texlite 0.8.1 → 0.8.3

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 (86) hide show
  1. package/README.md +36 -14
  2. package/README.zh-CN.md +34 -14
  3. package/dist/client/assets/{GitDialog-CZRQPg3O.js → GitDialog-Ds1IhVJ3.js} +1 -1
  4. package/dist/client/assets/{HistoryDialog-BQtr58Co.js → HistoryDialog-BOLQxHvV.js} +3 -3
  5. package/dist/client/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  6. package/dist/client/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  7. package/dist/client/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  8. package/dist/client/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  9. package/dist/client/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  10. package/dist/client/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  11. package/dist/client/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  12. package/dist/client/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  13. package/dist/client/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  14. package/dist/client/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  15. package/dist/client/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  16. package/dist/client/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  17. package/dist/client/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  18. package/dist/client/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  19. package/dist/client/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  20. package/dist/client/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  21. package/dist/client/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  22. package/dist/client/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  23. package/dist/client/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  24. package/dist/client/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  25. package/dist/client/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  26. package/dist/client/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  27. package/dist/client/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  28. package/dist/client/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  29. package/dist/client/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  30. package/dist/client/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  31. package/dist/client/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  32. package/dist/client/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  33. package/dist/client/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  34. package/dist/client/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  35. package/dist/client/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  36. package/dist/client/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  37. package/dist/client/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  38. package/dist/client/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  39. package/dist/client/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  40. package/dist/client/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  41. package/dist/client/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  42. package/dist/client/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  43. package/dist/client/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  44. package/dist/client/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  45. package/dist/client/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  46. package/dist/client/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  47. package/dist/client/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  48. package/dist/client/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  49. package/dist/client/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  50. package/dist/client/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  51. package/dist/client/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  52. package/dist/client/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  53. package/dist/client/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  54. package/dist/client/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  55. package/dist/client/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  56. package/dist/client/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  57. package/dist/client/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  58. package/dist/client/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  59. package/dist/client/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  60. package/dist/client/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  61. package/dist/client/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  62. package/dist/client/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  63. package/dist/client/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  64. package/dist/client/assets/LatexEditor-2BD2xa8h.js +65 -0
  65. package/dist/client/assets/{PdfPreview-D5CC-vqV.js → PdfPreview-DwKlkGl9.js} +1 -1
  66. package/dist/client/assets/{ProjectNavigationDialogs-BdtTldSa.js → ProjectNavigationDialogs-D6grphxz.js} +1 -1
  67. package/dist/client/assets/{SystemMetricsDialog-CEbYJdj7.js → SystemMetricsDialog-CxiyDnsC.js} +1 -1
  68. package/dist/client/assets/{editor-DMLs-XWi.js → editor-CiK7TK0p.js} +13 -13
  69. package/dist/client/assets/index-BoLY1azn.js +64 -0
  70. package/dist/client/assets/index-DzzqNm9b.css +1 -0
  71. package/dist/client/assets/katex-CEK31ho9.css +1 -0
  72. package/dist/client/assets/katex-COYOr4nK.js +257 -0
  73. package/dist/client/assets/{minus-KzdrD7TK.js → minus-DK3ejRQp.js} +1 -1
  74. package/dist/client/assets/{spellCheck-CDZ9ZXo6.js → spellCheck-BAgtQ60E.js} +1 -1
  75. package/dist/client/index.html +2 -2
  76. package/dist/server/db.js +4 -0
  77. package/dist/server/i18n.js +4 -0
  78. package/dist/server/lucideIcons.js +46 -0
  79. package/dist/server/projectIcons.js +96 -0
  80. package/dist/server/routes/projectShared.js +1 -0
  81. package/dist/server/routes/projects.js +114 -7
  82. package/package.json +2 -1
  83. package/preview-1.png +0 -0
  84. package/dist/client/assets/LatexEditor-XLwZxO6_.js +0 -59
  85. package/dist/client/assets/index-BAFR6u6_.js +0 -64
  86. package/dist/client/assets/index-g5CaToD6.css +0 -1
@@ -1,64 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PdfPreview-D5CC-vqV.js","assets/react-BoEjKzFZ.js","assets/pdf-BB1XvBIF.js","assets/minus-KzdrD7TK.js","assets/SystemMetricsDialog-CEbYJdj7.js","assets/spellCheck-CDZ9ZXo6.js","assets/LatexEditor-XLwZxO6_.js","assets/editor-DMLs-XWi.js","assets/GitDialog-CZRQPg3O.js","assets/HistoryDialog-BQtr58Co.js","assets/ProjectNavigationDialogs-BdtTldSa.js"])))=>i.map(i=>d[i]);
2
- import{i as Mp,u as st,j as i,r as f,R as Ir,a as Pu,b as $p,P as Mi,c as $a,d as Up,e as zp}from"./react-BoEjKzFZ.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&s(a)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}})();var wo={};const Be=t=>typeof t=="string",fr=()=>{let t,e;const n=new Promise((s,r)=>{t=s,e=r});return n.resolve=t,n.reject=e,n},pl=t=>t==null?"":""+t,Hp=(t,e,n)=>{t.forEach(s=>{e[s]&&(n[s]=e[s])})},Vp=/###/g,ml=t=>t&&t.indexOf("###")>-1?t.replace(Vp,"."):t,Dl=t=>!t||Be(t),br=(t,e,n)=>{const s=Be(e)?e.split("."):e;let r=0;for(;r<s.length-1;){if(Dl(t))return{};const o=ml(s[r]);!t[o]&&n&&(t[o]=new n),Object.prototype.hasOwnProperty.call(t,o)?t=t[o]:t={},++r}return Dl(t)?{}:{obj:t,k:ml(s[r])}},gl=(t,e,n)=>{const{obj:s,k:r}=br(t,e,Object);if(s!==void 0||e.length===1){s[r]=n;return}let o=e[e.length-1],a=e.slice(0,e.length-1),c=br(t,a,Object);for(;c.obj===void 0&&a.length;)o=`${a[a.length-1]}.${o}`,a=a.slice(0,a.length-1),c=br(t,a,Object),c?.obj&&typeof c.obj[`${c.k}.${o}`]<"u"&&(c.obj=void 0);c.obj[`${c.k}.${o}`]=n},qp=(t,e,n,s)=>{const{obj:r,k:o}=br(t,e,Object);r[o]=r[o]||[],r[o].push(n)},gi=(t,e)=>{const{obj:n,k:s}=br(t,e);if(n&&Object.prototype.hasOwnProperty.call(n,s))return n[s]},Wp=(t,e,n)=>{const s=gi(t,n);return s!==void 0?s:gi(e,n)},_u=(t,e,n)=>{for(const s in e)s!=="__proto__"&&s!=="constructor"&&(s in t?Be(t[s])||t[s]instanceof String||Be(e[s])||e[s]instanceof String?n&&(t[s]=e[s]):_u(t[s],e[s],n):t[s]=e[s]);return t},rs=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Kp={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const Gp=t=>Be(t)?t.replace(/[&<>"'\/]/g,e=>Kp[e]):t;class Yp{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 s=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,s),this.regExpQueue.push(e),s}}const Xp=[" ",",","?","!",";"],Jp=new Yp(20),Zp=(t,e,n)=>{e=e||"",n=n||"";const s=Xp.filter(a=>e.indexOf(a)<0&&n.indexOf(a)<0);if(s.length===0)return!0;const r=Jp.getRegExp(`(${s.map(a=>a==="?"?"\\?":a).join("|")})`);let o=!r.test(t);if(!o){const a=t.indexOf(n);a>0&&!r.test(t.substring(0,a))&&(o=!0)}return o},ea=(t,e,n=".")=>{if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;const s=e.split(n);let r=t;for(let o=0;o<s.length;){if(!r||typeof r!="object")return;let a,c="";for(let l=o;l<s.length;++l)if(l!==o&&(c+=n),c+=s[l],a=r[c],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&l<s.length-1)continue;o+=l-o+1;break}r=a}return r},xr=t=>t?.replace(/_/g,"-"),Qp={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 Fi{constructor(e,n={}){this.init(e,n)}init(e,n={}){this.prefix=n.prefix||"i18next:",this.logger=e||Qp,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,s,r){return r&&!this.debug?null:(Be(e[0])&&(e[0]=`${s}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new Fi(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new Fi(this.logger,e)}}var wn=new Fi;class $i{constructor(){this.observers={}}on(e,n){return e.split(" ").forEach(s=>{this.observers[s]||(this.observers[s]=new Map);const r=this.observers[s].get(n)||0;this.observers[s].set(n,r+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(([r,o])=>{for(let a=0;a<o;a++)r(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([r,o])=>{for(let a=0;a<o;a++)r.apply(r,[e,...n])})}}class Fl extends $i{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,s,r={}){const o=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,a=r.ignoreJSONStructure!==void 0?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let c;e.indexOf(".")>-1?c=e.split("."):(c=[e,n],s&&(Array.isArray(s)?c.push(...s):Be(s)&&o?c.push(...s.split(o)):c.push(s)));const l=gi(this.data,c);return!l&&!n&&!s&&e.indexOf(".")>-1&&(e=c[0],n=c[1],s=c.slice(2).join(".")),l||!a||!Be(s)?l:ea(this.data?.[e]?.[n],s,o)}addResource(e,n,s,r,o={silent:!1}){const a=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let c=[e,n];s&&(c=c.concat(a?s.split(a):s)),e.indexOf(".")>-1&&(c=e.split("."),r=n,n=c[1]),this.addNamespaces(n),gl(this.data,c,r),o.silent||this.emit("added",e,n,s,r)}addResources(e,n,s,r={silent:!1}){for(const o in s)(Be(s[o])||Array.isArray(s[o]))&&this.addResource(e,n,o,s[o],{silent:!0});r.silent||this.emit("added",e,n,s)}addResourceBundle(e,n,s,r,o,a={silent:!1,skipCopy:!1}){let c=[e,n];e.indexOf(".")>-1&&(c=e.split("."),r=s,s=n,n=c[1]),this.addNamespaces(n);let l=gi(this.data,c)||{};a.skipCopy||(s=JSON.parse(JSON.stringify(s))),r?_u(l,s,o):l={...l,...s},gl(this.data,c,l),a.silent||this.emit("added",e,n,s)}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(r=>n[r]&&Object.keys(n[r]).length>0)}toJSON(){return this.data}}var Iu={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,s,r){return t.forEach(o=>{e=this.processors[o]?.process(e,n,s,r)??e}),e}};const Mu=Symbol("i18next/PATH_KEY");function em(){const t=[],e=Object.create(null);let n;return e.get=(s,r)=>(n?.revoke?.(),r===Mu?t:(t.push(r),n=Proxy.revocable(s,e),n.proxy)),Proxy.revocable(Object.create(null),e).proxy}function Os(t,e){const{[Mu]:n}=t(em()),s=e?.keySeparator??".",r=e?.nsSeparator??":";if(n.length>1&&r){const o=e?.ns,a=Array.isArray(o)?o:null;if(a&&a.length>1&&a.slice(1).includes(n[0]))return`${n[0]}${r}${n.slice(1).join(s)}`}return n.join(s)}const bl={},xo=t=>!Be(t)&&typeof t!="boolean"&&typeof t!="number";class bi extends $i{constructor(e,n={}){super(),Hp(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=wn.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,n={interpolation:{}}){const s={...n};if(e==null)return!1;const r=this.resolve(e,s);if(r?.res===void 0)return!1;const o=xo(r.res);return!(s.returnObjects===!1&&o)}extractFromKey(e,n){let s=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");const r=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const a=s&&e.indexOf(s)>-1,c=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!Zp(e,s,r);if(a&&!c){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:Be(o)?[o]:o};const u=e.split(s);(s!==r||s===r&&this.options.ns.indexOf(u[0])>-1)&&(o=u.shift()),e=u.join(r)}return{key:e,namespaces:Be(o)?[o]:o}}translate(e,n,s){let r=typeof n=="object"?{...n}:n;if(typeof r!="object"&&this.options.overloadTranslationOptionHandler&&(r=this.options.overloadTranslationOptionHandler(arguments)),typeof r=="object"&&(r={...r}),r||(r={}),e==null)return"";typeof e=="function"&&(e=Os(e,{...this.options,...r})),Array.isArray(e)||(e=[String(e)]),e=e.map(W=>typeof W=="function"?Os(W,{...this.options,...r}):String(W));const o=r.returnDetails!==void 0?r.returnDetails:this.options.returnDetails,a=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,{key:c,namespaces:l}=this.extractFromKey(e[e.length-1],r),u=l[l.length-1];let d=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;d===void 0&&(d=":");const h=r.lng||this.language,D=r.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(h?.toLowerCase()==="cimode")return D?o?{res:`${u}${d}${c}`,usedKey:c,exactUsedKey:c,usedLng:h,usedNS:u,usedParams:this.getUsedParamsDetails(r)}:`${u}${d}${c}`:o?{res:c,usedKey:c,exactUsedKey:c,usedLng:h,usedNS:u,usedParams:this.getUsedParamsDetails(r)}:c;const m=this.resolve(e,r);let g=m?.res;const y=m?.usedKey||c,b=m?.exactUsedKey||c,w=["[object Number]","[object Function]","[object RegExp]"],v=r.joinArrays!==void 0?r.joinArrays:this.options.joinArrays,j=!this.i18nFormat||this.i18nFormat.handleAsObject,N=r.count!==void 0&&!Be(r.count),z=bi.hasDefaultValue(r),V=N?this.pluralResolver.getSuffix(h,r.count,r):"",U=r.ordinal&&N?this.pluralResolver.getSuffix(h,r.count,{ordinal:!1}):"",G=N&&!r.ordinal&&r.count===0,X=G&&r[`defaultValue${this.options.pluralSeparator}zero`]||r[`defaultValue${V}`]||r[`defaultValue${U}`]||r.defaultValue;let K=g;j&&!g&&z&&(K=X);const le=xo(K),_=Object.prototype.toString.apply(K);if(j&&K&&le&&w.indexOf(_)<0&&!(Be(v)&&Array.isArray(K))){if(!r.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const W=this.options.returnedObjectHandler?this.options.returnedObjectHandler(y,K,{...r,ns:l}):`key '${c} (${this.language})' returned an object instead of string.`;return o?(m.res=W,m.usedParams=this.getUsedParamsDetails(r),m):W}if(a){const W=Array.isArray(K),T=W?[]:{},k=W?b:y;for(const R in K)if(Object.prototype.hasOwnProperty.call(K,R)){const he=`${k}${a}${R}`;z&&!g?T[R]=this.translate(he,{...r,defaultValue:xo(X)?X[R]:void 0,joinArrays:!1,ns:l}):T[R]=this.translate(he,{...r,joinArrays:!1,ns:l}),T[R]===he&&(T[R]=K[R])}g=T}}else if(j&&Be(v)&&Array.isArray(g))g=g.join(v),g&&(g=this.extendTranslation(g,e,r,s));else{let W=!1,T=!1;!this.isValidLookup(g)&&z&&(W=!0,g=X),this.isValidLookup(g)||(T=!0,g=c);const R=(r.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&T?void 0:g,he=z&&X!==g&&this.options.updateMissing;if(T||W||he){if(this.logger.log(he?"updateKey":"missingKey",h,u,c,he?X:g),a){const Ee=this.resolve(c,{...r,keySeparator:!1});Ee&&Ee.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 Fe=this.languageUtils.getFallbackCodes(this.options.fallbackLng,r.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Fe&&Fe[0])for(let Ee=0;Ee<Fe.length;Ee++)be.push(Fe[Ee]);else this.options.saveMissingTo==="all"?be=this.languageUtils.toResolveHierarchy(r.lng||this.language):be.push(r.lng||this.language);const Ne=(Ee,B,me)=>{const J=z&&me!==g?me:R;this.options.missingKeyHandler?this.options.missingKeyHandler(Ee,u,B,J,he,r):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(Ee,u,B,J,he,r),this.emit("missingKey",Ee,u,B,g)};this.options.saveMissing&&(this.options.saveMissingPlurals&&N?be.forEach(Ee=>{const B=this.pluralResolver.getSuffixes(Ee,r);G&&r[`defaultValue${this.options.pluralSeparator}zero`]&&B.indexOf(`${this.options.pluralSeparator}zero`)<0&&B.push(`${this.options.pluralSeparator}zero`),B.forEach(me=>{Ne([Ee],c+me,r[`defaultValue${me}`]||X)})}):Ne(be,c,X))}g=this.extendTranslation(g,e,r,m,s),T&&g===c&&this.options.appendNamespaceToMissingKey&&(g=`${u}${d}${c}`),(T||W)&&this.options.parseMissingKeyHandler&&(g=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${d}${c}`:c,W?g:void 0,r))}return o?(m.res=g,m.usedParams=this.getUsedParamsDetails(r),m):g}extendTranslation(e,n,s,r,o){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...s},s.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init({...s,interpolation:{...this.options.interpolation,...s.interpolation}});const l=Be(e)&&(s?.interpolation?.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let u;if(l){const h=e.match(this.interpolator.nestingRegexp);u=h&&h.length}let d=s.replace&&!Be(s.replace)?s.replace:s;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),e=this.interpolator.interpolate(e,d,s.lng||this.language||r.usedLng,s),l){const h=e.match(this.interpolator.nestingRegexp),D=h&&h.length;u<D&&(s.nest=!1)}!s.lng&&r&&r.res&&(s.lng=this.language||r.usedLng),s.nest!==!1&&(e=this.interpolator.nest(e,(...h)=>o?.[0]===h[0]&&!s.context?(this.logger.warn(`It seems you are nesting recursively key: ${h[0]} in key: ${n[0]}`),null):this.translate(...h,n),s)),s.interpolation&&this.interpolator.reset()}const a=s.postProcess||this.options.postProcess,c=Be(a)?[a]:a;return e!=null&&c?.length&&s.applyPostProcessor!==!1&&(e=Iu.handle(c,e,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(s)},...s}:s,this)),e}resolve(e,n={}){let s,r,o,a,c;return Be(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(l=>typeof l=="function"?Os(l,{...this.options,...n}):l)),e.forEach(l=>{if(this.isValidLookup(s))return;const u=this.extractFromKey(l,n),d=u.key;r=d;let h=u.namespaces;this.options.fallbackNS&&(h=h.concat(this.options.fallbackNS));const D=n.count!==void 0&&!Be(n.count),m=D&&!n.ordinal&&n.count===0,g=n.context!==void 0&&(Be(n.context)||typeof n.context=="number")&&n.context!=="",y=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);h.forEach(b=>{this.isValidLookup(s)||(c=b,!bl[`${y[0]}-${b}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(c)&&(bl[`${y[0]}-${b}`]=!0,this.logger.warn(`key "${r}" for languages "${y.join(", ")}" won't get resolved as namespace "${c}" 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(w=>{if(this.isValidLookup(s))return;a=w;const v=[d];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(v,d,w,b,n);else{let N;D&&(N=this.pluralResolver.getSuffix(w,n.count,n));const z=`${this.options.pluralSeparator}zero`,V=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(D&&(n.ordinal&&N.indexOf(V)===0&&v.push(d+N.replace(V,this.options.pluralSeparator)),v.push(d+N),m&&v.push(d+z)),g){const U=`${d}${this.options.contextSeparator||"_"}${n.context}`;v.push(U),D&&(n.ordinal&&N.indexOf(V)===0&&v.push(U+N.replace(V,this.options.pluralSeparator)),v.push(U+N),m&&v.push(U+z))}}let j;for(;j=v.pop();)this.isValidLookup(s)||(o=j,s=this.getResource(w,b,j,n))}))})}),{res:s,usedKey:r,exactUsedKey:o,usedLng:a,usedNS:c}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,s,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,n,s,r):this.resourceStore.getResource(e,n,s,r)}getUsedParamsDetails(e={}){const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],s=e.replace&&!Be(e.replace);let r=s?e.replace:e;if(s&&typeof e.count<"u"&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!s){r={...r};for(const o of n)delete r[o]}return r}static hasDefaultValue(e){const n="defaultValue";for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&n===s.substring(0,n.length)&&e[s]!==void 0)return!0;return!1}}class yl{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=wn.create("languageUtils")}getScriptPartFromCode(e){if(e=xr(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=xr(e),!e||e.indexOf("-")<0)return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(Be(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(s=>{if(n)return;const r=this.formatLanguageCode(s);(!this.options.supportedLngs||this.isSupportedCode(r))&&(n=r)}),!n&&this.options.supportedLngs&&e.forEach(s=>{if(n)return;const r=this.getScriptPartFromCode(s);if(this.isSupportedCode(r))return n=r;const o=this.getLanguagePartFromCode(s);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)),Be(e)&&(e=[e]),Array.isArray(e))return e;if(!n)return e.default||[];let s=e[n];return s||(s=e[this.getScriptPartFromCode(n)]),s||(s=e[this.formatLanguageCode(n)]),s||(s=e[this.getLanguagePartFromCode(n)]),s||(s=e.default),s||[]}toResolveHierarchy(e,n){const s=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],e),r=[],o=a=>{a&&(this.isSupportedCode(a)?r.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return Be(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))):Be(e)&&o(this.formatLanguageCode(e)),s.forEach(a=>{r.indexOf(a)<0&&o(this.formatLanguageCode(a))}),r}}const Cl={zero:0,one:1,two:2,few:3,many:4,other:5},El={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class tm{constructor(e,n={}){this.languageUtils=e,this.options=n,this.logger=wn.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,n={}){const s=xr(e==="dev"?"en":e),r=n.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:s,type:r});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let a;try{a=new Intl.PluralRules(s,{type:r})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),El;if(!e.match(/-|_/))return El;const l=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(l,n)}return this.pluralRulesCache[o]=a,a}needsPlural(e,n={}){let s=this.getRule(e,n);return s||(s=this.getRule("dev",n)),s?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,n,s={}){return this.getSuffixes(e,s).map(r=>`${n}${r}`)}getSuffixes(e,n={}){let s=this.getRule(e,n);return s||(s=this.getRule("dev",n)),s?s.resolvedOptions().pluralCategories.sort((r,o)=>Cl[r]-Cl[o]).map(r=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${r}`):[]}getSuffix(e,n,s={}){const r=this.getRule(e,s);return r?`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${r.select(n)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",n,s))}}const wl=(t,e,n,s=".",r=!0)=>{let o=Wp(t,e,n);return!o&&r&&Be(n)&&(o=ea(t,n,s),o===void 0&&(o=ea(e,n,s))),o},vo=t=>t.replace(/\$/g,"$$$$");class xl{constructor(e={}){this.logger=wn.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:s,useRawValueToEscape:r,prefix:o,prefixEscaped:a,suffix:c,suffixEscaped:l,formatSeparator:u,unescapeSuffix:d,unescapePrefix:h,nestingPrefix:D,nestingPrefixEscaped:m,nestingSuffix:g,nestingSuffixEscaped:y,nestingOptionsSeparator:b,maxReplaces:w,alwaysFormat:v}=e.interpolation;this.escape=n!==void 0?n:Gp,this.escapeValue=s!==void 0?s:!0,this.useRawValueToEscape=r!==void 0?r:!1,this.prefix=o?rs(o):a||"{{",this.suffix=c?rs(c):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=d?"":h||"-",this.unescapeSuffix=this.unescapePrefix?"":d||"",this.nestingPrefix=D?rs(D):m||rs("$t("),this.nestingSuffix=g?rs(g):y||rs(")"),this.nestingOptionsSeparator=b||",",this.maxReplaces=w||1e3,this.alwaysFormat=v!==void 0?v:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(n,s)=>n?.source===s?(n.lastIndex=0,n):new RegExp(s,"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,s,r){let o,a,c;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=m=>{if(m.indexOf(this.formatSeparator)<0){const w=wl(n,l,m,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(w,void 0,s,{...r,...n,interpolationkey:m}):w}const g=m.split(this.formatSeparator),y=g.shift().trim(),b=g.join(this.formatSeparator).trim();return this.format(wl(n,l,y,this.options.keySeparator,this.options.ignoreJSONStructure),b,s,{...r,...n,interpolationkey:y})};this.resetRegExp();const d=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,h=r?.interpolation?.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:m=>vo(m)},{regex:this.regexp,safeValue:m=>this.escapeValue?vo(this.escape(m)):vo(m)}].forEach(m=>{for(c=0;o=m.regex.exec(e);){const g=o[1].trim();if(a=u(g),a===void 0)if(typeof d=="function"){const b=d(e,o,r);a=Be(b)?b:""}else if(r&&Object.prototype.hasOwnProperty.call(r,g))a="";else if(h){a=o[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${e}`),a="";else!Be(a)&&!this.useRawValueToEscape&&(a=pl(a));const y=m.safeValue(a);if(e=e.replace(o[0],y),h?(m.regex.lastIndex+=a.length,m.regex.lastIndex-=o[0].length):m.regex.lastIndex=0,c++,c>=this.maxReplaces)break}}),e}nest(e,n,s={}){let r,o,a;const c=(l,u)=>{const d=this.nestingOptionsSeparator;if(l.indexOf(d)<0)return l;const h=l.split(new RegExp(`${rs(d)}[ ]*{`));let D=`{${h[1]}`;l=h[0],D=this.interpolate(D,a);const m=D.match(/'/g),g=D.match(/"/g);((m?.length??0)%2===0&&!g||(g?.length??0)%2!==0)&&(D=D.replace(/'/g,'"'));try{a=JSON.parse(D),u&&(a={...u,...a})}catch(y){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,y),`${l}${d}${D}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,l};for(;r=this.nestingRegexp.exec(e);){let l=[];a={...s},a=a.replace&&!Be(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;const u=/{.*}/.test(r[1])?r[1].lastIndexOf("}")+1:r[1].indexOf(this.formatSeparator);if(u!==-1&&(l=r[1].slice(u).split(this.formatSeparator).map(d=>d.trim()).filter(Boolean),r[1]=r[1].slice(0,u)),o=n(c.call(this,r[1].trim(),a),a),o&&r[0]===e&&!Be(o))return o;Be(o)||(o=pl(o)),o||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),o=""),l.length&&(o=l.reduce((d,h)=>this.format(d,h,s.lng,{...s,interpolationkey:r[1].trim()}),o.trim())),e=e.replace(r[0],o),this.regexp.lastIndex=0}return e}}const nm=t=>{let e=t.toLowerCase().trim();const n={};if(t.indexOf("(")>-1){const s=t.split("(");e=s[0].toLowerCase().trim();const r=s[1].substring(0,s[1].length-1);e==="currency"&&r.indexOf(":")<0?n.currency||(n.currency=r.trim()):e==="relativetime"&&r.indexOf(":")<0?n.range||(n.range=r.trim()):r.split(";").forEach(a=>{if(a){const[c,...l]=a.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),d=c.trim();n[d]||(n[d]=u),u==="false"&&(n[d]=!1),u==="true"&&(n[d]=!0),isNaN(u)||(n[d]=parseInt(u,10))}})}return{formatName:e,formatOptions:n}},vl=t=>{const e={};return(n,s,r)=>{let o=r;r&&r.interpolationkey&&r.formatParams&&r.formatParams[r.interpolationkey]&&r[r.interpolationkey]&&(o={...o,[r.interpolationkey]:void 0});const a=s+JSON.stringify(o);let c=e[a];return c||(c=t(xr(s),r),e[a]=c),c(n)}},sm=t=>(e,n,s)=>t(xr(n),s)(e);class rm{constructor(e={}){this.logger=wn.create("formatter"),this.options=e,this.init(e)}init(e,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";const s=n.cacheInBuiltFormats?vl:sm;this.formats={number:s((r,o)=>{const a=new Intl.NumberFormat(r,{...o});return c=>a.format(c)}),currency:s((r,o)=>{const a=new Intl.NumberFormat(r,{...o,style:"currency"});return c=>a.format(c)}),datetime:s((r,o)=>{const a=new Intl.DateTimeFormat(r,{...o});return c=>a.format(c)}),relativetime:s((r,o)=>{const a=new Intl.RelativeTimeFormat(r,{...o});return c=>a.format(c,o.range||"day")}),list:s((r,o)=>{const a=new Intl.ListFormat(r,{...o});return c=>a.format(c)})}}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=vl(n)}format(e,n,s,r={}){const o=n.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&o[0].indexOf(")")<0&&o.find(c=>c.indexOf(")")>-1)){const c=o.findIndex(l=>l.indexOf(")")>-1);o[0]=[o[0],...o.splice(1,c)].join(this.formatSeparator)}return o.reduce((c,l)=>{const{formatName:u,formatOptions:d}=nm(l);if(this.formats[u]){let h=c;try{const D=r?.formatParams?.[r.interpolationkey]||{},m=D.locale||D.lng||r.locale||r.lng||s;h=this.formats[u](c,m,{...d,...r,...D})}catch(D){this.logger.warn(D)}return h}else this.logger.warn(`there was no format function for ${u}`);return c},e)}}const im=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class om extends $i{constructor(e,n,s,r={}){super(),this.backend=e,this.store=n,this.services=s,this.languageUtils=s.languageUtils,this.options=r,this.logger=wn.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(s,r.backend,r)}queueLoad(e,n,s,r){const o={},a={},c={},l={};return e.forEach(u=>{let d=!0;n.forEach(h=>{const D=`${u}|${h}`;!s.reload&&this.store.hasResourceBundle(u,h)?this.state[D]=2:this.state[D]<0||(this.state[D]===1?a[D]===void 0&&(a[D]=!0):(this.state[D]=1,d=!1,a[D]===void 0&&(a[D]=!0),o[D]===void 0&&(o[D]=!0),l[h]===void 0&&(l[h]=!0)))}),d||(c[u]=!0)}),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(c),toLoadNamespaces:Object.keys(l)}}loaded(e,n,s){const r=e.split("|"),o=r[0],a=r[1];n&&this.emit("failedLoading",o,a,n),!n&&s&&this.store.addResourceBundle(o,a,s,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2,n&&s&&(this.state[e]=0);const c={};this.queue.forEach(l=>{qp(l.loaded,[o],a),im(l,e),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{c[u]||(c[u]={});const d=l.loaded[u];d.length&&d.forEach(h=>{c[u][h]===void 0&&(c[u][h]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",c),this.queue=this.queue.filter(l=>!l.done)}read(e,n,s,r=0,o=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:s,tried:r,wait:o,callback:a});return}this.readingCalls++;const c=(u,d)=>{if(this.readingCalls--,this.waitingReads.length>0){const h=this.waitingReads.shift();this.read(h.lng,h.ns,h.fcName,h.tried,h.wait,h.callback)}if(u&&d&&r<this.maxRetries){setTimeout(()=>{this.read.call(this,e,n,s,r+1,o*2,a)},o);return}a(u,d)},l=this.backend[s].bind(this.backend);if(l.length===2){try{const u=l(e,n);u&&typeof u.then=="function"?u.then(d=>c(null,d)).catch(c):c(null,u)}catch(u){c(u)}return}return l(e,n,c)}prepareLoading(e,n,s={},r){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();Be(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Be(n)&&(n=[n]);const o=this.queueLoad(e,n,s,r);if(!o.toLoad.length)return o.pending.length||r(),null;o.toLoad.forEach(a=>{this.loadOne(a)})}load(e,n,s){this.prepareLoading(e,n,{},s)}reload(e,n,s){this.prepareLoading(e,n,{reload:!0},s)}loadOne(e,n=""){const s=e.split("|"),r=s[0],o=s[1];this.read(r,o,"read",void 0,void 0,(a,c)=>{a&&this.logger.warn(`${n}loading namespace ${o} for language ${r} failed`,a),!a&&c&&this.logger.log(`${n}loaded namespace ${o} for language ${r}`,c),this.loaded(e,a,c)})}saveMissing(e,n,s,r,o,a={},c=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${s}" 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(!(s==null||s==="")){if(this.backend?.create){const l={...a,isUpdate:o},u=this.backend.create.bind(this.backend);if(u.length<6)try{let d;u.length===5?d=u(e,n,s,r,l):d=u(e,n,s,r),d&&typeof d.then=="function"?d.then(h=>c(null,h)).catch(c):c(null,d)}catch(d){c(d)}else u(e,n,s,r,c,l)}!e||!e[0]||this.store.addResource(e[0],n,s,r)}}}const Ao=()=>({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]),Be(t[1])&&(e.defaultValue=t[1]),Be(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const n=t[3]||t[2];Object.keys(n).forEach(s=>{e[s]=n[s]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Al=t=>(Be(t.ns)&&(t.ns=[t.ns]),Be(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),Be(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),ei=()=>{},am=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})},$u="__i18next_supportNoticeShown",cm=()=>!!(typeof globalThis<"u"&&globalThis[$u]||typeof process<"u"&&wo&&wo.I18NEXT_NO_SUPPORT_NOTICE||typeof process<"u"&&wo),lm=()=>{typeof globalThis<"u"&&(globalThis[$u]=!0)},um=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 yr extends $i{constructor(e={},n){if(super(),this.options=Al(e),this.services={},this.logger=wn,this.modules={external:[]},am(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&&(Be(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const s=Ao();this.options={...s,...this.options,...Al(e)},this.options.interpolation={...s.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=s.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!um(this)&&!cm()&&(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 💙"),lm());const r=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?wn.init(r(this.modules.logger),this.options):wn.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:u=rm;const d=new yl(this.options);this.store=new Fl(this.options.resources,this.options);const h=this.services;h.logger=wn,h.resourceStore=this.store,h.languageUtils=d,h.pluralResolver=new tm(d,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==s.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"),u&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(h.formatter=r(u),h.formatter.init&&h.formatter.init(h,this.options),this.options.interpolation.format=h.formatter.format.bind(h.formatter)),h.interpolator=new xl(this.options),h.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},h.backendConnector=new om(r(this.modules.backend),h.resourceStore,h,this.options),h.backendConnector.on("*",(m,...g)=>{this.emit(m,...g)}),this.modules.languageDetector&&(h.languageDetector=r(this.modules.languageDetector),h.languageDetector.init&&h.languageDetector.init(h,this.options.detection,this.options)),this.modules.i18nFormat&&(h.i18nFormat=r(this.modules.i18nFormat),h.i18nFormat.init&&h.i18nFormat.init(this)),this.translator=new bi(this.services,this.options),this.translator.on("*",(m,...g)=>{this.emit(m,...g)}),this.modules.external.forEach(m=>{m.init&&m.init(this)})}if(this.format=this.options.interpolation.format,n||(n=ei),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[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(u=>{this[u]=(...d)=>this.store[u](...d)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=(...d)=>(this.store[u](...d),this)});const c=fr(),l=()=>{const u=(d,h)=>{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),c.resolve(h),n(d,h)};if(this.languages&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initAsync?l():setTimeout(l,0),c}loadResources(e,n=ei){let s=n;const r=Be(e)?e:this.language;if(typeof e=="function"&&(s=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return s();const o=[],a=c=>{if(!c||c==="cimode")return;this.services.languageUtils.toResolveHierarchy(c).forEach(u=>{u!=="cimode"&&o.indexOf(u)<0&&o.push(u)})};r?a(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>a(l)),this.options.preload?.forEach?.(c=>a(c)),this.services.backendConnector.load(o,this.options.ns,c=>{!c&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),s(c)})}else s(null)}reloadResources(e,n,s){const r=fr();return typeof e=="function"&&(s=e,e=void 0),typeof n=="function"&&(s=n,n=void 0),e||(e=this.languages),n||(n=this.options.ns),s||(s=ei),this.services.backendConnector.reload(e,n,o=>{r.resolve(),s(o)}),r}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"&&Iu.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 s=this.languages[n];if(!(["cimode","dev"].indexOf(s)>-1)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;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 s=fr();this.emit("languageChanging",e);const r=c=>{this.language=c,this.languages=this.services.languageUtils.toResolveHierarchy(c),this.resolvedLanguage=void 0,this.setResolvedLanguage(c)},o=(c,l)=>{l?this.isLanguageChangingTo===e&&(r(l),this.translator.changeLanguage(l),this.isLanguageChangingTo=void 0,this.emit("languageChanged",l),this.logger.log("languageChanged",l)):this.isLanguageChangingTo=void 0,s.resolve((...u)=>this.t(...u)),n&&n(c,(...u)=>this.t(...u))},a=c=>{!e&&!c&&this.services.languageDetector&&(c=[]);const l=Be(c)?c:c&&c[0],u=this.store.hasLanguageSomeTranslations(l)?l:this.services.languageUtils.getBestMatchFromCodes(Be(c)?[c]:c);u&&(this.language||r(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector?.cacheUserLanguage?.(u)),this.loadResources(u,d=>{o(d,u)})};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),s}getFixedT(e,n,s){const r=(o,a,...c)=>{let l;typeof a!="object"?l=this.options.overloadTranslationOptionHandler([o,a].concat(c)):l={...a},l.lng=l.lng||r.lng,l.lngs=l.lngs||r.lngs,l.ns=l.ns||r.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||s||r.keyPrefix);const u={...this.options,...l};typeof l.keyPrefix=="function"&&(l.keyPrefix=Os(l.keyPrefix,u));const d=this.options.keySeparator||".";let h;return l.keyPrefix&&Array.isArray(o)?h=o.map(D=>(typeof D=="function"&&(D=Os(D,u)),`${l.keyPrefix}${d}${D}`)):(typeof o=="function"&&(o=Os(o,u)),h=l.keyPrefix?`${l.keyPrefix}${d}${o}`:o),this.t(h,l)};return Be(e)?r.lng=e:r.lngs=e,r.ns=n,r.keyPrefix=s,r}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 s=n.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(s.toLowerCase()==="cimode")return!0;const a=(c,l)=>{const u=this.services.backendConnector.state[`${c}|${l}`];return u===-1||u===0||u===2};if(n.precheck){const c=n.precheck(this,a);if(c!==void 0)return c}return!!(this.hasResourceBundle(s,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(s,e)&&(!r||a(o,e)))}loadNamespaces(e,n){const s=fr();return this.options.ns?(Be(e)&&(e=[e]),e.forEach(r=>{this.options.ns.indexOf(r)<0&&this.options.ns.push(r)}),this.loadResources(r=>{s.resolve(),n&&n(r)}),s):(n&&n(),Promise.resolve())}loadLanguages(e,n){const s=fr();Be(e)&&(e=[e]);const r=this.options.preload||[],o=e.filter(a=>r.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return o.length?(this.options.preload=r.concat(o),this.loadResources(a=>{s.resolve(),n&&n(a)}),s):(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 r=new Intl.Locale(e);if(r&&r.getTextInfo){const o=r.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"],s=this.services?.languageUtils||new yl(Ao());return e.toLowerCase().indexOf("-latn")>1?"ltr":n.indexOf(s.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},n){const s=new yr(e,n);return s.createInstance=yr.createInstance,s}cloneInstance(e={},n=ei){const s=e.forkResourceStore;s&&delete e.forkResourceStore;const r={...this.options,...e,isClone:!0},o=new yr(r);if((e.debug!==void 0||e.prefix!==void 0)&&(o.logger=o.logger.clone(e)),["store","services","language"].forEach(c=>{o[c]=this[c]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},s){const c=Object.keys(this.store.data).reduce((l,u)=>(l[u]={...this.store.data[u]},l[u]=Object.keys(l[u]).reduce((d,h)=>(d[h]={...l[u][h]},d),l[u]),l),{});o.store=new Fl(c,r),o.services.resourceStore=o.store}if(e.interpolation){const l={...Ao().interpolation,...this.options.interpolation,...e.interpolation},u={...r,interpolation:l};o.services.interpolator=new xl(u)}return o.translator=new bi(o.services,r),o.translator.on("*",(c,...l)=>{o.emit(c,...l)}),o.init(r,n),o.translator.options=r,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 qe=yr.createInstance();qe.createInstance;qe.dir;qe.init;qe.loadResources;qe.reloadResources;qe.use;qe.changeLanguage;qe.getFixedT;qe.t;qe.exists;qe.setDefaultNamespace;qe.hasLoadedNamespace;qe.loadNamespaces;qe.loadLanguages;const{slice:dm,forEach:hm}=[];function fm(t){return hm.call(dm.call(arguments,1),e=>{if(e)for(const n in e)t[n]===void 0&&(t[n]=e[n])}),t}function pm(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 kl=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,mm=function(t,e){const s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},r=encodeURIComponent(e);let o=`${t}=${r}`;if(s.maxAge>0){const a=s.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");o+=`; Max-Age=${Math.floor(a)}`}if(s.domain){if(!kl.test(s.domain))throw new TypeError("option domain is invalid");o+=`; Domain=${s.domain}`}if(s.path){if(!kl.test(s.path))throw new TypeError("option path is invalid");o+=`; Path=${s.path}`}if(s.expires){if(typeof s.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+=`; Expires=${s.expires.toUTCString()}`}if(s.httpOnly&&(o+="; HttpOnly"),s.secure&&(o+="; Secure"),s.sameSite)switch(typeof s.sameSite=="string"?s.sameSite.toLowerCase():s.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 s.partitioned&&(o+="; Partitioned"),o},Sl={create(t,e,n,s){let r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(r.expires=new Date,r.expires.setTime(r.expires.getTime()+n*60*1e3)),s&&(r.domain=s),document.cookie=mm(t,e,r)},read(t){const e=`${t}=`,n=document.cookie.split(";");for(let s=0;s<n.length;s++){let r=n[s];for(;r.charAt(0)===" ";)r=r.substring(1,r.length);if(r.indexOf(e)===0)return r.substring(e.length,r.length)}return null},remove(t,e){this.create(t,"",-1,e)}};var Dm={name:"cookie",lookup(t){let{lookupCookie:e}=t;if(e&&typeof document<"u")return Sl.read(e)||void 0},cacheUserLanguage(t,e){let{lookupCookie:n,cookieMinutes:s,cookieDomain:r,cookieOptions:o}=e;n&&typeof document<"u"&&Sl.create(n,t,s,r,o)}},gm={name:"querystring",lookup(t){let{lookupQuerystring:e}=t,n;if(typeof window<"u"){let{search:s}=window.location;!window.location.search&&window.location.hash?.indexOf("?")>-1&&(s=window.location.hash.substring(window.location.hash.indexOf("?")));const o=s.substring(1).split("&");for(let a=0;a<o.length;a++){const c=o[a].indexOf("=");c>0&&o[a].substring(0,c)===e&&(n=o[a].substring(c+1))}}return n}},Fm={name:"hash",lookup(t){let{lookupHash:e,lookupFromHashIndex:n}=t,s;if(typeof window<"u"){const{hash:r}=window.location;if(r&&r.length>2){const o=r.substring(1);if(e){const a=o.split("&");for(let c=0;c<a.length;c++){const l=a[c].indexOf("=");l>0&&a[c].substring(0,l)===e&&(s=a[c].substring(l+1))}}if(s)return s;if(!s&&n>-1){const a=r.match(/\/([a-zA-Z-]*)/g);return Array.isArray(a)?a[typeof n=="number"?n:0]?.replace("/",""):void 0}}}return s}};let ws=null;const jl=()=>{if(ws!==null)return ws;try{if(ws=typeof window<"u"&&window.localStorage!==null,!ws)return!1;const t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{ws=!1}return ws};var bm={name:"localStorage",lookup(t){let{lookupLocalStorage:e}=t;if(e&&jl())return window.localStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupLocalStorage:n}=e;n&&jl()&&window.localStorage.setItem(n,t)}};let xs=null;const Tl=()=>{if(xs!==null)return xs;try{if(xs=typeof window<"u"&&window.sessionStorage!==null,!xs)return!1;const t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{xs=!1}return xs};var ym={name:"sessionStorage",lookup(t){let{lookupSessionStorage:e}=t;if(e&&Tl())return window.sessionStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupSessionStorage:n}=e;n&&Tl()&&window.sessionStorage.setItem(n,t)}},Cm={name:"navigator",lookup(t){const e=[];if(typeof navigator<"u"){const{languages:n,userLanguage:s,language:r}=navigator;if(n)for(let o=0;o<n.length;o++)e.push(n[o]);s&&e.push(s),r&&e.push(r)}return e.length>0?e:void 0}},Em={name:"htmlTag",lookup(t){let{htmlTag:e}=t,n;const s=e||(typeof document<"u"?document.documentElement:null);return s&&typeof s.getAttribute=="function"&&(n=s.getAttribute("lang")),n}},wm={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}},xm={name:"subdomain",lookup(t){let{lookupFromSubdomainIndex:e}=t;const n=typeof e=="number"?e+1:1,s=typeof window<"u"&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(s)return s[n]}};let Uu=!1;try{document.cookie,Uu=!0}catch{}const zu=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];Uu||zu.splice(1,1);const vm=()=>({order:zu,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:t=>t});class Hu{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]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e,this.options=fm(n,this.options||{},vm()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=r=>r.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=s,this.addDetector(Dm),this.addDetector(gm),this.addDetector(bm),this.addDetector(ym),this.addDetector(Cm),this.addDetector(Em),this.addDetector(wm),this.addDetector(xm),this.addDetector(Fm)}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(s=>{if(this.detectors[s]){let r=this.detectors[s].lookup(this.options);r&&typeof r=="string"&&(r=[r]),r&&(n=n.concat(r))}}),n=n.filter(s=>s!=null&&!pm(s)).map(s=>this.options.convertDetectedLanguage(s)),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(s=>{this.detectors[s]&&this.detectors[s].cacheUserLanguage(e,this.options)}))}}Hu.type="languageDetector";const Am={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",retry:"Retry",reload:"Reload page",languageEnglish:"English",languageChinese:"中文"},km={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"},Sm={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"},jm={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"},Tm=JSON.parse(`{"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","harperRecoveryTitle":"Harper is unavailable.","harperFallbackHint":" The browser's built-in spellchecker is being used instead.","texFmtRecoveryTitle":"tex-fmt could not load.","texFmtOptionsRecoveryTitle":"tex-fmt rejected the source or options.","texFmtRuntimeRecoveryTitle":"tex-fmt returned an unexpected result.","clientToolRecoveryHint":" Retry now, or reload the page to use the latest browser assets.","resetFormatterOptions":"Clear options and retry","texFmtDiagnosticsTitle":"tex-fmt produced diagnostics.","texFmtDiagnosticsHint":" The formatted text was applied; review the details below.","viewFormatterDiagnostics":"View diagnostics","dismissFormatterDiagnostics":"Dismiss formatter diagnostics","formattingBy":"{{name}} is formatting this file. Please wait…","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","wordCountTitle":"Word count","wordCountFull":"Full","wordCountSelection":"Selected","wordCountFullHint":"Count the current main document and included TeX files","wordCountSelectionHint":"Count the selected LaTeX source","wordCountLoading":"Running TeXcount…","wordCountTotal":"Total words","wordCountCharacters":"Characters","wordCountCharactersHint":"Excludes spaces and punctuation","wordCountText":"Body text","wordCountHeaders":"Headings","wordCountCaptions":"Captions","wordCountFloats":"Figures / tables","wordCountInlineMath":"Inline math","wordCountDisplayMath":"Displayed math","wordCountFiles":"Included files","wordCountWordsUnit":"words","wordCountItemsUnit":"items","wordCountExpressionsUnit":"expressions","wordCountParserErrors":"TeXcount reported {{count}} parsing issues.","wordCountSelectionEmpty":"Select LaTeX source before counting.","wordCountSaveRequired":"The latest editor changes could not be saved, so the count was cancelled.","wordCountFailed":"TeXcount could not count this source.","wordCountSourceInvalid":"Select LaTeX source text to count.","wordCountSourceTooLarge":"The selected source is too large to count.","wordCountUnavailable":"TeXcount is not available on this server. Install it from TeX Live and try again.","wordCountHelp":"About TeXcount","wordCountTemplateNote":"Custom %TC:newtemplate or %TC:template directives can override TexLite's report format and prevent a result.","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","showFileSizes":"Show file sizes","hideFileSizes":"Hide file sizes","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":"View","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","permissionDowngradeTitle":"Edit permission changed","permissionDowngradeDescription":"Your access changed from {{previous}} to read-only. Any unsaved local draft is still retained in this tab and cannot be saved. Keep it visible, or discard it and reload the latest server version.","permissionDowngradeKeep":"Keep local draft","permissionDowngradeDiscard":"Discard draft and reload","permissionDowngradeReload":"Reload server version","permissionDowngradeNoDraft":"Your access changed to read-only. Reload to use the latest server version, or continue viewing this tab.","permissionDowngradeOtherTab":"Your access changed to read-only. Another browser tab still has an unsaved draft; return to that tab to handle it. This page cannot clear the shared local draft safely.","permissionDowngradeMultipleDrafts":"Your access changed to read-only. This tab and another browser tab both have unsaved drafts. Handle the other tab first; this page will not clear shared local data.","permissionDowngradeOtherTabBlocked":"Another browser tab just created an unsaved draft, so cleanup was cancelled to protect it.","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"}}`),Bm={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.",deleteTitle:"Delete citation",deleteDescription:"Delete the citation {{key}} from your private library? This cannot be undone.",fileTooLarge:"This BibTeX file exceeds the {{size}} limit.",fileTooLargeHint:"The file is too large to parse in the browser. Save individual entries from a smaller file or split it first.",fileInvalid:"The current BibTeX file contains syntax errors.",fileInvalidHint:"Fix the current file before formatting it or importing another citation.",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}}"},Lm={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."},Nm="Manage your private BibTeX references and tags from the homepage. Open a .bib file to save or import entries.",Rm={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."},Om={pageOf:"Page {{page}} of {{totalPages}} · {{count}} entries",previous:"Previous",next:"Next"},Pm={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."},_m={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"}},Im={mainFile:"Main document",invalidMainFileOption:"{{path}} (not a root 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.",browserTools:"Formatting tools",toolStatus:{loading:"Loading",working:"Working",error:"Error"},reloadTool:"Reload",saveAppearance:"Save appearance",saveCompiler:"Save compiler settings",writingCheckDescription:"TexLite uses the optional host-installed Harper CLI. If it is unavailable, the browser spellchecker takes over. 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 ignored after Harper returns this project's spelling diagnostics. 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",bibtexTidyInstall:"View bibtex-tidy",texFmtOptions:"tex-fmt options (TOML)",texFmtOptionsPlaceholder:`wrap = true
8
- wraplen = 80`,texFmtOptionsDescription:"These options are stored only in this browser and isolated by the current user and project. They are passed directly to tex-fmt.",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"},Mm={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"},$m={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"}}},Um={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"},zm={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."}},Hm={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."},Vm={requestFailed:"Network request failed. Check your connection and retry.",invalidResponse:"The server returned an invalid response. Please retry."},qm={protocolUpgrade:"This workspace needs an update. Your local draft is retained; refresh when you are ready to reconnect."},Wm={disableTitle:"Disable user",disableDescription:"Disable @{{username}}? Their active sessions will end and they will no longer be able to sign in.",disableConfirm:"Disable user",demoteTitle:"Remove administrator access",demoteDescription:"Make @{{username}} a regular user? They will no longer be able to manage users.",demoteConfirm:"Make user",denyProjectCreationTitle:"Remove project creation",denyProjectCreationDescription:"Remove @{{username}}’s permission to create new projects? Their existing project access is unchanged.",denyProjectCreationConfirm:"Remove permission"},Km={cancel:"Cancel compile",cancelling:"Cancelling…",cancelled:"Compilation cancelled."},Gm={copyright:"© {{year}}",credit:"Designed and developed by CHEN Zhongpu"},Ym={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"},Xm={common:Am,auth:km,projects:Sm,users:jm,editor:Tm,citationLibrary:Bm,citationErrors:Lm,citationLibraryHomeDescription:Nm,citationLibraryActions:Rm,citationLibraryPagination:Om,navigation:Pm,history:_m,projectSettings:Im,git:Mm,metrics:$m,tags:Um,errors:zm,apiErrors:Hm,network:Vm,workspaceUpdates:qm,userConfirmations:Wm,compileControls:Km,footer:Gm,completions:Ym},Jm={cancel:"取消",create:"创建",add:"添加",remove:"移除",delete:"删除",close:"关闭",user:"用户",permission:"权限",readOnly:"只读",readWrite:"读写",settings:"设置",comments:"批注",files:"文件",outline:"大纲",version:"版本",loading:"正在载入…",enabled:"允许",disabled:"禁止",normal:"正常",admin:"管理员",language:"语言",save:"保存",edit:"编辑",retry:"重试",reload:"刷新页面",languageEnglish:"English",languageChinese:"中文"},Zm={tagline:"轻量 LaTeX 写作环境",username:"用户名",password:"密码",login:"登录",contact:"需要账号?请联系 {{email}}",firstLogin:"首次登录,请修改初始密码",currentPassword:"当前密码",newPassword:"新密码",confirmPassword:"确认新密码",updatePassword:"更新密码",mismatch:"两次输入的新密码不一致",passwordMinimum:"至少 {{count}} 位",sessionExpired:"登录状态已过期,请重新登录。",logout:"退出"},Qm={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:"清除已选文件"},eD={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:"永久删除项目及全部文件"},tD={saved:"已保存",savedAt:"已于 {{time}} 保存到服务器",loading:"载入中",pending:"等待保存",saving:"正在保存到服务器",saveFailed:"保存失败",offlineDraft:"离线 · 本地草稿已保留",harperRecoveryTitle:"Harper 暂不可用。",harperFallbackHint:" 已自动改用浏览器内置拼写检查。",texFmtRecoveryTitle:"tex-fmt 无法加载。",texFmtOptionsRecoveryTitle:"tex-fmt 无法处理当前源码或参数。",texFmtRuntimeRecoveryTitle:"tex-fmt 返回了异常结果。",clientToolRecoveryHint:" 可立即重试;如果页面在系统更新前已经打开,请刷新页面加载最新资源。",resetFormatterOptions:"清空参数并重试",texFmtDiagnosticsTitle:"tex-fmt 生成了诊断信息。",texFmtDiagnosticsHint:" 格式化内容已应用,请查看下方详情。",viewFormatterDiagnostics:"查看诊断",dismissFormatterDiagnostics:"关闭格式化诊断",formattingBy:"{{name}} 正在格式化此文件,请稍候…",compile:"编译 · {{engine}}",compiling:"编译中…",compileQueued:"编译已排队…",compileFailedRetained:"编译失败,当前显示上一次成功生成的 PDF({{time}})。",compileFailedNoPdf:"编译失败,且没有可用的成功 PDF。",upToDate:"文件已是最新,无需重新编译。",compileSnapshotStale:"PDF 基于较早的一致快照编译,未包含之后的源码修改。",addComment:"添加批注",sourceComments:"源码批注",projectSettings:"项目设置",uploadAttachment:"上传附件",newFile:"新建文本文件",binary:"二进制附件已保存,但不能在文本编辑器中打开。",noOutline:"当前文件没有章节",wordCountTitle:"字数统计",wordCountFull:"全文",wordCountSelection:"所选",wordCountFullHint:"统计当前主文档及其引入的 TeX 文件",wordCountSelectionHint:"统计选中的 LaTeX 源码",wordCountLoading:"正在运行 TeXcount…",wordCountTotal:"总字数",wordCountCharacters:"字符数",wordCountCharactersHint:"不含空格和标点",wordCountText:"正文",wordCountHeaders:"标题",wordCountCaptions:"图注/表注",wordCountFloats:"图表数量",wordCountInlineMath:"行内公式",wordCountDisplayMath:"独立公式",wordCountFiles:"引入文件",wordCountWordsUnit:"字",wordCountItemsUnit:"个",wordCountExpressionsUnit:"个",wordCountParserErrors:"TeXcount 报告了 {{count}} 个解析问题。",wordCountSelectionEmpty:"请选择 LaTeX 源码后再统计。",wordCountSaveRequired:"最新编辑修改无法保存,已取消统计。",wordCountFailed:"TeXcount 无法统计这段源码。",wordCountSourceInvalid:"请选择 LaTeX 源码后再统计。",wordCountSourceTooLarge:"所选源码过大,无法统计。",wordCountUnavailable:"服务器未安装 TeXcount,请安装 TeX Live 后重试。",wordCountHelp:"TeXcount 说明",wordCountTemplateNote:"自定义 %TC:newtemplate 或 %TC:template 指令可能覆盖 TexLite 的统计格式,并导致统计失败。",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:"折叠文件面板",showFileSizes:"显示文件大小",hideFileSizes:"隐藏文件大小",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:"重新连接",permissionDowngradeTitle:"编辑权限已变更",permissionDowngradeDescription:"您的权限已从{{previous}}变为只读。任何尚未保存的本地草稿仍保留在当前标签页中,但无法保存。您可以继续查看草稿,或放弃草稿并重新加载服务器上的最新版本。",permissionDowngradeKeep:"保留本地草稿",permissionDowngradeDiscard:"放弃草稿并重新加载",permissionDowngradeReload:"重新加载服务器版本",permissionDowngradeNoDraft:"您的权限已变为只读。您可以继续查看当前标签页,或重新加载服务器上的最新版本。",permissionDowngradeOtherTab:"您的权限已变为只读。另一个浏览器标签页中仍有尚未保存的草稿,请返回该标签页处理。为避免误删,该页面不能清理共享的本地草稿。",permissionDowngradeMultipleDrafts:"您的权限已变为只读。当前标签页和其他浏览器标签页都存在尚未保存的草稿。请先在其他标签页中处理草稿;当前页面不会清理共享数据。",permissionDowngradeOtherTabBlocked:"另一个浏览器标签页刚刚产生了尚未保存的草稿,已取消清理以保护该草稿。",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:"正则表达式无效"}},nD={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:"引用已删除。",deleteTitle:"删除引用",deleteDescription:"确定从你的私有引用库中删除引用 {{key}}?此操作不可撤销。",fileTooLarge:"该 BibTeX 文件超过 {{size}} 限制。",fileTooLargeHint:"文件过大,浏览器不会解析其中的条目。请拆分文件后再保存单条引用。",fileInvalid:"当前 BibTeX 文件存在语法错误。",fileInvalidHint:"请先修复当前文件,再格式化或导入新的引用。",savedLabel:"已保存",import:"导入",importToFile:"导入到当前 BibTeX 文件",importRequiresWrite:"导入需要当前项目的写权限。",imported:"已将 {{key}} 导入当前文件。",untitled:"未命名引用",authorUnknown:"未填写作者",allTags:"全部标签",noTags:"还没有标签",noTagMatches:"没有匹配此标签的引用。",newTagPlaceholder:"新标签名称",tagColor:"标签颜色",createTag:"创建标签",tagCreated:"标签已创建。",tags:"标签",tagsTitle:"{{key}} 的标签",noTagsToAssign:"请先创建标签。",saveTags:"保存标签",tagsUpdated:"标签已更新。",editTitle:"编辑 {{key}}"},sD={invalid:"请输入一个有效的 BibTeX 条目。",tooLarge:"BibTeX 条目过大。",notFound:"引用条目不存在。",keyExists:"引用 key 已经存在,请检查现有条目后再决定是否替换。",tagNotFound:"引用标签不存在。",conflict:"该引用已在其他位置发生修改,请刷新引用库后重试。",alreadyInFile:"{{key}} 已经存在于当前 BibTeX 文件中。"},rD="在首页管理属于你自己的 BibTeX 文献和标签。打开 .bib 文件后即可保存或导入条目。",iD={addEntry:"添加条目",addEntryTitle:"添加 BibTeX 条目",addEntryDescription:"粘贴一个完整的 BibTeX 文献条目,保存前会进行校验。",addEntryPlaceholder:`@article{key,
9
- author = {Author},
10
- title = {Title},
11
- year = {2026}
12
- }`,added:"引用已添加到你的引用库。"},oD={pageOf:"第 {{page}} / {{totalPages}} 页 · {{count}} 条引用",previous:"上一页",next:"下一页"},aD={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}} 项。"},cD={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:"安全检查点"}},lD={mainFile:"主文档",invalidMainFileOption:"{{path}}(不是主文档)",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:"这些偏好仅作用于当前浏览器中的当前用户和项目;项目词典是共享的。",browserTools:"格式化工具",toolStatus:{loading:"加载中",working:"运行正常",error:"错误"},reloadTool:"重新加载",saveAppearance:"保存外观设置",saveCompiler:"保存编译器设置",writingCheckDescription:"TexLite 使用宿主机上可选的 Harper CLI。若其不可用,将自动改用浏览器内置拼写检查。拼写问题使用红色波浪线,语法问题使用黄色波浪线;右键问题可以查看修改建议。",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:"宽松"},uD={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:"确认撤销"},dD={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:"生成补全索引"}}},hD={title:"标签",add:"添加标签",create:"新建标签",createDescription:"创建仅自己可见的可复用彩色标签,用于整理项目。",assign:"标签",assignTitle:"“{{project}}”的标签",assignDescription:"勾选你为此项目设置的私有标签;其他用户拥有各自的标签。",empty:"请先创建标签。",allAssigned:"所有可用标签均已添加。",name:"标签名称",color:"颜色",filter:"筛选",red:"红色",orange:"橙色",yellow:"黄色",green:"绿色",blue:"蓝色",purple:"紫色",gray:"灰色"},fD={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:"请求格式无效。"}},pD={historyVersionNotFound:"所选历史版本已不存在。",historyFileNotFound:"所选历史版本中没有这个文件。",historyTargetConflict:"当前恢复目标是目录或其他非普通文件路径。",historyPreviewUnsupported:"这个历史文件不能作为文本比较。",searchInvalid:"请输入有效的搜索内容。",gitUnavailable:"Git 集成功能不可用。请在宿主机安装 Git,或修正配置中的 git.binary 后重试。",formatFailed:"tex-fmt 无法格式化这段源码。",mainDocumentInvalid:"所选文件不是有效的 LaTeX 主文档。",compileSnapshotBusy:"源码尚未完成稳定保存,请稍后再试编译。"},mD={requestFailed:"网络请求失败,请检查连接后重试。",invalidResponse:"服务器返回了无效响应,请重试。"},DD={protocolUpgrade:"工作区需要更新。本地草稿已保留;请在准备好重新连接时刷新页面。"},gD={disableTitle:"禁用用户",disableDescription:"确定禁用 @{{username}} 吗?其活跃会话将结束,且无法再登录。",disableConfirm:"禁用用户",demoteTitle:"移除管理员权限",demoteDescription:"确定将 @{{username}} 降为普通用户吗?其将无法再管理用户。",demoteConfirm:"设为普通用户",denyProjectCreationTitle:"移除项目创建权限",denyProjectCreationDescription:"确定移除 @{{username}} 创建新项目的权限吗?其已有项目访问权限不受影响。",denyProjectCreationConfirm:"移除权限"},FD={cancel:"取消编译",cancelling:"正在取消…",cancelled:"编译已取消。"},bD={copyright:"© {{year}}",credit:"Designed and developed by CHEN Zhongpu"},yD={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 命令"},CD={common:Jm,auth:Zm,projects:Qm,users:eD,editor:tD,citationLibrary:nD,citationErrors:sD,citationLibraryHomeDescription:rD,citationLibraryActions:iD,citationLibraryPagination:oD,navigation:aD,history:cD,projectSettings:lD,git:uD,metrics:dD,tags:hD,errors:fD,apiErrors:pD,network:mD,workspaceUpdates:DD,userConfirmations:gD,compileControls:FD,footer:bD,completions:yD};qe.use(Hu).use(Mp).init({resources:{en:{translation:Xm},zh:{translation:CD}},fallbackLng:"en",supportedLngs:["en","zh"],nonExplicitSupportedLngs:!0,interpolation:{escapeValue:!1},detection:{order:["localStorage","navigator"],caches:["localStorage"]}});class Gn extends Error{constructor(e,n,s=null){super(e),this.status=n,this.code=s}status;code}function Vu(t){return t instanceof Error&&t.name==="AbortError"}function qu(t){return Vu(t)||t instanceof Gn?t:new Gn(qe.t("network.requestFailed"),0,"NETWORK_ERROR")}function ED(t){return typeof FormData<"u"&&t instanceof FormData}async function ee(t,e={}){const{suppressSessionExpired:n=!1,...s}=e,r=new Headers(s.headers);r.has("Accept-Language")||r.set("Accept-Language",qe.resolvedLanguage?.startsWith("zh")?"zh":"en"),s.body&&!ED(s.body)&&!r.has("Content-Type")&&r.set("Content-Type","application/json");let o;try{o=await fetch(t,{...s,headers:r})}catch(l){throw qu(l)}const a=o.headers.get("content-type")??"";let c=null;if(a.includes("application/json"))try{c=await o.json()}catch(l){throw Vu(l)?l:new Gn(qe.t("network.invalidResponse"),o.status,"INVALID_RESPONSE")}else if(o.ok)throw new Gn(qe.t("network.invalidResponse"),o.status,"INVALID_RESPONSE");if(!o.ok)throw o.status===401&&!n&&typeof window<"u"&&window.dispatchEvent(new Event("texlite:session-expired")),new Gn(Wu(c,o.status),o.status,Ua(c));return c}function Wu(t,e,n="errors.request"){const s=typeof t=="object"&&t!==null&&"error"in t&&typeof t.error=="string"?t.error:"",r=Ua(t);if(r){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",WORD_COUNT_FAILED:"editor.wordCountFailed",WORD_COUNT_SOURCE_INVALID:"editor.wordCountSourceInvalid",WORD_COUNT_SOURCE_TOO_LARGE:"editor.wordCountSourceTooLarge",WORD_COUNT_UNAVAILABLE:"editor.wordCountUnavailable"}[r]??`errors.codes.${r}`;if(qe.exists(o))return qe.t(o,{status:e,...typeof t=="object"&&t!==null?t:{}})}return s||qe.t(n,{status:e})}function Ua(t){return typeof t!="object"||t===null||!("code"in t)||typeof t.code!="string"?null:t.code}const wD=/^\/projects?\/([^/]+)\/?$/;function mr(t){return`/project/${encodeURIComponent(t)}`}function js(t){const e=wD.exec(t);if(!e)return null;try{const n=decodeURIComponent(e[1]);return n&&!n.includes("/")?n:null}catch{return null}}function xD(t){return"/?"+new URLSearchParams({return:mr(t)}).toString()}function vD(t){const e=new URLSearchParams(t).get("return");return e?js(e):null}function AD(t){if(!t||typeof t!="object")return!1;const e=t;return e.texliteRoute==="project"&&typeof e.projectId=="string"&&typeof e.fromDashboard=="boolean"}const kD="modulepreload",SD=function(t){return"/"+t},Bl={},ts=function(e,n,s){let r=Promise.resolve();if(n&&n.length>0){let l=function(u){return Promise.all(u.map(d=>Promise.resolve(d).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),c=a?.nonce||a?.getAttribute("nonce");r=l(n.map(u=>{if(u=SD(u),u in Bl)return;Bl[u]=!0;const d=u.endsWith(".css"),h=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${h}`))return;const D=document.createElement("link");if(D.rel=d?"stylesheet":kD,d||(D.as="script"),D.crossOrigin="",D.href=u,c&&D.setAttribute("nonce",c),document.head.appendChild(D),d)return new Promise((m,g)=>{D.addEventListener("load",m),D.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${u}`)))})}))}function o(a){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=a,window.dispatchEvent(c),!c.defaultPrevented)throw a}return r.then(a=>{for(const c of a||[])c.status==="rejected"&&o(c.reason);return e().catch(o)})},Ui=()=>ts(()=>import("./PdfPreview-D5CC-vqV.js"),__vite__mapDeps([0,1,2,3])),ti=new Map,Ll=2e3;function ni(t,e={}){const n=Date.now(),s=ti.get(t);if(!e.force&&s&&n-s.createdAt<Ll)return s.preload;const r=ee(`/api/projects/${t}`,{suppressSessionExpired:!0}),o=ee(`/api/projects/${t}/compile/latest`,{suppressSessionExpired:!0}),a=Ui(),c={projectId:t,project:r,latestCompile:o};return ti.set(t,{preload:c,createdAt:n}),r.catch(()=>{}),Promise.all([a,o]).then(([l,u])=>{u.pdfUrl&&l.preloadPdf(u.pdfUrl,u.pdfLoadingMode??"full")}).catch(()=>{}),window.setTimeout(()=>{ti.get(t)?.preload===c&&ti.delete(t)},Ll),c}function de(t){return t instanceof Error?t.message:qe.t("errors.generic")}function za({compact:t=!1}){const{i18n:e,t:n}=st(),s=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:s,"aria-label":n("common.language"),onChange:r=>{e.changeLanguage(r.target.value)},children:[i.jsx("option",{value:"en",children:n("common.languageEnglish")}),i.jsx("option",{value:"zh",children:n("common.languageChinese")})]})]})}const jD="0.8.1";function zi({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 Ha(){const{t}=st();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",jD]})]}),i.jsx("span",{children:t("footer.credit")})]})}function TD({site:t,user:e,onChanged:n}){const{t:s}=st(),[r,o]=f.useState(""),[a,c]=f.useState(""),[l,u]=f.useState(""),[d,h]=f.useState(""),D=async m=>{if(m.preventDefault(),a!==l)return h(s("auth.mismatch"));if(a.length<t.minPasswordLength)return h(s("auth.passwordMinimum",{count:t.minPasswordLength}));try{await ee("/api/me/password",{method:"PUT",body:JSON.stringify({currentPassword:r,newPassword:a})}),n({...e,mustChangePassword:!1})}catch(g){h(de(g))}};return i.jsxs("main",{className:"login-page",children:[i.jsx(za,{}),i.jsxs("form",{className:"login-card",onSubmit:D,children:[i.jsx(zi,{siteName:t.siteName,auth:!0}),i.jsx("h1",{className:"sr-only",children:t.siteName}),i.jsx("p",{className:"muted",children:s("auth.firstLogin")}),i.jsxs("label",{children:[s("auth.currentPassword"),i.jsx("input",{type:"password",value:r,onChange:m=>o(m.target.value)})]}),i.jsxs("label",{children:[s("auth.newPassword"),i.jsx("input",{type:"password",minLength:t.minPasswordLength,autoComplete:"new-password",value:a,onChange:m=>c(m.target.value)}),i.jsx("small",{className:"field-hint",children:s("auth.passwordMinimum",{count:t.minPasswordLength})})]}),i.jsxs("label",{children:[s("auth.confirmPassword"),i.jsx("input",{type:"password",minLength:t.minPasswordLength,autoComplete:"new-password",value:l,onChange:m=>u(m.target.value)})]}),d&&i.jsx("p",{className:"error",children:d}),i.jsx("button",{className:"primary",children:s("auth.updatePassword")})]}),i.jsx(Ha,{})]})}function BD({site:t,onLogin:e}){const{t:n}=st(),[s,r]=f.useState(""),[o,a]=f.useState(""),[c,l]=f.useState(""),u=async d=>{d.preventDefault(),l("");try{const h=await ee("/api/auth/login",{method:"POST",body:JSON.stringify({username:s,password:o}),suppressSessionExpired:!0});e(h.user)}catch(h){l(de(h))}};return i.jsxs("main",{className:"login-page",children:[i.jsx(za,{}),i.jsxs("form",{className:"login-card",onSubmit:u,children:[i.jsx(zi,{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:s,onChange:d=>r(d.target.value)})]}),i.jsxs("label",{children:[n("auth.password"),i.jsx("input",{type:"password",value:o,onChange:d=>a(d.target.value)})]}),c&&i.jsx("p",{className:"error",children:c}),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(Ha,{})]})}var LD=Object.defineProperty,nr=(t,e)=>LD(t,"name",{value:e,configurable:!0}),Ku=!!(typeof window<"u"&&window.document&&window.document.createElement);function Yn(t,e,{checkForDefaultPrevented:n=!0}={}){return nr(function(r){if(t?.(r),n===!1||!r||!r.defaultPrevented)return e?.(r)},"handleEvent")}nr(Yn,"composeEventHandlers");function ND(t){if(!Ku)throw new Error("Cannot access window outside of the DOM");return t?.ownerDocument?.defaultView??window}nr(ND,"getOwnerWindow");function ta(t){if(!Ku)throw new Error("Cannot access document outside of the DOM");return t?.ownerDocument??document}nr(ta,"getOwnerDocument");function Gu(t,e=!1){const{activeElement:n}=ta(t);if(!n?.nodeName)return null;if(Yu(n)&&n.contentDocument)return Gu(n.contentDocument.body,e);if(e){const s=n.getAttribute("aria-activedescendant");if(s){const r=ta(n).getElementById(s);if(r)return r}}return n}nr(Gu,"getActiveElement");function Yu(t){return t.tagName==="IFRAME"}nr(Yu,"isFrame");var RD=Object.defineProperty,Va=(t,e)=>RD(t,"name",{value:e,configurable:!0});function na(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}Va(na,"setRef");function Xu(...t){return e=>{let n=!1;const s=t.map(r=>{const o=na(r,e);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let r=0;r<s.length;r++){const o=s[r];typeof o=="function"?o():na(t[r],null)}}}}Va(Xu,"composeRefs");function sr(...t){return f.useCallback(Xu(...t),t)}Va(sr,"useComposedRefs");var OD=Object.defineProperty,rn=(t,e)=>OD(t,"name",{value:e,configurable:!0});function PD(t,e){const n=f.createContext(e);n.displayName=t+"Context";const s=rn(o=>{const{children:a,...c}=o,l=f.useMemo(()=>c,Object.values(c));return i.jsx(n.Provider,{value:l,children:a})},"Provider");s.displayName=t+"Provider";function r(o,a={}){const{optional:c=!1}=a,l=f.useContext(n);if(l)return l;if(e!==void 0)return e;if(!c)throw new Error(`\`${o}\` must be used within \`${t}\``)}return rn(r,"useContext"),[s,r]}rn(PD,"createContext");function Ju(t,e=[]){let n=[];function s(o,a){const c=f.createContext(a);c.displayName=o+"Context";const l=n.length;n=[...n,a];const u=rn(h=>{const{scope:D,children:m,...g}=h,y=D?.[t]?.[l]||c,b=f.useMemo(()=>g,Object.values(g));return i.jsx(y.Provider,{value:b,children:m})},"Provider");u.displayName=o+"Provider";function d(h,D,m={}){const{optional:g=!1}=m,y=D?.[t]?.[l]||c,b=f.useContext(y);if(b)return b;if(a!==void 0)return a;if(!g)throw new Error(`\`${h}\` must be used within \`${o}\``)}return rn(d,"useContext"),[u,d]}rn(s,"createContext");const r=rn(()=>{const o=n.map(a=>f.createContext(a));return rn(function(c){const l=c?.[t]||o;return f.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])},"useScope")},"createScope");return r.scopeName=t,[s,Zu(r,...e)]}rn(Ju,"createContextScope");function Zu(...t){const e=t[0];if(t.length===1)return e;const n=rn(()=>{const s=t.map(r=>({useScope:r(),scopeName:r.scopeName}));return rn(function(o){const a=s.reduce((c,{useScope:l,scopeName:u})=>{const h=l(o)[`__scope${u}`];return{...c,...h}},{});return f.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])},"useComposedScopes")},"createScope");return n.scopeName=e.scopeName,n}rn(Zu,"composeContextScopes");var Xn=globalThis?.document?f.useLayoutEffect:()=>{},_D=Object.defineProperty,ID=(t,e)=>_D(t,"name",{value:e,configurable:!0}),MD=Ir[" useId ".trim().toString()]||(()=>{}),$D=0;function di(t){const[e,n]=f.useState(MD());return Xn(()=>{t||n(s=>s??String($D++))},[t]),t||(e?`radix-${e}`:"")}ID(di,"useId");var UD=Object.defineProperty,zD=(t,e)=>UD(t,"name",{value:e,configurable:!0}),Nl=Ir[" useEffectEvent ".trim().toString()],Rl=Ir[" useInsertionEffect ".trim().toString()];function Qu(t){if(typeof Nl=="function")return Nl(t);const e=f.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Rl=="function"?Rl(()=>{e.current=t}):Xn(()=>{e.current=t}),f.useMemo(()=>((...n)=>e.current?.(...n)),[])}zD(Qu,"useEffectEvent");var HD=Object.defineProperty,Mr=(t,e)=>HD(t,"name",{value:e,configurable:!0}),VD=Ir[" useInsertionEffect ".trim().toString()]||Xn;function ed({prop:t,defaultProp:e,onChange:n=Mr(()=>{},"onChange"),caller:s}){const[r,o,a]=td({defaultProp:e,onChange:n}),c=t!==void 0,l=c?t:r,u=f.useCallback(d=>{if(c){const h=nd(d)?d(t):d;h!==t&&a.current?.(h)}else o(d)},[c,t,o,a]);return[l,u]}Mr(ed,"useControllableState");function td({defaultProp:t,onChange:e}){const[n,s]=f.useState(t),r=f.useRef(n),o=f.useRef(e);return VD(()=>{o.current=e},[e]),f.useEffect(()=>{r.current!==n&&(o.current?.(n),r.current=n)},[n,r]),[n,s,o]}Mr(td,"useUncontrolledState");function nd(t){return typeof t=="function"}Mr(nd,"isFunction");var Ol=Symbol("RADIX:SYNC_STATE");function qD(t,e,n,s){const{prop:r,defaultProp:o,onChange:a,caller:c}=e,l=r!==void 0,u=Qu(a),d=[{...n,state:o}];s&&d.push(s);const[h,D]=f.useReducer((b,w)=>{if(w.type===Ol)return{...b,state:w.state};const v=t(b,w);return l&&!Object.is(v.state,b.state)&&u(v.state),v},...d),m=h.state,g=f.useRef(m);f.useEffect(()=>{g.current!==m&&(g.current=m,l||u(m))},[m,g,l]);const y=f.useMemo(()=>r!==void 0?{...h,state:r}:h,[h,r]);return f.useEffect(()=>{l&&!Object.is(r,h.state)&&D({type:Ol,state:r})},[r,h.state,l]),[y,D]}Mr(qD,"useControllableStateReducer");var WD=Object.defineProperty,gn=(t,e)=>WD(t,"name",{value:e,configurable:!0});function qa(t){const e=f.forwardRef((n,s)=>{let{children:r,...o}=n,a=null,c=!1;const l=[];sa(r)&&typeof si=="function"&&(r=si(r._payload)),f.Children.forEach(r,D=>{if(od(D)){c=!0;const m=D;let g="child"in m.props?m.props.child:m.props.children;sa(g)&&typeof si=="function"&&(g=si(g._payload)),a=GD(m,g),l.push(a?.props?.children)}else l.push(D)}),a?a=f.cloneElement(a,void 0,l):!c&&f.Children.count(r)===1&&f.isValidElement(r)&&(a=r);const u=a?id(a):void 0,d=sr(s,u);if(!a){if(r||r===0)throw new Error(c?JD(t):XD(t));return r}const h=rd(o,a.props??{});return a.type!==f.Fragment&&(h.ref=s?d:u),f.cloneElement(a,h)});return e.displayName=`${t}.Slot`,e}gn(qa,"createSlot");var sd=Symbol.for("radix.slottable");function KD(t){const e=gn(n=>"child"in n?n.children(n.child):n.children,"Slottable");return e.displayName=`${t}.Slottable`,e.__radixId=sd,e}gn(KD,"createSlottable");var GD=gn((t,e)=>{if("child"in t.props){const n=t.props.child;return f.isValidElement(n)?f.cloneElement(n,void 0,t.props.children(n.props.children)):null}return f.isValidElement(e)?e:null},"getSlottableElementFromSlottable");function rd(t,e){const n={...e};for(const s in e){const r=t[s],o=e[s];/^on[A-Z]/.test(s)?r&&o?n[s]=(...c)=>{const l=o(...c);return r(...c),l}:r&&(n[s]=r):s==="style"?n[s]={...r,...o}:s==="className"&&(n[s]=[r,o].filter(Boolean).join(" "))}return{...t,...n}}gn(rd,"mergeProps");function id(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)}gn(id,"getElementRef");function od(t){return f.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===sd}gn(od,"isSlottable");var YD=Symbol.for("react.lazy");function sa(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===YD&&"_payload"in t&&ad(t._payload)}gn(sa,"isLazyComponent");function ad(t){return typeof t=="object"&&t!==null&&"then"in t}gn(ad,"isPromiseLike");var XD=gn(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),JD=gn(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),si=Ir[" use ".trim().toString()],ZD=Object.defineProperty,QD=(t,e)=>ZD(t,"name",{value:e,configurable:!0}),e0=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ms=e0.reduce((t,e)=>{const n=qa(`Primitive.${e}`),s=f.forwardRef((r,o)=>{const{asChild:a,...c}=r,l=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(l,{...c,ref:o})});return s.displayName=`Primitive.${e}`,{...t,[e]:s}},{});function cd(t,e){t&&Pu.flushSync(()=>t.dispatchEvent(e))}QD(cd,"dispatchDiscreteCustomEvent");var t0=Object.defineProperty,n0=(t,e)=>t0(t,"name",{value:e,configurable:!0});function qs(t){const e=f.useRef(t);return f.useEffect(()=>{e.current=t}),f.useMemo(()=>((...n)=>e.current?.(...n)),[])}n0(qs,"useCallbackRef");var s0=Object.defineProperty,Rt=(t,e)=>s0(t,"name",{value:e,configurable:!0}),ra="dismissableLayer.update",r0="dismissableLayer.pointerDownOutside",i0="dismissableLayer.focusOutside",Pl,ld=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),o0=f.forwardRef(Rt(function(e,n){const{disableOutsidePointerEvents:s=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:c,onInteractOutside:l,onDismiss:u,...d}=e,h=f.useContext(ld),[D,m]=f.useState(null),g=D?.ownerDocument??globalThis?.document,[,y]=f.useState({}),b=sr(n,m),w=Array.from(h.layers),[v]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),j=v?w.indexOf(v):-1,N=D?w.indexOf(D):-1,z=h.layersWithOutsidePointerEventsDisabled.size>0,V=N>=j,U=f.useRef(!1),G=dd(_=>{a?.(_),l?.(_),_.defaultPrevented||u?.()},{ownerDocument:g,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:U,dismissableSurfaces:h.dismissableSurfaces,shouldHandlePointerDownOutside:f.useCallback(_=>{if(!(_ instanceof Node))return!1;const W=[...h.branches].some(T=>T.contains(_));return V&&!W},[h.branches,V])}),X=hd(_=>{if(r&&U.current)return;const W=_.target;[...h.branches].some(k=>k.contains(W))||(c?.(_),l?.(_),_.defaultPrevented||u?.())},g),K=D?N===w.length-1:!1,le=qs(_=>{_.key==="Escape"&&(o?.(_),!_.defaultPrevented&&u&&(_.preventDefault(),u()))});return f.useEffect(()=>{if(K)return g.addEventListener("keydown",le,{capture:!0}),()=>g.removeEventListener("keydown",le,{capture:!0})},[g,K,le]),f.useEffect(()=>{if(D)return s&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(Pl=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(D)),h.layers.add(D),ia(),()=>{s&&(h.layersWithOutsidePointerEventsDisabled.delete(D),h.layersWithOutsidePointerEventsDisabled.size===0&&(g.body.style.pointerEvents=Pl))}},[D,g,s,h]),f.useEffect(()=>()=>{D&&(h.layers.delete(D),h.layersWithOutsidePointerEventsDisabled.delete(D),ia())},[D,h]),f.useEffect(()=>{const _=Rt(()=>y({}),"handleUpdate");return document.addEventListener(ra,_),()=>document.removeEventListener(ra,_)},[]),i.jsx(ms.div,{...d,ref:b,style:{pointerEvents:z?V?"auto":"none":void 0,...e.style},onFocusCapture:Yn(e.onFocusCapture,X.onFocusCapture),onBlurCapture:Yn(e.onBlurCapture,X.onBlurCapture),onPointerDownCapture:Yn(e.onPointerDownCapture,G.onPointerDownCapture)})},"DismissableLayer"));function ud(){const t=f.useContext(ld),[e,n]=f.useState(null);return f.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}Rt(ud,"useDismissableLayerSurface");var a0=Rt(()=>!0,"IS_TRUE");function dd(t,e){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:s=!1,isDeferredPointerDownOutsideRef:r,dismissableSurfaces:o,shouldHandlePointerDownOutside:a=a0}=e,c=qs(t),l=f.useRef(!1),u=f.useRef(!1),d=f.useRef(new Map),h=f.useRef(()=>{});return f.useEffect(()=>{function D(){u.current=!1,r.current=!1,d.current.clear()}Rt(D,"resetOutsideInteraction");function m(){return Array.from(d.current.values()).some(Boolean)}Rt(m,"isOutsideInteractionIntercepted");function g(j){if(!u.current)return;const N=j.target;N instanceof Node&&[...o].some(V=>V.contains(N))||d.current.set(j.type,!0),j.type==="click"&&window.setTimeout(()=>{u.current&&h.current()},0)}Rt(g,"handleInteractionCapture");function y(j){u.current&&d.current.set(j.type,!1)}Rt(y,"handleInteractionBubble");const b=Rt(j=>{if(j.target&&!l.current){let N=function(){n.removeEventListener("click",h.current);const V=m();D(),V||Wa(r0,c,z,{discrete:!0})};if(Rt(N,"handleAndDispatchPointerDownOutsideEvent"),!a(j.target)){n.removeEventListener("click",h.current),D(),l.current=!1;return}const z={originalEvent:j};u.current=!0,r.current=s&&j.button===0,d.current.clear(),!s||j.button!==0?N():(n.removeEventListener("click",h.current),h.current=N,n.addEventListener("click",h.current,{once:!0}))}else n.removeEventListener("click",h.current),D();l.current=!1},"handlePointerDown"),w=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const j of w)n.addEventListener(j,g,!0),n.addEventListener(j,y);const v=window.setTimeout(()=>{n.addEventListener("pointerdown",b)},0);return()=>{window.clearTimeout(v),n.removeEventListener("pointerdown",b),n.removeEventListener("click",h.current);for(const j of w)n.removeEventListener(j,g,!0),n.removeEventListener(j,y)}},[n,c,s,r,o,a]),{onPointerDownCapture:Rt(()=>l.current=!0,"onPointerDownCapture")}}Rt(dd,"usePointerDownOutside");function hd(t,e=globalThis?.document){const n=qs(t),s=f.useRef(!1);return f.useEffect(()=>{const r=Rt(o=>{o.target&&!s.current&&Wa(i0,n,{originalEvent:o},{discrete:!1})},"handleFocus");return e.addEventListener("focusin",r),()=>e.removeEventListener("focusin",r)},[e,n]),{onFocusCapture:Rt(()=>s.current=!0,"onFocusCapture"),onBlurCapture:Rt(()=>s.current=!1,"onBlurCapture")}}Rt(hd,"useFocusOutside");function ia(){const t=new CustomEvent(ra);document.dispatchEvent(t)}Rt(ia,"dispatchUpdate");function Wa(t,e,n,{discrete:s}){const r=n.originalEvent.target,o=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&r.addEventListener(t,e,{once:!0}),s?cd(r,o):r.dispatchEvent(o)}Rt(Wa,"handleAndDispatchCustomEvent");var c0=Object.defineProperty,Ht=(t,e)=>c0(t,"name",{value:e,configurable:!0}),ko="focusScope.autoFocusOnMount",So="focusScope.autoFocusOnUnmount",_l={bubbles:!1,cancelable:!0},l0=f.forwardRef(Ht(function(e,n){const{loop:s=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...c}=e,[l,u]=f.useState(null),d=qs(o),h=qs(a),D=f.useRef(null),m=sr(n,u),g=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(r){let b=function(N){if(g.paused||!l)return;const z=N.target;l.contains(z)?D.current=z:On(D.current,{select:!0})},w=function(N){if(g.paused||!l)return;const z=N.relatedTarget;z!==null&&(l.contains(z)||On(D.current,{select:!0}))},v=function(N){if(document.activeElement===document.body)for(const V of N)V.removedNodes.length>0&&On(l)};Ht(b,"handleFocusIn"),Ht(w,"handleFocusOut"),Ht(v,"handleMutations"),document.addEventListener("focusin",b),document.addEventListener("focusout",w);const j=new MutationObserver(v);return l&&j.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",w),j.disconnect()}}},[r,l,g.paused]),f.useEffect(()=>{if(l){Il.add(g);const b=document.activeElement;if(!l.contains(b)){const v=new CustomEvent(ko,_l);l.addEventListener(ko,d),l.dispatchEvent(v),v.defaultPrevented||(fd(Fd(Ka(l)),{select:!0}),document.activeElement===b&&On(l))}return()=>{l.removeEventListener(ko,d),setTimeout(()=>{const v=new CustomEvent(So,_l);l.addEventListener(So,h),l.dispatchEvent(v),v.defaultPrevented||On(b??document.body,{select:!0}),l.removeEventListener(So,h),Il.remove(g)},0)}}},[l,d,h,g]);const y=f.useCallback(b=>{if(!s&&!r||g.paused)return;const w=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,v=document.activeElement;if(w&&v){const j=b.currentTarget,[N,z]=pd(j);N&&z?!b.shiftKey&&v===z?(b.preventDefault(),s&&On(N,{select:!0})):b.shiftKey&&v===N&&(b.preventDefault(),s&&On(z,{select:!0})):v===j&&b.preventDefault()}},[s,r,g.paused]);return i.jsx(ms.div,{tabIndex:-1,...c,ref:m,onKeyDown:y})},"FocusScope"));function fd(t,{select:e=!1}={}){const n=document.activeElement;for(const s of t)if(On(s,{select:e}),document.activeElement!==n)return}Ht(fd,"focusFirst");function pd(t){const e=Ka(t),n=oa(e,t),s=oa(e.reverse(),t);return[n,s]}Ht(pd,"getTabbableEdges");function Ka(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:Ht(s=>{const r=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||r?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)e.push(n.currentNode);return e}Ht(Ka,"getTabbableCandidates");function oa(t,e){const n=typeof e.checkVisibility=="function"&&e.checkVisibility({checkVisibilityCSS:!0});for(const s of t)if(!(n?!s.checkVisibility({checkVisibilityCSS:!0}):md(s,{upTo:e})))return s}Ht(oa,"findVisible");function md(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}Ht(md,"isHidden");function Dd(t){return t instanceof HTMLInputElement&&"select"in t}Ht(Dd,"isSelectableInput");function On(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&Dd(t)&&e&&t.select()}}Ht(On,"focus");var Il=gd();function gd(){let t=[];return{add(e){const n=t[0];e!==n&&n?.pause(),t=aa(t,e),t.unshift(e)},remove(e){t=aa(t,e),t[0]?.resume()}}}Ht(gd,"createFocusScopesStack");function aa(t,e){const n=[...t],s=n.indexOf(e);return s!==-1&&n.splice(s,1),n}Ht(aa,"arrayRemove");function Fd(t){return t.filter(e=>e.tagName!=="A")}Ht(Fd,"removeLinks");var u0=Object.defineProperty,d0=(t,e)=>u0(t,"name",{value:e,configurable:!0}),h0=f.forwardRef(d0(function(e,n){const{container:s,...r}=e,[o,a]=f.useState(!1);Xn(()=>a(!0),[]);const c=s||o&&globalThis?.document?.body;return c?Pu.createPortal(i.jsx(ms.div,{...r,ref:n}),c):null},"Portal")),f0=Object.defineProperty,In=(t,e)=>f0(t,"name",{value:e,configurable:!0});function bd(t,e){return f.useReducer((n,s)=>e[n][s]??n,t)}In(bd,"useStateMachine");var Ga=In(t=>{const{present:e,children:n}=t,s=yd(e),r=typeof n=="function"?n({present:s.isPresent}):f.Children.only(n),o=Cd(s.ref,Ed(r));return typeof n=="function"||s.isPresent?f.cloneElement(r,{ref:o}):null},"Presence");function yd(t){const[e,n]=f.useState(),s=f.useRef(null),r=f.useRef(t),o=f.useRef("none"),a=f.useRef(void 0),c=t?"mounted":"unmounted",[l,u]=bd(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{l==="mounted"?(o.current=a.current??Ts(s.current),a.current=void 0):o.current="none"},[l]),Xn(()=>{const d=s.current,h=r.current;if(h!==t){const m=o.current,g=Ts(d);t?(a.current=g,u("MOUNT")):g==="none"||d?.display==="none"?u("UNMOUNT"):u(h&&m!==g?"ANIMATION_OUT":"UNMOUNT"),r.current=t}},[t,u]),Xn(()=>{if(e){let d;const h=e.ownerDocument.defaultView??window,D=In(g=>{const b=Ts(s.current).includes(CSS.escape(g.animationName));if(g.target===e&&b&&(u("ANIMATION_END"),!r.current)){const w=e.style.animationFillMode;e.style.animationFillMode="forwards",d=h.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=w)})}},"handleAnimationEnd"),m=In(g=>{g.target===e&&(o.current=Ts(s.current))},"handleAnimationStart");return e.addEventListener("animationstart",m),e.addEventListener("animationcancel",D),e.addEventListener("animationend",D),()=>{h.clearTimeout(d),e.removeEventListener("animationstart",m),e.removeEventListener("animationcancel",D),e.removeEventListener("animationend",D)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:f.useCallback(d=>{if(d){const h=getComputedStyle(d);s.current=h,a.current=Ts(h)}else s.current=null;n(d)},[])}}In(yd,"usePresence");function ca(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}In(ca,"setRef");function Cd(...t){const e=f.useRef(t);return e.current=t,f.useCallback(n=>{const s=e.current;let r=!1;const o=s.map(a=>{const c=ca(a,n);return!r&&typeof c=="function"&&(r=!0),c});if(r)return()=>{for(let a=0;a<o.length;a++){const c=o[a];typeof c=="function"?c():ca(s[a],null)}}},[])}In(Cd,"useStableComposedRefs");function Ts(t){return t?.animationName||"none"}In(Ts,"getAnimationName");function Ed(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)}In(Ed,"getElementRef");var p0=Object.defineProperty,Ya=(t,e)=>p0(t,"name",{value:e,configurable:!0}),ri=0,vs=null;function m0(t){return Xa(),t.children}Ya(m0,"FocusGuards");function Xa(){f.useEffect(()=>{vs||(vs={start:la(),end:la()});const{start:t,end:e}=vs;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),ri++,()=>{ri===1&&(vs?.start.remove(),vs?.end.remove(),vs=null),ri=Math.max(0,ri-1)}},[])}Ya(Xa,"useFocusGuards");function la(){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}Ya(la,"createFocusGuard");var D0=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},As=new WeakMap,ii=new WeakMap,oi={},jo=0,wd=function(t){return t&&(t.host||wd(t.parentNode))},g0=function(t,e){return e.map(function(n){if(t.contains(n))return n;var s=wd(n);return s&&t.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},F0=function(t,e,n,s){var r=g0(e,Array.isArray(t)?t:[t]);oi[n]||(oi[n]=new WeakMap);var o=oi[n],a=[],c=new Set,l=new Set(r),u=function(h){!h||c.has(h)||(c.add(h),u(h.parentNode))};r.forEach(u);var d=function(h){!h||l.has(h)||Array.prototype.forEach.call(h.children,function(D){if(c.has(D))d(D);else try{var m=D.getAttribute(s),g=m!==null&&m!=="false",y=(As.get(D)||0)+1,b=(o.get(D)||0)+1;As.set(D,y),o.set(D,b),a.push(D),y===1&&g&&ii.set(D,!0),b===1&&D.setAttribute(n,"true"),g||D.setAttribute(s,"true")}catch(w){console.error("aria-hidden: cannot operate on ",D,w)}})};return d(e),c.clear(),jo++,function(){a.forEach(function(h){var D=As.get(h)-1,m=o.get(h)-1;As.set(h,D),o.set(h,m),D||(ii.has(h)||h.removeAttribute(s),ii.delete(h)),m||h.removeAttribute(n)}),jo--,jo||(As=new WeakMap,As=new WeakMap,ii=new WeakMap,oi={})}},b0=function(t,e,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(t)?t:[t]),r=D0(t);return r?(s.push.apply(s,Array.from(r.querySelectorAll("[aria-live], script"))),F0(s,r,n,"aria-hidden")):function(){return null}},y0=Object.defineProperty,ln=(t,e)=>y0(t,"name",{value:e,configurable:!0}),Ja="Dialog",[xd,aC]=Ju(Ja),[C0,An]=xd(Ja),E0=ln(t=>{const{__scopeDialog:e,children:n,open:s,defaultOpen:r,onOpenChange:o,modal:a=!0}=t,c=f.useRef(null),l=f.useRef(null),[u,d]=ed({prop:s,defaultProp:r??!1,onChange:o,caller:Ja}),[h,D]=f.useState(0),[m,g]=f.useState(0);return i.jsx(C0,{scope:e,triggerRef:c,contentRef:l,contentId:di(),titleId:di(),descriptionId:di(),titlePresent:h>0,descriptionPresent:m>0,setTitleCount:D,setDescriptionCount:g,open:u,onOpenChange:d,onOpenToggle:f.useCallback(()=>d(y=>!y),[d]),modal:a,children:n})},"Dialog"),vd="DialogPortal",[w0,Ad]=xd(vd,{forceMount:void 0}),x0=ln(t=>{const{__scopeDialog:e,forceMount:n,children:s,container:r}=t,o=An(vd,e);return i.jsx(w0,{scope:e,forceMount:n,children:f.Children.map(s,a=>i.jsx(Ga,{present:n||o.open,children:i.jsx(h0,{asChild:!0,container:r,children:a})}))})},"DialogPortal"),ua="DialogOverlay",v0=f.forwardRef(ln(function(e,n){const s=Ad(ua,e.__scopeDialog),{forceMount:r=s.forceMount,...o}=e,a=An(ua,e.__scopeDialog);return a.modal?i.jsx(Ga,{present:r||a.open,children:i.jsx(k0,{...o,ref:n})}):null},"DialogOverlay")),A0=qa("DialogOverlay.RemoveScroll"),k0=f.forwardRef(ln(function(e,n){const{__scopeDialog:s,...r}=e,o=An(ua,s),a=ud(),c=sr(n,a);return i.jsx($p,{as:A0,allowPinchZoom:!0,shards:[o.contentRef],children:i.jsx(ms.div,{"data-state":Za(o.open),...r,ref:c,style:{pointerEvents:"auto",...r.style}})})},"DialogOverlayImpl")),vr="DialogContent",S0=f.forwardRef(ln(function(e,n){const s=Ad(vr,e.__scopeDialog),{forceMount:r=s.forceMount,...o}=e,a=An(vr,e.__scopeDialog);return i.jsx(Ga,{present:r||a.open,children:a.modal?i.jsx(j0,{...o,ref:n}):i.jsx(T0,{...o,ref:n})})},"DialogContent")),j0=f.forwardRef(ln(function(e,n){const s=An(vr,e.__scopeDialog),r=f.useRef(null),o=sr(n,s.contentRef,r);return f.useEffect(()=>{const a=r.current;if(a)return b0(a)},[]),i.jsx(kd,{...e,ref:o,trapFocus:s.open,disableOutsidePointerEvents:s.open,onCloseAutoFocus:Yn(e.onCloseAutoFocus,a=>{a.preventDefault(),s.triggerRef.current?.focus()}),onPointerDownOutside:Yn(e.onPointerDownOutside,a=>{const c=a.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0;(c.button===2||l)&&a.preventDefault()}),onFocusOutside:Yn(e.onFocusOutside,a=>a.preventDefault())})},"DialogContentModal")),T0=f.forwardRef(ln(function(e,n){const s=An(vr,e.__scopeDialog),r=f.useRef(!1),o=f.useRef(!1);return i.jsx(kd,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(r.current||s.triggerRef.current?.focus(),a.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const c=a.target;s.triggerRef.current?.contains(c)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}})},"DialogContentNonModal")),kd=f.forwardRef(ln(function(e,n){const{__scopeDialog:s,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,...c}=e,l=An(vr,s);return Xa(),i.jsx(i.Fragment,{children:i.jsx(l0,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:a,children:i.jsx(o0,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionPresent?l.descriptionId:void 0,"aria-labelledby":l.titlePresent?l.titleId:void 0,"data-state":Za(l.open),...c,ref:n,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1)})})})},"DialogContentImpl")),B0="DialogTitle",L0=f.forwardRef(ln(function(e,n){const{__scopeDialog:s,...r}=e,o=An(B0,s),{setTitleCount:a}=o;return Xn(()=>(a(c=>c+1),()=>a(c=>c-1)),[a]),i.jsx(ms.h2,{id:o.titleId,...r,ref:n})},"DialogTitle")),N0="DialogDescription",R0=f.forwardRef(ln(function(e,n){const{__scopeDialog:s,...r}=e,o=An(N0,s),{setDescriptionCount:a}=o;return Xn(()=>(a(c=>c+1),()=>a(c=>c-1)),[a]),i.jsx(ms.p,{id:o.descriptionId,...r,ref:n})},"DialogDescription")),O0="DialogClose",P0=f.forwardRef(ln(function(e,n){const{__scopeDialog:s,...r}=e,o=An(O0,s);return i.jsx(ms.button,{type:"button",...r,ref:n,onClick:Yn(e.onClick,()=>o.onOpenChange(!1))})},"DialogClose"));function Za(t){return t?"open":"closed"}ln(Za,"getState");const _0=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Sd=(...t)=>t.filter((e,n,s)=>!!e&&e.trim()!==""&&s.indexOf(e)===n).join(" ").trim();var I0={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 M0=f.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:r="",children:o,iconNode:a,...c},l)=>f.createElement("svg",{ref:l,...I0,width:e,height:e,stroke:t,strokeWidth:s?Number(n)*24/Number(e):n,className:Sd("lucide",r),...c},[...a.map(([u,d])=>f.createElement(u,d)),...Array.isArray(o)?o:[o]]));const re=(t,e)=>{const n=f.forwardRef(({className:s,...r},o)=>f.createElement(M0,{ref:o,iconNode:e,className:Sd(`lucide-${_0(t)}`,s),...r}));return n.displayName=`${t}`,n};const $0=re("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 jd=re("AlignLeft",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);const U0=re("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 Ml=re("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 z0=re("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 da=re("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const To=re("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 Ns=re("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 Qa=re("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 H0=re("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 us=re("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const Td=re("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Cr=re("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const Hi=re("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const V0=re("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);const q0=re("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);const W0=re("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);const Bd=re("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const ec=re("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 $l=re("Columns2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);const K0=re("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 G0=re("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 Ar=re("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 ha=re("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 fa=re("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 Y0=re("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 X0=re("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 Ws=re("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 J0=re("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 pa=re("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 Ld=re("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 Z0=re("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 Q0=re("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 eg=re("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 Nd=re("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 ma=re("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);const tg=re("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 ng=re("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 Ul=re("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 sg=re("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 rg=re("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 at=re("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const Rd=re("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 zl=re("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 Od=re("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 Pd=re("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 ig=re("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 og=re("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);const ag=re("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);const cg=re("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 lg=re("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 Da=re("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 ug=re("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);const hi=re("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const ga=re("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);const dg=re("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 hg=re("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 yi=re("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 Fa=re("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 _d=re("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);const fg=re("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 ba=re("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 pg=re("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 mg=re("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 Dg=re("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 gg=re("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 ya=re("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 cn=re("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 Zt=re("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 Ca=re("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=re("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 Fg=re("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 Ea=re("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 bg=re("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 kr=re("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 yg=re("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 Vt=re("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function pt({open:t,title:e,description:n,onOpenChange:s,children:r,footer:o,wide:a,extraWide:c,className:l}){const{t:u}=st();return i.jsx(E0,{open:t,onOpenChange:s,children:i.jsxs(x0,{children:[i.jsx(v0,{className:"dialog-overlay"}),i.jsxs(S0,{className:`dialog-content${a?" dialog-wide":""}${c?" dialog-extra-wide":""}${l?` ${l}`:""}`,children:[i.jsxs("div",{className:"dialog-header",children:[i.jsxs("div",{children:[i.jsx(L0,{children:e}),n&&i.jsx(R0,{children:n})]}),i.jsx(P0,{className:"dialog-close","aria-label":u("common.close"),children:"×"})]}),i.jsx("div",{className:"dialog-body",children:r}),o&&i.jsx("div",{className:"dialog-footer",children:o})]})]})})}function Jn({open:t,title:e,description:n,confirmLabel:s,danger:r,onCancel:o,onConfirm:a,error:c,busy:l=!1}){const{t:u}=st();return i.jsx(pt,{open:t,title:e,description:n,onOpenChange:d=>{!d&&!l&&o()},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{disabled:l,onClick:o,children:u("common.cancel")}),i.jsxs("button",{className:r?"danger":"primary",disabled:l,"aria-busy":l,onClick:a,children:[l&&i.jsx(at,{className:"spin",size:14}),s??u("common.remove")]})]}),children:i.jsxs(i.Fragment,{children:[c&&i.jsx("p",{className:"error dialog-error",children:c}),i.jsx("div",{})]})})}var Bo,Hl;function Cg(){if(Hl)return Bo;Hl=1;var t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,r=(p,E)=>t(p,"name",{value:E,configurable:!0}),o=(p,E)=>{for(var F in E)t(p,F,{get:E[F],enumerable:!0})},a=(p,E,F,I)=>{if(E&&typeof E=="object"||typeof E=="function")for(let P of n(E))!s.call(p,P)&&P!==F&&t(p,P,{get:()=>E[P],enumerable:!(I=e(E,P))||I.enumerable});return p},c=p=>a(t({},"__esModule",{value:!0}),p),l={};o(l,{getEntries:()=>ft,tidy:()=>ve}),Bo=c(l);var u=class{constructor(p=[]){this.children=p,this.type="root"}static{r(this,"RootNode")}},d=class{constructor(p,E){this.parent=p,this.text=E,this.type="text",p.children.push(this)}static{r(this,"TextNode")}},h=class{constructor(p){this.parent=p,this.type="block",this.command="",p.children.push(this)}static{r(this,"BlockNode")}},D=class{constructor(p,E,F,I){this.parent=p,this.raw=E,this.braces=F,this.parens=I,this.type="comment",p.block=this}static{r(this,"CommentNode")}},m=class{constructor(p,E,F,I){this.parent=p,this.raw=E,this.braces=F,this.parens=I,this.type="preamble",p.block=this}static{r(this,"PreambleNode")}},g=class{constructor(p,E,F,I){this.parent=p,this.raw=E,this.braces=F,this.parens=I,this.type="string",p.block=this}static{r(this,"StringNode")}},y=class{constructor(p,E){this.parent=p,this.wrapType=E,this.type="entry",p.block=this,this.fields=[]}static{r(this,"EntryNode")}},b=class{constructor(p,E=""){this.parent=p,this.name=E,this.type="field",this.value=new w(this)}static{r(this,"FieldNode")}},w=class{constructor(p){this.parent=p,this.type="concat",this.canConsumeValue=!0,this.concat=[]}static{r(this,"ConcatNode")}},v=class{constructor(p,E){this.parent=p,this.value=E,this.type="literal",p.concat.push(this)}static{r(this,"LiteralNode")}},j=class{constructor(p){this.parent=p,this.type="braced",this.value="",this.depth=0,p.concat.push(this)}static{r(this,"BracedNode")}},N=class{constructor(p){this.parent=p,this.type="quoted",this.value="",this.depth=0,p.concat.push(this)}static{r(this,"QuotedNode")}};function z(p){const E=new u;let F=E,I=1,P=0;for(let ae=0;ae<p.length;ae++){const L=p[ae]??"",je=p[ae-1]??"";switch(L===`
15
- `&&(I++,P=0),P++,F.type){case"root":{F=L==="@"?new h(F):new d(F,L);break}case"text":{L==="@"&&/[\s\r\n}]/.test(je)?F=new h(F.parent):F.text+=L;break}case"block":{if(L==="@"){const se=F.parent.children[F.parent.children.length-2];se?.type==="text"?se.text+=`@${F.command}`:(F.parent.children.pop(),new d(F.parent,`@${F.command}`),F.parent.children.push(F)),F.command=""}else if(L==="{"||L==="("){const se=F.command.trim();if(se===""||/\s/.test(se))F.parent.children.pop(),F=new d(F.parent,`@${F.command}${L}`);else{F.command=se;const He=F.command.toLowerCase(),[Le,Se]=L==="{"?[1,0]:[0,1],Ye=`@${He}${L}`;switch(He){case"string":F=new g(F,Ye,Le,Se);break;case"preamble":F=new m(F,Ye,Le,Se);break;case"comment":F=new D(F,Ye,Le,Se);break;default:F=new y(F,L);break}}}else L.match(/[=#,})[\]]/)?(F.parent.children.pop(),F=new d(F.parent,`@${F.command}${L}`)):F.command+=L;break}case"comment":case"string":case"preamble":L==="{"?F.braces++:L==="}"?F.braces--:L==="("?F.parens++:L===")"&&F.parens--,F.raw+=L,F.braces===0&&F.parens===0&&(F=F.parent.parent);break;case"entry":{if(V(L))F.key&&(F.keyEnded=!0);else if(L===",")F=new b(F);else if(F.wrapType==="{"&&L==="}"||F.wrapType==="("&&L===")")F=F.parent.parent;else if(L==="="&&F.key&&G(F.key)){const se=new b(F,F.key);F.fields.push(se),F.key=void 0,F=se.value}else{if(F.keyEnded)throw new X(p,F,ae,I,P,"The entry key cannot contain whitespace");if(U(L))F.key=(F.key??"")+L;else throw new X(p,F,ae,I,P,`The entry key cannot contain the character (${L})`)}break}case"field":{if(L==="}"||L===")")F.name=F.name.trim(),F=F.parent.parent.parent;else if(L==="=")F.name=F.name.trim(),F=F.value;else if(L===",")F.name=F.name.trim(),F=new b(F.parent);else if(G(L))F.name?F.name+=L:V(L)||(F.parent.fields.push(F),F.name=L);else throw new X(p,F,ae,I,P);break}case"concat":{if(V(L))break;if(F.canConsumeValue){if(/[#=,}()[\]]/.test(L))throw new X(p,F,ae,I,P);F.canConsumeValue=!1,L==="{"?F=new j(F):L==='"'?F=new N(F):F=new v(F,L)}else if(L===",")F=new b(F.parent.parent);else if(L==="}"||L===")")F=F.parent.parent.parent.parent;else if(L==="#")F.canConsumeValue=!0;else throw new X(p,F,ae,I,P);break}case"literal":V(L)?F=F.parent:L===","?F=new b(F.parent.parent.parent):L==="}"?F=F.parent.parent.parent.parent.parent:L==="#"?(F=F.parent,F.canConsumeValue=!0):F.value+=L;break;case"braced":if(L==="}"&&F.depth===0){F=F.parent;break}L==="{"?F.depth++:L==="}"&&F.depth--,F.value+=L;break;case"quoted":if(L==='"'&&F.depth===0){F=F.parent;break}if(L==="{")F.depth++;else if(L==="}"&&(F.depth--,F.depth<0))throw new X(p,F,ae,I,P);F.value+=L;break}}return E}r(z,"generateAST");function V(p){return/^[ \t\n\r]*$/.test(p)}r(V,"isWhitespace");function U(p){return!/[#%{}~$,]/.test(p)}r(U,"isValidKeyCharacter");function G(p){return!/[=,{}()[\]]/.test(p)}r(G,"isValidFieldName");var X=class extends Error{constructor(p,E,F,I,P,ae){super(`Line ${I}:${P}: Syntax Error in ${E.type} (${ae})
16
- ${p.slice(Math.max(0,F-20),F)}>>${p[F]}<<${p.slice(F+1,F+20)}`),this.node=E,this.line=I,this.column=P,this.hint=ae,this.name="Syntax Error",this.char=p[F]??""}static{r(this,"BibTeXSyntaxError")}};function K(p,E){return p.replace(/\s+/g," ").split(/ and /i).map(F=>{let I=F.trim();E&&(I=I.replace(/["{}]/g,""));const P=I.indexOf(",");if(P>-1)return{firstNames:I.slice(P+1).trim(),lastName:I.slice(0,P).trim()};const ae=I.lastIndexOf(" ");return{firstNames:I.slice(0,ae).trim(),lastName:I.slice(ae).trim()}})}r(K,"parseAuthors");var le=class Id{constructor(E,F,I=[]){this.kind=E,this.parent=F,this.children=I,this.type="block",F instanceof Id?F.children.push(this):F instanceof W&&F.args.push(this)}static{r(this,"BlockNode")}},_=class{constructor(p,E=""){this.parent=p,this.text=E,this.type="text",p.children.push(this)}static{r(this,"TextNode")}},W=class{constructor(p,E="",F=[]){this.parent=p,this.command=E,this.args=F,this.type="command",p.children.push(this)}static{r(this,"CommandNode")}};function T(p){const E=new le("root");let F=E;for(let I=0;I<p.length;I++){const P=p[I];if(!P)break;switch(F.type){case"block":{P==="\\"?F=new W(F):P==="{"?F=new le("curly",F):(P==="}"&&F.kind==="curly"||P==="]"&&F.kind==="square")&&F.parent?F=F.parent:F=new _(F,P);break}case"text":{P==="\\"||P==="{"||P==="}"&&F.parent.kind==="curly"||P==="]"&&F.parent.kind==="square"?(F=F.parent,I--):F.text+=P;break}case"command":P==="{"?F=new le("curly",F):P==="["?F=new le("square",F):P==="}"&&F.parent.kind==="curly"||P==="]"&&F.parent.kind==="square"||/\s/.test(P)||F.args.length>0?(F=F.parent,I--):F.command+=P}}return E}r(T,"parseLaTeX");function k(p){return R(p)}r(k,"stringifyLaTeX");function R(p){const E=p.children.map(F=>{switch(F.type){case"block":return R(F);case"command":return he(F);case"text":return F.text}}).join("");switch(p.kind){case"root":return E;case"curly":return`{${E}}`;case"square":return`[${E}]`}}r(R,"stringifyBlock");function he(p){return`\\${p.command}${p.args.map(R).join("")}`}r(he,"stringifyCommand");function be(p){const E={...p,children:[]};for(const F of p.children)if(F.type==="block"&&F.kind==="curly"&&F.children.every(I=>I.type!=="command")){const I=be(F);E.children.push(...I.children)}else E.children.push(F);return E}r(be,"flattenLaTeX");var Fe=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(p){let E=p;const F=[];E=E.replace(/\$[^$]+\$/g,ae=>(F.push(ae),`MATH.EXP.${F.length-1}`));let I="",P=!1;for(let ae=0;ae<E.length;ae++){if(P){P=!1,I+=E[ae];continue}if(E[ae]==="\\"){P=!0,I+=E[ae];continue}const L=E.charCodeAt(ae).toString(16).padStart(4,"0");I+=Fe.get(L)??E[ae]}return I.replace(/MATH\.EXP\.(\d+)/g,(ae,L)=>F[Number(L)]??"")}r(Ne,"escapeSpecialCharacters");function Ee(p){return p.replace(/(\w)(\S*)/g,(E,F,I)=>{const P=F+I;return B(P)?P:F.toLocaleUpperCase()+I.toLocaleLowerCase()})}r(Ee,"titleCase");function B(p){return/^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/.test(p)}r(B,"isRomanNumeral");function me(p){return p.replace(/[^0-9A-Za-z]/g,"").toLocaleLowerCase()}r(me,"alphaNum");function J(p){return p.replace(/\r\n?/g,`
17
- `)}r(J,"convertCRLF");function Z(p,E){const F=p.split(" "),I=[];let P="";for(const[ae,L]of F.entries())P.length+L.length+1>E&&ae>0&&(I.push(P.trim()),P=""),P+=`${L} `;return[...I,P.trim()]}r(Z,"wrapText");function ue(p){return p.replace(/\s*\n\s*\n\s*/g,"<<BIBTEX_TIDY_PARA>>").replace(/\s*\n\s*/g," ").replace(/<<BIBTEX_TIDY_PARA>>/g,`
18
-
19
- `)}r(ue,"unwrapText");function O(p){const E=T(p),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",I=k(E);return F?I:`{${I}}`}r(O,"doubleEnclose");function te(p){return p.replace(/^\{([^{}]*)\}$/g,"$1")}r(te,"removeEnclosingBraces");function A(p){return p.replace(/\\?_/g,"\\%5F")}r(A,"escapeURL");function De(p,E){const F=p.split(" and ");return F.length>E?[...F.slice(0,E),"others"].join(" and "):p}r(De,"limitAuthors");function Ce(p){let E=p;for(let F=0;F<4;F++)E=E.replace(/(\d)\s*-\s*(\d)/g,"$1--$2");return E}r(Ce,"formatPageRange");function Ve(p){return p.type!=="text"&&p.block?.type==="entry"}r(Ve,"isEntryNode");function lt(p,E,F,I){const P=new Map;if(F)for(const Se of F)P.set(Se,!!I);P.has("key")||P.set("key",!1);const ae=new Set,L=[],je=new Map,se=new Map,He=new Map,Le=new Map;for(const Se of ft(p)){const Ye=E.get(Se);if(Ye)for(const[St,Xe]of P){let rt,it;switch(St){case"key":{if(!Se.key)continue;const Ze=Se.key.toLocaleLowerCase();rt=je.get(Ze),rt?it=`The citation key ${Se.key} has already been used.`:je.set(Ze,Se);break}case"doi":{const Ze=me(Ye.get("doi")??"");if(!Ze)continue;rt=se.get(Ze),rt?it=`Entry ${Se.key} has an identical DOI to entry ${rt.key}.`:se.set(Ze,Se);break}case"citation":{const Ze=Ye.get("title"),dt=Ye.get("author"),Ct=Ye.get("number");if(!Ze||!dt)continue;const gt=[me(K(dt)[0]?.lastName??dt),me(Ze),me(Ct??"0")].join(":");rt=He.get(gt),rt?it=`Entry ${Se.key} has similar content to entry ${rt.key}.`:He.set(gt,Se);break}case"abstract":{const dt=me(Ye.get("abstract")??"").slice(0,100);if(!dt)continue;rt=Le.get(dt),rt?it=`Entry ${Se.key} has a similar abstract to entry ${rt.key}.`:Le.set(dt,Se);break}}rt&&Xe&&(ae.add(Se),We(I,rt,Se)),it&&L.push({code:"DUPLICATE_ENTRY",rule:St,message:`Duplicate ${Xe?"removed":"detected"}. ${it}`})}}return{entries:ae,warnings:L}}r(lt,"checkForDuplicates");function We(p,E,F){if(p)switch(p){case"last":E.key=F.key,E.fields=F.fields;break;case"combine":case"overwrite":for(const I of F.fields){const P=E.fields.find(ae=>ae.name.toLocaleLowerCase()===I.name.toLocaleLowerCase());P?p==="overwrite"&&(P.value=I.value):E.fields.push(I)}break;case"first":return}}r(We,"mergeEntries");var Ue=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],ye=new Set(Ue),Ke={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"},Je=["url","doi","eprint","file","verba","verbb","verbc","pdf"];function mt(p,E,F){const{omit:I,tab:P,space:ae}=E,L=P?" ":" ".repeat(ae),je=new Set(I);let se=p.children.map(He=>ge(He,E,L,je,F)).join("").trimEnd();return se.endsWith(`
20
- `)||(se+=`
21
- `),se}r(mt,"formatBibtex");function ge(p,E,F,I,P){if(p.type==="text")return ce(p.text,E);if(!p.block)throw new Error("FATAL!");switch(p.block.type){case"preamble":case"string":return`${p.block.raw}
22
- ${E.blankLines?`
23
- `:""}`;case"comment":return ce(p.block.raw,E);case"entry":return xt(p.command,p.block,E,F,I,P?.get(p.block))+(E.blankLines?`
24
- `:"")}}r(ge,"formatNode");function xt(p,E,F,I,P,ae){const{align:L,trailingCommas:je,removeDuplicateFields:se,removeEmptyFields:He,lowercase:Le}=F;let Se="";const Ye=Le?p.toLocaleLowerCase():p;Se+=`@${Ye}{`;const St=ae??E.key;St&&(Se+=`${St},`);const Xe=new Set;for(const[rt,it]of E.fields.entries()){const Ze=it.name.toLocaleLowerCase(),dt=Le?Ze:it.name;if(it.name!==""&&!P.has(Ze)&&!(se&&Xe.has(Ze))){if(Xe.add(Ze),it.value.concat.length===0){if(He)continue;Se+=`
25
- ${I}${dt}`}else{const Ct=ke(it,F);if(He&&(Ct==="{}"||Ct==='""'))continue;Se+=`
26
- ${I}${dt.trim().padEnd(L-1)} = ${Ct}`}(rt<E.fields.length-1||je)&&(Se+=",")}}return Se+=`
27
- }
28
- `,Se}r(xt,"formatEntry");function ce(p,{stripComments:E,tidyComments:F}){if(E)return"";if(F){const I=p.trim();return I===""?"":`${I}
29
- `}return p.replace(/^[ \t]*\n|[ \t]*$/g,"")}r(ce,"formatComment");function ke(p,E){const{curly:F,numeric:I,align:P,stripEnclosingBraces:ae,dropAllCaps:L,escape:je,encodeUrls:se,wrap:He,maxAuthors:Le,tab:Se,space:Ye,enclosingBraces:St,removeBraces:Xe,months:rt}=E,it=p.name.toLocaleLowerCase(),Ze=Se?" ":" ".repeat(Ye),dt=new Set((St??[]).map(gt=>gt.toLocaleLowerCase())),Ct=new Set((Xe??[]).map(gt=>gt.toLocaleLowerCase()));return p.value.concat.map(({type:gt,value:Pe})=>{const Lt=Pe.match(/^[1-9][0-9]*$/);if(Lt&&F&&(gt="braced"),rt&&it==="month"){const Tn=Ke[Pe.toLowerCase()];if(Tn)return Tn}if(gt==="literal"||I&&Lt)return Pe;const Wt=Pe.slice(0,3).toLowerCase(),ys=it==="month"&&ye.has(Wt);if(!F&&I&&ys)return Wt;if(Pe=ue(Pe),ae&&(Pe=te(Pe)),L&&!Pe.match(/[a-z]/)&&(Pe=Ee(Pe)),it==="url"&&se&&(Pe=A(Pe)),!Je.includes(it)&&je&&(Pe=Ne(Pe)),it==="pages"&&(Pe=Ce(Pe)),it==="author"&&Le&&(Pe=De(Pe,Le)),Ct.has(it)&&(Pe=k(be(T(Pe)))),dt.has(it)&&(gt==="braced"||F)&&(Pe=O(Pe)),gt==="braced"&&p.value.concat.length===1&&(Pe=Pe.trim()),gt==="braced"||F){const Tn=`${Ze}${P}{${Pe}}`.length,Bn=Pe.includes(`
30
-
31
- `);if(He&&Tn>He||Bn){let Ln=Pe.split(`
32
-
33
- `);const Qe=Ze.repeat(2);if(He){const Fn=He;Ln=Ln.map(jt=>Z(jt,Fn-Qe.length).join(`
34
- ${Qe}`))}Pe=`
35
- ${Qe}${Ln.join(`
36
-
37
- ${Qe}`)}
38
- ${Ze}`}return O(Pe)}return`"${Pe}"`}).join(" # ")}r(ke,"formatValue");var Re={auth:{description:"Last name of first authors",callback:r(p=>{const F=K(p.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:r(p=>{const E=K(p.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:r(p=>K(p.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:r((p,E=0)=>{const F=K(p.get("author")??"",!0);return[...F.slice(0,E).map(I=>I.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:r(p=>ze(xe(p)).slice(0,1),"callback")},shorttitle:{description:"First three non-function words of the title",callback:r(p=>ze(xe(p)).slice(0,3),"callback")},title:{description:"Full title, capitalized",callback:r(p=>tt(Ge(xe(p))),"callback")},fulltitle:{description:"Full title, verbatim",callback:r(p=>Ge(xe(p)),"callback")},year:{description:"Year",callback:r(p=>{const E=p.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:r(()=>["[duplicateLetter]"],"callback")},duplicateNumber:{description:"If the multiple entries end up with the same key, then insert a number.",callback:r(()=>["[duplicateNumber]"],"callback")}},Dt={required:{description:"If data is missing, revert to existing key",callback:r(p=>{if(p.length===0)throw new Me;return p},"callback")},lower:{description:"Convert to lowercase",callback:r(p=>p.map(E=>E.toLocaleLowerCase()),"callback")},upper:{description:"Convert to uppercase",callback:r(p=>p.map(E=>E.toLocaleUpperCase()),"callback")},capitalize:{description:"Capitalize first letter of each word",callback:tt}},Me=class extends Error{static{r(this,"MissingRequiredData")}};function H(p,E,F){let I=F;!F.includes("[duplicateLetter]")&&!F.includes("[duplicateNumber]")&&(I=`${F}[duplicateLetter]`);const P=new Map;for(const L of p.children)if(Ve(L)){const je=E.get(L.block);if(!je)continue;const se=fe(je,I);if(!se)continue;const He=P.get(se)??[];P.set(se,[...He,L.block])}const ae=new Map;for(const[L,je]of P)for(const[se,He]of je.entries()){const Le=je.length>1?String.fromCharCode(97+se):"",Se=je.length>1?String(se+1):"";He.key=L.replace(/\[duplicateLetter\]/g,Le).replace(/\[duplicateNumber\]/g,Se)}return ae}r(H,"generateKeys");function fe(p,E){try{const F=E.replace(/\[[^:\]]+(?::[^:\]]+)*\]/g,I=>{const[P,...ae]=I.slice(1,-1).split(":");if(!P)throw new Error("Token parse error");let L;const je=P.replace(/[0-9]+/g,Le=>(L=Number(Le),"N")),se=Re[je];let He;if(se)He=se.callback(p,L);else if(je===je.toLocaleUpperCase()){const Le=p.get(je.toLocaleLowerCase());He=Le?Ge(Le):[]}else throw new Error(`Invalid citation key token ${je}`);for(const Le of ae){const Se=Dt[Le];if(Se)He=Se.callback(He);else throw new Error(`Invalid modifier ${Le}`)}return He.join("")});return F===""?void 0:F}catch(F){if(F instanceof Me)return;throw F}}r(fe,"generateKey");var q=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 ze(p){return Ge(p).filter(E=>!q.has(E.toLocaleLowerCase()))}r(ze,"nonFunctionWords");function Ge(p){return p.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)}r(Ge,"words");function tt(p){return p.map(E=>E.slice(0,1).toLocaleUpperCase()+E.slice(1).toLocaleLowerCase())}r(tt,"capitalize");function xe(p){return p.get("title")??p.get("booktitle")??""}r(xe,"title");var vt=["doi","citation","abstract"],ne=14,$=2,ut=80,Bt=["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"],un=["key"],ct="[auth:required:lower][year:required][veryshorttitle:lower][duplicateNumber]",dn=[{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":r(p=>p[0],"--output"),"-o":r(p=>p[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":r(p=>(p.length===0&&(console.error("Expected a omit list"),process.exit(1)),p),"--omit")},toCLI:r(p=>Array.isArray(p)&&p.length>0?`--omit=${p.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:r(p=>p?"--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:r(p=>p?"--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:r(p=>p?"--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":r(p=>p.length>0?Number(p[0]):!0,"--space")},toCLI:r((p,E)=>{if(!E.tab){if(typeof p=="number"&&p!==$)return`--space=${p}`;if(p&&p!==$)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:r(p=>p?"--tab":void 0,"toCLI"),title:"Indent with tabs",description:["Indent all fields with a tab."],type:"boolean",defaultValue:!1},{key:"align",cli:{"--align":r(p=>Number(p[0]),"--align"),"--no-align":!1},toCLI:r(p=>{if(p===!1||p===1||p===0)return"--no-align";if(typeof p=="number"&&p!==ne)return`--align=${p}`},"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:ne,false:1},defaultValue:ne},{key:"blankLines",cli:{"--blank-lines":!0,"--no-blank-lines":!1},toCLI:r(p=>p?"--blank-lines":void 0,"toCLI"),title:"Insert blank lines",description:["Insert an empty line between each entry."],type:"boolean"},{key:"sort",cli:{"--sort":r(p=>p.length>0?p:!0,"--sort"),"--no-sort":!1},toCLI:r(p=>{if(Array.isArray(p)&&p.length>0)return`--sort=${p.join(",")}`;if(p===!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:un,false:void 0}},{key:"duplicates",cli:{"--duplicates":r(p=>{if(p.length===0)return!0;for(const E of p)E!=="doi"&&E!=="key"&&E!=="abstract"&&E!=="citation"&&(console.error(`Invalid key for merge option: "${E}"`),process.exit(1));return p},"--duplicates")},toCLI:r(p=>{if(Array.isArray(p)&&p.length>0)return`--duplicates=${p.join(",")}`;if(p===!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:vt,false:void 0},defaultValue:r(p=>p.merge?vt:void 0,"defaultValue")},{key:"merge",cli:{"--merge":r(p=>p.length===0?!0:(p[0]!=="first"&&p[0]!=="last"&&p[0]!=="combine"&&p[0]!=="overwrite"&&(console.error(`Invalid merge strategy: "${p[0]}"`),process.exit(1)),p[0]),"--merge"),"--no-merge":!1},toCLI:r(p=>{if(typeof p=="string")return`--merge=${p}`;if(p)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:r(p=>p?"--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:r(p=>p?"--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:r(p=>p===!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":r(p=>p.length>0?p:!0,"--sort-fields")},toCLI:r(p=>{if(Array.isArray(p)&&p.length>0)return JSON.stringify(p)===JSON.stringify(Bt)?"--sort-fields":`--sort-fields=${p.join(",")}`;if(p===!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:Bt,false:void 0},defaultValue:void 0},{key:"sortProperties",cli:{"--sort-properties":r(p=>p.length>0?p:!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:r(p=>p?"--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:r(p=>p?"--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:r(p=>p?"--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:r(p=>p===!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:r(p=>p?"--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:r(p=>p===!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":r(p=>p.length>0?p:!0,"--generate-keys")},toCLI:r(p=>{if(p===!0||p===ct)return"--generate-keys";if(typeof p=="string")return`--generate-keys="${p.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:ct,false:void 0},defaultValue:void 0},{key:"maxAuthors",cli:{"--max-authors":r(p=>Number(p[0]),"--max-authors")},toCLI:r(p=>p?`--max-authors=${p}`: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:r(p=>p===!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":r(p=>p.length>0?p:!0,"--enclosing-braces")},toCLI:r(p=>{if(Array.isArray(p)&&p.length>0)return`--enclosing-braces=${p.join(",")}`;if(p===!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":r(p=>p.length>0?p:!0,"--remove-braces")},toCLI:r(p=>{if(Array.isArray(p)&&p.length>0)return`--remove-braces=${p.join(",")}`;if(p===!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":r(p=>p.length>0?Number(p[0]):!0,"--wrap"),"--no-wrap":!1},toCLI:r(p=>p?`--wrap=${p}`: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:ut,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 tn(p){return Object.fromEntries(dn.map(E=>{const F=E.key,I=p[F];return E.convertBoolean&&typeof I=="boolean"?[F,I?E.convertBoolean.true:E.convertBoolean.false]:typeof I>"u"&&E.defaultValue!==void 0?typeof E.defaultValue=="function"?[F,E.defaultValue(p)]:[F,E.defaultValue]:[F,I]}))}r(tn,"normalizeOptions");function nn(p,E,F){const I=new Map,P=[];for(const ae of p.children){if(ae.type==="text"||ae.block?.type!=="entry"&&!F.includes("special")){P.push(ae);continue}const L=new Map;for(let je of F){je.startsWith("-")&&(je=je.slice(1));let se;switch(je){case"key":if(ae.block?.type!=="entry")continue;se=ae.block.key??"";break;case"type":se=ae.command;break;case"month":{if(ae.block?.type!=="entry")continue;const He=E.get(ae.block)?.get(je),Le=He?Ue.indexOf(He):-1;se=Le>-1?Le:"";break}case"special":se=ie(ae)?0:1;break;default:if(ae.block?.type!=="entry")continue;se=E.get(ae.block)?.get(je)??""}L.set(je,typeof se=="string"?se.toLowerCase():se)}for(I.set(ae,L);P.length>0;){const je=P.pop();if(!je)break;I.set(je,L)}}for(const ae of[...F].reverse()){const L=ae.startsWith("-"),je=L?ae.slice(1):ae;p.children.sort((se,He)=>{let Le=I.get(se)?.get(je)??"￰",Se=I.get(He)?.get(je)??"￰";return typeof Le=="number"&&(Le=String(Le).padStart(50,"0")),typeof Se=="number"&&(Se=String(Se).padStart(50,"0")),(L?Se:Le).localeCompare(L?Le:Se)})}}r(nn,"sortEntries");var S=new Set(["string","preamble","set","xdata"]);function ie(p){return S.has(p.command.toLowerCase())}r(ie,"isBibLaTeXSpecialEntry");function oe(p,E){for(const F of ft(p))F.fields.sort((I,P)=>{const ae=E.indexOf(I.name.toLocaleLowerCase()),L=E.indexOf(P.name.toLocaleLowerCase());return ae===-1&&L===-1?0:ae===-1?1:L===-1?-1:L<ae?1:L>ae?-1:0})}r(oe,"sortEntryFields");function ve(p,E={}){const F=tn(E),I=J(p),P=z(I),ae=ft(P).filter(Le=>!Le.key).map(Le=>({code:"MISSING_KEY",message:`${Le.parent.command} entry does not have a citation key.`})),L=At(P,F),je=lt(P,L,F.duplicates,F.merge);ae.push(...je.warnings),P.children=P.children.filter(Le=>!Ve(Le)||!je.entries.has(Le.block)),F.sort&&nn(P,L,F.sort),F.sortFields&&oe(P,F.sortFields);const se=F.generateKeys?H(P,L,F.generateKeys):void 0;return{bibtex:mt(P,F,se),warnings:ae,count:ft(P).length}}r(ve,"tidy");function At(p,E){return new Map(ft(p).map(F=>[F,new Map(F.fields.map(I=>[I.name.toLocaleLowerCase(),ke(I,E)??""]))]))}r(At,"generateValueLookup");function ft(p){return p.children.filter(Ve).map(E=>E.block)}return r(ft,"getEntries"),Bo}var Eg=Cg();class wa extends Error{constructor(e){super(e==="too-large"?"BibTeX input is too large to format":"BibTeX input is invalid"),this.kind=e,this.name="BibtexFormatError"}kind}const wg=new Set(["comment","string","preamble"]),xg={lowercase:!1,removeDuplicateFields:!1};function vg(t){return new TextEncoder().encode(t).byteLength}function Md(t){if(!Number.isSafeInteger(t)||t<1)throw new RangeError("Citation BibTeX limit must be a positive integer.");return t}function xa(t){return`${Math.round(Md(t)/1024)} KB`}function tc(t,e){return vg(t)>Md(e)}function nc(t,e){if(!t.trim()||tc(t,e))return null;try{const n=Eg.tidy(t,xg);return{bibtex:n.bibtex,count:n.count}}catch{return null}}function Ag(t,e){if(!t.trim())return t;if(tc(t,e))throw new wa("too-large");const n=nc(t,e);if(!n)throw new wa("invalid");return n.bibtex}function $d(t,e){if(!t.trim())return{status:"empty",entries:[]};if(tc(t,e))return{status:"too-large",entries:[]};const n=nc(t,e);if(!n)return{status:"invalid",entries:[]};if(n.count===0)return{status:"empty",entries:[]};const s=[];let r=0;for(;r<t.length;){const o=t.indexOf("@",r);if(o<0)break;r=o+1;const a=t.lastIndexOf(`
39
- `,o-1)+1;if(Sg(t,a,o))continue;const c=t.slice(o).match(/^@([A-Za-z][A-Za-z0-9_-]*)\s*([\{\(])/);if(!c||c.index===void 0)continue;const l=o+c[0].length-1,u=sc(t,l,c[2]==="{"?"}":")");if(u<0)continue;const d=Ud(t.slice(o,u+1));d&&s.push(d),r=u+1}return{status:"ok",entries:s}}function Vl(t,e){const n=t.trim(),s=nc(n,e);return!s||s.count!==1?null:Ud(n)}function kg(t){const e=t.bibtex.match(/^@([A-Za-z][A-Za-z0-9_-]*)\s*([\{\(])\s*[^,\s\}\)]+\s*,/s);if(!e||e.index===void 0)return null;const n=t.bibtex.indexOf(e[2],e.index);if(sc(t.bibtex,n,e[2]==="{"?"}":")")<0)return null;const r=zd(t.bibtex.slice(e[0].length,-1));if(!r)return null;const o=e[1].toLowerCase();return(/inproceedings|conference|incollection/.test(o)?r.booktitle??r.journal:r.journal??r.booktitle)?.trim()||null}function Ud(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(sc(t,n,e[2]==="{"?"}":")")!==t.length-1)return null;const r=e[1];if(wg.has(r.toLowerCase()))return null;const o=zd(t.slice(e[0].length,-1));return o?{citationKey:e[3],entryType:r,bibtex:t,title:o.title??null,authors:o.author??null,year:o.year??null}:null}function Sg(t,e,n){let s=!1;for(let r=e;r<n;r+=1){const o=t[r];if(o==="%"&&!s)return!0;o==="\\"?s=!s:s=!1}return!1}function sc(t,e,n){let s=0,r=0,o=!1,a=!1;for(let c=e;c<t.length;c+=1){const l=t[c];if(a){a=!1;continue}if(l==="\\"){a=!0;continue}if(n==="}"){if(l==='"'&&s===1&&(o=!o),l==="{")s+=1;else if(l==="}"&&--s===0)return c;continue}if(l==="{"&&!o){r+=1;continue}if(l==="}"&&!o&&r>0){r-=1;continue}if(!(r>0)){if(l==='"'){o=!o;continue}if(!o){if(l==="(")s+=1;else if(l===")"&&--s===0)return c}}}return-1}function zd(t){const e={};for(const n of jg(t,",")){if(!n.trim())continue;const s=n.replace(/(^|[\r\n])\s*%[^\r\n]*/g,"$1").trim();if(!s)continue;const r=s.match(/^\s*([A-Za-z][A-Za-z0-9_-]*)\s*=\s*([\s\S]*)$/);if(!r||!r[2].trim())return null;const o=Tg(r[2]);o&&(e[r[1].toLowerCase()]=o)}return e}function jg(t,e){const n=[];let s=0,r=0,o=!1,a=!1;for(let c=0;c<t.length;c+=1){const l=t[c];if(a){a=!1;continue}if(l==="\\"){a=!0;continue}if(l==='"'){o=!o;continue}o||(l==="{"?r+=1:l==="}"?r=Math.max(0,r-1):l===e&&r===0&&(n.push(t.slice(s,c)),s=c+1))}return n.push(t.slice(s)),n}function Tg(t){let e=t.trim();return(e.startsWith("{")&&e.endsWith("}")||e.startsWith('"')&&e.endsWith('"'))&&(e=e.slice(1,-1)),e.replace(/\s+/g," ").trim()}const Bg=[],Lg={status:"empty",entries:Bg};function Hd({open:t,onOpenChange:e,page:n=!1,onBack:s,currentFile:r="",currentSource:o="",readOnly:a=!1,currentUserId:c,maxBibtexBytes:l,onInsert:u}){const{t:d}=st(),[h,D]=f.useState("library"),[m,g]=f.useState(""),[y,b]=f.useState(""),[w,v]=f.useState([]),[j,N]=f.useState(1),[z,V]=f.useState({page:1,pageSize:60,total:0,totalPages:0}),[U,G]=f.useState(0),[X,K]=f.useState([]),[le,_]=f.useState(""),[W,T]=f.useState("green"),[k,R]=f.useState(null),[he,be]=f.useState([]),[Fe,Ne]=f.useState(!1),[Ee,B]=f.useState(!1),[me,J]=f.useState(null),[Z,ue]=f.useState(null),[O,te]=f.useState(""),[A,De]=f.useState(!1),[Ce,Ve]=f.useState(""),[lt,We]=f.useState(null),[Ue,ye]=f.useState(null),[Ke,Je]=f.useState(""),[mt,ge]=f.useState(""),[xt,ce]=f.useState(""),[ke,Re]=f.useState(new Map),[Dt,Me]=f.useState(!1),[H,fe]=f.useState(0),q=!!(/\.bib$/i.test(r)&&u),ze=f.useMemo(()=>t&&q?$d(o,l):Lg,[t,o,q,l]),Ge=ze.status==="too-large",tt=ze.status==="invalid",xe=ze.entries,vt=f.useMemo(()=>new Set(xe.map(S=>S.citationKey.toLowerCase())),[xe]);f.useEffect(()=>{if(!t)return;const S=new AbortController,ie=window.setTimeout(()=>{B(!0),ge("");const oe=new URLSearchParams;m.trim()&&oe.set("q",m.trim()),y&&oe.set("tag",y),oe.set("page",String(j)),oe.set("pageSize","60"),ee(`/api/citations?${oe.toString()}`,{signal:S.signal}).then(ve=>{v(ve.entries),V(ve.pagination),ve.pagination.page!==j&&N(ve.pagination.page)}).catch(ve=>{ve instanceof Error&&ve.name==="AbortError"||ge(de(ve))}).finally(()=>{S.signal.aborted||B(!1)})},m.trim()?180:0);return()=>{window.clearTimeout(ie),S.abort()}},[t,m,y,j,U]),f.useEffect(()=>{if(!t)return;const S=new AbortController;return ee("/api/citations/tags",{signal:S.signal}).then(ie=>K(ie.tags)).catch(ie=>{ie instanceof Error&&ie.name==="AbortError"||ge(de(ie))}),()=>S.abort()},[t]),f.useEffect(()=>{if(!t||!q){Re(new Map),Me(!1);return}const S=new AbortController,ie=[...new Set(xe.map(oe=>oe.citationKey))];return ie.length?(Me(!0),ee("/api/citations/lookup",{method:"POST",body:JSON.stringify({keys:ie}),signal:S.signal}).then(oe=>{Re(new Map(oe.matches.map(ve=>[ve.citationKey.toLowerCase(),ve])))}).catch(oe=>{oe instanceof Error&&oe.name==="AbortError"||ge(de(oe))}).finally(()=>{S.signal.aborted||Me(!1)}),()=>S.abort()):(Re(new Map),Me(!1),()=>S.abort())},[t,q,xe,H]),f.useEffect(()=>{t&&(D("library"),g(""),b(""),N(1),V({page:1,pageSize:60,total:0,totalPages:0}),ue(null),De(!1),Ve(""),R(null),We(null),ye(null),Je(""),ge(""),ce(""),Re(new Map))},[t,q]);const ne=async S=>{J(S.citationKey),ge("");try{const ie=ke.get(S.citationKey.toLowerCase()),oe=await ee("/api/citations",{method:"POST",body:JSON.stringify({bibtex:S.bibtex,citationKey:S.citationKey,entryType:S.entryType,title:S.title,authors:S.authors,year:S.year,overwrite:!!ie,expectedRevision:ie?.revision})});v(ve=>[oe.entry,...ve.filter(At=>At.id!==oe.entry.id&&At.citationKey.toLowerCase()!==oe.entry.citationKey.toLowerCase())]),Re(ve=>new Map(ve).set(oe.entry.citationKey.toLowerCase(),{id:oe.entry.id,citationKey:oe.entry.citationKey,revision:oe.entry.revision})),R(oe.entry),be(oe.entry.tags.map(ve=>ve.id)),ce(oe.updated?d("citationLibrary.updated"):d("citationLibrary.saved")),N(1),G(ve=>ve+1)}catch(ie){ge(de(ie)),fe(oe=>oe+1)}finally{J(null)}},$=async()=>{if(Z){J(Z.citationKey),ge("");try{const S=Vl(O,l);if(!S){ge(d("citationErrors.invalid"));return}const ie=await ee(`/api/citations/${encodeURIComponent(Z.id)}`,{method:"PATCH",body:JSON.stringify({bibtex:S.bibtex,citationKey:S.citationKey,entryType:S.entryType,title:S.title,authors:S.authors,year:S.year,expectedRevision:Z.revision})});v(oe=>[ie.entry,...oe.filter(ve=>ve.id!==ie.entry.id)]),Re(oe=>{const ve=new Map(oe);return ve.delete(Z.citationKey.toLowerCase()),ve.set(ie.entry.citationKey.toLowerCase(),{id:ie.entry.id,citationKey:ie.entry.citationKey,revision:ie.entry.revision}),ve}),ue(null),ce(d("citationLibrary.updated")),N(1),G(oe=>oe+1)}catch(S){ge(de(S))}finally{J(null)}}},ut=async()=>{if(Ce.trim()){J("__new__"),ge("");try{const S=Vl(Ce,l);if(!S){ge(d("citationErrors.invalid"));return}const ie=await ee("/api/citations",{method:"POST",body:JSON.stringify({bibtex:S.bibtex,citationKey:S.citationKey,entryType:S.entryType,title:S.title,authors:S.authors,year:S.year})});v(oe=>[ie.entry,...oe.filter(ve=>ve.id!==ie.entry.id&&ve.citationKey.toLowerCase()!==ie.entry.citationKey.toLowerCase())]),Re(oe=>new Map(oe).set(ie.entry.citationKey.toLowerCase(),{id:ie.entry.id,citationKey:ie.entry.citationKey,revision:ie.entry.revision})),De(!1),Ve(""),ce(ie.updated?d("citationLibrary.updated"):d("citationLibraryActions.added")),R(ie.entry),be(ie.entry.tags.map(oe=>oe.id)),N(1),G(oe=>oe+1)}catch(S){ge(de(S))}finally{J(null)}}},Bt=async()=>{if(le.trim()){ge("");try{const S=await ee("/api/citations/tags",{method:"POST",body:JSON.stringify({name:le.trim(),color:W})});K(ie=>[...ie.filter(oe=>oe.id!==S.tag.id),S.tag].sort((oe,ve)=>oe.name.localeCompare(ve.name))),_(""),ce(d("citationLibrary.tagCreated"))}catch(S){ge(de(S))}}},un=S=>{ue(null),De(!1),R(S),be(S.tags.map(ie=>ie.id))},ct=async()=>{if(k){Ne(!0),ge("");try{const S=await ee(`/api/citations/${encodeURIComponent(k.id)}/tags`,{method:"PATCH",body:JSON.stringify({tagIds:he,expectedRevision:k.revision})});v(ie=>ie.map(oe=>oe.id===S.entry.id?S.entry:oe)),Re(ie=>new Map(ie).set(S.entry.citationKey.toLowerCase(),{id:S.entry.id,citationKey:S.entry.citationKey,revision:S.entry.revision})),R(S.entry),be(S.entry.tags.map(ie=>ie.id)),ce(d("citationLibrary.tagsUpdated")),G(ie=>ie+1)}catch(S){ge(de(S))}finally{Ne(!1)}}},dn=async S=>{We(S.id),Je("");try{await ee(`/api/citations/${encodeURIComponent(S.id)}`,{method:"DELETE"}),v(ie=>ie.filter(oe=>oe.id!==S.id)),Re(ie=>{const oe=new Map(ie);return oe.delete(S.citationKey.toLowerCase()),oe}),Z?.id===S.id&&ue(null),k?.id===S.id&&R(null),ce(d("citationLibrary.deleted")),N(1),G(ie=>ie+1),ye(null)}catch(ie){Je(de(ie))}finally{We(null)}},tn=i.jsxs("div",{className:"citation-library-dialog",children:[i.jsxs("div",{className:"citation-library-tabs",role:"tablist","aria-label":d("citationLibrary.title"),children:[i.jsxs("button",{type:"button",role:"tab","aria-selected":h==="library",className:h==="library"?"active":"",onClick:()=>D("library"),children:[i.jsx(Ns,{size:15}),d("citationLibrary.myLibrary"),i.jsx("span",{children:z.total})]}),q&&i.jsxs("button",{type:"button",role:"tab","aria-selected":h==="current",className:h==="current"?"active":"",onClick:()=>D("current"),children:[i.jsx(hi,{size:15}),d("citationLibrary.currentFile"),i.jsx("span",{children:xe.length})]})]}),mt&&!(n&&(k||Z))&&i.jsx("p",{className:"error dialog-error",children:mt}),xt&&i.jsxs("p",{className:"citation-library-notice",role:"status",children:[i.jsx(us,{size:14}),xt,i.jsx("button",{type:"button","aria-label":d("common.close"),onClick:()=>ce(""),children:i.jsx(Vt,{size:13})})]}),h==="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(_d,{size:15}),i.jsx("input",{autoFocus:!0,placeholder:d("citationLibrary.searchPlaceholder"),value:m,onChange:S=>{g(S.target.value),N(1)}}),i.jsx("span",{children:d("citationLibrary.searchHint")})]}),i.jsxs("button",{type:"button",className:"citation-add-entry-button",onClick:()=>{De(!0),ue(null),R(null)},children:[i.jsx(hi,{size:14}),d("citationLibraryActions.addEntry")]})]}),i.jsxs("div",{className:"citation-tag-bar",children:[i.jsxs("div",{className:"citation-tag-filters",children:[i.jsx("button",{type:"button",className:y?"":"active",onClick:()=>{b(""),N(1)},children:d("citationLibrary.allTags")}),X.map(S=>i.jsxs("button",{type:"button",className:y===S.id?"active":"",onClick:()=>{b(y===S.id?"":S.id),N(1)},children:[i.jsx("span",{className:`citation-tag-dot tag-${S.color}`}),S.name]},S.id)),X.length===0&&i.jsx("span",{className:"muted",children:d("citationLibrary.noTags")})]}),i.jsxs("div",{className:"citation-tag-create",children:[i.jsx("input",{value:le,placeholder:d("citationLibrary.newTagPlaceholder"),onChange:S=>_(S.target.value),onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),Bt())}}),i.jsx("select",{"aria-label":d("citationLibrary.tagColor"),value:W,onChange:S=>T(S.target.value),children:["red","orange","yellow","green","blue","purple","gray"].map(S=>i.jsx("option",{value:S,children:d(`tags.${S}`)},S))}),i.jsxs("button",{type:"button",disabled:!le.trim(),title:d("citationLibrary.createTag"),onClick:()=>{Bt()},children:[i.jsx(hi,{size:13}),d("citationLibrary.createTag")]})]})]}),A&&i.jsxs("div",{className:"citation-edit-panel",children:[i.jsxs("div",{className:"citation-edit-header",children:[i.jsxs("div",{children:[i.jsx("strong",{children:d("citationLibraryActions.addEntryTitle")}),i.jsx("small",{children:d("citationLibraryActions.addEntryDescription")})]}),i.jsx("button",{type:"button","aria-label":d("common.close"),onClick:()=>De(!1),children:i.jsx(Vt,{size:15})})]}),i.jsx("textarea",{autoFocus:!0,value:Ce,onChange:S=>Ve(S.target.value),placeholder:d("citationLibraryActions.addEntryPlaceholder"),spellCheck:!1,rows:9}),i.jsxs("div",{className:"citation-edit-actions",children:[i.jsx("button",{type:"button",onClick:()=>De(!1),children:d("common.cancel")}),i.jsxs("button",{type:"button",className:"primary",disabled:!Ce.trim()||me==="__new__",onClick:()=>{ut()},children:[me==="__new__"?i.jsx(at,{className:"spin",size:14}):i.jsx(us,{size:14}),d("citationLibraryActions.addEntry")]})]})]}),Ee?i.jsxs("div",{className:"citation-library-empty",children:[i.jsx(at,{className:"spin",size:22}),i.jsx("span",{children:d("common.loading")})]}):w.length===0?i.jsxs("div",{className:"citation-library-empty",children:[i.jsx(Ns,{size:28}),i.jsx("strong",{children:d("citationLibrary.emptyTitle")}),i.jsx("span",{children:d(y?"citationLibrary.noTagMatches":"citationLibrary.emptyDescription")})]}):i.jsx("div",{className:"citation-entry-list",children:w.map(S=>i.jsxs("div",{className:"citation-entry-item",children:[i.jsx(ql,{entry:S,currentUserId:c,selected:k?.id===S.id||Z?.id===S.id,alreadyInFile:!n&&vt.has(S.citationKey.toLowerCase()),importDisabled:a,deleting:lt===S.id,onImport:u?async()=>{await u(S)&&e(!1)}:void 0,onEdit:S.ownerId===c?()=>{R(null),De(!1),ue(S),te(S.bibtex)}:void 0,onTags:S.ownerId===c?()=>un(S):void 0,onDelete:S.ownerId===c?()=>{ye(S),Je("")}:void 0,t:d}),!n&&k?.id===S.id&&i.jsx(Lo,{entry:k,tags:X,selectedIds:he,saving:Fe,onClose:()=>R(null),onToggle:ie=>be(oe=>oe.includes(ie)?oe.filter(ve=>ve!==ie):[...oe,ie]),onSave:()=>{ct()},t:d}),!n&&Z?.id===S.id&&i.jsx(Wl,{title:d("citationLibrary.editTitle",{key:Z.citationKey}),value:O,saving:me===Z.citationKey,onChange:te,onClose:()=>ue(null),onSave:()=>{$()},t:d})]},S.id))}),z.totalPages>1&&i.jsxs("nav",{className:"citation-library-pagination","aria-label":d("citationLibraryPagination.pageOf",{page:z.page,totalPages:z.totalPages,count:z.total}),children:[i.jsxs("button",{type:"button",disabled:z.page<=1,onClick:()=>N(S=>Math.max(1,S-1)),children:[i.jsx(Cr,{size:14}),d("citationLibraryPagination.previous")]}),i.jsx("span",{children:d("citationLibraryPagination.pageOf",{page:z.page,totalPages:z.totalPages,count:z.total})}),i.jsxs("button",{type:"button",disabled:z.page>=z.totalPages,onClick:()=>N(S=>Math.min(z.totalPages,S+1)),children:[d("citationLibraryPagination.next"),i.jsx(Hi,{size:14})]})]})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"citation-current-heading",children:[i.jsxs("div",{children:[i.jsx("strong",{children:d("citationLibrary.currentFileTitle")}),i.jsx("span",{children:d("citationLibrary.currentFileDescription")})]}),i.jsxs("button",{type:"button",onClick:()=>D("library"),children:[i.jsx(Cr,{size:14}),d("citationLibrary.backToLibrary")]})]}),Ge&&i.jsxs("p",{className:"warning citation-library-warning",children:[i.jsx(Zt,{size:15}),d("citationLibrary.fileTooLarge",{size:xa(l)})]}),tt&&i.jsxs("p",{className:"warning citation-library-warning",children:[i.jsx(Zt,{size:15}),d("citationLibrary.fileInvalid")]}),xe.length===0?i.jsxs("div",{className:"citation-library-empty",children:[i.jsx(Ns,{size:28}),i.jsx("strong",{children:d("citationLibrary.noEntries")}),i.jsx("span",{children:d(Ge?"citationLibrary.fileTooLargeHint":tt?"citationLibrary.fileInvalidHint":"citationLibrary.noEntriesDescription")})]}):i.jsx("div",{className:"citation-entry-list",children:xe.map((S,ie)=>i.jsxs("div",{className:"citation-entry-item",children:[i.jsx(ql,{entry:S,saved:ke.has(S.citationKey.toLowerCase()),saving:me===S.citationKey,saveDisabled:Dt,onSave:()=>{ne(S)},t:d}),!n&&k?.citationKey.toLowerCase()===S.citationKey.toLowerCase()&&i.jsx(Lo,{entry:k,tags:X,selectedIds:he,saving:Fe,onClose:()=>R(null),onToggle:oe=>be(ve=>ve.includes(oe)?ve.filter(At=>At!==oe):[...ve,oe]),onSave:()=>{ct()},t:d})]},`${S.citationKey}-${ie}`))})]})]}),nn=i.jsx(Jn,{open:!!Ue,title:d("citationLibrary.deleteTitle"),description:d("citationLibrary.deleteDescription",{key:Ue?.citationKey??""}),confirmLabel:d("common.delete"),danger:!0,error:Ke,busy:!!lt,onCancel:()=>{ye(null),Je("")},onConfirm:()=>{const S=Ue;S&&dn(S)}});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(Ns,{"aria-hidden":!0,size:26}),d("citationLibrary.title")]}),i.jsx("p",{children:d("citationLibraryHomeDescription")})]}),s&&i.jsxs("button",{type:"button",onClick:s,children:[i.jsx(Cr,{size:15}),d("projects.title")]})]}),tn]}),k&&i.jsx(pt,{open:!0,title:d("citationLibrary.tagsTitle",{key:k.citationKey}),description:d("citationLibrary.tags"),onOpenChange:S=>{S||(R(null),ge(""))},children:i.jsxs(i.Fragment,{children:[mt&&i.jsx("p",{className:"error dialog-error",children:mt}),i.jsx(Lo,{entry:k,tags:X,selectedIds:he,saving:Fe,modal:!0,onClose:()=>{R(null),ge("")},onToggle:S=>be(ie=>ie.includes(S)?ie.filter(oe=>oe!==S):[...ie,S]),onSave:()=>{ct()},t:d})]})}),Z&&i.jsx(pt,{open:!0,extraWide:!0,title:d("citationLibrary.editTitle",{key:Z.citationKey}),description:d("citationLibrary.title"),onOpenChange:S=>{S||(ue(null),ge(""))},children:i.jsxs(i.Fragment,{children:[mt&&i.jsx("p",{className:"error dialog-error",children:mt}),i.jsx(Wl,{title:d("citationLibrary.editTitle",{key:Z.citationKey}),value:O,saving:me===Z.citationKey,modal:!0,onChange:te,onClose:()=>{ue(null),ge("")},onSave:()=>{$()},t:d})]})}),nn]}):i.jsxs(i.Fragment,{children:[i.jsx(pt,{open:t,extraWide:!0,className:"citation-library-modal",title:d("citationLibrary.title"),description:d(q?"citationLibrary.description":"citationLibraryHomeDescription",{file:r}),onOpenChange:e,footer:i.jsx("button",{onClick:()=>e(!1),children:d("common.close")}),children:tn}),nn]})}function ql({entry:t,currentUserId:e,selected:n,alreadyInFile:s,saved:r,saving:o,saveDisabled:a,importDisabled:c,deleting:l,onSave:u,onImport:d,onEdit:h,onTags:D,onDelete:m,t:g}){const y="id"in t,b=y?t:null,w=kg(t);return i.jsxs("article",{className:`citation-entry-card${n?" selected":""}${s?" already-in-file":""}`,title:s?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]}),w&&i.jsx("span",{className:"citation-entry-venue",title:w,children:w}),r&&i.jsxs("em",{children:[i.jsx(us,{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]})]}),b&&b.tags.length>0&&i.jsx("div",{className:"citation-entry-tags",children:b.tags.map(v=>i.jsxs("span",{className:`citation-tag-pill tag-${v.color}`,children:[i.jsx("span",{className:"citation-tag-dot"}),v.name]},v.id))})]}),i.jsxs("div",{className:"citation-entry-actions",children:[u&&i.jsxs("button",{type:"button",className:r?"saved":"primary",disabled:o||a,onClick:u,children:[o||a?i.jsx(at,{className:"spin",size:13}):r?i.jsx(us,{size:13}):i.jsx(hi,{size:13}),g(o?"citationLibrary.saving":r?"citationLibrary.update":"citationLibrary.save")]}),d&&i.jsxs("button",{type:"button",disabled:c||s,title:s?g("citationErrors.alreadyInFile",{key:t.citationKey}):g(c?"citationLibrary.importRequiresWrite":"citationLibrary.importToFile"),onClick:()=>{d()},children:[i.jsx(ng,{size:13}),g("citationLibrary.import")]}),b&&D&&i.jsxs("button",{type:"button",onClick:D,children:[i.jsx(ya,{size:13}),g("citationLibrary.tags")]}),y&&h&&i.jsxs("button",{type:"button",onClick:h,children:[i.jsx(lg,{size:13}),g("common.edit")]}),y&&m&&i.jsxs("button",{type:"button",className:"danger-text",disabled:l,onClick:m,children:[l?i.jsx(at,{className:"spin",size:13}):i.jsx(cn,{size:13}),g("common.delete")]})]})]})}function Lo({entry:t,tags:e,selectedIds:n,saving:s,modal:r=!1,onClose:o,onToggle:a,onSave:c,t:l}){const u=i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"citation-tag-choice-list",children:e.length===0?i.jsx("span",{className:"muted",children:l("citationLibrary.noTagsToAssign")}):e.map(d=>i.jsxs("label",{children:[i.jsx("input",{type:"checkbox",checked:n.includes(d.id),onChange:()=>a(d.id)}),i.jsx("span",{className:`citation-tag-dot tag-${d.color}`}),d.name]},d.id))}),i.jsxs("div",{className:"citation-edit-actions",children:[i.jsx("button",{type:"button",onClick:o,children:l("common.cancel")}),i.jsxs("button",{type:"button",className:"primary",disabled:s||e.length===0,onClick:c,children:[s?i.jsx(at,{className:"spin",size:14}):i.jsx(us,{size:14}),l("citationLibrary.saveTags")]})]})]});return r?i.jsx("div",{className:"citation-modal-form",children:u}):i.jsxs("div",{className:"citation-tag-editor",children:[i.jsxs("div",{className:"citation-edit-header",children:[i.jsx("strong",{children:l("citationLibrary.tagsTitle",{key:t.citationKey})}),i.jsx("button",{type:"button","aria-label":l("common.close"),onClick:o,children:i.jsx(Vt,{size:15})})]}),u]})}function Wl({title:t,value:e,saving:n,modal:s=!1,onChange:r,onClose:o,onSave:a,t:c}){const l=i.jsxs(i.Fragment,{children:[i.jsx("textarea",{autoFocus:!s,value:e,onChange:u=>r(u.target.value),spellCheck:!1,rows:12}),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:!e.trim()||n,onClick:a,children:[n?i.jsx(at,{className:"spin",size:14}):i.jsx(us,{size:14}),c("common.save")]})]})]});return s?i.jsx("div",{className:"citation-modal-form citation-edit-panel",children:l}):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":c("common.close"),onClick:o,children:i.jsx(Vt,{size:15})})]}),l]})}function Ng(t=10){const e="ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789!@#$%",n=crypto.getRandomValues(new Uint8Array(t));return Array.from(n,s=>e[s%e.length]).join("")}function Rg({currentUser:t,minPasswordLength:e}){const{t:n}=st(),[s,r]=f.useState([]),[o,a]=f.useState(""),[c,l]=f.useState(!1),[u,d]=f.useState({username:"",displayName:"",password:"",role:"user",canCreateProjects:!1}),[h,D]=f.useState(null),[m,g]=f.useState(""),[y,b]=f.useState(null),[w,v]=f.useState(!1),[j,N]=f.useState(!1),[z,V]=f.useState(""),[U,G]=f.useState(null),[X,K]=f.useState(!1),[le,_]=f.useState(""),W=()=>ee("/api/admin/users").then(({users:B})=>r(B)).catch(B=>a(de(B)));f.useEffect(()=>{W()},[]);const T=async()=>{if(u.password.length<e)return a(n("auth.passwordMinimum",{count:e}));try{await ee("/api/admin/users",{method:"POST",body:JSON.stringify({username:u.username,displayName:u.displayName||u.username,password:u.password,role:u.role,canCreateProjects:u.canCreateProjects})}),l(!1),d({username:"",displayName:"",password:"",role:"user",canCreateProjects:!1}),await W()}catch(B){a(de(B))}},k=async(B,me)=>{try{await ee(`/api/admin/users/${B.id}`,{method:"PATCH",body:JSON.stringify(me)}),await W()}catch(J){a(de(J))}},R=async B=>{if(!B.disabled){G({target:B,setting:"disable"}),_("");return}await k(B,{disabled:!1})},he=async B=>{if(B.role==="admin"){G({target:B,setting:"demote"}),_("");return}await k(B,{role:"admin"})},be=async B=>{if(B.canCreateProjects){G({target:B,setting:"denyProjectCreation"}),_("");return}await k(B,{canCreateProjects:!0})},Fe=async()=>{if(!U)return;const{target:B,setting:me}=U,J=me==="disable"?{disabled:!0}:me==="demote"?{role:"user"}:{canCreateProjects:!1};K(!0),_("");try{await ee(`/api/admin/users/${B.id}`,{method:"PATCH",body:JSON.stringify(J)}),await W(),G(null)}catch(Z){_(de(Z))}finally{K(!1)}},Ne=async()=>{if(!(!h||!m)){if(m.length<e)return a(n("auth.passwordMinimum",{count:e}));try{await ee(`/api/admin/users/${h.id}`,{method:"PATCH",body:JSON.stringify({password:m})}),D(null),g("")}catch(B){a(de(B))}}},Ee=async()=>{if(!(!y||j)){N(!0),V("");try{await ee(`/api/admin/users/${y.id}`,{method:"DELETE",body:JSON.stringify({deleteProjects:w})}),b(null),v(!1),await W()}catch(B){V(de(B))}finally{N(!1)}}};return i.jsxs("main",{className:"dashboard",children:[i.jsxs("div",{className:"section-title",children:[i.jsxs("div",{children:[i.jsxs("h1",{children:[i.jsx(kr,{"aria-hidden":!0,size:25}),n("users.manage")]}),i.jsx("p",{className:"muted",children:n("users.onlyAdmin")})]}),i.jsxs("button",{className:"primary icon-button",onClick:()=>l(!0),children:[i.jsx(Ea,{"aria-hidden":!0,size:15}),n("users.add")]})]}),o&&i.jsx("p",{className:"error",children:o}),i.jsx("div",{className:"table-card",children:i.jsxs("table",{children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:n("common.user")}),i.jsx("th",{children:n("users.role")}),i.jsx("th",{children:n("users.createProjects")}),i.jsx("th",{children:n("users.ownedProjects")}),i.jsx("th",{children:n("users.status")}),i.jsx("th",{children:n("users.actions")})]})}),i.jsx("tbody",{children:s.map(B=>i.jsxs("tr",{children:[i.jsxs("td",{children:[i.jsx("strong",{children:B.displayName}),i.jsxs("small",{children:["@",B.username]})]}),i.jsx("td",{children:B.role==="admin"?n("common.admin"):n("common.user")}),i.jsx("td",{children:B.canCreateProjects?n("users.allow"):n("users.deny")}),i.jsx("td",{children:B.ownedProjects}),i.jsx("td",{children:B.disabled?n("common.disabled"):n("common.normal")}),i.jsxs("td",{children:[i.jsxs("button",{className:"icon-button",disabled:B.id===t.id,onClick:()=>R(B),children:[B.disabled?i.jsx(Fg,{"aria-hidden":!0,size:13}):i.jsx(bg,{"aria-hidden":!0,size:13}),B.disabled?n("users.enable"):n("users.disable")]}),i.jsxs("button",{className:"icon-button",disabled:B.id===t.id,onClick:()=>he(B),children:[B.role==="admin"?i.jsx(mg,{"aria-hidden":!0,size:13}):i.jsx(pg,{"aria-hidden":!0,size:13}),B.role==="admin"?n("users.demote"):n("users.promote")]}),i.jsxs("button",{className:"icon-button",disabled:B.role==="admin",onClick:()=>be(B),children:[B.canCreateProjects?i.jsx(Z0,{"aria-hidden":!0,size:13}):i.jsx(J0,{"aria-hidden":!0,size:13}),B.canCreateProjects?n("users.denyCreate"):n("users.allowCreate")]}),i.jsxs("button",{className:"icon-button",onClick:()=>{D(B),g("")},children:[i.jsx(Ul,{"aria-hidden":!0,size:13}),n("users.resetPassword")]}),i.jsxs("button",{className:"icon-button danger-text",disabled:B.id===t.id,onClick:()=>{b(B),v(!1),V("")},children:[i.jsx(cn,{"aria-hidden":!0,size:13}),n("common.delete")]})]})]},B.id))})]})}),i.jsx(pt,{open:c,title:n("users.add"),description:n("users.addDescription"),onOpenChange:l,footer:i.jsxs(i.Fragment,{children:[i.jsxs("button",{className:"icon-button",onClick:()=>l(!1),children:[i.jsx(Vt,{"aria-hidden":!0,size:14}),n("common.cancel")]}),i.jsxs("button",{className:"primary icon-button",disabled:u.password.length<e,onClick:()=>{T()},children:[i.jsx(Ea,{"aria-hidden":!0,size:14}),n("users.createUser")]})]}),children:i.jsxs("div",{className:"form-stack",children:[i.jsxs("label",{className:"form-field",children:[n("auth.username"),i.jsx("input",{value:u.username,onChange:B=>d({...u,username:B.target.value})})]}),i.jsxs("label",{className:"form-field",children:[n("users.displayName"),i.jsx("input",{value:u.displayName,onChange:B=>d({...u,displayName:B.target.value})})]}),i.jsxs("label",{className:"form-field",children:[n("users.initialPassword"),i.jsxs("span",{className:"password-generator",children:[i.jsx("input",{minLength:e,autoComplete:"new-password",value:u.password,onChange:B=>d({...u,password:B.target.value})}),i.jsxs("button",{type:"button",title:n("users.generatePassword"),onClick:()=>d({...u,password:Ng()}),children:[i.jsx(G0,{size:15}),n("users.randomPassword")]})]}),i.jsx("small",{className:"field-hint",children:n("auth.passwordMinimum",{count:e})})]}),i.jsxs("label",{className:"form-field",children:[n("users.role"),i.jsxs("select",{value:u.role,onChange:B=>d({...u,role:B.target.value}),children:[i.jsx("option",{value:"user",children:n("common.user")}),i.jsx("option",{value:"admin",children:n("common.admin")})]})]}),i.jsxs("label",{className:"checkbox-field",children:[i.jsx("input",{type:"checkbox",checked:u.canCreateProjects||u.role==="admin",disabled:u.role==="admin",onChange:B=>d({...u,canCreateProjects:B.target.checked})})," ",n("users.allowCreate")]})]})}),i.jsx(pt,{open:!!h,title:n("users.resetPassword"),description:n("users.resetDescription",{username:h?.username??""}),onOpenChange:B=>{B||D(null)},footer:i.jsxs(i.Fragment,{children:[i.jsxs("button",{className:"icon-button",onClick:()=>D(null),children:[i.jsx(Vt,{"aria-hidden":!0,size:14}),n("common.cancel")]}),i.jsxs("button",{className:"primary icon-button",disabled:m.length<e,onClick:()=>{Ne()},children:[i.jsx(Ul,{"aria-hidden":!0,size:14}),n("users.reset")]})]}),children:i.jsxs("label",{className:"form-field",children:[n("auth.newPassword"),i.jsx("input",{autoFocus:!0,type:"password",minLength:e,autoComplete:"new-password",value:m,onChange:B=>g(B.target.value)}),i.jsx("small",{className:"field-hint",children:n("auth.passwordMinimum",{count:e})})]})}),i.jsx(pt,{open:!!y,title:n("users.deleteTitle"),description:n("users.deleteDescription",{username:y?.username??""}),onOpenChange:B=>{!B&&!j&&(b(null),V(""))},footer:i.jsxs(i.Fragment,{children:[i.jsxs("button",{className:"icon-button",disabled:j,onClick:()=>{b(null),V("")},children:[i.jsx(Vt,{"aria-hidden":!0,size:14}),n("common.cancel")]}),i.jsxs("button",{className:"danger icon-button",disabled:j,"aria-busy":j,onClick:()=>{Ee()},children:[j?i.jsx(at,{className:"spin","aria-hidden":!0,size:14}):i.jsx(cn,{"aria-hidden":!0,size:14}),n(j?"common.loading":"users.deleteTitle")]})]}),children:i.jsxs(i.Fragment,{children:[z&&i.jsx("p",{className:"error dialog-error",children:z}),i.jsxs("fieldset",{className:"choice-group",disabled:j,children:[i.jsx("legend",{children:n("users.ownedChoice",{count:y?.ownedProjects??0})}),i.jsxs("label",{children:[i.jsx("input",{type:"radio",checked:!w,onChange:()=>v(!1)})," ",n("users.transferProjects")]}),i.jsxs("label",{children:[i.jsx("input",{type:"radio",checked:w,onChange:()=>v(!0)})," ",n("users.deleteProjects")]})]})]})}),i.jsx(Jn,{open:!!U,title:n(`userConfirmations.${U?.setting??"disable"}Title`),description:n(`userConfirmations.${U?.setting??"disable"}Description`,{username:U?.target.username??""}),confirmLabel:n(`userConfirmations.${U?.setting??"disable"}Confirm`),danger:!0,busy:X,error:le,onCancel:()=>{X||(G(null),_(""))},onConfirm:()=>{Fe()}})]})}const Og=f.lazy(()=>ts(()=>import("./SystemMetricsDialog-CEbYJdj7.js"),__vite__mapDeps([4,1])).then(t=>({default:t.SystemMetricsDialog})));function Pg(t){return t instanceof Error&&t.name==="AbortError"}function _g(t,e,n,s){const r=new Date(t).getTime();if(!Number.isFinite(r))return t;const o=r-n,a=Math.abs(o),c=60*1e3,l=60*c,u=24*l,d=3*u;if(a>d){const g=Math.floor(a/u),y=o<0?"Past":"Future";return s(`projects.relativeDays${y}`,{days:g,hours:0,minutes:0})}if(a>=u){const g=Math.floor(a/u),y=Math.floor(a%u/l),b=o<0?"Past":"Future",w=y>0?"DaysHours":"Days";return s(`projects.relative${w}${b}`,{days:g,hours:y,minutes:0})}if(a>=l){const g=Math.floor(a/l),y=Math.floor(a%l/c),b=o<0?"Past":"Future",w=y>0?"HoursMinutes":"Hours";return s(`projects.relative${w}${b}`,{days:0,hours:g,minutes:y})}const h="minute",D=c,m=Math.sign(o)*Math.max(1,Math.floor(a/D));return new Intl.RelativeTimeFormat(e,{numeric:"always"}).format(m,h)}function Ig(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/1024/1024).toFixed(1)} MB`}function Mg({site:t,user:e,initialData:n,onDataChange:s,onUser:r,onOpenProject:o}){const{t:a}=st(),[c,l]=f.useState(()=>n?.projects??[]),[u,d]=f.useState(()=>n?.tags??[]),[h,D]=f.useState(()=>n?.pagination??{page:1,pageSize:20,total:n?.projects.length??0,totalPages:n?.projects.length?1:0}),[m,g]=f.useState(!!n),[y,b]=f.useState(!1),[w,v]=f.useState(!1),[j,N]=f.useState(!1),[z,V]=f.useState(""),[U,G]=f.useState(""),[X,K]=f.useState(""),[le,_]=f.useState(""),[W,T]=f.useState(""),[k,R]=f.useState(""),[he,be]=f.useState(""),[Fe,Ne]=f.useState(!1),[Ee,B]=f.useState(""),[me,J]=f.useState(!1),[Z,ue]=f.useState(!1),[O,te]=f.useState(""),[A,De]=f.useState(null),[Ce,Ve]=f.useState(""),lt=f.useRef(null),[We,Ue]=f.useState(!1),[ye,Ke]=f.useState(""),[Je,mt]=f.useState(""),[ge,xt]=f.useState(!1),[ce,ke]=f.useState(""),[Re,Dt]=f.useState("blue"),[Me,H]=f.useState(null),[fe,q]=f.useState(null),[ze,Ge]=f.useState(""),[tt,xe]=f.useState(!1),[vt,ne]=f.useState(null),[$,ut]=f.useState(""),[Bt,un]=f.useState(!1),[ct,dn]=f.useState(null),[tn,nn]=f.useState(!1),[S,ie]=f.useState(null),[oe,ve]=f.useState([]),[At,ft]=f.useState(""),[p,E]=f.useState(!1),[F,I]=f.useState(""),[P,ae]=f.useState(()=>localStorage.getItem("texlite-project-view")==="list"?"list":"grid"),[L,je]=f.useState(()=>localStorage.getItem("texlite-project-sort")==="created"?"created":"updated"),[se,He]=f.useState(!1),[Le,Se]=f.useState(""),[Ye,St]=f.useState(1),[Xe,rt]=f.useState(()=>Date.now()),[it,Ze]=f.useState(""),dt=f.useRef(0),Ct=f.useRef(null),gt=(C,$e,Ie,Et,_t)=>`${C?"archived":"active"}|${$e}|${Ie}|${Et}|${_t}`,Pe=gt(se,Ye,ye,Je,L),Lt=(C,$e,Ie,Et,_t)=>{const zt=new URLSearchParams({page:String($e),pageSize:"20",sort:_t});C&&zt.set("archived","1"),Ie.trim()&&zt.set("search",Ie.trim()),Et&&zt.set("tag",Et);const ss=gt(C,$e,Ie,Et,_t),Un=++dt.current;Ct.current?.abort();const zn=new AbortController;return Ct.current=zn,Promise.all([ee(`/api/projects?${zt.toString()}`,{signal:zn.signal}),ee("/api/tags",{signal:zn.signal})]).then(([Hn,oo])=>{Un===dt.current&&(l(Hn.projects),d(oo.tags),D(Hn.pagination),St(Hn.pagination.page),g(!0),Ze(ss))}).catch(Hn=>{!Pg(Hn)&&Un===dt.current&&V(de(Hn))}).finally(()=>{Ct.current===zn&&(Ct.current=null)})};f.useEffect(()=>(Lt(se,Ye,ye,Je,L),()=>Ct.current?.abort()),[se,Ye,ye,Je,L]),f.useEffect(()=>{m&&!se&&it===Pe&&s(c,u,h)},[c,u,h,m,it,Pe,se]),f.useEffect(()=>{const C=window.setInterval(()=>rt(Date.now()),6e4);return()=>window.clearInterval(C)},[]);const Wt=C=>{ae(C),localStorage.setItem("texlite-project-view",C)},ys=C=>{je(C),St(1),localStorage.setItem("texlite-project-sort",C)},Tn=C=>{He(C),St(1)},Bn=C=>{mt(C),St(1)},Ln=async()=>{if(!(!Ee.trim()||me)){J(!0),G("");try{const{project:C}=await ee("/api/projects",{method:"POST",body:JSON.stringify({name:Ee})});Ne(!1),B("");const $e=se||Ye!==1?c:[C,...c].slice(0,h.pageSize),Ie=se?h:{...h,total:h.total+1,totalPages:Math.ceil((h.total+1)/h.pageSize)};l($e),D(Ie),se||s($e,u,Ie),o(C.id)}catch(C){G(de(C))}finally{J(!1)}}},Qe=async()=>{if(!A)return;const C=t.maxUploadSizeMB;if(A.size>C*1024*1024)return Ve(a("errors.fileTooLarge",{size:C}));Ue(!0),Ve("");const $e=new FormData;$e.append("file",A);try{const{project:Ie}=await ee(`/api/projects/import?name=${encodeURIComponent(O.trim())}`,{method:"POST",body:$e}),Et=se||Ye!==1?c:[Ie,...c].slice(0,h.pageSize),_t=se?h:{...h,total:h.total+1,totalPages:Math.ceil((h.total+1)/h.pageSize)};l(Et),D(_t),se||s(Et,u,_t),ue(!1),De(null),te(""),o(Ie.id)}catch(Ie){Ve(de(Ie))}finally{Ue(!1)}},Fn=C=>{if(C&&!C.name.toLocaleLowerCase().endsWith(".zip")){Ve(a("errors.zipOnly"));return}Ve(""),De(C),C&&!O&&te(C.name.replace(/\.zip$/i,""))},jt=async()=>{await ee("/api/auth/logout",{method:"POST"}),r(null)},Kr=async()=>{if(ce.trim()){K("");try{const C=await ee("/api/tags",{method:"POST",body:JSON.stringify({name:ce,color:Re})});d($e=>[...$e,C.tag].sort((Ie,Et)=>Ie.name.localeCompare(Et.name))),xt(!1),ke(""),Dt("blue")}catch(C){K(de(C))}}},so=async C=>{if(!Me)return;const $e=Me.tags.some(Ie=>Ie.id===C.id);_("");try{const Et=(await ee($e?`/api/projects/${Me.id}/tags/${C.id}`:`/api/projects/${Me.id}/tags`,$e?{method:"DELETE"}:{method:"POST",body:JSON.stringify({tagId:C.id})})).project;H(Et),l(_t=>_t.map(zt=>zt.id===Et.id?Et:zt))}catch(Ie){_(de(Ie))}},bn=async()=>{if(!(!fe||!ze.trim()||tt)){xe(!0),T("");try{const C=await ee(`/api/projects/${fe.id}`,{method:"PATCH",body:JSON.stringify({name:ze})});l($e=>$e.map(Ie=>Ie.id===C.project.id?C.project:Ie)),q(null),Ge("")}catch(C){T(de(C))}finally{xe(!1)}}},cr=async()=>{if(!(!vt||!$.trim())){un(!0),R("");try{await ee(`/api/projects/${vt.id}/duplicate`,{method:"POST",body:JSON.stringify({name:$})}),ne(null),ut(""),Lt(se,Ye,ye,Je,L)}catch(C){R(de(C))}finally{un(!1)}}},Ft=async()=>{if(!(!ct||tn)){nn(!0),be("");try{await ee(`/api/projects/${ct.id}`,{method:"DELETE"}),l(_t=>_t.filter(zt=>zt.id!==ct.id));const C=Math.max(0,h.total-1),$e=Math.ceil(C/h.pageSize),Ie=$e===0?1:Math.min(Ye,$e),Et={...h,page:Ie,total:C,totalPages:$e};D(Et),dn(null),Ie!==Ye?St(Ie):Lt(se,Ye,ye,Je,L)}catch(C){be(de(C))}finally{nn(!1)}}},Gr=async C=>{ie(C),ft(""),ve([]),I(""),E(!0);try{const $e=await ee("/api/users");ve($e.users.filter(Ie=>Ie.id!==C.ownerId))}catch($e){I(de($e))}finally{E(!1)}},Yr=async()=>{if(!(!S||!At)){E(!0),I("");try{await ee(`/api/projects/${S.id}/owner`,{method:"PUT",body:JSON.stringify({userId:At})}),ie(null),ft(""),Lt(se,Ye,ye,Je,L)}catch(C){I(de(C))}finally{E(!1)}}},Xr=async C=>{const $e=!se;Se(C.id),V("");try{await ee(`/api/projects/${C.id}/archive`,{method:$e?"PUT":"DELETE"});const Ie=c.filter(Un=>Un.id!==C.id);l(Ie);const Et=Math.max(0,h.total-1),_t=Math.ceil(Et/h.pageSize),zt=_t===0?1:Math.min(Ye,_t),ss={...h,page:zt,total:Et,totalPages:_t};D(ss),se||s(Ie,u,ss),zt!==Ye?St(zt):Lt(se,Ye,ye,Je,L)}catch(Ie){V(de(Ie))}finally{Se("")}},Cs=c,ro=["red","orange","yellow","green","blue","purple","gray"],lr=C=>new Date(C).toLocaleString(qe.resolvedLanguage),io=C=>_g(C,qe.resolvedLanguage??"en",Xe,($e,Ie)=>a($e,Ie));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(zi,{siteName:t.siteName})]}),i.jsxs("div",{className:"top-actions",children:[e.role==="admin"&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{className:"ghost",onClick:()=>v(!0),children:[i.jsx($0,{"aria-hidden":!0,size:14}),a("metrics.title")]}),i.jsxs("button",{className:`ghost${y?" top-return-action":""}`,onClick:()=>{b(C=>!C),N(!1)},children:[y?i.jsx(da,{"aria-hidden":!0,size:14}):i.jsx(kr,{"aria-hidden":!0,size:14}),a(y?"users.back":"users.manage")]})]}),i.jsxs("button",{className:`ghost${j?" top-return-action":""}`,onClick:()=>{b(!1),N(C=>!C)},children:[j?i.jsx(da,{"aria-hidden":!0,size:14}):i.jsx(Ns,{"aria-hidden":!0,size:14}),a(j?"users.back":"citationLibrary.title")]}),i.jsx(za,{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:jt,children:a("auth.logout")})]})]}),y?i.jsx(Rg,{currentUser:e,minPasswordLength:t.minPasswordLength}):j?i.jsx("main",{className:"dashboard citation-library-page-shell",children:i.jsx(Hd,{page:!0,open:!0,onOpenChange:N,onBack:()=>N(!1),currentUserId:e.id,maxBibtexBytes:t.maxCitationBibtexBytes})}):i.jsxs("main",{className:"dashboard",children:[i.jsxs("div",{className:"section-title",children:[i.jsxs("div",{children:[i.jsxs("h1",{children:[i.jsx(pa,{"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:()=>{K(""),xt(!0)},children:[i.jsx(ya,{"aria-hidden":!0,size:15}),a("tags.create")]}),e.canCreateProjects&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{onClick:()=>{Ve(""),ue(!0)},children:[i.jsx(Ci,{"aria-hidden":!0,size:15}),a("projects.upload")]}),i.jsxs("button",{className:"primary",onClick:()=>{G(""),Ne(!0)},children:[i.jsx(Ld,{"aria-hidden":!0,size:15}),a("projects.new")]})]})]})]}),z&&i.jsx("p",{className:"error",children:z}),i.jsxs("div",{className:"project-toolbar",children:[i.jsx("input",{type:"search",placeholder:a("projects.search"),value:ye,onChange:C=>{Ke(C.target.value),St(1)}}),i.jsxs("div",{className:"project-scope",role:"tablist","aria-label":a("projects.scope"),children:[i.jsxs("button",{className:se?"":"active",onClick:()=>Tn(!1),role:"tab","aria-selected":!se,children:[i.jsx(pa,{size:14}),a("projects.active")]}),i.jsxs("button",{className:se?"active":"",onClick:()=>Tn(!0),role:"tab","aria-selected":se,children:[i.jsx(Ml,{size:14}),a("projects.archived")]})]}),i.jsxs("div",{className:"tag-filters",children:[i.jsx("button",{className:Je?"":"active",onClick:()=>Bn(""),children:a("projects.allTags")}),u.map(C=>i.jsxs("button",{className:Je===C.id?"active":"",onClick:()=>Bn(Je===C.id?"":C.id),children:[i.jsx(No,{color:C.color}),C.name]},C.id))]}),i.jsxs("label",{className:"project-sort",children:[i.jsx(z0,{size:14}),i.jsx("span",{children:a("projects.sortBy")}),i.jsxs("select",{value:L,onChange:C=>ys(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:P==="grid"?"active":"",onClick:()=>Wt("grid"),title:a("projects.grid"),children:"▦"}),i.jsx("button",{className:P==="list"?"active":"",onClick:()=>Wt("list"),title:a("projects.list"),children:"☷"})]})]}),i.jsxs("div",{className:`project-grid ${P==="list"?"list-view":""}`,children:[Cs.map(C=>i.jsxs("article",{className:`project-card${C.ownerId===e.id?" owned-project":""}`,children:[P==="grid"&&C.ownerId===e.id&&i.jsxs("button",{className:"project-transfer-action",title:a("projects.transferOwnership"),onClick:()=>{Gr(C)},children:[i.jsx(To,{"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($e=>i.jsx("span",{className:`tag tag-${$e.color}`,children:$e.name},$e.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(Rd,{"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(H0,{"aria-hidden":!0,size:13}),a("projects.created")]}),i.jsx("dd",{children:i.jsx("time",{dateTime:C.createdAt,children:lr(C.createdAt)})})]}),i.jsxs("div",{children:[i.jsxs("dt",{children:[i.jsx(tg,{"aria-hidden":!0,size:13}),a("projects.modified")]}),i.jsxs("dd",{title:a("projects.modifiedByUser",{time:lr(C.updatedAt),user:C.lastModifiedDisplayName??C.lastModifiedUsername??a("projects.deletedUser")}),children:[i.jsx("time",{dateTime:C.updatedAt,children:io(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:()=>{_(""),H(C)},children:[i.jsx(ya,{"aria-hidden":!0,size:14}),a("tags.assign")]}),C.permission==="owner"&&i.jsxs("button",{onClick:()=>{T(""),q(C),Ge(C.name)},children:[i.jsx(Da,{"aria-hidden":!0,size:14}),a("projects.rename")]}),(e.role==="admin"||e.canCreateProjects)&&i.jsxs("button",{onClick:()=>{R(""),ne(C),ut(`${C.name} (1)`)},children:[i.jsx(K0,{"aria-hidden":!0,size:14}),a("projects.duplicate")]}),i.jsxs("a",{href:`/api/projects/${C.id}/download`,download:!0,children:[i.jsx(Ar,{"aria-hidden":!0,size:14}),a("projects.download")]}),i.jsxs("button",{disabled:Le===C.id,onClick:()=>{Xr(C)},children:[se?i.jsx(U0,{"aria-hidden":!0,size:14}):i.jsx(Ml,{"aria-hidden":!0,size:14}),a(se?"projects.unarchive":"projects.archive")]}),P==="list"&&C.ownerId===e.id&&i.jsxs("button",{onClick:()=>{Gr(C)},children:[i.jsx(To,{"aria-hidden":!0,size:14}),a("projects.transfer")]}),C.permission==="owner"&&i.jsxs("button",{className:"danger-text",onClick:()=>{dn(C),be("")},children:[i.jsx(cn,{"aria-hidden":!0,size:14}),a("common.delete")]})]})]},C.id)),Cs.length===0&&(c.length===0?se?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(Dg,{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")}))]}),h.totalPages>1&&i.jsxs("nav",{className:"project-pagination","aria-label":a("projects.pagination"),children:[i.jsxs("button",{disabled:h.page<=1,onClick:()=>St(C=>Math.max(1,C-1)),title:a("projects.previousPage"),children:[i.jsx(Cr,{size:15}),a("projects.previousPage")]}),i.jsx("span",{children:a("projects.pageOf",{page:h.page,totalPages:h.totalPages,count:h.total})}),i.jsxs("button",{disabled:h.page>=h.totalPages,onClick:()=>St(C=>Math.min(h.totalPages,C+1)),title:a("projects.nextPage"),children:[i.jsx(Hi,{size:15}),a("projects.nextPage")]})]}),i.jsx(pt,{open:Fe,title:a("projects.new"),description:a("projects.newDescription"),onOpenChange:C=>{!C&&me||(Ne(C),C||G(""))},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{disabled:me,onClick:()=>Ne(!1),children:a("common.cancel")}),i.jsxs("button",{className:"primary",disabled:me||!Ee.trim(),"aria-busy":me,onClick:()=>{Ln()},children:[me&&i.jsx(at,{className:"spin",size:14}),a(me?"common.loading":"common.create")]})]}),children:i.jsxs(i.Fragment,{children:[U&&i.jsx("p",{className:"error dialog-error",children:U}),i.jsxs("label",{className:"form-field",children:[a("projects.name"),i.jsx("input",{autoFocus:!0,value:Ee,onChange:C=>{B(C.target.value),G("")},onKeyDown:C=>{C.key==="Enter"&&Ln()}})]})]})}),i.jsx(pt,{open:Z,title:a("projects.upload"),description:a("projects.uploadDescription",{size:t.maxUploadSizeMB}),onOpenChange:C=>{ue(C),C||Ve("")},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>{ue(!1),Ve("")},children:a("common.cancel")}),i.jsx("button",{className:"primary",disabled:!A||We,onClick:()=>{Qe()},children:a(We?"projects.importing":"projects.import")})]}),children:i.jsxs("div",{className:"form-stack",children:[Ce&&i.jsx("p",{className:"error import-error",children:Ce}),i.jsxs("div",{className:`upload-picker${A?" has-file":""}`,onDragOver:C=>{C.preventDefault(),C.dataTransfer.dropEffect="copy"},onDrop:C=>{C.preventDefault(),Fn(C.dataTransfer.files[0]??null)},children:[i.jsx("input",{ref:lt,className:"sr-only",type:"file",accept:".zip,application/zip",onChange:C=>Fn(C.target.files?.[0]??null)}),i.jsx(fa,{size:34}),i.jsxs("div",{className:"upload-picker-copy",children:[i.jsx("strong",{children:A?.name??a("projects.chooseZip")}),i.jsx("span",{children:A?a("projects.selectedFileSize",{size:Ig(A.size)}):a("projects.dropZip")})]}),i.jsxs("button",{type:"button",onClick:()=>lt.current?.click(),children:[i.jsx(Ci,{size:15}),a("projects.browse")]}),A&&i.jsx("button",{className:"upload-clear",type:"button",title:a("projects.clearFile"),"aria-label":a("projects.clearFile"),onClick:()=>{Fn(null),lt.current&&(lt.current.value="")},children:i.jsx(Vt,{size:14})})]}),i.jsxs("label",{className:"form-field",children:[a("projects.name"),i.jsx("input",{value:O,onChange:C=>te(C.target.value)})]})]})}),i.jsx(pt,{open:ge,title:a("tags.create"),description:a("tags.createDescription"),onOpenChange:C=>{xt(C),C||K("")},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>xt(!1),children:a("common.cancel")}),i.jsx("button",{className:"primary",onClick:()=>{Kr()},children:a("common.create")})]}),children:i.jsxs("div",{className:"form-stack",children:[X&&i.jsx("p",{className:"error dialog-error",children:X}),i.jsxs("label",{className:"form-field",children:[a("tags.name"),i.jsx("input",{autoFocus:!0,value:ce,onChange:C=>{ke(C.target.value),K("")}})]}),i.jsxs("fieldset",{className:"color-picker",children:[i.jsx("legend",{children:a("tags.color")}),ro.map(C=>i.jsxs("label",{className:Re===C?"active":"",children:[i.jsx("input",{type:"radio",name:"dashboard-tag-color",checked:Re===C,onChange:()=>Dt(C)}),i.jsx(No,{color:C}),a(`tags.${C}`)]},C))]})]})}),i.jsx(pt,{open:!!Me,title:a("tags.assignTitle",{project:Me?.name??""}),description:a("tags.assignDescription"),onOpenChange:C=>{C||(H(null),_(""))},footer:i.jsx("button",{onClick:()=>{H(null),_("")},children:a("common.close")}),children:i.jsxs("div",{className:"tag-assignment-list",children:[le&&i.jsx("p",{className:"error dialog-error",children:le}),u.map(C=>i.jsxs("label",{children:[i.jsx("input",{type:"checkbox",checked:!!Me?.tags.some($e=>$e.id===C.id),onChange:()=>{so(C)}}),i.jsx(No,{color:C.color}),i.jsx("span",{children:C.name})]},C.id)),u.length===0&&i.jsx("p",{className:"muted",children:a("tags.empty")})]})}),i.jsx(pt,{open:!!fe,title:a("projects.renameTitle"),onOpenChange:C=>{!C&&tt||C||(q(null),T(""))},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{disabled:tt,onClick:()=>{q(null),T("")},children:a("common.cancel")}),i.jsxs("button",{className:"primary",disabled:tt||!ze.trim(),"aria-busy":tt,onClick:()=>{bn()},children:[tt&&i.jsx(at,{className:"spin",size:14}),a(tt?"common.loading":"projects.rename")]})]}),children:i.jsxs(i.Fragment,{children:[W&&i.jsx("p",{className:"error dialog-error",children:W}),i.jsxs("label",{className:"form-field",children:[a("projects.name"),i.jsx("input",{autoFocus:!0,value:ze,onChange:C=>{Ge(C.target.value),T("")},onKeyDown:C=>{C.key==="Enter"&&bn()}})]})]})}),i.jsx(pt,{open:!!vt,title:a("projects.duplicateTitle"),description:a("projects.duplicateDescription",{project:vt?.name??""}),onOpenChange:C=>{!C&&!Bt&&(ne(null),ut(""),R(""))},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{disabled:Bt,onClick:()=>{ne(null),ut(""),R("")},children:a("common.cancel")}),i.jsx("button",{className:"primary",disabled:Bt||!$.trim(),onClick:()=>{cr()},children:a(Bt?"projects.duplicating":"projects.duplicate")})]}),children:i.jsxs(i.Fragment,{children:[k&&i.jsx("p",{className:"error dialog-error",children:k}),i.jsxs("label",{className:"form-field",children:[a("projects.name"),i.jsx("input",{autoFocus:!0,value:$,onChange:C=>{ut(C.target.value),R("")},onKeyDown:C=>{C.key==="Enter"&&cr()}})]})]})}),i.jsx(pt,{open:!!S,title:a("projects.transferOwnership"),description:a("projects.transferDescription",{project:S?.name??""}),onOpenChange:C=>{!C&&!p&&(ie(null),ft(""),I(""))},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{disabled:p,onClick:()=>{ie(null),ft(""),I("")},children:a("common.cancel")}),i.jsxs("button",{className:"primary",disabled:p||!At,onClick:()=>{Yr()},children:[p?i.jsx(at,{className:"spin",size:14}):i.jsx(To,{size:14}),a("projects.transfer")]})]}),children:i.jsxs("div",{className:"form-stack",children:[F&&i.jsx("p",{className:"error dialog-error",children:F}),i.jsxs("label",{className:"form-field",children:[a("projects.newOwner"),i.jsxs("select",{disabled:p||oe.length===0,value:At,onChange:C=>ft(C.target.value),children:[i.jsx("option",{value:"",children:p?a("common.loading"):oe.length>0?a("projects.chooseNewOwner"):a("projects.noTransferUsers")}),oe.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(Zt,{size:15}),a("projects.transferWarning")]})]})}),i.jsx(Jn,{open:!!ct,title:a("projects.deleteTitle"),description:a("projects.deleteDescription",{project:ct?.name??""}),confirmLabel:a(tn?"common.loading":"common.delete"),danger:!0,busy:tn,error:he,onCancel:()=>{tn||(dn(null),be(""))},onConfirm:()=>{Ft()}})]}),w&&i.jsx(f.Suspense,{fallback:null,children:i.jsx(Og,{open:!0,onOpenChange:v})}),i.jsx(Ha,{})]})}function No({color:t}){return i.jsx("span",{className:`tag-dot tag-${t}`})}const Ei=[{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'}],Cn={font:"jetbrains",fontSize:14,lineHeight:1.65,lineWrapping:!0,spellCheck:!0,vimMode:!1,formatOnCompile:!1,texFmtConfig:"",openFilesInTabs:!1},$g="texlite-editor-preferences";function Vd(t,e){return`${$g}:${encodeURIComponent(t)}:${encodeURIComponent(e)}`}function cC(t){return Ei.find(e=>e.id===t)?.stack??Ei[0].stack}function Kl(t,e){try{const n=JSON.parse(localStorage.getItem(Vd(t,e))??"{}");return{font:Ei.some(s=>s.id===n.font)?n.font:Cn.font,fontSize:[12,13,14,15,16,18,20].includes(Number(n.fontSize))?Number(n.fontSize):Cn.fontSize,lineHeight:[1.45,1.65,1.85].includes(Number(n.lineHeight))?Number(n.lineHeight):Cn.lineHeight,lineWrapping:typeof n.lineWrapping=="boolean"?n.lineWrapping:Cn.lineWrapping,spellCheck:typeof n.spellCheck=="boolean"?n.spellCheck:Cn.spellCheck,vimMode:typeof n.vimMode=="boolean"?n.vimMode:Cn.vimMode,formatOnCompile:typeof n.formatOnCompile=="boolean"?n.formatOnCompile:Cn.formatOnCompile,texFmtConfig:typeof n.texFmtConfig=="string"&&n.texFmtConfig.length<=16*1024?n.texFmtConfig:Cn.texFmtConfig,openFilesInTabs:typeof n.openFilesInTabs=="boolean"?n.openFilesInTabs:Cn.openFilesInTabs}}catch{return Cn}}function Ug(t,e,n){localStorage.setItem(Vd(t,e),JSON.stringify(n))}function zg(){let t={status:"loading",error:""};const e=new Set,n=(s,r="")=>{if(!(t.status===s&&t.error===r)){t={status:s,error:r};for(const o of e)o()}};return{getSnapshot:()=>t,subscribe:s=>(e.add(s),()=>e.delete(s)),loading:()=>n("loading"),working:()=>n("working"),failed:s=>n("error",s instanceof Error?s.message:String(s))}}const Jt=zg(),Hg=/\.(?:tex|bib|cls|sty)$/i,qd=3e4;let fn=null,wi=!1,as=null,Vg=1;const ds=new Map,xi=[];let Ps=null,Dr=null;class Xt extends Error{constructor(e,n){super(n),this.kind=e,this.name="TexFmtError"}kind}function Ro(t){return t instanceof Xt}function Pn(t){fn?.terminate(),fn=null,wi=!1,as!==null&&window.clearTimeout(as),as=null,Ps=null,xi.length=0,Dr=null,Jt.failed(t);for(const e of ds.values())e.timeout!==null&&window.clearTimeout(e.timeout),e.reject(t);ds.clear()}function Er(){if(Ps!==null||xi.length===0)return;let t;try{t=qg()}catch(s){Pn(s instanceof Xt?s:new Xt("load","The bundled tex-fmt formatter could not be loaded."));return}if(!wi)return;const e=xi.shift();if(e===void 0)return;const n=ds.get(e);if(!n){Er();return}Ps=e,n.timeout=window.setTimeout(()=>{Ps===e&&Pn(new Xt("result","The formatter did not respond within 30 seconds."))},qd);try{t.postMessage({...n.request,id:e})}catch{Pn(new Xt("load","The formatter worker could not receive the source."))}}function qg(){if(fn)return fn;if(typeof Worker>"u"){const t=new Xt("load","This browser does not support formatter workers.");throw Jt.failed(t),t}Jt.loading();try{fn=new Worker(new URL("/assets/latexFormatterWorker-DYkYtcFy.js",import.meta.url),{type:"module",name:"texlite-latex-formatter"}),as=window.setTimeout(()=>{wi||Pn(new Xt("load","The formatter did not finish loading within 30 seconds."))},qd)}catch{const t=new Xt("load","The bundled tex-fmt formatter could not be loaded.");throw Jt.failed(t),t}return fn.onmessage=t=>{const e=t.data;if(e&&"type"in e){e.type==="ready"&&(wi=!0,as!==null&&window.clearTimeout(as),as=null,Er());return}if(!e||typeof e.id!="number"){Pn(new Xt("result","The formatter worker returned an invalid response."));return}const n=ds.get(e.id);if(n)if(ds.delete(e.id),n.timeout!==null&&window.clearTimeout(n.timeout),Ps===e.id&&(Ps=null),e.ok)Jt.working(),n.resolve(e.result),Er();else{const s=new Xt(e.kind,e.message);e.kind==="format"?(Jt.working(),n.reject(s),Er()):(n.reject(s),Pn(s))}},fn.onerror=()=>{Pn(new Xt("load","The bundled tex-fmt formatter could not be loaded."))},fn.onmessageerror=()=>{Pn(new Xt("result","The formatter worker returned an unreadable response."))},fn}function rc(t){const e=Vg++;return new Promise((n,s)=>{ds.set(e,{request:t,resolve:n,reject:s,timeout:null}),xi.push(e),Er()})}function Wg(t,e=""){return rc({action:"format",source:t,config:e})}async function Wd(){fn&&Jt.getSnapshot().status==="working"||(Dr||(Dr=rc({action:"probe"}).then(()=>{}).finally(()=>{Dr=null})),await Dr)}async function Kg(){(fn||ds.size)&&Pn(new Xt("load","The formatter runtime was reloaded.")),Jt.loading(),await Wd()}function ai(t){return Hg.test(t)}function Gg(t){return t.match(/(?:\r?\n)+$/)?.[0]??""}function Yg(t,e){const n=Gg(t),a=(n?t.slice(0,-n.length):t).split(/\r?\n/).find(u=>u.trim())?.match(/^[\t ]*/)?.[0]??"",c=e.replace(/(?:\r?\n)+$/,"");return`${a?c.split(`
40
- `).map(u=>u&&`${a}${u}`).join(`
41
- `):c}${n}`}async function Oo(t,e,n=0){return rc({action:"diff",source:t,formatted:e,baseOffset:n})}function Xg(t,e=null){const n=Gl(t),r=e==="succeeded"||e===null&&Zg(t)?[]:Yl(n.filter(Xl)),o=Gl(Jg(t));return{warnings:Yl(o.filter(c=>!Xl(c)&&Qg(c))),errors:r}}function Gl(t){return t.split(`
42
- `).map(e=>e.trim()).filter(Boolean)}function Yl(t){return[...new Set(t)]}function Jg(t){const e=/^Running ['"][^\n]*(?:pdf|xe|lua)latex(?:\s|['"])[^\n]*$/gim;let n=-1;for(const s of t.matchAll(e))n=s.index;return n>=0?t.slice(n):t}function Zg(t){return/Latexmk: All targets .* are up-to-date/i.test(t)&&/Output written on .*\.pdf/i.test(t)}function Xl(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 Qg(t){return/\bwarnings?\b|overfull|underfull|badness/i.test(t)}function e1(t){return t instanceof Error&&t.name==="AbortError"}function t1({projectId:t,activeFile:e,permission:n,revision:s,selection:r,save:o,onError:a,onAdded:c}){const[l,u]=f.useState([]),[d,h]=f.useState(null),[D,m]=f.useState(!1),[g,y]=f.useState(""),b=f.useRef(null),w=f.useRef(e),v=f.useRef(o),j=f.useRef(a),N=f.useRef(c);w.current=e,v.current=o,j.current=a,N.current=c;const z=async W=>{b.current?.abort();const T=new AbortController;b.current=T;try{const k=await ee(`/api/projects/${t}/comments?path=${encodeURIComponent(W)}`,{signal:T.signal});w.current===W&&u(k.comments)}catch(k){!e1(k)&&w.current===W&&u([])}finally{b.current===T&&(b.current=null)}};return f.useEffect(()=>{h(null)},[t,e]),f.useEffect(()=>(e?z(e):u([]),()=>{b.current?.abort(),b.current=null}),[t,e,s]),{comments:l,focusComment:d,setFocusComment:h,commentOpen:D,setCommentOpen:m,commentText:g,setCommentText:y,addComment:async()=>{if(!(!g.trim()||!e))try{if(n!=="read"&&!await v.current())return;await ee(`/api/projects/${t}/comments`,{method:"POST",body:JSON.stringify({path:e,content:g,...r})}),await z(e),m(!1),y(""),N.current()}catch(W){j.current(de(W))}},toggleComment:async W=>{try{await ee(`/api/projects/${t}/comments/${W.id}`,{method:"PATCH",body:JSON.stringify({resolved:!W.resolved})}),await z(e)}catch(T){j.current(de(T))}},replyToComment:async(W,T)=>{try{return await ee(`/api/projects/${t}/comments/${W.id}/replies`,{method:"POST",body:JSON.stringify({content:T})}),await z(e),!0}catch(k){return j.current(de(k)),!1}},editComment:async(W,T)=>{try{return await ee(`/api/projects/${t}/comments/${W.id}`,{method:"PATCH",body:JSON.stringify({content:T})}),await z(e),!0}catch(k){return j.current(de(k)),!1}},deleteComment:async W=>{try{return await ee(`/api/projects/${t}/comments/${W.id}`,{method:"DELETE"}),await z(e),h(T=>T?.id===W.id?null:T),!0}catch(T){return j.current(de(T)),!1}},editCommentReply:async(W,T,k)=>{try{return await ee(`/api/projects/${t}/comments/${W.id}/replies/${T}`,{method:"PATCH",body:JSON.stringify({content:k})}),await z(e),!0}catch(R){return j.current(de(R)),!1}},deleteCommentReply:async(W,T)=>{try{return await ee(`/api/projects/${t}/comments/${W.id}/replies/${T}`,{method:"DELETE"}),await z(e),!0}catch(k){return j.current(de(k)),!1}}}}const Gt=()=>new Map,va=t=>{const e=Gt();return t.forEach((n,s)=>{e.set(s,n)}),e},kn=(t,e,n)=>{let s=t.get(e);return s===void 0&&t.set(e,s=n()),s},n1=(t,e)=>{const n=[];for(const[s,r]of t)n.push(e(r,s));return n},s1=(t,e)=>{for(const[n,s]of t)if(e(s,n))return!0;return!1},Zn=()=>new Set,Po=t=>t[t.length-1],r1=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},Mn=Array.from,ic=(t,e)=>{for(let n=0;n<t.length;n++)if(!e(t[n],n,t))return!1;return!0},oc=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},i1=(t,e)=>{const n=new Array(t);for(let s=0;s<t;s++)n[s]=e(s,n);return n},Ks=Array.isArray;class ac{constructor(){this._observers=Gt()}on(e,n){return kn(this._observers,e,Zn).add(n),n}once(e,n){const s=(...r)=>{this.off(e,s),n(...r)};this.on(e,s)}off(e,n){const s=this._observers.get(e);s!==void 0&&(s.delete(n),s.size===0&&this._observers.delete(e))}emit(e,n){return Mn((this._observers.get(e)||Gt()).values()).forEach(s=>s(...n))}destroy(){this._observers=Gt()}}class Kd{constructor(){this._observers=Gt()}on(e,n){kn(this._observers,e,Zn).add(n)}once(e,n){const s=(...r)=>{this.off(e,s),n(...r)};this.on(e,s)}off(e,n){const s=this._observers.get(e);s!==void 0&&(s.delete(n),s.size===0&&this._observers.delete(e))}emit(e,n){return Mn((this._observers.get(e)||Gt()).values()).forEach(s=>s(...n))}destroy(){this._observers=Gt()}}const mn=Math.floor,fi=Math.abs,cc=(t,e)=>t<e?t:e,Ds=(t,e)=>t>e?t:e,o1=Math.pow,Gd=t=>t!==0?t<0:1/t<0,Jl=1,Zl=2,_o=4,Io=8,Sr=32,_n=64,Qt=128,Vi=31,Aa=63,ls=127,a1=2147483647,vi=Number.MAX_SAFE_INTEGER,Ql=Number.MIN_SAFE_INTEGER,c1=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&mn(t)===t),Yd=String.fromCharCode,l1=t=>t.toLowerCase(),u1=/^\s*/g,d1=t=>t.replace(u1,""),h1=/([A-Z])/g,eu=(t,e)=>d1(t.replace(h1,n=>`${e}${l1(n)}`)),f1=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,s=new Uint8Array(n);for(let r=0;r<n;r++)s[r]=e.codePointAt(r);return s},jr=typeof TextEncoder<"u"?new TextEncoder:null,p1=t=>jr.encode(t),m1=jr?p1:f1;let wr=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});wr&&wr.decode(new Uint8Array).length===1&&(wr=null);const D1=(t,e)=>i1(e,()=>t).join("");class $r{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const yt=()=>new $r,lc=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},et=t=>{const e=new Uint8Array(lc(t));let n=0;for(let s=0;s<t.bufs.length;s++){const r=t.bufs[s];e.set(r,n),n+=r.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},g1=(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(Ds(n,e)*2),t.cpos=0)},Nt=(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},ka=Nt,pe=(t,e)=>{for(;e>ls;)Nt(t,Qt|ls&e),e=mn(e/128);Nt(t,ls&e)},uc=(t,e)=>{const n=Gd(e);for(n&&(e=-e),Nt(t,(e>Aa?Qt:0)|(n?_n:0)|Aa&e),e=mn(e/64);e>0;)Nt(t,(e>ls?Qt:0)|ls&e),e=mn(e/128)},Sa=new Uint8Array(3e4),F1=Sa.length/3,b1=(t,e)=>{if(e.length<F1){const n=jr.encodeInto(e,Sa).written||0;pe(t,n);for(let s=0;s<n;s++)Nt(t,Sa[s])}else bt(t,m1(e))},y1=(t,e)=>{const n=unescape(encodeURIComponent(e)),s=n.length;pe(t,s);for(let r=0;r<s;r++)Nt(t,n.codePointAt(r))},Mt=jr&&jr.encodeInto?b1:y1,qi=(t,e)=>{const n=t.cbuf.length,s=t.cpos,r=cc(n-s,e.length),o=e.length-r;t.cbuf.set(e.subarray(0,r),s),t.cpos+=r,o>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(Ds(n*2,o)),t.cbuf.set(e.subarray(r)),t.cpos=o)},bt=(t,e)=>{pe(t,e.byteLength),qi(t,e)},dc=(t,e)=>{g1(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},C1=(t,e)=>dc(t,4).setFloat32(0,e,!1),E1=(t,e)=>dc(t,8).setFloat64(0,e,!1),w1=(t,e)=>dc(t,8).setBigInt64(0,e,!1),tu=new DataView(new ArrayBuffer(4)),x1=t=>(tu.setFloat32(0,t),tu.getFloat32(0)===t),Tr=(t,e)=>{switch(typeof e){case"string":Nt(t,119),Mt(t,e);break;case"number":c1(e)&&fi(e)<=a1?(Nt(t,125),uc(t,e)):x1(e)?(Nt(t,124),C1(t,e)):(Nt(t,123),E1(t,e));break;case"bigint":Nt(t,122),w1(t,e);break;case"object":if(e===null)Nt(t,126);else if(Ks(e)){Nt(t,117),pe(t,e.length);for(let n=0;n<e.length;n++)Tr(t,e[n])}else if(e instanceof Uint8Array)Nt(t,116),bt(t,e);else{Nt(t,118);const n=Object.keys(e);pe(t,n.length);for(let s=0;s<n.length;s++){const r=n[s];Mt(t,r),Tr(t,e[r])}}break;case"boolean":Nt(t,e?120:121);break;default:Nt(t,127)}};class nu extends $r{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&pe(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const su=t=>{t.count>0&&(uc(t.encoder,t.count===1?t.s:-t.s),t.count>1&&pe(t.encoder,t.count-2))};class pi{constructor(){this.encoder=new $r,this.s=0,this.count=0}write(e){this.s===e?this.count++:(su(this),this.count=1,this.s=e)}toUint8Array(){return su(this),et(this.encoder)}}const ru=t=>{if(t.count>0){const e=t.diff*2+(t.count===1?0:1);uc(t.encoder,e),t.count>1&&pe(t.encoder,t.count-2)}};class Mo{constructor(){this.encoder=new $r,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(ru(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return ru(this),et(this.encoder)}}class v1{constructor(){this.sarr=[],this.s="",this.lensE=new pi}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 $r;return this.sarr.push(this.s),this.s="",Mt(e,this.sarr.join("")),qi(e,this.lensE.toUint8Array()),et(e)}}const Dn=t=>new Error(t),pn=()=>{throw Dn("Method unimplemented")},en=()=>{throw Dn("Unexpected case")},Xd=Dn("Unexpected end of array"),Jd=Dn("Integer out of Range");class Wi{constructor(e){this.arr=e,this.pos=0}}const ns=t=>new Wi(t),ja=t=>t.pos!==t.arr.length,A1=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},$t=t=>A1(t,Te(t)),Gs=t=>t.arr[t.pos++],Te=t=>{let e=0,n=1;const s=t.arr.length;for(;t.pos<s;){const r=t.arr[t.pos++];if(e=e+(r&ls)*n,n*=128,r<Qt)return e;if(e>vi)throw Jd}throw Xd},hc=t=>{let e=t.arr[t.pos++],n=e&Aa,s=64;const r=(e&_n)>0?-1:1;if((e&Qt)===0)return r*n;const o=t.arr.length;for(;t.pos<o;){if(e=t.arr[t.pos++],n=n+(e&ls)*s,s*=128,e<Qt)return r*n;if(n>vi)throw Jd}throw Xd},k1=t=>{let e=Te(t);if(e===0)return"";{let n=String.fromCodePoint(Gs(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(Gs(t));else for(;e>0;){const s=e<1e4?e:1e4,r=t.arr.subarray(t.pos,t.pos+s);t.pos+=s,n+=String.fromCodePoint.apply(null,r),e-=s}return decodeURIComponent(escape(n))}},S1=t=>wr.decode($t(t)),ht=wr?S1:k1,fc=(t,e)=>{const n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},j1=t=>fc(t,4).getFloat32(0,!1),T1=t=>fc(t,8).getFloat64(0,!1),B1=t=>fc(t,8).getBigInt64(0,!1),L1=[t=>{},t=>null,hc,j1,T1,B1,t=>!1,t=>!0,ht,t=>{const e=Te(t),n={};for(let s=0;s<e;s++){const r=ht(t);n[r]=Br(t)}return n},t=>{const e=Te(t),n=[];for(let s=0;s<e;s++)n.push(Br(t));return n},$t],Br=t=>L1[127-Gs(t)](t);class iu extends Wi{constructor(e,n){super(e),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),ja(this)?this.count=Te(this)+1:this.count=-1),this.count--,this.s}}class mi extends Wi{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=hc(this);const e=Gd(this.s);this.count=1,e&&(this.s=-this.s,this.count=Te(this)+2)}return this.count--,this.s}}class $o extends Wi{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=hc(this),n=e&1;this.diff=mn(e/2),this.count=1,n&&(this.count=Te(this)+2)}return this.s+=this.diff,this.count--,this.s}}class N1{constructor(e){this.decoder=new mi(e),this.str=ht(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 R1=crypto.getRandomValues.bind(crypto),Zd=()=>R1(new Uint32Array(1))[0],O1="10000000-1000-4000-8000"+-1e11,P1=()=>O1.replace(/[018]/g,t=>(t^Zd()&15>>t/4).toString(16)),Qn=Date.now,Ys=t=>new Promise(t);Promise.all.bind(Promise);const ou=t=>t===void 0?null:t;class _1{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let Qd=new _1,pc=!0;try{typeof localStorage<"u"&&localStorage&&(Qd=localStorage,pc=!1)}catch{}const eh=Qd,I1=t=>pc||addEventListener("storage",t),M1=t=>pc||removeEventListener("storage",t),Lr=Symbol("Equality"),th=(t,e)=>t===e||!!t?.[Lr]?.(e)||!1,$1=t=>typeof t=="object",U1=Object.assign,z1=Object.keys,H1=(t,e)=>{for(const n in t)e(t[n],n)},V1=(t,e)=>{const n=[];for(const s in t)n.push(e(t[s],s));return n},Ai=t=>z1(t).length,q1=t=>{for(const e in t)return!1;return!0},Ur=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},mc=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),W1=(t,e)=>t===e||Ai(t)===Ai(e)&&Ur(t,(n,s)=>(n!==void 0||mc(e,s))&&th(e[s],n)),K1=Object.freeze,nh=t=>{for(const e in t){const n=t[e];(typeof n=="object"||typeof n=="function")&&nh(t[e])}return K1(t)},Dc=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&Dc(t,e,n+1)}},G1=t=>t,_s=(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[Lr]!=null)return t[Lr](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)||!_s(t.get(n),e.get(n)))return!1;break}case void 0:case Object:if(Ai(t)!==Ai(e))return!1;for(const n in t)if(!mc(t,n)||!_s(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(!_s(t[n],e[n]))return!1;break;default:return!1}return!0},Y1=(t,e)=>e.includes(t);var sh={};const es=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",rh=typeof window<"u"&&typeof document<"u"&&!es;let En;const X1=()=>{if(En===void 0)if(es){En=Gt();const t=process.argv;let e=null;for(let n=0;n<t.length;n++){const s=t[n];s[0]==="-"?(e!==null&&En.set(e,""),e=s):e!==null&&(En.set(e,s),e=null)}e!==null&&En.set(e,"")}else typeof location=="object"?(En=Gt(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");En.set(`--${eu(e,"-")}`,n),En.set(`-${eu(e,"-")}`,n)}})):En=Gt();return En},Ta=t=>X1().has(t),ki=t=>ou(es?sh[t.toUpperCase().replaceAll("-","_")]:eh.getItem(t)),ih=t=>Ta("--"+t)||ki(t)!==null,J1=ih("production"),Z1=es&&Y1(sh.FORCE_COLOR,["true","1","2"]),Q1=Z1||!Ta("--no-colors")&&!ih("no-color")&&(!es||process.stdout.isTTY)&&(!es||Ta("--color")||ki("COLORTERM")!==null||(ki("TERM")||"").includes("color")),oh=t=>new Uint8Array(t),eF=(t,e,n)=>new Uint8Array(t,e,n),tF=t=>new Uint8Array(t),nF=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=Yd(t[n]);return btoa(e)},sF=t=>Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),rF=t=>{const e=atob(t),n=oh(e.length);for(let s=0;s<e.length;s++)n[s]=e.charCodeAt(s);return n},iF=t=>{const e=Buffer.from(t,"base64");return eF(e.buffer,e.byteOffset,e.byteLength)},oF=rh?nF:sF,aF=rh?rF:iF,cF=t=>{const e=oh(t.byteLength);return e.set(t),e};class lF{constructor(e,n){this.left=e,this.right=n}}const Rn=(t,e)=>new lF(t,e),uF=(t,e)=>t.forEach(n=>e(n.left,n.right)),au=t=>t.next()>=.5,Uo=(t,e,n)=>mn(t.next()*(n+1-e)+e),ah=(t,e,n)=>mn(t.next()*(n+1-e)+e),gc=(t,e,n)=>ah(t,e,n),dF=t=>Yd(gc(t,97,122)),hF=(t,e=0,n=20)=>{const s=gc(t,e,n);let r="";for(let o=0;o<s;o++)r+=dF(t);return r},zo=(t,e)=>e[gc(t,0,e.length-1)],fF=Symbol("0schema");class pF{constructor(){this._rerrs=[]}extend(e,n,s,r=null){this._rerrs.push({path:e,expected:n,has:s,message:r})}toString(){const e=[];for(let n=this._rerrs.length-1;n>0;n--){const s=this._rerrs[n];e.push(D1(" ",(this._rerrs.length-n)*2)+`${s.path!=null?`[${s.path}] `:""}${s.has} doesn't match ${s.expected}. ${s.message}`)}return e.join(`
43
- `)}}const Ba=(t,e)=>t===e?!0:t==null||e==null||t.constructor!==e.constructor?!1:t[Lr]?th(t,e):Ks(t)?ic(t,n=>oc(e,s=>Ba(n,s))):$1(t)?Ur(t,(n,s)=>Ba(n,e[s])):!1;class qt{static _dilutes=!1;extends(e){let[n,s]=[this.shape,e.shape];return this.constructor._dilutes&&([s,n]=[n,s]),Ba(n,s)}equals(e){return this.constructor===e.constructor&&_s(this.shape,e.shape)}[fF](){return!0}[Lr](e){return this.equals(e)}validate(e){return this.check(e)}check(e,n){pn()}get nullable(){return rr(this,Ji)}get optional(){return new uh(this)}cast(e){return cu(e,this),e}expect(e){return cu(e,this),e}}class Fc extends qt{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n=void 0){const s=e?.constructor===this.shape&&(this._c==null||this._c(e));return!s&&n?.extend(null,this.shape.name,e?.constructor.name,e?.constructor!==this.shape?"Constructor match failed":"Check failed"),s}}const kt=(t,e=null)=>new Fc(t,e);kt(Fc);class bc extends qt{constructor(e){super(),this.shape=e}check(e,n){const s=this.shape(e);return!s&&n?.extend(null,"custom prop",e?.constructor.name,"failed to check custom prop"),s}}const Pt=t=>new bc(t);kt(bc);class Ki extends qt{constructor(e){super(),this.shape=e}check(e,n){const s=this.shape.some(r=>r===e);return!s&&n?.extend(null,this.shape.join(" | "),e.toString()),s}}const Gi=(...t)=>new Ki(t),ch=kt(Ki),mF=RegExp.escape||(t=>t.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),lh=t=>{if(Xs.check(t))return[mF(t)];if(ch.check(t))return t.shape.map(e=>e+"");if(bh.check(t))return["[+-]?\\d+.?\\d*"];if(yh.check(t))return[".*"];if(Si.check(t))return t.shape.map(lh).flat(1);en()};class DF extends qt{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(lh).map(n=>`(${n.join("|")})`).join("")+"$")}check(e,n){const s=this._r.exec(e)!=null;return!s&&n?.extend(null,this._r.toString(),e.toString(),"String doesn't match string template."),s}}kt(DF);const gF=Symbol("optional");class uh extends qt{constructor(e){super(),this.shape=e}check(e,n){const s=e===void 0||this.shape.check(e);return!s&&n?.extend(null,"undefined (optional)","()"),s}get[gF](){return!0}}const FF=kt(uh);class bF extends qt{check(e,n){return n?.extend(null,"never",typeof e),!1}}kt(bF);class Yi extends qt{constructor(e,n=!1){super(),this.shape=e,this._isPartial=n}static _dilutes=!0;get partial(){return new Yi(this.shape,!0)}check(e,n){return e==null?(n?.extend(null,"object","null"),!1):Ur(this.shape,(s,r)=>{const o=this._isPartial&&!mc(e,r)||s.check(e[r],n);return!o&&n?.extend(r.toString(),s.toString(),typeof e[r],"Object property does not match"),o})}}const yF=t=>new Yi(t),CF=kt(Yi),EF=Pt(t=>t!=null&&(t.constructor===Object||t.constructor==null));class dh extends qt{constructor(e,n){super(),this.shape={keys:e,values:n}}check(e,n){return e!=null&&Ur(e,(s,r)=>{const o=this.shape.keys.check(r,n);return!o&&n?.extend(r+"","Record",typeof e,o?"Key doesn't match schema":"Value doesn't match value"),o&&this.shape.values.check(s,n)})}}const hh=(t,e)=>new dh(t,e),wF=kt(dh);class fh extends qt{constructor(e){super(),this.shape=e}check(e,n){return e!=null&&Ur(this.shape,(s,r)=>{const o=s.check(e[r],n);return!o&&n?.extend(r.toString(),"Tuple",typeof s),o})}}const xF=(...t)=>new fh(t);kt(fh);class ph extends qt{constructor(e){super(),this.shape=e.length===1?e[0]:new yc(e)}check(e,n){const s=Ks(e)&&ic(e,r=>this.shape.check(r));return!s&&n?.extend(null,"Array",""),s}}const mh=(...t)=>new ph(t),vF=kt(ph),AF=Pt(t=>Ks(t));class Dh extends qt{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n){const s=e instanceof this.shape&&(this._c==null||this._c(e));return!s&&n?.extend(null,this.shape.name,e?.constructor.name),s}}const kF=(t,e=null)=>new Dh(t,e);kt(Dh);const SF=kF(qt);class jF extends qt{constructor(e){super(),this.len=e.length-1,this.args=xF(...e.slice(-1)),this.res=e[this.len]}check(e,n){const s=e.constructor===Function&&e.length<=this.len;return!s&&n?.extend(null,"function",typeof e),s}}const TF=kt(jF),BF=Pt(t=>typeof t=="function");class LF extends qt{constructor(e){super(),this.shape=e}check(e,n){const s=ic(this.shape,r=>r.check(e,n));return!s&&n?.extend(null,"Intersectinon",typeof e),s}}kt(LF,t=>t.shape.length>0);class yc extends qt{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,n){const s=oc(this.shape,r=>r.check(e,n));return n?.extend(null,"Union",typeof e),s}}const rr=(...t)=>t.findIndex(e=>Si.check(e))>=0?rr(...t.map(e=>Nr(e)).map(e=>Si.check(e)?e.shape:[e]).flat(1)):t.length===1?t[0]:new yc(t),Si=kt(yc),gh=()=>!0,ji=Pt(gh),NF=kt(bc,t=>t.shape===gh),Cc=Pt(t=>typeof t=="bigint"),RF=Pt(t=>t===Cc),Fh=Pt(t=>typeof t=="symbol");Pt(t=>t===Fh);const Is=Pt(t=>typeof t=="number"),bh=Pt(t=>t===Is),Xs=Pt(t=>typeof t=="string"),yh=Pt(t=>t===Xs),Xi=Pt(t=>typeof t=="boolean"),OF=Pt(t=>t===Xi),Ch=Gi(void 0);kt(Ki,t=>t.shape.length===1&&t.shape[0]===void 0);Gi(void 0);const Ji=Gi(null),PF=kt(Ki,t=>t.shape.length===1&&t.shape[0]===null);kt(Uint8Array);kt(Fc,t=>t.shape===Uint8Array);const _F=rr(Is,Xs,Ji,Ch,Cc,Xi,Fh);(()=>{const t=mh(ji),e=hh(Xs,ji),n=rr(Is,Xs,Ji,Xi,t,e);return t.shape=n,e.shape.values=n,n})();const Nr=t=>{if(SF.check(t))return t;if(EF.check(t)){const e={};for(const n in t)e[n]=Nr(t[n]);return yF(e)}else{if(AF.check(t))return rr(...t.map(Nr));if(_F.check(t))return Gi(t);if(BF.check(t))return kt(t)}en()},cu=J1?()=>{}:(t,e)=>{const n=new pF;if(!e.check(t,n))throw Dn(`Expected value to be of type ${e.constructor.name}.
44
- ${n.toString()}`)};class IF{constructor(e){this.patterns=[],this.$state=e}if(e,n){return this.patterns.push({if:Nr(e),h:n}),this}else(e){return this.if(ji,e)}done(){return(e,n)=>{for(let s=0;s<this.patterns.length;s++){const r=this.patterns[s];if(r.if.check(e))return r.h(e,n)}throw Dn("Unhandled pattern")}}}const MF=t=>new IF(t),Eh=MF(ji).if(bh,(t,e)=>Uo(e,Ql,vi)).if(yh,(t,e)=>hF(e)).if(OF,(t,e)=>au(e)).if(RF,(t,e)=>BigInt(Uo(e,Ql,vi))).if(Si,(t,e)=>ks(e,zo(e,t.shape))).if(CF,(t,e)=>{const n={};for(const s in t.shape){let r=t.shape[s];if(FF.check(r)){if(au(e))continue;r=r.shape}n[s]=Eh(r,e)}return n}).if(vF,(t,e)=>{const n=[],s=ah(e,0,42);for(let r=0;r<s;r++)n.push(ks(e,t.shape));return n}).if(ch,(t,e)=>zo(e,t.shape)).if(PF,(t,e)=>null).if(TF,(t,e)=>{const n=ks(e,t.res);return()=>n}).if(NF,(t,e)=>ks(e,zo(e,[Is,Xs,Ji,Ch,Cc,Xi,mh(Is),hh(rr("a","b","c"),Is)]))).if(wF,(t,e)=>{const n={},s=Uo(e,0,3);for(let r=0;r<s;r++){const o=ks(e,t.shape.keys),a=ks(e,t.shape.values);n[o]=a}return n}).done(),ks=(t,e)=>Eh(Nr(e),t),Sn=typeof document<"u"?document:{},$F=t=>Sn.createElement(t),UF=()=>Sn.createDocumentFragment();Pt(t=>t.nodeType===XF);const zF=t=>Sn.createTextNode(t);typeof DOMParser<"u"&&new DOMParser;const HF=(t,e)=>(uF(e,(n,s)=>{s===!1?t.removeAttribute(n):s===!0?t.setAttribute(n,""):t.setAttribute(n,s)}),t),VF=t=>{const e=UF();for(let n=0;n<t.length;n++)wh(e,t[n]);return e},qF=(t,e)=>(wh(t,VF(e)),t),lC=(t,e=[],n=[])=>qF(HF($F(t),e),n);Pt(t=>t.nodeType===KF);const uC=zF;Pt(t=>t.nodeType===GF);const WF=t=>n1(t,(e,n)=>`${n}:${e};`).join(""),wh=(t,e)=>t.appendChild(e),KF=Sn.ELEMENT_NODE,GF=Sn.TEXT_NODE;Sn.CDATA_SECTION_NODE;Sn.COMMENT_NODE;const YF=Sn.DOCUMENT_NODE;Sn.DOCUMENT_TYPE_NODE;const XF=Sn.DOCUMENT_FRAGMENT_NODE;Pt(t=>t.nodeType===YF);const $n=Symbol,xh=$n(),vh=$n(),JF=$n(),ZF=$n(),QF=$n(),Ah=$n(),eb=$n(),Ec=$n(),tb=$n(),nb=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());const e=[],n=[];let s=0;for(;s<t.length;s++){const r=t[s];if(r===void 0)break;if(r.constructor===String||r.constructor===Number)e.push(r);else if(r.constructor===Object)break}for(s>0&&n.push(e.join(""));s<t.length;s++){const r=t[s];r instanceof Symbol||n.push(r)}return n},sb={[xh]:Rn("font-weight","bold"),[vh]:Rn("font-weight","normal"),[JF]:Rn("color","blue"),[QF]:Rn("color","green"),[ZF]:Rn("color","grey"),[Ah]:Rn("color","red"),[eb]:Rn("color","purple"),[Ec]:Rn("color","orange"),[tb]:Rn("color","black")},rb=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());const e=[],n=[],s=Gt();let r=[],o=0;for(;o<t.length;o++){const a=t[o],c=sb[a];if(c!==void 0)s.set(c.left,c.right);else{if(a===void 0)break;if(a.constructor===String||a.constructor===Number){const l=WF(s);o>0||l.length>0?(e.push("%c"+a),n.push(l)):e.push(a)}else break}}for(o>0&&(r=n,r.unshift(e.join("")));o<t.length;o++){const a=t[o];a instanceof Symbol||r.push(a)}return r},kh=Q1?rb:nb,ib=(...t)=>{console.log(...kh(t)),jh.forEach(e=>e.print(t))},Sh=(...t)=>{console.warn(...kh(t)),t.unshift(Ec),jh.forEach(e=>e.print(t))},jh=Zn(),Th=t=>({[Symbol.iterator](){return this},next:t}),ob=(t,e)=>Th(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),Ho=(t,e)=>Th(()=>{const{done:n,value:s}=t.next();return{done:n,value:n?void 0:e(s)}});class Zi{constructor(e,n){this.clock=e,this.len=n}}class ir{constructor(){this.clients=new Map}}const Js=(t,e,n)=>e.clients.forEach((s,r)=>{const o=t.doc.store.clients.get(r);if(o!=null){const a=o[o.length-1],c=a.id.clock+a.length;for(let l=0,u=s[l];l<s.length&&u.clock<c;u=s[++l])qh(t,o,u.clock,u.len,n)}}),ab=(t,e)=>{let n=0,s=t.length-1;for(;n<=s;){const r=mn((n+s)/2),o=t[r],a=o.clock;if(a<=e){if(e<a+o.len)return r;n=r+1}else s=r-1}return null},zr=(t,e)=>{const n=t.clients.get(e.client);return n!==void 0&&ab(n,e.clock)!==null},wc=t=>{t.clients.forEach(e=>{e.sort((r,o)=>r.clock-o.clock);let n,s;for(n=1,s=1;n<e.length;n++){const r=e[s-1],o=e[n];r.clock+r.len>=o.clock?e[s-1]=new Zi(r.clock,Ds(r.len,o.clock+o.len-r.clock)):(s<n&&(e[s]=o),s++)}e.length=s})},La=t=>{const e=new ir;for(let n=0;n<t.length;n++)t[n].clients.forEach((s,r)=>{if(!e.clients.has(r)){const o=s.slice();for(let a=n+1;a<t.length;a++)r1(o,t[a].clients.get(r)||[]);e.clients.set(r,o)}});return wc(e),e},Rr=(t,e,n,s)=>{kn(t.clients,e,()=>[]).push(new Zi(n,s))},cb=()=>new ir,lb=t=>{const e=cb();return t.clients.forEach((n,s)=>{const r=[];for(let o=0;o<n.length;o++){const a=n[o];if(a.deleted){const c=a.id.clock;let l=a.length;if(o+1<n.length)for(let u=n[o+1];o+1<n.length&&u.deleted;u=n[++o+1])l+=u.length;r.push(new Zi(c,l))}}r.length>0&&e.clients.set(s,r)}),e},or=(t,e)=>{pe(t.restEncoder,e.clients.size),Mn(e.clients.entries()).sort((n,s)=>s[0]-n[0]).forEach(([n,s])=>{t.resetDsCurVal(),pe(t.restEncoder,n);const r=s.length;pe(t.restEncoder,r);for(let o=0;o<r;o++){const a=s[o];t.writeDsClock(a.clock),t.writeDsLen(a.len)}})},xc=t=>{const e=new ir,n=Te(t.restDecoder);for(let s=0;s<n;s++){t.resetDsCurVal();const r=Te(t.restDecoder),o=Te(t.restDecoder);if(o>0){const a=kn(e.clients,r,()=>[]);for(let c=0;c<o;c++)a.push(new Zi(t.readDsClock(),t.readDsLen()))}}return e},lu=(t,e,n)=>{const s=new ir,r=Te(t.restDecoder);for(let o=0;o<r;o++){t.resetDsCurVal();const a=Te(t.restDecoder),c=Te(t.restDecoder),l=n.clients.get(a)||[],u=wt(n,a);for(let d=0;d<c;d++){const h=t.readDsClock(),D=h+t.readDsLen();if(h<u){u<D&&Rr(s,a,u,D-u);let m=xn(l,h),g=l[m];for(!g.deleted&&g.id.clock<h&&(l.splice(m+1,0,_i(e,g,h-g.id.clock)),m++);m<l.length&&(g=l[m++],g.id.clock<D);)g.deleted||(D<g.id.clock+g.length&&l.splice(m,0,_i(e,g,D-g.id.clock)),g.delete(e))}else Rr(s,a,h,D-h)}}if(s.clients.size>0){const o=new hs;return pe(o.restEncoder,0),or(o,s),o.toUint8Array()}return null},Bh=Zd;class gs extends ac{constructor({guid:e=P1(),collectionid:n=null,gc:s=!0,gcFilter:r=()=>!0,meta:o=null,autoLoad:a=!1,shouldLoad:c=!0}={}){super(),this.gc=s,this.gcFilter=r,this.clientID=Bh(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new Hh,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=c,this.autoLoad=a,this.meta=o,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=Ys(u=>{this.on("load",()=>{this.isLoaded=!0,u(this)})});const l=()=>Ys(u=>{const d=h=>{(h===void 0||h===!0)&&(this.off("sync",d),u())};this.on("sync",d)});this.on("sync",u=>{u===!1&&this.isSynced&&(this.whenSynced=l()),this.isSynced=u===void 0||u===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=l()}load(){const e=this._item;e!==null&&!this.shouldLoad&&nt(e.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(Mn(this.subdocs).map(e=>e.guid))}transact(e,n=null){return nt(this,e,n)}get(e,n=Ot){const s=kn(this.share,e,()=>{const o=new n;return o._integrate(this,null),o}),r=s.constructor;if(n!==Ot&&r!==n)if(r===Ot){const o=new n;o._map=s._map,s._map.forEach(a=>{for(;a!==null;a=a.left)a.parent=o}),o._start=s._start;for(let a=o._start;a!==null;a=a.right)a.parent=o;return o._length=s._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 s}getArray(e=""){return this.get(e,Us)}getText(e=""){return this.get(e,er)}getMap(e=""){return this.get(e,Qs)}getXmlElement(e=""){return this.get(e,tr)}getXmlFragment(e=""){return this.get(e,fs)}toJSON(){const e={};return this.share.forEach((n,s)=>{e[s]=n.toJSON()}),e}destroy(){this.isDestroyed=!0,Mn(this.subdocs).forEach(n=>n.destroy());const e=this._item;if(e!==null){this._item=null;const n=e.content;n.doc=new gs({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=e,nt(e.parent.doc,s=>{const r=n.doc;e.deleted||s.subdocsAdded.add(r),s.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class Lh{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return Te(this.restDecoder)}readDsLen(){return Te(this.restDecoder)}}class Nh extends Lh{readLeftID(){return Oe(Te(this.restDecoder),Te(this.restDecoder))}readRightID(){return Oe(Te(this.restDecoder),Te(this.restDecoder))}readClient(){return Te(this.restDecoder)}readInfo(){return Gs(this.restDecoder)}readString(){return ht(this.restDecoder)}readParentInfo(){return Te(this.restDecoder)===1}readTypeRef(){return Te(this.restDecoder)}readLen(){return Te(this.restDecoder)}readAny(){return Br(this.restDecoder)}readBuf(){return cF($t(this.restDecoder))}readJSON(){return JSON.parse(ht(this.restDecoder))}readKey(){return ht(this.restDecoder)}}class ub{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=Te(this.restDecoder),this.dsCurrVal}readDsLen(){const e=Te(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class Zs extends ub{constructor(e){super(e),this.keys=[],Te(e),this.keyClockDecoder=new $o($t(e)),this.clientDecoder=new mi($t(e)),this.leftClockDecoder=new $o($t(e)),this.rightClockDecoder=new $o($t(e)),this.infoDecoder=new iu($t(e),Gs),this.stringDecoder=new N1($t(e)),this.parentInfoDecoder=new iu($t(e),Gs),this.typeRefDecoder=new mi($t(e)),this.lenDecoder=new mi($t(e))}readLeftID(){return new Ms(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new Ms(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 Br(this.restDecoder)}readBuf(){return $t(this.restDecoder)}readJSON(){return Br(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 Rh{constructor(){this.restEncoder=yt()}toUint8Array(){return et(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){pe(this.restEncoder,e)}writeDsLen(e){pe(this.restEncoder,e)}}class Hr extends Rh{writeLeftID(e){pe(this.restEncoder,e.client),pe(this.restEncoder,e.clock)}writeRightID(e){pe(this.restEncoder,e.client),pe(this.restEncoder,e.clock)}writeClient(e){pe(this.restEncoder,e)}writeInfo(e){ka(this.restEncoder,e)}writeString(e){Mt(this.restEncoder,e)}writeParentInfo(e){pe(this.restEncoder,e?1:0)}writeTypeRef(e){pe(this.restEncoder,e)}writeLen(e){pe(this.restEncoder,e)}writeAny(e){Tr(this.restEncoder,e)}writeBuf(e){bt(this.restEncoder,e)}writeJSON(e){Mt(this.restEncoder,JSON.stringify(e))}writeKey(e){Mt(this.restEncoder,e)}}class Oh{constructor(){this.restEncoder=yt(),this.dsCurrVal=0}toUint8Array(){return et(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const n=e-this.dsCurrVal;this.dsCurrVal=e,pe(this.restEncoder,n)}writeDsLen(e){e===0&&en(),pe(this.restEncoder,e-1),this.dsCurrVal+=e}}class hs extends Oh{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new Mo,this.clientEncoder=new pi,this.leftClockEncoder=new Mo,this.rightClockEncoder=new Mo,this.infoEncoder=new nu(ka),this.stringEncoder=new v1,this.parentInfoEncoder=new nu(ka),this.typeRefEncoder=new pi,this.lenEncoder=new pi}toUint8Array(){const e=yt();return pe(e,0),bt(e,this.keyClockEncoder.toUint8Array()),bt(e,this.clientEncoder.toUint8Array()),bt(e,this.leftClockEncoder.toUint8Array()),bt(e,this.rightClockEncoder.toUint8Array()),bt(e,et(this.infoEncoder)),bt(e,this.stringEncoder.toUint8Array()),bt(e,et(this.parentInfoEncoder)),bt(e,this.typeRefEncoder.toUint8Array()),bt(e,this.lenEncoder.toUint8Array()),qi(e,et(this.restEncoder)),et(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){Tr(this.restEncoder,e)}writeBuf(e){bt(this.restEncoder,e)}writeJSON(e){Tr(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 db=(t,e,n,s)=>{s=Ds(s,e[0].id.clock);const r=xn(e,s);pe(t.restEncoder,e.length-r),t.writeClient(n),pe(t.restEncoder,s);const o=e[r];o.write(t,s-o.id.clock);for(let a=r+1;a<e.length;a++)e[a].write(t,0)},vc=(t,e,n)=>{const s=new Map;n.forEach((r,o)=>{wt(e,o)>r&&s.set(o,r)}),Qi(e).forEach((r,o)=>{n.has(o)||s.set(o,0)}),pe(t.restEncoder,s.size),Mn(s.entries()).sort((r,o)=>o[0]-r[0]).forEach(([r,o])=>{db(t,e.clients.get(r),r,o)})},hb=(t,e)=>{const n=Gt(),s=Te(t.restDecoder);for(let r=0;r<s;r++){const o=Te(t.restDecoder),a=new Array(o),c=t.readClient();let l=Te(t.restDecoder);n.set(c,{i:0,refs:a});for(let u=0;u<o;u++){const d=t.readInfo();switch(Vi&d){case 0:{const h=t.readLen();a[u]=new on(Oe(c,l),h),l+=h;break}case 10:{const h=Te(t.restDecoder);a[u]=new an(Oe(c,l),h),l+=h;break}default:{const h=(d&(_n|Qt))===0,D=new ot(Oe(c,l),null,(d&Qt)===Qt?t.readLeftID():null,null,(d&_n)===_n?t.readRightID():null,h?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,h&&(d&Sr)===Sr?t.readString():null,hf(t,d));a[u]=D,l+=D.length}}}}return n},fb=(t,e,n)=>{const s=[];let r=Mn(n.keys()).sort((m,g)=>m-g);if(r.length===0)return null;const o=()=>{if(r.length===0)return null;let m=n.get(r[r.length-1]);for(;m.refs.length===m.i;)if(r.pop(),r.length>0)m=n.get(r[r.length-1]);else return null;return m};let a=o();if(a===null)return null;const c=new Hh,l=new Map,u=(m,g)=>{const y=l.get(m);(y==null||y>g)&&l.set(m,g)};let d=a.refs[a.i++];const h=new Map,D=()=>{for(const m of s){const g=m.id.client,y=n.get(g);y?(y.i--,c.clients.set(g,y.refs.slice(y.i)),n.delete(g),y.i=0,y.refs=[]):c.clients.set(g,[m]),r=r.filter(b=>b!==g)}s.length=0};for(;;){if(d.constructor!==an){const g=kn(h,d.id.client,()=>wt(e,d.id.client))-d.id.clock;if(g<0)s.push(d),u(d.id.client,d.id.clock-1),D();else{const y=d.getMissing(t,e);if(y!==null){s.push(d);const b=n.get(y)||{refs:[],i:0};if(b.refs.length===b.i)u(y,wt(e,y)),D();else{d=b.refs[b.i++];continue}}else(g===0||g<d.length)&&(d.integrate(t,g),h.set(d.id.client,d.id.clock+d.length))}}if(s.length>0)d=s.pop();else if(a!==null&&a.i<a.refs.length)d=a.refs[a.i++];else{if(a=o(),a===null)break;d=a.refs[a.i++]}}if(c.clients.size>0){const m=new hs;return vc(m,c,new Map),pe(m.restEncoder,0),{missing:l,update:m.toUint8Array()}}return null},pb=(t,e)=>vc(t,e.doc.store,e.beforeState),mb=(t,e,n,s=new Zs(t))=>nt(e,r=>{r.local=!1;let o=!1;const a=r.doc,c=a.store,l=hb(s,a),u=fb(r,c,l),d=c.pendingStructs;if(d){for(const[D,m]of d.missing)if(m<wt(c,D)){o=!0;break}if(u){for(const[D,m]of u.missing){const g=d.missing.get(D);(g==null||g>m)&&d.missing.set(D,m)}d.update=Bi([d.update,u.update])}}else c.pendingStructs=u;const h=lu(s,r,c);if(c.pendingDs){const D=new Zs(ns(c.pendingDs));Te(D.restDecoder);const m=lu(D,r,c);h&&m?c.pendingDs=Bi([h,m]):c.pendingDs=h||m}else c.pendingDs=h;if(o){const D=c.pendingStructs.update;c.pendingStructs=null,Ph(r.doc,D)}},n,!1),Ph=(t,e,n,s=Zs)=>{const r=ns(e);mb(r,t,n,new s(r))},_h=(t,e,n)=>Ph(t,e,n,Nh),Db=(t,e,n=new Map)=>{vc(t,e.store,n),or(t,lb(e.store))},gb=(t,e=new Uint8Array([0]),n=new hs)=>{const s=Ih(e);Db(n,t,s);const r=[n.toUint8Array()];if(t.store.pendingDs&&r.push(t.store.pendingDs),t.store.pendingStructs&&r.push(Pb(t.store.pendingStructs.update,e)),r.length>1){if(n.constructor===Hr)return Rb(r.map((o,a)=>a===0?o:Ib(o)));if(n.constructor===hs)return Bi(r)}return r[0]},Ac=(t,e)=>gb(t,e,new Hr),Fb=t=>{const e=new Map,n=Te(t.restDecoder);for(let s=0;s<n;s++){const r=Te(t.restDecoder),o=Te(t.restDecoder);e.set(r,o)}return e},Ih=t=>Fb(new Lh(ns(t))),Mh=(t,e)=>(pe(t.restEncoder,e.size),Mn(e.entries()).sort((n,s)=>s[0]-n[0]).forEach(([n,s])=>{pe(t.restEncoder,n),pe(t.restEncoder,s)}),t),bb=(t,e)=>Mh(t,Qi(e.store)),yb=(t,e=new Oh)=>(t instanceof Map?Mh(e,t):bb(e,t),e.toUint8Array()),Cb=t=>yb(t,new Rh);class Eb{constructor(){this.l=[]}}const uu=()=>new Eb,du=(t,e)=>t.l.push(e),hu=(t,e)=>{const n=t.l,s=n.length;t.l=n.filter(r=>e!==r),s===t.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},$h=(t,e,n)=>Dc(t.l,[e,n]);class Ms{constructor(e,n){this.client=e,this.clock=n}}const Rs=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,Oe=(t,e)=>new Ms(t,e),Uh=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw en()},Ti=(t,e)=>{for(;e!==null;){if(e.parent===t)return!0;e=e.parent._item}return!1};class zh{constructor(e,n,s,r=0){this.type=e,this.tname=n,this.item=s,this.assoc=r}}const dC=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},hC=t=>new zh(t.type==null?null:Oe(t.type.client,t.type.clock),t.tname??null,t.item==null?null:Oe(t.item.client,t.item.clock),t.assoc==null?0:t.assoc);class wb{constructor(e,n,s=0){this.type=e,this.index=n,this.assoc=s}}const xb=(t,e,n=0)=>new wb(t,e,n),ci=(t,e,n)=>{let s=null,r=null;return t._item===null?r=Uh(t):s=Oe(t._item.id.client,t._item.id.clock),new zh(s,r,e,n)},fC=(t,e,n=0)=>{let s=t._start;if(n<0){if(e===0)return ci(t,null,n);e--}for(;s!==null;){if(!s.deleted&&s.countable){if(s.length>e)return ci(t,Oe(s.id.client,s.id.clock+e),n);e-=s.length}if(s.right===null&&n<0)return ci(t,s.lastId,n);s=s.right}return ci(t,null,n)},vb=(t,e)=>{const n=$s(t,e),s=e.clock-n.id.clock;return{item:n,diff:s}},pC=(t,e,n=!0)=>{const s=e.store,r=t.item,o=t.type,a=t.tname,c=t.assoc;let l=null,u=0;if(r!==null){if(wt(s,r.client)<=r.clock)return null;const d=n?Pa(s,r):vb(s,r),h=d.item;if(!(h instanceof ot))return null;if(l=h.parent,l._item===null||!l._item.deleted){u=h.deleted||!h.countable?0:d.diff+(c>=0?0:1);let D=h.left;for(;D!==null;)!D.deleted&&D.countable&&(u+=D.length),D=D.left}}else{if(a!==null)l=e.get(a);else if(o!==null){if(wt(s,o.client)<=o.clock)return null;const{item:d}=n?Pa(s,o):{item:$s(s,o)};if(d instanceof ot&&d.content instanceof jn)l=d.content.type;else return null}else throw en();c>=0?u=l._length:u=0}return xb(l,u,t.assoc)},mC=(t,e)=>t===e||t!==null&&e!==null&&t.tname===e.tname&&Rs(t.item,e.item)&&Rs(t.type,e.type)&&t.assoc===e.assoc,Bs=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!zr(e.ds,t.id),Na=(t,e)=>{const n=kn(t.meta,Na,Zn),s=t.doc.store;n.has(e)||(e.sv.forEach((r,o)=>{r<wt(s,o)&&Kt(t,Oe(o,r))}),Js(t,e.ds,r=>{}),n.add(e))};class Hh{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const Qi=t=>{const e=new Map;return t.clients.forEach((n,s)=>{const r=n[n.length-1];e.set(s,r.id.clock+r.length)}),e},wt=(t,e)=>{const n=t.clients.get(e);if(n===void 0)return 0;const s=n[n.length-1];return s.id.clock+s.length},Vh=(t,e)=>{let n=t.clients.get(e.id.client);if(n===void 0)n=[],t.clients.set(e.id.client,n);else{const s=n[n.length-1];if(s.id.clock+s.length!==e.id.clock)throw en()}n.push(e)},xn=(t,e)=>{let n=0,s=t.length-1,r=t[s],o=r.id.clock;if(o===e)return s;let a=mn(e/(o+r.length-1)*s);for(;n<=s;){if(r=t[a],o=r.id.clock,o<=e){if(e<o+r.length)return a;n=a+1}else s=a-1;a=mn((n+s)/2)}throw en()},Ab=(t,e)=>{const n=t.clients.get(e.client);return n[xn(n,e.clock)]},$s=Ab,Ra=(t,e,n)=>{const s=xn(e,n),r=e[s];return r.id.clock<n&&r instanceof ot?(e.splice(s+1,0,_i(t,r,n-r.id.clock)),s+1):s},Kt=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[Ra(t,n,e.clock)]},fu=(t,e,n)=>{const s=e.clients.get(n.client),r=xn(s,n.clock),o=s[r];return n.clock!==o.id.clock+o.length-1&&o.constructor!==on&&s.splice(r+1,0,_i(t,o,n.clock-o.id.clock+1)),o},kb=(t,e,n)=>{const s=t.clients.get(e.id.client);s[xn(s,e.id.clock)]=n},qh=(t,e,n,s,r)=>{if(s===0)return;const o=n+s;let a=Ra(t,e,n),c;do c=e[a++],o<c.id.clock+c.length&&Ra(t,e,o),r(c);while(a<e.length&&e[a].id.clock<o)};class Sb{constructor(e,n,s){this.doc=e,this.deleteSet=new ir,this.beforeState=Qi(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=s,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const pu=(t,e)=>e.deleteSet.clients.size===0&&!s1(e.afterState,(n,s)=>e.beforeState.get(s)!==n)?!1:(wc(e.deleteSet),pb(t,e),or(t,e.deleteSet),!0),mu=(t,e,n)=>{const s=e._item;(s===null||s.id.clock<(t.beforeState.get(s.id.client)||0)&&!s.deleted)&&kn(t.changed,e,Zn).add(n)},Di=(t,e)=>{let n=t[e],s=t[e-1],r=e;for(;r>0;n=s,s=t[--r-1]){if(s.deleted===n.deleted&&s.constructor===n.constructor&&s.mergeWith(n)){n instanceof ot&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,s);continue}break}const o=e-r;return o&&t.splice(e+1-o,o),o},jb=(t,e,n)=>{for(const[s,r]of t.clients.entries()){const o=e.clients.get(s);for(let a=r.length-1;a>=0;a--){const c=r[a],l=c.clock+c.len;for(let u=xn(o,c.clock),d=o[u];u<o.length&&d.id.clock<l;d=o[++u]){const h=o[u];if(c.clock+c.len<=h.id.clock)break;h instanceof ot&&h.deleted&&!h.keep&&n(h)&&h.gc(e,!1)}}}},Tb=(t,e)=>{t.clients.forEach((n,s)=>{const r=e.clients.get(s);for(let o=n.length-1;o>=0;o--){const a=n[o],c=cc(r.length-1,1+xn(r,a.clock+a.len-1));for(let l=c,u=r[l];l>0&&u.id.clock>=a.clock;u=r[l])l-=1+Di(r,l)}})},Wh=(t,e)=>{if(e<t.length){const n=t[e],s=n.doc,r=s.store,o=n.deleteSet,a=n._mergeStructs;try{wc(o),n.afterState=Qi(n.doc.store),s.emit("beforeObserverCalls",[n,s]);const c=[];n.changed.forEach((l,u)=>c.push(()=>{(u._item===null||!u._item.deleted)&&u._callObserver(n,l)})),c.push(()=>{n.changedParentTypes.forEach((l,u)=>{u._dEH.l.length>0&&(u._item===null||!u._item.deleted)&&(l=l.filter(d=>d.target._item===null||!d.target._item.deleted),l.forEach(d=>{d.currentTarget=u,d._path=null}),l.sort((d,h)=>d.path.length-h.path.length),c.push(()=>{$h(u._dEH,l,n)}))}),c.push(()=>s.emit("afterTransaction",[n,s])),c.push(()=>{n._needFormattingCleanup&&Zb(n)})}),Dc(c,[])}finally{s.gc&&jb(o,r,s.gcFilter),Tb(o,r),n.afterState.forEach((d,h)=>{const D=n.beforeState.get(h)||0;if(D!==d){const m=r.clients.get(h),g=Ds(xn(m,D),1);for(let y=m.length-1;y>=g;)y-=1+Di(m,y)}});for(let d=a.length-1;d>=0;d--){const{client:h,clock:D}=a[d].id,m=r.clients.get(h),g=xn(m,D);g+1<m.length&&Di(m,g+1)>1||g>0&&Di(m,g)}if(!n.local&&n.afterState.get(s.clientID)!==n.beforeState.get(s.clientID)&&(ib(Ec,xh,"[yjs] ",vh,Ah,"Changed the client-id because another client seems to be using it."),s.clientID=Bh()),s.emit("afterTransactionCleanup",[n,s]),s._observers.has("update")){const d=new Hr;pu(d,n)&&s.emit("update",[d.toUint8Array(),n.origin,s,n])}if(s._observers.has("updateV2")){const d=new hs;pu(d,n)&&s.emit("updateV2",[d.toUint8Array(),n.origin,s,n])}const{subdocsAdded:c,subdocsLoaded:l,subdocsRemoved:u}=n;(c.size>0||u.size>0||l.size>0)&&(c.forEach(d=>{d.clientID=s.clientID,d.collectionid==null&&(d.collectionid=s.collectionid),s.subdocs.add(d)}),u.forEach(d=>s.subdocs.delete(d)),s.emit("subdocs",[{loaded:l,added:c,removed:u},s,n]),u.forEach(d=>d.destroy())),t.length<=e+1?(s._transactionCleanups=[],s.emit("afterAllTransactions",[s,t])):Wh(t,e+1)}}},nt=(t,e,n=null,s=!0)=>{const r=t._transactionCleanups;let o=!1,a=null;t._transaction===null&&(o=!0,t._transaction=new Sb(t,n,s),r.push(t._transaction),r.length===1&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{a=e(t._transaction)}finally{if(o){const c=t._transaction===r[0];t._transaction=null,c&&Wh(r,0)}}return a};class Bb{constructor(e,n){this.insertions=n,this.deletions=e,this.meta=new Map}}const Du=(t,e,n)=>{Js(t,n.deletions,s=>{s instanceof ot&&e.scope.some(r=>r===t.doc||Ti(r,s))&&Rc(s,!1)})},gu=(t,e,n)=>{let s=null;const r=t.doc,o=t.scope;nt(r,c=>{for(;e.length>0&&t.currStackItem===null;){const l=r.store,u=e.pop(),d=new Set,h=[];let D=!1;Js(c,u.insertions,m=>{if(m instanceof ot){if(m.redone!==null){let{item:g,diff:y}=Pa(l,m.id);y>0&&(g=Kt(c,Oe(g.id.client,g.id.clock+y))),m=g}!m.deleted&&o.some(g=>g===c.doc||Ti(g,m))&&h.push(m)}}),Js(c,u.deletions,m=>{m instanceof ot&&o.some(g=>g===c.doc||Ti(g,m))&&!zr(u.insertions,m.id)&&d.add(m)}),d.forEach(m=>{D=df(c,m,d,u.insertions,t.ignoreRemoteMapChanges,t)!==null||D});for(let m=h.length-1;m>=0;m--){const g=h[m];t.deleteFilter(g)&&(g.delete(c),D=!0)}t.currStackItem=D?u:null}c.changed.forEach((l,u)=>{l.has(null)&&u._searchMarker&&(u._searchMarker.length=0)}),s=c},t);const a=t.currStackItem;if(a!=null){const c=s.changedParentTypes;t.emit("stack-item-popped",[{stackItem:a,type:n,changedParentTypes:c,origin:t},t]),t.currStackItem=null}return a};class Lb extends ac{constructor(e,{captureTimeout:n=500,captureTransaction:s=l=>!0,deleteFilter:r=()=>!0,trackedOrigins:o=new Set([null]),ignoreRemoteMapChanges:a=!1,doc:c=Ks(e)?e[0].doc:e instanceof gs?e:e.doc}={}){super(),this.scope=[],this.doc=c,this.addToScope(e),this.deleteFilter=r,o.add(this),this.trackedOrigins=o,this.captureTransaction=s,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=a,this.captureTimeout=n,this.afterTransactionHandler=l=>{if(!this.captureTransaction(l)||!this.scope.some(b=>l.changedParentTypes.has(b)||b===this.doc)||!this.trackedOrigins.has(l.origin)&&(!l.origin||!this.trackedOrigins.has(l.origin.constructor)))return;const u=this.undoing,d=this.redoing,h=u?this.redoStack:this.undoStack;u?this.stopCapturing():d||this.clear(!1,!0);const D=new ir;l.afterState.forEach((b,w)=>{const v=l.beforeState.get(w)||0,j=b-v;j>0&&Rr(D,w,v,j)});const m=Qn();let g=!1;if(this.lastChange>0&&m-this.lastChange<this.captureTimeout&&h.length>0&&!u&&!d){const b=h[h.length-1];b.deletions=La([b.deletions,l.deleteSet]),b.insertions=La([b.insertions,D])}else h.push(new Bb(l.deleteSet,D)),g=!0;!u&&!d&&(this.lastChange=m),Js(l,l.deleteSet,b=>{b instanceof ot&&this.scope.some(w=>w===l.doc||Ti(w,b))&&Rc(b,!0)});const y=[{stackItem:h[h.length-1],origin:l.origin,type:u?"redo":"undo",changedParentTypes:l.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=Ks(e)?e:[e],e.forEach(s=>{n.has(s)||(n.add(s),(s instanceof Ot?s.doc!==this.doc:s!==this.doc)&&Sh("[yjs#509] Not same Y.Doc"),this.scope.push(s))})}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(s=>{e&&(this.undoStack.forEach(r=>Du(s,this,r)),this.undoStack=[]),n&&(this.redoStack.forEach(r=>Du(s,this,r)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:e,redoStackCleared:n}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=gu(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=gu(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*Nb(t){const e=Te(t.restDecoder);for(let n=0;n<e;n++){const s=Te(t.restDecoder),r=t.readClient();let o=Te(t.restDecoder);for(let a=0;a<s;a++){const c=t.readInfo();if(c===10){const l=Te(t.restDecoder);yield new an(Oe(r,o),l),o+=l}else if((Vi&c)!==0){const l=(c&(_n|Qt))===0,u=new ot(Oe(r,o),null,(c&Qt)===Qt?t.readLeftID():null,null,(c&_n)===_n?t.readRightID():null,l?t.readParentInfo()?t.readString():t.readLeftID():null,l&&(c&Sr)===Sr?t.readString():null,hf(t,c));yield u,o+=u.length}else{const l=t.readLen();yield new on(Oe(r,o),l),o+=l}}}}class kc{constructor(e,n){this.gen=Nb(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===an);return this.curr}}class Sc{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const Rb=t=>Bi(t,Nh,Hr),Ob=(t,e)=>{if(t.constructor===on){const{client:n,clock:s}=t.id;return new on(Oe(n,s+e),t.length-e)}else if(t.constructor===an){const{client:n,clock:s}=t.id;return new an(Oe(n,s+e),t.length-e)}else{const n=t,{client:s,clock:r}=n.id;return new ot(Oe(s,r+e),null,Oe(s,r+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},Bi=(t,e=Zs,n=hs)=>{if(t.length===1)return t[0];const s=t.map(d=>new e(ns(d)));let r=s.map(d=>new kc(d,!0)),o=null;const a=new n,c=new Sc(a);for(;r=r.filter(D=>D.curr!==null),r.sort((D,m)=>{if(D.curr.id.client===m.curr.id.client){const g=D.curr.id.clock-m.curr.id.clock;return g===0?D.curr.constructor===m.curr.constructor?0:D.curr.constructor===an?1:-1:g}else return m.curr.id.client-D.curr.id.client}),r.length!==0;){const d=r[0],h=d.curr.id.client;if(o!==null){let D=d.curr,m=!1;for(;D!==null&&D.id.clock+D.length<=o.struct.id.clock+o.struct.length&&D.id.client>=o.struct.id.client;)D=d.next(),m=!0;if(D===null||D.id.client!==h||m&&D.id.clock>o.struct.id.clock+o.struct.length)continue;if(h!==o.struct.id.client)Wn(c,o.struct,o.offset),o={struct:D,offset:0},d.next();else if(o.struct.id.clock+o.struct.length<D.id.clock)if(o.struct.constructor===an)o.struct.length=D.id.clock+D.length-o.struct.id.clock;else{Wn(c,o.struct,o.offset);const g=D.id.clock-o.struct.id.clock-o.struct.length;o={struct:new an(Oe(h,o.struct.id.clock+o.struct.length),g),offset:0}}else{const g=o.struct.id.clock+o.struct.length-D.id.clock;g>0&&(o.struct.constructor===an?o.struct.length-=g:D=Ob(D,g)),o.struct.mergeWith(D)||(Wn(c,o.struct,o.offset),o={struct:D,offset:0},d.next())}}else o={struct:d.curr,offset:0},d.next();for(let D=d.curr;D!==null&&D.id.client===h&&D.id.clock===o.struct.id.clock+o.struct.length&&D.constructor!==an;D=d.next())Wn(c,o.struct,o.offset),o={struct:D,offset:0}}o!==null&&(Wn(c,o.struct,o.offset),o=null),jc(c);const l=s.map(d=>xc(d)),u=La(l);return or(a,u),a.toUint8Array()},Pb=(t,e,n=Zs,s=hs)=>{const r=Ih(e),o=new s,a=new Sc(o),c=new n(ns(t)),l=new kc(c,!1);for(;l.curr;){const d=l.curr,h=d.id.client,D=r.get(h)||0;if(l.curr.constructor===an){l.next();continue}if(d.id.clock+d.length>D)for(Wn(a,d,Ds(D-d.id.clock,0)),l.next();l.curr&&l.curr.id.client===h;)Wn(a,l.curr,0),l.next();else for(;l.curr&&l.curr.id.client===h&&l.curr.id.clock+l.curr.length<=D;)l.next()}jc(a);const u=xc(c);return or(o,u),o.toUint8Array()},Kh=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:et(t.encoder.restEncoder)}),t.encoder.restEncoder=yt(),t.written=0)},Wn=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&Kh(t),t.written===0&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),pe(t.encoder.restEncoder,e.id.clock+n)),e.write(t.encoder,n),t.written++},jc=t=>{Kh(t);const e=t.encoder.restEncoder;pe(e,t.clientStructs.length);for(let n=0;n<t.clientStructs.length;n++){const s=t.clientStructs[n];pe(e,s.written),qi(e,s.restEncoder)}},_b=(t,e,n,s)=>{const r=new n(ns(t)),o=new kc(r,!1),a=new s,c=new Sc(a);for(let u=o.curr;u!==null;u=o.next())Wn(c,e(u),0);jc(c);const l=xc(r);return or(a,l),a.toUint8Array()},Ib=t=>_b(t,G1,Zs,Hr),Fu="You must not compute changes after the event-handler fired.";class eo{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=Mb(this.currentTarget,this.target))}deletes(e){return zr(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Dn(Fu);const e=new Map,n=this.target;this.transaction.changed.get(n).forEach(r=>{if(r!==null){const o=n._map.get(r);let a,c;if(this.adds(o)){let l=o.left;for(;l!==null&&this.adds(l);)l=l.left;if(this.deletes(o))if(l!==null&&this.deletes(l))a="delete",c=Po(l.content.getContent());else return;else l!==null&&this.deletes(l)?(a="update",c=Po(l.content.getContent())):(a="add",c=void 0)}else if(this.deletes(o))a="delete",c=Po(o.content.getContent());else return;e.set(r,{action:a,oldValue:c})}}),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 Dn(Fu);const n=this.target,s=Zn(),r=Zn(),o=[];if(e={added:s,deleted:r,delta:o,keys:this.keys},this.transaction.changed.get(n).has(null)){let c=null;const l=()=>{c&&o.push(c)};for(let u=n._start;u!==null;u=u.right)u.deleted?this.deletes(u)&&!this.adds(u)&&((c===null||c.delete===void 0)&&(l(),c={delete:0}),c.delete+=u.length,r.add(u)):this.adds(u)?((c===null||c.insert===void 0)&&(l(),c={insert:[]}),c.insert=c.insert.concat(u.content.getContent()),s.add(u)):((c===null||c.retain===void 0)&&(l(),c={retain:0}),c.retain+=u.length);c!==null&&c.retain===void 0&&l()}this._changes=e}return e}}const Mb=(t,e)=>{const n=[];for(;e._item!==null&&e!==t;){if(e._item.parentSub!==null)n.unshift(e._item.parentSub);else{let s=0,r=e._item.parent._start;for(;r!==e._item&&r!==null;)!r.deleted&&r.countable&&(s+=r.length),r=r.right;n.unshift(s)}e=e._item.parent}return n},Ut=()=>{Sh("Invalid access: Add Yjs type to a document before reading data.")},Gh=80;let Tc=0;class $b{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=Tc++}}const Ub=t=>{t.timestamp=Tc++},Yh=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=Tc++},zb=(t,e,n)=>{if(t.length>=Gh){const s=t.reduce((r,o)=>r.timestamp<o.timestamp?r:o);return Yh(s,e,n),s}else{const s=new $b(e,n);return t.push(s),s}},to=(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)=>fi(e-o.index)<fi(e-a.index)?o:a);let s=t._start,r=0;for(n!==null&&(s=n.p,r=n.index,Ub(n));s.right!==null&&r<e;){if(!s.deleted&&s.countable){if(e<r+s.length)break;r+=s.length}s=s.right}for(;s.left!==null&&r>e;)s=s.left,!s.deleted&&s.countable&&(r-=s.length);for(;s.left!==null&&s.left.id.client===s.id.client&&s.left.id.clock+s.left.length===s.id.clock;)s=s.left,!s.deleted&&s.countable&&(r-=s.length);return n!==null&&fi(n.index-r)<s.parent.length/Gh?(Yh(n,s,r),n):zb(t._searchMarker,s,r)},Or=(t,e,n)=>{for(let s=t.length-1;s>=0;s--){const r=t[s];if(n>0){let o=r.p;for(o.marker=!1;o&&(o.deleted||!o.countable);)o=o.left,o&&!o.deleted&&o.countable&&(r.index-=o.length);if(o===null||o.marker===!0){t.splice(s,1);continue}r.p=o,o.marker=!0}(e<r.index||n>0&&e===r.index)&&(r.index=Ds(e,r.index+n))}},no=(t,e,n)=>{const s=t,r=e.changedParentTypes;for(;kn(r,t,()=>[]).push(n),t._item!==null;)t=t._item.parent;$h(s._eH,n,e)};class Ot{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=uu(),this._dEH=uu(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,n){this.doc=e,this._item=n}_copy(){throw pn()}clone(){throw pn()}_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){du(this._eH,e)}observeDeep(e){du(this._dEH,e)}unobserve(e){hu(this._eH,e)}unobserveDeep(e){hu(this._dEH,e)}toJSON(){}}const Xh=(t,e,n)=>{t.doc??Ut(),e<0&&(e=t._length+e),n<0&&(n=t._length+n);let s=n-e;const r=[];let o=t._start;for(;o!==null&&s>0;){if(o.countable&&!o.deleted){const a=o.content.getContent();if(a.length<=e)e-=a.length;else{for(let c=e;c<a.length&&s>0;c++)r.push(a[c]),s--;e=0}}o=o.right}return r},Jh=t=>{t.doc??Ut();const e=[];let n=t._start;for(;n!==null;){if(n.countable&&!n.deleted){const s=n.content.getContent();for(let r=0;r<s.length;r++)e.push(s[r])}n=n.right}return e},Pr=(t,e)=>{let n=0,s=t._start;for(t.doc??Ut();s!==null;){if(s.countable&&!s.deleted){const r=s.content.getContent();for(let o=0;o<r.length;o++)e(r[o],n++,t)}s=s.right}},Zh=(t,e)=>{const n=[];return Pr(t,(s,r)=>{n.push(e(s,r,t))}),n},Hb=t=>{let e=t._start,n=null,s=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(),s=0,e=e.right}const r=n[s++];return n.length<=s&&(n=null),{done:!1,value:r}}}},Qh=(t,e)=>{t.doc??Ut();const n=to(t,e);let s=t._start;for(n!==null&&(s=n.p,e-=n.index);s!==null;s=s.right)if(!s.deleted&&s.countable){if(e<s.length)return s.content.getContent()[e];e-=s.length}},Li=(t,e,n,s)=>{let r=n;const o=t.doc,a=o.clientID,c=o.store,l=n===null?e._start:n.right;let u=[];const d=()=>{u.length>0&&(r=new ot(Oe(a,wt(c,a)),r,r&&r.lastId,l,l&&l.id,e,null,new ps(u)),r.integrate(t,0),u=[])};s.forEach(h=>{if(h===null)u.push(h);else switch(h.constructor){case Number:case Object:case Boolean:case Array:case String:u.push(h);break;default:switch(d(),h.constructor){case Uint8Array:case ArrayBuffer:r=new ot(Oe(a,wt(c,a)),r,r&&r.lastId,l,l&&l.id,e,null,new Vr(new Uint8Array(h))),r.integrate(t,0);break;case gs:r=new ot(Oe(a,wt(c,a)),r,r&&r.lastId,l,l&&l.id,e,null,new qr(h)),r.integrate(t,0);break;default:if(h instanceof Ot)r=new ot(Oe(a,wt(c,a)),r,r&&r.lastId,l,l&&l.id,e,null,new jn(h)),r.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),d()},ef=()=>Dn("Length exceeded!"),tf=(t,e,n,s)=>{if(n>e._length)throw ef();if(n===0)return e._searchMarker&&Or(e._searchMarker,n,s.length),Li(t,e,null,s);const r=n,o=to(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&&Kt(t,Oe(a.id.client,a.id.clock+n));break}n-=a.length}return e._searchMarker&&Or(e._searchMarker,r,s.length),Li(t,e,a,s)},Vb=(t,e,n)=>{let r=(e._searchMarker||[]).reduce((o,a)=>a.index>o.index?a:o,{index:0,p:e._start}).p;if(r)for(;r.right;)r=r.right;return Li(t,e,r,n)},nf=(t,e,n,s)=>{if(s===0)return;const r=n,o=s,a=to(e,n);let c=e._start;for(a!==null&&(c=a.p,n-=a.index);c!==null&&n>0;c=c.right)!c.deleted&&c.countable&&(n<c.length&&Kt(t,Oe(c.id.client,c.id.clock+n)),n-=c.length);for(;s>0&&c!==null;)c.deleted||(s<c.length&&Kt(t,Oe(c.id.client,c.id.clock+s)),c.delete(t),s-=c.length),c=c.right;if(s>0)throw ef();e._searchMarker&&Or(e._searchMarker,r,-o+s)},Ni=(t,e,n)=>{const s=e._map.get(n);s!==void 0&&s.delete(t)},Bc=(t,e,n,s)=>{const r=e._map.get(n)||null,o=t.doc,a=o.clientID;let c;if(s==null)c=new ps([s]);else switch(s.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:c=new ps([s]);break;case Uint8Array:c=new Vr(s);break;case gs:c=new qr(s);break;default:if(s instanceof Ot)c=new jn(s);else throw new Error("Unexpected content type")}new ot(Oe(a,wt(o.store,a)),r,r&&r.lastId,null,null,e,n,c).integrate(t,0)},Lc=(t,e)=>{t.doc??Ut();const n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},sf=t=>{const e={};return t.doc??Ut(),t._map.forEach((n,s)=>{n.deleted||(e[s]=n.content.getContent()[n.length-1])}),e},rf=(t,e)=>{t.doc??Ut();const n=t._map.get(e);return n!==void 0&&!n.deleted},qb=(t,e)=>{const n={};return t._map.forEach((s,r)=>{let o=s;for(;o!==null&&(!e.sv.has(o.id.client)||o.id.clock>=(e.sv.get(o.id.client)||0));)o=o.left;o!==null&&Bs(o,e)&&(n[r]=o.content.getContent()[o.length-1])}),n},li=t=>(t.doc??Ut(),ob(t._map.entries(),e=>!e[1].deleted));class Wb extends eo{}class Us extends Ot{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const n=new Us;return n.push(e),n}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Us}clone(){const e=new Us;return e.insert(0,this.toArray().map(n=>n instanceof Ot?n.clone():n)),e}get length(){return this.doc??Ut(),this._length}_callObserver(e,n){super._callObserver(e,n),no(this,e,new Wb(this,e))}insert(e,n){this.doc!==null?nt(this.doc,s=>{tf(s,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?nt(this.doc,n=>{Vb(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?nt(this.doc,s=>{nf(s,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return Qh(this,e)}toArray(){return Jh(this)}slice(e=0,n=this.length){return Xh(this,e,n)}toJSON(){return this.map(e=>e instanceof Ot?e.toJSON():e)}map(e){return Zh(this,e)}forEach(e){Pr(this,e)}[Symbol.iterator](){return Hb(this)}_write(e){e.writeTypeRef(gy)}}const Kb=t=>new Us;class Gb extends eo{constructor(e,n,s){super(e,n),this.keysChanged=s}}class Qs extends Ot{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((s,r)=>{this.set(r,s)}),this._prelimContent=null}_copy(){return new Qs}clone(){const e=new Qs;return this.forEach((n,s)=>{e.set(s,n instanceof Ot?n.clone():n)}),e}_callObserver(e,n){no(this,e,new Gb(this,e,n))}toJSON(){this.doc??Ut();const e={};return this._map.forEach((n,s)=>{if(!n.deleted){const r=n.content.getContent()[n.length-1];e[s]=r instanceof Ot?r.toJSON():r}}),e}get size(){return[...li(this)].length}keys(){return Ho(li(this),e=>e[0])}values(){return Ho(li(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return Ho(li(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??Ut(),this._map.forEach((n,s)=>{n.deleted||e(n.content.getContent()[n.length-1],s,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?nt(this.doc,n=>{Ni(n,this,e)}):this._prelimContent.delete(e)}set(e,n){return this.doc!==null?nt(this.doc,s=>{Bc(s,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return Lc(this,e)}has(e){return rf(this,e)}clear(){this.doc!==null?nt(this.doc,e=>{this.forEach(function(n,s,r){Ni(e,r,s)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(Fy)}}const Yb=t=>new Qs,Kn=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&W1(t,e);class Oa{constructor(e,n,s,r){this.left=e,this.right=n,this.index=s,this.currentAttributes=r}forward(){this.right===null&&en(),this.right.content.constructor===Tt?this.right.deleted||ar(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}}const bu=(t,e,n)=>{for(;e.right!==null&&n>0;)e.right.content.constructor===Tt?e.right.deleted||ar(e.currentAttributes,e.right.content):e.right.deleted||(n<e.right.length&&Kt(t,Oe(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},ui=(t,e,n,s)=>{const r=new Map,o=s?to(e,n):null;if(o){const a=new Oa(o.p.left,o.p,o.index,r);return bu(t,a,n-o.index)}else{const a=new Oa(null,e._start,0,r);return bu(t,a,n)}},of=(t,e,n,s)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===Tt&&Kn(s.get(n.right.content.key),n.right.content.value));)n.right.deleted||s.delete(n.right.content.key),n.forward();const r=t.doc,o=r.clientID;s.forEach((a,c)=>{const l=n.left,u=n.right,d=new ot(Oe(o,wt(r.store,o)),l,l&&l.lastId,u,u&&u.id,e,null,new Tt(c,a));d.integrate(t,0),n.right=d,n.forward()})},ar=(t,e)=>{const{key:n,value:s}=e;s===null?t.delete(n):t.set(n,s)},af=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===Tt&&Kn(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},cf=(t,e,n,s)=>{const r=t.doc,o=r.clientID,a=new Map;for(const c in s){const l=s[c],u=n.currentAttributes.get(c)??null;if(!Kn(u,l)){a.set(c,u);const{left:d,right:h}=n;n.right=new ot(Oe(o,wt(r.store,o)),d,d&&d.lastId,h,h&&h.id,e,null,new Tt(c,l)),n.right.integrate(t,0),n.forward()}}return a},Vo=(t,e,n,s,r)=>{n.currentAttributes.forEach((D,m)=>{r[m]===void 0&&(r[m]=null)});const o=t.doc,a=o.clientID;af(n,r);const c=cf(t,e,n,r),l=s.constructor===String?new vn(s):s instanceof Ot?new jn(s):new Fs(s);let{left:u,right:d,index:h}=n;e._searchMarker&&Or(e._searchMarker,n.index,l.getLength()),d=new ot(Oe(a,wt(o.store,a)),u,u&&u.lastId,d,d&&d.id,e,null,l),d.integrate(t,0),n.right=d,n.index=h,n.forward(),of(t,e,n,c)},yu=(t,e,n,s,r)=>{const o=t.doc,a=o.clientID;af(n,r);const c=cf(t,e,n,r);e:for(;n.right!==null&&(s>0||c.size>0&&(n.right.deleted||n.right.content.constructor===Tt));){if(!n.right.deleted)switch(n.right.content.constructor){case Tt:{const{key:l,value:u}=n.right.content,d=r[l];if(d!==void 0){if(Kn(d,u))c.delete(l);else{if(s===0)break e;c.set(l,u)}n.right.delete(t)}else n.currentAttributes.set(l,u);break}default:s<n.right.length&&Kt(t,Oe(n.right.id.client,n.right.id.clock+s)),s-=n.right.length;break}n.forward()}if(s>0){let l="";for(;s>0;s--)l+=`
45
- `;n.right=new ot(Oe(a,wt(o.store,a)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new vn(l)),n.right.integrate(t,0),n.forward()}of(t,e,n,c)},lf=(t,e,n,s,r)=>{let o=e;const a=Gt();for(;o&&(!o.countable||o.deleted);){if(!o.deleted&&o.content.constructor===Tt){const u=o.content;a.set(u.key,u)}o=o.right}let c=0,l=!1;for(;e!==o;){if(n===e&&(l=!0),!e.deleted){const u=e.content;if(u.constructor===Tt){const{key:d,value:h}=u,D=s.get(d)??null;(a.get(d)!==u||D===h)&&(e.delete(t),c++,!l&&(r.get(d)??null)===h&&D!==h&&(D===null?r.delete(d):r.set(d,D))),!l&&!e.deleted&&ar(r,u)}}e=e.right}return c},Xb=(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===Tt){const s=e.content.key;n.has(s)?e.delete(t):n.add(s)}e=e.left}},Jb=t=>{let e=0;return nt(t.doc,n=>{let s=t._start,r=t._start,o=Gt();const a=va(o);for(;r;)r.deleted===!1&&(r.content.constructor===Tt?ar(a,r.content):(e+=lf(n,s,r,o,a),o=va(a),s=r)),r=r.right}),e},Zb=t=>{const e=new Set,n=t.doc;for(const[s,r]of t.afterState.entries()){const o=t.beforeState.get(s)||0;r!==o&&qh(t,n.store.clients.get(s),o,r,a=>{!a.deleted&&a.content.constructor===Tt&&a.constructor!==on&&e.add(a.parent)})}nt(n,s=>{Js(t,t.deleteSet,r=>{if(r instanceof on||!r.parent._hasFormatting||e.has(r.parent))return;const o=r.parent;r.content.constructor===Tt?e.add(o):Xb(s,r)});for(const r of e)Jb(r)})},Cu=(t,e,n)=>{const s=n,r=va(e.currentAttributes),o=e.right;for(;n>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case jn:case Fs:case vn:n<e.right.length&&Kt(t,Oe(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t);break}e.forward()}o&&lf(t,o,e.right,r,e.currentAttributes);const a=(e.left||e.right).parent;return a._searchMarker&&Or(a._searchMarker,e.index,-s+n),e};class Qb extends eo{constructor(e,n,s){super(e,n),this.childListChanged=!1,this.keysChanged=new Set,s.forEach(r=>{r===null?this.childListChanged=!0:this.keysChanged.add(r)})}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=[];nt(e,s=>{const r=new Map,o=new Map;let a=this.target._start,c=null;const l={};let u="",d=0,h=0;const D=()=>{if(c!==null){let m=null;switch(c){case"delete":h>0&&(m={delete:h}),h=0;break;case"insert":(typeof u=="object"||u.length>0)&&(m={insert:u},r.size>0&&(m.attributes={},r.forEach((g,y)=>{g!==null&&(m.attributes[y]=g)}))),u="";break;case"retain":d>0&&(m={retain:d},q1(l)||(m.attributes=U1({},l))),d=0;break}m&&n.push(m),c=null}};for(;a!==null;){switch(a.content.constructor){case jn:case Fs:this.adds(a)?this.deletes(a)||(D(),c="insert",u=a.content.getContent()[0],D()):this.deletes(a)?(c!=="delete"&&(D(),c="delete"),h+=1):a.deleted||(c!=="retain"&&(D(),c="retain"),d+=1);break;case vn:this.adds(a)?this.deletes(a)||(c!=="insert"&&(D(),c="insert"),u+=a.content.str):this.deletes(a)?(c!=="delete"&&(D(),c="delete"),h+=a.length):a.deleted||(c!=="retain"&&(D(),c="retain"),d+=a.length);break;case Tt:{const{key:m,value:g}=a.content;if(this.adds(a)){if(!this.deletes(a)){const y=r.get(m)??null;Kn(y,g)?g!==null&&a.delete(s):(c==="retain"&&D(),Kn(g,o.get(m)??null)?delete l[m]:l[m]=g)}}else if(this.deletes(a)){o.set(m,g);const y=r.get(m)??null;Kn(y,g)||(c==="retain"&&D(),l[m]=y)}else if(!a.deleted){o.set(m,g);const y=l[m];y!==void 0&&(Kn(y,g)?y!==null&&a.delete(s):(c==="retain"&&D(),g===null?delete l[m]:l[m]=g))}a.deleted||(c==="insert"&&D(),ar(r,a.content));break}}a=a.right}for(D();n.length>0;){const m=n[n.length-1];if(m.retain!==void 0&&m.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}}class er extends Ot{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??Ut(),this._length}_integrate(e,n){super._integrate(e,n);try{this._pending.forEach(s=>s())}catch(s){console.error(s)}this._pending=null}_copy(){return new er}clone(){const e=new er;return e.applyDelta(this.toDelta()),e}_callObserver(e,n){super._callObserver(e,n);const s=new Qb(this,e,n);no(this,e,s),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??Ut();let e="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===vn&&(e+=n.content.str),n=n.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:n=!0}={}){this.doc!==null?nt(this.doc,s=>{const r=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 c=!n&&typeof a.insert=="string"&&o===e.length-1&&r.right===null&&a.insert.slice(-1)===`
46
- `?a.insert.slice(0,-1):a.insert;(typeof c!="string"||c.length>0)&&Vo(s,this,r,c,a.attributes||{})}else a.retain!==void 0?yu(s,this,r,a.retain,a.attributes||{}):a.delete!==void 0&&Cu(s,r,a.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,s){this.doc??Ut();const r=[],o=new Map,a=this.doc;let c="",l=this._start;function u(){if(c.length>0){const h={};let D=!1;o.forEach((g,y)=>{D=!0,h[y]=g});const m={insert:c};D&&(m.attributes=h),r.push(m),c=""}}const d=()=>{for(;l!==null;){if(Bs(l,e)||n!==void 0&&Bs(l,n))switch(l.content.constructor){case vn:{const h=o.get("ychange");e!==void 0&&!Bs(l,e)?(h===void 0||h.user!==l.id.client||h.type!=="removed")&&(u(),o.set("ychange",s?s("removed",l.id):{type:"removed"})):n!==void 0&&!Bs(l,n)?(h===void 0||h.user!==l.id.client||h.type!=="added")&&(u(),o.set("ychange",s?s("added",l.id):{type:"added"})):h!==void 0&&(u(),o.delete("ychange")),c+=l.content.str;break}case jn:case Fs:{u();const h={insert:l.content.getContent()[0]};if(o.size>0){const D={};h.attributes=D,o.forEach((m,g)=>{D[g]=m})}r.push(h);break}case Tt:Bs(l,e)&&(u(),ar(o,l.content));break}l=l.right}u()};return e||n?nt(a,h=>{e&&Na(h,e),n&&Na(h,n),d()},"cleanup"):d(),r}insert(e,n,s){if(n.length<=0)return;const r=this.doc;r!==null?nt(r,o=>{const a=ui(o,this,e,!s);s||(s={},a.currentAttributes.forEach((c,l)=>{s[l]=c})),Vo(o,this,a,n,s)}):this._pending.push(()=>this.insert(e,n,s))}insertEmbed(e,n,s){const r=this.doc;r!==null?nt(r,o=>{const a=ui(o,this,e,!s);Vo(o,this,a,n,s||{})}):this._pending.push(()=>this.insertEmbed(e,n,s||{}))}delete(e,n){if(n===0)return;const s=this.doc;s!==null?nt(s,r=>{Cu(r,ui(r,this,e,!0),n)}):this._pending.push(()=>this.delete(e,n))}format(e,n,s){if(n===0)return;const r=this.doc;r!==null?nt(r,o=>{const a=ui(o,this,e,!1);a.right!==null&&yu(o,this,a,n,s)}):this._pending.push(()=>this.format(e,n,s))}removeAttribute(e){this.doc!==null?nt(this.doc,n=>{Ni(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?nt(this.doc,s=>{Bc(s,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return Lc(this,e)}getAttributes(){return sf(this)}_write(e){e.writeTypeRef(by)}}const ey=t=>new er;class qo{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??Ut()}[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===tr||n.constructor===fs)&&n._start!==null)e=n._start;else for(;e!==null;){const s=e.next;if(s!==null){e=s;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 fs extends Ot{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 fs}clone(){const e=new fs;return e.insert(0,this.toArray().map(n=>n instanceof Ot?n.clone():n)),e}get length(){return this.doc??Ut(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new qo(this,e)}querySelector(e){e=e.toUpperCase();const s=new qo(this,r=>r.nodeName&&r.nodeName.toUpperCase()===e).next();return s.done?null:s.value}querySelectorAll(e){return e=e.toUpperCase(),Mn(new qo(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){no(this,e,new sy(this,n,e))}toString(){return Zh(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,n={},s){const r=e.createDocumentFragment();return s!==void 0&&s._createAssociation(r,this),Pr(this,o=>{r.insertBefore(o.toDOM(e,n,s),null)}),r}insert(e,n){this.doc!==null?nt(this.doc,s=>{tf(s,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)nt(this.doc,s=>{const r=e&&e instanceof Ot?e._item:e;Li(s,this,r,n)});else{const s=this._prelimContent,r=e===null?0:s.findIndex(o=>o===e)+1;if(r===0&&e!==null)throw Dn("Reference item not found");s.splice(r,0,...n)}}delete(e,n=1){this.doc!==null?nt(this.doc,s=>{nf(s,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return Jh(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return Qh(this,e)}slice(e=0,n=this.length){return Xh(this,e,n)}forEach(e){Pr(this,e)}_write(e){e.writeTypeRef(Cy)}}const ty=t=>new fs;class tr extends fs{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((s,r)=>{this.setAttribute(r,s)}),this._prelimAttrs=null}_copy(){return new tr(this.nodeName)}clone(){const e=new tr(this.nodeName),n=this.getAttributes();return H1(n,(s,r)=>{e.setAttribute(r,s)}),e.insert(0,this.toArray().map(s=>s instanceof Ot?s.clone():s)),e}toString(){const e=this.getAttributes(),n=[],s=[];for(const c in e)s.push(c);s.sort();const r=s.length;for(let c=0;c<r;c++){const l=s[c];n.push(l+'="'+e[l]+'"')}const o=this.nodeName.toLocaleLowerCase(),a=n.length>0?" "+n.join(" "):"";return`<${o}${a}>${super.toString()}</${o}>`}removeAttribute(e){this.doc!==null?nt(this.doc,n=>{Ni(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?nt(this.doc,s=>{Bc(s,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return Lc(this,e)}hasAttribute(e){return rf(this,e)}getAttributes(e){return e?qb(this,e):sf(this)}toDOM(e=document,n={},s){const r=e.createElement(this.nodeName),o=this.getAttributes();for(const a in o){const c=o[a];typeof c=="string"&&r.setAttribute(a,c)}return Pr(this,a=>{r.appendChild(a.toDOM(e,n,s))}),s!==void 0&&s._createAssociation(r,this),r}_write(e){e.writeTypeRef(yy),e.writeKey(this.nodeName)}}const ny=t=>new tr(t.readKey());class sy extends eo{constructor(e,n,s){super(e,s),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(r=>{r===null?this.childListChanged=!0:this.attributesChanged.add(r)})}}class Ri extends Qs{constructor(e){super(),this.hookName=e}_copy(){return new Ri(this.hookName)}clone(){const e=new Ri(this.hookName);return this.forEach((n,s)=>{e.set(s,n)}),e}toDOM(e=document,n={},s){const r=n[this.hookName];let o;return r!==void 0?o=r.createDom(this):o=document.createElement(this.hookName),o.setAttribute("data-yjs-hook",this.hookName),s!==void 0&&s._createAssociation(o,this),o}_write(e){e.writeTypeRef(Ey),e.writeKey(this.hookName)}}const ry=t=>new Ri(t.readKey());class Oi extends er{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 Oi}clone(){const e=new Oi;return e.applyDelta(this.toDelta()),e}toDOM(e=document,n,s){const r=e.createTextNode(this.toString());return s!==void 0&&s._createAssociation(r,this),r}toString(){return this.toDelta().map(e=>{const n=[];for(const r in e.attributes){const o=[];for(const a in e.attributes[r])o.push({key:a,value:e.attributes[r][a]});o.sort((a,c)=>a.key<c.key?-1:1),n.push({nodeName:r,attrs:o})}n.sort((r,o)=>r.nodeName<o.nodeName?-1:1);let s="";for(let r=0;r<n.length;r++){const o=n[r];s+=`<${o.nodeName}`;for(let a=0;a<o.attrs.length;a++){const c=o.attrs[a];s+=` ${c.key}="${c.value}"`}s+=">"}s+=e.insert;for(let r=n.length-1;r>=0;r--)s+=`</${n[r].nodeName}>`;return s}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(wy)}}const iy=t=>new Oi;class Nc{constructor(e,n){this.id=e,this.length=n}get deleted(){throw pn()}mergeWith(e){return!1}write(e,n,s){throw pn()}integrate(e,n){throw pn()}}const oy=0;class on extends Nc{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),Vh(e.doc.store,this)}write(e,n){e.writeInfo(oy),e.writeLen(this.length-n)}getMissing(e,n){return null}}class Vr{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new Vr(this.content)}splice(e){throw pn()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}}const ay=t=>new Vr(t.readBuf());class _r{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new _r(this.len)}splice(e){const n=new _r(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){Rr(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 cy=t=>new _r(t.readLen()),uf=(t,e)=>new gs({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class qr{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 qr(uf(this.doc.guid,this.opts))}splice(e){throw pn()}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 ly=t=>new qr(uf(t.readString(),t.readAny()));class Fs{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new Fs(this.embed)}splice(e){throw pn()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}}const uy=t=>new Fs(t.readJSON());class Tt{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new Tt(this.key,this.value)}splice(e){throw pn()}mergeWith(e){return!1}integrate(e,n){const s=n.parent;s._searchMarker=null,s._hasFormatting=!0}delete(e){}gc(e){}write(e,n){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const dy=t=>new Tt(t.readKey(),t.readJSON());class Pi{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Pi(this.arr)}splice(e){const n=new Pi(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 s=this.arr.length;e.writeLen(s-n);for(let r=n;r<s;r++){const o=this.arr[r];e.writeString(o===void 0?"undefined":JSON.stringify(o))}}getRef(){return 2}}const hy=t=>{const e=t.readLen(),n=[];for(let s=0;s<e;s++){const r=t.readString();r==="undefined"?n.push(void 0):n.push(JSON.parse(r))}return new Pi(n)},fy=ki("node_env")==="development";class ps{constructor(e){this.arr=e,fy&&nh(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new ps(this.arr)}splice(e){const n=new ps(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 s=this.arr.length;e.writeLen(s-n);for(let r=n;r<s;r++){const o=this.arr[r];e.writeAny(o)}}getRef(){return 8}}const py=t=>{const e=t.readLen(),n=[];for(let s=0;s<e;s++)n.push(t.readAny());return new ps(n)};class vn{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new vn(this.str)}splice(e){const n=new vn(this.str.slice(e));this.str=this.str.slice(0,e);const s=this.str.charCodeAt(e-1);return s>=55296&&s<=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 my=t=>new vn(t.readString()),Dy=[Kb,Yb,ey,ny,ty,ry,iy],gy=0,Fy=1,by=2,yy=3,Cy=4,Ey=5,wy=6;class jn{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new jn(this.type._copy())}splice(e){throw pn()}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(s=>{s.deleted?s.id.clock<(e.beforeState.get(s.id.client)||0)&&e._mergeStructs.push(s):s.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(s=>{for(;s!==null;)s.gc(e,!0),s=s.left}),this.type._map=new Map}write(e,n){this.type._write(e)}getRef(){return 7}}const xy=t=>new jn(Dy[t.readTypeRef()](t)),Pa=(t,e)=>{let n=e,s=0,r;do s>0&&(n=Oe(n.client,n.clock+s)),r=$s(t,n),s=n.clock-r.id.clock,n=r.redone;while(n!==null&&r instanceof ot);return{item:r,diff:s}},Rc=(t,e)=>{for(;t!==null&&t.keep!==e;)t.keep=e,t=t.parent._item},_i=(t,e,n)=>{const{client:s,clock:r}=e.id,o=new ot(Oe(s,r+n),e,Oe(s,r+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=Oe(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},Eu=(t,e)=>oc(t,n=>zr(n.deletions,e)),df=(t,e,n,s,r,o)=>{const a=t.doc,c=a.store,l=a.clientID,u=e.redone;if(u!==null)return Kt(t,u);let d=e.parent._item,h=null,D;if(d!==null&&d.deleted===!0){if(d.redone===null&&(!n.has(d)||df(t,d,n,s,r,o)===null))return null;for(;d.redone!==null;)d=Kt(t,d.redone)}const m=d===null?e.parent:d.content.type;if(e.parentSub===null){for(h=e.left,D=e;h!==null;){let w=h;for(;w!==null&&w.parent._item!==d;)w=w.redone===null?null:Kt(t,w.redone);if(w!==null&&w.parent._item===d){h=w;break}h=h.left}for(;D!==null;){let w=D;for(;w!==null&&w.parent._item!==d;)w=w.redone===null?null:Kt(t,w.redone);if(w!==null&&w.parent._item===d){D=w;break}D=D.right}}else{if(D=null,e.right&&!r){for(h=e;h!==null&&h.right!==null&&(h.right.redone||zr(s,h.right.id)||Eu(o.undoStack,h.right.id)||Eu(o.redoStack,h.right.id));)for(h=h.right;h.redone;)h=Kt(t,h.redone);if(h&&h.right!==null)return null}else h=m._map.get(e.parentSub)||null;h!==null&&h.parent._item!==d&&(h=m._map.get(e.parentSub)||null)}const g=wt(c,l),y=Oe(l,g),b=new ot(y,h,h&&h.lastId,D,D&&D.id,m,e.parentSub,e.content.copy());return e.redone=y,Rc(b,!0),b.integrate(t,0),b};class ot extends Nc{constructor(e,n,s,r,o,a,c,l){super(e,l.getLength()),this.origin=s,this.left=n,this.right=r,this.rightOrigin=o,this.parent=a,this.parentSub=c,this.redone=null,this.content=l,this.info=this.content.isCountable()?Zl:0}set marker(e){(this.info&Io)>0!==e&&(this.info^=Io)}get marker(){return(this.info&Io)>0}get keep(){return(this.info&Jl)>0}set keep(e){this.keep!==e&&(this.info^=Jl)}get countable(){return(this.info&Zl)>0}get deleted(){return(this.info&_o)>0}set deleted(e){this.deleted!==e&&(this.info^=_o)}markDeleted(){this.info|=_o}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=wt(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=wt(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===Ms&&this.id.client!==this.parent.client&&this.parent.clock>=wt(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=fu(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Kt(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===on||this.right&&this.right.constructor===on)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===ot?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===ot&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===Ms){const s=$s(n,this.parent);s.constructor===on?this.parent=null:this.parent=s.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=fu(e,e.doc.store,Oe(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 s=this.left,r;if(s!==null)r=s.right;else 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;const o=new Set,a=new Set;for(;r!==null&&r!==this.right;){if(a.add(r),o.add(r),Rs(this.origin,r.origin)){if(r.id.client<this.id.client)s=r,o.clear();else if(Rs(this.rightOrigin,r.rightOrigin))break}else if(r.origin!==null&&a.has($s(e.doc.store,r.origin)))o.has($s(e.doc.store,r.origin))||(s=r,o.clear());else break;r=r.right}this.left=s}if(this.left!==null){const s=this.left.right;this.right=s,this.left.right=this}else{let s;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,this.parent._start=this;this.right=s}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),Vh(e.doc.store,this),this.content.integrate(e,this),mu(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new on(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:Oe(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&Rs(e.origin,this.lastId)&&this.right===e&&Rs(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(s=>{s.p===e&&(s.p=this,!this.deleted&&this.countable&&(s.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(),Rr(e.deleteSet,this.id.client,this.id.clock,this.length),mu(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw en();this.content.gc(e),n?kb(e,this,new on(this.id,this.length)):this.content=new _r(this.length)}write(e,n){const s=n>0?Oe(this.id.client,this.id.clock+n-1):this.origin,r=this.rightOrigin,o=this.parentSub,a=this.content.getRef()&Vi|(s===null?0:Qt)|(r===null?0:_n)|(o===null?0:Sr);if(e.writeInfo(a),s!==null&&e.writeLeftID(s),r!==null&&e.writeRightID(r),s===null&&r===null){const c=this.parent;if(c._item!==void 0){const l=c._item;if(l===null){const u=Uh(c);e.writeParentInfo(!0),e.writeString(u)}else e.writeParentInfo(!1),e.writeLeftID(l.id)}else c.constructor===String?(e.writeParentInfo(!0),e.writeString(c)):c.constructor===Ms?(e.writeParentInfo(!1),e.writeLeftID(c)):en();o!==null&&e.writeString(o)}this.content.write(e,n)}}const hf=(t,e)=>vy[e&Vi](t),vy=[()=>{en()},cy,hy,ay,my,uy,dy,xy,py,ly,()=>{en()}],Ay=10;class an extends Nc{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){en()}write(e,n){e.writeInfo(Ay),pe(e.restEncoder,this.length-n)}getMissing(e,n){return null}}const ff=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},pf="__ $YJS$ __";ff[pf]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");ff[pf]=!0;const mf=new Map;class ky{constructor(e){this.room=e,this.onmessage=null,this._onChange=n=>n.key===e&&this.onmessage!==null&&this.onmessage({data:aF(n.newValue||"")}),I1(this._onChange)}postMessage(e){eh.setItem(this.room,oF(tF(e)))}close(){M1(this._onChange)}}const Sy=typeof BroadcastChannel>"u"?ky:BroadcastChannel,Oc=t=>kn(mf,t,()=>{const e=Zn(),n=new Sy(t);return n.onmessage=s=>e.forEach(r=>r(s.data,"broadcastchannel")),{bc:n,subs:e}}),jy=(t,e)=>(Oc(t).subs.add(e),e),Ty=(t,e)=>{const n=Oc(t),s=n.subs.delete(e);return s&&n.subs.size===0&&(n.bc.close(),mf.delete(t)),s},Ls=(t,e,n=null)=>{const s=Oc(t);s.bc.postMessage(e),s.subs.forEach(r=>r(e,n))},Df=0,Pc=1,gf=2,Ii=(t,e)=>{pe(t,Df);const n=Cb(e);bt(t,n)},Ff=(t,e,n)=>{pe(t,Pc),bt(t,Ac(e,n))},By=(t,e,n)=>Ff(e,n,$t(t)),bf=(t,e,n,s)=>{try{_h(e,$t(t),n)}catch(r){s?.(r),console.error("Caught error while handling a Yjs update",r)}},Ly=(t,e)=>{pe(t,gf),bt(t,e)},Ny=bf,Ry=(t,e,n,s,r)=>{const o=Te(t);switch(o){case Df:By(t,e,n);break;case Pc:bf(t,n,s,r);break;case gf:Ny(t,n,s,r);break;default:throw new Error("Unknown message type")}return o},Oy=0,Py=(t,e,n)=>{Te(t)===Oy&&n(e,ht(t))},Wo=3e4;class _y extends Kd{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const n=Qn();this.getLocalState()!==null&&Wo/2<=n-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const s=[];this.meta.forEach((r,o)=>{o!==this.clientID&&Wo<=n-r.lastUpdated&&this.states.has(o)&&s.push(o)}),s.length>0&&_c(this,s,"timeout")},mn(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,s=this.meta.get(n),r=s===void 0?0:s.clock+1,o=this.states.get(n);e===null?this.states.delete(n):this.states.set(n,e),this.meta.set(n,{clock:r,lastUpdated:Qn()});const a=[],c=[],l=[],u=[];e===null?u.push(n):o==null?e!=null&&a.push(n):(c.push(n),_s(o,e)||l.push(n)),(a.length>0||l.length>0||u.length>0)&&this.emit("change",[{added:a,updated:l,removed:u},"local"]),this.emit("update",[{added:a,updated:c,removed:u},"local"])}setLocalStateField(e,n){const s=this.getLocalState();s!==null&&this.setLocalState({...s,[e]:n})}getStates(){return this.states}}const _c=(t,e,n)=>{const s=[];for(let r=0;r<e.length;r++){const o=e[r];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:Qn()})}s.push(o)}}s.length>0&&(t.emit("change",[{added:[],updated:[],removed:s},n]),t.emit("update",[{added:[],updated:[],removed:s},n]))},zs=(t,e,n=t.states)=>{const s=e.length,r=yt();pe(r,s);for(let o=0;o<s;o++){const a=e[o],c=n.get(a)||null,l=t.meta.get(a).clock;pe(r,a),pe(r,l),Mt(r,JSON.stringify(c))}return et(r)},Iy=(t,e,n)=>{const s=ns(e),r=Qn(),o=[],a=[],c=[],l=[],u=Te(s);for(let d=0;d<u;d++){const h=Te(s);let D=Te(s);const m=JSON.parse(ht(s)),g=t.meta.get(h),y=t.states.get(h),b=g===void 0?0:g.clock;(b<D||b===D&&m===null&&t.states.has(h))&&(m===null?h===t.clientID&&t.getLocalState()!=null?D++:t.states.delete(h):t.states.set(h,m),t.meta.set(h,{clock:D,lastUpdated:r}),g===void 0&&m!==null?o.push(h):g!==void 0&&m===null?l.push(h):m!==null&&(_s(m,y)||c.push(h),a.push(h)))}(o.length>0||c.length>0||l.length>0)&&t.emit("change",[{added:o,updated:c,removed:l},n]),(o.length>0||a.length>0||l.length>0)&&t.emit("update",[{added:o,updated:a,removed:l},n])},My=t=>V1(t,(e,n)=>`${encodeURIComponent(n)}=${encodeURIComponent(e)}`).join("&"),cs=0,yf=3,Hs=1,$y=2,Wr=[];Wr[cs]=(t,e,n,s,r)=>{pe(t,cs);const o=Ry(e,t,n.doc,n);s&&o===Pc&&!n.synced&&(n.synced=!0)};Wr[yf]=(t,e,n,s,r)=>{pe(t,Hs),bt(t,zs(n.awareness,Array.from(n.awareness.getStates().keys())))};Wr[Hs]=(t,e,n,s,r)=>{Iy(n.awareness,$t(e),n)};Wr[$y]=(t,e,n,s,r)=>{Py(e,n.doc,(o,a)=>Uy(n,a))};const wu=3e4,Uy=(t,e)=>console.warn(`Permission denied to access ${t.url}.
47
- ${e}`),Cf=(t,e,n)=>{const s=ns(e),r=yt(),o=Te(s),a=t.messageHandlers[o];return a?a(r,s,t,n,o):console.error("Unable to compute message"),r},_a=(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,_c(t.awareness,Array.from(t.awareness.getStates().keys()).filter(s=>s!==t.doc.clientID),t),t.emit("status",[{status:"disconnected"}])):t.wsUnsuccessfulReconnects++,setTimeout(Ef,cc(o1(2,t.wsUnsuccessfulReconnects)*100,t.maxBackoffTime),t))},Ef=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=Qn();const s=Cf(t,new Uint8Array(n.data),!0);lc(s)>1&&e.send(et(s))},e.onerror=n=>{t.emit("connection-error",[n,t])},e.onclose=n=>{_a(t,e,n)},e.onopen=()=>{t.wsLastMessageReceived=Qn(),t.wsconnecting=!1,t.wsconnected=!0,t.wsUnsuccessfulReconnects=0,t.emit("status",[{status:"connected"}]);const n=yt();if(pe(n,cs),Ii(n,t.doc),e.send(et(n)),t.awareness.getLocalState()!==null){const s=yt();pe(s,Hs),bt(s,zs(t.awareness,[t.doc.clientID])),e.send(et(s))}},t.emit("status",[{status:"connecting"}])}},Ko=(t,e)=>{const n=t.ws;t.wsconnected&&n&&n.readyState===n.OPEN&&n.send(e),t.bcconnected&&Ls(t.bcChannel,e,t)};class zy extends ac{constructor(e,n,s,{connect:r=!0,awareness:o=new _y(s),params:a={},protocols:c=[],WebSocketPolyfill:l=WebSocket,resyncInterval:u=-1,maxBackoffTime:d=2500,disableBc:h=!1}={}){for(super();e[e.length-1]==="/";)e=e.slice(0,e.length-1);this.serverUrl=e,this.bcChannel=e+"/"+n,this.maxBackoffTime=d,this.params=a,this.protocols=c,this.roomname=n,this.doc=s,this._WS=l,this.awareness=o,this.wsconnected=!1,this.wsconnecting=!1,this.bcconnected=!1,this.disableBc=h,this.wsUnsuccessfulReconnects=0,this.messageHandlers=Wr.slice(),this._synced=!1,this.ws=null,this.wsLastMessageReceived=0,this.shouldConnect=r,this._resyncInterval=0,u>0&&(this._resyncInterval=setInterval(()=>{if(this.ws&&this.ws.readyState===WebSocket.OPEN){const D=yt();pe(D,cs),Ii(D,s),this.ws.send(et(D))}},u)),this._bcSubscriber=(D,m)=>{if(m!==this){const g=Cf(this,new Uint8Array(D),!1);lc(g)>1&&Ls(this.bcChannel,et(g),this)}},this._updateHandler=(D,m)=>{if(m!==this){const g=yt();pe(g,cs),Ly(g,D),Ko(this,et(g))}},this.doc.on("update",this._updateHandler),this._awarenessUpdateHandler=({added:D,updated:m,removed:g},y)=>{const b=D.concat(m).concat(g),w=yt();pe(w,Hs),bt(w,zs(o,b)),Ko(this,et(w))},this._exitHandler=()=>{_c(this.awareness,[s.clientID],"app closed")},es&&typeof process<"u"&&process.on("exit",this._exitHandler),o.on("update",this._awarenessUpdateHandler),this._checkInterval=setInterval(()=>{this.wsconnected&&wu<Qn()-this.wsLastMessageReceived&&_a(this,this.ws,null)},wu/10),r&&this.connect()}get url(){const e=My(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(),es&&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||(jy(this.bcChannel,this._bcSubscriber),this.bcconnected=!0);const e=yt();pe(e,cs),Ii(e,this.doc),Ls(this.bcChannel,et(e),this);const n=yt();pe(n,cs),Ff(n,this.doc),Ls(this.bcChannel,et(n),this);const s=yt();pe(s,yf),Ls(this.bcChannel,et(s),this);const r=yt();pe(r,Hs),bt(r,zs(this.awareness,[this.doc.clientID])),Ls(this.bcChannel,et(r),this)}disconnectBc(){const e=yt();pe(e,Hs),bt(e,zs(this.awareness,[this.doc.clientID],new Map)),Ko(this,et(e)),this.bcconnected&&(Ty(this.bcChannel,this._bcSubscriber),this.bcconnected=!1)}disconnect(){this.shouldConnect=!1,this.disconnectBc(),this.ws!==null&&_a(this,this.ws,null)}connect(){this.shouldConnect=!0,!this.wsconnected&&this.ws===null&&(Ef(this),this.connectBc())}}const bs=t=>Ys((e,n)=>{t.onerror=s=>n(new Error(s.target.error)),t.onsuccess=s=>e(s.target.result)}),Hy=(t,e)=>Ys((n,s)=>{const r=indexedDB.open(t);r.onupgradeneeded=o=>e(o.target.result),r.onerror=o=>s(Dn(o.target.error)),r.onsuccess=o=>{const a=o.target.result;a.onversionchange=()=>{a.close()},n(a)}}),Vy=t=>bs(indexedDB.deleteDatabase(t)),qy=(t,e)=>e.forEach(n=>t.createObjectStore.apply(t,n)),gr=(t,e,n="readwrite")=>{const s=t.transaction(e,n);return e.map(r=>Qy(s,r))},wf=(t,e)=>bs(t.count(e)),Wy=(t,e)=>bs(t.get(e)),xf=(t,e)=>bs(t.delete(e)),Ky=(t,e,n)=>bs(t.put(e,n)),Ia=(t,e)=>bs(t.add(e)),Gy=(t,e,n)=>bs(t.getAll(e,n)),Yy=(t,e,n)=>{let s=null;return Zy(t,e,r=>(s=r,!1),n).then(()=>s)},Xy=(t,e=null)=>Yy(t,e,"prev"),Jy=(t,e)=>Ys((n,s)=>{t.onerror=s,t.onsuccess=async r=>{const o=r.target.result;if(o===null||await e(o)===!1)return n();o.continue()}}),Zy=(t,e,n,s="next")=>Jy(t.openKeyCursor(e,s),r=>n(r.key)),Qy=(t,e)=>t.objectStore(e),e2=(t,e)=>IDBKeyRange.upperBound(t,e),t2=(t,e)=>IDBKeyRange.lowerBound(t,e),Go="custom",vf="updates",Af=500,kf=(t,e=()=>{},n=()=>{})=>{const[s]=gr(t.db,[vf]);return Gy(s,t2(t._dbref,!1)).then(r=>{t._destroyed||(e(s),nt(t.doc,()=>{r.forEach(o=>_h(t.doc,o))},t,!1),n(s))}).then(()=>Xy(s).then(r=>{t._dbref=r+1})).then(()=>wf(s).then(r=>{t._dbsize=r})).then(()=>s)},n2=(t,e=!0)=>kf(t).then(n=>{(e||t._dbsize>=Af)&&Ia(n,Ac(t.doc)).then(()=>xf(n,e2(t._dbref,!0))).then(()=>wf(n).then(s=>{t._dbsize=s}))});class s2 extends Kd{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=Hy(e,s=>qy(s,[["updates",{autoIncrement:!0}],["custom"]])),this.whenSynced=Ys(s=>this.on("synced",()=>s(this))),this._db.then(s=>{this.db=s,kf(this,a=>Ia(a,Ac(n)),()=>{if(this._destroyed)return this;this.synced=!0,this.emit("synced",[this])})}),this._storeTimeout=1e3,this._storeTimeoutId=null,this._storeUpdate=(s,r)=>{if(this.db&&r!==this){const[o]=gr(this.db,[vf]);Ia(o,s),++this._dbsize>=Af&&(this._storeTimeoutId!==null&&clearTimeout(this._storeTimeoutId),this._storeTimeoutId=setTimeout(()=>{n2(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(()=>{Vy(this.name)})}get(e){return this._db.then(n=>{const[s]=gr(n,[Go],"readonly");return Wy(s,e)})}set(e,n){return this._db.then(s=>{const[r]=gr(s,[Go]);return Ky(r,n,e)})}del(e){return this._db.then(n=>{const[s]=gr(n,[Go]);return xf(s,e)})}}const xu=[["#1677c8","#1677c833"],["#d65745","#d6574533"],["#16866a","#16866a33"],["#9a58b5","#9a58b533"],["#d27b18","#d27b1833"],["#3f7d20","#3f7d2033"],["#be3e7b","#be3e7b33"],["#4964c6","#4964c633"],["#8a6a14","#8a6a1433"],["#087f8c","#087f8c33"]],vu=4,Au=5,r2=6,i2=7,o2=8,Yo=9,Xo=3,a2=6e4,c2=720*60*60*1e3,l2=15e3,u2=5*6e4;function d2(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 ku(t){if(!t||typeof t!="object"||Array.isArray(t))return{};const e={};for(const[n,s]of Object.entries(t)){const r=d2(s);r&&r.mainFile===n&&(e[n]=r)}return e}function h2(t,e,n){return t<=n&&e<=n}function Su(t,e,n){const s=r=>r>0&&n-r<=u2;return{recoverable:t.some(r=>r.tabId===e||!s(r.activeAt)),otherActive:t.some(r=>r.tabId!==e&&s(r.activeAt))}}class f2{constructor(e,n){this.projectId=e,this.user=n;const s=window.location.protocol==="https:"?"wss:":"ws:";this.draftTabId=g2(`texlite:collaboration-tab:${n.id}:${e}`);const r=this.readOwnWritableDraftMarker();this.draftGeneration=r?.generation??0,this.draftUpdatedAt=r?.updatedAt??0,this.draftMarkerPresent=r!==null,this.markDraftTabInactive=()=>this.setOwnDraftActivity(!1),this.markDraftTabActive=()=>this.resumeOwnDraftActivity(),window.addEventListener("pagehide",this.markDraftTabInactive),window.addEventListener("pageshow",this.markDraftTabActive),r&&(this.setOwnDraftActivity(!0),this.startDraftHeartbeat()),this.persistence=new s2(`texlite:${n.id}:${e}`,this.doc),this.localDraftTransactionObserver=a=>{if(a.local){for(const[c,l]of this.doc.share)if(c.startsWith("source:")&&(a.changed.has(l)||a.changedParentTypes.has(l))){this.markWritableDraft();return}}},this.doc.on("afterTransaction",this.localDraftTransactionObserver),this.persistence.on("synced",()=>{this.localDraftReady=!0;for(const a of this.draftListeners)a()}),this.provider=new zy(`${s}//${window.location.host}/api/collaboration`,e,this.doc,{connect:!1,disableBc:!0,maxBackoffTime:2500}),this.awareness=this.provider.awareness;const o=this.doc.getMap("texlite:meta");this.metaObserver=(a,c)=>{c.origin===this.provider&&a.keysChanged.has("compileStates")&&(this.authoritativeCompileStates=null,this.notifyCompileStateListeners())},o.observe(this.metaObserver),this.provider.messageHandlers[vu]=(a,c)=>{const l=ht(c),u=this.flushRequests.get(l);if(!u)return;const d=Te(c)===1,h=Te(c),D=ht(c),m=Te(c),g=[];for(let y=0;y<m;y++)g.push(ht(c));if(window.clearTimeout(u.timer),this.flushRequests.delete(l),d)this.clearOwnWritableDraftMarker(u.draftGeneration),u.resolve({revision:h,persistedAt:D,ok:!0,failedPaths:[]});else{const y=Object.assign(new Error(g.length?`保存失败:${g.join(", ")}`:"源码保存到服务器磁盘失败"),{failedPaths:g});u.reject(y)}},this.provider.messageHandlers[Au]=(a,c)=>{const l=ht(c),u=this.epochStorageKey(),d=ju(u),h=/^([0-9]+):/.exec(l)?.[1]??null,D=d?/^([0-9]+):/.exec(d)?.[1]??null:null,m=!this.epoch&&h===String(Xo)&&D!==null&&D!==h;if((this.epoch&&this.epoch!==l||d&&d!==l)&&!m){this.provider.disconnect(),this.rejectFlushes(new Error("Collaboration state changed"));const v=l.endsWith(":reload")||h!==null&&h!==String(Xo),j=()=>{Jo(u,l.replace(/:reload$/,"")),window.location.reload()};if(v)for(const N of this.protocolUpgradeListeners)N();else this.persistence.clearData().then(()=>{this.clearWritableDraftMarkers(),j()});return}this.epoch=l,Jo(u,l);const g=this.provider.ws;if(!g||g.readyState!==WebSocket.OPEN)return;const y=yt();pe(y,Au),Mt(y,l),pe(y,Xo),g.send(et(y));const b=yt();pe(b,0),Ii(b,this.doc),g.send(et(b));const w=yt();pe(w,1),bt(w,zs(this.awareness,[this.doc.clientID])),g.send(et(w))},this.provider.messageHandlers[i2]=(a,c)=>{const l=ht(c),u=ht(c);if(l!==this.user.id)return;if(u==="revoked"){this.rejectFlushes(new Error("Project access revoked")),this.provider.disconnect();for(const h of this.permissionListeners)h("revoked",this.permission);return}if(u!=="read"&&u!=="edit"&&u!=="owner")return;const d=this.permission;if(this.setPermission(u),d!==u){u==="read"&&this.rejectFlushes(new Error("Project permission changed to read-only"));for(const h of this.permissionListeners)h(u,d)}},this.provider.messageHandlers[r2]=(a,c)=>{ht(c)},this.provider.messageHandlers[o2]=(a,c)=>{let l={};try{l=ku(JSON.parse(ht(c)))}catch{}this.authoritativeCompileStates=l,this.notifyCompileStateListeners()},this.provider.messageHandlers[Yo]=(a,c)=>{const l=ht(c),u=ht(c),d=ht(c),h=ht(c),D=ht(c),m=ht(c);if(l==="state"){const y=ja(c)?ht(c):"",b=ja(c)?ht(c):"",w=Number(D);if(!y||!Number.isFinite(w)||w<=Date.now())this.removeFormatLeaseState(d),this.notifyFormatLeaseListeners(null);else{const v={path:d,holderUserId:y,holderName:b,expiresAt:w};this.formatLeaseStatesByPath.set(d,v);const j=this.formatLeaseExpiryTimers.get(d);j!==void 0&&window.clearTimeout(j);const N=window.setTimeout(()=>{const z=this.formatLeaseStatesByPath.get(d);!z||z.expiresAt>Date.now()||(this.removeFormatLeaseState(d),this.notifyFormatLeaseListeners(null))},Math.max(0,w-Date.now())+25);this.formatLeaseExpiryTimers.set(d,N),this.notifyFormatLeaseListeners(v)}return}const g=this.formatLeaseRequests.get(u);g&&(window.clearTimeout(g.timer),this.formatLeaseRequests.delete(u),l==="denied"?g.reject(new Error(m||"Format lease request was denied")):g.resolve({status:l,filePath:d,token:h,expiresAt:Number(D)}))},this.provider.on("status",({status:a})=>{a==="disconnected"&&(this.authoritativeCompileStates=null,this.notifyCompileStateListeners(),this.rejectFlushes(new Error("Collaboration connection closed")),this.rejectFormatLeaseRequests(new Error("Collaboration connection closed")),this.clearFormatLeaseStates())}),this.updateLocalAwareness()}projectId;user;doc=new gs;provider;awareness;persistence;permission="read";activeFile="";epoch=null;destroyed=!1;localDraftReady=!1;draftListeners=new Set;permissionListeners=new Set;protocolUpgradeListeners=new Set;compileStateListeners=new Set;flushRequests=new Map;formatLeaseRequests=new Map;formatLeaseListeners=new Set;formatLeaseStatesByPath=new Map;formatLeaseExpiryTimers=new Map;draftTabId;draftGeneration=0;draftUpdatedAt=0;draftMarkerPresent=!1;draftHeartbeatTimer=null;markDraftTabInactive;markDraftTabActive;undoManagers=new Map;authoritativeCompileStates=null;metaObserver;localDraftTransactionObserver;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 s=new Lb(this.getText(e));return this.undoManagers.set(e,s),s}applyTextEdits(e,n){if(this.permission==="read")throw new Error("Read-only collaborators cannot edit source files");const s=this.getText(e);let r=0;for(const o of n){if(!Number.isInteger(o.from)||!Number.isInteger(o.to)||o.from<r||o.to<o.from||o.to>s.length)throw new RangeError("Invalid collaborative text edits");r=o.to}this.doc.transact(()=>{for(let o=n.length-1;o>=0;o-=1){const a=n[o];a.to>a.from&&s.delete(a.from,a.to-a.from),a.replacement&&s.insert(a.from,a.replacement)}})}get meta(){return this.doc.getMap("texlite:meta")}compileStates(){return this.authoritativeCompileStates??ku(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)}onProtocolUpgrade(e){return this.protocolUpgradeListeners.add(e),()=>this.protocolUpgradeListeners.delete(e)}async discardLocalDraft(){return this.hasOtherWritableDraft?!1:(await this.persistence.clearData(),this.localDraftReady=!1,this.clearWritableDraftMarkers(),!0)}get hasWritableDraft(){const e=this.readWritableDraftMarkers();return Su(e.map(({tabId:n,marker:s})=>({tabId:n,activeAt:s.activeAt})),this.draftTabId,Date.now()).recoverable}get hasOtherWritableDraft(){const e=this.readWritableDraftMarkers();return Su(e.map(({tabId:n,marker:s})=>({tabId:n,activeAt:s.activeAt})),this.draftTabId,Date.now()).otherActive}setPermission(e,n=!1){const s=this.permission;if(this.permission=e,e==="read"&&(s!=="read"&&this.rejectFlushes(new Error("Project permission changed to read-only")),this.destroyUndoManagers(),this.clearFormatLeaseStates()),this.updateLocalAwareness(),n&&s!==e)for(const r of this.permissionListeners)r(e,s)}setActiveFile(e){this.activeFile!==e&&(this.activeFile=e,this.awareness.setLocalStateField("cursor",null),this.updateLocalAwareness())}sessions(){const e=[];return this.awareness.getStates().forEach((n,s)=>{const r=n?.user;!r||typeof r.id!="string"||typeof r.name!="string"||e.push({clientId:s,userId:r.id,username:typeof r.username=="string"?r.username:r.name,name:r.name,color:typeof r.color=="string"?r.color:"#1677c8",colorLight:typeof r.colorLight=="string"?r.colorLight:"#1677c833",permission:r.permission==="owner"||r.permission==="edit"?r.permission:"read",filePath:typeof n.filePath=="string"?n.filePath:"",editing:!!n.cursor,local:s===this.doc.clientID})}),e.sort((n,s)=>Number(s.local)-Number(n.local)||n.name.localeCompare(s.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(),s=this.draftGeneration,r=yt();return pe(r,vu),Mt(r,n),new Promise((o,a)=>{const c=window.setTimeout(()=>{this.flushRequests.delete(n),a(new Error("Collaboration save timed out"))},5e3);this.flushRequests.set(n,{resolve:o,reject:a,timer:c,draftGeneration:s}),e.send(et(r))})}onFormatLeaseState(e){this.formatLeaseListeners.add(e);for(const n of this.formatLeaseStatesByPath.values())e(n);return()=>this.formatLeaseListeners.delete(e)}formatLeaseStates(){const e=Date.now();for(const[n,s]of this.formatLeaseStatesByPath)s.expiresAt<=e&&this.removeFormatLeaseState(n);return[...this.formatLeaseStatesByPath.values()]}async acquireFormatLease(e){if(this.permission==="read")throw new Error("Formatting requires write permission");const n=await this.requestFormatLease("acquire",e);if(n.status!=="grant"||!n.token||!Number.isFinite(n.expiresAt))throw new Error("Format lease was not granted");let s=n.token,r=n.expiresAt,o=!1;const a=async()=>{if(o)throw new Error("Format lease has already been released");const l=await this.requestFormatLease("renew",e,s);if(l.status!=="renewed"||!Number.isFinite(l.expiresAt))throw new Error("Format lease renewal failed");s=l.token||s,r=l.expiresAt};return{path:e,get token(){return s},get expiresAt(){return r},confirm:a,renew:a,release:async()=>{if(o)return;o=!0;const l=this.provider.ws;if(!(!l||l.readyState!==WebSocket.OPEN))try{await this.requestFormatLease("release",e,s)}catch{}}}}reconnect(){this.destroyed||(this.rejectFlushes(new Error("Collaboration connection reset")),this.provider.disconnect(),this.provider.connect(),this.updateLocalAwareness())}destroy(){this.destroyed=!0,this.setOwnDraftActivity(!1),this.stopDraftHeartbeat(),window.removeEventListener("pagehide",this.markDraftTabInactive),window.removeEventListener("pageshow",this.markDraftTabActive),this.rejectFlushes(new Error("Collaboration connection closed")),this.provider.destroy(),this.persistence.destroy(),this.draftListeners.clear(),this.protocolUpgradeListeners.clear(),this.compileStateListeners.clear(),this.rejectFormatLeaseRequests(new Error("Collaboration connection closed")),this.clearFormatLeaseStates(),this.formatLeaseListeners.clear(),this.meta.unobserve(this.metaObserver),this.doc.off("afterTransaction",this.localDraftTransactionObserver),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()}requestFormatLease(e,n,s=""){const r=this.provider.ws;if(!this.provider.synced||!r||r.readyState!==WebSocket.OPEN)return Promise.reject(new Error("Collaboration connection is unavailable"));const o=crypto.randomUUID(),a=yt();return pe(a,Yo),Mt(a,e),Mt(a,o),Mt(a,n),Mt(a,s),new Promise((c,l)=>{const u=window.setTimeout(()=>{if(this.formatLeaseRequests.delete(o),e==="acquire"){const d=this.provider.ws;if(d?.readyState===WebSocket.OPEN){const h=yt();pe(h,Yo),Mt(h,"cancel"),Mt(h,o),Mt(h,n),Mt(h,""),d.send(et(h))}}l(new Error("Format lease request timed out"))},e==="acquire"?a2:5e3);this.formatLeaseRequests.set(o,{resolve:c,reject:l,timer:u}),r.send(et(a))})}rejectFormatLeaseRequests(e){for(const n of this.formatLeaseRequests.values())window.clearTimeout(n.timer),n.reject(e);this.formatLeaseRequests.clear()}clearFormatLeaseStates(){for(const e of this.formatLeaseExpiryTimers.values())window.clearTimeout(e);this.formatLeaseExpiryTimers.clear(),this.formatLeaseStatesByPath.size&&(this.formatLeaseStatesByPath.clear(),this.notifyFormatLeaseListeners(null))}removeFormatLeaseState(e){const n=this.formatLeaseExpiryTimers.get(e);n!==void 0&&window.clearTimeout(n),this.formatLeaseExpiryTimers.delete(e),this.formatLeaseStatesByPath.delete(e)}notifyFormatLeaseListeners(e){for(const n of this.formatLeaseListeners)n(e)}updateLocalAwareness(){const[e,n]=xu[Math.abs(this.doc.clientID)%xu.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}`}writableDraftStoragePrefix(){return`texlite:collaboration-writable:${this.user.id}:${this.projectId}:`}ownWritableDraftStorageKey(){return`${this.writableDraftStoragePrefix()}${this.draftTabId}`}markWritableDraft(){this.draftGeneration+=1,this.draftUpdatedAt=Date.now(),this.draftMarkerPresent||this.writeOwnWritableDraftMarker(!0),this.startDraftHeartbeat()}clearWritableDraftMarkers(){for(const{key:e}of this.readWritableDraftMarkers())pr(e);this.draftMarkerPresent=!1,this.stopDraftHeartbeat(),pr(this.writableDraftStoragePrefix().slice(0,-1))}clearOwnWritableDraftMarker(e){const n=this.readOwnWritableDraftMarker();!n||!h2(n.generation,this.draftGeneration,e)||(pr(this.ownWritableDraftStorageKey()),this.draftMarkerPresent=!1,this.stopDraftHeartbeat())}readOwnWritableDraftMarker(){return this.readWritableDraftMarker(this.ownWritableDraftStorageKey())}readWritableDraftMarkers(){const e=this.writableDraftStoragePrefix(),n=[];for(const s of p2()){if(!s.startsWith(e))continue;const r=this.readWritableDraftMarker(s);r&&n.push({key:s,tabId:s.slice(e.length),marker:r})}return n}readWritableDraftMarker(e){const n=ju(e);if(!n)return null;try{const s=JSON.parse(n);if(!s||typeof s!="object"||Array.isArray(s))return null;const r=s,o=Date.now();if(!Number.isInteger(r.generation)||(r.generation??0)<0||typeof r.updatedAt!="number"||!Number.isFinite(r.updatedAt)||r.updatedAt<=0||o-r.updatedAt>c2)return pr(e),null;const a=typeof r.activeAt=="number"&&Number.isFinite(r.activeAt)?Math.max(0,r.activeAt):0;return{generation:r.generation,updatedAt:r.updatedAt,activeAt:a}}catch{return pr(e),null}}writeOwnWritableDraftMarker(e){if(!this.draftMarkerPresent&&this.draftUpdatedAt<=0)return;const n={generation:this.draftGeneration,updatedAt:this.draftUpdatedAt||Date.now(),activeAt:e?Date.now():0};Jo(this.ownWritableDraftStorageKey(),JSON.stringify(n)),this.draftMarkerPresent=!0}setOwnDraftActivity(e){this.draftMarkerPresent&&(this.writeOwnWritableDraftMarker(e),e?this.startDraftHeartbeat():this.stopDraftHeartbeat())}resumeOwnDraftActivity(){const e=this.readOwnWritableDraftMarker();if(!e){this.draftMarkerPresent=!1,this.stopDraftHeartbeat();return}this.draftGeneration=Math.max(this.draftGeneration,e.generation),this.draftUpdatedAt=e.updatedAt,this.draftMarkerPresent=!0,this.setOwnDraftActivity(!0)}startDraftHeartbeat(){this.draftHeartbeatTimer!==null||!this.draftMarkerPresent||(this.draftHeartbeatTimer=window.setInterval(()=>{this.writeOwnWritableDraftMarker(!0)},l2))}stopDraftHeartbeat(){this.draftHeartbeatTimer!==null&&(window.clearInterval(this.draftHeartbeatTimer),this.draftHeartbeatTimer=null)}}function ju(t){try{return window.localStorage.getItem(t)}catch{return null}}function Jo(t,e){try{window.localStorage.setItem(t,e)}catch{}}function pr(t){try{window.localStorage.removeItem(t)}catch{}}function p2(){try{const t=[];for(let e=0;e<window.localStorage.length;e+=1){const n=window.localStorage.key(e);n&&t.push(n)}return t}catch{return[]}}function m2(t){try{return window.sessionStorage.getItem(t)}catch{return null}}function D2(t,e){try{window.sessionStorage.setItem(t,e)}catch{}}function g2(t){const e=m2(t);if(e)return e;const n=typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`;return D2(t,n),n}function F2(t,e){return Array.from(t.trim()||e.trim()||"?")[0]?.toLocaleUpperCase()??"?"}function b2(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 y2(t,e,n,s,r,o){const[a]=f.useState(()=>new f2(t,e)),[c,l]=f.useState("connecting"),[u,d]=f.useState(!1),[h,D]=f.useState([]),[m,g]=f.useState(null),[y,b]=f.useState(null),[w,v]=f.useState(""),[j,N]=f.useState(""),[z,V]=f.useState([]),[U,G]=f.useState(!1),[X,K]=f.useState(s),[le,_]=f.useState(null),[W,T]=f.useState(!1),k=f.useRef(n),R=f.useRef(o),he=f.useRef(r);k.current=n,R.current=o,he.current=r,f.useEffect(()=>{const B=a.compileStates();g(B[n]??null)},[n,a]),f.useEffect(()=>{const B=()=>D(a.sessions()),me=()=>{d(!1),D([]),g(null),b(null),v(""),N(""),V([]),R.current()},J=({status:ye})=>{l(ye),ye!=="connected"&&me()},Z=ye=>{d(ye),ye||me()},ue=()=>{l("disconnected"),me()},O=()=>{const ye=a.meta.get("filesEvent");b2(ye)&&b(ye);const Ke=a.meta.get("commentsRevision");typeof Ke=="string"&&v(Ke);const Je=a.meta.get("dictionaryRevision");typeof Je=="string"&&N(Je);const mt=a.compileStates();g(mt[k.current]??null)},te=()=>{const ye=a.compileStates();g(ye[k.current]??null)};a.awareness.on("change",B),a.provider.on("status",J),a.provider.on("sync",Z),a.provider.on("connection-close",ue),a.provider.on("connection-error",ue),a.meta.observe(O);const A=a.onCompileStates(te),De=a.onProtocolUpgrade(()=>{T(!0),l("disconnected"),me()}),Ce=()=>V(a.formatLeaseStates()),Ve=a.onFormatLeaseState(Ce),lt=()=>{if(!he.current||a.currentPermission!=="read")return;const ye=a.hasWritableDraft,Ke=a.hasOtherWritableDraft;!ye&&!Ke||_({previous:"edit",localDraftReady:ye,otherTabDraft:Ke})},We=a.onDraftReady(()=>{G(!0),lt()}),Ue=a.onPermissionChanged((ye,Ke)=>{if(ye==="revoked"){l("disconnected"),d(!1),R.current();return}K(ye),ye==="read"&&Ke!=="read"?_({previous:Ke,localDraftReady:a.hasWritableDraft,otherTabDraft:a.hasOtherWritableDraft}):ye!=="read"&&_(null)});return B(),O(),l(a.connected?"connected":"connecting"),d(a.synced),()=>{a.awareness.off("change",B),a.provider.off("status",J),a.provider.off("sync",Z),a.provider.off("connection-close",ue),a.provider.off("connection-error",ue),a.meta.unobserve(O),A(),De(),Ve(),We(),Ue(),a.destroy()}},[a]),f.useEffect(()=>{r&&a.connect()},[a,r]),f.useEffect(()=>{a.setPermission(s),K(s),r&&s==="read"&&(a.hasWritableDraft||a.hasOtherWritableDraft)?_({previous:"edit",localDraftReady:a.hasWritableDraft,otherTabDraft:a.hasOtherWritableDraft}):s!=="read"&&_(null)},[a,s,r]);const be=le!==null;return f.useEffect(()=>{if(!be)return;const B=()=>{if(a.currentPermission!=="read")return;const J=a.hasWritableDraft,Z=a.hasOtherWritableDraft;_(ue=>!ue||ue.localDraftReady===J&&ue.otherTabDraft===Z?ue:{...ue,localDraftReady:J,otherTabDraft:Z})};B();const me=window.setInterval(B,2e3);return()=>window.clearInterval(me)},[a,be]),{collaboration:a,status:c,synced:u,activeSessions:h,compileState:m,setCompileState:g,formatLeaseStates:z,filesEvent:y,commentsRevision:w,dictionaryRevision:j,localDraftReady:U,permission:X,protocolUpgradeRequired:W,reconnect:()=>{W||(l("connecting"),d(!1),D([]),g(null),V([]),a.reconnect())},permissionDowngrade:le,dismissPermissionDowngrade:()=>_(null),discardLocalDraft:async()=>await a.discardLocalDraft()?(_(null),window.location.reload(),!0):(_(me=>me&&{...me,otherTabDraft:!0}),!1)}}function Tu(t){return t?.status==="succeeded"?"succeeded":t?.log.includes("Compilation was cancelled.")?"cancelled":t?.status==="failed"?"failed":null}function is(t){return t instanceof Error&&t.name==="AbortError"}function C2(t){return t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement}function E2({projectId:t,project:e,mainFile:n,initialLatest:s,collaborationSynced:r,sharedState:o,onSharedState:a,save:c,loadOutline:l,onPreviewTab:u,onError:d,onCompileStart:h,onCompileSuccess:D,onPdfChanged:m}){const{t:g}=st(),[y,b]=f.useState(""),[w,v]=f.useState(!0),[j,N]=f.useState(null),[z,V]=f.useState("full"),[U,G]=f.useState(""),[X,K]=f.useState(null),[le,_]=f.useState(null),[W,T]=f.useState([]),[k,R]=f.useState(null),[he,be]=f.useState(!1),[Fe,Ne]=f.useState(!1),[Ee,B]=f.useState(()=>new Set),[me,J]=f.useState(()=>new Set),[Z,ue]=f.useState(""),O=f.useRef(n),te=f.useRef(""),A=f.useRef(null),De=f.useRef(null),Ce=f.useRef(null),Ve=f.useRef(s),lt=f.useRef(!1),We=f.useRef(null),Ue=f.useRef(null),ye=f.useRef(new Set),Ke=f.useRef(new Map),Je=f.useRef(null),mt=f.useRef(()=>{}),ge=f.useRef({onSharedState:a,save:c,loadOutline:l,onPreviewTab:u,onError:d,onCompileStart:h,onCompileSuccess:D,onPdfChanged:m});O.current=n,ge.current={onSharedState:a,save:c,loadOutline:l,onPreviewTab:u,onError:d,onCompileStart:h,onCompileSuccess:D,onPdfChanged:m};const xt=H=>{Je.current!==H&&(Je.current=H,ge.current.onCompileSuccess())},ce=async(H,fe)=>{fe||(We.current?.abort(),We.current=new AbortController,fe=We.current.signal);try{const q=H?`?mainFile=${encodeURIComponent(H)}`:"",ze=await ee(`/api/projects/${t}/compile/artifacts${q}`,{signal:fe});O.current===H&&(T(ze.artifacts),R(null))}catch(q){!is(q)&&O.current===H&&(T([]),R(null))}finally{We.current?.signal===fe&&(We.current=null)}};f.useEffect(()=>{if(A.current?.abort(),!n){v(!1),b(""),N(null),V("full"),G(""),K(null),_(null),T([]),R(null),Ce.current=null,ge.current.onPdfChanged();return}Ce.current?.mainFile!==n&&(Ce.current=null);const H=new AbortController;A.current=H,v(!0),G(""),K(null),_(null),y&&n&&te.current===n||(b(""),N(null),V("full")),T([]),R(null),ge.current.onPdfChanged();let q=null;const ze=`?mainFile=${encodeURIComponent(n)}`,Ge=lt.current?null:Ve.current;Ge&&(lt.current=!0);const tt=()=>ee(`/api/projects/${t}/compile/latest${ze}`,{signal:H.signal}),xe=Ge?Ge.then($=>$.mainFile!==n?tt():$,()=>tt()):tt();let vt=!1;const ne=()=>{if(vt||H.signal.aborted||!n)return;vt=!0;const $=new AbortController;ye.current.add($),ce(n,$.signal).finally(()=>{ye.current.delete($)}),ge.current.loadOutline(H.signal,n).catch(()=>{})};return xe.then($=>{if(H.signal.aborted||n&&$.mainFile!==O.current)return;const ut=Ce.current;ut&&ut.mainFile===n&&$.latestRun?.id!==ut.runId||(G($.latestRun?.log??""),K($.latestRun?.diagnostics??null),_(Tu($.latestRun)),n&&$.latestRun?.requestedBy&&($.latestRun.status==="queued"||$.latestRun.status==="running")&&ge.current.onSharedState({mainFile:n,runId:$.latestRun.id,status:$.latestRun.status,requestedBy:$.latestRun.requestedBy,updatedAt:new Date().toISOString()}),$.pdfUrl&&(te.current=$.mainFile,b($.pdfUrl),N($.pdfCompiledAt),V($.pdfLoadingMode??"full"),ge.current.onPreviewTab("pdf")))}).catch($=>{!is($)&&O.current===n&&ge.current.onError(de($))}).finally(()=>{A.current===H&&(A.current=null),H.signal.aborted||(v(!1),q=window.setTimeout(ne,0))}),()=>{q!==null&&window.clearTimeout(q),H.abort(),Ue.current?.abort();for(const $ of ye.current)$.abort();ye.current.clear()}},[t,n]),f.useEffect(()=>{if(!(!o||o.mainFile!==n||o.status!=="cleaned"||!o.cleanMode)){A.current?.abort(),De.current?.abort(),We.current?.abort(),Ue.current?.abort();for(const H of ye.current)H.abort();ye.current.clear(),o.cleanMode==="artifacts"?(Ce.current=null,G(""),K(null),_(null),b(""),N(null),V("full"),T([]),R(null),ge.current.onPdfChanged(),ge.current.onPreviewTab("pdf"),ue(g("editor.cleanArtifactsComplete"))):ue(g("editor.cleanCacheComplete"))}},[o?.runId,o?.status,o?.cleanMode,o?.mainFile,n,g]),f.useEffect(()=>{!n||o?.mainFile===n&&(o.status==="queued"||o.status==="running")||J(H=>{if(!H.has(n))return H;const fe=new Set(H);return fe.delete(n),fe})},[n,o?.mainFile,o?.status]),f.useEffect(()=>{if(!o||o.mainFile!==n||o.status!=="succeeded"&&o.status!=="failed")return;let H=!1;De.current?.abort(),Ue.current?.abort();const fe=new AbortController;return De.current=fe,v(!0),ee(`/api/projects/${t}/compile/latest?mainFile=${encodeURIComponent(n)}`,{signal:fe.signal}).then(q=>{H||q.mainFile!==O.current||q.latestRun?.id!==o.runId||(G(q.latestRun.log),K(q.latestRun.diagnostics),_(Tu(q.latestRun)),o.status==="succeeded"&&o.stale&&ue(g("editor.compileSnapshotStale")),o.status==="succeeded"&&q.pdfUrl?(Ce.current={mainFile:n,runId:o.runId},ge.current.onPdfChanged(),b(q.pdfUrl),N(q.pdfCompiledAt),V(q.pdfLoadingMode??"full"),ge.current.onPreviewTab("pdf"),xt(o.runId),ce(n)):o.status==="failed"&&ge.current.onPreviewTab(q.latestRun.diagnostics.errors.length?"errors":"log"))}).catch(q=>{!is(q)&&!H&&ge.current.onError(de(q))}).finally(()=>{De.current===fe&&(De.current=null),H||v(!1)}),()=>{H=!0,fe.abort(),De.current===fe&&(De.current=null)}},[o?.runId,o?.status,o?.mainFile,o?.stale,n,t,g]);const ke=async()=>{if(!e||!n||e.permission==="read"||!r||Ke.current.has(n)||o?.mainFile===n&&(o.status==="queued"||o.status==="running"))return;const H=n;B(q=>new Set([...q,H])),ge.current.onCompileStart(),ue(""),Ue.current?.abort(),Ue.current=null,G(""),K(null),_(null),ge.current.onPreviewTab(y?"pdf":"log");const fe=new AbortController;Ke.current.set(H,fe);try{if(!await ge.current.save())return;const q=await ee(`/api/projects/${t}/compile`,{method:"POST",signal:fe.signal,body:JSON.stringify({mainFile:H})});if(q.mainFile!==O.current)return;G(q.log),K(q.diagnostics),_(q.cancelled?"cancelled":q.ok?"succeeded":"failed"),q.cancelled&&ue(g("compileControls.cancelled")),q.skipped&&ue(g("editor.upToDate")),q.ok&&q.stale&&ue(g("editor.compileSnapshotStale")),q.pdfUrl?(q.ok&&(Ce.current={mainFile:H,runId:q.runId}),ge.current.onPdfChanged(),b(q.pdfUrl),N(q.pdfCompiledAt),V(q.pdfLoadingMode??"full"),ge.current.onPreviewTab("pdf"),q.ok&&(q.skipped?ge.current.onCompileSuccess():xt(q.runId))):ge.current.onPreviewTab(q.diagnostics.errors.length?"errors":"log")}catch(q){!is(q)&&O.current===H&&ge.current.onError(de(q))}finally{Ke.current.get(H)===fe&&(Ke.current.delete(H),B(q=>{const ze=new Set(q);return ze.delete(H),ze}),J(q=>{if(!q.has(H))return q;const ze=new Set(q);return ze.delete(H),ze}))}},Re=async()=>{if(!e||!n||e.permission==="read"||!r)return;const H=n;J(fe=>new Set([...fe,H]));try{(await ee(`/api/projects/${t}/compile/cancel`,{method:"POST",body:JSON.stringify({mainFile:H})})).cancelled||J(q=>{const ze=new Set(q);return ze.delete(H),ze})}catch(fe){J(q=>{const ze=new Set(q);return ze.delete(H),ze}),!is(fe)&&O.current===H&&ge.current.onError(de(fe))}},Dt=async H=>{if(!e||!n||e.permission==="read"||!r||Fe||Ke.current.has(n)||o?.mainFile===n&&(o.status==="queued"||o.status==="running"))return;const fe=n;Ne(!0),A.current?.abort(),De.current?.abort(),We.current?.abort(),Ue.current?.abort();try{if((await ee(`/api/projects/${t}/compile/clean`,{method:"POST",body:JSON.stringify({mainFile:fe,mode:H})})).mainFile!==O.current)return;ge.current.onSharedState(null),H==="artifacts"&&(Ce.current=null,G(""),K(null),_(null),b(""),N(null),V("full"),T([]),R(null),ge.current.onPdfChanged()),ue(g(H==="cache"?"editor.cleanCacheComplete":"editor.cleanArtifactsComplete"))}catch(q){!is(q)&&O.current===fe&&ge.current.onError(de(q))}finally{Ne(!1)}};mt.current=()=>{ke()},f.useEffect(()=>{if(!Z)return;const H=window.setTimeout(()=>ue(""),3e3);return()=>window.clearTimeout(H)},[Z]),f.useEffect(()=>{const H=fe=>{if(!(!(fe.ctrlKey||fe.metaKey)||fe.key.toLocaleLowerCase()!=="s")){if(C2(fe.target)){fe.preventDefault();return}fe.preventDefault(),fe.stopPropagation(),fe.repeat||mt.current()}};return window.addEventListener("keydown",H,!0),()=>window.removeEventListener("keydown",H,!0)},[]),f.useEffect(()=>()=>{A.current?.abort(),De.current?.abort(),We.current?.abort(),Ue.current?.abort();for(const H of ye.current)H.abort();ye.current.clear();for(const H of Ke.current.values())H.abort();Ke.current.clear()},[]);const Me=async H=>{if(!H.viewable)return;Ue.current?.abort();const fe=new AbortController;Ue.current=fe,be(!0);try{const q=await ee(`/api/projects/${t}/compile/artifacts?mainFile=${encodeURIComponent(n)}&path=${encodeURIComponent(H.path)}`,{signal:fe.signal});!fe.signal.aborted&&Ue.current===fe&&O.current===n&&R(q)}catch(q){is(q)||ge.current.onError(de(q))}finally{Ue.current===fe&&(Ue.current=null,be(!1))}};return{pdfUrl:y,pdfCompiledAt:j,pdfLoadingMode:z,pdfLoading:w,compileLog:U,compileDiagnostics:X,compileOutcome:le,artifacts:W,artifactPreview:k,artifactLoading:he,editorNotice:Z,localCompiling:Ee.has(n),cancelling:me.has(n),cleaning:Fe,compile:ke,cancelCompile:Re,cleanCompile:Dt,viewArtifact:Me}}const Ma=10*1024*1024,w2=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 Bu(t){return t instanceof Error&&t.name==="AbortError"}function Fr(t){const e=t.split("/").filter(Boolean);return e.pop(),e.map((n,s)=>e.slice(0,s+1).join("/"))}function os(t,e){return!!(t&&e)&&(e===t||e.startsWith(`${t}/`))}function x2(t){const e=`.${t.split(".").at(-1)?.toLocaleLowerCase()??""}`;return!w2.has(e)}function Vs(t){return/(?:\.(?:tex|bib|sty|cls|txt|md)|latexmkrc)$/i.test(t)}function Lu(t){const e=t.split(".").at(-1)?.toLocaleLowerCase()??"";return e==="pdf"?"pdf":["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"].includes(e)?"image":x2(t)?"text":"unsupported"}function v2(t,e){return`/api/projects/${t}/file/raw?path=${encodeURIComponent(e)}`}function A2({projectId:t,site:e,activeFile:n,dirty:s,save:r,onError:o,onProject:a,onActiveFile:c,onActiveMainFile:l,onRootDocuments:u}){const{t:d}=st(),[h,D]=f.useState([]),[m,g]=f.useState(!1),[y,b]=f.useState(""),[w,v]=f.useState(null),[j,N]=f.useState(!1),[z,V]=f.useState(!1),[U,G]=f.useState(""),[X,K]=f.useState(""),[le,_]=f.useState(""),[W,T]=f.useState(new Set),[k,R]=f.useState(null),[he,be]=f.useState(""),[Fe,Ne]=f.useState(""),[Ee,B]=f.useState(null),[me,J]=f.useState(!1),[Z,ue]=f.useState(null),[O,te]=f.useState(!1),A=f.useRef(null),De=f.useRef(null),Ce=async(ce={})=>{A.current?.abort(),A.current=null;const ke=ce.signal?null:new AbortController;ke&&(A.current=ke);try{const Re=await ee(`/api/projects/${t}/files`,{signal:ce.signal??ke?.signal});return(!ce.isCurrent||ce.isCurrent())&&D(Re.files),Re.files}catch(Re){if(!Bu(Re))throw Re;return}finally{ke&&A.current===ke&&(A.current=null)}},Ve=async()=>{if(!(!y.trim()||y.trim().endsWith("/"))){K("");try{await ee(`/api/projects/${t}/file`,{method:"POST",body:JSON.stringify({path:y,content:""})}),await Ce(),c(y),T(ce=>new Set([...ce,...Fr(y)])),g(!1),b("")}catch(ce){K(de(ce))}}},lt=async()=>{if(!U.trim())return;K("");const ce=le?`${le}/${U.trim()}`:U.trim();try{const ke=await ee(`/api/projects/${t}/folders`,{method:"POST",body:JSON.stringify({path:ce})});await Ce(),T(Re=>new Set([...Re,...Fr(ke.path),ke.path])),_(ke.path),V(!1),G("")}catch(ke){K(de(ke))}},We=async(ce,ke=new Set,Re=le)=>{if(!ce.length)return;const Dt=e.maxUploadSizeMB;if(ce.find(xe=>xe.size>Dt*1024*1024))return o(d("errors.fileTooLarge",{size:Dt}));const H=Re,fe=ce.map(xe=>H?`${H}/${xe.name}`:xe.name),q=new Map;for(const xe of fe)q.set(xe,(q.get(xe)??0)+1);const ze=[...q.entries()].filter(([,xe])=>xe>1).map(([xe])=>xe);if(ze.length)return o(d("errors.duplicateUploadNames",{files:ze.join(", ")}));const Ge=new Set(h.map(xe=>xe.path)),tt=[...new Set(fe.filter(xe=>Ge.has(xe)&&!ke.has(xe)))];if(tt.length){ue({files:ce,directory:H,collisions:tt});return}ue(null),te(!0);try{const xe=new URLSearchParams;H&&xe.set("directory",H);let vt="";for(const[ne,$]of ce.entries()){const ut=fe[ne];xe.delete("overwrite"),ke.has(ut)&&xe.set("overwrite","1");const Bt=xe.toString()?`?${xe.toString()}`:"",un=new FormData;un.append("file",$);try{const ct=await ee(`/api/projects/${t}/upload${Bt}`,{method:"POST",body:un});typeof ct.path=="string"&&Vs(ct.path)&&(vt=ct.path)}catch(ct){if(ct instanceof Gn&&ct.status===409&&!ke.has(ut)&&ct.code==="FILE_EXISTS"){ne>0&&await Ce(),ue({files:ce.slice(ne),directory:H,collisions:[ut]});return}throw ct}}await Ce(),vt&&c(vt)}catch(xe){o(de(xe))}finally{te(!1)}},Ue=async ce=>{await We(Array.from(ce.target.files??[])),ce.target.value=""},ye=async ce=>{De.current?.abort(),De.current=null,N(!1);const ke=v2(t,ce.path);if((ce.size??0)>Ma){v({path:ce.path,kind:"large",size:ce.size??0,url:ke});return}const Re=Lu(ce.path);if(Re!=="text"){v({path:ce.path,kind:Re,size:ce.size??0,url:ke});return}v({path:ce.path,kind:Re,size:ce.size??0,url:ke,content:""}),N(!0);const Dt=new AbortController;De.current=Dt;try{let Me;try{Me=await fetch(ke,{signal:Dt.signal})}catch(q){throw qu(q)}const H=Me.headers.get("content-type")??"";if(!Me.ok){let q=null;try{q=H.includes("application/json")?await Me.json():await Me.text()}catch{}throw new Gn(Wu(q,Me.status),Me.status,Ua(q))}const fe=await Me.text();v(q=>q?.path===ce.path?{...q,content:fe}:q)}catch(Me){Bu(Me)||(v(null),o(de(Me)))}finally{De.current===Dt&&(De.current=null,N(!1))}},Ke=ce=>{const ke=Lu(ce.path),Re=e.maxCollaborativeFileSizeMB*1024*1024;(ce.size??0)>Ma||Vs(ce.path)&&(ce.size??0)>Re||ke!=="text"||!Vs(ce.path)?ye(ce):c(ce.path)},Je=async()=>{if(!k)return;const ce=he.trim();if(ce){K("");try{if(!await r())return;const ke=await ee(`/api/projects/${t}/path`,{method:"PATCH",body:JSON.stringify({source:k.path,destinationDirectory:Fe,destinationName:ce})}),Re=H=>H===k.path?ke.path:H.startsWith(`${k.path}/`)?`${ke.path}${H.slice(k.path.length)}`:H;c(H=>Re(H)),l(H=>Re(H)),u(H=>new Set([...H].map(Re))),_(H=>H&&Re(H));const[Dt,Me]=await Promise.all([ee(`/api/projects/${t}/files`),ee(`/api/projects/${t}`)]);D(Dt.files),a(Me.project),T(H=>new Set([...H,...Fr(ke.path),Fe].filter(Boolean))),R(null),be(""),Ne("")}catch(ke){K(de(ke))}}},mt=async()=>{if(Ee){K("");try{if(s&&!await r())return;await ee(`/api/projects/${t}/file?path=${encodeURIComponent(Ee.path)}`,{method:"DELETE"}),B(null)}catch(ce){K(de(ce))}}};f.useEffect(()=>()=>{A.current?.abort(),De.current?.abort()},[]),f.useEffect(()=>{De.current?.abort(),De.current=null,N(!1)},[n]);const ge=h.filter(ce=>ce.type==="directory"),xt=h.filter(ce=>Fr(ce.path).every(ke=>W.has(ke)));return{files:h,setFiles:D,loadFiles:Ce,newFileOpen:m,setNewFileOpen:g,newFilePath:y,setNewFilePath:b,resourcePreview:w,setResourcePreview:v,resourcePreviewLoading:j,setResourcePreviewLoading:N,newFolderOpen:z,setNewFolderOpen:V,newFolderName:U,setNewFolderName:G,fileDialogError:X,setFileDialogError:K,selectedFolder:le,setSelectedFolder:_,expandedFolders:W,setExpandedFolders:T,moveEntry:k,setMoveEntry:R,moveName:he,setMoveName:be,moveDestination:Fe,setMoveDestination:Ne,deleteEntry:Ee,setDeleteEntry:B,fileDragActive:me,setFileDragActive:J,uploadConflict:Z,setUploadConflict:ue,uploadingFiles:O,directoryEntries:ge,visibleEntries:xt,createFile:Ve,createFolder:lt,uploadFiles:We,upload:Ue,openFile:Ke,movePath:Je,removePath:mt}}function k2({active:t,projectId:e,activeFile:n,content:s,dictionaryWords:r}){const[o,a]=f.useState([]),[c,l]=f.useState(""),[u,d]=f.useState(""),[h,D]=f.useState(0),[m,g]=f.useState(null),[y,b]=f.useState(null),[w,v]=f.useState(!1),[j,N]=f.useState(0),z=f.useRef(0),V=f.useRef(!1),U=f.useRef(!1),G=f.useRef(s),X=f.useRef(n),K=f.useRef(0);G.current=s,X.current=n,U.current=w,f.useEffect(()=>{a([]),l(""),d(""),g(null),b(null),v(!1)},[n,r]),f.useEffect(()=>{b(null),v(!1)},[e]),f.useEffect(()=>{D(T=>o.length?Math.min(T,o.length-1):0)},[o]),f.useEffect(()=>{const T=++z.current;if(!t||!n){a([]),l(""),d(""),g(null);return}if(y){a([]),l(""),d("");return}const k=s,R=n;let he=!1;const be=window.setTimeout(()=>{b(null),(async()=>{try{const{lintLatex:Fe,isHarperLintSupersededError:Ne}=await ts(async()=>{const{lintLatex:B,isHarperLintSupersededError:me}=await import("./spellCheck-CDZ9ZXo6.js");return{lintLatex:B,isHarperLintSupersededError:me}},__vite__mapDeps([5,1]));if(he||T!==z.current||G.current!==k||X.current!==R)return;let Ee;try{Ee=await Fe(e,R,k,r)}catch(B){if(Ne(B))return;throw B}if(he||T!==z.current||G.current!==k||X.current!==R)return;V.current=!1,v(!1),a(Ee),l(k),d(R),D(0),g(null)}catch(Fe){if(he||T!==z.current||G.current!==k||X.current!==R)return;a([]),l(""),d(""),b(Fe instanceof Error?Fe.message:String(Fe));const Ne=V.current;V.current=!1,v(Ne?U.current:!1)}})()},700);return()=>{he=!0,window.clearTimeout(be)}},[t,e,n,s,r,j,y]),f.useEffect(()=>{if(!y||!t)return;let T=!1;const k=()=>{T||(T=!0,V.current=!0,b(null),N(he=>he+1))},R=window.setTimeout(k,15e3);return window.addEventListener("online",k,{once:!0}),()=>{window.clearTimeout(R),window.removeEventListener("online",k)}},[y,t]);const le=u===n&&c===s,_=f.useMemo(()=>le?{total:o.length,unique:new Set(o.map(T=>`${T.kind}:${T.word.toLocaleLowerCase("en-US")}`)).size}:null,[le,o]);return{issues:le?o:[],jump:le?m:null,index:h,summary:_,jumpToIssue:T=>{if(!o.length)return;const k=Math.max(0,Math.min(T,o.length-1)),R=o[k];D(k),g({from:R.from,to:R.to,nonce:++K.current})},error:w?null:y,nativeFallback:t&&!!y,retry:()=>{V.current=!1,b(null),v(!1),N(T=>T+1)},dismissError:()=>{V.current=!1,v(!0)}}}function Nu(t){return t instanceof Error&&t.name==="AbortError"}function S2({projectId:t,mainFile:e,activeFile:n,onActiveFile:s,onError:r,onShowPdf:o}){const[a,c]=f.useState(null),[l,u]=f.useState(null),[d,h]=f.useState(null),D=f.useRef(null),m=f.useRef(0),g=f.useRef(n),y=f.useRef(s),b=f.useRef(r),w=f.useRef(o),v=U=>U===e&&/\.tex$/i.test(U);g.current=n,y.current=s,b.current=r,w.current=o,f.useEffect(()=>(D.current?.abort(),D.current=null,c(null),u(null),h(null),()=>D.current?.abort()),[t,e]);const j=(U,G,X)=>{h({path:U,line:G,column:X,nonce:++m.current}),g.current!==U&&y.current(U)},N=async(U,G,X,K={})=>{if(!v(U))return;D.current?.abort();const le=new AbortController;D.current=le;try{const _=await ee(`/api/projects/${t}/sync/pdf?mainFile=${encodeURIComponent(e)}&path=${encodeURIComponent(U)}&line=${G}&column=${X}`,{signal:le.signal});if(D.current!==le||!_)return;c({..._,nonce:++m.current}),w.current()}catch(_){!Nu(_)&&!K.silent&&b.current(de(_))}finally{D.current===le&&(D.current=null)}},z=async(U,G,X)=>{if(!v(g.current))return;const K=g.current;D.current?.abort();const le=new AbortController;D.current=le;try{const _=await ee(`/api/projects/${t}/sync/source?mainFile=${encodeURIComponent(e)}&page=${U}&x=${G}&y=${X}`,{signal:le.signal});if(D.current!==le||g.current!==K||!v(g.current))return;j(_.path,_.line,_.column)}catch(_){Nu(_)||b.current(de(_))}finally{D.current===le&&(D.current=null)}};return{pdfTarget:a,pdfViewport:l,sourceJump:d,setPdfViewport:u,clearPdfViewport:()=>u(null),jumpToSource:j,syncSourceToPdf:N,syncPdfToSource:z,syncVisiblePdfToSource:()=>{l&&z(l.page,l.x,l.y)}}}function Sf(t,e){return`texlite.workspaceLayout:${encodeURIComponent(t)}:${encodeURIComponent(e)}`}function Ru(t,e){try{const n=window.localStorage.getItem(Sf(t,e));if(n==="editor-pdf"||n==="editor-only"||n==="pdf-only")return n}catch{}return"editor-pdf"}function j2(t,e){const[n,s]=f.useState(()=>Ru(t,e));return f.useEffect(()=>{s(Ru(t,e))},[t,e]),{workspaceLayout:n,setWorkspaceLayout:o=>{s(o);try{window.localStorage.setItem(Sf(t,e),o)}catch{}}}}function T2(t){const n=t.split(/(?<=\n)/).map(s=>{for(let r=0;r<s.length;r+=1){if(s[r]!=="%")continue;let o=0;for(let a=r-1;a>=0&&s[a]==="\\";a-=1)o+=1;if(o%2===0)return s.slice(0,r)+(s.endsWith(`
48
- `)?`
49
- `:"")}return s}).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 B2({sessions:t,status:e}){const{t:n}=st(),[s,r]=f.useState(!1),o=Math.max(0,t.length-5),a=s&&o>0,c=a?t:t.slice(0,5);return f.useEffect(()=>{t.length<=5&&r(!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:[c.map(l=>{const u=l.editing?n("editor.collaboration.editing"):n("editor.collaboration.viewing"),d=l.permission==="read"?n("common.readOnly"):n("common.readWrite"),h=n("editor.collaboration.sessionTooltip",{name:l.name,username:l.username,file:l.filePath||n("editor.collaboration.joining"),activity:u,permission:d});return i.jsxs("span",{className:`collaboration-avatar${l.editing?" editing":""}${l.local?" local":""}`,style:{"--session-color":l.color},title:h,"aria-label":h,tabIndex:0,children:[F2(l.name,l.username),i.jsxs("span",{className:"collaboration-avatar-tooltip",role:"tooltip",children:[i.jsx("strong",{children:l.name}),i.jsxs("span",{children:["@",l.username]}),i.jsxs("small",{children:[l.filePath||n("editor.collaboration.joining")," · ",u," · ",d]})]})]},l.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:()=>r(l=>!l),children:a?"−":`+${o}`})]})]})}function L2({value:t,onChange:e}){const{t:n}=st(),[s,r]=f.useState(!1),o=f.useRef(null),a=[{value:"editor-pdf",icon:$l},{value:"editor-only",icon:og},{value:"pdf-only",icon:ag}];return f.useEffect(()=>{if(!s)return;const c=u=>{o.current?.contains(u.target)||r(!1)},l=u=>{u.key==="Escape"&&r(!1)};return document.addEventListener("pointerdown",c),document.addEventListener("keydown",l),()=>{document.removeEventListener("pointerdown",c),document.removeEventListener("keydown",l)}},[s]),i.jsxs("div",{className:"layout-menu",ref:o,children:[i.jsxs("button",{type:"button",className:`layout-trigger${s?" active":""}`,"aria-haspopup":"menu","aria-expanded":s,title:n("editor.layout.current",{layout:n(`editor.layout.${t}.name`)}),onClick:()=>r(c=>!c),children:[i.jsx($l,{size:15}),i.jsxs("span",{children:[i.jsx("small",{children:n("editor.layout.label")}),n(`editor.layout.${t}.name`)]}),i.jsx(Td,{size:13})]}),s&&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(c=>{const l=c.icon,u=c.value===t;return i.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":u,className:`layout-option${u?" selected":""}`,onClick:()=>{e(c.value),r(!1)},children:[i.jsx(l,{size:19}),i.jsxs("span",{children:[i.jsx("strong",{children:n(`editor.layout.${c.value}.name`)}),i.jsx("small",{children:n(`editor.layout.${c.value}.description`)})]}),u&&i.jsx(us,{size:16})]},c.value)})]})]})}function N2({site:t,project:e,activeFile:n,saveStateLabel:s,editorPreferences:r,activeSessions:o,collaborationStatus:a,reconnectCollaboration:c,protocolUpgradeRequired:l,showEditor:u,filesCollapsed:d,toggleFilesPanel:h,workspaceLayout:D,changeWorkspaceLayout:m,onBack:g,onShare:y,showCitationLibrary:b,citationLibraryOpen:w,onCitationLibrary:v,onHistory:j,onGit:N,canManageGit:z,formatting:V,readOnly:U,collaborationSynced:G,canFormat:X,activeFormatLease:K,onFormatFile:le,onFormatSelection:_,hasSelection:W,onAddComment:T,onToggleComments:k,commentsOpen:R,unresolvedCommentCount:he,hasActiveFile:be,onToggleSettings:Fe,settingsOpen:Ne,compileBusy:Ee,sharedCompiling:B,localCompiling:me,cancelling:J,compileState:Z,onCompile:ue,onCancelCompile:O}){const{t:te}=st();return i.jsxs("header",{className:"editor-topbar",children:[i.jsx("button",{className:"back",title:te("editor.backToProjects"),"aria-label":te("editor.backToProjects"),onClick:g,children:i.jsx(da,{size:18})}),i.jsx("a",{className:"brand-link compact-brand-link",href:"/","aria-label":t.siteName,onClick:A=>{A.preventDefault(),g()},children:i.jsx(zi,{siteName:t.siteName,compact:!0})}),i.jsxs("div",{className:"project-heading",children:[i.jsx("strong",{children:e.name}),i.jsxs("small",{children:[n," · ",s]})]}),r.vimMode&&i.jsxs("span",{className:"vim-status-badge",title:te("editor.vimOnHint"),children:[i.jsx(sg,{size:14}),te("editor.vimOn")]}),i.jsx(B2,{sessions:o,status:a}),a==="disconnected"&&!l&&i.jsxs("div",{className:"collaboration-recovery",role:"status",children:[i.jsx("span",{children:te("editor.collaboration.disconnected")}),i.jsx("button",{type:"button",onClick:c,children:te("editor.collaboration.reconnect")})]}),i.jsxs("div",{className:"editor-actions",children:[u&&i.jsxs("button",{className:d?"":"active",onClick:h,children:[d?i.jsx(ig,{size:15}):i.jsx(Pd,{size:15}),te("common.files")]}),i.jsx(L2,{value:D,onChange:m}),i.jsxs("button",{onClick:y,children:[i.jsx(kr,{size:15}),te("projectSettings.share")]}),b&&i.jsxs("button",{className:w?"active":"",onClick:v,children:[i.jsx(Ns,{size:15}),te("citationLibrary.title")]}),i.jsxs("div",{className:"version-action",role:"group","aria-label":te("common.version"),children:[i.jsxs("div",{className:"version-action-label",children:[i.jsx(eg,{size:14}),i.jsx("span",{children:te("common.version")})]}),i.jsxs("div",{className:"version-action-options",children:[i.jsx("button",{type:"button",className:"version-action-history",title:te("history.title"),onClick:j,children:te("history.title")}),i.jsx("button",{type:"button",className:"version-action-git",title:te(z?"git.title":"git.ownerOnly"),disabled:!z,onClick:N,children:"Git"})]})]}),u&&e.permission!=="read"&&X&&i.jsxs("div",{className:"format-action",role:"group","aria-label":te("editor.format"),"aria-busy":V,children:[i.jsxs("div",{className:"format-action-label",children:[i.jsx(jd,{size:14}),i.jsx("span",{children:te("editor.format")})]}),i.jsxs("div",{className:"format-action-options",children:[i.jsx("button",{type:"button",className:"format-action-file",title:te("editor.formatFileHint"),onMouseDown:A=>A.preventDefault(),onClick:le,disabled:V||K||!G,children:te("editor.formatFile")}),i.jsx("button",{type:"button",className:"format-action-selected",title:te(W?"editor.formatSelection":"editor.formatSelectionHint"),onMouseDown:A=>A.preventDefault(),onClick:_,disabled:V||K||!G||!W,children:te("editor.formatSelected")})]})]}),i.jsxs("div",{className:"comments-action",role:"group","aria-label":te("common.comments"),children:[i.jsxs("div",{className:"comments-action-label",children:[i.jsx(Rd,{size:14}),i.jsx("span",{children:te("common.comments")})]}),i.jsxs("div",{className:"comments-action-options",children:[i.jsx("button",{type:"button",className:"comments-action-add",title:te("editor.addComment"),"aria-label":te("editor.addComment"),onMouseDown:A=>A.preventDefault(),onClick:T,disabled:!be,children:te("editor.commentsAdd")}),i.jsxs("button",{type:"button",className:`comments-action-all${R?" active":""}`,title:te("editor.commentsAll"),onClick:k,children:[te("editor.commentsAll")," ",he||""]})]})]}),i.jsxs("button",{className:Ne?"active":"",onClick:Fe,children:[i.jsx(ba,{size:15}),te("common.settings")]}),B||me?i.jsxs("button",{className:"compile cancel-compile",title:te("compileControls.cancel"),onClick:O,disabled:J||V||U||!G,children:[J?i.jsx(at,{className:"spin",size:15}):i.jsx(Vt,{size:15}),te(J?"compileControls.cancelling":"compileControls.cancel")]}):i.jsxs("button",{className:"compile",title:te("editor.compileShortcut"),onClick:ue,disabled:Ee||V||U||!G,children:[Ee?i.jsx(at,{className:"spin",size:15}):i.jsx(ug,{size:15}),te("editor.compile",{engine:e.engine})]})]})]})}function R2({project:t,filesPanel:e,files:n,visibleEntries:s,activeFile:r,activeMainFile:o,rootDocuments:a,selectedFolder:c,expandedFolders:l,fileDragActive:u,uploadingFiles:d,readOnly:h,editorFontSize:D,outline:m,sourceCursor:g,wordCountBusy:y,hasSelection:b,uploadInput:w,setSelectedFolder:v,setExpandedFolders:j,setMoveEntry:N,setMoveName:z,setMoveDestination:V,setDeleteEntry:U,setFileDialogError:G,setNewFolderName:X,setNewFolderOpen:K,setNewFilePath:le,setNewFileOpen:_,setQuickOpen:W,setProjectSearchOpen:T,setFileDragActive:k,setFilesCollapsed:R,toggleFilesPanel:he,uploadFiles:be,upload:Fe,openFile:Ne,jumpToSource:Ee,syncSourceToPdf:B,onWordCount:me}){const{t:J}=st(),[Z,ue]=f.useState(!1);return i.jsx(Mi,{id:"files",order:1,ref:e,defaultSize:16,minSize:12,maxSize:30,collapsible:!0,collapsedSize:0,onCollapse:()=>R(!0),onExpand:()=>R(!1),children:i.jsxs("aside",{className:"left-panel",children:[i.jsxs("section",{className:`files-panel${u?" drop-active":""}`,onDragEnter:O=>{O.dataTransfer.types.includes("Files")&&(O.preventDefault(),!h&&!d&&k(!0))},onDragOver:O=>{O.dataTransfer.types.includes("Files")&&(O.preventDefault(),O.dataTransfer.dropEffect=h||d?"none":"copy")},onDragLeave:O=>{O.currentTarget.contains(O.relatedTarget)||k(!1)},onDrop:O=>{O.preventDefault(),k(!1),!h&&!d&&be(Array.from(O.dataTransfer.files))},children:[i.jsxs("div",{className:"panel-title",children:[i.jsx("button",{className:"file-size-toggle",type:"button","aria-pressed":Z,title:J(Z?"editor.hideFileSizes":"editor.showFileSizes"),onClick:()=>ue(O=>!O),children:J("common.files")}),i.jsxs("span",{className:"file-tools",children:[i.jsx("button",{"aria-label":J("navigation.quickOpen"),title:`${J("navigation.quickOpen")} (Ctrl/Cmd+P)`,onClick:()=>W(!0),children:i.jsx(X0,{size:15})}),i.jsx("button",{"aria-label":J("navigation.projectSearch"),title:`${J("navigation.projectSearch")} (Ctrl/Cmd+Shift+F)`,onClick:()=>T(!0),children:i.jsx(_d,{size:15})}),!h&&i.jsxs(i.Fragment,{children:[i.jsx("button",{disabled:d,"aria-label":J("editor.uploadAttachment"),title:J("editor.uploadTo",{folder:c||J("editor.projectRoot")}),onClick:()=>w.current?.click(),children:i.jsx(Ci,{size:15})}),i.jsx("button",{"aria-label":J("editor.newFolder"),title:J("editor.newFolder"),onClick:()=>{X(""),K(!0)},children:i.jsx(Ld,{size:15})}),i.jsx("button",{"aria-label":J("editor.newFile"),title:J("editor.newFile"),onClick:()=>{le(c?`${c}/`:""),_(!0)},children:i.jsx(Y0,{size:15})}),i.jsx("input",{ref:w,type:"file",multiple:!0,hidden:!0,onChange:O=>{Fe(O)}})]}),i.jsx("button",{"aria-label":J("editor.collapseFiles"),title:J("editor.collapseFiles"),onClick:he,children:i.jsx(Pd,{size:15})})]})]}),u&&i.jsxs("div",{className:"file-drop-overlay",children:[i.jsx(Ci,{size:24}),i.jsx("strong",{children:J("editor.dropFiles")}),i.jsx("span",{children:J("editor.uploadTo",{folder:c||J("editor.projectRoot")})})]}),i.jsxs("div",{className:"file-list",style:{fontSize:`${D}px`},children:[i.jsx("div",{className:`file-entry folder-entry root-entry${c===""?" selected":""}`,children:i.jsxs("button",{className:"file-entry-main",onClick:()=>v(""),children:[i.jsx(pa,{size:15}),i.jsx("span",{children:J("editor.projectRoot")})]})}),s.map(O=>{const te=O.path.split("/").length-1,A=O.path.split("/").at(-1),De=l.has(O.path),Ce=a.has(O.path),Ve=o===O.path,lt=O.path!==t.mainFile&&!t.mainFile.startsWith(`${O.path}/`);return O.type==="directory"?i.jsxs("div",{className:`file-entry folder-entry${c===O.path?" selected":""}`,style:{paddingLeft:`${te*13+5}px`},children:[i.jsxs("button",{className:"file-entry-main",title:O.path,onClick:()=>{v(O.path),j(We=>{const Ue=new Set(We);return Ue.has(O.path)?Ue.delete(O.path):Ue.add(O.path),Ue})},children:[De?i.jsx(Td,{size:13}):i.jsx(Hi,{size:13}),i.jsx(Q0,{size:14}),i.jsx("span",{children:A})]}),!h&&i.jsxs(i.Fragment,{children:[i.jsx("button",{className:"file-entry-action",title:J("editor.move"),"aria-label":J("editor.move"),onClick:()=>{N(O),z(A??""),V("")},children:i.jsx(zl,{size:13})}),lt&&i.jsx("button",{className:"file-entry-action danger-text",title:J("editor.deletePath"),"aria-label":J("editor.deletePath"),onClick:()=>{U(O),G("")},children:i.jsx(cn,{size:13})})]})]},O.path):i.jsxs("div",{className:`file-entry${r===O.path?" active":""}${Ce?" root-document":""}${Ve?" compile-target":""}`,style:{paddingLeft:`${te*13+18}px`},children:[i.jsxs("button",{className:"file-entry-main",title:Ve?J("editor.currentMainDocument",{path:O.path}):Ce?J("editor.mainDocumentCandidate",{path:O.path}):O.path,onClick:()=>Ne(O),children:[Ce?i.jsx(Qa,{size:13}):i.jsx(Ws,{size:13}),i.jsx("span",{children:A}),Ve&&i.jsx("small",{children:J("editor.currentMainShort")})]}),Z&&typeof O.size=="number"&&i.jsx("span",{className:"file-entry-size",title:`${O.size.toLocaleString()} B`,children:O2(O.size)}),!h&&i.jsxs(i.Fragment,{children:[i.jsx("button",{className:"file-entry-action",title:J("editor.move"),"aria-label":J("editor.move"),onClick:()=>{N(O),z(A??""),V("")},children:i.jsx(zl,{size:13})}),lt&&i.jsx("button",{className:"file-entry-action danger-text",title:J("editor.deletePath"),"aria-label":J("editor.deletePath"),onClick:()=>{U(O),G("")},children:i.jsx(cn,{size:13})})]})]},O.path)})]})]}),i.jsxs("section",{className:"outline-panel",children:[i.jsxs("div",{className:"panel-title",children:[i.jsxs("span",{className:"outline-heading",children:[i.jsx(rg,{size:14}),J("common.outline")]}),i.jsxs("span",{className:"word-count-actions",role:"group","aria-label":J("editor.wordCountTitle"),children:[i.jsxs("button",{type:"button",title:J("editor.wordCountFullHint"),onClick:()=>me("full"),disabled:y||!o,children:[y?i.jsx(at,{className:"spin",size:12}):i.jsx(ma,{size:12}),J("editor.wordCountFull")]}),i.jsxs("button",{type:"button",title:J("editor.wordCountSelectionHint"),onClick:()=>me("selection"),disabled:y||!b,children:[y?i.jsx(at,{className:"spin",size:12}):i.jsx(ma,{size:12}),J("editor.wordCountSelection")]})]})]}),i.jsxs("div",{className:"outline",children:[m.map((O,te)=>i.jsxs("button",{className:`outline-item${r===O.path&&g.line===O.line?" current":""}`,title:`${O.path}:${O.line}`,onClick:()=>{Ee(O.path,O.line,1),B(O.path,O.line,1)},children:[i.jsx("span",{className:"outline-guides","aria-hidden":!0,style:{width:`${O.level*12}px`}}),i.jsx("small",{children:O.path===r?O.line:O.path.split("/").at(-1)}),i.jsx("span",{className:"outline-title",children:O.title})]},`${O.path}-${O.line}-${te}`)),m.length===0&&i.jsx("p",{className:"muted padded",children:J("editor.noOutline")})]})]})]})})}function O2(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:t<1024*1024*1024?`${(t/1024/1024).toFixed(1)} MB`:`${(t/1024/1024/1024).toFixed(1)} GB`}const P2=f.lazy(()=>ts(()=>import("./LatexEditor-XLwZxO6_.js"),__vite__mapDeps([6,1,7])).then(t=>({default:t.LatexEditor})));function _2({project:t,activeFile:e,activeMainFile:n,openTabs:s,content:r,loadedFile:o,readOnly:a,comments:c,focusComment:l,editorPreferences:u,completionIndex:d,nativeSpellCheck:h,spellCheckIssues:D,spellCheckJump:m,sourceJump:g,collaborativeText:y,collaborationAwareness:b,undoManager:w,editorNotice:v,activateTab:j,closeTab:N,handleTabKeyDown:z,updateEditorContent:V,setSelection:U,onCommentClick:G,onSpellCheckReplace:X,onCursor:K}){const{t:le}=st();return i.jsx(Mi,{id:"source",order:2,defaultSize:42,minSize:22,children:i.jsxs("main",{className:"source-panel",children:[u.openFilesInTabs&&s.length>0&&i.jsx("div",{className:"editor-tabs-bar",role:"tablist","aria-label":le("editor.openFiles"),children:i.jsx("div",{className:"editor-tabs-scroll",children:s.map((_,W)=>{const T=_===e,k=_===(n||t.mainFile),R=_.split("/").at(-1)||_;return i.jsxs("div",{className:`editor-tab-item${T?" active":""}`,role:"presentation",children:[i.jsxs("button",{id:`editor-tab-${encodeURIComponent(_)}`,type:"button",role:"tab","aria-selected":T,"aria-controls":"editor-source-content",tabIndex:T?0:-1,className:`editor-tab${T?" active":""}${k?" main-tab":""}`,onClick:()=>j(_),onKeyDown:he=>z(he,W),title:_,children:[i.jsx("span",{className:"editor-tab-icon",children:k?i.jsx(Qa,{size:13}):i.jsx(Ws,{size:13})}),i.jsx("span",{className:"editor-tab-title",children:R}),k&&i.jsx("small",{className:"editor-tab-badge",children:le("editor.currentMainShort")})]}),i.jsx("button",{type:"button",className:"editor-tab-close",title:le("common.close"),"aria-label":`${le("common.close")} ${R}`,onClick:()=>N(_),children:i.jsx(Vt,{size:12})})]},_)})})}),i.jsxs("div",{id:"editor-source-content",className:"editor-content-container",children:[i.jsx(f.Suspense,{fallback:i.jsxs("div",{className:"preview-empty",children:[i.jsx(at,{className:"spin",size:22}),i.jsx("span",{children:le("common.loading")})]}),children:i.jsx(P2,{value:r,filePath:e,readOnly:a,comments:c,focusComment:l,preferences:u,nativeSpellCheck:h,completionIndex:d,spellCheckIssues:D,spellCheckJump:m,jumpTo:o===e&&g?.path===e?g:null,searchRequest:0,collaboration:y?{text:y,awareness:b,undoManager:a?void 0:w}:void 0,onChange:V,onSelection:U,onCommentClick:G,onSpellCheckReplace:X,onCursor:K},e)}),v&&i.jsx("div",{className:"editor-centered-notice",role:"status","aria-live":"polite",children:v})]})]})})}function Ou({diagnostics:t,files:e,empty:n,tone:s,onJump:r}){const{t:o}=st(),a=s==="error"?ec:Zt;return t.length?i.jsx("div",{className:`compile-diagnostic-list compile-${s}`,children:t.map((c,l)=>{const u=$2(c.file,e),d=!!(u&&c.line);return i.jsxs("button",{type:"button",disabled:!d,className:"compile-diagnostic-row",onClick:()=>{u&&c.line&&r(u,c.line,c.column??1)},children:[i.jsx(a,{size:15}),i.jsxs("span",{children:[i.jsx("strong",{children:c.message}),i.jsxs("small",{children:[c.phase,u?` · ${u}${c.line?`:${c.line}`:""}`:c.line?` · ${o("editor.lineNumber",{line:c.line})}`:""]})]})]},`${c.phase}-${c.file??""}-${c.line??0}-${l}`)})}):i.jsxs("div",{className:`compile-empty compile-${s}`,children:[i.jsx(a,{size:26}),i.jsx("span",{children:n})]})}function Zo({lines:t,empty:e,tone:n="log"}){const s=n==="error"?ec:n==="warning"?Zt:Fa;return t.length?i.jsx("pre",{className:`compile-output compile-${n}`,children:t.join(`
50
- `)}):i.jsxs("div",{className:`compile-empty compile-${n}`,children:[i.jsx(s,{size:26}),i.jsx("span",{children:e})]})}function I2({projectId:t,mainFile:e,artifacts:n,preview:s,loading:r,onView:o}){const{t:a}=st(),c=l=>`/api/projects/${t}/compile/artifacts?mainFile=${encodeURIComponent(e)}&path=${encodeURIComponent(l)}&download=1`;return n.length?i.jsxs("div",{className:"artifact-browser",children:[i.jsx("div",{className:"artifact-list",children:n.map(l=>i.jsxs("div",{className:`artifact-row${s?.path===l.path?" active":""}`,children:[i.jsxs("button",{type:"button",disabled:!l.viewable,title:l.viewable?a("editor.viewArtifact"):a("editor.downloadToView"),onClick:()=>o(l),children:[i.jsx(Ws,{size:14}),i.jsxs("span",{children:[i.jsx("strong",{children:l.path}),i.jsx("small",{children:U2(l.size)})]})]}),i.jsx("a",{href:c(l.path),title:a("editor.downloadArtifact"),"aria-label":a("editor.downloadArtifact"),children:i.jsx(Ar,{size:14})})]},l.path))}),i.jsx("div",{className:"artifact-preview",children:r?i.jsxs("div",{className:"compile-empty",children:[i.jsx(at,{className:"spin",size:24}),i.jsx("span",{children:a("common.loading")})]}):s?i.jsxs(i.Fragment,{children:[i.jsxs("header",{children:[i.jsx("strong",{children:s.path}),i.jsxs("a",{href:c(s.path),children:[i.jsx(Ar,{size:13}),a("projects.download")]})]}),i.jsx("pre",{children:s.content})]}):i.jsxs("div",{className:"compile-empty",children:[i.jsx(Ws,{size:24}),i.jsx("span",{children:a("editor.selectArtifact")})]})})]}):i.jsxs("div",{className:"compile-empty",children:[i.jsx(Od,{size:26}),i.jsx("span",{children:a("editor.noArtifacts")})]})}function M2({mainFile:t,disabled:e,cleaning:n,onCleanCache:s,onCleanArtifacts:r}){const{t:o}=st();return i.jsxs("div",{className:"compile-clean-panel",children:[i.jsxs("div",{className:"compile-clean-intro",children:[i.jsx(Zt,{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(ha,{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:s,children:[n?i.jsx(at,{className:"spin",size:14}):i.jsx(ha,{size:14}),o("editor.cleanCache")]})]})]}),i.jsxs("article",{className:"danger",children:[i.jsx("div",{className:"compile-clean-action-icon",children:i.jsx(cn,{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:r,children:[n?i.jsx(at,{className:"spin",size:14}):i.jsx(cn,{size:14}),o("editor.cleanArtifacts")]})]})]})]})]})}function $2(t,e){if(!t)return null;const n=e.filter(c=>c.type==="file").map(c=>c.path),s=t.replaceAll("\\","/").replace(/^\.\//,"");if(n.includes(s))return s;const r=n.filter(c=>s.endsWith(`/${c}`));if(r.length===1)return r[0];const o=s.split("/").at(-1),a=n.filter(c=>c.split("/").at(-1)===o);return a.length===1?a[0]:null}function U2(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/1024/1024).toFixed(1)} MB`}const z2=f.lazy(()=>Ui().then(t=>({default:t.PdfPreview})));function H2({projectId:t,activeMainFile:e,previewTab:n,diagnosticTab:s,pdfUrl:r,pdfLoadingMode:o,pdfLoading:a,pdfCompiledAt:c,pdfCompiledLabel:l,pdfTargetLabel:u,pdfDownloadUrl:d,pdfTarget:h,pdfViewport:D,activeFile:m,sourceCursor:g,compileBusy:y,compileLog:b,compileDiagnostics:w,compileMessages:v,artifacts:j,artifactPreview:N,artifactLoading:z,cleaning:V,readOnly:U,collaborationSynced:G,workspaceLayout:X,showSyncResize:K,diagnosticCount:le,selectPreviewTab:_,changeWorkspaceLayout:W,onSetNotice:T,onSetPdfViewport:k,syncVisiblePdfToSource:R,syncSourceToPdf:he,syncPdfToSource:be,canSyncWithPdf:Fe,files:Ne,jumpToSource:Ee,onSetCleanMode:B,cleanCompile:me,viewArtifact:J}){const{t:Z}=st();return i.jsxs(i.Fragment,{children:[K&&i.jsxs($a,{className:"resize-handle sync-resize-handle",children:[i.jsx(Nd,{className:"resize-grip",size:12}),i.jsxs("span",{className:"sync-direction-buttons",onPointerDown:ue=>ue.stopPropagation(),children:[i.jsx("button",{disabled:!D||!Fe,title:Z(Fe?"editor.showInSource":"editor.syncTexOnlyForMain"),"aria-label":Z("editor.showInSource"),onClick:()=>{if(!Fe){T(Z("editor.syncTexOnlyForMain"));return}R()},children:i.jsx("span",{"aria-hidden":!0,children:"←"})}),i.jsx("button",{disabled:!m||!r||!Fe,title:Z(Fe?"editor.showInPdf":"editor.syncTexOnlyForMain"),"aria-label":Z("editor.showInPdf"),onClick:()=>{if(!Fe){T(Z("editor.syncTexOnlyForMain"));return}he(m,g.line,g.column)},children:i.jsx("span",{"aria-hidden":!0,children:"→"})})]})]}),i.jsx(Mi,{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":Z("editor.outputTabs"),children:[i.jsxs("button",{role:"tab","aria-selected":n==="pdf",className:`pdf-tab${n==="pdf"?" active":""}`,onClick:()=>_("pdf"),title:c?Z("editor.pdfCompiledAtFor",{file:e,time:new Date(c).toLocaleString(qe.resolvedLanguage)}):Z("editor.currentMainDocument",{path:e}),children:[i.jsx(Ws,{size:16}),i.jsxs("span",{className:"pdf-tab-label",children:["PDF · ",u,l&&i.jsx("small",{children:l})]})]}),i.jsxs("button",{role:"tab","aria-selected":n==="diagnostics",className:`diagnostics-tab${n==="diagnostics"?" active":""}`,onClick:()=>_("diagnostics"),children:[i.jsx(Fa,{size:14}),Z("editor.outputTabs"),i.jsx("span",{children:le})]})]}),d&&i.jsxs("a",{className:"pdf-download-top",href:d,download:!0,title:Z("editor.downloadPdf"),"aria-label":Z("editor.downloadPdf"),children:[i.jsx(Ar,{size:15}),i.jsx("span",{children:Z("editor.downloadPdf")})]})]}),n==="diagnostics"&&i.jsxs("div",{className:"preview-subtabs",role:"tablist","aria-label":Z("editor.outputTabs"),children:[i.jsxs("button",{role:"tab","aria-selected":s==="log",className:s==="log"?"active":"",onClick:()=>_("log"),children:[i.jsx(Fa,{size:13}),Z("editor.log")]}),i.jsxs("button",{role:"tab","aria-selected":s==="warnings",className:s==="warnings"?"active":"",onClick:()=>_("warnings"),children:[i.jsx(Zt,{size:13}),Z("editor.warnings"),i.jsx("span",{children:v.warnings.length})]}),i.jsxs("button",{role:"tab","aria-selected":s==="errors",className:s==="errors"?"active":"",onClick:()=>_("errors"),children:[i.jsx(ec,{size:13}),Z("editor.errors"),i.jsx("span",{children:v.errors.length})]}),i.jsxs("button",{role:"tab","aria-selected":s==="artifacts",className:s==="artifacts"?"active":"",onClick:()=>_("artifacts"),children:[i.jsx(Od,{size:13}),Z("editor.artifacts"),i.jsx("span",{children:j.length})]}),i.jsxs("button",{role:"tab","aria-selected":s==="clean",className:s==="clean"?"active":"",onClick:()=>_("clean"),children:[i.jsx(ha,{size:13}),Z("editor.clean")]})]}),i.jsxs("div",{className:`preview-content preview-${n} ${n==="diagnostics"?`preview-${s}`:""}`,children:[n==="pdf"&&(r?i.jsx(f.Suspense,{fallback:i.jsxs("div",{className:"pdf-loading-state",role:"status","aria-live":"polite",children:[i.jsx(at,{className:"spin",size:24}),i.jsx("span",{children:Z("editor.loadingPdf")})]}),children:i.jsx(z2,{url:r,loadingMode:o,target:h,compiling:y,onViewportLocation:(ue,O,te)=>k({page:ue,x:O,y:te}),onDoubleClickLocation:(ue,O,te)=>{if(k({page:ue,x:O,y:te}),!Fe){T(Z("editor.syncTexOnlyForMain"));return}be(ue,O,te)}})}):a?i.jsxs("div",{className:"pdf-loading-state",role:"status","aria-live":"polite",children:[i.jsx(at,{className:"spin",size:24}),i.jsx("span",{children:Z("editor.loadingPdf")})]}):i.jsxs("div",{className:"preview-empty",children:[i.jsx(Ws,{size:28}),i.jsx("strong",{children:Z("editor.preview")}),i.jsx("span",{children:Z("editor.previewHint")})]})),n==="diagnostics"&&s==="log"&&i.jsx(Zo,{lines:b?b.split(`
51
- `):[],empty:Z(y?"editor.compiling":"editor.noLog")}),n==="diagnostics"&&s==="warnings"&&(w?i.jsx(Ou,{tone:"warning",diagnostics:w.warnings,files:Ne,empty:Z("editor.noWarnings"),onJump:(ue,O,te)=>{X==="pdf-only"&&W("editor-pdf"),Ee(ue,O,te)}}):i.jsx(Zo,{tone:"warning",lines:v.warnings,empty:Z("editor.noWarnings")})),n==="diagnostics"&&s==="errors"&&(w?i.jsx(Ou,{tone:"error",diagnostics:w.errors,files:Ne,empty:Z("editor.noErrors"),onJump:(ue,O,te)=>{X==="pdf-only"&&W("editor-pdf"),Ee(ue,O,te)}}):i.jsx(Zo,{tone:"error",lines:v.errors,empty:Z("editor.noErrors")})),n==="diagnostics"&&s==="artifacts"&&i.jsx(I2,{projectId:t,mainFile:e,artifacts:j,preview:N,loading:z,onView:ue=>{J(ue)}}),n==="diagnostics"&&s==="clean"&&i.jsx(M2,{mainFile:e,disabled:U||!G||y,cleaning:V,onCleanCache:()=>B("cache"),onCleanArtifacts:()=>B("artifacts")})]})]})})]})}function Qo(t,e){!(t.ctrlKey||t.metaKey)||t.key!=="Enter"||t.nativeEvent.isComposing||(t.preventDefault(),t.stopPropagation(),e())}function V2({comment:t,currentUserId:e,onFocus:n,onToggle:s,onReply:r,onEdit:o,onDelete:a,onEditReply:c,onDeleteReply:l}){const{t:u}=st(),[d,h]=f.useState(!1),[D,m]=f.useState(""),[g,y]=f.useState(!1),[b,w]=f.useState(t.content),[v,j]=f.useState(!1),[N,z]=f.useState(null),[V,U]=f.useState(""),[G,X]=f.useState(null),K=async k=>{k?.preventDefault(),D.trim()&&await r(D)&&(m(""),h(!1))},le=async k=>{k?.preventDefault(),b.trim()&&await o(b)&&y(!1)},_=async k=>{k?.preventDefault(),!(!N||!V.trim())&&await c(N,V)&&z(null)},W=t.authorUsername,T=k=>new Date(k).toLocaleString(qe.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??W??u("editor.deletedUser")}),W&&i.jsxs("small",{children:["@",W]})]}),i.jsxs("span",{className:"comment-times",children:[i.jsx("time",{dateTime:t.createdAt,title:new Date(t.createdAt).toISOString(),children:T(t.createdAt)}),t.editedAt&&i.jsx("small",{children:u("editor.editedAt",{time:T(t.editedAt)})})]})]}),i.jsx("div",{className:"comment-location",children:t.orphaned?u("editor.orphaned"):u("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:k=>{le(k)},onClick:k=>k.stopPropagation(),children:[i.jsx("textarea",{autoFocus:!0,rows:4,value:b,onChange:k=>w(k.target.value),onKeyDown:k=>Qo(k,le)}),i.jsxs("div",{children:[i.jsx("button",{type:"button",onClick:()=>y(!1),children:u("common.cancel")}),i.jsxs("button",{className:"primary",type:"submit",disabled:!b.trim(),children:[i.jsx(yi,{size:13}),u("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(k=>i.jsxs("div",{className:"comment-reply",children:[i.jsxs("header",{children:[i.jsxs("span",{className:"comment-author",children:[i.jsx("strong",{children:k.authorDisplayName??k.authorUsername??u("editor.deletedUser")}),k.authorUsername&&i.jsxs("small",{children:["@",k.authorUsername]})]}),i.jsxs("span",{className:"comment-times",children:[i.jsx("time",{dateTime:k.createdAt,title:new Date(k.createdAt).toISOString(),children:T(k.createdAt)}),k.editedAt&&i.jsx("small",{children:u("editor.editedAt",{time:T(k.editedAt)})})]})]}),N===k.id?i.jsxs("form",{className:"comment-reply-form comment-edit-form",onSubmit:R=>{_(R)},onClick:R=>R.stopPropagation(),children:[i.jsx("textarea",{autoFocus:!0,rows:3,value:V,onChange:R=>U(R.target.value),onKeyDown:R=>Qo(R,_)}),i.jsxs("div",{children:[i.jsx("button",{type:"button",onClick:()=>z(null),children:u("common.cancel")}),i.jsxs("button",{className:"primary",type:"submit",disabled:!V.trim(),children:[i.jsx(yi,{size:13}),u("editor.saveChanges")]})]})]}):i.jsx("p",{className:"comment-content",children:k.content}),k.authorId===e&&N!==k.id&&i.jsxs("div",{className:"comment-owner-actions",children:[i.jsx("button",{title:u("editor.editReply"),"aria-label":u("editor.editReply"),onClick:R=>{R.stopPropagation(),z(k.id),U(k.content)},children:i.jsx(Da,{size:12})}),i.jsx("button",{className:"danger-text",title:u("editor.deleteReply"),"aria-label":u("editor.deleteReply"),onClick:R=>{R.stopPropagation(),X(k.id)},children:i.jsx(cn,{size:12})})]})]},k.id))}),i.jsxs("div",{className:"comment-actions",children:[i.jsxs("button",{className:"resolve",onClick:k=>{k.stopPropagation(),s()},children:[t.resolved?i.jsx(hg,{size:13}):i.jsx(Bd,{size:13}),t.resolved?u("editor.reopen"):u("editor.resolve")]}),i.jsxs("button",{className:"reply-action",onClick:k=>{k.stopPropagation(),h(R=>!R)},children:[i.jsx(dg,{size:13}),u("editor.reply")]}),t.authorId===e&&!g&&i.jsxs("span",{className:"comment-owner-actions",children:[i.jsx("button",{title:u("editor.editComment"),"aria-label":u("editor.editComment"),onClick:k=>{k.stopPropagation(),w(t.content),y(!0)},children:i.jsx(Da,{size:13})}),i.jsx("button",{className:"danger-text",title:u("editor.deleteComment"),"aria-label":u("editor.deleteComment"),onClick:k=>{k.stopPropagation(),j(!0)},children:i.jsx(cn,{size:13})})]})]}),d&&i.jsxs("form",{className:"comment-reply-form",onSubmit:k=>{K(k)},onClick:k=>k.stopPropagation(),children:[i.jsx("textarea",{autoFocus:!0,rows:3,value:D,placeholder:u("editor.replyPlaceholder"),onChange:k=>m(k.target.value),onKeyDown:k=>Qo(k,K)}),i.jsxs("div",{children:[i.jsx("button",{type:"button",onClick:()=>{h(!1),m("")},children:u("common.cancel")}),i.jsxs("button",{className:"primary",type:"submit",disabled:!D.trim(),children:[i.jsx(fg,{size:13}),u("editor.sendReply")]})]})]})]}),i.jsx(Jn,{open:v,title:u("editor.deleteCommentTitle"),description:u("editor.deleteCommentDescription",{count:t.replies.length}),confirmLabel:u("common.delete"),danger:!0,onCancel:()=>j(!1),onConfirm:()=>{a().then(k=>{k&&j(!1)})}}),i.jsx(Jn,{open:!!G,title:u("editor.deleteReplyTitle"),description:u("editor.deleteReplyDescription"),confirmLabel:u("common.delete"),danger:!0,onCancel:()=>X(null),onConfirm:()=>{G&&l(G).then(k=>{k&&X(null)})}})]})}function q2({open:t,onOpenChange:e,project:n,projectId:s}){const{t:r}=st(),[o,a]=f.useState([]),[c,l]=f.useState([]),[u,d]=f.useState(""),[h,D]=f.useState("read"),[m,g]=f.useState(null),[y,b]=f.useState(""),w=n.permission==="owner",v=async()=>{try{const[U,G]=await Promise.all([ee(`/api/projects/${s}/members`),ee("/api/users")]);a(U.members),l(G.users.filter(X=>X.id!==n.ownerId))}catch(U){b(de(U))}};f.useEffect(()=>{t&&v()},[t,s]);const j=async()=>{if(u)try{await ee(`/api/projects/${s}/members/${u}`,{method:"PUT",body:JSON.stringify({permission:h})}),d(""),D("read"),await v()}catch(U){b(de(U))}},N=async(U,G)=>{try{await ee(`/api/projects/${s}/members/${U.id}`,{method:"PUT",body:JSON.stringify({permission:G})}),await v()}catch(X){b(de(X))}},z=async()=>{if(m)try{await ee(`/api/projects/${s}/members/${m.id}`,{method:"DELETE"}),g(null),await v()}catch(U){b(de(U))}},V=c.filter(U=>!o.some(G=>G.id===U.id));return i.jsxs(i.Fragment,{children:[i.jsx(pt,{open:t,wide:!0,title:r("projectSettings.share"),description:r("projectSettings.shareDescription"),onOpenChange:e,footer:i.jsx("button",{onClick:()=>e(!1),children:r("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(kr,{size:17}),i.jsxs("span",{children:[i.jsx("small",{children:r("projects.owner")}),i.jsx("strong",{children:n.ownerDisplayName??n.ownerUsername})]})]}),w&&i.jsxs("div",{className:"share-add",children:[i.jsxs("label",{className:"form-field",children:[r("common.user"),i.jsxs("select",{value:u,onChange:U=>d(U.target.value),children:[i.jsx("option",{value:"",children:r("projectSettings.chooseUser")}),V.map(U=>i.jsx("option",{value:U.id,children:U.displayName??U.username},U.id))]})]}),i.jsxs("label",{className:"form-field",children:[r("common.permission"),i.jsxs("select",{value:h,onChange:U=>D(U.target.value),children:[i.jsx("option",{value:"read",children:r("common.readOnly")}),i.jsx("option",{value:"edit",children:r("common.readWrite")})]})]}),i.jsxs("button",{className:"primary icon-button",disabled:!u,onClick:()=>{j()},children:[i.jsx(Ea,{size:15}),r("projectSettings.addMember")]})]}),i.jsxs("div",{className:"shared-members-heading",children:[i.jsx("strong",{children:r("projectSettings.members")}),i.jsx("span",{children:o.length})]}),i.jsxs("div",{className:"shared-members",children:[o.map(U=>i.jsxs("div",{className:"shared-member",children:[i.jsxs("span",{className:"member-identity",children:[i.jsx("span",{className:"member-avatar",children:(U.displayName??U.username).slice(0,1).toLocaleUpperCase()}),i.jsxs("span",{children:[i.jsx("strong",{children:U.displayName??U.username}),i.jsxs("small",{children:["@",U.username]})]})]}),i.jsxs("span",{className:"member-controls",children:[i.jsxs("select",{"aria-label":r("common.permission"),disabled:!w,value:U.permission,onChange:G=>{N(U,G.target.value)},children:[i.jsx("option",{value:"read",children:r("common.readOnly")}),i.jsx("option",{value:"edit",children:r("common.readWrite")})]}),w&&i.jsx("button",{className:"icon-only danger-text",title:r("common.remove"),"aria-label":r("common.remove"),onClick:()=>g(U),children:i.jsx(cn,{size:15})})]})]},U.id)),o.length===0&&i.jsxs("div",{className:"share-empty",children:[i.jsx(kr,{size:24}),i.jsx("span",{children:r("projectSettings.noMembers")})]})]})]})}),i.jsx(Jn,{open:!!m,title:r("projectSettings.removeTitle"),description:r("projectSettings.removeDescription",{username:m?.username??""}),confirmLabel:r("common.remove"),danger:!0,onCancel:()=>g(null),onConfirm:()=>{z()}})]})}const W2=f.lazy(()=>ts(()=>import("./GitDialog-CZRQPg3O.js"),__vite__mapDeps([8,1,3])).then(t=>({default:t.GitDialog}))),K2=f.lazy(()=>ts(()=>import("./HistoryDialog-BQtr58Co.js"),__vite__mapDeps([9,1])).then(t=>({default:t.HistoryDialog}))),G2=f.lazy(()=>ts(()=>import("./ProjectNavigationDialogs-BdtTldSa.js"),__vite__mapDeps([10,1])).then(t=>({default:t.ProjectSearchDialog}))),Y2=f.lazy(()=>ts(()=>import("./ProjectNavigationDialogs-BdtTldSa.js"),__vite__mapDeps([10,1])).then(t=>({default:t.QuickOpenDialog})));function X2({user:t,project:e,projectId:n,activeFile:s,content:r,maxCitationBibtexBytes:o,files:a,directoryEntries:c,readOnly:l,workspaceLayout:u,changeWorkspaceLayout:d,resourcePreview:h,resourcePreviewLoading:D,setResourcePreview:m,setResourcePreviewLoading:g,uploadConflict:y,setUploadConflict:b,uploadFiles:w,cleanMode:v,setCleanMode:j,cleanCompile:N,newFileOpen:z,setNewFileOpen:V,newFilePath:U,setNewFilePath:G,newFolderOpen:X,setNewFolderOpen:K,newFolderName:le,setNewFolderName:_,selectedFolder:W,fileDialogError:T,setFileDialogError:k,createFile:R,createFolder:he,moveEntry:be,setMoveEntry:Fe,moveName:Ne,setMoveName:Ee,moveDestination:B,setMoveDestination:me,movePath:J,deleteEntry:Z,setDeleteEntry:ue,deleteActiveSessions:O,removePath:te,commentOpen:A,setCommentOpen:De,selection:Ce,commentText:Ve,setCommentText:lt,addComment:We,shareOpen:Ue,setShareOpen:ye,citationLibraryOpen:Ke,setCitationLibraryOpen:Je,insertCitationAtCursor:mt,quickOpen:ge,setQuickOpen:xt,projectSearchOpen:ce,setProjectSearchOpen:ke,openFile:Re,jumpToSource:Dt,historyOpen:Me,setHistoryOpen:H,gitOpen:fe,setGitOpen:q,save:ze,permissionDowngrade:Ge,permissionDowngradeBusy:tt,dismissPermissionDowngrade:xe,discardPermissionDraft:vt}){const{t:ne}=st();return i.jsxs(i.Fragment,{children:[Ge&&i.jsx(pt,{open:!0,title:ne("editor.collaboration.permissionDowngradeTitle"),description:Ge.localDraftReady&&Ge.otherTabDraft?ne("editor.collaboration.permissionDowngradeMultipleDrafts"):Ge.otherTabDraft?ne("editor.collaboration.permissionDowngradeOtherTab"):Ge.localDraftReady?ne("editor.collaboration.permissionDowngradeDescription",{previous:ne("common.readWrite")}):ne("editor.collaboration.permissionDowngradeNoDraft"),onOpenChange:$=>{!$&&!tt&&xe()},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",disabled:tt,onClick:xe,children:Ge.localDraftReady?ne("editor.collaboration.permissionDowngradeKeep"):ne("common.close")}),!Ge.otherTabDraft&&i.jsxs("button",{type:"button",className:"danger",disabled:tt,onClick:()=>{vt()},children:[tt?i.jsx(at,{className:"spin",size:14}):Ge.localDraftReady?i.jsx(cn,{size:14}):i.jsx(ga,{size:14}),Ge.localDraftReady?ne("editor.collaboration.permissionDowngradeDiscard"):ne("editor.collaboration.permissionDowngradeReload")]})]}),children:i.jsx("div",{})}),i.jsxs(pt,{open:!!h,extraWide:h?.kind==="image"||h?.kind==="pdf"||h?.kind==="text",title:h?.path??"",description:h?.kind==="large"?ne("editor.resourceTooLarge",{size:J2(h.size),limit:`${Ma/1024/1024} MB`}):ne(`editor.resourcePreview.${h?.kind??"text"}`),onOpenChange:$=>{$||(m(null),g(!1))},footer:h&&i.jsxs("a",{className:"primary resource-download",href:`${h.url}&download=1`,download:!0,children:[i.jsx(Ar,{size:14}),ne("editor.downloadResource")]}),children:[h?.kind==="large"&&i.jsxs("div",{className:"resource-preview-message",children:[i.jsx(fa,{size:34}),i.jsx("strong",{children:ne("editor.resourceTooLargeTitle")}),i.jsx("span",{children:ne("editor.resourceTooLargeDescription")})]}),h?.kind==="unsupported"&&i.jsxs("div",{className:"resource-preview-message",children:[i.jsx(fa,{size:34}),i.jsx("strong",{children:ne("editor.resourceUnsupportedTitle")}),i.jsx("span",{children:ne("editor.resourceUnsupportedDescription")})]}),h?.kind==="image"&&i.jsx("div",{className:"resource-image-wrap",children:i.jsx("img",{className:"resource-image",src:h.url,alt:h.path})}),h?.kind==="pdf"&&i.jsx("iframe",{className:"resource-pdf",src:h.url,title:h.path}),h?.kind==="text"&&(D?i.jsxs("div",{className:"resource-preview-message",children:[i.jsx(at,{className:"spin",size:24}),i.jsx("span",{children:ne("common.loading")})]}):i.jsx("pre",{className:"resource-text",children:h.content}))]}),i.jsx(Jn,{open:!!y,title:ne("editor.uploadOverwriteTitle"),description:ne("editor.uploadOverwriteDescription",{files:y?.collisions.join(", ")??""}),confirmLabel:ne("editor.uploadOverwrite"),danger:!0,onCancel:()=>b(null),onConfirm:()=>{const $=y;b(null),$&&w($.files,new Set($.collisions),$.directory)}}),i.jsx(Jn,{open:!!v,title:ne(v==="cache"?"editor.cleanCacheConfirmTitle":"editor.cleanArtifactsConfirmTitle"),description:ne(v==="cache"?"editor.cleanCacheConfirmDescription":"editor.cleanArtifactsConfirmDescription"),confirmLabel:ne("editor.cleanConfirm"),danger:v==="artifacts",onCancel:()=>j(null),onConfirm:()=>{const $=v;j(null),$&&N($)}}),i.jsx(pt,{open:z,title:ne("editor.newFile"),description:ne("editor.newFileDescription"),onOpenChange:$=>{V($),$||k("")},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>V(!1),children:ne("common.cancel")}),i.jsx("button",{className:"primary",onClick:()=>{R()},children:ne("common.create")})]}),children:i.jsxs(i.Fragment,{children:[T&&i.jsx("p",{className:"error dialog-error",children:T}),i.jsxs("label",{className:"form-field",children:[ne("editor.filePath"),i.jsx("input",{autoFocus:!0,value:U,onChange:$=>G($.target.value),onKeyDown:$=>{$.key==="Enter"&&!$.nativeEvent.isComposing&&($.preventDefault(),R())}})]})]})}),i.jsx(pt,{open:X,title:ne("editor.newFolder"),description:ne("editor.folderDestination",{folder:W||ne("editor.projectRoot")}),onOpenChange:$=>{K($),$||k("")},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>K(!1),children:ne("common.cancel")}),i.jsx("button",{className:"primary",onClick:()=>{he()},children:ne("common.create")})]}),children:i.jsxs(i.Fragment,{children:[T&&i.jsx("p",{className:"error dialog-error",children:T}),i.jsxs("label",{className:"form-field",children:[ne("editor.folderName"),i.jsx("input",{autoFocus:!0,value:le,onChange:$=>_($.target.value),onKeyDown:$=>{$.key==="Enter"&&he()}})]})]})}),i.jsx(pt,{open:!!be,title:ne("editor.moveTitle",{name:be?.path.split("/").at(-1)??""}),description:ne("editor.moveDescription"),onOpenChange:$=>{$||(Fe(null),Ee(""),k(""))},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>Fe(null),children:ne("common.cancel")}),i.jsx("button",{className:"primary",disabled:!Ne.trim(),onClick:()=>{J()},children:ne("editor.moveApply")})]}),children:i.jsxs(i.Fragment,{children:[T&&i.jsx("p",{className:"error dialog-error",children:T}),i.jsxs("label",{className:"form-field",children:[ne("editor.pathName"),i.jsx("input",{autoFocus:!0,value:Ne,onChange:$=>Ee($.target.value),onKeyDown:$=>{$.key==="Enter"&&J()}})]}),i.jsxs("label",{className:"form-field",children:[ne("editor.destinationFolder"),i.jsxs("select",{value:B,onChange:$=>me($.target.value),children:[i.jsx("option",{value:"",children:ne("editor.projectRoot")}),c.filter($=>be?.type!=="directory"||$.path!==be.path&&!$.path.startsWith(`${be.path}/`)).map($=>i.jsx("option",{value:$.path,children:$.path},$.path))]})]})]})}),i.jsx(pt,{open:!!Z,title:ne("editor.deletePathTitle",{name:Z?.path.split("/").at(-1)??""}),description:O.length?ne("editor.deletePathActiveDescription",{path:Z?.path??"",users:[...new Set(O.map($=>$.name))].join(", ")}):ne("editor.deletePathDescription",{path:Z?.path??""}),onOpenChange:$=>{$||(ue(null),k(""))},footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>ue(null),children:ne("common.cancel")}),i.jsx("button",{className:"danger",onClick:()=>{te()},children:ne("common.delete")})]}),children:i.jsxs(i.Fragment,{children:[T&&i.jsx("p",{className:"error dialog-error",children:T}),O.length>0&&i.jsxs("p",{className:"warning",children:[i.jsx(Zt,{size:15}),ne("editor.deletePathWillClose")]})]})}),i.jsxs(pt,{open:A,title:ne("editor.addComment"),description:Ce.selectedText?ne("editor.commentDescription",{count:Ce.endOffset-Ce.startOffset}):ne("editor.pointComment"),onOpenChange:De,footer:i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>De(!1),children:ne("common.cancel")}),i.jsx("button",{className:"primary",onClick:()=>{We()},children:ne("editor.addComment")})]}),children:[i.jsxs("label",{className:"form-field",children:[ne("editor.commentContent"),i.jsx("textarea",{autoFocus:!0,rows:5,value:Ve,onChange:$=>lt($.target.value),onKeyDown:$=>{($.ctrlKey||$.metaKey)&&$.key==="Enter"&&!$.nativeEvent.isComposing&&($.preventDefault(),$.stopPropagation(),We())}})]}),Ce.selectedText&&i.jsx("blockquote",{className:"selection-preview",children:Ce.selectedText})]}),i.jsx(q2,{open:Ue,onOpenChange:ye,project:e,projectId:n}),i.jsx(Hd,{open:Ke,onOpenChange:Je,currentFile:s,currentSource:r,readOnly:l,currentUserId:t.id,maxBibtexBytes:o,onInsert:mt}),ge&&i.jsx(f.Suspense,{fallback:null,children:i.jsx(Y2,{open:!0,files:a,onOpenChange:xt,onOpenFile:$=>{const ut=a.find(Bt=>Bt.path===$);ut&&Re(ut)}})}),ce&&i.jsx(f.Suspense,{fallback:null,children:i.jsx(G2,{open:!0,project:e,onOpenChange:ke,onJump:($,ut,Bt)=>{u==="pdf-only"&&d("editor-pdf"),Dt($,ut,Bt)}})}),Me&&i.jsx(f.Suspense,{fallback:null,children:i.jsx(K2,{open:!0,onOpenChange:H,project:e,onBeforeMutation:e.permission==="read"?async()=>!0:ze})}),e.ownerId===t.id&&fe&&i.jsx(f.Suspense,{fallback:null,children:i.jsx(W2,{open:!0,onOpenChange:q,project:e,onBeforeMutation:ze})})]})}function J2(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/1024/1024).toFixed(1)} MB`}function Z2({name:t,state:e,label:n,reloadLabel:s,onReload:r,compact:o=!1}){const a=e.status==="loading"?i.jsx(at,{className:"spin",size:14}):e.status==="working"?i.jsx(Bd,{size:14}):i.jsx(W0,{size:14}),c=i.jsxs(i.Fragment,{children:[a,i.jsx("strong",{children:t}),i.jsx("span",{children:n}),e.status==="error"&&i.jsxs("button",{type:"button",className:"browser-tool-reload",title:s,"aria-label":s,onClick:r,children:[i.jsx(ga,{size:12}),s]})]});return o?i.jsxs("span",{className:`browser-tool-status compact ${e.status}`,role:"status","aria-live":"polite","aria-label":`${t}: ${n}`,title:e.error||void 0,children:[a,i.jsx("span",{children:n}),e.status==="error"&&i.jsx("button",{type:"button",className:"browser-tool-reload",title:s,"aria-label":s,onClick:r,children:i.jsx(ga,{size:12})})]}):i.jsx("div",{className:`browser-tool-status ${e.status}`,title:e.error||void 0,children:c})}function Q2({project:t,projectId:e,site:n,files:s,dictionaryWords:r,onDictionaryChange:o,editorPreferences:a,onEditorPreferences:c,spellCheckCount:l,spellCheckUniqueCount:u,spellCheckIndex:d,onSpellCheckNavigate:h,onProject:D}){const{t:m}=st(),[g,y]=f.useState(t.engine),[b,w]=f.useState(""),[v,j]=f.useState(t.name),[N,z]=f.useState(t.mainFile),[V,U]=f.useState(null),[G,X]=f.useState(""),[K,le]=f.useState(""),[_,W]=f.useState(""),[T,k]=f.useState("appearance"),[R,he]=f.useState(a),be=f.useSyncExternalStore(Jt.subscribe,Jt.getSnapshot,Jt.getSnapshot),Fe=t.permission==="owner",Ne=t.permission!=="read",Ee=t.permission!=="read";f.useEffect(()=>he(a),[a]),f.useEffect(()=>{Wd().catch(Jt.failed)},[e]);const B=()=>{Kg().catch(Jt.failed)};f.useEffect(()=>{if(!t.latexmkrc)return w("");ee(`/api/projects/${e}/file?path=${encodeURIComponent(t.latexmkrc)}`).then(({content:A})=>w(A)).catch(A=>X(de(A)))},[t.latexmkrc]),f.useEffect(()=>{if(T!=="compiler")return;const A=new AbortController;return U(null),ee(`/api/projects/${e}/main-files`,{signal:A.signal}).then(De=>U(De.mainFiles)).catch(De=>{De instanceof Error&&De.name==="AbortError"||X(de(De))}),()=>A.abort()},[e,s,T]);const me=V??[t.mainFile],J=V!==null&&!V.includes(N),Z=async()=>{try{const A=b.trim()&&n.allowProjectLatexmkrc!==!1?".latexmkrc":null;A&&await ee(`/api/projects/${e}/file`,{method:"PUT",body:JSON.stringify({path:A,content:b})});const De=await ee(`/api/projects/${e}`,{method:"PATCH",body:JSON.stringify({name:v,mainFile:N,engine:g,latexmkrc:A})});D(De.project)}catch(A){X(de(A))}},ue=()=>c(R),O=async()=>{const A=K.trim();if(A)try{const De=await ee(`/api/projects/${e}/dictionary`,{method:"POST",body:JSON.stringify({word:A})});o(De.words),le(""),W("")}catch(De){W(de(De))}},te=async A=>{try{const De=await ee(`/api/projects/${e}/dictionary/${encodeURIComponent(A)}`,{method:"DELETE"});o(De.words),W("")}catch(De){W(de(De))}};return i.jsxs("div",{className:"settings padded",children:[G&&i.jsx("p",{className:"error",children:G}),i.jsxs("div",{className:"settings-tabs",role:"tablist","aria-label":m("common.settings"),children:[i.jsxs("button",{id:"settings-tab-appearance",type:"button",role:"tab","aria-selected":T==="appearance","aria-controls":"settings-panel-appearance",className:`settings-tab${T==="appearance"?" active":""}`,onClick:()=>k("appearance"),children:[i.jsx(Ca,{size:15}),m("projectSettings.editorTab")]}),i.jsxs("button",{id:"settings-tab-compiler",type:"button",role:"tab","aria-selected":T==="compiler","aria-controls":"settings-panel-compiler",className:`settings-tab${T==="compiler"?" active":""}`,onClick:()=>k("compiler"),children:[i.jsx(ba,{size:15}),m("projectSettings.compilerTab")]})]}),T==="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(Ca,{size:15}),i.jsx("strong",{children:m("projectSettings.editorAppearance")})]}),i.jsx("p",{className:"settings-description appearance-description",children:m("projectSettings.editorAppearanceDescription")}),i.jsxs("label",{children:[m("projectSettings.fontFamily"),i.jsx("select",{value:R.font,onChange:A=>he({...R,font:A.target.value}),children:Ei.map(A=>i.jsx("option",{value:A.id,children:m(A.labelKey)},A.id))})]}),i.jsxs("label",{children:[m("projectSettings.fontSize"),i.jsx("select",{value:R.fontSize,onChange:A=>he({...R,fontSize:Number(A.target.value)}),children:[12,13,14,15,16,18,20].map(A=>i.jsxs("option",{value:A,children:[A," px"]},A))})]}),i.jsxs("label",{children:[m("projectSettings.lineHeight"),i.jsxs("select",{value:R.lineHeight,onChange:A=>he({...R,lineHeight:Number(A.target.value)}),children:[i.jsx("option",{value:1.45,children:m("projectSettings.lineHeightCompact")}),i.jsx("option",{value:1.65,children:m("projectSettings.lineHeightNormal")}),i.jsx("option",{value:1.85,children:m("projectSettings.lineHeightRelaxed")})]})]}),i.jsxs("label",{className:"editor-checkbox",children:[i.jsx("input",{type:"checkbox",checked:R.lineWrapping,onChange:A=>he({...R,lineWrapping:A.target.checked})}),i.jsx(yg,{size:15}),i.jsx("span",{children:m("projectSettings.lineWrapping")})]}),i.jsxs("div",{className:"editor-preference",children:[i.jsxs("label",{className:"editor-checkbox",children:[i.jsx("input",{type:"checkbox",checked:R.spellCheck,onChange:A=>he({...R,spellCheck:A.target.checked})}),i.jsx("span",{children:m("projectSettings.spellCheck")})]}),i.jsxs("p",{className:"field-hint",children:[m("projectSettings.writingCheckDescription")," ",i.jsx("a",{href:"https://writewithharper.com/docs/integrations/language-server",target:"_blank",rel:"noreferrer",children:"Harper"})]})]}),i.jsxs("div",{className:"editor-preference",children:[i.jsxs("label",{className:"editor-checkbox",children:[i.jsx("input",{type:"checkbox",checked:R.vimMode,onChange:A=>he({...R,vimMode:A.target.checked})}),i.jsx("span",{children:m("projectSettings.vimMode")})]}),i.jsxs("p",{className:"field-hint",children:[m("projectSettings.vimModeDescription")," ",i.jsx("a",{href:"https://replit-codemirror-vim.mintlify.app/",target:"_blank",rel:"noreferrer",children:m("projectSettings.vimHelp")})]})]}),i.jsxs("div",{className:"editor-preference",children:[i.jsxs("label",{className:"editor-checkbox",children:[i.jsx("input",{type:"checkbox",checked:R.openFilesInTabs,onChange:A=>he({...R,openFilesInTabs:A.target.checked})}),i.jsx(cg,{size:15}),i.jsx("span",{children:m("projectSettings.openFilesInTabs")})]}),i.jsx("p",{className:"field-hint",children:m("projectSettings.openFilesInTabsDescription")})]}),i.jsxs("div",{className:"editor-preference",children:[i.jsxs("label",{className:"editor-checkbox",children:[i.jsx("input",{type:"checkbox",disabled:!Ne,checked:R.formatOnCompile,onChange:A=>he({...R,formatOnCompile:A.target.checked})}),i.jsx(jd,{size:15}),i.jsx("span",{children:m("projectSettings.formatOnCompile")})]}),i.jsxs("p",{className:"field-hint",children:[m(Ne?"projectSettings.formatOnCompileDescription":"projectSettings.formatRequiresWrite")," ",m("projectSettings.formatterDescription")," ",i.jsx("a",{href:"https://www.npmjs.com/package/tex-fmt",target:"_blank",rel:"noreferrer",children:m("projectSettings.formatterInstall")})," · ",i.jsx("a",{href:"https://github.com/FlamingTempura/bibtex-tidy",target:"_blank",rel:"noreferrer",children:m("projectSettings.bibtexTidyInstall")})]})]}),i.jsxs("div",{className:"editor-preference",children:[i.jsxs("label",{className:"tex-fmt-options-field",children:[i.jsxs("span",{className:"tex-fmt-options-heading",children:[i.jsx("span",{children:m("projectSettings.texFmtOptions")}),i.jsx(Z2,{compact:!0,name:"tex-fmt",state:be,label:m(`projectSettings.toolStatus.${be.status}`),reloadLabel:m("projectSettings.reloadTool"),onReload:B})]}),i.jsx("textarea",{className:"tex-fmt-options-editor",rows:6,maxLength:16*1024,spellCheck:!1,value:R.texFmtConfig,placeholder:m("projectSettings.texFmtOptionsPlaceholder"),onChange:A=>he({...R,texFmtConfig:A.target.value})})]}),i.jsx("p",{className:"field-hint",children:m("projectSettings.texFmtOptionsDescription")})]}),l!==null&&i.jsxs("div",{className:`spell-check-result${l?" has-issues":""}`,role:"status","aria-live":"polite",children:[i.jsx(gg,{size:14}),i.jsx("span",{children:l?m("projectSettings.writingIssues",{count:l,uniqueCount:u??0}):m("projectSettings.noWritingIssues")}),l>0&&i.jsxs("span",{className:"spell-check-controls",children:[i.jsx("button",{type:"button",title:m("projectSettings.spellCheckFirst"),"aria-label":m("projectSettings.spellCheckFirst"),disabled:d<=0,onClick:()=>h(0),children:i.jsx(V0,{size:14})}),i.jsx("button",{type:"button",title:m("projectSettings.spellCheckPrevious"),"aria-label":m("projectSettings.spellCheckPrevious"),disabled:d<=0,onClick:()=>h(d-1),children:i.jsx(Cr,{size:14})}),i.jsx("span",{className:"spell-check-position",children:m("projectSettings.spellCheckPosition",{current:Math.min(d+1,l),total:l})}),i.jsx("button",{type:"button",title:m("projectSettings.spellCheckNext"),"aria-label":m("projectSettings.spellCheckNext"),disabled:d>=l-1,onClick:()=>h(d+1),children:i.jsx(Hi,{size:14})}),i.jsx("button",{type:"button",title:m("projectSettings.spellCheckLast"),"aria-label":m("projectSettings.spellCheckLast"),disabled:d>=l-1,onClick:()=>h(l-1),children:i.jsx(q0,{size:14})})]})]}),i.jsxs("div",{className:"settings-section-title",children:[i.jsx(Qa,{size:15}),i.jsx("strong",{children:m("projectSettings.dictionary")})]}),i.jsx("p",{className:"settings-description",children:m("projectSettings.dictionaryDescription")}),_&&i.jsx("p",{className:"error dictionary-error",children:_}),Ee&&i.jsxs("div",{className:"dictionary-add",children:[i.jsx("input",{value:K,placeholder:m("projectSettings.dictionaryPlaceholder"),onChange:A=>le(A.target.value),onKeyDown:A=>{A.key==="Enter"&&(A.preventDefault(),O())}}),i.jsx("button",{type:"button",disabled:!K.trim(),onClick:()=>{O()},children:m("projectSettings.addWord")})]}),i.jsxs("div",{className:"dictionary-words",children:[r.map(A=>i.jsxs("span",{className:"dictionary-word",children:[i.jsx("code",{children:A}),Ee&&i.jsx("button",{type:"button",title:m("common.delete"),"aria-label":`${m("common.delete")} ${A}`,onClick:()=>{te(A)},children:i.jsx(Vt,{size:13})})]},A)),r.length===0&&i.jsx("span",{className:"dictionary-empty",children:m("projectSettings.dictionaryEmpty")})]}),i.jsx("div",{className:"settings-actions",children:i.jsxs("button",{className:"settings-save",onClick:ue,children:[i.jsx(yi,{size:15}),m("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(ba,{size:15}),i.jsx("strong",{children:m("projectSettings.compilerTab")})]}),i.jsx("p",{className:"settings-description compiler-description",children:m("projectSettings.compilerDescription")}),i.jsxs("label",{children:[m("projects.name"),i.jsx("input",{disabled:!Fe,value:v,onChange:A=>j(A.target.value)})]}),i.jsxs("label",{children:[m("projectSettings.mainFile"),i.jsxs("select",{disabled:!Fe||V===null||V.length===0,value:N,onChange:A=>z(A.target.value),children:[J&&i.jsx("option",{value:N,disabled:!0,children:m("projectSettings.invalidMainFileOption",{path:N})}),me.map(A=>i.jsx("option",{value:A,children:A},A))]})]}),i.jsxs("label",{children:[m("projectSettings.engine"),i.jsx("select",{disabled:!Fe,value:g,onChange:A=>y(A.target.value),children:(n.allowedEngines??["pdflatex","xelatex","lualatex"]).map(A=>i.jsx("option",{children:A},A))})]}),i.jsxs("label",{children:[m("projectSettings.latexmkrc"),i.jsx("textarea",{className:"latexmkrc-editor",rows:10,spellCheck:!1,disabled:!Fe||n.allowProjectLatexmkrc===!1,value:b,placeholder:m("projectSettings.latexmkrcPlaceholder"),onChange:A=>w(A.target.value)})]}),i.jsx("div",{className:"settings-actions",children:Fe&&i.jsxs("button",{className:"settings-save",onClick:()=>{Z()},children:[i.jsx(yi,{size:15}),m("projectSettings.saveCompiler")]})})]})]})}function eC({sidePanel:t,onClose:e,project:n,projectId:s,site:r,files:o,currentUserId:a,comments:c,onFocusComment:l,onToggleComment:u,onReplyComment:d,onEditComment:h,onDeleteComment:D,onEditCommentReply:m,onDeleteCommentReply:g,dictionaryWords:y,onDictionaryChange:b,editorPreferences:w,onEditorPreferences:v,spellCheckCount:j,spellCheckUniqueCount:N,spellCheckIndex:z,onSpellCheckNavigate:V,onProject:U}){const{t:G}=st();return t?i.jsxs(i.Fragment,{children:[i.jsx($a,{className:"resize-handle"}),i.jsx(Mi,{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:G(t==="comments"?"editor.sourceComments":"editor.projectSettings")}),i.jsx("button",{"aria-label":G("common.close"),onClick:e,children:i.jsx(Vt,{size:17})})]}),t==="comments"&&i.jsxs("div",{className:"comments",children:[c.map(X=>i.jsx(V2,{comment:X,currentUserId:a,onFocus:()=>l(X),onToggle:()=>{u(X)},onReply:K=>d(X,K),onEdit:K=>h(X,K),onDelete:()=>D(X),onEditReply:(K,le)=>m(X,K,le),onDeleteReply:K=>g(X,K)},X.id)),c.length===0&&i.jsx("p",{className:"muted padded",children:G("editor.noComments")})]}),t==="settings"&&i.jsx(Q2,{project:n,projectId:s,site:r,files:o,dictionaryWords:y,onDictionaryChange:b,editorPreferences:w,onEditorPreferences:v,spellCheckCount:j,spellCheckUniqueCount:N,spellCheckIndex:z,onSpellCheckNavigate:V,onProject:U})]})})]}):null}function tC({open:t,mode:e,path:n,busy:s,error:r,result:o,onOpenChange:a}){const{t:c}=st(),l=c(e==="full"?"editor.wordCountFullHint":"editor.wordCountSelectionHint");return i.jsxs(pt,{open:t,title:c("editor.wordCountTitle"),description:l,onOpenChange:a,footer:i.jsx("button",{type:"button",onClick:()=>a(!1),children:c("common.close")}),children:[n&&i.jsxs("p",{className:"word-count-source",children:[c(e==="full"?"editor.wordCountFull":"editor.wordCountSelection")," · ",i.jsx("code",{children:n}),i.jsx("a",{href:"https://app.uio.no/ifi/texcount/",target:"_blank",rel:"noreferrer",children:c("editor.wordCountHelp")})]}),i.jsx("p",{className:"word-count-template-note",children:c("editor.wordCountTemplateNote")}),s&&i.jsxs("div",{className:"word-count-loading",role:"status","aria-live":"polite",children:[i.jsx(at,{className:"spin",size:22}),i.jsx("span",{children:c("editor.wordCountLoading")})]}),r&&i.jsx("p",{className:"error dialog-error",children:r}),o&&!s&&i.jsxs("div",{className:"word-count-result","aria-live":"polite",children:[i.jsxs("div",{className:"word-count-totals",children:[i.jsxs("div",{className:"word-count-total",children:[i.jsx(ma,{size:20}),i.jsx("strong",{children:o.totalWords.toLocaleString()}),i.jsx("span",{children:c("editor.wordCountTotal")})]}),i.jsxs("div",{className:"word-count-total word-count-characters",children:[i.jsx(Ca,{size:20}),i.jsx("strong",{children:o.totalCharacters.toLocaleString()}),i.jsxs("span",{children:[c("editor.wordCountCharacters"),i.jsx("small",{children:c("editor.wordCountCharactersHint")})]})]})]}),i.jsxs("dl",{className:"word-count-breakdown",children:[i.jsxs("div",{children:[i.jsx("dt",{children:c("editor.wordCountText")}),i.jsxs("dd",{children:[o.textWords.toLocaleString(),i.jsx("small",{children:c("editor.wordCountWordsUnit")})]})]}),i.jsxs("div",{children:[i.jsx("dt",{children:c("editor.wordCountHeaders")}),i.jsxs("dd",{children:[o.headerWords.toLocaleString(),i.jsx("small",{children:c("editor.wordCountWordsUnit")})]})]}),i.jsxs("div",{children:[i.jsx("dt",{children:c("editor.wordCountCaptions")}),i.jsxs("dd",{children:[o.captionWords.toLocaleString(),i.jsx("small",{children:c("editor.wordCountWordsUnit")})]})]}),i.jsxs("div",{children:[i.jsx("dt",{children:c("editor.wordCountFloats")}),i.jsxs("dd",{children:[o.floats.toLocaleString(),i.jsx("small",{children:c("editor.wordCountItemsUnit")})]})]}),i.jsxs("div",{children:[i.jsx("dt",{children:c("editor.wordCountInlineMath")}),i.jsxs("dd",{children:[o.inlineMath.toLocaleString(),i.jsx("small",{children:c("editor.wordCountExpressionsUnit")})]})]}),i.jsxs("div",{children:[i.jsx("dt",{children:c("editor.wordCountDisplayMath")}),i.jsxs("dd",{children:[o.displayMath.toLocaleString(),i.jsx("small",{children:c("editor.wordCountExpressionsUnit")})]})]}),o.files!==null&&i.jsxs("div",{children:[i.jsx("dt",{children:c("editor.wordCountFiles")}),i.jsxs("dd",{children:[o.files.toLocaleString(),i.jsx("small",{children:c("editor.wordCountItemsUnit")})]})]})]}),o.parserErrors>0&&i.jsxs("p",{className:"warning word-count-warning",children:[i.jsx(Zt,{size:14}),c("editor.wordCountParserErrors",{count:o.parserErrors})]})]})]})}function Ss(t){return t instanceof Error&&t.name==="AbortError"}function nC({site:t,user:e,projectId:n,preload:s,onBack:r}){const{t:o}=st(),[a,c]=f.useState(null),[l,u]=f.useState(!1),[d,h]=f.useState([]),[D,m]=f.useState(null),[g,y]=f.useState([]),[b,w]=f.useState(""),[v,j]=f.useState(""),[N,z]=f.useState(new Set),[V,U]=f.useState(""),[G,X]=f.useState(""),[K,le]=f.useState(!1),[_,W]=f.useState("editor.saved"),[T,k]=f.useState(null),R=f.useRef(T);R.current=T;const[he,be]=f.useState({line:1,column:1}),Fe=f.useRef(he),Ne=f.useRef(0),[Ee,B]=f.useState("pdf"),[me,J]=f.useState("log"),Z=x=>{if(x==="pdf"){B("pdf");return}if(x==="diagnostics"){B("diagnostics");return}J(x),B("diagnostics")},{workspaceLayout:ue,setWorkspaceLayout:O}=j2(e.id,n),[te,A]=f.useState(""),[De,Ce]=f.useState(""),[Ve,lt]=f.useState({selectedText:"",startOffset:0,endOffset:0}),We=f.useRef({selectedText:"",startOffset:0,endOffset:0}),Ue=x=>{We.current=x,lt(x)},[ye,Ke]=f.useState(null),[Je,mt]=f.useState(!1),[ge,xt]=f.useState(!1),[ce,ke]=f.useState(!1),[Re,Dt]=f.useState(!1),[Me,H]=f.useState(!1),[fe,q]=f.useState(null),[ze,Ge]=f.useState(!1),[tt,xe]=f.useState(!1),[vt,ne]=f.useState(!1),[$,ut]=f.useState("full"),[Bt,un]=f.useState(""),[ct,dn]=f.useState(!1),[tn,nn]=f.useState(""),[S,ie]=f.useState(null),[oe,ve]=f.useState(!1),[At,ft]=f.useState(null),[p,E]=f.useState(""),[F,I]=f.useState(!1),[P,ae]=f.useState(()=>Kl(e.id,n)),[L,je]=f.useState([]),se=f.useRef([]);se.current=L;const He=f.useRef(null),Le=f.useRef(null),Se=f.useRef(0),Ye=f.useRef(0),St=f.useRef(""),Xe=f.useRef(""),rt=f.useRef(""),it=f.useRef(0),Ze=f.useRef(null),dt=f.useRef(null),Ct=f.useRef(null),gt=f.useRef(null),Pe=f.useRef(null),Lt=f.useRef(!1),Wt=f.useRef(null),ys=f.useRef(r);ys.current=r,rt.current=v,f.useEffect(()=>{if(!De)return;const x=window.setTimeout(()=>Ce(""),3e3);return()=>window.clearTimeout(x)},[De]);const Tn=(x,M,Q=0)=>{const Y={line:x,column:M};Fe.current=Y,Ne.current=Q,be(Y)},Bn=x=>{const M=se.current,Q=x(M);Q!==M&&(se.current=Q,je(Q))};f.useEffect(()=>{se.current=[],je([]),ft(null),E(""),Pe.current?.abort(),Pe.current=null,ne(!1),dn(!1),nn(""),ie(null)},[n]);const Ln=x=>{const M=se.current,Q=M.indexOf(x);if(Q<0)return;const Y=M.filter(_e=>_e!==x);if(se.current=Y,je(Y),Xe.current!==x)return;const Ae=Y.length>0?Y[Math.min(Q,Y.length-1)]:a?.mainFile??"";w(Ae)},{collaboration:Qe,status:Fn,synced:jt,activeSessions:Kr,formatLeaseStates:so,compileState:bn,setCompileState:cr,filesEvent:Ft,commentsRevision:Gr,dictionaryRevision:Yr,localDraftReady:Xr,permission:Cs,reconnect:ro,protocolUpgradeRequired:lr,permissionDowngrade:io,dismissPermissionDowngrade:C,discardLocalDraft:$e}=y2(n,e,v,a?.permission??"read",l,()=>W("editor.offlineDraft")),{pdfTarget:Ie,pdfViewport:Et,sourceJump:_t,setPdfViewport:zt,clearPdfViewport:ss,jumpToSource:Un,syncSourceToPdf:zn,syncPdfToSource:Hn,syncVisiblePdfToSource:oo}=S2({projectId:n,mainFile:v,activeFile:b,onActiveFile:w,onError:A,onShowPdf:()=>Z("pdf")}),Yt=k2({active:!!(a&&b&&jt&&P.spellCheck),projectId:n,activeFile:b,content:V,dictionaryWords:d});f.useEffect(()=>{ae(Kl(e.id,n))},[e.id,n]);const ao=x=>{St.current=x,U(x)};f.useEffect(()=>{if(Xe.current=b,Fe.current={line:1,column:1},Ne.current=0,be({line:1,column:1}),Ue({selectedText:"",startOffset:0,endOffset:0}),!P.openFilesInTabs){se.current.length>0&&(se.current=[],je([]));return}b&&Bn(x=>x.includes(b)?x:[...x,b])},[b,P.openFilesInTabs,n]),f.useEffect(()=>{if(!K)return;const x=M=>{M.preventDefault(),M.returnValue=""};return window.addEventListener("beforeunload",x),()=>window.removeEventListener("beforeunload",x)},[K]),f.useEffect(()=>{if(Fn!=="disconnected")return;const x=new AbortController;return ee(`/api/projects/${n}`,{signal:x.signal}).then(({project:M})=>{x.signal.aborted||(c(M),A(""))}).catch(M=>{if(!Ss(M)){if(M instanceof Gn&&[401,403,404].includes(M.status)){A(de(M)),ys.current();return}A(o("errors.collaborationUnavailable"))}}),()=>x.abort()},[Fn,n,o]);const co=async(x={})=>{Ze.current?.abort(),Ze.current=null;const M=x.signal?null:new AbortController;M&&(Ze.current=M);try{const Q=await ee(`/api/projects/${n}/completions`,{signal:x.signal??M?.signal});(!x.isCurrent||x.isCurrent())&&m(Q.index)}catch(Q){if(Ss(Q))return;(!x.isCurrent||x.isCurrent())&&m(null)}finally{M&&Ze.current===M&&(Ze.current=null)}},lo=async(x={},M=rt.current)=>{dt.current?.abort(),dt.current=null;const Q=x.signal?null:new AbortController;Q&&(dt.current=Q);try{const Y=M?`?mainFile=${encodeURIComponent(M)}`:"",Ae=await ee(`/api/projects/${n}/outline${Y}`,{signal:x.signal??Q?.signal});(!x.isCurrent||x.isCurrent())&&y(Ae.outline)}catch(Y){!Ss(Y)&&(!x.isCurrent||x.isCurrent())&&y([])}finally{Q&&dt.current===Q&&(dt.current=null)}},Ic=async(x={})=>{Ct.current?.abort(),Ct.current=null;const M=x.signal?null:new AbortController;M&&(Ct.current=M);try{const Q=await ee(`/api/projects/${n}/dictionary`,{signal:x.signal??M?.signal});(!x.isCurrent||x.isCurrent())&&h(Q.words)}catch(Q){if(Ss(Q))return;(!x.isCurrent||x.isCurrent())&&h([])}finally{M&&Ct.current===M&&(Ct.current=null)}};f.useEffect(()=>{let x=!1;const M=++it.current,Q=new AbortController,Y=()=>!x&&it.current===M;let Ae=!1;c(null),Uc([]),y([]),w(""),j(""),z(new Set),U(""),X(""),cr(null),ss(),m(null),h([]),Ui();const _e=(s?.projectId===n?s.project:ee(`/api/projects/${n}`,{signal:Q.signal})).then(It=>{Y()&&(Ae=!0,c(It.project),w(It.project.mainFile),j(It.project.mainFile),z(new Set),Yc(new Set(Fr(It.project.mainFile))))}).catch(It=>{Y()&&A(de(It))}),we=ee(`/api/projects/${n}/files`,{signal:Q.signal}).then(It=>{Y()&&Uc(It.files)}).catch(It=>{Y()&&A(de(It))});let sn=null;return Promise.allSettled([_e,we]).then(()=>{!Y()||!Ae||(sn=window.setTimeout(()=>{Y()&&Promise.all([co({signal:Q.signal,isCurrent:Y}),Ic({signal:Q.signal,isCurrent:Y})])},0))}),()=>{x=!0,sn!==null&&window.clearTimeout(sn),Q.abort(),Ze.current?.abort(),Ze.current=null,dt.current?.abort(),dt.current=null,Ct.current?.abort(),Ct.current=null,gt.current?.abort(),gt.current=null}},[n,s]),f.useEffect(()=>{Yr&&Ic()},[Yr,n]),f.useEffect(()=>{!a||Fn!=="connected"||Cs===a.permission||c(x=>x&&{...x,permission:Cs})},[Cs,a?.permission]),f.useEffect(()=>{if(!Ft)return;const x=Ft.kind==="delete"&&!!Ft.path&&os(Ft.path,Xe.current),M=Ft.kind==="delete"&&!!Ft.path&&os(Ft.path,rt.current);if(Ft.kind==="move"&&Ft.source&&Ft.destination){const Y=Ft.source,Ae=Ft.destination,_e=we=>we===Y?Ae:we.startsWith(`${Y}/`)?`${Ae}${we.slice(Y.length)}`:we;w(we=>_e(we)),j(we=>_e(we)),z(we=>new Set([...we].map(_e))),ho(we=>we&&_e(we)),Bn(we=>we.map(_e))}x&&(w(""),X(""),ao(""),Ce(o("editor.fileDeletedByCollaborator",{path:Ft.path}))),Ft.kind==="delete"&&Ft.path&&(z(Y=>new Set([...Y].filter(Ae=>!os(Ft.path,Ae)))),ho(Y=>os(Ft.path,Y)?"":Y),Vc(Y=>Y&&os(Ft.path,Y.path)?null:Y),Bn(Y=>Y.filter(Ae=>!os(Ft.path,Ae)))),gt.current?.abort();const Q=new AbortController;gt.current=Q,Promise.all([Nf({signal:Q.signal}),ee(`/api/projects/${n}`,{signal:Q.signal})]).then(([Y,Ae])=>{if(c(Ae.project),M&&j(Ae.project.mainFile),x&&Y){const _e=Y.find(we=>we.type==="file"&&we.path===Ae.project.mainFile)??Y.find(we=>we.type==="file"&&Vs(we.path));w(_e?.path??"")}co({signal:Q.signal}),lo({signal:Q.signal},M?Ae.project.mainFile:rt.current)}).catch(Y=>{Ss(Y)}).finally(()=>{gt.current===Q&&(gt.current=null)})},[Ft?.revision]),f.useEffect(()=>{if(Qe.setActiveFile(b),!b)return;X(""),W("editor.loading");const x=Qe.getText(b),M=(Q,Y)=>{ao(x.toString()),X(b),Y?.local&&a?.permission!=="read"?(Se.current+=1,le(!0),W("editor.pending")):Se.current<=Ye.current&&W(R.current?"editor.savedAt":"editor.saved")};return x.observe(M),(jt||Xr)&&M(),()=>{x.unobserve(M)}},[b,Qe,jt,Xr,a?.permission]);const Jr=async()=>{if(!jt)throw new Error("Collaboration is not synchronized");const x=Se.current,M=await Qe.flush();return Ye.current=Math.max(Ye.current,x),k(M.persistedAt),/\.tex$/i.test(Xe.current)&&lo(),Se.current===x?(le(!1),W("editor.savedAt")):W("editor.pending"),M};f.useEffect(()=>{if(!K||!b)return;if(!jt){W("editor.offlineDraft");return}W("editor.pending");const x=window.setTimeout(()=>{W("editor.saving"),Jr().catch(()=>{W(Qe.connected?"editor.saveFailed":"editor.offlineDraft")})},750);return()=>window.clearTimeout(x)},[V,K,b,jt]);const ur=async()=>{if(!a||a.permission==="read"||!jt||!b)return!1;W("editor.saving");try{return await Jr(),co(),!0}catch(x){return W("editor.saveFailed"),A(de(x)||o("errors.collaborationUnavailable")),!1}},jf=async x=>{if(!a||ct)return;const M=x==="full"?rt.current||a.mainFile:Xe.current,Q=x==="selection"?We.current.selectedText:"";if(!M)return;if(x==="selection"&&(!Q.trim()||!/\.(?:tex|sty|cls)$/i.test(M))){Ce(o("editor.wordCountSelectionEmpty"));return}Pe.current?.abort();const Y=new AbortController;Pe.current=Y,ut(x),un(M),ie(null),nn(""),ne(!0),dn(!0);try{if(x==="full"&&K&&a.permission!=="read"&&!await ur())throw new Error(o("editor.wordCountSaveRequired"));const Ae=x==="selection"?{mode:x,path:M,source:Q}:{mode:x,mainFile:M},_e=await ee(`/api/projects/${n}/word-count`,{method:"POST",body:JSON.stringify(Ae),signal:Y.signal});if(Y.signal.aborted)return;ie(_e)}catch(Ae){if(Ss(Ae))return;Y.signal.aborted||nn(de(Ae))}finally{Pe.current===Y&&(Pe.current=null,dn(!1))}},uo=async(x,M,Q=P.texFmtConfig)=>{if(/\.bib$/i.test(x))try{return{formatted:Ag(M,t.maxCitationBibtexBytes),diagnostics:""}}catch(Ae){throw Ae instanceof wa?Ae.kind==="too-large"?new Error(o("citationLibrary.fileTooLarge",{size:xa(t.maxCitationBibtexBytes)})):new Error(o("citationLibrary.fileInvalid")):Ae}const Y=await Wg(M,Q);return{formatted:Y.output,diagnostics:Y.logs.trim()}},Mc=async x=>{if(!a||a.permission==="read"||!jt||Lt.current||!ai(Xe.current))return;const M=Xe.current,Q=Qe.getText(M);Lt.current=!0,ve(!0);let Y=()=>{};const Ae=new Promise(we=>{Y=we});Wt.current=Ae,E("");let _e=null;try{_e=await Qe.acquireFormatLease(M);const we=Q.toString(),{formatted:sn,diagnostics:It}=await uo(M,we,x);if(Xe.current!==M||Q.toString()!==we){A(o("editor.formatSourceChanged"));return}await _e.confirm();const hn=await Oo(we,sn);if(Xe.current!==M||Q.toString()!==we){A(o("editor.formatSourceChanged"));return}if(await _e.confirm(),Xe.current!==M||Q.toString()!==we){A(o("editor.formatSourceChanged"));return}hn.length&&Qe.applyTextEdits(M,hn),hn.length&&await Jr(),ft(null),E(It),A(""),Ce(o("editor.formatFileComplete"))}catch(we){Ro(we)?(ft({action:"file",kind:we.kind,detail:we.message}),A("")):A(o("editor.formatFileFailed",{message:de(we)}))}finally{_e&&await _e.release(),Lt.current=!1,ve(!1),Y(),Wt.current===Ae&&(Wt.current=null)}},Tf=async()=>{if(!P.formatOnCompile||!a||a.permission==="read"||!jt||!ai(Xe.current)||Lt.current)return;const x=Xe.current,M=Qe.getText(x);Lt.current=!0,ve(!0),E("");let Q=null;try{Q=await Qe.acquireFormatLease(x);const Y=M.toString(),{formatted:Ae,diagnostics:_e}=await uo(x,Y);await Q.confirm();const we=await Oo(Y,Ae);if(Xe.current!==x||M.toString()!==Y)throw new Error(o("editor.formatSourceChanged"));if(await Q.confirm(),Xe.current!==x||M.toString()!==Y)throw new Error(o("editor.formatSourceChanged"));we.length&&Qe.applyTextEdits(x,we),we.length&&await Qe.flush(),ft(null),E(_e)}catch(Y){Ro(Y)?(ft({action:"file",kind:Y.kind,detail:Y.message}),A("")):A(o("editor.formatFailedContinue",{message:de(Y)}))}finally{Q&&await Q.release(),Lt.current=!1,ve(!1)}},Bf=async()=>(Wt.current&&await Wt.current,await Tf(),ur()),$c=async x=>{if(!a||a.permission==="read"||!jt||Lt.current||!ai(Xe.current))return;const M=We.current;if(!M.selectedText.trim()){Ce(o("editor.formatSelectionRequired"));return}const Q=Xe.current,{startOffset:Y,endOffset:Ae,selectedText:_e}=M,we=Qe.getText(Q);if(we.toString().slice(Y,Ae)!==_e){A(o("editor.formatSelectionChanged"));return}Lt.current=!0,ve(!0);let sn=()=>{};const It=new Promise(Nn=>{sn=Nn});Wt.current=It,E("");let hn=null;try{if(hn=await Qe.acquireFormatLease(Q),we.toString().slice(Y,Ae)!==_e){A(o("editor.formatSelectionChanged"));return}const fl=await uo(Q,_e,x),Ip=Yg(_e,fl.formatted);await hn.confirm();const Eo=await Oo(_e,Ip,Y);if(Xe.current!==Q||we.toString().slice(Y,Ae)!==_e){A(o("editor.formatSelectionChanged"));return}if(await hn.confirm(),Xe.current!==Q||we.toString().slice(Y,Ae)!==_e){A(o("editor.formatSelectionChanged"));return}Eo.length&&Qe.applyTextEdits(Q,Eo),Eo.length&&await Jr(),ft(null),E(fl.diagnostics),A(""),Ce(o("editor.formatSelectionComplete"))}catch(Nn){Ro(Nn)?(ft({action:"selection",kind:Nn.kind,detail:Nn.message}),A("")):A(o("editor.formatFailed",{message:de(Nn)}))}finally{hn&&await hn.release(),Lt.current=!1,ve(!1),sn(),Wt.current===It&&(Wt.current=null)}},Lf=x=>{const M=Xe.current;if(!/\.bib$/i.test(M)||a?.permission==="read"||!jt)return Ce(o("citationLibrary.importRequiresWrite")),!1;const Y=Qe.getText(M).toString(),Ae=$d(Y,t.maxCitationBibtexBytes);if(Ae.status==="too-large")return Ce(o("citationLibrary.fileTooLarge",{size:xa(t.maxCitationBibtexBytes)})),!1;if(Ae.status==="invalid")return Ce(o("citationLibrary.fileInvalid")),!1;if(Ae.entries.some(Nn=>Nn.citationKey.toLowerCase()===x.citationKey.toLowerCase()))return Ce(o("citationErrors.alreadyInFile",{key:x.citationKey})),!1;const _e=Math.max(0,Math.min(Y.length,Ne.current)),we=Y.slice(0,_e),sn=Y.slice(_e),It=we?we.endsWith(`
52
-
53
- `)?"":we.endsWith(`
54
- `)?`
55
- `:`
56
-
57
- `:"",hn=sn?sn.startsWith(`
58
-
59
- `)?"":sn.startsWith(`
60
- `)?`
61
- `:`
62
-
63
- `:"";return Qe.applyTextEdits(M,[{from:_e,to:_e,replacement:`${It}${x.bibtex.trim()}${hn}`}]),Ce(o("citationLibrary.imported",{key:x.citationKey})),!0},{files:yn,setFiles:Uc,loadFiles:Nf,newFileOpen:Rf,setNewFileOpen:zc,newFilePath:Of,setNewFilePath:Hc,resourcePreview:Pf,setResourcePreview:Vc,resourcePreviewLoading:_f,setResourcePreviewLoading:If,newFolderOpen:Mf,setNewFolderOpen:qc,newFolderName:$f,setNewFolderName:Wc,fileDialogError:Uf,setFileDialogError:Kc,selectedFolder:Gc,setSelectedFolder:ho,expandedFolders:zf,setExpandedFolders:Yc,moveEntry:Hf,setMoveEntry:Xc,moveName:Vf,setMoveName:Jc,moveDestination:qf,setMoveDestination:Zc,deleteEntry:fo,setDeleteEntry:Qc,fileDragActive:Wf,setFileDragActive:Kf,uploadConflict:Gf,setUploadConflict:Yf,uploadingFiles:Xf,directoryEntries:Jf,visibleEntries:Zf,createFile:Qf,createFolder:ep,uploadFiles:el,upload:tp,openFile:po,movePath:np,removePath:sp}=A2({projectId:n,site:t,activeFile:b,dirty:K,save:ur,onError:A,onProject:c,onActiveFile:w,onActiveMainFile:j,onRootDocuments:z});f.useEffect(()=>{if(!b||G!==b||!b.toLocaleLowerCase().endsWith(".tex"))return;const x=yn.filter(Ae=>Ae.type==="file"&&/\.tex$/i.test(Ae.path)).length;if(x===0)return;const M=b===a?.mainFile,Y=T2(V)||x===1;z(Ae=>{if(Ae.has(b)===Y)return Ae;const _e=new Set(Ae);return Y?_e.add(b):_e.delete(b),_e}),Y&&!M&&rt.current!==b?j(b):!Y&&rt.current===b&&a?.mainFile&&j(a.mainFile)},[b,G,V,yn,a?.mainFile]),f.useEffect(()=>{if(!P.openFilesInTabs||yn.length===0)return;const x=new Set(yn.filter(M=>M.type==="file"&&Vs(M.path)).map(M=>M.path));Bn(M=>{const Q=M.filter(Y=>x.has(Y));return Q.length===M.length?M:Q})},[yn,P.openFilesInTabs]);const{comments:Zr,focusComment:rp,setFocusComment:tl,commentOpen:ip,setCommentOpen:nl,commentText:op,setCommentText:ap,addComment:cp,toggleComment:lp,replyToComment:up,editComment:dp,deleteComment:hp,editCommentReply:fp,deleteCommentReply:pp}=t1({projectId:n,activeFile:b,permission:a?.permission,revision:Gr,selection:Ve,save:ur,onError:A,onAdded:()=>Ke("comments")}),{pdfUrl:Vn,pdfCompiledAt:dr,pdfLoadingMode:mp,pdfLoading:mo,compileLog:Do,compileDiagnostics:Dp,compileOutcome:hr,artifacts:sl,artifactPreview:gp,artifactLoading:Fp,editorNotice:bp,localCompiling:rl,cancelling:yp,cleaning:il,compile:Cp,cancelCompile:Ep,cleanCompile:ol,viewArtifact:wp}=E2({projectId:n,project:a,mainFile:v,initialLatest:s?.projectId===n?s.latestCompile:null,collaborationSynced:jt,sharedState:bn,onSharedState:cr,save:Bf,loadOutline:(x,M)=>lo({signal:x},M),onPreviewTab:Z,onError:A,onCompileStart:()=>{A(""),Ce("")},onCompileSuccess:()=>{const x=Xe.current;x&&zn(x,Fe.current.line,Fe.current.column,{silent:!0})},onPdfChanged:ss});f.useEffect(()=>{if(!a||!v||!Vn&&mo)return;const x=window.setTimeout(()=>u(!0),Vn?150:0);return()=>window.clearTimeout(x)},[a,mo,Vn]),f.useEffect(()=>{const x=M=>{(M.ctrlKey||M.metaKey)&&(!M.shiftKey&&M.key.toLocaleLowerCase()==="p"?(M.preventDefault(),Ge(!0)):M.shiftKey&&M.key.toLocaleLowerCase()==="f"&&(M.preventDefault(),xe(!0)))};return window.addEventListener("keydown",x,!0),()=>window.removeEventListener("keydown",x,!0)},[]);const al=x=>{ae(x),Ug(e.id,n,x)},cl=(x=!1)=>{const M=At;if(!M)return;ft(null),E(""),A(""),x&&al({...P,texFmtConfig:""});const Q=x?"":void 0;M.action==="selection"?$c(Q):Mc(Q)},xp=async()=>{I(!0);try{await $e()||(A(o("editor.collaboration.permissionDowngradeOtherTabBlocked")),I(!1))}catch(x){A(de(x)),I(!1)}},ll=()=>{Le.current?.isCollapsed()?Le.current.expand():Le.current?.collapse()},vp=f.useMemo(()=>g.length?g:sC(V).map(x=>({...x,path:b})),[g,V,b]),go=f.useMemo(()=>Xg(Do,hr),[Do,hr]),Es=ue!=="pdf-only",ul=ue!=="editor-only",Fo=x=>{O(x),x==="pdf-only"&&Z("pdf")},Ap=fo?Kr.filter(x=>x.filePath&&os(fo.path,x.filePath)):[];if(!a)return i.jsxs("div",{className:"center-card",children:[i.jsx("p",{children:te||o("common.loading")}),te&&i.jsx("button",{className:"primary",onClick:r,children:o("editor.backToProjects")})]});const qn=a.permission==="read"||!jt,bo=so.find(x=>x.path===b),yo=bo&&!oe?bo:null,kp=(x,M)=>{if(qn)return;const Q=Xe.current;if(!Q)return;if(Qe.getText(Q).toString().slice(x.from,x.to)!==x.word){A(o("editor.spellCheckSourceChanged"));return}try{Qe.applyTextEdits(Q,[{from:x.from,to:x.to,replacement:M}])}catch(_e){A(de(_e))}},Co=bn?.mainFile===v&&(bn.status==="queued"||bn.status==="running"),Qr=rl||Co||il,Sp=b?Qe.getText(b):null,jp=dr?new Date(dr).toLocaleString(qe.resolvedLanguage,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"",Tp=v.split("/").at(-1)??v,Bp=go.warnings.length+go.errors.length+sl.length,Lp=Vn?`${Vn}${Vn.includes("?")?"&":"?"}download=1`:"",Np=v||a.mainFile,Rp=!!(b&&b===Np&&/\.tex$/i.test(b)),dl=x=>{const M=yn.find(Q=>Q.path===x);M&&Vs(M.path)?po(M):Ln(x)},Op=x=>{document.getElementById(`editor-tab-${encodeURIComponent(x)}`)?.focus()},Pp=(x,M)=>{if(!["ArrowLeft","ArrowRight","Home","End"].includes(x.key))return;x.preventDefault();const Q=x.key==="Home"?0:x.key==="End"?L.length-1:(M+(x.key==="ArrowLeft"?-1:1)+L.length)%L.length,Y=L[Q];Y&&(dl(Y),window.requestAnimationFrame(()=>Op(Y)))},hl=Qr?Co?bn?.status==="queued"?o("editor.compileQueued"):o("editor.compilingBy",{name:bn?.requestedBy.name??o("common.user")}):o("editor.compiling"):hr==="failed"?Vn&&dr?o("editor.compileFailedRetained",{time:new Date(dr).toLocaleString(qe.resolvedLanguage)}):o("editor.compileFailedNoPdf"):hr==="cancelled"?o("compileControls.cancelled"):"",_p=_==="editor.savedAt"&&T?o("editor.savedAt",{time:new Date(T).toLocaleTimeString(qe.resolvedLanguage,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}):o(_);return i.jsxs("div",{className:"workspace",children:[i.jsx(N2,{site:t,project:a,activeFile:b,saveStateLabel:_p,editorPreferences:P,activeSessions:Kr,collaborationStatus:Fn,reconnectCollaboration:ro,protocolUpgradeRequired:lr,showEditor:Es,filesCollapsed:Je,toggleFilesPanel:ll,workspaceLayout:ue,changeWorkspaceLayout:Fo,onBack:r,onShare:()=>xt(!0),showCitationLibrary:Es&&/\.bib$/i.test(b),citationLibraryOpen:Me,onCitationLibrary:()=>H(!0),onHistory:()=>Dt(!0),onGit:()=>ke(!0),canManageGit:a.ownerId===e.id,formatting:oe,canFormat:ai(b),readOnly:qn,collaborationSynced:jt,activeFormatLease:!!bo,onFormatFile:()=>{Mc()},onFormatSelection:()=>{$c()},hasSelection:!!Ve.selectedText.trim(),onAddComment:()=>nl(!0),onToggleComments:()=>Ke(ye==="comments"?null:"comments"),commentsOpen:ye==="comments",unresolvedCommentCount:Zr.filter(x=>!x.resolved).length,hasActiveFile:!!b,onToggleSettings:()=>Ke(ye==="settings"?null:"settings"),settingsOpen:ye==="settings",compileBusy:Qr,sharedCompiling:Co,localCompiling:rl,cancelling:yp,compileState:bn,onCompile:Cp,onCancelCompile:()=>{Ep()}}),lr&&i.jsxs("div",{className:"workspace-update-banner",role:"alert",children:[i.jsx(Zt,{size:15}),i.jsx("span",{children:o("workspaceUpdates.protocolUpgrade")}),i.jsx("button",{type:"button",onClick:()=>window.location.reload(),children:o("common.reload")})]}),hl&&i.jsxs("div",{className:`compile-status-strip${hr==="failed"?" failed":""}`,role:"status","aria-live":"polite",children:[i.jsx(at,{className:Qr?"spin":"",size:14}),i.jsx("span",{children:hl})]}),(Yt.error||At||p||yo)&&i.jsxs("div",{className:"client-tool-recoveries",children:[Yt.error&&i.jsxs("div",{className:"client-tool-recovery",role:"alert",title:Yt.error,children:[i.jsx(Zt,{size:15}),i.jsxs("span",{children:[i.jsx("strong",{children:o("editor.harperRecoveryTitle")}),o("editor.harperFallbackHint")]}),i.jsx("div",{className:"client-tool-recovery-actions",children:i.jsx("button",{type:"button",onClick:Yt.retry,children:o("common.retry")})}),i.jsx("button",{type:"button",className:"formatter-diagnostics-dismiss",title:o("common.close"),"aria-label":o("common.close"),onClick:Yt.dismissError,children:i.jsx(Vt,{size:13})})]}),At&&i.jsxs("div",{className:"client-tool-recovery",role:"alert",title:At.detail,children:[i.jsx(Zt,{size:15}),i.jsxs("span",{children:[i.jsx("strong",{children:o(At.kind==="format"?"editor.texFmtOptionsRecoveryTitle":At.kind==="load"?"editor.texFmtRecoveryTitle":"editor.texFmtRuntimeRecoveryTitle")}),o("editor.clientToolRecoveryHint")]}),i.jsxs("div",{className:"client-tool-recovery-actions",children:[i.jsx("button",{type:"button",disabled:oe||qn,onClick:()=>cl(),children:o("common.retry")}),At.kind==="format"&&P.texFmtConfig.trim()&&i.jsx("button",{type:"button",disabled:oe||qn,onClick:()=>cl(!0),children:o("editor.resetFormatterOptions")}),i.jsx("button",{type:"button",onClick:()=>window.location.reload(),children:o("common.reload")})]}),i.jsx("button",{type:"button",className:"formatter-diagnostics-dismiss",title:o("common.close"),"aria-label":o("common.close"),onClick:()=>ft(null),children:i.jsx(Vt,{size:13})})]}),p&&i.jsxs("div",{className:"client-tool-recovery formatter-diagnostics",role:"status",children:[i.jsx(Zt,{size:15}),i.jsxs("span",{children:[i.jsx("strong",{children:o("editor.texFmtDiagnosticsTitle")}),o("editor.texFmtDiagnosticsHint")]}),i.jsxs("details",{children:[i.jsx("summary",{children:o("editor.viewFormatterDiagnostics")}),i.jsx("pre",{children:p})]}),i.jsx("button",{type:"button",className:"formatter-diagnostics-dismiss",title:o("editor.dismissFormatterDiagnostics"),"aria-label":o("editor.dismissFormatterDiagnostics"),onClick:()=>E(""),children:i.jsx(Vt,{size:13})})]}),yo&&i.jsxs("div",{className:"client-tool-recovery format-lease-status",role:"status",children:[i.jsx(at,{className:"spin",size:15}),i.jsx("span",{children:o("editor.formattingBy",{name:yo.holderName})})]})]}),te&&i.jsx("div",{className:"toast",onClick:()=>A(""),children:te}),De&&i.jsx("div",{className:"toast success",onClick:()=>Ce(""),children:De}),i.jsxs(Up,{autoSaveId:"texlite-workspace-layout",direction:"horizontal",className:"work-grid",children:[Es&&i.jsx(R2,{project:a,filesPanel:Le,files:yn,visibleEntries:Zf,activeFile:b,activeMainFile:v,rootDocuments:N,selectedFolder:Gc,expandedFolders:zf,fileDragActive:Wf,uploadingFiles:Xf,readOnly:qn,editorFontSize:P.fontSize,outline:vp,sourceCursor:he,wordCountBusy:ct,hasSelection:!!Ve.selectedText.trim()&&/\.(?:tex|sty|cls)$/i.test(b),uploadInput:He,setSelectedFolder:ho,setExpandedFolders:Yc,setMoveEntry:Xc,setMoveName:Jc,setMoveDestination:Zc,setDeleteEntry:Qc,setFileDialogError:Kc,setNewFolderName:Wc,setNewFolderOpen:qc,setNewFilePath:Hc,setNewFileOpen:zc,setQuickOpen:Ge,setProjectSearchOpen:xe,setFileDragActive:Kf,setFilesCollapsed:mt,toggleFilesPanel:ll,uploadFiles:el,upload:tp,openFile:po,jumpToSource:Un,syncSourceToPdf:zn,onWordCount:x=>{jf(x)}}),Es&&i.jsx($a,{className:"resize-handle",children:i.jsx(Nd,{size:12})}),Es&&i.jsx(_2,{project:a,activeFile:b,activeMainFile:v,openTabs:L,content:V,loadedFile:G,readOnly:qn,comments:Zr,focusComment:rp,editorPreferences:P,completionIndex:D,nativeSpellCheck:Yt.nativeFallback,spellCheckIssues:Yt.issues,spellCheckJump:Yt.jump,sourceJump:_t,collaborativeText:Sp,collaborationAwareness:Qe.awareness,undoManager:b?Qe.getUndoManager(b):void 0,editorNotice:bp,activateTab:dl,closeTab:Ln,handleTabKeyDown:Pp,updateEditorContent:ao,setSelection:(x,M,Q)=>Ue({selectedText:x,startOffset:M,endOffset:Q}),onCommentClick:x=>{const M=Zr.find(Q=>Q.id===x);M&&(tl({...M}),Ke("comments"))},onSpellCheckReplace:kp,onCursor:Tn}),ul&&i.jsx(H2,{projectId:n,activeMainFile:v,previewTab:Ee,diagnosticTab:me,pdfUrl:Vn,pdfLoadingMode:mp,pdfLoading:mo,pdfCompiledAt:dr,pdfCompiledLabel:jp,pdfTargetLabel:Tp,pdfDownloadUrl:Lp,pdfTarget:Ie,pdfViewport:Et,activeFile:b,sourceCursor:he,compileBusy:Qr,compileLog:Do,compileDiagnostics:Dp,compileMessages:go,artifacts:sl,artifactPreview:gp,artifactLoading:Fp,cleaning:il,readOnly:qn,collaborationSynced:jt,workspaceLayout:ue,showSyncResize:Es&&ul,diagnosticCount:Bp,selectPreviewTab:Z,changeWorkspaceLayout:Fo,onSetNotice:Ce,onSetPdfViewport:zt,syncVisiblePdfToSource:oo,syncSourceToPdf:zn,syncPdfToSource:Hn,canSyncWithPdf:Rp,files:yn,jumpToSource:Un,onSetCleanMode:q,cleanCompile:ol,viewArtifact:wp}),i.jsx(eC,{sidePanel:ye,onClose:()=>Ke(null),project:a,projectId:n,site:t,files:yn,currentUserId:e.id,comments:Zr,onFocusComment:x=>tl({...x}),onToggleComment:lp,onReplyComment:up,onEditComment:dp,onDeleteComment:hp,onEditCommentReply:fp,onDeleteCommentReply:pp,dictionaryWords:d,onDictionaryChange:h,editorPreferences:P,onEditorPreferences:al,spellCheckCount:Yt.summary?.total??null,spellCheckUniqueCount:Yt.summary?.unique??null,spellCheckIndex:Yt.summary?Yt.index:-1,onSpellCheckNavigate:Yt.jumpToIssue,onProject:c})]}),i.jsx(tC,{open:vt,mode:$,path:Bt,busy:ct,error:tn,result:S,onOpenChange:ne}),i.jsx(X2,{user:e,project:a,projectId:n,activeFile:b,content:V,maxCitationBibtexBytes:t.maxCitationBibtexBytes,files:yn,directoryEntries:Jf,readOnly:qn,workspaceLayout:ue,changeWorkspaceLayout:Fo,resourcePreview:Pf,resourcePreviewLoading:_f,setResourcePreview:Vc,setResourcePreviewLoading:If,uploadConflict:Gf,setUploadConflict:Yf,uploadFiles:el,cleanMode:fe,setCleanMode:q,cleanCompile:ol,newFileOpen:Rf,setNewFileOpen:zc,newFilePath:Of,setNewFilePath:Hc,newFolderOpen:Mf,setNewFolderOpen:qc,newFolderName:$f,setNewFolderName:Wc,selectedFolder:Gc,fileDialogError:Uf,setFileDialogError:Kc,createFile:Qf,createFolder:ep,moveEntry:Hf,setMoveEntry:Xc,moveName:Vf,setMoveName:Jc,moveDestination:qf,setMoveDestination:Zc,movePath:np,deleteEntry:fo,setDeleteEntry:Qc,deleteActiveSessions:Ap,removePath:sp,commentOpen:ip,setCommentOpen:nl,selection:Ve,commentText:op,setCommentText:ap,addComment:cp,shareOpen:ge,setShareOpen:xt,citationLibraryOpen:Me,setCitationLibraryOpen:H,insertCitationAtCursor:Lf,quickOpen:ze,setQuickOpen:Ge,projectSearchOpen:tt,setProjectSearchOpen:xe,openFile:po,jumpToSource:Un,historyOpen:Re,setHistoryOpen:Dt,gitOpen:ce,setGitOpen:ke,save:ur,permissionDowngrade:io,permissionDowngradeBusy:F,dismissPermissionDowngrade:C,discardPermissionDraft:xp})]})}function sC(t){const e=[],n=/^\s*\\(part|chapter|section|subsection|subsubsection)\*?(?:\[[^\]]*\])?\{([^}]*)\}/,s={part:0,chapter:0,section:1,subsection:2,subsubsection:3};return t.split(`
64
- `).forEach((r,o)=>{const a=r.match(n);a&&e.push({level:s[a[1]],title:a[2],line:o+1})}),e}function rC(){const{t}=st(),[e,n]=f.useState(null),[s,r]=f.useState(),[o,a]=f.useState(()=>typeof window>"u"?null:js(window.location.pathname)),[c,l]=f.useState(()=>{if(typeof window>"u")return null;const b=js(window.location.pathname);return b?ni(b):null}),[u,d]=f.useState(null),h=()=>{const b=js(window.location.pathname);if(!b)return;const w={texliteRoute:"dashboard"};window.history.replaceState(w,"",xD(b)),a(null),l(null)},D=b=>{const w=vD(window.location.search);if(w){const v={texliteRoute:"project",projectId:w,fromDashboard:!1};window.history.replaceState(v,"",mr(w)),l(ni(w,{force:!0})),a(w)}else if(new URLSearchParams(window.location.search).has("return")){const v={texliteRoute:"dashboard"};window.history.replaceState(v,"","/")}r(b)};f.useEffect(()=>{const b=js(window.location.pathname);if(b&&window.location.pathname!==mr(b)){const j={texliteRoute:"project",projectId:b,fromDashboard:!1};window.history.replaceState(j,"",mr(b))}const w=()=>{const j=js(window.location.pathname);a(j),l(j?ni(j):null)},v=()=>{d(null),r(null),h()};return window.addEventListener("popstate",w),window.addEventListener("texlite:session-expired",v),()=>{window.removeEventListener("popstate",w),window.removeEventListener("texlite:session-expired",v)}},[]);const m=b=>{const w=mr(b);if(window.location.pathname!==w){const v={texliteRoute:"project",projectId:b,fromDashboard:!0};window.history.pushState(v,"",w)}l(ni(b)),a(b)},g=()=>{const b=window.history.state;if(AD(b)&&b.fromDashboard){window.history.back();return}const w={texliteRoute:"dashboard"};window.history.replaceState(w,"","/"),a(null),l(null)};if(f.useEffect(()=>{ee("/api/config").then(b=>{n(b),document.title=b.siteName}),ee("/api/me",{suppressSessionExpired:!0}).then(({user:b})=>D(b)).catch(()=>{h(),r(null)})},[]),f.useEffect(()=>{if(!s||s.mustChangePassword||o)return;let b=!1,w=null,v=null;const j=()=>{b||Ui().then(z=>z.preloadPdfRuntime()).catch(()=>{})},N=window;return N.requestIdleCallback?v=N.requestIdleCallback(j,{timeout:1200}):w=window.setTimeout(j,400),()=>{b=!0,w!==null&&window.clearTimeout(w),v!==null&&N.cancelIdleCallback?.(v)}},[s?.id,s?.mustChangePassword,o]),s===void 0||!e)return i.jsx("div",{className:"center-card",children:t("common.loading")});if(!s)return i.jsx(BD,{site:e,onLogin:D});if(s.mustChangePassword)return i.jsx(TD,{site:e,user:s,onChanged:b=>r(b)});if(o)return i.jsx(nC,{site:e,user:s,projectId:o,preload:c?.projectId===o?c:null,onBack:g},o);const y=u?.userId===s.id?u:null;return i.jsx(Mg,{site:e,user:s,initialData:y?{projects:y.projects,tags:y.tags,pagination:y.pagination}:null,onDataChange:(b,w,v)=>d({userId:s.id,projects:b,tags:w,pagination:v}),onUser:b=>{(!b||b.id!==s.id)&&d(null),r(b),b||g()},onOpenProject:m})}class iC extends f.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??qe.t("errors.boundaryTitle")}),i.jsx("p",{style:{fontSize:"0.9rem",color:"var(--text-secondary, #6c757d)",marginBottom:"1rem"},children:qe.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:qe.t("errors.boundaryRetry")}),i.jsx("button",{type:"button",onClick:()=>window.location.reload(),style:{padding:"0.4rem 0.8rem",borderRadius:"4px",cursor:"pointer"},children:qe.t("errors.boundaryReload")})]})]}):this.props.children}}zp.createRoot(document.getElementById("root")).render(i.jsx(f.StrictMode,{children:i.jsx(iC,{children:i.jsx(rC,{})})}));export{$0 as A,Td as C,Ws as F,eg as G,Ul as K,at as L,pt as M,hi as P,ga as R,yi as S,cn as T,Lb as U,ee as a,fC as b,hC as c,pC as d,mC as e,Ds as f,lC as g,Rn as h,cC as i,re as j,Hi as k,hg as l,cc as m,Jn as n,_d as o,X0 as p,us as q,dC as r,uC as t};