diff --git a/README.md b/README.md index 2c15ea9..e08a178 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,16 @@ repository does not keep a copy. cannot be updated by a release APK and point to the website instead. - Phones show one pane at a time; tablets and unfolded foldables show the shelf beside the note. Light and dark themes follow the system. +- **Languages**: 简体中文 and English, as on the web (`core/…/Strings.kt`, + one interface, so a string missing from a language does not compile). + The language follows the system (the first supported one in its list, + English otherwise) until one is picked under 语言 · Language (library + menu, libraries list, account sheet); the choice is remembered. Signed in + to a synced library, the account's language (`User.language`) comes first; + choosing there also saves it to the account (`PATCH /me {language}`, kept + as pending and sent later when offline; "follow the system" clears it). + A new account is registered with the language in use (`language` in + `POST /auth/register`). See guide §界面语言 and `LanguageSettings`. ## Layout diff --git a/app/src/main/assets/editor/main.js b/app/src/main/assets/editor/main.js index 005db43..dd5c1e1 100644 --- a/app/src/main/assets/editor/main.js +++ b/app/src/main/assets/editor/main.js @@ -1,9 +1,9 @@ -import{$ as R,A as Xe,B as X,C as ve,D as Ni,E as Fi,F as Hi,G as jr,H as _r,I as Ki,Ia as us,J as Ji,K as es,L as K,M as Te,N as ht,O as le,P as M,Q as Lt,R as Et,S as Wt,T as ts,U as Oe,V as f,W as rs,X as Mt,Y as Yr,Z as ns,_ as De,a as Wi,aa as is,b as Rr,ba as ce,c as W,ca as Cr,d as Ot,da as Ut,e as J,ea as $e,f as qt,fa as ss,g as Z,ga as as,h as Ge,ha as Be,i as ie,ia as os,j as ge,ja as he,k as Mi,ka as Vt,l as Ui,la as ls,m as q,ma as Os,n as Vi,na as cs,o as A,p as Qe,q as ct,r as Gi,s as Ii,t as Di,tc as ps,u as Ie,uc as fs,v as I,w as ee,x as v,y as Bi,ya as hs,z as At}from"./chunks/chunk-GJGDCSZU.js";import{a as Gt}from"./chunks/chunk-TO3N6BD7.js";import"./chunks/chunk-Y6SLVHK3.js";var Ne=class{constructor(e,t,n,i){this.state=e,this.pos=t,this.explicit=n,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=R(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),i=t.text.slice(n-t.from,this.pos-t.from),s=i.search(xs(e,!1));return s<0?null:{from:n+s,to:this.pos,text:i.slice(s)}}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 ds(r){let e=Object.keys(r).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Wl(r){let e=Object.create(null),t=Object.create(null);for(let{label:i}of r){e[i[0]]=!0;for(let s=1;stypeof i=="string"?{label:i}:i),[t,n]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:Wl(e);return i=>{let s=i.matchBefore(n);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:t}:null}}function Ps(r,e){return t=>{for(let n=R(t.state).resolveInner(t.pos,-1);n;n=n.parent){if(r.indexOf(n.name)>-1)return null;if(n.type.isTop)break}return e(t)}}var Dt=class{constructor(e,t,n,i){this.completion=e,this.source=t,this.match=n,this.score=i}};function je(r){return r.selection.main.from}function xs(r,e){var t;let{source:n}=r,i=e&&n[0]!="^",s=n[n.length-1]!="$";return!i&&!s?r:new RegExp(`${i?"^":""}(?:${n})${s?"$":""}`,(t=r.flags)!==null&&t!==void 0?t:r.ignoreCase?"i":"")}var Nr=Ui.define();function Ml(r,e,t,n){let{main:i}=r.selection,s=t-i.from,a=n-i.from;return{...r.changeByRange(o=>{if(o!=i&&t!=n&&r.sliceDoc(o.from+s,o.from+a)!=r.sliceDoc(t,n))return{range:o};let l=r.toText(e);return{changes:{from:o.from+s,to:n==i.from?o.to:o.from+a,insert:l},range:Z.cursor(o.from+s+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}var ms=new WeakMap;function Ul(r){if(!Array.isArray(r))return r;let e=ms.get(r);return e||ms.set(r,e=Br(r)),e}var Bt=q.define(),ut=q.define(),Lr=class{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=48&&w<=57||w>=97&&w<=122?2:w>=65&&w<=90?1:0:(_=Ot(w))!=_.toLowerCase()?1:_!=_.toUpperCase()?2:0;(!Q||G==1&&g||y==0&&G!=0)&&(t[h]==w||n[h]==w&&(p=!0)?a[h++]=Q:a.length&&(b=!1)),y=G,Q+=J(w)}return h==l&&a[0]==0&&b?this.result(-100+(p?-200:0),a,e):u==l&&d==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):o>-1?this.ret(-700-e.length,[o,o+this.pattern.length]):u==l?this.ret(-900-e.length,[d,m]):h==l?this.result(-100+(p?-200:0)+-700+(b?0:-1100),a,e):t.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,t,n){let i=[],s=0;for(let a of t){let o=a+(this.astral?J(W(n,a)):1);s&&i[s-1]==a?i[s-1]=o:(i[s++]=a,i[s++]=o)}return this.ret(e-n.length,i)}},Er=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Vl,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>gs(e(n),t(n)),optionClass:(e,t)=>n=>gs(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function gs(r,e){return r?e?r+" "+e:r:e}function Vl(r,e,t,n,i,s){let a=r.textDirection==Bi.RTL,o=a,l=!1,O="top",c,h,p=e.left-i.left,u=i.right-e.right,d=n.right-n.left,m=n.bottom-n.top;if(o&&p=m||Q>e.top?c=t.bottom-e.top:(O="bottom",c=e.bottom-t.top)}let g=(e.bottom-e.top)/s.offsetHeight,b=(e.right-e.left)/s.offsetWidth;return{style:`${O}: ${c/g}px; max-width: ${h/b}px`,class:"cm-completionInfo-"+(l?a?"left-narrow":"right-narrow":o?"left":"right")}}var Fr=q.define();function Gl(r){let e=r.addToOptions.slice();return r.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(i=>"cm-completionIcon-"+i)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(t,n,i,s){let a=document.createElement("span");a.className="cm-completionLabel";let o=t.displayLabel||t.label,l=0;for(let O=0;Ol&&a.appendChild(document.createTextNode(o.slice(l,c)));let p=a.appendChild(document.createElement("span"));p.appendChild(document.createTextNode(o.slice(c,h))),p.className="cm-completionMatchedText",l=h}return lt.position-n.position).map(t=>t.render)}function zr(r,e,t){if(r<=t)return{from:0,to:r};if(e<0&&(e=0),e<=r>>1){let i=Math.floor(e/t);return{from:i*t,to:(i+1)*t}}let n=Math.ceil((r-e)/t);return{from:r-n*t,to:r-(n-1)*t}}var Wr=class{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:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let i=e.state.field(t),{options:s,selected:a}=i.open,o=e.state.facet(C);this.optionContent=Gl(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=zr(s.length,a,o.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:O}=e.state.field(t).open;for(let c=l.target,h;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(h=/-(\d+)$/.exec(c.id))&&+h[1]this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;c!=null&&(e.dispatch({effects:Fr.of(c)}),l.preventDefault())}}),this.dom.addEventListener("focusout",l=>{let O=e.state.field(this.stateField,!1);O&&O.tooltip&&e.state.facet(C).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:ut.of(null)})}),this.showOptions(s,i.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),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=i){let{options:s,selected:a,disabled:o}=n.open;(!i.open||i.open.options!=s)&&(this.range=zr(s.length,a,e.state.facet(C).maxRenderedOptions),this.showOptions(s,n.id)),this.updateSel(),o!=((t=i.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!o)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of t.split(" "))n&&this.dom.classList.add(n);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected=this.range.to)&&(this.range=zr(t.options.length,t.selected,this.view.state.facet(C).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:i}=t.options[t.selected],{info:s}=i;if(!s)return;let a=typeof s=="string"?document.createTextNode(s):s(i);if(!a)return;"then"in a?a.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,i)}).catch(o=>At(this.view.state,o,"completion info")):(this.addInfoPane(a,i),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:s}=e;n.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)n.nodeName!="LI"||!n.id?i--:i==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby"));return t&&Dl(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(),i=e.getBoundingClientRect(),s=this.space;if(!s){let a=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return i.top>Math.min(s.bottom,t.bottom)-10||i.bottom{a.target==i&&a.preventDefault()});let s=null;for(let a=n.from;an.from||n.from==0))if(s=p,typeof O!="string"&&O.header)i.appendChild(O.header(O));else{let u=i.appendChild(document.createElement("completion-section"));u.textContent=p}}let c=i.appendChild(document.createElement("li"));c.id=t+"-"+a,c.setAttribute("role","option");let h=this.optionClass(o);h&&(c.className=h);for(let p of this.optionContent){let u=p(o,this.view.state,this.view,l);u&&c.appendChild(u)}}return n.from&&i.classList.add("cm-completionListIncompleteTop"),n.tonew Wr(t,r,e)}function Dl(r,e){let t=r.getBoundingClientRect(),n=e.getBoundingClientRect(),i=t.height/r.offsetHeight;n.topt.bottom&&(r.scrollTop+=(n.bottom-t.bottom)/i)}function Qs(r){return(r.boost||0)*100+(r.apply?10:0)+(r.info?5:0)+(r.type?1:0)}function Bl(r,e){let t=[],n=null,i=null,s=c=>{t.push(c);let{section:h}=c.completion;if(h){n||(n=[]);let p=typeof h=="string"?h:h.name;n.some(u=>u.name==p)||n.push(typeof h=="string"?{name:p}:h)}},a=e.facet(C);for(let c of r)if(c.hasResult()){let h=c.result.getMatch;if(c.result.filter===!1)for(let p of c.result.options)s(new Dt(p,c.source,h?h(p):[],1e9-t.length));else{let p=e.sliceDoc(c.from,c.to),u,d=a.filterStrict?new Er(p):new Lr(p);for(let m of c.result.options)if(u=d.match(m.label)){let g=m.displayLabel?h?h(m,u.matched):[]:u.matched,b=u.score+(m.boost||0);if(s(new Dt(m,c.source,g,b)),typeof m.section=="object"&&m.section.rank==="dynamic"){let{name:Q}=m.section;i||(i=Object.create(null)),i[Q]=Math.max(b,i[Q]||-1e9)}}}}if(n){let c=Object.create(null),h=0,p=(u,d)=>(u.rank==="dynamic"&&d.rank==="dynamic"?i[d.name]-i[u.name]:0)||(typeof u.rank=="number"?u.rank:1e9)-(typeof d.rank=="number"?d.rank:1e9)||(u.namep.score-h.score||O(h.completion,p.completion))){let h=c.completion;!l||l.label!=h.label||l.detail!=h.detail||l.type!=null&&h.type!=null&&l.type!=h.type||l.apply!=h.apply||l.boost!=h.boost?o.push(c):Qs(c.completion)>Qs(l)&&(o[o.length-1]=c),l=c.completion}return o}var Mr=class r{constructor(e,t,n,i,s,a){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=i,this.selected=s,this.disabled=a}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new r(this.options,$s(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,i,s,a){if(i&&!a&&e.some(O=>O.isPending))return i.setDisabled();let o=Bl(e,t);if(!o.length)return i&&e.some(O=>O.isPending)?i.setDisabled():null;let l=t.facet(C).selectOnOpen?0:-1;if(i&&i.selected!=l&&i.selected!=-1){let O=i.options[i.selected].completion;for(let c=0;cc.hasResult()?Math.min(O,c.from):O,1e8),create:eO,above:s.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(e){return new r(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new r(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},Ur=class r{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new r(Kl,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,n=t.facet(C),s=(n.override||t.languageDataAt("autocomplete",je(t)).map(Ul)).map(l=>(this.active.find(c=>c.source==l)||new ue(l,this.active.some(c=>c.state!=0)?1:0)).update(e,n));s.length==this.active.length&&s.every((l,O)=>l==this.active[O])&&(s=this.active);let a=this.open,o=e.effects.some(l=>l.is(Hr));a&&e.docChanged&&(a=a.map(e.changes)),e.selection||s.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!Nl(s,this.active)||o?a=Mr.build(s,t,this.id,a,n,o):a&&a.disabled&&!s.some(l=>l.isPending)&&(a=null),!a&&s.every(l=>!l.isPending)&&s.some(l=>l.hasResult())&&(s=s.map(l=>l.hasResult()?new ue(l.source,0):l));for(let l of e.effects)l.is(Fr)&&(a=a&&a.setSelected(l.value,this.id));return s==this.active&&a==this.open?this:new r(s,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Fl:Hl}};function Nl(r,e){if(r==e)return!0;for(let t=0,n=0;;){for(;t-1&&(t["aria-activedescendant"]=r+"-"+e),t}var Kl=[];function ws(r,e){if(r.isUserEvent("input.complete")){let n=r.annotation(Nr);if(n&&e.activateOnCompletion(n))return 12}let t=r.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:r.isUserEvent("delete.backward")?2:r.selection?8:r.docChanged?16:0}var ue=class r{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=ws(e,t),i=this;(n&8||n&16&&this.touches(e))&&(i=new r(i.source,0)),n&4&&i.state==0&&(i=new r(this.source,1)),i=i.updateFor(e,n);for(let s of e.effects)if(s.is(Bt))i=new r(i.source,1,s.value);else if(s.is(ut))i=new r(i.source,0);else if(s.is(Hr))for(let a of s.value)a.source==i.source&&(i=a);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(je(e.state))}},Nt=class r extends ue{constructor(e,t,n,i,s,a){super(e,3,t),this.limit=n,this.result=i,this.from=s,this.to=a}hasResult(){return!0}updateFor(e,t){var n;if(!(t&3))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let s=e.changes.mapPos(this.from),a=e.changes.mapPos(this.to,1),o=je(e.state);if(o>a||!i||t&2&&(je(e.startState)==this.from||ot.map(e))}}),U=ie.define({create(){return Ur.start()},update(r,e){return r.update(e)},provide:r=>[Hi.from(r,e=>e.tooltip),X.contentAttributes.from(r,e=>e.attrs)]});function Kr(r,e){let t=e.completion.apply||e.completion.label,n=r.state.field(U).active.find(i=>i.source==e.source);return n instanceof Nt?(typeof t=="string"?r.dispatch({...Ml(r.state,t,n.from,n.to),annotations:Nr.of(e.completion)}):t(r,e.completion,n.from,n.to),!0):!1}var eO=Il(U,Kr);function It(r,e="option"){return t=>{let n=t.state.field(U,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+i*(r?1:-1):r?0:a-1;return o<0?o=e=="page"?0:a-1:o>=a&&(o=e=="page"?a-1:0),t.dispatch({effects:Fr.of(o)}),!0}}var tO=r=>{let e=r.state.field(U,!1);return r.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampr.state.field(U,!1)?(r.dispatch({effects:Bt.of(!0)}),!0):!1,rO=r=>{let e=r.state.field(U,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(r.dispatch({effects:ut.of(null)}),!0)},Vr=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},nO=50,iO=1e3,sO=Xe.fromClass(class{constructor(r){this.view=r,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of r.state.field(U).active)e.isPending&&this.startQuery(e)}update(r){let e=r.state.field(U),t=r.state.facet(C);if(!r.selectionSet&&!r.docChanged&&r.startState.field(U)==e)return;let n=r.transactions.some(s=>{let a=ws(s,t);return a&8||(s.selection||s.docChanged)&&!(a&3)});for(let s=0;snO&&Date.now()-a.time>iO){for(let o of a.context.abortListeners)try{o()}catch(l){At(this.view.state,l)}a.context.abortListeners=null,this.running.splice(s--,1)}else a.updates.push(...r.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),r.transactions.some(s=>s.effects.some(a=>a.is(Bt)))&&(this.pendingStart=!0);let i=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.isPending&&!this.running.some(a=>a.active.source==s.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let s of r.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:r}=this.view,e=r.field(U);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(C).updateSyncTime))}startQuery(r){let{state:e}=this.view,t=je(e),n=new Ne(e,t,r.explicit,this.view),i=new Vr(r,n);this.running.push(i),Promise.resolve(r.source(n)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:ut.of(null)}),At(this.view.state,s)})}scheduleAccept(){this.running.every(r=>r.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(C).updateSyncTime))}accept(){var r;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(C),n=this.view.state.field(U);for(let i=0;io.source==s.active.source);if(a&&a.isPending)if(s.done==null){let o=new ue(s.active.source,0);for(let l of s.updates)o=o.update(l,t);o.isPending||e.push(o)}else this.startQuery(a)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:Hr.of(e)})}},{eventHandlers:{blur(r){let e=this.view.state.field(U,!1);if(e&&e.tooltip&&this.view.state.facet(C).closeOnBlur){let t=e.open&&jr(this.view,e.open.tooltip);(!t||!t.dom.contains(r.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:ut.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Bt.of(!1)}),20),this.composing=0}}}),aO=typeof navigator=="object"&&/Win/.test(navigator.platform),oO=ge.highest(X.domEventHandlers({keydown(r,e){let t=e.state.field(U,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||!r.key||r.key.length>1||r.ctrlKey&&!(aO&&r.altKey)||r.metaKey)return!1;let n=t.open.options[t.open.selected],i=t.active.find(a=>a.source==n.source),s=n.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(r.key)>-1&&Kr(e,n),!1}})),ys=X.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:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".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:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),Gr=class{constructor(e,t,n,i){this.field=e,this.line=t,this.from=n,this.to=i}},Ir=class r{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(e){let t=e.mapPos(this.from,-1,qt.TrackDel),n=e.mapPos(this.to,1,qt.TrackDel);return t==null||n==null?null:new r(this.field,t,n)}},Dr=class r{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],i=[t],s=e.doc.lineAt(t),a=/^\s*/.exec(s.text)[0];for(let l of this.lines){if(n.length){let O=a,c=/^\t*/.exec(l)[0].length;for(let h=0;hnew Ir(l.field,i[l.line]+l.from,i[l.line]+l.to));return{text:n,ranges:o}}static parse(e){let t=[],n=[],i=[],s;for(let a of e.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(a);){let o=s[1]?+s[1]:null,l=s[2]||s[3]||"",O=-1;o===0&&(o=1e9);let c=l.replace(/\\[{}]/g,h=>h[1]);for(let h=0;h=O&&p.field++}for(let h of i)if(h.line==n.length&&h.from>s.index){let p=s[2]?3+(s[1]||"").length:2;h.from-=p,h.to-=p}i.push(new Gr(O,n.length,s.index,s.index+c.length)),a=a.slice(0,s.index)+l+a.slice(s.index+s[0].length)}a=a.replace(/\\([{}])/g,(o,l,O)=>{for(let c of i)c.line==n.length&&c.from>O&&(c.from--,c.to--);return l}),n.push(a)}return new r(n,i)}},lO=v.widget({widget:new class extends ee{toDOM(){let r=document.createElement("span");return r.className="cm-snippetFieldPosition",r}ignoreEvent(){return!1}}}),OO=v.mark({class:"cm-snippetField"}),Fe=class r{constructor(e,t){this.ranges=e,this.active=t,this.deco=v.set(e.map(n=>(n.from==n.to?lO:OO).range(n.from,n.to)),!0)}map(e){let t=[];for(let n of this.ranges){let i=n.map(e);if(!i)return null;t.push(i)}return new r(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))}},dt=q.define({map(r,e){return r&&r.map(e)}}),cO=q.define(),pt=ie.define({create(){return null},update(r,e){for(let t of e.effects){if(t.is(dt))return t.value;if(t.is(cO)&&r)return new Fe(r.ranges,t.value)}return r&&e.docChanged&&(r=r.map(e.changes)),r&&e.selection&&!r.selectionInsideField(e.selection)&&(r=null),r},provide:r=>X.decorations.from(r,e=>e?e.deco:v.none)});function Jr(r,e){return Z.create(r.filter(t=>t.field==e).map(t=>Z.range(t.from,t.to)))}function hO(r){let e=Dr.parse(r);return(t,n,i,s)=>{let{text:a,ranges:o}=e.instantiate(t.state,i),{main:l}=t.state.selection,O={changes:{from:i,to:s==l.from?l.to:s,insert:Wi.of(a)},scrollIntoView:!0,annotations:n?[Nr.of(n),Vi.userEvent.of("input.complete")]:void 0};if(o.length&&(O.selection=Jr(o,0)),o.some(c=>c.field>0)){let c=new Fe(o,0),h=O.effects=[dt.of(c)];t.state.field(pt,!1)===void 0&&h.push(q.appendConfig.of([pt,mO,gO,ys]))}t.dispatch(t.state.update(O))}}function Zs(r){return({state:e,dispatch:t})=>{let n=e.field(pt,!1);if(!n||r<0&&n.active==0)return!1;let i=n.active+r,s=r>0&&!n.ranges.some(a=>a.field==i+r);return t(e.update({selection:Jr(n.ranges,i),effects:dt.of(s?null:new Fe(n.ranges,i)),scrollIntoView:!0})),!0}}var uO=({state:r,dispatch:e})=>r.field(pt,!1)?(e(r.update({effects:dt.of(null)})),!0):!1,pO=Zs(1),fO=Zs(-1);var dO=[{key:"Tab",run:pO,shift:fO},{key:"Escape",run:uO}],bs=Ge.define({combine(r){return r.length?r[0]:dO}}),mO=ge.highest(ve.compute([bs],r=>r.facet(bs)));function L(r,e){return{...e,apply:hO(r)}}var gO=X.domEventHandlers({mousedown(r,e){let t=e.state.field(pt,!1),n;if(!t||(n=e.posAtCoords({x:r.clientX,y:r.clientY}))==null)return!1;let i=t.ranges.find(s=>s.from<=n&&s.to>=n);return!i||i.field==t.active?!1:(e.dispatch({selection:Jr(t.ranges,i.field),effects:dt.of(t.ranges.some(s=>s.field>i.field)?new Fe(t.ranges,i.field):null),scrollIntoView:!0}),!0)}});var ft={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Re=q.define({map(r,e){let t=e.mapPos(r,-1,qt.TrackAfter);return t??void 0}}),en=new class extends Gi{};en.startSide=1;en.endSide=-1;var Xs=ie.define({create(){return Ii.empty},update(r,e){if(r=r.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);r=r.update({filter:n=>n>=t.from&&n<=t.to})}for(let t of e.effects)t.is(Re)&&(r=r.update({add:[en.range(t.value,t.value+1)]}));return r}});function vs(){return[$O,Xs]}var Ar="()[]{}<>\xAB\xBB\xBB\xAB\uFF3B\uFF3D\uFF5B\uFF5D";function Ts(r){for(let e=0;e{if((QO?r.composing:r.compositionStarted)||r.state.readOnly)return!1;let i=r.state.selection.main;if(n.length>2||n.length==2&&J(W(n,0))==1||e!=i.from||t!=i.to)return!1;let s=SO(r.state,n);return s?(r.dispatch(s),!0):!1}),bO=({state:r,dispatch:e})=>{if(r.readOnly)return!1;let n=Rs(r,r.selection.main.head).brackets||ft.brackets,i=null,s=r.changeByRange(a=>{if(a.empty){let o=kO(r.doc,a.head);for(let l of n)if(l==o&&Ft(r.doc,a.head)==Ts(W(l,0)))return{changes:{from:a.head-l.length,to:a.head+l.length},range:Z.cursor(a.head-l.length)}}return{range:i=a}});return i||e(r.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},js=[{key:"Backspace",run:bO}];function SO(r,e){let t=Rs(r,r.selection.main.head),n=t.brackets||ft.brackets;for(let i of n){let s=Ts(W(i,0));if(e==i)return s==i?wO(r,i,n.indexOf(i+i+i)>-1,t):PO(r,i,s,t.before||ft.before);if(e==s&&_s(r,r.selection.main.from))return xO(r,i,s)}return null}function _s(r,e){let t=!1;return r.field(Xs).between(0,r.doc.length,n=>{n==e&&(t=!0)}),t}function Ft(r,e){let t=r.sliceString(e,e+2);return t.slice(0,J(W(t,0)))}function kO(r,e){let t=r.sliceString(e-2,e);return J(W(t,0))==t.length?t:t.slice(1)}function PO(r,e,t,n){let i=null,s=r.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:t,from:a.to}],effects:Re.of(a.to+e.length),range:Z.range(a.anchor+e.length,a.head+e.length)};let o=Ft(r.doc,a.head);return!o||/\s/.test(o)||n.indexOf(o)>-1?{changes:{insert:e+t,from:a.head},effects:Re.of(a.head+e.length),range:Z.cursor(a.head+e.length)}:{range:i=a}});return i?null:r.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function xO(r,e,t){let n=null,i=r.changeByRange(s=>s.empty&&Ft(r.doc,s.head)==t?{changes:{from:s.head,to:s.head+t.length,insert:t},range:Z.cursor(s.head+t.length)}:n={range:s});return n?null:r.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function wO(r,e,t,n){let i=n.stringPrefixes||ft.stringPrefixes,s=null,a=r.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:e,from:o.to}],effects:Re.of(o.to+e.length),range:Z.range(o.anchor+e.length,o.head+e.length)};let l=o.head,O=Ft(r.doc,l),c;if(O==e){if(Ss(r,l))return{changes:{insert:e+e,from:l},effects:Re.of(l+e.length),range:Z.cursor(l+e.length)};if(_s(r,l)){let p=t&&r.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+p.length,insert:p},range:Z.cursor(l+p.length)}}}else{if(t&&r.sliceDoc(l-2*e.length,l)==e+e&&(c=ks(r,l-2*e.length,i))>-1&&Ss(r,c))return{changes:{insert:e+e+e+e,from:l},effects:Re.of(l+e.length),range:Z.cursor(l+e.length)};if(r.charCategorizer(l)(O)!=A.Word&&ks(r,l,i)>-1&&!yO(r,l,e,i))return{changes:{insert:e+e,from:l},effects:Re.of(l+e.length),range:Z.cursor(l+e.length)}}return{range:s=o}});return s?null:r.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function Ss(r,e){let t=R(r).resolveInner(e+1);return t.parent&&t.from==e}function yO(r,e,t,n){let i=R(r).resolveInner(e,-1),s=n.reduce((a,o)=>Math.max(a,o.length),0);for(let a=0;a<5;a++){let o=r.sliceDoc(i.from,Math.min(i.to,i.from+t.length+s)),l=o.indexOf(t);if(!l||l>-1&&n.indexOf(o.slice(0,l))>-1){let c=i.firstChild;for(;c&&c.from==i.from&&c.to-c.from>t.length+l;){if(r.sliceDoc(c.to-t.length,c.to)==t)return!1;c=c.firstChild}return!0}let O=i.to==e&&i.parent;if(!O)break;i=O}return!1}function ks(r,e,t){let n=r.charCategorizer(e);if(n(r.sliceDoc(e-1,e))!=A.Word)return e;for(let i of t){let s=e-i.length;if(r.sliceDoc(s,e)==i&&n(r.sliceDoc(s-1,s))!=A.Word)return s}return-1}function Ys(r={}){return[oO,U,C.of(r),sO,ZO,ys]}var tn=[{key:"Ctrl-Space",run:qr},{mac:"Alt-`",run:qr},{mac:"Alt-i",run:qr},{key:"Escape",run:rO},{key:"ArrowDown",run:It(!0)},{key:"ArrowUp",run:It(!1)},{key:"PageDown",run:It(!0,"page")},{key:"PageUp",run:It(!1,"page")},{key:"Enter",run:tO}],ZO=ge.highest(ve.computeN([C],r=>r.facet(C).defaultKeymap?[tn]:[]));var Jt=class r{static create(e,t,n,i,s){let a=i+(i<<8)+e+(t<<4)|0;return new r(e,t,n,a,s,[],[])}constructor(e,t,n,i,s,a,o){this.type=e,this.value=t,this.from=n,this.hash=i,this.end=s,this.children=a,this.positions=o,this.blankFirstLine=!1,this.hashProp=[[K.contextHash,i]]}addChild(e,t){e.prop(K.contextHash)!=this.hash&&(e=new M(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(t)}toTree(e,t=this.end){let n=this.children.length-1;return n>=0&&(t=Math.max(t,this.positions[n]+this.children[n].length+this.from)),new M(e.types[this.type],this.children,this.positions,t-this.from).balance({makeTree:(i,s,a)=>new M(Te.none,i,s,a,this.hashProp)})}},$;(function(r){r[r.Document=1]="Document",r[r.CodeBlock=2]="CodeBlock",r[r.FencedCode=3]="FencedCode",r[r.Blockquote=4]="Blockquote",r[r.HorizontalRule=5]="HorizontalRule",r[r.BulletList=6]="BulletList",r[r.OrderedList=7]="OrderedList",r[r.ListItem=8]="ListItem",r[r.ATXHeading1=9]="ATXHeading1",r[r.ATXHeading2=10]="ATXHeading2",r[r.ATXHeading3=11]="ATXHeading3",r[r.ATXHeading4=12]="ATXHeading4",r[r.ATXHeading5=13]="ATXHeading5",r[r.ATXHeading6=14]="ATXHeading6",r[r.SetextHeading1=15]="SetextHeading1",r[r.SetextHeading2=16]="SetextHeading2",r[r.HTMLBlock=17]="HTMLBlock",r[r.LinkReference=18]="LinkReference",r[r.Paragraph=19]="Paragraph",r[r.CommentBlock=20]="CommentBlock",r[r.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",r[r.Escape=22]="Escape",r[r.Entity=23]="Entity",r[r.HardBreak=24]="HardBreak",r[r.Emphasis=25]="Emphasis",r[r.StrongEmphasis=26]="StrongEmphasis",r[r.Link=27]="Link",r[r.Image=28]="Image",r[r.InlineCode=29]="InlineCode",r[r.HTMLTag=30]="HTMLTag",r[r.Comment=31]="Comment",r[r.ProcessingInstruction=32]="ProcessingInstruction",r[r.Autolink=33]="Autolink",r[r.HeaderMark=34]="HeaderMark",r[r.QuoteMark=35]="QuoteMark",r[r.ListMark=36]="ListMark",r[r.LinkMark=37]="LinkMark",r[r.EmphasisMark=38]="EmphasisMark",r[r.CodeMark=39]="CodeMark",r[r.CodeText=40]="CodeText",r[r.CodeInfo=41]="CodeInfo",r[r.LinkTitle=42]="LinkTitle",r[r.LinkLabel=43]="LinkLabel",r[r.URL=44]="URL"})($||($={}));var sn=class{constructor(e,t){this.start=e,this.content=t,this.marks=[],this.parsers=[]}},an=class{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return gt(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,t=0,n=0){for(let i=t;i=e.stack[t.depth+1].value+t.baseIndent)return!0;if(t.indent>=t.baseIndent+4)return!1;let n=(r.type==$.OrderedList?Qn:gn)(t,e,!1);return n>0&&(r.type!=$.BulletList||mn(t,e,!1)<0)&&t.text.charCodeAt(t.pos+n-1)==r.value}var Is={[$.Blockquote](r,e,t){return t.next!=62?!1:(t.markers.push(T($.QuoteMark,e.lineStart+t.pos,e.lineStart+t.pos+1)),t.moveBase(t.pos+(D(t.text.charCodeAt(t.pos+1))?2:1)),r.end=e.lineStart+t.text.length,!0)},[$.ListItem](r,e,t){return(t.next<0?r.blankFirstLine&&r.children.length==1:t.indentt&&D(r.charCodeAt(e-1));)e--;return e}function Ds(r){if(r.next!=96&&r.next!=126)return-1;let e=r.pos+1;for(;e-1&&r.depth==e.stack.length&&e.parser.leafBlockParsers.indexOf(ta.SetextHeading)>-1||n<3?-1:1}function Ns(r,e){for(let t=r.stack.length-1;t>=0;t--)if(r.stack[t].type==e)return!0;return!1}function gn(r,e,t){return(r.next==45||r.next==43||r.next==42)&&(r.pos==r.text.length-1||D(r.text.charCodeAt(r.pos+1)))&&(!t||Ns(e,$.BulletList)||r.skipSpace(r.pos+2)=48&&i<=57;){n++;if(n==r.text.length)return-1;i=r.text.charCodeAt(n)}return n==r.pos||n>r.pos+9||i!=46&&i!=41||nr.pos+1||r.next!=49)?-1:n+1-r.pos}function Fs(r){if(r.next!=35)return-1;let e=r.pos+1;for(;e6?-1:t}function Hs(r){if(r.next!=45&&r.next!=61||r.indent>=r.baseIndent+4)return-1;let e=r.pos+1;for(;e/,Js=/\?>/,ln=[[/^<(?:script|pre|style|textarea)(?:\s|>|$)/i,/<\/(?:script|pre|style|textarea)>/i],[/^\s*)/.exec(n);if(s)return r.append(T($.Comment,t,t+1+s[0].length));let a=/^\?[^]*?\?>/.exec(n);if(a)return r.append(T($.ProcessingInstruction,t,t+1+a[0].length));let o=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/[a-zA-Z][\w-]*\s*>|[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*\/?>)/.exec(n);return o?r.append(T($.HTMLTag,t,t+1+o[0].length)):-1},Emphasis(r,e,t){if(e!=95&&e!=42)return-1;let n=t+1;for(;r.char(n)==e;)n++;let i=r.slice(t-1,t),s=r.slice(n,n+1),a=bt.test(i),o=bt.test(s),l=/\s|^$/.test(i),O=/\s|^$/.test(s),c=!O&&(!o||l||a),h=!l&&(!a||O||o),p=c&&(e==42||!h||a),u=h&&(e==42||!c||o);return r.append(new E(e==95?$n:bn,t,n,(p?1:0)|(u?2:0)))},HardBreak(r,e,t){if(e==92&&r.char(t+1)==10)return r.append(T($.HardBreak,t,t+2));if(e==32){let n=t+1;for(;r.char(n)==32;)n++;if(r.char(n)==10&&n>=t+2)return r.append(T($.HardBreak,t,n+1))}return-1},Link(r,e,t){return e==91?r.append(new E(_e,t,t+1,1)):-1},Image(r,e,t){return e==33&&r.char(t+1)==91?r.append(new E(rr,t,t+2,1)):-1},LinkEnd(r,e,t){if(e!=93)return-1;for(let n=r.parts.length-1;n>=0;n--){let i=r.parts[n];if(i instanceof E&&(i.type==_e||i.type==rr)){if(!i.side||r.skipSpace(i.to)==t&&!/[(\[]/.test(r.slice(t+1,t+2)))return r.parts[n]=null,-1;let s=r.takeContent(n),a=r.parts[n]=TO(r,s,i.type==_e?$.Link:$.Image,i.from,t+1);if(i.type==_e)for(let o=0;oe?T($.URL,e+t,s+t):s==r.length?null:!1}}function sa(r,e,t){let n=r.charCodeAt(e);if(n!=39&&n!=34&&n!=40)return!1;let i=n==40?41:n;for(let s=e+1,a=!1;s=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,t){return this.text.slice(e-this.offset,t-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,t,n,i,s){return this.append(new E(e,t,n,(i?1:0)|(s?2:0)))}get hasOpenLink(){for(let e=this.parts.length-1;e>=0;e--){let t=this.parts[e];if(t instanceof E&&(t.type==_e||t.type==rr))return!0}return!1}addElement(e){return this.append(e)}resolveMarkers(e){for(let n=e;n=e;l--){let m=this.parts[l];if(m instanceof E&&m.side&1&&m.type==i.type&&!(s&&(i.side&1||m.side&2)&&(m.size+i.size)%3==0&&(m.size%3||i.size%3))){o=m;break}}if(!o)continue;let O=i.type.resolve,c=[],h=o.from,p=i.to;if(s){let m=Math.min(2,o.to-o.from,a);h=o.to-m,p=i.from+m,O=m==1?"Emphasis":"StrongEmphasis"}o.type.mark&&c.push(this.elt(o.type.mark,h,o.to));for(let m=l+1;m=0;t--){let n=this.parts[t];if(n instanceof E&&n.type==e&&n.side&1)return t}return null}takeContent(e){let t=this.resolveMarkers(e);return this.parts.length=e,t}getDelimiterAt(e){let t=this.parts[e];return t instanceof E?t:null}skipSpace(e){return gt(this.text,e-this.offset)+this.offset}elt(e,t,n,i){return typeof e=="string"?T(this.parser.getNodeType(e),t,n,i):new tr(e,t)}};Ce.linkStart=_e;Ce.imageStart=rr;Ce.emphasisAsterisk=bn;Ce.emphasisUnderscore=$n;function pn(r,e){if(!e.length)return r;if(!r.length)return e;let t=r.slice(),n=0;for(let i of e){for(;n(e?e-1:0))return!1;if(this.fragmentEnd<0){let s=this.fragment.to;for(;s>0&&this.input.read(s-1,s)!=` -`;)s--;this.fragmentEnd=s?s-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(le.IncludeAnonymous|le.IgnoreMounts),n.firstChild());let i=e+this.fragment.offset;for(;n.to<=i;)if(!n.parent())return!1;for(;;){if(n.from>=i)return this.fragment.from<=t;if(!n.childAfter(i))return!1}}matches(e){let t=this.cursor.tree;for(;t&&t.type.isAnonymous&&t.children[0]instanceof M;)t=t.children[0];return t&&t.prop(K.contextHash)==e}takeNodes(e){let t=this.cursor,n=this.fragment.offset,i=this.fragmentEnd-(this.fragment.openEnd?1:0),s=e.absoluteLineStart,a=s,o=e.block.children.length,l=e.lineStart-e.block.from>>2,O=a,c=o;e:for(;;){if(t.to-n>Math.min(i,e.to)||t.type.isAnonymous&&t.tree&&(t.to-t.from>l||!RO(t.tree))){if(t.type.isAnonymous&&t.firstChild())continue;break}let h=la(t.from-n,e.ranges);if(t.to-n<=e.ranges[e.rangeI].to)e.addNode(t.tree,h);else{let p=new M(e.parser.nodeSet.types[$.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(p,t.tree),e.addNode(p,h)}for((t.type.isAnonymous||t.type.is("Block"))&&(t.type.isAnonymous||oa.indexOf(t.type.id)<0?(a=t.to-n,o=e.block.children.length):(a=O,o=c),O=t.to-n,c=e.block.children.length);;){if(t.nextSibling())continue e;if(!t.parent()||!t.type.isAnonymous)break e}}for(;e.block.children.length>o;)e.block.children.pop(),e.block.positions.pop();return a-s}};function RO(r){for(;r.type.isAnonymous;){let e=r.children[r.children.length-1];if(e instanceof M)r=e;else return!1}return r.type.is("Block")&&oa.indexOf(r.type.id)<0}function la(r,e){let t=r;for(let n=1;nHt[r]),Object.keys(Ht).map(r=>ta[r]),Object.keys(Ht),XO,Is,Object.keys(nn).map(r=>nn[r]),Object.keys(nn),[]);function _O(r,e,t){let n=[];for(let i=r.firstChild,s=e;;i=i.nextSibling){let a=i?i.from:t;if(a>s&&n.push({from:s,to:a}),!i)break;s=i.to}return n}function ca(r){let{codeParser:e,htmlParser:t}=r;return{wrap:Wt((i,s)=>{let a=i.type.id;if(e&&(a==$.CodeBlock||a==$.FencedCode)){let o="";if(a==$.FencedCode){let O=i.node.getChild($.CodeInfo);O&&(o=s.read(O.from,O.to))}let l=e(o);if(l)return{parser:l,overlay:O=>O.type.id==$.CodeText,bracketed:a==$.FencedCode}}else if(t&&(a==$.HTMLBlock||a==$.HTMLTag||a==$.CommentBlock))return{parser:t,overlay:_O(i.node,i.from,i.to)};return null})}}var YO={resolve:"Strikethrough",mark:"StrikethroughMark"},CO={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":f.strikethrough}},{name:"StrikethroughMark",style:f.processingInstruction}],parseInline:[{name:"Strikethrough",parse(r,e,t){if(e!=126||r.char(t+1)!=126||r.char(t+2)==126)return-1;let n=r.slice(t-1,t),i=r.slice(t+2,t+3),s=/\s|^$/.test(n),a=/\s|^$/.test(i),o=bt.test(n),l=bt.test(i);return r.addDelimiter(YO,t,t+2,!a&&(!l||s||o),!s&&(!o||a||l))},after:"Emphasis"}]};function Qt(r,e,t=0,n,i=0){let s=0,a=!0,o=-1,l=-1,O=!1,c=()=>{n.push(r.elt("TableCell",i+o,i+l,r.parser.parseInline(e.slice(o,l),i+o)))};for(let h=t;h-1)&&s++,a=!1,n&&(o>-1&&c(),n.push(r.elt("TableDelimiter",h+i,h+i+1))),o=l=-1):(O||p!=32&&p!=9)&&(o<0&&(o=h),l=h+1),O=!O&&p==92}return o>-1&&(s++,n&&c()),s}function Ls(r,e){for(let t=e;t\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,nr=class{constructor(){this.rows=null}nextLine(e,t,n){if(this.rows==null){this.rows=!1;let i;if((t.next==45||t.next==58||t.next==124)&&ha.test(i=t.text.slice(t.pos))){let s=[];Qt(e,n.content,0,s,n.start)==Qt(e,i,0)&&(this.rows=[e.elt("TableHeader",n.start,n.start+n.content.length,s),e.elt("TableDelimiter",e.lineStart+t.pos,e.lineStart+t.text.length)])}}else if(this.rows){let i=[];Qt(e,t.text,t.pos,i,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+t.pos,e.lineStart+t.text.length,i))}return!1}finish(e,t){return this.rows?(e.addLeafElement(t,e.elt("Table",t.start,t.start+t.content.length,this.rows)),!0):!1}},zO={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":f.heading}},"TableRow",{name:"TableCell",style:f.content},{name:"TableDelimiter",style:f.processingInstruction}],parseBlock:[{name:"Table",leaf(r,e){return Ls(e.content,0)?new nr:null},endLeaf(r,e,t){if(t.parsers.some(i=>i instanceof nr)||!Ls(e.text,e.basePos))return!1;let n=r.peekLine();return ha.test(n)&&Qt(r,e.text,e.basePos)==Qt(r,n,e.basePos)},before:"SetextHeading"}]},dn=class{nextLine(){return!1}finish(e,t){return e.addLeafElement(t,e.elt("Task",t.start,t.start+t.content.length,[e.elt("TaskMarker",t.start,t.start+3),...e.parser.parseInline(t.content.slice(3),t.start+3)])),!0}},qO={defineNodes:[{name:"Task",block:!0,style:f.list},{name:"TaskMarker",style:f.atom}],parseBlock:[{name:"TaskList",leaf(r,e){return/^\[[ xX]\][ \t]/.test(e.content)&&r.parentType().name=="ListItem"?new dn:null},after:"SetextHeading"}]},Es=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,Ws=/[\w-]+(\.[\w-]+)+(:\d+)?(\/[^\s<]*)?/gy,AO=/[\w-]+\.[\w-]+($|[/:])/,Ms=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,Us=/\/[a-zA-Z\d@.]+/gy;function Vs(r,e,t,n){let i=0;for(let s=e;s-1)return-1;let n=e+t[0].length;for(;;){let i=r[n-1],s;if(/[?!.,:*_~]/.test(i)||i==")"&&Vs(r,e,n,")")>Vs(r,e,n,"("))n--;else if(i==";"&&(s=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(r.slice(e,n))))n=e+s.index;else break}return n}function Gs(r,e){Ms.lastIndex=e;let t=Ms.exec(r);if(!t)return-1;let n=t[0][t[0].length-1];return n=="_"||n=="-"?-1:e+t[0].length-(n=="."?1:0)}var EO={parseInline:[{name:"Autolink",parse(r,e,t){let n=t-r.offset;if(n&&/\w/.test(r.text[n-1]))return-1;Es.lastIndex=n;let i=Es.exec(r.text),s=-1;if(!i)return-1;if(i[1]||i[2]){if(s=LO(r.text,n+i[0].length),s>-1&&r.hasOpenLink){let a=/([^\[\]]|\[[^\]]*\])*/.exec(r.text.slice(n,s));s=n+a[0].length}}else i[3]?s=Gs(r.text,n):(s=Gs(r.text,n+i[0].length),s>-1&&i[0]=="xmpp:"&&(Us.lastIndex=s,i=Us.exec(r.text),i&&(s=i.index+i[0].length)));return s<0?-1:(r.addElement(r.elt("URL",t,s+r.offset)),s+r.offset)}}]},ua=[zO,qO,CO,EO];function pa(r,e,t){return(n,i,s)=>{if(i!=r||n.char(s+1)==r)return-1;let a=[n.elt(t,s,s+1)];for(let o=s+1;ot%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let i=e.parser.context;return new r(e,[],t,n,n,0,[],0,i?new ir(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,i=e&65535,{parser:s}=this.p,a=this.reducePos=2e3&&!(!((t=this.p.parser.nodeSet.types[i])===null||t===void 0)&&t.isAnonymous)&&(O==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizel;)this.stack.pop();this.reduceContext(i,O)}storeNode(e,t,n,i=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[a-4]==0&&this.buffer[a-1]>-1){if(t==n)return;if(this.buffer[a-2]>=t){this.buffer[a-2]=n;return}}}if(!s||this.pos==n)this.buffer.push(e,t,n,i);else{let a=this.buffer.length;if(a>0&&(this.buffer[a-4]!=0||this.buffer[a-1]<0)){let o=!1;for(let l=a;l>0&&this.buffer[l-2]>n;l-=4)if(this.buffer[l-1]>=0){o=!0;break}if(o)for(;a>0&&this.buffer[a-2]>n;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,i>4&&(i-=4)}this.buffer[a]=e,this.buffer[a+1]=t,this.buffer[a+2]=n,this.buffer[a+3]=i}}shift(e,t,n,i){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let s=e,{parser:a}=this.p;this.pos=i;let o=a.stateFlag(s,1);!o&&(i>n||t<=a.maxNode)&&(this.reducePos=i),this.pushState(s,o?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=a.maxNode&&this.buffer.push(t,n,i,4)}else this.pos=i,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,i,4)}apply(e,t,n,i){e&65536?this.reduce(e):this.shift(e,t,n,i)}useNode(e,t,n){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let s=this.reducePos=this.pos=n+e.length;this.pushState(t,n),this.buffer.push(i,n,s,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(t&&e.buffer[t-4]==0&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),i=e.bufferBase+t;for(;e&&i==e.bufferBase;)e=e.parent;return new r(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new xn(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if((n&65536)==0)return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let i=[];for(let s=0,a;sl&1&&o==a)||i.push(t[s],a)}t=i}let n=[];for(let i=0;i>19,i=t&65535,s=this.stack.length-n*3;if(s<0||e.getGoto(this.stack[s],i,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;t=a}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(i,s)=>{if(!t.includes(i))return t.push(i),e.allActions(i,a=>{if(!(a&393216))if(a&65536){let o=(a>>19)-s;if(o>1){let l=a&65535,O=this.stack.length-o*3;if(O>=0&&e.getGoto(this.stack[O],l,!1)>=0)return o<<19|65536|l}}else{let o=n(a,s+1);if(o!=null)return o}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t0&&this.emitLookAhead()}},ir=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},xn=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=i}},wn=class r{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new r(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}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]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new r(this.stack,this.pos,this.index)}};function St(r,e=Uint16Array){if(typeof r!="string")return r;let t=null;for(let n=0,i=0;n=92&&a--,a>=34&&a--;let l=a-32;if(l>=46&&(l-=46,o=!0),s+=l,o)break;s*=46}t?t[i++]=s:t=new e(s)}return t}var Ke=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},ga=new Ke,yn=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=ga,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,i=this.rangeIndex,s=this.pos+e;for(;sn.to:s>=n.to;){if(i==this.ranges.length-1)return null;let a=this.ranges[++i];s+=a.from-n.to,n=a}return s}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,i;if(t>=0&&t=this.chunk2Pos&&no.to&&(this.chunk2=this.chunk2.slice(0,o.to-n)),i=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),i}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=ga,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let i of this.ranges){if(i.from>=t)break;i.to>e&&(n+=this.input.read(Math.max(i.from,e),Math.min(i.to,t)))}return n}},Se=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;ka(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};Se.prototype.contextual=Se.prototype.fallback=Se.prototype.extend=!1;var ke=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e=="string"?St(e):e}token(e,t){let n=e.pos,i=0;for(;;){let s=e.next<0,a=e.resolveOffset(1,1);if(ka(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||i++,a==null)break;e.reset(a,e.token)}i&&(e.reset(n,e.token),e.acceptToken(this.elseToken,i))}};ke.prototype.contextual=Se.prototype.fallback=Se.prototype.extend=!1;var z=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function ka(r,e,t,n,i,s){let a=0,o=1<0){let d=r[u];if(l.allows(d)&&(e.token.value==-1||e.token.value==d||MO(d,e.token.value,i,s))){e.acceptToken(d);break}}let c=e.next,h=0,p=r[a+2];if(e.next<0&&p>h&&r[O+p*3-3]==65535){a=r[O+p*3-1];continue e}for(;h>1,d=O+u+(u<<1),m=r[d],g=r[d+1]||65536;if(c=g)h=u+1;else{a=r[d+2],e.advance();continue e}}break}}function Qa(r,e,t){for(let n=e,i;(i=r[n])!=65535;n++)if(i==t)return n-e;return-1}function MO(r,e,t,n){let i=Qa(t,n,e);return i<0||Qa(t,n,r)e)&&!n.type.isError)return t<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(r.length,Math.max(n.from+1,e+25));if(t<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return t<0?0:r.length}}var Zn=class{constructor(e,t){this.fragments=e,this.minRepeat=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.lastRepeat=null,this.lastRepeatPos=-1,this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?$a(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?$a(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=a,null;if(s instanceof M){let o=a>this.lastRepeatPos&&s.type.id>=this.minRepeat;if(a==e||o){let l=a+s.length,O;if(a>=this.safeFrom&&l<=this.safeTo&&(!(O=s.prop(K.lookAhead))||l+O=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+s.length}}},Xn=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new Ke)}getActions(e){let t=0,n=null,{parser:i}=e.p,{tokenizers:s}=i,a=i.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,l=0;for(let O=0;Oh.end+25&&(l=Math.max(h.lookAhead,l)),h.value!=0)){let p=t;if(h.extended>-1&&(t=this.addActions(e,h.extended,h.end,t)),t=this.addActions(e,h.value,h.end,t),!c.extend&&(n=h,t>p))break}}for(;this.actions.length>t;)this.actions.pop();return l&&e.setLookAhead(l),!n&&e.pos==this.stream.end&&(n=new Ke,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Ke,{pos:n,p:i}=e;return t.start=n,t.end=Math.min(n+1,i.stream.end),t.value=n==i.stream.end?i.parser.eofTerm:0,t}updateCachedToken(e,t,n){let i=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(i,e),n),e.value>-1){let{parser:s}=n.p;for(let a=0;a=0&&n.p.parser.dialect.allows(o>>1)){(o&1)==0?e.value=o>>1:e.extended=o>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,t,n,i){for(let s=0;se.bufferLength*4?new Zn(n,e.minRepeatTerm):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],i,s;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;at)n.push(o);else{if(this.advanceStack(o,n,e))continue;{i||(i=[],s=[]),i.push(o);let l=this.tokens.getMainToken(o);s.push(l.value,l.end)}}break}}if(!n.length){let a=i&&UO(i);if(a)return B&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw B&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&i){let a=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,n);if(a)return B&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(n.length>a)for(n.sort((o,l)=>l.score-o.score);n.length>a;)n.pop();n.some(o=>o.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let a=0;a500&&O.buffer.length>500)if((o.score-O.score||o.buffer.length-O.buffer.length)>0)n.splice(l--,1);else{n.splice(a--,1);continue e}}}n.length>12&&(n.sort((a,o)=>o.score-a.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let a=1;a-1&&n.length&&(!s||(n.prop(K.contextHash)||0)==a))return e.useNode(n,o,t),n;if(n.children.length==0||n.positions[0]>0)break;let l=n.children[0];if(l instanceof M&&(!i||l.type.id>=this.parser.minRepeatTerm))n=l;else break}return null}advanceStack(e,t,n){let i=e.pos,{parser:s}=this,a=B?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let O=e.reducePos0)return e.reduce(o),B&&console.log(a+this.stackID(e)+` (via always-reduce ${s.getName(o&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let O=0;Oi?t.push(d):n.push(d)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return ba(e,t),!0}}runRecovery(e,t,n){let i=null,s=!1;for(let a=0;a ":"";if(o.deadEnd&&(s||(s=!0,o.restart(),B&&console.log(c+this.stackID(o)+" (restarted)"),this.advanceFully(o,n))))continue;let h=o.split(),p=c;for(let u=0;u<10&&h.forceReduce()&&(B&&console.log(p+this.stackID(h)+" (via force-reduce)"),!this.advanceFully(h,n));u++)B&&(p=this.stackID(h)+" -> ");for(let u of o.recoverByInsert(l))B&&console.log(c+this.stackID(u)+" (via recover-insert)"),this.advanceFully(u,n);this.stream.end>o.pos?(O==o.pos&&(O++,l=0),o.recoverByDelete(l,O),B&&console.log(c+this.stackID(o)+` (via recover-delete ${this.parser.getName(l)})`),ba(o,n)):(!i||i.scorer,Je=class{constructor(e){this.start=e.start,this.shift=e.shift||kn,this.reduce=e.reduce||kn,this.reuse=e.reuse||kn,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}},Pe=class r extends Et{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let o=0;oe.topRules[o][1]),i=[];for(let o=0;o=0)s(c,l,o[O++]);else{let h=o[O+-c];for(let p=-c;p>0;p--)s(o[O++],l,h);O++}}}this.nodeSet=new ht(t.map((o,l)=>Te.define({name:l>=this.minRepeatTerm?void 0:o,id:l,props:i[l],top:n.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=1024;let a=St(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let o=0;otypeof o=="number"?new Se(a,o):o),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let i=new vn(this,e,t,n);for(let s of this.wrappers)i=s(i,e,t,n);return i}getGoto(e,t,n=!1){let i=this.goto;if(t>=i[0])return-1;for(let s=i[t+1];;){let a=i[s++],o=a&1,l=i[s++];if(o&&n)return l;for(let O=s+(a>>1);s0}validAction(e,t){return!!this.allActions(e,n=>n==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),i=n?t(n):void 0;for(let s=this.stateSlot(e,1);i==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=pe(this.data,s+2);else break;i=t(pe(this.data,s+1))}return i}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=pe(this.data,n+2);else break;if((this.data[n+2]&1)==0){let i=this.data[n+1];t.some((s,a)=>a&1&&s==i)||t.push(this.data[n],i)}}return t}configure(e){let t=Object.assign(Object.create(r.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(n=>{let i=e.tokenizers.find(s=>s.from==n);return i?i.to:n})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,i)=>{let s=e.specializers.find(o=>o.from==n.external);if(!s)return n;let a=Object.assign(Object.assign({},n),{external:s.to});return t.specializers[i]=Sa(a),a})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let s of e.split(" ")){let a=t.indexOf(s);a>=0&&(n[a]=!0)}let i=null;for(let s=0;sn)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scorer.external(t,n)<<1|e}return r.get}var VO=55,GO=1,IO=56,DO=2,BO=57,NO=3,Pa=4,FO=5,Cn=6,Ra=7,ja=8,_a=9,Ya=10,HO=11,KO=12,JO=13,Rn=58,ec=14,tc=15,xa=59,Ca=21,rc=23,za=24,nc=25,_n=27,qa=28,ic=29,sc=32,ac=35,oc=37,lc=38,Oc=0,cc=1,hc={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},uc={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},wa={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function pc(r){return r==45||r==46||r==58||r>=65&&r<=90||r==95||r>=97&&r<=122||r>=161}var ya=null,Za=null,Xa=0;function Yn(r,e){let t=r.pos+e;if(Xa==t&&Za==r)return ya;let n=r.peek(e),i="";for(;pc(n);)i+=String.fromCharCode(n),n=r.peek(++e);return Za=r,Xa=t,ya=i?i.toLowerCase():n==fc||n==dc?void 0:null}var Aa=60,sr=62,zn=47,fc=63,dc=33,mc=45;function va(r,e){this.name=r,this.parent=e}var gc=[Cn,Ya,Ra,ja,_a],Qc=new Je({start:null,shift(r,e,t,n){return gc.indexOf(e)>-1?new va(Yn(n,1)||"",r):r},reduce(r,e){return e==Ca&&r?r.parent:r},reuse(r,e,t,n){let i=e.type.id;return i==Cn||i==oc?new va(Yn(n,1)||"",r):r},strict:!1}),$c=new z((r,e)=>{if(r.next!=Aa){r.next<0&&e.context&&r.acceptToken(Rn);return}r.advance();let t=r.next==zn;t&&r.advance();let n=Yn(r,0);if(n===void 0)return;if(!n)return r.acceptToken(t?tc:ec);let i=e.context?e.context.name:null;if(t){if(n==i)return r.acceptToken(HO);if(i&&uc[i])return r.acceptToken(Rn,-2);if(e.dialectEnabled(Oc))return r.acceptToken(KO);for(let s=e.context;s;s=s.parent)if(s.name==n)return;r.acceptToken(JO)}else{if(n=="script")return r.acceptToken(Ra);if(n=="style")return r.acceptToken(ja);if(n=="textarea")return r.acceptToken(_a);if(hc.hasOwnProperty(n))return r.acceptToken(Ya);i&&wa[i]&&wa[i][n]?r.acceptToken(Rn,-1):r.acceptToken(Cn)}},{contextual:!0}),bc=new z(r=>{for(let e=0,t=0;;t++){if(r.next<0){t&&r.acceptToken(xa);break}if(r.next==mc)e++;else if(r.next==sr&&e>=2){t>=3&&r.acceptToken(xa,-2);break}else e=0;r.advance()}});function Sc(r){for(;r;r=r.parent)if(r.name=="svg"||r.name=="math")return!0;return!1}var kc=new z((r,e)=>{if(r.next==zn&&r.peek(1)==sr){let t=e.dialectEnabled(cc)||Sc(e.context);r.acceptToken(t?FO:Pa,2)}else r.next==sr&&r.acceptToken(Pa,1)});function qn(r,e,t){let n=2+r.length;return new z(i=>{for(let s=0,a=0,o=0;;o++){if(i.next<0){o&&i.acceptToken(e);break}if(s==0&&i.next==Aa||s==1&&i.next==zn||s>=2&&sa?i.acceptToken(e,-a):i.acceptToken(t,-(a-2));break}else if((i.next==10||i.next==13)&&o){i.acceptToken(e,1);break}else s=a=0;i.advance()}})}var Pc=qn("script",VO,GO),xc=qn("style",IO,DO),wc=qn("textarea",BO,NO),yc=Oe({"Text RawText IncompleteTag IncompleteCloseTag":f.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":f.angleBracket,TagName:f.tagName,"MismatchedCloseTag/TagName":[f.tagName,f.invalid],AttributeName:f.attributeName,"AttributeValue UnquotedAttributeValue":f.attributeValue,Is:f.definitionOperator,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26A0 StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:68,context:Qc,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,22,31,34,37,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,30,33,36,38,"OpenTag"],["group",-10,14,15,18,19,20,21,40,41,42,43,"Entity",17,"Entity TextContent",-3,29,32,35,"TextContent Entity"],["isolate",-11,22,30,31,33,34,36,37,38,39,42,43,"ltr",-3,27,28,40,""]],propSources:[yc],skippedNodes:[0],repeatNodeCount:9,tokenData:"!]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zblWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOb!R!R7tP;=`<%l7S!Z8OYlWb!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{iiSlWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?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`!dpyPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!{let O=o.type.id;if(O==ic)return jn(o,l,t);if(O==sc)return jn(o,l,n);if(O==ac)return jn(o,l,i);if(O==Ca&&s.length){let c=o.node,h=c.firstChild,p=h&&Ta(h,l),u;if(p){for(let d of s)if(d.tag==p&&(!d.attrs||d.attrs(u||(u=Ea(h,l))))){let m=c.lastChild,g=m.type.id==lc?m.from:c.to;if(g>h.to)return{parser:d.parser,overlay:[{from:h.to,to:g}]}}}}if(a&&O==za){let c=o.node,h;if(h=c.firstChild){let p=a[l.read(h.from,h.to)];if(p)for(let u of p){if(u.tagName&&u.tagName!=Ta(c.parent,l))continue;let d=c.lastChild;if(d.type.id==_n){let m=d.from+1,g=d.lastChild,b=d.to-(g&&g.isError?0:1);if(b>m)return{parser:u.parser,overlay:[{from:m,to:b}],bracketed:!0}}else if(d.type.id==qa)return{parser:u.parser,overlay:[{from:d.from,to:d.to}]}}}}return null})}var Zc=148,Wa=1,Xc=149,vc=150,Va=2,Tc=151,Rc=3,jc=4,_c=152,Ga=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],Yc=58,Cc=40,Ia=95,zc=91,ar=45,qc=46,Ac=35,Lc=37,Ec=38,Wc=92,Mc=10,Uc=42;function kt(r){return r>=65&&r<=90||r>=97&&r<=122||r>=161}function Ln(r){return r>=48&&r<=57}function Ma(r){return Ln(r)||r>=97&&r<=102||r>=65&&r<=70}var Da=(r,e,t)=>(n,i)=>{for(let s=!1,a=0,o=0;;o++){let{next:l}=n;if(kt(l)||l==ar||l==Ia||s&&Ln(l))!s&&(l!=ar||o>0)&&(s=!0),a===o&&l==ar&&a++,n.advance();else if(l==Wc&&n.peek(1)!=Mc){if(n.advance(),Ma(n.next)){do n.advance();while(Ma(n.next));n.next==32&&n.advance()}else n.next>-1&&n.advance();s=!0}else{s&&n.acceptToken(a>=2&&i.canShift(Va)?e:l==Cc?t:r);break}}},Vc=new z(Da(Xc,Va,vc),{contextual:!0}),Gc=new z(Da(Tc,Rc,jc),{contextual:!0}),Ic=new z(r=>{if(Ga.includes(r.peek(-1))){let{next:e}=r;(kt(e)||e==Ia||e==Ac||e==qc||e==Uc||e==zc||e==Yc&&kt(r.peek(1))||e==ar||e==Ec)&&r.acceptToken(Zc)}}),Dc=new z(r=>{if(!Ga.includes(r.peek(-1))){let{next:e}=r;if(e==Lc&&(r.advance(),r.acceptToken(Wa)),kt(e)){do r.advance();while(kt(r.next)||Ln(r.next));r.acceptToken(Wa)}}});function Ua(r){let e=r.length;return(e==4||e==5||e==7||e==9)&&/^#[a-f\d]+$/i.test(r)?_c:-1}var Bc=Oe({"AtKeyword import charset namespace keyframes media supports font-feature-values":f.definitionKeyword,"from to selector scope MatchFlag":f.keyword,NamespaceName:f.namespace,KeyframeName:f.labelName,KeyframeRangeName:f.operatorKeyword,TagName:f.tagName,ClassName:f.className,PseudoClassName:f.constant(f.className),IdName:f.labelName,"FeatureName PropertyName":f.propertyName,AttributeName:f.attributeName,NumberLiteral:f.number,KeywordQuery:f.keyword,UnaryQueryOp:f.operatorKeyword,"CallTag ValueName FontName":f.atom,VariableName:f.variableName,Callee:f.operatorKeyword,Unit:f.unit,"UniversalSelector NestingSelector":f.definitionOperator,"MatchOp CompareOp":f.compareOperator,"ChildOp SiblingOp, LogicOp":f.logicOperator,BinOp:f.arithmeticOperator,Important:f.modifier,Comment:f.blockComment,ColorLiteral:f.color,"ParenthesizedContent StringLiteral":f.string,":":f.punctuation,PseudoOp:f.derefOperator,"; , |":f.separator,"( )":f.paren,"[ ]":f.squareBracket,"{ }":f.brace}),Nc={__proto__:null,lang:44,"nth-child":44,"nth-last-child":44,"nth-of-type":44,"nth-last-of-type":44,dir:44,"host-context":44,if:88,url:158,"url-prefix":158,domain:158,regexp:158},Fc={__proto__:null,or:102,and:102,not:112,only:112,layer:212},Hc={__proto__:null,selector:118,style:124,layer:208},Kc={__proto__:null,"@import":204,"@media":216,"@charset":220,"@namespace":224,"@keyframes":230,"@supports":242,"@scope":246,"@font-feature-values":252},Jc={__proto__:null,to:249},Ba=Pe.deserialize({version:14,states:"MrQYQdOOO$TQdOOP$[O`OOO%XQaO'#CfOOQP'#Ce'#CeO%`QdO'#CgO%eQ`O'#CgO%jQaO'#FrO&eQdO'#CkO'XQaO'#CcO'cQdO'#CnOOQP'#ES'#ESOOQP'#ER'#ERO'nQdO'#ETO'yQdO'#E[O'yQdO'#E_OOQP'#Fr'#FrO)`QhO'#FQOOQS'#Fq'#FqOOQS'#FT'#FTQYQdOOO)gQdO'#EeO*vQhO'#EkO)gQdO'#EmO*}QdO'#EoO+YQdO'#ErO*[QhO'#ExO+bQdO'#EzO+mQdO'#E}O+rQaO'#CfO+yQ`O'#EbO,OQ`O'#GPO,ZQdO'#GPQOQ`OOP,eO&jO'#CaPOOO)CAa)CAaOOQP'#Ci'#CiOOQP,59R,59RO%`QdO,59ROOQP'#Cm'#CmOOQP,59V,59VO&eQdO,59VO,pQdO,59YOOQP,5:m,5:mO'nQdO,5:oO'yQdO,5:vO'yQdO,5:xO'yQdO,5:yO'yQdO'#F[O,{Q`O,58}O-TQdO'#EaOOQS,58},58}OOQP'#Cq'#CqOOQO'#EP'#EPOOQP,59Y,59YO-[Q`O,59YO-aQ`O,59YO-fQpO'#EUO-qQdO'#EVO-vQ`O'#EVO-{QpO,5:oO.iQaO,5:vO/PQaO,5:yOOQW'#D]'#D]O0OQhO'#DgO0cQhO,5;lO*[QhO'#DeO0pQ`O'#DnO0uQhO'#D{OOQW'#Fx'#FxOOQS,5;l,5;lO0zQ`O'#DhO1PQ`O'#DkOOQS-E9R-E9ROOQ['#Cv'#CvO1UQdO'#CwO1iQdO'#C|O1|QdO'#DPOOQ['#DQ'#DQO2aQ!pO'#DRO4jQ!jO,5;POOQO'#DW'#DWO-aQ`O'#DVO4zQ!nO'#FuO6}Q`O'#DXO7SQ`O'#D|OOQ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y%jz#a%j#a#bCY#b;'S%j;'S;=`%{<%lO%jbC_U!r`Oy%jz#d%j#d#eCq#e;'S%j;'S;=`%{<%lO%jbCvU!r`Oy%jz#c%j#c#dDY#d;'S%j;'S;=`%{<%lO%jbD_U!r`Oy%jz#f%j#f#gDq#g;'S%j;'S;=`%{<%lO%jbDvU!r`Oy%jz#h%j#h#iEY#i;'S%j;'S;=`%{<%lO%jbE_U!r`Oy%jz#T%j#T#UEq#U;'S%j;'S;=`%{<%lO%jbEvU!r`Oy%jz#b%j#b#cFY#c;'S%j;'S;=`%{<%lO%jbF_U!r`Oy%jz#h%j#h#iFq#i;'S%j;'S;=`%{<%lO%jbFxS$tQ!r`Oy%jz;'S%j;'S;=`%{<%lO%jjGZSrYOy%jz;'S%j;'S;=`%{<%lO%jfGlU$gUOy%jz!_%j!_!`0^!`;'S%j;'S;=`%{<%lO%jjHTSqYOy%jz;'S%j;'S;=`%{<%lO%jfHfU#SQOy%jz!_%j!_!`0^!`;'S%j;'S;=`%{<%lO%j`H{P;=`<%l%Z",tokenizers:[Ic,Dc,Vc,Gc,1,2,3,4,new ke("m~RRYZ[z{a~~g~aO$c~~dP!P!Qg~lO$d~~",28,156)],topRules:{StyleSheet:[0,6],Styles:[1,129]},dynamicPrecedences:{97:1},specialized:[{term:172,get:(r,e)=>Ua(r)<<1,external:Ua},{term:150,get:r=>Nc[r]||-1},{term:151,get:r=>Fc[r]||-1},{term:4,get:r=>Hc[r]||-1},{term:28,get:r=>Kc[r]||-1},{term:149,get:r=>Jc[r]||-1}],tokenPrec:2433});var En=null;function Wn(){if(!En&&typeof document=="object"&&document.body){let{style:r}=document.body,e=[],t=new Set;for(let n in r)n!="cssText"&&n!="cssFloat"&&typeof r[n]=="string"&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,i=>"-"+i.toLowerCase())),t.has(n)||(e.push(n),t.add(n)));En=e.sort().map(n=>({type:"property",label:n,apply:n+": "}))}return En||[]}var Na=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(r=>({type:"class",label:r})),Fa=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(r=>({type:"keyword",label:r})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(r=>({type:"constant",label:r}))),eh=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(r=>({type:"type",label:r})),th=["@charset","@color-profile","@container","@counter-style","@font-face","@font-feature-values","@font-palette-values","@import","@keyframes","@layer","@media","@namespace","@page","@position-try","@property","@scope","@starting-style","@supports","@view-transition"].map(r=>({type:"keyword",label:r})),fe=/^(\w[\w-]*|-\w[\w-]*|)$/,rh=/^-(-[\w-]*)?$/;function nh(r,e){var t;if((r.name=="("||r.type.isError)&&(r=r.parent||r),r.name!="ArgList")return!1;let n=(t=r.parent)===null||t===void 0?void 0:t.firstChild;return n?.name!="Callee"?!1:e.sliceString(n.from,n.to)=="var"}var Ha=new Lt,ih=["Declaration"];function sh(r){for(let e=r;;){if(e.type.isTop)return e;if(!(e=e.parent))return r}}function Ka(r,e,t){if(e.to-e.from>4096){let n=Ha.get(e);if(n)return n;let i=[],s=new Set,a=e.cursor(le.IncludeAnonymous);if(a.firstChild())do for(let o of Ka(r,a.node,t))s.has(o.label)||(s.add(o.label),i.push(o));while(a.nextSibling());return Ha.set(e,i),i}else{let n=[],i=new Set;return e.cursor().iterate(s=>{var a;if(t(s)&&s.matchContext(ih)&&((a=s.node.nextSibling)===null||a===void 0?void 0:a.name)==":"){let o=r.sliceString(s.from,s.to);i.has(o)||(i.add(o),n.push({label:o,type:"variable"}))}}),n}}var ah=r=>e=>{let{state:t,pos:n}=e,i=R(t).resolveInner(n,-1),s=i.type.isError&&i.from==i.to-1&&t.doc.sliceString(i.from,i.to)=="-";if(i.name=="PropertyName"||(s||i.name=="TagName")&&/^(Block|Styles)$/.test(i.resolve(i.to).name))return{from:i.from,options:Wn(),validFor:fe};if(i.name=="ValueName")return{from:i.from,options:Fa,validFor:fe};if(i.name=="PseudoClassName")return{from:i.from,options:Na,validFor:fe};if(r(i)||(e.explicit||s)&&nh(i,t.doc))return{from:r(i)||s?i.from:n,options:Ka(t.doc,sh(i),r),validFor:rh};if(i.name=="TagName"){for(let{parent:l}=i;l;l=l.parent)if(l.name=="Block")return{from:i.from,options:Wn(),validFor:fe};return{from:i.from,options:eh,validFor:fe}}if(i.name=="AtKeyword")return{from:i.from,options:th,validFor:fe};if(!e.explicit)return null;let a=i.resolve(n),o=a.childBefore(n);return o&&o.name==":"&&a.name=="PseudoClassSelector"?{from:n,options:Na,validFor:fe}:o&&o.name==":"&&a.name=="Declaration"||a.name=="ArgList"?{from:n,options:Fa,validFor:fe}:a.name=="Block"||a.name=="Styles"?{from:n,options:Wn(),validFor:fe}:null},oh=ah(r=>r.name=="VariableName"),Pt=De.define({name:"css",parser:Ba.configure({props:[$e.add({Declaration:Be()}),he.add({"Block KeyframeList":Vt})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Ja(){return new ce(Pt,Pt.data.of({autocomplete:oh}))}var lh=317,Oh=318,eo=1,ch=2,hh=3,uh=4,ph=319,fh=321,dh=322,mh=5,gh=6,Qh=0,Un=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],to=125,$h=59,Vn=47,bh=42,Sh=43,kh=45,Ph=60,xh=44,wh=63,yh=46,Zh=91,Xh=new Je({start:!1,shift(r,e){return e==mh||e==gh||e==fh?r:e==dh},strict:!1}),vh=new z((r,e)=>{let{next:t}=r;(t==to||t==-1||e.context)&&r.acceptToken(ph)},{contextual:!0,fallback:!0}),Th=new z((r,e)=>{let{next:t}=r,n;Un.indexOf(t)>-1||t==Vn&&((n=r.peek(1))==Vn||n==bh)||t!=to&&t!=$h&&t!=-1&&!e.context&&r.acceptToken(lh)},{contextual:!0}),Rh=new z((r,e)=>{r.next==Zh&&!e.context&&r.acceptToken(Oh)},{contextual:!0}),jh=new z((r,e)=>{let{next:t}=r;if(t==Sh||t==kh){if(r.advance(),t==r.next){r.advance();let n=!e.context&&e.canShift(eo);r.acceptToken(n?eo:ch)}}else t==wh&&r.peek(1)==yh&&(r.advance(),r.advance(),(r.next<48||r.next>57)&&r.acceptToken(hh))},{contextual:!0});function Mn(r,e){return r>=65&&r<=90||r>=97&&r<=122||r==95||r>=192||!e&&r>=48&&r<=57}var _h=new z((r,e)=>{if(r.next!=Ph||!e.dialectEnabled(Qh)||(r.advance(),r.next==Vn))return;let t=0;for(;Un.indexOf(r.next)>-1;)r.advance(),t++;if(Mn(r.next,!0)){for(r.advance(),t++;Mn(r.next,!1);)r.advance(),t++;for(;Un.indexOf(r.next)>-1;)r.advance(),t++;if(r.next==xh)return;for(let n=0;;n++){if(n==7){if(!Mn(r.next,!0))return;break}if(r.next!="extends".charCodeAt(n))break;r.advance(),t++}}r.acceptToken(uh,-t)}),Yh=Oe({"get set async static":f.modifier,"for while do if else switch try catch finally return throw break continue default case defer":f.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":f.operatorKeyword,"let var const using function class extends":f.definitionKeyword,"import export from":f.moduleKeyword,"with debugger new":f.keyword,TemplateString:f.special(f.string),super:f.atom,BooleanLiteral:f.bool,this:f.self,null:f.null,Star:f.modifier,VariableName:f.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":f.function(f.variableName),VariableDefinition:f.definition(f.variableName),Label:f.labelName,PropertyName:f.propertyName,PrivatePropertyName:f.special(f.propertyName),"CallExpression/MemberExpression/PropertyName":f.function(f.propertyName),"FunctionDeclaration/VariableDefinition":f.function(f.definition(f.variableName)),"ClassDeclaration/VariableDefinition":f.definition(f.className),"NewExpression/VariableName":f.className,PropertyDefinition:f.definition(f.propertyName),PrivatePropertyDefinition:f.definition(f.special(f.propertyName)),UpdateOp:f.updateOperator,"LineComment Hashbang":f.lineComment,BlockComment:f.blockComment,Number:f.number,String:f.string,Escape:f.escape,ArithOp:f.arithmeticOperator,LogicOp:f.logicOperator,BitOp:f.bitwiseOperator,CompareOp:f.compareOperator,RegExp:f.regexp,Equals:f.definitionOperator,Arrow:f.function(f.punctuation),": Spread":f.punctuation,"( )":f.paren,"[ ]":f.squareBracket,"{ }":f.brace,"InterpolationStart InterpolationEnd":f.special(f.brace),".":f.derefOperator,", ;":f.separator,"@":f.meta,TypeName:f.typeName,TypeDefinition:f.definition(f.typeName),"type enum interface implements namespace module declare":f.definitionKeyword,"abstract global Privacy readonly override":f.modifier,"is keyof unique infer asserts":f.operatorKeyword,JSXAttributeValue:f.attributeValue,JSXText:f.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":f.angleBracket,"JSXIdentifier JSXNameSpacedName":f.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":f.attributeName,"JSXBuiltin/JSXIdentifier":f.standard(f.tagName)}),Ch={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:237,private:237,protected:237,readonly:239,instanceof:258,satisfies:261,import:294,keyof:351,unique:355,infer:361,asserts:397,is:399,abstract:419,implements:421,type:423,let:426,var:428,using:431,interface:437,enum:441,namespace:447,module:449,declare:453,global:457,defer:473,for:478,of:487,while:490,with:494,do:498,if:502,else:504,switch:508,case:514,try:520,catch:524,finally:528,return:532,throw:536,break:540,continue:544,debugger:548},zh={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:403},qh={__proto__:null,"<":193},ro=Pe.deserialize({version:14,states:"$GSQ%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Im'#ImO1XQ`O'#GtO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JsO6[Q!0Mx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x1lS8l5x:^R:^8mQ,^&_R1o,^Q5}1qR8o5}Q1},hS6_1}8|R8|6aQ1W+tW5j1W5l8c:XQ5l1ZQ8c5kR:X8dQ+y&QR1^+yQ2a,zR6o2aYrOXst#dQ&v!ZQ+c%mQ,t&rQ,v&tQ,w&uQ,y&wQ2[,uS2_,z2aR6n2^Q%opQ&z!_Q&}!aQ'P!bQ'R!cQ'r!uQ+b%lQ+n%zQ,S&XQ,j&mQ-R&|W-r'l't'u'xQ-y'pQ0Z*oQ1R+oQ1e,RS2Q,k,nQ2i-QQ2j-TQ2k-UQ3P-qW3R-t-u-x-zQ5c1SQ5o1aQ5s1gQ6X1wQ6c2SQ6m2]U6|3Q3T3WQ7P3UQ8_5dQ8g5qQ8i5tQ8n5|Q8w6YQ8}6bS9^6}7RQ9`7QQ:Y8eQ:d8xQ:i9OQ:p9_Q;W:ZQ;_:eQ;c:qQ;n;XR;q;`Q%zyQ'e!iQ'p!uU+o%{%|%}Q-X'VU-m'f'g'hS-q'l'vQ0S*kS1S+p+qQ2p-ZS2}-n-oQ3U-vS4r0T0WQ5d1TQ6x2wQ6{3OQ7Q3VU7}4t4u4xQ9|8PR;Q9}S$wi>QR*|%VU%Ui%V>QR0h*zQ$viS(v#v+kS)d$b$cQ)f$dQ*]$xS*f${*ZQ*u%OQ*v%QQ+R%^Q+S%_Q+W%cQ.nQQ>O>YQ>P>ZQ>[>^R>]>_Q+P%]Q.pTR#[WR'Z!el!tQ!r!v!y!z'a'm'n'o-g-w1q5}6PS'V!e-^U*k$|*[*pS-Z'W'`S0W*l*rQ0`*sQ2w-eQ4x0^R4}0aR(|#xQ!fQT-f'a-g]!qQ!r'a-g1q5}Q#p]R'j < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty VariableDefinition Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:381,context:Xh,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,208,212,216,217,219,222,225,235,238,244,246,248,250,253,259,265,267,269,271,273,275,276,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,121,122,137,140,142,143,144,145,146,148,149,168,170,172,"Expression",-23,31,33,37,41,43,45,174,176,178,179,181,182,183,185,186,187,189,190,191,202,204,206,207,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",161,"JSXStartCloseTag"],["closedBy",-2,24,169,">",40,"InterpolationEnd",50,"]",61,"}",74,")",166,"JSXEndTag"]],propSources:[Yh],skippedNodes:[0,5,6,279],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$x#r#s$@U#s$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$I|Er$I|$I}$Dk$I}$JO$Dk$JO$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr(n%d_$j&j(Xp([!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$j&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`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:15205});var ao=[L("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),L("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),L("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),L("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),L("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),L(`try { +import{$ as R,A as ve,B as X,C as Te,D as Ji,E as Yr,F as es,G as zr,H as qr,I as ts,Ia as ds,J as rs,K as ns,L as K,M as Re,N as pt,O as le,P as M,Q as Wt,R as Mt,S as Ut,T as is,U as Oe,V as f,W as ss,X as Vt,Y as Ar,Z as as,_ as Ne,a as Ii,aa as os,b as _r,ba as ce,c as W,ca as Lr,d as ht,da as Gt,e as J,ea as $e,f as Lt,fa as ls,g as Z,ga as Os,h as De,ha as Fe,i as ie,ia as cs,j as ge,ja as he,k as Cr,ka as It,l as Di,la as hs,m as q,ma as us,n as Bi,na as ps,o as A,p as Qe,q as ut,r as Ni,s as Fi,t as Hi,tc as ms,u as Be,uc as gs,v as I,w as ee,x as v,y as Ki,ya as fs,z as Et}from"./chunks/chunk-GJGDCSZU.js";import{a as Dt}from"./chunks/chunk-TO3N6BD7.js";import"./chunks/chunk-Y6SLVHK3.js";var He=class{constructor(e,r,n,i){this.state=e,this.pos=r,this.explicit=n,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let r=R(this.state).resolveInner(this.pos,-1);for(;r&&e.indexOf(r.name)<0;)r=r.parent;return r?{from:r.from,to:this.pos,text:this.state.sliceDoc(r.from,this.pos),type:r.type}:null}matchBefore(e){let r=this.state.doc.lineAt(this.pos),n=Math.max(r.from,this.pos-250),i=r.text.slice(n-r.from,this.pos-r.from),s=i.search(Zs(e,!1));return s<0?null:{from:n+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,r,n){e=="abort"&&this.abortListeners&&(this.abortListeners.push(r),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function Qs(t){let e=Object.keys(t).join(""),r=/\w/.test(e);return r&&(e=e.replace(/\w/g,"")),`[${r?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Gl(t){let e=Object.create(null),r=Object.create(null);for(let{label:i}of t){e[i[0]]=!0;for(let s=1;stypeof i=="string"?{label:i}:i),[r,n]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:Gl(e);return i=>{let s=i.matchBefore(n);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:r}:null}}function ys(t,e){return r=>{for(let n=R(r.state).resolveInner(r.pos,-1);n;n=n.parent){if(t.indexOf(n.name)>-1)return null;if(n.type.isTop)break}return e(r)}}var Nt=class{constructor(e,r,n,i){this.completion=e,this.source=r,this.match=n,this.score=i}};function _e(t){return t.selection.main.from}function Zs(t,e){var r;let{source:n}=t,i=e&&n[0]!="^",s=n[n.length-1]!="$";return!i&&!s?t:new RegExp(`${i?"^":""}(?:${n})${s?"$":""}`,(r=t.flags)!==null&&r!==void 0?r:t.ignoreCase?"i":"")}var Jr=Di.define();function Il(t,e,r,n){let{main:i}=t.selection,s=r-i.from,a=n-i.from;return{...t.changeByRange(o=>{if(o!=i&&r!=n&&t.sliceDoc(o.from+s,o.from+a)!=t.sliceDoc(r,n))return{range:o};let l=t.toText(e);return{changes:{from:o.from+s,to:n==i.from?o.to:o.from+a,insert:l},range:Z.cursor(o.from+s+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}var $s=new WeakMap;function Dl(t){if(!Array.isArray(t))return t;let e=$s.get(t);return e||$s.set(t,e=Kr(t)),e}var Ft=q.define(),ft=q.define(),Ur=class{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let r=0;r=48&&w<=57||w>=97&&w<=122?2:w>=65&&w<=90?1:0:(_=ht(w))!=_.toLowerCase()?1:_!=_.toUpperCase()?2:0;(!Q||G==1&&g||y==0&&G!=0)&&(r[h]==w||n[h]==w&&(p=!0)?a[h++]=Q:a.length&&(b=!1)),y=G,Q+=J(w)}return h==l&&a[0]==0&&b?this.result(-100+(p?-200:0),a,e):u==l&&d==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):o>-1?this.ret(-700-e.length,[o,o+this.pattern.length]):u==l?this.ret(-900-e.length,[d,m]):h==l?this.result(-100+(p?-200:0)+-700+(b?0:-1100),a,e):r.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,r,n){let i=[],s=0;for(let a of r){let o=a+(this.astral?J(W(n,a)):1);s&&i[s-1]==a?i[s-1]=o:(i[s++]=a,i[s++]=o)}return this.ret(e-n.length,i)}},Vr=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Bl,filterStrict:!1,compareCompletions:(e,r)=>(e.sortText||e.label).localeCompare(r.sortText||r.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,r)=>e&&r,closeOnBlur:(e,r)=>e&&r,icons:(e,r)=>e&&r,tooltipClass:(e,r)=>n=>bs(e(n),r(n)),optionClass:(e,r)=>n=>bs(e(n),r(n)),addToOptions:(e,r)=>e.concat(r),filterStrict:(e,r)=>e||r})}});function bs(t,e){return t?e?t+" "+e:t:e}function Bl(t,e,r,n,i,s){let a=t.textDirection==Ki.RTL,o=a,l=!1,O="top",c,h,p=e.left-i.left,u=i.right-e.right,d=n.right-n.left,m=n.bottom-n.top;if(o&&p=m||Q>e.top?c=r.bottom-e.top:(O="bottom",c=e.bottom-r.top)}let g=(e.bottom-e.top)/s.offsetHeight,b=(e.right-e.left)/s.offsetWidth;return{style:`${O}: ${c/g}px; max-width: ${h/b}px`,class:"cm-completionInfo-"+(l?a?"left-narrow":"right-narrow":o?"left":"right")}}var en=q.define();function Nl(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(r){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),r.type&&n.classList.add(...r.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(r,n,i,s){let a=document.createElement("span");a.className="cm-completionLabel";let o=r.displayLabel||r.label,l=0;for(let O=0;Ol&&a.appendChild(document.createTextNode(o.slice(l,c)));let p=a.appendChild(document.createElement("span"));p.appendChild(document.createTextNode(o.slice(c,h))),p.className="cm-completionMatchedText",l=h}return lr.position-n.position).map(r=>r.render)}function Er(t,e,r){if(t<=r)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let i=Math.floor(e/r);return{from:i*r,to:(i+1)*r}}let n=Math.ceil((t-e)/r);return{from:t-n*r,to:t-(n-1)*r}}var Gr=class{constructor(e,r,n){this.view=e,this.stateField=r,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let i=e.state.field(r),{options:s,selected:a}=i.open,o=e.state.facet(Y);this.optionContent=Nl(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=Er(s.length,a,o.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:O}=e.state.field(r).open;for(let c=l.target,h;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(h=/-(\d+)$/.exec(c.id))&&+h[1]this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;c!=null&&(e.dispatch({effects:en.of(c)}),l.preventDefault())}}),this.dom.addEventListener("focusout",l=>{let O=e.state.field(this.stateField,!1);O&&O.tooltip&&e.state.facet(Y).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:ft.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(e,r){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,r,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var r;let n=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=i){let{options:s,selected:a,disabled:o}=n.open;(!i.open||i.open.options!=s)&&(this.range=Er(s.length,a,e.state.facet(Y).maxRenderedOptions),this.showOptions(s,n.id)),this.updateSel(),o!=((r=i.open)===null||r===void 0?void 0:r.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!o)}}updateTooltipClass(e){let r=this.tooltipClass(e);if(r!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of r.split(" "))n&&this.dom.classList.add(n);this.currentClass=r}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),r=e.open;(r.selected>-1&&r.selected=this.range.to)&&(this.range=Er(r.options.length,r.selected,this.view.state.facet(Y).maxRenderedOptions),this.showOptions(r.options,e.id));let n=this.updateSelectedOption(r.selected);if(n){this.destroyInfo();let{completion:i}=r.options[r.selected],{info:s}=i;if(!s)return;let a=typeof s=="string"?document.createTextNode(s):s(i);if(!a)return;"then"in a?a.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,i)}).catch(o=>Et(this.view.state,o,"completion info")):(this.addInfoPane(a,i),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,r){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:s}=e;n.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let r=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)n.nodeName!="LI"||!n.id?i--:i==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),r=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby"));return r&&Hl(this.list,r),r}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let r=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),s=this.space;if(!s){let a=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return i.top>Math.min(s.bottom,r.bottom)-10||i.bottom{a.target==i&&a.preventDefault()});let s=null;for(let a=n.from;an.from||n.from==0))if(s=p,typeof O!="string"&&O.header)i.appendChild(O.header(O));else{let u=i.appendChild(document.createElement("completion-section"));u.textContent=p}}let c=i.appendChild(document.createElement("li"));c.id=r+"-"+a,c.setAttribute("role","option");let h=this.optionClass(o);h&&(c.className=h);for(let p of this.optionContent){let u=p(o,this.view.state,this.view,l);u&&c.appendChild(u)}}return n.from&&i.classList.add("cm-completionListIncompleteTop"),n.tonew Gr(r,t,e)}function Hl(t,e){let r=t.getBoundingClientRect(),n=e.getBoundingClientRect(),i=r.height/t.offsetHeight;n.topr.bottom&&(t.scrollTop+=(n.bottom-r.bottom)/i)}function Ss(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function Kl(t,e){let r=[],n=null,i=null,s=c=>{r.push(c);let{section:h}=c.completion;if(h){n||(n=[]);let p=typeof h=="string"?h:h.name;n.some(u=>u.name==p)||n.push(typeof h=="string"?{name:p}:h)}},a=e.facet(Y);for(let c of t)if(c.hasResult()){let h=c.result.getMatch;if(c.result.filter===!1)for(let p of c.result.options)s(new Nt(p,c.source,h?h(p):[],1e9-r.length));else{let p=e.sliceDoc(c.from,c.to),u,d=a.filterStrict?new Vr(p):new Ur(p);for(let m of c.result.options)if(u=d.match(m.label)){let g=m.displayLabel?h?h(m,u.matched):[]:u.matched,b=u.score+(m.boost||0);if(s(new Nt(m,c.source,g,b)),typeof m.section=="object"&&m.section.rank==="dynamic"){let{name:Q}=m.section;i||(i=Object.create(null)),i[Q]=Math.max(b,i[Q]||-1e9)}}}}if(n){let c=Object.create(null),h=0,p=(u,d)=>(u.rank==="dynamic"&&d.rank==="dynamic"?i[d.name]-i[u.name]:0)||(typeof u.rank=="number"?u.rank:1e9)-(typeof d.rank=="number"?d.rank:1e9)||(u.namep.score-h.score||O(h.completion,p.completion))){let h=c.completion;!l||l.label!=h.label||l.detail!=h.detail||l.type!=null&&h.type!=null&&l.type!=h.type||l.apply!=h.apply||l.boost!=h.boost?o.push(c):Ss(c.completion)>Ss(l)&&(o[o.length-1]=c),l=c.completion}return o}var Ir=class t{constructor(e,r,n,i,s,a){this.options=e,this.attrs=r,this.tooltip=n,this.timestamp=i,this.selected=s,this.disabled=a}setSelected(e,r){return e==this.selected||e>=this.options.length?this:new t(this.options,ks(r,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,r,n,i,s,a){if(i&&!a&&e.some(O=>O.isPending))return i.setDisabled();let o=Kl(e,r);if(!o.length)return i&&e.some(O=>O.isPending)?i.setDisabled():null;let l=r.facet(Y).selectOnOpen?0:-1;if(i&&i.selected!=l&&i.selected!=-1){let O=i.options[i.selected].completion;for(let c=0;cc.hasResult()?Math.min(O,c.from):O,1e8),create:iO,above:s.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(e){return new t(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new t(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},Dr=class t{constructor(e,r,n){this.active=e,this.id=r,this.open=n}static start(){return new t(rO,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:r}=e,n=r.facet(Y),s=(n.override||r.languageDataAt("autocomplete",_e(r)).map(Dl)).map(l=>(this.active.find(c=>c.source==l)||new ue(l,this.active.some(c=>c.state!=0)?1:0)).update(e,n));s.length==this.active.length&&s.every((l,O)=>l==this.active[O])&&(s=this.active);let a=this.open,o=e.effects.some(l=>l.is(tn));a&&e.docChanged&&(a=a.map(e.changes)),e.selection||s.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!Jl(s,this.active)||o?a=Ir.build(s,r,this.id,a,n,o):a&&a.disabled&&!s.some(l=>l.isPending)&&(a=null),!a&&s.every(l=>!l.isPending)&&s.some(l=>l.hasResult())&&(s=s.map(l=>l.hasResult()?new ue(l.source,0):l));for(let l of e.effects)l.is(en)&&(a=a&&a.setSelected(l.value,this.id));return s==this.active&&a==this.open?this:new t(s,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?eO:tO}};function Jl(t,e){if(t==e)return!0;for(let r=0,n=0;;){for(;r-1&&(r["aria-activedescendant"]=t+"-"+e),r}var rO=[];function Xs(t,e){if(t.isUserEvent("input.complete")){let n=t.annotation(Jr);if(n&&e.activateOnCompletion(n))return 12}let r=t.isUserEvent("input.type");return r&&e.activateOnTyping?5:r?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}var ue=class t{constructor(e,r,n=!1){this.source=e,this.state=r,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(e,r){let n=Xs(e,r),i=this;(n&8||n&16&&this.touches(e))&&(i=new t(i.source,0)),n&4&&i.state==0&&(i=new t(this.source,1)),i=i.updateFor(e,n);for(let s of e.effects)if(s.is(Ft))i=new t(i.source,1,s.value);else if(s.is(ft))i=new t(i.source,0);else if(s.is(tn))for(let a of s.value)a.source==i.source&&(i=a);return i}updateFor(e,r){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(_e(e.state))}},Ht=class t extends ue{constructor(e,r,n,i,s,a){super(e,3,r),this.limit=n,this.result=i,this.from=s,this.to=a}hasResult(){return!0}updateFor(e,r){var n;if(!(r&3))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let s=e.changes.mapPos(this.from),a=e.changes.mapPos(this.to,1),o=_e(e.state);if(o>a||!i||r&2&&(_e(e.startState)==this.from||or.map(e))}}),U=ie.define({create(){return Dr.start()},update(t,e){return t.update(e)},provide:t=>[es.from(t,e=>e.tooltip),X.contentAttributes.from(t,e=>e.attrs)]});function rn(t,e){let r=e.completion.apply||e.completion.label,n=t.state.field(U).active.find(i=>i.source==e.source);return n instanceof Ht?(typeof r=="string"?t.dispatch({...Il(t.state,r,n.from,n.to),annotations:Jr.of(e.completion)}):r(t,e.completion,n.from,n.to),!0):!1}var iO=Fl(U,rn);function Bt(t,e="option"){return r=>{let n=r.state.field(U,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+i*(t?1:-1):t?0:a-1;return o<0?o=e=="page"?0:a-1:o>=a&&(o=e=="page"?a-1:0),r.dispatch({effects:en.of(o)}),!0}}var sO=t=>{let e=t.state.field(U,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.state.field(U,!1)?(t.dispatch({effects:Ft.of(!0)}),!0):!1,aO=t=>{let e=t.state.field(U,!1);return!e||!e.active.some(r=>r.state!=0)?!1:(t.dispatch({effects:ft.of(null)}),!0)},Br=class{constructor(e,r){this.active=e,this.context=r,this.time=Date.now(),this.updates=[],this.done=void 0}},oO=50,lO=1e3,OO=ve.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(U).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(U),r=t.state.facet(Y);if(!t.selectionSet&&!t.docChanged&&t.startState.field(U)==e)return;let n=t.transactions.some(s=>{let a=Xs(s,r);return a&8||(s.selection||s.docChanged)&&!(a&3)});for(let s=0;soO&&Date.now()-a.time>lO){for(let o of a.context.abortListeners)try{o()}catch(l){Et(this.view.state,l)}a.context.abortListeners=null,this.running.splice(s--,1)}else a.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(s=>s.effects.some(a=>a.is(Ft)))&&(this.pendingStart=!0);let i=this.pendingStart?50:r.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.isPending&&!this.running.some(a=>a.active.source==s.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let s of t.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(U);for(let r of e.active)r.isPending&&!this.running.some(n=>n.active.source==r.source)&&this.startQuery(r);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Y).updateSyncTime))}startQuery(t){let{state:e}=this.view,r=_e(e),n=new He(e,r,t.explicit,this.view),i=new Br(t,n);this.running.push(i),Promise.resolve(t.source(n)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:ft.of(null)}),Et(this.view.state,s)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Y).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],r=this.view.state.facet(Y),n=this.view.state.field(U);for(let i=0;io.source==s.active.source);if(a&&a.isPending)if(s.done==null){let o=new ue(s.active.source,0);for(let l of s.updates)o=o.update(l,r);o.isPending||e.push(o)}else this.startQuery(a)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:tn.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(U,!1);if(e&&e.tooltip&&this.view.state.facet(Y).closeOnBlur){let r=e.open&&zr(this.view,e.open.tooltip);(!r||!r.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:ft.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Ft.of(!1)}),20),this.composing=0}}}),cO=typeof navigator=="object"&&/Win/.test(navigator.platform),hO=ge.highest(X.domEventHandlers({keydown(t,e){let r=e.state.field(U,!1);if(!r||!r.open||r.open.disabled||r.open.selected<0||!t.key||t.key.length>1||t.ctrlKey&&!(cO&&t.altKey)||t.metaKey)return!1;let n=r.open.options[r.open.selected],i=r.active.find(a=>a.source==n.source),s=n.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(t.key)>-1&&rn(e,n),!1}})),vs=X.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:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".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:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),Nr=class{constructor(e,r,n,i){this.field=e,this.line=r,this.from=n,this.to=i}},Fr=class t{constructor(e,r,n){this.field=e,this.from=r,this.to=n}map(e){let r=e.mapPos(this.from,-1,Lt.TrackDel),n=e.mapPos(this.to,1,Lt.TrackDel);return r==null||n==null?null:new t(this.field,r,n)}},Hr=class t{constructor(e,r){this.lines=e,this.fieldPositions=r}instantiate(e,r){let n=[],i=[r],s=e.doc.lineAt(r),a=/^\s*/.exec(s.text)[0];for(let l of this.lines){if(n.length){let O=a,c=/^\t*/.exec(l)[0].length;for(let h=0;hnew Fr(l.field,i[l.line]+l.from,i[l.line]+l.to));return{text:n,ranges:o}}static parse(e){let r=[],n=[],i=[],s;for(let a of e.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(a);){let o=s[1]?+s[1]:null,l=s[2]||s[3]||"",O=-1;o===0&&(o=1e9);let c=l.replace(/\\[{}]/g,h=>h[1]);for(let h=0;h=O&&p.field++}for(let h of i)if(h.line==n.length&&h.from>s.index){let p=s[2]?3+(s[1]||"").length:2;h.from-=p,h.to-=p}i.push(new Nr(O,n.length,s.index,s.index+c.length)),a=a.slice(0,s.index)+l+a.slice(s.index+s[0].length)}a=a.replace(/\\([{}])/g,(o,l,O)=>{for(let c of i)c.line==n.length&&c.from>O&&(c.from--,c.to--);return l}),n.push(a)}return new t(n,i)}},uO=v.widget({widget:new class extends ee{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),pO=v.mark({class:"cm-snippetField"}),Ke=class t{constructor(e,r){this.ranges=e,this.active=r,this.deco=v.set(e.map(n=>(n.from==n.to?uO:pO).range(n.from,n.to)),!0)}map(e){let r=[];for(let n of this.ranges){let i=n.map(e);if(!i)return null;r.push(i)}return new t(r,this.active)}selectionInsideField(e){return e.ranges.every(r=>this.ranges.some(n=>n.field==this.active&&n.from<=r.from&&n.to>=r.to))}},gt=q.define({map(t,e){return t&&t.map(e)}}),fO=q.define(),dt=ie.define({create(){return null},update(t,e){for(let r of e.effects){if(r.is(gt))return r.value;if(r.is(fO)&&t)return new Ke(t.ranges,r.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>X.decorations.from(t,e=>e?e.deco:v.none)});function nn(t,e){return Z.create(t.filter(r=>r.field==e).map(r=>Z.range(r.from,r.to)))}function dO(t){let e=Hr.parse(t);return(r,n,i,s)=>{let{text:a,ranges:o}=e.instantiate(r.state,i),{main:l}=r.state.selection,O={changes:{from:i,to:s==l.from?l.to:s,insert:Ii.of(a)},scrollIntoView:!0,annotations:n?[Jr.of(n),Bi.userEvent.of("input.complete")]:void 0};if(o.length&&(O.selection=nn(o,0)),o.some(c=>c.field>0)){let c=new Ke(o,0),h=O.effects=[gt.of(c)];r.state.field(dt,!1)===void 0&&h.push(q.appendConfig.of([dt,bO,SO,vs]))}r.dispatch(r.state.update(O))}}function Ts(t){return({state:e,dispatch:r})=>{let n=e.field(dt,!1);if(!n||t<0&&n.active==0)return!1;let i=n.active+t,s=t>0&&!n.ranges.some(a=>a.field==i+t);return r(e.update({selection:nn(n.ranges,i),effects:gt.of(s?null:new Ke(n.ranges,i)),scrollIntoView:!0})),!0}}var mO=({state:t,dispatch:e})=>t.field(dt,!1)?(e(t.update({effects:gt.of(null)})),!0):!1,gO=Ts(1),QO=Ts(-1);var $O=[{key:"Tab",run:gO,shift:QO},{key:"Escape",run:mO}],Ps=De.define({combine(t){return t.length?t[0]:$O}}),bO=ge.highest(Te.compute([Ps],t=>t.facet(Ps)));function L(t,e){return{...e,apply:dO(t)}}var SO=X.domEventHandlers({mousedown(t,e){let r=e.state.field(dt,!1),n;if(!r||(n=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let i=r.ranges.find(s=>s.from<=n&&s.to>=n);return!i||i.field==r.active?!1:(e.dispatch({selection:nn(r.ranges,i.field),effects:gt.of(r.ranges.some(s=>s.field>i.field)?new Ke(r.ranges,i.field):null),scrollIntoView:!0}),!0)}});var mt={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},je=q.define({map(t,e){let r=e.mapPos(t,-1,Lt.TrackAfter);return r??void 0}}),sn=new class extends Ni{};sn.startSide=1;sn.endSide=-1;var Rs=ie.define({create(){return Fi.empty},update(t,e){if(t=t.map(e.changes),e.selection){let r=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:n=>n>=r.from&&n<=r.to})}for(let r of e.effects)r.is(je)&&(t=t.update({add:[sn.range(r.value,r.value+1)]}));return t}});function js(){return[PO,Rs]}var Mr="()[]{}<>\xAB\xBB\xBB\xAB\uFF3B\uFF3D\uFF5B\uFF5D";function _s(t){for(let e=0;e{if((kO?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let i=t.state.selection.main;if(n.length>2||n.length==2&&J(W(n,0))==1||e!=i.from||r!=i.to)return!1;let s=wO(t.state,n);return s?(t.dispatch(s),!0):!1}),xO=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Cs(t,t.selection.main.head).brackets||mt.brackets,i=null,s=t.changeByRange(a=>{if(a.empty){let o=yO(t.doc,a.head);for(let l of n)if(l==o&&Kt(t.doc,a.head)==_s(W(l,0)))return{changes:{from:a.head-l.length,to:a.head+l.length},range:Z.cursor(a.head-l.length)}}return{range:i=a}});return i||e(t.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},Ys=[{key:"Backspace",run:xO}];function wO(t,e){let r=Cs(t,t.selection.main.head),n=r.brackets||mt.brackets;for(let i of n){let s=_s(W(i,0));if(e==i)return s==i?vO(t,i,n.indexOf(i+i+i)>-1,r):ZO(t,i,s,r.before||mt.before);if(e==s&&zs(t,t.selection.main.from))return XO(t,i,s)}return null}function zs(t,e){let r=!1;return t.field(Rs).between(0,t.doc.length,n=>{n==e&&(r=!0)}),r}function Kt(t,e){let r=t.sliceString(e,e+2);return r.slice(0,J(W(r,0)))}function yO(t,e){let r=t.sliceString(e-2,e);return J(W(r,0))==r.length?r:r.slice(1)}function ZO(t,e,r,n){let i=null,s=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:r,from:a.to}],effects:je.of(a.to+e.length),range:Z.range(a.anchor+e.length,a.head+e.length)};let o=Kt(t.doc,a.head);return!o||/\s/.test(o)||n.indexOf(o)>-1?{changes:{insert:e+r,from:a.head},effects:je.of(a.head+e.length),range:Z.cursor(a.head+e.length)}:{range:i=a}});return i?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function XO(t,e,r){let n=null,i=t.changeByRange(s=>s.empty&&Kt(t.doc,s.head)==r?{changes:{from:s.head,to:s.head+r.length,insert:r},range:Z.cursor(s.head+r.length)}:n={range:s});return n?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function vO(t,e,r,n){let i=n.stringPrefixes||mt.stringPrefixes,s=null,a=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:e,from:o.to}],effects:je.of(o.to+e.length),range:Z.range(o.anchor+e.length,o.head+e.length)};let l=o.head,O=Kt(t.doc,l),c;if(O==e){if(xs(t,l))return{changes:{insert:e+e,from:l},effects:je.of(l+e.length),range:Z.cursor(l+e.length)};if(zs(t,l)){let p=r&&t.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+p.length,insert:p},range:Z.cursor(l+p.length)}}}else{if(r&&t.sliceDoc(l-2*e.length,l)==e+e&&(c=ws(t,l-2*e.length,i))>-1&&xs(t,c))return{changes:{insert:e+e+e+e,from:l},effects:je.of(l+e.length),range:Z.cursor(l+e.length)};if(t.charCategorizer(l)(O)!=A.Word&&ws(t,l,i)>-1&&!TO(t,l,e,i))return{changes:{insert:e+e,from:l},effects:je.of(l+e.length),range:Z.cursor(l+e.length)}}return{range:s=o}});return s?null:t.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function xs(t,e){let r=R(t).resolveInner(e+1);return r.parent&&r.from==e}function TO(t,e,r,n){let i=R(t).resolveInner(e,-1),s=n.reduce((a,o)=>Math.max(a,o.length),0);for(let a=0;a<5;a++){let o=t.sliceDoc(i.from,Math.min(i.to,i.from+r.length+s)),l=o.indexOf(r);if(!l||l>-1&&n.indexOf(o.slice(0,l))>-1){let c=i.firstChild;for(;c&&c.from==i.from&&c.to-c.from>r.length+l;){if(t.sliceDoc(c.to-r.length,c.to)==r)return!1;c=c.firstChild}return!0}let O=i.to==e&&i.parent;if(!O)break;i=O}return!1}function ws(t,e,r){let n=t.charCategorizer(e);if(n(t.sliceDoc(e-1,e))!=A.Word)return e;for(let i of r){let s=e-i.length;if(t.sliceDoc(s,e)==i&&n(t.sliceDoc(s-1,s))!=A.Word)return s}return-1}function qs(t={}){return[hO,U,Y.of(t),OO,RO,vs]}var an=[{key:"Ctrl-Space",run:Wr},{mac:"Alt-`",run:Wr},{mac:"Alt-i",run:Wr},{key:"Escape",run:aO},{key:"ArrowDown",run:Bt(!0)},{key:"ArrowUp",run:Bt(!1)},{key:"PageDown",run:Bt(!0,"page")},{key:"PageUp",run:Bt(!1,"page")},{key:"Enter",run:sO}],RO=ge.highest(Te.computeN([Y],t=>t.facet(Y).defaultKeymap?[an]:[]));var tr=class t{static create(e,r,n,i,s){let a=i+(i<<8)+e+(r<<4)|0;return new t(e,r,n,a,s,[],[])}constructor(e,r,n,i,s,a,o){this.type=e,this.value=r,this.from=n,this.hash=i,this.end=s,this.children=a,this.positions=o,this.blankFirstLine=!1,this.hashProp=[[K.contextHash,i]]}addChild(e,r){e.prop(K.contextHash)!=this.hash&&(e=new M(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(r)}toTree(e,r=this.end){let n=this.children.length-1;return n>=0&&(r=Math.max(r,this.positions[n]+this.children[n].length+this.from)),new M(e.types[this.type],this.children,this.positions,r-this.from).balance({makeTree:(i,s,a)=>new M(Re.none,i,s,a,this.hashProp)})}},$;(function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.Autolink=33]="Autolink",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel",t[t.URL=44]="URL"})($||($={}));var On=class{constructor(e,r){this.start=e,this.content=r,this.marks=[],this.parsers=[]}},cn=class{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return $t(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,r=0,n=0){for(let i=r;i=e.stack[r.depth+1].value+r.baseIndent)return!0;if(r.indent>=r.baseIndent+4)return!1;let n=(t.type==$.OrderedList?kn:Sn)(r,e,!1);return n>0&&(t.type!=$.BulletList||bn(r,e,!1)<0)&&r.text.charCodeAt(r.pos+n-1)==t.value}var Ns={[$.Blockquote](t,e,r){return r.next!=62?!1:(r.markers.push(T($.QuoteMark,e.lineStart+r.pos,e.lineStart+r.pos+1)),r.moveBase(r.pos+(D(r.text.charCodeAt(r.pos+1))?2:1)),t.end=e.lineStart+r.text.length,!0)},[$.ListItem](t,e,r){return(r.next<0?t.blankFirstLine&&t.children.length==1:r.indentr&&D(t.charCodeAt(e-1));)e--;return e}function Fs(t){if(t.next!=96&&t.next!=126)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length&&e.parser.leafBlockParsers.indexOf(ia.SetextHeading)>-1||n<3?-1:1}function Ks(t,e){for(let r=t.stack.length-1;r>=0;r--)if(t.stack[r].type==e)return!0;return!1}function Sn(t,e,r){return(t.next==45||t.next==43||t.next==42)&&(t.pos==t.text.length-1||D(t.text.charCodeAt(t.pos+1)))&&(!r||Ks(e,$.BulletList)||t.skipSpace(t.pos+2)=48&&i<=57;){n++;if(n==t.text.length)return-1;i=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||i!=46&&i!=41||nt.pos+1||t.next!=49)?-1:n+1-t.pos}function Js(t){if(t.next!=35)return-1;let e=t.pos+1;for(;e6?-1:r}function ea(t){if(t.next!=45&&t.next!=61||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,ra=/\?>/,un=[[/^<(?:script|pre|style|textarea)(?:\s|>|$)/i,/<\/(?:script|pre|style|textarea)>/i],[/^\s*)/.exec(n);if(s)return t.append(T($.Comment,r,r+1+s[0].length));let a=/^\?[^]*?\?>/.exec(n);if(a)return t.append(T($.ProcessingInstruction,r,r+1+a[0].length));let o=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/[a-zA-Z][\w-]*\s*>|[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*\/?>)/.exec(n);return o?t.append(T($.HTMLTag,r,r+1+o[0].length)):-1},Emphasis(t,e,r){if(e!=95&&e!=42)return-1;let n=r+1;for(;t.char(n)==e;)n++;let i=t.slice(r-1,r),s=t.slice(n,n+1),a=kt.test(i),o=kt.test(s),l=/\s|^$/.test(i),O=/\s|^$/.test(s),c=!O&&(!o||l||a),h=!l&&(!a||O||o),p=c&&(e==42||!h||a),u=h&&(e==42||!c||o);return t.append(new E(e==95?Pn:xn,r,n,(p?1:0)|(u?2:0)))},HardBreak(t,e,r){if(e==92&&t.char(r+1)==10)return t.append(T($.HardBreak,r,r+2));if(e==32){let n=r+1;for(;t.char(n)==32;)n++;if(t.char(n)==10&&n>=r+2)return t.append(T($.HardBreak,r,n+1))}return-1},Link(t,e,r){return e==91?t.append(new E(Ce,r,r+1,1)):-1},Image(t,e,r){return e==33&&t.char(r+1)==91?t.append(new E(ir,r,r+2,1)):-1},LinkEnd(t,e,r){if(e!=93)return-1;for(let n=t.parts.length-1;n>=0;n--){let i=t.parts[n];if(i instanceof E&&(i.type==Ce||i.type==ir)){if(!i.side||t.skipSpace(i.to)==r&&!/[(\[]/.test(t.slice(r+1,r+2)))return t.parts[n]=null,-1;let s=t.takeContent(n),a=t.parts[n]=CO(t,s,i.type==Ce?$.Link:$.Image,i.from,r+1);if(i.type==Ce)for(let o=0;oe?T($.URL,e+r,s+r):s==t.length?null:!1}}function la(t,e,r){let n=t.charCodeAt(e);if(n!=39&&n!=34&&n!=40)return!1;let i=n==40?41:n;for(let s=e+1,a=!1;s=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,r){return this.text.slice(e-this.offset,r-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,r,n,i,s){return this.append(new E(e,r,n,(i?1:0)|(s?2:0)))}get hasOpenLink(){for(let e=this.parts.length-1;e>=0;e--){let r=this.parts[e];if(r instanceof E&&(r.type==Ce||r.type==ir))return!0}return!1}addElement(e){return this.append(e)}resolveMarkers(e){for(let n=e;n=e;l--){let m=this.parts[l];if(m instanceof E&&m.side&1&&m.type==i.type&&!(s&&(i.side&1||m.side&2)&&(m.size+i.size)%3==0&&(m.size%3||i.size%3))){o=m;break}}if(!o)continue;let O=i.type.resolve,c=[],h=o.from,p=i.to;if(s){let m=Math.min(2,o.to-o.from,a);h=o.to-m,p=i.from+m,O=m==1?"Emphasis":"StrongEmphasis"}o.type.mark&&c.push(this.elt(o.type.mark,h,o.to));for(let m=l+1;m=0;r--){let n=this.parts[r];if(n instanceof E&&n.type==e&&n.side&1)return r}return null}takeContent(e){let r=this.resolveMarkers(e);return this.parts.length=e,r}getDelimiterAt(e){let r=this.parts[e];return r instanceof E?r:null}skipSpace(e){return $t(this.text,e-this.offset)+this.offset}elt(e,r,n,i){return typeof e=="string"?T(this.parser.getNodeType(e),r,n,i):new nr(e,r)}};ze.linkStart=Ce;ze.imageStart=ir;ze.emphasisAsterisk=xn;ze.emphasisUnderscore=Pn;function gn(t,e){if(!e.length)return t;if(!t.length)return e;let r=t.slice(),n=0;for(let i of e){for(;n(e?e-1:0))return!1;if(this.fragmentEnd<0){let s=this.fragment.to;for(;s>0&&this.input.read(s-1,s)!=` +`;)s--;this.fragmentEnd=s?s-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(le.IncludeAnonymous|le.IgnoreMounts),n.firstChild());let i=e+this.fragment.offset;for(;n.to<=i;)if(!n.parent())return!1;for(;;){if(n.from>=i)return this.fragment.from<=r;if(!n.childAfter(i))return!1}}matches(e){let r=this.cursor.tree;for(;r&&r.type.isAnonymous&&r.children[0]instanceof M;)r=r.children[0];return r&&r.prop(K.contextHash)==e}takeNodes(e){let r=this.cursor,n=this.fragment.offset,i=this.fragmentEnd-(this.fragment.openEnd?1:0),s=e.absoluteLineStart,a=s,o=e.block.children.length,l=e.lineStart-e.block.from>>2,O=a,c=o;e:for(;;){if(r.to-n>Math.min(i,e.to)||r.type.isAnonymous&&r.tree&&(r.to-r.from>l||!YO(r.tree))){if(r.type.isAnonymous&&r.firstChild())continue;break}let h=ha(r.from-n,e.ranges);if(r.to-n<=e.ranges[e.rangeI].to)e.addNode(r.tree,h);else{let p=new M(e.parser.nodeSet.types[$.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(p,r.tree),e.addNode(p,h)}for((r.type.isAnonymous||r.type.is("Block"))&&(r.type.isAnonymous||ca.indexOf(r.type.id)<0?(a=r.to-n,o=e.block.children.length):(a=O,o=c),O=r.to-n,c=e.block.children.length);;){if(r.nextSibling())continue e;if(!r.parent()||!r.type.isAnonymous)break e}}for(;e.block.children.length>o;)e.block.children.pop(),e.block.positions.pop();return a-s}};function YO(t){for(;t.type.isAnonymous;){let e=t.children[t.children.length-1];if(e instanceof M)t=e;else return!1}return t.type.is("Block")&&ca.indexOf(t.type.id)<0}function ha(t,e){let r=t;for(let n=1;nJt[t]),Object.keys(Jt).map(t=>ia[t]),Object.keys(Jt),jO,Ns,Object.keys(ln).map(t=>ln[t]),Object.keys(ln),[]);function qO(t,e,r){let n=[];for(let i=t.firstChild,s=e;;i=i.nextSibling){let a=i?i.from:r;if(a>s&&n.push({from:s,to:a}),!i)break;s=i.to}return n}function pa(t){let{codeParser:e,htmlParser:r}=t;return{wrap:Ut((i,s)=>{let a=i.type.id;if(e&&(a==$.CodeBlock||a==$.FencedCode)){let o="";if(a==$.FencedCode){let O=i.node.getChild($.CodeInfo);O&&(o=s.read(O.from,O.to))}let l=e(o);if(l)return{parser:l,overlay:O=>O.type.id==$.CodeText,bracketed:a==$.FencedCode}}else if(r&&(a==$.HTMLBlock||a==$.HTMLTag||a==$.CommentBlock))return{parser:r,overlay:qO(i.node,i.from,i.to)};return null})}}var AO={resolve:"Strikethrough",mark:"StrikethroughMark"},LO={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":f.strikethrough}},{name:"StrikethroughMark",style:f.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,r){if(e!=126||t.char(r+1)!=126||t.char(r+2)==126)return-1;let n=t.slice(r-1,r),i=t.slice(r+2,r+3),s=/\s|^$/.test(n),a=/\s|^$/.test(i),o=kt.test(n),l=kt.test(i);return t.addDelimiter(AO,r,r+2,!a&&(!l||s||o),!s&&(!o||a||l))},after:"Emphasis"}]};function bt(t,e,r=0,n,i=0){let s=0,a=!0,o=-1,l=-1,O=!1,c=()=>{n.push(t.elt("TableCell",i+o,i+l,t.parser.parseInline(e.slice(o,l),i+o)))};for(let h=r;h-1)&&s++,a=!1,n&&(o>-1&&c(),n.push(t.elt("TableDelimiter",h+i,h+i+1))),o=l=-1):(O||p!=32&&p!=9)&&(o<0&&(o=h),l=h+1),O=!O&&p==92}return o>-1&&(s++,n&&c()),s}function Ms(t,e){for(let r=e;r\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,sr=class{constructor(){this.rows=null}nextLine(e,r,n){if(this.rows==null){this.rows=!1;let i;if((r.next==45||r.next==58||r.next==124)&&fa.test(i=r.text.slice(r.pos))){let s=[];bt(e,n.content,0,s,n.start)==bt(e,i,0)&&(this.rows=[e.elt("TableHeader",n.start,n.start+n.content.length,s),e.elt("TableDelimiter",e.lineStart+r.pos,e.lineStart+r.text.length)])}}else if(this.rows){let i=[];bt(e,r.text,r.pos,i,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+r.pos,e.lineStart+r.text.length,i))}return!1}finish(e,r){return this.rows?(e.addLeafElement(r,e.elt("Table",r.start,r.start+r.content.length,this.rows)),!0):!1}},EO={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":f.heading}},"TableRow",{name:"TableCell",style:f.content},{name:"TableDelimiter",style:f.processingInstruction}],parseBlock:[{name:"Table",leaf(t,e){return Ms(e.content,0)?new sr:null},endLeaf(t,e,r){if(r.parsers.some(i=>i instanceof sr)||!Ms(e.text,e.basePos))return!1;let n=t.peekLine();return fa.test(n)&&bt(t,e.text,e.basePos)==bt(t,n,e.basePos)},before:"SetextHeading"}]},$n=class{nextLine(){return!1}finish(e,r){return e.addLeafElement(r,e.elt("Task",r.start,r.start+r.content.length,[e.elt("TaskMarker",r.start,r.start+3),...e.parser.parseInline(r.content.slice(3),r.start+3)])),!0}},WO={defineNodes:[{name:"Task",block:!0,style:f.list},{name:"TaskMarker",style:f.atom}],parseBlock:[{name:"TaskList",leaf(t,e){return/^\[[ xX]\][ \t]/.test(e.content)&&t.parentType().name=="ListItem"?new $n:null},after:"SetextHeading"}]},Us=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,Vs=/[\w-]+(\.[\w-]+)+(:\d+)?(\/[^\s<]*)?/gy,MO=/[\w-]+\.[\w-]+($|[/:])/,Gs=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,Is=/\/[a-zA-Z\d@.]+/gy;function Ds(t,e,r,n){let i=0;for(let s=e;s-1)return-1;let n=e+r[0].length;for(;;){let i=t[n-1],s;if(/[?!.,:*_~]/.test(i)||i==")"&&Ds(t,e,n,")")>Ds(t,e,n,"("))n--;else if(i==";"&&(s=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(t.slice(e,n))))n=e+s.index;else break}return n}function Bs(t,e){Gs.lastIndex=e;let r=Gs.exec(t);if(!r)return-1;let n=r[0][r[0].length-1];return n=="_"||n=="-"?-1:e+r[0].length-(n=="."?1:0)}var VO={parseInline:[{name:"Autolink",parse(t,e,r){let n=r-t.offset;if(n&&/\w/.test(t.text[n-1]))return-1;Us.lastIndex=n;let i=Us.exec(t.text),s=-1;if(!i)return-1;if(i[1]||i[2]){if(s=UO(t.text,n+i[0].length),s>-1&&t.hasOpenLink){let a=/([^\[\]]|\[[^\]]*\])*/.exec(t.text.slice(n,s));s=n+a[0].length}}else i[3]?s=Bs(t.text,n):(s=Bs(t.text,n+i[0].length),s>-1&&i[0]=="xmpp:"&&(Is.lastIndex=s,i=Is.exec(t.text),i&&(s=i.index+i[0].length)));return s<0?-1:(t.addElement(t.elt("URL",r,s+t.offset)),s+t.offset)}}]},da=[EO,WO,LO,VO];function ma(t,e,r){return(n,i,s)=>{if(i!=t||n.char(s+1)==t)return-1;let a=[n.elt(r,s,s+1)];for(let o=s+1;or%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,r,n=0){let i=e.parser.context;return new t(e,[],r,n,n,0,[],0,i?new ar(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,r){this.stack.push(this.state,r,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var r;let n=e>>19,i=e&65535,{parser:s}=this.p,a=this.reducePos=2e3&&!(!((r=this.p.parser.nodeSet.types[i])===null||r===void 0)&&r.isAnonymous)&&(O==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizel;)this.stack.pop();this.reduceContext(i,O)}storeNode(e,r,n,i=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[a-4]==0&&this.buffer[a-1]>-1){if(r==n)return;if(this.buffer[a-2]>=r){this.buffer[a-2]=n;return}}}if(!s||this.pos==n)this.buffer.push(e,r,n,i);else{let a=this.buffer.length;if(a>0&&(this.buffer[a-4]!=0||this.buffer[a-1]<0)){let o=!1;for(let l=a;l>0&&this.buffer[l-2]>n;l-=4)if(this.buffer[l-1]>=0){o=!0;break}if(o)for(;a>0&&this.buffer[a-2]>n;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,i>4&&(i-=4)}this.buffer[a]=e,this.buffer[a+1]=r,this.buffer[a+2]=n,this.buffer[a+3]=i}}shift(e,r,n,i){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let s=e,{parser:a}=this.p;this.pos=i;let o=a.stateFlag(s,1);!o&&(i>n||r<=a.maxNode)&&(this.reducePos=i),this.pushState(s,o?n:Math.min(n,this.reducePos)),this.shiftContext(r,n),r<=a.maxNode&&this.buffer.push(r,n,i,4)}else this.pos=i,this.shiftContext(r,n),r<=this.p.parser.maxNode&&this.buffer.push(r,n,i,4)}apply(e,r,n,i){e&65536?this.reduce(e):this.shift(e,r,n,i)}useNode(e,r,n){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let s=this.reducePos=this.pos=n+e.length;this.pushState(r,n),this.buffer.push(i,n,s,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,r=e.buffer.length;for(r&&e.buffer[r-4]==0&&(r-=4);r>0&&e.buffer[r-2]>e.reducePos;)r-=4;let n=e.buffer.slice(r),i=e.bufferBase+r;for(;e&&i==e.bufferBase;)e=e.parent;return new t(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,r){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,r,4),this.storeNode(0,this.pos,r,n?8:4),this.pos=this.reducePos=r,this.score-=190}canShift(e){for(let r=new Xn(this);;){let n=this.p.parser.stateSlot(r.state,4)||this.p.parser.hasAction(r.state,e);if(n==0)return!1;if((n&65536)==0)return!0;r.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let r=this.p.parser.nextStates(this.state);if(r.length>8||this.stack.length>=120){let i=[];for(let s=0,a;sl&1&&o==a)||i.push(r[s],a)}r=i}let n=[];for(let i=0;i>19,i=r&65535,s=this.stack.length-n*3;if(s<0||e.getGoto(this.stack[s],i,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;r=a}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(r),!0}findForcedReduction(){let{parser:e}=this.p,r=[],n=(i,s)=>{if(!r.includes(i))return r.push(i),e.allActions(i,a=>{if(!(a&393216))if(a&65536){let o=(a>>19)-s;if(o>1){let l=a&65535,O=this.stack.length-o*3;if(O>=0&&e.getGoto(this.stack[O],l,!1)>=0)return o<<19|65536|l}}else{let o=n(a,s+1);if(o!=null)return o}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let r=0;r0&&this.emitLookAhead()}},ar=class{constructor(e,r){this.tracker=e,this.context=r,this.hash=e.strict?e.hash(r):0}},Xn=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let r=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],r,!0);this.state=i}},vn=class t{constructor(e,r,n){this.stack=e,this.pos=r,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,r=e.bufferBase+e.buffer.length){return new t(e,r,r-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}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]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new t(this.stack,this.pos,this.index)}};function Pt(t,e=Uint16Array){if(typeof t!="string")return t;let r=null;for(let n=0,i=0;n=92&&a--,a>=34&&a--;let l=a-32;if(l>=46&&(l-=46,o=!0),s+=l,o)break;s*=46}r?r[i++]=s:r=new e(s)}return r}var et=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},ba=new et,Tn=class{constructor(e,r){this.input=e,this.ranges=r,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=ba,this.rangeIndex=0,this.pos=this.chunkPos=r[0].from,this.range=r[0],this.end=r[r.length-1].to,this.readNext()}resolveOffset(e,r){let n=this.range,i=this.rangeIndex,s=this.pos+e;for(;sn.to:s>=n.to;){if(i==this.ranges.length-1)return null;let a=this.ranges[++i];s+=a.from-n.to,n=a}return s}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,r.from);return this.end}peek(e){let r=this.chunkOff+e,n,i;if(r>=0&&r=this.chunk2Pos&&no.to&&(this.chunk2=this.chunk2.slice(0,o.to-n)),i=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),i}acceptToken(e,r=0){let n=r?this.resolveOffset(r,-1):this.pos;if(n==null||n=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,r){if(r?(this.token=r,r.start=e,r.lookAhead=e+1,r.value=r.extended=-1):this.token=ba,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&r<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,r-this.chunkPos);if(e>=this.chunk2Pos&&r<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,r-this.chunk2Pos);if(e>=this.range.from&&r<=this.range.to)return this.input.read(e,r);let n="";for(let i of this.ranges){if(i.from>=r)break;i.to>e&&(n+=this.input.read(Math.max(i.from,e),Math.min(i.to,r)))}return n}},Se=class{constructor(e,r){this.data=e,this.id=r}token(e,r){let{parser:n}=r.p;wa(this.data,e,r,this.id,n.data,n.tokenPrecTable)}};Se.prototype.contextual=Se.prototype.fallback=Se.prototype.extend=!1;var ke=class{constructor(e,r,n){this.precTable=r,this.elseToken=n,this.data=typeof e=="string"?Pt(e):e}token(e,r){let n=e.pos,i=0;for(;;){let s=e.next<0,a=e.resolveOffset(1,1);if(wa(this.data,e,r,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||i++,a==null)break;e.reset(a,e.token)}i&&(e.reset(n,e.token),e.acceptToken(this.elseToken,i))}};ke.prototype.contextual=Se.prototype.fallback=Se.prototype.extend=!1;var z=class{constructor(e,r={}){this.token=e,this.contextual=!!r.contextual,this.fallback=!!r.fallback,this.extend=!!r.extend}};function wa(t,e,r,n,i,s){let a=0,o=1<0){let d=t[u];if(l.allows(d)&&(e.token.value==-1||e.token.value==d||IO(d,e.token.value,i,s))){e.acceptToken(d);break}}let c=e.next,h=0,p=t[a+2];if(e.next<0&&p>h&&t[O+p*3-3]==65535){a=t[O+p*3-1];continue e}for(;h>1,d=O+u+(u<<1),m=t[d],g=t[d+1]||65536;if(c=g)h=u+1;else{a=t[d+2],e.advance();continue e}}break}}function Sa(t,e,r){for(let n=e,i;(i=t[n])!=65535;n++)if(i==r)return n-e;return-1}function IO(t,e,r,n){let i=Sa(r,n,e);return i<0||Sa(r,n,t)e)&&!n.type.isError)return r<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(r<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return r<0?0:t.length}}var Rn=class{constructor(e,r){this.fragments=e,this.minRepeat=r,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.lastRepeat=null,this.lastRepeatPos=-1,this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?ka(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?ka(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=a,null;if(s instanceof M){let o=a>this.lastRepeatPos&&s.type.id>=this.minRepeat;if(a==e||o){let l=a+s.length,O;if(a>=this.safeFrom&&l<=this.safeTo&&(!(O=s.prop(K.lookAhead))||l+O=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(a),this.index.push(0))}else this.index[r]++,this.nextStart=a+s.length}}},jn=class{constructor(e,r){this.stream=r,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new et)}getActions(e){let r=0,n=null,{parser:i}=e.p,{tokenizers:s}=i,a=i.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,l=0;for(let O=0;Oh.end+25&&(l=Math.max(h.lookAhead,l)),h.value!=0)){let p=r;if(h.extended>-1&&(r=this.addActions(e,h.extended,h.end,r)),r=this.addActions(e,h.value,h.end,r),!c.extend&&(n=h,r>p))break}}for(;this.actions.length>r;)this.actions.pop();return l&&e.setLookAhead(l),!n&&e.pos==this.stream.end&&(n=new et,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,r=this.addActions(e,n.value,n.end,r)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let r=new et,{pos:n,p:i}=e;return r.start=n,r.end=Math.min(n+1,i.stream.end),r.value=n==i.stream.end?i.parser.eofTerm:0,r}updateCachedToken(e,r,n){let i=this.stream.clipPos(n.pos);if(r.token(this.stream.reset(i,e),n),e.value>-1){let{parser:s}=n.p;for(let a=0;a=0&&n.p.parser.dialect.allows(o>>1)){(o&1)==0?e.value=o>>1:e.extended=o>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,r,n,i){for(let s=0;se.bufferLength*4?new Rn(n,e.minRepeatTerm):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,r=this.minStackPos,n=this.stacks=[],i,s;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;ar)n.push(o);else{if(this.advanceStack(o,n,e))continue;{i||(i=[],s=[]),i.push(o);let l=this.tokens.getMainToken(o);s.push(l.value,l.end)}}break}}if(!n.length){let a=i&&DO(i);if(a)return B&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw B&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+r);this.recovering||(this.recovering=5)}if(this.recovering&&i){let a=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,n);if(a)return B&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(n.length>a)for(n.sort((o,l)=>l.score-o.score);n.length>a;)n.pop();n.some(o=>o.reducePos>r)&&this.recovering--}else if(n.length>1){e:for(let a=0;a500&&O.buffer.length>500)if((o.score-O.score||o.buffer.length-O.buffer.length)>0)n.splice(l--,1);else{n.splice(a--,1);continue e}}}n.length>12&&(n.sort((a,o)=>o.score-a.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let a=1;a-1&&n.length&&(!s||(n.prop(K.contextHash)||0)==a))return e.useNode(n,o,r),n;if(n.children.length==0||n.positions[0]>0)break;let l=n.children[0];if(l instanceof M&&(!i||l.type.id>=this.parser.minRepeatTerm))n=l;else break}return null}advanceStack(e,r,n){let i=e.pos,{parser:s}=this,a=B?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let O=e.reducePos0)return e.reduce(o),B&&console.log(a+this.stackID(e)+` (via always-reduce ${s.getName(o&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let O=0;Oi?r.push(d):n.push(d)}return!1}advanceFully(e,r){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return Pa(e,r),!0}}runRecovery(e,r,n){let i=null,s=!1;for(let a=0;a ":"";if(o.deadEnd&&(s||(s=!0,o.restart(),B&&console.log(c+this.stackID(o)+" (restarted)"),this.advanceFully(o,n))))continue;let h=o.split(),p=c;for(let u=0;u<10&&h.forceReduce()&&(B&&console.log(p+this.stackID(h)+" (via force-reduce)"),!this.advanceFully(h,n));u++)B&&(p=this.stackID(h)+" -> ");for(let u of o.recoverByInsert(l))B&&console.log(c+this.stackID(u)+" (via recover-insert)"),this.advanceFully(u,n);this.stream.end>o.pos?(O==o.pos&&(O++,l=0),o.recoverByDelete(l,O),B&&console.log(c+this.stackID(o)+` (via recover-delete ${this.parser.getName(l)})`),Pa(o,n)):(!i||i.scoret,tt=class{constructor(e){this.start=e.start,this.shift=e.shift||yn,this.reduce=e.reduce||yn,this.reuse=e.reuse||yn,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}},Pe=class t extends Mt{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let r=e.nodeNames.split(" ");this.minRepeatTerm=r.length;for(let o=0;oe.topRules[o][1]),i=[];for(let o=0;o=0)s(c,l,o[O++]);else{let h=o[O+-c];for(let p=-c;p>0;p--)s(o[O++],l,h);O++}}}this.nodeSet=new pt(r.map((o,l)=>Re.define({name:l>=this.minRepeatTerm?void 0:o,id:l,props:i[l],top:n.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=1024;let a=Pt(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let o=0;otypeof o=="number"?new Se(a,o):o),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,r,n){let i=new _n(this,e,r,n);for(let s of this.wrappers)i=s(i,e,r,n);return i}getGoto(e,r,n=!1){let i=this.goto;if(r>=i[0])return-1;for(let s=i[r+1];;){let a=i[s++],o=a&1,l=i[s++];if(o&&n)return l;for(let O=s+(a>>1);s0}validAction(e,r){return!!this.allActions(e,n=>n==r?!0:null)}allActions(e,r){let n=this.stateSlot(e,4),i=n?r(n):void 0;for(let s=this.stateSlot(e,1);i==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=pe(this.data,s+2);else break;i=r(pe(this.data,s+1))}return i}nextStates(e){let r=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=pe(this.data,n+2);else break;if((this.data[n+2]&1)==0){let i=this.data[n+1];r.some((s,a)=>a&1&&s==i)||r.push(this.data[n],i)}}return r}configure(e){let r=Object.assign(Object.create(t.prototype),this);if(e.props&&(r.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);r.top=n}return e.tokenizers&&(r.tokenizers=this.tokenizers.map(n=>{let i=e.tokenizers.find(s=>s.from==n);return i?i.to:n})),e.specializers&&(r.specializers=this.specializers.slice(),r.specializerSpecs=this.specializerSpecs.map((n,i)=>{let s=e.specializers.find(o=>o.from==n.external);if(!s)return n;let a=Object.assign(Object.assign({},n),{external:s.to});return r.specializers[i]=xa(a),a})),e.contextTracker&&(r.context=e.contextTracker),e.dialect&&(r.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(r.strict=e.strict),e.wrap&&(r.wrappers=r.wrappers.concat(e.wrap)),e.bufferLength!=null&&(r.bufferLength=e.bufferLength),r}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let r=this.dynamicPrecedences;return r==null?0:r[e]||0}parseDialect(e){let r=Object.keys(this.dialects),n=r.map(()=>!1);if(e)for(let s of e.split(" ")){let a=r.indexOf(s);a>=0&&(n[a]=!0)}let i=null;for(let s=0;sn)&&r.p.parser.stateFlag(r.state,2)&&(!e||e.scoret.external(r,n)<<1|e}return t.get}var BO=55,NO=1,FO=56,HO=2,KO=57,JO=3,ya=4,ec=5,Ln=6,Ca=7,Ya=8,za=9,qa=10,tc=11,rc=12,nc=13,Yn=58,ic=14,sc=15,Za=59,Aa=21,ac=23,La=24,oc=25,qn=27,Ea=28,lc=29,Oc=32,cc=35,hc=37,uc=38,pc=0,fc=1,dc={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},mc={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},Xa={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function gc(t){return t==45||t==46||t==58||t>=65&&t<=90||t==95||t>=97&&t<=122||t>=161}var va=null,Ta=null,Ra=0;function An(t,e){let r=t.pos+e;if(Ra==r&&Ta==t)return va;let n=t.peek(e),i="";for(;gc(n);)i+=String.fromCharCode(n),n=t.peek(++e);return Ta=t,Ra=r,va=i?i.toLowerCase():n==Qc||n==$c?void 0:null}var Wa=60,or=62,En=47,Qc=63,$c=33,bc=45;function ja(t,e){this.name=t,this.parent=e}var Sc=[Ln,qa,Ca,Ya,za],kc=new tt({start:null,shift(t,e,r,n){return Sc.indexOf(e)>-1?new ja(An(n,1)||"",t):t},reduce(t,e){return e==Aa&&t?t.parent:t},reuse(t,e,r,n){let i=e.type.id;return i==Ln||i==hc?new ja(An(n,1)||"",t):t},strict:!1}),Pc=new z((t,e)=>{if(t.next!=Wa){t.next<0&&e.context&&t.acceptToken(Yn);return}t.advance();let r=t.next==En;r&&t.advance();let n=An(t,0);if(n===void 0)return;if(!n)return t.acceptToken(r?sc:ic);let i=e.context?e.context.name:null;if(r){if(n==i)return t.acceptToken(tc);if(i&&mc[i])return t.acceptToken(Yn,-2);if(e.dialectEnabled(pc))return t.acceptToken(rc);for(let s=e.context;s;s=s.parent)if(s.name==n)return;t.acceptToken(nc)}else{if(n=="script")return t.acceptToken(Ca);if(n=="style")return t.acceptToken(Ya);if(n=="textarea")return t.acceptToken(za);if(dc.hasOwnProperty(n))return t.acceptToken(qa);i&&Xa[i]&&Xa[i][n]?t.acceptToken(Yn,-1):t.acceptToken(Ln)}},{contextual:!0}),xc=new z(t=>{for(let e=0,r=0;;r++){if(t.next<0){r&&t.acceptToken(Za);break}if(t.next==bc)e++;else if(t.next==or&&e>=2){r>=3&&t.acceptToken(Za,-2);break}else e=0;t.advance()}});function wc(t){for(;t;t=t.parent)if(t.name=="svg"||t.name=="math")return!0;return!1}var yc=new z((t,e)=>{if(t.next==En&&t.peek(1)==or){let r=e.dialectEnabled(fc)||wc(e.context);t.acceptToken(r?ec:ya,2)}else t.next==or&&t.acceptToken(ya,1)});function Wn(t,e,r){let n=2+t.length;return new z(i=>{for(let s=0,a=0,o=0;;o++){if(i.next<0){o&&i.acceptToken(e);break}if(s==0&&i.next==Wa||s==1&&i.next==En||s>=2&&sa?i.acceptToken(e,-a):i.acceptToken(r,-(a-2));break}else if((i.next==10||i.next==13)&&o){i.acceptToken(e,1);break}else s=a=0;i.advance()}})}var Zc=Wn("script",BO,NO),Xc=Wn("style",FO,HO),vc=Wn("textarea",KO,JO),Tc=Oe({"Text RawText IncompleteTag IncompleteCloseTag":f.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":f.angleBracket,TagName:f.tagName,"MismatchedCloseTag/TagName":[f.tagName,f.invalid],AttributeName:f.attributeName,"AttributeValue UnquotedAttributeValue":f.attributeValue,Is:f.definitionOperator,"EntityReference CharacterReference":f.character,Comment:f.blockComment,ProcessingInst:f.processingInstruction,DoctypeDecl:f.documentMeta}),Ma=Pe.deserialize({version:14,states:",xOVO!rOOO!ZQ#tO'#CrO!`Q#tO'#C{O!eQ#tO'#DOO!jQ#tO'#DRO!oQ#tO'#DTO!tOaO'#CqO#PObO'#CqO#[OdO'#CqO$kO!rO'#CqOOO`'#Cq'#CqO$rO$fO'#DUO$zQ#tO'#DWO%PQ#tO'#DXOOO`'#Dl'#DlOO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^Oa^Ob^Oc^Od^Oy^O!eZO~O![rO~P#gO!]sO!fuO~OgvO~OgwO~OS|OT}OiyO~OS!POT}OiyO~OS!ROT}OiyO~OS!TOT}OiyO~OS}OT}OiyO~O!XfOPmX![mX~OP!WO![!XO~O!YiOQpX![pX~OQ!ZO![!XO~O!ZlORsX![sX~OR!]O![!XO~O![!XO~P#gOg!_O~O!]sO!f!aO~OS!bO~OS!cO~Oj!dOShXThXihX~OS!fOT!gOiyO~OS!hOT!gOiyO~OS!iOT!gOiyO~OS!jOT!gOiyO~OS!gOT!gOiyO~Og!kO~Og!lO~Og!mO~OS!nO~Ol!qO!a!oO!c!pO~OS!rO~OS!sO~OS!tO~Ob!uOc!uOd!uO!a!wO!b!uO~Ob!xOc!xOd!xO!c!wO!d!xO~Ob!uOc!uOd!uO!a!{O!b!uO~Ob!xOc!xOd!xO!c!{O!d!xO~OT~cbd!ey|!e~",goto:"%q!aPPPPPPPPPPPPPPPPPPPPP!b!hP!nPP!zP!}#Q#T#Z#^#a#g#j#m#s#y!bP!b!bP$P$V$m$s$y%P%V%]%cPPPPPPPP%iX^OX`pXUOX`pezabcde{!O!Q!S!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"\u26A0 StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:68,context:kc,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,22,31,34,37,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,30,33,36,38,"OpenTag"],["group",-10,14,15,18,19,20,21,40,41,42,43,"Entity",17,"Entity TextContent",-3,29,32,35,"TextContent Entity"],["isolate",-11,22,30,31,33,34,36,37,38,39,42,43,"ltr",-3,27,28,40,""]],propSources:[Tc],skippedNodes:[0],repeatNodeCount:9,tokenData:"!]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zblWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOb!R!R7tP;=`<%l7S!Z8OYlWb!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{iiSlWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!_:sbiSlWb!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VP<%l?Ah;{?Ah?BY7S?BY?Mn;{?MnO7S!V=dXiSb!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!V>S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to)return{parser:d.parser,overlay:[{from:h.to,to:g}]}}}}if(a&&O==La){let c=o.node,h;if(h=c.firstChild){let p=a[l.read(h.from,h.to)];if(p)for(let u of p){if(u.tagName&&u.tagName!=_a(c.parent,l))continue;let d=c.lastChild;if(d.type.id==qn){let m=d.from+1,g=d.lastChild,b=d.to-(g&&g.isError?0:1);if(b>m)return{parser:u.parser,overlay:[{from:m,to:b}],bracketed:!0}}else if(d.type.id==Ea)return{parser:u.parser,overlay:[{from:d.from,to:d.to}]}}}}return null})}var Rc=148,Va=1,jc=149,_c=150,Da=2,Cc=151,Yc=3,zc=4,qc=152,Ba=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],Ac=58,Lc=40,Na=95,Ec=91,lr=45,Wc=46,Mc=35,Uc=37,Vc=38,Gc=92,Ic=10,Dc=42;function xt(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}function Un(t){return t>=48&&t<=57}function Ga(t){return Un(t)||t>=97&&t<=102||t>=65&&t<=70}var Fa=(t,e,r)=>(n,i)=>{for(let s=!1,a=0,o=0;;o++){let{next:l}=n;if(xt(l)||l==lr||l==Na||s&&Un(l))!s&&(l!=lr||o>0)&&(s=!0),a===o&&l==lr&&a++,n.advance();else if(l==Gc&&n.peek(1)!=Ic){if(n.advance(),Ga(n.next)){do n.advance();while(Ga(n.next));n.next==32&&n.advance()}else n.next>-1&&n.advance();s=!0}else{s&&n.acceptToken(a>=2&&i.canShift(Da)?e:l==Lc?r:t);break}}},Bc=new z(Fa(jc,Da,_c),{contextual:!0}),Nc=new z(Fa(Cc,Yc,zc),{contextual:!0}),Fc=new z(t=>{if(Ba.includes(t.peek(-1))){let{next:e}=t;(xt(e)||e==Na||e==Mc||e==Wc||e==Dc||e==Ec||e==Ac&&xt(t.peek(1))||e==lr||e==Vc)&&t.acceptToken(Rc)}}),Hc=new z(t=>{if(!Ba.includes(t.peek(-1))){let{next:e}=t;if(e==Uc&&(t.advance(),t.acceptToken(Va)),xt(e)){do t.advance();while(xt(t.next)||Un(t.next));t.acceptToken(Va)}}});function Ia(t){let e=t.length;return(e==4||e==5||e==7||e==9)&&/^#[a-f\d]+$/i.test(t)?qc:-1}var Kc=Oe({"AtKeyword import charset namespace keyframes media supports font-feature-values":f.definitionKeyword,"from to selector scope MatchFlag":f.keyword,NamespaceName:f.namespace,KeyframeName:f.labelName,KeyframeRangeName:f.operatorKeyword,TagName:f.tagName,ClassName:f.className,PseudoClassName:f.constant(f.className),IdName:f.labelName,"FeatureName PropertyName":f.propertyName,AttributeName:f.attributeName,NumberLiteral:f.number,KeywordQuery:f.keyword,UnaryQueryOp:f.operatorKeyword,"CallTag ValueName FontName":f.atom,VariableName:f.variableName,Callee:f.operatorKeyword,Unit:f.unit,"UniversalSelector NestingSelector":f.definitionOperator,"MatchOp CompareOp":f.compareOperator,"ChildOp SiblingOp, LogicOp":f.logicOperator,BinOp:f.arithmeticOperator,Important:f.modifier,Comment:f.blockComment,ColorLiteral:f.color,"ParenthesizedContent StringLiteral":f.string,":":f.punctuation,PseudoOp:f.derefOperator,"; , |":f.separator,"( )":f.paren,"[ ]":f.squareBracket,"{ }":f.brace}),Jc={__proto__:null,lang:44,"nth-child":44,"nth-last-child":44,"nth-of-type":44,"nth-last-of-type":44,dir:44,"host-context":44,if:88,url:158,"url-prefix":158,domain:158,regexp:158},eh={__proto__:null,or:102,and:102,not:112,only:112,layer:212},th={__proto__:null,selector:118,style:124,layer:208},rh={__proto__:null,"@import":204,"@media":216,"@charset":220,"@namespace":224,"@keyframes":230,"@supports":242,"@scope":246,"@font-feature-values":252},nh={__proto__:null,to:249},Ha=Pe.deserialize({version:14,states:"MrQYQdOOO$TQdOOP$[O`OOO%XQaO'#CfOOQP'#Ce'#CeO%`QdO'#CgO%eQ`O'#CgO%jQaO'#FrO&eQdO'#CkO'XQaO'#CcO'cQdO'#CnOOQP'#ES'#ESOOQP'#ER'#ERO'nQdO'#ETO'yQdO'#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oy%jz#b%j#b#cFY#c;'S%j;'S;=`%{<%lO%jbF_U!r`Oy%jz#h%j#h#iFq#i;'S%j;'S;=`%{<%lO%jbFxS$tQ!r`Oy%jz;'S%j;'S;=`%{<%lO%jjGZSrYOy%jz;'S%j;'S;=`%{<%lO%jfGlU$gUOy%jz!_%j!_!`0^!`;'S%j;'S;=`%{<%lO%jjHTSqYOy%jz;'S%j;'S;=`%{<%lO%jfHfU#SQOy%jz!_%j!_!`0^!`;'S%j;'S;=`%{<%lO%j`H{P;=`<%l%Z",tokenizers:[Fc,Hc,Bc,Nc,1,2,3,4,new ke("m~RRYZ[z{a~~g~aO$c~~dP!P!Qg~lO$d~~",28,156)],topRules:{StyleSheet:[0,6],Styles:[1,129]},dynamicPrecedences:{97:1},specialized:[{term:172,get:(t,e)=>Ia(t)<<1,external:Ia},{term:150,get:t=>Jc[t]||-1},{term:151,get:t=>eh[t]||-1},{term:4,get:t=>th[t]||-1},{term:28,get:t=>rh[t]||-1},{term:149,get:t=>nh[t]||-1}],tokenPrec:2433});var Vn=null;function Gn(){if(!Vn&&typeof document=="object"&&document.body){let{style:t}=document.body,e=[],r=new Set;for(let n in t)n!="cssText"&&n!="cssFloat"&&typeof t[n]=="string"&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,i=>"-"+i.toLowerCase())),r.has(n)||(e.push(n),r.add(n)));Vn=e.sort().map(n=>({type:"property",label:n,apply:n+": "}))}return Vn||[]}var Ka=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(t=>({type:"class",label:t})),Ja=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(t=>({type:"keyword",label:t})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(t=>({type:"constant",label:t}))),ih=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(t=>({type:"type",label:t})),sh=["@charset","@color-profile","@container","@counter-style","@font-face","@font-feature-values","@font-palette-values","@import","@keyframes","@layer","@media","@namespace","@page","@position-try","@property","@scope","@starting-style","@supports","@view-transition"].map(t=>({type:"keyword",label:t})),fe=/^(\w[\w-]*|-\w[\w-]*|)$/,ah=/^-(-[\w-]*)?$/;function oh(t,e){var r;if((t.name=="("||t.type.isError)&&(t=t.parent||t),t.name!="ArgList")return!1;let n=(r=t.parent)===null||r===void 0?void 0:r.firstChild;return n?.name!="Callee"?!1:e.sliceString(n.from,n.to)=="var"}var eo=new Wt,lh=["Declaration"];function Oh(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function to(t,e,r){if(e.to-e.from>4096){let n=eo.get(e);if(n)return n;let i=[],s=new Set,a=e.cursor(le.IncludeAnonymous);if(a.firstChild())do for(let o of to(t,a.node,r))s.has(o.label)||(s.add(o.label),i.push(o));while(a.nextSibling());return eo.set(e,i),i}else{let n=[],i=new Set;return e.cursor().iterate(s=>{var a;if(r(s)&&s.matchContext(lh)&&((a=s.node.nextSibling)===null||a===void 0?void 0:a.name)==":"){let o=t.sliceString(s.from,s.to);i.has(o)||(i.add(o),n.push({label:o,type:"variable"}))}}),n}}var ch=t=>e=>{let{state:r,pos:n}=e,i=R(r).resolveInner(n,-1),s=i.type.isError&&i.from==i.to-1&&r.doc.sliceString(i.from,i.to)=="-";if(i.name=="PropertyName"||(s||i.name=="TagName")&&/^(Block|Styles)$/.test(i.resolve(i.to).name))return{from:i.from,options:Gn(),validFor:fe};if(i.name=="ValueName")return{from:i.from,options:Ja,validFor:fe};if(i.name=="PseudoClassName")return{from:i.from,options:Ka,validFor:fe};if(t(i)||(e.explicit||s)&&oh(i,r.doc))return{from:t(i)||s?i.from:n,options:to(r.doc,Oh(i),t),validFor:ah};if(i.name=="TagName"){for(let{parent:l}=i;l;l=l.parent)if(l.name=="Block")return{from:i.from,options:Gn(),validFor:fe};return{from:i.from,options:ih,validFor:fe}}if(i.name=="AtKeyword")return{from:i.from,options:sh,validFor:fe};if(!e.explicit)return null;let a=i.resolve(n),o=a.childBefore(n);return o&&o.name==":"&&a.name=="PseudoClassSelector"?{from:n,options:Ka,validFor:fe}:o&&o.name==":"&&a.name=="Declaration"||a.name=="ArgList"?{from:n,options:Ja,validFor:fe}:a.name=="Block"||a.name=="Styles"?{from:n,options:Gn(),validFor:fe}:null},hh=ch(t=>t.name=="VariableName"),wt=Ne.define({name:"css",parser:Ha.configure({props:[$e.add({Declaration:Fe()}),he.add({"Block KeyframeList":It})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function ro(){return new ce(wt,wt.data.of({autocomplete:hh}))}var uh=317,ph=318,no=1,fh=2,dh=3,mh=4,gh=319,Qh=321,$h=322,bh=5,Sh=6,kh=0,Dn=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],io=125,Ph=59,Bn=47,xh=42,wh=43,yh=45,Zh=60,Xh=44,vh=63,Th=46,Rh=91,jh=new tt({start:!1,shift(t,e){return e==bh||e==Sh||e==Qh?t:e==$h},strict:!1}),_h=new z((t,e)=>{let{next:r}=t;(r==io||r==-1||e.context)&&t.acceptToken(gh)},{contextual:!0,fallback:!0}),Ch=new z((t,e)=>{let{next:r}=t,n;Dn.indexOf(r)>-1||r==Bn&&((n=t.peek(1))==Bn||n==xh)||r!=io&&r!=Ph&&r!=-1&&!e.context&&t.acceptToken(uh)},{contextual:!0}),Yh=new z((t,e)=>{t.next==Rh&&!e.context&&t.acceptToken(ph)},{contextual:!0}),zh=new z((t,e)=>{let{next:r}=t;if(r==wh||r==yh){if(t.advance(),r==t.next){t.advance();let n=!e.context&&e.canShift(no);t.acceptToken(n?no:fh)}}else r==vh&&t.peek(1)==Th&&(t.advance(),t.advance(),(t.next<48||t.next>57)&&t.acceptToken(dh))},{contextual:!0});function In(t,e){return t>=65&&t<=90||t>=97&&t<=122||t==95||t>=192||!e&&t>=48&&t<=57}var qh=new z((t,e)=>{if(t.next!=Zh||!e.dialectEnabled(kh)||(t.advance(),t.next==Bn))return;let r=0;for(;Dn.indexOf(t.next)>-1;)t.advance(),r++;if(In(t.next,!0)){for(t.advance(),r++;In(t.next,!1);)t.advance(),r++;for(;Dn.indexOf(t.next)>-1;)t.advance(),r++;if(t.next==Xh)return;for(let n=0;;n++){if(n==7){if(!In(t.next,!0))return;break}if(t.next!="extends".charCodeAt(n))break;t.advance(),r++}}t.acceptToken(mh,-r)}),Ah=Oe({"get set async static":f.modifier,"for while do if else switch try catch finally return throw break continue default case defer":f.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":f.operatorKeyword,"let var const using function class extends":f.definitionKeyword,"import export from":f.moduleKeyword,"with debugger new":f.keyword,TemplateString:f.special(f.string),super:f.atom,BooleanLiteral:f.bool,this:f.self,null:f.null,Star:f.modifier,VariableName:f.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":f.function(f.variableName),VariableDefinition:f.definition(f.variableName),Label:f.labelName,PropertyName:f.propertyName,PrivatePropertyName:f.special(f.propertyName),"CallExpression/MemberExpression/PropertyName":f.function(f.propertyName),"FunctionDeclaration/VariableDefinition":f.function(f.definition(f.variableName)),"ClassDeclaration/VariableDefinition":f.definition(f.className),"NewExpression/VariableName":f.className,PropertyDefinition:f.definition(f.propertyName),PrivatePropertyDefinition:f.definition(f.special(f.propertyName)),UpdateOp:f.updateOperator,"LineComment Hashbang":f.lineComment,BlockComment:f.blockComment,Number:f.number,String:f.string,Escape:f.escape,ArithOp:f.arithmeticOperator,LogicOp:f.logicOperator,BitOp:f.bitwiseOperator,CompareOp:f.compareOperator,RegExp:f.regexp,Equals:f.definitionOperator,Arrow:f.function(f.punctuation),": Spread":f.punctuation,"( )":f.paren,"[ ]":f.squareBracket,"{ }":f.brace,"InterpolationStart InterpolationEnd":f.special(f.brace),".":f.derefOperator,", ;":f.separator,"@":f.meta,TypeName:f.typeName,TypeDefinition:f.definition(f.typeName),"type enum interface implements namespace module declare":f.definitionKeyword,"abstract global Privacy readonly override":f.modifier,"is keyof unique infer asserts":f.operatorKeyword,JSXAttributeValue:f.attributeValue,JSXText:f.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":f.angleBracket,"JSXIdentifier JSXNameSpacedName":f.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":f.attributeName,"JSXBuiltin/JSXIdentifier":f.standard(f.tagName)}),Lh={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:237,private:237,protected:237,readonly:239,instanceof:258,satisfies:261,import:294,keyof:351,unique:355,infer:361,asserts:397,is:399,abstract:419,implements:421,type:423,let:426,var:428,using:431,interface:437,enum:441,namespace:447,module:449,declare:453,global:457,defer:473,for:478,of:487,while:490,with:494,do:498,if:502,else:504,switch:508,case:514,try:520,catch:524,finally:528,return:532,throw:536,break:540,continue:544,debugger:548},Eh={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:403},Wh={__proto__:null,"<":193},so=Pe.deserialize({version:14,states:"$GSQ%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Im'#ImO1XQ`O'#GtO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JsO6[Q!0MxO'#JtO6uQ`O'#F^O6zQ,UO'#FuOOQ!0Lf'#Fg'#FgO7VO7dO'#FgO9XQMhO'#F}O9`Q`O'#F|OOQ!0Lf'#Jt'#JtOOQ!0Lb'#Js'#JsO9eQ`O'#GxOOQ['#K`'#K`O9pQ`O'#IZO9uQ!0LrO'#I[OOQ['#Ja'#JaOOQ['#I`'#I`Q`QlOOQ`QlOOO9}Q!L^O'#DvO:UQlO'#EOO:]QlO'#EQO9kQ`O'#GtO:dQMhO'#CoO:rQ`O'#EnO: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e,RS2Q,k,nQ2i-QQ2j-TQ2k-UQ3P-qW3R-t-u-x-zQ5c1SQ5o1aQ5s1gQ6X1wQ6c2SQ6m2]U6|3Q3T3WQ7P3UQ8_5dQ8g5qQ8i5tQ8n5|Q8w6YQ8}6bS9^6}7RQ9`7QQ:Y8eQ:d8xQ:i9OQ:p9_Q;W:ZQ;_:eQ;c:qQ;n;XR;q;`Q%zyQ'e!iQ'p!uU+o%{%|%}Q-X'VU-m'f'g'hS-q'l'vQ0S*kS1S+p+qQ2p-ZS2}-n-oQ3U-vS4r0T0WQ5d1TQ6x2wQ6{3OQ7Q3VU7}4t4u4xQ9|8PR;Q9}S$wi>QR*|%VU%Ui%V>QR0h*zQ$viS(v#v+kS)d$b$cQ)f$dQ*]$xS*f${*ZQ*u%OQ*v%QQ+R%^Q+S%_Q+W%cQ.nQQ>O>YQ>P>ZQ>[>^R>]>_Q+P%]Q.pTR#[WR'Z!el!tQ!r!v!y!z'a'm'n'o-g-w1q5}6PS'V!e-^U*k$|*[*pS-Z'W'`S0W*l*rQ0`*sQ2w-eQ4x0^R4}0aR(|#xQ!fQT-f'a-g]!qQ!r'a-g1q5}Q#p]R'j < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty VariableDefinition Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:381,context:jh,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,208,212,216,217,219,222,225,235,238,244,246,248,250,253,259,265,267,269,271,273,275,276,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,121,122,137,140,142,143,144,145,146,148,149,168,170,172,"Expression",-23,31,33,37,41,43,45,174,176,178,179,181,182,183,185,186,187,189,190,191,202,204,206,207,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",161,"JSXStartCloseTag"],["closedBy",-2,24,169,">",40,"InterpolationEnd",50,"]",61,"}",74,")",166,"JSXEndTag"]],propSources:[Ah],skippedNodes:[0,5,6,279],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$x#r#s$@U#s$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$I|Er$I|$I}$Dk$I}$JO$Dk$JO$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr(n%d_$j&j(Xp([!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$j&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$j&j([!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU([!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$j&j(XpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU(XpOY)rZr)rs#O)r#P;'S)r;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&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr07[$D|k$j&j(Xp([!b(O0/l$^#t(U,2j(f$I[OY%ZYZ&cZr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$g%Z$g;'SEr;'S;=`I|<%lOEr",tokenizers:[Ch,Yh,zh,qh,2,3,4,5,6,7,8,9,10,11,12,13,14,_h,new ke("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOx~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!U~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(d~~",141,341),new ke("j~RQYZXz{^~^O(R~~aP!P!Qd~iO(S~~",25,324)],topRules:{Script:[0,7],SingleExpression:[1,277],SingleClassItem:[2,278]},dialects:{jsx:0,ts:15179},dynamicPrecedences:{80:1,82:1,94:1,170:1,200:1},specialized:[{term:328,get:t=>Lh[t]||-1},{term:344,get:t=>Eh[t]||-1},{term:95,get:t=>Wh[t]||-1}],tokenPrec:15205});var Oo=[L("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),L("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),L("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),L("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),L("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),L(`try { \${} } catch (\${error}) { \${} @@ -15,84 +15,84 @@ import{$ as R,A as Xe,B as X,C as ve,D as Ni,E as Fi,F as Hi,G as jr,H as _r,I a constructor(\${params}) { \${} } -}`,{label:"class",detail:"definition",type:"keyword"}),L('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),L('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Ah=ao.concat([L("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),L("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),L("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),no=new Lt,oo=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function xt(r){return(e,t)=>{let n=e.node.getChild("VariableDefinition");return n&&t(n,r),!0}}var Lh=["FunctionDeclaration"],Eh={FunctionDeclaration:xt("function"),ClassDeclaration:xt("class"),ClassExpression:()=>!0,EnumDeclaration:xt("constant"),TypeAliasDeclaration:xt("type"),NamespaceDeclaration:xt("namespace"),VariableDefinition(r,e){r.matchContext(Lh)||e(r,"variable")},TypeDefinition(r,e){e(r,"type")},__proto__:null};function lo(r,e){let t=no.get(e);if(t)return t;let n=[],i=!0;function s(a,o){let l=r.sliceString(a.from,a.to);n.push({label:l,type:o})}return e.cursor(le.IncludeAnonymous).iterate(a=>{if(i)i=!1;else if(a.name){let o=Eh[a.name];if(o&&o(a,s)||oo.has(a.name))return!1}else if(a.to-a.from>8192){for(let o of lo(r,a.node))n.push(o);return!1}}),no.set(e,n),n}var io=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Oo=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function Wh(r){let e=R(r.state).resolveInner(r.pos,-1);if(Oo.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&io.test(r.state.sliceDoc(e.from,e.to));if(!t&&!r.explicit)return null;let n=[];for(let i=e;i;i=i.parent)oo.has(i.name)&&(n=n.concat(lo(r.state.doc,i)));return{options:n,from:t?e.from:r.pos,validFor:io}}var te=De.define({name:"javascript",parser:ro.configure({props:[$e.add({IfStatement:Be({except:/^\s*({|else\b)/}),TryStatement:Be({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:as,SwitchBody:r=>{let e=r.textAfter,t=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return r.baseIndent+(t?0:n?1:2)*r.unit},Block:ss({closing:"}"}),ArrowFunction:r=>r.baseIndent+r.unit,"TemplateString BlockComment":()=>null,"Statement Property":Be({except:/^\s*{/}),JSXElement(r){let e=/^\s*<\//.test(r.textAfter);return r.lineIndent(r.node.from)+(e?0:r.unit)},JSXEscape(r){let e=/\s*\}/.test(r.textAfter);return r.lineIndent(r.node.from)+(e?0:r.unit)},"JSXOpenTag JSXSelfClosingTag"(r){return r.column(r.node.from)+r.unit}}),he.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Vt,BlockComment(r){return{from:r.from+2,to:r.to-2}},JSXElement(r){let e=r.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let t=r.lastChild;return{from:e.to,to:t.type.isError?r.to:t.from}},"JSXSelfClosingTag JSXOpenTag"(r){var e;let t=(e=r.firstChild)===null||e===void 0?void 0:e.nextSibling,n=r.lastChild;return!t||t.type.isError?null:{from:t.to,to:n.type.isError?r.to:n.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),co={test:r=>/^JSX/.test(r.name),facet:Mt({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Gn=te.configure({dialect:"ts"},"typescript"),In=te.configure({dialect:"jsx",props:[Yr.add(r=>r.isTop?[co]:void 0)]}),Dn=te.configure({dialect:"jsx ts",props:[Yr.add(r=>r.isTop?[co]:void 0)]},"typescript"),ho=r=>({label:r,type:"keyword"}),uo="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(ho),Mh=uo.concat(["declare","implements","private","protected","public"].map(ho));function po(r={}){let e=r.jsx?r.typescript?Dn:In:r.typescript?Gn:te,t=r.typescript?Ah.concat(Mh):ao.concat(uo);return new ce(e,[te.data.of({autocomplete:Ps(Oo,Br(t))}),te.data.of({autocomplete:Wh}),r.jsx?Gh:[]])}function Uh(r){for(;;){if(r.name=="JSXOpenTag"||r.name=="JSXSelfClosingTag"||r.name=="JSXFragmentTag")return r;if(r.name=="JSXEscape"||!r.parent)return null;r=r.parent}}function so(r,e,t=r.length){for(let n=e?.firstChild;n;n=n.nextSibling)if(n.name=="JSXIdentifier"||n.name=="JSXBuiltin"||n.name=="JSXNamespacedName"||n.name=="JSXMemberExpression")return r.sliceString(n.from,Math.min(n.to,t));return""}var Vh=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Gh=X.inputHandler.of((r,e,t,n,i)=>{if((Vh?r.composing:r.compositionStarted)||r.state.readOnly||e!=t||n!=">"&&n!="/"||!te.isActiveAt(r.state,e,-1))return!1;let s=i(),{state:a}=s,o=a.changeByRange(l=>{var O;let{head:c}=l,h=R(a).resolveInner(c-1,-1),p;if(h.name=="JSXStartTag"&&(h=h.parent),!(a.doc.sliceString(c-1,c)!=n||h.name=="JSXAttributeValue"&&h.to>c)){if(n==">"&&h.name=="JSXFragmentTag")return{range:l,changes:{from:c,insert:""}};if(n=="/"&&h.name=="JSXStartCloseTag"){let u=h.parent,d=u.parent;if(d&&u.from==c-2&&((p=so(a.doc,d.firstChild,c))||((O=d.firstChild)===null||O===void 0?void 0:O.name)=="JSXFragmentTag")){let m=`${p}>`;return{range:Z.cursor(c+m.length,-1),changes:{from:c,insert:m}}}}else if(n==">"){let u=Uh(h);if(u&&u.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(a.doc.sliceString(c,c+2))&&(p=so(a.doc,u,c)))return{range:l,changes:{from:c,insert:``}}}}return{range:l}});return o.changes.empty?!1:(r.dispatch([s,a.update(o,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});var wt=["_blank","_self","_top","_parent"],Bn=["ascii","utf-8","utf-16","latin1","latin1"],Nn=["get","post","put","delete"],Fn=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],N=["true","false"],S={},Ih={a:{attrs:{href:null,ping:null,type:null,media:null,target:wt,hreflang:null}},abbr:S,address:S,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:S,aside:S,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:S,base:{attrs:{href:null,target:wt}},bdi:S,bdo:S,blockquote:{attrs:{cite:null}},body:S,br:S,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:Fn,formmethod:Nn,formnovalidate:["novalidate"],formtarget:wt,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:S,center:S,cite:S,code:S,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:S,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:S,div:S,dl:S,dt:S,em:S,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:S,figure:S,footer:S,form:{attrs:{action:null,name:null,"accept-charset":Bn,autocomplete:["on","off"],enctype:Fn,method:Nn,novalidate:["novalidate"],target:wt}},h1:S,h2:S,h3:S,h4:S,h5:S,h6:S,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:S,hgroup:S,hr:S,html:{attrs:{manifest:null}},i:S,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:Fn,formmethod:Nn,formnovalidate:["novalidate"],formtarget:wt,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:S,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:S,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:S,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Bn,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:S,noscript:S,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:S,param:{attrs:{name:null,value:null}},pre:S,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:S,rt:S,ruby:S,samp:S,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Bn}},section:S,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:S,source:{attrs:{src:null,type:null,media:null}},span:S,strong:S,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:S,summary:S,sup:S,table:S,tbody:S,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:S,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:S,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:S,time:{attrs:{datetime:null}},title:S,tr:S,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:S,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:S},Qo={accesskey:null,class:null,contenteditable:N,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:N,autocorrect:N,autocapitalize:N,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":N,"aria-autocomplete":["inline","list","both","none"],"aria-busy":N,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":N,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":N,"aria-hidden":N,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":N,"aria-multiselectable":N,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":N,"aria-relevant":null,"aria-required":N,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},$o="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(r=>"on"+r);for(let r of $o)Qo[r]=null;var ze=class{constructor(e,t){this.tags={...Ih,...e},this.globalAttrs={...Qo,...t},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};ze.default=new ze;function qe(r,e,t=r.length){if(!e)return"";let n=e.firstChild,i=n&&n.getChild("TagName");return i?r.sliceString(i.from,Math.min(i.to,t)):""}function et(r,e=!1){for(;r;r=r.parent)if(r.name=="Element")if(e)e=!1;else return r;return null}function bo(r,e,t){let n=t.tags[qe(r,et(e))];return n?.children||t.allTags}function Hn(r,e){let t=[];for(let n=et(e);n&&!n.type.isTop;n=et(n.parent)){let i=qe(r,n);if(i&&n.lastChild.name=="CloseTag")break;i&&t.indexOf(i)<0&&(e.name=="EndTag"||e.from>=n.firstChild.to)&&t.push(i)}return t}var So=/^[:\-\.\w\u00b7-\uffff]*$/;function fo(r,e,t,n,i){let s=/\s*>/.test(r.sliceDoc(i,i+5))?"":">",a=et(t,t.name=="StartTag"||t.name=="TagName");return{from:n,to:i,options:bo(r.doc,a,e).map(o=>({label:o,type:"type"})).concat(Hn(r.doc,t).map((o,l)=>({label:"/"+o,apply:"/"+o+s,type:"type",boost:99-l}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function mo(r,e,t,n){let i=/\s*>/.test(r.sliceDoc(n,n+5))?"":">";return{from:t,to:n,options:Hn(r.doc,e).map((s,a)=>({label:s,apply:s+i,type:"type",boost:99-a})),validFor:So}}function Dh(r,e,t,n){let i=[],s=0;for(let a of bo(r.doc,t,e))i.push({label:"<"+a,type:"type"});for(let a of Hn(r.doc,t))i.push({label:"",type:"type",boost:99-s++});return{from:n,to:n,options:i,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function Bh(r,e,t,n,i){let s=et(t),a=s?e.tags[qe(r.doc,s)]:null,o=a&&a.attrs?Object.keys(a.attrs):[],l=a&&a.globalAttrs===!1?o:o.length?o.concat(e.globalAttrNames):e.globalAttrNames;return{from:n,to:i,options:l.map(O=>({label:O,type:"property"})),validFor:So}}function Nh(r,e,t,n,i){var s;let a=(s=t.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),o=[],l;if(a){let O=r.sliceDoc(a.from,a.to),c=e.globalAttrs[O];if(!c){let h=et(t),p=h?e.tags[qe(r.doc,h)]:null;c=p?.attrs&&p.attrs[O]}if(c){let h=r.sliceDoc(n,i).toLowerCase(),p='"',u='"';/^['"]/.test(h)?(l=h[0]=='"'?/^[^"]*$/:/^[^']*$/,p="",u=r.sliceDoc(i,i+1)==h[0]?"":h[0],h=h.slice(1),n++):l=/^[^\s<>='"]*$/;for(let d of c)o.push({label:d,apply:p+d+u,type:"constant"})}}return{from:n,to:i,options:o,validFor:l}}function ko(r,e){let{state:t,pos:n}=e,i=R(t).resolveInner(n,-1),s=i.resolve(n);for(let a=n,o;s==i&&(o=i.childBefore(a));){let l=o.lastChild;if(!l||!l.type.isError||l.fromko(n,i)}var Hh=te.parser.configure({top:"SingleExpression"}),xo=[{tag:"script",attrs:r=>r.type=="text/typescript"||r.lang=="ts",parser:Gn.parser},{tag:"script",attrs:r=>r.type=="text/babel"||r.type=="text/jsx",parser:In.parser},{tag:"script",attrs:r=>r.type=="text/typescript-jsx",parser:Dn.parser},{tag:"script",attrs(r){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(r.type)},parser:Hh},{tag:"script",attrs(r){return!r.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(r.type)},parser:te.parser},{tag:"style",attrs(r){return(!r.lang||r.lang=="css")&&(!r.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(r.type))},parser:Pt.parser}],wo=[{name:"style",parser:Pt.parser.configure({top:"Styles"})}].concat($o.map(r=>({name:r,parser:te.parser}))),yo=De.define({name:"html",parser:La.configure({props:[$e.add({Element(r){let e=/^(\s*)(<\/)?/.exec(r.textAfter);return r.node.to<=r.pos+e[0].length?r.continue():r.lineIndent(r.node.from)+(e[2]?0:r.unit)},"OpenTag CloseTag SelfClosingTag"(r){return r.column(r.node.from)+r.unit},Document(r){if(r.pos+/\s*/.exec(r.textAfter)[0].lengthr.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),or=yo.configure({wrap:An(xo,wo)});function Zo(r={}){let e="",t;r.matchClosingTags===!1&&(e="noMatch"),r.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(r.nestedLanguages&&r.nestedLanguages.length||r.nestedAttributes&&r.nestedAttributes.length)&&(t=An((r.nestedLanguages||[]).concat(xo),(r.nestedAttributes||[]).concat(wo)));let n=t?yo.configure({wrap:t,dialect:e}):e?or.configure({dialect:e}):or;return new ce(n,[or.data.of({autocomplete:Fh(r)}),r.autoCloseTags!==!1?Jh:[],po().support,Ja().support])}var go=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" "));function Kh(r,e,t){for(var n;;){if(((n=e.lastChild)===null||n===void 0?void 0:n.name)!="CloseTag")return!1;let i=e.parent;if(!i||qe(r,i)!=t)return!0;e=i}}var Jh=X.inputHandler.of((r,e,t,n,i)=>{if(r.composing||r.state.readOnly||e!=t||n!=">"&&n!="/"||!or.isActiveAt(r.state,e,-1))return!1;let s=i(),{state:a}=s,o=a.changeByRange(l=>{var O;let c=a.doc.sliceString(l.from-1,l.to)==n,{head:h}=l,p=R(a).resolveInner(h,-1),u;if(c&&n==">"&&p.name=="EndTag"){let d=p.parent;if((u=qe(a.doc,d.parent,h))&&!go.has(u)&&!Kh(a.doc,d.parent,u)){let m=h+(a.doc.sliceString(h,h+1)===">"?1:0),g=``;return{range:l,changes:{from:h,to:m,insert:g}}}}else if(c&&n=="/"&&p.name=="IncompleteCloseTag"){let d=p.parent;if(p.from==h-2&&((O=d.lastChild)===null||O===void 0?void 0:O.name)!="CloseTag"&&(u=qe(a.doc,d,h))&&!go.has(u)){let m=h+(a.doc.sliceString(h,h+1)===">"?1:0),g=`${u}>`;return{range:Z.cursor(h+g.length,-1),changes:{from:h,to:m,insert:g}}}}return{range:l}});return o.changes.empty?!1:(r.dispatch([s,a.update(o,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});var To=Mt({commentTokens:{block:{open:""}}}),Ro=new K,jo=Oa.configure({props:[he.add(r=>!r.is("Block")||r.is("Document")||ei(r)!=null||eu(r)?void 0:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})),Ro.add(ei),$e.add({Document:()=>null}),rs.add({Document:To})]});function ei(r){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(r.name);return e?+e[1]:void 0}function eu(r){return r.name=="OrderedList"||r.name=="BulletList"}function tu(r,e){let t=r;for(;;){let n=t.nextSibling,i;if(!n||(i=ei(n.type))!=null&&i<=e)break;t=n}return t.to}var ru=os.of((r,e,t)=>{for(let n=R(r).resolveInner(t,-1);n&&!(n.fromt)return{from:t,to:s}}return null});function ti(r){return new ns(To,r,[],"markdown")}var nu=ti(jo),iu=jo.configure([ua,da,fa,ma,{props:[he.add({Table:(r,e)=>({from:e.doc.lineAt(r.from).to,to:r.to})})]}]),tt=ti(iu);function su(r,e){return t=>{if(t&&r){let n=null;if(t=/\S*/.exec(t)[0],typeof r=="function"?n=r(t):n=Cr.matchLanguageName(r,t,!0),n instanceof Cr)return n.support?n.support.language.parser:is.getSkippingParser(n.load());if(n)return n.parser}return e?e.parser:null}}var yt=class{constructor(e,t,n,i,s,a,o){this.node=e,this.from=t,this.to=n,this.spaceBefore=i,this.spaceAfter=s,this.type=a,this.item=o}blank(e,t=!0){let n=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;n.length0;i--)n+=" ";return n+(t?this.spaceAfter:"")}}marker(e,t){let n=this.node.name=="OrderedList"?String(+Yo(this.item,e)[2]+t):"";return this.spaceBefore+n+this.type+this.spaceAfter}};function _o(r,e){let t=[],n=[];for(let i=r;i;i=i.parent){if(i.name=="FencedCode")return n;(i.name=="ListItem"||i.name=="Blockquote")&&t.push(i)}for(let i=t.length-1;i>=0;i--){let s=t[i],a,o=e.lineAt(s.from),l=s.from-o.from;if(s.name=="Blockquote"&&(a=/^ *>( ?)/.exec(o.text.slice(l))))n.push(new yt(s,l,l+a[0].length,"",a[1],">",null));else if(s.name=="ListItem"&&s.parent.name=="OrderedList"&&(a=/^( *)\d+([.)])( *)/.exec(o.text.slice(l)))){let O=a[3],c=a[0].length;O.length>=4&&(O=O.slice(0,O.length-4),c-=4),n.push(new yt(s.parent,l,l+c,a[1],O,a[2],s))}else if(s.name=="ListItem"&&s.parent.name=="BulletList"&&(a=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(o.text.slice(l)))){let O=a[4],c=a[0].length;O.length>4&&(O=O.slice(0,O.length-4),c-=4);let h=a[2];a[3]&&(h+=a[3].replace(/[xX]/," ")),n.push(new yt(s.parent,l,l+c,a[1],O,h,s))}}return n}function Yo(r,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(r.from,r.from+10))}function Kn(r,e,t,n=0){for(let i=-1,s=r;;){if(s.name=="ListItem"){let o=Yo(s,e),l=+o[2];if(i>=0){if(l!=i+1)return;t.push({from:s.from+o[1].length,to:s.from+o[0].length,insert:String(i+2+n)})}i=l}let a=s.nextSibling;if(!a)break;s=a}}function ri(r,e){let t=/^[ \t]*/.exec(r)[0].length;if(!t||e.facet(Ut)!=" ")return r;let n=Ie(r,4,t),i="";for(let s=n;s>0;)s>=4?(i+=" ",s-=4):(i+=" ",s--);return i+r.slice(t)}var au=(r={})=>({state:e,dispatch:t})=>{let n=R(e),{doc:i}=e,s=null,a=e.changeByRange(o=>{if(!o.empty||!tt.isActiveAt(e,o.from,-1)&&!tt.isActiveAt(e,o.from,1))return s={range:o};let l=o.from,O=i.lineAt(l),c=_o(n.resolveInner(l,-1),i);for(;c.length&&c[c.length-1].from>l-O.from;)c.pop();if(!c.length)return s={range:o};let h=c[c.length-1];if(h.to-h.spaceAfter.length>l-O.from)return s={range:o};let p=l>=h.to-h.spaceAfter.length&&!/\S/.test(O.text.slice(h.to));if(h.item&&p){if(h.item.from]*$/.test(O.text.slice(0,h.to)))return s={range:o};let b=h.node.firstChild,Q=h.node.getChild("ListItem","ListItem");if(b.to>=l||Q&&Q.to0&&!/[^\s>]/.test(i.lineAt(O.from-1).text)||r.nonTightLists===!1){let k=c.length>1?c[c.length-2]:null,y,w="";k&&k.item?(y=O.from+k.from,w=k.marker(i,1)):y=O.from+(k?k.to:0);let _=[{from:y,to:l,insert:w}];return h.node.name=="OrderedList"&&Kn(h.item,i,_,-2),k&&k.node.name=="OrderedList"&&Kn(k.item,i,_),{range:Z.cursor(y+w.length),changes:_}}else{let k=vo(c,e,O);return{range:Z.cursor(l+k.length+1),changes:{from:O.from,insert:k+e.lineBreak}}}}if(h.node.name=="Blockquote"&&p&&O.from){let b=i.lineAt(O.from-1),Q=/>\s*$/.exec(b.text);if(Q&&Q.index==h.from){let k=e.changes([{from:b.from+Q.index,to:b.to},{from:O.from+h.from,to:O.to}]);return{range:o.map(k),changes:k}}}let u=[];h.node.name=="OrderedList"&&Kn(h.item,i,u);let d=h.item&&h.item.from]*/.exec(O.text)[0].length>=h.to)for(let b=0,Q=c.length-1;b<=Q;b++)m+=b==Q&&!d?c[b].marker(i,1):c[b].blank(bO.from&&/\s/.test(O.text.charAt(g-O.from-1));)g--;return m=ri(m,e),lu(h.node,e.doc)&&(m=vo(c,e,O)+e.lineBreak+m),u.push({from:g,to:l,insert:e.lineBreak+m}),{range:Z.cursor(g+m.length+1),changes:u}});return s?!1:(t(e.update(a,{scrollIntoView:!0,userEvent:"input"})),!0)},ou=au();function Xo(r){return r.name=="QuoteMark"||r.name=="ListMark"}function lu(r,e){if(r.name!="OrderedList"&&r.name!="BulletList")return!1;let t=r.firstChild,n=r.getChild("ListItem","ListItem");if(!n)return!1;let i=e.lineAt(t.to),s=e.lineAt(n.from),a=/^[\s>]*$/.test(i.text);return i.number+(a?0:1){let t=R(r),n=null,i=r.changeByRange(s=>{let a=s.from,{doc:o}=r;if(s.empty&&tt.isActiveAt(r,s.from)){let l=o.lineAt(a),O=_o(Ou(t,a),o);if(O.length){let c=O[O.length-1],h=c.to-c.spaceAfter.length+(c.spaceAfter?1:0);if(a-l.from>h&&!/\S/.test(l.text.slice(h,a-l.from)))return{range:Z.cursor(l.from+h),changes:{from:l.from+h,to:a}};if(a-l.from==h&&(c.item&&l.from<=c.item.from||/^[\s>]*$/.test(l.text.slice(0,c.to)))){let p=l.from+c.from;if(c.item&&c.node.from{var t;let{main:n}=e.state.selection;if(n.empty)return!1;let i=(t=r.clipboardData)===null||t===void 0?void 0:t.getData("text/plain");if(!i||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(i)||(/^www\./.test(i)&&(i="https://"+i),!tt.isActiveAt(e.state,n.from,1)))return!1;let s=R(e.state),a=!1;return s.iterate({from:n.from,to:n.to,enter:o=>{(o.from>n.from||fu.test(o.name))&&(a=!0)},leave:o=>{o.tor.normalize("NFKD"):r=>r,we=class{constructor(e,t,n=0,i=e.length,s,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,i),this.bufferStart=n,this.normalize=s?o=>s(qo(o)):qo,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 W(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=Ot(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=J(e);let i=this.normalize(t);if(i.length)for(let s=0,a=n,o=!0;;s++){let l=i.charCodeAt(s),O=this.match(l,a,o,this.bufferPos+this.bufferStart,s==i.length-1);if(O)return this.value=O,this;if(s==i.length-1)break;o&&sthis.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,i=n+t[0].length;if(this.matchPos=pr(this.text,i+(n==i?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(nthis.value.to)&&(!this.test||this.test(n,i,t)))return this.value={from:n,to:i,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=n||i.to<=t){let o=new r(t,e.sliceString(t,n));return ni.set(e,o),o}if(i.from==t&&i.to==n)return i;let{text:s,from:a}=i;return a>t&&(s=e.sliceString(t,a)+s,a=t),i.to=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,i=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,i,t)))return this.value={from:n,to:i,precise:!0,match:t},this.matchPos=pr(this.text,i+(n==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=hr.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<"u"&&(cr.prototype[Symbol.iterator]=ur.prototype[Symbol.iterator]=function(){return this});function mu(r){try{return new RegExp(r,Oi),!0}catch{return!1}}function pr(r,e){if(e>=r.length)return e;let t=r.lineAt(e),n;for(;e=56320&&n<57344;)e++;return e}var gu=r=>{let e=es(r,"cm-goto-line");if(e){let a=e.dom.querySelector("input[type=text]");return a&&a.select(),!0}let{state:t}=r,n=String(t.doc.lineAt(r.state.selection.main.head).number),{close:i,result:s}=Ji(r,{class:"cm-goto-line",label:t.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:t.phrase("go")});return s.then(a=>{let o=a&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(a.elements.line.value);if(!o){r.dispatch({effects:i});return}let l=t.doc.lineAt(t.selection.main.head),[,O,c,h,p]=o,u=h?+h.slice(1):0,d=c?+c:l.number;if(c&&p){let b=d/100;O&&(b=b*(O=="-"?-1:1)+l.number/t.doc.lines),d=Math.round(t.doc.lines*b)}else c&&O&&(d=d*(O=="-"?-1:1)+l.number);let m=t.doc.line(Math.max(1,Math.min(t.doc.lines,d))),g=Z.cursor(m.from+Math.max(0,Math.min(u,m.length)));r.dispatch({effects:[i,X.scrollIntoView(g.from,{y:"center"})],selection:g})}),!0},Qu={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Wo=Ge.define({combine(r){return ct(r,Qu,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function Mo(r){let e=[Pu,ku];return r&&e.push(Wo.of(r)),e}var $u=v.mark({class:"cm-selectionMatch"}),bu=v.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Ao(r,e,t,n){return(t==0||r(e.sliceDoc(t-1,t))!=A.Word)&&(n==e.doc.length||r(e.sliceDoc(n,n+1))!=A.Word)}function Su(r,e,t,n){return r(e.sliceDoc(t,t+1))==A.Word&&r(e.sliceDoc(n-1,n))==A.Word}var ku=Xe.fromClass(class{constructor(r){this.decorations=this.getDeco(r)}update(r){(r.selectionSet||r.docChanged||r.viewportChanged)&&(this.decorations=this.getDeco(r.view))}getDeco(r){let e=r.state.facet(Wo),{state:t}=r,n=t.selection;if(n.ranges.length>1)return v.none;let i=n.main,s,a=null;if(i.empty){if(!e.highlightWordAroundCursor)return v.none;let l=t.wordAt(i.head);if(!l)return v.none;a=t.charCategorizer(i.head),s=t.sliceDoc(l.from,l.to)}else{let l=i.to-i.from;if(l200)return v.none;if(e.wholeWords){if(s=t.sliceDoc(i.from,i.to),a=t.charCategorizer(i.head),!(Ao(a,t,i.from,i.to)&&Su(a,t,i.from,i.to)))return v.none}else if(s=t.sliceDoc(i.from,i.to),!s)return v.none}let o=[];for(let l of r.visibleRanges){let O=new we(t.doc,s,l.from,l.to);for(;!O.next().done;){let{from:c,to:h}=O.value;if((!a||Ao(a,t,c,h))&&(i.empty&&c<=i.from&&h>=i.to?o.push(bu.range(c,h)):(c>=i.to||h<=i.from)&&o.push($u.range(c,h)),o.length>e.maxMatches))return v.none}}return v.set(o)}},{decorations:r=>r.decorations}),Pu=X.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),xu=({state:r,dispatch:e})=>{let{selection:t}=r,n=Z.create(t.ranges.map(i=>r.wordAt(i.head)||Z.cursor(i.head)),t.mainIndex);return n.eq(t)?!1:(e(r.update({selection:n})),!0)};function wu(r,e){let{main:t,ranges:n}=r.selection,i=r.wordAt(t.head),s=i&&i.from==t.from&&i.to==t.to;for(let a=!1,o=new we(r.doc,e,n[n.length-1].to);;)if(o.next(),o.done){if(a)return null;o=new we(r.doc,e,0,Math.max(0,n[n.length-1].from-1)),a=!0}else{if(a&&n.some(l=>l.from==o.value.from))continue;if(s){let l=r.wordAt(o.value.from);if(!l||l.from!=o.value.from||l.to!=o.value.to)continue}return o.value}}var yu=({state:r,dispatch:e})=>{let{ranges:t}=r.selection;if(t.some(s=>s.from===s.to))return xu({state:r,dispatch:e});let n=r.sliceDoc(t[0].from,t[0].to);if(r.selection.ranges.some(s=>r.sliceDoc(s.from,s.to)!=n))return!1;let i=wu(r,n);return i?(e(r.update({selection:r.selection.addRange(Z.range(i.from,i.to),!1),effects:X.scrollIntoView(i.to)})),!0):!1},Ae=Ge.define({combine(r){return ct(r,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new oi(e),scrollToMatch:e=>X.scrollIntoView(e)})}});function Uo(r){return r?[Ae.of(r),li]:li}var fr=class{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||mu(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,n)=>n=="n"?` -`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new si(this):new ii(this)}getCursor(e,t=0,n){let i=e.doc?e:Qe.create({doc:e});return n==null&&(n=i.doc.length),this.regexp?nt(this,i,t,n):rt(this,i,t,n)}},dr=class{constructor(e){this.spec=e}};function Zu(r,e,t){return(n,i,s,a)=>{if(t&&!t(n,i,s,a))return!1;let o=n>=a&&i<=a+s.length?s.slice(n-a,i-a):e.doc.sliceString(n,i);return r(o,e,n,i)}}function rt(r,e,t,n){let i;return r.wholeWord&&(i=Xu(e.doc,e.charCategorizer(e.selection.main.head))),r.test&&(i=Zu(r.test,e,i)),new we(e.doc,r.unquoted,t,n,r.caseSensitive?void 0:s=>s.toLowerCase(),i)}function Xu(r,e){return(t,n,i,s)=>((s>t||s+i.length=t)return null;i.push(n.value)}return i}highlight(e,t,n,i){let s=rt(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}};function vu(r,e,t){return(n,i,s)=>(!t||t(n,i,s))&&r(s[0],e,n,i)}function nt(r,e,t,n){let i;return r.wholeWord&&(i=Tu(e.charCategorizer(e.selection.main.head))),r.test&&(i=vu(r.test,e,i)),new cr(e.doc,r.search,{ignoreCase:!r.caseSensitive,test:i},t,n)}function mr(r,e){return r.slice(Rr(r,e,!1),e)}function gr(r,e){return r.slice(e,Rr(r,e))}function Tu(r){return(e,t,n)=>!n[0].length||(r(mr(n.input,n.index))!=A.Word||r(gr(n.input,n.index))!=A.Word)&&(r(gr(n.input,n.index+n[0].length))!=A.Word||r(mr(n.input,n.index+n[0].length))!=A.Word)}var si=class extends dr{nextMatch(e,t,n){let i=nt(this.spec,e,n,e.doc.length).next();return i.done&&(i=nt(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,n){for(let i=1;;i++){let s=Math.max(t,n-i*1e4),a=nt(this.spec,e,s,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(s==t||o.from>s+10))return o;if(s==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let i=n.length;i>0;i--){let s=+n.slice(0,i);if(s>0&&s=t)return null;i.push(n.value)}return i}highlight(e,t,n,i){let s=nt(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}},Xt=q.define(),ci=q.define(),xe=ie.define({create(r){return new Zt(ai(r).create(),null)},update(r,e){for(let t of e.effects)t.is(Xt)?r=new Zt(t.value.create(),r.panel):t.is(ci)&&(r=new Zt(r.query,t.value?hi:null));return r},provide:r=>Ki.from(r,e=>e.panel)});var Zt=class{constructor(e,t){this.query=e,this.panel=t}},Ru=v.mark({class:"cm-searchMatch"}),ju=v.mark({class:"cm-searchMatch cm-searchMatch-selected"}),_u=Xe.fromClass(class{constructor(r){this.view=r,this.decorations=this.highlight(r.state.field(xe))}update(r){let e=r.state.field(xe);(e!=r.startState.field(xe)||r.docChanged||r.selectionSet||r.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:r,panel:e}){if(!e||!r.spec.valid)return v.none;let{view:t}=this,n=new Di;for(let i=0,s=t.visibleRanges,a=s.length;is[i+1].from-500;)l=s[++i].to;r.highlight(t.state,o,l,(O,c)=>{let h=t.state.selection.ranges.some(p=>p.from==O&&p.to==c);n.add(O,c,h?ju:Ru)})}return n.finish()}},{decorations:r=>r.decorations});function vt(r){return e=>{let t=e.state.field(xe,!1);return t&&t.query.spec.valid?r(e,t):Io(e)}}var Qr=vt((r,{query:e})=>{let{to:t}=r.state.selection.main,n=e.nextMatch(r.state,t,t);if(!n)return!1;let i=Z.single(n.from,n.to),s=r.state.facet(Ae);return r.dispatch({selection:i,effects:[ui(r,n),s.scrollToMatch(i.main,r)],userEvent:"select.search"}),Go(r),!0}),$r=vt((r,{query:e})=>{let{state:t}=r,{from:n}=t.selection.main,i=e.prevMatch(t,n,n);if(!i)return!1;let s=Z.single(i.from,i.to),a=r.state.facet(Ae);return r.dispatch({selection:s,effects:[ui(r,i),a.scrollToMatch(s.main,r)],userEvent:"select.search"}),Go(r),!0}),Yu=vt((r,{query:e})=>{let t=e.matchAll(r.state,1e3);return!t||!t.length?!1:(r.dispatch({selection:Z.create(t.map(n=>Z.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),Cu=({state:r,dispatch:e})=>{let t=r.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:n,to:i}=t.main,s=[],a=0;for(let o=new we(r.doc,r.sliceDoc(n,i));!o.next().done;){if(s.length>1e3)return!1;o.value.from==n&&(a=s.length),s.push(Z.range(o.value.from,o.value.to))}return e(r.update({selection:Z.create(s,a),userEvent:"select.search.matches"})),!0},Lo=vt((r,{query:e})=>{let{state:t}=r,{from:n,to:i}=t.selection.main;if(t.readOnly)return!1;let s=e.nextMatch(t,n,n);if(!s)return!1;let a=s,o=[],l,O,c=[];a.precise?a.from==n&&a.to==i&&(O=t.toText(e.getReplacement(a)),o.push({from:a.from,to:a.to,insert:O}),a=e.nextMatch(t,a.from,a.to),c.push(X.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(n).number)+"."))):a=e.nextMatch(t,a.from,a.to);let h=r.state.changes(o);return a&&(l=Z.single(a.from,a.to).map(h),c.push(ui(r,a)),c.push(t.facet(Ae).scrollToMatch(l.main,r))),r.dispatch({changes:h,selection:l,effects:c,userEvent:"input.replace"}),!0}),zu=vt((r,{query:e})=>{if(r.state.readOnly)return!1;let t=[];for(let i of e.matchAll(r.state,1e9)){let{from:s,to:a,precise:o}=i;o&&t.push({from:s,to:a,insert:e.getReplacement(i)})}if(!t.length)return!1;let n=r.state.phrase("replaced $ matches",t.length)+".";return r.dispatch({changes:t,effects:X.announce.of(n),userEvent:"input.replace.all"}),!0});function hi(r){return r.state.facet(Ae).createPanel(r)}function ai(r,e){var t,n,i,s,a;let o=r.selection.main,l=o.empty||o.to>o.from+100?"":r.sliceDoc(o.from,o.to);if(e&&!l)return e;let O=r.facet(Ae);return new fr({search:((t=e?.literal)!==null&&t!==void 0?t:O.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(n=e?.caseSensitive)!==null&&n!==void 0?n:O.caseSensitive,literal:(i=e?.literal)!==null&&i!==void 0?i:O.literal,regexp:(s=e?.regexp)!==null&&s!==void 0?s:O.regexp,wholeWord:(a=e?.wholeWord)!==null&&a!==void 0?a:O.wholeWord})}function Vo(r){let e=_r(r,hi);return e&&e.dom.querySelector("[main-field]")}function Go(r){let e=Vo(r);e&&e==r.root.activeElement&&e.select()}var Io=r=>{let e=r.state.field(xe,!1);if(e&&e.panel){let t=Vo(r);if(t&&t!=r.root.activeElement){let n=ai(r.state,e.query.spec);n.valid&&r.dispatch({effects:Xt.of(n)}),t.focus(),t.select()}}else r.dispatch({effects:[ci.of(!0),e?Xt.of(ai(r.state,e.query.spec)):q.appendConfig.of(li)]});return!0},Do=r=>{let e=r.state.field(xe,!1);if(!e||!e.panel)return!1;let t=_r(r,hi);return t&&t.dom.contains(r.root.activeElement)&&r.focus(),r.dispatch({effects:ci.of(!1)}),!0},Bo=[{key:"Mod-f",run:Io,scope:"editor search-panel"},{key:"F3",run:Qr,shift:$r,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Qr,shift:$r,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Do,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Cu},{key:"Mod-Alt-g",run:gu},{key:"Mod-d",run:yu,preventDefault:!0}],oi=class{constructor(e){this.view=e;let t=this.query=e.state.field(xe).query.spec;this.commit=this.commit.bind(this),this.searchField=I("input",{value:t.search,placeholder:F(e,"Find"),"aria-label":F(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=I("input",{value:t.replace,placeholder:F(e,"Replace"),"aria-label":F(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=I("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=I("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=I("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function n(i,s,a){return I("button",{class:"cm-button",name:i,onclick:s,type:"button"},a)}this.dom=I("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,n("next",()=>Qr(e),[F(e,"next")]),n("prev",()=>$r(e),[F(e,"previous")]),n("select",()=>Yu(e),[F(e,"all")]),I("label",null,[this.caseField,F(e,"match case")]),I("label",null,[this.reField,F(e,"regexp")]),I("label",null,[this.wordField,F(e,"by word")]),...e.state.readOnly?[]:[I("br"),this.replaceField,n("replace",()=>Lo(e),[F(e,"replace")]),n("replaceAll",()=>zu(e),[F(e,"replace all")])],I("button",{name:"close",onclick:()=>Do(e),"aria-label":F(e,"close"),type:"button"},["\xD7"])])}commit(){let e=new fr({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:Xt.of(e)}))}keydown(e){Ni(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?$r:Qr)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Lo(this.view))}update(e){for(let t of e.transactions)for(let n of t.effects)n.is(Xt)&&!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(Ae).top}};function F(r,e){return r.state.phrase(e)}var lr=30,Or=/[\s\.,:;?!]/;function ui(r,{from:e,to:t}){let n=r.state.doc.lineAt(e),i=r.state.doc.lineAt(t).to,s=Math.max(n.from,e-lr),a=Math.min(i,t+lr),o=r.state.sliceDoc(s,a);if(s!=n.from){for(let l=0;lo.length-lr;l--)if(!Or.test(o[l-1])&&Or.test(o[l])){o=o.slice(0,l);break}}return X.announce.of(`${r.state.phrase("current match")}. ${o} ${r.state.phrase("on line")} ${n.number}.`)}var qu=X.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"}}),li=[xe,ge.low(_u),qu];function de(r,e,t=""){let n=r.state.changeByRange(i=>{let{from:s,to:a}=i,o=r.state.sliceDoc(s-e.length,s),l=r.state.sliceDoc(a,a+e.length);if(o===e&&l===e)return{changes:[{from:s-e.length,to:s,insert:""},{from:a,to:a+e.length,insert:""}],range:Z.range(s-e.length,a-e.length)};let O=r.state.sliceDoc(s,a)||t;return{changes:{from:s,to:a,insert:e+O+e},range:Z.range(s+e.length,s+e.length+O.length)}});return r.dispatch(n,{scrollIntoView:!0,userEvent:"input"}),r.focus(),!0}function V(r,e){let{state:t}=r,n=[],i=new Set;for(let a of t.selection.ranges)for(let o=t.doc.lineAt(a.from).number;o<=t.doc.lineAt(a.to).number;o++)i.add(o);let s=/^(\s*)(#{1,6}\s+|>\s?|[-*+]\s+\[[ xX]\]\s+|[-*+]\s+|\d+[.)]\s+)?/;for(let a of i){let o=t.doc.line(a),l=s.exec(o.text),O=l[1],c=l[2]??"",h=o.from+O.length,p=h+c.length;n.push({from:h,to:p,insert:c===e?"":e})}return r.dispatch({changes:n,scrollIntoView:!0,userEvent:"input"}),r.focus(),!0}function pi(r,e,t=!1){let{state:n}=r,i=n.selection.main,s=e;if(t){let a=n.doc.lineAt(i.from);i.from===a.from||(s=` +}`,{label:"class",detail:"definition",type:"keyword"}),L('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),L('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Mh=Oo.concat([L("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),L("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),L("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),ao=new Wt,co=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function yt(t){return(e,r)=>{let n=e.node.getChild("VariableDefinition");return n&&r(n,t),!0}}var Uh=["FunctionDeclaration"],Vh={FunctionDeclaration:yt("function"),ClassDeclaration:yt("class"),ClassExpression:()=>!0,EnumDeclaration:yt("constant"),TypeAliasDeclaration:yt("type"),NamespaceDeclaration:yt("namespace"),VariableDefinition(t,e){t.matchContext(Uh)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function ho(t,e){let r=ao.get(e);if(r)return r;let n=[],i=!0;function s(a,o){let l=t.sliceString(a.from,a.to);n.push({label:l,type:o})}return e.cursor(le.IncludeAnonymous).iterate(a=>{if(i)i=!1;else if(a.name){let o=Vh[a.name];if(o&&o(a,s)||co.has(a.name))return!1}else if(a.to-a.from>8192){for(let o of ho(t,a.node))n.push(o);return!1}}),ao.set(e,n),n}var oo=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,uo=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function Gh(t){let e=R(t.state).resolveInner(t.pos,-1);if(uo.indexOf(e.name)>-1)return null;let r=e.name=="VariableName"||e.to-e.from<20&&oo.test(t.state.sliceDoc(e.from,e.to));if(!r&&!t.explicit)return null;let n=[];for(let i=e;i;i=i.parent)co.has(i.name)&&(n=n.concat(ho(t.state.doc,i)));return{options:n,from:r?e.from:t.pos,validFor:oo}}var te=Ne.define({name:"javascript",parser:so.configure({props:[$e.add({IfStatement:Fe({except:/^\s*({|else\b)/}),TryStatement:Fe({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Os,SwitchBody:t=>{let e=t.textAfter,r=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(r?0:n?1:2)*t.unit},Block:ls({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":Fe({except:/^\s*{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag"(t){return t.column(t.node.from)+t.unit}}),he.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":It,BlockComment(t){return{from:t.from+2,to:t.to-2}},JSXElement(t){let e=t.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let r=t.lastChild;return{from:e.to,to:r.type.isError?t.to:r.from}},"JSXSelfClosingTag JSXOpenTag"(t){var e;let r=(e=t.firstChild)===null||e===void 0?void 0:e.nextSibling,n=t.lastChild;return!r||r.type.isError?null:{from:r.to,to:n.type.isError?t.to:n.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),po={test:t=>/^JSX/.test(t.name),facet:Vt({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Nn=te.configure({dialect:"ts"},"typescript"),Fn=te.configure({dialect:"jsx",props:[Ar.add(t=>t.isTop?[po]:void 0)]}),Hn=te.configure({dialect:"jsx ts",props:[Ar.add(t=>t.isTop?[po]:void 0)]},"typescript"),fo=t=>({label:t,type:"keyword"}),mo="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(fo),Ih=mo.concat(["declare","implements","private","protected","public"].map(fo));function go(t={}){let e=t.jsx?t.typescript?Hn:Fn:t.typescript?Nn:te,r=t.typescript?Mh.concat(Ih):Oo.concat(mo);return new ce(e,[te.data.of({autocomplete:ys(uo,Kr(r))}),te.data.of({autocomplete:Gh}),t.jsx?Nh:[]])}function Dh(t){for(;;){if(t.name=="JSXOpenTag"||t.name=="JSXSelfClosingTag"||t.name=="JSXFragmentTag")return t;if(t.name=="JSXEscape"||!t.parent)return null;t=t.parent}}function lo(t,e,r=t.length){for(let n=e?.firstChild;n;n=n.nextSibling)if(n.name=="JSXIdentifier"||n.name=="JSXBuiltin"||n.name=="JSXNamespacedName"||n.name=="JSXMemberExpression")return t.sliceString(n.from,Math.min(n.to,r));return""}var Bh=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Nh=X.inputHandler.of((t,e,r,n,i)=>{if((Bh?t.composing:t.compositionStarted)||t.state.readOnly||e!=r||n!=">"&&n!="/"||!te.isActiveAt(t.state,e,-1))return!1;let s=i(),{state:a}=s,o=a.changeByRange(l=>{var O;let{head:c}=l,h=R(a).resolveInner(c-1,-1),p;if(h.name=="JSXStartTag"&&(h=h.parent),!(a.doc.sliceString(c-1,c)!=n||h.name=="JSXAttributeValue"&&h.to>c)){if(n==">"&&h.name=="JSXFragmentTag")return{range:l,changes:{from:c,insert:""}};if(n=="/"&&h.name=="JSXStartCloseTag"){let u=h.parent,d=u.parent;if(d&&u.from==c-2&&((p=lo(a.doc,d.firstChild,c))||((O=d.firstChild)===null||O===void 0?void 0:O.name)=="JSXFragmentTag")){let m=`${p}>`;return{range:Z.cursor(c+m.length,-1),changes:{from:c,insert:m}}}}else if(n==">"){let u=Dh(h);if(u&&u.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(a.doc.sliceString(c,c+2))&&(p=lo(a.doc,u,c)))return{range:l,changes:{from:c,insert:``}}}}return{range:l}});return o.changes.empty?!1:(t.dispatch([s,a.update(o,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});var Zt=["_blank","_self","_top","_parent"],Kn=["ascii","utf-8","utf-16","latin1","latin1"],Jn=["get","post","put","delete"],ei=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],N=["true","false"],S={},Fh={a:{attrs:{href:null,ping:null,type:null,media:null,target:Zt,hreflang:null}},abbr:S,address:S,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:S,aside:S,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:S,base:{attrs:{href:null,target:Zt}},bdi:S,bdo:S,blockquote:{attrs:{cite:null}},body:S,br:S,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:ei,formmethod:Jn,formnovalidate:["novalidate"],formtarget:Zt,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:S,center:S,cite:S,code:S,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:S,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:S,div:S,dl:S,dt:S,em:S,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:S,figure:S,footer:S,form:{attrs:{action:null,name:null,"accept-charset":Kn,autocomplete:["on","off"],enctype:ei,method:Jn,novalidate:["novalidate"],target:Zt}},h1:S,h2:S,h3:S,h4:S,h5:S,h6:S,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:S,hgroup:S,hr:S,html:{attrs:{manifest:null}},i:S,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:ei,formmethod:Jn,formnovalidate:["novalidate"],formtarget:Zt,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:S,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:S,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:S,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Kn,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:S,noscript:S,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:S,param:{attrs:{name:null,value:null}},pre:S,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:S,rt:S,ruby:S,samp:S,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Kn}},section:S,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:S,source:{attrs:{src:null,type:null,media:null}},span:S,strong:S,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:S,summary:S,sup:S,table:S,tbody:S,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:S,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:S,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:S,time:{attrs:{datetime:null}},title:S,tr:S,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:S,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:S},So={accesskey:null,class:null,contenteditable:N,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:N,autocorrect:N,autocapitalize:N,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":N,"aria-autocomplete":["inline","list","both","none"],"aria-busy":N,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":N,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":N,"aria-hidden":N,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":N,"aria-multiselectable":N,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":N,"aria-relevant":null,"aria-required":N,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},ko="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(t=>"on"+t);for(let t of ko)So[t]=null;var qe=class{constructor(e,r){this.tags={...Fh,...e},this.globalAttrs={...So,...r},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};qe.default=new qe;function Ae(t,e,r=t.length){if(!e)return"";let n=e.firstChild,i=n&&n.getChild("TagName");return i?t.sliceString(i.from,Math.min(i.to,r)):""}function rt(t,e=!1){for(;t;t=t.parent)if(t.name=="Element")if(e)e=!1;else return t;return null}function Po(t,e,r){let n=r.tags[Ae(t,rt(e))];return n?.children||r.allTags}function ti(t,e){let r=[];for(let n=rt(e);n&&!n.type.isTop;n=rt(n.parent)){let i=Ae(t,n);if(i&&n.lastChild.name=="CloseTag")break;i&&r.indexOf(i)<0&&(e.name=="EndTag"||e.from>=n.firstChild.to)&&r.push(i)}return r}var xo=/^[:\-\.\w\u00b7-\uffff]*$/;function Qo(t,e,r,n,i){let s=/\s*>/.test(t.sliceDoc(i,i+5))?"":">",a=rt(r,r.name=="StartTag"||r.name=="TagName");return{from:n,to:i,options:Po(t.doc,a,e).map(o=>({label:o,type:"type"})).concat(ti(t.doc,r).map((o,l)=>({label:"/"+o,apply:"/"+o+s,type:"type",boost:99-l}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function $o(t,e,r,n){let i=/\s*>/.test(t.sliceDoc(n,n+5))?"":">";return{from:r,to:n,options:ti(t.doc,e).map((s,a)=>({label:s,apply:s+i,type:"type",boost:99-a})),validFor:xo}}function Hh(t,e,r,n){let i=[],s=0;for(let a of Po(t.doc,r,e))i.push({label:"<"+a,type:"type"});for(let a of ti(t.doc,r))i.push({label:"",type:"type",boost:99-s++});return{from:n,to:n,options:i,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function Kh(t,e,r,n,i){let s=rt(r),a=s?e.tags[Ae(t.doc,s)]:null,o=a&&a.attrs?Object.keys(a.attrs):[],l=a&&a.globalAttrs===!1?o:o.length?o.concat(e.globalAttrNames):e.globalAttrNames;return{from:n,to:i,options:l.map(O=>({label:O,type:"property"})),validFor:xo}}function Jh(t,e,r,n,i){var s;let a=(s=r.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),o=[],l;if(a){let O=t.sliceDoc(a.from,a.to),c=e.globalAttrs[O];if(!c){let h=rt(r),p=h?e.tags[Ae(t.doc,h)]:null;c=p?.attrs&&p.attrs[O]}if(c){let h=t.sliceDoc(n,i).toLowerCase(),p='"',u='"';/^['"]/.test(h)?(l=h[0]=='"'?/^[^"]*$/:/^[^']*$/,p="",u=t.sliceDoc(i,i+1)==h[0]?"":h[0],h=h.slice(1),n++):l=/^[^\s<>='"]*$/;for(let d of c)o.push({label:d,apply:p+d+u,type:"constant"})}}return{from:n,to:i,options:o,validFor:l}}function wo(t,e){let{state:r,pos:n}=e,i=R(r).resolveInner(n,-1),s=i.resolve(n);for(let a=n,o;s==i&&(o=i.childBefore(a));){let l=o.lastChild;if(!l||!l.type.isError||l.fromwo(n,i)}var tu=te.parser.configure({top:"SingleExpression"}),Zo=[{tag:"script",attrs:t=>t.type=="text/typescript"||t.lang=="ts",parser:Nn.parser},{tag:"script",attrs:t=>t.type=="text/babel"||t.type=="text/jsx",parser:Fn.parser},{tag:"script",attrs:t=>t.type=="text/typescript-jsx",parser:Hn.parser},{tag:"script",attrs(t){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(t.type)},parser:tu},{tag:"script",attrs(t){return!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type)},parser:te.parser},{tag:"style",attrs(t){return(!t.lang||t.lang=="css")&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type))},parser:wt.parser}],Xo=[{name:"style",parser:wt.parser.configure({top:"Styles"})}].concat(ko.map(t=>({name:t,parser:te.parser}))),vo=Ne.define({name:"html",parser:Ma.configure({props:[$e.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag"(t){return t.column(t.node.from)+t.unit},Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),Or=vo.configure({wrap:Mn(Zo,Xo)});function To(t={}){let e="",r;t.matchClosingTags===!1&&(e="noMatch"),t.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(r=Mn((t.nestedLanguages||[]).concat(Zo),(t.nestedAttributes||[]).concat(Xo)));let n=r?vo.configure({wrap:r,dialect:e}):e?Or.configure({dialect:e}):Or;return new ce(n,[Or.data.of({autocomplete:eu(t)}),t.autoCloseTags!==!1?nu:[],go().support,ro().support])}var bo=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" "));function ru(t,e,r){for(var n;;){if(((n=e.lastChild)===null||n===void 0?void 0:n.name)!="CloseTag")return!1;let i=e.parent;if(!i||Ae(t,i)!=r)return!0;e=i}}var nu=X.inputHandler.of((t,e,r,n,i)=>{if(t.composing||t.state.readOnly||e!=r||n!=">"&&n!="/"||!Or.isActiveAt(t.state,e,-1))return!1;let s=i(),{state:a}=s,o=a.changeByRange(l=>{var O;let c=a.doc.sliceString(l.from-1,l.to)==n,{head:h}=l,p=R(a).resolveInner(h,-1),u;if(c&&n==">"&&p.name=="EndTag"){let d=p.parent;if((u=Ae(a.doc,d.parent,h))&&!bo.has(u)&&!ru(a.doc,d.parent,u)){let m=h+(a.doc.sliceString(h,h+1)===">"?1:0),g=``;return{range:l,changes:{from:h,to:m,insert:g}}}}else if(c&&n=="/"&&p.name=="IncompleteCloseTag"){let d=p.parent;if(p.from==h-2&&((O=d.lastChild)===null||O===void 0?void 0:O.name)!="CloseTag"&&(u=Ae(a.doc,d,h))&&!bo.has(u)){let m=h+(a.doc.sliceString(h,h+1)===">"?1:0),g=`${u}>`;return{range:Z.cursor(h+g.length,-1),changes:{from:h,to:m,insert:g}}}}return{range:l}});return o.changes.empty?!1:(t.dispatch([s,a.update(o,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});var _o=Vt({commentTokens:{block:{open:""}}}),Co=new K,Yo=ua.configure({props:[he.add(t=>!t.is("Block")||t.is("Document")||ii(t)!=null||iu(t)?void 0:(e,r)=>({from:r.doc.lineAt(e.from).to,to:e.to})),Co.add(ii),$e.add({Document:()=>null}),ss.add({Document:_o})]});function ii(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function iu(t){return t.name=="OrderedList"||t.name=="BulletList"}function su(t,e){let r=t;for(;;){let n=r.nextSibling,i;if(!n||(i=ii(n.type))!=null&&i<=e)break;r=n}return r.to}var au=cs.of((t,e,r)=>{for(let n=R(t).resolveInner(r,-1);n&&!(n.fromr)return{from:r,to:s}}return null});function si(t){return new as(_o,t,[],"markdown")}var ou=si(Yo),lu=Yo.configure([da,Qa,ga,$a,{props:[he.add({Table:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}]),nt=si(lu);function Ou(t,e){return r=>{if(r&&t){let n=null;if(r=/\S*/.exec(r)[0],typeof t=="function"?n=t(r):n=Lr.matchLanguageName(t,r,!0),n instanceof Lr)return n.support?n.support.language.parser:os.getSkippingParser(n.load());if(n)return n.parser}return e?e.parser:null}}var Xt=class{constructor(e,r,n,i,s,a,o){this.node=e,this.from=r,this.to=n,this.spaceBefore=i,this.spaceAfter=s,this.type=a,this.item=o}blank(e,r=!0){let n=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;n.length0;i--)n+=" ";return n+(r?this.spaceAfter:"")}}marker(e,r){let n=this.node.name=="OrderedList"?String(+qo(this.item,e)[2]+r):"";return this.spaceBefore+n+this.type+this.spaceAfter}};function zo(t,e){let r=[],n=[];for(let i=t;i;i=i.parent){if(i.name=="FencedCode")return n;(i.name=="ListItem"||i.name=="Blockquote")&&r.push(i)}for(let i=r.length-1;i>=0;i--){let s=r[i],a,o=e.lineAt(s.from),l=s.from-o.from;if(s.name=="Blockquote"&&(a=/^ *>( ?)/.exec(o.text.slice(l))))n.push(new Xt(s,l,l+a[0].length,"",a[1],">",null));else if(s.name=="ListItem"&&s.parent.name=="OrderedList"&&(a=/^( *)\d+([.)])( *)/.exec(o.text.slice(l)))){let O=a[3],c=a[0].length;O.length>=4&&(O=O.slice(0,O.length-4),c-=4),n.push(new Xt(s.parent,l,l+c,a[1],O,a[2],s))}else if(s.name=="ListItem"&&s.parent.name=="BulletList"&&(a=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(o.text.slice(l)))){let O=a[4],c=a[0].length;O.length>4&&(O=O.slice(0,O.length-4),c-=4);let h=a[2];a[3]&&(h+=a[3].replace(/[xX]/," ")),n.push(new Xt(s.parent,l,l+c,a[1],O,h,s))}}return n}function qo(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function ri(t,e,r,n=0){for(let i=-1,s=t;;){if(s.name=="ListItem"){let o=qo(s,e),l=+o[2];if(i>=0){if(l!=i+1)return;r.push({from:s.from+o[1].length,to:s.from+o[0].length,insert:String(i+2+n)})}i=l}let a=s.nextSibling;if(!a)break;s=a}}function ai(t,e){let r=/^[ \t]*/.exec(t)[0].length;if(!r||e.facet(Gt)!=" ")return t;let n=Be(t,4,r),i="";for(let s=n;s>0;)s>=4?(i+=" ",s-=4):(i+=" ",s--);return i+t.slice(r)}var cu=(t={})=>({state:e,dispatch:r})=>{let n=R(e),{doc:i}=e,s=null,a=e.changeByRange(o=>{if(!o.empty||!nt.isActiveAt(e,o.from,-1)&&!nt.isActiveAt(e,o.from,1))return s={range:o};let l=o.from,O=i.lineAt(l),c=zo(n.resolveInner(l,-1),i);for(;c.length&&c[c.length-1].from>l-O.from;)c.pop();if(!c.length)return s={range:o};let h=c[c.length-1];if(h.to-h.spaceAfter.length>l-O.from)return s={range:o};let p=l>=h.to-h.spaceAfter.length&&!/\S/.test(O.text.slice(h.to));if(h.item&&p){if(h.item.from]*$/.test(O.text.slice(0,h.to)))return s={range:o};let b=h.node.firstChild,Q=h.node.getChild("ListItem","ListItem");if(b.to>=l||Q&&Q.to0&&!/[^\s>]/.test(i.lineAt(O.from-1).text)||t.nonTightLists===!1){let k=c.length>1?c[c.length-2]:null,y,w="";k&&k.item?(y=O.from+k.from,w=k.marker(i,1)):y=O.from+(k?k.to:0);let _=[{from:y,to:l,insert:w}];return h.node.name=="OrderedList"&&ri(h.item,i,_,-2),k&&k.node.name=="OrderedList"&&ri(k.item,i,_),{range:Z.cursor(y+w.length),changes:_}}else{let k=jo(c,e,O);return{range:Z.cursor(l+k.length+1),changes:{from:O.from,insert:k+e.lineBreak}}}}if(h.node.name=="Blockquote"&&p&&O.from){let b=i.lineAt(O.from-1),Q=/>\s*$/.exec(b.text);if(Q&&Q.index==h.from){let k=e.changes([{from:b.from+Q.index,to:b.to},{from:O.from+h.from,to:O.to}]);return{range:o.map(k),changes:k}}}let u=[];h.node.name=="OrderedList"&&ri(h.item,i,u);let d=h.item&&h.item.from]*/.exec(O.text)[0].length>=h.to)for(let b=0,Q=c.length-1;b<=Q;b++)m+=b==Q&&!d?c[b].marker(i,1):c[b].blank(bO.from&&/\s/.test(O.text.charAt(g-O.from-1));)g--;return m=ai(m,e),uu(h.node,e.doc)&&(m=jo(c,e,O)+e.lineBreak+m),u.push({from:g,to:l,insert:e.lineBreak+m}),{range:Z.cursor(g+m.length+1),changes:u}});return s?!1:(r(e.update(a,{scrollIntoView:!0,userEvent:"input"})),!0)},hu=cu();function Ro(t){return t.name=="QuoteMark"||t.name=="ListMark"}function uu(t,e){if(t.name!="OrderedList"&&t.name!="BulletList")return!1;let r=t.firstChild,n=t.getChild("ListItem","ListItem");if(!n)return!1;let i=e.lineAt(r.to),s=e.lineAt(n.from),a=/^[\s>]*$/.test(i.text);return i.number+(a?0:1){let r=R(t),n=null,i=t.changeByRange(s=>{let a=s.from,{doc:o}=t;if(s.empty&&nt.isActiveAt(t,s.from)){let l=o.lineAt(a),O=zo(pu(r,a),o);if(O.length){let c=O[O.length-1],h=c.to-c.spaceAfter.length+(c.spaceAfter?1:0);if(a-l.from>h&&!/\S/.test(l.text.slice(h,a-l.from)))return{range:Z.cursor(l.from+h),changes:{from:l.from+h,to:a}};if(a-l.from==h&&(c.item&&l.from<=c.item.from||/^[\s>]*$/.test(l.text.slice(0,c.to)))){let p=l.from+c.from;if(c.item&&c.node.from{var r;let{main:n}=e.state.selection;if(n.empty)return!1;let i=(r=t.clipboardData)===null||r===void 0?void 0:r.getData("text/plain");if(!i||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(i)||(/^www\./.test(i)&&(i="https://"+i),!nt.isActiveAt(e.state,n.from,1)))return!1;let s=R(e.state),a=!1;return s.iterate({from:n.from,to:n.to,enter:o=>{(o.from>n.from||Qu.test(o.name))&&(a=!0)},leave:o=>{o.tot.normalize("NFKD"):t=>t,we=class{constructor(e,r,n=0,i=e.length,s,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,i),this.bufferStart=n,this.normalize=s?o=>s(Eo(o)):Eo,this.query=this.normalize(r)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return W(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let r=ht(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=J(e);let i=this.normalize(r);if(i.length)for(let s=0,a=n,o=!0;;s++){let l=i.charCodeAt(s),O=this.match(l,a,o,this.bufferPos+this.bufferStart,s==i.length-1);if(O)return this.value=O,this;if(s==i.length-1)break;o&&sthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let n=this.curLineStart+r.index,i=n+r[0].length;if(this.matchPos=dr(this.text,i+(n==i?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(nthis.value.to)&&(!this.test||this.test(n,i,r)))return this.value={from:n,to:i,precise:!0,match:r},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=n||i.to<=r){let o=new t(r,e.sliceString(r,n));return oi.set(e,o),o}if(i.from==r&&i.to==n)return i;let{text:s,from:a}=i;return a>r&&(s=e.sliceString(r,a)+s,a=r),i.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==e&&(this.re.lastIndex=e+1,r=this.re.exec(this.flat.text)),r){let n=this.flat.from+r.index,i=n+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,i,r)))return this.value={from:n,to:i,precise:!0,match:r},this.matchPos=dr(this.text,i+(n==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=pr.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<"u"&&(ur.prototype[Symbol.iterator]=fr.prototype[Symbol.iterator]=function(){return this});function bu(t){try{return new RegExp(t,pi),!0}catch{return!1}}function dr(t,e){if(e>=t.length)return e;let r=t.lineAt(e),n;for(;e=56320&&n<57344;)e++;return e}var Su=t=>{let e=ns(t,"cm-goto-line");if(e){let a=e.dom.querySelector("input[type=text]");return a&&a.select(),!0}let{state:r}=t,n=String(r.doc.lineAt(t.state.selection.main.head).number),{close:i,result:s}=rs(t,{class:"cm-goto-line",label:r.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:r.phrase("go")});return s.then(a=>{let o=a&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(a.elements.line.value);if(!o){t.dispatch({effects:i});return}let l=r.doc.lineAt(r.selection.main.head),[,O,c,h,p]=o,u=h?+h.slice(1):0,d=c?+c:l.number;if(c&&p){let b=d/100;O&&(b=b*(O=="-"?-1:1)+l.number/r.doc.lines),d=Math.round(r.doc.lines*b)}else c&&O&&(d=d*(O=="-"?-1:1)+l.number);let m=r.doc.line(Math.max(1,Math.min(r.doc.lines,d))),g=Z.cursor(m.from+Math.max(0,Math.min(u,m.length)));t.dispatch({effects:[i,X.scrollIntoView(g.from,{y:"center"})],selection:g})}),!0},ku={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Vo=De.define({combine(t){return ut(t,ku,{highlightWordAroundCursor:(e,r)=>e||r,minSelectionLength:Math.min,maxMatches:Math.min})}});function Go(t){let e=[Zu,yu];return t&&e.push(Vo.of(t)),e}var Pu=v.mark({class:"cm-selectionMatch"}),xu=v.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Wo(t,e,r,n){return(r==0||t(e.sliceDoc(r-1,r))!=A.Word)&&(n==e.doc.length||t(e.sliceDoc(n,n+1))!=A.Word)}function wu(t,e,r,n){return t(e.sliceDoc(r,r+1))==A.Word&&t(e.sliceDoc(n-1,n))==A.Word}var yu=ve.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Vo),{state:r}=t,n=r.selection;if(n.ranges.length>1)return v.none;let i=n.main,s,a=null;if(i.empty){if(!e.highlightWordAroundCursor)return v.none;let l=r.wordAt(i.head);if(!l)return v.none;a=r.charCategorizer(i.head),s=r.sliceDoc(l.from,l.to)}else{let l=i.to-i.from;if(l200)return v.none;if(e.wholeWords){if(s=r.sliceDoc(i.from,i.to),a=r.charCategorizer(i.head),!(Wo(a,r,i.from,i.to)&&wu(a,r,i.from,i.to)))return v.none}else if(s=r.sliceDoc(i.from,i.to),!s)return v.none}let o=[];for(let l of t.visibleRanges){let O=new we(r.doc,s,l.from,l.to);for(;!O.next().done;){let{from:c,to:h}=O.value;if((!a||Wo(a,r,c,h))&&(i.empty&&c<=i.from&&h>=i.to?o.push(xu.range(c,h)):(c>=i.to||h<=i.from)&&o.push(Pu.range(c,h)),o.length>e.maxMatches))return v.none}}return v.set(o)}},{decorations:t=>t.decorations}),Zu=X.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Xu=({state:t,dispatch:e})=>{let{selection:r}=t,n=Z.create(r.ranges.map(i=>t.wordAt(i.head)||Z.cursor(i.head)),r.mainIndex);return n.eq(r)?!1:(e(t.update({selection:n})),!0)};function vu(t,e){let{main:r,ranges:n}=t.selection,i=t.wordAt(r.head),s=i&&i.from==r.from&&i.to==r.to;for(let a=!1,o=new we(t.doc,e,n[n.length-1].to);;)if(o.next(),o.done){if(a)return null;o=new we(t.doc,e,0,Math.max(0,n[n.length-1].from-1)),a=!0}else{if(a&&n.some(l=>l.from==o.value.from))continue;if(s){let l=t.wordAt(o.value.from);if(!l||l.from!=o.value.from||l.to!=o.value.to)continue}return o.value}}var Tu=({state:t,dispatch:e})=>{let{ranges:r}=t.selection;if(r.some(s=>s.from===s.to))return Xu({state:t,dispatch:e});let n=t.sliceDoc(r[0].from,r[0].to);if(t.selection.ranges.some(s=>t.sliceDoc(s.from,s.to)!=n))return!1;let i=vu(t,n);return i?(e(t.update({selection:t.selection.addRange(Z.range(i.from,i.to),!1),effects:X.scrollIntoView(i.to)})),!0):!1},Le=De.define({combine(t){return ut(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new hi(e),scrollToMatch:e=>X.scrollIntoView(e)})}});function Io(t){return t?[Le.of(t),ui]:ui}var mr=class{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||bu(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(r,n)=>n=="n"?` +`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Oi(this):new li(this)}getCursor(e,r=0,n){let i=e.doc?e:Qe.create({doc:e});return n==null&&(n=i.doc.length),this.regexp?st(this,i,r,n):it(this,i,r,n)}},gr=class{constructor(e){this.spec=e}};function Ru(t,e,r){return(n,i,s,a)=>{if(r&&!r(n,i,s,a))return!1;let o=n>=a&&i<=a+s.length?s.slice(n-a,i-a):e.doc.sliceString(n,i);return t(o,e,n,i)}}function it(t,e,r,n){let i;return t.wholeWord&&(i=ju(e.doc,e.charCategorizer(e.selection.main.head))),t.test&&(i=Ru(t.test,e,i)),new we(e.doc,t.unquoted,r,n,t.caseSensitive?void 0:s=>s.toLowerCase(),i)}function ju(t,e){return(r,n,i,s)=>((s>r||s+i.length=r)return null;i.push(n.value)}return i}highlight(e,r,n,i){let s=it(this.spec,e,Math.max(0,r-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}};function _u(t,e,r){return(n,i,s)=>(!r||r(n,i,s))&&t(s[0],e,n,i)}function st(t,e,r,n){let i;return t.wholeWord&&(i=Cu(e.charCategorizer(e.selection.main.head))),t.test&&(i=_u(t.test,e,i)),new ur(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:i},r,n)}function Qr(t,e){return t.slice(_r(t,e,!1),e)}function $r(t,e){return t.slice(e,_r(t,e))}function Cu(t){return(e,r,n)=>!n[0].length||(t(Qr(n.input,n.index))!=A.Word||t($r(n.input,n.index))!=A.Word)&&(t($r(n.input,n.index+n[0].length))!=A.Word||t(Qr(n.input,n.index+n[0].length))!=A.Word)}var Oi=class extends gr{nextMatch(e,r,n){let i=st(this.spec,e,n,e.doc.length).next();return i.done&&(i=st(this.spec,e,0,r).next()),i.done?null:i.value}prevMatchInRange(e,r,n){for(let i=1;;i++){let s=Math.max(r,n-i*1e4),a=st(this.spec,e,s,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(s==r||o.from>s+10))return o;if(s==r)return null}}prevMatch(e,r,n){return this.prevMatchInRange(e,0,r)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(r,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let i=n.length;i>0;i--){let s=+n.slice(0,i);if(s>0&&s=r)return null;i.push(n.value)}return i}highlight(e,r,n,i){let s=st(this.spec,e,Math.max(0,r-250),Math.min(n+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}},Tt=q.define(),fi=q.define(),xe=ie.define({create(t){return new vt(ci(t).create(),null)},update(t,e){for(let r of e.effects)r.is(Tt)?t=new vt(r.value.create(),t.panel):r.is(fi)&&(t=new vt(t.query,r.value?di:null));return t},provide:t=>ts.from(t,e=>e.panel)});var vt=class{constructor(e,r){this.query=e,this.panel=r}},Yu=v.mark({class:"cm-searchMatch"}),zu=v.mark({class:"cm-searchMatch cm-searchMatch-selected"}),qu=ve.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(xe))}update(t){let e=t.state.field(xe);(e!=t.startState.field(xe)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return v.none;let{view:r}=this,n=new Hi;for(let i=0,s=r.visibleRanges,a=s.length;is[i+1].from-500;)l=s[++i].to;t.highlight(r.state,o,l,(O,c)=>{let h=r.state.selection.ranges.some(p=>p.from==O&&p.to==c);n.add(O,c,h?zu:Yu)})}return n.finish()}},{decorations:t=>t.decorations});function Rt(t){return e=>{let r=e.state.field(xe,!1);return r&&r.query.spec.valid?t(e,r):No(e)}}var br=Rt((t,{query:e})=>{let{to:r}=t.state.selection.main,n=e.nextMatch(t.state,r,r);if(!n)return!1;let i=Z.single(n.from,n.to),s=t.state.facet(Le);return t.dispatch({selection:i,effects:[mi(t,n),s.scrollToMatch(i.main,t)],userEvent:"select.search"}),Bo(t),!0}),Sr=Rt((t,{query:e})=>{let{state:r}=t,{from:n}=r.selection.main,i=e.prevMatch(r,n,n);if(!i)return!1;let s=Z.single(i.from,i.to),a=t.state.facet(Le);return t.dispatch({selection:s,effects:[mi(t,i),a.scrollToMatch(s.main,t)],userEvent:"select.search"}),Bo(t),!0}),Au=Rt((t,{query:e})=>{let r=e.matchAll(t.state,1e3);return!r||!r.length?!1:(t.dispatch({selection:Z.create(r.map(n=>Z.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),Lu=({state:t,dispatch:e})=>{let r=t.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:n,to:i}=r.main,s=[],a=0;for(let o=new we(t.doc,t.sliceDoc(n,i));!o.next().done;){if(s.length>1e3)return!1;o.value.from==n&&(a=s.length),s.push(Z.range(o.value.from,o.value.to))}return e(t.update({selection:Z.create(s,a),userEvent:"select.search.matches"})),!0},Mo=Rt((t,{query:e})=>{let{state:r}=t,{from:n,to:i}=r.selection.main;if(r.readOnly)return!1;let s=e.nextMatch(r,n,n);if(!s)return!1;let a=s,o=[],l,O,c=[];a.precise?a.from==n&&a.to==i&&(O=r.toText(e.getReplacement(a)),o.push({from:a.from,to:a.to,insert:O}),a=e.nextMatch(r,a.from,a.to),c.push(X.announce.of(r.phrase("replaced match on line $",r.doc.lineAt(n).number)+"."))):a=e.nextMatch(r,a.from,a.to);let h=t.state.changes(o);return a&&(l=Z.single(a.from,a.to).map(h),c.push(mi(t,a)),c.push(r.facet(Le).scrollToMatch(l.main,t))),t.dispatch({changes:h,selection:l,effects:c,userEvent:"input.replace"}),!0}),Eu=Rt((t,{query:e})=>{if(t.state.readOnly)return!1;let r=[];for(let i of e.matchAll(t.state,1e9)){let{from:s,to:a,precise:o}=i;o&&r.push({from:s,to:a,insert:e.getReplacement(i)})}if(!r.length)return!1;let n=t.state.phrase("replaced $ matches",r.length)+".";return t.dispatch({changes:r,effects:X.announce.of(n),userEvent:"input.replace.all"}),!0});function di(t){return t.state.facet(Le).createPanel(t)}function ci(t,e){var r,n,i,s,a;let o=t.selection.main,l=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!l)return e;let O=t.facet(Le);return new mr({search:((r=e?.literal)!==null&&r!==void 0?r:O.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(n=e?.caseSensitive)!==null&&n!==void 0?n:O.caseSensitive,literal:(i=e?.literal)!==null&&i!==void 0?i:O.literal,regexp:(s=e?.regexp)!==null&&s!==void 0?s:O.regexp,wholeWord:(a=e?.wholeWord)!==null&&a!==void 0?a:O.wholeWord})}function Do(t){let e=qr(t,di);return e&&e.dom.querySelector("[main-field]")}function Bo(t){let e=Do(t);e&&e==t.root.activeElement&&e.select()}var No=t=>{let e=t.state.field(xe,!1);if(e&&e.panel){let r=Do(t);if(r&&r!=t.root.activeElement){let n=ci(t.state,e.query.spec);n.valid&&t.dispatch({effects:Tt.of(n)}),r.focus(),r.select()}}else t.dispatch({effects:[fi.of(!0),e?Tt.of(ci(t.state,e.query.spec)):q.appendConfig.of(ui)]});return!0},Fo=t=>{let e=t.state.field(xe,!1);if(!e||!e.panel)return!1;let r=qr(t,di);return r&&r.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:fi.of(!1)}),!0},Ho=[{key:"Mod-f",run:No,scope:"editor search-panel"},{key:"F3",run:br,shift:Sr,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:br,shift:Sr,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Fo,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Lu},{key:"Mod-Alt-g",run:Su},{key:"Mod-d",run:Tu,preventDefault:!0}],hi=class{constructor(e){this.view=e;let r=this.query=e.state.field(xe).query.spec;this.commit=this.commit.bind(this),this.searchField=I("input",{value:r.search,placeholder:F(e,"Find"),"aria-label":F(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=I("input",{value:r.replace,placeholder:F(e,"Replace"),"aria-label":F(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=I("input",{type:"checkbox",name:"case",form:"",checked:r.caseSensitive,onchange:this.commit}),this.reField=I("input",{type:"checkbox",name:"re",form:"",checked:r.regexp,onchange:this.commit}),this.wordField=I("input",{type:"checkbox",name:"word",form:"",checked:r.wholeWord,onchange:this.commit});function n(i,s,a){return I("button",{class:"cm-button",name:i,onclick:s,type:"button"},a)}this.dom=I("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,n("next",()=>br(e),[F(e,"next")]),n("prev",()=>Sr(e),[F(e,"previous")]),n("select",()=>Au(e),[F(e,"all")]),I("label",null,[this.caseField,F(e,"match case")]),I("label",null,[this.reField,F(e,"regexp")]),I("label",null,[this.wordField,F(e,"by word")]),...e.state.readOnly?[]:[I("br"),this.replaceField,n("replace",()=>Mo(e),[F(e,"replace")]),n("replaceAll",()=>Eu(e),[F(e,"replace all")])],I("button",{name:"close",onclick:()=>Fo(e),"aria-label":F(e,"close"),type:"button"},["\xD7"])])}commit(){let e=new mr({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:Tt.of(e)}))}keydown(e){Ji(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Sr:br)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Mo(this.view))}update(e){for(let r of e.transactions)for(let n of r.effects)n.is(Tt)&&!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(Le).top}};function F(t,e){return t.state.phrase(e)}var cr=30,hr=/[\s\.,:;?!]/;function mi(t,{from:e,to:r}){let n=t.state.doc.lineAt(e),i=t.state.doc.lineAt(r).to,s=Math.max(n.from,e-cr),a=Math.min(i,r+cr),o=t.state.sliceDoc(s,a);if(s!=n.from){for(let l=0;lo.length-cr;l--)if(!hr.test(o[l-1])&&hr.test(o[l])){o=o.slice(0,l);break}}return X.announce.of(`${t.state.phrase("current match")}. ${o} ${t.state.phrase("on line")} ${n.number}.`)}var Wu=X.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"}}),ui=[xe,ge.low(qu),Wu];function Ee(t,e){return typeof document<"u"&&document.documentElement.lang.toLowerCase().startsWith("zh")?t:e}function de(t,e,r=""){let n=t.state.changeByRange(i=>{let{from:s,to:a}=i,o=t.state.sliceDoc(s-e.length,s),l=t.state.sliceDoc(a,a+e.length);if(o===e&&l===e)return{changes:[{from:s-e.length,to:s,insert:""},{from:a,to:a+e.length,insert:""}],range:Z.range(s-e.length,a-e.length)};let O=t.state.sliceDoc(s,a)||r;return{changes:{from:s,to:a,insert:e+O+e},range:Z.range(s+e.length,s+e.length+O.length)}});return t.dispatch(n,{scrollIntoView:!0,userEvent:"input"}),t.focus(),!0}function V(t,e){let{state:r}=t,n=[],i=new Set;for(let a of r.selection.ranges)for(let o=r.doc.lineAt(a.from).number;o<=r.doc.lineAt(a.to).number;o++)i.add(o);let s=/^(\s*)(#{1,6}\s+|>\s?|[-*+]\s+\[[ xX]\]\s+|[-*+]\s+|\d+[.)]\s+)?/;for(let a of i){let o=r.doc.line(a),l=s.exec(o.text),O=l[1],c=l[2]??"",h=o.from+O.length,p=h+c.length;n.push({from:h,to:p,insert:c===e?"":e})}return t.dispatch({changes:n,scrollIntoView:!0,userEvent:"input"}),t.focus(),!0}function gi(t,e,r=!1){let{state:n}=t,i=n.selection.main,s=e;if(r){let a=n.doc.lineAt(i.from);i.from===a.from||(s=` `+s);let l=n.doc.lineAt(i.to);(i.to!==l.to||l.number===n.doc.lines)&&(s+=` -`)}r.dispatch({changes:{from:i.from,to:i.to,insert:s},selection:{anchor:i.from+s.length},scrollIntoView:!0,userEvent:"input"}),r.focus()}function fi(r){let e=r.state.selection.main,t=r.state.sliceDoc(e.from,e.to)||"\u94FE\u63A5",n=`[${t}](https://)`;return r.dispatch({changes:{from:e.from,to:e.to,insert:n},selection:Z.range(e.from+t.length+3,e.from+n.length-1),userEvent:"input"}),r.focus(),!0}function di(r){let e=r.state.selection.main,t=r.state.sliceDoc(e.from,e.to);return r.dispatch({changes:{from:e.from,to:e.to,insert:`[[${t}]]`},selection:{anchor:e.from+2+t.length},userEvent:"input"}),r.focus(),!0}var No=null,Fo="",Au=0,it=new Map;function gi(){return typeof document<"u"&&document.documentElement.dataset.theme==="dark"?"dark":"neutral"}async function Lu(){No??=import("./chunks/mermaid.core-3W6VKKIW.js").then(t=>t.default);let r=await No,e=gi();return Fo!==e&&(r.initialize({startOnLoad:!1,securityLevel:"strict",theme:e,fontFamily:"inherit"}),Fo=e),r}async function Eu(r){let e=gi()+` -`+r,t=it.get(e);if(t)return t;let n=await Lu(),i=`ivy-mermaid-${++Au}`;try{let{svg:s}=await n.render(i,r);return it.size>64&&it.delete(it.keys().next().value),it.set(e,s),s}finally{document.getElementById("d"+i)?.remove(),document.getElementById(i)?.remove()}}function Wu(r,e){return r.classList.add("mermaid-diagram"),r.setAttribute("role","img"),r.setAttribute("aria-label","Mermaid"),Eu(e).then(n=>{r.innerHTML=n,r.classList.remove("mermaid-error")},n=>{r.classList.add("mermaid-error"),r.textContent="Mermaid: "+String(n?.message??n).split(` -`)[0]})}var mi=class extends ee{constructor(t){super();this.code=t}eq(t){return t.code===this.code}toDOM(){let t=document.createElement("div");t.className="cm-mermaid";let n=gi()+` -`+this.code,i=it.get(n);return i?(t.classList.add("mermaid-diagram"),t.innerHTML=i):(t.classList.add("cm-mermaid-loading"),Wu(t,this.code).finally(()=>t.classList.remove("cm-mermaid-loading"))),t}get estimatedHeight(){return 200}ignoreEvent(){return!1}};function Mu(r){let e=[];return R(r).iterate({enter(t){if(t.name!=="FencedCode")return;let n=t.node.getChild("CodeInfo");if(!n||r.sliceDoc(n.from,n.to).trim().toLowerCase()!=="mermaid")return!1;let i=t.node.getChild("CodeText");return e.push({from:t.from,to:t.to,code:i?r.sliceDoc(i.from,i.to):""}),!1}}),e}function Qi(r,e,t){return r.selection.ranges.some(n=>n.from<=t&&n.to>=e)}var Ho=q.define();function Ko(r,e){let t=[];for(let n of Mu(r)){if(e&&Qi(r,n.from,n.to)||!n.code.trim())continue;let i=r.doc.lineAt(n.from).from,s=r.doc.lineAt(n.to).to;t.push(v.replace({widget:new mi(n.code),block:!0}).range(i,s))}return v.set(t,!0)}function Jo(){return[ie.define({create:e=>({focused:!1,deco:Ko(e,!1)}),update(e,t){let n=e.focused;for(let i of t.effects)i.is(Ho)&&(n=i.value);return n!==e.focused||t.docChanged||t.selection||R(t.startState)!==R(t.state)?{focused:n,deco:Ko(t.state,n)}:e},provide:e=>X.decorations.from(e,t=>t.deco)}),X.focusChangeEffect.of((e,t)=>Ho.of(t)),X.domEventHandlers({mousedown(e,t){let n=e.target.closest(".cm-mermaid");if(!n)return!1;let i=t.posAtDOM(n),s=t.state.doc.lineAt(i);e.preventDefault();let a=s.number"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}function el(r){let e=r.trim();return e.startsWith("|")&&(e=e.slice(1)),e.endsWith("|")&&!e.endsWith("\\|")&&(e=e.slice(0,-1)),e.split(/(?t.trim().replace(/\\\|/g,"|"))}function Vu(r){let e=r.split(` -`).filter(i=>i.trim());if(e.length<2)return"";let t=el(e[1]).map(i=>/^:-+:$/.test(i)?"center":/^-+:$/.test(i)?"right":""),n=(i,s)=>""+el(i).map((a,o)=>`<${s}${t[o]?` style="text-align:${t[o]}"`:""}>${Uu(a)}`).join("")+"";return`${n(e[0],"th")}${e.slice(2).map(i=>n(i,"td")).join("")}
`}var $i=class extends ee{constructor(t,n){super();this.src=t;this.render=n}eq(t){return t.src===this.src}toDOM(){let t=document.createElement("div");return t.className="cm-table prose-ivy",t.innerHTML=this.render(this.src),t}ignoreEvent(){return!1}};function Gu(r){let e=[];return R(r).iterate({enter(t){if(t.name==="Table")return e.push({from:t.from,to:t.to}),!1;if(t.name==="FencedCode"||t.name==="CodeBlock")return!1}}),e}var tl=q.define();function nl(r,e,t){return r.selection.ranges.some(n=>n.from<=t&&n.to>=e)}function rl(r,e,t){let n=[];for(let i of Gu(r)){if(e&&nl(r,i.from,i.to))continue;let s=r.doc.lineAt(i.from).from,a=r.doc.lineAt(i.to).to;n.push(v.replace({widget:new $i(r.sliceDoc(s,a),t),block:!0}).range(s,a))}return v.set(n,!0)}function il(r,e,t,n){return!(n&&nl(r,e,t))}function sl(r){let e=n=>r.renderBlock?.(n)||Vu(n);return[ie.define({create:n=>({focused:!1,deco:rl(n,!1,e)}),update(n,i){let s=n.focused;for(let a of i.effects)a.is(tl)&&(s=a.value);return s!==n.focused||i.docChanged||i.selection||R(i.startState)!==R(i.state)?{focused:s,deco:rl(i.state,s,e)}:n},provide:n=>X.decorations.from(n,i=>i.deco)}),X.focusChangeEffect.of((n,i)=>tl.of(i)),X.domEventHandlers({mousedown(n,i){let s=n.target.closest(".cm-table");if(!s)return!1;let a=n.target.closest("a");if(n.preventDefault(),a?.dataset.note||a?.classList.contains("missing"))return r.openNote(a.dataset.note??"",a.dataset.title??a.textContent??"",n.button===1||n.shiftKey),!0;if(a?.href&&/^https?:/i.test(a.href))return window.open(a.href,"_blank","noopener"),!0;let o=i.posAtDOM(s),l=i.state.doc.lineAt(o),O=n.target.closest("tr"),c=[...s.querySelectorAll("tr")],h=O?c.indexOf(O):0;h>0&&h++;let p=i.state.doc.line(Math.min(l.number+Math.max(0,h),i.state.doc.lines));return i.dispatch({selection:{anchor:p.from+Math.min(2,p.length)}}),i.focus(),!0}})]}var Iu=/^ivy:\/\/res\/([A-Za-z0-9_-]{8,64})/,Si=class extends ee{constructor(t,n,i){super();this.src=t;this.alt=n;this.kind=i}eq(t){return t.src===this.src&&t.alt===this.alt&&t.kind===this.kind}toDOM(){let t=document.createElement("span");if(t.className="cm-media",this.kind==="video"||this.kind==="audio"){let n=document.createElement(this.kind);n.src=this.src,n.controls=!0,n.preload="metadata",t.appendChild(n)}else if(this.kind==="file"){let n=document.createElement("a");n.className="cm-file-card",n.href=this.src,n.target="_blank",n.rel="noopener",n.textContent="\u{1F4CE} "+(this.alt||"file"),t.appendChild(n)}else{let n=document.createElement("img");n.src=this.src,n.alt=this.alt,n.loading="lazy",n.onerror=()=>t.classList.add("cm-media-broken"),t.appendChild(n)}return t}ignoreEvent(){return!1}},ki=class extends ee{constructor(t,n){super();this.checked=t;this.pos=n}eq(t){return t.checked===this.checked&&t.pos===this.pos}toDOM(t){let n=document.createElement("input");return n.type="checkbox",n.className="cm-task",n.checked=this.checked,n.setAttribute("aria-label",this.checked?"\u5DF2\u5B8C\u6210":"\u5F85\u529E"),n.addEventListener("mousedown",i=>{i.preventDefault();let a=t.state.sliceDoc(this.pos,this.pos+3)==="[ ]"?"[x]":"[ ]";t.dispatch({changes:{from:this.pos,to:this.pos+3,insert:a}})}),n}ignoreEvent(){return!0}},Pi=class extends ee{toDOM(){let e=document.createElement("span");return e.className="cm-hr-widget",e}eq(){return!0}},xi=class extends ee{toDOM(){let e=document.createElement("span");return e.className="cm-bullet",e.textContent="\u2022",e}eq(){return!0}},se=v.replace({}),bi=r=>v.line({class:r}),Tt=r=>v.mark({class:r});function Du(r){let e=new Set;for(let t of r.selection.ranges){let n=r.doc.lineAt(t.from).number,i=r.doc.lineAt(t.to).number;for(let s=n;s<=i;s++)e.add(s)}return e}function Bu(r,e,t){return r.selection.ranges.some(n=>n.from<=t&&n.to>=e)}var Nu=/\[\[([^[\]\n]+?)\]\]/g;function al(r,e,t){let{state:n}=r,i=[],s=t?Du(n):new Set,a=c=>s.has(n.doc.lineAt(c).number),o=(c,h)=>t&&Bu(n,c,h),l=[];for(let{from:c,to:h}of r.visibleRanges){R(n).iterate({from:c,to:h,enter(u){let d=u.name,m=/^ATXHeading(\d)$/.exec(d);if(m){let g=n.doc.lineAt(u.from);if(i.push(bi(`cm-h cm-h${m[1]}`).range(g.from)),!a(u.from)){let b=u.node.getChild("HeaderMark");b&&i.push(se.range(b.from,Math.min(b.to+1,g.to)))}return}switch(d){case"Table":return il(n,u.from,u.to,t)?!1:void 0;case"FencedCode":case"CodeBlock":{l.push([u.from,u.to]);let g=u.node.getChild("CodeInfo"),b=u.node.getChild("CodeText");if(g&&b&&n.sliceDoc(g.from,g.to).trim().toLowerCase()==="mermaid"&&n.sliceDoc(b.from,b.to).trim()&&!(t&&Qi(n,u.from,u.to)))return!1;let Q=n.doc.lineAt(u.from).number,k=n.doc.lineAt(u.to).number;if(d==="FencedCode"&&!o(u.from,u.to)){let y=n.doc.line(Q),w=n.doc.line(k);y.to>y.from&&i.push(se.range(y.from,y.to)),k!==Q&&w.to>w.from&&/^\s*(```|~~~)/.test(w.text)&&i.push(se.range(w.from,w.to))}for(let y=Q;y<=k;y++){let w=n.doc.line(y),_="cm-codeblock";y===Q&&(_+=" cm-codeblock-first"),y===k&&(_+=" cm-codeblock-last"),i.push(bi(_).range(w.from))}return!1}case"StrongEmphasis":case"Emphasis":case"Strikethrough":case"InlineCode":{let g=d==="StrongEmphasis"?"cm-strong":d==="Emphasis"?"cm-em":d==="Strikethrough"?"cm-strike":"cm-inline-code";if(i.push(Tt(g).range(u.from,u.to)),!o(u.from,u.to)){let b=d==="InlineCode"?"CodeMark":d==="Strikethrough"?"StrikethroughMark":"EmphasisMark",Q=u.node.firstChild;for(;Q;)Q.name===b&&i.push(se.range(Q.from,Q.to)),Q=Q.nextSibling}return d!=="InlineCode"}case"Link":{if(o(u.from,u.to))return;let g=u.node.getChildren("LinkMark"),b=u.node.getChild("URL");return g.length>=2&&(i.push(se.range(g[0].from,g[0].to)),i.push(Tt("cm-link").range(g[0].to,g[1].from)),i.push(se.range(g[1].from,u.to))),!1}case"Image":{let g=u.node.getChild("URL");if(!g)return!1;let b=n.sliceDoc(g.from,g.to),Q=Iu.exec(b),k=Q?e.resolveResource(Q[1]):b,y=Q?e.resourceKind(Q[1]):void 0,w=u.node.getChildren("LinkMark"),_=w.length>=2?n.sliceDoc(w[0].to,w[1].from):"";if(!k||/^javascript:/i.test(k))return!1;let G=new Si(k,_,y);return a(u.from)?i.push(v.widget({widget:G,side:1}).range(u.to)):i.push(v.replace({widget:G}).range(u.from,u.to)),!1}case"Blockquote":{let g=n.doc.lineAt(u.from).number,b=n.doc.lineAt(u.to).number;for(let Q=g;Q<=b;Q++)i.push(bi("cm-quote").range(n.doc.line(Q).from));return}case"QuoteMark":{if(!a(u.from)){let g=n.sliceDoc(u.to,u.to+1)===" "?u.to+1:u.to;i.push(se.range(u.from,g))}return}case"HorizontalRule":{a(u.from)||i.push(v.replace({widget:new Pi}).range(u.from,u.to));return}case"ListMark":{let g=n.sliceDoc(u.from,u.to),b=g==="-"||g==="*"||g==="+",Q=n.sliceDoc(u.to,u.to+4),k=/^ \[[ xX]\]/.test(Q);b&&!a(u.from)?k?i.push(se.range(u.from,u.to+1)):i.push(v.replace({widget:new xi}).range(u.from,u.to)):i.push(Tt("cm-list-mark").range(u.from,u.to));return}case"TaskMarker":{let g=/x/i.test(n.sliceDoc(u.from,u.to));if(!o(u.from,u.to)&&(i.push(v.replace({widget:new ki(g,u.from)}).range(u.from,u.to)),g)){let b=n.doc.lineAt(u.from);u.to+1d>=w&&m<=_))continue;let g=u[1],b=g.indexOf("|"),Q=(b>=0?g.slice(0,b):g).split("#")[0].trim(),k=!!e.resolveTitle(Q),y={"data-wiki":Q};if(o(d,m)){i.push(v.mark({class:"cm-wikilink cm-wikilink-src"+(k?"":" cm-wikilink-missing"),attributes:y}).range(d,m));continue}i.push(se.range(d,d+2+(b>=0?b+1:0))),i.push(v.mark({class:"cm-wikilink cm-wikilink-rendered"+(k?"":" cm-wikilink-missing"),attributes:y}).range(d+2+(b>=0?b+1:0),m-2)),i.push(se.range(m-2,m))}}let O=i.filter(c=>c.value.point===!0);return{all:v.set(i,!0),atomic:v.set(O,!0)}}function ol(r){let e=Xe.fromClass(class{decorations;atomic;constructor(t){let n=al(t,r,t.hasFocus);this.decorations=n.all,this.atomic=n.atomic}update(t){if(t.docChanged||t.viewportChanged||t.selectionSet||t.focusChanged||R(t.startState)!==R(t.state)){let n=al(t.view,r,t.view.hasFocus);this.decorations=n.all,this.atomic=n.atomic}}},{decorations:t=>t.decorations,eventHandlers:{mousedown(t,n){let i=t.target.closest(".cm-wikilink");if(!i)return!1;let s=i.classList.contains("cm-wikilink-rendered"),a=t.button===1||t.shiftKey;if(t.button>1||!s&&!(t.metaKey||t.ctrlKey||t.button===1))return!1;let o=i.dataset.wiki??"";return t.preventDefault(),r.openNote(r.resolveTitle(o),o,a),!0},click(t){let n=t.target.closest(".cm-link, .cm-file-card");return n&&(t.metaKey||t.ctrlKey)&&n instanceof HTMLAnchorElement?(window.open(n.href,"_blank","noopener"),!0):!1}}});return[e,Jo(),sl(r),X.atomicRanges.of(t=>t.plugin(e)?.atomic??v.none)]}var ll=X.theme({"&":{color:"rgb(var(--ink))",backgroundColor:"transparent",height:"100%"},"&.cm-focused":{outline:"none"},".cm-scroller":{fontFamily:"inherit",lineHeight:"1.85",overflow:"visible"},".cm-content":{padding:"0 0 40vh",caretColor:"rgb(var(--ivy))"},".cm-line":{padding:"0"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"rgb(var(--ivy))",borderLeftWidth:"2px"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, ::selection":{backgroundColor:"rgb(var(--ivy) / 0.2) !important"},".cm-placeholder":{color:"rgb(var(--faint))"},".cm-tooltip":{border:"none",backgroundColor:"rgb(var(--surface))",borderRadius:"14px",boxShadow:"var(--shadow-lift)",overflow:"hidden"},".cm-tooltip-autocomplete > ul":{fontFamily:"inherit",maxHeight:"260px",padding:"4px"},".cm-tooltip-autocomplete > ul > li":{padding:"7px 10px",borderRadius:"10px",lineHeight:"1.4"},".cm-tooltip-autocomplete > ul > li[aria-selected]":{backgroundColor:"rgb(var(--sunken))",color:"rgb(var(--ink))"},".cm-completionDetail":{marginLeft:"8px",color:"rgb(var(--muted))",fontStyle:"normal",fontSize:"12px"},".cm-completionIcon":{display:"none"},".cm-panels":{backgroundColor:"rgb(var(--surface))",color:"rgb(var(--ink))",border:"none"},".cm-searchMatch":{backgroundColor:"rgb(var(--warn) / 0.3)"},".cm-searchMatch-selected":{backgroundColor:"rgb(var(--warn) / 0.55)"}}),Ol=Os(ls.define([{tag:f.heading,fontWeight:"600"},{tag:f.strong,fontWeight:"600"},{tag:f.emphasis,fontStyle:"italic"},{tag:f.strikethrough,textDecoration:"line-through"},{tag:f.link,color:"rgb(var(--ivy))"},{tag:f.url,color:"rgb(var(--ivy))"},{tag:f.monospace,fontFamily:"var(--font-mono)",color:"rgb(var(--warn-ink))"},{tag:f.quote,color:"rgb(var(--ink-2))"},{tag:[f.processingInstruction,f.contentSeparator,f.meta],color:"rgb(var(--faint))"},{tag:f.labelName,color:"rgb(var(--muted))"}]));function cl(r){return e=>{let t=e.matchBefore(/\[\[[^\]\n|#]*$/);if(!t)return null;let n=t.text.slice(2).toLowerCase(),i=e.state.sliceDoc(e.pos,e.pos+2),s=[],a=new Set;for(let o of r())if(!(!o.title||a.has(o.title))&&(a.add(o.title),!(n&&!o.title.toLowerCase().includes(n))&&(s.push({label:o.title,detail:o.detail,type:"text",boost:o.title.toLowerCase().startsWith(n)?1:0,apply:(l,O,c,h)=>{let p=i==="]]"?"":"]]";l.dispatch({changes:{from:c,to:h,insert:O.label+p},selection:{anchor:c+O.label.length+2}})}}),s.length>=50)))break;if(n&&!a.has(t.text.slice(2))){let o=t.text.slice(2);s.push({label:o,detail:"\u65B0\u5EFA\u94FE\u63A5",type:"keyword",boost:-1,apply:(l,O,c,h)=>l.dispatch({changes:{from:c,to:h,insert:o+(i==="]]"?"":"]]")},selection:{anchor:c+o.length+2}})})}return{from:t.from+2,options:s,validFor:/^[^\]\n|#]*$/}}}function br(r){return r.trim().replace(/\s+/g," ").toLowerCase()}function hl(r){let e=r,t,n,i=e.indexOf("|");i>=0&&(t=e.slice(i+1).trim(),e=e.slice(0,i));let s=e.indexOf("#");return s>=0&&(n=e.slice(s+1).trim(),e=e.slice(0,s)),{target:e.trim(),alias:t,heading:n}}function Xi(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Me=Xi();function kl(r){Me=r}var Ee={exec:()=>null};function Le(r){let e=[];return t=>{let n=Math.max(0,Math.min(3,t-1)),i=e[n];return i||(i=r(n),e[n]=i),i}}function x(r,e=""){let t=typeof r=="string"?r:r.source,n={replace:(i,s)=>{let a=typeof s=="string"?s:s.source;return a=a.replace(Y.caret,"$1"),t=t.replace(i,a),n},getRegex:()=>new RegExp(t,e)};return n}var Pl=((r="")=>{try{return!!new RegExp("(?<=1)(?/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+)[ \t]*)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,blockquoteMarkerWhitespace:/^( {0,3}>)([ \t]+)/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\][ \t]+\S/,listReplaceTask:/^\[[ xX]\][ \t]+/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:r=>new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Le(r=>new RegExp(`^ {0,${r}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Le(r=>new RegExp(`^ {0,${r}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:Le(r=>new RegExp(`^ {0,${r}}(?:\`\`\`|~~~)`)),headingBeginRegex:Le(r=>new RegExp(`^ {0,${r}}#{1,6}(?:\\s|$)`)),pedanticHeadingBeginRegex:Le(r=>new RegExp(`^ {0,${r}}#`)),htmlBeginRegex:Le(r=>new RegExp(`^ {0,${r}}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|new RegExp(`^ {0,${r}}>`))},Fu=/^(?:[ \t]*(?:\n|$))+/,Hu=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ku=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}(?:(?=`)\1`*|(?=~)\1~*) *(?=\n|$)|$)/,_t=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ju=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,vi=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,xl=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+)[ \t]*(?:\n+|$)/,wl=x(xl).replace(/bull/g,vi).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),ep=x(xl).replace(/bull/g,vi).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ti=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,tp=/^[^\n]+/,Ri=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\\n]|\n(?![ \t]*\n))+/,rp=x(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ri).replace("title",/(?:"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\\n]|\n(?!\n))*'|\((?:\\[\s\S]|[^()\\])*\))/).getRegex(),np=x(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,vi).getRegex(),Yt="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ji=/|$))/,ip=x("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|[^\\n]*\\n*|$)|[^\\n]*\\n*|$)||$)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ji).replace("tag",Yt).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),yl=r=>x(Ti).replace("hr",_t).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",r).replace("html"," {0,3}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?| ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/).replace("paragraph",ap).getRegex(),_i={blockquote:op,code:Hu,def:rp,fences:Ku,heading:Ju,hr:_t,html:ip,lheading:wl,list:np,newline:Fu,paragraph:sp,table:Ee,text:tp},ul=x("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",_t).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html"," {0,3}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html"," {0,3}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|(?: *\\n{2,}|\\s*$)|\\s]*)*?/?>(?: *\\n{2,}|\\s*$))`).replace("comment",ji).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ee,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:x(Ti).replace("hr",_t).replace("heading",` *#{1,6} *[^ -]`).replace("lheading",wl).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},cp=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,hp=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Zl=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,up=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\`+)[^`]+\k(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Pl?"(?`+)[^`]+\k(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),vl=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Qp=x(vl,"u").replace(/punct/g,ae).getRegex(),$p=x(vl,"u").replace(/punct/g,Xl).getRegex(),bp=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,Sp=x(bp,"u").replace(/openQuote/g,fp).replace(/punct/g,ae).getRegex(),Tl="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",kp=x(Tl,"gu").replace(/notPunctSpace/g,Ct).replace(/punctSpace/g,ot).replace(/punct/g,ae).getRegex(),Pp=x(Tl,"gu").replace(/notPunctSpace/g,mp).replace(/punctSpace/g,dp).replace(/punct/g,Xl).getRegex(),xp="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",wp=x(xp,"gu").replace(/notPunctSpace/g,Ct).replace(/punctSpace/g,ot).replace(/punct/g,ae).getRegex(),yp=x("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ct).replace(/punctSpace/g,ot).replace(/punct/g,ae).getRegex(),Zp="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Xp=x(Zp,"gu").replace(/notPunctSpace/g,Ct).replace(/punctSpace/g,ot).replace(/punct/g,ae).getRegex(),vp=x(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,ae).getRegex(),Tp="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Rp=x(Tp,"gu").replace(/notPunctSpace/g,Ct).replace(/punctSpace/g,ot).replace(/punct/g,ae).getRegex(),jp=x(/\\(punct)/,"gu").replace(/punct/g,ae).getRegex(),_p=x(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,"gu").replace(/punct/g,ae).getRegex(),Yp=x(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Cp=x(ji).replace("(?:-->|$)","-->").getRegex(),zp=x("^comment|^|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",Cp).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Rl=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,Pr=x(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",Rl).getRegex(),qp=x(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label",Pr).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\((?:\\[\s\S]|[^)\\])*\)/).getRegex(),Ap=x(/^!?\[(label)\]\[(ref)\]/).replace("label",Pr).replace("ref",Ri).getRegex(),Lp=x(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ri).getRegex(),pl=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Ep=x(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",Rl).getRegex(),Wp=x("reflink|nolink(?!\\()","g").replace("reflink",x(/^!?\[(label)\]\[(ref)\]/).replace("label",Ep).replace("ref",pl).getRegex()).replace("nolink",x(/^!?\[(ref)\](?:\[\])?/).replace("ref",pl).getRegex()).getRegex(),fl=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Mp=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,Up=x(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,Mp).getRegex(),Yi={_backpedal:Ee,anyPunctuation:jp,anyPunctuationOutsideCode:_p,autolink:Yp,blockSkip:gp,br:Zl,code:hp,del:Ee,delLDelim:Ee,delRDelim:Ee,emStrongLDelim:Qp,emStrongRDelimAst:kp,emStrongRDelimUnd:yp,escape:cp,link:qp,nolink:Lp,punctuation:pp,reflink:Ap,reflinkSearch:Wp,tag:zp,text:up,url:Ee},Vp={...Yi,emStrongLDelim:Sp,emStrongRDelimAst:wp,emStrongRDelimUnd:Xp,link:x(/^!?\[(label)\]\((.*?)\)/).replace("label",Pr).getRegex(),reflink:x(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Pr).getRegex()},wi={...Yi,emStrongRDelimAst:Pp,emStrongLDelim:$p,delLDelim:vp,delRDelim:Rp,url:x(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",Up).replace("protocol",fl).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:x(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},dl=r=>Ip[r];function H(r,e){if(e){if(Y.escapeTest.test(r))return r.replace(Y.escapeReplace,dl)}else if(Y.escapeTestNoEncode.test(r))return r.replace(Y.escapeReplaceNoEncode,dl);return r}function Dp(r){return Y.numericCharacterReference.test(r)?r.replace(Y.numericCharacterReferenceOrAmpersand,(e,t,n)=>{if(t===void 0&&n===void 0)return"&";let i=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return i===0||i>1114111||i>=55296&&i<=57343?"\uFFFD":i===38?"&":String.fromCodePoint(i)}):r}function ml(r){try{r=encodeURI(r).replace(Y.percentDecode,"%")}catch{return null}return r}function gl(r,e){let t=r.replace(Y.findPipe,(s,a,o)=>{let l=!1,O=a;for(;--O>=0&&o[O]==="\\";)l=!l;return l?"|":" |"}),n=t.split(Y.splitPipe),i=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length=0&&Y.blankLine.test(e[t]);)t--;return e.length-t<=2?r:e.slice(0,t+1).join(` -`)}function xr(r){return r.trim().replace(Y.multipleSpaceGlobal," ").toLowerCase().toUpperCase().toLowerCase()}function $l(r,e){if(r.indexOf(e[0])===-1&&r.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n0?-2:-1}var at=new WeakMap;function Ci(r){let e={"*":-1,_:-1},t=-1,n=r.length;for(let i=0;i{let a=s.match(t.other.beginningSpace);if(a===null)return s;let[o]=a;return s.slice(Math.min(o.length,i.length))}).join(` -`)}function Sl(r,e,t,n){if(!e.includes("<"))return!1;for(let i=0;ie.length-i)return!0;i+=a[0].length-1}}return!1}var st=class{options;rules;lexer;constructor(r){this.options=r||Me}space(r){let e=this.rules.block.newline.exec(r);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(r){let e=this.rules.block.code.exec(r);if(e){let t=this.options.pedantic?e[0]:Ql(e[0]),n=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:n}}}fences(r){let e=this.rules.block.fences.exec(r);if(e){let t=e[0],n=Kp(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(r){let e=this.rules.block.heading.exec(r);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let n=me(t,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceTabChar.test(n))&&(t=n.trim())}return{type:"heading",raw:me(e[0],` -`),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(r){let e=this.rules.block.hr.exec(r);if(e)return{type:"hr",raw:me(e[0],` -`)}}blockquote(r){let e=this.rules.block.blockquote.exec(r);if(e){let t=me(e[0],` +`)}t.dispatch({changes:{from:i.from,to:i.to,insert:s},selection:{anchor:i.from+s.length},scrollIntoView:!0,userEvent:"input"}),t.focus()}function Qi(t){let e=t.state.selection.main,r=t.state.sliceDoc(e.from,e.to)||Ee("\u94FE\u63A5","link"),n=`[${r}](https://)`;return t.dispatch({changes:{from:e.from,to:e.to,insert:n},selection:Z.range(e.from+r.length+3,e.from+n.length-1),userEvent:"input"}),t.focus(),!0}function $i(t){let e=t.state.selection.main,r=t.state.sliceDoc(e.from,e.to);return t.dispatch({changes:{from:e.from,to:e.to,insert:`[[${r}]]`},selection:{anchor:e.from+2+r.length},userEvent:"input"}),t.focus(),!0}var Ko=null,Jo="",Mu=0,at=new Map;function Si(){return typeof document<"u"&&document.documentElement.dataset.theme==="dark"?"dark":"neutral"}async function Uu(){Ko??=import("./chunks/mermaid.core-3W6VKKIW.js").then(r=>r.default);let t=await Ko,e=Si();return Jo!==e&&(t.initialize({startOnLoad:!1,securityLevel:"strict",theme:e,fontFamily:"inherit"}),Jo=e),t}async function Vu(t){let e=Si()+` +`+t,r=at.get(e);if(r)return r;let n=await Uu(),i=`ivy-mermaid-${++Mu}`;try{let{svg:s}=await n.render(i,t);return at.size>64&&at.delete(at.keys().next().value),at.set(e,s),s}finally{document.getElementById("d"+i)?.remove(),document.getElementById(i)?.remove()}}function Gu(t,e){return t.classList.add("mermaid-diagram"),t.setAttribute("role","img"),t.setAttribute("aria-label","Mermaid"),Vu(e).then(n=>{t.innerHTML=n,t.classList.remove("mermaid-error")},n=>{t.classList.add("mermaid-error"),t.textContent="Mermaid: "+String(n?.message??n).split(` +`)[0]})}var bi=class extends ee{constructor(r){super();this.code=r}eq(r){return r.code===this.code}toDOM(){let r=document.createElement("div");r.className="cm-mermaid";let n=Si()+` +`+this.code,i=at.get(n);return i?(r.classList.add("mermaid-diagram"),r.innerHTML=i):(r.classList.add("cm-mermaid-loading"),Gu(r,this.code).finally(()=>r.classList.remove("cm-mermaid-loading"))),r}get estimatedHeight(){return 200}ignoreEvent(){return!1}};function Iu(t){let e=[];return R(t).iterate({enter(r){if(r.name!=="FencedCode")return;let n=r.node.getChild("CodeInfo");if(!n||t.sliceDoc(n.from,n.to).trim().toLowerCase()!=="mermaid")return!1;let i=r.node.getChild("CodeText");return e.push({from:r.from,to:r.to,code:i?t.sliceDoc(i.from,i.to):""}),!1}}),e}function ki(t,e,r){return t.selection.ranges.some(n=>n.from<=r&&n.to>=e)}var el=q.define();function tl(t,e){let r=[];for(let n of Iu(t)){if(e&&ki(t,n.from,n.to)||!n.code.trim())continue;let i=t.doc.lineAt(n.from).from,s=t.doc.lineAt(n.to).to;r.push(v.replace({widget:new bi(n.code),block:!0}).range(i,s))}return v.set(r,!0)}function rl(){return[ie.define({create:e=>({focused:!1,deco:tl(e,!1)}),update(e,r){let n=e.focused;for(let i of r.effects)i.is(el)&&(n=i.value);return n!==e.focused||r.docChanged||r.selection||R(r.startState)!==R(r.state)?{focused:n,deco:tl(r.state,n)}:e},provide:e=>X.decorations.from(e,r=>r.deco)}),X.focusChangeEffect.of((e,r)=>el.of(r)),X.domEventHandlers({mousedown(e,r){let n=e.target.closest(".cm-mermaid");if(!n)return!1;let i=r.posAtDOM(n),s=r.state.doc.lineAt(i);e.preventDefault();let a=s.number"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}function nl(t){let e=t.trim();return e.startsWith("|")&&(e=e.slice(1)),e.endsWith("|")&&!e.endsWith("\\|")&&(e=e.slice(0,-1)),e.split(/(?r.trim().replace(/\\\|/g,"|"))}function Bu(t){let e=t.split(` +`).filter(i=>i.trim());if(e.length<2)return"";let r=nl(e[1]).map(i=>/^:-+:$/.test(i)?"center":/^-+:$/.test(i)?"right":""),n=(i,s)=>""+nl(i).map((a,o)=>`<${s}${r[o]?` style="text-align:${r[o]}"`:""}>${Du(a)}`).join("")+"";return`${n(e[0],"th")}${e.slice(2).map(i=>n(i,"td")).join("")}
`}var Pi=class extends ee{constructor(r,n){super();this.src=r;this.render=n}eq(r){return r.src===this.src}toDOM(){let r=document.createElement("div");return r.className="cm-table prose-ivy",r.innerHTML=this.render(this.src),r}ignoreEvent(){return!1}};function Nu(t){let e=[];return R(t).iterate({enter(r){if(r.name==="Table")return e.push({from:r.from,to:r.to}),!1;if(r.name==="FencedCode"||r.name==="CodeBlock")return!1}}),e}var il=q.define();function al(t,e,r){return t.selection.ranges.some(n=>n.from<=r&&n.to>=e)}function sl(t,e,r){let n=[];for(let i of Nu(t)){if(e&&al(t,i.from,i.to))continue;let s=t.doc.lineAt(i.from).from,a=t.doc.lineAt(i.to).to;n.push(v.replace({widget:new Pi(t.sliceDoc(s,a),r),block:!0}).range(s,a))}return v.set(n,!0)}function ol(t,e,r,n){return!(n&&al(t,e,r))}function ll(t){let e=n=>t.renderBlock?.(n)||Bu(n);return[ie.define({create:n=>({focused:!1,deco:sl(n,!1,e)}),update(n,i){let s=n.focused;for(let a of i.effects)a.is(il)&&(s=a.value);return s!==n.focused||i.docChanged||i.selection||R(i.startState)!==R(i.state)?{focused:s,deco:sl(i.state,s,e)}:n},provide:n=>X.decorations.from(n,i=>i.deco)}),X.focusChangeEffect.of((n,i)=>il.of(i)),X.domEventHandlers({mousedown(n,i){let s=n.target.closest(".cm-table");if(!s)return!1;let a=n.target.closest("a");if(n.preventDefault(),a?.dataset.note||a?.classList.contains("missing"))return t.openNote(a.dataset.note??"",a.dataset.title??a.textContent??"",n.button===1||n.shiftKey),!0;if(a?.href&&/^https?:/i.test(a.href))return window.open(a.href,"_blank","noopener"),!0;let o=i.posAtDOM(s),l=i.state.doc.lineAt(o),O=n.target.closest("tr"),c=[...s.querySelectorAll("tr")],h=O?c.indexOf(O):0;h>0&&h++;let p=i.state.doc.line(Math.min(l.number+Math.max(0,h),i.state.doc.lines));return i.dispatch({selection:{anchor:p.from+Math.min(2,p.length)}}),i.focus(),!0}})]}var Fu=/^ivy:\/\/res\/([A-Za-z0-9_-]{8,64})/,wi=class extends ee{constructor(r,n,i){super();this.src=r;this.alt=n;this.kind=i}eq(r){return r.src===this.src&&r.alt===this.alt&&r.kind===this.kind}toDOM(){let r=document.createElement("span");if(r.className="cm-media",this.kind==="video"||this.kind==="audio"){let n=document.createElement(this.kind);n.src=this.src,n.controls=!0,n.preload="metadata",r.appendChild(n)}else if(this.kind==="file"){let n=document.createElement("a");n.className="cm-file-card",n.href=this.src,n.target="_blank",n.rel="noopener",n.textContent="\u{1F4CE} "+(this.alt||"file"),r.appendChild(n)}else{let n=document.createElement("img");n.src=this.src,n.alt=this.alt,n.loading="lazy",n.onerror=()=>r.classList.add("cm-media-broken"),r.appendChild(n)}return r}ignoreEvent(){return!1}},yi=class extends ee{constructor(r,n){super();this.checked=r;this.pos=n}eq(r){return r.checked===this.checked&&r.pos===this.pos}toDOM(r){let n=document.createElement("input");return n.type="checkbox",n.className="cm-task",n.checked=this.checked,n.setAttribute("aria-label",this.checked?Ee("\u5DF2\u5B8C\u6210","Done"):Ee("\u5F85\u529E","To-do")),n.addEventListener("mousedown",i=>{i.preventDefault();let a=r.state.sliceDoc(this.pos,this.pos+3)==="[ ]"?"[x]":"[ ]";r.dispatch({changes:{from:this.pos,to:this.pos+3,insert:a}})}),n}ignoreEvent(){return!0}},Zi=class extends ee{toDOM(){let e=document.createElement("span");return e.className="cm-hr-widget",e}eq(){return!0}},Xi=class extends ee{toDOM(){let e=document.createElement("span");return e.className="cm-bullet",e.textContent="\u2022",e}eq(){return!0}},se=v.replace({}),xi=t=>v.line({class:t}),jt=t=>v.mark({class:t});function Hu(t){let e=new Set;for(let r of t.selection.ranges){let n=t.doc.lineAt(r.from).number,i=t.doc.lineAt(r.to).number;for(let s=n;s<=i;s++)e.add(s)}return e}function Ku(t,e,r){return t.selection.ranges.some(n=>n.from<=r&&n.to>=e)}var Ju=/\[\[([^[\]\n]+?)\]\]/g;function Ol(t,e,r){let{state:n}=t,i=[],s=r?Hu(n):new Set,a=c=>s.has(n.doc.lineAt(c).number),o=(c,h)=>r&&Ku(n,c,h),l=[];for(let{from:c,to:h}of t.visibleRanges){R(n).iterate({from:c,to:h,enter(u){let d=u.name,m=/^ATXHeading(\d)$/.exec(d);if(m){let g=n.doc.lineAt(u.from);if(i.push(xi(`cm-h cm-h${m[1]}`).range(g.from)),!a(u.from)){let b=u.node.getChild("HeaderMark");b&&i.push(se.range(b.from,Math.min(b.to+1,g.to)))}return}switch(d){case"Table":return ol(n,u.from,u.to,r)?!1:void 0;case"FencedCode":case"CodeBlock":{l.push([u.from,u.to]);let g=u.node.getChild("CodeInfo"),b=u.node.getChild("CodeText");if(g&&b&&n.sliceDoc(g.from,g.to).trim().toLowerCase()==="mermaid"&&n.sliceDoc(b.from,b.to).trim()&&!(r&&ki(n,u.from,u.to)))return!1;let Q=n.doc.lineAt(u.from).number,k=n.doc.lineAt(u.to).number;if(d==="FencedCode"&&!o(u.from,u.to)){let y=n.doc.line(Q),w=n.doc.line(k);y.to>y.from&&i.push(se.range(y.from,y.to)),k!==Q&&w.to>w.from&&/^\s*(```|~~~)/.test(w.text)&&i.push(se.range(w.from,w.to))}for(let y=Q;y<=k;y++){let w=n.doc.line(y),_="cm-codeblock";y===Q&&(_+=" cm-codeblock-first"),y===k&&(_+=" cm-codeblock-last"),i.push(xi(_).range(w.from))}return!1}case"StrongEmphasis":case"Emphasis":case"Strikethrough":case"InlineCode":{let g=d==="StrongEmphasis"?"cm-strong":d==="Emphasis"?"cm-em":d==="Strikethrough"?"cm-strike":"cm-inline-code";if(i.push(jt(g).range(u.from,u.to)),!o(u.from,u.to)){let b=d==="InlineCode"?"CodeMark":d==="Strikethrough"?"StrikethroughMark":"EmphasisMark",Q=u.node.firstChild;for(;Q;)Q.name===b&&i.push(se.range(Q.from,Q.to)),Q=Q.nextSibling}return d!=="InlineCode"}case"Link":{if(o(u.from,u.to))return;let g=u.node.getChildren("LinkMark"),b=u.node.getChild("URL");return g.length>=2&&(i.push(se.range(g[0].from,g[0].to)),i.push(jt("cm-link").range(g[0].to,g[1].from)),i.push(se.range(g[1].from,u.to))),!1}case"Image":{let g=u.node.getChild("URL");if(!g)return!1;let b=n.sliceDoc(g.from,g.to),Q=Fu.exec(b),k=Q?e.resolveResource(Q[1]):b,y=Q?e.resourceKind(Q[1]):void 0,w=u.node.getChildren("LinkMark"),_=w.length>=2?n.sliceDoc(w[0].to,w[1].from):"";if(!k||/^javascript:/i.test(k))return!1;let G=new wi(k,_,y);return a(u.from)?i.push(v.widget({widget:G,side:1}).range(u.to)):i.push(v.replace({widget:G}).range(u.from,u.to)),!1}case"Blockquote":{let g=n.doc.lineAt(u.from).number,b=n.doc.lineAt(u.to).number;for(let Q=g;Q<=b;Q++)i.push(xi("cm-quote").range(n.doc.line(Q).from));return}case"QuoteMark":{if(!a(u.from)){let g=n.sliceDoc(u.to,u.to+1)===" "?u.to+1:u.to;i.push(se.range(u.from,g))}return}case"HorizontalRule":{a(u.from)||i.push(v.replace({widget:new Zi}).range(u.from,u.to));return}case"ListMark":{let g=n.sliceDoc(u.from,u.to),b=g==="-"||g==="*"||g==="+",Q=n.sliceDoc(u.to,u.to+4),k=/^ \[[ xX]\]/.test(Q);b&&!a(u.from)?k?i.push(se.range(u.from,u.to+1)):i.push(v.replace({widget:new Xi}).range(u.from,u.to)):i.push(jt("cm-list-mark").range(u.from,u.to));return}case"TaskMarker":{let g=/x/i.test(n.sliceDoc(u.from,u.to));if(!o(u.from,u.to)&&(i.push(v.replace({widget:new yi(g,u.from)}).range(u.from,u.to)),g)){let b=n.doc.lineAt(u.from);u.to+1d>=w&&m<=_))continue;let g=u[1],b=g.indexOf("|"),Q=(b>=0?g.slice(0,b):g).split("#")[0].trim(),k=!!e.resolveTitle(Q),y={"data-wiki":Q};if(o(d,m)){i.push(v.mark({class:"cm-wikilink cm-wikilink-src"+(k?"":" cm-wikilink-missing"),attributes:y}).range(d,m));continue}i.push(se.range(d,d+2+(b>=0?b+1:0))),i.push(v.mark({class:"cm-wikilink cm-wikilink-rendered"+(k?"":" cm-wikilink-missing"),attributes:y}).range(d+2+(b>=0?b+1:0),m-2)),i.push(se.range(m-2,m))}}let O=i.filter(c=>c.value.point===!0);return{all:v.set(i,!0),atomic:v.set(O,!0)}}function cl(t){let e=ve.fromClass(class{decorations;atomic;constructor(r){let n=Ol(r,t,r.hasFocus);this.decorations=n.all,this.atomic=n.atomic}update(r){if(r.docChanged||r.viewportChanged||r.selectionSet||r.focusChanged||R(r.startState)!==R(r.state)){let n=Ol(r.view,t,r.view.hasFocus);this.decorations=n.all,this.atomic=n.atomic}}},{decorations:r=>r.decorations,eventHandlers:{mousedown(r,n){let i=r.target.closest(".cm-wikilink");if(!i)return!1;let s=i.classList.contains("cm-wikilink-rendered"),a=r.button===1||r.shiftKey;if(r.button>1||!s&&!(r.metaKey||r.ctrlKey||r.button===1))return!1;let o=i.dataset.wiki??"";return r.preventDefault(),t.openNote(t.resolveTitle(o),o,a),!0},click(r){let n=r.target.closest(".cm-link, .cm-file-card");return n&&(r.metaKey||r.ctrlKey)&&n instanceof HTMLAnchorElement?(window.open(n.href,"_blank","noopener"),!0):!1}}});return[e,rl(),ll(t),X.atomicRanges.of(r=>r.plugin(e)?.atomic??v.none)]}var hl=X.theme({"&":{color:"rgb(var(--ink))",backgroundColor:"transparent",height:"100%"},"&.cm-focused":{outline:"none"},".cm-scroller":{fontFamily:"inherit",lineHeight:"1.85",overflow:"visible"},".cm-content":{padding:"0 0 40vh",caretColor:"rgb(var(--ivy))"},".cm-line":{padding:"0"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"rgb(var(--ivy))",borderLeftWidth:"2px"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, ::selection":{backgroundColor:"rgb(var(--ivy) / 0.2) !important"},".cm-placeholder":{color:"rgb(var(--faint))"},".cm-tooltip":{border:"none",backgroundColor:"rgb(var(--surface))",borderRadius:"14px",boxShadow:"var(--shadow-lift)",overflow:"hidden"},".cm-tooltip-autocomplete > ul":{fontFamily:"inherit",maxHeight:"260px",padding:"4px"},".cm-tooltip-autocomplete > ul > li":{padding:"7px 10px",borderRadius:"10px",lineHeight:"1.4"},".cm-tooltip-autocomplete > ul > li[aria-selected]":{backgroundColor:"rgb(var(--sunken))",color:"rgb(var(--ink))"},".cm-completionDetail":{marginLeft:"8px",color:"rgb(var(--muted))",fontStyle:"normal",fontSize:"12px"},".cm-completionIcon":{display:"none"},".cm-panels":{backgroundColor:"rgb(var(--surface))",color:"rgb(var(--ink))",border:"none"},".cm-searchMatch":{backgroundColor:"rgb(var(--warn) / 0.3)"},".cm-searchMatch-selected":{backgroundColor:"rgb(var(--warn) / 0.55)"}}),ul=us(hs.define([{tag:f.heading,fontWeight:"600"},{tag:f.strong,fontWeight:"600"},{tag:f.emphasis,fontStyle:"italic"},{tag:f.strikethrough,textDecoration:"line-through"},{tag:f.link,color:"rgb(var(--ivy))"},{tag:f.url,color:"rgb(var(--ivy))"},{tag:f.monospace,fontFamily:"var(--font-mono)",color:"rgb(var(--warn-ink))"},{tag:f.quote,color:"rgb(var(--ink-2))"},{tag:[f.processingInstruction,f.contentSeparator,f.meta],color:"rgb(var(--faint))"},{tag:f.labelName,color:"rgb(var(--muted))"}]));function pl(t){return e=>{let r=e.matchBefore(/\[\[[^\]\n|#]*$/);if(!r)return null;let n=r.text.slice(2).toLowerCase(),i=e.state.sliceDoc(e.pos,e.pos+2),s=[],a=new Set;for(let o of t())if(!(!o.title||a.has(o.title))&&(a.add(o.title),!(n&&!o.title.toLowerCase().includes(n))&&(s.push({label:o.title,detail:o.detail,type:"text",boost:o.title.toLowerCase().startsWith(n)?1:0,apply:(l,O,c,h)=>{let p=i==="]]"?"":"]]";l.dispatch({changes:{from:c,to:h,insert:O.label+p},selection:{anchor:c+O.label.length+2}})}}),s.length>=50)))break;if(n&&!a.has(r.text.slice(2))){let o=r.text.slice(2);s.push({label:o,detail:Ee("\u65B0\u5EFA\u94FE\u63A5","New link"),type:"keyword",boost:-1,apply:(l,O,c,h)=>l.dispatch({changes:{from:c,to:h,insert:o+(i==="]]"?"":"]]")},selection:{anchor:c+o.length+2}})})}return{from:r.from+2,options:s,validFor:/^[^\]\n|#]*$/}}}function kr(t){return t.trim().replace(/\s+/g," ").toLowerCase()}function fl(t){let e=t,r,n,i=e.indexOf("|");i>=0&&(r=e.slice(i+1).trim(),e=e.slice(0,i));let s=e.indexOf("#");return s>=0&&(n=e.slice(s+1).trim(),e=e.slice(0,s)),{target:e.trim(),alias:r,heading:n}}function ji(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ve=ji();function wl(t){Ve=t}var Me={exec:()=>null};function We(t){let e=[];return r=>{let n=Math.max(0,Math.min(3,r-1)),i=e[n];return i||(i=t(n),e[n]=i),i}}function x(t,e=""){let r=typeof t=="string"?t:t.source,n={replace:(i,s)=>{let a=typeof s=="string"?s:s.source;return a=a.replace(C.caret,"$1"),r=r.replace(i,a),n},getRegex:()=>new RegExp(r,e)};return n}var yl=((t="")=>{try{return!!new RegExp("(?<=1)(?/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+)[ \t]*)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,blockquoteMarkerWhitespace:/^( {0,3}>)([ \t]+)/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\][ \t]+\S/,listReplaceTask:/^\[[ xX]\][ \t]+/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^
/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:We(t=>new RegExp(`^ {0,${t}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:We(t=>new RegExp(`^ {0,${t}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:We(t=>new RegExp(`^ {0,${t}}(?:\`\`\`|~~~)`)),headingBeginRegex:We(t=>new RegExp(`^ {0,${t}}#{1,6}(?:\\s|$)`)),pedanticHeadingBeginRegex:We(t=>new RegExp(`^ {0,${t}}#`)),htmlBeginRegex:We(t=>new RegExp(`^ {0,${t}}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|new RegExp(`^ {0,${t}}>`))},ep=/^(?:[ \t]*(?:\n|$))+/,tp=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,rp=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}(?:(?=`)\1`*|(?=~)\1~*) *(?=\n|$)|$)/,Yt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,np=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,_i=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Zl=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+)[ \t]*(?:\n+|$)/,Xl=x(Zl).replace(/bull/g,_i).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),ip=x(Zl).replace(/bull/g,_i).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ci=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,sp=/^[^\n]+/,Yi=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\\n]|\n(?![ \t]*\n))+/,ap=x(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Yi).replace("title",/(?:"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\\n]|\n(?!\n))*'|\((?:\\[\s\S]|[^()\\])*\))/).getRegex(),op=x(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,_i).getRegex(),zt="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",zi=/|$))/,lp=x("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|[^\\n]*\\n*|$)|[^\\n]*\\n*|$)||$)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",zi).replace("tag",zt).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),vl=t=>x(Ci).replace("hr",Yt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",t).replace("html"," {0,3}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?| ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/).replace("paragraph",cp).getRegex(),qi={blockquote:hp,code:tp,def:ap,fences:rp,heading:np,hr:Yt,html:lp,lheading:Xl,list:op,newline:ep,paragraph:Op,table:Me,text:sp},dl=x("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Yt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html"," {0,3}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html"," {0,3}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|(?: *\\n{2,}|\\s*$)|\\s]*)*?/?>(?: *\\n{2,}|\\s*$))`).replace("comment",zi).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Me,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:x(Ci).replace("hr",Yt).replace("heading",` *#{1,6} *[^ +]`).replace("lheading",Xl).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},fp=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,dp=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Tl=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,mp=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\`+)[^`]+\k(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",yl?"(?`+)[^`]+\k(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),jl=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,kp=x(jl,"u").replace(/punct/g,ae).getRegex(),Pp=x(jl,"u").replace(/punct/g,Rl).getRegex(),xp=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,wp=x(xp,"u").replace(/openQuote/g,Qp).replace(/punct/g,ae).getRegex(),_l="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",yp=x(_l,"gu").replace(/notPunctSpace/g,qt).replace(/punctSpace/g,Ot).replace(/punct/g,ae).getRegex(),Zp=x(_l,"gu").replace(/notPunctSpace/g,bp).replace(/punctSpace/g,$p).replace(/punct/g,Rl).getRegex(),Xp="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",vp=x(Xp,"gu").replace(/notPunctSpace/g,qt).replace(/punctSpace/g,Ot).replace(/punct/g,ae).getRegex(),Tp=x("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,qt).replace(/punctSpace/g,Ot).replace(/punct/g,ae).getRegex(),Rp="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",jp=x(Rp,"gu").replace(/notPunctSpace/g,qt).replace(/punctSpace/g,Ot).replace(/punct/g,ae).getRegex(),_p=x(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,ae).getRegex(),Cp="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Yp=x(Cp,"gu").replace(/notPunctSpace/g,qt).replace(/punctSpace/g,Ot).replace(/punct/g,ae).getRegex(),zp=x(/\\(punct)/,"gu").replace(/punct/g,ae).getRegex(),qp=x(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,"gu").replace(/punct/g,ae).getRegex(),Ap=x(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Lp=x(zi).replace("(?:-->|$)","-->").getRegex(),Ep=x("^comment|^|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",Lp).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Cl=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,wr=x(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",Cl).getRegex(),Wp=x(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label",wr).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\((?:\\[\s\S]|[^)\\])*\)/).getRegex(),Mp=x(/^!?\[(label)\]\[(ref)\]/).replace("label",wr).replace("ref",Yi).getRegex(),Up=x(/^!?\[(ref)\](?:\[\])?/).replace("ref",Yi).getRegex(),ml=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Vp=x(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",Cl).getRegex(),Gp=x("reflink|nolink(?!\\()","g").replace("reflink",x(/^!?\[(label)\]\[(ref)\]/).replace("label",Vp).replace("ref",ml).getRegex()).replace("nolink",x(/^!?\[(ref)\](?:\[\])?/).replace("ref",ml).getRegex()).getRegex(),gl=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ip=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,Dp=x(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,Ip).getRegex(),Ai={_backpedal:Me,anyPunctuation:zp,anyPunctuationOutsideCode:qp,autolink:Ap,blockSkip:Sp,br:Tl,code:dp,del:Me,delLDelim:Me,delRDelim:Me,emStrongLDelim:kp,emStrongRDelimAst:yp,emStrongRDelimUnd:Tp,escape:fp,link:Wp,nolink:Up,punctuation:gp,reflink:Mp,reflinkSearch:Gp,tag:Ep,text:mp,url:Me},Bp={...Ai,emStrongLDelim:wp,emStrongRDelimAst:vp,emStrongRDelimUnd:jp,link:x(/^!?\[(label)\]\((.*?)\)/).replace("label",wr).getRegex(),reflink:x(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",wr).getRegex()},vi={...Ai,emStrongRDelimAst:Zp,emStrongLDelim:Pp,delLDelim:_p,delRDelim:Yp,url:x(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",Dp).replace("protocol",gl).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:x(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},Ql=t=>Fp[t];function H(t,e){if(e){if(C.escapeTest.test(t))return t.replace(C.escapeReplace,Ql)}else if(C.escapeTestNoEncode.test(t))return t.replace(C.escapeReplaceNoEncode,Ql);return t}function Hp(t){return C.numericCharacterReference.test(t)?t.replace(C.numericCharacterReferenceOrAmpersand,(e,r,n)=>{if(r===void 0&&n===void 0)return"&";let i=r===void 0?Number.parseInt(n,16):Number.parseInt(r,10);return i===0||i>1114111||i>=55296&&i<=57343?"\uFFFD":i===38?"&":String.fromCodePoint(i)}):t}function $l(t){try{t=encodeURI(t).replace(C.percentDecode,"%")}catch{return null}return t}function bl(t,e){let r=t.replace(C.findPipe,(s,a,o)=>{let l=!1,O=a;for(;--O>=0&&o[O]==="\\";)l=!l;return l?"|":" |"}),n=r.split(C.splitPipe),i=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length=0&&C.blankLine.test(e[r]);)r--;return e.length-r<=2?t:e.slice(0,r+1).join(` +`)}function yr(t){return t.trim().replace(C.multipleSpaceGlobal," ").toLowerCase().toUpperCase().toLowerCase()}function kl(t,e){if(t.indexOf(e[0])===-1&&t.indexOf(e[1])===-1)return-1;let r=0;for(let n=0;n0?-2:-1}var lt=new WeakMap;function Li(t){let e={"*":-1,_:-1},r=-1,n=t.length;for(let i=0;i{let a=s.match(r.other.beginningSpace);if(a===null)return s;let[o]=a;return s.slice(Math.min(o.length,i.length))}).join(` +`)}function xl(t,e,r,n){if(!e.includes("<"))return!1;for(let i=0;ie.length-i)return!0;i+=a[0].length-1}}return!1}var ot=class{options;rules;lexer;constructor(t){this.options=t||Ve}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let r=this.options.pedantic?e[0]:Sl(e[0]),n=r.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:r,codeBlockStyle:"indented",text:n}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let r=e[0],n=rf(r,e[3]||"",this.rules);return{type:"code",raw:r,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let r=e[2].trim();if(this.rules.other.endingHash.test(r)){let n=me(r,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceTabChar.test(n))&&(r=n.trim())}return{type:"heading",raw:me(e[0],` +`),depth:e[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:me(e[0],` +`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let r=me(e[0],` `).split(` -`),n="",i="",s=[];for(;t.length>0;){let a=!1,o=[],l;for(l=0;ld+kr(m,d.length)).replace(this.rules.other.blockquoteSetextReplace,` +`),n="",i="",s=[];for(;r.length>0;){let a=!1,o=[],l;for(l=0;ld+xr(m,d.length)).replace(this.rules.other.blockquoteSetextReplace,` $1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n} ${O}`:O,i=i?`${i} -${c}`:c;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,s,!0),this.lexer.state.top=h,t.length===0)break;let p=s.at(-1);if(p?.type==="code"||p?.type==="heading"||p?.type==="hr"||p?.type==="html"||p?.type==="table")break;if(p?.type==="blockquote"){let u=p,d=t.join(` +${c}`:c;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,s,!0),this.lexer.state.top=h,r.length===0)break;let p=s.at(-1);if(p?.type==="code"||p?.type==="heading"||p?.type==="hr"||p?.type==="html"||p?.type==="table")break;if(p?.type==="blockquote"){let u=p,d=r.join(` `),m=u.raw+` `+d.replace(this.rules.other.blockquoteSetextReplace2,""),g=this.blockquote(m);s[s.length-1]=g;let b=m.substring(g.raw.length).replace(/^\n/,""),Q=b?b.split(` -`).length:0,k=Q?t.slice(0,-Q):t;if(k.length>0&&(n=`${n} +`).length:0,k=Q?r.slice(0,-Q):r;if(k.length>0&&(n=`${n} ${k.join(` -`)}`),i=i.substring(0,i.length-u.text.length)+g.text,t=t.slice(k.length),t.length>0&&this.rules.other.blockquoteStart.test(t[0]))continue;break}else if(p?.type==="list"){let u=p,d=u.raw+` -`+t.join(` +`)}`),i=i.substring(0,i.length-u.text.length)+g.text,r=r.slice(k.length),r.length>0&&this.rules.other.blockquoteStart.test(r[0]))continue;break}else if(p?.type==="list"){let u=p,d=u.raw+` +`+r.join(` `),m=this.list(d);s[s.length-1]=m;let g=m.raw.length>u.raw.length?d.slice(u.raw.length+1,m.raw.length).split(` -`).length:0;if(g>0){let b=t.slice(0,g).join(` +`).length:0;if(g>0){let b=r.slice(0,g).join(` `);n=`${n} ${b}`,i=`${i} -${b}`}t=t.slice(g);continue}}return{type:"blockquote",raw:n,tokens:s,text:i}}}list(r){let e=this.rules.block.list.exec(r);if(e){let t=r,n=()=>t.length-r.length,i=e[1].trim(),s=i.length>1,a={type:"list",raw:"",ordered:s,start:s?+i.slice(0,-1):"",loose:!1,items:[]};i=s?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=s?i:"[*+-]");let o=this.rules.other.listItemRegex(i),l=!1;for(;r;){let c=!1,h="";if(!(e=o.exec(r))||this.rules.block.hr.test(r))break;let p=n();r=r.substring(e[0].length);let u=e[2].split(` -`,1)[0],d=e[1].length,m=this.options.pedantic?kr(u,d):u.replace(this.rules.other.leadingSpaceTab,y=>kr(y,d)),g=r.split(` -`,1)[0],b=!m.trim(),Q=0;if(this.options.pedantic?(Q=2,h=m.trimStart()):b?Q=d+1:(Q=m.search(this.rules.other.nonSpaceChar),Q=Q>4?1:Q,h=m.slice(Q),Q+=d),b&&this.rules.other.blankLine.test(g)&&(r=r.substring(g.length+1),c=!0),!c){let y=this.rules.other.nextBulletRegex(Q),w=this.rules.other.hrRegex(Q),_=this.rules.other.fencesBeginRegex(Q),G=this.options.pedantic?this.rules.other.pedanticHeadingBeginRegex(Q):this.rules.other.headingBeginRegex(Q),Ze=this.rules.other.htmlBeginRegex(Q),zt=this.rules.other.blockquoteBeginRegex(Q);for(;r;){let lt=r.split(` -`,1)[0],Ve;if(g=lt,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),Ve=g):Ve=g.replace(this.rules.other.leadingSpaceTab,Tr=>kr(Tr)),_.test(g)||G.test(g)||Ze.test(g)||zt.test(g)||y.test(g)||w.test(g))break;if(Ve.search(this.rules.other.nonSpaceChar)>=Q||!g.trim())h+=` -`+Ve.slice(Q);else{if(b||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||_.test(m)||G.test(m)||Ze.test(m)||w.test(m))break;let Tr=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(g)&&this.rules.block.lheading.test(`${m} -${g}`)?` ${Ve.replace(/^ {0,3}/,"")}`:g;h+=` -`+Tr}b=!g.trim(),r=r.substring(lt.length+1),m=Ve.slice(Q)}}let k=t.slice(p,n());a.loose||(l?a.loose=!0:this.rules.other.doubleBlankLine.test(k)&&(l=!0)),a.items.push({type:"list_item",raw:k,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]})}let O=a.items.at(-1);if(O)O.raw=O.raw.trimEnd(),O.text=O.text.trimEnd();else return;a.raw=t.slice(0,n()).trimEnd();for(let c of a.items)if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),!a.loose){let h=c.tokens.filter(u=>u.type==="space"),p=h.length>0&&h.some(u=>this.rules.other.anyLine.test(u.raw));a.loose=p}for(let c of a.items){let h=c.tokens[0];if(c.task&&(h?.type==="text"||h?.type==="paragraph")){c.text=c.text.replace(this.rules.other.listReplaceTask,""),h.raw=h.raw.replace(this.rules.other.listReplaceTask,""),h.text=h.text.replace(this.rules.other.listReplaceTask,"");for(let u=this.lexer.inlineQueue.length-1;u>=0;u--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)){this.lexer.inlineQueue[u].src=this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(c.raw);if(p){let u={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};c.checked=u.checked,a.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=u.raw+c.tokens[0].raw,c.tokens[0].text=u.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(u)):c.tokens.unshift({type:"paragraph",raw:u.raw,text:u.raw,tokens:[u]}):c.tokens.unshift(u)}}else c.task&&(c.task=!1)}if(a.loose)for(let c of a.items){c.loose=!0;for(let h of c.tokens)h.type==="text"&&(h.type="paragraph")}return a}}html(r){let e=this.rules.block.html.exec(r);if(e){let t=Ql(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(r){let e=this.rules.block.def.exec(r);if(e){if(!this.rules.other.startAngleBracket.test(e[2])&&$l(e[2],"()")!==-1)return;let t=xr(e[1]),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:me(e[0],` -`),href:n,title:i}}}table(r){let e=this.rules.block.table.exec(r);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=gl(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(` +${b}`}r=r.slice(g);continue}}return{type:"blockquote",raw:n,tokens:s,text:i}}}list(t){let e=this.rules.block.list.exec(t);if(e){let r=t,n=()=>r.length-t.length,i=e[1].trim(),s=i.length>1,a={type:"list",raw:"",ordered:s,start:s?+i.slice(0,-1):"",loose:!1,items:[]};i=s?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=s?i:"[*+-]");let o=this.rules.other.listItemRegex(i),l=!1;for(;t;){let c=!1,h="";if(!(e=o.exec(t))||this.rules.block.hr.test(t))break;let p=n();t=t.substring(e[0].length);let u=e[2].split(` +`,1)[0],d=e[1].length,m=this.options.pedantic?xr(u,d):u.replace(this.rules.other.leadingSpaceTab,y=>xr(y,d)),g=t.split(` +`,1)[0],b=!m.trim(),Q=0;if(this.options.pedantic?(Q=2,h=m.trimStart()):b?Q=d+1:(Q=m.search(this.rules.other.nonSpaceChar),Q=Q>4?1:Q,h=m.slice(Q),Q+=d),b&&this.rules.other.blankLine.test(g)&&(t=t.substring(g.length+1),c=!0),!c){let y=this.rules.other.nextBulletRegex(Q),w=this.rules.other.hrRegex(Q),_=this.rules.other.fencesBeginRegex(Q),G=this.options.pedantic?this.rules.other.pedanticHeadingBeginRegex(Q):this.rules.other.headingBeginRegex(Q),Xe=this.rules.other.htmlBeginRegex(Q),At=this.rules.other.blockquoteBeginRegex(Q);for(;t;){let ct=t.split(` +`,1)[0],Ie;if(g=ct,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),Ie=g):Ie=g.replace(this.rules.other.leadingSpaceTab,jr=>xr(jr)),_.test(g)||G.test(g)||Xe.test(g)||At.test(g)||y.test(g)||w.test(g))break;if(Ie.search(this.rules.other.nonSpaceChar)>=Q||!g.trim())h+=` +`+Ie.slice(Q);else{if(b||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||_.test(m)||G.test(m)||Xe.test(m)||w.test(m))break;let jr=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(g)&&this.rules.block.lheading.test(`${m} +${g}`)?` ${Ie.replace(/^ {0,3}/,"")}`:g;h+=` +`+jr}b=!g.trim(),t=t.substring(ct.length+1),m=Ie.slice(Q)}}let k=r.slice(p,n());a.loose||(l?a.loose=!0:this.rules.other.doubleBlankLine.test(k)&&(l=!0)),a.items.push({type:"list_item",raw:k,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]})}let O=a.items.at(-1);if(O)O.raw=O.raw.trimEnd(),O.text=O.text.trimEnd();else return;a.raw=r.slice(0,n()).trimEnd();for(let c of a.items)if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),!a.loose){let h=c.tokens.filter(u=>u.type==="space"),p=h.length>0&&h.some(u=>this.rules.other.anyLine.test(u.raw));a.loose=p}for(let c of a.items){let h=c.tokens[0];if(c.task&&(h?.type==="text"||h?.type==="paragraph")){c.text=c.text.replace(this.rules.other.listReplaceTask,""),h.raw=h.raw.replace(this.rules.other.listReplaceTask,""),h.text=h.text.replace(this.rules.other.listReplaceTask,"");for(let u=this.lexer.inlineQueue.length-1;u>=0;u--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)){this.lexer.inlineQueue[u].src=this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(c.raw);if(p){let u={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};c.checked=u.checked,a.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=u.raw+c.tokens[0].raw,c.tokens[0].text=u.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(u)):c.tokens.unshift({type:"paragraph",raw:u.raw,text:u.raw,tokens:[u]}):c.tokens.unshift(u)}}else c.task&&(c.task=!1)}if(a.loose)for(let c of a.items){c.loose=!0;for(let h of c.tokens)h.type==="text"&&(h.type="paragraph")}return a}}html(t){let e=this.rules.block.html.exec(t);if(e){let r=Sl(e[0]);return{type:"html",block:!0,raw:r,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:r}}}def(t){let e=this.rules.block.def.exec(t);if(e){if(!this.rules.other.startAngleBracket.test(e[2])&&kl(e[2],"()")!==-1)return;let r=yr(e[1]),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:r,raw:me(e[0],` +`),href:n,title:i}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let r=bl(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(` `):[],s={type:"table",raw:me(e[0],` -`),header:[],align:[],rows:[]};if(t.length===n.length){for(let a of n)this.rules.other.tableAlignRight.test(a)?s.align.push("right"):this.rules.other.tableAlignCenter.test(a)?s.align.push("center"):this.rules.other.tableAlignLeft.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a({text:o,tokens:this.lexer.inline(o),header:!1,align:s.align[l]})));return s}}lheading(r){let e=this.rules.block.lheading.exec(r);if(e){let t=e[1].trim();return{type:"heading",raw:me(e[0],` -`),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(r){let e=this.rules.block.paragraph.exec(r);if(e){let t=e[1].charAt(e[1].length-1)===` -`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(r){if(this.lexer.state.linkParenPossible===!1)return;let e=this.rules.inline.link.exec(r);if(e){let t=e[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&Sl(r,e[1],t,this.rules))return;let n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let o=me(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=$l(e[2],"()");if(o===-2)return;if(o>-1){let l=(e[0].indexOf("!")===0?5:4)+e[1].length+o;e[2]=e[2].substring(0,o),e[0]=e[0].substring(0,l).trim(),e[3]=""}}let i=me(e[0].slice(0,-1),"\\");if((e[0].length-i.length)%2===0)return;let s=e[2],a="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(s);o&&(s=o[1],a=o[3])}else a=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),bl(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:a&&a.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(r,e){let t;if((t=this.rules.inline.reflink.exec(r))||(t=this.rules.inline.nolink.exec(r))){let n=t[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&Sl(r,t[1],n,this.rules))return;let i=e[xr(t[2]||t[1])];if(!i){let s=t[0].charAt(0);return{type:"text",raw:s,text:s}}return bl(t,i,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let n=this.rules.inline.emStrongLDelim.exec(r);if(!n||!n[1]&&!n[2]&&!n[3]&&!n[4])return;let i=n[0][0],s=t===i,a=e.length-r.length,o=a;for(;!this.options.pedantic&&o>0&&e[o-1]===i;)o--;let l=[...e.slice(Math.max(0,o-2),o)].at(-1)??"",O=l==="*"||l==="_"||!!this.rules.inline.punctuation.exec(l);o_);){if(u=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!u)continue;if(d=[...u].length,n[3]||n[4]){m+=d;continue}else if(n[5]||n[6]||Q){if(s&&(n[5]||n[6]))break;if(b%3&&!((b+d)%3)){g+=d;continue}}if(m-=d,m>0)continue;d=Math.min(d,d+m+g);let G=[...n[0]][0].length,Ze=r.slice(0,p+n.index+G+d);if(Math.min(p,d)%2){let lt=Ze.slice(1,-1);return{type:"em",raw:Ze,text:lt,tokens:this.lexer.inlineTokens(lt)}}let zt=Ze.slice(2,-2);return{type:"strong",raw:Ze,text:zt,tokens:this.lexer.inlineTokens(zt)}}}}codespan(r){let e=this.rules.inline.code.exec(r);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return n&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(r){let e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r,e,t=""){let n=this.rules.inline.delLDelim.exec(r);if(n&&(!n[1]||!t||this.rules.inline.punctuation.exec(t))){let i=[...n[0]].length-1,s,a,o=i,l=this.rules.inline.delRDelim,O=Hp(this,e),c=e.length-r.length+i;if(Oh);){if(s=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!s||(a=[...s].length,a!==i))continue;if(n[3]||n[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let p=[...n[0]][0].length,u=r.slice(0,i+n.index+p+a),d=u.slice(i,-i);return{type:"del",raw:u,text:d,tokens:this.lexer.inlineTokens(d)}}}}autolink(r){let e=this.rules.inline.autolink.exec(r);if(e){let t,n;return e[2]==="@"?(t=e[1],n="mailto:"+t):(t=e[1],n=t),{type:"link",raw:e[0],text:t,href:n,autolink:!0,tokens:[{type:"text",raw:t,text:t}]}}}url(r){let e;if(e=this.rules.inline.url.exec(r)){let t,n;if(e[2]==="@")t=e[0],n="mailto:"+t;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);t=e[0],e[1]==="www."?n="http://"+e[0]:n=e[0]}return{type:"link",raw:e[0],text:t,href:n,autolink:!0,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(r){let e=this.rules.inline.text.exec(r);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:t?e[0]:Dp(e[0]),escaped:t}}}},re=class yi{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Me,this.options.tokenizer=this.options.tokenizer||new st,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let t={other:Y,block:Sr.normal,inline:Rt.normal};this.options.pedantic?(t.block=Sr.pedantic,t.inline=Rt.pedantic):this.options.gfm&&(t.block=Sr.gfm,this.options.breaks?t.inline=Rt.breaks:t.inline=Rt.gfm),this.tokenizer.rules=t}static get rules(){return{block:Sr,inline:Rt}}static lex(e,t){return new yi(t).lex(e)}static lexInline(e,t){return new yi(t).inlineTokens(e)}lex(e){e=e.replace(Y.carriageReturn,` -`),this.blockTokens(e,this.tokens);for(let t=0;t(s=o.call({lexer:this},e,t))?(e=e.substring(s.raw.length),t.push(s),!0):!1))continue;if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length);let o=t.at(-1);s.raw.length===1&&o!==void 0?o.raw+=` -`:t.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length);let o=t.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(` +`),header:[],align:[],rows:[]};if(r.length===n.length){for(let a of n)this.rules.other.tableAlignRight.test(a)?s.align.push("right"):this.rules.other.tableAlignCenter.test(a)?s.align.push("center"):this.rules.other.tableAlignLeft.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a({text:o,tokens:this.lexer.inline(o),header:!1,align:s.align[l]})));return s}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let r=e[1].trim();return{type:"heading",raw:me(e[0],` +`),depth:e[2].charAt(0)==="="?1:2,text:r,tokens:this.lexer.inline(r)}}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let r=e[1].charAt(e[1].length-1)===` +`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:r,tokens:this.lexer.inline(r)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){if(this.lexer.state.linkParenPossible===!1)return;let e=this.rules.inline.link.exec(t);if(e){let r=e[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&xl(t,e[1],r,this.rules))return;let n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let o=me(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=kl(e[2],"()");if(o===-2)return;if(o>-1){let l=(e[0].indexOf("!")===0?5:4)+e[1].length+o;e[2]=e[2].substring(0,o),e[0]=e[0].substring(0,l).trim(),e[3]=""}}let i=me(e[0].slice(0,-1),"\\");if((e[0].length-i.length)%2===0)return;let s=e[2],a="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(s);o&&(s=o[1],a=o[3])}else a=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),Pl(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:a&&a.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){let n=r[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&xl(t,r[1],n,this.rules))return;let i=e[yr(r[2]||r[1])];if(!i){let s=r[0].charAt(0);return{type:"text",raw:s,text:s}}return Pl(r,i,r[0],this.lexer,this.rules)}}emStrong(t,e,r=""){let n=this.rules.inline.emStrongLDelim.exec(t);if(!n||!n[1]&&!n[2]&&!n[3]&&!n[4])return;let i=n[0][0],s=r===i,a=e.length-t.length,o=a;for(;!this.options.pedantic&&o>0&&e[o-1]===i;)o--;let l=[...e.slice(Math.max(0,o-2),o)].at(-1)??"",O=l==="*"||l==="_"||!!this.rules.inline.punctuation.exec(l);o_);){if(u=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!u)continue;if(d=[...u].length,n[3]||n[4]){m+=d;continue}else if(n[5]||n[6]||Q){if(s&&(n[5]||n[6]))break;if(b%3&&!((b+d)%3)){g+=d;continue}}if(m-=d,m>0)continue;d=Math.min(d,d+m+g);let G=[...n[0]][0].length,Xe=t.slice(0,p+n.index+G+d);if(Math.min(p,d)%2){let ct=Xe.slice(1,-1);return{type:"em",raw:Xe,text:ct,tokens:this.lexer.inlineTokens(ct)}}let At=Xe.slice(2,-2);return{type:"strong",raw:Xe,text:At,tokens:this.lexer.inlineTokens(At)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let r=e[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(r),i=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return n&&i&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:e[0],text:r}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,r=""){let n=this.rules.inline.delLDelim.exec(t);if(n&&(!n[1]||!r||this.rules.inline.punctuation.exec(r))){let i=[...n[0]].length-1,s,a,o=i,l=this.rules.inline.delRDelim,O=tf(this,e),c=e.length-t.length+i;if(Oh);){if(s=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!s||(a=[...s].length,a!==i))continue;if(n[3]||n[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let p=[...n[0]][0].length,u=t.slice(0,i+n.index+p+a),d=u.slice(i,-i);return{type:"del",raw:u,text:d,tokens:this.lexer.inlineTokens(d)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let r,n;return e[2]==="@"?(r=e[1],n="mailto:"+r):(r=e[1],n=r),{type:"link",raw:e[0],text:r,href:n,autolink:!0,tokens:[{type:"text",raw:r,text:r}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let r,n;if(e[2]==="@")r=e[0],n="mailto:"+r;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);r=e[0],e[1]==="www."?n="http://"+e[0]:n=e[0]}return{type:"link",raw:e[0],text:r,href:n,autolink:!0,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let r=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:r?e[0]:Hp(e[0]),escaped:r}}}},re=class Ti{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ve,this.options.tokenizer=this.options.tokenizer||new ot,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let r={other:C,block:Pr.normal,inline:_t.normal};this.options.pedantic?(r.block=Pr.pedantic,r.inline=_t.pedantic):this.options.gfm&&(r.block=Pr.gfm,this.options.breaks?r.inline=_t.breaks:r.inline=_t.gfm),this.tokenizer.rules=r}static get rules(){return{block:Pr,inline:_t}}static lex(e,r){return new Ti(r).lex(e)}static lexInline(e,r){return new Ti(r).inlineTokens(e)}lex(e){e=e.replace(C.carriageReturn,` +`),this.blockTokens(e,this.tokens);for(let r=0;r(s=o.call({lexer:this},e,r))?(e=e.substring(s.raw.length),r.push(s),!0):!1))continue;if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length);let o=r.at(-1);s.raw.length===1&&o!==void 0?o.raw+=` +`:r.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length);let o=r.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(` `)?"":` `)+s.raw,o.text+=` -`+s.text,this.inlineQueue.at(-1).src=o.text):t.push(s);continue}if(s=this.tokenizer.fences(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.heading(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.hr(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.blockquote(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.list(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.html(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.def(e)){e=e.substring(s.raw.length);let o=t.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(` +`+s.text,this.inlineQueue.at(-1).src=o.text):r.push(s);continue}if(s=this.tokenizer.fences(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.heading(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.hr(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.blockquote(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.list(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.html(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.def(e)){e=e.substring(s.raw.length);let o=r.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(` `)?"":` `)+s.raw,o.text+=` -`+s.raw,this.inlineQueue.at(-1).src=o.text):(this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title}),t.push(s));continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),t.push(s);continue}let a=e;if(this.options.extensions?.startBlock){let o=1/0,l=e.slice(1),O;this.options.extensions.startBlock.forEach(c=>{O=c.call({lexer:this},l),typeof O=="number"&&O>=0&&(o=Math.min(o,O))}),o<1/0&&o>=0&&(a=e.substring(0,o+1))}if(this.state.top&&(s=this.tokenizer.paragraph(a))){let o=t.at(-1);n&&o?.type==="paragraph"?(o.raw+=(o.raw.endsWith(` +`+s.raw,this.inlineQueue.at(-1).src=o.text):(this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title}),r.push(s));continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),r.push(s);continue}let a=e;if(this.options.extensions?.startBlock){let o=1/0,l=e.slice(1),O;this.options.extensions.startBlock.forEach(c=>{O=c.call({lexer:this},l),typeof O=="number"&&O>=0&&(o=Math.min(o,O))}),o<1/0&&o>=0&&(a=e.substring(0,o+1))}if(this.state.top&&(s=this.tokenizer.paragraph(a))){let o=r.at(-1);n&&o?.type==="paragraph"?(o.raw+=(o.raw.endsWith(` `)?"":` `)+s.raw,o.text+=` -`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(s),n=a.length!==e.length,e=e.substring(s.raw.length);continue}if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length);let o=t.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(` +`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):r.push(s),n=a.length!==e.length,e=e.substring(s.raw.length);continue}if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length);let o=r.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(` `)?"":` `)+s.raw,o.text+=` -`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(s);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes("["))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!=="!")return!0;for(let n of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let i=n[0],s=i.lastIndexOf("[");if(!(i.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,xr(i.slice(s+1,-1))))&&!(s>1&&this.linkInText(i.slice(1,s-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=n&&e.includes(")");try{return this.#e(e,t)}finally{this.state.linkParenPossible=n}}#e(e,t){let n=e.includes("*")||e.includes("_")||e.includes("~")||this.options.hooks?.emStrongMask||this.tokenizer.emStrong!==st.prototype.emStrong||this.tokenizer.del!==st.prototype.del?this.#r(e):e;Bp(this.tokenizer,n);try{return this.#t(e,n,t)}finally{Np(this.tokenizer)}}#t(e,t,n){let i=!1,s="",a=1/0;for(;e;){if(e.length(o=O.call({lexer:this},e,n))?(e=e.substring(o.raw.length),n.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let O=n.at(-1);o.type==="text"&&O?.type==="text"?(O.raw+=o.raw,O.text+=o.text):n.push(o);continue}if(o=this.tokenizer.emStrong(e,t,s)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.del(e,t,s)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),n.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),n.push(o);continue}let l=e;if(this.options.extensions?.startInline){let O=1/0,c=e.slice(1),h;this.options.extensions.startInline.forEach(p=>{h=p.call({lexer:this},c),typeof h=="number"&&h>=0&&(O=Math.min(O,h))}),O<1/0&&O>=0&&(l=e.substring(0,O+1))}if(o=this.tokenizer.inlineText(l)){e=e.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(s=o.raw.slice(-1)),i=!0;let O=n.at(-1);O?.type==="text"?(O.raw+=o.raw,O.text+=o.text):n.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return n}#r(e){let t=e;if(this.tokens.links&&e.includes("[")){let n=this.tokenizer.rules.inline.reflinkSearch,i=s=>{let a=s.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,xr(s.slice(a+1,-1))))return s;if(a>1&&s.charAt(0)!=="!"){let o=s.slice(1,a-1);if(this.linkInText(o))return"["+o.replace(n,i)+"]["+"a".repeat(s.length-a-2)+"]"}return"["+"a".repeat(s.length-2)+"]"};t=t.replace(n,i)}return t=t.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(n,i,s)=>s?"+".repeat(n.length):i?i+n.slice(i.length,-i.length).replace(/`/g,"+")+i:n),t=t.replace(this.tokenizer.rules.inline.blockSkip,(n,i,s)=>{let a=s?s.length:0;return n.slice(0,a)+"["+"a".repeat(n.length-a-2)+"]"}),t=this.options.hooks?.emStrongMask?.call({lexer:this},t)??t,t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}},wr=class{options;parser;constructor(r){this.options=r||Me}space(r){return""}code({text:r,lang:e,escaped:t}){let n=(e||"").match(Y.notSpaceStart)?.[0],i=r?r.replace(Y.endingNewline,"")+` -`:"";return n?'
'+(t?i:H(i,!0))+`
-`:"
"+(t?i:H(i,!0))+`
-`}blockquote({tokens:r}){return`
-${this.parser.parse(r)}
-`}html({text:r}){return r}def(r){return""}heading({tokens:r,depth:e}){return`${this.parser.parseInline(r)} -`}hr(r){return`
-`}list(r){let e=r.ordered,t=r.start,n="";for(let a=0;a +`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):r.push(s);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}linkInText(e){if(!e.includes("["))return!1;let r=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(r.test(n[0])&&e.charAt(n.index-1)!=="!")return!0;for(let n of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let i=n[0],s=i.lastIndexOf("[");if(!(i.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,yr(i.slice(s+1,-1))))&&!(s>1&&this.linkInText(i.slice(1,s-1))))return!0}return!1}inlineTokens(e,r=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=n&&e.includes(")");try{return this.#e(e,r)}finally{this.state.linkParenPossible=n}}#e(e,r){let n=e.includes("*")||e.includes("_")||e.includes("~")||this.options.hooks?.emStrongMask||this.tokenizer.emStrong!==ot.prototype.emStrong||this.tokenizer.del!==ot.prototype.del?this.#r(e):e;Kp(this.tokenizer,n);try{return this.#t(e,n,r)}finally{Jp(this.tokenizer)}}#t(e,r,n){let i=!1,s="",a=1/0;for(;e;){if(e.length(o=O.call({lexer:this},e,n))?(e=e.substring(o.raw.length),n.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let O=n.at(-1);o.type==="text"&&O?.type==="text"?(O.raw+=o.raw,O.text+=o.text):n.push(o);continue}if(o=this.tokenizer.emStrong(e,r,s)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.del(e,r,s)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),n.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),n.push(o);continue}let l=e;if(this.options.extensions?.startInline){let O=1/0,c=e.slice(1),h;this.options.extensions.startInline.forEach(p=>{h=p.call({lexer:this},c),typeof h=="number"&&h>=0&&(O=Math.min(O,h))}),O<1/0&&O>=0&&(l=e.substring(0,O+1))}if(o=this.tokenizer.inlineText(l)){e=e.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(s=o.raw.slice(-1)),i=!0;let O=n.at(-1);O?.type==="text"?(O.raw+=o.raw,O.text+=o.text):n.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return n}#r(e){let r=e;if(this.tokens.links&&e.includes("[")){let n=this.tokenizer.rules.inline.reflinkSearch,i=s=>{let a=s.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,yr(s.slice(a+1,-1))))return s;if(a>1&&s.charAt(0)!=="!"){let o=s.slice(1,a-1);if(this.linkInText(o))return"["+o.replace(n,i)+"]["+"a".repeat(s.length-a-2)+"]"}return"["+"a".repeat(s.length-2)+"]"};r=r.replace(n,i)}return r=r.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(n,i,s)=>s?"+".repeat(n.length):i?i+n.slice(i.length,-i.length).replace(/`/g,"+")+i:n),r=r.replace(this.tokenizer.rules.inline.blockSkip,(n,i,s)=>{let a=s?s.length:0;return n.slice(0,a)+"["+"a".repeat(n.length-a-2)+"]"}),r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r,r}infiniteLoopError(e){let r="Infinite loop on byte: "+e;if(this.options.silent)console.error(r);else throw new Error(r)}},Zr=class{options;parser;constructor(t){this.options=t||Ve}space(t){return""}code({text:t,lang:e,escaped:r}){let n=(e||"").match(C.notSpaceStart)?.[0],i=t?t.replace(C.endingNewline,"")+` +`:"";return n?'
'+(r?i:H(i,!0))+`
+`:"
"+(r?i:H(i,!0))+`
+`}blockquote({tokens:t}){return`
+${this.parser.parse(t)}
+`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`${this.parser.parseInline(t)} +`}hr(t){return`
+`}list(t){let e=t.ordered,r=t.start,n="";for(let a=0;a `+n+" -`}listitem(r){return`
  • ${this.parser.parse(r.tokens)}
  • -`}checkbox({checked:r}){return" '}paragraph({tokens:r}){return`

    ${this.parser.parseInline(r)}

    -`}table(r){let e="",t="";for(let i=0;i${n}`),` +`}listitem(t){return`
  • ${this.parser.parse(t.tokens)}
  • +`}checkbox({checked:t}){return" '}paragraph({tokens:t}){return`

    ${this.parser.parseInline(t)}

    +`}table(t){let e="",r="";for(let i=0;i${n}`),`
    `+e+` `+n+`
    -`}tablerow({text:r}){return` -${r} -`}tablecell(r){let e=this.parser.parseInline(r.tokens),t=r.header?"th":"td";return(r.align?`<${t} align="${r.align}">`:`<${t}>`)+e+` -`}strong({tokens:r}){return`${this.parser.parseInline(r)}`}em({tokens:r}){return`${this.parser.parseInline(r)}`}codespan({text:r}){return`${H(r,!0)}`}br(r){return"
    "}del({tokens:r}){return`${this.parser.parseInline(r)}`}link({href:r,title:e,text:t,tokens:n,autolink:i}){let s=i?H(t,!0):this.parser.parseInline(n),a=ml(r);if(a===null)return s;r=H(a,i);let o='
    ",o}image({href:r,title:e,text:t,tokens:n}){n&&(t=this.parser.parseInline(n,this.parser.textRenderer));let i=ml(r);if(i===null)return H(t);r=i;let s=`${H(t)}{let a=i[s].flat(1/0);ye(t,this.walkTokens(a,e))}):i.tokens&&ye(t,this.walkTokens(i.tokens,e))}}return t}use(...r){let e=this.defaults.extensions||{renderers:Object.create(null),childTokens:Object.create(null)};return r.forEach(t=>{let n={...t};if(n.async=this.defaults.async||n.async||!1,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=e.renderers[i.name];s?e.renderers[i.name]=function(...a){let o=i.renderer.apply(this,a);return o===!1&&(o=s.apply(this,a)),o}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=e[i.level];s?s.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),n.extensions=e),t.renderer){let i=this.defaults.renderer||new wr(this.defaults);for(let s in t.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let a=s,o=t.renderer[a],l=i[a];i[a]=(...O)=>{let c=o.apply(i,O);return c===!1&&(c=l.apply(i,O)),c===!1?"":c??""}}n.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new st(this.defaults);for(let s in t.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let a=s,o=t.tokenizer[a],l=i[a];i[a]=(...O)=>{let c=o.apply(i,O);return c===!1&&(c=l.apply(i,O)),c}}n.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new jt;for(let s in t.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let a=s,o=t.hooks[a],l=i[a];jt.passThroughHooks.has(s)?i[a]=O=>{if(i.options.async&&jt.passThroughHooksRespectAsync.has(s))return(async()=>{let h=await o.call(i,O);return l.call(i,h)})();let c=o.call(i,O);return l.call(i,c)}:i[a]=(...O)=>{if(i.options.async)return(async()=>{let h=await o.apply(i,O);return h===!1&&(h=await l.apply(i,O)),h})();let c=o.apply(i,O);return c===!1&&(c=l.apply(i,O)),c}}n.hooks=i}if(t.walkTokens){let i=this.defaults.walkTokens,s=t.walkTokens;n.walkTokens=function(a){let o=[];return ye(o,s.call(this,a)),i&&ye(o,i.call(this,a)),o}}this.defaults={...this.defaults,...n}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return re.lex(r,e??this.defaults)}parser(r,e){return ne.parse(r,e??this.defaults)}parseMarkdown(r){return(e,t)=>{let n={...t},i={...this.defaults,...n},s=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&n.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=r),i.async)return(async()=>{let a=i.hooks?await i.hooks.preprocess(e):e,o=await(i.hooks?await i.hooks.provideLexer(r):r?re.lex:re.lexInline)(a,i),l=i.hooks?await i.hooks.processAllTokens(o):o;i.walkTokens&&await Promise.all(this.walkTokens(l,i.walkTokens));let O=await(i.hooks?await i.hooks.provideParser(r):r?ne.parse:ne.parseInline)(l,i);return i.hooks?await i.hooks.postprocess(O):O})().catch(s);try{i.hooks&&(e=i.hooks.preprocess(e));let a=(i.hooks?i.hooks.provideLexer(r):r?re.lex:re.lexInline)(e,i);i.hooks&&(a=i.hooks.processAllTokens(a)),i.walkTokens&&this.walkTokens(a,i.walkTokens);let o=(i.hooks?i.hooks.provideParser(r):r?ne.parse:ne.parseInline)(a,i);return i.hooks&&(o=i.hooks.postprocess(o)),o}catch(a){return s(a)}}}onError(r,e){return t=>{if(t.message+=` -Please report this to https://github.com/markedjs/marked.`,r){let n="

    An error occurred:

    "+H(t.message+"",!0)+"
    ";return e?Promise.resolve(n):n}if(e)return Promise.reject(t);throw t}}},We=new qi;function j(r,e){return We.parse(r,e)}j.options=j.setOptions=function(r){return We.setOptions(r),j.defaults=We.defaults,kl(j.defaults),j};j.getDefaults=Xi;j.defaults=Me;function Jp(...r){return We.use(...r),j.defaults=We.defaults,kl(j.defaults),j}j.use=Jp;j.walkTokens=function(r,e){return We.walkTokens(r,e)};j.parseInline=We.parseInline;j.Parser=ne;j.parser=ne.parse;j.Renderer=wr;j.TextRenderer=zi;j.Lexer=re;j.lexer=re.lex;j.Tokenizer=st;j.Hooks=jt;j.parse=j;var Zd=j.options,Xd=j.setOptions,vd=j.walkTokens,Td=j.parseInline;var Rd=ne.parse,jd=re.lex;var Ai=/^ivy:\/\/res\/([A-Za-z0-9_-]{8,64})/,jl=/^ivy:\/\/note\/([A-Za-z0-9_-]{8,64})/;function oe(r){return r.replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}function _l(r){return r.toLowerCase().trim().replace(/<[^>]+>/g,"").replace(/[^\p{L}\p{N}\s-]/gu,"").replace(/\s+/g,"-")}function ef(r){let e=new qi({gfm:!0,breaks:!1}),t=i=>{let s=Ai.exec(i);if(s)return r.resolveResource?.(s[1])||i;let a=jl.exec(i);return a?r.noteHref?.(a[1])??"#":i},n=0;return e.use({extensions:[{name:"wikilink",level:"inline",start:i=>i.indexOf("[["),tokenizer(i){let s=/^\[\[([^[\]\n]+?)\]\]/.exec(i);if(s)return{type:"wikilink",raw:s[0],inner:s[1]}},renderer(i){let s=hl(i.inner),a=oe(s.alias||s.target),o=r.resolveTitle?.(s.target)??"";if(!o)return`
    ${a}`;let l=(r.noteHref?.(o)??"#")+(s.heading?"#"+_l(s.heading):"");return`${a}`}},{name:"highlight",level:"inline",start:i=>i.indexOf("=="),tokenizer(i){let s=/^==([^=\n]+)==/.exec(i);if(s)return{type:"highlight",raw:s[0],text:s[1]}},renderer(i){return`${oe(i.text)}`}}],renderer:{heading({tokens:i,depth:s}){let a=this.parser.parseInline(i);return`${a} -`},image({href:i,title:s,text:a}){let o=Ai.exec(i),l=o?r.resourceKind?.(o[1]):void 0,O=oe(t(i)),c=s?` title="${oe(s)}"`:"";return l==="video"?``:l==="audio"?``:l==="file"?`\u{1F4CE} ${oe(a||"file")}`:`${oe(a)}`},link({href:i,title:s,tokens:a}){let o=this.parser.parseInline(a),l=Ai.exec(i),O=jl.exec(i),c=oe(t(i)),h=s?` title="${oe(s)}"`:"";if(O)return`${o}`;if(l)return`\u{1F4CE} ${o}`;let p=/^https?:\/\//i.test(i);return`${o}`},listitem(i){let s=this.parser.parse(i.tokens);if(i.task){let a=n++;s=s.replace(/^]*>\s*/,"");let o=r.interactiveTasks?"":" disabled";return`
  • ${s}
  • +`}tablerow({text:t}){return` +${t} +`}tablecell(t){let e=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+e+` +`}strong({tokens:t}){return`${this.parser.parseInline(t)}`}em({tokens:t}){return`${this.parser.parseInline(t)}`}codespan({text:t}){return`${H(t,!0)}`}br(t){return"
    "}del({tokens:t}){return`${this.parser.parseInline(t)}`}link({href:t,title:e,text:r,tokens:n,autolink:i}){let s=i?H(r,!0):this.parser.parseInline(n),a=$l(t);if(a===null)return s;t=H(a,i);let o='",o}image({href:t,title:e,text:r,tokens:n}){n&&(r=this.parser.parseInline(n,this.parser.textRenderer));let i=$l(t);if(i===null)return H(r);t=i;let s=`${H(r)}{let a=i[s].flat(1/0);ye(r,this.walkTokens(a,e))}):i.tokens&&ye(r,this.walkTokens(i.tokens,e))}}return r}use(...t){let e=this.defaults.extensions||{renderers:Object.create(null),childTokens:Object.create(null)};return t.forEach(r=>{let n={...r};if(n.async=this.defaults.async||n.async||!1,r.extensions&&(r.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=e.renderers[i.name];s?e.renderers[i.name]=function(...a){let o=i.renderer.apply(this,a);return o===!1&&(o=s.apply(this,a)),o}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=e[i.level];s?s.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),n.extensions=e),r.renderer){let i=this.defaults.renderer||new Zr(this.defaults);for(let s in r.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let a=s,o=r.renderer[a],l=i[a];i[a]=(...O)=>{let c=o.apply(i,O);return c===!1&&(c=l.apply(i,O)),c===!1?"":c??""}}n.renderer=i}if(r.tokenizer){let i=this.defaults.tokenizer||new ot(this.defaults);for(let s in r.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let a=s,o=r.tokenizer[a],l=i[a];i[a]=(...O)=>{let c=o.apply(i,O);return c===!1&&(c=l.apply(i,O)),c}}n.tokenizer=i}if(r.hooks){let i=this.defaults.hooks||new Ct;for(let s in r.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let a=s,o=r.hooks[a],l=i[a];Ct.passThroughHooks.has(s)?i[a]=O=>{if(i.options.async&&Ct.passThroughHooksRespectAsync.has(s))return(async()=>{let h=await o.call(i,O);return l.call(i,h)})();let c=o.call(i,O);return l.call(i,c)}:i[a]=(...O)=>{if(i.options.async)return(async()=>{let h=await o.apply(i,O);return h===!1&&(h=await l.apply(i,O)),h})();let c=o.apply(i,O);return c===!1&&(c=l.apply(i,O)),c}}n.hooks=i}if(r.walkTokens){let i=this.defaults.walkTokens,s=r.walkTokens;n.walkTokens=function(a){let o=[];return ye(o,s.call(this,a)),i&&ye(o,i.call(this,a)),o}}this.defaults={...this.defaults,...n}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return re.lex(t,e??this.defaults)}parser(t,e){return ne.parse(t,e??this.defaults)}parseMarkdown(t){return(e,r)=>{let n={...r},i={...this.defaults,...n},s=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&n.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=t),i.async)return(async()=>{let a=i.hooks?await i.hooks.preprocess(e):e,o=await(i.hooks?await i.hooks.provideLexer(t):t?re.lex:re.lexInline)(a,i),l=i.hooks?await i.hooks.processAllTokens(o):o;i.walkTokens&&await Promise.all(this.walkTokens(l,i.walkTokens));let O=await(i.hooks?await i.hooks.provideParser(t):t?ne.parse:ne.parseInline)(l,i);return i.hooks?await i.hooks.postprocess(O):O})().catch(s);try{i.hooks&&(e=i.hooks.preprocess(e));let a=(i.hooks?i.hooks.provideLexer(t):t?re.lex:re.lexInline)(e,i);i.hooks&&(a=i.hooks.processAllTokens(a)),i.walkTokens&&this.walkTokens(a,i.walkTokens);let o=(i.hooks?i.hooks.provideParser(t):t?ne.parse:ne.parseInline)(a,i);return i.hooks&&(o=i.hooks.postprocess(o)),o}catch(a){return s(a)}}}onError(t,e){return r=>{if(r.message+=` +Please report this to https://github.com/markedjs/marked.`,t){let n="

    An error occurred:

    "+H(r.message+"",!0)+"
    ";return e?Promise.resolve(n):n}if(e)return Promise.reject(r);throw r}}},Ue=new Wi;function j(t,e){return Ue.parse(t,e)}j.options=j.setOptions=function(t){return Ue.setOptions(t),j.defaults=Ue.defaults,wl(j.defaults),j};j.getDefaults=ji;j.defaults=Ve;function nf(...t){return Ue.use(...t),j.defaults=Ue.defaults,wl(j.defaults),j}j.use=nf;j.walkTokens=function(t,e){return Ue.walkTokens(t,e)};j.parseInline=Ue.parseInline;j.Parser=ne;j.parser=ne.parse;j.Renderer=Zr;j.TextRenderer=Ei;j.Lexer=re;j.lexer=re.lex;j.Tokenizer=ot;j.Hooks=Ct;j.parse=j;var zd=j.options,qd=j.setOptions,Ad=j.walkTokens,Ld=j.parseInline;var Ed=ne.parse,Wd=re.lex;var Mi=/^ivy:\/\/res\/([A-Za-z0-9_-]{8,64})/,Yl=/^ivy:\/\/note\/([A-Za-z0-9_-]{8,64})/;function oe(t){return t.replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}function zl(t){return t.toLowerCase().trim().replace(/<[^>]+>/g,"").replace(/[^\p{L}\p{N}\s-]/gu,"").replace(/\s+/g,"-")}function sf(t){let e=new Wi({gfm:!0,breaks:!1}),r=i=>{let s=Mi.exec(i);if(s)return t.resolveResource?.(s[1])||i;let a=Yl.exec(i);return a?t.noteHref?.(a[1])??"#":i},n=0;return e.use({extensions:[{name:"wikilink",level:"inline",start:i=>i.indexOf("[["),tokenizer(i){let s=/^\[\[([^[\]\n]+?)\]\]/.exec(i);if(s)return{type:"wikilink",raw:s[0],inner:s[1]}},renderer(i){let s=fl(i.inner),a=oe(s.alias||s.target),o=t.resolveTitle?.(s.target)??"";if(!o)return`
    ${a}`;let l=(t.noteHref?.(o)??"#")+(s.heading?"#"+zl(s.heading):"");return`${a}`}},{name:"highlight",level:"inline",start:i=>i.indexOf("=="),tokenizer(i){let s=/^==([^=\n]+)==/.exec(i);if(s)return{type:"highlight",raw:s[0],text:s[1]}},renderer(i){return`${oe(i.text)}`}}],renderer:{heading({tokens:i,depth:s}){let a=this.parser.parseInline(i);return`${a} +`},image({href:i,title:s,text:a}){let o=Mi.exec(i),l=o?t.resourceKind?.(o[1]):void 0,O=oe(r(i)),c=s?` title="${oe(s)}"`:"";return l==="video"?``:l==="audio"?``:l==="file"?`\u{1F4CE} ${oe(a||"file")}`:`${oe(a)}`},link({href:i,title:s,tokens:a}){let o=this.parser.parseInline(a),l=Mi.exec(i),O=Yl.exec(i),c=oe(r(i)),h=s?` title="${oe(s)}"`:"";if(O)return`${o}`;if(l)return`\u{1F4CE} ${o}`;let p=/^https?:\/\//i.test(i);return`${o}`},listitem(i){let s=this.parser.parse(i.tokens);if(i.task){let a=n++;s=s.replace(/^]*>\s*/,"");let o=t.interactiveTasks?"":" disabled";return`
  • ${s}
  • `}return`
  • ${s}
  • -`}}}),{marked:e,resetTasks:()=>n=0}}var Yl=!1;function Cl(r,e={}){let{marked:t,resetTasks:n}=ef(e);n();let i=t.parse(r,{async:!1});return e.citations&&(i=i.replace(/\[(\d{1,2})\](?![^<]*<\/a>)/g,'$1')),!Yl&&typeof Gt.addHook=="function"&&(Gt.addHook("afterSanitizeAttributes",s=>{s.tagName==="A"&&s.getAttribute("target")==="_blank"&&s.setAttribute("rel","noopener noreferrer")}),Yl=!0),Gt.sanitize(i,{ADD_TAGS:["video","audio"],ADD_ATTR:["target","controls","preload","data-note","data-title","data-task","data-cite","loading"],ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|tel|blob):|\/|#|[^a-z]|[a-z+.-]+(?:[^a-z+.\-:]|$))/i})}function Ue(r){window.IvyAndroid?.postMessage(JSON.stringify(r))}var Xr="",ql=[],yr=new Map,vr={},Zr="",P=null,Al=new Mi;function zl(r,e){return`/res/${encodeURIComponent(r)}${e?"?thumb=1":""}`}var Ll={resolveResource:zl,resourceKind:r=>vr[r]??"image",resolveTitle:r=>yr.get(br(r.split("#")[0].split("|")[0]))??"",openNote:(r,e)=>Ue({type:"open",id:r,title:e}),renderBlock:r=>Cl(r,{resolveResource:zl,resourceKind:e=>vr[e],resolveTitle:e=>Ll.resolveTitle(e),noteHref:()=>"#"})};function tf(){return ql.filter(r=>r.id!==Xr&&r.title).map(r=>({title:r.title,detail:r.folder}))}function rf(r){return[hs(),vs(),Uo({top:!0}),Mo(),zo({base:tt,addKeymap:!0}),Ol,ll,X.lineWrapping,Fi("\u5F00\u59CB\u5199\u4F5C\u2026"),Ys({override:[cl(tf)],icons:!1,activateOnTyping:!0}),ve.of([{key:"Mod-b",run:e=>de(e,"**","\u52A0\u7C97")},{key:"Mod-i",run:e=>de(e,"*","\u659C\u4F53")},{key:"Mod-e",run:e=>de(e,"`","code")},{key:"Mod-Shift-x",run:e=>de(e,"~~","\u5220\u9664\u7EBF")},{key:"Mod-k",run:fi},{key:"Mod-Shift-k",run:di},{key:"Mod-Alt-1",run:e=>V(e,"# ")},{key:"Mod-Alt-2",run:e=>V(e,"## ")},{key:"Mod-Alt-3",run:e=>V(e,"### ")},{key:"Mod-Shift-7",run:e=>V(e,"1. ")},{key:"Mod-Shift-8",run:e=>V(e,"- ")},{key:"Mod-Shift-9",run:e=>V(e,"- [ ] ")},...js,...tn,...Bo,...us,fs,...ps]),ol(Ll),X.contentAttributes.of({class:"cm-live"}),Al.of(Qe.readOnly.of(r)),X.updateListener.of(e=>{if(e.focusChanged&&Ue({type:"focus",focused:e.view.hasFocus}),!e.docChanged)return;let t=e.state.doc.toString();Zr=t,Ue({type:"change",id:Xr,body:t})})]}var nf=document.getElementById("editor"),Li=-1,Ei=!1;function El(){if(Ei=!1,!P)return;let r=P.lineBlockAtHeight(48-P.documentTop),e=P.state.doc.lineAt(Math.min(r.from,P.state.doc.length)).number-1;e!==Li&&(Li=e,Ue({type:"scroll",line:e}))}window.addEventListener("scroll",()=>{Ei||(Ei=!0,requestAnimationFrame(El))},{passive:!0});window.ivy={load(r){Xr=r.id,Zr=r.body,r.fontSize&&document.documentElement.style.setProperty("--editor-size",`${r.fontSize}px`);let e=Qe.create({doc:r.body,extensions:rf(!!r.readonly)});P?P.setState(e):P=new X({state:e,parent:nf}),P.scrollDOM.scrollTop=0,document.scrollingElement?.scrollTo(0,0),Li=-1,El(),r.focus&&window.ivy.focus(!0)},setBody(r,e){if(!P||r!==Xr||e===Zr)return;let t=P.state.doc.toString();if(Zr=e,e===t)return;let n=0;for(;nn&&s>n&&t[i-1]===e[s-1];)i--,s--;P.dispatch({changes:{from:n,to:i,insert:e.slice(n,s)}})},setTitles(r){ql=r,yr=new Map;for(let e of r){let t=br(e.title);t&&!yr.has(t)&&yr.set(t,e.id)}P?.dispatch({})},setKinds(r){let e=JSON.stringify(r)!==JSON.stringify(vr);vr=r,e&&P?.dispatch({})},insert(r,e=!0){!P||P.state.readOnly||pi(P,r,e)},setTheme(r){document.documentElement.dataset.theme=r?"dark":"light"},setReadonly(r){P?.dispatch({effects:Al.reconfigure(Qe.readOnly.of(r))})},focus(r=!1){P&&(P.focus(),r&&P.dispatch({selection:{anchor:P.state.doc.length},scrollIntoView:!0}))},scrollToLine(r,e=!1){if(!P)return;let t=P.state.doc.line(Math.min(Math.max(1,r+1),P.state.doc.lines));P.dispatch({selection:{anchor:t.from},effects:X.scrollIntoView(t.from,{y:"start",yMargin:24})}),e&&P.focus()},command(r){if(P){switch(r){case"bold":de(P,"**","\u52A0\u7C97");break;case"italic":de(P,"*","\u659C\u4F53");break;case"strike":de(P,"~~","\u5220\u9664\u7EBF");break;case"code":de(P,"`","code");break;case"h1":V(P,"# ");break;case"h2":V(P,"## ");break;case"h3":V(P,"### ");break;case"list":V(P,"- ");break;case"ordered":V(P,"1. ");break;case"task":V(P,"- [ ] ");break;case"quote":V(P,"> ");break;case"link":fi(P);break;case"wiki":di(P);break;case"rule":pi(P,"---",!0);break;case"undo":import("./chunks/dist-6TNHQW23.js").then(e=>P&&e.undo(P));return;case"redo":import("./chunks/dist-6TNHQW23.js").then(e=>P&&e.redo(P));return;case"blur":P.contentDOM.blur();return}P.focus()}}};window.addEventListener("error",r=>Ue({type:"error",message:String(r.message)}));document.addEventListener("error",r=>{let e=r.target;e&&"src"in e&&e!==window&&Ue({type:"log",message:`failed to load ${e.src}`})},!0);Ue({type:"ready"}); +`}}}),{marked:e,resetTasks:()=>n=0}}var ql=!1;function Al(t,e={}){let{marked:r,resetTasks:n}=sf(e);n();let i=r.parse(t,{async:!1});return e.citations&&(i=i.replace(/\[(\d{1,2})\](?![^<]*<\/a>)/g,'$1')),!ql&&typeof Dt.addHook=="function"&&(Dt.addHook("afterSanitizeAttributes",s=>{s.tagName==="A"&&s.getAttribute("target")==="_blank"&&s.setAttribute("rel","noopener noreferrer")}),ql=!0),Dt.sanitize(i,{ADD_TAGS:["video","audio"],ADD_ATTR:["target","controls","preload","data-note","data-title","data-task","data-cite","loading"],ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|tel|blob):|\/|#|[^a-z]|[a-z+.-]+(?:[^a-z+.\-:]|$))/i})}function Ge(t){window.IvyAndroid?.postMessage(JSON.stringify(t))}var Tr="",El=[],Xr=new Map,Rr={},vr="",P=null,Wl=new Cr,Ml=new Cr,af={zh:{placeholder:"\u5F00\u59CB\u5199\u4F5C\u2026",bold:"\u52A0\u7C97",italic:"\u659C\u4F53",strike:"\u5220\u9664\u7EBF"},en:{placeholder:"Start writing\u2026",bold:"bold",italic:"italic",strike:"strikethrough"}},Ui="zh",Ze=()=>af[Ui];function Ll(t,e){return`/res/${encodeURIComponent(t)}${e?"?thumb=1":""}`}var Ul={resolveResource:Ll,resourceKind:t=>Rr[t]??"image",resolveTitle:t=>Xr.get(kr(t.split("#")[0].split("|")[0]))??"",openNote:(t,e)=>Ge({type:"open",id:t,title:e}),renderBlock:t=>Al(t,{resolveResource:Ll,resourceKind:e=>Rr[e],resolveTitle:e=>Ul.resolveTitle(e),noteHref:()=>"#"})};function of(){return El.filter(t=>t.id!==Tr&&t.title).map(t=>({title:t.title,detail:t.folder}))}function lf(t){return[fs(),js(),Io({top:!0}),Go(),Lo({base:nt,addKeymap:!0}),ul,hl,X.lineWrapping,Ml.of(Yr(Ze().placeholder)),qs({override:[pl(of)],icons:!1,activateOnTyping:!0}),Te.of([{key:"Mod-b",run:e=>de(e,"**",Ze().bold)},{key:"Mod-i",run:e=>de(e,"*",Ze().italic)},{key:"Mod-e",run:e=>de(e,"`","code")},{key:"Mod-Shift-x",run:e=>de(e,"~~",Ze().strike)},{key:"Mod-k",run:Qi},{key:"Mod-Shift-k",run:$i},{key:"Mod-Alt-1",run:e=>V(e,"# ")},{key:"Mod-Alt-2",run:e=>V(e,"## ")},{key:"Mod-Alt-3",run:e=>V(e,"### ")},{key:"Mod-Shift-7",run:e=>V(e,"1. ")},{key:"Mod-Shift-8",run:e=>V(e,"- ")},{key:"Mod-Shift-9",run:e=>V(e,"- [ ] ")},...Ys,...an,...Ho,...ds,gs,...ms]),cl(Ul),X.contentAttributes.of({class:"cm-live"}),Wl.of(Qe.readOnly.of(t)),X.updateListener.of(e=>{if(e.focusChanged&&Ge({type:"focus",focused:e.view.hasFocus}),!e.docChanged)return;let r=e.state.doc.toString();vr=r,Ge({type:"change",id:Tr,body:r})})]}var Of=document.getElementById("editor"),Vi=-1,Gi=!1;function Vl(){if(Gi=!1,!P)return;let t=P.lineBlockAtHeight(48-P.documentTop),e=P.state.doc.lineAt(Math.min(t.from,P.state.doc.length)).number-1;e!==Vi&&(Vi=e,Ge({type:"scroll",line:e}))}window.addEventListener("scroll",()=>{Gi||(Gi=!0,requestAnimationFrame(Vl))},{passive:!0});window.ivy={load(t){Tr=t.id,vr=t.body,t.fontSize&&document.documentElement.style.setProperty("--editor-size",`${t.fontSize}px`);let e=Qe.create({doc:t.body,extensions:lf(!!t.readonly)});P?P.setState(e):P=new X({state:e,parent:Of}),P.scrollDOM.scrollTop=0,document.scrollingElement?.scrollTo(0,0),Vi=-1,Vl(),t.focus&&window.ivy.focus(!0)},setBody(t,e){if(!P||t!==Tr||e===vr)return;let r=P.state.doc.toString();if(vr=e,e===r)return;let n=0;for(;nn&&s>n&&r[i-1]===e[s-1];)i--,s--;P.dispatch({changes:{from:n,to:i,insert:e.slice(n,s)}})},setTitles(t){El=t,Xr=new Map;for(let e of t){let r=kr(e.title);r&&!Xr.has(r)&&Xr.set(r,e.id)}P?.dispatch({})},setKinds(t){let e=JSON.stringify(t)!==JSON.stringify(Rr);Rr=t,e&&P?.dispatch({})},insert(t,e=!0){!P||P.state.readOnly||gi(P,t,e)},setLanguage(t){Ui=t==="en"?"en":"zh",document.documentElement.lang=Ui==="zh"?"zh-CN":"en",P?.dispatch({effects:Ml.reconfigure(Yr(Ze().placeholder))})},setTheme(t){document.documentElement.dataset.theme=t?"dark":"light"},setReadonly(t){P?.dispatch({effects:Wl.reconfigure(Qe.readOnly.of(t))})},focus(t=!1){P&&(P.focus(),t&&P.dispatch({selection:{anchor:P.state.doc.length},scrollIntoView:!0}))},scrollToLine(t,e=!1){if(!P)return;let r=P.state.doc.line(Math.min(Math.max(1,t+1),P.state.doc.lines));P.dispatch({selection:{anchor:r.from},effects:X.scrollIntoView(r.from,{y:"start",yMargin:24})}),e&&P.focus()},command(t){if(P){switch(t){case"bold":de(P,"**",Ze().bold);break;case"italic":de(P,"*",Ze().italic);break;case"strike":de(P,"~~",Ze().strike);break;case"code":de(P,"`","code");break;case"h1":V(P,"# ");break;case"h2":V(P,"## ");break;case"h3":V(P,"### ");break;case"list":V(P,"- ");break;case"ordered":V(P,"1. ");break;case"task":V(P,"- [ ] ");break;case"quote":V(P,"> ");break;case"link":Qi(P);break;case"wiki":$i(P);break;case"rule":gi(P,"---",!0);break;case"undo":import("./chunks/dist-6TNHQW23.js").then(e=>P&&e.undo(P));return;case"redo":import("./chunks/dist-6TNHQW23.js").then(e=>P&&e.redo(P));return;case"blur":P.contentDOM.blur();return}P.focus()}}};window.addEventListener("error",t=>Ge({type:"error",message:String(t.message)}));document.addEventListener("error",t=>{let e=t.target;e&&"src"in e&&e!==window&&Ge({type:"log",message:`failed to load ${e.src}`})},!0);Ge({type:"ready"}); diff --git a/app/src/main/kotlin/app/ivynote/android/IvyApp.kt b/app/src/main/kotlin/app/ivynote/android/IvyApp.kt index f8ffe02..3bdacb1 100644 --- a/app/src/main/kotlin/app/ivynote/android/IvyApp.kt +++ b/app/src/main/kotlin/app/ivynote/android/IvyApp.kt @@ -1,6 +1,7 @@ package app.ivynote.android import android.app.Application +import android.content.res.Configuration import android.os.Build import androidx.lifecycle.DefaultLifecycleObserver import androidx.lifecycle.LifecycleOwner @@ -9,6 +10,8 @@ import app.ivynote.android.platform.KeystoreCredentialStore import app.ivynote.android.platform.SharedPrefsStore import app.ivynote.android.update.Updater import app.ivynote.core.IvyHttp +import app.ivynote.core.Language +import app.ivynote.core.LanguageSettings import app.ivynote.core.LibraryCatalog import app.ivynote.core.OfficialRegions import app.ivynote.core.newEntityId @@ -18,7 +21,9 @@ import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.launch import java.io.File +import java.util.Locale /** * Holds what outlives screens: the library catalog and the open library @@ -29,6 +34,12 @@ class IvyApp : Application() { private set lateinit var catalog: LibraryCatalog private set + lateinit var language: LanguageSettings + private set + + /** The system's locale (or this app's, set in the system settings), before ours replaces the default. */ + var systemLocale: Locale = Locale.getDefault() + private set /** New versions from the website: checks, the update dialog, downloads, install. */ lateinit var updater: Updater @@ -45,6 +56,10 @@ class IvyApp : Application() { instance = this IvyHttp.userAgent = "Ivynote-Android/${BuildConfig.VERSION_NAME} (Android ${Build.VERSION.RELEASE})" prefs = SharedPrefsStore(this) + systemLocale = systemLocales(resources.configuration).firstOrNull() ?: Locale.getDefault() + language = LanguageSettings(prefs, systemLocales(resources.configuration).map { it.toLanguageTag() }) + applyLocale(language.current.value) + appScope.launch { language.current.collect { applyLocale(it) } } // Official node addresses: the website's last answer, else the built-in ones. OfficialRegions.install(prefs) catalog = LibraryCatalog( @@ -60,6 +75,31 @@ class IvyApp : Application() { updater.start() } + override fun onConfigurationChanged(newConfig: Configuration) { + super.onConfigurationChanged(newConfig) + // The system language changed: the framework has reset the default locale. + systemLocale = systemLocales(newConfig).firstOrNull() ?: systemLocale + language.systemChanged(systemLocales(newConfig).map { it.toLanguageTag() }) + applyLocale(language.current.value) + } + + /** + * Dates, relative times and number formats follow the interface + * language. The region stays the system's (it picks the sync node). + */ + private fun applyLocale(lang: Language) { + // The system's own English (en-GB dates); Chinese is always the simplified script. + val base = if (lang == Language.EN && systemLocale.language == "en") systemLocale else null + val locale = base ?: Locale.Builder().setLanguage(lang.tag).setRegion(systemLocale.country.takeIf { it.length == 2 } ?: "") + .apply { if (lang == Language.ZH) setScript("Hans") }.build() + Locale.setDefault(locale) + } + + private fun systemLocales(config: Configuration): List { + val list = config.locales + return (0 until list.size()).map { list[it] } + } + /** This install's HLC node and `device` name, e.g. `android-a1b2c3d4` (guide 6.2). */ val deviceId: String get() { diff --git a/app/src/main/kotlin/app/ivynote/android/LibrarySession.kt b/app/src/main/kotlin/app/ivynote/android/LibrarySession.kt index 0a1e9b1..54dc332 100644 --- a/app/src/main/kotlin/app/ivynote/android/LibrarySession.kt +++ b/app/src/main/kotlin/app/ivynote/android/LibrarySession.kt @@ -9,6 +9,7 @@ import app.ivynote.android.editor.AttachmentLoader import app.ivynote.android.editor.EditorHost import app.ivynote.android.platform.SqliteDocumentStore import app.ivynote.android.platform.networkAvailable +import app.ivynote.core.L10n import app.ivynote.core.AddedFile import app.ivynote.core.ApiClient import app.ivynote.core.ApiError @@ -89,7 +90,7 @@ class LibrarySession private constructor( val type = resolver.getType(uri) ?: name?.substringAfterLast('.', "")?.lowercase()?.let { MimeTypeMap.getSingleton().getMimeTypeFromExtension(it) } ?: "application/octet-stream" - (resolver.openInputStream(uri) ?: throw java.io.IOException("无法读取文件")).use { input -> + (resolver.openInputStream(uri) ?: throw java.io.IOException(L10n.s.cannotReadFile)).use { input -> tmp.outputStream().use { input.copyTo(it) } } (name ?: fallbackName ?: defaultName(type)) to type diff --git a/app/src/main/kotlin/app/ivynote/android/MainActivity.kt b/app/src/main/kotlin/app/ivynote/android/MainActivity.kt index 9e2d379..db2d75c 100644 --- a/app/src/main/kotlin/app/ivynote/android/MainActivity.kt +++ b/app/src/main/kotlin/app/ivynote/android/MainActivity.kt @@ -5,6 +5,7 @@ import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.activity.enableEdgeToEdge import app.ivynote.android.ui.IvyTheme +import app.ivynote.android.ui.ProvideStrings import app.ivynote.android.ui.RootScreen class MainActivity : ComponentActivity() { @@ -12,7 +13,7 @@ class MainActivity : ComponentActivity() { enableEdgeToEdge() super.onCreate(savedInstanceState) setContent { - IvyTheme { RootScreen() } + ProvideStrings { IvyTheme { RootScreen() } } } } } diff --git a/app/src/main/kotlin/app/ivynote/android/editor/EditorHost.kt b/app/src/main/kotlin/app/ivynote/android/editor/EditorHost.kt index b9539c0..4b50fbc 100644 --- a/app/src/main/kotlin/app/ivynote/android/editor/EditorHost.kt +++ b/app/src/main/kotlin/app/ivynote/android/editor/EditorHost.kt @@ -27,6 +27,8 @@ import androidx.webkit.WebViewFeature import app.ivynote.android.BuildConfig import app.ivynote.android.IvyApp import app.ivynote.android.LibrarySession +import app.ivynote.core.L10n +import app.ivynote.core.Language import app.ivynote.core.Attachment import app.ivynote.core.IvyJson import app.ivynote.core.Note @@ -121,6 +123,7 @@ class EditorHost(appContext: Context, private val session: LibrarySession) { sendTitles() refreshKinds() call("ivy.setTheme($dark)") + setLanguage(L10n.language) val payload = buildJsonObject { put("id", note.id) put("body", note.body) @@ -175,6 +178,14 @@ class EditorHost(appContext: Context, private val session: LibrarySession) { fun setReadonly(ro: Boolean) = call("ivy.setReadonly($ro)") + /** The placeholder and the words formatting wraps around an empty selection. */ + fun setLanguage(language: Language) { + if (language == sentLanguage) return + sentLanguage = language + call("ivy.setLanguage(${JsonPrimitive(language.tag)})") + } + private var sentLanguage: Language? = null + fun setTheme(dark: Boolean) { this.dark = dark call("ivy.setTheme($dark)") @@ -302,6 +313,7 @@ class EditorHost(appContext: Context, private val session: LibrarySession) { view.destroy() queued.clear() sentKinds = "" + sentLanguage = null _webView.value = create() val id = noteId val note = id?.let { engine.notes[it] } diff --git a/app/src/main/kotlin/app/ivynote/android/ui/AccountSheet.kt b/app/src/main/kotlin/app/ivynote/android/ui/AccountSheet.kt index 7d6abf4..89676da 100644 --- a/app/src/main/kotlin/app/ivynote/android/ui/AccountSheet.kt +++ b/app/src/main/kotlin/app/ivynote/android/ui/AccountSheet.kt @@ -2,6 +2,7 @@ package app.ivynote.android.ui import android.content.Intent import android.net.Uri +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -52,54 +53,62 @@ fun AccountSheet(lib: LibrarySession, session: SessionStore, onDismiss: () -> Un val revision by engine.revision.collectAsState() var confirmSignOut by remember { mutableStateOf(false) } var signingOut by remember { mutableStateOf(false) } + var choosingLanguage by remember { mutableStateOf(false) } + val s = LocalStrings.current ModalBottomSheet(onDismissRequest = onDismiss, sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true), containerColor = c.canvas) { Column( Modifier.verticalScroll(rememberScrollState()).padding(horizontal = 20.dp).navigationBarsPadding().padding(bottom = 24.dp), verticalArrangement = Arrangement.spacedBy(14.dp), ) { - Text("账户", style = SerifTitle, fontSize = 20.sp, color = c.ink) + Text(s.account, style = SerifTitle, fontSize = 20.sp, color = c.ink) Card { - Field("名称", account.user.name) - Field("用户名", account.user.username) - if (account.user.email.isNotEmpty()) Field("邮箱", account.user.email) - Field("角色", if (account.user.isAdmin) "管理员" else "用户") + Field(s.name, account.user.name) + Field(s.username, account.user.username) + if (account.user.email.isNotEmpty()) Field(s.email, account.user.email) + Field(s.role, if (account.user.isAdmin) s.admin else s.user) + // The account's language: kept by the server, on all its devices. + Field(s.language, choiceLabel(IvyApp.instance.language.selected.collectAsState().value, s), onClick = { choosingLanguage = true }) } - Caption("同步 · ${lib.ref.name}") + Caption(s.syncSection(lib.ref.name)) Card { - Field("服务器", account.server.toString()) + Field(s.server, account.server.toString()) Row(Modifier.fillMaxWidth().padding(vertical = 8.dp), verticalAlignment = Alignment.CenterVertically) { - Text("状态", color = c.ink2, fontSize = 15.sp, modifier = Modifier.width(88.dp)) + Text(s.status, color = c.ink2, fontSize = 15.sp, modifier = Modifier.width(88.dp)) SyncStatusLine(engine, state) } - Field("笔记", remember(revision) { engine.liveNotes.size.toString() }) - Field("本设备", engine.device) + Field(s.notes, remember(revision) { engine.liveNotes.size.toString() }) + Field(s.thisDevice, engine.device) Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) { OutlinedButton(onClick = { lib.engine.let { e -> app.appScope.launch { e.sync() } } }, enabled = state.status != SyncState.Status.SYNCING) { - Text("立即同步") + Text(s.syncNow) } if (account.user.isAdmin) { OutlinedButton(onClick = { runCatching { context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(account.server.base + "/admin"))) } - }) { Text("打开管理后台") } + }) { Text(s.openAdmin) } } } } Surface(shape = RoundedCornerShape(16.dp), color = c.surface, modifier = Modifier.fillMaxWidth()) { TextButton(onClick = { confirmSignOut = true }, enabled = !signingOut, modifier = Modifier.padding(4.dp)) { - Text(if (signingOut) "正在退出…" else "退出登录", color = c.danger, fontWeight = FontWeight.Medium) + Text(if (signingOut) s.signingOut else s.signOut, color = c.danger, fontWeight = FontWeight.Medium) } } - Text("退出后,本设备上这个笔记库的副本会被删除;服务器上的数据不受影响。重新登录后会再次下载。", fontSize = 12.5.sp, color = c.muted) + Text(s.signOutHint, fontSize = 12.5.sp, color = c.muted) } } + if (choosingLanguage) { + LanguageDialog(onDismiss = { choosingLanguage = false }) + } + if (confirmSignOut) { val unsynced = state.pending + state.blocked ConfirmDialog( - title = "退出登录?", - message = if (unsynced > 0) "还有 $unsynced 条更改没有同步到服务器,退出后会丢失。" else "这台设备的登录令牌会被撤销,本地数据会被删除。", - confirm = "退出登录", + title = s.signOutTitle, + message = if (unsynced > 0) s.signOutUnsynced(unsynced) else s.signOutMessage, + confirm = s.signOut, onDismiss = { confirmSignOut = false }, ) { // Sync, revoke the token, then delete the local copy (guide 6.10). @@ -121,9 +130,9 @@ private fun Card(content: @Composable () -> Unit) { } @Composable -private fun Field(label: String, value: String) { +private fun Field(label: String, value: String, onClick: (() -> Unit)? = null) { val c = Ivy.colors - Row(Modifier.fillMaxWidth().padding(vertical = 8.dp), verticalAlignment = Alignment.CenterVertically) { + Row(Modifier.fillMaxWidth().then(if (onClick != null) Modifier.clickable(onClick = onClick) else Modifier).padding(vertical = 8.dp), verticalAlignment = Alignment.CenterVertically) { Text(label, color = c.ink2, fontSize = 15.sp, modifier = Modifier.width(88.dp)) Spacer(Modifier.width(4.dp)) Text(value, color = c.ink, fontSize = 15.sp, maxLines = 2, overflow = TextOverflow.Ellipsis) diff --git a/app/src/main/kotlin/app/ivynote/android/ui/Common.kt b/app/src/main/kotlin/app/ivynote/android/ui/Common.kt index bc3c4d7..f037efc 100644 --- a/app/src/main/kotlin/app/ivynote/android/ui/Common.kt +++ b/app/src/main/kotlin/app/ivynote/android/ui/Common.kt @@ -56,6 +56,7 @@ import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import app.ivynote.android.R +import app.ivynote.core.L10n import app.ivynote.core.LibraryRef import app.ivynote.core.SyncEngine import app.ivynote.core.SyncState @@ -66,8 +67,8 @@ import kotlinx.coroutines.delay fun TextInputDialog( title: String, initial: String = "", - placeholder: String = "名称", - confirm: String = "保存", + placeholder: String = L10n.s.name, + confirm: String = L10n.s.save, message: String? = null, onDismiss: () -> Unit, onConfirm: (String) -> Unit, @@ -92,7 +93,7 @@ fun TextInputDialog( } }, confirmButton = { TextButton(onClick = { onConfirm(value.text); onDismiss() }) { Text(confirm) } }, - dismissButton = { TextButton(onClick = onDismiss) { Text("取消") } }, + dismissButton = { TextButton(onClick = onDismiss) { Text(LocalStrings.current.cancel) } }, ) LaunchedEffect(Unit) { delay(100) @@ -118,7 +119,7 @@ fun ConfirmDialog( Text(confirm, color = if (destructive) Ivy.colors.danger else Ivy.colors.ivy) } }, - dismissButton = { TextButton(onClick = onDismiss) { Text("取消") } }, + dismissButton = { TextButton(onClick = onDismiss) { Text(LocalStrings.current.cancel) } }, ) } @@ -181,17 +182,18 @@ fun SyncStatusLine(engine: SyncEngine, state: SyncState, modifier: Modifier = Mo tick++ } } + val s = LocalStrings.current Column(modifier) { Row(verticalAlignment = Alignment.CenterVertically) { val (icon: ImageVector?, text: String, tint: Color) = when { - engine.isLocal -> Triple(Icons.Outlined.CloudOff, "仅保存在本机 · 未同步", c.muted) - state.status == SyncState.Status.SYNCING -> Triple(null, if (state.initial) "正在下载笔记…" else "同步中…", c.muted) + engine.isLocal -> Triple(Icons.Outlined.CloudOff, s.localUnsynced, c.muted) + state.status == SyncState.Status.SYNCING -> Triple(null, if (state.initial) s.downloadingNotes else s.syncing, c.muted) state.status == SyncState.Status.OFFLINE -> - Triple(Icons.Outlined.WifiOff, if (state.pending > 0) "离线 · ${state.pending} 条待同步" else "离线", c.warn) - state.status == SyncState.Status.ERROR -> Triple(Icons.Outlined.Warning, "同步出错", c.danger) - state.pending > 0 -> Triple(Icons.Outlined.Sync, "${state.pending} 条待同步", c.muted) - state.lastSyncAt > 0 -> Triple(Icons.Outlined.CloudDone, "已同步 · ${relative(state.lastSyncAt, tick)}", c.muted) - else -> Triple(null, "尚未同步", c.muted) + Triple(Icons.Outlined.WifiOff, if (state.pending > 0) s.offlinePending(state.pending) else s.offline, c.warn) + state.status == SyncState.Status.ERROR -> Triple(Icons.Outlined.Warning, s.syncError, c.danger) + state.pending > 0 -> Triple(Icons.Outlined.Sync, s.pending(state.pending), c.muted) + state.lastSyncAt > 0 -> Triple(Icons.Outlined.CloudDone, s.synced(relative(state.lastSyncAt, tick)), c.muted) + else -> Triple(null, s.neverSynced, c.muted) } if (state.status == SyncState.Status.SYNCING && !engine.isLocal) { CircularProgressIndicator(Modifier.size(11.dp), strokeWidth = 1.5.dp, color = c.muted) @@ -203,7 +205,7 @@ fun SyncStatusLine(engine: SyncEngine, state: SyncState, modifier: Modifier = Mo Text(text, fontSize = 12.5.sp, color = c.muted, maxLines = 1, overflow = TextOverflow.Ellipsis) } if (state.blocked > 0) { - Text("${state.blocked} 条更改被服务器拒绝", fontSize = 12.5.sp, color = c.warn) + Text(s.blocked(state.blocked), fontSize = 12.5.sp, color = c.warn) } } } @@ -211,23 +213,24 @@ fun SyncStatusLine(engine: SyncEngine, state: SyncState, modifier: Modifier = Mo @Suppress("UNUSED_PARAMETER") fun relative(at: Long, tick: Long = 0): String { val now = System.currentTimeMillis() - if (now - at < 60_000) return "刚刚" + if (now - at < 60_000) return L10n.s.justNow return DateUtils.getRelativeTimeSpanString(at, now, DateUtils.MINUTE_IN_MILLIS).toString() } -/** 今天 16:20、昨天、周几、10月29日、2025年3月1日 (guide 11.7). */ +/** 今天 16:20、昨天、周几、10月29日、2025年3月1日 (guide 11.7), in the interface language. */ fun shortDate(at: Long): String { + val s = L10n.s val now = java.util.Calendar.getInstance() val then = java.util.Calendar.getInstance().apply { timeInMillis = at } val days = ((startOfDay(now) - startOfDay(then)) / 86_400_000L).toInt() val time = String.format(java.util.Locale.ROOT, "%02d:%02d", then.get(java.util.Calendar.HOUR_OF_DAY), then.get(java.util.Calendar.MINUTE)) return when { days <= 0 -> time - days == 1 -> "昨天 $time" - days < 7 -> arrayOf("周日", "周一", "周二", "周三", "周四", "周五", "周六")[then.get(java.util.Calendar.DAY_OF_WEEK) - 1] + days == 1 -> s.yesterday(time) + days < 7 -> s.weekday(then.get(java.util.Calendar.DAY_OF_WEEK)) then.get(java.util.Calendar.YEAR) == now.get(java.util.Calendar.YEAR) -> - "${then.get(java.util.Calendar.MONTH) + 1}月${then.get(java.util.Calendar.DAY_OF_MONTH)}日" - else -> "${then.get(java.util.Calendar.YEAR)}年${then.get(java.util.Calendar.MONTH) + 1}月${then.get(java.util.Calendar.DAY_OF_MONTH)}日" + s.monthDay(then.get(java.util.Calendar.MONTH) + 1, then.get(java.util.Calendar.DAY_OF_MONTH)) + else -> s.yearMonthDay(then.get(java.util.Calendar.YEAR), then.get(java.util.Calendar.MONTH) + 1, then.get(java.util.Calendar.DAY_OF_MONTH)) } } diff --git a/app/src/main/kotlin/app/ivynote/android/ui/Language.kt b/app/src/main/kotlin/app/ivynote/android/ui/Language.kt new file mode 100644 index 0000000..8e8e9a4 --- /dev/null +++ b/app/src/main/kotlin/app/ivynote/android/ui/Language.kt @@ -0,0 +1,101 @@ +package app.ivynote.android.ui + +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.heightIn +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.selection.selectableGroup +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.AlertDialog +import androidx.compose.material3.RadioButton +import androidx.compose.material3.RadioButtonDefaults +import androidx.compose.material3.Text +import androidx.compose.material3.TextButton +import androidx.compose.runtime.Composable +import androidx.compose.runtime.CompositionLocalProvider +import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.getValue +import androidx.compose.runtime.staticCompositionLocalOf +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.semantics.Role +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import app.ivynote.android.IvyApp +import app.ivynote.core.L10n +import app.ivynote.core.Language +import app.ivynote.core.LanguageChoice +import app.ivynote.core.Strings + +/** + * The strings of the language in use. Static: a change recomposes everything + * below, so text built outside composables (with [L10n.s]) updates too. + */ +val LocalStrings = staticCompositionLocalOf { L10n.s } + +/** Provides the app's current language to [content]. */ +@Composable +fun ProvideStrings(content: @Composable () -> Unit) { + val language by IvyApp.instance.language.current.collectAsState() + CompositionLocalProvider(LocalStrings provides language.strings, content = content) +} + +/** Each language in its own name, so it can be found whatever the interface speaks. */ +val Language.nativeName: String + get() = when (this) { + Language.ZH -> "简体中文" + Language.EN -> "English" + } + +/** "跟随系统(English)", "简体中文". */ +fun choiceLabel(choice: LanguageChoice, s: Strings = L10n.s): String = when (choice) { + LanguageChoice.System -> s.followSystemWith(IvyApp.instance.language.systemLanguage.nativeName) + is LanguageChoice.Fixed -> choice.language.nativeName +} + +/** + * Picks the interface language: follow the system, or one language. Signed in + * to a synced library, the choice is the account's (guide: the account's + * language wins on every device); otherwise this device's. + */ +@Composable +fun LanguageDialog(onDismiss: () -> Unit) { + val s = LocalStrings.current + val c = Ivy.colors + val settings = IvyApp.instance.language + val selected by settings.selected.collectAsState() + AlertDialog( + onDismissRequest = onDismiss, + title = { Text(s.language) }, + text = { + Column(Modifier.selectableGroup(), verticalArrangement = Arrangement.spacedBy(2.dp)) { + for (choice in LanguageChoice.all) { + Row( + Modifier.fillMaxWidth().heightIn(min = 48.dp).clip(RoundedCornerShape(10.dp)) + .clickable(role = Role.RadioButton) { + settings.choose(choice) + onDismiss() + } + .padding(horizontal = 4.dp), + verticalAlignment = Alignment.CenterVertically, + ) { + RadioButton(selected = choice == selected, onClick = null, colors = RadioButtonDefaults.colors(selectedColor = c.ivy)) + Spacer(Modifier.width(12.dp)) + Text(choiceLabel(choice, s), color = c.ink, fontSize = 15.sp) + } + } + Text( + if (settings.hasAccount) s.languageAccountHint else s.languageDeviceHint, + color = c.muted, fontSize = 13.sp, modifier = Modifier.padding(top = 8.dp, start = 4.dp, end = 4.dp), + ) + } + }, + confirmButton = { TextButton(onClick = onDismiss) { Text(s.done) } }, + ) +} diff --git a/app/src/main/kotlin/app/ivynote/android/ui/LibrariesScreen.kt b/app/src/main/kotlin/app/ivynote/android/ui/LibrariesScreen.kt index de372c7..7f7fb6f 100644 --- a/app/src/main/kotlin/app/ivynote/android/ui/LibrariesScreen.kt +++ b/app/src/main/kotlin/app/ivynote/android/ui/LibrariesScreen.kt @@ -30,6 +30,7 @@ import androidx.compose.material.icons.outlined.CloudUpload import androidx.compose.material.icons.outlined.Delete import androidx.compose.material.icons.outlined.Edit import androidx.compose.material.icons.outlined.FolderOpen +import androidx.compose.material.icons.outlined.Language import androidx.compose.material.icons.outlined.MoreVert import androidx.compose.material3.DropdownMenu import androidx.compose.material3.DropdownMenuItem @@ -57,6 +58,7 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import app.ivynote.android.IvyApp +import app.ivynote.core.L10n import app.ivynote.core.LibraryRef /** @@ -74,6 +76,8 @@ fun LibrariesScreen() { var creatingLocal by remember { mutableStateOf(false) } var renaming by remember { mutableStateOf(null) } var removing by remember { mutableStateOf(null) } + var choosingLanguage by remember { mutableStateOf(false) } + val s = LocalStrings.current var about by remember { mutableStateOf(false) } val update by IvyApp.instance.updater.state.collectAsState() @@ -102,9 +106,9 @@ fun LibrariesScreen() { Column(Modifier.fillMaxWidth().padding(top = 24.dp, bottom = 12.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp)) { AppLogo(64.dp) - Text(if (libraries.isEmpty()) "常青笔记" else "笔记库", style = SerifTitle, fontSize = 26.sp, color = c.ink) + Text(if (libraries.isEmpty()) s.appName else s.libraries, style = SerifTitle, fontSize = 26.sp, color = c.ink) Text( - if (libraries.isEmpty()) "本地优先的 Markdown 笔记,在手机、电脑和网页间同步。" else "选择要打开的笔记库", + if (libraries.isEmpty()) s.welcome else s.pickLibrary, color = c.muted, fontSize = 14.sp, textAlign = TextAlign.Center, ) } @@ -127,14 +131,14 @@ fun LibrariesScreen() { item { Surface(shape = RoundedCornerShape(16.dp), color = c.surface, modifier = Modifier.padding(top = 8.dp)) { Column { - ActionRow(Icons.Outlined.Cloud, c.ivy, "登录云同步账户", "在多台设备间同步,支持官方节点和自建服务器") { cloud = "" } + ActionRow(Icons.Outlined.Cloud, c.ivy, s.connect, s.connectHint) { cloud = "" } HorizontalDivider(color = c.line, modifier = Modifier.padding(start = 64.dp)) - ActionRow(Icons.Outlined.Add, c.muted, "新建本地笔记库", "只保存在这台设备,无需账户,立即可用") { creatingLocal = true } + ActionRow(Icons.Outlined.Add, c.muted, s.newLocal, s.newLocalHint) { creatingLocal = true } } } } if (libraries.any { it.canTurnOnSync }) { - item { Caption("本地笔记库可以随时开启同步:注册新账户后,内容会自动上传。", Modifier.padding(horizontal = 8.dp)) } + item { Caption(s.canConvert, Modifier.padding(horizontal = 8.dp)) } } } else { // First run: syncing is the way in; local is the quiet alternative. @@ -146,8 +150,8 @@ fun LibrariesScreen() { } Spacer(Modifier.width(14.dp)) Column(Modifier.weight(1f)) { - Text("开始使用 · 多端同步", color = c.onIvy, fontWeight = FontWeight.SemiBold, fontSize = 16.sp) - Text("登录或注册,笔记在手机、电脑和网页间自动同步", color = c.onIvy.copy(alpha = 0.85f), fontSize = 13.sp) + Text(s.startCloud, color = c.onIvy, fontWeight = FontWeight.SemiBold, fontSize = 16.sp) + Text(s.startCloudHint, color = c.onIvy.copy(alpha = 0.85f), fontSize = 13.sp) } Icon(Icons.AutoMirrored.Filled.KeyboardArrowRight, null, tint = c.onIvy) } @@ -155,7 +159,17 @@ fun LibrariesScreen() { } item { Box(Modifier.fillMaxWidth(), contentAlignment = Alignment.Center) { - TextButton(onClick = { creatingLocal = true }) { Text("不登录,仅在本机使用", color = c.ink2) } + TextButton(onClick = { creatingLocal = true }) { Text(s.localOnly, color = c.ink2) } + } + } + } + // Language: before signing in, this device's choice. + item { + Box(Modifier.fillMaxWidth(), contentAlignment = Alignment.Center) { + TextButton(onClick = { choosingLanguage = true }) { + Icon(Icons.Outlined.Language, null, tint = c.muted, modifier = Modifier.size(16.dp)) + Spacer(Modifier.width(6.dp)) + Text(choiceLabel(IvyApp.instance.language.selected.collectAsState().value, s), color = c.muted, fontSize = 13.sp) } } } @@ -164,7 +178,7 @@ fun LibrariesScreen() { TextButton(onClick = { about = true }) { val newer = update.info?.takeIf { it.available }?.latest Text( - if (newer != null) "关于常青笔记 · 有新版本 $newer" else "关于常青笔记 · ${IvyApp.instance.updater.current}", + if (newer != null) s.aboutNewer(newer) else s.aboutVersion(IvyApp.instance.updater.current), color = if (newer != null) c.ivy else c.muted, fontSize = 13.sp, ) } @@ -173,25 +187,27 @@ fun LibrariesScreen() { } } + if (choosingLanguage) { + LanguageDialog(onDismiss = { choosingLanguage = false }) + } if (about) AboutSheet(onDismiss = { about = false }) if (creatingLocal) { TextInputDialog( - title = "新建本地笔记库", - initial = if (libraries.isEmpty()) "我的笔记" else "", - message = "笔记只保存在这台设备上,不会同步。", - confirm = "创建", + title = s.newLocal, + initial = if (libraries.isEmpty()) s.defaultLibraryName else "", + message = s.newLocalMessage, + confirm = s.create, onDismiss = { creatingLocal = false }, ) { name -> catalog.createLocal(name) } } renaming?.let { ref -> - TextInputDialog(title = "重命名笔记库", initial = ref.name, onDismiss = { renaming = null }) { name -> catalog.rename(ref.id, name) } + TextInputDialog(title = s.renameLibrary, initial = ref.name, onDismiss = { renaming = null }) { name -> catalog.rename(ref.id, name) } } removing?.let { ref -> ConfirmDialog( - title = "移除笔记库", - message = if (ref.isLocal) "将永久删除「${ref.name}」里的全部笔记,无法恢复。" - else "将从这台设备删除「${ref.name}」的本地副本和登录状态。服务器上的笔记不受影响,但尚未同步的更改会丢失。", - confirm = "移除", + title = s.removeLibrary, + message = if (ref.isLocal) s.removeLocalMessage(ref.name) else s.removeServerMessage(ref.name), + confirm = s.remove, onDismiss = { removing = null }, ) { catalog.remove(ref.id) @@ -205,6 +221,7 @@ fun LibrariesScreen() { private fun LibraryRow(ref: LibraryRef, onOpen: () -> Unit, onTurnOnSync: () -> Unit, onRename: () -> Unit, onRemove: () -> Unit) { val c = Ivy.colors var menu by remember { mutableStateOf(false) } + val s = LocalStrings.current Box { Row( Modifier.fillMaxWidth().combinedClickable(onClick = onOpen, onLongClick = { menu = true }).padding(start = 14.dp, top = 10.dp, bottom = 10.dp, end = 4.dp), @@ -216,23 +233,23 @@ private fun LibraryRow(ref: LibraryRef, onOpen: () -> Unit, onTurnOnSync: () -> Text(ref.name, fontWeight = FontWeight.Medium, fontSize = 16.sp, color = c.ink, maxLines = 1, overflow = TextOverflow.Ellipsis) Text(detail(ref), fontSize = 13.sp, color = c.muted, maxLines = 1, overflow = TextOverflow.Ellipsis) } - IconButton(onClick = { menu = true }) { Icon(Icons.Outlined.MoreVert, contentDescription = "更多", tint = c.faint) } + IconButton(onClick = { menu = true }) { Icon(Icons.Outlined.MoreVert, contentDescription = s.more, tint = c.faint) } } DropdownMenu(expanded = menu, onDismissRequest = { menu = false }) { - DropdownMenuItem(text = { Text("打开") }, leadingIcon = { Icon(Icons.Outlined.FolderOpen, null) }, onClick = { menu = false; onOpen() }) + DropdownMenuItem(text = { Text(s.open) }, leadingIcon = { Icon(Icons.Outlined.FolderOpen, null) }, onClick = { menu = false; onOpen() }) if (ref.canTurnOnSync) { - DropdownMenuItem(text = { Text("开启同步") }, leadingIcon = { Icon(Icons.Outlined.CloudUpload, null) }, onClick = { menu = false; onTurnOnSync() }) + DropdownMenuItem(text = { Text(s.turnOnSync) }, leadingIcon = { Icon(Icons.Outlined.CloudUpload, null) }, onClick = { menu = false; onTurnOnSync() }) } - DropdownMenuItem(text = { Text("重命名") }, leadingIcon = { Icon(Icons.Outlined.Edit, null) }, onClick = { menu = false; onRename() }) + DropdownMenuItem(text = { Text(s.rename) }, leadingIcon = { Icon(Icons.Outlined.Edit, null) }, onClick = { menu = false; onRename() }) HorizontalDivider() - DropdownMenuItem(text = { Text("移除", color = c.danger) }, leadingIcon = { Icon(Icons.Outlined.Delete, null, tint = c.danger) }, onClick = { menu = false; onRemove() }) + DropdownMenuItem(text = { Text(s.remove, color = c.danger) }, leadingIcon = { Icon(Icons.Outlined.Delete, null, tint = c.danger) }, onClick = { menu = false; onRemove() }) } } } private fun detail(ref: LibraryRef): String = when { - ref.migratedTo != null -> "已迁移到云端,确认无误后可以移除" - ref.isLocal -> "仅保存在本机 · 未同步" + ref.migratedTo != null -> L10n.s.migratedHint + ref.isLocal -> L10n.s.localUnsynced else -> { val host = ref.server?.host ?: "" ref.account?.let { "$host · @$it" } ?: host diff --git a/app/src/main/kotlin/app/ivynote/android/ui/LibraryScreen.kt b/app/src/main/kotlin/app/ivynote/android/ui/LibraryScreen.kt index d096a1c..a81047c 100644 --- a/app/src/main/kotlin/app/ivynote/android/ui/LibraryScreen.kt +++ b/app/src/main/kotlin/app/ivynote/android/ui/LibraryScreen.kt @@ -39,6 +39,7 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import app.ivynote.android.IvyApp import app.ivynote.android.LibrarySession +import app.ivynote.core.L10n import app.ivynote.core.SessionStore import app.ivynote.core.Shelf import app.ivynote.core.displayTitle @@ -161,7 +162,7 @@ fun LibraryScreen(lib: LibrarySession, session: SessionStore?) { val context = androidx.compose.ui.platform.LocalContext.current LaunchedEffect(refused) { val f = refused ?: return@LaunchedEffect - toast(context, "「${f.name}」未能上传:${f.message}", long = true) + toast(context, L10n.s.uploadRefused(f.name, f.message), long = true) engine.clearUploadFailure() } @@ -169,21 +170,22 @@ fun LibraryScreen(lib: LibrarySession, session: SessionStore?) { AccountSheet(lib, session, onDismiss = { ui.showAccount = false }) } + val s = LocalStrings.current conflict?.let { c -> AlertDialog( onDismissRequest = { engine.clearConflict() }, - title = { Text("内容冲突") }, + title = { Text(s.conflictTitle) }, text = { - val name = engine.notes[c.noteId]?.let(::displayTitle) ?: "笔记" - Text("「$name」在其他设备上也改动了同一处。服务器保留了它的版本,你的修改已另存为冲突副本。") + val name = engine.notes[c.noteId]?.let(::displayTitle) ?: s.note + Text(s.conflictMessage(name)) }, confirmButton = { TextButton(onClick = { ui.reveal(c.copyId) engine.clearConflict() - }) { Text("打开副本") } + }) { Text(s.openCopy) } }, - dismissButton = { TextButton(onClick = { engine.clearConflict() }) { Text("好") } }, + dismissButton = { TextButton(onClick = { engine.clearConflict() }) { Text(s.ok) } }, ) } } @@ -197,6 +199,6 @@ fun EmptyPaper() { horizontalAlignment = Alignment.CenterHorizontally, ) { IvyLeaf(64.dp, alpha = 0.7f) - Text("像常春藤一样,你的笔记彼此相连、四季常青。", color = Ivy.colors.muted, fontSize = 14.sp) + Text(LocalStrings.current.tagline, color = Ivy.colors.muted, fontSize = 14.sp) } } diff --git a/app/src/main/kotlin/app/ivynote/android/ui/Media.kt b/app/src/main/kotlin/app/ivynote/android/ui/Media.kt index 0972db0..80ae4e9 100644 --- a/app/src/main/kotlin/app/ivynote/android/ui/Media.kt +++ b/app/src/main/kotlin/app/ivynote/android/ui/Media.kt @@ -103,6 +103,7 @@ import app.ivynote.android.LibrarySession import app.ivynote.android.editor.AttachmentLoader import app.ivynote.core.AddedFile import app.ivynote.core.ApiError +import app.ivynote.core.L10n import app.ivynote.core.Attachment import app.ivynote.core.AttachmentDetail import app.ivynote.core.MediaLibrary @@ -119,12 +120,12 @@ fun toast(context: Context, text: String, long: Boolean = false) = fun copyText(context: Context, text: String, label: String = "ivynote") { context.getSystemService(ClipboardManager::class.java)?.setPrimaryClip(ClipData.newPlainText(label, text)) // Android 13+ shows its own confirmation. - if (android.os.Build.VERSION.SDK_INT < 33) toast(context, "已复制") + if (android.os.Build.VERSION.SDK_INT < 33) toast(context, L10n.s.copied) } fun errorText(e: Throwable): String = when (e) { - is ApiError.Unreachable -> "需要联网" - is ApiError.Server -> if (e.code == 413) "文件超过服务器的上传上限" else e.message ?: "请求失败" + is ApiError.Unreachable -> L10n.s.needsNetwork + is ApiError.Server -> if (e.code == 413) L10n.s.fileTooLarge else e.message else -> e.message ?: e.javaClass.simpleName } @@ -165,12 +166,12 @@ fun rememberAttachmentPicker(lib: LibrarySession, onAdded: (AddedFile) -> Unit): try { val added = lib.addFile(u, name) onAdded(added) - if (added.queued) toast(context, "离线中,「${added.name}」将在联网后上传") - else if (added.duplicate) toast(context, "重复文件已合并") + if (added.queued) toast(context, L10n.s.queuedUpload(added.name)) + else if (added.duplicate) toast(context, L10n.s.duplicateMerged) } catch (e: kotlinx.coroutines.CancellationException) { throw e } catch (e: Exception) { - toast(context, "无法添加文件:${errorText(e)}", long = true) + toast(context, L10n.s.cannotAddFile(errorText(e)), long = true) } } } finally { @@ -200,14 +201,14 @@ fun rememberAttachmentPicker(lib: LibrarySession, onAdded: (AddedFile) -> Unit): try { camera.launch(shareUri(context, f)) } catch (_: android.content.ActivityNotFoundException) { - toast(context, "没有可用的相机应用") + toast(context, L10n.s.noCamera) } }, files = { try { files.launch(arrayOf("*/*")) } catch (_: android.content.ActivityNotFoundException) { - toast(context, "没有可用的文件选择器") + toast(context, L10n.s.noFilePicker) } }, ) @@ -261,6 +262,7 @@ private fun decodeSampled(file: File, maxPx: Int): Bitmap? { @Composable fun MediaScreen(lib: LibrarySession, onOpenNote: (String) -> Unit, onDismiss: () -> Unit) { val c = Ivy.colors + val s = LocalStrings.current val context = LocalContext.current val revision by lib.engine.revision.collectAsState() val adding by lib.adding.collectAsState() @@ -287,16 +289,16 @@ fun MediaScreen(lib: LibrarySession, onOpenNote: (String) -> Unit, onDismiss: () Dialog(onDismissRequest = onDismiss, properties = DialogProperties(usePlatformDefaultWidth = false, decorFitsSystemWindows = false)) { Column(Modifier.fillMaxSize().background(c.canvas).statusBarsPadding()) { Row(Modifier.fillMaxWidth().height(56.dp).padding(horizontal = 4.dp), verticalAlignment = Alignment.CenterVertically) { - IconButton(onClick = onDismiss) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "返回", tint = c.ink2) } - Text("媒体库", style = SerifTitle, fontSize = 19.sp, color = c.ink, modifier = Modifier.weight(1f).padding(start = 4.dp)) + IconButton(onClick = onDismiss) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = s.back, tint = c.ink2) } + Text(s.mediaLibrary, style = SerifTitle, fontSize = 19.sp, color = c.ink, modifier = Modifier.weight(1f).padding(start = 4.dp)) if (adding > 0) CircularProgressIndicator(Modifier.size(18.dp), strokeWidth = 2.dp, color = c.muted) var menu by remember { mutableStateOf(false) } Box { - IconButton(onClick = { menu = true }) { Icon(Icons.Outlined.Upload, contentDescription = "上传", tint = c.ink2) } + IconButton(onClick = { menu = true }) { Icon(Icons.Outlined.Upload, contentDescription = s.upload, tint = c.ink2) } DropdownMenu(expanded = menu, onDismissRequest = { menu = false }) { - DropdownMenuItem(text = { Text("图片或视频") }, leadingIcon = { Icon(Icons.Outlined.Image, null) }, onClick = { menu = false; picker.photos() }) - DropdownMenuItem(text = { Text("拍照") }, leadingIcon = { Icon(Icons.Outlined.Image, null) }, onClick = { menu = false; picker.camera() }) - DropdownMenuItem(text = { Text("文件") }, leadingIcon = { Icon(Icons.Outlined.AttachFile, null) }, onClick = { menu = false; picker.files() }) + DropdownMenuItem(text = { Text(s.photoOrVideo) }, leadingIcon = { Icon(Icons.Outlined.Image, null) }, onClick = { menu = false; picker.photos() }) + DropdownMenuItem(text = { Text(s.camera) }, leadingIcon = { Icon(Icons.Outlined.Image, null) }, onClick = { menu = false; picker.camera() }) + DropdownMenuItem(text = { Text(s.file) }, leadingIcon = { Icon(Icons.Outlined.AttachFile, null) }, onClick = { menu = false; picker.files() }) } } } @@ -309,11 +311,11 @@ fun MediaScreen(lib: LibrarySession, onOpenNote: (String) -> Unit, onDismiss: () Icon(Icons.Outlined.Search, null, tint = c.faint, modifier = Modifier.size(18.dp)) Spacer(Modifier.width(8.dp)) Box(Modifier.weight(1f)) { - if (query.isEmpty()) Text("搜索文件名", color = c.faint, fontSize = 15.sp) + if (query.isEmpty()) Text(s.searchFiles, color = c.faint, fontSize = 15.sp) BasicTextField(query, { query = it }, singleLine = true, textStyle = TextStyle(color = c.ink, fontSize = 15.sp), cursorBrush = androidx.compose.ui.graphics.SolidColor(c.ivy), modifier = Modifier.fillMaxWidth()) } - if (query.isNotEmpty()) Icon(Icons.Outlined.Close, "清除", tint = c.faint, modifier = Modifier.size(18.dp).clip(CircleShape).clickable { query = "" }) + if (query.isNotEmpty()) Icon(Icons.Outlined.Close, s.clear, tint = c.faint, modifier = Modifier.size(18.dp).clip(CircleShape).clickable { query = "" }) } // Filters Row(Modifier.horizontalScroll(rememberScrollState()).padding(horizontal = 12.dp), horizontalArrangement = Arrangement.spacedBy(6.dp)) { @@ -329,19 +331,19 @@ fun MediaScreen(lib: LibrarySession, onOpenNote: (String) -> Unit, onDismiss: () } val l = listing if (l?.offline == true) { - Banner(Icons.Outlined.WifiOff, "离线中,显示的是本机同步下来的文件信息,修改需要联网。") + Banner(Icons.Outlined.WifiOff, s.mediaOffline) } else if (filter == MediaLibrary.Filter.ORPHANED && (l?.items?.isNotEmpty() == true)) { val days = l.orphanDays - Banner(Icons.Outlined.Delete, if (days > 0) "${l.items.size} 个文件没有被任何笔记引用,将在 $days 天后自动移入回收站。" else "${l.items.size} 个文件没有被任何笔记引用。") + Banner(Icons.Outlined.Delete, if (days > 0) s.orphanBanner(l.items.size, days) else s.orphanBannerNoDays(l.items.size)) } when { error != null && l == null -> Centered(error ?: "") l == null -> Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { CircularProgressIndicator(color = c.muted) } l.items.isEmpty() -> Centered( when { - query.isNotBlank() -> "没有找到「${query.trim()}」" - filter == MediaLibrary.Filter.TRASH -> "回收站是空的" - else -> "还没有文件。在笔记中插入图片或附件即可自动加入媒体库。" + query.isNotBlank() -> s.noResults(query.trim()) + filter == MediaLibrary.Filter.TRASH -> s.mediaTrashEmpty + else -> s.mediaEmpty }, ) else -> LazyVerticalGrid( @@ -384,18 +386,19 @@ private fun Centered(text: String) { @Composable private fun MediaCell(lib: LibrarySession, a: Attachment, onClick: () -> Unit) { val c = Ivy.colors + val s = LocalStrings.current val context = LocalContext.current Column(Modifier.clip(RoundedCornerShape(14.dp)).clickable(onClick = onClick)) { Box { AttachmentImage(lib.editor.media, a, thumb = true, modifier = Modifier.fillMaxWidth().aspectRatio(1f).clip(RoundedCornerShape(14.dp))) if (a.public) { - Icon(Icons.Outlined.Public, contentDescription = "已公开", tint = c.surface, + Icon(Icons.Outlined.Public, contentDescription = s.isPublic, tint = c.surface, modifier = Modifier.align(Alignment.TopEnd).padding(6.dp).size(20.dp).clip(CircleShape).background(c.ivy).padding(3.dp)) } } - Text(a.name.ifEmpty { "未命名" }, fontSize = 13.sp, color = c.ink, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.padding(start = 2.dp, top = 6.dp)) + Text(a.name.ifEmpty { s.unnamed }, fontSize = 13.sp, color = c.ink, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.padding(start = 2.dp, top = 6.dp)) Text( - formatSize(context, a.size) + " · " + if (a.refs > 0) "被 ${a.refs} 篇引用" else "未引用", + formatSize(context, a.size) + " · " + if (a.refs > 0) s.refs(a.refs) else s.unreferenced, fontSize = 11.5.sp, color = if (a.refs > 0) c.faint else c.warn, maxLines = 1, modifier = Modifier.padding(start = 2.dp), ) } @@ -406,6 +409,7 @@ private fun MediaCell(lib: LibrarySession, a: Attachment, onClick: () -> Unit) { @Composable fun MediaDetailSheet(lib: LibrarySession, initial: Attachment, onChanged: () -> Unit, onOpenNote: (String) -> Unit, onDismiss: () -> Unit) { val c = Ivy.colors + val s = LocalStrings.current val context = LocalContext.current val scope = rememberCoroutineScope() var detail by remember { mutableStateOf(null) } @@ -439,7 +443,7 @@ fun MediaDetailSheet(lib: LibrarySession, initial: Attachment, onChanged: () -> fun withFile(block: (File) -> Unit) { scope.launch { val f = withContext(Dispatchers.IO) { lib.editor.media.fetch(a.id, thumb = false) } - if (f == null) toast(context, "无法取得文件,请检查网络") else block(f) + if (f == null) toast(context, s.cannotGetFile) else block(f) } } @@ -459,19 +463,19 @@ fun MediaDetailSheet(lib: LibrarySession, initial: Attachment, onChanged: () -> } } Row(verticalAlignment = Alignment.CenterVertically) { - Text(a.name.ifEmpty { "未命名" }, style = SerifTitle, fontSize = 18.sp, color = c.ink, modifier = Modifier.weight(1f)) + Text(a.name.ifEmpty { s.unnamed }, style = SerifTitle, fontSize = 18.sp, color = c.ink, modifier = Modifier.weight(1f)) if (busy) CircularProgressIndicator(Modifier.size(18.dp), strokeWidth = 2.dp, color = c.muted) - if (!a.isTrashed) IconButton(onClick = { renaming = true }) { Icon(Icons.Outlined.Edit, contentDescription = "重命名", tint = c.ink2) } + if (!a.isTrashed) IconButton(onClick = { renaming = true }) { Icon(Icons.Outlined.Edit, contentDescription = s.rename, tint = c.ink2) } } - InfoLine("类型", a.mime.ifEmpty { a.kind }) - InfoLine("大小", formatSize(context, a.size) + if ((a.width ?: 0) > 0) " · ${a.width}×${a.height}" else "") - if (a.createdAt > 0) InfoLine("上传于", shortDate(a.createdAt)) - if (a.public) InfoLine("公网链接", a.publicUrl.ifEmpty { "已公开(/r/…)" }) - if (a.isTrashed) InfoLine("回收站", if (a.trashReason == "orphan") "未引用,已自动移入" else "已移入") + InfoLine(s.type, a.mime.ifEmpty { a.kind }) + InfoLine(s.size, formatSize(context, a.size) + if ((a.width ?: 0) > 0) " · ${a.width}×${a.height}" else "") + if (a.createdAt > 0) InfoLine(s.uploadedAt, shortDate(a.createdAt)) + if (a.public) InfoLine(s.publicUrl, a.publicUrl.ifEmpty { s.publicPlaceholder }, mono = true) + if (a.isTrashed) InfoLine(s.trash, if (a.trashReason == "orphan") s.trashedOrphan else s.trashedManual) // The notes that reference it. val notes = detail?.notes.orEmpty() - Text(if (notes.isEmpty()) "没有笔记引用它" else "被 ${notes.size} 篇笔记引用", fontSize = 13.sp, color = c.muted, fontWeight = FontWeight.Medium) + Text(if (notes.isEmpty()) s.noNotesReference else s.referencedBy(notes.size), fontSize = 13.sp, color = c.muted, fontWeight = FontWeight.Medium) for (n in notes) { Row( Modifier.fillMaxWidth().clip(RoundedCornerShape(10.dp)).clickable(enabled = lib.engine.notes[n.id] != null) { onOpenNote(n.id) } @@ -480,59 +484,59 @@ fun MediaDetailSheet(lib: LibrarySession, initial: Attachment, onChanged: () -> ) { Icon(Icons.Outlined.Description, null, tint = c.muted, modifier = Modifier.size(18.dp)) Spacer(Modifier.width(10.dp)) - Text(n.title.ifBlank { "无标题" }, color = if (n.title.isBlank()) c.muted else c.ink, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis) + Text(n.title.ifBlank { s.untitled }, color = if (n.title.isBlank()) c.muted else c.ink, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis) } } HorizontalDivider(color = c.line) // Actions - SheetAction(Icons.Outlined.ContentCopy, "复制引用") { + SheetAction(Icons.Outlined.ContentCopy, s.copyReference) { copyText(context, app.ivynote.core.Links.embed(a.id, a.name, a.kind)) } if (!a.isTrashed && media.canPublish) { - SheetAction(Icons.Outlined.Link, if (a.public) "复制公网链接" else "生成公网链接") { + SheetAction(Icons.Outlined.Link, if (a.public) s.copyPublicUrl else s.makePublicUrl) { act { copyText(context, media.publish(a.id)); detail = detail?.copy(attachment = a.copy(public = true)) ?: AttachmentDetail(a.copy(public = true)) } } - if (a.public) SheetAction(Icons.Outlined.LinkOff, "撤销公网链接") { + if (a.public) SheetAction(Icons.Outlined.LinkOff, s.revokePublicUrl) { act { val u = media.unpublish(a.id); detail = detail?.copy(attachment = u) ?: AttachmentDetail(u) } } } - SheetAction(Icons.Outlined.Share, "分享或保存原文件") { + SheetAction(Icons.Outlined.Share, s.shareOriginal) { withFile { f -> shareFile(context, f, a.name.ifEmpty { a.id }, a.mime) } } if (a.isTrashed) { - SheetAction(Icons.Outlined.Restore, "恢复") { act { val u = media.restore(a.id); detail = detail?.copy(attachment = u) ?: AttachmentDetail(u) } } - SheetAction(Icons.Outlined.DeleteForever, "永久删除", danger = true) { confirmPurge = true } + SheetAction(Icons.Outlined.Restore, s.restore) { act { val u = media.restore(a.id); detail = detail?.copy(attachment = u) ?: AttachmentDetail(u) } } + SheetAction(Icons.Outlined.DeleteForever, s.deleteForever, danger = true) { confirmPurge = true } } else { - SheetAction(Icons.Outlined.Delete, "移到回收站", danger = true) { + SheetAction(Icons.Outlined.Delete, s.moveToTrash, danger = true) { act { media.trash(a.id); onDismiss() } } } if (!media.canPublish) { - Text("本地笔记库的文件只保存在这台设备上。", fontSize = 12.5.sp, color = c.faint) + Text(s.localFilesHint, fontSize = 12.5.sp, color = c.faint) } else if (a.public) { - Text("公开的文件不再受登录保护,拿到链接的人都能打开。", fontSize = 12.5.sp, color = c.faint) + Text(s.publicFilesHint, fontSize = 12.5.sp, color = c.faint) } } } if (renaming) { - TextInputDialog(title = "重命名文件", initial = a.name, onDismiss = { renaming = false }) { name -> + TextInputDialog(title = s.renameFile, initial = a.name, onDismiss = { renaming = false }) { name -> act { val u = media.rename(a.id, name); detail = detail?.copy(attachment = u) ?: AttachmentDetail(u) } } } if (confirmPurge) { - ConfirmDialog("永久删除文件?", "「${a.name}」将被永久删除,引用它的笔记会显示为缺失。此操作无法撤销。", "永久删除", onDismiss = { confirmPurge = false }) { + ConfirmDialog(s.purgeFileTitle, s.purgeFileMessage(a.name), s.deleteForever, onDismiss = { confirmPurge = false }) { act { media.purge(a.id); onDismiss() } } } } @Composable -private fun InfoLine(label: String, value: String) { +private fun InfoLine(label: String, value: String, mono: Boolean = false) { val c = Ivy.colors Row { Text(label, fontSize = 13.sp, color = c.muted, modifier = Modifier.width(72.dp)) - Text(value, fontSize = 13.sp, color = c.ink2, fontFamily = if (label == "公网链接") FontFamily.Monospace else null) + Text(value, fontSize = 13.sp, color = c.ink2, fontFamily = if (mono) FontFamily.Monospace else null) } } diff --git a/app/src/main/kotlin/app/ivynote/android/ui/NoteScreen.kt b/app/src/main/kotlin/app/ivynote/android/ui/NoteScreen.kt index 82b36b2..4243004 100644 --- a/app/src/main/kotlin/app/ivynote/android/ui/NoteScreen.kt +++ b/app/src/main/kotlin/app/ivynote/android/ui/NoteScreen.kt @@ -75,6 +75,7 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.compose.ui.viewinterop.AndroidView +import app.ivynote.core.L10n import app.ivynote.core.Links import app.ivynote.core.Outline import app.ivynote.core.SyncEngine @@ -92,6 +93,7 @@ fun NoteScreen(ui: LibraryUiState, noteId: String, wide: Boolean, onBack: () -> val engine = lib.engine val host = lib.editor val c = Ivy.colors + val s = LocalStrings.current val dark = isSystemInDarkTheme() val revision by engine.revision.collectAsState() val focused by host.focused.collectAsState() @@ -123,6 +125,7 @@ fun NoteScreen(ui: LibraryUiState, noteId: String, wide: Boolean, onBack: () -> host.open(n, focus = n.body.isEmpty() && n.title.isEmpty() && !n.isTrashed) } LaunchedEffect(dark) { host.setTheme(dark) } + LaunchedEffect(s) { host.setLanguage(L10n.language) } LaunchedEffect(note.body) { host.bodyChanged(noteId, note.body) } LaunchedEffect(note.isTrashed) { host.setReadonly(note.isTrashed) } // New and uploaded files: embeds render as their kind. @@ -133,7 +136,7 @@ fun NoteScreen(ui: LibraryUiState, noteId: String, wide: Boolean, onBack: () -> Row(Modifier.fillMaxWidth().height(56.dp).padding(horizontal = 4.dp), verticalAlignment = Alignment.CenterVertically) { if (!wide) { IconButton(onClick = { host.hideKeyboard(); onBack() }) { - Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "返回", tint = c.ink2) + Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = s.back, tint = c.ink2) } } else { Spacer(Modifier.width(12.dp)) @@ -158,23 +161,23 @@ fun NoteScreen(ui: LibraryUiState, noteId: String, wide: Boolean, onBack: () -> } } if (focused && !wide) { - TextButton(onClick = { host.hideKeyboard() }) { Text("完成", color = c.ivy, fontWeight = FontWeight.SemiBold) } + TextButton(onClick = { host.hideKeyboard() }) { Text(s.done, color = c.ivy, fontWeight = FontWeight.SemiBold) } } if (!note.isTrashed) { - IconButton(onClick = { sharing = true }) { Icon(Icons.Outlined.IosShare, contentDescription = "分享", tint = c.ink2) } + IconButton(onClick = { sharing = true }) { Icon(Icons.Outlined.IosShare, contentDescription = s.share, tint = c.ink2) } } - IconButton(onClick = { outline = true }) { Icon(Icons.Outlined.Toc, contentDescription = "大纲", tint = c.ink2) } + IconButton(onClick = { outline = true }) { Icon(Icons.Outlined.Toc, contentDescription = s.outline, tint = c.ink2) } Box { - IconButton(onClick = { menu = true }) { Icon(Icons.Outlined.MoreVert, contentDescription = "更多", tint = c.ink2) } + IconButton(onClick = { menu = true }) { Icon(Icons.Outlined.MoreVert, contentDescription = s.more, tint = c.ink2) } DropdownMenu(expanded = menu, onDismissRequest = { menu = false }) { if (!note.isTrashed) { - DropdownMenuItem(text = { Text("标签…") }, leadingIcon = { Icon(Icons.Outlined.Sell, null) }, + DropdownMenuItem(text = { Text(s.tagsEllipsis) }, leadingIcon = { Icon(Icons.Outlined.Sell, null) }, onClick = { menu = false; tagging = true }) } - DropdownMenuItem(text = { Text(if (linkCount > 0) "反向链接($linkCount)" else "反向链接") }, leadingIcon = { Icon(Icons.Outlined.Link, null) }, + DropdownMenuItem(text = { Text(if (linkCount > 0) s.backlinksMenu(linkCount) else s.backlinks) }, leadingIcon = { Icon(Icons.Outlined.Link, null) }, onClick = { menu = false; backlinks = true }) if (!engine.isLocal) { - DropdownMenuItem(text = { Text("历史版本") }, leadingIcon = { Icon(Icons.Outlined.History, null) }, + DropdownMenuItem(text = { Text(s.history) }, leadingIcon = { Icon(Icons.Outlined.History, null) }, onClick = { menu = false; history = true }) } HorizontalDivider() @@ -193,12 +196,12 @@ fun NoteScreen(ui: LibraryUiState, noteId: String, wide: Boolean, onBack: () -> ) { Icon(Icons.Outlined.Delete, null, tint = c.warnInk, modifier = Modifier.size(18.dp)) Spacer(Modifier.width(8.dp)) - Text("这篇笔记在回收站中", color = c.warnInk, fontSize = 14.sp, modifier = Modifier.weight(1f)) - TextButton(onClick = { engine.updateNote(note.id, SyncEngine.NotePatch(trashed = false)) }) { Text("恢复", color = c.warnInk) } + Text(s.noteInTrash, color = c.warnInk, fontSize = 14.sp, modifier = Modifier.weight(1f)) + TextButton(onClick = { engine.updateNote(note.id, SyncEngine.NotePatch(trashed = false)) }) { Text(s.restore, color = c.warnInk) } TextButton(onClick = { ui.selection = null engine.deleteNote(note.id) - }) { Text("永久删除", color = c.danger) } + }) { Text(s.deleteForever, color = c.danger) } } } @@ -209,7 +212,7 @@ fun NoteScreen(ui: LibraryUiState, noteId: String, wide: Boolean, onBack: () -> Row(Modifier.fillMaxWidth().padding(start = 20.dp, end = 12.dp, bottom = 6.dp), verticalAlignment = Alignment.CenterVertically) { NoteTagsRow(note, engine, editable = !note.isTrashed, onEdit = { tagging = true }, modifier = Modifier.weight(1f)) if (linkCount > 0) { - Text("$linkCount 条反向链接", fontSize = 12.5.sp, color = c.ivy, + Text(s.backlinksCount(linkCount), fontSize = 12.5.sp, color = c.ivy, modifier = Modifier.clip(RoundedCornerShape(8.dp)).clickable { backlinks = true }.padding(horizontal = 6.dp, vertical = 3.dp)) } } @@ -232,7 +235,7 @@ fun NoteScreen(ui: LibraryUiState, noteId: String, wide: Boolean, onBack: () -> } if (renaming) { - TextInputDialog(title = "重命名笔记", initial = note.title, placeholder = "无标题", onDismiss = { renaming = false }) { t -> + TextInputDialog(title = s.renameNote, initial = note.title, placeholder = s.untitled, onDismiss = { renaming = false }) { t -> engine.updateNote(note.id, SyncEngine.NotePatch(title = cleanTitle(t))) } } @@ -294,23 +297,24 @@ private fun EditorView(host: app.ivynote.android.editor.EditorHost, modifier: Mo @Composable private fun FormatBar(host: app.ivynote.android.editor.EditorHost, modifier: Modifier = Modifier, attach: (String) -> Unit) { val c = Ivy.colors + val s = LocalStrings.current val files: List> = listOf( - Triple("photo", Icons.Outlined.Image, "图片"), - Triple("camera", Icons.Outlined.PhotoCamera, "拍照"), - Triple("file", Icons.Outlined.AttachFile, "附件"), + Triple("photo", Icons.Outlined.Image, s.formatPhoto), + Triple("camera", Icons.Outlined.PhotoCamera, s.formatCamera), + Triple("file", Icons.Outlined.AttachFile, s.formatAttachment), ) val items: List> = listOf( - Triple("h1", Icons.Outlined.Title, "标题"), - Triple("bold", Icons.Outlined.FormatBold, "加粗"), - Triple("italic", Icons.Outlined.FormatItalic, "斜体"), - Triple("task", Icons.Outlined.CheckBox, "待办"), - Triple("list", Icons.AutoMirrored.Filled.FormatListBulleted, "列表"), - Triple("ordered", Icons.Outlined.FormatListNumbered, "编号"), - Triple("quote", Icons.Outlined.FormatQuote, "引用"), - Triple("code", Icons.Outlined.Code, "代码"), - Triple("wiki", Icons.Outlined.AddLink, "双链"), - Triple("link", Icons.Outlined.Link, "链接"), - Triple("strike", Icons.Outlined.StrikethroughS, "删除线"), + Triple("h1", Icons.Outlined.Title, s.formatHeading), + Triple("bold", Icons.Outlined.FormatBold, s.formatBold), + Triple("italic", Icons.Outlined.FormatItalic, s.formatItalic), + Triple("task", Icons.Outlined.CheckBox, s.formatTask), + Triple("list", Icons.AutoMirrored.Filled.FormatListBulleted, s.formatList), + Triple("ordered", Icons.Outlined.FormatListNumbered, s.formatOrdered), + Triple("quote", Icons.Outlined.FormatQuote, s.formatQuote), + Triple("code", Icons.Outlined.Code, s.formatCode), + Triple("wiki", Icons.Outlined.AddLink, s.formatWikiLink), + Triple("link", Icons.Outlined.Link, s.formatLink), + Triple("strike", Icons.Outlined.StrikethroughS, s.formatStrike), ) androidx.compose.material3.Surface( modifier = modifier.heightIn(min = 48.dp), @@ -328,8 +332,8 @@ private fun FormatBar(host: app.ivynote.android.editor.EditorHost, modifier: Mod IconButton(onClick = { host.command(cmd) }) { Icon(icon, contentDescription = label, tint = c.ink2) } } } - IconButton(onClick = { host.command("undo") }) { Icon(Icons.AutoMirrored.Filled.Undo, contentDescription = "撤销", tint = c.ink2) } - IconButton(onClick = { host.hideKeyboard() }) { Icon(Icons.Outlined.KeyboardHide, contentDescription = "收起键盘", tint = c.ink2) } + IconButton(onClick = { host.command("undo") }) { Icon(Icons.AutoMirrored.Filled.Undo, contentDescription = s.undo, tint = c.ink2) } + IconButton(onClick = { host.hideKeyboard() }) { Icon(Icons.Outlined.KeyboardHide, contentDescription = s.hideKeyboard, tint = c.ink2) } } } } @@ -339,12 +343,13 @@ private fun FormatBar(host: app.ivynote.android.editor.EditorHost, modifier: Mod @Composable private fun OutlineSheet(body: String, topLine: Int, onPick: (Int) -> Unit, onDismiss: () -> Unit) { val c = Ivy.colors + val s = LocalStrings.current val headings = remember(body) { Outline.headings(body) } val current = Outline.current(headings, topLine) val top = headings.minOfOrNull { it.level } ?: 1 ModalBottomSheet(onDismissRequest = onDismiss, sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = false), containerColor = c.surface) { Row(Modifier.padding(horizontal = 24.dp, vertical = 4.dp), verticalAlignment = Alignment.CenterVertically) { - Text("大纲", fontWeight = FontWeight.SemiBold, fontSize = 16.sp, color = c.ink) + Text(s.outline, fontWeight = FontWeight.SemiBold, fontSize = 16.sp, color = c.ink) if (headings.isNotEmpty()) { Spacer(Modifier.width(6.dp)) Text("${headings.size}", fontSize = 13.sp, color = c.faint) @@ -352,8 +357,8 @@ private fun OutlineSheet(body: String, topLine: Int, onPick: (Int) -> Unit, onDi } if (headings.isEmpty()) { Column(Modifier.padding(24.dp)) { - Text("还没有标题", color = c.muted, fontWeight = FontWeight.Medium) - Text("以 # 开头的行会出现在这里。", color = c.faint, fontSize = 13.sp) + Text(s.noHeadings, color = c.muted, fontWeight = FontWeight.Medium) + Text(s.noHeadingsHint, color = c.faint, fontSize = 13.sp) } } else { HorizontalDivider(color = c.line, modifier = Modifier.padding(top = 8.dp)) diff --git a/app/src/main/kotlin/app/ivynote/android/ui/NoteSheets.kt b/app/src/main/kotlin/app/ivynote/android/ui/NoteSheets.kt index 80b180a..586244f 100644 --- a/app/src/main/kotlin/app/ivynote/android/ui/NoteSheets.kt +++ b/app/src/main/kotlin/app/ivynote/android/ui/NoteSheets.kt @@ -73,6 +73,7 @@ import androidx.compose.ui.window.DialogProperties import app.ivynote.android.IvyApp import app.ivynote.android.LibrarySession import app.ivynote.core.ApiError +import app.ivynote.core.L10n import app.ivynote.core.Links import app.ivynote.core.Note import app.ivynote.core.Revision @@ -88,18 +89,19 @@ import java.io.File @Composable fun BacklinksSheet(engine: SyncEngine, note: Note, onOpen: (String) -> Unit, onDismiss: () -> Unit) { val c = Ivy.colors + val s = LocalStrings.current val revision by engine.revision.collectAsState() val links = remember(revision, note.id) { Links.backlinks(note.id, engine.notes.values) } ModalBottomSheet(onDismissRequest = onDismiss, sheetState = rememberModalBottomSheetState(), containerColor = c.surface) { Row(Modifier.padding(horizontal = 24.dp, vertical = 4.dp), verticalAlignment = Alignment.CenterVertically) { - Text("反向链接", fontWeight = FontWeight.SemiBold, fontSize = 16.sp, color = c.ink) + Text(s.backlinks, fontWeight = FontWeight.SemiBold, fontSize = 16.sp, color = c.ink) Spacer(Modifier.width(6.dp)) Text("${links.size}", fontSize = 13.sp, color = c.faint) } if (links.isEmpty()) { Column(Modifier.padding(24.dp)) { - Text("还没有笔记链接到这里", color = c.muted, fontWeight = FontWeight.Medium) - Text("在其他笔记中输入 [[${displayTitle(note)}]] 即可链接到这篇笔记。", color = c.faint, fontSize = 13.sp) + Text(s.noBacklinks, color = c.muted, fontWeight = FontWeight.Medium) + Text(s.noBacklinksHint(displayTitle(note)), color = c.faint, fontSize = 13.sp) } } else { HorizontalDivider(color = c.line, modifier = Modifier.padding(top = 8.dp)) @@ -136,6 +138,7 @@ fun BacklinksSheet(engine: SyncEngine, note: Note, onOpen: (String) -> Unit, onD @Composable fun HistoryScreen(lib: LibrarySession, note: Note, onDismiss: () -> Unit) { val c = Ivy.colors + val s = LocalStrings.current val context = LocalContext.current val api = lib.api val scope = rememberCoroutineScope() @@ -167,23 +170,23 @@ fun HistoryScreen(lib: LibrarySession, note: Note, onDismiss: () -> Unit) { Column(Modifier.fillMaxSize().background(c.surface).statusBarsPadding()) { Row(Modifier.fillMaxWidth().height(56.dp).padding(horizontal = 4.dp), verticalAlignment = Alignment.CenterVertically) { IconButton(onClick = { if (picked != null) picked = null else onDismiss() }) { - Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "返回", tint = c.ink2) + Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = s.back, tint = c.ink2) } Column(Modifier.weight(1f).padding(start = 4.dp)) { - Text("历史版本", style = SerifTitle, fontSize = 18.sp, color = c.ink) + Text(s.history, style = SerifTitle, fontSize = 18.sp, color = c.ink) Text(displayTitle(note), fontSize = 12.sp, color = c.faint, maxLines = 1, overflow = TextOverflow.Ellipsis) } val p = picked if (p != null && p.rev != list?.firstOrNull()?.rev) { - TextButton(enabled = preview != null, onClick = { confirm = true }) { Text("恢复此版本", color = c.ivy, fontWeight = FontWeight.SemiBold) } + TextButton(enabled = preview != null, onClick = { confirm = true }) { Text(s.restoreVersion, color = c.ivy, fontWeight = FontWeight.SemiBold) } } } val l = list when { - api == null -> EmptyState(Icons.Outlined.History, "本地笔记库没有历史版本", "历史版本保存在同步服务器上。") - error != null && l == null -> EmptyState(Icons.Outlined.WifiOff, "无法载入历史版本", error ?: "") + api == null -> EmptyState(Icons.Outlined.History, s.localNoHistory, s.localNoHistoryHint) + error != null && l == null -> EmptyState(Icons.Outlined.WifiOff, s.historyLoadFailed, error ?: "") l == null -> Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { CircularProgressIndicator(color = c.muted) } - l.isEmpty() -> EmptyState(Icons.Outlined.History, "暂无历史版本", "编辑并同步后,这里会出现保存过的版本。") + l.isEmpty() -> EmptyState(Icons.Outlined.History, s.noHistory, s.noHistoryHint) picked != null -> { val r = preview if (r == null) { @@ -192,7 +195,7 @@ fun HistoryScreen(lib: LibrarySession, note: Note, onDismiss: () -> Unit) { Column(Modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(horizontal = 24.dp, vertical = 12.dp).navigationBarsPadding()) { Text(revisionLabel(r, l.first().rev == r.rev), fontSize = 12.5.sp, color = c.faint) Spacer(Modifier.height(8.dp)) - Text(r.title.ifBlank { "无标题" }, style = SerifTitle, fontSize = 22.sp, color = if (r.title.isBlank()) c.muted else c.ink) + Text(r.title.ifBlank { s.untitled }, style = SerifTitle, fontSize = 22.sp, color = if (r.title.isBlank()) c.muted else c.ink) Spacer(Modifier.height(12.dp)) SelectionContainer { Text(r.body.orEmpty(), fontFamily = FontFamily.Monospace, fontSize = 13.5.sp, color = c.ink2, lineHeight = 20.sp) @@ -209,11 +212,11 @@ fun HistoryScreen(lib: LibrarySession, note: Note, onDismiss: () -> Unit) { ) { Column(Modifier.weight(1f)) { Text(fullDate(r.createdAt), fontSize = 15.sp, color = c.ink, fontWeight = if (current) FontWeight.SemiBold else FontWeight.Normal) - Text(listOf(r.device.ifEmpty { "未知设备" }, formatSize(context, r.size), r.title.ifBlank { "无标题" }).joinToString(" · "), + Text(listOf(r.device.ifEmpty { s.unknownDevice }, formatSize(context, r.size), r.title.ifBlank { s.untitled }).joinToString(" · "), fontSize = 12.5.sp, color = c.faint, maxLines = 1, overflow = TextOverflow.Ellipsis) } if (current) { - Text("当前版本", fontSize = 12.sp, color = c.ivyInk, + Text(s.currentVersion, fontSize = 12.sp, color = c.ivyInk, modifier = Modifier.clip(RoundedCornerShape(50)).background(c.ivySoft).padding(horizontal = 8.dp, vertical = 2.dp)) } } @@ -224,10 +227,10 @@ fun HistoryScreen(lib: LibrarySession, note: Note, onDismiss: () -> Unit) { } if (confirm) { val r = preview - ConfirmDialog("恢复此版本?", "当前内容会被替换,但仍会保留在历史版本中。", "恢复", destructive = false, onDismiss = { confirm = false }) { + ConfirmDialog(s.restoreVersionTitle, s.restoreVersionMessage, s.restore, destructive = false, onDismiss = { confirm = false }) { if (r != null) { lib.engine.updateNote(note.id, SyncEngine.NotePatch(title = r.title, body = r.body.orEmpty())) - toast(context, "已恢复为历史版本") + toast(context, s.restoredVersion) scope.launch { lib.engine.sync() } onDismiss() } @@ -236,11 +239,11 @@ fun HistoryScreen(lib: LibrarySession, note: Note, onDismiss: () -> Unit) { } private fun revisionLabel(r: Revision, current: Boolean): String = - fullDate(r.createdAt) + (if (r.device.isNotEmpty()) " · ${r.device}" else "") + if (current) " · 当前版本" else "" + fullDate(r.createdAt) + (if (r.device.isNotEmpty()) " · ${r.device}" else "") + if (current) " · " + L10n.s.currentVersion else "" -/** 2026年11月6日 16:20, for lists where the exact moment matters. */ +/** 2026年11月6日 16:20 / Nov 6, 2026 16:20, for lists where the exact moment matters. */ fun fullDate(at: Long): String = - java.text.SimpleDateFormat("yyyy年M月d日 HH:mm", java.util.Locale.CHINA).format(java.util.Date(at)) + java.text.SimpleDateFormat(L10n.s.dateTimePattern, L10n.s.locale).format(java.util.Date(at)) @Composable private fun EmptyState(icon: androidx.compose.ui.graphics.vector.ImageVector, title: String, hint: String) { @@ -263,6 +266,7 @@ private fun EmptyState(icon: androidx.compose.ui.graphics.vector.ImageVector, ti @Composable fun ShareSheet(lib: LibrarySession, note: Note, onDismiss: () -> Unit) { val c = Ivy.colors + val s = LocalStrings.current val context = LocalContext.current val scope = rememberCoroutineScope() val api = lib.api @@ -323,7 +327,7 @@ fun ShareSheet(lib: LibrarySession, note: Note, onDismiss: () -> Unit) { a.exportNote(note.id, public = true) } catch (e: ApiError) { if (!e.isTransient) throw e - toast(context, "离线中,附件没有替换为公网链接") + toast(context, s.offlineNoPublicLinks) local } } @@ -349,17 +353,17 @@ fun ShareSheet(lib: LibrarySession, note: Note, onDismiss: () -> Unit) { ModalBottomSheet(onDismissRequest = onDismiss, sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true), containerColor = c.surface) { Column(Modifier.fillMaxWidth().verticalScroll(rememberScrollState()).padding(horizontal = 20.dp).padding(bottom = 28.dp), verticalArrangement = Arrangement.spacedBy(16.dp)) { - Text("分享笔记", style = SerifTitle, fontSize = 19.sp, color = c.ink) + Text(s.shareNote, style = SerifTitle, fontSize = 19.sp, color = c.ink) when { - api == null -> Text("本地笔记库不能生成公开链接,可以复制或导出笔记。", fontSize = 13.sp, color = c.muted) + api == null -> Text(s.localNoShare, fontSize = 13.sp, color = c.muted) loading -> Box(Modifier.fillMaxWidth().padding(16.dp), contentAlignment = Alignment.Center) { CircularProgressIndicator(color = c.muted) } - offline -> Text("分享链接需要联网。", fontSize = 13.sp, color = c.muted) + offline -> Text(s.shareNeedsNetwork, fontSize = 13.sp, color = c.muted) else -> { Row(verticalAlignment = Alignment.CenterVertically) { Column(Modifier.weight(1f)) { - Text("公开链接", fontSize = 15.sp, fontWeight = FontWeight.Medium, color = c.ink) - Text("拿到链接和访问密码的人可以阅读这篇笔记", fontSize = 12.5.sp, color = c.muted) + Text(s.publicLink, fontSize = 15.sp, fontWeight = FontWeight.Medium, color = c.ink) + Text(s.publicLinkHint, fontSize = 12.5.sp, color = c.muted) } Switch( checked = live || asking && !changing, @@ -387,64 +391,64 @@ fun ShareSheet(lib: LibrarySession, note: Note, onDismiss: () -> Unit) { Icon(Icons.Outlined.Lock, null, tint = c.ivy, modifier = Modifier.size(15.dp).padding(top = 2.dp)) Spacer(Modifier.width(8.dp)) Text( - if (share?.enabled == true && share?.hasPassword == false) "这个链接是在要求密码之前创建的,设置密码后才能继续访问。" - else "为保护你的隐私,公开链接必须设置至少 6 位的访问密码。", + if (share?.enabled == true && share?.hasPassword == false) s.legacyShare + else s.needPassword, fontSize = 12.5.sp, color = c.muted, ) } Row(verticalAlignment = Alignment.CenterVertically) { OutlinedTextField( value = password, onValueChange = { password = it.take(72) }, singleLine = true, - placeholder = { Text("新密码(至少 6 位)") }, + placeholder = { Text(s.newPasswordPlaceholder) }, textStyle = androidx.compose.ui.text.TextStyle(fontFamily = FontFamily.Monospace, fontSize = 15.sp), isError = err != null, modifier = Modifier.weight(1f), ) - TextButton(onClick = { password = Share.generatePassword() }) { Text("随机生成") } + TextButton(onClick = { password = Share.generatePassword() }) { Text(s.generate) } } if (err != null) Text(err, color = c.danger, fontSize = 12.sp) Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End) { - if (changing) TextButton(onClick = { changing = false; password = "" }) { Text("取消") } - InkButton(if (changing) "保存" else "生成链接", busy = saving, enabled = Share.passwordError(password) == null, + if (changing) TextButton(onClick = { changing = false; password = "" }) { Text(s.cancel) } + InkButton(if (changing) s.save else s.createLink, busy = saving, enabled = Share.passwordError(password) == null, onClick = { save(enabled = true, newPassword = password) }) } } } - val s = share - AnimatedVisibility(live && s != null) { - if (s == null) return@AnimatedVisibility + val sh = share + AnimatedVisibility(live && sh != null) { + if (sh == null) return@AnimatedVisibility Column(verticalArrangement = Arrangement.spacedBy(12.dp)) { Row( Modifier.fillMaxWidth().clip(RoundedCornerShape(12.dp)).background(c.sunken).padding(start = 12.dp), verticalAlignment = Alignment.CenterVertically, ) { Text(link, fontFamily = FontFamily.Monospace, fontSize = 12.5.sp, color = c.ink2, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f)) - TextButton(onClick = { copyText(context, link) }) { Text("复制链接") } + TextButton(onClick = { copyText(context, link) }) { Text(s.copyLink) } } - if (s.expired) Text("分享已过期", color = c.danger, fontSize = 12.sp) + if (sh.expired) Text(s.shareExpired, color = c.danger, fontSize = 12.sp) Row( Modifier.fillMaxWidth().clip(RoundedCornerShape(12.dp)).background(c.sunken).padding(start = 12.dp), verticalAlignment = Alignment.CenterVertically, ) { Icon(Icons.Outlined.Lock, null, tint = c.ivy, modifier = Modifier.size(14.dp)) Spacer(Modifier.width(8.dp)) - if (s.password.isNotEmpty()) { - Text(s.password, fontFamily = FontFamily.Monospace, fontWeight = FontWeight.Medium, fontSize = 14.sp, color = c.ink, modifier = Modifier.weight(1f)) - IconButton(onClick = { copyText(context, s.password) }) { Icon(Icons.Outlined.ContentCopy, contentDescription = "复制密码", tint = c.ink2, modifier = Modifier.size(16.dp)) } + if (sh.password.isNotEmpty()) { + Text(sh.password, fontFamily = FontFamily.Monospace, fontWeight = FontWeight.Medium, fontSize = 14.sp, color = c.ink, modifier = Modifier.weight(1f)) + IconButton(onClick = { copyText(context, sh.password) }) { Icon(Icons.Outlined.ContentCopy, contentDescription = s.copyPassword, tint = c.ink2, modifier = Modifier.size(16.dp)) } } else { - Text("已设置访问密码", fontSize = 13.sp, color = c.muted, modifier = Modifier.weight(1f)) + Text(s.passwordSet, fontSize = 13.sp, color = c.muted, modifier = Modifier.weight(1f)) } - if (!changing) TextButton(onClick = { changing = true; password = Share.generatePassword() }) { Text("修改密码", fontSize = 12.5.sp) } + if (!changing) TextButton(onClick = { changing = true; password = Share.generatePassword() }) { Text(s.changePassword, fontSize = 12.5.sp) } } - if (s.password.isNotEmpty()) { - InkButton("复制链接和密码", modifier = Modifier.fillMaxWidth(), onClick = { copyText(context, Share.message(title, link, s.password)) }) + if (sh.password.isNotEmpty()) { + InkButton(s.copyLinkAndPassword, modifier = Modifier.fillMaxWidth(), onClick = { copyText(context, Share.message(title, link, sh.password)) }) } Row(verticalAlignment = Alignment.CenterVertically) { - Text("有效期", fontSize = 13.sp, color = c.muted) + Text(s.expires, fontSize = 13.sp, color = c.muted) Spacer(Modifier.width(8.dp)) - ExpiryPicker(s, enabled = !saving) { days -> save(days = days) } + ExpiryPicker(sh, enabled = !saving) { days -> save(days = days) } Spacer(Modifier.weight(1f)) - Text("${s.views} 次访问", fontSize = 12.5.sp, color = c.faint) + Text(s.views(sh.views), fontSize = 12.5.sp, color = c.faint) } } } @@ -453,22 +457,22 @@ fun ShareSheet(lib: LibrarySession, note: Note, onDismiss: () -> Unit) { HorizontalDivider(color = c.line) Column(verticalArrangement = Arrangement.spacedBy(2.dp)) { - Text("复制或导出", fontSize = 15.sp, fontWeight = FontWeight.Medium, color = c.ink) + Text(s.copyOrExport, fontSize = 15.sp, fontWeight = FontWeight.Medium, color = c.ink) Text( - if (api != null && !offline && state.status != app.ivynote.core.SyncState.Status.OFFLINE) "附件会自动公开并替换为公网链接,方便粘贴到博客、公众号等地方。" - else "离线时附件不会替换为公网链接。", + if (api != null && !offline && state.status != app.ivynote.core.SyncState.Status.OFFLINE) s.copyAsHint + else s.copyAsOffline, fontSize = 12.5.sp, color = c.muted, ) } if (exporting) Box(Modifier.fillMaxWidth(), contentAlignment = Alignment.Center) { CircularProgressIndicator(Modifier.size(20.dp), strokeWidth = 2.dp, color = c.muted) } - SheetAction(Icons.Outlined.ContentCopy, "复制 Markdown", enabled = !exporting) { export { md -> copyText(context, md) } } - SheetAction(Icons.Outlined.Share, "发送到其他应用", enabled = !exporting) { + SheetAction(Icons.Outlined.ContentCopy, s.copyMarkdown, enabled = !exporting) { export { md -> copyText(context, md) } } + SheetAction(Icons.Outlined.Share, s.sendToApp, enabled = !exporting) { export { md -> val intent = Intent(Intent.ACTION_SEND).setType("text/plain").putExtra(Intent.EXTRA_SUBJECT, title).putExtra(Intent.EXTRA_TEXT, md) context.startActivity(Intent.createChooser(intent, title)) } } - SheetAction(Icons.Outlined.FileDownload, "导出 .md 文件", enabled = !exporting) { + SheetAction(Icons.Outlined.FileDownload, s.exportMd, enabled = !exporting) { export { md -> val name = title.replace(Regex("[\\\\/:*?\"<>|]"), "-") + ".md" val tmp = File(IvyApp.instance.transferDir(), "export-" + System.nanoTime()).apply { writeText(md) } @@ -486,16 +490,17 @@ fun ShareSheet(lib: LibrarySession, note: Note, onDismiss: () -> Unit) { @Composable private fun ExpiryPicker(share: Share, enabled: Boolean, onPick: (Int) -> Unit) { val c = Ivy.colors + val s = LocalStrings.current var open by remember { mutableStateOf(false) } val label = when { - share.expiresAt == 0L -> "永久有效" - else -> "至 " + java.text.SimpleDateFormat("M月d日", java.util.Locale.CHINA).format(java.util.Date(share.expiresAt)) + share.expiresAt == 0L -> s.neverExpires + else -> s.until(java.text.SimpleDateFormat(s.monthDayPattern, s.locale).format(java.util.Date(share.expiresAt))) } Box { Text(label, fontSize = 13.sp, color = if (enabled) c.ivy else c.faint, modifier = Modifier.clip(RoundedCornerShape(8.dp)).clickable(enabled = enabled) { open = true }.padding(horizontal = 6.dp, vertical = 4.dp)) DropdownMenu(expanded = open, onDismissRequest = { open = false }) { - for ((days, text) in listOf(1 to "1 天", 7 to "7 天", 30 to "30 天", -1 to "永久有效")) { + for ((days, text) in listOf(1 to s.days(1), 7 to s.days(7), 30 to s.days(30), -1 to s.neverExpires)) { DropdownMenuItem(text = { Text(text) }, onClick = { open = false; onPick(days) }) } } diff --git a/app/src/main/kotlin/app/ivynote/android/ui/Root.kt b/app/src/main/kotlin/app/ivynote/android/ui/Root.kt index 15cb2c1..15b3ca3 100644 --- a/app/src/main/kotlin/app/ivynote/android/ui/Root.kt +++ b/app/src/main/kotlin/app/ivynote/android/ui/Root.kt @@ -17,6 +17,7 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.key import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -26,6 +27,7 @@ import androidx.compose.ui.unit.dp import app.ivynote.android.IvyApp import app.ivynote.android.LibrarySession import app.ivynote.core.DocumentStore +import app.ivynote.core.LanguageSettings import app.ivynote.core.LibraryRef import app.ivynote.core.SessionStore import app.ivynote.core.StoredAccount @@ -81,6 +83,13 @@ fun LibraryRoot(ref: LibraryRef) { } } +/** Sends a language change made on this device (maybe offline) to the account. */ +private suspend fun pushLanguage(session: SessionStore, key: String) { + val language = IvyApp.instance.language + val tag = language.pendingTag(key) ?: return + if (session.pushLanguage(tag)) language.pushed(key, tag) +} + /** Opens a library's database and drives it with the app's foreground and background. */ @Composable fun OpenLibrary(ref: LibraryRef, account: StoredAccount?, session: SessionStore?) { @@ -89,6 +98,24 @@ fun OpenLibrary(ref: LibraryRef, account: StoredAccount?, session: SessionStore? var library by remember { mutableStateOf(null) } var openError by remember { mutableStateOf(null) } + // Signed in: the account's language comes first (LanguageSettings), the + // server's value as `/me` last returned it. + if (account != null && session != null) { + val key = LanguageSettings.accountKey(account.server, account.user.id) + val scope = rememberCoroutineScope() + DisposableEffect(key) { + val send: (String, String) -> Unit = { k, _ -> if (k == key) scope.launch { pushLanguage(session, key) } } + app.language.onAccountChoice = send + scope.launch { pushLanguage(session, key) } + onDispose { + // Libraries cross-fade: the next one may have set its own already. + if (app.language.onAccountChoice === send) app.language.onAccountChoice = null + app.language.accountClosed(key) + } + } + LaunchedEffect(key, account.user.language) { app.language.accountOpened(key, account.user.language) } + } + LaunchedEffect(ref.id, account?.user?.id) { val file = app.catalog.storeFile(ref.id) if (account != null) { @@ -113,7 +140,13 @@ fun OpenLibrary(ref: LibraryRef, account: StoredAccount?, session: SessionStore? app.foreground.collect { fg -> if (fg) { lib.activate() - session?.let { launch { it.refresh() } } + session?.let { s -> + launch { + s.refresh() + // Back online: a language change made offline goes out now. + account?.let { a -> pushLanguage(s, LanguageSettings.accountKey(a.server, a.user.id)) } + } + } } else { lib.deactivate() if (!ref.isLocal) app.appScope.launch { lib.flush() } @@ -141,9 +174,10 @@ fun OpenLibrary(ref: LibraryRef, account: StoredAccount?, session: SessionStore? verticalArrangement = Arrangement.spacedBy(16.dp, Alignment.CenterVertically), horizontalAlignment = Alignment.CenterHorizontally, ) { - Text("无法打开本地数据", style = SerifTitle) + val s = LocalStrings.current + Text(s.cannotOpenData, style = SerifTitle) Text(openError ?: "", color = Ivy.colors.muted, textAlign = TextAlign.Center) - InkButton("返回笔记库列表", onClick = { app.catalog.open(null) }) + InkButton(s.backToLibraries, onClick = { app.catalog.open(null) }) } } else { Loading() diff --git a/app/src/main/kotlin/app/ivynote/android/ui/ShelfPane.kt b/app/src/main/kotlin/app/ivynote/android/ui/ShelfPane.kt index 3ae8c0e..3fe6e48 100644 --- a/app/src/main/kotlin/app/ivynote/android/ui/ShelfPane.kt +++ b/app/src/main/kotlin/app/ivynote/android/ui/ShelfPane.kt @@ -42,6 +42,7 @@ import androidx.compose.material.icons.outlined.Description import androidx.compose.material.icons.outlined.Edit import androidx.compose.material.icons.outlined.Folder import androidx.compose.material.icons.outlined.FolderOpen +import androidx.compose.material.icons.outlined.Language import androidx.compose.material.icons.outlined.ManageAccounts import androidx.compose.material.icons.outlined.MoreHoriz import androidx.compose.material.icons.outlined.PhotoLibrary @@ -117,8 +118,10 @@ fun ShelfPane(ui: LibraryUiState, session: SessionStore?, wide: Boolean, modifie var movingNote by remember { mutableStateOf(null) } var confirmEmpty by remember { mutableStateOf(false) } var editingTag by remember { mutableStateOf(null) } + val s = LocalStrings.current - val rows = remember(revision, ui.expanded, sortBy, limits.toMap()) { + // The labels (置顶, 笔记, 回收站…) are in the interface language. + val rows = remember(revision, ui.expanded, sortBy, limits.toMap(), s) { Shelf.build(engine.folders.values, engine.notes.values, engine.tags.values, ui.expanded, sortBy, limits) } val actions = ShelfActions( @@ -168,11 +171,11 @@ fun ShelfPane(ui: LibraryUiState, session: SessionStore?, wide: Boolean, modifie contentColor = Ivy.colors.canvas, shape = CircleShape, modifier = Modifier.align(Alignment.BottomEnd).navigationBarsPadding().padding(20.dp), - ) { Icon(Icons.Outlined.Edit, contentDescription = "新建笔记") } + ) { Icon(Icons.Outlined.Edit, contentDescription = s.newNote) } } newFolderParent?.let { parent -> - TextInputDialog(title = if (parent.isEmpty()) "新建笔记本" else "新建子笔记本", confirm = "创建", onDismiss = { newFolderParent = null }) { name -> + TextInputDialog(title = if (parent.isEmpty()) s.newFolder else s.newSubfolder, confirm = s.create, onDismiss = { newFolderParent = null }) { name -> val n = name.trim().take(100) if (n.isNotEmpty()) { engine.createFolder(n, parent) @@ -181,18 +184,18 @@ fun ShelfPane(ui: LibraryUiState, session: SessionStore?, wide: Boolean, modifie } } renamingFolder?.let { f -> - TextInputDialog(title = "重命名笔记本", initial = f.name, onDismiss = { renamingFolder = null }) { name -> + TextInputDialog(title = s.renameFolder, initial = f.name, onDismiss = { renamingFolder = null }) { name -> val n = name.trim().take(100) if (n.isNotEmpty()) engine.renameFolder(f.id, n) } } deletingFolder?.let { f -> - ConfirmDialog("删除笔记本?", "「${f.name}」的子笔记本会一起删除,其中的笔记移到回收站。", "删除", onDismiss = { deletingFolder = null }) { + ConfirmDialog(s.deleteFolderTitle, s.deleteFolderMessage(f.name), s.delete, onDismiss = { deletingFolder = null }) { engine.deleteFolder(f.id) } } renamingNote?.let { n -> - TextInputDialog(title = "重命名笔记", initial = n.title, placeholder = "无标题", onDismiss = { renamingNote = null }) { title -> + TextInputDialog(title = s.renameNote, initial = n.title, placeholder = s.untitled, onDismiss = { renamingNote = null }) { title -> engine.updateNote(n.id, SyncEngine.NotePatch(title = cleanTitle(title))) } } @@ -201,7 +204,7 @@ fun ShelfPane(ui: LibraryUiState, session: SessionStore?, wide: Boolean, modifie } editingTag?.let { t -> TagEditDialog(engine, t, onDismiss = { editingTag = null }) } if (confirmEmpty) { - ConfirmDialog("清空回收站?", "回收站中的全部笔记将被永久删除,此操作无法撤销。", "清空回收站", onDismiss = { confirmEmpty = false }) { + ConfirmDialog(s.emptyTrashTitle, s.emptyTrashMessage, s.emptyTrash, onDismiss = { confirmEmpty = false }) { if (ui.selectedNote?.let { engine.notes[it]?.isTrashed } == true) ui.selection = null engine.emptyTrash() } @@ -234,6 +237,9 @@ private fun LibraryHeader(ui: LibraryUiState, session: SessionStore?, state: app val libraries by catalog.libraries.collectAsState() val ref = ui.lib.ref var open by remember { mutableStateOf(false) } + var choosingLanguage by remember { mutableStateOf(false) } + val s = LocalStrings.current + if (choosingLanguage) LanguageDialog(onDismiss = { choosingLanguage = false }) var about by remember { mutableStateOf(false) } if (about) AboutSheet(onDismiss = { about = false }) Box(Modifier.padding(horizontal = 10.dp, vertical = 6.dp)) { @@ -247,10 +253,10 @@ private fun LibraryHeader(ui: LibraryUiState, session: SessionStore?, state: app Text(ref.name, style = SerifTitle, fontSize = 19.sp, maxLines = 1, overflow = TextOverflow.Ellipsis, color = Ivy.colors.ink) SyncStatusLine(ui.lib.engine, state) } - Icon(Icons.Outlined.UnfoldMore, contentDescription = "切换笔记库", tint = Ivy.colors.faint, modifier = Modifier.size(18.dp)) + Icon(Icons.Outlined.UnfoldMore, contentDescription = s.switchLibrary, tint = Ivy.colors.faint, modifier = Modifier.size(18.dp)) } DropdownMenu(expanded = open, onDismissRequest = { open = false }) { - Caption("笔记库", Modifier.padding(horizontal = 12.dp, vertical = 4.dp)) + Caption(s.libraries, Modifier.padding(horizontal = 12.dp, vertical = 4.dp)) for (l in libraries) { DropdownMenuItem( text = { Text(l.name, maxLines = 1, overflow = TextOverflow.Ellipsis) }, @@ -263,17 +269,19 @@ private fun LibraryHeader(ui: LibraryUiState, session: SessionStore?, state: app } HorizontalDivider() if (!ref.isLocal && session != null) { - DropdownMenuItem(text = { Text("账户与同步…") }, leadingIcon = { Icon(Icons.Outlined.ManageAccounts, null) }, + DropdownMenuItem(text = { Text(s.accountAndSync) }, leadingIcon = { Icon(Icons.Outlined.ManageAccounts, null) }, onClick = { open = false; ui.showAccount = true }) } else if (catalog.library(ref.id)?.canTurnOnSync == true) { - DropdownMenuItem(text = { Text("开启多端同步…") }, leadingIcon = { Icon(Icons.Outlined.CloudUpload, null) }, + DropdownMenuItem(text = { Text(s.turnOnSyncEllipsis) }, leadingIcon = { Icon(Icons.Outlined.CloudUpload, null) }, onClick = { open = false; catalog.turnOnSync(ref.id) }) } - DropdownMenuItem(text = { Text("媒体库") }, leadingIcon = { Icon(Icons.Outlined.PhotoLibrary, null) }, + DropdownMenuItem(text = { Text(s.mediaLibrary) }, leadingIcon = { Icon(Icons.Outlined.PhotoLibrary, null) }, onClick = { open = false; ui.showMedia = true }) - DropdownMenuItem(text = { Text("管理笔记库…") }, leadingIcon = { Icon(Icons.Outlined.Book, null) }, + DropdownMenuItem(text = { Text(s.language) }, leadingIcon = { Icon(Icons.Outlined.Language, null) }, + onClick = { open = false; choosingLanguage = true }) + DropdownMenuItem(text = { Text(s.manageLibraries) }, leadingIcon = { Icon(Icons.Outlined.Book, null) }, onClick = { open = false; catalog.open(null) }) - DropdownMenuItem(text = { Text("关于与检查更新…") }, leadingIcon = { Icon(Icons.Outlined.Info, null) }, + DropdownMenuItem(text = { Text(s.aboutAndUpdates) }, leadingIcon = { Icon(Icons.Outlined.Info, null) }, onClick = { open = false; about = true }) } } @@ -290,7 +298,7 @@ private fun SearchField(query: String, onChange: (String) -> Unit) { Icon(Icons.Outlined.Search, contentDescription = null, tint = c.faint, modifier = Modifier.size(18.dp)) Spacer(Modifier.width(8.dp)) Box(Modifier.weight(1f)) { - if (query.isEmpty()) Text("搜索笔记", color = c.faint, fontSize = 15.sp) + if (query.isEmpty()) Text(LocalStrings.current.searchNotes, color = c.faint, fontSize = 15.sp) BasicTextField( value = query, onValueChange = onChange, @@ -301,7 +309,7 @@ private fun SearchField(query: String, onChange: (String) -> Unit) { ) } if (query.isNotEmpty()) { - Icon(Icons.Outlined.Close, contentDescription = "清除", tint = c.faint, + Icon(Icons.Outlined.Close, contentDescription = LocalStrings.current.clear, tint = c.faint, modifier = Modifier.size(18.dp).clip(CircleShape).clickable { onChange("") }) } } @@ -367,7 +375,7 @@ private fun RowContent(row: Shelf.Row, engine: SyncEngine, onHeadingMenu: () -> } Shelf.Kind.HEADING -> Row(Modifier.fillMaxWidth().padding(start = 8.dp, top = 6.dp), verticalAlignment = Alignment.CenterVertically) { Text(row.label, fontSize = 12.5.sp, fontWeight = FontWeight.SemiBold, color = c.muted, modifier = Modifier.weight(1f)) - IconButton(onClick = onHeadingMenu) { Icon(Icons.Outlined.MoreHoriz, contentDescription = "排序与新建", tint = c.muted) } + IconButton(onClick = onHeadingMenu) { Icon(Icons.Outlined.MoreHoriz, contentDescription = LocalStrings.current.sortAndNew, tint = c.muted) } } Shelf.Kind.CREATE -> Row(Modifier.padding(start = 8.dp), verticalAlignment = Alignment.CenterVertically) { Icon(Icons.Outlined.Add, null, tint = c.muted, modifier = Modifier.size(20.dp)) @@ -375,7 +383,7 @@ private fun RowContent(row: Shelf.Row, engine: SyncEngine, onHeadingMenu: () -> Text(row.label, color = c.muted, fontSize = 15.sp) } Shelf.Kind.MORE -> Row(Modifier.padding(start = indent(row.depth) + 30.dp), verticalAlignment = Alignment.CenterVertically) { - Text("再显示 ${minOf(row.count, Shelf.PAGE)} 篇(共 ${row.count} 篇未显示)", color = c.ivy, fontSize = 13.5.sp) + Text(LocalStrings.current.showMore(minOf(row.count, Shelf.PAGE), row.count), color = c.ivy, fontSize = 13.5.sp) } else -> Row(Modifier.fillMaxWidth().padding(start = 4.dp + indent(row.depth), end = 10.dp), verticalAlignment = Alignment.CenterVertically) { Box(Modifier.width(20.dp), contentAlignment = Alignment.Center) { @@ -391,7 +399,7 @@ private fun RowContent(row: Shelf.Row, engine: SyncEngine, onHeadingMenu: () -> val untitled = row.kind == Shelf.Kind.NOTE && row.label.isBlank() Text( when { - untitled -> "无标题" + untitled -> LocalStrings.current.untitled row.kind == Shelf.Kind.TAG -> "#" + row.label else -> row.label }, @@ -408,7 +416,7 @@ private fun RowContent(row: Shelf.Row, engine: SyncEngine, onHeadingMenu: () -> } if (note != null && note.pinned && !note.isTrashed && row.parent != Shelf.PINNED_KEY) { Spacer(Modifier.width(6.dp)) - Icon(Icons.Filled.PushPin, contentDescription = "置顶", tint = c.warn, modifier = Modifier.size(13.dp)) + Icon(Icons.Filled.PushPin, contentDescription = LocalStrings.current.pinned, tint = c.warn, modifier = Modifier.size(13.dp)) } if (row.count > 0) { Spacer(Modifier.width(6.dp)) @@ -424,7 +432,7 @@ private fun indent(depth: Int) = (minOf(depth, 4) * 16 + maxOf(depth - 4, 0) * 8 @Composable private fun Chevron(open: Boolean, modifier: Modifier = Modifier) { val angle by animateFloatAsState(if (open) 90f else 0f, label = "chevron") - Icon(Icons.AutoMirrored.Filled.KeyboardArrowRight, contentDescription = if (open) "收起" else "展开", + Icon(Icons.AutoMirrored.Filled.KeyboardArrowRight, contentDescription = if (open) LocalStrings.current.collapse else LocalStrings.current.expand, tint = Ivy.colors.faint, modifier = modifier.size(18.dp).rotate(angle)) } @@ -459,30 +467,32 @@ private fun RowMenu( } when (row.kind) { Shelf.Kind.HEADING -> { - Caption("排序", Modifier.padding(horizontal = 12.dp, vertical = 4.dp)) - for (s in Shelf.SortBy.entries) { + val s = LocalStrings.current + Caption(s.sort, Modifier.padding(horizontal = 12.dp, vertical = 4.dp)) + for (option in Shelf.SortBy.entries) { DropdownMenuItem( - text = { Text(s.label) }, - leadingIcon = { if (s == sortBy) Icon(Icons.Outlined.Check, null, tint = Ivy.colors.ivy) else Spacer(Modifier.size(24.dp)) }, - onClick = { close(); onSort(s) }, + text = { Text(option.label) }, + leadingIcon = { if (option == sortBy) Icon(Icons.Outlined.Check, null, tint = Ivy.colors.ivy) else Spacer(Modifier.size(24.dp)) }, + onClick = { close(); onSort(option) }, ) } HorizontalDivider() - item("新建笔记", Icons.Outlined.Edit) { actions.newNote("") }() - item("新建笔记本", Icons.Outlined.CreateNewFolder) { actions.newFolder("") }() + item(s.newNote, Icons.Outlined.Edit) { actions.newNote("") }() + item(s.newFolder, Icons.Outlined.CreateNewFolder) { actions.newFolder("") }() } Shelf.Kind.FOLDER -> row.folder?.let { f -> - item("新建笔记", Icons.Outlined.Edit) { actions.newNote(f.id) }() - item("新建子笔记本", Icons.Outlined.CreateNewFolder) { actions.newFolder(f.id) }() - item("重命名", Icons.Outlined.Edit) { actions.renameFolder(f) }() - item("删除", Icons.Outlined.Delete, danger = true) { actions.deleteFolder(f) }() + val s = LocalStrings.current + item(s.newNote, Icons.Outlined.Edit) { actions.newNote(f.id) }() + item(s.newSubfolder, Icons.Outlined.CreateNewFolder) { actions.newFolder(f.id) }() + item(s.rename, Icons.Outlined.Edit) { actions.renameFolder(f) }() + item(s.delete, Icons.Outlined.Delete, danger = true) { actions.deleteFolder(f) }() } Shelf.Kind.NOTE -> row.note?.let { n -> NoteMenuItems(n, ui, engine, actions, close) } Shelf.Kind.TAG -> row.tag?.let { t -> - item("编辑标签…", Icons.Outlined.Edit) { actions.editTag(t) }() + item(LocalStrings.current.editTagEllipsis, Icons.Outlined.Edit) { actions.editTag(t) }() } Shelf.Kind.GROUP -> if (row.key == Shelf.TRASH_KEY) { - item("清空回收站", Icons.Outlined.DeleteForever, danger = true) { actions.emptyTrash() }() + item(LocalStrings.current.emptyTrash, Icons.Outlined.DeleteForever, danger = true) { actions.emptyTrash() }() } else -> Unit } @@ -492,26 +502,27 @@ private fun RowMenu( @Composable fun NoteMenuItems(n: Note, ui: LibraryUiState, engine: SyncEngine, actions: ShelfActions?, close: () -> Unit) { val c = Ivy.colors + val s = LocalStrings.current fun clearIfSelected() { if (ui.selectedNote == n.id) ui.selection = null } if (n.isTrashed) { - DropdownMenuItem(text = { Text("恢复") }, leadingIcon = { Icon(Icons.Outlined.Restore, null) }, + DropdownMenuItem(text = { Text(s.restore) }, leadingIcon = { Icon(Icons.Outlined.Restore, null) }, onClick = { close(); engine.updateNote(n.id, SyncEngine.NotePatch(trashed = false)) }) - DropdownMenuItem(text = { Text("永久删除", color = c.danger) }, leadingIcon = { Icon(Icons.Outlined.DeleteForever, null, tint = c.danger) }, + DropdownMenuItem(text = { Text(s.deleteForever, color = c.danger) }, leadingIcon = { Icon(Icons.Outlined.DeleteForever, null, tint = c.danger) }, onClick = { close(); clearIfSelected(); engine.deleteNote(n.id) }) } else { - DropdownMenuItem(text = { Text(if (n.pinned) "取消置顶" else "置顶") }, leadingIcon = { Icon(Icons.Outlined.PushPin, null) }, + DropdownMenuItem(text = { Text(if (n.pinned) s.unpin else s.pin) }, leadingIcon = { Icon(Icons.Outlined.PushPin, null) }, onClick = { close(); engine.updateNote(n.id, SyncEngine.NotePatch(pinned = !n.pinned)) }) if (actions != null) { - DropdownMenuItem(text = { Text("重命名") }, leadingIcon = { Icon(Icons.Outlined.Edit, null) }, + DropdownMenuItem(text = { Text(s.rename) }, leadingIcon = { Icon(Icons.Outlined.Edit, null) }, onClick = { close(); actions.renameNote(n) }) - DropdownMenuItem(text = { Text("移动到…") }, leadingIcon = { Icon(Icons.Outlined.Folder, null) }, + DropdownMenuItem(text = { Text(s.moveToEllipsis) }, leadingIcon = { Icon(Icons.Outlined.Folder, null) }, onClick = { close(); actions.moveNote(n) }) } - DropdownMenuItem(text = { Text("复制笔记") }, leadingIcon = { Icon(Icons.Outlined.ContentCopy, null) }, + DropdownMenuItem(text = { Text(s.duplicateNote) }, leadingIcon = { Icon(Icons.Outlined.ContentCopy, null) }, onClick = { close(); engine.duplicateNote(n.id)?.let { ui.reveal(it.id) } }) - DropdownMenuItem(text = { Text("移到回收站", color = c.danger) }, leadingIcon = { Icon(Icons.Outlined.Delete, null, tint = c.danger) }, + DropdownMenuItem(text = { Text(s.moveToTrash, color = c.danger) }, leadingIcon = { Icon(Icons.Outlined.Delete, null, tint = c.danger) }, onClick = { close(); clearIfSelected(); engine.updateNote(n.id, SyncEngine.NotePatch(trashed = true)) }) } } @@ -522,13 +533,14 @@ fun MoveDialog(engine: SyncEngine, note: Note, onDismiss: () -> Unit) { val c = Ivy.colors val revision by engine.revision.collectAsState() val folders = remember(revision) { Shelf.flatFolders(engine.folders.values) } + val s = LocalStrings.current androidx.compose.material3.AlertDialog( onDismissRequest = onDismiss, - title = { Text("移动到") }, + title = { Text(s.moveTo) }, text = { LazyColumn(Modifier.heightIn(max = 420.dp)) { item { - FolderOption("无笔记本", 0, note.folderId.isEmpty() || engine.folders[note.folderId] == null) { + FolderOption(s.noNotebook, 0, note.folderId.isEmpty() || engine.folders[note.folderId] == null) { engine.updateNote(note.id, SyncEngine.NotePatch(folderId = "")); onDismiss() } } @@ -539,7 +551,7 @@ fun MoveDialog(engine: SyncEngine, note: Note, onDismiss: () -> Unit) { } } }, - confirmButton = { androidx.compose.material3.TextButton(onClick = onDismiss) { Text("取消", color = c.ink2) } }, + confirmButton = { androidx.compose.material3.TextButton(onClick = onDismiss) { Text(s.cancel, color = c.ink2) } }, ) } @@ -566,7 +578,7 @@ private fun SearchResults(engine: SyncEngine, revision: Long, query: String, onO val hits = remember(revision, query) { Search.run(engine.notes.values, query) } if (hits.isEmpty()) { Column(Modifier.fillMaxSize().padding(32.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp)) { - Text("没有找到「${query.trim()}」", color = c.muted) + Text(LocalStrings.current.noResults(query.trim()), color = c.muted) } return } diff --git a/app/src/main/kotlin/app/ivynote/android/ui/SignIn.kt b/app/src/main/kotlin/app/ivynote/android/ui/SignIn.kt index b86f305..b5ff440 100644 --- a/app/src/main/kotlin/app/ivynote/android/ui/SignIn.kt +++ b/app/src/main/kotlin/app/ivynote/android/ui/SignIn.kt @@ -70,6 +70,7 @@ import app.ivynote.android.IvyApp import app.ivynote.android.platform.SqliteDocumentStore import app.ivynote.core.ApiClient import app.ivynote.core.ApiError +import app.ivynote.core.L10n import app.ivynote.core.LibraryMigrator import app.ivynote.core.LibraryRef import app.ivynote.core.OfficialRegions @@ -85,7 +86,6 @@ import kotlinx.coroutines.async import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import kotlinx.coroutines.withTimeoutOrNull -import java.util.Locale import java.util.TimeZone private enum class Mode { REGISTER, LOGIN } @@ -102,11 +102,13 @@ private enum class Mode { REGISTER, LOGIN } @Composable fun CloudSignInScreen(promoting: LibraryRef?, onBack: () -> Unit) { val c = Ivy.colors + val s = LocalStrings.current val app = IvyApp.instance val catalog = app.catalog val scope = rememberCoroutineScope() - var server by remember { mutableStateOf(SyncRegion.preferred(Locale.getDefault().country, TimeZone.getDefault().id).server) } + // By the system's region, not the interface language (ours replaces the default locale). + var server by remember { mutableStateOf(SyncRegion.preferred(app.systemLocale.country, TimeZone.getDefault().id).server) } var info by remember { mutableStateOf(null) } var probing by remember { mutableStateOf(false) } var probeError by remember { mutableStateOf(null) } @@ -168,7 +170,7 @@ fun CloudSignInScreen(promoting: LibraryRef?, onBack: () -> Unit) { val libraryName = when { promoting != null -> promoting.name - region != null -> "我的笔记" + region != null -> s.defaultLibraryName else -> info?.siteName?.trim()?.takeIf { it.isNotEmpty() && it.lowercase() != "ivynote" } ?: server.host } @@ -188,17 +190,17 @@ fun CloudSignInScreen(promoting: LibraryRef?, onBack: () -> Unit) { catalog.markMigrated(local.id, ref.id) if (result.rejected.isNotEmpty()) { // Opened anyway; the local library keeps everything. - android.widget.Toast.makeText(app, "${result.rejected.size} 项未能迁移,原内容仍保留在本地笔记库中。", android.widget.Toast.LENGTH_LONG).show() + android.widget.Toast.makeText(app, L10n.s.migrationRejected(result.rejected.size), android.widget.Toast.LENGTH_LONG).show() } if (result.failedFiles.isNotEmpty()) { - android.widget.Toast.makeText(app, "${result.failedFiles.size} 个文件未能上传,原文件仍保留在本地笔记库中。", android.widget.Toast.LENGTH_LONG).show() + android.widget.Toast.makeText(app, L10n.s.migrationFilesFailed(result.failedFiles.size), android.widget.Toast.LENGTH_LONG).show() } } catch (e: CancellationException) { throw e } catch (e: LibraryMigrator.AccountNotEmpty) { migrationError = e.message } catch (e: Exception) { - migrationError = "迁移中断:${e.message}。账户已经创建,点「继续迁移」会从中断处继续,已上传的内容不会重复。" + migrationError = L10n.s.migrationInterrupted(e.message ?: e.javaClass.simpleName) } finally { migrating = false } @@ -234,7 +236,7 @@ fun CloudSignInScreen(promoting: LibraryRef?, onBack: () -> Unit) { } catch (e: CancellationException) { throw e } catch (e: ApiError) { - error = if (e.status == 401 && !registering) "用户名或密码错误" else e.message + error = if (e.status == 401 && !registering) L10n.s.wrongCredentials else e.message } catch (e: Exception) { error = e.message } finally { @@ -245,13 +247,13 @@ fun CloudSignInScreen(promoting: LibraryRef?, onBack: () -> Unit) { Column(Modifier.fillMaxSize().background(c.canvas).systemBarsPadding().imePadding()) { Row(Modifier.fillMaxWidth().height(56.dp).padding(horizontal = 4.dp), verticalAlignment = Alignment.CenterVertically) { - IconButton(onClick = onBack) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "返回", tint = c.ink2) } - Text(if (promoting == null) "登录常青笔记" else "开启多端同步", style = SerifTitle, fontSize = 18.sp, color = c.ink) + IconButton(onClick = onBack) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = s.back, tint = c.ink2) } + Text(if (promoting == null) s.signInTitle else s.turnOnSyncTitle, style = SerifTitle, fontSize = 18.sp, color = c.ink) } Box(Modifier.fillMaxSize().verticalScroll(rememberScrollState()), contentAlignment = Alignment.TopCenter) { Column(Modifier.widthIn(max = 440.dp).fillMaxWidth().padding(horizontal = 20.dp, vertical = 12.dp), verticalArrangement = Arrangement.spacedBy(14.dp)) { if (migrating || migrationError != null) { - Caption("开启多端同步") + Caption(s.turnOnSyncTitle) FormCard { if (migrating) { Row(verticalAlignment = Alignment.CenterVertically) { @@ -263,20 +265,20 @@ fun CloudSignInScreen(promoting: LibraryRef?, onBack: () -> Unit) { LinearProgressIndicator(progress = { progressShare(progress) }, modifier = Modifier.fillMaxWidth(), color = c.ivy, trackColor = c.sunken) } else { Text(migrationError ?: "", color = c.danger) - TextButton(onClick = { promoting?.let { p -> scope.launch { migrate(p) } } }) { Text("继续迁移", color = c.ivy) } + TextButton(onClick = { promoting?.let { p -> scope.launch { migrate(p) } } }) { Text(s.continueMigration, color = c.ivy) } } } return@Column } // The sync node - Caption("同步节点") + Caption(s.syncNode) Box { FormCard(Modifier.clickable { serverMenu = true }) { Row(verticalAlignment = Alignment.CenterVertically) { Icon(if (region == null) Icons.Outlined.Dns else Icons.Outlined.Public, null, tint = c.ivy) Spacer(Modifier.width(10.dp)) - Text(region?.let { "常青笔记 · ${it.title}" } ?: server.host, color = c.ink, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f)) + Text(region?.let { s.officialRegion(it.title) } ?: server.host, color = c.ink, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f)) when { probing -> CircularProgressIndicator(Modifier.size(16.dp), strokeWidth = 2.dp, color = c.muted) info != null -> Icon(Icons.Outlined.CheckCircle, null, tint = c.ok, modifier = Modifier.size(18.dp)) @@ -289,31 +291,31 @@ fun CloudSignInScreen(promoting: LibraryRef?, onBack: () -> Unit) { DropdownMenu(expanded = serverMenu, onDismissRequest = { serverMenu = false }) { for (r in SyncRegion.entries) { DropdownMenuItem( - text = { Text("常青笔记 · ${r.title}") }, + text = { Text(s.officialRegion(r.title)) }, leadingIcon = { if (region == r) Icon(Icons.Outlined.Check, null, tint = c.ivy) else Spacer(Modifier.size(24.dp)) }, onClick = { serverMenu = false; server = r.server }, ) } HorizontalDivider() - DropdownMenuItem(text = { Text("自定义服务器…") }, leadingIcon = { Icon(Icons.Outlined.Dns, null) }, + DropdownMenuItem(text = { Text(s.customServerEllipsis) }, leadingIcon = { Icon(Icons.Outlined.Dns, null) }, onClick = { serverMenu = false; custom = true }) } } when { probeError != null -> Row(verticalAlignment = Alignment.CenterVertically) { - Text(if (region != null) "暂时无法连接这个节点" else probeError ?: "", color = c.danger, fontSize = 13.sp, modifier = Modifier.weight(1f)) - TextButton(onClick = { probeRun++ }) { Text("重试", color = c.ivy) } + Text(if (region != null) s.nodeUnreachable else probeError ?: "", color = c.danger, fontSize = 13.sp, modifier = Modifier.weight(1f)) + TextButton(onClick = { probeRun++ }) { Text(s.retry, color = c.ivy) } } - promoting == null -> Caption("笔记先保存在本机,联网时自动同步到你的所有设备。") - else -> Caption("注册一个新账户,「${promoting.name}」会上传到云端,之后在所有设备上同步。") + promoting == null -> Caption(s.signInHint) + else -> Caption(s.promoteHint(promoting.name)) } if (promoting == null && canRegister) { SingleChoiceSegmentedButtonRow(Modifier.fillMaxWidth()) { SegmentedButton(selected = mode == Mode.REGISTER, onClick = { mode = Mode.REGISTER; error = null }, - shape = SegmentedButtonDefaults.itemShape(0, 2)) { Text("注册") } + shape = SegmentedButtonDefaults.itemShape(0, 2)) { Text(s.register) } SegmentedButton(selected = mode == Mode.LOGIN, onClick = { mode = Mode.LOGIN; error = null }, - shape = SegmentedButtonDefaults.itemShape(1, 2)) { Text("登录") } + shape = SegmentedButtonDefaults.itemShape(1, 2)) { Text(s.login) } } } @@ -328,19 +330,19 @@ fun CloudSignInScreen(promoting: LibraryRef?, onBack: () -> Unit) { ) when { error != null -> Text(error ?: "", color = c.danger, fontSize = 13.sp) - info?.hasUsers == false && region == null -> Caption("这台服务器还没有账户。你创建的第一个账户将成为管理员。") - promoting != null && info?.canRegister == false -> Text("这台服务器没有开放注册。", color = c.danger, fontSize = 13.sp) + info?.hasUsers == false && region == null -> Caption(s.firstAdmin) + promoting != null && info?.canRegister == false -> Text(s.registrationClosed, color = c.danger, fontSize = 13.sp) } val canSubmit = if (registering) canRegister && username.isNotEmpty() && password.isNotEmpty() else identity.isNotEmpty() && password.isNotEmpty() InkButton( - text = if (promoting != null) "注册并开启同步" else if (mode == Mode.LOGIN) "登录" else "注册", + text = if (promoting != null) s.registerAndSync else if (mode == Mode.LOGIN) s.login else s.register, onClick = ::submit, enabled = canSubmit && !probing && info != null, busy = busy, modifier = Modifier.fillMaxWidth().height(44.dp), ) if (promoting != null) { - Caption("本地笔记库只能迁移到新注册的账户。已有账户的话,可以先登录,再在网页版或桌面端的「设置 → 导入」中导入本笔记库导出的内容。") + Caption(s.promoteNote) } } } @@ -357,10 +359,10 @@ fun CloudSignInScreen(promoting: LibraryRef?, onBack: () -> Unit) { } private fun progressText(p: LibraryMigrator.Progress?): String = when (p?.phase) { - null, LibraryMigrator.Progress.Phase.CHECK -> "正在准备…" - LibraryMigrator.Progress.Phase.FILES -> "正在上传文件 ${p.done}/${p.total}" - LibraryMigrator.Progress.Phase.NOTES -> "正在上传笔记 ${p.done}/${p.total}" - LibraryMigrator.Progress.Phase.DONE -> "迁移完成,正在打开…" + null, LibraryMigrator.Progress.Phase.CHECK -> L10n.s.preparing + LibraryMigrator.Progress.Phase.FILES -> L10n.s.uploadingFiles(p.done, p.total) + LibraryMigrator.Progress.Phase.NOTES -> L10n.s.uploadingNotes(p.done, p.total) + LibraryMigrator.Progress.Phase.DONE -> L10n.s.migrationDone } private fun progressShare(p: LibraryMigrator.Progress?): Float = when (p?.phase) { @@ -385,6 +387,7 @@ private fun CustomServerDialog(onDismiss: () -> Unit, onPick: (ServerAddress, Se var checking by remember { mutableStateOf(false) } var error by remember { mutableStateOf(null) } val parsed = ServerAddress.parseOrNull(address) + val s = LocalStrings.current fun connect() { if (checking) return @@ -411,7 +414,7 @@ private fun CustomServerDialog(onDismiss: () -> Unit, onPick: (ServerAddress, Se AlertDialog( onDismissRequest = onDismiss, - title = { Text("自定义服务器") }, + title = { Text(s.customServer) }, text = { Column(verticalArrangement = Arrangement.spacedBy(8.dp)) { OutlinedTextField( @@ -425,17 +428,17 @@ private fun CustomServerDialog(onDismiss: () -> Unit, onPick: (ServerAddress, Se ) when { error != null -> Text(error ?: "", color = c.danger, fontSize = 13.sp) - parsed?.isInsecure == true -> Text("使用 http 连接时,密码和笔记以明文传输,请只在可信的局域网内使用。", color = c.warn, fontSize = 13.sp) - else -> Text("连接你自己或团队部署的常青笔记服务器。", color = c.muted, fontSize = 13.sp) + parsed?.isInsecure == true -> Text(s.insecureWarning, color = c.warn, fontSize = 13.sp) + else -> Text(s.customServerHint, color = c.muted, fontSize = 13.sp) } } }, confirmButton = { TextButton(onClick = ::connect, enabled = address.isNotBlank() && !checking) { - if (checking) CircularProgressIndicator(Modifier.size(16.dp), strokeWidth = 2.dp) else Text("使用这个服务器") + if (checking) CircularProgressIndicator(Modifier.size(16.dp), strokeWidth = 2.dp) else Text(s.useServer) } }, - dismissButton = { TextButton(onClick = onDismiss) { Text("取消") } }, + dismissButton = { TextButton(onClick = onDismiss) { Text(s.cancel) } }, ) } @@ -443,6 +446,7 @@ private fun CustomServerDialog(onDismiss: () -> Unit, onPick: (ServerAddress, Se @Composable fun SignInScreen(ref: LibraryRef, session: SessionStore) { val c = Ivy.colors + val s = LocalStrings.current val catalog = IvyApp.instance.catalog val notice by session.notice.collectAsState() val scope = rememberCoroutineScope() @@ -491,7 +495,7 @@ fun SignInScreen(ref: LibraryRef, session: SessionStore) { } catch (e: CancellationException) { throw e } catch (e: ApiError) { - error = if (e.status == 401 && mode == Mode.LOGIN) "用户名或密码错误" else e.message + error = if (e.status == 401 && mode == Mode.LOGIN) L10n.s.wrongCredentials else e.message } catch (e: Exception) { error = e.message } finally { @@ -502,7 +506,7 @@ fun SignInScreen(ref: LibraryRef, session: SessionStore) { Column(Modifier.fillMaxSize().background(c.canvas).systemBarsPadding().imePadding()) { Row(Modifier.fillMaxWidth().height(56.dp).padding(horizontal = 4.dp), verticalAlignment = Alignment.CenterVertically) { - IconButton(onClick = { catalog.open(null) }) { Icon(Icons.Outlined.Book, contentDescription = "笔记库", tint = c.ink2) } + IconButton(onClick = { catalog.open(null) }) { Icon(Icons.Outlined.Book, contentDescription = s.libraries, tint = c.ink2) } Text(ref.name, style = SerifTitle, fontSize = 18.sp, color = c.ink, maxLines = 1, overflow = TextOverflow.Ellipsis) } Box(Modifier.fillMaxSize().verticalScroll(rememberScrollState()), contentAlignment = Alignment.TopCenter) { @@ -512,8 +516,8 @@ fun SignInScreen(ref: LibraryRef, session: SessionStore) { horizontalAlignment = Alignment.CenterHorizontally, ) { IvyLeaf(68.dp) - Text(info?.siteName?.takeIf { it.isNotBlank() } ?: "常青笔记", style = SerifTitle, fontSize = 26.sp, color = c.ink) - Text("本地优先的 Markdown 笔记", color = c.muted, fontSize = 14.sp) + Text(info?.siteName?.takeIf { it.isNotBlank() } ?: s.appName, style = SerifTitle, fontSize = 26.sp, color = c.ink) + Text(s.slogan, color = c.muted, fontSize = 14.sp) notice?.takeIf { mode == Mode.LOGIN }?.let { Surface(color = c.warnSoft, shape = RoundedCornerShape(12.dp), modifier = Modifier.fillMaxWidth()) { Text(it, color = c.warnInk, fontSize = 14.sp, modifier = Modifier.padding(12.dp)) @@ -522,9 +526,9 @@ fun SignInScreen(ref: LibraryRef, session: SessionStore) { val current = info if (current == null) { if (probeError != null) { - Text("无法连接服务器", fontWeight = FontWeight.SemiBold, color = c.ink) + Text(s.cannotConnect, fontWeight = FontWeight.SemiBold, color = c.ink) Text(probeError ?: "", color = c.muted, fontSize = 13.sp, textAlign = TextAlign.Center) - InkButton("重试", onClick = { probeRun++ }) + InkButton(s.retry, onClick = { probeRun++ }) } else { CircularProgressIndicator(color = c.muted) } @@ -533,9 +537,9 @@ fun SignInScreen(ref: LibraryRef, session: SessionStore) { if (current.canRegister && current.hasUsers) { SingleChoiceSegmentedButtonRow(Modifier.fillMaxWidth()) { SegmentedButton(selected = mode == Mode.LOGIN, onClick = { mode = Mode.LOGIN; error = null }, - shape = SegmentedButtonDefaults.itemShape(0, 2)) { Text("登录") } + shape = SegmentedButtonDefaults.itemShape(0, 2)) { Text(s.login) } SegmentedButton(selected = mode == Mode.REGISTER, onClick = { mode = Mode.REGISTER; error = null }, - shape = SegmentedButtonDefaults.itemShape(1, 2)) { Text("注册") } + shape = SegmentedButtonDefaults.itemShape(1, 2)) { Text(s.register) } } } AccountFields( @@ -549,11 +553,11 @@ fun SignInScreen(ref: LibraryRef, session: SessionStore) { ) when { error != null -> Text(error ?: "", color = c.danger, fontSize = 13.sp) - !current.hasUsers -> Caption("这台服务器还没有账户。你创建的第一个账户将成为管理员。") - server.isInsecure -> Text("使用 http 连接,密码和笔记以明文传输。", color = c.warn, fontSize = 13.sp) + !current.hasUsers -> Caption(s.firstAdmin) + server.isInsecure -> Text(s.httpWarning, color = c.warn, fontSize = 13.sp) } val canSubmit = if (mode == Mode.LOGIN) identity.isNotEmpty() && password.isNotEmpty() else username.isNotEmpty() && password.isNotEmpty() - InkButton(if (mode == Mode.LOGIN) "登录" else "创建账户", onClick = ::submit, enabled = canSubmit, busy = busy, + InkButton(if (mode == Mode.LOGIN) s.login else s.createAccount, onClick = ::submit, enabled = canSubmit, busy = busy, modifier = Modifier.fillMaxWidth().height(44.dp)) Text(server.toString(), color = c.faint, fontSize = 12.sp) } @@ -571,24 +575,25 @@ private fun AccountFields( password: String, onPassword: (String) -> Unit, onSubmit: () -> Unit, ) { + val s = LocalStrings.current val plain = KeyboardOptions(autoCorrectEnabled = false, keyboardType = KeyboardType.Ascii, imeAction = ImeAction.Next) Column(verticalArrangement = Arrangement.spacedBy(10.dp)) { if (login) { - OutlinedTextField(identity, onIdentity, label = { Text("用户名或邮箱") }, singleLine = true, keyboardOptions = plain, + OutlinedTextField(identity, onIdentity, label = { Text(s.usernameOrEmail) }, singleLine = true, keyboardOptions = plain, modifier = Modifier.fillMaxWidth()) } else { - OutlinedTextField(username, onUsername, label = { Text("用户名") }, singleLine = true, keyboardOptions = plain, + OutlinedTextField(username, onUsername, label = { Text(s.username) }, singleLine = true, keyboardOptions = plain, modifier = Modifier.fillMaxWidth()) - OutlinedTextField(email, onEmail, label = { Text("邮箱(可选)") }, singleLine = true, + OutlinedTextField(email, onEmail, label = { Text(s.emailOptional) }, singleLine = true, keyboardOptions = plain.copy(keyboardType = KeyboardType.Email), modifier = Modifier.fillMaxWidth()) if (displayName != null) { - OutlinedTextField(displayName, onDisplayName, label = { Text("显示名(可选)") }, singleLine = true, + OutlinedTextField(displayName, onDisplayName, label = { Text(s.displayNameOptional) }, singleLine = true, keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next), modifier = Modifier.fillMaxWidth()) } } OutlinedTextField( password, onPassword, - label = { Text(if (login) "密码" else "密码(至少 8 位)") }, + label = { Text(if (login) s.password else s.passwordMin8) }, singleLine = true, visualTransformation = PasswordVisualTransformation(), keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password, imeAction = ImeAction.Done, autoCorrectEnabled = false), diff --git a/app/src/main/kotlin/app/ivynote/android/ui/Tags.kt b/app/src/main/kotlin/app/ivynote/android/ui/Tags.kt index 4bdfc6e..e6ffe74 100644 --- a/app/src/main/kotlin/app/ivynote/android/ui/Tags.kt +++ b/app/src/main/kotlin/app/ivynote/android/ui/Tags.kt @@ -64,10 +64,6 @@ import app.ivynote.core.Tag /** The six tag colors of the web client (`--tag-*-fg`), "" for none. */ val TAG_COLORS = listOf("", "green", "blue", "amber", "pink", "purple", "gray") -private val TAG_NAMES = mapOf( - "" to "无", "green" to "绿", "blue" to "蓝", "amber" to "琥珀", "pink" to "粉", "purple" to "紫", "gray" to "灰", -) - @Composable fun tagColor(color: String): Color { val dark = Ivy.colors.dark @@ -114,7 +110,7 @@ fun NoteTagsRow(note: Note, engine: SyncEngine, editable: Boolean, onEdit: () -> ) { Icon(Icons.Outlined.Add, null, tint = c.faint, modifier = Modifier.size(14.dp)) Spacer(Modifier.width(2.dp)) - Text("标签", fontSize = 12.5.sp, color = c.faint) + Text(LocalStrings.current.tags, fontSize = 12.5.sp, color = c.faint) } } } @@ -138,6 +134,7 @@ fun TagPickerSheet(engine: SyncEngine, noteId: String, onDismiss: () -> Unit) { val shown = if (key.isEmpty()) all else all.filter { Links.normalizeTitle(it.name).contains(key) } val exact = engine.tagNamed(clean) val full = note.tags.size >= SyncEngine.MAX_NOTE_TAGS + val s = LocalStrings.current fun submit() { if (clean.isEmpty()) return @@ -148,7 +145,7 @@ fun TagPickerSheet(engine: SyncEngine, noteId: String, onDismiss: () -> Unit) { ModalBottomSheet(onDismissRequest = onDismiss, sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true), containerColor = c.surface) { Row(Modifier.padding(horizontal = 24.dp, vertical = 4.dp), verticalAlignment = Alignment.CenterVertically) { - Text("标签", fontWeight = FontWeight.SemiBold, fontSize = 16.sp, color = c.ink, modifier = Modifier.weight(1f)) + Text(s.tags, fontWeight = FontWeight.SemiBold, fontSize = 16.sp, color = c.ink, modifier = Modifier.weight(1f)) Text("${note.tags.size}/${SyncEngine.MAX_NOTE_TAGS}", fontSize = 13.sp, color = c.faint) } Row( @@ -159,7 +156,7 @@ fun TagPickerSheet(engine: SyncEngine, noteId: String, onDismiss: () -> Unit) { Icon(Icons.Outlined.Search, null, tint = c.faint, modifier = Modifier.size(18.dp)) Spacer(Modifier.width(8.dp)) Box(Modifier.weight(1f)) { - if (query.isEmpty()) Text("搜索或创建标签", color = c.faint, fontSize = 15.sp) + if (query.isEmpty()) Text(s.searchOrCreateTag, color = c.faint, fontSize = 15.sp) BasicTextField( value = query, onValueChange = { query = it.take(60) }, @@ -172,18 +169,18 @@ fun TagPickerSheet(engine: SyncEngine, noteId: String, onDismiss: () -> Unit) { ) } if (query.isNotEmpty()) { - Icon(Icons.Outlined.Close, contentDescription = "清除", tint = c.faint, + Icon(Icons.Outlined.Close, contentDescription = s.clear, tint = c.faint, modifier = Modifier.size(18.dp).clip(CircleShape).clickable { query = "" }) } } - if (full) Text("一篇笔记最多 ${SyncEngine.MAX_NOTE_TAGS} 个标签", color = c.warn, fontSize = 12.5.sp, modifier = Modifier.padding(horizontal = 24.dp)) + if (full) Text(s.maxTags(SyncEngine.MAX_NOTE_TAGS), color = c.warn, fontSize = 12.5.sp, modifier = Modifier.padding(horizontal = 24.dp)) LazyColumn(Modifier.fillMaxWidth().heightIn(max = 420.dp), contentPadding = androidx.compose.foundation.layout.PaddingValues(bottom = 24.dp)) { if (clean.isNotEmpty() && exact == null) { item(key = "create") { PickerRow(enabled = !full, onClick = { submit() }) { Icon(Icons.Outlined.Add, null, tint = c.ivy, modifier = Modifier.size(20.dp)) Spacer(Modifier.width(12.dp)) - Text("创建「$clean」", color = c.ivy, fontSize = 15.sp, modifier = Modifier.weight(1f)) + Text(s.createTag(clean), color = c.ivy, fontSize = 15.sp, modifier = Modifier.weight(1f)) } } } @@ -197,11 +194,11 @@ fun TagPickerSheet(engine: SyncEngine, noteId: String, onDismiss: () -> Unit) { Box(Modifier.size(10.dp).clip(CircleShape).background(tagColor(t.color))) Spacer(Modifier.width(8.dp)) Text(t.name, color = c.ink, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f)) - IconButton(onClick = { editing = t }) { Icon(Icons.Outlined.Edit, contentDescription = "编辑标签", tint = c.faint, modifier = Modifier.size(18.dp)) } + IconButton(onClick = { editing = t }) { Icon(Icons.Outlined.Edit, contentDescription = s.editTag, tint = c.faint, modifier = Modifier.size(18.dp)) } } } if (all.isEmpty() && clean.isEmpty()) { - item { Text("还没有标签。输入名称即可创建。", color = c.muted, fontSize = 14.sp, modifier = Modifier.padding(24.dp)) } + item { Text(s.noTags, color = c.muted, fontSize = 14.sp, modifier = Modifier.padding(24.dp)) } } } } @@ -227,46 +224,47 @@ fun TagEditDialog(engine: SyncEngine, tag: Tag, onDismiss: () -> Unit) { var confirmDelete by remember { mutableStateOf(false) } val clean = SyncEngine.cleanTagName(name) val clash = engine.tagNamed(clean)?.takeIf { it.id != tag.id } + val s = LocalStrings.current AlertDialog( onDismissRequest = onDismiss, - title = { Text("编辑标签") }, + title = { Text(s.editTag) }, text = { Column(verticalArrangement = Arrangement.spacedBy(14.dp)) { OutlinedTextField( value = name, onValueChange = { name = it.take(60) }, singleLine = true, - label = { Text("名称") }, prefix = { Text("#") }, + label = { Text(s.name) }, prefix = { Text("#") }, isError = clash != null, - supportingText = if (clash != null) ({ Text("已有同名标签") }) else null, + supportingText = if (clash != null) ({ Text(s.tagExists) }) else null, modifier = Modifier.fillMaxWidth(), ) - Text("颜色", fontSize = 13.sp, color = c.muted) + Text(s.color, fontSize = 13.sp, color = c.muted) FlowRow(horizontalArrangement = Arrangement.spacedBy(10.dp), verticalArrangement = Arrangement.spacedBy(10.dp)) { for (k in TAG_COLORS) { val fg = tagColor(k) Box( Modifier.size(34.dp).clip(CircleShape).background(fg.copy(alpha = if (k.isEmpty()) 0.08f else 0.85f)) .border(2.dp, if (k == color) c.ink else Color.Transparent, CircleShape) - .clickable(onClickLabel = TAG_NAMES[k]) { color = k }, + .clickable(onClickLabel = s.tagColor(k)) { color = k }, contentAlignment = Alignment.Center, ) { - if (k == color) Icon(Icons.Outlined.Check, contentDescription = TAG_NAMES[k], tint = if (k.isEmpty()) c.ink else c.surface, modifier = Modifier.size(16.dp)) + if (k == color) Icon(Icons.Outlined.Check, contentDescription = s.tagColor(k), tint = if (k.isEmpty()) c.ink else c.surface, modifier = Modifier.size(16.dp)) } } } HorizontalDivider(color = c.line) - TextButton(onClick = { confirmDelete = true }) { Text("删除标签", color = c.danger) } + TextButton(onClick = { confirmDelete = true }) { Text(s.deleteTag, color = c.danger) } } }, confirmButton = { TextButton(enabled = clean.isNotEmpty() && clash == null, onClick = { engine.updateTag(tag.id, name = clean, color = color) onDismiss() - }) { Text("保存") } + }) { Text(s.save) } }, - dismissButton = { TextButton(onClick = onDismiss) { Text("取消") } }, + dismissButton = { TextButton(onClick = onDismiss) { Text(s.cancel) } }, ) if (confirmDelete) { - ConfirmDialog("删除标签?", "「#${tag.name}」会从所有笔记上移除,笔记本身不受影响。", "删除", onDismiss = { confirmDelete = false }) { + ConfirmDialog(s.deleteTagTitle, s.deleteTagMessage(tag.name), s.delete, onDismiss = { confirmDelete = false }) { engine.deleteTag(tag.id) onDismiss() } diff --git a/app/src/main/kotlin/app/ivynote/android/ui/UpdateUi.kt b/app/src/main/kotlin/app/ivynote/android/ui/UpdateUi.kt index 28cd925..c28e268 100644 --- a/app/src/main/kotlin/app/ivynote/android/ui/UpdateUi.kt +++ b/app/src/main/kotlin/app/ivynote/android/ui/UpdateUi.kt @@ -59,6 +59,7 @@ fun UpdateDialogHost() { @Composable private fun UpdateDialog(updater: Updater, s: Updater.State) { val c = Ivy.colors + val str = LocalStrings.current val context = LocalContext.current val info = s.info ?: return val asset = info.asset @@ -71,13 +72,13 @@ private fun UpdateDialog(updater: Updater, s: Updater.State) { onDismissRequest = { if (s.phase == Phase.DOWNLOADING) updater.hide() else if (s.phase != Phase.INSTALLING) updater.later() }, properties = DialogProperties(dismissOnClickOutside = !busy), containerColor = c.canvas, - title = { Text("发现新版本", style = SerifTitle) }, + title = { Text(str.updateAvailable, style = SerifTitle) }, text = { Column(verticalArrangement = Arrangement.spacedBy(10.dp)) { - Text("常青笔记 ${info.latest} 已发布", color = c.ink, fontWeight = FontWeight.SemiBold, fontSize = 16.sp) + Text(str.versionReleased(info.latest), color = c.ink, fontWeight = FontWeight.SemiBold, fontSize = 16.sp) Text( buildString { - append("当前版本 ${info.current}") + append(str.currentVersionIs(info.current)) if (asset != null && asset.size > 0) append(" · ").append(Formatter.formatShortFileSize(context, asset.size)) }, color = c.muted, fontSize = 13.sp, @@ -100,29 +101,29 @@ private fun UpdateDialog(updater: Updater, s: Updater.State) { val share = if (s.total > 0) (s.downloaded.toFloat() / s.total).coerceIn(0f, 1f) else 0f LinearProgressIndicator(progress = { share }, modifier = Modifier.fillMaxWidth(), color = c.ivy, trackColor = c.sunken) Text( - "正在下载… " + Formatter.formatShortFileSize(context, s.downloaded) + - (if (s.total > 0) " / " + Formatter.formatShortFileSize(context, s.total) else ""), + str.downloading(Formatter.formatShortFileSize(context, s.downloaded) + + (if (s.total > 0) " / " + Formatter.formatShortFileSize(context, s.total) else "")), color = c.muted, fontSize = 12.5.sp, ) } Phase.INSTALLING -> Row(verticalAlignment = Alignment.CenterVertically) { CircularProgressIndicator(Modifier.size(14.dp), strokeWidth = 2.dp, color = c.muted) Spacer(Modifier.width(8.dp)) - Text("正在保存笔记并打开安装程序…", color = c.muted, fontSize = 12.5.sp) + Text(str.savingAndInstalling, color = c.muted, fontSize = 12.5.sp) } - Phase.READY -> Text("新版本已下载并校验,按系统提示完成安装即可,笔记会先保存。", color = c.muted, fontSize = 12.5.sp) + Phase.READY -> Text(str.updateReady, color = c.muted, fontSize = 12.5.sp) else -> Text( when { - web && asset != null -> "调试版无法直接更新,请前往官网下载正式版。" - web -> "请前往官网下载新版本。" - else -> "下载完成后由系统安装,笔记会先保存。首次更新需要允许常青笔记安装应用。" + web && asset != null -> str.debugUpdateHint + web -> str.webUpdateHint + else -> str.updateHint }, color = c.muted, fontSize = 12.5.sp, ) } if (s.error.isNotEmpty() && (s.failed == Updater.Failed.DOWNLOAD || s.failed == Updater.Failed.INSTALL)) { Text( - (if (s.failed == Updater.Failed.DOWNLOAD) "下载失败" else "安装失败") + ":${s.error}。可以重试或前往官网下载。", + if (s.failed == Updater.Failed.DOWNLOAD) str.downloadFailed(s.error) else str.installFailed(s.error), color = c.danger, fontSize = 12.5.sp, ) } @@ -130,26 +131,26 @@ private fun UpdateDialog(updater: Updater, s: Updater.State) { }, confirmButton = { when (s.phase) { - Phase.DOWNLOADING -> TextButton(onClick = { updater.hide() }) { Text("后台下载", color = c.ivy) } - Phase.INSTALLING -> TextButton(onClick = {}, enabled = false) { Text("正在安装…") } - Phase.READY -> TextButton(onClick = { updater.install() }) { Text("立即安装", color = c.ivy, fontWeight = FontWeight.SemiBold) } + Phase.DOWNLOADING -> TextButton(onClick = { updater.hide() }) { Text(str.downloadInBackground, color = c.ivy) } + Phase.INSTALLING -> TextButton(onClick = {}, enabled = false) { Text(str.installing) } + Phase.READY -> TextButton(onClick = { updater.install() }) { Text(str.installNow, color = c.ivy, fontWeight = FontWeight.SemiBold) } else -> TextButton(onClick = { if (web) { updater.openDownloadPage(); updater.later() } else updater.downloadAndInstall() }) { - Text(if (web) "前往官网下载" else "立即更新", color = c.ivy, fontWeight = FontWeight.SemiBold) + Text(if (web) str.downloadFromWebsite else str.updateNow, color = c.ivy, fontWeight = FontWeight.SemiBold) } } }, dismissButton = { Row { when (s.phase) { - Phase.DOWNLOADING -> TextButton(onClick = { updater.cancelDownload() }) { Text("取消下载", color = c.ink2) } + Phase.DOWNLOADING -> TextButton(onClick = { updater.cancelDownload() }) { Text(str.cancelDownload, color = c.ink2) } Phase.INSTALLING -> Unit else -> { if (s.failed == Updater.Failed.DOWNLOAD || s.failed == Updater.Failed.INSTALL) { - TextButton(onClick = { updater.openDownloadPage() }) { Text("官网下载", color = c.ink2) } + TextButton(onClick = { updater.openDownloadPage() }) { Text(str.websiteDownload, color = c.ink2) } } else { - TextButton(onClick = { updater.skip() }) { Text("跳过此版本", color = c.muted) } + TextButton(onClick = { updater.skip() }) { Text(str.skipVersion, color = c.muted) } } - TextButton(onClick = { updater.later() }) { Text("稍后", color = c.ink2) } + TextButton(onClick = { updater.later() }) { Text(str.later, color = c.ink2) } } } } @@ -162,6 +163,7 @@ private fun UpdateDialog(updater: Updater, s: Updater.State) { @Composable fun AboutSheet(onDismiss: () -> Unit) { val c = Ivy.colors + val str = LocalStrings.current val context = LocalContext.current val updater = IvyApp.instance.updater val s by updater.state.collectAsState() @@ -175,12 +177,12 @@ fun AboutSheet(onDismiss: () -> Unit) { horizontalAlignment = Alignment.CenterHorizontally, ) { AppLogo(56.dp) - Text("常青笔记", style = SerifTitle, fontSize = 20.sp, color = c.ink) - Text("本地优先的 Markdown 笔记。离线也能写,联网后自动同步。", color = c.muted, fontSize = 13.5.sp) + Text(str.appName, style = SerifTitle, fontSize = 20.sp, color = c.ink) + Text(str.aboutTagline, color = c.muted, fontSize = 13.5.sp) Surface(shape = RoundedCornerShape(16.dp), color = c.surface, modifier = Modifier.fillMaxWidth()) { Column(Modifier.padding(horizontal = 16.dp, vertical = 4.dp)) { Row(Modifier.fillMaxWidth().padding(vertical = 10.dp), verticalAlignment = Alignment.CenterVertically) { - Text("版本", color = c.ink2, fontSize = 15.sp, modifier = Modifier.weight(1f)) + Text(str.version, color = c.ink2, fontSize = 15.sp, modifier = Modifier.weight(1f)) Text(updater.current, color = c.ink, fontSize = 15.sp) } HorizontalDivider(color = c.line) @@ -190,22 +192,22 @@ fun AboutSheet(onDismiss: () -> Unit) { }.padding(vertical = 10.dp), verticalAlignment = Alignment.CenterVertically, ) { - Text("检查更新", color = c.ink, fontSize = 15.sp, modifier = Modifier.weight(1f)) + Text(str.checkForUpdates, color = c.ink, fontSize = 15.sp, modifier = Modifier.weight(1f)) when { s.phase == Phase.CHECKING -> { CircularProgressIndicator(Modifier.size(14.dp), strokeWidth = 2.dp, color = c.muted) Spacer(Modifier.width(6.dp)) - Text("正在检查…", color = c.muted, fontSize = 13.sp) + Text(str.checking, color = c.muted, fontSize = 13.sp) } - s.phase == Phase.DOWNLOADING -> Text("正在下载 ${info?.latest}…", color = c.ivy, fontSize = 13.sp) - info?.available == true -> Text("有新版本 ${info.latest}", color = c.ivy, fontSize = 13.sp, fontWeight = FontWeight.Medium) - s.failed == Updater.Failed.CHECK -> Text("检查失败", color = c.danger, fontSize = 13.sp) - info != null -> Text("已是最新版本", color = c.muted, fontSize = 13.sp) + s.phase == Phase.DOWNLOADING -> Text(str.downloadingVersion(info?.latest.orEmpty()), color = c.ivy, fontSize = 13.sp) + info?.available == true -> Text(str.newVersion(info.latest), color = c.ivy, fontSize = 13.sp, fontWeight = FontWeight.Medium) + s.failed == Updater.Failed.CHECK -> Text(str.checkFailed, color = c.danger, fontSize = 13.sp) + info != null -> Text(str.upToDate, color = c.muted, fontSize = 13.sp) } } HorizontalDivider(color = c.line) Row(Modifier.fillMaxWidth().padding(vertical = 6.dp), verticalAlignment = Alignment.CenterVertically) { - Text("匿名使用统计", color = c.ink, fontSize = 15.sp, modifier = Modifier.weight(1f)) + Text(str.anonymousStats, color = c.ink, fontSize = 15.sp, modifier = Modifier.weight(1f)) Switch( checked = stats, onCheckedChange = { stats = it; updater.prefs.statsEnabled = it }, @@ -213,14 +215,14 @@ fun AboutSheet(onDismiss: () -> Unit) { ) } Text( - "检查更新时附带一个随机的安装编号(与账号无关),帮助我们了解有多少设备在使用常青笔记。不包含笔记内容或个人信息。", + str.anonymousStatsHint, color = c.muted, fontSize = 12.sp, modifier = Modifier.padding(bottom = 10.dp), ) } } TextButton(onClick = { runCatching { context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(AppUpdates.SITES.first()))) } - }) { Text("官网 ivynote.net", color = c.ivy) } + }) { Text(str.website, color = c.ivy) } } } } diff --git a/app/src/main/kotlin/app/ivynote/android/update/Updater.kt b/app/src/main/kotlin/app/ivynote/android/update/Updater.kt index 90a3774..b620f59 100644 --- a/app/src/main/kotlin/app/ivynote/android/update/Updater.kt +++ b/app/src/main/kotlin/app/ivynote/android/update/Updater.kt @@ -10,6 +10,7 @@ import android.widget.Toast import app.ivynote.android.BuildConfig import app.ivynote.core.AppUpdates import app.ivynote.core.KeyValueStore +import app.ivynote.core.L10n import app.ivynote.core.UpdateAsset import app.ivynote.core.UpdateInfo import app.ivynote.core.UpdatePrefs @@ -108,7 +109,7 @@ class Updater( val info = AppUpdates.check(current, reason, prefs.installId(), arch()) if (!info.available) { set { copy(phase = Phase.IDLE, info = info) } - if (manual) toast("已是最新版本($current)") + if (manual) toast(L10n.s.upToDateVersion(current)) return info } val ready = withContext(Dispatchers.IO) { info.asset?.let { a -> fileFor(info, a)?.let { AppUpdates.verified(it, a) } } == true } @@ -122,7 +123,7 @@ class Updater( } catch (e: Exception) { val msg = e.message ?: e.javaClass.simpleName set { copy(phase = Phase.IDLE, error = msg, failed = Failed.CHECK) } - if (manual) toast("检查更新失败:$msg", long = true) + if (manual) toast(L10n.s.checkUpdateFailed(msg), long = true) null } } @@ -172,7 +173,7 @@ class Updater( if (s.phase != Phase.READY) return if (!context.packageManager.canRequestPackageInstalls()) { // Android asks once per installing app: 设置 → 安装未知应用 → 常青笔记. - toast("请允许「常青笔记」安装应用,然后返回点击「立即安装」", long = true) + toast(L10n.s.allowInstall, long = true) runCatching { context.startActivity( Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES, Uri.parse("package:${context.packageName}")) @@ -186,7 +187,7 @@ class Updater( scope.launch { beforeInstall?.let { save -> withTimeoutOrNull(10_000) { runCatching { save() } } } try { - if (!withContext(Dispatchers.IO) { AppUpdates.verified(file, asset) }) error("下载的安装包已失效,请重新下载") + if (!withContext(Dispatchers.IO) { AppUpdates.verified(file, asset) }) error(L10n.s.apkInvalid) ApkInstaller.install(context, file) // The installer answers through InstallResultReceiver. } catch (e: CancellationException) { @@ -207,10 +208,10 @@ class Updater( else -> { val why = when (status) { PackageInstaller.STATUS_FAILURE_CONFLICT, PackageInstaller.STATUS_FAILURE_INCOMPATIBLE -> - "新版本与已安装的应用签名不一致,请前往官网下载安装" - PackageInstaller.STATUS_FAILURE_STORAGE -> "存储空间不足" - PackageInstaller.STATUS_FAILURE_BLOCKED -> "安装被系统阻止" - else -> message?.takeIf { it.isNotBlank() } ?: "安装未完成" + L10n.s.signatureMismatch + PackageInstaller.STATUS_FAILURE_STORAGE -> L10n.s.noStorage + PackageInstaller.STATUS_FAILURE_BLOCKED -> L10n.s.installBlocked + else -> message?.takeIf { it.isNotBlank() } ?: L10n.s.installIncomplete } set { copy(phase = Phase.READY, open = true, error = why, failed = Failed.INSTALL) } } diff --git a/core/src/main/kotlin/app/ivynote/core/ApiClient.kt b/core/src/main/kotlin/app/ivynote/core/ApiClient.kt index 80b07ff..9e5216a 100644 --- a/core/src/main/kotlin/app/ivynote/core/ApiClient.kt +++ b/core/src/main/kotlin/app/ivynote/core/ApiClient.kt @@ -44,12 +44,14 @@ class ApiClient( return r.token to r.user } - suspend fun register(username: String, password: String, email: String = "", displayName: String = ""): Pair { + /** [language]: the interface language at sign-up; it becomes the account's. */ + suspend fun register(username: String, password: String, email: String = "", displayName: String = "", language: String = L10n.language.tag): Pair { val body = buildJsonObject { put("username", username) put("password", password) if (email.isNotEmpty()) put("email", email) if (displayName.isNotEmpty()) put("displayName", displayName) + if (language.isNotEmpty()) put("language", language) } val r: AuthResponse = send("POST", "auth/register", body, AuthResponse.serializer()) return r.token to r.user @@ -62,6 +64,10 @@ class ApiClient( suspend fun me(): User = get("me") + /** Sets the account's interface language; "" clears it (follow the device). */ + suspend fun setLanguage(language: String): User = + send("PATCH", "me", buildJsonObject { put("language", language) }, User.serializer()) + // Sync (guide 5.4) override suspend fun snapshot(): PullResponse = get("sync/snapshot") @@ -153,6 +159,8 @@ class ApiClient( fun headers(json: Boolean): Map = buildMap { put("Accept", "application/json") put("User-Agent", IvyHttp.userAgent) + // The interface language, so server messages can match it. + put("Accept-Language", L10n.language.tag) token?.let { put("Authorization", "Bearer $it") } if (json) put("Content-Type", "application/json") } diff --git a/core/src/main/kotlin/app/ivynote/core/ApiError.kt b/core/src/main/kotlin/app/ivynote/core/ApiError.kt index 3cac9ad..f564a14 100644 --- a/core/src/main/kotlin/app/ivynote/core/ApiError.kt +++ b/core/src/main/kotlin/app/ivynote/core/ApiError.kt @@ -1,15 +1,21 @@ package app.ivynote.core /** What can go wrong talking to a server (guide 5.1). */ -sealed class ApiError(message: String) : Exception(message) { +sealed class ApiError : Exception() { /** The server answered with an error status and `{"error": "..."}`. */ - class Server(val code: Int, val serverMessage: String) : ApiError(describe(code, serverMessage)) + class Server(val code: Int, val serverMessage: String) : ApiError() { + override val message: String get() = describe(code, serverMessage) + } /** No answer: offline, DNS, TLS, timeout. Work offline, retry later. */ - class Unreachable(val detail: String) : ApiError("无法连接服务器:$detail") + class Unreachable(val detail: String) : ApiError() { + override val message: String get() = L10n.s.unreachable(detail) + } /** The server answered, but not with what an Ivynote server sends. */ - class InvalidResponse : ApiError("这个地址不是常青笔记服务器") + class InvalidResponse : ApiError() { + override val message: String get() = L10n.s.notIvynote + } val status: Int? get() = (this as? Server)?.code @@ -26,9 +32,9 @@ sealed class ApiError(message: String) : Exception(message) { companion object { private fun describe(status: Int, message: String): String = when { - status == 429 -> "尝试次数过多,请 15 分钟后再试" - status >= 500 -> "服务器暂时不可用($status)" - message.isEmpty() -> "请求失败($status)" + status == 429 -> L10n.s.tooManyAttempts + status >= 500 -> L10n.s.serverUnavailable(status) + message.isEmpty() -> L10n.s.requestFailedStatus(status) else -> message } } diff --git a/core/src/main/kotlin/app/ivynote/core/Language.kt b/core/src/main/kotlin/app/ivynote/core/Language.kt new file mode 100644 index 0000000..9d5d3c1 --- /dev/null +++ b/core/src/main/kotlin/app/ivynote/core/Language.kt @@ -0,0 +1,188 @@ +package app.ivynote.core + +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow + +/** + * The languages of the interface: Chinese first, English second, as on the + * web (`client/packages/core/src/i18n.ts`). [tag] is the value the web keeps + * in `ivy.lang` and the one the server is expected to store for an account. + */ +enum class Language(val tag: String) { + ZH("zh"), + EN("en"); + + val strings: Strings get() = when (this) { + ZH -> ZhStrings + EN -> EnStrings + } + + companion object { + /** `zh`, `zh-Hans-CN`, `zh_TW`, `en-GB`… to a supported language; null for any other. */ + fun fromTag(tag: String?): Language? { + val primary = tag?.trim()?.lowercase()?.split('-', '_')?.firstOrNull()?.takeIf { it.isNotEmpty() } ?: return null + return entries.firstOrNull { it.tag == primary } + } + + /** + * The first supported language in the system's preference list + * (most preferred first). English when none is, as the world's + * common second language; Chinese users always have a `zh` entry. + */ + fun fromSystem(tags: List): Language = tags.firstNotNullOfOrNull(::fromTag) ?: EN + } +} + +/** A language choice: follow the system, or one language. */ +sealed interface LanguageChoice { + data object System : LanguageChoice + data class Fixed(val language: Language) : LanguageChoice + + /** `system`, `zh`, `en`: how it is stored, and sent to the server. */ + val tag: String get() = when (this) { + System -> SYSTEM_TAG + is Fixed -> language.tag + } + + companion object { + const val SYSTEM_TAG = "system" + + fun fromTag(tag: String?): LanguageChoice? = when { + tag == null -> null + tag == SYSTEM_TAG -> System + else -> Language.fromTag(tag)?.let(::Fixed) + } + + val all: List = listOf(System) + Language.entries.map(::Fixed) + } +} + +/** The strings of the current language, for code without a UI context (errors, shelf labels). */ +object L10n { + @Volatile + var language: Language = Language.ZH + + val s: Strings get() = language.strings +} + +/** + * Which language the interface speaks, in this order (guide §界面语言): + * + * 1. the signed-in account's language (`User.language`, kept by the server, + * the same on every device), when a synced library is open and it is set; + * 2. the choice made on this device, remembered across launches and sign-outs; + * 3. the system's language (the first supported one in its list, else English). + * + * Choosing in settings sets this device's choice and, when an account is + * open, the account's (`PATCH /me {language}`; "follow the system" clears + * it). A change made offline is kept as pending and sent once the server can + * be reached ([pendingTag], [pushed]). A new account is registered with the + * language in use at that moment. + */ +class LanguageSettings( + private val prefs: KeyValueStore, + systemTags: List, +) { + private var systemTags: List = systemTags + + /** The open account: its key and its language, if it has one. */ + private var account: String? = null + private var accountLanguage: Language? = null + + /** Called when the user changes the open account's language: send [tag] to the server. */ + var onAccountChoice: ((accountKey: String, tag: String) -> Unit)? = null + + private val _current = MutableStateFlow(resolve()) + /** The language in use. */ + val current: StateFlow = _current.asStateFlow() + + init { + L10n.language = _current.value + } + + /** This device's choice; [LanguageChoice.System] until the user picks one. */ + val deviceChoice: LanguageChoice + get() = LanguageChoice.fromTag(prefs.getString(DEVICE_KEY)) ?: LanguageChoice.System + + /** What the settings page shows as selected. */ + val choice: LanguageChoice + get() = accountLanguage?.let(LanguageChoice::Fixed) ?: deviceChoice + + private val _selected = MutableStateFlow(choice) + /** [choice], observable. */ + val selected: StateFlow = _selected.asStateFlow() + + /** The system's own language, for "follow the system". */ + val systemLanguage: Language get() = Language.fromSystem(systemTags) + + /** Whether an account is open, so a choice is saved to it too. */ + val hasAccount: Boolean get() = account != null + + /** The system language changed (or the app's per-app language in system settings). */ + fun systemChanged(tags: List) { + systemTags = tags + update() + } + + /** The user picked a language in settings. */ + fun choose(choice: LanguageChoice) { + if (choice == LanguageChoice.System) prefs.remove(DEVICE_KEY) else prefs.putString(DEVICE_KEY, choice.tag) + account?.let { key -> + // "Follow the system" clears the account's language. + val tag = (choice as? LanguageChoice.Fixed)?.language?.tag ?: "" + accountLanguage = (choice as? LanguageChoice.Fixed)?.language + prefs.putString(PENDING_KEY_PREFIX + key, tag) + onAccountChoice?.invoke(key, tag) + } + update() + } + + /** + * A synced library is open with a signed-in account, or its account was + * refreshed. [serverLanguage] is `User.language` ("" when not set). A + * change not sent yet wins over it. + */ + fun accountOpened(accountKey: String, serverLanguage: String) { + account = accountKey + val tag = pendingTag(accountKey) ?: serverLanguage + accountLanguage = Language.fromTag(tag) + update() + } + + /** The account's library closed (switched, signed out): back to this device's choice. */ + fun accountClosed(accountKey: String) { + if (account != accountKey) return + account = null + accountLanguage = null + update() + } + + /** A language change for the account not yet saved on the server ("" clears it), if any. */ + fun pendingTag(accountKey: String): String? = prefs.getString(PENDING_KEY_PREFIX + accountKey) + + /** The server took [tag]; a newer pending change stays. */ + fun pushed(accountKey: String, tag: String) { + if (pendingTag(accountKey) == tag) prefs.remove(PENDING_KEY_PREFIX + accountKey) + } + + private fun resolve(): Language = accountLanguage ?: when (val c = deviceChoice) { + LanguageChoice.System -> Language.fromSystem(systemTags) + is LanguageChoice.Fixed -> c.language + } + + private fun update() { + val language = resolve() + L10n.language = language + _selected.value = choice + _current.value = language + } + + companion object { + const val DEVICE_KEY = "ivy.language" + const val PENDING_KEY_PREFIX = "ivy.language.pending." + + /** An account across devices: its server and user id. */ + fun accountKey(server: ServerAddress, userId: String): String = "${server.base}|$userId" + } +} diff --git a/core/src/main/kotlin/app/ivynote/core/LibraryCatalog.kt b/core/src/main/kotlin/app/ivynote/core/LibraryCatalog.kt index b2e1184..64f043f 100644 --- a/core/src/main/kotlin/app/ivynote/core/LibraryCatalog.kt +++ b/core/src/main/kotlin/app/ivynote/core/LibraryCatalog.kt @@ -82,7 +82,7 @@ class LibraryCatalog( // Changes fun createLocal(name: String): LibraryRef = - add(LibraryRef(id = newId(), kind = LibraryRef.Kind.LOCAL, name = clean(name, "我的笔记"), createdAt = now(), openedAt = now())) + add(LibraryRef(id = newId(), kind = LibraryRef.Kind.LOCAL, name = clean(name, L10n.s.defaultLibraryName), createdAt = now(), openedAt = now())) fun createServer(server: ServerAddress, name: String): LibraryRef = add(LibraryRef(id = newId(), kind = LibraryRef.Kind.SERVER, name = clean(name, server.host), server = server, createdAt = now(), openedAt = now())) diff --git a/core/src/main/kotlin/app/ivynote/core/LibraryMigrator.kt b/core/src/main/kotlin/app/ivynote/core/LibraryMigrator.kt index 6b4e63a..daff870 100644 --- a/core/src/main/kotlin/app/ivynote/core/LibraryMigrator.kt +++ b/core/src/main/kotlin/app/ivynote/core/LibraryMigrator.kt @@ -54,7 +54,9 @@ class LibraryMigrator( val failedFiles: List = emptyList(), ) - class AccountNotEmpty : Exception("这个账户里已经有笔记。本地笔记库只能迁移到新注册的空账户。") + class AccountNotEmpty : Exception() { + override val message: String get() = L10n.s.accountNotEmpty + } suspend fun run(content: Content, progress: suspend (Progress) -> Unit = {}): Result { val folders = parentsFirst(content.folders.filter { !it.deleted }) diff --git a/core/src/main/kotlin/app/ivynote/core/Links.kt b/core/src/main/kotlin/app/ivynote/core/Links.kt index 08c15ba..18931cb 100644 --- a/core/src/main/kotlin/app/ivynote/core/Links.kt +++ b/core/src/main/kotlin/app/ivynote/core/Links.kt @@ -96,7 +96,7 @@ object Links { * plain files, an embed for images, video and audio. Brackets leave the name. */ fun embed(id: String, name: String, kind: String): String { - val label = name.replace("[", "").replace("]", "").replace("\n", " ").trim().ifEmpty { "附件" } + val label = name.replace("[", "").replace("]", "").replace("\n", " ").trim().ifEmpty { L10n.s.attachment } return if (kind == "file") "[$label](ivy://res/$id)" else "![$label](ivy://res/$id)" } } diff --git a/core/src/main/kotlin/app/ivynote/core/MediaLibrary.kt b/core/src/main/kotlin/app/ivynote/core/MediaLibrary.kt index 36a5369..9ba15a6 100644 --- a/core/src/main/kotlin/app/ivynote/core/MediaLibrary.kt +++ b/core/src/main/kotlin/app/ivynote/core/MediaLibrary.kt @@ -8,9 +8,20 @@ package app.ivynote.core */ class MediaLibrary(private val engine: SyncEngine, private val api: ApiClient?) { - enum class Filter(val label: String, val kind: String = "") { - ALL("全部"), IMAGE("图片", "image"), VIDEO("视频", "video"), AUDIO("音频", "audio"), - FILE("文件", "file"), ORPHANED("未引用"), TRASH("回收站"), + enum class Filter(val kind: String = "") { + ALL, IMAGE("image"), VIDEO("video"), AUDIO("audio"), FILE("file"), ORPHANED, TRASH; + + val label: String get() = with(L10n.s) { + when (this@Filter) { + ALL -> filterAll + IMAGE -> filterImages + VIDEO -> filterVideo + AUDIO -> filterAudio + FILE -> filterFiles + ORPHANED -> unreferenced + TRASH -> trash + } + } } data class Listing( @@ -77,7 +88,7 @@ class MediaLibrary(private val engine: SyncEngine, private val api: ApiClient?) if (!e.isTransient) throw e } } - val a = engine.attachments[id] ?: throw ApiError.Server(404, "文件不存在") + val a = engine.attachments[id] ?: throw ApiError.Server(404, L10n.s.fileNotFound) val ids = engine.attachmentRefs()[id].orEmpty() val notes = ids.mapNotNull { engine.notes[it] }.map { NoteRef(it.id, it.title, it.folderId) } return AttachmentDetail(a.copy(refs = notes.size), notes) @@ -85,7 +96,7 @@ class MediaLibrary(private val engine: SyncEngine, private val api: ApiClient?) suspend fun rename(id: String, name: String): Attachment { val clean = name.trim().replace('\n', ' ') - if (clean.isEmpty()) throw ApiError.Server(400, "名称不能为空") + if (clean.isEmpty()) throw ApiError.Server(400, L10n.s.nameEmpty) return change(id, { it.renameAttachment(id, clean) }) { it.copy(name = clean) } } @@ -103,14 +114,14 @@ class MediaLibrary(private val engine: SyncEngine, private val api: ApiClient?) /** The public address, made on first use (guide 8.3: no longer behind sign-in). */ suspend fun publish(id: String): String { - val api = api ?: throw ApiError.Server(400, "本地笔记库没有公网链接") + val api = api ?: throw ApiError.Server(400, L10n.s.localNoPublicLink) val url = api.publishAttachment(id) engine.attachments[id]?.let { engine.putAttachment(it.copy(public = true)) } return url } suspend fun unpublish(id: String): Attachment { - val api = api ?: throw ApiError.Server(400, "本地笔记库没有公网链接") + val api = api ?: throw ApiError.Server(400, L10n.s.localNoPublicLink) return api.unpublishAttachment(id).also { engine.putAttachment(it) } } @@ -118,7 +129,7 @@ class MediaLibrary(private val engine: SyncEngine, private val api: ApiClient?) val updated = if (api != null) { remote(api) } else { - val a = engine.attachments[id] ?: throw ApiError.Server(404, "文件不存在") + val a = engine.attachments[id] ?: throw ApiError.Server(404, L10n.s.fileNotFound) local(a).copy(updatedAt = nowMillis()) } engine.putAttachment(updated) diff --git a/core/src/main/kotlin/app/ivynote/core/Models.kt b/core/src/main/kotlin/app/ivynote/core/Models.kt index 04748e7..8f768b0 100644 --- a/core/src/main/kotlin/app/ivynote/core/Models.kt +++ b/core/src/main/kotlin/app/ivynote/core/Models.kt @@ -25,6 +25,8 @@ data class User( val role: String = "user", val status: String = "active", val aiAvailable: Boolean = false, + /** The interface language the user chose (`zh`, `en`…); "" follows the device. */ + val language: String = "", ) { val name: String get() = displayName.ifEmpty { username } val isAdmin: Boolean get() = role == "admin" @@ -45,11 +47,11 @@ object Validation { private val usernamePattern = Regex("[A-Za-z0-9][A-Za-z0-9_.\\-]{1,31}") fun username(s: String): String? = - if (usernamePattern.matches(s)) null else "用户名为 2–32 位字母、数字、_ . -,以字母或数字开头" + if (usernamePattern.matches(s)) null else L10n.s.usernameRule fun password(s: String): String? = when { - s.codePointCount(0, s.length) < 8 -> "密码至少 8 个字符" - s.toByteArray(Charsets.UTF_8).size > 72 -> "密码最多 72 字节" + s.codePointCount(0, s.length) < 8 -> L10n.s.passwordTooShort + s.toByteArray(Charsets.UTF_8).size > 72 -> L10n.s.passwordTooLong else -> null } } diff --git a/core/src/main/kotlin/app/ivynote/core/Remote.kt b/core/src/main/kotlin/app/ivynote/core/Remote.kt index f68a57e..0507c29 100644 --- a/core/src/main/kotlin/app/ivynote/core/Remote.kt +++ b/core/src/main/kotlin/app/ivynote/core/Remote.kt @@ -68,8 +68,8 @@ data class Share( const val MAX_PASSWORD_BYTES = 72 fun passwordError(p: String): String? = when { - p.length < MIN_PASSWORD -> "密码至少 $MIN_PASSWORD 位" - p.toByteArray(Charsets.UTF_8).size > MAX_PASSWORD_BYTES -> "密码最多 $MAX_PASSWORD_BYTES 字节" + p.length < MIN_PASSWORD -> L10n.s.sharePasswordMin(MIN_PASSWORD) + p.toByteArray(Charsets.UTF_8).size > MAX_PASSWORD_BYTES -> L10n.s.sharePasswordMax(MAX_PASSWORD_BYTES) else -> null } @@ -81,6 +81,6 @@ data class Share( } /** The message the web copies with 复制链接和密码. */ - fun message(title: String, link: String, password: String): String = "$title\n链接:$link\n密码:$password" + fun message(title: String, link: String, password: String): String = L10n.s.shareMessage(title, link, password) } } diff --git a/core/src/main/kotlin/app/ivynote/core/ServerAddress.kt b/core/src/main/kotlin/app/ivynote/core/ServerAddress.kt index fe6909c..4b4efbb 100644 --- a/core/src/main/kotlin/app/ivynote/core/ServerAddress.kt +++ b/core/src/main/kotlin/app/ivynote/core/ServerAddress.kt @@ -18,11 +18,19 @@ import okhttp3.HttpUrl.Companion.toHttpUrlOrNull @Serializable(with = ServerAddressSerializer::class) class ServerAddress private constructor(val base: String, val host: String, val scheme: String) { - sealed class ParseError(message: String) : Exception(message) { - data object Empty : ParseError("请填写服务器地址") - data object Invalid : ParseError("服务器地址无效") - data class UnsupportedScheme(val scheme: String) : ParseError("不支持的协议:$scheme") - data class InsecureRemote(val host: String) : ParseError("$host 不是局域网地址,必须使用 https://") + sealed class ParseError : Exception() { + data object Empty : ParseError() + data object Invalid : ParseError() + data class UnsupportedScheme(val scheme: String) : ParseError() + data class InsecureRemote(val host: String) : ParseError() + + override val message: String + get() = when (this) { + Empty -> L10n.s.serverEmpty + Invalid -> L10n.s.serverInvalid + is UnsupportedScheme -> L10n.s.unsupportedScheme(scheme) + is InsecureRemote -> L10n.s.insecureRemote(host) + } } /** `{server}/api/v1`. */ diff --git a/core/src/main/kotlin/app/ivynote/core/SessionStore.kt b/core/src/main/kotlin/app/ivynote/core/SessionStore.kt index c1fee96..06c3cb2 100644 --- a/core/src/main/kotlin/app/ivynote/core/SessionStore.kt +++ b/core/src/main/kotlin/app/ivynote/core/SessionStore.kt @@ -83,6 +83,32 @@ class SessionStore( _state.value = State.SignedIn(account) } + /** + * Saves the account's interface language on the server (`PATCH /me`). + * False when it could not be sent (offline): the caller tries again later. + */ + suspend fun pushLanguage(tag: String): Boolean { + val current = account ?: return false + val api = api ?: return false + return try { + val user = api.setLanguage(tag) + if (account?.token == current.token) { + val updated = current.copy(user = user) + runCatching { store.save(updated) } + _state.value = State.SignedIn(updated) + } + true + } catch (e: CancellationException) { + throw e + } catch (e: ApiError) { + if (e.endsSession) expire(e) + // A refused tag will not succeed later either. + !e.isTransient + } catch (e: Exception) { + false + } + } + /** Revokes this device's token (best effort) and forgets the account. */ suspend fun signOut() { api?.let { runCatching { it.logout() } } @@ -101,7 +127,7 @@ class SessionStore( // The token is no longer valid. Local notes and the outbox are kept // (guide 5.1): signing in again resumes syncing them. runCatching { store.clear() } - _notice.value = if (error.status == 403) error.message ?: "账户不可用" else "登录已过期,请重新登录" + _notice.value = if (error.status == 403) error.message ?: L10n.s.accountUnavailable else L10n.s.sessionExpired _offline.value = false _state.value = State.SignedOut } diff --git a/core/src/main/kotlin/app/ivynote/core/Shelf.kt b/core/src/main/kotlin/app/ivynote/core/Shelf.kt index e7e219c..d5cea4c 100644 --- a/core/src/main/kotlin/app/ivynote/core/Shelf.kt +++ b/core/src/main/kotlin/app/ivynote/core/Shelf.kt @@ -15,8 +15,14 @@ object Shelf { /** Notes shown per branch before a "show more" row. */ const val PAGE = 100 - enum class SortBy(val label: String) { - UPDATED("更新时间"), CREATED("创建时间"), TITLE("标题"); + enum class SortBy { + UPDATED, CREATED, TITLE; + + val label: String get() = when (this) { + UPDATED -> L10n.s.sortUpdated + CREATED -> L10n.s.sortCreated + TITLE -> L10n.s.sortTitle + } } enum class Kind { GROUP, HEADING, SECTION, CREATE, FOLDER, TAG, NOTE, MORE } @@ -159,23 +165,23 @@ object Shelf { val pinned = live.filter { it.pinned } if (pinned.isNotEmpty()) { val open = closedKey(PINNED_KEY) !in expanded - rows += Row(key = PINNED_KEY, kind = Kind.SECTION, depth = 0, parent = "", label = "置顶", count = pinned.size, + rows += Row(key = PINNED_KEY, kind = Kind.SECTION, depth = 0, parent = "", label = L10n.s.pinned, count = pinned.size, expandable = true, open = open) if (open) noteRows(pinned, PINNED_KEY, 0) } - rows += Row(key = "h:notes", kind = Kind.HEADING, depth = 0, parent = "", label = "笔记", folderId = "") + rows += Row(key = "h:notes", kind = Kind.HEADING, depth = 0, parent = "", label = L10n.s.notes, folderId = "") if (folders.isNotEmpty()) { folderRows("", 0) } else { - rows += Row(key = "h:create", kind = Kind.CREATE, depth = 0, parent = "", label = "新建笔记本") + rows += Row(key = "h:create", kind = Kind.CREATE, depth = 0, parent = "", label = L10n.s.createFolderRow) } // Notes outside any notebook sit below them, like files at the root of a drive. noteRows(filed[""].orEmpty(), "", 0, folderId = "") if (tags.isNotEmpty()) { val open = TAGS_KEY in expanded - rows += Row(key = TAGS_KEY, kind = Kind.GROUP, depth = 0, parent = "", label = "标签", expandable = true, open = open, gap = true) + rows += Row(key = TAGS_KEY, kind = Kind.GROUP, depth = 0, parent = "", label = L10n.s.tags, expandable = true, open = open, gap = true) if (open) { for (tag in tags.sortedWith { a, b -> compareTitles(a.name, b.name) }) { val key = "t:" + tag.id @@ -187,7 +193,7 @@ object Shelf { } } } - group(TRASH_KEY, "回收站", trashed, trash = true, gap = tags.isEmpty()) + group(TRASH_KEY, L10n.s.trash, trashed, trash = true, gap = tags.isEmpty()) return rows } @@ -239,4 +245,4 @@ object Shelf { } } -fun displayTitle(n: Note): String = n.title.ifBlank { "无标题" } +fun displayTitle(n: Note): String = n.title.ifBlank { L10n.s.untitled } diff --git a/core/src/main/kotlin/app/ivynote/core/Strings.kt b/core/src/main/kotlin/app/ivynote/core/Strings.kt new file mode 100644 index 0000000..b8d232d --- /dev/null +++ b/core/src/main/kotlin/app/ivynote/core/Strings.kt @@ -0,0 +1,1164 @@ +package app.ivynote.core + +import java.util.Locale + +/** + * Every string the app shows, in each [Language]. One interface, so a string + * missing from a language does not compile. Wording follows the web client's + * dictionary (`client/packages/core/src/i18n.ts`) where both have it. + */ +interface Strings { + /** For dates, numbers and sorting in this language. */ + val locale: Locale + + // Common + val appName: String + val slogan: String + val tagline: String + val name: String + val save: String + val cancel: String + val create: String + val delete: String + val remove: String + val rename: String + val open: String + val retry: String + val done: String + val back: String + val more: String + val clear: String + val ok: String + val copied: String + val restore: String + val deleteForever: String + val untitled: String + val unnamed: String + val note: String + val notes: String + val tags: String + val trash: String + val pinned: String + val needsNetwork: String + val requestFailed: String + val cannotReadFile: String + + // Language + val language: String + val followSystem: String + fun followSystemWith(language: String): String + val languageAccountHint: String + val languageDeviceHint: String + + // Dates + val justNow: String + fun yesterday(time: String): String + fun weekday(dayOfWeek: Int): String + fun monthDay(month: Int, day: Int): String + fun yearMonthDay(year: Int, month: Int, day: Int): String + /** For [java.text.SimpleDateFormat]: a moment with the time. */ + val dateTimePattern: String + /** For [java.text.SimpleDateFormat]: a day this year. */ + val monthDayPattern: String + + // Sync status (guide 11.7) + val localUnsynced: String + val downloadingNotes: String + val syncing: String + val offline: String + fun offlinePending(n: Int): String + val syncError: String + fun pending(n: Int): String + fun synced(ago: String): String + val neverSynced: String + fun blocked(n: Int): String + + // Libraries + val libraries: String + val welcome: String + val pickLibrary: String + val connect: String + val connectHint: String + val newLocal: String + val newLocalHint: String + val newLocalMessage: String + val canConvert: String + val startCloud: String + val startCloudHint: String + val localOnly: String + val defaultLibraryName: String + val renameLibrary: String + val removeLibrary: String + fun removeLocalMessage(name: String): String + fun removeServerMessage(name: String): String + val turnOnSync: String + val migratedHint: String + val cannotOpenData: String + val backToLibraries: String + + // Account + val account: String + val username: String + val email: String + val role: String + val admin: String + val user: String + fun syncSection(library: String): String + val server: String + val status: String + val thisDevice: String + val syncNow: String + val openAdmin: String + val signingOut: String + val signOut: String + val signOutHint: String + val signOutTitle: String + fun signOutUnsynced(n: Int): String + val signOutMessage: String + + // Library and shelf + fun uploadRefused(name: String, message: String): String + val conflictTitle: String + fun conflictMessage(title: String): String + val openCopy: String + val newNote: String + val newFolder: String + val newSubfolder: String + val renameFolder: String + val deleteFolderTitle: String + fun deleteFolderMessage(name: String): String + val renameNote: String + val emptyTrashTitle: String + val emptyTrashMessage: String + val emptyTrash: String + val switchLibrary: String + val accountAndSync: String + val turnOnSyncEllipsis: String + val mediaLibrary: String + val manageLibraries: String + val searchNotes: String + val sortAndNew: String + fun showMore(next: Int, hidden: Int): String + val collapse: String + val expand: String + val sort: String + val sortUpdated: String + val sortCreated: String + val sortTitle: String + val createFolderRow: String + val editTagEllipsis: String + val pin: String + val unpin: String + val moveToEllipsis: String + val moveTo: String + val duplicateNote: String + val duplicateSuffix: String + val moveToTrash: String + val noNotebook: String + fun noResults(query: String): String + + // Note + val share: String + val outline: String + val tagsEllipsis: String + val backlinks: String + fun backlinksMenu(n: Int): String + fun backlinksCount(n: Int): String + val history: String + val noteInTrash: String + val formatPhoto: String + val formatCamera: String + val formatAttachment: String + val formatHeading: String + val formatBold: String + val formatItalic: String + val formatTask: String + val formatList: String + val formatOrdered: String + val formatQuote: String + val formatCode: String + val formatWikiLink: String + val formatLink: String + val formatStrike: String + val undo: String + val hideKeyboard: String + val noHeadings: String + val noHeadingsHint: String + val noBacklinks: String + fun noBacklinksHint(title: String): String + + // Tags + fun tagColor(color: String): String + val searchOrCreateTag: String + fun maxTags(n: Int): String + fun createTag(name: String): String + val editTag: String + val noTags: String + val tagExists: String + val color: String + val deleteTag: String + val deleteTagTitle: String + fun deleteTagMessage(name: String): String + + // History + val restoreVersion: String + val localNoHistory: String + val localNoHistoryHint: String + val historyLoadFailed: String + val noHistory: String + val noHistoryHint: String + val unknownDevice: String + val currentVersion: String + val restoreVersionTitle: String + val restoreVersionMessage: String + val restoredVersion: String + + // Sharing + val offlineNoPublicLinks: String + val shareNote: String + val localNoShare: String + val shareNeedsNetwork: String + val publicLink: String + val publicLinkHint: String + val legacyShare: String + val needPassword: String + val newPasswordPlaceholder: String + val generate: String + val createLink: String + val copyLink: String + val shareExpired: String + val copyPassword: String + val passwordSet: String + val changePassword: String + val copyLinkAndPassword: String + val expires: String + fun views(n: Int): String + val copyOrExport: String + val copyAsHint: String + val copyAsOffline: String + val copyMarkdown: String + val sendToApp: String + val exportMd: String + val neverExpires: String + fun until(date: String): String + fun days(n: Int): String + fun shareMessage(title: String, link: String, password: String): String + fun sharePasswordMin(n: Int): String + fun sharePasswordMax(n: Int): String + + // Media + val fileTooLarge: String + fun queuedUpload(name: String): String + val duplicateMerged: String + fun cannotAddFile(error: String): String + val noCamera: String + val noFilePicker: String + val upload: String + val photoOrVideo: String + val camera: String + val file: String + val searchFiles: String + val mediaOffline: String + fun orphanBanner(n: Int, days: Int): String + fun orphanBannerNoDays(n: Int): String + val mediaTrashEmpty: String + val mediaEmpty: String + val isPublic: String + fun refs(n: Int): String + val unreferenced: String + val cannotGetFile: String + val type: String + val size: String + val uploadedAt: String + val publicUrl: String + val publicPlaceholder: String + val trashedOrphan: String + val trashedManual: String + val noNotesReference: String + fun referencedBy(n: Int): String + val copyReference: String + val copyPublicUrl: String + val makePublicUrl: String + val revokePublicUrl: String + val shareOriginal: String + val localFilesHint: String + val publicFilesHint: String + val renameFile: String + val purgeFileTitle: String + fun purgeFileMessage(name: String): String + val filterAll: String + val filterImages: String + val filterVideo: String + val filterAudio: String + val filterFiles: String + val attachment: String + val fileNotFound: String + val nameEmpty: String + val localNoPublicLink: String + + // Sign in + val wrongCredentials: String + val signInTitle: String + val turnOnSyncTitle: String + val continueMigration: String + val syncNode: String + val regionCn: String + val regionGlobal: String + fun officialRegion(region: String): String + val customServerEllipsis: String + val nodeUnreachable: String + val signInHint: String + fun promoteHint(name: String): String + val register: String + val login: String + val firstAdmin: String + val registrationClosed: String + val registerAndSync: String + val promoteNote: String + fun migrationRejected(n: Int): String + fun migrationFilesFailed(n: Int): String + fun migrationInterrupted(error: String): String + val preparing: String + fun uploadingFiles(done: Int, total: Int): String + fun uploadingNotes(done: Int, total: Int): String + val migrationDone: String + val customServer: String + val insecureWarning: String + val customServerHint: String + val useServer: String + val cannotConnect: String + val httpWarning: String + val createAccount: String + val usernameOrEmail: String + val emailOptional: String + val displayNameOptional: String + val password: String + val passwordMin8: String + + // Updates + fun aboutNewer(newer: String): String + fun aboutVersion(version: String): String + val aboutAndUpdates: String + val updateAvailable: String + fun versionReleased(version: String): String + fun currentVersionIs(version: String): String + fun downloading(progress: String): String + val savingAndInstalling: String + val updateReady: String + val debugUpdateHint: String + val webUpdateHint: String + val updateHint: String + fun downloadFailed(error: String): String + fun installFailed(error: String): String + val downloadInBackground: String + val installing: String + val installNow: String + val downloadFromWebsite: String + val updateNow: String + val cancelDownload: String + val websiteDownload: String + val skipVersion: String + val later: String + val aboutTagline: String + val version: String + val checkForUpdates: String + val checking: String + fun downloadingVersion(version: String): String + fun newVersion(version: String): String + val checkFailed: String + val upToDate: String + val anonymousStats: String + val anonymousStatsHint: String + val website: String + fun upToDateVersion(version: String): String + fun checkUpdateFailed(error: String): String + val allowInstall: String + val apkInvalid: String + val signatureMismatch: String + val noStorage: String + val installBlocked: String + val installIncomplete: String + + // Errors and checks (core) + fun unreachable(detail: String): String + val notIvynote: String + val tooManyAttempts: String + fun serverUnavailable(status: Int): String + fun requestFailedStatus(status: Int): String + val accountNotEmpty: String + val accountUnavailable: String + val sessionExpired: String + val usernameRule: String + val passwordTooShort: String + val passwordTooLong: String + val serverEmpty: String + val serverInvalid: String + fun unsupportedScheme(scheme: String): String + fun insecureRemote(host: String): String +} + +object ZhStrings : Strings { + override val locale: Locale = Locale.SIMPLIFIED_CHINESE + + override val appName = "常青笔记" + override val slogan = "本地优先的 Markdown 笔记" + override val tagline = "像常春藤一样,你的笔记彼此相连、四季常青。" + override val name = "名称" + override val save = "保存" + override val cancel = "取消" + override val create = "创建" + override val delete = "删除" + override val remove = "移除" + override val rename = "重命名" + override val open = "打开" + override val retry = "重试" + override val done = "完成" + override val back = "返回" + override val more = "更多" + override val clear = "清除" + override val ok = "好" + override val copied = "已复制" + override val restore = "恢复" + override val deleteForever = "永久删除" + override val untitled = "无标题" + override val unnamed = "未命名" + override val note = "笔记" + override val notes = "笔记" + override val tags = "标签" + override val trash = "回收站" + override val pinned = "置顶" + override val needsNetwork = "需要联网" + override val requestFailed = "请求失败" + override val cannotReadFile = "无法读取文件" + + override val language = "语言 · Language" + override val followSystem = "跟随系统" + override fun followSystemWith(language: String) = "跟随系统($language)" + override val languageAccountHint = "保存在你的账户中,在登录这个账户的所有设备上生效。" + override val languageDeviceHint = "只对这台设备生效。登录同步账户后,以账户的语言设置为准。" + + override val justNow = "刚刚" + override fun yesterday(time: String) = "昨天 $time" + override fun weekday(dayOfWeek: Int) = listOf("周日", "周一", "周二", "周三", "周四", "周五", "周六")[(dayOfWeek - 1).mod(7)] + override fun monthDay(month: Int, day: Int) = "${month}月${day}日" + override fun yearMonthDay(year: Int, month: Int, day: Int) = "${year}年${month}月${day}日" + override val dateTimePattern = "yyyy年M月d日 HH:mm" + override val monthDayPattern = "M月d日" + + override val localUnsynced = "仅保存在本机 · 未同步" + override val downloadingNotes = "正在下载笔记…" + override val syncing = "同步中…" + override val offline = "离线" + override fun offlinePending(n: Int) = "离线 · $n 条待同步" + override val syncError = "同步出错" + override fun pending(n: Int) = "$n 条待同步" + override fun synced(ago: String) = "已同步 · $ago" + override val neverSynced = "尚未同步" + override fun blocked(n: Int) = "$n 条更改被服务器拒绝" + + override val libraries = "笔记库" + override val welcome = "本地优先的 Markdown 笔记,在手机、电脑和网页间同步。" + override val pickLibrary = "选择要打开的笔记库" + override val connect = "登录云同步账户" + override val connectHint = "在多台设备间同步,支持官方节点和自建服务器" + override val newLocal = "新建本地笔记库" + override val newLocalHint = "只保存在这台设备,无需账户,立即可用" + override val newLocalMessage = "笔记只保存在这台设备上,不会同步。" + override val canConvert = "本地笔记库可以随时开启同步:注册新账户后,内容会自动上传。" + override val startCloud = "开始使用 · 多端同步" + override val startCloudHint = "登录或注册,笔记在手机、电脑和网页间自动同步" + override val localOnly = "不登录,仅在本机使用" + override val defaultLibraryName = "我的笔记" + override val renameLibrary = "重命名笔记库" + override val removeLibrary = "移除笔记库" + override fun removeLocalMessage(name: String) = "将永久删除「$name」里的全部笔记,无法恢复。" + override fun removeServerMessage(name: String) = "将从这台设备删除「$name」的本地副本和登录状态。服务器上的笔记不受影响,但尚未同步的更改会丢失。" + override val turnOnSync = "开启同步" + override val migratedHint = "已迁移到云端,确认无误后可以移除" + override val cannotOpenData = "无法打开本地数据" + override val backToLibraries = "返回笔记库列表" + + override val account = "账户" + override val username = "用户名" + override val email = "邮箱" + override val role = "角色" + override val admin = "管理员" + override val user = "用户" + override fun syncSection(library: String) = "同步 · $library" + override val server = "服务器" + override val status = "状态" + override val thisDevice = "本设备" + override val syncNow = "立即同步" + override val openAdmin = "打开管理后台" + override val signingOut = "正在退出…" + override val signOut = "退出登录" + override val signOutHint = "退出后,本设备上这个笔记库的副本会被删除;服务器上的数据不受影响。重新登录后会再次下载。" + override val signOutTitle = "退出登录?" + override fun signOutUnsynced(n: Int) = "还有 $n 条更改没有同步到服务器,退出后会丢失。" + override val signOutMessage = "这台设备的登录令牌会被撤销,本地数据会被删除。" + + override fun uploadRefused(name: String, message: String) = "「$name」未能上传:$message" + override val conflictTitle = "内容冲突" + override fun conflictMessage(title: String) = "「$title」在其他设备上也改动了同一处。服务器保留了它的版本,你的修改已另存为冲突副本。" + override val openCopy = "打开副本" + override val newNote = "新建笔记" + override val newFolder = "新建笔记本" + override val newSubfolder = "新建子笔记本" + override val renameFolder = "重命名笔记本" + override val deleteFolderTitle = "删除笔记本?" + override fun deleteFolderMessage(name: String) = "「$name」的子笔记本会一起删除,其中的笔记移到回收站。" + override val renameNote = "重命名笔记" + override val emptyTrashTitle = "清空回收站?" + override val emptyTrashMessage = "回收站中的全部笔记将被永久删除,此操作无法撤销。" + override val emptyTrash = "清空回收站" + override val switchLibrary = "切换笔记库" + override val accountAndSync = "账户与同步…" + override val turnOnSyncEllipsis = "开启多端同步…" + override val mediaLibrary = "媒体库" + override val manageLibraries = "管理笔记库…" + override val searchNotes = "搜索笔记" + override val sortAndNew = "排序与新建" + override fun showMore(next: Int, hidden: Int) = "再显示 $next 篇(共 $hidden 篇未显示)" + override val collapse = "收起" + override val expand = "展开" + override val sort = "排序" + override val sortUpdated = "更新时间" + override val sortCreated = "创建时间" + override val sortTitle = "标题" + override val createFolderRow = "新建笔记本" + override val editTagEllipsis = "编辑标签…" + override val pin = "置顶" + override val unpin = "取消置顶" + override val moveToEllipsis = "移动到…" + override val moveTo = "移动到" + override val duplicateNote = "复制笔记" + override val duplicateSuffix = " 副本" + override val moveToTrash = "移到回收站" + override val noNotebook = "无笔记本" + override fun noResults(query: String) = "没有找到「$query」" + + override val share = "分享" + override val outline = "大纲" + override val tagsEllipsis = "标签…" + override val backlinks = "反向链接" + override fun backlinksMenu(n: Int) = "反向链接($n)" + override fun backlinksCount(n: Int) = "$n 条反向链接" + override val history = "历史版本" + override val noteInTrash = "这篇笔记在回收站中" + override val formatPhoto = "图片" + override val formatCamera = "拍照" + override val formatAttachment = "附件" + override val formatHeading = "标题" + override val formatBold = "加粗" + override val formatItalic = "斜体" + override val formatTask = "待办" + override val formatList = "列表" + override val formatOrdered = "编号" + override val formatQuote = "引用" + override val formatCode = "代码" + override val formatWikiLink = "双链" + override val formatLink = "链接" + override val formatStrike = "删除线" + override val undo = "撤销" + override val hideKeyboard = "收起键盘" + override val noHeadings = "还没有标题" + override val noHeadingsHint = "以 # 开头的行会出现在这里。" + override val noBacklinks = "还没有笔记链接到这里" + override fun noBacklinksHint(title: String) = "在其他笔记中输入 [[$title]] 即可链接到这篇笔记。" + + override fun tagColor(color: String) = when (color) { + "green" -> "绿" + "blue" -> "蓝" + "amber" -> "琥珀" + "pink" -> "粉" + "purple" -> "紫" + "gray" -> "灰" + else -> "无" + } + override val searchOrCreateTag = "搜索或创建标签" + override fun maxTags(n: Int) = "一篇笔记最多 $n 个标签" + override fun createTag(name: String) = "创建「$name」" + override val editTag = "编辑标签" + override val noTags = "还没有标签。输入名称即可创建。" + override val tagExists = "已有同名标签" + override val color = "颜色" + override val deleteTag = "删除标签" + override val deleteTagTitle = "删除标签?" + override fun deleteTagMessage(name: String) = "「#$name」会从所有笔记上移除,笔记本身不受影响。" + + override val restoreVersion = "恢复此版本" + override val localNoHistory = "本地笔记库没有历史版本" + override val localNoHistoryHint = "历史版本保存在同步服务器上。" + override val historyLoadFailed = "无法载入历史版本" + override val noHistory = "暂无历史版本" + override val noHistoryHint = "编辑并同步后,这里会出现保存过的版本。" + override val unknownDevice = "未知设备" + override val currentVersion = "当前版本" + override val restoreVersionTitle = "恢复此版本?" + override val restoreVersionMessage = "当前内容会被替换,但仍会保留在历史版本中。" + override val restoredVersion = "已恢复为历史版本" + + override val offlineNoPublicLinks = "离线中,附件没有替换为公网链接" + override val shareNote = "分享笔记" + override val localNoShare = "本地笔记库不能生成公开链接,可以复制或导出笔记。" + override val shareNeedsNetwork = "分享链接需要联网。" + override val publicLink = "公开链接" + override val publicLinkHint = "拿到链接和访问密码的人可以阅读这篇笔记" + override val legacyShare = "这个链接是在要求密码之前创建的,设置密码后才能继续访问。" + override val needPassword = "为保护你的隐私,公开链接必须设置至少 6 位的访问密码。" + override val newPasswordPlaceholder = "新密码(至少 6 位)" + override val generate = "随机生成" + override val createLink = "生成链接" + override val copyLink = "复制链接" + override val shareExpired = "分享已过期" + override val copyPassword = "复制密码" + override val passwordSet = "已设置访问密码" + override val changePassword = "修改密码" + override val copyLinkAndPassword = "复制链接和密码" + override val expires = "有效期" + override fun views(n: Int) = "$n 次访问" + override val copyOrExport = "复制或导出" + override val copyAsHint = "附件会自动公开并替换为公网链接,方便粘贴到博客、公众号等地方。" + override val copyAsOffline = "离线时附件不会替换为公网链接。" + override val copyMarkdown = "复制 Markdown" + override val sendToApp = "发送到其他应用" + override val exportMd = "导出 .md 文件" + override val neverExpires = "永久有效" + override fun until(date: String) = "至 $date" + override fun days(n: Int) = "$n 天" + override fun shareMessage(title: String, link: String, password: String) = "$title\n链接:$link\n密码:$password" + override fun sharePasswordMin(n: Int) = "密码至少 $n 位" + override fun sharePasswordMax(n: Int) = "密码最多 $n 字节" + + override val fileTooLarge = "文件超过服务器的上传上限" + override fun queuedUpload(name: String) = "离线中,「$name」将在联网后上传" + override val duplicateMerged = "重复文件已合并" + override fun cannotAddFile(error: String) = "无法添加文件:$error" + override val noCamera = "没有可用的相机应用" + override val noFilePicker = "没有可用的文件选择器" + override val upload = "上传" + override val photoOrVideo = "图片或视频" + override val camera = "拍照" + override val file = "文件" + override val searchFiles = "搜索文件名" + override val mediaOffline = "离线中,显示的是本机同步下来的文件信息,修改需要联网。" + override fun orphanBanner(n: Int, days: Int) = "$n 个文件没有被任何笔记引用,将在 $days 天后自动移入回收站。" + override fun orphanBannerNoDays(n: Int) = "$n 个文件没有被任何笔记引用。" + override val mediaTrashEmpty = "回收站是空的" + override val mediaEmpty = "还没有文件。在笔记中插入图片或附件即可自动加入媒体库。" + override val isPublic = "已公开" + override fun refs(n: Int) = "被 $n 篇引用" + override val unreferenced = "未引用" + override val cannotGetFile = "无法取得文件,请检查网络" + override val type = "类型" + override val size = "大小" + override val uploadedAt = "上传于" + override val publicUrl = "公网链接" + override val publicPlaceholder = "已公开(/r/…)" + override val trashedOrphan = "未引用,已自动移入" + override val trashedManual = "已移入" + override val noNotesReference = "没有笔记引用它" + override fun referencedBy(n: Int) = "被 $n 篇笔记引用" + override val copyReference = "复制引用" + override val copyPublicUrl = "复制公网链接" + override val makePublicUrl = "生成公网链接" + override val revokePublicUrl = "撤销公网链接" + override val shareOriginal = "分享或保存原文件" + override val localFilesHint = "本地笔记库的文件只保存在这台设备上。" + override val publicFilesHint = "公开的文件不再受登录保护,拿到链接的人都能打开。" + override val renameFile = "重命名文件" + override val purgeFileTitle = "永久删除文件?" + override fun purgeFileMessage(name: String) = "「$name」将被永久删除,引用它的笔记会显示为缺失。此操作无法撤销。" + override val filterAll = "全部" + override val filterImages = "图片" + override val filterVideo = "视频" + override val filterAudio = "音频" + override val filterFiles = "文件" + override val attachment = "附件" + override val fileNotFound = "文件不存在" + override val nameEmpty = "名称不能为空" + override val localNoPublicLink = "本地笔记库没有公网链接" + + override val wrongCredentials = "用户名或密码错误" + override val signInTitle = "登录常青笔记" + override val turnOnSyncTitle = "开启多端同步" + override val continueMigration = "继续迁移" + override val syncNode = "同步节点" + override val regionCn = "中国大陆" + override val regionGlobal = "全球" + override fun officialRegion(region: String) = "常青笔记 · $region" + override val customServerEllipsis = "自定义服务器…" + override val nodeUnreachable = "暂时无法连接这个节点" + override val signInHint = "笔记先保存在本机,联网时自动同步到你的所有设备。" + override fun promoteHint(name: String) = "注册一个新账户,「$name」会上传到云端,之后在所有设备上同步。" + override val register = "注册" + override val login = "登录" + override val firstAdmin = "这台服务器还没有账户。你创建的第一个账户将成为管理员。" + override val registrationClosed = "这台服务器没有开放注册。" + override val registerAndSync = "注册并开启同步" + override val promoteNote = "本地笔记库只能迁移到新注册的账户。已有账户的话,可以先登录,再在网页版或桌面端的「设置 → 导入」中导入本笔记库导出的内容。" + override fun migrationRejected(n: Int) = "$n 项未能迁移,原内容仍保留在本地笔记库中。" + override fun migrationFilesFailed(n: Int) = "$n 个文件未能上传,原文件仍保留在本地笔记库中。" + override fun migrationInterrupted(error: String) = "迁移中断:$error。账户已经创建,点「继续迁移」会从中断处继续,已上传的内容不会重复。" + override val preparing = "正在准备…" + override fun uploadingFiles(done: Int, total: Int) = "正在上传文件 $done/$total" + override fun uploadingNotes(done: Int, total: Int) = "正在上传笔记 $done/$total" + override val migrationDone = "迁移完成,正在打开…" + override val customServer = "自定义服务器" + override val insecureWarning = "使用 http 连接时,密码和笔记以明文传输,请只在可信的局域网内使用。" + override val customServerHint = "连接你自己或团队部署的常青笔记服务器。" + override val useServer = "使用这个服务器" + override val cannotConnect = "无法连接服务器" + override val httpWarning = "使用 http 连接,密码和笔记以明文传输。" + override val createAccount = "创建账户" + override val usernameOrEmail = "用户名或邮箱" + override val emailOptional = "邮箱(可选)" + override val displayNameOptional = "显示名(可选)" + override val password = "密码" + override val passwordMin8 = "密码(至少 8 位)" + + // Updates + override fun aboutNewer(newer: String) = "关于常青笔记 · 有新版本 $newer" + override fun aboutVersion(version: String) = "关于常青笔记 · $version" + override val aboutAndUpdates = "关于与检查更新…" + override val updateAvailable = "发现新版本" + override fun versionReleased(version: String) = "常青笔记 $version 已发布" + override fun currentVersionIs(version: String) = "当前版本 $version" + override fun downloading(progress: String) = "正在下载… $progress" + override val savingAndInstalling = "正在保存笔记并打开安装程序…" + override val updateReady = "新版本已下载并校验,按系统提示完成安装即可,笔记会先保存。" + override val debugUpdateHint = "调试版无法直接更新,请前往官网下载正式版。" + override val webUpdateHint = "请前往官网下载新版本。" + override val updateHint = "下载完成后由系统安装,笔记会先保存。首次更新需要允许常青笔记安装应用。" + override fun downloadFailed(error: String) = "下载失败:$error。可以重试或前往官网下载。" + override fun installFailed(error: String) = "安装失败:$error。可以重试或前往官网下载。" + override val downloadInBackground = "后台下载" + override val installing = "正在安装…" + override val installNow = "立即安装" + override val downloadFromWebsite = "前往官网下载" + override val updateNow = "立即更新" + override val cancelDownload = "取消下载" + override val websiteDownload = "官网下载" + override val skipVersion = "跳过此版本" + override val later = "稍后" + override val aboutTagline = "本地优先的 Markdown 笔记。离线也能写,联网后自动同步。" + override val version = "版本" + override val checkForUpdates = "检查更新" + override val checking = "正在检查…" + override fun downloadingVersion(version: String) = "正在下载 $version…" + override fun newVersion(version: String) = "有新版本 $version" + override val checkFailed = "检查失败" + override val upToDate = "已是最新版本" + override val anonymousStats = "匿名使用统计" + override val anonymousStatsHint = "检查更新时附带一个随机的安装编号(与账号无关),帮助我们了解有多少设备在使用常青笔记。不包含笔记内容或个人信息。" + override val website = "官网 ivynote.net" + override fun upToDateVersion(version: String) = "已是最新版本($version)" + override fun checkUpdateFailed(error: String) = "检查更新失败:$error" + override val allowInstall = "请允许「常青笔记」安装应用,然后返回点击「立即安装」" + override val apkInvalid = "下载的安装包已失效,请重新下载" + override val signatureMismatch = "新版本与已安装的应用签名不一致,请前往官网下载安装" + override val noStorage = "存储空间不足" + override val installBlocked = "安装被系统阻止" + override val installIncomplete = "安装未完成" + + override fun unreachable(detail: String) = "无法连接服务器:$detail" + override val notIvynote = "这个地址不是常青笔记服务器" + override val tooManyAttempts = "尝试次数过多,请 15 分钟后再试" + override fun serverUnavailable(status: Int) = "服务器暂时不可用($status)" + override fun requestFailedStatus(status: Int) = "请求失败($status)" + override val accountNotEmpty = "这个账户里已经有笔记。本地笔记库只能迁移到新注册的空账户。" + override val accountUnavailable = "账户不可用" + override val sessionExpired = "登录已过期,请重新登录" + override val usernameRule = "用户名为 2–32 位字母、数字、_ . -,以字母或数字开头" + override val passwordTooShort = "密码至少 8 个字符" + override val passwordTooLong = "密码最多 72 字节" + override val serverEmpty = "请填写服务器地址" + override val serverInvalid = "服务器地址无效" + override fun unsupportedScheme(scheme: String) = "不支持的协议:$scheme" + override fun insecureRemote(host: String) = "$host 不是局域网地址,必须使用 https://" +} + +object EnStrings : Strings { + override val locale: Locale = Locale.ENGLISH + + /** "1 note", "2 notes". */ + private fun count(n: Int, one: String, many: String = one + "s") = "$n ${if (n == 1) one else many}" + + override val appName = "Ivynote" + override val slogan = "Local-first Markdown notes" + override val tagline = "Like ivy, your notes stay connected and evergreen." + override val name = "Name" + override val save = "Save" + override val cancel = "Cancel" + override val create = "Create" + override val delete = "Delete" + override val remove = "Remove" + override val rename = "Rename" + override val open = "Open" + override val retry = "Retry" + override val done = "Done" + override val back = "Back" + override val more = "More" + override val clear = "Clear" + override val ok = "OK" + override val copied = "Copied" + override val restore = "Restore" + override val deleteForever = "Delete forever" + override val untitled = "Untitled" + override val unnamed = "Unnamed" + override val note = "Note" + override val notes = "Notes" + override val tags = "Tags" + override val trash = "Trash" + override val pinned = "Pinned" + override val needsNetwork = "Needs a connection" + override val requestFailed = "Request failed" + override val cannotReadFile = "Could not read the file" + + override val language = "Language · 语言" + override val followSystem = "System default" + override fun followSystemWith(language: String) = "System default ($language)" + override val languageAccountHint = "Saved in your account, on every device signed in to it." + override val languageDeviceHint = "For this device only. Once you sign in to a synced account, the account’s language applies." + + override val justNow = "just now" + override fun yesterday(time: String) = "Yesterday $time" + override fun weekday(dayOfWeek: Int) = listOf("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat")[(dayOfWeek - 1).mod(7)] + private val months = listOf("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec") + override fun monthDay(month: Int, day: Int) = "${months[(month - 1).mod(12)]} $day" + override fun yearMonthDay(year: Int, month: Int, day: Int) = "${months[(month - 1).mod(12)]} $day, $year" + override val dateTimePattern = "MMM d, yyyy HH:mm" + override val monthDayPattern = "MMM d" + + override val localUnsynced = "On this device only · not synced" + override val downloadingNotes = "Downloading notes…" + override val syncing = "Syncing…" + override val offline = "Offline" + override fun offlinePending(n: Int) = "Offline · ${count(n, "change")} to sync" + override val syncError = "Sync error" + override fun pending(n: Int) = "${count(n, "change")} to sync" + override fun synced(ago: String) = "Synced · $ago" + override val neverSynced = "Not synced yet" + override fun blocked(n: Int) = "${count(n, "change")} refused by the server" + + override val libraries = "Libraries" + override val welcome = "Local-first Markdown notes that sync across your phone, computer and the web." + override val pickLibrary = "Pick a library to open" + override val connect = "Sign in to sync" + override val connectHint = "Sync across devices, on the official service or your own server" + override val newLocal = "New local library" + override val newLocalHint = "Stays on this device, no account, ready right away" + override val newLocalMessage = "Notes stay on this device and do not sync." + override val canConvert = "A local library can turn on sync at any time: create an account and its content is uploaded." + override val startCloud = "Get started · Sync everywhere" + override val startCloudHint = "Sign in or sign up; notes sync across your phone, computer and the web" + override val localOnly = "Use on this device only, without an account" + override val defaultLibraryName = "My notes" + override val renameLibrary = "Rename library" + override val removeLibrary = "Remove library" + override fun removeLocalMessage(name: String) = "All notes in “$name” will be deleted for good. This cannot be undone." + override fun removeServerMessage(name: String) = "The copy of “$name” on this device and its sign-in will be removed. Notes on the server are not affected, but changes not synced yet are lost." + override val turnOnSync = "Turn on sync" + override val migratedHint = "Moved to the cloud; remove it once you have checked" + override val cannotOpenData = "Could not open the local data" + override val backToLibraries = "Back to libraries" + + override val account = "Account" + override val username = "Username" + override val email = "Email" + override val role = "Role" + override val admin = "Admin" + override val user = "User" + override fun syncSection(library: String) = "Sync · $library" + override val server = "Server" + override val status = "Status" + override val thisDevice = "This device" + override val syncNow = "Sync now" + override val openAdmin = "Open admin console" + override val signingOut = "Signing out…" + override val signOut = "Sign out" + override val signOutHint = "Signing out deletes this library’s copy on this device; the data on the server is not affected and downloads again when you sign back in." + override val signOutTitle = "Sign out?" + override fun signOutUnsynced(n: Int) = "${count(n, "change")} not synced to the server yet will be lost." + override val signOutMessage = "This device’s sign-in token is revoked and the local data deleted." + + override fun uploadRefused(name: String, message: String) = "“$name” could not be uploaded: $message" + override val conflictTitle = "Conflict" + override fun conflictMessage(title: String) = "“$title” was changed in the same place on another device. The server kept that version; your edit was saved as a conflict copy." + override val openCopy = "Open copy" + override val newNote = "New note" + override val newFolder = "New notebook" + override val newSubfolder = "New sub-notebook" + override val renameFolder = "Rename notebook" + override val deleteFolderTitle = "Delete notebook?" + override fun deleteFolderMessage(name: String) = "The sub-notebooks of “$name” are deleted too; its notes go to the trash." + override val renameNote = "Rename note" + override val emptyTrashTitle = "Empty trash?" + override val emptyTrashMessage = "All notes in the trash will be deleted for good. This cannot be undone." + override val emptyTrash = "Empty trash" + override val switchLibrary = "Switch library" + override val accountAndSync = "Account and sync…" + override val turnOnSyncEllipsis = "Turn on sync…" + override val mediaLibrary = "Media library" + override val manageLibraries = "Manage libraries…" + override val searchNotes = "Search notes" + override val sortAndNew = "Sort and new" + override fun showMore(next: Int, hidden: Int) = "Show $next more ($hidden not shown)" + override val collapse = "Collapse" + override val expand = "Expand" + override val sort = "Sort" + override val sortUpdated = "Last updated" + override val sortCreated = "Date created" + override val sortTitle = "Title" + override val createFolderRow = "New notebook" + override val editTagEllipsis = "Edit tag…" + override val pin = "Pin" + override val unpin = "Unpin" + override val moveToEllipsis = "Move to…" + override val moveTo = "Move to" + override val duplicateNote = "Duplicate" + override val duplicateSuffix = " copy" + override val moveToTrash = "Move to trash" + override val noNotebook = "No notebook" + override fun noResults(query: String) = "Nothing found for “$query”" + + override val share = "Share" + override val outline = "Outline" + override val tagsEllipsis = "Tags…" + override val backlinks = "Backlinks" + override fun backlinksMenu(n: Int) = "Backlinks ($n)" + override fun backlinksCount(n: Int) = count(n, "backlink") + override val history = "History" + override val noteInTrash = "This note is in the trash" + override val formatPhoto = "Photo" + override val formatCamera = "Take photo" + override val formatAttachment = "Attachment" + override val formatHeading = "Heading" + override val formatBold = "Bold" + override val formatItalic = "Italic" + override val formatTask = "Task" + override val formatList = "List" + override val formatOrdered = "Numbered list" + override val formatQuote = "Quote" + override val formatCode = "Code" + override val formatWikiLink = "Wiki link" + override val formatLink = "Link" + override val formatStrike = "Strikethrough" + override val undo = "Undo" + override val hideKeyboard = "Hide keyboard" + override val noHeadings = "No headings yet" + override val noHeadingsHint = "Lines starting with # show up here." + override val noBacklinks = "No notes link here yet" + override fun noBacklinksHint(title: String) = "Type [[$title]] in another note to link to this one." + + override fun tagColor(color: String) = when (color) { + "green" -> "Green" + "blue" -> "Blue" + "amber" -> "Amber" + "pink" -> "Pink" + "purple" -> "Purple" + "gray" -> "Gray" + else -> "None" + } + override val searchOrCreateTag = "Search or create a tag" + override fun maxTags(n: Int) = "A note can have at most $n tags" + override fun createTag(name: String) = "Create “$name”" + override val editTag = "Edit tag" + override val noTags = "No tags yet. Type a name to create one." + override val tagExists = "A tag with this name exists" + override val color = "Color" + override val deleteTag = "Delete tag" + override val deleteTagTitle = "Delete tag?" + override fun deleteTagMessage(name: String) = "“#$name” is removed from all notes; the notes themselves are not affected." + + override val restoreVersion = "Restore this version" + override val localNoHistory = "Local libraries have no history" + override val localNoHistoryHint = "Saved versions are kept on the sync server." + override val historyLoadFailed = "Could not load the history" + override val noHistory = "No saved versions yet" + override val noHistoryHint = "Versions show up here after you edit and sync." + override val unknownDevice = "Unknown device" + override val currentVersion = "Current version" + override val restoreVersionTitle = "Restore this version?" + override val restoreVersionMessage = "The current text is replaced, but stays in the history." + override val restoredVersion = "Restored the saved version" + + override val offlineNoPublicLinks = "Offline: attachments were not replaced with public links" + override val shareNote = "Share note" + override val localNoShare = "Local libraries cannot make public links; you can copy or export the note." + override val shareNeedsNetwork = "Sharing needs a connection." + override val publicLink = "Public link" + override val publicLinkHint = "Anyone with the link and the password can read this note" + override val legacyShare = "This link was created before passwords were required. Set one to reopen it." + override val needPassword = "To protect your privacy, a public link needs a password of at least 6 characters." + override val newPasswordPlaceholder = "New password (6+ characters)" + override val generate = "Generate" + override val createLink = "Create link" + override val copyLink = "Copy link" + override val shareExpired = "This share has expired" + override val copyPassword = "Copy password" + override val passwordSet = "Password set" + override val changePassword = "Change password" + override val copyLinkAndPassword = "Copy link and password" + override val expires = "Expires" + override fun views(n: Int) = count(n, "view") + override val copyOrExport = "Copy or export" + override val copyAsHint = "Attachments are made public and replaced with their public links, ready to paste into a blog or newsletter." + override val copyAsOffline = "Offline, attachments are not replaced with public links." + override val copyMarkdown = "Copy Markdown" + override val sendToApp = "Send to another app" + override val exportMd = "Export .md file" + override val neverExpires = "Never" + override fun until(date: String) = "Until $date" + override fun days(n: Int) = count(n, "day") + override fun shareMessage(title: String, link: String, password: String) = "$title\nLink: $link\nPassword: $password" + override fun sharePasswordMin(n: Int) = "At least $n characters" + override fun sharePasswordMax(n: Int) = "At most $n bytes" + + override val fileTooLarge = "The file is larger than the server allows" + override fun queuedUpload(name: String) = "Offline: “$name” will upload once you are online" + override val duplicateMerged = "Duplicate file merged" + override fun cannotAddFile(error: String) = "Could not add the file: $error" + override val noCamera = "No camera app available" + override val noFilePicker = "No file picker available" + override val upload = "Upload" + override val photoOrVideo = "Photo or video" + override val camera = "Take photo" + override val file = "File" + override val searchFiles = "Search file names" + override val mediaOffline = "Offline: showing the file details synced to this device; changes need a connection." + override fun orphanBanner(n: Int, days: Int) = "${count(n, "file")} not used by any note will move to the trash in ${count(days, "day")}." + override fun orphanBannerNoDays(n: Int) = "${count(n, "file")} not used by any note." + override val mediaTrashEmpty = "The trash is empty" + override val mediaEmpty = "No files yet. Images and attachments added to notes show up here." + override val isPublic = "Public" + override fun refs(n: Int) = "In ${count(n, "note")}" + override val unreferenced = "Unused" + override val cannotGetFile = "Could not get the file; check your connection" + override val type = "Type" + override val size = "Size" + override val uploadedAt = "Uploaded" + override val publicUrl = "Public link" + override val publicPlaceholder = "Public (/r/…)" + override val trashedOrphan = "Unused, moved automatically" + override val trashedManual = "Moved" + override val noNotesReference = "No note uses it" + override fun referencedBy(n: Int) = "Used in ${count(n, "note")}" + override val copyReference = "Copy reference" + override val copyPublicUrl = "Copy public link" + override val makePublicUrl = "Make public link" + override val revokePublicUrl = "Revoke public link" + override val shareOriginal = "Share or save the original" + override val localFilesHint = "Files of a local library stay on this device." + override val publicFilesHint = "Public files are no longer protected by sign-in: anyone with the link can open them." + override val renameFile = "Rename file" + override val purgeFileTitle = "Delete file forever?" + override fun purgeFileMessage(name: String) = "“$name” will be deleted for good; notes using it will show it as missing. This cannot be undone." + override val filterAll = "All" + override val filterImages = "Images" + override val filterVideo = "Video" + override val filterAudio = "Audio" + override val filterFiles = "Files" + override val attachment = "attachment" + override val fileNotFound = "File not found" + override val nameEmpty = "The name cannot be empty" + override val localNoPublicLink = "Local libraries have no public links" + + override val wrongCredentials = "Wrong username or password" + override val signInTitle = "Sign in to Ivynote" + override val turnOnSyncTitle = "Turn on sync" + override val continueMigration = "Continue" + override val syncNode = "Sync service" + override val regionCn = "Mainland China" + override val regionGlobal = "Global" + override fun officialRegion(region: String) = "Ivynote · $region" + override val customServerEllipsis = "Custom server…" + override val nodeUnreachable = "This service cannot be reached right now" + override val signInHint = "Notes are saved on this device first and sync to all your devices when online." + override fun promoteHint(name: String) = "Create a new account: “$name” is uploaded to the cloud and syncs on all your devices." + override val register = "Sign up" + override val login = "Sign in" + override val firstAdmin = "This server has no accounts yet. The first account you create becomes its admin." + override val registrationClosed = "This server does not accept sign-ups." + override val registerAndSync = "Sign up and turn on sync" + override val promoteNote = "A local library can only move to a newly created account. With an existing account, sign in and import this library’s export in Settings → Import on the web or desktop app." + override fun migrationRejected(n: Int) = "${count(n, "item")} could not be moved; the local library still has everything." + override fun migrationFilesFailed(n: Int) = "${count(n, "file")} could not be uploaded; the local library still has the originals." + override fun migrationInterrupted(error: String) = "Moving stopped: $error. The account exists; tap Continue to resume where it stopped, without uploading anything twice." + override val preparing = "Preparing…" + override fun uploadingFiles(done: Int, total: Int) = "Uploading files $done/$total" + override fun uploadingNotes(done: Int, total: Int) = "Uploading notes $done/$total" + override val migrationDone = "Done, opening…" + override val customServer = "Custom server" + override val insecureWarning = "Over http, passwords and notes travel unencrypted. Use it only on a local network you trust." + override val customServerHint = "Connect to an Ivynote server you or your team run." + override val useServer = "Use this server" + override val cannotConnect = "Cannot reach the server" + override val httpWarning = "Connected over http: passwords and notes travel unencrypted." + override val createAccount = "Create account" + override val usernameOrEmail = "Username or email" + override val emailOptional = "Email (optional)" + override val displayNameOptional = "Display name (optional)" + override val password = "Password" + override val passwordMin8 = "Password (8+ characters)" + + // Updates + override fun aboutNewer(newer: String) = "About Ivynote · new version $newer" + override fun aboutVersion(version: String) = "About Ivynote · $version" + override val aboutAndUpdates = "About and updates…" + override val updateAvailable = "New version available" + override fun versionReleased(version: String) = "Ivynote $version is out" + override fun currentVersionIs(version: String) = "Current version $version" + override fun downloading(progress: String) = "Downloading… $progress" + override val savingAndInstalling = "Saving notes and opening the installer…" + override val updateReady = "The new version is downloaded and verified. Follow the system prompt to install; your notes are saved first." + override val debugUpdateHint = "Debug builds cannot update in place; download the release from the website." + override val webUpdateHint = "Download the new version from the website." + override val updateHint = "Once downloaded, the system installs it; your notes are saved first. The first update asks you to allow Ivynote to install apps." + override fun downloadFailed(error: String) = "Download failed: $error. Try again or download from the website." + override fun installFailed(error: String) = "Install failed: $error. Try again or download from the website." + override val downloadInBackground = "Download in background" + override val installing = "Installing…" + override val installNow = "Install now" + override val downloadFromWebsite = "Download from website" + override val updateNow = "Update now" + override val cancelDownload = "Cancel download" + override val websiteDownload = "Website" + override val skipVersion = "Skip this version" + override val later = "Later" + override val aboutTagline = "Local-first Markdown notes. Write offline; they sync once you are online." + override val version = "Version" + override val checkForUpdates = "Check for updates" + override val checking = "Checking…" + override fun downloadingVersion(version: String) = "Downloading $version…" + override fun newVersion(version: String) = "New version $version" + override val checkFailed = "Check failed" + override val upToDate = "Up to date" + override val anonymousStats = "Anonymous usage statistics" + override val anonymousStatsHint = "Update checks carry a random install id (not tied to your account) so we know how many devices use Ivynote. No note content or personal data is sent." + override val website = "Website ivynote.net" + override fun upToDateVersion(version: String) = "Up to date ($version)" + override fun checkUpdateFailed(error: String) = "Could not check for updates: $error" + override val allowInstall = "Allow Ivynote to install apps, then come back and tap Install now" + override val apkInvalid = "The downloaded package is no longer valid; download it again" + override val signatureMismatch = "The new version is signed differently from the installed app; download it from the website" + override val noStorage = "Not enough storage" + override val installBlocked = "The system blocked the install" + override val installIncomplete = "The install did not finish" + + override fun unreachable(detail: String) = "Cannot reach the server: $detail" + override val notIvynote = "This address is not an Ivynote server" + override val tooManyAttempts = "Too many attempts; try again in 15 minutes" + override fun serverUnavailable(status: Int) = "The server is unavailable right now ($status)" + override fun requestFailedStatus(status: Int) = "Request failed ($status)" + override val accountNotEmpty = "This account already has notes. A local library can only move to a new, empty account." + override val accountUnavailable = "This account is not available" + override val sessionExpired = "Your session has expired; please sign in again" + override val usernameRule = "Usernames have 2–32 letters, digits, _ . or -, starting with a letter or digit" + override val passwordTooShort = "The password needs at least 8 characters" + override val passwordTooLong = "The password can be at most 72 bytes" + override val serverEmpty = "Enter the server address" + override val serverInvalid = "The server address is not valid" + override fun unsupportedScheme(scheme: String) = "Unsupported protocol: $scheme" + override fun insecureRemote(host: String) = "$host is not on the local network; use https://" +} diff --git a/core/src/main/kotlin/app/ivynote/core/SyncEngine.kt b/core/src/main/kotlin/app/ivynote/core/SyncEngine.kt index d6e0281..ee01a93 100644 --- a/core/src/main/kotlin/app/ivynote/core/SyncEngine.kt +++ b/core/src/main/kotlin/app/ivynote/core/SyncEngine.kt @@ -551,7 +551,7 @@ class SyncEngine( /** A copy next to the original, titled ` 副本` (guide 3.2). */ fun duplicateNote(id: String): Note? { val n = _notes[id] ?: return null - val title = (n.title.ifBlank { "无标题" } + " 副本").take(300) + val title = (n.title.ifBlank { L10n.s.untitled } + L10n.s.duplicateSuffix).take(300) return createNote(title = title, body = n.body, folderId = n.folderId, tags = n.tags) } @@ -787,7 +787,7 @@ class SyncEngine( } catch (e: ApiError.Server) { if (!refused(e.code)) throw e // One bad file must not hold back everything else. - val msg = if (e.code == 413) "文件超过服务器的上传上限" else e.message ?: "rejected" + val msg = if (e.code == 413) L10n.s.fileTooLarge else e.message ?: "rejected" _uploads[up.id] = up.copy(failed = msg) _uploadFailure.value = UploadFailure(up.name, msg) updateCounts() diff --git a/core/src/main/kotlin/app/ivynote/core/SyncRegion.kt b/core/src/main/kotlin/app/ivynote/core/SyncRegion.kt index c2de1ef..c83572a 100644 --- a/core/src/main/kotlin/app/ivynote/core/SyncRegion.kt +++ b/core/src/main/kotlin/app/ivynote/core/SyncRegion.kt @@ -9,9 +9,11 @@ package app.ivynote.core * address without a client release ([OfficialRegions]). [server] is the * address in effect now. */ -enum class SyncRegion(val id: String, val title: String, address: String) { - CN("cn", "中国大陆", "https://web.ivynote.net"), - GLOBAL("global", "全球", "https://web.ivynote.app"); +enum class SyncRegion(val id: String, address: String) { + CN("cn", "https://web.ivynote.net"), + GLOBAL("global", "https://web.ivynote.app"); + + val title: String get() = if (this == CN) L10n.s.regionCn else L10n.s.regionGlobal /** Built into the client; used whenever the website has said nothing else. */ val defaultServer: ServerAddress = ServerAddress.parse(address) diff --git a/core/src/test/kotlin/app/ivynote/core/ApiClientTest.kt b/core/src/test/kotlin/app/ivynote/core/ApiClientTest.kt index 67f9458..eda0384 100644 --- a/core/src/test/kotlin/app/ivynote/core/ApiClientTest.kt +++ b/core/src/test/kotlin/app/ivynote/core/ApiClientTest.kt @@ -49,6 +49,21 @@ class ApiClientTest { assertEquals("application/json", req.headers["Content-Type"]) } + @Test fun registerSendsTheInterfaceLanguage() = runTest { + val stub = StubTransport(mutableMapOf("POST /api/v1/auth/register" to (200 to """{"token":"tok","user":$USER_JSON}"""))) + ApiClient(server, transport = stub).register("ivy", "secret123", language = "en") + val req = stub.sent.single() + assertEquals("""{"username":"ivy","password":"secret123","language":"en"}""", req.body!!.decodeToString()) + assertEquals(L10n.language.tag, req.headers["Accept-Language"]) + } + + @Test fun setLanguagePatchesMe() = runTest { + val user = USER_JSON.replace("\"features\":{}", "\"features\":{},\"language\":\"en\"") + val stub = StubTransport(mutableMapOf("PATCH /api/v1/me" to (200 to user))) + assertEquals("en", ApiClient(server, "tok", stub).setLanguage("en").language) + assertEquals("""{"language":"en"}""", stub.sent.single().body!!.decodeToString()) + } + @Test fun errorsCarryTheServerMessage() = runTest { val stub = StubTransport(mutableMapOf("GET /api/v1/me" to (401 to """{"error":"unauthorized","status":401}"""))) val e = assertFailsWith<ApiError.Server> { ApiClient(server, "bad", stub).me() } diff --git a/core/src/test/kotlin/app/ivynote/core/LanguageTest.kt b/core/src/test/kotlin/app/ivynote/core/LanguageTest.kt new file mode 100644 index 0000000..9259be1 --- /dev/null +++ b/core/src/test/kotlin/app/ivynote/core/LanguageTest.kt @@ -0,0 +1,117 @@ +package app.ivynote.core + +import kotlin.test.AfterTest +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNull + +class LanguageTest { + private val prefs = MemoryKeyValueStore() + private val alice = "https://web.ivynote.app|u1" + private val bob = "https://web.ivynote.app|u2" + + @AfterTest + fun reset() { + L10n.language = Language.ZH + } + + @Test + fun systemTags() { + assertEquals(Language.ZH, Language.fromTag("zh-Hans-CN")) + assertEquals(Language.ZH, Language.fromTag("zh_TW")) + assertEquals(Language.EN, Language.fromTag("en-GB")) + assertNull(Language.fromTag("ja-JP")) + assertNull(Language.fromTag("")) + // The first supported language in the list wins; none falls back to English. + assertEquals(Language.ZH, Language.fromSystem(listOf("ja-JP", "zh-CN", "en-US"))) + assertEquals(Language.EN, Language.fromSystem(listOf("en-US", "zh-CN"))) + assertEquals(Language.EN, Language.fromSystem(listOf("fr-FR"))) + assertEquals(Language.EN, Language.fromSystem(emptyList())) + } + + @Test + fun followsTheSystemUntilChosen() { + val s = LanguageSettings(prefs, listOf("en-US")) + assertEquals(Language.EN, s.current.value) + assertEquals(Language.EN, L10n.language) + assertEquals(LanguageChoice.System, s.choice) + s.systemChanged(listOf("zh-CN")) + assertEquals(Language.ZH, s.current.value) + } + + @Test + fun aManualChoiceIsRemembered() { + LanguageSettings(prefs, listOf("en-US")).choose(LanguageChoice.Fixed(Language.ZH)) + val again = LanguageSettings(prefs, listOf("en-US")) + assertEquals(Language.ZH, again.current.value) + assertEquals(LanguageChoice.Fixed(Language.ZH), again.choice) + // Back to following the system. + again.choose(LanguageChoice.System) + assertEquals(Language.EN, LanguageSettings(prefs, listOf("en-US")).current.value) + } + + @Test + fun theAccountsLanguageComesFirst() { + val s = LanguageSettings(prefs, listOf("zh-CN")) + s.choose(LanguageChoice.Fixed(Language.ZH)) + s.accountOpened(alice, serverLanguage = "en") + assertEquals(Language.EN, s.current.value) + assertEquals(LanguageChoice.Fixed(Language.EN), s.choice) + s.accountClosed(alice) + assertEquals(Language.ZH, s.current.value) + // No language on the account (""): this device's choice. + s.accountOpened(bob, serverLanguage = "") + assertEquals(Language.ZH, s.current.value) + // A tag this app does not speak counts as none. + s.accountClosed(bob) + s.accountOpened(bob, serverLanguage = "fr") + assertEquals(Language.ZH, s.current.value) + } + + @Test + fun choosingWhileSignedInSetsTheAccountToo() { + val sent = mutableListOf<String>() + val s = LanguageSettings(prefs, listOf("zh-CN")) + s.onAccountChoice = { key, tag -> sent += "$key=$tag" } + s.accountOpened(alice, serverLanguage = "") + s.choose(LanguageChoice.Fixed(Language.EN)) + assertEquals(listOf("$alice=en"), sent) + assertEquals(Language.EN, s.current.value) + // Not sent yet (offline): it wins over the server's older value. + assertEquals("en", s.pendingTag(alice)) + s.accountOpened(alice, serverLanguage = "zh") + assertEquals(Language.EN, s.current.value) + s.pushed(alice, "en") + assertNull(s.pendingTag(alice)) + // Following the system clears the account's language. + s.choose(LanguageChoice.System) + assertEquals("$alice=", sent.last()) + assertEquals(Language.ZH, s.current.value) + s.accountClosed(alice) + assertEquals(LanguageChoice.System, s.deviceChoice) + } + + @Test + fun aPushedChangeDoesNotClearANewerOne() { + val s = LanguageSettings(prefs, listOf("zh-CN")) + s.accountOpened(alice, serverLanguage = "") + s.choose(LanguageChoice.Fixed(Language.EN)) + s.choose(LanguageChoice.Fixed(Language.ZH)) + s.pushed(alice, "en") + assertEquals("zh", s.pendingTag(alice)) + } + + @Test + fun coreMessagesFollowTheLanguage() { + val s = LanguageSettings(prefs, listOf("en-US")) + assertEquals("Wrong username or password", L10n.s.wrongCredentials) + assertEquals("Global", SyncRegion.GLOBAL.title) + assertEquals("Enter the server address", ServerAddress.ParseError.Empty.message) + assertEquals("Request failed (418)", ApiError.Server(418, "").message) + s.choose(LanguageChoice.Fixed(Language.ZH)) + assertEquals("全球", SyncRegion.GLOBAL.title) + assertEquals("请填写服务器地址", ServerAddress.ParseError.Empty.message) + assertEquals("1 change to sync", EnStrings.pending(1)) + assertEquals("2 changes to sync", EnStrings.pending(2)) + } +} diff --git a/editor-web/main.ts b/editor-web/main.ts index 41efafd..c67b074 100644 --- a/editor-web/main.ts +++ b/editor-web/main.ts @@ -3,7 +3,7 @@ // Kept in step with the Apple client's EditorWeb/main.ts. // // Kotlin → JS: window.ivy.load / setBody / setTitles / setKinds / setTheme / -// setReadonly / focus / command / scrollToLine / insert +// setLanguage / setReadonly / focus / command / scrollToLine / insert // JS → Kotlin: IvyAndroid.postMessage(JSON.stringify({ type, ... })) // ready the page can take a document // change {id, body} the user edited the note @@ -61,6 +61,17 @@ let kinds: Record<string, string> = {}; let lastEmitted = ''; let view: EditorView | null = null; const roConf = new Compartment(); +const placeholderConf = new Compartment(); + +// --- the interface language (setLanguage): the placeholder, and the words +// formatting wraps around an empty selection --- + +const words = { + zh: { placeholder: '开始写作…', bold: '加粗', italic: '斜体', strike: '删除线' }, + en: { placeholder: 'Start writing…', bold: 'bold', italic: 'italic', strike: 'strikethrough' } +}; +let lang: keyof typeof words = 'zh'; +const w = () => words[lang]; /** Same-origin path the native scheme handler answers with the attachment. */ function resource(id: string, thumb?: boolean): string { @@ -95,13 +106,13 @@ function extensions(readonly: boolean) { markdownHighlight, baseTheme, EditorView.lineWrapping, - placeholder('开始写作…'), + placeholderConf.of(placeholder(w().placeholder)), autocompletion({ override: [wikiCompletion(completions)], icons: false, activateOnTyping: true }), keymap.of([ - { key: 'Mod-b', run: (v) => toggleWrap(v, '**', '加粗') }, - { key: 'Mod-i', run: (v) => toggleWrap(v, '*', '斜体') }, + { key: 'Mod-b', run: (v) => toggleWrap(v, '**', w().bold) }, + { key: 'Mod-i', run: (v) => toggleWrap(v, '*', w().italic) }, { key: 'Mod-e', run: (v) => toggleWrap(v, '`', 'code') }, - { key: 'Mod-Shift-x', run: (v) => toggleWrap(v, '~~', '删除线') }, + { key: 'Mod-Shift-x', run: (v) => toggleWrap(v, '~~', w().strike) }, { key: 'Mod-k', run: insertLink }, { key: 'Mod-Shift-k', run: insertWiki }, { key: 'Mod-Alt-1', run: (v) => toggleLinePrefix(v, '# ') }, @@ -215,6 +226,13 @@ window.ivy = { insertText(view, text, block); }, + /** `zh` or `en`, as the app's interface. */ + setLanguage(l: string) { + lang = l === 'en' ? 'en' : 'zh'; + document.documentElement.lang = lang === 'zh' ? 'zh-CN' : 'en'; + view?.dispatch({ effects: placeholderConf.reconfigure(placeholder(w().placeholder)) }); + }, + setTheme(dark: boolean) { document.documentElement.dataset.theme = dark ? 'dark' : 'light'; }, @@ -241,9 +259,9 @@ window.ivy = { command(name: string) { if (!view) return; switch (name) { - case 'bold': toggleWrap(view, '**', '加粗'); break; - case 'italic': toggleWrap(view, '*', '斜体'); break; - case 'strike': toggleWrap(view, '~~', '删除线'); break; + case 'bold': toggleWrap(view, '**', w().bold); break; + case 'italic': toggleWrap(view, '*', w().italic); break; + case 'strike': toggleWrap(view, '~~', w().strike); break; case 'code': toggleWrap(view, '`', 'code'); break; case 'h1': toggleLinePrefix(view, '# '); break; case 'h2': toggleLinePrefix(view, '## '); break;