texlite 0.7.2 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/README.md +1 -6
  2. package/README.zh-CN.md +1 -6
  3. package/dist/client/assets/{BinaryModule-Aj1vLnwf-wAe5fMVe.js → BinaryModule-Aj1vLnwf-CKY6Y_Pt.js} +1 -1
  4. package/dist/client/assets/{GitDialog-b7cWzpdJ.js → GitDialog-pn8n5Afm.js} +1 -1
  5. package/dist/client/assets/{HistoryDialog-F8tDuD3v.js → HistoryDialog-BpWEZrYf.js} +1 -1
  6. package/dist/client/assets/{LatexEditor-BT2E5IIK.js → LatexEditor-DNAmNvHu.js} +1 -1
  7. package/dist/client/assets/{PdfPreview-C2tw6xhu.js → PdfPreview-BVaG7TtG.js} +1 -1
  8. package/dist/client/assets/{ProjectNavigationDialogs-CzrF5eh5.js → ProjectNavigationDialogs-CaovMu4V.js} +1 -1
  9. package/dist/client/assets/{SystemMetricsDialog-OAoXCVVy.js → SystemMetricsDialog-D8jj7epG.js} +1 -1
  10. package/dist/client/assets/binary-BoldOm0z.js +1 -0
  11. package/dist/client/assets/index-BQCB3z5H.js +64 -0
  12. package/dist/client/assets/index-BnvpaWsa.css +1 -0
  13. package/dist/client/assets/{index-JmuE6_j5.js → index-Byn2Miy9.js} +1 -1
  14. package/dist/client/assets/{minus-D0DZYQR6.js → minus-K-5IK4nL.js} +1 -1
  15. package/dist/client/assets/pdf-BB1XvBIF.js +55 -0
  16. package/dist/client/assets/{spellCheck-TTrb0uqA.js → spellCheck-C32VQVUE.js} +3 -3
  17. package/dist/client/assets/texFmtRuntime-EYyQNUnJ.js +2 -0
  18. package/dist/client/assets/tex_fmt_bg-VEAUIuFz.wasm +0 -0
  19. package/dist/client/index.html +2 -2
  20. package/dist/server/app.js +0 -40
  21. package/package.json +3 -1
  22. package/dist/client/assets/binary-CWru8eff.js +0 -1
  23. package/dist/client/assets/index-BLOqf18q.js +0 -62
  24. package/dist/client/assets/index-CwGialPz.css +0 -1
  25. package/dist/client/assets/pdf-DPnwNQHb.js +0 -55
  26. package/dist/server/latexFormatter.js +0 -118
@@ -0,0 +1,64 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-rBWMBTI-.js","assets/react-CsO_xvbl.js","assets/spellCheck-C32VQVUE.js","assets/PdfPreview-BVaG7TtG.js","assets/pdf-BB1XvBIF.js","assets/minus-K-5IK4nL.js","assets/LatexEditor-DNAmNvHu.js","assets/editor-DMLs-XWi.js","assets/GitDialog-pn8n5Afm.js","assets/HistoryDialog-BpWEZrYf.js","assets/ProjectNavigationDialogs-CaovMu4V.js","assets/SystemMetricsDialog-D8jj7epG.js"])))=>i.map(i=>d[i]);
2
+ import{i as vf,r as h,j as i,R as Cr,a as Yc,b as kf,u as at,P as Sf,c as zr,d as Qi,e as jf}from"./react-CsO_xvbl.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();const Bf="modulepreload",Tf=function(t){return"/"+t},vu={},dn=function(e,n,r){let s=Promise.resolve();if(n&&n.length>0){let c=function(l){return Promise.all(l.map(f=>Promise.resolve(f).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),u=a?.nonce||a?.getAttribute("nonce");s=c(n.map(l=>{if(l=Tf(l),l in vu)return;vu[l]=!0;const f=l.endsWith(".css"),d=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${d}`))return;const p=document.createElement("link");if(p.rel=f?"stylesheet":Bf,f||(p.as="script"),p.crossOrigin="",p.href=l,u&&p.setAttribute("nonce",u),document.head.appendChild(p),f)return new Promise((D,g)=>{p.addEventListener("load",D),p.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${l}`)))})}))}function o(a){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=a,window.dispatchEvent(u),!u.defaultPrevented)throw a}return s.then(a=>{for(const u of a||[])u.status==="rejected"&&o(u.reason);return e().catch(o)})},Nf="0.7.5";var eo={};const me=t=>typeof t=="string",er=()=>{let t,e;const n=new Promise((r,s)=>{t=r,e=s});return n.resolve=t,n.reject=e,n},ku=t=>t==null?"":""+t,Lf=(t,e,n)=>{t.forEach(r=>{e[r]&&(n[r]=e[r])})},Of=/###/g,Su=t=>t&&t.indexOf("###")>-1?t.replace(Of,"."):t,ju=t=>!t||me(t),sr=(t,e,n)=>{const r=me(e)?e.split("."):e;let s=0;for(;s<r.length-1;){if(ju(t))return{};const o=Su(r[s]);!t[o]&&n&&(t[o]=new n),Object.prototype.hasOwnProperty.call(t,o)?t=t[o]:t={},++s}return ju(t)?{}:{obj:t,k:Su(r[s])}},Bu=(t,e,n)=>{const{obj:r,k:s}=sr(t,e,Object);if(r!==void 0||e.length===1){r[s]=n;return}let o=e[e.length-1],a=e.slice(0,e.length-1),u=sr(t,a,Object);for(;u.obj===void 0&&a.length;)o=`${a[a.length-1]}.${o}`,a=a.slice(0,a.length-1),u=sr(t,a,Object),u?.obj&&typeof u.obj[`${u.k}.${o}`]<"u"&&(u.obj=void 0);u.obj[`${u.k}.${o}`]=n},Rf=(t,e,n,r)=>{const{obj:s,k:o}=sr(t,e,Object);s[o]=s[o]||[],s[o].push(n)},ii=(t,e)=>{const{obj:n,k:r}=sr(t,e);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},Pf=(t,e,n)=>{const r=ii(t,n);return r!==void 0?r:ii(e,n)},Wc=(t,e,n)=>{for(const r in e)r!=="__proto__"&&r!=="constructor"&&(r in t?me(t[r])||t[r]instanceof String||me(e[r])||e[r]instanceof String?n&&(t[r]=e[r]):Wc(t[r],e[r],n):t[r]=e[r]);return t},qn=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var _f={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const If=t=>me(t)?t.replace(/[&<>"'\/]/g,e=>_f[e]):t;class Mf{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const n=this.regExpMap.get(e);if(n!==void 0)return n;const r=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,r),this.regExpQueue.push(e),r}}const $f=[" ",",","?","!",";"],Uf=new Mf(20),zf=(t,e,n)=>{e=e||"",n=n||"";const r=$f.filter(a=>e.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const s=Uf.getRegExp(`(${r.map(a=>a==="?"?"\\?":a).join("|")})`);let o=!s.test(t);if(!o){const a=t.indexOf(n);a>0&&!s.test(t.substring(0,a))&&(o=!0)}return o},Bo=(t,e,n=".")=>{if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;const r=e.split(n);let s=t;for(let o=0;o<r.length;){if(!s||typeof s!="object")return;let a,u="";for(let c=o;c<r.length;++c)if(c!==o&&(u+=n),u+=r[c],a=s[u],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&c<r.length-1)continue;o+=c-o+1;break}s=a}return s},ar=t=>t?.replace(/_/g,"-"),Vf={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){console?.[t]?.apply?.(console,e)}};class oi{constructor(e,n={}){this.init(e,n)}init(e,n={}){this.prefix=n.prefix||"i18next:",this.logger=e||Vf,this.options=n,this.debug=n.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,n,r,s){return s&&!this.debug?null:(me(e[0])&&(e[0]=`${r}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new oi(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new oi(this.logger,e)}}var un=new oi;class Ai{constructor(){this.observers={}}on(e,n){return e.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const s=this.observers[r].get(n)||0;this.observers[r].set(n,s+1)}),this}off(e,n){if(this.observers[e]){if(!n){delete this.observers[e];return}this.observers[e].delete(n)}}emit(e,...n){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([s,o])=>{for(let a=0;a<o;a++)s(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([s,o])=>{for(let a=0;a<o;a++)s.apply(s,[e,...n])})}}class Tu extends Ai{constructor(e,n={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const n=this.options.ns.indexOf(e);n>-1&&this.options.ns.splice(n,1)}getResource(e,n,r,s={}){const o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,a=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let u;e.indexOf(".")>-1?u=e.split("."):(u=[e,n],r&&(Array.isArray(r)?u.push(...r):me(r)&&o?u.push(...r.split(o)):u.push(r)));const c=ii(this.data,u);return!c&&!n&&!r&&e.indexOf(".")>-1&&(e=u[0],n=u[1],r=u.slice(2).join(".")),c||!a||!me(r)?c:Bo(this.data?.[e]?.[n],r,o)}addResource(e,n,r,s,o={silent:!1}){const a=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let u=[e,n];r&&(u=u.concat(a?r.split(a):r)),e.indexOf(".")>-1&&(u=e.split("."),s=n,n=u[1]),this.addNamespaces(n),Bu(this.data,u,s),o.silent||this.emit("added",e,n,r,s)}addResources(e,n,r,s={silent:!1}){for(const o in r)(me(r[o])||Array.isArray(r[o]))&&this.addResource(e,n,o,r[o],{silent:!0});s.silent||this.emit("added",e,n,r)}addResourceBundle(e,n,r,s,o,a={silent:!1,skipCopy:!1}){let u=[e,n];e.indexOf(".")>-1&&(u=e.split("."),s=r,r=n,n=u[1]),this.addNamespaces(n);let c=ii(this.data,u)||{};a.skipCopy||(r=JSON.parse(JSON.stringify(r))),s?Wc(c,r,o):c={...c,...r},Bu(this.data,u,c),a.silent||this.emit("added",e,n,r)}removeResourceBundle(e,n){this.hasResourceBundle(e,n)&&delete this.data[e][n],this.removeNamespaces(n),this.emit("removed",e,n)}hasResourceBundle(e,n){return this.getResource(e,n)!==void 0}getResourceBundle(e,n){return n||(n=this.options.defaultNS),this.getResource(e,n)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const n=this.getDataByLanguage(e);return!!(n&&Object.keys(n)||[]).find(s=>n[s]&&Object.keys(n[s]).length>0)}toJSON(){return this.data}}var Xc={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,r,s){return t.forEach(o=>{e=this.processors[o]?.process(e,n,r,s)??e}),e}};const Jc=Symbol("i18next/PATH_KEY");function Hf(){const t=[],e=Object.create(null);let n;return e.get=(r,s)=>(n?.revoke?.(),s===Jc?t:(t.push(s),n=Proxy.revocable(r,e),n.proxy)),Proxy.revocable(Object.create(null),e).proxy}function ws(t,e){const{[Jc]:n}=t(Hf()),r=e?.keySeparator??".",s=e?.nsSeparator??":";if(n.length>1&&s){const o=e?.ns,a=Array.isArray(o)?o:null;if(a&&a.length>1&&a.slice(1).includes(n[0]))return`${n[0]}${s}${n.slice(1).join(r)}`}return n.join(r)}const Nu={},to=t=>!me(t)&&typeof t!="boolean"&&typeof t!="number";class ai extends Ai{constructor(e,n={}){super(),Lf(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=un.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,n={interpolation:{}}){const r={...n};if(e==null)return!1;const s=this.resolve(e,r);if(s?.res===void 0)return!1;const o=to(s.res);return!(r.returnObjects===!1&&o)}extractFromKey(e,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const a=r&&e.indexOf(r)>-1,u=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!zf(e,r,s);if(a&&!u){const c=e.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:e,namespaces:me(o)?[o]:o};const l=e.split(r);(r!==s||r===s&&this.options.ns.indexOf(l[0])>-1)&&(o=l.shift()),e=l.join(s)}return{key:e,namespaces:me(o)?[o]:o}}translate(e,n,r){let s=typeof n=="object"?{...n}:n;if(typeof s!="object"&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),typeof s=="object"&&(s={...s}),s||(s={}),e==null)return"";typeof e=="function"&&(e=ws(e,{...this.options,...s})),Array.isArray(e)||(e=[String(e)]),e=e.map(H=>typeof H=="function"?ws(H,{...this.options,...s}):String(H));const o=s.returnDetails!==void 0?s.returnDetails:this.options.returnDetails,a=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,{key:u,namespaces:c}=this.extractFromKey(e[e.length-1],s),l=c[c.length-1];let f=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;f===void 0&&(f=":");const d=s.lng||this.language,p=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()==="cimode")return p?o?{res:`${l}${f}${u}`,usedKey:u,exactUsedKey:u,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(s)}:`${l}${f}${u}`:o?{res:u,usedKey:u,exactUsedKey:u,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(s)}:u;const D=this.resolve(e,s);let g=D?.res;const y=D?.usedKey||u,x=D?.exactUsedKey||u,A=["[object Number]","[object Function]","[object RegExp]"],L=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,R=!this.i18nFormat||this.i18nFormat.handleAsObject,I=s.count!==void 0&&!me(s.count),M=ai.hasDefaultValue(s),X=I?this.pluralResolver.getSuffix(d,s.count,s):"",O=s.ordinal&&I?this.pluralResolver.getSuffix(d,s.count,{ordinal:!1}):"",re=I&&!s.ordinal&&s.count===0,v=re&&s[`defaultValue${this.options.pluralSeparator}zero`]||s[`defaultValue${X}`]||s[`defaultValue${O}`]||s.defaultValue;let Z=g;R&&!g&&M&&(Z=v);const le=to(Z),U=Object.prototype.toString.apply(Z);if(R&&Z&&le&&A.indexOf(U)<0&&!(me(L)&&Array.isArray(Z))){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const H=this.options.returnedObjectHandler?this.options.returnedObjectHandler(y,Z,{...s,ns:c}):`key '${u} (${this.language})' returned an object instead of string.`;return o?(D.res=H,D.usedParams=this.getUsedParamsDetails(s),D):H}if(a){const H=Array.isArray(Z),P=H?[]:{},S=H?x:y;for(const ie in Z)if(Object.prototype.hasOwnProperty.call(Z,ie)){const je=`${S}${a}${ie}`;M&&!g?P[ie]=this.translate(je,{...s,defaultValue:to(v)?v[ie]:void 0,joinArrays:!1,ns:c}):P[ie]=this.translate(je,{...s,joinArrays:!1,ns:c}),P[ie]===je&&(P[ie]=Z[ie])}g=P}}else if(R&&me(L)&&Array.isArray(g))g=g.join(L),g&&(g=this.extendTranslation(g,e,s,r));else{let H=!1,P=!1;!this.isValidLookup(g)&&M&&(H=!0,g=v),this.isValidLookup(g)||(P=!0,g=u);const ie=(s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&P?void 0:g,je=M&&v!==g&&this.options.updateMissing;if(P||H||je){if(this.logger.log(je?"updateKey":"missingKey",d,l,u,je?v:g),a){const be=this.resolve(u,{...s,keySeparator:!1});be&&be.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let Be=[];const Me=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Me&&Me[0])for(let be=0;be<Me.length;be++)Be.push(Me[be]);else this.options.saveMissingTo==="all"?Be=this.languageUtils.toResolveHierarchy(s.lng||this.language):Be.push(s.lng||this.language);const Ne=(be,K,Pe)=>{const se=M&&Pe!==g?Pe:ie;this.options.missingKeyHandler?this.options.missingKeyHandler(be,l,K,se,je,s):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(be,l,K,se,je,s),this.emit("missingKey",be,l,K,g)};this.options.saveMissing&&(this.options.saveMissingPlurals&&I?Be.forEach(be=>{const K=this.pluralResolver.getSuffixes(be,s);re&&s[`defaultValue${this.options.pluralSeparator}zero`]&&K.indexOf(`${this.options.pluralSeparator}zero`)<0&&K.push(`${this.options.pluralSeparator}zero`),K.forEach(Pe=>{Ne([be],u+Pe,s[`defaultValue${Pe}`]||v)})}):Ne(Be,u,v))}g=this.extendTranslation(g,e,s,D,r),P&&g===u&&this.options.appendNamespaceToMissingKey&&(g=`${l}${f}${u}`),(P||H)&&this.options.parseMissingKeyHandler&&(g=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${f}${u}`:u,H?g:void 0,s))}return o?(D.res=g,D.usedParams=this.getUsedParamsDetails(s),D):g}extendTranslation(e,n,r,s,o){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const c=me(e)&&(r?.interpolation?.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let l;if(c){const d=e.match(this.interpolator.nestingRegexp);l=d&&d.length}let f=r.replace&&!me(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(f={...this.options.interpolation.defaultVariables,...f}),e=this.interpolator.interpolate(e,f,r.lng||this.language||s.usedLng,r),c){const d=e.match(this.interpolator.nestingRegexp),p=d&&d.length;l<p&&(r.nest=!1)}!r.lng&&s&&s.res&&(r.lng=this.language||s.usedLng),r.nest!==!1&&(e=this.interpolator.nest(e,(...d)=>o?.[0]===d[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${d[0]} in key: ${n[0]}`),null):this.translate(...d,n),r)),r.interpolation&&this.interpolator.reset()}const a=r.postProcess||this.options.postProcess,u=me(a)?[a]:a;return e!=null&&u?.length&&r.applyPostProcessor!==!1&&(e=Xc.handle(u,e,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),e}resolve(e,n={}){let r,s,o,a,u;return me(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(c=>typeof c=="function"?ws(c,{...this.options,...n}):c)),e.forEach(c=>{if(this.isValidLookup(r))return;const l=this.extractFromKey(c,n),f=l.key;s=f;let d=l.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const p=n.count!==void 0&&!me(n.count),D=p&&!n.ordinal&&n.count===0,g=n.context!==void 0&&(me(n.context)||typeof n.context=="number")&&n.context!=="",y=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);d.forEach(x=>{this.isValidLookup(r)||(u=x,!Nu[`${y[0]}-${x}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(u)&&(Nu[`${y[0]}-${x}`]=!0,this.logger.warn(`key "${s}" for languages "${y.join(", ")}" won't get resolved as namespace "${u}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),y.forEach(A=>{if(this.isValidLookup(r))return;a=A;const L=[f];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(L,f,A,x,n);else{let I;p&&(I=this.pluralResolver.getSuffix(A,n.count,n));const M=`${this.options.pluralSeparator}zero`,X=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(p&&(n.ordinal&&I.indexOf(X)===0&&L.push(f+I.replace(X,this.options.pluralSeparator)),L.push(f+I),D&&L.push(f+M)),g){const O=`${f}${this.options.contextSeparator||"_"}${n.context}`;L.push(O),p&&(n.ordinal&&I.indexOf(X)===0&&L.push(O+I.replace(X,this.options.pluralSeparator)),L.push(O+I),D&&L.push(O+M))}}let R;for(;R=L.pop();)this.isValidLookup(r)||(o=R,r=this.getResource(A,x,R,n))}))})}),{res:r,usedKey:s,exactUsedKey:o,usedLng:a,usedNS:u}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,r,s={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,n,r,s):this.resourceStore.getResource(e,n,r,s)}getUsedParamsDetails(e={}){const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=e.replace&&!me(e.replace);let s=r?e.replace:e;if(r&&typeof e.count<"u"&&(s.count=e.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!r){s={...s};for(const o of n)delete s[o]}return s}static hasDefaultValue(e){const n="defaultValue";for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&n===r.substring(0,n.length)&&e[r]!==void 0)return!0;return!1}}class Lu{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=un.create("languageUtils")}getScriptPartFromCode(e){if(e=ar(e),!e||e.indexOf("-")<0)return null;const n=e.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(e){if(e=ar(e),!e||e.indexOf("-")<0)return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(me(e)&&e.indexOf("-")>-1){let n;try{n=Intl.getCanonicalLocales(e)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let n;return e.forEach(r=>{if(n)return;const s=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(s))&&(n=s)}),!n&&this.options.supportedLngs&&e.forEach(r=>{if(n)return;const s=this.getScriptPartFromCode(r);if(this.isSupportedCode(s))return n=s;const o=this.getLanguagePartFromCode(r);if(this.isSupportedCode(o))return n=o;n=this.options.supportedLngs.find(a=>{if(a===o)return a;if(!(a.indexOf("-")<0&&o.indexOf("-")<0)&&(a.indexOf("-")>0&&o.indexOf("-")<0&&a.substring(0,a.indexOf("-"))===o||a.indexOf(o)===0&&o.length>1))return a})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),me(e)&&(e=[e]),Array.isArray(e))return e;if(!n)return e.default||[];let r=e[n];return r||(r=e[this.getScriptPartFromCode(n)]),r||(r=e[this.formatLanguageCode(n)]),r||(r=e[this.getLanguagePartFromCode(n)]),r||(r=e.default),r||[]}toResolveHierarchy(e,n){const r=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],e),s=[],o=a=>{a&&(this.isSupportedCode(a)?s.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return me(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(e))):me(e)&&o(this.formatLanguageCode(e)),r.forEach(a=>{s.indexOf(a)<0&&o(this.formatLanguageCode(a))}),s}}const Ou={zero:0,one:1,two:2,few:3,many:4,other:5},Ru={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class qf{constructor(e,n={}){this.languageUtils=e,this.options=n,this.logger=un.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,n={}){const r=ar(e==="dev"?"en":e),s=n.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:r,type:s});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let a;try{a=new Intl.PluralRules(r,{type:s})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),Ru;if(!e.match(/-|_/))return Ru;const c=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(c,n)}return this.pluralRulesCache[o]=a,a}needsPlural(e,n={}){let r=this.getRule(e,n);return r||(r=this.getRule("dev",n)),r?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,n,r={}){return this.getSuffixes(e,r).map(s=>`${n}${s}`)}getSuffixes(e,n={}){let r=this.getRule(e,n);return r||(r=this.getRule("dev",n)),r?r.resolvedOptions().pluralCategories.sort((s,o)=>Ou[s]-Ou[o]).map(s=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${s}`):[]}getSuffix(e,n,r={}){const s=this.getRule(e,r);return s?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${s.select(n)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",n,r))}}const Pu=(t,e,n,r=".",s=!0)=>{let o=Pf(t,e,n);return!o&&s&&me(n)&&(o=Bo(t,n,r),o===void 0&&(o=Bo(e,n,r))),o},no=t=>t.replace(/\$/g,"$$$$");class _u{constructor(e={}){this.logger=un.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(n=>n),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:s,prefix:o,prefixEscaped:a,suffix:u,suffixEscaped:c,formatSeparator:l,unescapeSuffix:f,unescapePrefix:d,nestingPrefix:p,nestingPrefixEscaped:D,nestingSuffix:g,nestingSuffixEscaped:y,nestingOptionsSeparator:x,maxReplaces:A,alwaysFormat:L}=e.interpolation;this.escape=n!==void 0?n:If,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=o?qn(o):a||"{{",this.suffix=u?qn(u):c||"}}",this.formatSeparator=l||",",this.unescapePrefix=f?"":d||"-",this.unescapeSuffix=this.unescapePrefix?"":f||"",this.nestingPrefix=p?qn(p):D||qn("$t("),this.nestingSuffix=g?qn(g):y||qn(")"),this.nestingOptionsSeparator=x||",",this.maxReplaces=A||1e3,this.alwaysFormat=L!==void 0?L:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(n,r)=>n?.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,n,r,s){let o,a,u;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=D=>{if(D.indexOf(this.formatSeparator)<0){const A=Pu(n,c,D,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(A,void 0,r,{...s,...n,interpolationkey:D}):A}const g=D.split(this.formatSeparator),y=g.shift().trim(),x=g.join(this.formatSeparator).trim();return this.format(Pu(n,c,y,this.options.keySeparator,this.options.ignoreJSONStructure),x,r,{...s,...n,interpolationkey:y})};this.resetRegExp();const f=s?.missingInterpolationHandler||this.options.missingInterpolationHandler,d=s?.interpolation?.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:D=>no(D)},{regex:this.regexp,safeValue:D=>this.escapeValue?no(this.escape(D)):no(D)}].forEach(D=>{for(u=0;o=D.regex.exec(e);){const g=o[1].trim();if(a=l(g),a===void 0)if(typeof f=="function"){const x=f(e,o,s);a=me(x)?x:""}else if(s&&Object.prototype.hasOwnProperty.call(s,g))a="";else if(d){a=o[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${e}`),a="";else!me(a)&&!this.useRawValueToEscape&&(a=ku(a));const y=D.safeValue(a);if(e=e.replace(o[0],y),d?(D.regex.lastIndex+=a.length,D.regex.lastIndex-=o[0].length):D.regex.lastIndex=0,u++,u>=this.maxReplaces)break}}),e}nest(e,n,r={}){let s,o,a;const u=(c,l)=>{const f=this.nestingOptionsSeparator;if(c.indexOf(f)<0)return c;const d=c.split(new RegExp(`${qn(f)}[ ]*{`));let p=`{${d[1]}`;c=d[0],p=this.interpolate(p,a);const D=p.match(/'/g),g=p.match(/"/g);((D?.length??0)%2===0&&!g||(g?.length??0)%2!==0)&&(p=p.replace(/'/g,'"'));try{a=JSON.parse(p),l&&(a={...l,...a})}catch(y){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,y),`${c}${f}${p}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,c};for(;s=this.nestingRegexp.exec(e);){let c=[];a={...r},a=a.replace&&!me(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;const l=/{.*}/.test(s[1])?s[1].lastIndexOf("}")+1:s[1].indexOf(this.formatSeparator);if(l!==-1&&(c=s[1].slice(l).split(this.formatSeparator).map(f=>f.trim()).filter(Boolean),s[1]=s[1].slice(0,l)),o=n(u.call(this,s[1].trim(),a),a),o&&s[0]===e&&!me(o))return o;me(o)||(o=ku(o)),o||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${e}`),o=""),c.length&&(o=c.reduce((f,d)=>this.format(f,d,r.lng,{...r,interpolationkey:s[1].trim()}),o.trim())),e=e.replace(s[0],o),this.regexp.lastIndex=0}return e}}const Kf=t=>{let e=t.toLowerCase().trim();const n={};if(t.indexOf("(")>-1){const r=t.split("(");e=r[0].toLowerCase().trim();const s=r[1].substring(0,r[1].length-1);e==="currency"&&s.indexOf(":")<0?n.currency||(n.currency=s.trim()):e==="relativetime"&&s.indexOf(":")<0?n.range||(n.range=s.trim()):s.split(";").forEach(a=>{if(a){const[u,...c]=a.split(":"),l=c.join(":").trim().replace(/^'+|'+$/g,""),f=u.trim();n[f]||(n[f]=l),l==="false"&&(n[f]=!1),l==="true"&&(n[f]=!0),isNaN(l)||(n[f]=parseInt(l,10))}})}return{formatName:e,formatOptions:n}},Iu=t=>{const e={};return(n,r,s)=>{let o=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(o={...o,[s.interpolationkey]:void 0});const a=r+JSON.stringify(o);let u=e[a];return u||(u=t(ar(r),s),e[a]=u),u(n)}},Gf=t=>(e,n,r)=>t(ar(n),r)(e);class Yf{constructor(e={}){this.logger=un.create("formatter"),this.options=e,this.init(e)}init(e,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";const r=n.cacheInBuiltFormats?Iu:Gf;this.formats={number:r((s,o)=>{const a=new Intl.NumberFormat(s,{...o});return u=>a.format(u)}),currency:r((s,o)=>{const a=new Intl.NumberFormat(s,{...o,style:"currency"});return u=>a.format(u)}),datetime:r((s,o)=>{const a=new Intl.DateTimeFormat(s,{...o});return u=>a.format(u)}),relativetime:r((s,o)=>{const a=new Intl.RelativeTimeFormat(s,{...o});return u=>a.format(u,o.range||"day")}),list:r((s,o)=>{const a=new Intl.ListFormat(s,{...o});return u=>a.format(u)})}}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=Iu(n)}format(e,n,r,s={}){const o=n.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&o[0].indexOf(")")<0&&o.find(u=>u.indexOf(")")>-1)){const u=o.findIndex(c=>c.indexOf(")")>-1);o[0]=[o[0],...o.splice(1,u)].join(this.formatSeparator)}return o.reduce((u,c)=>{const{formatName:l,formatOptions:f}=Kf(c);if(this.formats[l]){let d=u;try{const p=s?.formatParams?.[s.interpolationkey]||{},D=p.locale||p.lng||s.locale||s.lng||r;d=this.formats[l](u,D,{...f,...s,...p})}catch(p){this.logger.warn(p)}return d}else this.logger.warn(`there was no format function for ${l}`);return u},e)}}const Wf=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class Xf extends Ai{constructor(e,n,r,s={}){super(),this.backend=e,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=s,this.logger=un.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(r,s.backend,s)}queueLoad(e,n,r,s){const o={},a={},u={},c={};return e.forEach(l=>{let f=!0;n.forEach(d=>{const p=`${l}|${d}`;!r.reload&&this.store.hasResourceBundle(l,d)?this.state[p]=2:this.state[p]<0||(this.state[p]===1?a[p]===void 0&&(a[p]=!0):(this.state[p]=1,f=!1,a[p]===void 0&&(a[p]=!0),o[p]===void 0&&(o[p]=!0),c[d]===void 0&&(c[d]=!0)))}),f||(u[l]=!0)}),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(u),toLoadNamespaces:Object.keys(c)}}loaded(e,n,r){const s=e.split("|"),o=s[0],a=s[1];n&&this.emit("failedLoading",o,a,n),!n&&r&&this.store.addResourceBundle(o,a,r,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2,n&&r&&(this.state[e]=0);const u={};this.queue.forEach(c=>{Rf(c.loaded,[o],a),Wf(c,e),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(l=>{u[l]||(u[l]={});const f=c.loaded[l];f.length&&f.forEach(d=>{u[l][d]===void 0&&(u[l][d]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",u),this.queue=this.queue.filter(c=>!c.done)}read(e,n,r,s=0,o=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:r,tried:s,wait:o,callback:a});return}this.readingCalls++;const u=(l,f)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(l&&f&&s<this.maxRetries){setTimeout(()=>{this.read.call(this,e,n,r,s+1,o*2,a)},o);return}a(l,f)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const l=c(e,n);l&&typeof l.then=="function"?l.then(f=>u(null,f)).catch(u):u(null,l)}catch(l){u(l)}return}return c(e,n,u)}prepareLoading(e,n,r={},s){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();me(e)&&(e=this.languageUtils.toResolveHierarchy(e)),me(n)&&(n=[n]);const o=this.queueLoad(e,n,r,s);if(!o.toLoad.length)return o.pending.length||s(),null;o.toLoad.forEach(a=>{this.loadOne(a)})}load(e,n,r){this.prepareLoading(e,n,{},r)}reload(e,n,r){this.prepareLoading(e,n,{reload:!0},r)}loadOne(e,n=""){const r=e.split("|"),s=r[0],o=r[1];this.read(s,o,"read",void 0,void 0,(a,u)=>{a&&this.logger.warn(`${n}loading namespace ${o} for language ${s} failed`,a),!a&&u&&this.logger.log(`${n}loaded namespace ${o} for language ${s}`,u),this.loaded(e,a,u)})}saveMissing(e,n,r,s,o,a={},u=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend?.create){const c={...a,isUpdate:o},l=this.backend.create.bind(this.backend);if(l.length<6)try{let f;l.length===5?f=l(e,n,r,s,c):f=l(e,n,r,s),f&&typeof f.then=="function"?f.then(d=>u(null,d)).catch(u):u(null,f)}catch(f){u(f)}else l(e,n,r,s,u,c)}!e||!e[0]||this.store.addResource(e[0],n,r,s)}}}const so=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),me(t[1])&&(e.defaultValue=t[1]),me(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const n=t[3]||t[2];Object.keys(n).forEach(r=>{e[r]=n[r]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Mu=t=>(me(t.ns)&&(t.ns=[t.ns]),me(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),me(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs?.indexOf?.("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),typeof t.initImmediate=="boolean"&&(t.initAsync=t.initImmediate),t),Vr=()=>{},Jf=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})},Zc="__i18next_supportNoticeShown",Zf=()=>!!(typeof globalThis<"u"&&globalThis[Zc]||typeof process<"u"&&eo&&eo.I18NEXT_NO_SUPPORT_NOTICE||typeof process<"u"&&eo),Qf=()=>{typeof globalThis<"u"&&(globalThis[Zc]=!0)},ep=t=>!!(t?.modules?.backend?.name?.indexOf("Locize")>0||t?.modules?.backend?.constructor?.name?.indexOf("Locize")>0||t?.options?.backend?.backends&&t.options.backend.backends.some(e=>e?.name?.indexOf("Locize")>0||e?.constructor?.name?.indexOf("Locize")>0)||t?.options?.backend?.projectId||t?.options?.backend?.backendOptions&&t.options.backend.backendOptions.some(e=>e?.projectId));class rr extends Ai{constructor(e={},n){if(super(),this.options=Mu(e),this.services={},this.logger=un,this.modules={external:[]},Jf(this),n&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,n),this;setTimeout(()=>{this.init(e,n)},0)}}init(e={},n){this.isInitializing=!0,typeof e=="function"&&(n=e,e={}),e.defaultNS==null&&e.ns&&(me(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const r=so();this.options={...r,...this.options,...Mu(e)},this.options.interpolation={...r.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=r.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!ep(this)&&!Zf()&&(typeof console<"u"&&typeof console.info<"u"&&console.info("🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙"),Qf());const s=l=>l?typeof l=="function"?new l:l:null;if(!this.options.isClone){this.modules.logger?un.init(s(this.modules.logger),this.options):un.init(null,this.options);let l;this.modules.formatter?l=this.modules.formatter:l=Yf;const f=new Lu(this.options);this.store=new Tu(this.options.resources,this.options);const d=this.services;d.logger=un,d.resourceStore=this.store,d.languageUtils=f,d.pluralResolver=new qf(f,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),l&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(d.formatter=s(l),d.formatter.init&&d.formatter.init(d,this.options),this.options.interpolation.format=d.formatter.format.bind(d.formatter)),d.interpolator=new _u(this.options),d.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},d.backendConnector=new Xf(s(this.modules.backend),d.resourceStore,d,this.options),d.backendConnector.on("*",(D,...g)=>{this.emit(D,...g)}),this.modules.languageDetector&&(d.languageDetector=s(this.modules.languageDetector),d.languageDetector.init&&d.languageDetector.init(d,this.options.detection,this.options)),this.modules.i18nFormat&&(d.i18nFormat=s(this.modules.i18nFormat),d.i18nFormat.init&&d.i18nFormat.init(this)),this.translator=new ai(this.services,this.options),this.translator.on("*",(D,...g)=>{this.emit(D,...g)}),this.modules.external.forEach(D=>{D.init&&D.init(this)})}if(this.format=this.options.interpolation.format,n||(n=Vr),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const l=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);l.length>0&&l[0]!=="dev"&&(this.options.lng=l[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(l=>{this[l]=(...f)=>this.store[l](...f)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(l=>{this[l]=(...f)=>(this.store[l](...f),this)});const u=er(),c=()=>{const l=(f,d)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),u.resolve(d),n(f,d)};if(this.languages&&!this.isInitialized)return l(null,this.t.bind(this));this.changeLanguage(this.options.lng,l)};return this.options.resources||!this.options.initAsync?c():setTimeout(c,0),u}loadResources(e,n=Vr){let r=n;const s=me(e)?e:this.language;if(typeof e=="function"&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(s?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const o=[],a=u=>{if(!u||u==="cimode")return;this.services.languageUtils.toResolveHierarchy(u).forEach(l=>{l!=="cimode"&&o.indexOf(l)<0&&o.push(l)})};s?a(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>a(c)),this.options.preload?.forEach?.(u=>a(u)),this.services.backendConnector.load(o,this.options.ns,u=>{!u&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(u)})}else r(null)}reloadResources(e,n,r){const s=er();return typeof e=="function"&&(r=e,e=void 0),typeof n=="function"&&(r=n,n=void 0),e||(e=this.languages),n||(n=this.options.ns),r||(r=Vr),this.services.backendConnector.reload(e,n,o=>{s.resolve(),r(o)}),s}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&Xc.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1)){for(let n=0;n<this.languages.length;n++){const r=this.languages[n];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,n){this.isLanguageChangingTo=e;const r=er();this.emit("languageChanging",e);const s=u=>{this.language=u,this.languages=this.services.languageUtils.toResolveHierarchy(u),this.resolvedLanguage=void 0,this.setResolvedLanguage(u)},o=(u,c)=>{c?this.isLanguageChangingTo===e&&(s(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,r.resolve((...l)=>this.t(...l)),n&&n(u,(...l)=>this.t(...l))},a=u=>{!e&&!u&&this.services.languageDetector&&(u=[]);const c=me(u)?u:u&&u[0],l=this.store.hasLanguageSomeTranslations(c)?c:this.services.languageUtils.getBestMatchFromCodes(me(u)?[u]:u);l&&(this.language||s(l),this.translator.language||this.translator.changeLanguage(l),this.services.languageDetector?.cacheUserLanguage?.(l)),this.loadResources(l,f=>{o(f,l)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),r}getFixedT(e,n,r){const s=(o,a,...u)=>{let c;typeof a!="object"?c=this.options.overloadTranslationOptionHandler([o,a].concat(u)):c={...a},c.lng=c.lng||s.lng,c.lngs=c.lngs||s.lngs,c.ns=c.ns||s.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||r||s.keyPrefix);const l={...this.options,...c};typeof c.keyPrefix=="function"&&(c.keyPrefix=ws(c.keyPrefix,l));const f=this.options.keySeparator||".";let d;return c.keyPrefix&&Array.isArray(o)?d=o.map(p=>(typeof p=="function"&&(p=ws(p,l)),`${c.keyPrefix}${f}${p}`)):(typeof o=="function"&&(o=ws(o,l)),d=c.keyPrefix?`${c.keyPrefix}${f}${o}`:o),this.t(d,c)};return me(e)?s.lng=e:s.lngs=e,s.ns=n,s.keyPrefix=r,s}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,n={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(u,c)=>{const l=this.services.backendConnector.state[`${u}|${c}`];return l===-1||l===0||l===2};if(n.precheck){const u=n.precheck(this,a);if(u!==void 0)return u}return!!(this.hasResourceBundle(r,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(r,e)&&(!s||a(o,e)))}loadNamespaces(e,n){const r=er();return this.options.ns?(me(e)&&(e=[e]),e.forEach(s=>{this.options.ns.indexOf(s)<0&&this.options.ns.push(s)}),this.loadResources(s=>{r.resolve(),n&&n(s)}),r):(n&&n(),Promise.resolve())}loadLanguages(e,n){const r=er();me(e)&&(e=[e]);const s=this.options.preload||[],o=e.filter(a=>s.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return o.length?(this.options.preload=s.concat(o),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";try{const s=new Intl.Locale(e);if(s&&s.getTextInfo){const o=s.getTextInfo();if(o&&o.direction)return o.direction}}catch{}const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services?.languageUtils||new Lu(so());return e.toLowerCase().indexOf("-latn")>1?"ltr":n.indexOf(r.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},n){const r=new rr(e,n);return r.createInstance=rr.createInstance,r}cloneInstance(e={},n=Vr){const r=e.forkResourceStore;r&&delete e.forkResourceStore;const s={...this.options,...e,isClone:!0},o=new rr(s);if((e.debug!==void 0||e.prefix!==void 0)&&(o.logger=o.logger.clone(e)),["store","services","language"].forEach(u=>{o[u]=this[u]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r){const u=Object.keys(this.store.data).reduce((c,l)=>(c[l]={...this.store.data[l]},c[l]=Object.keys(c[l]).reduce((f,d)=>(f[d]={...c[l][d]},f),c[l]),c),{});o.store=new Tu(u,s),o.services.resourceStore=o.store}if(e.interpolation){const c={...so().interpolation,...this.options.interpolation,...e.interpolation},l={...s,interpolation:c};o.services.interpolator=new _u(l)}return o.translator=new ai(o.services,s),o.translator.on("*",(u,...c)=>{o.emit(u,...c)}),o.init(s,n),o.translator.options=s,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Ie=rr.createInstance();Ie.createInstance;Ie.dir;Ie.init;Ie.loadResources;Ie.reloadResources;Ie.use;Ie.changeLanguage;Ie.getFixedT;Ie.t;Ie.exists;Ie.setDefaultNamespace;Ie.hasLoadedNamespace;Ie.loadNamespaces;Ie.loadLanguages;const{slice:tp,forEach:np}=[];function sp(t){return np.call(tp.call(arguments,1),e=>{if(e)for(const n in e)t[n]===void 0&&(t[n]=e[n])}),t}function rp(t){return typeof t!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(n=>n.test(t))}const $u=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,ip=function(t,e){const r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},s=encodeURIComponent(e);let o=`${t}=${s}`;if(r.maxAge>0){const a=r.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");o+=`; Max-Age=${Math.floor(a)}`}if(r.domain){if(!$u.test(r.domain))throw new TypeError("option domain is invalid");o+=`; Domain=${r.domain}`}if(r.path){if(!$u.test(r.path))throw new TypeError("option path is invalid");o+=`; Path=${r.path}`}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+=`; Expires=${r.expires.toUTCString()}`}if(r.httpOnly&&(o+="; HttpOnly"),r.secure&&(o+="; Secure"),r.sameSite)switch(typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return r.partitioned&&(o+="; Partitioned"),o},Uu={create(t,e,n,r){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(s.expires=new Date,s.expires.setTime(s.expires.getTime()+n*60*1e3)),r&&(s.domain=r),document.cookie=ip(t,e,s)},read(t){const e=`${t}=`,n=document.cookie.split(";");for(let r=0;r<n.length;r++){let s=n[r];for(;s.charAt(0)===" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return s.substring(e.length,s.length)}return null},remove(t,e){this.create(t,"",-1,e)}};var op={name:"cookie",lookup(t){let{lookupCookie:e}=t;if(e&&typeof document<"u")return Uu.read(e)||void 0},cacheUserLanguage(t,e){let{lookupCookie:n,cookieMinutes:r,cookieDomain:s,cookieOptions:o}=e;n&&typeof document<"u"&&Uu.create(n,t,r,s,o)}},ap={name:"querystring",lookup(t){let{lookupQuerystring:e}=t,n;if(typeof window<"u"){let{search:r}=window.location;!window.location.search&&window.location.hash?.indexOf("?")>-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));const o=r.substring(1).split("&");for(let a=0;a<o.length;a++){const u=o[a].indexOf("=");u>0&&o[a].substring(0,u)===e&&(n=o[a].substring(u+1))}}return n}},up={name:"hash",lookup(t){let{lookupHash:e,lookupFromHashIndex:n}=t,r;if(typeof window<"u"){const{hash:s}=window.location;if(s&&s.length>2){const o=s.substring(1);if(e){const a=o.split("&");for(let u=0;u<a.length;u++){const c=a[u].indexOf("=");c>0&&a[u].substring(0,c)===e&&(r=a[u].substring(c+1))}}if(r)return r;if(!r&&n>-1){const a=s.match(/\/([a-zA-Z-]*)/g);return Array.isArray(a)?a[typeof n=="number"?n:0]?.replace("/",""):void 0}}}return r}};let ds=null;const zu=()=>{if(ds!==null)return ds;try{if(ds=typeof window<"u"&&window.localStorage!==null,!ds)return!1;const t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{ds=!1}return ds};var cp={name:"localStorage",lookup(t){let{lookupLocalStorage:e}=t;if(e&&zu())return window.localStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupLocalStorage:n}=e;n&&zu()&&window.localStorage.setItem(n,t)}};let hs=null;const Vu=()=>{if(hs!==null)return hs;try{if(hs=typeof window<"u"&&window.sessionStorage!==null,!hs)return!1;const t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{hs=!1}return hs};var lp={name:"sessionStorage",lookup(t){let{lookupSessionStorage:e}=t;if(e&&Vu())return window.sessionStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupSessionStorage:n}=e;n&&Vu()&&window.sessionStorage.setItem(n,t)}},dp={name:"navigator",lookup(t){const e=[];if(typeof navigator<"u"){const{languages:n,userLanguage:r,language:s}=navigator;if(n)for(let o=0;o<n.length;o++)e.push(n[o]);r&&e.push(r),s&&e.push(s)}return e.length>0?e:void 0}},hp={name:"htmlTag",lookup(t){let{htmlTag:e}=t,n;const r=e||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},fp={name:"path",lookup(t){let{lookupFromPathIndex:e}=t;if(typeof window>"u")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?n[typeof e=="number"?e:0]?.replace("/",""):void 0}},pp={name:"subdomain",lookup(t){let{lookupFromSubdomainIndex:e}=t;const n=typeof e=="number"?e+1:1,r=typeof window<"u"&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[n]}};let Qc=!1;try{document.cookie,Qc=!0}catch{}const el=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];Qc||el.splice(1,1);const mp=()=>({order:el,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:t=>t});class tl{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(e,n)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e,this.options=sp(n,this.options||{},mp()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=s=>s.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(op),this.addDetector(ap),this.addDetector(cp),this.addDetector(lp),this.addDetector(dp),this.addDetector(hp),this.addDetector(fp),this.addDetector(pp),this.addDetector(up)}addDetector(e){return this.detectors[e.name]=e,this}detect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,n=[];return e.forEach(r=>{if(this.detectors[r]){let s=this.detectors[r].lookup(this.options);s&&typeof s=="string"&&(s=[s]),s&&(n=n.concat(s))}}),n=n.filter(r=>r!=null&&!rp(r)).map(r=>this.options.convertDetectedLanguage(r)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}cacheUserLanguage(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||n.forEach(r=>{this.detectors[r]&&this.detectors[r].cacheUserLanguage(e,this.options)}))}}tl.type="languageDetector";const Dp={cancel:"Cancel",create:"Create",add:"Add",remove:"Remove",delete:"Delete",close:"Close",user:"User",permission:"Permission",readOnly:"Read only",readWrite:"Read & write",settings:"Settings",comments:"Comments",files:"Files",outline:"Outline",version:"Version",loading:"Loading…",enabled:"Enabled",disabled:"Disabled",normal:"Active",admin:"Administrator",language:"Language",save:"Save",edit:"Edit",languageEnglish:"English",languageChinese:"中文"},gp={tagline:"A lightweight LaTeX writing environment",username:"Username",password:"Password",login:"Sign in",contact:"Need an account? Contact {{email}}",firstLogin:"Change your temporary password to continue",currentPassword:"Current password",newPassword:"New password",confirmPassword:"Confirm new password",updatePassword:"Update password",mismatch:"The new passwords do not match",passwordMinimum:"At least {{count}} characters",sessionExpired:"Your session has expired. Please sign in again.",logout:"Sign out"},Fp={title:"Projects",subtitle:"Create, edit and share LaTeX documents",restricted:"You can access projects shared with you. Project creation requires administrator permission.",new:"New project",newDescription:"The project will use the configured default LaTeX engine.",name:"Project name",emptyTitle:"Let’s build something great",emptyDescription:"Create a project or upload an existing LaTeX archive to get started.",emptyRestricted:"Projects shared with you will appear here.",noMatches:"No projects match the current search or tag filter.",upload:"Upload project",uploadDescription:"Upload a ZIP archive. A single top-level folder is removed automatically. Maximum file size: {{size}} MB.",zipFile:"ZIP archive",import:"Import project",importing:"Importing…",search:"Search projects…",grid:"Grid",list:"List",scope:"Project status",active:"Active",archived:"Archived",archive:"Archive",unarchive:"Restore",noArchived:"No archived projects.",allTags:"All tags",sortBy:"Sort",sortModified:"Last modified",sortCreated:"Created",pagination:"Project pages",pageOf:"Page {{page}} of {{totalPages}} · {{count}} projects",previousPage:"Previous",nextPage:"Next",owner:"Owner",created:"Created",modified:"Last modified",relativeHoursPast:"{{hours}}h ago",relativeHoursMinutesPast:"{{hours}}h {{minutes}}m ago",relativeHoursFuture:"in {{hours}}h",relativeHoursMinutesFuture:"in {{hours}}h {{minutes}}m",relativeDaysPast:"{{days}}d ago",relativeDaysHoursPast:"{{days}}d {{hours}}h ago",relativeDaysFuture:"in {{days}}d",relativeDaysHoursFuture:"in {{days}}d {{hours}}h",comments:"Comments",unresolvedComments:"{{count}} unresolved comments",unresolvedCommentsTooltip:"{{unresolved}} unresolved / {{total}} total comments",allResolved:"All resolved ({{count}})",allCommentsResolvedTooltip:"All {{count}} comments resolved",noComments:"No comments",unresolvedCount:"{{count}} unresolved",modifiedBy:"Modified by",byUser:"By {{user}}",modifiedByUser:"{{time}} · By {{user}}",deletedUser:"Deleted user",filterTags:"Filter by tag",rename:"Rename",renameTitle:"Rename project",duplicate:"Duplicate",duplicating:"Duplicating…",duplicateTitle:"Duplicate project",duplicateDescription:"Create an independent copy of {{project}}. Files and project settings are copied; members, comments, Git history and compile output are not.",transfer:"Transfer",transferOwnership:"Transfer ownership",transferDescription:"Choose a new owner for {{project}}.",newOwner:"New owner",chooseNewOwner:"Choose a user",noTransferUsers:"No other active users",transferWarning:"You will keep read/write access. Source files, history, comments and members remain; the saved GitHub token is removed so the new owner can add their own credential.",transferForbidden:"Only the current project owner can transfer ownership.",transferTargetInvalid:"Choose a new project owner.",transferSelf:"You already own this project.",download:"Download",deleteTitle:"Delete project",deleteDescription:"Permanently delete {{project}} and all of its files? This cannot be undone.",chooseZip:"Choose a ZIP project",dropZip:"Drag and drop a ZIP archive here",browse:"Browse files",selectedFileSize:"Selected · {{size}}",clearFile:"Clear selected file"},bp={manage:"User management",back:"Back to projects",onlyAdmin:"Only administrators can create users",add:"Add user",role:"Role",createProjects:"Create projects",ownedProjects:"Owned projects",status:"Status",actions:"Actions",adminRequired:"Administrator permission is required.",allow:"Allow",deny:"Deny",enable:"Enable",disable:"Disable",promote:"Make administrator",demote:"Make user",allowCreate:"Allow creation",denyCreate:"Deny creation",resetPassword:"Reset password",initialPassword:"Login password",displayName:"Display name",addDescription:"Set a login password or generate a secure random one.",createUser:"Create user",randomPassword:"Random password",generatePassword:"Generate a random password",resetDescription:"Set a temporary password for {{username}}. Existing sessions will be signed out.",reset:"Reset",deleteTitle:"Delete user",deleteDescription:"Delete {{username}}? This cannot be undone.",ownedChoice:"{{count}} owned projects",transferProjects:"Transfer them to the current administrator",deleteProjects:"Permanently delete projects and files"},yp={saved:"Saved",savedAt:"Saved to server at {{time}}",loading:"Loading",pending:"Waiting to save",saving:"Saving to server",saveFailed:"Save failed",offlineDraft:"Offline · local draft retained",compile:"Compile · {{engine}}",compiling:"Compiling…",compileQueued:"Compile queued…",compileFailedRetained:"Compilation failed; showing the last successful PDF from {{time}}.",compileFailedNoPdf:"Compilation failed and no successful PDF is available.",upToDate:"Files are up to date; no compilation was needed.",compileSnapshotStale:"PDF compiled from a consistent earlier snapshot; newer source changes are not included.",addComment:"Add comment",sourceComments:"Source comments",projectSettings:"Project settings",uploadAttachment:"Upload attachment",newFile:"New text file",binary:"The binary attachment is stored but cannot be opened in the text editor.",noOutline:"No sections in this file",preview:"PDF preview",previewHint:"Compile to generate the document",loadingPdf:"Loading PDF…",pdfCompiledAt:"Compiled successfully at {{time}}",pdfCompiledAtFor:"{{file}} compiled successfully at {{time}}",currentMainDocument:"Current document compiled as the root: {{path}}",mainDocumentCandidate:"LaTeX root document candidate: {{path}}",currentMainShort:"root",deletedUser:"Deleted User",orphaned:"Anchor lost",line:"Line {{line}}",reopen:"Reopen",resolve:"Mark resolved",noComments:"No comments in this file",newFileDescription:"Directories are allowed, for example chapters/introduction.tex.",filePath:"File path",commentDescription:"Selected {{count}} characters",pointComment:"No text selected; the comment will be anchored at the cursor.",commentContent:"Comment",backToProjects:"Back to projects",outputTabs:"Compile output",log:"Log",warnings:"Warnings",errors:"Errors",artifacts:"Artifacts",clean:"Recovery",noLog:"Compile to see the log.",noWarnings:"No warnings in the latest compile.",noErrors:"No errors in the latest compile.",projectRoot:"Project root",uploadTo:"Upload to {{folder}}",dropFiles:"Drop files to upload",newFolder:"New folder",folderName:"Folder name",noArtifacts:"Compile to see generated artifacts.",selectArtifact:"Select a text artifact to preview it.",viewArtifact:"View artifact",downloadArtifact:"Download artifact",downloadToView:"Download this artifact to view it",cleanTitle:"Compilation recovery",cleanDescription:"Use these advanced actions only when compilation is stuck, a previous error is left behind, or generated output is inconsistent. They do not change source files, project settings, comments, history, or Git data.",cleanCache:"Force a clean rebuild",cleanCacheDescription:"Use after a compilation failure or stale latexmk state. Removes the incremental cache while keeping the current successful PDF.",cleanArtifacts:"Remove generated output",cleanArtifactsDescription:"Use when generated files are inconsistent. Removes the PDF, SyncTeX, logs, and intermediate files for this root document.",cleanCacheConfirmTitle:"Force a clean rebuild?",cleanCacheConfirmDescription:"This recovery action removes the incremental latexmk cache. The current PDF remains visible, and the next compilation starts from a clean cache.",cleanArtifactsConfirmTitle:"Remove generated output?",cleanArtifactsConfirmDescription:"This recovery action removes the current PDF and all generated files for this root document. Source files are not affected.",cleanConfirm:"Run recovery",cleanCacheComplete:"Recovery cache cleared. The next compilation will be a full rebuild.",cleanArtifactsComplete:"Generated compilation output removed.",cleanBusy:"This root document is compiling. Try recovery again after it finishes.",folderDestination:"The folder will be created in {{folder}}.",uploadOverwriteTitle:"File already exists",uploadOverwriteDescription:"These files already exist: {{files}}. Replace them?",uploadOverwrite:"Replace files",collapseFiles:"Collapse file panel",move:"Move",moveTitle:"Move or rename {{name}}",moveDescription:"Choose a destination folder and name. Files, comments and project paths stay linked.",pathName:"Name",moveApply:"Move / rename",deletePath:"Delete file or folder",deletePathTitle:"Delete {{name}}",deletePathDescription:"Delete {{path}}? This cannot be undone.",deletePathActiveDescription:"Delete {{path}}? It is currently open for {{users}} and will close in those sessions.",deletePathWillClose:"Any late edits to this path will be rejected to prevent silent data loss.",fileDeletedByCollaborator:"{{path}} was deleted in another session. A safe fallback file has been opened.",destinationFolder:"Destination folder",compileShortcut:"Save and compile (Ctrl+S / Cmd+S)",compilingBy:"{{name}} is compiling",format:"Format",formatFile:"File",formatFileHint:"Format the current file",formatFileComplete:"Current file formatted.",formatFileFailed:"Unable to format the current file: {{message}}",formatSelected:"Selected",commentsAdd:"Add",commentsAll:"All",formatSelection:"Format selection",formatting:"Formatting…",formatSelectionHint:"Select LaTeX source to format",formatSelectionRequired:"Select LaTeX source before formatting.",formatSelectionComplete:"Selected LaTeX source formatted.",formatFailedContinue:"Formatting failed; compilation will continue: {{message}}",formatFailed:"Unable to format the selection: {{message}}",formatSourceChanged:"The source changed during formatting, so formatting was skipped.",formatSelectionChanged:"The selected source changed during formatting. Select it again and retry.",writingSuggestions:"Writing suggestions",noWritingSuggestions:"No suggestions available",removeText:"Remove text",replaceWith:"Replace with {{word}}",spellCheckReadOnly:"Read-only: choose a suggestion in an editor with write permission.",spellCheckSourceChanged:"The source changed before the writing correction could be applied.",vimOn:"Vim ON",vimOnHint:"Vim keybindings are enabled for this editor.",reply:"Reply",replyPlaceholder:"Write a reply…",sendReply:"Send reply",editComment:"Edit comment",deleteComment:"Delete comment",saveChanges:"Save changes",deleteCommentTitle:"Delete comment",deleteCommentDescription:"Delete this comment and its {{count}} replies? This cannot be undone.",editReply:"Edit reply",deleteReply:"Delete reply",deleteReplyTitle:"Delete reply",deleteReplyDescription:"Delete this reply? This cannot be undone.",editedAt:"Edited {{time}}",outlineJump:"Go to source line {{line}} and locate it in the PDF",lineNumber:"line {{line}}",showInSource:"Show the visible PDF location in source",showInPdf:"Show the source cursor location in PDF",syncTexOnlyForTex:"PDF sync is only available for TeX (.tex) files",syncTexOnlyForMain:"PDF sync is only available for the current main TeX document",openFiles:"Open files",pdfLoadFailed:"The PDF preview could not be loaded",pdfZoomControls:"PDF zoom controls",downloadPdf:"Download PDF",downloadResource:"Download file",resourceTooLarge:"This file is {{size}} and exceeds the direct preview limit of {{limit}}.",resourceTooLargeTitle:"File is too large to preview",resourceTooLargeDescription:"Download the file to open it locally.",resourceUnsupportedTitle:"Preview unavailable",resourceUnsupportedDescription:"This file type cannot be rendered in the browser. Download it to open it locally.",resourcePreview:{image:"Image preview",pdf:"PDF preview",text:"Text preview",unsupported:"File preview"},pdfZoomOut:"Zoom out",pdfZoomIn:"Zoom in",pdfFitWidth:"Fit width",pdfLink:"PDF link",pdfLinks:"PDF links",layout:{label:"Layout",choose:"Choose layout",current:"Current layout: {{layout}}","editor-pdf":{name:"Editor & PDF",description:"Show the source editor and PDF preview side by side"},"editor-only":{name:"Editor only",description:"Use the workspace for source editing"},"pdf-only":{name:"PDF only",description:"Use the workspace for the PDF and compile output"}},collaboration:{connecting:"Connecting collaboration…",connected:"Live collaboration connected",disconnected:"Collaboration disconnected",editing:"Editing",viewing:"Viewing",joining:"Joining project",reconnect:"Reconnect",activeSessions:"{{count}} active sessions",showMoreSessions:"Show {{count}} more sessions",showFewerSessions:"Collapse session list",sessionTooltip:"{{name}} (@{{username}}) · {{file}} · {{activity}} · {{permission}}"},search:{button:"Find",title:"Find and replace (Ctrl+F / Cmd+F)",find:"Find",replace:"Replace",next:"Next",previous:"Previous",all:"Select all",matchCase:"Match case",regexp:"Regular expression",wholeWord:"Whole word",replaceNext:"Replace",replaceAll:"Replace all",currentMatch:"Current match",onLine:"on line",replacedMatchOnLine:"replaced match on line $",replacedMatches:"replaced $ matches",goToLine:"Go to line",go:"Go",matchCount:"{{count}} matches",noMatches:"No matches",invalidQuery:"Invalid regular expression"}},Cp={title:"Citation library",description:"Save references from {{file}} and import them into this BibTeX file. Your library and its tags are private to your account.",myLibrary:"My library",currentFile:"Current file",searchPlaceholder:"Search citations…",searchHint:"Search key, title, author, or year",emptyTitle:"Your library is empty",emptyDescription:"Open the current-file tab to save a BibTeX entry.",noEntries:"No BibTeX entries found",noEntriesDescription:"Add a valid @article, @inproceedings, or similar entry to this file.",currentFileTitle:"Entries from the current file",currentFileDescription:"Select an entry to save it to your citation library.",backToLibrary:"Back to library",save:"Save",update:"Update",saving:"Saving…",saved:"Citation saved to your library.",updated:"Citation updated.",deleted:"Citation deleted.",savedLabel:"Saved",import:"Import",importToFile:"Import into the current BibTeX file",importRequiresWrite:"Import requires write permission for this project.",imported:"Imported {{key}} into the current file.",untitled:"Untitled citation",authorUnknown:"Author not specified",allTags:"All tags",noTags:"No tags yet",noTagMatches:"No citations match this tag.",newTagPlaceholder:"New tag name",tagColor:"Tag color",createTag:"Create tag",tagCreated:"Tag created.",tags:"Tags",tagsTitle:"Tags for {{key}}",noTagsToAssign:"Create a tag first.",saveTags:"Save tags",tagsUpdated:"Tags updated.",editTitle:"Edit {{key}}"},Ep={invalid:"Enter one valid BibTeX entry.",tooLarge:"This BibTeX entry is too large.",notFound:"The citation does not exist.",keyExists:"That citation key already exists. Review the existing entry before replacing it.",tagNotFound:"The citation tag does not exist.",conflict:"This citation changed elsewhere. Refresh the library and try again.",alreadyInFile:"{{key}} is already present in this BibTeX file."},xp="Manage your private BibTeX references and tags from the homepage. Open a .bib file to save or import entries.",wp={addEntry:"Add entry",addEntryTitle:"Add a BibTeX entry",addEntryDescription:"Paste one complete BibTeX entry. It will be validated before it is saved.",addEntryPlaceholder:`@article{key,
3
+ author = {Author},
4
+ title = {Title},
5
+ year = {2026}
6
+ }`,added:"Citation added to your library."},Ap={pageOf:"Page {{page}} of {{totalPages}} · {{count}} entries",previous:"Previous",next:"Next"},vp={quickOpen:"Quick open",quickOpenDescription:"Open a project file by name (Ctrl/Cmd+P).",filePlaceholder:"Type a file name…",noFiles:"No matching files.",projectSearch:"Project search",projectSearchDescription:"Search and replace across project source files (Ctrl/Cmd+Shift+F).",searchPlaceholder:"Search all source files…",replacePlaceholder:"Replace with…",matchSummary:"{{count}} matches",truncated:"Showing the first {{count}} matches.",replaceAll:"Replace all {{count}}",replaceConfirmTitle:"Replace across the project",replaceConfirmDescription:"Replace all {{count}} matches? Automatic history records every changed file first.",replaced:"Replaced {{count}} matches in {{files}} files."},kp={title:"History",description:"Browse automatic project versions, compare files and safely restore earlier work.",empty:"No history versions yet.",changedCount:"{{count}} changed files",fileCount:"{{count}} files",changed:"changed",labelPlaceholder:"Name this version",saveLabel:"Save label",compareCurrent:"Compare with current",comparingCurrent:"Earlier version compared with the current file",chooseFile:"Choose a file, then compare it with the current source.",restore:"Restore",restoreFile:"Restore file",restoreProject:"Restore project",restoreFileTitle:"Restore this file",restoreProjectTitle:"Restore this project version",restoreFileDescription:"Restore {{path}} from this version? The current project is checkpointed first.",restoreProjectDescription:"Restore all source files and compiler settings from this version? The current project is checkpointed first.",storage:"History storage",storageUsage:"{{used}} of {{limit}}",versionUsage:"{{count}} of {{limit}} ordinary versions",protectedVersions:"{{count}} labeled",storageExceeded:"Protected or current data exceeds the soft storage limit.",deleteVersion:"Delete version",deleteVersionTitle:"Delete this history version",deleteVersionDescription:"Permanently delete {{name}}? Current project files are not changed.",clearAll:"Clear history",clearAllTitle:"Clear all project history",clearAllDescription:"Permanently delete every history version and its unreferenced stored data? Current project files are not changed.",reasons:{initial:"Project created",autosave:"Automatic save",file:"File operation",settings:"Compiler settings",git:"Git operation",restore:"Restored version",checkpoint:"Safety checkpoint"}},Sp={mainFile:"Main document",engine:"Compiler",latexmkrc:"Project latexmkrc",save:"Save project settings",members:"Shared members",recentLog:"Latest compile log",share:"Share",shareDescription:"Projects can only be shared with users created by an administrator.",chooseUser:"Choose a user",latexmkrcPlaceholder:`# Empty disables the project rc file
7
+ $pdf_mode = 1;`,addMember:"Add member",noMembers:"This project has not been shared with anyone.",removeTitle:"Remove shared member",removeDescription:"Remove {{username}}? Their account and other projects are unaffected.",editorTab:"Editor appearance",compilerTab:"LaTeX compiler",compilerDescription:"Choose the main document and compiler options shared by everyone in this project.",editorAppearance:"Editor appearance",editorAppearanceDescription:"These preferences are private to this user and project on this browser. The project dictionary is shared.",saveAppearance:"Save appearance",saveCompiler:"Save compiler settings",writingCheckDescription:"Harper runs locally in a worker. Spelling issues use a red wavy underline; grammar issues use yellow. Right-click an issue for suggestions.",projectConfiguration:"Project configuration",fontFamily:"English font",fontSize:"Font size",lineHeight:"Line spacing",dictionary:"Project dictionary",dictionaryDescription:"Words added here are imported into Harper's custom dictionary and ignored by spelling checks for this project. Editors can maintain this list.",dictionaryPlaceholder:"Add a custom word",addWord:"Add word",dictionaryEmpty:"No custom words yet.",lineWrapping:"Wrap long lines",spellCheck:"Spelling and grammar checking",vimMode:"Vim keybindings",vimModeDescription:"Use Vim normal/insert/visual modes in this editor.",vimHelp:"View help",formatOnCompile:"Format LaTeX before compiling",formatOnCompileDescription:"Off by default. Formatting runs before compilation.",formatRequiresWrite:"Formatting requires permission to edit this project.",formatterDescription:"Tex, cls, and sty files use the bundled browser-side tex-fmt WASM formatter; BibTeX files use browser-side bibtex-tidy.",formatterInstall:"View tex-fmt package/docs",bibtexTidyInstall:"View bibtex-tidy",texFmtOptions:"tex-fmt options (TOML)",texFmtOptionsPlaceholder:`wrap = true
8
+ wraplen = 80`,texFmtOptionsDescription:"These options are private to this user and project. They are passed directly to tex-fmt in the browser.",openFilesInTabs:"Open LaTeX files in editor tabs",openFilesInTabsDescription:"Open .tex, .bib, .sty and other source files in tabs at the top of the editor.",writingIssues:"{{count}} writing issues ({{uniqueCount}} unique)",noWritingIssues:"No spelling or grammar issues found.",spellCheckFirst:"First writing issue",spellCheckPrevious:"Previous writing issue",spellCheckNext:"Next writing issue",spellCheckLast:"Last writing issue",spellCheckPosition:"{{current}}/{{total}}",fontJetBrains:"JetBrains Mono",fontSourceCode:"Source Code Pro",fontIbmPlex:"IBM Plex Mono",fontFiraCode:"Fira Code",fontIosevka:"Iosevka",lineHeightCompact:"Compact",lineHeightNormal:"Normal",lineHeightRelaxed:"Relaxed"},jp={title:"Git backup",description:"Manage the local Git history and its GitHub backup. Only the project owner can use these actions.",ownerOnly:"Only the project owner can use Git backup.",authentication:"GitHub authentication",authenticationHint:"Use a token with repository Administration and Contents write access. It is encrypted at rest and never written to the repository or remote URL.",recommendedAccessTitle:"Recommended repository access: All repositories",recommendedAccess:"texLite is intended for trusted users. Select All repositories so this token can create a repository and access repositories created later. Grant Administration and Contents read and write permissions.",token:"Personal access token",tokenPlaceholder:"Paste your GitHub token",replaceToken:"Replace personal access token",saveToken:"Save and verify token",createToken:"Create a fine-grained token",connectedAs:"Connected as @{{login}}",removeToken:"Remove token",tokenSaved:"GitHub token saved; the local repository is ready.",tokenRemoved:"GitHub token removed.",repository:"Repository",localReady:"The project source is managed by a local Git repository.",localPending:"Saving a valid token initializes the local Git repository.",repositoryName:"GitHub repository name",privateRepository:"Create as a private repository",createRepository:"Create GitHub repository",repositoryCreated:"GitHub repository created.",origin:"origin",openGitHub:"Open GitHub",clean:"Working tree clean",changedFiles:"{{count}} changed files",commitAndPush:"Commit and push",identity:"Commits use {{username}} <{{username}}@texlite.com> for this command only.",detachedHead:"Detached HEAD: return to the default branch before committing or pushing.",detachedAt:"detached at {{revision}}",commitMessage:"Commit message",commitPlaceholder:"Describe this backup…",commit:"Commit",committed:"Changes committed.",noChangesToCommit:"There are no new changes to commit.",push:"Push",pushed:"Push succeeded. The backup is up to date on GitHub.",pushFailed:"Push failed",workingDiff:"Working diff",refresh:"Refresh",diffTitle:"Diff",diffTruncated:"output truncated",diffFontSize:"Diff font size",diffFontDecrease:"Decrease diff font size",diffFontIncrease:"Increase diff font size",fullscreenDiff:"View diff full screen",exitFullscreenDiff:"Exit full screen",noChanges:"No differences to display.",history:"History",historyHint:"Up to 100 recent commits",noCommits:"No commits yet.",viewCommitDiff:"View this commit's diff",checkoutVersion:"Checkout this version",checkoutTitle:"Checkout version",checkout:"Checkout",checkoutDescription:"Checkout {{revision}} — {{message}}. By default Git preserves compatible uncommitted changes and refuses conflicts.",forceCheckout:"Force overwrite",forceCheckoutDescription:"Explicitly discard tracked and untracked working changes before checkout. This cannot be undone.",returnToBranch:"Return to {{branch}}",returnTitle:"Return to default branch",returnDescription:"Checkout {{branch}}. By default Git preserves compatible uncommitted changes and refuses conflicts.",discardChanges:"Discard changes",noChangesToDiscard:"There are no changes to discard.",discardTitle:"Discard uncommitted changes",discardDescription:"Restore all tracked files to the current HEAD commit. Untracked files are unaffected.",discardConfirm:"Discard changes"},Bp={title:"System status",description:"Live server health and recent operation latency. Values refresh every five seconds.",refresh:"Refresh",uptime:"Uptime",memory:"Memory",heap:"heap",compileQueue:"Compile jobs",pending:"{{count}} pending",collaboration:"Collaboration",sessions:"{{count}} sessions",roomsAndDirty:"{{rooms}} rooms · {{dirty}} dirty files",eventLoop:"Event-loop latency",latencySummary:"P50 {{p50Ms}} ms · P95 {{p95Ms}} ms · max {{maxMs}} ms",operationDurations:"Recent operation durations",noSamples:"No operation samples have been collected yet.",operation:"Operation",samples:"Samples",last:"Last",max:"Max",operations:{collaboration:{connect:"Open collaboration room",persist:"Save collaboration changes"},workspace:{project:"Load project metadata",files:"Load project files",compileState:"Load retained PDF state"},compile:{snapshot:"Prepare compile snapshot",request:"Compile request total",cacheSync:"Update compiler cache",latexmk:"Run latexmk",artifactCopy:"Publish compile artifacts"},outline:{build:"Build project outline"},search:{project:"Search project"},completions:{build:"Build completion index"}}},Tp={title:"Tags",add:"Add tag",create:"Create tag",createDescription:"Create a private reusable colored tag for organizing your projects.",assign:"Tags",assignTitle:"Tags for {{project}}",assignDescription:"Select your private tags for this project. Other users have their own tags.",empty:"Create a tag first.",allAssigned:"All available tags are already assigned.",name:"Tag name",color:"Color",filter:"Filter",red:"Red",orange:"Orange",yellow:"Yellow",green:"Green",blue:"Blue",purple:"Purple",gray:"Gray"},Np={generic:"Operation failed",request:"Request failed ({{status}})",upload:"Upload failed",boundaryTitle:"Something went wrong",boundaryDescription:"An unexpected error occurred while rendering the page. You can try recovering, or reload the page.",boundaryRetry:"Retry",boundaryReload:"Reload page",fileExists:"A file or folder with this name already exists.",pathConflict:"The destination path is already used by a folder or file.",duplicateUploadNames:"The selected files contain duplicate names: {{files}}.",fileTooLarge:"The file exceeds the {{size}} MB limit.",zipOnly:"Please choose a ZIP archive.",collaborationUnavailable:"Live collaboration is not connected. Reconnect before saving or compiling.",codes:{AUTH_INVALID:"The username or password is incorrect.",CURRENT_PASSWORD_INVALID:"The current password is incorrect.",USER_NOT_FOUND:"The user no longer exists.",LAST_ADMIN:"At least one administrator must remain active.",SELF_DELETE_FORBIDDEN:"You cannot delete the currently signed-in administrator.",PROJECT_CREATE_FORBIDDEN:"You do not have permission to create projects.",PROJECT_NOT_FOUND:"The project does not exist or is no longer accessible.",PROJECT_OWNER_ONLY:"Only the project owner can change this setting.",PROJECT_EDIT_FORBIDDEN:"You do not have edit permission for this project.",DICTIONARY_EDIT_FORBIDDEN:"You do not have permission to maintain this project's dictionary.",TAG_NOT_FOUND:"The selected tag does not exist.",GIT_TOKEN_INVALID:"Enter a GitHub token.",GIT_REPOSITORY_NAME_INVALID:"Enter a GitHub repository name.",GIT_REVISION_INVALID:"Choose a Git revision to check out.",PROJECT_DELETE_FORBIDDEN:"Only the project owner can delete this project.",MEMBERS_MANAGE_FORBIDDEN:"Only the project owner can manage project members.",OWNER_MEMBER_FORBIDDEN:"The project owner cannot be added as a member.",INVALID_PATH:"The file path is invalid.",RESERVED_PATH:"This path is reserved by TexLite.",PATH_EXISTS:"The destination path is already used by a file or folder.",FILE_EXISTS:"A file with this name already exists.",PATH_NOT_FOUND:"The file or folder does not exist.",FILE_NOT_FOUND:"The file does not exist.",DIRECTORY_NOT_FOUND:"The destination folder does not exist.",MOVE_INTO_SELF:"A folder cannot be moved into itself.",MAIN_FILE_DELETE_FORBIDDEN:"The main document cannot be deleted.",FILE_TOO_LARGE:"This file is too large to open or upload.",UPLOAD_EMPTY:"No file was selected for upload.",COMMENT_FILE_NOT_FOUND:"The file for this comment does not exist.",COMMENT_RANGE_INVALID:"The comment source range is invalid.",COMMENT_NOT_FOUND:"The comment does not exist.",COMMENT_EDIT_FORBIDDEN:"You can only edit your own comments.",COMMENT_DELETE_FORBIDDEN:"You can only delete your own comments.",REPLY_NOT_FOUND:"The reply does not exist.",REPLY_EDIT_FORBIDDEN:"You can only edit your own replies.",REPLY_DELETE_FORBIDDEN:"You can only delete your own replies.",COMMENT_UPDATE_EMPTY:"There is no comment content to update.",MAIN_FILE_NOT_FOUND:"The selected main document does not exist.",LATEXMKRC_DISABLED:"Project latexmkrc files are disabled by the administrator.",LATEXMKRC_NOT_FOUND:"The selected latexmkrc file does not exist.",COMPILE_ARTIFACTS_NOT_FOUND:"No compiled artifacts are available yet.",COMPILE_ARTIFACT_NOT_FOUND:"The compiled artifact does not exist.",ARTIFACT_PREVIEW_UNSUPPORTED:"This artifact cannot be previewed as text; download it instead.",SYNC_SOURCE_INVALID:"The source location is invalid.",SOURCE_FILE_NOT_FOUND:"The source file does not exist.",SYNCTEX_NOT_AVAILABLE:"No SyncTeX data is available. Compile the project again.",SYNC_PDF_INVALID:"The PDF location is invalid.",SYNCTEX_EXTERNAL_PATH:"SyncTeX returned a source path outside the project.",COMPILE_FORBIDDEN:"You do not have permission to compile this project.",PDF_NOT_FOUND:"No PDF has been generated yet.",API_NOT_FOUND:"The API endpoint does not exist.",SERVER_ERROR:"The server could not complete the request.",REQUEST_INVALID:"The request is invalid."}},Lp={historyVersionNotFound:"The selected history version no longer exists.",historyFileNotFound:"This file does not exist in the selected history version.",historyTargetConflict:"The current restore target is a directory or another non-file path.",historyPreviewUnsupported:"This historical file cannot be compared as text.",searchInvalid:"Enter valid text to search for.",gitUnavailable:"Git integration is unavailable. Install Git on the host or correct git.binary in the configuration, then try again.",formatFailed:"tex-fmt could not format this source.",mainDocumentInvalid:"The selected file is not a valid LaTeX root document.",compileSnapshotBusy:"The source has not finished saving durably. Wait a moment and try compiling again."},Op={copyright:"© {{year}}",credit:"Designed and developed by CHEN Zhongpu"},Rp={section:"Section",subsection:"Subsection",bold:"Bold",emphasis:"Emphasis",citation:"Citation",reference:"Cross-reference",label:"Label",image:"Image",unordered:"Unordered list",ordered:"Ordered list",equation:"Equation",figure:"Figure",projectCommand:"Project command",projectCommandArgs:"Project command ({{count}} arguments)",projectMacro:"Project macro",expl3Command:"Expl3 project command",mathOperator:"Project math operator",mathDelimiter:"Project math delimiter",projectEnvironment:"Project environment",projectFile:"Project file",package:"Package",documentClass:"Document class",currentFile:"Current file",project:"Project",latex:"LaTeX",standard:"LaTeX command"},Pp={common:Dp,auth:gp,projects:Fp,users:bp,editor:yp,citationLibrary:Cp,citationErrors:Ep,citationLibraryHomeDescription:xp,citationLibraryActions:wp,citationLibraryPagination:Ap,navigation:vp,history:kp,projectSettings:Sp,git:jp,metrics:Bp,tags:Tp,errors:Np,apiErrors:Lp,footer:Op,completions:Rp},_p={cancel:"取消",create:"创建",add:"添加",remove:"移除",delete:"删除",close:"关闭",user:"用户",permission:"权限",readOnly:"只读",readWrite:"读写",settings:"设置",comments:"批注",files:"文件",outline:"大纲",version:"版本",loading:"正在载入…",enabled:"允许",disabled:"禁止",normal:"正常",admin:"管理员",language:"语言",save:"保存",edit:"编辑",languageEnglish:"English",languageChinese:"中文"},Ip={tagline:"轻量 LaTeX 写作环境",username:"用户名",password:"密码",login:"登录",contact:"需要账号?请联系 {{email}}",firstLogin:"首次登录,请修改初始密码",currentPassword:"当前密码",newPassword:"新密码",confirmPassword:"确认新密码",updatePassword:"更新密码",mismatch:"两次输入的新密码不一致",passwordMinimum:"至少 {{count}} 位",sessionExpired:"登录状态已过期,请重新登录。",logout:"退出"},Mp={title:"项目",subtitle:"创建、编辑和分享 LaTeX 文档",restricted:"你可以访问别人共享给你的项目;创建权限由管理员授予",new:"新建项目",newDescription:"项目会使用配置文件中的默认 LaTeX 引擎。",name:"项目名称",emptyTitle:"一起创造出色的作品",emptyDescription:"创建新项目,或上传已有的 LaTeX 压缩包开始写作。",emptyRestricted:"共享给你的项目会显示在这里。",noMatches:"没有符合当前搜索或标签筛选条件的项目。",upload:"上传项目",uploadDescription:"上传 ZIP 压缩包;若只有一个顶层目录会自动去除。单文件最大 {{size}} MB。",zipFile:"ZIP 压缩包",import:"导入项目",importing:"正在导入…",search:"搜索项目…",grid:"网格",list:"列表",allTags:"全部标签",sortBy:"排序",sortModified:"最后修改时间",sortCreated:"创建时间",scope:"项目状态",active:"活跃项目",archived:"已归档",archive:"归档",unarchive:"取消归档",noArchived:"还没有归档项目。",pagination:"项目分页",pageOf:"第 {{page}} / {{totalPages}} 页 · 共 {{count}} 个项目",previousPage:"上一页",nextPage:"下一页",owner:"所有者",created:"创建时间",modified:"最后修改",relativeHoursPast:"{{hours}}小时前",relativeHoursMinutesPast:"{{hours}}小时{{minutes}}分钟前",relativeHoursFuture:"{{hours}}小时后",relativeHoursMinutesFuture:"{{hours}}小时{{minutes}}分钟后",relativeDaysPast:"{{days}}天前",relativeDaysHoursPast:"{{days}}天{{hours}}小时前",relativeDaysFuture:"{{days}}天后",relativeDaysHoursFuture:"{{days}}天{{hours}}小时后",modifiedBy:"最后修改人",byUser:"由 {{user}} 修改",modifiedByUser:"{{time}} · 由 {{user}} 修改",deletedUser:"已删除用户",comments:"批注",unresolvedComments:"{{count}} 条未解决批注",unresolvedCommentsTooltip:"{{unresolved}} 条未解决批注 / 共 {{total}} 条",allResolved:"全部已解决 ({{count}})",allCommentsResolvedTooltip:"全部 {{count}} 条批注已解决",noComments:"暂无批注",unresolvedCount:"{{count}} 条待解决",filterTags:"按标签过滤",rename:"重命名",renameTitle:"重命名项目",duplicate:"复制项目",duplicating:"正在复制…",duplicateTitle:"复制项目",duplicateDescription:"创建“{{project}}”的独立副本。会复制文件和项目设置,但不会复制成员、批注、Git 历史和编译产物。",download:"下载",transfer:"转让",transferOwnership:"转让项目",transferDescription:"为“{{project}}”选择新的所有者。",newOwner:"新所有者",chooseNewOwner:"请选择用户",noTransferUsers:"没有其他可用用户",transferWarning:"转让后你仍保留读写权限。源码、历史、批注和成员不会改变;已保存的 GitHub token 会被移除,由新所有者配置自己的凭据。",transferForbidden:"只有当前项目所有者可以转让项目。",transferTargetInvalid:"请选择新的项目所有者。",transferSelf:"你已经是该项目的所有者。",deleteTitle:"删除项目",deleteDescription:"确定永久删除“{{project}}”及其全部文件吗?此操作不可撤销。",chooseZip:"选择 ZIP 项目",dropZip:"将 ZIP 压缩包拖放到这里",browse:"浏览文件",selectedFileSize:"已选择 · {{size}}",clearFile:"清除已选文件"},$p={manage:"用户管理",back:"返回项目",onlyAdmin:"仅管理员可以创建用户",add:"添加用户",role:"角色",createProjects:"创建项目",ownedProjects:"拥有项目",status:"状态",actions:"操作",adminRequired:"需要管理员权限。",allow:"允许",deny:"禁止",enable:"启用",disable:"禁用",promote:"设为管理员",demote:"降为用户",allowCreate:"允许创建",denyCreate:"禁止创建",resetPassword:"重置密码",initialPassword:"登录密码",displayName:"显示名称",addDescription:"设置登录密码,或生成一个安全的随机密码。",createUser:"创建用户",randomPassword:"随机密码",generatePassword:"生成随机密码",resetDescription:"为 {{username}} 设置初始密码;其现有会话会被注销。",reset:"重置",deleteTitle:"删除用户",deleteDescription:"确认删除 {{username}}?此操作不可撤销。",ownedChoice:"其拥有的 {{count}} 个项目",transferProjects:"转移给当前管理员",deleteProjects:"永久删除项目及全部文件"},Up={saved:"已保存",savedAt:"已于 {{time}} 保存到服务器",loading:"载入中",pending:"等待保存",saving:"正在保存到服务器",saveFailed:"保存失败",offlineDraft:"离线 · 本地草稿已保留",compile:"编译 · {{engine}}",compiling:"编译中…",compileQueued:"编译已排队…",compileFailedRetained:"编译失败,当前显示上一次成功生成的 PDF({{time}})。",compileFailedNoPdf:"编译失败,且没有可用的成功 PDF。",upToDate:"文件已是最新,无需重新编译。",compileSnapshotStale:"PDF 基于较早的一致快照编译,未包含之后的源码修改。",addComment:"添加批注",sourceComments:"源码批注",projectSettings:"项目设置",uploadAttachment:"上传附件",newFile:"新建文本文件",binary:"二进制附件已保存,但不能在文本编辑器中打开。",noOutline:"当前文件没有章节",preview:"PDF 预览",previewHint:"点击“编译”生成文档",loadingPdf:"正在加载 PDF…",pdfCompiledAt:"成功编译于 {{time}}",pdfCompiledAtFor:"{{file}} 成功编译于 {{time}}",currentMainDocument:"当前作为主文档编译:{{path}}",mainDocumentCandidate:"LaTeX 主文档候选:{{path}}",currentMainShort:"主文档",deletedUser:"已删除用户",orphaned:"锚点已丢失",line:"第 {{line}} 行",reopen:"重新打开",resolve:"标记为已解决",noComments:"当前文件没有批注",newFileDescription:"可以包含目录,例如 chapters/introduction.tex。",filePath:"文件路径",commentDescription:"已选择 {{count}} 个字符",pointComment:"未选择文本,将在当前光标位置添加批注。",commentContent:"批注内容",backToProjects:"返回项目列表",outputTabs:"编译输出",log:"日志",warnings:"警告",errors:"错误",artifacts:"产物",clean:"故障恢复",noLog:"编译后将在此显示日志。",noWarnings:"最近一次编译没有警告。",noErrors:"最近一次编译没有错误。",projectRoot:"项目根目录",uploadTo:"上传到 {{folder}}",dropFiles:"拖放文件以上传",newFolder:"新建文件夹",folderName:"文件夹名称",folderDestination:"文件夹将创建在 {{folder}} 中。",uploadOverwriteTitle:"文件已存在",uploadOverwriteDescription:"以下文件已经存在:{{files}}。要覆盖它们吗?",uploadOverwrite:"覆盖文件",noArtifacts:"编译后将在此显示输出产物。",selectArtifact:"选择一个文本产物进行预览。",viewArtifact:"查看产物",downloadArtifact:"下载产物",downloadToView:"该产物需要下载后查看",cleanTitle:"编译故障恢复",cleanDescription:"这里只提供高级故障恢复操作:仅在编译卡住、历史错误状态残留或生成产物异常时使用。不会修改源码、项目设置、批注、历史或 Git 数据。",cleanCache:"强制完整重编译",cleanCacheDescription:"仅在编译失败或 latexmk 缓存状态异常时使用。删除增量缓存,但保留当前成功的 PDF。",cleanArtifacts:"删除生成输出",cleanArtifactsDescription:"仅在生成产物状态异常时使用。删除该主文档的 PDF、SyncTeX、日志和中间文件。",cleanCacheConfirmTitle:"强制完整重编译?",cleanCacheConfirmDescription:"此故障恢复操作会删除 latexmk 增量缓存。当前 PDF 会保留,下一次编译将从干净缓存开始。",cleanArtifactsConfirmTitle:"删除生成输出?",cleanArtifactsConfirmDescription:"此故障恢复操作会删除当前 PDF 以及该主文档的全部生成文件,但不会影响源码。",cleanConfirm:"执行恢复",cleanCacheComplete:"故障恢复缓存已清理,下一次编译将完整执行。",cleanArtifactsComplete:"编译生成输出已删除。",cleanBusy:"当前主文档正在编译,请完成后再执行故障恢复。",collapseFiles:"折叠文件面板",move:"移动",moveTitle:"移动或重命名 {{name}}",moveDescription:"选择目标文件夹和名称;源码、批注和项目路径会保持关联。",pathName:"名称",moveApply:"移动/重命名",destinationFolder:"目标文件夹",deletePath:"删除文件或文件夹",deletePathTitle:"删除 {{name}}",deletePathDescription:"确定删除 {{path}}?此操作不可撤销。",deletePathActiveDescription:"确定删除 {{path}}?{{users}} 当前正在打开它,删除后这些会话将关闭该文件。",deletePathWillClose:"系统会拒绝该路径上迟到的修改,避免内容被静默丢失。",fileDeletedByCollaborator:"{{path}} 已在其他会话中删除,现已打开安全的备用文件。",compileShortcut:"保存并编译(Ctrl+S / Cmd+S)",compilingBy:"{{name}} 正在编译",format:"格式化",formatFile:"文件",formatFileHint:"格式化当前文件",formatFileComplete:"当前文件已格式化。",formatFileFailed:"无法格式化当前文件:{{message}}",formatSelected:"选区",commentsAdd:"添加",commentsAll:"全部",formatSelection:"格式化选区",formatting:"正在格式化…",formatSelectionHint:"选择一段 LaTeX 源码后格式化",formatSelectionRequired:"请先选择 LaTeX 源码,再进行格式化。",formatSelectionComplete:"所选 LaTeX 源码已格式化。",formatFailedContinue:"格式化失败,仍将继续编译:{{message}}",formatFailed:"无法格式化选区:{{message}}",formatSourceChanged:"格式化期间源码已发生变化,已跳过本次格式化。",formatSelectionChanged:"格式化期间所选源码已发生变化,请重新选择后再试。",writingSuggestions:"写作建议",noWritingSuggestions:"没有可用的修改建议",removeText:"删除文本",replaceWith:"替换为 {{word}}",spellCheckReadOnly:"当前为只读,需要编辑权限才能替换。",spellCheckSourceChanged:"源码在应用写作修正前发生了变化。",vimOn:"Vim 已开启",vimOnHint:"当前编辑器已启用 Vim 键位。",reply:"回复",replyPlaceholder:"输入回复内容…",sendReply:"发送回复",editComment:"编辑批注",deleteComment:"删除批注",saveChanges:"保存修改",deleteCommentTitle:"删除批注",deleteCommentDescription:"确定删除这条批注及其 {{count}} 条回复吗?此操作不可撤销。",editReply:"编辑回复",deleteReply:"删除回复",deleteReplyTitle:"删除回复",deleteReplyDescription:"确定删除这条回复吗?此操作不可撤销。",editedAt:"编辑于 {{time}}",outlineJump:"跳转到源码第 {{line}} 行并定位 PDF",lineNumber:"第 {{line}} 行",showInSource:"在源码中显示当前 PDF 位置",showInPdf:"在 PDF 中显示当前源码光标位置",syncTexOnlyForTex:"PDF 跳转仅支持 TeX 源文件(.tex)",syncTexOnlyForMain:"PDF 跳转仅支持当前主 TeX 文档",openFiles:"打开的文件",pdfLoadFailed:"无法载入 PDF 预览",pdfZoomControls:"PDF 缩放控件",downloadPdf:"下载 PDF",downloadResource:"下载文件",resourceTooLarge:"该文件大小为 {{size}},超过 {{limit}} 的直接预览上限。",resourceTooLargeTitle:"文件过大,无法直接预览",resourceTooLargeDescription:"请下载文件后在本地打开。",resourceUnsupportedTitle:"无法预览",resourceUnsupportedDescription:"浏览器不能直接渲染此文件类型,请下载后在本地打开。",resourcePreview:{image:"图片预览",pdf:"PDF 预览",text:"文本预览",unsupported:"文件预览"},pdfZoomOut:"缩小",pdfZoomIn:"放大",pdfFitWidth:"适合宽度",pdfLink:"PDF 链接",pdfLinks:"PDF 链接",layout:{label:"布局",choose:"选择布局",current:"当前布局:{{layout}}","editor-pdf":{name:"编辑器与 PDF",description:"并排显示源码编辑器和 PDF 预览"},"editor-only":{name:"仅编辑器",description:"将工作区用于源码编辑"},"pdf-only":{name:"仅 PDF",description:"将工作区用于 PDF 和编译输出"}},collaboration:{connecting:"正在连接协作服务…",connected:"实时协作已连接",disconnected:"实时协作连接已断开",editing:"正在编辑",viewing:"正在查看",joining:"正在进入项目",reconnect:"重新连接",activeSessions:"{{count}} 个活跃会话",showMoreSessions:"展开另外 {{count}} 个会话",showFewerSessions:"收起会话列表",sessionTooltip:"{{name}}(@{{username}})· {{file}} · {{activity}} · {{permission}}"},search:{button:"查找",title:"查找和替换(Ctrl+F / Cmd+F)",find:"查找",replace:"替换为",next:"下一个",previous:"上一个",all:"选择全部",matchCase:"区分大小写",regexp:"正则表达式",wholeWord:"全字匹配",replaceNext:"替换",replaceAll:"全部替换",currentMatch:"当前匹配",onLine:"位于行",replacedMatchOnLine:"已替换第 $ 行的匹配项",replacedMatches:"已替换 $ 个匹配项",goToLine:"跳转到行",go:"跳转",matchCount:"共 {{count}} 个匹配",noMatches:"没有匹配项",invalidQuery:"正则表达式无效"}},zp={title:"引用库",description:"从 {{file}} 保存文献,并将它们导入当前 BibTeX 文件。引用库及其标签仅属于你自己。",myLibrary:"我的引用库",currentFile:"当前文件",searchPlaceholder:"搜索引用…",searchHint:"可搜索 key、标题、作者或年份",emptyTitle:"引用库还是空的",emptyDescription:"打开“当前文件”标签页,保存一个 BibTeX 文献条目。",noEntries:"没有找到 BibTeX 条目",noEntriesDescription:"请在当前文件中添加有效的 @article、@inproceedings 或其他文献条目。",currentFileTitle:"当前文件中的条目",currentFileDescription:"选择一个条目保存到你的引用库。",backToLibrary:"返回引用库",save:"保存",update:"更新",saving:"正在保存…",saved:"引用已保存到你的引用库。",updated:"引用已更新。",deleted:"引用已删除。",savedLabel:"已保存",import:"导入",importToFile:"导入到当前 BibTeX 文件",importRequiresWrite:"导入需要当前项目的写权限。",imported:"已将 {{key}} 导入当前文件。",untitled:"未命名引用",authorUnknown:"未填写作者",allTags:"全部标签",noTags:"还没有标签",noTagMatches:"没有匹配此标签的引用。",newTagPlaceholder:"新标签名称",tagColor:"标签颜色",createTag:"创建标签",tagCreated:"标签已创建。",tags:"标签",tagsTitle:"{{key}} 的标签",noTagsToAssign:"请先创建标签。",saveTags:"保存标签",tagsUpdated:"标签已更新。",editTitle:"编辑 {{key}}"},Vp={invalid:"请输入一个有效的 BibTeX 条目。",tooLarge:"BibTeX 条目过大。",notFound:"引用条目不存在。",keyExists:"引用 key 已经存在,请检查现有条目后再决定是否替换。",tagNotFound:"引用标签不存在。",conflict:"该引用已在其他位置发生修改,请刷新引用库后重试。",alreadyInFile:"{{key}} 已经存在于当前 BibTeX 文件中。"},Hp="在首页管理属于你自己的 BibTeX 文献和标签。打开 .bib 文件后即可保存或导入条目。",qp={addEntry:"添加条目",addEntryTitle:"添加 BibTeX 条目",addEntryDescription:"粘贴一个完整的 BibTeX 文献条目,保存前会进行校验。",addEntryPlaceholder:`@article{key,
9
+ author = {Author},
10
+ title = {Title},
11
+ year = {2026}
12
+ }`,added:"引用已添加到你的引用库。"},Kp={pageOf:"第 {{page}} / {{totalPages}} 页 · {{count}} 条引用",previous:"上一页",next:"下一页"},Gp={quickOpen:"快速打开",quickOpenDescription:"按名称打开项目文件(Ctrl/Cmd+P)。",filePlaceholder:"输入文件名…",noFiles:"没有匹配的文件。",projectSearch:"项目搜索",projectSearchDescription:"在项目源码文件中搜索和替换(Ctrl/Cmd+Shift+F)。",searchPlaceholder:"搜索全部源码文件…",replacePlaceholder:"替换为…",matchSummary:"共 {{count}} 个匹配",truncated:"仅显示前 {{count}} 个匹配。",replaceAll:"替换全部 {{count}} 项",replaceConfirmTitle:"在项目中批量替换",replaceConfirmDescription:"确定替换全部 {{count}} 个匹配?自动历史会记录所有修改文件。",replaced:"已在 {{files}} 个文件中替换 {{count}} 项。"},Yp={title:"历史",description:"浏览自动项目版本、比较文件,并安全恢复较早的工作。",empty:"尚无历史版本。",changedCount:"{{count}} 个文件有变化",fileCount:"{{count}} 个文件",changed:"有修改",labelPlaceholder:"为此版本命名",saveLabel:"保存标签",compareCurrent:"与当前版本比较",comparingCurrent:"历史版本与当前文件的比较",chooseFile:"选择文件后,可与当前源码进行比较。",restore:"恢复",restoreFile:"恢复文件",restoreProject:"恢复项目",restoreFileTitle:"恢复此文件",restoreProjectTitle:"恢复此项目版本",restoreFileDescription:"从此版本恢复 {{path}}?系统会先为当前项目创建安全检查点。",restoreProjectDescription:"恢复此版本的全部源码和编译器设置?系统会先为当前项目创建安全检查点。",storage:"历史存储",storageUsage:"已使用 {{used}},上限 {{limit}}",versionUsage:"普通版本 {{count}} / {{limit}}",protectedVersions:"{{count}} 个已标记版本",storageExceeded:"受保护版本或当前基线已超过存储软上限。",deleteVersion:"删除版本",deleteVersionTitle:"删除此历史版本",deleteVersionDescription:"永久删除“{{name}}”?当前项目文件不会改变。",clearAll:"清空历史",clearAllTitle:"清空全部项目历史",clearAllDescription:"永久删除全部历史版本及不再引用的存储数据?当前项目文件不会改变。",reasons:{initial:"项目创建",autosave:"自动保存",file:"文件操作",settings:"编译器设置",git:"Git 操作",restore:"恢复版本",checkpoint:"安全检查点"}},Wp={mainFile:"主文档",engine:"编译引擎",latexmkrc:"项目 latexmkrc",save:"保存项目设置",members:"共享成员",recentLog:"最近编译日志",share:"共享",shareDescription:"仅可共享给管理员已创建的用户。",chooseUser:"请选择用户",latexmkrcPlaceholder:`# 留空表示不使用项目 rc 文件
13
+ $pdf_mode = 1;`,addMember:"添加成员",noMembers:"该项目尚未分享给其他成员。",removeTitle:"移除共享成员",removeDescription:"确认移除 {{username}}?其账号和其他项目不会受到影响。",editorTab:"编辑器外观",compilerTab:"LaTeX 编译器",compilerDescription:"选择本项目所有成员共享的主文档和 LaTeX 编译选项。",editorAppearance:"编辑器外观",editorAppearanceDescription:"这些偏好仅作用于当前浏览器中的当前用户和项目;项目词典是共享的。",saveAppearance:"保存外观设置",saveCompiler:"保存编译器设置",writingCheckDescription:"Harper 在浏览器本地 worker 中运行。拼写问题使用红色波浪线,语法问题使用黄色波浪线;右键问题可以查看修改建议。",projectConfiguration:"项目配置",fontFamily:"英文字体",fontSize:"字体大小",lineHeight:"行间距",dictionary:"项目词典",dictionaryDescription:"添加到这里的词会导入 Harper 的自定义词典,并在本项目的拼写检查中忽略;具有编辑权限的用户可以维护此列表。",dictionaryPlaceholder:"添加自定义词",addWord:"添加词",dictionaryEmpty:"暂未添加自定义词。",lineWrapping:"自动换行",spellCheck:"拼写和语法检查",vimMode:"Vim 键位",vimModeDescription:"在当前编辑器中使用 Vim 的普通、插入和可视模式。",vimHelp:"查看帮助",formatOnCompile:"编译前自动格式化 LaTeX",formatOnCompileDescription:"默认关闭;格式化会在编译前执行。",formatRequiresWrite:"需要项目编辑权限才能使用格式化。",formatterDescription:"tex、cls、sty 使用内置的浏览器 tex-fmt WASM 格式化器;BibTeX 使用浏览器中的 bibtex-tidy。",formatterInstall:"查看 tex-fmt 包和文档",bibtexTidyInstall:"查看 bibtex-tidy",texFmtOptions:"tex-fmt 参数(TOML)",texFmtOptionsPlaceholder:`wrap = true
14
+ wraplen = 80`,texFmtOptionsDescription:"这些参数仅保存于当前用户和项目,并直接在浏览器中传递给 tex-fmt。",openFilesInTabs:"使用新 Tab 打开 LaTeX 文件",openFilesInTabsDescription:"在编辑器顶部通过标签页管理打开的 .tex、.bib、.sty 等源码文件。",writingIssues:"发现 {{count}} 个写作问题(去重后 {{uniqueCount}} 个)",noWritingIssues:"未发现拼写或语法问题。",spellCheckFirst:"第一个写作问题",spellCheckPrevious:"上一个写作问题",spellCheckNext:"下一个写作问题",spellCheckLast:"最后一个写作问题",spellCheckPosition:"第 {{current}}/{{total}} 个",fontJetBrains:"JetBrains Mono",fontSourceCode:"Source Code Pro",fontIbmPlex:"IBM Plex Mono",fontFiraCode:"Fira Code",fontIosevka:"Iosevka",lineHeightCompact:"紧凑",lineHeightNormal:"标准",lineHeightRelaxed:"宽松"},Xp={title:"Git 备份",description:"管理本地 Git 历史及 GitHub 备份;只有项目创建者可以执行这些操作。",ownerOnly:"只有项目所有者可以使用 Git 备份。",authentication:"GitHub 身份验证",authenticationHint:"token 需要仓库 Administration 与 Contents 写权限;它会加密保存,不会写入项目仓库或远程地址。",recommendedAccessTitle:"建议的仓库访问范围:All repositories(所有仓库)",recommendedAccess:"texLite 面向相互信任的用户。请选择 All repositories,使该 token 能创建仓库,并访问之后新建的仓库;同时授予 Administration 和 Contents 的 Read and write 权限。",token:"个人访问 token",tokenPlaceholder:"在此粘贴 GitHub token",replaceToken:"替换个人访问 token",saveToken:"保存并验证 token",createToken:"创建细粒度 token",connectedAs:"已连接为 @{{login}}",removeToken:"移除 token",tokenSaved:"GitHub token 已保存,本地仓库已就绪。",tokenRemoved:"GitHub token 已移除。",repository:"仓库",localReady:"项目源码已由本地 Git 仓库管理。",localPending:"保存有效 token 后将自动初始化本地 Git 仓库。",repositoryName:"GitHub 仓库名称",privateRepository:"创建为私有仓库",createRepository:"创建 GitHub 仓库",repositoryCreated:"GitHub 仓库创建成功。",origin:"远程仓库",openGitHub:"打开 GitHub",clean:"工作区干净",changedFiles:"{{count}} 个文件有修改",commitAndPush:"提交与推送",identity:"本次提交临时使用 {{username}} <{{username}}@texlite.com>,不会写入 Git 配置。",detachedHead:"当前处于 detached HEAD;请先返回默认分支再提交或推送。",detachedAt:"detached 于 {{revision}}",commitMessage:"提交说明",commitPlaceholder:"说明本次备份的内容…",commit:"提交",committed:"修改已提交。",noChangesToCommit:"当前没有新的修改可以提交。",push:"推送",pushed:"推送成功,GitHub 备份已是最新。",pushFailed:"推送失败",workingDiff:"当前差异",refresh:"刷新",diffTitle:"差异",diffTruncated:"输出已截断",diffFontSize:"差异字体大小",diffFontDecrease:"减小差异字体",diffFontIncrease:"增大差异字体",fullscreenDiff:"全屏查看差异",exitFullscreenDiff:"退出全屏",noChanges:"没有可显示的差异。",history:"提交历史",historyHint:"最多显示最近 100 次提交",noCommits:"尚无提交。",viewCommitDiff:"查看该提交的差异",checkoutVersion:"checkout 到该版本",checkoutTitle:"Checkout 版本",checkout:"Checkout",checkoutDescription:"将 checkout 到 {{revision}} — {{message}}。默认由 Git 保留兼容的未提交修改,发生冲突时拒绝操作。",forceCheckout:"强制覆盖",forceCheckoutDescription:"明确丢弃所有已跟踪及未跟踪的工作区修改后再 checkout;此操作不可撤销。",returnToBranch:"返回 {{branch}}",returnTitle:"返回默认分支",returnDescription:"将 checkout 到 {{branch}}。默认由 Git 保留兼容的未提交修改,发生冲突时拒绝操作。",discardChanges:"撤销修改",noChangesToDiscard:"当前没有可以撤销的修改。",discardTitle:"撤销未提交修改",discardDescription:"把所有已跟踪文件恢复到当前 HEAD(上次 commit)。未跟踪文件不受影响。",discardConfirm:"确认撤销"},Jp={title:"系统状态",description:"服务器实时健康状态和近期操作耗时,每五秒自动刷新。",refresh:"刷新",uptime:"运行时间",memory:"内存",heap:"堆内存",compileQueue:"编译任务",pending:"{{count}} 个等待中",collaboration:"协作",sessions:"{{count}} 个会话",roomsAndDirty:"{{rooms}} 个房间 · {{dirty}} 个待保存文件",eventLoop:"事件循环延迟",latencySummary:"P50 {{p50Ms}} ms · P95 {{p95Ms}} ms · 最大 {{maxMs}} ms",operationDurations:"近期操作耗时",noSamples:"尚未采集到操作样本。",operation:"操作",samples:"样本",last:"最近",max:"最大",operations:{collaboration:{connect:"打开协作房间",persist:"保存协作修改"},workspace:{project:"加载项目元数据",files:"加载项目文件",compileState:"加载保留的 PDF 状态"},compile:{snapshot:"准备编译快照",request:"编译请求总耗时",cacheSync:"更新编译缓存",latexmk:"运行 latexmk",artifactCopy:"发布编译产物"},outline:{build:"生成项目大纲"},search:{project:"项目内搜索"},completions:{build:"生成补全索引"}}},Zp={title:"标签",add:"添加标签",create:"新建标签",createDescription:"创建仅自己可见的可复用彩色标签,用于整理项目。",assign:"标签",assignTitle:"“{{project}}”的标签",assignDescription:"勾选你为此项目设置的私有标签;其他用户拥有各自的标签。",empty:"请先创建标签。",allAssigned:"所有可用标签均已添加。",name:"标签名称",color:"颜色",filter:"筛选",red:"红色",orange:"橙色",yellow:"黄色",green:"绿色",blue:"蓝色",purple:"紫色",gray:"灰色"},Qp={generic:"操作失败",request:"请求失败({{status}})",upload:"上传失败",boundaryTitle:"页面遇到问题",boundaryDescription:"渲染组件时发生异常。你可以尝试恢复,或刷新页面重新载入。",boundaryRetry:"重试",boundaryReload:"刷新页面",fileExists:"同名文件或文件夹已经存在。",pathConflict:"目标路径已经被文件或文件夹占用。",duplicateUploadNames:"所选文件中存在重复名称:{{files}}。",fileTooLarge:"文件超过 {{size}} MB 限制。",zipOnly:"请选择 ZIP 压缩包。",collaborationUnavailable:"实时协作尚未连接,请在重新连接后保存或编译。",codes:{AUTH_INVALID:"用户名或密码错误。",CURRENT_PASSWORD_INVALID:"当前密码错误。",USER_NOT_FOUND:"用户不存在或已被删除。",LAST_ADMIN:"系统必须保留至少一名可用管理员。",SELF_DELETE_FORBIDDEN:"不能删除当前登录的管理员。",PROJECT_CREATE_FORBIDDEN:"管理员尚未授予你创建项目的权限。",PROJECT_NOT_FOUND:"项目不存在或你已无法访问。",PROJECT_OWNER_ONLY:"只有项目所有者可以修改此设置。",PROJECT_EDIT_FORBIDDEN:"你没有此项目的编辑权限。",DICTIONARY_EDIT_FORBIDDEN:"你没有维护本项目词典的权限。",TAG_NOT_FOUND:"所选标签不存在。",GIT_TOKEN_INVALID:"请输入 GitHub token。",GIT_REPOSITORY_NAME_INVALID:"请输入 GitHub 仓库名称。",GIT_REVISION_INVALID:"请选择要 checkout 的 Git 版本。",PROJECT_DELETE_FORBIDDEN:"只有项目所有者可以删除项目。",MEMBERS_MANAGE_FORBIDDEN:"只有项目所有者可以管理项目成员。",OWNER_MEMBER_FORBIDDEN:"项目所有者不能作为成员添加。",INVALID_PATH:"文件路径无效。",RESERVED_PATH:"此路径由 TexLite 保留。",PATH_EXISTS:"目标路径已被文件或文件夹占用。",FILE_EXISTS:"同名文件已经存在。",PATH_NOT_FOUND:"文件或文件夹不存在。",FILE_NOT_FOUND:"文件不存在。",DIRECTORY_NOT_FOUND:"目标文件夹不存在。",MOVE_INTO_SELF:"不能把文件夹移动到自身内部。",MAIN_FILE_DELETE_FORBIDDEN:"不能删除主文档。",FILE_TOO_LARGE:"文件过大,无法打开或上传。",UPLOAD_EMPTY:"没有选择要上传的文件。",COMMENT_FILE_NOT_FOUND:"批注对应的文件不存在。",COMMENT_RANGE_INVALID:"批注的源码区间无效。",COMMENT_NOT_FOUND:"批注不存在。",COMMENT_EDIT_FORBIDDEN:"只能编辑自己的批注。",COMMENT_DELETE_FORBIDDEN:"只能删除自己的批注。",REPLY_NOT_FOUND:"回复不存在。",REPLY_EDIT_FORBIDDEN:"只能编辑自己的回复。",REPLY_DELETE_FORBIDDEN:"只能删除自己的回复。",COMMENT_UPDATE_EMPTY:"没有可更新的批注内容。",MAIN_FILE_NOT_FOUND:"所选主文档不存在。",LATEXMKRC_DISABLED:"管理员已禁用项目级 latexmkrc。",LATEXMKRC_NOT_FOUND:"所选 latexmkrc 文件不存在。",COMPILE_ARTIFACTS_NOT_FOUND:"尚无可用的编译产物。",COMPILE_ARTIFACT_NOT_FOUND:"编译产物不存在。",ARTIFACT_PREVIEW_UNSUPPORTED:"该产物不能作为文本预览,请下载后查看。",SYNC_SOURCE_INVALID:"源码位置无效。",SOURCE_FILE_NOT_FOUND:"源码文件不存在。",SYNCTEX_NOT_AVAILABLE:"尚无可用的 SyncTeX 数据,请重新编译。",SYNC_PDF_INVALID:"PDF 位置无效。",SYNCTEX_EXTERNAL_PATH:"SyncTeX 返回了项目外部的源码路径。",COMPILE_FORBIDDEN:"你没有编译此项目的权限。",PDF_NOT_FOUND:"尚未生成 PDF。",API_NOT_FOUND:"接口不存在。",SERVER_ERROR:"服务器无法完成请求。",REQUEST_INVALID:"请求格式无效。"}},em={historyVersionNotFound:"所选历史版本已不存在。",historyFileNotFound:"所选历史版本中没有这个文件。",historyTargetConflict:"当前恢复目标是目录或其他非普通文件路径。",historyPreviewUnsupported:"这个历史文件不能作为文本比较。",searchInvalid:"请输入有效的搜索内容。",gitUnavailable:"Git 集成功能不可用。请在宿主机安装 Git,或修正配置中的 git.binary 后重试。",formatFailed:"tex-fmt 无法格式化这段源码。",mainDocumentInvalid:"所选文件不是有效的 LaTeX 主文档。",compileSnapshotBusy:"源码尚未完成稳定保存,请稍后再试编译。"},tm={copyright:"© {{year}}",credit:"Designed and developed by CHEN Zhongpu"},nm={section:"章节",subsection:"小节",bold:"粗体",emphasis:"强调",citation:"引用文献",reference:"交叉引用",label:"标签",image:"插入图片",unordered:"无序列表",ordered:"有序列表",equation:"公式",figure:"图片环境",projectCommand:"项目命令",projectCommandArgs:"项目命令({{count}} 个参数)",projectMacro:"项目宏",expl3Command:"Expl3 项目命令",mathOperator:"项目数学算子",mathDelimiter:"项目数学定界符",projectEnvironment:"项目环境",projectFile:"项目文件",package:"宏包",documentClass:"文档类",currentFile:"当前文件",project:"项目",latex:"LaTeX",standard:"LaTeX 命令"},sm={common:_p,auth:Ip,projects:Mp,users:$p,editor:Up,citationLibrary:zp,citationErrors:Vp,citationLibraryHomeDescription:Hp,citationLibraryActions:qp,citationLibraryPagination:Kp,navigation:Gp,history:Yp,projectSettings:Wp,git:Xp,metrics:Jp,tags:Zp,errors:Qp,apiErrors:em,footer:tm,completions:nm};Ie.use(tl).use(vf).init({resources:{en:{translation:Pp},zh:{translation:sm}},fallbackLng:"en",supportedLngs:["en","zh"],nonExplicitSupportedLngs:!0,interpolation:{escapeValue:!1},detection:{order:["localStorage","navigator"],caches:["localStorage"]}});class la extends Error{constructor(e,n,r=null){super(e),this.status=n,this.code=r}status;code}async function W(t,e={}){const n=await fetch(t,{...e,headers:e.body?{"Content-Type":"application/json",...e.headers}:e.headers}),s=(n.headers.get("content-type")??"").includes("application/json")?await n.json():null;if(!n.ok)throw n.status===401&&typeof window<"u"&&window.dispatchEvent(new Event("texlite:session-expired")),new la(da(s,n.status),n.status,nl(s));return s}function da(t,e,n="errors.request"){const r=typeof t=="object"&&t!==null&&"error"in t&&typeof t.error=="string"?t.error:"",s=nl(t);if(s){const o={AUTH_REQUIRED:"auth.sessionExpired",ADMIN_REQUIRED:"users.adminRequired",HISTORY_VERSION_NOT_FOUND:"apiErrors.historyVersionNotFound",HISTORY_FILE_NOT_FOUND:"apiErrors.historyFileNotFound",HISTORY_TARGET_CONFLICT:"apiErrors.historyTargetConflict",HISTORY_FILE_PREVIEW_UNSUPPORTED:"apiErrors.historyPreviewUnsupported",SEARCH_QUERY_INVALID:"apiErrors.searchInvalid",GIT_UNAVAILABLE:"apiErrors.gitUnavailable",FORMAT_FAILED:"apiErrors.formatFailed",PROJECT_TRANSFER_FORBIDDEN:"projects.transferForbidden",PROJECT_TRANSFER_TARGET_INVALID:"projects.transferTargetInvalid",PROJECT_TRANSFER_SELF:"projects.transferSelf",MAIN_DOCUMENT_INVALID:"apiErrors.mainDocumentInvalid",COMPILE_SNAPSHOT_BUSY:"apiErrors.compileSnapshotBusy",COMPILE_CLEAN_BUSY:"editor.cleanBusy",CITATION_INVALID:"citationErrors.invalid",CITATION_TOO_LARGE:"citationErrors.tooLarge",CITATION_NOT_FOUND:"citationErrors.notFound",CITATION_KEY_EXISTS:"citationErrors.keyExists",CITATION_TAG_NOT_FOUND:"citationErrors.tagNotFound",CITATION_CONFLICT:"citationErrors.conflict"}[s]??`errors.codes.${s}`;if(Ie.exists(o))return Ie.t(o,{status:e,...typeof t=="object"&&t!==null?t:{}})}return Ie.resolvedLanguage?.startsWith("zh")&&r?r:Ie.t(n,{status:e})}function nl(t){return typeof t!="object"||t===null||!("code"in t)||typeof t.code!="string"?null:t.code}var rm=Object.defineProperty,qs=(t,e)=>rm(t,"name",{value:e,configurable:!0}),sl=!!(typeof window<"u"&&window.document&&window.document.createElement);function Pn(t,e,{checkForDefaultPrevented:n=!0}={}){return qs(function(s){if(t?.(s),n===!1||!s||!s.defaultPrevented)return e?.(s)},"handleEvent")}qs(Pn,"composeEventHandlers");function im(t){if(!sl)throw new Error("Cannot access window outside of the DOM");return t?.ownerDocument?.defaultView??window}qs(im,"getOwnerWindow");function To(t){if(!sl)throw new Error("Cannot access document outside of the DOM");return t?.ownerDocument??document}qs(To,"getOwnerDocument");function rl(t,e=!1){const{activeElement:n}=To(t);if(!n?.nodeName)return null;if(il(n)&&n.contentDocument)return rl(n.contentDocument.body,e);if(e){const r=n.getAttribute("aria-activedescendant");if(r){const s=To(n).getElementById(r);if(s)return s}}return n}qs(rl,"getActiveElement");function il(t){return t.tagName==="IFRAME"}qs(il,"isFrame");var om=Object.defineProperty,ha=(t,e)=>om(t,"name",{value:e,configurable:!0});function No(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}ha(No,"setRef");function ol(...t){return e=>{let n=!1;const r=t.map(s=>{const o=No(s,e);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let s=0;s<r.length;s++){const o=r[s];typeof o=="function"?o():No(t[s],null)}}}}ha(ol,"composeRefs");function Ks(...t){return h.useCallback(ol(...t),t)}ha(Ks,"useComposedRefs");var am=Object.defineProperty,Kt=(t,e)=>am(t,"name",{value:e,configurable:!0});function um(t,e){const n=h.createContext(e);n.displayName=t+"Context";const r=Kt(o=>{const{children:a,...u}=o,c=h.useMemo(()=>u,Object.values(u));return i.jsx(n.Provider,{value:c,children:a})},"Provider");r.displayName=t+"Provider";function s(o,a={}){const{optional:u=!1}=a,c=h.useContext(n);if(c)return c;if(e!==void 0)return e;if(!u)throw new Error(`\`${o}\` must be used within \`${t}\``)}return Kt(s,"useContext"),[r,s]}Kt(um,"createContext");function al(t,e=[]){let n=[];function r(o,a){const u=h.createContext(a);u.displayName=o+"Context";const c=n.length;n=[...n,a];const l=Kt(d=>{const{scope:p,children:D,...g}=d,y=p?.[t]?.[c]||u,x=h.useMemo(()=>g,Object.values(g));return i.jsx(y.Provider,{value:x,children:D})},"Provider");l.displayName=o+"Provider";function f(d,p,D={}){const{optional:g=!1}=D,y=p?.[t]?.[c]||u,x=h.useContext(y);if(x)return x;if(a!==void 0)return a;if(!g)throw new Error(`\`${d}\` must be used within \`${o}\``)}return Kt(f,"useContext"),[l,f]}Kt(r,"createContext");const s=Kt(()=>{const o=n.map(a=>h.createContext(a));return Kt(function(u){const c=u?.[t]||o;return h.useMemo(()=>({[`__scope${t}`]:{...u,[t]:c}}),[u,c])},"useScope")},"createScope");return s.scopeName=t,[r,ul(s,...e)]}Kt(al,"createContextScope");function ul(...t){const e=t[0];if(t.length===1)return e;const n=Kt(()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return Kt(function(o){const a=r.reduce((u,{useScope:c,scopeName:l})=>{const d=c(o)[`__scope${l}`];return{...u,...d}},{});return h.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])},"useComposedScopes")},"createScope");return n.scopeName=e.scopeName,n}Kt(ul,"composeContextScopes");var _n=globalThis?.document?h.useLayoutEffect:()=>{},cm=Object.defineProperty,lm=(t,e)=>cm(t,"name",{value:e,configurable:!0}),dm=Cr[" useId ".trim().toString()]||(()=>{}),hm=0;function Qr(t){const[e,n]=h.useState(dm());return _n(()=>{t||n(r=>r??String(hm++))},[t]),t||(e?`radix-${e}`:"")}lm(Qr,"useId");var fm=Object.defineProperty,pm=(t,e)=>fm(t,"name",{value:e,configurable:!0}),Hu=Cr[" useEffectEvent ".trim().toString()],qu=Cr[" useInsertionEffect ".trim().toString()];function cl(t){if(typeof Hu=="function")return Hu(t);const e=h.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof qu=="function"?qu(()=>{e.current=t}):_n(()=>{e.current=t}),h.useMemo(()=>((...n)=>e.current?.(...n)),[])}pm(cl,"useEffectEvent");var mm=Object.defineProperty,Er=(t,e)=>mm(t,"name",{value:e,configurable:!0}),Dm=Cr[" useInsertionEffect ".trim().toString()]||_n;function ll({prop:t,defaultProp:e,onChange:n=Er(()=>{},"onChange"),caller:r}){const[s,o,a]=dl({defaultProp:e,onChange:n}),u=t!==void 0,c=u?t:s,l=h.useCallback(f=>{if(u){const d=hl(f)?f(t):f;d!==t&&a.current?.(d)}else o(f)},[u,t,o,a]);return[c,l]}Er(ll,"useControllableState");function dl({defaultProp:t,onChange:e}){const[n,r]=h.useState(t),s=h.useRef(n),o=h.useRef(e);return Dm(()=>{o.current=e},[e]),h.useEffect(()=>{s.current!==n&&(o.current?.(n),s.current=n)},[n,s]),[n,r,o]}Er(dl,"useUncontrolledState");function hl(t){return typeof t=="function"}Er(hl,"isFunction");var Ku=Symbol("RADIX:SYNC_STATE");function gm(t,e,n,r){const{prop:s,defaultProp:o,onChange:a,caller:u}=e,c=s!==void 0,l=cl(a),f=[{...n,state:o}];r&&f.push(r);const[d,p]=h.useReducer((x,A)=>{if(A.type===Ku)return{...x,state:A.state};const L=t(x,A);return c&&!Object.is(L.state,x.state)&&l(L.state),L},...f),D=d.state,g=h.useRef(D);h.useEffect(()=>{g.current!==D&&(g.current=D,c||l(D))},[D,g,c]);const y=h.useMemo(()=>s!==void 0?{...d,state:s}:d,[d,s]);return h.useEffect(()=>{c&&!Object.is(s,d.state)&&p({type:Ku,state:s})},[s,d.state,c]),[y,p]}Er(gm,"useControllableStateReducer");var Fm=Object.defineProperty,nn=(t,e)=>Fm(t,"name",{value:e,configurable:!0});function fa(t){const e=h.forwardRef((n,r)=>{let{children:s,...o}=n,a=null,u=!1;const c=[];Lo(s)&&typeof Hr=="function"&&(s=Hr(s._payload)),h.Children.forEach(s,p=>{if(Dl(p)){u=!0;const D=p;let g="child"in D.props?D.props.child:D.props.children;Lo(g)&&typeof Hr=="function"&&(g=Hr(g._payload)),a=ym(D,g),c.push(a?.props?.children)}else c.push(p)}),a?a=h.cloneElement(a,void 0,c):!u&&h.Children.count(s)===1&&h.isValidElement(s)&&(a=s);const l=a?ml(a):void 0,f=Ks(r,l);if(!a){if(s||s===0)throw new Error(u?xm(t):Em(t));return s}const d=pl(o,a.props??{});return a.type!==h.Fragment&&(d.ref=r?f:l),h.cloneElement(a,d)});return e.displayName=`${t}.Slot`,e}nn(fa,"createSlot");var fl=Symbol.for("radix.slottable");function bm(t){const e=nn(n=>"child"in n?n.children(n.child):n.children,"Slottable");return e.displayName=`${t}.Slottable`,e.__radixId=fl,e}nn(bm,"createSlottable");var ym=nn((t,e)=>{if("child"in t.props){const n=t.props.child;return h.isValidElement(n)?h.cloneElement(n,void 0,t.props.children(n.props.children)):null}return h.isValidElement(e)?e:null},"getSlottableElementFromSlottable");function pl(t,e){const n={...e};for(const r in e){const s=t[r],o=e[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...u)=>{const c=o(...u);return s(...u),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...t,...n}}nn(pl,"mergeProps");function ml(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}nn(ml,"getElementRef");function Dl(t){return h.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===fl}nn(Dl,"isSlottable");var Cm=Symbol.for("react.lazy");function Lo(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===Cm&&"_payload"in t&&gl(t._payload)}nn(Lo,"isLazyComponent");function gl(t){return typeof t=="object"&&t!==null&&"then"in t}nn(gl,"isPromiseLike");var Em=nn(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),xm=nn(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Hr=Cr[" use ".trim().toString()],wm=Object.defineProperty,Am=(t,e)=>wm(t,"name",{value:e,configurable:!0}),vm=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Qn=vm.reduce((t,e)=>{const n=fa(`Primitive.${e}`),r=h.forwardRef((s,o)=>{const{asChild:a,...u}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(c,{...u,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Fl(t,e){t&&Yc.flushSync(()=>t.dispatchEvent(e))}Am(Fl,"dispatchDiscreteCustomEvent");var km=Object.defineProperty,Sm=(t,e)=>km(t,"name",{value:e,configurable:!0});function Ls(t){const e=h.useRef(t);return h.useEffect(()=>{e.current=t}),h.useMemo(()=>((...n)=>e.current?.(...n)),[])}Sm(Ls,"useCallbackRef");var jm=Object.defineProperty,xt=(t,e)=>jm(t,"name",{value:e,configurable:!0}),Oo="dismissableLayer.update",Bm="dismissableLayer.pointerDownOutside",Tm="dismissableLayer.focusOutside",Gu,bl=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Nm=h.forwardRef(xt(function(e,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:s=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:u,onInteractOutside:c,onDismiss:l,...f}=e,d=h.useContext(bl),[p,D]=h.useState(null),g=p?.ownerDocument??globalThis?.document,[,y]=h.useState({}),x=Ks(n,D),A=Array.from(d.layers),[L]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),R=L?A.indexOf(L):-1,I=p?A.indexOf(p):-1,M=d.layersWithOutsidePointerEventsDisabled.size>0,X=I>=R,O=h.useRef(!1),re=Cl(U=>{a?.(U),c?.(U),U.defaultPrevented||l?.()},{ownerDocument:g,deferPointerDownOutside:s,isDeferredPointerDownOutsideRef:O,dismissableSurfaces:d.dismissableSurfaces,shouldHandlePointerDownOutside:h.useCallback(U=>{if(!(U instanceof Node))return!1;const H=[...d.branches].some(P=>P.contains(U));return X&&!H},[d.branches,X])}),v=El(U=>{if(s&&O.current)return;const H=U.target;[...d.branches].some(S=>S.contains(H))||(u?.(U),c?.(U),U.defaultPrevented||l?.())},g),Z=p?I===A.length-1:!1,le=Ls(U=>{U.key==="Escape"&&(o?.(U),!U.defaultPrevented&&l&&(U.preventDefault(),l()))});return h.useEffect(()=>{if(Z)return g.addEventListener("keydown",le,{capture:!0}),()=>g.removeEventListener("keydown",le,{capture:!0})},[g,Z,le]),h.useEffect(()=>{if(p)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Gu=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),Ro(),()=>{r&&(d.layersWithOutsidePointerEventsDisabled.delete(p),d.layersWithOutsidePointerEventsDisabled.size===0&&(g.body.style.pointerEvents=Gu))}},[p,g,r,d]),h.useEffect(()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),Ro())},[p,d]),h.useEffect(()=>{const U=xt(()=>y({}),"handleUpdate");return document.addEventListener(Oo,U),()=>document.removeEventListener(Oo,U)},[]),i.jsx(Qn.div,{...f,ref:x,style:{pointerEvents:M?X?"auto":"none":void 0,...e.style},onFocusCapture:Pn(e.onFocusCapture,v.onFocusCapture),onBlurCapture:Pn(e.onBlurCapture,v.onBlurCapture),onPointerDownCapture:Pn(e.onPointerDownCapture,re.onPointerDownCapture)})},"DismissableLayer"));function yl(){const t=h.useContext(bl),[e,n]=h.useState(null);return h.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}xt(yl,"useDismissableLayerSurface");var Lm=xt(()=>!0,"IS_TRUE");function Cl(t,e){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:o,shouldHandlePointerDownOutside:a=Lm}=e,u=Ls(t),c=h.useRef(!1),l=h.useRef(!1),f=h.useRef(new Map),d=h.useRef(()=>{});return h.useEffect(()=>{function p(){l.current=!1,s.current=!1,f.current.clear()}xt(p,"resetOutsideInteraction");function D(){return Array.from(f.current.values()).some(Boolean)}xt(D,"isOutsideInteractionIntercepted");function g(R){if(!l.current)return;const I=R.target;I instanceof Node&&[...o].some(X=>X.contains(I))||f.current.set(R.type,!0),R.type==="click"&&window.setTimeout(()=>{l.current&&d.current()},0)}xt(g,"handleInteractionCapture");function y(R){l.current&&f.current.set(R.type,!1)}xt(y,"handleInteractionBubble");const x=xt(R=>{if(R.target&&!c.current){let I=function(){n.removeEventListener("click",d.current);const X=D();p(),X||pa(Bm,u,M,{discrete:!0})};if(xt(I,"handleAndDispatchPointerDownOutsideEvent"),!a(R.target)){n.removeEventListener("click",d.current),p(),c.current=!1;return}const M={originalEvent:R};l.current=!0,s.current=r&&R.button===0,f.current.clear(),!r||R.button!==0?I():(n.removeEventListener("click",d.current),d.current=I,n.addEventListener("click",d.current,{once:!0}))}else n.removeEventListener("click",d.current),p();c.current=!1},"handlePointerDown"),A=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const R of A)n.addEventListener(R,g,!0),n.addEventListener(R,y);const L=window.setTimeout(()=>{n.addEventListener("pointerdown",x)},0);return()=>{window.clearTimeout(L),n.removeEventListener("pointerdown",x),n.removeEventListener("click",d.current);for(const R of A)n.removeEventListener(R,g,!0),n.removeEventListener(R,y)}},[n,u,r,s,o,a]),{onPointerDownCapture:xt(()=>c.current=!0,"onPointerDownCapture")}}xt(Cl,"usePointerDownOutside");function El(t,e=globalThis?.document){const n=Ls(t),r=h.useRef(!1);return h.useEffect(()=>{const s=xt(o=>{o.target&&!r.current&&pa(Tm,n,{originalEvent:o},{discrete:!1})},"handleFocus");return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,n]),{onFocusCapture:xt(()=>r.current=!0,"onFocusCapture"),onBlurCapture:xt(()=>r.current=!1,"onBlurCapture")}}xt(El,"useFocusOutside");function Ro(){const t=new CustomEvent(Oo);document.dispatchEvent(t)}xt(Ro,"dispatchUpdate");function pa(t,e,n,{discrete:r}){const s=n.originalEvent.target,o=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?Fl(s,o):s.dispatchEvent(o)}xt(pa,"handleAndDispatchCustomEvent");var Om=Object.defineProperty,Pt=(t,e)=>Om(t,"name",{value:e,configurable:!0}),ro="focusScope.autoFocusOnMount",io="focusScope.autoFocusOnUnmount",Yu={bubbles:!1,cancelable:!0},Rm=h.forwardRef(Pt(function(e,n){const{loop:r=!1,trapped:s=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...u}=e,[c,l]=h.useState(null),f=Ls(o),d=Ls(a),p=h.useRef(null),D=Ks(n,l),g=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(s){let x=function(I){if(g.paused||!c)return;const M=I.target;c.contains(M)?p.current=M:En(p.current,{select:!0})},A=function(I){if(g.paused||!c)return;const M=I.relatedTarget;M!==null&&(c.contains(M)||En(p.current,{select:!0}))},L=function(I){if(document.activeElement===document.body)for(const X of I)X.removedNodes.length>0&&En(c)};Pt(x,"handleFocusIn"),Pt(A,"handleFocusOut"),Pt(L,"handleMutations"),document.addEventListener("focusin",x),document.addEventListener("focusout",A);const R=new MutationObserver(L);return c&&R.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",x),document.removeEventListener("focusout",A),R.disconnect()}}},[s,c,g.paused]),h.useEffect(()=>{if(c){Wu.add(g);const x=document.activeElement;if(!c.contains(x)){const L=new CustomEvent(ro,Yu);c.addEventListener(ro,f),c.dispatchEvent(L),L.defaultPrevented||(xl(Sl(ma(c)),{select:!0}),document.activeElement===x&&En(c))}return()=>{c.removeEventListener(ro,f),setTimeout(()=>{const L=new CustomEvent(io,Yu);c.addEventListener(io,d),c.dispatchEvent(L),L.defaultPrevented||En(x??document.body,{select:!0}),c.removeEventListener(io,d),Wu.remove(g)},0)}}},[c,f,d,g]);const y=h.useCallback(x=>{if(!r&&!s||g.paused)return;const A=x.key==="Tab"&&!x.altKey&&!x.ctrlKey&&!x.metaKey,L=document.activeElement;if(A&&L){const R=x.currentTarget,[I,M]=wl(R);I&&M?!x.shiftKey&&L===M?(x.preventDefault(),r&&En(I,{select:!0})):x.shiftKey&&L===I&&(x.preventDefault(),r&&En(M,{select:!0})):L===R&&x.preventDefault()}},[r,s,g.paused]);return i.jsx(Qn.div,{tabIndex:-1,...u,ref:D,onKeyDown:y})},"FocusScope"));function xl(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(En(r,{select:e}),document.activeElement!==n)return}Pt(xl,"focusFirst");function wl(t){const e=ma(t),n=Po(e,t),r=Po(e.reverse(),t);return[n,r]}Pt(wl,"getTabbableEdges");function ma(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:Pt(r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)e.push(n.currentNode);return e}Pt(ma,"getTabbableCandidates");function Po(t,e){const n=typeof e.checkVisibility=="function"&&e.checkVisibility({checkVisibilityCSS:!0});for(const r of t)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Al(r,{upTo:e})))return r}Pt(Po,"findVisible");function Al(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}Pt(Al,"isHidden");function vl(t){return t instanceof HTMLInputElement&&"select"in t}Pt(vl,"isSelectableInput");function En(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&vl(t)&&e&&t.select()}}Pt(En,"focus");var Wu=kl();function kl(){let t=[];return{add(e){const n=t[0];e!==n&&n?.pause(),t=_o(t,e),t.unshift(e)},remove(e){t=_o(t,e),t[0]?.resume()}}}Pt(kl,"createFocusScopesStack");function _o(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}Pt(_o,"arrayRemove");function Sl(t){return t.filter(e=>e.tagName!=="A")}Pt(Sl,"removeLinks");var Pm=Object.defineProperty,_m=(t,e)=>Pm(t,"name",{value:e,configurable:!0}),Im=h.forwardRef(_m(function(e,n){const{container:r,...s}=e,[o,a]=h.useState(!1);_n(()=>a(!0),[]);const u=r||o&&globalThis?.document?.body;return u?Yc.createPortal(i.jsx(Qn.div,{...s,ref:n}),u):null},"Portal")),Mm=Object.defineProperty,An=(t,e)=>Mm(t,"name",{value:e,configurable:!0});function jl(t,e){return h.useReducer((n,r)=>e[n][r]??n,t)}An(jl,"useStateMachine");var Da=An(t=>{const{present:e,children:n}=t,r=Bl(e),s=typeof n=="function"?n({present:r.isPresent}):h.Children.only(n),o=Tl(r.ref,Nl(s));return typeof n=="function"||r.isPresent?h.cloneElement(s,{ref:o}):null},"Presence");function Bl(t){const[e,n]=h.useState(),r=h.useRef(null),s=h.useRef(t),o=h.useRef("none"),a=h.useRef(void 0),u=t?"mounted":"unmounted",[c,l]=jl(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{c==="mounted"?(o.current=a.current??gs(r.current),a.current=void 0):o.current="none"},[c]),_n(()=>{const f=r.current,d=s.current;if(d!==t){const D=o.current,g=gs(f);t?(a.current=g,l("MOUNT")):g==="none"||f?.display==="none"?l("UNMOUNT"):l(d&&D!==g?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,l]),_n(()=>{if(e){let f;const d=e.ownerDocument.defaultView??window,p=An(g=>{const x=gs(r.current).includes(CSS.escape(g.animationName));if(g.target===e&&x&&(l("ANIMATION_END"),!s.current)){const A=e.style.animationFillMode;e.style.animationFillMode="forwards",f=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=A)})}},"handleAnimationEnd"),D=An(g=>{g.target===e&&(o.current=gs(r.current))},"handleAnimationStart");return e.addEventListener("animationstart",D),e.addEventListener("animationcancel",p),e.addEventListener("animationend",p),()=>{d.clearTimeout(f),e.removeEventListener("animationstart",D),e.removeEventListener("animationcancel",p),e.removeEventListener("animationend",p)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:h.useCallback(f=>{if(f){const d=getComputedStyle(f);r.current=d,a.current=gs(d)}else r.current=null;n(f)},[])}}An(Bl,"usePresence");function Io(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}An(Io,"setRef");function Tl(...t){const e=h.useRef(t);return e.current=t,h.useCallback(n=>{const r=e.current;let s=!1;const o=r.map(a=>{const u=Io(a,n);return!s&&typeof u=="function"&&(s=!0),u});if(s)return()=>{for(let a=0;a<o.length;a++){const u=o[a];typeof u=="function"?u():Io(r[a],null)}}},[])}An(Tl,"useStableComposedRefs");function gs(t){return t?.animationName||"none"}An(gs,"getAnimationName");function Nl(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}An(Nl,"getElementRef");var $m=Object.defineProperty,ga=(t,e)=>$m(t,"name",{value:e,configurable:!0}),qr=0,fs=null;function Um(t){return Fa(),t.children}ga(Um,"FocusGuards");function Fa(){h.useEffect(()=>{fs||(fs={start:Mo(),end:Mo()});const{start:t,end:e}=fs;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),qr++,()=>{qr===1&&(fs?.start.remove(),fs?.end.remove(),fs=null),qr=Math.max(0,qr-1)}},[])}ga(Fa,"useFocusGuards");function Mo(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}ga(Mo,"createFocusGuard");var zm=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},ps=new WeakMap,Kr=new WeakMap,Gr={},oo=0,Ll=function(t){return t&&(t.host||Ll(t.parentNode))},Vm=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=Ll(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},Hm=function(t,e,n,r){var s=Vm(e,Array.isArray(t)?t:[t]);Gr[n]||(Gr[n]=new WeakMap);var o=Gr[n],a=[],u=new Set,c=new Set(s),l=function(d){!d||u.has(d)||(u.add(d),l(d.parentNode))};s.forEach(l);var f=function(d){!d||c.has(d)||Array.prototype.forEach.call(d.children,function(p){if(u.has(p))f(p);else try{var D=p.getAttribute(r),g=D!==null&&D!=="false",y=(ps.get(p)||0)+1,x=(o.get(p)||0)+1;ps.set(p,y),o.set(p,x),a.push(p),y===1&&g&&Kr.set(p,!0),x===1&&p.setAttribute(n,"true"),g||p.setAttribute(r,"true")}catch(A){console.error("aria-hidden: cannot operate on ",p,A)}})};return f(e),u.clear(),oo++,function(){a.forEach(function(d){var p=ps.get(d)-1,D=o.get(d)-1;ps.set(d,p),o.set(d,D),p||(Kr.has(d)||d.removeAttribute(r),Kr.delete(d)),D||d.removeAttribute(n)}),oo--,oo||(ps=new WeakMap,ps=new WeakMap,Kr=new WeakMap,Gr={})}},qm=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),s=zm(t);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),Hm(r,s,n,"aria-hidden")):function(){return null}},Km=Object.defineProperty,Wt=(t,e)=>Km(t,"name",{value:e,configurable:!0}),ba="Dialog",[Ol,h2]=al(ba),[Gm,hn]=Ol(ba),Ym=Wt(t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:s,onOpenChange:o,modal:a=!0}=t,u=h.useRef(null),c=h.useRef(null),[l,f]=ll({prop:r,defaultProp:s??!1,onChange:o,caller:ba}),[d,p]=h.useState(0),[D,g]=h.useState(0);return i.jsx(Gm,{scope:e,triggerRef:u,contentRef:c,contentId:Qr(),titleId:Qr(),descriptionId:Qr(),titlePresent:d>0,descriptionPresent:D>0,setTitleCount:p,setDescriptionCount:g,open:l,onOpenChange:f,onOpenToggle:h.useCallback(()=>f(y=>!y),[f]),modal:a,children:n})},"Dialog"),Rl="DialogPortal",[Wm,Pl]=Ol(Rl,{forceMount:void 0}),Xm=Wt(t=>{const{__scopeDialog:e,forceMount:n,children:r,container:s}=t,o=hn(Rl,e);return i.jsx(Wm,{scope:e,forceMount:n,children:h.Children.map(r,a=>i.jsx(Da,{present:n||o.open,children:i.jsx(Im,{asChild:!0,container:s,children:a})}))})},"DialogPortal"),$o="DialogOverlay",Jm=h.forwardRef(Wt(function(e,n){const r=Pl($o,e.__scopeDialog),{forceMount:s=r.forceMount,...o}=e,a=hn($o,e.__scopeDialog);return a.modal?i.jsx(Da,{present:s||a.open,children:i.jsx(Qm,{...o,ref:n})}):null},"DialogOverlay")),Zm=fa("DialogOverlay.RemoveScroll"),Qm=h.forwardRef(Wt(function(e,n){const{__scopeDialog:r,...s}=e,o=hn($o,r),a=yl(),u=Ks(n,a);return i.jsx(kf,{as:Zm,allowPinchZoom:!0,shards:[o.contentRef],children:i.jsx(Qn.div,{"data-state":ya(o.open),...s,ref:u,style:{pointerEvents:"auto",...s.style}})})},"DialogOverlayImpl")),ur="DialogContent",eD=h.forwardRef(Wt(function(e,n){const r=Pl(ur,e.__scopeDialog),{forceMount:s=r.forceMount,...o}=e,a=hn(ur,e.__scopeDialog);return i.jsx(Da,{present:s||a.open,children:a.modal?i.jsx(tD,{...o,ref:n}):i.jsx(nD,{...o,ref:n})})},"DialogContent")),tD=h.forwardRef(Wt(function(e,n){const r=hn(ur,e.__scopeDialog),s=h.useRef(null),o=Ks(n,r.contentRef,s);return h.useEffect(()=>{const a=s.current;if(a)return qm(a)},[]),i.jsx(_l,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:Pn(e.onCloseAutoFocus,a=>{a.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Pn(e.onPointerDownOutside,a=>{const u=a.detail.originalEvent,c=u.button===0&&u.ctrlKey===!0;(u.button===2||c)&&a.preventDefault()}),onFocusOutside:Pn(e.onFocusOutside,a=>a.preventDefault())})},"DialogContentModal")),nD=h.forwardRef(Wt(function(e,n){const r=hn(ur,e.__scopeDialog),s=h.useRef(!1),o=h.useRef(!1);return i.jsx(_l,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(s.current||r.triggerRef.current?.focus(),a.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(s.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const u=a.target;r.triggerRef.current?.contains(u)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}})},"DialogContentNonModal")),_l=h.forwardRef(Wt(function(e,n){const{__scopeDialog:r,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:a,...u}=e,c=hn(ur,r);return Fa(),i.jsx(i.Fragment,{children:i.jsx(Rm,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:a,children:i.jsx(Nm,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionPresent?c.descriptionId:void 0,"aria-labelledby":c.titlePresent?c.titleId:void 0,"data-state":ya(c.open),...u,ref:n,deferPointerDownOutside:!0,onDismiss:()=>c.onOpenChange(!1)})})})},"DialogContentImpl")),sD="DialogTitle",rD=h.forwardRef(Wt(function(e,n){const{__scopeDialog:r,...s}=e,o=hn(sD,r),{setTitleCount:a}=o;return _n(()=>(a(u=>u+1),()=>a(u=>u-1)),[a]),i.jsx(Qn.h2,{id:o.titleId,...s,ref:n})},"DialogTitle")),iD="DialogDescription",oD=h.forwardRef(Wt(function(e,n){const{__scopeDialog:r,...s}=e,o=hn(iD,r),{setDescriptionCount:a}=o;return _n(()=>(a(u=>u+1),()=>a(u=>u-1)),[a]),i.jsx(Qn.p,{id:o.descriptionId,...s,ref:n})},"DialogDescription")),aD="DialogClose",uD=h.forwardRef(Wt(function(e,n){const{__scopeDialog:r,...s}=e,o=hn(aD,r);return i.jsx(Qn.button,{type:"button",...s,ref:n,onClick:Pn(e.onClick,()=>o.onOpenChange(!1))})},"DialogClose"));function ya(t){return t?"open":"closed"}Wt(ya,"getState");function it({open:t,title:e,description:n,onOpenChange:r,children:s,footer:o,wide:a,extraWide:u,className:c}){const{t:l}=at();return i.jsx(Ym,{open:t,onOpenChange:r,children:i.jsxs(Xm,{children:[i.jsx(Jm,{className:"dialog-overlay"}),i.jsxs(eD,{className:`dialog-content${a?" dialog-wide":""}${u?" dialog-extra-wide":""}${c?` ${c}`:""}`,children:[i.jsxs("div",{className:"dialog-header",children:[i.jsxs("div",{children:[i.jsx(rD,{children:e}),n&&i.jsx(oD,{children:n})]}),i.jsx(uD,{className:"dialog-close","aria-label":l("common.close"),children:"×"})]}),i.jsx("div",{className:"dialog-body",children:s}),o&&i.jsx("div",{className:"dialog-footer",children:o})]})]})})}function Os({open:t,title:e,description:n,confirmLabel:r,danger:s,onCancel:o,onConfirm:a}){const{t:u}=at();return i.jsx(it,{open:t,title:e,description:n,onOpenChange:c=>{c||o()},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:o,children:u("common.cancel")}),i.jsx("button",{className:s?"danger":"primary",onClick:a,children:r??u("common.remove")})]}),children:i.jsx("div",{})})}function Ca({compact:t=!1}){const{i18n:e,t:n}=at(),r=e.resolvedLanguage?.startsWith("zh")?"zh":"en";return i.jsxs("label",{className:`language-switcher${t?" compact":""}`,title:n("common.language"),children:[i.jsx("span",{children:"文/A"}),i.jsxs("select",{value:r,"aria-label":n("common.language"),onChange:s=>{e.changeLanguage(s.target.value)},children:[i.jsx("option",{value:"en",children:n("common.languageEnglish")}),i.jsx("option",{value:"zh",children:n("common.languageChinese")})]})]})}const cD=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Il=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();var lD={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const dD=h.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:o,iconNode:a,...u},c)=>h.createElement("svg",{ref:c,...lD,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:Il("lucide",s),...u},[...a.map(([l,f])=>h.createElement(l,f)),...Array.isArray(o)?o:[o]]));const q=(t,e)=>{const n=h.forwardRef(({className:r,...s},o)=>h.createElement(dD,{ref:o,iconNode:e,className:Il(`lucide-${cD(t)}`,r),...s}));return n.displayName=`${t}`,n};const hD=q("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);const Ml=q("AlignLeft",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);const fD=q("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);const Xu=q("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);const pD=q("ArrowDownUp",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"m21 8-4-4-4 4",key:"1c9v7m"}],["path",{d:"M17 4v16",key:"7dpous"}]]);const Uo=q("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const ao=q("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);const Cs=q("BookMarked",[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);const zo=q("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);const mD=q("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);const Wn=q("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const $l=q("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const ir=q("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const vi=q("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const DD=q("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);const gD=q("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);const FD=q("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const Ea=q("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);const Ju=q("Columns2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);const bD=q("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const yD=q("Dices",[["rect",{width:"12",height:"12",x:"2",y:"10",rx:"2",ry:"2",key:"6agr2n"}],["path",{d:"m17.92 14 3.5-3.5a2.24 2.24 0 0 0 0-3l-5-4.92a2.24 2.24 0 0 0-3 0L10 6",key:"1o487t"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 14h.01",key:"ssrbsk"}],["path",{d:"M15 6h.01",key:"cblpky"}],["path",{d:"M18 9h.01",key:"2061c0"}]]);const cr=q("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);const Vo=q("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);const Ho=q("FileArchive",[["path",{d:"M10 12v-1",key:"v7bkov"}],["path",{d:"M10 18v-2",key:"1cjy8d"}],["path",{d:"M10 7V6",key:"dljcrl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01",key:"gkbcor"}],["circle",{cx:"10",cy:"20",r:"2",key:"1xzdoj"}]]);const CD=q("FilePlus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]);const ED=q("FileSearch",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]]);const Es=q("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const xD=q("FolderCheck",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"m9 13 2 2 4-4",key:"6343dt"}]]);const qo=q("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);const Ul=q("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);const wD=q("FolderX",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"m9.5 10.5 5 5",key:"ra9qjz"}],["path",{d:"m14.5 10.5-5 5",key:"l2rkpq"}]]);const AD=q("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);const vD=q("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);const uo=q("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);const kD=q("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);const SD=q("Import",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m8 11 4 4 4-4",key:"1dohi6"}],["path",{d:"M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4",key:"1ywtjm"}]]);const Zu=q("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);const jD=q("Keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);const BD=q("ListTree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]);const Lt=q("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const zl=q("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);const Qu=q("Move",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]);const Vl=q("PackageOpen",[["path",{d:"M12 22v-9",key:"x3hkom"}],["path",{d:"M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z",key:"2ntwy6"}],["path",{d:"M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13",key:"1pmm1c"}],["path",{d:"M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z",key:"12ttoo"}]]);const ec=q("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);const TD=q("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);const ND=q("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);const LD=q("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);const OD=q("PanelsTopLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]);const RD=q("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);const Ko=q("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);const PD=q("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);const ei=q("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const _D=q("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);const ID=q("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);const ui=q("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);const Go=q("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);const Hl=q("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);const MD=q("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);const Yo=q("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const $D=q("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const UD=q("ShieldOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]);const zD=q("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);const VD=q("SpellCheck2",[["path",{d:"m6 16 6-12 6 12",key:"1b4byz"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M4 21c1.1 0 1.1-1 2.3-1s1.1 1 2.3 1c1.1 0 1.1-1 2.3-1 1.1 0 1.1 1 2.3 1 1.1 0 1.1-1 2.3-1 1.1 0 1.1 1 2.3 1 1.1 0 1.1-1 2.3-1",key:"8mdmtu"}]]);const Wo=q("Tags",[["path",{d:"m15 5 6.3 6.3a2.4 2.4 0 0 1 0 3.4L17 19",key:"1cbfv1"}],["path",{d:"M9.586 5.586A2 2 0 0 0 8.172 5H3a1 1 0 0 0-1 1v5.172a2 2 0 0 0 .586 1.414L8.29 18.29a2.426 2.426 0 0 0 3.42 0l3.58-3.58a2.426 2.426 0 0 0 0-3.42z",key:"135mg7"}],["circle",{cx:"6.5",cy:"9.5",r:".5",fill:"currentColor",key:"5pm5xn"}]]);const Qt=q("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);const Rs=q("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const tc=q("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);const ci=q("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);const HD=q("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);const Xo=q("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);const qD=q("UserX",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]);const lr=q("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);const KD=q("WrapText",[["line",{x1:"3",x2:"21",y1:"6",y2:"6",key:"4m8b97"}],["path",{d:"M3 12h15a3 3 0 1 1 0 6h-4",key:"1cl7v7"}],["polyline",{points:"16 16 14 18 16 20",key:"1jznyi"}],["line",{x1:"3",x2:"10",y1:"18",y2:"18",key:"1h33wv"}]]);const Jt=q("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),li=[{id:"jetbrains",labelKey:"projectSettings.fontJetBrains",stack:'"JetBrains Mono", ui-monospace, monospace'},{id:"source-code",labelKey:"projectSettings.fontSourceCode",stack:'"Source Code Pro", ui-monospace, monospace'},{id:"ibm-plex",labelKey:"projectSettings.fontIbmPlex",stack:'"IBM Plex Mono", ui-monospace, monospace'},{id:"fira-code",labelKey:"projectSettings.fontFiraCode",stack:'"Fira Code", ui-monospace, monospace'},{id:"iosevka",labelKey:"projectSettings.fontIosevka",stack:'"Iosevka", ui-monospace, monospace'}],on={font:"jetbrains",fontSize:14,lineHeight:1.65,lineWrapping:!0,spellCheck:!0,vimMode:!1,formatOnCompile:!1,texFmtConfig:"",openFilesInTabs:!1},GD="texlite-editor-preferences";function ql(t,e){return`${GD}:${encodeURIComponent(t)}:${encodeURIComponent(e)}`}function f2(t){return li.find(e=>e.id===t)?.stack??li[0].stack}function nc(t,e){try{const n=JSON.parse(localStorage.getItem(ql(t,e))??"{}");return{font:li.some(r=>r.id===n.font)?n.font:on.font,fontSize:[12,13,14,15,16,18,20].includes(Number(n.fontSize))?Number(n.fontSize):on.fontSize,lineHeight:[1.45,1.65,1.85].includes(Number(n.lineHeight))?Number(n.lineHeight):on.lineHeight,lineWrapping:typeof n.lineWrapping=="boolean"?n.lineWrapping:on.lineWrapping,spellCheck:typeof n.spellCheck=="boolean"?n.spellCheck:on.spellCheck,vimMode:typeof n.vimMode=="boolean"?n.vimMode:on.vimMode,formatOnCompile:typeof n.formatOnCompile=="boolean"?n.formatOnCompile:on.formatOnCompile,texFmtConfig:typeof n.texFmtConfig=="string"&&n.texFmtConfig.length<=16*1024?n.texFmtConfig:on.texFmtConfig,openFilesInTabs:typeof n.openFilesInTabs=="boolean"?n.openFilesInTabs:on.openFilesInTabs}}catch{return on}}function YD(t,e,n){localStorage.setItem(ql(t,e),JSON.stringify(n))}const WD=/\.(?:tex|bib|cls|sty)$/i;let co=null;async function XD(t,e=""){co??=dn(()=>import("./texFmtRuntime-EYyQNUnJ.js"),[]);let n;try{({main:n}=await co)}catch{throw co=null,new Error("The bundled tex-fmt formatter could not be loaded.")}let r;try{r=n(t,e)}catch{throw new Error("tex-fmt could not format this source. Check the TOML formatter options.")}if(!r||typeof r!="object"||!("output"in r)||typeof r.output!="string")throw new Error("tex-fmt returned an invalid formatting result.");return r.output}function Yr(t){return WD.test(t)}function JD(t){return t.match(/(?:\r?\n)+$/)?.[0]??""}function ZD(t,e){const n=JD(t),a=(n?t.slice(0,-n.length):t).split(/\r?\n/).find(l=>l.trim())?.match(/^[\t ]*/)?.[0]??"",u=e.replace(/(?:\r?\n)+$/,"");return`${a?u.split(`
15
+ `).map(l=>l&&`${a}${l}`).join(`
16
+ `):u}${n}`}async function lo(t,e,n=0){if(t===e)return[];const{default:r}=await dn(async()=>{const{default:f}=await import("./index-rBWMBTI-.js").then(d=>d.i);return{default:f}},__vite__mapDeps([0,1])),s=new r,o=s.diff_main(t,e,!0);s.diff_cleanupEfficiency(o);const a=[];let u=n,c=null;const l=()=>{c&&a.push(c),c=null};for(const[f,d]of o)f===r.DIFF_EQUAL?(l(),u+=d.length):f===r.DIFF_DELETE?(c??={from:u,to:u,replacement:""},c.to+=d.length,u+=d.length):(c??={from:u,to:u,replacement:""},c.replacement+=d);return l(),a}var ho,sc;function QD(){if(sc)return ho;sc=1;var t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,s=(m,E)=>t(m,"name",{value:E,configurable:!0}),o=(m,E)=>{for(var F in E)t(m,F,{get:E[F],enumerable:!0})},a=(m,E,F,j)=>{if(E&&typeof E=="object"||typeof E=="function")for(let T of n(E))!r.call(m,T)&&T!==F&&t(m,T,{get:()=>E[T],enumerable:!(j=e(E,T))||j.enumerable});return m},u=m=>a(t({},"__esModule",{value:!0}),m),c={};o(c,{getEntries:()=>St,tidy:()=>Sn}),ho=u(c);var l=class{constructor(m=[]){this.children=m,this.type="root"}static{s(this,"RootNode")}},f=class{constructor(m,E){this.parent=m,this.text=E,this.type="text",m.children.push(this)}static{s(this,"TextNode")}},d=class{constructor(m){this.parent=m,this.type="block",this.command="",m.children.push(this)}static{s(this,"BlockNode")}},p=class{constructor(m,E,F,j){this.parent=m,this.raw=E,this.braces=F,this.parens=j,this.type="comment",m.block=this}static{s(this,"CommentNode")}},D=class{constructor(m,E,F,j){this.parent=m,this.raw=E,this.braces=F,this.parens=j,this.type="preamble",m.block=this}static{s(this,"PreambleNode")}},g=class{constructor(m,E,F,j){this.parent=m,this.raw=E,this.braces=F,this.parens=j,this.type="string",m.block=this}static{s(this,"StringNode")}},y=class{constructor(m,E){this.parent=m,this.wrapType=E,this.type="entry",m.block=this,this.fields=[]}static{s(this,"EntryNode")}},x=class{constructor(m,E=""){this.parent=m,this.name=E,this.type="field",this.value=new A(this)}static{s(this,"FieldNode")}},A=class{constructor(m){this.parent=m,this.type="concat",this.canConsumeValue=!0,this.concat=[]}static{s(this,"ConcatNode")}},L=class{constructor(m,E){this.parent=m,this.value=E,this.type="literal",m.concat.push(this)}static{s(this,"LiteralNode")}},R=class{constructor(m){this.parent=m,this.type="braced",this.value="",this.depth=0,m.concat.push(this)}static{s(this,"BracedNode")}},I=class{constructor(m){this.parent=m,this.type="quoted",this.value="",this.depth=0,m.concat.push(this)}static{s(this,"QuotedNode")}};function M(m){const E=new l;let F=E,j=1,T=0;for(let V=0;V<m.length;V++){const N=m[V]??"",he=m[V-1]??"";switch(N===`
17
+ `&&(j++,T=0),T++,F.type){case"root":{F=N==="@"?new d(F):new f(F,N);break}case"text":{N==="@"&&/[\s\r\n}]/.test(he)?F=new d(F.parent):F.text+=N;break}case"block":{if(N==="@"){const de=F.parent.children[F.parent.children.length-2];de?.type==="text"?de.text+=`@${F.command}`:(F.parent.children.pop(),new f(F.parent,`@${F.command}`),F.parent.children.push(F)),F.command=""}else if(N==="{"||N==="("){const de=F.command.trim();if(de===""||/\s/.test(de))F.parent.children.pop(),F=new f(F.parent,`@${F.command}${N}`);else{F.command=de;const ue=F.command.toLowerCase(),[pe,ne]=N==="{"?[1,0]:[0,1],mt=`@${ue}${N}`;switch(ue){case"string":F=new g(F,mt,pe,ne);break;case"preamble":F=new D(F,mt,pe,ne);break;case"comment":F=new p(F,mt,pe,ne);break;default:F=new y(F,N);break}}}else N.match(/[=#,})[\]]/)?(F.parent.children.pop(),F=new f(F.parent,`@${F.command}${N}`)):F.command+=N;break}case"comment":case"string":case"preamble":N==="{"?F.braces++:N==="}"?F.braces--:N==="("?F.parens++:N===")"&&F.parens--,F.raw+=N,F.braces===0&&F.parens===0&&(F=F.parent.parent);break;case"entry":{if(X(N))F.key&&(F.keyEnded=!0);else if(N===",")F=new x(F);else if(F.wrapType==="{"&&N==="}"||F.wrapType==="("&&N===")")F=F.parent.parent;else if(N==="="&&F.key&&re(F.key)){const de=new x(F,F.key);F.fields.push(de),F.key=void 0,F=de.value}else{if(F.keyEnded)throw new v(m,F,V,j,T,"The entry key cannot contain whitespace");if(O(N))F.key=(F.key??"")+N;else throw new v(m,F,V,j,T,`The entry key cannot contain the character (${N})`)}break}case"field":{if(N==="}"||N===")")F.name=F.name.trim(),F=F.parent.parent.parent;else if(N==="=")F.name=F.name.trim(),F=F.value;else if(N===",")F.name=F.name.trim(),F=new x(F.parent);else if(re(N))F.name?F.name+=N:X(N)||(F.parent.fields.push(F),F.name=N);else throw new v(m,F,V,j,T);break}case"concat":{if(X(N))break;if(F.canConsumeValue){if(/[#=,}()[\]]/.test(N))throw new v(m,F,V,j,T);F.canConsumeValue=!1,N==="{"?F=new R(F):N==='"'?F=new I(F):F=new L(F,N)}else if(N===",")F=new x(F.parent.parent);else if(N==="}"||N===")")F=F.parent.parent.parent.parent;else if(N==="#")F.canConsumeValue=!0;else throw new v(m,F,V,j,T);break}case"literal":X(N)?F=F.parent:N===","?F=new x(F.parent.parent.parent):N==="}"?F=F.parent.parent.parent.parent.parent:N==="#"?(F=F.parent,F.canConsumeValue=!0):F.value+=N;break;case"braced":if(N==="}"&&F.depth===0){F=F.parent;break}N==="{"?F.depth++:N==="}"&&F.depth--,F.value+=N;break;case"quoted":if(N==='"'&&F.depth===0){F=F.parent;break}if(N==="{")F.depth++;else if(N==="}"&&(F.depth--,F.depth<0))throw new v(m,F,V,j,T);F.value+=N;break}}return E}s(M,"generateAST");function X(m){return/^[ \t\n\r]*$/.test(m)}s(X,"isWhitespace");function O(m){return!/[#%{}~$,]/.test(m)}s(O,"isValidKeyCharacter");function re(m){return!/[=,{}()[\]]/.test(m)}s(re,"isValidFieldName");var v=class extends Error{constructor(m,E,F,j,T,V){super(`Line ${j}:${T}: Syntax Error in ${E.type} (${V})
18
+ ${m.slice(Math.max(0,F-20),F)}>>${m[F]}<<${m.slice(F+1,F+20)}`),this.node=E,this.line=j,this.column=T,this.hint=V,this.name="Syntax Error",this.char=m[F]??""}static{s(this,"BibTeXSyntaxError")}};function Z(m,E){return m.replace(/\s+/g," ").split(/ and /i).map(F=>{let j=F.trim();E&&(j=j.replace(/["{}]/g,""));const T=j.indexOf(",");if(T>-1)return{firstNames:j.slice(T+1).trim(),lastName:j.slice(0,T).trim()};const V=j.lastIndexOf(" ");return{firstNames:j.slice(0,V).trim(),lastName:j.slice(V).trim()}})}s(Z,"parseAuthors");var le=class Kl{constructor(E,F,j=[]){this.kind=E,this.parent=F,this.children=j,this.type="block",F instanceof Kl?F.children.push(this):F instanceof H&&F.args.push(this)}static{s(this,"BlockNode")}},U=class{constructor(m,E=""){this.parent=m,this.text=E,this.type="text",m.children.push(this)}static{s(this,"TextNode")}},H=class{constructor(m,E="",F=[]){this.parent=m,this.command=E,this.args=F,this.type="command",m.children.push(this)}static{s(this,"CommandNode")}};function P(m){const E=new le("root");let F=E;for(let j=0;j<m.length;j++){const T=m[j];if(!T)break;switch(F.type){case"block":{T==="\\"?F=new H(F):T==="{"?F=new le("curly",F):(T==="}"&&F.kind==="curly"||T==="]"&&F.kind==="square")&&F.parent?F=F.parent:F=new U(F,T);break}case"text":{T==="\\"||T==="{"||T==="}"&&F.parent.kind==="curly"||T==="]"&&F.parent.kind==="square"?(F=F.parent,j--):F.text+=T;break}case"command":T==="{"?F=new le("curly",F):T==="["?F=new le("square",F):T==="}"&&F.parent.kind==="curly"||T==="]"&&F.parent.kind==="square"||/\s/.test(T)||F.args.length>0?(F=F.parent,j--):F.command+=T}}return E}s(P,"parseLaTeX");function S(m){return ie(m)}s(S,"stringifyLaTeX");function ie(m){const E=m.children.map(F=>{switch(F.type){case"block":return ie(F);case"command":return je(F);case"text":return F.text}}).join("");switch(m.kind){case"root":return E;case"curly":return`{${E}}`;case"square":return`[${E}]`}}s(ie,"stringifyBlock");function je(m){return`\\${m.command}${m.args.map(ie).join("")}`}s(je,"stringifyCommand");function Be(m){const E={...m,children:[]};for(const F of m.children)if(F.type==="block"&&F.kind==="curly"&&F.children.every(j=>j.type!=="command")){const j=Be(F);E.children.push(...j.children)}else E.children.push(F);return E}s(Be,"flattenLaTeX");var Me=new Map([["0023","\\#"],["0024","\\$"],["0025","\\%"],["0026","\\&"],["0027","'"],["0040","\\@"],["002a","\\textasteriskcentered"],["005f","\\_"],["007c","\\vert{}"],["00a0","~"],["00a1","\\textexclamdown{}"],["00a2","\\textcent{}"],["00a3","\\textsterling{}"],["00a4","\\textcurrency{}"],["00a5","\\textyen{}"],["00a6","\\textbrokenbar{}"],["00a7","\\textsection{}"],["00a8","\\textasciidieresis{}"],["00a9","\\textcopyright{}"],["00aa","\\textordfeminine{}"],["00ab","\\guillemotleft{}"],["00ac","\\lnot{}"],["00ad","\\-"],["00ae","\\textregistered{}"],["00af","\\textasciimacron{}"],["00b0","\\textdegree{}"],["00b1","\\pm{}"],["00b2","\\ensuremath{^2}"],["00b3","\\ensuremath{^3}"],["00b4","\\textasciiacute{}"],["00b5","\\mathrm{\\mu}"],["00b6","\\textparagraph{}"],["00b7","\\cdot{}"],["00b8","\\c{}"],["00b9","\\ensuremath{^1}"],["00ba","\\textordmasculine{}"],["00bb","\\guillemotright{}"],["00bc","\\textonequarter{}"],["00bd","\\textonehalf{}"],["00be","\\textthreequarters{}"],["00bf","\\textquestiondown{}"],["00c0","\\`{A}"],["00c1","\\'{A}"],["00c2","\\^{A}"],["00c3","\\~{A}"],["00c4",'\\"{A}'],["00c5","\\AA{}"],["00c6","\\AE{}"],["00c7","\\c{C}"],["00c8","\\`{E}"],["00c9","\\'{E}"],["00ca","\\^{E}"],["00cb",'\\"{E}'],["00cc","\\`{I}"],["00cd","\\'{I}"],["00ce","\\^{I}"],["00cf",'\\"{I}'],["00d0","\\DH{}"],["00d1","\\~{N}"],["00d2","\\`{O}"],["00d3","\\'{O}"],["00d4","\\^{O}"],["00d5","\\~{O}"],["00d6",'\\"{O}'],["00d7","\\texttimes{}"],["00d8","\\O{}"],["00d9","\\`{U}"],["00da","\\'{U}"],["00db","\\^{U}"],["00dc",'\\"{U}'],["00dd","\\'{Y}"],["00de","\\TH{}"],["00df","\\ss{}"],["00e0","\\`{a}"],["00e1","\\'{a}"],["00e2","\\^{a}"],["00e3","\\~{a}"],["00e4",'\\"{a}'],["00e5","\\aa{}"],["00e6","\\ae{}"],["00e7","\\c{c}"],["00e8","\\`{e}"],["00e9","\\'{e}"],["00ea","\\^{e}"],["00eb",'\\"{e}'],["00ec","\\`{\\i}"],["00ed","\\'{\\i}"],["00ee","\\^{\\i}"],["00ef",'\\"{\\i}'],["00f0","\\dh{}"],["00f1","\\~{n}"],["00f2","\\`{o}"],["00f3","\\'{o}"],["00f4","\\^{o}"],["00f5","\\~{o}"],["00f6",'\\"{o}'],["00f7","\\div{}"],["00f8","\\o{}"],["00f9","\\`{u}"],["00fa","\\'{u}"],["00fb","\\^{u}"],["00fc",'\\"{u}'],["00fd","\\'{y}"],["00fe","\\th{}"],["00ff",'\\"{y}'],["0100","\\={A}"],["0101","\\={a}"],["0102","\\u{A}"],["0103","\\u{a}"],["0104","\\k{A}"],["0105","\\k{a}"],["0106","\\'{C}"],["0107","\\'{c}"],["0108","\\^{C}"],["0109","\\^{c}"],["010a","\\.{C}"],["010b","\\.{c}"],["010c","\\v{C}"],["010d","\\v{c}"],["010e","\\v{D}"],["010f","\\v{d}"],["0110","\\DJ{}"],["0111","\\dj{}"],["0112","\\={E}"],["0113","\\={e}"],["0114","\\u{E}"],["0115","\\u{e}"],["0116","\\.{E}"],["0117","\\.{e}"],["0118","\\k{E}"],["0119","\\k{e}"],["011a","\\v{E}"],["011b","\\v{e}"],["011c","\\^{G}"],["011d","\\^{g}"],["011e","\\u{G}"],["011f","\\u{g}"],["0120","\\.{G}"],["0121","\\.{g}"],["0122","\\c{G}"],["0123","\\c{g}"],["0124","\\^{H}"],["0125","\\^{h}"],["0126","{\\fontencoding{LELA}\\selectfont\\char40}"],["0127","\\Elzxh{}"],["0128","\\~{I}"],["0129","\\~{\\i}"],["012a","\\={I}"],["012b","\\={\\i}"],["012c","\\u{I}"],["012d","\\u{\\i}"],["012e","\\k{I}"],["012f","\\k{i}"],["0130","\\.{I}"],["0131","\\i{}"],["0132","IJ"],["0133","ij"],["0134","\\^{J}"],["0135","\\^{\\j}"],["0136","\\c{K}"],["0137","\\c{k}"],["0138","{\\fontencoding{LELA}\\selectfont\\char91}"],["0139","\\'{L}"],["013a","\\'{l}"],["013b","\\c{L}"],["013c","\\c{l}"],["013d","\\v{L}"],["013e","\\v{l}"],["013f","{\\fontencoding{LELA}\\selectfont\\char201}"],["0140","{\\fontencoding{LELA}\\selectfont\\char202}"],["0141","\\L{}"],["0142","\\l{}"],["0143","\\'{N}"],["0144","\\'{n}"],["0145","\\c{N}"],["0146","\\c{n}"],["0147","\\v{N}"],["0148","\\v{n}"],["0149","'n"],["014a","\\NG{}"],["014b","\\ng{}"],["014c","\\={O}"],["014d","\\={o}"],["014e","\\u{O}"],["014f","\\u{o}"],["0150","\\H{O}"],["0151","\\H{o}"],["0152","\\OE{}"],["0153","\\oe{}"],["0154","\\'{R}"],["0155","\\'{r}"],["0156","\\c{R}"],["0157","\\c{r}"],["0158","\\v{R}"],["0159","\\v{r}"],["015a","\\'{S}"],["015b","\\'{s}"],["015c","\\^{S}"],["015d","\\^{s}"],["015e","\\c{S}"],["015f","\\c{s}"],["0160","\\v{S}"],["0161","\\v{s}"],["0162","\\c{T}"],["0163","\\c{t}"],["0164","\\v{T}"],["0165","\\v{t}"],["0166","{\\fontencoding{LELA}\\selectfont\\char47}"],["0167","{\\fontencoding{LELA}\\selectfont\\char63}"],["0168","\\~{U}"],["0169","\\~{u}"],["016a","\\={U}"],["016b","\\={u}"],["016c","\\u{U}"],["016d","\\u{u}"],["016e","\\r{U}"],["016f","\\r{u}"],["0170","\\H{U}"],["0171","\\H{u}"],["0172","\\k{U}"],["0173","\\k{u}"],["0174","\\^{W}"],["0175","\\^{w}"],["0176","\\^{Y}"],["0177","\\^{y}"],["0178",'\\"{Y}'],["0179","\\'{Z}"],["017a","\\'{z}"],["017b","\\.{Z}"],["017c","\\.{z}"],["017d","\\v{Z}"],["017e","\\v{z}"],["0195","\\texthvlig{}"],["019e","\\textnrleg{}"],["01aa","\\eth{}"],["01ba","{\\fontencoding{LELA}\\selectfont\\char195}"],["01c2","\\textdoublepipe{}"],["01f5","\\'{g}"],["0250","\\Elztrna{}"],["0252","\\Elztrnsa{}"],["0254","\\Elzopeno{}"],["0256","\\Elzrtld{}"],["0258","{\\fontencoding{LEIP}\\selectfont\\char61}"],["0259","\\Elzschwa{}"],["025b","\\varepsilon{}"],["0263","\\Elzpgamma{}"],["0264","\\Elzpbgam{}"],["0265","\\Elztrnh{}"],["026c","\\Elzbtdl{}"],["026d","\\Elzrtll{}"],["026f","\\Elztrnm{}"],["0270","\\Elztrnmlr{}"],["0271","\\Elzltlmr{}"],["0272","\\Elzltln{}"],["0273","\\Elzrtln{}"],["0277","\\Elzclomeg{}"],["0278","\\textphi{}"],["0279","\\Elztrnr{}"],["027a","\\Elztrnrl{}"],["027b","\\Elzrttrnr{}"],["027c","\\Elzrl{}"],["027d","\\Elzrtlr{}"],["027e","\\Elzfhr{}"],["027f","{\\fontencoding{LEIP}\\selectfont\\char202}"],["0282","\\Elzrtls{}"],["0283","\\Elzesh{}"],["0287","\\Elztrnt{}"],["0288","\\Elzrtlt{}"],["028a","\\Elzpupsil{}"],["028b","\\Elzpscrv{}"],["028c","\\Elzinvv{}"],["028d","\\Elzinvw{}"],["028e","\\Elztrny{}"],["0290","\\Elzrtlz{}"],["0292","\\Elzyogh{}"],["0294","\\Elzglst{}"],["0295","\\Elzreglst{}"],["0296","\\Elzinglst{}"],["029e","\\textturnk{}"],["02a4","\\Elzdyogh{}"],["02a7","\\Elztesh{}"],["02c7","\\textasciicaron{}"],["02c8","\\Elzverts{}"],["02cc","\\Elzverti{}"],["02d0","\\Elzlmrk{}"],["02d1","\\Elzhlmrk{}"],["02d2","\\Elzsbrhr{}"],["02d3","\\Elzsblhr{}"],["02d4","\\Elzrais{}"],["02d5","\\Elzlow{}"],["02d8","\\textasciibreve{}"],["02d9","\\textperiodcentered{}"],["02da","\\r{}"],["02db","\\k{}"],["02dc","\\texttildelow{}"],["02dd","\\H{}"],["02e5","\\tone{55}"],["02e6","\\tone{44}"],["02e7","\\tone{33}"],["02e8","\\tone{22}"],["02e9","\\tone{11}"],["0300","\\`"],["0301","\\'"],["0302","\\^"],["0303","\\~"],["0304","\\="],["0306","\\u"],["0307","\\."],["0308",'\\"'],["030a","\\r"],["030b","\\H"],["030c","\\v"],["030f","\\cyrchar\\C"],["0311","{\\fontencoding{LECO}\\selectfont\\char177}"],["0318","{\\fontencoding{LECO}\\selectfont\\char184}"],["0319","{\\fontencoding{LECO}\\selectfont\\char185}"],["0321","\\Elzpalh{}"],["0322","\\Elzrh{}"],["0327","\\c"],["0328","\\k"],["032a","\\Elzsbbrg{}"],["032b","{\\fontencoding{LECO}\\selectfont\\char203}"],["032f","{\\fontencoding{LECO}\\selectfont\\char207}"],["0335","\\Elzxl{}"],["0336","\\Elzbar{}"],["0337","{\\fontencoding{LECO}\\selectfont\\char215}"],["0338","{\\fontencoding{LECO}\\selectfont\\char216}"],["033a","{\\fontencoding{LECO}\\selectfont\\char218}"],["033b","{\\fontencoding{LECO}\\selectfont\\char219}"],["033c","{\\fontencoding{LECO}\\selectfont\\char220}"],["033d","{\\fontencoding{LECO}\\selectfont\\char221}"],["0361","{\\fontencoding{LECO}\\selectfont\\char225}"],["0386","\\'{A}"],["0388","\\'{E}"],["0389","\\'{H}"],["038a","\\'{}{I}"],["038c","\\'{}O"],["038e","\\mathrm{'Y}"],["038f","\\mathrm{'\\Omega}"],["0390","\\acute{\\ddot{\\iota}}"],["0391","\\ensuremath{\\Alpha}"],["0392","\\ensuremath{\\Beta}"],["0393","\\ensuremath{\\Gamma}"],["0394","\\ensuremath{\\Delta}"],["0395","\\ensuremath{\\Epsilon}"],["0396","\\ensuremath{\\Zeta}"],["0397","\\ensuremath{\\Eta}"],["0398","\\ensuremath{\\Theta}"],["0399","\\ensuremath{\\Iota}"],["039a","\\ensuremath{\\Kappa}"],["039b","\\ensuremath{\\Lambda}"],["039e","\\ensuremath{\\Xi}"],["03a0","\\ensuremath{\\Pi}"],["03a1","\\ensuremath{\\Rho}"],["03a3","\\ensuremath{\\Sigma}"],["03a4","\\ensuremath{\\Tau}"],["03a5","\\ensuremath{\\Upsilon}"],["03a6","\\ensuremath{\\Phi}"],["03a7","\\ensuremath{\\Chi}"],["03a8","\\ensuremath{\\Psi}"],["03a9","\\ensuremath{\\Omega}"],["03aa","\\mathrm{\\ddot{I}}"],["03ab","\\mathrm{\\ddot{Y}}"],["03ac","\\'{$\\alpha$}"],["03ad","\\acute{\\epsilon}"],["03ae","\\acute{\\eta}"],["03af","\\acute{\\iota}"],["03b0","\\acute{\\ddot{\\upsilon}}"],["03b1","\\ensuremath{\\alpha}"],["03b2","\\ensuremath{\\beta}"],["03b3","\\ensuremath{\\gamma}"],["03b4","\\ensuremath{\\delta}"],["03b5","\\ensuremath{\\epsilon}"],["03b6","\\ensuremath{\\zeta}"],["03b7","\\ensuremath{\\eta}"],["03b8","\\texttheta{}"],["03b9","\\ensuremath{\\iota}"],["03ba","\\ensuremath{\\kappa}"],["03bb","\\ensuremath{\\lambda}"],["03bc","\\ensuremath{\\mu}"],["03bd","\\ensuremath{\\nu}"],["03be","\\ensuremath{\\xi}"],["03c0","\\ensuremath{\\pi}"],["03c1","\\ensuremath{\\rho}"],["03c2","\\ensuremath{\\varsigma}"],["03c3","\\ensuremath{\\sigma}"],["03c4","\\ensuremath{\\tau}"],["03c5","\\ensuremath{\\upsilon}"],["03c6","\\ensuremath{\\varphi}"],["03c7","\\ensuremath{\\chi}"],["03c8","\\ensuremath{\\psi}"],["03c9","\\ensuremath{\\omega}"],["03ca","\\ensuremath{\\ddot{\\iota}}"],["03cb","\\ensuremath{\\ddot{\\upsilon}}"],["03cc","\\'{o}"],["03cd","\\acute{\\upsilon}"],["03ce","\\acute{\\omega}"],["03d0","\\Pisymbol{ppi022}{87}"],["03d1","\\textvartheta{}"],["03d2","\\ensuremath{\\Upsilon}"],["03d5","\\ensuremath{\\phi}"],["03d6","\\ensuremath{\\varpi}"],["03da","\\Stigma{}"],["03dc","\\Digamma{}"],["03dd","\\digamma{}"],["03de","\\Koppa{}"],["03e0","\\Sampi{}"],["03f0","\\varkappa{}"],["03f1","\\varrho{}"],["03f4","\\textTheta{}"],["03f6","\\backepsilon{}"],["0401","\\cyrchar\\CYRYO{}"],["0402","\\cyrchar\\CYRDJE{}"],["0403","\\cyrchar{\\'\\CYRG}"],["0404","\\cyrchar\\CYRIE{}"],["0405","\\cyrchar\\CYRDZE{}"],["0406","\\cyrchar\\CYRII{}"],["0407","\\cyrchar\\CYRYI{}"],["0408","\\cyrchar\\CYRJE{}"],["0409","\\cyrchar\\CYRLJE{}"],["040a","\\cyrchar\\CYRNJE{}"],["040b","\\cyrchar\\CYRTSHE{}"],["040c","\\cyrchar{\\'\\CYRK}"],["040e","\\cyrchar\\CYRUSHRT{}"],["040f","\\cyrchar\\CYRDZHE{}"],["0410","\\cyrchar\\CYRA{}"],["0411","\\cyrchar\\CYRB{}"],["0412","\\cyrchar\\CYRV{}"],["0413","\\cyrchar\\CYRG{}"],["0414","\\cyrchar\\CYRD{}"],["0415","\\cyrchar\\CYRE{}"],["0416","\\cyrchar\\CYRZH{}"],["0417","\\cyrchar\\CYRZ{}"],["0418","\\cyrchar\\CYRI{}"],["0419","\\cyrchar\\CYRISHRT{}"],["041a","\\cyrchar\\CYRK{}"],["041b","\\cyrchar\\CYRL{}"],["041c","\\cyrchar\\CYRM{}"],["041d","\\cyrchar\\CYRN{}"],["041e","\\cyrchar\\CYRO{}"],["041f","\\cyrchar\\CYRP{}"],["0420","\\cyrchar\\CYRR{}"],["0421","\\cyrchar\\CYRS{}"],["0422","\\cyrchar\\CYRT{}"],["0423","\\cyrchar\\CYRU{}"],["0424","\\cyrchar\\CYRF{}"],["0425","\\cyrchar\\CYRH{}"],["0426","\\cyrchar\\CYRC{}"],["0427","\\cyrchar\\CYRCH{}"],["0428","\\cyrchar\\CYRSH{}"],["0429","\\cyrchar\\CYRSHCH{}"],["042a","\\cyrchar\\CYRHRDSN{}"],["042b","\\cyrchar\\CYRERY{}"],["042c","\\cyrchar\\CYRSFTSN{}"],["042d","\\cyrchar\\CYREREV{}"],["042e","\\cyrchar\\CYRYU{}"],["042f","\\cyrchar\\CYRYA{}"],["0430","\\cyrchar\\cyra{}"],["0431","\\cyrchar\\cyrb{}"],["0432","\\cyrchar\\cyrv{}"],["0433","\\cyrchar\\cyrg{}"],["0434","\\cyrchar\\cyrd{}"],["0435","\\cyrchar\\cyre{}"],["0436","\\cyrchar\\cyrzh{}"],["0437","\\cyrchar\\cyrz{}"],["0438","\\cyrchar\\cyri{}"],["0439","\\cyrchar\\cyrishrt{}"],["043a","\\cyrchar\\cyrk{}"],["043b","\\cyrchar\\cyrl{}"],["043c","\\cyrchar\\cyrm{}"],["043d","\\cyrchar\\cyrn{}"],["043e","\\cyrchar\\cyro{}"],["043f","\\cyrchar\\cyrp{}"],["0440","\\cyrchar\\cyrr{}"],["0441","\\cyrchar\\cyrs{}"],["0442","\\cyrchar\\cyrt{}"],["0443","\\cyrchar\\cyru{}"],["0444","\\cyrchar\\cyrf{}"],["0445","\\cyrchar\\cyrh{}"],["0446","\\cyrchar\\cyrc{}"],["0447","\\cyrchar\\cyrch{}"],["0448","\\cyrchar\\cyrsh{}"],["0449","\\cyrchar\\cyrshch{}"],["044a","\\cyrchar\\cyrhrdsn{}"],["044b","\\cyrchar\\cyrery{}"],["044c","\\cyrchar\\cyrsftsn{}"],["044d","\\cyrchar\\cyrerev{}"],["044e","\\cyrchar\\cyryu{}"],["044f","\\cyrchar\\cyrya{}"],["0451","\\cyrchar\\cyryo{}"],["0452","\\cyrchar\\cyrdje{}"],["0453","\\cyrchar{\\'\\cyrg}"],["0454","\\cyrchar\\cyrie{}"],["0455","\\cyrchar\\cyrdze{}"],["0456","\\cyrchar\\cyrii{}"],["0457","\\cyrchar\\cyryi{}"],["0458","\\cyrchar\\cyrje{}"],["0459","\\cyrchar\\cyrlje{}"],["045a","\\cyrchar\\cyrnje{}"],["045b","\\cyrchar\\cyrtshe{}"],["045c","\\cyrchar{\\'\\cyrk}"],["045e","\\cyrchar\\cyrushrt{}"],["045f","\\cyrchar\\cyrdzhe{}"],["0460","\\cyrchar\\CYROMEGA{}"],["0461","\\cyrchar\\cyromega{}"],["0462","\\cyrchar\\CYRYAT{}"],["0464","\\cyrchar\\CYRIOTE{}"],["0465","\\cyrchar\\cyriote{}"],["0466","\\cyrchar\\CYRLYUS{}"],["0467","\\cyrchar\\cyrlyus{}"],["0468","\\cyrchar\\CYRIOTLYUS{}"],["0469","\\cyrchar\\cyriotlyus{}"],["046a","\\cyrchar\\CYRBYUS{}"],["046c","\\cyrchar\\CYRIOTBYUS{}"],["046d","\\cyrchar\\cyriotbyus{}"],["046e","\\cyrchar\\CYRKSI{}"],["046f","\\cyrchar\\cyrksi{}"],["0470","\\cyrchar\\CYRPSI{}"],["0471","\\cyrchar\\cyrpsi{}"],["0472","\\cyrchar\\CYRFITA{}"],["0474","\\cyrchar\\CYRIZH{}"],["0478","\\cyrchar\\CYRUK{}"],["0479","\\cyrchar\\cyruk{}"],["047a","\\cyrchar\\CYROMEGARND{}"],["047b","\\cyrchar\\cyromegarnd{}"],["047c","\\cyrchar\\CYROMEGATITLO{}"],["047d","\\cyrchar\\cyromegatitlo{}"],["047e","\\cyrchar\\CYROT{}"],["047f","\\cyrchar\\cyrot{}"],["0480","\\cyrchar\\CYRKOPPA{}"],["0481","\\cyrchar\\cyrkoppa{}"],["0482","\\cyrchar\\cyrthousands{}"],["0488","\\cyrchar\\cyrhundredthousands{}"],["0489","\\cyrchar\\cyrmillions{}"],["048c","\\cyrchar\\CYRSEMISFTSN{}"],["048d","\\cyrchar\\cyrsemisftsn{}"],["048e","\\cyrchar\\CYRRTICK{}"],["048f","\\cyrchar\\cyrrtick{}"],["0490","\\cyrchar\\CYRGUP{}"],["0491","\\cyrchar\\cyrgup{}"],["0492","\\cyrchar\\CYRGHCRS{}"],["0493","\\cyrchar\\cyrghcrs{}"],["0494","\\cyrchar\\CYRGHK{}"],["0495","\\cyrchar\\cyrghk{}"],["0496","\\cyrchar\\CYRZHDSC{}"],["0497","\\cyrchar\\cyrzhdsc{}"],["0498","\\cyrchar\\CYRZDSC{}"],["0499","\\cyrchar\\cyrzdsc{}"],["049a","\\cyrchar\\CYRKDSC{}"],["049b","\\cyrchar\\cyrkdsc{}"],["049c","\\cyrchar\\CYRKVCRS{}"],["049d","\\cyrchar\\cyrkvcrs{}"],["049e","\\cyrchar\\CYRKHCRS{}"],["049f","\\cyrchar\\cyrkhcrs{}"],["04a0","\\cyrchar\\CYRKBEAK{}"],["04a1","\\cyrchar\\cyrkbeak{}"],["04a2","\\cyrchar\\CYRNDSC{}"],["04a3","\\cyrchar\\cyrndsc{}"],["04a4","\\cyrchar\\CYRNG{}"],["04a5","\\cyrchar\\cyrng{}"],["04a6","\\cyrchar\\CYRPHK{}"],["04a7","\\cyrchar\\cyrphk{}"],["04a8","\\cyrchar\\CYRABHHA{}"],["04a9","\\cyrchar\\cyrabhha{}"],["04aa","\\cyrchar\\CYRSDSC{}"],["04ab","\\cyrchar\\cyrsdsc{}"],["04ac","\\cyrchar\\CYRTDSC{}"],["04ad","\\cyrchar\\cyrtdsc{}"],["04ae","\\cyrchar\\CYRY{}"],["04af","\\cyrchar\\cyry{}"],["04b0","\\cyrchar\\CYRYHCRS{}"],["04b1","\\cyrchar\\cyryhcrs{}"],["04b2","\\cyrchar\\CYRHDSC{}"],["04b3","\\cyrchar\\cyrhdsc{}"],["04b4","\\cyrchar\\CYRTETSE{}"],["04b5","\\cyrchar\\cyrtetse{}"],["04b6","\\cyrchar\\CYRCHRDSC{}"],["04b7","\\cyrchar\\cyrchrdsc{}"],["04b8","\\cyrchar\\CYRCHVCRS{}"],["04b9","\\cyrchar\\cyrchvcrs{}"],["04ba","\\cyrchar\\CYRSHHA{}"],["04bb","\\cyrchar\\cyrshha{}"],["04bc","\\cyrchar\\CYRABHCH{}"],["04bd","\\cyrchar\\cyrabhch{}"],["04be","\\cyrchar\\CYRABHCHDSC{}"],["04bf","\\cyrchar\\cyrabhchdsc{}"],["04c0","\\cyrchar\\CYRpalochka{}"],["04c3","\\cyrchar\\CYRKHK{}"],["04c4","\\cyrchar\\cyrkhk{}"],["04c7","\\cyrchar\\CYRNHK{}"],["04c8","\\cyrchar\\cyrnhk{}"],["04cb","\\cyrchar\\CYRCHLDSC{}"],["04cc","\\cyrchar\\cyrchldsc{}"],["04d4","\\cyrchar\\CYRAE{}"],["04d5","\\cyrchar\\cyrae{}"],["04d8","\\cyrchar\\CYRSCHWA{}"],["04d9","\\cyrchar\\cyrschwa{}"],["04e0","\\cyrchar\\CYRABHDZE{}"],["04e1","\\cyrchar\\cyrabhdze{}"],["04e8","\\cyrchar\\CYROTLD{}"],["04e9","\\cyrchar\\cyrotld{}"],["2002","\\hspace{0.6em}"],["2003","\\hspace{1em}"],["2004","\\hspace{0.33em}"],["2005","\\hspace{0.25em}"],["2006","\\hspace{0.166em}"],["2007","\\hphantom{0}"],["2008","\\hphantom{,}"],["2009","\\hspace{0.167em}"],["200a","\\mkern1mu{}"],["2010","-"],["2014","--"],["2015","\\rule{1em}{1pt}"],["2016","\\Vert{}"],["2018","`"],["2019","'"],["201b","\\Elzreapos{}"],["201c","``"],["201d","''"],["201e",",,"],["2020","\\textdagger{}"],["2021","\\textdaggerdbl{}"],["2022","\\textbullet{}"],["2025",".."],["2026","\\ldots{}"],["2030","\\textperthousand{}"],["2031","\\textpertenthousand{}"],["2032","\\ensuremath{'}"],["2033","\\ensuremath{''}"],["2034","\\ensuremath{'''}"],["2035","\\backprime{}"],["2039","\\guilsinglleft{}"],["203a","\\guilsinglright{}"],["2057","''''"],["205f","\\mkern4mu{}"],["2060","\\nolinebreak{}"],["20a7","\\ensuremath{\\Elzpes}"],["20ac","\\mbox{\\texteuro}{}"],["20db","\\dddot{}"],["20dc","\\ddddot{}"],["2102","\\mathbb{C}"],["210a","\\mathscr{g}"],["210b","\\mathscr{H}"],["210c","\\mathfrak{H}"],["210d","\\mathbb{H}"],["210f","\\hslash{}"],["2110","\\mathscr{I}"],["2111","\\mathfrak{I}"],["2112","\\mathscr{L}"],["2113","\\mathscr{l}"],["2115","\\mathbb{N}"],["2116","\\cyrchar\\textnumero{}"],["2118","\\wp{}"],["2119","\\mathbb{P}"],["211a","\\mathbb{Q}"],["211b","\\mathscr{R}"],["211c","\\mathfrak{R}"],["211d","\\mathbb{R}"],["211e","\\Elzxrat{}"],["2122","\\texttrademark{}"],["2124","\\mathbb{Z}"],["2126","\\Omega{}"],["2127","\\mho{}"],["2128","\\mathfrak{Z}"],["2129","\\ElsevierGlyph{2129}"],["212b","\\AA{}"],["212c","\\mathscr{B}"],["212d","\\mathfrak{C}"],["212f","\\mathscr{e}"],["2130","\\mathscr{E}"],["2131","\\mathscr{F}"],["2133","\\mathscr{M}"],["2134","\\mathscr{o}"],["2135","\\aleph{}"],["2136","\\beth{}"],["2137","\\gimel{}"],["2138","\\daleth{}"],["2153","\\textfrac{1}{3}"],["2154","\\textfrac{2}{3}"],["2155","\\textfrac{1}{5}"],["2156","\\textfrac{2}{5}"],["2157","\\textfrac{3}{5}"],["2158","\\textfrac{4}{5}"],["2159","\\textfrac{1}{6}"],["215a","\\textfrac{5}{6}"],["215b","\\textfrac{1}{8}"],["215c","\\textfrac{3}{8}"],["215d","\\textfrac{5}{8}"],["215e","\\textfrac{7}{8}"],["2190","\\leftarrow{}"],["2191","\\uparrow{}"],["2192","\\rightarrow{}"],["2193","\\downarrow{}"],["2194","\\leftrightarrow{}"],["2195","\\updownarrow{}"],["2196","\\nwarrow{}"],["2197","\\nearrow{}"],["2198","\\searrow{}"],["2199","\\swarrow{}"],["219a","\\nleftarrow{}"],["219b","\\nrightarrow{}"],["219c","\\arrowwaveright{}"],["219d","\\arrowwaveright{}"],["219e","\\twoheadleftarrow{}"],["21a0","\\twoheadrightarrow{}"],["21a2","\\leftarrowtail{}"],["21a3","\\rightarrowtail{}"],["21a6","\\mapsto{}"],["21a9","\\hookleftarrow{}"],["21aa","\\hookrightarrow{}"],["21ab","\\looparrowleft{}"],["21ac","\\looparrowright{}"],["21ad","\\leftrightsquigarrow{}"],["21ae","\\nleftrightarrow{}"],["21b0","\\Lsh{}"],["21b1","\\Rsh{}"],["21b3","\\ElsevierGlyph{21B3}"],["21b6","\\curvearrowleft{}"],["21b7","\\curvearrowright{}"],["21ba","\\circlearrowleft{}"],["21bb","\\circlearrowright{}"],["21bc","\\leftharpoonup{}"],["21bd","\\leftharpoondown{}"],["21be","\\upharpoonright{}"],["21bf","\\upharpoonleft{}"],["21c0","\\rightharpoonup{}"],["21c1","\\rightharpoondown{}"],["21c2","\\downharpoonright{}"],["21c3","\\downharpoonleft{}"],["21c4","\\rightleftarrows{}"],["21c5","\\dblarrowupdown{}"],["21c6","\\leftrightarrows{}"],["21c7","\\leftleftarrows{}"],["21c8","\\upuparrows{}"],["21c9","\\rightrightarrows{}"],["21ca","\\downdownarrows{}"],["21cb","\\leftrightharpoons{}"],["21cc","\\rightleftharpoons{}"],["21cd","\\nLeftarrow{}"],["21ce","\\nLeftrightarrow{}"],["21cf","\\nRightarrow{}"],["21d0","\\Leftarrow{}"],["21d1","\\Uparrow{}"],["21d2","\\Rightarrow{}"],["21d3","\\Downarrow{}"],["21d4","\\Leftrightarrow{}"],["21d5","\\Updownarrow{}"],["21da","\\Lleftarrow{}"],["21db","\\Rrightarrow{}"],["21dd","\\rightsquigarrow{}"],["21f5","\\DownArrowUpArrow{}"],["2200","\\forall{}"],["2201","\\complement{}"],["2202","\\partial{}"],["2203","\\exists{}"],["2204","\\nexists{}"],["2205","\\varnothing{}"],["2207","\\nabla{}"],["2208","\\in{}"],["2209","\\not\\in{}"],["220b","\\ni{}"],["220c","\\not\\ni{}"],["220f","\\prod{}"],["2210","\\coprod{}"],["2211","\\sum{}"],["2212","-"],["2213","\\mp{}"],["2214","\\dotplus{}"],["2216","\\setminus{}"],["2217","{\\_\\ast}"],["2218","\\circ{}"],["2219","\\bullet{}"],["221a","\\surd{}"],["221d","\\propto{}"],["221e","\\infty{}"],["221f","\\rightangle{}"],["2220","\\angle{}"],["2221","\\measuredangle{}"],["2222","\\sphericalangle{}"],["2223","\\mid{}"],["2224","\\nmid{}"],["2225","\\parallel{}"],["2226","\\nparallel{}"],["2227","\\wedge{}"],["2228","\\vee{}"],["2229","\\cap{}"],["222a","\\cup{}"],["222b","\\int{}"],["222c","\\int\\!\\int{}"],["222d","\\int\\!\\int\\!\\int{}"],["222e","\\oint{}"],["222f","\\surfintegral{}"],["2230","\\volintegral{}"],["2231","\\clwintegral{}"],["2232","\\ElsevierGlyph{2232}"],["2233","\\ElsevierGlyph{2233}"],["2234","\\therefore{}"],["2235","\\because{}"],["2237","\\Colon{}"],["2238","\\ElsevierGlyph{2238}"],["223a","\\mathbin{{:}\\!\\!{-}\\!\\!{:}}"],["223b","\\homothetic{}"],["223c","\\sim{}"],["223d","\\backsim{}"],["223e","\\lazysinv{}"],["2240","\\wr{}"],["2241","\\not\\sim{}"],["2242","\\ElsevierGlyph{2242}"],["2243","\\simeq{}"],["2244","\\not\\simeq{}"],["2245","\\cong{}"],["2246","\\approxnotequal{}"],["2247","\\not\\cong{}"],["2248","\\approx{}"],["2249","\\not\\approx{}"],["224a","\\approxeq{}"],["224b","\\tildetrpl{}"],["224c","\\allequal{}"],["224d","\\asymp{}"],["224e","\\Bumpeq{}"],["224f","\\bumpeq{}"],["2250","\\doteq{}"],["2251","\\doteqdot{}"],["2252","\\fallingdotseq{}"],["2253","\\risingdotseq{}"],["2254",":="],["2255","=:"],["2256","\\eqcirc{}"],["2257","\\circeq{}"],["2259","\\estimates{}"],["225a","\\ElsevierGlyph{225A}"],["225b","\\starequal{}"],["225c","\\triangleq{}"],["225f","\\ElsevierGlyph{225F}"],["2260","\\not ="],["2261","\\equiv{}"],["2262","\\not\\equiv{}"],["2264","\\leq{}"],["2265","\\geq{}"],["2266","\\leqq{}"],["2267","\\geqq{}"],["2268","\\lneqq{}"],["2269","\\gneqq{}"],["226a","\\ll{}"],["226b","\\gg{}"],["226c","\\between{}"],["226d","\\not\\kern-0.3em\\times{}"],["226e","\\not&lt;"],["226f","\\not&gt;"],["2270","\\not\\leq{}"],["2271","\\not\\geq{}"],["2272","\\lessequivlnt{}"],["2273","\\greaterequivlnt{}"],["2274","\\ElsevierGlyph{2274}"],["2275","\\ElsevierGlyph{2275}"],["2276","\\lessgtr{}"],["2277","\\gtrless{}"],["2278","\\notlessgreater{}"],["2279","\\notgreaterless{}"],["227a","\\prec{}"],["227b","\\succ{}"],["227c","\\preccurlyeq{}"],["227d","\\succcurlyeq{}"],["227e","\\precapprox{}"],["227f","\\succapprox{}"],["2280","\\not\\prec{}"],["2281","\\not\\succ{}"],["2282","\\subset{}"],["2283","\\supset{}"],["2284","\\not\\subset{}"],["2285","\\not\\supset{}"],["2286","\\subseteq{}"],["2287","\\supseteq{}"],["2288","\\not\\subseteq{}"],["2289","\\not\\supseteq{}"],["228a","\\subsetneq{}"],["228b","\\supsetneq{}"],["228e","\\uplus{}"],["228f","\\sqsubset{}"],["2290","\\sqsupset{}"],["2291","\\sqsubseteq{}"],["2292","\\sqsupseteq{}"],["2293","\\sqcap{}"],["2294","\\sqcup{}"],["2295","\\oplus{}"],["2296","\\ominus{}"],["2297","\\otimes{}"],["2298","\\oslash{}"],["2299","\\odot{}"],["229a","\\circledcirc{}"],["229b","\\circledast{}"],["229d","\\circleddash{}"],["229e","\\boxplus{}"],["229f","\\boxminus{}"],["22a0","\\boxtimes{}"],["22a1","\\boxdot{}"],["22a2","\\vdash{}"],["22a3","\\dashv{}"],["22a4","\\top{}"],["22a5","\\perp{}"],["22a7","\\truestate{}"],["22a8","\\forcesextra{}"],["22a9","\\Vdash{}"],["22aa","\\Vvdash{}"],["22ab","\\VDash{}"],["22ac","\\nvdash{}"],["22ad","\\nvDash{}"],["22ae","\\nVdash{}"],["22af","\\nVDash{}"],["22b2","\\vartriangleleft{}"],["22b3","\\vartriangleright{}"],["22b4","\\trianglelefteq{}"],["22b5","\\trianglerighteq{}"],["22b6","\\original{}"],["22b7","\\image{}"],["22b8","\\multimap{}"],["22b9","\\hermitconjmatrix{}"],["22ba","\\intercal{}"],["22bb","\\veebar{}"],["22be","\\rightanglearc{}"],["22c0","\\ElsevierGlyph{22C0}"],["22c1","\\ElsevierGlyph{22C1}"],["22c2","\\bigcap{}"],["22c3","\\bigcup{}"],["22c4","\\diamond{}"],["22c5","\\cdot{}"],["22c6","\\star{}"],["22c7","\\divideontimes{}"],["22c8","\\bowtie{}"],["22c9","\\ltimes{}"],["22ca","\\rtimes{}"],["22cb","\\leftthreetimes{}"],["22cc","\\rightthreetimes{}"],["22cd","\\backsimeq{}"],["22ce","\\curlyvee{}"],["22cf","\\curlywedge{}"],["22d0","\\Subset{}"],["22d1","\\Supset{}"],["22d2","\\Cap{}"],["22d3","\\Cup{}"],["22d4","\\pitchfork{}"],["22d6","\\lessdot{}"],["22d7","\\gtrdot{}"],["22d8","\\verymuchless{}"],["22d9","\\verymuchgreater{}"],["22da","\\lesseqgtr{}"],["22db","\\gtreqless{}"],["22de","\\curlyeqprec{}"],["22df","\\curlyeqsucc{}"],["22e2","\\not\\sqsubseteq{}"],["22e3","\\not\\sqsupseteq{}"],["22e5","\\Elzsqspne{}"],["22e6","\\lnsim{}"],["22e7","\\gnsim{}"],["22e8","\\precedesnotsimilar{}"],["22e9","\\succnsim{}"],["22ea","\\ntriangleleft{}"],["22eb","\\ntriangleright{}"],["22ec","\\ntrianglelefteq{}"],["22ed","\\ntrianglerighteq{}"],["22ee","\\vdots{}"],["22ef","\\cdots{}"],["22f0","\\upslopeellipsis{}"],["22f1","\\downslopeellipsis{}"],["2305","\\barwedge{}"],["2306","\\perspcorrespond{}"],["2308","\\lceil{}"],["2309","\\rceil{}"],["230a","\\lfloor{}"],["230b","\\rfloor{}"],["2315","\\recorder{}"],["2316",'\\mathchar"2208'],["231c","\\ulcorner{}"],["231d","\\urcorner{}"],["231e","\\llcorner{}"],["231f","\\lrcorner{}"],["2322","\\frown{}"],["2323","\\smile{}"],["2329","\\langle{}"],["232a","\\rangle{}"],["233d","\\ElsevierGlyph{E838}"],["23a3","\\Elzdlcorn{}"],["23b0","\\lmoustache{}"],["23b1","\\rmoustache{}"],["2423","\\textvisiblespace{}"],["2460","\\ding{172}"],["2461","\\ding{173}"],["2462","\\ding{174}"],["2463","\\ding{175}"],["2464","\\ding{176}"],["2465","\\ding{177}"],["2466","\\ding{178}"],["2467","\\ding{179}"],["2468","\\ding{180}"],["2469","\\ding{181}"],["24c8","\\circledS{}"],["2506","\\Elzdshfnc{}"],["2519","\\Elzsqfnw{}"],["2571","\\diagup{}"],["25a0","\\ding{110}"],["25a1","\\square{}"],["25aa","\\blacksquare{}"],["25ad","\\fbox{~~}"],["25af","\\Elzvrecto{}"],["25b1","\\ElsevierGlyph{E381}"],["25b2","\\ding{115}"],["25b3","\\bigtriangleup{}"],["25b4","\\blacktriangle{}"],["25b5","\\vartriangle{}"],["25b8","\\blacktriangleright{}"],["25b9","\\triangleright{}"],["25bc","\\ding{116}"],["25bd","\\bigtriangledown{}"],["25be","\\blacktriangledown{}"],["25bf","\\triangledown{}"],["25c2","\\blacktriangleleft{}"],["25c3","\\triangleleft{}"],["25c6","\\ding{117}"],["25ca","\\lozenge{}"],["25cb","\\bigcirc{}"],["25cf","\\ding{108}"],["25d0","\\Elzcirfl{}"],["25d1","\\Elzcirfr{}"],["25d2","\\Elzcirfb{}"],["25d7","\\ding{119}"],["25d8","\\Elzrvbull{}"],["25e7","\\Elzsqfl{}"],["25e8","\\Elzsqfr{}"],["25ea","\\Elzsqfse{}"],["25ef","\\bigcirc{}"],["2605","\\ding{72}"],["2606","\\ding{73}"],["260e","\\ding{37}"],["261b","\\ding{42}"],["261e","\\ding{43}"],["263e","\\rightmoon{}"],["263f","\\mercury{}"],["2640","\\venus{}"],["2642","\\male{}"],["2643","\\jupiter{}"],["2644","\\saturn{}"],["2645","\\uranus{}"],["2646","\\neptune{}"],["2647","\\pluto{}"],["2648","\\aries{}"],["2649","\\taurus{}"],["264a","\\gemini{}"],["264b","\\cancer{}"],["264c","\\leo{}"],["264d","\\virgo{}"],["264e","\\libra{}"],["264f","\\scorpio{}"],["2650","\\sagittarius{}"],["2651","\\capricornus{}"],["2652","\\aquarius{}"],["2653","\\pisces{}"],["2660","\\ding{171}"],["2662","\\diamond{}"],["2663","\\ding{168}"],["2665","\\ding{170}"],["2666","\\ding{169}"],["2669","\\quarternote{}"],["266a","\\eighthnote{}"],["266d","\\flat{}"],["266e","\\natural{}"],["266f","\\sharp{}"],["2701","\\ding{33}"],["2702","\\ding{34}"],["2703","\\ding{35}"],["2704","\\ding{36}"],["2706","\\ding{38}"],["2707","\\ding{39}"],["2708","\\ding{40}"],["2709","\\ding{41}"],["270c","\\ding{44}"],["270d","\\ding{45}"],["270e","\\ding{46}"],["270f","\\ding{47}"],["2710","\\ding{48}"],["2711","\\ding{49}"],["2712","\\ding{50}"],["2713","\\ding{51}"],["2714","\\ding{52}"],["2715","\\ding{53}"],["2716","\\ding{54}"],["2717","\\ding{55}"],["2718","\\ding{56}"],["2719","\\ding{57}"],["271a","\\ding{58}"],["271b","\\ding{59}"],["271c","\\ding{60}"],["271d","\\ding{61}"],["271e","\\ding{62}"],["271f","\\ding{63}"],["2720","\\ding{64}"],["2721","\\ding{65}"],["2722","\\ding{66}"],["2723","\\ding{67}"],["2724","\\ding{68}"],["2725","\\ding{69}"],["2726","\\ding{70}"],["2727","\\ding{71}"],["2729","\\ding{73}"],["272a","\\ding{74}"],["272b","\\ding{75}"],["272c","\\ding{76}"],["272d","\\ding{77}"],["272e","\\ding{78}"],["272f","\\ding{79}"],["2730","\\ding{80}"],["2731","\\ding{81}"],["2732","\\ding{82}"],["2733","\\ding{83}"],["2734","\\ding{84}"],["2735","\\ding{85}"],["2736","\\ding{86}"],["2737","\\ding{87}"],["2738","\\ding{88}"],["2739","\\ding{89}"],["273a","\\ding{90}"],["273b","\\ding{91}"],["273c","\\ding{92}"],["273d","\\ding{93}"],["273e","\\ding{94}"],["273f","\\ding{95}"],["2740","\\ding{96}"],["2741","\\ding{97}"],["2742","\\ding{98}"],["2743","\\ding{99}"],["2744","\\ding{100}"],["2745","\\ding{101}"],["2746","\\ding{102}"],["2747","\\ding{103}"],["2748","\\ding{104}"],["2749","\\ding{105}"],["274a","\\ding{106}"],["274b","\\ding{107}"],["274d","\\ding{109}"],["274f","\\ding{111}"],["2750","\\ding{112}"],["2751","\\ding{113}"],["2752","\\ding{114}"],["2756","\\ding{118}"],["2758","\\ding{120}"],["2759","\\ding{121}"],["275a","\\ding{122}"],["275b","\\ding{123}"],["275c","\\ding{124}"],["275d","\\ding{125}"],["275e","\\ding{126}"],["2761","\\ding{161}"],["2762","\\ding{162}"],["2763","\\ding{163}"],["2764","\\ding{164}"],["2765","\\ding{165}"],["2766","\\ding{166}"],["2767","\\ding{167}"],["2776","\\ding{182}"],["2777","\\ding{183}"],["2778","\\ding{184}"],["2779","\\ding{185}"],["277a","\\ding{186}"],["277b","\\ding{187}"],["277c","\\ding{188}"],["277d","\\ding{189}"],["277e","\\ding{190}"],["277f","\\ding{191}"],["2780","\\ding{192}"],["2781","\\ding{193}"],["2782","\\ding{194}"],["2783","\\ding{195}"],["2784","\\ding{196}"],["2785","\\ding{197}"],["2786","\\ding{198}"],["2787","\\ding{199}"],["2788","\\ding{200}"],["2789","\\ding{201}"],["278a","\\ding{202}"],["278b","\\ding{203}"],["278c","\\ding{204}"],["278d","\\ding{205}"],["278e","\\ding{206}"],["278f","\\ding{207}"],["2790","\\ding{208}"],["2791","\\ding{209}"],["2792","\\ding{210}"],["2793","\\ding{211}"],["2794","\\ding{212}"],["2798","\\ding{216}"],["2799","\\ding{217}"],["279a","\\ding{218}"],["279b","\\ding{219}"],["279c","\\ding{220}"],["279d","\\ding{221}"],["279e","\\ding{222}"],["279f","\\ding{223}"],["27a0","\\ding{224}"],["27a1","\\ding{225}"],["27a2","\\ding{226}"],["27a3","\\ding{227}"],["27a4","\\ding{228}"],["27a5","\\ding{229}"],["27a6","\\ding{230}"],["27a7","\\ding{231}"],["27a8","\\ding{232}"],["27a9","\\ding{233}"],["27aa","\\ding{234}"],["27ab","\\ding{235}"],["27ac","\\ding{236}"],["27ad","\\ding{237}"],["27ae","\\ding{238}"],["27af","\\ding{239}"],["27b1","\\ding{241}"],["27b2","\\ding{242}"],["27b3","\\ding{243}"],["27b4","\\ding{244}"],["27b5","\\ding{245}"],["27b6","\\ding{246}"],["27b7","\\ding{247}"],["27b8","\\ding{248}"],["27b9","\\ding{249}"],["27ba","\\ding{250}"],["27bb","\\ding{251}"],["27bc","\\ding{252}"],["27bd","\\ding{253}"],["27be","\\ding{254}"],["27f5","\\longleftarrow{}"],["27f6","\\longrightarrow{}"],["27f7","\\longleftrightarrow{}"],["27f8","\\Longleftarrow{}"],["27f9","\\Longrightarrow{}"],["27fa","\\Longleftrightarrow{}"],["27fc","\\longmapsto{}"],["27ff","\\sim\\joinrel\\leadsto"],["2905","\\ElsevierGlyph{E212}"],["2912","\\UpArrowBar{}"],["2913","\\DownArrowBar{}"],["2923","\\ElsevierGlyph{E20C}"],["2924","\\ElsevierGlyph{E20D}"],["2925","\\ElsevierGlyph{E20B}"],["2926","\\ElsevierGlyph{E20A}"],["2927","\\ElsevierGlyph{E211}"],["2928","\\ElsevierGlyph{E20E}"],["2929","\\ElsevierGlyph{E20F}"],["292a","\\ElsevierGlyph{E210}"],["2933","\\ElsevierGlyph{E21C}"],["2936","\\ElsevierGlyph{E21A}"],["2937","\\ElsevierGlyph{E219}"],["2940","\\Elolarr{}"],["2941","\\Elorarr{}"],["2942","\\ElzRlarr{}"],["2944","\\ElzrLarr{}"],["2947","\\Elzrarrx{}"],["294e","\\LeftRightVector{}"],["294f","\\RightUpDownVector{}"],["2950","\\DownLeftRightVector{}"],["2951","\\LeftUpDownVector{}"],["2952","\\LeftVectorBar{}"],["2953","\\RightVectorBar{}"],["2954","\\RightUpVectorBar{}"],["2955","\\RightDownVectorBar{}"],["2956","\\DownLeftVectorBar{}"],["2957","\\DownRightVectorBar{}"],["2958","\\LeftUpVectorBar{}"],["2959","\\LeftDownVectorBar{}"],["295a","\\LeftTeeVector{}"],["295b","\\RightTeeVector{}"],["295c","\\RightUpTeeVector{}"],["295d","\\RightDownTeeVector{}"],["295e","\\DownLeftTeeVector{}"],["295f","\\DownRightTeeVector{}"],["2960","\\LeftUpTeeVector{}"],["2961","\\LeftDownTeeVector{}"],["296e","\\UpEquilibrium{}"],["296f","\\ReverseUpEquilibrium{}"],["2970","\\RoundImplies{}"],["297c","\\ElsevierGlyph{E214}"],["297d","\\ElsevierGlyph{E215}"],["2980","\\Elztfnc{}"],["2985","\\ElsevierGlyph{3018}"],["2986","\\Elroang{}"],["2993","&lt;\\kern-0.58em("],["2994","\\ElsevierGlyph{E291}"],["2999","\\Elzddfnc{}"],["299c","\\Angle{}"],["29a0","\\Elzlpargt{}"],["29b5","\\ElsevierGlyph{E260}"],["29b6","\\ElsevierGlyph{E61B}"],["29ca","\\ElzLap{}"],["29cb","\\Elzdefas{}"],["29cf","\\LeftTriangleBar{}"],["29d0","\\RightTriangleBar{}"],["29dc","\\ElsevierGlyph{E372}"],["29eb","\\blacklozenge{}"],["29f4","\\RuleDelayed{}"],["2a04","\\Elxuplus{}"],["2a05","\\ElzThr{}"],["2a06","\\Elxsqcup{}"],["2a07","\\ElzInf{}"],["2a08","\\ElzSup{}"],["2a0d","\\ElzCint{}"],["2a0f","\\clockoint{}"],["2a10","\\ElsevierGlyph{E395}"],["2a16","\\sqrint{}"],["2a25","\\ElsevierGlyph{E25A}"],["2a2a","\\ElsevierGlyph{E25B}"],["2a2d","\\ElsevierGlyph{E25C}"],["2a2e","\\ElsevierGlyph{E25D}"],["2a2f","\\ElzTimes{}"],["2a34","\\ElsevierGlyph{E25E}"],["2a35","\\ElsevierGlyph{E25E}"],["2a3c","\\ElsevierGlyph{E259}"],["2a3f","\\amalg{}"],["2a53","\\ElzAnd{}"],["2a54","\\ElzOr{}"],["2a55","\\ElsevierGlyph{E36E}"],["2a56","\\ElOr{}"],["2a5e","\\perspcorrespond{}"],["2a5f","\\Elzminhat{}"],["2a63","\\ElsevierGlyph{225A}"],["2a6e","\\stackrel{*}{=}"],["2a75","\\Equal{}"],["2a7d","\\leqslant{}"],["2a7e","\\geqslant{}"],["2a85","\\lessapprox{}"],["2a86","\\gtrapprox{}"],["2a87","\\lneq{}"],["2a88","\\gneq{}"],["2a89","\\lnapprox{}"],["2a8a","\\gnapprox{}"],["2a8b","\\lesseqqgtr{}"],["2a8c","\\gtreqqless{}"],["2a95","\\eqslantless{}"],["2a96","\\eqslantgtr{}"],["2a9d","\\Pisymbol{ppi020}{117}"],["2a9e","\\Pisymbol{ppi020}{105}"],["2aa1","\\NestedLessLess{}"],["2aa2","\\NestedGreaterGreater{}"],["2aaf","\\preceq{}"],["2ab0","\\succeq{}"],["2ab5","\\precneqq{}"],["2ab6","\\succneqq{}"],["2ab7","\\precapprox{}"],["2ab8","\\succapprox{}"],["2ab9","\\precnapprox{}"],["2aba","\\succnapprox{}"],["2ac5","\\subseteqq{}"],["2ac6","\\supseteqq{}"],["2acb","\\subsetneqq{}"],["2acc","\\supsetneqq{}"],["2aeb","\\ElsevierGlyph{E30D}"],["2af6","\\Elztdcol{}"],["2afd","{{/}\\!\\!{/}}"],["300a","\\ElsevierGlyph{300A}"],["300b","\\ElsevierGlyph{300B}"],["3018","\\ElsevierGlyph{3018}"],["3019","\\ElsevierGlyph{3019}"],["301a","\\openbracketleft{}"],["301b","\\openbracketright{}"],["fb00","ff"],["fb01","fi"],["fb02","fl"],["fb03","ffi"],["fb04","ffl"],["d400","\\mathbf{A}"],["d401","\\mathbf{B}"],["d402","\\mathbf{C}"],["d403","\\mathbf{D}"],["d404","\\mathbf{E}"],["d405","\\mathbf{F}"],["d406","\\mathbf{G}"],["d407","\\mathbf{H}"],["d408","\\mathbf{I}"],["d409","\\mathbf{J}"],["d40a","\\mathbf{K}"],["d40b","\\mathbf{L}"],["d40c","\\mathbf{M}"],["d40d","\\mathbf{N}"],["d40e","\\mathbf{O}"],["d40f","\\mathbf{P}"],["d410","\\mathbf{Q}"],["d411","\\mathbf{R}"],["d412","\\mathbf{S}"],["d413","\\mathbf{T}"],["d414","\\mathbf{U}"],["d415","\\mathbf{V}"],["d416","\\mathbf{W}"],["d417","\\mathbf{X}"],["d418","\\mathbf{Y}"],["d419","\\mathbf{Z}"],["d41a","\\mathbf{a}"],["d41b","\\mathbf{b}"],["d41c","\\mathbf{c}"],["d41d","\\mathbf{d}"],["d41e","\\mathbf{e}"],["d41f","\\mathbf{f}"],["d420","\\mathbf{g}"],["d421","\\mathbf{h}"],["d422","\\mathbf{i}"],["d423","\\mathbf{j}"],["d424","\\mathbf{k}"],["d425","\\mathbf{l}"],["d426","\\mathbf{m}"],["d427","\\mathbf{n}"],["d428","\\mathbf{o}"],["d429","\\mathbf{p}"],["d42a","\\mathbf{q}"],["d42b","\\mathbf{r}"],["d42c","\\mathbf{s}"],["d42d","\\mathbf{t}"],["d42e","\\mathbf{u}"],["d42f","\\mathbf{v}"],["d430","\\mathbf{w}"],["d431","\\mathbf{x}"],["d432","\\mathbf{y}"],["d433","\\mathbf{z}"],["d434","\\mathsl{A}"],["d435","\\mathsl{B}"],["d436","\\mathsl{C}"],["d437","\\mathsl{D}"],["d438","\\mathsl{E}"],["d439","\\mathsl{F}"],["d43a","\\mathsl{G}"],["d43b","\\mathsl{H}"],["d43c","\\mathsl{I}"],["d43d","\\mathsl{J}"],["d43e","\\mathsl{K}"],["d43f","\\mathsl{L}"],["d440","\\mathsl{M}"],["d441","\\mathsl{N}"],["d442","\\mathsl{O}"],["d443","\\mathsl{P}"],["d444","\\mathsl{Q}"],["d445","\\mathsl{R}"],["d446","\\mathsl{S}"],["d447","\\mathsl{T}"],["d448","\\mathsl{U}"],["d449","\\mathsl{V}"],["d44a","\\mathsl{W}"],["d44b","\\mathsl{X}"],["d44c","\\mathsl{Y}"],["d44d","\\mathsl{Z}"],["d44e","\\mathsl{a}"],["d44f","\\mathsl{b}"],["d450","\\mathsl{c}"],["d451","\\mathsl{d}"],["d452","\\mathsl{e}"],["d453","\\mathsl{f}"],["d454","\\mathsl{g}"],["d456","\\mathsl{i}"],["d457","\\mathsl{j}"],["d458","\\mathsl{k}"],["d459","\\mathsl{l}"],["d45a","\\mathsl{m}"],["d45b","\\mathsl{n}"],["d45c","\\mathsl{o}"],["d45d","\\mathsl{p}"],["d45e","\\mathsl{q}"],["d45f","\\mathsl{r}"],["d460","\\mathsl{s}"],["d461","\\mathsl{t}"],["d462","\\mathsl{u}"],["d463","\\mathsl{v}"],["d464","\\mathsl{w}"],["d465","\\mathsl{x}"],["d466","\\mathsl{y}"],["d467","\\mathsl{z}"],["d468","\\mathbit{A}"],["d469","\\mathbit{B}"],["d46a","\\mathbit{C}"],["d46b","\\mathbit{D}"],["d46c","\\mathbit{E}"],["d46d","\\mathbit{F}"],["d46e","\\mathbit{G}"],["d46f","\\mathbit{H}"],["d470","\\mathbit{I}"],["d471","\\mathbit{J}"],["d472","\\mathbit{K}"],["d473","\\mathbit{L}"],["d474","\\mathbit{M}"],["d475","\\mathbit{N}"],["d476","\\mathbit{O}"],["d477","\\mathbit{P}"],["d478","\\mathbit{Q}"],["d479","\\mathbit{R}"],["d47a","\\mathbit{S}"],["d47b","\\mathbit{T}"],["d47c","\\mathbit{U}"],["d47d","\\mathbit{V}"],["d47e","\\mathbit{W}"],["d47f","\\mathbit{X}"],["d480","\\mathbit{Y}"],["d481","\\mathbit{Z}"],["d482","\\mathbit{a}"],["d483","\\mathbit{b}"],["d484","\\mathbit{c}"],["d485","\\mathbit{d}"],["d486","\\mathbit{e}"],["d487","\\mathbit{f}"],["d488","\\mathbit{g}"],["d489","\\mathbit{h}"],["d48a","\\mathbit{i}"],["d48b","\\mathbit{j}"],["d48c","\\mathbit{k}"],["d48d","\\mathbit{l}"],["d48e","\\mathbit{m}"],["d48f","\\mathbit{n}"],["d490","\\mathbit{o}"],["d491","\\mathbit{p}"],["d492","\\mathbit{q}"],["d493","\\mathbit{r}"],["d494","\\mathbit{s}"],["d495","\\mathbit{t}"],["d496","\\mathbit{u}"],["d497","\\mathbit{v}"],["d498","\\mathbit{w}"],["d499","\\mathbit{x}"],["d49a","\\mathbit{y}"],["d49b","\\mathbit{z}"],["d49c","\\mathscr{A}"],["d49e","\\mathscr{C}"],["d49f","\\mathscr{D}"],["d4a2","\\mathscr{G}"],["d4a5","\\mathscr{J}"],["d4a6","\\mathscr{K}"],["d4a9","\\mathscr{N}"],["d4aa","\\mathscr{O}"],["d4ab","\\mathscr{P}"],["d4ac","\\mathscr{Q}"],["d4ae","\\mathscr{S}"],["d4af","\\mathscr{T}"],["d4b0","\\mathscr{U}"],["d4b1","\\mathscr{V}"],["d4b2","\\mathscr{W}"],["d4b3","\\mathscr{X}"],["d4b4","\\mathscr{Y}"],["d4b5","\\mathscr{Z}"],["d4b6","\\mathscr{a}"],["d4b7","\\mathscr{b}"],["d4b8","\\mathscr{c}"],["d4b9","\\mathscr{d}"],["d4bb","\\mathscr{f}"],["d4bd","\\mathscr{h}"],["d4be","\\mathscr{i}"],["d4bf","\\mathscr{j}"],["d4c0","\\mathscr{k}"],["d4c1","\\mathscr{l}"],["d4c2","\\mathscr{m}"],["d4c3","\\mathscr{n}"],["d4c5","\\mathscr{p}"],["d4c6","\\mathscr{q}"],["d4c7","\\mathscr{r}"],["d4c8","\\mathscr{s}"],["d4c9","\\mathscr{t}"],["d4ca","\\mathscr{u}"],["d4cb","\\mathscr{v}"],["d4cc","\\mathscr{w}"],["d4cd","\\mathscr{x}"],["d4ce","\\mathscr{y}"],["d4cf","\\mathscr{z}"],["d4d0","\\mathmit{A}"],["d4d1","\\mathmit{B}"],["d4d2","\\mathmit{C}"],["d4d3","\\mathmit{D}"],["d4d4","\\mathmit{E}"],["d4d5","\\mathmit{F}"],["d4d6","\\mathmit{G}"],["d4d7","\\mathmit{H}"],["d4d8","\\mathmit{I}"],["d4d9","\\mathmit{J}"],["d4da","\\mathmit{K}"],["d4db","\\mathmit{L}"],["d4dc","\\mathmit{M}"],["d4dd","\\mathmit{N}"],["d4de","\\mathmit{O}"],["d4df","\\mathmit{P}"],["d4e0","\\mathmit{Q}"],["d4e1","\\mathmit{R}"],["d4e2","\\mathmit{S}"],["d4e3","\\mathmit{T}"],["d4e4","\\mathmit{U}"],["d4e5","\\mathmit{V}"],["d4e6","\\mathmit{W}"],["d4e7","\\mathmit{X}"],["d4e8","\\mathmit{Y}"],["d4e9","\\mathmit{Z}"],["d4ea","\\mathmit{a}"],["d4eb","\\mathmit{b}"],["d4ec","\\mathmit{c}"],["d4ed","\\mathmit{d}"],["d4ee","\\mathmit{e}"],["d4ef","\\mathmit{f}"],["d4f0","\\mathmit{g}"],["d4f1","\\mathmit{h}"],["d4f2","\\mathmit{i}"],["d4f3","\\mathmit{j}"],["d4f4","\\mathmit{k}"],["d4f5","\\mathmit{l}"],["d4f6","\\mathmit{m}"],["d4f7","\\mathmit{n}"],["d4f8","\\mathmit{o}"],["d4f9","\\mathmit{p}"],["d4fa","\\mathmit{q}"],["d4fb","\\mathmit{r}"],["d4fc","\\mathmit{s}"],["d4fd","\\mathmit{t}"],["d4fe","\\mathmit{u}"],["d4ff","\\mathmit{v}"],["d500","\\mathmit{w}"],["d501","\\mathmit{x}"],["d502","\\mathmit{y}"],["d503","\\mathmit{z}"],["d504","\\mathfrak{A}"],["d505","\\mathfrak{B}"],["d507","\\mathfrak{D}"],["d508","\\mathfrak{E}"],["d509","\\mathfrak{F}"],["d50a","\\mathfrak{G}"],["d50d","\\mathfrak{J}"],["d50e","\\mathfrak{K}"],["d50f","\\mathfrak{L}"],["d510","\\mathfrak{M}"],["d511","\\mathfrak{N}"],["d512","\\mathfrak{O}"],["d513","\\mathfrak{P}"],["d514","\\mathfrak{Q}"],["d516","\\mathfrak{S}"],["d517","\\mathfrak{T}"],["d518","\\mathfrak{U}"],["d519","\\mathfrak{V}"],["d51a","\\mathfrak{W}"],["d51b","\\mathfrak{X}"],["d51c","\\mathfrak{Y}"],["d51e","\\mathfrak{a}"],["d51f","\\mathfrak{b}"],["d520","\\mathfrak{c}"],["d521","\\mathfrak{d}"],["d522","\\mathfrak{e}"],["d523","\\mathfrak{f}"],["d524","\\mathfrak{g}"],["d525","\\mathfrak{h}"],["d526","\\mathfrak{i}"],["d527","\\mathfrak{j}"],["d528","\\mathfrak{k}"],["d529","\\mathfrak{l}"],["d52a","\\mathfrak{m}"],["d52b","\\mathfrak{n}"],["d52c","\\mathfrak{o}"],["d52d","\\mathfrak{p}"],["d52e","\\mathfrak{q}"],["d52f","\\mathfrak{r}"],["d530","\\mathfrak{s}"],["d531","\\mathfrak{t}"],["d532","\\mathfrak{u}"],["d533","\\mathfrak{v}"],["d534","\\mathfrak{w}"],["d535","\\mathfrak{x}"],["d536","\\mathfrak{y}"],["d537","\\mathfrak{z}"],["d538","\\mathbb{A}"],["d539","\\mathbb{B}"],["d53b","\\mathbb{D}"],["d53c","\\mathbb{E}"],["d53d","\\mathbb{F}"],["d53e","\\mathbb{G}"],["d540","\\mathbb{I}"],["d541","\\mathbb{J}"],["d542","\\mathbb{K}"],["d543","\\mathbb{L}"],["d544","\\mathbb{M}"],["d546","\\mathbb{O}"],["d54a","\\mathbb{S}"],["d54b","\\mathbb{T}"],["d54c","\\mathbb{U}"],["d54d","\\mathbb{V}"],["d54e","\\mathbb{W}"],["d54f","\\mathbb{X}"],["d550","\\mathbb{Y}"],["d552","\\mathbb{a}"],["d553","\\mathbb{b}"],["d554","\\mathbb{c}"],["d555","\\mathbb{d}"],["d556","\\mathbb{e}"],["d557","\\mathbb{f}"],["d558","\\mathbb{g}"],["d559","\\mathbb{h}"],["d55a","\\mathbb{i}"],["d55b","\\mathbb{j}"],["d55c","\\mathbb{k}"],["d55d","\\mathbb{l}"],["d55e","\\mathbb{m}"],["d55f","\\mathbb{n}"],["d560","\\mathbb{o}"],["d561","\\mathbb{p}"],["d562","\\mathbb{q}"],["d563","\\mathbb{r}"],["d564","\\mathbb{s}"],["d565","\\mathbb{t}"],["d566","\\mathbb{u}"],["d567","\\mathbb{v}"],["d568","\\mathbb{w}"],["d569","\\mathbb{x}"],["d56a","\\mathbb{y}"],["d56b","\\mathbb{z}"],["d56c","\\mathslbb{A}"],["d56d","\\mathslbb{B}"],["d56e","\\mathslbb{C}"],["d56f","\\mathslbb{D}"],["d570","\\mathslbb{E}"],["d571","\\mathslbb{F}"],["d572","\\mathslbb{G}"],["d573","\\mathslbb{H}"],["d574","\\mathslbb{I}"],["d575","\\mathslbb{J}"],["d576","\\mathslbb{K}"],["d577","\\mathslbb{L}"],["d578","\\mathslbb{M}"],["d579","\\mathslbb{N}"],["d57a","\\mathslbb{O}"],["d57b","\\mathslbb{P}"],["d57c","\\mathslbb{Q}"],["d57d","\\mathslbb{R}"],["d57e","\\mathslbb{S}"],["d57f","\\mathslbb{T}"],["d580","\\mathslbb{U}"],["d581","\\mathslbb{V}"],["d582","\\mathslbb{W}"],["d583","\\mathslbb{X}"],["d584","\\mathslbb{Y}"],["d585","\\mathslbb{Z}"],["d586","\\mathslbb{a}"],["d587","\\mathslbb{b}"],["d588","\\mathslbb{c}"],["d589","\\mathslbb{d}"],["d58a","\\mathslbb{e}"],["d58b","\\mathslbb{f}"],["d58c","\\mathslbb{g}"],["d58d","\\mathslbb{h}"],["d58e","\\mathslbb{i}"],["d58f","\\mathslbb{j}"],["d590","\\mathslbb{k}"],["d591","\\mathslbb{l}"],["d592","\\mathslbb{m}"],["d593","\\mathslbb{n}"],["d594","\\mathslbb{o}"],["d595","\\mathslbb{p}"],["d596","\\mathslbb{q}"],["d597","\\mathslbb{r}"],["d598","\\mathslbb{s}"],["d599","\\mathslbb{t}"],["d59a","\\mathslbb{u}"],["d59b","\\mathslbb{v}"],["d59c","\\mathslbb{w}"],["d59d","\\mathslbb{x}"],["d59e","\\mathslbb{y}"],["d59f","\\mathslbb{z}"],["d5a0","\\mathsf{A}"],["d5a1","\\mathsf{B}"],["d5a2","\\mathsf{C}"],["d5a3","\\mathsf{D}"],["d5a4","\\mathsf{E}"],["d5a5","\\mathsf{F}"],["d5a6","\\mathsf{G}"],["d5a7","\\mathsf{H}"],["d5a8","\\mathsf{I}"],["d5a9","\\mathsf{J}"],["d5aa","\\mathsf{K}"],["d5ab","\\mathsf{L}"],["d5ac","\\mathsf{M}"],["d5ad","\\mathsf{N}"],["d5ae","\\mathsf{O}"],["d5af","\\mathsf{P}"],["d5b0","\\mathsf{Q}"],["d5b1","\\mathsf{R}"],["d5b2","\\mathsf{S}"],["d5b3","\\mathsf{T}"],["d5b4","\\mathsf{U}"],["d5b5","\\mathsf{V}"],["d5b6","\\mathsf{W}"],["d5b7","\\mathsf{X}"],["d5b8","\\mathsf{Y}"],["d5b9","\\mathsf{Z}"],["d5ba","\\mathsf{a}"],["d5bb","\\mathsf{b}"],["d5bc","\\mathsf{c}"],["d5bd","\\mathsf{d}"],["d5be","\\mathsf{e}"],["d5bf","\\mathsf{f}"],["d5c0","\\mathsf{g}"],["d5c1","\\mathsf{h}"],["d5c2","\\mathsf{i}"],["d5c3","\\mathsf{j}"],["d5c4","\\mathsf{k}"],["d5c5","\\mathsf{l}"],["d5c6","\\mathsf{m}"],["d5c7","\\mathsf{n}"],["d5c8","\\mathsf{o}"],["d5c9","\\mathsf{p}"],["d5ca","\\mathsf{q}"],["d5cb","\\mathsf{r}"],["d5cc","\\mathsf{s}"],["d5cd","\\mathsf{t}"],["d5ce","\\mathsf{u}"],["d5cf","\\mathsf{v}"],["d5d0","\\mathsf{w}"],["d5d1","\\mathsf{x}"],["d5d2","\\mathsf{y}"],["d5d3","\\mathsf{z}"],["d5d4","\\mathsfbf{A}"],["d5d5","\\mathsfbf{B}"],["d5d6","\\mathsfbf{C}"],["d5d7","\\mathsfbf{D}"],["d5d8","\\mathsfbf{E}"],["d5d9","\\mathsfbf{F}"],["d5da","\\mathsfbf{G}"],["d5db","\\mathsfbf{H}"],["d5dc","\\mathsfbf{I}"],["d5dd","\\mathsfbf{J}"],["d5de","\\mathsfbf{K}"],["d5df","\\mathsfbf{L}"],["d5e0","\\mathsfbf{M}"],["d5e1","\\mathsfbf{N}"],["d5e2","\\mathsfbf{O}"],["d5e3","\\mathsfbf{P}"],["d5e4","\\mathsfbf{Q}"],["d5e5","\\mathsfbf{R}"],["d5e6","\\mathsfbf{S}"],["d5e7","\\mathsfbf{T}"],["d5e8","\\mathsfbf{U}"],["d5e9","\\mathsfbf{V}"],["d5ea","\\mathsfbf{W}"],["d5eb","\\mathsfbf{X}"],["d5ec","\\mathsfbf{Y}"],["d5ed","\\mathsfbf{Z}"],["d5ee","\\mathsfbf{a}"],["d5ef","\\mathsfbf{b}"],["d5f0","\\mathsfbf{c}"],["d5f1","\\mathsfbf{d}"],["d5f2","\\mathsfbf{e}"],["d5f3","\\mathsfbf{f}"],["d5f4","\\mathsfbf{g}"],["d5f5","\\mathsfbf{h}"],["d5f6","\\mathsfbf{i}"],["d5f7","\\mathsfbf{j}"],["d5f8","\\mathsfbf{k}"],["d5f9","\\mathsfbf{l}"],["d5fa","\\mathsfbf{m}"],["d5fb","\\mathsfbf{n}"],["d5fc","\\mathsfbf{o}"],["d5fd","\\mathsfbf{p}"],["d5fe","\\mathsfbf{q}"],["d5ff","\\mathsfbf{r}"],["d600","\\mathsfbf{s}"],["d601","\\mathsfbf{t}"],["d602","\\mathsfbf{u}"],["d603","\\mathsfbf{v}"],["d604","\\mathsfbf{w}"],["d605","\\mathsfbf{x}"],["d606","\\mathsfbf{y}"],["d607","\\mathsfbf{z}"],["d608","\\mathsfsl{A}"],["d609","\\mathsfsl{B}"],["d60a","\\mathsfsl{C}"],["d60b","\\mathsfsl{D}"],["d60c","\\mathsfsl{E}"],["d60d","\\mathsfsl{F}"],["d60e","\\mathsfsl{G}"],["d60f","\\mathsfsl{H}"],["d610","\\mathsfsl{I}"],["d611","\\mathsfsl{J}"],["d612","\\mathsfsl{K}"],["d613","\\mathsfsl{L}"],["d614","\\mathsfsl{M}"],["d615","\\mathsfsl{N}"],["d616","\\mathsfsl{O}"],["d617","\\mathsfsl{P}"],["d618","\\mathsfsl{Q}"],["d619","\\mathsfsl{R}"],["d61a","\\mathsfsl{S}"],["d61b","\\mathsfsl{T}"],["d61c","\\mathsfsl{U}"],["d61d","\\mathsfsl{V}"],["d61e","\\mathsfsl{W}"],["d61f","\\mathsfsl{X}"],["d620","\\mathsfsl{Y}"],["d621","\\mathsfsl{Z}"],["d622","\\mathsfsl{a}"],["d623","\\mathsfsl{b}"],["d624","\\mathsfsl{c}"],["d625","\\mathsfsl{d}"],["d626","\\mathsfsl{e}"],["d627","\\mathsfsl{f}"],["d628","\\mathsfsl{g}"],["d629","\\mathsfsl{h}"],["d62a","\\mathsfsl{i}"],["d62b","\\mathsfsl{j}"],["d62c","\\mathsfsl{k}"],["d62d","\\mathsfsl{l}"],["d62e","\\mathsfsl{m}"],["d62f","\\mathsfsl{n}"],["d630","\\mathsfsl{o}"],["d631","\\mathsfsl{p}"],["d632","\\mathsfsl{q}"],["d633","\\mathsfsl{r}"],["d634","\\mathsfsl{s}"],["d635","\\mathsfsl{t}"],["d636","\\mathsfsl{u}"],["d637","\\mathsfsl{v}"],["d638","\\mathsfsl{w}"],["d639","\\mathsfsl{x}"],["d63a","\\mathsfsl{y}"],["d63b","\\mathsfsl{z}"],["d63c","\\mathsfbfsl{A}"],["d63d","\\mathsfbfsl{B}"],["d63e","\\mathsfbfsl{C}"],["d63f","\\mathsfbfsl{D}"],["d640","\\mathsfbfsl{E}"],["d641","\\mathsfbfsl{F}"],["d642","\\mathsfbfsl{G}"],["d643","\\mathsfbfsl{H}"],["d644","\\mathsfbfsl{I}"],["d645","\\mathsfbfsl{J}"],["d646","\\mathsfbfsl{K}"],["d647","\\mathsfbfsl{L}"],["d648","\\mathsfbfsl{M}"],["d649","\\mathsfbfsl{N}"],["d64a","\\mathsfbfsl{O}"],["d64b","\\mathsfbfsl{P}"],["d64c","\\mathsfbfsl{Q}"],["d64d","\\mathsfbfsl{R}"],["d64e","\\mathsfbfsl{S}"],["d64f","\\mathsfbfsl{T}"],["d650","\\mathsfbfsl{U}"],["d651","\\mathsfbfsl{V}"],["d652","\\mathsfbfsl{W}"],["d653","\\mathsfbfsl{X}"],["d654","\\mathsfbfsl{Y}"],["d655","\\mathsfbfsl{Z}"],["d656","\\mathsfbfsl{a}"],["d657","\\mathsfbfsl{b}"],["d658","\\mathsfbfsl{c}"],["d659","\\mathsfbfsl{d}"],["d65a","\\mathsfbfsl{e}"],["d65b","\\mathsfbfsl{f}"],["d65c","\\mathsfbfsl{g}"],["d65d","\\mathsfbfsl{h}"],["d65e","\\mathsfbfsl{i}"],["d65f","\\mathsfbfsl{j}"],["d660","\\mathsfbfsl{k}"],["d661","\\mathsfbfsl{l}"],["d662","\\mathsfbfsl{m}"],["d663","\\mathsfbfsl{n}"],["d664","\\mathsfbfsl{o}"],["d665","\\mathsfbfsl{p}"],["d666","\\mathsfbfsl{q}"],["d667","\\mathsfbfsl{r}"],["d668","\\mathsfbfsl{s}"],["d669","\\mathsfbfsl{t}"],["d66a","\\mathsfbfsl{u}"],["d66b","\\mathsfbfsl{v}"],["d66c","\\mathsfbfsl{w}"],["d66d","\\mathsfbfsl{x}"],["d66e","\\mathsfbfsl{y}"],["d66f","\\mathsfbfsl{z}"],["d670","\\mathtt{A}"],["d671","\\mathtt{B}"],["d672","\\mathtt{C}"],["d673","\\mathtt{D}"],["d674","\\mathtt{E}"],["d675","\\mathtt{F}"],["d676","\\mathtt{G}"],["d677","\\mathtt{H}"],["d678","\\mathtt{I}"],["d679","\\mathtt{J}"],["d67a","\\mathtt{K}"],["d67b","\\mathtt{L}"],["d67c","\\mathtt{M}"],["d67d","\\mathtt{N}"],["d67e","\\mathtt{O}"],["d67f","\\mathtt{P}"],["d680","\\mathtt{Q}"],["d681","\\mathtt{R}"],["d682","\\mathtt{S}"],["d683","\\mathtt{T}"],["d684","\\mathtt{U}"],["d685","\\mathtt{V}"],["d686","\\mathtt{W}"],["d687","\\mathtt{X}"],["d688","\\mathtt{Y}"],["d689","\\mathtt{Z}"],["d68a","\\mathtt{a}"],["d68b","\\mathtt{b}"],["d68c","\\mathtt{c}"],["d68d","\\mathtt{d}"],["d68e","\\mathtt{e}"],["d68f","\\mathtt{f}"],["d690","\\mathtt{g}"],["d691","\\mathtt{h}"],["d692","\\mathtt{i}"],["d693","\\mathtt{j}"],["d694","\\mathtt{k}"],["d695","\\mathtt{l}"],["d696","\\mathtt{m}"],["d697","\\mathtt{n}"],["d698","\\mathtt{o}"],["d699","\\mathtt{p}"],["d69a","\\mathtt{q}"],["d69b","\\mathtt{r}"],["d69c","\\mathtt{s}"],["d69d","\\mathtt{t}"],["d69e","\\mathtt{u}"],["d69f","\\mathtt{v}"],["d6a0","\\mathtt{w}"],["d6a1","\\mathtt{x}"],["d6a2","\\mathtt{y}"],["d6a3","\\mathtt{z}"],["d6a8","\\mathbf{\\Alpha}"],["d6a9","\\mathbf{\\Beta}"],["d6aa","\\mathbf{\\Gamma}"],["d6ab","\\mathbf{\\Delta}"],["d6ac","\\mathbf{\\Epsilon}"],["d6ad","\\mathbf{\\Zeta}"],["d6ae","\\mathbf{\\Eta}"],["d6af","\\mathbf{\\Theta}"],["d6b0","\\mathbf{\\Iota}"],["d6b1","\\mathbf{\\Kappa}"],["d6b2","\\mathbf{\\Lambda}"],["d6b5","\\mathbf{\\Xi}"],["d6b7","\\mathbf{\\Pi}"],["d6b8","\\mathbf{\\Rho}"],["d6b9","\\mathbf{\\vartheta}"],["d6ba","\\mathbf{\\Sigma}"],["d6bb","\\mathbf{\\Tau}"],["d6bc","\\mathbf{\\Upsilon}"],["d6bd","\\mathbf{\\Phi}"],["d6be","\\mathbf{\\Chi}"],["d6bf","\\mathbf{\\Psi}"],["d6c0","\\mathbf{\\Omega}"],["d6c1","\\mathbf{\\nabla}"],["d6c2","\\mathbf{\\Alpha}"],["d6c3","\\mathbf{\\Beta}"],["d6c4","\\mathbf{\\Gamma}"],["d6c5","\\mathbf{\\Delta}"],["d6c6","\\mathbf{\\Epsilon}"],["d6c7","\\mathbf{\\Zeta}"],["d6c8","\\mathbf{\\Eta}"],["d6c9","\\mathbf{\\theta}"],["d6ca","\\mathbf{\\Iota}"],["d6cb","\\mathbf{\\Kappa}"],["d6cc","\\mathbf{\\Lambda}"],["d6cf","\\mathbf{\\Xi}"],["d6d1","\\mathbf{\\Pi}"],["d6d2","\\mathbf{\\Rho}"],["d6d3","\\mathbf{\\varsigma}"],["d6d4","\\mathbf{\\Sigma}"],["d6d5","\\mathbf{\\Tau}"],["d6d6","\\mathbf{\\Upsilon}"],["d6d7","\\mathbf{\\Phi}"],["d6d8","\\mathbf{\\Chi}"],["d6d9","\\mathbf{\\Psi}"],["d6da","\\mathbf{\\Omega}"],["d6db","\\partial{}"],["d6dc","\\in"],["d6dd","\\mathbf{\\vartheta}"],["d6de","\\mathbf{\\varkappa}"],["d6df","\\mathbf{\\phi}"],["d6e0","\\mathbf{\\varrho}"],["d6e1","\\mathbf{\\varpi}"],["d6e2","\\mathsl{\\Alpha}"],["d6e3","\\mathsl{\\Beta}"],["d6e4","\\mathsl{\\Gamma}"],["d6e5","\\mathsl{\\Delta}"],["d6e6","\\mathsl{\\Epsilon}"],["d6e7","\\mathsl{\\Zeta}"],["d6e8","\\mathsl{\\Eta}"],["d6e9","\\mathsl{\\Theta}"],["d6ea","\\mathsl{\\Iota}"],["d6eb","\\mathsl{\\Kappa}"],["d6ec","\\mathsl{\\Lambda}"],["d6ef","\\mathsl{\\Xi}"],["d6f1","\\mathsl{\\Pi}"],["d6f2","\\mathsl{\\Rho}"],["d6f3","\\mathsl{\\vartheta}"],["d6f4","\\mathsl{\\Sigma}"],["d6f5","\\mathsl{\\Tau}"],["d6f6","\\mathsl{\\Upsilon}"],["d6f7","\\mathsl{\\Phi}"],["d6f8","\\mathsl{\\Chi}"],["d6f9","\\mathsl{\\Psi}"],["d6fa","\\mathsl{\\Omega}"],["d6fb","\\mathsl{\\nabla}"],["d6fc","\\mathsl{\\Alpha}"],["d6fd","\\mathsl{\\Beta}"],["d6fe","\\mathsl{\\Gamma}"],["d6ff","\\mathsl{\\Delta}"],["d700","\\mathsl{\\Epsilon}"],["d701","\\mathsl{\\Zeta}"],["d702","\\mathsl{\\Eta}"],["d703","\\mathsl{\\Theta}"],["d704","\\mathsl{\\Iota}"],["d705","\\mathsl{\\Kappa}"],["d706","\\mathsl{\\Lambda}"],["d709","\\mathsl{\\Xi}"],["d70b","\\mathsl{\\Pi}"],["d70c","\\mathsl{\\Rho}"],["d70d","\\mathsl{\\varsigma}"],["d70e","\\mathsl{\\Sigma}"],["d70f","\\mathsl{\\Tau}"],["d710","\\mathsl{\\Upsilon}"],["d711","\\mathsl{\\Phi}"],["d712","\\mathsl{\\Chi}"],["d713","\\mathsl{\\Psi}"],["d714","\\mathsl{\\Omega}"],["d715","\\partial{}"],["d716","\\in"],["d717","\\mathsl{\\vartheta}"],["d718","\\mathsl{\\varkappa}"],["d719","\\mathsl{\\phi}"],["d71a","\\mathsl{\\varrho}"],["d71b","\\mathsl{\\varpi}"],["d71c","\\mathbit{\\Alpha}"],["d71d","\\mathbit{\\Beta}"],["d71e","\\mathbit{\\Gamma}"],["d71f","\\mathbit{\\Delta}"],["d720","\\mathbit{\\Epsilon}"],["d721","\\mathbit{\\Zeta}"],["d722","\\mathbit{\\Eta}"],["d723","\\mathbit{\\Theta}"],["d724","\\mathbit{\\Iota}"],["d725","\\mathbit{\\Kappa}"],["d726","\\mathbit{\\Lambda}"],["d729","\\mathbit{\\Xi}"],["d72b","\\mathbit{\\Pi}"],["d72c","\\mathbit{\\Rho}"],["d72d","\\mathbit{O}"],["d72e","\\mathbit{\\Sigma}"],["d72f","\\mathbit{\\Tau}"],["d730","\\mathbit{\\Upsilon}"],["d731","\\mathbit{\\Phi}"],["d732","\\mathbit{\\Chi}"],["d733","\\mathbit{\\Psi}"],["d734","\\mathbit{\\Omega}"],["d735","\\mathbit{\\nabla}"],["d736","\\mathbit{\\Alpha}"],["d737","\\mathbit{\\Beta}"],["d738","\\mathbit{\\Gamma}"],["d739","\\mathbit{\\Delta}"],["d73a","\\mathbit{\\Epsilon}"],["d73b","\\mathbit{\\Zeta}"],["d73c","\\mathbit{\\Eta}"],["d73d","\\mathbit{\\Theta}"],["d73e","\\mathbit{\\Iota}"],["d73f","\\mathbit{\\Kappa}"],["d740","\\mathbit{\\Lambda}"],["d743","\\mathbit{\\Xi}"],["d745","\\mathbit{\\Pi}"],["d746","\\mathbit{\\Rho}"],["d747","\\mathbit{\\varsigma}"],["d748","\\mathbit{\\Sigma}"],["d749","\\mathbit{\\Tau}"],["d74a","\\mathbit{\\Upsilon}"],["d74b","\\mathbit{\\Phi}"],["d74c","\\mathbit{\\Chi}"],["d74d","\\mathbit{\\Psi}"],["d74e","\\mathbit{\\Omega}"],["d74f","\\partial{}"],["d750","\\in"],["d751","\\mathbit{\\vartheta}"],["d752","\\mathbit{\\varkappa}"],["d753","\\mathbit{\\phi}"],["d754","\\mathbit{\\varrho}"],["d755","\\mathbit{\\varpi}"],["d756","\\mathsfbf{\\Alpha}"],["d757","\\mathsfbf{\\Beta}"],["d758","\\mathsfbf{\\Gamma}"],["d759","\\mathsfbf{\\Delta}"],["d75a","\\mathsfbf{\\Epsilon}"],["d75b","\\mathsfbf{\\Zeta}"],["d75c","\\mathsfbf{\\Eta}"],["d75d","\\mathsfbf{\\Theta}"],["d75e","\\mathsfbf{\\Iota}"],["d75f","\\mathsfbf{\\Kappa}"],["d760","\\mathsfbf{\\Lambda}"],["d763","\\mathsfbf{\\Xi}"],["d765","\\mathsfbf{\\Pi}"],["d766","\\mathsfbf{\\Rho}"],["d767","\\mathsfbf{\\vartheta}"],["d768","\\mathsfbf{\\Sigma}"],["d769","\\mathsfbf{\\Tau}"],["d76a","\\mathsfbf{\\Upsilon}"],["d76b","\\mathsfbf{\\Phi}"],["d76c","\\mathsfbf{\\Chi}"],["d76d","\\mathsfbf{\\Psi}"],["d76e","\\mathsfbf{\\Omega}"],["d76f","\\mathsfbf{\\nabla}"],["d770","\\mathsfbf{\\Alpha}"],["d771","\\mathsfbf{\\Beta}"],["d772","\\mathsfbf{\\Gamma}"],["d773","\\mathsfbf{\\Delta}"],["d774","\\mathsfbf{\\Epsilon}"],["d775","\\mathsfbf{\\Zeta}"],["d776","\\mathsfbf{\\Eta}"],["d777","\\mathsfbf{\\Theta}"],["d778","\\mathsfbf{\\Iota}"],["d779","\\mathsfbf{\\Kappa}"],["d77a","\\mathsfbf{\\Lambda}"],["d77d","\\mathsfbf{\\Xi}"],["d77f","\\mathsfbf{\\Pi}"],["d780","\\mathsfbf{\\Rho}"],["d781","\\mathsfbf{\\varsigma}"],["d782","\\mathsfbf{\\Sigma}"],["d783","\\mathsfbf{\\Tau}"],["d784","\\mathsfbf{\\Upsilon}"],["d785","\\mathsfbf{\\Phi}"],["d786","\\mathsfbf{\\Chi}"],["d787","\\mathsfbf{\\Psi}"],["d788","\\mathsfbf{\\Omega}"],["d789","\\partial{}"],["d78a","\\in"],["d78b","\\mathsfbf{\\vartheta}"],["d78c","\\mathsfbf{\\varkappa}"],["d78d","\\mathsfbf{\\phi}"],["d78e","\\mathsfbf{\\varrho}"],["d78f","\\mathsfbf{\\varpi}"],["d790","\\mathsfbfsl{\\Alpha}"],["d791","\\mathsfbfsl{\\Beta}"],["d792","\\mathsfbfsl{\\Gamma}"],["d793","\\mathsfbfsl{\\Delta}"],["d794","\\mathsfbfsl{\\Epsilon}"],["d795","\\mathsfbfsl{\\Zeta}"],["d796","\\mathsfbfsl{\\Eta}"],["d797","\\mathsfbfsl{\\vartheta}"],["d798","\\mathsfbfsl{\\Iota}"],["d799","\\mathsfbfsl{\\Kappa}"],["d79a","\\mathsfbfsl{\\Lambda}"],["d79d","\\mathsfbfsl{\\Xi}"],["d79f","\\mathsfbfsl{\\Pi}"],["d7a0","\\mathsfbfsl{\\Rho}"],["d7a1","\\mathsfbfsl{\\vartheta}"],["d7a2","\\mathsfbfsl{\\Sigma}"],["d7a3","\\mathsfbfsl{\\Tau}"],["d7a4","\\mathsfbfsl{\\Upsilon}"],["d7a5","\\mathsfbfsl{\\Phi}"],["d7a6","\\mathsfbfsl{\\Chi}"],["d7a7","\\mathsfbfsl{\\Psi}"],["d7a8","\\mathsfbfsl{\\Omega}"],["d7a9","\\mathsfbfsl{\\nabla}"],["d7aa","\\mathsfbfsl{\\Alpha}"],["d7ab","\\mathsfbfsl{\\Beta}"],["d7ac","\\mathsfbfsl{\\Gamma}"],["d7ad","\\mathsfbfsl{\\Delta}"],["d7ae","\\mathsfbfsl{\\Epsilon}"],["d7af","\\mathsfbfsl{\\Zeta}"],["d7b0","\\mathsfbfsl{\\Eta}"],["d7b1","\\mathsfbfsl{\\vartheta}"],["d7b2","\\mathsfbfsl{\\Iota}"],["d7b3","\\mathsfbfsl{\\Kappa}"],["d7b4","\\mathsfbfsl{\\Lambda}"],["d7b7","\\mathsfbfsl{\\Xi}"],["d7b9","\\mathsfbfsl{\\Pi}"],["d7ba","\\mathsfbfsl{\\Rho}"],["d7bb","\\mathsfbfsl{\\varsigma}"],["d7bc","\\mathsfbfsl{\\Sigma}"],["d7bd","\\mathsfbfsl{\\Tau}"],["d7be","\\mathsfbfsl{\\Upsilon}"],["d7bf","\\mathsfbfsl{\\Phi}"],["d7c0","\\mathsfbfsl{\\Chi}"],["d7c1","\\mathsfbfsl{\\Psi}"],["d7c2","\\mathsfbfsl{\\Omega}"],["d7c3","\\partial{}"],["d7c4","\\in"],["d7c5","\\mathsfbfsl{\\vartheta}"],["d7c6","\\mathsfbfsl{\\varkappa}"],["d7c7","\\mathsfbfsl{\\phi}"],["d7c8","\\mathsfbfsl{\\varrho}"],["d7c9","\\mathsfbfsl{\\varpi}"],["d7ce","\\mathbf{0}"],["d7cf","\\mathbf{1}"],["d7d0","\\mathbf{2}"],["d7d1","\\mathbf{3}"],["d7d2","\\mathbf{4}"],["d7d3","\\mathbf{5}"],["d7d4","\\mathbf{6}"],["d7d5","\\mathbf{7}"],["d7d6","\\mathbf{8}"],["d7d7","\\mathbf{9}"],["d7d8","\\mathbb{0}"],["d7d9","\\mathbb{1}"],["d7da","\\mathbb{2}"],["d7db","\\mathbb{3}"],["d7dc","\\mathbb{4}"],["d7dd","\\mathbb{5}"],["d7de","\\mathbb{6}"],["d7df","\\mathbb{7}"],["d7e0","\\mathbb{8}"],["d7e1","\\mathbb{9}"],["d7e2","\\mathsf{0}"],["d7e3","\\mathsf{1}"],["d7e4","\\mathsf{2}"],["d7e5","\\mathsf{3}"],["d7e6","\\mathsf{4}"],["d7e7","\\mathsf{5}"],["d7e8","\\mathsf{6}"],["d7e9","\\mathsf{7}"],["d7ea","\\mathsf{8}"],["d7eb","\\mathsf{9}"],["d7ec","\\mathsfbf{0}"],["d7ed","\\mathsfbf{1}"],["d7ee","\\mathsfbf{2}"],["d7ef","\\mathsfbf{3}"],["d7f0","\\mathsfbf{4}"],["d7f1","\\mathsfbf{5}"],["d7f2","\\mathsfbf{6}"],["d7f3","\\mathsfbf{7}"],["d7f4","\\mathsfbf{8}"],["d7f5","\\mathsfbf{9}"],["d7f6","\\mathtt{0}"],["d7f7","\\mathtt{1}"],["d7f8","\\mathtt{2}"],["d7f9","\\mathtt{3}"],["d7fa","\\mathtt{4}"],["d7fb","\\mathtt{5}"],["d7fc","\\mathtt{6}"],["d7fd","\\mathtt{7}"],["d7fe","\\mathtt{8}"],["d7ff","\\mathtt{9}"]]);function Ne(m){let E=m;const F=[];E=E.replace(/\$[^$]+\$/g,V=>(F.push(V),`MATH.EXP.${F.length-1}`));let j="",T=!1;for(let V=0;V<E.length;V++){if(T){T=!1,j+=E[V];continue}if(E[V]==="\\"){T=!0,j+=E[V];continue}const N=E.charCodeAt(V).toString(16).padStart(4,"0");j+=Me.get(N)??E[V]}return j.replace(/MATH\.EXP\.(\d+)/g,(V,N)=>F[Number(N)]??"")}s(Ne,"escapeSpecialCharacters");function be(m){return m.replace(/(\w)(\S*)/g,(E,F,j)=>{const T=F+j;return K(T)?T:F.toLocaleUpperCase()+j.toLocaleLowerCase()})}s(be,"titleCase");function K(m){return/^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/.test(m)}s(K,"isRomanNumeral");function Pe(m){return m.replace(/[^0-9A-Za-z]/g,"").toLocaleLowerCase()}s(Pe,"alphaNum");function se(m){return m.replace(/\r\n?/g,`
19
+ `)}s(se,"convertCRLF");function B(m,E){const F=m.split(" "),j=[];let T="";for(const[V,N]of F.entries())T.length+N.length+1>E&&V>0&&(j.push(T.trim()),T=""),T+=`${N} `;return[...j,T.trim()]}s(B,"wrapText");function Se(m){return m.replace(/\s*\n\s*\n\s*/g,"<<BIBTEX_TIDY_PARA>>").replace(/\s*\n\s*/g," ").replace(/<<BIBTEX_TIDY_PARA>>/g,`
20
+
21
+ `)}s(Se,"unwrapText");function Ue(m){const E=P(m),F=E.children.length===1&&E.children[0]?.type==="block"&&E.children[0]?.kind==="curly"&&E.children[0].children.length===1&&E.children[0].children[0]?.type==="block"&&E.children[0].children[0]?.kind==="curly",j=S(E);return F?j:`{${j}}`}s(Ue,"doubleEnclose");function ye(m){return m.replace(/^\{([^{}]*)\}$/g,"$1")}s(ye,"removeEnclosingBraces");function qe(m){return m.replace(/\\?_/g,"\\%5F")}s(qe,"escapeURL");function Le(m,E){const F=m.split(" and ");return F.length>E?[...F.slice(0,E),"others"].join(" and "):m}s(Le,"limitAuthors");function ce(m){let E=m;for(let F=0;F<4;F++)E=E.replace(/(\d)\s*-\s*(\d)/g,"$1--$2");return E}s(ce,"formatPageRange");function nt(m){return m.type!=="text"&&m.block?.type==="entry"}s(nt,"isEntryNode");function ht(m,E,F,j){const T=new Map;if(F)for(const ne of F)T.set(ne,!!j);T.has("key")||T.set("key",!1);const V=new Set,N=[],he=new Map,de=new Map,ue=new Map,pe=new Map;for(const ne of St(m)){const mt=E.get(ne);if(mt)for(const[yt,qt]of T){let ke,Ke;switch(yt){case"key":{if(!ne.key)continue;const Xe=ne.key.toLocaleLowerCase();ke=he.get(Xe),ke?Ke=`The citation key ${ne.key} has already been used.`:he.set(Xe,ne);break}case"doi":{const Xe=Pe(mt.get("doi")??"");if(!Xe)continue;ke=de.get(Xe),ke?Ke=`Entry ${ne.key} has an identical DOI to entry ${ke.key}.`:de.set(Xe,ne);break}case"citation":{const Xe=mt.get("title"),Ct=mt.get("author"),Ut=mt.get("number");if(!Xe||!Ct)continue;const Bt=[Pe(Z(Ct)[0]?.lastName??Ct),Pe(Xe),Pe(Ut??"0")].join(":");ke=ue.get(Bt),ke?Ke=`Entry ${ne.key} has similar content to entry ${ke.key}.`:ue.set(Bt,ne);break}case"abstract":{const Ct=Pe(mt.get("abstract")??"").slice(0,100);if(!Ct)continue;ke=pe.get(Ct),ke?Ke=`Entry ${ne.key} has a similar abstract to entry ${ke.key}.`:pe.set(Ct,ne);break}}ke&&qt&&(V.add(ne),Ze(j,ke,ne)),Ke&&N.push({code:"DUPLICATE_ENTRY",rule:yt,message:`Duplicate ${qt?"removed":"detected"}. ${Ke}`})}}return{entries:V,warnings:N}}s(ht,"checkForDuplicates");function Ze(m,E,F){if(m)switch(m){case"last":E.key=F.key,E.fields=F.fields;break;case"combine":case"overwrite":for(const j of F.fields){const T=E.fields.find(V=>V.name.toLocaleLowerCase()===j.name.toLocaleLowerCase());T?m==="overwrite"&&(T.value=j.value):E.fields.push(j)}break;case"first":return}}s(Ze,"mergeEntries");var Fe=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],Ft=new Set(Fe),J={1:"jan",2:"feb",3:"mar",4:"apr",5:"may",6:"jun",7:"jul",8:"aug",9:"sep",10:"oct",11:"nov",12:"dec",jan:"jan",feb:"feb",mar:"mar",apr:"apr",may:"may",jun:"jun",jul:"jul",aug:"aug",sep:"sep",oct:"oct",nov:"nov",dec:"dec",january:"jan",february:"feb",march:"mar",april:"apr",june:"jun",july:"jul",august:"aug",september:"sep",october:"oct",november:"nov",december:"dec"},De=["url","doi","eprint","file","verba","verbb","verbc","pdf"];function G(m,E,F){const{omit:j,tab:T,space:V}=E,N=T?" ":" ".repeat(V),he=new Set(j);let de=m.children.map(ue=>st(ue,E,N,he,F)).join("").trimEnd();return de.endsWith(`
22
+ `)||(de+=`
23
+ `),de}s(G,"formatBibtex");function st(m,E,F,j,T){if(m.type==="text")return Q(m.text,E);if(!m.block)throw new Error("FATAL!");switch(m.block.type){case"preamble":case"string":return`${m.block.raw}
24
+ ${E.blankLines?`
25
+ `:""}`;case"comment":return Q(m.block.raw,E);case"entry":return ft(m.command,m.block,E,F,j,T?.get(m.block))+(E.blankLines?`
26
+ `:"")}}s(st,"formatNode");function ft(m,E,F,j,T,V){const{align:N,trailingCommas:he,removeDuplicateFields:de,removeEmptyFields:ue,lowercase:pe}=F;let ne="";const mt=pe?m.toLocaleLowerCase():m;ne+=`@${mt}{`;const yt=V??E.key;yt&&(ne+=`${yt},`);const qt=new Set;for(const[ke,Ke]of E.fields.entries()){const Xe=Ke.name.toLocaleLowerCase(),Ct=pe?Xe:Ke.name;if(Ke.name!==""&&!T.has(Xe)&&!(de&&qt.has(Xe))){if(qt.add(Xe),Ke.value.concat.length===0){if(ue)continue;ne+=`
27
+ ${j}${Ct}`}else{const Ut=Ce(Ke,F);if(ue&&(Ut==="{}"||Ut==='""'))continue;ne+=`
28
+ ${j}${Ct.trim().padEnd(N-1)} = ${Ut}`}(ke<E.fields.length-1||he)&&(ne+=",")}}return ne+=`
29
+ }
30
+ `,ne}s(ft,"formatEntry");function Q(m,{stripComments:E,tidyComments:F}){if(E)return"";if(F){const j=m.trim();return j===""?"":`${j}
31
+ `}return m.replace(/^[ \t]*\n|[ \t]*$/g,"")}s(Q,"formatComment");function Ce(m,E){const{curly:F,numeric:j,align:T,stripEnclosingBraces:V,dropAllCaps:N,escape:he,encodeUrls:de,wrap:ue,maxAuthors:pe,tab:ne,space:mt,enclosingBraces:yt,removeBraces:qt,months:ke}=E,Ke=m.name.toLocaleLowerCase(),Xe=ne?" ":" ".repeat(mt),Ct=new Set((yt??[]).map(Bt=>Bt.toLocaleLowerCase())),Ut=new Set((qt??[]).map(Bt=>Bt.toLocaleLowerCase()));return m.value.concat.map(({type:Bt,value:Re})=>{const rs=Re.match(/^[1-9][0-9]*$/);if(rs&&F&&(Bt="braced"),ke&&Ke==="month"){const C=J[Re.toLowerCase()];if(C)return C}if(Bt==="literal"||j&&rs)return Re;const Bn=Re.slice(0,3).toLowerCase(),is=Ke==="month"&&Ft.has(Bn);if(!F&&j&&is)return Bn;if(Re=Se(Re),V&&(Re=ye(Re)),N&&!Re.match(/[a-z]/)&&(Re=be(Re)),Ke==="url"&&de&&(Re=qe(Re)),!De.includes(Ke)&&he&&(Re=Ne(Re)),Ke==="pages"&&(Re=ce(Re)),Ke==="author"&&pe&&(Re=Le(Re,pe)),Ut.has(Ke)&&(Re=S(Be(P(Re)))),Ct.has(Ke)&&(Bt==="braced"||F)&&(Re=Ue(Re)),Bt==="braced"&&m.value.concat.length===1&&(Re=Re.trim()),Bt==="braced"||F){const C=`${Xe}${T}{${Re}}`.length,Ae=Re.includes(`
32
+
33
+ `);if(ue&&C>ue||Ae){let ge=Re.split(`
34
+
35
+ `);const Ge=Xe.repeat(2);if(ue){const Dt=ue;ge=ge.map(Ye=>B(Ye,Dt-Ge.length).join(`
36
+ ${Ge}`))}Re=`
37
+ ${Ge}${ge.join(`
38
+
39
+ ${Ge}`)}
40
+ ${Xe}`}return Ue(Re)}return`"${Re}"`}).join(" # ")}s(Ce,"formatValue");var ee={auth:{description:"Last name of first authors",callback:s(m=>{const F=Z(m.get("author")??"",!0)[0]?.lastName.replace(/(?:[\0-@\[-`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u036F\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482-\u0489\u0530\u0557\u0558\u055A-\u055F\u0589-\u05CF\u05EB-\u05EE\u05F3-\u061F\u064B-\u066D\u0670\u06D4\u06D6-\u06E4\u06E7-\u06ED\u06F0-\u06F9\u06FD\u06FE\u0700-\u070F\u0711\u0730-\u074C\u07A6-\u07B0\u07B2-\u07C9\u07EB-\u07F3\u07F6-\u07F9\u07FB-\u07FF\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u083F\u0859-\u085F\u086B-\u086F\u0888\u088F-\u089F\u08CA-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962-\u0970\u0981-\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA-\u09BC\u09BE-\u09CD\u09CF-\u09DB\u09DE\u09E2-\u09EF\u09F2-\u09FB\u09FD-\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A-\u0A58\u0A5D\u0A5F-\u0A71\u0A75-\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA-\u0ABC\u0ABE-\u0ACF\u0AD1-\u0ADF\u0AE2-\u0AF8\u0AFA-\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A-\u0B3C\u0B3E-\u0B5B\u0B5E\u0B62-\u0B70\u0B72-\u0B82\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BCF\u0BD1-\u0C04\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C3E-\u0C57\u0C5B\u0C5C\u0C5E\u0C5F\u0C62-\u0C7F\u0C81-\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA-\u0CBC\u0CBE-\u0CDC\u0CDF\u0CE2-\u0CF0\u0CF3-\u0D03\u0D0D\u0D11\u0D3B\u0D3C\u0D3E-\u0D4D\u0D4F-\u0D53\u0D57-\u0D5E\u0D62-\u0D79\u0D80-\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0E00\u0E31\u0E34-\u0E3F\u0E47-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EB1\u0EB4-\u0EBC\u0EBE\u0EBF\u0EC5\u0EC7-\u0EDB\u0EE0-\u0EFF\u0F01-\u0F3F\u0F48\u0F6D-\u0F87\u0F8D-\u0FFF\u102B-\u103E\u1040-\u104F\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16F0\u16F9-\u16FF\u1712-\u171E\u1732-\u173F\u1752-\u175F\u176D\u1771-\u177F\u17B4-\u17D6\u17D8-\u17DB\u17DD-\u181F\u1879-\u187F\u1885\u1886\u18A9\u18AB-\u18AF\u18F6-\u18FF\u191F-\u194F\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19FF\u1A17-\u1A1F\u1A55-\u1AA6\u1AA8-\u1B04\u1B34-\u1B44\u1B4D-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BFF\u1C24-\u1C4C\u1C50-\u1C59\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1CFB-\u1CFF\u1DC0-\u1DFF\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u2182\u2185-\u2BFF\u2CE5-\u2CEA\u2CEF-\u2CF1\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7F\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF-\u2E2E\u2E30-\u3004\u3007-\u3030\u3036-\u303A\u303D-\u3040\u3097-\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA620-\uA629\uA62C-\uA63F\uA66F-\uA67E\uA69E\uA69F\uA6E6-\uA716\uA720\uA721\uA789\uA78A\uA7CB-\uA7CF\uA7D2\uA7D4\uA7DA-\uA7F1\uA802\uA806\uA80B\uA823-\uA83F\uA874-\uA881\uA8B4-\uA8F1\uA8F8-\uA8FA\uA8FC\uA8FF-\uA909\uA926-\uA92F\uA947-\uA95F\uA97D-\uA983\uA9B3-\uA9CE\uA9D0-\uA9DF\uA9E5\uA9F0-\uA9F9\uA9FF\uAA29-\uAA3F\uAA43\uAA4C-\uAA5F\uAA77-\uAA79\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAC3-\uAADA\uAADE\uAADF\uAAEB-\uAAF1\uAAF5-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABE3-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB1E\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFE6F\uFE75\uFEFD-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEFF\uDF20-\uDF2C\uDF41\uDF4A-\uDF4F\uDF76-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0-\uDFFF]|\uD801[\uDC9E-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDD6F\uDD7B\uDD8B\uDD93\uDD96\uDDA2\uDDB2\uDDBA\uDDBD-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDF7F\uDF86\uDFB1\uDFBB-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE01-\uDE0F\uDE14\uDE18\uDE36-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE5-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD24-\uDE7F\uDEAA-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF46-\uDF6F\uDF82-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC00-\uDC02\uDC38-\uDC70\uDC73\uDC74\uDC76-\uDC82\uDCB0-\uDCCF\uDCE9-\uDD02\uDD27-\uDD43\uDD45\uDD46\uDD48-\uDD4F\uDD73-\uDD75\uDD77-\uDD82\uDDB3-\uDDC0\uDDC5-\uDDD9\uDDDB\uDDDD-\uDDFF\uDE12\uDE2C-\uDE3E\uDE41-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEDF-\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A-\uDF3C\uDF3E-\uDF4F\uDF51-\uDF5C\uDF62-\uDFFF]|\uD805[\uDC35-\uDC46\uDC4B-\uDC5E\uDC62-\uDC7F\uDCB0-\uDCC3\uDCC6\uDCC8-\uDD7F\uDDAF-\uDDD7\uDDDC-\uDDFF\uDE30-\uDE43\uDE45-\uDE7F\uDEAB-\uDEB7\uDEB9-\uDEFF\uDF1B-\uDF3F\uDF47-\uDFFF]|\uD806[\uDC2C-\uDC9F\uDCE0-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD30-\uDD3E\uDD40\uDD42-\uDD9F\uDDA8\uDDA9\uDDD1-\uDDE0\uDDE2\uDDE4-\uDDFF\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE4F\uDE51-\uDE5B\uDE8A-\uDE9C\uDE9E-\uDEAF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC2F-\uDC3F\uDC41-\uDC71\uDC90-\uDCFF\uDD07\uDD0A\uDD31-\uDD45\uDD47-\uDD5F\uDD66\uDD69\uDD8A-\uDD97\uDD99-\uDEDF\uDEF3-\uDF01\uDF03\uDF11\uDF34-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC00-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80E-\uD810\uD812-\uD819\uD824-\uD82A\uD82D\uD82E\uD830-\uD834\uD836\uD83C-\uD83F\uD87C\uD87D\uD87F\uD889-\uDBFF][\uDC00-\uDFFF]|\uD80B[\uDC00-\uDF8F\uDFF1-\uDFFF]|\uD80D[\uDC30-\uDC40\uDC47-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F-\uDE6F\uDEBF-\uDECF\uDEEE-\uDEFF\uDF30-\uDF3F\uDF44-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4F\uDF51-\uDF92\uDFA0-\uDFDF\uDFE2\uDFE4-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82B[\uDC00-\uDFEF\uDFF4\uDFFC\uDFFF]|\uD82C[\uDD23-\uDD31\uDD33-\uDD4F\uDD53\uDD54\uDD56-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC-\uDFFF]|\uD837[\uDC00-\uDEFF\uDF1F-\uDF24\uDF2B-\uDFFF]|\uD838[\uDC00-\uDC2F\uDC6E-\uDCFF\uDD2D-\uDD36\uDD3E-\uDD4D\uDD4F-\uDE8F\uDEAE-\uDEBF\uDEEC-\uDFFF]|\uD839[\uDC00-\uDCCF\uDCEC-\uDFDF\uDFE7\uDFEC\uDFEF\uDFFF]|\uD83A[\uDCC5-\uDCFF\uDD44-\uDD4A\uDD4C-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD869[\uDEE0-\uDEFF]|\uD86D[\uDF3A-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFEF]|\uD87B[\uDE5E-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDF4F]|\uD888[\uDFB0-\uDFFF])+/g,"_");return F?[F]:[]},"callback")},authEtAl:{description:"If 1 or 2 authors, both authors, otherwise first author and EtAl",callback:s(m=>{const E=Z(m.get("author")??"",!0);return[...E.slice(0,2).map(F=>F.lastName.replace(/(?:[\0-@\[-`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u036F\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482-\u0489\u0530\u0557\u0558\u055A-\u055F\u0589-\u05CF\u05EB-\u05EE\u05F3-\u061F\u064B-\u066D\u0670\u06D4\u06D6-\u06E4\u06E7-\u06ED\u06F0-\u06F9\u06FD\u06FE\u0700-\u070F\u0711\u0730-\u074C\u07A6-\u07B0\u07B2-\u07C9\u07EB-\u07F3\u07F6-\u07F9\u07FB-\u07FF\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u083F\u0859-\u085F\u086B-\u086F\u0888\u088F-\u089F\u08CA-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962-\u0970\u0981-\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA-\u09BC\u09BE-\u09CD\u09CF-\u09DB\u09DE\u09E2-\u09EF\u09F2-\u09FB\u09FD-\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A-\u0A58\u0A5D\u0A5F-\u0A71\u0A75-\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA-\u0ABC\u0ABE-\u0ACF\u0AD1-\u0ADF\u0AE2-\u0AF8\u0AFA-\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A-\u0B3C\u0B3E-\u0B5B\u0B5E\u0B62-\u0B70\u0B72-\u0B82\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BCF\u0BD1-\u0C04\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C3E-\u0C57\u0C5B\u0C5C\u0C5E\u0C5F\u0C62-\u0C7F\u0C81-\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA-\u0CBC\u0CBE-\u0CDC\u0CDF\u0CE2-\u0CF0\u0CF3-\u0D03\u0D0D\u0D11\u0D3B\u0D3C\u0D3E-\u0D4D\u0D4F-\u0D53\u0D57-\u0D5E\u0D62-\u0D79\u0D80-\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0E00\u0E31\u0E34-\u0E3F\u0E47-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EB1\u0EB4-\u0EBC\u0EBE\u0EBF\u0EC5\u0EC7-\u0EDB\u0EE0-\u0EFF\u0F01-\u0F3F\u0F48\u0F6D-\u0F87\u0F8D-\u0FFF\u102B-\u103E\u1040-\u104F\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16F0\u16F9-\u16FF\u1712-\u171E\u1732-\u173F\u1752-\u175F\u176D\u1771-\u177F\u17B4-\u17D6\u17D8-\u17DB\u17DD-\u181F\u1879-\u187F\u1885\u1886\u18A9\u18AB-\u18AF\u18F6-\u18FF\u191F-\u194F\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19FF\u1A17-\u1A1F\u1A55-\u1AA6\u1AA8-\u1B04\u1B34-\u1B44\u1B4D-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BFF\u1C24-\u1C4C\u1C50-\u1C59\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1CFB-\u1CFF\u1DC0-\u1DFF\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u2182\u2185-\u2BFF\u2CE5-\u2CEA\u2CEF-\u2CF1\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7F\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF-\u2E2E\u2E30-\u3004\u3007-\u3030\u3036-\u303A\u303D-\u3040\u3097-\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA620-\uA629\uA62C-\uA63F\uA66F-\uA67E\uA69E\uA69F\uA6E6-\uA716\uA720\uA721\uA789\uA78A\uA7CB-\uA7CF\uA7D2\uA7D4\uA7DA-\uA7F1\uA802\uA806\uA80B\uA823-\uA83F\uA874-\uA881\uA8B4-\uA8F1\uA8F8-\uA8FA\uA8FC\uA8FF-\uA909\uA926-\uA92F\uA947-\uA95F\uA97D-\uA983\uA9B3-\uA9CE\uA9D0-\uA9DF\uA9E5\uA9F0-\uA9F9\uA9FF\uAA29-\uAA3F\uAA43\uAA4C-\uAA5F\uAA77-\uAA79\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAC3-\uAADA\uAADE\uAADF\uAAEB-\uAAF1\uAAF5-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABE3-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB1E\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFE6F\uFE75\uFEFD-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEFF\uDF20-\uDF2C\uDF41\uDF4A-\uDF4F\uDF76-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0-\uDFFF]|\uD801[\uDC9E-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDD6F\uDD7B\uDD8B\uDD93\uDD96\uDDA2\uDDB2\uDDBA\uDDBD-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDF7F\uDF86\uDFB1\uDFBB-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE01-\uDE0F\uDE14\uDE18\uDE36-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE5-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD24-\uDE7F\uDEAA-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF46-\uDF6F\uDF82-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC00-\uDC02\uDC38-\uDC70\uDC73\uDC74\uDC76-\uDC82\uDCB0-\uDCCF\uDCE9-\uDD02\uDD27-\uDD43\uDD45\uDD46\uDD48-\uDD4F\uDD73-\uDD75\uDD77-\uDD82\uDDB3-\uDDC0\uDDC5-\uDDD9\uDDDB\uDDDD-\uDDFF\uDE12\uDE2C-\uDE3E\uDE41-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEDF-\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A-\uDF3C\uDF3E-\uDF4F\uDF51-\uDF5C\uDF62-\uDFFF]|\uD805[\uDC35-\uDC46\uDC4B-\uDC5E\uDC62-\uDC7F\uDCB0-\uDCC3\uDCC6\uDCC8-\uDD7F\uDDAF-\uDDD7\uDDDC-\uDDFF\uDE30-\uDE43\uDE45-\uDE7F\uDEAB-\uDEB7\uDEB9-\uDEFF\uDF1B-\uDF3F\uDF47-\uDFFF]|\uD806[\uDC2C-\uDC9F\uDCE0-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD30-\uDD3E\uDD40\uDD42-\uDD9F\uDDA8\uDDA9\uDDD1-\uDDE0\uDDE2\uDDE4-\uDDFF\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE4F\uDE51-\uDE5B\uDE8A-\uDE9C\uDE9E-\uDEAF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC2F-\uDC3F\uDC41-\uDC71\uDC90-\uDCFF\uDD07\uDD0A\uDD31-\uDD45\uDD47-\uDD5F\uDD66\uDD69\uDD8A-\uDD97\uDD99-\uDEDF\uDEF3-\uDF01\uDF03\uDF11\uDF34-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC00-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80E-\uD810\uD812-\uD819\uD824-\uD82A\uD82D\uD82E\uD830-\uD834\uD836\uD83C-\uD83F\uD87C\uD87D\uD87F\uD889-\uDBFF][\uDC00-\uDFFF]|\uD80B[\uDC00-\uDF8F\uDFF1-\uDFFF]|\uD80D[\uDC30-\uDC40\uDC47-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F-\uDE6F\uDEBF-\uDECF\uDEEE-\uDEFF\uDF30-\uDF3F\uDF44-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4F\uDF51-\uDF92\uDFA0-\uDFDF\uDFE2\uDFE4-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82B[\uDC00-\uDFEF\uDFF4\uDFFC\uDFFF]|\uD82C[\uDD23-\uDD31\uDD33-\uDD4F\uDD53\uDD54\uDD56-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC-\uDFFF]|\uD837[\uDC00-\uDEFF\uDF1F-\uDF24\uDF2B-\uDFFF]|\uD838[\uDC00-\uDC2F\uDC6E-\uDCFF\uDD2D-\uDD36\uDD3E-\uDD4D\uDD4F-\uDE8F\uDEAE-\uDEBF\uDEEC-\uDFFF]|\uD839[\uDC00-\uDCCF\uDCEC-\uDFDF\uDFE7\uDFEC\uDFEF\uDFFF]|\uD83A[\uDCC5-\uDCFF\uDD44-\uDD4A\uDD4C-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD869[\uDEE0-\uDEFF]|\uD86D[\uDF3A-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFEF]|\uD87B[\uDE5E-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDF4F]|\uD888[\uDFB0-\uDFFF])+/g,"_")),...E.length>2?["Et","Al"]:[]]},"callback")},authors:{description:"Last name all authors",callback:s(m=>Z(m.get("author")??"",!0).map(F=>F.lastName.replace(/(?:[\0-@\[-`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u036F\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482-\u0489\u0530\u0557\u0558\u055A-\u055F\u0589-\u05CF\u05EB-\u05EE\u05F3-\u061F\u064B-\u066D\u0670\u06D4\u06D6-\u06E4\u06E7-\u06ED\u06F0-\u06F9\u06FD\u06FE\u0700-\u070F\u0711\u0730-\u074C\u07A6-\u07B0\u07B2-\u07C9\u07EB-\u07F3\u07F6-\u07F9\u07FB-\u07FF\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u083F\u0859-\u085F\u086B-\u086F\u0888\u088F-\u089F\u08CA-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962-\u0970\u0981-\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA-\u09BC\u09BE-\u09CD\u09CF-\u09DB\u09DE\u09E2-\u09EF\u09F2-\u09FB\u09FD-\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A-\u0A58\u0A5D\u0A5F-\u0A71\u0A75-\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA-\u0ABC\u0ABE-\u0ACF\u0AD1-\u0ADF\u0AE2-\u0AF8\u0AFA-\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A-\u0B3C\u0B3E-\u0B5B\u0B5E\u0B62-\u0B70\u0B72-\u0B82\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BCF\u0BD1-\u0C04\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C3E-\u0C57\u0C5B\u0C5C\u0C5E\u0C5F\u0C62-\u0C7F\u0C81-\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA-\u0CBC\u0CBE-\u0CDC\u0CDF\u0CE2-\u0CF0\u0CF3-\u0D03\u0D0D\u0D11\u0D3B\u0D3C\u0D3E-\u0D4D\u0D4F-\u0D53\u0D57-\u0D5E\u0D62-\u0D79\u0D80-\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0E00\u0E31\u0E34-\u0E3F\u0E47-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EB1\u0EB4-\u0EBC\u0EBE\u0EBF\u0EC5\u0EC7-\u0EDB\u0EE0-\u0EFF\u0F01-\u0F3F\u0F48\u0F6D-\u0F87\u0F8D-\u0FFF\u102B-\u103E\u1040-\u104F\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16F0\u16F9-\u16FF\u1712-\u171E\u1732-\u173F\u1752-\u175F\u176D\u1771-\u177F\u17B4-\u17D6\u17D8-\u17DB\u17DD-\u181F\u1879-\u187F\u1885\u1886\u18A9\u18AB-\u18AF\u18F6-\u18FF\u191F-\u194F\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19FF\u1A17-\u1A1F\u1A55-\u1AA6\u1AA8-\u1B04\u1B34-\u1B44\u1B4D-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BFF\u1C24-\u1C4C\u1C50-\u1C59\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1CFB-\u1CFF\u1DC0-\u1DFF\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u2182\u2185-\u2BFF\u2CE5-\u2CEA\u2CEF-\u2CF1\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7F\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF-\u2E2E\u2E30-\u3004\u3007-\u3030\u3036-\u303A\u303D-\u3040\u3097-\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA620-\uA629\uA62C-\uA63F\uA66F-\uA67E\uA69E\uA69F\uA6E6-\uA716\uA720\uA721\uA789\uA78A\uA7CB-\uA7CF\uA7D2\uA7D4\uA7DA-\uA7F1\uA802\uA806\uA80B\uA823-\uA83F\uA874-\uA881\uA8B4-\uA8F1\uA8F8-\uA8FA\uA8FC\uA8FF-\uA909\uA926-\uA92F\uA947-\uA95F\uA97D-\uA983\uA9B3-\uA9CE\uA9D0-\uA9DF\uA9E5\uA9F0-\uA9F9\uA9FF\uAA29-\uAA3F\uAA43\uAA4C-\uAA5F\uAA77-\uAA79\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAC3-\uAADA\uAADE\uAADF\uAAEB-\uAAF1\uAAF5-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABE3-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB1E\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFE6F\uFE75\uFEFD-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEFF\uDF20-\uDF2C\uDF41\uDF4A-\uDF4F\uDF76-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0-\uDFFF]|\uD801[\uDC9E-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDD6F\uDD7B\uDD8B\uDD93\uDD96\uDDA2\uDDB2\uDDBA\uDDBD-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDF7F\uDF86\uDFB1\uDFBB-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE01-\uDE0F\uDE14\uDE18\uDE36-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE5-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD24-\uDE7F\uDEAA-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF46-\uDF6F\uDF82-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC00-\uDC02\uDC38-\uDC70\uDC73\uDC74\uDC76-\uDC82\uDCB0-\uDCCF\uDCE9-\uDD02\uDD27-\uDD43\uDD45\uDD46\uDD48-\uDD4F\uDD73-\uDD75\uDD77-\uDD82\uDDB3-\uDDC0\uDDC5-\uDDD9\uDDDB\uDDDD-\uDDFF\uDE12\uDE2C-\uDE3E\uDE41-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEDF-\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A-\uDF3C\uDF3E-\uDF4F\uDF51-\uDF5C\uDF62-\uDFFF]|\uD805[\uDC35-\uDC46\uDC4B-\uDC5E\uDC62-\uDC7F\uDCB0-\uDCC3\uDCC6\uDCC8-\uDD7F\uDDAF-\uDDD7\uDDDC-\uDDFF\uDE30-\uDE43\uDE45-\uDE7F\uDEAB-\uDEB7\uDEB9-\uDEFF\uDF1B-\uDF3F\uDF47-\uDFFF]|\uD806[\uDC2C-\uDC9F\uDCE0-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD30-\uDD3E\uDD40\uDD42-\uDD9F\uDDA8\uDDA9\uDDD1-\uDDE0\uDDE2\uDDE4-\uDDFF\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE4F\uDE51-\uDE5B\uDE8A-\uDE9C\uDE9E-\uDEAF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC2F-\uDC3F\uDC41-\uDC71\uDC90-\uDCFF\uDD07\uDD0A\uDD31-\uDD45\uDD47-\uDD5F\uDD66\uDD69\uDD8A-\uDD97\uDD99-\uDEDF\uDEF3-\uDF01\uDF03\uDF11\uDF34-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC00-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80E-\uD810\uD812-\uD819\uD824-\uD82A\uD82D\uD82E\uD830-\uD834\uD836\uD83C-\uD83F\uD87C\uD87D\uD87F\uD889-\uDBFF][\uDC00-\uDFFF]|\uD80B[\uDC00-\uDF8F\uDFF1-\uDFFF]|\uD80D[\uDC30-\uDC40\uDC47-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F-\uDE6F\uDEBF-\uDECF\uDEEE-\uDEFF\uDF30-\uDF3F\uDF44-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4F\uDF51-\uDF92\uDFA0-\uDFDF\uDFE2\uDFE4-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82B[\uDC00-\uDFEF\uDFF4\uDFFC\uDFFF]|\uD82C[\uDD23-\uDD31\uDD33-\uDD4F\uDD53\uDD54\uDD56-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC-\uDFFF]|\uD837[\uDC00-\uDEFF\uDF1F-\uDF24\uDF2B-\uDFFF]|\uD838[\uDC00-\uDC2F\uDC6E-\uDCFF\uDD2D-\uDD36\uDD3E-\uDD4D\uDD4F-\uDE8F\uDEAE-\uDEBF\uDEEC-\uDFFF]|\uD839[\uDC00-\uDCCF\uDCEC-\uDFDF\uDFE7\uDFEC\uDFEF\uDFFF]|\uD83A[\uDCC5-\uDCFF\uDD44-\uDD4A\uDD4C-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD869[\uDEE0-\uDEFF]|\uD86D[\uDF3A-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFEF]|\uD87B[\uDE5E-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDF4F]|\uD888[\uDFB0-\uDFFF])+/g,"_")),"callback")},authorsN:{description:"Last name N authors, with EtAl if more",callback:s((m,E=0)=>{const F=Z(m.get("author")??"",!0);return[...F.slice(0,E).map(j=>j.lastName.replace(/(?:[\0-@\[-`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u036F\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482-\u0489\u0530\u0557\u0558\u055A-\u055F\u0589-\u05CF\u05EB-\u05EE\u05F3-\u061F\u064B-\u066D\u0670\u06D4\u06D6-\u06E4\u06E7-\u06ED\u06F0-\u06F9\u06FD\u06FE\u0700-\u070F\u0711\u0730-\u074C\u07A6-\u07B0\u07B2-\u07C9\u07EB-\u07F3\u07F6-\u07F9\u07FB-\u07FF\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u083F\u0859-\u085F\u086B-\u086F\u0888\u088F-\u089F\u08CA-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962-\u0970\u0981-\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA-\u09BC\u09BE-\u09CD\u09CF-\u09DB\u09DE\u09E2-\u09EF\u09F2-\u09FB\u09FD-\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A-\u0A58\u0A5D\u0A5F-\u0A71\u0A75-\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA-\u0ABC\u0ABE-\u0ACF\u0AD1-\u0ADF\u0AE2-\u0AF8\u0AFA-\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A-\u0B3C\u0B3E-\u0B5B\u0B5E\u0B62-\u0B70\u0B72-\u0B82\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BCF\u0BD1-\u0C04\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C3E-\u0C57\u0C5B\u0C5C\u0C5E\u0C5F\u0C62-\u0C7F\u0C81-\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA-\u0CBC\u0CBE-\u0CDC\u0CDF\u0CE2-\u0CF0\u0CF3-\u0D03\u0D0D\u0D11\u0D3B\u0D3C\u0D3E-\u0D4D\u0D4F-\u0D53\u0D57-\u0D5E\u0D62-\u0D79\u0D80-\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0E00\u0E31\u0E34-\u0E3F\u0E47-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EB1\u0EB4-\u0EBC\u0EBE\u0EBF\u0EC5\u0EC7-\u0EDB\u0EE0-\u0EFF\u0F01-\u0F3F\u0F48\u0F6D-\u0F87\u0F8D-\u0FFF\u102B-\u103E\u1040-\u104F\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16F0\u16F9-\u16FF\u1712-\u171E\u1732-\u173F\u1752-\u175F\u176D\u1771-\u177F\u17B4-\u17D6\u17D8-\u17DB\u17DD-\u181F\u1879-\u187F\u1885\u1886\u18A9\u18AB-\u18AF\u18F6-\u18FF\u191F-\u194F\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19FF\u1A17-\u1A1F\u1A55-\u1AA6\u1AA8-\u1B04\u1B34-\u1B44\u1B4D-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BFF\u1C24-\u1C4C\u1C50-\u1C59\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1CFB-\u1CFF\u1DC0-\u1DFF\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u2182\u2185-\u2BFF\u2CE5-\u2CEA\u2CEF-\u2CF1\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7F\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF-\u2E2E\u2E30-\u3004\u3007-\u3030\u3036-\u303A\u303D-\u3040\u3097-\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA620-\uA629\uA62C-\uA63F\uA66F-\uA67E\uA69E\uA69F\uA6E6-\uA716\uA720\uA721\uA789\uA78A\uA7CB-\uA7CF\uA7D2\uA7D4\uA7DA-\uA7F1\uA802\uA806\uA80B\uA823-\uA83F\uA874-\uA881\uA8B4-\uA8F1\uA8F8-\uA8FA\uA8FC\uA8FF-\uA909\uA926-\uA92F\uA947-\uA95F\uA97D-\uA983\uA9B3-\uA9CE\uA9D0-\uA9DF\uA9E5\uA9F0-\uA9F9\uA9FF\uAA29-\uAA3F\uAA43\uAA4C-\uAA5F\uAA77-\uAA79\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAC3-\uAADA\uAADE\uAADF\uAAEB-\uAAF1\uAAF5-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABE3-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB1E\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFE6F\uFE75\uFEFD-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEFF\uDF20-\uDF2C\uDF41\uDF4A-\uDF4F\uDF76-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0-\uDFFF]|\uD801[\uDC9E-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDD6F\uDD7B\uDD8B\uDD93\uDD96\uDDA2\uDDB2\uDDBA\uDDBD-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDF7F\uDF86\uDFB1\uDFBB-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE01-\uDE0F\uDE14\uDE18\uDE36-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE5-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD24-\uDE7F\uDEAA-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF46-\uDF6F\uDF82-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC00-\uDC02\uDC38-\uDC70\uDC73\uDC74\uDC76-\uDC82\uDCB0-\uDCCF\uDCE9-\uDD02\uDD27-\uDD43\uDD45\uDD46\uDD48-\uDD4F\uDD73-\uDD75\uDD77-\uDD82\uDDB3-\uDDC0\uDDC5-\uDDD9\uDDDB\uDDDD-\uDDFF\uDE12\uDE2C-\uDE3E\uDE41-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEDF-\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A-\uDF3C\uDF3E-\uDF4F\uDF51-\uDF5C\uDF62-\uDFFF]|\uD805[\uDC35-\uDC46\uDC4B-\uDC5E\uDC62-\uDC7F\uDCB0-\uDCC3\uDCC6\uDCC8-\uDD7F\uDDAF-\uDDD7\uDDDC-\uDDFF\uDE30-\uDE43\uDE45-\uDE7F\uDEAB-\uDEB7\uDEB9-\uDEFF\uDF1B-\uDF3F\uDF47-\uDFFF]|\uD806[\uDC2C-\uDC9F\uDCE0-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD30-\uDD3E\uDD40\uDD42-\uDD9F\uDDA8\uDDA9\uDDD1-\uDDE0\uDDE2\uDDE4-\uDDFF\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE4F\uDE51-\uDE5B\uDE8A-\uDE9C\uDE9E-\uDEAF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC2F-\uDC3F\uDC41-\uDC71\uDC90-\uDCFF\uDD07\uDD0A\uDD31-\uDD45\uDD47-\uDD5F\uDD66\uDD69\uDD8A-\uDD97\uDD99-\uDEDF\uDEF3-\uDF01\uDF03\uDF11\uDF34-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC00-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80E-\uD810\uD812-\uD819\uD824-\uD82A\uD82D\uD82E\uD830-\uD834\uD836\uD83C-\uD83F\uD87C\uD87D\uD87F\uD889-\uDBFF][\uDC00-\uDFFF]|\uD80B[\uDC00-\uDF8F\uDFF1-\uDFFF]|\uD80D[\uDC30-\uDC40\uDC47-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F-\uDE6F\uDEBF-\uDECF\uDEEE-\uDEFF\uDF30-\uDF3F\uDF44-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4F\uDF51-\uDF92\uDFA0-\uDFDF\uDFE2\uDFE4-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82B[\uDC00-\uDFEF\uDFF4\uDFFC\uDFFF]|\uD82C[\uDD23-\uDD31\uDD33-\uDD4F\uDD53\uDD54\uDD56-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC-\uDFFF]|\uD837[\uDC00-\uDEFF\uDF1F-\uDF24\uDF2B-\uDFFF]|\uD838[\uDC00-\uDC2F\uDC6E-\uDCFF\uDD2D-\uDD36\uDD3E-\uDD4D\uDD4F-\uDE8F\uDEAE-\uDEBF\uDEEC-\uDFFF]|\uD839[\uDC00-\uDCCF\uDCEC-\uDFDF\uDFE7\uDFEC\uDFEF\uDFFF]|\uD83A[\uDCC5-\uDCFF\uDD44-\uDD4A\uDD4C-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD869[\uDEE0-\uDEFF]|\uD86D[\uDF3A-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFEF]|\uD87B[\uDE5E-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDF4F]|\uD888[\uDFB0-\uDFFF])+/g,"_")),...F.length>E?["Et","Al"]:[]]},"callback")},veryshorttitle:{description:"First non-function word of the title",callback:s(m=>bt(we(m)).slice(0,1),"callback")},shorttitle:{description:"First three non-function words of the title",callback:s(m=>bt(we(m)).slice(0,3),"callback")},title:{description:"Full title, capitalized",callback:s(m=>rt(vt(we(m))),"callback")},fulltitle:{description:"Full title, verbatim",callback:s(m=>vt(we(m)),"callback")},year:{description:"Year",callback:s(m=>{const E=m.get("year")?.replace(/[^0-9]/g,"");return E?[E]:[]},"callback")},duplicateLetter:{description:"If the multiple entries end up with the same key, then insert a letter a-z. By default this will be inserted at the end.",callback:s(()=>["[duplicateLetter]"],"callback")},duplicateNumber:{description:"If the multiple entries end up with the same key, then insert a number.",callback:s(()=>["[duplicateNumber]"],"callback")}},We={required:{description:"If data is missing, revert to existing key",callback:s(m=>{if(m.length===0)throw new Qe;return m},"callback")},lower:{description:"Convert to lowercase",callback:s(m=>m.map(E=>E.toLocaleLowerCase()),"callback")},upper:{description:"Convert to uppercase",callback:s(m=>m.map(E=>E.toLocaleUpperCase()),"callback")},capitalize:{description:"Capitalize first letter of each word",callback:rt}},Qe=class extends Error{static{s(this,"MissingRequiredData")}};function xe(m,E,F){let j=F;!F.includes("[duplicateLetter]")&&!F.includes("[duplicateNumber]")&&(j=`${F}[duplicateLetter]`);const T=new Map;for(const N of m.children)if(nt(N)){const he=E.get(N.block);if(!he)continue;const de=et(he,j);if(!de)continue;const ue=T.get(de)??[];T.set(de,[...ue,N.block])}const V=new Map;for(const[N,he]of T)for(const[de,ue]of he.entries()){const pe=he.length>1?String.fromCharCode(97+de):"",ne=he.length>1?String(de+1):"";ue.key=N.replace(/\[duplicateLetter\]/g,pe).replace(/\[duplicateNumber\]/g,ne)}return V}s(xe,"generateKeys");function et(m,E){try{const F=E.replace(/\[[^:\]]+(?::[^:\]]+)*\]/g,j=>{const[T,...V]=j.slice(1,-1).split(":");if(!T)throw new Error("Token parse error");let N;const he=T.replace(/[0-9]+/g,pe=>(N=Number(pe),"N")),de=ee[he];let ue;if(de)ue=de.callback(m,N);else if(he===he.toLocaleUpperCase()){const pe=m.get(he.toLocaleLowerCase());ue=pe?vt(pe):[]}else throw new Error(`Invalid citation key token ${he}`);for(const pe of V){const ne=We[pe];if(ne)ue=ne.callback(ue);else throw new Error(`Invalid modifier ${pe}`)}return ue.join("")});return F===""?void 0:F}catch(F){if(F instanceof Qe)return;throw F}}s(et,"generateKey");var Ht=new Set(["a","about","above","across","against","along","among","an","and","around","at","before","behind","below","beneath","beside","between","beyond","but","by","down","during","except","for","for","from","in","inside","into","like","near","nor","of","off","on","onto","or","since","so","the","through","to","toward","under","until","up","upon","with","within","without","yet"]);function bt(m){return vt(m).filter(E=>!Ht.has(E.toLocaleLowerCase()))}s(bt,"nonFunctionWords");function vt(m){return m.split(/(?:[\0-\/:-@\[-`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u036F\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482-\u0489\u0530\u0557\u0558\u055A-\u055F\u0589-\u05CF\u05EB-\u05EE\u05F3-\u061F\u064B-\u066D\u0670\u06D4\u06D6-\u06E4\u06E7-\u06ED\u06F0-\u06F9\u06FD\u06FE\u0700-\u070F\u0711\u0730-\u074C\u07A6-\u07B0\u07B2-\u07C9\u07EB-\u07F3\u07F6-\u07F9\u07FB-\u07FF\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u083F\u0859-\u085F\u086B-\u086F\u0888\u088F-\u089F\u08CA-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962-\u0970\u0981-\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA-\u09BC\u09BE-\u09CD\u09CF-\u09DB\u09DE\u09E2-\u09EF\u09F2-\u09FB\u09FD-\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A-\u0A58\u0A5D\u0A5F-\u0A71\u0A75-\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA-\u0ABC\u0ABE-\u0ACF\u0AD1-\u0ADF\u0AE2-\u0AF8\u0AFA-\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A-\u0B3C\u0B3E-\u0B5B\u0B5E\u0B62-\u0B70\u0B72-\u0B82\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BCF\u0BD1-\u0C04\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C3E-\u0C57\u0C5B\u0C5C\u0C5E\u0C5F\u0C62-\u0C7F\u0C81-\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA-\u0CBC\u0CBE-\u0CDC\u0CDF\u0CE2-\u0CF0\u0CF3-\u0D03\u0D0D\u0D11\u0D3B\u0D3C\u0D3E-\u0D4D\u0D4F-\u0D53\u0D57-\u0D5E\u0D62-\u0D79\u0D80-\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0E00\u0E31\u0E34-\u0E3F\u0E47-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EB1\u0EB4-\u0EBC\u0EBE\u0EBF\u0EC5\u0EC7-\u0EDB\u0EE0-\u0EFF\u0F01-\u0F3F\u0F48\u0F6D-\u0F87\u0F8D-\u0FFF\u102B-\u103E\u1040-\u104F\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16F0\u16F9-\u16FF\u1712-\u171E\u1732-\u173F\u1752-\u175F\u176D\u1771-\u177F\u17B4-\u17D6\u17D8-\u17DB\u17DD-\u181F\u1879-\u187F\u1885\u1886\u18A9\u18AB-\u18AF\u18F6-\u18FF\u191F-\u194F\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19FF\u1A17-\u1A1F\u1A55-\u1AA6\u1AA8-\u1B04\u1B34-\u1B44\u1B4D-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BFF\u1C24-\u1C4C\u1C50-\u1C59\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1CFB-\u1CFF\u1DC0-\u1DFF\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u2182\u2185-\u2BFF\u2CE5-\u2CEA\u2CEF-\u2CF1\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7F\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF-\u2E2E\u2E30-\u3004\u3007-\u3030\u3036-\u303A\u303D-\u3040\u3097-\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA620-\uA629\uA62C-\uA63F\uA66F-\uA67E\uA69E\uA69F\uA6E6-\uA716\uA720\uA721\uA789\uA78A\uA7CB-\uA7CF\uA7D2\uA7D4\uA7DA-\uA7F1\uA802\uA806\uA80B\uA823-\uA83F\uA874-\uA881\uA8B4-\uA8F1\uA8F8-\uA8FA\uA8FC\uA8FF-\uA909\uA926-\uA92F\uA947-\uA95F\uA97D-\uA983\uA9B3-\uA9CE\uA9D0-\uA9DF\uA9E5\uA9F0-\uA9F9\uA9FF\uAA29-\uAA3F\uAA43\uAA4C-\uAA5F\uAA77-\uAA79\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAC3-\uAADA\uAADE\uAADF\uAAEB-\uAAF1\uAAF5-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABE3-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB1E\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFE6F\uFE75\uFEFD-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEFF\uDF20-\uDF2C\uDF41\uDF4A-\uDF4F\uDF76-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0-\uDFFF]|\uD801[\uDC9E-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDD6F\uDD7B\uDD8B\uDD93\uDD96\uDDA2\uDDB2\uDDBA\uDDBD-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDF7F\uDF86\uDFB1\uDFBB-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE01-\uDE0F\uDE14\uDE18\uDE36-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE5-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD24-\uDE7F\uDEAA-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF46-\uDF6F\uDF82-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC00-\uDC02\uDC38-\uDC70\uDC73\uDC74\uDC76-\uDC82\uDCB0-\uDCCF\uDCE9-\uDD02\uDD27-\uDD43\uDD45\uDD46\uDD48-\uDD4F\uDD73-\uDD75\uDD77-\uDD82\uDDB3-\uDDC0\uDDC5-\uDDD9\uDDDB\uDDDD-\uDDFF\uDE12\uDE2C-\uDE3E\uDE41-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEDF-\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A-\uDF3C\uDF3E-\uDF4F\uDF51-\uDF5C\uDF62-\uDFFF]|\uD805[\uDC35-\uDC46\uDC4B-\uDC5E\uDC62-\uDC7F\uDCB0-\uDCC3\uDCC6\uDCC8-\uDD7F\uDDAF-\uDDD7\uDDDC-\uDDFF\uDE30-\uDE43\uDE45-\uDE7F\uDEAB-\uDEB7\uDEB9-\uDEFF\uDF1B-\uDF3F\uDF47-\uDFFF]|\uD806[\uDC2C-\uDC9F\uDCE0-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD30-\uDD3E\uDD40\uDD42-\uDD9F\uDDA8\uDDA9\uDDD1-\uDDE0\uDDE2\uDDE4-\uDDFF\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE4F\uDE51-\uDE5B\uDE8A-\uDE9C\uDE9E-\uDEAF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC2F-\uDC3F\uDC41-\uDC71\uDC90-\uDCFF\uDD07\uDD0A\uDD31-\uDD45\uDD47-\uDD5F\uDD66\uDD69\uDD8A-\uDD97\uDD99-\uDEDF\uDEF3-\uDF01\uDF03\uDF11\uDF34-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC00-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80E-\uD810\uD812-\uD819\uD824-\uD82A\uD82D\uD82E\uD830-\uD834\uD836\uD83C-\uD83F\uD87C\uD87D\uD87F\uD889-\uDBFF][\uDC00-\uDFFF]|\uD80B[\uDC00-\uDF8F\uDFF1-\uDFFF]|\uD80D[\uDC30-\uDC40\uDC47-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F-\uDE6F\uDEBF-\uDECF\uDEEE-\uDEFF\uDF30-\uDF3F\uDF44-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4F\uDF51-\uDF92\uDFA0-\uDFDF\uDFE2\uDFE4-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82B[\uDC00-\uDFEF\uDFF4\uDFFC\uDFFF]|\uD82C[\uDD23-\uDD31\uDD33-\uDD4F\uDD53\uDD54\uDD56-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC-\uDFFF]|\uD837[\uDC00-\uDEFF\uDF1F-\uDF24\uDF2B-\uDFFF]|\uD838[\uDC00-\uDC2F\uDC6E-\uDCFF\uDD2D-\uDD36\uDD3E-\uDD4D\uDD4F-\uDE8F\uDEAE-\uDEBF\uDEEC-\uDFFF]|\uD839[\uDC00-\uDCCF\uDCEC-\uDFDF\uDFE7\uDFEC\uDFEF\uDFFF]|\uD83A[\uDCC5-\uDCFF\uDD44-\uDD4A\uDD4C-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD869[\uDEE0-\uDEFF]|\uD86D[\uDF3A-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFEF]|\uD87B[\uDE5E-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDF4F]|\uD888[\uDFB0-\uDFFF])+/).filter(E=>E.length>0)}s(vt,"words");function rt(m){return m.map(E=>E.slice(0,1).toLocaleUpperCase()+E.slice(1).toLocaleLowerCase())}s(rt,"capitalize");function we(m){return m.get("title")??m.get("booktitle")??""}s(we,"title");var pt=["doi","citation","abstract"],w=14,$=2,z=80,ae=["title","shorttitle","author","year","month","day","journal","booktitle","location","on","publisher","address","series","volume","number","pages","doi","isbn","issn","url","urldate","copyright","category","note","metadata"],ut=["key"],Oe="[auth:required:lower][year:required][veryshorttitle:lower][duplicateNumber]",jt=[{key:"help",cli:{"--help":!0,"-h":!0},title:"Help",description:["Show help"],type:"boolean"},{key:"v2",cli:{"--v2":!0},title:"Enable planned v2 CLI changes",description:["Input files will no longer be modified by default. Instead, you will need to specify `--modify`/`-m` option to overwrite the file, or `--output`/`-o` to output to a different file."],type:"string",defaultValue:void 0},{key:"outputPath",cli:{"--output":s(m=>m[0],"--output"),"-o":s(m=>m[0],"-o")},title:"Output path",description:["Write output to specified path. When omitted (and -m/--modify is not used), the result will be printed to stdout."],type:"string",defaultValue:void 0},{key:"modify",cli:{"--modify":!0,"-m":!0,"--no-modify":!1},title:"Modify input files",description:["Overwrite the original input files with the tidied result. This is enabled by default but will be disabled by default in v2. For v1, use --no-modify to output to stdout instead of overwriting the input files."],type:"boolean",defaultValue:!0},{key:"omit",cli:{"--omit":s(m=>(m.length===0&&(console.error("Expected a omit list"),process.exit(1)),m),"--omit")},toCLI:s(m=>Array.isArray(m)&&m.length>0?`--omit=${m.join(",")}`:void 0,"toCLI"),title:"Remove fields",description:["Remove specified fields from bibliography entries."],examples:["--omit=id,name"],type:"string[]",defaultValue:[]},{key:"curly",cli:{"--curly":!0,"--no-curly":!1},toCLI:s(m=>m?"--curly":void 0,"toCLI"),title:"Enclose values in braces",description:['Enclose all property values in braces. Quoted values will be converted to braces. For example, "Journal of Tea" will become {Journal of Tea}.'],type:"boolean",defaultValue:!1},{key:"numeric",cli:{"--numeric":!0,"--no-numeric":!1},toCLI:s(m=>m?"--numeric":void 0,"toCLI"),title:"Use numeric values where possible",description:["Strip quotes and braces from numeric/month values. For example, {1998} will become 1998."],type:"boolean",defaultValue:!1},{key:"months",cli:{"--months":!0},toCLI:s(m=>m?"--months":void 0,"toCLI"),title:"Abbreviate months",description:["Convert all months to three letter abbreviations (jan, feb, etc)."],type:"boolean",defaultValue:!1},{key:"space",cli:{"--space":s(m=>m.length>0?Number(m[0]):!0,"--space")},toCLI:s((m,E)=>{if(!E.tab){if(typeof m=="number"&&m!==$)return`--space=${m}`;if(m&&m!==$)return"--space"}},"toCLI"),title:"Indent with spaces",description:["Indent all fields with the specified number of spaces. Ignored if tab is set."],examples:["--space=2 (default)","--space=4"],type:"boolean | number",convertBoolean:{true:$,false:void 0},defaultValue:$},{key:"tab",cli:{"--tab":!0,"--no-tab":!1},toCLI:s(m=>m?"--tab":void 0,"toCLI"),title:"Indent with tabs",description:["Indent all fields with a tab."],type:"boolean",defaultValue:!1},{key:"align",cli:{"--align":s(m=>Number(m[0]),"--align"),"--no-align":!1},toCLI:s(m=>{if(m===!1||m===1||m===0)return"--no-align";if(typeof m=="number"&&m!==w)return`--align=${m}`},"toCLI"),title:"Align values",description:["Insert whitespace between fields and values so that values are visually aligned."],examples:["--align=14 (default)"],type:"boolean | number",convertBoolean:{true:w,false:1},defaultValue:w},{key:"blankLines",cli:{"--blank-lines":!0,"--no-blank-lines":!1},toCLI:s(m=>m?"--blank-lines":void 0,"toCLI"),title:"Insert blank lines",description:["Insert an empty line between each entry."],type:"boolean"},{key:"sort",cli:{"--sort":s(m=>m.length>0?m:!0,"--sort"),"--no-sort":!1},toCLI:s(m=>{if(Array.isArray(m)&&m.length>0)return`--sort=${m.join(",")}`;if(m===!0)return"--sort"},"toCLI"),title:"Sort bibliography entries",description:["Sort entries by the specified field names (citation key is used if no fields are specified). For descending order, prefix the field with a dash (-).","Multiple fields may be specified to sort everything by first field, then by the second field whenever the first field for entries are equal, etc.","The following additional fields are also permitted: key (entry citation key), type (sorts by the type of entry, e.g. article), and special (ensures that @string, @preamble, @set, and @xdata entries are first). "],examples:["--sort (sort by citation key)","--sort=-year,name (sort year descending then name ascending)","--sort=name,year"],type:"boolean | string[]",convertBoolean:{true:ut,false:void 0}},{key:"duplicates",cli:{"--duplicates":s(m=>{if(m.length===0)return!0;for(const E of m)E!=="doi"&&E!=="key"&&E!=="abstract"&&E!=="citation"&&(console.error(`Invalid key for merge option: "${E}"`),process.exit(1));return m},"--duplicates")},toCLI:s(m=>{if(Array.isArray(m)&&m.length>0)return`--duplicates=${m.join(",")}`;if(m===!0)return"--duplicates"},"toCLI"),title:"Check for duplicates",description:["Warn if duplicates are found, which are entries where DOI, abstract, or author and title are the same."],examples:["--duplicates doi (same DOIs)","--duplicates key (same IDs)","--duplicates abstract (similar abstracts)","--duplicates citation (similar author and titles)","--duplicates doi, key (identical DOI or keys)","--duplicates (same DOI, key, abstract, or citation)"],type:"boolean | ('doi' | 'key' | 'abstract' | 'citation')[]",convertBoolean:{true:pt,false:void 0},defaultValue:s(m=>m.merge?pt:void 0,"defaultValue")},{key:"merge",cli:{"--merge":s(m=>m.length===0?!0:(m[0]!=="first"&&m[0]!=="last"&&m[0]!=="combine"&&m[0]!=="overwrite"&&(console.error(`Invalid merge strategy: "${m[0]}"`),process.exit(1)),m[0]),"--merge"),"--no-merge":!1},toCLI:s(m=>{if(typeof m=="string")return`--merge=${m}`;if(m)return"--merge"},"toCLI"),title:"Merge duplicate entries",description:["Merge duplicates entries. Use the duplicates option to determine how duplicates are identified. There are different ways to merge:","- first: only keep the original entry","- last: only keep the last found duplicate","- combine: keep original entry and merge in fields of duplicates if they do not already exist","- overwrite: keep original entry and merge in fields of duplicates, overwriting existing fields if they exist"],type:"boolean | 'first' | 'last' | 'combine' | 'overwrite'",convertBoolean:{true:"combine",false:void 0}},{key:"stripEnclosingBraces",cli:{"--strip-enclosing-braces":!0},toCLI:s(m=>m?"--strip-enclosing-braces":void 0,"toCLI"),title:"Strip double-braced values",description:["Where an entire value is enclosed in double braces, remove the extra braces. For example, {{Journal of Tea}} will become {Journal of Tea}."],type:"boolean",defaultValue:!1},{key:"dropAllCaps",cli:{"--drop-all-caps":!0},toCLI:s(m=>m?"--drop-all-caps":void 0,"toCLI"),title:"Drop all caps",description:["Where values are all caps, make them title case. For example, {JOURNAL OF TEA} will become {Journal of Tea}. Roman numerals will be left unchanged."],type:"boolean",defaultValue:!1},{key:"escape",cli:{"--escape":!0,"--no-escape":!1},toCLI:s(m=>m===!1?"--no-escape":void 0,"toCLI"),title:"Escape special characters",description:["Escape special characters, such as umlaut. This ensures correct typesetting with latex. Enabled by default."],type:"boolean",defaultValue:!0},{key:"sortFields",cli:{"--sort-fields":s(m=>m.length>0?m:!0,"--sort-fields")},toCLI:s(m=>{if(Array.isArray(m)&&m.length>0)return JSON.stringify(m)===JSON.stringify(ae)?"--sort-fields":`--sort-fields=${m.join(",")}`;if(m===!0)return"--sort-fields"},"toCLI"),title:"Sort fields",description:["Sort the fields within entries.","If no fields are specified fields will be sorted by: title, shorttitle, author, year, month, day, journal, booktitle, location, on, publisher, address, series, volume, number, pages, doi, isbn, issn, url, urldate, copyright, category, note, metadata"],examples:["--sort-fields=name,author"],type:"boolean | string[]",convertBoolean:{true:ae,false:void 0},defaultValue:void 0},{key:"sortProperties",cli:{"--sort-properties":s(m=>m.length>0?m:!0,"--sort-properties")},title:"Sort properties",description:["Alias of sort fields (legacy)"],type:"boolean | string[]",deprecated:!0},{key:"stripComments",cli:{"--strip-comments":!0,"--no-strip-comments":!1},toCLI:s(m=>m?"--strip-comments":void 0,"toCLI"),title:"Remove comments",description:["Remove all comments from the bibtex source."],type:"boolean",defaultValue:!1},{key:"trailingCommas",cli:{"--trailing-commas":!0,"--no-trailing-commas":!0},toCLI:s(m=>m?"--trailing-commas":void 0,"toCLI"),title:"Trailing commas",description:["End the last key value pair in each entry with a comma."],type:"boolean",defaultValue:!1},{key:"encodeUrls",cli:{"--encode-urls":!0,"--no-encode-urls":!0},toCLI:s(m=>m?"--encode-urls":void 0,"toCLI"),title:"Encode URLs",description:["Replace invalid URL characters with percent encoded values."],type:"boolean",defaultValue:!1},{key:"tidyComments",cli:{"--tidy-comments":!0,"--no-tidy-comments":!1},toCLI:s(m=>m===!1?"--no-tidy-comments":void 0,"toCLI"),title:"Tidy comments",description:["Remove whitespace surrounding comments."],type:"boolean",defaultValue:!0},{key:"removeEmptyFields",cli:{"--remove-empty-fields":!0,"--no-remove-empty-fields":!1},toCLI:s(m=>m?"--remove-empty-fields":void 0,"toCLI"),title:"Remove empty fields",description:["Remove any fields that have empty values."],type:"boolean",defaultValue:!1},{key:"removeDuplicateFields",cli:{"--remove-dupe-fields":!0,"--no-remove-dupe-fields":!1},toCLI:s(m=>m===!1?"--no-remove-dupe-fields":void 0,"toCLI"),title:"Remove duplicate fields",description:["Only allow one of each field in each entry. Enabled by default."],type:"boolean",defaultValue:!0},{key:"generateKeys",cli:{"--generate-keys":s(m=>m.length>0?m:!0,"--generate-keys")},toCLI:s(m=>{if(m===!0||m===Oe)return"--generate-keys";if(typeof m=="string")return`--generate-keys="${m.replace(/"/g,'\\"')}"`},"toCLI"),title:"Generate citation keys [Experimental]",description:["For all entries replace the key with a new key of the form <author><year><title>. A JabRef citation pattern can be provided. This is an experimental option that may change without warning."],type:"boolean | string",convertBoolean:{true:Oe,false:void 0},defaultValue:void 0},{key:"maxAuthors",cli:{"--max-authors":s(m=>Number(m[0]),"--max-authors")},toCLI:s(m=>m?`--max-authors=${m}`:void 0,"toCLI"),title:"Maximum authors",description:['Truncate authors if above a given number into "and others".'],type:"number"},{key:"lowercase",cli:{"--no-lowercase":!1},toCLI:s(m=>m===!1?"--no-lowercase":void 0,"toCLI"),title:"Lowercase fields",description:["Lowercase field names and entry type. Enabled by default."],type:"boolean",defaultValue:!0},{key:"enclosingBraces",cli:{"--enclosing-braces":s(m=>m.length>0?m:!0,"--enclosing-braces")},toCLI:s(m=>{if(Array.isArray(m)&&m.length>0)return`--enclosing-braces=${m.join(",")}`;if(m===!0)return"--enclosing-braces"},"toCLI"),title:"Enclose values in double braces",description:["Enclose the given fields in double braces, such that case is preserved during BibTeX compilation."],examples:["--enclosing-braces=title,journal (output title and journal fields will be of the form {{This is a title}})","--enclosing-braces (equivalent to ---enclosing-braces=title)"],type:"boolean | string[]",convertBoolean:{true:["title"],false:void 0}},{key:"removeBraces",cli:{"--remove-braces":s(m=>m.length>0?m:!0,"--remove-braces")},toCLI:s(m=>{if(Array.isArray(m)&&m.length>0)return`--remove-braces=${m.join(",")}`;if(m===!0)return"--remove-braces"},"toCLI"),title:"Remove braces",description:["Remove any curly braces within the value, unless they are part of a command."],examples:["--remove-braces=title,journal","--remove-braces (equivalent to ---remove-braces=title)"],type:"boolean | string[]",convertBoolean:{true:["title"],false:void 0}},{key:"wrap",cli:{"--wrap":s(m=>m.length>0?Number(m[0]):!0,"--wrap"),"--no-wrap":!1},toCLI:s(m=>m?`--wrap=${m}`:void 0,"toCLI"),title:"Wrap values",description:["Wrap long values at the given column"],examples:["--wrap (80 by default)","--wrap=82"],type:"boolean | number",convertBoolean:{true:z,false:void 0}},{key:"version",cli:{"--version":!0,"-v":!0},title:"Version",description:["Show bibtex-tidy version."],type:"boolean"},{key:"quiet",cli:{"--quiet":!0},title:"Quiet",description:["Suppress logs on stdout."],type:"boolean"},{key:"backup",cli:{"--backup":!0,"--no-backup":!1},title:"Backup",description:["Make a backup <filename>.original. Enabled by default (unless --modify is explicitly provided or outputting to a different file/stdio). Deprecated but provided for backward compatibility."],type:"boolean",defaultValue:!0,deprecated:!0}];function Dn(m){return Object.fromEntries(jt.map(E=>{const F=E.key,j=m[F];return E.convertBoolean&&typeof j=="boolean"?[F,j?E.convertBoolean.true:E.convertBoolean.false]:typeof j>"u"&&E.defaultValue!==void 0?typeof E.defaultValue=="function"?[F,E.defaultValue(m)]:[F,E.defaultValue]:[F,j]}))}s(Dn,"normalizeOptions");function gn(m,E,F){const j=new Map,T=[];for(const V of m.children){if(V.type==="text"||V.block?.type!=="entry"&&!F.includes("special")){T.push(V);continue}const N=new Map;for(let he of F){he.startsWith("-")&&(he=he.slice(1));let de;switch(he){case"key":if(V.block?.type!=="entry")continue;de=V.block.key??"";break;case"type":de=V.command;break;case"month":{if(V.block?.type!=="entry")continue;const ue=E.get(V.block)?.get(he),pe=ue?Fe.indexOf(ue):-1;de=pe>-1?pe:"";break}case"special":de=$e(V)?0:1;break;default:if(V.block?.type!=="entry")continue;de=E.get(V.block)?.get(he)??""}N.set(he,typeof de=="string"?de.toLowerCase():de)}for(j.set(V,N);T.length>0;){const he=T.pop();if(!he)break;j.set(he,N)}}for(const V of[...F].reverse()){const N=V.startsWith("-"),he=N?V.slice(1):V;m.children.sort((de,ue)=>{let pe=j.get(de)?.get(he)??"￰",ne=j.get(ue)?.get(he)??"￰";return typeof pe=="number"&&(pe=String(pe).padStart(50,"0")),typeof ne=="number"&&(ne=String(ne).padStart(50,"0")),(N?ne:pe).localeCompare(N?pe:ne)})}}s(gn,"sortEntries");var kt=new Set(["string","preamble","set","xdata"]);function $e(m){return kt.has(m.command.toLowerCase())}s($e,"isBibLaTeXSpecialEntry");function Fn(m,E){for(const F of St(m))F.fields.sort((j,T)=>{const V=E.indexOf(j.name.toLocaleLowerCase()),N=E.indexOf(T.name.toLocaleLowerCase());return V===-1&&N===-1?0:V===-1?1:N===-1?-1:N<V?1:N>V?-1:0})}s(Fn,"sortEntryFields");function Sn(m,E={}){const F=Dn(E),j=se(m),T=M(j),V=St(T).filter(pe=>!pe.key).map(pe=>({code:"MISSING_KEY",message:`${pe.parent.command} entry does not have a citation key.`})),N=jn(T,F),he=ht(T,N,F.duplicates,F.merge);V.push(...he.warnings),T.children=T.children.filter(pe=>!nt(pe)||!he.entries.has(pe.block)),F.sort&&gn(T,N,F.sort),F.sortFields&&Fn(T,F.sortFields);const de=F.generateKeys?xe(T,N,F.generateKeys):void 0;return{bibtex:G(T,F,de),warnings:V,count:St(T).length}}s(Sn,"tidy");function jn(m,E){return new Map(St(m).map(F=>[F,new Map(F.fields.map(j=>[j.name.toLocaleLowerCase(),Ce(j,E)??""]))]))}s(jn,"generateValueLookup");function St(m){return m.children.filter(nt).map(E=>E.block)}return s(St,"getEntries"),ho}var e0=QD();const Gl=512*1024,t0=new Set(["comment","string","preamble"]),n0={lowercase:!1,removeDuplicateFields:!1};function Yl(t){return new TextEncoder().encode(t).byteLength}function xa(t){if(!t.trim()||Yl(t)>Gl)return null;try{const e=e0.tidy(t,n0);return{bibtex:e.bibtex,count:e.count}}catch{return null}}function s0(t){if(!t.trim())return t;const e=xa(t);if(!e)throw new Error("BibTeX 格式不正确,无法格式化");return e.bibtex}function Wl(t){if(!t.trim()||Yl(t)>Gl)return[];const e=xa(t);if(!e||e.count===0)return[];const n=[];let r=0;for(;r<t.length;){const s=t.indexOf("@",r);if(s<0)break;r=s+1;const o=t.lastIndexOf(`
41
+ `,s-1)+1;if(r0(t,o,s))continue;const a=t.slice(s).match(/^@([A-Za-z][A-Za-z0-9_-]*)\s*([\{\(])/);if(!a||a.index===void 0)continue;const u=s+a[0].length-1,c=Jl(t,u,a[2]==="{"?"}":")");if(c<0)continue;const l=Xl(t.slice(s,c+1));l&&n.push(l),r=c+1}return n}function rc(t){const e=t.trim(),n=xa(e);return!n||n.count!==1?null:Xl(e)}function Xl(t){const e=t.match(/^@([A-Za-z][A-Za-z0-9_-]*)\s*([\{\(])\s*([^,\s\}\)]+)\s*,/s);if(!e)return null;const n=t.indexOf(e[2],e.index??0);if(Jl(t,n,e[2]==="{"?"}":")")!==t.length-1)return null;const s=e[1];if(t0.has(s.toLowerCase()))return null;const o=i0(t.slice(e[0].length,-1));return o?{citationKey:e[3],entryType:s,bibtex:t,title:o.title??null,authors:o.author??null,year:o.year??null}:null}function r0(t,e,n){let r=!1;for(let s=e;s<n;s+=1){const o=t[s];if(o==="%"&&!r)return!0;o==="\\"?r=!r:r=!1}return!1}function Jl(t,e,n){let r=0,s=0,o=!1,a=!1;for(let u=e;u<t.length;u+=1){const c=t[u];if(a){a=!1;continue}if(c==="\\"){a=!0;continue}if(n==="}"){if(c==='"'&&r===1&&(o=!o),c==="{")r+=1;else if(c==="}"&&--r===0)return u;continue}if(c==="{"&&!o){s+=1;continue}if(c==="}"&&!o&&s>0){s-=1;continue}if(!(s>0)){if(c==='"'){o=!o;continue}if(!o){if(c==="(")r+=1;else if(c===")"&&--r===0)return u}}}return-1}function i0(t){const e={};for(const n of o0(t,",")){if(!n.trim())continue;const r=n.replace(/(^|[\r\n])\s*%[^\r\n]*/g,"$1").trim();if(!r)continue;const s=r.match(/^\s*([A-Za-z][A-Za-z0-9_-]*)\s*=\s*([\s\S]*)$/);if(!s||!s[2].trim())return null;const o=a0(s[2]);o&&(e[s[1].toLowerCase()]=o)}return e}function o0(t,e){const n=[];let r=0,s=0,o=!1,a=!1;for(let u=0;u<t.length;u+=1){const c=t[u];if(a){a=!1;continue}if(c==="\\"){a=!0;continue}if(c==='"'){o=!o;continue}o||(c==="{"?s+=1:c==="}"?s=Math.max(0,s-1):c===e&&s===0&&(n.push(t.slice(r,u)),r=u+1))}return n.push(t.slice(r)),n}function a0(t){let e=t.trim();return(e.startsWith("{")&&e.endsWith("}")||e.startsWith('"')&&e.endsWith('"'))&&(e=e.slice(1,-1)),e.replace(/\s+/g," ").trim()}function u0(t,e=null){const n=ic(t),s=e==="succeeded"||e===null&&l0(t)?[]:oc(n.filter(ac)),o=ic(c0(t));return{warnings:oc(o.filter(u=>!ac(u)&&d0(u))),errors:s}}function ic(t){return t.split(`
42
+ `).map(e=>e.trim()).filter(Boolean)}function oc(t){return[...new Set(t)]}function c0(t){const e=/^Running ['"][^\n]*(?:pdf|xe|lua)latex(?:\s|['"])[^\n]*$/gim;let n=-1;for(const r of t.matchAll(e))n=r.index;return n>=0?t.slice(n):t}function l0(t){return/Latexmk: All targets .* are up-to-date/i.test(t)&&/Output written on .*\.pdf/i.test(t)}function ac(t){return/^!\s/.test(t)||/(?:^|:\s)(?:LaTeX|Package|Class|pdfTeX|XeTeX|LuaTeX)?\s*Error:/i.test(t)||/^Latexmk:.*(?:\bErrors?,|did not complete making targets|failure)/i.test(t)||/^Collected error summary/i.test(t)||/\b(?:fatal error|emergency stop|undefined control sequence|no output pdf|no pages of output)\b/i.test(t)||/\b(?:bibtex|biber) errors?:/i.test(t)||/^error, and then rerun latexmk/i.test(t)}function d0(t){return/\bwarnings?\b|overfull|underfull|badness/i.test(t)}const h0=/^\/projects?\/([^/]+)\/?$/;function fo(t){return`/project/${encodeURIComponent(t)}`}function Wr(t){const e=h0.exec(t);if(!e)return null;try{const n=decodeURIComponent(e[1]);return n&&!n.includes("/")?n:null}catch{return null}}function f0(t){if(!t||typeof t!="object")return!1;const e=t;return e.texliteRoute==="project"&&typeof e.projectId=="string"&&typeof e.fromDashboard=="boolean"}function te(t){return t instanceof Error?t.message:Ie.t("errors.generic")}const $t=()=>new Map,Jo=t=>{const e=$t();return t.forEach((n,r)=>{e.set(r,n)}),e},fn=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},p0=(t,e)=>{const n=[];for(const[r,s]of t)n.push(e(s,r));return n},m0=(t,e)=>{for(const[n,r]of t)if(e(r,n))return!0;return!1},In=()=>new Set,po=t=>t[t.length-1],D0=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},vn=Array.from,wa=(t,e)=>{for(let n=0;n<t.length;n++)if(!e(t[n],n,t))return!1;return!0},Aa=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},g0=(t,e)=>{const n=new Array(t);for(let r=0;r<t;r++)n[r]=e(r,n);return n},Ps=Array.isArray;class va{constructor(){this._observers=$t()}on(e,n){return fn(this._observers,e,In).add(n),n}once(e,n){const r=(...s)=>{this.off(e,r),n(...s)};this.on(e,r)}off(e,n){const r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return vn((this._observers.get(e)||$t()).values()).forEach(r=>r(...n))}destroy(){this._observers=$t()}}class Zl{constructor(){this._observers=$t()}on(e,n){fn(this._observers,e,In).add(n)}once(e,n){const r=(...s)=>{this.off(e,r),n(...s)};this.on(e,r)}off(e,n){const r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return vn((this._observers.get(e)||$t()).values()).forEach(r=>r(...n))}destroy(){this._observers=$t()}}const en=Math.floor,ti=Math.abs,ka=(t,e)=>t<e?t:e,es=(t,e)=>t>e?t:e,F0=Math.pow,Ql=t=>t!==0?t<0:1/t<0,uc=1,cc=2,mo=4,Do=8,dr=32,xn=64,zt=128,ki=31,Zo=63,Yn=127,b0=2147483647,di=Number.MAX_SAFE_INTEGER,lc=Number.MIN_SAFE_INTEGER,y0=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&en(t)===t),ed=String.fromCharCode,C0=t=>t.toLowerCase(),E0=/^\s*/g,x0=t=>t.replace(E0,""),w0=/([A-Z])/g,dc=(t,e)=>x0(t.replace(w0,n=>`${e}${C0(n)}`)),A0=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let s=0;s<n;s++)r[s]=e.codePointAt(s);return r},hr=typeof TextEncoder<"u"?new TextEncoder:null,v0=t=>hr.encode(t),k0=hr?v0:A0;let or=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});or&&or.decode(new Uint8Array).length===1&&(or=null);const S0=(t,e)=>g0(e,()=>t).join("");class xr{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const lt=()=>new xr,Sa=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},Ve=t=>{const e=new Uint8Array(Sa(t));let n=0;for(let r=0;r<t.bufs.length;r++){const s=t.bufs[r];e.set(s,n),n+=s.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},j0=(t,e)=>{const n=t.cbuf.length;n-t.cpos<e&&(t.bufs.push(new Uint8Array(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(es(n,e)*2),t.cpos=0)},Et=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},Qo=Et,oe=(t,e)=>{for(;e>Yn;)Et(t,zt|Yn&e),e=en(e/128);Et(t,Yn&e)},ja=(t,e)=>{const n=Ql(e);for(n&&(e=-e),Et(t,(e>Zo?zt:0)|(n?xn:0)|Zo&e),e=en(e/64);e>0;)Et(t,(e>Yn?zt:0)|Yn&e),e=en(e/128)},ea=new Uint8Array(3e4),B0=ea.length/3,T0=(t,e)=>{if(e.length<B0){const n=hr.encodeInto(e,ea).written||0;oe(t,n);for(let r=0;r<n;r++)Et(t,ea[r])}else tt(t,k0(e))},N0=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;oe(t,r);for(let s=0;s<r;s++)Et(t,n.codePointAt(s))},wn=hr&&hr.encodeInto?T0:N0,Si=(t,e)=>{const n=t.cbuf.length,r=t.cpos,s=ka(n-r,e.length),o=e.length-s;t.cbuf.set(e.subarray(0,s),r),t.cpos+=s,o>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(es(n*2,o)),t.cbuf.set(e.subarray(s)),t.cpos=o)},tt=(t,e)=>{oe(t,e.byteLength),Si(t,e)},Ba=(t,e)=>{j0(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},L0=(t,e)=>Ba(t,4).setFloat32(0,e,!1),O0=(t,e)=>Ba(t,8).setFloat64(0,e,!1),R0=(t,e)=>Ba(t,8).setBigInt64(0,e,!1),hc=new DataView(new ArrayBuffer(4)),P0=t=>(hc.setFloat32(0,t),hc.getFloat32(0)===t),fr=(t,e)=>{switch(typeof e){case"string":Et(t,119),wn(t,e);break;case"number":y0(e)&&ti(e)<=b0?(Et(t,125),ja(t,e)):P0(e)?(Et(t,124),L0(t,e)):(Et(t,123),O0(t,e));break;case"bigint":Et(t,122),R0(t,e);break;case"object":if(e===null)Et(t,126);else if(Ps(e)){Et(t,117),oe(t,e.length);for(let n=0;n<e.length;n++)fr(t,e[n])}else if(e instanceof Uint8Array)Et(t,116),tt(t,e);else{Et(t,118);const n=Object.keys(e);oe(t,n.length);for(let r=0;r<n.length;r++){const s=n[r];wn(t,s),fr(t,e[s])}}break;case"boolean":Et(t,e?120:121);break;default:Et(t,127)}};class fc extends xr{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&oe(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const pc=t=>{t.count>0&&(ja(t.encoder,t.count===1?t.s:-t.s),t.count>1&&oe(t.encoder,t.count-2))};class ni{constructor(){this.encoder=new xr,this.s=0,this.count=0}write(e){this.s===e?this.count++:(pc(this),this.count=1,this.s=e)}toUint8Array(){return pc(this),Ve(this.encoder)}}const mc=t=>{if(t.count>0){const e=t.diff*2+(t.count===1?0:1);ja(t.encoder,e),t.count>1&&oe(t.encoder,t.count-2)}};class go{constructor(){this.encoder=new xr,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(mc(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return mc(this),Ve(this.encoder)}}class _0{constructor(){this.sarr=[],this.s="",this.lensE=new ni}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new xr;return this.sarr.push(this.s),this.s="",wn(e,this.sarr.join("")),Si(e,this.lensE.toUint8Array()),Ve(e)}}const tn=t=>new Error(t),Zt=()=>{throw tn("Method unimplemented")},Vt=()=>{throw tn("Unexpected case")},td=tn("Unexpected end of array"),nd=tn("Integer out of Range");class ji{constructor(e){this.arr=e,this.pos=0}}const Un=t=>new ji(t),I0=t=>t.pos!==t.arr.length,M0=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},Tt=t=>M0(t,fe(t)),_s=t=>t.arr[t.pos++],fe=t=>{let e=0,n=1;const r=t.arr.length;for(;t.pos<r;){const s=t.arr[t.pos++];if(e=e+(s&Yn)*n,n*=128,s<zt)return e;if(e>di)throw nd}throw td},Ta=t=>{let e=t.arr[t.pos++],n=e&Zo,r=64;const s=(e&xn)>0?-1:1;if((e&zt)===0)return s*n;const o=t.arr.length;for(;t.pos<o;){if(e=t.arr[t.pos++],n=n+(e&Yn)*r,r*=128,e<zt)return s*n;if(n>di)throw nd}throw td},$0=t=>{let e=fe(t);if(e===0)return"";{let n=String.fromCodePoint(_s(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(_s(t));else for(;e>0;){const r=e<1e4?e:1e4,s=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,n+=String.fromCodePoint.apply(null,s),e-=r}return decodeURIComponent(escape(n))}},U0=t=>or.decode(Tt(t)),Nt=or?U0:$0,Na=(t,e)=>{const n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},z0=t=>Na(t,4).getFloat32(0,!1),V0=t=>Na(t,8).getFloat64(0,!1),H0=t=>Na(t,8).getBigInt64(0,!1),q0=[t=>{},t=>null,Ta,z0,V0,H0,t=>!1,t=>!0,Nt,t=>{const e=fe(t),n={};for(let r=0;r<e;r++){const s=Nt(t);n[s]=pr(t)}return n},t=>{const e=fe(t),n=[];for(let r=0;r<e;r++)n.push(pr(t));return n},Tt],pr=t=>q0[127-_s(t)](t);class Dc extends ji{constructor(e,n){super(e),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),I0(this)?this.count=fe(this)+1:this.count=-1),this.count--,this.s}}class si extends ji{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=Ta(this);const e=Ql(this.s);this.count=1,e&&(this.s=-this.s,this.count=fe(this)+2)}return this.count--,this.s}}class Fo extends ji{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=Ta(this),n=e&1;this.diff=en(e/2),this.count=1,n&&(this.count=fe(this)+2)}return this.s+=this.diff,this.count--,this.s}}class K0{constructor(e){this.decoder=new si(e),this.str=Nt(this.decoder),this.spos=0}read(){const e=this.spos+this.decoder.read(),n=this.str.slice(this.spos,e);return this.spos=e,n}}const G0=crypto.getRandomValues.bind(crypto),sd=()=>G0(new Uint32Array(1))[0],Y0="10000000-1000-4000-8000"+-1e11,W0=()=>Y0.replace(/[018]/g,t=>(t^sd()&15>>t/4).toString(16)),Mn=Date.now,Is=t=>new Promise(t);Promise.all.bind(Promise);const gc=t=>t===void 0?null:t;class X0{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let rd=new X0,La=!0;try{typeof localStorage<"u"&&localStorage&&(rd=localStorage,La=!1)}catch{}const id=rd,J0=t=>La||addEventListener("storage",t),Z0=t=>La||removeEventListener("storage",t),mr=Symbol("Equality"),od=(t,e)=>t===e||!!t?.[mr]?.(e)||!1,Q0=t=>typeof t=="object",eg=Object.assign,tg=Object.keys,ng=(t,e)=>{for(const n in t)e(t[n],n)},sg=(t,e)=>{const n=[];for(const r in t)n.push(e(t[r],r));return n},hi=t=>tg(t).length,rg=t=>{for(const e in t)return!1;return!0},wr=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},Oa=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),ig=(t,e)=>t===e||hi(t)===hi(e)&&wr(t,(n,r)=>(n!==void 0||Oa(e,r))&&od(e[r],n)),og=Object.freeze,ad=t=>{for(const e in t){const n=t[e];(typeof n=="object"||typeof n=="function")&&ad(t[e])}return og(t)},Ra=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&Ra(t,e,n+1)}},ag=t=>t,As=(t,e)=>{if(t===e)return!0;if(t==null||e==null||t.constructor!==e.constructor&&(t.constructor||Object)!==(e.constructor||Object))return!1;if(t[mr]!=null)return t[mr](e);switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:{if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;break}case Set:{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;break}case Map:{if(t.size!==e.size)return!1;for(const n of t.keys())if(!e.has(n)||!As(t.get(n),e.get(n)))return!1;break}case void 0:case Object:if(hi(t)!==hi(e))return!1;for(const n in t)if(!Oa(t,n)||!As(t[n],e[n]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!As(t[n],e[n]))return!1;break;default:return!1}return!0},ug=(t,e)=>e.includes(t);var ud={};const $n=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",cd=typeof window<"u"&&typeof document<"u"&&!$n;let an;const cg=()=>{if(an===void 0)if($n){an=$t();const t=process.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];r[0]==="-"?(e!==null&&an.set(e,""),e=r):e!==null&&(an.set(e,r),e=null)}e!==null&&an.set(e,"")}else typeof location=="object"?(an=$t(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");an.set(`--${dc(e,"-")}`,n),an.set(`-${dc(e,"-")}`,n)}})):an=$t();return an},ta=t=>cg().has(t),fi=t=>gc($n?ud[t.toUpperCase().replaceAll("-","_")]:id.getItem(t)),ld=t=>ta("--"+t)||fi(t)!==null,lg=ld("production"),dg=$n&&ug(ud.FORCE_COLOR,["true","1","2"]),hg=dg||!ta("--no-colors")&&!ld("no-color")&&(!$n||process.stdout.isTTY)&&(!$n||ta("--color")||fi("COLORTERM")!==null||(fi("TERM")||"").includes("color")),dd=t=>new Uint8Array(t),fg=(t,e,n)=>new Uint8Array(t,e,n),pg=t=>new Uint8Array(t),mg=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=ed(t[n]);return btoa(e)},Dg=t=>Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),gg=t=>{const e=atob(t),n=dd(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n},Fg=t=>{const e=Buffer.from(t,"base64");return fg(e.buffer,e.byteOffset,e.byteLength)},bg=cd?mg:Dg,yg=cd?gg:Fg,Cg=t=>{const e=dd(t.byteLength);return e.set(t),e};class Eg{constructor(e,n){this.left=e,this.right=n}}const Cn=(t,e)=>new Eg(t,e),xg=(t,e)=>t.forEach(n=>e(n.left,n.right)),Fc=t=>t.next()>=.5,bo=(t,e,n)=>en(t.next()*(n+1-e)+e),hd=(t,e,n)=>en(t.next()*(n+1-e)+e),Pa=(t,e,n)=>hd(t,e,n),wg=t=>ed(Pa(t,97,122)),Ag=(t,e=0,n=20)=>{const r=Pa(t,e,n);let s="";for(let o=0;o<r;o++)s+=wg(t);return s},yo=(t,e)=>e[Pa(t,0,e.length-1)],vg=Symbol("0schema");class kg{constructor(){this._rerrs=[]}extend(e,n,r,s=null){this._rerrs.push({path:e,expected:n,has:r,message:s})}toString(){const e=[];for(let n=this._rerrs.length-1;n>0;n--){const r=this._rerrs[n];e.push(S0(" ",(this._rerrs.length-n)*2)+`${r.path!=null?`[${r.path}] `:""}${r.has} doesn't match ${r.expected}. ${r.message}`)}return e.join(`
43
+ `)}}const na=(t,e)=>t===e?!0:t==null||e==null||t.constructor!==e.constructor?!1:t[mr]?od(t,e):Ps(t)?wa(t,n=>Aa(e,r=>na(n,r))):Q0(t)?wr(t,(n,r)=>na(n,e[r])):!1;class _t{static _dilutes=!1;extends(e){let[n,r]=[this.shape,e.shape];return this.constructor._dilutes&&([r,n]=[n,r]),na(n,r)}equals(e){return this.constructor===e.constructor&&As(this.shape,e.shape)}[vg](){return!0}[mr](e){return this.equals(e)}validate(e){return this.check(e)}check(e,n){Zt()}get nullable(){return Gs(this,Oi)}get optional(){return new md(this)}cast(e){return bc(e,this),e}expect(e){return bc(e,this),e}}class _a extends _t{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n=void 0){const r=e?.constructor===this.shape&&(this._c==null||this._c(e));return!r&&n?.extend(null,this.shape.name,e?.constructor.name,e?.constructor!==this.shape?"Constructor match failed":"Check failed"),r}}const dt=(t,e=null)=>new _a(t,e);dt(_a);class Ia extends _t{constructor(e){super(),this.shape=e}check(e,n){const r=this.shape(e);return!r&&n?.extend(null,"custom prop",e?.constructor.name,"failed to check custom prop"),r}}const At=t=>new Ia(t);dt(Ia);class Bi extends _t{constructor(e){super(),this.shape=e}check(e,n){const r=this.shape.some(s=>s===e);return!r&&n?.extend(null,this.shape.join(" | "),e.toString()),r}}const Ti=(...t)=>new Bi(t),fd=dt(Bi),Sg=RegExp.escape||(t=>t.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),pd=t=>{if(Ms.check(t))return[Sg(t)];if(fd.check(t))return t.shape.map(e=>e+"");if(wd.check(t))return["[+-]?\\d+.?\\d*"];if(Ad.check(t))return[".*"];if(pi.check(t))return t.shape.map(pd).flat(1);Vt()};class jg extends _t{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(pd).map(n=>`(${n.join("|")})`).join("")+"$")}check(e,n){const r=this._r.exec(e)!=null;return!r&&n?.extend(null,this._r.toString(),e.toString(),"String doesn't match string template."),r}}dt(jg);const Bg=Symbol("optional");class md extends _t{constructor(e){super(),this.shape=e}check(e,n){const r=e===void 0||this.shape.check(e);return!r&&n?.extend(null,"undefined (optional)","()"),r}get[Bg](){return!0}}const Tg=dt(md);class Ng extends _t{check(e,n){return n?.extend(null,"never",typeof e),!1}}dt(Ng);class Ni extends _t{constructor(e,n=!1){super(),this.shape=e,this._isPartial=n}static _dilutes=!0;get partial(){return new Ni(this.shape,!0)}check(e,n){return e==null?(n?.extend(null,"object","null"),!1):wr(this.shape,(r,s)=>{const o=this._isPartial&&!Oa(e,s)||r.check(e[s],n);return!o&&n?.extend(s.toString(),r.toString(),typeof e[s],"Object property does not match"),o})}}const Lg=t=>new Ni(t),Og=dt(Ni),Rg=At(t=>t!=null&&(t.constructor===Object||t.constructor==null));class Dd extends _t{constructor(e,n){super(),this.shape={keys:e,values:n}}check(e,n){return e!=null&&wr(e,(r,s)=>{const o=this.shape.keys.check(s,n);return!o&&n?.extend(s+"","Record",typeof e,o?"Key doesn't match schema":"Value doesn't match value"),o&&this.shape.values.check(r,n)})}}const gd=(t,e)=>new Dd(t,e),Pg=dt(Dd);class Fd extends _t{constructor(e){super(),this.shape=e}check(e,n){return e!=null&&wr(this.shape,(r,s)=>{const o=r.check(e[s],n);return!o&&n?.extend(s.toString(),"Tuple",typeof r),o})}}const _g=(...t)=>new Fd(t);dt(Fd);class bd extends _t{constructor(e){super(),this.shape=e.length===1?e[0]:new Ma(e)}check(e,n){const r=Ps(e)&&wa(e,s=>this.shape.check(s));return!r&&n?.extend(null,"Array",""),r}}const yd=(...t)=>new bd(t),Ig=dt(bd),Mg=At(t=>Ps(t));class Cd extends _t{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n){const r=e instanceof this.shape&&(this._c==null||this._c(e));return!r&&n?.extend(null,this.shape.name,e?.constructor.name),r}}const $g=(t,e=null)=>new Cd(t,e);dt(Cd);const Ug=$g(_t);class zg extends _t{constructor(e){super(),this.len=e.length-1,this.args=_g(...e.slice(-1)),this.res=e[this.len]}check(e,n){const r=e.constructor===Function&&e.length<=this.len;return!r&&n?.extend(null,"function",typeof e),r}}const Vg=dt(zg),Hg=At(t=>typeof t=="function");class qg extends _t{constructor(e){super(),this.shape=e}check(e,n){const r=wa(this.shape,s=>s.check(e,n));return!r&&n?.extend(null,"Intersectinon",typeof e),r}}dt(qg,t=>t.shape.length>0);class Ma extends _t{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,n){const r=Aa(this.shape,s=>s.check(e,n));return n?.extend(null,"Union",typeof e),r}}const Gs=(...t)=>t.findIndex(e=>pi.check(e))>=0?Gs(...t.map(e=>Dr(e)).map(e=>pi.check(e)?e.shape:[e]).flat(1)):t.length===1?t[0]:new Ma(t),pi=dt(Ma),Ed=()=>!0,mi=At(Ed),Kg=dt(Ia,t=>t.shape===Ed),$a=At(t=>typeof t=="bigint"),Gg=At(t=>t===$a),xd=At(t=>typeof t=="symbol");At(t=>t===xd);const vs=At(t=>typeof t=="number"),wd=At(t=>t===vs),Ms=At(t=>typeof t=="string"),Ad=At(t=>t===Ms),Li=At(t=>typeof t=="boolean"),Yg=At(t=>t===Li),vd=Ti(void 0);dt(Bi,t=>t.shape.length===1&&t.shape[0]===void 0);Ti(void 0);const Oi=Ti(null),Wg=dt(Bi,t=>t.shape.length===1&&t.shape[0]===null);dt(Uint8Array);dt(_a,t=>t.shape===Uint8Array);const Xg=Gs(vs,Ms,Oi,vd,$a,Li,xd);(()=>{const t=yd(mi),e=gd(Ms,mi),n=Gs(vs,Ms,Oi,Li,t,e);return t.shape=n,e.shape.values=n,n})();const Dr=t=>{if(Ug.check(t))return t;if(Rg.check(t)){const e={};for(const n in t)e[n]=Dr(t[n]);return Lg(e)}else{if(Mg.check(t))return Gs(...t.map(Dr));if(Xg.check(t))return Ti(t);if(Hg.check(t))return dt(t)}Vt()},bc=lg?()=>{}:(t,e)=>{const n=new kg;if(!e.check(t,n))throw tn(`Expected value to be of type ${e.constructor.name}.
44
+ ${n.toString()}`)};class Jg{constructor(e){this.patterns=[],this.$state=e}if(e,n){return this.patterns.push({if:Dr(e),h:n}),this}else(e){return this.if(mi,e)}done(){return(e,n)=>{for(let r=0;r<this.patterns.length;r++){const s=this.patterns[r];if(s.if.check(e))return s.h(e,n)}throw tn("Unhandled pattern")}}}const Zg=t=>new Jg(t),kd=Zg(mi).if(wd,(t,e)=>bo(e,lc,di)).if(Ad,(t,e)=>Ag(e)).if(Yg,(t,e)=>Fc(e)).if(Gg,(t,e)=>BigInt(bo(e,lc,di))).if(pi,(t,e)=>ms(e,yo(e,t.shape))).if(Og,(t,e)=>{const n={};for(const r in t.shape){let s=t.shape[r];if(Tg.check(s)){if(Fc(e))continue;s=s.shape}n[r]=kd(s,e)}return n}).if(Ig,(t,e)=>{const n=[],r=hd(e,0,42);for(let s=0;s<r;s++)n.push(ms(e,t.shape));return n}).if(fd,(t,e)=>yo(e,t.shape)).if(Wg,(t,e)=>null).if(Vg,(t,e)=>{const n=ms(e,t.res);return()=>n}).if(Kg,(t,e)=>ms(e,yo(e,[vs,Ms,Oi,vd,$a,Li,yd(vs),gd(Gs("a","b","c"),vs)]))).if(Pg,(t,e)=>{const n={},r=bo(e,0,3);for(let s=0;s<r;s++){const o=ms(e,t.shape.keys),a=ms(e,t.shape.values);n[o]=a}return n}).done(),ms=(t,e)=>kd(Dr(e),t),pn=typeof document<"u"?document:{},Qg=t=>pn.createElement(t),e1=()=>pn.createDocumentFragment();At(t=>t.nodeType===c1);const t1=t=>pn.createTextNode(t);typeof DOMParser<"u"&&new DOMParser;const n1=(t,e)=>(xg(e,(n,r)=>{r===!1?t.removeAttribute(n):r===!0?t.setAttribute(n,""):t.setAttribute(n,r)}),t),s1=t=>{const e=e1();for(let n=0;n<t.length;n++)Sd(e,t[n]);return e},r1=(t,e)=>(Sd(t,s1(e)),t),p2=(t,e=[],n=[])=>r1(n1(Qg(t),e),n);At(t=>t.nodeType===o1);const m2=t1;At(t=>t.nodeType===a1);const i1=t=>p0(t,(e,n)=>`${n}:${e};`).join(""),Sd=(t,e)=>t.appendChild(e),o1=pn.ELEMENT_NODE,a1=pn.TEXT_NODE;pn.CDATA_SECTION_NODE;pn.COMMENT_NODE;const u1=pn.DOCUMENT_NODE;pn.DOCUMENT_TYPE_NODE;const c1=pn.DOCUMENT_FRAGMENT_NODE;At(t=>t.nodeType===u1);const kn=Symbol,jd=kn(),Bd=kn(),l1=kn(),d1=kn(),h1=kn(),Td=kn(),f1=kn(),Ua=kn(),p1=kn(),m1=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());const e=[],n=[];let r=0;for(;r<t.length;r++){const s=t[r];if(s===void 0)break;if(s.constructor===String||s.constructor===Number)e.push(s);else if(s.constructor===Object)break}for(r>0&&n.push(e.join(""));r<t.length;r++){const s=t[r];s instanceof Symbol||n.push(s)}return n},D1={[jd]:Cn("font-weight","bold"),[Bd]:Cn("font-weight","normal"),[l1]:Cn("color","blue"),[h1]:Cn("color","green"),[d1]:Cn("color","grey"),[Td]:Cn("color","red"),[f1]:Cn("color","purple"),[Ua]:Cn("color","orange"),[p1]:Cn("color","black")},g1=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());const e=[],n=[],r=$t();let s=[],o=0;for(;o<t.length;o++){const a=t[o],u=D1[a];if(u!==void 0)r.set(u.left,u.right);else{if(a===void 0)break;if(a.constructor===String||a.constructor===Number){const c=i1(r);o>0||c.length>0?(e.push("%c"+a),n.push(c)):e.push(a)}else break}}for(o>0&&(s=n,s.unshift(e.join("")));o<t.length;o++){const a=t[o];a instanceof Symbol||s.push(a)}return s},Nd=hg?g1:m1,F1=(...t)=>{console.log(...Nd(t)),Od.forEach(e=>e.print(t))},Ld=(...t)=>{console.warn(...Nd(t)),t.unshift(Ua),Od.forEach(e=>e.print(t))},Od=In(),Rd=t=>({[Symbol.iterator](){return this},next:t}),b1=(t,e)=>Rd(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),Co=(t,e)=>Rd(()=>{const{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}});class Ri{constructor(e,n){this.clock=e,this.len=n}}class Ys{constructor(){this.clients=new Map}}const $s=(t,e,n)=>e.clients.forEach((r,s)=>{const o=t.doc.store.clients.get(s);if(o!=null){const a=o[o.length-1],u=a.id.clock+a.length;for(let c=0,l=r[c];c<r.length&&l.clock<u;l=r[++c])Xd(t,o,l.clock,l.len,n)}}),y1=(t,e)=>{let n=0,r=t.length-1;for(;n<=r;){const s=en((n+r)/2),o=t[s],a=o.clock;if(a<=e){if(e<a+o.len)return s;n=s+1}else r=s-1}return null},Ar=(t,e)=>{const n=t.clients.get(e.client);return n!==void 0&&y1(n,e.clock)!==null},za=t=>{t.clients.forEach(e=>{e.sort((s,o)=>s.clock-o.clock);let n,r;for(n=1,r=1;n<e.length;n++){const s=e[r-1],o=e[n];s.clock+s.len>=o.clock?e[r-1]=new Ri(s.clock,es(s.len,o.clock+o.len-s.clock)):(r<n&&(e[r]=o),r++)}e.length=r})},sa=t=>{const e=new Ys;for(let n=0;n<t.length;n++)t[n].clients.forEach((r,s)=>{if(!e.clients.has(s)){const o=r.slice();for(let a=n+1;a<t.length;a++)D0(o,t[a].clients.get(s)||[]);e.clients.set(s,o)}});return za(e),e},gr=(t,e,n,r)=>{fn(t.clients,e,()=>[]).push(new Ri(n,r))},C1=()=>new Ys,E1=t=>{const e=C1();return t.clients.forEach((n,r)=>{const s=[];for(let o=0;o<n.length;o++){const a=n[o];if(a.deleted){const u=a.id.clock;let c=a.length;if(o+1<n.length)for(let l=n[o+1];o+1<n.length&&l.deleted;l=n[++o+1])c+=l.length;s.push(new Ri(u,c))}}s.length>0&&e.clients.set(r,s)}),e},Ws=(t,e)=>{oe(t.restEncoder,e.clients.size),vn(e.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{t.resetDsCurVal(),oe(t.restEncoder,n);const s=r.length;oe(t.restEncoder,s);for(let o=0;o<s;o++){const a=r[o];t.writeDsClock(a.clock),t.writeDsLen(a.len)}})},Va=t=>{const e=new Ys,n=fe(t.restDecoder);for(let r=0;r<n;r++){t.resetDsCurVal();const s=fe(t.restDecoder),o=fe(t.restDecoder);if(o>0){const a=fn(e.clients,s,()=>[]);for(let u=0;u<o;u++)a.push(new Ri(t.readDsClock(),t.readDsLen()))}}return e},yc=(t,e,n)=>{const r=new Ys,s=fe(t.restDecoder);for(let o=0;o<s;o++){t.resetDsCurVal();const a=fe(t.restDecoder),u=fe(t.restDecoder),c=n.clients.get(a)||[],l=ot(n,a);for(let f=0;f<u;f++){const d=t.readDsClock(),p=d+t.readDsLen();if(d<l){l<p&&gr(r,a,l,p-l);let D=cn(c,d),g=c[D];for(!g.deleted&&g.id.clock<d&&(c.splice(D+1,0,xi(e,g,d-g.id.clock)),D++);D<c.length&&(g=c[D++],g.id.clock<p);)g.deleted||(p<g.id.clock+g.length&&c.splice(D,0,xi(e,g,p-g.id.clock)),g.delete(e))}else gr(r,a,d,p-d)}}if(r.clients.size>0){const o=new Xn;return oe(o.restEncoder,0),Ws(o,r),o.toUint8Array()}return null},Pd=sd;class ts extends va{constructor({guid:e=W0(),collectionid:n=null,gc:r=!0,gcFilter:s=()=>!0,meta:o=null,autoLoad:a=!1,shouldLoad:u=!0}={}){super(),this.gc=r,this.gcFilter=s,this.clientID=Pd(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new Yd,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=u,this.autoLoad=a,this.meta=o,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=Is(l=>{this.on("load",()=>{this.isLoaded=!0,l(this)})});const c=()=>Is(l=>{const f=d=>{(d===void 0||d===!0)&&(this.off("sync",f),l())};this.on("sync",f)});this.on("sync",l=>{l===!1&&this.isSynced&&(this.whenSynced=c()),this.isSynced=l===void 0||l===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=c()}load(){const e=this._item;e!==null&&!this.shouldLoad&&ze(e.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(vn(this.subdocs).map(e=>e.guid))}transact(e,n=null){return ze(this,e,n)}get(e,n=wt){const r=fn(this.share,e,()=>{const o=new n;return o._integrate(this,null),o}),s=r.constructor;if(n!==wt&&s!==n)if(s===wt){const o=new n;o._map=r._map,r._map.forEach(a=>{for(;a!==null;a=a.left)a.parent=o}),o._start=r._start;for(let a=o._start;a!==null;a=a.right)a.parent=o;return o._length=r._length,this.share.set(e,o),o._integrate(this,null),o}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return r}getArray(e=""){return this.get(e,js)}getText(e=""){return this.get(e,Vs)}getMap(e=""){return this.get(e,zs)}getXmlElement(e=""){return this.get(e,Hs)}getXmlFragment(e=""){return this.get(e,Jn)}toJSON(){const e={};return this.share.forEach((n,r)=>{e[r]=n.toJSON()}),e}destroy(){this.isDestroyed=!0,vn(this.subdocs).forEach(n=>n.destroy());const e=this._item;if(e!==null){this._item=null;const n=e.content;n.doc=new ts({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=e,ze(e.parent.doc,r=>{const s=n.doc;e.deleted||r.subdocsAdded.add(s),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class _d{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return fe(this.restDecoder)}readDsLen(){return fe(this.restDecoder)}}class Id extends _d{readLeftID(){return ve(fe(this.restDecoder),fe(this.restDecoder))}readRightID(){return ve(fe(this.restDecoder),fe(this.restDecoder))}readClient(){return fe(this.restDecoder)}readInfo(){return _s(this.restDecoder)}readString(){return Nt(this.restDecoder)}readParentInfo(){return fe(this.restDecoder)===1}readTypeRef(){return fe(this.restDecoder)}readLen(){return fe(this.restDecoder)}readAny(){return pr(this.restDecoder)}readBuf(){return Cg(Tt(this.restDecoder))}readJSON(){return JSON.parse(Nt(this.restDecoder))}readKey(){return Nt(this.restDecoder)}}class x1{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=fe(this.restDecoder),this.dsCurrVal}readDsLen(){const e=fe(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class Us extends x1{constructor(e){super(e),this.keys=[],fe(e),this.keyClockDecoder=new Fo(Tt(e)),this.clientDecoder=new si(Tt(e)),this.leftClockDecoder=new Fo(Tt(e)),this.rightClockDecoder=new Fo(Tt(e)),this.infoDecoder=new Dc(Tt(e),_s),this.stringDecoder=new K0(Tt(e)),this.parentInfoDecoder=new Dc(Tt(e),_s),this.typeRefDecoder=new si(Tt(e)),this.lenDecoder=new si(Tt(e))}readLeftID(){return new ks(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new ks(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return pr(this.restDecoder)}readBuf(){return Tt(this.restDecoder)}readJSON(){return pr(this.restDecoder)}readKey(){const e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{const n=this.stringDecoder.read();return this.keys.push(n),n}}}class Md{constructor(){this.restEncoder=lt()}toUint8Array(){return Ve(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){oe(this.restEncoder,e)}writeDsLen(e){oe(this.restEncoder,e)}}class vr extends Md{writeLeftID(e){oe(this.restEncoder,e.client),oe(this.restEncoder,e.clock)}writeRightID(e){oe(this.restEncoder,e.client),oe(this.restEncoder,e.clock)}writeClient(e){oe(this.restEncoder,e)}writeInfo(e){Qo(this.restEncoder,e)}writeString(e){wn(this.restEncoder,e)}writeParentInfo(e){oe(this.restEncoder,e?1:0)}writeTypeRef(e){oe(this.restEncoder,e)}writeLen(e){oe(this.restEncoder,e)}writeAny(e){fr(this.restEncoder,e)}writeBuf(e){tt(this.restEncoder,e)}writeJSON(e){wn(this.restEncoder,JSON.stringify(e))}writeKey(e){wn(this.restEncoder,e)}}class $d{constructor(){this.restEncoder=lt(),this.dsCurrVal=0}toUint8Array(){return Ve(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const n=e-this.dsCurrVal;this.dsCurrVal=e,oe(this.restEncoder,n)}writeDsLen(e){e===0&&Vt(),oe(this.restEncoder,e-1),this.dsCurrVal+=e}}class Xn extends $d{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new go,this.clientEncoder=new ni,this.leftClockEncoder=new go,this.rightClockEncoder=new go,this.infoEncoder=new fc(Qo),this.stringEncoder=new _0,this.parentInfoEncoder=new fc(Qo),this.typeRefEncoder=new ni,this.lenEncoder=new ni}toUint8Array(){const e=lt();return oe(e,0),tt(e,this.keyClockEncoder.toUint8Array()),tt(e,this.clientEncoder.toUint8Array()),tt(e,this.leftClockEncoder.toUint8Array()),tt(e,this.rightClockEncoder.toUint8Array()),tt(e,Ve(this.infoEncoder)),tt(e,this.stringEncoder.toUint8Array()),tt(e,Ve(this.parentInfoEncoder)),tt(e,this.typeRefEncoder.toUint8Array()),tt(e,this.lenEncoder.toUint8Array()),Si(e,Ve(this.restEncoder)),Ve(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){fr(this.restEncoder,e)}writeBuf(e){tt(this.restEncoder,e)}writeJSON(e){fr(this.restEncoder,e)}writeKey(e){const n=this.keyMap.get(e);n===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(n)}}const w1=(t,e,n,r)=>{r=es(r,e[0].id.clock);const s=cn(e,r);oe(t.restEncoder,e.length-s),t.writeClient(n),oe(t.restEncoder,r);const o=e[s];o.write(t,r-o.id.clock);for(let a=s+1;a<e.length;a++)e[a].write(t,0)},Ha=(t,e,n)=>{const r=new Map;n.forEach((s,o)=>{ot(e,o)>s&&r.set(o,s)}),Pi(e).forEach((s,o)=>{n.has(o)||r.set(o,0)}),oe(t.restEncoder,r.size),vn(r.entries()).sort((s,o)=>o[0]-s[0]).forEach(([s,o])=>{w1(t,e.clients.get(s),s,o)})},A1=(t,e)=>{const n=$t(),r=fe(t.restDecoder);for(let s=0;s<r;s++){const o=fe(t.restDecoder),a=new Array(o),u=t.readClient();let c=fe(t.restDecoder);n.set(u,{i:0,refs:a});for(let l=0;l<o;l++){const f=t.readInfo();switch(ki&f){case 0:{const d=t.readLen();a[l]=new Gt(ve(u,c),d),c+=d;break}case 10:{const d=fe(t.restDecoder);a[l]=new Yt(ve(u,c),d),c+=d;break}default:{const d=(f&(xn|zt))===0,p=new He(ve(u,c),null,(f&zt)===zt?t.readLeftID():null,null,(f&xn)===xn?t.readRightID():null,d?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,d&&(f&dr)===dr?t.readString():null,Dh(t,f));a[l]=p,c+=p.length}}}}return n},v1=(t,e,n)=>{const r=[];let s=vn(n.keys()).sort((D,g)=>D-g);if(s.length===0)return null;const o=()=>{if(s.length===0)return null;let D=n.get(s[s.length-1]);for(;D.refs.length===D.i;)if(s.pop(),s.length>0)D=n.get(s[s.length-1]);else return null;return D};let a=o();if(a===null)return null;const u=new Yd,c=new Map,l=(D,g)=>{const y=c.get(D);(y==null||y>g)&&c.set(D,g)};let f=a.refs[a.i++];const d=new Map,p=()=>{for(const D of r){const g=D.id.client,y=n.get(g);y?(y.i--,u.clients.set(g,y.refs.slice(y.i)),n.delete(g),y.i=0,y.refs=[]):u.clients.set(g,[D]),s=s.filter(x=>x!==g)}r.length=0};for(;;){if(f.constructor!==Yt){const g=fn(d,f.id.client,()=>ot(e,f.id.client))-f.id.clock;if(g<0)r.push(f),l(f.id.client,f.id.clock-1),p();else{const y=f.getMissing(t,e);if(y!==null){r.push(f);const x=n.get(y)||{refs:[],i:0};if(x.refs.length===x.i)l(y,ot(e,y)),p();else{f=x.refs[x.i++];continue}}else(g===0||g<f.length)&&(f.integrate(t,g),d.set(f.id.client,f.id.clock+f.length))}}if(r.length>0)f=r.pop();else if(a!==null&&a.i<a.refs.length)f=a.refs[a.i++];else{if(a=o(),a===null)break;f=a.refs[a.i++]}}if(u.clients.size>0){const D=new Xn;return Ha(D,u,new Map),oe(D.restEncoder,0),{missing:c,update:D.toUint8Array()}}return null},k1=(t,e)=>Ha(t,e.doc.store,e.beforeState),S1=(t,e,n,r=new Us(t))=>ze(e,s=>{s.local=!1;let o=!1;const a=s.doc,u=a.store,c=A1(r,a),l=v1(s,u,c),f=u.pendingStructs;if(f){for(const[p,D]of f.missing)if(D<ot(u,p)){o=!0;break}if(l){for(const[p,D]of l.missing){const g=f.missing.get(p);(g==null||g>D)&&f.missing.set(p,D)}f.update=gi([f.update,l.update])}}else u.pendingStructs=l;const d=yc(r,s,u);if(u.pendingDs){const p=new Us(Un(u.pendingDs));fe(p.restDecoder);const D=yc(p,s,u);d&&D?u.pendingDs=gi([d,D]):u.pendingDs=d||D}else u.pendingDs=d;if(o){const p=u.pendingStructs.update;u.pendingStructs=null,Ud(s.doc,p)}},n,!1),Ud=(t,e,n,r=Us)=>{const s=Un(e);S1(s,t,n,new r(s))},zd=(t,e,n)=>Ud(t,e,n,Id),j1=(t,e,n=new Map)=>{Ha(t,e.store,n),Ws(t,E1(e.store))},B1=(t,e=new Uint8Array([0]),n=new Xn)=>{const r=Vd(e);j1(n,t,r);const s=[n.toUint8Array()];if(t.store.pendingDs&&s.push(t.store.pendingDs),t.store.pendingStructs&&s.push(W1(t.store.pendingStructs.update,e)),s.length>1){if(n.constructor===vr)return G1(s.map((o,a)=>a===0?o:J1(o)));if(n.constructor===Xn)return gi(s)}return s[0]},qa=(t,e)=>B1(t,e,new vr),T1=t=>{const e=new Map,n=fe(t.restDecoder);for(let r=0;r<n;r++){const s=fe(t.restDecoder),o=fe(t.restDecoder);e.set(s,o)}return e},Vd=t=>T1(new _d(Un(t))),Hd=(t,e)=>(oe(t.restEncoder,e.size),vn(e.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{oe(t.restEncoder,n),oe(t.restEncoder,r)}),t),N1=(t,e)=>Hd(t,Pi(e.store)),L1=(t,e=new $d)=>(t instanceof Map?Hd(e,t):N1(e,t),e.toUint8Array()),O1=t=>L1(t,new Md);class R1{constructor(){this.l=[]}}const Cc=()=>new R1,Ec=(t,e)=>t.l.push(e),xc=(t,e)=>{const n=t.l,r=n.length;t.l=n.filter(s=>e!==s),r===t.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},qd=(t,e,n)=>Ra(t.l,[e,n]);class ks{constructor(e,n){this.client=e,this.clock=n}}const xs=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,ve=(t,e)=>new ks(t,e),Kd=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw Vt()},Di=(t,e)=>{for(;e!==null;){if(e.parent===t)return!0;e=e.parent._item}return!1};class Gd{constructor(e,n,r,s=0){this.type=e,this.tname=n,this.item=r,this.assoc=s}}const D2=t=>{const e={};return t.type&&(e.type=t.type),t.tname&&(e.tname=t.tname),t.item&&(e.item=t.item),t.assoc!=null&&(e.assoc=t.assoc),e},g2=t=>new Gd(t.type==null?null:ve(t.type.client,t.type.clock),t.tname??null,t.item==null?null:ve(t.item.client,t.item.clock),t.assoc==null?0:t.assoc);class P1{constructor(e,n,r=0){this.type=e,this.index=n,this.assoc=r}}const _1=(t,e,n=0)=>new P1(t,e,n),Xr=(t,e,n)=>{let r=null,s=null;return t._item===null?s=Kd(t):r=ve(t._item.id.client,t._item.id.clock),new Gd(r,s,e,n)},F2=(t,e,n=0)=>{let r=t._start;if(n<0){if(e===0)return Xr(t,null,n);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return Xr(t,ve(r.id.client,r.id.clock+e),n);e-=r.length}if(r.right===null&&n<0)return Xr(t,r.lastId,n);r=r.right}return Xr(t,null,n)},I1=(t,e)=>{const n=Ss(t,e),r=e.clock-n.id.clock;return{item:n,diff:r}},b2=(t,e,n=!0)=>{const r=e.store,s=t.item,o=t.type,a=t.tname,u=t.assoc;let c=null,l=0;if(s!==null){if(ot(r,s.client)<=s.clock)return null;const f=n?aa(r,s):I1(r,s),d=f.item;if(!(d instanceof He))return null;if(c=d.parent,c._item===null||!c._item.deleted){l=d.deleted||!d.countable?0:f.diff+(u>=0?0:1);let p=d.left;for(;p!==null;)!p.deleted&&p.countable&&(l+=p.length),p=p.left}}else{if(a!==null)c=e.get(a);else if(o!==null){if(ot(r,o.client)<=o.clock)return null;const{item:f}=n?aa(r,o):{item:Ss(r,o)};if(f instanceof He&&f.content instanceof mn)c=f.content.type;else return null}else throw Vt();u>=0?l=c._length:l=0}return _1(c,l,t.assoc)},y2=(t,e)=>t===e||t!==null&&e!==null&&t.tname===e.tname&&xs(t.item,e.item)&&xs(t.type,e.type)&&t.assoc===e.assoc,Fs=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!Ar(e.ds,t.id),ra=(t,e)=>{const n=fn(t.meta,ra,In),r=t.doc.store;n.has(e)||(e.sv.forEach((s,o)=>{s<ot(r,o)&&Mt(t,ve(o,s))}),$s(t,e.ds,s=>{}),n.add(e))};class Yd{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const Pi=t=>{const e=new Map;return t.clients.forEach((n,r)=>{const s=n[n.length-1];e.set(r,s.id.clock+s.length)}),e},ot=(t,e)=>{const n=t.clients.get(e);if(n===void 0)return 0;const r=n[n.length-1];return r.id.clock+r.length},Wd=(t,e)=>{let n=t.clients.get(e.id.client);if(n===void 0)n=[],t.clients.set(e.id.client,n);else{const r=n[n.length-1];if(r.id.clock+r.length!==e.id.clock)throw Vt()}n.push(e)},cn=(t,e)=>{let n=0,r=t.length-1,s=t[r],o=s.id.clock;if(o===e)return r;let a=en(e/(o+s.length-1)*r);for(;n<=r;){if(s=t[a],o=s.id.clock,o<=e){if(e<o+s.length)return a;n=a+1}else r=a-1;a=en((n+r)/2)}throw Vt()},M1=(t,e)=>{const n=t.clients.get(e.client);return n[cn(n,e.clock)]},Ss=M1,ia=(t,e,n)=>{const r=cn(e,n),s=e[r];return s.id.clock<n&&s instanceof He?(e.splice(r+1,0,xi(t,s,n-s.id.clock)),r+1):r},Mt=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[ia(t,n,e.clock)]},wc=(t,e,n)=>{const r=e.clients.get(n.client),s=cn(r,n.clock),o=r[s];return n.clock!==o.id.clock+o.length-1&&o.constructor!==Gt&&r.splice(s+1,0,xi(t,o,n.clock-o.id.clock+1)),o},$1=(t,e,n)=>{const r=t.clients.get(e.id.client);r[cn(r,e.id.clock)]=n},Xd=(t,e,n,r,s)=>{if(r===0)return;const o=n+r;let a=ia(t,e,n),u;do u=e[a++],o<u.id.clock+u.length&&ia(t,e,o),s(u);while(a<e.length&&e[a].id.clock<o)};class U1{constructor(e,n,r){this.doc=e,this.deleteSet=new Ys,this.beforeState=Pi(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=n,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const Ac=(t,e)=>e.deleteSet.clients.size===0&&!m0(e.afterState,(n,r)=>e.beforeState.get(r)!==n)?!1:(za(e.deleteSet),k1(t,e),Ws(t,e.deleteSet),!0),vc=(t,e,n)=>{const r=e._item;(r===null||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)&&fn(t.changed,e,In).add(n)},ri=(t,e)=>{let n=t[e],r=t[e-1],s=e;for(;s>0;n=r,r=t[--s-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof He&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}const o=e-s;return o&&t.splice(e+1-o,o),o},z1=(t,e,n)=>{for(const[r,s]of t.clients.entries()){const o=e.clients.get(r);for(let a=s.length-1;a>=0;a--){const u=s[a],c=u.clock+u.len;for(let l=cn(o,u.clock),f=o[l];l<o.length&&f.id.clock<c;f=o[++l]){const d=o[l];if(u.clock+u.len<=d.id.clock)break;d instanceof He&&d.deleted&&!d.keep&&n(d)&&d.gc(e,!1)}}}},V1=(t,e)=>{t.clients.forEach((n,r)=>{const s=e.clients.get(r);for(let o=n.length-1;o>=0;o--){const a=n[o],u=ka(s.length-1,1+cn(s,a.clock+a.len-1));for(let c=u,l=s[c];c>0&&l.id.clock>=a.clock;l=s[c])c-=1+ri(s,c)}})},Jd=(t,e)=>{if(e<t.length){const n=t[e],r=n.doc,s=r.store,o=n.deleteSet,a=n._mergeStructs;try{za(o),n.afterState=Pi(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const u=[];n.changed.forEach((c,l)=>u.push(()=>{(l._item===null||!l._item.deleted)&&l._callObserver(n,c)})),u.push(()=>{n.changedParentTypes.forEach((c,l)=>{l._dEH.l.length>0&&(l._item===null||!l._item.deleted)&&(c=c.filter(f=>f.target._item===null||!f.target._item.deleted),c.forEach(f=>{f.currentTarget=l,f._path=null}),c.sort((f,d)=>f.path.length-d.path.length),u.push(()=>{qd(l._dEH,c,n)}))}),u.push(()=>r.emit("afterTransaction",[n,r])),u.push(()=>{n._needFormattingCleanup&&dF(n)})}),Ra(u,[])}finally{r.gc&&z1(o,s,r.gcFilter),V1(o,s),n.afterState.forEach((f,d)=>{const p=n.beforeState.get(d)||0;if(p!==f){const D=s.clients.get(d),g=es(cn(D,p),1);for(let y=D.length-1;y>=g;)y-=1+ri(D,y)}});for(let f=a.length-1;f>=0;f--){const{client:d,clock:p}=a[f].id,D=s.clients.get(d),g=cn(D,p);g+1<D.length&&ri(D,g+1)>1||g>0&&ri(D,g)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(F1(Ua,jd,"[yjs] ",Bd,Td,"Changed the client-id because another client seems to be using it."),r.clientID=Pd()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const f=new vr;Ac(f,n)&&r.emit("update",[f.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const f=new Xn;Ac(f,n)&&r.emit("updateV2",[f.toUint8Array(),n.origin,r,n])}const{subdocsAdded:u,subdocsLoaded:c,subdocsRemoved:l}=n;(u.size>0||l.size>0||c.size>0)&&(u.forEach(f=>{f.clientID=r.clientID,f.collectionid==null&&(f.collectionid=r.collectionid),r.subdocs.add(f)}),l.forEach(f=>r.subdocs.delete(f)),r.emit("subdocs",[{loaded:c,added:u,removed:l},r,n]),l.forEach(f=>f.destroy())),t.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,t])):Jd(t,e+1)}}},ze=(t,e,n=null,r=!0)=>{const s=t._transactionCleanups;let o=!1,a=null;t._transaction===null&&(o=!0,t._transaction=new U1(t,n,r),s.push(t._transaction),s.length===1&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{a=e(t._transaction)}finally{if(o){const u=t._transaction===s[0];t._transaction=null,u&&Jd(s,0)}}return a};class H1{constructor(e,n){this.insertions=n,this.deletions=e,this.meta=new Map}}const kc=(t,e,n)=>{$s(t,n.deletions,r=>{r instanceof He&&e.scope.some(s=>s===t.doc||Di(s,r))&&Qa(r,!1)})},Sc=(t,e,n)=>{let r=null;const s=t.doc,o=t.scope;ze(s,u=>{for(;e.length>0&&t.currStackItem===null;){const c=s.store,l=e.pop(),f=new Set,d=[];let p=!1;$s(u,l.insertions,D=>{if(D instanceof He){if(D.redone!==null){let{item:g,diff:y}=aa(c,D.id);y>0&&(g=Mt(u,ve(g.id.client,g.id.clock+y))),D=g}!D.deleted&&o.some(g=>g===u.doc||Di(g,D))&&d.push(D)}}),$s(u,l.deletions,D=>{D instanceof He&&o.some(g=>g===u.doc||Di(g,D))&&!Ar(l.insertions,D.id)&&f.add(D)}),f.forEach(D=>{p=mh(u,D,f,l.insertions,t.ignoreRemoteMapChanges,t)!==null||p});for(let D=d.length-1;D>=0;D--){const g=d[D];t.deleteFilter(g)&&(g.delete(u),p=!0)}t.currStackItem=p?l:null}u.changed.forEach((c,l)=>{c.has(null)&&l._searchMarker&&(l._searchMarker.length=0)}),r=u},t);const a=t.currStackItem;if(a!=null){const u=r.changedParentTypes;t.emit("stack-item-popped",[{stackItem:a,type:n,changedParentTypes:u,origin:t},t]),t.currStackItem=null}return a};class q1 extends va{constructor(e,{captureTimeout:n=500,captureTransaction:r=c=>!0,deleteFilter:s=()=>!0,trackedOrigins:o=new Set([null]),ignoreRemoteMapChanges:a=!1,doc:u=Ps(e)?e[0].doc:e instanceof ts?e:e.doc}={}){super(),this.scope=[],this.doc=u,this.addToScope(e),this.deleteFilter=s,o.add(this),this.trackedOrigins=o,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=a,this.captureTimeout=n,this.afterTransactionHandler=c=>{if(!this.captureTransaction(c)||!this.scope.some(x=>c.changedParentTypes.has(x)||x===this.doc)||!this.trackedOrigins.has(c.origin)&&(!c.origin||!this.trackedOrigins.has(c.origin.constructor)))return;const l=this.undoing,f=this.redoing,d=l?this.redoStack:this.undoStack;l?this.stopCapturing():f||this.clear(!1,!0);const p=new Ys;c.afterState.forEach((x,A)=>{const L=c.beforeState.get(A)||0,R=x-L;R>0&&gr(p,A,L,R)});const D=Mn();let g=!1;if(this.lastChange>0&&D-this.lastChange<this.captureTimeout&&d.length>0&&!l&&!f){const x=d[d.length-1];x.deletions=sa([x.deletions,c.deleteSet]),x.insertions=sa([x.insertions,p])}else d.push(new H1(c.deleteSet,p)),g=!0;!l&&!f&&(this.lastChange=D),$s(c,c.deleteSet,x=>{x instanceof He&&this.scope.some(A=>A===c.doc||Di(A,x))&&Qa(x,!0)});const y=[{stackItem:d[d.length-1],origin:c.origin,type:l?"redo":"undo",changedParentTypes:c.changedParentTypes},this];g?this.emit("stack-item-added",y):this.emit("stack-item-updated",y)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(e){const n=new Set(this.scope);e=Ps(e)?e:[e],e.forEach(r=>{n.has(r)||(n.add(r),(r instanceof wt?r.doc!==this.doc:r!==this.doc)&&Ld("[yjs#509] Not same Y.Doc"),this.scope.push(r))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,n=!0){(e&&this.canUndo()||n&&this.canRedo())&&this.doc.transact(r=>{e&&(this.undoStack.forEach(s=>kc(r,this,s)),this.undoStack=[]),n&&(this.redoStack.forEach(s=>kc(r,this,s)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:e,redoStackCleared:n}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=Sc(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=Sc(this,this.redoStack,"redo")}finally{this.redoing=!1}return e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}}function*K1(t){const e=fe(t.restDecoder);for(let n=0;n<e;n++){const r=fe(t.restDecoder),s=t.readClient();let o=fe(t.restDecoder);for(let a=0;a<r;a++){const u=t.readInfo();if(u===10){const c=fe(t.restDecoder);yield new Yt(ve(s,o),c),o+=c}else if((ki&u)!==0){const c=(u&(xn|zt))===0,l=new He(ve(s,o),null,(u&zt)===zt?t.readLeftID():null,null,(u&xn)===xn?t.readRightID():null,c?t.readParentInfo()?t.readString():t.readLeftID():null,c&&(u&dr)===dr?t.readString():null,Dh(t,u));yield l,o+=l.length}else{const c=t.readLen();yield new Gt(ve(s,o),c),o+=c}}}}class Ka{constructor(e,n){this.gen=K1(e),this.curr=null,this.done=!1,this.filterSkips=n,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===Yt);return this.curr}}class Ga{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const G1=t=>gi(t,Id,vr),Y1=(t,e)=>{if(t.constructor===Gt){const{client:n,clock:r}=t.id;return new Gt(ve(n,r+e),t.length-e)}else if(t.constructor===Yt){const{client:n,clock:r}=t.id;return new Yt(ve(n,r+e),t.length-e)}else{const n=t,{client:r,clock:s}=n.id;return new He(ve(r,s+e),null,ve(r,s+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},gi=(t,e=Us,n=Xn)=>{if(t.length===1)return t[0];const r=t.map(f=>new e(Un(f)));let s=r.map(f=>new Ka(f,!0)),o=null;const a=new n,u=new Ga(a);for(;s=s.filter(p=>p.curr!==null),s.sort((p,D)=>{if(p.curr.id.client===D.curr.id.client){const g=p.curr.id.clock-D.curr.id.clock;return g===0?p.curr.constructor===D.curr.constructor?0:p.curr.constructor===Yt?1:-1:g}else return D.curr.id.client-p.curr.id.client}),s.length!==0;){const f=s[0],d=f.curr.id.client;if(o!==null){let p=f.curr,D=!1;for(;p!==null&&p.id.clock+p.length<=o.struct.id.clock+o.struct.length&&p.id.client>=o.struct.id.client;)p=f.next(),D=!0;if(p===null||p.id.client!==d||D&&p.id.clock>o.struct.id.clock+o.struct.length)continue;if(d!==o.struct.id.client)On(u,o.struct,o.offset),o={struct:p,offset:0},f.next();else if(o.struct.id.clock+o.struct.length<p.id.clock)if(o.struct.constructor===Yt)o.struct.length=p.id.clock+p.length-o.struct.id.clock;else{On(u,o.struct,o.offset);const g=p.id.clock-o.struct.id.clock-o.struct.length;o={struct:new Yt(ve(d,o.struct.id.clock+o.struct.length),g),offset:0}}else{const g=o.struct.id.clock+o.struct.length-p.id.clock;g>0&&(o.struct.constructor===Yt?o.struct.length-=g:p=Y1(p,g)),o.struct.mergeWith(p)||(On(u,o.struct,o.offset),o={struct:p,offset:0},f.next())}}else o={struct:f.curr,offset:0},f.next();for(let p=f.curr;p!==null&&p.id.client===d&&p.id.clock===o.struct.id.clock+o.struct.length&&p.constructor!==Yt;p=f.next())On(u,o.struct,o.offset),o={struct:p,offset:0}}o!==null&&(On(u,o.struct,o.offset),o=null),Ya(u);const c=r.map(f=>Va(f)),l=sa(c);return Ws(a,l),a.toUint8Array()},W1=(t,e,n=Us,r=Xn)=>{const s=Vd(e),o=new r,a=new Ga(o),u=new n(Un(t)),c=new Ka(u,!1);for(;c.curr;){const f=c.curr,d=f.id.client,p=s.get(d)||0;if(c.curr.constructor===Yt){c.next();continue}if(f.id.clock+f.length>p)for(On(a,f,es(p-f.id.clock,0)),c.next();c.curr&&c.curr.id.client===d;)On(a,c.curr,0),c.next();else for(;c.curr&&c.curr.id.client===d&&c.curr.id.clock+c.curr.length<=p;)c.next()}Ya(a);const l=Va(u);return Ws(o,l),o.toUint8Array()},Zd=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:Ve(t.encoder.restEncoder)}),t.encoder.restEncoder=lt(),t.written=0)},On=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&Zd(t),t.written===0&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),oe(t.encoder.restEncoder,e.id.clock+n)),e.write(t.encoder,n),t.written++},Ya=t=>{Zd(t);const e=t.encoder.restEncoder;oe(e,t.clientStructs.length);for(let n=0;n<t.clientStructs.length;n++){const r=t.clientStructs[n];oe(e,r.written),Si(e,r.restEncoder)}},X1=(t,e,n,r)=>{const s=new n(Un(t)),o=new Ka(s,!1),a=new r,u=new Ga(a);for(let l=o.curr;l!==null;l=o.next())On(u,e(l),0);Ya(u);const c=Va(s);return Ws(a,c),a.toUint8Array()},J1=t=>X1(t,ag,Us,vr),jc="You must not compute changes after the event-handler fired.";class _i{constructor(e,n){this.target=e,this.currentTarget=e,this.transaction=n,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=Z1(this.currentTarget,this.target))}deletes(e){return Ar(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw tn(jc);const e=new Map,n=this.target;this.transaction.changed.get(n).forEach(s=>{if(s!==null){const o=n._map.get(s);let a,u;if(this.adds(o)){let c=o.left;for(;c!==null&&this.adds(c);)c=c.left;if(this.deletes(o))if(c!==null&&this.deletes(c))a="delete",u=po(c.content.getContent());else return;else c!==null&&this.deletes(c)?(a="update",u=po(c.content.getContent())):(a="add",u=void 0)}else if(this.deletes(o))a="delete",u=po(o.content.getContent());else return;e.set(s,{action:a,oldValue:u})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw tn(jc);const n=this.target,r=In(),s=In(),o=[];if(e={added:r,deleted:s,delta:o,keys:this.keys},this.transaction.changed.get(n).has(null)){let u=null;const c=()=>{u&&o.push(u)};for(let l=n._start;l!==null;l=l.right)l.deleted?this.deletes(l)&&!this.adds(l)&&((u===null||u.delete===void 0)&&(c(),u={delete:0}),u.delete+=l.length,s.add(l)):this.adds(l)?((u===null||u.insert===void 0)&&(c(),u={insert:[]}),u.insert=u.insert.concat(l.content.getContent()),r.add(l)):((u===null||u.retain===void 0)&&(c(),u={retain:0}),u.retain+=l.length);u!==null&&u.retain===void 0&&c()}this._changes=e}return e}}const Z1=(t,e)=>{const n=[];for(;e._item!==null&&e!==t;){if(e._item.parentSub!==null)n.unshift(e._item.parentSub);else{let r=0,s=e._item.parent._start;for(;s!==e._item&&s!==null;)!s.deleted&&s.countable&&(r+=s.length),s=s.right;n.unshift(r)}e=e._item.parent}return n},Ot=()=>{Ld("Invalid access: Add Yjs type to a document before reading data.")},Qd=80;let Wa=0;class Q1{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=Wa++}}const eF=t=>{t.timestamp=Wa++},eh=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=Wa++},tF=(t,e,n)=>{if(t.length>=Qd){const r=t.reduce((s,o)=>s.timestamp<o.timestamp?s:o);return eh(r,e,n),r}else{const r=new Q1(e,n);return t.push(r),r}},Ii=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;const n=t._searchMarker.length===0?null:t._searchMarker.reduce((o,a)=>ti(e-o.index)<ti(e-a.index)?o:a);let r=t._start,s=0;for(n!==null&&(r=n.p,s=n.index,eF(n));r.right!==null&&s<e;){if(!r.deleted&&r.countable){if(e<s+r.length)break;s+=r.length}r=r.right}for(;r.left!==null&&s>e;)r=r.left,!r.deleted&&r.countable&&(s-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(s-=r.length);return n!==null&&ti(n.index-s)<r.parent.length/Qd?(eh(n,r,s),n):tF(t._searchMarker,r,s)},Fr=(t,e,n)=>{for(let r=t.length-1;r>=0;r--){const s=t[r];if(n>0){let o=s.p;for(o.marker=!1;o&&(o.deleted||!o.countable);)o=o.left,o&&!o.deleted&&o.countable&&(s.index-=o.length);if(o===null||o.marker===!0){t.splice(r,1);continue}s.p=o,o.marker=!0}(e<s.index||n>0&&e===s.index)&&(s.index=es(e,s.index+n))}},Mi=(t,e,n)=>{const r=t,s=e.changedParentTypes;for(;fn(s,t,()=>[]).push(n),t._item!==null;)t=t._item.parent;qd(r._eH,n,e)};class wt{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=Cc(),this._dEH=Cc(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,n){this.doc=e,this._item=n}_copy(){throw Zt()}clone(){throw Zt()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,n){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){Ec(this._eH,e)}observeDeep(e){Ec(this._dEH,e)}unobserve(e){xc(this._eH,e)}unobserveDeep(e){xc(this._dEH,e)}toJSON(){}}const th=(t,e,n)=>{t.doc??Ot(),e<0&&(e=t._length+e),n<0&&(n=t._length+n);let r=n-e;const s=[];let o=t._start;for(;o!==null&&r>0;){if(o.countable&&!o.deleted){const a=o.content.getContent();if(a.length<=e)e-=a.length;else{for(let u=e;u<a.length&&r>0;u++)s.push(a[u]),r--;e=0}}o=o.right}return s},nh=t=>{t.doc??Ot();const e=[];let n=t._start;for(;n!==null;){if(n.countable&&!n.deleted){const r=n.content.getContent();for(let s=0;s<r.length;s++)e.push(r[s])}n=n.right}return e},br=(t,e)=>{let n=0,r=t._start;for(t.doc??Ot();r!==null;){if(r.countable&&!r.deleted){const s=r.content.getContent();for(let o=0;o<s.length;o++)e(s[o],n++,t)}r=r.right}},sh=(t,e)=>{const n=[];return br(t,(r,s)=>{n.push(e(r,s,t))}),n},nF=t=>{let e=t._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};n=e.content.getContent(),r=0,e=e.right}const s=n[r++];return n.length<=r&&(n=null),{done:!1,value:s}}}},rh=(t,e)=>{t.doc??Ot();const n=Ii(t,e);let r=t._start;for(n!==null&&(r=n.p,e-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(e<r.length)return r.content.getContent()[e];e-=r.length}},Fi=(t,e,n,r)=>{let s=n;const o=t.doc,a=o.clientID,u=o.store,c=n===null?e._start:n.right;let l=[];const f=()=>{l.length>0&&(s=new He(ve(a,ot(u,a)),s,s&&s.lastId,c,c&&c.id,e,null,new Zn(l)),s.integrate(t,0),l=[])};r.forEach(d=>{if(d===null)l.push(d);else switch(d.constructor){case Number:case Object:case Boolean:case Array:case String:l.push(d);break;default:switch(f(),d.constructor){case Uint8Array:case ArrayBuffer:s=new He(ve(a,ot(u,a)),s,s&&s.lastId,c,c&&c.id,e,null,new kr(new Uint8Array(d))),s.integrate(t,0);break;case ts:s=new He(ve(a,ot(u,a)),s,s&&s.lastId,c,c&&c.id,e,null,new Sr(d)),s.integrate(t,0);break;default:if(d instanceof wt)s=new He(ve(a,ot(u,a)),s,s&&s.lastId,c,c&&c.id,e,null,new mn(d)),s.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),f()},ih=()=>tn("Length exceeded!"),oh=(t,e,n,r)=>{if(n>e._length)throw ih();if(n===0)return e._searchMarker&&Fr(e._searchMarker,n,r.length),Fi(t,e,null,r);const s=n,o=Ii(e,n);let a=e._start;for(o!==null&&(a=o.p,n-=o.index,n===0&&(a=a.prev,n+=a&&a.countable&&!a.deleted?a.length:0));a!==null;a=a.right)if(!a.deleted&&a.countable){if(n<=a.length){n<a.length&&Mt(t,ve(a.id.client,a.id.clock+n));break}n-=a.length}return e._searchMarker&&Fr(e._searchMarker,s,r.length),Fi(t,e,a,r)},sF=(t,e,n)=>{let s=(e._searchMarker||[]).reduce((o,a)=>a.index>o.index?a:o,{index:0,p:e._start}).p;if(s)for(;s.right;)s=s.right;return Fi(t,e,s,n)},ah=(t,e,n,r)=>{if(r===0)return;const s=n,o=r,a=Ii(e,n);let u=e._start;for(a!==null&&(u=a.p,n-=a.index);u!==null&&n>0;u=u.right)!u.deleted&&u.countable&&(n<u.length&&Mt(t,ve(u.id.client,u.id.clock+n)),n-=u.length);for(;r>0&&u!==null;)u.deleted||(r<u.length&&Mt(t,ve(u.id.client,u.id.clock+r)),u.delete(t),r-=u.length),u=u.right;if(r>0)throw ih();e._searchMarker&&Fr(e._searchMarker,s,-o+r)},bi=(t,e,n)=>{const r=e._map.get(n);r!==void 0&&r.delete(t)},Xa=(t,e,n,r)=>{const s=e._map.get(n)||null,o=t.doc,a=o.clientID;let u;if(r==null)u=new Zn([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:u=new Zn([r]);break;case Uint8Array:u=new kr(r);break;case ts:u=new Sr(r);break;default:if(r instanceof wt)u=new mn(r);else throw new Error("Unexpected content type")}new He(ve(a,ot(o.store,a)),s,s&&s.lastId,null,null,e,n,u).integrate(t,0)},Ja=(t,e)=>{t.doc??Ot();const n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},uh=t=>{const e={};return t.doc??Ot(),t._map.forEach((n,r)=>{n.deleted||(e[r]=n.content.getContent()[n.length-1])}),e},ch=(t,e)=>{t.doc??Ot();const n=t._map.get(e);return n!==void 0&&!n.deleted},rF=(t,e)=>{const n={};return t._map.forEach((r,s)=>{let o=r;for(;o!==null&&(!e.sv.has(o.id.client)||o.id.clock>=(e.sv.get(o.id.client)||0));)o=o.left;o!==null&&Fs(o,e)&&(n[s]=o.content.getContent()[o.length-1])}),n},Jr=t=>(t.doc??Ot(),b1(t._map.entries(),e=>!e[1].deleted));class iF extends _i{}class js extends wt{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const n=new js;return n.push(e),n}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new js}clone(){const e=new js;return e.insert(0,this.toArray().map(n=>n instanceof wt?n.clone():n)),e}get length(){return this.doc??Ot(),this._length}_callObserver(e,n){super._callObserver(e,n),Mi(this,e,new iF(this,e))}insert(e,n){this.doc!==null?ze(this.doc,r=>{oh(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?ze(this.doc,n=>{sF(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?ze(this.doc,r=>{ah(r,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return rh(this,e)}toArray(){return nh(this)}slice(e=0,n=this.length){return th(this,e,n)}toJSON(){return this.map(e=>e instanceof wt?e.toJSON():e)}map(e){return sh(this,e)}forEach(e){br(this,e)}[Symbol.iterator](){return nF(this)}_write(e){e.writeTypeRef(BF)}}const oF=t=>new js;class aF extends _i{constructor(e,n,r){super(e,n),this.keysChanged=r}}class zs extends wt{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,n){super._integrate(e,n),this._prelimContent.forEach((r,s)=>{this.set(s,r)}),this._prelimContent=null}_copy(){return new zs}clone(){const e=new zs;return this.forEach((n,r)=>{e.set(r,n instanceof wt?n.clone():n)}),e}_callObserver(e,n){Mi(this,e,new aF(this,e,n))}toJSON(){this.doc??Ot();const e={};return this._map.forEach((n,r)=>{if(!n.deleted){const s=n.content.getContent()[n.length-1];e[r]=s instanceof wt?s.toJSON():s}}),e}get size(){return[...Jr(this)].length}keys(){return Co(Jr(this),e=>e[0])}values(){return Co(Jr(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return Co(Jr(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??Ot(),this._map.forEach((n,r)=>{n.deleted||e(n.content.getContent()[n.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?ze(this.doc,n=>{bi(n,this,e)}):this._prelimContent.delete(e)}set(e,n){return this.doc!==null?ze(this.doc,r=>{Xa(r,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return Ja(this,e)}has(e){return ch(this,e)}clear(){this.doc!==null?ze(this.doc,e=>{this.forEach(function(n,r,s){bi(e,s,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(TF)}}const uF=t=>new zs,Rn=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&ig(t,e);class oa{constructor(e,n,r,s){this.left=e,this.right=n,this.index=r,this.currentAttributes=s}forward(){this.right===null&&Vt(),this.right.content.constructor===gt?this.right.deleted||Xs(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}}const Bc=(t,e,n)=>{for(;e.right!==null&&n>0;)e.right.content.constructor===gt?e.right.deleted||Xs(e.currentAttributes,e.right.content):e.right.deleted||(n<e.right.length&&Mt(t,ve(e.right.id.client,e.right.id.clock+n)),e.index+=e.right.length,n-=e.right.length),e.left=e.right,e.right=e.right.right;return e},Zr=(t,e,n,r)=>{const s=new Map,o=r?Ii(e,n):null;if(o){const a=new oa(o.p.left,o.p,o.index,s);return Bc(t,a,n-o.index)}else{const a=new oa(null,e._start,0,s);return Bc(t,a,n)}},lh=(t,e,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===gt&&Rn(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const s=t.doc,o=s.clientID;r.forEach((a,u)=>{const c=n.left,l=n.right,f=new He(ve(o,ot(s.store,o)),c,c&&c.lastId,l,l&&l.id,e,null,new gt(u,a));f.integrate(t,0),n.right=f,n.forward()})},Xs=(t,e)=>{const{key:n,value:r}=e;r===null?t.delete(n):t.set(n,r)},dh=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===gt&&Rn(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},hh=(t,e,n,r)=>{const s=t.doc,o=s.clientID,a=new Map;for(const u in r){const c=r[u],l=n.currentAttributes.get(u)??null;if(!Rn(l,c)){a.set(u,l);const{left:f,right:d}=n;n.right=new He(ve(o,ot(s.store,o)),f,f&&f.lastId,d,d&&d.id,e,null,new gt(u,c)),n.right.integrate(t,0),n.forward()}}return a},Eo=(t,e,n,r,s)=>{n.currentAttributes.forEach((p,D)=>{s[D]===void 0&&(s[D]=null)});const o=t.doc,a=o.clientID;dh(n,s);const u=hh(t,e,n,s),c=r.constructor===String?new ln(r):r instanceof wt?new mn(r):new ns(r);let{left:l,right:f,index:d}=n;e._searchMarker&&Fr(e._searchMarker,n.index,c.getLength()),f=new He(ve(a,ot(o.store,a)),l,l&&l.lastId,f,f&&f.id,e,null,c),f.integrate(t,0),n.right=f,n.index=d,n.forward(),lh(t,e,n,u)},Tc=(t,e,n,r,s)=>{const o=t.doc,a=o.clientID;dh(n,s);const u=hh(t,e,n,s);e:for(;n.right!==null&&(r>0||u.size>0&&(n.right.deleted||n.right.content.constructor===gt));){if(!n.right.deleted)switch(n.right.content.constructor){case gt:{const{key:c,value:l}=n.right.content,f=s[c];if(f!==void 0){if(Rn(f,l))u.delete(c);else{if(r===0)break e;u.set(c,l)}n.right.delete(t)}else n.currentAttributes.set(c,l);break}default:r<n.right.length&&Mt(t,ve(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let c="";for(;r>0;r--)c+=`
45
+ `;n.right=new He(ve(a,ot(o.store,a)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new ln(c)),n.right.integrate(t,0),n.forward()}lh(t,e,n,u)},fh=(t,e,n,r,s)=>{let o=e;const a=$t();for(;o&&(!o.countable||o.deleted);){if(!o.deleted&&o.content.constructor===gt){const l=o.content;a.set(l.key,l)}o=o.right}let u=0,c=!1;for(;e!==o;){if(n===e&&(c=!0),!e.deleted){const l=e.content;if(l.constructor===gt){const{key:f,value:d}=l,p=r.get(f)??null;(a.get(f)!==l||p===d)&&(e.delete(t),u++,!c&&(s.get(f)??null)===d&&p!==d&&(p===null?s.delete(f):s.set(f,p))),!c&&!e.deleted&&Xs(s,l)}}e=e.right}return u},cF=(t,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;const n=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===gt){const r=e.content.key;n.has(r)?e.delete(t):n.add(r)}e=e.left}},lF=t=>{let e=0;return ze(t.doc,n=>{let r=t._start,s=t._start,o=$t();const a=Jo(o);for(;s;)s.deleted===!1&&(s.content.constructor===gt?Xs(a,s.content):(e+=fh(n,r,s,o,a),o=Jo(a),r=s)),s=s.right}),e},dF=t=>{const e=new Set,n=t.doc;for(const[r,s]of t.afterState.entries()){const o=t.beforeState.get(r)||0;s!==o&&Xd(t,n.store.clients.get(r),o,s,a=>{!a.deleted&&a.content.constructor===gt&&a.constructor!==Gt&&e.add(a.parent)})}ze(n,r=>{$s(t,t.deleteSet,s=>{if(s instanceof Gt||!s.parent._hasFormatting||e.has(s.parent))return;const o=s.parent;s.content.constructor===gt?e.add(o):cF(r,s)});for(const s of e)lF(s)})},Nc=(t,e,n)=>{const r=n,s=Jo(e.currentAttributes),o=e.right;for(;n>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case mn:case ns:case ln:n<e.right.length&&Mt(t,ve(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t);break}e.forward()}o&&fh(t,o,e.right,s,e.currentAttributes);const a=(e.left||e.right).parent;return a._searchMarker&&Fr(a._searchMarker,e.index,-r+n),e};class hF extends _i{constructor(e,n,r){super(e,n),this.childListChanged=!1,this.keysChanged=new Set,r.forEach(s=>{s===null?this.childListChanged=!0:this.keysChanged.add(s)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,n=[];ze(e,r=>{const s=new Map,o=new Map;let a=this.target._start,u=null;const c={};let l="",f=0,d=0;const p=()=>{if(u!==null){let D=null;switch(u){case"delete":d>0&&(D={delete:d}),d=0;break;case"insert":(typeof l=="object"||l.length>0)&&(D={insert:l},s.size>0&&(D.attributes={},s.forEach((g,y)=>{g!==null&&(D.attributes[y]=g)}))),l="";break;case"retain":f>0&&(D={retain:f},rg(c)||(D.attributes=eg({},c))),f=0;break}D&&n.push(D),u=null}};for(;a!==null;){switch(a.content.constructor){case mn:case ns:this.adds(a)?this.deletes(a)||(p(),u="insert",l=a.content.getContent()[0],p()):this.deletes(a)?(u!=="delete"&&(p(),u="delete"),d+=1):a.deleted||(u!=="retain"&&(p(),u="retain"),f+=1);break;case ln:this.adds(a)?this.deletes(a)||(u!=="insert"&&(p(),u="insert"),l+=a.content.str):this.deletes(a)?(u!=="delete"&&(p(),u="delete"),d+=a.length):a.deleted||(u!=="retain"&&(p(),u="retain"),f+=a.length);break;case gt:{const{key:D,value:g}=a.content;if(this.adds(a)){if(!this.deletes(a)){const y=s.get(D)??null;Rn(y,g)?g!==null&&a.delete(r):(u==="retain"&&p(),Rn(g,o.get(D)??null)?delete c[D]:c[D]=g)}}else if(this.deletes(a)){o.set(D,g);const y=s.get(D)??null;Rn(y,g)||(u==="retain"&&p(),c[D]=y)}else if(!a.deleted){o.set(D,g);const y=c[D];y!==void 0&&(Rn(y,g)?y!==null&&a.delete(r):(u==="retain"&&p(),g===null?delete c[D]:c[D]=g))}a.deleted||(u==="insert"&&p(),Xs(s,a.content));break}}a=a.right}for(p();n.length>0;){const D=n[n.length-1];if(D.retain!==void 0&&D.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}}class Vs extends wt{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??Ot(),this._length}_integrate(e,n){super._integrate(e,n);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new Vs}clone(){const e=new Vs;return e.applyDelta(this.toDelta()),e}_callObserver(e,n){super._callObserver(e,n);const r=new hF(this,e,n);Mi(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??Ot();let e="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===ln&&(e+=n.content.str),n=n.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:n=!0}={}){this.doc!==null?ze(this.doc,r=>{const s=new oa(null,this._start,0,new Map);for(let o=0;o<e.length;o++){const a=e[o];if(a.insert!==void 0){const u=!n&&typeof a.insert=="string"&&o===e.length-1&&s.right===null&&a.insert.slice(-1)===`
46
+ `?a.insert.slice(0,-1):a.insert;(typeof u!="string"||u.length>0)&&Eo(r,this,s,u,a.attributes||{})}else a.retain!==void 0?Tc(r,this,s,a.retain,a.attributes||{}):a.delete!==void 0&&Nc(r,s,a.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,r){this.doc??Ot();const s=[],o=new Map,a=this.doc;let u="",c=this._start;function l(){if(u.length>0){const d={};let p=!1;o.forEach((g,y)=>{p=!0,d[y]=g});const D={insert:u};p&&(D.attributes=d),s.push(D),u=""}}const f=()=>{for(;c!==null;){if(Fs(c,e)||n!==void 0&&Fs(c,n))switch(c.content.constructor){case ln:{const d=o.get("ychange");e!==void 0&&!Fs(c,e)?(d===void 0||d.user!==c.id.client||d.type!=="removed")&&(l(),o.set("ychange",r?r("removed",c.id):{type:"removed"})):n!==void 0&&!Fs(c,n)?(d===void 0||d.user!==c.id.client||d.type!=="added")&&(l(),o.set("ychange",r?r("added",c.id):{type:"added"})):d!==void 0&&(l(),o.delete("ychange")),u+=c.content.str;break}case mn:case ns:{l();const d={insert:c.content.getContent()[0]};if(o.size>0){const p={};d.attributes=p,o.forEach((D,g)=>{p[g]=D})}s.push(d);break}case gt:Fs(c,e)&&(l(),Xs(o,c.content));break}c=c.right}l()};return e||n?ze(a,d=>{e&&ra(d,e),n&&ra(d,n),f()},"cleanup"):f(),s}insert(e,n,r){if(n.length<=0)return;const s=this.doc;s!==null?ze(s,o=>{const a=Zr(o,this,e,!r);r||(r={},a.currentAttributes.forEach((u,c)=>{r[c]=u})),Eo(o,this,a,n,r)}):this._pending.push(()=>this.insert(e,n,r))}insertEmbed(e,n,r){const s=this.doc;s!==null?ze(s,o=>{const a=Zr(o,this,e,!r);Eo(o,this,a,n,r||{})}):this._pending.push(()=>this.insertEmbed(e,n,r||{}))}delete(e,n){if(n===0)return;const r=this.doc;r!==null?ze(r,s=>{Nc(s,Zr(s,this,e,!0),n)}):this._pending.push(()=>this.delete(e,n))}format(e,n,r){if(n===0)return;const s=this.doc;s!==null?ze(s,o=>{const a=Zr(o,this,e,!1);a.right!==null&&Tc(o,this,a,n,r)}):this._pending.push(()=>this.format(e,n,r))}removeAttribute(e){this.doc!==null?ze(this.doc,n=>{bi(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?ze(this.doc,r=>{Xa(r,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return Ja(this,e)}getAttributes(){return uh(this)}_write(e){e.writeTypeRef(NF)}}const fF=t=>new Vs;class xo{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??Ot()}[Symbol.iterator](){return this}next(){let e=this._currentNode,n=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(n)))do if(n=e.content.type,!e.deleted&&(n.constructor===Hs||n.constructor===Jn)&&n._start!==null)e=n._start;else for(;e!==null;){const r=e.next;if(r!==null){e=r;break}else e.parent===this._root?e=null:e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class Jn extends wt{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Jn}clone(){const e=new Jn;return e.insert(0,this.toArray().map(n=>n instanceof wt?n.clone():n)),e}get length(){return this.doc??Ot(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new xo(this,e)}querySelector(e){e=e.toUpperCase();const r=new xo(this,s=>s.nodeName&&s.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),vn(new xo(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){Mi(this,e,new DF(this,n,e))}toString(){return sh(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,n={},r){const s=e.createDocumentFragment();return r!==void 0&&r._createAssociation(s,this),br(this,o=>{s.insertBefore(o.toDOM(e,n,r),null)}),s}insert(e,n){this.doc!==null?ze(this.doc,r=>{oh(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)ze(this.doc,r=>{const s=e&&e instanceof wt?e._item:e;Fi(r,this,s,n)});else{const r=this._prelimContent,s=e===null?0:r.findIndex(o=>o===e)+1;if(s===0&&e!==null)throw tn("Reference item not found");r.splice(s,0,...n)}}delete(e,n=1){this.doc!==null?ze(this.doc,r=>{ah(r,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return nh(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return rh(this,e)}slice(e=0,n=this.length){return th(this,e,n)}forEach(e){br(this,e)}_write(e){e.writeTypeRef(OF)}}const pF=t=>new Jn;class Hs extends Jn{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,n){super._integrate(e,n),this._prelimAttrs.forEach((r,s)=>{this.setAttribute(s,r)}),this._prelimAttrs=null}_copy(){return new Hs(this.nodeName)}clone(){const e=new Hs(this.nodeName),n=this.getAttributes();return ng(n,(r,s)=>{e.setAttribute(s,r)}),e.insert(0,this.toArray().map(r=>r instanceof wt?r.clone():r)),e}toString(){const e=this.getAttributes(),n=[],r=[];for(const u in e)r.push(u);r.sort();const s=r.length;for(let u=0;u<s;u++){const c=r[u];n.push(c+'="'+e[c]+'"')}const o=this.nodeName.toLocaleLowerCase(),a=n.length>0?" "+n.join(" "):"";return`<${o}${a}>${super.toString()}</${o}>`}removeAttribute(e){this.doc!==null?ze(this.doc,n=>{bi(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?ze(this.doc,r=>{Xa(r,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return Ja(this,e)}hasAttribute(e){return ch(this,e)}getAttributes(e){return e?rF(this,e):uh(this)}toDOM(e=document,n={},r){const s=e.createElement(this.nodeName),o=this.getAttributes();for(const a in o){const u=o[a];typeof u=="string"&&s.setAttribute(a,u)}return br(this,a=>{s.appendChild(a.toDOM(e,n,r))}),r!==void 0&&r._createAssociation(s,this),s}_write(e){e.writeTypeRef(LF),e.writeKey(this.nodeName)}}const mF=t=>new Hs(t.readKey());class DF extends _i{constructor(e,n,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(s=>{s===null?this.childListChanged=!0:this.attributesChanged.add(s)})}}class yi extends zs{constructor(e){super(),this.hookName=e}_copy(){return new yi(this.hookName)}clone(){const e=new yi(this.hookName);return this.forEach((n,r)=>{e.set(r,n)}),e}toDOM(e=document,n={},r){const s=n[this.hookName];let o;return s!==void 0?o=s.createDom(this):o=document.createElement(this.hookName),o.setAttribute("data-yjs-hook",this.hookName),r!==void 0&&r._createAssociation(o,this),o}_write(e){e.writeTypeRef(RF),e.writeKey(this.hookName)}}const gF=t=>new yi(t.readKey());class Ci extends Vs{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new Ci}clone(){const e=new Ci;return e.applyDelta(this.toDelta()),e}toDOM(e=document,n,r){const s=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(s,this),s}toString(){return this.toDelta().map(e=>{const n=[];for(const s in e.attributes){const o=[];for(const a in e.attributes[s])o.push({key:a,value:e.attributes[s][a]});o.sort((a,u)=>a.key<u.key?-1:1),n.push({nodeName:s,attrs:o})}n.sort((s,o)=>s.nodeName<o.nodeName?-1:1);let r="";for(let s=0;s<n.length;s++){const o=n[s];r+=`<${o.nodeName}`;for(let a=0;a<o.attrs.length;a++){const u=o.attrs[a];r+=` ${u.key}="${u.value}"`}r+=">"}r+=e.insert;for(let s=n.length-1;s>=0;s--)r+=`</${n[s].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(PF)}}const FF=t=>new Ci;class Za{constructor(e,n){this.id=e,this.length=n}get deleted(){throw Zt()}mergeWith(e){return!1}write(e,n,r){throw Zt()}integrate(e,n){throw Zt()}}const bF=0;class Gt extends Za{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){n>0&&(this.id.clock+=n,this.length-=n),Wd(e.doc.store,this)}write(e,n){e.writeInfo(bF),e.writeLen(this.length-n)}getMissing(e,n){return null}}class kr{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new kr(this.content)}splice(e){throw Zt()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}}const yF=t=>new kr(t.readBuf());class yr{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new yr(this.len)}splice(e){const n=new yr(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){gr(e.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(e){}gc(e){}write(e,n){e.writeLen(this.len-n)}getRef(){return 1}}const CF=t=>new yr(t.readLen()),ph=(t,e)=>new ts({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class Sr{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const n={};this.opts=n,e.gc||(n.gc=!1),e.autoLoad&&(n.autoLoad=!0),e.meta!==null&&(n.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new Sr(ph(this.doc.guid,this.opts))}splice(e){throw Zt()}mergeWith(e){return!1}integrate(e,n){this.doc._item=n,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,n){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}const EF=t=>new Sr(ph(t.readString(),t.readAny()));class ns{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new ns(this.embed)}splice(e){throw Zt()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}}const xF=t=>new ns(t.readJSON());class gt{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new gt(this.key,this.value)}splice(e){throw Zt()}mergeWith(e){return!1}integrate(e,n){const r=n.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,n){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const wF=t=>new gt(t.readKey(),t.readJSON());class Ei{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Ei(this.arr)}splice(e){const n=new Ei(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let s=n;s<r;s++){const o=this.arr[s];e.writeString(o===void 0?"undefined":JSON.stringify(o))}}getRef(){return 2}}const AF=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++){const s=t.readString();s==="undefined"?n.push(void 0):n.push(JSON.parse(s))}return new Ei(n)},vF=fi("node_env")==="development";class Zn{constructor(e){this.arr=e,vF&&ad(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Zn(this.arr)}splice(e){const n=new Zn(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let s=n;s<r;s++){const o=this.arr[s];e.writeAny(o)}}getRef(){return 8}}const kF=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new Zn(n)};class ln{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new ln(this.str)}splice(e){const n=new ln(this.str.slice(e));this.str=this.str.slice(0,e);const r=this.str.charCodeAt(e-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(e){return this.str+=e.str,!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}}const SF=t=>new ln(t.readString()),jF=[oF,uF,fF,mF,pF,gF,FF],BF=0,TF=1,NF=2,LF=3,OF=4,RF=5,PF=6;class mn{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new mn(this.type._copy())}splice(e){throw Zt()}mergeWith(e){return!1}integrate(e,n){this.type._integrate(e.doc,n)}delete(e){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(e.beforeState.get(n.id.client)||0)&&e._mergeStructs.push(n):n.delete(e),n=n.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(e.beforeState.get(r.id.client)||0)&&e._mergeStructs.push(r):r.delete(e)}),e.changed.delete(this.type)}gc(e){let n=this.type._start;for(;n!==null;)n.gc(e,!0),n=n.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,n){this.type._write(e)}getRef(){return 7}}const _F=t=>new mn(jF[t.readTypeRef()](t)),aa=(t,e)=>{let n=e,r=0,s;do r>0&&(n=ve(n.client,n.clock+r)),s=Ss(t,n),r=n.clock-s.id.clock,n=s.redone;while(n!==null&&s instanceof He);return{item:s,diff:r}},Qa=(t,e)=>{for(;t!==null&&t.keep!==e;)t.keep=e,t=t.parent._item},xi=(t,e,n)=>{const{client:r,clock:s}=e.id,o=new He(ve(r,s+n),e,ve(r,s+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));return e.deleted&&o.markDeleted(),e.keep&&(o.keep=!0),e.redone!==null&&(o.redone=ve(e.redone.client,e.redone.clock+n)),e.right=o,o.right!==null&&(o.right.left=o),t._mergeStructs.push(o),o.parentSub!==null&&o.right===null&&o.parent._map.set(o.parentSub,o),e.length=n,o},Lc=(t,e)=>Aa(t,n=>Ar(n.deletions,e)),mh=(t,e,n,r,s,o)=>{const a=t.doc,u=a.store,c=a.clientID,l=e.redone;if(l!==null)return Mt(t,l);let f=e.parent._item,d=null,p;if(f!==null&&f.deleted===!0){if(f.redone===null&&(!n.has(f)||mh(t,f,n,r,s,o)===null))return null;for(;f.redone!==null;)f=Mt(t,f.redone)}const D=f===null?e.parent:f.content.type;if(e.parentSub===null){for(d=e.left,p=e;d!==null;){let A=d;for(;A!==null&&A.parent._item!==f;)A=A.redone===null?null:Mt(t,A.redone);if(A!==null&&A.parent._item===f){d=A;break}d=d.left}for(;p!==null;){let A=p;for(;A!==null&&A.parent._item!==f;)A=A.redone===null?null:Mt(t,A.redone);if(A!==null&&A.parent._item===f){p=A;break}p=p.right}}else{if(p=null,e.right&&!s){for(d=e;d!==null&&d.right!==null&&(d.right.redone||Ar(r,d.right.id)||Lc(o.undoStack,d.right.id)||Lc(o.redoStack,d.right.id));)for(d=d.right;d.redone;)d=Mt(t,d.redone);if(d&&d.right!==null)return null}else d=D._map.get(e.parentSub)||null;d!==null&&d.parent._item!==f&&(d=D._map.get(e.parentSub)||null)}const g=ot(u,c),y=ve(c,g),x=new He(y,d,d&&d.lastId,p,p&&p.id,D,e.parentSub,e.content.copy());return e.redone=y,Qa(x,!0),x.integrate(t,0),x};class He extends Za{constructor(e,n,r,s,o,a,u,c){super(e,c.getLength()),this.origin=r,this.left=n,this.right=s,this.rightOrigin=o,this.parent=a,this.parentSub=u,this.redone=null,this.content=c,this.info=this.content.isCountable()?cc:0}set marker(e){(this.info&Do)>0!==e&&(this.info^=Do)}get marker(){return(this.info&Do)>0}get keep(){return(this.info&uc)>0}set keep(e){this.keep!==e&&(this.info^=uc)}get countable(){return(this.info&cc)>0}get deleted(){return(this.info&mo)>0}set deleted(e){this.deleted!==e&&(this.info^=mo)}markDeleted(){this.info|=mo}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=ot(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=ot(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===ks&&this.id.client!==this.parent.client&&this.parent.clock>=ot(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=wc(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Mt(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Gt||this.right&&this.right.constructor===Gt)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===He?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===He&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===ks){const r=Ss(n,this.parent);r.constructor===Gt?this.parent=null:this.parent=r.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=wc(e,e.doc.store,ve(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,s;if(r!==null)s=r.right;else if(this.parentSub!==null)for(s=this.parent._map.get(this.parentSub)||null;s!==null&&s.left!==null;)s=s.left;else s=this.parent._start;const o=new Set,a=new Set;for(;s!==null&&s!==this.right;){if(a.add(s),o.add(s),xs(this.origin,s.origin)){if(s.id.client<this.id.client)r=s,o.clear();else if(xs(this.rightOrigin,s.rightOrigin))break}else if(s.origin!==null&&a.has(Ss(e.doc.store,s.origin)))o.has(Ss(e.doc.store,s.origin))||(r=s,o.clear());else break;s=s.right}this.left=r}if(this.left!==null){const r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),Wd(e.doc.store,this),this.content.integrate(e,this),vc(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new Gt(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:ve(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&xs(e.origin,this.lastId)&&this.right===e&&xs(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const n=this.parent._searchMarker;return n&&n.forEach(r=>{r.p===e&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),gr(e.deleteSet,this.id.client,this.id.clock,this.length),vc(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw Vt();this.content.gc(e),n?$1(e,this,new Gt(this.id,this.length)):this.content=new yr(this.length)}write(e,n){const r=n>0?ve(this.id.client,this.id.clock+n-1):this.origin,s=this.rightOrigin,o=this.parentSub,a=this.content.getRef()&ki|(r===null?0:zt)|(s===null?0:xn)|(o===null?0:dr);if(e.writeInfo(a),r!==null&&e.writeLeftID(r),s!==null&&e.writeRightID(s),r===null&&s===null){const u=this.parent;if(u._item!==void 0){const c=u._item;if(c===null){const l=Kd(u);e.writeParentInfo(!0),e.writeString(l)}else e.writeParentInfo(!1),e.writeLeftID(c.id)}else u.constructor===String?(e.writeParentInfo(!0),e.writeString(u)):u.constructor===ks?(e.writeParentInfo(!1),e.writeLeftID(u)):Vt();o!==null&&e.writeString(o)}this.content.write(e,n)}}const Dh=(t,e)=>IF[e&ki](t),IF=[()=>{Vt()},CF,AF,yF,SF,xF,wF,_F,kF,EF,()=>{Vt()}],MF=10;class Yt extends Za{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){Vt()}write(e,n){e.writeInfo(MF),oe(e.restEncoder,this.length-n)}getMissing(e,n){return null}}const gh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},Fh="__ $YJS$ __";gh[Fh]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");gh[Fh]=!0;const bh=new Map;class $F{constructor(e){this.room=e,this.onmessage=null,this._onChange=n=>n.key===e&&this.onmessage!==null&&this.onmessage({data:yg(n.newValue||"")}),J0(this._onChange)}postMessage(e){id.setItem(this.room,bg(pg(e)))}close(){Z0(this._onChange)}}const UF=typeof BroadcastChannel>"u"?$F:BroadcastChannel,eu=t=>fn(bh,t,()=>{const e=In(),n=new UF(t);return n.onmessage=r=>e.forEach(s=>s(r.data,"broadcastchannel")),{bc:n,subs:e}}),zF=(t,e)=>(eu(t).subs.add(e),e),VF=(t,e)=>{const n=eu(t),r=n.subs.delete(e);return r&&n.subs.size===0&&(n.bc.close(),bh.delete(t)),r},bs=(t,e,n=null)=>{const r=eu(t);r.bc.postMessage(e),r.subs.forEach(s=>s(e,n))},yh=0,tu=1,Ch=2,wi=(t,e)=>{oe(t,yh);const n=O1(e);tt(t,n)},Eh=(t,e,n)=>{oe(t,tu),tt(t,qa(e,n))},HF=(t,e,n)=>Eh(e,n,Tt(t)),xh=(t,e,n,r)=>{try{zd(e,Tt(t),n)}catch(s){r?.(s),console.error("Caught error while handling a Yjs update",s)}},qF=(t,e)=>{oe(t,Ch),tt(t,e)},KF=xh,GF=(t,e,n,r,s)=>{const o=fe(t);switch(o){case yh:HF(t,e,n);break;case tu:xh(t,n,r,s);break;case Ch:KF(t,n,r,s);break;default:throw new Error("Unknown message type")}return o},YF=0,WF=(t,e,n)=>{fe(t)===YF&&n(e,Nt(t))},wo=3e4;class XF extends Zl{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const n=Mn();this.getLocalState()!==null&&wo/2<=n-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const r=[];this.meta.forEach((s,o)=>{o!==this.clientID&&wo<=n-s.lastUpdated&&this.states.has(o)&&r.push(o)}),r.length>0&&nu(this,r,"timeout")},en(wo/10)),e.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){const n=this.clientID,r=this.meta.get(n),s=r===void 0?0:r.clock+1,o=this.states.get(n);e===null?this.states.delete(n):this.states.set(n,e),this.meta.set(n,{clock:s,lastUpdated:Mn()});const a=[],u=[],c=[],l=[];e===null?l.push(n):o==null?e!=null&&a.push(n):(u.push(n),As(o,e)||c.push(n)),(a.length>0||c.length>0||l.length>0)&&this.emit("change",[{added:a,updated:c,removed:l},"local"]),this.emit("update",[{added:a,updated:u,removed:l},"local"])}setLocalStateField(e,n){const r=this.getLocalState();r!==null&&this.setLocalState({...r,[e]:n})}getStates(){return this.states}}const nu=(t,e,n)=>{const r=[];for(let s=0;s<e.length;s++){const o=e[s];if(t.states.has(o)){if(t.states.delete(o),o===t.clientID){const a=t.meta.get(o);t.meta.set(o,{clock:a.clock+1,lastUpdated:Mn()})}r.push(o)}}r.length>0&&(t.emit("change",[{added:[],updated:[],removed:r},n]),t.emit("update",[{added:[],updated:[],removed:r},n]))},Bs=(t,e,n=t.states)=>{const r=e.length,s=lt();oe(s,r);for(let o=0;o<r;o++){const a=e[o],u=n.get(a)||null,c=t.meta.get(a).clock;oe(s,a),oe(s,c),wn(s,JSON.stringify(u))}return Ve(s)},JF=(t,e,n)=>{const r=Un(e),s=Mn(),o=[],a=[],u=[],c=[],l=fe(r);for(let f=0;f<l;f++){const d=fe(r);let p=fe(r);const D=JSON.parse(Nt(r)),g=t.meta.get(d),y=t.states.get(d),x=g===void 0?0:g.clock;(x<p||x===p&&D===null&&t.states.has(d))&&(D===null?d===t.clientID&&t.getLocalState()!=null?p++:t.states.delete(d):t.states.set(d,D),t.meta.set(d,{clock:p,lastUpdated:s}),g===void 0&&D!==null?o.push(d):g!==void 0&&D===null?c.push(d):D!==null&&(As(D,y)||u.push(d),a.push(d)))}(o.length>0||u.length>0||c.length>0)&&t.emit("change",[{added:o,updated:u,removed:c},n]),(o.length>0||a.length>0||c.length>0)&&t.emit("update",[{added:o,updated:a,removed:c},n])},ZF=t=>sg(t,(e,n)=>`${encodeURIComponent(n)}=${encodeURIComponent(e)}`).join("&"),Gn=0,wh=3,Ts=1,QF=2,jr=[];jr[Gn]=(t,e,n,r,s)=>{oe(t,Gn);const o=GF(e,t,n.doc,n);r&&o===tu&&!n.synced&&(n.synced=!0)};jr[wh]=(t,e,n,r,s)=>{oe(t,Ts),tt(t,Bs(n.awareness,Array.from(n.awareness.getStates().keys())))};jr[Ts]=(t,e,n,r,s)=>{JF(n.awareness,Tt(e),n)};jr[QF]=(t,e,n,r,s)=>{WF(e,n.doc,(o,a)=>eb(n,a))};const Oc=3e4,eb=(t,e)=>console.warn(`Permission denied to access ${t.url}.
47
+ ${e}`),Ah=(t,e,n)=>{const r=Un(e),s=lt(),o=fe(r),a=t.messageHandlers[o];return a?a(s,r,t,n,o):console.error("Unable to compute message"),s},ua=(t,e,n)=>{e===t.ws&&(t.emit("connection-close",[n,t]),t.ws=null,e.close(),t.wsconnecting=!1,t.wsconnected?(t.wsconnected=!1,t.synced=!1,nu(t.awareness,Array.from(t.awareness.getStates().keys()).filter(r=>r!==t.doc.clientID),t),t.emit("status",[{status:"disconnected"}])):t.wsUnsuccessfulReconnects++,setTimeout(vh,ka(F0(2,t.wsUnsuccessfulReconnects)*100,t.maxBackoffTime),t))},vh=t=>{if(t.shouldConnect&&t.ws===null){const e=new t._WS(t.url,t.protocols);e.binaryType="arraybuffer",t.ws=e,t.wsconnecting=!0,t.wsconnected=!1,t.synced=!1,e.onmessage=n=>{t.wsLastMessageReceived=Mn();const r=Ah(t,new Uint8Array(n.data),!0);Sa(r)>1&&e.send(Ve(r))},e.onerror=n=>{t.emit("connection-error",[n,t])},e.onclose=n=>{ua(t,e,n)},e.onopen=()=>{t.wsLastMessageReceived=Mn(),t.wsconnecting=!1,t.wsconnected=!0,t.wsUnsuccessfulReconnects=0,t.emit("status",[{status:"connected"}]);const n=lt();if(oe(n,Gn),wi(n,t.doc),e.send(Ve(n)),t.awareness.getLocalState()!==null){const r=lt();oe(r,Ts),tt(r,Bs(t.awareness,[t.doc.clientID])),e.send(Ve(r))}},t.emit("status",[{status:"connecting"}])}},Ao=(t,e)=>{const n=t.ws;t.wsconnected&&n&&n.readyState===n.OPEN&&n.send(e),t.bcconnected&&bs(t.bcChannel,e,t)};class tb extends va{constructor(e,n,r,{connect:s=!0,awareness:o=new XF(r),params:a={},protocols:u=[],WebSocketPolyfill:c=WebSocket,resyncInterval:l=-1,maxBackoffTime:f=2500,disableBc:d=!1}={}){for(super();e[e.length-1]==="/";)e=e.slice(0,e.length-1);this.serverUrl=e,this.bcChannel=e+"/"+n,this.maxBackoffTime=f,this.params=a,this.protocols=u,this.roomname=n,this.doc=r,this._WS=c,this.awareness=o,this.wsconnected=!1,this.wsconnecting=!1,this.bcconnected=!1,this.disableBc=d,this.wsUnsuccessfulReconnects=0,this.messageHandlers=jr.slice(),this._synced=!1,this.ws=null,this.wsLastMessageReceived=0,this.shouldConnect=s,this._resyncInterval=0,l>0&&(this._resyncInterval=setInterval(()=>{if(this.ws&&this.ws.readyState===WebSocket.OPEN){const p=lt();oe(p,Gn),wi(p,r),this.ws.send(Ve(p))}},l)),this._bcSubscriber=(p,D)=>{if(D!==this){const g=Ah(this,new Uint8Array(p),!1);Sa(g)>1&&bs(this.bcChannel,Ve(g),this)}},this._updateHandler=(p,D)=>{if(D!==this){const g=lt();oe(g,Gn),qF(g,p),Ao(this,Ve(g))}},this.doc.on("update",this._updateHandler),this._awarenessUpdateHandler=({added:p,updated:D,removed:g},y)=>{const x=p.concat(D).concat(g),A=lt();oe(A,Ts),tt(A,Bs(o,x)),Ao(this,Ve(A))},this._exitHandler=()=>{nu(this.awareness,[r.clientID],"app closed")},$n&&typeof process<"u"&&process.on("exit",this._exitHandler),o.on("update",this._awarenessUpdateHandler),this._checkInterval=setInterval(()=>{this.wsconnected&&Oc<Mn()-this.wsLastMessageReceived&&ua(this,this.ws,null)},Oc/10),s&&this.connect()}get url(){const e=ZF(this.params);return this.serverUrl+"/"+this.roomname+(e.length===0?"":"?"+e)}get synced(){return this._synced}set synced(e){this._synced!==e&&(this._synced=e,this.emit("synced",[e]),this.emit("sync",[e]))}destroy(){this._resyncInterval!==0&&clearInterval(this._resyncInterval),clearInterval(this._checkInterval),this.disconnect(),$n&&typeof process<"u"&&process.off("exit",this._exitHandler),this.awareness.off("update",this._awarenessUpdateHandler),this.doc.off("update",this._updateHandler),super.destroy()}connectBc(){if(this.disableBc)return;this.bcconnected||(zF(this.bcChannel,this._bcSubscriber),this.bcconnected=!0);const e=lt();oe(e,Gn),wi(e,this.doc),bs(this.bcChannel,Ve(e),this);const n=lt();oe(n,Gn),Eh(n,this.doc),bs(this.bcChannel,Ve(n),this);const r=lt();oe(r,wh),bs(this.bcChannel,Ve(r),this);const s=lt();oe(s,Ts),tt(s,Bs(this.awareness,[this.doc.clientID])),bs(this.bcChannel,Ve(s),this)}disconnectBc(){const e=lt();oe(e,Ts),tt(e,Bs(this.awareness,[this.doc.clientID],new Map)),Ao(this,Ve(e)),this.bcconnected&&(VF(this.bcChannel,this._bcSubscriber),this.bcconnected=!1)}disconnect(){this.shouldConnect=!1,this.disconnectBc(),this.ws!==null&&ua(this,this.ws,null)}connect(){this.shouldConnect=!0,!this.wsconnected&&this.ws===null&&(vh(this),this.connectBc())}}const ss=t=>Is((e,n)=>{t.onerror=r=>n(new Error(r.target.error)),t.onsuccess=r=>e(r.target.result)}),nb=(t,e)=>Is((n,r)=>{const s=indexedDB.open(t);s.onupgradeneeded=o=>e(o.target.result),s.onerror=o=>r(tn(o.target.error)),s.onsuccess=o=>{const a=o.target.result;a.onversionchange=()=>{a.close()},n(a)}}),sb=t=>ss(indexedDB.deleteDatabase(t)),rb=(t,e)=>e.forEach(n=>t.createObjectStore.apply(t,n)),tr=(t,e,n="readwrite")=>{const r=t.transaction(e,n);return e.map(s=>hb(r,s))},kh=(t,e)=>ss(t.count(e)),ib=(t,e)=>ss(t.get(e)),Sh=(t,e)=>ss(t.delete(e)),ob=(t,e,n)=>ss(t.put(e,n)),ca=(t,e)=>ss(t.add(e)),ab=(t,e,n)=>ss(t.getAll(e,n)),ub=(t,e,n)=>{let r=null;return db(t,e,s=>(r=s,!1),n).then(()=>r)},cb=(t,e=null)=>ub(t,e,"prev"),lb=(t,e)=>Is((n,r)=>{t.onerror=r,t.onsuccess=async s=>{const o=s.target.result;if(o===null||await e(o)===!1)return n();o.continue()}}),db=(t,e,n,r="next")=>lb(t.openKeyCursor(e,r),s=>n(s.key)),hb=(t,e)=>t.objectStore(e),fb=(t,e)=>IDBKeyRange.upperBound(t,e),pb=(t,e)=>IDBKeyRange.lowerBound(t,e),vo="custom",jh="updates",Bh=500,Th=(t,e=()=>{},n=()=>{})=>{const[r]=tr(t.db,[jh]);return ab(r,pb(t._dbref,!1)).then(s=>{t._destroyed||(e(r),ze(t.doc,()=>{s.forEach(o=>zd(t.doc,o))},t,!1),n(r))}).then(()=>cb(r).then(s=>{t._dbref=s+1})).then(()=>kh(r).then(s=>{t._dbsize=s})).then(()=>r)},mb=(t,e=!0)=>Th(t).then(n=>{(e||t._dbsize>=Bh)&&ca(n,qa(t.doc)).then(()=>Sh(n,fb(t._dbref,!0))).then(()=>kh(n).then(r=>{t._dbsize=r}))});class Db extends Zl{constructor(e,n){super(),this.doc=n,this.name=e,this._dbref=0,this._dbsize=0,this._destroyed=!1,this.db=null,this.synced=!1,this._db=nb(e,r=>rb(r,[["updates",{autoIncrement:!0}],["custom"]])),this.whenSynced=Is(r=>this.on("synced",()=>r(this))),this._db.then(r=>{this.db=r,Th(this,a=>ca(a,qa(n)),()=>{if(this._destroyed)return this;this.synced=!0,this.emit("synced",[this])})}),this._storeTimeout=1e3,this._storeTimeoutId=null,this._storeUpdate=(r,s)=>{if(this.db&&s!==this){const[o]=tr(this.db,[jh]);ca(o,r),++this._dbsize>=Bh&&(this._storeTimeoutId!==null&&clearTimeout(this._storeTimeoutId),this._storeTimeoutId=setTimeout(()=>{mb(this,!1),this._storeTimeoutId=null},this._storeTimeout))}},n.on("update",this._storeUpdate),this.destroy=this.destroy.bind(this),n.on("destroy",this.destroy)}destroy(){return this._storeTimeoutId&&clearTimeout(this._storeTimeoutId),this.doc.off("update",this._storeUpdate),this.doc.off("destroy",this.destroy),this._destroyed=!0,this._db.then(e=>{e.close()})}clearData(){return this.destroy().then(()=>{sb(this.name)})}get(e){return this._db.then(n=>{const[r]=tr(n,[vo],"readonly");return ib(r,e)})}set(e,n){return this._db.then(r=>{const[s]=tr(r,[vo]);return ob(s,n,e)})}del(e){return this._db.then(n=>{const[r]=tr(n,[vo]);return Sh(r,e)})}}const Rc=[["#1677c8","#1677c833"],["#d65745","#d6574533"],["#16866a","#16866a33"],["#9a58b5","#9a58b533"],["#d27b18","#d27b1833"],["#3f7d20","#3f7d2033"],["#be3e7b","#be3e7b33"],["#4964c6","#4964c633"],["#8a6a14","#8a6a1433"],["#087f8c","#087f8c33"]],Pc=4,_c=5,gb=6,Fb=7,bb=8,yb=2;function Cb(t){if(!t||typeof t!="object")return null;const e=t,n=e.requestedBy;return typeof e.mainFile!="string"||typeof e.runId!="string"||!["queued","running","succeeded","failed","cleaned"].includes(e.status??"")||e.status==="cleaned"&&e.cleanMode!=="cache"&&e.cleanMode!=="artifacts"||e.stale!==void 0&&typeof e.stale!="boolean"||typeof e.updatedAt!="string"||!n||typeof n.id!="string"||typeof n.username!="string"||typeof n.name!="string"?null:e}function Ic(t){if(!t||typeof t!="object"||Array.isArray(t))return{};const e={};for(const[n,r]of Object.entries(t)){const s=Cb(r);s&&s.mainFile===n&&(e[n]=s)}return e}class Eb{constructor(e,n){this.projectId=e,this.user=n;const r=window.location.protocol==="https:"?"wss:":"ws:";this.persistence=new Db(`texlite:${n.id}:${e}`,this.doc),this.persistence.on("synced",()=>{this.localDraftReady=!0;for(const o of this.draftListeners)o()}),this.provider=new tb(`${r}//${window.location.host}/api/collaboration`,e,this.doc,{connect:!1,disableBc:!0,maxBackoffTime:2500}),this.awareness=this.provider.awareness;const s=this.doc.getMap("texlite:meta");this.metaObserver=(o,a)=>{a.origin===this.provider&&o.keysChanged.has("compileStates")&&(this.authoritativeCompileStates=null,this.notifyCompileStateListeners())},s.observe(this.metaObserver),this.provider.messageHandlers[Pc]=(o,a)=>{const u=Nt(a),c=this.flushRequests.get(u);if(!c)return;const l=fe(a)===1,f=fe(a),d=Nt(a),p=fe(a),D=[];for(let g=0;g<p;g++)D.push(Nt(a));if(window.clearTimeout(c.timer),this.flushRequests.delete(u),l)c.resolve({revision:f,persistedAt:d,ok:!0,failedPaths:[]});else{const g=Object.assign(new Error(D.length?`保存失败:${D.join(", ")}`:"源码保存到服务器磁盘失败"),{failedPaths:D});c.reject(g)}},this.provider.messageHandlers[_c]=(o,a)=>{const u=Nt(a),c=this.epochStorageKey(),l=xb(c);if(this.epoch&&this.epoch!==u||l&&l!==u){this.provider.disconnect(),this.rejectFlushes(new Error("Collaboration state changed"));const g=/^([0-9]+):/.exec(u)?.[1]??null,y=l?/^([0-9]+):/.exec(l)?.[1]??null:null,x=u.endsWith(":reload")||g!==null&&g!==y,A=()=>{Mc(c,u.replace(/:reload$/,"")),window.location.reload()};x?A():this.persistence.clearData().then(A);return}this.epoch=u,Mc(c,u);const f=this.provider.ws;if(!f||f.readyState!==WebSocket.OPEN)return;const d=lt();oe(d,_c),wn(d,u),oe(d,yb),f.send(Ve(d));const p=lt();oe(p,0),wi(p,this.doc),f.send(Ve(p));const D=lt();oe(D,1),tt(D,Bs(this.awareness,[this.doc.clientID])),f.send(Ve(D))},this.provider.messageHandlers[Fb]=(o,a)=>{const u=Nt(a),c=Nt(a);if(u!==this.user.id)return;if(c==="revoked"){this.rejectFlushes(new Error("Project access revoked")),this.provider.disconnect();for(const f of this.permissionListeners)f("revoked");return}if(c!=="read"&&c!=="edit"&&c!=="owner")return;const l=this.permission;this.setPermission(c,!0),l!==c&&c==="read"&&this.persistence.clearData().finally(()=>window.location.reload())},this.provider.messageHandlers[gb]=(o,a)=>{Nt(a)},this.provider.messageHandlers[bb]=(o,a)=>{let u={};try{u=Ic(JSON.parse(Nt(a)))}catch{}this.authoritativeCompileStates=u,this.notifyCompileStateListeners()},this.provider.on("status",({status:o})=>{o==="disconnected"&&(this.authoritativeCompileStates=null,this.notifyCompileStateListeners(),this.rejectFlushes(new Error("Collaboration connection closed")))}),this.updateLocalAwareness()}projectId;user;doc=new ts;provider;awareness;persistence;permission="read";activeFile="";epoch=null;destroyed=!1;localDraftReady=!1;draftListeners=new Set;permissionListeners=new Set;compileStateListeners=new Set;flushRequests=new Map;undoManagers=new Map;authoritativeCompileStates=null;metaObserver;connect(){this.destroyed||(this.provider.connect(),this.updateLocalAwareness())}getText(e){return this.doc.getText(`source:${e}`)}getUndoManager(e){const n=this.undoManagers.get(e);if(n)return n;const r=new q1(this.getText(e));return this.undoManagers.set(e,r),r}applyTextEdits(e,n){if(this.permission==="read")throw new Error("Read-only collaborators cannot edit source files");const r=this.getText(e);let s=0;for(const o of n){if(!Number.isInteger(o.from)||!Number.isInteger(o.to)||o.from<s||o.to<o.from||o.to>r.length)throw new RangeError("Invalid collaborative text edits");s=o.to}this.doc.transact(()=>{for(let o=n.length-1;o>=0;o-=1){const a=n[o];a.to>a.from&&r.delete(a.from,a.to-a.from),a.replacement&&r.insert(a.from,a.replacement)}})}get meta(){return this.doc.getMap("texlite:meta")}compileStates(){return this.authoritativeCompileStates??Ic(this.meta.get("compileStates"))}onCompileStates(e){return this.compileStateListeners.add(e),()=>this.compileStateListeners.delete(e)}get synced(){return this.provider.synced}get connected(){return this.provider.wsconnected}get draftReady(){return this.localDraftReady}get currentPermission(){return this.permission}onDraftReady(e){return this.draftListeners.add(e),this.localDraftReady&&e(),()=>this.draftListeners.delete(e)}onPermissionChanged(e){return this.permissionListeners.add(e),()=>this.permissionListeners.delete(e)}setPermission(e,n=!1){if(this.permission=e,e==="read"&&this.destroyUndoManagers(),this.updateLocalAwareness(),n)for(const r of this.permissionListeners)r(e)}setActiveFile(e){this.activeFile!==e&&(this.activeFile=e,this.awareness.setLocalStateField("cursor",null),this.updateLocalAwareness())}sessions(){const e=[];return this.awareness.getStates().forEach((n,r)=>{const s=n?.user;!s||typeof s.id!="string"||typeof s.name!="string"||e.push({clientId:r,userId:s.id,username:typeof s.username=="string"?s.username:s.name,name:s.name,color:typeof s.color=="string"?s.color:"#1677c8",colorLight:typeof s.colorLight=="string"?s.colorLight:"#1677c833",permission:s.permission==="owner"||s.permission==="edit"?s.permission:"read",filePath:typeof n.filePath=="string"?n.filePath:"",editing:!!n.cursor,local:r===this.doc.clientID})}),e.sort((n,r)=>Number(r.local)-Number(n.local)||n.name.localeCompare(r.name))}flush(){const e=this.provider.ws;if(!this.provider.synced||!e||e.readyState!==WebSocket.OPEN)return Promise.reject(new Error("Collaboration connection is unavailable"));const n=crypto.randomUUID(),r=lt();return oe(r,Pc),wn(r,n),new Promise((s,o)=>{const a=window.setTimeout(()=>{this.flushRequests.delete(n),o(new Error("Collaboration save timed out"))},5e3);this.flushRequests.set(n,{resolve:s,reject:o,timer:a}),e.send(Ve(r))})}reconnect(){this.destroyed||(this.rejectFlushes(new Error("Collaboration connection reset")),this.provider.disconnect(),this.provider.connect(),this.updateLocalAwareness())}destroy(){this.destroyed=!0,this.rejectFlushes(new Error("Collaboration connection closed")),this.provider.destroy(),this.persistence.destroy(),this.draftListeners.clear(),this.compileStateListeners.clear(),this.meta.unobserve(this.metaObserver),this.destroyUndoManagers(),this.doc.destroy()}destroyUndoManagers(){for(const e of this.undoManagers.values())e.destroy();this.undoManagers.clear()}notifyCompileStateListeners(){for(const e of this.compileStateListeners)e()}rejectFlushes(e){for(const n of this.flushRequests.values())window.clearTimeout(n.timer),n.reject(e);this.flushRequests.clear()}updateLocalAwareness(){const[e,n]=Rc[Math.abs(this.doc.clientID)%Rc.length];this.awareness.setLocalStateField("user",{id:this.user.id,username:this.user.username,name:this.user.displayName,color:e,colorLight:n,permission:this.permission,sessionId:String(this.doc.clientID)}),this.awareness.setLocalStateField("filePath",this.activeFile)}epochStorageKey(){return`texlite:collaboration-epoch:${this.user.id}:${this.projectId}`}}function xb(t){try{return window.localStorage.getItem(t)}catch{return null}}function Mc(t,e){try{window.localStorage.setItem(t,e)}catch{}}function wb(t,e){return Array.from(t.trim()||e.trim()||"?")[0]?.toLocaleUpperCase()??"?"}function Ab({sessions:t,status:e}){const{t:n}=at(),[r,s]=h.useState(!1),o=Math.max(0,t.length-5),a=r&&o>0,u=a?t:t.slice(0,5);return h.useEffect(()=>{t.length<=5&&s(!1)},[t.length]),t.length<=1?null:i.jsxs("div",{className:`collaboration-presence collaboration-${e}`,title:n(`editor.collaboration.${e}`),children:[i.jsx("span",{className:"collaboration-status-dot","aria-label":n(`editor.collaboration.${e}`)}),i.jsxs("div",{className:"collaboration-avatars","aria-label":n("editor.collaboration.activeSessions",{count:t.length}),children:[u.map(c=>{const l=c.editing?n("editor.collaboration.editing"):n("editor.collaboration.viewing"),f=c.permission==="read"?n("common.readOnly"):n("common.readWrite"),d=n("editor.collaboration.sessionTooltip",{name:c.name,username:c.username,file:c.filePath||n("editor.collaboration.joining"),activity:l,permission:f});return i.jsxs("span",{className:`collaboration-avatar${c.editing?" editing":""}${c.local?" local":""}`,style:{"--session-color":c.color},title:d,"aria-label":d,tabIndex:0,children:[wb(c.name,c.username),i.jsxs("span",{className:"collaboration-avatar-tooltip",role:"tooltip",children:[i.jsx("strong",{children:c.name}),i.jsxs("span",{children:["@",c.username]}),i.jsxs("small",{children:[c.filePath||n("editor.collaboration.joining")," · ",l," · ",f]})]})]},c.clientId)}),o>0&&i.jsx("button",{type:"button",className:"collaboration-avatar collaboration-avatar-overflow","aria-expanded":a,"aria-label":a?n("editor.collaboration.showFewerSessions"):n("editor.collaboration.showMoreSessions",{count:o}),title:a?n("editor.collaboration.showFewerSessions"):n("editor.collaboration.showMoreSessions",{count:o}),onClick:()=>s(c=>!c),children:a?"−":`+${o}`})]})]})}function vb({value:t,onChange:e}){const{t:n}=at(),[r,s]=h.useState(!1),o=h.useRef(null),a=[{value:"editor-pdf",icon:Ju},{value:"editor-only",icon:ND},{value:"pdf-only",icon:LD}];return h.useEffect(()=>{if(!r)return;const u=l=>{o.current?.contains(l.target)||s(!1)},c=l=>{l.key==="Escape"&&s(!1)};return document.addEventListener("pointerdown",u),document.addEventListener("keydown",c),()=>{document.removeEventListener("pointerdown",u),document.removeEventListener("keydown",c)}},[r]),i.jsxs("div",{className:"layout-menu",ref:o,children:[i.jsxs("button",{type:"button",className:`layout-trigger${r?" active":""}`,"aria-haspopup":"menu","aria-expanded":r,title:n("editor.layout.current",{layout:n(`editor.layout.${t}.name`)}),onClick:()=>s(u=>!u),children:[i.jsx(Ju,{size:15}),i.jsxs("span",{children:[i.jsx("small",{children:n("editor.layout.label")}),n(`editor.layout.${t}.name`)]}),i.jsx($l,{size:13})]}),r&&i.jsxs("div",{className:"layout-popover",role:"menu","aria-label":n("editor.layout.label"),children:[i.jsx("div",{className:"layout-popover-title",children:n("editor.layout.choose")}),a.map(u=>{const c=u.icon,l=u.value===t;return i.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":l,className:`layout-option${l?" selected":""}`,onClick:()=>{e(u.value),s(!1)},children:[i.jsx(c,{size:19}),i.jsxs("span",{children:[i.jsx("strong",{children:n(`editor.layout.${u.value}.name`)}),i.jsx("small",{children:n(`editor.layout.${u.value}.description`)})]}),l&&i.jsx(Wn,{size:16})]},u.value)})]})]})}function kb({comment:t,currentUserId:e,onFocus:n,onToggle:r,onReply:s,onEdit:o,onDelete:a,onEditReply:u,onDeleteReply:c}){const{t:l}=at(),[f,d]=h.useState(!1),[p,D]=h.useState(""),[g,y]=h.useState(!1),[x,A]=h.useState(t.content),[L,R]=h.useState(!1),[I,M]=h.useState(null),[X,O]=h.useState(""),[re,v]=h.useState(null),Z=async S=>{S.preventDefault(),p.trim()&&await s(p)&&(D(""),d(!1))},le=async S=>{S.preventDefault(),x.trim()&&await o(x)&&y(!1)},U=async S=>{S.preventDefault(),!(!I||!X.trim())&&await u(I,X)&&M(null)},H=t.authorUsername,P=S=>new Date(S).toLocaleString(Ie.resolvedLanguage);return i.jsxs(i.Fragment,{children:[i.jsxs("article",{className:`comment-thread${t.resolved?" resolved":""}${t.orphaned?" orphaned":""}`,onClick:()=>{window.getSelection()?.toString()||n()},children:[i.jsxs("header",{className:"comment-header",children:[i.jsxs("span",{className:"comment-author",children:[i.jsx("strong",{children:t.authorDisplayName??H??l("editor.deletedUser")}),H&&i.jsxs("small",{children:["@",H]})]}),i.jsxs("span",{className:"comment-times",children:[i.jsx("time",{dateTime:t.createdAt,title:new Date(t.createdAt).toISOString(),children:P(t.createdAt)}),t.editedAt&&i.jsx("small",{children:l("editor.editedAt",{time:P(t.editedAt)})})]})]}),i.jsx("div",{className:"comment-location",children:t.orphaned?l("editor.orphaned"):l("editor.line",{line:t.startLine})}),t.selectedText&&i.jsx("blockquote",{className:"comment-selected-text",children:t.selectedText}),g?i.jsxs("form",{className:"comment-reply-form comment-edit-form",onSubmit:S=>{le(S)},onClick:S=>S.stopPropagation(),children:[i.jsx("textarea",{autoFocus:!0,rows:4,value:x,onChange:S=>A(S.target.value)}),i.jsxs("div",{children:[i.jsx("button",{type:"button",onClick:()=>y(!1),children:l("common.cancel")}),i.jsxs("button",{className:"primary",type:"submit",disabled:!x.trim(),children:[i.jsx(ui,{size:13}),l("editor.saveChanges")]})]})]}):i.jsx("p",{className:"comment-content",children:t.content}),t.replies.length>0&&i.jsx("div",{className:"comment-replies",children:t.replies.map(S=>i.jsxs("div",{className:"comment-reply",children:[i.jsxs("header",{children:[i.jsxs("span",{className:"comment-author",children:[i.jsx("strong",{children:S.authorDisplayName??S.authorUsername??l("editor.deletedUser")}),S.authorUsername&&i.jsxs("small",{children:["@",S.authorUsername]})]}),i.jsxs("span",{className:"comment-times",children:[i.jsx("time",{dateTime:S.createdAt,title:new Date(S.createdAt).toISOString(),children:P(S.createdAt)}),S.editedAt&&i.jsx("small",{children:l("editor.editedAt",{time:P(S.editedAt)})})]})]}),I===S.id?i.jsxs("form",{className:"comment-reply-form comment-edit-form",onSubmit:ie=>{U(ie)},onClick:ie=>ie.stopPropagation(),children:[i.jsx("textarea",{autoFocus:!0,rows:3,value:X,onChange:ie=>O(ie.target.value)}),i.jsxs("div",{children:[i.jsx("button",{type:"button",onClick:()=>M(null),children:l("common.cancel")}),i.jsxs("button",{className:"primary",type:"submit",disabled:!X.trim(),children:[i.jsx(ui,{size:13}),l("editor.saveChanges")]})]})]}):i.jsx("p",{className:"comment-content",children:S.content}),S.authorId===e&&I!==S.id&&i.jsxs("div",{className:"comment-owner-actions",children:[i.jsx("button",{title:l("editor.editReply"),"aria-label":l("editor.editReply"),onClick:ie=>{ie.stopPropagation(),M(S.id),O(S.content)},children:i.jsx(Ko,{size:12})}),i.jsx("button",{className:"danger-text",title:l("editor.deleteReply"),"aria-label":l("editor.deleteReply"),onClick:ie=>{ie.stopPropagation(),v(S.id)},children:i.jsx(Qt,{size:12})})]})]},S.id))}),i.jsxs("div",{className:"comment-actions",children:[i.jsxs("button",{className:"resolve",onClick:S=>{S.stopPropagation(),r()},children:[t.resolved?i.jsx(ID,{size:13}):i.jsx(FD,{size:13}),t.resolved?l("editor.reopen"):l("editor.resolve")]}),i.jsxs("button",{className:"reply-action",onClick:S=>{S.stopPropagation(),d(ie=>!ie)},children:[i.jsx(_D,{size:13}),l("editor.reply")]}),t.authorId===e&&!g&&i.jsxs("span",{className:"comment-owner-actions",children:[i.jsx("button",{title:l("editor.editComment"),"aria-label":l("editor.editComment"),onClick:S=>{S.stopPropagation(),A(t.content),y(!0)},children:i.jsx(Ko,{size:13})}),i.jsx("button",{className:"danger-text",title:l("editor.deleteComment"),"aria-label":l("editor.deleteComment"),onClick:S=>{S.stopPropagation(),R(!0)},children:i.jsx(Qt,{size:13})})]})]}),f&&i.jsxs("form",{className:"comment-reply-form",onSubmit:S=>{Z(S)},onClick:S=>S.stopPropagation(),children:[i.jsx("textarea",{autoFocus:!0,rows:3,value:p,placeholder:l("editor.replyPlaceholder"),onChange:S=>D(S.target.value)}),i.jsxs("div",{children:[i.jsx("button",{type:"button",onClick:()=>{d(!1),D("")},children:l("common.cancel")}),i.jsxs("button",{className:"primary",type:"submit",disabled:!p.trim(),children:[i.jsx(MD,{size:13}),l("editor.sendReply")]})]})]})]}),i.jsx(Os,{open:L,title:l("editor.deleteCommentTitle"),description:l("editor.deleteCommentDescription",{count:t.replies.length}),confirmLabel:l("common.delete"),danger:!0,onCancel:()=>R(!1),onConfirm:()=>{a().then(S=>{S&&R(!1)})}}),i.jsx(Os,{open:!!re,title:l("editor.deleteReplyTitle"),description:l("editor.deleteReplyDescription"),confirmLabel:l("common.delete"),danger:!0,onCancel:()=>v(null),onConfirm:()=>{re&&c(re).then(S=>{S&&v(null)})}})]})}function Sb({open:t,onOpenChange:e,project:n,projectId:r}){const{t:s}=at(),[o,a]=h.useState([]),[u,c]=h.useState([]),[l,f]=h.useState(""),[d,p]=h.useState("read"),[D,g]=h.useState(null),[y,x]=h.useState(""),A=n.permission==="owner",L=async()=>{try{const[O,re]=await Promise.all([W(`/api/projects/${r}/members`),W("/api/users")]);a(O.members),c(re.users.filter(v=>v.id!==n.ownerId))}catch(O){x(te(O))}};h.useEffect(()=>{t&&L()},[t,r]);const R=async()=>{if(l)try{await W(`/api/projects/${r}/members/${l}`,{method:"PUT",body:JSON.stringify({permission:d})}),f(""),p("read"),await L()}catch(O){x(te(O))}},I=async(O,re)=>{try{await W(`/api/projects/${r}/members/${O.id}`,{method:"PUT",body:JSON.stringify({permission:re})}),await L()}catch(v){x(te(v))}},M=async()=>{if(D)try{await W(`/api/projects/${r}/members/${D.id}`,{method:"DELETE"}),g(null),await L()}catch(O){x(te(O))}},X=u.filter(O=>!o.some(re=>re.id===O.id));return i.jsxs(i.Fragment,{children:[i.jsx(it,{open:t,wide:!0,title:s("projectSettings.share"),description:s("projectSettings.shareDescription"),onOpenChange:e,footer:i.jsx("button",{onClick:()=>e(!1),children:s("common.close")}),children:i.jsxs("div",{className:"share-dialog",children:[y&&i.jsx("p",{className:"error",children:y}),i.jsxs("div",{className:"share-owner",children:[i.jsx(lr,{size:17}),i.jsxs("span",{children:[i.jsx("small",{children:s("projects.owner")}),i.jsx("strong",{children:n.ownerDisplayName??n.ownerUsername})]})]}),A&&i.jsxs("div",{className:"share-add",children:[i.jsxs("label",{className:"form-field",children:[s("common.user"),i.jsxs("select",{value:l,onChange:O=>f(O.target.value),children:[i.jsx("option",{value:"",children:s("projectSettings.chooseUser")}),X.map(O=>i.jsx("option",{value:O.id,children:O.displayName??O.username},O.id))]})]}),i.jsxs("label",{className:"form-field",children:[s("common.permission"),i.jsxs("select",{value:d,onChange:O=>p(O.target.value),children:[i.jsx("option",{value:"read",children:s("common.readOnly")}),i.jsx("option",{value:"edit",children:s("common.readWrite")})]})]}),i.jsxs("button",{className:"primary icon-button",disabled:!l,onClick:()=>{R()},children:[i.jsx(Xo,{size:15}),s("projectSettings.addMember")]})]}),i.jsxs("div",{className:"shared-members-heading",children:[i.jsx("strong",{children:s("projectSettings.members")}),i.jsx("span",{children:o.length})]}),i.jsxs("div",{className:"shared-members",children:[o.map(O=>i.jsxs("div",{className:"shared-member",children:[i.jsxs("span",{className:"member-identity",children:[i.jsx("span",{className:"member-avatar",children:(O.displayName??O.username).slice(0,1).toLocaleUpperCase()}),i.jsxs("span",{children:[i.jsx("strong",{children:O.displayName??O.username}),i.jsxs("small",{children:["@",O.username]})]})]}),i.jsxs("span",{className:"member-controls",children:[i.jsxs("select",{"aria-label":s("common.permission"),disabled:!A,value:O.permission,onChange:re=>{I(O,re.target.value)},children:[i.jsx("option",{value:"read",children:s("common.readOnly")}),i.jsx("option",{value:"edit",children:s("common.readWrite")})]}),A&&i.jsx("button",{className:"icon-only danger-text",title:s("common.remove"),"aria-label":s("common.remove"),onClick:()=>g(O),children:i.jsx(Qt,{size:15})})]})]},O.id)),o.length===0&&i.jsxs("div",{className:"share-empty",children:[i.jsx(lr,{size:24}),i.jsx("span",{children:s("projectSettings.noMembers")})]})]})]})}),i.jsx(Os,{open:!!D,title:s("projectSettings.removeTitle"),description:s("projectSettings.removeDescription",{username:D?.username??""}),confirmLabel:s("common.remove"),danger:!0,onCancel:()=>g(null),onConfirm:()=>{M()}})]})}function jb({project:t,projectId:e,site:n,files:r,dictionaryWords:s,onDictionaryChange:o,editorPreferences:a,onEditorPreferences:u,spellCheckCount:c,spellCheckUniqueCount:l,spellCheckIndex:f,onSpellCheckNavigate:d,onProject:p}){const{t:D}=at(),[g,y]=h.useState(t.engine),[x,A]=h.useState(""),[L,R]=h.useState(t.name),[I,M]=h.useState(t.mainFile),[X,O]=h.useState(""),[re,v]=h.useState(""),[Z,le]=h.useState(""),[U,H]=h.useState("appearance"),[P,S]=h.useState(a),ie=t.permission==="owner",je=t.permission!=="read",Be=t.permission!=="read";h.useEffect(()=>S(a),[a]),h.useEffect(()=>{if(!t.latexmkrc)return A("");W(`/api/projects/${e}/file?path=${encodeURIComponent(t.latexmkrc)}`).then(({content:B})=>A(B)).catch(B=>O(te(B)))},[t.latexmkrc]);const Me=r.filter(B=>B.type==="file"&&/\.tex$/i.test(B.path)).map(B=>B.path),Ne=[...new Set(t.mainFile&&t.mainFile.toLowerCase().endsWith(".tex")?[...Me,t.mainFile]:Me)].sort((B,Se)=>B.localeCompare(Se)),be=async()=>{try{const B=x.trim()&&n.allowProjectLatexmkrc!==!1?".latexmkrc":null;B&&await W(`/api/projects/${e}/file`,{method:"PUT",body:JSON.stringify({path:B,content:x})});const Se=await W(`/api/projects/${e}`,{method:"PATCH",body:JSON.stringify({name:L,mainFile:I,engine:g,latexmkrc:B})});p(Se.project)}catch(B){O(te(B))}},K=()=>u(P),Pe=async()=>{const B=re.trim();if(B)try{const Se=await W(`/api/projects/${e}/dictionary`,{method:"POST",body:JSON.stringify({word:B})});o(Se.words),v(""),le("")}catch(Se){le(te(Se))}},se=async B=>{try{const Se=await W(`/api/projects/${e}/dictionary/${encodeURIComponent(B)}`,{method:"DELETE"});o(Se.words),le("")}catch(Se){le(te(Se))}};return i.jsxs("div",{className:"settings padded",children:[X&&i.jsx("p",{className:"error",children:X}),i.jsxs("div",{className:"settings-tabs",role:"tablist","aria-label":D("common.settings"),children:[i.jsxs("button",{id:"settings-tab-appearance",type:"button",role:"tab","aria-selected":U==="appearance","aria-controls":"settings-panel-appearance",className:`settings-tab${U==="appearance"?" active":""}`,onClick:()=>H("appearance"),children:[i.jsx(tc,{size:15}),D("projectSettings.editorTab")]}),i.jsxs("button",{id:"settings-tab-compiler",type:"button",role:"tab","aria-selected":U==="compiler","aria-controls":"settings-panel-compiler",className:`settings-tab${U==="compiler"?" active":""}`,onClick:()=>H("compiler"),children:[i.jsx(Yo,{size:15}),D("projectSettings.compilerTab")]})]}),U==="appearance"?i.jsxs("section",{id:"settings-panel-appearance",role:"tabpanel","aria-labelledby":"settings-tab-appearance",children:[i.jsxs("div",{className:"settings-section-title",children:[i.jsx(tc,{size:15}),i.jsx("strong",{children:D("projectSettings.editorAppearance")})]}),i.jsx("p",{className:"settings-description appearance-description",children:D("projectSettings.editorAppearanceDescription")}),i.jsxs("label",{children:[D("projectSettings.fontFamily"),i.jsx("select",{value:P.font,onChange:B=>S({...P,font:B.target.value}),children:li.map(B=>i.jsx("option",{value:B.id,children:D(B.labelKey)},B.id))})]}),i.jsxs("label",{children:[D("projectSettings.fontSize"),i.jsx("select",{value:P.fontSize,onChange:B=>S({...P,fontSize:Number(B.target.value)}),children:[12,13,14,15,16,18,20].map(B=>i.jsxs("option",{value:B,children:[B," px"]},B))})]}),i.jsxs("label",{children:[D("projectSettings.lineHeight"),i.jsxs("select",{value:P.lineHeight,onChange:B=>S({...P,lineHeight:Number(B.target.value)}),children:[i.jsx("option",{value:1.45,children:D("projectSettings.lineHeightCompact")}),i.jsx("option",{value:1.65,children:D("projectSettings.lineHeightNormal")}),i.jsx("option",{value:1.85,children:D("projectSettings.lineHeightRelaxed")})]})]}),i.jsxs("label",{className:"editor-checkbox",children:[i.jsx("input",{type:"checkbox",checked:P.lineWrapping,onChange:B=>S({...P,lineWrapping:B.target.checked})}),i.jsx(KD,{size:15}),i.jsx("span",{children:D("projectSettings.lineWrapping")})]}),i.jsxs("div",{className:"editor-preference",children:[i.jsxs("label",{className:"editor-checkbox",children:[i.jsx("input",{type:"checkbox",checked:P.spellCheck,onChange:B=>S({...P,spellCheck:B.target.checked})}),i.jsx("span",{children:D("projectSettings.spellCheck")})]}),i.jsxs("p",{className:"field-hint",children:[D("projectSettings.writingCheckDescription")," ",i.jsx("a",{href:"https://writewithharper.com/docs/harperjs/introduction",target:"_blank",rel:"noreferrer",children:"Harper.js"})]})]}),i.jsxs("div",{className:"editor-preference",children:[i.jsxs("label",{className:"editor-checkbox",children:[i.jsx("input",{type:"checkbox",checked:P.vimMode,onChange:B=>S({...P,vimMode:B.target.checked})}),i.jsx("span",{children:D("projectSettings.vimMode")})]}),i.jsxs("p",{className:"field-hint",children:[D("projectSettings.vimModeDescription")," ",i.jsx("a",{href:"https://replit-codemirror-vim.mintlify.app/",target:"_blank",rel:"noreferrer",children:D("projectSettings.vimHelp")})]})]}),i.jsxs("div",{className:"editor-preference",children:[i.jsxs("label",{className:"editor-checkbox",children:[i.jsx("input",{type:"checkbox",checked:P.openFilesInTabs,onChange:B=>S({...P,openFilesInTabs:B.target.checked})}),i.jsx(OD,{size:15}),i.jsx("span",{children:D("projectSettings.openFilesInTabs")})]}),i.jsx("p",{className:"field-hint",children:D("projectSettings.openFilesInTabsDescription")})]}),i.jsxs("div",{className:"editor-preference",children:[i.jsxs("label",{className:"editor-checkbox",children:[i.jsx("input",{type:"checkbox",disabled:!je,checked:P.formatOnCompile,onChange:B=>S({...P,formatOnCompile:B.target.checked})}),i.jsx(Ml,{size:15}),i.jsx("span",{children:D("projectSettings.formatOnCompile")})]}),i.jsxs("p",{className:"field-hint",children:[D(je?"projectSettings.formatOnCompileDescription":"projectSettings.formatRequiresWrite")," ",D("projectSettings.formatterDescription")," ",i.jsx("a",{href:"https://www.npmjs.com/package/tex-fmt",target:"_blank",rel:"noreferrer",children:D("projectSettings.formatterInstall")})," · ",i.jsx("a",{href:"https://github.com/FlamingTempura/bibtex-tidy",target:"_blank",rel:"noreferrer",children:D("projectSettings.bibtexTidyInstall")})]})]}),i.jsxs("div",{className:"editor-preference",children:[i.jsxs("label",{children:[D("projectSettings.texFmtOptions"),i.jsx("textarea",{className:"tex-fmt-options-editor",rows:6,maxLength:16*1024,spellCheck:!1,value:P.texFmtConfig,placeholder:D("projectSettings.texFmtOptionsPlaceholder"),onChange:B=>S({...P,texFmtConfig:B.target.value})})]}),i.jsx("p",{className:"field-hint",children:D("projectSettings.texFmtOptionsDescription")})]}),c!==null&&i.jsxs("div",{className:`spell-check-result${c?" has-issues":""}`,role:"status","aria-live":"polite",children:[i.jsx(VD,{size:14}),i.jsx("span",{children:c?D("projectSettings.writingIssues",{count:c,uniqueCount:l??0}):D("projectSettings.noWritingIssues")}),c>0&&i.jsxs("span",{className:"spell-check-controls",children:[i.jsx("button",{type:"button",title:D("projectSettings.spellCheckFirst"),"aria-label":D("projectSettings.spellCheckFirst"),disabled:f<=0,onClick:()=>d(0),children:i.jsx(DD,{size:14})}),i.jsx("button",{type:"button",title:D("projectSettings.spellCheckPrevious"),"aria-label":D("projectSettings.spellCheckPrevious"),disabled:f<=0,onClick:()=>d(f-1),children:i.jsx(ir,{size:14})}),i.jsx("span",{className:"spell-check-position",children:D("projectSettings.spellCheckPosition",{current:Math.min(f+1,c),total:c})}),i.jsx("button",{type:"button",title:D("projectSettings.spellCheckNext"),"aria-label":D("projectSettings.spellCheckNext"),disabled:f>=c-1,onClick:()=>d(f+1),children:i.jsx(vi,{size:14})}),i.jsx("button",{type:"button",title:D("projectSettings.spellCheckLast"),"aria-label":D("projectSettings.spellCheckLast"),disabled:f>=c-1,onClick:()=>d(c-1),children:i.jsx(gD,{size:14})})]})]}),i.jsxs("div",{className:"settings-section-title",children:[i.jsx(zo,{size:15}),i.jsx("strong",{children:D("projectSettings.dictionary")})]}),i.jsx("p",{className:"settings-description",children:D("projectSettings.dictionaryDescription")}),Z&&i.jsx("p",{className:"error dictionary-error",children:Z}),Be&&i.jsxs("div",{className:"dictionary-add",children:[i.jsx("input",{value:re,placeholder:D("projectSettings.dictionaryPlaceholder"),onChange:B=>v(B.target.value),onKeyDown:B=>{B.key==="Enter"&&(B.preventDefault(),Pe())}}),i.jsx("button",{type:"button",disabled:!re.trim(),onClick:()=>{Pe()},children:D("projectSettings.addWord")})]}),i.jsxs("div",{className:"dictionary-words",children:[s.map(B=>i.jsxs("span",{className:"dictionary-word",children:[i.jsx("code",{children:B}),Be&&i.jsx("button",{type:"button",title:D("common.delete"),"aria-label":`${D("common.delete")} ${B}`,onClick:()=>{se(B)},children:i.jsx(Jt,{size:13})})]},B)),s.length===0&&i.jsx("span",{className:"dictionary-empty",children:D("projectSettings.dictionaryEmpty")})]}),i.jsx("div",{className:"settings-actions",children:i.jsxs("button",{className:"settings-save",onClick:K,children:[i.jsx(ui,{size:15}),D("projectSettings.saveAppearance")]})})]}):i.jsxs("section",{id:"settings-panel-compiler",role:"tabpanel","aria-labelledby":"settings-tab-compiler",children:[i.jsxs("div",{className:"settings-section-title",children:[i.jsx(Yo,{size:15}),i.jsx("strong",{children:D("projectSettings.compilerTab")})]}),i.jsx("p",{className:"settings-description compiler-description",children:D("projectSettings.compilerDescription")}),i.jsxs("label",{children:[D("projects.name"),i.jsx("input",{disabled:!ie,value:L,onChange:B=>R(B.target.value)})]}),i.jsxs("label",{children:[D("projectSettings.mainFile"),i.jsx("select",{disabled:!ie||Ne.length===0,value:I,onChange:B=>M(B.target.value),children:Ne.map(B=>i.jsx("option",{value:B,children:B},B))})]}),i.jsxs("label",{children:[D("projectSettings.engine"),i.jsx("select",{disabled:!ie,value:g,onChange:B=>y(B.target.value),children:(n.allowedEngines??["pdflatex","xelatex","lualatex"]).map(B=>i.jsx("option",{children:B},B))})]}),i.jsxs("label",{children:[D("projectSettings.latexmkrc"),i.jsx("textarea",{className:"latexmkrc-editor",rows:10,spellCheck:!1,disabled:!ie||n.allowProjectLatexmkrc===!1,value:x,placeholder:D("projectSettings.latexmkrcPlaceholder"),onChange:B=>A(B.target.value)})]}),i.jsx("div",{className:"settings-actions",children:ie&&i.jsxs("button",{className:"settings-save",onClick:()=>{be()},children:[i.jsx(ui,{size:15}),D("projectSettings.saveCompiler")]})})]})]})}function $c({diagnostics:t,files:e,empty:n,tone:r,onJump:s}){const{t:o}=at(),a=r==="error"?Ea:Rs;return t.length?i.jsx("div",{className:`compile-diagnostic-list compile-${r}`,children:t.map((u,c)=>{const l=Nb(u.file,e),f=!!(l&&u.line);return i.jsxs("button",{type:"button",disabled:!f,className:"compile-diagnostic-row",onClick:()=>{l&&u.line&&s(l,u.line,u.column??1)},children:[i.jsx(a,{size:15}),i.jsxs("span",{children:[i.jsx("strong",{children:u.message}),i.jsxs("small",{children:[u.phase,l?` · ${l}${u.line?`:${u.line}`:""}`:u.line?` · ${o("editor.lineNumber",{line:u.line})}`:""]})]})]},`${u.phase}-${u.file??""}-${u.line??0}-${c}`)})}):i.jsxs("div",{className:`compile-empty compile-${r}`,children:[i.jsx(a,{size:26}),i.jsx("span",{children:n})]})}function ko({lines:t,empty:e,tone:n="log"}){const r=n==="error"?Ea:n==="warning"?Rs:Go;return t.length?i.jsx("pre",{className:`compile-output compile-${n}`,children:t.join(`
48
+ `)}):i.jsxs("div",{className:`compile-empty compile-${n}`,children:[i.jsx(r,{size:26}),i.jsx("span",{children:e})]})}function Bb({projectId:t,mainFile:e,artifacts:n,preview:r,loading:s,onView:o}){const{t:a}=at(),u=c=>`/api/projects/${t}/compile/artifacts?mainFile=${encodeURIComponent(e)}&path=${encodeURIComponent(c)}&download=1`;return n.length?i.jsxs("div",{className:"artifact-browser",children:[i.jsx("div",{className:"artifact-list",children:n.map(c=>i.jsxs("div",{className:`artifact-row${r?.path===c.path?" active":""}`,children:[i.jsxs("button",{type:"button",disabled:!c.viewable,title:c.viewable?a("editor.viewArtifact"):a("editor.downloadToView"),onClick:()=>o(c),children:[i.jsx(Es,{size:14}),i.jsxs("span",{children:[i.jsx("strong",{children:c.path}),i.jsx("small",{children:Lb(c.size)})]})]}),i.jsx("a",{href:u(c.path),title:a("editor.downloadArtifact"),"aria-label":a("editor.downloadArtifact"),children:i.jsx(cr,{size:14})})]},c.path))}),i.jsx("div",{className:"artifact-preview",children:s?i.jsxs("div",{className:"compile-empty",children:[i.jsx(Lt,{className:"spin",size:24}),i.jsx("span",{children:a("common.loading")})]}):r?i.jsxs(i.Fragment,{children:[i.jsxs("header",{children:[i.jsx("strong",{children:r.path}),i.jsxs("a",{href:u(r.path),children:[i.jsx(cr,{size:13}),a("projects.download")]})]}),i.jsx("pre",{children:r.content})]}):i.jsxs("div",{className:"compile-empty",children:[i.jsx(Es,{size:24}),i.jsx("span",{children:a("editor.selectArtifact")})]})})]}):i.jsxs("div",{className:"compile-empty",children:[i.jsx(Vl,{size:26}),i.jsx("span",{children:a("editor.noArtifacts")})]})}function Tb({mainFile:t,disabled:e,cleaning:n,onCleanCache:r,onCleanArtifacts:s}){const{t:o}=at();return i.jsxs("div",{className:"compile-clean-panel",children:[i.jsxs("div",{className:"compile-clean-intro",children:[i.jsx(Rs,{size:28}),i.jsxs("div",{children:[i.jsx("strong",{children:o("editor.cleanTitle")}),i.jsx("p",{children:o("editor.cleanDescription",{file:t})})]})]}),i.jsxs("div",{className:"compile-clean-actions",children:[i.jsxs("article",{children:[i.jsx("div",{className:"compile-clean-action-icon",children:i.jsx(Vo,{size:19})}),i.jsxs("div",{children:[i.jsx("strong",{children:o("editor.cleanCache")}),i.jsx("p",{children:o("editor.cleanCacheDescription")}),i.jsxs("button",{type:"button",disabled:e||n,onClick:r,children:[n?i.jsx(Lt,{className:"spin",size:14}):i.jsx(Vo,{size:14}),o("editor.cleanCache")]})]})]}),i.jsxs("article",{className:"danger",children:[i.jsx("div",{className:"compile-clean-action-icon",children:i.jsx(Qt,{size:19})}),i.jsxs("div",{children:[i.jsx("strong",{children:o("editor.cleanArtifacts")}),i.jsx("p",{children:o("editor.cleanArtifactsDescription")}),i.jsxs("button",{type:"button",className:"danger",disabled:e||n,onClick:s,children:[n?i.jsx(Lt,{className:"spin",size:14}):i.jsx(Qt,{size:14}),o("editor.cleanArtifacts")]})]})]})]})]})}function Nb(t,e){if(!t)return null;const n=e.filter(u=>u.type==="file").map(u=>u.path),r=t.replaceAll("\\","/").replace(/^\.\//,"");if(n.includes(r))return r;const s=n.filter(u=>r.endsWith(`/${u}`));if(s.length===1)return s[0];const o=r.split("/").at(-1),a=n.filter(u=>u.split("/").at(-1)===o);return a.length===1?a[0]:null}function Lb(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/1024/1024).toFixed(1)} MB`}function Ob(t){return t instanceof Error&&t.name==="AbortError"}function Rb({projectId:t,activeFile:e,permission:n,revision:r,selection:s,save:o,onError:a,onAdded:u}){const[c,l]=h.useState([]),[f,d]=h.useState(null),[p,D]=h.useState(!1),[g,y]=h.useState(""),x=h.useRef(null),A=h.useRef(e),L=h.useRef(o),R=h.useRef(a),I=h.useRef(u);A.current=e,L.current=o,R.current=a,I.current=u;const M=async H=>{x.current?.abort();const P=new AbortController;x.current=P;try{const S=await W(`/api/projects/${t}/comments?path=${encodeURIComponent(H)}`,{signal:P.signal});A.current===H&&l(S.comments)}catch(S){!Ob(S)&&A.current===H&&l([])}finally{x.current===P&&(x.current=null)}};return h.useEffect(()=>{d(null)},[t,e]),h.useEffect(()=>(e?M(e):l([]),()=>{x.current?.abort(),x.current=null}),[t,e,r]),{comments:c,focusComment:f,setFocusComment:d,commentOpen:p,setCommentOpen:D,commentText:g,setCommentText:y,addComment:async()=>{if(!(!g.trim()||!e))try{if(n!=="read"&&!await L.current())return;await W(`/api/projects/${t}/comments`,{method:"POST",body:JSON.stringify({path:e,content:g,...s})}),await M(e),D(!1),y(""),I.current()}catch(H){R.current(te(H))}},toggleComment:async H=>{try{await W(`/api/projects/${t}/comments/${H.id}`,{method:"PATCH",body:JSON.stringify({resolved:!H.resolved})}),await M(e)}catch(P){R.current(te(P))}},replyToComment:async(H,P)=>{try{return await W(`/api/projects/${t}/comments/${H.id}/replies`,{method:"POST",body:JSON.stringify({content:P})}),await M(e),!0}catch(S){return R.current(te(S)),!1}},editComment:async(H,P)=>{try{return await W(`/api/projects/${t}/comments/${H.id}`,{method:"PATCH",body:JSON.stringify({content:P})}),await M(e),!0}catch(S){return R.current(te(S)),!1}},deleteComment:async H=>{try{return await W(`/api/projects/${t}/comments/${H.id}`,{method:"DELETE"}),await M(e),d(P=>P?.id===H.id?null:P),!0}catch(P){return R.current(te(P)),!1}},editCommentReply:async(H,P,S)=>{try{return await W(`/api/projects/${t}/comments/${H.id}/replies/${P}`,{method:"PATCH",body:JSON.stringify({content:S})}),await M(e),!0}catch(ie){return R.current(te(ie)),!1}},deleteCommentReply:async(H,P)=>{try{return await W(`/api/projects/${t}/comments/${H.id}/replies/${P}`,{method:"DELETE"}),await M(e),!0}catch(S){return R.current(te(S)),!1}}}}function Pb(t){if(!t||typeof t!="object")return!1;const e=t;return(e.kind==="update"||e.kind==="move"||e.kind==="delete")&&typeof e.revision=="string"}function _b(t,e,n,r,s,o){const[a]=h.useState(()=>new Eb(t,e)),[u,c]=h.useState("connecting"),[l,f]=h.useState(!1),[d,p]=h.useState([]),[D,g]=h.useState(null),[y,x]=h.useState(null),[A,L]=h.useState(""),[R,I]=h.useState(""),[M,X]=h.useState(!1),[O,re]=h.useState(r),v=h.useRef(n),Z=h.useRef(o);return v.current=n,Z.current=o,h.useEffect(()=>{const U=a.compileStates();g(U[n]??null)},[n,a]),h.useEffect(()=>{const U=()=>p(a.sessions()),H=()=>{f(!1),p([]),g(null),x(null),L(""),I(""),Z.current()},P=({status:K})=>{c(K),K!=="connected"&&H()},S=K=>{f(K),K||H()},ie=()=>{c("disconnected"),H()},je=()=>{const K=a.meta.get("filesEvent");Pb(K)&&x(K);const Pe=a.meta.get("commentsRevision");typeof Pe=="string"&&L(Pe);const se=a.meta.get("dictionaryRevision");typeof se=="string"&&I(se);const B=a.compileStates();g(B[v.current]??null)},Be=()=>{const K=a.compileStates();g(K[v.current]??null)};a.awareness.on("change",U),a.provider.on("status",P),a.provider.on("sync",S),a.provider.on("connection-close",ie),a.provider.on("connection-error",ie),a.meta.observe(je);const Me=a.onCompileStates(Be),Ne=a.onDraftReady(()=>X(!0)),be=a.onPermissionChanged(K=>{if(K==="revoked"){c("disconnected"),f(!1),Z.current();return}re(K)});return U(),je(),c(a.connected?"connected":"connecting"),f(a.synced),()=>{a.awareness.off("change",U),a.provider.off("status",P),a.provider.off("sync",S),a.provider.off("connection-close",ie),a.provider.off("connection-error",ie),a.meta.unobserve(je),Me(),Ne(),be(),a.destroy()}},[a]),h.useEffect(()=>{s&&a.connect()},[a,s]),h.useEffect(()=>{a.setPermission(r),re(r)},[a,r]),{collaboration:a,status:u,synced:l,activeSessions:d,compileState:D,setCompileState:g,filesEvent:y,commentsRevision:A,dictionaryRevision:R,localDraftReady:M,permission:O,reconnect:()=>{c("connecting"),f(!1),p([]),g(null),a.reconnect()}}}function Ds(t){return t instanceof Error&&t.name==="AbortError"}function Ib({projectId:t,project:e,mainFile:n,collaborationSynced:r,sharedState:s,onSharedState:o,save:a,loadOutline:u,onPreviewTab:c,onError:l,onCompileStart:f,onCompileSuccess:d,onPdfChanged:p}){const{t:D}=at(),[g,y]=h.useState(""),[x,A]=h.useState(!0),[L,R]=h.useState(null),[I,M]=h.useState(""),[X,O]=h.useState(null),[re,v]=h.useState(null),[Z,le]=h.useState([]),[U,H]=h.useState(null),[P,S]=h.useState(!1),[ie,je]=h.useState(!1),[Be,Me]=h.useState(()=>new Set),[Ne,be]=h.useState(""),K=h.useRef(n),Pe=h.useRef(""),se=h.useRef(null),B=h.useRef(null),Se=h.useRef(null),Ue=h.useRef(new Set),ye=h.useRef(new Map),qe=h.useRef(null),Le=h.useRef(()=>{}),ce=h.useRef({onSharedState:o,save:a,loadOutline:u,onPreviewTab:c,onError:l,onCompileStart:f,onCompileSuccess:d,onPdfChanged:p});K.current=n,ce.current={onSharedState:o,save:a,loadOutline:u,onPreviewTab:c,onError:l,onCompileStart:f,onCompileSuccess:d,onPdfChanged:p};const nt=J=>{qe.current!==J&&(qe.current=J,ce.current.onCompileSuccess())},ht=async(J,De)=>{De||(B.current?.abort(),B.current=new AbortController,De=B.current.signal);try{const G=J?`?mainFile=${encodeURIComponent(J)}`:"",st=await W(`/api/projects/${t}/compile/artifacts${G}`,{signal:De});K.current===J&&(le(st.artifacts),H(null))}catch(G){!Ds(G)&&K.current===J&&(le([]),H(null))}finally{B.current?.signal===De&&(B.current=null)}};h.useEffect(()=>{if(se.current?.abort(),!n){A(!1),y(""),R(null),M(""),O(null),v(null),le([]),H(null),ce.current.onPdfChanged();return}const J=new AbortController;se.current=J,A(!0),M(""),O(null),v(null),g&&n&&Pe.current===n||(y(""),R(null)),le([]),H(null),ce.current.onPdfChanged();let G=null;const st=`?mainFile=${encodeURIComponent(n)}`,ft=W(`/api/projects/${t}/compile/latest${st}`,{signal:J.signal});let Q=!1;const Ce=()=>{if(Q||J.signal.aborted||!n)return;Q=!0;const ee=new AbortController;Ue.current.add(ee),ht(n,ee.signal).finally(()=>{Ue.current.delete(ee)}),ce.current.loadOutline(J.signal,n).catch(()=>{})};return ft.then(ee=>{J.signal.aborted||n&&ee.mainFile!==K.current||(M(ee.latestRun?.log??""),O(ee.latestRun?.diagnostics??null),v(ee.latestRun?.status==="succeeded"||ee.latestRun?.status==="failed"?ee.latestRun.status:null),n&&ee.latestRun?.requestedBy&&(ee.latestRun.status==="queued"||ee.latestRun.status==="running")&&ce.current.onSharedState({mainFile:n,runId:ee.latestRun.id,status:ee.latestRun.status,requestedBy:ee.latestRun.requestedBy,updatedAt:new Date().toISOString()}),ee.pdfUrl&&(Pe.current=ee.mainFile,y(ee.pdfUrl),R(ee.pdfCompiledAt),ce.current.onPreviewTab("pdf")))}).catch(ee=>{!Ds(ee)&&K.current===n&&ce.current.onError(te(ee))}).finally(()=>{se.current===J&&(se.current=null),J.signal.aborted||(A(!1),G=window.setTimeout(Ce,0))}),()=>{G!==null&&window.clearTimeout(G),J.abort(),Se.current?.abort();for(const ee of Ue.current)ee.abort();Ue.current.clear()}},[t,n]),h.useEffect(()=>{if(!(!s||s.mainFile!==n||s.status!=="cleaned"||!s.cleanMode)){se.current?.abort(),B.current?.abort(),Se.current?.abort();for(const J of Ue.current)J.abort();Ue.current.clear(),s.cleanMode==="artifacts"?(M(""),O(null),v(null),y(""),R(null),le([]),H(null),ce.current.onPdfChanged(),ce.current.onPreviewTab("pdf"),be(D("editor.cleanArtifactsComplete"))):be(D("editor.cleanCacheComplete"))}},[s?.runId,s?.status,s?.cleanMode,s?.mainFile,n,D]),h.useEffect(()=>{if(!s||s.mainFile!==n||s.status!=="succeeded"&&s.status!=="failed")return;let J=!1;se.current?.abort(),Se.current?.abort();const De=new AbortController;return se.current=De,A(!0),W(`/api/projects/${t}/compile/latest?mainFile=${encodeURIComponent(n)}`,{signal:De.signal}).then(G=>{J||G.mainFile!==K.current||G.latestRun?.id!==s.runId||(M(G.latestRun.log),O(G.latestRun.diagnostics),v(s.status==="succeeded"?"succeeded":"failed"),s.status==="succeeded"&&s.stale&&be(D("editor.compileSnapshotStale")),s.status==="succeeded"&&G.pdfUrl?(ce.current.onPdfChanged(),y(G.pdfUrl),R(G.pdfCompiledAt),ce.current.onPreviewTab("pdf"),nt(s.runId),ht(n)):s.status==="failed"&&ce.current.onPreviewTab(G.latestRun.diagnostics.errors.length?"errors":"log"))}).catch(G=>{!Ds(G)&&!J&&ce.current.onError(te(G))}).finally(()=>{J||A(!1)}),()=>{J=!0,De.abort(),se.current===De&&(se.current=null)}},[s?.runId,s?.status,s?.mainFile,s?.stale,n,t,D]);const Ze=async()=>{if(!e||!n||e.permission==="read"||!r||ye.current.has(n)||s?.mainFile===n&&(s.status==="queued"||s.status==="running"))return;const J=n;Me(G=>new Set([...G,J])),ce.current.onCompileStart(),be(""),Se.current?.abort(),Se.current=null,M(""),O(null),v(null),ce.current.onPreviewTab(g?"pdf":"log");const De=new AbortController;ye.current.set(J,De);try{if(!await ce.current.save())return;const G=await W(`/api/projects/${t}/compile`,{method:"POST",signal:De.signal,body:JSON.stringify({mainFile:J})});if(G.mainFile!==K.current)return;M(G.log),O(G.diagnostics),v(G.ok?"succeeded":"failed"),G.skipped&&be(D("editor.upToDate")),G.ok&&G.stale&&be(D("editor.compileSnapshotStale")),G.pdfUrl?(ce.current.onPdfChanged(),y(G.pdfUrl),R(G.pdfCompiledAt),ce.current.onPreviewTab("pdf"),G.ok&&(G.skipped?ce.current.onCompileSuccess():nt(G.runId))):ce.current.onPreviewTab(G.diagnostics.errors.length?"errors":"log")}catch(G){!Ds(G)&&K.current===J&&ce.current.onError(te(G))}finally{ye.current.get(J)===De&&(ye.current.delete(J),Me(G=>{const st=new Set(G);return st.delete(J),st}))}},Fe=async J=>{if(!e||!n||e.permission==="read"||!r||ie||ye.current.has(n)||s?.mainFile===n&&(s.status==="queued"||s.status==="running"))return;const De=n;je(!0),se.current?.abort(),B.current?.abort(),Se.current?.abort();try{if((await W(`/api/projects/${t}/compile/clean`,{method:"POST",body:JSON.stringify({mainFile:De,mode:J})})).mainFile!==K.current)return;ce.current.onSharedState(null),J==="artifacts"&&(M(""),O(null),v(null),y(""),R(null),le([]),H(null),ce.current.onPdfChanged()),be(D(J==="cache"?"editor.cleanCacheComplete":"editor.cleanArtifactsComplete"))}catch(G){!Ds(G)&&K.current===De&&ce.current.onError(te(G))}finally{je(!1)}};Le.current=()=>{Ze()},h.useEffect(()=>{if(!Ne)return;const J=window.setTimeout(()=>be(""),3e3);return()=>window.clearTimeout(J)},[Ne]),h.useEffect(()=>{const J=De=>{!(De.ctrlKey||De.metaKey)||De.key.toLocaleLowerCase()!=="s"||(De.preventDefault(),De.stopPropagation(),De.repeat||Le.current())};return window.addEventListener("keydown",J,!0),()=>window.removeEventListener("keydown",J,!0)},[]),h.useEffect(()=>()=>{se.current?.abort(),B.current?.abort(),Se.current?.abort();for(const J of Ue.current)J.abort();Ue.current.clear();for(const J of ye.current.values())J.abort();ye.current.clear()},[]);const Ft=async J=>{if(!J.viewable)return;Se.current?.abort();const De=new AbortController;Se.current=De,S(!0);try{const G=await W(`/api/projects/${t}/compile/artifacts?mainFile=${encodeURIComponent(n)}&path=${encodeURIComponent(J.path)}`,{signal:De.signal});!De.signal.aborted&&Se.current===De&&K.current===n&&H(G)}catch(G){Ds(G)||ce.current.onError(te(G))}finally{Se.current===De&&(Se.current=null,S(!1))}};return{pdfUrl:g,pdfCompiledAt:L,pdfLoading:x,compileLog:I,compileDiagnostics:X,compileOutcome:re,artifacts:Z,artifactPreview:U,artifactLoading:P,editorNotice:Ne,localCompiling:Be.has(n),cleaning:ie,compile:Ze,cleanCompile:Fe,viewArtifact:Ft}}const Uc=10*1024*1024,Mb=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg",".bmp",".ico",".avif",".pdf",".zip",".gz",".bz2",".xz",".tar",".rar",".7z",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".odt",".ods",".odp",".mp3",".mp4",".wav",".ogg",".webm",".mov",".avi",".wasm",".exe",".bin",".so",".dll",".class",".jar"]);function zc(t){return t instanceof Error&&t.name==="AbortError"}function nr(t){const e=t.split("/").filter(Boolean);return e.pop(),e.map((n,r)=>e.slice(0,r+1).join("/"))}function Kn(t,e){return!!(t&&e)&&(e===t||e.startsWith(`${t}/`))}function $b(t){const e=`.${t.split(".").at(-1)?.toLocaleLowerCase()??""}`;return!Mb.has(e)}function Ns(t){return/(?:\.(?:tex|bib|sty|cls|txt|md)|latexmkrc)$/i.test(t)}function Vc(t){const e=t.split(".").at(-1)?.toLocaleLowerCase()??"";return e==="pdf"?"pdf":["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"].includes(e)?"image":$b(t)?"text":"unsupported"}function Ub(t,e){return`/api/projects/${t}/file/raw?path=${encodeURIComponent(e)}`}function zb({projectId:t,site:e,activeFile:n,dirty:r,save:s,onError:o,onProject:a,onActiveFile:u,onActiveMainFile:c,onRootDocuments:l}){const{t:f}=at(),[d,p]=h.useState([]),[D,g]=h.useState(!1),[y,x]=h.useState(""),[A,L]=h.useState(null),[R,I]=h.useState(!1),[M,X]=h.useState(!1),[O,re]=h.useState(""),[v,Z]=h.useState(""),[le,U]=h.useState(""),[H,P]=h.useState(new Set),[S,ie]=h.useState(null),[je,Be]=h.useState(""),[Me,Ne]=h.useState(""),[be,K]=h.useState(null),[Pe,se]=h.useState(!1),[B,Se]=h.useState(null),[Ue,ye]=h.useState(!1),qe=h.useRef(null),Le=h.useRef(null),ce=async(Q={})=>{qe.current?.abort(),qe.current=null;const Ce=Q.signal?null:new AbortController;Ce&&(qe.current=Ce);try{const ee=await W(`/api/projects/${t}/files`,{signal:Q.signal??Ce?.signal});return(!Q.isCurrent||Q.isCurrent())&&p(ee.files),ee.files}catch(ee){if(!zc(ee))throw ee;return}finally{Ce&&qe.current===Ce&&(qe.current=null)}},nt=async()=>{if(!(!y.trim()||y.trim().endsWith("/"))){Z("");try{await W(`/api/projects/${t}/file`,{method:"POST",body:JSON.stringify({path:y,content:""})}),await ce(),u(y),P(Q=>new Set([...Q,...nr(y)])),g(!1),x("")}catch(Q){Z(te(Q))}}},ht=async()=>{if(!O.trim())return;Z("");const Q=le?`${le}/${O.trim()}`:O.trim();try{const Ce=await W(`/api/projects/${t}/folders`,{method:"POST",body:JSON.stringify({path:Q})});await ce(),P(ee=>new Set([...ee,...nr(Ce.path),Ce.path])),U(Ce.path),X(!1),re("")}catch(Ce){Z(te(Ce))}},Ze=async(Q,Ce=new Set,ee=le)=>{if(!Q.length)return;const We=e.maxUploadSizeMB??50;if(Q.find(we=>we.size>We*1024*1024))return o(f("errors.fileTooLarge",{size:We}));const xe=ee,et=Q.map(we=>xe?`${xe}/${we.name}`:we.name),Ht=new Map;for(const we of et)Ht.set(we,(Ht.get(we)??0)+1);const bt=[...Ht.entries()].filter(([,we])=>we>1).map(([we])=>we);if(bt.length)return o(f("errors.duplicateUploadNames",{files:bt.join(", ")}));const vt=new Set(d.map(we=>we.path)),rt=[...new Set(et.filter(we=>vt.has(we)&&!Ce.has(we)))];if(rt.length){Se({files:Q,directory:xe,collisions:rt});return}Se(null),ye(!0);try{const we=new URLSearchParams;xe&&we.set("directory",xe);let pt="";for(const[w,$]of Q.entries()){const z=et[w];we.delete("overwrite"),Ce.has(z)&&we.set("overwrite","1");const ae=we.toString()?`?${we.toString()}`:"",ut=new FormData;ut.append("file",$);const Oe=await fetch(`/api/projects/${t}/upload${ae}`,{method:"POST",body:ut}),jt=await Oe.json().catch(()=>({}));if(!Oe.ok){if(Oe.status===409&&!Ce.has(z)&&jt.code==="FILE_EXISTS"){w>0&&await ce(),Se({files:Q.slice(w),directory:xe,collisions:[typeof jt.path=="string"?jt.path:z]});return}throw new Error(Oe.status===409?f("errors.pathConflict"):da(jt,Oe.status,"errors.upload"))}typeof jt.path=="string"&&Ns(jt.path)&&(pt=jt.path)}await ce(),pt&&u(pt)}catch(we){o(te(we))}finally{ye(!1)}},Fe=async Q=>{await Ze(Array.from(Q.target.files??[])),Q.target.value=""},Ft=async Q=>{Le.current?.abort(),Le.current=null,I(!1);const Ce=Ub(t,Q.path);if((Q.size??0)>Uc){L({path:Q.path,kind:"large",size:Q.size??0,url:Ce});return}const ee=Vc(Q.path);if(ee!=="text"){L({path:Q.path,kind:ee,size:Q.size??0,url:Ce});return}L({path:Q.path,kind:ee,size:Q.size??0,url:Ce,content:""}),I(!0);const We=new AbortController;Le.current=We;try{const Qe=await fetch(Ce,{signal:We.signal}),xe=await Qe.text();if(!Qe.ok)throw new Error(xe||f("errors.request",{status:Qe.status}));L(et=>et?.path===Q.path?{...et,content:xe}:et)}catch(Qe){zc(Qe)||(L(null),o(te(Qe)))}finally{Le.current===We&&(Le.current=null,I(!1))}},J=Q=>{const Ce=Vc(Q.path),ee=(e.maxCollaborativeFileSizeMB??5)*1024*1024;(Q.size??0)>Uc||Ns(Q.path)&&(Q.size??0)>ee||Ce!=="text"||!Ns(Q.path)?Ft(Q):u(Q.path)},De=async()=>{if(!S)return;const Q=je.trim();if(Q){Z("");try{if(!await s())return;const Ce=await W(`/api/projects/${t}/path`,{method:"PATCH",body:JSON.stringify({source:S.path,destinationDirectory:Me,destinationName:Q})}),ee=xe=>xe===S.path?Ce.path:xe.startsWith(`${S.path}/`)?`${Ce.path}${xe.slice(S.path.length)}`:xe;u(xe=>ee(xe)),c(xe=>ee(xe)),l(xe=>new Set([...xe].map(ee))),U(xe=>xe&&ee(xe));const[We,Qe]=await Promise.all([W(`/api/projects/${t}/files`),W(`/api/projects/${t}`)]);p(We.files),a(Qe.project),P(xe=>new Set([...xe,...nr(Ce.path),Me].filter(Boolean))),ie(null),Be(""),Ne("")}catch(Ce){Z(te(Ce))}}},G=async()=>{if(be){Z("");try{if(r&&!await s())return;await W(`/api/projects/${t}/file?path=${encodeURIComponent(be.path)}`,{method:"DELETE"}),K(null)}catch(Q){Z(te(Q))}}};h.useEffect(()=>()=>{qe.current?.abort(),Le.current?.abort()},[]),h.useEffect(()=>{Le.current?.abort(),Le.current=null,I(!1)},[n]);const st=d.filter(Q=>Q.type==="directory"),ft=d.filter(Q=>nr(Q.path).every(Ce=>H.has(Ce)));return{files:d,setFiles:p,loadFiles:ce,newFileOpen:D,setNewFileOpen:g,newFilePath:y,setNewFilePath:x,resourcePreview:A,setResourcePreview:L,resourcePreviewLoading:R,setResourcePreviewLoading:I,newFolderOpen:M,setNewFolderOpen:X,newFolderName:O,setNewFolderName:re,fileDialogError:v,setFileDialogError:Z,selectedFolder:le,setSelectedFolder:U,expandedFolders:H,setExpandedFolders:P,moveEntry:S,setMoveEntry:ie,moveName:je,setMoveName:Be,moveDestination:Me,setMoveDestination:Ne,deleteEntry:be,setDeleteEntry:K,fileDragActive:Pe,setFileDragActive:se,uploadConflict:B,setUploadConflict:Se,uploadingFiles:Ue,directoryEntries:st,visibleEntries:ft,createFile:nt,createFolder:ht,uploadFiles:Ze,upload:Fe,openFile:J,movePath:De,removePath:G}}function Vb({active:t,activeFile:e,content:n,dictionaryWords:r}){const[s,o]=h.useState([]),[a,u]=h.useState(""),[c,l]=h.useState(""),[f,d]=h.useState(0),[p,D]=h.useState(null),g=h.useRef(0),y=h.useRef(n),x=h.useRef(e),A=h.useRef(0);y.current=n,x.current=e,h.useEffect(()=>{o([]),u(""),l(""),D(null)},[e,r]),h.useEffect(()=>{d(M=>s.length?Math.min(M,s.length-1):0)},[s]),h.useEffect(()=>{const M=++g.current;if(!t||!e){o([]),u(""),l(""),D(null);return}const X=n,O=e,re=window.setTimeout(()=>{dn(async()=>{const{lintLatex:v}=await import("./spellCheck-C32VQVUE.js");return{lintLatex:v}},__vite__mapDeps([2,1])).then(({lintLatex:v})=>{if(!(M!==g.current||y.current!==X||x.current!==O))return v(X,r).then(Z=>{M!==g.current||y.current!==X||x.current!==O||(o(Z),u(X),l(O),d(0),D(null))})}).catch(()=>{})},700);return()=>window.clearTimeout(re)},[t,e,n,r]);const L=c===e&&a===n,R=h.useMemo(()=>L?{total:s.length,unique:new Set(s.map(M=>`${M.kind}:${M.word.toLocaleLowerCase("en-US")}`)).size}:null,[L,s]);return{issues:L?s:[],jump:L?p:null,index:f,summary:R,jumpToIssue:M=>{if(!s.length)return;const X=Math.max(0,Math.min(M,s.length-1)),O=s[X];d(X),D({from:O.from,to:O.to,nonce:++A.current})}}}function Hc(t){return t instanceof Error&&t.name==="AbortError"}function Hb({projectId:t,mainFile:e,activeFile:n,onActiveFile:r,onError:s,onShowPdf:o}){const[a,u]=h.useState(null),[c,l]=h.useState(null),[f,d]=h.useState(null),p=h.useRef(null),D=h.useRef(0),g=h.useRef(n),y=h.useRef(r),x=h.useRef(s),A=h.useRef(o),L=O=>O===e&&/\.tex$/i.test(O);g.current=n,y.current=r,x.current=s,A.current=o,h.useEffect(()=>(p.current?.abort(),p.current=null,u(null),l(null),d(null),()=>p.current?.abort()),[t,e]);const R=(O,re,v)=>{d({path:O,line:re,column:v,nonce:++D.current}),g.current!==O&&y.current(O)},I=async(O,re,v,Z={})=>{if(!L(O))return;p.current?.abort();const le=new AbortController;p.current=le;try{const U=await W(`/api/projects/${t}/sync/pdf?mainFile=${encodeURIComponent(e)}&path=${encodeURIComponent(O)}&line=${re}&column=${v}`,{signal:le.signal});if(p.current!==le||!U)return;u({...U,nonce:++D.current}),A.current()}catch(U){!Hc(U)&&!Z.silent&&x.current(te(U))}finally{p.current===le&&(p.current=null)}},M=async(O,re,v)=>{if(!L(g.current))return;const Z=g.current;p.current?.abort();const le=new AbortController;p.current=le;try{const U=await W(`/api/projects/${t}/sync/source?mainFile=${encodeURIComponent(e)}&page=${O}&x=${re}&y=${v}`,{signal:le.signal});if(p.current!==le||g.current!==Z||!L(g.current))return;R(U.path,U.line,U.column)}catch(U){Hc(U)||x.current(te(U))}finally{p.current===le&&(p.current=null)}};return{pdfTarget:a,pdfViewport:c,sourceJump:f,setPdfViewport:l,clearPdfViewport:()=>l(null),jumpToSource:R,syncSourceToPdf:I,syncPdfToSource:M,syncVisiblePdfToSource:()=>{c&&M(c.page,c.x,c.y)}}}function Nh(t,e){return`texlite.workspaceLayout:${encodeURIComponent(t)}:${encodeURIComponent(e)}`}function qc(t,e){try{const n=window.localStorage.getItem(Nh(t,e));if(n==="editor-pdf"||n==="editor-only"||n==="pdf-only")return n}catch{}return"editor-pdf"}function qb(t,e){const[n,r]=h.useState(()=>qc(t,e));return h.useEffect(()=>{r(qc(t,e))},[t,e]),{workspaceLayout:n,setWorkspaceLayout:o=>{r(o);try{window.localStorage.setItem(Nh(t,e),o)}catch{}}}}const Kb=[];function Lh({open:t,onOpenChange:e,page:n=!1,onBack:r,currentFile:s="",currentSource:o="",readOnly:a=!1,currentUserId:u,onInsert:c}){const{t:l}=at(),[f,d]=h.useState("library"),[p,D]=h.useState(""),[g,y]=h.useState(""),[x,A]=h.useState([]),[L,R]=h.useState(1),[I,M]=h.useState({page:1,pageSize:60,total:0,totalPages:0}),[X,O]=h.useState(0),[re,v]=h.useState([]),[Z,le]=h.useState(""),[U,H]=h.useState("green"),[P,S]=h.useState(null),[ie,je]=h.useState([]),[Be,Me]=h.useState(!1),[Ne,be]=h.useState(!1),[K,Pe]=h.useState(null),[se,B]=h.useState(null),[Se,Ue]=h.useState(""),[ye,qe]=h.useState(!1),[Le,ce]=h.useState(""),[nt,ht]=h.useState(null),[Ze,Fe]=h.useState(""),[Ft,J]=h.useState(""),[De,G]=h.useState(new Map),[st,ft]=h.useState(!1),[Q,Ce]=h.useState(0),ee=!!(/\.bib$/i.test(s)&&c),We=h.useMemo(()=>t&&ee?Wl(o):Kb,[t,o,ee]),Qe=h.useMemo(()=>new Set(We.map(w=>w.citationKey.toLowerCase())),[We]);h.useEffect(()=>{if(!t)return;const w=new AbortController,$=window.setTimeout(()=>{be(!0),Fe("");const z=new URLSearchParams;p.trim()&&z.set("q",p.trim()),g&&z.set("tag",g),z.set("page",String(L)),z.set("pageSize","60"),W(`/api/citations?${z.toString()}`,{signal:w.signal}).then(ae=>{A(ae.entries),M(ae.pagination),ae.pagination.page!==L&&R(ae.pagination.page)}).catch(ae=>{ae instanceof Error&&ae.name==="AbortError"||Fe(te(ae))}).finally(()=>{w.signal.aborted||be(!1)})},p.trim()?180:0);return()=>{window.clearTimeout($),w.abort()}},[t,p,g,L,X]),h.useEffect(()=>{if(!t)return;const w=new AbortController;return W("/api/citations/tags",{signal:w.signal}).then($=>v($.tags)).catch($=>{$ instanceof Error&&$.name==="AbortError"||Fe(te($))}),()=>w.abort()},[t]),h.useEffect(()=>{if(!t||!ee){G(new Map),ft(!1);return}const w=new AbortController,$=[...new Set(We.map(z=>z.citationKey))];return $.length?(ft(!0),W("/api/citations/lookup",{method:"POST",body:JSON.stringify({keys:$}),signal:w.signal}).then(z=>{G(new Map(z.matches.map(ae=>[ae.citationKey.toLowerCase(),ae])))}).catch(z=>{z instanceof Error&&z.name==="AbortError"||Fe(te(z))}).finally(()=>{w.signal.aborted||ft(!1)}),()=>w.abort()):(G(new Map),ft(!1),()=>w.abort())},[t,ee,We,Q]),h.useEffect(()=>{t&&(d("library"),D(""),y(""),R(1),M({page:1,pageSize:60,total:0,totalPages:0}),B(null),qe(!1),ce(""),S(null),ht(null),Fe(""),J(""),G(new Map))},[t,ee]);const xe=async w=>{Pe(w.citationKey),Fe("");try{const $=De.get(w.citationKey.toLowerCase()),z=await W("/api/citations",{method:"POST",body:JSON.stringify({bibtex:w.bibtex,citationKey:w.citationKey,entryType:w.entryType,title:w.title,authors:w.authors,year:w.year,overwrite:!!$,expectedRevision:$?.revision})});A(ae=>[z.entry,...ae.filter(ut=>ut.id!==z.entry.id&&ut.citationKey.toLowerCase()!==z.entry.citationKey.toLowerCase())]),G(ae=>new Map(ae).set(z.entry.citationKey.toLowerCase(),{id:z.entry.id,citationKey:z.entry.citationKey,revision:z.entry.revision})),S(z.entry),je(z.entry.tags.map(ae=>ae.id)),J(z.updated?l("citationLibrary.updated"):l("citationLibrary.saved")),R(1),O(ae=>ae+1)}catch($){Fe(te($)),Ce(z=>z+1)}finally{Pe(null)}},et=async()=>{if(se){Pe(se.citationKey),Fe("");try{const w=rc(Se);if(!w){Fe(l("citationErrors.invalid"));return}const $=await W(`/api/citations/${encodeURIComponent(se.id)}`,{method:"PATCH",body:JSON.stringify({bibtex:w.bibtex,citationKey:w.citationKey,entryType:w.entryType,title:w.title,authors:w.authors,year:w.year,expectedRevision:se.revision})});A(z=>[$.entry,...z.filter(ae=>ae.id!==$.entry.id)]),G(z=>{const ae=new Map(z);return ae.delete(se.citationKey.toLowerCase()),ae.set($.entry.citationKey.toLowerCase(),{id:$.entry.id,citationKey:$.entry.citationKey,revision:$.entry.revision}),ae}),B(null),J(l("citationLibrary.updated")),R(1),O(z=>z+1)}catch(w){Fe(te(w))}finally{Pe(null)}}},Ht=async()=>{if(Le.trim()){Pe("__new__"),Fe("");try{const w=rc(Le);if(!w){Fe(l("citationErrors.invalid"));return}const $=await W("/api/citations",{method:"POST",body:JSON.stringify({bibtex:w.bibtex,citationKey:w.citationKey,entryType:w.entryType,title:w.title,authors:w.authors,year:w.year})});A(z=>[$.entry,...z.filter(ae=>ae.id!==$.entry.id&&ae.citationKey.toLowerCase()!==$.entry.citationKey.toLowerCase())]),G(z=>new Map(z).set($.entry.citationKey.toLowerCase(),{id:$.entry.id,citationKey:$.entry.citationKey,revision:$.entry.revision})),qe(!1),ce(""),J($.updated?l("citationLibrary.updated"):l("citationLibraryActions.added")),S($.entry),je($.entry.tags.map(z=>z.id)),R(1),O(z=>z+1)}catch(w){Fe(te(w))}finally{Pe(null)}}},bt=async()=>{if(Z.trim()){Fe("");try{const w=await W("/api/citations/tags",{method:"POST",body:JSON.stringify({name:Z.trim(),color:U})});v($=>[...$.filter(z=>z.id!==w.tag.id),w.tag].sort((z,ae)=>z.name.localeCompare(ae.name))),le(""),J(l("citationLibrary.tagCreated"))}catch(w){Fe(te(w))}}},vt=w=>{B(null),qe(!1),S(w),je(w.tags.map($=>$.id))},rt=async()=>{if(P){Me(!0),Fe("");try{const w=await W(`/api/citations/${encodeURIComponent(P.id)}/tags`,{method:"PATCH",body:JSON.stringify({tagIds:ie,expectedRevision:P.revision})});A($=>$.map(z=>z.id===w.entry.id?w.entry:z)),G($=>new Map($).set(w.entry.citationKey.toLowerCase(),{id:w.entry.id,citationKey:w.entry.citationKey,revision:w.entry.revision})),S(w.entry),je(w.entry.tags.map($=>$.id)),J(l("citationLibrary.tagsUpdated")),O($=>$+1)}catch(w){Fe(te(w))}finally{Me(!1)}}},we=async w=>{ht(w.id),Fe("");try{await W(`/api/citations/${encodeURIComponent(w.id)}`,{method:"DELETE"}),A($=>$.filter(z=>z.id!==w.id)),G($=>{const z=new Map($);return z.delete(w.citationKey.toLowerCase()),z}),se?.id===w.id&&B(null),P?.id===w.id&&S(null),J(l("citationLibrary.deleted")),R(1),O($=>$+1)}catch($){Fe(te($))}finally{ht(null)}},pt=i.jsxs("div",{className:"citation-library-dialog",children:[i.jsxs("div",{className:"citation-library-tabs",role:"tablist","aria-label":l("citationLibrary.title"),children:[i.jsxs("button",{type:"button",role:"tab","aria-selected":f==="library",className:f==="library"?"active":"",onClick:()=>d("library"),children:[i.jsx(Cs,{size:15}),l("citationLibrary.myLibrary"),i.jsx("span",{children:I.total})]}),ee&&i.jsxs("button",{type:"button",role:"tab","aria-selected":f==="current",className:f==="current"?"active":"",onClick:()=>d("current"),children:[i.jsx(ei,{size:15}),l("citationLibrary.currentFile"),i.jsx("span",{children:We.length})]})]}),Ze&&!(n&&(P||se))&&i.jsx("p",{className:"error dialog-error",children:Ze}),Ft&&i.jsxs("p",{className:"citation-library-notice",role:"status",children:[i.jsx(Wn,{size:14}),Ft,i.jsx("button",{type:"button","aria-label":l("common.close"),onClick:()=>J(""),children:i.jsx(Jt,{size:13})})]}),f==="library"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"citation-library-search-row",children:[i.jsxs("label",{className:"citation-library-search",children:[i.jsx(Hl,{size:15}),i.jsx("input",{autoFocus:!0,placeholder:l("citationLibrary.searchPlaceholder"),value:p,onChange:w=>{D(w.target.value),R(1)}}),i.jsx("span",{children:l("citationLibrary.searchHint")})]}),i.jsxs("button",{type:"button",className:"citation-add-entry-button",onClick:()=>{qe(!0),B(null),S(null)},children:[i.jsx(ei,{size:14}),l("citationLibraryActions.addEntry")]})]}),i.jsxs("div",{className:"citation-tag-bar",children:[i.jsxs("div",{className:"citation-tag-filters",children:[i.jsx("button",{type:"button",className:g?"":"active",onClick:()=>{y(""),R(1)},children:l("citationLibrary.allTags")}),re.map(w=>i.jsxs("button",{type:"button",className:g===w.id?"active":"",onClick:()=>{y(g===w.id?"":w.id),R(1)},children:[i.jsx("span",{className:`citation-tag-dot tag-${w.color}`}),w.name]},w.id)),re.length===0&&i.jsx("span",{className:"muted",children:l("citationLibrary.noTags")})]}),i.jsxs("div",{className:"citation-tag-create",children:[i.jsx("input",{value:Z,placeholder:l("citationLibrary.newTagPlaceholder"),onChange:w=>le(w.target.value),onKeyDown:w=>{w.key==="Enter"&&(w.preventDefault(),bt())}}),i.jsx("select",{"aria-label":l("citationLibrary.tagColor"),value:U,onChange:w=>H(w.target.value),children:["red","orange","yellow","green","blue","purple","gray"].map(w=>i.jsx("option",{value:w,children:l(`tags.${w}`)},w))}),i.jsxs("button",{type:"button",disabled:!Z.trim(),title:l("citationLibrary.createTag"),onClick:()=>{bt()},children:[i.jsx(ei,{size:13}),l("citationLibrary.createTag")]})]})]}),ye&&i.jsxs("div",{className:"citation-edit-panel",children:[i.jsxs("div",{className:"citation-edit-header",children:[i.jsxs("div",{children:[i.jsx("strong",{children:l("citationLibraryActions.addEntryTitle")}),i.jsx("small",{children:l("citationLibraryActions.addEntryDescription")})]}),i.jsx("button",{type:"button","aria-label":l("common.close"),onClick:()=>qe(!1),children:i.jsx(Jt,{size:15})})]}),i.jsx("textarea",{autoFocus:!0,value:Le,onChange:w=>ce(w.target.value),placeholder:l("citationLibraryActions.addEntryPlaceholder"),spellCheck:!1,rows:9}),i.jsxs("div",{className:"citation-edit-actions",children:[i.jsx("button",{type:"button",onClick:()=>qe(!1),children:l("common.cancel")}),i.jsxs("button",{type:"button",className:"primary",disabled:!Le.trim()||K==="__new__",onClick:()=>{Ht()},children:[K==="__new__"?i.jsx(Lt,{className:"spin",size:14}):i.jsx(Wn,{size:14}),l("citationLibraryActions.addEntry")]})]})]}),Ne?i.jsxs("div",{className:"citation-library-empty",children:[i.jsx(Lt,{className:"spin",size:22}),i.jsx("span",{children:l("common.loading")})]}):x.length===0?i.jsxs("div",{className:"citation-library-empty",children:[i.jsx(Cs,{size:28}),i.jsx("strong",{children:l("citationLibrary.emptyTitle")}),i.jsx("span",{children:l(g?"citationLibrary.noTagMatches":"citationLibrary.emptyDescription")})]}):i.jsx("div",{className:"citation-entry-list",children:x.map(w=>i.jsxs("div",{className:"citation-entry-item",children:[i.jsx(Kc,{entry:w,currentUserId:u,selected:P?.id===w.id||se?.id===w.id,alreadyInFile:!n&&Qe.has(w.citationKey.toLowerCase()),importDisabled:a,deleting:nt===w.id,onImport:c?async()=>{await c(w)&&e(!1)}:void 0,onEdit:w.ownerId===u?()=>{S(null),qe(!1),B(w),Ue(w.bibtex)}:void 0,onTags:w.ownerId===u?()=>vt(w):void 0,onDelete:w.ownerId===u?()=>{we(w)}:void 0,t:l}),!n&&P?.id===w.id&&i.jsx(So,{entry:P,tags:re,selectedIds:ie,saving:Be,onClose:()=>S(null),onToggle:$=>je(z=>z.includes($)?z.filter(ae=>ae!==$):[...z,$]),onSave:()=>{rt()},t:l}),!n&&se?.id===w.id&&i.jsx(Gc,{title:l("citationLibrary.editTitle",{key:se.citationKey}),value:Se,saving:K===se.citationKey,onChange:Ue,onClose:()=>B(null),onSave:()=>{et()},t:l})]},w.id))}),I.totalPages>1&&i.jsxs("nav",{className:"citation-library-pagination","aria-label":l("citationLibraryPagination.pageOf",{page:I.page,totalPages:I.totalPages,count:I.total}),children:[i.jsxs("button",{type:"button",disabled:I.page<=1,onClick:()=>R(w=>Math.max(1,w-1)),children:[i.jsx(ir,{size:14}),l("citationLibraryPagination.previous")]}),i.jsx("span",{children:l("citationLibraryPagination.pageOf",{page:I.page,totalPages:I.totalPages,count:I.total})}),i.jsxs("button",{type:"button",disabled:I.page>=I.totalPages,onClick:()=>R(w=>Math.min(I.totalPages,w+1)),children:[l("citationLibraryPagination.next"),i.jsx(vi,{size:14})]})]})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"citation-current-heading",children:[i.jsxs("div",{children:[i.jsx("strong",{children:l("citationLibrary.currentFileTitle")}),i.jsx("span",{children:l("citationLibrary.currentFileDescription")})]}),i.jsxs("button",{type:"button",onClick:()=>d("library"),children:[i.jsx(ir,{size:14}),l("citationLibrary.backToLibrary")]})]}),We.length===0?i.jsxs("div",{className:"citation-library-empty",children:[i.jsx(Cs,{size:28}),i.jsx("strong",{children:l("citationLibrary.noEntries")}),i.jsx("span",{children:l("citationLibrary.noEntriesDescription")})]}):i.jsx("div",{className:"citation-entry-list",children:We.map((w,$)=>i.jsxs("div",{className:"citation-entry-item",children:[i.jsx(Kc,{entry:w,saved:De.has(w.citationKey.toLowerCase()),saving:K===w.citationKey,saveDisabled:st,onSave:()=>{xe(w)},t:l}),!n&&P?.citationKey.toLowerCase()===w.citationKey.toLowerCase()&&i.jsx(So,{entry:P,tags:re,selectedIds:ie,saving:Be,onClose:()=>S(null),onToggle:z=>je(ae=>ae.includes(z)?ae.filter(ut=>ut!==z):[...ae,z]),onSave:()=>{rt()},t:l})]},`${w.citationKey}-${$}`))})]})]});return n?i.jsxs(i.Fragment,{children:[i.jsxs("section",{className:"citation-library-page",children:[i.jsxs("header",{className:"citation-library-page-header",children:[i.jsxs("div",{children:[i.jsxs("h1",{children:[i.jsx(Cs,{"aria-hidden":!0,size:26}),l("citationLibrary.title")]}),i.jsx("p",{children:l("citationLibraryHomeDescription")})]}),r&&i.jsxs("button",{type:"button",onClick:r,children:[i.jsx(ir,{size:15}),l("projects.title")]})]}),pt]}),P&&i.jsx(it,{open:!0,title:l("citationLibrary.tagsTitle",{key:P.citationKey}),description:l("citationLibrary.tags"),onOpenChange:w=>{w||(S(null),Fe(""))},children:i.jsxs(i.Fragment,{children:[Ze&&i.jsx("p",{className:"error dialog-error",children:Ze}),i.jsx(So,{entry:P,tags:re,selectedIds:ie,saving:Be,modal:!0,onClose:()=>{S(null),Fe("")},onToggle:w=>je($=>$.includes(w)?$.filter(z=>z!==w):[...$,w]),onSave:()=>{rt()},t:l})]})}),se&&i.jsx(it,{open:!0,extraWide:!0,title:l("citationLibrary.editTitle",{key:se.citationKey}),description:l("citationLibrary.title"),onOpenChange:w=>{w||(B(null),Fe(""))},children:i.jsxs(i.Fragment,{children:[Ze&&i.jsx("p",{className:"error dialog-error",children:Ze}),i.jsx(Gc,{title:l("citationLibrary.editTitle",{key:se.citationKey}),value:Se,saving:K===se.citationKey,modal:!0,onChange:Ue,onClose:()=>{B(null),Fe("")},onSave:()=>{et()},t:l})]})})]}):i.jsx(it,{open:t,extraWide:!0,className:"citation-library-modal",title:l("citationLibrary.title"),description:l(ee?"citationLibrary.description":"citationLibraryHomeDescription",{file:s}),onOpenChange:e,footer:i.jsx("button",{onClick:()=>e(!1),children:l("common.close")}),children:pt})}function Kc({entry:t,currentUserId:e,selected:n,alreadyInFile:r,saved:s,saving:o,saveDisabled:a,importDisabled:u,deleting:c,onSave:l,onImport:f,onEdit:d,onTags:p,onDelete:D,t:g}){const y="id"in t,x=y?t:null;return i.jsxs("article",{className:`citation-entry-card${n?" selected":""}${r?" already-in-file":""}`,title:r?g("citationErrors.alreadyInFile",{key:t.citationKey}):void 0,children:[i.jsxs("div",{className:"citation-entry-main",children:[i.jsxs("div",{className:"citation-entry-heading",children:[i.jsx("code",{children:t.citationKey}),i.jsxs("span",{children:["@",t.entryType]}),s&&i.jsxs("em",{children:[i.jsx(Wn,{size:11}),g("citationLibrary.savedLabel")]})]}),i.jsx("strong",{children:t.title||g("citationLibrary.untitled")}),i.jsxs("p",{children:[t.authors||g("citationLibrary.authorUnknown"),t.year&&i.jsxs("span",{children:[" · ",t.year]})]}),x&&x.tags.length>0&&i.jsx("div",{className:"citation-entry-tags",children:x.tags.map(A=>i.jsxs("span",{className:`citation-tag-pill tag-${A.color}`,children:[i.jsx("span",{className:"citation-tag-dot"}),A.name]},A.id))})]}),i.jsxs("div",{className:"citation-entry-actions",children:[l&&i.jsxs("button",{type:"button",className:s?"saved":"primary",disabled:o||a,onClick:l,children:[o||a?i.jsx(Lt,{className:"spin",size:13}):s?i.jsx(Wn,{size:13}):i.jsx(ei,{size:13}),g(o?"citationLibrary.saving":s?"citationLibrary.update":"citationLibrary.save")]}),f&&i.jsxs("button",{type:"button",disabled:u||r,title:r?g("citationErrors.alreadyInFile",{key:t.citationKey}):g(u?"citationLibrary.importRequiresWrite":"citationLibrary.importToFile"),onClick:()=>{f()},children:[i.jsx(SD,{size:13}),g("citationLibrary.import")]}),x&&p&&i.jsxs("button",{type:"button",onClick:p,children:[i.jsx(Wo,{size:13}),g("citationLibrary.tags")]}),y&&d&&i.jsxs("button",{type:"button",onClick:d,children:[i.jsx(RD,{size:13}),g("common.edit")]}),y&&D&&i.jsxs("button",{type:"button",className:"danger-text",disabled:c,onClick:D,children:[c?i.jsx(Lt,{className:"spin",size:13}):i.jsx(Qt,{size:13}),g("common.delete")]})]})]})}function So({entry:t,tags:e,selectedIds:n,saving:r,modal:s=!1,onClose:o,onToggle:a,onSave:u,t:c}){const l=i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"citation-tag-choice-list",children:e.length===0?i.jsx("span",{className:"muted",children:c("citationLibrary.noTagsToAssign")}):e.map(f=>i.jsxs("label",{children:[i.jsx("input",{type:"checkbox",checked:n.includes(f.id),onChange:()=>a(f.id)}),i.jsx("span",{className:`citation-tag-dot tag-${f.color}`}),f.name]},f.id))}),i.jsxs("div",{className:"citation-edit-actions",children:[i.jsx("button",{type:"button",onClick:o,children:c("common.cancel")}),i.jsxs("button",{type:"button",className:"primary",disabled:r||e.length===0,onClick:u,children:[r?i.jsx(Lt,{className:"spin",size:14}):i.jsx(Wn,{size:14}),c("citationLibrary.saveTags")]})]})]});return s?i.jsx("div",{className:"citation-modal-form",children:l}):i.jsxs("div",{className:"citation-tag-editor",children:[i.jsxs("div",{className:"citation-edit-header",children:[i.jsx("strong",{children:c("citationLibrary.tagsTitle",{key:t.citationKey})}),i.jsx("button",{type:"button","aria-label":c("common.close"),onClick:o,children:i.jsx(Jt,{size:15})})]}),l]})}function Gc({title:t,value:e,saving:n,modal:r=!1,onChange:s,onClose:o,onSave:a,t:u}){const c=i.jsxs(i.Fragment,{children:[i.jsx("textarea",{autoFocus:!r,value:e,onChange:l=>s(l.target.value),spellCheck:!1,rows:12}),i.jsxs("div",{className:"citation-edit-actions",children:[i.jsx("button",{type:"button",onClick:o,children:u("common.cancel")}),i.jsxs("button",{type:"button",className:"primary",disabled:!e.trim()||n,onClick:a,children:[n?i.jsx(Lt,{className:"spin",size:14}):i.jsx(Wn,{size:14}),u("common.save")]})]})]});return r?i.jsx("div",{className:"citation-modal-form citation-edit-panel",children:c}):i.jsxs("div",{className:"citation-edit-panel",children:[i.jsxs("div",{className:"citation-edit-header",children:[i.jsx("strong",{children:t}),i.jsx("button",{type:"button","aria-label":u("common.close"),onClick:o,children:i.jsx(Jt,{size:15})})]}),c]})}const Oh=()=>dn(()=>import("./PdfPreview-BVaG7TtG.js"),__vite__mapDeps([3,1,4,5])),Gb=h.lazy(()=>Oh().then(t=>({default:t.PdfPreview}))),Yb=h.lazy(()=>dn(()=>import("./LatexEditor-DNAmNvHu.js"),__vite__mapDeps([6,1,7])).then(t=>({default:t.LatexEditor}))),Wb=h.lazy(()=>dn(()=>import("./GitDialog-pn8n5Afm.js"),__vite__mapDeps([8,1,5])).then(t=>({default:t.GitDialog}))),Xb=h.lazy(()=>dn(()=>import("./HistoryDialog-BpWEZrYf.js"),__vite__mapDeps([9,1,0])).then(t=>({default:t.HistoryDialog}))),Jb=h.lazy(()=>dn(()=>import("./ProjectNavigationDialogs-CaovMu4V.js"),__vite__mapDeps([10,1])).then(t=>({default:t.ProjectSearchDialog}))),Zb=h.lazy(()=>dn(()=>import("./ProjectNavigationDialogs-CaovMu4V.js"),__vite__mapDeps([10,1])).then(t=>({default:t.QuickOpenDialog}))),Qb=h.lazy(()=>dn(()=>import("./SystemMetricsDialog-D8jj7epG.js"),__vite__mapDeps([11,1])).then(t=>({default:t.SystemMetricsDialog}))),Rt=8;function ys(t){return t instanceof Error&&t.name==="AbortError"}function e2(t,e,n,r){const s=new Date(t).getTime();if(!Number.isFinite(s))return t;const o=s-n,a=Math.abs(o),u=60*1e3,c=60*u,l=24*c,f=3*l;if(a>f){const g=Math.floor(a/l),y=o<0?"Past":"Future";return r(`projects.relativeDays${y}`,{days:g,hours:0,minutes:0})}if(a>=l){const g=Math.floor(a/l),y=Math.floor(a%l/c),x=o<0?"Past":"Future",A=y>0?"DaysHours":"Days";return r(`projects.relative${A}${x}`,{days:g,hours:y,minutes:0})}if(a>=c){const g=Math.floor(a/c),y=Math.floor(a%c/u),x=o<0?"Past":"Future",A=y>0?"HoursMinutes":"Hours";return r(`projects.relative${A}${x}`,{days:0,hours:g,minutes:y})}let d="minute",p=u;const D=Math.sign(o)*Math.max(1,Math.floor(a/p));return new Intl.RelativeTimeFormat(e,{numeric:"always"}).format(D,d)}function t2(){const{t}=at(),[e,n]=h.useState({siteName:"TexLite",adminEmail:""}),[r,s]=h.useState(),[o,a]=h.useState(()=>typeof window>"u"?null:Wr(window.location.pathname)),[u,c]=h.useState(null);h.useEffect(()=>{const p=Wr(window.location.pathname);if(p&&window.location.pathname!==fo(p)){const y={texliteRoute:"project",projectId:p,fromDashboard:!1};window.history.replaceState(y,"",fo(p))}const D=()=>a(Wr(window.location.pathname)),g=()=>{if(c(null),s(null),Wr(window.location.pathname)){const y={texliteRoute:"dashboard"};window.history.replaceState(y,"","/"),a(null)}};return window.addEventListener("popstate",D),window.addEventListener("texlite:session-expired",g),()=>{window.removeEventListener("popstate",D),window.removeEventListener("texlite:session-expired",g)}},[]);const l=p=>{const D=fo(p);if(window.location.pathname!==D){const g={texliteRoute:"project",projectId:p,fromDashboard:!0};window.history.pushState(g,"",D)}a(p)},f=()=>{const p=window.history.state;if(f0(p)&&p.fromDashboard){window.history.back();return}const D={texliteRoute:"dashboard"};window.history.replaceState(D,"","/"),a(null)};if(h.useEffect(()=>{W("/api/config").then(p=>{n(p),document.title=p.siteName}),W("/api/me").then(({user:p})=>s(p)).catch(p=>{p instanceof la&&p.status,s(null)})},[]),r===void 0)return i.jsx("div",{className:"center-card",children:t("common.loading")});if(!r)return i.jsx(s2,{site:e,onLogin:s});if(r.mustChangePassword)return i.jsx(n2,{site:e,user:r,onChanged:p=>s(p)});if(o)return i.jsx(a2,{site:e,user:r,projectId:o,onBack:f},o);const d=u?.userId===r.id?u:null;return i.jsx(r2,{site:e,user:r,initialData:d?{projects:d.projects,tags:d.tags,pagination:d.pagination}:null,onDataChange:(p,D,g)=>c({userId:r.id,projects:p,tags:D,pagination:g}),onUser:p=>{(!p||p.id!==r.id)&&c(null),s(p),p||f()},onOpenProject:l})}function $i({siteName:t,compact:e=!1,auth:n=!1}){return i.jsx("span",{className:`site-logo${e?" compact":""}${n?" auth-logo":""}`,children:i.jsx("img",{src:"/logo.svg",alt:t})})}function su(){const{t}=at();return i.jsxs("footer",{className:"site-footer",children:[i.jsxs("span",{children:[t("footer.copyright",{year:new Date().getFullYear()})," ",i.jsxs("a",{href:"https://github.com/SWUFE-DB-Group/TexLite",target:"_blank",rel:"noreferrer",children:["TexLite v",Nf]})]}),i.jsx("span",{children:t("footer.credit")})]})}function n2({site:t,user:e,onChanged:n}){const{t:r}=at(),[s,o]=h.useState(""),[a,u]=h.useState(""),[c,l]=h.useState(""),[f,d]=h.useState(""),p=async D=>{if(D.preventDefault(),a!==c)return d(r("auth.mismatch"));if(a.length<Rt)return d(r("auth.passwordMinimum",{count:Rt}));try{await W("/api/me/password",{method:"PUT",body:JSON.stringify({currentPassword:s,newPassword:a})}),n({...e,mustChangePassword:!1})}catch(g){d(te(g))}};return i.jsxs("main",{className:"login-page",children:[i.jsx(Ca,{}),i.jsxs("form",{className:"login-card",onSubmit:p,children:[i.jsx($i,{siteName:t.siteName,auth:!0}),i.jsx("h1",{className:"sr-only",children:t.siteName}),i.jsx("p",{className:"muted",children:r("auth.firstLogin")}),i.jsxs("label",{children:[r("auth.currentPassword"),i.jsx("input",{type:"password",value:s,onChange:D=>o(D.target.value)})]}),i.jsxs("label",{children:[r("auth.newPassword"),i.jsx("input",{type:"password",minLength:Rt,autoComplete:"new-password",value:a,onChange:D=>u(D.target.value)}),i.jsx("small",{className:"field-hint",children:r("auth.passwordMinimum",{count:Rt})})]}),i.jsxs("label",{children:[r("auth.confirmPassword"),i.jsx("input",{type:"password",minLength:Rt,autoComplete:"new-password",value:c,onChange:D=>l(D.target.value)})]}),f&&i.jsx("p",{className:"error",children:f}),i.jsx("button",{className:"primary",children:r("auth.updatePassword")})]}),i.jsx(su,{})]})}function s2({site:t,onLogin:e}){const{t:n}=at(),[r,s]=h.useState(""),[o,a]=h.useState(""),[u,c]=h.useState(""),l=async f=>{f.preventDefault(),c("");try{const d=await W("/api/auth/login",{method:"POST",body:JSON.stringify({username:r,password:o})});e(d.user)}catch(d){c(te(d))}};return i.jsxs("main",{className:"login-page",children:[i.jsx(Ca,{}),i.jsxs("form",{className:"login-card",onSubmit:l,children:[i.jsx($i,{siteName:t.siteName,auth:!0}),i.jsx("h1",{className:"sr-only",children:t.siteName}),i.jsx("p",{className:"muted",children:n("auth.tagline")}),i.jsxs("label",{children:[n("auth.username"),i.jsx("input",{autoFocus:!0,value:r,onChange:f=>s(f.target.value)})]}),i.jsxs("label",{children:[n("auth.password"),i.jsx("input",{type:"password",value:o,onChange:f=>a(f.target.value)})]}),u&&i.jsx("p",{className:"error",children:u}),i.jsx("button",{className:"primary",type:"submit",children:n("auth.login")}),t.adminEmail&&i.jsx("small",{className:"support",children:n("auth.contact",{email:t.adminEmail})})]}),i.jsx(su,{})]})}function r2({site:t,user:e,initialData:n,onDataChange:r,onUser:s,onOpenProject:o}){const{t:a}=at(),[u,c]=h.useState(()=>n?.projects??[]),[l,f]=h.useState(()=>n?.tags??[]),[d,p]=h.useState(()=>n?.pagination??{page:1,pageSize:20,total:n?.projects.length??0,totalPages:n?.projects.length?1:0}),[D,g]=h.useState(!!n),[y,x]=h.useState(!1),[A,L]=h.useState(!1),[R,I]=h.useState(!1),[M,X]=h.useState(""),[O,re]=h.useState(!1),[v,Z]=h.useState(""),[le,U]=h.useState(!1),[H,P]=h.useState(""),[S,ie]=h.useState(null),[je,Be]=h.useState(""),Me=h.useRef(null),[Ne,be]=h.useState(!1),[K,Pe]=h.useState(""),[se,B]=h.useState(""),[Se,Ue]=h.useState(!1),[ye,qe]=h.useState(""),[Le,ce]=h.useState("blue"),[nt,ht]=h.useState(null),[Ze,Fe]=h.useState(null),[Ft,J]=h.useState(""),[De,G]=h.useState(null),[st,ft]=h.useState(""),[Q,Ce]=h.useState(!1),[ee,We]=h.useState(null),[Qe,xe]=h.useState(null),[et,Ht]=h.useState([]),[bt,vt]=h.useState(""),[rt,we]=h.useState(!1),[pt,w]=h.useState(""),[$,z]=h.useState(()=>localStorage.getItem("texlite-project-view")==="list"?"list":"grid"),[ae,ut]=h.useState(()=>localStorage.getItem("texlite-project-sort")==="created"?"created":"updated"),[Oe,jt]=h.useState(!1),[Dn,gn]=h.useState(""),[kt,$e]=h.useState(1),[Fn,Sn]=h.useState(()=>Date.now()),[jn,St]=h.useState(""),m=h.useRef(0),E=h.useRef(null),F=(C,Ae,ge,Ge,Dt)=>`${C?"archived":"active"}|${Ae}|${ge}|${Ge}|${Dt}`,j=F(Oe,kt,K,se,ae),T=(C,Ae,ge,Ge,Dt)=>{const Ye=new URLSearchParams({page:String(Ae),pageSize:"20",sort:Dt});C&&Ye.set("archived","1"),ge.trim()&&Ye.set("search",ge.trim()),Ge&&Ye.set("tag",Ge);const Xt=F(C,Ae,ge,Ge,Dt),Tn=++m.current;E.current?.abort();const Nn=new AbortController;return E.current=Nn,Promise.all([W(`/api/projects?${Ye.toString()}`,{signal:Nn.signal}),W("/api/tags",{signal:Nn.signal})]).then(([bn,Br])=>{Tn===m.current&&(c(bn.projects),f(Br.tags),p(bn.pagination),$e(bn.pagination.page),g(!0),St(Xt))}).catch(bn=>{!ys(bn)&&Tn===m.current&&X(te(bn))}).finally(()=>{E.current===Nn&&(E.current=null)})};h.useEffect(()=>(T(Oe,kt,K,se,ae),()=>E.current?.abort()),[Oe,kt,K,se,ae]),h.useEffect(()=>{D&&!Oe&&jn===j&&r(u,l,d)},[u,l,d,D,jn,j,Oe]),h.useEffect(()=>{const C=window.setInterval(()=>Sn(Date.now()),6e4);return()=>window.clearInterval(C)},[]);const V=C=>{z(C),localStorage.setItem("texlite-project-view",C)},N=C=>{ut(C),$e(1),localStorage.setItem("texlite-project-sort",C)},he=C=>{jt(C),$e(1)},de=C=>{B(C),$e(1)},ue=async()=>{if(v.trim())try{const{project:C}=await W("/api/projects",{method:"POST",body:JSON.stringify({name:v})});re(!1),Z("");const Ae=Oe||kt!==1?u:[C,...u].slice(0,d.pageSize),ge=Oe?d:{...d,total:d.total+1,totalPages:Math.ceil((d.total+1)/d.pageSize)};c(Ae),p(ge),Oe||r(Ae,l,ge),o(C.id)}catch(C){X(te(C))}},pe=async()=>{if(!S)return;const C=t.maxUploadSizeMB??50;if(S.size>C*1024*1024)return Be(a("errors.fileTooLarge",{size:C}));be(!0),Be("");const Ae=new FormData;Ae.append("file",S);try{const ge=await fetch(`/api/projects/import?name=${encodeURIComponent(H.trim())}`,{method:"POST",body:Ae}),Ge=await ge.json();if(!ge.ok)throw new Error(da(Ge,ge.status,"errors.upload"));const Dt=Ge.project,Ye=Oe||kt!==1?u:[Dt,...u].slice(0,d.pageSize),Xt=Oe?d:{...d,total:d.total+1,totalPages:Math.ceil((d.total+1)/d.pageSize)};c(Ye),p(Xt),Oe||r(Ye,l,Xt),U(!1),ie(null),P(""),o(Dt.id)}catch(ge){Be(te(ge))}finally{be(!1)}},ne=C=>{if(C&&!C.name.toLocaleLowerCase().endsWith(".zip")){Be(a("errors.zipOnly"));return}Be(""),ie(C),C&&!H&&P(C.name.replace(/\.zip$/i,""))},mt=async()=>{await W("/api/auth/logout",{method:"POST"}),s(null)},yt=async()=>{if(ye.trim())try{const C=await W("/api/tags",{method:"POST",body:JSON.stringify({name:ye,color:Le})});f(Ae=>[...Ae,C.tag].sort((ge,Ge)=>ge.name.localeCompare(Ge.name))),Ue(!1),qe(""),ce("blue")}catch(C){X(te(C))}},qt=async C=>{if(!nt)return;const Ae=nt.tags.some(ge=>ge.id===C.id);try{const Ge=(await W(Ae?`/api/projects/${nt.id}/tags/${C.id}`:`/api/projects/${nt.id}/tags`,Ae?{method:"DELETE"}:{method:"POST",body:JSON.stringify({tagId:C.id})})).project;ht(Ge),c(Dt=>Dt.map(Ye=>Ye.id===Ge.id?Ge:Ye))}catch(ge){X(te(ge))}},ke=async()=>{if(!(!Ze||!Ft.trim()))try{const C=await W(`/api/projects/${Ze.id}`,{method:"PATCH",body:JSON.stringify({name:Ft})});c(Ae=>Ae.map(ge=>ge.id===C.project.id?C.project:ge)),Fe(null),J("")}catch(C){X(te(C))}},Ke=async()=>{if(!(!De||!st.trim())){Ce(!0),X("");try{await W(`/api/projects/${De.id}/duplicate`,{method:"POST",body:JSON.stringify({name:st})}),G(null),ft(""),T(Oe,kt,K,se,ae)}catch(C){X(te(C))}finally{Ce(!1)}}},Xe=async()=>{if(ee)try{await W(`/api/projects/${ee.id}`,{method:"DELETE"}),c(Dt=>Dt.filter(Ye=>Ye.id!==ee.id));const C=Math.max(0,d.total-1),Ae=Math.ceil(C/d.pageSize),ge=Ae===0?1:Math.min(kt,Ae),Ge={...d,page:ge,total:C,totalPages:Ae};p(Ge),We(null),ge!==kt?$e(ge):T(Oe,kt,K,se,ae)}catch(C){X(te(C))}},Ct=async C=>{xe(C),vt(""),Ht([]),w(""),we(!0);try{const Ae=await W("/api/users");Ht(Ae.users.filter(ge=>ge.id!==C.ownerId))}catch(Ae){w(te(Ae))}finally{we(!1)}},Ut=async()=>{if(!(!Qe||!bt)){we(!0),w("");try{await W(`/api/projects/${Qe.id}/owner`,{method:"PUT",body:JSON.stringify({userId:bt})}),xe(null),vt(""),T(Oe,kt,K,se,ae)}catch(C){w(te(C))}finally{we(!1)}}},Bt=async C=>{const Ae=!Oe;gn(C.id),X("");try{await W(`/api/projects/${C.id}/archive`,{method:Ae?"PUT":"DELETE"});const ge=u.filter(Tn=>Tn.id!==C.id);c(ge);const Ge=Math.max(0,d.total-1),Dt=Math.ceil(Ge/d.pageSize),Ye=Dt===0?1:Math.min(kt,Dt),Xt={...d,page:Ye,total:Ge,totalPages:Dt};p(Xt),Oe||r(ge,l,Xt),Ye!==kt?$e(Ye):T(Oe,kt,K,se,ae)}catch(ge){X(te(ge))}finally{gn("")}},Re=u,rs=["red","orange","yellow","green","blue","purple","gray"],Bn=C=>new Date(C).toLocaleString(Ie.resolvedLanguage),is=C=>e2(C,Ie.resolvedLanguage??"en",Fn,(Ae,ge)=>a(Ae,ge));return i.jsxs("div",{className:"page",children:[i.jsxs("header",{className:"topbar",children:[i.jsxs("a",{className:"brand-link",href:"/","aria-label":t.siteName,children:[i.jsx("span",{className:"site-title",children:t.siteName}),i.jsx($i,{siteName:t.siteName})]}),i.jsxs("div",{className:"top-actions",children:[e.role==="admin"&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{className:"ghost",onClick:()=>L(!0),children:[i.jsx(hD,{"aria-hidden":!0,size:14}),a("metrics.title")]}),i.jsxs("button",{className:`ghost${y?" top-return-action":""}`,onClick:()=>{x(C=>!C),I(!1)},children:[y?i.jsx(Uo,{"aria-hidden":!0,size:14}):i.jsx(lr,{"aria-hidden":!0,size:14}),a(y?"users.back":"users.manage")]})]}),i.jsxs("button",{className:`ghost${R?" top-return-action":""}`,onClick:()=>{x(!1),I(C=>!C)},children:[R?i.jsx(Uo,{"aria-hidden":!0,size:14}):i.jsx(Cs,{"aria-hidden":!0,size:14}),a(R?"users.back":"citationLibrary.title")]}),i.jsx(Ca,{compact:!0}),i.jsxs("span",{className:"top-user-identity",children:[i.jsx("strong",{children:e.displayName}),i.jsxs("small",{children:["@",e.username]})]}),i.jsx("button",{className:"ghost",onClick:mt,children:a("auth.logout")})]})]}),y?i.jsx(o2,{currentUser:e}):R?i.jsx("main",{className:"dashboard citation-library-page-shell",children:i.jsx(Lh,{page:!0,open:!0,onOpenChange:I,onBack:()=>I(!1),currentUserId:e.id})}):i.jsxs("main",{className:"dashboard",children:[i.jsxs("div",{className:"section-title",children:[i.jsxs("div",{children:[i.jsxs("h1",{children:[i.jsx(qo,{"aria-hidden":!0,size:25}),a("projects.title")]}),i.jsx("p",{className:"muted",children:e.canCreateProjects?a("projects.subtitle"):a("projects.restricted")})]}),i.jsxs("div",{className:"section-actions",children:[i.jsxs("button",{onClick:()=>Ue(!0),children:[i.jsx(Wo,{"aria-hidden":!0,size:15}),a("tags.create")]}),e.canCreateProjects&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{onClick:()=>{Be(""),U(!0)},children:[i.jsx(ci,{"aria-hidden":!0,size:15}),a("projects.upload")]}),i.jsxs("button",{className:"primary",onClick:()=>re(!0),children:[i.jsx(Ul,{"aria-hidden":!0,size:15}),a("projects.new")]})]})]})]}),M&&i.jsx("p",{className:"error",children:M}),i.jsxs("div",{className:"project-toolbar",children:[i.jsx("input",{type:"search",placeholder:a("projects.search"),value:K,onChange:C=>{Pe(C.target.value),$e(1)}}),i.jsxs("div",{className:"project-scope",role:"tablist","aria-label":a("projects.scope"),children:[i.jsxs("button",{className:Oe?"":"active",onClick:()=>he(!1),role:"tab","aria-selected":!Oe,children:[i.jsx(qo,{size:14}),a("projects.active")]}),i.jsxs("button",{className:Oe?"active":"",onClick:()=>he(!0),role:"tab","aria-selected":Oe,children:[i.jsx(Xu,{size:14}),a("projects.archived")]})]}),i.jsxs("div",{className:"tag-filters",children:[i.jsx("button",{className:se?"":"active",onClick:()=>de(""),children:a("projects.allTags")}),l.map(C=>i.jsxs("button",{className:se===C.id?"active":"",onClick:()=>de(se===C.id?"":C.id),children:[i.jsx(jo,{color:C.color}),C.name]},C.id))]}),i.jsxs("label",{className:"project-sort",children:[i.jsx(pD,{size:14}),i.jsx("span",{children:a("projects.sortBy")}),i.jsxs("select",{value:ae,onChange:C=>N(C.target.value),children:[i.jsx("option",{value:"updated",children:a("projects.sortModified")}),i.jsx("option",{value:"created",children:a("projects.sortCreated")})]})]}),i.jsxs("div",{className:"view-toggle",children:[i.jsx("button",{className:$==="grid"?"active":"",onClick:()=>V("grid"),title:a("projects.grid"),children:"▦"}),i.jsx("button",{className:$==="list"?"active":"",onClick:()=>V("list"),title:a("projects.list"),children:"☷"})]})]}),i.jsxs("div",{className:`project-grid ${$==="list"?"list-view":""}`,children:[Re.map(C=>i.jsxs("article",{className:`project-card${C.ownerId===e.id?" owned-project":""}`,children:[$==="grid"&&C.ownerId===e.id&&i.jsxs("button",{className:"project-transfer-action",title:a("projects.transferOwnership"),onClick:()=>{Ct(C)},children:[i.jsx(ao,{"aria-hidden":!0,size:13}),a("projects.transfer")]}),i.jsxs("button",{className:"project-card-open",onClick:()=>o(C.id),children:[i.jsx("span",{className:"owner-badge",title:C.ownerDisplayName??C.ownerUsername,children:C.ownerDisplayName??C.ownerUsername}),i.jsxs("span",{className:"project-card-main",children:[i.jsx("strong",{children:C.name}),i.jsxs("span",{className:"project-tags",children:[C.tags?.map(Ae=>i.jsx("span",{className:`tag tag-${Ae.color}`,children:Ae.name},Ae.id)),!!(C.unresolvedCommentCount&&C.unresolvedCommentCount>0)&&i.jsxs("span",{className:"project-comments-badge unresolved",title:a("projects.unresolvedCommentsTooltip",{unresolved:C.unresolvedCommentCount,total:C.commentCount??C.unresolvedCommentCount}),children:[i.jsx(zl,{"aria-hidden":!0,size:10}),i.jsx("span",{children:a("projects.unresolvedCount",{count:C.unresolvedCommentCount})})]})]})]}),i.jsxs("dl",{className:"project-meta",children:[i.jsxs("div",{children:[i.jsxs("dt",{children:[i.jsx(mD,{"aria-hidden":!0,size:13}),a("projects.created")]}),i.jsx("dd",{children:i.jsx("time",{dateTime:C.createdAt,children:Bn(C.createdAt)})})]}),i.jsxs("div",{children:[i.jsxs("dt",{children:[i.jsx(kD,{"aria-hidden":!0,size:13}),a("projects.modified")]}),i.jsxs("dd",{title:a("projects.modifiedByUser",{time:Bn(C.updatedAt),user:C.lastModifiedDisplayName??C.lastModifiedUsername??a("projects.deletedUser")}),children:[i.jsx("time",{dateTime:C.updatedAt,children:is(C.updatedAt)}),i.jsxs("span",{className:"project-modified-by",children:[" · ",a("projects.byUser",{user:C.lastModifiedDisplayName??C.lastModifiedUsername??a("projects.deletedUser")})]})]})]})]})]}),i.jsxs("div",{className:"project-card-actions",children:[i.jsxs("button",{onClick:()=>ht(C),children:[i.jsx(Wo,{"aria-hidden":!0,size:14}),a("tags.assign")]}),C.permission==="owner"&&i.jsxs("button",{onClick:()=>{Fe(C),J(C.name)},children:[i.jsx(Ko,{"aria-hidden":!0,size:14}),a("projects.rename")]}),(e.role==="admin"||e.canCreateProjects)&&i.jsxs("button",{onClick:()=>{G(C),ft(`${C.name} (1)`)},children:[i.jsx(bD,{"aria-hidden":!0,size:14}),a("projects.duplicate")]}),i.jsxs("a",{href:`/api/projects/${C.id}/download`,download:!0,children:[i.jsx(cr,{"aria-hidden":!0,size:14}),a("projects.download")]}),i.jsxs("button",{disabled:Dn===C.id,onClick:()=>{Bt(C)},children:[Oe?i.jsx(fD,{"aria-hidden":!0,size:14}):i.jsx(Xu,{"aria-hidden":!0,size:14}),a(Oe?"projects.unarchive":"projects.archive")]}),$==="list"&&C.ownerId===e.id&&i.jsxs("button",{onClick:()=>{Ct(C)},children:[i.jsx(ao,{"aria-hidden":!0,size:14}),a("projects.transfer")]}),C.permission==="owner"&&i.jsxs("button",{className:"danger-text",onClick:()=>We(C),children:[i.jsx(Qt,{"aria-hidden":!0,size:14}),a("common.delete")]})]})]},C.id)),Re.length===0&&(u.length===0?Oe?i.jsx("div",{className:"empty",children:a("projects.noArchived")}):i.jsxs("div",{className:"project-empty",children:[i.jsx("span",{className:"project-empty-icon",children:i.jsx(zD,{size:28})}),i.jsx("h2",{children:a("projects.emptyTitle")}),i.jsx("p",{children:e.canCreateProjects?a("projects.emptyDescription"):a("projects.emptyRestricted")})]}):i.jsx("div",{className:"empty",children:a("projects.noMatches")}))]}),d.totalPages>1&&i.jsxs("nav",{className:"project-pagination","aria-label":a("projects.pagination"),children:[i.jsxs("button",{disabled:d.page<=1,onClick:()=>$e(C=>Math.max(1,C-1)),title:a("projects.previousPage"),children:[i.jsx(ir,{size:15}),a("projects.previousPage")]}),i.jsx("span",{children:a("projects.pageOf",{page:d.page,totalPages:d.totalPages,count:d.total})}),i.jsxs("button",{disabled:d.page>=d.totalPages,onClick:()=>$e(C=>Math.min(d.totalPages,C+1)),title:a("projects.nextPage"),children:[i.jsx(vi,{size:15}),a("projects.nextPage")]})]}),i.jsx(it,{open:O,title:a("projects.new"),description:a("projects.newDescription"),onOpenChange:re,footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>re(!1),children:a("common.cancel")}),i.jsx("button",{className:"primary",onClick:()=>{ue()},children:a("common.create")})]}),children:i.jsxs("label",{className:"form-field",children:[a("projects.name"),i.jsx("input",{autoFocus:!0,value:v,onChange:C=>Z(C.target.value),onKeyDown:C=>{C.key==="Enter"&&ue()}})]})}),i.jsx(it,{open:le,title:a("projects.upload"),description:a("projects.uploadDescription",{size:t.maxUploadSizeMB??50}),onOpenChange:C=>{U(C),C||Be("")},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>{U(!1),Be("")},children:a("common.cancel")}),i.jsx("button",{className:"primary",disabled:!S||Ne,onClick:()=>{pe()},children:a(Ne?"projects.importing":"projects.import")})]}),children:i.jsxs("div",{className:"form-stack",children:[je&&i.jsx("p",{className:"error import-error",children:je}),i.jsxs("div",{className:`upload-picker${S?" has-file":""}`,onDragOver:C=>{C.preventDefault(),C.dataTransfer.dropEffect="copy"},onDrop:C=>{C.preventDefault(),ne(C.dataTransfer.files[0]??null)},children:[i.jsx("input",{ref:Me,className:"sr-only",type:"file",accept:".zip,application/zip",onChange:C=>ne(C.target.files?.[0]??null)}),i.jsx(Ho,{size:34}),i.jsxs("div",{className:"upload-picker-copy",children:[i.jsx("strong",{children:S?.name??a("projects.chooseZip")}),i.jsx("span",{children:S?a("projects.selectedFileSize",{size:Rh(S.size)}):a("projects.dropZip")})]}),i.jsxs("button",{type:"button",onClick:()=>Me.current?.click(),children:[i.jsx(ci,{size:15}),a("projects.browse")]}),S&&i.jsx("button",{className:"upload-clear",type:"button",title:a("projects.clearFile"),"aria-label":a("projects.clearFile"),onClick:()=>{ne(null),Me.current&&(Me.current.value="")},children:i.jsx(Jt,{size:14})})]}),i.jsxs("label",{className:"form-field",children:[a("projects.name"),i.jsx("input",{value:H,onChange:C=>P(C.target.value)})]})]})}),i.jsx(it,{open:Se,title:a("tags.create"),description:a("tags.createDescription"),onOpenChange:Ue,footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>Ue(!1),children:a("common.cancel")}),i.jsx("button",{className:"primary",onClick:()=>{yt()},children:a("common.create")})]}),children:i.jsxs("div",{className:"form-stack",children:[i.jsxs("label",{className:"form-field",children:[a("tags.name"),i.jsx("input",{autoFocus:!0,value:ye,onChange:C=>qe(C.target.value)})]}),i.jsxs("fieldset",{className:"color-picker",children:[i.jsx("legend",{children:a("tags.color")}),rs.map(C=>i.jsxs("label",{className:Le===C?"active":"",children:[i.jsx("input",{type:"radio",name:"dashboard-tag-color",checked:Le===C,onChange:()=>ce(C)}),i.jsx(jo,{color:C}),a(`tags.${C}`)]},C))]})]})}),i.jsx(it,{open:!!nt,title:a("tags.assignTitle",{project:nt?.name??""}),description:a("tags.assignDescription"),onOpenChange:C=>{C||ht(null)},footer:i.jsx("button",{onClick:()=>ht(null),children:a("common.close")}),children:i.jsxs("div",{className:"tag-assignment-list",children:[l.map(C=>i.jsxs("label",{children:[i.jsx("input",{type:"checkbox",checked:!!nt?.tags.some(Ae=>Ae.id===C.id),onChange:()=>{qt(C)}}),i.jsx(jo,{color:C.color}),i.jsx("span",{children:C.name})]},C.id)),l.length===0&&i.jsx("p",{className:"muted",children:a("tags.empty")})]})}),i.jsx(it,{open:!!Ze,title:a("projects.renameTitle"),onOpenChange:C=>{C||Fe(null)},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>Fe(null),children:a("common.cancel")}),i.jsx("button",{className:"primary",onClick:()=>{ke()},children:a("projects.rename")})]}),children:i.jsxs("label",{className:"form-field",children:[a("projects.name"),i.jsx("input",{autoFocus:!0,value:Ft,onChange:C=>J(C.target.value),onKeyDown:C=>{C.key==="Enter"&&ke()}})]})}),i.jsx(it,{open:!!De,title:a("projects.duplicateTitle"),description:a("projects.duplicateDescription",{project:De?.name??""}),onOpenChange:C=>{!C&&!Q&&(G(null),ft(""))},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{disabled:Q,onClick:()=>{G(null),ft("")},children:a("common.cancel")}),i.jsx("button",{className:"primary",disabled:Q||!st.trim(),onClick:()=>{Ke()},children:a(Q?"projects.duplicating":"projects.duplicate")})]}),children:i.jsxs("label",{className:"form-field",children:[a("projects.name"),i.jsx("input",{autoFocus:!0,value:st,onChange:C=>ft(C.target.value),onKeyDown:C=>{C.key==="Enter"&&Ke()}})]})}),i.jsx(it,{open:!!Qe,title:a("projects.transferOwnership"),description:a("projects.transferDescription",{project:Qe?.name??""}),onOpenChange:C=>{!C&&!rt&&(xe(null),vt(""),w(""))},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{disabled:rt,onClick:()=>{xe(null),vt(""),w("")},children:a("common.cancel")}),i.jsxs("button",{className:"primary",disabled:rt||!bt,onClick:()=>{Ut()},children:[rt?i.jsx(Lt,{className:"spin",size:14}):i.jsx(ao,{size:14}),a("projects.transfer")]})]}),children:i.jsxs("div",{className:"form-stack",children:[pt&&i.jsx("p",{className:"error dialog-error",children:pt}),i.jsxs("label",{className:"form-field",children:[a("projects.newOwner"),i.jsxs("select",{disabled:rt||et.length===0,value:bt,onChange:C=>vt(C.target.value),children:[i.jsx("option",{value:"",children:rt?a("common.loading"):et.length>0?a("projects.chooseNewOwner"):a("projects.noTransferUsers")}),et.map(C=>i.jsxs("option",{value:C.id,children:[C.displayName??C.username," (@",C.username,")"]},C.id))]})]}),i.jsxs("p",{className:"warning",children:[i.jsx(Rs,{size:15}),a("projects.transferWarning")]})]})}),i.jsx(Os,{open:!!ee,title:a("projects.deleteTitle"),description:a("projects.deleteDescription",{project:ee?.name??""}),confirmLabel:a("common.delete"),danger:!0,onCancel:()=>We(null),onConfirm:()=>{Xe()}})]}),A&&i.jsx(h.Suspense,{fallback:null,children:i.jsx(Qb,{open:!0,onOpenChange:L})}),i.jsx(su,{})]})}function jo({color:t}){return i.jsx("span",{className:`tag-dot tag-${t}`})}function i2(t=10){const e="ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789!@#$%",n=crypto.getRandomValues(new Uint8Array(t));return Array.from(n,r=>e[r%e.length]).join("")}function o2({currentUser:t}){const{t:e}=at(),[n,r]=h.useState([]),[s,o]=h.useState(""),[a,u]=h.useState(!1),[c,l]=h.useState({username:"",displayName:"",password:"",role:"user",canCreateProjects:!1}),[f,d]=h.useState(null),[p,D]=h.useState(""),[g,y]=h.useState(null),[x,A]=h.useState(!1),L=()=>W("/api/admin/users").then(({users:v})=>r(v)).catch(v=>o(te(v)));h.useEffect(()=>{L()},[]);const R=async()=>{if(c.password.length<Rt)return o(e("auth.passwordMinimum",{count:Rt}));try{await W("/api/admin/users",{method:"POST",body:JSON.stringify({username:c.username,displayName:c.displayName||c.username,password:c.password,role:c.role,canCreateProjects:c.canCreateProjects})}),u(!1),l({username:"",displayName:"",password:"",role:"user",canCreateProjects:!1}),await L()}catch(v){o(te(v))}},I=async v=>{try{await W(`/api/admin/users/${v.id}`,{method:"PATCH",body:JSON.stringify({disabled:!v.disabled})}),await L()}catch(Z){o(te(Z))}},M=async v=>{try{await W(`/api/admin/users/${v.id}`,{method:"PATCH",body:JSON.stringify({role:v.role==="admin"?"user":"admin"})}),await L()}catch(Z){o(te(Z))}},X=async v=>{try{await W(`/api/admin/users/${v.id}`,{method:"PATCH",body:JSON.stringify({canCreateProjects:!v.canCreateProjects})}),await L()}catch(Z){o(te(Z))}},O=async()=>{if(!(!f||!p)){if(p.length<Rt)return o(e("auth.passwordMinimum",{count:Rt}));try{await W(`/api/admin/users/${f.id}`,{method:"PATCH",body:JSON.stringify({password:p})}),d(null),D("")}catch(v){o(te(v))}}},re=async()=>{if(g)try{await W(`/api/admin/users/${g.id}`,{method:"DELETE",body:JSON.stringify({deleteProjects:x})}),y(null),A(!1),await L()}catch(v){o(te(v))}};return i.jsxs("main",{className:"dashboard",children:[i.jsxs("div",{className:"section-title",children:[i.jsxs("div",{children:[i.jsxs("h1",{children:[i.jsx(lr,{"aria-hidden":!0,size:25}),e("users.manage")]}),i.jsx("p",{className:"muted",children:e("users.onlyAdmin")})]}),i.jsxs("button",{className:"primary icon-button",onClick:()=>u(!0),children:[i.jsx(Xo,{"aria-hidden":!0,size:15}),e("users.add")]})]}),s&&i.jsx("p",{className:"error",children:s}),i.jsx("div",{className:"table-card",children:i.jsxs("table",{children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:e("common.user")}),i.jsx("th",{children:e("users.role")}),i.jsx("th",{children:e("users.createProjects")}),i.jsx("th",{children:e("users.ownedProjects")}),i.jsx("th",{children:e("users.status")}),i.jsx("th",{children:e("users.actions")})]})}),i.jsx("tbody",{children:n.map(v=>i.jsxs("tr",{children:[i.jsxs("td",{children:[i.jsx("strong",{children:v.displayName}),i.jsxs("small",{children:["@",v.username]})]}),i.jsx("td",{children:v.role==="admin"?e("common.admin"):e("common.user")}),i.jsx("td",{children:v.canCreateProjects?e("users.allow"):e("users.deny")}),i.jsx("td",{children:v.ownedProjects}),i.jsx("td",{children:v.disabled?e("common.disabled"):e("common.normal")}),i.jsxs("td",{children:[i.jsxs("button",{className:"icon-button",disabled:v.id===t.id,onClick:()=>I(v),children:[v.disabled?i.jsx(HD,{"aria-hidden":!0,size:13}):i.jsx(qD,{"aria-hidden":!0,size:13}),v.disabled?e("users.enable"):e("users.disable")]}),i.jsxs("button",{className:"icon-button",disabled:v.id===t.id,onClick:()=>M(v),children:[v.role==="admin"?i.jsx(UD,{"aria-hidden":!0,size:13}):i.jsx($D,{"aria-hidden":!0,size:13}),v.role==="admin"?e("users.demote"):e("users.promote")]}),i.jsxs("button",{className:"icon-button",disabled:v.role==="admin",onClick:()=>X(v),children:[v.canCreateProjects?i.jsx(wD,{"aria-hidden":!0,size:13}):i.jsx(xD,{"aria-hidden":!0,size:13}),v.canCreateProjects?e("users.denyCreate"):e("users.allowCreate")]}),i.jsxs("button",{className:"icon-button",onClick:()=>{d(v),D("")},children:[i.jsx(Zu,{"aria-hidden":!0,size:13}),e("users.resetPassword")]}),i.jsxs("button",{className:"icon-button danger-text",disabled:v.id===t.id,onClick:()=>{y(v),A(!1)},children:[i.jsx(Qt,{"aria-hidden":!0,size:13}),e("common.delete")]})]})]},v.id))})]})}),i.jsx(it,{open:a,title:e("users.add"),description:e("users.addDescription"),onOpenChange:u,footer:i.jsxs(i.Fragment,{children:[i.jsxs("button",{className:"icon-button",onClick:()=>u(!1),children:[i.jsx(Jt,{"aria-hidden":!0,size:14}),e("common.cancel")]}),i.jsxs("button",{className:"primary icon-button",disabled:c.password.length<Rt,onClick:()=>{R()},children:[i.jsx(Xo,{"aria-hidden":!0,size:14}),e("users.createUser")]})]}),children:i.jsxs("div",{className:"form-stack",children:[i.jsxs("label",{className:"form-field",children:[e("auth.username"),i.jsx("input",{value:c.username,onChange:v=>l({...c,username:v.target.value})})]}),i.jsxs("label",{className:"form-field",children:[e("users.displayName"),i.jsx("input",{value:c.displayName,onChange:v=>l({...c,displayName:v.target.value})})]}),i.jsxs("label",{className:"form-field",children:[e("users.initialPassword"),i.jsxs("span",{className:"password-generator",children:[i.jsx("input",{minLength:Rt,autoComplete:"new-password",value:c.password,onChange:v=>l({...c,password:v.target.value})}),i.jsxs("button",{type:"button",title:e("users.generatePassword"),onClick:()=>l({...c,password:i2()}),children:[i.jsx(yD,{size:15}),e("users.randomPassword")]})]}),i.jsx("small",{className:"field-hint",children:e("auth.passwordMinimum",{count:Rt})})]}),i.jsxs("label",{className:"form-field",children:[e("users.role"),i.jsxs("select",{value:c.role,onChange:v=>l({...c,role:v.target.value}),children:[i.jsx("option",{value:"user",children:e("common.user")}),i.jsx("option",{value:"admin",children:e("common.admin")})]})]}),i.jsxs("label",{className:"checkbox-field",children:[i.jsx("input",{type:"checkbox",checked:c.canCreateProjects||c.role==="admin",disabled:c.role==="admin",onChange:v=>l({...c,canCreateProjects:v.target.checked})})," ",e("users.allowCreate")]})]})}),i.jsx(it,{open:!!f,title:e("users.resetPassword"),description:e("users.resetDescription",{username:f?.username??""}),onOpenChange:v=>{v||d(null)},footer:i.jsxs(i.Fragment,{children:[i.jsxs("button",{className:"icon-button",onClick:()=>d(null),children:[i.jsx(Jt,{"aria-hidden":!0,size:14}),e("common.cancel")]}),i.jsxs("button",{className:"primary icon-button",disabled:p.length<Rt,onClick:()=>{O()},children:[i.jsx(Zu,{"aria-hidden":!0,size:14}),e("users.reset")]})]}),children:i.jsxs("label",{className:"form-field",children:[e("auth.newPassword"),i.jsx("input",{autoFocus:!0,type:"password",minLength:Rt,autoComplete:"new-password",value:p,onChange:v=>D(v.target.value)}),i.jsx("small",{className:"field-hint",children:e("auth.passwordMinimum",{count:Rt})})]})}),i.jsx(it,{open:!!g,title:e("users.deleteTitle"),description:e("users.deleteDescription",{username:g?.username??""}),onOpenChange:v=>{v||y(null)},footer:i.jsxs(i.Fragment,{children:[i.jsxs("button",{className:"icon-button",onClick:()=>y(null),children:[i.jsx(Jt,{"aria-hidden":!0,size:14}),e("common.cancel")]}),i.jsxs("button",{className:"danger icon-button",onClick:()=>{re()},children:[i.jsx(Qt,{"aria-hidden":!0,size:14}),e("users.deleteTitle")]})]}),children:i.jsxs("fieldset",{className:"choice-group",children:[i.jsx("legend",{children:e("users.ownedChoice",{count:g?.ownedProjects??0})}),i.jsxs("label",{children:[i.jsx("input",{type:"radio",checked:!x,onChange:()=>A(!1)})," ",e("users.transferProjects")]}),i.jsxs("label",{children:[i.jsx("input",{type:"radio",checked:x,onChange:()=>A(!0)})," ",e("users.deleteProjects")]})]})})]})}function a2({site:t,user:e,projectId:n,onBack:r}){const{t:s}=at(),[o,a]=h.useState(null),[u,c]=h.useState(!1),[l,f]=h.useState([]),[d,p]=h.useState(null),[D,g]=h.useState([]),[y,x]=h.useState(""),[A,L]=h.useState(""),[R,I]=h.useState(new Set),[M,X]=h.useState(""),[O,re]=h.useState(""),[v,Z]=h.useState(!1),[le,U]=h.useState("editor.saved"),[H,P]=h.useState(null),S=h.useRef(H);S.current=H;const[ie,je]=h.useState({line:1,column:1}),Be=h.useRef(ie),Me=h.useRef(0),[Ne,be]=h.useState("pdf"),[K,Pe]=h.useState("log"),se=b=>{if(b==="pdf"){be("pdf");return}Pe(b),be("diagnostics")},{workspaceLayout:B,setWorkspaceLayout:Se}=qb(e.id,n),[Ue,ye]=h.useState(""),[qe,Le]=h.useState(""),[ce,nt]=h.useState({selectedText:"",startOffset:0,endOffset:0}),ht=h.useRef({selectedText:"",startOffset:0,endOffset:0}),Ze=b=>{ht.current=b,nt(b)},[Fe,Ft]=h.useState(null),[J,De]=h.useState(!1),[G,st]=h.useState(!1),[ft,Q]=h.useState(!1),[Ce,ee]=h.useState(!1),[We,Qe]=h.useState(!1),[xe,et]=h.useState(null),[Ht,bt]=h.useState(!1),[vt,rt]=h.useState(!1),[we,pt]=h.useState(!1),[w,$]=h.useState(()=>nc(e.id,n)),[z,ae]=h.useState([]),ut=h.useRef([]);ut.current=z;const Oe=h.useRef(null),jt=h.useRef(null),Dn=h.useRef(0),gn=h.useRef(0),kt=h.useRef(""),$e=h.useRef(""),Fn=h.useRef(""),Sn=h.useRef(""),jn=h.useRef(0),St=h.useRef(null),m=h.useRef(null),E=h.useRef(null),F=h.useRef(null),j=h.useRef(!1),T=h.useRef(null),V=h.useRef(r);V.current=r,Fn.current=A;const N=(b,k,_=0)=>{const Y={line:b,column:k};Be.current=Y,Me.current=_,je(Y)},he=b=>{const k=ut.current,_=b(k);_!==k&&(ut.current=_,ae(_))};h.useEffect(()=>{ut.current=[],ae([])},[n]);const de=b=>{const k=ut.current,_=k.indexOf(b);if(_<0)return;const Y=k.filter(_e=>_e!==b);if(ut.current=Y,ae(Y),$e.current!==b)return;const Ee=Y.length>0?Y[Math.min(_,Y.length-1)]:o?.mainFile??"";x(Ee)},{collaboration:ue,status:pe,synced:ne,activeSessions:mt,compileState:yt,setCompileState:qt,filesEvent:ke,commentsRevision:Ke,dictionaryRevision:Xe,localDraftReady:Ct,permission:Ut,reconnect:Bt}=_b(n,e,A,o?.permission??"read",u,()=>U("editor.offlineDraft")),{pdfTarget:Re,pdfViewport:rs,sourceJump:Bn,setPdfViewport:is,clearPdfViewport:C,jumpToSource:Ae,syncSourceToPdf:ge,syncPdfToSource:Ge,syncVisiblePdfToSource:Dt}=Hb({projectId:n,mainFile:A,activeFile:y,onActiveFile:x,onError:ye,onShowPdf:()=>se("pdf")}),Ye=Vb({active:!!(o&&y&&ne&&w.spellCheck),activeFile:y,content:M,dictionaryWords:l});h.useEffect(()=>{$(nc(e.id,n))},[e.id,n]);const Xt=b=>{kt.current=b,X(b)};h.useEffect(()=>{if($e.current=y,Be.current={line:1,column:1},Me.current=0,je({line:1,column:1}),Ze({selectedText:"",startOffset:0,endOffset:0}),!w.openFilesInTabs){ut.current.length>0&&(ut.current=[],ae([]));return}y&&he(b=>b.includes(y)?b:[...b,y])},[y,w.openFilesInTabs,n]),h.useEffect(()=>{if(!v)return;const b=k=>{k.preventDefault(),k.returnValue=""};return window.addEventListener("beforeunload",b),()=>window.removeEventListener("beforeunload",b)},[v]),h.useEffect(()=>{if(pe!=="disconnected")return;const b=new AbortController;return W(`/api/projects/${n}`,{signal:b.signal}).then(({project:k})=>{b.signal.aborted||(a(k),ye(""))}).catch(k=>{if(!ys(k)){if(k instanceof la&&[401,403,404].includes(k.status)){ye(te(k)),V.current();return}ye(s("errors.collaborationUnavailable"))}}),()=>b.abort()},[pe,n,s]);const Tn=async(b={})=>{St.current?.abort(),St.current=null;const k=b.signal?null:new AbortController;k&&(St.current=k);try{const _=await W(`/api/projects/${n}/completions`,{signal:b.signal??k?.signal});(!b.isCurrent||b.isCurrent())&&p(_.index)}catch(_){if(ys(_))return;(!b.isCurrent||b.isCurrent())&&p(null)}finally{k&&St.current===k&&(St.current=null)}},Nn=async(b={},k=Fn.current)=>{m.current?.abort(),m.current=null;const _=b.signal?null:new AbortController;_&&(m.current=_);try{const Y=k?`?mainFile=${encodeURIComponent(k)}`:"",Ee=await W(`/api/projects/${n}/outline${Y}`,{signal:b.signal??_?.signal});(!b.isCurrent||b.isCurrent())&&g(Ee.outline)}catch(Y){!ys(Y)&&(!b.isCurrent||b.isCurrent())&&g([])}finally{_&&m.current===_&&(m.current=null)}},bn=async(b={})=>{E.current?.abort(),E.current=null;const k=b.signal?null:new AbortController;k&&(E.current=k);try{const _=await W(`/api/projects/${n}/dictionary`,{signal:b.signal??k?.signal});(!b.isCurrent||b.isCurrent())&&f(_.words)}catch(_){if(ys(_))return;(!b.isCurrent||b.isCurrent())&&f([])}finally{k&&E.current===k&&(E.current=null)}};h.useEffect(()=>{let b=!1;const k=++jn.current,_=new AbortController,Y=()=>!b&&jn.current===k;let Ee=!1;Sn.current="",a(null),ru([]),g([]),x(""),L(""),I(new Set),X(""),re(""),qt(null),C(),p(null),f([]),Oh();const _e=W(`/api/projects/${n}`,{signal:_.signal}).then(Je=>{Y()&&(Ee=!0,a(Je.project),x(Je.project.mainFile),L(Je.project.mainFile),I(new Set([Je.project.mainFile])),uu(new Set(nr(Je.project.mainFile))))}).catch(Je=>{Y()&&ye(te(Je))}),Te=W(`/api/projects/${n}/files`,{signal:_.signal}).then(Je=>{Y()&&ru(Je.files)}).catch(Je=>{Y()&&ye(te(Je))});let rn=null;return Promise.allSettled([_e,Te]).then(()=>{!Y()||!Ee||(rn=window.setTimeout(()=>{Y()&&Promise.all([Tn({signal:_.signal,isCurrent:Y}),bn({signal:_.signal,isCurrent:Y})])},0))}),()=>{b=!0,rn!==null&&window.clearTimeout(rn),_.abort(),St.current?.abort(),St.current=null,m.current?.abort(),m.current=null,E.current?.abort(),E.current=null,F.current?.abort(),F.current=null}},[n]),h.useEffect(()=>{Xe&&bn()},[Xe,n]),h.useEffect(()=>{!o||pe!=="connected"||Ut===o.permission||a(b=>b&&{...b,permission:Ut})},[Ut,o?.permission]),h.useEffect(()=>{if(!ke)return;const b=ke.kind==="delete"&&!!ke.path&&Kn(ke.path,$e.current),k=ke.kind==="delete"&&!!ke.path&&Kn(ke.path,Fn.current);if(ke.kind==="move"&&ke.source&&ke.destination){const Y=ke.source,Ee=ke.destination,_e=Te=>Te===Y?Ee:Te.startsWith(`${Y}/`)?`${Ee}${Te.slice(Y.length)}`:Te;x(Te=>_e(Te)),L(Te=>_e(Te)),I(Te=>new Set([...Te].map(_e))),Tr(Te=>Te&&_e(Te)),he(Te=>Te.map(_e))}b&&(x(""),re(""),Xt(""),Le(s("editor.fileDeletedByCollaborator",{path:ke.path}))),ke.kind==="delete"&&ke.path&&(I(Y=>new Set([...Y].filter(Ee=>!Kn(ke.path,Ee)))),Tr(Y=>Kn(ke.path,Y)?"":Y),ou(Y=>Y&&Kn(ke.path,Y.path)?null:Y),he(Y=>Y.filter(Ee=>!Kn(ke.path,Ee)))),F.current?.abort();const _=new AbortController;F.current=_,Promise.all([Uh({signal:_.signal}),W(`/api/projects/${n}`,{signal:_.signal})]).then(([Y,Ee])=>{if(a(Ee.project),k&&L(Ee.project.mainFile),b&&Y){const _e=Y.find(Te=>Te.type==="file"&&Te.path===Ee.project.mainFile)??Y.find(Te=>Te.type==="file"&&Ns(Te.path));x(_e?.path??"")}Tn({signal:_.signal}),Nn({signal:_.signal},k?Ee.project.mainFile:Fn.current)}).catch(Y=>{ys(Y)}).finally(()=>{F.current===_&&(F.current=null)})},[ke?.revision]),h.useEffect(()=>{if(ue.setActiveFile(y),!y)return;re(""),U("editor.loading");const b=ue.getText(y),k=(_,Y)=>{Xt(b.toString()),re(y),Y?.local&&o?.permission!=="read"?(Dn.current+=1,Z(!0),U("editor.pending")):Dn.current<=gn.current&&U(S.current?"editor.savedAt":"editor.saved")};return b.observe(k),(ne||Ct)&&k(),()=>{b.unobserve(k)}},[y,ue,ne,Ct,o?.permission]),h.useEffect(()=>{!y||O!==y||Sn.current===y||(Sn.current=y,!(!y.toLocaleLowerCase().endsWith(".tex")||!u2(M))&&(I(b=>new Set([...b,y])),L(y)))},[y,O,M]);const Br=async()=>{if(!ne)throw new Error("Collaboration is not synchronized");const b=Dn.current,k=await ue.flush();return gn.current=Math.max(gn.current,b),P(k.persistedAt),/\.tex$/i.test($e.current)&&Nn(),Dn.current===b?(Z(!1),U("editor.savedAt")):U("editor.pending"),k};h.useEffect(()=>{if(!v||!y)return;if(!ne){U("editor.offlineDraft");return}U("editor.pending");const b=window.setTimeout(()=>{U("editor.saving"),Br().catch(()=>{U(ue.connected?"editor.saveFailed":"editor.offlineDraft")})},750);return()=>window.clearTimeout(b)},[M,v,y,ne]);const Js=async()=>{if(!o||o.permission==="read"||!ne||!y)return!1;U("editor.saving");try{return await Br(),Tn(),!0}catch(b){return U("editor.saveFailed"),ye(te(b)||s("errors.collaborationUnavailable")),!1}},Ui=async(b,k)=>/\.bib$/i.test(b)?s0(k):XD(k,w.texFmtConfig),Ph=async()=>{if(!o||o.permission==="read"||!ne||j.current||!Yr($e.current))return;const b=$e.current,k=ue.getText(b),_=k.toString();j.current=!0,pt(!0);let Y=()=>{};const Ee=new Promise(_e=>{Y=_e});T.current=Ee;try{const _e=await Ui(b,_);if($e.current!==b||k.toString()!==_){ye(s("editor.formatSourceChanged"));return}const Te=await lo(_,_e);if($e.current!==b||k.toString()!==_){ye(s("editor.formatSourceChanged"));return}Te.length&&ue.applyTextEdits(b,Te),ye(""),Le(s("editor.formatFileComplete"))}catch(_e){ye(s("editor.formatFileFailed",{message:te(_e)}))}finally{j.current=!1,pt(!1),Y(),T.current===Ee&&(T.current=null)}},_h=async()=>{if(!w.formatOnCompile||!o||o.permission==="read"||!ne||!Yr($e.current)||j.current)return;const b=$e.current,k=ue.getText(b),_=k.toString();j.current=!0,pt(!0);try{const Y=await Ui(b,_),Ee=await lo(_,Y);if($e.current!==b||k.toString()!==_)throw new Error(s("editor.formatSourceChanged"));Ee.length&&ue.applyTextEdits(b,Ee)}catch(Y){ye(s("editor.formatFailedContinue",{message:te(Y)}))}finally{j.current=!1,pt(!1)}},Ih=async()=>(T.current&&await T.current,await _h(),Js()),Mh=async()=>{if(!o||o.permission==="read"||!ne||j.current||!Yr($e.current))return;const b=ht.current;if(!b.selectedText.trim()){Le(s("editor.formatSelectionRequired"));return}const k=$e.current,{startOffset:_,endOffset:Y,selectedText:Ee}=b,_e=ue.getText(k);if(_e.toString().slice(_,Y)!==Ee){ye(s("editor.formatSelectionChanged"));return}j.current=!0,pt(!0);let Te=()=>{};const rn=new Promise(Je=>{Te=Je});T.current=rn;try{const Je=ZD(Ee,await Ui(k,Ee)),Ur=await lo(Ee,Je,_);if($e.current!==k||_e.toString().slice(_,Y)!==Ee){ye(s("editor.formatSelectionChanged"));return}Ur.length&&ue.applyTextEdits(k,Ur),ye(""),Le(s("editor.formatSelectionComplete"))}catch(Je){ye(s("editor.formatFailed",{message:te(Je)}))}finally{j.current=!1,pt(!1),Te(),T.current===rn&&(T.current=null)}},$h=b=>{const k=$e.current;if(!/\.bib$/i.test(k)||o?.permission==="read"||!ne)return Le(s("citationLibrary.importRequiresWrite")),!1;const Y=ue.getText(k).toString();if(Wl(Y).some(Ur=>Ur.citationKey.toLowerCase()===b.citationKey.toLowerCase()))return Le(s("citationErrors.alreadyInFile",{key:b.citationKey})),!1;const Ee=Math.max(0,Math.min(Y.length,Me.current)),_e=Y.slice(0,Ee),Te=Y.slice(Ee),rn=_e?_e.endsWith(`
49
+
50
+ `)?"":_e.endsWith(`
51
+ `)?`
52
+ `:`
53
+
54
+ `:"",Je=Te?Te.startsWith(`
55
+
56
+ `)?"":Te.startsWith(`
57
+ `)?`
58
+ `:`
59
+
60
+ `:"";return ue.applyTextEdits(k,[{from:Ee,to:Ee,replacement:`${rn}${b.bibtex.trim()}${Je}`}]),Le(s("citationLibrary.imported",{key:b.citationKey})),!0},{files:yn,setFiles:ru,loadFiles:Uh,newFileOpen:zh,setNewFileOpen:zi,newFilePath:Vh,setNewFilePath:iu,resourcePreview:ct,setResourcePreview:ou,resourcePreviewLoading:Hh,setResourcePreviewLoading:qh,newFolderOpen:Kh,setNewFolderOpen:Vi,newFolderName:Gh,setNewFolderName:au,fileDialogError:Ln,setFileDialogError:os,selectedFolder:zn,setSelectedFolder:Tr,expandedFolders:Yh,setExpandedFolders:uu,moveEntry:Zs,setMoveEntry:Nr,moveName:cu,setMoveName:Lr,moveDestination:Wh,setMoveDestination:Hi,deleteEntry:as,setDeleteEntry:Or,fileDragActive:lu,setFileDragActive:qi,uploadConflict:Ki,setUploadConflict:du,uploadingFiles:Rr,directoryEntries:Xh,visibleEntries:Jh,createFile:Zh,createFolder:hu,uploadFiles:fu,upload:Qh,openFile:Gi,movePath:pu,removePath:ef}=zb({projectId:n,site:t,activeFile:y,dirty:v,save:Js,onError:ye,onProject:a,onActiveFile:x,onActiveMainFile:L,onRootDocuments:I});h.useEffect(()=>{if(!w.openFilesInTabs||yn.length===0)return;const b=new Set(yn.filter(k=>k.type==="file"&&Ns(k.path)).map(k=>k.path));he(k=>{const _=k.filter(Y=>b.has(Y));return _.length===k.length?k:_})},[yn,w.openFilesInTabs]);const{comments:Qs,focusComment:tf,setFocusComment:mu,commentOpen:nf,setCommentOpen:Yi,commentText:sf,setCommentText:rf,addComment:of,toggleComment:af,replyToComment:uf,editComment:cf,deleteComment:lf,editCommentReply:df,deleteCommentReply:hf}=Rb({projectId:n,activeFile:y,permission:o?.permission,revision:Ke,selection:ce,save:Js,onError:ye,onAdded:()=>Ft("comments")}),{pdfUrl:sn,pdfCompiledAt:us,pdfLoading:Wi,compileLog:Pr,compileDiagnostics:_r,compileOutcome:Ir,artifacts:Xi,artifactPreview:ff,artifactLoading:pf,editorNotice:Du,localCompiling:Ji,cleaning:gu,compile:mf,cleanCompile:Df,viewArtifact:gf}=Ib({projectId:n,project:o,mainFile:A,collaborationSynced:ne,sharedState:yt,onSharedState:qt,save:Ih,loadOutline:(b,k)=>Nn({signal:b},k),onPreviewTab:se,onError:ye,onCompileStart:()=>{ye(""),Le("")},onCompileSuccess:()=>{const b=$e.current;b&&ge(b,Be.current.line,Be.current.column,{silent:!0})},onPdfChanged:C});h.useEffect(()=>{if(!o||!A||!sn&&Wi)return;const b=window.setTimeout(()=>c(!0),sn?150:0);return()=>window.clearTimeout(b)},[o,Wi,sn]),h.useEffect(()=>{const b=k=>{(k.ctrlKey||k.metaKey)&&(!k.shiftKey&&k.key.toLocaleLowerCase()==="p"?(k.preventDefault(),bt(!0)):k.shiftKey&&k.key.toLocaleLowerCase()==="f"&&(k.preventDefault(),rt(!0)))};return window.addEventListener("keydown",b,!0),()=>window.removeEventListener("keydown",b,!0)},[]);const Ff=b=>{$(b),YD(e.id,n,b)},Fu=()=>{jt.current?.isCollapsed()?jt.current.expand():jt.current?.collapse()},bu=h.useMemo(()=>D.length?D:c2(M).map(b=>({...b,path:y})),[D,M,y]),cs=h.useMemo(()=>u0(Pr,Ir),[Pr,Ir]),Vn=B!=="pdf-only",yu=B!=="editor-only",Mr=b=>{Se(b),b==="pdf-only"&&se("pdf")},Zi=as?mt.filter(b=>b.filePath&&Kn(as.path,b.filePath)):[];if(!o)return i.jsxs("div",{className:"center-card",children:[i.jsx("p",{children:Ue||s("common.loading")}),Ue&&i.jsx("button",{className:"primary",onClick:r,children:s("editor.backToProjects")})]});const It=o.permission==="read"||!ne,bf=(b,k)=>{if(It)return;const _=$e.current;if(!_)return;if(ue.getText(_).toString().slice(b.from,b.to)!==b.word){ye(s("editor.spellCheckSourceChanged"));return}try{ue.applyTextEdits(_,[{from:b.from,to:b.to,replacement:k}])}catch(_e){ye(te(_e))}},$r=yt?.mainFile===A&&(yt.status==="queued"||yt.status==="running"),ls=Ji||$r||gu,Cu=y?ue.getText(y):null,Eu=us?new Date(us).toLocaleString(Ie.resolvedLanguage,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"",yf=A.split("/").at(-1)??A,Cf=cs.warnings.length+cs.errors.length+Xi.length,xu=sn?`${sn}${sn.includes("?")?"&":"?"}download=1`:"",Ef=A||o.mainFile,Hn=!!(y&&y===Ef&&/\.tex$/i.test(y)),wu=b=>{const k=yn.find(_=>_.path===b);k&&Ns(k.path)?Gi(k):de(b)},xf=b=>{document.getElementById(`editor-tab-${encodeURIComponent(b)}`)?.focus()},wf=(b,k)=>{if(!["ArrowLeft","ArrowRight","Home","End"].includes(b.key))return;b.preventDefault();const _=b.key==="Home"?0:b.key==="End"?z.length-1:(k+(b.key==="ArrowLeft"?-1:1)+z.length)%z.length,Y=z[_];Y&&(wu(Y),window.requestAnimationFrame(()=>xf(Y)))},Au=ls?$r?yt?.status==="queued"?s("editor.compileQueued"):s("editor.compilingBy",{name:yt?.requestedBy.name??s("common.user")}):s("editor.compiling"):Ir==="failed"?sn&&us?s("editor.compileFailedRetained",{time:new Date(us).toLocaleString(Ie.resolvedLanguage)}):s("editor.compileFailedNoPdf"):"",Af=le==="editor.savedAt"&&H?s("editor.savedAt",{time:new Date(H).toLocaleTimeString(Ie.resolvedLanguage,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}):s(le);return i.jsxs("div",{className:"workspace",children:[i.jsxs("header",{className:"editor-topbar",children:[i.jsx("button",{className:"back",title:s("editor.backToProjects"),"aria-label":s("editor.backToProjects"),onClick:r,children:i.jsx(Uo,{size:18})}),i.jsx("a",{className:"brand-link compact-brand-link",href:"/","aria-label":t.siteName,onClick:b=>{b.preventDefault(),r()},children:i.jsx($i,{siteName:t.siteName,compact:!0})}),i.jsxs("div",{className:"project-heading",children:[i.jsx("strong",{children:o.name}),i.jsxs("small",{children:[y," · ",Af]})]}),w.vimMode&&i.jsxs("span",{className:"vim-status-badge",title:s("editor.vimOnHint"),children:[i.jsx(jD,{size:14}),s("editor.vimOn")]}),i.jsx(Ab,{sessions:mt,status:pe}),pe==="disconnected"&&i.jsxs("div",{className:"collaboration-recovery",role:"status",children:[i.jsx("span",{children:s("editor.collaboration.disconnected")}),i.jsx("button",{type:"button",onClick:Bt,children:s("editor.collaboration.reconnect")})]}),i.jsxs("div",{className:"editor-actions",children:[Vn&&i.jsxs("button",{className:J?"":"active",onClick:Fu,children:[J?i.jsx(TD,{size:15}):i.jsx(ec,{size:15}),s("common.files")]}),i.jsx(vb,{value:B,onChange:Mr}),i.jsxs("button",{onClick:()=>st(!0),children:[i.jsx(lr,{size:15}),s("projectSettings.share")]}),Vn&&/\.bib$/i.test(y)&&i.jsxs("button",{className:We?"active":"",onClick:()=>Qe(!0),children:[i.jsx(Cs,{size:15}),s("citationLibrary.title")]}),i.jsxs("div",{className:"version-action",role:"group","aria-label":s("common.version"),children:[i.jsxs("div",{className:"version-action-label",children:[i.jsx(vD,{size:14}),i.jsx("span",{children:s("common.version")})]}),i.jsxs("div",{className:"version-action-options",children:[i.jsx("button",{type:"button",className:"version-action-history",title:s("history.title"),onClick:()=>ee(!0),children:s("history.title")}),i.jsx("button",{type:"button",className:"version-action-git",title:o.ownerId===e.id?s("git.title"):s("git.ownerOnly"),disabled:o.ownerId!==e.id,onClick:()=>Q(!0),children:"Git"})]})]}),Vn&&o.permission!=="read"&&Yr(y)&&i.jsxs("div",{className:"format-action",role:"group","aria-label":s("editor.format"),"aria-busy":we,children:[i.jsxs("div",{className:"format-action-label",children:[i.jsx(Ml,{size:14}),i.jsx("span",{children:s("editor.format")})]}),i.jsxs("div",{className:"format-action-options",children:[i.jsx("button",{type:"button",className:"format-action-file",title:s("editor.formatFileHint"),onMouseDown:b=>b.preventDefault(),onClick:()=>{Ph()},disabled:It||we||!ne,children:s("editor.formatFile")}),i.jsx("button",{type:"button",className:"format-action-selected",title:ce.selectedText.trim()?s("editor.formatSelection"):s("editor.formatSelectionHint"),onMouseDown:b=>b.preventDefault(),onClick:()=>{Mh()},disabled:It||we||!ne||!ce.selectedText.trim(),children:s("editor.formatSelected")})]})]}),i.jsxs("div",{className:"comments-action",role:"group","aria-label":s("common.comments"),children:[i.jsxs("div",{className:"comments-action-label",children:[i.jsx(zl,{size:14}),i.jsx("span",{children:s("common.comments")})]}),i.jsxs("div",{className:"comments-action-options",children:[i.jsx("button",{type:"button",className:"comments-action-add",title:s("editor.addComment"),"aria-label":s("editor.addComment"),onMouseDown:b=>b.preventDefault(),onClick:()=>Yi(!0),disabled:!y,children:s("editor.commentsAdd")}),i.jsxs("button",{type:"button",className:`comments-action-all${Fe==="comments"?" active":""}`,title:s("editor.commentsAll"),onClick:()=>Ft(Fe==="comments"?null:"comments"),children:[s("editor.commentsAll")," ",Qs.filter(b=>!b.resolved).length||""]})]})]}),i.jsxs("button",{className:Fe==="settings"?"active":"",onClick:()=>Ft(Fe==="settings"?null:"settings"),children:[i.jsx(Yo,{size:15}),s("common.settings")]}),i.jsxs("button",{className:"compile",title:$r?s("editor.compilingBy",{name:yt?.requestedBy.name??""}):s("editor.compileShortcut"),onClick:mf,disabled:ls||we||It||!ne,children:[ls?i.jsx(Lt,{className:"spin",size:15}):i.jsx(PD,{size:15}),$r?s("editor.compilingBy",{name:yt?.requestedBy.name??""}):Ji?s("editor.compiling"):s("editor.compile",{engine:o.engine})]})]})]}),Au&&i.jsxs("div",{className:`compile-status-strip${Ir==="failed"?" failed":""}`,role:"status","aria-live":"polite",children:[i.jsx(Lt,{className:ls?"spin":"",size:14}),i.jsx("span",{children:Au})]}),Ue&&i.jsx("div",{className:"toast",onClick:()=>ye(""),children:Ue}),qe&&i.jsx("div",{className:"toast success",onClick:()=>Le(""),children:qe}),i.jsxs(Sf,{autoSaveId:"texlite-workspace-layout",direction:"horizontal",className:"work-grid",children:[Vn&&i.jsx(zr,{id:"files",order:1,ref:jt,defaultSize:16,minSize:12,maxSize:30,collapsible:!0,collapsedSize:0,onCollapse:()=>De(!0),onExpand:()=>De(!1),children:i.jsxs("aside",{className:"left-panel",children:[i.jsxs("section",{className:`files-panel${lu?" drop-active":""}`,onDragEnter:b=>{b.dataTransfer.types.includes("Files")&&(b.preventDefault(),!It&&!Rr&&qi(!0))},onDragOver:b=>{b.dataTransfer.types.includes("Files")&&(b.preventDefault(),b.dataTransfer.dropEffect=It||Rr?"none":"copy")},onDragLeave:b=>{b.currentTarget.contains(b.relatedTarget)||qi(!1)},onDrop:b=>{b.preventDefault(),qi(!1),!It&&!Rr&&fu(Array.from(b.dataTransfer.files))},children:[i.jsxs("div",{className:"panel-title",children:[i.jsx("span",{children:s("common.files")}),i.jsxs("span",{className:"file-tools",children:[i.jsx("button",{"aria-label":s("navigation.quickOpen"),title:`${s("navigation.quickOpen")} (Ctrl/Cmd+P)`,onClick:()=>bt(!0),children:i.jsx(ED,{size:15})}),i.jsx("button",{"aria-label":s("navigation.projectSearch"),title:`${s("navigation.projectSearch")} (Ctrl/Cmd+Shift+F)`,onClick:()=>rt(!0),children:i.jsx(Hl,{size:15})}),!It&&i.jsxs(i.Fragment,{children:[i.jsx("button",{disabled:Rr,"aria-label":s("editor.uploadAttachment"),title:s("editor.uploadTo",{folder:zn||s("editor.projectRoot")}),onClick:()=>Oe.current?.click(),children:i.jsx(ci,{size:15})}),i.jsx("button",{"aria-label":s("editor.newFolder"),title:s("editor.newFolder"),onClick:()=>{au(""),Vi(!0)},children:i.jsx(Ul,{size:15})}),i.jsx("button",{"aria-label":s("editor.newFile"),title:s("editor.newFile"),onClick:()=>{iu(zn?`${zn}/`:""),zi(!0)},children:i.jsx(CD,{size:15})}),i.jsx("input",{ref:Oe,type:"file",multiple:!0,hidden:!0,onChange:b=>{Qh(b)}})]}),i.jsx("button",{"aria-label":s("editor.collapseFiles"),title:s("editor.collapseFiles"),onClick:Fu,children:i.jsx(ec,{size:15})})]})]}),lu&&i.jsxs("div",{className:"file-drop-overlay",children:[i.jsx(ci,{size:24}),i.jsx("strong",{children:s("editor.dropFiles")}),i.jsx("span",{children:s("editor.uploadTo",{folder:zn||s("editor.projectRoot")})})]}),i.jsxs("div",{className:"file-list",style:{fontSize:`${w.fontSize}px`},children:[i.jsx("div",{className:`file-entry folder-entry root-entry${zn===""?" selected":""}`,children:i.jsxs("button",{className:"file-entry-main",onClick:()=>Tr(""),children:[i.jsx(qo,{size:15}),i.jsx("span",{children:s("editor.projectRoot")})]})}),Jh.map(b=>{const k=b.path.split("/").length-1,_=b.path.split("/").at(-1),Y=Yh.has(b.path),Ee=R.has(b.path),_e=A===b.path,Te=b.path!==o.mainFile&&!o.mainFile.startsWith(`${b.path}/`);return b.type==="directory"?i.jsxs("div",{className:`file-entry folder-entry${zn===b.path?" selected":""}`,style:{paddingLeft:`${k*13+5}px`},children:[i.jsxs("button",{className:"file-entry-main",title:b.path,onClick:()=>{Tr(b.path),uu(rn=>{const Je=new Set(rn);return Je.has(b.path)?Je.delete(b.path):Je.add(b.path),Je})},children:[Y?i.jsx($l,{size:13}):i.jsx(vi,{size:13}),i.jsx(AD,{size:14}),i.jsx("span",{children:_})]}),!It&&i.jsxs(i.Fragment,{children:[i.jsx("button",{className:"file-entry-action",title:s("editor.move"),"aria-label":s("editor.move"),onClick:()=>{Nr(b),Lr(_??""),Hi("")},children:i.jsx(Qu,{size:13})}),Te&&i.jsx("button",{className:"file-entry-action danger-text",title:s("editor.deletePath"),"aria-label":s("editor.deletePath"),onClick:()=>{Or(b),os("")},children:i.jsx(Qt,{size:13})})]})]},b.path):i.jsxs("div",{className:`file-entry${y===b.path?" active":""}${Ee?" root-document":""}${_e?" compile-target":""}`,style:{paddingLeft:`${k*13+18}px`},children:[i.jsxs("button",{className:"file-entry-main",title:_e?s("editor.currentMainDocument",{path:b.path}):Ee?s("editor.mainDocumentCandidate",{path:b.path}):b.path,onClick:()=>Gi(b),children:[Ee?i.jsx(zo,{size:13}):i.jsx(Es,{size:13}),i.jsx("span",{children:_}),_e&&i.jsx("small",{children:s("editor.currentMainShort")})]}),!It&&i.jsxs(i.Fragment,{children:[i.jsx("button",{className:"file-entry-action",title:s("editor.move"),"aria-label":s("editor.move"),onClick:()=>{Nr(b),Lr(_??""),Hi("")},children:i.jsx(Qu,{size:13})}),Te&&i.jsx("button",{className:"file-entry-action danger-text",title:s("editor.deletePath"),"aria-label":s("editor.deletePath"),onClick:()=>{Or(b),os("")},children:i.jsx(Qt,{size:13})})]})]},b.path)})]})]}),i.jsxs("section",{className:"outline-panel",children:[i.jsx("div",{className:"panel-title",children:i.jsxs("span",{children:[i.jsx(BD,{size:14}),s("common.outline")]})}),i.jsxs("div",{className:"outline",children:[bu.map((b,k)=>i.jsxs("button",{className:`outline-item${y===b.path&&ie.line===b.line?" current":""}`,title:`${b.path}:${b.line}`,onClick:()=>{Ae(b.path,b.line,1),ge(b.path,b.line,1)},children:[i.jsx("span",{className:"outline-guides","aria-hidden":!0,style:{width:`${b.level*12}px`}}),i.jsx("small",{children:b.path===y?b.line:b.path.split("/").at(-1)}),i.jsx("span",{className:"outline-title",children:b.title})]},`${b.path}-${b.line}-${k}`)),bu.length===0&&i.jsx("p",{className:"muted padded",children:s("editor.noOutline")})]})]})]})}),Vn&&i.jsx(Qi,{className:"resize-handle",children:i.jsx(uo,{size:12})}),Vn&&i.jsx(zr,{id:"source",order:2,defaultSize:42,minSize:22,children:i.jsxs("main",{className:"source-panel",children:[w.openFilesInTabs&&z.length>0&&i.jsx("div",{className:"editor-tabs-bar",role:"tablist","aria-label":s("editor.openFiles"),children:i.jsx("div",{className:"editor-tabs-scroll",children:z.map((b,k)=>{const _=b===y,Y=b===(A||o.mainFile),Ee=b.split("/").at(-1)||b;return i.jsxs("div",{className:`editor-tab-item${_?" active":""}`,role:"presentation",children:[i.jsxs("button",{id:`editor-tab-${encodeURIComponent(b)}`,type:"button",role:"tab","aria-selected":_,"aria-controls":"editor-source-content",tabIndex:_?0:-1,className:`editor-tab${_?" active":""}${Y?" main-tab":""}`,onClick:()=>wu(b),onKeyDown:_e=>wf(_e,k),title:b,children:[i.jsx("span",{className:"editor-tab-icon",children:Y?i.jsx(zo,{size:13}):i.jsx(Es,{size:13})}),i.jsx("span",{className:"editor-tab-title",children:Ee}),Y&&i.jsx("small",{className:"editor-tab-badge",children:s("editor.currentMainShort")})]}),i.jsx("button",{type:"button",className:"editor-tab-close",title:s("common.close"),"aria-label":`${s("common.close")} ${Ee}`,onClick:()=>de(b),children:i.jsx(Jt,{size:12})})]},b)})})}),i.jsxs("div",{id:"editor-source-content",className:"editor-content-container",children:[i.jsx(h.Suspense,{fallback:i.jsxs("div",{className:"preview-empty",children:[i.jsx(Lt,{className:"spin",size:22}),i.jsx("span",{children:s("common.loading")})]}),children:i.jsx(Yb,{value:M,filePath:y,readOnly:It,comments:Qs,focusComment:tf,preferences:w,completionIndex:d,spellCheckIssues:Ye.issues,spellCheckJump:Ye.jump,jumpTo:O===y&&Bn?.path===y?Bn:null,searchRequest:0,collaboration:Cu?{text:Cu,awareness:ue.awareness,undoManager:It?void 0:ue.getUndoManager(y)}:void 0,onChange:Xt,onSelection:(b,k,_)=>Ze({selectedText:b,startOffset:k,endOffset:_}),onCommentClick:b=>{const k=Qs.find(_=>_.id===b);k&&(mu({...k}),Ft("comments"))},onSpellCheckReplace:bf,onCursor:N},y)}),Du&&i.jsx("div",{className:"editor-centered-notice",role:"status","aria-live":"polite",children:Du})]})]})}),Vn&&yu&&i.jsxs(Qi,{className:"resize-handle sync-resize-handle",children:[i.jsx(uo,{className:"resize-grip",size:12}),i.jsxs("span",{className:"sync-direction-buttons",onPointerDown:b=>b.stopPropagation(),children:[i.jsx("button",{disabled:!rs||!Hn,title:s(Hn?"editor.showInSource":"editor.syncTexOnlyForMain"),"aria-label":s("editor.showInSource"),onClick:()=>{if(!Hn){Le(s("editor.syncTexOnlyForMain"));return}Dt()},children:i.jsx("span",{"aria-hidden":!0,children:"←"})}),i.jsx("button",{disabled:!y||!sn||!Hn,title:s(Hn?"editor.showInPdf":"editor.syncTexOnlyForMain"),"aria-label":s("editor.showInPdf"),onClick:()=>{if(!Hn){Le(s("editor.syncTexOnlyForMain"));return}ge(y,ie.line,ie.column)},children:i.jsx("span",{"aria-hidden":!0,children:"→"})})]})]}),yu&&i.jsx(zr,{id:"preview",order:3,defaultSize:42,minSize:22,children:i.jsxs("section",{className:"preview-panel",children:[i.jsxs("div",{className:"preview-tabs",children:[i.jsxs("div",{className:"preview-tab-list",role:"tablist","aria-label":s("editor.outputTabs"),children:[i.jsxs("button",{role:"tab","aria-selected":Ne==="pdf",className:`pdf-tab${Ne==="pdf"?" active":""}`,onClick:()=>se("pdf"),title:us?s("editor.pdfCompiledAtFor",{file:A,time:new Date(us).toLocaleString(Ie.resolvedLanguage)}):s("editor.currentMainDocument",{path:A}),children:[i.jsx(Es,{size:16}),i.jsxs("span",{className:"pdf-tab-label",children:["PDF · ",yf,Eu&&i.jsx("small",{children:Eu})]})]}),i.jsxs("button",{role:"tab","aria-selected":Ne==="diagnostics",className:`diagnostics-tab${Ne==="diagnostics"?" active":""}`,onClick:()=>be("diagnostics"),children:[i.jsx(Go,{size:14}),s("editor.outputTabs"),i.jsx("span",{children:Cf})]})]}),xu&&i.jsxs("a",{className:"pdf-download-top",href:xu,download:!0,title:s("editor.downloadPdf"),"aria-label":s("editor.downloadPdf"),children:[i.jsx(cr,{size:15}),i.jsx("span",{children:s("editor.downloadPdf")})]})]}),Ne==="diagnostics"&&i.jsxs("div",{className:"preview-subtabs",role:"tablist","aria-label":s("editor.outputTabs"),children:[i.jsxs("button",{role:"tab","aria-selected":K==="log",className:K==="log"?"active":"",onClick:()=>se("log"),children:[i.jsx(Go,{size:13}),s("editor.log")]}),i.jsxs("button",{role:"tab","aria-selected":K==="warnings",className:K==="warnings"?"active":"",onClick:()=>se("warnings"),children:[i.jsx(Rs,{size:13}),s("editor.warnings"),i.jsx("span",{children:cs.warnings.length})]}),i.jsxs("button",{role:"tab","aria-selected":K==="errors",className:K==="errors"?"active":"",onClick:()=>se("errors"),children:[i.jsx(Ea,{size:13}),s("editor.errors"),i.jsx("span",{children:cs.errors.length})]}),i.jsxs("button",{role:"tab","aria-selected":K==="artifacts",className:K==="artifacts"?"active":"",onClick:()=>se("artifacts"),children:[i.jsx(Vl,{size:13}),s("editor.artifacts"),i.jsx("span",{children:Xi.length})]}),i.jsxs("button",{role:"tab","aria-selected":K==="clean",className:K==="clean"?"active":"",onClick:()=>se("clean"),children:[i.jsx(Vo,{size:13}),s("editor.clean")]})]}),i.jsxs("div",{className:`preview-content preview-${Ne} ${Ne==="diagnostics"?`preview-${K}`:""}`,children:[Ne==="pdf"&&(sn?i.jsx(h.Suspense,{fallback:i.jsxs("div",{className:"pdf-loading-state",role:"status","aria-live":"polite",children:[i.jsx(Lt,{className:"spin",size:24}),i.jsx("span",{children:s("editor.loadingPdf")})]}),children:i.jsx(Gb,{url:sn,target:Re,compiling:ls,onViewportLocation:(b,k,_)=>is({page:b,x:k,y:_}),onDoubleClickLocation:(b,k,_)=>{if(is({page:b,x:k,y:_}),!Hn){Le(s("editor.syncTexOnlyForMain"));return}Ge(b,k,_)}})}):Wi?i.jsxs("div",{className:"pdf-loading-state",role:"status","aria-live":"polite",children:[i.jsx(Lt,{className:"spin",size:24}),i.jsx("span",{children:s("editor.loadingPdf")})]}):i.jsxs("div",{className:"preview-empty",children:[i.jsx(Es,{size:28}),i.jsx("strong",{children:s("editor.preview")}),i.jsx("span",{children:s("editor.previewHint")})]})),Ne==="diagnostics"&&K==="log"&&i.jsx(ko,{lines:Pr?Pr.split(`
61
+ `):[],empty:s(Ji?"editor.compiling":"editor.noLog")}),Ne==="diagnostics"&&K==="warnings"&&(_r?i.jsx($c,{tone:"warning",diagnostics:_r.warnings,files:yn,empty:s("editor.noWarnings"),onJump:(b,k,_)=>{B==="pdf-only"&&Mr("editor-pdf"),Ae(b,k,_)}}):i.jsx(ko,{tone:"warning",lines:cs.warnings,empty:s("editor.noWarnings")})),Ne==="diagnostics"&&K==="errors"&&(_r?i.jsx($c,{tone:"error",diagnostics:_r.errors,files:yn,empty:s("editor.noErrors"),onJump:(b,k,_)=>{B==="pdf-only"&&Mr("editor-pdf"),Ae(b,k,_)}}):i.jsx(ko,{tone:"error",lines:cs.errors,empty:s("editor.noErrors")})),Ne==="diagnostics"&&K==="artifacts"&&i.jsx(Bb,{projectId:n,mainFile:A,artifacts:Xi,preview:ff,loading:pf,onView:b=>{gf(b)}}),Ne==="diagnostics"&&K==="clean"&&i.jsx(Tb,{mainFile:A,disabled:It||!ne||ls,cleaning:gu,onCleanCache:()=>et("cache"),onCleanArtifacts:()=>et("artifacts")})]})]})}),Fe&&i.jsxs(i.Fragment,{children:[i.jsx(Qi,{className:"resize-handle",children:i.jsx(uo,{size:12})}),i.jsx(zr,{id:"context",order:4,defaultSize:20,minSize:15,maxSize:38,children:i.jsxs("aside",{className:"context-panel",children:[i.jsxs("div",{className:"drawer-title",children:[i.jsx("strong",{children:s(Fe==="comments"?"editor.sourceComments":"editor.projectSettings")}),i.jsx("button",{"aria-label":s("common.close"),onClick:()=>Ft(null),children:i.jsx(Jt,{size:17})})]}),Fe==="comments"&&i.jsxs("div",{className:"comments",children:[Qs.map(b=>i.jsx(kb,{comment:b,currentUserId:e.id,onFocus:()=>mu({...b}),onToggle:()=>{af(b)},onReply:k=>uf(b,k),onEdit:k=>cf(b,k),onDelete:()=>lf(b),onEditReply:(k,_)=>df(b,k,_),onDeleteReply:k=>hf(b,k)},b.id)),Qs.length===0&&i.jsx("p",{className:"muted padded",children:s("editor.noComments")})]}),Fe==="settings"&&i.jsx(jb,{project:o,projectId:n,site:t,files:yn,dictionaryWords:l,onDictionaryChange:f,editorPreferences:w,onEditorPreferences:Ff,spellCheckCount:Ye.summary?.total??null,spellCheckUniqueCount:Ye.summary?.unique??null,spellCheckIndex:Ye.summary?Ye.index:-1,onSpellCheckNavigate:Ye.jumpToIssue,onProject:a})]})})]})]}),i.jsxs(it,{open:!!ct,extraWide:ct?.kind==="image"||ct?.kind==="pdf"||ct?.kind==="text",title:ct?.path??"",description:ct?.kind==="large"?s("editor.resourceTooLarge",{size:Rh(ct.size),limit:"10 MB"}):s(`editor.resourcePreview.${ct?.kind??"text"}`),onOpenChange:b=>{b||(ou(null),qh(!1))},footer:ct&&i.jsxs("a",{className:"primary resource-download",href:`${ct.url}&download=1`,download:!0,children:[i.jsx(cr,{size:14}),s("editor.downloadResource")]}),children:[ct?.kind==="large"&&i.jsxs("div",{className:"resource-preview-message",children:[i.jsx(Ho,{size:34}),i.jsx("strong",{children:s("editor.resourceTooLargeTitle")}),i.jsx("span",{children:s("editor.resourceTooLargeDescription")})]}),ct?.kind==="unsupported"&&i.jsxs("div",{className:"resource-preview-message",children:[i.jsx(Ho,{size:34}),i.jsx("strong",{children:s("editor.resourceUnsupportedTitle")}),i.jsx("span",{children:s("editor.resourceUnsupportedDescription")})]}),ct?.kind==="image"&&i.jsx("div",{className:"resource-image-wrap",children:i.jsx("img",{className:"resource-image",src:ct.url,alt:ct.path})}),ct?.kind==="pdf"&&i.jsx("iframe",{className:"resource-pdf",src:ct.url,title:ct.path}),ct?.kind==="text"&&(Hh?i.jsxs("div",{className:"resource-preview-message",children:[i.jsx(Lt,{className:"spin",size:24}),i.jsx("span",{children:s("common.loading")})]}):i.jsx("pre",{className:"resource-text",children:ct.content}))]}),i.jsx(Os,{open:!!Ki,title:s("editor.uploadOverwriteTitle"),description:s("editor.uploadOverwriteDescription",{files:Ki?.collisions.join(", ")??""}),confirmLabel:s("editor.uploadOverwrite"),danger:!0,onCancel:()=>du(null),onConfirm:()=>{const b=Ki;du(null),b&&fu(b.files,new Set(b.collisions),b.directory)}}),i.jsx(Os,{open:!!xe,title:s(xe==="cache"?"editor.cleanCacheConfirmTitle":"editor.cleanArtifactsConfirmTitle"),description:s(xe==="cache"?"editor.cleanCacheConfirmDescription":"editor.cleanArtifactsConfirmDescription"),confirmLabel:s("editor.cleanConfirm"),danger:xe==="artifacts",onCancel:()=>et(null),onConfirm:()=>{const b=xe;et(null),b&&Df(b)}}),i.jsx(it,{open:zh,title:s("editor.newFile"),description:s("editor.newFileDescription"),onOpenChange:b=>{zi(b),b||os("")},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>zi(!1),children:s("common.cancel")}),i.jsx("button",{className:"primary",onClick:()=>{Zh()},children:s("common.create")})]}),children:i.jsxs(i.Fragment,{children:[Ln&&i.jsx("p",{className:"error dialog-error",children:Ln}),i.jsxs("label",{className:"form-field",children:[s("editor.filePath"),i.jsx("input",{autoFocus:!0,value:Vh,onChange:b=>iu(b.target.value)})]})]})}),i.jsx(it,{open:Kh,title:s("editor.newFolder"),description:s("editor.folderDestination",{folder:zn||s("editor.projectRoot")}),onOpenChange:b=>{Vi(b),b||os("")},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>Vi(!1),children:s("common.cancel")}),i.jsx("button",{className:"primary",onClick:()=>{hu()},children:s("common.create")})]}),children:i.jsxs(i.Fragment,{children:[Ln&&i.jsx("p",{className:"error dialog-error",children:Ln}),i.jsxs("label",{className:"form-field",children:[s("editor.folderName"),i.jsx("input",{autoFocus:!0,value:Gh,onChange:b=>au(b.target.value),onKeyDown:b=>{b.key==="Enter"&&hu()}})]})]})}),i.jsx(it,{open:!!Zs,title:s("editor.moveTitle",{name:Zs?.path.split("/").at(-1)??""}),description:s("editor.moveDescription"),onOpenChange:b=>{b||(Nr(null),Lr(""),os(""))},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>Nr(null),children:s("common.cancel")}),i.jsx("button",{className:"primary",disabled:!cu.trim(),onClick:()=>{pu()},children:s("editor.moveApply")})]}),children:i.jsxs(i.Fragment,{children:[Ln&&i.jsx("p",{className:"error dialog-error",children:Ln}),i.jsxs("label",{className:"form-field",children:[s("editor.pathName"),i.jsx("input",{autoFocus:!0,value:cu,onChange:b=>Lr(b.target.value),onKeyDown:b=>{b.key==="Enter"&&pu()}})]}),i.jsxs("label",{className:"form-field",children:[s("editor.destinationFolder"),i.jsxs("select",{value:Wh,onChange:b=>Hi(b.target.value),children:[i.jsx("option",{value:"",children:s("editor.projectRoot")}),Xh.filter(b=>Zs?.type!=="directory"||b.path!==Zs.path&&!b.path.startsWith(`${Zs.path}/`)).map(b=>i.jsx("option",{value:b.path,children:b.path},b.path))]})]})]})}),i.jsx(it,{open:!!as,title:s("editor.deletePathTitle",{name:as?.path.split("/").at(-1)??""}),description:Zi.length?s("editor.deletePathActiveDescription",{path:as?.path??"",users:[...new Set(Zi.map(b=>b.name))].join(", ")}):s("editor.deletePathDescription",{path:as?.path??""}),onOpenChange:b=>{b||(Or(null),os(""))},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>Or(null),children:s("common.cancel")}),i.jsx("button",{className:"danger",onClick:()=>{ef()},children:s("common.delete")})]}),children:i.jsxs(i.Fragment,{children:[Ln&&i.jsx("p",{className:"error dialog-error",children:Ln}),Zi.length>0&&i.jsxs("p",{className:"warning",children:[i.jsx(Rs,{size:15}),s("editor.deletePathWillClose")]})]})}),i.jsxs(it,{open:nf,title:s("editor.addComment"),description:ce.selectedText?s("editor.commentDescription",{count:ce.endOffset-ce.startOffset}):s("editor.pointComment"),onOpenChange:Yi,footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>Yi(!1),children:s("common.cancel")}),i.jsx("button",{className:"primary",onClick:()=>{of()},children:s("editor.addComment")})]}),children:[i.jsxs("label",{className:"form-field",children:[s("editor.commentContent"),i.jsx("textarea",{autoFocus:!0,rows:5,value:sf,onChange:b=>rf(b.target.value)})]}),ce.selectedText&&i.jsx("blockquote",{className:"selection-preview",children:ce.selectedText})]}),i.jsx(Sb,{open:G,onOpenChange:st,project:o,projectId:n}),i.jsx(Lh,{open:We,onOpenChange:Qe,currentFile:y,currentSource:M,readOnly:It,currentUserId:e.id,onInsert:$h}),Ht&&i.jsx(h.Suspense,{fallback:null,children:i.jsx(Zb,{open:!0,files:yn,onOpenChange:bt,onOpenFile:b=>{const k=yn.find(_=>_.path===b);k&&Gi(k)}})}),vt&&i.jsx(h.Suspense,{fallback:null,children:i.jsx(Jb,{open:!0,project:o,onOpenChange:rt,onJump:(b,k,_)=>{B==="pdf-only"&&Mr("editor-pdf"),Ae(b,k,_)}})}),Ce&&i.jsx(h.Suspense,{fallback:null,children:i.jsx(Xb,{open:!0,onOpenChange:ee,project:o,onBeforeMutation:o.permission==="read"?async()=>!0:Js})}),o.ownerId===e.id&&ft&&i.jsx(h.Suspense,{fallback:null,children:i.jsx(Wb,{open:!0,onOpenChange:Q,project:o,onBeforeMutation:Js})})]})}function u2(t){const n=t.split(/(?<=\n)/).map(r=>{for(let s=0;s<r.length;s+=1){if(r[s]!=="%")continue;let o=0;for(let a=s-1;a>=0&&r[a]==="\\";a-=1)o+=1;if(o%2===0)return`${r.slice(0,s)}${r.endsWith(`
62
+ `)?`
63
+ `:""}`}return r}).join("").replace(/\\verb\*?([^\s]).*?\1/g,"").replace(/\\begin\{(?:verbatim\*?|Verbatim|lstlisting|minted)\}[\s\S]*?\\end\{(?:verbatim\*?|Verbatim|lstlisting|minted)\}/g,"");return/\\documentclass\s*(?:\[[^\]]*\]\s*)?\{/.test(n)}function Rh(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/1024/1024).toFixed(1)} MB`}function c2(t){const e=[],n=/^\s*\\(part|chapter|section|subsection|subsubsection)\*?(?:\[[^\]]*\])?\{([^}]*)\}/,r={part:0,chapter:0,section:1,subsection:2,subsubsection:3};return t.split(`
64
+ `).forEach((s,o)=>{const a=s.match(n);a&&e.push({level:r[a[1]],title:a[2],line:o+1})}),e}class l2 extends h.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,n){console.error("Uncaught error in component tree:",e,n)}handleReset=()=>{this.setState({hasError:!1,error:null}),this.props.onReset?.()};render(){return this.state.hasError?typeof this.props.fallback=="function"?this.props.fallback(this.state.error??new Error("Unknown error"),this.handleReset):this.props.fallback?this.props.fallback:i.jsxs("div",{role:"alert",style:{padding:"2rem",margin:"1rem",borderRadius:"8px",backgroundColor:"var(--bg-secondary, #f8f9fa)",border:"1px solid var(--border-color, #e9ecef)",color:"var(--text-primary, #212529)",fontFamily:"system-ui, -apple-system, sans-serif"},children:[i.jsx("h2",{style:{fontSize:"1.25rem",fontWeight:600,marginBottom:"0.5rem",color:"#dc3545"},children:this.props.title??Ie.t("errors.boundaryTitle")}),i.jsx("p",{style:{fontSize:"0.9rem",color:"var(--text-secondary, #6c757d)",marginBottom:"1rem"},children:Ie.t("errors.boundaryDescription")}),i.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[i.jsx("button",{type:"button",onClick:this.handleReset,className:"primary",style:{padding:"0.4rem 0.8rem",borderRadius:"4px",cursor:"pointer"},children:Ie.t("errors.boundaryRetry")}),i.jsx("button",{type:"button",onClick:()=>window.location.reload(),style:{padding:"0.4rem 0.8rem",borderRadius:"4px",cursor:"pointer"},children:Ie.t("errors.boundaryReload")})]})]}):this.props.children}}jf.createRoot(document.getElementById("root")).render(i.jsx(h.StrictMode,{children:i.jsx(l2,{children:i.jsx(t2,{})})}));export{hD as A,$l as C,Es as F,vD as G,Zu as K,Lt as L,it as M,ei as P,ID as R,ui as S,Qt as T,q1 as U,dn as _,F2 as a,b2 as b,g2 as c,y2 as d,es as e,p2 as f,Cn as g,f2 as h,q as i,vi as j,W as k,Os as l,ka as m,Hl as n,ED as o,Wn as p,D2 as r,m2 as t};