act-plus 1.1.76 → 1.1.78
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 +6 -6
- package/lib/{dialogAddField-a77ac6b5.js → dialogAddField-6b36374f.js} +2 -2
- package/lib/{dialogConfigBtn-eebcdf33.js → dialogConfigBtn-bc3654e4.js} +2 -2
- package/lib/{dialogSiteComponentsParams-f85afc5d.js → dialogSiteComponentsParams-50ddae0f.js} +1 -1
- package/lib/{index-af485fe8.js → index-07ea7c6f.js} +1 -1
- package/lib/{index-49141176.js → index-4b01c50e.js} +1 -1
- package/lib/{index-b0a25bbc.js → index-7c99a393.js} +2 -2
- package/lib/{index-77ef0d15.js → index-96a5d15c.js} +1 -1
- package/lib/{index-581c47e6.js → index-9b985e07.js} +1 -1
- package/lib/{index-2426df0a.js → index-ada2bff9.js} +1 -1
- package/lib/{index-a7bca3db.js → index-c5b44aa1.js} +1 -1
- package/lib/{index-9744cb23.js → index-c69e0f9a.js} +462 -455
- package/lib/{index-b7b9f03f.js → index-d37c9fc1.js} +1 -1
- package/package.json +1 -1
- package/style.css +1 -1
package/act-plus.umd.cjs
CHANGED
|
@@ -18,17 +18,17 @@ ${h}`:c)}else throw o},onCacheKey:o=>JO(e,t,o)}}function F0(i){if(ne(i))return i
|
|
|
18
18
|
* vue-i18n v10.0.5
|
|
19
19
|
* (c) 2024 kazuya kawaguchi
|
|
20
20
|
* Released under the MIT License.
|
|
21
|
-
*/const J0="10.0.5";function eb(){typeof __VUE_I18N_FULL_INSTALL__!="boolean"&&(ln().__VUE_I18N_FULL_INSTALL__=!0),typeof __VUE_I18N_LEGACY_API__!="boolean"&&(ln().__VUE_I18N_LEGACY_API__=!0),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(ln().__INTLIFY_DROP_MESSAGE_COMPILER__=!1),typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(ln().__INTLIFY_PROD_DEVTOOLS__=!1)}const Ui={FALLBACK_TO_ROOT:y0,NOT_FOUND_PARENT_SCOPE:9,IGNORE_OBJ_FLATTEN:10,DEPRECATE_TC:11},tb={[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 yr(i,...e){return ur(tb[i],...e)}const Me={UNEXPECTED_RETURN_TYPE:l0,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:ib,args:e}:void 0)}const ib={[Me.UNEXPECTED_RETURN_TYPE]:"Unexpected return type in composer",[Me.INVALID_ARGUMENT]:"Invalid argument",[Me.MUST_BE_CALL_SETUP_TOP]:"Must be called at the top of a `setup` function",[Me.NOT_INSTALLED]:"Need to install with `app.use` function",[Me.UNEXPECTED_ERROR]:"Unexpected error",[Me.REQUIRED_VALUE]:"Required in value: {0}",[Me.INVALID_VALUE]:"Invalid value",[Me.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN]:"Cannot setup vue-devtools plugin",[Me.NOT_INSTALLED_WITH_PROVIDE]:"Need to install with `provide` function",[Me.NOT_COMPATIBLE_LEGACY_VUE_I18N]:"Not compatible legacy VueI18n.",[Me.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=si("__translateVNode"),wl=si("__datetimeParts"),kl=si("__numberParts"),cn=si("__enableEmitter"),us=si("__disableEmitter"),eu=si("__setPluralRules"),tu=si("__injectWithOption"),xl=si("__dispose");function fs(i){if(!Ce(i))return i;for(const e in i)if(zt(i,e))if(!e.includes("."))Ce(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]in s||(s[t[o]]=Ve()),!Ce(s[t[o]])){process.env.NODE_ENV!=="production"&&Bi(yr(Ui.IGNORE_OBJ_FLATTEN,{key:t[o]})),r=!0;break}s=s[t[o]]}r||(s[t[n]]=i[e],delete i[e]),Ce(s[t[n]])&&fs(s[t[n]])}return i}function Sl(i,e){const{messages:t,__i18n:n,messageResolver:s,flatJson:r}=e,o=ke(t)?t:We(n)?Ve():{[i]:Ve()};if(We(n)&&n.forEach(a=>{if("locale"in a&&"resource"in a){const{locale:c,resource:h}=a;c?(o[c]=o[c]||Ve(),pr(h,o[c])):pr(h,o)}else ne(a)&&pr(JSON.parse(a),o)}),s==null&&r)for(const a in o)zt(o,a)&&fs(o[a]);return o}function iu(i){return i.type}function nu(i,e,t){let n=Ce(e.messages)?e.messages:Ve();"__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(Ce(e.datetimeFormats)){const r=Object.keys(e.datetimeFormats);r.length&&r.forEach(o=>{i.mergeDateTimeFormat(o,e.datetimeFormats[o])})}if(Ce(e.numberFormats)){const r=Object.keys(e.numberFormats);r.length&&r.forEach(o=>{i.mergeNumberFormat(o,e.numberFormats[o])})}}}function su(i){return l.createVNode(l.Text,null,i,0)}const ru="__INTLIFY_META__",ou=()=>[],nb=()=>!1;let lu=0;function au(i){return(e,t,n,s)=>i(t,n,l.getCurrentInstance()||void 0,s)}const sb=()=>{const i=l.getCurrentInstance();let e=null;return i&&(e=iu(i)[ru])?{[ru]: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=Te(i.inheritLocale)?i.inheritLocale:!0;const a=r(e&&o?e.locale.value:ne(i.locale)?i.locale:cs),c=r(e&&o?e.fallbackLocale.value:ne(i.fallbackLocale)||We(i.fallbackLocale)||ke(i.fallbackLocale)||i.fallbackLocale===!1?i.fallbackLocale:a.value),h=r(Sl(a.value,i)),u=r(ke(i.datetimeFormats)?i.datetimeFormats:{[a.value]:{}}),f=r(ke(i.numberFormats)?i.numberFormats:{[a.value]:{}});let d=e?e.missingWarn:Te(i.missingWarn)||An(i.missingWarn)?i.missingWarn:!0,m=e?e.fallbackWarn:Te(i.fallbackWarn)||An(i.fallbackWarn)?i.fallbackWarn:!0,b=e?e.fallbackRoot:Te(i.fallbackRoot)?i.fallbackRoot:!0,w=!!i.fallbackFormat,g=Le(i.missing)?i.missing:null,p=Le(i.missing)?au(i.missing):null,O=Le(i.postTranslation)?i.postTranslation:null,C=e?e.warnHtmlMessage:Te(i.warnHtmlMessage)?i.warnHtmlMessage:!0,y=!!i.escapeParameter;const E=e?e.modifiers:ke(i.modifiers)?i.modifiers:{};let x=i.pluralRules||e&&e.pluralRules,k;k=(()=>{n&&Mh(null);const F={version:J0,locale:a.value,fallbackLocale:c.value,messages:h.value,modifiers:E,pluralRules:x,missing:p===null?void 0:p,missingWarn:d,fallbackWarn:m,fallbackFormat:w,unresolving:!0,postTranslation:O===null?void 0:O,warnHtmlMessage:C,escapeParameter:y,messageResolver:i.messageResolver,messageCompiler:i.messageCompiler,__meta:{framework:"vue"}};F.datetimeFormats=u.value,F.numberFormats=f.value,F.__datetimeFormatters=ke(k)?k.__datetimeFormatters:void 0,F.__numberFormatters=ke(k)?k.__numberFormatters:void 0,process.env.NODE_ENV!=="production"&&(F.__v_emitter=ke(k)?k.__v_emitter:void 0);const G=E0(F);return n&&Mh(G),G})(),hs(k,a.value,c.value);function N(){return[a.value,c.value,h.value,u.value,f.value]}const _=l.computed({get:()=>a.value,set:F=>{a.value=F,k.locale=a.value}}),A=l.computed({get:()=>c.value,set:F=>{c.value=F,k.fallbackLocale=c.value,hs(k,a.value,F)}}),S=l.computed(()=>h.value),M=l.computed(()=>u.value),T=l.computed(()=>f.value);function I(){return Le(O)?O:null}function B(F){O=F,k.postTranslation=F}function U(){return g}function Z(F){F!==null&&(p=au(F)),g=F,k.missing=p}function K(F,G){return F!=="translate"||!G.resolvedMessage}const X=(F,G,Pe,Fe,Li,rs)=>{N();let sn;try{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,n||(k.fallbackContext=e?T0():void 0),sn=F(k)}finally{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,n||(k.fallbackContext=void 0)}if(Pe!=="translate exists"&&Ye(sn)&&sn===Or||Pe==="translate exists"&&!sn){const[Mi,il]=G();if(process.env.NODE_ENV!=="production"&&e&&ne(Mi)&&K(Pe,il)&&(b&&(br(m,Mi)||Dh(d,Mi))&&Bi(yr(Ui.FALLBACK_TO_ROOT,{key:Mi,type:Pe})),process.env.NODE_ENV!=="production")){const{__v_emitter:os}=k;os&&b&&os.emit("fallback",{type:Pe,key:Mi,to:"global",groupId:`${Pe}:${Mi}`})}return e&&b?Fe(e):Li(Mi)}else{if(rs(sn))return sn;throw yt(Me.UNEXPECTED_RETURN_TYPE)}};function J(...F){return X(G=>Reflect.apply(Gh,null,[G,...F]),()=>_l(...F),"translate",G=>Reflect.apply(G.t,G,[...F]),G=>G,G=>ne(G))}function fe(...F){const[G,Pe,Fe]=F;if(Fe&&!Ce(Fe))throw yt(Me.INVALID_ARGUMENT);return J(G,Pe,tt({resolvedMessage:!0},Fe||{}))}function he(...F){return X(G=>Reflect.apply(Uh,null,[G,...F]),()=>gl(...F),"datetime format",G=>Reflect.apply(G.d,G,[...F]),()=>_r,G=>ne(G))}function ye(...F){return X(G=>Reflect.apply(qh,null,[G,...F]),()=>Ol(...F),"number format",G=>Reflect.apply(G.n,G,[...F]),()=>_r,G=>ne(G))}function z(F){return F.map(G=>ne(G)||Ye(G)||Te(G)?su(String(G)):G)}const V={normalize:z,interpolate:F=>F,type:"vnode"};function q(...F){return X(G=>{let Pe;const Fe=G;try{Fe.processor=V,Pe=Reflect.apply(Gh,null,[Fe,...F])}finally{Fe.processor=null}return Pe},()=>_l(...F),"translate",G=>G[yl](...F),G=>[su(G)],G=>We(G))}function H(...F){return X(G=>Reflect.apply(qh,null,[G,...F]),()=>Ol(...F),"number format",G=>G[kl](...F),ou,G=>ne(G)||We(G))}function Ue(...F){return X(G=>Reflect.apply(Uh,null,[G,...F]),()=>gl(...F),"datetime format",G=>G[wl](...F),ou,G=>ne(G)||We(G))}function Ri(F){x=F,k.pluralRules=x}function Re(F,G){return X(()=>{if(!F)return!1;const Pe=ne(G)?G:a.value,Fe=Dt(Pe),Li=k.messageResolver(Fe,F);return Zi(Li)||Zt(Li)||ne(Li)},()=>[F],"translate exists",Pe=>Reflect.apply(Pe.te,Pe,[F,G]),nb,Pe=>Te(Pe))}function qe(F){let G=null;const Pe=Qh(k,c.value,a.value);for(let Fe=0;Fe<Pe.length;Fe++){const Li=h.value[Pe[Fe]]||{},rs=k.messageResolver(Li,F);if(rs!=null){G=rs;break}}return G}function Wt(F){const G=qe(F);return G??(e?e.tm(F)||{}:{})}function Dt(F){return h.value[F]||{}}function ki(F,G){if(s){const Pe={[F]:G};for(const Fe in Pe)zt(Pe,Fe)&&fs(Pe[Fe]);G=Pe[F]}h.value[F]=G,k.messages=h.value}function Vi(F,G){h.value[F]=h.value[F]||{};const Pe={[F]:G};if(s)for(const Fe in Pe)zt(Pe,Fe)&&fs(Pe[Fe]);G=Pe[F],pr(G,h.value[F]),k.messages=h.value}function R(F){return u.value[F]||{}}function Q(F,G){u.value[F]=G,k.datetimeFormats=u.value,jh(k,F,G)}function W(F,G){u.value[F]=tt(u.value[F]||{},G),k.datetimeFormats=u.value,jh(k,F,G)}function Y(F){return f.value[F]||{}}function $e(F,G){f.value[F]=G,k.numberFormats=f.value,Wh(k,F,G)}function Xe(F,G){f.value[F]=tt(f.value[F]||{},G),k.numberFormats=f.value,Wh(k,F,G)}lu++,e&&Yt&&(l.watch(e.locale,F=>{o&&(a.value=F,k.locale=F,hs(k,a.value,c.value))}),l.watch(e.fallbackLocale,F=>{o&&(c.value=F,k.fallbackLocale=F,hs(k,a.value,c.value))}));const Qe={id:lu,locale:_,fallbackLocale:A,get inheritLocale(){return o},set inheritLocale(F){o=F,F&&e&&(a.value=e.locale.value,c.value=e.fallbackLocale.value,hs(k,a.value,c.value))},get availableLocales(){return Object.keys(h.value).sort()},messages:S,get modifiers(){return E},get pluralRules(){return x||{}},get isGlobal(){return n},get missingWarn(){return d},set missingWarn(F){d=F,k.missingWarn=d},get fallbackWarn(){return m},set fallbackWarn(F){m=F,k.fallbackWarn=m},get fallbackRoot(){return b},set fallbackRoot(F){b=F},get fallbackFormat(){return w},set fallbackFormat(F){w=F,k.fallbackFormat=w},get warnHtmlMessage(){return C},set warnHtmlMessage(F){C=F,k.warnHtmlMessage=F},get escapeParameter(){return y},set escapeParameter(F){y=F,k.escapeParameter=F},t:J,getLocaleMessage:Dt,setLocaleMessage:ki,mergeLocaleMessage:Vi,getPostTranslationHandler:I,setPostTranslationHandler:B,getMissingHandler:U,setMissingHandler:Z,[eu]:Ri};return Qe.datetimeFormats=M,Qe.numberFormats=T,Qe.rt=fe,Qe.te=Re,Qe.tm=Wt,Qe.d=he,Qe.n=ye,Qe.getDateTimeFormat=R,Qe.setDateTimeFormat=Q,Qe.mergeDateTimeFormat=W,Qe.getNumberFormat=Y,Qe.setNumberFormat=$e,Qe.mergeNumberFormat=Xe,Qe[tu]=t,Qe[yl]=q,Qe[wl]=Ue,Qe[kl]=H,process.env.NODE_ENV!=="production"&&(Qe[cn]=F=>{k.__v_emitter=F},Qe[us]=()=>{k.__v_emitter=void 0}),Qe}const cu="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"},rb={"vue-i18n-resource-inspector":"Search for scopes ..."},ob={"vue-i18n-timeline":16764185};let Ql;async function lb(i,e){return new Promise((t,n)=>{try{K0({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:[cu],app:i},s=>{Ql=s,s.on.visitComponentTree(({componentInstance:o,treeNode:a})=>{ab(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&&uu(a,o.vnode.el.__VUE_I18N__):uu(a,o.vnode.el.__VUE_I18N__))}),s.addInspector({id:"vue-i18n-resource-inspector",label:Al["vue-i18n-resource-inspector"],icon:"language",treeFilterPlaceholder:rb["vue-i18n-resource-inspector"]}),s.on.getInspectorTree(o=>{o.app===i&&o.inspectorId==="vue-i18n-resource-inspector"&&db(o,e)});const r=new Map;s.on.getInspectorState(async o=>{if(o.app===i&&o.inspectorId==="vue-i18n-resource-inspector")if(s.unhighlightElement(),mb(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=pb(o.nodeId,e);a&&s.highlightElement(a)}}),s.on.editInspectorState(o=>{o.app===i&&o.inspectorId==="vue-i18n-resource-inspector"&&Ob(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 hu(i){return i.type.name||i.type.displayName||i.type.__file||"Anonymous"}function ab(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 (${hu(i)} Scope)`,textColor:0,backgroundColor:16764185};e.tags.push(s)}}function uu(i,e){const t=cu;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];Le(n)&&"source"in n?e[t]=fb(n):Zi(n)&&n.loc&&n.loc.source?e[t]=n.loc.source:Ce(n)?e[t]=Pl(n):e[t]=n}),e}const cb={"<":"<",">":">",'"':""","&":"&"};function hb(i){return i.replace(/[<>"&]/g,ub)}function ub(i){return cb[i]||i}function fb(i){return{_custom:{type:"function",display:`<span>ƒ</span> ${i.source?`("${hb(i.source)}")`:"(?)"}`}}}function db(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:`${hu(n)} Scope`})}}function pb(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 fu(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 mb(i,e){const t=fu(i.nodeId,e);return t&&(i.state=gb(t)),null}function gb(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",h=[{type:c,key:"numberFormats",editable:!1,value:i.numberFormats.value}];e[c]=h}return e}function ds(i,e){if(Ql){let t;e&&"groupId"in e&&(t=e.groupId,delete e.groupId),Ql.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 Ob(i,e){const t=fu(i.nodeId,e);if(t){const[n]=i.path;n==="locale"&&ne(i.state.value)?t.locale.value=i.state.value:n==="fallbackLocale"&&(ne(i.state.value)||We(i.state.value)||Ce(i.state.value))?t.fallbackLocale.value=i.state.value:n==="inheritLocale"&&Te(i.state.value)&&(t.inheritLocale=i.state.value)}}function _b(i){const e=ne(i.locale)?i.locale:cs,t=ne(i.fallbackLocale)||We(i.fallbackLocale)||ke(i.fallbackLocale)||i.fallbackLocale===!1?i.fallbackLocale:e,n=Le(i.missing)?i.missing:void 0,s=Te(i.silentTranslationWarn)||An(i.silentTranslationWarn)?!i.silentTranslationWarn:!0,r=Te(i.silentFallbackWarn)||An(i.silentFallbackWarn)?!i.silentFallbackWarn:!0,o=Te(i.fallbackRoot)?i.fallbackRoot:!0,a=!!i.formatFallbackMessages,c=ke(i.modifiers)?i.modifiers:{},h=i.pluralizationRules,u=Le(i.postTranslation)?i.postTranslation:void 0,f=ne(i.warnHtmlInMessage)?i.warnHtmlInMessage!=="off":!0,d=!!i.escapeParameterHtml,m=Te(i.sync)?i.sync:!0;let b=i.messages;if(ke(i.sharedMessages)){const E=i.sharedMessages;b=Object.keys(E).reduce((k,P)=>{const N=k[P]||(k[P]={});return tt(N,E[P]),k},b||{})}const{__i18n:w,__root:g,__injectWithOption:p}=i,O=i.datetimeFormats,C=i.numberFormats,y=i.flatJson;return{locale:e,fallbackLocale:t,messages:b,flatJson:y,datetimeFormats:O,numberFormats:C,missing:n,missingWarn:s,fallbackWarn:r,fallbackRoot:o,fallbackFormat:a,modifiers:c,pluralRules:h,postTranslation:u,warnHtmlMessage:f,escapeParameter:d,messageResolver:i.messageResolver,inheritLocale:m,__i18n:w,__root:g,__injectWithOption:p}}function Tl(i={}){const e=Cl(_b(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 Te(e.missingWarn)?!e.missingWarn:e.missingWarn},set silentTranslationWarn(s){e.missingWarn=Te(s)?!s:s},get silentFallbackWarn(){return Te(e.fallbackWarn)?!e.fallbackWarn:e.fallbackWarn},set silentFallbackWarn(s){e.fallbackWarn=Te(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 h=null,u=null;if(process.env.NODE_ENV!=="production"&&wh(yr(Ui.DEPRECATE_TC)),!ne(r))throw yt(Me.INVALID_ARGUMENT);const f=r;return ne(o)?c.locale=o:Ye(o)?c.plural=o:We(o)?h=o:ke(o)&&(u=o),ne(a)?c.locale=a:We(a)?h=a:ke(a)&&(u=a),Reflect.apply(e.t,e,[f,h||u||{},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[cn]&&r[cn](s)},n.__disableEmitter=()=>{const s=e;s[us]&&s[us]()}),n}function bb(i,e,t){return{beforeCreate(){const n=l.getCurrentInstance();if(!n)throw yt(Me.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=du(i,r);else{r.__injectWithOption=!0,r.__extender=t.__vueI18nExtend,this.$i18n=Tl(r);const o=this.$i18n;o.__extender&&(o.__disposer=o.__extender(this.$i18n))}}else if(s.__i18n)if(this===this.$root)this.$i18n=du(i,s);else{this.$i18n=Tl({__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&&nu(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(Me.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 du(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[eu](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 yb({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},Ve())}function pu(){return l.Fragment}const mu=l.defineComponent({name:"i18n-t",props:tt({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:i=>Ye(i)||!isNaN(i)}},El),setup(i,e){const{slots:t,attrs:n}=e,s=i.i18n||Gt({useScope:i.scope,__useComponent:!0});return()=>{const r=Object.keys(t).filter(f=>f!=="_"),o=Ve();i.locale&&(o.locale=i.locale),i.plural!==void 0&&(o.plural=ne(i.plural)?+i.plural:i.plural);const a=yb(e,r),c=s[yl](i.keypath,a,o),h=tt(Ve(),n),u=ne(i.tag)||Ce(i.tag)?i.tag:pu();return l.h(u,h,c)}}});function wb(i){return We(i)&&!ne(i[0])}function gu(i,e,t,n){const{slots:s,attrs:r}=e;return()=>{const o={part:!0};let a=Ve();i.locale&&(o.locale=i.locale),ne(i.format)?o.key=i.format:Ce(i.format)&&(ne(i.format.key)&&(o.key=i.format.key),a=Object.keys(i.format).reduce((d,m)=>t.includes(m)?tt(Ve(),d,{[m]:i.format[m]}):d,Ve()));const c=n(i.value,o,a);let h=[o.key];We(c)?h=c.map((d,m)=>{const b=s[d.type],w=b?b({[d.type]:d.value,index:m,parts:c}):[d.value];return wb(w)&&(w[0].key=`${d.type}-${m}`),w}):ne(c)&&(h=[c]);const u=tt(Ve(),r),f=ne(i.tag)||Ce(i.tag)?i.tag:pu();return l.h(f,u,h)}}const Ou=l.defineComponent({name:"i18n-n",props:tt({value:{type:Number,required:!0},format:{type:[String,Object]}},El),setup(i,e){const t=i.i18n||Gt({useScope:i.scope,__useComponent:!0});return gu(i,e,Xh,(...n)=>t[kl](...n))}}),_u=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||Gt({useScope:i.scope,__useComponent:!0});return gu(i,e,Fh,(...n)=>t[wl](...n))}});function kb(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 xb(i){const e=o=>{const{instance:a,value:c}=o;if(!a||!a.$)throw yt(Me.UNEXPECTED_ERROR);const h=kb(i,a.$),u=bu(c);return[Reflect.apply(h.t,h,[...yu(u)]),h]};return{created:(o,a)=>{const[c,h]=e(a);Yt&&i.global===h&&(o.__i18nWatcher=l.watch(h.locale,()=>{a.instance&&a.instance.$forceUpdate()})),o.__composer=h,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,h=bu(a);o.textContent=Reflect.apply(c.t,c,[...yu(h)])}},getSSRProps:o=>{const[a]=e(o);return{textContent:a}}}}function bu(i){if(ne(i))return{path:i};if(ke(i)){if(!("path"in i))throw yt(Me.REQUIRED_VALUE,"path");return i}else throw yt(Me.INVALID_VALUE)}function yu(i){const{path:e,locale:t,args:n,choice:s,plural:r}=i,o={},a=n||{};return ne(t)&&(o.locale=t),Ye(s)&&(o.plural=s),Ye(r)&&(o.plural=r),[e,a,o]}function Sb(i,e,...t){const n=ke(t[0])?t[0]:{};(Te(n.globalInstall)?n.globalInstall:!0)&&([mu.name,"I18nT"].forEach(r=>i.component(r,mu)),[Ou.name,"I18nN"].forEach(r=>i.component(r,Ou)),[_u.name,"I18nD"].forEach(r=>i.component(r,_u))),i.directive("t",xb(e))}const Cb=si("global-vue-i18n");function wu(i={},e){const t=__VUE_I18N_LEGACY_API__&&Te(i.legacy)?i.legacy:__VUE_I18N_LEGACY_API__,n=Te(i.globalInjection)?i.globalInjection:!0,s=new Map,[r,o]=Ab(i,t),a=si(process.env.NODE_ENV!=="production"?"vue-i18n":"");function c(d){return s.get(d)||null}function h(d,m){s.set(d,m)}function u(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),ke(m[0])){const g=m[0];f.__composerExtend=g.__composerExtend,f.__vueI18nExtend=g.__vueI18nExtend}let b=null;!t&&n&&(b=Vb(d,f.global)),__VUE_I18N_FULL_INSTALL__&&Sb(d,f,...m),__VUE_I18N_LEGACY_API__&&t&&d.mixin(bb(o,o.__composer,f));const w=d.unmount;if(d.unmount=()=>{b&&b(),f.dispose(),w()},process.env.NODE_ENV!=="production"){if(!await lb(d,f))throw yt(Me.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN);const p=ol();if(t){const O=o;O.__enableEmitter&&O.__enableEmitter(p)}else{const O=o;O[cn]&&O[cn](p)}p.on("*",ds)}},get global(){return o},dispose(){r.stop()},__instances:s,__getInstance:c,__setInstance:h,__deleteInstance:u};return f}function Gt(i={}){const e=l.getCurrentInstance();if(e==null)throw yt(Me.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw yt(Me.NOT_INSTALLED);const t=Qb(e),n=Tb(t),s=iu(e),r=Pb(i,s);if(r==="global")return nu(n,i,s),n;if(r==="parent"){let c=Eb(t,e,i.__useComponent);return c==null&&(process.env.NODE_ENV!=="production"&&Bi(yr(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)),Nb(o,e,a),o.__setInstance(e,a)}return a}function Ab(i,e,t){const n=l.effectScope(),s=__VUE_I18N_LEGACY_API__&&e?n.run(()=>Tl(i)):n.run(()=>Cl(i));if(s==null)throw yt(Me.UNEXPECTED_ERROR);return[n,s]}function Qb(i){const e=l.inject(i.isCE?Cb:i.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw yt(i.isCE?Me.NOT_INSTALLED_WITH_PROVIDE:Me.UNEXPECTED_ERROR);return e}function Pb(i,e){return fr(i)?"__i18n"in e?"local":"global":i.useScope?i.useScope:"local"}function Tb(i){return i.mode==="composition"?i.global:i.global.__composer}function Eb(i,e,t=!1){let n=null;const s=e.root;let r=$b(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[tu]&&(n=null))}if(n!=null||s===r)break;r=r.parent}return n}function $b(i,e=!1){return i==null?null:e&&i.vnode.ctx||i.parent}function Nb(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[cn]&&s[cn](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[us]&&s[us](),delete e.vnode.el.__VUE_I18N__),i.__deleteInstance(e);const r=s[xl];r&&(r(),delete s[xl])},e)}const Rb=["locale","fallbackLocale","availableLocales"],ku=["t","rt","d","n","tm","te"];function Vb(i,e){const t=Object.create(null);return Rb.forEach(s=>{const r=Object.getOwnPropertyDescriptor(e,s);if(!r)throw yt(Me.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,ku.forEach(s=>{const r=Object.getOwnPropertyDescriptor(e,s);if(!r||!r.value)throw yt(Me.UNEXPECTED_ERROR);Object.defineProperty(i.config.globalProperties,`$${s}`,r)}),()=>{delete i.config.globalProperties.$i18n,ku.forEach(s=>{delete i.config.globalProperties[`$${s}`]})}}if(eb(),S0(i0),C0(b0),A0(Qh),process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const i=ln();i.__INTLIFY__=!0,n0(i.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}process.env.NODE_ENV;const xu="3.7.7",Lb=xu,$n=typeof Buffer=="function",Su=typeof TextDecoder=="function"?new TextDecoder:void 0,Cu=typeof TextEncoder=="function"?new TextEncoder:void 0,Mb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",ps=Array.prototype.slice.call(Mb),wr=(i=>{let e={};return i.forEach((t,n)=>e[t]=n),e})(ps),Bb=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,at=String.fromCharCode.bind(String),Au=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):i=>new Uint8Array(Array.prototype.slice.call(i,0)),Qu=i=>i.replace(/=/g,"").replace(/[+\/]/g,e=>e=="+"?"-":"_"),Pu=i=>i.replace(/[^A-Za-z0-9\+\/]/g,""),Tu=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):$n?i=>Buffer.from(i,"binary").toString("base64"):Tu,Nl=$n?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(""))},kr=(i,e=!1)=>e?Qu(Nl(i)):Nl(i),Db=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)}},vb=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Eu=i=>i.replace(vb,Db),$u=$n?i=>Buffer.from(i,"utf8").toString("base64"):Cu?i=>Nl(Cu.encode(i)):i=>$l(Eu(i)),Nn=(i,e=!1)=>e?Qu($u(i)):$u(i),Nu=i=>Nn(i,!0),Zb=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Ib=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))}},Ru=i=>i.replace(Zb,Ib),Vu=i=>{if(i=i.replace(/\s+/g,""),!Bb.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=wr[i.charAt(r++)]<<18|wr[i.charAt(r++)]<<12|(n=wr[i.charAt(r++)])<<6|(s=wr[i.charAt(r++)]),t+=n===64?at(e>>16&255):s===64?at(e>>16&255,e>>8&255):at(e>>16&255,e>>8&255,e&255);return t},Rl=typeof atob=="function"?i=>atob(Pu(i)):$n?i=>Buffer.from(i,"base64").toString("binary"):Vu,Lu=$n?i=>Au(Buffer.from(i,"base64")):i=>Au(Rl(i).split("").map(e=>e.charCodeAt(0))),Mu=i=>Lu(Bu(i)),Ub=$n?i=>Buffer.from(i,"base64").toString("utf8"):Su?i=>Su.decode(Lu(i)):i=>Ru(Rl(i)),Bu=i=>Pu(i.replace(/[-_]/g,e=>e=="-"?"+":"/")),Vl=i=>Ub(Bu(i)),Fb=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)},Du=i=>({value:i,enumerable:!1,writable:!0,configurable:!0}),vu=function(){const i=(e,t)=>Object.defineProperty(String.prototype,e,Du(t));i("fromBase64",function(){return Vl(this)}),i("toBase64",function(e){return Nn(this,e)}),i("toBase64URI",function(){return Nn(this,!0)}),i("toBase64URL",function(){return Nn(this,!0)}),i("toUint8Array",function(){return Mu(this)})},Zu=function(){const i=(e,t)=>Object.defineProperty(Uint8Array.prototype,e,Du(t));i("toBase64",function(e){return kr(this,e)}),i("toBase64URI",function(){return kr(this,!0)}),i("toBase64URL",function(){return kr(this,!0)})},jb={version:xu,VERSION:Lb,atob:Rl,atobPolyfill:Vu,btoa:$l,btoaPolyfill:Tu,fromBase64:Vl,toBase64:Nn,encode:Nn,encodeURI:Nu,encodeURL:Nu,utob:Eu,btou:Ru,decode:Vl,isValid:Fb,fromUint8Array:kr,toUint8Array:Mu,extendString:vu,extendUint8Array:Zu,extendBuiltins:()=>{vu(),Zu()}},qb="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=",Xb="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",Wb="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=",Yb="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",zb={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"},Iu=()=>{function i(o,a){try{const c=decodeURI(o.headers["content-disposition"]);let h=a||c.split("filename*=utf-8")[1];const u=h.substring(h.lastIndexOf(".")+1),f=new Blob([o.data],{type:zb[u]??"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),m=(window.URL||window.webkitURL).createObjectURL(f),b=document.createElement("a");b.setAttribute("href",m);const w=h.lastIndexOf(".");h=`${h.slice(0,w)}_${Ne.dayjs().format("YYYYMMDD")+h.slice(w)}`,b.setAttribute("download",h),document.body.appendChild(b),b.click(),document.body.removeChild(b),window.URL.revokeObjectURL(m)}catch(c){console.error(c)}}function e({multiple:o=!1},a){const c=document.createElement("input");c.style.display="none",c.setAttribute("type","file"),o&&c.setAttribute("multiple",o),c.setAttribute("accept","application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,.xml"),document.body.appendChild(c),c.click(),c.addEventListener("change",h=>{a(h)&&document.body.removeChild(c)})}function t(o){return o?o.substring(o.lastIndexOf("/")+1):""}function n(o){return o?new URL(Object.assign({"../static/images/upload-excel.png":qb,"../static/images/upload-file.png":Xb,"../static/images/upload-pdf.png":Wb,"../static/images/upload-word.png":Yb})[`../static/${o}`],self.location).href:""}function s(o,a,c){if(!a)return;let h=c||t(a);const u=h.lastIndexOf(".");h=`${h.slice(0,u)}_${Date.now()+h.slice(u)}`,o({url:a,method:"GET",responseType:"blob"}).then(f=>{const d=URL.createObjectURL(f.data),m=document.createElement("a");m.style.display="none",m.setAttribute("href",d),m.setAttribute("target","_blank"),m.setAttribute("download",h),document.body.appendChild(m),m.click(),document.body.removeChild(m),window.URL.revokeObjectURL(d)})}function r(o){if(!o)return;const a=document.createElement("input");a.value=o,document.body.appendChild(a),a.select(),document.execCommand("Copy"),a.remove(),Ne.ElNotification({title:"提示",message:"复制成功",type:"success",duration:2e3})}return{exportFile:i,importFile:e,getAssetsFileName:t,getAssetsFilePath:n,downloadFile:s,copy:r}},Uu={label:"name",value:"code",children:"children"},Fu={label:"key",value:"value"},xr={label:"name",value:"code",children:"children"},Gb={year:"year",month:"month",date:"day"};/*! Element Plus Icons Vue v2.3.1 */var Hb=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.592 30.592 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.592 30.592 0 0 0-42.752 0z"})]))}}),Kb=Hb,Jb=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"})]))}}),ey=Jb,ty=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"})]))}}),iy=ty,ny=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"})]))}}),sy=ny,ry=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=ry;const wT="",ct=(i,e)=>{const t=i.__vccOpts||i;for(const[n,s]of e)t[n]=s;return t},ly={class:"a-loading"},Sr=ct({__name:"index",setup(i){return(e,t)=>(l.openBlock(),l.createElementBlock("div",ly,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"]]),xT="",ay={key:0,class:"table-link"},cy=["onClick"],hy={class:"no-image"},uy={key:4},ju=ct({__name:"index",props:{pageKey:{type:String,default:""},defaultParams:{type:Array,default:()=>[]},matchData:{type:Object,default:()=>({})},maxHeight:{type:[String,Number],default:-1},tableConfig:{type:Object,default:()=>({})}},emits:["onClickRow","changeExpansionRow","refresh","load","operate"],setup(i,{expose:e,emit:t}){const n=l.defineAsyncComponent({loader:()=>Promise.resolve().then(()=>qy),loadingComponent:Sr,delay:20}),s=l.defineAsyncComponent({loader:()=>Promise.resolve().then(()=>Wy),loadingComponent:Sr,delay:20}),r=l.defineAsyncComponent({loader:()=>Promise.resolve().then(()=>zy),loadingComponent:Sr,delay:20}),o=l.defineAsyncComponent(()=>Promise.resolve().then(()=>Ky)),a=l.defineAsyncComponent(()=>Promise.resolve().then(()=>t1)),{t:c}=Gt(),h=l.inject("actModules"),u=l.inject("apiPrefix"),f=l.inject("request"),d=l.inject("themeColor"),m=l.inject("cacheTokenType"),b=l.inject("cookieStorage"),w=rn.useRoute(),g=rn.useRouter(),p=t,O=i,C=()=>({pageLoading:!1,tableLoading:!1,tableTotal:0,tableSelection:[],tableQuery:{pageIndex:1,pageSize:10},showFormDialog:!1,showEditorPreDialog:!1,dialogTitle:"",editorDialogTitle:"",dialogData:{}});let y=l.reactive(C()),E=l.ref("loading"),x=l.ref([]),k={},P=[],N=l.ref([]),_=l.ref([]),A=l.ref([]),S=l.ref([]),M=l.ref([]),T=l.ref({});const I=l.ref(null),B=l.ref(null),U=l.ref(null),Z=l.ref(null),K=l.ref(0);let X=l.ref({});const J=$=>f({url:`${u}/sysOperate/getMenuOfOperateByRole`,method:"post",data:$}),fe=$=>f({url:`${u}/pages/getPageDetail?key=${$}`,method:"get"}),he=()=>{y=l.reactive(C()),E.value="loading",x.value=[],k={},P=[],N.value=[],_.value=[],A.value=[],S.value=[],M.value=[],X.value={}},ye=()=>{l.nextTick(()=>{setTimeout(()=>{var ue,ae,re,te,ee,Oe,me;const $=((ae=(ue=I.value)==null?void 0:ue.$el)==null?void 0:ae.offsetHeight)||0,v=((te=(re=B.value)==null?void 0:re.$el)==null?void 0:te.offsetHeight)||0,le=((Oe=(ee=U.value)==null?void 0:ee.$el)==null?void 0:Oe.offsetHeight)||0,pe=$-v-le-6;K.value=O.maxHeight>0?O.maxHeight:(me=k==null?void 0:k.tableConfig)!=null&&me.isPagination?pe-48:pe},500)})},z=()=>[...os(P)],D=$=>{Z.value.updateSelection($)},V=()=>y.tableSelection,q=async()=>{await ti(P),p("refresh")},H=$=>{if(!$||!$.tableQueryDefaultValue)return;const le=Wt($)["value-format"]||"YYYY-MM-DD HH:mm:ss";if($.fieldType=="date"&&$.tableQueryDefaultValue=="nowYear")return Ne.dayjs().format(le);if($.fieldType=="date"&&$.tableQueryDefaultValue=="yearAgo")return Ne.dayjs().subtract(1,"year").format(le);if($.fieldType=="dateRange"&&$.tableQueryDefaultValue.includes("&")){const pe=$.tableQueryDefaultValue.split("&");return[Ne.dayjs(pe[0]).subtract(6,"month").format(le),Ne.dayjs(pe[1]).format(le)]}if($.fieldType=="dateRange"&&$.tableQueryDefaultValue=="yearAgo")return[Ne.dayjs().subtract(1,"year").format(le),Ne.dayjs().format(le)];if($.fieldType=="dateRange"&&$.tableQueryDefaultValue=="sixMonthsAgo")return[Ne.dayjs().subtract(6,"month").format(le),Ne.dayjs().format(le)]},Ue=($,v)=>{if(!(v.row&&Object.keys(v.row).length))return;const pe=(v.row[$.fieldKey]??"").split(";"),ue=pe&&pe.length?pe[0]:"",ae=ue.substring(ue.lastIndexOf(".")+1);return/(gif|jpg|jpeg|png|pdf|bmp|webp|GIF|JPG|PDF|PNG|JPEG)$/.test(ae)},Ri=($,v)=>{if(!(v.row&&Object.keys(v.row).length))return;const pe=(v.row[$.fieldKey]??"").split(";");return pe&&pe.length?pe[0]:""},Re=($,v)=>{if(!(v.row&&Object.keys(v.row).length))return;const le=v.row[$.fieldKey]??null;return le?le.split(";"):[]},qe=$=>$==="true",Wt=$=>new Function("",$.fieldUiProps)()||{},Dt=async($,v)=>Reflect.has(h,`/src/views${$}.vue`)?l.markRaw(l.defineAsyncComponent(h[`/src/views${$}.vue`])):null,ki=async($,v)=>Reflect.has(h,`/src/views${$}.vue`)?l.markRaw(l.defineAsyncComponent({loader:h[`/src/views${$}.vue`],loadingComponent:Sr,delay:20})):null,Vi=async()=>{k.buttons=await Promise.all(k.buttons.map(async $=>{if($.isCustomBtn&&$.customType=="component"){const{customComponentUrl:v,customComponentName:le}=$,pe=await Dt(v);$[le]=pe}return $}))},R=async()=>{const $=k.fields.filter(v=>(v.formCustomComponentes??[]).some(le=>le.permissionCode=="tableShow"&&le.isFieldCustom));M.value=await Promise.all($.map(async v=>{const le=v.formCustomComponentes.find(re=>re.permissionCode=="tableShow"),{customComponentUrl:pe,customComponentName:ue}=le,ae=await Dt(pe);return v.customTableHeaderName=ue,v.customTableHeaderUrl=pe,v[`customTableHeaderInstance_${ue}`]=ae,v.headerItem={label:v.fieldName,prop:v.fieldKey,align:v.tableCellAlignType,width:v.tableCellWidthType=="default"?v.tableCellWidth:"",minWidth:v.tableCellWidthType=="min"?v.tableCellWidth:"",showOverflowTooltip:v.isTableCellOverflowTooltip||!1,sort:v.isTableCellSort||!1},v}))},Q=($,v)=>{switch($){case"array":return typeof v=="string"?v.toString().split().sort((le,pe)=>le.sort-pe.sort):[v];case"number":return Number(v);case"boolean":return!!v;default:return v}},W=($,v)=>v[$.fieldKey]?v[$.fieldKey].toString().includes("T")?Ne.dayjs(v[$.fieldKey]).format("YYYY-MM-DD HH:mm:ss"):v[$.fieldKey]:"";function Y($,v={}){return $.replace(/\{([^}]+)\}/g,(le,pe)=>{const ue=pe.trim().split(".");let ae=v;for(const re of ue){if(!ae||typeof ae!="object")break;ae=ae[re]}return ae!==void 0?ae:le})}const $e=$=>$?Y($,O.matchData):"",Xe=($,v,le)=>{switch($){case"LessThanOrEqual":return v<=le;case"LessThan":return v<le;case"GreaterThanOrEqual":return v>=le;case"GreaterThan":return v>le;case"NotEqual":return v!=le;case"Equal":return v==le;default:return v==le}},Qe=($,v)=>{if(!$.matchFields.length)return!0;const le=re=>re.matchType=="default"?v[re.matchFieldName]:O.matchData[re.matchType][re.matchFieldName];let ue=$.matchFields.reduce((re,te,ee)=>{const Oe=le(te),me=Xe(te.matchCondition,Oe,te.fieldValue==""?null:te.fieldValue=="true"||te.fieldValue=="false"?qe(te.fieldValue):te.fieldValue);return re+=me,ee!==$.matchFields.length-1&&(re+=te.spliceCondition||"&&"),re},"").split("||"),ae=ue.reduce((re,te,ee)=>(re+=`(${te})`,ee<ue.length-1&&(re+="||"),re),"");return new Function(`return ${ae}`)()},F=($,v)=>Object.keys(v).length?x.value.some(le=>le.unique==$.permissionCode)&&Qe($,v):!1,G=async $=>{try{y.pageLoading=!0;const v=O.pageKey??w.params.key,{data:{pageConfigs:le}}=await fe(v);return k=le.pageConfig?JSON.parse(le.pageConfig):{},y.tableQuery.pageSize=k.tableConfig.pageSize||10,y.pageLoading=!1,Promise.resolve(Object.keys(k).length)}catch(v){y.pageLoading=!1,console.error(v)}},Pe=async($=[],v={},le=!0,pe=!1)=>{try{const ue=$.filter(te=>["select","multipleSelect","selectIcon","switch","virtualizedSelect","virtualizedMultipleSelect","fullLoadTreeSelect","provinceCascade"].includes(te.fieldType)&&(!Reflect.has(te,"dataList")||!te.dataList.length||pe)),re=(await Promise.allSettled(ue.map(async te=>{const ee=te.postRequestParams.filter(lt=>lt.submitType==="default").reduce((lt,ii)=>(lt[ii.submitName]=Q(ii.paramsType,ii.submitValue),lt),{}),Oe=te.postRequestParams.filter(lt=>lt.submitType==="match").reduce((lt,ii)=>(lt[ii.submitName]=Q(ii.paramsType,v[ii.submitValue][ii.submitName]),lt),{}),me=te.postRequestParams.filter(lt=>lt.submitType==="dynamic").map(lt=>({field:lt.submitName,operate:lt.submitMatchType,value:Q(lt.paramsType,lt.submitValue)}));let He={};Object.keys(ee).length&&(He={...He,...ee}),Object.keys(Oe).length&&(He={...He,...Oe}),me.length&&(He.dynamicFilters=me);const{data:xi}=await f({url:te.fieldRequestUrl,method:te.fieldRequestType||"GET",data:He});return Promise.resolve({...te,dataList:xi||[]})}))).filter(te=>te.status==="fulfilled"&&Reflect.has(te,"value")).map(te=>te.value);return le&&k.fields.forEach(te=>{const ee=re.find(Oe=>te.fieldName==Oe.fieldName&&te.fieldKey==Oe.fieldKey);ee&&(te.dataList=(ee==null?void 0:ee.dataList)??[])}),re}catch(ue){console.error(ue)}},Fe=l.computed(()=>{const{tableConfig:{tableMoreBtnSplitNumber:$}}=k;return!$||$>=_.value.length}),Li=()=>{const{tableConfig:{tableMoreBtnSplitNumber:$}}=k;return Fe.value?_.value:_.value.slice(0,$)},rs=()=>{var v;const{tableConfig:{tableMoreBtnSplitNumber:$}}=k;return Fe.value?[]:_.value.slice($,(v=_.value)==null?void 0:v.length)},sn=async $=>{try{const v=($||[]).filter(ae=>ae.useScenes.some(re=>["tableShow"].includes(re))).sort((ae,re)=>ae.sort-re.sort),le=["editor","upload","date"];let pe=v.map(ae=>{const re=ae.formCustomComponentes.some(te=>te.permissionCode=="tableShow"&&te.isFieldCustom);return{label:ae.fieldName,prop:ae.fieldKey,align:ae.tableCellAlignType,width:ae.tableCellWidthType=="default"?ae.tableCellWidth:"",minWidth:ae.tableCellWidthType=="min"?ae.tableCellWidth:"",showOverflowTooltip:ae.isTableCellOverflowTooltip||!1,sort:ae.isTableCellSort||!1,render:!!ae.fieldRequestUrl||ae.tableCellContentType=="link"||le.includes(ae.fieldType),isCustomTableHeader:re}});k.tableConfig.isSerialNumber&&pe.unshift({prop:"serialNumber",width:80}),k.tableConfig.isCheckRow&&pe.unshift({prop:"checkbox",width:50});const ue=_.value.filter(ae=>x.value.some(re=>re.unique==ae.permissionCode));k.tableConfig.isOperateRow&&ue.length&&pe.push({label:c("act.operate"),prop:"operate",width:k.tableConfig.tableOperateCellWidth,render:!0,fixed:"right"}),S.value=v.filter(ae=>!!ae.fieldRequestUrl&&ae.useScenes.includes("tableShow")||ae.tableCellContentType=="link"||le.includes(ae.fieldType)),N.value=pe}catch(v){console.error(v)}},Mi=()=>{_.value=(k.buttons||[]).filter($=>$.permissionCode!==1001&&$.btnPostion.includes("table")).sort(($,v)=>$.sort-v.sort).map($=>($.loading=!1,$.btnAlias&&($.btnName=$.btnAlias),$))},il=()=>k.fields.filter($=>$.useScenes.includes("tableSearch")).map($=>(["date","dateRange"].includes($.fieldType)?$.queryValue=$.tableQueryDefaultValue?$.tableQueryDefaultValue:H($):$.queryValue=($==null?void 0:$.tableQueryDefaultValue)||void 0,O.defaultParams.some(v=>{v.field==$.fieldKey&&v.operate===$.tableQueryCondition&&($.queryValue=v.value)}),$)),os=($,v="queryValue")=>$?($||[]).filter(pe=>!!pe[v]).reduce((pe,ue)=>{var re;const ae=Wt(ue);if(ue.fieldType==="date"&&ae["value-format"]!=="YYYY"){const te=ae!=null&&ae.dayJsType?Gb[(re=ue.fieldUiProps)==null?void 0:re.dayJsType]:"day",ee=ae["value-format"]||"YYYY-MM-DD HH:mm:ss";pe=[...pe,{field:ue.fieldKey,operate:"GreaterThanOrEqual",value:Ne.dayjs(ue[v]).startOf(te).format(ee)},{field:ue.fieldKey,operate:"LessThanOrEqual",value:Ne.dayjs(ue[v]).endOf(te).format(ee)}]}else if(ue.fieldType==="dateRange"&&ue[v].length)if(ue.fieldKey.includes("&")){const te=ue.fieldKey.split("&")||[];pe=[...pe,{field:te[0],operate:"GreaterThanOrEqual",value:ue.queryValue[0]},{field:te[1],operate:"LessThanOrEqual",value:ue.queryValue[1]}]}else pe=[...pe,{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[v].length){const te=(ue.fieldKey.split("&")||[]).map((ee,Oe)=>({field:ee,operate:"Equal",value:ue.queryValue[Oe]}));pe=[...pe,...te]}else return Array.isArray(ue[v])&&!ue[v].length?[...pe]:[...pe,{field:ue.fieldKey,operate:ue.tableQueryCondition,value:ue.tableQueryCondition==="In"&&ue[v]&&typeof ue[v]=="string"?ue[v].split(";"):ue[v]=="true"||ue[v]=="false"?qe(ue[v]):ue[v]}];return pe},[]):[],uT=($,v)=>{if(!$.dataList||!Reflect.has(v,$.fieldKey))return"";const le=v[$.fieldKey];if(!le&&le!==0&&le!==!1)return"";const pe=Wt($),ue=Object.assign({key:"key",value:"value"},pe.props||{});return["virtualizedSelect","virtualizedMultipleSelect"].includes($.fieldType)&&(ue.key=ue.label),["multipleSelect","select","switch","virtualizedSelect","virtualizedMultipleSelect","selectIcon"].includes($.fieldType)?($.dataList||[]).filter(ae=>{const re=$.fieldType==="selectIcon"?`btn-${ae[ue.value]}`:ae[ue.value],te=re=="true"||re=="false"?qe(re):re;return Array.isArray(le)?le.some(ee=>ee==re==ee):typeof le=="string"?le.split(";").includes(te):le==te}).map(ae=>ae[ue.key]).join(";"):le},ti=async($=[])=>{try{y.tableLoading=!0;const v=O.defaultParams.filter(ae=>!(k.fields??[]).some(re=>re.fieldKey===ae.field&&re.tableQueryCondition===ae.operate&&re.useScenes.includes("tableSearch"))),le=k.tableConfig.defaultParams.map(ae=>({field:ae.submitFieldName,operate:ae.matchValue,value:Q(ae.submitFieldType,ae.defaultValue)})),pe=[...v,...le,...os($)];k.tableConfig.isPagination||(y.tableQuery.pageSize=9999);const{data:ue}=await f({url:k.tableConfig.dataUrl,method:"POST",data:{...y.tableQuery,dynamicFilters:pe}});y.tableTotal=ue.totalCount||0,A.value=ue.datas||[],y.tableLoading=!1}catch(v){y.tableLoading=!1,console.error(v)}},YO=async()=>{try{E.value="loading";const $=O.pageKey;if(!await G($)){E.value="end";return}await R(),await Vi(),await Pe(k.fields.filter(ae=>ae.useScenes.some(re=>["tableSearch","tableShow"].includes(re)))),E.value="success";let le="";m==="sessionStorage"?le=sessionStorage.getItem("accessToken"):le=b.getItemValue("accessToken");const ue=JSON.parse(jb.decode(le.split(".")[1]))["http://schemas.microsoft.com/ws/2008/06/identity/claims/role"];x.value=(await J({roleId:ue,key:$})).data.datas||[],Mi(),sn(k.fields),ye(),P=il(),(!Reflect.has(k.tableConfig,"isExecuteImmediatelyTableApi")||k.tableConfig.isExecuteImmediatelyTableApi)&&await ti(P),p("load"),console.log(k)}catch($){console.error($),E.value="end"}};l.provide("globalProps",O),l.provide("loadComponents",Dt),l.provide("defineAsyncLoadComponents",ki),l.provide("stringToBoolean",qe),l.provide("matchCondition",Xe),l.provide("menuPermissionBtns",x),l.provide("getTableData",ti),l.provide("tableBtnRefs",T.value),l.provide("formatDataType",Q),l.provide("getFieldUiProps",Wt),l.provide("disposeRequestData",Pe),l.provide("disposeDate",H),l.provide("getDefaultQueryValues",il),l.watch(()=>O.pageKey,($,v)=>{he(),YO()},{immediate:!0});const zO=async($,v)=>{P=$,await ti($),p("refresh"),v(!0)},fT=$=>{p("operate",$),ti(P)},nl=($,v)=>{const{exportFile:le,importFile:pe,downloadFile:ue}=Iu();if($.isCustomBtn){if($.customType=="component"&&!Reflect.has($,[$.customComponentName])){Ne.ElNotification({title:"提示",message:`当前自定义按钮未创建vue文件,请在路径【/src/views${$.customComponentUrl}】下创建vue文件`,type:"warning",duration:2500});return}if($.customType=="code"){try{new Function("router","route","data","configItem",$.codeStr)(g,w,v,$)}catch(te){console.error(te)}return}const re=`${$.customComponentName}-${$.permissionCode}`;T.value[re]&&T.value[re].onTigger({rowData:v,tableSelection:y.tableSelection});return}if($.submitWay=="associationSubTable"){Ne.ElNotification({title:c("act.tip"),message:c("act.developing"),type:"warning",duration:2500});return}if(["export","exportUrl"].includes($.submitWay)){$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!0:v[`loading${$.permissionCode}`]=!0;let re=[...O.defaultParams,...os(P)],te=($.submitFields||[]).reduce((Oe,me)=>{if(me.matchType=="default")Oe=[...Oe,{field:me.submitFieldName,operate:me.submitFieldType==="array"?"In":"Equal",value:Q(me.submitFieldType,me.matchFieldName)}];else if(me.matchType=="match"){const He=me.submitFieldMatchOrigin==="rowData"?v:O.matchData[me.submitFieldMatchOrigin];Oe=[...Oe,{field:me.submitFieldName,operate:me.submitFieldType==="array"?"In":"Equal",value:Q(me.submitFieldType,He[me.matchFieldName])}]}else if(me.matchType=="selection"){const He=y.tableSelection.map(xi=>xi[me.matchFieldName]);Oe=[...Oe,{field:me.submitFieldName,operate:me.submitFieldType==="array"?"In":"Equal",value:me.submitFieldType==="string"?He.join():He}]}return Oe},[]);const ee=[...re,...te];f({url:$e($.requestUrl),method:"post",data:{dynamicFilters:ee},responseType:["exportUrl"].includes($.submitWay)?"json":"blob"}).then(Oe=>{$.submitWay=="exportUrl"?ue(f,Oe.data):le(Oe),p("operate",$),$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:v[`loading${$.permissionCode}`]=!1}).catch(Oe=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:v[`loading${$.permissionCode}`]=!1});return}if(["import","batchImport"].includes($.submitWay)){pe({multiple:$.submitWay=="batchImport"},re=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!0:v[`loading${$.permissionCode}`]=!0;const te=new FormData;if(($.submitFields||[]).forEach(ee=>{var Oe,me;if(ee.matchType=="default")te.append(ee.submitFieldName,Q(ee.submitFieldType,ee.matchFieldName));else if(ee.matchType=="match")(Oe=Object.keys(v))!=null&&Oe.length&&te.append(ee.submitFieldName,Q(ee.submitFieldType,v[ee.matchFieldName]));else if(ee.matchType=="query"){const He=((me=P.find(xi=>xi.fieldKey==ee.matchFieldName))==null?void 0:me.queryValue)??null;te.append(ee.submitFieldName,Q(ee.submitFieldType,He))}}),$.submitWay=="import")te.append($.importFileName||"file",re.target.files[0]);else for(let ee of re.target.files)te.append($.importFileName||"files",ee);return f({url:$e($.requestUrl),method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:te}).then(ee=>{Ne.ElNotification({title:c("act.tip"),message:`${ee.msg}`,type:"success",duration:2500}),p("operate",$),ti(P),$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:v[`loading${$.permissionCode}`]=!1}).catch(()=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:v[`loading${$.permissionCode}`]=!1})});return}if($.submitWay==="executeApi"){let re=($.submitFields||[]).reduce((te,ee)=>{var Oe;if(ee.matchType=="default")te[ee.submitFieldName]=Q(ee.submitFieldType,ee.matchFieldName);else if(ee.matchType=="match"){const me=ee.submitFieldMatchOrigin==="rowData"?v:O.matchData[ee.submitFieldMatchOrigin];te[ee.submitFieldName]=Q(ee.submitFieldType,me[ee.matchFieldName])}else ee.matchType=="query"&&(te[ee.submitFieldName]=((Oe=P.find(me=>me.fieldKey==ee.matchFieldName))==null?void 0:Oe.queryValue)??null);return te},{});if($.btnPostion==="header"&&$.isPromptVerificationSelectTable=="1"){if(!k.tableConfig.isCheckRow){Ne.ElNotification({title:c("act.tip"),message:c("act.configTableRow"),type:"warning",duration:2500});return}if(!y.tableSelection.length){Ne.ElNotification({title:c("act.tip"),message:`${c("act.pleaseSelcet")}${$.btnName}${c("act.data")}`,type:"warning",duration:2500});return}}if($.btnPostion==="header"){const te=($.submitFields||[]).filter(ee=>ee.matchType=="selection").reduce((ee,Oe)=>(ee[Oe.submitFieldName]=y.tableSelection.reduce((me,He)=>(Oe.submitFieldType==="array"?me=[...me,...Q(Oe.submitFieldType,He[Oe.matchFieldName])]:me=[...me,Q(Oe.submitFieldType,He[Oe.matchFieldName])],me),[]),ee),{});Object.assign(re,te)}$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!0:v[`loading${$.permissionCode}`]=!0,f({url:$e($.requestUrl),method:"post",data:re}).then(te=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:v[`loading${$.permissionCode}`]=!1,Ne.ElNotification({type:"success",title:c("act.tip"),message:`${$.btnName}${c("act.success")}`,duration:2500}),p("operate",$),ti(P)}).catch(te=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:v[`loading${$.permissionCode}`]=!1});return}if($.submitWay==="messageBox"){if($.btnPostion==="header"&&$.isPromptVerificationSelectTable=="1"){if(!k.tableConfig.isCheckRow){Ne.ElNotification({title:c("act.tip"),message:c("act.configTableRow"),type:"warning",duration:2500});return}if(!y.tableSelection.length){Ne.ElNotification({title:c("act.tip"),message:`${c("act.pleaseSelcet")}${$.btnName}${c("act.data")}`,type:"warning",duration:2500});return}}Ne.ElMessageBox.confirm(`${c("act.isExecuteOperate")}?`,c("act.tip"),{confirmButtonText:c("act.enter"),cancelButtonText:c("act.cancel"),type:"warning"}).then(()=>{let re=($.submitFields||[]).reduce((te,ee)=>{var Oe;if(ee.matchType=="default")te[ee.submitFieldName]=Q(ee.submitFieldType,ee.matchFieldName);else if(ee.matchType=="match"){const me=ee.submitFieldMatchOrigin==="rowData"?v:O.matchData[ee.submitFieldMatchOrigin];te[ee.submitFieldName]=Q(ee.submitFieldType,me[ee.matchFieldName])}else ee.matchType=="query"&&(te[ee.submitFieldName]=((Oe=P.find(me=>me.fieldKey==ee.matchFieldName))==null?void 0:Oe.queryValue)??null);return te},{});if($.btnPostion==="header"){const te=($.submitFields||[]).filter(ee=>ee.matchType=="selection").reduce((ee,Oe)=>(ee[Oe.submitFieldName]=y.tableSelection.reduce((me,He)=>(Oe.submitFieldType==="array"?me=[...me,...Q(Oe.submitFieldType,He[Oe.matchFieldName])]:me=[...me,Q(Oe.submitFieldType,He[Oe.matchFieldName])],me),[]),ee),{});Object.assign(re,te)}$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!0:v[`loading${$.permissionCode}`]=!0,f({url:$e($.requestUrl),method:"post",data:re}).then(te=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:v[`loading${$.permissionCode}`]=!1,Ne.ElNotification({type:"success",title:c("act.tip"),message:`${$.btnName}${c("act.success")}`,duration:2500}),p("operate",$),ti(P)}).catch(te=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:v[`loading${$.permissionCode}`]=!1})}).catch(re=>{});return}if($.btnPostion==="header"&&$.submitWay==="dialog"&&($.submitFields||[]).some(re=>re.submitFieldMatchOrigin==="selections")&&!y.tableSelection.length){if(!k.tableConfig.isCheckRow){Ne.ElNotification({title:c("act.tip"),message:c("act.configTableRow"),type:"warning",duration:2500});return}if(!y.tableSelection.length){Ne.ElNotification({title:c("act.tip"),message:`${c("act.pleaseSelcet")}${$.btnName}${c("act.data")}`,type:"warning",duration:2500});return}return}let ae=(k.fields||[]).filter(re=>re.useScenes.includes($.permissionCode)).map(re=>(re.customFiledsComponentes=re.formCustomComponentes.find(te=>te.permissionCode==$.permissionCode)||{},re));if(!ae.length){Ne.ElNotification({title:c("act.tip"),message:c("act.buttonBindField"),type:"warning",duration:2500});return}if($.submitWay==="dialog"){y.dialogTitle=$.btnName,y.dialogData={dataItem:{...$},rowData:{...v},selections:y.tableSelection||[],formConfig:k.formConfig,formList:ae},y.showFormDialog=!0;return}},dT=($,v,le)=>{p("onClickRow",$,v,le)},pT=($,v)=>{X.value=$,p("changeExpansionRow",$,v)},mT=($,v)=>{y.editorDialogTitle=`${c("act.preview")}${$.fieldName}`,y.dialogData={...v,editorContent:v[$.fieldKey]},y.showEditorPreDialog=!0};return e({loadData:YO,getDynamicFiltersData:z,getTableData:ti,getTableSelection:V,setTableSelection:D}),($,v)=>{const le=l.resolveComponent("el-table-column"),pe=l.resolveComponent("el-image"),ue=l.resolveComponent("el-link"),ae=l.resolveComponent("a-svg-icon"),re=l.resolveComponent("el-button"),te=l.resolveComponent("el-dropdown-item"),ee=l.resolveComponent("el-dropdown-menu"),Oe=l.resolveComponent("el-dropdown"),me=l.resolveComponent("el-empty"),He=l.resolveComponent("el-card"),xi=l.resolveDirective("debounce"),lt=l.resolveDirective("loading");return l.withDirectives((l.openBlock(),l.createBlock(He,{class:"act-module",ref_key:"actModuleRef",ref:I,shadow:"never"},{default:l.withCtx(()=>{var ii,GO;return[l.unref(E)==="success"?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[l.createVNode(l.unref(n),{ref_key:"queryModuleRef",ref:B,data:l.unref(k),onReset:zO,onSearch:zO},null,8,["data"]),l.createVNode(l.unref(s),{ref_key:"headerButtonsModuleRef",ref:U,data:l.unref(k),onOnOperate:nl},null,8,["data"]),l.createVNode(l.unref(r),{ref_key:"aTableRef",ref:Z,loading:l.unref(y).tableLoading,total:l.unref(y).tableTotal,tableQuery:l.unref(y).tableQuery,"onUpdate:tableQuery":v[0]||(v[0]=_e=>l.unref(y).tableQuery=_e),selection:l.unref(y).tableSelection,"onUpdate:selection":v[1]||(v[1]=_e=>l.unref(y).tableSelection=_e),headers:l.unref(N),data:l.unref(A),showPagination:(GO=(ii=l.unref(k))==null?void 0:ii.tableConfig)==null?void 0:GO.isPagination,tableConfig:O.tableConfig,maxHeight:K.value,onRefresh:q,onOnRowClick:dT,onChangeExpand:pT},l.createSlots({operate:l.withCtx(({scope:_e})=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(Li(),(ge,ni)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:ni},[F(ge,_e.row)?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[ge.isCustomBtn&&ge.customType=="component"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(ge[ge.customComponentName]),{key:0,ref_for:!0,ref:Cn=>l.unref(T)[`${ge.customComponentName}-${ge.permissionCode}`]=Cn,buttonData:ge,scope:_e,onRefresh:ti},{default:l.withCtx(()=>[l.withDirectives((l.openBlock(),l.createBlock(re,{class:"ml4",type:"primary",link:"",size:"small",loading:_e.row[`loading${ge.permissionCode}`],onClick:Cn=>nl(ge,_e.row)},{default:l.withCtx(()=>[ge.btnIcon&&!_e.row[`loading${ge.permissionCode}`]?(l.openBlock(),l.createBlock(ae,{key:0,class:"mr2",name:ge.btnIcon,width:"12",height:"12",color:l.unref(d)},null,8,["name","color"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(_e.row[`loading${ge.permissionCode}`]?ge.btnName+l.unref(c)("act.loading")+"...":ge.btnName),1)]),_:2},1032,["loading","onClick"])),[[xi]])]),_:2},1064,["buttonData","scope"])):l.withDirectives((l.openBlock(),l.createBlock(re,{key:1,class:"ml4",type:"primary",link:"",size:"small",loading:_e.row[`loading${ge.permissionCode}`],onClick:Cn=>nl(ge,_e.row)},{default:l.withCtx(()=>[ge.btnIcon&&!_e.row[`loading${ge.permissionCode}`]?(l.openBlock(),l.createBlock(ae,{key:0,class:"mr2",name:ge.btnIcon,width:"12",height:"12",color:l.unref(d)},null,8,["name","color"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(_e.row[`loading${ge.permissionCode}`]?ge.btnName+l.unref(c)("act.loading")+"...":ge.btnName),1)]),_:2},1032,["loading","onClick"])),[[xi]])],64)):l.createCommentVNode("",!0)],64))),128)),Fe.value?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(Oe,{key:0,class:"table-opreate-dropdown"},{dropdown:l.withCtx(()=>[l.createVNode(ee,null,{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(rs(),(ge,ni)=>(l.openBlock(),l.createBlock(te,{key:ni,onClick:Cn=>nl(ge,_e.row)},{default:l.withCtx(()=>[F(ge,_e.row)?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[ge.isCustomBtn&&ge.customType=="component"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(ge[ge.customComponentName]),{key:0,ref_for:!0,ref:Cn=>l.unref(T)[`${ge.customComponentName}-${ge.permissionCode}`]=Cn,buttonData:ge,scope:_e,onRefresh:ti},{default:l.withCtx(()=>[l.withDirectives((l.openBlock(),l.createBlock(re,{class:"ml4",type:"primary",link:"",size:"small",loading:_e.row[`loading${ge.permissionCode}`]},{default:l.withCtx(()=>[ge.btnIcon&&!_e.row[`loading${ge.permissionCode}`]?(l.openBlock(),l.createBlock(ae,{key:0,class:"mr2",name:ge.btnIcon,width:"12",height:"12",color:l.unref(d)},null,8,["name","color"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(_e.row[`loading${ge.permissionCode}`]?ge.btnName+l.unref(c)("act.loading")+"...":ge.btnName),1)]),_:2},1032,["loading"])),[[xi]])]),_:2},1064,["buttonData","scope"])):l.withDirectives((l.openBlock(),l.createBlock(re,{key:1,class:"ml4",type:"primary",link:"",size:"small",loading:_e.row[`loading${ge.permissionCode}`]},{default:l.withCtx(()=>[ge.btnIcon&&!_e.row[`loading${ge.permissionCode}`]?(l.openBlock(),l.createBlock(ae,{key:0,class:"mr2",name:ge.btnIcon,width:"12",height:"12",color:l.unref(d)},null,8,["name","color"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(_e.row[`loading${ge.permissionCode}`]?ge.btnName+l.unref(c)("act.loading")+"...":ge.btnName),1)]),_:2},1032,["loading"])),[[xi]])],64)):l.createCommentVNode("",!0)]),_:2},1032,["onClick"]))),128))]),_:2},1024)]),default:l.withCtx(()=>[l.createVNode(re,{class:"table-btn-more",icon:l.unref(sy),size:"small",circle:""},null,8,["icon"])]),_:2},1024))]),_:2},[l.renderList(l.unref(M),(_e,ge)=>({name:_e.fieldKey,fn:l.withCtx(()=>[_e[`customTableHeaderInstance_${_e.customTableHeaderName}`]?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(_e[`customTableHeaderInstance_${_e.customTableHeaderName}`]),{key:0,data:_e,configData:l.unref(k),rowData:l.unref(X)},null,8,["data","configData","rowData"])):(l.openBlock(),l.createBlock(le,{key:1,label:_e.fieldName+l.unref(c)("act.customTableHeader"),width:"260"},null,8,["label"]))])})),l.renderList(l.unref(S),(_e,ge)=>({name:_e.fieldKey,fn:l.withCtx(({scope:ni})=>[_e.tableCellContentType=="link"?(l.openBlock(),l.createElementBlock("span",ay,l.toDisplayString(ni.row[_e.fieldKey]),1)):_e.fieldType=="editor"?(l.openBlock(),l.createElementBlock("span",{key:1,class:"table-link",onClick:Cn=>mT(_e,ni.row)},"点击预览",8,cy)):_e.fieldType=="upload"?(l.openBlock(),l.createElementBlock(l.Fragment,{key:2},[Ue(_e,ni)?(l.openBlock(),l.createBlock(pe,{key:0,class:"file-image",fit:"cover","preview-src-list":Re(_e,ni),"preview-teleported":"",src:Ri(_e,ni)},{error:l.withCtx(()=>[l.createElementVNode("div",hy,l.toDisplayString(_e("act.noImage")),1)]),_:2},1032,["preview-src-list","src"])):(l.openBlock(),l.createBlock(ue,{key:1,type:"primary"}))],64)):_e.fieldType=="date"?(l.openBlock(),l.createElementBlock(l.Fragment,{key:3},[l.createTextVNode(l.toDisplayString(W(_e,ni.row)),1)],64)):(l.openBlock(),l.createElementBlock("span",uy,l.toDisplayString(uT(_e,ni.row)),1))])}))]),1032,["loading","total","tableQuery","selection","headers","data","showPagination","tableConfig","maxHeight"])],64)):l.createCommentVNode("",!0),l.createVNode(l.unref(o),{visible:l.unref(y).showFormDialog,"onUpdate:visible":v[2]||(v[2]=_e=>l.unref(y).showFormDialog=_e),title:l.unref(y).dialogTitle,data:l.unref(y).dialogData,onRefresh:fT},null,8,["visible","title","data"]),l.createVNode(l.unref(a),{visible:l.unref(y).showEditorPreDialog,"onUpdate:visible":v[3]||(v[3]=_e=>l.unref(y).showEditorPreDialog=_e),title:l.unref(y).editorDialogTitle,data:l.unref(y).dialogData},null,8,["visible","title","data"]),l.unref(E)==="end"?(l.openBlock(),l.createBlock(me,{key:1,description:l.unref(c)("act.noConfigPage")},{image:l.withCtx(()=>[l.createVNode(ae,{name:"config-nodata",width:"200",height:"200"})]),_:1},8,["description"])):l.createCommentVNode("",!0)]}),_:1})),[[lt,l.unref(y).pageLoading]])}}},[["__scopeId","data-v-a0e34299"]]),fy=[{key:"按钮形式",value:"default"},{key:"文字形式",value:"text"}],dy=[{key:"顶部",value:"header"},{key:"表格",value:"table"}],py=[{key:"主题色",value:"primary"},{key:"绿色",value:"success"},{key:"灰色",value:"info"},{key:"橙黄色",value:"warning"},{key:"红色",value:"danger"},{key:"浅蓝",value:"primary-light"}],my=[{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"}],gy=[{key:"数组",value:"array"},{key:"字符串",value:"string"},{key:"数字",value:"number"},{key:"布尔",value:"boolean"}],Oy=[{key:"且",value:"&&"},{key:"或",value:"||"}],_y=[{key:"默认值",value:"default"},{key:"匹配",value:"match"},{key:"选择列",value:"selection"},{key:"查询条件",value:"query"}],by=[{key:"默认匹配",value:"default"},{key:"用户信息变量",value:"userInfo"}],yy=[{key:"组件",value:"component"},{key:"代码",value:"code"}],wy=[{key:"GET",value:"GET"},{key:"POST",value:"POST"}],qu=[{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"}],ky=[{key:"默认值",value:"default"},{key:"匹配",value:"match"},{key:"dynamic",value:"dynamic"}],xy=[{key:"数组",value:"array"},{key:"字符串",value:"string"},{key:"数字",value:"number"}],Sy=[{key:"居中",value:"center"},{key:"左对齐",value:"left"},{key:"右对齐",value:"right"}],Cy=[{key:"默认",value:"default"},{key:"链接",value:"link"},{key:"标签",value:"tag"}],Ay=[{key:"默认宽",value:"default"},{key:"最小宽",value:"min"}],Xu=[{key:"数组",value:"array"},{key:"字符串",value:"string"},{key:"数字",value:"number"},{key:"布尔",value:"boolean"}],Qy=[{key:"左侧",value:"right"},{key:"上侧",value:"top"}],Py=[{key:"是",value:"1"},{key:"否",value:"0"}],Wu=[{label:"表格配置",options:[{key:"表格查询",value:"tableSearch"},{key:"表格展示",value:"tableShow"}]},{label:"表单配置",options:[]}],Ty={__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 h=l.resolveComponent("el-input-number"),u=l.resolveComponent("el-form-item"),f=l.resolveComponent("el-col"),d=l.resolveComponent("el-option"),m=l.resolveComponent("el-select"),b=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(b,null,{default:l.withCtx(()=>[l.createVNode(f,{span:8},{default:l.withCtx(()=>[l.createVNode(u,{label:"弹窗宽度"},{default:l.withCtx(()=>[l.createVNode(h,{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(u,{label:"排版列数"},{default:l.withCtx(()=>[l.createVNode(h,{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(u,{label:"label宽度"},{default:l.withCtx(()=>[l.createVNode(h,{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(u,{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(Qy),(p,O)=>(l.openBlock(),l.createBlock(d,{key:O+"labelPosition",label:p.key,value:p.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),_:1})}}},CT="",Ey=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(b=>{["defaultParams"].includes(b)?a.value[b]=[...m[b]||[]]:b==="tableMoreBtnSplitNumber"?a.value[b]=Reflect.has(m,"tableMoreBtnSplitNumber")?m[b]:0:b==="headerMoreBtnSplitNumber"?a.value[b]=Reflect.has(m,"headerMoreBtnSplitNumber")?m[b]:0:b==="isExecuteImmediatelyTableApi"?a.value[b]=Reflect.has(m,"isExecuteImmediatelyTableApi")?m[b]:!0:a.value[b]=m[b]})}},{deep:!0,immediate:!0});const c=()=>{a.value.defaultParams.push({submitFieldName:"",defaultValue:"",matchValue:"",submitFieldType:""})},h=f=>{a.value.defaultParams.splice(f,1)},u=f=>{f||(a.value.pageSize=10)};return e({formRef:o,form:a}),(f,d)=>{const m=l.resolveComponent("el-input"),b=l.resolveComponent("el-form-item"),w=l.resolveComponent("el-col"),g=l.resolveComponent("el-row"),p=l.resolveComponent("el-button"),O=l.resolveComponent("el-divider"),C=l.resolveComponent("el-option"),y=l.resolveComponent("el-select"),E=l.resolveComponent("el-switch"),x=l.resolveComponent("el-input-number"),k=l.resolveComponent("el-form"),P=l.resolveComponent("el-card");return l.openBlock(),l.createBlock(P,{class:"form-card",shadow:"hover",header:"表格配置"},{default:l.withCtx(()=>[l.createVNode(k,{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(b,{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]=N=>l.unref(a).dataUrl=N),placeholder:"请输入",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),l.createVNode(O,{"content-position":"left"},{default:l.withCtx(()=>[d[14]||(d[14]=l.createTextVNode(" 表格默认参数配置 ")),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,(N,_)=>(l.openBlock(),l.createBlock(g,{class:"table-post-params",key:_},{default:l.withCtx(()=>[l.createVNode(w,{span:12},{default:l.withCtx(()=>[l.createVNode(b,{label:"字段",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"defaultParams."+_+".submitFieldName"},{default:l.withCtx(()=>[l.createVNode(m,{modelValue:N.submitFieldName,"onUpdate:modelValue":A=>N.submitFieldName=A,placeholder:"请输入",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(w,{span:12},{default:l.withCtx(()=>[l.createVNode(b,{label:"匹配条件",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"defaultParams."+_+".matchValue"},{default:l.withCtx(()=>[l.createVNode(y,{modelValue:N.matchValue,"onUpdate:modelValue":A=>N.matchValue=A,placeholder:"请选择",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(r),(A,S)=>(l.openBlock(),l.createBlock(C,{key:S,label:A.key,value:A.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(w,{span:12},{default:l.withCtx(()=>[l.createVNode(b,{label:"默认值",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"defaultParams."+_+".defaultValue"},{default:l.withCtx(()=>[l.createVNode(m,{modelValue:N.defaultValue,"onUpdate:modelValue":A=>N.defaultValue=A,placeholder:"请输入",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(w,{span:12},{default:l.withCtx(()=>[l.createVNode(b,{label:"提交类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"defaultParams."+_+".submitFieldType"},{default:l.withCtx(()=>[l.createVNode(y,{modelValue:N.submitFieldType,"onUpdate:modelValue":A=>N.submitFieldType=A,placeholder:"请选择",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Xu),(A,S)=>(l.openBlock(),l.createBlock(C,{key:S,label:A.key,value:A.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(O,{"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:A=>h(_)},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(b,{label:"多选列"},{default:l.withCtx(()=>[l.createVNode(E,{modelValue:l.unref(a).isCheckRow,"onUpdate:modelValue":d[1]||(d[1]=N=>l.unref(a).isCheckRow=N)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:6},{default:l.withCtx(()=>[l.createVNode(b,{label:"操作列"},{default:l.withCtx(()=>[l.createVNode(E,{modelValue:l.unref(a).isOperateRow,"onUpdate:modelValue":d[2]||(d[2]=N=>l.unref(a).isOperateRow=N)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:6},{default:l.withCtx(()=>[l.createVNode(b,{label:"分页"},{default:l.withCtx(()=>[l.createVNode(E,{modelValue:l.unref(a).isPagination,"onUpdate:modelValue":d[3]||(d[3]=N=>l.unref(a).isPagination=N),onChange:u},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:6},{default:l.withCtx(()=>[l.createVNode(b,{label:"序号列"},{default:l.withCtx(()=>[l.createVNode(E,{modelValue:l.unref(a).isSerialNumber,"onUpdate:modelValue":d[4]||(d[4]=N=>l.unref(a).isSerialNumber=N)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:6},{default:l.withCtx(()=>[l.createVNode(b,{label:"排序"},{default:l.withCtx(()=>[l.createVNode(E,{modelValue:l.unref(a).isSort,"onUpdate:modelValue":d[5]||(d[5]=N=>l.unref(a).isSort=N)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:6},{default:l.withCtx(()=>[l.createVNode(b,{label:"展/收查询条件"},{default:l.withCtx(()=>[l.createVNode(E,{modelValue:l.unref(a).isExpandQuery,"onUpdate:modelValue":d[6]||(d[6]=N=>l.unref(a).isExpandQuery=N),onChange:u},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:6},{default:l.withCtx(()=>[l.createVNode(b,{label:"立即执行接口"},{default:l.withCtx(()=>[l.createVNode(E,{modelValue:l.unref(a).isExecuteImmediatelyTableApi,"onUpdate:modelValue":d[7]||(d[7]=N=>l.unref(a).isExecuteImmediatelyTableApi=N)},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(b,{label:"操作列宽度","label-width":"150"},{default:l.withCtx(()=>[l.createVNode(x,{modelValue:l.unref(a).tableOperateCellWidth,"onUpdate:modelValue":d[8]||(d[8]=N=>l.unref(a).tableOperateCellWidth=N),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(b,{label:"分页页数",prop:"pageSize","label-width":"150",rules:[{required:!0,message:"必填项",trigger:"blur"}]},{default:l.withCtx(()=>[l.createVNode(x,{modelValue:l.unref(a).pageSize,"onUpdate:modelValue":d[9]||(d[9]=N=>l.unref(a).pageSize=N),min:10},null,8,["modelValue"])]),_:1})]),_:1})):l.createCommentVNode("",!0),l.createVNode(w,{span:8},{default:l.withCtx(()=>[l.createVNode(b,{label:"查询条件label宽度","label-width":"150"},{default:l.withCtx(()=>[l.createVNode(x,{modelValue:l.unref(a).tableQueryLabelWidth,"onUpdate:modelValue":d[10]||(d[10]=N=>l.unref(a).tableQueryLabelWidth=N),min:80},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:8},{default:l.withCtx(()=>[l.createVNode(b,{label:"查询条件列数","label-width":"150"},{default:l.withCtx(()=>[l.createVNode(x,{modelValue:l.unref(a).tableQueryRowWidth,"onUpdate:modelValue":d[11]||(d[11]=N=>l.unref(a).tableQueryRowWidth=N),min:1},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:8},{default:l.withCtx(()=>[l.createVNode(b,{label:"表格更多按钮分割数","label-width":"150"},{default:l.withCtx(()=>[l.createVNode(x,{modelValue:l.unref(a).tableMoreBtnSplitNumber,"onUpdate:modelValue":d[12]||(d[12]=N=>l.unref(a).tableMoreBtnSplitNumber=N),min:0},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:8},{default:l.withCtx(()=>[l.createVNode(b,{label:"顶部更多按钮分割数","label-width":"150"},{default:l.withCtx(()=>[l.createVNode(x,{modelValue:l.unref(a).headerMoreBtnSplitNumber,"onUpdate:modelValue":d[13]||(d[13]=N=>l.unref(a).headerMoreBtnSplitNumber=N),min:0},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),_:1})}}},[["__scopeId","data-v-fa895b16"]]),QT="",$y=ct({__name:"configBtns",props:{modelValue:{type:Object,default:()=>[]}},emits:["update:modelValue"],setup(i,{expose:e,emit:t}){const n=rn.useRoute(),s=l.inject("apiPrefix"),r=l.inject("request"),o=l.defineAsyncComponent(()=>Promise.resolve().then(()=>n1)),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:[]}),h=()=>({tableLoading:!1,showConfigBtnDialog:!1,dialogData:{}});let u=l.reactive(h()),f=l.ref(null),d=0,m=l.ref([]),b=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=k=>r({url:`${s}/sysMenus/getAllList`,method:"post",data:k}),O=k=>r({url:`${s}/sysMenus/getMenuOfOperate`,method:"get",params:k}),C=(k,P)=>{b.value.includes(k.permissionCode)||b.value.push(k.permissionCode),Object.assign(g.value[d],k),P(!0)},y=async k=>{try{u.tableLoading=!0;const P=a.id?a.id:n.params.id,{data:N}=await O({id:P});b.value=(N||[]).filter(_=>(k||[]).some(A=>A.permissionCode==_.unique)).map(_=>_.unique),g.value=(N||[]).map((_,A)=>{let S=c(),M=(k||[]).find(T=>T.permissionCode==_.unique)||{};return{...S,btnIcon:_.icon||"",...M,btnName:_.name,permissionCode:_.unique,sort:M.sort?M.sort:(A+1)*10}}).sort((_,A)=>_.sort-A.sort),u.tableLoading=!1}catch(P){u.tableLoading=!1,console.error(P)}},E=()=>f.value.getSelectionRows()||[];l.provide("associationMenuList",m),l.provide("createDefaultButtonItem",c),l.watch(()=>a.modelValue,async(k,P)=>{try{const N=a.id?a.id:n.params.id;m.value=(await p({dynamicFilters:[{field:"parentId",operate:"Equal",value:N}]})).data||[],await y(k)}catch(N){u.tableLoading=!1,console.error(N)}},{deep:!0});const x=k=>{u.dialogData=k.row,d=k.$index,u.showConfigBtnDialog=!0};return e({getTableSelectionRows:E}),(k,P)=>{const N=l.resolveComponent("el-tag"),_=l.resolveComponent("el-input-number"),A=l.resolveComponent("el-button"),S=l.resolveComponent("a-table"),M=l.resolveComponent("el-card");return l.openBlock(),l.createBlock(M,{class:"form-card",shadow:"hover"},{header:l.withCtx(()=>P[2]||(P[2]=[l.createElementVNode("div",{class:"card-header"},[l.createElementVNode("div",{class:"card-header-title"},"按钮配置")],-1)])),default:l.withCtx(()=>[l.createVNode(S,{ref_key:"tableRef",ref:f,loading:l.unref(u).tableLoading,rowKey:"permissionCode",selection:l.unref(b),"onUpdate:selection":P[0]||(P[0]=T=>l.isRef(b)?b.value=T:b=T),headers:l.unref(w),data:l.unref(g),showPagination:!1},{isCustomBtn:l.withCtx(({scope:T})=>[l.createVNode(N,{type:"primary",effect:"dark",size:"small"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(T.row.isCustomBtn?"是":"否"),1)]),_:2},1024)]),sort:l.withCtx(({scope:T})=>[l.createVNode(_,{modelValue:T.row.sort,"onUpdate:modelValue":I=>T.row.sort=I,min:0},null,8,["modelValue","onUpdate:modelValue"])]),operate:l.withCtx(({scope:T})=>[l.createVNode(A,{type:"primary",text:"",size:"small",icon:"Aim",onClick:I=>x(T)},{default:l.withCtx(()=>P[3]||(P[3]=[l.createTextVNode(" 配置 ")])),_:2},1032,["onClick"])]),_:1},8,["loading","selection","headers","data"]),l.createVNode(l.unref(o),{visible:l.unref(u).showConfigBtnDialog,"onUpdate:visible":P[1]||(P[1]=T=>l.unref(u).showConfigBtnDialog=T),title:"配置按钮",data:l.unref(u).dialogData,onRefresh:C},null,8,["visible","data"])]),_:1})}}},[["__scopeId","data-v-8c801481"]]),TT="",Ny={class:"card-header"},Ry=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"}],h=l.ref([]);Wu[0].options.map(C=>({btnName:C.key,permissionCode:C.value}));const u=C=>{if(!Reflect.has(C,"fieldType"))return"";const y=qu.find(E=>E.value==C.fieldType);return(y==null?void 0:y.key)||""},f=C=>Reflect.has(C,"useScenes")?(C.formCustomComponentes??[]).filter(y=>C.useScenes.includes(y.permissionCode)):[],d=C=>(C.formCustomComponentes||[]).filter(y=>y.isFieldCustom).map(y=>`${y.btnName}:是`).join(),m=(C,y)=>{if(a==null){const E=h.value.length;h.value.push({...C,sort:(E+1)*10})}else h.value[a]={...C,postRequestParams:[...C.postRequestParams],useScenes:[...C.useScenes],formCustomComponentes:[...C.formCustomComponentes]};n("update:modelValue",h.value),y(!0)},b=async()=>{try{o.tableLoading=!0,h.value=(s.modelValue||[]).map(C=>({...C,sort:C.sort?C.sort:0})).sort((C,y)=>C.sort-y.sort),o.tableLoading=!1}catch(C){o.tableLoading=!1,console.error(C)}};l.watch(()=>s.modelValue,async(C,y)=>{await b()},{deep:!0,immediate:!0});const w=()=>{a=null,o.dialogData={},o.showAddFieldDialog=!0},g=C=>{a=C.$index,o.dialogData=C.row,o.showAddFieldDialog=!0},p=()=>{n("update:modelValue",h.value)},O=C=>{h.value.splice(C.$index,1),n("update:modelValue",h.value)};return(C,y)=>{const E=l.resolveComponent("el-button"),x=l.resolveComponent("el-tag"),k=l.resolveComponent("el-badge"),P=l.resolveComponent("el-input-number"),N=l.resolveComponent("a-table"),_=l.resolveComponent("el-card");return l.openBlock(),l.createBlock(_,{class:"form-card",shadow:"hover"},{header:l.withCtx(()=>[l.createElementVNode("div",Ny,[y[3]||(y[3]=l.createElementVNode("div",{class:"card-header-title"},"字段配置",-1)),l.createVNode(E,{class:"card-header-operate",type:"primary",icon:"Plus",onClick:y[0]||(y[0]=A=>w())},{default:l.withCtx(()=>y[2]||(y[2]=[l.createTextVNode("添加字段")])),_:1})])]),default:l.withCtx(()=>[l.createVNode(N,{loading:l.unref(o).tableLoading,headers:l.unref(c),data:l.unref(h),showPagination:!1},{fieldType:l.withCtx(({scope:A})=>[l.createTextVNode(l.toDisplayString(u(A.row)),1)]),useScenes:l.withCtx(({scope:A})=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(f(A.row),(S,M)=>(l.openBlock(),l.createBlock(k,{key:M,value:S.isFieldCustom?"C":"",offset:[-5,5]},{default:l.withCtx(()=>[l.createVNode(x,{style:{margin:"0 4px"},type:"success",effect:"dark",size:"small"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(S.btnName),1)]),_:2},1024)]),_:2},1032,["value"]))),128))]),formCustomComponentes:l.withCtx(({scope:A})=>[d(A.row)?(l.openBlock(),l.createBlock(x,{key:0,type:"primary",effect:"dark",size:"small"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(d(A.row)),1)]),_:2},1024)):l.createCommentVNode("",!0)]),sort:l.withCtx(({scope:A})=>[l.createVNode(P,{modelValue:A.row.sort,"onUpdate:modelValue":S=>A.row.sort=S,min:0,onChange:p},null,8,["modelValue","onUpdate:modelValue"])]),operate:l.withCtx(({scope:A})=>[l.createVNode(E,{type:"primary",text:"",size:"small",icon:"EditPen",onClick:S=>g(A)},{default:l.withCtx(()=>y[4]||(y[4]=[l.createTextVNode("编辑")])),_:2},1032,["onClick"]),l.createVNode(E,{type:"danger",text:"",size:"small",icon:"Delete",onClick:S=>O(A)},{default:l.withCtx(()=>y[5]||(y[5]=[l.createTextVNode("删除")])),_:2},1032,["onClick"])]),_:1},8,["loading","headers","data"]),l.createVNode(l.unref(t),{visible:l.unref(o).showAddFieldDialog,"onUpdate:visible":y[1]||(y[1]=A=>l.unref(o).showAddFieldDialog=A),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-75e750d2"]]),$T="",Vy={class:"dialog-footer"},Ly=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=rn.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 h=l.reactive(c()),u=l.ref([]),f=l.ref(null),d=l.ref(a());const m=C=>s({url:`${n}/scripts/getAllDatabaseTable`,method:"get",data:C}),b=async()=>{try{h.loading=!0;const{data:C}=await m();u.value=C||[],h.loading=!1}catch(C){console.error(C),h.loading=!1}};l.watch(()=>o.visible,async(C,y)=>{C&&await b()});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=C=>{p(),C()},p=()=>{d.value=Object.assign(d.value,a()),f.value.resetFields(),r("update:visible",!1)},O=C=>{C&&C.validate(async y=>{if(y)try{h.btnLoading=!0;const{data:E}=await s({url:`${n}/scripts/getAllColumnsByTableName`,method:"get",params:{tableName:d.value.dataBase}}),x=(E||[]).map(k=>{let P=w();return P.fieldName=k.comment,P.fieldKey=k.name,P.fieldType="string",P});r("refresh",{formList:x},()=>{p()}),h.btnLoading=!1}catch(E){console.error(E),h.btnLoading=!1}})};return(C,y)=>{const E=l.resolveComponent("el-option"),x=l.resolveComponent("el-select"),k=l.resolveComponent("el-form-item"),P=l.resolveComponent("el-input"),N=l.resolveComponent("el-form"),_=l.resolveComponent("el-button"),A=l.resolveComponent("el-dialog"),S=l.resolveDirective("loading"),M=l.resolveDirective("debounce");return l.openBlock(),l.createBlock(A,{"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",Vy,[l.createVNode(_,{loading:l.unref(h).btnLoading,onClick:p},{default:l.withCtx(()=>y[3]||(y[3]=[l.createTextVNode("取消")])),_:1},8,["loading"]),l.withDirectives((l.openBlock(),l.createBlock(_,{type:"primary",loading:l.unref(h).btnLoading,onClick:y[2]||(y[2]=T=>O(l.unref(f)))},{default:l.withCtx(()=>y[4]||(y[4]=[l.createTextVNode("保存")])),_:1},8,["loading"])),[[M]])])]),default:l.withCtx(()=>[l.withDirectives((l.openBlock(),l.createBlock(N,{ref_key:"formRef",ref:f,model:l.unref(d),"label-suffix":":","label-position":"top"},{default:l.withCtx(()=>[l.createVNode(k,{label:"数据库","label-width":"120",rules:[{required:!1,message:"必填项",trigger:"change"}],prop:"dataBase"},{default:l.withCtx(()=>[l.createVNode(x,{modelValue:l.unref(d).dataBase,"onUpdate:modelValue":y[0]||(y[0]=T=>l.unref(d).dataBase=T),placeholder:"请选择数据库",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(u),(T,I)=>(l.openBlock(),l.createBlock(E,{key:T,label:`${T.tableComment}【${T.tableName}】`,value:T.tableName},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l.createVNode(k,{label:"接口地址(关键字)","label-width":"120",rules:[{required:!1,message:"必填项",trigger:"change"}],prop:"api"},{default:l.withCtx(()=>[l.createVNode(P,{modelValue:l.unref(d).api,"onUpdate:modelValue":y[1]||(y[1]=T=>l.unref(d).api=T),placeholder:"请输入接口地址(关键字)",clearable:""},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])),[[S,l.unref(h).loading]])]),_:1},8,["model-value","title"])}}},[["__scopeId","data-v-8fa48448"]]),RT="",My={class:"page-container"},By={class:"submit-box"},Dy={class:"submit-box-r"},Yu=ct({__name:"index",props:{pageKey:{type:String,default:""},id:{type:String,default:void 0}},setup(i){const e=rn.useRoute(),t=rn.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([]),h=l.ref(),u=l.ref([]),f=l.ref({}),d=l.ref(null),m=l.ref(null),b=l.ref(null),w=l.ref({}),g=l.ref({}),p=l.ref([]),O=l.ref([]),C=l.reactive({pageLoading:!1,saveBtnLoading:!1,showDialogInitConfig:!1});const y=B=>s({url:`${n}/pages/getPageDetail?key=${B}`,method:"get"}),E=B=>s({url:`${n}/pageConfigs/createOrEdit`,method:"post",data:B}),x=B=>s({url:`${n}/sysMenus/getAllList`,method:"post",data:B}),k=B=>s({url:`${n}/sysDataDictionaries/getDictionaryByGroup?groupName=${B}`,method:"get"}),P=async()=>{const{data:B}=await x({dynamicFilters:[{field:"url",operate:"Equal",value:"/pages"}]});c.value=B||[]},N=async()=>{try{const{data:{pageConfigs:B}}=await y(a),U=JSON.parse(B.pageConfig)||{};o=B.pageId,console.log("pageConfigData",U),f.value=U,w.value={...U.tableConfig??{}},g.value={...U.formConfig??{}},p.value=[...U.buttons??[]],O.value=[...U.fields??[]]}catch(B){console.error(B)}},_=()=>{w.value={},g.value={},p.value=[],O.value=[],N()};l.provide("conditionList",()=>u),l.provide("pageKey",()=>l.ref(a)),l.provide("configData",()=>f),l.onMounted(async()=>{try{C.pageLoading=!0,await P(),h.value=e.params.id,u.value=(await k("Condition")).data||[],await N(),C.pageLoading=!1}catch(B){C.pageLoading=!1,console.error(B)}});const A=B=>{const U=c.value.find(Z=>Z.id==B);t.replace({path:`/actConfig/${U.key}/${U.id}`}),h.value=U.id,a=U.key,N()},S=()=>{C.showDialogInitConfig=!0},M=({formList:B},U)=>{O.value=[...B],U(!0)},T=()=>{let B={id:o,key:a,pageConfig:{tableConfig:d.value.form,formConfig:m.value.form,buttons:b.value.getTableSelectionRows(),fields:O.value}};B.pageConfig=JSON.stringify(B.pageConfig),C.saveBtnLoading=!0,E(B).then(U=>{Ne.ElNotification({title:"提示",message:"保存成功",type:"success",duration:2500}),_(),C.saveBtnLoading=!1}).catch(U=>{C.saveBtnLoading=!1})},I=async()=>{Promise.all([d.value.formRef.validate(),m.value.formRef.validate()]).then(B=>{B.every(U=>U)&&T()}).catch(B=>B)};return(B,U)=>{const Z=l.resolveComponent("el-button"),K=l.resolveComponent("el-option"),X=l.resolveComponent("el-select"),J=l.resolveComponent("el-card"),fe=l.resolveComponent("el-col"),he=l.resolveComponent("el-row"),ye=l.resolveDirective("debounce"),z=l.resolveDirective("loading");return l.withDirectives((l.openBlock(),l.createElementBlock("div",My,[l.createVNode(he,{style:{margin:"0"},gutter:12},{default:l.withCtx(()=>[l.createVNode(fe,{class:"header-operate",span:24},{default:l.withCtx(()=>[l.createVNode(J,{class:"form-card",shadow:"hover"},{default:l.withCtx(()=>[l.createElementVNode("div",By,[U[10]||(U[10]=l.createElementVNode("div",{class:"submit-box-l"},null,-1)),l.createElementVNode("div",Dy,[l.withDirectives((l.openBlock(),l.createBlock(Z,{style:{width:"120px"},type:"primary",loading:l.unref(C).initBtnLoading,onClick:U[0]||(U[0]=D=>S())},{default:l.withCtx(()=>U[8]||(U[8]=[l.createTextVNode("一键初始化配置")])),_:1},8,["loading"])),[[ye]]),l.createVNode(X,{class:"menu-select",modelValue:l.unref(h),"onUpdate:modelValue":U[1]||(U[1]=D=>l.isRef(h)?h.value=D:h=D),placeholder:"菜单切换",clearable:"",filterable:"",onChange:A},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(c),D=>(l.openBlock(),l.createBlock(K,{key:D.id,label:D.name,value:D.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),l.withDirectives((l.openBlock(),l.createBlock(Z,{style:{width:"120px"},type:"success",loading:l.unref(C).saveBtnLoading,onClick:U[2]||(U[2]=D=>I(B.formRef))},{default:l.withCtx(()=>U[9]||(U[9]=[l.createTextVNode("保存")])),_:1},8,["loading"])),[[ye]])])])]),_:1})]),_:1}),l.createVNode(fe,{class:"mt12",span:12},{default:l.withCtx(()=>[l.createVNode(Ey,{ref_key:"configTableRef",ref:d,modelValue:l.unref(w),"onUpdate:modelValue":U[3]||(U[3]=D=>l.isRef(w)?w.value=D:w=D)},null,8,["modelValue"])]),_:1}),l.createVNode(fe,{class:"mt12",span:12},{default:l.withCtx(()=>[l.createVNode(Ty,{ref_key:"configFormRef",ref:m,modelValue:l.unref(g),"onUpdate:modelValue":U[4]||(U[4]=D=>l.isRef(g)?g.value=D:g=D)},null,8,["modelValue"])]),_:1}),l.createVNode(fe,{class:"mt12",span:24},{default:l.withCtx(()=>[l.createVNode($y,{ref_key:"configBtnsRef",ref:b,modelValue:l.unref(p),"onUpdate:modelValue":U[5]||(U[5]=D=>l.isRef(p)?p.value=D:p=D)},null,8,["modelValue"])]),_:1}),l.createVNode(fe,{class:"mt12",span:24},{default:l.withCtx(()=>[l.createVNode(Ry,{modelValue:l.unref(O),"onUpdate:modelValue":U[6]||(U[6]=D=>l.isRef(O)?O.value=D:O=D)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(Ly,{visible:l.unref(C).showDialogInitConfig,"onUpdate:visible":U[7]||(U[7]=D=>l.unref(C).showDialogInitConfig=D),title:"一键初始化配置",onRefresh:M},null,8,["visible"])])),[[z,l.unref(C).pageLoading]])}}},[["__scopeId","data-v-8dfa8a8a"]]),vy=(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)},Cr={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:"一键格式化代码"}}},zu={ActPage:ju,ActConfig:Yu},Zy={install(i,e){var u;const{modules:t,request:n,themeColor:s,apiPrefix:r,language:{messages:o={},en:a="zhCn"}}=e,c={act:Object.assign(Cr[a].act,((u=o[a])==null?void 0:u.act)??{})},h=wu({locale:a,fallbackLocale:a,messages:{...Cr,[a]:c}});i.use(h),i.provide("actModules",t),i.provide("themeColor",s),i.provide("apiPrefix",r||"/api/v1"),i.provide("request",n),i.directive("debounce",vy),Object.keys(zu).forEach(f=>{i.component(f,zu[f])})}},Iy={ActPage:ju,ActConfig:Yu};function Uy(i){var o;const{modules:e,language:{messages:t={},en:n="zhCn"}}=i,s={act:Object.assign(Cr[n].act,((o=t[n])==null?void 0:o.act)??{})};return wu({locale:n,fallbackLocale:n,messages:{...Cr,[n]:s}})}const LT="",Fy={key:0,class:"search-module-container"},jy={class:"no-config-field"},qy=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(()=>Gu)),{t:n}=Gt(),s=l.inject("request"),r=l.inject("globalProps"),o=l.inject("loadComponents"),a=l.inject("getFieldUiProps"),c=l.inject("formatDataType"),h=l.inject("disposeDate"),u=l.inject("getDefaultQueryValues"),f=e,d=i,m=l.ref({});let b=l.ref([]),w=l.ref([]),g=l.ref(!0);const p=l.ref(0),O=l.ref(0),C=A=>d.data.tableConfig.isExpandQuery&&g.value?d.data.tableConfig.tableQueryRowWidth>A+1:!0,y=async A=>{b.value=await Promise.all(A.filter(S=>S.useScenes.includes("tableSearch")).map(async S=>{S.tableQueryDefaultValue&&(["date","dateRange"].includes(S.fieldType)?S.queryValue=h(S):S.queryValue=S.tableQueryDefaultValue?S.tableQueryDefaultValue:void 0),r.defaultParams.some(T=>{T.field==S.fieldKey&&T.operate===S.tableQueryCondition&&(S.queryValue=T.value)});const M=(S.formCustomComponentes??[]).find(T=>T.permissionCode==="tableSearch");if(S.isQueryFieldCustom=!1,M&&M.isFieldCustom){const{isFieldCustom:T,customComponentName:I,customComponentUrl:B}=M;if(S.isQueryFieldCustom=!0,O.value++,T&&!S.customQueryComponent){const U=await o(B,I);S.customQueryComponent=U}}return S}))},E=A=>{const S=(A||[]).filter(M=>M.permissionCode===1001).map(M=>({...M,loading:!1}));w.value=[...S,{btnName:n("act.reset"),permissionCode:"9999",btnColor:"info",btnIcon:"btn-reset",loading:!1}]},x=async({node:A,resolve:S},M)=>{const T=a(M),{label:I,value:B,children:U,isLeaf:Z}={...xr,...T.treeProps||{}};if(A[Z])return S([]);const K=M.postRequestParams.filter(z=>z.submitType==="default").reduce((z,D)=>(z[D.submitName]=c(D.paramsType,D.submitValue),z),{}),X=M.postRequestParams.filter(z=>z.submitType==="match").reduce((z,D)=>(z[D.submitName]=c(D.paramsType,r.matchData[D.submitValue][D.submitName]),z),{}),J=M.postRequestParams.filter(z=>z.submitType==="dynamic").map(z=>({field:z.submitName,operate:z.submitMatchType,value:T.loadCode?A==null?void 0:A.data.value:c(z.paramsType,z.submitValue)}));let fe={};Object.keys(K).length&&(fe={...fe,...K}),Object.keys(X).length&&(fe={...fe,...X}),J.length&&(fe.dynamicFilters=J),T.loadCode&&Reflect.has(fe,T.loadCode)&&(fe[T.loadCode]=A==null?void 0:A.data.value);const{data:he}=await s({url:M.fieldRequestUrl,method:M.fieldRequestType||"GET",data:fe}),ye=(he||[]).map(z=>({label:z[I],value:z[B],children:[],isLeaf:z[Z]}));S(ye)};l.watch(()=>d.data,(A,S)=>{y(A.fields),E(A.buttons)},{immediate:!0,deep:!0});const k=()=>{p.value++,p.value===O.value&&P({permissionCode:1001})},P=A=>{switch(A.loading=!0,A.permissionCode){case"9999":b.value.forEach(T=>{T.tableQueryDefaultValue?T.queryValue=["date","dateRange"].includes(T.fieldType)?h(T):(T==null?void 0:T.tableQueryDefaultValue)||void 0:T.queryValue=T.fieldType.includes("&")?[]:void 0});const S=u();f("reset",S,()=>{A.loading=!1});break;default:const M=b.value.filter(T=>Array.isArray(T.queryValue)?T.queryValue.length:!!T.queryValue);f("search",M,()=>{A.loading=!1});break}},N=()=>{g.value=!g.value},_=()=>{P({permissionCode:1001})};return(A,S)=>{var z;const M=l.resolveComponent("el-input"),T=l.resolveComponent("el-option"),I=l.resolveComponent("el-select"),B=l.resolveComponent("el-select-v2"),U=l.resolveComponent("el-cascader"),Z=l.resolveComponent("el-tree-select"),K=l.resolveComponent("el-date-picker"),X=l.resolveComponent("el-form-item"),J=l.resolveComponent("a-svg-icon"),fe=l.resolveComponent("el-button"),he=l.resolveComponent("el-form"),ye=l.resolveDirective("debounce");return l.unref(b)&&l.unref(b).length?(l.openBlock(),l.createElementBlock("div",Fy,[l.createVNode(he,{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(b),(D,V)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:V},[C(V)?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[D.isQueryFieldCustom?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[D.customQueryComponent?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(D.customQueryComponent),{key:0,class:"custom-btn",ref_for:!0,ref:q=>m.value[`customQueryComponent_${V}`]=q,modelValue:D.queryValue,"onUpdate:modelValue":q=>D.queryValue=q,queryItem:D,data:d.data,onRefresh:S[9]||(S[9]=q=>P({permissionCode:1001})),onLoaded:k},null,40,["modelValue","onUpdate:modelValue","queryItem","data"])):(l.openBlock(),l.createElementBlock("div",{class:"no-config",key:V},[l.createElementVNode("span",jy,"【"+l.toDisplayString(D.fieldName)+"】",1),l.createTextVNode(l.toDisplayString(l.unref(n)("act.fieldCustom")),1)]))],64)):(l.openBlock(),l.createBlock(X,{key:0,class:"search-form-item","label-width":d.data.tableConfig.tableQueryLabelWidth,label:D.fieldName},{default:l.withCtx(()=>[D.fieldType==="input"||D.fieldType==="editor"?(l.openBlock(),l.createBlock(M,l.mergeProps({key:0,modelValue:D.queryValue,"onUpdate:modelValue":q=>D.queryValue=q,placeholder:`${l.unref(n)("act.inputPlaceholder")}${D.fieldName}`,clearable:"",ref_for:!0},l.unref(a)(D),{onKeyup:S[0]||(S[0]=l.withKeys(l.withModifiers(q=>P({permissionCode:1001}),["prevent"]),["enter","native"])),onClear:_}),null,16,["modelValue","onUpdate:modelValue","placeholder"])):l.createCommentVNode("",!0),D.fieldType==="inputNumber"?(l.openBlock(),l.createBlock(l.unref(t),l.mergeProps({key:1,modelValue:D.queryValue,"onUpdate:modelValue":q=>D.queryValue=q,placeholder:`${l.unref(n)("act.inputPlaceholder")}${D.fieldName}`,clearable:"",onKeyup:S[1]||(S[1]=l.withKeys(l.withModifiers(q=>P({permissionCode:1001}),["prevent"]),["enter","native"])),ref_for:!0},l.unref(a)(D)),null,16,["modelValue","onUpdate:modelValue","placeholder"])):["select","switch","multipleSelect"].includes(D.fieldType)?(l.openBlock(),l.createBlock(I,l.mergeProps({key:2,modelValue:D.queryValue,"onUpdate:modelValue":q=>D.queryValue=q,placeholder:`${l.unref(n)("act.selectPlaceholder")}${D.fieldName}`,clearable:"",filterable:"",ref_for:!0},l.unref(a)(D),{multiple:D.fieldType==="multipleSelect","collapse-tags":D.fieldType==="multipleSelect","collapse-tags-tooltip":D.fieldType==="multipleSelect",onChange:S[2]||(S[2]=q=>P({permissionCode:1001}))}),{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(D.dataList,(q,H)=>(l.openBlock(),l.createBlock(T,{key:H,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(D.fieldType)?(l.openBlock(),l.createBlock(B,l.mergeProps({key:3,modelValue:D.queryValue,"onUpdate:modelValue":q=>D.queryValue=q,options:D.dataList,props:{...l.unref(Fu)},placeholder:`${l.unref(n)("act.selectPlaceholder")}${D.fieldName}`,clearable:"",filterable:"",ref_for:!0},l.unref(a)(D),{"collapse-tags":D.fieldType==="virtualizedMultipleSelect","collapse-tags-tooltip":D.fieldType==="virtualizedMultipleSelect",multiple:D.fieldType==="virtualizedMultipleSelect",onChange:S[3]||(S[3]=q=>P({permissionCode:1001}))}),null,16,["modelValue","onUpdate:modelValue","options","props","placeholder","collapse-tags","collapse-tags-tooltip","multiple"])):D.fieldType==="provinceCascade"?(l.openBlock(),l.createBlock(U,l.mergeProps({key:4,modelValue:D.queryValue,"onUpdate:modelValue":q=>D.queryValue=q,options:D.dataList,props:{...l.unref(Uu)},clearable:"",filterable:"",placeholder:`${l.unref(n)("act.selectPlaceholder")}${D.fieldName}`,ref_for:!0},l.unref(a)(D),{onChange:S[4]||(S[4]=q=>P({permissionCode:1001}))}),null,16,["modelValue","onUpdate:modelValue","options","props","placeholder"])):D.fieldType==="fullLoadTreeSelect"?(l.openBlock(),l.createBlock(Z,l.mergeProps({key:5,ref_for:!0,ref:q=>m.value[`elTreeSelect_fullLoad_${V}`]=q,modelValue:D.queryValue,"onUpdate:modelValue":q=>D.queryValue=q,data:D.dataList,placeholder:`请选择${D.fieldName}`,props:{...l.unref(xr),...l.unref(a)(D).treeProps||{}},"render-after-expand":!1,"collapse-tags":"","collapse-tags-tooltip":"",multiple:"","show-checkbox":"",clearable:"",filterable:""},l.unref(a)(D),{onChange:S[5]||(S[5]=q=>P({permissionCode:1001}))}),null,16,["modelValue","onUpdate:modelValue","data","placeholder","props"])):D.fieldType==="treeSelect"?(l.openBlock(),l.createBlock(Z,l.mergeProps({key:6,ref_for:!0,ref:q=>m.value[`elTreeSelect_${V}`]=q,modelValue:D.queryValue,"onUpdate:modelValue":q=>D.queryValue=q,placeholder:`请选择${D.fieldName}`,props:{isLeaf:"isLeaf"},"render-after-expand":!1,"collapse-tags":"","collapse-tags-tooltip":"",multiple:"","show-checkbox":"",clearable:"",filterable:"",lazy:"",load:(q,H)=>x({node:q,resolve:H},D)},l.unref(a)(D),{onChange:S[6]||(S[6]=q=>P({permissionCode:1001}))}),null,16,["modelValue","onUpdate:modelValue","placeholder","load"])):D.fieldType==="date"?(l.openBlock(),l.createBlock(K,l.mergeProps({key:7,modelValue:D.queryValue,"onUpdate:modelValue":q=>D.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)(D),{onChange:S[7]||(S[7]=q=>P({permissionCode:1001}))}),null,16,["modelValue","onUpdate:modelValue","placeholder"])):D.fieldType==="dateRange"?(l.openBlock(),l.createBlock(K,l.mergeProps({key:8,modelValue:D.queryValue,"onUpdate:modelValue":q=>D.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)(D),{onChange:S[8]||(S[8]=q=>P({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(b).length?(l.openBlock(),l.createBlock(X,{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),(D,V)=>l.withDirectives((l.openBlock(),l.createBlock(fe,{key:V,type:D.btnColor,loading:D.loading,onClick:q=>P(D)},{default:l.withCtx(()=>[D.btnIcon?(l.openBlock(),l.createBlock(J,{key:0,class:"mr6",name:D.btnIcon,width:"12",height:"12",color:"#fff"},null,8,["name"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(D.btnName),1)]),_:2},1032,["type","loading","onClick"])),[[ye]])),128))]),_:1})):l.createCommentVNode("",!0)]),_:1},8,["style"]),d.data.tableConfig.isExpandQuery&&((z=l.unref(b))==null?void 0:z.length)>d.data.tableConfig.tableQueryRowWidth?(l.openBlock(),l.createBlock(fe,{key:0,class:"expand",text:"",size:"small",icon:l.unref(g)?"ArrowDown":"ArrowUp",onClick:N},{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-92d7682c"]])},Symbol.toStringTag,{value:"Module"})),DT="",Xy={class:"header-operate-container"},Wy=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}=Gt();let r=l.ref([]);const o=l.inject("globalProps"),a=l.inject("menuPermissionBtns"),c=l.inject("stringToBoolean"),h=l.inject("matchCondition"),u=l.inject("getTableData"),f=l.inject("tableBtnRefs"),d=l.computed(()=>{const{tableConfig:{headerMoreBtnSplitNumber:C}}=n.data;return!C||C>=r.value.length}),m=()=>{const{tableConfig:{headerMoreBtnSplitNumber:C}}=n.data;return d.value?r.value:r.value.slice(0,C)},b=()=>{var y;const{tableConfig:{headerMoreBtnSplitNumber:C}}=n.data;return d.value?[]:r.value.slice(C,(y=r.value)==null?void 0:y.length)},w=C=>{if(!C.matchFields.length)return!0;const y=C.matchFields.filter(N=>N.matchType!="default"),E=N=>o.matchData[N.matchType][N.matchFieldName];let k=y.reduce((N,_,A)=>{const S=E(_);return N+=h(_.matchCondition,S,_.fieldValue==""?null:_.fieldValue=="true"||_.fieldValue=="false"?c(_.fieldValue):_.fieldValue),A!==y.length-1&&(N+=_.spliceCondition||"&&"),N},"").split("||"),P=k.reduce((N,_,A)=>(N+=`(${_})`,A<k.length-1&&(N+="||"),N),"");return new Function(`return ${P}`)()},g=C=>a.value.some(y=>y.unique==C.permissionCode)&&w(C),p=C=>{r.value=(C||[]).filter(y=>y.permissionCode!==1001&&y.btnPostion.includes("header")).sort((y,E)=>y.sort-E.sort).map(y=>(y.btnAlias&&(y.btnName=y.btnAlias),Reflect.has(y,"isPromptVerificationSelectTable")||(y.isPromptVerificationSelectTable="1"),y))};l.watch(()=>n.data,(C,y)=>{p(C.buttons)},{immediate:!0});const O=C=>{t("onOperate",C,{})};return(C,y)=>{const E=l.resolveComponent("a-svg-icon"),x=l.resolveComponent("el-button"),k=l.resolveComponent("el-icon"),P=l.resolveComponent("el-dropdown-item"),N=l.resolveComponent("el-dropdown-menu"),_=l.resolveComponent("el-dropdown"),A=l.resolveDirective("debounce");return l.openBlock(),l.createElementBlock("div",Xy,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(m(),(S,M)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:S.permissionCode},[g(S)?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[S.isCustomBtn&&S.customType=="component"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(S[S.customComponentName]),{key:0,class:"custom-btn",ref_for:!0,ref:T=>l.unref(f)[`${S.customComponentName}-${S.permissionCode}`]=T,buttonData:S,onRefresh:y[0]||(y[0]=T=>l.unref(u)())},{default:l.withCtx(()=>[l.withDirectives((l.openBlock(),l.createBlock(x,{class:"el-btn",type:S.btnColor,loading:S[`loading${S.permissionCode}`],onClick:T=>O(S)},{default:l.withCtx(()=>[S.btnIcon&&!S[`loading${S.permissionCode}`]?(l.openBlock(),l.createBlock(E,{key:0,class:"mr4",name:S.btnIcon,width:"12",height:"12",color:"#fff"},null,8,["name"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(S[`loading${S.permissionCode}`]?S.btnName+l.unref(s)("act.loading")+"...":S.btnName),1)]),_:2},1032,["type","loading","onClick"])),[[A]])]),_:2},1064,["buttonData"])):l.withDirectives((l.openBlock(),l.createBlock(x,{key:1,class:"el-btn",type:S.btnColor,loading:S[`loading${S.permissionCode}`],onClick:T=>O(S)},{default:l.withCtx(()=>[S.btnIcon&&!S[`loading${S.permissionCode}`]?(l.openBlock(),l.createBlock(E,{key:0,class:"mr4",name:S.btnIcon,width:"12",height:"12",color:"#fff"},null,8,["name"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(S[`loading${S.permissionCode}`]?S.btnName+l.unref(s)("act.loading")+"...":S.btnName),1)]),_:2},1032,["type","loading","onClick"])),[[A]])],64)):l.createCommentVNode("",!0)],64))),128)),d.value?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(_,{key:0,class:"header-opreate-dropdown"},{dropdown:l.withCtx(()=>[l.createVNode(N,null,{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(b(),(S,M)=>(l.openBlock(),l.createBlock(P,{key:S.permissionCode,onClick:T=>O(S)},{default:l.withCtx(()=>[g(S)?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[S.isCustomBtn&&S.customType=="component"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(S[S.customComponentName]),{key:0,class:"custom-btn",ref_for:!0,ref:T=>l.unref(f)[`${S.customComponentName}-${S.permissionCode}`]=T,buttonData:S,onRefresh:y[1]||(y[1]=T=>l.unref(u)())},{default:l.withCtx(()=>[l.withDirectives((l.openBlock(),l.createBlock(x,{class:"el-btn",type:S.btnColor,loading:S[`loading${S.permissionCode}`]},{default:l.withCtx(()=>[S.btnIcon&&!S[`loading${S.permissionCode}`]?(l.openBlock(),l.createBlock(E,{key:0,class:"mr4",name:S.btnIcon,width:"12",height:"12",color:"#fff"},null,8,["name"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(S[`loading${S.permissionCode}`]?S.btnName+l.unref(s)("act.loading")+"...":S.btnName),1)]),_:2},1032,["type","loading"])),[[A]])]),_:2},1064,["buttonData"])):l.withDirectives((l.openBlock(),l.createBlock(x,{key:1,class:"el-btn",type:S.btnColor,loading:S[`loading${S.permissionCode}`]},{default:l.withCtx(()=>[S.btnIcon&&!S[`loading${S.permissionCode}`]?(l.openBlock(),l.createBlock(E,{key:0,class:"mr4",name:S.btnIcon,width:"12",height:"12",color:"#fff"},null,8,["name"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(S[`loading${S.permissionCode}`]?S.btnName+l.unref(s)("act.loading")+"...":S.btnName),1)]),_:2},1032,["type","loading"])),[[A]])],64)):l.createCommentVNode("",!0)]),_:2},1032,["onClick"]))),128))]),_:1})]),default:l.withCtx(()=>[l.createVNode(x,{type:"primary"},{default:l.withCtx(()=>[y[2]||(y[2]=l.createTextVNode(" 更多按钮")),l.createVNode(k,{class:"el-icon--right"},{default:l.withCtx(()=>[l.createVNode(l.unref(Kb))]),_:1})]),_:1})]),_:1}))])}}},[["__scopeId","data-v-f0dda1b5"]])},Symbol.toStringTag,{value:"Module"})),IT="",Yy={class:"act-table"},zy=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","refresh","onRowClick","changeExpand"],setup(i,{expose:e,emit:t}){const{t:n}=Gt(),s=t,r=i;let o=l.ref(null);const a=g=>r.showPagination?g+1+(r.tableQuery.pageIndex-1)*r.tableQuery.pageSize:g+1,c=g=>{l.nextTick(()=>{r.data.forEach(p=>{g.includes(p[r.rowKey])&&o.value.toggleRowSelection(p,!0)})})},h=g=>o.value.getSelectionRows();l.watch(()=>r.selection,(g,p)=>{g&&g.length&&c(g)},{deep:!0,immediate:!0});const u=g=>{s("update:selection",g)},f=(g,p)=>{g&&l.nextTick(()=>{r.data.forEach(O=>{g.includes(O[p||r.rowKey])&&o.value.toggleRowSelection(O,!0)})})},d=g=>{s("update:tableQuery",{...r.tableQuery,pageSize:g}),s("refresh",[])},m=g=>{s("update:tableQuery",{...r.tableQuery,pageIndex:g}),s("refresh",[])},b=(g,p,O)=>{s("onRowClick",g,p,O)},w=(g,p)=>{s("changeExpand",g,p)};return e({getSelectionRows:h,updateSelection:f}),(g,p)=>{const O=l.resolveComponent("el-table-column"),C=l.resolveComponent("el-table"),y=l.resolveComponent("el-pagination"),E=l.resolveDirective("loading");return l.openBlock(),l.createElementBlock("div",Yy,[l.withDirectives((l.openBlock(),l.createBlock(C,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:u,onRowClick:b,onExpandChange:w}),{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(g.$slots,x.prop,{key:0},void 0,!0):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[x.render?(l.openBlock(),l.createBlock(O,{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(k=>[l.renderSlot(g.$slots,x.prop,{scope:k},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(O,{key:0,type:"selection",align:"center",width:x.width,fixed:""},null,8,["width"])):x.prop=="serialNumber"?(l.openBlock(),l.createBlock(O,{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(O,{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"])),[[E,r.loading]]),r.showPagination?(l.openBlock(),l.createBlock(y,{key:0,class:"table-pagination","current-page":r.tableQuery.pageIndex,"onUpdate:currentPage":p[0]||(p[0]=x=>r.tableQuery.pageIndex=x),"page-size":r.tableQuery.pageSize,"onUpdate:pageSize":p[1]||(p[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:d,onCurrentChange:m},null,8,["current-page","page-size","total"])):l.createCommentVNode("",!0)])}}},[["__scopeId","data-v-d2da0301"]])},Symbol.toStringTag,{value:"Module"})),jT="",Gy={class:"no-config-field"},Hy={class:"dialog-footer"},Ky=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(()=>Gu)),n=l.defineAsyncComponent(()=>Promise.resolve().then(()=>Hu)),s=l.defineAsyncComponent(()=>Promise.resolve().then(()=>w1)),r=l.defineAsyncComponent(()=>Promise.resolve().then(()=>D1)),{t:o}=Gt(),a=l.inject("request"),c=l.inject("loadComponents"),h=l.inject("formatDataType"),u=l.inject("globalProps"),f=l.inject("stringToBoolean"),d=l.inject("getFieldUiProps"),m=l.inject("disposeRequestData"),b=e,w=i,g=l.ref(!1),p=l.ref(!1),O=l.ref(null),C=l.ref([]),y=l.ref({}),E=l.ref({}),x=Z=>Z.formColumnCol==null?24:Z.formColumnCol?Z.formColumnCol:24/Z.formRow,k=Z=>["input","textarea"].includes(Z.fieldType)?"blur":(["select","multipleSelect","datetimerange","treeSelect","provinceCascade"].includes(Z.fieldType),"change"),P=async({node:Z,resolve:K},X)=>{const J=d(X),{label:fe,value:he,children:ye,isLeaf:z}={...xr,...J.treeProps||{}};if(Z[z])return K([]);const D=X.postRequestParams.filter(Re=>Re.submitType==="default").reduce((Re,qe)=>(Re[qe.submitName]=h(qe.paramsType,qe.submitValue),Re),{}),V=X.postRequestParams.filter(Re=>Re.submitType==="match").reduce((Re,qe)=>(Re[qe.submitName]=h(qe.paramsType,u.matchData[qe.submitValue][qe.submitName]),Re),{}),q=X.postRequestParams.filter(Re=>Re.submitType==="dynamic").map(Re=>{let qe={field:Re.submitName,operate:Re.submitMatchType,value:h(Re.paramsType,Re.submitValue)};return J.loadCode===Re.submitName&&(Z!=null&&Z.data.value)&&(qe.value=Z==null?void 0:Z.data.value),qe});let H={};Object.keys(D).length&&(H={...H,...D}),Object.keys(V).length&&(H={...H,...V}),q.length&&(H.dynamicFilters=q),J.loadCode&&Reflect.has(H,J.loadCode)&&(H[J.loadCode]=Z==null?void 0:Z.data.value);const{data:Ue}=await a({url:X.fieldRequestUrl,method:X.fieldRequestType||"GET",data:H}),Ri=(Ue||[]).map(Re=>({label:Re[fe],value:Re[he],children:[],isLeaf:Re[z]}));K(Ri)},N=Z=>{if(!["input","textarea"].includes(Z)){if(["multipleSelect","dateRange"].includes(Z))return[];if(["switch"].includes(Z))return!1}},_=(Z,K)=>{if(typeof Z=="string"&&["string"].includes(K))return Z.toString();if(["string"].includes(K))return Z.sort((X,J)=>X.sort-J.sort).join(";");if(["number"].includes(K))return Number(Z);if(["array"].includes(K))return Z.sort((X,J)=>X.sort-J.sort)},A=(Z,K=!1)=>{if(["multipleSelect"].includes(Z.fieldType))return w.data.rowData[Z.fieldKey]?w.data.rowData[Z.fieldKey].split(";").map(J=>K?{value:J}:J):[];if(["virtualizedMultipleSelect"].includes(Z.fieldType))return w.data.rowData[Z.fieldKey]?w.data.rowData[Z.fieldKey].split(";"):[];if(["dateRange","provinceCascade"].includes(Z.fieldType)){const J=Z.fieldKey.split("&");return w.data.rowData[Z.fieldKey]=J.map(fe=>w.data.rowData[fe]),w.data.rowData[Z.fieldKey]}let X=w.data.rowData[Z.fieldKey];if(["select"].includes(Z.fieldType)){const J=d(Z);Z.dataList&&Z.dataList.length&&typeof Z.dataList[0][J["value-key"]?J["value-key"]:"value"]=="string"&&X!==null&&(X=K?{value:X.toString()}:X.toString())}if(["virtualizedSelect"].includes(Z.fieldType)){const J=d(Z);Z.dataList&&Z.dataList.length&&typeof Z.dataList[0][J["value-key"]?J["value-key"]:"value"]=="string"&&X!==null&&(X=X.toString())}return(X==="true"||X==="false")&&(X=f(X)),X},S=Z=>a({url:w.data.dataItem.requestUrl,method:"post",data:Z});l.watch(()=>w.visible,async(Z,K)=>{var X,J;if(Z)try{g.value=!0;const fe=await m(w.data.formList,w.data.rowData,!1,!0);console.log("formList",(X=w.data)==null?void 0:X.formList),C.value=await Promise.all((((J=w.data)==null?void 0:J.formList)??[]).sort((he,ye)=>he.sort-ye.sort).map(async he=>{const ye=fe.find(q=>he.fieldName==q.fieldName&&he.fieldKey==q.fieldKey);ye&&(he.dataList=(ye==null?void 0:ye.dataList)??[]),["select","multipleSelect"].includes(he.fieldType)&&(y.value[`${he.fieldKey}ActImplicit`]=Object.keys(w.data.rowData).length&&he.isFormSetValue?A(he,!0):N(he.fieldType)),y.value[he.fieldKey]=Object.keys(w.data.rowData).length&&he.isFormSetValue?A(he):N(he.fieldType);const{isFieldCustom:z,customComponentName:D,customComponentUrl:V}=he.customFiledsComponentes;if(z&&!he.customFiledsComponentes[D]){const q=await c(V,D);he.customFiledsComponentes[D]=q}return he})),g.value=!1}catch(fe){console.error(fe),g.value=!1}});const M=Z=>{T(),Z()},T=()=>{C.value=[],O.value.resetFields(),b("update:visible",!1)},I=(Z,K)=>{const X=d(K),{fieldKey:J,fieldType:fe}=K;if(fe==="multipleSelect"){const he=Z.filter(z=>typeof z=="string"),ye=Z.filter(z=>typeof z!="string").map(z=>z.value);y.value[X.createFieldKey]=he.length?_(he,"string"):void 0,y.value[J]=ye.length?_(ye,"string"):void 0}else typeof Z=="string"?(y.value[X.createFieldKey]=Z,y.value[J]=void 0):(y.value[J]=Z.value,delete y.value[X.createFieldKey])},B=Z=>{Z&&Z.validate(K=>{if(K){const{dataItem:X,rowData:J}=w.data;let fe={...l.toRaw(y.value)};Object.keys(fe).forEach(z=>{if(z.includes("ActImplicit")){delete fe[z];return}const D=C.value.find(V=>V.fieldKey===z);z.includes("&")?z.split("&").forEach((q,H)=>{fe[q]=fe[z]?_(fe[z][H],D.fieldSubmitType):fe[z]}):Array.isArray(fe[z])&&D.fieldSubmitType=="string"&&(fe[z]=_(fe[z],"string"))});const he=X.submitFields.filter(z=>z.matchType=="default").reduce((z,D)=>(D.submitFieldType==="string"&&(z[D.submitFieldName]=D.matchFieldName.toString()),z),{}),ye=X.submitFields.filter(z=>z.matchType=="match").reduce((z,D)=>(Reflect.has(D,"submitFieldMatchOrigin")&&D.submitFieldMatchOrigin==="selections"?z[D.submitFieldName]=w.data.selections.map(V=>h(D.submitFieldType,V[D.matchFieldName])):Reflect.has(D,"submitFieldMatchOrigin")&&D.submitFieldMatchOrigin!="rowData"?Reflect.has(u.matchData,D.submitFieldMatchOrigin)&&(z[D.submitFieldName]=h(D.submitFieldType,u.matchData[D.submitFieldMatchOrigin][D.matchFieldName])):z[D.submitFieldName]=h(D.submitFieldType,J[D.matchFieldName]),z),{});S({...fe,...he,...ye}).then(z=>{try{Ne.ElNotification({title:o("act.tip"),message:o("act.saveSuccessfully"),type:"success",duration:2500}),T(),b("refresh",X)}catch(D){console.error(D)}p.value=!1}).catch(z=>{console.error(z),p.value=!1})}})},U=Z=>{const K=Object.keys(E.value).map(X=>{var J;return(J=E.value[X])==null?void 0:J.updateFormData(y.value)}).filter(X=>X);Promise.all([Z.validate(),...K]).then(X=>{X.every(J=>J)&&B(Z)}).catch(X=>(console.error(X),X))};return(Z,K)=>{var ki;const X=l.resolveComponent("el-input"),J=l.resolveComponent("el-option"),fe=l.resolveComponent("el-select"),he=l.resolveComponent("el-select-v2"),ye=l.resolveComponent("el-tree-select"),z=l.resolveComponent("el-date-picker"),D=l.resolveComponent("el-cascader"),V=l.resolveComponent("el-switch"),q=l.resolveComponent("el-form-item"),H=l.resolveComponent("el-col"),Ue=l.resolveComponent("el-row"),Ri=l.resolveComponent("el-form"),Re=l.resolveComponent("el-button"),qe=l.resolveComponent("el-dialog"),Wt=l.resolveDirective("loading"),Dt=l.resolveDirective("debounce");return l.openBlock(),l.createBlock(qe,{"model-value":w.visible,title:w.title,top:"5vh",width:(ki=i.data.formConfig)==null?void 0:ki.dialogWidth,draggable:"",overflow:"","append-to-body":"","destroy-on-close":"","close-on-click-modal":!1,"before-close":M},{footer:l.withCtx(()=>[l.createElementVNode("span",Hy,[l.createVNode(Re,{loading:p.value,onClick:T},{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:K[1]||(K[1]=Vi=>U(O.value))},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(o)("act.save")),1)]),_:1},8,["loading"])),[[Dt]])])]),default:l.withCtx(()=>{var Vi,R;return[l.withDirectives((l.openBlock(),l.createBlock(Ri,{class:"a-form",ref_key:"formRef",ref:O,model:y.value,"label-suffix":":","label-width":(Vi=i.data.formConfig)==null?void 0:Vi.formLabelWidth,"label-position":(R=i.data.formConfig)==null?void 0:R.formLabelPosition},{default:l.withCtx(()=>[l.createVNode(Ue,{gutter:40},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(C.value,(Q,W)=>(l.openBlock(),l.createBlock(H,{span:x(Q),key:W},{default:l.withCtx(()=>[Q.customFiledsComponentes.isFieldCustom?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[Q.customFiledsComponentes[Q.customFiledsComponentes.customComponentName]?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(Q.customFiledsComponentes[Q.customFiledsComponentes.customComponentName]),{key:0,ref_for:!0,ref:Y=>E.value[Q.customFiledsComponentes.customComponentName]=Y,formConfig:i.data.formConfig,item:Q,rowData:w.data.rowData,visible:w.visible,form:y.value,"onUpdate:form":K[0]||(K[0]=Y=>y.value=Y)},null,40,["formConfig","item","rowData","visible","form"])):(l.openBlock(),l.createElementBlock("div",{class:"no-config",key:W},[l.createElementVNode("span",Gy,"【"+l.toDisplayString(Q.fieldName)+"】",1),l.createTextVNode(l.toDisplayString(l.unref(o)("act.fieldCustom")),1)]))],64)):(l.openBlock(),l.createBlock(q,{key:0,label:Q.fieldName,prop:["select","multipleSelect"].includes(Q.fieldType)?`${Q.fieldKey}ActImplicit`:Q.fieldKey,rules:[{required:Q.isFormFieldRequired,message:l.unref(o)("act.requiredMessage"),trigger:k(Q)}]},{default:l.withCtx(()=>[Q.fieldType==="input"?(l.openBlock(),l.createBlock(X,l.mergeProps({key:0,modelValue:y.value[Q.fieldKey],"onUpdate:modelValue":Y=>y.value[Q.fieldKey]=Y,placeholder:`${l.unref(o)("act.inputPlaceholder")}${Q.fieldName}`,clearable:"",ref_for:!0},l.unref(d)(Q),{disabled:Q.isFormDisabled}),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):l.createCommentVNode("",!0),Q.fieldType==="inputNumber"?(l.openBlock(),l.createBlock(l.unref(t),l.mergeProps({key:1,modelValue:y.value[Q.fieldKey],"onUpdate:modelValue":Y=>y.value[Q.fieldKey]=Y,placeholder:`${l.unref(o)("act.inputPlaceholder")}${Q.fieldName}`,clearable:"",ref_for:!0},l.unref(d)(Q),{disabled:Q.isFormDisabled}),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):Q.fieldType==="textarea"?(l.openBlock(),l.createBlock(X,l.mergeProps({key:2,modelValue:y.value[Q.fieldKey],"onUpdate:modelValue":Y=>y.value[Q.fieldKey]=Y,placeholder:`${l.unref(o)("act.inputPlaceholder")}${Q.fieldName}`,rows:4,ref_for:!0},l.unref(d)(Q),{type:"textarea",disabled:Q.isFormDisabled}),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):Q.fieldType==="selectIcon"?(l.openBlock(),l.createBlock(l.unref(n),l.mergeProps({key:3,modelValue:y.value[Q.fieldKey],"onUpdate:modelValue":Y=>y.value[Q.fieldKey]=Y,icons:Q.dataList,placeholder:`${l.unref(o)("act.selectPlaceholder")}${Q.fieldName}`,ref_for:!0},l.unref(d)(Q),{disabled:Q.isFormDisabled}),{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(Q.dataList,(Y,$e)=>(l.openBlock(),l.createBlock(J,{key:$e,label:Y.key,value:Y.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","icons","placeholder","disabled"])):["select","multipleSelect"].includes(Q.fieldType)?(l.openBlock(),l.createBlock(fe,l.mergeProps({key:4,modelValue:y.value[`${Q.fieldKey}ActImplicit`],"onUpdate:modelValue":Y=>y.value[`${Q.fieldKey}ActImplicit`]=Y,placeholder:`${l.unref(o)("act.selectPlaceholder")}${Q.fieldName}`,clearable:"",filterable:"","value-key":"value",ref_for:!0},l.unref(d)(Q),{multiple:Q.fieldType==="multipleSelect",disabled:Q.isFormDisabled,onChange:Y=>I(Y,Q)}),{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(Q.dataList,(Y,$e)=>(l.openBlock(),l.createBlock(J,{key:$e,label:Y.key,value:Y},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","multiple","disabled","onChange"])):["virtualizedSelect","virtualizedMultipleSelect"].includes(Q.fieldType)?(l.openBlock(),l.createBlock(he,l.mergeProps({key:5,modelValue:y.value[Q.fieldKey],"onUpdate:modelValue":Y=>y.value[Q.fieldKey]=Y,options:Q.dataList,props:{...l.unref(Fu)},placeholder:`${l.unref(o)("act.selectPlaceholder")}${Q.fieldName}`,clearable:"",filterable:"",ref_for:!0},l.unref(d)(Q),{disabled:Q.isFormDisabled,multiple:Q.fieldType==="virtualizedMultipleSelect"}),null,16,["modelValue","onUpdate:modelValue","options","props","placeholder","disabled","multiple"])):Q.fieldType==="fullLoadTreeSelect"?(l.openBlock(),l.createBlock(ye,l.mergeProps({key:6,modelValue:y.value[Q.fieldKey],"onUpdate:modelValue":Y=>y.value[Q.fieldKey]=Y,data:Q.dataList,"default-expanded-keys":[y.value[Q.fieldKey]||null],placeholder:`请选择${Q.fieldName}`,props:{...l.unref(xr),...l.unref(d)(Q).treeProps||{}},"collapse-tags":"","collapse-tags-tooltip":"",multiple:"","show-checkbox":"",clearable:"",filterable:"",ref_for:!0},l.unref(d)(Q)),null,16,["modelValue","onUpdate:modelValue","data","default-expanded-keys","placeholder","props"])):Q.fieldType==="treeSelect"?(l.openBlock(),l.createBlock(ye,l.mergeProps({key:7,modelValue:y.value[Q.fieldKey],"onUpdate:modelValue":Y=>y.value[Q.fieldKey]=Y,placeholder:`请选择${Q.fieldName}`,props:{isLeaf:"isLeaf"},"render-after-expand":!1,"collapse-tags":"","collapse-tags-tooltip":"",multiple:"","show-checkbox":"",clearable:"",filterable:"",lazy:"",load:(Y,$e)=>P({node:Y,resolve:$e},Q),ref_for:!0},l.unref(d)(Q)),null,16,["modelValue","onUpdate:modelValue","placeholder","load"])):Q.fieldType==="date"?(l.openBlock(),l.createBlock(z,l.mergeProps({key:8,modelValue:y.value[Q.fieldKey],"onUpdate:modelValue":Y=>y.value[Q.fieldKey]=Y,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)(Q),{disabled:Q.isFormDisabled}),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):Q.fieldType==="dateRange"?(l.openBlock(),l.createBlock(z,l.mergeProps({key:9,modelValue:y.value[Q.fieldKey],"onUpdate:modelValue":Y=>y.value[Q.fieldKey]=Y,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)(Q),{disabled:Q.isFormDisabled}),null,16,["modelValue","onUpdate:modelValue","start-placeholder","end-placeholder","disabled"])):Q.fieldType==="provinceCascade"?(l.openBlock(),l.createBlock(D,l.mergeProps({key:10,modelValue:y.value[Q.fieldKey],"onUpdate:modelValue":Y=>y.value[Q.fieldKey]=Y,options:Q.dataList,props:l.unref(Uu),clearable:"",filterable:"",placeholder:`${l.unref(o)("act.selectPlaceholder")}${Q.fieldName}`,ref_for:!0},l.unref(d)(Q),{disabled:Q.isFormDisabled}),null,16,["modelValue","onUpdate:modelValue","options","props","placeholder","disabled"])):Q.fieldType==="switch"?(l.openBlock(),l.createBlock(V,l.mergeProps({key:11,modelValue:y.value[Q.fieldKey],"onUpdate:modelValue":Y=>y.value[Q.fieldKey]=Y,"active-value":!0,"inactive-value":!1,ref_for:!0},l.unref(d)(Q)),null,16,["modelValue","onUpdate:modelValue"])):Q.fieldType==="upload"?(l.openBlock(),l.createBlock(l.unref(s),l.mergeProps({key:12,class:"form-upload",modelValue:y.value[Q.fieldKey],"onUpdate:modelValue":Y=>y.value[Q.fieldKey]=Y,request:l.unref(a),ref_for:!0},l.unref(d)(Q)),null,16,["modelValue","onUpdate:modelValue","request"])):Q.fieldType==="editor"?(l.openBlock(),l.createBlock(l.unref(r),l.mergeProps({key:13,modelValue:y.value[Q.fieldKey],"onUpdate:modelValue":Y=>y.value[Q.fieldKey]=Y,disabled:Q.isFormDisabled,placeholder:`${l.unref(o)("act.inputPlaceholder")}${Q.fieldName}`,ref_for:!0},l.unref(d)(Q)),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"])),[[Wt,g.value]])]}),_:1},8,["model-value","title","width"])}}},[["__scopeId","data-v-4ca7d743"]])},Symbol.toStringTag,{value:"Module"})),WT="",Jy=["innerHTML"],e1={class:"dialog-footer"},t1=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}=Gt(),n=e,s=i,r=()=>({loading:!1});let o=l.reactive(r());l.watch(()=>s.visible,async(h,u)=>{h&&(o.loading=!0,o.loading=!1)});const a=h=>{c(),h()},c=()=>{n("update:visible",!1)};return(h,u)=>{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",e1,[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,Jy)]),_:1},8,["model-value","title"])}}},[["__scopeId","data-v-be1c5be6"]])},Symbol.toStringTag,{value:"Module"})),GT="",i1={class:"dialog-footer"},n1=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(()=>Hu)),n=l.defineAsyncComponent(()=>Promise.resolve().then(()=>WO)),s=rn.useRoute(),r=l.inject("apiPrefix"),o=l.inject("request"),a=e,c=i,h=l.computed(()=>s.params.key),u=()=>({btnLoading:!1});let f=l.reactive(u());const d=l.inject("createDefaultButtonItem"),m=l.inject("associationMenuList"),b=l.inject("conditionList")();let w=l.ref([]),g=l.ref(null),p=l.ref(d());const O=M=>o({url:`${r}/icons/getAllList`,method:"post",data:M}),C=async()=>{try{const{data:M}=await O({dynamicFilters:[{field:"type",operate:"Equal",value:"2"}]});w.value=M||[]}catch(M){console.error(M)}};l.watch(()=>c.visible,async(M,T)=>{if(M){await C();const I={...c.data};Object.keys(p.value).forEach(B=>{B=="submitFields"||B=="matchFields"?p.value[B]=[...I[B]||[]]:B=="isPromptVerificationSelectTable"?p.value[B]=I[B]??"1":p.value[B]=I[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},E=()=>{p.value.submitFields.push({matchType:"match",submitFieldMatchOrigin:"rowData",submitFieldName:"",matchFieldName:"",submitFieldType:""})},x=M=>{p.value.submitFields.splice(M,1)},k=()=>{p.value.matchFields.push({matchType:"default",matchFieldName:"",matchCondition:"",fieldValue:"",spliceCondition:""})},P=M=>{p.value.matchFields.splice(M,1),p.value.matchFields.length===1&&(p.value.matchFields[0].spliceCondition="")},N=(M,T)=>{M.submitFieldMatchOrigin=T==="match"?"rowData":""},_=M=>{A(),M()},A=()=>{p.value=Object.assign(p.value,d()),g.value.resetFields(),a("update:visible",!1)},S=M=>{M&&M.validate(T=>{if(T)try{f.btnLoading=!0,a("refresh",{...p.value,submitFields:[...p.value.submitFields],matchFields:[...p.value.matchFields]},()=>{A()}),f.btnLoading=!1}catch(I){console.error(I),f.btnLoading=!1}})};return(M,T)=>{const I=l.resolveComponent("el-input"),B=l.resolveComponent("el-form-item"),U=l.resolveComponent("el-col"),Z=l.resolveComponent("el-option"),K=l.resolveComponent("el-select"),X=l.resolveComponent("el-row"),J=l.resolveComponent("el-button"),fe=l.resolveComponent("el-divider"),he=l.resolveComponent("el-switch"),ye=l.resolveComponent("el-form"),z=l.resolveComponent("el-dialog"),D=l.resolveDirective("debounce");return l.openBlock(),l.createBlock(z,{"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",i1,[l.createVNode(J,{loading:l.unref(f).btnLoading,onClick:A},{default:l.withCtx(()=>T[19]||(T[19]=[l.createTextVNode("取消")])),_:1},8,["loading"]),l.withDirectives((l.openBlock(),l.createBlock(J,{type:"primary",loading:l.unref(f).btnLoading,onClick:T[16]||(T[16]=V=>S(l.unref(g)))},{default:l.withCtx(()=>T[20]||(T[20]=[l.createTextVNode("保存")])),_:1},8,["loading"])),[[D]])])]),default:l.withCtx(()=>[l.createVNode(ye,{ref_key:"formRef",ref:g,model:l.unref(p),"label-suffix":":","label-position":"top"},{default:l.withCtx(()=>[l.createVNode(X,{gutter:24},{default:l.withCtx(()=>[l.createVNode(U,{span:6},{default:l.withCtx(()=>[l.createVNode(B,{label:"按钮",prop:"btnName"},{default:l.withCtx(()=>[l.createVNode(I,{modelValue:l.unref(p).btnName,"onUpdate:modelValue":T[0]||(T[0]=V=>l.unref(p).btnName=V),disabled:"",placeholder:"请输入按钮名称"},{prepend:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(p).permissionCode),1)]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(U,{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":T[1]||(T[1]=V=>l.unref(p).btnIcon=V),icons:l.unref(w),props:{value:"name",type:"btn"}},null,8,["modelValue","icons"])]),_:1})]),_:1}),l.createVNode(U,{span:24},{default:l.withCtx(()=>[l.createVNode(B,{label:"接口地址",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"requestUrl"},{default:l.withCtx(()=>[l.createVNode(I,{modelValue:l.unref(p).requestUrl,"onUpdate:modelValue":T[2]||(T[2]=V=>l.unref(p).requestUrl=V),placeholder:"请输入接口地址",clearable:""},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(U,{span:12},{default:l.withCtx(()=>[l.createVNode(B,{label:"按钮位置",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"btnPostion"},{default:l.withCtx(()=>[l.createVNode(K,{modelValue:l.unref(p).btnPostion,"onUpdate:modelValue":T[3]||(T[3]=V=>l.unref(p).btnPostion=V),placeholder:"请选择按钮位置",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(dy),(V,q)=>(l.openBlock(),l.createBlock(Z,{key:q,label:V.key,value:V.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(U,{span:12},{default:l.withCtx(()=>[l.createVNode(B,{label:"按钮类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"btnType"},{default:l.withCtx(()=>[l.createVNode(K,{modelValue:l.unref(p).btnType,"onUpdate:modelValue":T[4]||(T[4]=V=>l.unref(p).btnType=V),placeholder:"请选择按钮类型",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(fy),(V,q)=>(l.openBlock(),l.createBlock(Z,{key:q,label:V.key,value:V.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(U,{span:12},{default:l.withCtx(()=>[l.createVNode(B,{label:"按钮别名",prop:"btnAlias"},{default:l.withCtx(()=>[l.createVNode(I,{modelValue:l.unref(p).btnAlias,"onUpdate:modelValue":T[5]||(T[5]=V=>l.unref(p).btnAlias=V),placeholder:"请输入按钮别名",clearable:""},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(U,{span:12},{default:l.withCtx(()=>[l.createVNode(B,{label:"按钮颜色",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"btnColor"},{default:l.withCtx(()=>[l.createVNode(K,{modelValue:l.unref(p).btnColor,"onUpdate:modelValue":T[6]||(T[6]=V=>l.unref(p).btnColor=V),placeholder:"请选择按钮颜色",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(py),(V,q)=>(l.openBlock(),l.createBlock(Z,{key:q,label:V.key,value:V.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),!l.unref(p).isCustomBtn&&l.unref(p).permissionCode!="1001"?(l.openBlock(),l.createBlock(U,{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(K,{modelValue:l.unref(p).submitWay,"onUpdate:modelValue":T[7]||(T[7]=V=>l.unref(p).submitWay=V),placeholder:"请选择提交方式",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(my),(V,q)=>(l.openBlock(),l.createBlock(Z,{key:q,label:V.key,value:V.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(U,{key:1,span:12},{default:l.withCtx(()=>[l.createVNode(B,{label:"导入提交文件字段",rules:[{required:!1,message:"必填项",trigger:"blur"}],prop:"importFileName"},{default:l.withCtx(()=>[l.createVNode(I,{modelValue:l.unref(p).importFileName,"onUpdate:modelValue":T[8]||(T[8]=V=>l.unref(p).importFileName=V),placeholder:"请输入导入提交文件字段",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(U,{key:2,span:12},{default:l.withCtx(()=>[l.createVNode(B,{label:"是否提示校验选择表格",rules:[{required:!1,message:"必填项",trigger:"change"}],prop:"isPromptVerificationSelectTable"},{default:l.withCtx(()=>[l.createVNode(K,{modelValue:l.unref(p).isPromptVerificationSelectTable,"onUpdate:modelValue":T[9]||(T[9]=V=>l.unref(p).isPromptVerificationSelectTable=V),placeholder:"请选择",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Py),(V,q)=>(l.openBlock(),l.createBlock(Z,{key:q,label:V.key,value:V.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})):l.createCommentVNode("",!0)]),_:1}),l.createVNode(fe,{"content-position":"left"},{default:l.withCtx(()=>[T[17]||(T[17]=l.createTextVNode(" 提交字段配置 ")),l.createVNode(J,{class:"add-icon-btn",type:"primary",icon:"Plus",circle:"",onClick:E})]),_:1}),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(p).submitFields,(V,q)=>(l.openBlock(),l.createBlock(X,{gutter:24,key:q},{default:l.withCtx(()=>[l.createVNode(U,{span:6},{default:l.withCtx(()=>[l.createVNode(B,{label:"提交字段名",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"submitFields."+q+".submitFieldName"},{default:l.withCtx(()=>[l.createVNode(I,{modelValue:V.submitFieldName,"onUpdate:modelValue":H=>V.submitFieldName=H,placeholder:"请输入提交字段名",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(U,{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(I,{placeholder:"请输入",modelValue:V.matchFieldName,"onUpdate:modelValue":H=>V.matchFieldName=H,clearable:""},{prepend:l.withCtx(()=>[l.createVNode(K,{modelValue:V.matchType,"onUpdate:modelValue":H=>V.matchType=H,placeholder:"请选择",style:{width:"120px"},onChange:H=>N(V,H)},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(_y),(H,Ue)=>(l.openBlock(),l.createBlock(Z,{key:Ue,label:H.key,value:H.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),V.matchType==="match"?(l.openBlock(),l.createBlock(U,{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(I,{modelValue:V.submitFieldMatchOrigin,"onUpdate:modelValue":H=>V.submitFieldMatchOrigin=H,placeholder:"请输入匹配源",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024)):l.createCommentVNode("",!0),l.createVNode(U,{span:4},{default:l.withCtx(()=>[l.createVNode(B,{label:"提交类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"submitFields."+q+".submitFieldType"},{default:l.withCtx(()=>[l.createVNode(K,{modelValue:V.submitFieldType,"onUpdate:modelValue":H=>V.submitFieldType=H,placeholder:"请选择提交类型",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(gy),(H,Ue)=>(l.openBlock(),l.createBlock(Z,{key:Ue,label:H.key,value:H.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(U,{class:"submit-operate",span:1},{default:l.withCtx(()=>[l.createVNode(J,{class:"match-opreate",type:"danger",icon:"Minus",circle:"",onClick:H=>x(q)},null,8,["onClick"])]),_:2},1024)]),_:2},1024))),128)),l.createVNode(fe,{"content-position":"left"},{default:l.withCtx(()=>[T[18]||(T[18]=l.createTextVNode(" 匹配字段配置(表格操作列按钮显示/隐藏) ")),l.createVNode(J,{class:"add-icon-btn",type:"primary",icon:"Plus",circle:"",onClick:k})]),_:1}),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(p).matchFields,(V,q)=>(l.openBlock(),l.createBlock(X,{gutter:24,key:q},{default:l.withCtx(()=>[l.createVNode(U,{span:10},{default:l.withCtx(()=>[l.createVNode(B,{label:"匹配字段名",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"matchFields."+q+".matchFieldName"},{default:l.withCtx(()=>[l.createVNode(I,{placeholder:"请输入",modelValue:V.matchFieldName,"onUpdate:modelValue":H=>V.matchFieldName=H,clearable:""},{prepend:l.withCtx(()=>[l.createVNode(K,{modelValue:V.matchType,"onUpdate:modelValue":H=>V.matchType=H,placeholder:"请选择",style:{width:"180px"}},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(by),(H,Ue)=>(l.openBlock(),l.createBlock(Z,{key:Ue,label:H.key,value:H.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(U,{span:6},{default:l.withCtx(()=>[l.createVNode(B,{label:"匹配条件",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"matchFields."+q+".matchCondition"},{default:l.withCtx(()=>[l.createVNode(K,{modelValue:V.matchCondition,"onUpdate:modelValue":H=>V.matchCondition=H,placeholder:"请选择匹配条件",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(b),(H,Ue)=>(l.openBlock(),l.createBlock(Z,{key:Ue,label:H.key,value:H.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(U,{span:6},{default:l.withCtx(()=>[l.createVNode(B,{label:"字段值",prop:"matchFields."+q+".fieldValue"},{default:l.withCtx(()=>[l.createVNode(I,{modelValue:V.fieldValue,"onUpdate:modelValue":H=>V.fieldValue=H,placeholder:"请输入字段值",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(U,{class:"submit-operate",span:2},{default:l.withCtx(()=>[l.createVNode(J,{class:"match-opreate",type:"danger",icon:"Minus",circle:"",onClick:H=>P(q)},null,8,["onClick"])]),_:2},1024),q+1!==l.unref(p).matchFields.length?(l.openBlock(),l.createBlock(U,{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(K,{modelValue:V.spliceCondition,"onUpdate:modelValue":H=>V.spliceCondition=H,placeholder:"请选择拼接条件",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Oy),(H,Ue)=>(l.openBlock(),l.createBlock(Z,{key:Ue,label:H.key,value:H.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024)):l.createCommentVNode("",!0)]),_:2},1024))),128)),l.createVNode(X,{gutter:24},{default:l.withCtx(()=>[l.createVNode(U,{span:4},{default:l.withCtx(()=>[l.createVNode(B,{label:"自定义按钮",prop:"isCustomBtn"},{default:l.withCtx(()=>[l.createVNode(he,{modelValue:l.unref(p).isCustomBtn,"onUpdate:modelValue":T[10]||(T[10]=V=>l.unref(p).isCustomBtn=V),onChange:y},null,8,["modelValue"])]),_:1})]),_:1}),l.unref(p).isCustomBtn?(l.openBlock(),l.createBlock(U,{key:0,span:6},{default:l.withCtx(()=>[l.createVNode(B,{label:"自定义类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"customType"},{default:l.withCtx(()=>[l.createVNode(K,{modelValue:l.unref(p).customType,"onUpdate:modelValue":T[11]||(T[11]=V=>l.unref(p).customType=V),placeholder:"请选择关联菜单",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(yy),(V,q)=>(l.openBlock(),l.createBlock(Z,{key:q,label:V.key,value:V.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})):l.createCommentVNode("",!0),l.createVNode(U,{span:6},{default:l.withCtx(()=>[l.createVNode(B,{label:"关联菜单"},{default:l.withCtx(()=>[l.createVNode(K,{modelValue:l.unref(p).associationMenuId,"onUpdate:modelValue":T[12]||(T[12]=V=>l.unref(p).associationMenuId=V),placeholder:"请选择关联菜单",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(m),(V,q)=>(l.openBlock(),l.createBlock(Z,{key:q,label:V.name,value:V.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),l.unref(p).customType==="code"?(l.openBlock(),l.createBlock(X,{key:0,gutter:24},{default:l.withCtx(()=>[l.createVNode(U,{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":T[13]||(T[13]=V=>l.unref(p).codeStr=V)},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})):l.createCommentVNode("",!0),l.unref(p).customType==="component"?(l.openBlock(),l.createBlock(X,{key:1,gutter:24},{default:l.withCtx(()=>[l.createVNode(U,{span:10},{default:l.withCtx(()=>[l.createVNode(B,{label:"组件名称",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"customComponentName"},{default:l.withCtx(()=>[l.createVNode(I,{modelValue:l.unref(p).customComponentName,"onUpdate:modelValue":T[14]||(T[14]=V=>l.unref(p).customComponentName=V),placeholder:"请输入组件名称",clearable:""},{prepend:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(h.value),1)]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(U,{span:14},{default:l.withCtx(()=>[l.createVNode(B,{label:"组件地址",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"customComponentUrl"},{default:l.withCtx(()=>[l.createVNode(I,{modelValue:l.unref(p).customComponentUrl,"onUpdate:modelValue":T[15]||(T[15]=V=>l.unref(p).customComponentUrl=V),placeholder:"请输入组件地址",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})):l.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["model-value","title"])}}},[["__scopeId","data-v-325d2233"]])},Symbol.toStringTag,{value:"Module"})),JT="",s1={slot:"prepend"},r1={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(()=>hT)),n=e,s=i,r=l.inject("pageKey")(),o=l.inject("conditionList")(),a=l.inject("configData")(),c=()=>({btnLoading:!1,showSiteComponentsParamsDialog:!1});let h=l.reactive(c());const u=()=>({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,tableQueryDefaultValue:void 0,tableCellWidthType:"min",tableCellWidth:"120",tableCellAlignType:"center",tableCellContentType:"default",isTableCellOverflowTooltip:!0,isTableCellSort:!0}),f=Wu,d=l.ref(null),m=l.ref(u()),b=()=>["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(A=>A==_));l.watch(()=>s.visible,async(_,A)=>{if(_){const S=(a.value.buttons||[]).filter(T=>T.permissionCode!=1001).map(T=>({key:T.btnName,value:T.permissionCode}));f.some(T=>{if(T.label==="表单配置")return T.options=S,!0});const{data:M}=s;if(!M.fieldName)return;Object.keys(m.value).forEach(T=>{if(T=="permissionCode")m.value[T]=M.unique;else if(T=="formCustomComponentes"){const I=M.useScenes.map(B=>M[T].find(Z=>Z.permissionCode==B)||{});m.value[T]=[...I]}else["postRequestParams","useScenes"].includes(T)?m.value[T]=[...M[T]||[]]:m.value[T]=M[T]})}});const O=()=>{m.value.postRequestParams.push({submitName:"",submitValue:"",submitType:"default",submitMatchType:"",paramsType:""})},C=_=>{m.value.postRequestParams.splice(_,1)},y=_=>{m.value.postRequestParams=[]},E=_=>{const A=f.find(M=>M.label==="表格配置").options,S=f.find(M=>M.label==="表单配置").options;m.value.formCustomComponentes=[...A,...S].filter(M=>_.includes(M.value)).map(M=>{const T=m.value.formCustomComponentes.find(I=>I.permissionCode==M.value);return{btnName:M.key,permissionCode:M.value,pageKey:r,customComponentName:(T==null?void 0:T.customComponentName)||void 0,customComponentUrl:(T==null?void 0:T.customComponentUrl)||void 0,isFieldCustom:(T==null?void 0:T.isFieldCustom)||!1}})},x=(_,A)=>{A.customComponentName=void 0,A.customComponentUrl=void 0},k=_=>{P(),_()},P=()=>{m.value=u(),d.value.resetFields(),n("update:visible",!1)},N=_=>{_&&_.validate(A=>{A&&(h.btnLoading=!0,m.value.formCustomComponentes.forEach(S=>{delete S.isFiledCustom}),n("refresh",JSON.parse(JSON.stringify(m.value)),()=>{P()}),h.btnLoading=!1)})};return(_,A)=>{const S=l.resolveComponent("el-input"),M=l.resolveComponent("el-form-item"),T=l.resolveComponent("el-col"),I=l.resolveComponent("el-option"),B=l.resolveComponent("el-select"),U=l.resolveComponent("el-button"),Z=l.resolveComponent("el-row"),K=l.resolveComponent("el-divider"),X=l.resolveComponent("el-option-group"),J=l.resolveComponent("el-switch"),fe=l.resolveComponent("el-input-number"),he=l.resolveComponent("el-form"),ye=l.resolveComponent("el-scrollbar"),z=l.resolveComponent("el-dialog"),D=l.resolveDirective("debounce");return l.openBlock(),l.createBlock(z,{"model-value":s.visible,title:s.title,top:"5vh",width:"1400",draggable:"",overflow:"","close-on-click-modal":!1,"before-close":k},{footer:l.withCtx(()=>[l.createElementVNode("span",r1,[l.createVNode(U,{onClick:P,loading:l.unref(h).btnLoading},{default:l.withCtx(()=>A[29]||(A[29]=[l.createTextVNode("取消")])),_:1},8,["loading"]),l.withDirectives((l.openBlock(),l.createBlock(U,{type:"primary",loading:l.unref(h).btnLoading,onClick:A[22]||(A[22]=V=>N(d.value))},{default:l.withCtx(()=>A[30]||(A[30]=[l.createTextVNode("保存")])),_:1},8,["loading"])),[[D]])])]),default:l.withCtx(()=>[l.createVNode(ye,{ref:"configFieldsScroll","max-height":"800px"},{default:l.withCtx(()=>[l.createVNode(he,{ref_key:"formRef",ref:d,model:m.value,"label-suffix":":","label-width":"120px"},{default:l.withCtx(()=>[l.createVNode(Z,null,{default:l.withCtx(()=>[l.createVNode(T,{span:6},{default:l.withCtx(()=>[l.createVNode(M,{label:"字段名称",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"fieldName"},{default:l.withCtx(()=>[l.createVNode(S,{modelValue:m.value.fieldName,"onUpdate:modelValue":A[0]||(A[0]=V=>m.value.fieldName=V),placeholder:"请输入",clearable:""},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(T,{span:6},{default:l.withCtx(()=>[l.createVNode(M,{label:"字段key",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"fieldKey"},{default:l.withCtx(()=>[l.createVNode(S,{modelValue:m.value.fieldKey,"onUpdate:modelValue":A[1]||(A[1]=V=>m.value.fieldKey=V),placeholder:"请输入",clearable:""},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(T,{span:6},{default:l.withCtx(()=>[l.createVNode(M,{label:"字段类型",rules:[{required:!0,message:"必填项",trigger:["change"]}],prop:"fieldType"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.fieldType,"onUpdate:modelValue":A[2]||(A[2]=V=>m.value.fieldType=V),placeholder:"请选择",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(qu),V=>(l.openBlock(),l.createBlock(I,{key:V.value,label:V.key,value:V.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(T,{span:4},{default:l.withCtx(()=>[l.createVNode(M,{label:"组件参数",rules:[{required:!1,message:"必填项",trigger:["change"]}],prop:"fieldType"},{default:l.withCtx(()=>[l.createVNode(U,{type:"primary",onClick:A[3]||(A[3]=V=>l.unref(h).showSiteComponentsParamsDialog=!0)},{default:l.withCtx(()=>A[23]||(A[23]=[l.createTextVNode("设置props")])),_:1}),l.createVNode(l.unref(t),{modelValue:m.value.fieldUiProps,"onUpdate:modelValue":A[4]||(A[4]=V=>m.value.fieldUiProps=V),visible:l.unref(h).showSiteComponentsParamsDialog,"onUpdate:visible":A[5]||(A[5]=V=>l.unref(h).showSiteComponentsParamsDialog=V),title:"设置组件参数"},null,8,["modelValue","visible"])]),_:1})]),_:1})]),_:1}),b()?(l.openBlock(),l.createBlock(Z,{key:0},{default:l.withCtx(()=>[l.createVNode(T,{span:24},{default:l.withCtx(()=>[l.createVNode(M,{label:"数据源",prop:"fieldRequestUrl"},{default:l.withCtx(()=>[l.createVNode(S,{placeholder:"请输入",modelValue:m.value.fieldRequestUrl,"onUpdate:modelValue":A[7]||(A[7]=V=>m.value.fieldRequestUrl=V),clearable:""},{prepend:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.fieldRequestType,"onUpdate:modelValue":A[6]||(A[6]=V=>m.value.fieldRequestType=V),placeholder:"请选择",style:{width:"150px"},onChange:y},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(wy),V=>(l.openBlock(),l.createBlock(I,{key:V.value,label:V.key,value:V.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(K,{"content-position":"left"},{default:l.withCtx(()=>[A[24]||(A[24]=l.createTextVNode(" POST参数配置 ")),l.createVNode(U,{class:"add-icon-btn",type:"primary",icon:"Plus",circle:"",onClick:O})]),_:1}),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(m.value.postRequestParams,(V,q)=>(l.openBlock(),l.createBlock(Z,{key:q},{default:l.withCtx(()=>[l.createVNode(T,{span:5},{default:l.withCtx(()=>[l.createVNode(M,{label:"提交字段名",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"postRequestParams."+q+".submitName"},{default:l.withCtx(()=>[l.createVNode(S,{modelValue:V.submitName,"onUpdate:modelValue":H=>V.submitName=H,placeholder:"请输入提交字段名",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(T,{span:8},{default:l.withCtx(()=>[l.createVNode(M,{label:"方式",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"postRequestParams."+q+".submitValue"},{default:l.withCtx(()=>[l.createVNode(S,{placeholder:"请输入值",modelValue:V.submitValue,"onUpdate:modelValue":H=>V.submitValue=H,clearable:""},{prepend:l.withCtx(()=>[l.createVNode(B,{modelValue:V.submitType,"onUpdate:modelValue":H=>V.submitType=H,placeholder:"请选择方式",style:{width:"120px"}},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(ky),(H,Ue)=>(l.openBlock(),l.createBlock(I,{key:Ue,label:H.key,value:H.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),V.submitType==="dynamic"?(l.openBlock(),l.createBlock(T,{key:0,span:5},{default:l.withCtx(()=>[l.createVNode(M,{label:"匹配条件",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"postRequestParams."+q+".submitMatchType"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:V.submitMatchType,"onUpdate:modelValue":H=>V.submitMatchType=H,placeholder:"请选择方式",clearable:"",filterable:"",style:{width:"120px"}},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(o),(H,Ue)=>(l.openBlock(),l.createBlock(I,{key:Ue,label:H.key,value:H.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024)):l.createCommentVNode("",!0),l.createVNode(T,{span:5},{default:l.withCtx(()=>[l.createVNode(M,{label:"提交类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"postRequestParams."+q+".paramsType"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:V.paramsType,"onUpdate:modelValue":H=>V.paramsType=H,placeholder:"请选择",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Xu),(H,Ue)=>(l.openBlock(),l.createBlock(I,{key:Ue,label:H.key,value:H.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(T,{class:"submit-operate",span:1},{default:l.withCtx(()=>[l.createVNode(U,{class:"match-opreate",type:"danger",icon:"Minus",circle:"",onClick:H=>C(q)},null,8,["onClick"])]),_:2},1024)]),_:2},1024))),128))],64)):l.createCommentVNode("",!0),l.createVNode(Z,null,{default:l.withCtx(()=>[l.createVNode(T,{span:24},{default:l.withCtx(()=>[l.createVNode(M,{label:"使用场景",rules:[{required:!1,message:"必填项",trigger:["change"]}],prop:"useScenes"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.useScenes,"onUpdate:modelValue":A[8]||(A[8]=V=>m.value.useScenes=V),placeholder:"请选择",multiple:"",clearable:"",filterable:"",onChange:E},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(f),V=>(l.openBlock(),l.createBlock(X,{key:V.label,label:V.label},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(V.options,q=>(l.openBlock(),l.createBlock(I,{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(Z,{key:2},{default:l.withCtx(()=>[l.createVNode(K,{"content-position":"left"},{default:l.withCtx(()=>A[25]||(A[25]=[l.createTextVNode("查询模块")])),_:1}),l.createVNode(T,{span:6},{default:l.withCtx(()=>[l.createVNode(M,{label:"查询条件",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"tableQueryCondition"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.tableQueryCondition,"onUpdate:modelValue":A[9]||(A[9]=V=>m.value.tableQueryCondition=V),placeholder:"请选择查询条件",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(o),(V,q)=>(l.openBlock(),l.createBlock(I,{key:q,label:V.key,value:V.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(T,{span:6},{default:l.withCtx(()=>[l.createVNode(M,{label:"默认值",rules:[{required:!1,message:"必填项",trigger:"blur"}],prop:"tableQueryDefaultValue"},{default:l.withCtx(()=>[l.createVNode(S,{modelValue:m.value.tableQueryDefaultValue,"onUpdate:modelValue":A[10]||(A[10]=V=>m.value.tableQueryDefaultValue=V),placeholder:"请输入",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})):l.createCommentVNode("",!0),g()?(l.openBlock(),l.createBlock(Z,{key:3},{default:l.withCtx(()=>[l.createVNode(K,{"content-position":"left"},{default:l.withCtx(()=>A[26]||(A[26]=[l.createTextVNode("表格模块")])),_:1}),l.createVNode(T,{span:6},{default:l.withCtx(()=>[l.createVNode(M,{label:"列宽",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"tableCellWidth"},{default:l.withCtx(()=>[l.createVNode(S,{placeholder:"请输入",modelValue:m.value.tableCellWidth,"onUpdate:modelValue":A[12]||(A[12]=V=>m.value.tableCellWidth=V)},{prepend:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.tableCellWidthType,"onUpdate:modelValue":A[11]||(A[11]=V=>m.value.tableCellWidthType=V),placeholder:"请选择",style:{width:"100px"}},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Ay),(V,q)=>(l.openBlock(),l.createBlock(I,{key:q,label:V.key,value:V.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(T,{span:6},{default:l.withCtx(()=>[l.createVNode(M,{label:"对齐方式",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"tableCellAlignType"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.tableCellAlignType,"onUpdate:modelValue":A[13]||(A[13]=V=>m.value.tableCellAlignType=V),placeholder:"请选择对齐方式",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Sy),(V,q)=>(l.openBlock(),l.createBlock(I,{key:q,label:V.key,value:V.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(T,{span:6},{default:l.withCtx(()=>[l.createVNode(M,{label:"内容类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"tableCellContentType"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.tableCellContentType,"onUpdate:modelValue":A[14]||(A[14]=V=>m.value.tableCellContentType=V),placeholder:"请选择内容类型",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Cy),(V,q)=>(l.openBlock(),l.createBlock(I,{key:q,label:V.key,value:V.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(T,{span:2},{default:l.withCtx(()=>[l.createVNode(M,{label:"溢出隐藏",prop:"isTableCellOverflowTooltip"},{default:l.withCtx(()=>[l.createVNode(J,{modelValue:m.value.isTableCellOverflowTooltip,"onUpdate:modelValue":A[15]||(A[15]=V=>m.value.isTableCellOverflowTooltip=V)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(T,{span:2},{default:l.withCtx(()=>[l.createVNode(M,{label:"排序",prop:"isTableCellSort"},{default:l.withCtx(()=>[l.createVNode(J,{modelValue:m.value.isTableCellSort,"onUpdate:modelValue":A[16]||(A[16]=V=>m.value.isTableCellSort=V)},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})):l.createCommentVNode("",!0),p()?(l.openBlock(),l.createBlock(Z,{key:4},{default:l.withCtx(()=>[l.createVNode(K,{"content-position":"left"},{default:l.withCtx(()=>A[27]||(A[27]=[l.createTextVNode("表单模块")])),_:1}),l.createVNode(T,{span:3},{default:l.withCtx(()=>[l.createVNode(M,{label:"是否必填",prop:"isFormFieldRequired"},{default:l.withCtx(()=>[l.createVNode(J,{modelValue:m.value.isFormFieldRequired,"onUpdate:modelValue":A[17]||(A[17]=V=>m.value.isFormFieldRequired=V)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(T,{span:3},{default:l.withCtx(()=>[l.createVNode(M,{label:"是否回显",prop:"isFormSetValue"},{default:l.withCtx(()=>[l.createVNode(J,{modelValue:m.value.isFormSetValue,"onUpdate:modelValue":A[18]||(A[18]=V=>m.value.isFormSetValue=V)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(T,{span:3},{default:l.withCtx(()=>[l.createVNode(M,{label:"是否禁用",prop:"isFormDisabled"},{default:l.withCtx(()=>[l.createVNode(J,{modelValue:m.value.isFormDisabled,"onUpdate:modelValue":A[19]||(A[19]=V=>m.value.isFormDisabled=V)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(T,{span:6},{default:l.withCtx(()=>[l.createVNode(M,{label:"提交类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"fieldSubmitType"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.fieldSubmitType,"onUpdate:modelValue":A[20]||(A[20]=V=>m.value.fieldSubmitType=V),placeholder:"请选择提交类型",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(xy),(V,q)=>(l.openBlock(),l.createBlock(I,{key:q,label:V.key,value:V.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(T,{span:6},{default:l.withCtx(()=>[l.createVNode(M,{label:"栅格数",prop:"formColumnCol"},{default:l.withCtx(()=>[l.createVNode(fe,{modelValue:m.value.formColumnCol,"onUpdate:modelValue":A[21]||(A[21]=V=>m.value.formColumnCol=V),max:24},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})):l.createCommentVNode("",!0),l.createVNode(K,{"content-position":"left"},{default:l.withCtx(()=>A[28]||(A[28]=[l.createTextVNode("不同场景自定义字段组件")])),_:1}),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(m.value.formCustomComponentes,(V,q)=>(l.openBlock(),l.createBlock(Z,{key:q},{default:l.withCtx(()=>[l.createVNode(T,{span:2},{default:l.withCtx(()=>[l.createVNode(M,{label:`${V.btnName}`,prop:`formCustomComponentes.${q}.isFieldCustom`},{default:l.withCtx(()=>[l.createVNode(J,{modelValue:V.isFieldCustom,"onUpdate:modelValue":H=>V.isFieldCustom=H,onChange:H=>x(H,V)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),_:2},1032,["label","prop"])]),_:2},1024),V.isFieldCustom?(l.openBlock(),l.createBlock(T,{key:0,span:8},{default:l.withCtx(()=>[l.createVNode(M,{label:"组件名称","label-width":"220",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:`formCustomComponentes.${q}.customComponentName`},{default:l.withCtx(()=>[l.createVNode(S,{modelValue:V.customComponentName,"onUpdate:modelValue":H=>V.customComponentName=H,placeholder:"请输入",clearable:""},{default:l.withCtx(()=>[l.createElementVNode("template",s1,[l.createTextVNode(l.toDisplayString(l.unref(r)),1)])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024)):l.createCommentVNode("",!0),V.isFieldCustom?(l.openBlock(),l.createBlock(T,{key:1,span:14},{default:l.withCtx(()=>[l.createVNode(M,{label:"组件地址",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:`formCustomComponentes.${q}.customComponentUrl`},{default:l.withCtx(()=>[l.createVNode(S,{modelValue:V.customComponentUrl,"onUpdate:modelValue":H=>V.customComponentUrl=H,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-6b2ebaa8"]])},Symbol.toStringTag,{value:"Module"})),Gu=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 h=l.resolveComponent("el-input");return l.openBlock(),l.createBlock(h,l.mergeProps({modelValue:s.value,"onUpdate:modelValue":c[0]||(c[0]=u=>s.value=u),modelModifiers:{number:!0},placeholder:"Please input"},a.$attrs,{onInput:o}),null,16,["modelValue"])}}}},Symbol.toStringTag,{value:"Module"})),nE="",sE="",l1={class:"select-icon-container"},a1={class:"icon-list"},c1=["onClick"],h1={class:"icon-value",slot:"reference"},Hu=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,(h,u)=>{h&&(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,(h,u)=>{if(!h){r.value=-1,t("update:modelValue","");return}const f=o.value.findIndex(d=>d===h);r.value=f},{deep:!0,immediate:!0});const c=(h,u)=>{r.value=u,t("update:modelValue",a()),s.value=!1};return(h,u)=>{const f=l.resolveComponent("a-svg-icon"),d=l.resolveComponent("el-button"),m=l.resolveComponent("el-popover");return l.openBlock(),l.createElementBlock("div",l1,[l.createVNode(m,{"popper-class":"select-icon-popover",placement:"bottom-start",visible:l.unref(s),"onUpdate:visible":u[0]||(u[0]=b=>l.isRef(s)?s.value=b:s=b),width:400,trigger:"click"},{reference:l.withCtx(()=>[l.createElementVNode("div",h1,[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(()=>u[1]||(u[1]=[l.createTextVNode("选择图标")])),_:1})])]),default:l.withCtx(()=>[l.createElementVNode("ul",a1,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(o),(b,w)=>(l.openBlock(),l.createElementBlock("li",{class:l.normalizeClass(["icon-item",{"icon-item-checked":l.unref(r)==w}]),key:w,onClick:g=>c(b,w)},[l.createVNode(f,{class:"icon-svg",name:b,width:"24",height:"24",color:"#999"},null,8,["name"])],10,c1))),128))])]),_:1},8,["visible"])])}}},[["__scopeId","data-v-308d02d4"]])},Symbol.toStringTag,{value:"Module"}));let Ar;const u1=new Uint8Array(16);function f1(){if(!Ar&&(Ar=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ar))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ar(u1)}const ht=[];for(let i=0;i<256;++i)ht.push((i+256).toString(16).slice(1));function d1(i,e=0){return ht[i[e+0]]+ht[i[e+1]]+ht[i[e+2]]+ht[i[e+3]]+"-"+ht[i[e+4]]+ht[i[e+5]]+"-"+ht[i[e+6]]+ht[i[e+7]]+"-"+ht[i[e+8]]+ht[i[e+9]]+"-"+ht[i[e+10]]+ht[i[e+11]]+ht[i[e+12]]+ht[i[e+13]]+ht[i[e+14]]+ht[i[e+15]]}const Ku={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function p1(i,e,t){if(Ku.randomUUID&&!e&&!i)return Ku.randomUUID();i=i||{};const n=i.random||(i.rng||f1)();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 d1(n)}const aE="",m1={class:"upload-container"},g1={class:"el-upload__text"},O1={class:"tip-text"},_1={class:"file-list-l"},b1=["onMouseenter","onMouseleave"],y1={class:"el-file-operate"},w1=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}=Iu(),{t:o}=Gt(),a=t,c=i,h={image:/(gif|jpg|jpeg|png|pdf|bmp|webp|GIF|JPG|PDF|PNG|JPEG)$/,word:/(doc|docx)$/,pdf:/(pdf)$/,excel:/(xls|xlsx)$/};let u=l.ref(!1),f=l.ref({}),d=l.ref(!1),m=l.ref(null),b=null,w=l.computed({get(){return C(c.modelValue)},set(T){a("update:modelValue",T)}});const g=T=>{const I=(w.value||[]).map(Z=>Z.filePath);if(T==0)return I;let B=I.splice(T),U=I.splice(0,T);return B.concat(U)},p=T=>{const I=T.substring(T.lastIndexOf(".")+1);let B=null;return Object.keys(h).some(U=>{if(h[U].test(I))return B=U,!0}),B===null&&(B="file"),B},O=T=>T.map(I=>({uid:I.uid??p1(),name:n(I),filePath:I,fileType:p(I),status:"success"})),C=T=>{const I=Array.isArray(T)?T.map(B=>B.filePath):T?T.split(";"):[];return O(I||[])},y=({name:T})=>{const I=T.lastIndexOf("."),B=T.slice(I),U=c.accept.trim().split(",");let Z=!1;return U.includes(B)&&(Z=!0),Z=U.some(K=>K=="image/*"?h.image.test(B):K.startsWith(".")?T.endsWith(K):K===B),Z||Ne.ElNotification({title:`${o("act.tip")}`,message:`【${T}】${o("act.uploadErrorTip")}`,type:"warning",duration:2500}),Z},E=(T,I,B)=>{b&&(clearTimeout(b),b=null),b=setTimeout(()=>{T.call(this,I)},B)},x=T=>c.request({url:c.action,method:"POST",data:T,headers:{"Content-Type":"application/x-www-form-urlencoded"}}),k=async T=>{try{const I=T.filter(X=>X.status=="ready"&&y(X)),B=w.value.length+I.length;if(I.length===0){m.value.clearFiles();return}if(B>c.limit){Ne.ElNotification({title:`${o("act.tip")}`,message:`${o("act.uploadLimitTip")}`,type:"warning",duration:2500}),m.value.clearFiles();return}if(!c.autoUpload){const X=I.map(J=>({...J,filePath:null,status:"success"}));a("update:modelValue",X),m.value.clearFiles();return}u.value=!0;const U=new FormData;Object.keys(c.data).forEach(X=>{U.append(X,c.data[X])}),I.forEach(X=>{U.append(c.name,X.raw)});let{data:Z}=await x(U);const K=c.multiple?[...w.value.map(X=>X.filePath),...Z.filePaths||[]].join(";"):[...Z.filePaths||[]].join(";");m.value.clearFiles(),a("update:modelValue",K),u.value=!1}catch(I){m.value.clearFiles(),u.value=!1,console.error(I)}},P=(T,I)=>{E(k,I,500)},N=(T,I)=>{const B=f.value[`tooltipRef${I}`];d.value=B.scrollWidth<=Math.round(B.getBoundingClientRect().width)},_=({filePath:T,name:I,uid:B},U)=>{l.nextTick(()=>{document.querySelector(`.previewImage_${B}`).children[0].click()})},A=({filePath:T,name:I})=>{r(c.request,T)},S=(T,I)=>{w.value=w.value.filter((B,U)=>U!==I),a("delete",{data:T})};return e({clearFiles:()=>{w.value=[],m.value.clearFiles()}}),(T,I)=>{const B=l.resolveComponent("upload-filled"),U=l.resolveComponent("el-icon"),Z=l.resolveComponent("el-upload"),K=l.resolveComponent("el-image"),X=l.resolveComponent("el-tooltip"),J=l.resolveComponent("el-button"),fe=l.resolveDirective("loading");return l.openBlock(),l.createElementBlock("div",m1,[l.withDirectives((l.openBlock(),l.createBlock(Z,l.mergeProps({ref_key:"uploadRef",ref:m,action:"#",drag:"",accept:c.accept,multiple:c.multiple,"auto-upload":!1,"show-file-list":!1,"on-change":P},T.$attrs,{"element-loading-text":l.unref(o)("act.uploadLoading")}),{tip:l.withCtx(()=>[c.tipText?l.renderSlot(T.$slots,"default",{key:0},()=>[l.createElementVNode("p",O1,l.toDisplayString(c.tipText),1)],!0):l.createCommentVNode("",!0)]),default:l.withCtx(()=>[l.createVNode(U,{class:"el-icon--upload"},{default:l.withCtx(()=>[l.createVNode(B)]),_:1}),l.createElementVNode("div",g1,[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"])),[[fe,l.unref(u)]]),l.renderSlot(T.$slots,"default",{},()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(w),(he,ye)=>(l.openBlock(),l.createElementBlock("div",{class:"file-list",key:he.uid},[l.createElementVNode("div",_1,[he.fileType==="image"?(l.openBlock(),l.createBlock(K,{key:0,class:l.normalizeClass(["file-list-image",{[`previewImage_${he.uid}`]:!0}]),fit:"cover","preview-src-list":g(ye),"preview-teleported":"",src:he.filePath},null,8,["class","preview-src-list","src"])):(l.openBlock(),l.createBlock(K,{key:1,class:"file-list-icon",src:l.unref(s)(`images/upload-${he.fileType}.png`)},null,8,["src"])),l.createVNode(X,{effect:"dark",content:he.name,placement:"bottom-start",disabled:l.unref(d)},{default:l.withCtx(()=>[l.createElementVNode("div",{class:"el-file-name",ref_for:!0,ref:z=>l.unref(f)[`tooltipRef${ye}`]=z,onMouseenter:z=>N(z,ye),onMouseleave:z=>N(z,ye)},l.toDisplayString(he.name),41,b1)]),_:2},1032,["content","disabled"])]),l.createElementVNode("div",y1,[he.fileType==="image"?(l.openBlock(),l.createBlock(J,{key:0,type:"primary",size:"small",icon:l.unref(oy),circle:"",onClick:z=>_(he)},null,8,["icon","onClick"])):l.createCommentVNode("",!0),l.createVNode(J,{type:"primary",size:"small",icon:l.unref(iy),circle:"",onClick:z=>A(he)},null,8,["icon","onClick"]),l.createVNode(J,{type:"danger",size:"small",icon:l.unref(ey),circle:"",onClick:z=>S(he,ye)},null,8,["icon","onClick"])])]))),128))],!0)])}}},[["__scopeId","data-v-f839bee6"]])},Symbol.toStringTag,{value:"Module"}));var k1=["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"],x1=function(i){return k1.map(function(e){return e.toLowerCase()}).indexOf(i.toLowerCase())!==-1},S1=function(i,e,t){Object.keys(e).filter(x1).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)}))})},C1=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}))})},A1=function(i,e,t,n,s,r){n.setContent(r()),t.attrs["onUpdate:modelValue"]&&C1(e,t,n,s),S1(i,t.attrs,n)},Ju=0,ef=function(i){var e=Date.now(),t=Math.floor(Math.random()*1e9);return Ju++,i+"_"+t+Ju+String(e)},Q1=function(i){return i!==null&&i.tagName.toLowerCase()==="textarea"},tf=function(i){return typeof i>"u"||i===""?[]:Array.isArray(i)?i:i.split(" ")},P1=function(i,e){return tf(i).concat(tf(e))},T1=function(i){return i==null},nf=function(){return{listeners:[],scriptId:ef("tiny-script"),scriptLoaded:!1}},E1=function(){var i=nf(),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 h=function(){c.removeEventListener("load",h),a()};c.addEventListener("load",h),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=nf()};return{load:t,reinitialize:n}},$1=E1(),N1=function(){return typeof window<"u"?window:global},hn=function(){var i=N1();return i&&i.tinymce?i.tinymce:null},R1={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,tinymceScriptSrc:String,outputFormat:{type:String,validator:function(i){return i==="html"||i==="text"}}},oi=globalThis&&globalThis.__assign||function(){return oi=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},oi.apply(this,arguments)},V1=function(i,e,t,n){return i(n||"div",{id:e,ref:t})},L1=function(i,e,t){return i("textarea",{id:e,visibility:"hidden",ref:t})},Ll={selector:void 0,target:void 0},M1=l.defineComponent({props:R1,setup:function(i,e){var t=i.init?oi(oi({},i.init),Ll):oi({},Ll),n=l.toRefs(i),s=n.disabled,r=n.modelValue,o=n.tagName,a=l.ref(null),c=null,h=i.id||ef("tiny-vue"),u=i.init&&i.init.inline||i.inline,f=!!e.attrs["onUpdate:modelValue"],d=!0,m=i.initialValue?i.initialValue:"",b="",w=function(O){return f?function(){return r!=null&&r.value?r.value:""}:function(){return O?m:b}},g=function(){var O=w(d),C=oi(oi({},t),{readonly:i.disabled,target:a.value,plugins:P1(t.plugins,i.plugins),toolbar:i.toolbar||t.toolbar,inline:u,license_key:i.licenseKey,setup:function(y){c=y,y.on("init",function(E){return A1(E,i,e,y,r,O)}),typeof t.setup=="function"&&t.setup(y)}});Q1(a.value)&&(a.value.style.visibility=""),hn().init(C),d=!1};l.watch(s,function(O){var C;c!==null&&(typeof((C=c.mode)===null||C===void 0?void 0:C.set)=="function"?c.mode.set(O?"readonly":"design"):c.setMode(O?"readonly":"design"))}),l.watch(o,function(O){var C;f||(b=c.getContent()),(C=hn())===null||C===void 0||C.remove(c),l.nextTick(function(){return g()})}),l.onMounted(function(){if(hn()!==null)g();else if(a.value&&a.value.ownerDocument){var O=i.cloudChannel?i.cloudChannel:"7",C=i.apiKey?i.apiKey:"no-api-key",y=T1(i.tinymceScriptSrc)?"https://cdn.tiny.cloud/1/".concat(C,"/tinymce/").concat(O,"/tinymce.min.js"):i.tinymceScriptSrc;$1.load(a.value.ownerDocument,y,g)}}),l.onBeforeUnmount(function(){hn()!==null&&hn().remove(c)}),u||(l.onActivated(function(){d||g()}),l.onDeactivated(function(){var O;f||(b=c.getContent()),(O=hn())===null||O===void 0||O.remove(c)}));var p=function(O){var C;b=c.getContent(),(C=hn())===null||C===void 0||C.remove(c),t=oi(oi(oi({},t),O),Ll),l.nextTick(function(){return g()})};return e.expose({rerender:p,getEditor:function(){return c}}),function(){return u?V1(l.h,h,a,i.tagName):L1(l.h,h,a)}}});const uE="",B1={style:{height:"100%",overflow:"hidden"}},D1=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,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(u,f){}});console.log(o);const a=l.computed({get(){return s.modelValue},set(u){n("update:modelValue",u)}});return l.watch(()=>a.value,()=>{n("setHtml",hr.activeEditor.getContent({format:"text"}),a.value)}),l.onMounted(()=>{hr.init({})}),e({onGetContent:()=>hr.activeEditor.getContent(),onSetContent:u=>{hr.activeEditor.setContent(u)}}),(u,f)=>(l.openBlock(),l.createElementBlock("div",B1,[l.createVNode(l.unref(M1),{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 Ml=[],sf=[];(()=>{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?sf:Ml).push(t=t+i[e])})();function v1(i){if(i<768)return!1;for(let e=0,t=Ml.length;;){let n=e+t>>1;if(i<Ml[n])t=n;else if(i>=sf[n])e=n+1;else return!0;if(e==t)return!1}}function rf(i){return i>=127462&&i<=127487}const of=8205;function Z1(i,e,t=!0,n=!0){return(t?lf:I1)(i,e,n)}function lf(i,e,t){if(e==i.length)return e;e&&af(i.charCodeAt(e))&&cf(i.charCodeAt(e-1))&&e--;let n=Bl(i,e);for(e+=hf(n);e<i.length;){let s=Bl(i,e);if(n==of||s==of||t&&v1(s))e+=hf(s),n=s;else if(rf(s)){let r=0,o=e-2;for(;o>=0&&rf(Bl(i,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function I1(i,e,t){for(;e>0;){let n=lf(i,e-2,t);if(n<e)return n;e--}return 0}function Bl(i,e){let t=i.charCodeAt(e);if(!cf(t)||e+1==i.length)return t;let n=i.charCodeAt(e+1);return af(n)?(t-55296<<10)+(n-56320)+65536:t}function af(i){return i>=56320&&i<57344}function cf(i){return i>=55296&&i<56320}function hf(i){return i<65536?1:2}class Ae{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]=Rn(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),li.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]=Rn(this,e,t);let n=[];return this.decompose(e,t,n,0),li.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 ff(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 df(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]?Ae.empty:e.length<=32?new ze(e):li.from(ze.split(e,[]))}}class ze extends Ae{constructor(e,t=U1(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 F1(s,a,n,o);s=a+1,n++}}decompose(e,t,n,s){let r=e<=0&&t>=this.length?this:new ze(uf(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]=Rn(this,e,t);let s=Qr(this.text,Qr(n.text,uf(this.text,0,e)),t),r=this.length+n.length-(t-e);return s.length<=32?new ze(s,r):li.from(ze.split(s,[]),r)}sliceString(e,t=this.length,n=`
|
|
21
|
+
*/const J0="10.0.5";function eb(){typeof __VUE_I18N_FULL_INSTALL__!="boolean"&&(ln().__VUE_I18N_FULL_INSTALL__=!0),typeof __VUE_I18N_LEGACY_API__!="boolean"&&(ln().__VUE_I18N_LEGACY_API__=!0),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(ln().__INTLIFY_DROP_MESSAGE_COMPILER__=!1),typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(ln().__INTLIFY_PROD_DEVTOOLS__=!1)}const Ui={FALLBACK_TO_ROOT:y0,NOT_FOUND_PARENT_SCOPE:9,IGNORE_OBJ_FLATTEN:10,DEPRECATE_TC:11},tb={[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 yr(i,...e){return ur(tb[i],...e)}const Me={UNEXPECTED_RETURN_TYPE:l0,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:ib,args:e}:void 0)}const ib={[Me.UNEXPECTED_RETURN_TYPE]:"Unexpected return type in composer",[Me.INVALID_ARGUMENT]:"Invalid argument",[Me.MUST_BE_CALL_SETUP_TOP]:"Must be called at the top of a `setup` function",[Me.NOT_INSTALLED]:"Need to install with `app.use` function",[Me.UNEXPECTED_ERROR]:"Unexpected error",[Me.REQUIRED_VALUE]:"Required in value: {0}",[Me.INVALID_VALUE]:"Invalid value",[Me.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN]:"Cannot setup vue-devtools plugin",[Me.NOT_INSTALLED_WITH_PROVIDE]:"Need to install with `provide` function",[Me.NOT_COMPATIBLE_LEGACY_VUE_I18N]:"Not compatible legacy VueI18n.",[Me.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=si("__translateVNode"),wl=si("__datetimeParts"),kl=si("__numberParts"),cn=si("__enableEmitter"),us=si("__disableEmitter"),eu=si("__setPluralRules"),tu=si("__injectWithOption"),xl=si("__dispose");function fs(i){if(!Ce(i))return i;for(const e in i)if(zt(i,e))if(!e.includes("."))Ce(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]in s||(s[t[o]]=Ve()),!Ce(s[t[o]])){process.env.NODE_ENV!=="production"&&Bi(yr(Ui.IGNORE_OBJ_FLATTEN,{key:t[o]})),r=!0;break}s=s[t[o]]}r||(s[t[n]]=i[e],delete i[e]),Ce(s[t[n]])&&fs(s[t[n]])}return i}function Sl(i,e){const{messages:t,__i18n:n,messageResolver:s,flatJson:r}=e,o=ke(t)?t:We(n)?Ve():{[i]:Ve()};if(We(n)&&n.forEach(a=>{if("locale"in a&&"resource"in a){const{locale:c,resource:h}=a;c?(o[c]=o[c]||Ve(),pr(h,o[c])):pr(h,o)}else ne(a)&&pr(JSON.parse(a),o)}),s==null&&r)for(const a in o)zt(o,a)&&fs(o[a]);return o}function iu(i){return i.type}function nu(i,e,t){let n=Ce(e.messages)?e.messages:Ve();"__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(Ce(e.datetimeFormats)){const r=Object.keys(e.datetimeFormats);r.length&&r.forEach(o=>{i.mergeDateTimeFormat(o,e.datetimeFormats[o])})}if(Ce(e.numberFormats)){const r=Object.keys(e.numberFormats);r.length&&r.forEach(o=>{i.mergeNumberFormat(o,e.numberFormats[o])})}}}function su(i){return l.createVNode(l.Text,null,i,0)}const ru="__INTLIFY_META__",ou=()=>[],nb=()=>!1;let lu=0;function au(i){return(e,t,n,s)=>i(t,n,l.getCurrentInstance()||void 0,s)}const sb=()=>{const i=l.getCurrentInstance();let e=null;return i&&(e=iu(i)[ru])?{[ru]: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=Te(i.inheritLocale)?i.inheritLocale:!0;const a=r(e&&o?e.locale.value:ne(i.locale)?i.locale:cs),c=r(e&&o?e.fallbackLocale.value:ne(i.fallbackLocale)||We(i.fallbackLocale)||ke(i.fallbackLocale)||i.fallbackLocale===!1?i.fallbackLocale:a.value),h=r(Sl(a.value,i)),u=r(ke(i.datetimeFormats)?i.datetimeFormats:{[a.value]:{}}),f=r(ke(i.numberFormats)?i.numberFormats:{[a.value]:{}});let d=e?e.missingWarn:Te(i.missingWarn)||An(i.missingWarn)?i.missingWarn:!0,m=e?e.fallbackWarn:Te(i.fallbackWarn)||An(i.fallbackWarn)?i.fallbackWarn:!0,b=e?e.fallbackRoot:Te(i.fallbackRoot)?i.fallbackRoot:!0,w=!!i.fallbackFormat,g=Le(i.missing)?i.missing:null,p=Le(i.missing)?au(i.missing):null,O=Le(i.postTranslation)?i.postTranslation:null,C=e?e.warnHtmlMessage:Te(i.warnHtmlMessage)?i.warnHtmlMessage:!0,y=!!i.escapeParameter;const E=e?e.modifiers:ke(i.modifiers)?i.modifiers:{};let x=i.pluralRules||e&&e.pluralRules,k;k=(()=>{n&&Mh(null);const F={version:J0,locale:a.value,fallbackLocale:c.value,messages:h.value,modifiers:E,pluralRules:x,missing:p===null?void 0:p,missingWarn:d,fallbackWarn:m,fallbackFormat:w,unresolving:!0,postTranslation:O===null?void 0:O,warnHtmlMessage:C,escapeParameter:y,messageResolver:i.messageResolver,messageCompiler:i.messageCompiler,__meta:{framework:"vue"}};F.datetimeFormats=u.value,F.numberFormats=f.value,F.__datetimeFormatters=ke(k)?k.__datetimeFormatters:void 0,F.__numberFormatters=ke(k)?k.__numberFormatters:void 0,process.env.NODE_ENV!=="production"&&(F.__v_emitter=ke(k)?k.__v_emitter:void 0);const G=E0(F);return n&&Mh(G),G})(),hs(k,a.value,c.value);function N(){return[a.value,c.value,h.value,u.value,f.value]}const _=l.computed({get:()=>a.value,set:F=>{a.value=F,k.locale=a.value}}),A=l.computed({get:()=>c.value,set:F=>{c.value=F,k.fallbackLocale=c.value,hs(k,a.value,F)}}),S=l.computed(()=>h.value),M=l.computed(()=>u.value),T=l.computed(()=>f.value);function I(){return Le(O)?O:null}function B(F){O=F,k.postTranslation=F}function U(){return g}function Z(F){F!==null&&(p=au(F)),g=F,k.missing=p}function K(F,G){return F!=="translate"||!G.resolvedMessage}const X=(F,G,Pe,Fe,Li,rs)=>{N();let sn;try{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,n||(k.fallbackContext=e?T0():void 0),sn=F(k)}finally{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,n||(k.fallbackContext=void 0)}if(Pe!=="translate exists"&&Ye(sn)&&sn===Or||Pe==="translate exists"&&!sn){const[Mi,il]=G();if(process.env.NODE_ENV!=="production"&&e&&ne(Mi)&&K(Pe,il)&&(b&&(br(m,Mi)||Dh(d,Mi))&&Bi(yr(Ui.FALLBACK_TO_ROOT,{key:Mi,type:Pe})),process.env.NODE_ENV!=="production")){const{__v_emitter:os}=k;os&&b&&os.emit("fallback",{type:Pe,key:Mi,to:"global",groupId:`${Pe}:${Mi}`})}return e&&b?Fe(e):Li(Mi)}else{if(rs(sn))return sn;throw yt(Me.UNEXPECTED_RETURN_TYPE)}};function J(...F){return X(G=>Reflect.apply(Gh,null,[G,...F]),()=>_l(...F),"translate",G=>Reflect.apply(G.t,G,[...F]),G=>G,G=>ne(G))}function fe(...F){const[G,Pe,Fe]=F;if(Fe&&!Ce(Fe))throw yt(Me.INVALID_ARGUMENT);return J(G,Pe,tt({resolvedMessage:!0},Fe||{}))}function he(...F){return X(G=>Reflect.apply(Uh,null,[G,...F]),()=>gl(...F),"datetime format",G=>Reflect.apply(G.d,G,[...F]),()=>_r,G=>ne(G))}function ye(...F){return X(G=>Reflect.apply(qh,null,[G,...F]),()=>Ol(...F),"number format",G=>Reflect.apply(G.n,G,[...F]),()=>_r,G=>ne(G))}function z(F){return F.map(G=>ne(G)||Ye(G)||Te(G)?su(String(G)):G)}const V={normalize:z,interpolate:F=>F,type:"vnode"};function q(...F){return X(G=>{let Pe;const Fe=G;try{Fe.processor=V,Pe=Reflect.apply(Gh,null,[Fe,...F])}finally{Fe.processor=null}return Pe},()=>_l(...F),"translate",G=>G[yl](...F),G=>[su(G)],G=>We(G))}function H(...F){return X(G=>Reflect.apply(qh,null,[G,...F]),()=>Ol(...F),"number format",G=>G[kl](...F),ou,G=>ne(G)||We(G))}function Ue(...F){return X(G=>Reflect.apply(Uh,null,[G,...F]),()=>gl(...F),"datetime format",G=>G[wl](...F),ou,G=>ne(G)||We(G))}function Ri(F){x=F,k.pluralRules=x}function Re(F,G){return X(()=>{if(!F)return!1;const Pe=ne(G)?G:a.value,Fe=Dt(Pe),Li=k.messageResolver(Fe,F);return Zi(Li)||Zt(Li)||ne(Li)},()=>[F],"translate exists",Pe=>Reflect.apply(Pe.te,Pe,[F,G]),nb,Pe=>Te(Pe))}function qe(F){let G=null;const Pe=Qh(k,c.value,a.value);for(let Fe=0;Fe<Pe.length;Fe++){const Li=h.value[Pe[Fe]]||{},rs=k.messageResolver(Li,F);if(rs!=null){G=rs;break}}return G}function Wt(F){const G=qe(F);return G??(e?e.tm(F)||{}:{})}function Dt(F){return h.value[F]||{}}function ki(F,G){if(s){const Pe={[F]:G};for(const Fe in Pe)zt(Pe,Fe)&&fs(Pe[Fe]);G=Pe[F]}h.value[F]=G,k.messages=h.value}function Vi(F,G){h.value[F]=h.value[F]||{};const Pe={[F]:G};if(s)for(const Fe in Pe)zt(Pe,Fe)&&fs(Pe[Fe]);G=Pe[F],pr(G,h.value[F]),k.messages=h.value}function R(F){return u.value[F]||{}}function Q(F,G){u.value[F]=G,k.datetimeFormats=u.value,jh(k,F,G)}function W(F,G){u.value[F]=tt(u.value[F]||{},G),k.datetimeFormats=u.value,jh(k,F,G)}function Y(F){return f.value[F]||{}}function $e(F,G){f.value[F]=G,k.numberFormats=f.value,Wh(k,F,G)}function Xe(F,G){f.value[F]=tt(f.value[F]||{},G),k.numberFormats=f.value,Wh(k,F,G)}lu++,e&&Yt&&(l.watch(e.locale,F=>{o&&(a.value=F,k.locale=F,hs(k,a.value,c.value))}),l.watch(e.fallbackLocale,F=>{o&&(c.value=F,k.fallbackLocale=F,hs(k,a.value,c.value))}));const Qe={id:lu,locale:_,fallbackLocale:A,get inheritLocale(){return o},set inheritLocale(F){o=F,F&&e&&(a.value=e.locale.value,c.value=e.fallbackLocale.value,hs(k,a.value,c.value))},get availableLocales(){return Object.keys(h.value).sort()},messages:S,get modifiers(){return E},get pluralRules(){return x||{}},get isGlobal(){return n},get missingWarn(){return d},set missingWarn(F){d=F,k.missingWarn=d},get fallbackWarn(){return m},set fallbackWarn(F){m=F,k.fallbackWarn=m},get fallbackRoot(){return b},set fallbackRoot(F){b=F},get fallbackFormat(){return w},set fallbackFormat(F){w=F,k.fallbackFormat=w},get warnHtmlMessage(){return C},set warnHtmlMessage(F){C=F,k.warnHtmlMessage=F},get escapeParameter(){return y},set escapeParameter(F){y=F,k.escapeParameter=F},t:J,getLocaleMessage:Dt,setLocaleMessage:ki,mergeLocaleMessage:Vi,getPostTranslationHandler:I,setPostTranslationHandler:B,getMissingHandler:U,setMissingHandler:Z,[eu]:Ri};return Qe.datetimeFormats=M,Qe.numberFormats=T,Qe.rt=fe,Qe.te=Re,Qe.tm=Wt,Qe.d=he,Qe.n=ye,Qe.getDateTimeFormat=R,Qe.setDateTimeFormat=Q,Qe.mergeDateTimeFormat=W,Qe.getNumberFormat=Y,Qe.setNumberFormat=$e,Qe.mergeNumberFormat=Xe,Qe[tu]=t,Qe[yl]=q,Qe[wl]=Ue,Qe[kl]=H,process.env.NODE_ENV!=="production"&&(Qe[cn]=F=>{k.__v_emitter=F},Qe[us]=()=>{k.__v_emitter=void 0}),Qe}const cu="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"},rb={"vue-i18n-resource-inspector":"Search for scopes ..."},ob={"vue-i18n-timeline":16764185};let Ql;async function lb(i,e){return new Promise((t,n)=>{try{K0({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:[cu],app:i},s=>{Ql=s,s.on.visitComponentTree(({componentInstance:o,treeNode:a})=>{ab(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&&uu(a,o.vnode.el.__VUE_I18N__):uu(a,o.vnode.el.__VUE_I18N__))}),s.addInspector({id:"vue-i18n-resource-inspector",label:Al["vue-i18n-resource-inspector"],icon:"language",treeFilterPlaceholder:rb["vue-i18n-resource-inspector"]}),s.on.getInspectorTree(o=>{o.app===i&&o.inspectorId==="vue-i18n-resource-inspector"&&db(o,e)});const r=new Map;s.on.getInspectorState(async o=>{if(o.app===i&&o.inspectorId==="vue-i18n-resource-inspector")if(s.unhighlightElement(),mb(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=pb(o.nodeId,e);a&&s.highlightElement(a)}}),s.on.editInspectorState(o=>{o.app===i&&o.inspectorId==="vue-i18n-resource-inspector"&&Ob(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 hu(i){return i.type.name||i.type.displayName||i.type.__file||"Anonymous"}function ab(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 (${hu(i)} Scope)`,textColor:0,backgroundColor:16764185};e.tags.push(s)}}function uu(i,e){const t=cu;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];Le(n)&&"source"in n?e[t]=fb(n):Zi(n)&&n.loc&&n.loc.source?e[t]=n.loc.source:Ce(n)?e[t]=Pl(n):e[t]=n}),e}const cb={"<":"<",">":">",'"':""","&":"&"};function hb(i){return i.replace(/[<>"&]/g,ub)}function ub(i){return cb[i]||i}function fb(i){return{_custom:{type:"function",display:`<span>ƒ</span> ${i.source?`("${hb(i.source)}")`:"(?)"}`}}}function db(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:`${hu(n)} Scope`})}}function pb(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 fu(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 mb(i,e){const t=fu(i.nodeId,e);return t&&(i.state=gb(t)),null}function gb(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",h=[{type:c,key:"numberFormats",editable:!1,value:i.numberFormats.value}];e[c]=h}return e}function ds(i,e){if(Ql){let t;e&&"groupId"in e&&(t=e.groupId,delete e.groupId),Ql.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 Ob(i,e){const t=fu(i.nodeId,e);if(t){const[n]=i.path;n==="locale"&&ne(i.state.value)?t.locale.value=i.state.value:n==="fallbackLocale"&&(ne(i.state.value)||We(i.state.value)||Ce(i.state.value))?t.fallbackLocale.value=i.state.value:n==="inheritLocale"&&Te(i.state.value)&&(t.inheritLocale=i.state.value)}}function _b(i){const e=ne(i.locale)?i.locale:cs,t=ne(i.fallbackLocale)||We(i.fallbackLocale)||ke(i.fallbackLocale)||i.fallbackLocale===!1?i.fallbackLocale:e,n=Le(i.missing)?i.missing:void 0,s=Te(i.silentTranslationWarn)||An(i.silentTranslationWarn)?!i.silentTranslationWarn:!0,r=Te(i.silentFallbackWarn)||An(i.silentFallbackWarn)?!i.silentFallbackWarn:!0,o=Te(i.fallbackRoot)?i.fallbackRoot:!0,a=!!i.formatFallbackMessages,c=ke(i.modifiers)?i.modifiers:{},h=i.pluralizationRules,u=Le(i.postTranslation)?i.postTranslation:void 0,f=ne(i.warnHtmlInMessage)?i.warnHtmlInMessage!=="off":!0,d=!!i.escapeParameterHtml,m=Te(i.sync)?i.sync:!0;let b=i.messages;if(ke(i.sharedMessages)){const E=i.sharedMessages;b=Object.keys(E).reduce((k,P)=>{const N=k[P]||(k[P]={});return tt(N,E[P]),k},b||{})}const{__i18n:w,__root:g,__injectWithOption:p}=i,O=i.datetimeFormats,C=i.numberFormats,y=i.flatJson;return{locale:e,fallbackLocale:t,messages:b,flatJson:y,datetimeFormats:O,numberFormats:C,missing:n,missingWarn:s,fallbackWarn:r,fallbackRoot:o,fallbackFormat:a,modifiers:c,pluralRules:h,postTranslation:u,warnHtmlMessage:f,escapeParameter:d,messageResolver:i.messageResolver,inheritLocale:m,__i18n:w,__root:g,__injectWithOption:p}}function Tl(i={}){const e=Cl(_b(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 Te(e.missingWarn)?!e.missingWarn:e.missingWarn},set silentTranslationWarn(s){e.missingWarn=Te(s)?!s:s},get silentFallbackWarn(){return Te(e.fallbackWarn)?!e.fallbackWarn:e.fallbackWarn},set silentFallbackWarn(s){e.fallbackWarn=Te(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 h=null,u=null;if(process.env.NODE_ENV!=="production"&&wh(yr(Ui.DEPRECATE_TC)),!ne(r))throw yt(Me.INVALID_ARGUMENT);const f=r;return ne(o)?c.locale=o:Ye(o)?c.plural=o:We(o)?h=o:ke(o)&&(u=o),ne(a)?c.locale=a:We(a)?h=a:ke(a)&&(u=a),Reflect.apply(e.t,e,[f,h||u||{},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[cn]&&r[cn](s)},n.__disableEmitter=()=>{const s=e;s[us]&&s[us]()}),n}function bb(i,e,t){return{beforeCreate(){const n=l.getCurrentInstance();if(!n)throw yt(Me.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=du(i,r);else{r.__injectWithOption=!0,r.__extender=t.__vueI18nExtend,this.$i18n=Tl(r);const o=this.$i18n;o.__extender&&(o.__disposer=o.__extender(this.$i18n))}}else if(s.__i18n)if(this===this.$root)this.$i18n=du(i,s);else{this.$i18n=Tl({__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&&nu(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(Me.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 du(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[eu](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 yb({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},Ve())}function pu(){return l.Fragment}const mu=l.defineComponent({name:"i18n-t",props:tt({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:i=>Ye(i)||!isNaN(i)}},El),setup(i,e){const{slots:t,attrs:n}=e,s=i.i18n||Gt({useScope:i.scope,__useComponent:!0});return()=>{const r=Object.keys(t).filter(f=>f!=="_"),o=Ve();i.locale&&(o.locale=i.locale),i.plural!==void 0&&(o.plural=ne(i.plural)?+i.plural:i.plural);const a=yb(e,r),c=s[yl](i.keypath,a,o),h=tt(Ve(),n),u=ne(i.tag)||Ce(i.tag)?i.tag:pu();return l.h(u,h,c)}}});function wb(i){return We(i)&&!ne(i[0])}function gu(i,e,t,n){const{slots:s,attrs:r}=e;return()=>{const o={part:!0};let a=Ve();i.locale&&(o.locale=i.locale),ne(i.format)?o.key=i.format:Ce(i.format)&&(ne(i.format.key)&&(o.key=i.format.key),a=Object.keys(i.format).reduce((d,m)=>t.includes(m)?tt(Ve(),d,{[m]:i.format[m]}):d,Ve()));const c=n(i.value,o,a);let h=[o.key];We(c)?h=c.map((d,m)=>{const b=s[d.type],w=b?b({[d.type]:d.value,index:m,parts:c}):[d.value];return wb(w)&&(w[0].key=`${d.type}-${m}`),w}):ne(c)&&(h=[c]);const u=tt(Ve(),r),f=ne(i.tag)||Ce(i.tag)?i.tag:pu();return l.h(f,u,h)}}const Ou=l.defineComponent({name:"i18n-n",props:tt({value:{type:Number,required:!0},format:{type:[String,Object]}},El),setup(i,e){const t=i.i18n||Gt({useScope:i.scope,__useComponent:!0});return gu(i,e,Xh,(...n)=>t[kl](...n))}}),_u=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||Gt({useScope:i.scope,__useComponent:!0});return gu(i,e,Fh,(...n)=>t[wl](...n))}});function kb(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 xb(i){const e=o=>{const{instance:a,value:c}=o;if(!a||!a.$)throw yt(Me.UNEXPECTED_ERROR);const h=kb(i,a.$),u=bu(c);return[Reflect.apply(h.t,h,[...yu(u)]),h]};return{created:(o,a)=>{const[c,h]=e(a);Yt&&i.global===h&&(o.__i18nWatcher=l.watch(h.locale,()=>{a.instance&&a.instance.$forceUpdate()})),o.__composer=h,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,h=bu(a);o.textContent=Reflect.apply(c.t,c,[...yu(h)])}},getSSRProps:o=>{const[a]=e(o);return{textContent:a}}}}function bu(i){if(ne(i))return{path:i};if(ke(i)){if(!("path"in i))throw yt(Me.REQUIRED_VALUE,"path");return i}else throw yt(Me.INVALID_VALUE)}function yu(i){const{path:e,locale:t,args:n,choice:s,plural:r}=i,o={},a=n||{};return ne(t)&&(o.locale=t),Ye(s)&&(o.plural=s),Ye(r)&&(o.plural=r),[e,a,o]}function Sb(i,e,...t){const n=ke(t[0])?t[0]:{};(Te(n.globalInstall)?n.globalInstall:!0)&&([mu.name,"I18nT"].forEach(r=>i.component(r,mu)),[Ou.name,"I18nN"].forEach(r=>i.component(r,Ou)),[_u.name,"I18nD"].forEach(r=>i.component(r,_u))),i.directive("t",xb(e))}const Cb=si("global-vue-i18n");function wu(i={},e){const t=__VUE_I18N_LEGACY_API__&&Te(i.legacy)?i.legacy:__VUE_I18N_LEGACY_API__,n=Te(i.globalInjection)?i.globalInjection:!0,s=new Map,[r,o]=Ab(i,t),a=si(process.env.NODE_ENV!=="production"?"vue-i18n":"");function c(d){return s.get(d)||null}function h(d,m){s.set(d,m)}function u(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),ke(m[0])){const g=m[0];f.__composerExtend=g.__composerExtend,f.__vueI18nExtend=g.__vueI18nExtend}let b=null;!t&&n&&(b=Vb(d,f.global)),__VUE_I18N_FULL_INSTALL__&&Sb(d,f,...m),__VUE_I18N_LEGACY_API__&&t&&d.mixin(bb(o,o.__composer,f));const w=d.unmount;if(d.unmount=()=>{b&&b(),f.dispose(),w()},process.env.NODE_ENV!=="production"){if(!await lb(d,f))throw yt(Me.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN);const p=ol();if(t){const O=o;O.__enableEmitter&&O.__enableEmitter(p)}else{const O=o;O[cn]&&O[cn](p)}p.on("*",ds)}},get global(){return o},dispose(){r.stop()},__instances:s,__getInstance:c,__setInstance:h,__deleteInstance:u};return f}function Gt(i={}){const e=l.getCurrentInstance();if(e==null)throw yt(Me.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw yt(Me.NOT_INSTALLED);const t=Qb(e),n=Tb(t),s=iu(e),r=Pb(i,s);if(r==="global")return nu(n,i,s),n;if(r==="parent"){let c=Eb(t,e,i.__useComponent);return c==null&&(process.env.NODE_ENV!=="production"&&Bi(yr(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)),Nb(o,e,a),o.__setInstance(e,a)}return a}function Ab(i,e,t){const n=l.effectScope(),s=__VUE_I18N_LEGACY_API__&&e?n.run(()=>Tl(i)):n.run(()=>Cl(i));if(s==null)throw yt(Me.UNEXPECTED_ERROR);return[n,s]}function Qb(i){const e=l.inject(i.isCE?Cb:i.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw yt(i.isCE?Me.NOT_INSTALLED_WITH_PROVIDE:Me.UNEXPECTED_ERROR);return e}function Pb(i,e){return fr(i)?"__i18n"in e?"local":"global":i.useScope?i.useScope:"local"}function Tb(i){return i.mode==="composition"?i.global:i.global.__composer}function Eb(i,e,t=!1){let n=null;const s=e.root;let r=$b(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[tu]&&(n=null))}if(n!=null||s===r)break;r=r.parent}return n}function $b(i,e=!1){return i==null?null:e&&i.vnode.ctx||i.parent}function Nb(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[cn]&&s[cn](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[us]&&s[us](),delete e.vnode.el.__VUE_I18N__),i.__deleteInstance(e);const r=s[xl];r&&(r(),delete s[xl])},e)}const Rb=["locale","fallbackLocale","availableLocales"],ku=["t","rt","d","n","tm","te"];function Vb(i,e){const t=Object.create(null);return Rb.forEach(s=>{const r=Object.getOwnPropertyDescriptor(e,s);if(!r)throw yt(Me.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,ku.forEach(s=>{const r=Object.getOwnPropertyDescriptor(e,s);if(!r||!r.value)throw yt(Me.UNEXPECTED_ERROR);Object.defineProperty(i.config.globalProperties,`$${s}`,r)}),()=>{delete i.config.globalProperties.$i18n,ku.forEach(s=>{delete i.config.globalProperties[`$${s}`]})}}if(eb(),S0(i0),C0(b0),A0(Qh),process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const i=ln();i.__INTLIFY__=!0,n0(i.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}process.env.NODE_ENV;const xu="3.7.7",Lb=xu,$n=typeof Buffer=="function",Su=typeof TextDecoder=="function"?new TextDecoder:void 0,Cu=typeof TextEncoder=="function"?new TextEncoder:void 0,Mb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",ps=Array.prototype.slice.call(Mb),wr=(i=>{let e={};return i.forEach((t,n)=>e[t]=n),e})(ps),Bb=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,at=String.fromCharCode.bind(String),Au=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):i=>new Uint8Array(Array.prototype.slice.call(i,0)),Qu=i=>i.replace(/=/g,"").replace(/[+\/]/g,e=>e=="+"?"-":"_"),Pu=i=>i.replace(/[^A-Za-z0-9\+\/]/g,""),Tu=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):$n?i=>Buffer.from(i,"binary").toString("base64"):Tu,Nl=$n?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(""))},kr=(i,e=!1)=>e?Qu(Nl(i)):Nl(i),Db=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)}},vb=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Eu=i=>i.replace(vb,Db),$u=$n?i=>Buffer.from(i,"utf8").toString("base64"):Cu?i=>Nl(Cu.encode(i)):i=>$l(Eu(i)),Nn=(i,e=!1)=>e?Qu($u(i)):$u(i),Nu=i=>Nn(i,!0),Zb=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Ib=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))}},Ru=i=>i.replace(Zb,Ib),Vu=i=>{if(i=i.replace(/\s+/g,""),!Bb.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=wr[i.charAt(r++)]<<18|wr[i.charAt(r++)]<<12|(n=wr[i.charAt(r++)])<<6|(s=wr[i.charAt(r++)]),t+=n===64?at(e>>16&255):s===64?at(e>>16&255,e>>8&255):at(e>>16&255,e>>8&255,e&255);return t},Rl=typeof atob=="function"?i=>atob(Pu(i)):$n?i=>Buffer.from(i,"base64").toString("binary"):Vu,Lu=$n?i=>Au(Buffer.from(i,"base64")):i=>Au(Rl(i).split("").map(e=>e.charCodeAt(0))),Mu=i=>Lu(Bu(i)),Ub=$n?i=>Buffer.from(i,"base64").toString("utf8"):Su?i=>Su.decode(Lu(i)):i=>Ru(Rl(i)),Bu=i=>Pu(i.replace(/[-_]/g,e=>e=="-"?"+":"/")),Vl=i=>Ub(Bu(i)),Fb=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)},Du=i=>({value:i,enumerable:!1,writable:!0,configurable:!0}),vu=function(){const i=(e,t)=>Object.defineProperty(String.prototype,e,Du(t));i("fromBase64",function(){return Vl(this)}),i("toBase64",function(e){return Nn(this,e)}),i("toBase64URI",function(){return Nn(this,!0)}),i("toBase64URL",function(){return Nn(this,!0)}),i("toUint8Array",function(){return Mu(this)})},Zu=function(){const i=(e,t)=>Object.defineProperty(Uint8Array.prototype,e,Du(t));i("toBase64",function(e){return kr(this,e)}),i("toBase64URI",function(){return kr(this,!0)}),i("toBase64URL",function(){return kr(this,!0)})},jb={version:xu,VERSION:Lb,atob:Rl,atobPolyfill:Vu,btoa:$l,btoaPolyfill:Tu,fromBase64:Vl,toBase64:Nn,encode:Nn,encodeURI:Nu,encodeURL:Nu,utob:Eu,btou:Ru,decode:Vl,isValid:Fb,fromUint8Array:kr,toUint8Array:Mu,extendString:vu,extendUint8Array:Zu,extendBuiltins:()=>{vu(),Zu()}},qb="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=",Xb="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",Wb="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=",Yb="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",zb={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"},Iu=()=>{function i(o,a){try{const c=decodeURI(o.headers["content-disposition"]);let h=a||c.split("filename*=utf-8")[1];const u=h.substring(h.lastIndexOf(".")+1),f=new Blob([o.data],{type:zb[u]??"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),m=(window.URL||window.webkitURL).createObjectURL(f),b=document.createElement("a");b.setAttribute("href",m);const w=h.lastIndexOf(".");h=`${h.slice(0,w)}_${Ne.dayjs().format("YYYYMMDD")+h.slice(w)}`,b.setAttribute("download",h),document.body.appendChild(b),b.click(),document.body.removeChild(b),window.URL.revokeObjectURL(m)}catch(c){console.error(c)}}function e({multiple:o=!1},a){const c=document.createElement("input");c.style.display="none",c.setAttribute("type","file"),o&&c.setAttribute("multiple",o),c.setAttribute("accept","application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,.xml"),document.body.appendChild(c),c.click(),c.addEventListener("change",h=>{a(h)&&document.body.removeChild(c)})}function t(o){return o?o.substring(o.lastIndexOf("/")+1):""}function n(o){return o?new URL(Object.assign({"../static/images/upload-excel.png":qb,"../static/images/upload-file.png":Xb,"../static/images/upload-pdf.png":Wb,"../static/images/upload-word.png":Yb})[`../static/${o}`],self.location).href:""}function s(o,a,c){if(!a)return;let h=c||t(a);const u=h.lastIndexOf(".");h=`${h.slice(0,u)}_${Date.now()+h.slice(u)}`,o({url:a,method:"GET",responseType:"blob"}).then(f=>{const d=URL.createObjectURL(f.data),m=document.createElement("a");m.style.display="none",m.setAttribute("href",d),m.setAttribute("target","_blank"),m.setAttribute("download",h),document.body.appendChild(m),m.click(),document.body.removeChild(m),window.URL.revokeObjectURL(d)})}function r(o){if(!o)return;const a=document.createElement("input");a.value=o,document.body.appendChild(a),a.select(),document.execCommand("Copy"),a.remove(),Ne.ElNotification({title:"提示",message:"复制成功",type:"success",duration:2e3})}return{exportFile:i,importFile:e,getAssetsFileName:t,getAssetsFilePath:n,downloadFile:s,copy:r}},Uu={label:"name",value:"code",children:"children"},Fu={label:"key",value:"value"},xr={label:"name",value:"code",children:"children"},Gb={year:"year",month:"month",date:"day"};/*! Element Plus Icons Vue v2.3.1 */var Hb=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.592 30.592 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.592 30.592 0 0 0-42.752 0z"})]))}}),Kb=Hb,Jb=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"})]))}}),ey=Jb,ty=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"})]))}}),iy=ty,ny=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"})]))}}),sy=ny,ry=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=ry;const wT="",ct=(i,e)=>{const t=i.__vccOpts||i;for(const[n,s]of e)t[n]=s;return t},ly={class:"a-loading"},Sr=ct({__name:"index",setup(i){return(e,t)=>(l.openBlock(),l.createElementBlock("div",ly,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"]]),xT="",ay={key:0,class:"table-link"},cy=["onClick"],hy={class:"no-image"},uy={key:4},ju=ct({__name:"index",props:{pageKey:{type:String,default:""},defaultParams:{type:Array,default:()=>[]},matchData:{type:Object,default:()=>({})},maxHeight:{type:[String,Number],default:-1},tableConfig:{type:Object,default:()=>({})}},emits:["onClickRow","changeExpansionRow","refresh","load","operate"],setup(i,{expose:e,emit:t}){const n=l.defineAsyncComponent({loader:()=>Promise.resolve().then(()=>qy),loadingComponent:Sr,delay:20}),s=l.defineAsyncComponent({loader:()=>Promise.resolve().then(()=>Wy),loadingComponent:Sr,delay:20}),r=l.defineAsyncComponent({loader:()=>Promise.resolve().then(()=>zy),loadingComponent:Sr,delay:20}),o=l.defineAsyncComponent(()=>Promise.resolve().then(()=>Ky)),a=l.defineAsyncComponent(()=>Promise.resolve().then(()=>t1)),{t:c}=Gt(),h=l.inject("actModules"),u=l.inject("apiPrefix"),f=l.inject("request"),d=l.inject("themeColor"),m=l.inject("cacheTokenType"),b=l.inject("cookieStorage"),w=rn.useRoute(),g=rn.useRouter(),p=t,O=i,C=()=>({pageLoading:!1,tableLoading:!1,tableTotal:0,tableSelection:[],tableQuery:{pageIndex:1,pageSize:10},showFormDialog:!1,showEditorPreDialog:!1,dialogTitle:"",editorDialogTitle:"",dialogData:{}});let y=l.reactive(C()),E=l.ref("loading"),x=l.ref([]),k={},P=[],N=l.ref([]),_=l.ref([]),A=l.ref([]),S=l.ref([]),M=l.ref([]),T=l.ref({});const I=l.ref(null),B=l.ref(null),U=l.ref(null),Z=l.ref(null),K=l.ref(0);let X=l.ref({});const J=$=>f({url:`${u}/sysOperate/getMenuOfOperateByRole`,method:"post",data:$}),fe=$=>f({url:`${u}/pages/getPageDetail?key=${$}`,method:"get"}),he=()=>{y=l.reactive(C()),E.value="loading",x.value=[],k={},P=[],N.value=[],_.value=[],A.value=[],S.value=[],M.value=[],X.value={}},ye=()=>{l.nextTick(()=>{setTimeout(()=>{var ue,oe,re,te,ee,Oe,me;const $=((oe=(ue=I.value)==null?void 0:ue.$el)==null?void 0:oe.offsetHeight)||0,v=((te=(re=B.value)==null?void 0:re.$el)==null?void 0:te.offsetHeight)||0,ae=((Oe=(ee=U.value)==null?void 0:ee.$el)==null?void 0:Oe.offsetHeight)||0,pe=$-v-ae-6;K.value=O.maxHeight>0?O.maxHeight:(me=k==null?void 0:k.tableConfig)!=null&&me.isPagination?pe-48:pe},500)})},z=()=>[...os(P)],D=$=>{Z.value.updateSelection($)},V=()=>y.tableSelection,q=async()=>{await ti(P),p("refresh")},H=$=>{if(!$||!$.tableQueryDefaultValue)return;const ae=Wt($)["value-format"]||"YYYY-MM-DD HH:mm:ss";if($.fieldType=="date"&&$.tableQueryDefaultValue=="nowYear")return Ne.dayjs().format(ae);if($.fieldType=="date"&&$.tableQueryDefaultValue=="yearAgo")return Ne.dayjs().subtract(1,"year").format(ae);if($.fieldType=="dateRange"&&$.tableQueryDefaultValue.includes("&")){const pe=$.tableQueryDefaultValue.split("&");return[Ne.dayjs(pe[0]).subtract(6,"month").format(ae),Ne.dayjs(pe[1]).format(ae)]}if($.fieldType=="dateRange"&&$.tableQueryDefaultValue=="yearAgo")return[Ne.dayjs().subtract(1,"year").format(ae),Ne.dayjs().format(ae)];if($.fieldType=="dateRange"&&$.tableQueryDefaultValue=="sixMonthsAgo")return[Ne.dayjs().subtract(6,"month").format(ae),Ne.dayjs().format(ae)]},Ue=($,v)=>{if(!(v.row&&Object.keys(v.row).length))return;const pe=(v.row[$.fieldKey]??"").split(";"),ue=pe&&pe.length?pe[0]:"",oe=ue.substring(ue.lastIndexOf(".")+1);return/(gif|jpg|jpeg|png|pdf|bmp|webp|GIF|JPG|PDF|PNG|JPEG)$/.test(oe)},Ri=($,v)=>{if(!(v.row&&Object.keys(v.row).length))return;const pe=(v.row[$.fieldKey]??"").split(";");return pe&&pe.length?pe[0]:""},Re=($,v)=>{if(!(v.row&&Object.keys(v.row).length))return;const ae=v.row[$.fieldKey]??null;return ae?ae.split(";"):[]},qe=$=>$==="true",Wt=$=>new Function("",$.fieldUiProps)()||{},Dt=async($,v)=>Reflect.has(h,`/src/views${$}.vue`)?l.markRaw(l.defineAsyncComponent(h[`/src/views${$}.vue`])):null,ki=async($,v)=>Reflect.has(h,`/src/views${$}.vue`)?l.markRaw(l.defineAsyncComponent({loader:h[`/src/views${$}.vue`],loadingComponent:Sr,delay:20})):null,Vi=async()=>{k.buttons=await Promise.all(k.buttons.map(async $=>{if($.isCustomBtn&&$.customType=="component"){const{customComponentUrl:v,customComponentName:ae}=$,pe=await Dt(v);$[ae]=pe}return $}))},R=async()=>{const $=k.fields.filter(v=>(v.formCustomComponentes??[]).some(ae=>ae.permissionCode=="tableShow"&&ae.isFieldCustom));M.value=await Promise.all($.map(async v=>{const ae=v.formCustomComponentes.find(re=>re.permissionCode=="tableShow"),{customComponentUrl:pe,customComponentName:ue}=ae,oe=await Dt(pe);return v.customTableHeaderName=ue,v.customTableHeaderUrl=pe,v[`customTableHeaderInstance_${ue}`]=oe,v.headerItem={label:v.fieldName,prop:v.fieldKey,align:v.tableCellAlignType,width:v.tableCellWidthType=="default"?v.tableCellWidth:"",minWidth:v.tableCellWidthType=="min"?v.tableCellWidth:"",showOverflowTooltip:v.isTableCellOverflowTooltip||!1,sort:v.isTableCellSort||!1},v}))},Q=($,v)=>{switch($){case"array":return typeof v=="string"?v.toString().split().sort((ae,pe)=>ae.sort-pe.sort):[v];case"number":return Number(v);case"boolean":return!!v;default:return v}},W=($,v)=>v[$.fieldKey]?v[$.fieldKey].toString().includes("T")?Ne.dayjs(v[$.fieldKey]).format("YYYY-MM-DD HH:mm:ss"):v[$.fieldKey]:"";function Y($,v={}){return $.replace(/\{([^}]+)\}/g,(ae,pe)=>{const ue=pe.trim().split(".");let oe=v;for(const re of ue){if(!oe||typeof oe!="object")break;oe=oe[re]}return oe!==void 0?oe:ae})}const $e=$=>$?Y($,O.matchData):"",Xe=($,v,ae)=>{switch($){case"LessThanOrEqual":return v<=ae;case"LessThan":return v<ae;case"GreaterThanOrEqual":return v>=ae;case"GreaterThan":return v>ae;case"NotEqual":return v!=ae;case"Equal":return v==ae;default:return v==ae}},Qe=($,v)=>{if(!$.matchFields.length)return!0;const ae=re=>re.matchType=="default"?v[re.matchFieldName]:O.matchData[re.matchType][re.matchFieldName];let ue=$.matchFields.reduce((re,te,ee)=>{const Oe=ae(te),me=Xe(te.matchCondition,Oe,te.fieldValue==""?null:te.fieldValue=="true"||te.fieldValue=="false"?qe(te.fieldValue):te.fieldValue);return re+=me,ee!==$.matchFields.length-1&&(re+=te.spliceCondition||"&&"),re},"").split("||"),oe=ue.reduce((re,te,ee)=>(re+=`(${te})`,ee<ue.length-1&&(re+="||"),re),"");return new Function(`return ${oe}`)()},F=($,v)=>Object.keys(v).length?x.value.some(ae=>ae.unique==$.permissionCode)&&Qe($,v):!1,G=async $=>{try{y.pageLoading=!0;const v=O.pageKey??w.params.key,{data:{pageConfigs:ae}}=await fe(v);return k=ae.pageConfig?JSON.parse(ae.pageConfig):{},y.tableQuery.pageSize=k.tableConfig.pageSize||10,y.pageLoading=!1,Promise.resolve(Object.keys(k).length)}catch(v){y.pageLoading=!1,console.error(v)}},Pe=async($=[],v={},ae=!0,pe=!1)=>{try{const ue=$.filter(te=>["select","multipleSelect","selectIcon","switch","virtualizedSelect","virtualizedMultipleSelect","fullLoadTreeSelect","provinceCascade"].includes(te.fieldType)&&(!Reflect.has(te,"dataList")||!te.dataList.length||pe)),re=(await Promise.allSettled(ue.map(async te=>{const ee=te.postRequestParams.filter(lt=>lt.submitType==="default").reduce((lt,ii)=>(lt[ii.submitName]=Q(ii.paramsType,ii.submitValue),lt),{}),Oe=te.postRequestParams.filter(lt=>lt.submitType==="match").reduce((lt,ii)=>(lt[ii.submitName]=Q(ii.paramsType,v[ii.submitValue][ii.submitName]),lt),{}),me=te.postRequestParams.filter(lt=>lt.submitType==="dynamic").map(lt=>({field:lt.submitName,operate:lt.submitMatchType,value:Q(lt.paramsType,lt.submitValue)}));let He={};Object.keys(ee).length&&(He={...He,...ee}),Object.keys(Oe).length&&(He={...He,...Oe}),me.length&&(He.dynamicFilters=me);const{data:xi}=await f({url:te.fieldRequestUrl,method:te.fieldRequestType||"GET",data:He});return Promise.resolve({...te,dataList:xi||[]})}))).filter(te=>te.status==="fulfilled"&&Reflect.has(te,"value")).map(te=>te.value);return ae&&k.fields.forEach(te=>{const ee=re.find(Oe=>te.fieldName==Oe.fieldName&&te.fieldKey==Oe.fieldKey);ee&&(te.dataList=(ee==null?void 0:ee.dataList)??[])}),re}catch(ue){console.error(ue)}},Fe=l.computed(()=>{const{tableConfig:{tableMoreBtnSplitNumber:$}}=k;return!$||$>=_.value.length}),Li=()=>{const{tableConfig:{tableMoreBtnSplitNumber:$}}=k;return Fe.value?_.value:_.value.slice(0,$)},rs=()=>{var v;const{tableConfig:{tableMoreBtnSplitNumber:$}}=k;return Fe.value?[]:_.value.slice($,(v=_.value)==null?void 0:v.length)},sn=async $=>{try{const v=($||[]).filter(oe=>oe.useScenes.some(re=>["tableShow"].includes(re))).sort((oe,re)=>oe.sort-re.sort),ae=["editor","upload","date"];let pe=v.map(oe=>{const re=oe.formCustomComponentes.some(te=>te.permissionCode=="tableShow"&&te.isFieldCustom);return{label:oe.fieldName,prop:oe.fieldKey,align:oe.tableCellAlignType,width:oe.tableCellWidthType=="default"?oe.tableCellWidth:"",minWidth:oe.tableCellWidthType=="min"?oe.tableCellWidth:"",showOverflowTooltip:oe.isTableCellOverflowTooltip||!1,sort:oe.isTableCellSort||!1,render:!!oe.fieldRequestUrl||oe.tableCellContentType=="link"||ae.includes(oe.fieldType),isCustomTableHeader:re}});k.tableConfig.isSerialNumber&&pe.unshift({prop:"serialNumber",width:80}),k.tableConfig.isCheckRow&&pe.unshift({prop:"checkbox",width:50});const ue=_.value.filter(oe=>x.value.some(re=>re.unique==oe.permissionCode));k.tableConfig.isOperateRow&&ue.length&&pe.push({label:c("act.operate"),prop:"operate",width:k.tableConfig.tableOperateCellWidth,render:!0,fixed:"right"}),S.value=v.filter(oe=>!!oe.fieldRequestUrl&&oe.useScenes.includes("tableShow")||oe.tableCellContentType=="link"||ae.includes(oe.fieldType)),N.value=pe}catch(v){console.error(v)}},Mi=()=>{_.value=(k.buttons||[]).filter($=>$.permissionCode!==1001&&$.btnPostion.includes("table")).sort(($,v)=>$.sort-v.sort).map($=>($.loading=!1,$.btnAlias&&($.btnName=$.btnAlias),$))},il=()=>k.fields.filter($=>$.useScenes.includes("tableSearch")).map($=>(["date","dateRange"].includes($.fieldType)?$.queryValue=$.tableQueryDefaultValue?$.tableQueryDefaultValue:H($):$.queryValue=($==null?void 0:$.tableQueryDefaultValue)||void 0,O.defaultParams.some(v=>{v.field==$.fieldKey&&v.operate===$.tableQueryCondition&&($.queryValue=v.value)}),$)),os=($,v="queryValue")=>$?($||[]).filter(pe=>!!pe[v]).reduce((pe,ue)=>{var re;const oe=Wt(ue);if(ue.fieldType==="date"&&oe["value-format"]!=="YYYY"){const te=oe!=null&&oe.dayJsType?Gb[(re=ue.fieldUiProps)==null?void 0:re.dayJsType]:"day",ee=oe["value-format"]||"YYYY-MM-DD HH:mm:ss";pe=[...pe,{field:ue.fieldKey,operate:"GreaterThanOrEqual",value:Ne.dayjs(ue[v]).startOf(te).format(ee)},{field:ue.fieldKey,operate:"LessThanOrEqual",value:Ne.dayjs(ue[v]).endOf(te).format(ee)}]}else if(ue.fieldType==="dateRange"&&ue[v].length)if(ue.fieldKey.includes("&")){const te=ue.fieldKey.split("&")||[];pe=[...pe,{field:te[0],operate:"GreaterThanOrEqual",value:ue.queryValue[0]},{field:te[1],operate:"LessThanOrEqual",value:ue.queryValue[1]}]}else pe=[...pe,{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[v].length){const te=(ue.fieldKey.split("&")||[]).map((ee,Oe)=>({field:ee,operate:"Equal",value:ue.queryValue[Oe]}));pe=[...pe,...te]}else return Array.isArray(ue[v])&&!ue[v].length?[...pe]:[...pe,{field:ue.fieldKey,operate:ue.tableQueryCondition,value:ue.tableQueryCondition==="In"&&ue[v]&&typeof ue[v]=="string"?ue[v].split(";"):ue[v]=="true"||ue[v]=="false"?qe(ue[v]):ue[v]}];return pe},[]):[],uT=($,v)=>{if(!$.dataList||!Reflect.has(v,$.fieldKey))return"";const ae=v[$.fieldKey];if(!ae&&ae!==0&&ae!==!1)return"";const pe=Wt($),ue=Object.assign({key:"key",value:"value"},pe.props||{});return["virtualizedSelect","virtualizedMultipleSelect"].includes($.fieldType)&&(ue.key=ue.label),["multipleSelect","select","switch","virtualizedSelect","virtualizedMultipleSelect","selectIcon"].includes($.fieldType)?($.dataList||[]).filter(oe=>{const re=$.fieldType==="selectIcon"?`btn-${oe[ue.value]}`:oe[ue.value],te=re=="true"||re=="false"?qe(re):re;return Array.isArray(ae)?ae.some(ee=>ee==re==ee):typeof ae=="string"?ae.split(";").includes(te):ae==te}).map(oe=>oe[ue.key]).join(";"):ae},ti=async($=[])=>{try{y.tableLoading=!0;const v=O.defaultParams.filter(oe=>!(k.fields??[]).some(re=>re.fieldKey===oe.field&&re.tableQueryCondition===oe.operate&&re.useScenes.includes("tableSearch"))),ae=k.tableConfig.defaultParams.map(oe=>({field:oe.submitFieldName,operate:oe.matchValue,value:Q(oe.submitFieldType,oe.defaultValue)})),pe=[...v,...ae,...os($)];k.tableConfig.isPagination||(y.tableQuery.pageSize=9999);const{data:ue}=await f({url:k.tableConfig.dataUrl,method:"POST",data:{...y.tableQuery,dynamicFilters:pe}});y.tableTotal=ue.totalCount||0,A.value=ue.datas||[],y.tableLoading=!1}catch(v){y.tableLoading=!1,console.error(v)}},YO=async()=>{try{E.value="loading";const $=O.pageKey;if(!await G($)){E.value="end";return}await R(),await Vi(),await Pe(k.fields.filter(oe=>oe.useScenes.some(re=>["tableSearch","tableShow"].includes(re)))),E.value="success";let ae="";if(m==="sessionStorage")ae=sessionStorage.getItem("accessToken");else{const oe=b.getPrefix();ae=b.getItemValue(`${oe}accessToken`)}const ue=JSON.parse(jb.decode(ae.split(".")[1]))["http://schemas.microsoft.com/ws/2008/06/identity/claims/role"];x.value=(await J({roleId:ue,key:$})).data.datas||[],Mi(),sn(k.fields),ye(),P=il(),(!Reflect.has(k.tableConfig,"isExecuteImmediatelyTableApi")||k.tableConfig.isExecuteImmediatelyTableApi)&&await ti(P),p("load"),console.log(k)}catch($){console.error($),E.value="end"}};l.provide("globalProps",O),l.provide("loadComponents",Dt),l.provide("defineAsyncLoadComponents",ki),l.provide("stringToBoolean",qe),l.provide("matchCondition",Xe),l.provide("menuPermissionBtns",x),l.provide("getTableData",ti),l.provide("tableBtnRefs",T.value),l.provide("formatDataType",Q),l.provide("getFieldUiProps",Wt),l.provide("disposeRequestData",Pe),l.provide("disposeDate",H),l.provide("getDefaultQueryValues",il),l.watch(()=>O.pageKey,($,v)=>{he(),YO()},{immediate:!0});const zO=async($,v)=>{P=$,await ti($),p("refresh"),v(!0)},fT=$=>{p("operate",$),ti(P)},nl=($,v)=>{const{exportFile:ae,importFile:pe,downloadFile:ue}=Iu();if($.isCustomBtn){if($.customType=="component"&&!Reflect.has($,[$.customComponentName])){Ne.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)(g,w,v,$,b)}catch(te){console.error(te)}return}const re=`${$.customComponentName}-${$.permissionCode}`;T.value[re]&&T.value[re].onTigger({rowData:v,tableSelection:y.tableSelection});return}if($.submitWay=="associationSubTable"){Ne.ElNotification({title:c("act.tip"),message:c("act.developing"),type:"warning",duration:2500});return}if(["export","exportUrl"].includes($.submitWay)){$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!0:v[`loading${$.permissionCode}`]=!0;let re=[...O.defaultParams,...os(P)],te=($.submitFields||[]).reduce((Oe,me)=>{if(me.matchType=="default")Oe=[...Oe,{field:me.submitFieldName,operate:me.submitFieldType==="array"?"In":"Equal",value:Q(me.submitFieldType,me.matchFieldName)}];else if(me.matchType=="match"){const He=me.submitFieldMatchOrigin==="rowData"?v:O.matchData[me.submitFieldMatchOrigin];Oe=[...Oe,{field:me.submitFieldName,operate:me.submitFieldType==="array"?"In":"Equal",value:Q(me.submitFieldType,He[me.matchFieldName])}]}else if(me.matchType=="selection"){const He=y.tableSelection.map(xi=>xi[me.matchFieldName]);Oe=[...Oe,{field:me.submitFieldName,operate:me.submitFieldType==="array"?"In":"Equal",value:me.submitFieldType==="string"?He.join():He}]}return Oe},[]);const ee=[...re,...te];f({url:$e($.requestUrl),method:"post",data:{dynamicFilters:ee},responseType:["exportUrl"].includes($.submitWay)?"json":"blob"}).then(Oe=>{$.submitWay=="exportUrl"?ue(f,Oe.data):ae(Oe),p("operate",$),$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:v[`loading${$.permissionCode}`]=!1}).catch(Oe=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:v[`loading${$.permissionCode}`]=!1});return}if(["import","batchImport"].includes($.submitWay)){pe({multiple:$.submitWay=="batchImport"},re=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!0:v[`loading${$.permissionCode}`]=!0;const te=new FormData;if(($.submitFields||[]).forEach(ee=>{var Oe,me;if(ee.matchType=="default")te.append(ee.submitFieldName,Q(ee.submitFieldType,ee.matchFieldName));else if(ee.matchType=="match")(Oe=Object.keys(v))!=null&&Oe.length&&te.append(ee.submitFieldName,Q(ee.submitFieldType,v[ee.matchFieldName]));else if(ee.matchType=="query"){const He=((me=P.find(xi=>xi.fieldKey==ee.matchFieldName))==null?void 0:me.queryValue)??null;te.append(ee.submitFieldName,Q(ee.submitFieldType,He))}}),$.submitWay=="import")te.append($.importFileName||"file",re.target.files[0]);else for(let ee of re.target.files)te.append($.importFileName||"files",ee);return f({url:$e($.requestUrl),method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:te}).then(ee=>{Ne.ElNotification({title:c("act.tip"),message:`${ee.msg}`,type:"success",duration:2500}),p("operate",$),ti(P),$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:v[`loading${$.permissionCode}`]=!1}).catch(()=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:v[`loading${$.permissionCode}`]=!1})});return}if($.submitWay==="executeApi"){let re=($.submitFields||[]).reduce((te,ee)=>{var Oe;if(ee.matchType=="default")te[ee.submitFieldName]=Q(ee.submitFieldType,ee.matchFieldName);else if(ee.matchType=="match"){const me=ee.submitFieldMatchOrigin==="rowData"?v:O.matchData[ee.submitFieldMatchOrigin];te[ee.submitFieldName]=Q(ee.submitFieldType,me[ee.matchFieldName])}else ee.matchType=="query"&&(te[ee.submitFieldName]=((Oe=P.find(me=>me.fieldKey==ee.matchFieldName))==null?void 0:Oe.queryValue)??null);return te},{});if($.btnPostion==="header"&&$.isPromptVerificationSelectTable=="1"){if(!k.tableConfig.isCheckRow){Ne.ElNotification({title:c("act.tip"),message:c("act.configTableRow"),type:"warning",duration:2500});return}if(!y.tableSelection.length){Ne.ElNotification({title:c("act.tip"),message:`${c("act.pleaseSelcet")}${$.btnName}${c("act.data")}`,type:"warning",duration:2500});return}}if($.btnPostion==="header"){const te=($.submitFields||[]).filter(ee=>ee.matchType=="selection").reduce((ee,Oe)=>(ee[Oe.submitFieldName]=y.tableSelection.reduce((me,He)=>(Oe.submitFieldType==="array"?me=[...me,...Q(Oe.submitFieldType,He[Oe.matchFieldName])]:me=[...me,Q(Oe.submitFieldType,He[Oe.matchFieldName])],me),[]),ee),{});Object.assign(re,te)}$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!0:v[`loading${$.permissionCode}`]=!0,f({url:$e($.requestUrl),method:"post",data:re}).then(te=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:v[`loading${$.permissionCode}`]=!1,Ne.ElNotification({type:"success",title:c("act.tip"),message:`${$.btnName}${c("act.success")}`,duration:2500}),p("operate",$),ti(P)}).catch(te=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:v[`loading${$.permissionCode}`]=!1});return}if($.submitWay==="messageBox"){if($.btnPostion==="header"&&$.isPromptVerificationSelectTable=="1"){if(!k.tableConfig.isCheckRow){Ne.ElNotification({title:c("act.tip"),message:c("act.configTableRow"),type:"warning",duration:2500});return}if(!y.tableSelection.length){Ne.ElNotification({title:c("act.tip"),message:`${c("act.pleaseSelcet")}${$.btnName}${c("act.data")}`,type:"warning",duration:2500});return}}Ne.ElMessageBox.confirm(`${c("act.isExecuteOperate")}?`,c("act.tip"),{confirmButtonText:c("act.enter"),cancelButtonText:c("act.cancel"),type:"warning"}).then(()=>{let re=($.submitFields||[]).reduce((te,ee)=>{var Oe;if(ee.matchType=="default")te[ee.submitFieldName]=Q(ee.submitFieldType,ee.matchFieldName);else if(ee.matchType=="match"){const me=ee.submitFieldMatchOrigin==="rowData"?v:O.matchData[ee.submitFieldMatchOrigin];te[ee.submitFieldName]=Q(ee.submitFieldType,me[ee.matchFieldName])}else ee.matchType=="query"&&(te[ee.submitFieldName]=((Oe=P.find(me=>me.fieldKey==ee.matchFieldName))==null?void 0:Oe.queryValue)??null);return te},{});if($.btnPostion==="header"){const te=($.submitFields||[]).filter(ee=>ee.matchType=="selection").reduce((ee,Oe)=>(ee[Oe.submitFieldName]=y.tableSelection.reduce((me,He)=>(Oe.submitFieldType==="array"?me=[...me,...Q(Oe.submitFieldType,He[Oe.matchFieldName])]:me=[...me,Q(Oe.submitFieldType,He[Oe.matchFieldName])],me),[]),ee),{});Object.assign(re,te)}$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!0:v[`loading${$.permissionCode}`]=!0,f({url:$e($.requestUrl),method:"post",data:re}).then(te=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:v[`loading${$.permissionCode}`]=!1,Ne.ElNotification({type:"success",title:c("act.tip"),message:`${$.btnName}${c("act.success")}`,duration:2500}),p("operate",$),ti(P)}).catch(te=>{$.btnPostion==="header"?$[`loading${$.permissionCode}`]=!1:v[`loading${$.permissionCode}`]=!1})}).catch(re=>{});return}if($.btnPostion==="header"&&$.submitWay==="dialog"&&($.submitFields||[]).some(re=>re.submitFieldMatchOrigin==="selections")&&!y.tableSelection.length){if(!k.tableConfig.isCheckRow){Ne.ElNotification({title:c("act.tip"),message:c("act.configTableRow"),type:"warning",duration:2500});return}if(!y.tableSelection.length){Ne.ElNotification({title:c("act.tip"),message:`${c("act.pleaseSelcet")}${$.btnName}${c("act.data")}`,type:"warning",duration:2500});return}return}let oe=(k.fields||[]).filter(re=>re.useScenes.includes($.permissionCode)).map(re=>(re.customFiledsComponentes=re.formCustomComponentes.find(te=>te.permissionCode==$.permissionCode)||{},re));if(!oe.length){Ne.ElNotification({title:c("act.tip"),message:c("act.buttonBindField"),type:"warning",duration:2500});return}if($.submitWay==="dialog"){y.dialogTitle=$.btnName,y.dialogData={dataItem:{...$},rowData:{...v},selections:y.tableSelection||[],formConfig:k.formConfig,formList:oe},y.showFormDialog=!0;return}},dT=($,v,ae)=>{p("onClickRow",$,v,ae)},pT=($,v)=>{X.value=$,p("changeExpansionRow",$,v)},mT=($,v)=>{y.editorDialogTitle=`${c("act.preview")}${$.fieldName}`,y.dialogData={...v,editorContent:v[$.fieldKey]},y.showEditorPreDialog=!0};return e({loadData:YO,getDynamicFiltersData:z,getTableData:ti,getTableSelection:V,setTableSelection:D}),($,v)=>{const ae=l.resolveComponent("el-table-column"),pe=l.resolveComponent("el-image"),ue=l.resolveComponent("el-link"),oe=l.resolveComponent("a-svg-icon"),re=l.resolveComponent("el-button"),te=l.resolveComponent("el-dropdown-item"),ee=l.resolveComponent("el-dropdown-menu"),Oe=l.resolveComponent("el-dropdown"),me=l.resolveComponent("el-empty"),He=l.resolveComponent("el-card"),xi=l.resolveDirective("debounce"),lt=l.resolveDirective("loading");return l.withDirectives((l.openBlock(),l.createBlock(He,{class:"act-module",ref_key:"actModuleRef",ref:I,shadow:"never"},{default:l.withCtx(()=>{var ii,GO;return[l.unref(E)==="success"?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[l.createVNode(l.unref(n),{ref_key:"queryModuleRef",ref:B,data:l.unref(k),onReset:zO,onSearch:zO},null,8,["data"]),l.createVNode(l.unref(s),{ref_key:"headerButtonsModuleRef",ref:U,data:l.unref(k),onOnOperate:nl},null,8,["data"]),l.createVNode(l.unref(r),{ref_key:"aTableRef",ref:Z,loading:l.unref(y).tableLoading,total:l.unref(y).tableTotal,tableQuery:l.unref(y).tableQuery,"onUpdate:tableQuery":v[0]||(v[0]=_e=>l.unref(y).tableQuery=_e),selection:l.unref(y).tableSelection,"onUpdate:selection":v[1]||(v[1]=_e=>l.unref(y).tableSelection=_e),headers:l.unref(N),data:l.unref(A),showPagination:(GO=(ii=l.unref(k))==null?void 0:ii.tableConfig)==null?void 0:GO.isPagination,tableConfig:O.tableConfig,maxHeight:K.value,onRefresh:q,onOnRowClick:dT,onChangeExpand:pT},l.createSlots({operate:l.withCtx(({scope:_e})=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(Li(),(ge,ni)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:ni},[F(ge,_e.row)?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[ge.isCustomBtn&&ge.customType=="component"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(ge[ge.customComponentName]),{key:0,ref_for:!0,ref:Cn=>l.unref(T)[`${ge.customComponentName}-${ge.permissionCode}`]=Cn,buttonData:ge,scope:_e,onRefresh:ti},{default:l.withCtx(()=>[l.withDirectives((l.openBlock(),l.createBlock(re,{class:"ml4",type:"primary",link:"",size:"small",loading:_e.row[`loading${ge.permissionCode}`],onClick:Cn=>nl(ge,_e.row)},{default:l.withCtx(()=>[ge.btnIcon&&!_e.row[`loading${ge.permissionCode}`]?(l.openBlock(),l.createBlock(oe,{key:0,class:"mr2",name:ge.btnIcon,width:"12",height:"12",color:l.unref(d)},null,8,["name","color"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(_e.row[`loading${ge.permissionCode}`]?ge.btnName+l.unref(c)("act.loading")+"...":ge.btnName),1)]),_:2},1032,["loading","onClick"])),[[xi]])]),_:2},1064,["buttonData","scope"])):l.withDirectives((l.openBlock(),l.createBlock(re,{key:1,class:"ml4",type:"primary",link:"",size:"small",loading:_e.row[`loading${ge.permissionCode}`],onClick:Cn=>nl(ge,_e.row)},{default:l.withCtx(()=>[ge.btnIcon&&!_e.row[`loading${ge.permissionCode}`]?(l.openBlock(),l.createBlock(oe,{key:0,class:"mr2",name:ge.btnIcon,width:"12",height:"12",color:l.unref(d)},null,8,["name","color"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(_e.row[`loading${ge.permissionCode}`]?ge.btnName+l.unref(c)("act.loading")+"...":ge.btnName),1)]),_:2},1032,["loading","onClick"])),[[xi]])],64)):l.createCommentVNode("",!0)],64))),128)),Fe.value?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(Oe,{key:0,class:"table-opreate-dropdown"},{dropdown:l.withCtx(()=>[l.createVNode(ee,null,{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(rs(),(ge,ni)=>(l.openBlock(),l.createBlock(te,{key:ni,onClick:Cn=>nl(ge,_e.row)},{default:l.withCtx(()=>[F(ge,_e.row)?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[ge.isCustomBtn&&ge.customType=="component"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(ge[ge.customComponentName]),{key:0,ref_for:!0,ref:Cn=>l.unref(T)[`${ge.customComponentName}-${ge.permissionCode}`]=Cn,buttonData:ge,scope:_e,onRefresh:ti},{default:l.withCtx(()=>[l.withDirectives((l.openBlock(),l.createBlock(re,{class:"ml4",type:"primary",link:"",size:"small",loading:_e.row[`loading${ge.permissionCode}`]},{default:l.withCtx(()=>[ge.btnIcon&&!_e.row[`loading${ge.permissionCode}`]?(l.openBlock(),l.createBlock(oe,{key:0,class:"mr2",name:ge.btnIcon,width:"12",height:"12",color:l.unref(d)},null,8,["name","color"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(_e.row[`loading${ge.permissionCode}`]?ge.btnName+l.unref(c)("act.loading")+"...":ge.btnName),1)]),_:2},1032,["loading"])),[[xi]])]),_:2},1064,["buttonData","scope"])):l.withDirectives((l.openBlock(),l.createBlock(re,{key:1,class:"ml4",type:"primary",link:"",size:"small",loading:_e.row[`loading${ge.permissionCode}`]},{default:l.withCtx(()=>[ge.btnIcon&&!_e.row[`loading${ge.permissionCode}`]?(l.openBlock(),l.createBlock(oe,{key:0,class:"mr2",name:ge.btnIcon,width:"12",height:"12",color:l.unref(d)},null,8,["name","color"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(_e.row[`loading${ge.permissionCode}`]?ge.btnName+l.unref(c)("act.loading")+"...":ge.btnName),1)]),_:2},1032,["loading"])),[[xi]])],64)):l.createCommentVNode("",!0)]),_:2},1032,["onClick"]))),128))]),_:2},1024)]),default:l.withCtx(()=>[l.createVNode(re,{class:"table-btn-more",icon:l.unref(sy),size:"small",circle:""},null,8,["icon"])]),_:2},1024))]),_:2},[l.renderList(l.unref(M),(_e,ge)=>({name:_e.fieldKey,fn:l.withCtx(()=>[_e[`customTableHeaderInstance_${_e.customTableHeaderName}`]?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(_e[`customTableHeaderInstance_${_e.customTableHeaderName}`]),{key:0,data:_e,configData:l.unref(k),rowData:l.unref(X)},null,8,["data","configData","rowData"])):(l.openBlock(),l.createBlock(ae,{key:1,label:_e.fieldName+l.unref(c)("act.customTableHeader"),width:"260"},null,8,["label"]))])})),l.renderList(l.unref(S),(_e,ge)=>({name:_e.fieldKey,fn:l.withCtx(({scope:ni})=>[_e.tableCellContentType=="link"?(l.openBlock(),l.createElementBlock("span",ay,l.toDisplayString(ni.row[_e.fieldKey]),1)):_e.fieldType=="editor"?(l.openBlock(),l.createElementBlock("span",{key:1,class:"table-link",onClick:Cn=>mT(_e,ni.row)},"点击预览",8,cy)):_e.fieldType=="upload"?(l.openBlock(),l.createElementBlock(l.Fragment,{key:2},[Ue(_e,ni)?(l.openBlock(),l.createBlock(pe,{key:0,class:"file-image",fit:"cover","preview-src-list":Re(_e,ni),"preview-teleported":"",src:Ri(_e,ni)},{error:l.withCtx(()=>[l.createElementVNode("div",hy,l.toDisplayString(_e("act.noImage")),1)]),_:2},1032,["preview-src-list","src"])):(l.openBlock(),l.createBlock(ue,{key:1,type:"primary"}))],64)):_e.fieldType=="date"?(l.openBlock(),l.createElementBlock(l.Fragment,{key:3},[l.createTextVNode(l.toDisplayString(W(_e,ni.row)),1)],64)):(l.openBlock(),l.createElementBlock("span",uy,l.toDisplayString(uT(_e,ni.row)),1))])}))]),1032,["loading","total","tableQuery","selection","headers","data","showPagination","tableConfig","maxHeight"])],64)):l.createCommentVNode("",!0),l.createVNode(l.unref(o),{visible:l.unref(y).showFormDialog,"onUpdate:visible":v[2]||(v[2]=_e=>l.unref(y).showFormDialog=_e),title:l.unref(y).dialogTitle,data:l.unref(y).dialogData,onRefresh:fT},null,8,["visible","title","data"]),l.createVNode(l.unref(a),{visible:l.unref(y).showEditorPreDialog,"onUpdate:visible":v[3]||(v[3]=_e=>l.unref(y).showEditorPreDialog=_e),title:l.unref(y).editorDialogTitle,data:l.unref(y).dialogData},null,8,["visible","title","data"]),l.unref(E)==="end"?(l.openBlock(),l.createBlock(me,{key:1,description:l.unref(c)("act.noConfigPage")},{image:l.withCtx(()=>[l.createVNode(oe,{name:"config-nodata",width:"200",height:"200"})]),_:1},8,["description"])):l.createCommentVNode("",!0)]}),_:1})),[[lt,l.unref(y).pageLoading]])}}},[["__scopeId","data-v-5e51a3ae"]]),fy=[{key:"按钮形式",value:"default"},{key:"文字形式",value:"text"}],dy=[{key:"顶部",value:"header"},{key:"表格",value:"table"}],py=[{key:"主题色",value:"primary"},{key:"绿色",value:"success"},{key:"灰色",value:"info"},{key:"橙黄色",value:"warning"},{key:"红色",value:"danger"},{key:"浅蓝",value:"primary-light"}],my=[{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"}],gy=[{key:"数组",value:"array"},{key:"字符串",value:"string"},{key:"数字",value:"number"},{key:"布尔",value:"boolean"}],Oy=[{key:"且",value:"&&"},{key:"或",value:"||"}],_y=[{key:"默认值",value:"default"},{key:"匹配",value:"match"},{key:"选择列",value:"selection"},{key:"查询条件",value:"query"}],by=[{key:"默认匹配",value:"default"},{key:"用户信息变量",value:"userInfo"}],yy=[{key:"组件",value:"component"},{key:"代码",value:"code"}],wy=[{key:"GET",value:"GET"},{key:"POST",value:"POST"}],qu=[{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"}],ky=[{key:"默认值",value:"default"},{key:"匹配",value:"match"},{key:"dynamic",value:"dynamic"}],xy=[{key:"数组",value:"array"},{key:"字符串",value:"string"},{key:"数字",value:"number"}],Sy=[{key:"居中",value:"center"},{key:"左对齐",value:"left"},{key:"右对齐",value:"right"}],Cy=[{key:"默认",value:"default"},{key:"链接",value:"link"},{key:"标签",value:"tag"}],Ay=[{key:"默认宽",value:"default"},{key:"最小宽",value:"min"}],Xu=[{key:"数组",value:"array"},{key:"字符串",value:"string"},{key:"数字",value:"number"},{key:"布尔",value:"boolean"}],Qy=[{key:"左侧",value:"right"},{key:"上侧",value:"top"}],Py=[{key:"是",value:"1"},{key:"否",value:"0"}],Wu=[{label:"表格配置",options:[{key:"表格查询",value:"tableSearch"},{key:"表格展示",value:"tableShow"}]},{label:"表单配置",options:[]}],Ty={__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 h=l.resolveComponent("el-input-number"),u=l.resolveComponent("el-form-item"),f=l.resolveComponent("el-col"),d=l.resolveComponent("el-option"),m=l.resolveComponent("el-select"),b=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(b,null,{default:l.withCtx(()=>[l.createVNode(f,{span:8},{default:l.withCtx(()=>[l.createVNode(u,{label:"弹窗宽度"},{default:l.withCtx(()=>[l.createVNode(h,{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(u,{label:"排版列数"},{default:l.withCtx(()=>[l.createVNode(h,{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(u,{label:"label宽度"},{default:l.withCtx(()=>[l.createVNode(h,{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(u,{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(Qy),(p,O)=>(l.openBlock(),l.createBlock(d,{key:O+"labelPosition",label:p.key,value:p.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),_:1})}}},CT="",Ey=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(b=>{["defaultParams"].includes(b)?a.value[b]=[...m[b]||[]]:b==="tableMoreBtnSplitNumber"?a.value[b]=Reflect.has(m,"tableMoreBtnSplitNumber")?m[b]:0:b==="headerMoreBtnSplitNumber"?a.value[b]=Reflect.has(m,"headerMoreBtnSplitNumber")?m[b]:0:b==="isExecuteImmediatelyTableApi"?a.value[b]=Reflect.has(m,"isExecuteImmediatelyTableApi")?m[b]:!0:a.value[b]=m[b]})}},{deep:!0,immediate:!0});const c=()=>{a.value.defaultParams.push({submitFieldName:"",defaultValue:"",matchValue:"",submitFieldType:""})},h=f=>{a.value.defaultParams.splice(f,1)},u=f=>{f||(a.value.pageSize=10)};return e({formRef:o,form:a}),(f,d)=>{const m=l.resolveComponent("el-input"),b=l.resolveComponent("el-form-item"),w=l.resolveComponent("el-col"),g=l.resolveComponent("el-row"),p=l.resolveComponent("el-button"),O=l.resolveComponent("el-divider"),C=l.resolveComponent("el-option"),y=l.resolveComponent("el-select"),E=l.resolveComponent("el-switch"),x=l.resolveComponent("el-input-number"),k=l.resolveComponent("el-form"),P=l.resolveComponent("el-card");return l.openBlock(),l.createBlock(P,{class:"form-card",shadow:"hover",header:"表格配置"},{default:l.withCtx(()=>[l.createVNode(k,{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(b,{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]=N=>l.unref(a).dataUrl=N),placeholder:"请输入",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),l.createVNode(O,{"content-position":"left"},{default:l.withCtx(()=>[d[14]||(d[14]=l.createTextVNode(" 表格默认参数配置 ")),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,(N,_)=>(l.openBlock(),l.createBlock(g,{class:"table-post-params",key:_},{default:l.withCtx(()=>[l.createVNode(w,{span:12},{default:l.withCtx(()=>[l.createVNode(b,{label:"字段",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"defaultParams."+_+".submitFieldName"},{default:l.withCtx(()=>[l.createVNode(m,{modelValue:N.submitFieldName,"onUpdate:modelValue":A=>N.submitFieldName=A,placeholder:"请输入",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(w,{span:12},{default:l.withCtx(()=>[l.createVNode(b,{label:"匹配条件",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"defaultParams."+_+".matchValue"},{default:l.withCtx(()=>[l.createVNode(y,{modelValue:N.matchValue,"onUpdate:modelValue":A=>N.matchValue=A,placeholder:"请选择",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(r),(A,S)=>(l.openBlock(),l.createBlock(C,{key:S,label:A.key,value:A.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(w,{span:12},{default:l.withCtx(()=>[l.createVNode(b,{label:"默认值",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"defaultParams."+_+".defaultValue"},{default:l.withCtx(()=>[l.createVNode(m,{modelValue:N.defaultValue,"onUpdate:modelValue":A=>N.defaultValue=A,placeholder:"请输入",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(w,{span:12},{default:l.withCtx(()=>[l.createVNode(b,{label:"提交类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"defaultParams."+_+".submitFieldType"},{default:l.withCtx(()=>[l.createVNode(y,{modelValue:N.submitFieldType,"onUpdate:modelValue":A=>N.submitFieldType=A,placeholder:"请选择",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Xu),(A,S)=>(l.openBlock(),l.createBlock(C,{key:S,label:A.key,value:A.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(O,{"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:A=>h(_)},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(b,{label:"多选列"},{default:l.withCtx(()=>[l.createVNode(E,{modelValue:l.unref(a).isCheckRow,"onUpdate:modelValue":d[1]||(d[1]=N=>l.unref(a).isCheckRow=N)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:6},{default:l.withCtx(()=>[l.createVNode(b,{label:"操作列"},{default:l.withCtx(()=>[l.createVNode(E,{modelValue:l.unref(a).isOperateRow,"onUpdate:modelValue":d[2]||(d[2]=N=>l.unref(a).isOperateRow=N)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:6},{default:l.withCtx(()=>[l.createVNode(b,{label:"分页"},{default:l.withCtx(()=>[l.createVNode(E,{modelValue:l.unref(a).isPagination,"onUpdate:modelValue":d[3]||(d[3]=N=>l.unref(a).isPagination=N),onChange:u},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:6},{default:l.withCtx(()=>[l.createVNode(b,{label:"序号列"},{default:l.withCtx(()=>[l.createVNode(E,{modelValue:l.unref(a).isSerialNumber,"onUpdate:modelValue":d[4]||(d[4]=N=>l.unref(a).isSerialNumber=N)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:6},{default:l.withCtx(()=>[l.createVNode(b,{label:"排序"},{default:l.withCtx(()=>[l.createVNode(E,{modelValue:l.unref(a).isSort,"onUpdate:modelValue":d[5]||(d[5]=N=>l.unref(a).isSort=N)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:6},{default:l.withCtx(()=>[l.createVNode(b,{label:"展/收查询条件"},{default:l.withCtx(()=>[l.createVNode(E,{modelValue:l.unref(a).isExpandQuery,"onUpdate:modelValue":d[6]||(d[6]=N=>l.unref(a).isExpandQuery=N),onChange:u},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:6},{default:l.withCtx(()=>[l.createVNode(b,{label:"立即执行接口"},{default:l.withCtx(()=>[l.createVNode(E,{modelValue:l.unref(a).isExecuteImmediatelyTableApi,"onUpdate:modelValue":d[7]||(d[7]=N=>l.unref(a).isExecuteImmediatelyTableApi=N)},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(b,{label:"操作列宽度","label-width":"150"},{default:l.withCtx(()=>[l.createVNode(x,{modelValue:l.unref(a).tableOperateCellWidth,"onUpdate:modelValue":d[8]||(d[8]=N=>l.unref(a).tableOperateCellWidth=N),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(b,{label:"分页页数",prop:"pageSize","label-width":"150",rules:[{required:!0,message:"必填项",trigger:"blur"}]},{default:l.withCtx(()=>[l.createVNode(x,{modelValue:l.unref(a).pageSize,"onUpdate:modelValue":d[9]||(d[9]=N=>l.unref(a).pageSize=N),min:10},null,8,["modelValue"])]),_:1})]),_:1})):l.createCommentVNode("",!0),l.createVNode(w,{span:8},{default:l.withCtx(()=>[l.createVNode(b,{label:"查询条件label宽度","label-width":"150"},{default:l.withCtx(()=>[l.createVNode(x,{modelValue:l.unref(a).tableQueryLabelWidth,"onUpdate:modelValue":d[10]||(d[10]=N=>l.unref(a).tableQueryLabelWidth=N),min:80},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:8},{default:l.withCtx(()=>[l.createVNode(b,{label:"查询条件列数","label-width":"150"},{default:l.withCtx(()=>[l.createVNode(x,{modelValue:l.unref(a).tableQueryRowWidth,"onUpdate:modelValue":d[11]||(d[11]=N=>l.unref(a).tableQueryRowWidth=N),min:1},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:8},{default:l.withCtx(()=>[l.createVNode(b,{label:"表格更多按钮分割数","label-width":"150"},{default:l.withCtx(()=>[l.createVNode(x,{modelValue:l.unref(a).tableMoreBtnSplitNumber,"onUpdate:modelValue":d[12]||(d[12]=N=>l.unref(a).tableMoreBtnSplitNumber=N),min:0},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(w,{span:8},{default:l.withCtx(()=>[l.createVNode(b,{label:"顶部更多按钮分割数","label-width":"150"},{default:l.withCtx(()=>[l.createVNode(x,{modelValue:l.unref(a).headerMoreBtnSplitNumber,"onUpdate:modelValue":d[13]||(d[13]=N=>l.unref(a).headerMoreBtnSplitNumber=N),min:0},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),_:1})}}},[["__scopeId","data-v-fa895b16"]]),QT="",$y=ct({__name:"configBtns",props:{modelValue:{type:Object,default:()=>[]}},emits:["update:modelValue"],setup(i,{expose:e,emit:t}){const n=rn.useRoute(),s=l.inject("apiPrefix"),r=l.inject("request"),o=l.defineAsyncComponent(()=>Promise.resolve().then(()=>n1)),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:[]}),h=()=>({tableLoading:!1,showConfigBtnDialog:!1,dialogData:{}});let u=l.reactive(h()),f=l.ref(null),d=0,m=l.ref([]),b=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=k=>r({url:`${s}/sysMenus/getAllList`,method:"post",data:k}),O=k=>r({url:`${s}/sysMenus/getMenuOfOperate`,method:"get",params:k}),C=(k,P)=>{b.value.includes(k.permissionCode)||b.value.push(k.permissionCode),Object.assign(g.value[d],k),P(!0)},y=async k=>{try{u.tableLoading=!0;const P=a.id?a.id:n.params.id,{data:N}=await O({id:P});b.value=(N||[]).filter(_=>(k||[]).some(A=>A.permissionCode==_.unique)).map(_=>_.unique),g.value=(N||[]).map((_,A)=>{let S=c(),M=(k||[]).find(T=>T.permissionCode==_.unique)||{};return{...S,btnIcon:_.icon||"",...M,btnName:_.name,permissionCode:_.unique,sort:M.sort?M.sort:(A+1)*10}}).sort((_,A)=>_.sort-A.sort),u.tableLoading=!1}catch(P){u.tableLoading=!1,console.error(P)}},E=()=>f.value.getSelectionRows()||[];l.provide("associationMenuList",m),l.provide("createDefaultButtonItem",c),l.watch(()=>a.modelValue,async(k,P)=>{try{const N=a.id?a.id:n.params.id;m.value=(await p({dynamicFilters:[{field:"parentId",operate:"Equal",value:N}]})).data||[],await y(k)}catch(N){u.tableLoading=!1,console.error(N)}},{deep:!0});const x=k=>{u.dialogData=k.row,d=k.$index,u.showConfigBtnDialog=!0};return e({getTableSelectionRows:E}),(k,P)=>{const N=l.resolveComponent("el-tag"),_=l.resolveComponent("el-input-number"),A=l.resolveComponent("el-button"),S=l.resolveComponent("a-table"),M=l.resolveComponent("el-card");return l.openBlock(),l.createBlock(M,{class:"form-card",shadow:"hover"},{header:l.withCtx(()=>P[2]||(P[2]=[l.createElementVNode("div",{class:"card-header"},[l.createElementVNode("div",{class:"card-header-title"},"按钮配置")],-1)])),default:l.withCtx(()=>[l.createVNode(S,{ref_key:"tableRef",ref:f,loading:l.unref(u).tableLoading,rowKey:"permissionCode",selection:l.unref(b),"onUpdate:selection":P[0]||(P[0]=T=>l.isRef(b)?b.value=T:b=T),headers:l.unref(w),data:l.unref(g),showPagination:!1},{isCustomBtn:l.withCtx(({scope:T})=>[l.createVNode(N,{type:"primary",effect:"dark",size:"small"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(T.row.isCustomBtn?"是":"否"),1)]),_:2},1024)]),sort:l.withCtx(({scope:T})=>[l.createVNode(_,{modelValue:T.row.sort,"onUpdate:modelValue":I=>T.row.sort=I,min:0},null,8,["modelValue","onUpdate:modelValue"])]),operate:l.withCtx(({scope:T})=>[l.createVNode(A,{type:"primary",text:"",size:"small",icon:"Aim",onClick:I=>x(T)},{default:l.withCtx(()=>P[3]||(P[3]=[l.createTextVNode(" 配置 ")])),_:2},1032,["onClick"])]),_:1},8,["loading","selection","headers","data"]),l.createVNode(l.unref(o),{visible:l.unref(u).showConfigBtnDialog,"onUpdate:visible":P[1]||(P[1]=T=>l.unref(u).showConfigBtnDialog=T),title:"配置按钮",data:l.unref(u).dialogData,onRefresh:C},null,8,["visible","data"])]),_:1})}}},[["__scopeId","data-v-8c801481"]]),TT="",Ny={class:"card-header"},Ry=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"}],h=l.ref([]);Wu[0].options.map(C=>({btnName:C.key,permissionCode:C.value}));const u=C=>{if(!Reflect.has(C,"fieldType"))return"";const y=qu.find(E=>E.value==C.fieldType);return(y==null?void 0:y.key)||""},f=C=>Reflect.has(C,"useScenes")?(C.formCustomComponentes??[]).filter(y=>C.useScenes.includes(y.permissionCode)):[],d=C=>(C.formCustomComponentes||[]).filter(y=>y.isFieldCustom).map(y=>`${y.btnName}:是`).join(),m=(C,y)=>{if(a==null){const E=h.value.length;h.value.push({...C,sort:(E+1)*10})}else h.value[a]={...C,postRequestParams:[...C.postRequestParams],useScenes:[...C.useScenes],formCustomComponentes:[...C.formCustomComponentes]};n("update:modelValue",h.value),y(!0)},b=async()=>{try{o.tableLoading=!0,h.value=(s.modelValue||[]).map(C=>({...C,sort:C.sort?C.sort:0})).sort((C,y)=>C.sort-y.sort),o.tableLoading=!1}catch(C){o.tableLoading=!1,console.error(C)}};l.watch(()=>s.modelValue,async(C,y)=>{await b()},{deep:!0,immediate:!0});const w=()=>{a=null,o.dialogData={},o.showAddFieldDialog=!0},g=C=>{a=C.$index,o.dialogData=C.row,o.showAddFieldDialog=!0},p=()=>{n("update:modelValue",h.value)},O=C=>{h.value.splice(C.$index,1),n("update:modelValue",h.value)};return(C,y)=>{const E=l.resolveComponent("el-button"),x=l.resolveComponent("el-tag"),k=l.resolveComponent("el-badge"),P=l.resolveComponent("el-input-number"),N=l.resolveComponent("a-table"),_=l.resolveComponent("el-card");return l.openBlock(),l.createBlock(_,{class:"form-card",shadow:"hover"},{header:l.withCtx(()=>[l.createElementVNode("div",Ny,[y[3]||(y[3]=l.createElementVNode("div",{class:"card-header-title"},"字段配置",-1)),l.createVNode(E,{class:"card-header-operate",type:"primary",icon:"Plus",onClick:y[0]||(y[0]=A=>w())},{default:l.withCtx(()=>y[2]||(y[2]=[l.createTextVNode("添加字段")])),_:1})])]),default:l.withCtx(()=>[l.createVNode(N,{loading:l.unref(o).tableLoading,headers:l.unref(c),data:l.unref(h),showPagination:!1},{fieldType:l.withCtx(({scope:A})=>[l.createTextVNode(l.toDisplayString(u(A.row)),1)]),useScenes:l.withCtx(({scope:A})=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(f(A.row),(S,M)=>(l.openBlock(),l.createBlock(k,{key:M,value:S.isFieldCustom?"C":"",offset:[-5,5]},{default:l.withCtx(()=>[l.createVNode(x,{style:{margin:"0 4px"},type:"success",effect:"dark",size:"small"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(S.btnName),1)]),_:2},1024)]),_:2},1032,["value"]))),128))]),formCustomComponentes:l.withCtx(({scope:A})=>[d(A.row)?(l.openBlock(),l.createBlock(x,{key:0,type:"primary",effect:"dark",size:"small"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(d(A.row)),1)]),_:2},1024)):l.createCommentVNode("",!0)]),sort:l.withCtx(({scope:A})=>[l.createVNode(P,{modelValue:A.row.sort,"onUpdate:modelValue":S=>A.row.sort=S,min:0,onChange:p},null,8,["modelValue","onUpdate:modelValue"])]),operate:l.withCtx(({scope:A})=>[l.createVNode(E,{type:"primary",text:"",size:"small",icon:"EditPen",onClick:S=>g(A)},{default:l.withCtx(()=>y[4]||(y[4]=[l.createTextVNode("编辑")])),_:2},1032,["onClick"]),l.createVNode(E,{type:"danger",text:"",size:"small",icon:"Delete",onClick:S=>O(A)},{default:l.withCtx(()=>y[5]||(y[5]=[l.createTextVNode("删除")])),_:2},1032,["onClick"])]),_:1},8,["loading","headers","data"]),l.createVNode(l.unref(t),{visible:l.unref(o).showAddFieldDialog,"onUpdate:visible":y[1]||(y[1]=A=>l.unref(o).showAddFieldDialog=A),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-75e750d2"]]),$T="",Vy={class:"dialog-footer"},Ly=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=rn.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 h=l.reactive(c()),u=l.ref([]),f=l.ref(null),d=l.ref(a());const m=C=>s({url:`${n}/scripts/getAllDatabaseTable`,method:"get",data:C}),b=async()=>{try{h.loading=!0;const{data:C}=await m();u.value=C||[],h.loading=!1}catch(C){console.error(C),h.loading=!1}};l.watch(()=>o.visible,async(C,y)=>{C&&await b()});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=C=>{p(),C()},p=()=>{d.value=Object.assign(d.value,a()),f.value.resetFields(),r("update:visible",!1)},O=C=>{C&&C.validate(async y=>{if(y)try{h.btnLoading=!0;const{data:E}=await s({url:`${n}/scripts/getAllColumnsByTableName`,method:"get",params:{tableName:d.value.dataBase}}),x=(E||[]).map(k=>{let P=w();return P.fieldName=k.comment,P.fieldKey=k.name,P.fieldType="string",P});r("refresh",{formList:x},()=>{p()}),h.btnLoading=!1}catch(E){console.error(E),h.btnLoading=!1}})};return(C,y)=>{const E=l.resolveComponent("el-option"),x=l.resolveComponent("el-select"),k=l.resolveComponent("el-form-item"),P=l.resolveComponent("el-input"),N=l.resolveComponent("el-form"),_=l.resolveComponent("el-button"),A=l.resolveComponent("el-dialog"),S=l.resolveDirective("loading"),M=l.resolveDirective("debounce");return l.openBlock(),l.createBlock(A,{"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",Vy,[l.createVNode(_,{loading:l.unref(h).btnLoading,onClick:p},{default:l.withCtx(()=>y[3]||(y[3]=[l.createTextVNode("取消")])),_:1},8,["loading"]),l.withDirectives((l.openBlock(),l.createBlock(_,{type:"primary",loading:l.unref(h).btnLoading,onClick:y[2]||(y[2]=T=>O(l.unref(f)))},{default:l.withCtx(()=>y[4]||(y[4]=[l.createTextVNode("保存")])),_:1},8,["loading"])),[[M]])])]),default:l.withCtx(()=>[l.withDirectives((l.openBlock(),l.createBlock(N,{ref_key:"formRef",ref:f,model:l.unref(d),"label-suffix":":","label-position":"top"},{default:l.withCtx(()=>[l.createVNode(k,{label:"数据库","label-width":"120",rules:[{required:!1,message:"必填项",trigger:"change"}],prop:"dataBase"},{default:l.withCtx(()=>[l.createVNode(x,{modelValue:l.unref(d).dataBase,"onUpdate:modelValue":y[0]||(y[0]=T=>l.unref(d).dataBase=T),placeholder:"请选择数据库",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(u),(T,I)=>(l.openBlock(),l.createBlock(E,{key:T,label:`${T.tableComment}【${T.tableName}】`,value:T.tableName},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l.createVNode(k,{label:"接口地址(关键字)","label-width":"120",rules:[{required:!1,message:"必填项",trigger:"change"}],prop:"api"},{default:l.withCtx(()=>[l.createVNode(P,{modelValue:l.unref(d).api,"onUpdate:modelValue":y[1]||(y[1]=T=>l.unref(d).api=T),placeholder:"请输入接口地址(关键字)",clearable:""},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])),[[S,l.unref(h).loading]])]),_:1},8,["model-value","title"])}}},[["__scopeId","data-v-8fa48448"]]),RT="",My={class:"page-container"},By={class:"submit-box"},Dy={class:"submit-box-r"},Yu=ct({__name:"index",props:{pageKey:{type:String,default:""},id:{type:String,default:void 0}},setup(i){const e=rn.useRoute(),t=rn.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([]),h=l.ref(),u=l.ref([]),f=l.ref({}),d=l.ref(null),m=l.ref(null),b=l.ref(null),w=l.ref({}),g=l.ref({}),p=l.ref([]),O=l.ref([]),C=l.reactive({pageLoading:!1,saveBtnLoading:!1,showDialogInitConfig:!1});const y=B=>s({url:`${n}/pages/getPageDetail?key=${B}`,method:"get"}),E=B=>s({url:`${n}/pageConfigs/createOrEdit`,method:"post",data:B}),x=B=>s({url:`${n}/sysMenus/getAllList`,method:"post",data:B}),k=B=>s({url:`${n}/sysDataDictionaries/getDictionaryByGroup?groupName=${B}`,method:"get"}),P=async()=>{const{data:B}=await x({dynamicFilters:[{field:"url",operate:"Equal",value:"/pages"}]});c.value=B||[]},N=async()=>{try{const{data:{pageConfigs:B}}=await y(a),U=JSON.parse(B.pageConfig)||{};o=B.pageId,console.log("pageConfigData",U),f.value=U,w.value={...U.tableConfig??{}},g.value={...U.formConfig??{}},p.value=[...U.buttons??[]],O.value=[...U.fields??[]]}catch(B){console.error(B)}},_=()=>{w.value={},g.value={},p.value=[],O.value=[],N()};l.provide("conditionList",()=>u),l.provide("pageKey",()=>l.ref(a)),l.provide("configData",()=>f),l.onMounted(async()=>{try{C.pageLoading=!0,await P(),h.value=e.params.id,u.value=(await k("Condition")).data||[],await N(),C.pageLoading=!1}catch(B){C.pageLoading=!1,console.error(B)}});const A=B=>{const U=c.value.find(Z=>Z.id==B);t.replace({path:`/actConfig/${U.key}/${U.id}`}),h.value=U.id,a=U.key,N()},S=()=>{C.showDialogInitConfig=!0},M=({formList:B},U)=>{O.value=[...B],U(!0)},T=()=>{let B={id:o,key:a,pageConfig:{tableConfig:d.value.form,formConfig:m.value.form,buttons:b.value.getTableSelectionRows(),fields:O.value}};B.pageConfig=JSON.stringify(B.pageConfig),C.saveBtnLoading=!0,E(B).then(U=>{Ne.ElNotification({title:"提示",message:"保存成功",type:"success",duration:2500}),_(),C.saveBtnLoading=!1}).catch(U=>{C.saveBtnLoading=!1})},I=async()=>{Promise.all([d.value.formRef.validate(),m.value.formRef.validate()]).then(B=>{B.every(U=>U)&&T()}).catch(B=>B)};return(B,U)=>{const Z=l.resolveComponent("el-button"),K=l.resolveComponent("el-option"),X=l.resolveComponent("el-select"),J=l.resolveComponent("el-card"),fe=l.resolveComponent("el-col"),he=l.resolveComponent("el-row"),ye=l.resolveDirective("debounce"),z=l.resolveDirective("loading");return l.withDirectives((l.openBlock(),l.createElementBlock("div",My,[l.createVNode(he,{style:{margin:"0"},gutter:12},{default:l.withCtx(()=>[l.createVNode(fe,{class:"header-operate",span:24},{default:l.withCtx(()=>[l.createVNode(J,{class:"form-card",shadow:"hover"},{default:l.withCtx(()=>[l.createElementVNode("div",By,[U[10]||(U[10]=l.createElementVNode("div",{class:"submit-box-l"},null,-1)),l.createElementVNode("div",Dy,[l.withDirectives((l.openBlock(),l.createBlock(Z,{style:{width:"120px"},type:"primary",loading:l.unref(C).initBtnLoading,onClick:U[0]||(U[0]=D=>S())},{default:l.withCtx(()=>U[8]||(U[8]=[l.createTextVNode("一键初始化配置")])),_:1},8,["loading"])),[[ye]]),l.createVNode(X,{class:"menu-select",modelValue:l.unref(h),"onUpdate:modelValue":U[1]||(U[1]=D=>l.isRef(h)?h.value=D:h=D),placeholder:"菜单切换",clearable:"",filterable:"",onChange:A},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(c),D=>(l.openBlock(),l.createBlock(K,{key:D.id,label:D.name,value:D.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),l.withDirectives((l.openBlock(),l.createBlock(Z,{style:{width:"120px"},type:"success",loading:l.unref(C).saveBtnLoading,onClick:U[2]||(U[2]=D=>I(B.formRef))},{default:l.withCtx(()=>U[9]||(U[9]=[l.createTextVNode("保存")])),_:1},8,["loading"])),[[ye]])])])]),_:1})]),_:1}),l.createVNode(fe,{class:"mt12",span:12},{default:l.withCtx(()=>[l.createVNode(Ey,{ref_key:"configTableRef",ref:d,modelValue:l.unref(w),"onUpdate:modelValue":U[3]||(U[3]=D=>l.isRef(w)?w.value=D:w=D)},null,8,["modelValue"])]),_:1}),l.createVNode(fe,{class:"mt12",span:12},{default:l.withCtx(()=>[l.createVNode(Ty,{ref_key:"configFormRef",ref:m,modelValue:l.unref(g),"onUpdate:modelValue":U[4]||(U[4]=D=>l.isRef(g)?g.value=D:g=D)},null,8,["modelValue"])]),_:1}),l.createVNode(fe,{class:"mt12",span:24},{default:l.withCtx(()=>[l.createVNode($y,{ref_key:"configBtnsRef",ref:b,modelValue:l.unref(p),"onUpdate:modelValue":U[5]||(U[5]=D=>l.isRef(p)?p.value=D:p=D)},null,8,["modelValue"])]),_:1}),l.createVNode(fe,{class:"mt12",span:24},{default:l.withCtx(()=>[l.createVNode(Ry,{modelValue:l.unref(O),"onUpdate:modelValue":U[6]||(U[6]=D=>l.isRef(O)?O.value=D:O=D)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(Ly,{visible:l.unref(C).showDialogInitConfig,"onUpdate:visible":U[7]||(U[7]=D=>l.unref(C).showDialogInitConfig=D),title:"一键初始化配置",onRefresh:M},null,8,["visible"])])),[[z,l.unref(C).pageLoading]])}}},[["__scopeId","data-v-8dfa8a8a"]]),vy=(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)},Cr={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:"一键格式化代码"}}},zu={ActPage:ju,ActConfig:Yu},Zy={install(i,e){var d;const{modules:t,apiPrefix:n,request:s,themeColor:r,cacheTokenType:o="sessionStorage",cookieStorage:a,language:{messages:c={},en:h="zhCn"}}=e,u={act:Object.assign(Cr[h].act,((d=c[h])==null?void 0:d.act)??{})},f=wu({locale:h,fallbackLocale:h,messages:{...Cr,[h]:u}});i.use(f),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.directive("debounce",vy),Object.keys(zu).forEach(m=>{i.component(m,zu[m])})}},Iy={ActPage:ju,ActConfig:Yu};function Uy(i){var o;const{modules:e,language:{messages:t={},en:n="zhCn"}}=i,s={act:Object.assign(Cr[n].act,((o=t[n])==null?void 0:o.act)??{})};return wu({locale:n,fallbackLocale:n,messages:{...Cr,[n]:s}})}const LT="",Fy={key:0,class:"search-module-container"},jy={class:"no-config-field"},qy=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(()=>Gu)),{t:n}=Gt(),s=l.inject("request"),r=l.inject("globalProps"),o=l.inject("loadComponents"),a=l.inject("getFieldUiProps"),c=l.inject("formatDataType"),h=l.inject("disposeDate"),u=l.inject("getDefaultQueryValues"),f=e,d=i,m=l.ref({});let b=l.ref([]),w=l.ref([]),g=l.ref(!0);const p=l.ref(0),O=l.ref(0),C=A=>d.data.tableConfig.isExpandQuery&&g.value?d.data.tableConfig.tableQueryRowWidth>A+1:!0,y=async A=>{b.value=await Promise.all(A.filter(S=>S.useScenes.includes("tableSearch")).map(async S=>{S.tableQueryDefaultValue&&(["date","dateRange"].includes(S.fieldType)?S.queryValue=h(S):S.queryValue=S.tableQueryDefaultValue?S.tableQueryDefaultValue:void 0),r.defaultParams.some(T=>{T.field==S.fieldKey&&T.operate===S.tableQueryCondition&&(S.queryValue=T.value)});const M=(S.formCustomComponentes??[]).find(T=>T.permissionCode==="tableSearch");if(S.isQueryFieldCustom=!1,M&&M.isFieldCustom){const{isFieldCustom:T,customComponentName:I,customComponentUrl:B}=M;if(S.isQueryFieldCustom=!0,O.value++,T&&!S.customQueryComponent){const U=await o(B,I);S.customQueryComponent=U}}return S}))},E=A=>{const S=(A||[]).filter(M=>M.permissionCode===1001).map(M=>({...M,loading:!1}));w.value=[...S,{btnName:n("act.reset"),permissionCode:"9999",btnColor:"info",btnIcon:"btn-reset",loading:!1}]},x=async({node:A,resolve:S},M)=>{const T=a(M),{label:I,value:B,children:U,isLeaf:Z}={...xr,...T.treeProps||{}};if(A[Z])return S([]);const K=M.postRequestParams.filter(z=>z.submitType==="default").reduce((z,D)=>(z[D.submitName]=c(D.paramsType,D.submitValue),z),{}),X=M.postRequestParams.filter(z=>z.submitType==="match").reduce((z,D)=>(z[D.submitName]=c(D.paramsType,r.matchData[D.submitValue][D.submitName]),z),{}),J=M.postRequestParams.filter(z=>z.submitType==="dynamic").map(z=>({field:z.submitName,operate:z.submitMatchType,value:T.loadCode?A==null?void 0:A.data.value:c(z.paramsType,z.submitValue)}));let fe={};Object.keys(K).length&&(fe={...fe,...K}),Object.keys(X).length&&(fe={...fe,...X}),J.length&&(fe.dynamicFilters=J),T.loadCode&&Reflect.has(fe,T.loadCode)&&(fe[T.loadCode]=A==null?void 0:A.data.value);const{data:he}=await s({url:M.fieldRequestUrl,method:M.fieldRequestType||"GET",data:fe}),ye=(he||[]).map(z=>({label:z[I],value:z[B],children:[],isLeaf:z[Z]}));S(ye)};l.watch(()=>d.data,(A,S)=>{y(A.fields),E(A.buttons)},{immediate:!0,deep:!0});const k=()=>{p.value++,p.value===O.value&&P({permissionCode:1001})},P=A=>{switch(A.loading=!0,A.permissionCode){case"9999":b.value.forEach(T=>{T.tableQueryDefaultValue?T.queryValue=["date","dateRange"].includes(T.fieldType)?h(T):(T==null?void 0:T.tableQueryDefaultValue)||void 0:T.queryValue=T.fieldType.includes("&")?[]:void 0});const S=u();f("reset",S,()=>{A.loading=!1});break;default:const M=b.value.filter(T=>Array.isArray(T.queryValue)?T.queryValue.length:!!T.queryValue);f("search",M,()=>{A.loading=!1});break}},N=()=>{g.value=!g.value},_=()=>{P({permissionCode:1001})};return(A,S)=>{var z;const M=l.resolveComponent("el-input"),T=l.resolveComponent("el-option"),I=l.resolveComponent("el-select"),B=l.resolveComponent("el-select-v2"),U=l.resolveComponent("el-cascader"),Z=l.resolveComponent("el-tree-select"),K=l.resolveComponent("el-date-picker"),X=l.resolveComponent("el-form-item"),J=l.resolveComponent("a-svg-icon"),fe=l.resolveComponent("el-button"),he=l.resolveComponent("el-form"),ye=l.resolveDirective("debounce");return l.unref(b)&&l.unref(b).length?(l.openBlock(),l.createElementBlock("div",Fy,[l.createVNode(he,{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(b),(D,V)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:V},[C(V)?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[D.isQueryFieldCustom?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[D.customQueryComponent?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(D.customQueryComponent),{key:0,class:"custom-btn",ref_for:!0,ref:q=>m.value[`customQueryComponent_${V}`]=q,modelValue:D.queryValue,"onUpdate:modelValue":q=>D.queryValue=q,queryItem:D,data:d.data,onRefresh:S[9]||(S[9]=q=>P({permissionCode:1001})),onLoaded:k},null,40,["modelValue","onUpdate:modelValue","queryItem","data"])):(l.openBlock(),l.createElementBlock("div",{class:"no-config",key:V},[l.createElementVNode("span",jy,"【"+l.toDisplayString(D.fieldName)+"】",1),l.createTextVNode(l.toDisplayString(l.unref(n)("act.fieldCustom")),1)]))],64)):(l.openBlock(),l.createBlock(X,{key:0,class:"search-form-item","label-width":d.data.tableConfig.tableQueryLabelWidth,label:D.fieldName},{default:l.withCtx(()=>[D.fieldType==="input"||D.fieldType==="editor"?(l.openBlock(),l.createBlock(M,l.mergeProps({key:0,modelValue:D.queryValue,"onUpdate:modelValue":q=>D.queryValue=q,placeholder:`${l.unref(n)("act.inputPlaceholder")}${D.fieldName}`,clearable:"",ref_for:!0},l.unref(a)(D),{onKeyup:S[0]||(S[0]=l.withKeys(l.withModifiers(q=>P({permissionCode:1001}),["prevent"]),["enter","native"])),onClear:_}),null,16,["modelValue","onUpdate:modelValue","placeholder"])):l.createCommentVNode("",!0),D.fieldType==="inputNumber"?(l.openBlock(),l.createBlock(l.unref(t),l.mergeProps({key:1,modelValue:D.queryValue,"onUpdate:modelValue":q=>D.queryValue=q,placeholder:`${l.unref(n)("act.inputPlaceholder")}${D.fieldName}`,clearable:"",onKeyup:S[1]||(S[1]=l.withKeys(l.withModifiers(q=>P({permissionCode:1001}),["prevent"]),["enter","native"])),ref_for:!0},l.unref(a)(D)),null,16,["modelValue","onUpdate:modelValue","placeholder"])):["select","switch","multipleSelect"].includes(D.fieldType)?(l.openBlock(),l.createBlock(I,l.mergeProps({key:2,modelValue:D.queryValue,"onUpdate:modelValue":q=>D.queryValue=q,placeholder:`${l.unref(n)("act.selectPlaceholder")}${D.fieldName}`,clearable:"",filterable:"",ref_for:!0},l.unref(a)(D),{multiple:D.fieldType==="multipleSelect","collapse-tags":D.fieldType==="multipleSelect","collapse-tags-tooltip":D.fieldType==="multipleSelect",onChange:S[2]||(S[2]=q=>P({permissionCode:1001}))}),{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(D.dataList,(q,H)=>(l.openBlock(),l.createBlock(T,{key:H,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(D.fieldType)?(l.openBlock(),l.createBlock(B,l.mergeProps({key:3,modelValue:D.queryValue,"onUpdate:modelValue":q=>D.queryValue=q,options:D.dataList,props:{...l.unref(Fu)},placeholder:`${l.unref(n)("act.selectPlaceholder")}${D.fieldName}`,clearable:"",filterable:"",ref_for:!0},l.unref(a)(D),{"collapse-tags":D.fieldType==="virtualizedMultipleSelect","collapse-tags-tooltip":D.fieldType==="virtualizedMultipleSelect",multiple:D.fieldType==="virtualizedMultipleSelect",onChange:S[3]||(S[3]=q=>P({permissionCode:1001}))}),null,16,["modelValue","onUpdate:modelValue","options","props","placeholder","collapse-tags","collapse-tags-tooltip","multiple"])):D.fieldType==="provinceCascade"?(l.openBlock(),l.createBlock(U,l.mergeProps({key:4,modelValue:D.queryValue,"onUpdate:modelValue":q=>D.queryValue=q,options:D.dataList,props:{...l.unref(Uu)},clearable:"",filterable:"",placeholder:`${l.unref(n)("act.selectPlaceholder")}${D.fieldName}`,ref_for:!0},l.unref(a)(D),{onChange:S[4]||(S[4]=q=>P({permissionCode:1001}))}),null,16,["modelValue","onUpdate:modelValue","options","props","placeholder"])):D.fieldType==="fullLoadTreeSelect"?(l.openBlock(),l.createBlock(Z,l.mergeProps({key:5,ref_for:!0,ref:q=>m.value[`elTreeSelect_fullLoad_${V}`]=q,modelValue:D.queryValue,"onUpdate:modelValue":q=>D.queryValue=q,data:D.dataList,placeholder:`请选择${D.fieldName}`,props:{...l.unref(xr),...l.unref(a)(D).treeProps||{}},"render-after-expand":!1,"collapse-tags":"","collapse-tags-tooltip":"",multiple:"","show-checkbox":"",clearable:"",filterable:""},l.unref(a)(D),{onChange:S[5]||(S[5]=q=>P({permissionCode:1001}))}),null,16,["modelValue","onUpdate:modelValue","data","placeholder","props"])):D.fieldType==="treeSelect"?(l.openBlock(),l.createBlock(Z,l.mergeProps({key:6,ref_for:!0,ref:q=>m.value[`elTreeSelect_${V}`]=q,modelValue:D.queryValue,"onUpdate:modelValue":q=>D.queryValue=q,placeholder:`请选择${D.fieldName}`,props:{isLeaf:"isLeaf"},"render-after-expand":!1,"collapse-tags":"","collapse-tags-tooltip":"",multiple:"","show-checkbox":"",clearable:"",filterable:"",lazy:"",load:(q,H)=>x({node:q,resolve:H},D)},l.unref(a)(D),{onChange:S[6]||(S[6]=q=>P({permissionCode:1001}))}),null,16,["modelValue","onUpdate:modelValue","placeholder","load"])):D.fieldType==="date"?(l.openBlock(),l.createBlock(K,l.mergeProps({key:7,modelValue:D.queryValue,"onUpdate:modelValue":q=>D.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)(D),{onChange:S[7]||(S[7]=q=>P({permissionCode:1001}))}),null,16,["modelValue","onUpdate:modelValue","placeholder"])):D.fieldType==="dateRange"?(l.openBlock(),l.createBlock(K,l.mergeProps({key:8,modelValue:D.queryValue,"onUpdate:modelValue":q=>D.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)(D),{onChange:S[8]||(S[8]=q=>P({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(b).length?(l.openBlock(),l.createBlock(X,{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),(D,V)=>l.withDirectives((l.openBlock(),l.createBlock(fe,{key:V,type:D.btnColor,loading:D.loading,onClick:q=>P(D)},{default:l.withCtx(()=>[D.btnIcon?(l.openBlock(),l.createBlock(J,{key:0,class:"mr6",name:D.btnIcon,width:"12",height:"12",color:"#fff"},null,8,["name"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(D.btnName),1)]),_:2},1032,["type","loading","onClick"])),[[ye]])),128))]),_:1})):l.createCommentVNode("",!0)]),_:1},8,["style"]),d.data.tableConfig.isExpandQuery&&((z=l.unref(b))==null?void 0:z.length)>d.data.tableConfig.tableQueryRowWidth?(l.openBlock(),l.createBlock(fe,{key:0,class:"expand",text:"",size:"small",icon:l.unref(g)?"ArrowDown":"ArrowUp",onClick:N},{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-92d7682c"]])},Symbol.toStringTag,{value:"Module"})),DT="",Xy={class:"header-operate-container"},Wy=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}=Gt();let r=l.ref([]);const o=l.inject("globalProps"),a=l.inject("menuPermissionBtns"),c=l.inject("stringToBoolean"),h=l.inject("matchCondition"),u=l.inject("getTableData"),f=l.inject("tableBtnRefs"),d=l.computed(()=>{const{tableConfig:{headerMoreBtnSplitNumber:C}}=n.data;return!C||C>=r.value.length}),m=()=>{const{tableConfig:{headerMoreBtnSplitNumber:C}}=n.data;return d.value?r.value:r.value.slice(0,C)},b=()=>{var y;const{tableConfig:{headerMoreBtnSplitNumber:C}}=n.data;return d.value?[]:r.value.slice(C,(y=r.value)==null?void 0:y.length)},w=C=>{if(!C.matchFields.length)return!0;const y=C.matchFields.filter(N=>N.matchType!="default"),E=N=>o.matchData[N.matchType][N.matchFieldName];let k=y.reduce((N,_,A)=>{const S=E(_);return N+=h(_.matchCondition,S,_.fieldValue==""?null:_.fieldValue=="true"||_.fieldValue=="false"?c(_.fieldValue):_.fieldValue),A!==y.length-1&&(N+=_.spliceCondition||"&&"),N},"").split("||"),P=k.reduce((N,_,A)=>(N+=`(${_})`,A<k.length-1&&(N+="||"),N),"");return new Function(`return ${P}`)()},g=C=>a.value.some(y=>y.unique==C.permissionCode)&&w(C),p=C=>{r.value=(C||[]).filter(y=>y.permissionCode!==1001&&y.btnPostion.includes("header")).sort((y,E)=>y.sort-E.sort).map(y=>(y.btnAlias&&(y.btnName=y.btnAlias),Reflect.has(y,"isPromptVerificationSelectTable")||(y.isPromptVerificationSelectTable="1"),y))};l.watch(()=>n.data,(C,y)=>{p(C.buttons)},{immediate:!0});const O=C=>{t("onOperate",C,{})};return(C,y)=>{const E=l.resolveComponent("a-svg-icon"),x=l.resolveComponent("el-button"),k=l.resolveComponent("el-icon"),P=l.resolveComponent("el-dropdown-item"),N=l.resolveComponent("el-dropdown-menu"),_=l.resolveComponent("el-dropdown"),A=l.resolveDirective("debounce");return l.openBlock(),l.createElementBlock("div",Xy,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(m(),(S,M)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:S.permissionCode},[g(S)?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[S.isCustomBtn&&S.customType=="component"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(S[S.customComponentName]),{key:0,class:"custom-btn",ref_for:!0,ref:T=>l.unref(f)[`${S.customComponentName}-${S.permissionCode}`]=T,buttonData:S,onRefresh:y[0]||(y[0]=T=>l.unref(u)())},{default:l.withCtx(()=>[l.withDirectives((l.openBlock(),l.createBlock(x,{class:"el-btn",type:S.btnColor,loading:S[`loading${S.permissionCode}`],onClick:T=>O(S)},{default:l.withCtx(()=>[S.btnIcon&&!S[`loading${S.permissionCode}`]?(l.openBlock(),l.createBlock(E,{key:0,class:"mr4",name:S.btnIcon,width:"12",height:"12",color:"#fff"},null,8,["name"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(S[`loading${S.permissionCode}`]?S.btnName+l.unref(s)("act.loading")+"...":S.btnName),1)]),_:2},1032,["type","loading","onClick"])),[[A]])]),_:2},1064,["buttonData"])):l.withDirectives((l.openBlock(),l.createBlock(x,{key:1,class:"el-btn",type:S.btnColor,loading:S[`loading${S.permissionCode}`],onClick:T=>O(S)},{default:l.withCtx(()=>[S.btnIcon&&!S[`loading${S.permissionCode}`]?(l.openBlock(),l.createBlock(E,{key:0,class:"mr4",name:S.btnIcon,width:"12",height:"12",color:"#fff"},null,8,["name"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(S[`loading${S.permissionCode}`]?S.btnName+l.unref(s)("act.loading")+"...":S.btnName),1)]),_:2},1032,["type","loading","onClick"])),[[A]])],64)):l.createCommentVNode("",!0)],64))),128)),d.value?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(_,{key:0,class:"header-opreate-dropdown"},{dropdown:l.withCtx(()=>[l.createVNode(N,null,{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(b(),(S,M)=>(l.openBlock(),l.createBlock(P,{key:S.permissionCode,onClick:T=>O(S)},{default:l.withCtx(()=>[g(S)?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[S.isCustomBtn&&S.customType=="component"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(S[S.customComponentName]),{key:0,class:"custom-btn",ref_for:!0,ref:T=>l.unref(f)[`${S.customComponentName}-${S.permissionCode}`]=T,buttonData:S,onRefresh:y[1]||(y[1]=T=>l.unref(u)())},{default:l.withCtx(()=>[l.withDirectives((l.openBlock(),l.createBlock(x,{class:"el-btn",type:S.btnColor,loading:S[`loading${S.permissionCode}`]},{default:l.withCtx(()=>[S.btnIcon&&!S[`loading${S.permissionCode}`]?(l.openBlock(),l.createBlock(E,{key:0,class:"mr4",name:S.btnIcon,width:"12",height:"12",color:"#fff"},null,8,["name"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(S[`loading${S.permissionCode}`]?S.btnName+l.unref(s)("act.loading")+"...":S.btnName),1)]),_:2},1032,["type","loading"])),[[A]])]),_:2},1064,["buttonData"])):l.withDirectives((l.openBlock(),l.createBlock(x,{key:1,class:"el-btn",type:S.btnColor,loading:S[`loading${S.permissionCode}`]},{default:l.withCtx(()=>[S.btnIcon&&!S[`loading${S.permissionCode}`]?(l.openBlock(),l.createBlock(E,{key:0,class:"mr4",name:S.btnIcon,width:"12",height:"12",color:"#fff"},null,8,["name"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(S[`loading${S.permissionCode}`]?S.btnName+l.unref(s)("act.loading")+"...":S.btnName),1)]),_:2},1032,["type","loading"])),[[A]])],64)):l.createCommentVNode("",!0)]),_:2},1032,["onClick"]))),128))]),_:1})]),default:l.withCtx(()=>[l.createVNode(x,{type:"primary"},{default:l.withCtx(()=>[y[2]||(y[2]=l.createTextVNode(" 更多按钮")),l.createVNode(k,{class:"el-icon--right"},{default:l.withCtx(()=>[l.createVNode(l.unref(Kb))]),_:1})]),_:1})]),_:1}))])}}},[["__scopeId","data-v-f0dda1b5"]])},Symbol.toStringTag,{value:"Module"})),IT="",Yy={class:"act-table"},zy=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","refresh","onRowClick","changeExpand"],setup(i,{expose:e,emit:t}){const{t:n}=Gt(),s=t,r=i;let o=l.ref(null);const a=g=>r.showPagination?g+1+(r.tableQuery.pageIndex-1)*r.tableQuery.pageSize:g+1,c=g=>{l.nextTick(()=>{r.data.forEach(p=>{g.includes(p[r.rowKey])&&o.value.toggleRowSelection(p,!0)})})},h=g=>o.value.getSelectionRows();l.watch(()=>r.selection,(g,p)=>{g&&g.length&&c(g)},{deep:!0,immediate:!0});const u=g=>{s("update:selection",g)},f=(g,p)=>{g&&l.nextTick(()=>{r.data.forEach(O=>{g.includes(O[p||r.rowKey])&&o.value.toggleRowSelection(O,!0)})})},d=g=>{s("update:tableQuery",{...r.tableQuery,pageSize:g}),s("refresh",[])},m=g=>{s("update:tableQuery",{...r.tableQuery,pageIndex:g}),s("refresh",[])},b=(g,p,O)=>{s("onRowClick",g,p,O)},w=(g,p)=>{s("changeExpand",g,p)};return e({getSelectionRows:h,updateSelection:f}),(g,p)=>{const O=l.resolveComponent("el-table-column"),C=l.resolveComponent("el-table"),y=l.resolveComponent("el-pagination"),E=l.resolveDirective("loading");return l.openBlock(),l.createElementBlock("div",Yy,[l.withDirectives((l.openBlock(),l.createBlock(C,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:u,onRowClick:b,onExpandChange:w}),{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(g.$slots,x.prop,{key:0},void 0,!0):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[x.render?(l.openBlock(),l.createBlock(O,{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(k=>[l.renderSlot(g.$slots,x.prop,{scope:k},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(O,{key:0,type:"selection",align:"center",width:x.width,fixed:""},null,8,["width"])):x.prop=="serialNumber"?(l.openBlock(),l.createBlock(O,{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(O,{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"])),[[E,r.loading]]),r.showPagination?(l.openBlock(),l.createBlock(y,{key:0,class:"table-pagination","current-page":r.tableQuery.pageIndex,"onUpdate:currentPage":p[0]||(p[0]=x=>r.tableQuery.pageIndex=x),"page-size":r.tableQuery.pageSize,"onUpdate:pageSize":p[1]||(p[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:d,onCurrentChange:m},null,8,["current-page","page-size","total"])):l.createCommentVNode("",!0)])}}},[["__scopeId","data-v-d2da0301"]])},Symbol.toStringTag,{value:"Module"})),jT="",Gy={class:"no-config-field"},Hy={class:"dialog-footer"},Ky=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(()=>Gu)),n=l.defineAsyncComponent(()=>Promise.resolve().then(()=>Hu)),s=l.defineAsyncComponent(()=>Promise.resolve().then(()=>w1)),r=l.defineAsyncComponent(()=>Promise.resolve().then(()=>D1)),{t:o}=Gt(),a=l.inject("request"),c=l.inject("loadComponents"),h=l.inject("formatDataType"),u=l.inject("globalProps"),f=l.inject("stringToBoolean"),d=l.inject("getFieldUiProps"),m=l.inject("disposeRequestData"),b=e,w=i,g=l.ref(!1),p=l.ref(!1),O=l.ref(null),C=l.ref([]),y=l.ref({}),E=l.ref({}),x=Z=>Z.formColumnCol==null?24:Z.formColumnCol?Z.formColumnCol:24/Z.formRow,k=Z=>["input","textarea"].includes(Z.fieldType)?"blur":(["select","multipleSelect","datetimerange","treeSelect","provinceCascade"].includes(Z.fieldType),"change"),P=async({node:Z,resolve:K},X)=>{const J=d(X),{label:fe,value:he,children:ye,isLeaf:z}={...xr,...J.treeProps||{}};if(Z[z])return K([]);const D=X.postRequestParams.filter(Re=>Re.submitType==="default").reduce((Re,qe)=>(Re[qe.submitName]=h(qe.paramsType,qe.submitValue),Re),{}),V=X.postRequestParams.filter(Re=>Re.submitType==="match").reduce((Re,qe)=>(Re[qe.submitName]=h(qe.paramsType,u.matchData[qe.submitValue][qe.submitName]),Re),{}),q=X.postRequestParams.filter(Re=>Re.submitType==="dynamic").map(Re=>{let qe={field:Re.submitName,operate:Re.submitMatchType,value:h(Re.paramsType,Re.submitValue)};return J.loadCode===Re.submitName&&(Z!=null&&Z.data.value)&&(qe.value=Z==null?void 0:Z.data.value),qe});let H={};Object.keys(D).length&&(H={...H,...D}),Object.keys(V).length&&(H={...H,...V}),q.length&&(H.dynamicFilters=q),J.loadCode&&Reflect.has(H,J.loadCode)&&(H[J.loadCode]=Z==null?void 0:Z.data.value);const{data:Ue}=await a({url:X.fieldRequestUrl,method:X.fieldRequestType||"GET",data:H}),Ri=(Ue||[]).map(Re=>({label:Re[fe],value:Re[he],children:[],isLeaf:Re[z]}));K(Ri)},N=Z=>{if(!["input","textarea"].includes(Z)){if(["multipleSelect","dateRange"].includes(Z))return[];if(["switch"].includes(Z))return!1}},_=(Z,K)=>{if(typeof Z=="string"&&["string"].includes(K))return Z.toString();if(["string"].includes(K))return Z.sort((X,J)=>X.sort-J.sort).join(";");if(["number"].includes(K))return Number(Z);if(["array"].includes(K))return Z.sort((X,J)=>X.sort-J.sort)},A=(Z,K=!1)=>{if(["multipleSelect"].includes(Z.fieldType))return w.data.rowData[Z.fieldKey]?w.data.rowData[Z.fieldKey].split(";").map(J=>K?{value:J}:J):[];if(["virtualizedMultipleSelect"].includes(Z.fieldType))return w.data.rowData[Z.fieldKey]?w.data.rowData[Z.fieldKey].split(";"):[];if(["dateRange","provinceCascade"].includes(Z.fieldType)){const J=Z.fieldKey.split("&");return w.data.rowData[Z.fieldKey]=J.map(fe=>w.data.rowData[fe]),w.data.rowData[Z.fieldKey]}let X=w.data.rowData[Z.fieldKey];if(["select"].includes(Z.fieldType)){const J=d(Z);Z.dataList&&Z.dataList.length&&typeof Z.dataList[0][J["value-key"]?J["value-key"]:"value"]=="string"&&X!==null&&(X=K?{value:X.toString()}:X.toString())}if(["virtualizedSelect"].includes(Z.fieldType)){const J=d(Z);Z.dataList&&Z.dataList.length&&typeof Z.dataList[0][J["value-key"]?J["value-key"]:"value"]=="string"&&X!==null&&(X=X.toString())}return(X==="true"||X==="false")&&(X=f(X)),X},S=Z=>a({url:w.data.dataItem.requestUrl,method:"post",data:Z});l.watch(()=>w.visible,async(Z,K)=>{var X,J;if(Z)try{g.value=!0;const fe=await m(w.data.formList,w.data.rowData,!1,!0);console.log("formList",(X=w.data)==null?void 0:X.formList),C.value=await Promise.all((((J=w.data)==null?void 0:J.formList)??[]).sort((he,ye)=>he.sort-ye.sort).map(async he=>{const ye=fe.find(q=>he.fieldName==q.fieldName&&he.fieldKey==q.fieldKey);ye&&(he.dataList=(ye==null?void 0:ye.dataList)??[]),["select","multipleSelect"].includes(he.fieldType)&&(y.value[`${he.fieldKey}ActImplicit`]=Object.keys(w.data.rowData).length&&he.isFormSetValue?A(he,!0):N(he.fieldType)),y.value[he.fieldKey]=Object.keys(w.data.rowData).length&&he.isFormSetValue?A(he):N(he.fieldType);const{isFieldCustom:z,customComponentName:D,customComponentUrl:V}=he.customFiledsComponentes;if(z&&!he.customFiledsComponentes[D]){const q=await c(V,D);he.customFiledsComponentes[D]=q}return he})),g.value=!1}catch(fe){console.error(fe),g.value=!1}});const M=Z=>{T(),Z()},T=()=>{C.value=[],O.value.resetFields(),b("update:visible",!1)},I=(Z,K)=>{const X=d(K),{fieldKey:J,fieldType:fe}=K;if(fe==="multipleSelect"){const he=Z.filter(z=>typeof z=="string"),ye=Z.filter(z=>typeof z!="string").map(z=>z.value);y.value[X.createFieldKey]=he.length?_(he,"string"):void 0,y.value[J]=ye.length?_(ye,"string"):void 0}else typeof Z=="string"?(y.value[X.createFieldKey]=Z,y.value[J]=void 0):(y.value[J]=Z.value,delete y.value[X.createFieldKey])},B=Z=>{Z&&Z.validate(K=>{if(K){const{dataItem:X,rowData:J}=w.data;let fe={...l.toRaw(y.value)};Object.keys(fe).forEach(z=>{if(z.includes("ActImplicit")){delete fe[z];return}const D=C.value.find(V=>V.fieldKey===z);z.includes("&")?z.split("&").forEach((q,H)=>{fe[q]=fe[z]?_(fe[z][H],D.fieldSubmitType):fe[z]}):Array.isArray(fe[z])&&D.fieldSubmitType=="string"&&(fe[z]=_(fe[z],"string"))});const he=X.submitFields.filter(z=>z.matchType=="default").reduce((z,D)=>(D.submitFieldType==="string"&&(z[D.submitFieldName]=D.matchFieldName.toString()),z),{}),ye=X.submitFields.filter(z=>z.matchType=="match").reduce((z,D)=>(Reflect.has(D,"submitFieldMatchOrigin")&&D.submitFieldMatchOrigin==="selections"?z[D.submitFieldName]=w.data.selections.map(V=>h(D.submitFieldType,V[D.matchFieldName])):Reflect.has(D,"submitFieldMatchOrigin")&&D.submitFieldMatchOrigin!="rowData"?Reflect.has(u.matchData,D.submitFieldMatchOrigin)&&(z[D.submitFieldName]=h(D.submitFieldType,u.matchData[D.submitFieldMatchOrigin][D.matchFieldName])):z[D.submitFieldName]=h(D.submitFieldType,J[D.matchFieldName]),z),{});S({...fe,...he,...ye}).then(z=>{try{Ne.ElNotification({title:o("act.tip"),message:o("act.saveSuccessfully"),type:"success",duration:2500}),T(),b("refresh",X)}catch(D){console.error(D)}p.value=!1}).catch(z=>{console.error(z),p.value=!1})}})},U=Z=>{const K=Object.keys(E.value).map(X=>{var J;return(J=E.value[X])==null?void 0:J.updateFormData(y.value)}).filter(X=>X);Promise.all([Z.validate(),...K]).then(X=>{X.every(J=>J)&&B(Z)}).catch(X=>(console.error(X),X))};return(Z,K)=>{var ki;const X=l.resolveComponent("el-input"),J=l.resolveComponent("el-option"),fe=l.resolveComponent("el-select"),he=l.resolveComponent("el-select-v2"),ye=l.resolveComponent("el-tree-select"),z=l.resolveComponent("el-date-picker"),D=l.resolveComponent("el-cascader"),V=l.resolveComponent("el-switch"),q=l.resolveComponent("el-form-item"),H=l.resolveComponent("el-col"),Ue=l.resolveComponent("el-row"),Ri=l.resolveComponent("el-form"),Re=l.resolveComponent("el-button"),qe=l.resolveComponent("el-dialog"),Wt=l.resolveDirective("loading"),Dt=l.resolveDirective("debounce");return l.openBlock(),l.createBlock(qe,{"model-value":w.visible,title:w.title,top:"5vh",width:(ki=i.data.formConfig)==null?void 0:ki.dialogWidth,draggable:"",overflow:"","append-to-body":"","destroy-on-close":"","close-on-click-modal":!1,"before-close":M},{footer:l.withCtx(()=>[l.createElementVNode("span",Hy,[l.createVNode(Re,{loading:p.value,onClick:T},{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:K[1]||(K[1]=Vi=>U(O.value))},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(o)("act.save")),1)]),_:1},8,["loading"])),[[Dt]])])]),default:l.withCtx(()=>{var Vi,R;return[l.withDirectives((l.openBlock(),l.createBlock(Ri,{class:"a-form",ref_key:"formRef",ref:O,model:y.value,"label-suffix":":","label-width":(Vi=i.data.formConfig)==null?void 0:Vi.formLabelWidth,"label-position":(R=i.data.formConfig)==null?void 0:R.formLabelPosition},{default:l.withCtx(()=>[l.createVNode(Ue,{gutter:40},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(C.value,(Q,W)=>(l.openBlock(),l.createBlock(H,{span:x(Q),key:W},{default:l.withCtx(()=>[Q.customFiledsComponentes.isFieldCustom?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[Q.customFiledsComponentes[Q.customFiledsComponentes.customComponentName]?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(Q.customFiledsComponentes[Q.customFiledsComponentes.customComponentName]),{key:0,ref_for:!0,ref:Y=>E.value[Q.customFiledsComponentes.customComponentName]=Y,formConfig:i.data.formConfig,item:Q,rowData:w.data.rowData,visible:w.visible,form:y.value,"onUpdate:form":K[0]||(K[0]=Y=>y.value=Y)},null,40,["formConfig","item","rowData","visible","form"])):(l.openBlock(),l.createElementBlock("div",{class:"no-config",key:W},[l.createElementVNode("span",Gy,"【"+l.toDisplayString(Q.fieldName)+"】",1),l.createTextVNode(l.toDisplayString(l.unref(o)("act.fieldCustom")),1)]))],64)):(l.openBlock(),l.createBlock(q,{key:0,label:Q.fieldName,prop:["select","multipleSelect"].includes(Q.fieldType)?`${Q.fieldKey}ActImplicit`:Q.fieldKey,rules:[{required:Q.isFormFieldRequired,message:l.unref(o)("act.requiredMessage"),trigger:k(Q)}]},{default:l.withCtx(()=>[Q.fieldType==="input"?(l.openBlock(),l.createBlock(X,l.mergeProps({key:0,modelValue:y.value[Q.fieldKey],"onUpdate:modelValue":Y=>y.value[Q.fieldKey]=Y,placeholder:`${l.unref(o)("act.inputPlaceholder")}${Q.fieldName}`,clearable:"",ref_for:!0},l.unref(d)(Q),{disabled:Q.isFormDisabled}),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):l.createCommentVNode("",!0),Q.fieldType==="inputNumber"?(l.openBlock(),l.createBlock(l.unref(t),l.mergeProps({key:1,modelValue:y.value[Q.fieldKey],"onUpdate:modelValue":Y=>y.value[Q.fieldKey]=Y,placeholder:`${l.unref(o)("act.inputPlaceholder")}${Q.fieldName}`,clearable:"",ref_for:!0},l.unref(d)(Q),{disabled:Q.isFormDisabled}),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):Q.fieldType==="textarea"?(l.openBlock(),l.createBlock(X,l.mergeProps({key:2,modelValue:y.value[Q.fieldKey],"onUpdate:modelValue":Y=>y.value[Q.fieldKey]=Y,placeholder:`${l.unref(o)("act.inputPlaceholder")}${Q.fieldName}`,rows:4,ref_for:!0},l.unref(d)(Q),{type:"textarea",disabled:Q.isFormDisabled}),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):Q.fieldType==="selectIcon"?(l.openBlock(),l.createBlock(l.unref(n),l.mergeProps({key:3,modelValue:y.value[Q.fieldKey],"onUpdate:modelValue":Y=>y.value[Q.fieldKey]=Y,icons:Q.dataList,placeholder:`${l.unref(o)("act.selectPlaceholder")}${Q.fieldName}`,ref_for:!0},l.unref(d)(Q),{disabled:Q.isFormDisabled}),{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(Q.dataList,(Y,$e)=>(l.openBlock(),l.createBlock(J,{key:$e,label:Y.key,value:Y.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","icons","placeholder","disabled"])):["select","multipleSelect"].includes(Q.fieldType)?(l.openBlock(),l.createBlock(fe,l.mergeProps({key:4,modelValue:y.value[`${Q.fieldKey}ActImplicit`],"onUpdate:modelValue":Y=>y.value[`${Q.fieldKey}ActImplicit`]=Y,placeholder:`${l.unref(o)("act.selectPlaceholder")}${Q.fieldName}`,clearable:"",filterable:"","value-key":"value",ref_for:!0},l.unref(d)(Q),{multiple:Q.fieldType==="multipleSelect",disabled:Q.isFormDisabled,onChange:Y=>I(Y,Q)}),{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(Q.dataList,(Y,$e)=>(l.openBlock(),l.createBlock(J,{key:$e,label:Y.key,value:Y},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","multiple","disabled","onChange"])):["virtualizedSelect","virtualizedMultipleSelect"].includes(Q.fieldType)?(l.openBlock(),l.createBlock(he,l.mergeProps({key:5,modelValue:y.value[Q.fieldKey],"onUpdate:modelValue":Y=>y.value[Q.fieldKey]=Y,options:Q.dataList,props:{...l.unref(Fu)},placeholder:`${l.unref(o)("act.selectPlaceholder")}${Q.fieldName}`,clearable:"",filterable:"",ref_for:!0},l.unref(d)(Q),{disabled:Q.isFormDisabled,multiple:Q.fieldType==="virtualizedMultipleSelect"}),null,16,["modelValue","onUpdate:modelValue","options","props","placeholder","disabled","multiple"])):Q.fieldType==="fullLoadTreeSelect"?(l.openBlock(),l.createBlock(ye,l.mergeProps({key:6,modelValue:y.value[Q.fieldKey],"onUpdate:modelValue":Y=>y.value[Q.fieldKey]=Y,data:Q.dataList,"default-expanded-keys":[y.value[Q.fieldKey]||null],placeholder:`请选择${Q.fieldName}`,props:{...l.unref(xr),...l.unref(d)(Q).treeProps||{}},"collapse-tags":"","collapse-tags-tooltip":"",multiple:"","show-checkbox":"",clearable:"",filterable:"",ref_for:!0},l.unref(d)(Q)),null,16,["modelValue","onUpdate:modelValue","data","default-expanded-keys","placeholder","props"])):Q.fieldType==="treeSelect"?(l.openBlock(),l.createBlock(ye,l.mergeProps({key:7,modelValue:y.value[Q.fieldKey],"onUpdate:modelValue":Y=>y.value[Q.fieldKey]=Y,placeholder:`请选择${Q.fieldName}`,props:{isLeaf:"isLeaf"},"render-after-expand":!1,"collapse-tags":"","collapse-tags-tooltip":"",multiple:"","show-checkbox":"",clearable:"",filterable:"",lazy:"",load:(Y,$e)=>P({node:Y,resolve:$e},Q),ref_for:!0},l.unref(d)(Q)),null,16,["modelValue","onUpdate:modelValue","placeholder","load"])):Q.fieldType==="date"?(l.openBlock(),l.createBlock(z,l.mergeProps({key:8,modelValue:y.value[Q.fieldKey],"onUpdate:modelValue":Y=>y.value[Q.fieldKey]=Y,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)(Q),{disabled:Q.isFormDisabled}),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):Q.fieldType==="dateRange"?(l.openBlock(),l.createBlock(z,l.mergeProps({key:9,modelValue:y.value[Q.fieldKey],"onUpdate:modelValue":Y=>y.value[Q.fieldKey]=Y,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)(Q),{disabled:Q.isFormDisabled}),null,16,["modelValue","onUpdate:modelValue","start-placeholder","end-placeholder","disabled"])):Q.fieldType==="provinceCascade"?(l.openBlock(),l.createBlock(D,l.mergeProps({key:10,modelValue:y.value[Q.fieldKey],"onUpdate:modelValue":Y=>y.value[Q.fieldKey]=Y,options:Q.dataList,props:l.unref(Uu),clearable:"",filterable:"",placeholder:`${l.unref(o)("act.selectPlaceholder")}${Q.fieldName}`,ref_for:!0},l.unref(d)(Q),{disabled:Q.isFormDisabled}),null,16,["modelValue","onUpdate:modelValue","options","props","placeholder","disabled"])):Q.fieldType==="switch"?(l.openBlock(),l.createBlock(V,l.mergeProps({key:11,modelValue:y.value[Q.fieldKey],"onUpdate:modelValue":Y=>y.value[Q.fieldKey]=Y,"active-value":!0,"inactive-value":!1,ref_for:!0},l.unref(d)(Q)),null,16,["modelValue","onUpdate:modelValue"])):Q.fieldType==="upload"?(l.openBlock(),l.createBlock(l.unref(s),l.mergeProps({key:12,class:"form-upload",modelValue:y.value[Q.fieldKey],"onUpdate:modelValue":Y=>y.value[Q.fieldKey]=Y,request:l.unref(a),ref_for:!0},l.unref(d)(Q)),null,16,["modelValue","onUpdate:modelValue","request"])):Q.fieldType==="editor"?(l.openBlock(),l.createBlock(l.unref(r),l.mergeProps({key:13,modelValue:y.value[Q.fieldKey],"onUpdate:modelValue":Y=>y.value[Q.fieldKey]=Y,disabled:Q.isFormDisabled,placeholder:`${l.unref(o)("act.inputPlaceholder")}${Q.fieldName}`,ref_for:!0},l.unref(d)(Q)),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"])),[[Wt,g.value]])]}),_:1},8,["model-value","title","width"])}}},[["__scopeId","data-v-4ca7d743"]])},Symbol.toStringTag,{value:"Module"})),WT="",Jy=["innerHTML"],e1={class:"dialog-footer"},t1=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}=Gt(),n=e,s=i,r=()=>({loading:!1});let o=l.reactive(r());l.watch(()=>s.visible,async(h,u)=>{h&&(o.loading=!0,o.loading=!1)});const a=h=>{c(),h()},c=()=>{n("update:visible",!1)};return(h,u)=>{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",e1,[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,Jy)]),_:1},8,["model-value","title"])}}},[["__scopeId","data-v-be1c5be6"]])},Symbol.toStringTag,{value:"Module"})),GT="",i1={class:"dialog-footer"},n1=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(()=>Hu)),n=l.defineAsyncComponent(()=>Promise.resolve().then(()=>WO)),s=rn.useRoute(),r=l.inject("apiPrefix"),o=l.inject("request"),a=e,c=i,h=l.computed(()=>s.params.key),u=()=>({btnLoading:!1});let f=l.reactive(u());const d=l.inject("createDefaultButtonItem"),m=l.inject("associationMenuList"),b=l.inject("conditionList")();let w=l.ref([]),g=l.ref(null),p=l.ref(d());const O=M=>o({url:`${r}/icons/getAllList`,method:"post",data:M}),C=async()=>{try{const{data:M}=await O({dynamicFilters:[{field:"type",operate:"Equal",value:"2"}]});w.value=M||[]}catch(M){console.error(M)}};l.watch(()=>c.visible,async(M,T)=>{if(M){await C();const I={...c.data};Object.keys(p.value).forEach(B=>{B=="submitFields"||B=="matchFields"?p.value[B]=[...I[B]||[]]:B=="isPromptVerificationSelectTable"?p.value[B]=I[B]??"1":p.value[B]=I[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},E=()=>{p.value.submitFields.push({matchType:"match",submitFieldMatchOrigin:"rowData",submitFieldName:"",matchFieldName:"",submitFieldType:""})},x=M=>{p.value.submitFields.splice(M,1)},k=()=>{p.value.matchFields.push({matchType:"default",matchFieldName:"",matchCondition:"",fieldValue:"",spliceCondition:""})},P=M=>{p.value.matchFields.splice(M,1),p.value.matchFields.length===1&&(p.value.matchFields[0].spliceCondition="")},N=(M,T)=>{M.submitFieldMatchOrigin=T==="match"?"rowData":""},_=M=>{A(),M()},A=()=>{p.value=Object.assign(p.value,d()),g.value.resetFields(),a("update:visible",!1)},S=M=>{M&&M.validate(T=>{if(T)try{f.btnLoading=!0,a("refresh",{...p.value,submitFields:[...p.value.submitFields],matchFields:[...p.value.matchFields]},()=>{A()}),f.btnLoading=!1}catch(I){console.error(I),f.btnLoading=!1}})};return(M,T)=>{const I=l.resolveComponent("el-input"),B=l.resolveComponent("el-form-item"),U=l.resolveComponent("el-col"),Z=l.resolveComponent("el-option"),K=l.resolveComponent("el-select"),X=l.resolveComponent("el-row"),J=l.resolveComponent("el-button"),fe=l.resolveComponent("el-divider"),he=l.resolveComponent("el-switch"),ye=l.resolveComponent("el-form"),z=l.resolveComponent("el-dialog"),D=l.resolveDirective("debounce");return l.openBlock(),l.createBlock(z,{"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",i1,[l.createVNode(J,{loading:l.unref(f).btnLoading,onClick:A},{default:l.withCtx(()=>T[19]||(T[19]=[l.createTextVNode("取消")])),_:1},8,["loading"]),l.withDirectives((l.openBlock(),l.createBlock(J,{type:"primary",loading:l.unref(f).btnLoading,onClick:T[16]||(T[16]=V=>S(l.unref(g)))},{default:l.withCtx(()=>T[20]||(T[20]=[l.createTextVNode("保存")])),_:1},8,["loading"])),[[D]])])]),default:l.withCtx(()=>[l.createVNode(ye,{ref_key:"formRef",ref:g,model:l.unref(p),"label-suffix":":","label-position":"top"},{default:l.withCtx(()=>[l.createVNode(X,{gutter:24},{default:l.withCtx(()=>[l.createVNode(U,{span:6},{default:l.withCtx(()=>[l.createVNode(B,{label:"按钮",prop:"btnName"},{default:l.withCtx(()=>[l.createVNode(I,{modelValue:l.unref(p).btnName,"onUpdate:modelValue":T[0]||(T[0]=V=>l.unref(p).btnName=V),disabled:"",placeholder:"请输入按钮名称"},{prepend:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(p).permissionCode),1)]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(U,{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":T[1]||(T[1]=V=>l.unref(p).btnIcon=V),icons:l.unref(w),props:{value:"name",type:"btn"}},null,8,["modelValue","icons"])]),_:1})]),_:1}),l.createVNode(U,{span:24},{default:l.withCtx(()=>[l.createVNode(B,{label:"接口地址",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"requestUrl"},{default:l.withCtx(()=>[l.createVNode(I,{modelValue:l.unref(p).requestUrl,"onUpdate:modelValue":T[2]||(T[2]=V=>l.unref(p).requestUrl=V),placeholder:"请输入接口地址",clearable:""},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(U,{span:12},{default:l.withCtx(()=>[l.createVNode(B,{label:"按钮位置",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"btnPostion"},{default:l.withCtx(()=>[l.createVNode(K,{modelValue:l.unref(p).btnPostion,"onUpdate:modelValue":T[3]||(T[3]=V=>l.unref(p).btnPostion=V),placeholder:"请选择按钮位置",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(dy),(V,q)=>(l.openBlock(),l.createBlock(Z,{key:q,label:V.key,value:V.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(U,{span:12},{default:l.withCtx(()=>[l.createVNode(B,{label:"按钮类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"btnType"},{default:l.withCtx(()=>[l.createVNode(K,{modelValue:l.unref(p).btnType,"onUpdate:modelValue":T[4]||(T[4]=V=>l.unref(p).btnType=V),placeholder:"请选择按钮类型",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(fy),(V,q)=>(l.openBlock(),l.createBlock(Z,{key:q,label:V.key,value:V.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(U,{span:12},{default:l.withCtx(()=>[l.createVNode(B,{label:"按钮别名",prop:"btnAlias"},{default:l.withCtx(()=>[l.createVNode(I,{modelValue:l.unref(p).btnAlias,"onUpdate:modelValue":T[5]||(T[5]=V=>l.unref(p).btnAlias=V),placeholder:"请输入按钮别名",clearable:""},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(U,{span:12},{default:l.withCtx(()=>[l.createVNode(B,{label:"按钮颜色",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"btnColor"},{default:l.withCtx(()=>[l.createVNode(K,{modelValue:l.unref(p).btnColor,"onUpdate:modelValue":T[6]||(T[6]=V=>l.unref(p).btnColor=V),placeholder:"请选择按钮颜色",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(py),(V,q)=>(l.openBlock(),l.createBlock(Z,{key:q,label:V.key,value:V.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),!l.unref(p).isCustomBtn&&l.unref(p).permissionCode!="1001"?(l.openBlock(),l.createBlock(U,{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(K,{modelValue:l.unref(p).submitWay,"onUpdate:modelValue":T[7]||(T[7]=V=>l.unref(p).submitWay=V),placeholder:"请选择提交方式",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(my),(V,q)=>(l.openBlock(),l.createBlock(Z,{key:q,label:V.key,value:V.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(U,{key:1,span:12},{default:l.withCtx(()=>[l.createVNode(B,{label:"导入提交文件字段",rules:[{required:!1,message:"必填项",trigger:"blur"}],prop:"importFileName"},{default:l.withCtx(()=>[l.createVNode(I,{modelValue:l.unref(p).importFileName,"onUpdate:modelValue":T[8]||(T[8]=V=>l.unref(p).importFileName=V),placeholder:"请输入导入提交文件字段",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(U,{key:2,span:12},{default:l.withCtx(()=>[l.createVNode(B,{label:"是否提示校验选择表格",rules:[{required:!1,message:"必填项",trigger:"change"}],prop:"isPromptVerificationSelectTable"},{default:l.withCtx(()=>[l.createVNode(K,{modelValue:l.unref(p).isPromptVerificationSelectTable,"onUpdate:modelValue":T[9]||(T[9]=V=>l.unref(p).isPromptVerificationSelectTable=V),placeholder:"请选择",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Py),(V,q)=>(l.openBlock(),l.createBlock(Z,{key:q,label:V.key,value:V.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})):l.createCommentVNode("",!0)]),_:1}),l.createVNode(fe,{"content-position":"left"},{default:l.withCtx(()=>[T[17]||(T[17]=l.createTextVNode(" 提交字段配置 ")),l.createVNode(J,{class:"add-icon-btn",type:"primary",icon:"Plus",circle:"",onClick:E})]),_:1}),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(p).submitFields,(V,q)=>(l.openBlock(),l.createBlock(X,{gutter:24,key:q},{default:l.withCtx(()=>[l.createVNode(U,{span:6},{default:l.withCtx(()=>[l.createVNode(B,{label:"提交字段名",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"submitFields."+q+".submitFieldName"},{default:l.withCtx(()=>[l.createVNode(I,{modelValue:V.submitFieldName,"onUpdate:modelValue":H=>V.submitFieldName=H,placeholder:"请输入提交字段名",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(U,{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(I,{placeholder:"请输入",modelValue:V.matchFieldName,"onUpdate:modelValue":H=>V.matchFieldName=H,clearable:""},{prepend:l.withCtx(()=>[l.createVNode(K,{modelValue:V.matchType,"onUpdate:modelValue":H=>V.matchType=H,placeholder:"请选择",style:{width:"120px"},onChange:H=>N(V,H)},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(_y),(H,Ue)=>(l.openBlock(),l.createBlock(Z,{key:Ue,label:H.key,value:H.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),V.matchType==="match"?(l.openBlock(),l.createBlock(U,{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(I,{modelValue:V.submitFieldMatchOrigin,"onUpdate:modelValue":H=>V.submitFieldMatchOrigin=H,placeholder:"请输入匹配源",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024)):l.createCommentVNode("",!0),l.createVNode(U,{span:4},{default:l.withCtx(()=>[l.createVNode(B,{label:"提交类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"submitFields."+q+".submitFieldType"},{default:l.withCtx(()=>[l.createVNode(K,{modelValue:V.submitFieldType,"onUpdate:modelValue":H=>V.submitFieldType=H,placeholder:"请选择提交类型",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(gy),(H,Ue)=>(l.openBlock(),l.createBlock(Z,{key:Ue,label:H.key,value:H.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(U,{class:"submit-operate",span:1},{default:l.withCtx(()=>[l.createVNode(J,{class:"match-opreate",type:"danger",icon:"Minus",circle:"",onClick:H=>x(q)},null,8,["onClick"])]),_:2},1024)]),_:2},1024))),128)),l.createVNode(fe,{"content-position":"left"},{default:l.withCtx(()=>[T[18]||(T[18]=l.createTextVNode(" 匹配字段配置(表格操作列按钮显示/隐藏) ")),l.createVNode(J,{class:"add-icon-btn",type:"primary",icon:"Plus",circle:"",onClick:k})]),_:1}),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(p).matchFields,(V,q)=>(l.openBlock(),l.createBlock(X,{gutter:24,key:q},{default:l.withCtx(()=>[l.createVNode(U,{span:10},{default:l.withCtx(()=>[l.createVNode(B,{label:"匹配字段名",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"matchFields."+q+".matchFieldName"},{default:l.withCtx(()=>[l.createVNode(I,{placeholder:"请输入",modelValue:V.matchFieldName,"onUpdate:modelValue":H=>V.matchFieldName=H,clearable:""},{prepend:l.withCtx(()=>[l.createVNode(K,{modelValue:V.matchType,"onUpdate:modelValue":H=>V.matchType=H,placeholder:"请选择",style:{width:"180px"}},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(by),(H,Ue)=>(l.openBlock(),l.createBlock(Z,{key:Ue,label:H.key,value:H.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(U,{span:6},{default:l.withCtx(()=>[l.createVNode(B,{label:"匹配条件",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"matchFields."+q+".matchCondition"},{default:l.withCtx(()=>[l.createVNode(K,{modelValue:V.matchCondition,"onUpdate:modelValue":H=>V.matchCondition=H,placeholder:"请选择匹配条件",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(b),(H,Ue)=>(l.openBlock(),l.createBlock(Z,{key:Ue,label:H.key,value:H.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(U,{span:6},{default:l.withCtx(()=>[l.createVNode(B,{label:"字段值",prop:"matchFields."+q+".fieldValue"},{default:l.withCtx(()=>[l.createVNode(I,{modelValue:V.fieldValue,"onUpdate:modelValue":H=>V.fieldValue=H,placeholder:"请输入字段值",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(U,{class:"submit-operate",span:2},{default:l.withCtx(()=>[l.createVNode(J,{class:"match-opreate",type:"danger",icon:"Minus",circle:"",onClick:H=>P(q)},null,8,["onClick"])]),_:2},1024),q+1!==l.unref(p).matchFields.length?(l.openBlock(),l.createBlock(U,{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(K,{modelValue:V.spliceCondition,"onUpdate:modelValue":H=>V.spliceCondition=H,placeholder:"请选择拼接条件",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Oy),(H,Ue)=>(l.openBlock(),l.createBlock(Z,{key:Ue,label:H.key,value:H.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024)):l.createCommentVNode("",!0)]),_:2},1024))),128)),l.createVNode(X,{gutter:24},{default:l.withCtx(()=>[l.createVNode(U,{span:4},{default:l.withCtx(()=>[l.createVNode(B,{label:"自定义按钮",prop:"isCustomBtn"},{default:l.withCtx(()=>[l.createVNode(he,{modelValue:l.unref(p).isCustomBtn,"onUpdate:modelValue":T[10]||(T[10]=V=>l.unref(p).isCustomBtn=V),onChange:y},null,8,["modelValue"])]),_:1})]),_:1}),l.unref(p).isCustomBtn?(l.openBlock(),l.createBlock(U,{key:0,span:6},{default:l.withCtx(()=>[l.createVNode(B,{label:"自定义类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"customType"},{default:l.withCtx(()=>[l.createVNode(K,{modelValue:l.unref(p).customType,"onUpdate:modelValue":T[11]||(T[11]=V=>l.unref(p).customType=V),placeholder:"请选择关联菜单",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(yy),(V,q)=>(l.openBlock(),l.createBlock(Z,{key:q,label:V.key,value:V.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})):l.createCommentVNode("",!0),l.createVNode(U,{span:6},{default:l.withCtx(()=>[l.createVNode(B,{label:"关联菜单"},{default:l.withCtx(()=>[l.createVNode(K,{modelValue:l.unref(p).associationMenuId,"onUpdate:modelValue":T[12]||(T[12]=V=>l.unref(p).associationMenuId=V),placeholder:"请选择关联菜单",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(m),(V,q)=>(l.openBlock(),l.createBlock(Z,{key:q,label:V.name,value:V.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),l.unref(p).customType==="code"?(l.openBlock(),l.createBlock(X,{key:0,gutter:24},{default:l.withCtx(()=>[l.createVNode(U,{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":T[13]||(T[13]=V=>l.unref(p).codeStr=V)},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})):l.createCommentVNode("",!0),l.unref(p).customType==="component"?(l.openBlock(),l.createBlock(X,{key:1,gutter:24},{default:l.withCtx(()=>[l.createVNode(U,{span:10},{default:l.withCtx(()=>[l.createVNode(B,{label:"组件名称",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"customComponentName"},{default:l.withCtx(()=>[l.createVNode(I,{modelValue:l.unref(p).customComponentName,"onUpdate:modelValue":T[14]||(T[14]=V=>l.unref(p).customComponentName=V),placeholder:"请输入组件名称",clearable:""},{prepend:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(h.value),1)]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(U,{span:14},{default:l.withCtx(()=>[l.createVNode(B,{label:"组件地址",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"customComponentUrl"},{default:l.withCtx(()=>[l.createVNode(I,{modelValue:l.unref(p).customComponentUrl,"onUpdate:modelValue":T[15]||(T[15]=V=>l.unref(p).customComponentUrl=V),placeholder:"请输入组件地址",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})):l.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["model-value","title"])}}},[["__scopeId","data-v-325d2233"]])},Symbol.toStringTag,{value:"Module"})),JT="",s1={slot:"prepend"},r1={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(()=>hT)),n=e,s=i,r=l.inject("pageKey")(),o=l.inject("conditionList")(),a=l.inject("configData")(),c=()=>({btnLoading:!1,showSiteComponentsParamsDialog:!1});let h=l.reactive(c());const u=()=>({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,tableQueryDefaultValue:void 0,tableCellWidthType:"min",tableCellWidth:"120",tableCellAlignType:"center",tableCellContentType:"default",isTableCellOverflowTooltip:!0,isTableCellSort:!0}),f=Wu,d=l.ref(null),m=l.ref(u()),b=()=>["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(A=>A==_));l.watch(()=>s.visible,async(_,A)=>{if(_){const S=(a.value.buttons||[]).filter(T=>T.permissionCode!=1001).map(T=>({key:T.btnName,value:T.permissionCode}));f.some(T=>{if(T.label==="表单配置")return T.options=S,!0});const{data:M}=s;if(!M.fieldName)return;Object.keys(m.value).forEach(T=>{if(T=="permissionCode")m.value[T]=M.unique;else if(T=="formCustomComponentes"){const I=M.useScenes.map(B=>M[T].find(Z=>Z.permissionCode==B)||{});m.value[T]=[...I]}else["postRequestParams","useScenes"].includes(T)?m.value[T]=[...M[T]||[]]:m.value[T]=M[T]})}});const O=()=>{m.value.postRequestParams.push({submitName:"",submitValue:"",submitType:"default",submitMatchType:"",paramsType:""})},C=_=>{m.value.postRequestParams.splice(_,1)},y=_=>{m.value.postRequestParams=[]},E=_=>{const A=f.find(M=>M.label==="表格配置").options,S=f.find(M=>M.label==="表单配置").options;m.value.formCustomComponentes=[...A,...S].filter(M=>_.includes(M.value)).map(M=>{const T=m.value.formCustomComponentes.find(I=>I.permissionCode==M.value);return{btnName:M.key,permissionCode:M.value,pageKey:r,customComponentName:(T==null?void 0:T.customComponentName)||void 0,customComponentUrl:(T==null?void 0:T.customComponentUrl)||void 0,isFieldCustom:(T==null?void 0:T.isFieldCustom)||!1}})},x=(_,A)=>{A.customComponentName=void 0,A.customComponentUrl=void 0},k=_=>{P(),_()},P=()=>{m.value=u(),d.value.resetFields(),n("update:visible",!1)},N=_=>{_&&_.validate(A=>{A&&(h.btnLoading=!0,m.value.formCustomComponentes.forEach(S=>{delete S.isFiledCustom}),n("refresh",JSON.parse(JSON.stringify(m.value)),()=>{P()}),h.btnLoading=!1)})};return(_,A)=>{const S=l.resolveComponent("el-input"),M=l.resolveComponent("el-form-item"),T=l.resolveComponent("el-col"),I=l.resolveComponent("el-option"),B=l.resolveComponent("el-select"),U=l.resolveComponent("el-button"),Z=l.resolveComponent("el-row"),K=l.resolveComponent("el-divider"),X=l.resolveComponent("el-option-group"),J=l.resolveComponent("el-switch"),fe=l.resolveComponent("el-input-number"),he=l.resolveComponent("el-form"),ye=l.resolveComponent("el-scrollbar"),z=l.resolveComponent("el-dialog"),D=l.resolveDirective("debounce");return l.openBlock(),l.createBlock(z,{"model-value":s.visible,title:s.title,top:"5vh",width:"1400",draggable:"",overflow:"","close-on-click-modal":!1,"before-close":k},{footer:l.withCtx(()=>[l.createElementVNode("span",r1,[l.createVNode(U,{onClick:P,loading:l.unref(h).btnLoading},{default:l.withCtx(()=>A[29]||(A[29]=[l.createTextVNode("取消")])),_:1},8,["loading"]),l.withDirectives((l.openBlock(),l.createBlock(U,{type:"primary",loading:l.unref(h).btnLoading,onClick:A[22]||(A[22]=V=>N(d.value))},{default:l.withCtx(()=>A[30]||(A[30]=[l.createTextVNode("保存")])),_:1},8,["loading"])),[[D]])])]),default:l.withCtx(()=>[l.createVNode(ye,{ref:"configFieldsScroll","max-height":"800px"},{default:l.withCtx(()=>[l.createVNode(he,{ref_key:"formRef",ref:d,model:m.value,"label-suffix":":","label-width":"120px"},{default:l.withCtx(()=>[l.createVNode(Z,null,{default:l.withCtx(()=>[l.createVNode(T,{span:6},{default:l.withCtx(()=>[l.createVNode(M,{label:"字段名称",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"fieldName"},{default:l.withCtx(()=>[l.createVNode(S,{modelValue:m.value.fieldName,"onUpdate:modelValue":A[0]||(A[0]=V=>m.value.fieldName=V),placeholder:"请输入",clearable:""},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(T,{span:6},{default:l.withCtx(()=>[l.createVNode(M,{label:"字段key",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"fieldKey"},{default:l.withCtx(()=>[l.createVNode(S,{modelValue:m.value.fieldKey,"onUpdate:modelValue":A[1]||(A[1]=V=>m.value.fieldKey=V),placeholder:"请输入",clearable:""},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(T,{span:6},{default:l.withCtx(()=>[l.createVNode(M,{label:"字段类型",rules:[{required:!0,message:"必填项",trigger:["change"]}],prop:"fieldType"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.fieldType,"onUpdate:modelValue":A[2]||(A[2]=V=>m.value.fieldType=V),placeholder:"请选择",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(qu),V=>(l.openBlock(),l.createBlock(I,{key:V.value,label:V.key,value:V.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(T,{span:4},{default:l.withCtx(()=>[l.createVNode(M,{label:"组件参数",rules:[{required:!1,message:"必填项",trigger:["change"]}],prop:"fieldType"},{default:l.withCtx(()=>[l.createVNode(U,{type:"primary",onClick:A[3]||(A[3]=V=>l.unref(h).showSiteComponentsParamsDialog=!0)},{default:l.withCtx(()=>A[23]||(A[23]=[l.createTextVNode("设置props")])),_:1}),l.createVNode(l.unref(t),{modelValue:m.value.fieldUiProps,"onUpdate:modelValue":A[4]||(A[4]=V=>m.value.fieldUiProps=V),visible:l.unref(h).showSiteComponentsParamsDialog,"onUpdate:visible":A[5]||(A[5]=V=>l.unref(h).showSiteComponentsParamsDialog=V),title:"设置组件参数"},null,8,["modelValue","visible"])]),_:1})]),_:1})]),_:1}),b()?(l.openBlock(),l.createBlock(Z,{key:0},{default:l.withCtx(()=>[l.createVNode(T,{span:24},{default:l.withCtx(()=>[l.createVNode(M,{label:"数据源",prop:"fieldRequestUrl"},{default:l.withCtx(()=>[l.createVNode(S,{placeholder:"请输入",modelValue:m.value.fieldRequestUrl,"onUpdate:modelValue":A[7]||(A[7]=V=>m.value.fieldRequestUrl=V),clearable:""},{prepend:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.fieldRequestType,"onUpdate:modelValue":A[6]||(A[6]=V=>m.value.fieldRequestType=V),placeholder:"请选择",style:{width:"150px"},onChange:y},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(wy),V=>(l.openBlock(),l.createBlock(I,{key:V.value,label:V.key,value:V.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(K,{"content-position":"left"},{default:l.withCtx(()=>[A[24]||(A[24]=l.createTextVNode(" POST参数配置 ")),l.createVNode(U,{class:"add-icon-btn",type:"primary",icon:"Plus",circle:"",onClick:O})]),_:1}),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(m.value.postRequestParams,(V,q)=>(l.openBlock(),l.createBlock(Z,{key:q},{default:l.withCtx(()=>[l.createVNode(T,{span:5},{default:l.withCtx(()=>[l.createVNode(M,{label:"提交字段名",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"postRequestParams."+q+".submitName"},{default:l.withCtx(()=>[l.createVNode(S,{modelValue:V.submitName,"onUpdate:modelValue":H=>V.submitName=H,placeholder:"请输入提交字段名",clearable:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(T,{span:8},{default:l.withCtx(()=>[l.createVNode(M,{label:"方式",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"postRequestParams."+q+".submitValue"},{default:l.withCtx(()=>[l.createVNode(S,{placeholder:"请输入值",modelValue:V.submitValue,"onUpdate:modelValue":H=>V.submitValue=H,clearable:""},{prepend:l.withCtx(()=>[l.createVNode(B,{modelValue:V.submitType,"onUpdate:modelValue":H=>V.submitType=H,placeholder:"请选择方式",style:{width:"120px"}},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(ky),(H,Ue)=>(l.openBlock(),l.createBlock(I,{key:Ue,label:H.key,value:H.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),V.submitType==="dynamic"?(l.openBlock(),l.createBlock(T,{key:0,span:5},{default:l.withCtx(()=>[l.createVNode(M,{label:"匹配条件",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"postRequestParams."+q+".submitMatchType"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:V.submitMatchType,"onUpdate:modelValue":H=>V.submitMatchType=H,placeholder:"请选择方式",clearable:"",filterable:"",style:{width:"120px"}},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(o),(H,Ue)=>(l.openBlock(),l.createBlock(I,{key:Ue,label:H.key,value:H.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024)):l.createCommentVNode("",!0),l.createVNode(T,{span:5},{default:l.withCtx(()=>[l.createVNode(M,{label:"提交类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"postRequestParams."+q+".paramsType"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:V.paramsType,"onUpdate:modelValue":H=>V.paramsType=H,placeholder:"请选择",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Xu),(H,Ue)=>(l.openBlock(),l.createBlock(I,{key:Ue,label:H.key,value:H.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),l.createVNode(T,{class:"submit-operate",span:1},{default:l.withCtx(()=>[l.createVNode(U,{class:"match-opreate",type:"danger",icon:"Minus",circle:"",onClick:H=>C(q)},null,8,["onClick"])]),_:2},1024)]),_:2},1024))),128))],64)):l.createCommentVNode("",!0),l.createVNode(Z,null,{default:l.withCtx(()=>[l.createVNode(T,{span:24},{default:l.withCtx(()=>[l.createVNode(M,{label:"使用场景",rules:[{required:!1,message:"必填项",trigger:["change"]}],prop:"useScenes"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.useScenes,"onUpdate:modelValue":A[8]||(A[8]=V=>m.value.useScenes=V),placeholder:"请选择",multiple:"",clearable:"",filterable:"",onChange:E},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(f),V=>(l.openBlock(),l.createBlock(X,{key:V.label,label:V.label},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(V.options,q=>(l.openBlock(),l.createBlock(I,{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(Z,{key:2},{default:l.withCtx(()=>[l.createVNode(K,{"content-position":"left"},{default:l.withCtx(()=>A[25]||(A[25]=[l.createTextVNode("查询模块")])),_:1}),l.createVNode(T,{span:6},{default:l.withCtx(()=>[l.createVNode(M,{label:"查询条件",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"tableQueryCondition"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.tableQueryCondition,"onUpdate:modelValue":A[9]||(A[9]=V=>m.value.tableQueryCondition=V),placeholder:"请选择查询条件",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(o),(V,q)=>(l.openBlock(),l.createBlock(I,{key:q,label:V.key,value:V.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(T,{span:6},{default:l.withCtx(()=>[l.createVNode(M,{label:"默认值",rules:[{required:!1,message:"必填项",trigger:"blur"}],prop:"tableQueryDefaultValue"},{default:l.withCtx(()=>[l.createVNode(S,{modelValue:m.value.tableQueryDefaultValue,"onUpdate:modelValue":A[10]||(A[10]=V=>m.value.tableQueryDefaultValue=V),placeholder:"请输入",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})):l.createCommentVNode("",!0),g()?(l.openBlock(),l.createBlock(Z,{key:3},{default:l.withCtx(()=>[l.createVNode(K,{"content-position":"left"},{default:l.withCtx(()=>A[26]||(A[26]=[l.createTextVNode("表格模块")])),_:1}),l.createVNode(T,{span:6},{default:l.withCtx(()=>[l.createVNode(M,{label:"列宽",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:"tableCellWidth"},{default:l.withCtx(()=>[l.createVNode(S,{placeholder:"请输入",modelValue:m.value.tableCellWidth,"onUpdate:modelValue":A[12]||(A[12]=V=>m.value.tableCellWidth=V)},{prepend:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.tableCellWidthType,"onUpdate:modelValue":A[11]||(A[11]=V=>m.value.tableCellWidthType=V),placeholder:"请选择",style:{width:"100px"}},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Ay),(V,q)=>(l.openBlock(),l.createBlock(I,{key:q,label:V.key,value:V.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(T,{span:6},{default:l.withCtx(()=>[l.createVNode(M,{label:"对齐方式",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"tableCellAlignType"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.tableCellAlignType,"onUpdate:modelValue":A[13]||(A[13]=V=>m.value.tableCellAlignType=V),placeholder:"请选择对齐方式",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Sy),(V,q)=>(l.openBlock(),l.createBlock(I,{key:q,label:V.key,value:V.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(T,{span:6},{default:l.withCtx(()=>[l.createVNode(M,{label:"内容类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"tableCellContentType"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.tableCellContentType,"onUpdate:modelValue":A[14]||(A[14]=V=>m.value.tableCellContentType=V),placeholder:"请选择内容类型",clearable:"",filterable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(Cy),(V,q)=>(l.openBlock(),l.createBlock(I,{key:q,label:V.key,value:V.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(T,{span:2},{default:l.withCtx(()=>[l.createVNode(M,{label:"溢出隐藏",prop:"isTableCellOverflowTooltip"},{default:l.withCtx(()=>[l.createVNode(J,{modelValue:m.value.isTableCellOverflowTooltip,"onUpdate:modelValue":A[15]||(A[15]=V=>m.value.isTableCellOverflowTooltip=V)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(T,{span:2},{default:l.withCtx(()=>[l.createVNode(M,{label:"排序",prop:"isTableCellSort"},{default:l.withCtx(()=>[l.createVNode(J,{modelValue:m.value.isTableCellSort,"onUpdate:modelValue":A[16]||(A[16]=V=>m.value.isTableCellSort=V)},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})):l.createCommentVNode("",!0),p()?(l.openBlock(),l.createBlock(Z,{key:4},{default:l.withCtx(()=>[l.createVNode(K,{"content-position":"left"},{default:l.withCtx(()=>A[27]||(A[27]=[l.createTextVNode("表单模块")])),_:1}),l.createVNode(T,{span:3},{default:l.withCtx(()=>[l.createVNode(M,{label:"是否必填",prop:"isFormFieldRequired"},{default:l.withCtx(()=>[l.createVNode(J,{modelValue:m.value.isFormFieldRequired,"onUpdate:modelValue":A[17]||(A[17]=V=>m.value.isFormFieldRequired=V)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(T,{span:3},{default:l.withCtx(()=>[l.createVNode(M,{label:"是否回显",prop:"isFormSetValue"},{default:l.withCtx(()=>[l.createVNode(J,{modelValue:m.value.isFormSetValue,"onUpdate:modelValue":A[18]||(A[18]=V=>m.value.isFormSetValue=V)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(T,{span:3},{default:l.withCtx(()=>[l.createVNode(M,{label:"是否禁用",prop:"isFormDisabled"},{default:l.withCtx(()=>[l.createVNode(J,{modelValue:m.value.isFormDisabled,"onUpdate:modelValue":A[19]||(A[19]=V=>m.value.isFormDisabled=V)},null,8,["modelValue"])]),_:1})]),_:1}),l.createVNode(T,{span:6},{default:l.withCtx(()=>[l.createVNode(M,{label:"提交类型",rules:[{required:!0,message:"必填项",trigger:"change"}],prop:"fieldSubmitType"},{default:l.withCtx(()=>[l.createVNode(B,{modelValue:m.value.fieldSubmitType,"onUpdate:modelValue":A[20]||(A[20]=V=>m.value.fieldSubmitType=V),placeholder:"请选择提交类型",filterable:"",clearable:""},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(xy),(V,q)=>(l.openBlock(),l.createBlock(I,{key:q,label:V.key,value:V.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l.createVNode(T,{span:6},{default:l.withCtx(()=>[l.createVNode(M,{label:"栅格数",prop:"formColumnCol"},{default:l.withCtx(()=>[l.createVNode(fe,{modelValue:m.value.formColumnCol,"onUpdate:modelValue":A[21]||(A[21]=V=>m.value.formColumnCol=V),max:24},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})):l.createCommentVNode("",!0),l.createVNode(K,{"content-position":"left"},{default:l.withCtx(()=>A[28]||(A[28]=[l.createTextVNode("不同场景自定义字段组件")])),_:1}),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(m.value.formCustomComponentes,(V,q)=>(l.openBlock(),l.createBlock(Z,{key:q},{default:l.withCtx(()=>[l.createVNode(T,{span:2},{default:l.withCtx(()=>[l.createVNode(M,{label:`${V.btnName}`,prop:`formCustomComponentes.${q}.isFieldCustom`},{default:l.withCtx(()=>[l.createVNode(J,{modelValue:V.isFieldCustom,"onUpdate:modelValue":H=>V.isFieldCustom=H,onChange:H=>x(H,V)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),_:2},1032,["label","prop"])]),_:2},1024),V.isFieldCustom?(l.openBlock(),l.createBlock(T,{key:0,span:8},{default:l.withCtx(()=>[l.createVNode(M,{label:"组件名称","label-width":"220",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:`formCustomComponentes.${q}.customComponentName`},{default:l.withCtx(()=>[l.createVNode(S,{modelValue:V.customComponentName,"onUpdate:modelValue":H=>V.customComponentName=H,placeholder:"请输入",clearable:""},{default:l.withCtx(()=>[l.createElementVNode("template",s1,[l.createTextVNode(l.toDisplayString(l.unref(r)),1)])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024)):l.createCommentVNode("",!0),V.isFieldCustom?(l.openBlock(),l.createBlock(T,{key:1,span:14},{default:l.withCtx(()=>[l.createVNode(M,{label:"组件地址",rules:[{required:!0,message:"必填项",trigger:"blur"}],prop:`formCustomComponentes.${q}.customComponentUrl`},{default:l.withCtx(()=>[l.createVNode(S,{modelValue:V.customComponentUrl,"onUpdate:modelValue":H=>V.customComponentUrl=H,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-6b2ebaa8"]])},Symbol.toStringTag,{value:"Module"})),Gu=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 h=l.resolveComponent("el-input");return l.openBlock(),l.createBlock(h,l.mergeProps({modelValue:s.value,"onUpdate:modelValue":c[0]||(c[0]=u=>s.value=u),modelModifiers:{number:!0},placeholder:"Please input"},a.$attrs,{onInput:o}),null,16,["modelValue"])}}}},Symbol.toStringTag,{value:"Module"})),nE="",sE="",l1={class:"select-icon-container"},a1={class:"icon-list"},c1=["onClick"],h1={class:"icon-value",slot:"reference"},Hu=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,(h,u)=>{h&&(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,(h,u)=>{if(!h){r.value=-1,t("update:modelValue","");return}const f=o.value.findIndex(d=>d===h);r.value=f},{deep:!0,immediate:!0});const c=(h,u)=>{r.value=u,t("update:modelValue",a()),s.value=!1};return(h,u)=>{const f=l.resolveComponent("a-svg-icon"),d=l.resolveComponent("el-button"),m=l.resolveComponent("el-popover");return l.openBlock(),l.createElementBlock("div",l1,[l.createVNode(m,{"popper-class":"select-icon-popover",placement:"bottom-start",visible:l.unref(s),"onUpdate:visible":u[0]||(u[0]=b=>l.isRef(s)?s.value=b:s=b),width:400,trigger:"click"},{reference:l.withCtx(()=>[l.createElementVNode("div",h1,[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(()=>u[1]||(u[1]=[l.createTextVNode("选择图标")])),_:1})])]),default:l.withCtx(()=>[l.createElementVNode("ul",a1,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(o),(b,w)=>(l.openBlock(),l.createElementBlock("li",{class:l.normalizeClass(["icon-item",{"icon-item-checked":l.unref(r)==w}]),key:w,onClick:g=>c(b,w)},[l.createVNode(f,{class:"icon-svg",name:b,width:"24",height:"24",color:"#999"},null,8,["name"])],10,c1))),128))])]),_:1},8,["visible"])])}}},[["__scopeId","data-v-308d02d4"]])},Symbol.toStringTag,{value:"Module"}));let Ar;const u1=new Uint8Array(16);function f1(){if(!Ar&&(Ar=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ar))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ar(u1)}const ht=[];for(let i=0;i<256;++i)ht.push((i+256).toString(16).slice(1));function d1(i,e=0){return ht[i[e+0]]+ht[i[e+1]]+ht[i[e+2]]+ht[i[e+3]]+"-"+ht[i[e+4]]+ht[i[e+5]]+"-"+ht[i[e+6]]+ht[i[e+7]]+"-"+ht[i[e+8]]+ht[i[e+9]]+"-"+ht[i[e+10]]+ht[i[e+11]]+ht[i[e+12]]+ht[i[e+13]]+ht[i[e+14]]+ht[i[e+15]]}const Ku={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function p1(i,e,t){if(Ku.randomUUID&&!e&&!i)return Ku.randomUUID();i=i||{};const n=i.random||(i.rng||f1)();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 d1(n)}const aE="",m1={class:"upload-container"},g1={class:"el-upload__text"},O1={class:"tip-text"},_1={class:"file-list-l"},b1=["onMouseenter","onMouseleave"],y1={class:"el-file-operate"},w1=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}=Iu(),{t:o}=Gt(),a=t,c=i,h={image:/(gif|jpg|jpeg|png|pdf|bmp|webp|GIF|JPG|PDF|PNG|JPEG)$/,word:/(doc|docx)$/,pdf:/(pdf)$/,excel:/(xls|xlsx)$/};let u=l.ref(!1),f=l.ref({}),d=l.ref(!1),m=l.ref(null),b=null,w=l.computed({get(){return C(c.modelValue)},set(T){a("update:modelValue",T)}});const g=T=>{const I=(w.value||[]).map(Z=>Z.filePath);if(T==0)return I;let B=I.splice(T),U=I.splice(0,T);return B.concat(U)},p=T=>{const I=T.substring(T.lastIndexOf(".")+1);let B=null;return Object.keys(h).some(U=>{if(h[U].test(I))return B=U,!0}),B===null&&(B="file"),B},O=T=>T.map(I=>({uid:I.uid??p1(),name:n(I),filePath:I,fileType:p(I),status:"success"})),C=T=>{const I=Array.isArray(T)?T.map(B=>B.filePath):T?T.split(";"):[];return O(I||[])},y=({name:T})=>{const I=T.lastIndexOf("."),B=T.slice(I),U=c.accept.trim().split(",");let Z=!1;return U.includes(B)&&(Z=!0),Z=U.some(K=>K=="image/*"?h.image.test(B):K.startsWith(".")?T.endsWith(K):K===B),Z||Ne.ElNotification({title:`${o("act.tip")}`,message:`【${T}】${o("act.uploadErrorTip")}`,type:"warning",duration:2500}),Z},E=(T,I,B)=>{b&&(clearTimeout(b),b=null),b=setTimeout(()=>{T.call(this,I)},B)},x=T=>c.request({url:c.action,method:"POST",data:T,headers:{"Content-Type":"application/x-www-form-urlencoded"}}),k=async T=>{try{const I=T.filter(X=>X.status=="ready"&&y(X)),B=w.value.length+I.length;if(I.length===0){m.value.clearFiles();return}if(B>c.limit){Ne.ElNotification({title:`${o("act.tip")}`,message:`${o("act.uploadLimitTip")}`,type:"warning",duration:2500}),m.value.clearFiles();return}if(!c.autoUpload){const X=I.map(J=>({...J,filePath:null,status:"success"}));a("update:modelValue",X),m.value.clearFiles();return}u.value=!0;const U=new FormData;Object.keys(c.data).forEach(X=>{U.append(X,c.data[X])}),I.forEach(X=>{U.append(c.name,X.raw)});let{data:Z}=await x(U);const K=c.multiple?[...w.value.map(X=>X.filePath),...Z.filePaths||[]].join(";"):[...Z.filePaths||[]].join(";");m.value.clearFiles(),a("update:modelValue",K),u.value=!1}catch(I){m.value.clearFiles(),u.value=!1,console.error(I)}},P=(T,I)=>{E(k,I,500)},N=(T,I)=>{const B=f.value[`tooltipRef${I}`];d.value=B.scrollWidth<=Math.round(B.getBoundingClientRect().width)},_=({filePath:T,name:I,uid:B},U)=>{l.nextTick(()=>{document.querySelector(`.previewImage_${B}`).children[0].click()})},A=({filePath:T,name:I})=>{r(c.request,T)},S=(T,I)=>{w.value=w.value.filter((B,U)=>U!==I),a("delete",{data:T})};return e({clearFiles:()=>{w.value=[],m.value.clearFiles()}}),(T,I)=>{const B=l.resolveComponent("upload-filled"),U=l.resolveComponent("el-icon"),Z=l.resolveComponent("el-upload"),K=l.resolveComponent("el-image"),X=l.resolveComponent("el-tooltip"),J=l.resolveComponent("el-button"),fe=l.resolveDirective("loading");return l.openBlock(),l.createElementBlock("div",m1,[l.withDirectives((l.openBlock(),l.createBlock(Z,l.mergeProps({ref_key:"uploadRef",ref:m,action:"#",drag:"",accept:c.accept,multiple:c.multiple,"auto-upload":!1,"show-file-list":!1,"on-change":P},T.$attrs,{"element-loading-text":l.unref(o)("act.uploadLoading")}),{tip:l.withCtx(()=>[c.tipText?l.renderSlot(T.$slots,"default",{key:0},()=>[l.createElementVNode("p",O1,l.toDisplayString(c.tipText),1)],!0):l.createCommentVNode("",!0)]),default:l.withCtx(()=>[l.createVNode(U,{class:"el-icon--upload"},{default:l.withCtx(()=>[l.createVNode(B)]),_:1}),l.createElementVNode("div",g1,[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"])),[[fe,l.unref(u)]]),l.renderSlot(T.$slots,"default",{},()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(w),(he,ye)=>(l.openBlock(),l.createElementBlock("div",{class:"file-list",key:he.uid},[l.createElementVNode("div",_1,[he.fileType==="image"?(l.openBlock(),l.createBlock(K,{key:0,class:l.normalizeClass(["file-list-image",{[`previewImage_${he.uid}`]:!0}]),fit:"cover","preview-src-list":g(ye),"preview-teleported":"",src:he.filePath},null,8,["class","preview-src-list","src"])):(l.openBlock(),l.createBlock(K,{key:1,class:"file-list-icon",src:l.unref(s)(`images/upload-${he.fileType}.png`)},null,8,["src"])),l.createVNode(X,{effect:"dark",content:he.name,placement:"bottom-start",disabled:l.unref(d)},{default:l.withCtx(()=>[l.createElementVNode("div",{class:"el-file-name",ref_for:!0,ref:z=>l.unref(f)[`tooltipRef${ye}`]=z,onMouseenter:z=>N(z,ye),onMouseleave:z=>N(z,ye)},l.toDisplayString(he.name),41,b1)]),_:2},1032,["content","disabled"])]),l.createElementVNode("div",y1,[he.fileType==="image"?(l.openBlock(),l.createBlock(J,{key:0,type:"primary",size:"small",icon:l.unref(oy),circle:"",onClick:z=>_(he)},null,8,["icon","onClick"])):l.createCommentVNode("",!0),l.createVNode(J,{type:"primary",size:"small",icon:l.unref(iy),circle:"",onClick:z=>A(he)},null,8,["icon","onClick"]),l.createVNode(J,{type:"danger",size:"small",icon:l.unref(ey),circle:"",onClick:z=>S(he,ye)},null,8,["icon","onClick"])])]))),128))],!0)])}}},[["__scopeId","data-v-f839bee6"]])},Symbol.toStringTag,{value:"Module"}));var k1=["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"],x1=function(i){return k1.map(function(e){return e.toLowerCase()}).indexOf(i.toLowerCase())!==-1},S1=function(i,e,t){Object.keys(e).filter(x1).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)}))})},C1=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}))})},A1=function(i,e,t,n,s,r){n.setContent(r()),t.attrs["onUpdate:modelValue"]&&C1(e,t,n,s),S1(i,t.attrs,n)},Ju=0,ef=function(i){var e=Date.now(),t=Math.floor(Math.random()*1e9);return Ju++,i+"_"+t+Ju+String(e)},Q1=function(i){return i!==null&&i.tagName.toLowerCase()==="textarea"},tf=function(i){return typeof i>"u"||i===""?[]:Array.isArray(i)?i:i.split(" ")},P1=function(i,e){return tf(i).concat(tf(e))},T1=function(i){return i==null},nf=function(){return{listeners:[],scriptId:ef("tiny-script"),scriptLoaded:!1}},E1=function(){var i=nf(),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 h=function(){c.removeEventListener("load",h),a()};c.addEventListener("load",h),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=nf()};return{load:t,reinitialize:n}},$1=E1(),N1=function(){return typeof window<"u"?window:global},hn=function(){var i=N1();return i&&i.tinymce?i.tinymce:null},R1={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,tinymceScriptSrc:String,outputFormat:{type:String,validator:function(i){return i==="html"||i==="text"}}},oi=globalThis&&globalThis.__assign||function(){return oi=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},oi.apply(this,arguments)},V1=function(i,e,t,n){return i(n||"div",{id:e,ref:t})},L1=function(i,e,t){return i("textarea",{id:e,visibility:"hidden",ref:t})},Ll={selector:void 0,target:void 0},M1=l.defineComponent({props:R1,setup:function(i,e){var t=i.init?oi(oi({},i.init),Ll):oi({},Ll),n=l.toRefs(i),s=n.disabled,r=n.modelValue,o=n.tagName,a=l.ref(null),c=null,h=i.id||ef("tiny-vue"),u=i.init&&i.init.inline||i.inline,f=!!e.attrs["onUpdate:modelValue"],d=!0,m=i.initialValue?i.initialValue:"",b="",w=function(O){return f?function(){return r!=null&&r.value?r.value:""}:function(){return O?m:b}},g=function(){var O=w(d),C=oi(oi({},t),{readonly:i.disabled,target:a.value,plugins:P1(t.plugins,i.plugins),toolbar:i.toolbar||t.toolbar,inline:u,license_key:i.licenseKey,setup:function(y){c=y,y.on("init",function(E){return A1(E,i,e,y,r,O)}),typeof t.setup=="function"&&t.setup(y)}});Q1(a.value)&&(a.value.style.visibility=""),hn().init(C),d=!1};l.watch(s,function(O){var C;c!==null&&(typeof((C=c.mode)===null||C===void 0?void 0:C.set)=="function"?c.mode.set(O?"readonly":"design"):c.setMode(O?"readonly":"design"))}),l.watch(o,function(O){var C;f||(b=c.getContent()),(C=hn())===null||C===void 0||C.remove(c),l.nextTick(function(){return g()})}),l.onMounted(function(){if(hn()!==null)g();else if(a.value&&a.value.ownerDocument){var O=i.cloudChannel?i.cloudChannel:"7",C=i.apiKey?i.apiKey:"no-api-key",y=T1(i.tinymceScriptSrc)?"https://cdn.tiny.cloud/1/".concat(C,"/tinymce/").concat(O,"/tinymce.min.js"):i.tinymceScriptSrc;$1.load(a.value.ownerDocument,y,g)}}),l.onBeforeUnmount(function(){hn()!==null&&hn().remove(c)}),u||(l.onActivated(function(){d||g()}),l.onDeactivated(function(){var O;f||(b=c.getContent()),(O=hn())===null||O===void 0||O.remove(c)}));var p=function(O){var C;b=c.getContent(),(C=hn())===null||C===void 0||C.remove(c),t=oi(oi(oi({},t),O),Ll),l.nextTick(function(){return g()})};return e.expose({rerender:p,getEditor:function(){return c}}),function(){return u?V1(l.h,h,a,i.tagName):L1(l.h,h,a)}}});const uE="",B1={style:{height:"100%",overflow:"hidden"}},D1=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,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(u,f){}});console.log(o);const a=l.computed({get(){return s.modelValue},set(u){n("update:modelValue",u)}});return l.watch(()=>a.value,()=>{n("setHtml",hr.activeEditor.getContent({format:"text"}),a.value)}),l.onMounted(()=>{hr.init({})}),e({onGetContent:()=>hr.activeEditor.getContent(),onSetContent:u=>{hr.activeEditor.setContent(u)}}),(u,f)=>(l.openBlock(),l.createElementBlock("div",B1,[l.createVNode(l.unref(M1),{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 Ml=[],sf=[];(()=>{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?sf:Ml).push(t=t+i[e])})();function v1(i){if(i<768)return!1;for(let e=0,t=Ml.length;;){let n=e+t>>1;if(i<Ml[n])t=n;else if(i>=sf[n])e=n+1;else return!0;if(e==t)return!1}}function rf(i){return i>=127462&&i<=127487}const of=8205;function Z1(i,e,t=!0,n=!0){return(t?lf:I1)(i,e,n)}function lf(i,e,t){if(e==i.length)return e;e&&af(i.charCodeAt(e))&&cf(i.charCodeAt(e-1))&&e--;let n=Bl(i,e);for(e+=hf(n);e<i.length;){let s=Bl(i,e);if(n==of||s==of||t&&v1(s))e+=hf(s),n=s;else if(rf(s)){let r=0,o=e-2;for(;o>=0&&rf(Bl(i,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function I1(i,e,t){for(;e>0;){let n=lf(i,e-2,t);if(n<e)return n;e--}return 0}function Bl(i,e){let t=i.charCodeAt(e);if(!cf(t)||e+1==i.length)return t;let n=i.charCodeAt(e+1);return af(n)?(t-55296<<10)+(n-56320)+65536:t}function af(i){return i>=56320&&i<57344}function cf(i){return i>=55296&&i<56320}function hf(i){return i<65536?1:2}class Ae{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]=Rn(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),li.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]=Rn(this,e,t);let n=[];return this.decompose(e,t,n,0),li.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 ff(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 df(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]?Ae.empty:e.length<=32?new ze(e):li.from(ze.split(e,[]))}}class ze extends Ae{constructor(e,t=U1(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 F1(s,a,n,o);s=a+1,n++}}decompose(e,t,n,s){let r=e<=0&&t>=this.length?this:new ze(uf(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]=Rn(this,e,t);let s=Qr(this.text,Qr(n.text,uf(this.text,0,e)),t),r=this.length+n.length-(t-e);return s.length<=32?new ze(s,r):li.from(ze.split(s,[]),r)}sliceString(e,t=this.length,n=`
|
|
22
22
|
`){[e,t]=Rn(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 li extends Ae{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 h=s&((o<=e?1:0)|(c>=t?2:0));o>=e&&c<=t&&!h?n.push(a):a.decompose(e-o,t-o,n,h)}o=c+1}}replace(e,t,n){if([e,t]=Rn(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),h=this.lines-o.lines+c.lines;if(c.lines<h>>5-1&&c.lines>h>>5+1){let u=this.children.slice();return u[s]=c,new li(u,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]=Rn(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 li))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],h=e.children[r];if(c!=h)return n+c.scanIdentical(h,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 b of e)b.flatten(m);return new ze(m,t)}let s=Math.max(32,n>>5),r=s<<1,o=s>>1,a=[],c=0,h=-1,u=[];function f(m){let b;if(m.lines>r&&m instanceof li)for(let w of m.children)f(w);else m.lines>o&&(c>o||!c)?(d(),a.push(m)):m instanceof ze&&c&&(b=u[u.length-1])instanceof ze&&m.lines+b.lines<=32?(c+=m.lines,h+=m.length+1,u[u.length-1]=new ze(b.text.concat(m.text),b.length+1+m.length)):(c+m.lines>s&&d(),c+=m.lines,h+=m.length+1,u.push(m))}function d(){c!=0&&(a.push(u.length==1?u[0]:li.from(u,h)),h=-1,c=u.length=0)}for(let m of e)f(m);return d(),a.length==1?a[0]:new li(a,t)}}Ae.empty=new ze([""],0);function U1(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 uf(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
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 ff{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 df{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"&&(Ae.prototype[Symbol.iterator]=function(){return this.iter()},ms.prototype[Symbol.iterator]=ff.prototype[Symbol.iterator]=df.prototype[Symbol.iterator]=function(){return this});class F1{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 Rn(i,e,t){return e=Math.max(0,Math.min(i.length,e)),[e,Math.max(e,Math.min(i.length,t))]}function ut(i,e,t=!0,n=!0){return Z1(i,e,t,n)}function j1(i){return i>=56320&&i<57344}function q1(i){return i>=55296&&i<56320}function Ct(i,e){let t=i.charCodeAt(e);if(!q1(t)||e+1==i.length)return t;let n=i.charCodeAt(e+1);return j1(n)?(t-55296<<10)+(n-56320)+65536:t}function Dl(i){return i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10)+55296,(i&1023)+56320))}function ai(i){return i<65536?1:2}const vl=/\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 ci{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 ci(e)}composeDesc(e){return this.empty?e:e.empty?this:pf(this,e)}mapDesc(e,t=!1){return e.empty?this:Il(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++],h=s+a;if(c<0){if(h>e)return r+(e-s);r+=a}else{if(n!=ft.Simple&&h>=e&&(n==ft.TrackDel&&s<e&&h>e||n==ft.TrackBefore&&s<e||n==ft.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!a)return e==s||t<0?r:r+c;r+=c}s=h}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 ci(e)}static create(e){return new ci(e)}}class it extends ci{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 Il(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(Ae.empty);n.push(o?e.slice(r,r+o):Ae.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:Il(this,e,t,!0)}iterChanges(e,t=!1){Zl(this,e,t)}get desc(){return ci.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 u=Math.min(r.len,c-a);gt(s,u,-1);let f=r.ins==-1?-1:r.off==0?r.ins:0;gt(t,u,f),f>0&&Fi(n,t,r.text),r.forward(u),a+=u}let h=e[o++];for(;a<h;){if(r.done)break e;let u=Math.min(r.len,h-a);gt(t,u,-1),gt(s,u,r.ins==-1?-1:r.off==0?r.ins:0),r.forward(u),a+=u}}return{changes:new it(t,n),filtered:ci.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(u=!1){if(!u&&!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 h(u){if(Array.isArray(u))for(let f of u)h(f);else if(u instanceof it){if(u.length!=t)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${t})`);c(),a=a?a.compose(u.map(a)):u}else{let{from:f,to:d=f,insert:m}=u;if(f>d||f<0||d>t)throw new RangeError(`Invalid change range ${f} to ${d} (in doc of length ${t})`);let b=m?typeof m=="string"?Ae.of(m.split(n||vl)):m:Ae.empty,w=b.length;if(f==d&&w==0)return;f<o&&c(),f>o&>(s,f-o,-1),gt(s,d-f,w),Fi(r,s,b),o=d}}return h(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(Ae.empty);n[s]=Ae.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 Fi(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(Ae.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 h=s,u=r,f=Ae.empty;for(;h+=a,u+=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,h,r,u,f),s=h,r=u}}}function Il(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 h=Math.min(o.len,a.len);gt(s,h,-1),o.forward(h),a.forward(h)}else if(a.ins>=0&&(o.ins<0||c==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!t))){let h=a.len;for(gt(s,a.ins,-1);h;){let u=Math.min(o.len,h);o.ins>=0&&c<o.i&&o.len<=u&&(gt(s,0,o.ins),r&&Fi(r,s,o.text),c=o.i),o.forward(u),h-=u}a.next()}else if(o.ins>=0){let h=0,u=o.len;for(;u;)if(a.ins==-1){let f=Math.min(u,a.len);h+=f,u-=f,a.forward(f)}else if(a.ins==0&&a.len<u)u-=a.len,a.next();else break;gt(s,h,c<o.i?o.ins:0),r&&c<o.i&&Fi(r,s,o.text),c=o.i,o.forward(o.len-u)}else{if(o.done&&a.done)return r?it.createSet(s,r):ci.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):ci.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&&Fi(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),h=n.length;if(r.ins==-1){let u=o.ins==-1?-1:o.off?0:o.ins;gt(n,c,u,a),s&&u&&Fi(s,n,o.text)}else o.ins==-1?(gt(n,r.off?0:r.len,c,a),s&&Fi(s,n,r.textBit(c))):(gt(n,r.off?0:r.len,o.off?0:o.ins,a),s&&!o.off&&Fi(s,n,o.text));a=(r.ins>c||o.ins>=0&&o.len>c)&&(a||n.length>h),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?Ae.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?Ae.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 un{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 un(n,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return j.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return j.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 j.range(e.anchor,e.head)}static create(e,t,n){return new un(e,t,n)}}class j{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:j.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 j([this.main],0)}addRange(e,t=!0){return j.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,j.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 j(e.ranges.map(t=>un.fromJSON(t)),e.main)}static single(e,t=e){return new j([j.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 j.normalized(e.slice(),t);n=r.to}return new j(e,t)}static cursor(e,t=0,n,s){return un.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?un.create(t,e,48|r):un.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?j.range(c,a):j.range(a,c))}}return new j(e,t)}}function mf(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:Fl),!!e.static,e.enables)}of(e){return new Pr([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Pr(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Pr(e,this,2,t)}from(e,t){return t||(t=n=>n),this.compute([e],n=>t(n.field(e)))}}function Fl(i,e){return i==e||i.length==e.length&&i.every((t,n)=>t===e[n])}class Pr{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,h=!1,u=[];for(let f of this.dependencies)f=="doc"?c=!0:f=="selection"?h=!0:((t=e[f.id])!==null&&t!==void 0?t:1)&1||u.push(e[f.id]);return{create(f){return f.values[o]=n(f),1},update(f,d){if(c&&d.docChanged||h&&(d.docChanged||d.selection)||jl(f,u)){let m=n(f);if(a?!gf(m,f.values[o],s):!s(m,f.values[o]))return f.values[o]=m,1}return 0},reconfigure:(f,d)=>{let m,b=d.config.address[r];if(b!=null){let w=$r(d,b);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?gf(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 gf(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 jl(i,e){let t=!1;for(let n of e)bs(i,n)&1&&(t=!0);return t}function X1(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 h=[];for(let u=0;u<n.length;u++){let f=$r(c,n[u]);if(s[u]==2)for(let d of f)h.push(d);else h.push(f)}return e.combine(h)}return{create(c){for(let h of n)bs(c,h);return c.values[o]=a(c),1},update(c,h){if(!jl(c,r))return 0;let u=a(c);return e.compare(u,c.values[o])?0:(c.values[o]=u,1)},reconfigure(c,h){let u=jl(c,n),f=h.config.facets[e.id],d=h.facet(e);if(f&&!u&&Fl(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 Tr=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(Tr).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(Tr),o=s.facet(Tr),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,Tr.of({field:this,create:e})]}get extension(){return this}}const fn={lowest:4,low:3,default:2,high:1,highest:0};function Os(i){return e=>new Of(e,i)}const ji={highest:Os(fn.highest),high:Os(fn.high),default:Os(fn.default),low:Os(fn.low),lowest:Os(fn.lowest)};class Of{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 Er{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 W1(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=[],h=[];for(let d of s)a[d.id]=h.length<<1,h.push(m=>d.slot(m));let u=n==null?void 0:n.config.facets;for(let d in r){let m=r[d],b=m[0].facet,w=u&&u[d]||[];if(m.every(g=>g.type==0))if(a[b.id]=c.length<<1|1,Fl(w,m))c.push(n.facet(b));else{let g=b.combine(m.map(p=>p.value));c.push(n&&b.compare(g,n.facet(b))?n.facet(b):g)}else{for(let g of m)g.type==0?(a[g.id]=c.length<<1|1,c.push(g.value)):(a[g.id]=h.length<<1,h.push(p=>g.dynamicSlot(p)));a[b.id]=h.length<<1,h.push(g=>X1(g,b,m))}}let f=h.map(d=>d(a));return new Er(e,o,f,a,c,r)}}function W1(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 h=n[c].indexOf(o);h>-1&&n[c].splice(h,1),o instanceof ql&&t.delete(o.compartment)}if(s.set(o,a),Array.isArray(o))for(let h of o)r(h,a);else if(o instanceof ql){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),r(h,a)}else if(o instanceof Of)r(o.inner,o.prec);else if(o instanceof rt)n[a].push(o),o.provides&&r(o.provides,a);else if(o instanceof Pr)n[a].push(o),o.facet.extensions&&r(o.facet.extensions,fn.default);else{let h=o.extension;if(!h)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(h,a)}}return r(i,fn.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 $r(i,e){return e&1?i.config.staticValues[e>>1]:i.values[e>>1]}const _f=ce.define(),Xl=ce.define({combine:i=>i.some(e=>e),static:!0}),bf=ce.define({combine:i=>i.length?i[0]:void 0,static:!0}),yf=ce.define(),wf=ce.define(),kf=ce.define(),xf=ce.define({combine:i=>i.length?i[0]:!1});class Ai{constructor(e,t){this.type=e,this.value=t}static define(){return new Y1}}class Y1{of(e){return new Ai(this,e)}}class z1{constructor(e){this.map=e}of(e){return new we(this,e)}}class we{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 we(this.type,t)}is(e){return this.type==e}static define(e={}){return new z1(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}}we.reconfigure=we.define(),we.appendConfig=we.define();class Ke{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&&mf(n,t.newLength),r.some(a=>a.type==Ke.time)||(this.annotations=r.concat(Ke.time.of(Date.now())))}static create(e,t,n,s,r,o){return new Ke(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(Ke.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}Ke.time=Ai.define(),Ke.userEvent=Ai.define(),Ke.addToHistory=Ai.define(),Ke.remote=Ai.define();function G1(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 Sf(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:we.mapEffects(i.effects,s).concat(we.mapEffects(e.effects,r)),annotations:i.annotations.length?i.annotations.concat(e.annotations):e.annotations,scrollIntoView:i.scrollIntoView||e.scrollIntoView}}function Wl(i,e,t){let n=e.selection,s=Vn(e.annotations);return e.userEvent&&(s=s.concat(Ke.userEvent.of(e.userEvent))),{changes:e.changes instanceof it?e.changes:it.of(e.changes||[],t,i.facet(bf)),selection:n&&(n instanceof j?n:j.single(n.anchor,n.head)),effects:Vn(e.effects),annotations:s,scrollIntoView:!!e.scrollIntoView}}function Cf(i,e,t){let n=Wl(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=Sf(n,Wl(i,e[r],o?n.changes.newLength:i.doc.length),o)}let s=Ke.create(i,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return K1(t?H1(s):s)}function H1(i){let e=i.startState,t=!0;for(let s of e.facet(yf)){let r=s(i);if(r===!1){t=!1;break}Array.isArray(r)&&(t=t===!0?r:G1(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=Ke.create(e,s,i.selection&&i.selection.map(r),we.mapEffects(i.effects,r),i.annotations,i.scrollIntoView)}let n=e.facet(wf);for(let s=n.length-1;s>=0;s--){let r=n[s](i);r instanceof Ke?i=r:Array.isArray(r)&&r.length==1&&r[0]instanceof Ke?i=r[0]:i=Cf(e,Vn(r),!1)}return i}function K1(i){let e=i.startState,t=e.facet(kf),n=i;for(let s=t.length-1;s>=0;s--){let r=t[s](i);r&&Object.keys(r).length&&(n=Sf(n,Wl(e,r,i.changes.newLength),!0))}return n==i?i:Ke.create(e,i.changes,i.selection,n.effects,n.annotations,n.scrollIntoView)}const J1=[];function Vn(i){return i==null?J1:Array.isArray(i)?i:[i]}var je=function(i){return i[i.Word=0]="Word",i[i.Space=1]="Space",i[i.Other=2]="Other",i}(je||(je={}));const ew=/[\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 tw(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()||ew.test(t)))return!0}return!1}function iw(i){return e=>{if(!/\S/.test(e))return je.Space;if(tw(e))return je.Word;for(let t=0;t<i.length;t++)if(e.indexOf(i[t])>-1)return je.Word;return je.Other}}class Se{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),$r(this,n)}update(...e){return Cf(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,h)=>s.set(h,c)),t=null),s.set(a.value.compartment,a.value.extension)):a.is(we.reconfigure)?(t=null,n=a.value):a.is(we.appendConfig)&&(t=null,n=Vn(n).concat(a.value));let r;t?r=e.startState.values.slice():(t=Er.resolve(n,s,this),r=new Se(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(c,h)=>h.reconfigure(c,this),null).values);let o=e.startState.facet(Xl)?e.newSelection:e.newSelection.asSingle();new Se(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:j.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=Vn(n.effects);for(let a=1;a<t.ranges.length;a++){let c=e(t.ranges[a]),h=this.changes(c.changes),u=h.map(s);for(let d=0;d<a;d++)r[d]=r[d].map(u);let f=s.mapDesc(h,!0);r.push(c.range.map(f)),s=s.compose(u),o=we.mapEffects(o,u).concat(we.mapEffects(Vn(c.effects),f))}return{changes:s,selection:j.create(r,t.mainIndex),effects:o}}changes(e=[]){return e instanceof it?e:it.of(e,this.doc.length,this.facet(Se.lineSeparator))}toText(e){return Ae.of(e.split(this.facet(Se.lineSeparator)||vl))}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),$r(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 Se.create({doc:e.doc,selection:j.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=Er.resolve(e.extensions||[],new Map),n=e.doc instanceof Ae?e.doc:Ae.of((e.doc||"").split(t.staticFacet(Se.lineSeparator)||vl)),s=e.selection?e.selection instanceof j?e.selection:j.single(e.selection.anchor,e.selection.head):j.single(0);return mf(s,n.length),t.staticFacet(Xl)||(s=s.asSingle()),new Se(t,n,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(Se.tabSize)}get lineBreak(){return this.facet(Se.lineSeparator)||`
|
|
25
25
|
`}get readOnly(){return this.facet(xf)}phrase(e,...t){for(let n of this.facet(Se.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(_f))for(let o of r(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&s.push(o[e]);return s}charCategorizer(e){return iw(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=ut(t,o,!1);if(r(t.slice(c,o))!=je.Word)break;o=c}for(;a<s;){let c=ut(t,a);if(r(t.slice(a,c))!=je.Word)break;a=c}return o==a?null:j.range(o+n,a+n)}}Se.allowMultipleSelections=Xl,Se.tabSize=ce.define({combine:i=>i.length?i[0]:4}),Se.lineSeparator=bf,Se.readOnly=xf,Se.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])}}),Se.languageData=_f,Se.changeFilter=yf,Se.transactionFilter=wf,Se.transactionExtender=kf,_s.reconfigure=we.define();function hi(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 dn{eq(e){return this==e}range(e,t=e){return zl.create(e,t,this)}}dn.prototype.startSide=dn.prototype.endSide=0,dn.prototype.point=!1,dn.prototype.mapMode=ft.TrackDel;let zl=class HO{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new HO(e,t,n)}};function Gl(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,h=r[c]-e||(n?this.value[c].endSide:this.value[c].startSide)-t;if(c==o)return h>=0?o:a;h>=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 h=this.value[c],u=this.from[c]+e,f=this.to[c]+e,d,m;if(u==f){let b=t.mapPos(u,h.startSide,h.mapMode);if(b==null||(d=m=b,h.startSide!=h.endSide&&(m=t.mapPos(u,h.endSide),m<d)))continue}else if(d=t.mapPos(u,h.startSide),m=t.mapPos(f,h.endSide),d>m||d==m&&h.startSide>0&&h.endSide<=0)continue;(m-d||h.endSide-h.startSide)<0||(o<0&&(o=d),h.point&&(a=Math.max(a,m-d)),n.push(h),s.push(d-o),r.push(m-o))}return{mapped:n.length?new Hl(s,r,n,a):null,pos:o}}}class Ee{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 Ee(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(Gl)),this.isEmpty)return t.length?Ee.of(t):this;let a=new Qf(this,null,-1).goto(0),c=0,h=[],u=new Qi;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++];u.addInner(f.from,f.to,f.value)||h.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])&&u.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))&&(u.addInner(a.from,a.to,a.value)||h.push(zl.create(a.from,a.to,a.value))),a.next());return u.finishInner(this.nextLayer.isEmpty&&!h.length?Ee.empty:this.nextLayer.update({add:h,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],h=e.touchesRange(a,a+c.length);if(h===!1)s=Math.max(s,c.maxPoint),t.push(c),n.push(e.mapPos(a));else if(h===!0){let{mapped:u,pos:f}=c.map(a,e);u&&(s=Math.max(s,u.maxPoint),t.push(u),n.push(f))}}let r=this.nextLayer.map(e);return t.length==0?r:new Ee(n,t,r||Ee.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=Af(o,a,n),h=new ws(o,c,r),u=new ws(a,c,r);n.iterGaps((f,d,m)=>Pf(h,f,u,d,m,s)),n.empty&&n.length==0&&Pf(h,0,u,0,0,s)}static eq(e,t,n=0,s){s==null&&(s=1e9-1);let r=e.filter(u=>!u.isEmpty&&t.indexOf(u)<0),o=t.filter(u=>!u.isEmpty&&e.indexOf(u)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let a=Af(r,o),c=new ws(r,a,0).goto(n),h=new ws(o,a,0).goto(n);for(;;){if(c.to!=h.to||!Jl(c.active,h.active)||c.point&&(!h.point||!c.point.eq(h.point)))return!1;if(c.to>s)return!0;c.next(),h.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 h=Math.min(o.to,n);if(o.point){let u=o.activeForPoint(o.to),f=o.pointFrom<t?u.length+1:o.point.startSide<0?u.length:Math.min(u.length,c);s.point(a,h,o.point,u,f,o.pointRank),c=Math.min(o.openEnd(h),u.length)}else h>a&&(s.span(a,h,o.active,c),c=o.openEnd(h));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 Qi;for(let s of e instanceof zl?[e]:t?nw(e):e)n.add(s.from,s.to,s.value);return n.finish()}static join(e){if(!e.length)return Ee.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let s=e[n];s!=Ee.empty;s=s.nextLayer)t=new Ee(s.chunkPos,s.chunk,t,Math.max(s.maxPoint,t.maxPoint));return t}}Ee.empty=new Ee([],[],null,-1);function nw(i){if(i.length>1)for(let e=i[0],t=1;t<i.length;t++){let n=i[t];if(Gl(e,n)>0)return i.slice().sort(Gl);e=n}return i}Ee.empty.nextLayer=Ee.empty;class Qi{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 Qi)).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(Ee.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=Ee.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Af(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 Qf{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 Qf(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--)Kl(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--)Kl(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(),Kl(this.heap,0)}}}function Kl(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){Nr(this.active,e),Nr(this.activeTo,e),Nr(this.activeRank,e),this.minActive=Tf(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++;Rr(this.active,t,n),Rr(this.activeTo,t,s),Rr(this.activeRank,t,r),e&&Rr(e,t,this.cursor.from),this.minActive=Tf(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&&Nr(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 Pf(i,e,t,n,s,r){i.goto(e),t.goto(n);let o=n+s,a=n,c=n-e;for(;;){let h=i.to+c-t.to,u=h||i.endSide-t.endSide,f=u<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))&&Jl(i.activeForPoint(i.to),t.activeForPoint(t.to))||r.comparePoint(a,d,i.point,t.point):d>a&&!Jl(i.active,t.active)&&r.compareRange(a,d,i.active,t.active),f>o)break;(h||i.openEnd!=t.openEnd)&&r.boundChange&&r.boundChange(f),a=f,u<=0&&i.next(),u>=0&&t.next()}}function Jl(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 Nr(i,e){for(let t=e,n=i.length-1;t<n;t++)i[t]=i[t+1];i.pop()}function Rr(i,e,t){for(let n=i.length-1;n>=e;n--)i[n+1]=i[n];i[e]=t}function Tf(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 Ln(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=ut(i,s));return n}function ea(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=ut(i,s)}return n===!0?-1:i.length}const ta="ͼ",Ef=typeof Symbol>"u"?"__"+ta:Symbol.for(ta),ia=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),$f=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,h){let u=[],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 b=a[m];if(/&/.test(m))r(m.split(/,\s*/).map(w=>o.map(g=>w.replace(/&/,g))).reduce((w,g)=>w.concat(g)),b,c);else if(b&&typeof b=="object"){if(!f)throw new RangeError("The value of a property ("+m+") should be a primitive value.");r(s(m),b,u,d)}else b!=null&&u.push(m.replace(/_.*/,"").replace(/[A-Z]/g,w=>"-"+w.toLowerCase())+": "+b+";")}(u.length||d)&&c.push((n&&!f&&!h?o.map(n):o).join(", ")+" {"+u.join(" ")+"}")}for(let o in e)r(s(o),e[o],this.rules)}getRules(){return this.rules.join(`
|
|
26
26
|
`)}static newName(){let e=$f[Ef]||1;return $f[Ef]=e+1,ta+e.toString(36)}static mount(e,t,n){let s=e[ia],r=n&&n.nonce;s?r&&s.setNonce(r):s=new sw(e,r),s.mount(Array.isArray(t)?t:[t],e)}}let Nf=new Map;class sw{constructor(e,t){let n=e.ownerDocument||e,s=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let r=Nf.get(n);if(r)return e[ia]=r;this.sheet=new s.CSSStyleSheet,Nf.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[ia]=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 h=0;h<a.rules.length;h++)n.insertRule(a.rules[h],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 Xi={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:'"'},rw=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++)Xi[48+dt]=Xi[96+dt]=String(dt);for(var dt=1;dt<=24;dt++)Xi[dt+111]="F"+dt;for(var dt=65;dt<=90;dt++)Xi[dt]=String.fromCharCode(dt+32),ks[dt]=String.fromCharCode(dt);for(var na in Xi)ks.hasOwnProperty(na)||(ks[na]=Xi[na]);function lw(i){var e=rw&&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:Xi)[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 xs(i){let e;return i.nodeType==11?e=i.getSelection?i:i.ownerDocument:e=i,e.getSelection()}function sa(i,e){return e?i==e||i.contains(e.nodeType!=1?e.parentNode:e):!1}function Vr(i,e){if(!e.anchorNode)return!1;try{return sa(i,e.anchorNode)}catch{return!1}}function Mn(i){return i.nodeType==3?mn(i,0,i.nodeValue.length).getClientRects():i.nodeType==1?i.getClientRects():[]}function Ss(i,e,t,n){return t?Rf(i,e,t,n,-1)||Rf(i,e,t,n,1):!1}function pn(i){for(var e=0;;e++)if(i=i.previousSibling,!i)return e}function Lr(i){return i.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(i.nodeName)}function Rf(i,e,t,n,s){for(;;){if(i==t&&e==n)return!0;if(e==(s<0?0:ui(i))){if(i.nodeName=="DIV")return!1;let r=i.parentNode;if(!r||r.nodeType!=1)return!1;e=pn(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?ui(i):0}else return!1}}function ui(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 aw(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 Vf(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 cw(i,e,t,n,s,r,o,a){let c=i.ownerDocument,h=c.defaultView||window;for(let u=i,f=!1;u&&!f;)if(u.nodeType==1){let d,m=u==c.body,b=1,w=1;if(m)d=aw(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(f=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let O=u.getBoundingClientRect();({scaleX:b,scaleY:w}=Vf(u,O)),d={left:O.left,right:O.left+u.clientWidth*b,top:O.top,bottom:O.top+u.clientHeight*w}}let g=0,p=0;if(s=="nearest")e.top<d.top?(p=-(d.top-e.top+o),t>0&&e.bottom>d.bottom+p&&(p=e.bottom-d.bottom+p+o)):e.bottom>d.bottom&&(p=e.bottom-d.bottom+o,t<0&&e.top-p<d.top&&(p=-(d.top+p-e.top+o)));else{let O=e.bottom-e.top,C=d.bottom-d.top;p=(s=="center"&&O<=C?e.top+O/2-C/2:s=="start"||s=="center"&&t<0?e.top-o:e.bottom-C+o)-d.top}if(n=="nearest"?e.left<d.left?(g=-(d.left-e.left+r),t>0&&e.right>d.right+g&&(g=e.right-d.right+g+r)):e.right>d.right&&(g=e.right-d.right+r,t<0&&e.left<d.left+g&&(g=-(d.left+g-e.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)h.scrollBy(g,p);else{let O=0,C=0;if(p){let y=u.scrollTop;u.scrollTop+=p/w,C=(u.scrollTop-y)*w}if(g){let y=u.scrollLeft;u.scrollLeft+=g/b,O=(u.scrollLeft-y)*b}e={left:e.left-O,top:e.top-C,right:e.right-O,bottom:e.bottom-C},O&&Math.abs(O-g)<1&&(n="nearest"),C&&Math.abs(C-p)<1&&(s="nearest")}if(m)break;u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function hw(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 uw{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?ui(t):0),n,Math.min(e.focusOffset,n?ui(n):0))}set(e,t,n,s){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=s}}let Bn=null;function Lf(i){if(i.setActive)return i.setActive();if(Bn)return i.focus(Bn);let e=[];for(let t=i;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(i.focus(Bn==null?{get preventScroll(){return Bn={preventScroll:!0},!0}}:void 0),!Bn){Bn=!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 Mf;function mn(i,e,t=e){let n=Mf||(Mf=document.createRange());return n.setEnd(i,t),n.setStart(i,e),n}function Dn(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 fw(i){for(;i;){if(i&&(i.nodeType==9||i.nodeType==11&&i.host))return i;i=i.assignedSlot||i.parentNode}return null}function Bf(i){for(;i.attributes.length;)i.removeAttributeNode(i.attributes[0])}function dw(i,e){let t=e.focusNode,n=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=n)return!1;for(n=Math.min(n,ui(t));;)if(n){if(t.nodeType!=1)return!1;let s=t.childNodes[n-1];s.contentEditable=="false"?n--:(t=s,n=ui(t))}else{if(t==i)return!0;n=pn(t),t=t.parentNode}}function Df(i){return i.scrollTop>Math.max(1,i.scrollHeight-i.clientHeight-4)}function vf(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=ui(t)}else if(t.parentNode&&!Lr(t))n=pn(t),t=t.parentNode;else return null}}function Zf(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&&!Lr(t))n=pn(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,pn(e),t)}static after(e,t){return new Ot(e.parentNode,pn(e)+1,t)}}const ra=[];class Be{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=Be.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=If(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=If(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=ui(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&&!Be.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,h=n,u=n;c<this.children.length;c++){let f=this.children[c],d=h+f.length;if(h<e&&d>t)return f.domBoundsAround(e,t,h);if(d>=e&&s==-1&&(s=c,r=h),h>t&&f.dom.parentNode==this.dom){o=c,a=u;break}u=d,h=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=ra){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 Uf(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}}Be.prototype.breakAfter=0;function If(i){let e=i.nextSibling;return i.parentNode.removeChild(i),e}class Uf{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 Ff(i,e,t,n,s,r,o,a,c){let{children:h}=i,u=h.length?h[e]:null,f=r.length?r[r.length-1]:null,d=f?f.breakAfter:o;if(!(e==n&&u&&!o&&!d&&r.length<2&&u.merge(t,s,r.length?f:null,t==0,a,c))){if(n<h.length){let m=h[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(u&&(u.breakAfter=o,t>0&&(!o&&r.length&&u.merge(t,u.length,r[0],!1,a,0)?u.breakAfter=r.shift().breakAfter:(t<u.length||u.children.length&&u.children[u.children.length-1].length==0)&&u.merge(t,u.length,null,!1,a,0),e++));e<n&&r.length;)if(h[n-1].become(r[r.length-1]))n--,r.pop(),c=r.length?0:a;else if(h[e].become(r[0]))e++,r.shift(),a=r.length?0:c;else break;!r.length&&e&&n<h.length&&!h[e-1].breakAfter&&h[n].merge(0,0,h[e-1],!1,a,c)&&e--,(e<n||r.length)&&i.replaceChildren(e,n,r)}}function jf(i,e,t,n,s,r){let o=i.childCursor(),{i:a,off:c}=o.findPos(t,1),{i:h,off:u}=o.findPos(e,-1),f=e-t;for(let d of n)f+=d.length;i.length+=f,Ff(i,h,u,a,c,n,0,s,r)}let At=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},oa=typeof document<"u"?document:{documentElement:{style:{}}};const la=/Edge\/(\d+)/.exec(At.userAgent),qf=/MSIE \d/.test(At.userAgent),aa=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(At.userAgent),Mr=!!(qf||aa||la),Xf=!Mr&&/gecko\/(\d+)/i.test(At.userAgent),ca=!Mr&&/Chrome\/(\d+)/.exec(At.userAgent),Wf="webkitFontSmoothing"in oa.documentElement.style,Yf=!Mr&&/Apple Computer/.test(At.vendor),zf=Yf&&(/Mobile\/\w+/.test(At.userAgent)||At.maxTouchPoints>2);var oe={mac:zf||/Mac/.test(At.platform),windows:/Win/.test(At.platform),linux:/Linux|X11/.test(At.platform),ie:Mr,ie_version:qf?oa.documentMode||6:aa?+aa[1]:la?+la[1]:0,gecko:Xf,gecko_version:Xf?+(/Firefox\/(\d+)/.exec(At.userAgent)||[0,0])[1]:0,chrome:!!ca,chrome_version:ca?+ca[1]:0,ios:zf,android:/Android\b/.test(At.userAgent),webkit:Wf,safari:Yf,webkit_version:Wf?+(/\bAppleWebKit\/(\d+)/.exec(At.userAgent)||[0,0])[1]:0,tabSize:oa.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const pw=256;class Ht extends Be{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>pw||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 mw(this.dom,e,t)}}class Pi extends Be{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(Bf(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 Pi&&n.mark.eq(this.mark))||e&&r<=0||t<this.length&&o<=0)?!1:(jf(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 Pi(this.mark,t,o)}domAtPos(e){return Gf(this,e)}coordsAt(e,t){return Kf(this,e,t)}}function mw(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?oe.chrome||oe.gecko||(e?(s--,o=1):r<n&&(r++,o=-1)):t<0?s--:r<n&&r++;let a=mn(i,s,r).getClientRects();if(!a.length)return null;let c=a[(o?o<0:t>=0)?0:a.length-1];return oe.safari&&!o&&c.width==0&&(c=Array.prototype.find.call(a,h=>h.width)||c),o?Cs(c,o<0):c||null}class Wi extends Be{static create(e,t,n){return new Wi(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=Wi.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 Wi)||!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 Wi&&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 Ae.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):Ae.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 vn extends Be{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof vn&&e.side==this.side}split(){return new vn(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 Ae.empty}get isHidden(){return!0}}Ht.prototype.children=Wi.prototype.children=vn.prototype.children=ra;function Gf(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 Hf(i,e,t){let n,{children:s}=i;t>0&&e instanceof Pi&&s.length&&(n=s[s.length-1])instanceof Pi&&n.mark.eq(e.mark)?Hf(n,e.children[0],t-1):(s.push(e),e.setParent(i)),i.length+=e.length}function Kf(i,e,t){let n=null,s=-1,r=null,o=-1;function a(h,u){for(let f=0,d=0;f<h.children.length&&d<=u;f++){let m=h.children[f],b=d+m.length;b>=u&&(m.children.length?a(m,u-d):(!r||r.isHidden&&t>0)&&(b>u||d==b&&m.getSide()>0)?(r=m,o=u-d):(d<u||d==b&&m.getSide()<0&&!m.isHidden)&&(n=m,s=u-d)),d=b}}a(i,e);let c=(t<0?n:r)||n||r;return c?c.coordsAt(Math.max(0,c==n?s:o),t):gw(i)}function gw(i){let e=i.dom.lastChild;if(!e)return i.dom.getBoundingClientRect();let t=Mn(e);return t[t.length-1]||null}function ha(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 Jf=Object.create(null);function Br(i,e,t){if(i==e)return!0;i||(i=Jf),e||(e=Jf);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 ua(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 Ow(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 fi{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 wt=function(i){return i[i.Text=0]="Text",i[i.WidgetBefore=1]="WidgetBefore",i[i.WidgetAfter=2]="WidgetAfter",i[i.WidgetRange=3]="WidgetRange",i}(wt||(wt={}));class de extends dn{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 Yi(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}=ed(e,t);n=(r?t?-3e8:-1:5e8)-1,s=(o?t?2e8:1:-6e8)+1}return new Yi(e,n,s,t,e.widget||null,!0)}static line(e){return new Qs(e)}static set(e,t=!1){return Ee.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}de.none=Ee.empty;class As extends de{constructor(e){let{start:t,end:n}=ed(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))&&Br(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 Qs extends de{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Qs&&this.spec.class==e.spec.class&&Br(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)}}Qs.prototype.mapMode=ft.TrackBefore,Qs.prototype.point=!0;class Yi extends de{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?wt.WidgetRange:this.startSide<=0?wt.WidgetBefore:wt.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Yi&&_w(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)}}Yi.prototype.point=!0;function ed(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 _w(i,e){return i==e||!!(i&&e&&i.compare(e))}function Dr(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 Be{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),jf(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){Br(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Hf(this,e,t)}addLineDeco(e){let t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=ha(t,this.attrs||{})),n&&(this.attrs=ha({class:n},this.attrs||{}))}domAtPos(e){return Gf(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var n;this.dom?this.flags&4&&(Bf(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&&(ua(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&&Be.get(s)instanceof Pi;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((n=Be.get(s))===null||n===void 0?void 0:n.isEditable)==!1&&(!oe.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=Mn(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=Kf(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&&Br(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 Ti extends Be{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 Ti)||!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 Ti(this.widget,t,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return ra}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):Ae.empty}domBoundsAround(){return null}become(e){return e instanceof Ti&&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 fa?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 fa extends fi{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 Ti&&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(vr(new vn(-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 Ti)&&this.getLine()}buildText(e,t,n){for(;e>0;){if(this.textOff==this.text.length){let{value:r,lineBreak:o,done:a}=this.cursor.next(this.skip);if(this.skip=0,a)throw new Error("Ran out of text content when drawing inline views");if(o){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=r,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-n)),this.getLine().append(vr(new Ht(this.text.slice(this.textOff,this.textOff+s)),t),n),this.atCursorPos=!0,this.textOff+=s,e-=s,n=0}}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 Yi){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 Yi)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Ti(n.widget||Zn.block,a,n));else{let c=Wi.create(n.widget||Zn.inline,a,a?0:n.startSide),h=this.atCursorPos&&!c.isEditable&&r<=s.length&&(e<t||n.startSide>0),u=!c.isEditable&&(e<t||r>s.length||n.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!h&&!c.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),h&&(f.append(vr(new vn(1),s),r),r=s.length+Math.max(0,r-s.length)),f.append(vr(c,s),r),this.atCursorPos=u,this.pendingBuffer=u?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=Ee.spans(s,t,n,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function vr(i,e){for(let t of e)i=new Pi(t,[i],i.length);return i}class Zn extends fi{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 Ze=function(i){return i[i.LTR=0]="LTR",i[i.RTL=1]="RTL",i}(Ze||(Ze={}));const gn=Ze.LTR,da=Ze.RTL;function td(i){let e=[];for(let t=0;t<i.length;t++)e.push(1<<+i[t]);return e}const bw=td("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),yw=td("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),pa=Object.create(null),di=[];for(let i of["()","[]","{}"]){let e=i.charCodeAt(0),t=i.charCodeAt(1);pa[e]=t,pa[t]=-e}function id(i){return i<=247?bw[i]:1424<=i&&i<=1524?2:1536<=i&&i<=1785?yw[i-1536]:1774<=i&&i<=2220?4:8192<=i&&i<=8204?256:64336<=i&&i<=65023?4:1}const ww=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class zi{get dir(){return this.level%2?da:gn}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 nd(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||!nd(n.inner,s.inner))return!1}return!0}const De=[];function kw(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 h=o,u=c,f=c;h<a;h++){let d=id(i.charCodeAt(h));d==512?d=u:d==8&&f==4&&(d=16),De[h]=d==4?2:d,d&7&&(f=d),u=d}for(let h=o,u=c,f=c;h<a;h++){let d=De[h];if(d==128)h<a-1&&u==De[h+1]&&u&24?d=De[h]=u:De[h]=256;else if(d==64){let m=h+1;for(;m<a&&De[m]==64;)m++;let b=h&&u==8||m<t&&De[m]==8?f==1?1:8:256;for(let w=h;w<m;w++)De[w]=b;h=m-1}else d==8&&f==1&&(De[h]=1);u=d,d&7&&(f=d)}}}function xw(i,e,t,n,s){let r=s==1?2:1;for(let o=0,a=0,c=0;o<=n.length;o++){let h=o?n[o-1].to:e,u=o<n.length?n[o].from:t;for(let f=h,d,m,b;f<u;f++)if(m=pa[d=i.charCodeAt(f)])if(m<0){for(let w=a-3;w>=0;w-=3)if(di[w+1]==-m){let g=di[w+2],p=g&2?s:g&4?g&1?r:s:0;p&&(De[f]=De[di[w]]=p),a=w;break}}else{if(di.length==189)break;di[a++]=f,di[a++]=d,di[a++]=c}else if((b=De[f])==2||b==1){let w=b==s;c=w?0:1;for(let g=a-3;g>=0;g-=3){let p=di[g+2];if(p&2)break;if(w)di[g+2]|=2;else{if(p&4)break;di[g+2]|=4}}}}}function Sw(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 h=De[c];if(h==256){let u=c+1;for(;;)if(u==a){if(s==t.length)break;u=t[s++].to,a=s<t.length?t[s].from:e}else if(De[u]==256)u++;else break;let f=r==1,d=(u<e?De[u]:n)==1,m=f==d?f?1:2:n;for(let b=u,w=s,g=w?t[w-1].to:i;b>c;)b==g&&(b=t[--w].from,g=w?t[w-1].to:i),De[--b]=m;c=u}else r=h,c++}}}function ma(i,e,t,n,s,r,o){let a=n%2?2:1;if(n%2==s%2)for(let c=e,h=0;c<t;){let u=!0,f=!1;if(h==r.length||c<r[h].from){let w=De[c];w!=a&&(u=!1,f=w==16)}let d=!u&&a==1?[]:null,m=u?n:n+1,b=c;e:for(;;)if(h<r.length&&b==r[h].from){if(f)break e;let w=r[h];if(!u)for(let g=w.to,p=h+1;;){if(g==t)break e;if(p<r.length&&r[p].from==g)g=r[p++].to;else{if(De[g]==a)break e;break}}if(h++,d)d.push(w);else{w.from>c&&o.push(new zi(c,w.from,m));let g=w.direction==gn!=!(m%2);ga(i,g?n+1:n,s,w.inner,w.from,w.to,o),c=w.to}b=w.to}else{if(b==t||(u?De[b]!=a:De[b]==a))break;b++}d?ma(i,c,b,n+1,s,d,o):c<b&&o.push(new zi(c,b,m)),c=b}else for(let c=t,h=r.length;c>e;){let u=!0,f=!1;if(!h||c>r[h-1].to){let w=De[c-1];w!=a&&(u=!1,f=w==16)}let d=!u&&a==1?[]:null,m=u?n:n+1,b=c;e:for(;;)if(h&&b==r[h-1].to){if(f)break e;let w=r[--h];if(!u)for(let g=w.from,p=h;;){if(g==e)break e;if(p&&r[p-1].to==g)g=r[--p].from;else{if(De[g-1]==a)break e;break}}if(d)d.push(w);else{w.to<c&&o.push(new zi(w.to,c,m));let g=w.direction==gn!=!(m%2);ga(i,g?n+1:n,s,w.inner,w.from,w.to,o),c=w.from}b=w.from}else{if(b==e||(u?De[b-1]!=a:De[b-1]==a))break;b--}d?ma(i,b,c,n+1,s,d,o):b<c&&o.push(new zi(b,c,m)),c=b}}function ga(i,e,t,n,s,r,o){let a=e%2?2:1;kw(i,s,r,n,a),xw(i,s,r,n,a),Sw(s,r,n,a),ma(i,s,r,e,t,n,o)}function Cw(i,e,t){if(!i)return[new zi(0,0,e==da?1:0)];if(e==gn&&!t.length&&!ww.test(i))return sd(i.length);if(t.length)for(;i.length>De.length;)De[De.length]=256;let n=[],s=e==gn?0:1;return ga(i,s,s,t,0,i.length,n),n}function sd(i){return[new zi(0,i,0)]}let rd="";function Aw(i,e,t,n,s){var r;let o=n.head-i.from,a=zi.find(e,o,(r=n.bidiLevel)!==null&&r!==void 0?r:-1,n.assoc),c=e[a],h=c.side(s,t);if(o==h){let d=a+=s?1:-1;if(d<0||d>=e.length)return null;c=e[a=d],o=c.side(!s,t),h=c.side(s,t)}let u=ut(i.text,o,c.forward(s,t));(u<c.from||u>c.to)&&(u=h),rd=i.text.slice(Math.min(o,u),Math.max(o,u));let f=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return f&&u==h&&f.level+(s?0:1)<c.level?j.cursor(f.side(!s,t)+i.from,f.forward(s,t)?1:-1,f.level):j.cursor(u+i.from,c.forward(s,t)?-1:1,c.level)}function Qw(i,e,t){for(let n=e;n<t;n++){let s=id(i.charCodeAt(n));if(s==1)return gn;if(s==2||s==4)return da}return gn}const od=ce.define(),ld=ce.define(),ad=ce.define(),cd=ce.define(),Oa=ce.define(),hd=ce.define(),ud=ce.define(),_a=ce.define(),ba=ce.define(),fd=ce.define({combine:i=>i.some(e=>e)}),dd=ce.define({combine:i=>i.some(e=>e)}),pd=ce.define();class In{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 In(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 In(j.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Zr=we.define({map:(i,e)=>i.map(e)}),md=we.define();function Qt(i,e,t){let n=i.facet(cd);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 Ei=ce.define({combine:i=>i.length?i[0]:!0});let Pw=0;const Ts=ce.define();class Ge{constructor(e,t,n,s,r){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=s,this.extension=r(this)}static define(e,t){const{eventHandlers:n,eventObservers:s,provide:r,decorations:o}=t||{};return new Ge(Pw++,e,n,s,a=>{let c=[Ts.of(a)];return o&&c.push(Es.of(h=>{let u=h.plugin(a);return u?o(u):de.none})),r&&c.push(r(a)),c})}static fromClass(e,t){return Ge.define(n=>new e(n),t)}}class ya{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}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(Qt(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.create(e)}catch(t){Qt(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){Qt(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const gd=ce.define(),wa=ce.define(),Es=ce.define(),Od=ce.define(),ka=ce.define(),_d=ce.define();function bd(i,e){let t=i.state.facet(_d);if(!t.length)return t;let n=t.map(r=>r instanceof Function?r(i):r),s=[];return Ee.spans(n,e.from,e.to,{point(){},span(r,o,a,c){let h=r-e.from,u=o-e.from,f=s;for(let d=a.length-1;d>=0;d--,c--){let m=a[d].spec.bidiIsolate,b;if(m==null&&(m=Qw(e.text,h,u)),c>0&&f.length&&(b=f[f.length-1]).to==h&&b.direction==m)b.to=u,f=b.inner;else{let w={from:h,to:u,direction:m,inner:[]};f.push(w),f=w.inner}}}}),s}const yd=ce.define();function xa(i){let e=0,t=0,n=0,s=0;for(let r of i.state.facet(yd)){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 It{constructor(e,t,n,s){this.fromA=e,this.toA=t,this.fromB=n,this.toB=s}join(e){return new It(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],h=o-a,u=c?c.fromB:1e9;for(;r<t.length&&t[r]<u;){let f=t[r],d=t[r+1],m=Math.max(a,f),b=Math.min(u,d);if(m<=b&&new It(m+h,b+h,m,b).addToSet(n),d>u)break;r+=2}if(!c)return n;new It(c.fromA,c.toA,c.fromB,c.toB).addToSet(n),o=c.toA,a=c.toB}}}class Ir{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 It(r,o,a,c))),this.changedRanges=s}static create(e,t,n){return new Ir(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 wd extends Be{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=de.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 It(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:h,toA:u})=>u<this.minWidthFrom||h>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:!Lw(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let r=s>-1?Ew(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:u}=this.hasComposition;n=new It(h,u,e.changes.mapPos(h,-1),e.changes.mapPos(u,1)).addToSet(n.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(oe.ie||oe.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.updateDeco(),c=Rw(o,a,e.changes);return n=It.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=oe.chrome||oe.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 Ti&&o.widget instanceof fa&&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:h,fromB:u,toB:f}=a,d,m,b,w;if(n&&n.range.fromB<f&&n.range.toB>u){let y=Ps.build(this.view.state.doc,u,n.range.fromB,this.decorations,this.dynamicDecorationMap),E=Ps.build(this.view.state.doc,n.range.toB,f,this.decorations,this.dynamicDecorationMap);m=y.breakAtStart,b=y.openStart,w=E.openEnd;let x=this.compositionView(n);E.breakAtStart?x.breakAfter=1:E.content.length&&x.merge(x.length,x.length,E.content[0],!1,E.openStart,0)&&(x.breakAfter=E.content[0].breakAfter,E.content.shift()),y.content.length&&x.merge(0,0,y.content[y.content.length-1],!0,0,y.openEnd)&&y.content.pop(),d=y.content.concat(x).concat(E.content)}else({content:d,breakAtStart:m,openStart:b,openEnd:w}=Ps.build(this.view.state.doc,u,f,this.decorations,this.dynamicDecorationMap));let{i:g,off:p}=r.findPos(h,1),{i:O,off:C}=r.findPos(c,-1);Ff(this,O,C,g,p,d,m,b,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(md)&&(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 Pi(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=Be.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(Ei)||this.dom.tabIndex>-1)&&Vr(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)),h=a.empty?c:this.moveToLine(this.domAtPos(a.head));if(oe.gecko&&a.empty&&!this.hasComposition&&Tw(c)){let f=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(f,c.node.childNodes[c.offset]||null)),c=h=new Ot(f,0),o=!0}let u=this.view.observer.selectionRange;(o||!u.focusNode||(!Ss(c.node,c.offset,u.anchorNode,u.anchorOffset)||!Ss(h.node,h.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,a))&&(this.view.observer.ignore(()=>{oe.android&&oe.chrome&&this.dom.contains(u.focusNode)&&Vw(u.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=xs(this.view.root);if(f)if(a.empty){if(oe.gecko){let d=$w(c.node,c.offset);if(d&&d!=3){let m=(d==1?vf:Zf)(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(h.node,h.offset)}catch{}}else{let d=document.createRange();a.anchor>a.head&&([c,h]=[h,c]),d.setEnd(h.node,h.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,h)),this.impreciseAnchor=c.precise?null:new Ot(u.anchorNode,u.anchorOffset),this.impreciseHead=h.precise?null:new Ot(u.focusNode,u.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),h=this.coordsAt(t.head,1);if(!c||!h||c.bottom>h.top)return;let u=this.domAtPos(t.head+t.assoc);n.collapse(u.node,u.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=Be.get(t.childNodes[s]);r instanceof Je&&(n=r.domAtPos(0))}for(let s=e.offset-1;!n&&s>=0;s--){let r=Be.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=Be.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,h=c-a.length;if(c<e)break;if(h<=e&&(h<e||a.covers(-1))&&(c>e||a.covers(1))&&(!n||a instanceof Je&&!(n instanceof Je&&t>=0)))n=a,s=h;else if(n&&h==e&&c==e&&a instanceof Ti&&Math.abs(t)<2){if(a.deco.startSide<0)break;o&&(n=null)}r=h}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=ut(s.text,n);if(r==n)return null;let o=mn(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==Ze.LTR;for(let h=0,u=0;u<this.children.length;u++){let f=this.children[u],d=h+f.length;if(d>s)break;if(h>=n){let m=f.dom.getBoundingClientRect();if(t.push(m.height),o){let b=f.dom.lastChild,w=b?Mn(b):[];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=h,this.minWidthTo=d)}}}h=d+f.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?Ze.RTL:Ze.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=Mn(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 Uf(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(de.replace({widget:new fa(a),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!r)break;n=r.to+1}return de.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Es).map(r=>(this.dynamicDecorationMap[e++]=typeof r=="function")?r(this.view):r),n=!1,s=this.view.state.facet(Od).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(Ee.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 h=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=h.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let h of this.view.state.facet(pd))try{if(h(this.view,e.range,e))return!0}catch(u){Qt(this.view.state,u,"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=xa(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;cw(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==Ze.LTR)}}function Tw(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 kd(i,e){let t=i.observer.selectionRange;if(!t.focusNode)return null;let n=vf(t.focusNode,t.focusOffset),s=Zf(t.focusNode,t.focusOffset),r=n||s;if(s&&n&&s.node!=n.node){let a=Be.get(s.node);if(!a||a instanceof Ht&&a.text!=s.node.nodeValue)r=s;else if(i.docView.lastCompositionAfterCursor){let c=Be.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 Ew(i,e,t){let n=kd(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,h=new It(c.mapPos(r),c.mapPos(o),r,o),u=[];for(let f=s.parentNode;;f=f.parentNode){let d=Be.get(f);if(d instanceof Pi)u.push({node:f,deco:d.mark});else{if(d instanceof Je||f.nodeName=="DIV"&&f.parentNode==i.contentDOM)return{range:h,text:s,marks:u,line:f};if(f!=i.contentDOM)u.push({node:f,deco:new As({inclusive:!0,attributes:Ow(f),tagName:f.tagName.toLowerCase()})});else return null}}}function $w(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 Nw=class{constructor(){this.changes=[]}compareRange(e,t){Dr(e,t,this.changes)}comparePoint(e,t){Dr(e,t,this.changes)}boundChange(e){Dr(e,e,this.changes)}};function Rw(i,e,t){let n=new Nw;return Ee.compare(i,e,t,n),n.changes}function Vw(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 Lw(i,e){let t=!1;return e&&i.iterChangedRanges((n,s)=>{n<e.to&&s>e.from&&(t=!0)}),t}function Mw(i,e,t=1){let n=i.charCategorizer(e),s=i.doc.lineAt(e),r=e-s.from;if(s.length==0)return j.cursor(e);r==0?t=1:r==s.length&&(t=-1);let o=r,a=r;t<0?o=ut(s.text,r,!1):a=ut(s.text,r);let c=n(s.text.slice(o,a));for(;o>0;){let h=ut(s.text,o,!1);if(n(s.text.slice(h,o))!=c)break;o=h}for(;a<s.length;){let h=ut(s.text,a);if(n(s.text.slice(a,h))!=c)break;a=h}return j.range(o+s.from,a+s.from)}function Bw(i,e){return e.left>i?e.left-i:Math.max(0,i-e.right)}function Dw(i,e){return e.top>i?e.top-i:Math.max(0,i-e.bottom)}function Sa(i,e){return i.top<e.bottom-1&&i.bottom>e.top+1}function xd(i,e){return e<i.top?{top:e,left:i.left,right:i.right,bottom:i.bottom}:i}function Sd(i,e){return e>i.bottom?{top:i.top,left:i.left,right:i.right,bottom:e}:i}function Ca(i,e,t){let n,s,r,o,a=!1,c,h,u,f;for(let b=i.firstChild;b;b=b.nextSibling){let w=Mn(b);for(let g=0;g<w.length;g++){let p=w[g];s&&Sa(s,p)&&(p=xd(Sd(p,s.bottom),s.top));let O=Bw(e,p),C=Dw(t,p);if(O==0&&C==0)return b.nodeType==3?Cd(b,e,t):Ca(b,e,t);if(!n||o>C||o==C&&r>O){n=b,s=p,r=O,o=C;let y=C?t<p.top?-1:1:O?e<p.left?-1:1:0;a=!y||(y>0?g<w.length-1:g>0)}O==0?t>p.bottom&&(!u||u.bottom<p.bottom)?(c=b,u=p):t<p.top&&(!f||f.top>p.top)&&(h=b,f=p):u&&Sa(u,p)?u=Sd(u,p.bottom):f&&Sa(f,p)&&(f=xd(f,p.top))}}if(u&&u.bottom>=t?(n=c,s=u):f&&f.top<=t&&(n=h,s=f),!n)return{node:i,offset:0};let d=Math.max(s.left,Math.min(s.right,e));if(n.nodeType==3)return Cd(n,d,t);if(a&&n.contentEditable!="false")return Ca(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 Cd(i,e,t){let n=i.nodeValue.length,s=-1,r=1e9,o=0;for(let a=0;a<n;a++){let c=mn(i,a,a+1).getClientRects();for(let h=0;h<c.length;h++){let u=c[h];if(u.top==u.bottom)continue;o||(o=e-u.left);let f=(u.top>t?u.top-t:t-u.bottom)-1;if(u.left-1<=e&&u.right+1>=e&&f<r){let d=e>=(u.left+u.right)/2,m=d;if((oe.chrome||oe.gecko)&&mn(i,a).getBoundingClientRect().left==u.right&&(m=!d),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 Ad(i,e,t,n=-1){var s,r;let o=i.contentDOM.getBoundingClientRect(),a=o.top+i.viewState.paddingTop,c,{docHeight:h}=i.viewState,{x:u,y:f}=e,d=f-a;if(d<0)return 0;if(d>h)return i.state.doc.length;for(let y=i.viewState.heightOracle.textHeight/2,E=!1;c=i.elementAtHeight(d),c.type!=wt.Text;)for(;d=n>0?c.bottom+y:c.top-y,!(d>=0&&d<=h);){if(E)return t?null:0;E=!0,n=-n}f=a+d;let m=c.from;if(m<i.viewport.from)return i.viewport.from==0?0:t?null:Qd(i,o,c,u,f);if(m>i.viewport.to)return i.viewport.to==i.state.doc.length?i.state.doc.length:t?null:Qd(i,o,c,u,f);let b=i.dom.ownerDocument,w=i.root.elementFromPoint?i.root:b,g=w.elementFromPoint(u,f);g&&!i.contentDOM.contains(g)&&(g=null),g||(u=Math.max(o.left+1,Math.min(o.right-1,u)),g=w.elementFromPoint(u,f),g&&!i.contentDOM.contains(g)&&(g=null));let p,O=-1;if(g&&((s=i.docView.nearest(g))===null||s===void 0?void 0:s.isEditable)!=!1){if(b.caretPositionFromPoint){let y=b.caretPositionFromPoint(u,f);y&&({offsetNode:p,offset:O}=y)}else if(b.caretRangeFromPoint){let y=b.caretRangeFromPoint(u,f);y&&({startContainer:p,startOffset:O}=y,(!i.contentDOM.contains(p)||oe.safari&&vw(p,O,u)||oe.chrome&&Zw(p,O,u))&&(p=void 0))}p&&(O=Math.min(ui(p),O))}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:O}=Ca(y.dom,u,f))}let C=i.docView.nearest(p);if(!C)return null;if(C.isWidget&&((r=C.dom)===null||r===void 0?void 0:r.nodeType)==1){let y=C.dom.getBoundingClientRect();return e.y<y.top||e.y<=y.bottom&&e.x<=(y.left+y.right)/2?C.posAtStart:C.posAtEnd}else return C.localPosFromDOM(p,O)+C.posAtStart}function Qd(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+ea(o,r,i.state.tabSize)}function vw(i,e,t){let n;if(i.nodeType!=3||e!=(n=i.nodeValue.length))return!1;for(let s=i.nextSibling;s;s=s.nextSibling)if(s.nodeType!=1||s.nodeName!="BR")return!1;return mn(i,n-1,n).getBoundingClientRect().left>t}function Zw(i,e,t){if(e!=0)return!1;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():mn(i,0,Math.max(i.nodeValue.length,1)).getBoundingClientRect();return t-n.left>5}function Aa(i,e){let t=i.lineBlockAt(e);if(Array.isArray(t.type)){for(let n of t.type)if(n.to>e||n.to==e&&(n.to==t.to||n.type==wt.Text))return n}return t}function Iw(i,e,t,n){let s=Aa(i,e.head),r=!n||s.type!=wt.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==Ze.LTR)?o.right-1:o.left+1,y:(r.top+r.bottom)/2});if(c!=null)return j.cursor(c,t?-1:1)}return j.cursor(t?s.to:s.from,t?-1:1)}function Pd(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 h=Aw(s,r,o,a,t),u=rd;if(!h){if(s.number==(t?i.state.doc.lines:1))return a;u=`
|
|
28
|
-
`,s=i.state.doc.line(s.number+(t?1:-1)),r=i.bidiSpans(s),h=i.visualLineSide(s,!t)}if(c){if(!c(u))return a}else{if(!n)return h;c=n(u)}a=h}}function Uw(i,e,t){let n=i.state.charCategorizer(e),s=n(t);return r=>{let o=n(r);return s==je.Space&&(s=o),s==o}}function Fw(i,e,t,n){let s=e.head,r=t?1:-1;if(s==(t?i.state.doc.length:0))return j.cursor(s,e.assoc);let o=e.goalColumn,a,c=i.contentDOM.getBoundingClientRect(),h=i.coordsAtPos(s,e.assoc||-1),u=i.documentTop;if(h)o==null&&(o=h.left-c.left),a=r<0?h.top:h.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)+u}let f=c.left+o,d=n??i.viewState.heightOracle.textHeight>>1;for(let m=0;;m+=10){let b=a+(d+m)*r,w=Ad(i,{x:f,y:b},!1,r);if(b<c.top||b>c.bottom||(r<0?w<s:w>s)){let g=i.docView.coordsForChar(w),p=!g||b<g.top?-1:1;return j.cursor(w,p,void 0,o)}}}function Ur(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 Qa(i,e,t){let n=Ur(i.state.facet(ka).map(s=>s(i)),t.from,e.head>t.from?-1:1);return n==t.from?t:j.cursor(n,n<t.from?1:-1)}const Ns="";class jw{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(Se.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Ns}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=Be.get(s),c=Be.get(o);(a&&c?a.breakAfter:(a?a.breakAfter:Lr(s))||Lr(o)&&(s.nodeName!="BR"||s.cmIgnore)&&this.text.length>r)&&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=Be.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+(qw(e,n.node,n.offset)?t:0))}}function qw(i,e,t){for(;;){if(!e||t<ui(e))return!1;if(e==i)return!0;t=pn(e)+1,e=e.parentNode}}class Td{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class Xw{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?[]:zw(e),c=new jw(a,e.state);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=Gw(a,this.bounds.from)}else{let a=e.observer.selectionRange,c=r&&r.node==a.focusNode&&r.offset==a.focusOffset||!sa(e.contentDOM,a.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),h=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!sa(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),u=e.viewport;if((
|
|
29
|
-
`&&i.lineWrapping&&(n&&(n=j.single(n.main.anchor-1,n.main.head-1)),t={from:s.from,to:s.to,insert:Ae.of([" "])}),t)return Pa(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),i.dispatch({selection:n,scrollIntoView:o,userEvent:a}),!0}else return!1}function Pa(i,e,t,n=-1){if(oe.ios&&i.inputState.flushIOSKey(e))return!0;let s=i.state.selection.main;if(oe.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&&Dn(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)&&Dn(i.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&Dn(i.contentDOM,"Delete",46)))return!0;let r=e.insert.toString();i.inputState.composing>=0&&i.inputState.composing++;let o,a=()=>o||(o=Ww(i,e,t));return i.state.facet(hd).some(c=>c(i,e.from,e.to,r,a))||i.dispatch(a()),!0}function Ww(i,e,t){let n,s=i.state,r=s.selection.main;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 a=r.from<e.from?s.sliceDoc(r.from,e.from):"",c=r.to>e.to?s.sliceDoc(e.to,r.to):"";n=s.replaceSelection(i.state.toText(a+e.insert.sliceString(0,void 0,i.state.lineBreak)+c))}else{let a=s.changes(e),c=t&&t.main.to<=a.newLength?t.main:void 0;if(s.selection.ranges.length>1&&i.inputState.composing>=0&&e.to<=r.to&&e.to>=r.to-10){let h=i.state.sliceDoc(e.from,e.to),u,f=t&&kd(i,t.main.head);if(f){let b=e.insert.length-(e.to-e.from);u={from:f.from,to:f.to-b}}else u=i.state.doc.lineAt(r.head);let d=r.to-e.to,m=r.to-r.from;n=s.changeByRange(b=>{if(b.from==r.from&&b.to==r.to)return{changes:a,range:c||b.map(a)};let w=b.to-d,g=w-h.length;if(b.to-b.from!=m||i.state.sliceDoc(g,w)!=h||b.to>=u.from&&b.from<=u.to)return{range:b};let p=s.changes({from:g,to:w,insert:e.insert}),O=b.to-r.to;return{changes:p,range:c?j.range(Math.max(0,c.anchor+O),Math.max(0,c.head+O)):b.map(p)}})}else n={changes:a,selection:c&&s.selection.replaceRange(c)}}let o="input.type";return(i.composing||i.inputState.compositionPendingChange&&i.inputState.compositionEndedAt>Date.now()-50)&&(i.inputState.compositionPendingChange=!1,o+=".compose",i.inputState.compositionFirstChange&&(o+=".start",i.inputState.compositionFirstChange=!1)),s.update(n,{userEvent:o,scrollIntoView:!0})}function Yw(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 zw(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 Td(t,n)),(s!=t||r!=n)&&e.push(new Td(s,r))),e}function Gw(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?j.single(t+e,n+e):null}class Hw{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.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,oe.safari&&e.contentDOM.addEventListener("input",()=>null),oe.gecko&&dk(e.contentDOM.ownerDocument)}handleEvent(e){!rk(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(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=Kw(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&&Rd.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),oe.android&&oe.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return oe.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=Nd.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||Jw.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,Dn(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:oe.safari&&!oe.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!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 $d(i,e){return(t,n)=>{try{return e.call(i,n,t)}catch(s){Qt(t.state,s)}}}function Kw(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;if(s&&s.domEventHandlers)for(let r in s.domEventHandlers){let o=s.domEventHandlers[r];o&&t(r).handlers.push($d(n.value,o))}if(s&&s.domEventObservers)for(let r in s.domEventObservers){let o=s.domEventObservers[r];o&&t(r).observers.push($d(n.value,o))}}for(let n in Kt)t(n).handlers.push(Kt[n]);for(let n in Ut)t(n).observers.push(Ut[n]);return e}const Nd=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Jw="dthko",Rd=[16,17,18,20,91,92,224,225],Fr=6;function jr(i){return Math.max(0,i)*.7+8}function ek(i,e){return Math.max(Math.abs(i.clientX-e.clientX),Math.abs(i.clientY-e.clientY))}class tk{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=hw(e.contentDOM),this.atoms=e.state.facet(ka).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(Se.allowMultipleSelections)&&ik(e,t),this.dragging=sk(e,t)&&Ud(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&&ek(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=xa(this.view);e.clientX-c.left<=s+Fr?t=-jr(s-e.clientX):e.clientX+c.right>=o-Fr&&(t=jr(e.clientX-o)),e.clientY-c.top<=r+Fr?n=-jr(r-e.clientY):e.clientY+c.bottom>=a-Fr&&(n=jr(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)}skipAtoms(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=Ur(this.atoms,s.from,0);o!=s.from&&(r=j.cursor(o,-1))}else{let o=Ur(this.atoms,s.from,-1),a=Ur(this.atoms,s.to,1);(o!=s.from||a!=s.to)&&(r=j.range(s.from==s.anchor?o:a,s.from==s.head?o:a))}r&&(t||(t=e.ranges.slice()),t[n]=r)}return t?j.create(t,e.mainIndex):e}select(e){let{view:t}=this,n=this.skipAtoms(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 ik(i,e){let t=i.state.facet(od);return t.length?t[0](e):oe.mac?e.metaKey:e.ctrlKey}function nk(i,e){let t=i.state.facet(ld);return t.length?t[0](e):oe.mac?!e.altKey:!e.ctrlKey}function sk(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 rk(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=Be.get(t))&&n.ignoreEvent(e))return!1;return!0}const Kt=Object.create(null),Ut=Object.create(null),Vd=oe.ie&&oe.ie_version<15||oe.ios&&oe.webkit_version<604;function ok(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(),Ld(i,t.value)},50)}function qr(i,e,t){for(let n of i.facet(e))t=n(t,i);return t}function Ld(i,e){e=qr(i.state,_a,e);let{state:t}=i,n,s=1,r=t.toText(e),o=r.lines==t.selection.ranges.length;if(Ta!=null&&t.selection.ranges.every(c=>c.empty)&&Ta==r.toString()){let c=-1;n=t.changeByRange(h=>{let u=t.doc.lineAt(h.from);if(u.from==c)return{range:h};c=u.from;let f=t.toText((o?r.line(s++).text:e)+t.lineBreak);return{changes:{from:u.from,insert:f},range:j.cursor(h.from+f.length)}})}else o?n=t.changeByRange(c=>{let h=r.line(s++);return{changes:{from:c.from,to:c.to,insert:h.text},range:j.cursor(c.from+h.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},Kt.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")},Kt.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(ad))if(t=n(i,e),t)break;if(!t&&e.button==0&&(t=ck(i,e)),t){let n=!i.hasFocus;i.inputState.startMouseSelection(new tk(i,e,t,n)),n&&i.observer.ignore(()=>{Lf(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}return!1};function Md(i,e,t,n){if(n==1)return j.cursor(e,t);if(n==2)return Mw(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++,j.range(o,a)}}let Bd=(i,e,t)=>e>=t.top&&e<=t.bottom&&i>=t.left&&i<=t.right;function lk(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&&Bd(t,n,o))return-1;let a=s.coordsAt(r,1);return a&&Bd(t,n,a)?1:o&&o.bottom>=n?-1:1}function Dd(i,e){let t=i.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:lk(i,t,e.clientX,e.clientY)}}const ak=oe.ie&&oe.ie_version<=11;let vd=null,Zd=0,Id=0;function Ud(i){if(!ak)return i.detail;let e=vd,t=Id;return vd=i,Id=Date.now(),Zd=!e||t>Date.now()-400&&Math.abs(e.clientX-i.clientX)<2&&Math.abs(e.clientY-i.clientY)<2?(Zd+1)%3:1}function ck(i,e){let t=Dd(i,e),n=Ud(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=Dd(i,r),h,u=Md(i,c.pos,c.bias,n);if(t.pos!=c.pos&&!o){let f=Md(i,t.pos,t.bias,n),d=Math.min(f.from,u.from),m=Math.max(f.to,u.to);u=d<u.from?j.range(d,m):j.range(m,d)}return o?s.replaceRange(s.main.extend(u.from,u.to)):a&&n==1&&s.ranges.length>1&&(h=hk(s,c.pos))?h:a?s.addRange(u):j.create([u])}}}function hk(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 j.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}Kt.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=j.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,ba,i.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1},Kt.dragend=i=>(i.inputState.draggedContent=null,!1);function Fd(i,e,t,n){if(t=qr(i.state,_a,t),!t)return;let s=i.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:r}=i.inputState,o=n&&r&&nk(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}Kt.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&&Fd(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 Fd(i,e,n,!0),!0}return!1},Kt.paste=(i,e)=>{if(i.state.readOnly)return!0;i.observer.flush();let t=Vd?null:e.clipboardData;return t?(Ld(i,t.getData("text/plain")||t.getData("text/uri-list")),!0):(ok(i),!1)};function uk(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 fk(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,ba,e.join(i.lineBreak)),ranges:t,linewise:n}}let Ta=null;Kt.copy=Kt.cut=(i,e)=>{let{text:t,ranges:n,linewise:s}=fk(i.state);if(!t&&!s)return!1;Ta=s?t:null,e.type=="cut"&&!i.state.readOnly&&i.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let r=Vd?null:e.clipboardData;return r?(r.clearData(),r.setData("text/plain",t),!0):(uk(i,t),!1)};const jd=Ai.define();function qd(i,e){let t=[];for(let n of i.facet(ud)){let s=n(i,e);s&&t.push(s)}return t?i.update({effects:t,annotations:jd.of(!0)}):null}function Xd(i){setTimeout(()=>{let e=i.hasFocus;if(e!=i.inputState.notifiedFocused){let t=qd(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),Xd(i)},Ut.blur=i=>{i.observer.clearSelectionRange(),Xd(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,oe.chrome&&oe.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()},Kt.beforeinput=(i,e)=>{var t,n;if(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),h=i.posAtDOM(a.endContainer,a.endOffset);return Pa(i,{from:c,to:h,insert:i.state.toText(r)},null),!0}}let s;if(oe.chrome&&oe.android&&(s=Nd.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 oe.ios&&e.inputType=="deleteContentForward"&&i.observer.flushSoon(),oe.safari&&e.inputType=="insertText"&&i.inputState.composing>=0&&setTimeout(()=>Ut.compositionend(i,e),20),!1};const Wd=new Set;function dk(i){Wd.has(i)||(Wd.add(i),i.addEventListener("copy",()=>{}),i.addEventListener("cut",()=>{}))}const Yd=["pre-wrap","normal","pre-line","break-spaces"];let Un=!1;function zd(){Un=!1}class pk{constructor(e){this.lineWrapping=e,this.doc=Ae.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)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Yd.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=Yd.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 h=0;h<o.length;h++){let u=o[h];u<0?h++:this.heightSamples[Math.floor(u*10)]=!0}}return c}}class mk{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class pi{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"?wt.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 Yi?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 pi(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var Ie=function(i){return i[i.ByPos=0]="ByPos",i[i.ByHeight=1]="ByHeight",i[i.ByPosNoHeight=2]="ByPosNoHeight",i}(Ie||(Ie={}));const Xr=.001;class kt{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)>Xr&&(Un=!0),this.height=e)}replace(e,t,n){return kt.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:h,fromB:u,toB:f}=s[a],d=r.lineAt(c,Ie.ByPosNoHeight,n.setDoc(t),0,0),m=d.to>=h?d:r.lineAt(h,Ie.ByPosNoHeight,n,0,0);for(f+=m.to-h,h=m.to;a>0&&d.from<=s[a-1].toA;)c=s[a-1].fromA,u=s[a-1].fromB,a--,c<d.from&&(d=r.lineAt(c,Ie.ByPosNoHeight,n,0,0));u+=d.from-c,c=d.from;let b=Ea.build(n.setDoc(o),e,u,f);r=Wr(r,r.replace(c,h,b))}return r.updateHeight(n,0)}static empty(){return new Vt(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 gk(kt.of(e.slice(0,t)),o,kt.of(e.slice(n)))}}function Wr(i,e){return i==e?i:(i.constructor!=e.constructor&&(Un=!0),e)}kt.prototype.size=1;class Gd extends kt{constructor(e,t,n){super(e,t),this.deco=n}blockAt(e,t,n,s){return new pi(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 Vt extends Gd{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,s){return new pi(s,this.length,n,this.height,this.breaks)}replace(e,t,n){let s=n[0];return n.length==1&&(s instanceof Vt||s instanceof pt&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof pt?s=new Vt(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):kt.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 kt{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 h=s+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),u=t.doc.lineAt(h),f=a+u.length*c,d=Math.max(n,e-f/2);return new pi(u.from,u.length,d,f,0)}else{let h=Math.max(0,Math.min(o-r,Math.floor((e-n)/a))),{from:u,length:f}=t.doc.line(r+h);return new pi(u,f,n+a*h,a,0)}}lineAt(e,t,n,s,r){if(t==Ie.ByHeight)return this.blockAt(e,n,s,r);if(t==Ie.ByPosNoHeight){let{from:m,to:b}=n.doc.lineAt(e);return new pi(m,b-m,0,0,0)}let{firstLine:o,perLine:a,perChar:c}=this.heightMetrics(n,r),h=n.doc.lineAt(e),u=a+h.length*c,f=h.number-o,d=s+a*f+c*(h.from-r-f);return new pi(h.from,h.length,Math.max(s,Math.min(d,s+this.height-u)),u,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:h}=this.heightMetrics(n,r);for(let u=e,f=s;u<=t;){let d=n.doc.lineAt(u);if(u==e){let b=d.number-a;f+=c*b+h*(e-r-b)}let m=c+h*d.length;o(new pi(d.from,d.length,f,m,0)),f+=m,u=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 kt.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 u=e.doc.lineAt(a).length;o.length&&o.push(null);let f=s.heights[s.index++];c==-1?c=f:Math.abs(f-c)>=Xr&&(c=-2);let d=new Vt(u,f);d.outdated=!1,o.push(d),a+=u+1}a<=r&&o.push(null,new pt(r-a).updateHeight(e,a));let h=kt.of(o);return(c<0||Math.abs(h.height-this.height)>=Xr||Math.abs(c-this.heightMetrics(e,t).perLine)>=Xr)&&(Un=!0),Wr(this,h)}else(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class gk extends kt{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==Ie.ByHeight?e<o:e<a,h=c?this.left.lineAt(e,t,n,s,r):this.right.lineAt(e,t,n,o,a);if(this.break||(c?h.to<a:h.from>a))return h;let u=t==Ie.ByPosNoHeight?Ie.ByPosNoHeight:Ie.ByPos;return c?h.join(this.right.lineAt(a,u,n,o,a)):this.left.lineAt(a,u,n,s,r).join(h)}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 h=this.lineAt(c,Ie.ByPos,n,s,r);e<h.from&&this.left.forEachLine(e,h.from-1,n,s,r,o),h.to>=e&&h.from<=t&&o(h),t>h.to&&this.right.forEachLine(h.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&&Hd(r,o-1),t<this.length){let a=r.length;this.decomposeRight(t,r),Hd(r,a)}return kt.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?kt.of(this.break?[e,null,t]:[e,t]):(this.left=Wr(this.left,e),this.right=Wr(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 Hd(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 Ok=5;class Ea{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 Vt?s.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new Vt(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 Gd(o,s,n)):(o||r||s>=Ok)&&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 Vt(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 Vt)return e;let t=new Vt(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 Vt)&&!this.isCovered?this.nodes.push(new Vt(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 Vt&&s.updateHeight(this.oracle,n),n+=s?s.length:1;return this.nodes}static build(e,t,n,s){let r=new Ea(n,e);return Ee.spans(t,n,s,r,0),r.finish(n)}}function _k(i,e,t){let n=new bk;return Ee.compare(i,e,t,n,0),n.changes}class bk{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,s){(e<t||n&&n.heightRelevant||s&&s.heightRelevant)&&Dr(e,t,this.changes,5)}}function yk(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 h=i.parentNode;h&&h!=n.body;)if(h.nodeType==1){let u=h,f=window.getComputedStyle(u);if((u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth)&&f.overflow!="visible"){let d=u.getBoundingClientRect();r=Math.max(r,d.left),o=Math.min(o,d.right),a=Math.max(a,d.top),c=Math.min(h==i.parentNode?s.innerHeight:c,d.bottom)}h=f.position=="absolute"||f.position=="fixed"?u.offsetParent:u.parentNode}else if(h.nodeType==11)h=h.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 wk(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 kk(i,e){let t=i.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class $a{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 de.replace({widget:new xk(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class xk extends fi{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 Kd{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=Jd,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Ze.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(wa).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new pk(t),this.stateDeco=e.facet(Es).filter(n=>typeof n!="function"),this.heightMap=kt.empty().applyChanges(this.stateDeco,Ae.empty,this.heightOracle.setDoc(e.doc),[new It(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=de.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?Jd:new Na(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(Rs(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(Es).filter(u=>typeof u!="function");let s=e.changedRanges,r=It.extendWithRanges(s,_k(n,this.stateDeco,e?e.changes:it.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);zd(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=o||Un)&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);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 h=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,e.flags|=this.updateForViewport(),(h||!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(dd)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?Ze.RTL:Ze.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 h=0,u=0;if(a.width&&a.height){let{scaleX:y,scaleY:E}=Vf(t,a);(y>.005&&Math.abs(this.scaleX-y)>.005||E>.005&&Math.abs(this.scaleY-E)>.005)&&(this.scaleX=y,this.scaleY=E,h|=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,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(c=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let m=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=m&&(this.scrollAnchorHeight=-1,this.scrollTop=m),this.scrolledToBottom=Df(e.scrollDOM);let b=(this.printing?kk:yk)(t,this.paddingTop),w=b.top-this.pixelViewport.top,g=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;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&&!wk(e.dom))return 0;let O=a.width;if((this.contentDOMWidth!=O||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),c){let y=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(y)&&(o=!0),o||s.lineWrapping&&Math.abs(O-this.contentDOMWidth)>s.charWidth){let{lineHeight:E,charWidth:x,textHeight:k}=e.docView.measureTextSize();o=E>0&&s.refresh(r,E,x,k,O/x,y),o&&(e.docView.minWidth=0,h|=16)}w>0&&g>0?u=Math.max(w,g):w<0&&g<0&&(u=Math.min(w,g)),zd();for(let E of this.viewports){let x=E.from==this.viewport.from?y:e.docView.measureVisibleLineHeights(E);this.heightMap=(o?kt.empty().applyChanges(this.stateDeco,Ae.empty,this.heightOracle,[new It(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new mk(E.from,x))}Un&&(h|=2)}let C=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return C&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(u,this.scrollTarget),h|=this.updateForViewport()),(h&2||C)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}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,Ie.ByHeight,r,0,0).from,s.lineAt(a+(1-n)*1e3,Ie.ByHeight,r,0,0).to);if(t){let{head:h}=t.range;if(h<c.from||h>c.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=s.lineAt(h,Ie.ByPos,r,0,0),d;t.y=="center"?d=(f.top+f.bottom)/2-u/2:t.y=="start"||t.y=="nearest"&&h<c.from?d=f.top:d=f.bottom-u,c=new Yr(s.lineAt(d-1e3/2,Ie.ByHeight,r,0,0).from,s.lineAt(d+u+1e3/2,Ie.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,Ie.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,Ie.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,Ie.ByPos,this.heightOracle,0,0),{bottom:r}=this.heightMap.lineAt(t,Ie.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 $a(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!=Ze.LTR&&!n)return[];let a=[],c=(u,f,d,m)=>{if(f-u<r)return;let b=this.state.selection.main,w=[b.from];b.empty||w.push(b.to);for(let p of w)if(p>u&&p<f){c(u,p-10,d,m),c(p+10,f,d,m);return}let g=Ck(e,p=>p.from>=d.from&&p.to<=d.to&&Math.abs(p.from-u)<r&&Math.abs(p.to-f)<r&&!w.some(O=>p.from<O&&p.to>O));if(!g){if(f<d.to&&t&&n&&t.visibleRanges.some(C=>C.from<=f&&C.to>=f)){let C=t.moveToLineBoundary(j.cursor(f),!1,!0).head;C>u&&(f=C)}let p=this.gapSize(d,u,f,m),O=n||p<2e6?p:2e6;g=new $a(u,f,p,O)}a.push(g)},h=u=>{if(u.length<o||u.type!=wt.Text)return;let f=Sk(u.from,u.to,this.stateDeco);if(f.total<o)return;let d=this.scrollTarget?this.scrollTarget.range.head:null,m,b;if(n){let w=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,g,p;if(d!=null){let O=Gr(f,d),C=((this.visibleBottom-this.visibleTop)/2+w)/u.height;g=O-C,p=O+C}else g=(this.visibleTop-u.top-w)/u.height,p=(this.visibleBottom-u.top+w)/u.height;m=zr(f,g),b=zr(f,p)}else{let w=f.total*this.heightOracle.charWidth,g=s*this.heightOracle.charWidth,p=0;if(w>2e6)for(let x of e)x.from>=u.from&&x.from<u.to&&x.size!=x.displaySize&&x.from*this.heightOracle.charWidth+p<this.pixelViewport.left&&(p=x.size-x.displaySize);let O=this.pixelViewport.left+p,C=this.pixelViewport.right+p,y,E;if(d!=null){let x=Gr(f,d),k=((C-O)/2+g)/w;y=x-k,E=x+k}else y=(O-g)/w,E=(C+g)/w;m=zr(f,y),b=zr(f,E)}m>u.from&&c(u.from,m,u,f),b<u.to&&c(b,u.to,u,f)};for(let u of this.viewportLines)Array.isArray(u.type)?u.type.forEach(h):h(u);return a}gapSize(e,t,n,s){let r=Gr(s,n)-Gr(s,t);return this.heightOracle.lineWrapping?e.height*r:s.total*this.heightOracle.charWidth*r}updateLineGaps(e){$a.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=de.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=[];Ee.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)||Rs(this.heightMap.lineAt(e,Ie.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)||Rs(this.heightMap.lineAt(this.scaler.fromDOM(e),Ie.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 Rs(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 Sk(i,e,t){let n=[],s=i,r=0;return Ee.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 zr({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 Gr(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 Ck(i,e){for(let t of i)if(e(t))return t}const Jd={toDOM(i){return i},fromDOM(i){return i},scale:1,eq(i){return i==this}};class Na{constructor(e,t,n){let s=0,r=0,o=0;this.viewports=n.map(({from:a,to:c})=>{let h=t.lineAt(a,Ie.ByPos,e,0,0).top,u=t.lineAt(c,Ie.ByPos,e,0,0).bottom;return s+=u-h,{from:a,to:c,top:h,bottom:u,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 Na?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 Rs(i,e){if(e.scale==1)return i;let t=e.toDOM(i.top),n=e.toDOM(i.bottom);return new pi(i.from,i.length,t,n-t,Array.isArray(i._content)?i._content.map(s=>Rs(s,e)):i._content)}const Hr=ce.define({combine:i=>i.join(" ")}),Ra=ce.define({combine:i=>i.indexOf(!0)>-1}),Va=qi.newName(),ep=qi.newName(),tp=qi.newName(),ip={"&light":"."+ep,"&dark":"."+tp};function La(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 Ak=La("."+Va,{"&":{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",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&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-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"},".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"}},ip),Qk={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Ma=oe.ie&&oe.ie_version<=11;class Pk{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new uw,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);(oe.ie&&oe.ie_version<=11||oe.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&&e.constructor.EDIT_CONTEXT!==!1&&!(oe.chrome&&oe.chrome_version<126)&&(this.editContext=new Ek(e),e.state.facet(Ei)&&(e.contentDOM.editContext=this.editContext.editContext)),Ma&&(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(Ei)?n.root.activeElement!=this.dom:!Vr(this.dom,s))return;let r=s.anchorNode&&n.docView.nearest(s.anchorNode);if(r&&r.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(oe.ie&&oe.ie_version<=11||oe.android&&oe.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=oe.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Tk(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let s=Vr(this.dom,n);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&dw(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,Qk),Ma&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Ma&&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&&Dn(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&&Vr(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 Xw(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=Ed(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=np(t,e.previousSibling||e.target.previousSibling,-1),s=np(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(Ei)!=e.state.facet(Ei)&&(e.view.contentDOM.editContext=e.state.facet(Ei)?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 np(i,e,t){for(;e;){let n=Be.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 sp(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 Tk(i,e){if(e.getComposedRanges){let s=e.getComposedRanges(i.root)[0];if(s)return sp(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?sp(i,t):null}class Ek{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 h={from:a,to:c,insert:Ae.of(n.text.split(`
|
|
30
|
-
`))};if(h.from==this.from&&r<this.from?h.from=r:h.to==this.to&&r>this.to&&(h.to=r),h.from==h.to&&!h.insert.length){let u=j.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));u.main.eq(s)||e.dispatch({selection:u,userEvent:"select"});return}if((oe.mac||oe.android)&&h.from==o-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:a,to:c,insert:Ae.of([n.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let u=this.to-this.from+(h.to-h.from+h.insert.length);Pa(e,h,j.single(this.toEditorPos(n.selectionStart,u),this.toEditorPos(n.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state))},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(o!="None"&&a!="None"){let c=this.toEditorPos(r.rangeStart),h=this.toEditorPos(r.rangeEnd);if(c<h){let u=`text-decoration: underline ${o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${a=="Thin"?1:2}px`;s.push(de.mark({attributes:{style:u}}).range(c,h))}}}e.dispatch({effects:md.of(de.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,h)=>{if(n)return;let u=h.length-(o-r);if(s&&o>=s.to)if(s.from==r&&s.to==o&&s.insert.eq(h)){s=this.pendingContextChange=null,t+=u,this.to+=u;return}else s=null,this.revertPending(e.state);if(r+=t,o+=t,o<=this.from)this.from+=u,this.to+=u;else if(r<this.to){if(r<this.from||o>this.to||this.to-this.from+h.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(r),this.toContextPos(o),h.toString()),this.to+=u}t+=u}),s&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange;this.composing&&(this.composing.drifted||e.transactions.some(n=>!n.isUserEvent("input.type")&&n.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.composing>0}get compositionStarted(){return 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||fw(e.parent)||document,this.viewState=new Kd(e.state||Se.create(e)),e.scrollTo&&e.scrollTo.is(Zr)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Ts).map(s=>new ya(s));for(let s of this.plugins)s.update(this);this.observer=new Pk(this),this.inputState=new Hw(this),this.inputState.ensureHandlers(this.plugins),this.docView=new wd(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 Ke?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(jd))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,c=qd(r,o),c||(a=1));let h=this.observer.delayedAndroidKey,u=null;if(h?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(u=null)):this.observer.clear(),r.facet(Se.phrases)!=this.state.facet(Se.phrases))return this.setState(r);s=Ir.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 In(m.empty?m:j.cursor(m.head,m.head>m.anchor?-1:1))}for(let m of d.effects)m.is(Zr)&&(f=m.value.clip(this.state))}this.viewState.update(s,f),this.bidiCache=Kr.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(Oa))try{d(s)}catch(m){Qt(this.state,m,"update listener")}(c||u)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),u&&!Ed(this,u)&&h.force&&Dn(this.contentDOM,h.key,h.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 Kd(e),this.plugins=e.facet(Ts).map(n=>new ya(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new wd(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(Ts),n=e.state.facet(Ts);if(t!=n){let s=[];for(let r of n){let o=t.indexOf(r);if(o<0)s.push(new ya(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){Qt(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(Df(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 h=[];c&4||([this.measureRequests,h]=[h,this.measureRequests]);let u=h.map(m=>{try{return m.read(this)}catch(b){return Qt(this.state,b),rp}}),f=Ir.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<h.length;m++)if(u[m]!=rp)try{let b=h[m];b.write&&b.write(u[m],this)}catch(b){Qt(this.state,b)}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 b=(r<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(r).top)-o;if(b>1||b<-1){s=s+b,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(Oa))a(t)}get themeClasses(){return Va+" "+(this.state.facet(Ra)?tp:ep)+" "+this.state.facet(Hr)}updateAttrs(){let e=op(this,gd,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Ei)?"true":"false",class:"cm-content",style:`${oe.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),op(this,wa,t);let n=this.observer.ignore(()=>{let s=ua(this.contentDOM,this.contentAttrs,t),r=ua(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(Ak).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.spec!=e)&&this.pluginMap.set(e,t=this.plugins.find(n=>n.spec==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 Qa(this,e,Pd(this,e,t,n))}moveByGroup(e,t){return Qa(this,e,Pd(this,e,t,n=>Uw(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 j.cursor(r.side(t,s)+e.from,r.forward(!t,s)?1:-1)}moveToLineBoundary(e,t,n=!0){return Iw(this,e,t,n)}moveVertically(e,t,n){return Qa(this,e,Fw(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(),Ad(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[zi.find(r,e-s.from,-1,t)];return Cs(n,o.dir==Ze.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(fd)||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>$k)return sd(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||nd(r.isolates,n=bd(this,e))))return r.order;n||(n=bd(this,e));let s=Cw(e.text,t,n);return this.bidiCache.push(new Kr(e.from,e.to,t,n,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||oe.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Lf(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 Zr.of(new In(typeof e=="number"?j.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 Zr.of(new In(j.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 Ge.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Ge.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=qi.newName(),s=[Hr.of(n),$s.of(La(`.${n}`,e))];return t&&t.dark&&s.push(Ra.of(!0)),s}static baseTheme(e){return ji.lowest($s.of(La("."+Va,e,ip)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),s=n&&Be.get(n)||Be.get(e);return((t=s==null?void 0:s.rootView)===null||t===void 0?void 0:t.view)||null}}se.styleModule=$s,se.inputHandler=hd,se.clipboardInputFilter=_a,se.clipboardOutputFilter=ba,se.scrollHandler=pd,se.focusChangeEffect=ud,se.perLineTextDirection=fd,se.exceptionSink=cd,se.updateListener=Oa,se.editable=Ei,se.mouseSelectionStyle=ad,se.dragMovesSelection=ld,se.clickAddsSelectionRange=od,se.decorations=Es,se.outerDecorations=Od,se.atomicRanges=ka,se.bidiIsolatedRanges=_d,se.scrollMargins=yd,se.darkTheme=Ra,se.cspNonce=ce.define({combine:i=>i.length?i[0]:""}),se.contentAttributes=wa,se.editorAttributes=gd,se.lineWrapping=se.contentAttributes.of({class:"cm-lineWrapping"}),se.announce=we.define();const $k=4096,rp={};class Kr{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:Ze.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 Kr(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function op(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&&ha(o,t)}return t}const Nk=oe.mac?"mac":oe.windows?"win":oe.linux?"linux":"key";function Rk(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 h=t[c];if(/^(cmd|meta|m)$/i.test(h))a=!0;else if(/^a(lt)?$/i.test(h))s=!0;else if(/^(c|ctrl|control)$/i.test(h))r=!0;else if(/^s(hift)?$/i.test(h))o=!0;else if(/^mod$/i.test(h))e=="mac"?a=!0:r=!0;else throw new Error("Unrecognized modifier name: "+h)}return s&&(n="Alt-"+n),r&&(n="Ctrl-"+n),a&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function Jr(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 Vk=ji.default(se.domEventHandlers({keydown(i,e){return cp(ap(e.state),i,e,"editor")}})),Vs=ce.define({enables:Vk}),lp=new WeakMap;function ap(i){let e=i.facet(Vs),t=lp.get(e);return t||lp.set(e,t=Bk(e.reduce((n,s)=>n.concat(s),[]))),t}function Lk(i,e,t){return cp(ap(i.state),e,i,t)}let Gi=null;const Mk=4e3;function Bk(i,e=Nk){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,h,u)=>{var f,d;let m=t[o]||(t[o]=Object.create(null)),b=a.split(/ (?!$)/).map(p=>Rk(p,e));for(let p=1;p<b.length;p++){let O=b.slice(0,p).join(" ");s(O,!0),m[O]||(m[O]={preventDefault:!0,stopPropagation:!1,run:[C=>{let y=Gi={view:C,prefix:O,scope:o};return setTimeout(()=>{Gi==y&&(Gi=null)},Mk),!0}]})}let w=b.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),h&&(g.preventDefault=!0),u&&(g.stopPropagation=!0)};for(let o of i){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let h of a){let u=t[h]||(t[h]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let d in u)u[d].run.push(m=>f(m,Ba))}let c=o[e]||o.key;if(c)for(let h of a)r(h,c,o.run,o.preventDefault,o.stopPropagation),o.shift&&r(h,"Shift-"+c,o.shift,o.preventDefault,o.stopPropagation)}return t}let Ba=null;function cp(i,e,t,n){Ba=e;let s=lw(e),r=Ct(s,0),o=ai(r)==s.length&&s!=" ",a="",c=!1,h=!1,u=!1;Gi&&Gi.view==t&&Gi.scope==n&&(a=Gi.prefix+" ",Rd.indexOf(e.keyCode)<0&&(h=!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&&(u=!0),!0;g.preventDefault&&(g.stopPropagation&&(u=!0),h=!0)}return!1},m=i[n],b,w;return m&&(d(m[a+Jr(s,e,!o)])?c=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(oe.windows&&e.ctrlKey&&e.altKey)&&(b=Xi[e.keyCode])&&b!=s?(d(m[a+Jr(b,e,!0)])||e.shiftKey&&(w=ks[e.keyCode])!=s&&w!=b&&d(m[a+Jr(w,e,!1)]))&&(c=!0):o&&e.shiftKey&&d(m[a+Jr(s,e,!0)])&&(c=!0),!c&&d(m._any)&&(c=!0)),h&&(c=!0),c&&u&&e.stopPropagation(),Ba=null,c}class Ls{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=hp(e);return[new Ls(t,s.left-r.left,s.top-r.top,null,s.bottom-s.top)]}else return Dk(e,t,n)}}function hp(i){let e=i.scrollDOM.getBoundingClientRect();return{left:(i.textDirection==Ze.LTR?e.left:e.right-i.scrollDOM.clientWidth*i.scaleX)-i.scrollDOM.scrollLeft*i.scaleX,top:e.top-i.scrollDOM.scrollTop*i.scaleY}}function up(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 Dk(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==Ze.LTR,o=i.contentDOM,a=o.getBoundingClientRect(),c=hp(i),h=o.querySelector(".cm-line"),u=h&&window.getComputedStyle(h),f=a.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),d=a.right-(u?parseInt(u.paddingRight):0),m=Aa(i,n),b=Aa(i,s),w=m.type==wt.Text?m:null,g=b.type==wt.Text?b:null;if(w&&(i.lineWrapping||m.widgetLineBreaks)&&(w=up(i,n,1,w)),g&&(i.lineWrapping||b.widgetLineBreaks)&&(g=up(i,s,-1,g)),w&&g&&w.from==g.from&&w.to==g.to)return O(C(t.from,t.to,w));{let E=w?C(t.from,null,w):y(m,!1),x=g?C(null,t.to,g):y(b,!0),k=[];return(w||m).to<(g||b).from-(w&&g?1:0)||m.widgetLineBreaks>1&&E.bottom+i.defaultLineHeight/2<x.top?k.push(p(f,E.bottom,d,x.top)):E.bottom<x.top&&i.elementAtHeight((E.bottom+x.top)/2).type==wt.Text&&(E.bottom=x.top=(E.bottom+x.top)/2),O(E).concat(k).concat(O(x))}function p(E,x,k,P){return new Ls(e,E-c.left,x-c.top,k-E,P-x)}function O({top:E,bottom:x,horizontal:k}){let P=[];for(let N=0;N<k.length;N+=2)P.push(p(k[N],E,k[N+1],x));return P}function C(E,x,k){let P=1e9,N=-1e9,_=[];function A(T,I,B,U,Z){let K=i.coordsAtPos(T,T==k.to?-2:2),X=i.coordsAtPos(B,B==k.from?2:-2);!K||!X||(P=Math.min(K.top,X.top,P),N=Math.max(K.bottom,X.bottom,N),Z==Ze.LTR?_.push(r&&I?f:K.left,r&&U?d:X.right):_.push(!r&&U?f:X.left,!r&&I?d:K.right))}let S=E??k.from,M=x??k.to;for(let T of i.visibleRanges)if(T.to>S&&T.from<M)for(let I=Math.max(T.from,S),B=Math.min(T.to,M);;){let U=i.state.doc.lineAt(I);for(let Z of i.bidiSpans(U)){let K=Z.from+U.from,X=Z.to+U.from;if(K>=B)break;X>I&&A(Math.max(K,I),E==null&&K<=S,Math.min(X,B),x==null&&X>=M,Z.dir)}if(I=U.to+1,I>=B)break}return _.length==0&&A(S,E==null,M,x==null,i.textDirection),{top:P,bottom:N,horizontal:_}}function y(E,x){let k=a.top+(x?E.top:E.bottom);return{top:k,bottom:k,horizontal:[]}}}function vk(i,e){return i.constructor==e.constructor&&i.eq(e)}class Zk{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(eo)!=e.state.facet(eo)&&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(eo);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)=>!vk(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}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const eo=ce.define();function fp(i){return[Ge.define(e=>new Zk(e,i)),eo.of(i)]}const dp=!(oe.ios&&oe.webkit&&oe.webkit_version<534),Ms=ce.define({combine(i){return hi(i,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function Ik(i={}){return[Ms.of(i),Uk,Fk,jk,dd.of(!0)]}function pp(i){return i.startState.facet(Ms)!=i.state.facet(Ms)}const Uk=fp({above:!0,markers(i){let{state:e}=i,t=e.facet(Ms),n=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty?!r||dp:t.drawRangeCursor){let o=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=s.empty?s:j.cursor(s.head,s.head>s.anchor?-1:1);for(let c of Ls.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=pp(i);return t&&mp(i.state,e),i.docChanged||i.selectionSet||t},mount(i,e){mp(e.state,i)},class:"cm-cursorLayer"});function mp(i,e){e.style.animationDuration=i.facet(Ms).cursorBlinkRate+"ms"}const Fk=fp({above:!1,markers(i){return i.state.selection.ranges.map(e=>e.empty?[]:Ls.forRange(i,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(i,e){return i.docChanged||i.selectionSet||i.viewportChanged||pp(i)},class:"cm-selectionLayer"}),Da={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};dp&&(Da[".cm-line"].caretColor=Da[".cm-content"].caretColor="transparent !important");const jk=ji.highest(se.theme(Da)),gp=we.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(gp)?n.value:t,i)}}),qk=Ge.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:gp.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 Xk(){return[Bs,qk]}function Op(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 Wk(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 Yk{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,h,u)=>s(u,h,h+a[0].length,a,c);else if(typeof n=="function")this.addMatch=(a,c,h,u)=>{let f=n(a,c,h);f&&u(h,h+a[0].length,f)};else if(n)this.addMatch=(a,c,h,u)=>u(h,h+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 Qi,n=t.add.bind(t);for(let{from:s,to:r}of Wk(e,this.maxLength))Op(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),h=c.to<a?e.state.doc.lineAt(a):c,u=Math.max(r.from,c.from),f=Math.min(r.to,h.to);if(this.boundary){for(;o>c.from;o--)if(this.boundary.test(c.text[o-1-c.from])){u=o;break}for(;a<h.to;a++)if(this.boundary.test(h.text[a-h.from])){f=a;break}}let d=[],m,b=(w,g,p)=>d.push(p.range(w,g));if(c==h)for(this.regexp.lastIndex=u-c.from;(m=this.regexp.exec(c.text))&&m.index<f-c.from;)this.addMatch(m,e,m.index+c.from,b);else Op(e.state.doc,this.regexp,u,f,(w,g)=>this.addMatch(g,e,w,b));t=t.update({filterFrom:u,filterTo:f,filter:(w,g)=>w<u||g>f,add:d})}}return t}}const va=/x/.unicode!=null?"gu":"g",zk=new RegExp(`[\0-\b
|
|
31
|
-
--\u2028\u2029\uFEFF-]`,va),Gk={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 Za=null;function Hk(){var i;if(Za==null&&typeof document<"u"&&document.body){let e=document.body.style;Za=((i=e.tabSize)!==null&&i!==void 0?i:e.MozTabSize)!=null}return Za||!1}const to=ce.define({combine(i){let e=hi(i,{render:null,specialChars:zk,addSpecialChars:null});return(e.replaceTabs=!Hk())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,va)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,va)),e}});function Kk(i={}){return[to.of(i),Jk()]}let _p=null;function Jk(){return _p||(_p=Ge.fromClass(class{constructor(i){this.view=i,this.decorations=de.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(i.state.facet(to)),this.decorations=this.decorator.createDeco(i)}makeDecorator(i){return new Yk({regexp:i.specialChars,decoration:(e,t,n)=>{let{doc:s}=t.state,r=Ct(e[0],0);if(r==9){let o=s.lineAt(n),a=t.state.tabSize,c=Ln(o.text,a,n-o.from);return de.replace({widget:new nx((a-c%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[r]||(this.decorationCache[r]=de.replace({widget:new ix(i,r)}))},boundary:i.replaceTabs?void 0:/[^]/})}update(i){let e=i.state.facet(to);i.startState.facet(to)!=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 ex="•";function tx(i){return i>=32?ex:i==10?"":String.fromCharCode(9216+i)}class ix extends fi{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=tx(this.code),n=e.state.phrase("Control character")+" "+(Gk[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 nx extends fi{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 sx(){return ox}const rx=de.line({class:"cm-activeLine"}),ox=Ge.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(rx.range(s.from)),e=s.from)}return de.set(t)}},{decorations:i=>i.decorations});class lx extends fi{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)),typeof this.content=="string"?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?Mn(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 ax(i){return Ge.fromClass(class{constructor(e){this.view=e,this.placeholder=i?de.set([de.widget({widget:new lx(i),side:1}).range(0)]):de.none}get decorations(){return this.view.state.doc.length?de.none:this.placeholder}},{decorations:e=>e.decorations})}const Ia=2e3;function cx(i,e,t){let n=Math.min(e.line,t.line),s=Math.max(e.line,t.line),r=[];if(e.off>Ia||t.off>Ia||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 h=i.doc.line(c);h.length<=a&&r.push(j.range(h.from+o,h.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 h=i.doc.line(c),u=ea(h.text,o,i.tabSize,!0);if(u<0)r.push(j.cursor(h.to));else{let f=ea(h.text,a,i.tabSize);r.push(j.range(h.from+u,h.from+f))}}}return r}function hx(i,e){let t=i.coordsAtPos(i.viewport.from);return t?Math.round(Math.abs((t.left-e)/i.defaultCharacterWidth)):-1}function bp(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>Ia?-1:s==n.length?hx(i,e.clientX):Ln(n.text,i.state.tabSize,t-n.from);return{line:n.number,col:r,off:s}}function ux(i,e){let t=bp(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=bp(i,s);if(!a)return n;let c=cx(i.state,t,a);return c.length?o?j.create(c.concat(n.ranges)):j.create(c):n}}:null}function fx(i){let e=(i==null?void 0:i.eventFilter)||(t=>t.altKey&&t.button==0);return se.mouseSelectionStyle.of((t,n)=>e(n)?ux(t,n):null)}const dx={Alt:[18,i=>!!i.altKey],Control:[17,i=>!!i.ctrlKey],Shift:[16,i=>!!i.shiftKey],Meta:[91,i=>!!i.metaKey]},px={style:"cursor: crosshair"};function mx(i={}){let[e,t]=dx[i.key||"Alt"],n=Ge.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?px:null})]}const Ds="-10000px";class yp{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 h=r[c],u=-1;if(h){for(let f=0;f<this.tooltips.length;f++){let d=this.tooltips[f];d&&d.create==h.create&&(u=f)}if(u<0)o[c]=this.createTooltipView(h,c?o[c-1]:null),a&&(a[c]=!!h.above);else{let f=o[c]=this.tooltipViews[u];a&&(a[c]=t[u]),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,h)=>t[h]=c),t.length=a.length),this.input=s,this.tooltips=r,this.tooltipViews=o,!0}}function gx(i){let{win:e}=i;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}const Ua=ce.define({combine:i=>{var e,t,n;return{position:oe.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)||gx}}}),wp=new WeakMap,Fa=Ge.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(Ua);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 yp(i,ja,(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(Ua);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=Ds,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(oe.gecko)t=r.offsetParent!=this.container.ownerDocument.body;else if(r.style.top==Ds&&r.style.left=="0px"){let o=r.getBoundingClientRect();t=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}}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=xa(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(Ua).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],h=this.manager.tooltipViews[a],{dom:u}=h,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)){u.style.top=Ds;continue}let m=c.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,b=m?7:0,w=d.right-d.left,g=(e=wp.get(h))!==null&&e!==void 0?e:d.bottom-d.top,p=h.offset||_x,O=this.view.textDirection==Ze.LTR,C=d.width>n.right-n.left?O?n.left:n.right-d.width:O?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-b-p.y<n.top:f.bottom+g+b+p.y>n.bottom)&&y==n.bottom-f.bottom>f.top-n.top&&(y=this.above[a]=!y);let E=(y?f.top-n.top:n.bottom-f.bottom)-b;if(E<g&&h.resize!==!1){if(E<this.view.defaultLineHeight){u.style.top=Ds;continue}wp.set(h,g),u.style.height=(g=E)/r+"px"}else u.style.height&&(u.style.height="");let x=y?f.top-g-b-p.y:f.bottom+b+p.y,k=C+w;if(h.overlap!==!0)for(let P of o)P.left<k&&P.right>C&&P.top<x+g&&P.bottom>x&&(x=y?P.top-g-2-b:P.bottom+b+2);if(this.position=="absolute"?(u.style.top=(x-i.parent.top)/r+"px",kp(u,(C-i.parent.left)/s)):(u.style.top=x/r+"px",kp(u,C/s)),m){let P=f.left+(O?p.x:-p.x)-(C+14-7);m.style.left=P/s+"px"}h.overlap!==!0&&o.push({left:C,top:x,right:k,bottom:x+g}),u.classList.toggle("cm-tooltip-above",y),u.classList.toggle("cm-tooltip-below",!y),h.positioned&&h.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=Ds}},{eventObservers:{scroll(){this.maybeMeasure()}}});function kp(i,e){let t=parseInt(i.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(i.style.left=e+"px")}const Ox=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"}}}),_x={x:0,y:0},ja=ce.define({enables:[Fa,Ox]}),io=ce.define({combine:i=>i.reduce((e,t)=>e.concat(t),[])});class no{static create(e){return new no(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new yp(e,io,(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 bx=ja.compute([io],i=>{let e=i.facet(io);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:no.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class yx{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 Wi)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(u=>u.from<=s&&u.to>=s),h=c&&c.dir==Ze.RTL?-1:1;r=t.x<a.left?-h:h}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=>Qt(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(Fa),t=e?e.manager.tooltips.findIndex(n=>n.create==no.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&&!wx(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:!kx(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 so=4;function wx(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-so&&e.clientX<=n+so&&e.clientY>=s-so&&e.clientY<=r+so}function kx(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 xx(i,e={}){let t=we.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 h=Object.assign(Object.create(null),a);h.pos=c,h.end!=null&&(h.end=r.changes.mapPos(h.end)),o.push(h)}}s=o}for(let o of r.effects)o.is(t)&&(s=o.value),o.is(Sx)&&(s=[]);return s},provide:s=>io.from(s)});return{active:n,extension:[n,Ge.define(s=>new yx(s,i,n,t,e.hoverTime||300)),bx]}}function xp(i,e){let t=i.plugin(Fa);if(!t)return null;let n=t.manager.tooltips.indexOf(e);return n<0?null:t.manager.tooltipViews[n]}const Sx=we.define(),Sp=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(Cp),n=t?t.specs.indexOf(e):-1;return n>-1?t.panels[n]:null}const Cp=Ge.fromClass(class{constructor(i){this.input=i.state.facet(Zs),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(i));let e=i.state.facet(Sp);this.top=new ro(i,!0,e.topContainer),this.bottom=new ro(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(Sp);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new ro(i.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new ro(i.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=i.state.facet(Zs);if(t!=this.input){let n=t.filter(c=>c),s=[],r=[],o=[],a=[];for(let c of n){let h=this.specs.indexOf(c),u;h<0?(u=c(i.view),a.push(u)):(u=this.panels[h],u.update&&u.update(i)),s.push(u),(u.top?r:o).push(u)}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 ro{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=Ap(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Ap(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 Ap(i){let e=i.nextSibling;return i.remove(),e}const Zs=ce.define({enables:Cp});class $i extends dn{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}$i.prototype.elementClass="",$i.prototype.toDOM=void 0,$i.prototype.mapMode=ft.TrackBefore,$i.prototype.startSide=$i.prototype.endSide=-1,$i.prototype.point=!0;const oo=ce.define(),Cx=ce.define(),Ax={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Ee.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Is=ce.define();function Qx(i){return[Qp(),Is.of(Object.assign(Object.assign({},Ax),i))]}const qa=ce.define({combine:i=>i.some(e=>e)});function Qp(i){let e=[Px];return i&&i.fixed===!1&&e.push(qa.of(!0)),e}const Px=Ge.fromClass(class{constructor(i){this.view=i,this.prevViewport=i.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=i.state.facet(Is).map(e=>new Tp(i,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!i.state.facet(qa),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),i.scrollDOM.insertBefore(this.dom,i.contentDOM)}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)}i.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(qa)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=i.view.viewport}syncGutters(i){let e=this.dom.nextSibling;i&&this.dom.remove();let t=Ee.iter(this.view.state.facet(oo),this.view.viewport.from),n=[],s=this.gutters.map(r=>new Tx(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==wt.Text&&o){Xa(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==wt.Text){Xa(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)}updateGutters(i){let e=i.startState.facet(Is),t=i.state.facet(Is),n=i.docChanged||i.heightChanged||i.viewportChanged||!Ee.eq(i.startState.facet(oo),i.state.facet(oo),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 Tp(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)this.dom.appendChild(r.dom);this.gutters=s}return n}destroy(){for(let i of this.gutters)i.destroy();this.dom.remove()}},{provide:i=>se.scrollMargins.of(e=>{let t=e.plugin(i);return!t||t.gutters.length==0||!t.fixed?null:e.textDirection==Ze.LTR?{left:t.dom.offsetWidth*e.scaleX}:{right:t.dom.offsetWidth*e.scaleX}})});function Pp(i){return Array.isArray(i)?i:[i]}function Xa(i,e,t){for(;i.value&&i.from<=t;)i.from==t&&e.push(i.value),i.next()}class Tx{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=Ee.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 Ep(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=[];Xa(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(Cx)){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 Tp{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=Pp(t.markers(e)),t.initialSpacer&&(this.spacer=new Ep(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=Pp(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!Ee.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 Ep{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":""),Ex(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,h=!1;if(c){let u=c.elementClass;u&&(n+=" "+u);for(let f=o;f<this.markers.length;f++)if(this.markers[f].compare(c)){a=f,h=!0;break}}else a=this.markers.length;for(;o<a;){let u=this.markers[o++];if(u.toDOM){u.destroy(s);let f=s.nextSibling;s.remove(),s=f}}if(!c)break;c.toDOM&&(h?s=s.nextSibling:this.dom.insertBefore(c.toDOM(e),s)),h&&o++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}function Ex(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 $x=ce.define(),Nx=ce.define(),Fn=ce.define({combine(i){return hi(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,h)=>r(a,c,h)||o(a,c,h):o}return n}})}});class Wa extends $i{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Ya(i,e){return i.state.facet(Fn).formatNumber(e,i.state)}const Rx=Is.compute([Fn],i=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet($x)},lineMarker(e,t,n){return n.some(s=>s.toDOM)?null:new Wa(Ya(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,n)=>{for(let s of e.state.facet(Nx)){let r=s(e,t,n);if(r)return r}return null},lineMarkerChange:e=>e.startState.facet(Fn)!=e.state.facet(Fn),initialSpacer(e){return new Wa(Ya(e,$p(e.state.doc.lines)))},updateSpacer(e,t){let n=Ya(t.view,$p(t.view.state.doc.lines));return n==e.number?e:new Wa(n)},domEventHandlers:i.facet(Fn).domEventHandlers}));function Vx(i={}){return[Fn.of(i),Qp(),Rx]}function $p(i){let e=9;for(;e<i;)e=e*10+9;return e}const Lx=new class extends $i{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},Mx=oo.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(Lx.range(s)))}return Ee.of(e)});function Bx(){return Mx}const Np=1024;let Dx=0;class za{constructor(e,t){this.from=e,this.to=t}}class xe{constructor(e={}){this.id=Dx++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Pt.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}xe.closedBy=new xe({deserialize:i=>i.split(" ")}),xe.openedBy=new xe({deserialize:i=>i.split(" ")}),xe.group=new xe({deserialize:i=>i.split(" ")}),xe.isolate=new xe({deserialize:i=>{if(i&&i!="rtl"&&i!="ltr"&&i!="auto")throw new RangeError("Invalid value for isolate: "+i);return i||"auto"}}),xe.contextHash=new xe({perNode:!0}),xe.lookAhead=new xe({perNode:!0}),xe.mounted=new xe({perNode:!0});class lo{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[xe.mounted.id]}}const vx=Object.create(null);class Pt{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):vx,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new Pt(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(xe.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(xe.group),r=-1;r<(s?s.length:0);r++){let o=t[r<0?n.name:s[r]];if(o)return o}}}}Pt.none=new Pt("",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);o&&(s||(s=Object.assign({},n.props)),s[o[0].id]=o[1])}t.push(s?new Pt(n.name,s,n.id,n.flags):n)}return new Ga(t)}}const ao=new WeakMap,Rp=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=lo.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=ao.get(this)||this.topNode,r=new Ja(s);return r.moveTo(e,t),ao.set(this,r._tree),r}get topNode(){return new Tt(this,0,0,null)}resolve(e,t=0){let n=Us(ao.get(this)||this.topNode,e,t,!1);return ao.set(this,n),n}resolveInner(e,t=0){let n=Us(Rp.get(this)||this.topNode,e,t,!0);return Rp.set(this,n),n}resolveStack(e,t=0){return Ux(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 h=!1;if(c.from<=r&&c.to>=s&&(!a&&c.type.isAnonymous||t(c)!==!1)){if(c.firstChild())continue;h=!0}for(;h&&n&&(a||!c.type.isAnonymous)&&n(c),!c.nextSibling();){if(!c.parent())return;h=!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(Pt.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(Pt.none,t,n,s)))}static build(e){return Fx(e)}}et.empty=new et(Pt.none,[],[],0);class Ha{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 Ha(this.buffer,this.index)}}class Hi{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Pt.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&&!(Vp(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 h=r[c++]=s[a++]-n;r[c++]=s[a++]-e,o=Math.max(o,h)}return new Hi(r,o,this.set)}}function Vp(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 Us(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 Tt&&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 Tt&&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 Lp{cursor(e=0){return new Ja(this,e)}getChild(e,t=null,n=null){let s=Mp(this,e,t,n);return s.length?s[0]:null}getChildren(e,t=null,n=null){return Mp(this,e,t,n)}resolve(e,t=0){return Us(this,e,t,!1)}resolveInner(e,t=0){return Us(this,e,t,!0)}matchContext(e){return Ka(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 Tt extends Lp{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,h=t>0?a.length:-1;e!=h;e+=t){let u=a[e],f=c[e]+o.from;if(Vp(s,n,f,f+u.length)){if(u instanceof Hi){if(r&nt.ExcludeBuffers)continue;let d=u.findChild(0,u.buffer.length,t,n-f,s);if(d>-1)return new mi(new Zx(o,u,e,f),null,d)}else if(r&nt.IncludeAnonymous||!u.type.isAnonymous||ec(u)){let d;if(!(r&nt.IgnoreMounts)&&(d=lo.get(u))&&!d.overlay)return new Tt(d.tree,f,e,o);let m=new Tt(u,f,e,o);return r&nt.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(t<0?u.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)}enter(e,t,n=0){let s;if(!(n&nt.IgnoreOverlays)&&(s=lo.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 Tt(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 Mp(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 Ka(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 Zx{constructor(e,t,n,s){this.parent=e,this.buffer=t,this.index=n,this.start=s}}class mi extends Lp{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 mi(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)}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 mi(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 mi(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 mi(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 Bp(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 Tt&&t.index<0?null:t.parent,s=i.slice();return n?s[e]=n:s.splice(e,1),new Ix(s,t)}class Ix{constructor(e,t){this.heads=e,this.node=t}get next(){return Bp(this.heads)}}function Ux(i,e,t){let n=i.resolveInner(e,t),s=null;for(let r=n instanceof Tt?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=lo.get(r.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new Tt(o.tree,o.overlay[0].from+r.from,-1,r);(s||(s=[n])).push(Us(a,e,t,!1))}}return s?Bp(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 Tt)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 Tt?(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 Hi||!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 mi(this.buffer,t,this.stack[s]);return this.bufferNode=new mi(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 Ka(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 Ka(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 Hi||!e.type.isAnonymous||ec(e))}function Fx(i){var e;let{buffer:t,nodeSet:n,maxBufferLength:s=Np,reused:r=[],minRepeatType:o=n.types.length}=i,a=Array.isArray(t)?new Ha(t,t.length):t,c=n.types,h=0,u=0;function f(E,x,k,P,N,_){let{id:A,start:S,end:M,size:T}=a,I=u,B=h;for(;T<0;)if(a.next(),T==-1){let J=r[A];k.push(J),P.push(S-E);return}else if(T==-3){h=A;return}else if(T==-4){u=A;return}else throw new RangeError(`Unrecognized record size: ${T}`);let U=c[A],Z,K,X=S-E;if(M-S<=s&&(K=g(a.pos-x,N))){let J=new Uint16Array(K.size-K.skip),fe=a.pos-K.size,he=J.length;for(;a.pos>fe;)he=p(K.start,J,he);Z=new Hi(J,M-K.start,n),X=K.start-E}else{let J=a.pos-T;a.next();let fe=[],he=[],ye=A>=o?A:-1,z=0,D=M;for(;a.pos>J;)ye>=0&&a.id==ye&&a.size>=0?(a.end<=D-s&&(b(fe,he,S,z,a.end,D,ye,I,B),z=fe.length,D=a.end),a.next()):_>2500?d(S,J,fe,he):f(S,J,fe,he,ye,_+1);if(ye>=0&&z>0&&z<fe.length&&b(fe,he,S,z,S,D,ye,I,B),fe.reverse(),he.reverse(),ye>-1&&z>0){let V=m(U,B);Z=tc(U,fe,he,0,fe.length,0,M-S,V,V)}else Z=w(U,fe,he,M-S,I-M,B)}k.push(Z),P.push(X)}function d(E,x,k,P){let N=[],_=0,A=-1;for(;a.pos>x;){let{id:S,start:M,end:T,size:I}=a;if(I>4)a.next();else{if(A>-1&&M<A)break;A<0&&(A=T-s),N.push(S,M,T),_++,a.next()}}if(_){let S=new Uint16Array(_*4),M=N[N.length-2];for(let T=N.length-3,I=0;T>=0;T-=3)S[I++]=N[T],S[I++]=N[T+1]-M,S[I++]=N[T+2]-M,S[I++]=I;k.push(new Hi(S,N[2]-M,n)),P.push(M-E)}}function m(E,x){return(k,P,N)=>{let _=0,A=k.length-1,S,M;if(A>=0&&(S=k[A])instanceof et){if(!A&&S.type==E&&S.length==N)return S;(M=S.prop(xe.lookAhead))&&(_=P[A]+S.length+M)}return w(E,k,P,N,_,x)}}function b(E,x,k,P,N,_,A,S,M){let T=[],I=[];for(;E.length>P;)T.push(E.pop()),I.push(x.pop()+k-N);E.push(w(n.types[A],T,I,_-N,S-_,M)),x.push(N-k)}function w(E,x,k,P,N,_,A){if(_){let S=[xe.contextHash,_];A=A?[S].concat(A):[S]}if(N>25){let S=[xe.lookAhead,N];A=A?[S].concat(A):[S]}return new et(E,x,k,P,A)}function g(E,x){let k=a.fork(),P=0,N=0,_=0,A=k.end-s,S={size:0,start:0,skip:0};e:for(let M=k.pos-E;k.pos>M;){let T=k.size;if(k.id==x&&T>=0){S.size=P,S.start=N,S.skip=_,_+=4,P+=4,k.next();continue}let I=k.pos-T;if(T<0||I<M||k.start<A)break;let B=k.id>=o?4:0,U=k.start;for(k.next();k.pos>I;){if(k.size<0)if(k.size==-3)B+=4;else break e;else k.id>=o&&(B+=4);k.next()}N=U,P+=T,_+=B}return(x<0||P==E)&&(S.size=P,S.start=N,S.skip=_),S.size>4?S:void 0}function p(E,x,k){let{id:P,start:N,end:_,size:A}=a;if(a.next(),A>=0&&P<o){let S=k;if(A>4){let M=a.pos-(A-4);for(;a.pos>M;)k=p(E,x,k)}x[--k]=S,x[--k]=_-E,x[--k]=N-E,x[--k]=P}else A==-3?h=P:A==-4&&(u=P);return k}let O=[],C=[];for(;a.pos>0;)f(i.start||0,i.bufferStart||0,O,C,-1,0);let y=(e=i.length)!==null&&e!==void 0?e:O.length?C[0]+O[0].length:0;return new et(c[i.topID],O.reverse(),C.reverse(),y)}const Dp=new WeakMap;function co(i,e){if(!i.isAnonymous||e instanceof Hi||e.type!=i)return 1;let t=Dp.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=i||!(n instanceof et)){t=1;break}t+=co(i,n)}Dp.set(e,t)}return t}function tc(i,e,t,n,s,r,o,a,c){let h=0;for(let b=n;b<s;b++)h+=co(i,e[b]);let u=Math.ceil(h*1.5/8),f=[],d=[];function m(b,w,g,p,O){for(let C=g;C<p;){let y=C,E=w[C],x=co(i,b[C]);for(C++;C<p;C++){let k=co(i,b[C]);if(x+k>=u)break;x+=k}if(C==y+1){if(x>u){let k=b[y];m(k.children,k.positions,0,k.children.length,w[y]+O);continue}f.push(b[y])}else{let k=w[C-1]+b[C-1].length-E;f.push(tc(i,b,w,y,C,E,k,null,c))}d.push(E+O-r)}}return m(e,t,n,s,0),(a||c)(f,d,o)}class jx{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 mi?this.setBuffer(e.context.buffer,e.index,t):e instanceof Tt&&this.map.set(e.tree,t)}get(e){return e instanceof mi?this.getBuffer(e.context.buffer,e.index):e instanceof Tt?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 On{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 On(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,h=0;;a++){let u=a<t.length?t[a]:null,f=u?u.fromA:1e9;if(f-c>=n)for(;o&&o.from<f;){let d=o;if(c>=d.from||f<=d.to||h){let m=Math.max(d.from,c)-h,b=Math.min(d.to,f)-h;d=m>=b?null:new On(m,b,d.tree,d.offset+h,a>0,!!u)}if(d&&s.push(d),o.to>f)break;o=r<e.length?e[r++]:null}if(!u)break;c=u.toA,h=u.toA-u.toB}return s}}class vp{startParse(e,t,n){return typeof e=="string"&&(e=new qx(e)),n=n?n.length?n.map(s=>new za(s.from,s.to)):[new za(0,0)]:[new za(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 qx{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 xe({perNode:!0});let Xx=0;class Ft{constructor(e,t,n,s){this.name=e,this.set=t,this.base=n,this.modified=s,this.id=Xx++}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 Ft&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let s=new Ft(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 ho(e);return n=>n.modified.indexOf(t)>-1?n:ho.get(n.base||n,n.modified.concat(t).sort((s,r)=>s.id-r.id))}}let Wx=0;class ho{constructor(e){this.name=e,this.instances=[],this.id=Wx++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(a=>a.base==e&&Yx(t,a.modified));if(n)return n;let s=[],r=new Ft(e.name,s,e,t);for(let a of t)a.instances.push(r);let o=zx(t);for(let a of e.set)if(!a.modified.length)for(let c of o)s.push(ho.get(a,c));return r}}function Yx(i,e){return i.length==e.length&&i.every((t,n)=>t==e[n])}function zx(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 Zp(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,h=r[c];if(!h)throw new RangeError("Invalid path: "+s);let u=new uo(n,o,c>0?r.slice(0,c):null);e[h]=u.sort(e[h])}}return Ip.add(e)}const Ip=new xe;class uo{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}}uo.empty=new uo([],2,null);function Up(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 h=t[c.id];if(h){o=o?o+" "+h:h;break}}return o},scope:n}}function Gx(i,e){let t=null;for(let n of i){let s=n.style(e);s&&(t=t?t+" "+s:s)}return t}function Hx(i,e,t,n=0,s=i.length){let r=new Kx(n,Array.isArray(e)?e:[e],t);r.highlightRange(i.cursor(),n,s,"",r.highlighters),r.flush(s)}class Kx{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 h=s,u=Jx(e)||uo.empty,f=Gx(r,u.tags);if(f&&(h&&(h+=" "),h+=f,u.mode==1&&(s+=(s?" ":"")+f)),this.startSpan(Math.max(t,a),h),u.opaque)return;let d=e.tree&&e.tree.prop(xe.mounted);if(d&&d.overlay){let m=e.node.enter(d.overlay[0].from+a,1),b=this.highlighters.filter(g=>!g.scope||g.scope(d.tree.type)),w=e.firstChild();for(let g=0,p=a;;g++){let O=g<d.overlay.length?d.overlay[g]:null,C=O?O.from+a:c,y=Math.max(t,p),E=Math.min(n,C);if(y<E&&w)for(;e.from<E&&(this.highlightRange(e,y,E,s,r),this.startSpan(Math.min(E,e.to),h),!(e.to>=C||!e.nextSibling())););if(!O||C>n)break;p=O.to+a,p>t&&(this.highlightRange(m.cursor(),Math.max(t,O.from+a),Math.min(n,p),"",b),this.startSpan(Math.min(n,p),h))}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),h)}while(e.nextSibling());e.parent()}}}function Jx(i){let e=i.type.prop(Ip);for(;e&&e.context&&!i.matchContext(e.context);)e=e.next;return e||null}const ie=Ft.define,fo=ie(),Ki=ie(),Fp=ie(Ki),jp=ie(Ki),Ji=ie(),po=ie(Ji),ic=ie(Ji),gi=ie(),_n=ie(gi),Oi=ie(),_i=ie(),nc=ie(),Fs=ie(nc),mo=ie(),L={comment:fo,lineComment:ie(fo),blockComment:ie(fo),docComment:ie(fo),name:Ki,variableName:ie(Ki),typeName:Fp,tagName:ie(Fp),propertyName:jp,attributeName:ie(jp),className:ie(Ki),labelName:ie(Ki),namespace:ie(Ki),macroName:ie(Ki),literal:Ji,string:po,docString:ie(po),character:ie(po),attributeValue:ie(po),number:ic,integer:ie(ic),float:ie(ic),bool:ie(Ji),regexp:ie(Ji),escape:ie(Ji),color:ie(Ji),url:ie(Ji),keyword:Oi,self:ie(Oi),null:ie(Oi),atom:ie(Oi),unit:ie(Oi),modifier:ie(Oi),operatorKeyword:ie(Oi),controlKeyword:ie(Oi),definitionKeyword:ie(Oi),moduleKeyword:ie(Oi),operator:_i,derefOperator:ie(_i),arithmeticOperator:ie(_i),logicOperator:ie(_i),bitwiseOperator:ie(_i),compareOperator:ie(_i),updateOperator:ie(_i),definitionOperator:ie(_i),typeOperator:ie(_i),controlOperator:ie(_i),punctuation:nc,separator:ie(nc),bracket:Fs,angleBracket:ie(Fs),squareBracket:ie(Fs),paren:ie(Fs),brace:ie(Fs),content:gi,heading:_n,heading1:ie(_n),heading2:ie(_n),heading3:ie(_n),heading4:ie(_n),heading5:ie(_n),heading6:ie(_n),contentSeparator:ie(gi),list:ie(gi),quote:ie(gi),emphasis:ie(gi),strong:ie(gi),link:ie(gi),monospace:ie(gi),strikethrough:ie(gi),inserted:ie(),deleted:ie(),changed:ie(),invalid:ie(),meta:mo,documentMeta:ie(mo),annotation:ie(mo),processingInstruction:ie(mo),definition:Ft.defineModifier("definition"),constant:Ft.defineModifier("constant"),function:Ft.defineModifier("function"),standard:Ft.defineModifier("standard"),local:Ft.defineModifier("local"),special:Ft.defineModifier("special")};for(let i in L){let e=L[i];e instanceof Ft&&(e.name=i)}Up([{tag:L.link,class:"tok-link"},{tag:L.heading,class:"tok-heading"},{tag:L.emphasis,class:"tok-emphasis"},{tag:L.strong,class:"tok-strong"},{tag:L.keyword,class:"tok-keyword"},{tag:L.atom,class:"tok-atom"},{tag:L.bool,class:"tok-bool"},{tag:L.url,class:"tok-url"},{tag:L.labelName,class:"tok-labelName"},{tag:L.inserted,class:"tok-inserted"},{tag:L.deleted,class:"tok-deleted"},{tag:L.literal,class:"tok-literal"},{tag:L.string,class:"tok-string"},{tag:L.number,class:"tok-number"},{tag:[L.regexp,L.escape,L.special(L.string)],class:"tok-string2"},{tag:L.variableName,class:"tok-variableName"},{tag:L.local(L.variableName),class:"tok-variableName tok-local"},{tag:L.definition(L.variableName),class:"tok-variableName tok-definition"},{tag:L.special(L.variableName),class:"tok-variableName2"},{tag:L.definition(L.propertyName),class:"tok-propertyName tok-definition"},{tag:L.typeName,class:"tok-typeName"},{tag:L.namespace,class:"tok-namespace"},{tag:L.className,class:"tok-className"},{tag:L.macroName,class:"tok-macroName"},{tag:L.propertyName,class:"tok-propertyName"},{tag:L.operator,class:"tok-operator"},{tag:L.comment,class:"tok-comment"},{tag:L.meta,class:"tok-meta"},{tag:L.invalid,class:"tok-invalid"},{tag:L.punctuation,class:"tok-punctuation"}]);var sc;const jn=new xe;function qp(i){return ce.define({combine:i?e=>e.concat(i):void 0})}const rc=new xe;class Jt{constructor(e,t,n=[],s=""){this.data=e,this.name=s,Se.prototype.hasOwnProperty("tree")||Object.defineProperty(Se.prototype,"tree",{get(){return st(this)}}),this.parser=t,this.extension=[en.of(this),Se.languageData.of((r,o,a)=>{let c=Xp(r,o,a),h=c.type.prop(jn);if(!h)return[];let u=r.facet(h),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 b=r.facet(m.facet);return m.type=="replace"?b:b.concat(u)}}return u})].concat(n)}isActiveAt(e,t,n=-1){return Xp(e,t,n).type.prop(jn)==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(jn)==this.data){n.push({from:o,to:o+r.length});return}let a=r.prop(xe.mounted);if(a){if(a.tree.prop(jn)==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 h=r.children[c];h instanceof et&&s(h,r.positions[c]+o)}};return s(st(e),0),n}get allowsNesting(){return!0}}Jt.setState=we.define();function Xp(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 go extends Jt{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=qp(e.languageData);return new go(t,e.parser.configure({props:[jn.add(n=>n.isTop?t:void 0)]}),e.name)}configure(e,t){return new go(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function st(i){let e=i.field(Jt.state,!1);return e?e.tree:et.empty}class eS{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 js=null;class Oo{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 Oo(e,t,[],et.empty,0,n,[],null)}startParse(){return this.parser.startParse(new eS(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(On.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(On.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=js;js=this;try{return e()}finally{js=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Wp(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((h,u,f,d)=>c.push({fromA:h,toA:u,fromB:f,toB:d})),n=On.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 h of this.skipped){let u=e.mapPos(h.from,1),f=e.mapPos(h.to,-1);u<f&&a.push({from:u,to:f})}}}return new Oo(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=Wp(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 vp{createParse(t,n,s){let r=s[0].from,o=s[s.length-1].to;return{parsedPos:r,advance(){let c=js;if(c){for(let h of s)c.tempSkipped.push(h);e&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,e]):e)}return this.parsedPos=o,new et(Pt.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 js}}function Wp(i,e,t){return On.applyChanges(i,[{fromA:e,toA:t,fromB:e,toB:t}])}class qn{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 qn(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=Oo.create(e.facet(en).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new qn(n)}}Jt.state=rt.define({create:qn.init,update(i,e){for(let t of e.effects)if(t.is(Jt.setState))return t.value;return e.startState.facet(en)!=e.state.facet(en)?qn.init(e.state):i.apply(e)}});let Yp=i=>{let e=setTimeout(()=>i(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Yp=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,tS=Ge.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(Jt.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(Jt.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Yp(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(Jt.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:Jt.setState.of(new qn(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=>Qt(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=>[Jt.state,tS,se.contentAttributes.compute([i],e=>{let t=e.facet(i);return t&&t.name?{"data-language":t.name}:{}})]});class iS{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const nS=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 _o(i){let e=i.facet(qs);return e.charCodeAt(0)==9?i.tabSize*e.length:e.length}function Xs(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 Se&&(i=new bo(i));for(let n of i.state.facet(nS)){let s=n(i,e);if(s!==void 0)return s}let t=st(i.state);return t.length>=e?sS(i,t,e):null}class bo{constructor(e,t={}){this.state=e,this.options=t,this.unit=_o(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 Ln(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 zp=new xe;function sS(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.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 Gp(n,i,t)}function Gp(i,e,t){for(let n=i;n;n=n.next){let s=oS(n.node);if(s)return s(ac.create(e,t,n))}return 0}function rS(i){return i.pos==i.options.simulateBreak&&i.options.simulateDoubleBreak}function oS(i){let e=i.type.prop(zp);if(e)return e;let t=i.firstChild,n;if(t&&(n=t.type.prop(xe.closedBy))){let s=i.lastChild,r=s&&n.indexOf(s.name)>-1;return o=>Hp(o,!0,1,void 0,r&&!rS(o)?s.from:void 0)}return i.parent==null?lS:null}function lS(){return 0}class ac extends bo{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(aS(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return Gp(this.context.next,this.base,this.pos)}}function aS(i,e){for(let t=e;t;t=t.parent)if(i==t)return!0;return!1}function cS(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 h=/^ */.exec(r.text.slice(t.to-r.from))[0].length;return{from:t.from,to:t.to+h}}a=c.to}}function hS({closing:i,align:e=!0,units:t=1}){return n=>Hp(n,e,t,i)}function Hp(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?cS(i):null;return c?a?i.column(c.from):i.column(c.to):i.baseIndent+(a?0:i.unit*t)}const uS=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 fS=200;function dS(){return Se.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+fS)return i;let r=t.sliceString(s.from,n);if(!e.some(h=>h.test(r)))return i;let{state:o}=i,a=-1,c=[];for(let{head:h}of o.selection.ranges){let u=o.doc.lineAt(h);if(u.from==a)continue;a=u.from;let f=lc(o,u.from);if(f==null)continue;let d=/^\s*/.exec(u.text)[0],m=Xs(o,f);d!=m&&c.push({from:u.from,to:u.from+d.length,insert:m})}return c.length?[i,{changes:c,sequential:!0}]:i})}const pS=ce.define(),Kp=new xe;function mS(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 gS(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(Kp);if(c&&(a.to<n.length-50||n.length==i.doc.length||!OS(a))){let h=c(a,i);h&&h.from<=t&&h.from>=e&&h.to>t&&(r=h)}}return r}function OS(i){let e=i.lastChild;return e&&e.to==i.to&&e.type.isError}function yo(i,e,t){for(let n of i.facet(pS)){let s=n(i,e,t);if(s)return s}return gS(i,e,t)}function Jp(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 wo=we.define({map:Jp}),Ws=we.define({map:Jp});function em(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 bn=rt.define({create(){return de.none},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(wo)&&!_S(i,t.value.from,t.value.to)){let{preparePlaceholder:n}=e.state.facet(hc),s=n?de.replace({widget:new xS(n(e.state,t.value))}):rm;i=i.update({add:[s.range(t.value.from,t.value.to)]})}else t.is(Ws)&&(i=i.update({filter:(n,s)=>t.value.from!=n||t.value.to!=s,filterFrom:t.value.from,filterTo:t.value.to}));if(e.selection){let t=!1,{head:n}=e.selection.main;i.between(n,n,(s,r)=>{s<n&&r>n&&(t=!0)}),t&&(i=i.update({filterFrom:n,filterTo:n,filter:(s,r)=>r<=n||s>=n}))}return 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(rm.range(n,s))}return de.set(e,!0)}});function ko(i,e,t){var n;let s=null;return(n=i.field(bn,!1))===null||n===void 0||n.between(e,t,(r,o)=>{(!s||s.from>r)&&(s={from:r,to:o})}),s}function _S(i,e,t){let n=!1;return i.between(e,e,(s,r)=>{s==e&&r==t&&(n=!0)}),n}function tm(i,e){return i.field(bn,!1)?e:e.concat(we.appendConfig.of(nm()))}const bS=i=>{for(let e of em(i)){let t=yo(i.state,e.from,e.to);if(t)return i.dispatch({effects:tm(i.state,[wo.of(t),im(i,t)])}),!0}return!1},yS=i=>{if(!i.state.field(bn,!1))return!1;let e=[];for(let t of em(i)){let n=ko(i.state,t.from,t.to);n&&e.push(Ws.of(n),im(i,n,!1))}return e.length&&i.dispatch({effects:e}),e.length>0};function im(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 wS=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:bS},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:yS},{key:"Ctrl-Alt-[",run:i=>{let{state:e}=i,t=[];for(let n=0;n<e.doc.length;){let s=i.lineBlockAt(n),r=yo(e,s.from,s.to);r&&t.push(wo.of(r)),n=(r?i.lineBlockAt(r.to):s).to+1}return t.length&&i.dispatch({effects:tm(i.state,t)}),!!t.length}},{key:"Ctrl-Alt-]",run:i=>{let e=i.state.field(bn,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,i.state.doc.length,(n,s)=>{t.push(Ws.of({from:n,to:s}))}),i.dispatch({effects:t}),!0}}],kS={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},hc=ce.define({combine(i){return hi(i,kS)}});function nm(i){let e=[bn,AS];return i&&e.push(hc.of(i)),e}function sm(i,e){let{state:t}=i,n=t.facet(hc),s=o=>{let a=i.lineBlockAt(i.posAtDOM(o.target)),c=ko(i.state,a.from,a.to);c&&i.dispatch({effects:Ws.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 rm=de.replace({widget:new class extends fi{toDOM(i){return sm(i,null)}}});class xS extends fi{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return sm(e,this.value)}}const SS={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class uc extends $i{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 CS(i={}){let e=Object.assign(Object.assign({},SS),i),t=new uc(e,!0),n=new uc(e,!1),s=Ge.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(bn,!1)!=o.state.field(bn,!1)||st(o.startState)!=st(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new Qi;for(let c of o.viewportLineBlocks){let h=ko(o.state,c.from,c.to)?n:yo(o.state,c.from,c.to)?t:null;h&&a.add(c.from,c.from,h)}return a.finish()}}),{domEventHandlers:r}=e;return[s,Qx({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(s))===null||a===void 0?void 0:a.markers)||Ee.empty},initialSpacer(){return new uc(e,!1)},domEventHandlers:Object.assign(Object.assign({},r),{click:(o,a,c)=>{if(r.click&&r.click(o,a,c))return!0;let h=ko(o.state,a.from,a.to);if(h)return o.dispatch({effects:Ws.of(h)}),!0;let u=yo(o.state,a.from,a.to);return u?(o.dispatch({effects:wo.of(u)}),!0):!1}})}),nm()]}const AS=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 Jt?a=>a.prop(jn)==o.data:o?a=>a==o:void 0,this.style=Up(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(),om=ce.define({combine(i){return i.length?[i[0]]:null}});function dc(i){let e=i.facet(fc);return e.length?e:i.facet(om)}function lm(i,e){let t=[PS],n;return i instanceof Ys&&(i.module&&t.push(se.styleModule.of(i.module)),n=i.themeType),e!=null&&e.fallback?t.push(om.of(i)):n?t.push(fc.computeN([se.darkTheme],s=>s.facet(se.darkTheme)==(n=="dark")?[i]:[])):t.push(fc.of(i)),t}class QS{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 de.none;let n=new Qi;for(let{from:s,to:r}of e.visibleRanges)Hx(this.tree,t,(o,a,c)=>{n.add(o,a,this.markCache[c]||(this.markCache[c]=de.mark({class:c})))},s,r);return n.finish()}}const PS=ji.high(Ge.fromClass(QS,{decorations:i=>i.decorations})),TS=Ys.define([{tag:L.meta,color:"#404740"},{tag:L.link,textDecoration:"underline"},{tag:L.heading,textDecoration:"underline",fontWeight:"bold"},{tag:L.emphasis,fontStyle:"italic"},{tag:L.strong,fontWeight:"bold"},{tag:L.strikethrough,textDecoration:"line-through"},{tag:L.keyword,color:"#708"},{tag:[L.atom,L.bool,L.url,L.contentSeparator,L.labelName],color:"#219"},{tag:[L.literal,L.inserted],color:"#164"},{tag:[L.string,L.deleted],color:"#a11"},{tag:[L.regexp,L.escape,L.special(L.string)],color:"#e40"},{tag:L.definition(L.variableName),color:"#00f"},{tag:L.local(L.variableName),color:"#30a"},{tag:[L.typeName,L.namespace],color:"#085"},{tag:L.className,color:"#167"},{tag:[L.special(L.variableName),L.macroName],color:"#256"},{tag:L.definition(L.propertyName),color:"#00c"},{tag:L.comment,color:"#940"},{tag:L.invalid,color:"#f00"}]),ES=se.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),am=1e4,cm="()[]{}",hm=ce.define({combine(i){return hi(i,{afterCursor:!0,brackets:cm,maxScanDistance:am,renderMatch:RS})}}),$S=de.mark({class:"cm-matchingBracket"}),NS=de.mark({class:"cm-nonmatchingBracket"});function RS(i){let e=[],t=i.matched?$S:NS;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 VS=[rt.define({create(){return de.none},update(i,e){if(!e.docChanged&&!e.selection)return i;let t=[],n=e.state.facet(hm);for(let s of e.state.selection.ranges){if(!s.empty)continue;let r=bi(e.state,s.head,-1,n)||s.head>0&&bi(e.state,s.head-1,1,n)||n.afterCursor&&(bi(e.state,s.head,1,n)||s.head<e.state.doc.length&&bi(e.state,s.head+1,-1,n));r&&(t=t.concat(n.renderMatch(r,e.state)))}return de.set(t,!0)},provide:i=>se.decorations.from(i)}),ES];function LS(i={}){return[hm.of(i),VS]}const MS=new xe;function pc(i,e,t){let n=i.prop(e<0?xe.openedBy:xe.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(MS);return e?e(i.node):i}function bi(i,e,t,n={}){let s=n.maxScanDistance||am,r=n.brackets||cm,o=st(i),a=o.resolveInner(e,t);for(let c=a;c;c=c.parent){let h=pc(c.type,t,r);if(h&&c.from<c.to){let u=mc(c);if(u&&(t>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return BS(i,e,t,c,u,h,r)}}return DS(i,e,t,o,a.type,s,r)}function BS(i,e,t,n,s,r,o){let a=n.parent,c={from:s.from,to:s.to},h=0,u=a==null?void 0:a.cursor();if(u&&(t<0?u.childBefore(n.from):u.childAfter(n.to)))do if(t<0?u.to<=n.from:u.from>=n.to){if(h==0&&r.indexOf(u.type.name)>-1&&u.from<u.to){let f=mc(u);return{start:c,end:f?{from:f.from,to:f.to}:void 0,matched:!0}}else if(pc(u.type,t,o))h++;else if(pc(u.type,-t,o)){if(h==0){let f=mc(u);return{start:c,end:f&&f.from<f.to?{from:f.from,to:f.to}:void 0,matched:!1}}h--}}while(t<0?u.prevSibling():u.nextSibling());return{start:c,matched:!1}}function DS(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 h={from:t<0?e-1:e,to:t>0?e+1:e},u=i.doc.iterRange(e,t>0?i.doc.length:0),f=0;for(let d=0;!u.next().done&&d<=r;){let m=u.value;t<0&&(d+=m.length);let b=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(b+w,1).type!=s))if(p%2==0==t>0)f++;else{if(f==1)return{start:h,end:{from:b+w,to:b+w+1},matched:p>>1==c>>1};f--}}t>0&&(d+=m.length)}return u.done?{start:h,matched:!1}:null}const vS=Object.create(null),um=[Pt.none],fm=[],dm=Object.create(null),ZS=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"]])ZS[i]=IS(vS,e);function gc(i,e){fm.indexOf(i)>-1||(fm.push(i),console.warn(e))}function IS(i,e){let t=[];for(let a of e.split(" ")){let c=[];for(let h of a.split(".")){let u=i[h]||L[h];u?typeof u=="function"?c.length?c=c.map(u):gc(h,`Modifier ${h} used at start of tag`):c.length?gc(h,`Tag ${h} used as modifier`):c=Array.isArray(u)?u:[u]:gc(h,`Unknown highlighting tag ${h}`)}for(let h of c)t.push(h)}if(!t.length)return 0;let n=e.replace(/ /g,"_"),s=n+" "+t.map(a=>a.id),r=dm[s];if(r)return r.id;let o=dm[s]=Pt.define({id:um.length,name:n,props:[Zp({[n]:t})]});return um.push(o),o.id}Ze.RTL,Ze.LTR;const US=i=>{let{state:e}=i,t=e.doc.lineAt(e.selection.main.from),n=_c(i.state,t.from);return n.line?FS(i):n.block?qS(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 FS=Oc(YS,0),jS=Oc(pm,0),qS=Oc((i,e)=>pm(i,e,WS(e)),0);function _c(i,e){let t=i.languageDataAt("commentTokens",e);return t.length?t[0]:{}}const zs=50;function XS(i,{open:e,close:t},n,s){let r=i.sliceDoc(n-zs,n),o=i.sliceDoc(s,s+zs),a=/\s*$/.exec(r)[0].length,c=/^\s*/.exec(o)[0].length,h=r.length-a;if(r.slice(h-e.length,h)==e&&o.slice(c,c+t.length)==t)return{open:{pos:n-a,margin:a&&1},close:{pos:s+c,margin:c&&1}};let u,f;s-n<=2*zs?u=f=i.sliceDoc(n,s):(u=i.sliceDoc(n,n+zs),f=i.sliceDoc(s-zs,s));let d=/^\s*/.exec(u)[0].length,m=/\s*$/.exec(f)[0].length,b=f.length-m-t.length;return u.slice(d,d+e.length)==e&&f.slice(b,b+t.length)==t?{open:{pos:n+d+e.length,margin:/\s/.test(u.charAt(d+e.length))?1:0},close:{pos:s-m-t.length,margin:/\s/.test(f.charAt(b-1))?1:0}}:null}function WS(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 pm(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)=>XS(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:h,close:u}=a;r.push({from:h.pos-c.open.length,to:h.pos+h.margin},{from:u.pos-u.margin,to:u.pos+c.close.length})}return{changes:r}}return null}function YS(i,e,t=e.selection.ranges){let n=[],s=-1;for(let{from:r,to:o}of t){let a=n.length,c=1e9,h=_c(e,r).line;if(h){for(let u=r;u<=o;){let f=e.doc.lineAt(u);if(f.from>s&&(r==o||o>f.from)){s=f.from;let d=/^\s*/.exec(f.text)[0].length,m=d==f.length,b=f.text.slice(d,d+h.length)==h?d:-1;d<f.text.length&&d<c&&(c=d),n.push({line:f,comment:b,token:h,indent:d,empty:m,single:!1})}u=f.to+1}if(c<1e9)for(let u=a;u<n.length;u++)n[u].indent<n[u].line.text.length&&(n[u].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:h,empty:u,single:f}of n)(f||!u)&&r.push({from:a.from+h,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 h=o.from+a,u=h+c.length;o.text[u-o.from]==" "&&u++,r.push({from:h,to:u})}return{changes:r}}return null}const bc=Ai.define(),zS=Ai.define(),GS=ce.define(),mm=ce.define({combine(i){return hi(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)})}}),gm=rt.define({create(){return yi.empty},update(i,e){let t=e.state.facet(mm),n=e.annotation(bc);if(n){let c=Et.fromTransaction(e,n.selection),h=n.side,u=h==0?i.undone:i.done;return c?u=So(u,u.length,t.minDepth,c):u=bm(u,e.startState.selection),new yi(h==0?n.rest:u,h==0?u:n.rest)}let s=e.annotation(zS);if((s=="full"||s=="before")&&(i=i.isolate()),e.annotation(Ke.addToHistory)===!1)return e.changes.empty?i:i.addMapping(e.changes.desc);let r=Et.fromTransaction(e),o=e.annotation(Ke.time),a=e.annotation(Ke.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 yi(i.done.map(Et.fromJSON),i.undone.map(Et.fromJSON))}});function HS(i={}){return[gm,mm.of(i),se.domEventHandlers({beforeinput(e,t){let n=e.inputType=="historyUndo"?Om:e.inputType=="historyRedo"?yc:null;return n?(e.preventDefault(),n(t)):!1}})]}function xo(i,e){return function({state:t,dispatch:n}){if(!e&&t.readOnly)return!1;let s=t.field(gm,!1);if(!s)return!1;let r=s.pop(i,t,e);return r?(n(r),!0):!1}}const Om=xo(0,!1),yc=xo(1,!1),KS=xo(0,!0),JS=xo(1,!0);class Et{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 Et(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 Et(e.changes&&it.fromJSON(e.changes),[],e.mapped&&ci.fromJSON(e.mapped),e.startSelection&&j.fromJSON(e.startSelection),e.selectionsAfter.map(j.fromJSON))}static fromTransaction(e,t){let n=jt;for(let s of e.startState.facet(GS)){let r=s(e);r.length&&(n=n.concat(r))}return!n.length&&e.changes.empty?null:new Et(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,jt)}static selection(e){return new Et(void 0,jt,void 0,void 0,e)}}function So(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 eC(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 h=t[c++],u=t[c++];a>=h&&o<=u&&(n=!0)}}),n}function tC(i,e){return i.ranges.length==e.ranges.length&&i.ranges.filter((t,n)=>t.empty!=e.ranges[n].empty).length===0}function _m(i,e){return i.length?e.length?i.concat(e):i:e}const jt=[],iC=200;function bm(i,e){if(i.length){let t=i[i.length-1],n=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-iC));return n.length&&n[n.length-1].eq(e)?i:(n.push(e),So(i,i.length-1,1e9,t.setSelAfter(n)))}else return[Et.selection([e])]}function nC(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=jt;for(;t;){let s=sC(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?[Et.selection(n)]:jt}function sC(i,e,t){let n=_m(i.selectionsAfter.length?i.selectionsAfter.map(a=>a.map(e)):jt,t);if(!i.changes)return Et.selection(n);let s=i.changes.map(e),r=e.mapDesc(i.changes,!0),o=i.mapped?i.mapped.composeDesc(r):r;return new Et(s,we.mapEffects(i.effects,e),o,i.startSelection.map(r),n)}const rC=/^(input\.type|delete)($|\.)/;class yi{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 yi(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||rC.test(n))&&(!a.selectionsAfter.length&&t-this.prevTime<s.newGroupDelay&&s.joinToEvent(r,eC(a.changes,e.changes))||n=="input.type.compose")?o=So(o,o.length-1,s.minDepth,new Et(e.changes.compose(a.changes),_m(we.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,jt)):o=So(o,o.length,s.minDepth,e),new yi(o,jt,t,n)}addSelection(e,t,n,s){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:jt;return r.length>0&&t-this.prevTime<s&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&tC(r[r.length-1],e)?this:new yi(bm(this.done,e),this.undone,t,n)}addMapping(e){return new yi(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:nC(s),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){let a=s.length==1?jt: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}}yi.empty=new yi(jt,jt);const oC=[{key:"Mod-z",run:Om,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:KS,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:JS,preventDefault:!0}];function Xn(i,e){return j.create(i.ranges.map(e),i.mainIndex)}function wi(i,e){return i.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function ei({state:i,dispatch:e},t){let n=Xn(i.selection,t);return n.eq(i.selection,!0)?!1:(e(wi(i,n)),!0)}function Co(i,e){return j.cursor(e?i.to:i.from)}function ym(i,e){return ei(i,t=>t.empty?i.moveByChar(t,e):Co(t,e))}function _t(i){return i.textDirectionAt(i.state.selection.main.head)==Ze.LTR}const wm=i=>ym(i,!_t(i)),km=i=>ym(i,_t(i));function xm(i,e){return ei(i,t=>t.empty?i.moveByGroup(t,e):Co(t,e))}const lC=i=>xm(i,!_t(i)),aC=i=>xm(i,_t(i));function cC(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 Ao(i,e,t){let n=st(i).resolveInner(e.head),s=t?xe.closedBy:xe.openedBy;for(let c=e.head;;){let h=t?n.childAfter(c):n.childBefore(c);if(!h)break;cC(i,h,s)?n=h:c=t?h.to:h.from}let r=n.type.prop(s),o,a;return r&&(o=t?bi(i,n.from,1):bi(i,n.to,-1))&&o.matched?a=t?o.end.to:o.end.from:a=t?n.to:n.from,j.cursor(a,t?-1:1)}const hC=i=>ei(i,e=>Ao(i.state,e,!_t(i))),uC=i=>ei(i,e=>Ao(i.state,e,_t(i)));function Sm(i,e){return ei(i,t=>{if(!t.empty)return Co(t,e);let n=i.moveVertically(t,e);return n.head!=t.head?n:i.moveToLineBoundary(t,e)})}const Cm=i=>Sm(i,!1),Am=i=>Sm(i,!0);function Qm(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 Pm(i,e){let t=Qm(i),{state:n}=i,s=Xn(n.selection,o=>o.empty?i.moveVertically(o,e,t.height):Co(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,h=a.bottom-t.marginBottom;o&&o.top>c&&o.bottom<h&&(r=se.scrollIntoView(s.main.head,{y:"start",yMargin:o.top-c}))}return i.dispatch(wi(n,s),{effects:r}),!0}const Tm=i=>Pm(i,!1),kc=i=>Pm(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=j.cursor(n.from+r))}return s}const fC=i=>ei(i,e=>tn(i,e,!0)),dC=i=>ei(i,e=>tn(i,e,!1)),pC=i=>ei(i,e=>tn(i,e,!_t(i))),mC=i=>ei(i,e=>tn(i,e,_t(i))),gC=i=>ei(i,e=>j.cursor(i.lineBlockAt(e.head).from,1)),OC=i=>ei(i,e=>j.cursor(i.lineBlockAt(e.head).to,-1));function _C(i,e,t){let n=!1,s=Xn(i.selection,r=>{let o=bi(i,r.head,-1)||bi(i,r.head,1)||r.head>0&&bi(i,r.head-1,1)||r.head<i.doc.length&&bi(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?j.range(r.anchor,a):j.cursor(a)});return n?(e(wi(i,s)),!0):!1}const bC=({state:i,dispatch:e})=>_C(i,e,!1);function qt(i,e){let t=Xn(i.state.selection,n=>{let s=e(n);return j.range(n.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return t.eq(i.state.selection)?!1:(i.dispatch(wi(i.state,t)),!0)}function Em(i,e){return qt(i,t=>i.moveByChar(t,e))}const $m=i=>Em(i,!_t(i)),Nm=i=>Em(i,_t(i));function Rm(i,e){return qt(i,t=>i.moveByGroup(t,e))}const yC=i=>Rm(i,!_t(i)),wC=i=>Rm(i,_t(i)),kC=i=>qt(i,e=>Ao(i.state,e,!_t(i))),xC=i=>qt(i,e=>Ao(i.state,e,_t(i)));function Vm(i,e){return qt(i,t=>i.moveVertically(t,e))}const Lm=i=>Vm(i,!1),Mm=i=>Vm(i,!0);function Bm(i,e){return qt(i,t=>i.moveVertically(t,e,Qm(i).height))}const Dm=i=>Bm(i,!1),vm=i=>Bm(i,!0),SC=i=>qt(i,e=>tn(i,e,!0)),CC=i=>qt(i,e=>tn(i,e,!1)),AC=i=>qt(i,e=>tn(i,e,!_t(i))),QC=i=>qt(i,e=>tn(i,e,_t(i))),PC=i=>qt(i,e=>j.cursor(i.lineBlockAt(e.head).from)),TC=i=>qt(i,e=>j.cursor(i.lineBlockAt(e.head).to)),Zm=({state:i,dispatch:e})=>(e(wi(i,{anchor:0})),!0),Im=({state:i,dispatch:e})=>(e(wi(i,{anchor:i.doc.length})),!0),Um=({state:i,dispatch:e})=>(e(wi(i,{anchor:i.selection.main.anchor,head:0})),!0),Fm=({state:i,dispatch:e})=>(e(wi(i,{anchor:i.selection.main.anchor,head:i.doc.length})),!0),EC=({state:i,dispatch:e})=>(e(i.update({selection:{anchor:0,head:i.doc.length},userEvent:"select"})),!0),$C=({state:i,dispatch:e})=>{let t=Po(i).map(({from:n,to:s})=>j.range(n,Math.min(s+1,i.doc.length)));return e(i.update({selection:j.create(t),userEvent:"select"})),!0},NC=({state:i,dispatch:e})=>{let t=Xn(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 j.range(a.to,a.from)}return n});return t.eq(i.selection)?!1:(e(wi(i,t)),!0)},RC=({state:i,dispatch:e})=>{let t=i.selection,n=null;return t.ranges.length>1?n=j.create([t.main]):t.main.empty||(n=j.create([j.cursor(t.main.head)])),n?(e(wi(i,n)),!0):!1};function Gs(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=Qo(i,c,!1)):c>o&&(t="delete.forward",c=Qo(i,c,!0)),o=Math.min(o,c),a=Math.max(a,c)}else o=Qo(i,o,!1),a=Qo(i,a,!0);return o==a?{range:r}:{changes:{from:o,to:a},range:j.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 Qo(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 jm=(i,e,t)=>Gs(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 h=Ln(a,r.tabSize),u=h%_o(r)||_o(r);for(let f=0;f<u&&a[a.length-1-f]==" ";f++)s--;c=s}else c=ut(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=ut(o.text,c-o.from,!1,!1)+o.from);return c}),xc=i=>jm(i,!1,!0),qm=i=>jm(i,!0,!1),Xm=(i,e)=>Gs(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=ut(r.text,n-r.from,e)+r.from,h=r.text.slice(Math.min(n,c)-r.from,Math.max(n,c)-r.from),u=o(h);if(a!=null&&u!=a)break;(h!=" "||n!=t.head)&&(a=u),n=c}return n}),Wm=i=>Xm(i,!1),VC=i=>Xm(i,!0),LC=i=>Gs(i,e=>{let t=i.lineBlockAt(e.head).to;return e.head<t?t:Math.min(i.state.doc.length,e.head+1)}),MC=i=>Gs(i,e=>{let t=i.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),BC=i=>Gs(i,e=>{let t=i.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(i.state.doc.length,e.head+1)}),DC=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=i.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:Ae.of(["",""])},range:j.cursor(n.from)}));return e(i.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},vC=({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:ut(r.text,s-r.from,!1)+r.from,a=s==r.to?s+1:ut(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:j.cursor(a)}});return t.changes.empty?!1:(e(i.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Po(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 Ym(i,e,t){if(i.readOnly)return!1;let n=[],s=[];for(let r of Po(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(j.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(j.range(c.anchor-a,c.head-a))}}return n.length?(e(i.update({changes:n,scrollIntoView:!0,selection:j.create(s,i.selection.mainIndex),userEvent:"move.line"})),!0):!1}const ZC=({state:i,dispatch:e})=>Ym(i,e,!1),IC=({state:i,dispatch:e})=>Ym(i,e,!0);function zm(i,e,t){if(i.readOnly)return!1;let n=[];for(let s of Po(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 UC=({state:i,dispatch:e})=>zm(i,e,!1),FC=({state:i,dispatch:e})=>zm(i,e,!0),jC=i=>{if(i.state.readOnly)return!1;let{state:e}=i,t=e.changes(Po(e).map(({from:s,to:r})=>(s>0?s--:r<e.doc.length&&r++,{from:s,to:r}))),n=Xn(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 qC(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(xe.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 Gm=Hm(!1),XC=Hm(!0);function Hm(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&&qC(e,r);i&&(r=o=(o<=a.to?a:e.doc.lineAt(o)).to);let h=new bo(e,{simulateBreak:r,simulateDoubleBreak:!!c}),u=lc(h,r);for(u==null&&(u=Ln(/^\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=["",Xs(e,u)];return c&&f.push(Xs(e,h.lineIndent(a.from,-1))),{changes:{from:r,to:o,insert:Ae.of(f)},range:j.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:j.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}})}const WC=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=Object.create(null),n=new bo(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 h=/^\s*/.exec(r.text)[0],u=Xs(i,c);(h!=u||a.from<r.from+h.length)&&(t[r.from]=c,o.push({from:r.from,to:r.from+h.length,insert:u}))});return s.changes.empty||e(i.update(s,{userEvent:"indent"})),!0},Km=({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),Jm=({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=Ln(s,i.tabSize),o=0,a=Xs(i,Math.max(0,r-_o(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),YC=i=>(i.setTabFocusMode(),!0),zC=[{key:"Ctrl-b",run:wm,shift:$m,preventDefault:!0},{key:"Ctrl-f",run:km,shift:Nm},{key:"Ctrl-p",run:Cm,shift:Lm},{key:"Ctrl-n",run:Am,shift:Mm},{key:"Ctrl-a",run:gC,shift:PC},{key:"Ctrl-e",run:OC,shift:TC},{key:"Ctrl-d",run:qm},{key:"Ctrl-h",run:xc},{key:"Ctrl-k",run:LC},{key:"Ctrl-Alt-h",run:Wm},{key:"Ctrl-o",run:DC},{key:"Ctrl-t",run:vC},{key:"Ctrl-v",run:kc}],GC=[{key:"ArrowLeft",run:wm,shift:$m,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:lC,shift:yC,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:pC,shift:AC,preventDefault:!0},{key:"ArrowRight",run:km,shift:Nm,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:aC,shift:wC,preventDefault:!0},{mac:"Cmd-ArrowRight",run:mC,shift:QC,preventDefault:!0},{key:"ArrowUp",run:Cm,shift:Lm,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Zm,shift:Um},{mac:"Ctrl-ArrowUp",run:Tm,shift:Dm},{key:"ArrowDown",run:Am,shift:Mm,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Im,shift:Fm},{mac:"Ctrl-ArrowDown",run:kc,shift:vm},{key:"PageUp",run:Tm,shift:Dm},{key:"PageDown",run:kc,shift:vm},{key:"Home",run:dC,shift:CC,preventDefault:!0},{key:"Mod-Home",run:Zm,shift:Um},{key:"End",run:fC,shift:SC,preventDefault:!0},{key:"Mod-End",run:Im,shift:Fm},{key:"Enter",run:Gm,shift:Gm},{key:"Mod-a",run:EC},{key:"Backspace",run:xc,shift:xc},{key:"Delete",run:qm},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Wm},{key:"Mod-Delete",mac:"Alt-Delete",run:VC},{mac:"Mod-Backspace",run:MC},{mac:"Mod-Delete",run:BC}].concat(zC.map(i=>({mac:i.key,run:i.run,shift:i.shift}))),HC=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:hC,shift:kC},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:uC,shift:xC},{key:"Alt-ArrowUp",run:ZC},{key:"Shift-Alt-ArrowUp",run:UC},{key:"Alt-ArrowDown",run:IC},{key:"Shift-Alt-ArrowDown",run:FC},{key:"Escape",run:RC},{key:"Mod-Enter",run:XC},{key:"Alt-l",mac:"Ctrl-l",run:$C},{key:"Mod-i",run:NC,preventDefault:!0},{key:"Mod-[",run:Jm},{key:"Mod-]",run:Km},{key:"Mod-Alt-\\",run:WC},{key:"Shift-Mod-k",run:jC},{key:"Shift-Mod-\\",run:bC},{key:"Mod-/",run:US},{key:"Alt-A",run:jS},{key:"Ctrl-m",mac:"Shift-Alt-m",run:YC}].concat(GC),KC={key:"Tab",run:Km,shift:Jm};function ve(){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++)eg(i,arguments[e]);return i}function eg(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++)eg(i,e[t]);else throw new RangeError("Unsupported child node: "+e)}const tg=typeof String.prototype.normalize=="function"?i=>i.normalize("NFKD"):i=>i;class Wn{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(tg(a)):tg,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 Ct(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=Dl(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=ai(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"&&(Wn.prototype[Symbol.iterator]=function(){return this});const ig={from:-1,to:-1,match:/.*/.exec("")},Cc="gm"+(/x/.unicode==null?"":"u");class ng{constructor(e,t,n,s=0,r=e.length){if(this.text=e,this.to=r,this.curLine="",this.done=!1,this.value=ig,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new sg(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=To(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=To(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 Yn{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 Yn(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 Yn(o,r)),new Yn(t,r.slice(t-o,n-o))}}class sg{constructor(e,t,n,s,r){this.text=e,this.to=r,this.done=!1,this.value=ig,this.matchPos=To(e,s),this.re=new RegExp(t,Cc+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.flat=Yn.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=To(this.text,s+(n==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Yn.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(ng.prototype[Symbol.iterator]=sg.prototype[Symbol.iterator]=function(){return this});function JC(i){try{return new RegExp(i,Cc),!0}catch{return!1}}function To(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 Qc(i){let e=String(i.state.doc.lineAt(i.state.selection.main.head).number),t=ve("input",{class:"cm-textfield",name:"line",value:e}),n=ve("form",{class:"cm-gotoLine",onkeydown:r=>{r.keyCode==27?(r.preventDefault(),i.dispatch({effects:Eo.of(!1)}),i.focus()):r.keyCode==13&&(r.preventDefault(),s())},onsubmit:r=>{r.preventDefault(),s()}},ve("label",i.state.phrase("Go to line"),": ",t)," ",ve("button",{class:"cm-button",type:"submit"},i.state.phrase("go")));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,h,u,f]=r,d=u?+u.slice(1):0,m=h?+h:a.number;if(h&&f){let g=m/100;c&&(g=g*(c=="-"?-1:1)+a.number/o.doc.lines),m=Math.round(o.doc.lines*g)}else h&&c&&(m=m*(c=="-"?-1:1)+a.number);let b=o.doc.line(Math.max(1,Math.min(o.doc.lines,m))),w=j.cursor(b.from+Math.max(0,Math.min(d,b.length)));i.dispatch({effects:[Eo.of(!1),se.scrollIntoView(w.from,{y:"center"})],selection:w}),i.focus()}return{dom:n}}const Eo=we.define(),rg=rt.define({create(){return!0},update(i,e){for(let t of e.effects)t.is(Eo)&&(i=t.value);return i},provide:i=>Zs.from(i,e=>e?Qc:null)}),eA=i=>{let e=vs(i,Qc);if(!e){let t=[Eo.of(!0)];i.state.field(rg,!1)==null&&t.push(we.appendConfig.of([rg,tA])),i.dispatch({effects:t}),e=vs(i,Qc)}return e&&e.dom.querySelector("input").select(),!0},tA=se.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),iA={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},og=ce.define({combine(i){return hi(i,iA,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function nA(i){let e=[aA,lA];return i&&e.push(og.of(i)),e}const sA=de.mark({class:"cm-selectionMatch"}),rA=de.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function lg(i,e,t,n){return(t==0||i(e.sliceDoc(t-1,t))!=je.Word)&&(n==e.doc.length||i(e.sliceDoc(n,n+1))!=je.Word)}function oA(i,e,t,n){return i(e.sliceDoc(t,t+1))==je.Word&&i(e.sliceDoc(n-1,n))==je.Word}const lA=Ge.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(og),{state:t}=i,n=t.selection;if(n.ranges.length>1)return de.none;let s=n.main,r,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return de.none;let c=t.wordAt(s.head);if(!c)return de.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 de.none;if(e.wholeWords){if(r=t.sliceDoc(s.from,s.to),o=t.charCategorizer(s.head),!(lg(o,t,s.from,s.to)&&oA(o,t,s.from,s.to)))return de.none}else if(r=t.sliceDoc(s.from,s.to),!r)return de.none}let a=[];for(let c of i.visibleRanges){let h=new Wn(t.doc,r,c.from,c.to);for(;!h.next().done;){let{from:u,to:f}=h.value;if((!o||lg(o,t,u,f))&&(s.empty&&u<=s.from&&f>=s.to?a.push(rA.range(u,f)):(u>=s.to||f<=s.from)&&a.push(sA.range(u,f)),a.length>e.maxMatches))return de.none}}return de.set(a)}},{decorations:i=>i.decorations}),aA=se.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),cA=({state:i,dispatch:e})=>{let{selection:t}=i,n=j.create(t.ranges.map(s=>i.wordAt(s.head)||j.cursor(s.head)),t.mainIndex);return n.eq(t)?!1:(e(i.update({selection:n})),!0)};function hA(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 Wn(i.doc,e,n[n.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new Wn(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 uA=({state:i,dispatch:e})=>{let{ranges:t}=i.selection;if(t.some(r=>r.from===r.to))return cA({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=hA(i,n);return s?(e(i.update({selection:i.selection.addRange(j.range(s.from,s.to),!1),effects:se.scrollIntoView(s.to)})),!0):!1},zn=ce.define({combine(i){return hi(i,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new xA(e),scrollToMatch:e=>se.scrollIntoView(e)})}});class ag{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||JC(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"?`
|
|
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 Xi={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:'"'},rw=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++)Xi[48+dt]=Xi[96+dt]=String(dt);for(var dt=1;dt<=24;dt++)Xi[dt+111]="F"+dt;for(var dt=65;dt<=90;dt++)Xi[dt]=String.fromCharCode(dt+32),ks[dt]=String.fromCharCode(dt);for(var na in Xi)ks.hasOwnProperty(na)||(ks[na]=Xi[na]);function lw(i){var e=rw&&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:Xi)[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 xs(i){let e;return i.nodeType==11?e=i.getSelection?i:i.ownerDocument:e=i,e.getSelection()}function sa(i,e){return e?i==e||i.contains(e.nodeType!=1?e.parentNode:e):!1}function Vr(i,e){if(!e.anchorNode)return!1;try{return sa(i,e.anchorNode)}catch{return!1}}function Mn(i){return i.nodeType==3?mn(i,0,i.nodeValue.length).getClientRects():i.nodeType==1?i.getClientRects():[]}function Ss(i,e,t,n){return t?Rf(i,e,t,n,-1)||Rf(i,e,t,n,1):!1}function pn(i){for(var e=0;;e++)if(i=i.previousSibling,!i)return e}function Lr(i){return i.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(i.nodeName)}function Rf(i,e,t,n,s){for(;;){if(i==t&&e==n)return!0;if(e==(s<0?0:ui(i))){if(i.nodeName=="DIV")return!1;let r=i.parentNode;if(!r||r.nodeType!=1)return!1;e=pn(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?ui(i):0}else return!1}}function ui(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 aw(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 Vf(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 cw(i,e,t,n,s,r,o,a){let c=i.ownerDocument,h=c.defaultView||window;for(let u=i,f=!1;u&&!f;)if(u.nodeType==1){let d,m=u==c.body,b=1,w=1;if(m)d=aw(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(f=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let O=u.getBoundingClientRect();({scaleX:b,scaleY:w}=Vf(u,O)),d={left:O.left,right:O.left+u.clientWidth*b,top:O.top,bottom:O.top+u.clientHeight*w}}let g=0,p=0;if(s=="nearest")e.top<d.top?(p=-(d.top-e.top+o),t>0&&e.bottom>d.bottom+p&&(p=e.bottom-d.bottom+p+o)):e.bottom>d.bottom&&(p=e.bottom-d.bottom+o,t<0&&e.top-p<d.top&&(p=-(d.top+p-e.top+o)));else{let O=e.bottom-e.top,C=d.bottom-d.top;p=(s=="center"&&O<=C?e.top+O/2-C/2:s=="start"||s=="center"&&t<0?e.top-o:e.bottom-C+o)-d.top}if(n=="nearest"?e.left<d.left?(g=-(d.left-e.left+r),t>0&&e.right>d.right+g&&(g=e.right-d.right+g+r)):e.right>d.right&&(g=e.right-d.right+r,t<0&&e.left<d.left+g&&(g=-(d.left+g-e.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)h.scrollBy(g,p);else{let O=0,C=0;if(p){let y=u.scrollTop;u.scrollTop+=p/w,C=(u.scrollTop-y)*w}if(g){let y=u.scrollLeft;u.scrollLeft+=g/b,O=(u.scrollLeft-y)*b}e={left:e.left-O,top:e.top-C,right:e.right-O,bottom:e.bottom-C},O&&Math.abs(O-g)<1&&(n="nearest"),C&&Math.abs(C-p)<1&&(s="nearest")}if(m)break;u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function hw(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 uw{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?ui(t):0),n,Math.min(e.focusOffset,n?ui(n):0))}set(e,t,n,s){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=s}}let Bn=null;function Lf(i){if(i.setActive)return i.setActive();if(Bn)return i.focus(Bn);let e=[];for(let t=i;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(i.focus(Bn==null?{get preventScroll(){return Bn={preventScroll:!0},!0}}:void 0),!Bn){Bn=!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 Mf;function mn(i,e,t=e){let n=Mf||(Mf=document.createRange());return n.setEnd(i,t),n.setStart(i,e),n}function Dn(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 fw(i){for(;i;){if(i&&(i.nodeType==9||i.nodeType==11&&i.host))return i;i=i.assignedSlot||i.parentNode}return null}function Bf(i){for(;i.attributes.length;)i.removeAttributeNode(i.attributes[0])}function dw(i,e){let t=e.focusNode,n=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=n)return!1;for(n=Math.min(n,ui(t));;)if(n){if(t.nodeType!=1)return!1;let s=t.childNodes[n-1];s.contentEditable=="false"?n--:(t=s,n=ui(t))}else{if(t==i)return!0;n=pn(t),t=t.parentNode}}function Df(i){return i.scrollTop>Math.max(1,i.scrollHeight-i.clientHeight-4)}function vf(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=ui(t)}else if(t.parentNode&&!Lr(t))n=pn(t),t=t.parentNode;else return null}}function Zf(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&&!Lr(t))n=pn(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,pn(e),t)}static after(e,t){return new Ot(e.parentNode,pn(e)+1,t)}}const ra=[];class Be{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=Be.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=If(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=If(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=ui(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&&!Be.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,h=n,u=n;c<this.children.length;c++){let f=this.children[c],d=h+f.length;if(h<e&&d>t)return f.domBoundsAround(e,t,h);if(d>=e&&s==-1&&(s=c,r=h),h>t&&f.dom.parentNode==this.dom){o=c,a=u;break}u=d,h=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=ra){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 Uf(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}}Be.prototype.breakAfter=0;function If(i){let e=i.nextSibling;return i.parentNode.removeChild(i),e}class Uf{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 Ff(i,e,t,n,s,r,o,a,c){let{children:h}=i,u=h.length?h[e]:null,f=r.length?r[r.length-1]:null,d=f?f.breakAfter:o;if(!(e==n&&u&&!o&&!d&&r.length<2&&u.merge(t,s,r.length?f:null,t==0,a,c))){if(n<h.length){let m=h[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(u&&(u.breakAfter=o,t>0&&(!o&&r.length&&u.merge(t,u.length,r[0],!1,a,0)?u.breakAfter=r.shift().breakAfter:(t<u.length||u.children.length&&u.children[u.children.length-1].length==0)&&u.merge(t,u.length,null,!1,a,0),e++));e<n&&r.length;)if(h[n-1].become(r[r.length-1]))n--,r.pop(),c=r.length?0:a;else if(h[e].become(r[0]))e++,r.shift(),a=r.length?0:c;else break;!r.length&&e&&n<h.length&&!h[e-1].breakAfter&&h[n].merge(0,0,h[e-1],!1,a,c)&&e--,(e<n||r.length)&&i.replaceChildren(e,n,r)}}function jf(i,e,t,n,s,r){let o=i.childCursor(),{i:a,off:c}=o.findPos(t,1),{i:h,off:u}=o.findPos(e,-1),f=e-t;for(let d of n)f+=d.length;i.length+=f,Ff(i,h,u,a,c,n,0,s,r)}let At=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},oa=typeof document<"u"?document:{documentElement:{style:{}}};const la=/Edge\/(\d+)/.exec(At.userAgent),qf=/MSIE \d/.test(At.userAgent),aa=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(At.userAgent),Mr=!!(qf||aa||la),Xf=!Mr&&/gecko\/(\d+)/i.test(At.userAgent),ca=!Mr&&/Chrome\/(\d+)/.exec(At.userAgent),Wf="webkitFontSmoothing"in oa.documentElement.style,Yf=!Mr&&/Apple Computer/.test(At.vendor),zf=Yf&&(/Mobile\/\w+/.test(At.userAgent)||At.maxTouchPoints>2);var le={mac:zf||/Mac/.test(At.platform),windows:/Win/.test(At.platform),linux:/Linux|X11/.test(At.platform),ie:Mr,ie_version:qf?oa.documentMode||6:aa?+aa[1]:la?+la[1]:0,gecko:Xf,gecko_version:Xf?+(/Firefox\/(\d+)/.exec(At.userAgent)||[0,0])[1]:0,chrome:!!ca,chrome_version:ca?+ca[1]:0,ios:zf,android:/Android\b/.test(At.userAgent),webkit:Wf,safari:Yf,webkit_version:Wf?+(/\bAppleWebKit\/(\d+)/.exec(At.userAgent)||[0,0])[1]:0,tabSize:oa.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const pw=256;class Ht extends Be{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>pw||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 mw(this.dom,e,t)}}class Pi extends Be{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(Bf(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 Pi&&n.mark.eq(this.mark))||e&&r<=0||t<this.length&&o<=0)?!1:(jf(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 Pi(this.mark,t,o)}domAtPos(e){return Gf(this,e)}coordsAt(e,t){return Kf(this,e,t)}}function mw(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?le.chrome||le.gecko||(e?(s--,o=1):r<n&&(r++,o=-1)):t<0?s--:r<n&&r++;let a=mn(i,s,r).getClientRects();if(!a.length)return null;let c=a[(o?o<0:t>=0)?0:a.length-1];return le.safari&&!o&&c.width==0&&(c=Array.prototype.find.call(a,h=>h.width)||c),o?Cs(c,o<0):c||null}class Wi extends Be{static create(e,t,n){return new Wi(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=Wi.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 Wi)||!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 Wi&&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 Ae.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):Ae.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 vn extends Be{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof vn&&e.side==this.side}split(){return new vn(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 Ae.empty}get isHidden(){return!0}}Ht.prototype.children=Wi.prototype.children=vn.prototype.children=ra;function Gf(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 Hf(i,e,t){let n,{children:s}=i;t>0&&e instanceof Pi&&s.length&&(n=s[s.length-1])instanceof Pi&&n.mark.eq(e.mark)?Hf(n,e.children[0],t-1):(s.push(e),e.setParent(i)),i.length+=e.length}function Kf(i,e,t){let n=null,s=-1,r=null,o=-1;function a(h,u){for(let f=0,d=0;f<h.children.length&&d<=u;f++){let m=h.children[f],b=d+m.length;b>=u&&(m.children.length?a(m,u-d):(!r||r.isHidden&&t>0)&&(b>u||d==b&&m.getSide()>0)?(r=m,o=u-d):(d<u||d==b&&m.getSide()<0&&!m.isHidden)&&(n=m,s=u-d)),d=b}}a(i,e);let c=(t<0?n:r)||n||r;return c?c.coordsAt(Math.max(0,c==n?s:o),t):gw(i)}function gw(i){let e=i.dom.lastChild;if(!e)return i.dom.getBoundingClientRect();let t=Mn(e);return t[t.length-1]||null}function ha(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 Jf=Object.create(null);function Br(i,e,t){if(i==e)return!0;i||(i=Jf),e||(e=Jf);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 ua(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 Ow(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 fi{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 wt=function(i){return i[i.Text=0]="Text",i[i.WidgetBefore=1]="WidgetBefore",i[i.WidgetAfter=2]="WidgetAfter",i[i.WidgetRange=3]="WidgetRange",i}(wt||(wt={}));class de extends dn{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 Yi(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}=ed(e,t);n=(r?t?-3e8:-1:5e8)-1,s=(o?t?2e8:1:-6e8)+1}return new Yi(e,n,s,t,e.widget||null,!0)}static line(e){return new Qs(e)}static set(e,t=!1){return Ee.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}de.none=Ee.empty;class As extends de{constructor(e){let{start:t,end:n}=ed(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))&&Br(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 Qs extends de{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Qs&&this.spec.class==e.spec.class&&Br(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)}}Qs.prototype.mapMode=ft.TrackBefore,Qs.prototype.point=!0;class Yi extends de{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?wt.WidgetRange:this.startSide<=0?wt.WidgetBefore:wt.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Yi&&_w(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)}}Yi.prototype.point=!0;function ed(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 _w(i,e){return i==e||!!(i&&e&&i.compare(e))}function Dr(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 Be{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),jf(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){Br(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Hf(this,e,t)}addLineDeco(e){let t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=ha(t,this.attrs||{})),n&&(this.attrs=ha({class:n},this.attrs||{}))}domAtPos(e){return Gf(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var n;this.dom?this.flags&4&&(Bf(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&&(ua(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&&Be.get(s)instanceof Pi;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((n=Be.get(s))===null||n===void 0?void 0:n.isEditable)==!1&&(!le.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=Mn(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=Kf(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&&Br(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 Ti extends Be{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 Ti)||!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 Ti(this.widget,t,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return ra}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):Ae.empty}domBoundsAround(){return null}become(e){return e instanceof Ti&&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 fa?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 fa extends fi{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 Ti&&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(vr(new vn(-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 Ti)&&this.getLine()}buildText(e,t,n){for(;e>0;){if(this.textOff==this.text.length){let{value:r,lineBreak:o,done:a}=this.cursor.next(this.skip);if(this.skip=0,a)throw new Error("Ran out of text content when drawing inline views");if(o){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=r,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-n)),this.getLine().append(vr(new Ht(this.text.slice(this.textOff,this.textOff+s)),t),n),this.atCursorPos=!0,this.textOff+=s,e-=s,n=0}}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 Yi){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 Yi)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Ti(n.widget||Zn.block,a,n));else{let c=Wi.create(n.widget||Zn.inline,a,a?0:n.startSide),h=this.atCursorPos&&!c.isEditable&&r<=s.length&&(e<t||n.startSide>0),u=!c.isEditable&&(e<t||r>s.length||n.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!h&&!c.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),h&&(f.append(vr(new vn(1),s),r),r=s.length+Math.max(0,r-s.length)),f.append(vr(c,s),r),this.atCursorPos=u,this.pendingBuffer=u?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=Ee.spans(s,t,n,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function vr(i,e){for(let t of e)i=new Pi(t,[i],i.length);return i}class Zn extends fi{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 Ze=function(i){return i[i.LTR=0]="LTR",i[i.RTL=1]="RTL",i}(Ze||(Ze={}));const gn=Ze.LTR,da=Ze.RTL;function td(i){let e=[];for(let t=0;t<i.length;t++)e.push(1<<+i[t]);return e}const bw=td("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),yw=td("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),pa=Object.create(null),di=[];for(let i of["()","[]","{}"]){let e=i.charCodeAt(0),t=i.charCodeAt(1);pa[e]=t,pa[t]=-e}function id(i){return i<=247?bw[i]:1424<=i&&i<=1524?2:1536<=i&&i<=1785?yw[i-1536]:1774<=i&&i<=2220?4:8192<=i&&i<=8204?256:64336<=i&&i<=65023?4:1}const ww=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class zi{get dir(){return this.level%2?da:gn}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 nd(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||!nd(n.inner,s.inner))return!1}return!0}const De=[];function kw(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 h=o,u=c,f=c;h<a;h++){let d=id(i.charCodeAt(h));d==512?d=u:d==8&&f==4&&(d=16),De[h]=d==4?2:d,d&7&&(f=d),u=d}for(let h=o,u=c,f=c;h<a;h++){let d=De[h];if(d==128)h<a-1&&u==De[h+1]&&u&24?d=De[h]=u:De[h]=256;else if(d==64){let m=h+1;for(;m<a&&De[m]==64;)m++;let b=h&&u==8||m<t&&De[m]==8?f==1?1:8:256;for(let w=h;w<m;w++)De[w]=b;h=m-1}else d==8&&f==1&&(De[h]=1);u=d,d&7&&(f=d)}}}function xw(i,e,t,n,s){let r=s==1?2:1;for(let o=0,a=0,c=0;o<=n.length;o++){let h=o?n[o-1].to:e,u=o<n.length?n[o].from:t;for(let f=h,d,m,b;f<u;f++)if(m=pa[d=i.charCodeAt(f)])if(m<0){for(let w=a-3;w>=0;w-=3)if(di[w+1]==-m){let g=di[w+2],p=g&2?s:g&4?g&1?r:s:0;p&&(De[f]=De[di[w]]=p),a=w;break}}else{if(di.length==189)break;di[a++]=f,di[a++]=d,di[a++]=c}else if((b=De[f])==2||b==1){let w=b==s;c=w?0:1;for(let g=a-3;g>=0;g-=3){let p=di[g+2];if(p&2)break;if(w)di[g+2]|=2;else{if(p&4)break;di[g+2]|=4}}}}}function Sw(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 h=De[c];if(h==256){let u=c+1;for(;;)if(u==a){if(s==t.length)break;u=t[s++].to,a=s<t.length?t[s].from:e}else if(De[u]==256)u++;else break;let f=r==1,d=(u<e?De[u]:n)==1,m=f==d?f?1:2:n;for(let b=u,w=s,g=w?t[w-1].to:i;b>c;)b==g&&(b=t[--w].from,g=w?t[w-1].to:i),De[--b]=m;c=u}else r=h,c++}}}function ma(i,e,t,n,s,r,o){let a=n%2?2:1;if(n%2==s%2)for(let c=e,h=0;c<t;){let u=!0,f=!1;if(h==r.length||c<r[h].from){let w=De[c];w!=a&&(u=!1,f=w==16)}let d=!u&&a==1?[]:null,m=u?n:n+1,b=c;e:for(;;)if(h<r.length&&b==r[h].from){if(f)break e;let w=r[h];if(!u)for(let g=w.to,p=h+1;;){if(g==t)break e;if(p<r.length&&r[p].from==g)g=r[p++].to;else{if(De[g]==a)break e;break}}if(h++,d)d.push(w);else{w.from>c&&o.push(new zi(c,w.from,m));let g=w.direction==gn!=!(m%2);ga(i,g?n+1:n,s,w.inner,w.from,w.to,o),c=w.to}b=w.to}else{if(b==t||(u?De[b]!=a:De[b]==a))break;b++}d?ma(i,c,b,n+1,s,d,o):c<b&&o.push(new zi(c,b,m)),c=b}else for(let c=t,h=r.length;c>e;){let u=!0,f=!1;if(!h||c>r[h-1].to){let w=De[c-1];w!=a&&(u=!1,f=w==16)}let d=!u&&a==1?[]:null,m=u?n:n+1,b=c;e:for(;;)if(h&&b==r[h-1].to){if(f)break e;let w=r[--h];if(!u)for(let g=w.from,p=h;;){if(g==e)break e;if(p&&r[p-1].to==g)g=r[--p].from;else{if(De[g-1]==a)break e;break}}if(d)d.push(w);else{w.to<c&&o.push(new zi(w.to,c,m));let g=w.direction==gn!=!(m%2);ga(i,g?n+1:n,s,w.inner,w.from,w.to,o),c=w.from}b=w.from}else{if(b==e||(u?De[b-1]!=a:De[b-1]==a))break;b--}d?ma(i,b,c,n+1,s,d,o):b<c&&o.push(new zi(b,c,m)),c=b}}function ga(i,e,t,n,s,r,o){let a=e%2?2:1;kw(i,s,r,n,a),xw(i,s,r,n,a),Sw(s,r,n,a),ma(i,s,r,e,t,n,o)}function Cw(i,e,t){if(!i)return[new zi(0,0,e==da?1:0)];if(e==gn&&!t.length&&!ww.test(i))return sd(i.length);if(t.length)for(;i.length>De.length;)De[De.length]=256;let n=[],s=e==gn?0:1;return ga(i,s,s,t,0,i.length,n),n}function sd(i){return[new zi(0,i,0)]}let rd="";function Aw(i,e,t,n,s){var r;let o=n.head-i.from,a=zi.find(e,o,(r=n.bidiLevel)!==null&&r!==void 0?r:-1,n.assoc),c=e[a],h=c.side(s,t);if(o==h){let d=a+=s?1:-1;if(d<0||d>=e.length)return null;c=e[a=d],o=c.side(!s,t),h=c.side(s,t)}let u=ut(i.text,o,c.forward(s,t));(u<c.from||u>c.to)&&(u=h),rd=i.text.slice(Math.min(o,u),Math.max(o,u));let f=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return f&&u==h&&f.level+(s?0:1)<c.level?j.cursor(f.side(!s,t)+i.from,f.forward(s,t)?1:-1,f.level):j.cursor(u+i.from,c.forward(s,t)?-1:1,c.level)}function Qw(i,e,t){for(let n=e;n<t;n++){let s=id(i.charCodeAt(n));if(s==1)return gn;if(s==2||s==4)return da}return gn}const od=ce.define(),ld=ce.define(),ad=ce.define(),cd=ce.define(),Oa=ce.define(),hd=ce.define(),ud=ce.define(),_a=ce.define(),ba=ce.define(),fd=ce.define({combine:i=>i.some(e=>e)}),dd=ce.define({combine:i=>i.some(e=>e)}),pd=ce.define();class In{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 In(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 In(j.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Zr=we.define({map:(i,e)=>i.map(e)}),md=we.define();function Qt(i,e,t){let n=i.facet(cd);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 Ei=ce.define({combine:i=>i.length?i[0]:!0});let Pw=0;const Ts=ce.define();class Ge{constructor(e,t,n,s,r){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=s,this.extension=r(this)}static define(e,t){const{eventHandlers:n,eventObservers:s,provide:r,decorations:o}=t||{};return new Ge(Pw++,e,n,s,a=>{let c=[Ts.of(a)];return o&&c.push(Es.of(h=>{let u=h.plugin(a);return u?o(u):de.none})),r&&c.push(r(a)),c})}static fromClass(e,t){return Ge.define(n=>new e(n),t)}}class ya{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}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(Qt(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.create(e)}catch(t){Qt(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){Qt(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const gd=ce.define(),wa=ce.define(),Es=ce.define(),Od=ce.define(),ka=ce.define(),_d=ce.define();function bd(i,e){let t=i.state.facet(_d);if(!t.length)return t;let n=t.map(r=>r instanceof Function?r(i):r),s=[];return Ee.spans(n,e.from,e.to,{point(){},span(r,o,a,c){let h=r-e.from,u=o-e.from,f=s;for(let d=a.length-1;d>=0;d--,c--){let m=a[d].spec.bidiIsolate,b;if(m==null&&(m=Qw(e.text,h,u)),c>0&&f.length&&(b=f[f.length-1]).to==h&&b.direction==m)b.to=u,f=b.inner;else{let w={from:h,to:u,direction:m,inner:[]};f.push(w),f=w.inner}}}}),s}const yd=ce.define();function xa(i){let e=0,t=0,n=0,s=0;for(let r of i.state.facet(yd)){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 It{constructor(e,t,n,s){this.fromA=e,this.toA=t,this.fromB=n,this.toB=s}join(e){return new It(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],h=o-a,u=c?c.fromB:1e9;for(;r<t.length&&t[r]<u;){let f=t[r],d=t[r+1],m=Math.max(a,f),b=Math.min(u,d);if(m<=b&&new It(m+h,b+h,m,b).addToSet(n),d>u)break;r+=2}if(!c)return n;new It(c.fromA,c.toA,c.fromB,c.toB).addToSet(n),o=c.toA,a=c.toB}}}class Ir{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 It(r,o,a,c))),this.changedRanges=s}static create(e,t,n){return new Ir(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 wd extends Be{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=de.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 It(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:h,toA:u})=>u<this.minWidthFrom||h>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:!Lw(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let r=s>-1?Ew(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:u}=this.hasComposition;n=new It(h,u,e.changes.mapPos(h,-1),e.changes.mapPos(u,1)).addToSet(n.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(le.ie||le.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.updateDeco(),c=Rw(o,a,e.changes);return n=It.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=le.chrome||le.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 Ti&&o.widget instanceof fa&&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:h,fromB:u,toB:f}=a,d,m,b,w;if(n&&n.range.fromB<f&&n.range.toB>u){let y=Ps.build(this.view.state.doc,u,n.range.fromB,this.decorations,this.dynamicDecorationMap),E=Ps.build(this.view.state.doc,n.range.toB,f,this.decorations,this.dynamicDecorationMap);m=y.breakAtStart,b=y.openStart,w=E.openEnd;let x=this.compositionView(n);E.breakAtStart?x.breakAfter=1:E.content.length&&x.merge(x.length,x.length,E.content[0],!1,E.openStart,0)&&(x.breakAfter=E.content[0].breakAfter,E.content.shift()),y.content.length&&x.merge(0,0,y.content[y.content.length-1],!0,0,y.openEnd)&&y.content.pop(),d=y.content.concat(x).concat(E.content)}else({content:d,breakAtStart:m,openStart:b,openEnd:w}=Ps.build(this.view.state.doc,u,f,this.decorations,this.dynamicDecorationMap));let{i:g,off:p}=r.findPos(h,1),{i:O,off:C}=r.findPos(c,-1);Ff(this,O,C,g,p,d,m,b,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(md)&&(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 Pi(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=Be.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(Ei)||this.dom.tabIndex>-1)&&Vr(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)),h=a.empty?c:this.moveToLine(this.domAtPos(a.head));if(le.gecko&&a.empty&&!this.hasComposition&&Tw(c)){let f=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(f,c.node.childNodes[c.offset]||null)),c=h=new Ot(f,0),o=!0}let u=this.view.observer.selectionRange;(o||!u.focusNode||(!Ss(c.node,c.offset,u.anchorNode,u.anchorOffset)||!Ss(h.node,h.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,a))&&(this.view.observer.ignore(()=>{le.android&&le.chrome&&this.dom.contains(u.focusNode)&&Vw(u.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=xs(this.view.root);if(f)if(a.empty){if(le.gecko){let d=$w(c.node,c.offset);if(d&&d!=3){let m=(d==1?vf:Zf)(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(h.node,h.offset)}catch{}}else{let d=document.createRange();a.anchor>a.head&&([c,h]=[h,c]),d.setEnd(h.node,h.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,h)),this.impreciseAnchor=c.precise?null:new Ot(u.anchorNode,u.anchorOffset),this.impreciseHead=h.precise?null:new Ot(u.focusNode,u.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),h=this.coordsAt(t.head,1);if(!c||!h||c.bottom>h.top)return;let u=this.domAtPos(t.head+t.assoc);n.collapse(u.node,u.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=Be.get(t.childNodes[s]);r instanceof Je&&(n=r.domAtPos(0))}for(let s=e.offset-1;!n&&s>=0;s--){let r=Be.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=Be.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,h=c-a.length;if(c<e)break;if(h<=e&&(h<e||a.covers(-1))&&(c>e||a.covers(1))&&(!n||a instanceof Je&&!(n instanceof Je&&t>=0)))n=a,s=h;else if(n&&h==e&&c==e&&a instanceof Ti&&Math.abs(t)<2){if(a.deco.startSide<0)break;o&&(n=null)}r=h}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=ut(s.text,n);if(r==n)return null;let o=mn(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==Ze.LTR;for(let h=0,u=0;u<this.children.length;u++){let f=this.children[u],d=h+f.length;if(d>s)break;if(h>=n){let m=f.dom.getBoundingClientRect();if(t.push(m.height),o){let b=f.dom.lastChild,w=b?Mn(b):[];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=h,this.minWidthTo=d)}}}h=d+f.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?Ze.RTL:Ze.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=Mn(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 Uf(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(de.replace({widget:new fa(a),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!r)break;n=r.to+1}return de.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Es).map(r=>(this.dynamicDecorationMap[e++]=typeof r=="function")?r(this.view):r),n=!1,s=this.view.state.facet(Od).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(Ee.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 h=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=h.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let h of this.view.state.facet(pd))try{if(h(this.view,e.range,e))return!0}catch(u){Qt(this.view.state,u,"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=xa(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;cw(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==Ze.LTR)}}function Tw(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 kd(i,e){let t=i.observer.selectionRange;if(!t.focusNode)return null;let n=vf(t.focusNode,t.focusOffset),s=Zf(t.focusNode,t.focusOffset),r=n||s;if(s&&n&&s.node!=n.node){let a=Be.get(s.node);if(!a||a instanceof Ht&&a.text!=s.node.nodeValue)r=s;else if(i.docView.lastCompositionAfterCursor){let c=Be.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 Ew(i,e,t){let n=kd(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,h=new It(c.mapPos(r),c.mapPos(o),r,o),u=[];for(let f=s.parentNode;;f=f.parentNode){let d=Be.get(f);if(d instanceof Pi)u.push({node:f,deco:d.mark});else{if(d instanceof Je||f.nodeName=="DIV"&&f.parentNode==i.contentDOM)return{range:h,text:s,marks:u,line:f};if(f!=i.contentDOM)u.push({node:f,deco:new As({inclusive:!0,attributes:Ow(f),tagName:f.tagName.toLowerCase()})});else return null}}}function $w(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 Nw=class{constructor(){this.changes=[]}compareRange(e,t){Dr(e,t,this.changes)}comparePoint(e,t){Dr(e,t,this.changes)}boundChange(e){Dr(e,e,this.changes)}};function Rw(i,e,t){let n=new Nw;return Ee.compare(i,e,t,n),n.changes}function Vw(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 Lw(i,e){let t=!1;return e&&i.iterChangedRanges((n,s)=>{n<e.to&&s>e.from&&(t=!0)}),t}function Mw(i,e,t=1){let n=i.charCategorizer(e),s=i.doc.lineAt(e),r=e-s.from;if(s.length==0)return j.cursor(e);r==0?t=1:r==s.length&&(t=-1);let o=r,a=r;t<0?o=ut(s.text,r,!1):a=ut(s.text,r);let c=n(s.text.slice(o,a));for(;o>0;){let h=ut(s.text,o,!1);if(n(s.text.slice(h,o))!=c)break;o=h}for(;a<s.length;){let h=ut(s.text,a);if(n(s.text.slice(a,h))!=c)break;a=h}return j.range(o+s.from,a+s.from)}function Bw(i,e){return e.left>i?e.left-i:Math.max(0,i-e.right)}function Dw(i,e){return e.top>i?e.top-i:Math.max(0,i-e.bottom)}function Sa(i,e){return i.top<e.bottom-1&&i.bottom>e.top+1}function xd(i,e){return e<i.top?{top:e,left:i.left,right:i.right,bottom:i.bottom}:i}function Sd(i,e){return e>i.bottom?{top:i.top,left:i.left,right:i.right,bottom:e}:i}function Ca(i,e,t){let n,s,r,o,a=!1,c,h,u,f;for(let b=i.firstChild;b;b=b.nextSibling){let w=Mn(b);for(let g=0;g<w.length;g++){let p=w[g];s&&Sa(s,p)&&(p=xd(Sd(p,s.bottom),s.top));let O=Bw(e,p),C=Dw(t,p);if(O==0&&C==0)return b.nodeType==3?Cd(b,e,t):Ca(b,e,t);if(!n||o>C||o==C&&r>O){n=b,s=p,r=O,o=C;let y=C?t<p.top?-1:1:O?e<p.left?-1:1:0;a=!y||(y>0?g<w.length-1:g>0)}O==0?t>p.bottom&&(!u||u.bottom<p.bottom)?(c=b,u=p):t<p.top&&(!f||f.top>p.top)&&(h=b,f=p):u&&Sa(u,p)?u=Sd(u,p.bottom):f&&Sa(f,p)&&(f=xd(f,p.top))}}if(u&&u.bottom>=t?(n=c,s=u):f&&f.top<=t&&(n=h,s=f),!n)return{node:i,offset:0};let d=Math.max(s.left,Math.min(s.right,e));if(n.nodeType==3)return Cd(n,d,t);if(a&&n.contentEditable!="false")return Ca(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 Cd(i,e,t){let n=i.nodeValue.length,s=-1,r=1e9,o=0;for(let a=0;a<n;a++){let c=mn(i,a,a+1).getClientRects();for(let h=0;h<c.length;h++){let u=c[h];if(u.top==u.bottom)continue;o||(o=e-u.left);let f=(u.top>t?u.top-t:t-u.bottom)-1;if(u.left-1<=e&&u.right+1>=e&&f<r){let d=e>=(u.left+u.right)/2,m=d;if((le.chrome||le.gecko)&&mn(i,a).getBoundingClientRect().left==u.right&&(m=!d),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 Ad(i,e,t,n=-1){var s,r;let o=i.contentDOM.getBoundingClientRect(),a=o.top+i.viewState.paddingTop,c,{docHeight:h}=i.viewState,{x:u,y:f}=e,d=f-a;if(d<0)return 0;if(d>h)return i.state.doc.length;for(let y=i.viewState.heightOracle.textHeight/2,E=!1;c=i.elementAtHeight(d),c.type!=wt.Text;)for(;d=n>0?c.bottom+y:c.top-y,!(d>=0&&d<=h);){if(E)return t?null:0;E=!0,n=-n}f=a+d;let m=c.from;if(m<i.viewport.from)return i.viewport.from==0?0:t?null:Qd(i,o,c,u,f);if(m>i.viewport.to)return i.viewport.to==i.state.doc.length?i.state.doc.length:t?null:Qd(i,o,c,u,f);let b=i.dom.ownerDocument,w=i.root.elementFromPoint?i.root:b,g=w.elementFromPoint(u,f);g&&!i.contentDOM.contains(g)&&(g=null),g||(u=Math.max(o.left+1,Math.min(o.right-1,u)),g=w.elementFromPoint(u,f),g&&!i.contentDOM.contains(g)&&(g=null));let p,O=-1;if(g&&((s=i.docView.nearest(g))===null||s===void 0?void 0:s.isEditable)!=!1){if(b.caretPositionFromPoint){let y=b.caretPositionFromPoint(u,f);y&&({offsetNode:p,offset:O}=y)}else if(b.caretRangeFromPoint){let y=b.caretRangeFromPoint(u,f);y&&({startContainer:p,startOffset:O}=y,(!i.contentDOM.contains(p)||le.safari&&vw(p,O,u)||le.chrome&&Zw(p,O,u))&&(p=void 0))}p&&(O=Math.min(ui(p),O))}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:O}=Ca(y.dom,u,f))}let C=i.docView.nearest(p);if(!C)return null;if(C.isWidget&&((r=C.dom)===null||r===void 0?void 0:r.nodeType)==1){let y=C.dom.getBoundingClientRect();return e.y<y.top||e.y<=y.bottom&&e.x<=(y.left+y.right)/2?C.posAtStart:C.posAtEnd}else return C.localPosFromDOM(p,O)+C.posAtStart}function Qd(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+ea(o,r,i.state.tabSize)}function vw(i,e,t){let n;if(i.nodeType!=3||e!=(n=i.nodeValue.length))return!1;for(let s=i.nextSibling;s;s=s.nextSibling)if(s.nodeType!=1||s.nodeName!="BR")return!1;return mn(i,n-1,n).getBoundingClientRect().left>t}function Zw(i,e,t){if(e!=0)return!1;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():mn(i,0,Math.max(i.nodeValue.length,1)).getBoundingClientRect();return t-n.left>5}function Aa(i,e){let t=i.lineBlockAt(e);if(Array.isArray(t.type)){for(let n of t.type)if(n.to>e||n.to==e&&(n.to==t.to||n.type==wt.Text))return n}return t}function Iw(i,e,t,n){let s=Aa(i,e.head),r=!n||s.type!=wt.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==Ze.LTR)?o.right-1:o.left+1,y:(r.top+r.bottom)/2});if(c!=null)return j.cursor(c,t?-1:1)}return j.cursor(t?s.to:s.from,t?-1:1)}function Pd(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 h=Aw(s,r,o,a,t),u=rd;if(!h){if(s.number==(t?i.state.doc.lines:1))return a;u=`
|
|
28
|
+
`,s=i.state.doc.line(s.number+(t?1:-1)),r=i.bidiSpans(s),h=i.visualLineSide(s,!t)}if(c){if(!c(u))return a}else{if(!n)return h;c=n(u)}a=h}}function Uw(i,e,t){let n=i.state.charCategorizer(e),s=n(t);return r=>{let o=n(r);return s==je.Space&&(s=o),s==o}}function Fw(i,e,t,n){let s=e.head,r=t?1:-1;if(s==(t?i.state.doc.length:0))return j.cursor(s,e.assoc);let o=e.goalColumn,a,c=i.contentDOM.getBoundingClientRect(),h=i.coordsAtPos(s,e.assoc||-1),u=i.documentTop;if(h)o==null&&(o=h.left-c.left),a=r<0?h.top:h.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)+u}let f=c.left+o,d=n??i.viewState.heightOracle.textHeight>>1;for(let m=0;;m+=10){let b=a+(d+m)*r,w=Ad(i,{x:f,y:b},!1,r);if(b<c.top||b>c.bottom||(r<0?w<s:w>s)){let g=i.docView.coordsForChar(w),p=!g||b<g.top?-1:1;return j.cursor(w,p,void 0,o)}}}function Ur(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 Qa(i,e,t){let n=Ur(i.state.facet(ka).map(s=>s(i)),t.from,e.head>t.from?-1:1);return n==t.from?t:j.cursor(n,n<t.from?1:-1)}const Ns="";class jw{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(Se.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Ns}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=Be.get(s),c=Be.get(o);(a&&c?a.breakAfter:(a?a.breakAfter:Lr(s))||Lr(o)&&(s.nodeName!="BR"||s.cmIgnore)&&this.text.length>r)&&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=Be.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+(qw(e,n.node,n.offset)?t:0))}}function qw(i,e,t){for(;;){if(!e||t<ui(e))return!1;if(e==i)return!0;t=pn(e)+1,e=e.parentNode}}class Td{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class Xw{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?[]:zw(e),c=new jw(a,e.state);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=Gw(a,this.bounds.from)}else{let a=e.observer.selectionRange,c=r&&r.node==a.focusNode&&r.offset==a.focusOffset||!sa(e.contentDOM,a.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),h=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!sa(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),u=e.viewport;if((le.ios||le.chrome)&&e.state.selection.main.empty&&c!=h&&(u.from>0||u.to<e.state.doc.length)){let f=Math.min(c,h),d=Math.max(c,h),m=u.from-f,b=u.to-d;(m==0||m==1||f==0)&&(b==0||b==-1||d==e.state.doc.length)&&(c=0,h=e.state.doc.length)}this.newSel=j.single(h,c)}}}function Ed(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,h=null;(r===8||le.android&&e.text.length<a-o)&&(c=s.to,h="end");let u=Yw(i.state.doc.sliceString(o,a,Ns),e.text,c-o,h);u&&(le.chrome&&r==13&&u.toB==u.from+2&&e.text.slice(u.from,u.toB)==Ns+Ns&&u.toB--,t={from:o+u.from,to:o+u.toA,insert:Ae.of(e.text.slice(u.from,u.toB).split(Ns))})}else n&&(!i.hasFocus&&i.state.facet(Ei)||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)}:(le.mac||le.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=j.single(n.main.anchor-1,n.main.head-1)),t={from:t.from,to:t.to,insert:Ae.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))}:le.chrome&&t&&t.from==t.to&&t.from==s.head&&t.insert.toString()==`
|
|
29
|
+
`&&i.lineWrapping&&(n&&(n=j.single(n.main.anchor-1,n.main.head-1)),t={from:s.from,to:s.to,insert:Ae.of([" "])}),t)return Pa(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),i.dispatch({selection:n,scrollIntoView:o,userEvent:a}),!0}else return!1}function Pa(i,e,t,n=-1){if(le.ios&&i.inputState.flushIOSKey(e))return!0;let s=i.state.selection.main;if(le.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&&Dn(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)&&Dn(i.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&Dn(i.contentDOM,"Delete",46)))return!0;let r=e.insert.toString();i.inputState.composing>=0&&i.inputState.composing++;let o,a=()=>o||(o=Ww(i,e,t));return i.state.facet(hd).some(c=>c(i,e.from,e.to,r,a))||i.dispatch(a()),!0}function Ww(i,e,t){let n,s=i.state,r=s.selection.main;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 a=r.from<e.from?s.sliceDoc(r.from,e.from):"",c=r.to>e.to?s.sliceDoc(e.to,r.to):"";n=s.replaceSelection(i.state.toText(a+e.insert.sliceString(0,void 0,i.state.lineBreak)+c))}else{let a=s.changes(e),c=t&&t.main.to<=a.newLength?t.main:void 0;if(s.selection.ranges.length>1&&i.inputState.composing>=0&&e.to<=r.to&&e.to>=r.to-10){let h=i.state.sliceDoc(e.from,e.to),u,f=t&&kd(i,t.main.head);if(f){let b=e.insert.length-(e.to-e.from);u={from:f.from,to:f.to-b}}else u=i.state.doc.lineAt(r.head);let d=r.to-e.to,m=r.to-r.from;n=s.changeByRange(b=>{if(b.from==r.from&&b.to==r.to)return{changes:a,range:c||b.map(a)};let w=b.to-d,g=w-h.length;if(b.to-b.from!=m||i.state.sliceDoc(g,w)!=h||b.to>=u.from&&b.from<=u.to)return{range:b};let p=s.changes({from:g,to:w,insert:e.insert}),O=b.to-r.to;return{changes:p,range:c?j.range(Math.max(0,c.anchor+O),Math.max(0,c.head+O)):b.map(p)}})}else n={changes:a,selection:c&&s.selection.replaceRange(c)}}let o="input.type";return(i.composing||i.inputState.compositionPendingChange&&i.inputState.compositionEndedAt>Date.now()-50)&&(i.inputState.compositionPendingChange=!1,o+=".compose",i.inputState.compositionFirstChange&&(o+=".start",i.inputState.compositionFirstChange=!1)),s.update(n,{userEvent:o,scrollIntoView:!0})}function Yw(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 zw(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 Td(t,n)),(s!=t||r!=n)&&e.push(new Td(s,r))),e}function Gw(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?j.single(t+e,n+e):null}class Hw{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.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,le.safari&&e.contentDOM.addEventListener("input",()=>null),le.gecko&&dk(e.contentDOM.ownerDocument)}handleEvent(e){!rk(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(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=Kw(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&&Rd.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),le.android&&le.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return le.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=Nd.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||Jw.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,Dn(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:le.safari&&!le.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!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 $d(i,e){return(t,n)=>{try{return e.call(i,n,t)}catch(s){Qt(t.state,s)}}}function Kw(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;if(s&&s.domEventHandlers)for(let r in s.domEventHandlers){let o=s.domEventHandlers[r];o&&t(r).handlers.push($d(n.value,o))}if(s&&s.domEventObservers)for(let r in s.domEventObservers){let o=s.domEventObservers[r];o&&t(r).observers.push($d(n.value,o))}}for(let n in Kt)t(n).handlers.push(Kt[n]);for(let n in Ut)t(n).observers.push(Ut[n]);return e}const Nd=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Jw="dthko",Rd=[16,17,18,20,91,92,224,225],Fr=6;function jr(i){return Math.max(0,i)*.7+8}function ek(i,e){return Math.max(Math.abs(i.clientX-e.clientX),Math.abs(i.clientY-e.clientY))}class tk{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=hw(e.contentDOM),this.atoms=e.state.facet(ka).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(Se.allowMultipleSelections)&&ik(e,t),this.dragging=sk(e,t)&&Ud(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&&ek(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=xa(this.view);e.clientX-c.left<=s+Fr?t=-jr(s-e.clientX):e.clientX+c.right>=o-Fr&&(t=jr(e.clientX-o)),e.clientY-c.top<=r+Fr?n=-jr(r-e.clientY):e.clientY+c.bottom>=a-Fr&&(n=jr(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)}skipAtoms(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=Ur(this.atoms,s.from,0);o!=s.from&&(r=j.cursor(o,-1))}else{let o=Ur(this.atoms,s.from,-1),a=Ur(this.atoms,s.to,1);(o!=s.from||a!=s.to)&&(r=j.range(s.from==s.anchor?o:a,s.from==s.head?o:a))}r&&(t||(t=e.ranges.slice()),t[n]=r)}return t?j.create(t,e.mainIndex):e}select(e){let{view:t}=this,n=this.skipAtoms(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 ik(i,e){let t=i.state.facet(od);return t.length?t[0](e):le.mac?e.metaKey:e.ctrlKey}function nk(i,e){let t=i.state.facet(ld);return t.length?t[0](e):le.mac?!e.altKey:!e.ctrlKey}function sk(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 rk(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=Be.get(t))&&n.ignoreEvent(e))return!1;return!0}const Kt=Object.create(null),Ut=Object.create(null),Vd=le.ie&&le.ie_version<15||le.ios&&le.webkit_version<604;function ok(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(),Ld(i,t.value)},50)}function qr(i,e,t){for(let n of i.facet(e))t=n(t,i);return t}function Ld(i,e){e=qr(i.state,_a,e);let{state:t}=i,n,s=1,r=t.toText(e),o=r.lines==t.selection.ranges.length;if(Ta!=null&&t.selection.ranges.every(c=>c.empty)&&Ta==r.toString()){let c=-1;n=t.changeByRange(h=>{let u=t.doc.lineAt(h.from);if(u.from==c)return{range:h};c=u.from;let f=t.toText((o?r.line(s++).text:e)+t.lineBreak);return{changes:{from:u.from,insert:f},range:j.cursor(h.from+f.length)}})}else o?n=t.changeByRange(c=>{let h=r.line(s++);return{changes:{from:c.from,to:c.to,insert:h.text},range:j.cursor(c.from+h.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},Kt.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")},Kt.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(ad))if(t=n(i,e),t)break;if(!t&&e.button==0&&(t=ck(i,e)),t){let n=!i.hasFocus;i.inputState.startMouseSelection(new tk(i,e,t,n)),n&&i.observer.ignore(()=>{Lf(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}return!1};function Md(i,e,t,n){if(n==1)return j.cursor(e,t);if(n==2)return Mw(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++,j.range(o,a)}}let Bd=(i,e,t)=>e>=t.top&&e<=t.bottom&&i>=t.left&&i<=t.right;function lk(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&&Bd(t,n,o))return-1;let a=s.coordsAt(r,1);return a&&Bd(t,n,a)?1:o&&o.bottom>=n?-1:1}function Dd(i,e){let t=i.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:lk(i,t,e.clientX,e.clientY)}}const ak=le.ie&&le.ie_version<=11;let vd=null,Zd=0,Id=0;function Ud(i){if(!ak)return i.detail;let e=vd,t=Id;return vd=i,Id=Date.now(),Zd=!e||t>Date.now()-400&&Math.abs(e.clientX-i.clientX)<2&&Math.abs(e.clientY-i.clientY)<2?(Zd+1)%3:1}function ck(i,e){let t=Dd(i,e),n=Ud(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=Dd(i,r),h,u=Md(i,c.pos,c.bias,n);if(t.pos!=c.pos&&!o){let f=Md(i,t.pos,t.bias,n),d=Math.min(f.from,u.from),m=Math.max(f.to,u.to);u=d<u.from?j.range(d,m):j.range(m,d)}return o?s.replaceRange(s.main.extend(u.from,u.to)):a&&n==1&&s.ranges.length>1&&(h=hk(s,c.pos))?h:a?s.addRange(u):j.create([u])}}}function hk(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 j.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}Kt.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=j.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,ba,i.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1},Kt.dragend=i=>(i.inputState.draggedContent=null,!1);function Fd(i,e,t,n){if(t=qr(i.state,_a,t),!t)return;let s=i.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:r}=i.inputState,o=n&&r&&nk(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}Kt.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&&Fd(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 Fd(i,e,n,!0),!0}return!1},Kt.paste=(i,e)=>{if(i.state.readOnly)return!0;i.observer.flush();let t=Vd?null:e.clipboardData;return t?(Ld(i,t.getData("text/plain")||t.getData("text/uri-list")),!0):(ok(i),!1)};function uk(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 fk(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,ba,e.join(i.lineBreak)),ranges:t,linewise:n}}let Ta=null;Kt.copy=Kt.cut=(i,e)=>{let{text:t,ranges:n,linewise:s}=fk(i.state);if(!t&&!s)return!1;Ta=s?t:null,e.type=="cut"&&!i.state.readOnly&&i.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let r=Vd?null:e.clipboardData;return r?(r.clearData(),r.setData("text/plain",t),!0):(uk(i,t),!1)};const jd=Ai.define();function qd(i,e){let t=[];for(let n of i.facet(ud)){let s=n(i,e);s&&t.push(s)}return t?i.update({effects:t,annotations:jd.of(!0)}):null}function Xd(i){setTimeout(()=>{let e=i.hasFocus;if(e!=i.inputState.notifiedFocused){let t=qd(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),Xd(i)},Ut.blur=i=>{i.observer.clearSelectionRange(),Xd(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,le.chrome&&le.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()},Kt.beforeinput=(i,e)=>{var t,n;if(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),h=i.posAtDOM(a.endContainer,a.endOffset);return Pa(i,{from:c,to:h,insert:i.state.toText(r)},null),!0}}let s;if(le.chrome&&le.android&&(s=Nd.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 le.ios&&e.inputType=="deleteContentForward"&&i.observer.flushSoon(),le.safari&&e.inputType=="insertText"&&i.inputState.composing>=0&&setTimeout(()=>Ut.compositionend(i,e),20),!1};const Wd=new Set;function dk(i){Wd.has(i)||(Wd.add(i),i.addEventListener("copy",()=>{}),i.addEventListener("cut",()=>{}))}const Yd=["pre-wrap","normal","pre-line","break-spaces"];let Un=!1;function zd(){Un=!1}class pk{constructor(e){this.lineWrapping=e,this.doc=Ae.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)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Yd.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=Yd.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 h=0;h<o.length;h++){let u=o[h];u<0?h++:this.heightSamples[Math.floor(u*10)]=!0}}return c}}class mk{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class pi{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"?wt.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 Yi?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 pi(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var Ie=function(i){return i[i.ByPos=0]="ByPos",i[i.ByHeight=1]="ByHeight",i[i.ByPosNoHeight=2]="ByPosNoHeight",i}(Ie||(Ie={}));const Xr=.001;class kt{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)>Xr&&(Un=!0),this.height=e)}replace(e,t,n){return kt.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:h,fromB:u,toB:f}=s[a],d=r.lineAt(c,Ie.ByPosNoHeight,n.setDoc(t),0,0),m=d.to>=h?d:r.lineAt(h,Ie.ByPosNoHeight,n,0,0);for(f+=m.to-h,h=m.to;a>0&&d.from<=s[a-1].toA;)c=s[a-1].fromA,u=s[a-1].fromB,a--,c<d.from&&(d=r.lineAt(c,Ie.ByPosNoHeight,n,0,0));u+=d.from-c,c=d.from;let b=Ea.build(n.setDoc(o),e,u,f);r=Wr(r,r.replace(c,h,b))}return r.updateHeight(n,0)}static empty(){return new Vt(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 gk(kt.of(e.slice(0,t)),o,kt.of(e.slice(n)))}}function Wr(i,e){return i==e?i:(i.constructor!=e.constructor&&(Un=!0),e)}kt.prototype.size=1;class Gd extends kt{constructor(e,t,n){super(e,t),this.deco=n}blockAt(e,t,n,s){return new pi(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 Vt extends Gd{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,s){return new pi(s,this.length,n,this.height,this.breaks)}replace(e,t,n){let s=n[0];return n.length==1&&(s instanceof Vt||s instanceof pt&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof pt?s=new Vt(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):kt.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 kt{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 h=s+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),u=t.doc.lineAt(h),f=a+u.length*c,d=Math.max(n,e-f/2);return new pi(u.from,u.length,d,f,0)}else{let h=Math.max(0,Math.min(o-r,Math.floor((e-n)/a))),{from:u,length:f}=t.doc.line(r+h);return new pi(u,f,n+a*h,a,0)}}lineAt(e,t,n,s,r){if(t==Ie.ByHeight)return this.blockAt(e,n,s,r);if(t==Ie.ByPosNoHeight){let{from:m,to:b}=n.doc.lineAt(e);return new pi(m,b-m,0,0,0)}let{firstLine:o,perLine:a,perChar:c}=this.heightMetrics(n,r),h=n.doc.lineAt(e),u=a+h.length*c,f=h.number-o,d=s+a*f+c*(h.from-r-f);return new pi(h.from,h.length,Math.max(s,Math.min(d,s+this.height-u)),u,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:h}=this.heightMetrics(n,r);for(let u=e,f=s;u<=t;){let d=n.doc.lineAt(u);if(u==e){let b=d.number-a;f+=c*b+h*(e-r-b)}let m=c+h*d.length;o(new pi(d.from,d.length,f,m,0)),f+=m,u=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 kt.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 u=e.doc.lineAt(a).length;o.length&&o.push(null);let f=s.heights[s.index++];c==-1?c=f:Math.abs(f-c)>=Xr&&(c=-2);let d=new Vt(u,f);d.outdated=!1,o.push(d),a+=u+1}a<=r&&o.push(null,new pt(r-a).updateHeight(e,a));let h=kt.of(o);return(c<0||Math.abs(h.height-this.height)>=Xr||Math.abs(c-this.heightMetrics(e,t).perLine)>=Xr)&&(Un=!0),Wr(this,h)}else(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class gk extends kt{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==Ie.ByHeight?e<o:e<a,h=c?this.left.lineAt(e,t,n,s,r):this.right.lineAt(e,t,n,o,a);if(this.break||(c?h.to<a:h.from>a))return h;let u=t==Ie.ByPosNoHeight?Ie.ByPosNoHeight:Ie.ByPos;return c?h.join(this.right.lineAt(a,u,n,o,a)):this.left.lineAt(a,u,n,s,r).join(h)}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 h=this.lineAt(c,Ie.ByPos,n,s,r);e<h.from&&this.left.forEachLine(e,h.from-1,n,s,r,o),h.to>=e&&h.from<=t&&o(h),t>h.to&&this.right.forEachLine(h.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&&Hd(r,o-1),t<this.length){let a=r.length;this.decomposeRight(t,r),Hd(r,a)}return kt.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?kt.of(this.break?[e,null,t]:[e,t]):(this.left=Wr(this.left,e),this.right=Wr(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 Hd(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 Ok=5;class Ea{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 Vt?s.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new Vt(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 Gd(o,s,n)):(o||r||s>=Ok)&&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 Vt(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 Vt)return e;let t=new Vt(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 Vt)&&!this.isCovered?this.nodes.push(new Vt(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 Vt&&s.updateHeight(this.oracle,n),n+=s?s.length:1;return this.nodes}static build(e,t,n,s){let r=new Ea(n,e);return Ee.spans(t,n,s,r,0),r.finish(n)}}function _k(i,e,t){let n=new bk;return Ee.compare(i,e,t,n,0),n.changes}class bk{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,s){(e<t||n&&n.heightRelevant||s&&s.heightRelevant)&&Dr(e,t,this.changes,5)}}function yk(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 h=i.parentNode;h&&h!=n.body;)if(h.nodeType==1){let u=h,f=window.getComputedStyle(u);if((u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth)&&f.overflow!="visible"){let d=u.getBoundingClientRect();r=Math.max(r,d.left),o=Math.min(o,d.right),a=Math.max(a,d.top),c=Math.min(h==i.parentNode?s.innerHeight:c,d.bottom)}h=f.position=="absolute"||f.position=="fixed"?u.offsetParent:u.parentNode}else if(h.nodeType==11)h=h.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 wk(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 kk(i,e){let t=i.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class $a{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 de.replace({widget:new xk(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class xk extends fi{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 Kd{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=Jd,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Ze.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(wa).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new pk(t),this.stateDeco=e.facet(Es).filter(n=>typeof n!="function"),this.heightMap=kt.empty().applyChanges(this.stateDeco,Ae.empty,this.heightOracle.setDoc(e.doc),[new It(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=de.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?Jd:new Na(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(Rs(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(Es).filter(u=>typeof u!="function");let s=e.changedRanges,r=It.extendWithRanges(s,_k(n,this.stateDeco,e?e.changes:it.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);zd(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=o||Un)&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);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 h=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,e.flags|=this.updateForViewport(),(h||!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(dd)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?Ze.RTL:Ze.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 h=0,u=0;if(a.width&&a.height){let{scaleX:y,scaleY:E}=Vf(t,a);(y>.005&&Math.abs(this.scaleX-y)>.005||E>.005&&Math.abs(this.scaleY-E)>.005)&&(this.scaleX=y,this.scaleY=E,h|=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,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(c=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let m=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=m&&(this.scrollAnchorHeight=-1,this.scrollTop=m),this.scrolledToBottom=Df(e.scrollDOM);let b=(this.printing?kk:yk)(t,this.paddingTop),w=b.top-this.pixelViewport.top,g=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;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&&!wk(e.dom))return 0;let O=a.width;if((this.contentDOMWidth!=O||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),c){let y=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(y)&&(o=!0),o||s.lineWrapping&&Math.abs(O-this.contentDOMWidth)>s.charWidth){let{lineHeight:E,charWidth:x,textHeight:k}=e.docView.measureTextSize();o=E>0&&s.refresh(r,E,x,k,O/x,y),o&&(e.docView.minWidth=0,h|=16)}w>0&&g>0?u=Math.max(w,g):w<0&&g<0&&(u=Math.min(w,g)),zd();for(let E of this.viewports){let x=E.from==this.viewport.from?y:e.docView.measureVisibleLineHeights(E);this.heightMap=(o?kt.empty().applyChanges(this.stateDeco,Ae.empty,this.heightOracle,[new It(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new mk(E.from,x))}Un&&(h|=2)}let C=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return C&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(u,this.scrollTarget),h|=this.updateForViewport()),(h&2||C)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}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,Ie.ByHeight,r,0,0).from,s.lineAt(a+(1-n)*1e3,Ie.ByHeight,r,0,0).to);if(t){let{head:h}=t.range;if(h<c.from||h>c.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=s.lineAt(h,Ie.ByPos,r,0,0),d;t.y=="center"?d=(f.top+f.bottom)/2-u/2:t.y=="start"||t.y=="nearest"&&h<c.from?d=f.top:d=f.bottom-u,c=new Yr(s.lineAt(d-1e3/2,Ie.ByHeight,r,0,0).from,s.lineAt(d+u+1e3/2,Ie.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,Ie.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,Ie.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,Ie.ByPos,this.heightOracle,0,0),{bottom:r}=this.heightMap.lineAt(t,Ie.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 $a(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!=Ze.LTR&&!n)return[];let a=[],c=(u,f,d,m)=>{if(f-u<r)return;let b=this.state.selection.main,w=[b.from];b.empty||w.push(b.to);for(let p of w)if(p>u&&p<f){c(u,p-10,d,m),c(p+10,f,d,m);return}let g=Ck(e,p=>p.from>=d.from&&p.to<=d.to&&Math.abs(p.from-u)<r&&Math.abs(p.to-f)<r&&!w.some(O=>p.from<O&&p.to>O));if(!g){if(f<d.to&&t&&n&&t.visibleRanges.some(C=>C.from<=f&&C.to>=f)){let C=t.moveToLineBoundary(j.cursor(f),!1,!0).head;C>u&&(f=C)}let p=this.gapSize(d,u,f,m),O=n||p<2e6?p:2e6;g=new $a(u,f,p,O)}a.push(g)},h=u=>{if(u.length<o||u.type!=wt.Text)return;let f=Sk(u.from,u.to,this.stateDeco);if(f.total<o)return;let d=this.scrollTarget?this.scrollTarget.range.head:null,m,b;if(n){let w=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,g,p;if(d!=null){let O=Gr(f,d),C=((this.visibleBottom-this.visibleTop)/2+w)/u.height;g=O-C,p=O+C}else g=(this.visibleTop-u.top-w)/u.height,p=(this.visibleBottom-u.top+w)/u.height;m=zr(f,g),b=zr(f,p)}else{let w=f.total*this.heightOracle.charWidth,g=s*this.heightOracle.charWidth,p=0;if(w>2e6)for(let x of e)x.from>=u.from&&x.from<u.to&&x.size!=x.displaySize&&x.from*this.heightOracle.charWidth+p<this.pixelViewport.left&&(p=x.size-x.displaySize);let O=this.pixelViewport.left+p,C=this.pixelViewport.right+p,y,E;if(d!=null){let x=Gr(f,d),k=((C-O)/2+g)/w;y=x-k,E=x+k}else y=(O-g)/w,E=(C+g)/w;m=zr(f,y),b=zr(f,E)}m>u.from&&c(u.from,m,u,f),b<u.to&&c(b,u.to,u,f)};for(let u of this.viewportLines)Array.isArray(u.type)?u.type.forEach(h):h(u);return a}gapSize(e,t,n,s){let r=Gr(s,n)-Gr(s,t);return this.heightOracle.lineWrapping?e.height*r:s.total*this.heightOracle.charWidth*r}updateLineGaps(e){$a.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=de.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=[];Ee.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)||Rs(this.heightMap.lineAt(e,Ie.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)||Rs(this.heightMap.lineAt(this.scaler.fromDOM(e),Ie.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 Rs(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 Sk(i,e,t){let n=[],s=i,r=0;return Ee.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 zr({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 Gr(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 Ck(i,e){for(let t of i)if(e(t))return t}const Jd={toDOM(i){return i},fromDOM(i){return i},scale:1,eq(i){return i==this}};class Na{constructor(e,t,n){let s=0,r=0,o=0;this.viewports=n.map(({from:a,to:c})=>{let h=t.lineAt(a,Ie.ByPos,e,0,0).top,u=t.lineAt(c,Ie.ByPos,e,0,0).bottom;return s+=u-h,{from:a,to:c,top:h,bottom:u,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 Na?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 Rs(i,e){if(e.scale==1)return i;let t=e.toDOM(i.top),n=e.toDOM(i.bottom);return new pi(i.from,i.length,t,n-t,Array.isArray(i._content)?i._content.map(s=>Rs(s,e)):i._content)}const Hr=ce.define({combine:i=>i.join(" ")}),Ra=ce.define({combine:i=>i.indexOf(!0)>-1}),Va=qi.newName(),ep=qi.newName(),tp=qi.newName(),ip={"&light":"."+ep,"&dark":"."+tp};function La(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 Ak=La("."+Va,{"&":{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",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&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-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"},".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"}},ip),Qk={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Ma=le.ie&&le.ie_version<=11;class Pk{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new uw,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);(le.ie&&le.ie_version<=11||le.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&&e.constructor.EDIT_CONTEXT!==!1&&!(le.chrome&&le.chrome_version<126)&&(this.editContext=new Ek(e),e.state.facet(Ei)&&(e.contentDOM.editContext=this.editContext.editContext)),Ma&&(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(Ei)?n.root.activeElement!=this.dom:!Vr(this.dom,s))return;let r=s.anchorNode&&n.docView.nearest(s.anchorNode);if(r&&r.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(le.ie&&le.ie_version<=11||le.android&&le.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=le.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Tk(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let s=Vr(this.dom,n);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&dw(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,Qk),Ma&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Ma&&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&&Dn(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&&Vr(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 Xw(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=Ed(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=np(t,e.previousSibling||e.target.previousSibling,-1),s=np(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(Ei)!=e.state.facet(Ei)&&(e.view.contentDOM.editContext=e.state.facet(Ei)?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 np(i,e,t){for(;e;){let n=Be.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 sp(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 Tk(i,e){if(e.getComposedRanges){let s=e.getComposedRanges(i.root)[0];if(s)return sp(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?sp(i,t):null}class Ek{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 h={from:a,to:c,insert:Ae.of(n.text.split(`
|
|
30
|
+
`))};if(h.from==this.from&&r<this.from?h.from=r:h.to==this.to&&r>this.to&&(h.to=r),h.from==h.to&&!h.insert.length){let u=j.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));u.main.eq(s)||e.dispatch({selection:u,userEvent:"select"});return}if((le.mac||le.android)&&h.from==o-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:a,to:c,insert:Ae.of([n.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let u=this.to-this.from+(h.to-h.from+h.insert.length);Pa(e,h,j.single(this.toEditorPos(n.selectionStart,u),this.toEditorPos(n.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state))},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(o!="None"&&a!="None"){let c=this.toEditorPos(r.rangeStart),h=this.toEditorPos(r.rangeEnd);if(c<h){let u=`text-decoration: underline ${o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${a=="Thin"?1:2}px`;s.push(de.mark({attributes:{style:u}}).range(c,h))}}}e.dispatch({effects:md.of(de.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,h)=>{if(n)return;let u=h.length-(o-r);if(s&&o>=s.to)if(s.from==r&&s.to==o&&s.insert.eq(h)){s=this.pendingContextChange=null,t+=u,this.to+=u;return}else s=null,this.revertPending(e.state);if(r+=t,o+=t,o<=this.from)this.from+=u,this.to+=u;else if(r<this.to){if(r<this.from||o>this.to||this.to-this.from+h.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(r),this.toContextPos(o),h.toString()),this.to+=u}t+=u}),s&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange;this.composing&&(this.composing.drifted||e.transactions.some(n=>!n.isUserEvent("input.type")&&n.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.composing>0}get compositionStarted(){return 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||fw(e.parent)||document,this.viewState=new Kd(e.state||Se.create(e)),e.scrollTo&&e.scrollTo.is(Zr)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Ts).map(s=>new ya(s));for(let s of this.plugins)s.update(this);this.observer=new Pk(this),this.inputState=new Hw(this),this.inputState.ensureHandlers(this.plugins),this.docView=new wd(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 Ke?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(jd))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,c=qd(r,o),c||(a=1));let h=this.observer.delayedAndroidKey,u=null;if(h?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(u=null)):this.observer.clear(),r.facet(Se.phrases)!=this.state.facet(Se.phrases))return this.setState(r);s=Ir.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 In(m.empty?m:j.cursor(m.head,m.head>m.anchor?-1:1))}for(let m of d.effects)m.is(Zr)&&(f=m.value.clip(this.state))}this.viewState.update(s,f),this.bidiCache=Kr.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(Oa))try{d(s)}catch(m){Qt(this.state,m,"update listener")}(c||u)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),u&&!Ed(this,u)&&h.force&&Dn(this.contentDOM,h.key,h.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 Kd(e),this.plugins=e.facet(Ts).map(n=>new ya(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new wd(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(Ts),n=e.state.facet(Ts);if(t!=n){let s=[];for(let r of n){let o=t.indexOf(r);if(o<0)s.push(new ya(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){Qt(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(Df(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 h=[];c&4||([this.measureRequests,h]=[h,this.measureRequests]);let u=h.map(m=>{try{return m.read(this)}catch(b){return Qt(this.state,b),rp}}),f=Ir.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<h.length;m++)if(u[m]!=rp)try{let b=h[m];b.write&&b.write(u[m],this)}catch(b){Qt(this.state,b)}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 b=(r<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(r).top)-o;if(b>1||b<-1){s=s+b,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(Oa))a(t)}get themeClasses(){return Va+" "+(this.state.facet(Ra)?tp:ep)+" "+this.state.facet(Hr)}updateAttrs(){let e=op(this,gd,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Ei)?"true":"false",class:"cm-content",style:`${le.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),op(this,wa,t);let n=this.observer.ignore(()=>{let s=ua(this.contentDOM,this.contentAttrs,t),r=ua(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(Ak).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.spec!=e)&&this.pluginMap.set(e,t=this.plugins.find(n=>n.spec==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 Qa(this,e,Pd(this,e,t,n))}moveByGroup(e,t){return Qa(this,e,Pd(this,e,t,n=>Uw(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 j.cursor(r.side(t,s)+e.from,r.forward(!t,s)?1:-1)}moveToLineBoundary(e,t,n=!0){return Iw(this,e,t,n)}moveVertically(e,t,n){return Qa(this,e,Fw(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(),Ad(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[zi.find(r,e-s.from,-1,t)];return Cs(n,o.dir==Ze.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(fd)||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>$k)return sd(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||nd(r.isolates,n=bd(this,e))))return r.order;n||(n=bd(this,e));let s=Cw(e.text,t,n);return this.bidiCache.push(new Kr(e.from,e.to,t,n,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||le.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Lf(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 Zr.of(new In(typeof e=="number"?j.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 Zr.of(new In(j.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 Ge.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Ge.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=qi.newName(),s=[Hr.of(n),$s.of(La(`.${n}`,e))];return t&&t.dark&&s.push(Ra.of(!0)),s}static baseTheme(e){return ji.lowest($s.of(La("."+Va,e,ip)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),s=n&&Be.get(n)||Be.get(e);return((t=s==null?void 0:s.rootView)===null||t===void 0?void 0:t.view)||null}}se.styleModule=$s,se.inputHandler=hd,se.clipboardInputFilter=_a,se.clipboardOutputFilter=ba,se.scrollHandler=pd,se.focusChangeEffect=ud,se.perLineTextDirection=fd,se.exceptionSink=cd,se.updateListener=Oa,se.editable=Ei,se.mouseSelectionStyle=ad,se.dragMovesSelection=ld,se.clickAddsSelectionRange=od,se.decorations=Es,se.outerDecorations=Od,se.atomicRanges=ka,se.bidiIsolatedRanges=_d,se.scrollMargins=yd,se.darkTheme=Ra,se.cspNonce=ce.define({combine:i=>i.length?i[0]:""}),se.contentAttributes=wa,se.editorAttributes=gd,se.lineWrapping=se.contentAttributes.of({class:"cm-lineWrapping"}),se.announce=we.define();const $k=4096,rp={};class Kr{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:Ze.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 Kr(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function op(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&&ha(o,t)}return t}const Nk=le.mac?"mac":le.windows?"win":le.linux?"linux":"key";function Rk(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 h=t[c];if(/^(cmd|meta|m)$/i.test(h))a=!0;else if(/^a(lt)?$/i.test(h))s=!0;else if(/^(c|ctrl|control)$/i.test(h))r=!0;else if(/^s(hift)?$/i.test(h))o=!0;else if(/^mod$/i.test(h))e=="mac"?a=!0:r=!0;else throw new Error("Unrecognized modifier name: "+h)}return s&&(n="Alt-"+n),r&&(n="Ctrl-"+n),a&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function Jr(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 Vk=ji.default(se.domEventHandlers({keydown(i,e){return cp(ap(e.state),i,e,"editor")}})),Vs=ce.define({enables:Vk}),lp=new WeakMap;function ap(i){let e=i.facet(Vs),t=lp.get(e);return t||lp.set(e,t=Bk(e.reduce((n,s)=>n.concat(s),[]))),t}function Lk(i,e,t){return cp(ap(i.state),e,i,t)}let Gi=null;const Mk=4e3;function Bk(i,e=Nk){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,h,u)=>{var f,d;let m=t[o]||(t[o]=Object.create(null)),b=a.split(/ (?!$)/).map(p=>Rk(p,e));for(let p=1;p<b.length;p++){let O=b.slice(0,p).join(" ");s(O,!0),m[O]||(m[O]={preventDefault:!0,stopPropagation:!1,run:[C=>{let y=Gi={view:C,prefix:O,scope:o};return setTimeout(()=>{Gi==y&&(Gi=null)},Mk),!0}]})}let w=b.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),h&&(g.preventDefault=!0),u&&(g.stopPropagation=!0)};for(let o of i){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let h of a){let u=t[h]||(t[h]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let d in u)u[d].run.push(m=>f(m,Ba))}let c=o[e]||o.key;if(c)for(let h of a)r(h,c,o.run,o.preventDefault,o.stopPropagation),o.shift&&r(h,"Shift-"+c,o.shift,o.preventDefault,o.stopPropagation)}return t}let Ba=null;function cp(i,e,t,n){Ba=e;let s=lw(e),r=Ct(s,0),o=ai(r)==s.length&&s!=" ",a="",c=!1,h=!1,u=!1;Gi&&Gi.view==t&&Gi.scope==n&&(a=Gi.prefix+" ",Rd.indexOf(e.keyCode)<0&&(h=!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&&(u=!0),!0;g.preventDefault&&(g.stopPropagation&&(u=!0),h=!0)}return!1},m=i[n],b,w;return m&&(d(m[a+Jr(s,e,!o)])?c=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(le.windows&&e.ctrlKey&&e.altKey)&&(b=Xi[e.keyCode])&&b!=s?(d(m[a+Jr(b,e,!0)])||e.shiftKey&&(w=ks[e.keyCode])!=s&&w!=b&&d(m[a+Jr(w,e,!1)]))&&(c=!0):o&&e.shiftKey&&d(m[a+Jr(s,e,!0)])&&(c=!0),!c&&d(m._any)&&(c=!0)),h&&(c=!0),c&&u&&e.stopPropagation(),Ba=null,c}class Ls{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=hp(e);return[new Ls(t,s.left-r.left,s.top-r.top,null,s.bottom-s.top)]}else return Dk(e,t,n)}}function hp(i){let e=i.scrollDOM.getBoundingClientRect();return{left:(i.textDirection==Ze.LTR?e.left:e.right-i.scrollDOM.clientWidth*i.scaleX)-i.scrollDOM.scrollLeft*i.scaleX,top:e.top-i.scrollDOM.scrollTop*i.scaleY}}function up(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 Dk(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==Ze.LTR,o=i.contentDOM,a=o.getBoundingClientRect(),c=hp(i),h=o.querySelector(".cm-line"),u=h&&window.getComputedStyle(h),f=a.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),d=a.right-(u?parseInt(u.paddingRight):0),m=Aa(i,n),b=Aa(i,s),w=m.type==wt.Text?m:null,g=b.type==wt.Text?b:null;if(w&&(i.lineWrapping||m.widgetLineBreaks)&&(w=up(i,n,1,w)),g&&(i.lineWrapping||b.widgetLineBreaks)&&(g=up(i,s,-1,g)),w&&g&&w.from==g.from&&w.to==g.to)return O(C(t.from,t.to,w));{let E=w?C(t.from,null,w):y(m,!1),x=g?C(null,t.to,g):y(b,!0),k=[];return(w||m).to<(g||b).from-(w&&g?1:0)||m.widgetLineBreaks>1&&E.bottom+i.defaultLineHeight/2<x.top?k.push(p(f,E.bottom,d,x.top)):E.bottom<x.top&&i.elementAtHeight((E.bottom+x.top)/2).type==wt.Text&&(E.bottom=x.top=(E.bottom+x.top)/2),O(E).concat(k).concat(O(x))}function p(E,x,k,P){return new Ls(e,E-c.left,x-c.top,k-E,P-x)}function O({top:E,bottom:x,horizontal:k}){let P=[];for(let N=0;N<k.length;N+=2)P.push(p(k[N],E,k[N+1],x));return P}function C(E,x,k){let P=1e9,N=-1e9,_=[];function A(T,I,B,U,Z){let K=i.coordsAtPos(T,T==k.to?-2:2),X=i.coordsAtPos(B,B==k.from?2:-2);!K||!X||(P=Math.min(K.top,X.top,P),N=Math.max(K.bottom,X.bottom,N),Z==Ze.LTR?_.push(r&&I?f:K.left,r&&U?d:X.right):_.push(!r&&U?f:X.left,!r&&I?d:K.right))}let S=E??k.from,M=x??k.to;for(let T of i.visibleRanges)if(T.to>S&&T.from<M)for(let I=Math.max(T.from,S),B=Math.min(T.to,M);;){let U=i.state.doc.lineAt(I);for(let Z of i.bidiSpans(U)){let K=Z.from+U.from,X=Z.to+U.from;if(K>=B)break;X>I&&A(Math.max(K,I),E==null&&K<=S,Math.min(X,B),x==null&&X>=M,Z.dir)}if(I=U.to+1,I>=B)break}return _.length==0&&A(S,E==null,M,x==null,i.textDirection),{top:P,bottom:N,horizontal:_}}function y(E,x){let k=a.top+(x?E.top:E.bottom);return{top:k,bottom:k,horizontal:[]}}}function vk(i,e){return i.constructor==e.constructor&&i.eq(e)}class Zk{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(eo)!=e.state.facet(eo)&&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(eo);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)=>!vk(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}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const eo=ce.define();function fp(i){return[Ge.define(e=>new Zk(e,i)),eo.of(i)]}const dp=!(le.ios&&le.webkit&&le.webkit_version<534),Ms=ce.define({combine(i){return hi(i,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function Ik(i={}){return[Ms.of(i),Uk,Fk,jk,dd.of(!0)]}function pp(i){return i.startState.facet(Ms)!=i.state.facet(Ms)}const Uk=fp({above:!0,markers(i){let{state:e}=i,t=e.facet(Ms),n=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty?!r||dp:t.drawRangeCursor){let o=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=s.empty?s:j.cursor(s.head,s.head>s.anchor?-1:1);for(let c of Ls.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=pp(i);return t&&mp(i.state,e),i.docChanged||i.selectionSet||t},mount(i,e){mp(e.state,i)},class:"cm-cursorLayer"});function mp(i,e){e.style.animationDuration=i.facet(Ms).cursorBlinkRate+"ms"}const Fk=fp({above:!1,markers(i){return i.state.selection.ranges.map(e=>e.empty?[]:Ls.forRange(i,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(i,e){return i.docChanged||i.selectionSet||i.viewportChanged||pp(i)},class:"cm-selectionLayer"}),Da={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};dp&&(Da[".cm-line"].caretColor=Da[".cm-content"].caretColor="transparent !important");const jk=ji.highest(se.theme(Da)),gp=we.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(gp)?n.value:t,i)}}),qk=Ge.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:gp.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 Xk(){return[Bs,qk]}function Op(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 Wk(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 Yk{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,h,u)=>s(u,h,h+a[0].length,a,c);else if(typeof n=="function")this.addMatch=(a,c,h,u)=>{let f=n(a,c,h);f&&u(h,h+a[0].length,f)};else if(n)this.addMatch=(a,c,h,u)=>u(h,h+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 Qi,n=t.add.bind(t);for(let{from:s,to:r}of Wk(e,this.maxLength))Op(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),h=c.to<a?e.state.doc.lineAt(a):c,u=Math.max(r.from,c.from),f=Math.min(r.to,h.to);if(this.boundary){for(;o>c.from;o--)if(this.boundary.test(c.text[o-1-c.from])){u=o;break}for(;a<h.to;a++)if(this.boundary.test(h.text[a-h.from])){f=a;break}}let d=[],m,b=(w,g,p)=>d.push(p.range(w,g));if(c==h)for(this.regexp.lastIndex=u-c.from;(m=this.regexp.exec(c.text))&&m.index<f-c.from;)this.addMatch(m,e,m.index+c.from,b);else Op(e.state.doc,this.regexp,u,f,(w,g)=>this.addMatch(g,e,w,b));t=t.update({filterFrom:u,filterTo:f,filter:(w,g)=>w<u||g>f,add:d})}}return t}}const va=/x/.unicode!=null?"gu":"g",zk=new RegExp(`[\0-\b
|
|
31
|
+
--\u2028\u2029\uFEFF-]`,va),Gk={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 Za=null;function Hk(){var i;if(Za==null&&typeof document<"u"&&document.body){let e=document.body.style;Za=((i=e.tabSize)!==null&&i!==void 0?i:e.MozTabSize)!=null}return Za||!1}const to=ce.define({combine(i){let e=hi(i,{render:null,specialChars:zk,addSpecialChars:null});return(e.replaceTabs=!Hk())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,va)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,va)),e}});function Kk(i={}){return[to.of(i),Jk()]}let _p=null;function Jk(){return _p||(_p=Ge.fromClass(class{constructor(i){this.view=i,this.decorations=de.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(i.state.facet(to)),this.decorations=this.decorator.createDeco(i)}makeDecorator(i){return new Yk({regexp:i.specialChars,decoration:(e,t,n)=>{let{doc:s}=t.state,r=Ct(e[0],0);if(r==9){let o=s.lineAt(n),a=t.state.tabSize,c=Ln(o.text,a,n-o.from);return de.replace({widget:new nx((a-c%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[r]||(this.decorationCache[r]=de.replace({widget:new ix(i,r)}))},boundary:i.replaceTabs?void 0:/[^]/})}update(i){let e=i.state.facet(to);i.startState.facet(to)!=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 ex="•";function tx(i){return i>=32?ex:i==10?"":String.fromCharCode(9216+i)}class ix extends fi{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=tx(this.code),n=e.state.phrase("Control character")+" "+(Gk[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 nx extends fi{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 sx(){return ox}const rx=de.line({class:"cm-activeLine"}),ox=Ge.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(rx.range(s.from)),e=s.from)}return de.set(t)}},{decorations:i=>i.decorations});class lx extends fi{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)),typeof this.content=="string"?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?Mn(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 ax(i){return Ge.fromClass(class{constructor(e){this.view=e,this.placeholder=i?de.set([de.widget({widget:new lx(i),side:1}).range(0)]):de.none}get decorations(){return this.view.state.doc.length?de.none:this.placeholder}},{decorations:e=>e.decorations})}const Ia=2e3;function cx(i,e,t){let n=Math.min(e.line,t.line),s=Math.max(e.line,t.line),r=[];if(e.off>Ia||t.off>Ia||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 h=i.doc.line(c);h.length<=a&&r.push(j.range(h.from+o,h.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 h=i.doc.line(c),u=ea(h.text,o,i.tabSize,!0);if(u<0)r.push(j.cursor(h.to));else{let f=ea(h.text,a,i.tabSize);r.push(j.range(h.from+u,h.from+f))}}}return r}function hx(i,e){let t=i.coordsAtPos(i.viewport.from);return t?Math.round(Math.abs((t.left-e)/i.defaultCharacterWidth)):-1}function bp(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>Ia?-1:s==n.length?hx(i,e.clientX):Ln(n.text,i.state.tabSize,t-n.from);return{line:n.number,col:r,off:s}}function ux(i,e){let t=bp(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=bp(i,s);if(!a)return n;let c=cx(i.state,t,a);return c.length?o?j.create(c.concat(n.ranges)):j.create(c):n}}:null}function fx(i){let e=(i==null?void 0:i.eventFilter)||(t=>t.altKey&&t.button==0);return se.mouseSelectionStyle.of((t,n)=>e(n)?ux(t,n):null)}const dx={Alt:[18,i=>!!i.altKey],Control:[17,i=>!!i.ctrlKey],Shift:[16,i=>!!i.shiftKey],Meta:[91,i=>!!i.metaKey]},px={style:"cursor: crosshair"};function mx(i={}){let[e,t]=dx[i.key||"Alt"],n=Ge.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?px:null})]}const Ds="-10000px";class yp{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 h=r[c],u=-1;if(h){for(let f=0;f<this.tooltips.length;f++){let d=this.tooltips[f];d&&d.create==h.create&&(u=f)}if(u<0)o[c]=this.createTooltipView(h,c?o[c-1]:null),a&&(a[c]=!!h.above);else{let f=o[c]=this.tooltipViews[u];a&&(a[c]=t[u]),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,h)=>t[h]=c),t.length=a.length),this.input=s,this.tooltips=r,this.tooltipViews=o,!0}}function gx(i){let{win:e}=i;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}const Ua=ce.define({combine:i=>{var e,t,n;return{position:le.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)||gx}}}),wp=new WeakMap,Fa=Ge.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(Ua);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 yp(i,ja,(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(Ua);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=Ds,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(le.gecko)t=r.offsetParent!=this.container.ownerDocument.body;else if(r.style.top==Ds&&r.style.left=="0px"){let o=r.getBoundingClientRect();t=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}}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=xa(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(Ua).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],h=this.manager.tooltipViews[a],{dom:u}=h,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)){u.style.top=Ds;continue}let m=c.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,b=m?7:0,w=d.right-d.left,g=(e=wp.get(h))!==null&&e!==void 0?e:d.bottom-d.top,p=h.offset||_x,O=this.view.textDirection==Ze.LTR,C=d.width>n.right-n.left?O?n.left:n.right-d.width:O?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-b-p.y<n.top:f.bottom+g+b+p.y>n.bottom)&&y==n.bottom-f.bottom>f.top-n.top&&(y=this.above[a]=!y);let E=(y?f.top-n.top:n.bottom-f.bottom)-b;if(E<g&&h.resize!==!1){if(E<this.view.defaultLineHeight){u.style.top=Ds;continue}wp.set(h,g),u.style.height=(g=E)/r+"px"}else u.style.height&&(u.style.height="");let x=y?f.top-g-b-p.y:f.bottom+b+p.y,k=C+w;if(h.overlap!==!0)for(let P of o)P.left<k&&P.right>C&&P.top<x+g&&P.bottom>x&&(x=y?P.top-g-2-b:P.bottom+b+2);if(this.position=="absolute"?(u.style.top=(x-i.parent.top)/r+"px",kp(u,(C-i.parent.left)/s)):(u.style.top=x/r+"px",kp(u,C/s)),m){let P=f.left+(O?p.x:-p.x)-(C+14-7);m.style.left=P/s+"px"}h.overlap!==!0&&o.push({left:C,top:x,right:k,bottom:x+g}),u.classList.toggle("cm-tooltip-above",y),u.classList.toggle("cm-tooltip-below",!y),h.positioned&&h.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=Ds}},{eventObservers:{scroll(){this.maybeMeasure()}}});function kp(i,e){let t=parseInt(i.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(i.style.left=e+"px")}const Ox=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"}}}),_x={x:0,y:0},ja=ce.define({enables:[Fa,Ox]}),io=ce.define({combine:i=>i.reduce((e,t)=>e.concat(t),[])});class no{static create(e){return new no(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new yp(e,io,(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 bx=ja.compute([io],i=>{let e=i.facet(io);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:no.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class yx{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 Wi)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(u=>u.from<=s&&u.to>=s),h=c&&c.dir==Ze.RTL?-1:1;r=t.x<a.left?-h:h}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=>Qt(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(Fa),t=e?e.manager.tooltips.findIndex(n=>n.create==no.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&&!wx(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:!kx(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 so=4;function wx(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-so&&e.clientX<=n+so&&e.clientY>=s-so&&e.clientY<=r+so}function kx(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 xx(i,e={}){let t=we.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 h=Object.assign(Object.create(null),a);h.pos=c,h.end!=null&&(h.end=r.changes.mapPos(h.end)),o.push(h)}}s=o}for(let o of r.effects)o.is(t)&&(s=o.value),o.is(Sx)&&(s=[]);return s},provide:s=>io.from(s)});return{active:n,extension:[n,Ge.define(s=>new yx(s,i,n,t,e.hoverTime||300)),bx]}}function xp(i,e){let t=i.plugin(Fa);if(!t)return null;let n=t.manager.tooltips.indexOf(e);return n<0?null:t.manager.tooltipViews[n]}const Sx=we.define(),Sp=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(Cp),n=t?t.specs.indexOf(e):-1;return n>-1?t.panels[n]:null}const Cp=Ge.fromClass(class{constructor(i){this.input=i.state.facet(Zs),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(i));let e=i.state.facet(Sp);this.top=new ro(i,!0,e.topContainer),this.bottom=new ro(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(Sp);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new ro(i.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new ro(i.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=i.state.facet(Zs);if(t!=this.input){let n=t.filter(c=>c),s=[],r=[],o=[],a=[];for(let c of n){let h=this.specs.indexOf(c),u;h<0?(u=c(i.view),a.push(u)):(u=this.panels[h],u.update&&u.update(i)),s.push(u),(u.top?r:o).push(u)}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 ro{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=Ap(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Ap(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 Ap(i){let e=i.nextSibling;return i.remove(),e}const Zs=ce.define({enables:Cp});class $i extends dn{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}$i.prototype.elementClass="",$i.prototype.toDOM=void 0,$i.prototype.mapMode=ft.TrackBefore,$i.prototype.startSide=$i.prototype.endSide=-1,$i.prototype.point=!0;const oo=ce.define(),Cx=ce.define(),Ax={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Ee.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Is=ce.define();function Qx(i){return[Qp(),Is.of(Object.assign(Object.assign({},Ax),i))]}const qa=ce.define({combine:i=>i.some(e=>e)});function Qp(i){let e=[Px];return i&&i.fixed===!1&&e.push(qa.of(!0)),e}const Px=Ge.fromClass(class{constructor(i){this.view=i,this.prevViewport=i.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=i.state.facet(Is).map(e=>new Tp(i,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!i.state.facet(qa),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),i.scrollDOM.insertBefore(this.dom,i.contentDOM)}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)}i.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(qa)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=i.view.viewport}syncGutters(i){let e=this.dom.nextSibling;i&&this.dom.remove();let t=Ee.iter(this.view.state.facet(oo),this.view.viewport.from),n=[],s=this.gutters.map(r=>new Tx(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==wt.Text&&o){Xa(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==wt.Text){Xa(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)}updateGutters(i){let e=i.startState.facet(Is),t=i.state.facet(Is),n=i.docChanged||i.heightChanged||i.viewportChanged||!Ee.eq(i.startState.facet(oo),i.state.facet(oo),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 Tp(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)this.dom.appendChild(r.dom);this.gutters=s}return n}destroy(){for(let i of this.gutters)i.destroy();this.dom.remove()}},{provide:i=>se.scrollMargins.of(e=>{let t=e.plugin(i);return!t||t.gutters.length==0||!t.fixed?null:e.textDirection==Ze.LTR?{left:t.dom.offsetWidth*e.scaleX}:{right:t.dom.offsetWidth*e.scaleX}})});function Pp(i){return Array.isArray(i)?i:[i]}function Xa(i,e,t){for(;i.value&&i.from<=t;)i.from==t&&e.push(i.value),i.next()}class Tx{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=Ee.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 Ep(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=[];Xa(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(Cx)){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 Tp{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=Pp(t.markers(e)),t.initialSpacer&&(this.spacer=new Ep(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=Pp(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!Ee.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 Ep{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":""),Ex(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,h=!1;if(c){let u=c.elementClass;u&&(n+=" "+u);for(let f=o;f<this.markers.length;f++)if(this.markers[f].compare(c)){a=f,h=!0;break}}else a=this.markers.length;for(;o<a;){let u=this.markers[o++];if(u.toDOM){u.destroy(s);let f=s.nextSibling;s.remove(),s=f}}if(!c)break;c.toDOM&&(h?s=s.nextSibling:this.dom.insertBefore(c.toDOM(e),s)),h&&o++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}function Ex(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 $x=ce.define(),Nx=ce.define(),Fn=ce.define({combine(i){return hi(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,h)=>r(a,c,h)||o(a,c,h):o}return n}})}});class Wa extends $i{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Ya(i,e){return i.state.facet(Fn).formatNumber(e,i.state)}const Rx=Is.compute([Fn],i=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet($x)},lineMarker(e,t,n){return n.some(s=>s.toDOM)?null:new Wa(Ya(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,n)=>{for(let s of e.state.facet(Nx)){let r=s(e,t,n);if(r)return r}return null},lineMarkerChange:e=>e.startState.facet(Fn)!=e.state.facet(Fn),initialSpacer(e){return new Wa(Ya(e,$p(e.state.doc.lines)))},updateSpacer(e,t){let n=Ya(t.view,$p(t.view.state.doc.lines));return n==e.number?e:new Wa(n)},domEventHandlers:i.facet(Fn).domEventHandlers}));function Vx(i={}){return[Fn.of(i),Qp(),Rx]}function $p(i){let e=9;for(;e<i;)e=e*10+9;return e}const Lx=new class extends $i{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},Mx=oo.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(Lx.range(s)))}return Ee.of(e)});function Bx(){return Mx}const Np=1024;let Dx=0;class za{constructor(e,t){this.from=e,this.to=t}}class xe{constructor(e={}){this.id=Dx++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Pt.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}xe.closedBy=new xe({deserialize:i=>i.split(" ")}),xe.openedBy=new xe({deserialize:i=>i.split(" ")}),xe.group=new xe({deserialize:i=>i.split(" ")}),xe.isolate=new xe({deserialize:i=>{if(i&&i!="rtl"&&i!="ltr"&&i!="auto")throw new RangeError("Invalid value for isolate: "+i);return i||"auto"}}),xe.contextHash=new xe({perNode:!0}),xe.lookAhead=new xe({perNode:!0}),xe.mounted=new xe({perNode:!0});class lo{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[xe.mounted.id]}}const vx=Object.create(null);class Pt{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):vx,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new Pt(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(xe.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(xe.group),r=-1;r<(s?s.length:0);r++){let o=t[r<0?n.name:s[r]];if(o)return o}}}}Pt.none=new Pt("",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);o&&(s||(s=Object.assign({},n.props)),s[o[0].id]=o[1])}t.push(s?new Pt(n.name,s,n.id,n.flags):n)}return new Ga(t)}}const ao=new WeakMap,Rp=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=lo.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=ao.get(this)||this.topNode,r=new Ja(s);return r.moveTo(e,t),ao.set(this,r._tree),r}get topNode(){return new Tt(this,0,0,null)}resolve(e,t=0){let n=Us(ao.get(this)||this.topNode,e,t,!1);return ao.set(this,n),n}resolveInner(e,t=0){let n=Us(Rp.get(this)||this.topNode,e,t,!0);return Rp.set(this,n),n}resolveStack(e,t=0){return Ux(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 h=!1;if(c.from<=r&&c.to>=s&&(!a&&c.type.isAnonymous||t(c)!==!1)){if(c.firstChild())continue;h=!0}for(;h&&n&&(a||!c.type.isAnonymous)&&n(c),!c.nextSibling();){if(!c.parent())return;h=!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(Pt.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(Pt.none,t,n,s)))}static build(e){return Fx(e)}}et.empty=new et(Pt.none,[],[],0);class Ha{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 Ha(this.buffer,this.index)}}class Hi{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Pt.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&&!(Vp(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 h=r[c++]=s[a++]-n;r[c++]=s[a++]-e,o=Math.max(o,h)}return new Hi(r,o,this.set)}}function Vp(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 Us(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 Tt&&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 Tt&&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 Lp{cursor(e=0){return new Ja(this,e)}getChild(e,t=null,n=null){let s=Mp(this,e,t,n);return s.length?s[0]:null}getChildren(e,t=null,n=null){return Mp(this,e,t,n)}resolve(e,t=0){return Us(this,e,t,!1)}resolveInner(e,t=0){return Us(this,e,t,!0)}matchContext(e){return Ka(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 Tt extends Lp{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,h=t>0?a.length:-1;e!=h;e+=t){let u=a[e],f=c[e]+o.from;if(Vp(s,n,f,f+u.length)){if(u instanceof Hi){if(r&nt.ExcludeBuffers)continue;let d=u.findChild(0,u.buffer.length,t,n-f,s);if(d>-1)return new mi(new Zx(o,u,e,f),null,d)}else if(r&nt.IncludeAnonymous||!u.type.isAnonymous||ec(u)){let d;if(!(r&nt.IgnoreMounts)&&(d=lo.get(u))&&!d.overlay)return new Tt(d.tree,f,e,o);let m=new Tt(u,f,e,o);return r&nt.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(t<0?u.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)}enter(e,t,n=0){let s;if(!(n&nt.IgnoreOverlays)&&(s=lo.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 Tt(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 Mp(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 Ka(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 Zx{constructor(e,t,n,s){this.parent=e,this.buffer=t,this.index=n,this.start=s}}class mi extends Lp{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 mi(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)}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 mi(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 mi(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 mi(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 Bp(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 Tt&&t.index<0?null:t.parent,s=i.slice();return n?s[e]=n:s.splice(e,1),new Ix(s,t)}class Ix{constructor(e,t){this.heads=e,this.node=t}get next(){return Bp(this.heads)}}function Ux(i,e,t){let n=i.resolveInner(e,t),s=null;for(let r=n instanceof Tt?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=lo.get(r.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new Tt(o.tree,o.overlay[0].from+r.from,-1,r);(s||(s=[n])).push(Us(a,e,t,!1))}}return s?Bp(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 Tt)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 Tt?(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 Hi||!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 mi(this.buffer,t,this.stack[s]);return this.bufferNode=new mi(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 Ka(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 Ka(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 Hi||!e.type.isAnonymous||ec(e))}function Fx(i){var e;let{buffer:t,nodeSet:n,maxBufferLength:s=Np,reused:r=[],minRepeatType:o=n.types.length}=i,a=Array.isArray(t)?new Ha(t,t.length):t,c=n.types,h=0,u=0;function f(E,x,k,P,N,_){let{id:A,start:S,end:M,size:T}=a,I=u,B=h;for(;T<0;)if(a.next(),T==-1){let J=r[A];k.push(J),P.push(S-E);return}else if(T==-3){h=A;return}else if(T==-4){u=A;return}else throw new RangeError(`Unrecognized record size: ${T}`);let U=c[A],Z,K,X=S-E;if(M-S<=s&&(K=g(a.pos-x,N))){let J=new Uint16Array(K.size-K.skip),fe=a.pos-K.size,he=J.length;for(;a.pos>fe;)he=p(K.start,J,he);Z=new Hi(J,M-K.start,n),X=K.start-E}else{let J=a.pos-T;a.next();let fe=[],he=[],ye=A>=o?A:-1,z=0,D=M;for(;a.pos>J;)ye>=0&&a.id==ye&&a.size>=0?(a.end<=D-s&&(b(fe,he,S,z,a.end,D,ye,I,B),z=fe.length,D=a.end),a.next()):_>2500?d(S,J,fe,he):f(S,J,fe,he,ye,_+1);if(ye>=0&&z>0&&z<fe.length&&b(fe,he,S,z,S,D,ye,I,B),fe.reverse(),he.reverse(),ye>-1&&z>0){let V=m(U,B);Z=tc(U,fe,he,0,fe.length,0,M-S,V,V)}else Z=w(U,fe,he,M-S,I-M,B)}k.push(Z),P.push(X)}function d(E,x,k,P){let N=[],_=0,A=-1;for(;a.pos>x;){let{id:S,start:M,end:T,size:I}=a;if(I>4)a.next();else{if(A>-1&&M<A)break;A<0&&(A=T-s),N.push(S,M,T),_++,a.next()}}if(_){let S=new Uint16Array(_*4),M=N[N.length-2];for(let T=N.length-3,I=0;T>=0;T-=3)S[I++]=N[T],S[I++]=N[T+1]-M,S[I++]=N[T+2]-M,S[I++]=I;k.push(new Hi(S,N[2]-M,n)),P.push(M-E)}}function m(E,x){return(k,P,N)=>{let _=0,A=k.length-1,S,M;if(A>=0&&(S=k[A])instanceof et){if(!A&&S.type==E&&S.length==N)return S;(M=S.prop(xe.lookAhead))&&(_=P[A]+S.length+M)}return w(E,k,P,N,_,x)}}function b(E,x,k,P,N,_,A,S,M){let T=[],I=[];for(;E.length>P;)T.push(E.pop()),I.push(x.pop()+k-N);E.push(w(n.types[A],T,I,_-N,S-_,M)),x.push(N-k)}function w(E,x,k,P,N,_,A){if(_){let S=[xe.contextHash,_];A=A?[S].concat(A):[S]}if(N>25){let S=[xe.lookAhead,N];A=A?[S].concat(A):[S]}return new et(E,x,k,P,A)}function g(E,x){let k=a.fork(),P=0,N=0,_=0,A=k.end-s,S={size:0,start:0,skip:0};e:for(let M=k.pos-E;k.pos>M;){let T=k.size;if(k.id==x&&T>=0){S.size=P,S.start=N,S.skip=_,_+=4,P+=4,k.next();continue}let I=k.pos-T;if(T<0||I<M||k.start<A)break;let B=k.id>=o?4:0,U=k.start;for(k.next();k.pos>I;){if(k.size<0)if(k.size==-3)B+=4;else break e;else k.id>=o&&(B+=4);k.next()}N=U,P+=T,_+=B}return(x<0||P==E)&&(S.size=P,S.start=N,S.skip=_),S.size>4?S:void 0}function p(E,x,k){let{id:P,start:N,end:_,size:A}=a;if(a.next(),A>=0&&P<o){let S=k;if(A>4){let M=a.pos-(A-4);for(;a.pos>M;)k=p(E,x,k)}x[--k]=S,x[--k]=_-E,x[--k]=N-E,x[--k]=P}else A==-3?h=P:A==-4&&(u=P);return k}let O=[],C=[];for(;a.pos>0;)f(i.start||0,i.bufferStart||0,O,C,-1,0);let y=(e=i.length)!==null&&e!==void 0?e:O.length?C[0]+O[0].length:0;return new et(c[i.topID],O.reverse(),C.reverse(),y)}const Dp=new WeakMap;function co(i,e){if(!i.isAnonymous||e instanceof Hi||e.type!=i)return 1;let t=Dp.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=i||!(n instanceof et)){t=1;break}t+=co(i,n)}Dp.set(e,t)}return t}function tc(i,e,t,n,s,r,o,a,c){let h=0;for(let b=n;b<s;b++)h+=co(i,e[b]);let u=Math.ceil(h*1.5/8),f=[],d=[];function m(b,w,g,p,O){for(let C=g;C<p;){let y=C,E=w[C],x=co(i,b[C]);for(C++;C<p;C++){let k=co(i,b[C]);if(x+k>=u)break;x+=k}if(C==y+1){if(x>u){let k=b[y];m(k.children,k.positions,0,k.children.length,w[y]+O);continue}f.push(b[y])}else{let k=w[C-1]+b[C-1].length-E;f.push(tc(i,b,w,y,C,E,k,null,c))}d.push(E+O-r)}}return m(e,t,n,s,0),(a||c)(f,d,o)}class jx{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 mi?this.setBuffer(e.context.buffer,e.index,t):e instanceof Tt&&this.map.set(e.tree,t)}get(e){return e instanceof mi?this.getBuffer(e.context.buffer,e.index):e instanceof Tt?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 On{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 On(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,h=0;;a++){let u=a<t.length?t[a]:null,f=u?u.fromA:1e9;if(f-c>=n)for(;o&&o.from<f;){let d=o;if(c>=d.from||f<=d.to||h){let m=Math.max(d.from,c)-h,b=Math.min(d.to,f)-h;d=m>=b?null:new On(m,b,d.tree,d.offset+h,a>0,!!u)}if(d&&s.push(d),o.to>f)break;o=r<e.length?e[r++]:null}if(!u)break;c=u.toA,h=u.toA-u.toB}return s}}class vp{startParse(e,t,n){return typeof e=="string"&&(e=new qx(e)),n=n?n.length?n.map(s=>new za(s.from,s.to)):[new za(0,0)]:[new za(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 qx{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 xe({perNode:!0});let Xx=0;class Ft{constructor(e,t,n,s){this.name=e,this.set=t,this.base=n,this.modified=s,this.id=Xx++}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 Ft&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let s=new Ft(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 ho(e);return n=>n.modified.indexOf(t)>-1?n:ho.get(n.base||n,n.modified.concat(t).sort((s,r)=>s.id-r.id))}}let Wx=0;class ho{constructor(e){this.name=e,this.instances=[],this.id=Wx++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(a=>a.base==e&&Yx(t,a.modified));if(n)return n;let s=[],r=new Ft(e.name,s,e,t);for(let a of t)a.instances.push(r);let o=zx(t);for(let a of e.set)if(!a.modified.length)for(let c of o)s.push(ho.get(a,c));return r}}function Yx(i,e){return i.length==e.length&&i.every((t,n)=>t==e[n])}function zx(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 Zp(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,h=r[c];if(!h)throw new RangeError("Invalid path: "+s);let u=new uo(n,o,c>0?r.slice(0,c):null);e[h]=u.sort(e[h])}}return Ip.add(e)}const Ip=new xe;class uo{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}}uo.empty=new uo([],2,null);function Up(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 h=t[c.id];if(h){o=o?o+" "+h:h;break}}return o},scope:n}}function Gx(i,e){let t=null;for(let n of i){let s=n.style(e);s&&(t=t?t+" "+s:s)}return t}function Hx(i,e,t,n=0,s=i.length){let r=new Kx(n,Array.isArray(e)?e:[e],t);r.highlightRange(i.cursor(),n,s,"",r.highlighters),r.flush(s)}class Kx{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 h=s,u=Jx(e)||uo.empty,f=Gx(r,u.tags);if(f&&(h&&(h+=" "),h+=f,u.mode==1&&(s+=(s?" ":"")+f)),this.startSpan(Math.max(t,a),h),u.opaque)return;let d=e.tree&&e.tree.prop(xe.mounted);if(d&&d.overlay){let m=e.node.enter(d.overlay[0].from+a,1),b=this.highlighters.filter(g=>!g.scope||g.scope(d.tree.type)),w=e.firstChild();for(let g=0,p=a;;g++){let O=g<d.overlay.length?d.overlay[g]:null,C=O?O.from+a:c,y=Math.max(t,p),E=Math.min(n,C);if(y<E&&w)for(;e.from<E&&(this.highlightRange(e,y,E,s,r),this.startSpan(Math.min(E,e.to),h),!(e.to>=C||!e.nextSibling())););if(!O||C>n)break;p=O.to+a,p>t&&(this.highlightRange(m.cursor(),Math.max(t,O.from+a),Math.min(n,p),"",b),this.startSpan(Math.min(n,p),h))}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),h)}while(e.nextSibling());e.parent()}}}function Jx(i){let e=i.type.prop(Ip);for(;e&&e.context&&!i.matchContext(e.context);)e=e.next;return e||null}const ie=Ft.define,fo=ie(),Ki=ie(),Fp=ie(Ki),jp=ie(Ki),Ji=ie(),po=ie(Ji),ic=ie(Ji),gi=ie(),_n=ie(gi),Oi=ie(),_i=ie(),nc=ie(),Fs=ie(nc),mo=ie(),L={comment:fo,lineComment:ie(fo),blockComment:ie(fo),docComment:ie(fo),name:Ki,variableName:ie(Ki),typeName:Fp,tagName:ie(Fp),propertyName:jp,attributeName:ie(jp),className:ie(Ki),labelName:ie(Ki),namespace:ie(Ki),macroName:ie(Ki),literal:Ji,string:po,docString:ie(po),character:ie(po),attributeValue:ie(po),number:ic,integer:ie(ic),float:ie(ic),bool:ie(Ji),regexp:ie(Ji),escape:ie(Ji),color:ie(Ji),url:ie(Ji),keyword:Oi,self:ie(Oi),null:ie(Oi),atom:ie(Oi),unit:ie(Oi),modifier:ie(Oi),operatorKeyword:ie(Oi),controlKeyword:ie(Oi),definitionKeyword:ie(Oi),moduleKeyword:ie(Oi),operator:_i,derefOperator:ie(_i),arithmeticOperator:ie(_i),logicOperator:ie(_i),bitwiseOperator:ie(_i),compareOperator:ie(_i),updateOperator:ie(_i),definitionOperator:ie(_i),typeOperator:ie(_i),controlOperator:ie(_i),punctuation:nc,separator:ie(nc),bracket:Fs,angleBracket:ie(Fs),squareBracket:ie(Fs),paren:ie(Fs),brace:ie(Fs),content:gi,heading:_n,heading1:ie(_n),heading2:ie(_n),heading3:ie(_n),heading4:ie(_n),heading5:ie(_n),heading6:ie(_n),contentSeparator:ie(gi),list:ie(gi),quote:ie(gi),emphasis:ie(gi),strong:ie(gi),link:ie(gi),monospace:ie(gi),strikethrough:ie(gi),inserted:ie(),deleted:ie(),changed:ie(),invalid:ie(),meta:mo,documentMeta:ie(mo),annotation:ie(mo),processingInstruction:ie(mo),definition:Ft.defineModifier("definition"),constant:Ft.defineModifier("constant"),function:Ft.defineModifier("function"),standard:Ft.defineModifier("standard"),local:Ft.defineModifier("local"),special:Ft.defineModifier("special")};for(let i in L){let e=L[i];e instanceof Ft&&(e.name=i)}Up([{tag:L.link,class:"tok-link"},{tag:L.heading,class:"tok-heading"},{tag:L.emphasis,class:"tok-emphasis"},{tag:L.strong,class:"tok-strong"},{tag:L.keyword,class:"tok-keyword"},{tag:L.atom,class:"tok-atom"},{tag:L.bool,class:"tok-bool"},{tag:L.url,class:"tok-url"},{tag:L.labelName,class:"tok-labelName"},{tag:L.inserted,class:"tok-inserted"},{tag:L.deleted,class:"tok-deleted"},{tag:L.literal,class:"tok-literal"},{tag:L.string,class:"tok-string"},{tag:L.number,class:"tok-number"},{tag:[L.regexp,L.escape,L.special(L.string)],class:"tok-string2"},{tag:L.variableName,class:"tok-variableName"},{tag:L.local(L.variableName),class:"tok-variableName tok-local"},{tag:L.definition(L.variableName),class:"tok-variableName tok-definition"},{tag:L.special(L.variableName),class:"tok-variableName2"},{tag:L.definition(L.propertyName),class:"tok-propertyName tok-definition"},{tag:L.typeName,class:"tok-typeName"},{tag:L.namespace,class:"tok-namespace"},{tag:L.className,class:"tok-className"},{tag:L.macroName,class:"tok-macroName"},{tag:L.propertyName,class:"tok-propertyName"},{tag:L.operator,class:"tok-operator"},{tag:L.comment,class:"tok-comment"},{tag:L.meta,class:"tok-meta"},{tag:L.invalid,class:"tok-invalid"},{tag:L.punctuation,class:"tok-punctuation"}]);var sc;const jn=new xe;function qp(i){return ce.define({combine:i?e=>e.concat(i):void 0})}const rc=new xe;class Jt{constructor(e,t,n=[],s=""){this.data=e,this.name=s,Se.prototype.hasOwnProperty("tree")||Object.defineProperty(Se.prototype,"tree",{get(){return st(this)}}),this.parser=t,this.extension=[en.of(this),Se.languageData.of((r,o,a)=>{let c=Xp(r,o,a),h=c.type.prop(jn);if(!h)return[];let u=r.facet(h),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 b=r.facet(m.facet);return m.type=="replace"?b:b.concat(u)}}return u})].concat(n)}isActiveAt(e,t,n=-1){return Xp(e,t,n).type.prop(jn)==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(jn)==this.data){n.push({from:o,to:o+r.length});return}let a=r.prop(xe.mounted);if(a){if(a.tree.prop(jn)==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 h=r.children[c];h instanceof et&&s(h,r.positions[c]+o)}};return s(st(e),0),n}get allowsNesting(){return!0}}Jt.setState=we.define();function Xp(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 go extends Jt{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=qp(e.languageData);return new go(t,e.parser.configure({props:[jn.add(n=>n.isTop?t:void 0)]}),e.name)}configure(e,t){return new go(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function st(i){let e=i.field(Jt.state,!1);return e?e.tree:et.empty}class eS{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 js=null;class Oo{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 Oo(e,t,[],et.empty,0,n,[],null)}startParse(){return this.parser.startParse(new eS(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(On.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(On.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=js;js=this;try{return e()}finally{js=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Wp(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((h,u,f,d)=>c.push({fromA:h,toA:u,fromB:f,toB:d})),n=On.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 h of this.skipped){let u=e.mapPos(h.from,1),f=e.mapPos(h.to,-1);u<f&&a.push({from:u,to:f})}}}return new Oo(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=Wp(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 vp{createParse(t,n,s){let r=s[0].from,o=s[s.length-1].to;return{parsedPos:r,advance(){let c=js;if(c){for(let h of s)c.tempSkipped.push(h);e&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,e]):e)}return this.parsedPos=o,new et(Pt.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 js}}function Wp(i,e,t){return On.applyChanges(i,[{fromA:e,toA:t,fromB:e,toB:t}])}class qn{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 qn(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=Oo.create(e.facet(en).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new qn(n)}}Jt.state=rt.define({create:qn.init,update(i,e){for(let t of e.effects)if(t.is(Jt.setState))return t.value;return e.startState.facet(en)!=e.state.facet(en)?qn.init(e.state):i.apply(e)}});let Yp=i=>{let e=setTimeout(()=>i(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Yp=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,tS=Ge.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(Jt.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(Jt.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Yp(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(Jt.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:Jt.setState.of(new qn(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=>Qt(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=>[Jt.state,tS,se.contentAttributes.compute([i],e=>{let t=e.facet(i);return t&&t.name?{"data-language":t.name}:{}})]});class iS{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const nS=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 _o(i){let e=i.facet(qs);return e.charCodeAt(0)==9?i.tabSize*e.length:e.length}function Xs(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 Se&&(i=new bo(i));for(let n of i.state.facet(nS)){let s=n(i,e);if(s!==void 0)return s}let t=st(i.state);return t.length>=e?sS(i,t,e):null}class bo{constructor(e,t={}){this.state=e,this.options=t,this.unit=_o(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 Ln(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 zp=new xe;function sS(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.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 Gp(n,i,t)}function Gp(i,e,t){for(let n=i;n;n=n.next){let s=oS(n.node);if(s)return s(ac.create(e,t,n))}return 0}function rS(i){return i.pos==i.options.simulateBreak&&i.options.simulateDoubleBreak}function oS(i){let e=i.type.prop(zp);if(e)return e;let t=i.firstChild,n;if(t&&(n=t.type.prop(xe.closedBy))){let s=i.lastChild,r=s&&n.indexOf(s.name)>-1;return o=>Hp(o,!0,1,void 0,r&&!rS(o)?s.from:void 0)}return i.parent==null?lS:null}function lS(){return 0}class ac extends bo{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(aS(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return Gp(this.context.next,this.base,this.pos)}}function aS(i,e){for(let t=e;t;t=t.parent)if(i==t)return!0;return!1}function cS(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 h=/^ */.exec(r.text.slice(t.to-r.from))[0].length;return{from:t.from,to:t.to+h}}a=c.to}}function hS({closing:i,align:e=!0,units:t=1}){return n=>Hp(n,e,t,i)}function Hp(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?cS(i):null;return c?a?i.column(c.from):i.column(c.to):i.baseIndent+(a?0:i.unit*t)}const uS=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 fS=200;function dS(){return Se.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+fS)return i;let r=t.sliceString(s.from,n);if(!e.some(h=>h.test(r)))return i;let{state:o}=i,a=-1,c=[];for(let{head:h}of o.selection.ranges){let u=o.doc.lineAt(h);if(u.from==a)continue;a=u.from;let f=lc(o,u.from);if(f==null)continue;let d=/^\s*/.exec(u.text)[0],m=Xs(o,f);d!=m&&c.push({from:u.from,to:u.from+d.length,insert:m})}return c.length?[i,{changes:c,sequential:!0}]:i})}const pS=ce.define(),Kp=new xe;function mS(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 gS(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(Kp);if(c&&(a.to<n.length-50||n.length==i.doc.length||!OS(a))){let h=c(a,i);h&&h.from<=t&&h.from>=e&&h.to>t&&(r=h)}}return r}function OS(i){let e=i.lastChild;return e&&e.to==i.to&&e.type.isError}function yo(i,e,t){for(let n of i.facet(pS)){let s=n(i,e,t);if(s)return s}return gS(i,e,t)}function Jp(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 wo=we.define({map:Jp}),Ws=we.define({map:Jp});function em(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 bn=rt.define({create(){return de.none},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(wo)&&!_S(i,t.value.from,t.value.to)){let{preparePlaceholder:n}=e.state.facet(hc),s=n?de.replace({widget:new xS(n(e.state,t.value))}):rm;i=i.update({add:[s.range(t.value.from,t.value.to)]})}else t.is(Ws)&&(i=i.update({filter:(n,s)=>t.value.from!=n||t.value.to!=s,filterFrom:t.value.from,filterTo:t.value.to}));if(e.selection){let t=!1,{head:n}=e.selection.main;i.between(n,n,(s,r)=>{s<n&&r>n&&(t=!0)}),t&&(i=i.update({filterFrom:n,filterTo:n,filter:(s,r)=>r<=n||s>=n}))}return 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(rm.range(n,s))}return de.set(e,!0)}});function ko(i,e,t){var n;let s=null;return(n=i.field(bn,!1))===null||n===void 0||n.between(e,t,(r,o)=>{(!s||s.from>r)&&(s={from:r,to:o})}),s}function _S(i,e,t){let n=!1;return i.between(e,e,(s,r)=>{s==e&&r==t&&(n=!0)}),n}function tm(i,e){return i.field(bn,!1)?e:e.concat(we.appendConfig.of(nm()))}const bS=i=>{for(let e of em(i)){let t=yo(i.state,e.from,e.to);if(t)return i.dispatch({effects:tm(i.state,[wo.of(t),im(i,t)])}),!0}return!1},yS=i=>{if(!i.state.field(bn,!1))return!1;let e=[];for(let t of em(i)){let n=ko(i.state,t.from,t.to);n&&e.push(Ws.of(n),im(i,n,!1))}return e.length&&i.dispatch({effects:e}),e.length>0};function im(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 wS=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:bS},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:yS},{key:"Ctrl-Alt-[",run:i=>{let{state:e}=i,t=[];for(let n=0;n<e.doc.length;){let s=i.lineBlockAt(n),r=yo(e,s.from,s.to);r&&t.push(wo.of(r)),n=(r?i.lineBlockAt(r.to):s).to+1}return t.length&&i.dispatch({effects:tm(i.state,t)}),!!t.length}},{key:"Ctrl-Alt-]",run:i=>{let e=i.state.field(bn,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,i.state.doc.length,(n,s)=>{t.push(Ws.of({from:n,to:s}))}),i.dispatch({effects:t}),!0}}],kS={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},hc=ce.define({combine(i){return hi(i,kS)}});function nm(i){let e=[bn,AS];return i&&e.push(hc.of(i)),e}function sm(i,e){let{state:t}=i,n=t.facet(hc),s=o=>{let a=i.lineBlockAt(i.posAtDOM(o.target)),c=ko(i.state,a.from,a.to);c&&i.dispatch({effects:Ws.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 rm=de.replace({widget:new class extends fi{toDOM(i){return sm(i,null)}}});class xS extends fi{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return sm(e,this.value)}}const SS={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class uc extends $i{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 CS(i={}){let e=Object.assign(Object.assign({},SS),i),t=new uc(e,!0),n=new uc(e,!1),s=Ge.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(bn,!1)!=o.state.field(bn,!1)||st(o.startState)!=st(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new Qi;for(let c of o.viewportLineBlocks){let h=ko(o.state,c.from,c.to)?n:yo(o.state,c.from,c.to)?t:null;h&&a.add(c.from,c.from,h)}return a.finish()}}),{domEventHandlers:r}=e;return[s,Qx({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(s))===null||a===void 0?void 0:a.markers)||Ee.empty},initialSpacer(){return new uc(e,!1)},domEventHandlers:Object.assign(Object.assign({},r),{click:(o,a,c)=>{if(r.click&&r.click(o,a,c))return!0;let h=ko(o.state,a.from,a.to);if(h)return o.dispatch({effects:Ws.of(h)}),!0;let u=yo(o.state,a.from,a.to);return u?(o.dispatch({effects:wo.of(u)}),!0):!1}})}),nm()]}const AS=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 Jt?a=>a.prop(jn)==o.data:o?a=>a==o:void 0,this.style=Up(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(),om=ce.define({combine(i){return i.length?[i[0]]:null}});function dc(i){let e=i.facet(fc);return e.length?e:i.facet(om)}function lm(i,e){let t=[PS],n;return i instanceof Ys&&(i.module&&t.push(se.styleModule.of(i.module)),n=i.themeType),e!=null&&e.fallback?t.push(om.of(i)):n?t.push(fc.computeN([se.darkTheme],s=>s.facet(se.darkTheme)==(n=="dark")?[i]:[])):t.push(fc.of(i)),t}class QS{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 de.none;let n=new Qi;for(let{from:s,to:r}of e.visibleRanges)Hx(this.tree,t,(o,a,c)=>{n.add(o,a,this.markCache[c]||(this.markCache[c]=de.mark({class:c})))},s,r);return n.finish()}}const PS=ji.high(Ge.fromClass(QS,{decorations:i=>i.decorations})),TS=Ys.define([{tag:L.meta,color:"#404740"},{tag:L.link,textDecoration:"underline"},{tag:L.heading,textDecoration:"underline",fontWeight:"bold"},{tag:L.emphasis,fontStyle:"italic"},{tag:L.strong,fontWeight:"bold"},{tag:L.strikethrough,textDecoration:"line-through"},{tag:L.keyword,color:"#708"},{tag:[L.atom,L.bool,L.url,L.contentSeparator,L.labelName],color:"#219"},{tag:[L.literal,L.inserted],color:"#164"},{tag:[L.string,L.deleted],color:"#a11"},{tag:[L.regexp,L.escape,L.special(L.string)],color:"#e40"},{tag:L.definition(L.variableName),color:"#00f"},{tag:L.local(L.variableName),color:"#30a"},{tag:[L.typeName,L.namespace],color:"#085"},{tag:L.className,color:"#167"},{tag:[L.special(L.variableName),L.macroName],color:"#256"},{tag:L.definition(L.propertyName),color:"#00c"},{tag:L.comment,color:"#940"},{tag:L.invalid,color:"#f00"}]),ES=se.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),am=1e4,cm="()[]{}",hm=ce.define({combine(i){return hi(i,{afterCursor:!0,brackets:cm,maxScanDistance:am,renderMatch:RS})}}),$S=de.mark({class:"cm-matchingBracket"}),NS=de.mark({class:"cm-nonmatchingBracket"});function RS(i){let e=[],t=i.matched?$S:NS;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 VS=[rt.define({create(){return de.none},update(i,e){if(!e.docChanged&&!e.selection)return i;let t=[],n=e.state.facet(hm);for(let s of e.state.selection.ranges){if(!s.empty)continue;let r=bi(e.state,s.head,-1,n)||s.head>0&&bi(e.state,s.head-1,1,n)||n.afterCursor&&(bi(e.state,s.head,1,n)||s.head<e.state.doc.length&&bi(e.state,s.head+1,-1,n));r&&(t=t.concat(n.renderMatch(r,e.state)))}return de.set(t,!0)},provide:i=>se.decorations.from(i)}),ES];function LS(i={}){return[hm.of(i),VS]}const MS=new xe;function pc(i,e,t){let n=i.prop(e<0?xe.openedBy:xe.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(MS);return e?e(i.node):i}function bi(i,e,t,n={}){let s=n.maxScanDistance||am,r=n.brackets||cm,o=st(i),a=o.resolveInner(e,t);for(let c=a;c;c=c.parent){let h=pc(c.type,t,r);if(h&&c.from<c.to){let u=mc(c);if(u&&(t>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return BS(i,e,t,c,u,h,r)}}return DS(i,e,t,o,a.type,s,r)}function BS(i,e,t,n,s,r,o){let a=n.parent,c={from:s.from,to:s.to},h=0,u=a==null?void 0:a.cursor();if(u&&(t<0?u.childBefore(n.from):u.childAfter(n.to)))do if(t<0?u.to<=n.from:u.from>=n.to){if(h==0&&r.indexOf(u.type.name)>-1&&u.from<u.to){let f=mc(u);return{start:c,end:f?{from:f.from,to:f.to}:void 0,matched:!0}}else if(pc(u.type,t,o))h++;else if(pc(u.type,-t,o)){if(h==0){let f=mc(u);return{start:c,end:f&&f.from<f.to?{from:f.from,to:f.to}:void 0,matched:!1}}h--}}while(t<0?u.prevSibling():u.nextSibling());return{start:c,matched:!1}}function DS(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 h={from:t<0?e-1:e,to:t>0?e+1:e},u=i.doc.iterRange(e,t>0?i.doc.length:0),f=0;for(let d=0;!u.next().done&&d<=r;){let m=u.value;t<0&&(d+=m.length);let b=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(b+w,1).type!=s))if(p%2==0==t>0)f++;else{if(f==1)return{start:h,end:{from:b+w,to:b+w+1},matched:p>>1==c>>1};f--}}t>0&&(d+=m.length)}return u.done?{start:h,matched:!1}:null}const vS=Object.create(null),um=[Pt.none],fm=[],dm=Object.create(null),ZS=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"]])ZS[i]=IS(vS,e);function gc(i,e){fm.indexOf(i)>-1||(fm.push(i),console.warn(e))}function IS(i,e){let t=[];for(let a of e.split(" ")){let c=[];for(let h of a.split(".")){let u=i[h]||L[h];u?typeof u=="function"?c.length?c=c.map(u):gc(h,`Modifier ${h} used at start of tag`):c.length?gc(h,`Tag ${h} used as modifier`):c=Array.isArray(u)?u:[u]:gc(h,`Unknown highlighting tag ${h}`)}for(let h of c)t.push(h)}if(!t.length)return 0;let n=e.replace(/ /g,"_"),s=n+" "+t.map(a=>a.id),r=dm[s];if(r)return r.id;let o=dm[s]=Pt.define({id:um.length,name:n,props:[Zp({[n]:t})]});return um.push(o),o.id}Ze.RTL,Ze.LTR;const US=i=>{let{state:e}=i,t=e.doc.lineAt(e.selection.main.from),n=_c(i.state,t.from);return n.line?FS(i):n.block?qS(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 FS=Oc(YS,0),jS=Oc(pm,0),qS=Oc((i,e)=>pm(i,e,WS(e)),0);function _c(i,e){let t=i.languageDataAt("commentTokens",e);return t.length?t[0]:{}}const zs=50;function XS(i,{open:e,close:t},n,s){let r=i.sliceDoc(n-zs,n),o=i.sliceDoc(s,s+zs),a=/\s*$/.exec(r)[0].length,c=/^\s*/.exec(o)[0].length,h=r.length-a;if(r.slice(h-e.length,h)==e&&o.slice(c,c+t.length)==t)return{open:{pos:n-a,margin:a&&1},close:{pos:s+c,margin:c&&1}};let u,f;s-n<=2*zs?u=f=i.sliceDoc(n,s):(u=i.sliceDoc(n,n+zs),f=i.sliceDoc(s-zs,s));let d=/^\s*/.exec(u)[0].length,m=/\s*$/.exec(f)[0].length,b=f.length-m-t.length;return u.slice(d,d+e.length)==e&&f.slice(b,b+t.length)==t?{open:{pos:n+d+e.length,margin:/\s/.test(u.charAt(d+e.length))?1:0},close:{pos:s-m-t.length,margin:/\s/.test(f.charAt(b-1))?1:0}}:null}function WS(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 pm(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)=>XS(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:h,close:u}=a;r.push({from:h.pos-c.open.length,to:h.pos+h.margin},{from:u.pos-u.margin,to:u.pos+c.close.length})}return{changes:r}}return null}function YS(i,e,t=e.selection.ranges){let n=[],s=-1;for(let{from:r,to:o}of t){let a=n.length,c=1e9,h=_c(e,r).line;if(h){for(let u=r;u<=o;){let f=e.doc.lineAt(u);if(f.from>s&&(r==o||o>f.from)){s=f.from;let d=/^\s*/.exec(f.text)[0].length,m=d==f.length,b=f.text.slice(d,d+h.length)==h?d:-1;d<f.text.length&&d<c&&(c=d),n.push({line:f,comment:b,token:h,indent:d,empty:m,single:!1})}u=f.to+1}if(c<1e9)for(let u=a;u<n.length;u++)n[u].indent<n[u].line.text.length&&(n[u].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:h,empty:u,single:f}of n)(f||!u)&&r.push({from:a.from+h,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 h=o.from+a,u=h+c.length;o.text[u-o.from]==" "&&u++,r.push({from:h,to:u})}return{changes:r}}return null}const bc=Ai.define(),zS=Ai.define(),GS=ce.define(),mm=ce.define({combine(i){return hi(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)})}}),gm=rt.define({create(){return yi.empty},update(i,e){let t=e.state.facet(mm),n=e.annotation(bc);if(n){let c=Et.fromTransaction(e,n.selection),h=n.side,u=h==0?i.undone:i.done;return c?u=So(u,u.length,t.minDepth,c):u=bm(u,e.startState.selection),new yi(h==0?n.rest:u,h==0?u:n.rest)}let s=e.annotation(zS);if((s=="full"||s=="before")&&(i=i.isolate()),e.annotation(Ke.addToHistory)===!1)return e.changes.empty?i:i.addMapping(e.changes.desc);let r=Et.fromTransaction(e),o=e.annotation(Ke.time),a=e.annotation(Ke.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 yi(i.done.map(Et.fromJSON),i.undone.map(Et.fromJSON))}});function HS(i={}){return[gm,mm.of(i),se.domEventHandlers({beforeinput(e,t){let n=e.inputType=="historyUndo"?Om:e.inputType=="historyRedo"?yc:null;return n?(e.preventDefault(),n(t)):!1}})]}function xo(i,e){return function({state:t,dispatch:n}){if(!e&&t.readOnly)return!1;let s=t.field(gm,!1);if(!s)return!1;let r=s.pop(i,t,e);return r?(n(r),!0):!1}}const Om=xo(0,!1),yc=xo(1,!1),KS=xo(0,!0),JS=xo(1,!0);class Et{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 Et(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 Et(e.changes&&it.fromJSON(e.changes),[],e.mapped&&ci.fromJSON(e.mapped),e.startSelection&&j.fromJSON(e.startSelection),e.selectionsAfter.map(j.fromJSON))}static fromTransaction(e,t){let n=jt;for(let s of e.startState.facet(GS)){let r=s(e);r.length&&(n=n.concat(r))}return!n.length&&e.changes.empty?null:new Et(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,jt)}static selection(e){return new Et(void 0,jt,void 0,void 0,e)}}function So(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 eC(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 h=t[c++],u=t[c++];a>=h&&o<=u&&(n=!0)}}),n}function tC(i,e){return i.ranges.length==e.ranges.length&&i.ranges.filter((t,n)=>t.empty!=e.ranges[n].empty).length===0}function _m(i,e){return i.length?e.length?i.concat(e):i:e}const jt=[],iC=200;function bm(i,e){if(i.length){let t=i[i.length-1],n=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-iC));return n.length&&n[n.length-1].eq(e)?i:(n.push(e),So(i,i.length-1,1e9,t.setSelAfter(n)))}else return[Et.selection([e])]}function nC(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=jt;for(;t;){let s=sC(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?[Et.selection(n)]:jt}function sC(i,e,t){let n=_m(i.selectionsAfter.length?i.selectionsAfter.map(a=>a.map(e)):jt,t);if(!i.changes)return Et.selection(n);let s=i.changes.map(e),r=e.mapDesc(i.changes,!0),o=i.mapped?i.mapped.composeDesc(r):r;return new Et(s,we.mapEffects(i.effects,e),o,i.startSelection.map(r),n)}const rC=/^(input\.type|delete)($|\.)/;class yi{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 yi(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||rC.test(n))&&(!a.selectionsAfter.length&&t-this.prevTime<s.newGroupDelay&&s.joinToEvent(r,eC(a.changes,e.changes))||n=="input.type.compose")?o=So(o,o.length-1,s.minDepth,new Et(e.changes.compose(a.changes),_m(we.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,jt)):o=So(o,o.length,s.minDepth,e),new yi(o,jt,t,n)}addSelection(e,t,n,s){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:jt;return r.length>0&&t-this.prevTime<s&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&tC(r[r.length-1],e)?this:new yi(bm(this.done,e),this.undone,t,n)}addMapping(e){return new yi(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:nC(s),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){let a=s.length==1?jt: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}}yi.empty=new yi(jt,jt);const oC=[{key:"Mod-z",run:Om,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:KS,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:JS,preventDefault:!0}];function Xn(i,e){return j.create(i.ranges.map(e),i.mainIndex)}function wi(i,e){return i.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function ei({state:i,dispatch:e},t){let n=Xn(i.selection,t);return n.eq(i.selection,!0)?!1:(e(wi(i,n)),!0)}function Co(i,e){return j.cursor(e?i.to:i.from)}function ym(i,e){return ei(i,t=>t.empty?i.moveByChar(t,e):Co(t,e))}function _t(i){return i.textDirectionAt(i.state.selection.main.head)==Ze.LTR}const wm=i=>ym(i,!_t(i)),km=i=>ym(i,_t(i));function xm(i,e){return ei(i,t=>t.empty?i.moveByGroup(t,e):Co(t,e))}const lC=i=>xm(i,!_t(i)),aC=i=>xm(i,_t(i));function cC(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 Ao(i,e,t){let n=st(i).resolveInner(e.head),s=t?xe.closedBy:xe.openedBy;for(let c=e.head;;){let h=t?n.childAfter(c):n.childBefore(c);if(!h)break;cC(i,h,s)?n=h:c=t?h.to:h.from}let r=n.type.prop(s),o,a;return r&&(o=t?bi(i,n.from,1):bi(i,n.to,-1))&&o.matched?a=t?o.end.to:o.end.from:a=t?n.to:n.from,j.cursor(a,t?-1:1)}const hC=i=>ei(i,e=>Ao(i.state,e,!_t(i))),uC=i=>ei(i,e=>Ao(i.state,e,_t(i)));function Sm(i,e){return ei(i,t=>{if(!t.empty)return Co(t,e);let n=i.moveVertically(t,e);return n.head!=t.head?n:i.moveToLineBoundary(t,e)})}const Cm=i=>Sm(i,!1),Am=i=>Sm(i,!0);function Qm(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 Pm(i,e){let t=Qm(i),{state:n}=i,s=Xn(n.selection,o=>o.empty?i.moveVertically(o,e,t.height):Co(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,h=a.bottom-t.marginBottom;o&&o.top>c&&o.bottom<h&&(r=se.scrollIntoView(s.main.head,{y:"start",yMargin:o.top-c}))}return i.dispatch(wi(n,s),{effects:r}),!0}const Tm=i=>Pm(i,!1),kc=i=>Pm(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=j.cursor(n.from+r))}return s}const fC=i=>ei(i,e=>tn(i,e,!0)),dC=i=>ei(i,e=>tn(i,e,!1)),pC=i=>ei(i,e=>tn(i,e,!_t(i))),mC=i=>ei(i,e=>tn(i,e,_t(i))),gC=i=>ei(i,e=>j.cursor(i.lineBlockAt(e.head).from,1)),OC=i=>ei(i,e=>j.cursor(i.lineBlockAt(e.head).to,-1));function _C(i,e,t){let n=!1,s=Xn(i.selection,r=>{let o=bi(i,r.head,-1)||bi(i,r.head,1)||r.head>0&&bi(i,r.head-1,1)||r.head<i.doc.length&&bi(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?j.range(r.anchor,a):j.cursor(a)});return n?(e(wi(i,s)),!0):!1}const bC=({state:i,dispatch:e})=>_C(i,e,!1);function qt(i,e){let t=Xn(i.state.selection,n=>{let s=e(n);return j.range(n.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return t.eq(i.state.selection)?!1:(i.dispatch(wi(i.state,t)),!0)}function Em(i,e){return qt(i,t=>i.moveByChar(t,e))}const $m=i=>Em(i,!_t(i)),Nm=i=>Em(i,_t(i));function Rm(i,e){return qt(i,t=>i.moveByGroup(t,e))}const yC=i=>Rm(i,!_t(i)),wC=i=>Rm(i,_t(i)),kC=i=>qt(i,e=>Ao(i.state,e,!_t(i))),xC=i=>qt(i,e=>Ao(i.state,e,_t(i)));function Vm(i,e){return qt(i,t=>i.moveVertically(t,e))}const Lm=i=>Vm(i,!1),Mm=i=>Vm(i,!0);function Bm(i,e){return qt(i,t=>i.moveVertically(t,e,Qm(i).height))}const Dm=i=>Bm(i,!1),vm=i=>Bm(i,!0),SC=i=>qt(i,e=>tn(i,e,!0)),CC=i=>qt(i,e=>tn(i,e,!1)),AC=i=>qt(i,e=>tn(i,e,!_t(i))),QC=i=>qt(i,e=>tn(i,e,_t(i))),PC=i=>qt(i,e=>j.cursor(i.lineBlockAt(e.head).from)),TC=i=>qt(i,e=>j.cursor(i.lineBlockAt(e.head).to)),Zm=({state:i,dispatch:e})=>(e(wi(i,{anchor:0})),!0),Im=({state:i,dispatch:e})=>(e(wi(i,{anchor:i.doc.length})),!0),Um=({state:i,dispatch:e})=>(e(wi(i,{anchor:i.selection.main.anchor,head:0})),!0),Fm=({state:i,dispatch:e})=>(e(wi(i,{anchor:i.selection.main.anchor,head:i.doc.length})),!0),EC=({state:i,dispatch:e})=>(e(i.update({selection:{anchor:0,head:i.doc.length},userEvent:"select"})),!0),$C=({state:i,dispatch:e})=>{let t=Po(i).map(({from:n,to:s})=>j.range(n,Math.min(s+1,i.doc.length)));return e(i.update({selection:j.create(t),userEvent:"select"})),!0},NC=({state:i,dispatch:e})=>{let t=Xn(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 j.range(a.to,a.from)}return n});return t.eq(i.selection)?!1:(e(wi(i,t)),!0)},RC=({state:i,dispatch:e})=>{let t=i.selection,n=null;return t.ranges.length>1?n=j.create([t.main]):t.main.empty||(n=j.create([j.cursor(t.main.head)])),n?(e(wi(i,n)),!0):!1};function Gs(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=Qo(i,c,!1)):c>o&&(t="delete.forward",c=Qo(i,c,!0)),o=Math.min(o,c),a=Math.max(a,c)}else o=Qo(i,o,!1),a=Qo(i,a,!0);return o==a?{range:r}:{changes:{from:o,to:a},range:j.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 Qo(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 jm=(i,e,t)=>Gs(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 h=Ln(a,r.tabSize),u=h%_o(r)||_o(r);for(let f=0;f<u&&a[a.length-1-f]==" ";f++)s--;c=s}else c=ut(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=ut(o.text,c-o.from,!1,!1)+o.from);return c}),xc=i=>jm(i,!1,!0),qm=i=>jm(i,!0,!1),Xm=(i,e)=>Gs(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=ut(r.text,n-r.from,e)+r.from,h=r.text.slice(Math.min(n,c)-r.from,Math.max(n,c)-r.from),u=o(h);if(a!=null&&u!=a)break;(h!=" "||n!=t.head)&&(a=u),n=c}return n}),Wm=i=>Xm(i,!1),VC=i=>Xm(i,!0),LC=i=>Gs(i,e=>{let t=i.lineBlockAt(e.head).to;return e.head<t?t:Math.min(i.state.doc.length,e.head+1)}),MC=i=>Gs(i,e=>{let t=i.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),BC=i=>Gs(i,e=>{let t=i.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(i.state.doc.length,e.head+1)}),DC=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=i.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:Ae.of(["",""])},range:j.cursor(n.from)}));return e(i.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},vC=({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:ut(r.text,s-r.from,!1)+r.from,a=s==r.to?s+1:ut(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:j.cursor(a)}});return t.changes.empty?!1:(e(i.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Po(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 Ym(i,e,t){if(i.readOnly)return!1;let n=[],s=[];for(let r of Po(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(j.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(j.range(c.anchor-a,c.head-a))}}return n.length?(e(i.update({changes:n,scrollIntoView:!0,selection:j.create(s,i.selection.mainIndex),userEvent:"move.line"})),!0):!1}const ZC=({state:i,dispatch:e})=>Ym(i,e,!1),IC=({state:i,dispatch:e})=>Ym(i,e,!0);function zm(i,e,t){if(i.readOnly)return!1;let n=[];for(let s of Po(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 UC=({state:i,dispatch:e})=>zm(i,e,!1),FC=({state:i,dispatch:e})=>zm(i,e,!0),jC=i=>{if(i.state.readOnly)return!1;let{state:e}=i,t=e.changes(Po(e).map(({from:s,to:r})=>(s>0?s--:r<e.doc.length&&r++,{from:s,to:r}))),n=Xn(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 qC(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(xe.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 Gm=Hm(!1),XC=Hm(!0);function Hm(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&&qC(e,r);i&&(r=o=(o<=a.to?a:e.doc.lineAt(o)).to);let h=new bo(e,{simulateBreak:r,simulateDoubleBreak:!!c}),u=lc(h,r);for(u==null&&(u=Ln(/^\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=["",Xs(e,u)];return c&&f.push(Xs(e,h.lineIndent(a.from,-1))),{changes:{from:r,to:o,insert:Ae.of(f)},range:j.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:j.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}})}const WC=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=Object.create(null),n=new bo(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 h=/^\s*/.exec(r.text)[0],u=Xs(i,c);(h!=u||a.from<r.from+h.length)&&(t[r.from]=c,o.push({from:r.from,to:r.from+h.length,insert:u}))});return s.changes.empty||e(i.update(s,{userEvent:"indent"})),!0},Km=({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),Jm=({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=Ln(s,i.tabSize),o=0,a=Xs(i,Math.max(0,r-_o(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),YC=i=>(i.setTabFocusMode(),!0),zC=[{key:"Ctrl-b",run:wm,shift:$m,preventDefault:!0},{key:"Ctrl-f",run:km,shift:Nm},{key:"Ctrl-p",run:Cm,shift:Lm},{key:"Ctrl-n",run:Am,shift:Mm},{key:"Ctrl-a",run:gC,shift:PC},{key:"Ctrl-e",run:OC,shift:TC},{key:"Ctrl-d",run:qm},{key:"Ctrl-h",run:xc},{key:"Ctrl-k",run:LC},{key:"Ctrl-Alt-h",run:Wm},{key:"Ctrl-o",run:DC},{key:"Ctrl-t",run:vC},{key:"Ctrl-v",run:kc}],GC=[{key:"ArrowLeft",run:wm,shift:$m,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:lC,shift:yC,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:pC,shift:AC,preventDefault:!0},{key:"ArrowRight",run:km,shift:Nm,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:aC,shift:wC,preventDefault:!0},{mac:"Cmd-ArrowRight",run:mC,shift:QC,preventDefault:!0},{key:"ArrowUp",run:Cm,shift:Lm,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Zm,shift:Um},{mac:"Ctrl-ArrowUp",run:Tm,shift:Dm},{key:"ArrowDown",run:Am,shift:Mm,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Im,shift:Fm},{mac:"Ctrl-ArrowDown",run:kc,shift:vm},{key:"PageUp",run:Tm,shift:Dm},{key:"PageDown",run:kc,shift:vm},{key:"Home",run:dC,shift:CC,preventDefault:!0},{key:"Mod-Home",run:Zm,shift:Um},{key:"End",run:fC,shift:SC,preventDefault:!0},{key:"Mod-End",run:Im,shift:Fm},{key:"Enter",run:Gm,shift:Gm},{key:"Mod-a",run:EC},{key:"Backspace",run:xc,shift:xc},{key:"Delete",run:qm},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Wm},{key:"Mod-Delete",mac:"Alt-Delete",run:VC},{mac:"Mod-Backspace",run:MC},{mac:"Mod-Delete",run:BC}].concat(zC.map(i=>({mac:i.key,run:i.run,shift:i.shift}))),HC=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:hC,shift:kC},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:uC,shift:xC},{key:"Alt-ArrowUp",run:ZC},{key:"Shift-Alt-ArrowUp",run:UC},{key:"Alt-ArrowDown",run:IC},{key:"Shift-Alt-ArrowDown",run:FC},{key:"Escape",run:RC},{key:"Mod-Enter",run:XC},{key:"Alt-l",mac:"Ctrl-l",run:$C},{key:"Mod-i",run:NC,preventDefault:!0},{key:"Mod-[",run:Jm},{key:"Mod-]",run:Km},{key:"Mod-Alt-\\",run:WC},{key:"Shift-Mod-k",run:jC},{key:"Shift-Mod-\\",run:bC},{key:"Mod-/",run:US},{key:"Alt-A",run:jS},{key:"Ctrl-m",mac:"Shift-Alt-m",run:YC}].concat(GC),KC={key:"Tab",run:Km,shift:Jm};function ve(){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++)eg(i,arguments[e]);return i}function eg(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++)eg(i,e[t]);else throw new RangeError("Unsupported child node: "+e)}const tg=typeof String.prototype.normalize=="function"?i=>i.normalize("NFKD"):i=>i;class Wn{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(tg(a)):tg,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 Ct(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=Dl(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=ai(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"&&(Wn.prototype[Symbol.iterator]=function(){return this});const ig={from:-1,to:-1,match:/.*/.exec("")},Cc="gm"+(/x/.unicode==null?"":"u");class ng{constructor(e,t,n,s=0,r=e.length){if(this.text=e,this.to=r,this.curLine="",this.done=!1,this.value=ig,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new sg(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=To(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=To(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 Yn{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 Yn(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 Yn(o,r)),new Yn(t,r.slice(t-o,n-o))}}class sg{constructor(e,t,n,s,r){this.text=e,this.to=r,this.done=!1,this.value=ig,this.matchPos=To(e,s),this.re=new RegExp(t,Cc+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.flat=Yn.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=To(this.text,s+(n==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Yn.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(ng.prototype[Symbol.iterator]=sg.prototype[Symbol.iterator]=function(){return this});function JC(i){try{return new RegExp(i,Cc),!0}catch{return!1}}function To(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 Qc(i){let e=String(i.state.doc.lineAt(i.state.selection.main.head).number),t=ve("input",{class:"cm-textfield",name:"line",value:e}),n=ve("form",{class:"cm-gotoLine",onkeydown:r=>{r.keyCode==27?(r.preventDefault(),i.dispatch({effects:Eo.of(!1)}),i.focus()):r.keyCode==13&&(r.preventDefault(),s())},onsubmit:r=>{r.preventDefault(),s()}},ve("label",i.state.phrase("Go to line"),": ",t)," ",ve("button",{class:"cm-button",type:"submit"},i.state.phrase("go")));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,h,u,f]=r,d=u?+u.slice(1):0,m=h?+h:a.number;if(h&&f){let g=m/100;c&&(g=g*(c=="-"?-1:1)+a.number/o.doc.lines),m=Math.round(o.doc.lines*g)}else h&&c&&(m=m*(c=="-"?-1:1)+a.number);let b=o.doc.line(Math.max(1,Math.min(o.doc.lines,m))),w=j.cursor(b.from+Math.max(0,Math.min(d,b.length)));i.dispatch({effects:[Eo.of(!1),se.scrollIntoView(w.from,{y:"center"})],selection:w}),i.focus()}return{dom:n}}const Eo=we.define(),rg=rt.define({create(){return!0},update(i,e){for(let t of e.effects)t.is(Eo)&&(i=t.value);return i},provide:i=>Zs.from(i,e=>e?Qc:null)}),eA=i=>{let e=vs(i,Qc);if(!e){let t=[Eo.of(!0)];i.state.field(rg,!1)==null&&t.push(we.appendConfig.of([rg,tA])),i.dispatch({effects:t}),e=vs(i,Qc)}return e&&e.dom.querySelector("input").select(),!0},tA=se.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),iA={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},og=ce.define({combine(i){return hi(i,iA,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function nA(i){let e=[aA,lA];return i&&e.push(og.of(i)),e}const sA=de.mark({class:"cm-selectionMatch"}),rA=de.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function lg(i,e,t,n){return(t==0||i(e.sliceDoc(t-1,t))!=je.Word)&&(n==e.doc.length||i(e.sliceDoc(n,n+1))!=je.Word)}function oA(i,e,t,n){return i(e.sliceDoc(t,t+1))==je.Word&&i(e.sliceDoc(n-1,n))==je.Word}const lA=Ge.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(og),{state:t}=i,n=t.selection;if(n.ranges.length>1)return de.none;let s=n.main,r,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return de.none;let c=t.wordAt(s.head);if(!c)return de.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 de.none;if(e.wholeWords){if(r=t.sliceDoc(s.from,s.to),o=t.charCategorizer(s.head),!(lg(o,t,s.from,s.to)&&oA(o,t,s.from,s.to)))return de.none}else if(r=t.sliceDoc(s.from,s.to),!r)return de.none}let a=[];for(let c of i.visibleRanges){let h=new Wn(t.doc,r,c.from,c.to);for(;!h.next().done;){let{from:u,to:f}=h.value;if((!o||lg(o,t,u,f))&&(s.empty&&u<=s.from&&f>=s.to?a.push(rA.range(u,f)):(u>=s.to||f<=s.from)&&a.push(sA.range(u,f)),a.length>e.maxMatches))return de.none}}return de.set(a)}},{decorations:i=>i.decorations}),aA=se.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),cA=({state:i,dispatch:e})=>{let{selection:t}=i,n=j.create(t.ranges.map(s=>i.wordAt(s.head)||j.cursor(s.head)),t.mainIndex);return n.eq(t)?!1:(e(i.update({selection:n})),!0)};function hA(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 Wn(i.doc,e,n[n.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new Wn(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 uA=({state:i,dispatch:e})=>{let{ranges:t}=i.selection;if(t.some(r=>r.from===r.to))return cA({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=hA(i,n);return s?(e(i.update({selection:i.selection.addRange(j.range(s.from,s.to),!1),effects:se.scrollIntoView(s.to)})),!0):!1},zn=ce.define({combine(i){return hi(i,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new xA(e),scrollToMatch:e=>se.scrollIntoView(e)})}});class ag{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||JC(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
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 mA(this):new dA(this)}getCursor(e,t=0,n){let s=e.doc?e:Se.create({doc:e});return n==null&&(n=s.doc.length),this.regexp?Hn(this,s,t,n):Gn(this,s,t,n)}}class cg{constructor(e){this.spec=e}}function Gn(i,e,t,n){return new Wn(e.doc,i.unquoted,t,n,i.caseSensitive?void 0:s=>s.toLowerCase(),i.wholeWord?fA(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function fA(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))!=je.Word||e(No(s,t-r))!=je.Word)&&(e(No(s,n-r))!=je.Word||e($o(s,n-r))!=je.Word))}class dA extends cg{constructor(e){super(e)}nextMatch(e,t,n){let s=Gn(this.spec,e,n,e.doc.length).nextOverlapping();if(s.done){let r=Math.min(e.doc.length,t+this.spec.unquoted.length);s=Gn(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=Gn(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=Gn(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=Gn(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 Hn(i,e,t,n){return new ng(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(ut(i,e,!1),e)}function No(i,e){return i.slice(e,ut(i,e))}function pA(i){return(e,t,n)=>!n[0].length||(i($o(n.input,n.index))!=je.Word||i(No(n.input,n.index))!=je.Word)&&(i(No(n.input,n.index+n[0].length))!=je.Word||i($o(n.input,n.index+n[0].length))!=je.Word)}class mA extends cg{nextMatch(e,t,n){let s=Hn(this.spec,e,n,e.doc.length).next();return s.done&&(s=Hn(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=Hn(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)=>n=="$"?"$":n=="&"?e.match[0]:n!="0"&&+n<e.match.length?e.match[n]:t)}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-250),Math.min(n+250,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}const Hs=we.define(),Pc=we.define(),nn=rt.define({create(i){return new Tc($c(i).create(),null)},update(i,e){for(let t of e.effects)t.is(Hs)?i=new Tc(t.value.create(),i.panel):t.is(Pc)&&(i=new Tc(i.query,t.value?Ec:null));return i},provide:i=>Zs.from(i,e=>e.panel)});class Tc{constructor(e,t){this.query=e,this.panel=t}}const gA=de.mark({class:"cm-searchMatch"}),OA=de.mark({class:"cm-searchMatch cm-searchMatch-selected"}),_A=Ge.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 de.none;let{view:t}=this,n=new Qi;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,(h,u)=>{let f=t.state.selection.ranges.some(d=>d.from==h&&d.to==u);n.add(h,u,f?OA:gA)})}return n.finish()}},{decorations:i=>i.decorations});function Ks(i){return e=>{let t=e.state.field(nn,!1);return t&&t.query.spec.valid?i(e,t):dg(e)}}const Ro=Ks((i,{query:e})=>{let{to:t}=i.state.selection.main,n=e.nextMatch(i.state,t,t);if(!n)return!1;let s=j.single(n.from,n.to),r=i.state.facet(zn);return i.dispatch({selection:s,effects:[Nc(i,n),r.scrollToMatch(s.main,i)],userEvent:"select.search"}),fg(i),!0}),Vo=Ks((i,{query:e})=>{let{state:t}=i,{from:n}=t.selection.main,s=e.prevMatch(t,n,n);if(!s)return!1;let r=j.single(s.from,s.to),o=i.state.facet(zn);return i.dispatch({selection:r,effects:[Nc(i,s),o.scrollToMatch(r.main,i)],userEvent:"select.search"}),fg(i),!0}),bA=Ks((i,{query:e})=>{let t=e.matchAll(i.state,1e3);return!t||!t.length?!1:(i.dispatch({selection:j.create(t.map(n=>j.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),yA=({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 Wn(i.doc,i.sliceDoc(n,s));!a.next().done;){if(r.length>1e3)return!1;a.value.from==n&&(o=r.length),r.push(j.range(a.value.from,a.value.to))}return e(i.update({selection:j.create(r,o),userEvent:"select.search.matches"})),!0},hg=Ks((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,h,u=[];if(o.from==n&&o.to==s&&(h=t.toText(e.getReplacement(o)),a.push({from:o.from,to:o.to,insert:h}),o=e.nextMatch(t,o.from,o.to),u.push(se.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(n).number)+"."))),o){let f=a.length==0||a[0].from>=r.to?0:r.to-r.from-h.length;c=j.single(o.from-f,o.to-f),u.push(Nc(i,o)),u.push(t.facet(zn).scrollToMatch(c.main,i))}return i.dispatch({changes:a,selection:c,effects:u,userEvent:"input.replace"}),!0}),wA=Ks((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(zn).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 h=i.facet(zn);return new ag({search:((t=e==null?void 0:e.literal)!==null&&t!==void 0?t:h.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:(n=e==null?void 0:e.caseSensitive)!==null&&n!==void 0?n:h.caseSensitive,literal:(s=e==null?void 0:e.literal)!==null&&s!==void 0?s:h.literal,regexp:(r=e==null?void 0:e.regexp)!==null&&r!==void 0?r:h.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function ug(i){let e=vs(i,Ec);return e&&e.dom.querySelector("[main-field]")}function fg(i){let e=ug(i);e&&e==i.root.activeElement&&e.select()}const dg=i=>{let e=i.state.field(nn,!1);if(e&&e.panel){let t=ug(i);if(t&&t!=i.root.activeElement){let n=$c(i.state,e.query.spec);n.valid&&i.dispatch({effects:Hs.of(n)}),t.focus(),t.select()}}else i.dispatch({effects:[Pc.of(!0),e?Hs.of($c(i.state,e.query.spec)):we.appendConfig.of(CA)]});return!0},pg=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},kA=[{key:"Mod-f",run:dg,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:pg,scope:"editor search-panel"},{key:"Mod-Shift-l",run:yA},{key:"Mod-Alt-g",run:eA},{key:"Mod-d",run:uA,preventDefault:!0}];class xA{constructor(e){this.view=e;let t=this.query=e.state.field(nn).query.spec;this.commit=this.commit.bind(this),this.searchField=ve("input",{value:t.search,placeholder:Lt(e,"Find"),"aria-label":Lt(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ve("input",{value:t.replace,placeholder:Lt(e,"Replace"),"aria-label":Lt(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ve("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=ve("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=ve("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function n(s,r,o){return ve("button",{class:"cm-button",name:s,onclick:r,type:"button"},o)}this.dom=ve("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,n("next",()=>Ro(e),[Lt(e,"next")]),n("prev",()=>Vo(e),[Lt(e,"previous")]),n("select",()=>bA(e),[Lt(e,"all")]),ve("label",null,[this.caseField,Lt(e,"match case")]),ve("label",null,[this.reField,Lt(e,"regexp")]),ve("label",null,[this.wordField,Lt(e,"by word")]),...e.state.readOnly?[]:[ve("br"),this.replaceField,n("replace",()=>hg(e),[Lt(e,"replace")]),n("replaceAll",()=>wA(e),[Lt(e,"replace all")])],ve("button",{name:"close",onclick:()=>pg(e),"aria-label":Lt(e,"close"),type:"button"},["×"])])}commit(){let e=new ag({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:Hs.of(e)}))}keydown(e){Lk(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(),hg(this.view))}update(e){for(let t of e.transactions)for(let n of t.effects)n.is(Hs)&&!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(zn).top}}function Lt(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 SA=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"}}),CA=[nn,ji.low(_A),SA];class mg{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(bg(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 gg(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 AA(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=gg(e)+gg(t)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function Og(i){let e=i.map(s=>typeof s=="string"?{label:s}:s),[t,n]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:AA(e);return s=>{let r=s.matchBefore(n);return r||s.explicit?{from:r?r.from:s.pos,options:e,validFor:t}:null}}function QA(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 _g{constructor(e,t,n,s){this.completion=e,this.source=t,this.match=n,this.score=s}}function yn(i){return i.selection.main.from}function bg(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=Ai.define();function PA(i,e,t,n){let{main:s}=i.selection,r=t-s.from,o=n-s.from;return Object.assign(Object.assign({},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:j.cursor(a.from+r+c.length)}})),{scrollIntoView:!0,userEvent:"input.complete"})}const yg=new WeakMap;function TA(i){if(!Array.isArray(i))return i;let e=yg.get(i);return e||yg.set(i,e=Og(i)),e}const Bo=we.define(),Js=we.define();class EA{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=Ct(e,t),s=ai(n);this.chars.push(n);let r=e.slice(t,t+s),o=r.toUpperCase();this.folded.push(Ct(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 O=Ct(e,0),C=ai(O),y=C==e.length?0:-100;if(O!=t[0])if(O==n[0])y+=-200;else return null;return this.ret(y,[0,C])}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,h=0;if(a<0){for(let O=0,C=Math.min(e.length,200);O<C&&h<c;){let y=Ct(e,O);(y==t[h]||y==n[h])&&(s[h++]=O),O+=ai(y)}if(h<c)return null}let u=0,f=0,d=!1,m=0,b=-1,w=-1,g=/[a-z]/.test(e),p=!0;for(let O=0,C=Math.min(e.length,200),y=0;O<C&&f<c;){let E=Ct(e,O);a<0&&(u<c&&E==t[u]&&(r[u++]=O),m<c&&(E==t[m]||E==n[m]?(m==0&&(b=O),w=O+1,m++):m=0));let x,k=E<255?E>=48&&E<=57||E>=97&&E<=122?2:E>=65&&E<=90?1:0:(x=Dl(E))!=x.toLowerCase()?1:x!=x.toUpperCase()?2:0;(!O||k==1&&g||y==0&&k!=0)&&(t[f]==E||n[f]==E&&(d=!0)?o[f++]=O:o.length&&(p=!1)),y=k,O+=ai(E)}return f==c&&o[0]==0&&p?this.result(-100+(d?-200:0),o,e):m==c&&b==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,[b,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?ai(Ct(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 $A{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 hi(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:NA,filterStrict:!1,compareCompletions:(e,t)=>e.label.localeCompare(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=>wg(e(n),t(n)),optionClass:(e,t)=>n=>wg(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function wg(i,e){return i?e?i+" "+e:i:e}function NA(i,e,t,n,s,r){let o=i.textDirection==Ze.RTL,a=o,c=!1,h="top",u,f,d=e.left-s.left,m=s.right-e.right,b=n.right-n.left,w=n.bottom-n.top;if(a&&d<Math.min(b,m)?a=!1:!a&&m<Math.min(b,d)&&(a=!0),b<=(a?d:m))u=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 O=s.bottom-e.bottom;O>=w||O>e.top?u=t.bottom-e.top:(h="bottom",u=e.bottom-t.top)}let g=(e.bottom-e.top)/r.offsetHeight,p=(e.right-e.left)/r.offsetWidth;return{style:`${h}: ${u/g}px; max-width: ${f/p}px`,class:"cm-completionInfo-"+(c?o?"left-narrow":"right-narrow":a?"left":"right")}}function RA(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 h=0;h<r.length;){let u=r[h++],f=r[h++];u>c&&o.appendChild(document.createTextNode(a.slice(c,u)));let d=o.appendChild(document.createElement("span"));d.appendChild(document.createTextNode(a.slice(u,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 VA{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=RA(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:h}=e.state.field(t).open;for(let u=c.target,f;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(f=/-(\d+)$/.exec(u.id))&&+f[1]<h.length){this.applyCompletion(e,h[+f[1]]),c.preventDefault();return}}),this.dom.addEventListener("focusout",c=>{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(ot).closeOnBlur&&c.relatedTarget!=e.contentDOM&&e.dispatch({effects:Js.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;if((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)),this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:n}=t.options[t.selected],{info:s}=n;if(!s)return;let r=typeof s=="string"?document.createTextNode(s):s(n);if(!r)return;"then"in r?r.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,n)}).catch(o=>Qt(this.view.state,o,"completion info")):this.addInfoPane(r,n)}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",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");return t&&MA(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.defaultView||window;r={left:0,top:0,right:o.innerWidth,bottom:o.innerHeight}}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"));let r=null;for(let o=n.from;o<n.to;o++){let{completion:a,match:c}=e[o],{section:h}=a;if(h){let d=typeof h=="string"?h:h.name;if(d!=r&&(o>n.from||n.from==0))if(r=d,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let m=s.appendChild(document.createElement("completion-section"));m.textContent=d}}const u=s.appendChild(document.createElement("li"));u.id=t+"-"+o,u.setAttribute("role","option");let f=this.optionClass(a);f&&(u.className=f);for(let d of this.optionContent){let m=d(a,this.view.state,this.view,c);m&&u.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 LA(i,e){return t=>new VA(t,i,e)}function MA(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 kg(i){return(i.boost||0)*100+(i.apply?10:0)+(i.info?5:0)+(i.type?1:0)}function BA(i,e){let t=[],n=null,s=h=>{t.push(h);let{section:u}=h.completion;if(u){n||(n=[]);let f=typeof u=="string"?u:u.name;n.some(d=>d.name==f)||n.push(typeof u=="string"?{name:f}:u)}},r=e.facet(ot);for(let h of i)if(h.hasResult()){let u=h.result.getMatch;if(h.result.filter===!1)for(let f of h.result.options)s(new _g(f,h.source,u?u(f):[],1e9-t.length));else{let f=e.sliceDoc(h.from,h.to),d,m=r.filterStrict?new $A(f):new EA(f);for(let b of h.result.options)if(d=m.match(b.label)){let w=b.displayLabel?u?u(b,d.matched):[]:d.matched;s(new _g(b,h.source,w,d.score+(b.boost||0)))}}}if(n){let h=Object.create(null),u=0,f=(d,m)=>{var b,w;return((b=d.rank)!==null&&b!==void 0?b:1e9)-((w=m.rank)!==null&&w!==void 0?w:1e9)||(d.name<m.name?-1:1)};for(let d of n.sort(f))u-=1e5,h[d.name]=u;for(let d of t){let{section:m}=d.completion;m&&(d.score+=h[typeof m=="string"?m:m.name])}}let o=[],a=null,c=r.compareCompletions;for(let h of t.sort((u,f)=>f.score-u.score||c(u.completion,f.completion))){let u=h.completion;!a||a.label!=u.label||a.detail!=u.detail||a.type!=null&&u.type!=null&&a.type!=u.type||a.apply!=u.apply||a.boost!=u.boost?o.push(h):kg(h.completion)>kg(a)&&(o[o.length-1]=h),a=h.completion}return o}class Kn{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 Kn(this.options,xg(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,s,r,o){if(s&&!o&&e.some(h=>h.isPending))return s.setDisabled();let a=BA(e,t);if(!a.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let c=t.facet(ot).selectOnOpen?0:-1;if(s&&s.selected!=c&&s.selected!=-1){let h=s.options[s.selected].completion;for(let u=0;u<a.length;u++)if(a[u].completion==h){c=u;break}}return new Kn(a,xg(n,c),{pos:e.reduce((h,u)=>u.hasResult()?Math.min(h,u.from):h,1e8),create:FA,above:r.aboveCursor},s?s.timestamp:Date.now(),c,!1)}map(e){return new Kn(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}setDisabled(){return new Kn(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Do{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new Do(IA,"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",yn(t)).map(TA)).map(c=>(this.active.find(u=>u.source==c)||new Xt(c,this.active.some(u=>u.state!=0)?1:0)).update(e,n));r.length==this.active.length&&r.every((c,h)=>c==this.active[h])&&(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))||!DA(r,this.active)||a?o=Kn.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 Xt(c.source,0):c));for(let c of e.effects)c.is(Cg)&&(o=o&&o.setSelected(c.value,this.id));return r==this.active&&o==this.open?this:new Do(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?vA:ZA}}function DA(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 vA={"aria-autocomplete":"list"},ZA={};function xg(i,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":i};return e>-1&&(t["aria-activedescendant"]=i+"-"+e),t}const IA=[];function Sg(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 Xt{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=Sg(e,t),s=this;(n&8||n&16&&this.touches(e))&&(s=new Xt(s.source,0)),n&4&&s.state==0&&(s=new Xt(this.source,1)),s=s.updateFor(e,n);for(let r of e.effects)if(r.is(Bo))s=new Xt(s.source,1,r.value);else if(r.is(Js))s=new Xt(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(yn(e.state))}}class Jn extends Xt{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=yn(e.state);if(a>o||!s||t&2&&(yn(e.startState)==this.from||a<this.limit))return new Xt(this.source,t&4?1:0);let c=e.changes.mapPos(this.limit);return UA(s.validFor,e.state,r,o)?new Jn(this.source,this.explicit,c,s,r,o):s.update&&(s=s.update(s,r,o,new mg(e.state,a,!1)))?new Jn(this.source,this.explicit,c,s,s.from,(n=s.to)!==null&&n!==void 0?n:yn(e.state)):new Xt(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new Jn(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Xt(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function UA(i,e,t,n){if(!i)return!1;let s=e.sliceDoc(t,n);return typeof i=="function"?i(s,t,n,e):bg(i,!0).test(s)}const Lc=we.define({map(i,e){return i.map(t=>t.map(e))}}),Cg=we.define(),$t=rt.define({create(){return Do.start()},update(i,e){return i.update(e)},provide:i=>[ja.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($t).active.find(s=>s.source==e.source);return n instanceof Jn?(typeof t=="string"?i.dispatch(Object.assign(Object.assign({},PA(i.state,t,n.from,n.to)),{annotations:Rc.of(e.completion)})):t(i,e.completion,n.from,n.to),!0):!1}const FA=LA($t,Mc);function vo(i,e="option"){return t=>{let n=t.state.field($t,!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=xp(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:Cg.of(a)}),!0}}const jA=i=>{let e=i.state.field($t,!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])},Ag=i=>i.state.field($t,!1)?(i.dispatch({effects:Bo.of(!0)}),!0):!1,qA=i=>{let e=i.state.field($t,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(i.dispatch({effects:Js.of(null)}),!0)};class XA{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const WA=50,YA=1e3,zA=Ge.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($t).active)e.isPending&&this.startQuery(e)}update(i){let e=i.state.field($t),t=i.state.facet(ot);if(!i.selectionSet&&!i.docChanged&&i.startState.field($t)==e)return;let n=i.transactions.some(r=>{let o=Sg(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>WA&&Date.now()-o.time>YA){for(let a of o.context.abortListeners)try{a()}catch(c){Qt(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(Bo)))&&(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($t);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=yn(e),n=new mg(e,t,i.explicit,this.view),s=new XA(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:Js.of(null)}),Qt(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($t);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=yn(r.updates.length?r.updates[0].startState:this.view.state),c=Math.min(a,r.done.from+(r.active.explicit?0:1)),h=new Jn(r.active.source,r.active.explicit,c,r.done,r.done.from,(i=r.done.to)!==null&&i!==void 0?i:a);for(let u of r.updates)h=h.update(u,t);if(h.hasResult()){e.push(h);continue}}let o=n.active.find(a=>a.source==r.active.source);if(o&&o.isPending)if(r.done==null){let a=new Xt(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($t,!1);if(e&&e.tooltip&&this.view.state.facet(ot).closeOnBlur){let t=e.open&&xp(this.view,e.open.tooltip);(!t||!t.dom.contains(i.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Js.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Bo.of(!1)}),20),this.composing=0}}}),GA=typeof navigator=="object"&&/Win/.test(navigator.platform),HA=ji.highest(se.domEventHandlers({keydown(i,e){let t=e.state.field($t,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||i.key.length>1||i.ctrlKey&&!(GA&&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}})),Qg=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 KA{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 Dc{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 h=o,u=/^\t*/.exec(c)[0].length;for(let f=0;f<u;f++)h+=e.facet(qs);s.push(t+h.length-u),c=h+c.slice(u)}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]||"",h=-1,u=c.replace(/\\[{}]/g,f=>f[1]);for(let f=0;f<t.length;f++)(a!=null?t[f].seq==a:u&&t[f].name==u)&&(h=f);if(h<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:u}),h=f;for(let d of s)d.field>=h&&d.field++}s.push(new KA(h,n.length,r.index,r.index+u.length)),o=o.slice(0,r.index)+c+o.slice(r.index+r[0].length)}o=o.replace(/\\([{}])/g,(a,c,h)=>{for(let u of s)u.line==n.length&&u.from>h&&(u.from--,u.to--);return c}),n.push(o)}return new Dc(n,s)}}let JA=de.widget({widget:new class extends fi{toDOM(){let i=document.createElement("span");return i.className="cm-snippetFieldPosition",i}ignoreEvent(){return!1}}}),eQ=de.mark({class:"cm-snippetField"});class es{constructor(e,t){this.ranges=e,this.active=t,this.deco=de.set(e.map(n=>(n.from==n.to?JA:eQ).range(n.from,n.to)))}map(e){let t=[];for(let n of this.ranges){let s=n.map(e);if(!s)return null;t.push(s)}return new es(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 er=we.define({map(i,e){return i&&i.map(e)}}),tQ=we.define(),tr=rt.define({create(){return null},update(i,e){for(let t of e.effects){if(t.is(er))return t.value;if(t.is(tQ)&&i)return new es(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:de.none)});function vc(i,e){return j.create(i.filter(t=>t.field==e).map(t=>j.range(t.from,t.to)))}function iQ(i){let e=Dc.parse(i);return(t,n,s,r)=>{let{text:o,ranges:a}=e.instantiate(t.state,s),{main:c}=t.state.selection,h={changes:{from:s,to:r==c.from?c.to:r,insert:Ae.of(o)},scrollIntoView:!0,annotations:n?[Rc.of(n),Ke.userEvent.of("input.complete")]:void 0};if(a.length&&(h.selection=vc(a,0)),a.some(u=>u.field>0)){let u=new es(a,0),f=h.effects=[er.of(u)];t.state.field(tr,!1)===void 0&&f.push(we.appendConfig.of([tr,sQ,rQ,Qg]))}t.dispatch(t.state.update(h))}}function Pg(i){return({state:e,dispatch:t})=>{let n=e.field(tr,!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:vc(n.ranges,s),effects:er.of(r?null:new es(n.ranges,s)),scrollIntoView:!0})),!0}}const nQ=[{key:"Tab",run:Pg(1),shift:Pg(-1)},{key:"Escape",run:({state:i,dispatch:e})=>i.field(tr,!1)?(e(i.update({effects:er.of(null)})),!0):!1}],Tg=ce.define({combine(i){return i.length?i[0]:nQ}}),sQ=ji.highest(Vs.compute([Tg],i=>i.facet(Tg)));function Nt(i,e){return Object.assign(Object.assign({},e),{apply:iQ(i)})}const rQ=se.domEventHandlers({mousedown(i,e){let t=e.state.field(tr,!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:vc(t.ranges,s.field),effects:er.of(t.ranges.some(r=>r.field>s.field)?new es(t.ranges,s.field):null),scrollIntoView:!0}),!0)}}),ir={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},wn=we.define({map(i,e){let t=e.mapPos(i,-1,ft.TrackAfter);return t??void 0}}),Zc=new class extends dn{};Zc.startSide=1,Zc.endSide=-1;const Eg=rt.define({create(){return Ee.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(wn)&&(i=i.update({add:[Zc.range(t.value,t.value+1)]}));return i}});function oQ(){return[aQ,Eg]}const Ic="()[]{}<>";function $g(i){for(let e=0;e<Ic.length;e+=2)if(Ic.charCodeAt(e)==i)return Ic.charAt(e+1);return Dl(i<128?i:i+1)}function Ng(i,e){return i.languageDataAt("closeBrackets",e)[0]||ir}const lQ=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),aQ=se.inputHandler.of((i,e,t,n)=>{if((lQ?i.composing:i.compositionStarted)||i.state.readOnly)return!1;let s=i.state.selection.main;if(n.length>2||n.length==2&&ai(Ct(n,0))==1||e!=s.from||t!=s.to)return!1;let r=hQ(i.state,n);return r?(i.dispatch(r),!0):!1}),cQ=[{key:"Backspace",run:({state:i,dispatch:e})=>{if(i.readOnly)return!1;let n=Ng(i,i.selection.main.head).brackets||ir.brackets,s=null,r=i.changeByRange(o=>{if(o.empty){let a=uQ(i.doc,o.head);for(let c of n)if(c==a&&Zo(i.doc,o.head)==$g(Ct(c,0)))return{changes:{from:o.head-c.length,to:o.head+c.length},range:j.cursor(o.head-c.length)}}return{range:s=o}});return s||e(i.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!s}}];function hQ(i,e){let t=Ng(i,i.selection.main.head),n=t.brackets||ir.brackets;for(let s of n){let r=$g(Ct(s,0));if(e==s)return r==s?pQ(i,s,n.indexOf(s+s+s)>-1,t):fQ(i,s,r,t.before||ir.before);if(e==r&&Rg(i,i.selection.main.from))return dQ(i,s,r)}return null}function Rg(i,e){let t=!1;return i.field(Eg).between(0,i.doc.length,n=>{n==e&&(t=!0)}),t}function Zo(i,e){let t=i.sliceString(e,e+2);return t.slice(0,ai(Ct(t,0)))}function uQ(i,e){let t=i.sliceString(e-2,e);return ai(Ct(t,0))==t.length?t:t.slice(1)}function fQ(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:wn.of(o.to+e.length),range:j.range(o.anchor+e.length,o.head+e.length)};let a=Zo(i.doc,o.head);return!a||/\s/.test(a)||n.indexOf(a)>-1?{changes:{insert:e+t,from:o.head},effects:wn.of(o.head+e.length),range:j.cursor(o.head+e.length)}:{range:s=o}});return s?null:i.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function dQ(i,e,t){let n=null,s=i.changeByRange(r=>r.empty&&Zo(i.doc,r.head)==t?{changes:{from:r.head,to:r.head+t.length,insert:t},range:j.cursor(r.head+t.length)}:n={range:r});return n?null:i.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function pQ(i,e,t,n){let s=n.stringPrefixes||ir.stringPrefixes,r=null,o=i.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:wn.of(a.to+e.length),range:j.range(a.anchor+e.length,a.head+e.length)};let c=a.head,h=Zo(i.doc,c),u;if(h==e){if(Vg(i,c))return{changes:{insert:e+e,from:c},effects:wn.of(c+e.length),range:j.cursor(c+e.length)};if(Rg(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:j.cursor(c+d.length)}}}else{if(t&&i.sliceDoc(c-2*e.length,c)==e+e&&(u=Lg(i,c-2*e.length,s))>-1&&Vg(i,u))return{changes:{insert:e+e+e+e,from:c},effects:wn.of(c+e.length),range:j.cursor(c+e.length)};if(i.charCategorizer(c)(h)!=je.Word&&Lg(i,c,s)>-1&&!mQ(i,c,e,s))return{changes:{insert:e+e,from:c},effects:wn.of(c+e.length),range:j.cursor(c+e.length)}}return{range:r=a}});return r?null:i.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Vg(i,e){let t=st(i).resolveInner(e+1);return t.parent&&t.from==e}function mQ(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 u=s.firstChild;for(;u&&u.from==s.from&&u.to-u.from>t.length+c;){if(i.sliceDoc(u.to-t.length,u.to)==t)return!1;u=u.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function Lg(i,e,t){let n=i.charCategorizer(e);if(n(i.sliceDoc(e-1,e))!=je.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))!=je.Word)return r}return-1}function gQ(i={}){return[HA,$t,ot.of(i),zA,OQ,Qg]}const Mg=[{key:"Ctrl-Space",run:Ag},{mac:"Alt-`",run:Ag},{key:"Escape",run:qA},{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:jA}],OQ=ji.highest(Vs.computeN([ot],i=>i.facet(ot).defaultKeymap?[Mg]:[]));class Bg{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class kn{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let s=e,r=n.facet(nr).markerFilter;r&&(s=r(s,n));let o=e.slice().sort((f,d)=>f.from-d.from||f.to-d.to),a=new Qi,c=[],h=0;for(let f=0;;){let d=f==o.length?null:o[f];if(!d&&!c.length)break;let m,b;for(c.length?(m=h,b=c.reduce((g,p)=>Math.min(g,p.to),d&&d.from>m?d.from:1e8)):(m=d.from,b=d.to,c.push(d),f++);f<o.length;){let g=o[f];if(g.from==m&&(g.to>g.from||g.to==m))c.push(g),f++,b=Math.min(g.to,b);else{b=Math.min(g.from,b);break}}let w=TQ(c);if(c.some(g=>g.from==g.to||g.from==g.to-1&&n.doc.lineAt(g.from).to==g.from))a.add(m,m,de.widget({widget:new CQ(w),diagnostics:c.slice()}));else{let g=c.reduce((p,O)=>O.markClass?p+" "+O.markClass:p,"");a.add(m,b,de.mark({class:"cm-lintRange cm-lintRange-"+w+g,diagnostics:c.slice(),inclusiveEnd:c.some(p=>p.to>b)}))}h=b;for(let g=0;g<c.length;g++)c[g].to<=h&&c.splice(g--,1)}let u=a.finish();return new kn(u,t,ts(u))}}function ts(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 Bg(s,r,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(n.diagnostic)<0)return!1;n=new Bg(n.from,r,n.diagnostic)}}),n}function _Q(i,e){let t=e.pos,n=e.end||t,s=i.state.facet(nr).hideOn(i,t,n);if(s!=null)return s;let r=i.startState.doc.lineAt(e.pos);return!!(i.effects.some(o=>o.is(Dg))||i.changes.touchesRange(r.from,Math.max(r.to,n)))}function bQ(i,e){return i.field(Mt,!1)?e:e.concat(we.appendConfig.of(EQ))}const Dg=we.define(),Uc=we.define(),vg=we.define(),Mt=rt.define({create(){return new kn(de.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=ts(t,i.selected.diagnostic,r)||ts(t,null,r)}!t.size&&s&&e.state.facet(nr).autoPanel&&(s=null),i=new kn(t,s,n)}for(let t of e.effects)if(t.is(Dg)){let n=e.state.facet(nr).autoPanel?t.value.length?sr.open:null:i.panel;i=kn.init(t.value,n,e.state)}else t.is(Uc)?i=new kn(i.diagnostics,t.value?sr.open:null,i.selected):t.is(vg)&&(i=new kn(i.diagnostics,i.panel,t.value));return i},provide:i=>[Zs.from(i,e=>e.panel),se.decorations.from(i,e=>e.diagnostics)]}),yQ=de.mark({class:"cm-lintRange cm-lintRange-active"});function wQ(i,e,t){let{diagnostics:n}=i.state.field(Mt),s,r=-1,o=-1;n.between(e-(t<0?1:0),e+(t>0?1:0),(c,h,{spec:u})=>{if(e>=c&&e<=h&&(c==h||(e>c||t>0)&&(e<h||t<0)))return s=u.diagnostics,r=c,o=h,!1});let a=i.state.facet(nr).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:kQ(i,s)}}}:null}function kQ(i,e){return ve("ul",{class:"cm-tooltip-lint"},e.map(t=>Ug(i,t,!1)))}const xQ=i=>{let e=i.state.field(Mt,!1);(!e||!e.panel)&&i.dispatch({effects:bQ(i.state,[Uc.of(!0)])});let t=vs(i,sr.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},Zg=i=>{let e=i.state.field(Mt,!1);return!e||!e.panel?!1:(i.dispatch({effects:Uc.of(!1)}),!0)},SQ=[{key:"Mod-Shift-m",run:xQ,preventDefault:!0},{key:"F8",run:i=>{let e=i.state.field(Mt,!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)}}],nr=ce.define({combine(i){return Object.assign({sources:i.map(e=>e.source).filter(e=>e!=null)},hi(i.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t}))}});function Ig(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 Ug(i,e,t){var n;let s=t?Ig(e.actions):[];return ve("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},ve("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=d=>{if(d.preventDefault(),a)return;a=!0;let m=ts(i.state.field(Mt).diagnostics,e);m&&r.apply(i,m.from,m.to)},{name:h}=r,u=s[o]?h.indexOf(s[o]):-1,f=u<0?h:[h.slice(0,u),ve("u",h.slice(u,u+1)),h.slice(u+1)];return ve("button",{type:"button",class:"cm-diagnosticAction",onclick:c,onmousedown:c,"aria-label":` Action: ${h}${u<0?"":` (access key "${s[o]})"`}.`},f)}),e.source&&ve("div",{class:"cm-diagnosticSource"},e.source))}class CQ extends fi{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return ve("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Fg{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Ug(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class sr{constructor(e){this.view=e,this.items=[];let t=s=>{if(s.keyCode==27)Zg(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=Ig(r.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==s.keyCode){let c=ts(this.view.state.field(Mt).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=ve("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:n}),this.dom=ve("div",{class:"cm-panel-lint"},this.list,ve("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Zg(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Mt).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(Mt),n=0,s=!1,r=null,o=new Set;for(e.between(0,this.view.state.doc.length,(a,c,{spec:h})=>{for(let u of h.diagnostics){if(o.has(u))continue;o.add(u);let f=-1,d;for(let m=n;m<this.items.length;m++)if(this.items[m].diagnostic==u){f=m;break}f<0?(d=new Fg(this.view,u),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 Fg(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 h=c.height/this.list.offsetHeight;a.top<c.top?this.list.scrollTop-=(c.top-a.top)/h:a.bottom>c.bottom&&(this.list.scrollTop+=(a.bottom-c.bottom)/h)}})):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(Mt),n=ts(t.diagnostics,this.items[e].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:vg.of(n)})}static open(e){return new sr(e)}}function AQ(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 Io(i){return AQ(`<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 QQ=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:Io("#d11")},".cm-lintRange-warning":{backgroundImage:Io("orange")},".cm-lintRange-info":{backgroundImage:Io("#999")},".cm-lintRange-hint":{backgroundImage:Io("#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 PQ(i){return i=="error"?4:i=="warning"?3:i=="info"?2:1}function TQ(i){let e="hint",t=1;for(let n of i){let s=PQ(n.severity);s>t&&(t=s,e=n.severity)}return e}const EQ=[Mt,se.decorations.compute([Mt],i=>{let{selected:e,panel:t}=i.field(Mt);return!e||!t||e.from==e.to?de.none:de.set([yQ.range(e.from,e.to)])}),xx(wQ,{hideOn:_Q}),QQ],$Q=(()=>[Vx(),Bx(),Kk(),HS(),CS(),Ik(),Xk(),Se.allowMultipleSelections.of(!0),dS(),lm(TS,{fallback:!0}),LS(),oQ(),gQ(),fx(),mx(),sx(),nA(),Vs.of([...cQ,...HC,...kA,...oC,...wS,...Mg,...SQ])])();/*!
|
|
33
33
|
* VueCodemirror v6.1.1
|
|
34
34
|
* Copyright (c) Surmon. All rights reserved.
|