399 lines
802 KiB
JavaScript
399 lines
802 KiB
JavaScript
/*
|
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
if you want to view the source visit the plugins github repository
|
|
*/
|
|
|
|
"use strict";var WB=Object.create;var bs=Object.defineProperty;var oS=Object.getOwnPropertyDescriptor;var HB=Object.getOwnPropertyNames;var KB=Object.getPrototypeOf,VB=Object.prototype.hasOwnProperty;var GB=(t,e,r)=>e in t?bs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Xa=(t,e)=>()=>(t&&(e=t(t=0)),e);var b=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),iS=(t,e)=>{for(var r in e)bs(t,r,{get:e[r],enumerable:!0})},sS=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of HB(e))!VB.call(t,o)&&o!==r&&bs(t,o,{get:()=>e[o],enumerable:!(n=oS(e,o))||n.enumerable});return t};var Y=(t,e,r)=>(r=t!=null?WB(KB(t)):{},sS(e||!t||!t.__esModule?bs(r,"default",{value:t,enumerable:!0}):r,t)),zg=t=>sS(bs({},"__esModule",{value:!0}),t),he=(t,e,r,n)=>{for(var o=n>1?void 0:n?oS(e,r):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(n?s(e,r,o):s(o))||o);return n&&o&&bs(e,r,o),o};var aS=(t,e,r)=>(GB(t,typeof e!="symbol"?e+"":e,r),r);var p,a=Xa(()=>{p={"121":{darwin:["arm64","x64"],linux:["arm64","x64"],win32:["arm64","ia32","x64"]},"123":{darwin:["arm64","x64"],linux:["arm64","x64"],win32:["arm64","ia32","x64"]},"125":{darwin:["arm64","x64"],linux:["arm64","x64"],win32:["arm64","ia32","x64"]},"128":{darwin:["arm64","x64"],linux:["arm64","x64"],win32:["arm64","ia32","x64"]},"130":{darwin:["arm64","x64"],linux:["arm64","x64"],win32:["arm64","ia32","x64"]},"132":{darwin:["arm64","x64"],linux:["arm64","x64"],win32:["arm64","ia32","x64"]},"133":{darwin:["arm64","x64"],linux:["arm64","x64"],win32:["arm64","ia32","x64"]},"135":{darwin:["arm64","x64"],linux:["arm64","x64"],win32:["arm64","ia32","x64"]},"136":{darwin:["arm64","x64"],linux:["arm64","x64"],win32:["arm64","ia32","x64"]},"139":{darwin:["arm64","x64"],linux:["arm64","x64"],win32:["arm64","ia32","x64"]},"140":{darwin:["arm64","x64"],linux:["arm64","x64"],win32:["arm64","ia32","x64"]},"143":{darwin:["arm64","x64"],linux:["arm64","x64"],win32:["arm64","ia32","x64"]},"145":{darwin:["arm64","x64"],linux:["arm64","x64"],win32:["arm64","ia32","x64"]}}});var DS=b((sfe,NS)=>{a();var Es=1e3,Ss=Es*60,Is=Ss*60,ii=Is*24,iz=ii*7,sz=ii*365.25;NS.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return az(t);if(r==="number"&&isFinite(t))return e.long?cz(t):lz(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function az(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*sz;case"weeks":case"week":case"w":return r*iz;case"days":case"day":case"d":return r*ii;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Is;case"minutes":case"minute":case"mins":case"min":case"m":return r*Ss;case"seconds":case"second":case"secs":case"sec":case"s":return r*Es;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function lz(t){var e=Math.abs(t);return e>=ii?Math.round(t/ii)+"d":e>=Is?Math.round(t/Is)+"h":e>=Ss?Math.round(t/Ss)+"m":e>=Es?Math.round(t/Es)+"s":t+"ms"}function cz(t){var e=Math.abs(t);return e>=ii?cf(t,e,ii,"day"):e>=Is?cf(t,e,Is,"hour"):e>=Ss?cf(t,e,Ss,"minute"):e>=Es?cf(t,e,Es,"second"):t+" ms"}function cf(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var FS=b((lfe,PS)=>{a();function uz(t){r.debug=r,r.default=r,r.coerce=c,r.disable=i,r.enable=o,r.enabled=s,r.humanize=DS(),r.destroy=f,Object.keys(t).forEach(u=>{r[u]=t[u]}),r.names=[],r.skips=[],r.formatters={};function e(u){let d=0;for(let m=0;m<u.length;m++)d=(d<<5)-d+u.charCodeAt(m),d|=0;return r.colors[Math.abs(d)%r.colors.length]}r.selectColor=e;function r(u){let d,m=null,h,y;function w(...v){if(!w.enabled)return;let x=w,S=Number(new Date),k=S-(d||S);x.diff=k,x.prev=d,x.curr=S,d=S,v[0]=r.coerce(v[0]),typeof v[0]!="string"&&v.unshift("%O");let j=0;v[0]=v[0].replace(/%([a-zA-Z%])/g,(X,J)=>{if(X==="%%")return"%";j++;let G=r.formatters[J];if(typeof G=="function"){let $=v[j];X=G.call(x,$),v.splice(j,1),j--}return X}),r.formatArgs.call(x,v),(x.log||r.log).apply(x,v)}return w.namespace=u,w.useColors=r.useColors(),w.color=r.selectColor(u),w.extend=n,w.destroy=r.destroy,Object.defineProperty(w,"enabled",{enumerable:!0,configurable:!1,get:()=>m!==null?m:(h!==r.namespaces&&(h=r.namespaces,y=r.enabled(u)),y),set:v=>{m=v}}),typeof r.init=="function"&&r.init(w),w}function n(u,d){let m=r(this.namespace+(typeof d>"u"?":":d)+u);return m.log=this.log,m}function o(u){r.save(u),r.namespaces=u,r.names=[],r.skips=[];let d,m=(typeof u=="string"?u:"").split(/[\s,]+/),h=m.length;for(d=0;d<h;d++)m[d]&&(u=m[d].replace(/\*/g,".*?"),u[0]==="-"?r.skips.push(new RegExp("^"+u.slice(1)+"$")):r.names.push(new RegExp("^"+u+"$")))}function i(){let u=[...r.names.map(l),...r.skips.map(l).map(d=>"-"+d)].join(",");return r.enable(""),u}function s(u){if(u[u.length-1]==="*")return!0;let d,m;for(d=0,m=r.skips.length;d<m;d++)if(r.skips[d].test(u))return!1;for(d=0,m=r.names.length;d<m;d++)if(r.names[d].test(u))return!0;return!1}function l(u){return u.toString().substring(2,u.toString().length-2).replace(/\.\*\?$/,"*")}function c(u){return u instanceof Error?u.stack||u.message:u}function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}PS.exports=uz});var Ye=b((Kt,uf)=>{a();Kt.formatArgs=pz;Kt.save=dz;Kt.load=mz;Kt.useColors=fz;Kt.storage=hz();Kt.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Kt.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function fz(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function pz(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+uf.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),t.splice(n,0,e)}Kt.log=console.debug||console.log||(()=>{});function dz(t){try{t?Kt.storage.setItem("debug",t):Kt.storage.removeItem("debug")}catch{}}function mz(){let t;try{t=Kt.storage.getItem("debug")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function hz(){try{return localStorage}catch{}}uf.exports=FS()(Kt);var{formatters:gz}=uf.exports;gz.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var MS=b((ffe,$S)=>{"use strict";a();$S.exports=yz;function _s(t){return t instanceof Buffer?Buffer.from(t):new t.constructor(t.buffer.slice(),t.byteOffset,t.length)}function yz(t){if(t=t||{},t.circles)return bz(t);return t.proto?n:r;function e(o,i){for(var s=Object.keys(o),l=new Array(s.length),c=0;c<s.length;c++){var f=s[c],u=o[f];typeof u!="object"||u===null?l[f]=u:u instanceof Date?l[f]=new Date(u):ArrayBuffer.isView(u)?l[f]=_s(u):l[f]=i(u)}return l}function r(o){if(typeof o!="object"||o===null)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return e(o,r);if(o instanceof Map)return new Map(e(Array.from(o),r));if(o instanceof Set)return new Set(e(Array.from(o),r));var i={};for(var s in o)if(Object.hasOwnProperty.call(o,s)!==!1){var l=o[s];typeof l!="object"||l===null?i[s]=l:l instanceof Date?i[s]=new Date(l):l instanceof Map?i[s]=new Map(e(Array.from(l),r)):l instanceof Set?i[s]=new Set(e(Array.from(l),r)):ArrayBuffer.isView(l)?i[s]=_s(l):i[s]=r(l)}return i}function n(o){if(typeof o!="object"||o===null)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return e(o,n);if(o instanceof Map)return new Map(e(Array.from(o),n));if(o instanceof Set)return new Set(e(Array.from(o),n));var i={};for(var s in o){var l=o[s];typeof l!="object"||l===null?i[s]=l:l instanceof Date?i[s]=new Date(l):l instanceof Map?i[s]=new Map(e(Array.from(l),n)):l instanceof Set?i[s]=new Set(e(Array.from(l),n)):ArrayBuffer.isView(l)?i[s]=_s(l):i[s]=n(l)}return i}}function bz(t){var e=[],r=[];return t.proto?i:o;function n(s,l){for(var c=Object.keys(s),f=new Array(c.length),u=0;u<c.length;u++){var d=c[u],m=s[d];if(typeof m!="object"||m===null)f[d]=m;else if(m instanceof Date)f[d]=new Date(m);else if(ArrayBuffer.isView(m))f[d]=_s(m);else{var h=e.indexOf(m);h!==-1?f[d]=r[h]:f[d]=l(m)}}return f}function o(s){if(typeof s!="object"||s===null)return s;if(s instanceof Date)return new Date(s);if(Array.isArray(s))return n(s,o);if(s instanceof Map)return new Map(n(Array.from(s),o));if(s instanceof Set)return new Set(n(Array.from(s),o));var l={};e.push(s),r.push(l);for(var c in s)if(Object.hasOwnProperty.call(s,c)!==!1){var f=s[c];if(typeof f!="object"||f===null)l[c]=f;else if(f instanceof Date)l[c]=new Date(f);else if(f instanceof Map)l[c]=new Map(n(Array.from(f),o));else if(f instanceof Set)l[c]=new Set(n(Array.from(f),o));else if(ArrayBuffer.isView(f))l[c]=_s(f);else{var u=e.indexOf(f);u!==-1?l[c]=r[u]:l[c]=o(f)}}return e.pop(),r.pop(),l}function i(s){if(typeof s!="object"||s===null)return s;if(s instanceof Date)return new Date(s);if(Array.isArray(s))return n(s,i);if(s instanceof Map)return new Map(n(Array.from(s),i));if(s instanceof Set)return new Set(n(Array.from(s),i));var l={};e.push(s),r.push(l);for(var c in s){var f=s[c];if(typeof f!="object"||f===null)l[c]=f;else if(f instanceof Date)l[c]=new Date(f);else if(f instanceof Map)l[c]=new Map(n(Array.from(f),i));else if(f instanceof Set)l[c]=new Set(n(Array.from(f),i));else if(ArrayBuffer.isView(f))l[c]=_s(f);else{var u=e.indexOf(f);u!==-1?l[c]=r[u]:l[c]=i(f)}}return e.pop(),r.pop(),l}}});var ai=b((dfe,BS)=>{a();var vz=require("util"),si=Ye()("log4js:configuration"),ff=[],pf=[],LS=t=>!t,jS=t=>t&&typeof t=="object"&&!Array.isArray(t),wz=t=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(t),xz=t=>t&&typeof t=="number"&&Number.isInteger(t),Ez=t=>{pf.push(t),si(`Added listener, now ${pf.length} listeners`)},Sz=t=>{ff.push(t),si(`Added pre-processing listener, now ${ff.length} listeners`)},qS=(t,e,r)=>{(Array.isArray(e)?e:[e]).forEach(o=>{if(o)throw new Error(`Problem with log4js configuration: (${vz.inspect(t,{depth:5})}) - ${r}`)})},Iz=t=>{si("New configuration to be validated: ",t),qS(t,LS(jS(t)),"must be an object."),si(`Calling pre-processing listeners (${ff.length})`),ff.forEach(e=>e(t)),si("Configuration pre-processing finished."),si(`Calling configuration listeners (${pf.length})`),pf.forEach(e=>e(t)),si("Configuration finished.")};BS.exports={configure:Iz,addListener:Ez,addPreProcessingListener:Sz,throwExceptionIf:qS,anObject:jS,anInteger:xz,validIdentifier:wz,not:LS}});var df=b((hfe,lr)=>{"use strict";a();function zS(t,e){for(var r=t.toString();r.length<e;)r="0"+r;return r}function li(t){return zS(t,2)}function _z(t){var e=Math.abs(t),r=String(Math.floor(e/60)),n=String(e%60);return r=("0"+r).slice(-2),n=("0"+n).slice(-2),t===0?"Z":(t<0?"+":"-")+r+":"+n}function US(t,e){typeof t!="string"&&(e=t,t=lr.exports.ISO8601_FORMAT),e||(e=lr.exports.now());var r=li(e.getDate()),n=li(e.getMonth()+1),o=li(e.getFullYear()),i=li(o.substring(2,4)),s=t.indexOf("yyyy")>-1?o:i,l=li(e.getHours()),c=li(e.getMinutes()),f=li(e.getSeconds()),u=zS(e.getMilliseconds(),3),d=_z(e.getTimezoneOffset()),m=t.replace(/dd/g,r).replace(/MM/g,n).replace(/y{1,4}/g,s).replace(/hh/g,l).replace(/mm/g,c).replace(/ss/g,f).replace(/SSS/g,u).replace(/O/g,d);return m}function co(t,e,r,n){t["set"+(n?"":"UTC")+e](r)}function Oz(t,e,r){var n=t.indexOf("O")<0,o=!1,i=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(d,m){co(d,"FullYear",m,n)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(d,m){co(d,"Month",m-1,n),d.getMonth()!==m-1&&(o=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(d,m){o&&co(d,"Month",d.getMonth()-1,n),co(d,"Date",m,n)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(d,m){co(d,"Hours",m,n)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(d,m){co(d,"Minutes",m,n)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(d,m){co(d,"Seconds",m,n)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(d,m){co(d,"Milliseconds",m,n)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(d,m){m==="Z"?m=0:m=m.replace(":","");var h=Math.abs(m),y=(m>0?-1:1)*(h%100+Math.floor(h/100)*60);d.setUTCMinutes(d.getUTCMinutes()+y)}}],s=i.reduce(function(d,m){return m.pattern.test(d.regexp)?(m.index=d.regexp.match(m.pattern).index,d.regexp=d.regexp.replace(m.pattern,"("+m.regexp+")")):m.index=-1,d},{regexp:t,index:[]}),l=i.filter(function(d){return d.index>-1});l.sort(function(d,m){return d.index-m.index});var c=new RegExp(s.regexp),f=c.exec(e);if(f){var u=r||lr.exports.now();return l.forEach(function(d,m){d.fn(u,f[m+1])}),u}throw new Error("String '"+e+"' could not be parsed as '"+t+"'")}function Tz(t,e,r){if(!t)throw new Error("pattern must be supplied");return Oz(t,e,r)}function Cz(){return new Date}lr.exports=US;lr.exports.asString=US;lr.exports.parse=Tz;lr.exports.now=Cz;lr.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS";lr.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO";lr.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS";lr.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"});var ty=b((yfe,tI)=>{a();var uo=df(),WS=require("os"),sl=require("util"),il=require("path"),HS=require("url"),KS=Ye()("log4js:layouts"),VS={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function GS(t){return t?`\x1B[${VS[t][0]}m`:""}function ZS(t){return t?`\x1B[${VS[t][1]}m`:""}function kz(t,e){return GS(e)+t+ZS(e)}function JS(t,e){return kz(sl.format("[%s] [%s] %s - ",uo.asString(t.startTime),t.level.toString(),t.categoryName),e)}function YS(t){return JS(t)+sl.format(...t.data)}function mf(t){return JS(t,t.level.colour)+sl.format(...t.data)}function XS(t){return sl.format(...t.data)}function QS(t){return t.data[0]}function eI(t,e){let r="%r %p %c - %m%n",n=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflos%])(\{([^}]+)\})?|([^%]+)/;t=t||r;function o(C,T){let O=C.categoryName;if(T){let U=parseInt(T,10),F=O.split(".");U<F.length&&(O=F.slice(F.length-U).join("."))}return O}function i(C,T){let O=uo.ISO8601_FORMAT;if(T)switch(O=T,O){case"ISO8601":case"ISO8601_FORMAT":O=uo.ISO8601_FORMAT;break;case"ISO8601_WITH_TZ_OFFSET":case"ISO8601_WITH_TZ_OFFSET_FORMAT":O=uo.ISO8601_WITH_TZ_OFFSET_FORMAT;break;case"ABSOLUTE":process.emitWarning("Pattern %d{ABSOLUTE} is deprecated in favor of %d{ABSOLUTETIME}. Please use %d{ABSOLUTETIME} instead.","DeprecationWarning","log4js-node-DEP0003"),KS("[log4js-node-DEP0003]","DEPRECATION: Pattern %d{ABSOLUTE} is deprecated and replaced by %d{ABSOLUTETIME}.");case"ABSOLUTETIME":case"ABSOLUTETIME_FORMAT":O=uo.ABSOLUTETIME_FORMAT;break;case"DATE":process.emitWarning("Pattern %d{DATE} is deprecated due to the confusion it causes when used. Please use %d{DATETIME} instead.","DeprecationWarning","log4js-node-DEP0004"),KS("[log4js-node-DEP0004]","DEPRECATION: Pattern %d{DATE} is deprecated and replaced by %d{DATETIME}.");case"DATETIME":case"DATETIME_FORMAT":O=uo.DATETIME_FORMAT;break}return uo.asString(O,C.startTime)}function s(){return WS.hostname().toString()}function l(C){return sl.format(...C.data)}function c(){return WS.EOL}function f(C){return C.level.toString()}function u(C){return uo.asString("hh:mm:ss",C.startTime)}function d(C){return GS(C.level.colour)}function m(C){return ZS(C.level.colour)}function h(){return"%"}function y(C){return C&&C.pid?C.pid.toString():process.pid.toString()}function w(){return y()}function v(C,T){return typeof e[T]<"u"?typeof e[T]=="function"?e[T](C):e[T]:null}function x(C,T){let O=C.context[T];return typeof O<"u"?typeof O=="function"?O(C):O:null}function S(C,T){let O=C.fileName||"";if(O=function(F){let se="file://";return F.startsWith(se)&&(typeof HS.fileURLToPath=="function"?F=HS.fileURLToPath(F):(F=il.normalize(F.replace(new RegExp(`^${se}`),"")),process.platform==="win32"&&(F.startsWith("\\")?F=F.slice(1):F=il.sep+il.sep+F))),F}(O),T){let F=parseInt(T,10),se=O.split(il.sep);se.length>F&&(O=se.slice(-F).join(il.sep))}return O}function k(C){return C.lineNumber?`${C.lineNumber}`:""}function j(C){return C.columnNumber?`${C.columnNumber}`:""}function Z(C){return C.callStack||""}let X={c:o,d:i,h:s,m:l,n:c,p:f,r:u,"[":d,"]":m,y:w,z:y,"%":h,x:v,X:x,f:S,l:k,o:j,s:Z};function J(C,T,O){return X[C](T,O)}function G(C,T){let O;return C?(O=parseInt(C.slice(1),10),O>0?T.slice(0,O):T.slice(O)):T}function $(C,T){let O;if(C)if(C.charAt(0)==="-")for(O=parseInt(C.slice(1),10);T.length<O;)T+=" ";else for(O=parseInt(C,10);T.length<O;)T=` ${T}`;return T}function te(C,T,O){let U=C;return U=G(T,U),U=$(O,U),U}return function(C){let T="",O,U=t;for(;(O=n.exec(U))!==null;){let F=O[1],se=O[2],le=O[3],we=O[5],fe=O[6];if(fe)T+=fe.toString();else{let I=J(le,C,we);T+=te(I,se,F)}U=U.slice(O.index+O[0].length)}return T}}var ey={messagePassThrough(){return XS},basic(){return YS},colored(){return mf},coloured(){return mf},pattern(t){return eI(t&&t.pattern,t&&t.tokens)},dummy(){return QS}};tI.exports={basicLayout:YS,messagePassThroughLayout:XS,patternLayout:eI,colouredLayout:mf,coloredLayout:mf,dummyLayout:QS,addLayout(t,e){ey[t]=e},layout(t,e){return ey[t]&&ey[t](e)}}});var ci=b((vfe,nI)=>{a();var Ue=ai(),rI=["white","grey","black","blue","cyan","green","magenta","red","yellow"],We=class{constructor(e,r,n){this.level=e,this.levelStr=r,this.colour=n}toString(){return this.levelStr}static getLevel(e,r){return e?e instanceof We?e:(e instanceof Object&&e.levelStr&&(e=e.levelStr),We[e.toString().toUpperCase()]||r):r}static addLevels(e){e&&(Object.keys(e).forEach(n=>{let o=n.toUpperCase();We[o]=new We(e[n].value,o,e[n].colour);let i=We.levels.findIndex(s=>s.levelStr===o);i>-1?We.levels[i]=We[o]:We.levels.push(We[o])}),We.levels.sort((n,o)=>n.level-o.level))}isLessThanOrEqualTo(e){return typeof e=="string"&&(e=We.getLevel(e)),this.level<=e.level}isGreaterThanOrEqualTo(e){return typeof e=="string"&&(e=We.getLevel(e)),this.level>=e.level}isEqualTo(e){return typeof e=="string"&&(e=We.getLevel(e)),this.level===e.level}};We.levels=[];We.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}});Ue.addListener(t=>{let e=t.levels;e&&(Ue.throwExceptionIf(t,Ue.not(Ue.anObject(e)),"levels must be an object"),Object.keys(e).forEach(n=>{Ue.throwExceptionIf(t,Ue.not(Ue.validIdentifier(n)),`level name "${n}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),Ue.throwExceptionIf(t,Ue.not(Ue.anObject(e[n])),`level "${n}" must be an object`),Ue.throwExceptionIf(t,Ue.not(e[n].value),`level "${n}" must have a 'value' property`),Ue.throwExceptionIf(t,Ue.not(Ue.anInteger(e[n].value)),`level "${n}".value must have an integer value`),Ue.throwExceptionIf(t,Ue.not(e[n].colour),`level "${n}" must have a 'colour' property`),Ue.throwExceptionIf(t,Ue.not(rI.indexOf(e[n].colour)>-1),`level "${n}".colour must be one of ${rI.join(", ")}`)}))});Ue.addListener(t=>{We.addLevels(t.levels)});nI.exports=We});var dI=b(ll=>{"use strict";a();var{parse:sI,stringify:aI}=JSON,{keys:Az}=Object,al=String,lI="string",oI={},hf="object",cI=(t,e)=>e,Rz=t=>t instanceof al?al(t):t,Nz=(t,e)=>typeof e===lI?new al(e):e,uI=(t,e,r,n)=>{let o=[];for(let i=Az(r),{length:s}=i,l=0;l<s;l++){let c=i[l],f=r[c];if(f instanceof al){let u=t[f];typeof u===hf&&!e.has(u)?(e.add(u),r[c]=oI,o.push({k:c,a:[t,e,u,n]})):r[c]=n.call(r,c,u)}else r[c]!==oI&&(r[c]=n.call(r,c,f))}for(let{length:i}=o,s=0;s<i;s++){let{k:l,a:c}=o[s];r[l]=n.call(r,l,uI.apply(null,c))}return r},iI=(t,e,r)=>{let n=al(e.push(r)-1);return t.set(r,n),n},fI=(t,e)=>{let r=sI(t,Nz).map(Rz),n=r[0],o=e||cI,i=typeof n===hf&&n?uI(r,new Set,n,o):n;return o.call({"":i},"",i)};ll.parse=fI;var pI=(t,e,r)=>{let n=e&&typeof e===hf?(u,d)=>u===""||-1<e.indexOf(u)?d:void 0:e||cI,o=new Map,i=[],s=[],l=+iI(o,i,n.call({"":t},"",t)),c=!l;for(;l<i.length;)c=!0,s[l]=aI(i[l++],f,r);return"["+s.join(",")+"]";function f(u,d){if(c)return c=!c,d;let m=n.call(this,u,d);switch(typeof m){case hf:if(m===null)return m;case lI:return o.get(m)||iI(o,i,m)}return m}};ll.stringify=pI;var Dz=t=>sI(pI(t));ll.toJSON=Dz;var Pz=t=>fI(aI(t));ll.fromJSON=Pz});var ry=b((Sfe,gI)=>{a();var mI=dI(),hI=ci(),Os=class{constructor(e,r,n,o,i){this.startTime=new Date,this.categoryName=e,this.data=n,this.level=r,this.context=Object.assign({},o),this.pid=process.pid,i&&(this.functionName=i.functionName,this.fileName=i.fileName,this.lineNumber=i.lineNumber,this.columnNumber=i.columnNumber,this.callStack=i.callStack)}serialise(){return mI.stringify(this,(e,r)=>(r&&r.message&&r.stack?r=Object.assign({message:r.message,stack:r.stack},r):typeof r=="number"&&(Number.isNaN(r)||!Number.isFinite(r))?r=r.toString():typeof r>"u"&&(r=typeof r),r))}static deserialise(e){let r;try{let n=mI.parse(e,(o,i)=>{if(i&&i.message&&i.stack){let s=new Error(i);Object.keys(i).forEach(l=>{s[l]=i[l]}),i=s}return i});n.location={functionName:n.functionName,fileName:n.fileName,lineNumber:n.lineNumber,columnNumber:n.columnNumber,callStack:n.callStack},r=new Os(n.categoryName,hI.getLevel(n.level.levelStr),n.data,n.context,n.location),r.startTime=new Date(n.startTime),r.pid=n.pid,r.cluster=n.cluster}catch(n){r=new Os("log4js",hI.ERROR,["Unable to parse log:",e,"because: ",n])}return r}};gI.exports=Os});var yf=b((_fe,vI)=>{a();var cr=Ye()("log4js:clustering"),Fz=ry(),$z=ai(),Ts=!1,ur=null;try{ur=require("cluster")}catch{cr("cluster module not present"),Ts=!0}var oy=[],ul=!1,cl="NODE_APP_INSTANCE",yI=()=>ul&&process.env[cl]==="0",ny=()=>Ts||ur&&ur.isMaster||yI(),bI=t=>{oy.forEach(e=>e(t))},gf=(t,e)=>{if(cr("cluster message received from worker ",t,": ",e),t.topic&&t.data&&(e=t,t=void 0),e&&e.topic&&e.topic==="log4js:message"){cr("received message: ",e.data);let r=Fz.deserialise(e.data);bI(r)}};Ts||$z.addListener(t=>{oy.length=0,{pm2:ul,disableClustering:Ts,pm2InstanceVar:cl="NODE_APP_INSTANCE"}=t,cr(`clustering disabled ? ${Ts}`),cr(`cluster.isMaster ? ${ur&&ur.isMaster}`),cr(`pm2 enabled ? ${ul}`),cr(`pm2InstanceVar = ${cl}`),cr(`process.env[${cl}] = ${process.env[cl]}`),ul&&process.removeListener("message",gf),ur&&ur.removeListener&&ur.removeListener("message",gf),Ts||t.disableClustering?cr("Not listening for cluster messages, because clustering disabled."):yI()?(cr("listening for PM2 broadcast messages"),process.on("message",gf)):ur&&ur.isMaster?(cr("listening for cluster messages"),ur.on("message",gf)):cr("not listening for messages, because we are not a master process")});vI.exports={onlyOnMaster:(t,e)=>ny()?t():e,isMaster:ny,send:t=>{ny()?bI(t):(ul||(t.cluster={workerId:ur.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:t.serialise()}))},onMessage:t=>{oy.push(t)}}});var EI=b((Tfe,xI)=>{a();function Mz(t){if(typeof t=="number"&&Number.isInteger(t))return t;let e={K:1024,M:1024*1024,G:1024*1024*1024},r=Object.keys(e),n=t.slice(-1).toLocaleUpperCase(),o=t.slice(0,-1).trim();if(r.indexOf(n)<0||!Number.isInteger(Number(o)))throw Error(`maxLogSize: "${t}" is invalid`);return o*e[n]}function Lz(t,e){let r=Object.assign({},e);return Object.keys(t).forEach(n=>{r[n]&&(r[n]=t[n](e[n]))}),r}function iy(t){return Lz({maxLogSize:Mz},t)}var wI={dateFile:iy,file:iy,fileSync:iy};xI.exports.modifyConfig=t=>wI[t.type]?wI[t.type](t):t});var II=b((kfe,SI)=>{a();var jz=console.log.bind(console);function qz(t,e){return r=>{jz(t(r,e))}}function Bz(t,e){let r=e.colouredLayout;return t.layout&&(r=e.layout(t.layout.type,t.layout)),qz(r,t.timezoneOffset)}SI.exports.configure=Bz});var OI=b(_I=>{a();function zz(t,e){return r=>{process.stdout.write(`${t(r,e)}
|
|
`)}}function Uz(t,e){let r=e.colouredLayout;return t.layout&&(r=e.layout(t.layout.type,t.layout)),zz(r,t.timezoneOffset)}_I.configure=Uz});var CI=b((Dfe,TI)=>{a();function Wz(t,e){return r=>{process.stderr.write(`${t(r,e)}
|
|
`)}}function Hz(t,e){let r=e.colouredLayout;return t.layout&&(r=e.layout(t.layout.type,t.layout)),Wz(r,t.timezoneOffset)}TI.exports.configure=Hz});var AI=b((Ffe,kI)=>{a();function Kz(t,e,r,n){let o=n.getLevel(t),i=n.getLevel(e,n.FATAL);return s=>{let l=s.level;o.isLessThanOrEqualTo(l)&&i.isGreaterThanOrEqualTo(l)&&r(s)}}function Vz(t,e,r,n){let o=r(t.appender);return Kz(t.level,t.maxLevel,o,n)}kI.exports.configure=Vz});var DI=b((Mfe,NI)=>{a();var RI=Ye()("log4js:categoryFilter");function Gz(t,e){return typeof t=="string"&&(t=[t]),r=>{RI(`Checking ${r.categoryName} against ${t}`),t.indexOf(r.categoryName)===-1&&(RI("Not excluded, sending to appender"),e(r))}}function Zz(t,e,r){let n=r(t.appender);return Gz(t.exclude,n)}NI.exports.configure=Zz});var $I=b((jfe,FI)=>{a();var PI=Ye()("log4js:noLogFilter");function Jz(t){return t.filter(r=>r!=null&&r!=="")}function Yz(t,e){return r=>{PI(`Checking data: ${r.data} against filters: ${t}`),typeof t=="string"&&(t=[t]),t=Jz(t);let n=new RegExp(t.join("|"),"i");(t.length===0||r.data.findIndex(o=>n.test(o))<0)&&(PI("Not excluded, sending to appender"),e(r))}}function Xz(t,e,r){let n=r(t.appender);return Yz(t.exclude,n)}FI.exports.configure=Xz});var Nt=b(sy=>{"use strict";a();sy.fromCallback=function(t){return Object.defineProperty(function(){if(typeof arguments[arguments.length-1]=="function")t.apply(this,arguments);else return new Promise((e,r)=>{arguments[arguments.length]=(n,o)=>{if(n)return r(n);e(o)},arguments.length++,t.apply(this,arguments)})},"name",{value:t.name})};sy.fromPromise=function(t){return Object.defineProperty(function(){let e=arguments[arguments.length-1];if(typeof e!="function")return t.apply(this,arguments);t.apply(this,arguments).then(r=>e(null,r),e)},"name",{value:t.name})}});var LI=b((Ufe,MI)=>{a();var fo=require("constants"),Qz=process.cwd,bf=null,e6=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return bf||(bf=Qz.call(process)),bf};try{process.cwd()}catch{}typeof process.chdir=="function"&&(ay=process.chdir,process.chdir=function(t){bf=null,ay.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,ay));var ay;MI.exports=t6;function t6(t){fo.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(t),t.lutimes||r(t),t.chown=i(t.chown),t.fchown=i(t.fchown),t.lchown=i(t.lchown),t.chmod=n(t.chmod),t.fchmod=n(t.fchmod),t.lchmod=n(t.lchmod),t.chownSync=s(t.chownSync),t.fchownSync=s(t.fchownSync),t.lchownSync=s(t.lchownSync),t.chmodSync=o(t.chmodSync),t.fchmodSync=o(t.fchmodSync),t.lchmodSync=o(t.lchmodSync),t.stat=l(t.stat),t.fstat=l(t.fstat),t.lstat=l(t.lstat),t.statSync=c(t.statSync),t.fstatSync=c(t.fstatSync),t.lstatSync=c(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(u,d,m){m&&process.nextTick(m)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(u,d,m,h){h&&process.nextTick(h)},t.lchownSync=function(){}),e6==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:function(u){function d(m,h,y){var w=Date.now(),v=0;u(m,h,function x(S){if(S&&(S.code==="EACCES"||S.code==="EPERM"||S.code==="EBUSY")&&Date.now()-w<6e4){setTimeout(function(){t.stat(h,function(k,j){k&&k.code==="ENOENT"?u(m,h,x):y(S)})},v),v<100&&(v+=10);return}y&&y(S)})}return Object.setPrototypeOf&&Object.setPrototypeOf(d,u),d}(t.rename)),t.read=typeof t.read!="function"?t.read:function(u){function d(m,h,y,w,v,x){var S;if(x&&typeof x=="function"){var k=0;S=function(j,Z,X){if(j&&j.code==="EAGAIN"&&k<10)return k++,u.call(t,m,h,y,w,v,S);x.apply(this,arguments)}}return u.call(t,m,h,y,w,v,S)}return Object.setPrototypeOf&&Object.setPrototypeOf(d,u),d}(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:function(u){return function(d,m,h,y,w){for(var v=0;;)try{return u.call(t,d,m,h,y,w)}catch(x){if(x.code==="EAGAIN"&&v<10){v++;continue}throw x}}}(t.readSync);function e(u){u.lchmod=function(d,m,h){u.open(d,fo.O_WRONLY|fo.O_SYMLINK,m,function(y,w){if(y){h&&h(y);return}u.fchmod(w,m,function(v){u.close(w,function(x){h&&h(v||x)})})})},u.lchmodSync=function(d,m){var h=u.openSync(d,fo.O_WRONLY|fo.O_SYMLINK,m),y=!0,w;try{w=u.fchmodSync(h,m),y=!1}finally{if(y)try{u.closeSync(h)}catch{}else u.closeSync(h)}return w}}function r(u){fo.hasOwnProperty("O_SYMLINK")&&u.futimes?(u.lutimes=function(d,m,h,y){u.open(d,fo.O_SYMLINK,function(w,v){if(w){y&&y(w);return}u.futimes(v,m,h,function(x){u.close(v,function(S){y&&y(x||S)})})})},u.lutimesSync=function(d,m,h){var y=u.openSync(d,fo.O_SYMLINK),w,v=!0;try{w=u.futimesSync(y,m,h),v=!1}finally{if(v)try{u.closeSync(y)}catch{}else u.closeSync(y)}return w}):u.futimes&&(u.lutimes=function(d,m,h,y){y&&process.nextTick(y)},u.lutimesSync=function(){})}function n(u){return u&&function(d,m,h){return u.call(t,d,m,function(y){f(y)&&(y=null),h&&h.apply(this,arguments)})}}function o(u){return u&&function(d,m){try{return u.call(t,d,m)}catch(h){if(!f(h))throw h}}}function i(u){return u&&function(d,m,h,y){return u.call(t,d,m,h,function(w){f(w)&&(w=null),y&&y.apply(this,arguments)})}}function s(u){return u&&function(d,m,h){try{return u.call(t,d,m,h)}catch(y){if(!f(y))throw y}}}function l(u){return u&&function(d,m,h){typeof m=="function"&&(h=m,m=null);function y(w,v){v&&(v.uid<0&&(v.uid+=4294967296),v.gid<0&&(v.gid+=4294967296)),h&&h.apply(this,arguments)}return m?u.call(t,d,m,y):u.call(t,d,y)}}function c(u){return u&&function(d,m){var h=m?u.call(t,d,m):u.call(t,d);return h&&(h.uid<0&&(h.uid+=4294967296),h.gid<0&&(h.gid+=4294967296)),h}}function f(u){if(!u||u.code==="ENOSYS")return!0;var d=!process.getuid||process.getuid()!==0;return!!(d&&(u.code==="EINVAL"||u.code==="EPERM"))}}});var BI=b((Hfe,qI)=>{a();var jI=require("stream").Stream;qI.exports=r6;function r6(t){return{ReadStream:e,WriteStream:r};function e(n,o){if(!(this instanceof e))return new e(n,o);jI.call(this);var i=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,o=o||{};for(var s=Object.keys(o),l=0,c=s.length;l<c;l++){var f=s[l];this[f]=o[f]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){i._read()});return}t.open(this.path,this.flags,this.mode,function(u,d){if(u){i.emit("error",u),i.readable=!1;return}i.fd=d,i.emit("open",d),i._read()})}function r(n,o){if(!(this instanceof r))return new r(n,o);jI.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,o=o||{};for(var i=Object.keys(o),s=0,l=i.length;s<l;s++){var c=i[s];this[c]=o[c]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var UI=b((Vfe,zI)=>{"use strict";a();zI.exports=o6;var n6=Object.getPrototypeOf||function(t){return t.__proto__};function o6(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:n6(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var He=b((Zfe,uy)=>{a();var Ne=require("fs"),i6=LI(),s6=BI(),a6=UI(),vf=require("util"),lt,xf;typeof Symbol=="function"&&typeof Symbol.for=="function"?(lt=Symbol.for("graceful-fs.queue"),xf=Symbol.for("graceful-fs.previous")):(lt="___graceful-fs.queue",xf="___graceful-fs.previous");function l6(){}function KI(t,e){Object.defineProperty(t,lt,{get:function(){return e}})}var ui=l6;vf.debuglog?ui=vf.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(ui=function(){var t=vf.format.apply(vf,arguments);t="GFS4: "+t.split(/\n/).join(`
|
|
GFS4: `),console.error(t)});Ne[lt]||(WI=global[lt]||[],KI(Ne,WI),Ne.close=function(t){function e(r,n){return t.call(Ne,r,function(o){o||HI(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,xf,{value:t}),e}(Ne.close),Ne.closeSync=function(t){function e(r){t.apply(Ne,arguments),HI()}return Object.defineProperty(e,xf,{value:t}),e}(Ne.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){ui(Ne[lt]),require("assert").equal(Ne[lt].length,0)}));var WI;global[lt]||KI(global,Ne[lt]);uy.exports=ly(a6(Ne));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Ne.__patched&&(uy.exports=ly(Ne),Ne.__patched=!0);function ly(t){i6(t),t.gracefulify=ly,t.createReadStream=Z,t.createWriteStream=X;var e=t.readFile;t.readFile=r;function r($,te,C){return typeof te=="function"&&(C=te,te=null),T($,te,C);function T(O,U,F,se){return e(O,U,function(le){le&&(le.code==="EMFILE"||le.code==="ENFILE")?Cs([T,[O,U,F],le,se||Date.now(),Date.now()]):typeof F=="function"&&F.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=o;function o($,te,C,T){return typeof C=="function"&&(T=C,C=null),O($,te,C,T);function O(U,F,se,le,we){return n(U,F,se,function(fe){fe&&(fe.code==="EMFILE"||fe.code==="ENFILE")?Cs([O,[U,F,se,le],fe,we||Date.now(),Date.now()]):typeof le=="function"&&le.apply(this,arguments)})}}var i=t.appendFile;i&&(t.appendFile=s);function s($,te,C,T){return typeof C=="function"&&(T=C,C=null),O($,te,C,T);function O(U,F,se,le,we){return i(U,F,se,function(fe){fe&&(fe.code==="EMFILE"||fe.code==="ENFILE")?Cs([O,[U,F,se,le],fe,we||Date.now(),Date.now()]):typeof le=="function"&&le.apply(this,arguments)})}}var l=t.copyFile;l&&(t.copyFile=c);function c($,te,C,T){return typeof C=="function"&&(T=C,C=0),O($,te,C,T);function O(U,F,se,le,we){return l(U,F,se,function(fe){fe&&(fe.code==="EMFILE"||fe.code==="ENFILE")?Cs([O,[U,F,se,le],fe,we||Date.now(),Date.now()]):typeof le=="function"&&le.apply(this,arguments)})}}var f=t.readdir;t.readdir=d;var u=/^v[0-5]\./;function d($,te,C){typeof te=="function"&&(C=te,te=null);var T=u.test(process.version)?function(F,se,le,we){return f(F,O(F,se,le,we))}:function(F,se,le,we){return f(F,se,O(F,se,le,we))};return T($,te,C);function O(U,F,se,le){return function(we,fe){we&&(we.code==="EMFILE"||we.code==="ENFILE")?Cs([T,[U,F,se],we,le||Date.now(),Date.now()]):(fe&&fe.sort&&fe.sort(),typeof se=="function"&&se.call(this,we,fe))}}}if(process.version.substr(0,4)==="v0.8"){var m=s6(t);x=m.ReadStream,k=m.WriteStream}var h=t.ReadStream;h&&(x.prototype=Object.create(h.prototype),x.prototype.open=S);var y=t.WriteStream;y&&(k.prototype=Object.create(y.prototype),k.prototype.open=j),Object.defineProperty(t,"ReadStream",{get:function(){return x},set:function($){x=$},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return k},set:function($){k=$},enumerable:!0,configurable:!0});var w=x;Object.defineProperty(t,"FileReadStream",{get:function(){return w},set:function($){w=$},enumerable:!0,configurable:!0});var v=k;Object.defineProperty(t,"FileWriteStream",{get:function(){return v},set:function($){v=$},enumerable:!0,configurable:!0});function x($,te){return this instanceof x?(h.apply(this,arguments),this):x.apply(Object.create(x.prototype),arguments)}function S(){var $=this;G($.path,$.flags,$.mode,function(te,C){te?($.autoClose&&$.destroy(),$.emit("error",te)):($.fd=C,$.emit("open",C),$.read())})}function k($,te){return this instanceof k?(y.apply(this,arguments),this):k.apply(Object.create(k.prototype),arguments)}function j(){var $=this;G($.path,$.flags,$.mode,function(te,C){te?($.destroy(),$.emit("error",te)):($.fd=C,$.emit("open",C))})}function Z($,te){return new t.ReadStream($,te)}function X($,te){return new t.WriteStream($,te)}var J=t.open;t.open=G;function G($,te,C,T){return typeof C=="function"&&(T=C,C=null),O($,te,C,T);function O(U,F,se,le,we){return J(U,F,se,function(fe,I){fe&&(fe.code==="EMFILE"||fe.code==="ENFILE")?Cs([O,[U,F,se,le],fe,we||Date.now(),Date.now()]):typeof le=="function"&&le.apply(this,arguments)})}}return t}function Cs(t){ui("ENQUEUE",t[0].name,t[1]),Ne[lt].push(t),cy()}var wf;function HI(){for(var t=Date.now(),e=0;e<Ne[lt].length;++e)Ne[lt][e].length>2&&(Ne[lt][e][3]=t,Ne[lt][e][4]=t);cy()}function cy(){if(clearTimeout(wf),wf=void 0,Ne[lt].length!==0){var t=Ne[lt].shift(),e=t[0],r=t[1],n=t[2],o=t[3],i=t[4];if(o===void 0)ui("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-o>=6e4){ui("TIMEOUT",e.name,r);var s=r.pop();typeof s=="function"&&s.call(null,n)}else{var l=Date.now()-i,c=Math.max(i-o,1),f=Math.min(c*1.2,100);l>=f?(ui("RETRY",e.name,r),e.apply(null,r.concat([o]))):Ne[lt].push(t)}wf===void 0&&(wf=setTimeout(cy,0))}}});var fy=b(fi=>{"use strict";a();var VI=Nt().fromCallback,fr=He(),c6=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(t=>typeof fr[t]=="function");Object.keys(fr).forEach(t=>{t!=="promises"&&(fi[t]=fr[t])});c6.forEach(t=>{fi[t]=VI(fr[t])});fi.exists=function(t,e){return typeof e=="function"?fr.exists(t,e):new Promise(r=>fr.exists(t,r))};fi.read=function(t,e,r,n,o,i){return typeof i=="function"?fr.read(t,e,r,n,o,i):new Promise((s,l)=>{fr.read(t,e,r,n,o,(c,f,u)=>{if(c)return l(c);s({bytesRead:f,buffer:u})})})};fi.write=function(t,e,...r){return typeof r[r.length-1]=="function"?fr.write(t,e,...r):new Promise((n,o)=>{fr.write(t,e,...r,(i,s,l)=>{if(i)return o(i);n({bytesWritten:s,buffer:l})})})};typeof fr.realpath.native=="function"&&(fi.realpath.native=VI(fr.realpath.native))});var dy=b((Qfe,ZI)=>{"use strict";a();var py=require("path");function GI(t){return t=py.normalize(py.resolve(t)).split(py.sep),t.length>0?t[0]:null}var u6=/[<>:"|?*]/;function f6(t){let e=GI(t);return t=t.replace(e,""),u6.test(t)}ZI.exports={getRootPath:GI,invalidWin32Path:f6}});var YI=b((tpe,JI)=>{"use strict";a();var p6=He(),my=require("path"),d6=dy().invalidWin32Path,m6=parseInt("0777",8);function hy(t,e,r,n){if(typeof e=="function"?(r=e,e={}):(!e||typeof e!="object")&&(e={mode:e}),process.platform==="win32"&&d6(t)){let s=new Error(t+" contains invalid WIN32 path characters.");return s.code="EINVAL",r(s)}let o=e.mode,i=e.fs||p6;o===void 0&&(o=m6&~process.umask()),n||(n=null),r=r||function(){},t=my.resolve(t),i.mkdir(t,o,s=>{if(!s)return n=n||t,r(null,n);switch(s.code){case"ENOENT":if(my.dirname(t)===t)return r(s);hy(my.dirname(t),e,(l,c)=>{l?r(l,c):hy(t,e,r,c)});break;default:i.stat(t,(l,c)=>{l||!c.isDirectory()?r(s,n):r(null,n)});break}})}JI.exports=hy});var QI=b((npe,XI)=>{"use strict";a();var h6=He(),gy=require("path"),g6=dy().invalidWin32Path,y6=parseInt("0777",8);function yy(t,e,r){(!e||typeof e!="object")&&(e={mode:e});let n=e.mode,o=e.fs||h6;if(process.platform==="win32"&&g6(t)){let i=new Error(t+" contains invalid WIN32 path characters.");throw i.code="EINVAL",i}n===void 0&&(n=y6&~process.umask()),r||(r=null),t=gy.resolve(t);try{o.mkdirSync(t,n),r=r||t}catch(i){if(i.code==="ENOENT"){if(gy.dirname(t)===t)throw i;r=yy(gy.dirname(t),e,r),yy(t,e,r)}else{let s;try{s=o.statSync(t)}catch{throw i}if(!s.isDirectory())throw i}}return r}XI.exports=yy});var Vt=b((ipe,e1)=>{"use strict";a();var b6=Nt().fromCallback,by=b6(YI()),vy=QI();e1.exports={mkdirs:by,mkdirsSync:vy,mkdirp:by,mkdirpSync:vy,ensureDir:by,ensureDirSync:vy}});var wy=b((ape,r1)=>{"use strict";a();var mt=He(),t1=require("os"),Ef=require("path");function v6(){let t=Ef.join("millis-test-sync"+Date.now().toString()+Math.random().toString().slice(2));t=Ef.join(t1.tmpdir(),t);let e=new Date(1435410243862);mt.writeFileSync(t,"https://github.com/jprichardson/node-fs-extra/pull/141");let r=mt.openSync(t,"r+");return mt.futimesSync(r,e,e),mt.closeSync(r),mt.statSync(t).mtime>1435410243e3}function w6(t){let e=Ef.join("millis-test"+Date.now().toString()+Math.random().toString().slice(2));e=Ef.join(t1.tmpdir(),e);let r=new Date(1435410243862);mt.writeFile(e,"https://github.com/jprichardson/node-fs-extra/pull/141",n=>{if(n)return t(n);mt.open(e,"r+",(o,i)=>{if(o)return t(o);mt.futimes(i,r,r,s=>{if(s)return t(s);mt.close(i,l=>{if(l)return t(l);mt.stat(e,(c,f)=>{if(c)return t(c);t(null,f.mtime>1435410243e3)})})})})})}function x6(t){if(typeof t=="number")return Math.floor(t/1e3)*1e3;if(t instanceof Date)return new Date(Math.floor(t.getTime()/1e3)*1e3);throw new Error("fs-extra: timeRemoveMillis() unknown parameter type")}function E6(t,e,r,n){mt.open(t,"r+",(o,i)=>{if(o)return n(o);mt.futimes(i,e,r,s=>{mt.close(i,l=>{n&&n(s||l)})})})}function S6(t,e,r){let n=mt.openSync(t,"r+");return mt.futimesSync(n,e,r),mt.closeSync(n)}r1.exports={hasMillisRes:w6,hasMillisResSync:v6,timeRemoveMillis:x6,utimesMillis:E6,utimesMillisSync:S6}});var dl=b((cpe,l1)=>{"use strict";a();var pr=He(),Dt=require("path"),n1=10,o1=5,I6=0,Ey=process.versions.node.split("."),i1=Number.parseInt(Ey[0],10),s1=Number.parseInt(Ey[1],10),_6=Number.parseInt(Ey[2],10);function fl(){if(i1>n1)return!0;if(i1===n1){if(s1>o1)return!0;if(s1===o1&&_6>=I6)return!0}return!1}function O6(t,e,r){fl()?pr.stat(t,{bigint:!0},(n,o)=>{if(n)return r(n);pr.stat(e,{bigint:!0},(i,s)=>i?i.code==="ENOENT"?r(null,{srcStat:o,destStat:null}):r(i):r(null,{srcStat:o,destStat:s}))}):pr.stat(t,(n,o)=>{if(n)return r(n);pr.stat(e,(i,s)=>i?i.code==="ENOENT"?r(null,{srcStat:o,destStat:null}):r(i):r(null,{srcStat:o,destStat:s}))})}function T6(t,e){let r,n;fl()?r=pr.statSync(t,{bigint:!0}):r=pr.statSync(t);try{fl()?n=pr.statSync(e,{bigint:!0}):n=pr.statSync(e)}catch(o){if(o.code==="ENOENT")return{srcStat:r,destStat:null};throw o}return{srcStat:r,destStat:n}}function C6(t,e,r,n){O6(t,e,(o,i)=>{if(o)return n(o);let{srcStat:s,destStat:l}=i;return l&&l.ino&&l.dev&&l.ino===s.ino&&l.dev===s.dev?n(new Error("Source and destination must not be the same.")):s.isDirectory()&&Sy(t,e)?n(new Error(pl(t,e,r))):n(null,{srcStat:s,destStat:l})})}function k6(t,e,r){let{srcStat:n,destStat:o}=T6(t,e);if(o&&o.ino&&o.dev&&o.ino===n.ino&&o.dev===n.dev)throw new Error("Source and destination must not be the same.");if(n.isDirectory()&&Sy(t,e))throw new Error(pl(t,e,r));return{srcStat:n,destStat:o}}function xy(t,e,r,n,o){let i=Dt.resolve(Dt.dirname(t)),s=Dt.resolve(Dt.dirname(r));if(s===i||s===Dt.parse(s).root)return o();fl()?pr.stat(s,{bigint:!0},(l,c)=>l?l.code==="ENOENT"?o():o(l):c.ino&&c.dev&&c.ino===e.ino&&c.dev===e.dev?o(new Error(pl(t,r,n))):xy(t,e,s,n,o)):pr.stat(s,(l,c)=>l?l.code==="ENOENT"?o():o(l):c.ino&&c.dev&&c.ino===e.ino&&c.dev===e.dev?o(new Error(pl(t,r,n))):xy(t,e,s,n,o))}function a1(t,e,r,n){let o=Dt.resolve(Dt.dirname(t)),i=Dt.resolve(Dt.dirname(r));if(i===o||i===Dt.parse(i).root)return;let s;try{fl()?s=pr.statSync(i,{bigint:!0}):s=pr.statSync(i)}catch(l){if(l.code==="ENOENT")return;throw l}if(s.ino&&s.dev&&s.ino===e.ino&&s.dev===e.dev)throw new Error(pl(t,r,n));return a1(t,e,i,n)}function Sy(t,e){let r=Dt.resolve(t).split(Dt.sep).filter(o=>o),n=Dt.resolve(e).split(Dt.sep).filter(o=>o);return r.reduce((o,i,s)=>o&&n[s]===i,!0)}function pl(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}l1.exports={checkPaths:C6,checkPathsSync:k6,checkParentPaths:xy,checkParentPathsSync:a1,isSrcSubdir:Sy}});var u1=b((fpe,c1)=>{"use strict";a();c1.exports=function(t){if(typeof Buffer.allocUnsafe=="function")try{return Buffer.allocUnsafe(t)}catch{return new Buffer(t)}return new Buffer(t)}});var h1=b((dpe,m1)=>{"use strict";a();var Ae=He(),ml=require("path"),A6=Vt().mkdirsSync,R6=wy().utimesMillisSync,hl=dl();function N6(t,e,r){typeof r=="function"&&(r={filter:r}),r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
|
|
see https://github.com/jprichardson/node-fs-extra/issues/269`);let{srcStat:n,destStat:o}=hl.checkPathsSync(t,e,"copy");return hl.checkParentPathsSync(t,n,e,"copy"),D6(o,t,e,r)}function D6(t,e,r,n){if(n.filter&&!n.filter(e,r))return;let o=ml.dirname(r);return Ae.existsSync(o)||A6(o),f1(t,e,r,n)}function f1(t,e,r,n){if(!(n.filter&&!n.filter(e,r)))return P6(t,e,r,n)}function P6(t,e,r,n){let i=(n.dereference?Ae.statSync:Ae.lstatSync)(e);if(i.isDirectory())return L6(i,t,e,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return F6(i,t,e,r,n);if(i.isSymbolicLink())return B6(t,e,r,n)}function F6(t,e,r,n,o){return e?$6(t,r,n,o):p1(t,r,n,o)}function $6(t,e,r,n){if(n.overwrite)return Ae.unlinkSync(r),p1(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function p1(t,e,r,n){return typeof Ae.copyFileSync=="function"?(Ae.copyFileSync(e,r),Ae.chmodSync(r,t.mode),n.preserveTimestamps?R6(r,t.atime,t.mtime):void 0):M6(t,e,r,n)}function M6(t,e,r,n){let i=u1()(65536),s=Ae.openSync(e,"r"),l=Ae.openSync(r,"w",t.mode),c=0;for(;c<t.size;){let f=Ae.readSync(s,i,0,65536,c);Ae.writeSync(l,i,0,f),c+=f}n.preserveTimestamps&&Ae.futimesSync(l,t.atime,t.mtime),Ae.closeSync(s),Ae.closeSync(l)}function L6(t,e,r,n,o){if(!e)return j6(t,r,n,o);if(e&&!e.isDirectory())throw new Error(`Cannot overwrite non-directory '${n}' with directory '${r}'.`);return d1(r,n,o)}function j6(t,e,r,n){return Ae.mkdirSync(r),d1(e,r,n),Ae.chmodSync(r,t.mode)}function d1(t,e,r){Ae.readdirSync(t).forEach(n=>q6(n,t,e,r))}function q6(t,e,r,n){let o=ml.join(e,t),i=ml.join(r,t),{destStat:s}=hl.checkPathsSync(o,i,"copy");return f1(s,o,i,n)}function B6(t,e,r,n){let o=Ae.readlinkSync(e);if(n.dereference&&(o=ml.resolve(process.cwd(),o)),t){let i;try{i=Ae.readlinkSync(r)}catch(s){if(s.code==="EINVAL"||s.code==="UNKNOWN")return Ae.symlinkSync(o,r);throw s}if(n.dereference&&(i=ml.resolve(process.cwd(),i)),hl.isSrcSubdir(o,i))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`);if(Ae.statSync(r).isDirectory()&&hl.isSrcSubdir(i,o))throw new Error(`Cannot overwrite '${i}' with '${o}'.`);return z6(o,r)}else return Ae.symlinkSync(o,r)}function z6(t,e){return Ae.unlinkSync(e),Ae.symlinkSync(t,e)}m1.exports=N6});var Iy=b((hpe,g1)=>{"use strict";a();g1.exports={copySync:h1()}});var Jr=b((ype,b1)=>{"use strict";a();var U6=Nt().fromPromise,y1=fy();function W6(t){return y1.access(t).then(()=>!0).catch(()=>!1)}b1.exports={pathExists:U6(W6),pathExistsSync:y1.existsSync}});var T1=b((vpe,O1)=>{"use strict";a();var ct=He(),gl=require("path"),H6=Vt().mkdirs,K6=Jr().pathExists,V6=wy().utimesMillis,yl=dl();function G6(t,e,r,n){typeof r=="function"&&!n?(n=r,r={}):typeof r=="function"&&(r={filter:r}),n=n||function(){},r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
|
|
see https://github.com/jprichardson/node-fs-extra/issues/269`),yl.checkPaths(t,e,"copy",(o,i)=>{if(o)return n(o);let{srcStat:s,destStat:l}=i;yl.checkParentPaths(t,s,e,"copy",c=>c?n(c):r.filter?x1(v1,l,t,e,r,n):v1(l,t,e,r,n))})}function v1(t,e,r,n,o){let i=gl.dirname(r);K6(i,(s,l)=>{if(s)return o(s);if(l)return _y(t,e,r,n,o);H6(i,c=>c?o(c):_y(t,e,r,n,o))})}function x1(t,e,r,n,o,i){Promise.resolve(o.filter(r,n)).then(s=>s?t(e,r,n,o,i):i(),s=>i(s))}function _y(t,e,r,n,o){return n.filter?x1(w1,t,e,r,n,o):w1(t,e,r,n,o)}function w1(t,e,r,n,o){(n.dereference?ct.stat:ct.lstat)(e,(s,l)=>{if(s)return o(s);if(l.isDirectory())return X6(l,t,e,r,n,o);if(l.isFile()||l.isCharacterDevice()||l.isBlockDevice())return Z6(l,t,e,r,n,o);if(l.isSymbolicLink())return t9(t,e,r,n,o)})}function Z6(t,e,r,n,o,i){return e?J6(t,r,n,o,i):E1(t,r,n,o,i)}function J6(t,e,r,n,o){if(n.overwrite)ct.unlink(r,i=>i?o(i):E1(t,e,r,n,o));else return n.errorOnExist?o(new Error(`'${r}' already exists`)):o()}function E1(t,e,r,n,o){return typeof ct.copyFile=="function"?ct.copyFile(e,r,i=>i?o(i):S1(t,r,n,o)):Y6(t,e,r,n,o)}function Y6(t,e,r,n,o){let i=ct.createReadStream(e);i.on("error",s=>o(s)).once("open",()=>{let s=ct.createWriteStream(r,{mode:t.mode});s.on("error",l=>o(l)).on("open",()=>i.pipe(s)).once("close",()=>S1(t,r,n,o))})}function S1(t,e,r,n){ct.chmod(e,t.mode,o=>o?n(o):r.preserveTimestamps?V6(e,t.atime,t.mtime,n):n())}function X6(t,e,r,n,o,i){return e?e&&!e.isDirectory()?i(new Error(`Cannot overwrite non-directory '${n}' with directory '${r}'.`)):I1(r,n,o,i):Q6(t,r,n,o,i)}function Q6(t,e,r,n,o){ct.mkdir(r,i=>{if(i)return o(i);I1(e,r,n,s=>s?o(s):ct.chmod(r,t.mode,o))})}function I1(t,e,r,n){ct.readdir(t,(o,i)=>o?n(o):_1(i,t,e,r,n))}function _1(t,e,r,n,o){let i=t.pop();return i?e9(t,i,e,r,n,o):o()}function e9(t,e,r,n,o,i){let s=gl.join(r,e),l=gl.join(n,e);yl.checkPaths(s,l,"copy",(c,f)=>{if(c)return i(c);let{destStat:u}=f;_y(u,s,l,o,d=>d?i(d):_1(t,r,n,o,i))})}function t9(t,e,r,n,o){ct.readlink(e,(i,s)=>{if(i)return o(i);if(n.dereference&&(s=gl.resolve(process.cwd(),s)),t)ct.readlink(r,(l,c)=>l?l.code==="EINVAL"||l.code==="UNKNOWN"?ct.symlink(s,r,o):o(l):(n.dereference&&(c=gl.resolve(process.cwd(),c)),yl.isSrcSubdir(s,c)?o(new Error(`Cannot copy '${s}' to a subdirectory of itself, '${c}'.`)):t.isDirectory()&&yl.isSrcSubdir(c,s)?o(new Error(`Cannot overwrite '${c}' with '${s}'.`)):r9(s,r,o)));else return ct.symlink(s,r,o)})}function r9(t,e,r){ct.unlink(e,n=>n?r(n):ct.symlink(t,e,r))}O1.exports=G6});var Oy=b((xpe,C1)=>{"use strict";a();var n9=Nt().fromCallback;C1.exports={copy:n9(T1())}});var M1=b((Spe,$1)=>{"use strict";a();var k1=He(),D1=require("path"),ye=require("assert"),bl=process.platform==="win32";function P1(t){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(r=>{t[r]=t[r]||k1[r],r=r+"Sync",t[r]=t[r]||k1[r]}),t.maxBusyTries=t.maxBusyTries||3}function Ty(t,e,r){let n=0;typeof e=="function"&&(r=e,e={}),ye(t,"rimraf: missing path"),ye.strictEqual(typeof t,"string","rimraf: path should be a string"),ye.strictEqual(typeof r,"function","rimraf: callback function required"),ye(e,"rimraf: invalid options argument provided"),ye.strictEqual(typeof e,"object","rimraf: options should be object"),P1(e),A1(t,e,function o(i){if(i){if((i.code==="EBUSY"||i.code==="ENOTEMPTY"||i.code==="EPERM")&&n<e.maxBusyTries){n++;let s=n*100;return setTimeout(()=>A1(t,e,o),s)}i.code==="ENOENT"&&(i=null)}r(i)})}function A1(t,e,r){ye(t),ye(e),ye(typeof r=="function"),e.lstat(t,(n,o)=>{if(n&&n.code==="ENOENT")return r(null);if(n&&n.code==="EPERM"&&bl)return R1(t,e,n,r);if(o&&o.isDirectory())return Sf(t,e,n,r);e.unlink(t,i=>{if(i){if(i.code==="ENOENT")return r(null);if(i.code==="EPERM")return bl?R1(t,e,i,r):Sf(t,e,i,r);if(i.code==="EISDIR")return Sf(t,e,i,r)}return r(i)})})}function R1(t,e,r,n){ye(t),ye(e),ye(typeof n=="function"),r&&ye(r instanceof Error),e.chmod(t,438,o=>{o?n(o.code==="ENOENT"?null:r):e.stat(t,(i,s)=>{i?n(i.code==="ENOENT"?null:r):s.isDirectory()?Sf(t,e,r,n):e.unlink(t,n)})})}function N1(t,e,r){let n;ye(t),ye(e),r&&ye(r instanceof Error);try{e.chmodSync(t,438)}catch(o){if(o.code==="ENOENT")return;throw r}try{n=e.statSync(t)}catch(o){if(o.code==="ENOENT")return;throw r}n.isDirectory()?If(t,e,r):e.unlinkSync(t)}function Sf(t,e,r,n){ye(t),ye(e),r&&ye(r instanceof Error),ye(typeof n=="function"),e.rmdir(t,o=>{o&&(o.code==="ENOTEMPTY"||o.code==="EEXIST"||o.code==="EPERM")?o9(t,e,n):o&&o.code==="ENOTDIR"?n(r):n(o)})}function o9(t,e,r){ye(t),ye(e),ye(typeof r=="function"),e.readdir(t,(n,o)=>{if(n)return r(n);let i=o.length,s;if(i===0)return e.rmdir(t,r);o.forEach(l=>{Ty(D1.join(t,l),e,c=>{if(!s){if(c)return r(s=c);--i===0&&e.rmdir(t,r)}})})})}function F1(t,e){let r;e=e||{},P1(e),ye(t,"rimraf: missing path"),ye.strictEqual(typeof t,"string","rimraf: path should be a string"),ye(e,"rimraf: missing options"),ye.strictEqual(typeof e,"object","rimraf: options should be object");try{r=e.lstatSync(t)}catch(n){if(n.code==="ENOENT")return;n.code==="EPERM"&&bl&&N1(t,e,n)}try{r&&r.isDirectory()?If(t,e,null):e.unlinkSync(t)}catch(n){if(n.code==="ENOENT")return;if(n.code==="EPERM")return bl?N1(t,e,n):If(t,e,n);if(n.code!=="EISDIR")throw n;If(t,e,n)}}function If(t,e,r){ye(t),ye(e),r&&ye(r instanceof Error);try{e.rmdirSync(t)}catch(n){if(n.code==="ENOTDIR")throw r;if(n.code==="ENOTEMPTY"||n.code==="EEXIST"||n.code==="EPERM")i9(t,e);else if(n.code!=="ENOENT")throw n}}function i9(t,e){if(ye(t),ye(e),e.readdirSync(t).forEach(r=>F1(D1.join(t,r),e)),bl){let r=Date.now();do try{return e.rmdirSync(t,e)}catch{}while(Date.now()-r<500)}else return e.rmdirSync(t,e)}$1.exports=Ty;Ty.sync=F1});var vl=b((_pe,j1)=>{"use strict";a();var s9=Nt().fromCallback,L1=M1();j1.exports={remove:s9(L1),removeSync:L1.sync}});var V1=b((Tpe,K1)=>{"use strict";a();var a9=Nt().fromCallback,z1=He(),U1=require("path"),W1=Vt(),H1=vl(),q1=a9(function(e,r){r=r||function(){},z1.readdir(e,(n,o)=>{if(n)return W1.mkdirs(e,r);o=o.map(s=>U1.join(e,s)),i();function i(){let s=o.pop();if(!s)return r();H1.remove(s,l=>{if(l)return r(l);i()})}})});function B1(t){let e;try{e=z1.readdirSync(t)}catch{return W1.mkdirsSync(t)}e.forEach(r=>{r=U1.join(t,r),H1.removeSync(r)})}K1.exports={emptyDirSync:B1,emptydirSync:B1,emptyDir:q1,emptydir:q1}});var Y1=b((kpe,J1)=>{"use strict";a();var l9=Nt().fromCallback,G1=require("path"),wl=He(),Z1=Vt(),c9=Jr().pathExists;function u9(t,e){function r(){wl.writeFile(t,"",n=>{if(n)return e(n);e()})}wl.stat(t,(n,o)=>{if(!n&&o.isFile())return e();let i=G1.dirname(t);c9(i,(s,l)=>{if(s)return e(s);if(l)return r();Z1.mkdirs(i,c=>{if(c)return e(c);r()})})})}function f9(t){let e;try{e=wl.statSync(t)}catch{}if(e&&e.isFile())return;let r=G1.dirname(t);wl.existsSync(r)||Z1.mkdirsSync(r),wl.writeFileSync(t,"")}J1.exports={createFile:l9(u9),createFileSync:f9}});var r_=b((Rpe,t_)=>{"use strict";a();var p9=Nt().fromCallback,Q1=require("path"),pi=He(),e_=Vt(),X1=Jr().pathExists;function d9(t,e,r){function n(o,i){pi.link(o,i,s=>{if(s)return r(s);r(null)})}X1(e,(o,i)=>{if(o)return r(o);if(i)return r(null);pi.lstat(t,s=>{if(s)return s.message=s.message.replace("lstat","ensureLink"),r(s);let l=Q1.dirname(e);X1(l,(c,f)=>{if(c)return r(c);if(f)return n(t,e);e_.mkdirs(l,u=>{if(u)return r(u);n(t,e)})})})})}function m9(t,e){if(pi.existsSync(e))return;try{pi.lstatSync(t)}catch(i){throw i.message=i.message.replace("lstat","ensureLink"),i}let n=Q1.dirname(e);return pi.existsSync(n)||e_.mkdirsSync(n),pi.linkSync(t,e)}t_.exports={createLink:p9(d9),createLinkSync:m9}});var o_=b((Dpe,n_)=>{"use strict";a();var po=require("path"),xl=He(),h9=Jr().pathExists;function g9(t,e,r){if(po.isAbsolute(t))return xl.lstat(t,n=>n?(n.message=n.message.replace("lstat","ensureSymlink"),r(n)):r(null,{toCwd:t,toDst:t}));{let n=po.dirname(e),o=po.join(n,t);return h9(o,(i,s)=>i?r(i):s?r(null,{toCwd:o,toDst:t}):xl.lstat(t,l=>l?(l.message=l.message.replace("lstat","ensureSymlink"),r(l)):r(null,{toCwd:t,toDst:po.relative(n,t)})))}}function y9(t,e){let r;if(po.isAbsolute(t)){if(r=xl.existsSync(t),!r)throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}else{let n=po.dirname(e),o=po.join(n,t);if(r=xl.existsSync(o),r)return{toCwd:o,toDst:t};if(r=xl.existsSync(t),!r)throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:po.relative(n,t)}}}n_.exports={symlinkPaths:g9,symlinkPathsSync:y9}});var a_=b((Fpe,s_)=>{"use strict";a();var i_=He();function b9(t,e,r){if(r=typeof e=="function"?e:r,e=typeof e=="function"?!1:e,e)return r(null,e);i_.lstat(t,(n,o)=>{if(n)return r(null,"file");e=o&&o.isDirectory()?"dir":"file",r(null,e)})}function v9(t,e){let r;if(e)return e;try{r=i_.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}s_.exports={symlinkType:b9,symlinkTypeSync:v9}});var m_=b((Mpe,d_)=>{"use strict";a();var w9=Nt().fromCallback,c_=require("path"),ks=He(),u_=Vt(),x9=u_.mkdirs,E9=u_.mkdirsSync,f_=o_(),S9=f_.symlinkPaths,I9=f_.symlinkPathsSync,p_=a_(),_9=p_.symlinkType,O9=p_.symlinkTypeSync,l_=Jr().pathExists;function T9(t,e,r,n){n=typeof r=="function"?r:n,r=typeof r=="function"?!1:r,l_(e,(o,i)=>{if(o)return n(o);if(i)return n(null);S9(t,e,(s,l)=>{if(s)return n(s);t=l.toDst,_9(l.toCwd,r,(c,f)=>{if(c)return n(c);let u=c_.dirname(e);l_(u,(d,m)=>{if(d)return n(d);if(m)return ks.symlink(t,e,f,n);x9(u,h=>{if(h)return n(h);ks.symlink(t,e,f,n)})})})})})}function C9(t,e,r){if(ks.existsSync(e))return;let o=I9(t,e);t=o.toDst,r=O9(o.toCwd,r);let i=c_.dirname(e);return ks.existsSync(i)||E9(i),ks.symlinkSync(t,e,r)}d_.exports={createSymlink:w9(T9),createSymlinkSync:C9}});var g_=b((jpe,h_)=>{"use strict";a();var _f=Y1(),Of=r_(),Tf=m_();h_.exports={createFile:_f.createFile,createFileSync:_f.createFileSync,ensureFile:_f.createFile,ensureFileSync:_f.createFileSync,createLink:Of.createLink,createLinkSync:Of.createLinkSync,ensureLink:Of.createLink,ensureLinkSync:Of.createLinkSync,createSymlink:Tf.createSymlink,createSymlinkSync:Tf.createSymlinkSync,ensureSymlink:Tf.createSymlink,ensureSymlinkSync:Tf.createSymlinkSync}});var w_=b((Bpe,v_)=>{a();var As;try{As=He()}catch{As=require("fs")}function k9(t,e,r){r==null&&(r=e,e={}),typeof e=="string"&&(e={encoding:e}),e=e||{};var n=e.fs||As,o=!0;"throws"in e&&(o=e.throws),n.readFile(t,e,function(i,s){if(i)return r(i);s=b_(s);var l;try{l=JSON.parse(s,e?e.reviver:null)}catch(c){return o?(c.message=t+": "+c.message,r(c)):r(null,null)}r(null,l)})}function A9(t,e){e=e||{},typeof e=="string"&&(e={encoding:e});var r=e.fs||As,n=!0;"throws"in e&&(n=e.throws);try{var o=r.readFileSync(t,e);return o=b_(o),JSON.parse(o,e.reviver)}catch(i){if(n)throw i.message=t+": "+i.message,i;return null}}function y_(t,e){var r,n=`
|
|
`;typeof e=="object"&&e!==null&&(e.spaces&&(r=e.spaces),e.EOL&&(n=e.EOL));var o=JSON.stringify(t,e?e.replacer:null,r);return o.replace(/\n/g,n)+n}function R9(t,e,r,n){n==null&&(n=r,r={}),r=r||{};var o=r.fs||As,i="";try{i=y_(e,r)}catch(s){n&&n(s,null);return}o.writeFile(t,i,r,n)}function N9(t,e,r){r=r||{};var n=r.fs||As,o=y_(e,r);return n.writeFileSync(t,o,r)}function b_(t){return Buffer.isBuffer(t)&&(t=t.toString("utf8")),t=t.replace(/^\uFEFF/,""),t}var D9={readFile:k9,readFileSync:A9,writeFile:R9,writeFileSync:N9};v_.exports=D9});var kf=b((Upe,E_)=>{"use strict";a();var x_=Nt().fromCallback,Cf=w_();E_.exports={readJson:x_(Cf.readFile),readJsonSync:Cf.readFileSync,writeJson:x_(Cf.writeFile),writeJsonSync:Cf.writeFileSync}});var __=b((Hpe,I_)=>{"use strict";a();var P9=require("path"),F9=Vt(),$9=Jr().pathExists,S_=kf();function M9(t,e,r,n){typeof r=="function"&&(n=r,r={});let o=P9.dirname(t);$9(o,(i,s)=>{if(i)return n(i);if(s)return S_.writeJson(t,e,r,n);F9.mkdirs(o,l=>{if(l)return n(l);S_.writeJson(t,e,r,n)})})}I_.exports=M9});var T_=b((Vpe,O_)=>{"use strict";a();var L9=He(),j9=require("path"),q9=Vt(),B9=kf();function z9(t,e,r){let n=j9.dirname(t);L9.existsSync(n)||q9.mkdirsSync(n),B9.writeJsonSync(t,e,r)}O_.exports=z9});var k_=b((Zpe,C_)=>{"use strict";a();var U9=Nt().fromCallback,xt=kf();xt.outputJson=U9(__());xt.outputJsonSync=T_();xt.outputJSON=xt.outputJson;xt.outputJSONSync=xt.outputJsonSync;xt.writeJSON=xt.writeJson;xt.writeJSONSync=xt.writeJsonSync;xt.readJSON=xt.readJson;xt.readJSONSync=xt.readJsonSync;C_.exports=xt});var F_=b((Ype,P_)=>{"use strict";a();var N_=He(),W9=require("path"),H9=Iy().copySync,D_=vl().removeSync,K9=Vt().mkdirpSync,A_=dl();function V9(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:o}=A_.checkPathsSync(t,e,"move");return A_.checkParentPathsSync(t,o,e,"move"),K9(W9.dirname(e)),G9(t,e,n)}function G9(t,e,r){if(r)return D_(e),R_(t,e,r);if(N_.existsSync(e))throw new Error("dest already exists.");return R_(t,e,r)}function R_(t,e,r){try{N_.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return Z9(t,e,r)}}function Z9(t,e,r){return H9(t,e,{overwrite:r,errorOnExist:!0}),D_(t)}P_.exports=V9});var M_=b((Qpe,$_)=>{"use strict";a();$_.exports={moveSync:F_()}});var z_=b((tde,B_)=>{"use strict";a();var J9=He(),Y9=require("path"),X9=Oy().copy,q_=vl().remove,Q9=Vt().mkdirp,e4=Jr().pathExists,L_=dl();function t4(t,e,r,n){typeof r=="function"&&(n=r,r={});let o=r.overwrite||r.clobber||!1;L_.checkPaths(t,e,"move",(i,s)=>{if(i)return n(i);let{srcStat:l}=s;L_.checkParentPaths(t,l,e,"move",c=>{if(c)return n(c);Q9(Y9.dirname(e),f=>f?n(f):r4(t,e,o,n))})})}function r4(t,e,r,n){if(r)return q_(e,o=>o?n(o):j_(t,e,r,n));e4(e,(o,i)=>o?n(o):i?n(new Error("dest already exists.")):j_(t,e,r,n))}function j_(t,e,r,n){J9.rename(t,e,o=>o?o.code!=="EXDEV"?n(o):n4(t,e,r,n):n())}function n4(t,e,r,n){X9(t,e,{overwrite:r,errorOnExist:!0},i=>i?n(i):q_(t,n))}B_.exports=t4});var W_=b((nde,U_)=>{"use strict";a();var o4=Nt().fromCallback;U_.exports={move:o4(z_())}});var G_=b((ide,V_)=>{"use strict";a();var i4=Nt().fromCallback,El=He(),H_=require("path"),K_=Vt(),s4=Jr().pathExists;function a4(t,e,r,n){typeof r=="function"&&(n=r,r="utf8");let o=H_.dirname(t);s4(o,(i,s)=>{if(i)return n(i);if(s)return El.writeFile(t,e,r,n);K_.mkdirs(o,l=>{if(l)return n(l);El.writeFile(t,e,r,n)})})}function l4(t,...e){let r=H_.dirname(t);if(El.existsSync(r))return El.writeFileSync(t,...e);K_.mkdirsSync(r),El.writeFileSync(t,...e)}V_.exports={outputFile:i4(a4),outputFileSync:l4}});var ky=b((ade,Cy)=>{"use strict";a();Cy.exports=Object.assign({},fy(),Iy(),Oy(),V1(),g_(),k_(),Vt(),M_(),W_(),G_(),Jr(),vl());var Z_=require("fs");Object.getOwnPropertyDescriptor(Z_,"promises")&&Object.defineProperty(Cy.exports,"promises",{get(){return Z_.promises}})});var Y_=b((cde,J_)=>{a();J_.exports=()=>new Date});var Q_=b((fde,X_)=>{a();var c4=Ye()("streamroller:fileNameFormatter"),u4=require("path"),f4=".gz",p4=".";X_.exports=({file:t,keepFileExt:e,needsIndex:r,alwaysIncludeDate:n,compress:o,fileNameSep:i})=>{let s=i||p4,l=u4.join(t.dir,t.name),c=h=>h+t.ext,f=(h,y,w)=>(r||!w)&&y?h+s+y:h,u=(h,y,w)=>(y>0||n)&&w?h+s+w:h,d=(h,y)=>y&&o?h+f4:h,m=e?[u,f,c,d]:[c,u,f,d];return({date:h,index:y})=>(c4(`_formatFileName: date=${h}, index=${y}`),m.reduce((w,v)=>v(w,y,h),l))}});var nO=b((dde,rO)=>{a();var di=Ye()("streamroller:fileNameParser"),eO=".gz",tO=df(),d4=".";rO.exports=({file:t,keepFileExt:e,pattern:r,fileNameSep:n})=>{let o=n||d4,i=(m,h)=>m.endsWith(eO)?(di("it is gzipped"),h.isCompressed=!0,m.slice(0,-1*eO.length)):m,s="__NOT_MATCHING__",d=[i,e?m=>m.startsWith(t.name)&&m.endsWith(t.ext)?(di("it starts and ends with the right things"),m.slice(t.name.length+1,-1*t.ext.length)):s:m=>m.startsWith(t.base)?(di("it starts with the right things"),m.slice(t.base.length+1)):s,r?(m,h)=>{let y=m.split(o),w=y[y.length-1];di("items: ",y,", indexStr: ",w);let v=m;w!==void 0&&w.match(/^\d+$/)?(v=m.slice(0,-1*(w.length+1)),di(`dateStr is ${v}`),r&&!v&&(v=w,w="0")):w="0";try{let x=tO.parse(r,v,new Date(0,0));return tO.asString(r,x)!==v?m:(h.index=parseInt(w,10),h.date=v,h.timestamp=x.getTime(),"")}catch(x){return di(`Problem parsing ${v} as ${r}, error was: `,x),m}}:(m,h)=>m.match(/^\d+$/)?(di("it has an index"),h.index=parseInt(m,10),""):m];return m=>{let h={filename:m,index:0,isCompressed:!1};return d.reduce((w,v)=>v(w,h),m)?null:h}}});var iO=b((hde,oO)=>{a();var Pt=Ye()("streamroller:moveAndMaybeCompressFile"),_n=ky(),m4=require("zlib"),h4=function(t){let e={mode:parseInt("0600",8),compress:!1},r=Object.assign({},e,t);return Pt(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(r)}`),r},g4=async(t,e,r)=>{if(r=h4(r),t===e){Pt("moveAndMaybeCompressFile: source and target are the same, not doing anything");return}if(await _n.pathExists(t))if(Pt(`moveAndMaybeCompressFile: moving file from ${t} to ${e} ${r.compress?"with":"without"} compress`),r.compress)await new Promise((n,o)=>{let i=!1,s=_n.createWriteStream(e,{mode:r.mode,flags:"wx"}).on("open",()=>{i=!0;let l=_n.createReadStream(t).on("open",()=>{l.pipe(m4.createGzip()).pipe(s)}).on("error",c=>{Pt(`moveAndMaybeCompressFile: error reading ${t}`,c),s.destroy(c)})}).on("finish",()=>{Pt(`moveAndMaybeCompressFile: finished compressing ${e}, deleting ${t}`),_n.unlink(t).then(n).catch(l=>{Pt(`moveAndMaybeCompressFile: error deleting ${t}, truncating instead`,l),_n.truncate(t).then(n).catch(c=>{Pt(`moveAndMaybeCompressFile: error truncating ${t}`,c),o(c)})})}).on("error",l=>{i?(Pt(`moveAndMaybeCompressFile: error writing ${e}, deleting`,l),_n.unlink(e).then(()=>{o(l)}).catch(c=>{Pt(`moveAndMaybeCompressFile: error deleting ${e}`,c),o(c)})):(Pt(`moveAndMaybeCompressFile: error creating ${e}`,l),o(l))})}).catch(()=>{});else{Pt(`moveAndMaybeCompressFile: renaming ${t} to ${e}`);try{await _n.move(t,e,{overwrite:!0})}catch(n){if(Pt(`moveAndMaybeCompressFile: error renaming ${t} to ${e}`,n),n.code!=="ENOENT"){Pt("moveAndMaybeCompressFile: trying copy+truncate instead");try{await _n.copy(t,e,{overwrite:!0}),await _n.truncate(t)}catch(o){Pt("moveAndMaybeCompressFile: error copy+truncate",o)}}}}};oO.exports=g4});var Nf=b((yde,sO)=>{a();var Gt=Ye()("streamroller:RollingFileWriteStream"),hi=ky(),mi=require("path"),y4=require("os"),Af=Y_(),Rf=df(),{Writable:b4}=require("stream"),v4=Q_(),w4=nO(),x4=iO(),E4=t=>(Gt(`deleteFiles: files to delete: ${t}`),Promise.all(t.map(e=>hi.unlink(e).catch(r=>{Gt(`deleteFiles: error when unlinking ${e}, ignoring. Error was ${r}`)})))),Ay=class extends b4{constructor(e,r){if(Gt(`constructor: creating RollingFileWriteStream. path=${e}`),typeof e!="string"||e.length===0)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(mi.sep))throw new Error(`Filename is a directory: ${e}`);e.indexOf(`~${mi.sep}`)===0&&(e=e.replace("~",y4.homedir())),super(r),this.options=this._parseOption(r),this.fileObject=mi.parse(e),this.fileObject.dir===""&&(this.fileObject=mi.parse(mi.join(process.cwd(),e))),this.fileFormatter=v4({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize<Number.MAX_SAFE_INTEGER,compress:this.options.compress,keepFileExt:this.options.keepFileExt,fileNameSep:this.options.fileNameSep}),this.fileNameParser=w4({file:this.fileObject,keepFileExt:this.options.keepFileExt,pattern:this.options.pattern,fileNameSep:this.options.fileNameSep}),this.state={currentSize:0},this.options.pattern&&(this.state.currentDate=Rf(this.options.pattern,Af())),this.filename=this.fileFormatter({index:0,date:this.state.currentDate}),["a","a+","as","as+"].includes(this.options.flags)&&this._setExistingSizeAndDate(),Gt(`constructor: create new file ${this.filename}, state=${JSON.stringify(this.state)}`),this._renewWriteStream()}_setExistingSizeAndDate(){try{let e=hi.statSync(this.filename);this.state.currentSize=e.size,this.options.pattern&&(this.state.currentDate=Rf(this.options.pattern,e.mtime))}catch{return}}_parseOption(e){let r={maxSize:0,numToKeep:Number.MAX_SAFE_INTEGER,encoding:"utf8",mode:parseInt("0600",8),flags:"a",compress:!1,keepFileExt:!1,alwaysIncludePattern:!1},n=Object.assign({},r,e);if(!n.maxSize)delete n.maxSize;else if(n.maxSize<=0)throw new Error(`options.maxSize (${n.maxSize}) should be > 0`);if(n.numBackups||n.numBackups===0){if(n.numBackups<0)throw new Error(`options.numBackups (${n.numBackups}) should be >= 0`);if(n.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${n.numBackups}) should be < Number.MAX_SAFE_INTEGER`);n.numToKeep=n.numBackups+1}else if(n.numToKeep<=0)throw new Error(`options.numToKeep (${n.numToKeep}) should be > 0`);return Gt(`_parseOption: creating stream with option=${JSON.stringify(n)}`),n}_final(e){this.currentFileStream.end("",this.options.encoding,e)}_write(e,r,n){this._shouldRoll().then(()=>{Gt(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${e}`),this.currentFileStream.write(e,r,o=>{this.state.currentSize+=e.length,n(o)})})}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(Gt(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==Rf(this.options.pattern,Af())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return Gt("_roll: closing the current stream"),new Promise((e,r)=>{this.currentFileStream.end("",this.options.encoding,()=>{this._moveOldFiles().then(e).catch(r)})})}async _moveOldFiles(){let e=await this._getExistingFiles(),r=this.state.currentDate?e.filter(n=>n.date===this.state.currentDate):e;for(let n=r.length;n>=0;n--){Gt(`_moveOldFiles: i = ${n}`);let o=this.fileFormatter({date:this.state.currentDate,index:n}),i=this.fileFormatter({date:this.state.currentDate,index:n+1}),s={compress:this.options.compress&&n===0,mode:this.options.mode};await x4(o,i,s)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?Rf(this.options.pattern,Af()):null,Gt(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise((n,o)=>{this.currentFileStream.write("","utf8",()=>{this._clean().then(n).catch(o)})})}async _getExistingFiles(){let e=await hi.readdir(this.fileObject.dir).catch(()=>[]);Gt(`_getExistingFiles: files=${e}`);let r=e.map(o=>this.fileNameParser(o)).filter(o=>o),n=o=>(o.timestamp?o.timestamp:Af().getTime())-o.index;return r.sort((o,i)=>n(o)-n(i)),r}_renewWriteStream(){let e=this.fileFormatter({date:this.state.currentDate,index:0}),r=i=>{try{return hi.mkdirSync(i,{recursive:!0})}catch(s){if(s.code==="ENOENT")return r(mi.dirname(i)),r(i);if(s.code!=="EEXIST"&&s.code!=="EROFS")throw s;try{if(hi.statSync(i).isDirectory())return i;throw s}catch{throw s}}};r(this.fileObject.dir);let n={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode},o=function(i,s,l){return i[l]=i[s],delete i[s],i};hi.appendFileSync(e,"",o({...n},"flags","flag")),this.currentFileStream=hi.createWriteStream(e,n),this.currentFileStream.on("error",i=>{this.emit("error",i)})}async _clean(){let e=await this._getExistingFiles();if(Gt(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${e.length}`),Gt("_clean: existing files are: ",e),this._tooManyFiles(e.length)){let r=e.slice(0,e.length-this.options.numToKeep).map(n=>mi.format({dir:this.fileObject.dir,base:n.filename}));await E4(r)}}_tooManyFiles(e){return this.options.numToKeep>0&&e>this.options.numToKeep}};sO.exports=Ay});var lO=b((vde,aO)=>{a();var S4=Nf(),Ry=class extends S4{constructor(e,r,n,o){o||(o={}),r&&(o.maxSize=r),!o.numBackups&&o.numBackups!==0&&(!n&&n!==0&&(n=1),o.numBackups=n),super(e,o),this.backups=o.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}};aO.exports=Ry});var uO=b((xde,cO)=>{a();var I4=Nf(),Ny=class extends I4{constructor(e,r,n){r&&typeof r=="object"&&(n=r,r=null),n||(n={}),r||(r="yyyy-MM-dd"),n.pattern=r,!n.numBackups&&n.numBackups!==0?(!n.daysToKeep&&n.daysToKeep!==0?n.daysToKeep=1:process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"),n.numBackups=n.daysToKeep):n.daysToKeep=n.numBackups,super(e,n),this.mode=this.options.mode}get theStream(){return this.currentFileStream}};cO.exports=Ny});var Dy=b((Sde,fO)=>{a();fO.exports={RollingFileWriteStream:Nf(),RollingFileStream:lO(),DateRollingFileStream:uO()}});var gO=b((_de,hO)=>{a();var pO=Ye()("log4js:file"),Py=require("path"),_4=Dy(),mO=require("os"),O4=mO.EOL,Df=!1,Pf=new Set;function dO(){Pf.forEach(t=>{t.sighupHandler()})}function T4(t,e,r,n,o,i){if(typeof t!="string"||t.length===0)throw new Error(`Invalid filename: ${t}`);if(t.endsWith(Py.sep))throw new Error(`Filename is a directory: ${t}`);t=t.replace(new RegExp(`^~(?=${Py.sep}.+)`),mO.homedir()),t=Py.normalize(t),n=!n&&n!==0?5:n,pO("Creating file appender (",t,", ",r,", ",n,", ",o,", ",i,")");function s(f,u,d,m){let h=new _4.RollingFileStream(f,u,d,m);return h.on("error",y=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",f,y)}),h.on("drain",()=>{process.emit("log4js:pause",!1)}),h}let l=s(t,r,n,o),c=function(f){if(l.writable){if(o.removeColor===!0){let u=/\x1b[[0-9;]*m/g;f.data=f.data.map(d=>typeof d=="string"?d.replace(u,""):d)}l.write(e(f,i)+O4,"utf8")||process.emit("log4js:pause",!0)}};return c.reopen=function(){l.end(()=>{l=s(t,r,n,o)})},c.sighupHandler=function(){pO("SIGHUP handler called."),c.reopen()},c.shutdown=function(f){Pf.delete(c),Pf.size===0&&Df&&(process.removeListener("SIGHUP",dO),Df=!1),l.end("","utf-8",f)},Pf.add(c),Df||(process.on("SIGHUP",dO),Df=!0),c}function C4(t,e){let r=e.basicLayout;return t.layout&&(r=e.layout(t.layout.type,t.layout)),t.mode=t.mode||384,T4(t.filename,r,t.maxLogSize,t.backups,t,t.timezoneOffset)}hO.exports.configure=C4});var bO=b((Tde,yO)=>{a();var k4=Dy(),A4=require("os"),R4=A4.EOL;function N4(t,e,r){let n=new k4.DateRollingFileStream(t,e,r);return n.on("error",o=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",t,o)}),n.on("drain",()=>{process.emit("log4js:pause",!1)}),n}function D4(t,e,r,n,o){n.maxSize=n.maxLogSize;let i=N4(t,e,n),s=function(l){i.writable&&(i.write(r(l,o)+R4,"utf8")||process.emit("log4js:pause",!0))};return s.shutdown=function(l){i.end("","utf-8",l)},s}function P4(t,e){let r=e.basicLayout;return t.layout&&(r=e.layout(t.layout.type,t.layout)),t.alwaysIncludePattern||(t.alwaysIncludePattern=!1),t.mode=t.mode||384,D4(t.filename,t.pattern,r,t,t.timezoneOffset)}yO.exports.configure=P4});var EO=b((kde,xO)=>{a();var On=Ye()("log4js:fileSync"),Xr=require("path"),Yr=require("fs"),vO=require("os"),F4=vO.EOL;function wO(t,e){let r=n=>{try{return Yr.mkdirSync(n,{recursive:!0})}catch(o){if(o.code==="ENOENT")return r(Xr.dirname(n)),r(n);if(o.code!=="EEXIST"&&o.code!=="EROFS")throw o;try{if(Yr.statSync(n).isDirectory())return n;throw o}catch{throw o}}};r(Xr.dirname(t)),Yr.appendFileSync(t,"",{mode:e.mode,flag:e.flags})}var Fy=class{constructor(e,r,n,o){if(On("In RollingFileStream"),r<0)throw new Error(`maxLogSize (${r}) should be > 0`);this.filename=e,this.size=r,this.backups=n,this.options=o,this.currentSize=0;function i(s){let l=0;try{l=Yr.statSync(s).size}catch{wO(s,o)}return l}this.currentSize=i(this.filename)}shouldRoll(){return On("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(e){let r=this,n=new RegExp(`^${Xr.basename(e)}`);function o(f){return n.test(f)}function i(f){return parseInt(f.slice(`${Xr.basename(e)}.`.length),10)||0}function s(f,u){return i(f)-i(u)}function l(f){let u=i(f);if(On(`Index of ${f} is ${u}`),r.backups===0)Yr.truncateSync(e,0);else if(u<r.backups){try{Yr.unlinkSync(`${e}.${u+1}`)}catch{}On(`Renaming ${f} -> ${e}.${u+1}`),Yr.renameSync(Xr.join(Xr.dirname(e),f),`${e}.${u+1}`)}}function c(){On("Renaming the old files"),Yr.readdirSync(Xr.dirname(e)).filter(o).sort(s).reverse().forEach(l)}On("Rolling, rolling, rolling"),c()}write(e,r){let n=this;function o(){On("writing the chunk to the file"),n.currentSize+=e.length,Yr.appendFileSync(n.filename,e)}On("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),o()}};function $4(t,e,r,n,o,i){if(typeof t!="string"||t.length===0)throw new Error(`Invalid filename: ${t}`);if(t.endsWith(Xr.sep))throw new Error(`Filename is a directory: ${t}`);t=t.replace(new RegExp(`^~(?=${Xr.sep}.+)`),vO.homedir()),t=Xr.normalize(t),n=!n&&n!==0?5:n,On("Creating fileSync appender (",t,", ",r,", ",n,", ",o,", ",i,")");function s(c,f,u){let d;return f?d=new Fy(c,f,u,o):d=(m=>(wO(m,o),{write(h){Yr.appendFileSync(m,h)}}))(c),d}let l=s(t,r,n);return c=>{l.write(e(c,i)+F4)}}function M4(t,e){let r=e.basicLayout;t.layout&&(r=e.layout(t.layout.type,t.layout));let n={flags:t.flags||"a",encoding:t.encoding||"utf8",mode:t.mode||384};return $4(t.filename,r,t.maxLogSize,t.backups,n,t.timezoneOffset)}xO.exports.configure=M4});var IO=b((Rde,SO)=>{a();var Qr=Ye()("log4js:tcp"),L4=require("net");function j4(t,e){let r=!1,n=[],o,i=3,s="__LOG4JS__";function l(d){Qr("Writing log event to socket"),r=o.write(`${e(d)}${s}`,"utf8")}function c(){let d;for(Qr("emptying buffer");d=n.shift();)l(d)}function f(){Qr(`appender creating socket to ${t.host||"localhost"}:${t.port||5e3}`),s=`${t.endMsg||"__LOG4JS__"}`,o=L4.createConnection(t.port||5e3,t.host||"localhost"),o.on("connect",()=>{Qr("socket connected"),c(),r=!0}),o.on("drain",()=>{Qr("drain event received, emptying buffer"),r=!0,c()}),o.on("timeout",o.end.bind(o)),o.on("error",d=>{Qr("connection error",d),r=!1,c()}),o.on("close",f)}f();function u(d){r?l(d):(Qr("buffering log event because it cannot write at the moment"),n.push(d))}return u.shutdown=function(d){Qr("shutdown called"),n.length&&i?(Qr("buffer has items, waiting 100ms to empty"),i-=1,setTimeout(()=>{u.shutdown(d)},100)):(o.removeAllListeners("close"),o.end(d))},u}function q4(t,e){Qr(`configure with config = ${t}`);let r=function(n){return n.serialise()};return t.layout&&(r=e.layout(t.layout.type,t.layout)),j4(t,r)}SO.exports.configure=q4});var Ly=b((Dde,My)=>{a();var $y=require("path"),mo=Ye()("log4js:appenders"),dr=ai(),_O=yf(),B4=ci(),z4=ty(),U4=EI(),Rr=new Map;Rr.set("console",II());Rr.set("stdout",OI());Rr.set("stderr",CI());Rr.set("logLevelFilter",AI());Rr.set("categoryFilter",DI());Rr.set("noLogFilter",$I());Rr.set("file",gO());Rr.set("dateFile",bO());Rr.set("fileSync",EO());Rr.set("tcp",IO());var Sl=new Map,Ff=(t,e)=>{let r;try{let n=`${t}.cjs`;r=require.resolve(n),mo("Loading module from ",n)}catch{r=t,mo("Loading module from ",t)}try{return require(r)}catch(n){dr.throwExceptionIf(e,n.code!=="MODULE_NOT_FOUND",`appender "${t}" could not be loaded (error was: ${n})`);return}},W4=(t,e)=>Rr.get(t)||Ff(`./${t}`,e)||Ff(t,e)||require.main&&require.main.filename&&Ff($y.join($y.dirname(require.main.filename),t),e)||Ff($y.join(process.cwd(),t),e),$f=new Set,OO=(t,e)=>{if(Sl.has(t))return Sl.get(t);if(!e.appenders[t])return!1;if($f.has(t))throw new Error(`Dependency loop detected for appender ${t}.`);$f.add(t),mo(`Creating appender ${t}`);let r=H4(t,e);return $f.delete(t),Sl.set(t,r),r},H4=(t,e)=>{let r=e.appenders[t],n=r.type.configure?r.type:W4(r.type,e);return dr.throwExceptionIf(e,dr.not(n),`appender "${t}" is not valid (type "${r.type}" could not be found)`),n.appender&&(process.emitWarning(`Appender ${r.type} exports an appender function.`,"DeprecationWarning","log4js-node-DEP0001"),mo("[log4js-node-DEP0001]",`DEPRECATION: Appender ${r.type} exports an appender function.`)),n.shutdown&&(process.emitWarning(`Appender ${r.type} exports a shutdown function.`,"DeprecationWarning","log4js-node-DEP0002"),mo("[log4js-node-DEP0002]",`DEPRECATION: Appender ${r.type} exports a shutdown function.`)),mo(`${t}: clustering.isMaster ? ${_O.isMaster()}`),mo(`${t}: appenderModule is ${require("util").inspect(n)}`),_O.onlyOnMaster(()=>(mo(`calling appenderModule.configure for ${t} / ${r.type}`),n.configure(U4.modifyConfig(r),z4,o=>OO(o,e),B4)),()=>{})},TO=t=>{if(Sl.clear(),$f.clear(),!t)return;let e=[];Object.values(t.categories).forEach(r=>{e.push(...r.appenders)}),Object.keys(t.appenders).forEach(r=>{(e.includes(r)||t.appenders[r].type==="tcp-server"||t.appenders[r].type==="multiprocess")&&OO(r,t)})},CO=()=>{TO()};CO();dr.addListener(t=>{dr.throwExceptionIf(t,dr.not(dr.anObject(t.appenders)),'must have a property "appenders" of type object.');let e=Object.keys(t.appenders);dr.throwExceptionIf(t,dr.not(e.length),"must define at least one appender."),e.forEach(r=>{dr.throwExceptionIf(t,dr.not(t.appenders[r].type),`appender "${r}" is not valid (must be an object with property "type")`)})});dr.addListener(TO);My.exports=Sl;My.exports.init=CO});var By=b((Fde,Mf)=>{a();var Il=Ye()("log4js:categories"),$e=ai(),jy=ci(),kO=Ly(),ho=new Map;function AO(t,e,r){if(e.inherit===!1)return;let n=r.lastIndexOf(".");if(n<0)return;let o=r.slice(0,n),i=t.categories[o];i||(i={inherit:!0,appenders:[]}),AO(t,i,o),!t.categories[o]&&i.appenders&&i.appenders.length&&i.level&&(t.categories[o]=i),e.appenders=e.appenders||[],e.level=e.level||i.level,i.appenders.forEach(s=>{e.appenders.includes(s)||e.appenders.push(s)}),e.parent=i}function K4(t){if(!t.categories)return;Object.keys(t.categories).forEach(r=>{let n=t.categories[r];AO(t,n,r)})}$e.addPreProcessingListener(t=>K4(t));$e.addListener(t=>{$e.throwExceptionIf(t,$e.not($e.anObject(t.categories)),'must have a property "categories" of type object.');let e=Object.keys(t.categories);$e.throwExceptionIf(t,$e.not(e.length),"must define at least one category."),e.forEach(r=>{let n=t.categories[r];$e.throwExceptionIf(t,[$e.not(n.appenders),$e.not(n.level)],`category "${r}" is not valid (must be an object with properties "appenders" and "level")`),$e.throwExceptionIf(t,$e.not(Array.isArray(n.appenders)),`category "${r}" is not valid (appenders must be an array of appender names)`),$e.throwExceptionIf(t,$e.not(n.appenders.length),`category "${r}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(n,"enableCallStack")&&$e.throwExceptionIf(t,typeof n.enableCallStack!="boolean",`category "${r}" is not valid (enableCallStack must be boolean type)`),n.appenders.forEach(o=>{$e.throwExceptionIf(t,$e.not(kO.get(o)),`category "${r}" is not valid (appender "${o}" is not defined)`)}),$e.throwExceptionIf(t,$e.not(jy.getLevel(n.level)),`category "${r}" is not valid (level "${n.level}" not recognised; valid levels are ${jy.levels.join(", ")})`)}),$e.throwExceptionIf(t,$e.not(t.categories.default),'must define a "default" category.')});var qy=t=>{if(ho.clear(),!t)return;Object.keys(t.categories).forEach(r=>{let n=t.categories[r],o=[];n.appenders.forEach(i=>{o.push(kO.get(i)),Il(`Creating category ${r}`),ho.set(r,{appenders:o,level:jy.getLevel(n.level),enableCallStack:n.enableCallStack||!1})})})},RO=()=>{qy()};RO();$e.addListener(qy);var Rs=t=>{if(Il(`configForCategory: searching for config for ${t}`),ho.has(t))return Il(`configForCategory: ${t} exists in config, returning it`),ho.get(t);let e;return t.indexOf(".")>0?(Il(`configForCategory: ${t} has hierarchy, cloning from parents`),e={...Rs(t.slice(0,t.lastIndexOf(".")))}):(ho.has("default")||qy({categories:{default:{appenders:["out"],level:"OFF"}}}),Il("configForCategory: cloning default category"),e={...ho.get("default")}),ho.set(t,e),e},V4=t=>Rs(t).appenders,G4=t=>Rs(t).level,Z4=(t,e)=>{Rs(t).level=e},J4=t=>Rs(t).enableCallStack===!0,Y4=(t,e)=>{Rs(t).enableCallStack=e};Mf.exports=ho;Mf.exports=Object.assign(Mf.exports,{appendersForCategory:V4,getLevelForCategory:G4,setLevelForCategory:Z4,getEnableCallStackForCategory:J4,setEnableCallStackForCategory:Y4,init:RO})});var $O=b((Mde,FO)=>{a();var NO=Ye()("log4js:logger"),X4=ry(),en=ci(),Q4=yf(),Lf=By(),DO=ai(),eU=/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/;function tU(t,e=4){try{let r=t.stack.split(`
|
|
`).slice(e),n=eU.exec(r[0]);if(n&&n.length===6)return{functionName:n[1],fileName:n[2],lineNumber:parseInt(n[3],10),columnNumber:parseInt(n[4],10),callStack:r.join(`
|
|
`)};console.error("log4js.logger - defaultParseCallStack error")}catch(r){console.error("log4js.logger - defaultParseCallStack error",r)}return null}var _l=class{constructor(e){if(!e)throw new Error("No category provided.");this.category=e,this.context={},this.parseCallStack=tU,NO(`Logger created (${this.category}, ${this.level})`)}get level(){return en.getLevel(Lf.getLevelForCategory(this.category),en.OFF)}set level(e){Lf.setLevelForCategory(this.category,en.getLevel(e,this.level))}get useCallStack(){return Lf.getEnableCallStackForCategory(this.category)}set useCallStack(e){Lf.setEnableCallStackForCategory(this.category,e===!0)}log(e,...r){let n=en.getLevel(e);n?this.isLevelEnabled(n)&&this._log(n,r):DO.validIdentifier(e)&&r.length>0?(this.log(en.WARN,"log4js:logger.log: valid log-level not found as first parameter given:",e),this.log(en.INFO,`[${e}]`,...r)):this.log(en.INFO,e,...r)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(e,r){NO(`sending log data (${e}) to appenders`);let n=new X4(this.category,e,r,this.context,this.useCallStack&&this.parseCallStack(new Error));Q4.send(n)}addContext(e,r){this.context[e]=r}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){this.parseCallStack=e}};function PO(t){let e=en.getLevel(t),n=e.toString().toLowerCase().replace(/_([a-z])/g,i=>i[1].toUpperCase()),o=n[0].toUpperCase()+n.slice(1);_l.prototype[`is${o}Enabled`]=function(){return this.isLevelEnabled(e)},_l.prototype[n]=function(...i){this.log(e,...i)}}en.levels.forEach(PO);DO.addListener(()=>{en.levels.forEach(PO)});FO.exports=_l});var jO=b((jde,LO)=>{a();var Ns=ci(),rU=':remote-addr - - ":method :url HTTP/:http-version" :status :content-length ":referrer" ":user-agent"';function nU(t){return t.originalUrl||t.url}function oU(t,e,r){let n=i=>{let s=i.concat();for(let l=0;l<s.length;++l)for(let c=l+1;c<s.length;++c)s[l].token==s[c].token&&s.splice(c--,1);return s},o=[];return o.push({token:":url",replacement:nU(t)}),o.push({token:":protocol",replacement:t.protocol}),o.push({token:":hostname",replacement:t.hostname}),o.push({token:":method",replacement:t.method}),o.push({token:":status",replacement:e.__statusCode||e.statusCode}),o.push({token:":response-time",replacement:e.responseTime}),o.push({token:":date",replacement:new Date().toUTCString()}),o.push({token:":referrer",replacement:t.headers.referer||t.headers.referrer||""}),o.push({token:":http-version",replacement:`${t.httpVersionMajor}.${t.httpVersionMinor}`}),o.push({token:":remote-addr",replacement:t.headers["x-forwarded-for"]||t.ip||t._remoteAddress||t.socket&&(t.socket.remoteAddress||t.socket.socket&&t.socket.socket.remoteAddress)}),o.push({token:":user-agent",replacement:t.headers["user-agent"]}),o.push({token:":content-length",replacement:e.getHeader("content-length")||e.__headers&&e.__headers["Content-Length"]||"-"}),o.push({token:/:req\[([^\]]+)]/g,replacement(i,s){return t.headers[s.toLowerCase()]}}),o.push({token:/:res\[([^\]]+)]/g,replacement(i,s){return e.getHeader(s.toLowerCase())||e.__headers&&e.__headers[s]}}),n(r.concat(o))}function MO(t,e){for(let r=0;r<e.length;r++)t=t.replace(e[r].token,e[r].replacement);return t}function iU(t){let e=null;if(t instanceof RegExp&&(e=t),typeof t=="string"&&(e=new RegExp(t)),Array.isArray(t)){let r=t.map(n=>n.source?n.source:n);e=new RegExp(r.join("|"))}return e}function sU(t,e,r){let n=e;if(r){let o=r.find(i=>{let s=!1;return i.from&&i.to?s=t>=i.from&&t<=i.to:s=i.codes.indexOf(t)!==-1,s});o&&(n=Ns.getLevel(o.level,n))}return n}LO.exports=function(e,r){typeof r=="string"||typeof r=="function"?r={format:r}:r=r||{};let n=e,o=Ns.getLevel(r.level,Ns.INFO),i=r.format||rU;return(s,l,c)=>{if(s._logging!==void 0)return c();if(typeof r.nolog!="function"){let f=iU(r.nolog);if(f&&f.test(s.originalUrl))return c()}if(n.isLevelEnabled(o)||r.level==="auto"){let f=new Date,{writeHead:u}=l;s._logging=!0,l.writeHead=(h,y)=>{l.writeHead=u,l.writeHead(h,y),l.__statusCode=h,l.__headers=y||{}};let d=!1,m=()=>{if(d)return;if(d=!0,typeof r.nolog=="function"&&r.nolog(s,l)===!0){s._logging=!1;return}l.responseTime=new Date-f,l.statusCode&&r.level==="auto"&&(o=Ns.INFO,l.statusCode>=300&&(o=Ns.WARN),l.statusCode>=400&&(o=Ns.ERROR)),o=sU(l.statusCode,o,r.statusRules);let h=oU(s,l,r.tokens||[]);if(r.context&&n.addContext("res",l),typeof i=="function"){let y=i(s,l,w=>MO(w,h));y&&n.log(o,y)}else n.log(o,MO(i,h));r.context&&n.removeContext("res")};l.on("end",m),l.on("finish",m),l.on("error",m),l.on("close",m)}return c()}}});var WO=b((Bde,UO)=>{a();var qO=Ye()("log4js:recording"),jf=[];function aU(){return function(t){qO(`received logEvent, number of events now ${jf.length+1}`),qO("log event was ",t),jf.push(t)}}function BO(){return jf.slice()}function zO(){jf.length=0}UO.exports={configure:aU,replay:BO,playback:BO,reset:zO,erase:zO}});var YO=b((Ude,JO)=>{a();var go=Ye()("log4js:main"),lU=require("fs"),cU=MS()({proto:!0}),uU=ai(),fU=ty(),pU=ci(),HO=Ly(),KO=By(),dU=$O(),mU=yf(),hU=jO(),gU=WO(),Ol=!1;function yU(t){if(!Ol)return;go("Received log event ",t),KO.appendersForCategory(t.categoryName).forEach(r=>{r(t)})}function bU(t){go(`Loading configuration from ${t}`);try{return JSON.parse(lU.readFileSync(t,"utf8"))}catch(e){throw new Error(`Problem reading config from file "${t}". Error was ${e.message}`,e)}}function VO(t){Ol&&GO();let e=t;return typeof e=="string"&&(e=bU(t)),go(`Configuration is ${e}`),uU.configure(cU(e)),mU.onMessage(yU),Ol=!0,ZO}function vU(){return gU}function GO(t){go("Shutdown called. Disabling all log writing."),Ol=!1;let e=Array.from(HO.values());HO.init(),KO.init();let r=e.reduceRight((s,l)=>l.shutdown?s+1:s,0);if(r===0)return go("No appenders with shutdown functions found."),t!==void 0&&t();let n=0,o;go(`Found ${r} appenders with shutdown functions.`);function i(s){o=o||s,n+=1,go(`Appender shutdowns complete: ${n} / ${r}`),n>=r&&(go("All shutdown functions completed."),t&&t(o))}return e.filter(s=>s.shutdown).forEach(s=>s.shutdown(i)),null}function wU(t){return Ol||VO(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new dU(t||"default")}var ZO={getLogger:wU,configure:VO,shutdown:GO,connectLogger:hU,levels:pU,addLayout:fU.addLayout,recording:vU};JO.exports=ZO});var Ds=b(qf=>{"use strict";a();Object.defineProperty(qf,"__esModule",{value:!0});function XO(t,e){if(e)return t;throw new Error("Unhandled discriminated union member: "+JSON.stringify(t))}qf.assertNever=XO;qf.default=XO});var tT=b((Vde,eT)=>{"use strict";a();var xU=["h","min","s","ms","\u03BCs","ns"],EU=["hour","minute","second","millisecond","microsecond","nanosecond"],QO=[3600,60,1,1e6,1e3,1];eT.exports=function(t,e){var r,n,o,i,s,l,c,f,u,d;if(r=!1,n=!1,e&&(r=e.verbose||!1,n=e.precise||!1),!Array.isArray(t)||t.length!==2||typeof t[0]!="number"||typeof t[1]!="number")return"";for(t[1]<0&&(d=t[0]+t[1]/1e9,t[0]=parseInt(d),t[1]=parseFloat((d%1).toPrecision(9))*1e9),u="",o=0;o<6&&(i=o<3?0:1,s=t[i],o!==3&&o!==0&&(s=s%QO[o-1]),o===2&&(s+=t[1]/1e9),l=s/QO[o],!(l>=1&&(r&&(l=Math.floor(l)),n?f=l.toString():(c=l>=10?0:2,f=l.toFixed(c)),f.indexOf(".")>-1&&f[f.length-1]==="0"&&(f=f.replace(/\.?0+$/,"")),u&&(u+=" "),u+=f,r?(u+=" "+EU[o],f!=="1"&&(u+="s")):u+=" "+xU[o],!r)));o++);return u}});var nT=b((Zde,rT)=>{"use strict";a();rT.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var lT=b((Yde,aT)=>{"use strict";a();var sT="%[a-f0-9]{2}",oT=new RegExp("("+sT+")|([^%]+?)","gi"),iT=new RegExp("("+sT+")+","gi");function zy(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],zy(r),zy(n))}function SU(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(oT)||[],r=1;r<e.length;r++)t=zy(e,r).join(""),e=t.match(oT)||[];return t}}function IU(t){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},r=iT.exec(t);r;){try{e[r[0]]=decodeURIComponent(r[0])}catch{var n=SU(r[0]);n!==r[0]&&(e[r[0]]=n)}r=iT.exec(t)}e["%C2"]="\uFFFD";for(var o=Object.keys(e),i=0;i<o.length;i++){var s=o[i];t=t.replace(new RegExp(s,"g"),e[s])}return t}aT.exports=function(t){if(typeof t!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch{return IU(t)}}});var uT=b((Qde,cT)=>{"use strict";a();cT.exports=(t,e)=>{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];let r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]}});var pT=b((tme,fT)=>{"use strict";a();fT.exports=function(t,e){for(var r={},n=Object.keys(t),o=Array.isArray(e),i=0;i<n.length;i++){var s=n[i],l=t[s];(o?e.indexOf(s)!==-1:e(s,l,t))&&(r[s]=l)}return r}});var Wy=b(Ft=>{"use strict";a();var _U=nT(),OU=lT(),mT=uT(),TU=pT(),CU=t=>t==null,Uy=Symbol("encodeFragmentIdentifier");function kU(t){switch(t.arrayFormat){case"index":return e=>(r,n)=>{let o=r.length;return n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[Le(e,t),"[",o,"]"].join("")]:[...r,[Le(e,t),"[",Le(o,t),"]=",Le(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[Le(e,t),"[]"].join("")]:[...r,[Le(e,t),"[]=",Le(n,t)].join("")];case"colon-list-separator":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[Le(e,t),":list="].join("")]:[...r,[Le(e,t),":list=",Le(n,t)].join("")];case"comma":case"separator":case"bracket-separator":{let e=t.arrayFormat==="bracket-separator"?"[]=":"=";return r=>(n,o)=>o===void 0||t.skipNull&&o===null||t.skipEmptyString&&o===""?n:(o=o===null?"":o,n.length===0?[[Le(r,t),e,Le(o,t)].join("")]:[[n,Le(o,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,Le(e,t)]:[...r,[Le(e,t),"=",Le(n,t)].join("")]}}function AU(t){let e;switch(t.arrayFormat){case"index":return(r,n,o)=>{if(e=/\[(\d*)\]$/.exec(r),r=r.replace(/\[\d*\]$/,""),!e){o[r]=n;return}o[r]===void 0&&(o[r]={}),o[r][e[1]]=n};case"bracket":return(r,n,o)=>{if(e=/(\[\])$/.exec(r),r=r.replace(/\[\]$/,""),!e){o[r]=n;return}if(o[r]===void 0){o[r]=[n];return}o[r]=[].concat(o[r],n)};case"colon-list-separator":return(r,n,o)=>{if(e=/(:list)$/.exec(r),r=r.replace(/:list$/,""),!e){o[r]=n;return}if(o[r]===void 0){o[r]=[n];return}o[r]=[].concat(o[r],n)};case"comma":case"separator":return(r,n,o)=>{let i=typeof n=="string"&&n.includes(t.arrayFormatSeparator),s=typeof n=="string"&&!i&&Tn(n,t).includes(t.arrayFormatSeparator);n=s?Tn(n,t):n;let l=i||s?n.split(t.arrayFormatSeparator).map(c=>Tn(c,t)):n===null?n:Tn(n,t);o[r]=l};case"bracket-separator":return(r,n,o)=>{let i=/(\[\])$/.test(r);if(r=r.replace(/\[\]$/,""),!i){o[r]=n&&Tn(n,t);return}let s=n===null?[]:n.split(t.arrayFormatSeparator).map(l=>Tn(l,t));if(o[r]===void 0){o[r]=s;return}o[r]=[].concat(o[r],s)};default:return(r,n,o)=>{if(o[r]===void 0){o[r]=n;return}o[r]=[].concat(o[r],n)}}}function hT(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Le(t,e){return e.encode?e.strict?_U(t):encodeURIComponent(t):t}function Tn(t,e){return e.decode?OU(t):t}function gT(t){return Array.isArray(t)?t.sort():typeof t=="object"?gT(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function yT(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function RU(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function bT(t){t=yT(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function dT(t,e){return e.parseNumbers&&!Number.isNaN(Number(t))&&typeof t=="string"&&t.trim()!==""?t=Number(t):e.parseBooleans&&t!==null&&(t.toLowerCase()==="true"||t.toLowerCase()==="false")&&(t=t.toLowerCase()==="true"),t}function vT(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),hT(e.arrayFormatSeparator);let r=AU(e),n=Object.create(null);if(typeof t!="string"||(t=t.trim().replace(/^[?#&]/,""),!t))return n;for(let o of t.split("&")){if(o==="")continue;let[i,s]=mT(e.decode?o.replace(/\+/g," "):o,"=");s=s===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?s:Tn(s,e),r(Tn(i,e),s,n)}for(let o of Object.keys(n)){let i=n[o];if(typeof i=="object"&&i!==null)for(let s of Object.keys(i))i[s]=dT(i[s],e);else n[o]=dT(i,e)}return e.sort===!1?n:(e.sort===!0?Object.keys(n).sort():Object.keys(n).sort(e.sort)).reduce((o,i)=>{let s=n[i];return s&&typeof s=="object"&&!Array.isArray(s)?o[i]=gT(s):o[i]=s,o},Object.create(null))}Ft.extract=bT;Ft.parse=vT;Ft.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),hT(e.arrayFormatSeparator);let r=s=>e.skipNull&&CU(t[s])||e.skipEmptyString&&t[s]==="",n=kU(e),o={};for(let s of Object.keys(t))r(s)||(o[s]=t[s]);let i=Object.keys(o);return e.sort!==!1&&i.sort(e.sort),i.map(s=>{let l=t[s];return l===void 0?"":l===null?Le(s,e):Array.isArray(l)?l.length===0&&e.arrayFormat==="bracket-separator"?Le(s,e)+"[]":l.reduce(n(s),[]).join("&"):Le(s,e)+"="+Le(l,e)}).filter(s=>s.length>0).join("&")};Ft.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=mT(t,"#");return Object.assign({url:r.split("?")[0]||"",query:vT(bT(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:Tn(n,e)}:{})};Ft.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[Uy]:!0},e);let r=yT(t.url).split("?")[0]||"",n=Ft.extract(t.url),o=Ft.parse(n,{sort:!1}),i=Object.assign(o,t.query),s=Ft.stringify(i,e);s&&(s=`?${s}`);let l=RU(t.url);return t.fragmentIdentifier&&(l=`#${e[Uy]?Le(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${s}${l}`};Ft.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[Uy]:!1},r);let{url:n,query:o,fragmentIdentifier:i}=Ft.parseUrl(t,r);return Ft.stringifyUrl({url:n,query:TU(o,e),fragmentIdentifier:i},r)};Ft.exclude=(t,e,r)=>{let n=Array.isArray(e)?o=>!e.includes(o):(o,i)=>!e(o,i);return Ft.pick(t,n,r)}});function Dn(t,e){for(var r in e)t[r]=e[r];return t}function Wk(t){var e=t.parentNode;e&&e.removeChild(t)}function V(t,e,r){var n,o,i,s={};for(i in e)i=="key"?n=e[i]:i=="ref"?o=e[i]:s[i]=e[i];if(arguments.length>2&&(s.children=arguments.length>3?Yl.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(i in t.defaultProps)s[i]===void 0&&(s[i]=t.defaultProps[i]);return Zl(t,s,n,o,null)}function Zl(t,e,r,n,o){var i={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:o??++Bk};return o==null&&z.vnode!=null&&z.vnode(i),i}function Rp(){return{current:null}}function L(t){return t.children}function Jt(t,e){this.props=t,this.context=e}function Jl(t,e){if(e==null)return t.__?Jl(t.__,t.__.__k.indexOf(t)+1):null;for(var r;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null)return r.__e;return typeof t.type=="function"?Jl(t):null}function Hk(t){var e,r;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null){t.__e=t.__c.base=r.__e;break}return Hk(t)}}function Bb(t){(!t.__d&&(t.__d=!0)&&Gl.push(t)&&!kp.__r++||Mk!==z.debounceRendering)&&((Mk=z.debounceRendering)||setTimeout)(kp)}function kp(){for(var t;kp.__r=Gl.length;)t=Gl.sort(function(e,r){return e.__v.__b-r.__v.__b}),Gl=[],t.some(function(e){var r,n,o,i,s,l;e.__d&&(s=(i=(r=e).__v).__e,(l=r.__P)&&(n=[],(o=Dn({},i)).__v=i.__v+1,zb(l,i,o,r.__n,l.ownerSVGElement!==void 0,i.__h!=null?[s]:null,n,s??Jl(i),i.__h),Zk(n,i),i.__e!=s&&Hk(i)))})}function Kk(t,e,r,n,o,i,s,l,c,f){var u,d,m,h,y,w,v,x=n&&n.__k||Uk,S=x.length;for(r.__k=[],u=0;u<e.length;u++)if((h=r.__k[u]=(h=e[u])==null||typeof h=="boolean"?null:typeof h=="string"||typeof h=="number"||typeof h=="bigint"?Zl(null,h,null,null,h):Array.isArray(h)?Zl(L,{children:h},null,null,null):h.__b>0?Zl(h.type,h.props,h.key,h.ref?h.ref:null,h.__v):h)!=null){if(h.__=r,h.__b=r.__b+1,(m=x[u])===null||m&&h.key==m.key&&h.type===m.type)x[u]=void 0;else for(d=0;d<S;d++){if((m=x[d])&&h.key==m.key&&h.type===m.type){x[d]=void 0;break}m=null}zb(t,h,m=m||Cp,o,i,s,l,c,f),y=h.__e,(d=h.ref)&&m.ref!=d&&(v||(v=[]),m.ref&&v.push(m.ref,null,h),v.push(d,h.__c||y,h)),y!=null?(w==null&&(w=y),typeof h.type=="function"&&h.__k===m.__k?h.__d=c=Vk(h,c,t):c=Gk(t,h,m,x,y,c),typeof r.type=="function"&&(r.__d=c)):c&&m.__e==c&&c.parentNode!=t&&(c=Jl(m))}for(r.__e=w,u=S;u--;)x[u]!=null&&Yk(x[u],x[u]);if(v)for(u=0;u<v.length;u++)Jk(v[u],v[++u],v[++u])}function Vk(t,e,r){for(var n,o=t.__k,i=0;o&&i<o.length;i++)(n=o[i])&&(n.__=t,e=typeof n.type=="function"?Vk(n,e,r):Gk(r,n,n,o,n.__e,e));return e}function an(t,e){return e=e||[],t==null||typeof t=="boolean"||(Array.isArray(t)?t.some(function(r){an(r,e)}):e.push(t)),e}function Gk(t,e,r,n,o,i){var s,l,c;if(e.__d!==void 0)s=e.__d,e.__d=void 0;else if(r==null||o!=i||o.parentNode==null)e:if(i==null||i.parentNode!==t)t.appendChild(o),s=null;else{for(l=i,c=0;(l=l.nextSibling)&&c<n.length;c+=1)if(l==o)break e;t.insertBefore(o,i),s=i}return s!==void 0?s:o.nextSibling}function u7(t,e,r,n,o){var i;for(i in r)i==="children"||i==="key"||i in e||Ap(t,i,null,r[i],n);for(i in e)o&&typeof e[i]!="function"||i==="children"||i==="key"||i==="value"||i==="checked"||r[i]===e[i]||Ap(t,i,e[i],r[i],n)}function Lk(t,e,r){e[0]==="-"?t.setProperty(e,r):t[e]=r==null?"":typeof r!="number"||c7.test(e)?r:r+"px"}function Ap(t,e,r,n,o){var i;e:if(e==="style")if(typeof r=="string")t.style.cssText=r;else{if(typeof n=="string"&&(t.style.cssText=n=""),n)for(e in n)r&&e in r||Lk(t.style,e,"");if(r)for(e in r)n&&r[e]===n[e]||Lk(t.style,e,r[e])}else if(e[0]==="o"&&e[1]==="n")i=e!==(e=e.replace(/Capture$/,"")),e=e.toLowerCase()in t?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+i]=r,r?n||t.addEventListener(e,i?qk:jk,i):t.removeEventListener(e,i?qk:jk,i);else if(e!=="dangerouslySetInnerHTML"){if(o)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!=="href"&&e!=="list"&&e!=="form"&&e!=="tabIndex"&&e!=="download"&&e in t)try{t[e]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&e.indexOf("-")==-1?t.removeAttribute(e):t.setAttribute(e,r))}}function jk(t){this.l[t.type+!1](z.event?z.event(t):t)}function qk(t){this.l[t.type+!0](z.event?z.event(t):t)}function zb(t,e,r,n,o,i,s,l,c){var f,u,d,m,h,y,w,v,x,S,k,j,Z,X,J,G=e.type;if(e.constructor!==void 0)return null;r.__h!=null&&(c=r.__h,l=e.__e=r.__e,e.__h=null,i=[l]),(f=z.__b)&&f(e);try{e:if(typeof G=="function"){if(v=e.props,x=(f=G.contextType)&&n[f.__c],S=f?x?x.props.value:f.__:n,r.__c?w=(u=e.__c=r.__c).__=u.__E:("prototype"in G&&G.prototype.render?e.__c=u=new G(v,S):(e.__c=u=new Jt(v,S),u.constructor=G,u.render=p7),x&&x.sub(u),u.props=v,u.state||(u.state={}),u.context=S,u.__n=n,d=u.__d=!0,u.__h=[],u._sb=[]),u.__s==null&&(u.__s=u.state),G.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=Dn({},u.__s)),Dn(u.__s,G.getDerivedStateFromProps(v,u.__s))),m=u.props,h=u.state,d)G.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(G.getDerivedStateFromProps==null&&v!==m&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(v,S),!u.__e&&u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(v,u.__s,S)===!1||e.__v===r.__v){for(u.props=v,u.state=u.__s,e.__v!==r.__v&&(u.__d=!1),u.__v=e,e.__e=r.__e,e.__k=r.__k,e.__k.forEach(function($){$&&($.__=e)}),k=0;k<u._sb.length;k++)u.__h.push(u._sb[k]);u._sb=[],u.__h.length&&s.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(v,u.__s,S),u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(m,h,y)})}if(u.context=S,u.props=v,u.__v=e,u.__P=t,j=z.__r,Z=0,"prototype"in G&&G.prototype.render){for(u.state=u.__s,u.__d=!1,j&&j(e),f=u.render(u.props,u.state,u.context),X=0;X<u._sb.length;X++)u.__h.push(u._sb[X]);u._sb=[]}else do u.__d=!1,j&&j(e),f=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++Z<25);u.state=u.__s,u.getChildContext!=null&&(n=Dn(Dn({},n),u.getChildContext())),d||u.getSnapshotBeforeUpdate==null||(y=u.getSnapshotBeforeUpdate(m,h)),J=f!=null&&f.type===L&&f.key==null?f.props.children:f,Kk(t,Array.isArray(J)?J:[J],e,r,n,o,i,s,l,c),u.base=e.__e,e.__h=null,u.__h.length&&s.push(u),w&&(u.__E=u.__=null),u.__e=!1}else i==null&&e.__v===r.__v?(e.__k=r.__k,e.__e=r.__e):e.__e=f7(r.__e,e,r,n,o,i,s,c);(f=z.diffed)&&f(e)}catch($){e.__v=null,(c||i!=null)&&(e.__e=l,e.__h=!!c,i[i.indexOf(l)]=null),z.__e($,e,r)}}function Zk(t,e){z.__c&&z.__c(e,t),t.some(function(r){try{t=r.__h,r.__h=[],t.some(function(n){n.call(r)})}catch(n){z.__e(n,r.__v)}})}function f7(t,e,r,n,o,i,s,l){var c,f,u,d=r.props,m=e.props,h=e.type,y=0;if(h==="svg"&&(o=!0),i!=null){for(;y<i.length;y++)if((c=i[y])&&"setAttribute"in c==!!h&&(h?c.localName===h:c.nodeType===3)){t=c,i[y]=null;break}}if(t==null){if(h===null)return document.createTextNode(m);t=o?document.createElementNS("http://www.w3.org/2000/svg",h):document.createElement(h,m.is&&m),i=null,l=!1}if(h===null)d===m||l&&t.data===m||(t.data=m);else{if(i=i&&Yl.call(t.childNodes),f=(d=r.props||Cp).dangerouslySetInnerHTML,u=m.dangerouslySetInnerHTML,!l){if(i!=null)for(d={},y=0;y<t.attributes.length;y++)d[t.attributes[y].name]=t.attributes[y].value;(u||f)&&(u&&(f&&u.__html==f.__html||u.__html===t.innerHTML)||(t.innerHTML=u&&u.__html||""))}if(u7(t,m,d,o,l),u)e.__k=[];else if(y=e.props.children,Kk(t,Array.isArray(y)?y:[y],e,r,n,o&&h!=="foreignObject",i,s,i?i[0]:r.__k&&Jl(r,0),l),i!=null)for(y=i.length;y--;)i[y]!=null&&Wk(i[y]);l||("value"in m&&(y=m.value)!==void 0&&(y!==t.value||h==="progress"&&!y||h==="option"&&y!==d.value)&&Ap(t,"value",y,d.value,!1),"checked"in m&&(y=m.checked)!==void 0&&y!==t.checked&&Ap(t,"checked",y,d.checked,!1))}return t}function Jk(t,e,r){try{typeof t=="function"?t(e):t.current=e}catch(n){z.__e(n,r)}}function Yk(t,e,r){var n,o;if(z.unmount&&z.unmount(t),(n=t.ref)&&(n.current&&n.current!==t.__e||Jk(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){z.__e(i,e)}n.base=n.__P=null,t.__c=void 0}if(n=t.__k)for(o=0;o<n.length;o++)n[o]&&Yk(n[o],e,r||typeof t.type!="function");r||t.__e==null||Wk(t.__e),t.__=t.__e=t.__d=void 0}function p7(t,e,r){return this.constructor(t,r)}function Vs(t,e,r){var n,o,i;z.__&&z.__(t,e),o=(n=typeof r=="function")?null:r&&r.__k||e.__k,i=[],zb(e,t=(!n&&r||e).__k=V(L,null,[t]),o||Cp,Cp,e.ownerSVGElement!==void 0,!n&&r?[r]:o?null:e.firstChild?Yl.call(e.childNodes):null,i,!n&&r?r:o?o.__e:e.firstChild,n),Zk(i,t)}function Ub(t,e){Vs(t,e,Ub)}function Xk(t,e,r){var n,o,i,s=Dn({},t.props);for(i in e)i=="key"?n=e[i]:i=="ref"?o=e[i]:s[i]=e[i];return arguments.length>2&&(s.children=arguments.length>3?Yl.call(arguments,2):r),Zl(t.type,s,n||t.key,o||t.ref,null)}function Ke(t,e){var r={__c:e="__cC"+zk++,__:t,Consumer:function(n,o){return n.children(o)},Provider:function(n){var o,i;return this.getChildContext||(o=[],(i={})[e]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(s){this.props.value!==s.value&&o.some(Bb)},this.sub=function(s){o.push(s);var l=s.componentWillUnmount;s.componentWillUnmount=function(){o.splice(o.indexOf(s),1),l&&l.call(s)}}),n.children}};return r.Provider.__=r.Consumer.contextType=r}var Yl,z,Bk,l7,Gl,Mk,zk,Cp,Uk,c7,Gs=Xa(()=>{a();Cp={},Uk=[],c7=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;Yl=Uk.slice,z={__e:function(t,e,r,n){for(var o,i,s;e=e.__;)if((o=e.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(t)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(t,n||{}),s=o.__d),s)return o.__E=o}catch(l){t=l}throw t}},Bk=0,l7=function(t){return t!=null&&t.constructor===void 0},Jt.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Dn({},this.state),typeof t=="function"&&(t=t(Dn({},r),this.props)),t&&Dn(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),Bb(this))},Jt.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Bb(this))},Jt.prototype.render=L,Gl=[],kp.__r=0,zk=0});function _i(t,e){z.__h&&z.__h(Ce,t,Zs||e),Zs=0;var r=Ce.__H||(Ce.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({__V:Np}),r.__[t]}function q(t){return Zs=1,ln(aA,t)}function ln(t,e,r){var n=_i(Io++,2);if(n.t=t,!n.__c&&(n.__=[r?r(e):aA(void 0,e),function(i){var s=n.__N?n.__N[0]:n.__[0],l=n.t(s,i);s!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=Ce,!Ce.u)){Ce.u=!0;var o=Ce.shouldComponentUpdate;Ce.shouldComponentUpdate=function(i,s,l){if(!n.__c.__H)return!0;var c=n.__c.__H.__.filter(function(u){return u.__c});if(c.every(function(u){return!u.__N}))return!o||o.call(this,i,s,l);var f=!1;return c.forEach(function(u){if(u.__N){var d=u.__[0];u.__=u.__N,u.__N=void 0,d!==u.__[0]&&(f=!0)}}),!(!f&&n.__c.props===i)&&(!o||o.call(this,i,s,l))}}return n.__N||n.__}function K(t,e){var r=_i(Io++,3);!z.__s&&Gb(r.__H,e)&&(r.__=t,r.i=e,Ce.__H.__h.push(r))}function Lt(t,e){var r=_i(Io++,4);!z.__s&&Gb(r.__H,e)&&(r.__=t,r.i=e,Ce.__h.push(r))}function M(t){return Zs=5,ae(function(){return{current:t}},[])}function Kb(t,e,r){Zs=6,Lt(function(){return typeof t=="function"?(t(e()),function(){return t(null)}):t?(t.current=e(),function(){return t.current=null}):void 0},r==null?r:r.concat(t))}function ae(t,e){var r=_i(Io++,7);return Gb(r.__H,e)?(r.__V=t(),r.i=e,r.__h=t,r.__V):r.__}function ee(t,e){return Zs=8,ae(function(){return t},e)}function re(t){var e=Ce.context[t.__c],r=_i(Io++,9);return r.c=t,e?(r.__==null&&(r.__=!0,e.sub(Ce)),e.props.value):t.__}function Oi(t,e){z.useDebugValue&&z.useDebugValue(e?e(t):t)}function d7(t){var e=_i(Io++,10),r=q();return e.__=t,Ce.componentDidCatch||(Ce.componentDidCatch=function(n,o){e.__&&e.__(n,o),r[1](n)}),[r[0],function(){r[1](void 0)}]}function Vb(){var t=_i(Io++,11);if(!t.__){for(var e=Ce.__v;e!==null&&!e.__m&&e.__!==null;)e=e.__;var r=e.__m||(e.__m=[0,0]);t.__="P"+r[0]+"-"+r[1]++}return t.__}function m7(){for(var t;t=sA.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Dp),t.__H.__h.forEach(Hb),t.__H.__h=[]}catch(e){t.__H.__h=[],z.__e(e,t.__v)}}function h7(t){var e,r=function(){clearTimeout(n),iA&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);iA&&(e=requestAnimationFrame(r))}function Dp(t){var e=Ce,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),Ce=e}function Hb(t){var e=Ce;t.__c=t.__(),Ce=e}function Gb(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}function aA(t,e){return typeof e=="function"?e(t):e}var Io,Ce,Wb,Qk,Zs,sA,Np,eA,tA,rA,nA,oA,iA,Zb=Xa(()=>{a();Gs();Zs=0,sA=[],Np=[],eA=z.__b,tA=z.__r,rA=z.diffed,nA=z.__c,oA=z.unmount;z.__b=function(t){Ce=null,eA&&eA(t)},z.__r=function(t){tA&&tA(t),Io=0;var e=(Ce=t.__c).__H;e&&(Wb===Ce?(e.__h=[],Ce.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.__V=Np,r.__N=r.i=void 0})):(e.__h.forEach(Dp),e.__h.forEach(Hb),e.__h=[])),Wb=Ce},z.diffed=function(t){rA&&rA(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(sA.push(e)!==1&&Qk===z.requestAnimationFrame||((Qk=z.requestAnimationFrame)||h7)(m7)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.__V!==Np&&(r.__=r.__V),r.i=void 0,r.__V=Np})),Wb=Ce=null},z.__c=function(t,e){e.some(function(r){try{r.__h.forEach(Dp),r.__h=r.__h.filter(function(n){return!n.__||Hb(n)})}catch(n){e.some(function(o){o.__h&&(o.__h=[])}),e=[],z.__e(n,r.__v)}}),nA&&nA(t,e)},z.unmount=function(t){oA&&oA(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Dp(n)}catch(o){e=o}}),r.__H=void 0,e&&z.__e(e,r.__v))};iA=typeof requestAnimationFrame=="function"});function gA(t,e){for(var r in e)t[r]=e[r];return t}function Yb(t,e){for(var r in t)if(r!=="__source"&&!(r in e))return!0;for(var n in e)if(n!=="__source"&&t[n]!==e[n])return!0;return!1}function Jb(t,e){return t===e&&(t!==0||1/t==1/e)||t!=t&&e!=e}function Pp(t){this.props=t}function yt(t,e){function r(o){var i=this.props.ref,s=i==o.ref;return!s&&i&&(i.call?i(null):i.current=null),e?!e(this.props,o)||!s:Yb(this.props,o)}function n(o){return this.shouldComponentUpdate=r,V(t,o)}return n.displayName="Memo("+(t.displayName||t.name)+")",n.prototype.isReactComponent=!0,n.__f=!0,n}function Q(t){function e(r){var n=gA({},r);return delete n.ref,t(n,r.ref||null)}return e.$$typeof=g7,e.render=e,e.prototype.isReactComponent=e.__f=!0,e.displayName="ForwardRef("+(t.displayName||t.name)+")",e}function yA(t,e,r){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach(function(n){typeof n.__c=="function"&&n.__c()}),t.__c.__H=null),(t=gA({},t)).__c!=null&&(t.__c.__P===r&&(t.__c.__P=e),t.__c=null),t.__k=t.__k&&t.__k.map(function(n){return yA(n,e,r)})),t}function bA(t,e,r){return t&&(t.__v=null,t.__k=t.__k&&t.__k.map(function(n){return bA(n,e,r)}),t.__c&&t.__c.__P===e&&(t.__e&&r.insertBefore(t.__e,t.__d),t.__c.__e=!0,t.__c.__P=r)),t}function Xl(){this.__u=0,this.t=null,this.__b=null}function vA(t){var e=t.__.__c;return e&&e.__a&&e.__a(t)}function wA(t){var e,r,n;function o(i){if(e||(e=t()).then(function(s){r=s.default||s},function(s){n=s}),n)throw n;if(!r)throw e;return V(r,i)}return o.displayName="Lazy",o.__f=!0,o}function Js(){this.u=null,this.o=null}function b7(t){return this.getChildContext=function(){return t.context},t.children}function v7(t){var e=this,r=t.i;e.componentWillUnmount=function(){Vs(null,e.l),e.l=null,e.i=null},e.i&&e.i!==r&&e.componentWillUnmount(),t.__v?(e.l||(e.i=r,e.l={nodeType:1,parentNode:r,childNodes:[],appendChild:function(n){this.childNodes.push(n),e.i.appendChild(n)},insertBefore:function(n,o){this.childNodes.push(n),e.i.appendChild(n)},removeChild:function(n){this.childNodes.splice(this.childNodes.indexOf(n)>>>1,1),e.i.removeChild(n)}}),Vs(V(b7,{context:e.context},t.__v),e.l)):e.l&&e.componentWillUnmount()}function xA(t,e){var r=V(v7,{__v:t,i:e});return r.containerInfo=e,r}function SA(t,e,r){return e.__k==null&&(e.textContent=""),Vs(t,e),typeof r=="function"&&r(),t?t.__c:null}function IA(t,e,r){return Ub(t,e),typeof r=="function"&&r(),t?t.__c:null}function S7(){}function I7(){return this.cancelBubble}function _7(){return this.defaultPrevented}function TA(t){return V.bind(null,t)}function Yt(t){return!!t&&t.$$typeof===EA}function br(t){return Yt(t)?Xk.apply(null,arguments):t}function CA(t){return!!t.__k&&(Vs(null,t),!0)}function kA(t){return t&&(t.base||t.nodeType===1&&t)||null}function Xb(t){t()}function NA(t){return t}function DA(){return[!1,Xb]}function FA(t,e){var r=e(),n=q({h:{__:r,v:e}}),o=n[0].h,i=n[1];return Lt(function(){o.__=r,o.v=e,Jb(o.__,e())||i({h:o})},[t,r,e]),K(function(){return Jb(o.__,o.v())||i({h:o}),t(function(){Jb(o.__,o.v())||i({h:o})})},[t]),r}var lA,g7,cA,tt,y7,uA,fA,EA,w7,x7,E7,pA,_A,dA,mA,hA,OA,O7,AA,cn,RA,PA,P,Qb=Xa(()=>{a();Gs();Gs();Zb();Zb();(Pp.prototype=new Jt).isPureReactComponent=!0,Pp.prototype.shouldComponentUpdate=function(t,e){return Yb(this.props,t)||Yb(this.state,e)};lA=z.__b;z.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),lA&&lA(t)};g7=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;cA=function(t,e){return t==null?null:an(an(t).map(e))},tt={map:cA,forEach:cA,count:function(t){return t?an(t).length:0},only:function(t){var e=an(t);if(e.length!==1)throw"Children.only";return e[0]},toArray:an},y7=z.__e;z.__e=function(t,e,r,n){if(t.then){for(var o,i=e;i=i.__;)if((o=i.__c)&&o.__c)return e.__e==null&&(e.__e=r.__e,e.__k=r.__k),o.__c(t,e)}y7(t,e,r,n)};uA=z.unmount;z.unmount=function(t){var e=t.__c;e&&e.__R&&e.__R(),e&&t.__h===!0&&(t.type=null),uA&&uA(t)},(Xl.prototype=new Jt).__c=function(t,e){var r=e.__c,n=this;n.t==null&&(n.t=[]),n.t.push(r);var o=vA(n.__v),i=!1,s=function(){i||(i=!0,r.__R=null,o?o(l):l())};r.__R=s;var l=function(){if(!--n.__u){if(n.state.__a){var f=n.state.__a;n.__v.__k[0]=bA(f,f.__c.__P,f.__c.__O)}var u;for(n.setState({__a:n.__b=null});u=n.t.pop();)u.forceUpdate()}},c=e.__h===!0;n.__u++||c||n.setState({__a:n.__b=n.__v.__k[0]}),t.then(s,s)},Xl.prototype.componentWillUnmount=function(){this.t=[]},Xl.prototype.render=function(t,e){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=yA(this.__b,r,n.__O=n.__P)}this.__b=null}var o=e.__a&&V(L,null,t.fallback);return o&&(o.__h=null),[V(L,null,e.__a?null:t.children),o]};fA=function(t,e,r){if(++r[1]===r[0]&&t.o.delete(e),t.props.revealOrder&&(t.props.revealOrder[0]!=="t"||!t.o.size))for(r=t.u;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;t.u=r=r[2]}};(Js.prototype=new Jt).__a=function(t){var e=this,r=vA(e.__v),n=e.o.get(t);return n[0]++,function(o){var i=function(){e.props.revealOrder?(n.push(o),fA(e,t,n)):o()};r?r(i):i()}},Js.prototype.render=function(t){this.u=null,this.o=new Map;var e=an(t.children);t.revealOrder&&t.revealOrder[0]==="b"&&e.reverse();for(var r=e.length;r--;)this.o.set(e[r],this.u=[1,0,this.u]);return t.children},Js.prototype.componentDidUpdate=Js.prototype.componentDidMount=function(){var t=this;this.o.forEach(function(e,r){fA(t,r,e)})};EA=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,w7=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,x7=typeof document<"u",E7=function(t){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/i:/fil|che|ra/i).test(t)};Jt.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(Jt.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})});pA=z.event;z.event=function(t){return pA&&(t=pA(t)),t.persist=S7,t.isPropagationStopped=I7,t.isDefaultPrevented=_7,t.nativeEvent=t};dA={configurable:!0,get:function(){return this.class}},mA=z.vnode;z.vnode=function(t){var e=t.type,r=t.props,n=r;if(typeof e=="string"){var o=e.indexOf("-")===-1;for(var i in n={},r){var s=r[i];x7&&i==="children"&&e==="noscript"||i==="value"&&"defaultValue"in r&&s==null||(i==="defaultValue"&&"value"in r&&r.value==null?i="value":i==="download"&&s===!0?s="":/ondoubleclick/i.test(i)?i="ondblclick":/^onchange(textarea|input)/i.test(i+e)&&!E7(r.type)?i="oninput":/^onfocus$/i.test(i)?i="onfocusin":/^onblur$/i.test(i)?i="onfocusout":/^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(i)?i=i.toLowerCase():o&&w7.test(i)?i=i.replace(/[A-Z0-9]/g,"-$&").toLowerCase():s===null&&(s=void 0),/^oninput$/i.test(i)&&(i=i.toLowerCase(),n[i]&&(i="oninputCapture")),n[i]=s)}e=="select"&&n.multiple&&Array.isArray(n.value)&&(n.value=an(r.children).forEach(function(l){l.props.selected=n.value.indexOf(l.props.value)!=-1})),e=="select"&&n.defaultValue!=null&&(n.value=an(r.children).forEach(function(l){l.props.selected=n.multiple?n.defaultValue.indexOf(l.props.value)!=-1:n.defaultValue==l.props.value})),t.props=n,r.class!=r.className&&(dA.enumerable="className"in r,r.className!=null&&(n.class=r.className),Object.defineProperty(n,"className",dA))}t.$$typeof=EA,mA&&mA(t)};hA=z.__r;z.__r=function(t){hA&&hA(t),_A=t.__c};OA={ReactCurrentDispatcher:{current:{readContext:function(t){return _A.__n[t.__c].props.value}}}},O7="17.0.2";AA=function(t,e){return t(e)},cn=function(t,e){return t(e)},RA=L;PA=Lt;P={useState:q,useId:Vb,useReducer:ln,useEffect:K,useLayoutEffect:Lt,useInsertionEffect:PA,useTransition:DA,useDeferredValue:NA,useSyncExternalStore:FA,startTransition:Xb,useRef:M,useImperativeHandle:Kb,useMemo:ae,useCallback:ee,useContext:re,useDebugValue:Oi,version:"17.0.2",Children:tt,render:SA,hydrate:IA,unmountComponentAtNode:CA,createPortal:xA,createElement:V,createContext:Ke,createFactory:TA,cloneElement:br,createRef:Rp,Fragment:L,isValidElement:Yt,findDOMNode:kA,Component:Jt,PureComponent:Pp,memo:yt,forwardRef:Q,flushSync:cn,unstable_batchedUpdates:AA,StrictMode:RA,Suspense:Xl,SuspenseList:Js,lazy:wA,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:OA}});var Pr={};iS(Pr,{Children:()=>tt,Component:()=>Jt,Fragment:()=>L,PureComponent:()=>Pp,StrictMode:()=>RA,Suspense:()=>Xl,SuspenseList:()=>Js,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:()=>OA,cloneElement:()=>br,createContext:()=>Ke,createElement:()=>V,createFactory:()=>TA,createPortal:()=>xA,createRef:()=>Rp,default:()=>P,findDOMNode:()=>kA,flushSync:()=>cn,forwardRef:()=>Q,hydrate:()=>IA,isValidElement:()=>Yt,lazy:()=>wA,memo:()=>yt,render:()=>SA,startTransition:()=>Xb,unmountComponentAtNode:()=>CA,unstable_batchedUpdates:()=>AA,useCallback:()=>ee,useContext:()=>re,useDebugValue:()=>Oi,useDeferredValue:()=>NA,useEffect:()=>K,useErrorBoundary:()=>d7,useId:()=>Vb,useImperativeHandle:()=>Kb,useInsertionEffect:()=>PA,useLayoutEffect:()=>Lt,useMemo:()=>ae,useReducer:()=>ln,useRef:()=>M,useState:()=>q,useSyncExternalStore:()=>FA,useTransition:()=>DA,version:()=>O7});var _=Xa(()=>{a();Qb();Qb()});var Ir=b((_D,OD)=>{"use strict";a();var mm=function(t){return t&&t.Math===Math&&t};OD.exports=mm(typeof globalThis=="object"&&globalThis)||mm(typeof window=="object"&&window)||mm(typeof self=="object"&&self)||mm(typeof global=="object"&&global)||function(){return this}()||_D||Function("return this")()});var Ot=b((vNe,TD)=>{"use strict";a();TD.exports=function(t){try{return!!t()}catch{return!0}}});var Kc=b((xNe,CD)=>{"use strict";a();var nV=Ot();CD.exports=!nV(function(){var t=function(){}.bind();return typeof t!="function"||t.hasOwnProperty("prototype")})});var DD=b((SNe,ND)=>{"use strict";a();var oV=Kc(),RD=Function.prototype,kD=RD.apply,AD=RD.call;ND.exports=typeof Reflect=="object"&&Reflect.apply||(oV?AD.bind(kD):function(){return AD.apply(kD,arguments)})});var Tt=b((_Ne,$D)=>{"use strict";a();var PD=Kc(),FD=Function.prototype,q0=FD.call,iV=PD&&FD.bind.bind(q0,q0);$D.exports=PD?iV:function(t){return function(){return q0.apply(t,arguments)}}});var Vi=b((TNe,LD)=>{"use strict";a();var MD=Tt(),sV=MD({}.toString),aV=MD("".slice);LD.exports=function(t){return aV(sV(t),8,-1)}});var B0=b((kNe,jD)=>{"use strict";a();var lV=Vi(),cV=Tt();jD.exports=function(t){if(lV(t)==="Function")return cV(t)}});var U0=b((RNe,qD)=>{"use strict";a();var z0=typeof document=="object"&&document.all,uV=typeof z0>"u"&&z0!==void 0;qD.exports={all:z0,IS_HTMLDDA:uV}});var st=b((DNe,zD)=>{"use strict";a();var BD=U0(),fV=BD.all;zD.exports=BD.IS_HTMLDDA?function(t){return typeof t=="function"||t===fV}:function(t){return typeof t=="function"}});var _r=b((FNe,UD)=>{"use strict";a();var pV=Ot();UD.exports=!pV(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var Zn=b((MNe,WD)=>{"use strict";a();var dV=Kc(),hm=Function.prototype.call;WD.exports=dV?hm.bind(hm):function(){return hm.apply(hm,arguments)}});var GD=b(VD=>{"use strict";a();var HD={}.propertyIsEnumerable,KD=Object.getOwnPropertyDescriptor,mV=KD&&!HD.call({1:2},1);VD.f=mV?function(e){var r=KD(this,e);return!!r&&r.enumerable}:HD});var Vc=b((BNe,ZD)=>{"use strict";a();ZD.exports=function(t,e){return{enumerable:!(t&1),configurable:!(t&2),writable:!(t&4),value:e}}});var H0=b((UNe,JD)=>{"use strict";a();var hV=Tt(),gV=Ot(),yV=Vi(),W0=Object,bV=hV("".split);JD.exports=gV(function(){return!W0("z").propertyIsEnumerable(0)})?function(t){return yV(t)==="String"?bV(t,""):W0(t)}:W0});var xa=b((HNe,YD)=>{"use strict";a();YD.exports=function(t){return t==null}});var Gc=b((VNe,XD)=>{"use strict";a();var vV=xa(),wV=TypeError;XD.exports=function(t){if(vV(t))throw wV("Can't call method on "+t);return t}});var Ea=b((ZNe,QD)=>{"use strict";a();var xV=H0(),EV=Gc();QD.exports=function(t){return xV(EV(t))}});var Br=b((YNe,rP)=>{"use strict";a();var eP=st(),tP=U0(),SV=tP.all;rP.exports=tP.IS_HTMLDDA?function(t){return typeof t=="object"?t!==null:eP(t)||t===SV}:function(t){return typeof t=="object"?t!==null:eP(t)}});var Zc=b((QNe,nP)=>{"use strict";a();nP.exports={}});var Gi=b((tDe,iP)=>{"use strict";a();var K0=Zc(),V0=Ir(),IV=st(),oP=function(t){return IV(t)?t:void 0};iP.exports=function(t,e){return arguments.length<2?oP(K0[t])||oP(V0[t]):K0[t]&&K0[t][e]||V0[t]&&V0[t][e]}});var gm=b((nDe,sP)=>{"use strict";a();var _V=Tt();sP.exports=_V({}.isPrototypeOf)});var lP=b((iDe,aP)=>{"use strict";a();aP.exports=typeof navigator<"u"&&String(navigator.userAgent)||""});var hP=b((aDe,mP)=>{"use strict";a();var dP=Ir(),G0=lP(),cP=dP.process,uP=dP.Deno,fP=cP&&cP.versions||uP&&uP.version,pP=fP&&fP.v8,zr,ym;pP&&(zr=pP.split("."),ym=zr[0]>0&&zr[0]<4?1:+(zr[0]+zr[1]));!ym&&G0&&(zr=G0.match(/Edge\/(\d+)/),(!zr||zr[1]>=74)&&(zr=G0.match(/Chrome\/(\d+)/),zr&&(ym=+zr[1])));mP.exports=ym});var Z0=b((cDe,yP)=>{"use strict";a();var gP=hP(),OV=Ot(),TV=Ir(),CV=TV.String;yP.exports=!!Object.getOwnPropertySymbols&&!OV(function(){var t=Symbol("symbol detection");return!CV(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&gP&&gP<41})});var J0=b((fDe,bP)=>{"use strict";a();var kV=Z0();bP.exports=kV&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Y0=b((dDe,vP)=>{"use strict";a();var AV=Gi(),RV=st(),NV=gm(),DV=J0(),PV=Object;vP.exports=DV?function(t){return typeof t=="symbol"}:function(t){var e=AV("Symbol");return RV(e)&&NV(e.prototype,PV(t))}});var bm=b((hDe,wP)=>{"use strict";a();var FV=String;wP.exports=function(t){try{return FV(t)}catch{return"Object"}}});var Zi=b((yDe,xP)=>{"use strict";a();var $V=st(),MV=bm(),LV=TypeError;xP.exports=function(t){if($V(t))return t;throw LV(MV(t)+" is not a function")}});var vm=b((vDe,EP)=>{"use strict";a();var jV=Zi(),qV=xa();EP.exports=function(t,e){var r=t[e];return qV(r)?void 0:jV(r)}});var IP=b((xDe,SP)=>{"use strict";a();var X0=Zn(),Q0=st(),ew=Br(),BV=TypeError;SP.exports=function(t,e){var r,n;if(e==="string"&&Q0(r=t.toString)&&!ew(n=X0(r,t))||Q0(r=t.valueOf)&&!ew(n=X0(r,t))||e!=="string"&&Q0(r=t.toString)&&!ew(n=X0(r,t)))return n;throw BV("Can't convert object to primitive value")}});var Jc=b((SDe,_P)=>{"use strict";a();_P.exports=!0});var CP=b((_De,TP)=>{"use strict";a();var OP=Ir(),zV=Object.defineProperty;TP.exports=function(t,e){try{zV(OP,t,{value:e,configurable:!0,writable:!0})}catch{OP[t]=e}return e}});var wm=b((TDe,AP)=>{"use strict";a();var UV=Ir(),WV=CP(),kP="__core-js_shared__",HV=UV[kP]||WV(kP,{});AP.exports=HV});var tw=b((kDe,NP)=>{"use strict";a();var KV=Jc(),RP=wm();(NP.exports=function(t,e){return RP[t]||(RP[t]=e!==void 0?e:{})})("versions",[]).push({version:"3.32.1",mode:KV?"pure":"global",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.32.1/LICENSE",source:"https://github.com/zloirock/core-js"})});var xm=b((RDe,DP)=>{"use strict";a();var VV=Gc(),GV=Object;DP.exports=function(t){return GV(VV(t))}});var wn=b((DDe,PP)=>{"use strict";a();var ZV=Tt(),JV=xm(),YV=ZV({}.hasOwnProperty);PP.exports=Object.hasOwn||function(e,r){return YV(JV(e),r)}});var Em=b((FDe,FP)=>{"use strict";a();var XV=Tt(),QV=0,eG=Math.random(),tG=XV(1 .toString);FP.exports=function(t){return"Symbol("+(t===void 0?"":t)+")_"+tG(++QV+eG,36)}});var Ur=b((MDe,MP)=>{"use strict";a();var rG=Ir(),nG=tw(),$P=wn(),oG=Em(),iG=Z0(),sG=J0(),Sa=rG.Symbol,rw=nG("wks"),aG=sG?Sa.for||Sa:Sa&&Sa.withoutSetter||oG;MP.exports=function(t){return $P(rw,t)||(rw[t]=iG&&$P(Sa,t)?Sa[t]:aG("Symbol."+t)),rw[t]}});var BP=b((jDe,qP)=>{"use strict";a();var lG=Zn(),LP=Br(),jP=Y0(),cG=vm(),uG=IP(),fG=Ur(),pG=TypeError,dG=fG("toPrimitive");qP.exports=function(t,e){if(!LP(t)||jP(t))return t;var r=cG(t,dG),n;if(r){if(e===void 0&&(e="default"),n=lG(r,t,e),!LP(n)||jP(n))return n;throw pG("Can't convert object to primitive value")}return e===void 0&&(e="number"),uG(t,e)}});var Yc=b((BDe,zP)=>{"use strict";a();var mG=BP(),hG=Y0();zP.exports=function(t){var e=mG(t,"string");return hG(e)?e:e+""}});var ow=b((UDe,WP)=>{"use strict";a();var gG=Ir(),UP=Br(),nw=gG.document,yG=UP(nw)&&UP(nw.createElement);WP.exports=function(t){return yG?nw.createElement(t):{}}});var iw=b((HDe,HP)=>{"use strict";a();var bG=_r(),vG=Ot(),wG=ow();HP.exports=!bG&&!vG(function(){return Object.defineProperty(wG("div"),"a",{get:function(){return 7}}).a!==7})});var GP=b(VP=>{"use strict";a();var xG=_r(),EG=Zn(),SG=GD(),IG=Vc(),_G=Ea(),OG=Yc(),TG=wn(),CG=iw(),KP=Object.getOwnPropertyDescriptor;VP.f=xG?KP:function(e,r){if(e=_G(e),r=OG(r),CG)try{return KP(e,r)}catch{}if(TG(e,r))return IG(!EG(SG.f,e,r),e[r])}});var JP=b((ZDe,ZP)=>{"use strict";a();var kG=Ot(),AG=st(),RG=/#|\.prototype\./,Xc=function(t,e){var r=DG[NG(t)];return r===FG?!0:r===PG?!1:AG(e)?kG(e):!!e},NG=Xc.normalize=function(t){return String(t).replace(RG,".").toLowerCase()},DG=Xc.data={},PG=Xc.NATIVE="N",FG=Xc.POLYFILL="P";ZP.exports=Xc});var Qc=b((YDe,XP)=>{"use strict";a();var YP=B0(),$G=Zi(),MG=Kc(),LG=YP(YP.bind);XP.exports=function(t,e){return $G(t),e===void 0?t:MG?LG(t,e):function(){return t.apply(e,arguments)}}});var sw=b((QDe,QP)=>{"use strict";a();var jG=_r(),qG=Ot();QP.exports=jG&&qG(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var zo=b((tPe,eF)=>{"use strict";a();var BG=Br(),zG=String,UG=TypeError;eF.exports=function(t){if(BG(t))return t;throw UG(zG(t)+" is not an object")}});var Uo=b(rF=>{"use strict";a();var WG=_r(),HG=iw(),KG=sw(),Sm=zo(),tF=Yc(),VG=TypeError,aw=Object.defineProperty,GG=Object.getOwnPropertyDescriptor,lw="enumerable",cw="configurable",uw="writable";rF.f=WG?KG?function(e,r,n){if(Sm(e),r=tF(r),Sm(n),typeof e=="function"&&r==="prototype"&&"value"in n&&uw in n&&!n[uw]){var o=GG(e,r);o&&o[uw]&&(e[r]=n.value,n={configurable:cw in n?n[cw]:o[cw],enumerable:lw in n?n[lw]:o[lw],writable:!1})}return aw(e,r,n)}:aw:function(e,r,n){if(Sm(e),r=tF(r),Sm(n),HG)try{return aw(e,r,n)}catch{}if("get"in n||"set"in n)throw VG("Accessors not supported");return"value"in n&&(e[r]=n.value),e}});var Ji=b((iPe,nF)=>{"use strict";a();var ZG=_r(),JG=Uo(),YG=Vc();nF.exports=ZG?function(t,e,r){return JG.f(t,e,YG(1,r))}:function(t,e,r){return t[e]=r,t}});var Yi=b((aPe,iF)=>{"use strict";a();var Im=Ir(),XG=DD(),QG=B0(),eZ=st(),tZ=GP().f,rZ=JP(),Ia=Zc(),nZ=Qc(),_a=Ji(),oF=wn(),oZ=function(t){var e=function(r,n,o){if(this instanceof e){switch(arguments.length){case 0:return new t;case 1:return new t(r);case 2:return new t(r,n)}return new t(r,n,o)}return XG(t,this,arguments)};return e.prototype=t.prototype,e};iF.exports=function(t,e){var r=t.target,n=t.global,o=t.stat,i=t.proto,s=n?Im:o?Im[r]:(Im[r]||{}).prototype,l=n?Ia:Ia[r]||_a(Ia,r,{})[r],c=l.prototype,f,u,d,m,h,y,w,v,x;for(m in e)f=rZ(n?m:r+(o?".":"#")+m,t.forced),u=!f&&s&&oF(s,m),y=l[m],u&&(t.dontCallGetSet?(x=tZ(s,m),w=x&&x.value):w=s[m]),h=u&&w?w:e[m],!(u&&typeof y==typeof h)&&(t.bind&&u?v=nZ(h,Im):t.wrap&&u?v=oZ(h):i&&eZ(h)?v=QG(h):v=h,(t.sham||h&&h.sham||y&&y.sham)&&_a(v,"sham",!0),_a(l,m,v),i&&(d=r+"Prototype",oF(Ia,d)||_a(Ia,d,{}),_a(Ia[d],m,h),t.real&&c&&(f||!c[m])&&_a(c,m,h)))}});var eu=b((cPe,sF)=>{"use strict";a();sF.exports={}});var lF=b((fPe,aF)=>{"use strict";a();var iZ=Math.ceil,sZ=Math.floor;aF.exports=Math.trunc||function(e){var r=+e;return(r>0?sZ:iZ)(r)}});var fw=b((dPe,cF)=>{"use strict";a();var aZ=lF();cF.exports=function(t){var e=+t;return e!==e||e===0?0:aZ(e)}});var pw=b((hPe,uF)=>{"use strict";a();var lZ=fw(),cZ=Math.max,uZ=Math.min;uF.exports=function(t,e){var r=lZ(t);return r<0?cZ(r+e,0):uZ(r,e)}});var pF=b((yPe,fF)=>{"use strict";a();var fZ=fw(),pZ=Math.min;fF.exports=function(t){return t>0?pZ(fZ(t),9007199254740991):0}});var tu=b((vPe,dF)=>{"use strict";a();var dZ=pF();dF.exports=function(t){return dZ(t.length)}});var gF=b((xPe,hF)=>{"use strict";a();var mZ=Ea(),hZ=pw(),gZ=tu(),mF=function(t){return function(e,r,n){var o=mZ(e),i=gZ(o),s=hZ(n,i),l;if(t&&r!==r){for(;i>s;)if(l=o[s++],l!==l)return!0}else for(;i>s;s++)if((t||s in o)&&o[s]===r)return t||s||0;return!t&&-1}};hF.exports={includes:mF(!0),indexOf:mF(!1)}});var mw=b((SPe,bF)=>{"use strict";a();var yZ=Tt(),dw=wn(),bZ=Ea(),vZ=gF().indexOf,wZ=eu(),yF=yZ([].push);bF.exports=function(t,e){var r=bZ(t),n=0,o=[],i;for(i in r)!dw(wZ,i)&&dw(r,i)&&yF(o,i);for(;e.length>n;)dw(r,i=e[n++])&&(~vZ(o,i)||yF(o,i));return o}});var _m=b((_Pe,vF)=>{"use strict";a();vF.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var hw=b(wF=>{"use strict";a();var xZ=mw(),EZ=_m(),SZ=EZ.concat("length","prototype");wF.f=Object.getOwnPropertyNames||function(e){return xZ(e,SZ)}});var EF=b((kPe,xF)=>{"use strict";a();var IZ=Yc(),_Z=Uo(),OZ=Vc();xF.exports=function(t,e,r){var n=IZ(e);n in t?_Z.f(t,n,OZ(0,r)):t[n]=r}});var _F=b((RPe,IF)=>{"use strict";a();var SF=pw(),TZ=tu(),CZ=EF(),kZ=Array,AZ=Math.max;IF.exports=function(t,e,r){for(var n=TZ(t),o=SF(e,n),i=SF(r===void 0?n:r,n),s=kZ(AZ(i-o,0)),l=0;o<i;o++,l++)CZ(s,l,t[o]);return s.length=l,s}});var kF=b((DPe,CF)=>{"use strict";a();var RZ=Vi(),NZ=Ea(),OF=hw().f,DZ=_F(),TF=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],PZ=function(t){try{return OF(t)}catch{return DZ(TF)}};CF.exports.f=function(e){return TF&&RZ(e)==="Window"?PZ(e):OF(NZ(e))}});var RF=b((FPe,AF)=>{"use strict";a();var FZ=Ot();AF.exports=FZ(function(){if(typeof ArrayBuffer=="function"){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}})});var PF=b((MPe,DF)=>{"use strict";a();var $Z=Ot(),MZ=Br(),LZ=Vi(),NF=RF(),Om=Object.isExtensible,jZ=$Z(function(){Om(1)});DF.exports=jZ||NF?function(e){return!MZ(e)||NF&&LZ(e)==="ArrayBuffer"?!1:Om?Om(e):!0}:Om});var $F=b((jPe,FF)=>{"use strict";a();var qZ=Ot();FF.exports=!qZ(function(){return Object.isExtensible(Object.preventExtensions({}))})});var vw=b((BPe,jF)=>{"use strict";a();var BZ=Yi(),zZ=Tt(),UZ=eu(),WZ=Br(),gw=wn(),HZ=Uo().f,MF=hw(),KZ=kF(),yw=PF(),VZ=Em(),GZ=$F(),LF=!1,Jn=VZ("meta"),ZZ=0,bw=function(t){HZ(t,Jn,{value:{objectID:"O"+ZZ++,weakData:{}}})},JZ=function(t,e){if(!WZ(t))return typeof t=="symbol"?t:(typeof t=="string"?"S":"P")+t;if(!gw(t,Jn)){if(!yw(t))return"F";if(!e)return"E";bw(t)}return t[Jn].objectID},YZ=function(t,e){if(!gw(t,Jn)){if(!yw(t))return!0;if(!e)return!1;bw(t)}return t[Jn].weakData},XZ=function(t){return GZ&&LF&&yw(t)&&!gw(t,Jn)&&bw(t),t},QZ=function(){eJ.enable=function(){},LF=!0;var t=MF.f,e=zZ([].splice),r={};r[Jn]=1,t(r).length&&(MF.f=function(n){for(var o=t(n),i=0,s=o.length;i<s;i++)if(o[i]===Jn){e(o,i,1);break}return o},BZ({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:KZ.f}))},eJ=jF.exports={enable:QZ,fastKey:JZ,getWeakData:YZ,onFreeze:XZ};UZ[Jn]=!0});var ru=b((UPe,qF)=>{"use strict";a();qF.exports={}});var zF=b((HPe,BF)=>{"use strict";a();var tJ=Ur(),rJ=ru(),nJ=tJ("iterator"),oJ=Array.prototype;BF.exports=function(t){return t!==void 0&&(rJ.Array===t||oJ[nJ]===t)}});var Tm=b((VPe,WF)=>{"use strict";a();var iJ=Ur(),sJ=iJ("toStringTag"),UF={};UF[sJ]="z";WF.exports=String(UF)==="[object z]"});var km=b((ZPe,HF)=>{"use strict";a();var aJ=Tm(),lJ=st(),Cm=Vi(),cJ=Ur(),uJ=cJ("toStringTag"),fJ=Object,pJ=Cm(function(){return arguments}())==="Arguments",dJ=function(t,e){try{return t[e]}catch{}};HF.exports=aJ?Cm:function(t){var e,r,n;return t===void 0?"Undefined":t===null?"Null":typeof(r=dJ(e=fJ(t),uJ))=="string"?r:pJ?Cm(e):(n=Cm(e))==="Object"&&lJ(e.callee)?"Arguments":n}});var ww=b((YPe,VF)=>{"use strict";a();var mJ=km(),KF=vm(),hJ=xa(),gJ=ru(),yJ=Ur(),bJ=yJ("iterator");VF.exports=function(t){if(!hJ(t))return KF(t,bJ)||KF(t,"@@iterator")||gJ[mJ(t)]}});var ZF=b((QPe,GF)=>{"use strict";a();var vJ=Zn(),wJ=Zi(),xJ=zo(),EJ=bm(),SJ=ww(),IJ=TypeError;GF.exports=function(t,e){var r=arguments.length<2?SJ(t):e;if(wJ(r))return xJ(vJ(r,t));throw IJ(EJ(t)+" is not iterable")}});var XF=b((tFe,YF)=>{"use strict";a();var _J=Zn(),JF=zo(),OJ=vm();YF.exports=function(t,e,r){var n,o;JF(t);try{if(n=OJ(t,"return"),!n){if(e==="throw")throw r;return r}n=_J(n,t)}catch(i){o=!0,n=i}if(e==="throw")throw r;if(o)throw n;return JF(n),r}});var nu=b((nFe,r$)=>{"use strict";a();var TJ=Qc(),CJ=Zn(),kJ=zo(),AJ=bm(),RJ=zF(),NJ=tu(),QF=gm(),DJ=ZF(),PJ=ww(),e$=XF(),FJ=TypeError,Am=function(t,e){this.stopped=t,this.result=e},t$=Am.prototype;r$.exports=function(t,e,r){var n=r&&r.that,o=!!(r&&r.AS_ENTRIES),i=!!(r&&r.IS_RECORD),s=!!(r&&r.IS_ITERATOR),l=!!(r&&r.INTERRUPTED),c=TJ(e,n),f,u,d,m,h,y,w,v=function(S){return f&&e$(f,"normal",S),new Am(!0,S)},x=function(S){return o?(kJ(S),l?c(S[0],S[1],v):c(S[0],S[1])):l?c(S,v):c(S)};if(i)f=t.iterator;else if(s)f=t;else{if(u=PJ(t),!u)throw FJ(AJ(t)+" is not iterable");if(RJ(u)){for(d=0,m=NJ(t);m>d;d++)if(h=x(t[d]),h&&QF(t$,h))return h;return new Am(!1)}f=DJ(t,u)}for(y=i?t.next:f.next;!(w=CJ(y,f)).done;){try{h=x(w.value)}catch(S){e$(f,"throw",S)}if(typeof h=="object"&&h&&QF(t$,h))return h}return new Am(!1)}});var xw=b((iFe,n$)=>{"use strict";a();var $J=gm(),MJ=TypeError;n$.exports=function(t,e){if($J(e,t))return t;throw MJ("Incorrect invocation")}});var i$=b((aFe,o$)=>{"use strict";a();var LJ=Tm(),jJ=km();o$.exports=LJ?{}.toString:function(){return"[object "+jJ(this)+"]"}});var Rm=b((cFe,a$)=>{"use strict";a();var qJ=Tm(),BJ=Uo().f,zJ=Ji(),UJ=wn(),WJ=i$(),HJ=Ur(),s$=HJ("toStringTag");a$.exports=function(t,e,r,n){if(t){var o=r?t:t.prototype;UJ(o,s$)||BJ(o,s$,{configurable:!0,value:e}),n&&!qJ&&zJ(o,"toString",WJ)}}});var c$=b((fFe,l$)=>{"use strict";a();var KJ=Vi();l$.exports=Array.isArray||function(e){return KJ(e)==="Array"}});var f$=b((dFe,u$)=>{"use strict";a();var VJ=Tt(),GJ=st(),Ew=wm(),ZJ=VJ(Function.toString);GJ(Ew.inspectSource)||(Ew.inspectSource=function(t){return ZJ(t)});u$.exports=Ew.inspectSource});var y$=b((hFe,g$)=>{"use strict";a();var JJ=Tt(),YJ=Ot(),p$=st(),XJ=km(),QJ=Gi(),eY=f$(),d$=function(){},tY=[],m$=QJ("Reflect","construct"),Sw=/^\s*(?:class|function)\b/,rY=JJ(Sw.exec),nY=!Sw.exec(d$),ou=function(e){if(!p$(e))return!1;try{return m$(d$,tY,e),!0}catch{return!1}},h$=function(e){if(!p$(e))return!1;switch(XJ(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return nY||!!rY(Sw,eY(e))}catch{return!0}};h$.sham=!0;g$.exports=!m$||YJ(function(){var t;return ou(ou.call)||!ou(Object)||!ou(function(){t=!0})||t})?h$:ou});var x$=b((yFe,w$)=>{"use strict";a();var b$=c$(),oY=y$(),iY=Br(),sY=Ur(),aY=sY("species"),v$=Array;w$.exports=function(t){var e;return b$(t)&&(e=t.constructor,oY(e)&&(e===v$||b$(e.prototype))?e=void 0:iY(e)&&(e=e[aY],e===null&&(e=void 0))),e===void 0?v$:e}});var S$=b((vFe,E$)=>{"use strict";a();var lY=x$();E$.exports=function(t,e){return new(lY(t))(e===0?0:e)}});var O$=b((xFe,_$)=>{"use strict";a();var cY=Qc(),uY=Tt(),fY=H0(),pY=xm(),dY=tu(),mY=S$(),I$=uY([].push),Wo=function(t){var e=t===1,r=t===2,n=t===3,o=t===4,i=t===6,s=t===7,l=t===5||i;return function(c,f,u,d){for(var m=pY(c),h=fY(m),y=cY(f,u),w=dY(h),v=0,x=d||mY,S=e?x(c,w):r||s?x(c,0):void 0,k,j;w>v;v++)if((l||v in h)&&(k=h[v],j=y(k,v,m),t))if(e)S[v]=j;else if(j)switch(t){case 3:return!0;case 5:return k;case 6:return v;case 2:I$(S,k)}else switch(t){case 4:return!1;case 7:I$(S,k)}return i?-1:n||o?o:S}};_$.exports={forEach:Wo(0),map:Wo(1),filter:Wo(2),some:Wo(3),every:Wo(4),find:Wo(5),findIndex:Wo(6),filterReject:Wo(7)}});var k$=b((SFe,C$)=>{"use strict";a();var hY=Ir(),gY=st(),T$=hY.WeakMap;C$.exports=gY(T$)&&/native code/.test(String(T$))});var Nm=b((_Fe,R$)=>{"use strict";a();var yY=tw(),bY=Em(),A$=yY("keys");R$.exports=function(t){return A$[t]||(A$[t]=bY(t))}});var Tw=b((TFe,P$)=>{"use strict";a();var vY=k$(),D$=Ir(),wY=Br(),xY=Ji(),Iw=wn(),_w=wm(),EY=Nm(),SY=eu(),N$="Object already initialized",Ow=D$.TypeError,IY=D$.WeakMap,Dm,iu,Pm,_Y=function(t){return Pm(t)?iu(t):Dm(t,{})},OY=function(t){return function(e){var r;if(!wY(e)||(r=iu(e)).type!==t)throw Ow("Incompatible receiver, "+t+" required");return r}};vY||_w.state?(Wr=_w.state||(_w.state=new IY),Wr.get=Wr.get,Wr.has=Wr.has,Wr.set=Wr.set,Dm=function(t,e){if(Wr.has(t))throw Ow(N$);return e.facade=t,Wr.set(t,e),e},iu=function(t){return Wr.get(t)||{}},Pm=function(t){return Wr.has(t)}):(Xi=EY("state"),SY[Xi]=!0,Dm=function(t,e){if(Iw(t,Xi))throw Ow(N$);return e.facade=t,xY(t,Xi,e),e},iu=function(t){return Iw(t,Xi)?t[Xi]:{}},Pm=function(t){return Iw(t,Xi)});var Wr,Xi;P$.exports={set:Dm,get:iu,has:Pm,enforce:_Y,getterFor:OY}});var M$=b((kFe,$$)=>{"use strict";a();var TY=Yi(),CY=Ir(),kY=vw(),AY=Ot(),RY=Ji(),NY=nu(),DY=xw(),PY=st(),FY=Br(),$Y=xa(),MY=Rm(),LY=Uo().f,jY=O$().forEach,qY=_r(),F$=Tw(),BY=F$.set,zY=F$.getterFor;$$.exports=function(t,e,r){var n=t.indexOf("Map")!==-1,o=t.indexOf("Weak")!==-1,i=n?"set":"add",s=CY[t],l=s&&s.prototype,c={},f;if(!qY||!PY(s)||!(o||l.forEach&&!AY(function(){new s().entries().next()})))f=r.getConstructor(e,t,n,i),kY.enable();else{f=e(function(m,h){BY(DY(m,u),{type:t,collection:new s}),$Y(h)||NY(h,m[i],{that:m,AS_ENTRIES:n})});var u=f.prototype,d=zY(t);jY(["add","clear","delete","forEach","get","has","set","keys","values","entries"],function(m){var h=m==="add"||m==="set";m in l&&!(o&&m==="clear")&&RY(u,m,function(y,w){var v=d(this).collection;if(!h&&o&&!FY(y))return m==="get"?void 0:!1;var x=v[m](y===0?0:y,w);return h?this:x})}),o||LY(u,"size",{configurable:!0,get:function(){return d(this).collection.size}})}return MY(f,t,!1,!0),c[t]=f,TY({global:!0,forced:!0},c),o||r.setStrong(f,t,n),f}});var j$=b((RFe,L$)=>{"use strict";a();var UY=mw(),WY=_m();L$.exports=Object.keys||function(e){return UY(e,WY)}});var B$=b(q$=>{"use strict";a();var HY=_r(),KY=sw(),VY=Uo(),GY=zo(),ZY=Ea(),JY=j$();q$.f=HY&&!KY?Object.defineProperties:function(e,r){GY(e);for(var n=ZY(r),o=JY(r),i=o.length,s=0,l;i>s;)VY.f(e,l=o[s++],n[l]);return e}});var U$=b((FFe,z$)=>{"use strict";a();var YY=Gi();z$.exports=YY("document","documentElement")});var su=b((MFe,J$)=>{"use strict";a();var XY=zo(),QY=B$(),W$=_m(),eX=eu(),tX=U$(),rX=ow(),nX=Nm(),H$=">",K$="<",kw="prototype",Aw="script",G$=nX("IE_PROTO"),Cw=function(){},Z$=function(t){return K$+Aw+H$+t+K$+"/"+Aw+H$},V$=function(t){t.write(Z$("")),t.close();var e=t.parentWindow.Object;return t=null,e},oX=function(){var t=rX("iframe"),e="java"+Aw+":",r;return t.style.display="none",tX.appendChild(t),t.src=String(e),r=t.contentWindow.document,r.open(),r.write(Z$("document.F=Object")),r.close(),r.F},Fm,$m=function(){try{Fm=new ActiveXObject("htmlfile")}catch{}$m=typeof document<"u"?document.domain&&Fm?V$(Fm):oX():V$(Fm);for(var t=W$.length;t--;)delete $m[kw][W$[t]];return $m()};eX[G$]=!0;J$.exports=Object.create||function(e,r){var n;return e!==null?(Cw[kw]=XY(e),n=new Cw,Cw[kw]=null,n[G$]=e):n=$m(),r===void 0?n:QY.f(n,r)}});var Rw=b((jFe,Y$)=>{"use strict";a();var iX=Uo();Y$.exports=function(t,e,r){return iX.f(t,e,r)}});var Mm=b((BFe,X$)=>{"use strict";a();var sX=Ji();X$.exports=function(t,e,r,n){return n&&n.enumerable?t[e]=r:sX(t,e,r),t}});var eM=b((UFe,Q$)=>{"use strict";a();var aX=Mm();Q$.exports=function(t,e,r){for(var n in e)r&&r.unsafe&&t[n]?t[n]=e[n]:aX(t,n,e[n],r);return t}});var nM=b((HFe,rM)=>{"use strict";a();var Nw=_r(),lX=wn(),tM=Function.prototype,cX=Nw&&Object.getOwnPropertyDescriptor,Dw=lX(tM,"name"),uX=Dw&&function(){}.name==="something",fX=Dw&&(!Nw||Nw&&cX(tM,"name").configurable);rM.exports={EXISTS:Dw,PROPER:uX,CONFIGURABLE:fX}});var iM=b((VFe,oM)=>{"use strict";a();var pX=Ot();oM.exports=!pX(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})});var Fw=b((ZFe,aM)=>{"use strict";a();var dX=wn(),mX=st(),hX=xm(),gX=Nm(),yX=iM(),sM=gX("IE_PROTO"),Pw=Object,bX=Pw.prototype;aM.exports=yX?Pw.getPrototypeOf:function(t){var e=hX(t);if(dX(e,sM))return e[sM];var r=e.constructor;return mX(r)&&e instanceof r?r.prototype:e instanceof Pw?bX:null}});var jw=b((YFe,uM)=>{"use strict";a();var vX=Ot(),wX=st(),xX=Br(),EX=su(),lM=Fw(),SX=Mm(),IX=Ur(),_X=Jc(),Lw=IX("iterator"),cM=!1,Yn,$w,Mw;[].keys&&(Mw=[].keys(),"next"in Mw?($w=lM(lM(Mw)),$w!==Object.prototype&&(Yn=$w)):cM=!0);var OX=!xX(Yn)||vX(function(){var t={};return Yn[Lw].call(t)!==t});OX?Yn={}:_X&&(Yn=EX(Yn));wX(Yn[Lw])||SX(Yn,Lw,function(){return this});uM.exports={IteratorPrototype:Yn,BUGGY_SAFARI_ITERATORS:cM}});var pM=b((QFe,fM)=>{"use strict";a();var TX=jw().IteratorPrototype,CX=su(),kX=Vc(),AX=Rm(),RX=ru(),NX=function(){return this};fM.exports=function(t,e,r,n){var o=e+" Iterator";return t.prototype=CX(TX,{next:kX(+!n,r)}),AX(t,o,!1,!0),RX[o]=NX,t}});var mM=b((t$e,dM)=>{"use strict";a();var DX=Tt(),PX=Zi();dM.exports=function(t,e,r){try{return DX(PX(Object.getOwnPropertyDescriptor(t,e)[r]))}catch{}}});var gM=b((n$e,hM)=>{"use strict";a();var FX=st(),$X=String,MX=TypeError;hM.exports=function(t){if(typeof t=="object"||FX(t))return t;throw MX("Can't set "+$X(t)+" as a prototype")}});var bM=b((i$e,yM)=>{"use strict";a();var LX=mM(),jX=zo(),qX=gM();yM.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t=!1,e={},r;try{r=LX(Object.prototype,"__proto__","set"),r(e,[]),t=e instanceof Array}catch{}return function(o,i){return jX(o),qX(i),t?r(o,i):o.__proto__=i,o}}():void 0)});var kM=b((a$e,CM)=>{"use strict";a();var BX=Yi(),zX=Zn(),Lm=Jc(),OM=nM(),UX=st(),WX=pM(),vM=Fw(),wM=bM(),HX=Rm(),KX=Ji(),qw=Mm(),VX=Ur(),xM=ru(),TM=jw(),GX=OM.PROPER,ZX=OM.CONFIGURABLE,EM=TM.IteratorPrototype,jm=TM.BUGGY_SAFARI_ITERATORS,au=VX("iterator"),SM="keys",lu="values",IM="entries",_M=function(){return this};CM.exports=function(t,e,r,n,o,i,s){WX(r,e,n);var l=function(x){if(x===o&&m)return m;if(!jm&&x in u)return u[x];switch(x){case SM:return function(){return new r(this,x)};case lu:return function(){return new r(this,x)};case IM:return function(){return new r(this,x)}}return function(){return new r(this)}},c=e+" Iterator",f=!1,u=t.prototype,d=u[au]||u["@@iterator"]||o&&u[o],m=!jm&&d||l(o),h=e==="Array"&&u.entries||d,y,w,v;if(h&&(y=vM(h.call(new t)),y!==Object.prototype&&y.next&&(!Lm&&vM(y)!==EM&&(wM?wM(y,EM):UX(y[au])||qw(y,au,_M)),HX(y,c,!0,!0),Lm&&(xM[c]=_M))),GX&&o===lu&&d&&d.name!==lu&&(!Lm&&ZX?KX(u,"name",lu):(f=!0,m=function(){return zX(d,this)})),o)if(w={values:l(lu),keys:i?m:l(SM),entries:l(IM)},s)for(v in w)(jm||f||!(v in u))&&qw(u,v,w[v]);else BX({target:e,proto:!0,forced:jm||f},w);return(!Lm||s)&&u[au]!==m&&qw(u,au,m,{name:o}),xM[e]=m,w}});var RM=b((c$e,AM)=>{"use strict";a();AM.exports=function(t,e){return{value:t,done:e}}});var PM=b((f$e,DM)=>{"use strict";a();var JX=Gi(),YX=Rw(),XX=Ur(),QX=_r(),NM=XX("species");DM.exports=function(t){var e=JX(t);QX&&e&&!e[NM]&&YX(e,NM,{configurable:!0,get:function(){return this}})}});var qM=b((d$e,jM)=>{"use strict";a();var eQ=su(),tQ=Rw(),FM=eM(),rQ=Qc(),nQ=xw(),oQ=xa(),iQ=nu(),sQ=kM(),qm=RM(),aQ=PM(),cu=_r(),$M=vw().fastKey,LM=Tw(),MM=LM.set,Bw=LM.getterFor;jM.exports={getConstructor:function(t,e,r,n){var o=t(function(f,u){nQ(f,i),MM(f,{type:e,index:eQ(null),first:void 0,last:void 0,size:0}),cu||(f.size=0),oQ(u)||iQ(u,f[n],{that:f,AS_ENTRIES:r})}),i=o.prototype,s=Bw(e),l=function(f,u,d){var m=s(f),h=c(f,u),y,w;return h?h.value=d:(m.last=h={index:w=$M(u,!0),key:u,value:d,previous:y=m.last,next:void 0,removed:!1},m.first||(m.first=h),y&&(y.next=h),cu?m.size++:f.size++,w!=="F"&&(m.index[w]=h)),f},c=function(f,u){var d=s(f),m=$M(u),h;if(m!=="F")return d.index[m];for(h=d.first;h;h=h.next)if(h.key===u)return h};return FM(i,{clear:function(){for(var u=this,d=s(u),m=d.index,h=d.first;h;)h.removed=!0,h.previous&&(h.previous=h.previous.next=void 0),delete m[h.index],h=h.next;d.first=d.last=void 0,cu?d.size=0:u.size=0},delete:function(f){var u=this,d=s(u),m=c(u,f);if(m){var h=m.next,y=m.previous;delete d.index[m.index],m.removed=!0,y&&(y.next=h),h&&(h.previous=y),d.first===m&&(d.first=h),d.last===m&&(d.last=y),cu?d.size--:u.size--}return!!m},forEach:function(u){for(var d=s(this),m=rQ(u,arguments.length>1?arguments[1]:void 0),h;h=h?h.next:d.first;)for(m(h.value,h.key,this);h&&h.removed;)h=h.previous},has:function(u){return!!c(this,u)}}),FM(i,r?{get:function(u){var d=c(this,u);return d&&d.value},set:function(u,d){return l(this,u===0?0:u,d)}}:{add:function(u){return l(this,u=u===0?0:u,u)}}),cu&&tQ(i,"size",{configurable:!0,get:function(){return s(this).size}}),o},setStrong:function(t,e,r){var n=e+" Iterator",o=Bw(e),i=Bw(n);sQ(t,e,function(s,l){MM(this,{type:n,target:s,state:o(s),kind:l,last:void 0})},function(){for(var s=i(this),l=s.kind,c=s.last;c&&c.removed;)c=c.previous;return!s.target||!(s.last=c=c?c.next:s.state.first)?(s.target=void 0,qm(void 0,!0)):qm(l==="keys"?c.key:l==="values"?c.value:[c.key,c.value],!1)},r?"entries":"values",!r,!0),aQ(e)}}});var BM=b(()=>{"use strict";a();var lQ=M$(),cQ=qM();lQ("Map",function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},cQ)});var zM=b(()=>{"use strict";a();BM()});var WM=b((x$e,UM)=>{"use strict";a();UM.exports=function(t,e){return e===1?function(r,n){return r[t](n)}:function(r,n,o){return r[t](n,o)}}});var VM=b((S$e,KM)=>{"use strict";a();var uQ=Gi(),Bm=WM(),HM=uQ("Map");KM.exports={Map:HM,set:Bm("set",2),get:Bm("get",1),has:Bm("has",1),remove:Bm("delete",1),proto:HM.prototype}});var GM=b(()=>{"use strict";a();var fQ=Yi(),pQ=Tt(),dQ=Zi(),mQ=Gc(),hQ=nu(),zm=VM(),gQ=Jc(),yQ=zm.Map,bQ=zm.has,vQ=zm.get,wQ=zm.set,xQ=pQ([].push);fQ({target:"Map",stat:!0,forced:gQ},{groupBy:function(e,r){mQ(e),dQ(r);var n=new yQ,o=0;return hQ(e,function(i){var s=r(i,o++);bQ(n,s)?xQ(vQ(n,s),i):wQ(n,s,[i])}),n}})});var YM=b((C$e,JM)=>{"use strict";a();zM();GM();var EQ=Zn(),SQ=st(),IQ=Zc(),ZM=IQ.Map,_Q=ZM.groupBy;JM.exports=function(e,r,n){return EQ(_Q,SQ(this)?this:ZM,e,r,n)}});var QM=b((A$e,XM)=>{"use strict";a();var OQ=YM();XM.exports=OQ});var e2=b(()=>{"use strict";a();var TQ=Yi(),CQ=_r(),kQ=su();TQ({target:"Object",stat:!0,sham:!CQ},{create:kQ})});var t2=b(()=>{"use strict";a();var AQ=Yi(),RQ=Gi(),NQ=Tt(),DQ=Zi(),PQ=Gc(),FQ=Yc(),$Q=nu(),MQ=RQ("Object","create"),LQ=NQ([].push);AQ({target:"Object",stat:!0},{groupBy:function(e,r){PQ(e),DQ(r);var n=MQ(null),o=0;return $Q(e,function(i){var s=FQ(r(i,o++));s in n?LQ(n[s],i):n[s]=[i]}),n}})});var n2=b((L$e,r2)=>{"use strict";a();e2();t2();var jQ=Zc();r2.exports=jQ.Object.groupBy});var i2=b((q$e,o2)=>{"use strict";a();var qQ=n2();o2.exports=qQ});var _2=b(I2=>{"use strict";a();var Ca=(_(),zg(Pr));function nee(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var oee=typeof Object.is=="function"?Object.is:nee,iee=Ca.useState,see=Ca.useEffect,aee=Ca.useLayoutEffect,lee=Ca.useDebugValue;function cee(t,e){var r=e(),n=iee({inst:{value:r,getSnapshot:e}}),o=n[0].inst,i=n[1];return aee(function(){o.value=r,o.getSnapshot=e,sx(o)&&i({inst:o})},[t,r,e]),see(function(){return sx(o)&&i({inst:o}),t(function(){sx(o)&&i({inst:o})})},[t]),lee(r),r}function sx(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!oee(t,r)}catch{return!0}}function uee(t,e){return e()}var fee=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?uee:cee;I2.useSyncExternalStore=Ca.useSyncExternalStore!==void 0?Ca.useSyncExternalStore:fee});var T2=b((VLe,O2)=>{"use strict";a();O2.exports=_2()});var k2=b(C2=>{"use strict";a();var th=(_(),zg(Pr)),pee=T2();function dee(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var mee=typeof Object.is=="function"?Object.is:dee,hee=pee.useSyncExternalStore,gee=th.useRef,yee=th.useEffect,bee=th.useMemo,vee=th.useDebugValue;C2.useSyncExternalStoreWithSelector=function(t,e,r,n,o){var i=gee(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=bee(function(){function c(h){if(!f){if(f=!0,u=h,h=n(h),o!==void 0&&s.hasValue){var y=s.value;if(o(y,h))return d=y}return d=h}if(y=d,mee(u,h))return y;var w=n(h);return o!==void 0&&o(y,w)?y:(u=h,d=w)}var f=!1,u,d,m=r===void 0?null:r;return[function(){return c(e())},m===null?void 0:function(){return c(m())}]},[e,r,n,o]);var l=hee(t,i[0],i[1]);return yee(function(){s.hasValue=!0,s.value=l},[l]),vee(l),l}});var R2=b((YLe,A2)=>{"use strict";a();A2.exports=k2()});var Jo=b((YUe,to)=>{a();function Mx(){return to.exports=Mx=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},to.exports.__esModule=!0,to.exports.default=to.exports,Mx.apply(this,arguments)}to.exports=Mx,to.exports.__esModule=!0,to.exports.default=to.exports});var xh=b((q8e,ro)=>{a();function Hx(t){return ro.exports=Hx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ro.exports.__esModule=!0,ro.exports.default=ro.exports,Hx(t)}ro.exports=Hx,ro.exports.__esModule=!0,ro.exports.default=ro.exports});var kj=b((z8e,Cu)=>{a();var Cj=xh().default;function ine(t,e){if(Cj(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Cj(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}Cu.exports=ine,Cu.exports.__esModule=!0,Cu.exports.default=Cu.exports});var Aj=b((W8e,ku)=>{a();var sne=xh().default,ane=kj();function lne(t){var e=ane(t,"string");return sne(e)==="symbol"?e:String(e)}ku.exports=lne,ku.exports.__esModule=!0,ku.exports.default=ku.exports});var Rj=b((K8e,Au)=>{a();var cne=Aj();function une(t,e,r){return e=cne(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}Au.exports=une,Au.exports.__esModule=!0,Au.exports.default=Au.exports});var Nj=b((G8e,Ru)=>{a();function fne(t){if(Array.isArray(t))return t}Ru.exports=fne,Ru.exports.__esModule=!0,Ru.exports.default=Ru.exports});var Dj=b((J8e,Nu)=>{a();function pne(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,o,i,s,l=[],c=!0,f=!1;try{if(i=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(u){f=!0,o=u}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(f)throw o}}return l}}Nu.exports=pne,Nu.exports.__esModule=!0,Nu.exports.default=Nu.exports});var Pj=b((X8e,Du)=>{a();function dne(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}Du.exports=dne,Du.exports.__esModule=!0,Du.exports.default=Du.exports});var $j=b((eWe,Pu)=>{a();var Fj=Pj();function mne(t,e){if(t){if(typeof t=="string")return Fj(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Fj(t,e)}}Pu.exports=mne,Pu.exports.__esModule=!0,Pu.exports.default=Pu.exports});var Mj=b((rWe,Fu)=>{a();function hne(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}Fu.exports=hne,Fu.exports.__esModule=!0,Fu.exports.default=Fu.exports});var Lj=b((oWe,$u)=>{a();var gne=Nj(),yne=Dj(),bne=$j(),vne=Mj();function wne(t,e){return gne(t)||yne(t,e)||bne(t,e)||vne()}$u.exports=wne,$u.exports.__esModule=!0,$u.exports.default=$u.exports});var qj=b((Eh,jj)=>{"use strict";a();Eh.__esModule=!0;Eh.default={scheme:"threezerotwofour",author:"jan t. sott (http://github.com/idleberg)",base00:"#090300",base01:"#3a3432",base02:"#4a4543",base03:"#5c5855",base04:"#807d7c",base05:"#a5a2a2",base06:"#d6d5d4",base07:"#f7f7f7",base08:"#db2d20",base09:"#e8bbd0",base0A:"#fded02",base0B:"#01a252",base0C:"#b5e4f4",base0D:"#01a0e4",base0E:"#a16a94",base0F:"#cdab53"};jj.exports=Eh.default});var zj=b((Sh,Bj)=>{"use strict";a();Sh.__esModule=!0;Sh.default={scheme:"apathy",author:"jannik siebert (https://github.com/janniks)",base00:"#031A16",base01:"#0B342D",base02:"#184E45",base03:"#2B685E",base04:"#5F9C92",base05:"#81B5AC",base06:"#A7CEC8",base07:"#D2E7E4",base08:"#3E9688",base09:"#3E7996",base0A:"#3E4C96",base0B:"#883E96",base0C:"#963E4C",base0D:"#96883E",base0E:"#4C963E",base0F:"#3E965B"};Bj.exports=Sh.default});var Wj=b((Ih,Uj)=>{"use strict";a();Ih.__esModule=!0;Ih.default={scheme:"ashes",author:"jannik siebert (https://github.com/janniks)",base00:"#1C2023",base01:"#393F45",base02:"#565E65",base03:"#747C84",base04:"#ADB3BA",base05:"#C7CCD1",base06:"#DFE2E5",base07:"#F3F4F5",base08:"#C7AE95",base09:"#C7C795",base0A:"#AEC795",base0B:"#95C7AE",base0C:"#95AEC7",base0D:"#AE95C7",base0E:"#C795AE",base0F:"#C79595"};Uj.exports=Ih.default});var Kj=b((_h,Hj)=>{"use strict";a();_h.__esModule=!0;_h.default={scheme:"atelier dune",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/dune)",base00:"#20201d",base01:"#292824",base02:"#6e6b5e",base03:"#7d7a68",base04:"#999580",base05:"#a6a28c",base06:"#e8e4cf",base07:"#fefbec",base08:"#d73737",base09:"#b65611",base0A:"#cfb017",base0B:"#60ac39",base0C:"#1fad83",base0D:"#6684e1",base0E:"#b854d4",base0F:"#d43552"};Hj.exports=_h.default});var Gj=b((Oh,Vj)=>{"use strict";a();Oh.__esModule=!0;Oh.default={scheme:"atelier forest",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/forest)",base00:"#1b1918",base01:"#2c2421",base02:"#68615e",base03:"#766e6b",base04:"#9c9491",base05:"#a8a19f",base06:"#e6e2e0",base07:"#f1efee",base08:"#f22c40",base09:"#df5320",base0A:"#d5911a",base0B:"#5ab738",base0C:"#00ad9c",base0D:"#407ee7",base0E:"#6666ea",base0F:"#c33ff3"};Vj.exports=Oh.default});var Jj=b((Th,Zj)=>{"use strict";a();Th.__esModule=!0;Th.default={scheme:"atelier heath",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/heath)",base00:"#1b181b",base01:"#292329",base02:"#695d69",base03:"#776977",base04:"#9e8f9e",base05:"#ab9bab",base06:"#d8cad8",base07:"#f7f3f7",base08:"#ca402b",base09:"#a65926",base0A:"#bb8a35",base0B:"#379a37",base0C:"#159393",base0D:"#516aec",base0E:"#7b59c0",base0F:"#cc33cc"};Zj.exports=Th.default});var Xj=b((Ch,Yj)=>{"use strict";a();Ch.__esModule=!0;Ch.default={scheme:"atelier lakeside",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/lakeside/)",base00:"#161b1d",base01:"#1f292e",base02:"#516d7b",base03:"#5a7b8c",base04:"#7195a8",base05:"#7ea2b4",base06:"#c1e4f6",base07:"#ebf8ff",base08:"#d22d72",base09:"#935c25",base0A:"#8a8a0f",base0B:"#568c3b",base0C:"#2d8f6f",base0D:"#257fad",base0E:"#5d5db1",base0F:"#b72dd2"};Yj.exports=Ch.default});var e5=b((kh,Qj)=>{"use strict";a();kh.__esModule=!0;kh.default={scheme:"atelier seaside",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/seaside/)",base00:"#131513",base01:"#242924",base02:"#5e6e5e",base03:"#687d68",base04:"#809980",base05:"#8ca68c",base06:"#cfe8cf",base07:"#f0fff0",base08:"#e6193c",base09:"#87711d",base0A:"#c3c322",base0B:"#29a329",base0C:"#1999b3",base0D:"#3d62f5",base0E:"#ad2bee",base0F:"#e619c3"};Qj.exports=kh.default});var r5=b((Ah,t5)=>{"use strict";a();Ah.__esModule=!0;Ah.default={scheme:"bespin",author:"jan t. sott",base00:"#28211c",base01:"#36312e",base02:"#5e5d5c",base03:"#666666",base04:"#797977",base05:"#8a8986",base06:"#9d9b97",base07:"#baae9e",base08:"#cf6a4c",base09:"#cf7d34",base0A:"#f9ee98",base0B:"#54be0d",base0C:"#afc4db",base0D:"#5ea6ea",base0E:"#9b859d",base0F:"#937121"};t5.exports=Ah.default});var o5=b((Rh,n5)=>{"use strict";a();Rh.__esModule=!0;Rh.default={scheme:"brewer",author:"timoth\xE9e poisot (http://github.com/tpoisot)",base00:"#0c0d0e",base01:"#2e2f30",base02:"#515253",base03:"#737475",base04:"#959697",base05:"#b7b8b9",base06:"#dadbdc",base07:"#fcfdfe",base08:"#e31a1c",base09:"#e6550d",base0A:"#dca060",base0B:"#31a354",base0C:"#80b1d3",base0D:"#3182bd",base0E:"#756bb1",base0F:"#b15928"};n5.exports=Rh.default});var s5=b((Nh,i5)=>{"use strict";a();Nh.__esModule=!0;Nh.default={scheme:"bright",author:"chris kempson (http://chriskempson.com)",base00:"#000000",base01:"#303030",base02:"#505050",base03:"#b0b0b0",base04:"#d0d0d0",base05:"#e0e0e0",base06:"#f5f5f5",base07:"#ffffff",base08:"#fb0120",base09:"#fc6d24",base0A:"#fda331",base0B:"#a1c659",base0C:"#76c7b7",base0D:"#6fb3d2",base0E:"#d381c3",base0F:"#be643c"};i5.exports=Nh.default});var l5=b((Dh,a5)=>{"use strict";a();Dh.__esModule=!0;Dh.default={scheme:"chalk",author:"chris kempson (http://chriskempson.com)",base00:"#151515",base01:"#202020",base02:"#303030",base03:"#505050",base04:"#b0b0b0",base05:"#d0d0d0",base06:"#e0e0e0",base07:"#f5f5f5",base08:"#fb9fb1",base09:"#eda987",base0A:"#ddb26f",base0B:"#acc267",base0C:"#12cfc0",base0D:"#6fc2ef",base0E:"#e1a3ee",base0F:"#deaf8f"};a5.exports=Dh.default});var u5=b((Ph,c5)=>{"use strict";a();Ph.__esModule=!0;Ph.default={scheme:"codeschool",author:"brettof86",base00:"#232c31",base01:"#1c3657",base02:"#2a343a",base03:"#3f4944",base04:"#84898c",base05:"#9ea7a6",base06:"#a7cfa3",base07:"#b5d8f6",base08:"#2a5491",base09:"#43820d",base0A:"#a03b1e",base0B:"#237986",base0C:"#b02f30",base0D:"#484d79",base0E:"#c59820",base0F:"#c98344"};c5.exports=Ph.default});var p5=b((Fh,f5)=>{"use strict";a();Fh.__esModule=!0;Fh.default={scheme:"colors",author:"mrmrs (http://clrs.cc)",base00:"#111111",base01:"#333333",base02:"#555555",base03:"#777777",base04:"#999999",base05:"#bbbbbb",base06:"#dddddd",base07:"#ffffff",base08:"#ff4136",base09:"#ff851b",base0A:"#ffdc00",base0B:"#2ecc40",base0C:"#7fdbff",base0D:"#0074d9",base0E:"#b10dc9",base0F:"#85144b"};f5.exports=Fh.default});var m5=b(($h,d5)=>{"use strict";a();$h.__esModule=!0;$h.default={scheme:"default",author:"chris kempson (http://chriskempson.com)",base00:"#181818",base01:"#282828",base02:"#383838",base03:"#585858",base04:"#b8b8b8",base05:"#d8d8d8",base06:"#e8e8e8",base07:"#f8f8f8",base08:"#ab4642",base09:"#dc9656",base0A:"#f7ca88",base0B:"#a1b56c",base0C:"#86c1b9",base0D:"#7cafc2",base0E:"#ba8baf",base0F:"#a16946"};d5.exports=$h.default});var g5=b((Mh,h5)=>{"use strict";a();Mh.__esModule=!0;Mh.default={scheme:"eighties",author:"chris kempson (http://chriskempson.com)",base00:"#2d2d2d",base01:"#393939",base02:"#515151",base03:"#747369",base04:"#a09f93",base05:"#d3d0c8",base06:"#e8e6df",base07:"#f2f0ec",base08:"#f2777a",base09:"#f99157",base0A:"#ffcc66",base0B:"#99cc99",base0C:"#66cccc",base0D:"#6699cc",base0E:"#cc99cc",base0F:"#d27b53"};h5.exports=Mh.default});var b5=b((Lh,y5)=>{"use strict";a();Lh.__esModule=!0;Lh.default={scheme:"embers",author:"jannik siebert (https://github.com/janniks)",base00:"#16130F",base01:"#2C2620",base02:"#433B32",base03:"#5A5047",base04:"#8A8075",base05:"#A39A90",base06:"#BEB6AE",base07:"#DBD6D1",base08:"#826D57",base09:"#828257",base0A:"#6D8257",base0B:"#57826D",base0C:"#576D82",base0D:"#6D5782",base0E:"#82576D",base0F:"#825757"};y5.exports=Lh.default});var w5=b((jh,v5)=>{"use strict";a();jh.__esModule=!0;jh.default={scheme:"flat",author:"chris kempson (http://chriskempson.com)",base00:"#2C3E50",base01:"#34495E",base02:"#7F8C8D",base03:"#95A5A6",base04:"#BDC3C7",base05:"#e0e0e0",base06:"#f5f5f5",base07:"#ECF0F1",base08:"#E74C3C",base09:"#E67E22",base0A:"#F1C40F",base0B:"#2ECC71",base0C:"#1ABC9C",base0D:"#3498DB",base0E:"#9B59B6",base0F:"#be643c"};v5.exports=jh.default});var E5=b((qh,x5)=>{"use strict";a();qh.__esModule=!0;qh.default={scheme:"google",author:"seth wright (http://sethawright.com)",base00:"#1d1f21",base01:"#282a2e",base02:"#373b41",base03:"#969896",base04:"#b4b7b4",base05:"#c5c8c6",base06:"#e0e0e0",base07:"#ffffff",base08:"#CC342B",base09:"#F96A38",base0A:"#FBA922",base0B:"#198844",base0C:"#3971ED",base0D:"#3971ED",base0E:"#A36AC7",base0F:"#3971ED"};x5.exports=qh.default});var I5=b((Bh,S5)=>{"use strict";a();Bh.__esModule=!0;Bh.default={scheme:"grayscale",author:"alexandre gavioli (https://github.com/alexx2/)",base00:"#101010",base01:"#252525",base02:"#464646",base03:"#525252",base04:"#ababab",base05:"#b9b9b9",base06:"#e3e3e3",base07:"#f7f7f7",base08:"#7c7c7c",base09:"#999999",base0A:"#a0a0a0",base0B:"#8e8e8e",base0C:"#868686",base0D:"#686868",base0E:"#747474",base0F:"#5e5e5e"};S5.exports=Bh.default});var O5=b((zh,_5)=>{"use strict";a();zh.__esModule=!0;zh.default={scheme:"green screen",author:"chris kempson (http://chriskempson.com)",base00:"#001100",base01:"#003300",base02:"#005500",base03:"#007700",base04:"#009900",base05:"#00bb00",base06:"#00dd00",base07:"#00ff00",base08:"#007700",base09:"#009900",base0A:"#007700",base0B:"#00bb00",base0C:"#005500",base0D:"#009900",base0E:"#00bb00",base0F:"#005500"};_5.exports=zh.default});var C5=b((Uh,T5)=>{"use strict";a();Uh.__esModule=!0;Uh.default={scheme:"harmonic16",author:"jannik siebert (https://github.com/janniks)",base00:"#0b1c2c",base01:"#223b54",base02:"#405c79",base03:"#627e99",base04:"#aabcce",base05:"#cbd6e2",base06:"#e5ebf1",base07:"#f7f9fb",base08:"#bf8b56",base09:"#bfbf56",base0A:"#8bbf56",base0B:"#56bf8b",base0C:"#568bbf",base0D:"#8b56bf",base0E:"#bf568b",base0F:"#bf5656"};T5.exports=Uh.default});var A5=b((Wh,k5)=>{"use strict";a();Wh.__esModule=!0;Wh.default={scheme:"hopscotch",author:"jan t. sott",base00:"#322931",base01:"#433b42",base02:"#5c545b",base03:"#797379",base04:"#989498",base05:"#b9b5b8",base06:"#d5d3d5",base07:"#ffffff",base08:"#dd464c",base09:"#fd8b19",base0A:"#fdcc59",base0B:"#8fc13e",base0C:"#149b93",base0D:"#1290bf",base0E:"#c85e7c",base0F:"#b33508"};k5.exports=Wh.default});var N5=b((Hh,R5)=>{"use strict";a();Hh.__esModule=!0;Hh.default={scheme:"isotope",author:"jan t. sott",base00:"#000000",base01:"#404040",base02:"#606060",base03:"#808080",base04:"#c0c0c0",base05:"#d0d0d0",base06:"#e0e0e0",base07:"#ffffff",base08:"#ff0000",base09:"#ff9900",base0A:"#ff0099",base0B:"#33ff00",base0C:"#00ffff",base0D:"#0066ff",base0E:"#cc00ff",base0F:"#3300ff"};R5.exports=Hh.default});var P5=b((Kh,D5)=>{"use strict";a();Kh.__esModule=!0;Kh.default={scheme:"marrakesh",author:"alexandre gavioli (http://github.com/alexx2/)",base00:"#201602",base01:"#302e00",base02:"#5f5b17",base03:"#6c6823",base04:"#86813b",base05:"#948e48",base06:"#ccc37a",base07:"#faf0a5",base08:"#c35359",base09:"#b36144",base0A:"#a88339",base0B:"#18974e",base0C:"#75a738",base0D:"#477ca1",base0E:"#8868b3",base0F:"#b3588e"};D5.exports=Kh.default});var $5=b((Vh,F5)=>{"use strict";a();Vh.__esModule=!0;Vh.default={scheme:"mocha",author:"chris kempson (http://chriskempson.com)",base00:"#3B3228",base01:"#534636",base02:"#645240",base03:"#7e705a",base04:"#b8afad",base05:"#d0c8c6",base06:"#e9e1dd",base07:"#f5eeeb",base08:"#cb6077",base09:"#d28b71",base0A:"#f4bc87",base0B:"#beb55b",base0C:"#7bbda4",base0D:"#8ab3b5",base0E:"#a89bb9",base0F:"#bb9584"};F5.exports=Vh.default});var L5=b((Gh,M5)=>{"use strict";a();Gh.__esModule=!0;Gh.default={scheme:"monokai",author:"wimer hazenberg (http://www.monokai.nl)",base00:"#272822",base01:"#383830",base02:"#49483e",base03:"#75715e",base04:"#a59f85",base05:"#f8f8f2",base06:"#f5f4f1",base07:"#f9f8f5",base08:"#f92672",base09:"#fd971f",base0A:"#f4bf75",base0B:"#a6e22e",base0C:"#a1efe4",base0D:"#66d9ef",base0E:"#ae81ff",base0F:"#cc6633"};M5.exports=Gh.default});var q5=b((Zh,j5)=>{"use strict";a();Zh.__esModule=!0;Zh.default={scheme:"ocean",author:"chris kempson (http://chriskempson.com)",base00:"#2b303b",base01:"#343d46",base02:"#4f5b66",base03:"#65737e",base04:"#a7adba",base05:"#c0c5ce",base06:"#dfe1e8",base07:"#eff1f5",base08:"#bf616a",base09:"#d08770",base0A:"#ebcb8b",base0B:"#a3be8c",base0C:"#96b5b4",base0D:"#8fa1b3",base0E:"#b48ead",base0F:"#ab7967"};j5.exports=Zh.default});var z5=b((Jh,B5)=>{"use strict";a();Jh.__esModule=!0;Jh.default={scheme:"paraiso",author:"jan t. sott",base00:"#2f1e2e",base01:"#41323f",base02:"#4f424c",base03:"#776e71",base04:"#8d8687",base05:"#a39e9b",base06:"#b9b6b0",base07:"#e7e9db",base08:"#ef6155",base09:"#f99b15",base0A:"#fec418",base0B:"#48b685",base0C:"#5bc4bf",base0D:"#06b6ef",base0E:"#815ba4",base0F:"#e96ba8"};B5.exports=Jh.default});var W5=b((Yh,U5)=>{"use strict";a();Yh.__esModule=!0;Yh.default={scheme:"pop",author:"chris kempson (http://chriskempson.com)",base00:"#000000",base01:"#202020",base02:"#303030",base03:"#505050",base04:"#b0b0b0",base05:"#d0d0d0",base06:"#e0e0e0",base07:"#ffffff",base08:"#eb008a",base09:"#f29333",base0A:"#f8ca12",base0B:"#37b349",base0C:"#00aabb",base0D:"#0e5a94",base0E:"#b31e8d",base0F:"#7a2d00"};U5.exports=Yh.default});var K5=b((Xh,H5)=>{"use strict";a();Xh.__esModule=!0;Xh.default={scheme:"railscasts",author:"ryan bates (http://railscasts.com)",base00:"#2b2b2b",base01:"#272935",base02:"#3a4055",base03:"#5a647e",base04:"#d4cfc9",base05:"#e6e1dc",base06:"#f4f1ed",base07:"#f9f7f3",base08:"#da4939",base09:"#cc7833",base0A:"#ffc66d",base0B:"#a5c261",base0C:"#519f50",base0D:"#6d9cbe",base0E:"#b6b3eb",base0F:"#bc9458"};H5.exports=Xh.default});var G5=b((Qh,V5)=>{"use strict";a();Qh.__esModule=!0;Qh.default={scheme:"shapeshifter",author:"tyler benziger (http://tybenz.com)",base00:"#000000",base01:"#040404",base02:"#102015",base03:"#343434",base04:"#555555",base05:"#ababab",base06:"#e0e0e0",base07:"#f9f9f9",base08:"#e92f2f",base09:"#e09448",base0A:"#dddd13",base0B:"#0ed839",base0C:"#23edda",base0D:"#3b48e3",base0E:"#f996e2",base0F:"#69542d"};V5.exports=Qh.default});var J5=b((eg,Z5)=>{"use strict";a();eg.__esModule=!0;eg.default={scheme:"solarized",author:"ethan schoonover (http://ethanschoonover.com/solarized)",base00:"#002b36",base01:"#073642",base02:"#586e75",base03:"#657b83",base04:"#839496",base05:"#93a1a1",base06:"#eee8d5",base07:"#fdf6e3",base08:"#dc322f",base09:"#cb4b16",base0A:"#b58900",base0B:"#859900",base0C:"#2aa198",base0D:"#268bd2",base0E:"#6c71c4",base0F:"#d33682"};Z5.exports=eg.default});var X5=b((tg,Y5)=>{"use strict";a();tg.__esModule=!0;tg.default={scheme:"summerfruit",author:"christopher corley (http://cscorley.github.io/)",base00:"#151515",base01:"#202020",base02:"#303030",base03:"#505050",base04:"#B0B0B0",base05:"#D0D0D0",base06:"#E0E0E0",base07:"#FFFFFF",base08:"#FF0086",base09:"#FD8900",base0A:"#ABA800",base0B:"#00C918",base0C:"#1faaaa",base0D:"#3777E6",base0E:"#AD00A1",base0F:"#cc6633"};Y5.exports=tg.default});var e3=b((rg,Q5)=>{"use strict";a();rg.__esModule=!0;rg.default={scheme:"tomorrow",author:"chris kempson (http://chriskempson.com)",base00:"#1d1f21",base01:"#282a2e",base02:"#373b41",base03:"#969896",base04:"#b4b7b4",base05:"#c5c8c6",base06:"#e0e0e0",base07:"#ffffff",base08:"#cc6666",base09:"#de935f",base0A:"#f0c674",base0B:"#b5bd68",base0C:"#8abeb7",base0D:"#81a2be",base0E:"#b294bb",base0F:"#a3685a"};Q5.exports=rg.default});var r3=b((ng,t3)=>{"use strict";a();ng.__esModule=!0;ng.default={scheme:"london tube",author:"jan t. sott",base00:"#231f20",base01:"#1c3f95",base02:"#5a5758",base03:"#737171",base04:"#959ca1",base05:"#d9d8d8",base06:"#e7e7e8",base07:"#ffffff",base08:"#ee2e24",base09:"#f386a1",base0A:"#ffd204",base0B:"#00853e",base0C:"#85cebc",base0D:"#009ddc",base0E:"#98005d",base0F:"#b06110"};t3.exports=ng.default});var o3=b((og,n3)=>{"use strict";a();og.__esModule=!0;og.default={scheme:"twilight",author:"david hart (http://hart-dev.com)",base00:"#1e1e1e",base01:"#323537",base02:"#464b50",base03:"#5f5a60",base04:"#838184",base05:"#a7a7a7",base06:"#c3c3c3",base07:"#ffffff",base08:"#cf6a4c",base09:"#cda869",base0A:"#f9ee98",base0B:"#8f9d6a",base0C:"#afc4db",base0D:"#7587a6",base0E:"#9b859d",base0F:"#9b703f"};n3.exports=og.default});var i3=b(ce=>{"use strict";a();ce.__esModule=!0;function ue(t){return t&&t.__esModule?t.default:t}var xne=qj();ce.threezerotwofour=ue(xne);var Ene=zj();ce.apathy=ue(Ene);var Sne=Wj();ce.ashes=ue(Sne);var Ine=Kj();ce.atelierDune=ue(Ine);var _ne=Gj();ce.atelierForest=ue(_ne);var One=Jj();ce.atelierHeath=ue(One);var Tne=Xj();ce.atelierLakeside=ue(Tne);var Cne=e5();ce.atelierSeaside=ue(Cne);var kne=r5();ce.bespin=ue(kne);var Ane=o5();ce.brewer=ue(Ane);var Rne=s5();ce.bright=ue(Rne);var Nne=l5();ce.chalk=ue(Nne);var Dne=u5();ce.codeschool=ue(Dne);var Pne=p5();ce.colors=ue(Pne);var Fne=m5();ce.default=ue(Fne);var $ne=g5();ce.eighties=ue($ne);var Mne=b5();ce.embers=ue(Mne);var Lne=w5();ce.flat=ue(Lne);var jne=E5();ce.google=ue(jne);var qne=I5();ce.grayscale=ue(qne);var Bne=O5();ce.greenscreen=ue(Bne);var zne=C5();ce.harmonic=ue(zne);var Une=A5();ce.hopscotch=ue(Une);var Wne=N5();ce.isotope=ue(Wne);var Hne=P5();ce.marrakesh=ue(Hne);var Kne=$5();ce.mocha=ue(Kne);var Vne=L5();ce.monokai=ue(Vne);var Gne=q5();ce.ocean=ue(Gne);var Zne=z5();ce.paraiso=ue(Zne);var Jne=W5();ce.pop=ue(Jne);var Yne=K5();ce.railscasts=ue(Yne);var Xne=G5();ce.shapeshifter=ue(Xne);var Qne=J5();ce.solarized=ue(Qne);var eoe=X5();ce.summerfruit=ue(eoe);var toe=e3();ce.tomorrow=ue(toe);var roe=r3();ce.tube=ue(roe);var noe=o3();ce.twilight=ue(noe)});var a3=b((HWe,s3)=>{"use strict";a();s3.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var c3=b((VWe,l3)=>{a();l3.exports=function(e){return!e||typeof e=="string"?!1:e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&e.constructor.name!=="String")}});var p3=b((ZWe,f3)=>{"use strict";a();var ooe=c3(),ioe=Array.prototype.concat,soe=Array.prototype.slice,u3=f3.exports=function(e){for(var r=[],n=0,o=e.length;n<o;n++){var i=e[n];ooe(i)?r=ioe.call(r,soe.call(i)):r.push(i)}return r};u3.wrap=function(t){return function(){return t(u3(arguments))}}});var g3=b((YWe,h3)=>{a();var Mu=a3(),Lu=p3(),d3=Object.hasOwnProperty,m3=Object.create(null);for(ig in Mu)d3.call(Mu,ig)&&(m3[Mu[ig]]=ig);var ig,nr=h3.exports={to:{},get:{}};nr.get=function(t){var e=t.substring(0,3).toLowerCase(),r,n;switch(e){case"hsl":r=nr.get.hsl(t),n="hsl";break;case"hwb":r=nr.get.hwb(t),n="hwb";break;default:r=nr.get.rgb(t),n="rgb";break}return r?{model:n,value:r}:null};nr.get.rgb=function(t){if(!t)return null;var e=/^#([a-f0-9]{3,4})$/i,r=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,n=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,o=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,i=/^(\w+)$/,s=[0,0,0,1],l,c,f;if(l=t.match(r)){for(f=l[2],l=l[1],c=0;c<3;c++){var u=c*2;s[c]=parseInt(l.slice(u,u+2),16)}f&&(s[3]=parseInt(f,16)/255)}else if(l=t.match(e)){for(l=l[1],f=l[3],c=0;c<3;c++)s[c]=parseInt(l[c]+l[c],16);f&&(s[3]=parseInt(f+f,16)/255)}else if(l=t.match(n)){for(c=0;c<3;c++)s[c]=parseInt(l[c+1],0);l[4]&&(l[5]?s[3]=parseFloat(l[4])*.01:s[3]=parseFloat(l[4]))}else if(l=t.match(o)){for(c=0;c<3;c++)s[c]=Math.round(parseFloat(l[c+1])*2.55);l[4]&&(l[5]?s[3]=parseFloat(l[4])*.01:s[3]=parseFloat(l[4]))}else return(l=t.match(i))?l[1]==="transparent"?[0,0,0,0]:d3.call(Mu,l[1])?(s=Mu[l[1]],s[3]=1,s):null:null;for(c=0;c<3;c++)s[c]=Xo(s[c],0,255);return s[3]=Xo(s[3],0,1),s};nr.get.hsl=function(t){if(!t)return null;var e=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,r=t.match(e);if(r){var n=parseFloat(r[4]),o=(parseFloat(r[1])%360+360)%360,i=Xo(parseFloat(r[2]),0,100),s=Xo(parseFloat(r[3]),0,100),l=Xo(isNaN(n)?1:n,0,1);return[o,i,s,l]}return null};nr.get.hwb=function(t){if(!t)return null;var e=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,r=t.match(e);if(r){var n=parseFloat(r[4]),o=(parseFloat(r[1])%360+360)%360,i=Xo(parseFloat(r[2]),0,100),s=Xo(parseFloat(r[3]),0,100),l=Xo(isNaN(n)?1:n,0,1);return[o,i,s,l]}return null};nr.to.hex=function(){var t=Lu(arguments);return"#"+sg(t[0])+sg(t[1])+sg(t[2])+(t[3]<1?sg(Math.round(t[3]*255)):"")};nr.to.rgb=function(){var t=Lu(arguments);return t.length<4||t[3]===1?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"};nr.to.rgb.percent=function(){var t=Lu(arguments),e=Math.round(t[0]/255*100),r=Math.round(t[1]/255*100),n=Math.round(t[2]/255*100);return t.length<4||t[3]===1?"rgb("+e+"%, "+r+"%, "+n+"%)":"rgba("+e+"%, "+r+"%, "+n+"%, "+t[3]+")"};nr.to.hsl=function(){var t=Lu(arguments);return t.length<4||t[3]===1?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"};nr.to.hwb=function(){var t=Lu(arguments),e="";return t.length>=4&&t[3]!==1&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"};nr.to.keyword=function(t){return m3[t.slice(0,3)]};function Xo(t,e,r){return Math.min(Math.max(e,t),r)}function sg(t){var e=Math.round(t).toString(16).toUpperCase();return e.length<2?"0"+e:e}});var b3=b((QWe,y3)=>{"use strict";a();y3.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var Kx=b((t7e,E3)=>{a();var cs=b3(),x3={};for(ag in cs)cs.hasOwnProperty(ag)&&(x3[cs[ag]]=ag);var ag,B=E3.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(kt in B)if(B.hasOwnProperty(kt)){if(!("channels"in B[kt]))throw new Error("missing channels property: "+kt);if(!("labels"in B[kt]))throw new Error("missing channel labels property: "+kt);if(B[kt].labels.length!==B[kt].channels)throw new Error("channel and label counts mismatch: "+kt);v3=B[kt].channels,w3=B[kt].labels,delete B[kt].channels,delete B[kt].labels,Object.defineProperty(B[kt],"channels",{value:v3}),Object.defineProperty(B[kt],"labels",{value:w3})}var v3,w3,kt;B.rgb.hsl=function(t){var e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.min(e,r,n),i=Math.max(e,r,n),s=i-o,l,c,f;return i===o?l=0:e===i?l=(r-n)/s:r===i?l=2+(n-e)/s:n===i&&(l=4+(e-r)/s),l=Math.min(l*60,360),l<0&&(l+=360),f=(o+i)/2,i===o?c=0:f<=.5?c=s/(i+o):c=s/(2-i-o),[l,c*100,f*100]};B.rgb.hsv=function(t){var e,r,n,o,i,s=t[0]/255,l=t[1]/255,c=t[2]/255,f=Math.max(s,l,c),u=f-Math.min(s,l,c),d=function(m){return(f-m)/6/u+1/2};return u===0?o=i=0:(i=u/f,e=d(s),r=d(l),n=d(c),s===f?o=n-r:l===f?o=1/3+e-n:c===f&&(o=2/3+r-e),o<0?o+=1:o>1&&(o-=1)),[o*360,i*100,f*100]};B.rgb.hwb=function(t){var e=t[0],r=t[1],n=t[2],o=B.rgb.hsl(t)[0],i=1/255*Math.min(e,Math.min(r,n));return n=1-1/255*Math.max(e,Math.max(r,n)),[o,i*100,n*100]};B.rgb.cmyk=function(t){var e=t[0]/255,r=t[1]/255,n=t[2]/255,o,i,s,l;return l=Math.min(1-e,1-r,1-n),o=(1-e-l)/(1-l)||0,i=(1-r-l)/(1-l)||0,s=(1-n-l)/(1-l)||0,[o*100,i*100,s*100,l*100]};function aoe(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)+Math.pow(t[2]-e[2],2)}B.rgb.keyword=function(t){var e=x3[t];if(e)return e;var r=1/0,n;for(var o in cs)if(cs.hasOwnProperty(o)){var i=cs[o],s=aoe(t,i);s<r&&(r=s,n=o)}return n};B.keyword.rgb=function(t){return cs[t]};B.rgb.xyz=function(t){var e=t[0]/255,r=t[1]/255,n=t[2]/255;e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92,n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92;var o=e*.4124+r*.3576+n*.1805,i=e*.2126+r*.7152+n*.0722,s=e*.0193+r*.1192+n*.9505;return[o*100,i*100,s*100]};B.rgb.lab=function(t){var e=B.rgb.xyz(t),r=e[0],n=e[1],o=e[2],i,s,l;return r/=95.047,n/=100,o/=108.883,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,o=o>.008856?Math.pow(o,1/3):7.787*o+16/116,i=116*n-16,s=500*(r-n),l=200*(n-o),[i,s,l]};B.hsl.rgb=function(t){var e=t[0]/360,r=t[1]/100,n=t[2]/100,o,i,s,l,c;if(r===0)return c=n*255,[c,c,c];n<.5?i=n*(1+r):i=n+r-n*r,o=2*n-i,l=[0,0,0];for(var f=0;f<3;f++)s=e+1/3*-(f-1),s<0&&s++,s>1&&s--,6*s<1?c=o+(i-o)*6*s:2*s<1?c=i:3*s<2?c=o+(i-o)*(2/3-s)*6:c=o,l[f]=c*255;return l};B.hsl.hsv=function(t){var e=t[0],r=t[1]/100,n=t[2]/100,o=r,i=Math.max(n,.01),s,l;return n*=2,r*=n<=1?n:2-n,o*=i<=1?i:2-i,l=(n+r)/2,s=n===0?2*o/(i+o):2*r/(n+r),[e,s*100,l*100]};B.hsv.rgb=function(t){var e=t[0]/60,r=t[1]/100,n=t[2]/100,o=Math.floor(e)%6,i=e-Math.floor(e),s=255*n*(1-r),l=255*n*(1-r*i),c=255*n*(1-r*(1-i));switch(n*=255,o){case 0:return[n,c,s];case 1:return[l,n,s];case 2:return[s,n,c];case 3:return[s,l,n];case 4:return[c,s,n];case 5:return[n,s,l]}};B.hsv.hsl=function(t){var e=t[0],r=t[1]/100,n=t[2]/100,o=Math.max(n,.01),i,s,l;return l=(2-r)*n,i=(2-r)*o,s=r*o,s/=i<=1?i:2-i,s=s||0,l/=2,[e,s*100,l*100]};B.hwb.rgb=function(t){var e=t[0]/360,r=t[1]/100,n=t[2]/100,o=r+n,i,s,l,c;o>1&&(r/=o,n/=o),i=Math.floor(6*e),s=1-n,l=6*e-i,i&1&&(l=1-l),c=r+l*(s-r);var f,u,d;switch(i){default:case 6:case 0:f=s,u=c,d=r;break;case 1:f=c,u=s,d=r;break;case 2:f=r,u=s,d=c;break;case 3:f=r,u=c,d=s;break;case 4:f=c,u=r,d=s;break;case 5:f=s,u=r,d=c;break}return[f*255,u*255,d*255]};B.cmyk.rgb=function(t){var e=t[0]/100,r=t[1]/100,n=t[2]/100,o=t[3]/100,i,s,l;return i=1-Math.min(1,e*(1-o)+o),s=1-Math.min(1,r*(1-o)+o),l=1-Math.min(1,n*(1-o)+o),[i*255,s*255,l*255]};B.xyz.rgb=function(t){var e=t[0]/100,r=t[1]/100,n=t[2]/100,o,i,s;return o=e*3.2406+r*-1.5372+n*-.4986,i=e*-.9689+r*1.8758+n*.0415,s=e*.0557+r*-.204+n*1.057,o=o>.0031308?1.055*Math.pow(o,1/2.4)-.055:o*12.92,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*12.92,s=s>.0031308?1.055*Math.pow(s,1/2.4)-.055:s*12.92,o=Math.min(Math.max(0,o),1),i=Math.min(Math.max(0,i),1),s=Math.min(Math.max(0,s),1),[o*255,i*255,s*255]};B.xyz.lab=function(t){var e=t[0],r=t[1],n=t[2],o,i,s;return e/=95.047,r/=100,n/=108.883,e=e>.008856?Math.pow(e,1/3):7.787*e+16/116,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,o=116*r-16,i=500*(e-r),s=200*(r-n),[o,i,s]};B.lab.xyz=function(t){var e=t[0],r=t[1],n=t[2],o,i,s;i=(e+16)/116,o=r/500+i,s=i-n/200;var l=Math.pow(i,3),c=Math.pow(o,3),f=Math.pow(s,3);return i=l>.008856?l:(i-16/116)/7.787,o=c>.008856?c:(o-16/116)/7.787,s=f>.008856?f:(s-16/116)/7.787,o*=95.047,i*=100,s*=108.883,[o,i,s]};B.lab.lch=function(t){var e=t[0],r=t[1],n=t[2],o,i,s;return o=Math.atan2(n,r),i=o*360/2/Math.PI,i<0&&(i+=360),s=Math.sqrt(r*r+n*n),[e,s,i]};B.lch.lab=function(t){var e=t[0],r=t[1],n=t[2],o,i,s;return s=n/360*2*Math.PI,o=r*Math.cos(s),i=r*Math.sin(s),[e,o,i]};B.rgb.ansi16=function(t){var e=t[0],r=t[1],n=t[2],o=1 in arguments?arguments[1]:B.rgb.hsv(t)[2];if(o=Math.round(o/50),o===0)return 30;var i=30+(Math.round(n/255)<<2|Math.round(r/255)<<1|Math.round(e/255));return o===2&&(i+=60),i};B.hsv.ansi16=function(t){return B.rgb.ansi16(B.hsv.rgb(t),t[2])};B.rgb.ansi256=function(t){var e=t[0],r=t[1],n=t[2];if(e===r&&r===n)return e<8?16:e>248?231:Math.round((e-8)/247*24)+232;var o=16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5);return o};B.ansi16.rgb=function(t){var e=t%10;if(e===0||e===7)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];var r=(~~(t>50)+1)*.5,n=(e&1)*r*255,o=(e>>1&1)*r*255,i=(e>>2&1)*r*255;return[n,o,i]};B.ansi256.rgb=function(t){if(t>=232){var e=(t-232)*10+8;return[e,e,e]}t-=16;var r,n=Math.floor(t/36)/5*255,o=Math.floor((r=t%36)/6)/5*255,i=r%6/5*255;return[n,o,i]};B.rgb.hex=function(t){var e=((Math.round(t[0])&255)<<16)+((Math.round(t[1])&255)<<8)+(Math.round(t[2])&255),r=e.toString(16).toUpperCase();return"000000".substring(r.length)+r};B.hex.rgb=function(t){var e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];var r=e[0];e[0].length===3&&(r=r.split("").map(function(l){return l+l}).join(""));var n=parseInt(r,16),o=n>>16&255,i=n>>8&255,s=n&255;return[o,i,s]};B.rgb.hcg=function(t){var e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.max(Math.max(e,r),n),i=Math.min(Math.min(e,r),n),s=o-i,l,c;return s<1?l=i/(1-s):l=0,s<=0?c=0:o===e?c=(r-n)/s%6:o===r?c=2+(n-e)/s:c=4+(e-r)/s+4,c/=6,c%=1,[c*360,s*100,l*100]};B.hsl.hcg=function(t){var e=t[1]/100,r=t[2]/100,n=1,o=0;return r<.5?n=2*e*r:n=2*e*(1-r),n<1&&(o=(r-.5*n)/(1-n)),[t[0],n*100,o*100]};B.hsv.hcg=function(t){var e=t[1]/100,r=t[2]/100,n=e*r,o=0;return n<1&&(o=(r-n)/(1-n)),[t[0],n*100,o*100]};B.hcg.rgb=function(t){var e=t[0]/360,r=t[1]/100,n=t[2]/100;if(r===0)return[n*255,n*255,n*255];var o=[0,0,0],i=e%1*6,s=i%1,l=1-s,c=0;switch(Math.floor(i)){case 0:o[0]=1,o[1]=s,o[2]=0;break;case 1:o[0]=l,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=s;break;case 3:o[0]=0,o[1]=l,o[2]=1;break;case 4:o[0]=s,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=l}return c=(1-r)*n,[(r*o[0]+c)*255,(r*o[1]+c)*255,(r*o[2]+c)*255]};B.hcg.hsv=function(t){var e=t[1]/100,r=t[2]/100,n=e+r*(1-e),o=0;return n>0&&(o=e/n),[t[0],o*100,n*100]};B.hcg.hsl=function(t){var e=t[1]/100,r=t[2]/100,n=r*(1-e)+.5*e,o=0;return n>0&&n<.5?o=e/(2*n):n>=.5&&n<1&&(o=e/(2*(1-n))),[t[0],o*100,n*100]};B.hcg.hwb=function(t){var e=t[1]/100,r=t[2]/100,n=e+r*(1-e);return[t[0],(n-e)*100,(1-n)*100]};B.hwb.hcg=function(t){var e=t[1]/100,r=t[2]/100,n=1-r,o=n-e,i=0;return o<1&&(i=(n-o)/(1-o)),[t[0],o*100,i*100]};B.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};B.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};B.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};B.gray.hsl=B.gray.hsv=function(t){return[0,0,t[0]]};B.gray.hwb=function(t){return[0,100,t[0]]};B.gray.cmyk=function(t){return[0,0,0,t[0]]};B.gray.lab=function(t){return[t[0],0,0]};B.gray.hex=function(t){var e=Math.round(t[0]/100*255)&255,r=(e<<16)+(e<<8)+e,n=r.toString(16).toUpperCase();return"000000".substring(n.length)+n};B.rgb.gray=function(t){var e=(t[0]+t[1]+t[2])/3;return[e/255*100]}});var I3=b((n7e,S3)=>{a();var lg=Kx();function loe(){for(var t={},e=Object.keys(lg),r=e.length,n=0;n<r;n++)t[e[n]]={distance:-1,parent:null};return t}function coe(t){var e=loe(),r=[t];for(e[t].distance=0;r.length;)for(var n=r.pop(),o=Object.keys(lg[n]),i=o.length,s=0;s<i;s++){var l=o[s],c=e[l];c.distance===-1&&(c.distance=e[n].distance+1,c.parent=n,r.unshift(l))}return e}function uoe(t,e){return function(r){return e(t(r))}}function foe(t,e){for(var r=[e[t].parent,t],n=lg[e[t].parent][t],o=e[t].parent;e[o].parent;)r.unshift(e[o].parent),n=uoe(lg[e[o].parent][o],n),o=e[o].parent;return n.conversion=r,n}S3.exports=function(t){for(var e=coe(t),r={},n=Object.keys(e),o=n.length,i=0;i<o;i++){var s=n[i],l=e[s];l.parent!==null&&(r[s]=foe(s,e))}return r}});var O3=b((i7e,_3)=>{a();var Vx=Kx(),poe=I3(),$a={},doe=Object.keys(Vx);function moe(t){var e=function(r){return r==null?r:(arguments.length>1&&(r=Array.prototype.slice.call(arguments)),t(r))};return"conversion"in t&&(e.conversion=t.conversion),e}function hoe(t){var e=function(r){if(r==null)return r;arguments.length>1&&(r=Array.prototype.slice.call(arguments));var n=t(r);if(typeof n=="object")for(var o=n.length,i=0;i<o;i++)n[i]=Math.round(n[i]);return n};return"conversion"in t&&(e.conversion=t.conversion),e}doe.forEach(function(t){$a[t]={},Object.defineProperty($a[t],"channels",{value:Vx[t].channels}),Object.defineProperty($a[t],"labels",{value:Vx[t].labels});var e=poe(t),r=Object.keys(e);r.forEach(function(n){var o=e[n];$a[t][n]=hoe(o),$a[t][n].raw=moe(o)})});_3.exports=$a});var k3=b((a7e,C3)=>{"use strict";a();var ju=g3(),or=O3(),Jx=[].slice,T3=["keyword","gray","hex"],Gx={};Object.keys(or).forEach(function(t){Gx[Jx.call(or[t].labels).sort().join("")]=t});var cg={};function pt(t,e){if(!(this instanceof pt))return new pt(t,e);if(e&&e in T3&&(e=null),e&&!(e in or))throw new Error("Unknown model: "+e);var r,n;if(t==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(t instanceof pt)this.model=t.model,this.color=t.color.slice(),this.valpha=t.valpha;else if(typeof t=="string"){var o=ju.get(t);if(o===null)throw new Error("Unable to parse color from string: "+t);this.model=o.model,n=or[this.model].channels,this.color=o.value.slice(0,n),this.valpha=typeof o.value[n]=="number"?o.value[n]:1}else if(t.length){this.model=e||"rgb",n=or[this.model].channels;var i=Jx.call(t,0,n);this.color=Zx(i,n),this.valpha=typeof t[n]=="number"?t[n]:1}else if(typeof t=="number")t&=16777215,this.model="rgb",this.color=[t>>16&255,t>>8&255,t&255],this.valpha=1;else{this.valpha=1;var s=Object.keys(t);"alpha"in t&&(s.splice(s.indexOf("alpha"),1),this.valpha=typeof t.alpha=="number"?t.alpha:0);var l=s.sort().join("");if(!(l in Gx))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=Gx[l];var c=or[this.model].labels,f=[];for(r=0;r<c.length;r++)f.push(t[c[r]]);this.color=Zx(f)}if(cg[this.model])for(n=or[this.model].channels,r=0;r<n;r++){var u=cg[this.model][r];u&&(this.color[r]=u(this.color[r]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}pt.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(t){var e=this.model in ju.to?this:this.rgb();e=e.round(typeof t=="number"?t:1);var r=e.valpha===1?e.color:e.color.concat(this.valpha);return ju.to[e.model](r)},percentString:function(t){var e=this.rgb().round(typeof t=="number"?t:1),r=e.valpha===1?e.color:e.color.concat(this.valpha);return ju.to.rgb.percent(r)},array:function(){return this.valpha===1?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var t={},e=or[this.model].channels,r=or[this.model].labels,n=0;n<e;n++)t[r[n]]=this.color[n];return this.valpha!==1&&(t.alpha=this.valpha),t},unitArray:function(){var t=this.rgb().color;return t[0]/=255,t[1]/=255,t[2]/=255,this.valpha!==1&&t.push(this.valpha),t},unitObject:function(){var t=this.rgb().object();return t.r/=255,t.g/=255,t.b/=255,this.valpha!==1&&(t.alpha=this.valpha),t},round:function(t){return t=Math.max(t||0,0),new pt(this.color.map(yoe(t)).concat(this.valpha),this.model)},alpha:function(t){return arguments.length?new pt(this.color.concat(Math.max(0,Math.min(1,t))),this.model):this.valpha},red:Me("rgb",0,Je(255)),green:Me("rgb",1,Je(255)),blue:Me("rgb",2,Je(255)),hue:Me(["hsl","hsv","hsl","hwb","hcg"],0,function(t){return(t%360+360)%360}),saturationl:Me("hsl",1,Je(100)),lightness:Me("hsl",2,Je(100)),saturationv:Me("hsv",1,Je(100)),value:Me("hsv",2,Je(100)),chroma:Me("hcg",1,Je(100)),gray:Me("hcg",2,Je(100)),white:Me("hwb",1,Je(100)),wblack:Me("hwb",2,Je(100)),cyan:Me("cmyk",0,Je(100)),magenta:Me("cmyk",1,Je(100)),yellow:Me("cmyk",2,Je(100)),black:Me("cmyk",3,Je(100)),x:Me("xyz",0,Je(100)),y:Me("xyz",1,Je(100)),z:Me("xyz",2,Je(100)),l:Me("lab",0,Je(100)),a:Me("lab",1),b:Me("lab",2),keyword:function(t){return arguments.length?new pt(t):or[this.model].keyword(this.color)},hex:function(t){return arguments.length?new pt(t):ju.to.hex(this.rgb().round().color)},rgbNumber:function(){var t=this.rgb().color;return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255},luminosity:function(){for(var t=this.rgb().color,e=[],r=0;r<t.length;r++){var n=t[r]/255;e[r]=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)}return .2126*e[0]+.7152*e[1]+.0722*e[2]},contrast:function(t){var e=this.luminosity(),r=t.luminosity();return e>r?(e+.05)/(r+.05):(r+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},isDark:function(){var t=this.rgb().color,e=(t[0]*299+t[1]*587+t[2]*114)/1e3;return e<128},isLight:function(){return!this.isDark()},negate:function(){for(var t=this.rgb(),e=0;e<3;e++)t.color[e]=255-t.color[e];return t},lighten:function(t){var e=this.hsl();return e.color[2]+=e.color[2]*t,e},darken:function(t){var e=this.hsl();return e.color[2]-=e.color[2]*t,e},saturate:function(t){var e=this.hsl();return e.color[1]+=e.color[1]*t,e},desaturate:function(t){var e=this.hsl();return e.color[1]-=e.color[1]*t,e},whiten:function(t){var e=this.hwb();return e.color[1]+=e.color[1]*t,e},blacken:function(t){var e=this.hwb();return e.color[2]+=e.color[2]*t,e},grayscale:function(){var t=this.rgb().color,e=t[0]*.3+t[1]*.59+t[2]*.11;return pt.rgb(e,e,e)},fade:function(t){return this.alpha(this.valpha-this.valpha*t)},opaquer:function(t){return this.alpha(this.valpha+this.valpha*t)},rotate:function(t){var e=this.hsl(),r=e.color[0];return r=(r+t)%360,r=r<0?360+r:r,e.color[0]=r,e},mix:function(t,e){if(!t||!t.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof t);var r=t.rgb(),n=this.rgb(),o=e===void 0?.5:e,i=2*o-1,s=r.alpha()-n.alpha(),l=((i*s===-1?i:(i+s)/(1+i*s))+1)/2,c=1-l;return pt.rgb(l*r.red()+c*n.red(),l*r.green()+c*n.green(),l*r.blue()+c*n.blue(),r.alpha()*o+n.alpha()*(1-o))}};Object.keys(or).forEach(function(t){if(T3.indexOf(t)===-1){var e=or[t].channels;pt.prototype[t]=function(){if(this.model===t)return new pt(this);if(arguments.length)return new pt(arguments,t);var r=typeof arguments[e]=="number"?e:this.valpha;return new pt(boe(or[this.model][t].raw(this.color)).concat(r),t)},pt[t]=function(r){return typeof r=="number"&&(r=Zx(Jx.call(arguments),e)),new pt(r,t)}}});function goe(t,e){return Number(t.toFixed(e))}function yoe(t){return function(e){return goe(e,t)}}function Me(t,e,r){return t=Array.isArray(t)?t:[t],t.forEach(function(n){(cg[n]||(cg[n]=[]))[e]=r}),t=t[0],function(n){var o;return arguments.length?(r&&(n=r(n)),o=this[t](),o.color[e]=n,o):(o=this[t]().color[e],r&&(o=r(o)),o)}}function Je(t){return function(e){return Math.max(0,Math.min(t,e))}}function boe(t){return Array.isArray(t)?t:[t]}function Zx(t,e){for(var r=0;r<e;r++)typeof t[r]!="number"&&(t[r]=0);return t}C3.exports=pt});var G3=b((c7e,V3)=>{a();var voe="Expected a function",A3="__lodash_placeholder__",fs=1,fg=2,woe=4,us=8,qu=16,Ma=32,Bu=64,M3=128,xoe=256,L3=512,R3=1/0,Eoe=9007199254740991,Soe=17976931348623157e292,N3=0/0,Ioe=[["ary",M3],["bind",fs],["bindKey",fg],["curry",us],["curryRight",qu],["flip",L3],["partial",Ma],["partialRight",Bu],["rearg",xoe]],_oe="[object Function]",Ooe="[object GeneratorFunction]",Toe="[object Symbol]",Coe=/[\\^$.*+?()[\]{}|]/g,koe=/^\s+|\s+$/g,Aoe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Roe=/\{\n\/\* \[wrapped with (.+)\] \*/,Noe=/,? & /,Doe=/^[-+]0x[0-9a-f]+$/i,Poe=/^0b[01]+$/i,Foe=/^\[object .+?Constructor\]$/,$oe=/^0o[0-7]+$/i,Moe=/^(?:0|[1-9]\d*)$/,Loe=parseInt,joe=typeof global=="object"&&global&&global.Object===Object&&global,qoe=typeof self=="object"&&self&&self.Object===Object&&self,Uu=joe||qoe||Function("return this")();function j3(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function Boe(t,e){for(var r=-1,n=t?t.length:0;++r<n&&e(t[r],r,t)!==!1;);return t}function zoe(t,e){var r=t?t.length:0;return!!r&&Woe(t,e,0)>-1}function Uoe(t,e,r,n){for(var o=t.length,i=r+(n?1:-1);n?i--:++i<o;)if(e(t[i],i,t))return i;return-1}function Woe(t,e,r){if(e!==e)return Uoe(t,Hoe,r);for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}function Hoe(t){return t!==t}function Koe(t,e){for(var r=t.length,n=0;r--;)t[r]===e&&n++;return n}function Voe(t,e){return t?.[e]}function Goe(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function q3(t,e){for(var r=-1,n=t.length,o=0,i=[];++r<n;){var s=t[r];(s===e||s===A3)&&(t[r]=A3,i[o++]=r)}return i}var Zoe=Function.prototype,B3=Object.prototype,Yx=Uu["__core-js_shared__"],D3=function(){var t=/[^.]+$/.exec(Yx&&Yx.keys&&Yx.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),z3=Zoe.toString,Joe=B3.hasOwnProperty,U3=B3.toString,Yoe=RegExp("^"+z3.call(Joe).replace(Coe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Xoe=Object.create,ug=Math.max,Qoe=Math.min,P3=function(){var t=F3(Object,"defineProperty"),e=F3.name;return e&&e.length>2?t:void 0}();function eie(t){return La(t)?Xoe(t):{}}function tie(t){if(!La(t)||pie(t))return!1;var e=gie(t)||Goe(t)?Yoe:Foe;return e.test(mie(t))}function rie(t,e,r,n){for(var o=-1,i=t.length,s=r.length,l=-1,c=e.length,f=ug(i-s,0),u=Array(c+f),d=!n;++l<c;)u[l]=e[l];for(;++o<s;)(d||o<i)&&(u[r[o]]=t[o]);for(;f--;)u[l++]=t[o++];return u}function nie(t,e,r,n){for(var o=-1,i=t.length,s=-1,l=r.length,c=-1,f=e.length,u=ug(i-l,0),d=Array(u+f),m=!n;++o<u;)d[o]=t[o];for(var h=o;++c<f;)d[h+c]=e[c];for(;++s<l;)(m||o<i)&&(d[h+r[s]]=t[o++]);return d}function oie(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}function iie(t,e,r){var n=e&fs,o=zu(t);function i(){var s=this&&this!==Uu&&this instanceof i?o:t;return s.apply(n?r:this,arguments)}return i}function zu(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var r=eie(t.prototype),n=t.apply(r,e);return La(n)?n:r}}function sie(t,e,r){var n=zu(t);function o(){for(var i=arguments.length,s=Array(i),l=i,c=H3(o);l--;)s[l]=arguments[l];var f=i<3&&s[0]!==c&&s[i-1]!==c?[]:q3(s,c);if(i-=f.length,i<r)return W3(t,e,Xx,o.placeholder,void 0,s,f,void 0,void 0,r-i);var u=this&&this!==Uu&&this instanceof o?n:t;return j3(u,this,s)}return o}function Xx(t,e,r,n,o,i,s,l,c,f){var u=e&M3,d=e&fs,m=e&fg,h=e&(us|qu),y=e&L3,w=m?void 0:zu(t);function v(){for(var x=arguments.length,S=Array(x),k=x;k--;)S[k]=arguments[k];if(h)var j=H3(v),Z=Koe(S,j);if(n&&(S=rie(S,n,o,h)),i&&(S=nie(S,i,s,h)),x-=Z,h&&x<f){var X=q3(S,j);return W3(t,e,Xx,v.placeholder,r,S,X,l,c,f-x)}var J=d?r:this,G=m?J[t]:t;return x=S.length,l?S=die(S,l):y&&x>1&&S.reverse(),u&&c<x&&(S.length=c),this&&this!==Uu&&this instanceof v&&(G=w||zu(G)),G.apply(J,S)}return v}function aie(t,e,r,n){var o=e&fs,i=zu(t);function s(){for(var l=-1,c=arguments.length,f=-1,u=n.length,d=Array(u+c),m=this&&this!==Uu&&this instanceof s?i:t;++f<u;)d[f]=n[f];for(;c--;)d[f++]=arguments[++l];return j3(m,o?r:this,d)}return s}function W3(t,e,r,n,o,i,s,l,c,f){var u=e&us,d=u?s:void 0,m=u?void 0:s,h=u?i:void 0,y=u?void 0:i;e|=u?Ma:Bu,e&=~(u?Bu:Ma),e&woe||(e&=~(fs|fg));var w=r(t,e,o,h,d,y,m,l,c,f);return w.placeholder=n,K3(w,t,e)}function lie(t,e,r,n,o,i,s,l){var c=e&fg;if(!c&&typeof t!="function")throw new TypeError(voe);var f=n?n.length:0;if(f||(e&=~(Ma|Bu),n=o=void 0),s=s===void 0?s:ug($3(s),0),l=l===void 0?l:$3(l),f-=o?o.length:0,e&Bu){var u=n,d=o;n=o=void 0}var m=[t,e,r,n,o,u,d,i,s,l];if(t=m[0],e=m[1],r=m[2],n=m[3],o=m[4],l=m[9]=m[9]==null?c?0:t.length:ug(m[9]-f,0),!l&&e&(us|qu)&&(e&=~(us|qu)),!e||e==fs)var h=iie(t,e,r);else e==us||e==qu?h=sie(t,e,l):(e==Ma||e==(fs|Ma))&&!o.length?h=aie(t,e,r,n):h=Xx.apply(void 0,m);return K3(h,t,e)}function H3(t){var e=t;return e.placeholder}function F3(t,e){var r=Voe(t,e);return tie(r)?r:void 0}function cie(t){var e=t.match(Roe);return e?e[1].split(Noe):[]}function uie(t,e){var r=e.length,n=r-1;return e[n]=(r>1?"& ":"")+e[n],e=e.join(r>2?", ":" "),t.replace(Aoe,`{
|
|
/* [wrapped with `+e+`] */
|
|
`)}function fie(t,e){return e=e??Eoe,!!e&&(typeof t=="number"||Moe.test(t))&&t>-1&&t%1==0&&t<e}function pie(t){return!!D3&&D3 in t}function die(t,e){for(var r=t.length,n=Qoe(e.length,r),o=oie(t);n--;){var i=e[n];t[n]=fie(i,r)?o[i]:void 0}return t}var K3=P3?function(t,e,r){var n=e+"";return P3(t,"toString",{configurable:!0,enumerable:!1,value:xie(uie(n,hie(cie(n),r)))})}:Eie;function mie(t){if(t!=null){try{return z3.call(t)}catch{}try{return t+""}catch{}}return""}function hie(t,e){return Boe(Ioe,function(r){var n="_."+r[0];e&r[1]&&!zoe(t,n)&&t.push(n)}),t.sort()}function Qx(t,e,r){e=r?void 0:e;var n=lie(t,us,void 0,void 0,void 0,void 0,void 0,e);return n.placeholder=Qx.placeholder,n}function gie(t){var e=La(t)?U3.call(t):"";return e==_oe||e==Ooe}function La(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function yie(t){return!!t&&typeof t=="object"}function bie(t){return typeof t=="symbol"||yie(t)&&U3.call(t)==Toe}function vie(t){if(!t)return t===0?t:0;if(t=wie(t),t===R3||t===-R3){var e=t<0?-1:1;return e*Soe}return t===t?t:0}function $3(t){var e=vie(t),r=e%1;return e===e?r?e-r:e:0}function wie(t){if(typeof t=="number")return t;if(bie(t))return N3;if(La(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=La(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(koe,"");var r=Poe.test(t);return r||$oe.test(t)?Loe(t.slice(2),r?2:8):Doe.test(t)?N3:+t}function xie(t){return function(){return t}}function Eie(t){return t}Qx.placeholder={};V3.exports=Qx});var Cae={};iS(Cae,{default:()=>Se});module.exports=zg(Cae);a();a();function lS(t){var e=new WeakMap;return r=>e.has(r)?e.get(r):JB(e,r,t(r,e))}function JB(t,e,r){return t.set(e,r),r}a();function cS(t){return t&&typeof t=="object"?JSON.parse(JSON.stringify(t)):t}a();var Sn=typeof queueMicrotask=="function"?queueMicrotask:(t=>e=>t.then(e))(Promise.resolve());function uS(t){let e=Promise.resolve(t);return(r,n)=>r||n?(typeof n>"u"&&(n=console.error),e=e.then(r,n)):e}a();function fS(){let t,e,r=new Promise((n,o)=>{t=n,e=o});return{resolve:t,reject:e,promise:r}}a();var Hae=require("obsidian"),dt;(function(t){Object.assign(t,require("obsidian"))})(dt||(dt={}));a();a();var Ug="use.me",Wg="use.factory",vs,Qa,Hg=function(){return Object.defineProperties(t(),{this:{get(){if(vs)return vs;throw new TypeError("No current context")}},me:{value:Ug},factory:{value:Wg}});function t(o){let i=new Map;i.prev=o;let s=Object.assign(o?c=>{let f=i.get(c);if(!f){for(let h=i.prev;h;h=h.prev)if(f=h.get(c)){f=Object.assign(Object.assign({},f),{s:f.s||1});break}f=f||{s:2,v:r},i.set(c,f)}let u,d,m;for(;;)switch(f.s){case 0:return vs===s&&Qa&&Qa.push(c),f.v;case 1:if(u=f.d,!u||l(()=>u.k.every(h=>s(h)===u.c(h)))){f.s=0;break}f.v=u.f;case 2:f.s=4;try{e(i,c,0,l(d=f.v,c,m=[])),m.length&&(f.d={c:s,f:d,k:m});break}catch(h){f.s=3,f.v=h,f.d=null}case 3:throw f.v;case 4:throw new Error(`Factory ${String(f.v)} didn't resolve ${String(c)}`)}}:c=>Hg.this(c),{def(c,f){return e(i,c,2,f),s},set(c,f){return e(i,c,1,f),s},fork(c){let f=t(i);return c!=null?f(c):f}});return o?s.use=s:s;function l(c,f,u){let d=vs,m=Qa;try{return vs=s,Qa=u,c(f)}finally{vs=d,Qa=m}}}function e(o,i,s,l){if(o.has(i)){let c=o.get(i);if(!c.s)throw new Error(`Already read: ${String(i)}`);c.s=s,c.v=l,c.d=null}else o.set(i,{s,v:l})}function r(o){if(typeof o[Ug]=="function")return o[Ug](o);if(n(o))return typeof o.prototype[Wg]=="function"?o.prototype[Wg]():new o;throw new ReferenceError(`No config for ${String(o)}`)}function n(o){return typeof o=="function"&&o.prototype!==void 0&&(Object.getPrototypeOf(o.prototype)!==Object.prototype||Object.getOwnPropertyNames(o.prototype).length>1||o.toString().startsWith("class"))}}();var YB,ws=(t=>(t.service=function(e){return t(tf).addChild(e),t.this},t.plugin=function(e){if(!In)YB=e.app,In=t.fork(),In.set(dt.Plugin,e),In.set(e.constructor,e),e.addChild(In.use(tf));else if(e!==In.use(dt.Plugin))throw new TypeError("use.plugin() called on multiple plugins");return In},t.def(dt.Plugin,()=>{throw new Error("Plugin not created yet")}),t.def(dt.App,()=>t(dt.Plugin).app),t))(Hg),In;function Kg(t){if(t?.use)return t.use;if(In)return In;if(t instanceof dt.Plugin)return t.use=ws.plugin(t);throw new Error("No context available: did you forget to `use.plugin()`?")}var de=class extends dt.Component{constructor(){super(...arguments),this.use=ws.service(this)}},tf=class extends dt.Component{constructor(){super(...arguments),this.children=new Set([this])}onload(){this.loaded=!0}onunload(){this.loaded=!1,this.children.clear()}addChild(e){return this.children.has(e)||(this.children.add(e),this.loaded?Sn(()=>super.addChild(e)):super.addChild(e)),e}};function XB(t,e){Sn(()=>t.removeChild(e))}function pS(t,e){let r=new dt.Component;r.onload=()=>{XB(t,r),t=null,e()},t.addChild(r)}a();a();function nf(){throw new Error("Cycle detected")}function of(){if(so>1){so--;return}let t,e=!1;for(;el!==void 0;){let r=el;for(el=void 0,Vg++;r!==void 0;){let n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&gS(r))try{r.c()}catch(o){e||(t=o,e=!0)}r=n}}if(Vg=0,so--,e)throw t}function dS(t){if(so>0)return t();so++;try{return t()}finally{of()}}var Fe,el;var so=0,Vg=0,rf=0;function mS(t){if(Fe===void 0)return;let e=t.n;if(e===void 0||e.t!==Fe)return e={i:0,S:t,p:Fe.s,n:void 0,t:Fe,e:void 0,x:void 0,r:e},Fe.s!==void 0&&(Fe.s.n=e),Fe.s=e,t.n=e,32&Fe.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=Fe.s,e.n=void 0,Fe.s.n=e,Fe.s=e),e}function Rt(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}Rt.prototype.h=function(){return!0};Rt.prototype.S=function(t){this.t!==t&&t.e===void 0&&(t.x=this.t,this.t!==void 0&&(this.t.e=t),this.t=t)};Rt.prototype.U=function(t){if(this.t!==void 0){let e=t.e,r=t.x;e!==void 0&&(e.x=r,t.e=void 0),r!==void 0&&(r.e=e,t.x=void 0),t===this.t&&(this.t=r)}};Rt.prototype.subscribe=function(t){let e=this;return Zg(function(){let r=e.value,n=32&this.f;this.f&=-33;try{t(r)}finally{this.f|=n}})};Rt.prototype.valueOf=function(){return this.value};Rt.prototype.toString=function(){return this.value+""};Rt.prototype.toJSON=function(){return this.value};Rt.prototype.peek=function(){return this.v};Object.defineProperty(Rt.prototype,"value",{get(){let t=mS(this);return t!==void 0&&(t.i=this.i),this.v},set(t){if(Fe instanceof ao&&function(){throw new Error("Computed cannot have side-effects")}(),t!==this.v){Vg>100&&nf(),this.v=t,this.i++,rf++,so++;try{for(let e=this.t;e!==void 0;e=e.x)e.t.N()}finally{of()}}}});function hS(t){return new Rt(t)}function gS(t){for(let e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function yS(t){for(let e=t.s;e!==void 0;e=e.n){let r=e.S.n;if(r!==void 0&&(e.r=r),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function bS(t){let e,r=t.s;for(;r!==void 0;){let n=r.p;r.i===-1?(r.S.U(r),n!==void 0&&(n.n=r.n),r.n!==void 0&&(r.n.p=n)):e=r,r.S.n=r.r,r.r!==void 0&&(r.r=void 0),r=n}t.s=e}function ao(t){Rt.call(this,void 0),this.x=t,this.s=void 0,this.g=rf-1,this.f=4}(ao.prototype=new Rt).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===rf))return!0;if(this.g=rf,this.f|=1,this.i>0&&!gS(this))return this.f&=-2,!0;let t=Fe;try{yS(this),Fe=this;let e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return Fe=t,bS(this),this.f&=-2,!0};ao.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(let e=this.s;e!==void 0;e=e.n)e.S.S(e)}Rt.prototype.S.call(this,t)};ao.prototype.U=function(t){if(this.t!==void 0&&(Rt.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(let e=this.s;e!==void 0;e=e.n)e.S.U(e)}};ao.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let t=this.t;t!==void 0;t=t.x)t.t.N()}};ao.prototype.peek=function(){if(this.h()||nf(),16&this.f)throw this.v;return this.v};Object.defineProperty(ao.prototype,"value",{get(){1&this.f&&nf();let t=mS(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function vS(t){return new ao(t)}function wS(t){let e=t.u;if(t.u=void 0,typeof e=="function"){so++;let r=Fe;Fe=void 0;try{e()}catch(n){throw t.f&=-2,t.f|=8,Gg(t),n}finally{Fe=r,of()}}}function Gg(t){for(let e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,wS(t)}function QB(t){if(Fe!==this)throw new Error("Out-of-order effect");bS(this),Fe=t,this.f&=-2,8&this.f&&Gg(this),of()}function tl(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}tl.prototype.c=function(){let t=this.S();try{if(8&this.f||this.x===void 0)return;let e=this.x();typeof e=="function"&&(this.u=e)}finally{t()}};tl.prototype.S=function(){1&this.f&&nf(),this.f|=1,this.f&=-9,wS(this),yS(this),so++;let t=Fe;return Fe=this,QB.bind(this,t)};tl.prototype.N=function(){2&this.f||(this.f|=2,this.o=el,el=this)};tl.prototype.d=function(){this.f|=8,1&this.f||Gg(this)};function Zg(t){let e=new tl(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}function ol(t){let e=vS(t);return()=>e.value}function xS(t){let e=hS(t);function r(){return e.value,t}return r.set=function(n){t!==n&&(nl.size||Sn(ez),nl.set(e,t=n))},r}var nl=new Map;function ez(){nl.size&&dS(()=>{for(let[t,e]of nl.entries())nl.delete(t),t.value=e})}var tz=lS(function(t){return{}});function ge(t,e,r){let n=r.get;return{...r,get(){var o,i;return((o=(i=tz(this))[e])!==null&&o!==void 0?o:i[e]=ol(n.bind(this)))()}}}var rl;function Ve(t){let e=Zg(function(){let r=rl,n=rl=[];try{let o=t.call(this);if(o&&n.push(o),n.length)return n.length===1?n.pop():function(){for(;n.length;)try{n.shift()()}catch(i){Promise.reject(i)}}}finally{rl=r}});return rl&&rl.push(e),e}a();function sr(t,e){let r=Object.keys(e).map(n=>rz(t,n,e[n]));return r.length===1?r[0]:function(){r.forEach(n=>n())}}function rz(t,e,r){let n=t[e],o=t.hasOwnProperty(e),i=r(n);return n&&Object.setPrototypeOf(i,n),Object.setPrototypeOf(s,i),t[e]=s,l;function s(...c){return i===n&&t[e]===s&&l(),i.apply(this,c)}function l(){t[e]===s&&(o?t[e]=n:delete t[e]),i!==n&&(i=n,Object.setPrototypeOf(s,n||Function))}}a();var sf=t=>{if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},nz=new Set(["__proto__","prototype","constructor"]),Jg=(t,e)=>{if(!sf(e))return t;t||(t={});for(let[r,n]of Object.entries(e)){if(nz.has(r))continue;let o=t[r];if(sf(o)&&sf(n))t[r]=Jg(o,n);else{if(n===void 0)continue;sf(n)?t[r]=Jg({},n):Array.isArray(n)?t[r]=[...n]:t[r]=n}}return t};function af(t={},e={}){return Jg({...e},{...t})}a();var lf=class extends de{get current(){return this.cloned()}addDefaults(e){this.data=af(this.data,e)}constructor(){super(),this.plugin=this.use(dt.Plugin),this.queue=uS(),this.data={},this.version=xS(0),this.cloned=ol(()=>this.version()?cS(this.data):null),this.queue(async()=>{var e;await new Promise(r=>pS(this.plugin,r)),this.data=af((e=await this.plugin.loadData())!==null&&e!==void 0?e:{},this.data),this.version.set(this.version()+1)},console.error)}once(e,r){let n=this.each(o=>{n(),e.call(r,o)});return n}each(e,r){return Ve(()=>{this.current&&Sn(e.bind(r,this.current))})}onChange(e,r){return this.each(e,r)}update(e){return this.queue(async()=>{var r;let n=this.data,o=JSON.stringify(n);try{var i=JSON.parse(o);i=(r=e(i))!==null&&r!==void 0?r:i;let s=JSON.stringify(i);o!==s&&(this.data=i,this.version.set(this.version()+1),await this.plugin.saveData(JSON.parse(s)).catch(console.error))}catch(s){console.error(s)}return this.data})}};a();function ES(t,e,r,n){let{resolve:o,promise:i}=fS(),s=new class extends dt.FuzzySuggestModal{getItemText(l){var c;return(c=e?.(l))!==null&&c!==void 0?c:""+l}getItems(){return t}onChooseItem(l,c){o({item:l,event:c})}onClose(){super.onClose(),Sn(()=>o({item:null,event:null}))}}(app);return r&&s.setPlaceholder(r),n?.(s),s.open(),i}var zB=require("obsidian");a();a();a();var SS=t=>`obsidian-zotero:${t}`;a();var ar=({key:t,groupID:e,parentItem:r},n=!1)=>{let o=[t];return!n&&r&&o.push(`a${r}`),typeof e=="number"&&o.push(`g${e}`),o.join("")},IS=(t,e,r=!0)=>(n,...o)=>{let i="";for(let s=0;s<n.length;s++)s>0&&(i+=t(o[s-1])),i+=(r?n.raw:n)[s];return e(i)},Qg=(t=!0,e)=>IS(r=>r,r=>new RegExp(t?"^"+r+"$":r,e),!0),Yg=String.raw`[23456789ABCDEFGHIJKLMNPQRSTUVWXYZ]{8}`,Xg=String.raw`\d+`,_S=t=>{let e={annotKey:Yg,parentKey:Yg,groupID:Xg,page:Xg};if(t)for(let r in e)e[r]=`(${e[r]})`;return IS(r=>e[r],r=>r)`${"annotKey"}a${"parentKey"}(?:g${"groupID"})?(?:p${"page"})?`},OS=Qg()`${Yg}(?:g${Xg})?`,TS=Qg()`${_S(!0)}`,CS=Qg()`(?:${_S(!1)}n?)+`,xs=(t,e)=>{if(t===null)return null;let r;return typeof t=="number"?r=t:r=parseInt(t,10),Number.isInteger(r)?e?r+1:r:null};a();a();var kS=(t,e,{getLogger:r,configure:n})=>{let o=SS(t);return n({appenders:{out:{type:"console"}},categories:{default:{appenders:["out"],level:e},[o]:{appenders:["out"],level:e}}}),r(o)},AS={ALL:"ALL",TRACE:"TRACE",DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR",FATAL:"FATAL",MARK:"MARK",OFF:"OFF"};a();var lo=()=>(...t)=>t;a();a();var RS=t=>`better-sqlite3-${t}.node`;var Tp=Y(YO(),1);a();var jb=Y(Ds(),1),So=require("obsidian"),Pk=Y(tT(),1);a();var GT=require("http");a();a();var NU=Y(Ds(),1),DU=Y(Wy(),1),Hy=Y(Wy(),1);var xT=lo()("open","export","update");var wT=(t,e)=>{let r=new RegExp(`^${e}\\[(\\d+)\\]$`);return Object.entries(t).filter(([n])=>r.test(n)).sort(([n],[o])=>Number(n.match(r)[1])-Number(o.match(r)[1])).map(([,n])=>JSON.parse(n))},Bf=t=>{if(t.type==="item")return{version:t.version,type:t.type,items:wT(t,"items")};if(t.type==="annotation")return{version:t.version,type:t.type,annots:wT(t,"annots"),parent:JSON.parse(t.parent)};throw new TypeError("Unrecognized query type: "+t.type)};a();var Ky=/^<!--merge:(\d+)-->/;var Wf=require("obsidian");a();var Tl=require("path");a();var ST=require("path/posix");var Vy=require("obsidian"),Uf="v12.8.0",zf=p,IT=()=>Object.keys(zf).length===0,ET=Vy.Platform.isDesktopApp?require("@electron/remote").app.getPath("userData"):null,{arch:hme,platform:gme,versions:{modules:yme,electron:bme}}=process,_T=({modules:t})=>{if(IT()||t in zf)return 0;let e=Object.keys(zf).map(n=>parseInt(n,10)).sort((n,o)=>n-o);return parseInt(t,10)>e[e.length-1]?1:-1},OT=({modules:t,platform:e,arch:r})=>IT()?!0:zf[t]?.[e]?.includes(r)??!1,TT=()=>Vy.Platform.isDesktopApp?{arch:process.arch,platform:process.platform,modules:process.versions.modules,electron:process.versions.electron}:null,Ps=()=>ET?(0,ST.join)(ET,RS(Uf)):null;a();a();var CT={citationEditorSuggester:!0,showCitekeyInSuggester:!1};a();var kT={literatureNoteFolder:"LiteratureNotes"};a();var AT={enableServer:!1,serverPort:9091,serverHostname:"127.0.0.1"};a();a();var Gy=require("path/posix");var RT=`[!note] Page <%= it.pageLabel %>
|
|
|
|
<%= it.imgEmbed %><%= it.text %>
|
|
<% if (it.comment) { %>
|
|
---
|
|
<%= it.comment %>
|
|
<% } %>`;var NT=`<% for (const annotation of it) { %>
|
|
<%~ include("annotation", annotation) %>
|
|
<% } %>`;var DT='[<%= it.filter(lit => !!lit.citekey).map(lit => `@${lit.citekey}`).join("; ") %>]\n';var PT='<%= it.filter(lit => !!lit.citekey).map(lit => `@${lit.citekey}`).join("; ") %>\n';var FT=`<mark style="
|
|
<%- if (it.color) { _%> color: <%= it.color %>; <%_ } -%>
|
|
<%- if (it.bgColor) { _%> background-color: <%= it.bgColor %>; <%_ } -%>
|
|
"><%= it.content %></mark>`;var $T=`title: "<%= it.title %>"
|
|
citekey: "<%= it.citekey %>"`;var MT=`# <%= it.title %>
|
|
|
|
[Zotero](<%= it.backlink %>) <%= it.fileLink %>
|
|
<%~ include("annots", it.annotations) %>`;var ht={Ejectable:{note:MT,field:$T,annots:NT,annotation:RT,cite:DT,cite2:PT,colored:FT},Embeded:{filename:"<%= it.citekey ?? it.DOI ?? it.title ?? it.key %>.md"}},tn={Ejectable:Object.keys(ht.Ejectable),Embeded:Object.keys(ht.Embeded),All:Object.keys(ht.Ejectable).concat(Object.keys(ht.Embeded))};function Zy(t){return Object.hasOwn(ht.Embeded,t)?`zt-${t}.eta.md`:Object.hasOwn(ht.Ejectable,t)?t==="annotation"?"zt-annot.eta.md":`zt-${t}.eta.md`:null}function gi(t,e){return(0,Gy.join)(e,Zy(t))}function Et(t,e){let r=tn.Embeded.find(o=>(0,Gy.join)(e,`zt-${o}.eta.md`)===t);if(r)return{type:"embeded",name:r};let n=tn.Ejectable.find(o=>gi(o,e)===t);return n?{type:"ejectable",name:n}:null}var LT={template:{folder:"ZtTemplates",templates:ht.Embeded},updateAnnotBlock:!1,updateOverwrite:!1,autoPairEta:!1,autoTrim:[!1,!1]};a();var jT={autoRefresh:!0};a();var qT=require("os"),BT=require("path"),zT=()=>({zoteroDataDir:(0,BT.join)((0,qT.homedir)(),"Zotero"),citationLibrary:1});a();var UT=require("obsidian"),WT={imgExcerptImport:UT.Platform.isWin?"copy":"symlink",imgExcerptPath:"ZtImgExcerpt"};var HT=()=>({...KT,...CT,...kT,...AT,...LT,...jT,...zT(),...WT});function BU(t){return t!==null&&typeof t=="object"&&"then"in t&&typeof t.then=="function"}function ut(t,e,r=!1){let n=0;return(...o)=>{if(e(),n++>(r?1:0)){let i=t(...o);if(BU(i)){Promise.resolve(i).catch(s=>{console.error("Unhandled async effect in skip()",s)});return}return i}}}var be=class extends lf{#e=this.use(Se);#t;get nativeBinding(){if(this.#t)return this.#t;let e=Ps();if(e)return this.#t=e,this.#t;throw new Error("Failed to get native binding path")}get templateDir(){return this.current?.template?.folder}get libId(){return this.current?.citationLibrary}get simpleTemplates(){return this.current?.template?.templates}get zoteroDbPath(){return(0,Tl.join)(this.current?.zoteroDataDir,"zotero.sqlite")}get bbtSearchDbPath(){return(0,Tl.join)(this.current?.zoteroDataDir,"better-bibtex-search.sqlite")}get bbtMainDbPath(){return(0,Tl.join)(this.current?.zoteroDataDir,"better-bibtex.sqlite")}get zoteroCacheDirPath(){return(0,Tl.join)(this.current?.zoteroDataDir,"cache")}get dbConnParams(){return[{zotero:this.zoteroDbPath,bbtSearch:this.bbtSearchDbPath,bbtMain:this.bbtMainDbPath},{nativeBinding:this.nativeBinding}]}};he([ge],be.prototype,"templateDir",1),he([ge],be.prototype,"libId",1),he([ge],be.prototype,"simpleTemplates",1),he([ge],be.prototype,"zoteroDbPath",1),he([ge],be.prototype,"bbtSearchDbPath",1),he([ge],be.prototype,"bbtMainDbPath",1),he([ge],be.prototype,"zoteroCacheDirPath",1),he([ge],be.prototype,"dbConnParams",1);function VT(t){let e=Kg(t)(be);return e.addDefaults(HT()),e}var zU=new Set(["notify"]),UU=new Set([...xT.map(t=>`zotero/${t}`)]),Cn=class extends de{#e=new Wf.Events;settings=this.use(be);plugin=this.use(Se);server=null;get port(){return this.settings.current?.serverPort}get hostname(){return this.settings.current?.serverHostname}get enableServer(){return this.settings.current?.enableServer}onload(){this.register(Ve(ut(()=>{this.enableServer?this.initServer():this.closeServer()},()=>this.enableServer))),this.register(Ve(ut(()=>{this.reloadPort(),new Wf.Notice("Server port is saved and applied.")},()=>(this.port,this.hostname),!0))),this.registerObsidianProtocolHandler()}onunload(){this.closeServer(),this.server=null}registerObsidianProtocolHandler(){let e=r=>{let{action:n,...o}=r;this.trigger(n,o)};for(let r of UU)this.plugin.registerObsidianProtocolHandler(r,e)}#t(){this.server??=(0,GT.createServer)((e,r)=>{this.requestListener(e,r)})}#n(){this.server?.listening||this.server?.listen(this.port,this.hostname,()=>this.listeningListener())}initServer(){this.#t(),this.#n()}closeServer(){this.server?.close()}reloadPort(){this.enableServer&&(this.closeServer(),this.#t(),this.#n())}requestListener(e,r){if(!e.url){W.error("Request without url"),r.statusCode=400,r.end();return}W.trace("server recieved req",e.url,e.rawHeaders);let{pathname:n,searchParams:o}=new URL(e.url,`http://${e.headers.host}`),i=n.substring(1),s=`bg:${n.substring(1)}`;if(zU.has(i)){let l=Object.fromEntries(o.entries());HU(e)?KU(e).then(c=>{this.trigger(s,l,c),r.end()}).catch(c=>{W.error(`Failed to process ${i} request`,c),r.statusCode=400,r.end()}):(this.trigger(s,l),r.end())}else r.statusCode=404,r.end()}listeningListener(){this.server&&W.info(`Server is listening at ${WU(this.server)}`)}on(e,r,n){return this.#e.on(e,r,n)}off(e,r){return this.#e.off(e,r)}offref(e){return this.#e.offref(e)}trigger(e,...r){return W.trace(`server trigger ${e}`,...r),this.#e.trigger(e,...r)}tryTrigger(e,r){return this.#e.tryTrigger(e,r)}};he([ge],Cn.prototype,"port",1),he([ge],Cn.prototype,"hostname",1),he([ge],Cn.prototype,"enableServer",1);function WU(t){let e=t.address();return e?typeof e=="string"?e:`${e.address}:${e.port}`:"?"}function HU(t){let e=t.headers["content-type"];return e?(Array.isArray(e)?e:[e]).some(n=>n.toLowerCase().startsWith("application/json")):!1}function KU(t){return new Promise((e,r)=>{let n="";t.on("data",o=>n+=o),t.on("error",o=>r(o)),t.on("end",()=>{try{e(JSON.parse(n))}catch(o){r(o)}})})}a();var ZT=Y(Ds(),1),JT=require("obsidian");function YT(t,e={}){return Al({...e,register:r=>t.metadataCache.on("initialized",r),unregister:r=>t.metadataCache.offref(r),escape:()=>t.metadataCache.initialized,timeout:e.timeout??null})}function Jy(t,e={}){return Al({...e,register:r=>t.vault.on("zotero:db-refresh",r),unregister:r=>t.vault.offref(r)})}function Fs(t,e={}){return Al({...e,unregister:r=>t.app.vault.offref(r),escape:()=>t.dbWorker.status===2,register:r=>{let n=t.dbWorker.status;if(n===0)return t.app.vault.on("zotero:db-ready",r);if(n===1)return t.app.vault.on("zotero:db-refresh",r);if(n===2)throw new Error("should not be called when db is ready");(0,ZT.assertNever)(n)}})}var XT=t=>new Promise(e=>{t.workspace.onLayoutReady(e)}),Al=({register:t,unregister:e,escape:r,timeout:n=1e4,waitAfterEvent:o,debounce:i=1e3})=>{let s=null;return[new Promise((c,f)=>{if(r?.()){c();return}s=function(){e(m),f(new kl)};function u(){e(m),c()}async function d(){o!==void 0&&await sleep(o),u()}let m=t(i?(0,JT.debounce)(d,i,!0):d);n!==null&&sleep(n).then(()=>{e(m),r?.()?u():f(new Cl(n))})}),s]},Cl=class extends Error{constructor(r){super(`Timeout after ${r}ms`);this.timeout=r}},kl=class extends Error{constructor(){super("Manually cancelled")}};a();a();var GU=t=>{let e=new Blob([t],{type:"text/javascript"});return URL.createObjectURL(e)},QT=(t,e)=>{let r=GU(t),n=new Worker(r,e);return URL.revokeObjectURL(r),n};a();a();a();a();a();a();a();a();a();a();var Yy=class extends Error{},Oe=t=>{throw new Yy(t)},Xy=class extends Error{},xe=t=>{throw new Xy(t)};a();a();var yo=(t,e)=>je(t)===e,je=t=>{let e=typeof t;return e==="object"?t===null?"null":"object":e==="function"?"object":e},Qy={bigint:"a bigint",boolean:"boolean",null:"null",number:"a number",object:"an object",string:"a string",symbol:"a symbol",undefined:"undefined"};var mr=(t,e)=>t in e,eC=t=>Object.entries(t),Te=t=>Object.keys(t),yi=t=>{let e=[];for(;t!==Object.prototype&&t!==null&&t!==void 0;){for(let r of Object.getOwnPropertyNames(t))e.includes(r)||e.push(r);for(let r of Object.getOwnPropertySymbols(t))e.includes(r)||e.push(r);t=Object.getPrototypeOf(t)}return e},$s=(t,e)=>{let r=t?.[e];return r!=null};var tC=t=>Object.keys(t).length,Rl=t=>yo(t,"object")?Object.keys(t).length!==0:!1,Dhe=Symbol("id");var rn=t=>Array.isArray(t)?t:[t];a();var Xe=class extends Array{static fromString(e,r="/"){return e===r?new Xe:new Xe(...e.split(r))}toString(e="/"){return this.length?this.join(e):e}},rC=(t,e)=>{let r=t;for(let n of e){if(typeof r!="object"||r===null)return;r=r[n]}return r};a();a();var eb=/^(?!^-0$)-?(?:0|[1-9]\d*)(?:\.\d*[1-9])?$/,ZU=t=>eb.test(t),JU=/^-?\d*\.?\d*$/,YU=t=>t.length!==0&&JU.test(t),Hf=/^(?:0|(?:-?[1-9]\d*))$/,Nl=t=>Hf.test(t),Dl=/^(?:0|(?:[1-9]\d*))$/,nC=/^-?\d+$/,XU=t=>nC.test(t),oC={number:"a number",bigint:"a bigint",integer:"an integer"},iC=(t,e)=>`'${t}' was parsed as ${oC[e]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`,QU=(t,e)=>e==="number"?ZU(t):Nl(t),e8=(t,e)=>e==="number"?Number(t):Number.parseInt(t),t8=(t,e)=>e==="number"?YU(t):XU(t),Pl=(t,e)=>sC(t,"number",e),Kf=(t,e)=>sC(t,"integer",e),sC=(t,e,r)=>{let n=e8(t,e);if(!Number.isNaN(n)){if(QU(t,e))return n;if(t8(t,e))return xe(iC(t,e))}return r?xe(r===!0?`Failed to parse ${oC[e]} from '${t}'`:r):void 0},tb=t=>{if(t[t.length-1]!=="n")return;let e=t.slice(0,-1),r;try{r=BigInt(e)}catch{return}if(Hf.test(e))return r;if(nC.test(e))return xe(iC(t,"bigint"))};var De=(t,e)=>{switch(je(t)){case"object":return JSON.stringify(rb(t,Vf,[]),null,e);case"symbol":return Vf.onSymbol(t);default:return nb(t)}},Vf={onCycle:()=>"(cycle)",onSymbol:t=>`(symbol${t.description&&` ${t.description}`})`,onFunction:t=>`(function${t.name&&` ${t.name}`})`},rb=(t,e,r)=>{switch(je(t)){case"object":if(typeof t=="function")return Vf.onFunction(t);if(r.includes(t))return"(cycle)";let n=[...r,t];if(Array.isArray(t))return t.map(i=>rb(i,e,n));let o={};for(let i in t)o[i]=rb(t[i],e,n);return o;case"symbol":return Vf.onSymbol(t);case"bigint":return`${t}n`;case"undefined":return"undefined";default:return t}},nb=t=>typeof t=="string"?`'${t}'`:typeof t=="bigint"?`${t}n`:`${t}`;function r8(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function n8(t,e){return e.get?e.get.call(t):e.value}function o8(t,e,r){if(e.set)e.set.call(t,r);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=r}}function lC(t,e,r){if(!e.has(t))throw new TypeError("attempted to "+r+" private field on non-instance");return e.get(t)}function aC(t,e){var r=lC(t,e,"get");return n8(t,r)}function i8(t,e,r){r8(t,e),e.set(t,r)}function s8(t,e,r){var n=lC(t,e,"set");return o8(t,n,r),r}function Gf(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var hr=t=>(e,r,n)=>e===void 0?r===void 0?Oe(Yf):r:r===void 0?e:t(e,r,n),Yf="Unexpected operation two undefined operands",ob={domain:({l:t,r:e})=>`${t.join(", ")} and ${e.join(", ")}`,range:({l:t,r:e})=>`${Jf(t)} and ${Jf(e)}`,class:({l:t,r:e})=>`classes ${typeof t=="string"?t:t.name} and ${typeof e=="string"?e:e.name}`,tupleLength:({l:t,r:e})=>`tuples of length ${t} and ${e}`,value:({l:t,r:e})=>`literal values ${De(t)} and ${De(e)}`,leftAssignability:({l:t,r:e})=>`literal value ${De(t.value)} and ${De(e)}`,rightAssignability:({l:t,r:e})=>`literal value ${De(e.value)} and ${De(t)}`,union:({l:t,r:e})=>`branches ${De(t)} and branches ${De(e)}`},Jf=t=>"limit"in t?`the range of exactly ${t.limit}`:t.min?t.max?`the range bounded by ${t.min.comparator}${t.min.limit} and ${t.max.comparator}${t.max.limit}`:`${t.min.comparator}${t.min.limit}`:t.max?`${t.max.comparator}${t.max.limit}`:"the unbounded range",Zf=new WeakMap,bo=class{get disjoints(){return aC(this,Zf)}addDisjoint(e,r,n){return aC(this,Zf)[`${this.path}`]={kind:e,l:r,r:n},Xf}constructor(e,r){Gf(this,"type",void 0),Gf(this,"lastOperator",void 0),Gf(this,"path",void 0),Gf(this,"domain",void 0),i8(this,Zf,{writable:!0,value:void 0}),this.type=e,this.lastOperator=r,this.path=new Xe,s8(this,Zf,{})}},Xf=Symbol("empty"),cC=()=>Xf,Nr=t=>t===Xf,uC=Symbol("equal"),Qe=()=>uC,gr=t=>t===uC,Ms=(t,e)=>(r,n,o)=>{let i={},s=Te({...r,...n}),l=!0,c=!0;for(let f of s){let u=typeof t=="function"?t(f,r[f],n[f],o):t[f](r[f],n[f],o);if(gr(u))r[f]!==void 0&&(i[f]=r[f]);else if(Nr(u))if(e.onEmpty==="omit")l=!1,c=!1;else return Xf;else u!==void 0&&(i[f]=u),l&&(l=u===r[f]),c&&(c=u===n[f])}return l?c?Qe():r:c?n:i};var fC=t=>{let e=Te(t);if(e.length===1){let n=e[0];return`${n==="/"?"":`At ${n}: `}Intersection of ${ob[t[n].kind](t[n])} results in an unsatisfiable type`}let r=`
|
|
"Intersection results in unsatisfiable types at the following paths:
|
|
`;for(let n in t)r+=` ${n}: ${ob[t[n].kind](t[n])}
|
|
`;return r},Qf=(t,e,r)=>`${t.length?`At ${t}: `:""}${e} ${r?`${r} `:""}results in an unsatisfiable type`;a();a();var Fl={Array,Date,Error,Function,Map,RegExp,Set,Object,String,Number,Boolean,WeakMap,WeakSet,Promise},Ls=(t,e)=>{if(je(t)!=="object")return;let r=e??Fl,n=Object.getPrototypeOf(t);for(;n?.constructor&&(!r[n.constructor.name]||!(t instanceof r[n.constructor.name]));)n=Object.getPrototypeOf(n);return n?.constructor?.name};var vo=t=>Array.isArray(t),ib={Object:"an object",Array:"an array",Function:"a function",Date:"a Date",RegExp:"a RegExp",Error:"an Error",Map:"a Map",Set:"a Set",String:"a String object",Number:"a Number object",Boolean:"a Boolean object",Promise:"a Promise",WeakMap:"a WeakMap",WeakSet:"a WeakSet"},ep=t=>{let e=Object(t).name;return e&&mr(e,Fl)&&Fl[e]===t?e:void 0};a();a();a();var pC=hr((t,e,r)=>t===e?Qe():t instanceof e?t:e instanceof t?e:r.addDisjoint("class",t,e)),dC=(t,e)=>typeof t=="string"?Ls(e.data)===t||!e.problems.add("class",t):e.data instanceof t||!e.problems.add("class",t);a();var tp=(t,e)=>{if(Array.isArray(t)){if(Array.isArray(e)){let r=a8(t,e);return r.length===t.length?r.length===e.length?Qe():t:r.length===e.length?e:r}return t.includes(e)?t:[...t,e]}return Array.isArray(e)?e.includes(t)?e:[...e,t]:t===e?Qe():[t,e]},a8=(t,e)=>{let r=[...t];for(let n of e)t.includes(n)||r.push(n);return r};a();var mC=hr((t,e)=>t===e?Qe():Math.abs(t*e/l8(t,e))),l8=(t,e)=>{let r,n=t,o=e;for(;o!==0;)r=o,o=n%o,n=r;return n},hC=(t,e)=>e.data%t===0||!e.problems.add("divisor",t);a();var $l=t=>t[0]==="?",rp=t=>t[0]==="!",on={index:"[index]"},wo=t=>$l(t)||rp(t)?t[1]:t,c8=t=>{if(typeof t.length=="object"&&rp(t.length)&&typeof t.length[1]!="string"&&op(t.length[1],"number"))return t.length[1].number.value},gC=hr((t,e,r)=>{let n=u8(t,e,r);if(typeof n=="symbol")return n;let o=c8(n);if(o===void 0||!(on.index in n))return n;let{[on.index]:i,...s}=n,l=wo(i);for(let c=0;c<o;c++){if(!s[c]){s[c]=l;continue}let f=wo(s[c]);r.path.push(`${c}`);let u=np(f,l,r);if(r.path.pop(),Nr(u))return u;!gr(u)&&u!==f&&(s[c]=u)}return s}),u8=Ms((t,e,r,n)=>{if(e===void 0)return r===void 0?Qe():r;if(r===void 0)return e;n.path.push(t);let o=np(wo(e),wo(r),n);n.path.pop();let i=$l(e)&&$l(r);return Nr(o)&&i?{}:o},{onEmpty:"bubble"}),yC=(t,e,r)=>{let n=r.type.config?.keys??r.type.scope.config.keys;return n==="loose"?f8(t,e,r):p8(n,t,e,r)},f8=(t,e,r)=>{for(let n in e){let o=e[n];r.path.push(n),n===on.index?t.push(["indexProp",nn(wo(o),r)]):$l(o)?t.push(["optionalProp",[n,nn(o[1],r)]]):rp(o)?t.push(["prerequisiteProp",[n,nn(o[1],r)]]):t.push(["requiredProp",[n,nn(o,r)]]),r.path.pop()}},p8=(t,e,r,n)=>{let o={required:{},optional:{}};for(let i in r){let s=r[i];n.path.push(i),i===on.index?o.index=nn(wo(s),n):$l(s)?o.optional[i]=nn(s[1],n):rp(s)?e.push(["prerequisiteProp",[i,nn(s[1],n)]]):o.required[i]=nn(s,n),n.path.pop()}e.push([`${t}Props`,o])};a();a();function d8(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var sb=t=>typeof t=="string"||Array.isArray(t)?t.length:typeof t=="number"?t:0,m8=t=>typeof t=="string"?"characters":Array.isArray(t)?"items long":"",ip=class{toString(){return De(this.value)}get domain(){return je(this.value)}get size(){return sb(this.value)}get units(){return m8(this.value)}get className(){return Object(this.value).constructor.name}constructor(e){d8(this,"value",void 0),this.value=e}};var sp={">":!0,">=":!0},ab={"<":!0,"<=":!0},Ml=t=>"comparator"in t,vC=hr((t,e,r)=>{if(Ml(t))return Ml(e)?t.limit===e.limit?Qe():r.addDisjoint("range",t,e):bC(e,t.limit)?t:r.addDisjoint("range",t,e);if(Ml(e))return bC(t,e.limit)?e:r.addDisjoint("range",t,e);let n=js("min",t.min,e.min),o=js("max",t.max,e.max);return n==="l"?o==="r"?js("min",t.min,e.max)==="l"?r.addDisjoint("range",t,e):{min:t.min,max:e.max}:t:n==="r"?o==="l"?js("max",t.max,e.min)==="l"?r.addDisjoint("range",t,e):{min:e.min,max:t.max}:e:o==="l"?t:o==="r"?e:Qe()}),bC=(t,e)=>Ml(t)?e===t.limit:h8(t.min,e)&&g8(t.max,e),h8=(t,e)=>!t||e>t.limit||e===t.limit&&!Ll(t.comparator),g8=(t,e)=>!t||e<t.limit||e===t.limit&&!Ll(t.comparator),wC=(t,e,r)=>{let n=r.lastDomain==="string"?"characters":r.lastDomain==="object"?"items long":void 0;if(Ml(e))return t.push(["bound",n?{...e,units:n}:e]);e.min&&t.push(["bound",n?{...e.min,units:n}:e.min]),e.max&&t.push(["bound",n?{...e.max,units:n}:e.max])},xC=(t,e)=>y8[t.comparator](sb(e.data),t.limit)||!e.problems.add("bound",t),y8={"<":(t,e)=>t<e,">":(t,e)=>t>e,"<=":(t,e)=>t<=e,">=":(t,e)=>t>=e,"==":(t,e)=>t===e},js=(t,e,r)=>e?r?e.limit===r.limit?Ll(e.comparator)?Ll(r.comparator)?"=":"l":Ll(r.comparator)?"r":"=":t==="min"?e.limit>r.limit?"l":"r":e.limit<r.limit?"l":"r":"l":r?"r":"=",Ll=t=>t.length===1;a();var lb={},cb=t=>(lb[t]||(lb[t]=new RegExp(t)),lb[t]),EC=(t,e)=>cb(t).test(e.data)||!e.problems.add("regex",`/${t}/`),SC=hr(tp);var _C=(t,e,r)=>"value"in t?"value"in e?t.value===e.value?Qe():r.addDisjoint("value",t.value,e.value):IC(t.value,e,r)?t:r.addDisjoint("leftAssignability",t,e):"value"in e?IC(e.value,t,r)?e:r.addDisjoint("rightAssignability",t,e):v8(t,e,r),b8=hr(tp),v8=Ms({divisor:mC,regex:SC,props:gC,class:pC,range:vC,narrow:b8},{onEmpty:"bubble"}),ub=(t,e)=>{let r=[],n;for(n in t)w8[n](r,t[n],e);return r.sort((o,i)=>jl[o[0]]-jl[i[0]])},w8={regex:(t,e)=>{for(let r of rn(e))t.push(["regex",r])},divisor:(t,e)=>{t.push(["divisor",e])},range:wC,class:(t,e)=>{t.push(["class",e])},props:yC,narrow:(t,e)=>{for(let r of rn(e))t.push(["narrow",r])},value:(t,e)=>{t.push(["value",e])}},jl={config:-1,domain:0,value:0,domains:0,branches:0,switch:0,alias:0,class:0,regex:1,divisor:1,bound:1,prerequisiteProp:2,distilledProps:3,strictProps:3,requiredProp:3,optionalProp:3,indexProp:3,narrow:4,morph:5},IC=(t,e,r)=>!r.type.scope.type(["node",{[r.domain]:e}])(t).problems;var fb=t=>t?.lBranches!==void 0,TC=(t,e,r)=>{let n={lBranches:t,rBranches:e,lExtendsR:[],rExtendsL:[],equalities:[],distinctIntersections:[]},o=e.map(i=>({condition:i,distinct:[]}));return t.forEach((i,s)=>{let l=!1,c=o.map((f,u)=>{if(l||!f.distinct)return null;let d=f.condition,m=Bl(i,d,r);return Nr(m)?null:m===i?(n.lExtendsR.push(s),l=!0,null):m===d?(n.rExtendsL.push(u),f.distinct=null,null):gr(m)?(n.equalities.push([s,u]),l=!0,f.distinct=null,null):yo(m,"object")?m:Oe(`Unexpected predicate intersection result of type '${je(m)}'`)});if(!l)for(let f=0;f<o.length;f++)c[f]&&o[f].distinct?.push(c[f])}),n.distinctIntersections=o.flatMap(i=>i.distinct??[]),n},pb=t=>"rules"in t,ql=(t,e)=>{if(pb(t)){let r=ub(t.rules,e);if(t.morph)if(typeof t.morph=="function")r.push(["morph",t.morph]);else for(let n of t.morph)r.push(["morph",n]);return r}return ub(t,e)},OC=t=>t.rules??t,Bl=(t,e,r)=>{let n=OC(t),o=OC(e),i=_C(n,o,r);return"morph"in t?"morph"in e?t.morph===e.morph?gr(i)||Nr(i)?i:{rules:i,morph:t.morph}:r.lastOperator==="&"?xe(Qf(r.path,"Intersection","of morphs")):{}:Nr(i)?i:{rules:gr(i)?t.rules:i,morph:t.morph}:"morph"in e?Nr(i)?i:{rules:gr(i)?e.rules:i,morph:e.morph}:i};a();a();var CC=t=>`${t==="/"?"A":`At ${t}, a`} union including one or more morphs must be discriminatable`;var AC=(t,e)=>{let r=E8(t,e),n=t.map((o,i)=>i);return RC(t,n,r,e)},RC=(t,e,r,n)=>{if(e.length===1)return ql(t[e[0]],n);let o=I8(e,r);if(!o)return[["branches",e.map(s=>mb(t[s],n.type.scope)?xe(CC(`${n.path}`)):ql(t[s],n))]];let i={};for(let s in o.indexCases){let l=o.indexCases[s];i[s]=RC(t,l,r,n),s!=="default"&&zl(i[s],o.path,o,n)}return[["switch",{path:o.path,kind:o.kind,cases:i}]]},zl=(t,e,r,n)=>{for(let o=0;o<t.length;o++){let[i,s]=t[o];if(e.length){if((i==="requiredProp"||i==="prerequisiteProp"||i==="optionalProp")&&s[0]===e[0]){if(typeof s[1]=="string"){if(r.kind!=="domain")return db(r);t.splice(o,1);return}zl(s[1],e.slice(1),r,n),s[1].length===0&&t.splice(o,1);return}}else if(r.kind==="domain"){if(i==="domain"||i==="domains"){t.splice(o,1);return}else if(i==="class"||i==="value")return}else if(r.kind===i){t.splice(o,1);return}if(i==="domains"){if(tC(s)!==1||!s.object)return db(r);zl(s.object,e,r,n);return}else if(i==="switch"){for(let l in s.cases)zl(s.cases[l],e,r,n);return}else if(i==="branches"){for(let l of s)zl(l,e,r,n);return}}return db(r)},db=t=>Oe(`Unexpectedly failed to discriminate ${t.kind} at path '${t.path}'`),x8={domain:!0,class:!0,value:!0},E8=(t,e)=>{let r={disjointsByPair:{},casesByDisjoint:{}};for(let n=0;n<t.length-1;n++)for(let o=n+1;o<t.length;o++){let i=`${n}/${o}`,s=[];r.disjointsByPair[i]=s;let l=new bo(e.type,"|");Bl(t[n],t[o],l);for(let c in l.disjoints){if(c.includes(on.index))continue;let{l:f,r:u,kind:d}=l.disjoints[c];if(!mr(d,x8))continue;let m=kC(d,f),h=kC(d,u);if(m===void 0||h===void 0)continue;let y=c==="/"?d:`${c}/${d}`;if(s.push(y),!r.casesByDisjoint[y]){r.casesByDisjoint[y]={[m]:[n],[h]:[o]};continue}let w=r.casesByDisjoint[y],v=w[m];v?v.includes(n)||v.push(n):w[m]=[n];let x=w[h];x?x.includes(o)||x.push(o):w[h]=[o]}}return r},S8=t=>{let e=Xe.fromString(t);return[e,e.pop()]},I8=(t,e)=>{let r;for(let n=0;n<t.length-1;n++){let o=t[n];for(let i=n+1;i<t.length;i++){let s=t[i],l=e.disjointsByPair[`${o}/${s}`];for(let c of l){let f=e.casesByDisjoint[c],u={},d=[...t],m=0;for(let y in f){let w=f[y].filter(v=>{let x=t.indexOf(v);if(x!==-1)return delete d[x],!0});w.length!==0&&(u[y]=w,m++)}let h=Te(d);if(h.length&&(u.default=h.map(y=>parseInt(y))),!r||m>r.score){let[y,w]=S8(c);if(r={path:y,kind:w,indexCases:u,score:m},m===t.length)return r}}}}return r},kC=(t,e)=>{switch(t){case"value":return NC(e);case"domain":return e;case"class":return ep(e);default:return}},NC=t=>{let e=je(t);return e==="object"||e==="symbol"?void 0:nb(t)},_8={value:t=>NC(t)??"default",class:t=>Ls(t)??"default",domain:je},DC=(t,e)=>_8[t](e),mb=(t,e)=>"morph"in t?!0:"props"in t?Object.values(t.props).some(r=>O8(wo(r),e)):!1,O8=(t,e)=>typeof t=="string"?e.resolve(t).includesMorph:Object.values(e.resolveTypeNode(t)).some(r=>r===!0?!1:vo(r)?r.some(n=>mb(n,e)):mb(r,e));var qs=t=>t===!0?{}:t,PC=(t,e,r)=>{if(t===!0&&e===!0)return Qe();if(!vo(t)&&!vo(e)){let s=Bl(qs(t),qs(e),r);return s===t?t:s===e?e:s}let n=rn(qs(t)),o=rn(qs(e)),i=TC(n,o,r);return i.equalities.length===n.length&&i.equalities.length===o.length?Qe():i.lExtendsR.length+i.equalities.length===n.length?t:i.rExtendsL.length+i.equalities.length===o.length?e:i},FC=(t,e,r,n)=>{n.domain=t;let o=PC(e,r,n);if(!fb(o))return o;let i=[...o.distinctIntersections,...o.equalities.map(s=>o.lBranches[s[0]]),...o.lExtendsR.map(s=>o.lBranches[s]),...o.rExtendsL.map(s=>o.rBranches[s])];return i.length===0&&n.addDisjoint("union",o.lBranches,o.rBranches),i.length===1?i[0]:i},$C=(t,e,r,n)=>{let o=new bo(n,"|"),i=PC(e,r,o);if(!fb(i))return gr(i)||i===e?r:i===r?e:t==="boolean"?!0:[qs(e),qs(r)];let s=[...i.lBranches.filter((l,c)=>!i.lExtendsR.includes(c)&&!i.equalities.some(f=>f[0]===c)),...i.rBranches.filter((l,c)=>!i.rExtendsL.includes(c)&&!i.equalities.some(f=>f[1]===c))];return s.length===1?s[0]:s},hb=(t,e)=>t===!0?[]:vo(t)?AC(t,e):ql(t,e),MC=t=>typeof t=="object"&&"value"in t;var Ul=t=>"config"in t,np=(t,e,r)=>{r.domain=void 0;let n=r.type.scope.resolveTypeNode(t),o=r.type.scope.resolveTypeNode(e),i=T8(n,o,r);return typeof i=="object"&&!Rl(i)?Rl(r.disjoints)?cC():r.addDisjoint("domain",Te(n),Te(o)):i===n?t:i===o?e:i},T8=Ms((t,e,r,n)=>{if(e===void 0)return r===void 0?Oe(Yf):void 0;if(r!==void 0)return FC(t,e,r,n)},{onEmpty:"omit"}),xo=(t,e,r)=>{let n=new bo(r,"&"),o=np(t,e,n);return Nr(o)?xe(fC(n.disjoints)):gr(o)?t:o},ap=(t,e,r)=>{let n=r.scope.resolveTypeNode(t),o=r.scope.resolveTypeNode(e),i={},s=Te({...n,...o});for(let l of s)i[l]=$s(n,l)?$s(o,l)?$C(l,n[l],o[l],r):n[l]:$s(o,l)?o[l]:Oe(Yf);return i},C8=t=>t[0]&&(t[0][0]==="value"||t[0][0]==="class"),gb=t=>{let e={type:t,path:new Xe,lastDomain:"undefined"};return nn(t.node,e)},nn=(t,e)=>{if(typeof t=="string")return e.type.scope.resolve(t).flat;let r=Ul(t),n=k8(r?t.node:t,e);return r?[["config",{config:eC(t.config),node:n}]]:n},k8=(t,e)=>{let r=Te(t);if(r.length===1){let o=r[0],i=t[o];if(i===!0)return o;e.lastDomain=o;let s=hb(i,e);return C8(s)?s:[["domain",o],...s]}let n={};for(let o of r)e.lastDomain=o,n[o]=hb(t[o],e);return[["domains",n]]},op=(t,e)=>A8(t,e)&&MC(t[e]),A8=(t,e)=>{let r=Te(t);return r.length===1&&r[0]===e},Bs=t=>({object:{class:Array,props:{[on.index]:t}}});a();a();a();a();a();function yb(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Pe=class{shift(){return this.chars[this.i++]??""}get lookahead(){return this.chars[this.i]??""}shiftUntil(e){let r="";for(;this.lookahead;){if(e(this,r))if(r[r.length-1]===Pe.escapeToken)r=r.slice(0,-1);else break;r+=this.shift()}return r}shiftUntilNextTerminator(){return this.shiftUntil(Pe.lookaheadIsNotWhitespace),this.shiftUntil(Pe.lookaheadIsTerminator)}get unscanned(){return this.chars.slice(this.i,this.chars.length).join("")}lookaheadIs(e){return this.lookahead===e}lookaheadIsIn(e){return this.lookahead in e}constructor(e){yb(this,"chars",void 0),yb(this,"i",void 0),yb(this,"finalized",!1),this.chars=[...e],this.i=0}};(function(t){var e=t.lookaheadIsTerminator=m=>m.lookahead in o,r=t.lookaheadIsNotWhitespace=m=>m.lookahead!==d,n=t.comparatorStartChars={"<":!0,">":!0,"=":!0},o=t.terminatingChars={...n,"|":!0,"&":!0,")":!0,"[":!0,"%":!0," ":!0},i=t.comparators={"<":!0,">":!0,"<=":!0,">=":!0,"==":!0},s=t.oneCharComparators={"<":!0,">":!0},l=t.comparatorDescriptions={"<":"less than",">":"more than","<=":"at most",">=":"at least","==":"exactly"},c=t.invertedComparators={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},f=t.branchTokens={"|":!0,"&":!0},u=t.escapeToken="\\",d=t.whiteSpaceToken=" "})(Pe||(Pe={}));function R8(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function N8(t,e){return e.get?e.get.call(t):e.value}function D8(t,e,r){if(e.set)e.set.call(t,r);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=r}}function LC(t,e,r){if(!e.has(t))throw new TypeError("attempted to "+r+" private field on non-instance");return e.get(t)}function lp(t,e){var r=LC(t,e,"get");return N8(t,r)}function P8(t,e,r){R8(t,e),e.set(t,r)}function F8(t,e,r){var n=LC(t,e,"set");return D8(t,n,r),r}function kn(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var vb=class extends TypeError{constructor(e){super(`${e}`),kn(this,"cause",void 0),this.cause=e}},wi=class{toString(){return this.message}get message(){return this.writers.addContext(this.reason,this.path)}get reason(){return this.writers.writeReason(this.mustBe,new ip(this.data))}get mustBe(){return typeof this.writers.mustBe=="string"?this.writers.mustBe:this.writers.mustBe(this.source)}constructor(e,r,n,o,i){kn(this,"code",void 0),kn(this,"path",void 0),kn(this,"data",void 0),kn(this,"source",void 0),kn(this,"writers",void 0),kn(this,"parts",void 0),this.code=e,this.path=r,this.data=n,this.source=o,this.writers=i,this.code==="multi"&&(this.parts=this.source)}},zs=new WeakMap,wb=class extends Array{mustBe(e,r){return this.add("custom",e,r)}add(e,r,n){let o=Xe.from(n?.path??lp(this,zs).path),i=n&&"data"in n?n.data:lp(this,zs).data,s=new wi(e,o,i,r,lp(this,zs).getProblemConfig(e));return this.addProblem(s),s}addProblem(e){let r=`${e.path}`,n=this.byPath[r];if(n)if(n.parts)n.parts.push(e);else{let o=new wi("multi",n.path,n.data,[n,e],lp(this,zs).getProblemConfig("multi")),i=this.indexOf(n);this[i===-1?this.length:i]=o,this.byPath[r]=o}else this.byPath[r]=e,this.push(e);this.count++}get summary(){return`${this}`}toString(){return this.join(`
|
|
`)}throw(){throw new vb(this)}constructor(e){super(),kn(this,"byPath",{}),kn(this,"count",0),P8(this,zs,{writable:!0,value:void 0}),F8(this,zs,e)}},cp=wb,$8=t=>t[0].toUpperCase()+t.slice(1),xb=t=>t.map(e=>Qy[e]),jC=t=>t.map(e=>ib[e]),bb=t=>{if(t.length===0)return"never";if(t.length===1)return t[0];let e="";for(let r=0;r<t.length-1;r++)e+=t[r],r<t.length-2&&(e+=", ");return e+=` or ${t[t.length-1]}`,e},bi=(t,e)=>`must be ${t}${e&&` (was ${e})`}`,qC=(t,e)=>e.length===0?$8(t):e.length===1&&Nl(e[0])?`Item at index ${e[0]} ${t}`:`${e} ${t}`,vi={divisor:{mustBe:t=>t===1?"an integer":`a multiple of ${t}`},class:{mustBe:t=>{let e=ep(t);return e?ib[e]:`an instance of ${t.name}`},writeReason:(t,e)=>bi(t,e.className)},domain:{mustBe:t=>Qy[t],writeReason:(t,e)=>bi(t,e.domain)},missing:{mustBe:()=>"defined",writeReason:t=>bi(t,"")},extraneous:{mustBe:()=>"removed",writeReason:t=>bi(t,"")},bound:{mustBe:t=>`${Pe.comparatorDescriptions[t.comparator]} ${t.limit}${t.units?` ${t.units}`:""}`,writeReason:(t,e)=>bi(t,`${e.size}`)},regex:{mustBe:t=>`a string matching ${t}`},value:{mustBe:De},branches:{mustBe:t=>bb(t.map(e=>`${e.path} must be ${e.parts?bb(e.parts.map(r=>r.mustBe)):e.mustBe}`)),writeReason:(t,e)=>`${t} (was ${e})`,addContext:(t,e)=>e.length?`At ${e}, ${t}`:t},multi:{mustBe:t=>"\u2022 "+t.map(e=>e.mustBe).join(`
|
|
\u2022 `),writeReason:(t,e)=>`${e} must be...
|
|
${t}`,addContext:(t,e)=>e.length?`At ${e}, ${t}`:t},custom:{mustBe:t=>t},cases:{mustBe:t=>bb(t)}},BC=Te(vi),M8=()=>{let t={},e;for(e of BC)t[e]={mustBe:vi[e].mustBe,writeReason:vi[e].writeReason??bi,addContext:vi[e].addContext??qC};return t},L8=M8(),zC=t=>{if(!t)return L8;let e={};for(let r of BC)e[r]={mustBe:t[r]?.mustBe??vi[r].mustBe,writeReason:t[r]?.writeReason??vi[r].writeReason??t.writeReason??bi,addContext:t[r]?.addContext??vi[r].addContext??t.addContext??qC};return e};function j8(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function q8(t,e){return e.get?e.get.call(t):e.value}function B8(t,e,r){if(e.set)e.set.call(t,r);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=r}}function HC(t,e,r){if(!e.has(t))throw new TypeError("attempted to "+r+" private field on non-instance");return e.get(t)}function Eb(t,e){var r=HC(t,e,"get");return q8(t,r)}function z8(t,e,r){j8(t,e),e.set(t,r)}function U8(t,e,r){var n=HC(t,e,"set");return B8(t,n,r),r}function sn(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var W8=()=>({mustBe:[],writeReason:[],addContext:[],keys:[]}),H8=["mustBe","writeReason","addContext"],KC=(t,e)=>{let r=new Sb(e,t);up(t.flat,r);let n=new VC(r);if(r.problems.count)n.problems=r.problems;else{for(let[o,i]of r.entriesToPrune)delete o[i];n.data=r.data}return n},VC=class{constructor(){sn(this,"data",void 0),sn(this,"problems",void 0)}},Wl=new WeakMap,Sb=class{getProblemConfig(e){let r={};for(let n of H8)r[n]=this.traversalConfig[n][0]??this.rootScope.config.codes[e][n];return r}traverseConfig(e,r){for(let o of e)this.traversalConfig[o[0]].unshift(o[1]);let n=up(r,this);for(let o of e)this.traversalConfig[o[0]].shift();return n}traverseKey(e,r){let n=this.data;this.data=this.data[e],this.path.push(e);let o=up(r,this);return this.path.pop(),n[e]!==this.data&&(n[e]=this.data),this.data=n,o}traverseResolution(e){let r=this.type.scope.resolve(e),n=r.qualifiedName,o=this.data,i=yo(o,"object");if(i){let c=Eb(this,Wl)[n];if(c){if(c.includes(o))return!0;c.push(o)}else Eb(this,Wl)[n]=[o]}let s=this.type;this.type=r;let l=up(r.flat,this);return this.type=s,i&&Eb(this,Wl)[n].pop(),l}traverseBranches(e){let r=this.failFast;this.failFast=!0;let n=this.problems,o=new cp(this);this.problems=o;let i=this.path,s=this.entriesToPrune,l=!1;for(let c of e)if(this.path=new Xe,this.entriesToPrune=[],fp(c,this)){l=!0,s.push(...this.entriesToPrune);break}return this.path=i,this.entriesToPrune=s,this.problems=n,this.failFast=r,l||!this.problems.add("branches",o)}constructor(e,r){sn(this,"data",void 0),sn(this,"type",void 0),sn(this,"path",void 0),sn(this,"problems",void 0),sn(this,"entriesToPrune",void 0),sn(this,"failFast",void 0),sn(this,"traversalConfig",void 0),sn(this,"rootScope",void 0),z8(this,Wl,{writable:!0,value:void 0}),this.data=e,this.type=r,this.path=new Xe,this.problems=new cp(this),this.entriesToPrune=[],this.failFast=!1,this.traversalConfig=W8(),U8(this,Wl,{}),this.rootScope=r.scope}},up=(t,e)=>typeof t=="string"?je(e.data)===t||!e.problems.add("domain",t):fp(t,e),fp=(t,e)=>{let r=!0;for(let n=0;n<t.length;n++){let[o,i]=t[n],s=K8[o](i,e);if(r&&(r=s),!r&&(e.failFast||n<t.length-1&&jl[o]<jl[t[n+1][0]]))return!1}return r},UC=(t,e)=>t[0]in e.data?e.traverseKey(t[0],t[1]):(e.problems.add("missing",void 0,{path:e.path.concat(t[0]),data:void 0}),!1),WC=t=>(e,r)=>{let n=!0,o={...e.required};for(let s in r.data)if(e.required[s]?(n=r.traverseKey(s,e.required[s])&&n,delete o[s]):e.optional[s]?n=r.traverseKey(s,e.optional[s])&&n:e.index&&Hf.test(s)?n=r.traverseKey(s,e.index)&&n:t==="distilledProps"?r.failFast?r.entriesToPrune.push([r.data,s]):delete r.data[s]:(n=!1,r.problems.add("extraneous",r.data[s],{path:r.path.concat(s)})),!n&&r.failFast)return!1;let i=Object.keys(o);if(i.length){for(let s of i)r.problems.add("missing",void 0,{path:r.path.concat(s)});return!1}return n},K8={regex:EC,divisor:hC,domains:(t,e)=>{let r=t[je(e.data)];return r?fp(r,e):!e.problems.add("cases",xb(Te(t)))},domain:(t,e)=>je(e.data)===t||!e.problems.add("domain",t),bound:xC,optionalProp:(t,e)=>t[0]in e.data?e.traverseKey(t[0],t[1]):!0,requiredProp:UC,prerequisiteProp:UC,indexProp:(t,e)=>{if(!Array.isArray(e.data))return e.problems.add("class",Array),!1;let r=!0;for(let n=0;n<e.data.length;n++)if(r=e.traverseKey(`${n}`,t)&&r,!r&&e.failFast)return!1;return r},branches:(t,e)=>e.traverseBranches(t),switch:(t,e)=>{let r=rC(e.data,t.path),n=DC(t.kind,r);if($s(t.cases,n))return fp(t.cases[n],e);let o=Te(t.cases),i=e.path.concat(t.path),s=t.kind==="value"?o:t.kind==="domain"?xb(o):t.kind==="class"?jC(o):Oe(`Unexpectedly encountered rule kind '${t.kind}' during traversal`);return e.problems.add("cases",s,{path:i,data:r}),!1},alias:(t,e)=>e.traverseResolution(t),class:dC,narrow:(t,e)=>{let r=e.problems.count,n=t(e.data,e.problems);return!n&&e.problems.count===r&&e.problems.mustBe(t.name?`valid according to ${t.name}`:"valid"),n},config:({config:t,node:e},r)=>r.traverseConfig(t,e),value:(t,e)=>e.data===t||!e.problems.add("value",t),morph:(t,e)=>{let r=t(e.data,e.problems);if(e.problems.length)return!1;if(r instanceof wi)return e.problems.addProblem(r),!1;if(r instanceof VC){if(r.problems){for(let n of r.problems)e.problems.addProblem(n);return!1}return e.data=r.data,!0}return e.data=r,!0},distilledProps:WC("distilledProps"),strictProps:WC("strictProps")};a();var Eo=new Proxy(()=>Eo,{get:()=>Eo});var Ib=(t,e,r,n)=>{let o={node:t,flat:[["alias",t]],allows:l=>!i(l).problems,assert:l=>{let c=i(l);return c.problems?c.problems.throw():c.data},infer:Eo,inferIn:Eo,qualifiedName:V8(t)?n.getAnonymousQualifiedName(t):`${n.name}.${t}`,definition:e,scope:n,includesMorph:!1,config:r},i={[t]:l=>KC(i,l)}[t];return Object.assign(i,o)},_b=t=>t?.infer===Eo,V8=t=>t[0]==="\u03BB";a();a();var GC=t=>{let e=t.scanner.shiftUntilNextTerminator();t.setRoot(G8(t,e))},G8=(t,e)=>t.ctx.type.scope.addParsedReferenceIfResolvable(e,t.ctx)?e:Z8(e)??t.error(e===""?Ob(t):J8(e)),Z8=t=>{let e=Pl(t);if(e!==void 0)return{number:{value:e}};let r=tb(t);if(r!==void 0)return{bigint:{value:r}}},J8=t=>`'${t}' is unresolvable`,Ob=t=>{let e=t.previousOperator();return e?Tb(e,t.scanner.unscanned):Y8(t.scanner.unscanned)},Tb=(t,e)=>`Token '${t}' requires a right operand${e?` before '${e}'`:""}`,Y8=t=>`Expected an expression${t?` before '${t}'`:""}`;a();var Cb=(t,e)=>({node:e.type.scope.resolveTypeNode(et(t[0],e)),config:t[2]});a();a();var yr=t=>Object.isFrozen(t)?t:Array.isArray(t)?Object.freeze(t.map(yr)):X8(t),X8=t=>{for(let e in t)yr(t[e]);return t};var Q8=yr({regex:Dl.source}),eW=yr({range:{min:{comparator:">=",limit:0}},divisor:1}),ZC=(t,e)=>{let r=e.type.scope.resolveNode(et(t[1],e)),n=Te(r).map(u=>rW(u,r[u])),o=JC(n);if(!o.length)return Qf(e.path,"keyof");let i={};for(let u of o){let d=typeof u;if(d==="string"||d==="number"||d==="symbol"){var s,l;(s=i)[l=d]??(s[l]=[]),i[d].push({value:u})}else if(u===Dl){var c,f;(c=i).string??(c.string=[]),i.string.push(Q8),(f=i).number??(f.number=[]),i.number.push(eW)}else return Oe(`Unexpected keyof key '${De(u)}'`)}return Object.fromEntries(Object.entries(i).map(([u,d])=>[u,d.length===1?d[0]:d]))},tW={bigint:yi(0n),boolean:yi(!1),null:[],number:yi(0),object:[],string:yi(""),symbol:yi(Symbol()),undefined:[]},rW=(t,e)=>t!=="object"||e===!0?tW[t]:JC(rn(e).map(r=>nW(r))),JC=t=>{if(!t.length)return[];let e=t[0];for(let r=1;r<t.length;r++)e=e.filter(n=>t[r].includes(n));return e},nW=t=>{let e=[];if("props"in t)for(let r of Object.keys(t.props))r===on.index?e.push(Dl):e.includes(r)||(e.push(r),Dl.test(r)&&e.push(Kf(r,`Unexpectedly failed to parse an integer from key '${r}'`)));if("class"in t){let r=typeof t.class=="string"?Fl[t.class]:t.class;for(let n of yi(r.prototype))e.includes(n)||e.push(n)}return e};a();var XC=(t,e)=>{if(typeof t[2]!="function")return xe(oW(t[2]));let r=et(t[0],e),n=e.type.scope.resolveTypeNode(r),o=t[2];e.type.includesMorph=!0;let i,s={};for(i in n){let l=n[i];l===!0?s[i]={rules:{},morph:o}:typeof l=="object"?s[i]=vo(l)?l.map(c=>YC(c,o)):YC(l,o):Oe(`Unexpected predicate value for domain '${i}': ${De(l)}`)}return s},YC=(t,e)=>pb(t)?{...t,morph:t.morph?Array.isArray(t.morph)?[...t.morph,e]:[t.morph,e]:e}:{rules:t,morph:e},oW=t=>`Morph expression requires a function following '|>' (was ${typeof t})`;a();a();var QC=t=>`Expected a Function or Record<Domain, Function> operand (${De(t)} was invalid)`,ek=(t,e,r,n)=>{let o=Te(e);if(!yo(t,"object"))return xe(QC(t));let i={};if(typeof t=="function"){let s={[n]:t};for(let l of o)i[l]=s}else for(let s of o){if(t[s]===void 0)continue;let l={[n]:t[s]};if(typeof l[n]!="function")return xe(QC(l));i[s]=l}return i};var tk=(t,e)=>{let r=et(t[0],e),n=e.type.scope.resolveNode(r),o=Ul(n),i=o?n.node:n,s=xo(r,ek(t[2],i,e,"narrow"),e.type);return o?{config:n.config,node:s}:s};var nk=(t,e)=>{if(sW(t))return ok[t[1]](t,e);if(aW(t))return ik[t[0]](t,e);let r={length:["!",{number:{value:t.length}}]};for(let n=0;n<t.length;n++)e.path.push(`${n}`),r[n]=et(t[n],e),e.path.pop();return{object:{class:Array,props:r}}},rk=(t,e)=>{if(t[2]===void 0)return xe(Tb(t[1],""));let r=et(t[0],e),n=et(t[2],e);return t[1]==="&"?xo(r,n,e.type):ap(r,n,e.type)},iW=(t,e)=>Bs(et(t[0],e));var sW=t=>ok[t[1]]!==void 0,ok={"|":rk,"&":rk,"[]":iW,"=>":tk,"|>":XC,":":Cb},ik={keyof:ZC,instanceof:t=>typeof t[1]!="function"?xe(`Expected a constructor following 'instanceof' operator (was ${typeof t[1]}).`):{object:{class:t[1]}},"===":t=>({[je(t[1])]:{value:t[1]}}),node:t=>t[1]},aW=t=>ik[t[0]]!==void 0;a();var sk=(t,e)=>{let r={};for(let n in t){let o=n,i=!1;n[n.length-1]==="?"&&(n[n.length-2]===Pe.escapeToken?o=`${n.slice(0,-2)}?`:(o=n.slice(0,-1),i=!0)),e.path.push(o);let s=et(t[n],e);e.path.pop(),r[o]=i?["?",s]:s}return{object:{props:r}}};a();a();a();var ak=t=>`Unmatched )${t===""?"":` before ${t}`}`,lk="Missing )",ck=(t,e)=>`Left bounds are only valid when paired with right bounds (try ...${e}${t})`,pp=t=>`Left-bounded expressions must specify their limits using < or <= (was ${t})`,uk=(t,e,r,n)=>`An expression may have at most one left bound (parsed ${t}${Pe.invertedComparators[e]}, ${r}${Pe.invertedComparators[n]})`;function Hl(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var dp=class{error(e){return xe(e)}hasRoot(){return this.root!==void 0}resolveRoot(){return this.assertHasRoot(),this.ctx.type.scope.resolveTypeNode(this.root)}rootToString(){return this.assertHasRoot(),De(this.root)}ejectRootIfLimit(){this.assertHasRoot();let e=typeof this.root=="string"?this.ctx.type.scope.resolveNode(this.root):this.root;if(op(e,"number")){let r=e.number.value;return this.root=void 0,r}}ejectRangeIfOpen(){if(this.branches.range){let e=this.branches.range;return delete this.branches.range,e}}assertHasRoot(){if(this.root===void 0)return Oe("Unexpected interaction with unset root")}assertUnsetRoot(){if(this.root!==void 0)return Oe("Unexpected attempt to overwrite root")}setRoot(e){this.assertUnsetRoot(),this.root=e}rootToArray(){this.root=Bs(this.ejectRoot())}intersect(e){this.root=xo(this.ejectRoot(),e,this.ctx.type)}ejectRoot(){this.assertHasRoot();let e=this.root;return this.root=void 0,e}ejectFinalizedRoot(){this.assertHasRoot();let e=this.root;return this.root=lW,e}finalize(){if(this.groups.length)return this.error(lk);this.finalizeBranches(),this.scanner.finalized=!0}reduceLeftBound(e,r){let n=Pe.invertedComparators[r];if(!mr(n,sp))return this.error(pp(r));if(this.branches.range)return this.error(uk(`${this.branches.range.limit}`,this.branches.range.comparator,`${e}`,n));this.branches.range={limit:e,comparator:n}}finalizeBranches(){this.assertRangeUnset(),this.branches.union?(this.pushRootToBranch("|"),this.setRoot(this.branches.union)):this.branches.intersection&&this.setRoot(xo(this.branches.intersection,this.ejectRoot(),this.ctx.type))}finalizeGroup(){this.finalizeBranches();let e=this.groups.pop();if(!e)return this.error(ak(this.scanner.unscanned));this.branches=e}pushRootToBranch(e){this.assertRangeUnset(),this.branches.intersection=this.branches.intersection?xo(this.branches.intersection,this.ejectRoot(),this.ctx.type):this.ejectRoot(),e==="|"&&(this.branches.union=this.branches.union?ap(this.branches.union,this.branches.intersection,this.ctx.type):this.branches.intersection,delete this.branches.intersection)}assertRangeUnset(){if(this.branches.range)return this.error(ck(`${this.branches.range.limit}`,this.branches.range.comparator))}reduceGroupOpen(){this.groups.push(this.branches),this.branches={}}previousOperator(){return this.branches.range?.comparator??this.branches.intersection?"&":this.branches.union?"|":void 0}shiftedByOne(){return this.scanner.shift(),this}constructor(e,r){Hl(this,"ctx",void 0),Hl(this,"scanner",void 0),Hl(this,"root",void 0),Hl(this,"branches",void 0),Hl(this,"groups",void 0),this.ctx=r,this.branches={},this.groups=[],this.scanner=new Pe(e)}},lW=new Proxy({},{get:()=>Oe("Unexpected attempt to access ejected attributes")});a();a();var fk=(t,e)=>{let r=t.scanner.shiftUntil(cW[e]);if(t.scanner.lookahead==="")return t.error(fW(r,e));t.scanner.shift()==="/"?(cb(r),t.setRoot({string:{regex:r}})):t.setRoot({string:{value:r}})},pk={"'":1,'"':1,"/":1},cW={"'":t=>t.lookahead==="'",'"':t=>t.lookahead==='"',"/":t=>t.lookahead==="/"},uW={'"':"double-quote","'":"single-quote","/":"forward slash"},fW=(t,e)=>`${e}${t} requires a closing ${uW[e]}`;var mp=t=>t.scanner.lookahead===""?t.error(Ob(t)):t.scanner.lookahead==="("?t.shiftedByOne().reduceGroupOpen():t.scanner.lookaheadIsIn(pk)?fk(t,t.scanner.shift()):t.scanner.lookahead===" "?mp(t.shiftedByOne()):GC(t);a();a();a();var dk=t=>`Bounded expression ${t} must be a number, string or array`;var mk=(t,e)=>{let r=pW(t,e),n=t.ejectRootIfLimit();return n===void 0?mW(t,r):t.reduceLeftBound(n,r)},pW=(t,e)=>t.scanner.lookaheadIs("=")?`${e}${t.scanner.shift()}`:mr(e,Pe.oneCharComparators)?e:t.error(dW),dW="= is not a valid comparator. Use == to check for equality",mW=(t,e)=>{let r=t.scanner.shiftUntilNextTerminator(),n=Pl(r,yW(e,r+t.scanner.unscanned)),o=t.ejectRangeIfOpen(),i={comparator:e,limit:n},s=o?kb(i,ab)?js("min",o,i)==="l"?t.error(bW({min:o,max:i})):{min:o,max:i}:t.error(pp(e)):gW(i,"==")?i:kb(i,sp)?{min:i}:kb(i,ab)?{max:i}:Oe(`Unexpected comparator '${i.comparator}'`);t.intersect(hW(s,t))},hW=(t,e)=>{let r=e.resolveRoot(),n=Te(r),o={},i={range:t};return n.every(l=>{switch(l){case"string":return o.string=i,!0;case"number":return o.number=i,!0;case"object":return o.object=i,r.object===!0?!1:rn(r.object).every(c=>"class"in c&&c.class===Array);default:return!1}})||e.error(dk(e.rootToString())),o},gW=(t,e)=>t.comparator===e,kb=(t,e)=>t.comparator in e,yW=(t,e)=>`Comparator ${t} must be followed by a number literal (was '${e}')`,bW=t=>`${Jf(t)} is empty`;a();a();var hk=t=>`Divisibility operand ${t} must be a number`;var yk=t=>{let e=t.scanner.shiftUntilNextTerminator(),r=Kf(e,gk(e));r===0&&t.error(gk(0));let n=Te(t.resolveRoot());n.length===1&&n[0]==="number"?t.intersect({number:{divisor:r}}):t.error(hk(t.rootToString()))},gk=t=>`% operator must be followed by a non-zero integer literal (was ${t})`;var Ab=t=>{let e=t.scanner.shift();return e===""?t.finalize():e==="["?t.scanner.shift()==="]"?t.rootToArray():t.error(wW):mr(e,Pe.branchTokens)?t.pushRootToBranch(e):e===")"?t.finalizeGroup():mr(e,Pe.comparatorStartChars)?mk(t,e):e==="%"?yk(t):e===" "?Ab(t):Oe(vW(e))},vW=t=>`Unexpected character '${t}'`,wW="Missing expected ']'";var bk=(t,e)=>e.type.scope.parseCache.get(t)??e.type.scope.parseCache.set(t,xW(t,e)??EW(t,e)),xW=(t,e)=>{if(e.type.scope.addParsedReferenceIfResolvable(t,e))return t;if(t.endsWith("[]")){let r=t.slice(0,-2);if(e.type.scope.addParsedReferenceIfResolvable(t,e))return Bs(r)}},EW=(t,e)=>{let r=new dp(t,e);return mp(r),SW(r)},SW=t=>{for(;!t.scanner.finalized;)IW(t);return t.ejectFinalizedRoot()},IW=t=>t.hasRoot()?Ab(t):mp(t);var et=(t,e)=>{let r=je(t);if(r==="string")return bk(t,e);if(r!=="object")return xe(Rb(r));let n=Ls(t);switch(n){case"Object":return sk(t,e);case"Array":return nk(t,e);case"RegExp":return{string:{regex:t.source}};case"Function":if(_b(t))return e.type.scope.addAnonymousTypeReference(t,e);if(_W(t)){let o=t();if(_b(o))return e.type.scope.addAnonymousTypeReference(o,e)}return xe(Rb("Function"));default:return xe(Rb(n??De(t)))}},a0e=Symbol("as"),_W=t=>typeof t=="function"&&t.length===0,Rb=t=>`Type definitions must be strings or objects (was ${t})`;a();function OW(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Us=class{get root(){return this.cache}has(e){return e in this.cache}get(e){return this.cache[e]}set(e,r){return this.cache[e]=r,r}constructor(){OW(this,"cache",{})}},hp=class extends Us{set(e,r){return this.cache[e]=yr(r),r}};function Sk(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function TW(t,e){return e.get?e.get.call(t):e.value}function CW(t,e,r){if(e.set)e.set.call(t,r);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=r}}function Ik(t,e,r){if(!e.has(t))throw new TypeError("attempted to "+r+" private field on non-instance");return e.get(t)}function Rn(t,e){var r=Ik(t,e,"get");return TW(t,r)}function vk(t,e,r){Sk(t,e),e.set(t,r)}function wk(t,e,r){var n=Ik(t,e,"set");return CW(t,n,r),r}function An(t,e,r){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return r}function gp(t,e){Sk(t,e),e.add(t)}function $t(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var kW=t=>({codes:zC(t.codes),keys:t.keys??"loose"}),AW=0,xk={},Nb={};var xi=new WeakMap,Ws=new WeakMap,Ek=new WeakSet,yp=new WeakSet,Pb=new WeakSet,bp=new WeakSet,Fb=class{getAnonymousQualifiedName(e){let r=0,n=e;for(;this.isResolvable(n);)n=`${e}${r++}`;return`${this.name}.${n}`}addAnonymousTypeReference(e,r){var n;return(n=r.type).includesMorph||(n.includesMorph=e.includesMorph),e.node}get infer(){return Eo}compile(){if(!Nb[this.name]){for(let e in this.aliases)this.resolve(e);Nb[this.name]=Rn(this,Ws).root}return Rn(this,Ws).root}addParsedReferenceIfResolvable(e,r){var n;let o=An(this,bp,$b).call(this,e,"undefined",[e]);return o?((n=r.type).includesMorph||(n.includesMorph=o.includesMorph),!0):!1}resolve(e){return An(this,bp,$b).call(this,e,"throw",[e])}resolveNode(e){return typeof e=="string"?this.resolveNode(this.resolve(e).node):e}resolveTypeNode(e){let r=this.resolveNode(e);return Ul(r)?r.node:r}isResolvable(e){return Rn(this,xi).has(e)||this.aliases[e]}constructor(e,r={}){gp(this,Ek),gp(this,yp),gp(this,Pb),gp(this,bp),$t(this,"aliases",void 0),$t(this,"name",void 0),$t(this,"config",void 0),$t(this,"parseCache",void 0),vk(this,xi,{writable:!0,value:void 0}),vk(this,Ws,{writable:!0,value:void 0}),$t(this,"expressions",void 0),$t(this,"intersection",void 0),$t(this,"union",void 0),$t(this,"arrayOf",void 0),$t(this,"keyOf",void 0),$t(this,"valueOf",void 0),$t(this,"instanceOf",void 0),$t(this,"narrow",void 0),$t(this,"morph",void 0),$t(this,"type",void 0),this.aliases=e,this.parseCache=new hp,wk(this,xi,new Us),wk(this,Ws,new Us),this.expressions={intersection:(n,o,i)=>this.type([n,"&",o],i),union:(n,o,i)=>this.type([n,"|",o],i),arrayOf:(n,o)=>this.type([n,"[]"],o),keyOf:(n,o)=>this.type(["keyof",n],o),node:(n,o)=>this.type(["node",n],o),instanceOf:(n,o)=>this.type(["instanceof",n],o),valueOf:(n,o)=>this.type(["===",n],o),narrow:(n,o,i)=>this.type([n,"=>",o],i),morph:(n,o,i)=>this.type([n,"|>",o],i)},this.intersection=this.expressions.intersection,this.union=this.expressions.union,this.arrayOf=this.expressions.arrayOf,this.keyOf=this.expressions.keyOf,this.valueOf=this.expressions.valueOf,this.instanceOf=this.expressions.instanceOf,this.narrow=this.expressions.narrow,this.morph=this.expressions.morph,this.type=Object.assign((n,o={})=>{let i=Ib("\u03BBtype",n,o,this),s=An(this,Pb,_k).call(this,i),l=et(n,s);return i.node=yr(Rl(o)?{config:o,node:this.resolveTypeNode(l)}:l),i.flat=yr(gb(i)),i},{from:this.expressions.node}),this.name=An(this,Ek,RW).call(this,r),r.standard!==!1&&An(this,yp,Db).call(this,[Nb.standard],"imports"),r.imports&&An(this,yp,Db).call(this,r.imports,"imports"),r.includes&&An(this,yp,Db).call(this,r.includes,"includes"),this.config=kW(r)}};function RW(t){let e=t.name?xk[t.name]?xe(`A scope named '${t.name}' already exists`):t.name:`scope${++AW}`;return xk[e]=this,e}function Db(t,e){for(let r of t)for(let n in r)(Rn(this,xi).has(n)||n in this.aliases)&&xe(DW(n)),Rn(this,xi).set(n,r[n]),e==="includes"&&Rn(this,Ws).set(n,r[n])}function _k(t){return{type:t,path:new Xe}}function $b(t,e,r){let n=Rn(this,xi).get(t);if(n)return n;let o=this.aliases[t];if(!o)return e==="throw"?Oe(`Unexpectedly failed to resolve alias '${t}'`):void 0;let i=Ib(t,o,{},this),s=An(this,Pb,_k).call(this,i);Rn(this,xi).set(t,i),Rn(this,Ws).set(t,i);let l=et(o,s);if(typeof l=="string"){if(r.includes(l))return xe(NW(t,r));r.push(l),l=An(this,bp,$b).call(this,l,"throw",r).node}return i.node=yr(l),i.flat=yr(gb(i)),i}var Mt=(t,e={})=>new Fb(t,e),Mb=Mt({},{name:"root",standard:!1}),Dr=Mb.type,NW=(t,e)=>`Alias '${t}' has a shallow resolution cycle: ${[...e,t].join("=>")}`,DW=t=>`Alias '${t}' is already defined`;a();a();var vp=Mt({Function:["node",{object:{class:Function}}],Date:["node",{object:{class:Date}}],Error:["node",{object:{class:Error}}],Map:["node",{object:{class:Map}}],RegExp:["node",{object:{class:RegExp}}],Set:["node",{object:{class:Set}}],WeakMap:["node",{object:{class:WeakMap}}],WeakSet:["node",{object:{class:WeakSet}}],Promise:["node",{object:{class:Promise}}]},{name:"jsObjects",standard:!1}),Ok=vp.compile();a();var Tk={bigint:!0,boolean:!0,null:!0,number:!0,object:!0,string:!0,symbol:!0,undefined:!0},wp=Mt({any:["node",Tk],bigint:["node",{bigint:!0}],boolean:["node",{boolean:!0}],false:["node",{boolean:{value:!1}}],never:["node",{}],null:["node",{null:!0}],number:["node",{number:!0}],object:["node",{object:!0}],string:["node",{string:!0}],symbol:["node",{symbol:!0}],true:["node",{boolean:{value:!0}}],unknown:["node",Tk],void:["node",{undefined:!0}],undefined:["node",{undefined:!0}]},{name:"ts",standard:!1}),Ei=wp.compile();a();a();var PW=t=>{let e=t.replace(/[- ]+/g,""),r=0,n,o,i;for(let s=e.length-1;s>=0;s--)n=e.substring(s,s+1),o=parseInt(n,10),i?(o*=2,o>=10?r+=o%10+1:r+=o):r+=o,i=!i;return!!(r%10===0&&e)},FW=/^(?:4[0-9]{12}(?:[0-9]{3,6})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12,15}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|6[27][0-9]{14}|^(81[0-9]{14,17}))$/,Ck=Dr([FW,"=>",(t,e)=>PW(t)||!e.mustBe("a valid credit card number")],{mustBe:"a valid credit card number"});a();var $W=/^[./-]$/,MW=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/,LW=t=>!isNaN(t),xp=t=>`a ${t}-formatted date`,jW=(t,e)=>{if(!e?.format){let l=new Date(t);return LW(l)?l:"a valid date"}if(e.format==="iso8601")return MW.test(t)?new Date(t):xp("iso8601");let r=t.split($W),n=t[r[0].length],o=n?e.format.split(n):[e.format];if(r.length!==o.length)return xp(e.format);let i={};for(let l=0;l<o.length;l++){if(r[l].length!==o[l].length&&!(o[l].length===1&&r[l].length===2))return xp(e.format);i[o[l][0]]=r[l]}let s=new Date(`${i.m}/${i.d}/${i.y}`);return`${s.getDate()}`===i.d?s:xp(e.format)},kk=Dr([Ei.string,"|>",(t,e)=>{let r=jW(t);return typeof r=="string"?e.mustBe(r):r}]);var qW=Dr([eb,"|>",t=>parseFloat(t)],{mustBe:"a well-formed numeric string"}),BW=Dr([Ei.string,"|>",(t,e)=>{if(!Nl(t))return e.mustBe("a well-formed integer string");let r=parseInt(t);return Number.isSafeInteger(r)?r:e.mustBe("an integer in the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER")}]),zW=Dr(/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/,{mustBe:"a valid email"}),UW=Dr(/^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$/,{mustBe:"a valid UUID"}),WW=Dr(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,{mustBe:"a valid semantic version (see https://semver.org/)"}),HW=Dr([Ei.string,"|>",t=>JSON.parse(t)],{mustBe:"a JSON-parsable string"}),Ep=Mt({alpha:[/^[A-Za-z]*$/,":",{mustBe:"only letters"}],alphanumeric:[/^[A-Za-z\d]*$/,":",{mustBe:"only letters and digits"}],lowercase:[/^[a-z]*$/,":",{mustBe:"only lowercase letters"}],uppercase:[/^[A-Z]*$/,":",{mustBe:"only uppercase letters"}],creditCard:Ck,email:zW,uuid:UW,parsedNumber:qW,parsedInteger:BW,parsedDate:kk,semver:WW,json:HW,integer:["node",{number:{divisor:1}}]},{name:"validation",standard:!1}),Ak=Ep.compile();var Sp=Mt({},{name:"standard",includes:[Ei,Ok,Ak],standard:!1}),KW=Sp.compile(),Nn={root:Mb,tsKeywords:wp,jsObjects:vp,validation:Ep,ark:Sp};var Kl=Sp.type;a();var VW=Nn.ark.intersection,GW=Nn.ark.union,ZW=Nn.ark.arrayOf,JW=Nn.ark.keyOf,YW=Nn.ark.instanceOf,XW=Nn.ark.valueOf,QW=Nn.ark.narrow,e7=Nn.ark.morph;var{DataRequest:fwe,DataResponse:Rk}=Mt({DataRequest:{id:"number",method:"string",params:"any[]"},DataResponse:{id:"number","eventName?":"string",payload:"any",error:"any"}}).compile(),Ip="__METHODS__",_p="__EVAL__";a();a();var Nk=()=>({events:{},emit(t,...e){let r=this.events[t]||[];for(let n=0,o=r.length;n<o;n++)r[n](...e)},on(t,e){return this.events[t]?.push(e)||(this.events[t]=[e]),()=>{this.events[t]=this.events[t]?.filter(r=>e!==r)}}});function Si(){let t=Nk();return t.once=(e,r)=>{let n=(...i)=>{o(),r(...i)},o=t.on(e,n);return o},t}function t7(t){return Object.assign(new Error,t)}var Ii=class{pending=new Map;terminateState=!1;terminationHandler=null;lastId=0;worker;constructor(){this.worker=this.setupWorker(),this.worker.onMessage(e=>this.onMessage(e.data)),this.worker.onError(e=>this.onError(e.error))}internal=Si();evt=Si();task=Si();onMessage(e){if(this.terminateState==="finished")return;if(e==="ready"){this.internal.emit("ready");return}let{data:r,problems:n}=Rk(e);if(n)throw new Error(n.toString());if(r.eventName){this.evt.emit(r.eventName,r.payload);return}this.task.emit(r.id,r.payload,r.error),this.terminateState==="requested"&&this.terminate()}onError(e){for(let r of this.pending.values())r.abort(e);this.pending.clear(),this.worker.terminate()}methods(){return this.invoke(Ip)}eval(e,r,n){let o=[e,...r];return this.invoke(_p,o,{transfer:n})}send({id:e,method:r,params:n,transfer:o,timeout:i},s=new AbortController){let l=s.signal;return this.pending.set(e,s),new Promise((c,f)=>{this.worker.send({id:e,method:r,params:n},{transfer:o});let u=-1,d=()=>{f(l?.reason),m(),window.clearTimeout(u)};i!==void 0&&(u=window.setTimeout(()=>{s.abort(new DOMException(`Timeout after ${i}ms`,"TimeoutError"))},i)),l?.addEventListener("abort",d);let m=this.task.once(e,(h,y)=>{l?.removeEventListener("abort",d),y?f(t7(y)):c(h)})}).catch(c=>{if(c instanceof DOMException&&["AbortError","TimeoutError"].includes(c.name))return this.terminate(!0).then(()=>{throw c});throw c}).finally(()=>{this.pending.delete(e)})}async invoke(e,r=[],{controller:n,transfer:o}={}){if(this.terminateState!==!1)throw new Error("Worker is terminated");let i=++this.lastId;return await this.worker.readyPromise,await this.send({id:i,method:e,params:r,transfer:o},n)}busy(){return this.pending.size>0}terminate(e=!1,r){if(e){for(let n of this.pending.values())n.abort(new Error("Worker terminated"));this.pending.clear()}if(this.busy()){this.terminateState="requested";let n=new Promise(o=>{this.internal.once("terminate",o)});return r!==void 0?Promise.race([n,r7(r)]).then():n}return this.worker.terminate(),Promise.resolve()}};function r7(t){return new Promise(e=>setTimeout(()=>e(new DOMException(`Timeout after ${t}ms`,"TimeoutError")),t))}a();var Hs=class extends Ii{setupWorker(){let e=this,r=Object.assign(this.initWebWorker(),{readyPromise:new Promise(n=>e.internal.once("ready",()=>n(!0))),killed:!1,send(n,o){r.postMessage(n,o)},onMessage(n){return r.addEventListener("message",n),()=>r.removeEventListener("message",n)},onError(n){return r.addEventListener("error",n),()=>r.removeEventListener("error",n)}});return sr(r,{terminate:n=>function(){r.killed||(n.call(this),r.killed=!0,e.internal.emit("terminate")),e.terminateState="finished"}}),r}};a();var Ks=class{workers=[];tasks=[];pending=new Map;emitter=Si();#e=Si();maxQueueSize=1/0;maxWorkers=Math.max((this.getMaxConcurrency()||4)-1,1);minWorkers=0;getMaxConcurrency(){return navigator.hardwareConcurrency}constructor(e={}){if(e.maxQueueSize!==void 0&&(this.maxQueueSize=o7.assert(e.maxQueueSize)),e.maxWorkers!==void 0&&(this.maxWorkers=n7.assert(e.maxWorkers)),e.minWorkers!==void 0){let o=i7.assert(e.minWorkers);o==="max"?this.minWorkers=this.maxWorkers:(this.minWorkers=o,this.maxWorkers=Math.max(this.minWorkers,this.maxWorkers)),this.ensureMinWorkers()}let r={},n=o=>r[o]??=(...i)=>this.invoke(o,i);this.proxy=new Proxy(r,{get:(o,i)=>!Reflect.has(o,i)&&typeof i=="string"?n(i):Reflect.get(o,i)}),this.methods().then(o=>o.forEach(n))}eval(e,r,n={}){return this.invoke(_p,[typeof e=="string"?e:e.toString(),r],n)}invoke(e,r=[],n={}){if(this.tasks.length>=this.maxQueueSize)throw new Error("Max queue size of "+this.maxQueueSize+" reached");let o={method:e,params:r,transfer:n.transfer};return this.tasks.push(o),this.pending.set(o,n.controller??new AbortController),this.next(),new Promise((i,s)=>{let l=[this.#e.on("complete",(c,f)=>{o===c&&(l.forEach(u=>u()),i(f))}),this.#e.on("error",(c,f)=>{o===c&&(l.forEach(u=>u()),s(f))})]})}methods(){return this.invoke(Ip)}proxy;next(){if(this.tasks.length===0)return;let e=this.getWorker();if(!e)return;let r=this.tasks.shift();if(!this.pending.has(r))return this.next();let n=this.pending.get(r);e.invoke(r.method,r.params,{transfer:r.transfer,timeout:r.timeout,controller:n}).then(o=>{this.#e.emit("complete",r,o)}).catch(o=>{this.#e.emit("error",r,o),e.terminateState==="finished"&&this.removeWorker(e)}).finally(()=>{this.pending.delete(r),this.next()})}getWorker(){for(let e of this.workers)if(!e.busy())return e;if(this.workers.length<this.maxWorkers){let e=this.initWorker();return this.workers.push(e),e}return null}async removeWorker(e){return this.removeWorkerFromList(e),this.ensureMinWorkers(),await e.terminate(!1),this.emitter.emit("worker-terminate"),e}removeWorkerFromList(e){let r=this.workers.indexOf(e);r!==-1&&this.workers.splice(r,1)}terminate(e=!1,r){for(let n of this.pending.values())n.abort(new Error("Pool terminated"));return this.tasks.length=0,this.pending.clear(),Promise.all(this.workers.slice().map(async n=>{try{await n.terminate(e,r),this.removeWorkerFromList(n)}finally{this.emitter.emit("worker-terminate")}})).then()}get stats(){let e=this.workers.length,r=this.workers.filter(function(n){return n.busy()}).length;return{totalWorkers:e,busyWorkers:r,idleWorkers:e-r,pendingTasks:this.tasks.length,activeTasks:r}}ensureMinWorkers(){if(this.minWorkers)for(let e=this.workers.length;e<this.minWorkers;e++)this.workers.push(this.initWorker())}initWorker(){let e=this.workerCtor();return this.emitter.emit("worker-create"),e}},n7=Kl("integer>=1"),o7=Kl("integer>=1"),i7=Kl('integer>=0|"max"');var Dk='"use strict";var ey=Object.create;var Iu=Object.defineProperty;var ty=Object.getOwnPropertyDescriptor;var ry=Object.getOwnPropertyNames;var ny=Object.getPrototypeOf,oy=Object.prototype.hasOwnProperty;var iy=(e,t)=>()=>(e&&(t=e(e=0)),t);var T=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var sy=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ry(t))!oy.call(e,o)&&o!==r&&Iu(e,o,{get:()=>t[o],enumerable:!(n=ty(t,o))||n.enumerable});return e};var Pr=(e,t,r)=>(r=e!=null?ey(ny(e)):{},sy(t||!e||!e.__esModule?Iu(r,"default",{value:e,enumerable:!0}):r,e));var u=iy(()=>{});var Zs=T((gl,Ys)=>{u();(function(e){if(typeof gl=="object"&&typeof Ys<"u")Ys.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t;typeof window<"u"?t=window:typeof global<"u"?t=global:typeof self<"u"?t=self:t=this,t.localforage=e()}})(function(){var e,t,r;return function n(o,i,s){function a(f,h){if(!i[f]){if(!o[f]){var p=typeof require=="function"&&require;if(!h&&p)return p(f,!0);if(c)return c(f,!0);var b=new Error("Cannot find module \'"+f+"\'");throw b.code="MODULE_NOT_FOUND",b}var E=i[f]={exports:{}};o[f][0].call(E.exports,function(I){var D=o[f][1][I];return a(D||I)},E,E.exports,n,o,i,s)}return i[f].exports}for(var c=typeof require=="function"&&require,m=0;m<s.length;m++)a(s[m]);return a}({1:[function(n,o,i){(function(s){"use strict";var a=s.MutationObserver||s.WebKitMutationObserver,c;if(a){var m=0,f=new a(I),h=s.document.createTextNode("");f.observe(h,{characterData:!0}),c=function(){h.data=m=++m%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var p=new s.MessageChannel;p.port1.onmessage=I,c=function(){p.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?c=function(){var A=s.document.createElement("script");A.onreadystatechange=function(){I(),A.onreadystatechange=null,A.parentNode.removeChild(A),A=null},s.document.documentElement.appendChild(A)}:c=function(){setTimeout(I,0)};var b,E=[];function I(){b=!0;for(var A,j,q=E.length;q;){for(j=E,E=[],A=-1;++A<q;)j[A]();q=E.length}b=!1}o.exports=D;function D(A){E.push(A)===1&&!b&&c()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,o,i){"use strict";var s=n(1);function a(){}var c={},m=["REJECTED"],f=["FULFILLED"],h=["PENDING"];o.exports=p;function p(F){if(typeof F!="function")throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,F!==a&&D(this,F)}p.prototype.catch=function(F){return this.then(null,F)},p.prototype.then=function(F,z){if(typeof F!="function"&&this.state===f||typeof z!="function"&&this.state===m)return this;var U=new this.constructor(a);if(this.state!==h){var P=this.state===f?F:z;E(U,P,this.outcome)}else this.queue.push(new b(U,F,z));return U};function b(F,z,U){this.promise=F,typeof z=="function"&&(this.onFulfilled=z,this.callFulfilled=this.otherCallFulfilled),typeof U=="function"&&(this.onRejected=U,this.callRejected=this.otherCallRejected)}b.prototype.callFulfilled=function(F){c.resolve(this.promise,F)},b.prototype.otherCallFulfilled=function(F){E(this.promise,this.onFulfilled,F)},b.prototype.callRejected=function(F){c.reject(this.promise,F)},b.prototype.otherCallRejected=function(F){E(this.promise,this.onRejected,F)};function E(F,z,U){s(function(){var P;try{P=z(U)}catch(B){return c.reject(F,B)}P===F?c.reject(F,new TypeError("Cannot resolve promise with itself")):c.resolve(F,P)})}c.resolve=function(F,z){var U=A(I,z);if(U.status==="error")return c.reject(F,U.value);var P=U.value;if(P)D(F,P);else{F.state=f,F.outcome=z;for(var B=-1,_=F.queue.length;++B<_;)F.queue[B].callFulfilled(z)}return F},c.reject=function(F,z){F.state=m,F.outcome=z;for(var U=-1,P=F.queue.length;++U<P;)F.queue[U].callRejected(z);return F};function I(F){var z=F&&F.then;if(F&&(typeof F=="object"||typeof F=="function")&&typeof z=="function")return function(){z.apply(F,arguments)}}function D(F,z){var U=!1;function P($){U||(U=!0,c.reject(F,$))}function B($){U||(U=!0,c.resolve(F,$))}function _(){z(B,P)}var k=A(_);k.status==="error"&&P(k.value)}function A(F,z){var U={};try{U.value=F(z),U.status="success"}catch(P){U.status="error",U.value=P}return U}p.resolve=j;function j(F){return F instanceof this?F:c.resolve(new this(a),F)}p.reject=q;function q(F){var z=new this(a);return c.reject(z,F)}p.all=ne;function ne(F){var z=this;if(Object.prototype.toString.call(F)!=="[object Array]")return this.reject(new TypeError("must be an array"));var U=F.length,P=!1;if(!U)return this.resolve([]);for(var B=new Array(U),_=0,k=-1,$=new this(a);++k<U;)W(F[k],k);return $;function W(L,G){z.resolve(L).then(V,function(re){P||(P=!0,c.reject($,re))});function V(re){B[G]=re,++_===U&&!P&&(P=!0,c.resolve($,B))}}}p.race=Ie;function Ie(F){var z=this;if(Object.prototype.toString.call(F)!=="[object Array]")return this.reject(new TypeError("must be an array"));var U=F.length,P=!1;if(!U)return this.resolve([]);for(var B=-1,_=new this(a);++B<U;)k(F[B]);return _;function k($){z.resolve($).then(function(W){P||(P=!0,c.resolve(_,W))},function(W){P||(P=!0,c.reject(_,W))})}}},{1:1}],3:[function(n,o,i){(function(s){"use strict";typeof s.Promise!="function"&&(s.Promise=n(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,o,i){"use strict";var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l};function a(l,y){if(!(l instanceof y))throw new TypeError("Cannot call a class as a function")}function c(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var m=c();function f(){try{if(!m||!m.open)return!1;var l=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),y=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!l||y)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function h(l,y){l=l||[],y=y||{};try{return new Blob(l,y)}catch(v){if(v.name!=="TypeError")throw v;for(var d=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,w=new d,x=0;x<l.length;x+=1)w.append(l[x]);return w.getBlob(y.type)}}typeof Promise>"u"&&n(3);var p=Promise;function b(l,y){y&&l.then(function(d){y(null,d)},function(d){y(d)})}function E(l,y,d){typeof y=="function"&&l.then(y),typeof d=="function"&&l.catch(d)}function I(l){return typeof l!="string"&&(console.warn(l+" used as a key, but it is not a string."),l=String(l)),l}function D(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var A="local-forage-detect-blob-support",j=void 0,q={},ne=Object.prototype.toString,Ie="readonly",F="readwrite";function z(l){for(var y=l.length,d=new ArrayBuffer(y),w=new Uint8Array(d),x=0;x<y;x++)w[x]=l.charCodeAt(x);return d}function U(l){return new p(function(y){var d=l.transaction(A,F),w=h([""]);d.objectStore(A).put(w,"key"),d.onabort=function(x){x.preventDefault(),x.stopPropagation(),y(!1)},d.oncomplete=function(){var x=navigator.userAgent.match(/Chrome\\/(\\d+)/),v=navigator.userAgent.match(/Edge\\//);y(v||!x||parseInt(x[1],10)>=43)}}).catch(function(){return!1})}function P(l){return typeof j=="boolean"?p.resolve(j):U(l).then(function(y){return j=y,j})}function B(l){var y=q[l.name],d={};d.promise=new p(function(w,x){d.resolve=w,d.reject=x}),y.deferredOperations.push(d),y.dbReady?y.dbReady=y.dbReady.then(function(){return d.promise}):y.dbReady=d.promise}function _(l){var y=q[l.name],d=y.deferredOperations.pop();if(d)return d.resolve(),d.promise}function k(l,y){var d=q[l.name],w=d.deferredOperations.pop();if(w)return w.reject(y),w.promise}function $(l,y){return new p(function(d,w){if(q[l.name]=q[l.name]||nu(),l.db)if(y)B(l),l.db.close();else return d(l.db);var x=[l.name];y&&x.push(l.version);var v=m.open.apply(m,x);y&&(v.onupgradeneeded=function(S){var O=v.result;try{O.createObjectStore(l.storeName),S.oldVersion<=1&&O.createObjectStore(A)}catch(N){if(N.name==="ConstraintError")console.warn(\'The database "\'+l.name+\'" has been upgraded from version \'+S.oldVersion+" to version "+S.newVersion+\', but the storage "\'+l.storeName+\'" already exists.\');else throw N}}),v.onerror=function(S){S.preventDefault(),w(v.error)},v.onsuccess=function(){var S=v.result;S.onversionchange=function(O){O.target.close()},d(S),_(l)}})}function W(l){return $(l,!1)}function L(l){return $(l,!0)}function G(l,y){if(!l.db)return!0;var d=!l.db.objectStoreNames.contains(l.storeName),w=l.version<l.db.version,x=l.version>l.db.version;if(w&&(l.version!==y&&console.warn(\'The database "\'+l.name+`" can\'t be downgraded from version `+l.db.version+" to version "+l.version+"."),l.version=l.db.version),x||d){if(d){var v=l.db.version+1;v>l.version&&(l.version=v)}return!0}return!1}function V(l){return new p(function(y,d){var w=new FileReader;w.onerror=d,w.onloadend=function(x){var v=btoa(x.target.result||"");y({__local_forage_encoded_blob:!0,data:v,type:l.type})},w.readAsBinaryString(l)})}function re(l){var y=z(atob(l.data));return h([y],{type:l.type})}function Z(l){return l&&l.__local_forage_encoded_blob}function Zn(l){var y=this,d=y._initReady().then(function(){var w=q[y._dbInfo.name];if(w&&w.dbReady)return w.dbReady});return E(d,l,l),d}function rg(l){B(l);for(var y=q[l.name],d=y.forages,w=0;w<d.length;w++){var x=d[w];x._dbInfo.db&&(x._dbInfo.db.close(),x._dbInfo.db=null)}return l.db=null,W(l).then(function(v){return l.db=v,G(l)?L(l):v}).then(function(v){l.db=y.db=v;for(var S=0;S<d.length;S++)d[S]._dbInfo.db=v}).catch(function(v){throw k(l,v),v})}function pt(l,y,d,w){w===void 0&&(w=1);try{var x=l.db.transaction(l.storeName,y);d(null,x)}catch(v){if(w>0&&(!l.db||v.name==="InvalidStateError"||v.name==="NotFoundError"))return p.resolve().then(function(){if(!l.db||v.name==="NotFoundError"&&!l.db.objectStoreNames.contains(l.storeName)&&l.version<=l.db.version)return l.db&&(l.version=l.db.version+1),L(l)}).then(function(){return rg(l).then(function(){pt(l,y,d,w-1)})}).catch(d);d(v)}}function nu(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function ng(l){var y=this,d={db:null};if(l)for(var w in l)d[w]=l[w];var x=q[d.name];x||(x=nu(),q[d.name]=x),x.forages.push(y),y._initReady||(y._initReady=y.ready,y.ready=Zn);var v=[];function S(){return p.resolve()}for(var O=0;O<x.forages.length;O++){var N=x.forages[O];N!==y&&v.push(N._initReady().catch(S))}var C=x.forages.slice(0);return p.all(v).then(function(){return d.db=x.db,W(d)}).then(function(R){return d.db=R,G(d,y._defaultConfig.version)?L(d):R}).then(function(R){d.db=x.db=R,y._dbInfo=d;for(var M=0;M<C.length;M++){var K=C[M];K!==y&&(K._dbInfo.db=d.db,K._dbInfo.version=d.version)}})}function og(l,y){var d=this;l=I(l);var w=new p(function(x,v){d.ready().then(function(){pt(d._dbInfo,Ie,function(S,O){if(S)return v(S);try{var N=O.objectStore(d._dbInfo.storeName),C=N.get(l);C.onsuccess=function(){var R=C.result;R===void 0&&(R=null),Z(R)&&(R=re(R)),x(R)},C.onerror=function(){v(C.error)}}catch(R){v(R)}})}).catch(v)});return b(w,y),w}function ig(l,y){var d=this,w=new p(function(x,v){d.ready().then(function(){pt(d._dbInfo,Ie,function(S,O){if(S)return v(S);try{var N=O.objectStore(d._dbInfo.storeName),C=N.openCursor(),R=1;C.onsuccess=function(){var M=C.result;if(M){var K=M.value;Z(K)&&(K=re(K));var Q=l(K,M.key,R++);Q!==void 0?x(Q):M.continue()}else x()},C.onerror=function(){v(C.error)}}catch(M){v(M)}})}).catch(v)});return b(w,y),w}function sg(l,y,d){var w=this;l=I(l);var x=new p(function(v,S){var O;w.ready().then(function(){return O=w._dbInfo,ne.call(y)==="[object Blob]"?P(O.db).then(function(N){return N?y:V(y)}):y}).then(function(N){pt(w._dbInfo,F,function(C,R){if(C)return S(C);try{var M=R.objectStore(w._dbInfo.storeName);N===null&&(N=void 0);var K=M.put(N,l);R.oncomplete=function(){N===void 0&&(N=null),v(N)},R.onabort=R.onerror=function(){var Q=K.error?K.error:K.transaction.error;S(Q)}}catch(Q){S(Q)}})}).catch(S)});return b(x,d),x}function ag(l,y){var d=this;l=I(l);var w=new p(function(x,v){d.ready().then(function(){pt(d._dbInfo,F,function(S,O){if(S)return v(S);try{var N=O.objectStore(d._dbInfo.storeName),C=N.delete(l);O.oncomplete=function(){x()},O.onerror=function(){v(C.error)},O.onabort=function(){var R=C.error?C.error:C.transaction.error;v(R)}}catch(R){v(R)}})}).catch(v)});return b(w,y),w}function ug(l){var y=this,d=new p(function(w,x){y.ready().then(function(){pt(y._dbInfo,F,function(v,S){if(v)return x(v);try{var O=S.objectStore(y._dbInfo.storeName),N=O.clear();S.oncomplete=function(){w()},S.onabort=S.onerror=function(){var C=N.error?N.error:N.transaction.error;x(C)}}catch(C){x(C)}})}).catch(x)});return b(d,l),d}function cg(l){var y=this,d=new p(function(w,x){y.ready().then(function(){pt(y._dbInfo,Ie,function(v,S){if(v)return x(v);try{var O=S.objectStore(y._dbInfo.storeName),N=O.count();N.onsuccess=function(){w(N.result)},N.onerror=function(){x(N.error)}}catch(C){x(C)}})}).catch(x)});return b(d,l),d}function lg(l,y){var d=this,w=new p(function(x,v){if(l<0){x(null);return}d.ready().then(function(){pt(d._dbInfo,Ie,function(S,O){if(S)return v(S);try{var N=O.objectStore(d._dbInfo.storeName),C=!1,R=N.openKeyCursor();R.onsuccess=function(){var M=R.result;if(!M){x(null);return}l===0||C?x(M.key):(C=!0,M.advance(l))},R.onerror=function(){v(R.error)}}catch(M){v(M)}})}).catch(v)});return b(w,y),w}function fg(l){var y=this,d=new p(function(w,x){y.ready().then(function(){pt(y._dbInfo,Ie,function(v,S){if(v)return x(v);try{var O=S.objectStore(y._dbInfo.storeName),N=O.openKeyCursor(),C=[];N.onsuccess=function(){var R=N.result;if(!R){w(C);return}C.push(R.key),R.continue()},N.onerror=function(){x(N.error)}}catch(R){x(R)}})}).catch(x)});return b(d,l),d}function pg(l,y){y=D.apply(this,arguments);var d=this.config();l=typeof l!="function"&&l||{},l.name||(l.name=l.name||d.name,l.storeName=l.storeName||d.storeName);var w=this,x;if(!l.name)x=p.reject("Invalid arguments");else{var v=l.name===d.name&&w._dbInfo.db,S=v?p.resolve(w._dbInfo.db):W(l).then(function(O){var N=q[l.name],C=N.forages;N.db=O;for(var R=0;R<C.length;R++)C[R]._dbInfo.db=O;return O});l.storeName?x=S.then(function(O){if(O.objectStoreNames.contains(l.storeName)){var N=O.version+1;B(l);var C=q[l.name],R=C.forages;O.close();for(var M=0;M<R.length;M++){var K=R[M];K._dbInfo.db=null,K._dbInfo.version=N}var Q=new p(function(X,de){var fe=m.open(l.name,N);fe.onerror=function(qe){var $r=fe.result;$r.close(),de(qe)},fe.onupgradeneeded=function(){var qe=fe.result;qe.deleteObjectStore(l.storeName)},fe.onsuccess=function(){var qe=fe.result;qe.close(),X(qe)}});return Q.then(function(X){C.db=X;for(var de=0;de<R.length;de++){var fe=R[de];fe._dbInfo.db=X,_(fe._dbInfo)}}).catch(function(X){throw(k(l,X)||p.resolve()).catch(function(){}),X})}}):x=S.then(function(O){B(l);var N=q[l.name],C=N.forages;O.close();for(var R=0;R<C.length;R++){var M=C[R];M._dbInfo.db=null}var K=new p(function(Q,X){var de=m.deleteDatabase(l.name);de.onerror=function(){var fe=de.result;fe&&fe.close(),X(de.error)},de.onblocked=function(){console.warn(\'dropInstance blocked for database "\'+l.name+\'" until all open connections are closed\')},de.onsuccess=function(){var fe=de.result;fe&&fe.close(),Q(fe)}});return K.then(function(Q){N.db=Q;for(var X=0;X<C.length;X++){var de=C[X];_(de._dbInfo)}}).catch(function(Q){throw(k(l,Q)||p.resolve()).catch(function(){}),Q})})}return b(x,y),x}var mg={_driver:"asyncStorage",_initStorage:ng,_support:f(),iterate:ig,getItem:og,setItem:sg,removeItem:ag,clear:ug,length:cg,key:lg,keys:fg,dropInstance:pg};function dg(){return typeof openDatabase=="function"}var wt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",hg="~~local_forage_type~",ou=/^~~local_forage_type~([^~]+)~/,Qn="__lfsc__:",Ki=Qn.length,Gi="arbf",Vi="blob",iu="si08",su="ui08",au="uic8",uu="si16",cu="si32",lu="ur16",fu="ui32",pu="fl32",mu="fl64",du=Ki+Gi.length,hu=Object.prototype.toString;function gu(l){var y=l.length*.75,d=l.length,w,x=0,v,S,O,N;l[l.length-1]==="="&&(y--,l[l.length-2]==="="&&y--);var C=new ArrayBuffer(y),R=new Uint8Array(C);for(w=0;w<d;w+=4)v=wt.indexOf(l[w]),S=wt.indexOf(l[w+1]),O=wt.indexOf(l[w+2]),N=wt.indexOf(l[w+3]),R[x++]=v<<2|S>>4,R[x++]=(S&15)<<4|O>>2,R[x++]=(O&3)<<6|N&63;return C}function Hi(l){var y=new Uint8Array(l),d="",w;for(w=0;w<y.length;w+=3)d+=wt[y[w]>>2],d+=wt[(y[w]&3)<<4|y[w+1]>>4],d+=wt[(y[w+1]&15)<<2|y[w+2]>>6],d+=wt[y[w+2]&63];return y.length%3===2?d=d.substring(0,d.length-1)+"=":y.length%3===1&&(d=d.substring(0,d.length-2)+"=="),d}function gg(l,y){var d="";if(l&&(d=hu.call(l)),l&&(d==="[object ArrayBuffer]"||l.buffer&&hu.call(l.buffer)==="[object ArrayBuffer]")){var w,x=Qn;l instanceof ArrayBuffer?(w=l,x+=Gi):(w=l.buffer,d==="[object Int8Array]"?x+=iu:d==="[object Uint8Array]"?x+=su:d==="[object Uint8ClampedArray]"?x+=au:d==="[object Int16Array]"?x+=uu:d==="[object Uint16Array]"?x+=lu:d==="[object Int32Array]"?x+=cu:d==="[object Uint32Array]"?x+=fu:d==="[object Float32Array]"?x+=pu:d==="[object Float64Array]"?x+=mu:y(new Error("Failed to get type for BinaryArray"))),y(x+Hi(w))}else if(d==="[object Blob]"){var v=new FileReader;v.onload=function(){var S=hg+l.type+"~"+Hi(this.result);y(Qn+Vi+S)},v.readAsArrayBuffer(l)}else try{y(JSON.stringify(l))}catch(S){console.error("Couldn\'t convert value into a JSON string: ",l),y(null,S)}}function yg(l){if(l.substring(0,Ki)!==Qn)return JSON.parse(l);var y=l.substring(du),d=l.substring(Ki,du),w;if(d===Vi&&ou.test(y)){var x=y.match(ou);w=x[1],y=y.substring(x[0].length)}var v=gu(y);switch(d){case Gi:return v;case Vi:return h([v],{type:w});case iu:return new Int8Array(v);case su:return new Uint8Array(v);case au:return new Uint8ClampedArray(v);case uu:return new Int16Array(v);case lu:return new Uint16Array(v);case cu:return new Int32Array(v);case fu:return new Uint32Array(v);case pu:return new Float32Array(v);case mu:return new Float64Array(v);default:throw new Error("Unkown type: "+d)}}var Ji={serialize:gg,deserialize:yg,stringToBuffer:gu,bufferToString:Hi};function yu(l,y,d,w){l.executeSql("CREATE TABLE IF NOT EXISTS "+y.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],d,w)}function bg(l){var y=this,d={db:null};if(l)for(var w in l)d[w]=typeof l[w]!="string"?l[w].toString():l[w];var x=new p(function(v,S){try{d.db=openDatabase(d.name,String(d.version),d.description,d.size)}catch(O){return S(O)}d.db.transaction(function(O){yu(O,d,function(){y._dbInfo=d,v()},function(N,C){S(C)})},S)});return d.serializer=Ji,x}function xt(l,y,d,w,x,v){l.executeSql(d,w,x,function(S,O){O.code===O.SYNTAX_ERR?S.executeSql("SELECT name FROM sqlite_master WHERE type=\'table\' AND name = ?",[y.storeName],function(N,C){C.rows.length?v(N,O):yu(N,y,function(){N.executeSql(d,w,x,v)},v)},v):v(S,O)},v)}function vg(l,y){var d=this;l=I(l);var w=new p(function(x,v){d.ready().then(function(){var S=d._dbInfo;S.db.transaction(function(O){xt(O,S,"SELECT * FROM "+S.storeName+" WHERE key = ? LIMIT 1",[l],function(N,C){var R=C.rows.length?C.rows.item(0).value:null;R&&(R=S.serializer.deserialize(R)),x(R)},function(N,C){v(C)})})}).catch(v)});return b(w,y),w}function wg(l,y){var d=this,w=new p(function(x,v){d.ready().then(function(){var S=d._dbInfo;S.db.transaction(function(O){xt(O,S,"SELECT * FROM "+S.storeName,[],function(N,C){for(var R=C.rows,M=R.length,K=0;K<M;K++){var Q=R.item(K),X=Q.value;if(X&&(X=S.serializer.deserialize(X)),X=l(X,Q.key,K+1),X!==void 0){x(X);return}}x()},function(N,C){v(C)})})}).catch(v)});return b(w,y),w}function bu(l,y,d,w){var x=this;l=I(l);var v=new p(function(S,O){x.ready().then(function(){y===void 0&&(y=null);var N=y,C=x._dbInfo;C.serializer.serialize(y,function(R,M){M?O(M):C.db.transaction(function(K){xt(K,C,"INSERT OR REPLACE INTO "+C.storeName+" (key, value) VALUES (?, ?)",[l,R],function(){S(N)},function(Q,X){O(X)})},function(K){if(K.code===K.QUOTA_ERR){if(w>0){S(bu.apply(x,[l,N,d,w-1]));return}O(K)}})})}).catch(O)});return b(v,d),v}function xg(l,y,d){return bu.apply(this,[l,y,d,1])}function Eg(l,y){var d=this;l=I(l);var w=new p(function(x,v){d.ready().then(function(){var S=d._dbInfo;S.db.transaction(function(O){xt(O,S,"DELETE FROM "+S.storeName+" WHERE key = ?",[l],function(){x()},function(N,C){v(C)})})}).catch(v)});return b(w,y),w}function Ig(l){var y=this,d=new p(function(w,x){y.ready().then(function(){var v=y._dbInfo;v.db.transaction(function(S){xt(S,v,"DELETE FROM "+v.storeName,[],function(){w()},function(O,N){x(N)})})}).catch(x)});return b(d,l),d}function Sg(l){var y=this,d=new p(function(w,x){y.ready().then(function(){var v=y._dbInfo;v.db.transaction(function(S){xt(S,v,"SELECT COUNT(key) as c FROM "+v.storeName,[],function(O,N){var C=N.rows.item(0).c;w(C)},function(O,N){x(N)})})}).catch(x)});return b(d,l),d}function Og(l,y){var d=this,w=new p(function(x,v){d.ready().then(function(){var S=d._dbInfo;S.db.transaction(function(O){xt(O,S,"SELECT key FROM "+S.storeName+" WHERE id = ? LIMIT 1",[l+1],function(N,C){var R=C.rows.length?C.rows.item(0).key:null;x(R)},function(N,C){v(C)})})}).catch(v)});return b(w,y),w}function Dg(l){var y=this,d=new p(function(w,x){y.ready().then(function(){var v=y._dbInfo;v.db.transaction(function(S){xt(S,v,"SELECT key FROM "+v.storeName,[],function(O,N){for(var C=[],R=0;R<N.rows.length;R++)C.push(N.rows.item(R).key);w(C)},function(O,N){x(N)})})}).catch(x)});return b(d,l),d}function _g(l){return new p(function(y,d){l.transaction(function(w){w.executeSql("SELECT name FROM sqlite_master WHERE type=\'table\' AND name <> \'__WebKitDatabaseInfoTable__\'",[],function(x,v){for(var S=[],O=0;O<v.rows.length;O++)S.push(v.rows.item(O).name);y({db:l,storeNames:S})},function(x,v){d(v)})},function(w){d(w)})})}function Tg(l,y){y=D.apply(this,arguments);var d=this.config();l=typeof l!="function"&&l||{},l.name||(l.name=l.name||d.name,l.storeName=l.storeName||d.storeName);var w=this,x;return l.name?x=new p(function(v){var S;l.name===d.name?S=w._dbInfo.db:S=openDatabase(l.name,"","",0),l.storeName?v({db:S,storeNames:[l.storeName]}):v(_g(S))}).then(function(v){return new p(function(S,O){v.db.transaction(function(N){function C(Q){return new p(function(X,de){N.executeSql("DROP TABLE IF EXISTS "+Q,[],function(){X()},function(fe,qe){de(qe)})})}for(var R=[],M=0,K=v.storeNames.length;M<K;M++)R.push(C(v.storeNames[M]));p.all(R).then(function(){S()}).catch(function(Q){O(Q)})},function(N){O(N)})})}):x=p.reject("Invalid arguments"),b(x,y),x}var Ng={_driver:"webSQLStorage",_initStorage:bg,_support:dg(),iterate:wg,getItem:vg,setItem:xg,removeItem:Eg,clear:Ig,length:Sg,key:Og,keys:Dg,dropInstance:Tg};function Cg(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function vu(l,y){var d=l.name+"/";return l.storeName!==y.storeName&&(d+=l.storeName+"/"),d}function Ag(){var l="_localforage_support_test";try{return localStorage.setItem(l,!0),localStorage.removeItem(l),!1}catch{return!0}}function Rg(){return!Ag()||localStorage.length>0}function Fg(l){var y=this,d={};if(l)for(var w in l)d[w]=l[w];return d.keyPrefix=vu(l,y._defaultConfig),Rg()?(y._dbInfo=d,d.serializer=Ji,p.resolve()):p.reject()}function $g(l){var y=this,d=y.ready().then(function(){for(var w=y._dbInfo.keyPrefix,x=localStorage.length-1;x>=0;x--){var v=localStorage.key(x);v.indexOf(w)===0&&localStorage.removeItem(v)}});return b(d,l),d}function Pg(l,y){var d=this;l=I(l);var w=d.ready().then(function(){var x=d._dbInfo,v=localStorage.getItem(x.keyPrefix+l);return v&&(v=x.serializer.deserialize(v)),v});return b(w,y),w}function kg(l,y){var d=this,w=d.ready().then(function(){for(var x=d._dbInfo,v=x.keyPrefix,S=v.length,O=localStorage.length,N=1,C=0;C<O;C++){var R=localStorage.key(C);if(R.indexOf(v)===0){var M=localStorage.getItem(R);if(M&&(M=x.serializer.deserialize(M)),M=l(M,R.substring(S),N++),M!==void 0)return M}}});return b(w,y),w}function Mg(l,y){var d=this,w=d.ready().then(function(){var x=d._dbInfo,v;try{v=localStorage.key(l)}catch{v=null}return v&&(v=v.substring(x.keyPrefix.length)),v});return b(w,y),w}function qg(l){var y=this,d=y.ready().then(function(){for(var w=y._dbInfo,x=localStorage.length,v=[],S=0;S<x;S++){var O=localStorage.key(S);O.indexOf(w.keyPrefix)===0&&v.push(O.substring(w.keyPrefix.length))}return v});return b(d,l),d}function jg(l){var y=this,d=y.keys().then(function(w){return w.length});return b(d,l),d}function Lg(l,y){var d=this;l=I(l);var w=d.ready().then(function(){var x=d._dbInfo;localStorage.removeItem(x.keyPrefix+l)});return b(w,y),w}function Bg(l,y,d){var w=this;l=I(l);var x=w.ready().then(function(){y===void 0&&(y=null);var v=y;return new p(function(S,O){var N=w._dbInfo;N.serializer.serialize(y,function(C,R){if(R)O(R);else try{localStorage.setItem(N.keyPrefix+l,C),S(v)}catch(M){(M.name==="QuotaExceededError"||M.name==="NS_ERROR_DOM_QUOTA_REACHED")&&O(M),O(M)}})})});return b(x,d),x}function Ug(l,y){if(y=D.apply(this,arguments),l=typeof l!="function"&&l||{},!l.name){var d=this.config();l.name=l.name||d.name,l.storeName=l.storeName||d.storeName}var w=this,x;return l.name?x=new p(function(v){l.storeName?v(vu(l,w._defaultConfig)):v(l.name+"/")}).then(function(v){for(var S=localStorage.length-1;S>=0;S--){var O=localStorage.key(S);O.indexOf(v)===0&&localStorage.removeItem(O)}}):x=p.reject("Invalid arguments"),b(x,y),x}var zg={_driver:"localStorageWrapper",_initStorage:Fg,_support:Cg(),iterate:kg,getItem:Pg,setItem:Bg,removeItem:Lg,clear:$g,length:jg,key:Mg,keys:qg,dropInstance:Ug},Wg=function(y,d){return y===d||typeof y=="number"&&typeof d=="number"&&isNaN(y)&&isNaN(d)},Kg=function(y,d){for(var w=y.length,x=0;x<w;){if(Wg(y[x],d))return!0;x++}return!1},wu=Array.isArray||function(l){return Object.prototype.toString.call(l)==="[object Array]"},Fr={},xu={},ir={INDEXEDDB:mg,WEBSQL:Ng,LOCALSTORAGE:zg},Gg=[ir.INDEXEDDB._driver,ir.WEBSQL._driver,ir.LOCALSTORAGE._driver],Xn=["dropInstance"],Yi=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Xn),Vg={description:"",driver:Gg.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Hg(l,y){l[y]=function(){var d=arguments;return l.ready().then(function(){return l[y].apply(l,d)})}}function Zi(){for(var l=1;l<arguments.length;l++){var y=arguments[l];if(y)for(var d in y)y.hasOwnProperty(d)&&(wu(y[d])?arguments[0][d]=y[d].slice():arguments[0][d]=y[d])}return arguments[0]}var Jg=function(){function l(y){a(this,l);for(var d in ir)if(ir.hasOwnProperty(d)){var w=ir[d],x=w._driver;this[d]=x,Fr[x]||this.defineDriver(w)}this._defaultConfig=Zi({},Vg),this._config=Zi({},this._defaultConfig,y),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return l.prototype.config=function(d){if((typeof d>"u"?"undefined":s(d))==="object"){if(this._ready)return new Error("Can\'t call config() after localforage has been used.");for(var w in d){if(w==="storeName"&&(d[w]=d[w].replace(/\\W/g,"_")),w==="version"&&typeof d[w]!="number")return new Error("Database version must be a number.");this._config[w]=d[w]}return"driver"in d&&d.driver?this.setDriver(this._config.driver):!0}else return typeof d=="string"?this._config[d]:this._config},l.prototype.defineDriver=function(d,w,x){var v=new p(function(S,O){try{var N=d._driver,C=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!d._driver){O(C);return}for(var R=Yi.concat("_initStorage"),M=0,K=R.length;M<K;M++){var Q=R[M],X=!Kg(Xn,Q);if((X||d[Q])&&typeof d[Q]!="function"){O(C);return}}var de=function(){for(var $r=function(Qg){return function(){var Xg=new Error("Method "+Qg+" is not implemented by the current driver"),Eu=p.reject(Xg);return b(Eu,arguments[arguments.length-1]),Eu}},Qi=0,Zg=Xn.length;Qi<Zg;Qi++){var Xi=Xn[Qi];d[Xi]||(d[Xi]=$r(Xi))}};de();var fe=function($r){Fr[N]&&console.info("Redefining LocalForage driver: "+N),Fr[N]=d,xu[N]=$r,S()};"_support"in d?d._support&&typeof d._support=="function"?d._support().then(fe,O):fe(!!d._support):fe(!0)}catch(qe){O(qe)}});return E(v,w,x),v},l.prototype.driver=function(){return this._driver||null},l.prototype.getDriver=function(d,w,x){var v=Fr[d]?p.resolve(Fr[d]):p.reject(new Error("Driver not found."));return E(v,w,x),v},l.prototype.getSerializer=function(d){var w=p.resolve(Ji);return E(w,d),w},l.prototype.ready=function(d){var w=this,x=w._driverSet.then(function(){return w._ready===null&&(w._ready=w._initDriver()),w._ready});return E(x,d,d),x},l.prototype.setDriver=function(d,w,x){var v=this;wu(d)||(d=[d]);var S=this._getSupportedDrivers(d);function O(){v._config.driver=v.driver()}function N(M){return v._extend(M),O(),v._ready=v._initStorage(v._config),v._ready}function C(M){return function(){var K=0;function Q(){for(;K<M.length;){var X=M[K];return K++,v._dbInfo=null,v._ready=null,v.getDriver(X).then(N).catch(Q)}O();var de=new Error("No available storage method found.");return v._driverSet=p.reject(de),v._driverSet}return Q()}}var R=this._driverSet!==null?this._driverSet.catch(function(){return p.resolve()}):p.resolve();return this._driverSet=R.then(function(){var M=S[0];return v._dbInfo=null,v._ready=null,v.getDriver(M).then(function(K){v._driver=K._driver,O(),v._wrapLibraryMethodsWithReady(),v._initDriver=C(S)})}).catch(function(){O();var M=new Error("No available storage method found.");return v._driverSet=p.reject(M),v._driverSet}),E(this._driverSet,w,x),this._driverSet},l.prototype.supports=function(d){return!!xu[d]},l.prototype._extend=function(d){Zi(this,d)},l.prototype._getSupportedDrivers=function(d){for(var w=[],x=0,v=d.length;x<v;x++){var S=d[x];this.supports(S)&&w.push(S)}return w},l.prototype._wrapLibraryMethodsWithReady=function(){for(var d=0,w=Yi.length;d<w;d++)Hg(this,Yi[d])},l.prototype.createInstance=function(d){return new l(d)},l}(),Yg=new Jg;o.exports=Yg},{3:3}]},{},[4])(4)})});var bl=T((cF,yl)=>{u();var yr=1e3,br=yr*60,vr=br*60,Wt=vr*24,Wv=Wt*7,Kv=Wt*365.25;yl.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return Gv(e);if(r==="number"&&isFinite(e))return t.long?Hv(e):Vv(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Gv(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Kv;case"weeks":case"week":case"w":return r*Wv;case"days":case"day":case"d":return r*Wt;case"hours":case"hour":case"hrs":case"hr":case"h":return r*vr;case"minutes":case"minute":case"mins":case"min":case"m":return r*br;case"seconds":case"second":case"secs":case"sec":case"s":return r*yr;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Vv(e){var t=Math.abs(e);return t>=Wt?Math.round(e/Wt)+"d":t>=vr?Math.round(e/vr)+"h":t>=br?Math.round(e/br)+"m":t>=yr?Math.round(e/yr)+"s":e+"ms"}function Hv(e){var t=Math.abs(e);return t>=Wt?Ko(e,t,Wt,"day"):t>=vr?Ko(e,t,vr,"hour"):t>=br?Ko(e,t,br,"minute"):t>=yr?Ko(e,t,yr,"second"):e+" ms"}function Ko(e,t,r,n){var o=t>=r*1.5;return Math.round(e/r)+" "+n+(o?"s":"")}});var wl=T((fF,vl)=>{u();function Jv(e){r.debug=r,r.default=r,r.coerce=c,r.disable=i,r.enable=o,r.enabled=s,r.humanize=bl(),r.destroy=m,Object.keys(e).forEach(f=>{r[f]=e[f]}),r.names=[],r.skips=[],r.formatters={};function t(f){let h=0;for(let p=0;p<f.length;p++)h=(h<<5)-h+f.charCodeAt(p),h|=0;return r.colors[Math.abs(h)%r.colors.length]}r.selectColor=t;function r(f){let h,p=null,b,E;function I(...D){if(!I.enabled)return;let A=I,j=Number(new Date),q=j-(h||j);A.diff=q,A.prev=h,A.curr=j,h=j,D[0]=r.coerce(D[0]),typeof D[0]!="string"&&D.unshift("%O");let ne=0;D[0]=D[0].replace(/%([a-zA-Z%])/g,(F,z)=>{if(F==="%%")return"%";ne++;let U=r.formatters[z];if(typeof U=="function"){let P=D[ne];F=U.call(A,P),D.splice(ne,1),ne--}return F}),r.formatArgs.call(A,D),(A.log||r.log).apply(A,D)}return I.namespace=f,I.useColors=r.useColors(),I.color=r.selectColor(f),I.extend=n,I.destroy=r.destroy,Object.defineProperty(I,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(b!==r.namespaces&&(b=r.namespaces,E=r.enabled(f)),E),set:D=>{p=D}}),typeof r.init=="function"&&r.init(I),I}function n(f,h){let p=r(this.namespace+(typeof h>"u"?":":h)+f);return p.log=this.log,p}function o(f){r.save(f),r.namespaces=f,r.names=[],r.skips=[];let h,p=(typeof f=="string"?f:"").split(/[\\s,]+/),b=p.length;for(h=0;h<b;h++)p[h]&&(f=p[h].replace(/\\*/g,".*?"),f[0]==="-"?r.skips.push(new RegExp("^"+f.slice(1)+"$")):r.names.push(new RegExp("^"+f+"$")))}function i(){let f=[...r.names.map(a),...r.skips.map(a).map(h=>"-"+h)].join(",");return r.enable(""),f}function s(f){if(f[f.length-1]==="*")return!0;let h,p;for(h=0,p=r.skips.length;h<p;h++)if(r.skips[h].test(f))return!1;for(h=0,p=r.names.length;h<p;h++)if(r.names[h].test(f))return!0;return!1}function a(f){return f.toString().substring(2,f.toString().length-2).replace(/\\.\\*\\?$/,"*")}function c(f){return f instanceof Error?f.stack||f.message:f}function m(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}vl.exports=Jv});var Ee=T((Pe,Go)=>{u();Pe.formatArgs=Zv;Pe.save=Qv;Pe.load=Xv;Pe.useColors=Yv;Pe.storage=ew();Pe.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Pe.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Yv(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/)}function Zv(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+Go.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),e.splice(n,0,t)}Pe.log=console.debug||console.log||(()=>{});function Qv(e){try{e?Pe.storage.setItem("debug",e):Pe.storage.removeItem("debug")}catch{}}function Xv(){let e;try{e=Pe.storage.getItem("debug")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function ew(){try{return localStorage}catch{}}Go.exports=wl()(Pe);var{formatters:tw}=Go.exports;tw.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var El=T((dF,xl)=>{"use strict";u();xl.exports=rw;function wr(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function rw(e){if(e=e||{},e.circles)return nw(e);return e.proto?n:r;function t(o,i){for(var s=Object.keys(o),a=new Array(s.length),c=0;c<s.length;c++){var m=s[c],f=o[m];typeof f!="object"||f===null?a[m]=f:f instanceof Date?a[m]=new Date(f):ArrayBuffer.isView(f)?a[m]=wr(f):a[m]=i(f)}return a}function r(o){if(typeof o!="object"||o===null)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return t(o,r);if(o instanceof Map)return new Map(t(Array.from(o),r));if(o instanceof Set)return new Set(t(Array.from(o),r));var i={};for(var s in o)if(Object.hasOwnProperty.call(o,s)!==!1){var a=o[s];typeof a!="object"||a===null?i[s]=a:a instanceof Date?i[s]=new Date(a):a instanceof Map?i[s]=new Map(t(Array.from(a),r)):a instanceof Set?i[s]=new Set(t(Array.from(a),r)):ArrayBuffer.isView(a)?i[s]=wr(a):i[s]=r(a)}return i}function n(o){if(typeof o!="object"||o===null)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return t(o,n);if(o instanceof Map)return new Map(t(Array.from(o),n));if(o instanceof Set)return new Set(t(Array.from(o),n));var i={};for(var s in o){var a=o[s];typeof a!="object"||a===null?i[s]=a:a instanceof Date?i[s]=new Date(a):a instanceof Map?i[s]=new Map(t(Array.from(a),n)):a instanceof Set?i[s]=new Set(t(Array.from(a),n)):ArrayBuffer.isView(a)?i[s]=wr(a):i[s]=n(a)}return i}}function nw(e){var t=[],r=[];return e.proto?i:o;function n(s,a){for(var c=Object.keys(s),m=new Array(c.length),f=0;f<c.length;f++){var h=c[f],p=s[h];if(typeof p!="object"||p===null)m[h]=p;else if(p instanceof Date)m[h]=new Date(p);else if(ArrayBuffer.isView(p))m[h]=wr(p);else{var b=t.indexOf(p);b!==-1?m[h]=r[b]:m[h]=a(p)}}return m}function o(s){if(typeof s!="object"||s===null)return s;if(s instanceof Date)return new Date(s);if(Array.isArray(s))return n(s,o);if(s instanceof Map)return new Map(n(Array.from(s),o));if(s instanceof Set)return new Set(n(Array.from(s),o));var a={};t.push(s),r.push(a);for(var c in s)if(Object.hasOwnProperty.call(s,c)!==!1){var m=s[c];if(typeof m!="object"||m===null)a[c]=m;else if(m instanceof Date)a[c]=new Date(m);else if(m instanceof Map)a[c]=new Map(n(Array.from(m),o));else if(m instanceof Set)a[c]=new Set(n(Array.from(m),o));else if(ArrayBuffer.isView(m))a[c]=wr(m);else{var f=t.indexOf(m);f!==-1?a[c]=r[f]:a[c]=o(m)}}return t.pop(),r.pop(),a}function i(s){if(typeof s!="object"||s===null)return s;if(s instanceof Date)return new Date(s);if(Array.isArray(s))return n(s,i);if(s instanceof Map)return new Map(n(Array.from(s),i));if(s instanceof Set)return new Set(n(Array.from(s),i));var a={};t.push(s),r.push(a);for(var c in s){var m=s[c];if(typeof m!="object"||m===null)a[c]=m;else if(m instanceof Date)a[c]=new Date(m);else if(m instanceof Map)a[c]=new Map(n(Array.from(m),i));else if(m instanceof Set)a[c]=new Set(n(Array.from(m),i));else if(ArrayBuffer.isView(m))a[c]=wr(m);else{var f=t.indexOf(m);f!==-1?a[c]=r[f]:a[c]=i(m)}}return t.pop(),r.pop(),a}}});var Gt=T((gF,Dl)=>{u();var ow=require("util"),Kt=Ee()("log4js:configuration"),Vo=[],Ho=[],Il=e=>!e,Sl=e=>e&&typeof e=="object"&&!Array.isArray(e),iw=e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),sw=e=>e&&typeof e=="number"&&Number.isInteger(e),aw=e=>{Ho.push(e),Kt(`Added listener, now ${Ho.length} listeners`)},uw=e=>{Vo.push(e),Kt(`Added pre-processing listener, now ${Vo.length} listeners`)},Ol=(e,t,r)=>{(Array.isArray(t)?t:[t]).forEach(o=>{if(o)throw new Error(`Problem with log4js configuration: (${ow.inspect(e,{depth:5})}) - ${r}`)})},cw=e=>{Kt("New configuration to be validated: ",e),Ol(e,Il(Sl(e)),"must be an object."),Kt(`Calling pre-processing listeners (${Vo.length})`),Vo.forEach(t=>t(e)),Kt("Configuration pre-processing finished."),Kt(`Calling configuration listeners (${Ho.length})`),Ho.forEach(t=>t(e)),Kt("Configuration finished.")};Dl.exports={configure:cw,addListener:aw,addPreProcessingListener:uw,throwExceptionIf:Ol,anObject:Sl,anInteger:sw,validIdentifier:iw,not:Il}});var Jo=T((bF,Ke)=>{"use strict";u();function _l(e,t){for(var r=e.toString();r.length<t;)r="0"+r;return r}function Vt(e){return _l(e,2)}function lw(e){var t=Math.abs(e),r=String(Math.floor(t/60)),n=String(t%60);return r=("0"+r).slice(-2),n=("0"+n).slice(-2),e===0?"Z":(e<0?"+":"-")+r+":"+n}function Tl(e,t){typeof e!="string"&&(t=e,e=Ke.exports.ISO8601_FORMAT),t||(t=Ke.exports.now());var r=Vt(t.getDate()),n=Vt(t.getMonth()+1),o=Vt(t.getFullYear()),i=Vt(o.substring(2,4)),s=e.indexOf("yyyy")>-1?o:i,a=Vt(t.getHours()),c=Vt(t.getMinutes()),m=Vt(t.getSeconds()),f=_l(t.getMilliseconds(),3),h=lw(t.getTimezoneOffset()),p=e.replace(/dd/g,r).replace(/MM/g,n).replace(/y{1,4}/g,s).replace(/hh/g,a).replace(/mm/g,c).replace(/ss/g,m).replace(/SSS/g,f).replace(/O/g,h);return p}function Tt(e,t,r,n){e["set"+(n?"":"UTC")+t](r)}function fw(e,t,r){var n=e.indexOf("O")<0,o=!1,i=[{pattern:/y{1,4}/,regexp:"\\\\d{1,4}",fn:function(h,p){Tt(h,"FullYear",p,n)}},{pattern:/MM/,regexp:"\\\\d{1,2}",fn:function(h,p){Tt(h,"Month",p-1,n),h.getMonth()!==p-1&&(o=!0)}},{pattern:/dd/,regexp:"\\\\d{1,2}",fn:function(h,p){o&&Tt(h,"Month",h.getMonth()-1,n),Tt(h,"Date",p,n)}},{pattern:/hh/,regexp:"\\\\d{1,2}",fn:function(h,p){Tt(h,"Hours",p,n)}},{pattern:/mm/,regexp:"\\\\d\\\\d",fn:function(h,p){Tt(h,"Minutes",p,n)}},{pattern:/ss/,regexp:"\\\\d\\\\d",fn:function(h,p){Tt(h,"Seconds",p,n)}},{pattern:/SSS/,regexp:"\\\\d\\\\d\\\\d",fn:function(h,p){Tt(h,"Milliseconds",p,n)}},{pattern:/O/,regexp:"[+-]\\\\d{1,2}:?\\\\d{2}?|Z",fn:function(h,p){p==="Z"?p=0:p=p.replace(":","");var b=Math.abs(p),E=(p>0?-1:1)*(b%100+Math.floor(b/100)*60);h.setUTCMinutes(h.getUTCMinutes()+E)}}],s=i.reduce(function(h,p){return p.pattern.test(h.regexp)?(p.index=h.regexp.match(p.pattern).index,h.regexp=h.regexp.replace(p.pattern,"("+p.regexp+")")):p.index=-1,h},{regexp:e,index:[]}),a=i.filter(function(h){return h.index>-1});a.sort(function(h,p){return h.index-p.index});var c=new RegExp(s.regexp),m=c.exec(t);if(m){var f=r||Ke.exports.now();return a.forEach(function(h,p){h.fn(f,m[p+1])}),f}throw new Error("String \'"+t+"\' could not be parsed as \'"+e+"\'")}function pw(e,t,r){if(!e)throw new Error("pattern must be supplied");return fw(e,t,r)}function mw(){return new Date}Ke.exports=Tl;Ke.exports.asString=Tl;Ke.exports.parse=pw;Ke.exports.now=mw;Ke.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS";Ke.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO";Ke.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS";Ke.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"});var Xs=T((wF,Ll)=>{u();var Nt=Jo(),Nl=require("os"),vn=require("util"),bn=require("path"),Cl=require("url"),Al=Ee()("log4js:layouts"),Rl={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function Fl(e){return e?`\\x1B[${Rl[e][0]}m`:""}function $l(e){return e?`\\x1B[${Rl[e][1]}m`:""}function dw(e,t){return Fl(t)+e+$l(t)}function Pl(e,t){return dw(vn.format("[%s] [%s] %s - ",Nt.asString(e.startTime),e.level.toString(),e.categoryName),t)}function kl(e){return Pl(e)+vn.format(...e.data)}function Yo(e){return Pl(e,e.level.colour)+vn.format(...e.data)}function Ml(e){return vn.format(...e.data)}function ql(e){return e.data[0]}function jl(e,t){let r="%r %p %c - %m%n",n=/%(-?[0-9]+)?(\\.?-?[0-9]+)?([[\\]cdhmnprzxXyflos%])(\\{([^}]+)\\})?|([^%]+)/;e=e||r;function o(_,k){let $=_.categoryName;if(k){let W=parseInt(k,10),L=$.split(".");W<L.length&&($=L.slice(L.length-W).join("."))}return $}function i(_,k){let $=Nt.ISO8601_FORMAT;if(k)switch($=k,$){case"ISO8601":case"ISO8601_FORMAT":$=Nt.ISO8601_FORMAT;break;case"ISO8601_WITH_TZ_OFFSET":case"ISO8601_WITH_TZ_OFFSET_FORMAT":$=Nt.ISO8601_WITH_TZ_OFFSET_FORMAT;break;case"ABSOLUTE":process.emitWarning("Pattern %d{ABSOLUTE} is deprecated in favor of %d{ABSOLUTETIME}. Please use %d{ABSOLUTETIME} instead.","DeprecationWarning","log4js-node-DEP0003"),Al("[log4js-node-DEP0003]","DEPRECATION: Pattern %d{ABSOLUTE} is deprecated and replaced by %d{ABSOLUTETIME}.");case"ABSOLUTETIME":case"ABSOLUTETIME_FORMAT":$=Nt.ABSOLUTETIME_FORMAT;break;case"DATE":process.emitWarning("Pattern %d{DATE} is deprecated due to the confusion it causes when used. Please use %d{DATETIME} instead.","DeprecationWarning","log4js-node-DEP0004"),Al("[log4js-node-DEP0004]","DEPRECATION: Pattern %d{DATE} is deprecated and replaced by %d{DATETIME}.");case"DATETIME":case"DATETIME_FORMAT":$=Nt.DATETIME_FORMAT;break}return Nt.asString($,_.startTime)}function s(){return Nl.hostname().toString()}function a(_){return vn.format(..._.data)}function c(){return Nl.EOL}function m(_){return _.level.toString()}function f(_){return Nt.asString("hh:mm:ss",_.startTime)}function h(_){return Fl(_.level.colour)}function p(_){return $l(_.level.colour)}function b(){return"%"}function E(_){return _&&_.pid?_.pid.toString():process.pid.toString()}function I(){return E()}function D(_,k){return typeof t[k]<"u"?typeof t[k]=="function"?t[k](_):t[k]:null}function A(_,k){let $=_.context[k];return typeof $<"u"?typeof $=="function"?$(_):$:null}function j(_,k){let $=_.fileName||"";if($=function(L){let G="file://";return L.startsWith(G)&&(typeof Cl.fileURLToPath=="function"?L=Cl.fileURLToPath(L):(L=bn.normalize(L.replace(new RegExp(`^${G}`),"")),process.platform==="win32"&&(L.startsWith("\\\\")?L=L.slice(1):L=bn.sep+bn.sep+L))),L}($),k){let L=parseInt(k,10),G=$.split(bn.sep);G.length>L&&($=G.slice(-L).join(bn.sep))}return $}function q(_){return _.lineNumber?`${_.lineNumber}`:""}function ne(_){return _.columnNumber?`${_.columnNumber}`:""}function Ie(_){return _.callStack||""}let F={c:o,d:i,h:s,m:a,n:c,p:m,r:f,"[":h,"]":p,y:I,z:E,"%":b,x:D,X:A,f:j,l:q,o:ne,s:Ie};function z(_,k,$){return F[_](k,$)}function U(_,k){let $;return _?($=parseInt(_.slice(1),10),$>0?k.slice(0,$):k.slice($)):k}function P(_,k){let $;if(_)if(_.charAt(0)==="-")for($=parseInt(_.slice(1),10);k.length<$;)k+=" ";else for($=parseInt(_,10);k.length<$;)k=` ${k}`;return k}function B(_,k,$){let W=_;return W=U(k,W),W=P($,W),W}return function(_){let k="",$,W=e;for(;($=n.exec(W))!==null;){let L=$[1],G=$[2],V=$[3],re=$[5],Z=$[6];if(Z)k+=Z.toString();else{let Zn=z(V,_,re);k+=B(Zn,G,L)}W=W.slice($.index+$[0].length)}return k}}var Qs={messagePassThrough(){return Ml},basic(){return kl},colored(){return Yo},coloured(){return Yo},pattern(e){return jl(e&&e.pattern,e&&e.tokens)},dummy(){return ql}};Ll.exports={basicLayout:kl,messagePassThroughLayout:Ml,patternLayout:jl,colouredLayout:Yo,coloredLayout:Yo,dummyLayout:ql,addLayout(e,t){Qs[e]=t},layout(e,t){return Qs[e]&&Qs[e](t)}}});var Ht=T((EF,Ul)=>{u();var he=Gt(),Bl=["white","grey","black","blue","cyan","green","magenta","red","yellow"],ge=class{constructor(t,r,n){this.level=t,this.levelStr=r,this.colour=n}toString(){return this.levelStr}static getLevel(t,r){return t?t instanceof ge?t:(t instanceof Object&&t.levelStr&&(t=t.levelStr),ge[t.toString().toUpperCase()]||r):r}static addLevels(t){t&&(Object.keys(t).forEach(n=>{let o=n.toUpperCase();ge[o]=new ge(t[n].value,o,t[n].colour);let i=ge.levels.findIndex(s=>s.levelStr===o);i>-1?ge.levels[i]=ge[o]:ge.levels.push(ge[o])}),ge.levels.sort((n,o)=>n.level-o.level))}isLessThanOrEqualTo(t){return typeof t=="string"&&(t=ge.getLevel(t)),this.level<=t.level}isGreaterThanOrEqualTo(t){return typeof t=="string"&&(t=ge.getLevel(t)),this.level>=t.level}isEqualTo(t){return typeof t=="string"&&(t=ge.getLevel(t)),this.level===t.level}};ge.levels=[];ge.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}});he.addListener(e=>{let t=e.levels;t&&(he.throwExceptionIf(e,he.not(he.anObject(t)),"levels must be an object"),Object.keys(t).forEach(n=>{he.throwExceptionIf(e,he.not(he.validIdentifier(n)),`level name "${n}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),he.throwExceptionIf(e,he.not(he.anObject(t[n])),`level "${n}" must be an object`),he.throwExceptionIf(e,he.not(t[n].value),`level "${n}" must have a \'value\' property`),he.throwExceptionIf(e,he.not(he.anInteger(t[n].value)),`level "${n}".value must have an integer value`),he.throwExceptionIf(e,he.not(t[n].colour),`level "${n}" must have a \'colour\' property`),he.throwExceptionIf(e,he.not(Bl.indexOf(t[n].colour)>-1),`level "${n}".colour must be one of ${Bl.join(", ")}`)}))});he.addListener(e=>{ge.addLevels(e.levels)});Ul.exports=ge});var Ql=T(xn=>{"use strict";u();var{parse:Kl,stringify:Gl}=JSON,{keys:hw}=Object,wn=String,Vl="string",zl={},Zo="object",Hl=(e,t)=>t,gw=e=>e instanceof wn?wn(e):e,yw=(e,t)=>typeof t===Vl?new wn(t):t,Jl=(e,t,r,n)=>{let o=[];for(let i=hw(r),{length:s}=i,a=0;a<s;a++){let c=i[a],m=r[c];if(m instanceof wn){let f=e[m];typeof f===Zo&&!t.has(f)?(t.add(f),r[c]=zl,o.push({k:c,a:[e,t,f,n]})):r[c]=n.call(r,c,f)}else r[c]!==zl&&(r[c]=n.call(r,c,m))}for(let{length:i}=o,s=0;s<i;s++){let{k:a,a:c}=o[s];r[a]=n.call(r,a,Jl.apply(null,c))}return r},Wl=(e,t,r)=>{let n=wn(t.push(r)-1);return e.set(r,n),n},Yl=(e,t)=>{let r=Kl(e,yw).map(gw),n=r[0],o=t||Hl,i=typeof n===Zo&&n?Jl(r,new Set,n,o):n;return o.call({"":i},"",i)};xn.parse=Yl;var Zl=(e,t,r)=>{let n=t&&typeof t===Zo?(f,h)=>f===""||-1<t.indexOf(f)?h:void 0:t||Hl,o=new Map,i=[],s=[],a=+Wl(o,i,n.call({"":e},"",e)),c=!a;for(;a<i.length;)c=!0,s[a]=Gl(i[a++],m,r);return"["+s.join(",")+"]";function m(f,h){if(c)return c=!c,h;let p=n.call(this,f,h);switch(typeof p){case Zo:if(p===null)return p;case Vl:return o.get(p)||Wl(o,i,p)}return p}};xn.stringify=Zl;var bw=e=>Kl(Zl(e));xn.toJSON=bw;var vw=e=>Yl(Gl(e));xn.fromJSON=vw});var ea=T((DF,tf)=>{u();var Xl=Ql(),ef=Ht(),xr=class{constructor(t,r,n,o,i){this.startTime=new Date,this.categoryName=t,this.data=n,this.level=r,this.context=Object.assign({},o),this.pid=process.pid,i&&(this.functionName=i.functionName,this.fileName=i.fileName,this.lineNumber=i.lineNumber,this.columnNumber=i.columnNumber,this.callStack=i.callStack)}serialise(){return Xl.stringify(this,(t,r)=>(r&&r.message&&r.stack?r=Object.assign({message:r.message,stack:r.stack},r):typeof r=="number"&&(Number.isNaN(r)||!Number.isFinite(r))?r=r.toString():typeof r>"u"&&(r=typeof r),r))}static deserialise(t){let r;try{let n=Xl.parse(t,(o,i)=>{if(i&&i.message&&i.stack){let s=new Error(i);Object.keys(i).forEach(a=>{s[a]=i[a]}),i=s}return i});n.location={functionName:n.functionName,fileName:n.fileName,lineNumber:n.lineNumber,columnNumber:n.columnNumber,callStack:n.callStack},r=new xr(n.categoryName,ef.getLevel(n.level.levelStr),n.data,n.context,n.location),r.startTime=new Date(n.startTime),r.pid=n.pid,r.cluster=n.cluster}catch(n){r=new xr("log4js",ef.ERROR,["Unable to parse log:",t,"because: ",n])}return r}};tf.exports=xr});var Xo=T((TF,of)=>{u();var Ge=Ee()("log4js:clustering"),ww=ea(),xw=Gt(),Er=!1,Ve=null;try{Ve=require("cluster")}catch{Ge("cluster module not present"),Er=!0}var ra=[],In=!1,En="NODE_APP_INSTANCE",rf=()=>In&&process.env[En]==="0",ta=()=>Er||Ve&&Ve.isMaster||rf(),nf=e=>{ra.forEach(t=>t(e))},Qo=(e,t)=>{if(Ge("cluster message received from worker ",e,": ",t),e.topic&&e.data&&(t=e,e=void 0),t&&t.topic&&t.topic==="log4js:message"){Ge("received message: ",t.data);let r=ww.deserialise(t.data);nf(r)}};Er||xw.addListener(e=>{ra.length=0,{pm2:In,disableClustering:Er,pm2InstanceVar:En="NODE_APP_INSTANCE"}=e,Ge(`clustering disabled ? ${Er}`),Ge(`cluster.isMaster ? ${Ve&&Ve.isMaster}`),Ge(`pm2 enabled ? ${In}`),Ge(`pm2InstanceVar = ${En}`),Ge(`process.env[${En}] = ${process.env[En]}`),In&&process.removeListener("message",Qo),Ve&&Ve.removeListener&&Ve.removeListener("message",Qo),Er||e.disableClustering?Ge("Not listening for cluster messages, because clustering disabled."):rf()?(Ge("listening for PM2 broadcast messages"),process.on("message",Qo)):Ve&&Ve.isMaster?(Ge("listening for cluster messages"),Ve.on("message",Qo)):Ge("not listening for messages, because we are not a master process")});of.exports={onlyOnMaster:(e,t)=>ta()?e():t,isMaster:ta,send:e=>{ta()?nf(e):(In||(e.cluster={workerId:Ve.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{ra.push(e)}}});var uf=T((CF,af)=>{u();function Ew(e){if(typeof e=="number"&&Number.isInteger(e))return e;let t={K:1024,M:1024*1024,G:1024*1024*1024},r=Object.keys(t),n=e.slice(-1).toLocaleUpperCase(),o=e.slice(0,-1).trim();if(r.indexOf(n)<0||!Number.isInteger(Number(o)))throw Error(`maxLogSize: "${e}" is invalid`);return o*t[n]}function Iw(e,t){let r=Object.assign({},t);return Object.keys(e).forEach(n=>{r[n]&&(r[n]=e[n](t[n]))}),r}function na(e){return Iw({maxLogSize:Ew},e)}var sf={dateFile:na,file:na,fileSync:na};af.exports.modifyConfig=e=>sf[e.type]?sf[e.type](e):e});var lf=T((RF,cf)=>{u();var Sw=console.log.bind(console);function Ow(e,t){return r=>{Sw(e(r,t))}}function Dw(e,t){let r=t.colouredLayout;return e.layout&&(r=t.layout(e.layout.type,e.layout)),Ow(r,e.timezoneOffset)}cf.exports.configure=Dw});var pf=T(ff=>{u();function _w(e,t){return r=>{process.stdout.write(`${e(r,t)}\n`)}}function Tw(e,t){let r=t.colouredLayout;return e.layout&&(r=t.layout(e.layout.type,e.layout)),_w(r,e.timezoneOffset)}ff.configure=Tw});var df=T((kF,mf)=>{u();function Nw(e,t){return r=>{process.stderr.write(`${e(r,t)}\n`)}}function Cw(e,t){let r=t.colouredLayout;return e.layout&&(r=t.layout(e.layout.type,e.layout)),Nw(r,e.timezoneOffset)}mf.exports.configure=Cw});var gf=T((qF,hf)=>{u();function Aw(e,t,r,n){let o=n.getLevel(e),i=n.getLevel(t,n.FATAL);return s=>{let a=s.level;o.isLessThanOrEqualTo(a)&&i.isGreaterThanOrEqualTo(a)&&r(s)}}function Rw(e,t,r,n){let o=r(e.appender);return Aw(e.level,e.maxLevel,o,n)}hf.exports.configure=Rw});var vf=T((LF,bf)=>{u();var yf=Ee()("log4js:categoryFilter");function Fw(e,t){return typeof e=="string"&&(e=[e]),r=>{yf(`Checking ${r.categoryName} against ${e}`),e.indexOf(r.categoryName)===-1&&(yf("Not excluded, sending to appender"),t(r))}}function $w(e,t,r){let n=r(e.appender);return Fw(e.exclude,n)}bf.exports.configure=$w});var Ef=T((UF,xf)=>{u();var wf=Ee()("log4js:noLogFilter");function Pw(e){return e.filter(r=>r!=null&&r!=="")}function kw(e,t){return r=>{wf(`Checking data: ${r.data} against filters: ${e}`),typeof e=="string"&&(e=[e]),e=Pw(e);let n=new RegExp(e.join("|"),"i");(e.length===0||r.data.findIndex(o=>n.test(o))<0)&&(wf("Not excluded, sending to appender"),t(r))}}function Mw(e,t,r){let n=r(e.appender);return kw(e.exclude,n)}xf.exports.configure=Mw});var Re=T(oa=>{"use strict";u();oa.fromCallback=function(e){return Object.defineProperty(function(){if(typeof arguments[arguments.length-1]=="function")e.apply(this,arguments);else return new Promise((t,r)=>{arguments[arguments.length]=(n,o)=>{if(n)return r(n);t(o)},arguments.length++,e.apply(this,arguments)})},"name",{value:e.name})};oa.fromPromise=function(e){return Object.defineProperty(function(){let t=arguments[arguments.length-1];if(typeof t!="function")return e.apply(this,arguments);e.apply(this,arguments).then(r=>t(null,r),t)},"name",{value:e.name})}});var Sf=T((GF,If)=>{u();var Ct=require("constants"),qw=process.cwd,ei=null,jw=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return ei||(ei=qw.call(process)),ei};try{process.cwd()}catch{}typeof process.chdir=="function"&&(ia=process.chdir,process.chdir=function(e){ei=null,ia.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,ia));var ia;If.exports=Lw;function Lw(e){Ct.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\\.6\\.[0-2]|^v0\\.5\\./)&&t(e),e.lutimes||r(e),e.chown=i(e.chown),e.fchown=i(e.fchown),e.lchown=i(e.lchown),e.chmod=n(e.chmod),e.fchmod=n(e.fchmod),e.lchmod=n(e.lchmod),e.chownSync=s(e.chownSync),e.fchownSync=s(e.fchownSync),e.lchownSync=s(e.lchownSync),e.chmodSync=o(e.chmodSync),e.fchmodSync=o(e.fchmodSync),e.lchmodSync=o(e.lchmodSync),e.stat=a(e.stat),e.fstat=a(e.fstat),e.lstat=a(e.lstat),e.statSync=c(e.statSync),e.fstatSync=c(e.fstatSync),e.lstatSync=c(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(f,h,p){p&&process.nextTick(p)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(f,h,p,b){b&&process.nextTick(b)},e.lchownSync=function(){}),jw==="win32"&&(e.rename=typeof e.rename!="function"?e.rename:function(f){function h(p,b,E){var I=Date.now(),D=0;f(p,b,function A(j){if(j&&(j.code==="EACCES"||j.code==="EPERM"||j.code==="EBUSY")&&Date.now()-I<6e4){setTimeout(function(){e.stat(b,function(q,ne){q&&q.code==="ENOENT"?f(p,b,A):E(j)})},D),D<100&&(D+=10);return}E&&E(j)})}return Object.setPrototypeOf&&Object.setPrototypeOf(h,f),h}(e.rename)),e.read=typeof e.read!="function"?e.read:function(f){function h(p,b,E,I,D,A){var j;if(A&&typeof A=="function"){var q=0;j=function(ne,Ie,F){if(ne&&ne.code==="EAGAIN"&&q<10)return q++,f.call(e,p,b,E,I,D,j);A.apply(this,arguments)}}return f.call(e,p,b,E,I,D,j)}return Object.setPrototypeOf&&Object.setPrototypeOf(h,f),h}(e.read),e.readSync=typeof e.readSync!="function"?e.readSync:function(f){return function(h,p,b,E,I){for(var D=0;;)try{return f.call(e,h,p,b,E,I)}catch(A){if(A.code==="EAGAIN"&&D<10){D++;continue}throw A}}}(e.readSync);function t(f){f.lchmod=function(h,p,b){f.open(h,Ct.O_WRONLY|Ct.O_SYMLINK,p,function(E,I){if(E){b&&b(E);return}f.fchmod(I,p,function(D){f.close(I,function(A){b&&b(D||A)})})})},f.lchmodSync=function(h,p){var b=f.openSync(h,Ct.O_WRONLY|Ct.O_SYMLINK,p),E=!0,I;try{I=f.fchmodSync(b,p),E=!1}finally{if(E)try{f.closeSync(b)}catch{}else f.closeSync(b)}return I}}function r(f){Ct.hasOwnProperty("O_SYMLINK")&&f.futimes?(f.lutimes=function(h,p,b,E){f.open(h,Ct.O_SYMLINK,function(I,D){if(I){E&&E(I);return}f.futimes(D,p,b,function(A){f.close(D,function(j){E&&E(A||j)})})})},f.lutimesSync=function(h,p,b){var E=f.openSync(h,Ct.O_SYMLINK),I,D=!0;try{I=f.futimesSync(E,p,b),D=!1}finally{if(D)try{f.closeSync(E)}catch{}else f.closeSync(E)}return I}):f.futimes&&(f.lutimes=function(h,p,b,E){E&&process.nextTick(E)},f.lutimesSync=function(){})}function n(f){return f&&function(h,p,b){return f.call(e,h,p,function(E){m(E)&&(E=null),b&&b.apply(this,arguments)})}}function o(f){return f&&function(h,p){try{return f.call(e,h,p)}catch(b){if(!m(b))throw b}}}function i(f){return f&&function(h,p,b,E){return f.call(e,h,p,b,function(I){m(I)&&(I=null),E&&E.apply(this,arguments)})}}function s(f){return f&&function(h,p,b){try{return f.call(e,h,p,b)}catch(E){if(!m(E))throw E}}}function a(f){return f&&function(h,p,b){typeof p=="function"&&(b=p,p=null);function E(I,D){D&&(D.uid<0&&(D.uid+=4294967296),D.gid<0&&(D.gid+=4294967296)),b&&b.apply(this,arguments)}return p?f.call(e,h,p,E):f.call(e,h,E)}}function c(f){return f&&function(h,p){var b=p?f.call(e,h,p):f.call(e,h);return b&&(b.uid<0&&(b.uid+=4294967296),b.gid<0&&(b.gid+=4294967296)),b}}function m(f){if(!f||f.code==="ENOSYS")return!0;var h=!process.getuid||process.getuid()!==0;return!!(h&&(f.code==="EINVAL"||f.code==="EPERM"))}}});var _f=T((HF,Df)=>{u();var Of=require("stream").Stream;Df.exports=Bw;function Bw(e){return{ReadStream:t,WriteStream:r};function t(n,o){if(!(this instanceof t))return new t(n,o);Of.call(this);var i=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,o=o||{};for(var s=Object.keys(o),a=0,c=s.length;a<c;a++){var m=s[a];this[m]=o[m]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){i._read()});return}e.open(this.path,this.flags,this.mode,function(f,h){if(f){i.emit("error",f),i.readable=!1;return}i.fd=h,i.emit("open",h),i._read()})}function r(n,o){if(!(this instanceof r))return new r(n,o);Of.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,o=o||{};for(var i=Object.keys(o),s=0,a=i.length;s<a;s++){var c=i[s];this[c]=o[c]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var Nf=T((YF,Tf)=>{"use strict";u();Tf.exports=zw;var Uw=Object.getPrototypeOf||function(e){return e.__proto__};function zw(e){if(e===null||typeof e!="object")return e;if(e instanceof Object)var t={__proto__:Uw(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}});var ye=T((QF,ua)=>{u();var ce=require("fs"),Ww=Sf(),Kw=_f(),Gw=Nf(),ti=require("util"),Se,ni;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Se=Symbol.for("graceful-fs.queue"),ni=Symbol.for("graceful-fs.previous")):(Se="___graceful-fs.queue",ni="___graceful-fs.previous");function Vw(){}function Rf(e,t){Object.defineProperty(e,Se,{get:function(){return t}})}var Jt=Vw;ti.debuglog?Jt=ti.debuglog("gfs4"):/\\bgfs4\\b/i.test(process.env.NODE_DEBUG||"")&&(Jt=function(){var e=ti.format.apply(ti,arguments);e="GFS4: "+e.split(/\\n/).join(`\nGFS4: `),console.error(e)});ce[Se]||(Cf=global[Se]||[],Rf(ce,Cf),ce.close=function(e){function t(r,n){return e.call(ce,r,function(o){o||Af(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(t,ni,{value:e}),t}(ce.close),ce.closeSync=function(e){function t(r){e.apply(ce,arguments),Af()}return Object.defineProperty(t,ni,{value:e}),t}(ce.closeSync),/\\bgfs4\\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Jt(ce[Se]),require("assert").equal(ce[Se].length,0)}));var Cf;global[Se]||Rf(global,ce[Se]);ua.exports=sa(Gw(ce));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!ce.__patched&&(ua.exports=sa(ce),ce.__patched=!0);function sa(e){Ww(e),e.gracefulify=sa,e.createReadStream=Ie,e.createWriteStream=F;var t=e.readFile;e.readFile=r;function r(P,B,_){return typeof B=="function"&&(_=B,B=null),k(P,B,_);function k($,W,L,G){return t($,W,function(V){V&&(V.code==="EMFILE"||V.code==="ENFILE")?Ir([k,[$,W,L],V,G||Date.now(),Date.now()]):typeof L=="function"&&L.apply(this,arguments)})}}var n=e.writeFile;e.writeFile=o;function o(P,B,_,k){return typeof _=="function"&&(k=_,_=null),$(P,B,_,k);function $(W,L,G,V,re){return n(W,L,G,function(Z){Z&&(Z.code==="EMFILE"||Z.code==="ENFILE")?Ir([$,[W,L,G,V],Z,re||Date.now(),Date.now()]):typeof V=="function"&&V.apply(this,arguments)})}}var i=e.appendFile;i&&(e.appendFile=s);function s(P,B,_,k){return typeof _=="function"&&(k=_,_=null),$(P,B,_,k);function $(W,L,G,V,re){return i(W,L,G,function(Z){Z&&(Z.code==="EMFILE"||Z.code==="ENFILE")?Ir([$,[W,L,G,V],Z,re||Date.now(),Date.now()]):typeof V=="function"&&V.apply(this,arguments)})}}var a=e.copyFile;a&&(e.copyFile=c);function c(P,B,_,k){return typeof _=="function"&&(k=_,_=0),$(P,B,_,k);function $(W,L,G,V,re){return a(W,L,G,function(Z){Z&&(Z.code==="EMFILE"||Z.code==="ENFILE")?Ir([$,[W,L,G,V],Z,re||Date.now(),Date.now()]):typeof V=="function"&&V.apply(this,arguments)})}}var m=e.readdir;e.readdir=h;var f=/^v[0-5]\\./;function h(P,B,_){typeof B=="function"&&(_=B,B=null);var k=f.test(process.version)?function(L,G,V,re){return m(L,$(L,G,V,re))}:function(L,G,V,re){return m(L,G,$(L,G,V,re))};return k(P,B,_);function $(W,L,G,V){return function(re,Z){re&&(re.code==="EMFILE"||re.code==="ENFILE")?Ir([k,[W,L,G],re,V||Date.now(),Date.now()]):(Z&&Z.sort&&Z.sort(),typeof G=="function"&&G.call(this,re,Z))}}}if(process.version.substr(0,4)==="v0.8"){var p=Kw(e);A=p.ReadStream,q=p.WriteStream}var b=e.ReadStream;b&&(A.prototype=Object.create(b.prototype),A.prototype.open=j);var E=e.WriteStream;E&&(q.prototype=Object.create(E.prototype),q.prototype.open=ne),Object.defineProperty(e,"ReadStream",{get:function(){return A},set:function(P){A=P},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return q},set:function(P){q=P},enumerable:!0,configurable:!0});var I=A;Object.defineProperty(e,"FileReadStream",{get:function(){return I},set:function(P){I=P},enumerable:!0,configurable:!0});var D=q;Object.defineProperty(e,"FileWriteStream",{get:function(){return D},set:function(P){D=P},enumerable:!0,configurable:!0});function A(P,B){return this instanceof A?(b.apply(this,arguments),this):A.apply(Object.create(A.prototype),arguments)}function j(){var P=this;U(P.path,P.flags,P.mode,function(B,_){B?(P.autoClose&&P.destroy(),P.emit("error",B)):(P.fd=_,P.emit("open",_),P.read())})}function q(P,B){return this instanceof q?(E.apply(this,arguments),this):q.apply(Object.create(q.prototype),arguments)}function ne(){var P=this;U(P.path,P.flags,P.mode,function(B,_){B?(P.destroy(),P.emit("error",B)):(P.fd=_,P.emit("open",_))})}function Ie(P,B){return new e.ReadStream(P,B)}function F(P,B){return new e.WriteStream(P,B)}var z=e.open;e.open=U;function U(P,B,_,k){return typeof _=="function"&&(k=_,_=null),$(P,B,_,k);function $(W,L,G,V,re){return z(W,L,G,function(Z,Zn){Z&&(Z.code==="EMFILE"||Z.code==="ENFILE")?Ir([$,[W,L,G,V],Z,re||Date.now(),Date.now()]):typeof V=="function"&&V.apply(this,arguments)})}}return e}function Ir(e){Jt("ENQUEUE",e[0].name,e[1]),ce[Se].push(e),aa()}var ri;function Af(){for(var e=Date.now(),t=0;t<ce[Se].length;++t)ce[Se][t].length>2&&(ce[Se][t][3]=e,ce[Se][t][4]=e);aa()}function aa(){if(clearTimeout(ri),ri=void 0,ce[Se].length!==0){var e=ce[Se].shift(),t=e[0],r=e[1],n=e[2],o=e[3],i=e[4];if(o===void 0)Jt("RETRY",t.name,r),t.apply(null,r);else if(Date.now()-o>=6e4){Jt("TIMEOUT",t.name,r);var s=r.pop();typeof s=="function"&&s.call(null,n)}else{var a=Date.now()-i,c=Math.max(i-o,1),m=Math.min(c*1.2,100);a>=m?(Jt("RETRY",t.name,r),t.apply(null,r.concat([o]))):ce[Se].push(e)}ri===void 0&&(ri=setTimeout(aa,0))}}});var ca=T(Yt=>{"use strict";u();var Ff=Re().fromCallback,He=ye(),Hw=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(e=>typeof He[e]=="function");Object.keys(He).forEach(e=>{e!=="promises"&&(Yt[e]=He[e])});Hw.forEach(e=>{Yt[e]=Ff(He[e])});Yt.exists=function(e,t){return typeof t=="function"?He.exists(e,t):new Promise(r=>He.exists(e,r))};Yt.read=function(e,t,r,n,o,i){return typeof i=="function"?He.read(e,t,r,n,o,i):new Promise((s,a)=>{He.read(e,t,r,n,o,(c,m,f)=>{if(c)return a(c);s({bytesRead:m,buffer:f})})})};Yt.write=function(e,t,...r){return typeof r[r.length-1]=="function"?He.write(e,t,...r):new Promise((n,o)=>{He.write(e,t,...r,(i,s,a)=>{if(i)return o(i);n({bytesWritten:s,buffer:a})})})};typeof He.realpath.native=="function"&&(Yt.realpath.native=Ff(He.realpath.native))});var fa=T((r$,Pf)=>{"use strict";u();var la=require("path");function $f(e){return e=la.normalize(la.resolve(e)).split(la.sep),e.length>0?e[0]:null}var Jw=/[<>:"|?*]/;function Yw(e){let t=$f(e);return e=e.replace(t,""),Jw.test(e)}Pf.exports={getRootPath:$f,invalidWin32Path:Yw}});var Mf=T((o$,kf)=>{"use strict";u();var Zw=ye(),pa=require("path"),Qw=fa().invalidWin32Path,Xw=parseInt("0777",8);function ma(e,t,r,n){if(typeof t=="function"?(r=t,t={}):(!t||typeof t!="object")&&(t={mode:t}),process.platform==="win32"&&Qw(e)){let s=new Error(e+" contains invalid WIN32 path characters.");return s.code="EINVAL",r(s)}let o=t.mode,i=t.fs||Zw;o===void 0&&(o=Xw&~process.umask()),n||(n=null),r=r||function(){},e=pa.resolve(e),i.mkdir(e,o,s=>{if(!s)return n=n||e,r(null,n);switch(s.code){case"ENOENT":if(pa.dirname(e)===e)return r(s);ma(pa.dirname(e),t,(a,c)=>{a?r(a,c):ma(e,t,r,c)});break;default:i.stat(e,(a,c)=>{a||!c.isDirectory()?r(s,n):r(null,n)});break}})}kf.exports=ma});var jf=T((s$,qf)=>{"use strict";u();var ex=ye(),da=require("path"),tx=fa().invalidWin32Path,rx=parseInt("0777",8);function ha(e,t,r){(!t||typeof t!="object")&&(t={mode:t});let n=t.mode,o=t.fs||ex;if(process.platform==="win32"&&tx(e)){let i=new Error(e+" contains invalid WIN32 path characters.");throw i.code="EINVAL",i}n===void 0&&(n=rx&~process.umask()),r||(r=null),e=da.resolve(e);try{o.mkdirSync(e,n),r=r||e}catch(i){if(i.code==="ENOENT"){if(da.dirname(e)===e)throw i;r=ha(da.dirname(e),t,r),ha(e,t,r)}else{let s;try{s=o.statSync(e)}catch{throw i}if(!s.isDirectory())throw i}}return r}qf.exports=ha});var ke=T((u$,Lf)=>{"use strict";u();var nx=Re().fromCallback,ga=nx(Mf()),ya=jf();Lf.exports={mkdirs:ga,mkdirsSync:ya,mkdirp:ga,mkdirpSync:ya,ensureDir:ga,ensureDirSync:ya}});var ba=T((l$,Uf)=>{"use strict";u();var De=ye(),Bf=require("os"),oi=require("path");function ox(){let e=oi.join("millis-test-sync"+Date.now().toString()+Math.random().toString().slice(2));e=oi.join(Bf.tmpdir(),e);let t=new Date(1435410243862);De.writeFileSync(e,"https://github.com/jprichardson/node-fs-extra/pull/141");let r=De.openSync(e,"r+");return De.futimesSync(r,t,t),De.closeSync(r),De.statSync(e).mtime>1435410243e3}function ix(e){let t=oi.join("millis-test"+Date.now().toString()+Math.random().toString().slice(2));t=oi.join(Bf.tmpdir(),t);let r=new Date(1435410243862);De.writeFile(t,"https://github.com/jprichardson/node-fs-extra/pull/141",n=>{if(n)return e(n);De.open(t,"r+",(o,i)=>{if(o)return e(o);De.futimes(i,r,r,s=>{if(s)return e(s);De.close(i,a=>{if(a)return e(a);De.stat(t,(c,m)=>{if(c)return e(c);e(null,m.mtime>1435410243e3)})})})})})}function sx(e){if(typeof e=="number")return Math.floor(e/1e3)*1e3;if(e instanceof Date)return new Date(Math.floor(e.getTime()/1e3)*1e3);throw new Error("fs-extra: timeRemoveMillis() unknown parameter type")}function ax(e,t,r,n){De.open(e,"r+",(o,i)=>{if(o)return n(o);De.futimes(i,t,r,s=>{De.close(i,a=>{n&&n(s||a)})})})}function ux(e,t,r){let n=De.openSync(e,"r+");return De.futimesSync(n,t,r),De.closeSync(n)}Uf.exports={hasMillisRes:ix,hasMillisResSync:ox,timeRemoveMillis:sx,utimesMillis:ax,utimesMillisSync:ux}});var Dn=T((p$,Hf)=>{"use strict";u();var Je=ye(),Fe=require("path"),zf=10,Wf=5,cx=0,wa=process.versions.node.split("."),Kf=Number.parseInt(wa[0],10),Gf=Number.parseInt(wa[1],10),lx=Number.parseInt(wa[2],10);function Sn(){if(Kf>zf)return!0;if(Kf===zf){if(Gf>Wf)return!0;if(Gf===Wf&&lx>=cx)return!0}return!1}function fx(e,t,r){Sn()?Je.stat(e,{bigint:!0},(n,o)=>{if(n)return r(n);Je.stat(t,{bigint:!0},(i,s)=>i?i.code==="ENOENT"?r(null,{srcStat:o,destStat:null}):r(i):r(null,{srcStat:o,destStat:s}))}):Je.stat(e,(n,o)=>{if(n)return r(n);Je.stat(t,(i,s)=>i?i.code==="ENOENT"?r(null,{srcStat:o,destStat:null}):r(i):r(null,{srcStat:o,destStat:s}))})}function px(e,t){let r,n;Sn()?r=Je.statSync(e,{bigint:!0}):r=Je.statSync(e);try{Sn()?n=Je.statSync(t,{bigint:!0}):n=Je.statSync(t)}catch(o){if(o.code==="ENOENT")return{srcStat:r,destStat:null};throw o}return{srcStat:r,destStat:n}}function mx(e,t,r,n){fx(e,t,(o,i)=>{if(o)return n(o);let{srcStat:s,destStat:a}=i;return a&&a.ino&&a.dev&&a.ino===s.ino&&a.dev===s.dev?n(new Error("Source and destination must not be the same.")):s.isDirectory()&&xa(e,t)?n(new Error(On(e,t,r))):n(null,{srcStat:s,destStat:a})})}function dx(e,t,r){let{srcStat:n,destStat:o}=px(e,t);if(o&&o.ino&&o.dev&&o.ino===n.ino&&o.dev===n.dev)throw new Error("Source and destination must not be the same.");if(n.isDirectory()&&xa(e,t))throw new Error(On(e,t,r));return{srcStat:n,destStat:o}}function va(e,t,r,n,o){let i=Fe.resolve(Fe.dirname(e)),s=Fe.resolve(Fe.dirname(r));if(s===i||s===Fe.parse(s).root)return o();Sn()?Je.stat(s,{bigint:!0},(a,c)=>a?a.code==="ENOENT"?o():o(a):c.ino&&c.dev&&c.ino===t.ino&&c.dev===t.dev?o(new Error(On(e,r,n))):va(e,t,s,n,o)):Je.stat(s,(a,c)=>a?a.code==="ENOENT"?o():o(a):c.ino&&c.dev&&c.ino===t.ino&&c.dev===t.dev?o(new Error(On(e,r,n))):va(e,t,s,n,o))}function Vf(e,t,r,n){let o=Fe.resolve(Fe.dirname(e)),i=Fe.resolve(Fe.dirname(r));if(i===o||i===Fe.parse(i).root)return;let s;try{Sn()?s=Je.statSync(i,{bigint:!0}):s=Je.statSync(i)}catch(a){if(a.code==="ENOENT")return;throw a}if(s.ino&&s.dev&&s.ino===t.ino&&s.dev===t.dev)throw new Error(On(e,r,n));return Vf(e,t,i,n)}function xa(e,t){let r=Fe.resolve(e).split(Fe.sep).filter(o=>o),n=Fe.resolve(t).split(Fe.sep).filter(o=>o);return r.reduce((o,i,s)=>o&&n[s]===i,!0)}function On(e,t,r){return`Cannot ${r} \'${e}\' to a subdirectory of itself, \'${t}\'.`}Hf.exports={checkPaths:mx,checkPathsSync:dx,checkParentPaths:va,checkParentPathsSync:Vf,isSrcSubdir:xa}});var Yf=T((d$,Jf)=>{"use strict";u();Jf.exports=function(e){if(typeof Buffer.allocUnsafe=="function")try{return Buffer.allocUnsafe(e)}catch{return new Buffer(e)}return new Buffer(e)}});var tp=T((g$,ep)=>{"use strict";u();var se=ye(),_n=require("path"),hx=ke().mkdirsSync,gx=ba().utimesMillisSync,Tn=Dn();function yx(e,t,r){typeof r=="function"&&(r={filter:r}),r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269`);let{srcStat:n,destStat:o}=Tn.checkPathsSync(e,t,"copy");return Tn.checkParentPathsSync(e,n,t,"copy"),bx(o,e,t,r)}function bx(e,t,r,n){if(n.filter&&!n.filter(t,r))return;let o=_n.dirname(r);return se.existsSync(o)||hx(o),Zf(e,t,r,n)}function Zf(e,t,r,n){if(!(n.filter&&!n.filter(t,r)))return vx(e,t,r,n)}function vx(e,t,r,n){let i=(n.dereference?se.statSync:se.lstatSync)(t);if(i.isDirectory())return Ix(i,e,t,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return wx(i,e,t,r,n);if(i.isSymbolicLink())return Dx(e,t,r,n)}function wx(e,t,r,n,o){return t?xx(e,r,n,o):Qf(e,r,n,o)}function xx(e,t,r,n){if(n.overwrite)return se.unlinkSync(r),Qf(e,t,r,n);if(n.errorOnExist)throw new Error(`\'${r}\' already exists`)}function Qf(e,t,r,n){return typeof se.copyFileSync=="function"?(se.copyFileSync(t,r),se.chmodSync(r,e.mode),n.preserveTimestamps?gx(r,e.atime,e.mtime):void 0):Ex(e,t,r,n)}function Ex(e,t,r,n){let i=Yf()(65536),s=se.openSync(t,"r"),a=se.openSync(r,"w",e.mode),c=0;for(;c<e.size;){let m=se.readSync(s,i,0,65536,c);se.writeSync(a,i,0,m),c+=m}n.preserveTimestamps&&se.futimesSync(a,e.atime,e.mtime),se.closeSync(s),se.closeSync(a)}function Ix(e,t,r,n,o){if(!t)return Sx(e,r,n,o);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory \'${n}\' with directory \'${r}\'.`);return Xf(r,n,o)}function Sx(e,t,r,n){return se.mkdirSync(r),Xf(t,r,n),se.chmodSync(r,e.mode)}function Xf(e,t,r){se.readdirSync(e).forEach(n=>Ox(n,e,t,r))}function Ox(e,t,r,n){let o=_n.join(t,e),i=_n.join(r,e),{destStat:s}=Tn.checkPathsSync(o,i,"copy");return Zf(s,o,i,n)}function Dx(e,t,r,n){let o=se.readlinkSync(t);if(n.dereference&&(o=_n.resolve(process.cwd(),o)),e){let i;try{i=se.readlinkSync(r)}catch(s){if(s.code==="EINVAL"||s.code==="UNKNOWN")return se.symlinkSync(o,r);throw s}if(n.dereference&&(i=_n.resolve(process.cwd(),i)),Tn.isSrcSubdir(o,i))throw new Error(`Cannot copy \'${o}\' to a subdirectory of itself, \'${i}\'.`);if(se.statSync(r).isDirectory()&&Tn.isSrcSubdir(i,o))throw new Error(`Cannot overwrite \'${i}\' with \'${o}\'.`);return _x(o,r)}else return se.symlinkSync(o,r)}function _x(e,t){return se.unlinkSync(t),se.symlinkSync(e,t)}ep.exports=yx});var Ea=T((b$,rp)=>{"use strict";u();rp.exports={copySync:tp()}});var st=T((w$,op)=>{"use strict";u();var Tx=Re().fromPromise,np=ca();function Nx(e){return np.access(e).then(()=>!0).catch(()=>!1)}op.exports={pathExists:Tx(Nx),pathExistsSync:np.existsSync}});var mp=T((E$,pp)=>{"use strict";u();var Oe=ye(),Nn=require("path"),Cx=ke().mkdirs,Ax=st().pathExists,Rx=ba().utimesMillis,Cn=Dn();function Fx(e,t,r,n){typeof r=="function"&&!n?(n=r,r={}):typeof r=="function"&&(r={filter:r}),n=n||function(){},r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269`),Cn.checkPaths(e,t,"copy",(o,i)=>{if(o)return n(o);let{srcStat:s,destStat:a}=i;Cn.checkParentPaths(e,s,t,"copy",c=>c?n(c):r.filter?ap(ip,a,e,t,r,n):ip(a,e,t,r,n))})}function ip(e,t,r,n,o){let i=Nn.dirname(r);Ax(i,(s,a)=>{if(s)return o(s);if(a)return Ia(e,t,r,n,o);Cx(i,c=>c?o(c):Ia(e,t,r,n,o))})}function ap(e,t,r,n,o,i){Promise.resolve(o.filter(r,n)).then(s=>s?e(t,r,n,o,i):i(),s=>i(s))}function Ia(e,t,r,n,o){return n.filter?ap(sp,e,t,r,n,o):sp(e,t,r,n,o)}function sp(e,t,r,n,o){(n.dereference?Oe.stat:Oe.lstat)(t,(s,a)=>{if(s)return o(s);if(a.isDirectory())return Mx(a,e,t,r,n,o);if(a.isFile()||a.isCharacterDevice()||a.isBlockDevice())return $x(a,e,t,r,n,o);if(a.isSymbolicLink())return Lx(e,t,r,n,o)})}function $x(e,t,r,n,o,i){return t?Px(e,r,n,o,i):up(e,r,n,o,i)}function Px(e,t,r,n,o){if(n.overwrite)Oe.unlink(r,i=>i?o(i):up(e,t,r,n,o));else return n.errorOnExist?o(new Error(`\'${r}\' already exists`)):o()}function up(e,t,r,n,o){return typeof Oe.copyFile=="function"?Oe.copyFile(t,r,i=>i?o(i):cp(e,r,n,o)):kx(e,t,r,n,o)}function kx(e,t,r,n,o){let i=Oe.createReadStream(t);i.on("error",s=>o(s)).once("open",()=>{let s=Oe.createWriteStream(r,{mode:e.mode});s.on("error",a=>o(a)).on("open",()=>i.pipe(s)).once("close",()=>cp(e,r,n,o))})}function cp(e,t,r,n){Oe.chmod(t,e.mode,o=>o?n(o):r.preserveTimestamps?Rx(t,e.atime,e.mtime,n):n())}function Mx(e,t,r,n,o,i){return t?t&&!t.isDirectory()?i(new Error(`Cannot overwrite non-directory \'${n}\' with directory \'${r}\'.`)):lp(r,n,o,i):qx(e,r,n,o,i)}function qx(e,t,r,n,o){Oe.mkdir(r,i=>{if(i)return o(i);lp(t,r,n,s=>s?o(s):Oe.chmod(r,e.mode,o))})}function lp(e,t,r,n){Oe.readdir(e,(o,i)=>o?n(o):fp(i,e,t,r,n))}function fp(e,t,r,n,o){let i=e.pop();return i?jx(e,i,t,r,n,o):o()}function jx(e,t,r,n,o,i){let s=Nn.join(r,t),a=Nn.join(n,t);Cn.checkPaths(s,a,"copy",(c,m)=>{if(c)return i(c);let{destStat:f}=m;Ia(f,s,a,o,h=>h?i(h):fp(e,r,n,o,i))})}function Lx(e,t,r,n,o){Oe.readlink(t,(i,s)=>{if(i)return o(i);if(n.dereference&&(s=Nn.resolve(process.cwd(),s)),e)Oe.readlink(r,(a,c)=>a?a.code==="EINVAL"||a.code==="UNKNOWN"?Oe.symlink(s,r,o):o(a):(n.dereference&&(c=Nn.resolve(process.cwd(),c)),Cn.isSrcSubdir(s,c)?o(new Error(`Cannot copy \'${s}\' to a subdirectory of itself, \'${c}\'.`)):e.isDirectory()&&Cn.isSrcSubdir(c,s)?o(new Error(`Cannot overwrite \'${c}\' with \'${s}\'.`)):Bx(s,r,o)));else return Oe.symlink(s,r,o)})}function Bx(e,t,r){Oe.unlink(t,n=>n?r(n):Oe.symlink(e,t,r))}pp.exports=Fx});var Sa=T((S$,dp)=>{"use strict";u();var Ux=Re().fromCallback;dp.exports={copy:Ux(mp())}});var Ip=T((D$,Ep)=>{"use strict";u();var hp=ye(),vp=require("path"),H=require("assert"),An=process.platform==="win32";function wp(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(r=>{e[r]=e[r]||hp[r],r=r+"Sync",e[r]=e[r]||hp[r]}),e.maxBusyTries=e.maxBusyTries||3}function Oa(e,t,r){let n=0;typeof t=="function"&&(r=t,t={}),H(e,"rimraf: missing path"),H.strictEqual(typeof e,"string","rimraf: path should be a string"),H.strictEqual(typeof r,"function","rimraf: callback function required"),H(t,"rimraf: invalid options argument provided"),H.strictEqual(typeof t,"object","rimraf: options should be object"),wp(t),gp(e,t,function o(i){if(i){if((i.code==="EBUSY"||i.code==="ENOTEMPTY"||i.code==="EPERM")&&n<t.maxBusyTries){n++;let s=n*100;return setTimeout(()=>gp(e,t,o),s)}i.code==="ENOENT"&&(i=null)}r(i)})}function gp(e,t,r){H(e),H(t),H(typeof r=="function"),t.lstat(e,(n,o)=>{if(n&&n.code==="ENOENT")return r(null);if(n&&n.code==="EPERM"&&An)return yp(e,t,n,r);if(o&&o.isDirectory())return ii(e,t,n,r);t.unlink(e,i=>{if(i){if(i.code==="ENOENT")return r(null);if(i.code==="EPERM")return An?yp(e,t,i,r):ii(e,t,i,r);if(i.code==="EISDIR")return ii(e,t,i,r)}return r(i)})})}function yp(e,t,r,n){H(e),H(t),H(typeof n=="function"),r&&H(r instanceof Error),t.chmod(e,438,o=>{o?n(o.code==="ENOENT"?null:r):t.stat(e,(i,s)=>{i?n(i.code==="ENOENT"?null:r):s.isDirectory()?ii(e,t,r,n):t.unlink(e,n)})})}function bp(e,t,r){let n;H(e),H(t),r&&H(r instanceof Error);try{t.chmodSync(e,438)}catch(o){if(o.code==="ENOENT")return;throw r}try{n=t.statSync(e)}catch(o){if(o.code==="ENOENT")return;throw r}n.isDirectory()?si(e,t,r):t.unlinkSync(e)}function ii(e,t,r,n){H(e),H(t),r&&H(r instanceof Error),H(typeof n=="function"),t.rmdir(e,o=>{o&&(o.code==="ENOTEMPTY"||o.code==="EEXIST"||o.code==="EPERM")?zx(e,t,n):o&&o.code==="ENOTDIR"?n(r):n(o)})}function zx(e,t,r){H(e),H(t),H(typeof r=="function"),t.readdir(e,(n,o)=>{if(n)return r(n);let i=o.length,s;if(i===0)return t.rmdir(e,r);o.forEach(a=>{Oa(vp.join(e,a),t,c=>{if(!s){if(c)return r(s=c);--i===0&&t.rmdir(e,r)}})})})}function xp(e,t){let r;t=t||{},wp(t),H(e,"rimraf: missing path"),H.strictEqual(typeof e,"string","rimraf: path should be a string"),H(t,"rimraf: missing options"),H.strictEqual(typeof t,"object","rimraf: options should be object");try{r=t.lstatSync(e)}catch(n){if(n.code==="ENOENT")return;n.code==="EPERM"&&An&&bp(e,t,n)}try{r&&r.isDirectory()?si(e,t,null):t.unlinkSync(e)}catch(n){if(n.code==="ENOENT")return;if(n.code==="EPERM")return An?bp(e,t,n):si(e,t,n);if(n.code!=="EISDIR")throw n;si(e,t,n)}}function si(e,t,r){H(e),H(t),r&&H(r instanceof Error);try{t.rmdirSync(e)}catch(n){if(n.code==="ENOTDIR")throw r;if(n.code==="ENOTEMPTY"||n.code==="EEXIST"||n.code==="EPERM")Wx(e,t);else if(n.code!=="ENOENT")throw n}}function Wx(e,t){if(H(e),H(t),t.readdirSync(e).forEach(r=>xp(vp.join(e,r),t)),An){let r=Date.now();do try{return t.rmdirSync(e,t)}catch{}while(Date.now()-r<500)}else return t.rmdirSync(e,t)}Ep.exports=Oa;Oa.sync=xp});var Rn=T((T$,Op)=>{"use strict";u();var Kx=Re().fromCallback,Sp=Ip();Op.exports={remove:Kx(Sp),removeSync:Sp.sync}});var Fp=T((C$,Rp)=>{"use strict";u();var Gx=Re().fromCallback,Tp=ye(),Np=require("path"),Cp=ke(),Ap=Rn(),Dp=Gx(function(t,r){r=r||function(){},Tp.readdir(t,(n,o)=>{if(n)return Cp.mkdirs(t,r);o=o.map(s=>Np.join(t,s)),i();function i(){let s=o.pop();if(!s)return r();Ap.remove(s,a=>{if(a)return r(a);i()})}})});function _p(e){let t;try{t=Tp.readdirSync(e)}catch{return Cp.mkdirsSync(e)}t.forEach(r=>{r=Np.join(e,r),Ap.removeSync(r)})}Rp.exports={emptyDirSync:_p,emptydirSync:_p,emptyDir:Dp,emptydir:Dp}});var Mp=T((R$,kp)=>{"use strict";u();var Vx=Re().fromCallback,$p=require("path"),Fn=ye(),Pp=ke(),Hx=st().pathExists;function Jx(e,t){function r(){Fn.writeFile(e,"",n=>{if(n)return t(n);t()})}Fn.stat(e,(n,o)=>{if(!n&&o.isFile())return t();let i=$p.dirname(e);Hx(i,(s,a)=>{if(s)return t(s);if(a)return r();Pp.mkdirs(i,c=>{if(c)return t(c);r()})})})}function Yx(e){let t;try{t=Fn.statSync(e)}catch{}if(t&&t.isFile())return;let r=$p.dirname(e);Fn.existsSync(r)||Pp.mkdirsSync(r),Fn.writeFileSync(e,"")}kp.exports={createFile:Vx(Jx),createFileSync:Yx}});var Up=T(($$,Bp)=>{"use strict";u();var Zx=Re().fromCallback,jp=require("path"),Zt=ye(),Lp=ke(),qp=st().pathExists;function Qx(e,t,r){function n(o,i){Zt.link(o,i,s=>{if(s)return r(s);r(null)})}qp(t,(o,i)=>{if(o)return r(o);if(i)return r(null);Zt.lstat(e,s=>{if(s)return s.message=s.message.replace("lstat","ensureLink"),r(s);let a=jp.dirname(t);qp(a,(c,m)=>{if(c)return r(c);if(m)return n(e,t);Lp.mkdirs(a,f=>{if(f)return r(f);n(e,t)})})})})}function Xx(e,t){if(Zt.existsSync(t))return;try{Zt.lstatSync(e)}catch(i){throw i.message=i.message.replace("lstat","ensureLink"),i}let n=jp.dirname(t);return Zt.existsSync(n)||Lp.mkdirsSync(n),Zt.linkSync(e,t)}Bp.exports={createLink:Zx(Qx),createLinkSync:Xx}});var Wp=T((k$,zp)=>{"use strict";u();var At=require("path"),$n=ye(),e0=st().pathExists;function t0(e,t,r){if(At.isAbsolute(e))return $n.lstat(e,n=>n?(n.message=n.message.replace("lstat","ensureSymlink"),r(n)):r(null,{toCwd:e,toDst:e}));{let n=At.dirname(t),o=At.join(n,e);return e0(o,(i,s)=>i?r(i):s?r(null,{toCwd:o,toDst:e}):$n.lstat(e,a=>a?(a.message=a.message.replace("lstat","ensureSymlink"),r(a)):r(null,{toCwd:e,toDst:At.relative(n,e)})))}}function r0(e,t){let r;if(At.isAbsolute(e)){if(r=$n.existsSync(e),!r)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}else{let n=At.dirname(t),o=At.join(n,e);if(r=$n.existsSync(o),r)return{toCwd:o,toDst:e};if(r=$n.existsSync(e),!r)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:At.relative(n,e)}}}zp.exports={symlinkPaths:t0,symlinkPathsSync:r0}});var Vp=T((q$,Gp)=>{"use strict";u();var Kp=ye();function n0(e,t,r){if(r=typeof t=="function"?t:r,t=typeof t=="function"?!1:t,t)return r(null,t);Kp.lstat(e,(n,o)=>{if(n)return r(null,"file");t=o&&o.isDirectory()?"dir":"file",r(null,t)})}function o0(e,t){let r;if(t)return t;try{r=Kp.lstatSync(e)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}Gp.exports={symlinkType:n0,symlinkTypeSync:o0}});var em=T((L$,Xp)=>{"use strict";u();var i0=Re().fromCallback,Jp=require("path"),Sr=ye(),Yp=ke(),s0=Yp.mkdirs,a0=Yp.mkdirsSync,Zp=Wp(),u0=Zp.symlinkPaths,c0=Zp.symlinkPathsSync,Qp=Vp(),l0=Qp.symlinkType,f0=Qp.symlinkTypeSync,Hp=st().pathExists;function p0(e,t,r,n){n=typeof r=="function"?r:n,r=typeof r=="function"?!1:r,Hp(t,(o,i)=>{if(o)return n(o);if(i)return n(null);u0(e,t,(s,a)=>{if(s)return n(s);e=a.toDst,l0(a.toCwd,r,(c,m)=>{if(c)return n(c);let f=Jp.dirname(t);Hp(f,(h,p)=>{if(h)return n(h);if(p)return Sr.symlink(e,t,m,n);s0(f,b=>{if(b)return n(b);Sr.symlink(e,t,m,n)})})})})})}function m0(e,t,r){if(Sr.existsSync(t))return;let o=c0(e,t);e=o.toDst,r=f0(o.toCwd,r);let i=Jp.dirname(t);return Sr.existsSync(i)||a0(i),Sr.symlinkSync(e,t,r)}Xp.exports={createSymlink:i0(p0),createSymlinkSync:m0}});var rm=T((U$,tm)=>{"use strict";u();var ai=Mp(),ui=Up(),ci=em();tm.exports={createFile:ai.createFile,createFileSync:ai.createFileSync,ensureFile:ai.createFile,ensureFileSync:ai.createFileSync,createLink:ui.createLink,createLinkSync:ui.createLinkSync,ensureLink:ui.createLink,ensureLinkSync:ui.createLinkSync,createSymlink:ci.createSymlink,createSymlinkSync:ci.createSymlinkSync,ensureSymlink:ci.createSymlink,ensureSymlinkSync:ci.createSymlinkSync}});var sm=T((W$,im)=>{u();var Or;try{Or=ye()}catch{Or=require("fs")}function d0(e,t,r){r==null&&(r=t,t={}),typeof t=="string"&&(t={encoding:t}),t=t||{};var n=t.fs||Or,o=!0;"throws"in t&&(o=t.throws),n.readFile(e,t,function(i,s){if(i)return r(i);s=om(s);var a;try{a=JSON.parse(s,t?t.reviver:null)}catch(c){return o?(c.message=e+": "+c.message,r(c)):r(null,null)}r(null,a)})}function h0(e,t){t=t||{},typeof t=="string"&&(t={encoding:t});var r=t.fs||Or,n=!0;"throws"in t&&(n=t.throws);try{var o=r.readFileSync(e,t);return o=om(o),JSON.parse(o,t.reviver)}catch(i){if(n)throw i.message=e+": "+i.message,i;return null}}function nm(e,t){var r,n=`\n`;typeof t=="object"&&t!==null&&(t.spaces&&(r=t.spaces),t.EOL&&(n=t.EOL));var o=JSON.stringify(e,t?t.replacer:null,r);return o.replace(/\\n/g,n)+n}function g0(e,t,r,n){n==null&&(n=r,r={}),r=r||{};var o=r.fs||Or,i="";try{i=nm(t,r)}catch(s){n&&n(s,null);return}o.writeFile(e,i,r,n)}function y0(e,t,r){r=r||{};var n=r.fs||Or,o=nm(t,r);return n.writeFileSync(e,o,r)}function om(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e=e.replace(/^\\uFEFF/,""),e}var b0={readFile:d0,readFileSync:h0,writeFile:g0,writeFileSync:y0};im.exports=b0});var fi=T((G$,um)=>{"use strict";u();var am=Re().fromCallback,li=sm();um.exports={readJson:am(li.readFile),readJsonSync:li.readFileSync,writeJson:am(li.writeFile),writeJsonSync:li.writeFileSync}});var fm=T((H$,lm)=>{"use strict";u();var v0=require("path"),w0=ke(),x0=st().pathExists,cm=fi();function E0(e,t,r,n){typeof r=="function"&&(n=r,r={});let o=v0.dirname(e);x0(o,(i,s)=>{if(i)return n(i);if(s)return cm.writeJson(e,t,r,n);w0.mkdirs(o,a=>{if(a)return n(a);cm.writeJson(e,t,r,n)})})}lm.exports=E0});var mm=T((Y$,pm)=>{"use strict";u();var I0=ye(),S0=require("path"),O0=ke(),D0=fi();function _0(e,t,r){let n=S0.dirname(e);I0.existsSync(n)||O0.mkdirsSync(n),D0.writeJsonSync(e,t,r)}pm.exports=_0});var hm=T((Q$,dm)=>{"use strict";u();var T0=Re().fromCallback,Te=fi();Te.outputJson=T0(fm());Te.outputJsonSync=mm();Te.outputJSON=Te.outputJson;Te.outputJSONSync=Te.outputJsonSync;Te.writeJSON=Te.writeJson;Te.writeJSONSync=Te.writeJsonSync;Te.readJSON=Te.readJson;Te.readJSONSync=Te.readJsonSync;dm.exports=Te});var xm=T((eP,wm)=>{"use strict";u();var bm=ye(),N0=require("path"),C0=Ea().copySync,vm=Rn().removeSync,A0=ke().mkdirpSync,gm=Dn();function R0(e,t,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:o}=gm.checkPathsSync(e,t,"move");return gm.checkParentPathsSync(e,o,t,"move"),A0(N0.dirname(t)),F0(e,t,n)}function F0(e,t,r){if(r)return vm(t),ym(e,t,r);if(bm.existsSync(t))throw new Error("dest already exists.");return ym(e,t,r)}function ym(e,t,r){try{bm.renameSync(e,t)}catch(n){if(n.code!=="EXDEV")throw n;return $0(e,t,r)}}function $0(e,t,r){return C0(e,t,{overwrite:r,errorOnExist:!0}),vm(e)}wm.exports=R0});var Im=T((rP,Em)=>{"use strict";u();Em.exports={moveSync:xm()}});var Tm=T((oP,_m)=>{"use strict";u();var P0=ye(),k0=require("path"),M0=Sa().copy,Dm=Rn().remove,q0=ke().mkdirp,j0=st().pathExists,Sm=Dn();function L0(e,t,r,n){typeof r=="function"&&(n=r,r={});let o=r.overwrite||r.clobber||!1;Sm.checkPaths(e,t,"move",(i,s)=>{if(i)return n(i);let{srcStat:a}=s;Sm.checkParentPaths(e,a,t,"move",c=>{if(c)return n(c);q0(k0.dirname(t),m=>m?n(m):B0(e,t,o,n))})})}function B0(e,t,r,n){if(r)return Dm(t,o=>o?n(o):Om(e,t,r,n));j0(t,(o,i)=>o?n(o):i?n(new Error("dest already exists.")):Om(e,t,r,n))}function Om(e,t,r,n){P0.rename(e,t,o=>o?o.code!=="EXDEV"?n(o):U0(e,t,r,n):n())}function U0(e,t,r,n){M0(e,t,{overwrite:r,errorOnExist:!0},i=>i?n(i):Dm(e,n))}_m.exports=L0});var Cm=T((sP,Nm)=>{"use strict";u();var z0=Re().fromCallback;Nm.exports={move:z0(Tm())}});var $m=T((uP,Fm)=>{"use strict";u();var W0=Re().fromCallback,Pn=ye(),Am=require("path"),Rm=ke(),K0=st().pathExists;function G0(e,t,r,n){typeof r=="function"&&(n=r,r="utf8");let o=Am.dirname(e);K0(o,(i,s)=>{if(i)return n(i);if(s)return Pn.writeFile(e,t,r,n);Rm.mkdirs(o,a=>{if(a)return n(a);Pn.writeFile(e,t,r,n)})})}function V0(e,...t){let r=Am.dirname(e);if(Pn.existsSync(r))return Pn.writeFileSync(e,...t);Rm.mkdirsSync(r),Pn.writeFileSync(e,...t)}Fm.exports={outputFile:W0(G0),outputFileSync:V0}});var _a=T((lP,Da)=>{"use strict";u();Da.exports=Object.assign({},ca(),Ea(),Sa(),Fp(),rm(),hm(),ke(),Im(),Cm(),$m(),st(),Rn());var Pm=require("fs");Object.getOwnPropertyDescriptor(Pm,"promises")&&Object.defineProperty(Da.exports,"promises",{get(){return Pm.promises}})});var Mm=T((pP,km)=>{u();km.exports=()=>new Date});var jm=T((dP,qm)=>{u();var H0=Ee()("streamroller:fileNameFormatter"),J0=require("path"),Y0=".gz",Z0=".";qm.exports=({file:e,keepFileExt:t,needsIndex:r,alwaysIncludeDate:n,compress:o,fileNameSep:i})=>{let s=i||Z0,a=J0.join(e.dir,e.name),c=b=>b+e.ext,m=(b,E,I)=>(r||!I)&&E?b+s+E:b,f=(b,E,I)=>(E>0||n)&&I?b+s+I:b,h=(b,E)=>E&&o?b+Y0:b,p=t?[f,m,c,h]:[c,f,m,h];return({date:b,index:E})=>(H0(`_formatFileName: date=${b}, index=${E}`),p.reduce((I,D)=>D(I,E,b),a))}});var zm=T((gP,Um)=>{u();var Qt=Ee()("streamroller:fileNameParser"),Lm=".gz",Bm=Jo(),Q0=".";Um.exports=({file:e,keepFileExt:t,pattern:r,fileNameSep:n})=>{let o=n||Q0,i=(p,b)=>p.endsWith(Lm)?(Qt("it is gzipped"),b.isCompressed=!0,p.slice(0,-1*Lm.length)):p,s="__NOT_MATCHING__",h=[i,t?p=>p.startsWith(e.name)&&p.endsWith(e.ext)?(Qt("it starts and ends with the right things"),p.slice(e.name.length+1,-1*e.ext.length)):s:p=>p.startsWith(e.base)?(Qt("it starts with the right things"),p.slice(e.base.length+1)):s,r?(p,b)=>{let E=p.split(o),I=E[E.length-1];Qt("items: ",E,", indexStr: ",I);let D=p;I!==void 0&&I.match(/^\\d+$/)?(D=p.slice(0,-1*(I.length+1)),Qt(`dateStr is ${D}`),r&&!D&&(D=I,I="0")):I="0";try{let A=Bm.parse(r,D,new Date(0,0));return Bm.asString(r,A)!==D?p:(b.index=parseInt(I,10),b.date=D,b.timestamp=A.getTime(),"")}catch(A){return Qt(`Problem parsing ${D} as ${r}, error was: `,A),p}}:(p,b)=>p.match(/^\\d+$/)?(Qt("it has an index"),b.index=parseInt(p,10),""):p];return p=>{let b={filename:p,index:0,isCompressed:!1};return h.reduce((I,D)=>D(I,b),p)?null:b}}});var Km=T((bP,Wm)=>{u();var $e=Ee()("streamroller:moveAndMaybeCompressFile"),yt=_a(),X0=require("zlib"),eE=function(e){let t={mode:parseInt("0600",8),compress:!1},r=Object.assign({},t,e);return $e(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(r)}`),r},tE=async(e,t,r)=>{if(r=eE(r),e===t){$e("moveAndMaybeCompressFile: source and target are the same, not doing anything");return}if(await yt.pathExists(e))if($e(`moveAndMaybeCompressFile: moving file from ${e} to ${t} ${r.compress?"with":"without"} compress`),r.compress)await new Promise((n,o)=>{let i=!1,s=yt.createWriteStream(t,{mode:r.mode,flags:"wx"}).on("open",()=>{i=!0;let a=yt.createReadStream(e).on("open",()=>{a.pipe(X0.createGzip()).pipe(s)}).on("error",c=>{$e(`moveAndMaybeCompressFile: error reading ${e}`,c),s.destroy(c)})}).on("finish",()=>{$e(`moveAndMaybeCompressFile: finished compressing ${t}, deleting ${e}`),yt.unlink(e).then(n).catch(a=>{$e(`moveAndMaybeCompressFile: error deleting ${e}, truncating instead`,a),yt.truncate(e).then(n).catch(c=>{$e(`moveAndMaybeCompressFile: error truncating ${e}`,c),o(c)})})}).on("error",a=>{i?($e(`moveAndMaybeCompressFile: error writing ${t}, deleting`,a),yt.unlink(t).then(()=>{o(a)}).catch(c=>{$e(`moveAndMaybeCompressFile: error deleting ${t}`,c),o(c)})):($e(`moveAndMaybeCompressFile: error creating ${t}`,a),o(a))})}).catch(()=>{});else{$e(`moveAndMaybeCompressFile: renaming ${e} to ${t}`);try{await yt.move(e,t,{overwrite:!0})}catch(n){if($e(`moveAndMaybeCompressFile: error renaming ${e} to ${t}`,n),n.code!=="ENOENT"){$e("moveAndMaybeCompressFile: trying copy+truncate instead");try{await yt.copy(e,t,{overwrite:!0}),await yt.truncate(e)}catch(o){$e("moveAndMaybeCompressFile: error copy+truncate",o)}}}}};Wm.exports=tE});var di=T((wP,Gm)=>{u();var Me=Ee()("streamroller:RollingFileWriteStream"),er=_a(),Xt=require("path"),rE=require("os"),pi=Mm(),mi=Jo(),{Writable:nE}=require("stream"),oE=jm(),iE=zm(),sE=Km(),aE=e=>(Me(`deleteFiles: files to delete: ${e}`),Promise.all(e.map(t=>er.unlink(t).catch(r=>{Me(`deleteFiles: error when unlinking ${t}, ignoring. Error was ${r}`)})))),Ta=class extends nE{constructor(t,r){if(Me(`constructor: creating RollingFileWriteStream. path=${t}`),typeof t!="string"||t.length===0)throw new Error(`Invalid filename: ${t}`);if(t.endsWith(Xt.sep))throw new Error(`Filename is a directory: ${t}`);t.indexOf(`~${Xt.sep}`)===0&&(t=t.replace("~",rE.homedir())),super(r),this.options=this._parseOption(r),this.fileObject=Xt.parse(t),this.fileObject.dir===""&&(this.fileObject=Xt.parse(Xt.join(process.cwd(),t))),this.fileFormatter=oE({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize<Number.MAX_SAFE_INTEGER,compress:this.options.compress,keepFileExt:this.options.keepFileExt,fileNameSep:this.options.fileNameSep}),this.fileNameParser=iE({file:this.fileObject,keepFileExt:this.options.keepFileExt,pattern:this.options.pattern,fileNameSep:this.options.fileNameSep}),this.state={currentSize:0},this.options.pattern&&(this.state.currentDate=mi(this.options.pattern,pi())),this.filename=this.fileFormatter({index:0,date:this.state.currentDate}),["a","a+","as","as+"].includes(this.options.flags)&&this._setExistingSizeAndDate(),Me(`constructor: create new file ${this.filename}, state=${JSON.stringify(this.state)}`),this._renewWriteStream()}_setExistingSizeAndDate(){try{let t=er.statSync(this.filename);this.state.currentSize=t.size,this.options.pattern&&(this.state.currentDate=mi(this.options.pattern,t.mtime))}catch{return}}_parseOption(t){let r={maxSize:0,numToKeep:Number.MAX_SAFE_INTEGER,encoding:"utf8",mode:parseInt("0600",8),flags:"a",compress:!1,keepFileExt:!1,alwaysIncludePattern:!1},n=Object.assign({},r,t);if(!n.maxSize)delete n.maxSize;else if(n.maxSize<=0)throw new Error(`options.maxSize (${n.maxSize}) should be > 0`);if(n.numBackups||n.numBackups===0){if(n.numBackups<0)throw new Error(`options.numBackups (${n.numBackups}) should be >= 0`);if(n.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${n.numBackups}) should be < Number.MAX_SAFE_INTEGER`);n.numToKeep=n.numBackups+1}else if(n.numToKeep<=0)throw new Error(`options.numToKeep (${n.numToKeep}) should be > 0`);return Me(`_parseOption: creating stream with option=${JSON.stringify(n)}`),n}_final(t){this.currentFileStream.end("",this.options.encoding,t)}_write(t,r,n){this._shouldRoll().then(()=>{Me(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${t}`),this.currentFileStream.write(t,r,o=>{this.state.currentSize+=t.length,n(o)})})}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(Me(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==mi(this.options.pattern,pi())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return Me("_roll: closing the current stream"),new Promise((t,r)=>{this.currentFileStream.end("",this.options.encoding,()=>{this._moveOldFiles().then(t).catch(r)})})}async _moveOldFiles(){let t=await this._getExistingFiles(),r=this.state.currentDate?t.filter(n=>n.date===this.state.currentDate):t;for(let n=r.length;n>=0;n--){Me(`_moveOldFiles: i = ${n}`);let o=this.fileFormatter({date:this.state.currentDate,index:n}),i=this.fileFormatter({date:this.state.currentDate,index:n+1}),s={compress:this.options.compress&&n===0,mode:this.options.mode};await sE(o,i,s)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?mi(this.options.pattern,pi()):null,Me(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise((n,o)=>{this.currentFileStream.write("","utf8",()=>{this._clean().then(n).catch(o)})})}async _getExistingFiles(){let t=await er.readdir(this.fileObject.dir).catch(()=>[]);Me(`_getExistingFiles: files=${t}`);let r=t.map(o=>this.fileNameParser(o)).filter(o=>o),n=o=>(o.timestamp?o.timestamp:pi().getTime())-o.index;return r.sort((o,i)=>n(o)-n(i)),r}_renewWriteStream(){let t=this.fileFormatter({date:this.state.currentDate,index:0}),r=i=>{try{return er.mkdirSync(i,{recursive:!0})}catch(s){if(s.code==="ENOENT")return r(Xt.dirname(i)),r(i);if(s.code!=="EEXIST"&&s.code!=="EROFS")throw s;try{if(er.statSync(i).isDirectory())return i;throw s}catch{throw s}}};r(this.fileObject.dir);let n={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode},o=function(i,s,a){return i[a]=i[s],delete i[s],i};er.appendFileSync(t,"",o({...n},"flags","flag")),this.currentFileStream=er.createWriteStream(t,n),this.currentFileStream.on("error",i=>{this.emit("error",i)})}async _clean(){let t=await this._getExistingFiles();if(Me(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${t.length}`),Me("_clean: existing files are: ",t),this._tooManyFiles(t.length)){let r=t.slice(0,t.length-this.options.numToKeep).map(n=>Xt.format({dir:this.fileObject.dir,base:n.filename}));await aE(r)}}_tooManyFiles(t){return this.options.numToKeep>0&&t>this.options.numToKeep}};Gm.exports=Ta});var Hm=T((EP,Vm)=>{u();var uE=di(),Na=class extends uE{constructor(t,r,n,o){o||(o={}),r&&(o.maxSize=r),!o.numBackups&&o.numBackups!==0&&(!n&&n!==0&&(n=1),o.numBackups=n),super(t,o),this.backups=o.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}};Vm.exports=Na});var Ym=T((SP,Jm)=>{u();var cE=di(),Ca=class extends cE{constructor(t,r,n){r&&typeof r=="object"&&(n=r,r=null),n||(n={}),r||(r="yyyy-MM-dd"),n.pattern=r,!n.numBackups&&n.numBackups!==0?(!n.daysToKeep&&n.daysToKeep!==0?n.daysToKeep=1:process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"),n.numBackups=n.daysToKeep):n.daysToKeep=n.numBackups,super(t,n),this.mode=this.options.mode}get theStream(){return this.currentFileStream}};Jm.exports=Ca});var Aa=T((DP,Zm)=>{u();Zm.exports={RollingFileWriteStream:di(),RollingFileStream:Hm(),DateRollingFileStream:Ym()}});var rd=T((TP,td)=>{u();var Qm=Ee()("log4js:file"),Ra=require("path"),lE=Aa(),ed=require("os"),fE=ed.EOL,hi=!1,gi=new Set;function Xm(){gi.forEach(e=>{e.sighupHandler()})}function pE(e,t,r,n,o,i){if(typeof e!="string"||e.length===0)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(Ra.sep))throw new Error(`Filename is a directory: ${e}`);e=e.replace(new RegExp(`^~(?=${Ra.sep}.+)`),ed.homedir()),e=Ra.normalize(e),n=!n&&n!==0?5:n,Qm("Creating file appender (",e,", ",r,", ",n,", ",o,", ",i,")");function s(m,f,h,p){let b=new lE.RollingFileStream(m,f,h,p);return b.on("error",E=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",m,E)}),b.on("drain",()=>{process.emit("log4js:pause",!1)}),b}let a=s(e,r,n,o),c=function(m){if(a.writable){if(o.removeColor===!0){let f=/\\x1b[[0-9;]*m/g;m.data=m.data.map(h=>typeof h=="string"?h.replace(f,""):h)}a.write(t(m,i)+fE,"utf8")||process.emit("log4js:pause",!0)}};return c.reopen=function(){a.end(()=>{a=s(e,r,n,o)})},c.sighupHandler=function(){Qm("SIGHUP handler called."),c.reopen()},c.shutdown=function(m){gi.delete(c),gi.size===0&&hi&&(process.removeListener("SIGHUP",Xm),hi=!1),a.end("","utf-8",m)},gi.add(c),hi||(process.on("SIGHUP",Xm),hi=!0),c}function mE(e,t){let r=t.basicLayout;return e.layout&&(r=t.layout(e.layout.type,e.layout)),e.mode=e.mode||384,pE(e.filename,r,e.maxLogSize,e.backups,e,e.timezoneOffset)}td.exports.configure=mE});var od=T((CP,nd)=>{u();var dE=Aa(),hE=require("os"),gE=hE.EOL;function yE(e,t,r){let n=new dE.DateRollingFileStream(e,t,r);return n.on("error",o=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",e,o)}),n.on("drain",()=>{process.emit("log4js:pause",!1)}),n}function bE(e,t,r,n,o){n.maxSize=n.maxLogSize;let i=yE(e,t,n),s=function(a){i.writable&&(i.write(r(a,o)+gE,"utf8")||process.emit("log4js:pause",!0))};return s.shutdown=function(a){i.end("","utf-8",a)},s}function vE(e,t){let r=t.basicLayout;return e.layout&&(r=t.layout(e.layout.type,e.layout)),e.alwaysIncludePattern||(e.alwaysIncludePattern=!1),e.mode=e.mode||384,bE(e.filename,e.pattern,r,e,e.timezoneOffset)}nd.exports.configure=vE});var ud=T((RP,ad)=>{u();var bt=Ee()("log4js:fileSync"),ut=require("path"),at=require("fs"),id=require("os"),wE=id.EOL;function sd(e,t){let r=n=>{try{return at.mkdirSync(n,{recursive:!0})}catch(o){if(o.code==="ENOENT")return r(ut.dirname(n)),r(n);if(o.code!=="EEXIST"&&o.code!=="EROFS")throw o;try{if(at.statSync(n).isDirectory())return n;throw o}catch{throw o}}};r(ut.dirname(e)),at.appendFileSync(e,"",{mode:t.mode,flag:t.flags})}var Fa=class{constructor(t,r,n,o){if(bt("In RollingFileStream"),r<0)throw new Error(`maxLogSize (${r}) should be > 0`);this.filename=t,this.size=r,this.backups=n,this.options=o,this.currentSize=0;function i(s){let a=0;try{a=at.statSync(s).size}catch{sd(s,o)}return a}this.currentSize=i(this.filename)}shouldRoll(){return bt("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(t){let r=this,n=new RegExp(`^${ut.basename(t)}`);function o(m){return n.test(m)}function i(m){return parseInt(m.slice(`${ut.basename(t)}.`.length),10)||0}function s(m,f){return i(m)-i(f)}function a(m){let f=i(m);if(bt(`Index of ${m} is ${f}`),r.backups===0)at.truncateSync(t,0);else if(f<r.backups){try{at.unlinkSync(`${t}.${f+1}`)}catch{}bt(`Renaming ${m} -> ${t}.${f+1}`),at.renameSync(ut.join(ut.dirname(t),m),`${t}.${f+1}`)}}function c(){bt("Renaming the old files"),at.readdirSync(ut.dirname(t)).filter(o).sort(s).reverse().forEach(a)}bt("Rolling, rolling, rolling"),c()}write(t,r){let n=this;function o(){bt("writing the chunk to the file"),n.currentSize+=t.length,at.appendFileSync(n.filename,t)}bt("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),o()}};function xE(e,t,r,n,o,i){if(typeof e!="string"||e.length===0)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(ut.sep))throw new Error(`Filename is a directory: ${e}`);e=e.replace(new RegExp(`^~(?=${ut.sep}.+)`),id.homedir()),e=ut.normalize(e),n=!n&&n!==0?5:n,bt("Creating fileSync appender (",e,", ",r,", ",n,", ",o,", ",i,")");function s(c,m,f){let h;return m?h=new Fa(c,m,f,o):h=(p=>(sd(p,o),{write(b){at.appendFileSync(p,b)}}))(c),h}let a=s(e,r,n);return c=>{a.write(t(c,i)+wE)}}function EE(e,t){let r=t.basicLayout;e.layout&&(r=t.layout(e.layout.type,e.layout));let n={flags:e.flags||"a",encoding:e.encoding||"utf8",mode:e.mode||384};return xE(e.filename,r,e.maxLogSize,e.backups,n,e.timezoneOffset)}ad.exports.configure=EE});var ld=T(($P,cd)=>{u();var ct=Ee()("log4js:tcp"),IE=require("net");function SE(e,t){let r=!1,n=[],o,i=3,s="__LOG4JS__";function a(h){ct("Writing log event to socket"),r=o.write(`${t(h)}${s}`,"utf8")}function c(){let h;for(ct("emptying buffer");h=n.shift();)a(h)}function m(){ct(`appender creating socket to ${e.host||"localhost"}:${e.port||5e3}`),s=`${e.endMsg||"__LOG4JS__"}`,o=IE.createConnection(e.port||5e3,e.host||"localhost"),o.on("connect",()=>{ct("socket connected"),c(),r=!0}),o.on("drain",()=>{ct("drain event received, emptying buffer"),r=!0,c()}),o.on("timeout",o.end.bind(o)),o.on("error",h=>{ct("connection error",h),r=!1,c()}),o.on("close",m)}m();function f(h){r?a(h):(ct("buffering log event because it cannot write at the moment"),n.push(h))}return f.shutdown=function(h){ct("shutdown called"),n.length&&i?(ct("buffer has items, waiting 100ms to empty"),i-=1,setTimeout(()=>{f.shutdown(h)},100)):(o.removeAllListeners("close"),o.end(h))},f}function OE(e,t){ct(`configure with config = ${e}`);let r=function(n){return n.serialise()};return e.layout&&(r=t.layout(e.layout.type,e.layout)),SE(e,r)}cd.exports.configure=OE});var ka=T((kP,Pa)=>{u();var $a=require("path"),Rt=Ee()("log4js:appenders"),Ye=Gt(),fd=Xo(),DE=Ht(),_E=Xs(),TE=uf(),et=new Map;et.set("console",lf());et.set("stdout",pf());et.set("stderr",df());et.set("logLevelFilter",gf());et.set("categoryFilter",vf());et.set("noLogFilter",Ef());et.set("file",rd());et.set("dateFile",od());et.set("fileSync",ud());et.set("tcp",ld());var kn=new Map,yi=(e,t)=>{let r;try{let n=`${e}.cjs`;r=require.resolve(n),Rt("Loading module from ",n)}catch{r=e,Rt("Loading module from ",e)}try{return require(r)}catch(n){Ye.throwExceptionIf(t,n.code!=="MODULE_NOT_FOUND",`appender "${e}" could not be loaded (error was: ${n})`);return}},NE=(e,t)=>et.get(e)||yi(`./${e}`,t)||yi(e,t)||require.main&&require.main.filename&&yi($a.join($a.dirname(require.main.filename),e),t)||yi($a.join(process.cwd(),e),t),bi=new Set,pd=(e,t)=>{if(kn.has(e))return kn.get(e);if(!t.appenders[e])return!1;if(bi.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);bi.add(e),Rt(`Creating appender ${e}`);let r=CE(e,t);return bi.delete(e),kn.set(e,r),r},CE=(e,t)=>{let r=t.appenders[e],n=r.type.configure?r.type:NE(r.type,t);return Ye.throwExceptionIf(t,Ye.not(n),`appender "${e}" is not valid (type "${r.type}" could not be found)`),n.appender&&(process.emitWarning(`Appender ${r.type} exports an appender function.`,"DeprecationWarning","log4js-node-DEP0001"),Rt("[log4js-node-DEP0001]",`DEPRECATION: Appender ${r.type} exports an appender function.`)),n.shutdown&&(process.emitWarning(`Appender ${r.type} exports a shutdown function.`,"DeprecationWarning","log4js-node-DEP0002"),Rt("[log4js-node-DEP0002]",`DEPRECATION: Appender ${r.type} exports a shutdown function.`)),Rt(`${e}: clustering.isMaster ? ${fd.isMaster()}`),Rt(`${e}: appenderModule is ${require("util").inspect(n)}`),fd.onlyOnMaster(()=>(Rt(`calling appenderModule.configure for ${e} / ${r.type}`),n.configure(TE.modifyConfig(r),_E,o=>pd(o,t),DE)),()=>{})},md=e=>{if(kn.clear(),bi.clear(),!e)return;let t=[];Object.values(e.categories).forEach(r=>{t.push(...r.appenders)}),Object.keys(e.appenders).forEach(r=>{(t.includes(r)||e.appenders[r].type==="tcp-server"||e.appenders[r].type==="multiprocess")&&pd(r,e)})},dd=()=>{md()};dd();Ye.addListener(e=>{Ye.throwExceptionIf(e,Ye.not(Ye.anObject(e.appenders)),\'must have a property "appenders" of type object.\');let t=Object.keys(e.appenders);Ye.throwExceptionIf(e,Ye.not(t.length),"must define at least one appender."),t.forEach(r=>{Ye.throwExceptionIf(e,Ye.not(e.appenders[r].type),`appender "${r}" is not valid (must be an object with property "type")`)})});Ye.addListener(md);Pa.exports=kn;Pa.exports.init=dd});var ja=T((qP,vi)=>{u();var Mn=Ee()("log4js:categories"),le=Gt(),Ma=Ht(),hd=ka(),Ft=new Map;function gd(e,t,r){if(t.inherit===!1)return;let n=r.lastIndexOf(".");if(n<0)return;let o=r.slice(0,n),i=e.categories[o];i||(i={inherit:!0,appenders:[]}),gd(e,i,o),!e.categories[o]&&i.appenders&&i.appenders.length&&i.level&&(e.categories[o]=i),t.appenders=t.appenders||[],t.level=t.level||i.level,i.appenders.forEach(s=>{t.appenders.includes(s)||t.appenders.push(s)}),t.parent=i}function AE(e){if(!e.categories)return;Object.keys(e.categories).forEach(r=>{let n=e.categories[r];gd(e,n,r)})}le.addPreProcessingListener(e=>AE(e));le.addListener(e=>{le.throwExceptionIf(e,le.not(le.anObject(e.categories)),\'must have a property "categories" of type object.\');let t=Object.keys(e.categories);le.throwExceptionIf(e,le.not(t.length),"must define at least one category."),t.forEach(r=>{let n=e.categories[r];le.throwExceptionIf(e,[le.not(n.appenders),le.not(n.level)],`category "${r}" is not valid (must be an object with properties "appenders" and "level")`),le.throwExceptionIf(e,le.not(Array.isArray(n.appenders)),`category "${r}" is not valid (appenders must be an array of appender names)`),le.throwExceptionIf(e,le.not(n.appenders.length),`category "${r}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(n,"enableCallStack")&&le.throwExceptionIf(e,typeof n.enableCallStack!="boolean",`category "${r}" is not valid (enableCallStack must be boolean type)`),n.appenders.forEach(o=>{le.throwExceptionIf(e,le.not(hd.get(o)),`category "${r}" is not valid (appender "${o}" is not defined)`)}),le.throwExceptionIf(e,le.not(Ma.getLevel(n.level)),`category "${r}" is not valid (level "${n.level}" not recognised; valid levels are ${Ma.levels.join(", ")})`)}),le.throwExceptionIf(e,le.not(e.categories.default),\'must define a "default" category.\')});var qa=e=>{if(Ft.clear(),!e)return;Object.keys(e.categories).forEach(r=>{let n=e.categories[r],o=[];n.appenders.forEach(i=>{o.push(hd.get(i)),Mn(`Creating category ${r}`),Ft.set(r,{appenders:o,level:Ma.getLevel(n.level),enableCallStack:n.enableCallStack||!1})})})},yd=()=>{qa()};yd();le.addListener(qa);var Dr=e=>{if(Mn(`configForCategory: searching for config for ${e}`),Ft.has(e))return Mn(`configForCategory: ${e} exists in config, returning it`),Ft.get(e);let t;return e.indexOf(".")>0?(Mn(`configForCategory: ${e} has hierarchy, cloning from parents`),t={...Dr(e.slice(0,e.lastIndexOf(".")))}):(Ft.has("default")||qa({categories:{default:{appenders:["out"],level:"OFF"}}}),Mn("configForCategory: cloning default category"),t={...Ft.get("default")}),Ft.set(e,t),t},RE=e=>Dr(e).appenders,FE=e=>Dr(e).level,$E=(e,t)=>{Dr(e).level=t},PE=e=>Dr(e).enableCallStack===!0,kE=(e,t)=>{Dr(e).enableCallStack=t};vi.exports=Ft;vi.exports=Object.assign(vi.exports,{appendersForCategory:RE,getLevelForCategory:FE,setLevelForCategory:$E,getEnableCallStackForCategory:PE,setEnableCallStackForCategory:kE,init:yd})});var Ed=T((LP,xd)=>{u();var bd=Ee()("log4js:logger"),ME=ea(),lt=Ht(),qE=Xo(),wi=ja(),vd=Gt(),jE=/at (?:(.+)\\s+\\()?(?:(.+?):(\\d+)(?::(\\d+))?|([^)]+))\\)?/;function LE(e,t=4){try{let r=e.stack.split(`\n`).slice(t),n=jE.exec(r[0]);if(n&&n.length===6)return{functionName:n[1],fileName:n[2],lineNumber:parseInt(n[3],10),columnNumber:parseInt(n[4],10),callStack:r.join(`\n`)};console.error("log4js.logger - defaultParseCallStack error")}catch(r){console.error("log4js.logger - defaultParseCallStack error",r)}return null}var qn=class{constructor(t){if(!t)throw new Error("No category provided.");this.category=t,this.context={},this.parseCallStack=LE,bd(`Logger created (${this.category}, ${this.level})`)}get level(){return lt.getLevel(wi.getLevelForCategory(this.category),lt.OFF)}set level(t){wi.setLevelForCategory(this.category,lt.getLevel(t,this.level))}get useCallStack(){return wi.getEnableCallStackForCategory(this.category)}set useCallStack(t){wi.setEnableCallStackForCategory(this.category,t===!0)}log(t,...r){let n=lt.getLevel(t);n?this.isLevelEnabled(n)&&this._log(n,r):vd.validIdentifier(t)&&r.length>0?(this.log(lt.WARN,"log4js:logger.log: valid log-level not found as first parameter given:",t),this.log(lt.INFO,`[${t}]`,...r)):this.log(lt.INFO,t,...r)}isLevelEnabled(t){return this.level.isLessThanOrEqualTo(t)}_log(t,r){bd(`sending log data (${t}) to appenders`);let n=new ME(this.category,t,r,this.context,this.useCallStack&&this.parseCallStack(new Error));qE.send(n)}addContext(t,r){this.context[t]=r}removeContext(t){delete this.context[t]}clearContext(){this.context={}}setParseCallStackFunction(t){this.parseCallStack=t}};function wd(e){let t=lt.getLevel(e),n=t.toString().toLowerCase().replace(/_([a-z])/g,i=>i[1].toUpperCase()),o=n[0].toUpperCase()+n.slice(1);qn.prototype[`is${o}Enabled`]=function(){return this.isLevelEnabled(t)},qn.prototype[n]=function(...i){this.log(t,...i)}}lt.levels.forEach(wd);vd.addListener(()=>{lt.levels.forEach(wd)});xd.exports=qn});var Od=T((UP,Sd)=>{u();var _r=Ht(),BE=\':remote-addr - - ":method :url HTTP/:http-version" :status :content-length ":referrer" ":user-agent"\';function UE(e){return e.originalUrl||e.url}function zE(e,t,r){let n=i=>{let s=i.concat();for(let a=0;a<s.length;++a)for(let c=a+1;c<s.length;++c)s[a].token==s[c].token&&s.splice(c--,1);return s},o=[];return o.push({token:":url",replacement:UE(e)}),o.push({token:":protocol",replacement:e.protocol}),o.push({token:":hostname",replacement:e.hostname}),o.push({token:":method",replacement:e.method}),o.push({token:":status",replacement:t.__statusCode||t.statusCode}),o.push({token:":response-time",replacement:t.responseTime}),o.push({token:":date",replacement:new Date().toUTCString()}),o.push({token:":referrer",replacement:e.headers.referer||e.headers.referrer||""}),o.push({token:":http-version",replacement:`${e.httpVersionMajor}.${e.httpVersionMinor}`}),o.push({token:":remote-addr",replacement:e.headers["x-forwarded-for"]||e.ip||e._remoteAddress||e.socket&&(e.socket.remoteAddress||e.socket.socket&&e.socket.socket.remoteAddress)}),o.push({token:":user-agent",replacement:e.headers["user-agent"]}),o.push({token:":content-length",replacement:t.getHeader("content-length")||t.__headers&&t.__headers["Content-Length"]||"-"}),o.push({token:/:req\\[([^\\]]+)]/g,replacement(i,s){return e.headers[s.toLowerCase()]}}),o.push({token:/:res\\[([^\\]]+)]/g,replacement(i,s){return t.getHeader(s.toLowerCase())||t.__headers&&t.__headers[s]}}),n(r.concat(o))}function Id(e,t){for(let r=0;r<t.length;r++)e=e.replace(t[r].token,t[r].replacement);return e}function WE(e){let t=null;if(e instanceof RegExp&&(t=e),typeof e=="string"&&(t=new RegExp(e)),Array.isArray(e)){let r=e.map(n=>n.source?n.source:n);t=new RegExp(r.join("|"))}return t}function KE(e,t,r){let n=t;if(r){let o=r.find(i=>{let s=!1;return i.from&&i.to?s=e>=i.from&&e<=i.to:s=i.codes.indexOf(e)!==-1,s});o&&(n=_r.getLevel(o.level,n))}return n}Sd.exports=function(t,r){typeof r=="string"||typeof r=="function"?r={format:r}:r=r||{};let n=t,o=_r.getLevel(r.level,_r.INFO),i=r.format||BE;return(s,a,c)=>{if(s._logging!==void 0)return c();if(typeof r.nolog!="function"){let m=WE(r.nolog);if(m&&m.test(s.originalUrl))return c()}if(n.isLevelEnabled(o)||r.level==="auto"){let m=new Date,{writeHead:f}=a;s._logging=!0,a.writeHead=(b,E)=>{a.writeHead=f,a.writeHead(b,E),a.__statusCode=b,a.__headers=E||{}};let h=!1,p=()=>{if(h)return;if(h=!0,typeof r.nolog=="function"&&r.nolog(s,a)===!0){s._logging=!1;return}a.responseTime=new Date-m,a.statusCode&&r.level==="auto"&&(o=_r.INFO,a.statusCode>=300&&(o=_r.WARN),a.statusCode>=400&&(o=_r.ERROR)),o=KE(a.statusCode,o,r.statusRules);let b=zE(s,a,r.tokens||[]);if(r.context&&n.addContext("res",a),typeof i=="function"){let E=i(s,a,I=>Id(I,b));E&&n.log(o,E)}else n.log(o,Id(i,b));r.context&&n.removeContext("res")};a.on("end",p),a.on("finish",p),a.on("error",p),a.on("close",p)}return c()}}});var Cd=T((WP,Nd)=>{u();var Dd=Ee()("log4js:recording"),xi=[];function GE(){return function(e){Dd(`received logEvent, number of events now ${xi.length+1}`),Dd("log event was ",e),xi.push(e)}}function _d(){return xi.slice()}function Td(){xi.length=0}Nd.exports={configure:GE,replay:_d,playback:_d,reset:Td,erase:Td}});var Md=T((GP,kd)=>{u();var $t=Ee()("log4js:main"),VE=require("fs"),HE=El()({proto:!0}),JE=Gt(),YE=Xs(),ZE=Ht(),Ad=ka(),Rd=ja(),QE=Ed(),XE=Xo(),eI=Od(),tI=Cd(),jn=!1;function rI(e){if(!jn)return;$t("Received log event ",e),Rd.appendersForCategory(e.categoryName).forEach(r=>{r(e)})}function nI(e){$t(`Loading configuration from ${e}`);try{return JSON.parse(VE.readFileSync(e,"utf8"))}catch(t){throw new Error(`Problem reading config from file "${e}". Error was ${t.message}`,t)}}function Fd(e){jn&&$d();let t=e;return typeof t=="string"&&(t=nI(e)),$t(`Configuration is ${t}`),JE.configure(HE(t)),XE.onMessage(rI),jn=!0,Pd}function oI(){return tI}function $d(e){$t("Shutdown called. Disabling all log writing."),jn=!1;let t=Array.from(Ad.values());Ad.init(),Rd.init();let r=t.reduceRight((s,a)=>a.shutdown?s+1:s,0);if(r===0)return $t("No appenders with shutdown functions found."),e!==void 0&&e();let n=0,o;$t(`Found ${r} appenders with shutdown functions.`);function i(s){o=o||s,n+=1,$t(`Appender shutdowns complete: ${n} / ${r}`),n>=r&&($t("All shutdown functions completed."),e&&e(o))}return t.filter(s=>s.shutdown).forEach(s=>s.shutdown(i)),null}function iI(e){return jn||Fd(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new QE(e||"default")}var Pd={getLogger:iI,configure:Fd,shutdown:$d,connectLogger:eI,levels:ZE,addLayout:YE.addLayout,recording:oI};kd.exports=Pd});var ft=T(Ii=>{"use strict";u();Ii.getBooleanOption=(e,t)=>{let r=!1;if(t in e&&typeof(r=e[t])!="boolean")throw new TypeError(`Expected the "${t}" option to be a boolean`);return r};Ii.cppdb=Symbol();Ii.inspect=Symbol.for("nodejs.util.inspect.custom")});var Ua=T((XP,Ld)=>{"use strict";u();var Ba={value:"SqliteError",writable:!0,enumerable:!1,configurable:!0};function tr(e,t){if(new.target!==tr)return new tr(e,t);if(typeof t!="string")throw new TypeError("Expected second argument to be a string");Error.call(this,e),Ba.value=""+e,Object.defineProperty(this,"message",Ba),Error.captureStackTrace(this,tr),this.code=t}Object.setPrototypeOf(tr,Error);Object.setPrototypeOf(tr.prototype,Error.prototype);Object.defineProperty(tr.prototype,"name",Ba);Ld.exports=tr});var Ud=T((tk,Bd)=>{u();var Si=require("path").sep||"/";Bd.exports=aI;function aI(e){if(typeof e!="string"||e.length<=7||e.substring(0,7)!="file://")throw new TypeError("must pass in a file:// URI to convert to a file path");var t=decodeURI(e.substring(7)),r=t.indexOf("/"),n=t.substring(0,r),o=t.substring(r+1);return n=="localhost"&&(n=""),n&&(n=Si+Si+n),o=o.replace(/^(.+)\\|/,"$1:"),Si=="\\\\"&&(o=o.replace(/\\//g,"\\\\")),/^.+\\:/.test(o)||(o=Si+o),n+o}});var Gd=T((Tr,Kd)=>{u();var za=require("fs"),Di=require("path"),uI=Ud(),Oi=Di.join,cI=Di.dirname,zd=za.accessSync&&function(e){try{za.accessSync(e)}catch{return!1}return!0}||za.existsSync||Di.existsSync,Wd={arrow:process.env.NODE_BINDINGS_ARROW||" \\u2192 ",compiled:process.env.NODE_BINDINGS_COMPILED_DIR||"compiled",platform:process.platform,arch:process.arch,nodePreGyp:"node-v"+process.versions.modules+"-"+process.platform+"-"+process.arch,version:process.versions.node,bindings:"bindings.node",try:[["module_root","build","bindings"],["module_root","build","Debug","bindings"],["module_root","build","Release","bindings"],["module_root","out","Debug","bindings"],["module_root","Debug","bindings"],["module_root","out","Release","bindings"],["module_root","Release","bindings"],["module_root","build","default","bindings"],["module_root","compiled","version","platform","arch","bindings"],["module_root","addon-build","release","install-root","bindings"],["module_root","addon-build","debug","install-root","bindings"],["module_root","addon-build","default","install-root","bindings"],["module_root","lib","binding","nodePreGyp","bindings"]]};function lI(e){typeof e=="string"?e={bindings:e}:e||(e={}),Object.keys(Wd).map(function(c){c in e||(e[c]=Wd[c])}),e.module_root||(e.module_root=Tr.getRoot(Tr.getFileName())),Di.extname(e.bindings)!=".node"&&(e.bindings+=".node");for(var t=typeof __webpack_require__=="function"?__non_webpack_require__:require,r=[],n=0,o=e.try.length,i,s,a;n<o;n++){i=Oi.apply(null,e.try[n].map(function(c){return e[c]||c})),r.push(i);try{return s=e.path?t.resolve(i):t(i),e.path||(s.path=i),s}catch(c){if(c.code!=="MODULE_NOT_FOUND"&&c.code!=="QUALIFIED_PATH_RESOLUTION_FAILED"&&!/not find/i.test(c.message))throw c}}throw a=new Error(`Could not locate the bindings file. Tried:\n`+r.map(function(c){return e.arrow+c}).join(`\n`)),a.tries=r,a}Kd.exports=Tr=lI;Tr.getFileName=function(t){var r=Error.prepareStackTrace,n=Error.stackTraceLimit,o={},i;Error.stackTraceLimit=10,Error.prepareStackTrace=function(a,c){for(var m=0,f=c.length;m<f;m++)if(i=c[m].getFileName(),i!==__filename)if(t){if(i!==t)return}else return},Error.captureStackTrace(o),o.stack,Error.prepareStackTrace=r,Error.stackTraceLimit=n;var s="file://";return i.indexOf(s)===0&&(i=uI(i)),i};Tr.getRoot=function(t){for(var r=cI(t),n;;){if(r==="."&&(r=process.cwd()),zd(Oi(r,"package.json"))||zd(Oi(r,"node_modules")))return r;if(n===r)throw new Error(\'Could not find module root given file: "\'+t+\'". Do you have a `package.json` file? \');n=r,r=Oi(r,"..")}}});var Vd=T(Pt=>{"use strict";u();var{cppdb:tt}=ft();Pt.prepare=function(t){return this[tt].prepare(t,this,!1)};Pt.exec=function(t){return this[tt].exec(t),this};Pt.close=function(){return this[tt].close(),this};Pt.loadExtension=function(...t){return this[tt].loadExtension(...t),this};Pt.defaultSafeIntegers=function(...t){return this[tt].defaultSafeIntegers(...t),this};Pt.unsafeMode=function(...t){return this[tt].unsafeMode(...t),this};Pt.getters={name:{get:function(){return this[tt].name},enumerable:!0},open:{get:function(){return this[tt].open},enumerable:!0},inTransaction:{get:function(){return this[tt].inTransaction},enumerable:!0},readonly:{get:function(){return this[tt].readonly},enumerable:!0},memory:{get:function(){return this[tt].memory},enumerable:!0}}});var Yd=T((sk,Jd)=>{"use strict";u();var{cppdb:fI}=ft(),Hd=new WeakMap;Jd.exports=function(t){if(typeof t!="function")throw new TypeError("Expected first argument to be a function");let r=this[fI],n=pI(r,this),{apply:o}=Function.prototype,i={default:{value:_i(o,t,r,n.default)},deferred:{value:_i(o,t,r,n.deferred)},immediate:{value:_i(o,t,r,n.immediate)},exclusive:{value:_i(o,t,r,n.exclusive)},database:{value:this,enumerable:!0}};return Object.defineProperties(i.default.value,i),Object.defineProperties(i.deferred.value,i),Object.defineProperties(i.immediate.value,i),Object.defineProperties(i.exclusive.value,i),i.default.value};var pI=(e,t)=>{let r=Hd.get(e);if(!r){let n={commit:e.prepare("COMMIT",t,!1),rollback:e.prepare("ROLLBACK",t,!1),savepoint:e.prepare("SAVEPOINT ` _bs3. `",t,!1),release:e.prepare("RELEASE ` _bs3. `",t,!1),rollbackTo:e.prepare("ROLLBACK TO ` _bs3. `",t,!1)};Hd.set(e,r={default:Object.assign({begin:e.prepare("BEGIN",t,!1)},n),deferred:Object.assign({begin:e.prepare("BEGIN DEFERRED",t,!1)},n),immediate:Object.assign({begin:e.prepare("BEGIN IMMEDIATE",t,!1)},n),exclusive:Object.assign({begin:e.prepare("BEGIN EXCLUSIVE",t,!1)},n)})}return r},_i=(e,t,r,{begin:n,commit:o,rollback:i,savepoint:s,release:a,rollbackTo:c})=>function(){let f,h,p;r.inTransaction?(f=s,h=a,p=c):(f=n,h=o,p=i),f.run();try{let b=e.call(t,this,arguments);if(b&&typeof b.then=="function")throw new TypeError("Transaction function cannot return a promise");return h.run(),b}catch(b){throw r.inTransaction&&(p.run(),p!==i&&h.run()),b}}});var Qd=T((uk,Zd)=>{"use strict";u();var{getBooleanOption:mI,cppdb:dI}=ft();Zd.exports=function(t,r){if(r==null&&(r={}),typeof t!="string")throw new TypeError("Expected first argument to be a string");if(typeof r!="object")throw new TypeError("Expected second argument to be an options object");let n=mI(r,"simple"),o=this[dI].prepare(`PRAGMA ${t}`,this,!0);return n?o.pluck().get():o.all()}});var th=T((lk,eh)=>{"use strict";u();var hI=require("fs"),gI=require("path"),{promisify:yI}=require("util"),{cppdb:bI}=ft(),Xd=yI(hI.access);eh.exports=async function(t,r){if(r==null&&(r={}),typeof t!="string")throw new TypeError("Expected first argument to be a string");if(typeof r!="object")throw new TypeError("Expected second argument to be an options object");t=t.trim();let n="attached"in r?r.attached:"main",o="progress"in r?r.progress:null;if(!t)throw new TypeError("Backup filename cannot be an empty string");if(t===":memory:")throw new TypeError(\'Invalid backup filename ":memory:"\');if(typeof n!="string")throw new TypeError(\'Expected the "attached" option to be a string\');if(!n)throw new TypeError(\'The "attached" option cannot be an empty string\');if(o!=null&&typeof o!="function")throw new TypeError(\'Expected the "progress" option to be a function\');await Xd(gI.dirname(t)).catch(()=>{throw new TypeError("Cannot save backup because the directory does not exist")});let i=await Xd(t).then(()=>!1,()=>!0);return vI(this[bI].backup(this,n,t,i),o||null)};var vI=(e,t)=>{let r=0,n=!0;return new Promise((o,i)=>{setImmediate(function s(){try{let a=e.transfer(r);if(!a.remainingPages){e.close(),o(a);return}if(n&&(n=!1,r=100),t){let c=t(a);if(c!==void 0)if(typeof c=="number"&&c===c)r=Math.max(0,Math.min(2147483647,Math.round(c)));else throw new TypeError("Expected progress callback to return a number or undefined")}setImmediate(s)}catch(a){e.close(),i(a)}})})}});var nh=T((pk,rh)=>{"use strict";u();var{cppdb:wI}=ft();rh.exports=function(t){if(t==null&&(t={}),typeof t!="object")throw new TypeError("Expected first argument to be an options object");let r="attached"in t?t.attached:"main";if(typeof r!="string")throw new TypeError(\'Expected the "attached" option to be a string\');if(!r)throw new TypeError(\'The "attached" option cannot be an empty string\');return this[wI].serialize(r)}});var ih=T((dk,oh)=>{"use strict";u();var{getBooleanOption:Ti,cppdb:xI}=ft();oh.exports=function(t,r,n){if(r==null&&(r={}),typeof r=="function"&&(n=r,r={}),typeof t!="string")throw new TypeError("Expected first argument to be a string");if(typeof n!="function")throw new TypeError("Expected last argument to be a function");if(typeof r!="object")throw new TypeError("Expected second argument to be an options object");if(!t)throw new TypeError("User-defined function name cannot be an empty string");let o="safeIntegers"in r?+Ti(r,"safeIntegers"):2,i=Ti(r,"deterministic"),s=Ti(r,"directOnly"),a=Ti(r,"varargs"),c=-1;if(!a){if(c=n.length,!Number.isInteger(c)||c<0)throw new TypeError("Expected function.length to be a positive integer");if(c>100)throw new RangeError("User-defined functions cannot have more than 100 arguments")}return this[xI].function(n,t,c,o,i,s),this}});var uh=T((gk,ah)=>{"use strict";u();var{getBooleanOption:Ni,cppdb:EI}=ft();ah.exports=function(t,r){if(typeof t!="string")throw new TypeError("Expected first argument to be a string");if(typeof r!="object"||r===null)throw new TypeError("Expected second argument to be an options object");if(!t)throw new TypeError("User-defined function name cannot be an empty string");let n="start"in r?r.start:null,o=Wa(r,"step",!0),i=Wa(r,"inverse",!1),s=Wa(r,"result",!1),a="safeIntegers"in r?+Ni(r,"safeIntegers"):2,c=Ni(r,"deterministic"),m=Ni(r,"directOnly"),f=Ni(r,"varargs"),h=-1;if(!f&&(h=Math.max(sh(o),i?sh(i):0),h>0&&(h-=1),h>100))throw new RangeError("User-defined functions cannot have more than 100 arguments");return this[EI].aggregate(n,o,i,s,t,h,a,c,m),this};var Wa=(e,t,r)=>{let n=t in e?e[t]:null;if(typeof n=="function")return n;if(n!=null)throw new TypeError(`Expected the "${t}" option to be a function`);if(r)throw new TypeError(`Missing required option "${t}"`);return null},sh=({length:e})=>{if(Number.isInteger(e)&&e>=0)return e;throw new TypeError("Expected function.length to be a positive integer")}});var ph=T((bk,fh)=>{"use strict";u();var{cppdb:II}=ft();fh.exports=function(t,r){if(typeof t!="string")throw new TypeError("Expected first argument to be a string");if(!t)throw new TypeError("Virtual table module name cannot be an empty string");let n=!1;if(typeof r=="object"&&r!==null)n=!0,r=AI(lh(r,"used",t));else{if(typeof r!="function")throw new TypeError("Expected second argument to be a function or a table definition object");r=SI(r)}return this[II].table(r,t,n),this};function SI(e){return function(r,n,o,...i){let s={module:r,database:n,table:o},a=NI.call(e,s,i);if(typeof a!="object"||a===null)throw new TypeError(`Virtual table module "${r}" did not return a table definition object`);return lh(a,"returned",r)}}function lh(e,t,r){if(!Ln.call(e,"rows"))throw new TypeError(`Virtual table module "${r}" ${t} a table definition without a "rows" property`);if(!Ln.call(e,"columns"))throw new TypeError(`Virtual table module "${r}" ${t} a table definition without a "columns" property`);let n=e.rows;if(typeof n!="function"||Object.getPrototypeOf(n)!==CI)throw new TypeError(`Virtual table module "${r}" ${t} a table definition with an invalid "rows" property (should be a generator function)`);let o=e.columns;if(!Array.isArray(o)||!(o=[...o]).every(m=>typeof m=="string"))throw new TypeError(`Virtual table module "${r}" ${t} a table definition with an invalid "columns" property (should be an array of strings)`);if(o.length!==new Set(o).size)throw new TypeError(`Virtual table module "${r}" ${t} a table definition with duplicate column names`);if(!o.length)throw new RangeError(`Virtual table module "${r}" ${t} a table definition with zero columns`);let i;if(Ln.call(e,"parameters")){if(i=e.parameters,!Array.isArray(i)||!(i=[...i]).every(m=>typeof m=="string"))throw new TypeError(`Virtual table module "${r}" ${t} a table definition with an invalid "parameters" property (should be an array of strings)`)}else i=TI(n);if(i.length!==new Set(i).size)throw new TypeError(`Virtual table module "${r}" ${t} a table definition with duplicate parameter names`);if(i.length>32)throw new RangeError(`Virtual table module "${r}" ${t} a table definition with more than the maximum number of 32 parameters`);for(let m of i)if(o.includes(m))throw new TypeError(`Virtual table module "${r}" ${t} a table definition with column "${m}" which was ambiguously defined as both a column and parameter`);let s=2;if(Ln.call(e,"safeIntegers")){let m=e.safeIntegers;if(typeof m!="boolean")throw new TypeError(`Virtual table module "${r}" ${t} a table definition with an invalid "safeIntegers" property (should be a boolean)`);s=+m}let a=!1;if(Ln.call(e,"directOnly")&&(a=e.directOnly,typeof a!="boolean"))throw new TypeError(`Virtual table module "${r}" ${t} a table definition with an invalid "directOnly" property (should be a boolean)`);return[`CREATE TABLE x(${[...i.map(ch).map(m=>`${m} HIDDEN`),...o.map(ch)].join(", ")});`,OI(n,new Map(o.map((m,f)=>[m,i.length+f])),r),i,s,a]}function OI(e,t,r){return function*(...o){let i=o.map(s=>Buffer.isBuffer(s)?Buffer.from(s):s);for(let s=0;s<t.size;++s)i.push(null);for(let s of e(...o))if(Array.isArray(s))DI(s,i,t.size,r),yield i;else if(typeof s=="object"&&s!==null)_I(s,i,t,r),yield i;else throw new TypeError(`Virtual table module "${r}" yielded something that isn\'t a valid row object`)}}function DI(e,t,r,n){if(e.length!==r)throw new TypeError(`Virtual table module "${n}" yielded a row with an incorrect number of columns`);let o=t.length-r;for(let i=0;i<r;++i)t[i+o]=e[i]}function _I(e,t,r,n){let o=0;for(let i of Object.keys(e)){let s=r.get(i);if(s===void 0)throw new TypeError(`Virtual table module "${n}" yielded a row with an undeclared column "${i}"`);t[s]=e[i],o+=1}if(o!==r.size)throw new TypeError(`Virtual table module "${n}" yielded a row with missing columns`)}function TI({length:e}){if(!Number.isInteger(e)||e<0)throw new TypeError("Expected function.length to be a positive integer");let t=[];for(let r=0;r<e;++r)t.push(`$${r+1}`);return t}var{hasOwnProperty:Ln}=Object.prototype,{apply:NI}=Function.prototype,CI=Object.getPrototypeOf(function*(){}),ch=e=>`"${e.replace(/"/g,\'""\')}"`,AI=e=>()=>e});var dh=T((wk,mh)=>{"use strict";u();var RI=function(){};mh.exports=function(t,r){return Object.assign(new RI,this)}});var bh=T((Ek,yh)=>{"use strict";u();var FI=require("fs"),hh=require("path"),Ci=ft(),$I=Ua(),gh;function _e(e,t){if(new.target==null)return new _e(e,t);let r;if(Buffer.isBuffer(e)&&(r=e,e=":memory:"),e==null&&(e=""),t==null&&(t={}),typeof e!="string")throw new TypeError("Expected first argument to be a string");if(typeof t!="object")throw new TypeError("Expected second argument to be an options object");if("readOnly"in t)throw new TypeError(\'Misspelled option "readOnly" should be "readonly"\');if("memory"in t)throw new TypeError(\'Option "memory" was removed in v7.0.0 (use ":memory:" filename instead)\');let n=e.trim(),o=n===""||n===":memory:",i=Ci.getBooleanOption(t,"readonly"),s=Ci.getBooleanOption(t,"fileMustExist"),a="timeout"in t?t.timeout:5e3,c="verbose"in t?t.verbose:null,m="nativeBinding"in t?t.nativeBinding:null;if(i&&o&&!r)throw new TypeError("In-memory/temporary databases cannot be readonly");if(!Number.isInteger(a)||a<0)throw new TypeError(\'Expected the "timeout" option to be a positive integer\');if(a>2147483647)throw new RangeError(\'Option "timeout" cannot be greater than 2147483647\');if(c!=null&&typeof c!="function")throw new TypeError(\'Expected the "verbose" option to be a function\');if(m!=null&&typeof m!="string"&&typeof m!="object")throw new TypeError(\'Expected the "nativeBinding" option to be a string or addon object\');let f;if(m==null?f=gh||(gh=Gd()("better_sqlite3.node")):typeof m=="string"?f=(typeof __non_webpack_require__=="function"?__non_webpack_require__:require)(hh.resolve(m).replace(/(\\.node)?$/,".node")):f=m,f.isInitialized||(f.setErrorConstructor($I),f.isInitialized=!0),!o&&!n.startsWith("file:")&&!FI.existsSync(hh.dirname(n)))throw new TypeError("Cannot open database because the directory does not exist");Object.defineProperties(this,{[Ci.cppdb]:{value:new f.Database(n,e,o,i,s,a,c||null,r||null)},...rr.getters})}var rr=Vd();_e.prototype.prepare=rr.prepare;_e.prototype.transaction=Yd();_e.prototype.pragma=Qd();_e.prototype.backup=th();_e.prototype.serialize=nh();_e.prototype.function=ih();_e.prototype.aggregate=uh();_e.prototype.table=ph();_e.prototype.loadExtension=rr.loadExtension;_e.prototype.exec=rr.exec;_e.prototype.close=rr.close;_e.prototype.defaultSafeIntegers=rr.defaultSafeIntegers;_e.prototype.unsafeMode=rr.unsafeMode;_e.prototype[Ci.inspect]=dh();yh.exports=_e});var vh=T((Sk,Ka)=>{"use strict";u();Ka.exports=bh();Ka.exports.SqliteError=Ua()});var Ih=T(Ri=>{"use strict";u();Object.defineProperty(Ri,"__esModule",{value:!0});function Eh(e,t){if(t)return e;throw new Error("Unhandled discriminated union member: "+JSON.stringify(e))}Ri.assertNever=Eh;Ri.default=Eh});u();u();u();u();u();u();u();u();u();var es=class extends Error{},oe=e=>{throw new es(e)},ts=class extends Error{},te=e=>{throw new ts(e)};u();u();var Et=(e,t)=>pe(e)===t,pe=e=>{let t=typeof e;return t==="object"?e===null?"null":"object":t==="function"?"object":t},rs={bigint:"a bigint",boolean:"boolean",null:"null",number:"a number",object:"an object",string:"a string",symbol:"a symbol",undefined:"undefined"};var je=(e,t)=>e in t,Su=e=>Object.entries(e),ie=e=>Object.keys(e),kt=e=>{let t=[];for(;e!==Object.prototype&&e!==null&&e!==void 0;){for(let r of Object.getOwnPropertyNames(e))t.includes(r)||t.push(r);for(let r of Object.getOwnPropertySymbols(e))t.includes(r)||t.push(r);e=Object.getPrototypeOf(e)}return t},sr=(e,t)=>{let r=e?.[t];return r!=null};var Ou=e=>Object.keys(e).length,kr=e=>Et(e,"object")?Object.keys(e).length!==0:!1,lS=Symbol("id");var rt=e=>Array.isArray(e)?e:[e];u();var be=class extends Array{static fromString(t,r="/"){return t===r?new be:new be(...t.split(r))}toString(t="/"){return this.length?this.join(t):t}},Du=(e,t)=>{let r=e;for(let n of t){if(typeof r!="object"||r===null)return;r=r[n]}return r};u();u();var ns=/^(?!^-0$)-?(?:0|[1-9]\\d*)(?:\\.\\d*[1-9])?$/,ay=e=>ns.test(e),uy=/^-?\\d*\\.?\\d*$/,cy=e=>e.length!==0&&uy.test(e),eo=/^(?:0|(?:-?[1-9]\\d*))$/,Mr=e=>eo.test(e),qr=/^(?:0|(?:[1-9]\\d*))$/,_u=/^-?\\d+$/,ly=e=>_u.test(e),Tu={number:"a number",bigint:"a bigint",integer:"an integer"},Nu=(e,t)=>`\'${e}\' was parsed as ${Tu[t]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`,fy=(e,t)=>t==="number"?ay(e):Mr(e),py=(e,t)=>t==="number"?Number(e):Number.parseInt(e),my=(e,t)=>t==="number"?cy(e):ly(e),jr=(e,t)=>Cu(e,"number",t),to=(e,t)=>Cu(e,"integer",t),Cu=(e,t,r)=>{let n=py(e,t);if(!Number.isNaN(n)){if(fy(e,t))return n;if(my(e,t))return te(Nu(e,t))}return r?te(r===!0?`Failed to parse ${Tu[t]} from \'${e}\'`:r):void 0},os=e=>{if(e[e.length-1]!=="n")return;let t=e.slice(0,-1),r;try{r=BigInt(t)}catch{return}if(eo.test(t))return r;if(_u.test(t))return te(Nu(e,"bigint"))};var ae=(e,t)=>{switch(pe(e)){case"object":return JSON.stringify(is(e,ro,[]),null,t);case"symbol":return ro.onSymbol(e);default:return ss(e)}},ro={onCycle:()=>"(cycle)",onSymbol:e=>`(symbol${e.description&&` ${e.description}`})`,onFunction:e=>`(function${e.name&&` ${e.name}`})`},is=(e,t,r)=>{switch(pe(e)){case"object":if(typeof e=="function")return ro.onFunction(e);if(r.includes(e))return"(cycle)";let n=[...r,e];if(Array.isArray(e))return e.map(i=>is(i,t,n));let o={};for(let i in e)o[i]=is(e[i],t,n);return o;case"symbol":return ro.onSymbol(e);case"bigint":return`${e}n`;case"undefined":return"undefined";default:return e}},ss=e=>typeof e=="string"?`\'${e}\'`:typeof e=="bigint"?`${e}n`:`${e}`;function dy(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function hy(e,t){return t.get?t.get.call(e):t.value}function gy(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}function Ru(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function Au(e,t){var r=Ru(e,t,"get");return hy(e,r)}function yy(e,t,r){dy(e,t),t.set(e,r)}function by(e,t,r){var n=Ru(e,t,"set");return gy(e,n,r),r}function no(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Le=e=>(t,r,n)=>t===void 0?r===void 0?oe(so):r:r===void 0?t:e(t,r,n),so="Unexpected operation two undefined operands",as={domain:({l:e,r:t})=>`${e.join(", ")} and ${t.join(", ")}`,range:({l:e,r:t})=>`${io(e)} and ${io(t)}`,class:({l:e,r:t})=>`classes ${typeof e=="string"?e:e.name} and ${typeof t=="string"?t:t.name}`,tupleLength:({l:e,r:t})=>`tuples of length ${e} and ${t}`,value:({l:e,r:t})=>`literal values ${ae(e)} and ${ae(t)}`,leftAssignability:({l:e,r:t})=>`literal value ${ae(e.value)} and ${ae(t)}`,rightAssignability:({l:e,r:t})=>`literal value ${ae(t.value)} and ${ae(e)}`,union:({l:e,r:t})=>`branches ${ae(e)} and branches ${ae(t)}`},io=e=>"limit"in e?`the range of exactly ${e.limit}`:e.min?e.max?`the range bounded by ${e.min.comparator}${e.min.limit} and ${e.max.comparator}${e.max.limit}`:`${e.min.comparator}${e.min.limit}`:e.max?`${e.max.comparator}${e.max.limit}`:"the unbounded range",oo=new WeakMap,It=class{get disjoints(){return Au(this,oo)}addDisjoint(t,r,n){return Au(this,oo)[`${this.path}`]={kind:t,l:r,r:n},ao}constructor(t,r){no(this,"type",void 0),no(this,"lastOperator",void 0),no(this,"path",void 0),no(this,"domain",void 0),yy(this,oo,{writable:!0,value:void 0}),this.type=t,this.lastOperator=r,this.path=new be,by(this,oo,{})}},ao=Symbol("empty"),Fu=()=>ao,Qe=e=>e===ao,$u=Symbol("equal"),ve=()=>$u,Be=e=>e===$u,ar=(e,t)=>(r,n,o)=>{let i={},s=ie({...r,...n}),a=!0,c=!0;for(let m of s){let f=typeof e=="function"?e(m,r[m],n[m],o):e[m](r[m],n[m],o);if(Be(f))r[m]!==void 0&&(i[m]=r[m]);else if(Qe(f))if(t.onEmpty==="omit")a=!1,c=!1;else return ao;else f!==void 0&&(i[m]=f),a&&(a=f===r[m]),c&&(c=f===n[m])}return a?c?ve():r:c?n:i};var Pu=e=>{let t=ie(e);if(t.length===1){let n=t[0];return`${n==="/"?"":`At ${n}: `}Intersection of ${as[e[n].kind](e[n])} results in an unsatisfiable type`}let r=`\n "Intersection results in unsatisfiable types at the following paths:\n`;for(let n in e)r+=` ${n}: ${as[e[n].kind](e[n])}\n`;return r},uo=(e,t,r)=>`${e.length?`At ${e}: `:""}${t} ${r?`${r} `:""}results in an unsatisfiable type`;u();u();var Lr={Array,Date,Error,Function,Map,RegExp,Set,Object,String,Number,Boolean,WeakMap,WeakSet,Promise},ur=(e,t)=>{if(pe(e)!=="object")return;let r=t??Lr,n=Object.getPrototypeOf(e);for(;n?.constructor&&(!r[n.constructor.name]||!(e instanceof r[n.constructor.name]));)n=Object.getPrototypeOf(n);return n?.constructor?.name};var St=e=>Array.isArray(e),us={Object:"an object",Array:"an array",Function:"a function",Date:"a Date",RegExp:"a RegExp",Error:"an Error",Map:"a Map",Set:"a Set",String:"a String object",Number:"a Number object",Boolean:"a Boolean object",Promise:"a Promise",WeakMap:"a WeakMap",WeakSet:"a WeakSet"},co=e=>{let t=Object(e).name;return t&&je(t,Lr)&&Lr[t]===e?t:void 0};u();u();u();var ku=Le((e,t,r)=>e===t?ve():e instanceof t?e:t instanceof e?t:r.addDisjoint("class",e,t)),Mu=(e,t)=>typeof e=="string"?ur(t.data)===e||!t.problems.add("class",e):t.data instanceof e||!t.problems.add("class",e);u();var lo=(e,t)=>{if(Array.isArray(e)){if(Array.isArray(t)){let r=vy(e,t);return r.length===e.length?r.length===t.length?ve():e:r.length===t.length?t:r}return e.includes(t)?e:[...e,t]}return Array.isArray(t)?t.includes(e)?t:[...t,e]:e===t?ve():[e,t]},vy=(e,t)=>{let r=[...e];for(let n of t)e.includes(n)||r.push(n);return r};u();var qu=Le((e,t)=>e===t?ve():Math.abs(e*t/wy(e,t))),wy=(e,t)=>{let r,n=e,o=t;for(;o!==0;)r=o,o=n%o,n=r;return n},ju=(e,t)=>t.data%e===0||!t.problems.add("divisor",e);u();var Br=e=>e[0]==="?",fo=e=>e[0]==="!",ot={index:"[index]"},Ot=e=>Br(e)||fo(e)?e[1]:e,xy=e=>{if(typeof e.length=="object"&&fo(e.length)&&typeof e.length[1]!="string"&&mo(e.length[1],"number"))return e.length[1].number.value},Lu=Le((e,t,r)=>{let n=Ey(e,t,r);if(typeof n=="symbol")return n;let o=xy(n);if(o===void 0||!(ot.index in n))return n;let{[ot.index]:i,...s}=n,a=Ot(i);for(let c=0;c<o;c++){if(!s[c]){s[c]=a;continue}let m=Ot(s[c]);r.path.push(`${c}`);let f=po(m,a,r);if(r.path.pop(),Qe(f))return f;!Be(f)&&f!==m&&(s[c]=f)}return s}),Ey=ar((e,t,r,n)=>{if(t===void 0)return r===void 0?ve():r;if(r===void 0)return t;n.path.push(e);let o=po(Ot(t),Ot(r),n);n.path.pop();let i=Br(t)&&Br(r);return Qe(o)&&i?{}:o},{onEmpty:"bubble"}),Bu=(e,t,r)=>{let n=r.type.config?.keys??r.type.scope.config.keys;return n==="loose"?Iy(e,t,r):Sy(n,e,t,r)},Iy=(e,t,r)=>{for(let n in t){let o=t[n];r.path.push(n),n===ot.index?e.push(["indexProp",nt(Ot(o),r)]):Br(o)?e.push(["optionalProp",[n,nt(o[1],r)]]):fo(o)?e.push(["prerequisiteProp",[n,nt(o[1],r)]]):e.push(["requiredProp",[n,nt(o,r)]]),r.path.pop()}},Sy=(e,t,r,n)=>{let o={required:{},optional:{}};for(let i in r){let s=r[i];n.path.push(i),i===ot.index?o.index=nt(Ot(s),n):Br(s)?o.optional[i]=nt(s[1],n):fo(s)?t.push(["prerequisiteProp",[i,nt(s[1],n)]]):o.required[i]=nt(s,n),n.path.pop()}t.push([`${e}Props`,o])};u();u();function Oy(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var cs=e=>typeof e=="string"||Array.isArray(e)?e.length:typeof e=="number"?e:0,Dy=e=>typeof e=="string"?"characters":Array.isArray(e)?"items long":"",ho=class{toString(){return ae(this.value)}get domain(){return pe(this.value)}get size(){return cs(this.value)}get units(){return Dy(this.value)}get className(){return Object(this.value).constructor.name}constructor(t){Oy(this,"value",void 0),this.value=t}};var go={">":!0,">=":!0},ls={"<":!0,"<=":!0},Ur=e=>"comparator"in e,zu=Le((e,t,r)=>{if(Ur(e))return Ur(t)?e.limit===t.limit?ve():r.addDisjoint("range",e,t):Uu(t,e.limit)?e:r.addDisjoint("range",e,t);if(Ur(t))return Uu(e,t.limit)?t:r.addDisjoint("range",e,t);let n=cr("min",e.min,t.min),o=cr("max",e.max,t.max);return n==="l"?o==="r"?cr("min",e.min,t.max)==="l"?r.addDisjoint("range",e,t):{min:e.min,max:t.max}:e:n==="r"?o==="l"?cr("max",e.max,t.min)==="l"?r.addDisjoint("range",e,t):{min:t.min,max:e.max}:t:o==="l"?e:o==="r"?t:ve()}),Uu=(e,t)=>Ur(e)?t===e.limit:_y(e.min,t)&&Ty(e.max,t),_y=(e,t)=>!e||t>e.limit||t===e.limit&&!zr(e.comparator),Ty=(e,t)=>!e||t<e.limit||t===e.limit&&!zr(e.comparator),Wu=(e,t,r)=>{let n=r.lastDomain==="string"?"characters":r.lastDomain==="object"?"items long":void 0;if(Ur(t))return e.push(["bound",n?{...t,units:n}:t]);t.min&&e.push(["bound",n?{...t.min,units:n}:t.min]),t.max&&e.push(["bound",n?{...t.max,units:n}:t.max])},Ku=(e,t)=>Ny[e.comparator](cs(t.data),e.limit)||!t.problems.add("bound",e),Ny={"<":(e,t)=>e<t,">":(e,t)=>e>t,"<=":(e,t)=>e<=t,">=":(e,t)=>e>=t,"==":(e,t)=>e===t},cr=(e,t,r)=>t?r?t.limit===r.limit?zr(t.comparator)?zr(r.comparator)?"=":"l":zr(r.comparator)?"r":"=":e==="min"?t.limit>r.limit?"l":"r":t.limit<r.limit?"l":"r":"l":r?"r":"=",zr=e=>e.length===1;u();var fs={},ps=e=>(fs[e]||(fs[e]=new RegExp(e)),fs[e]),Gu=(e,t)=>ps(e).test(t.data)||!t.problems.add("regex",`/${e}/`),Vu=Le(lo);var Ju=(e,t,r)=>"value"in e?"value"in t?e.value===t.value?ve():r.addDisjoint("value",e.value,t.value):Hu(e.value,t,r)?e:r.addDisjoint("leftAssignability",e,t):"value"in t?Hu(t.value,e,r)?t:r.addDisjoint("rightAssignability",e,t):Ay(e,t,r),Cy=Le(lo),Ay=ar({divisor:qu,regex:Vu,props:Lu,class:ku,range:zu,narrow:Cy},{onEmpty:"bubble"}),ms=(e,t)=>{let r=[],n;for(n in e)Ry[n](r,e[n],t);return r.sort((o,i)=>Wr[o[0]]-Wr[i[0]])},Ry={regex:(e,t)=>{for(let r of rt(t))e.push(["regex",r])},divisor:(e,t)=>{e.push(["divisor",t])},range:Wu,class:(e,t)=>{e.push(["class",t])},props:Bu,narrow:(e,t)=>{for(let r of rt(t))e.push(["narrow",r])},value:(e,t)=>{e.push(["value",t])}},Wr={config:-1,domain:0,value:0,domains:0,branches:0,switch:0,alias:0,class:0,regex:1,divisor:1,bound:1,prerequisiteProp:2,distilledProps:3,strictProps:3,requiredProp:3,optionalProp:3,indexProp:3,narrow:4,morph:5},Hu=(e,t,r)=>!r.type.scope.type(["node",{[r.domain]:t}])(e).problems;var ds=e=>e?.lBranches!==void 0,Zu=(e,t,r)=>{let n={lBranches:e,rBranches:t,lExtendsR:[],rExtendsL:[],equalities:[],distinctIntersections:[]},o=t.map(i=>({condition:i,distinct:[]}));return e.forEach((i,s)=>{let a=!1,c=o.map((m,f)=>{if(a||!m.distinct)return null;let h=m.condition,p=Gr(i,h,r);return Qe(p)?null:p===i?(n.lExtendsR.push(s),a=!0,null):p===h?(n.rExtendsL.push(f),m.distinct=null,null):Be(p)?(n.equalities.push([s,f]),a=!0,m.distinct=null,null):Et(p,"object")?p:oe(`Unexpected predicate intersection result of type \'${pe(p)}\'`)});if(!a)for(let m=0;m<o.length;m++)c[m]&&o[m].distinct?.push(c[m])}),n.distinctIntersections=o.flatMap(i=>i.distinct??[]),n},hs=e=>"rules"in e,Kr=(e,t)=>{if(hs(e)){let r=ms(e.rules,t);if(e.morph)if(typeof e.morph=="function")r.push(["morph",e.morph]);else for(let n of e.morph)r.push(["morph",n]);return r}return ms(e,t)},Yu=e=>e.rules??e,Gr=(e,t,r)=>{let n=Yu(e),o=Yu(t),i=Ju(n,o,r);return"morph"in e?"morph"in t?e.morph===t.morph?Be(i)||Qe(i)?i:{rules:i,morph:e.morph}:r.lastOperator==="&"?te(uo(r.path,"Intersection","of morphs")):{}:Qe(i)?i:{rules:Be(i)?e.rules:i,morph:e.morph}:"morph"in t?Qe(i)?i:{rules:Be(i)?t.rules:i,morph:t.morph}:i};u();u();var Qu=e=>`${e==="/"?"A":`At ${e}, a`} union including one or more morphs must be discriminatable`;var ec=(e,t)=>{let r=$y(e,t),n=e.map((o,i)=>i);return tc(e,n,r,t)},tc=(e,t,r,n)=>{if(t.length===1)return Kr(e[t[0]],n);let o=ky(t,r);if(!o)return[["branches",t.map(s=>ys(e[s],n.type.scope)?te(Qu(`${n.path}`)):Kr(e[s],n))]];let i={};for(let s in o.indexCases){let a=o.indexCases[s];i[s]=tc(e,a,r,n),s!=="default"&&Vr(i[s],o.path,o,n)}return[["switch",{path:o.path,kind:o.kind,cases:i}]]},Vr=(e,t,r,n)=>{for(let o=0;o<e.length;o++){let[i,s]=e[o];if(t.length){if((i==="requiredProp"||i==="prerequisiteProp"||i==="optionalProp")&&s[0]===t[0]){if(typeof s[1]=="string"){if(r.kind!=="domain")return gs(r);e.splice(o,1);return}Vr(s[1],t.slice(1),r,n),s[1].length===0&&e.splice(o,1);return}}else if(r.kind==="domain"){if(i==="domain"||i==="domains"){e.splice(o,1);return}else if(i==="class"||i==="value")return}else if(r.kind===i){e.splice(o,1);return}if(i==="domains"){if(Ou(s)!==1||!s.object)return gs(r);Vr(s.object,t,r,n);return}else if(i==="switch"){for(let a in s.cases)Vr(s.cases[a],t,r,n);return}else if(i==="branches"){for(let a of s)Vr(a,t,r,n);return}}return gs(r)},gs=e=>oe(`Unexpectedly failed to discriminate ${e.kind} at path \'${e.path}\'`),Fy={domain:!0,class:!0,value:!0},$y=(e,t)=>{let r={disjointsByPair:{},casesByDisjoint:{}};for(let n=0;n<e.length-1;n++)for(let o=n+1;o<e.length;o++){let i=`${n}/${o}`,s=[];r.disjointsByPair[i]=s;let a=new It(t.type,"|");Gr(e[n],e[o],a);for(let c in a.disjoints){if(c.includes(ot.index))continue;let{l:m,r:f,kind:h}=a.disjoints[c];if(!je(h,Fy))continue;let p=Xu(h,m),b=Xu(h,f);if(p===void 0||b===void 0)continue;let E=c==="/"?h:`${c}/${h}`;if(s.push(E),!r.casesByDisjoint[E]){r.casesByDisjoint[E]={[p]:[n],[b]:[o]};continue}let I=r.casesByDisjoint[E],D=I[p];D?D.includes(n)||D.push(n):I[p]=[n];let A=I[b];A?A.includes(o)||A.push(o):I[b]=[o]}}return r},Py=e=>{let t=be.fromString(e);return[t,t.pop()]},ky=(e,t)=>{let r;for(let n=0;n<e.length-1;n++){let o=e[n];for(let i=n+1;i<e.length;i++){let s=e[i],a=t.disjointsByPair[`${o}/${s}`];for(let c of a){let m=t.casesByDisjoint[c],f={},h=[...e],p=0;for(let E in m){let I=m[E].filter(D=>{let A=e.indexOf(D);if(A!==-1)return delete h[A],!0});I.length!==0&&(f[E]=I,p++)}let b=ie(h);if(b.length&&(f.default=b.map(E=>parseInt(E))),!r||p>r.score){let[E,I]=Py(c);if(r={path:E,kind:I,indexCases:f,score:p},p===e.length)return r}}}}return r},Xu=(e,t)=>{switch(e){case"value":return rc(t);case"domain":return t;case"class":return co(t);default:return}},rc=e=>{let t=pe(e);return t==="object"||t==="symbol"?void 0:ss(e)},My={value:e=>rc(e)??"default",class:e=>ur(e)??"default",domain:pe},nc=(e,t)=>My[e](t),ys=(e,t)=>"morph"in e?!0:"props"in e?Object.values(e.props).some(r=>qy(Ot(r),t)):!1,qy=(e,t)=>typeof e=="string"?t.resolve(e).includesMorph:Object.values(t.resolveTypeNode(e)).some(r=>r===!0?!1:St(r)?r.some(n=>ys(n,t)):ys(r,t));var lr=e=>e===!0?{}:e,oc=(e,t,r)=>{if(e===!0&&t===!0)return ve();if(!St(e)&&!St(t)){let s=Gr(lr(e),lr(t),r);return s===e?e:s===t?t:s}let n=rt(lr(e)),o=rt(lr(t)),i=Zu(n,o,r);return i.equalities.length===n.length&&i.equalities.length===o.length?ve():i.lExtendsR.length+i.equalities.length===n.length?e:i.rExtendsL.length+i.equalities.length===o.length?t:i},ic=(e,t,r,n)=>{n.domain=e;let o=oc(t,r,n);if(!ds(o))return o;let i=[...o.distinctIntersections,...o.equalities.map(s=>o.lBranches[s[0]]),...o.lExtendsR.map(s=>o.lBranches[s]),...o.rExtendsL.map(s=>o.rBranches[s])];return i.length===0&&n.addDisjoint("union",o.lBranches,o.rBranches),i.length===1?i[0]:i},sc=(e,t,r,n)=>{let o=new It(n,"|"),i=oc(t,r,o);if(!ds(i))return Be(i)||i===t?r:i===r?t:e==="boolean"?!0:[lr(t),lr(r)];let s=[...i.lBranches.filter((a,c)=>!i.lExtendsR.includes(c)&&!i.equalities.some(m=>m[0]===c)),...i.rBranches.filter((a,c)=>!i.rExtendsL.includes(c)&&!i.equalities.some(m=>m[1]===c))];return s.length===1?s[0]:s},bs=(e,t)=>e===!0?[]:St(e)?ec(e,t):Kr(e,t),ac=e=>typeof e=="object"&&"value"in e;var Hr=e=>"config"in e,po=(e,t,r)=>{r.domain=void 0;let n=r.type.scope.resolveTypeNode(e),o=r.type.scope.resolveTypeNode(t),i=jy(n,o,r);return typeof i=="object"&&!kr(i)?kr(r.disjoints)?Fu():r.addDisjoint("domain",ie(n),ie(o)):i===n?e:i===o?t:i},jy=ar((e,t,r,n)=>{if(t===void 0)return r===void 0?oe(so):void 0;if(r!==void 0)return ic(e,t,r,n)},{onEmpty:"omit"}),Dt=(e,t,r)=>{let n=new It(r,"&"),o=po(e,t,n);return Qe(o)?te(Pu(n.disjoints)):Be(o)?e:o},yo=(e,t,r)=>{let n=r.scope.resolveTypeNode(e),o=r.scope.resolveTypeNode(t),i={},s=ie({...n,...o});for(let a of s)i[a]=sr(n,a)?sr(o,a)?sc(a,n[a],o[a],r):n[a]:sr(o,a)?o[a]:oe(so);return i},Ly=e=>e[0]&&(e[0][0]==="value"||e[0][0]==="class"),vs=e=>{let t={type:e,path:new be,lastDomain:"undefined"};return nt(e.node,t)},nt=(e,t)=>{if(typeof e=="string")return t.type.scope.resolve(e).flat;let r=Hr(e),n=By(r?e.node:e,t);return r?[["config",{config:Su(e.config),node:n}]]:n},By=(e,t)=>{let r=ie(e);if(r.length===1){let o=r[0],i=e[o];if(i===!0)return o;t.lastDomain=o;let s=bs(i,t);return Ly(s)?s:[["domain",o],...s]}let n={};for(let o of r)t.lastDomain=o,n[o]=bs(e[o],t);return[["domains",n]]},mo=(e,t)=>Uy(e,t)&&ac(e[t]),Uy=(e,t)=>{let r=ie(e);return r.length===1&&r[0]===t},fr=e=>({object:{class:Array,props:{[ot.index]:e}}});u();u();u();u();u();function ws(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ue=class{shift(){return this.chars[this.i++]??""}get lookahead(){return this.chars[this.i]??""}shiftUntil(t){let r="";for(;this.lookahead;){if(t(this,r))if(r[r.length-1]===ue.escapeToken)r=r.slice(0,-1);else break;r+=this.shift()}return r}shiftUntilNextTerminator(){return this.shiftUntil(ue.lookaheadIsNotWhitespace),this.shiftUntil(ue.lookaheadIsTerminator)}get unscanned(){return this.chars.slice(this.i,this.chars.length).join("")}lookaheadIs(t){return this.lookahead===t}lookaheadIsIn(t){return this.lookahead in t}constructor(t){ws(this,"chars",void 0),ws(this,"i",void 0),ws(this,"finalized",!1),this.chars=[...t],this.i=0}};(function(e){var t=e.lookaheadIsTerminator=p=>p.lookahead in o,r=e.lookaheadIsNotWhitespace=p=>p.lookahead!==h,n=e.comparatorStartChars={"<":!0,">":!0,"=":!0},o=e.terminatingChars={...n,"|":!0,"&":!0,")":!0,"[":!0,"%":!0," ":!0},i=e.comparators={"<":!0,">":!0,"<=":!0,">=":!0,"==":!0},s=e.oneCharComparators={"<":!0,">":!0},a=e.comparatorDescriptions={"<":"less than",">":"more than","<=":"at most",">=":"at least","==":"exactly"},c=e.invertedComparators={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},m=e.branchTokens={"|":!0,"&":!0},f=e.escapeToken="\\\\",h=e.whiteSpaceToken=" "})(ue||(ue={}));function zy(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Wy(e,t){return t.get?t.get.call(e):t.value}function Ky(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}function uc(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function bo(e,t){var r=uc(e,t,"get");return Wy(e,r)}function Gy(e,t,r){zy(e,t),t.set(e,r)}function Vy(e,t,r){var n=uc(e,t,"set");return Ky(e,n,r),r}function mt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Es=class extends TypeError{constructor(t){super(`${t}`),mt(this,"cause",void 0),this.cause=t}},jt=class{toString(){return this.message}get message(){return this.writers.addContext(this.reason,this.path)}get reason(){return this.writers.writeReason(this.mustBe,new ho(this.data))}get mustBe(){return typeof this.writers.mustBe=="string"?this.writers.mustBe:this.writers.mustBe(this.source)}constructor(t,r,n,o,i){mt(this,"code",void 0),mt(this,"path",void 0),mt(this,"data",void 0),mt(this,"source",void 0),mt(this,"writers",void 0),mt(this,"parts",void 0),this.code=t,this.path=r,this.data=n,this.source=o,this.writers=i,this.code==="multi"&&(this.parts=this.source)}},pr=new WeakMap,Is=class extends Array{mustBe(t,r){return this.add("custom",t,r)}add(t,r,n){let o=be.from(n?.path??bo(this,pr).path),i=n&&"data"in n?n.data:bo(this,pr).data,s=new jt(t,o,i,r,bo(this,pr).getProblemConfig(t));return this.addProblem(s),s}addProblem(t){let r=`${t.path}`,n=this.byPath[r];if(n)if(n.parts)n.parts.push(t);else{let o=new jt("multi",n.path,n.data,[n,t],bo(this,pr).getProblemConfig("multi")),i=this.indexOf(n);this[i===-1?this.length:i]=o,this.byPath[r]=o}else this.byPath[r]=t,this.push(t);this.count++}get summary(){return`${this}`}toString(){return this.join(`\n`)}throw(){throw new Es(this)}constructor(t){super(),mt(this,"byPath",{}),mt(this,"count",0),Gy(this,pr,{writable:!0,value:void 0}),Vy(this,pr,t)}},vo=Is,Hy=e=>e[0].toUpperCase()+e.slice(1),Ss=e=>e.map(t=>rs[t]),cc=e=>e.map(t=>us[t]),xs=e=>{if(e.length===0)return"never";if(e.length===1)return e[0];let t="";for(let r=0;r<e.length-1;r++)t+=e[r],r<e.length-2&&(t+=", ");return t+=` or ${e[e.length-1]}`,t},Mt=(e,t)=>`must be ${e}${t&&` (was ${t})`}`,lc=(e,t)=>t.length===0?Hy(e):t.length===1&&Mr(t[0])?`Item at index ${t[0]} ${e}`:`${t} ${e}`,qt={divisor:{mustBe:e=>e===1?"an integer":`a multiple of ${e}`},class:{mustBe:e=>{let t=co(e);return t?us[t]:`an instance of ${e.name}`},writeReason:(e,t)=>Mt(e,t.className)},domain:{mustBe:e=>rs[e],writeReason:(e,t)=>Mt(e,t.domain)},missing:{mustBe:()=>"defined",writeReason:e=>Mt(e,"")},extraneous:{mustBe:()=>"removed",writeReason:e=>Mt(e,"")},bound:{mustBe:e=>`${ue.comparatorDescriptions[e.comparator]} ${e.limit}${e.units?` ${e.units}`:""}`,writeReason:(e,t)=>Mt(e,`${t.size}`)},regex:{mustBe:e=>`a string matching ${e}`},value:{mustBe:ae},branches:{mustBe:e=>xs(e.map(t=>`${t.path} must be ${t.parts?xs(t.parts.map(r=>r.mustBe)):t.mustBe}`)),writeReason:(e,t)=>`${e} (was ${t})`,addContext:(e,t)=>t.length?`At ${t}, ${e}`:e},multi:{mustBe:e=>"\\u2022 "+e.map(t=>t.mustBe).join(`\n\\u2022 `),writeReason:(e,t)=>`${t} must be...\n${e}`,addContext:(e,t)=>t.length?`At ${t}, ${e}`:e},custom:{mustBe:e=>e},cases:{mustBe:e=>xs(e)}},fc=ie(qt),Jy=()=>{let e={},t;for(t of fc)e[t]={mustBe:qt[t].mustBe,writeReason:qt[t].writeReason??Mt,addContext:qt[t].addContext??lc};return e},Yy=Jy(),pc=e=>{if(!e)return Yy;let t={};for(let r of fc)t[r]={mustBe:e[r]?.mustBe??qt[r].mustBe,writeReason:e[r]?.writeReason??qt[r].writeReason??e.writeReason??Mt,addContext:e[r]?.addContext??qt[r].addContext??e.addContext??lc};return t};function Zy(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Qy(e,t){return t.get?t.get.call(e):t.value}function Xy(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}function hc(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function Os(e,t){var r=hc(e,t,"get");return Qy(e,r)}function eb(e,t,r){Zy(e,t),t.set(e,r)}function tb(e,t,r){var n=hc(e,t,"set");return Xy(e,n,r),r}function it(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var rb=()=>({mustBe:[],writeReason:[],addContext:[],keys:[]}),nb=["mustBe","writeReason","addContext"],gc=(e,t)=>{let r=new Ds(t,e);wo(e.flat,r);let n=new yc(r);if(r.problems.count)n.problems=r.problems;else{for(let[o,i]of r.entriesToPrune)delete o[i];n.data=r.data}return n},yc=class{constructor(){it(this,"data",void 0),it(this,"problems",void 0)}},Jr=new WeakMap,Ds=class{getProblemConfig(t){let r={};for(let n of nb)r[n]=this.traversalConfig[n][0]??this.rootScope.config.codes[t][n];return r}traverseConfig(t,r){for(let o of t)this.traversalConfig[o[0]].unshift(o[1]);let n=wo(r,this);for(let o of t)this.traversalConfig[o[0]].shift();return n}traverseKey(t,r){let n=this.data;this.data=this.data[t],this.path.push(t);let o=wo(r,this);return this.path.pop(),n[t]!==this.data&&(n[t]=this.data),this.data=n,o}traverseResolution(t){let r=this.type.scope.resolve(t),n=r.qualifiedName,o=this.data,i=Et(o,"object");if(i){let c=Os(this,Jr)[n];if(c){if(c.includes(o))return!0;c.push(o)}else Os(this,Jr)[n]=[o]}let s=this.type;this.type=r;let a=wo(r.flat,this);return this.type=s,i&&Os(this,Jr)[n].pop(),a}traverseBranches(t){let r=this.failFast;this.failFast=!0;let n=this.problems,o=new vo(this);this.problems=o;let i=this.path,s=this.entriesToPrune,a=!1;for(let c of t)if(this.path=new be,this.entriesToPrune=[],xo(c,this)){a=!0,s.push(...this.entriesToPrune);break}return this.path=i,this.entriesToPrune=s,this.problems=n,this.failFast=r,a||!this.problems.add("branches",o)}constructor(t,r){it(this,"data",void 0),it(this,"type",void 0),it(this,"path",void 0),it(this,"problems",void 0),it(this,"entriesToPrune",void 0),it(this,"failFast",void 0),it(this,"traversalConfig",void 0),it(this,"rootScope",void 0),eb(this,Jr,{writable:!0,value:void 0}),this.data=t,this.type=r,this.path=new be,this.problems=new vo(this),this.entriesToPrune=[],this.failFast=!1,this.traversalConfig=rb(),tb(this,Jr,{}),this.rootScope=r.scope}},wo=(e,t)=>typeof e=="string"?pe(t.data)===e||!t.problems.add("domain",e):xo(e,t),xo=(e,t)=>{let r=!0;for(let n=0;n<e.length;n++){let[o,i]=e[n],s=ob[o](i,t);if(r&&(r=s),!r&&(t.failFast||n<e.length-1&&Wr[o]<Wr[e[n+1][0]]))return!1}return r},mc=(e,t)=>e[0]in t.data?t.traverseKey(e[0],e[1]):(t.problems.add("missing",void 0,{path:t.path.concat(e[0]),data:void 0}),!1),dc=e=>(t,r)=>{let n=!0,o={...t.required};for(let s in r.data)if(t.required[s]?(n=r.traverseKey(s,t.required[s])&&n,delete o[s]):t.optional[s]?n=r.traverseKey(s,t.optional[s])&&n:t.index&&eo.test(s)?n=r.traverseKey(s,t.index)&&n:e==="distilledProps"?r.failFast?r.entriesToPrune.push([r.data,s]):delete r.data[s]:(n=!1,r.problems.add("extraneous",r.data[s],{path:r.path.concat(s)})),!n&&r.failFast)return!1;let i=Object.keys(o);if(i.length){for(let s of i)r.problems.add("missing",void 0,{path:r.path.concat(s)});return!1}return n},ob={regex:Gu,divisor:ju,domains:(e,t)=>{let r=e[pe(t.data)];return r?xo(r,t):!t.problems.add("cases",Ss(ie(e)))},domain:(e,t)=>pe(t.data)===e||!t.problems.add("domain",e),bound:Ku,optionalProp:(e,t)=>e[0]in t.data?t.traverseKey(e[0],e[1]):!0,requiredProp:mc,prerequisiteProp:mc,indexProp:(e,t)=>{if(!Array.isArray(t.data))return t.problems.add("class",Array),!1;let r=!0;for(let n=0;n<t.data.length;n++)if(r=t.traverseKey(`${n}`,e)&&r,!r&&t.failFast)return!1;return r},branches:(e,t)=>t.traverseBranches(e),switch:(e,t)=>{let r=Du(t.data,e.path),n=nc(e.kind,r);if(sr(e.cases,n))return xo(e.cases[n],t);let o=ie(e.cases),i=t.path.concat(e.path),s=e.kind==="value"?o:e.kind==="domain"?Ss(o):e.kind==="class"?cc(o):oe(`Unexpectedly encountered rule kind \'${e.kind}\' during traversal`);return t.problems.add("cases",s,{path:i,data:r}),!1},alias:(e,t)=>t.traverseResolution(e),class:Mu,narrow:(e,t)=>{let r=t.problems.count,n=e(t.data,t.problems);return!n&&t.problems.count===r&&t.problems.mustBe(e.name?`valid according to ${e.name}`:"valid"),n},config:({config:e,node:t},r)=>r.traverseConfig(e,t),value:(e,t)=>t.data===e||!t.problems.add("value",e),morph:(e,t)=>{let r=e(t.data,t.problems);if(t.problems.length)return!1;if(r instanceof jt)return t.problems.addProblem(r),!1;if(r instanceof yc){if(r.problems){for(let n of r.problems)t.problems.addProblem(n);return!1}return t.data=r.data,!0}return t.data=r,!0},distilledProps:dc("distilledProps"),strictProps:dc("strictProps")};u();var _t=new Proxy(()=>_t,{get:()=>_t});var _s=(e,t,r,n)=>{let o={node:e,flat:[["alias",e]],allows:a=>!i(a).problems,assert:a=>{let c=i(a);return c.problems?c.problems.throw():c.data},infer:_t,inferIn:_t,qualifiedName:ib(e)?n.getAnonymousQualifiedName(e):`${n.name}.${e}`,definition:t,scope:n,includesMorph:!1,config:r},i={[e]:a=>gc(i,a)}[e];return Object.assign(i,o)},Ts=e=>e?.infer===_t,ib=e=>e[0]==="\\u03BB";u();u();var bc=e=>{let t=e.scanner.shiftUntilNextTerminator();e.setRoot(sb(e,t))},sb=(e,t)=>e.ctx.type.scope.addParsedReferenceIfResolvable(t,e.ctx)?t:ab(t)??e.error(t===""?Ns(e):ub(t)),ab=e=>{let t=jr(e);if(t!==void 0)return{number:{value:t}};let r=os(e);if(r!==void 0)return{bigint:{value:r}}},ub=e=>`\'${e}\' is unresolvable`,Ns=e=>{let t=e.previousOperator();return t?Cs(t,e.scanner.unscanned):cb(e.scanner.unscanned)},Cs=(e,t)=>`Token \'${e}\' requires a right operand${t?` before \'${t}\'`:""}`,cb=e=>`Expected an expression${e?` before \'${e}\'`:""}`;u();var As=(e,t)=>({node:t.type.scope.resolveTypeNode(we(e[0],t)),config:e[2]});u();u();var Ue=e=>Object.isFrozen(e)?e:Array.isArray(e)?Object.freeze(e.map(Ue)):lb(e),lb=e=>{for(let t in e)Ue(e[t]);return e};var fb=Ue({regex:qr.source}),pb=Ue({range:{min:{comparator:">=",limit:0}},divisor:1}),vc=(e,t)=>{let r=t.type.scope.resolveNode(we(e[1],t)),n=ie(r).map(f=>db(f,r[f])),o=wc(n);if(!o.length)return uo(t.path,"keyof");let i={};for(let f of o){let h=typeof f;if(h==="string"||h==="number"||h==="symbol"){var s,a;(s=i)[a=h]??(s[a]=[]),i[h].push({value:f})}else if(f===qr){var c,m;(c=i).string??(c.string=[]),i.string.push(fb),(m=i).number??(m.number=[]),i.number.push(pb)}else return oe(`Unexpected keyof key \'${ae(f)}\'`)}return Object.fromEntries(Object.entries(i).map(([f,h])=>[f,h.length===1?h[0]:h]))},mb={bigint:kt(0n),boolean:kt(!1),null:[],number:kt(0),object:[],string:kt(""),symbol:kt(Symbol()),undefined:[]},db=(e,t)=>e!=="object"||t===!0?mb[e]:wc(rt(t).map(r=>hb(r))),wc=e=>{if(!e.length)return[];let t=e[0];for(let r=1;r<e.length;r++)t=t.filter(n=>e[r].includes(n));return t},hb=e=>{let t=[];if("props"in e)for(let r of Object.keys(e.props))r===ot.index?t.push(qr):t.includes(r)||(t.push(r),qr.test(r)&&t.push(to(r,`Unexpectedly failed to parse an integer from key \'${r}\'`)));if("class"in e){let r=typeof e.class=="string"?Lr[e.class]:e.class;for(let n of kt(r.prototype))t.includes(n)||t.push(n)}return t};u();var Ec=(e,t)=>{if(typeof e[2]!="function")return te(gb(e[2]));let r=we(e[0],t),n=t.type.scope.resolveTypeNode(r),o=e[2];t.type.includesMorph=!0;let i,s={};for(i in n){let a=n[i];a===!0?s[i]={rules:{},morph:o}:typeof a=="object"?s[i]=St(a)?a.map(c=>xc(c,o)):xc(a,o):oe(`Unexpected predicate value for domain \'${i}\': ${ae(a)}`)}return s},xc=(e,t)=>hs(e)?{...e,morph:e.morph?Array.isArray(e.morph)?[...e.morph,t]:[e.morph,t]:t}:{rules:e,morph:t},gb=e=>`Morph expression requires a function following \'|>\' (was ${typeof e})`;u();u();var Ic=e=>`Expected a Function or Record<Domain, Function> operand (${ae(e)} was invalid)`,Sc=(e,t,r,n)=>{let o=ie(t);if(!Et(e,"object"))return te(Ic(e));let i={};if(typeof e=="function"){let s={[n]:e};for(let a of o)i[a]=s}else for(let s of o){if(e[s]===void 0)continue;let a={[n]:e[s]};if(typeof a[n]!="function")return te(Ic(a));i[s]=a}return i};var Oc=(e,t)=>{let r=we(e[0],t),n=t.type.scope.resolveNode(r),o=Hr(n),i=o?n.node:n,s=Dt(r,Sc(e[2],i,t,"narrow"),t.type);return o?{config:n.config,node:s}:s};var _c=(e,t)=>{if(bb(e))return Tc[e[1]](e,t);if(vb(e))return Nc[e[0]](e,t);let r={length:["!",{number:{value:e.length}}]};for(let n=0;n<e.length;n++)t.path.push(`${n}`),r[n]=we(e[n],t),t.path.pop();return{object:{class:Array,props:r}}},Dc=(e,t)=>{if(e[2]===void 0)return te(Cs(e[1],""));let r=we(e[0],t),n=we(e[2],t);return e[1]==="&"?Dt(r,n,t.type):yo(r,n,t.type)},yb=(e,t)=>fr(we(e[0],t));var bb=e=>Tc[e[1]]!==void 0,Tc={"|":Dc,"&":Dc,"[]":yb,"=>":Oc,"|>":Ec,":":As},Nc={keyof:vc,instanceof:e=>typeof e[1]!="function"?te(`Expected a constructor following \'instanceof\' operator (was ${typeof e[1]}).`):{object:{class:e[1]}},"===":e=>({[pe(e[1])]:{value:e[1]}}),node:e=>e[1]},vb=e=>Nc[e[0]]!==void 0;u();var Cc=(e,t)=>{let r={};for(let n in e){let o=n,i=!1;n[n.length-1]==="?"&&(n[n.length-2]===ue.escapeToken?o=`${n.slice(0,-2)}?`:(o=n.slice(0,-1),i=!0)),t.path.push(o);let s=we(e[n],t);t.path.pop(),r[o]=i?["?",s]:s}return{object:{props:r}}};u();u();u();var Ac=e=>`Unmatched )${e===""?"":` before ${e}`}`,Rc="Missing )",Fc=(e,t)=>`Left bounds are only valid when paired with right bounds (try ...${t}${e})`,Eo=e=>`Left-bounded expressions must specify their limits using < or <= (was ${e})`,$c=(e,t,r,n)=>`An expression may have at most one left bound (parsed ${e}${ue.invertedComparators[t]}, ${r}${ue.invertedComparators[n]})`;function Yr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Io=class{error(t){return te(t)}hasRoot(){return this.root!==void 0}resolveRoot(){return this.assertHasRoot(),this.ctx.type.scope.resolveTypeNode(this.root)}rootToString(){return this.assertHasRoot(),ae(this.root)}ejectRootIfLimit(){this.assertHasRoot();let t=typeof this.root=="string"?this.ctx.type.scope.resolveNode(this.root):this.root;if(mo(t,"number")){let r=t.number.value;return this.root=void 0,r}}ejectRangeIfOpen(){if(this.branches.range){let t=this.branches.range;return delete this.branches.range,t}}assertHasRoot(){if(this.root===void 0)return oe("Unexpected interaction with unset root")}assertUnsetRoot(){if(this.root!==void 0)return oe("Unexpected attempt to overwrite root")}setRoot(t){this.assertUnsetRoot(),this.root=t}rootToArray(){this.root=fr(this.ejectRoot())}intersect(t){this.root=Dt(this.ejectRoot(),t,this.ctx.type)}ejectRoot(){this.assertHasRoot();let t=this.root;return this.root=void 0,t}ejectFinalizedRoot(){this.assertHasRoot();let t=this.root;return this.root=wb,t}finalize(){if(this.groups.length)return this.error(Rc);this.finalizeBranches(),this.scanner.finalized=!0}reduceLeftBound(t,r){let n=ue.invertedComparators[r];if(!je(n,go))return this.error(Eo(r));if(this.branches.range)return this.error($c(`${this.branches.range.limit}`,this.branches.range.comparator,`${t}`,n));this.branches.range={limit:t,comparator:n}}finalizeBranches(){this.assertRangeUnset(),this.branches.union?(this.pushRootToBranch("|"),this.setRoot(this.branches.union)):this.branches.intersection&&this.setRoot(Dt(this.branches.intersection,this.ejectRoot(),this.ctx.type))}finalizeGroup(){this.finalizeBranches();let t=this.groups.pop();if(!t)return this.error(Ac(this.scanner.unscanned));this.branches=t}pushRootToBranch(t){this.assertRangeUnset(),this.branches.intersection=this.branches.intersection?Dt(this.branches.intersection,this.ejectRoot(),this.ctx.type):this.ejectRoot(),t==="|"&&(this.branches.union=this.branches.union?yo(this.branches.union,this.branches.intersection,this.ctx.type):this.branches.intersection,delete this.branches.intersection)}assertRangeUnset(){if(this.branches.range)return this.error(Fc(`${this.branches.range.limit}`,this.branches.range.comparator))}reduceGroupOpen(){this.groups.push(this.branches),this.branches={}}previousOperator(){return this.branches.range?.comparator??this.branches.intersection?"&":this.branches.union?"|":void 0}shiftedByOne(){return this.scanner.shift(),this}constructor(t,r){Yr(this,"ctx",void 0),Yr(this,"scanner",void 0),Yr(this,"root",void 0),Yr(this,"branches",void 0),Yr(this,"groups",void 0),this.ctx=r,this.branches={},this.groups=[],this.scanner=new ue(t)}},wb=new Proxy({},{get:()=>oe("Unexpected attempt to access ejected attributes")});u();u();var Pc=(e,t)=>{let r=e.scanner.shiftUntil(xb[t]);if(e.scanner.lookahead==="")return e.error(Ib(r,t));e.scanner.shift()==="/"?(ps(r),e.setRoot({string:{regex:r}})):e.setRoot({string:{value:r}})},kc={"\'":1,\'"\':1,"/":1},xb={"\'":e=>e.lookahead==="\'",\'"\':e=>e.lookahead===\'"\',"/":e=>e.lookahead==="/"},Eb={\'"\':"double-quote","\'":"single-quote","/":"forward slash"},Ib=(e,t)=>`${t}${e} requires a closing ${Eb[t]}`;var So=e=>e.scanner.lookahead===""?e.error(Ns(e)):e.scanner.lookahead==="("?e.shiftedByOne().reduceGroupOpen():e.scanner.lookaheadIsIn(kc)?Pc(e,e.scanner.shift()):e.scanner.lookahead===" "?So(e.shiftedByOne()):bc(e);u();u();u();var Mc=e=>`Bounded expression ${e} must be a number, string or array`;var qc=(e,t)=>{let r=Sb(e,t),n=e.ejectRootIfLimit();return n===void 0?Db(e,r):e.reduceLeftBound(n,r)},Sb=(e,t)=>e.scanner.lookaheadIs("=")?`${t}${e.scanner.shift()}`:je(t,ue.oneCharComparators)?t:e.error(Ob),Ob="= is not a valid comparator. Use == to check for equality",Db=(e,t)=>{let r=e.scanner.shiftUntilNextTerminator(),n=jr(r,Nb(t,r+e.scanner.unscanned)),o=e.ejectRangeIfOpen(),i={comparator:t,limit:n},s=o?Rs(i,ls)?cr("min",o,i)==="l"?e.error(Cb({min:o,max:i})):{min:o,max:i}:e.error(Eo(t)):Tb(i,"==")?i:Rs(i,go)?{min:i}:Rs(i,ls)?{max:i}:oe(`Unexpected comparator \'${i.comparator}\'`);e.intersect(_b(s,e))},_b=(e,t)=>{let r=t.resolveRoot(),n=ie(r),o={},i={range:e};return n.every(a=>{switch(a){case"string":return o.string=i,!0;case"number":return o.number=i,!0;case"object":return o.object=i,r.object===!0?!1:rt(r.object).every(c=>"class"in c&&c.class===Array);default:return!1}})||t.error(Mc(t.rootToString())),o},Tb=(e,t)=>e.comparator===t,Rs=(e,t)=>e.comparator in t,Nb=(e,t)=>`Comparator ${e} must be followed by a number literal (was \'${t}\')`,Cb=e=>`${io(e)} is empty`;u();u();var jc=e=>`Divisibility operand ${e} must be a number`;var Bc=e=>{let t=e.scanner.shiftUntilNextTerminator(),r=to(t,Lc(t));r===0&&e.error(Lc(0));let n=ie(e.resolveRoot());n.length===1&&n[0]==="number"?e.intersect({number:{divisor:r}}):e.error(jc(e.rootToString()))},Lc=e=>`% operator must be followed by a non-zero integer literal (was ${e})`;var Fs=e=>{let t=e.scanner.shift();return t===""?e.finalize():t==="["?e.scanner.shift()==="]"?e.rootToArray():e.error(Rb):je(t,ue.branchTokens)?e.pushRootToBranch(t):t===")"?e.finalizeGroup():je(t,ue.comparatorStartChars)?qc(e,t):t==="%"?Bc(e):t===" "?Fs(e):oe(Ab(t))},Ab=e=>`Unexpected character \'${e}\'`,Rb="Missing expected \']\'";var Uc=(e,t)=>t.type.scope.parseCache.get(e)??t.type.scope.parseCache.set(e,Fb(e,t)??$b(e,t)),Fb=(e,t)=>{if(t.type.scope.addParsedReferenceIfResolvable(e,t))return e;if(e.endsWith("[]")){let r=e.slice(0,-2);if(t.type.scope.addParsedReferenceIfResolvable(e,t))return fr(r)}},$b=(e,t)=>{let r=new Io(e,t);return So(r),Pb(r)},Pb=e=>{for(;!e.scanner.finalized;)kb(e);return e.ejectFinalizedRoot()},kb=e=>e.hasRoot()?Fs(e):So(e);var we=(e,t)=>{let r=pe(e);if(r==="string")return Uc(e,t);if(r!=="object")return te($s(r));let n=ur(e);switch(n){case"Object":return Cc(e,t);case"Array":return _c(e,t);case"RegExp":return{string:{regex:e.source}};case"Function":if(Ts(e))return t.type.scope.addAnonymousTypeReference(e,t);if(Mb(e)){let o=e();if(Ts(o))return t.type.scope.addAnonymousTypeReference(o,t)}return te($s("Function"));default:return te($s(n??ae(e)))}},q1=Symbol("as"),Mb=e=>typeof e=="function"&&e.length===0,$s=e=>`Type definitions must be strings or objects (was ${e})`;u();function qb(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var mr=class{get root(){return this.cache}has(t){return t in this.cache}get(t){return this.cache[t]}set(t,r){return this.cache[t]=r,r}constructor(){qb(this,"cache",{})}},Oo=class extends mr{set(t,r){return this.cache[t]=Ue(r),r}};function Vc(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function jb(e,t){return t.get?t.get.call(e):t.value}function Lb(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}function Hc(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function ht(e,t){var r=Hc(e,t,"get");return jb(e,r)}function zc(e,t,r){Vc(e,t),t.set(e,r)}function Wc(e,t,r){var n=Hc(e,t,"set");return Lb(e,n,r),r}function dt(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}function Do(e,t){Vc(e,t),t.add(e)}function Ae(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Bb=e=>({codes:pc(e.codes),keys:e.keys??"loose"}),Ub=0,Kc={},Ps={};var Lt=new WeakMap,dr=new WeakMap,Gc=new WeakSet,_o=new WeakSet,Ms=new WeakSet,To=new WeakSet,qs=class{getAnonymousQualifiedName(t){let r=0,n=t;for(;this.isResolvable(n);)n=`${t}${r++}`;return`${this.name}.${n}`}addAnonymousTypeReference(t,r){var n;return(n=r.type).includesMorph||(n.includesMorph=t.includesMorph),t.node}get infer(){return _t}compile(){if(!Ps[this.name]){for(let t in this.aliases)this.resolve(t);Ps[this.name]=ht(this,dr).root}return ht(this,dr).root}addParsedReferenceIfResolvable(t,r){var n;let o=dt(this,To,js).call(this,t,"undefined",[t]);return o?((n=r.type).includesMorph||(n.includesMorph=o.includesMorph),!0):!1}resolve(t){return dt(this,To,js).call(this,t,"throw",[t])}resolveNode(t){return typeof t=="string"?this.resolveNode(this.resolve(t).node):t}resolveTypeNode(t){let r=this.resolveNode(t);return Hr(r)?r.node:r}isResolvable(t){return ht(this,Lt).has(t)||this.aliases[t]}constructor(t,r={}){Do(this,Gc),Do(this,_o),Do(this,Ms),Do(this,To),Ae(this,"aliases",void 0),Ae(this,"name",void 0),Ae(this,"config",void 0),Ae(this,"parseCache",void 0),zc(this,Lt,{writable:!0,value:void 0}),zc(this,dr,{writable:!0,value:void 0}),Ae(this,"expressions",void 0),Ae(this,"intersection",void 0),Ae(this,"union",void 0),Ae(this,"arrayOf",void 0),Ae(this,"keyOf",void 0),Ae(this,"valueOf",void 0),Ae(this,"instanceOf",void 0),Ae(this,"narrow",void 0),Ae(this,"morph",void 0),Ae(this,"type",void 0),this.aliases=t,this.parseCache=new Oo,Wc(this,Lt,new mr),Wc(this,dr,new mr),this.expressions={intersection:(n,o,i)=>this.type([n,"&",o],i),union:(n,o,i)=>this.type([n,"|",o],i),arrayOf:(n,o)=>this.type([n,"[]"],o),keyOf:(n,o)=>this.type(["keyof",n],o),node:(n,o)=>this.type(["node",n],o),instanceOf:(n,o)=>this.type(["instanceof",n],o),valueOf:(n,o)=>this.type(["===",n],o),narrow:(n,o,i)=>this.type([n,"=>",o],i),morph:(n,o,i)=>this.type([n,"|>",o],i)},this.intersection=this.expressions.intersection,this.union=this.expressions.union,this.arrayOf=this.expressions.arrayOf,this.keyOf=this.expressions.keyOf,this.valueOf=this.expressions.valueOf,this.instanceOf=this.expressions.instanceOf,this.narrow=this.expressions.narrow,this.morph=this.expressions.morph,this.type=Object.assign((n,o={})=>{let i=_s("\\u03BBtype",n,o,this),s=dt(this,Ms,Jc).call(this,i),a=we(n,s);return i.node=Ue(kr(o)?{config:o,node:this.resolveTypeNode(a)}:a),i.flat=Ue(vs(i)),i},{from:this.expressions.node}),this.name=dt(this,Gc,zb).call(this,r),r.standard!==!1&&dt(this,_o,ks).call(this,[Ps.standard],"imports"),r.imports&&dt(this,_o,ks).call(this,r.imports,"imports"),r.includes&&dt(this,_o,ks).call(this,r.includes,"includes"),this.config=Bb(r)}};function zb(e){let t=e.name?Kc[e.name]?te(`A scope named \'${e.name}\' already exists`):e.name:`scope${++Ub}`;return Kc[t]=this,t}function ks(e,t){for(let r of e)for(let n in r)(ht(this,Lt).has(n)||n in this.aliases)&&te(Kb(n)),ht(this,Lt).set(n,r[n]),t==="includes"&&ht(this,dr).set(n,r[n])}function Jc(e){return{type:e,path:new be}}function js(e,t,r){let n=ht(this,Lt).get(e);if(n)return n;let o=this.aliases[e];if(!o)return t==="throw"?oe(`Unexpectedly failed to resolve alias \'${e}\'`):void 0;let i=_s(e,o,{},this),s=dt(this,Ms,Jc).call(this,i);ht(this,Lt).set(e,i),ht(this,dr).set(e,i);let a=we(o,s);if(typeof a=="string"){if(r.includes(a))return te(Wb(e,r));r.push(a),a=dt(this,To,js).call(this,a,"throw",r).node}return i.node=Ue(a),i.flat=Ue(vs(i)),i}var ze=(e,t={})=>new qs(e,t),Ls=ze({},{name:"root",standard:!1}),Xe=Ls.type,Wb=(e,t)=>`Alias \'${e}\' has a shallow resolution cycle: ${[...t,e].join("=>")}`,Kb=e=>`Alias \'${e}\' is already defined`;u();u();var No=ze({Function:["node",{object:{class:Function}}],Date:["node",{object:{class:Date}}],Error:["node",{object:{class:Error}}],Map:["node",{object:{class:Map}}],RegExp:["node",{object:{class:RegExp}}],Set:["node",{object:{class:Set}}],WeakMap:["node",{object:{class:WeakMap}}],WeakSet:["node",{object:{class:WeakSet}}],Promise:["node",{object:{class:Promise}}]},{name:"jsObjects",standard:!1}),Yc=No.compile();u();var Zc={bigint:!0,boolean:!0,null:!0,number:!0,object:!0,string:!0,symbol:!0,undefined:!0},Co=ze({any:["node",Zc],bigint:["node",{bigint:!0}],boolean:["node",{boolean:!0}],false:["node",{boolean:{value:!1}}],never:["node",{}],null:["node",{null:!0}],number:["node",{number:!0}],object:["node",{object:!0}],string:["node",{string:!0}],symbol:["node",{symbol:!0}],true:["node",{boolean:{value:!0}}],unknown:["node",Zc],void:["node",{undefined:!0}],undefined:["node",{undefined:!0}]},{name:"ts",standard:!1}),Bt=Co.compile();u();u();var Gb=e=>{let t=e.replace(/[- ]+/g,""),r=0,n,o,i;for(let s=t.length-1;s>=0;s--)n=t.substring(s,s+1),o=parseInt(n,10),i?(o*=2,o>=10?r+=o%10+1:r+=o):r+=o,i=!i;return!!(r%10===0&&t)},Vb=/^(?:4[0-9]{12}(?:[0-9]{3,6})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12,15}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\d{3})\\d{11}|6[27][0-9]{14}|^(81[0-9]{14,17}))$/,Qc=Xe([Vb,"=>",(e,t)=>Gb(e)||!t.mustBe("a valid credit card number")],{mustBe:"a valid credit card number"});u();var Hb=/^[./-]$/,Jb=/^([+-]?\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6])))([T]((([01]\\d|2[0-3])((:?)[0-5]\\d)?|24:?00)([.,]\\d+(?!:))?)?(\\17[0-5]\\d([.,]\\d+)?)?([zZ]|([+-])([01]\\d|2[0-3]):?([0-5]\\d)?)?)?)?$/,Yb=e=>!isNaN(e),Ao=e=>`a ${e}-formatted date`,Zb=(e,t)=>{if(!t?.format){let a=new Date(e);return Yb(a)?a:"a valid date"}if(t.format==="iso8601")return Jb.test(e)?new Date(e):Ao("iso8601");let r=e.split(Hb),n=e[r[0].length],o=n?t.format.split(n):[t.format];if(r.length!==o.length)return Ao(t.format);let i={};for(let a=0;a<o.length;a++){if(r[a].length!==o[a].length&&!(o[a].length===1&&r[a].length===2))return Ao(t.format);i[o[a][0]]=r[a]}let s=new Date(`${i.m}/${i.d}/${i.y}`);return`${s.getDate()}`===i.d?s:Ao(t.format)},Xc=Xe([Bt.string,"|>",(e,t)=>{let r=Zb(e);return typeof r=="string"?t.mustBe(r):r}]);var Qb=Xe([ns,"|>",e=>parseFloat(e)],{mustBe:"a well-formed numeric string"}),Xb=Xe([Bt.string,"|>",(e,t)=>{if(!Mr(e))return t.mustBe("a well-formed integer string");let r=parseInt(e);return Number.isSafeInteger(r)?r:t.mustBe("an integer in the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER")}]),ev=Xe(/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$/,{mustBe:"a valid email"}),tv=Xe(/^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$/,{mustBe:"a valid UUID"}),rv=Xe(/^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$/,{mustBe:"a valid semantic version (see https://semver.org/)"}),nv=Xe([Bt.string,"|>",e=>JSON.parse(e)],{mustBe:"a JSON-parsable string"}),Ro=ze({alpha:[/^[A-Za-z]*$/,":",{mustBe:"only letters"}],alphanumeric:[/^[A-Za-z\\d]*$/,":",{mustBe:"only letters and digits"}],lowercase:[/^[a-z]*$/,":",{mustBe:"only lowercase letters"}],uppercase:[/^[A-Z]*$/,":",{mustBe:"only uppercase letters"}],creditCard:Qc,email:ev,uuid:tv,parsedNumber:Qb,parsedInteger:Xb,parsedDate:Xc,semver:rv,json:nv,integer:["node",{number:{divisor:1}}]},{name:"validation",standard:!1}),el=Ro.compile();var Fo=ze({},{name:"standard",includes:[Bt,Yc,el],standard:!1}),ov=Fo.compile(),gt={root:Ls,tsKeywords:Co,jsObjects:No,validation:Ro,ark:Fo};var iv=Fo.type;u();var sv=gt.ark.intersection,av=gt.ark.union,uv=gt.ark.arrayOf,cv=gt.ark.keyOf,lv=gt.ark.instanceOf,fv=gt.ark.valueOf,pv=gt.ark.narrow,mv=gt.ark.morph;var{DataRequest:tl,DataResponse:UT}=ze({DataRequest:{id:"number",method:"string",params:"any[]"},DataResponse:{id:"number","eventName?":"string",payload:"any",error:"any"}}).compile(),rl="__METHODS__",nl="__EVAL__";var dv=typeof parent<"u"&&typeof window<"u"&&window!==parent?parent.postMessage:postMessage,Zr=class{methods;constructor(t){if(!(typeof self<"u"&&typeof postMessage=="function"&&typeof addEventListener=="function"))throw new Error("Script must be executed as a worker");this.methods={...t,[rl]:()=>Object.keys(t),[nl]:(r,...n)=>new Function(`return (${r})`)()(...n)},addEventListener("message",r=>this.onMessage(r.data)),this.send("ready")}send(t,r){dv(t,r)}async onMessage(t){let{data:r,problems:n}=tl(t);if(n)return this.send({id:-1,payload:null,error:n.toString()});try{let o=this.methods[r.method];if(!o)throw new Error(\'Unknown method "\'+r.method+\'"\');let i=await o.apply(o,r.params);this.send({id:r.id,payload:i,error:null})}catch(o){console.error(o),this.send({id:r.id,payload:null,error:hv(o)})}}emit(t,r){this.send({eventName:t,payload:r,id:-1,error:null})}};function hv(e){return Object.getOwnPropertyNames(e).reduce((t,r)=>Object.defineProperty(t,r,{value:e[r],enumerable:!0}),{})}u();u();var ol=e=>`obsidian-zotero:${e}`;u();var zs=({key:e,groupID:t,parentItem:r},n=!1)=>{let o=[e];return!n&&r&&o.push(`a${r}`),typeof t=="number"&&o.push(`g${t}`),o.join("")},il=(e,t,r=!0)=>(n,...o)=>{let i="";for(let s=0;s<n.length;s++)s>0&&(i+=e(o[s-1])),i+=(r?n.raw:n)[s];return t(i)},Ws=(e=!0,t)=>il(r=>r,r=>new RegExp(e?"^"+r+"$":r,t),!0),Bs=String.raw`[23456789ABCDEFGHIJKLMNPQRSTUVWXYZ]{8}`,Us=String.raw`\\d+`,sl=e=>{let t={annotKey:Bs,parentKey:Bs,groupID:Us,page:Us};if(e)for(let r in t)t[r]=`(${t[r]})`;return il(r=>t[r],r=>r)`${"annotKey"}a${"parentKey"}(?:g${"groupID"})?(?:p${"page"})?`},JT=Ws()`${Bs}(?:g${Us})?`,YT=Ws()`${sl(!0)}`,ZT=Ws()`(?:${sl(!1)}n?)+`;u();var yv=/^[0-9]{4}\\-(0[0-9]|10|11|12)\\-(0[0-9]|[1-2][0-9]|30|31) /;var bv=/^\\-?[0-9]{4}\\-(0[1-9]|10|11|12)\\-(0[1-9]|[1-2][0-9]|30|31) ([0-1][0-9]|[2][0-3]):([0-5][0-9]):([0-5][0-9])$/,vv=/^\\-?[0-9]{4}\\-(0[1-9]|10|11|12)\\-(0[1-9]|[1-2][0-9]|30|31) ([0-1][0-9]|[2][0-3]):([0-5][0-9])$/,wv=e=>xv(e)||Ev(e)?!1:yv.test(e),al=e=>e?wv(e)?e.substring(0,10):"0000-00-00":"";var xv=e=>bv.test(e),Ev=e=>vv.test(e);u();var ul=(e,t,{getLogger:r,configure:n})=>{let o=ol(e);return n({appenders:{out:{type:"console"}},categories:{default:{appenders:["out"],level:t},[o]:{appenders:["out"],level:t}}}),r(o)};u();var cl=()=>(...e)=>e;u();u();function ll(e,t){let r=Object.keys(t).map(n=>Iv(e,n,t[n]));return r.length===1?r[0]:function(){r.forEach(n=>n())}}function Iv(e,t,r){let n=e[t],o=e.hasOwnProperty(t),i=r(n);return n&&Object.setPrototypeOf(i,n),Object.setPrototypeOf(s,i),e[t]=s,a;function s(...c){return i===n&&e[t]===s&&a(),i.apply(this,c)}function a(){e[t]===s&&(o?e[t]=n:delete e[t]),i!==n&&(i=n,Object.setPrototypeOf(s,n||Function))}}var fl=e=>{let t=r=>async(...n)=>{try{return await r(...n)}catch(o){throw console.error(o),o}};return ll(e,Object.fromEntries(Object.keys(e).map(r=>[r,t]))),e};u();u();u();u();u();u();u();u();var pl;(function(e){e[e.highlight=1]="highlight",e[e.note=2]="note",e[e.image=3]="image",e[e.ink=4]="ink",e[e.underline=5]="underline",e[e.text=6]="text"})(pl||(pl={}));var ml;(function(e){e[e.manual=0]="manual",e[e.auto=1]="auto"})(ml||(ml={}));var dl;(function(e){e[e.importedFile=0]="importedFile",e[e.importedUrl=1]="importedUrl",e[e.linkedFile=2]="linkedFile",e[e.linkedUrl=3]="linkedUrl",e[e.embeddedImage=4]="embeddedImage"})(dl||(dl={}));var Ks;(function(e){e[e.fullName=0]="fullName",e[e.nameOnly=1]="nameOnly"})(Ks||(Ks={}));u();var Gs=["attachment","note","annotation"];u();u();var $o=Gs.map(e=>`\'${e}\'`).join(",");var xe=(e="itemID")=>`--sql\n ${e} IS NOT NULL\n ${e==="itemID"?`AND ${e} NOT IN (SELECT itemID FROM deletedItems)`:""}\n`,We=(e,t="$itemId")=>typeof e=="boolean"?"":`AND ${e} = ${t}`;u();var ee=class{statement;constructor(t){this.statement=t.prepare(this.sql())}get database(){return this.statement.database}get(t){return this.statement.get(t)}all(t){return this.statement.all(t)}},hr=class extends ee{query(t){return this.all(t)}},Po=class extends ee{query(){return this.all([])}},gr=class extends ee{query(t){return this.all(t).map(r=>this.parse(r,t))}};u();u();var Vs=(e,t)=>{for(let r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]-t[r];return 0};var Hs=e=>e?.split("|").map(t=>parseInt(t,10))??[];var ko=`--sql\n items.itemID,\n items.key,\n items.clientDateModified,\n items.dateAdded,\n items.dateModified,\n annots.type,\n annots.authorName,\n annots.text,\n annots.comment,\n annots.color,\n annots.pageLabel,\n annots.sortIndex,\n annots.position,\n annots.isExternal\n`,Mo=`--sql\n itemAnnotations annots\n JOIN items USING (itemID)\n`,qo=(e,t,r)=>Object.assign(e,{sortIndex:Hs(e.sortIndex),position:JSON.parse(e.position),libraryID:t,groupID:r,itemType:"annotation"});var Sv=`--sql\nSELECT\n ${ko},\n annots.parentItemID,\n parentItems.key as parentItem\nFROM\n ${Mo}\n JOIN items as parentItems ON annots.parentItemID = parentItems.itemID\nWHERE\n items.key = $annotKey\n AND items.libraryID = $libId\n AND ${xe("items.itemID")}\n`,Qr=class extends ee{trxCache={};sql(){return Sv}parse(t,r){return qo(t,r.libId,r.groupID)}query(t){let{annotKeys:r,libId:n}=t,o=s=>s.reduce((a,c)=>{let m=this.get({annotKey:c,libId:n});return m&&(a[c]=this.parse(m,t)),a},{});return(this.trxCache[n]??=this.database.transaction(o))(r)}};u();var Ov=`--sql\nSELECT\n ${ko}\nFROM\n ${Mo}\nWHERE\n parentItemID = $attachmentId\n AND items.libraryID = $libId\n AND ${xe()}\n`,Xr=class extends gr{sql(){return Ov}getKeyStatement=this.database.prepare("SELECT key FROM items WHERE itemID = $attachmentId AND libraryID = $libId");parse(t,r,n){return Object.assign(qo(t,r.libId,r.groupID),{parentItem:n,parentItemID:r.attachmentId})}query(t){let r=this.getKeyStatement.get(t)?.key;if(r===void 0)throw new Error("Parent item not found");return this.all(t).map(n=>this.parse(n,t,r)).sort((n,o)=>Vs(n.sortIndex,o.sortIndex))}};u();u();var jo=`--sql\n items.itemID,\n items.key,\n items.clientDateModified,\n items.dateAdded,\n items.dateModified,\n notes.note,\n notes.title\n`,Lo=`--sql\n itemNotes notes\n JOIN items USING (itemID)\n`,Bo=(e,t,r)=>Object.assign(e,{libraryID:t,groupID:r,itemType:"note"});var Dv=`--sql\nSELECT\n ${jo},\n notes.parentItemID,\n parentItems.key as parentItem\nFROM\n ${Lo}\n JOIN items as parentItems ON notes.parentItemID = parentItems.itemID\nWHERE\n items.key = $noteKey\n AND items.libraryID = $libId\n AND ${xe("items.itemID")}\n`,en=class extends ee{trxCache={};sql(){return Dv}parse(t,r){return Bo(t,r.libId,r.groupID)}query(t){let{noteKeys:r,libId:n}=t,o=s=>s.reduce((a,c)=>{let m=this.get({noteKey:c,libId:n});return m&&(a[c]=this.parse(m,t)),a},{});return(this.trxCache[n]??=this.database.transaction(o))(r)}};u();var _v=`--sql\nSELECT\n ${jo}\nFROM\n ${Lo}\nWHERE\n parentItemID = $itemID\n AND items.libraryID = $libId\n AND ${xe()}\n`,tn=class extends gr{sql(){return _v}getKeyStatement=this.database.prepare("SELECT key FROM items WHERE itemID = $itemID AND libraryID = $libId");parse(t,r,n){return Object.assign(Bo(t,r.libId,r.groupID),{parentItem:n,parentItemID:r.itemID})}query(t){let r=this.getKeyStatement.get(t)?.key;if(r===void 0)throw new Error("Parent item not found");return this.all(t).map(n=>this.parse(n,t,r))}};u();var Tv=`--sql\nSELECT\n atchs.itemID,\n atchs.path,\n atchs.contentType,\n atchs.linkMode,\n charsets.charset,\n items.key,\n COUNT(atchs.itemID) as annotCount\nFROM\n itemAttachments atchs\n JOIN items USING (itemID)\n LEFT JOIN charsets USING (charsetID)\n LEFT JOIN itemAnnotations annots ON atchs.itemID = annots.parentItemID\nWHERE\n atchs.parentItemID = $itemId\n AND libraryID = $libId\n AND ${xe("atchs.itemID")}\nGROUP BY atchs.itemID\n`,rn=class extends hr{sql(){return Tv}};u();u();var Uo="betterbibtex",Ut="bbts";var Nv=`--sql\nSELECT\n itemDataValues.value AS citekey\nFROM\n itemData\n JOIN itemDataValues USING (valueID)\nWHERE\n itemData.itemID = $itemID\n AND itemData.fieldID = (\n SELECT\n fieldID\n FROM\n fieldsCombined\n WHERE\n fieldName = \'citationKey\'\n LIMIT\n 1\n )\n`,Cv=`--sql\nSELECT\n citekey\nFROM\n ${Ut}.citekeys\nWHERE\n itemID = $itemID\n AND (libraryID IS NULL OR libraryID = $libId)\n`,nn=class extends ee{trxFunc=t=>t.reduce((r,[n,o])=>{let i=this.get({itemID:n,libId:o});return i&&(r[n]=i.citekey),r},{});trx=this.database.transaction(this.trxFunc);sql(){return Nv}query(t){return this.trx(t.items)}},on=class extends ee{trxFunc=t=>t.reduce((r,[n,o])=>{let i=this.get({itemID:n,libId:o});return i&&(r[n]=i.citekey),r},{});trx=this.database.transaction(this.trxFunc);sql(){return Cv}query(t){return this.trx(t.items)}};u();var Av=`--sql\nSELECT\n itemData.itemID AS itemID\nFROM\n itemData\n JOIN itemDataValues USING (valueID)\nWHERE\n itemData.fieldID = (\n SELECT\n fieldID\n FROM\n fieldsCombined\n WHERE\n fieldName = \'citationKey\'\n LIMIT\n 1\n )\n AND itemDataValues.value = $citekey\n`,Rv=`--sql\nSELECT\n itemID\nFROM\n ${Ut}.citekeys\nWHERE\n citekey = $citekey\n`,sn=class extends ee{trxFunc=t=>t.reduce((r,n)=>{let o=this.get({citekey:n});return r[n]=o?.itemID??-1,r},{});trx=this.database.transaction(this.trxFunc);sql(){return Av}query(t){return this.trx(t.citekeys)}},an=class extends ee{trxFunc=t=>t.reduce((r,n)=>{let o=this.get({citekey:n});return r[n]=o?.itemID??-1,r},{});trx=this.database.transaction(this.trxFunc);sql(){return Rv}query(t){return this.trx(t.citekeys)}};u();u();var zo=e=>`--sql\nSELECT\n itemID,\n creators.firstName,\n creators.lastName,\n creators.fieldMode,\n creatorTypes.creatorType,\n orderIndex\nFROM\n items\n LEFT JOIN itemCreators USING (itemID)\n JOIN creators USING (creatorID)\n JOIN creatorTypes USING (creatorTypeID)\nWHERE\n libraryID = $libId\n ${We(e||"itemID")}\n AND ${xe()}\nORDER BY\n itemID,\n orderIndex\n`;var FC=zo(!0);u();u();u();u();function hl(e){for(var t={},r=e.length,n=0;n<r;++n){var o=e[n];t[o[0]]=o[1]}return t}var zt=hl;var Fv=zo(!1),un=class extends ee{trxFunc=t=>t.map(([r,n])=>[r,this.all({itemId:r,libId:n})]);trx=this.database.transaction(this.trxFunc);sql(){return Fv}query(t){return zt(this.trx(t))}};u();u();var Wo=e=>`--sql\nSELECT\n items.itemID,\n fieldsCombined.fieldName,\n itemDataValues.value\nFROM\n items\n JOIN itemData USING (itemID)\n JOIN itemDataValues USING (valueID)\n JOIN fieldsCombined USING (fieldID)\n JOIN itemTypesCombined USING (itemTypeID)\nWHERE\n libraryID = $libId\n ${We(e||"items.itemID")}\n AND itemTypesCombined.typeName NOT IN (${$o})\n AND ${xe()}\n`;var _A=Wo(!0);u();var $v=Wo(!1),cn=class extends ee{trxFunc=t=>t.map(([r,n])=>[r,this.all({itemId:r,libId:n})]);trx=this.database.transaction(this.trxFunc);sql(){return $v}query(t){return zt(this.trx(t))}};u();u();var ln=e=>`--sql\nSELECT\n items.libraryID,\n items.itemID,\n items.key,\n items.clientDateModified,\n items.dateAdded,\n items.dateModified,\n itemTypesCombined.typeName as itemType,\n json_group_array(collectionID) filter (where collectionID is not null) as collectionIDs\nFROM \n items\n JOIN itemTypesCombined USING (itemTypeID)\n LEFT JOIN collectionItems USING (itemID)\nWHERE \n libraryID = $libId\n ${e==="full"?We(!1):e==="id"?We("items.itemID"):We("items.key","$key")}\n AND ${xe()}\n AND itemType NOT IN (${$o})\nGROUP BY itemID\n`;var Pv=ln("full"),fn=class extends ee{sql(){return Pv}query(t){return this.all(t).map(({collectionIDs:n,...o})=>({...o,collectionIDs:JSON.parse(n)}))}};u();var kv=ln("id"),Mv=ln("key"),pn=class extends ee{trxFunc=t=>t.reduce((r,[n,o])=>{let i=this.get({itemId:n,libId:o});return i&&(r[n]={...i,collectionIDs:JSON.parse(i.collectionIDs)}),r},{});trx=this.database.transaction(this.trxFunc);sql(){return kv}query(t){return this.trx(t)}},mn=class extends ee{trxFunc=t=>t.reduce((r,[n,o])=>{let i=this.get({key:n,libId:o});return i&&(r[n]={...i,collectionIDs:JSON.parse(i.collectionIDs)}),r},{});trx=this.database.transaction(this.trxFunc);sql(){return Mv}query(t){return this.trx(t)}};u();u();var dn=e=>`--sql\nWITH\n RECURSIVE CollectionPath AS (\n -- Base case: collections without a parent\n SELECT\n collectionID,\n parentCollectionID,\n collectionName AS path\n FROM\n collections\n WHERE\n libraryID = $libId\n ${e==="full"?We(!1):e==="id"?We("collectionID","$collectionID"):We("key","$key")}\n AND ${xe("collectionID")}\n UNION ALL\n -- Recursive case: join with parent collections\n SELECT\n prev.collectionID,\n c.parentCollectionID,\n c.collectionName\n FROM\n collections c\n JOIN CollectionPath prev ON c.collectionID = prev.parentCollectionID\n )\nSELECT\n p.collectionID,\n json_group_array(p.path) path,\n c.key,\n c.collectionName,\n c.libraryID\nFROM\n CollectionPath p\n JOIN collections c USING (collectionID)\nGROUP BY\n collectionID\nORDER BY\n collectionID;\n`;function Js({collectionID:e,collectionName:t,path:r,...n}){return{...n,id:e,name:t,path:JSON.parse(r)}}var ZA=dn("full");u();var qv=dn("id"),rR=dn("key"),hn=class extends ee{trxFunc=t=>t.reduce((r,[n,o])=>{let i=this.get({collectionID:n,libId:o});return i&&r.set(n,Js(i)),r},new Map);trx=this.database.transaction(this.trxFunc);sql(){return qv}query(t){return this.trx(t)}};u();var jv=`--sql\nSELECT\n libraries.libraryID,\n groups.groupID,\n CASE\n libraries.type\n WHEN \'user\' THEN \'My Library\'\n WHEN \'group\' THEN groups.name\n ELSE NULL\n END AS name\nFROM\n libraries\n LEFT JOIN groups USING (libraryID)\nWHERE\n libraries.libraryID IS NOT NULL\nORDER BY\n libraryID\n`,gn=class extends Po{sql(){return jv}};u();var Lv=`--sql\nSELECT\n tagID,\n type,\n name\nFROM\n itemTags\n JOIN items USING (itemID)\n JOIN tags USING (tagID)\nWHERE\n itemID = $itemId\n AND tagID IS NOT NULL\n AND libraryID = $libId\n`,yn=class extends ee{trxFunc=t=>t.map(([r,n])=>[r,this.all({itemId:r,libId:n})]);trx=this.database.transaction(this.trxFunc);sql(){return Lv}query(t){return zt(this.trx(t))}};u();u();u();var Bv=new Set(cl()("creators","itemID","itemType","key","libraryID","collections"));var tg=Pr(Zs(),1);u();u();u();var qd=Pr(Zs(),1),Ei=Pr(Md(),1),sI="INFO",jd=ul("db-worker",sI,Ei.default),La="log4js_loglevel";qd.default.getItem(La).then(e=>{typeof e=="string"&&e in Ei.levels&&(jd.level=e,console.debug(`Read from localforage: loglevel ${e}`))});var J=jd;u();var xh=require("fs"),Ga=Pr(vh(),1);var vt=class extends Error{constructor(){super("Database not set")}};globalThis.sqlite3=Ga.default;var wh=e=>{try{return(0,xh.statSync)(e).mtimeMs}catch(t){if(t.code==="ENOENT")return-1;throw t}},Bn=class{database=null;get instance(){return this.database?.instance}get databaseList(){return this.instance?.pragma("database_list")??[]}tableExists(t,r=""){if(!this.database)throw new vt;let n=r||"main",{exist:o}=(this.database.existStatements[n]??=this.database.instance.prepare(`SELECT count(*) AS exist FROM ${r?`${r}.`:""}sqlite_master WHERE type = \'table\' AND name = $tableName`)).get({tableName:t});return!!o}attachDatabase(t,r){if(!this.instance)throw new vt;this.instance.prepare(`ATTACH DATABASE $path AS ${r}`).run({path:t})}detachDatabase(t){if(!this.instance)throw new vt;this.instance.prepare(`DETACH DATABASE ${t}`).run()}isUpToDate(){if(!this.database)return null;let t=wh(this.database.file);return t===-1?null:this.database.mtime===t}opened=!1;open(t,r){let n=Ai(t);try{this.database?.instance&&(J.debug("Database opened before, closing: ",this.database.instance.name),this.close());let o=wh(t);return o===-1?(J.debug(`Database file not found, skipping open: ${n}`),this.opened=!1,!1):(J.debug(`Opening database: ${n}`),this.database={mtime:o,instance:PI(n,r),file:t,existStatements:{},prepared:new Map},J.debug(`Database opened: ${n}`),this.opened=!0,!0)}catch(o){throw J.error(`Failed to open database: ${n}`,o),o}}close(){this.opened=!1,this.instance?.close(),this.database=null}prepare(t){if(!this.database)throw new vt;let r=this.database.prepared.get(t);if(r)return r;let n=new t(this.database.instance);return this.database.prepared.set(t,n),n}},Ai=e=>`file:${e}?mode=ro&immutable=1`;function PI(e,t){return new Ga.default(e,{nativeBinding:t.nativeBinding,verbose:void 0})}function kI(e){return e.tableExists("citationkey",Uo)}function MI(e){let t=e.instance;return!t||!e.tableExists("fieldsCombined")||!e.tableExists("itemData")||!e.tableExists("itemDataValues")?!1:!!t.prepare("SELECT 1 AS exist FROM fieldsCombined WHERE fieldName = \'citationKey\' LIMIT 1").get()?.exist}var Un=class{#e=null;get instance(){return this.status==="READY"?this.#e:null}get zotero(){if(!this.#e)throw new Error("database not ready");return this.#e.zotero}status="NOT_INITIALIZED";get loadStatus(){return this.#e?.zotero.opened!==!0?{main:!1,bbtMain:!1,bbtSearch:null}:this.#e.citekeyBackend==="unavailable"?{main:!0,bbtMain:!1,bbtSearch:null}:this.#e.citekeyBackend==="v1"?{main:!0,bbtMain:!0,bbtSearch:null}:{main:!0,bbtMain:!0,bbtSearch:!0}}get bbtLoadStatus(){let t=this.loadStatus;return t.bbtMain?t.bbtSearch!==!1:!1}getItemIDsFromCitekey(t){if(!this.#e)throw new vt;let r=this.#e.citekeyBackend==="v0"?an:sn;return this.#e.zotero.prepare(r).query({citekeys:t})}getCitekeys(t){if(!this.#e)throw new vt;let r=this.#e.citekeyBackend==="v0"?on:nn;return this.#e.zotero.prepare(r).query({items:t})}load(t,r){let n={zotero:this.#e?.zotero??new Bn};try{let o=n.zotero.open(t.zotero,r);if(!o)throw new Error(`Failed to open main database, no database found at ${t.zotero}`);let i=qI(t,n.zotero),s=n.zotero.prepare(gn).query().reduce((a,c)=>(a[c.libraryID]=c,a),{});return this.#e={...n,citekeyBackend:i.bbtMain===!1?"unavailable":i.bbtSearch===!0?"v0":"v1",libraries:s},this.status="READY",{main:o,...i}}catch(o){throw this.status="ERROR",o}}groupOf(t){if(!this.#e)throw new Error("Library info not loaded");return this.#e.libraries[t].groupID}get libraries(){if(!this.#e)throw new Error("Library info not loaded");return Object.values(this.#e.libraries)}};function qI(e,t){let r=Ai(e.bbtMain),n=()=>MI(t)?(J.debug("Using native Zotero citationKey field"),{bbtMain:!0,bbtSearch:null}):null;try{J.debug(`Attaching bbt main database: ${r}`),t.attachDatabase(r,Uo),J.debug(`Attached bbt main database: ${r}`)}catch(s){let{code:a}=s;a==="SQLITE_CANTOPEN"?J.debug(`Unable to open bbt main database, no database found at ${r}`):J.debug(`Unable to open bbt main database, ${a} @ ${r}`);let c=n();return c||{bbtMain:!1,bbtSearch:null}}if(kI(t))return{bbtMain:!0,bbtSearch:null};let i=Ai(e.bbtSearch);try{J.debug(`Attaching bbt search database: ${i}`),t.attachDatabase(i,Ut),J.debug(`Attached bbt search database: ${i}`)}catch(s){let{code:a}=s;a==="SQLITE_CANTOPEN"?J.debug(`Unable to open bbt search database, no database found at ${i}`):J.debug(`Unable to open bbt search database, ${a} @ ${i}`);let c=n();return c||{bbtMain:!0,bbtSearch:!1}}return{bbtMain:!0,bbtSearch:!0}}u();var Sh=Pr(Ih(),1);var jI=e=>typeof e[0][0]=="string";function Oh(e){return[...new Set(e)]}var zn=class{#e=Fi;async get(t,r){if(t.length===0)return[];if(!r)return await Promise.all(t.map(([i,s])=>this.#t(i,s)));let n=jI(t)?this.#e.readItemByKey(t):this.#e.readItemById(t);return await this.#e.updateIndex(n),Object.values(n)}async#t(t,r){let n=await this.#e.getItemsCache(r);return typeof t=="number"?n.byId.get(t)??null:typeof t=="string"?n.byKey.get(t)??null:((0,Sh.assertNever)(t),null)}};u();u();u();u();u();function Wn(){this.cache=null,this.matcher=null,this.stemmer=null,this.filter=null}Wn.prototype.add;Wn.prototype.append;Wn.prototype.search;Wn.prototype.update;Wn.prototype.remove;u();u();u();function Nr(e,t){return typeof e<"u"?e:t}function Va(e){let t=new Array(e);for(let r=0;r<e;r++)t[r]=Y();return t}function Dh(e){return Object.keys(e)}function Y(){return Object.create(null)}function _h(e){return[].concat.apply([],e)}function Th(e,t){return t.length-e.length}function nr(e){return e.constructor===Array}function me(e){return typeof e=="string"}function Ze(e){return typeof e=="object"}function Kn(e){return typeof e=="function"}function Ch(e,t,r,n){if(e&&(t&&(e=Ha(e,t)),this.matcher&&(e=Ha(e,this.matcher)),this.stemmer&&e.length>1&&(e=Ha(e,this.stemmer)),n&&e.length>1&&(e=LI(e)),r||r==="")){let o=e.split(r);return this.filter?BI(o,this.filter):o}return e}var Ah=/[\\p{Z}\\p{S}\\p{P}\\p{C}]+/u;function Rh(e){let t=Y();for(let r=0,n=e.length;r<n;r++)t[e[r]]=1;return t}function Ja(e,t){let r=Dh(e),n=r.length,o=[],i="",s=0;for(let a=0,c,m;a<n;a++)c=r[a],m=e[c],m?(o[s++]=Nh(t?"(?!\\\\b)"+c+"(\\\\b|_)":c),o[s++]=m):i+=(i?"|":"")+c;return i&&(o[s++]=Nh(t?"(?!\\\\b)("+i+")(\\\\b|_)":"("+i+")"),o[s]=""),o}function Ha(e,t){for(let r=0,n=t.length;r<n&&(e=e.replace(t[r],t[r+1]),!!e);r+=2);return e}function Nh(e){return new RegExp(e,"g")}function LI(e){let t="",r="";for(let n=0,o=e.length,i;n<o;n++)(i=e[n])!==r&&(t+=r=i);return t}function BI(e,t){let r=e.length,n=[];for(let o=0,i=0;o<r;o++){let s=e[o];s&&!t[s]&&(n[i++]=s)}return n}var UI=!1,zI="",Fh={encode:Ya,rtl:UI,tokenize:zI};function Ya(e){return Ch.call(this,(""+e).toLowerCase(),!1,Ah,!1)}u();var $h={},Ph={};u();function $i(e){Gn(e,"add"),Gn(e,"append"),Gn(e,"search"),Gn(e,"update"),Gn(e,"remove")}function Gn(e,t){e[t+"Async"]=function(){let r=this,n=arguments,o=n[n.length-1],i;Kn(o)&&(i=o,delete n[n.length-1]);let s=new Promise(function(a){setTimeout(function(){r.async=!0;let c=r[t].apply(r,n);r.async=!1,a(c)})});return i?(s.then(i),this):s}}u();function Pi(e,t,r,n){let o=e.length,i=[],s,a,c=0;n&&(n=[]);for(let m=o-1;m>=0;m--){let f=e[m],h=f.length,p=Y(),b=!s;for(let E=0;E<h;E++){let I=f[E],D=I.length;if(D)for(let A=0,j,q;A<D;A++)if(q=I[A],s){if(s[q]){if(!m){if(r)r--;else if(i[c++]=q,c===t)return i}(m||n)&&(p[q]=1),b=!0}if(n&&(j=(a[q]||0)+1,a[q]=j,j<o)){let ne=n[j-2]||(n[j-2]=[]);ne[ne.length]=q}}else p[q]=1}if(n)s||(a=p);else if(!b)return[];s=p}if(n)for(let m=n.length-1,f,h;m>=0;m--){f=n[m],h=f.length;for(let p=0,b;p<h;p++)if(b=f[p],!s[b]){if(r)r--;else if(i[c++]=b,c===t)return i;s[b]=1}}return i}function kh(e,t){let r=Y(),n=Y(),o=[];for(let i=0;i<e.length;i++)r[e[i]]=1;for(let i=0,s;i<t.length;i++){s=t[i];for(let a=0,c;a<s.length;a++)c=s[a],r[c]&&(n[c]||(n[c]=1,o[o.length]=c))}return o}u();function ki(e){this.limit=e!==!0&&e,this.cache=Y(),this.queue=[]}var Mi=ki;function qi(e,t,r){Ze(e)&&(e=e.query);let n=this.cache.get(e);return n||(n=this.search(e,t,r),this.cache.set(e,n)),n}ki.prototype.set=function(e,t){if(!this.cache[e]){let r=this.queue.length;r===this.limit?delete this.cache[this.queue[r-1]]:r++;for(let n=r-1;n>0;n--)this.queue[n]=this.queue[n-1];this.queue[0]=e}this.cache[e]=t};ki.prototype.get=function(e){let t=this.cache[e];if(this.limit&&t){let r=this.queue.indexOf(e);if(r){let n=this.queue[r-1];this.queue[r-1]=this.queue[r],this.queue[r]=n}}return t};ki.prototype.del=function(e){for(let t=0,r,n;t<this.queue.length;t++)n=this.queue[t],r=this.cache[n],r.includes(e)&&(this.queue.splice(t--,1),delete this.cache[n])};u();var qh={memory:{charset:"latin:extra",resolution:3,minlength:4,fastupdate:!1},performance:{resolution:3,minlength:3,optimize:!1,context:{depth:2,resolution:1}},match:{charset:"latin:extra",tokenize:"reverse"},score:{charset:"latin:advanced",resolution:20,minlength:3,context:{depth:3,resolution:9}},default:{}};function Za(e){if(me(e))!1&&!qh[e]&&console.warn("Preset not found: "+e),e=qh[e];else{let t=e.preset;t&&(!1&&!t[t]&&console.warn("Preset not found: "+t),e=Object.assign({},t[t],e))}return e}u();function jh(e,t,r,n,o,i,s){setTimeout(function(){let a=e(r?r+"."+n:n,JSON.stringify(s));a&&a.then?a.then(function(){t.export(e,t,r,o,i+1)}):t.export(e,t,r,o,i+1)})}function Lh(e,t,r,n,o){let i,s;switch(o||(o=0)){case 0:if(i="reg",this.fastupdate){s=Y();for(let a in this.register)s[a]=1}else s=this.register;break;case 1:i="cfg",s={doc:0,opt:this.optimize?1:0};break;case 2:i="map",s=this.map;break;case 3:i="ctx",s=this.ctx;break;default:return}return jh(e,t||this,r,i,n,o,s),!0}function Bh(e,t){if(t)switch(me(t)&&(t=JSON.parse(t)),e){case"cfg":this.optimize=!!t.opt;break;case"reg":this.fastupdate=!1,this.register=t;break;case"map":this.map=t;break;case"ctx":this.ctx=t;break}}function Uh(e,t,r,n,o){if(o||(o=0),n||(n=0),n<this.field.length){let i=this.field[n],s=this.index[i];t=this,setTimeout(function(){s.export(e,t,o?i:"",n,o++)||(n++,o=1,t.export(e,t,i,n,o))})}else{let i,s;switch(o){case 1:i="tag",s=this.tagindex;break;case 2:i="store",s=this.store;break;default:return}jh(e,this,r,i,n,o,s)}}function zh(e,t){if(t)switch(me(t)&&(t=JSON.parse(t)),e){case"tag":this.tagindex=t;break;case"reg":this.fastupdate=!1,this.register=t;for(let n=0,o;n<this.field.length;n++)o=this.index[this.field[n]],o.register=t,o.fastupdate=!1;break;case"store":this.store=t;break;default:e=e.split(".");let r=e[0];e=e[1],r&&e&&this.index[r].import(e,t)}}function Ne(e,t){if(!(this instanceof Ne))return new Ne(e);let r,n,o;e?(!0&&(e=Za(e)),r=e.charset,n=e.lang,me(r)&&(r.indexOf(":")===-1&&(r+=":default"),r=Ph[r]),me(n)&&(n=$h[n])):e={};let i,s,a=e.context||{};this.encode=e.encode||r&&r.encode||Ya,this.register=t||Y(),this.resolution=i=e.resolution||9,this.tokenize=o=r&&r.tokenize||e.tokenize||"strict",this.depth=o==="strict"&&a.depth,this.bidirectional=Nr(a.bidirectional,!0),this.optimize=s=Nr(e.optimize,!0),this.fastupdate=Nr(e.fastupdate,!0),this.minlength=e.minlength||1,this.boost=e.boost,this.map=s?Va(i):Y(),this.resolution_ctx=i=a.resolution||1,this.ctx=s?Va(i):Y(),this.rtl=r&&r.rtl||e.rtl,this.matcher=(o=e.matcher||n&&n.matcher)&&Ja(o,!1),this.stemmer=(o=e.stemmer||n&&n.stemmer)&&Ja(o,!0),this.filter=(o=e.filter||n&&n.filter)&&Rh(o),!0&&(this.cache=(o=e.cache)&&new Mi(o))}var Ui=Ne;Ne.prototype.append=function(e,t){return this.add(e,t,!0)};Ne.prototype.add=function(e,t,r,n){if(t&&(e||e===0)){if(!n&&!r&&this.register[e])return this.update(e,t);t=this.encode(""+t);let o=t.length;if(o){let i=Y(),s=Y(),a=this.depth,c=this.resolution;for(let m=0;m<o;m++){let f=t[this.rtl?o-1-m:m],h=f.length;if(f&&h>=this.minlength&&(a||!s[f])){let p=ji(c,o,m),b="";switch(this.tokenize){case"full":if(h>2){for(let E=0;E<h;E++)for(let I=h;I>E;I--)if(I-E>=this.minlength){let D=ji(c,o,m,h,E);b=f.substring(E,I),this.push_index(s,b,D,e,r)}break}case"reverse":if(h>1){for(let E=h-1;E>0;E--)if(b=f[E]+b,b.length>=this.minlength){let I=ji(c,o,m,h,E);this.push_index(s,b,I,e,r)}b=""}case"forward":if(h>1){for(let E=0;E<h;E++)b+=f[E],b.length>=this.minlength&&this.push_index(s,b,p,e,r);break}default:if(this.boost&&(p=Math.min(p/this.boost(t,f,m)|0,c-1)),this.push_index(s,f,p,e,r),a&&o>1&&m<o-1){let E=Y(),I=this.resolution_ctx,D=f,A=Math.min(a+1,o-m);E[D]=1;for(let j=1;j<A;j++)if(f=t[this.rtl?o-1-m-j:m+j],f&&f.length>=this.minlength&&!E[f]){E[f]=1;let q=ji(I+(o/2>I?0:1),o,m,A-1,j-1),ne=this.bidirectional&&f>D;this.push_index(i,ne?D:f,q,e,r,ne?f:D)}}}}}this.fastupdate||(this.register[e]=1)}}return this};function ji(e,t,r,n,o){return r&&e>1?t+(n||0)<=e?r+(o||0):(e-1)/(t+(n||0))*(r+(o||0))+1|0:0}Ne.prototype.push_index=function(e,t,r,n,o,i){let s=i?this.ctx:this.map;if((!e[t]||i&&!e[t][i])&&(this.optimize&&(s=s[r]),i?(e=e[t]||(e[t]=Y()),e[i]=1,s=s[i]||(s[i]=Y())):e[t]=1,s=s[t]||(s[t]=[]),this.optimize||(s=s[r]||(s[r]=[])),(!o||!s.includes(n))&&(s[s.length]=n,this.fastupdate))){let a=this.register[n]||(this.register[n]=[]);a[a.length]=s}};Ne.prototype.search=function(e,t,r){r||(!t&&Ze(e)?(r=e,e=r.query):Ze(t)&&(r=t));let n=[],o,i,s,a=0;if(r&&(e=r.query||e,t=r.limit,a=r.offset||0,i=r.context,s=!0&&r.suggest),e&&(e=this.encode(""+e),o=e.length,o>1)){let h=Y(),p=[];for(let b=0,E=0,I;b<o;b++)if(I=e[b],I&&I.length>=this.minlength&&!h[I]){if(!this.optimize&&!s&&!this.map[I])return n;p[E++]=I,h[I]=1}e=p,o=e.length}if(!o)return n;t||(t=100);let c=this.depth&&o>1&&i!==!1,m=0,f;c?(f=e[0],m=1):o>1&&e.sort(Th);for(let h,p;m<o;m++){if(p=e[m],c?(h=this.add_result(n,s,t,a,o===2,p,f),(!s||h!==!1||!n.length)&&(f=p)):h=this.add_result(n,s,t,a,o===1,p),h)return h;if(s&&m===o-1){let b=n.length;if(b){if(b===1)return Kh(n[0],t,a)}else{if(c){c=0,m=-1;continue}return n}}}return Pi(n,t,a,s)};Ne.prototype.add_result=function(e,t,r,n,o,i,s){let a=[],c=s?this.ctx:this.map;if(this.optimize||(c=Wh(c,i,s,this.bidirectional)),c){let m=0,f=Math.min(c.length,s?this.resolution_ctx:this.resolution);for(let h=0,p=0,b,E;h<f&&(b=c[h],!(b&&(this.optimize&&(b=Wh(b,i,s,this.bidirectional)),n&&b&&o&&(E=b.length,E<=n?(n-=E,b=null):(b=b.slice(n),n=0)),b&&(a[m++]=b,o&&(p+=b.length,p>=r)))));h++);if(m){if(o)return Kh(a,r,0);e[e.length]=a;return}}return!t&&a};function Kh(e,t,r){return e.length===1?e=e[0]:e=_h(e),r||e.length>t?e.slice(r,r+t):e}function Wh(e,t,r,n){if(r){let o=n&&t>r;e=e[o?t:r],e=e&&e[o?r:t]}else e=e[t];return e}Ne.prototype.contain=function(e){return!!this.register[e]};Ne.prototype.update=function(e,t){return this.remove(e).add(e,t)};Ne.prototype.remove=function(e,t){let r=this.register[e];if(r){if(this.fastupdate)for(let n=0,o;n<r.length;n++)o=r[n],o.splice(o.indexOf(e),1);else Li(this.map,e,this.resolution,this.optimize),this.depth&&Li(this.ctx,e,this.resolution_ctx,this.optimize);t||delete this.register[e],!0&&this.cache&&this.cache.del(e)}return this};function Li(e,t,r,n,o){let i=0;if(nr(e))if(o){let s=e.indexOf(t);s!==-1?e.length>1&&(e.splice(s,1),i++):i++}else{o=Math.min(e.length,r);for(let s=0,a;s<o;s++)a=e[s],a&&(i=Li(a,t,r,n,o),!n&&!i&&delete e[s])}else for(let s in e)i=Li(e[s],t,r,n,o),i||delete e[s];return i}!0&&(Ne.prototype.searchCache=qi);!0&&(Ne.prototype.export=Lh,Ne.prototype.import=Bh);!0&&$i(Ne.prototype);u();u();function Gh(e){e=e.data;let t=self._index,r=e.args,n=e.task;switch(n){case"init":let o=e.options||{},i=e.factory,s=o.encode;o.cache=!1,s&&s.indexOf("function")===0&&(o.encode=Function("return "+s)()),i?(Function("return "+i)()(self),self._index=new self.FlexSearch.Index(o),delete self.FlexSearch):self._index=new Ui(o);break;default:let a=e.id,c=t[n].apply(t,r);postMessage(n==="search"?{id:a,msg:c}:{id:a})}}var Vh=0;function Vn(e){if(!(this instanceof Vn))return new Vn(e);let t;e?Kn(t=e.encode)&&(e.encode=t.toString()):e={};let r=(self||window)._factory;r&&(r=r.toString());let n=typeof window>"u"&&self.exports,o=this;this.worker=GI(r,n,e.worker),this.resolver=Y(),this.worker&&(n?this.worker.on("message",function(i){o.resolver[i.id](i.msg),delete o.resolver[i.id]}):this.worker.onmessage=function(i){i=i.data,o.resolver[i.id](i.msg),delete o.resolver[i.id]},this.worker.postMessage({task:"init",factory:r,options:e}))}var Hh=Vn;Hn("add");Hn("append");Hn("search");Hn("update");Hn("remove");function Hn(e){Vn.prototype[e]=Vn.prototype[e+"Async"]=function(){let t=this,r=[].slice.call(arguments),n=r[r.length-1],o;Kn(n)&&(o=n,r.splice(r.length-1,1));let i=new Promise(function(s){setTimeout(function(){t.resolver[++Vh]=s,t.worker.postMessage({task:e,id:Vh,args:r})})});return o?(i.then(o),this):i}}function GI(factory,is_node_js,worker_path){let worker;try{worker=is_node_js?eval(\'new (require("worker_threads")["Worker"])("../dist/node/node.js")\'):factory?new Worker(URL.createObjectURL(new Blob(["onmessage="+Gh.toString()],{type:"text/javascript"}))):new Worker(me(worker_path)?worker_path:"worker/worker.js",{type:"module"})}catch(e){}return worker}function Ce(e){if(!(this instanceof Ce))return new Ce(e);let t=e.document||e.doc||e,r;this.tree=[],this.field=[],this.marker=[],this.register=Y(),this.key=(r=t.key||t.id)&&zi(r,this.marker)||"id",this.fastupdate=Nr(e.fastupdate,!0),!0&&(this.storetree=(r=t.store)&&r!==!0&&[],this.store=r&&Y()),!0&&(this.tag=(r=t.tag)&&zi(r,this.marker),this.tagindex=r&&Y()),!0&&(this.cache=(r=e.cache)&&new Mi(r),e.cache=!1),!0&&(this.worker=e.worker),!0&&(this.async=!1),this.index=VI.call(this,e,t)}var Yh=Ce;function VI(e,t){let r=Y(),n=t.index||t.field||t;me(n)&&(n=[n]);for(let o=0,i,s;o<n.length;o++)i=n[o],me(i)||(s=i,i=i.field),s=Ze(s)?Object.assign({},e,s):e,!0&&this.worker&&(r[i]=new Hh(s),r[i].worker||(this.worker=!1)),this.worker||(r[i]=new Ui(s,this.register)),this.tree[o]=zi(i,this.marker),this.field[o]=i;if(!0&&this.storetree){let o=t.store;me(o)&&(o=[o]);for(let i=0;i<o.length;i++)this.storetree[i]=zi(o[i],this.marker)}return r}function zi(e,t){let r=e.split(":"),n=0;for(let o=0;o<r.length;o++)e=r[o],e.indexOf("[]")>=0&&(e=e.substring(0,e.length-2),e&&(t[n]=!0)),e&&(r[n++]=e);return n<r.length&&(r.length=n),n>1?r:r[0]}function Xa(e,t){if(me(t))e=e[t];else for(let r=0;e&&r<t.length;r++)e=e[t[r]];return e}function eu(e,t,r,n,o){if(e=e[o],n===r.length-1)t[o]=e;else if(e)if(nr(e)){t=t[o]=new Array(e.length);for(let i=0;i<e.length;i++)eu(e,t,r,n,i)}else t=t[o]||(t[o]=Y()),o=r[++n],eu(e,t,r,n,o)}function tu(e,t,r,n,o,i,s,a){if(e=e[s],e)if(n===t.length-1){if(nr(e)){if(r[n]){for(let c=0;c<e.length;c++)o.add(i,e[c],!0,!0);return}e=e.join(" ")}o.add(i,e,a,!0)}else if(nr(e))for(let c=0;c<e.length;c++)tu(e,t,r,n,o,i,c,a);else s=t[++n],tu(e,t,r,n,o,i,s,a)}Ce.prototype.add=function(e,t,r){if(Ze(e)&&(t=e,e=Xa(t,this.key)),t&&(e||e===0)){if(!r&&this.register[e])return this.update(e,t);for(let n=0,o,i;n<this.field.length;n++)i=this.field[n],o=this.tree[n],me(o)&&(o=[o]),tu(t,o,this.marker,0,this.index[i],e,o[0],r);if(!0&&this.tag){let n=Xa(t,this.tag),o=Y();me(n)&&(n=[n]);for(let i=0,s,a;i<n.length;i++)if(s=n[i],!o[s]&&(o[s]=1,a=this.tagindex[s]||(this.tagindex[s]=[]),(!r||!a.includes(e))&&(a[a.length]=e,this.fastupdate))){let c=this.register[e]||(this.register[e]=[]);c[c.length]=a}}if(!0&&this.store&&(!r||!this.store[e])){let n;if(this.storetree){n=Y();for(let o=0,i;o<this.storetree.length;o++)i=this.storetree[o],me(i)?n[i]=t[i]:eu(t,n,i,0,i[0])}this.store[e]=n||t}}return this};Ce.prototype.append=function(e,t){return this.add(e,t,!0)};Ce.prototype.update=function(e,t){return this.remove(e).add(e,t)};Ce.prototype.remove=function(e){if(Ze(e)&&(e=Xa(e,this.key)),this.register[e]){for(let t=0;t<this.field.length&&(this.index[this.field[t]].remove(e,!this.worker),!this.fastupdate);t++);if(!0&&this.tag&&!this.fastupdate)for(let t in this.tagindex){let r=this.tagindex[t],n=r.indexOf(e);n!==-1&&(r.length>1?r.splice(n,1):delete this.tagindex[t])}!0&&this.store&&delete this.store[e],delete this.register[e]}return this};Ce.prototype.search=function(e,t,r,n){r||(!t&&Ze(e)?(r=e,e=""):Ze(t)&&(r=t,t=0));let o=[],i=[],s,a,c,m,f,h,p=0;if(r)if(nr(r))c=r,r=null;else{if(e=r.query||e,s=r.pluck,c=s||r.index||r.field,m=!0&&r.tag,a=!0&&this.store&&r.enrich,f=r.bool==="and",t=r.limit||t||100,h=r.offset||0,m&&(me(m)&&(m=[m]),!e)){for(let E=0,I;E<m.length;E++)I=HI.call(this,m[E],t,h,a),I&&(o[o.length]=I,p++);return p?o:[]}me(c)&&(c=[c])}c||(c=this.field),f=f&&(c.length>1||m&&m.length>1);let b=!n&&(this.worker||this.async)&&[];for(let E=0,I,D,A;E<c.length;E++){let j;if(D=c[E],me(D)||(j=D,D=j.field,e=j.query||e,t=j.limit||t),b){b[E]=this.index[D].searchAsync(e,t,j||r);continue}else n?I=n[E]:I=this.index[D].search(e,t,j||r);if(A=I&&I.length,m&&A){let q=[],ne=0;f&&(q[0]=[I]);for(let Ie=0,F,z;Ie<m.length;Ie++)F=m[Ie],z=this.tagindex[F],A=z&&z.length,A&&(ne++,q[q.length]=f?[z]:z);ne&&(f?I=Pi(q,t||100,h||0):I=kh(I,q),A=I.length)}if(A)i[p]=D,o[p++]=I;else if(f)return[]}if(b){let E=this;return new Promise(function(I){Promise.all(b).then(function(D){I(E.search(e,t,r,D))})})}if(!p)return[];if(s&&(!a||!this.store))return o[0];for(let E=0,I;E<i.length;E++){if(I=o[E],I.length&&a&&(I=Zh.call(this,I)),s)return I;o[E]={field:i[E],result:I}}return o};function HI(e,t,r,n){let o=this.tagindex[e],i=o&&o.length-r;if(i&&i>0)return(i>t||r)&&(o=o.slice(r,r+t)),n&&(o=Zh.call(this,o)),{tag:e,result:o}}function Zh(e){let t=new Array(e.length);for(let r=0,n;r<e.length;r++)n=e[r],t[r]={id:n,doc:this.store[n]};return t}Ce.prototype.contain=function(e){return!!this.register[e]};!0&&(Ce.prototype.get=function(e){return this.store[e]},Ce.prototype.set=function(e,t){return this.store[e]=t,this});!0&&(Ce.prototype.searchCache=qi);!0&&(Ce.prototype.export=Uh,Ce.prototype.import=zh);!0&&$i(Ce.prototype);u();var JI=["a","about","above","after","again","against","all","also","am","an","and","any","are","aren\'t","as","at","be","because","been","before","being","below","both","but","by","can","cannot","can\'t","come","could","couldn\'t","did","didn\'t","do","does","doesn\'t","doing","dont","down","during","each","even","few","first","for","from","further","get","go","had","hadn\'t","has","hasn\'t","have","haven\'t","having","he","hed","her","here","here\'s","hers","herself","hes","him","himself","his","how","how\'s","i","id","if","ill","im","in","into","is","isn\'t","it","it\'s","itself","i\'ve","just","know","let\'s","like","make","me","more","most","mustn\'t","my","myself","new","no","nor","not","now","of","off","on","once","only","or","other","ought","our","our\'s","ourselves","out","over","own","same","say","see","shan\'t","she","she\'d","shell","shes","should","shouldn\'t","so","some","such","than","that","that\'s","the","their","theirs","them","themselves","then","there","there\'s","these","they","they\'d","they\'ll","they\'re","they\'ve","this","those","through","time","to","too","until","up","us","very","want","was","wasn\'t","way","we","wed","well","were","weren\'t","we\'ve","what","what\'s","when","when\'s","where","where\'s","which","while","who","whom","who\'s","why","why\'s","will","with","won\'t","would","wouldn\'t","you","you\'d","you\'ll","your","you\'re","your\'s","yourself","yourselves","you\'ve"],YI={ational:"ate",iveness:"ive",fulness:"ful",ousness:"ous",ization:"ize",tional:"tion",biliti:"ble",icate:"ic",ative:"",alize:"al",iciti:"ic",entli:"ent",ousli:"ous",alism:"al",ation:"ate",aliti:"al",iviti:"ive",ement:"",enci:"ence",anci:"ance",izer:"ize",alli:"al",ator:"ate",logi:"log",ical:"ic",ance:"",ence:"",ness:"",able:"",ible:"",ment:"",eli:"e",bli:"ble",ful:"",ant:"",ent:"",ism:"",ate:"",iti:"",ous:"",ive:"",ize:"",al:"",ou:"",er:"",ic:""},ZI={},Qh={filter:JI,stemmer:YI,matcher:ZI};u();function Xh(){let e,t,r=new Promise((n,o)=>{e=n,t=o});return{resolve:e,reject:t,promise:r}}u();var Jn=class{#e=Rr;readCitekeys(t){if(J.debug("Reading Better BibTex database"),!this.#e.bbtLoadStatus)return J.info("Better BibTex database not enabled, skipping..."),[];let r=this.#e.getCitekeys(t);return J.info("Finished reading Better BibTex"),r}toItemObjects(t,r){let n=this.readCitekeys(r),o=this.#e.zotero.prepare(cn).query(r),i=this.#e.zotero.prepare(un).query(r),s=Oh(r.flatMap(([c])=>t[c]?.collectionIDs?.map(m=>`${m}-${t[c].libraryID}`)??[])).filter(c=>c!==null),a=this.#e.zotero.prepare(hn).query(s.map(c=>c.split("-").map(m=>+m)));return r.reduce((c,[m,f])=>{if(!m)return c;let h=n[m];h||J.warn(`Citekey: No item found for itemID ${m}`,h);let p=o[m].reduce((A,j)=>{let{value:q}=j;return j.fieldName==="date"&&(q=al(q).split("-")[0]),(A[j.fieldName]??=[]).push(q),A},{}),{collectionIDs:b,...E}=t[m],I=b.map(A=>a.get(A)).filter(A=>A!==void 0),D={...E,libraryID:f,groupID:this.#e.groupOf(f),itemID:m,creators:i[m],collections:I,citekey:n[m],...p,dateAccessed:QI(p)?XI(p.accessDate[0]):null};return c[m]=D,c},{})}};function QI(e){let t=e;return Array.isArray(t.accessDate)&&t.accessDate.length===1&&typeof t.accessDate[0]=="string"}function XI(e){let t=e.replace(" ","T")+"Z";try{return new Date(t)}catch{return null}}var Yn=class{#e=Rr;#t=new Jn;#r=new Yh({worker:!0,charset:Fh,language:Qh,document:{id:"itemID",index:["title","creators[]:firstName","creators[]:lastName","date"]},tokenize:"full",suggest:!0});#o=new Map;#n=new Map;getStatus(t){if(!this.#n.has(t)){let n=Xh();return this.#n.set(t,n),n.promise}let r=this.#n.get(t);return r instanceof Promise||typeof r=="string"?r:r.promise}load(t){let r=this.#n.get(t);if(r instanceof Promise)return r;let n=this.#a(t),o=this.#u(t,n).then(()=>{this.#n.set(t,"READY")}).catch(i=>{throw this.#n.set(t,"ERROR"),i});return typeof r=="string"||!r||o.then(r.resolve,r.reject),this.#n.set(t,o),o}async searchItems(t,r){return await this.#i(t),await this.#r.searchAsync(r)}async getCachedItems(t,r){await this.#i(r);let n=this.#o.get(r);if(!n)throw new Error("Cache not initialized");let o=[...n.byId.values()].sort((i,s)=>s.dateAccessed&&i.dateAccessed?s.dateAccessed.getTime()-i.dateAccessed.getTime():0);return t<=0?o:o.slice(0,t)}async getItemsCache(t){await this.#i(t);let r=this.#o.get(t);if(!r)throw new Error("Cache not initialized");return r}async#i(t){let r=this.getStatus(t);if(r==="ERROR")throw new Error("Indexing failed");r instanceof Promise&&await r}#a(t){J.debug("Reading main Zotero database for index");let{zotero:r}=this.#e,n=this.#s(r.prepare(fn).query({libId:t}));return J.info("Finished reading main Zotero database for index"),n}readItemByKey(t){let{zotero:r}=this.#e,n=r.prepare(mn).query(t);return this.#s(t.map(([i])=>n[i]))}readItemById(t){let{zotero:r}=this.#e,n=r.prepare(pn).query(t);return this.#s(t.map(([i])=>n[i]))}#s(t){let r=t.reduce((o,i)=>(o[i.itemID]=i,o),{}),n=t.map(o=>[o.itemID,o.libraryID]);return this.#t.toItemObjects(r,n)}async#u(t,r){J.trace("Start flexsearch indexing");let n=Object.values(r),o=this.#o.get(t);if(this.#o.set(t,{byId:new Map(n.map(i=>[i.itemID,i])),byKey:new Map(n.map(i=>[zs(i,!0),i]))}),!o)await Promise.all([...n.map(i=>this.#r.addAsync(i.itemID,i))]);else{let i=new Set(n.map(a=>a.itemID)),s=[...o.byId.keys()].filter(a=>!i.has(a));o.byId.clear(),o.byKey.clear(),await Promise.all([...n.map(a=>this.#r.addAsync(a.itemID,a)),...s.map(a=>this.#r.removeAsync(a))])}J.info("Library citation index done: "+t)}async updateIndex(t){await Promise.all(Object.values(t).map(async r=>{let n=this.#o.get(r.libraryID);if(!n)throw new Error("Cannot update index for library not initialized");n.byId.set(r.itemID,r),n.byKey.set(zs(r,!0),r),await this.#r.updateAsync(r.itemID,r)}))}};var Rr=new Un,Fi=new Yn,eg=new zn;u();function or(e,t){return(...r)=>{J.debug(`Reading Zotero database for ${typeof t=="string"?t:t(null,...r)}`);let n=e.apply(null,r);return Promise.resolve(n).then(o=>J.debug(`Finished reading Zotero database for ${typeof t=="string"?t:t(o,...r)}`)),n}}var ru=class{#e=Rr;#t=Fi;#r=eg;api={getLibs:()=>this.#e.libraries,initIndex:async t=>{await this.#t.load(t)},openDb:(...t)=>this.#e.load(...t),search:async(t,r)=>await this.#t.searchItems(t,r),getItems:async(t,r)=>await this.#r.get(t,r),getTags:or(t=>this.#e.zotero.prepare(yn).query(t),"tags"),getItemIDsFromCitekey:t=>this.#e.getItemIDsFromCitekey(t),getItemsFromCache:(t,r)=>this.#t.getCachedItems(t,r),getAttachments:or((t,r)=>this.#e.zotero.prepare(rn).query({itemId:t,libId:r}),(t,r)=>`attachments of item ${r}`+(t?`, count: ${t.length}`:"")),getAnnotations:or((t,r)=>this.#e.zotero.prepare(Xr).query({attachmentId:t,libId:r,groupID:this.#e.groupOf(r)}),(t,r)=>`annotations of attachment ${r}`+(t?`, count: ${t.length}`:"")),getAnnotFromKey:or((t,r)=>this.#e.zotero.prepare(Qr).query({annotKeys:t,libId:r,groupID:this.#e.groupOf(r)}),(t,r)=>`annotations with keys: ${r.join(",")}`+(t?`, count: ${t.length}`:"")),getNotes:or((t,r)=>this.#e.zotero.prepare(tn).query({itemID:t,libId:r,groupID:this.#e.groupOf(r)}),(t,r)=>`notes of literature ${r}`+(t?`, count: ${t.length}`:"")),getNoteFromKey:or((t,r)=>this.#e.zotero.prepare(en).query({noteKeys:t,libId:r,groupID:this.#e.groupOf(r)}),(t,r)=>`notes with keys: ${r.join(",")}`+(t?`, count: ${t.length}`:"")),isUpToDate:()=>this.#e.zotero.isUpToDate(),getLoadStatus:()=>{let t=this.#e.loadStatus;return{main:t.main,bbt:this.#e.bbtLoadStatus,bbtVersion:t.bbtSearch===null?"v1":"v0"}},raw:(t,r,n)=>{let{zotero:{instance:o}}=this.#e;if(!o)throw new Error("failed to query raw: no main database opened");return o.prepare(r)[t](...n)},setLoglevel:t=>{J.level=t,tg.default.setItem(La,t)}};toAPI(){return fl(this.api)}},eS=new ru;new Zr(eS.toAPI());\n/*! Bundled license information:\n\nlocalforage/dist/localforage.js:\n (*!\n localForage -- Offline Storage, Improved\n Version 1.10.0\n https://localforage.github.io/localForage\n (c) 2013-2017 Mozilla, Apache License 2.0\n *)\n\nflatted/cjs/index.js:\n (*! (c) 2020 Andrea Giammarchi *)\n*/\n';var Lb=class extends Hs{initWebWorker(){return QT(Dk,{name:"zotlit database worker"})}},Op=class extends Ks{workerCtor(){return new Lb}};var Zt=class extends de{settings=this.use(be);app=this.use(So.App);plugin=this.use(Se);server=this.use(Cn);get zoteroDataDir(){return this.settings.current?.zoteroDataDir}onload(){W.debug("loading DatabaseWorker"),this.settings.once(async()=>{let e=(0,So.debounce)(()=>this.refresh({task:"dbConn"}),500,!0);this.registerEvent(this.app.vault.on("zotero:db-updated",()=>e()));let r=process.hrtime();await this.initialize(),W.debug(`ZoteroDB Initialization complete. Took ${(0,Pk.default)(process.hrtime(r))}`);let n=this.genAutoRefresh(this.plugin);this.registerEvent(this.server.on("bg:notify",async(o,i)=>{i.event==="regular-item/update"&&n(i)})),this.plugin.addCommand({id:"refresh-zotero-data",name:"Refresh Zotero data",callback:async()=>{await this.refresh({task:"full"})}}),this.plugin.addCommand({id:"refresh-zotero-search-index",name:"Refresh Zotero search index",callback:async()=>{await this.refresh({task:"searchIndex"})}})}),this.register(Ve(ut(async()=>{this.status===0?await this.initialize():await this.refresh({task:"full"})},()=>this.zoteroDataDir))),this.register(Ve(ut(async()=>{await this.refresh({task:"searchIndex",force:!0}),new So.Notice("Zotero search index updated.")},()=>this.settings.libId,!0)))}genAutoRefresh(e){let r=!1,n=null,o=()=>{n&&(W.debug("unregistering db refresh watcher"),n(),n=null)},i=(0,So.debounce)(async()=>{if(o(),W.debug("Auto Refreshing Zotero Search Index"),!r){r=!1;try{W.debug("Db not refreshed, waiting before auto refresh");let[s]=Jy(e.app,{timeout:1e4});await s}catch(s){if(s instanceof Cl){W.warn("no db refreshed event received in 10s, skip refresh search index");return}else{console.error("error while waiting for db refresh during execute",s);return}}}await this.refresh({task:"searchIndex",force:!0}),W.debug("Auto Refreshing Zotero Search Index Success")},5e3,!0);return s=>{if(W.debug(`Request to auto refresh search index: (refreshed ${r})`,s),i(),o(),r)return;W.debug("watching db refresh while waiting for search index auto refresh");let[l,c]=Jy(e.app,{timeout:null});n=c,l.then(()=>{W.debug("db refresh while requesting auto refresh search index"),r=!0,n=null}).catch(f=>{f instanceof kl||console.error("error while waiting for db refresh during request",f)})}}async onunload(){await this.#e.terminate(),this.#t=0,this.#s=null}#e=new Op({minWorkers:1,maxWorkers:1});get api(){return this.#e.proxy}#t=0;get status(){return this.#t}#n=null;async#o(e){let r=this.settings.libId;return!e&&this.#n===r?(W.debug(`Skipping search index init, lib ${r} already indexed`),!1):(await this.api.initIndex(r),this.#n=r,W.debug(`Search index init complete for lib ${r}`),!0)}async#i(){let[e,r]=this.settings.dbConnParams;W.debug("Opening Zotero databases",{zotero:e.zotero,bbtMain:e.bbtMain,bbtSearch:e.bbtSearch});let{main:n,bbtMain:o,bbtSearch:i}=await this.api.openDb(e,r);if(W.debug("Zotero database open result",{main:n,bbtMain:o,bbtSearch:i}),(!o||i===!1)&&W.debug("Failed to open Better BibTeX database, skipping..."),!n)throw new Error("Failed to init ZoteroDB")}async initialize(){if(this.#t!==0)throw new Error("Calling init on already initialized db, use refresh instead");await this.#i(),this.app.vault.trigger("zotero:db-ready"),await this.#o(!0),this.app.metadataCache.trigger("zotero:search-ready"),W.info("ZoteroDB Initialization complete."),this.#t=2}#r=null;#s=null;refresh(e){if(this.#t===0)return Promise.reject(new Error("Calling refresh on uninitialized database"));if(this.#t===2){this.#t=1;let r=(async()=>{e.task==="dbConn"?await this.#a():e.task==="searchIndex"?await this.#l(e.force):e.task==="full"?await this.#c():(0,jb.assertNever)(e),this.#t=2;let n=this.#s;n&&(this.#s=null,await this.refresh(n))})();return this.#r=r}else{if(this.#t===1)return this.#r?(this.#s=this.#u(e),this.#r):Promise.reject(new Error("Other task in pending state"));(0,jb.assertNever)(this.#t)}}async#a(){await this.#i(),this.app.vault.trigger("zotero:db-refresh")}async#l(e=!1){await this.#o(e)&&this.app.metadataCache.trigger("zotero:search-refresh")}async#c(){await this.#a(),await this.#l(!0),new So.Notice("ZoteroDB Refresh complete.")}#u(e){if(!this.#s)return e;let r=this.#s;return r.task==="full"?r:r.task===e.task?r.task==="searchIndex"?{...r,force:r.force||e.force}:r:{task:"full"}}};he([ge],Zt.prototype,"zoteroDataDir",1);var Fk="INFO",$k="log4js_loglevel",a7=()=>{let t=localStorage.getItem($k);return typeof t=="string"&&t in Tp.levels?(console.debug(`Read from localstorage: loglevel ${t}`),t):Fk},qb=kS("main",a7(),Tp.default),W=qb,gt=(t,e,...r)=>{if(!e){qb.error(t,...r);return}qb.error(t,e instanceof Error?e.message:String(e),...r),console.error(e)},KT={logLevel:Fk},Vl=class extends de{settings=this.use(be);get level(){return this.settings.current?.logLevel}async applyLogLevel(){localStorage.setItem($k,this.level),await this.use(Zt).api.setLoglevel(this.level)}onload(){this.register(Ve(ut(()=>this.applyLogLevel(),()=>this.level)))}};he([ge],Vl.prototype,"level",1);a();var vN=require("fs"),Kn=require("obsidian");a();a();_();var Ie={},Ys=Symbol(),jA=t=>!!t[Ys],$A=t=>!t[Ys].c,Ql=t=>{var e;let{b:r,c:n}=t[Ys];n&&(n(),(e=T7.get(r))==null||e())},$p=(t,e)=>{let r=t[Ys].o,n=e[Ys].o;return r===n||t===n||jA(r)&&$p(r,e)},MA=(t,e)=>{let r={b:t,o:e,c:null},n=new Promise(o=>{r.c=()=>{r.c=null,o()},e.finally(r.c)});return n[Ys]=r,n},T7=new WeakMap;var Fp=t=>"init"in t,tv="r",rv="w",ec="c",nv="s",LA="h",C7="n",k7="l",A7="a",R7="m",N7=t=>{let e=new WeakMap,r=new WeakMap,n=new Map,o,i;if((Ie.env&&Ie.env.MODE)!=="production"&&(o=new Set,i=new Set),t)for(let[I,E]of t){let A={v:E,r:0,y:!0,d:new Map};(Ie.env&&Ie.env.MODE)!=="production"&&(Object.freeze(A),Fp(I)||console.warn("Found initial value for derived atom which can cause unexpected behavior",I)),e.set(I,A)}let s=new WeakMap,l=(I,E,A)=>{let R=s.get(E);R||(R=new Map,s.set(E,R)),A.then(()=>{R.get(I)===A&&(R.delete(I),R.size||s.delete(E))}),R.set(I,A)},c=I=>{let E=new Set,A=s.get(I);return A&&(s.delete(I),A.forEach((R,N)=>{Ql(R),E.add(N)})),E},f=new WeakMap,u=I=>{let E=f.get(I);return E||(E=new Map,f.set(I,E)),E},d=(I,E)=>{if(I){let A=u(I),R=A.get(E);return R||(R=d(I.p,E),R&&"p"in R&&$A(R.p)&&(R=void 0),R&&A.set(E,R)),R}return e.get(E)},m=(I,E,A)=>{if((Ie.env&&Ie.env.MODE)!=="production"&&Object.freeze(A),I)u(I).set(E,A);else{let R=e.get(E);e.set(E,A),n.has(E)||n.set(E,R)}},h=(I,E=new Map,A)=>{if(!A)return E;let R=new Map,N=!1;return A.forEach(D=>{var H;let ie=((H=d(I,D))==null?void 0:H.r)||0;R.set(D,ie),E.get(D)!==ie&&(N=!0)}),E.size===R.size&&!N?E:R},y=(I,E,A,R,N)=>{let D=d(I,E);if(D){if(N&&(!("p"in D)||!$p(D.p,N)))return D;"p"in D&&Ql(D.p)}let H={v:A,r:D?.r||0,y:!0,d:h(I,D?.d,R)},ie=!D?.y;return!D||!("v"in D)||!Object.is(D.v,A)?(ie=!0,++H.r,H.d.has(E)&&(H.d=new Map(H.d).set(E,H.r))):H.d!==D.d&&(H.d.size!==D.d.size||!Array.from(H.d.keys()).every(Zr=>D.d.has(Zr)))&&(ie=!0,Promise.resolve().then(()=>{F(I)})),D&&!ie?D:(m(I,E,H),H)},w=(I,E,A,R,N)=>{let D=d(I,E);if(D){if(N&&(!("p"in D)||!$p(D.p,N)))return D;"p"in D&&Ql(D.p)}let H={e:A,r:(D?.r||0)+1,y:!0,d:h(I,D?.d,R)};return m(I,E,H),H},v=(I,E,A,R)=>{let N=d(I,E);if(N&&"p"in N){if($p(N.p,A))return N.y?N:{...N,y:!0};Ql(N.p)}l(I,E,A);let D={p:A,r:(N?.r||0)+1,y:!0,d:h(I,N?.d,R)};return m(I,E,D),D},x=(I,E,A,R)=>{if(A instanceof Promise){let N=MA(A,A.then(D=>{y(I,E,D,R,N)}).catch(D=>{if(D instanceof Promise)return jA(D)?D.then(()=>{k(I,E,!0)}):D;w(I,E,D,R,N)}));return v(I,E,N,R)}return y(I,E,A,R)},S=(I,E)=>{let A=d(I,E);if(A){let R={...A,y:!1};m(I,E,R)}else(Ie.env&&Ie.env.MODE)!=="production"&&console.warn("[Bug] could not invalidate non existing atom",E)},k=(I,E,A)=>{if(!A){let N=d(I,E);if(N){if(N.y&&"p"in N&&!$A(N.p))return N;if(N.d.forEach((D,H)=>{if(H!==E)if(!r.has(H))k(I,H);else{let ie=d(I,H);ie&&!ie.y&&k(I,H)}}),Array.from(N.d).every(([D,H])=>{let ie=d(I,D);return ie&&!("p"in ie)&&ie.r===H}))return N.y?N:{...N,y:!0}}}let R=new Set;try{let N=E.read(D=>{R.add(D);let H=D===E?d(I,D):k(I,D);if(H){if("e"in H)throw H.e;if("p"in H)throw H.p;return H.v}if(Fp(D))return D.init;throw new Error("no atom init")});return x(I,E,N,R)}catch(N){if(N instanceof Promise){let D=MA(N,N);return v(I,E,D,R)}return w(I,E,N,R)}},j=(I,E)=>k(E,I),Z=(I,E)=>{let A=r.get(E);return A||(A=T(I,E)),A},X=(I,E)=>!E.l.size&&(!E.t.size||E.t.size===1&&E.t.has(I)),J=(I,E)=>{let A=r.get(E);A&&X(E,A)&&O(I,E)},G=(I,E)=>{let A=r.get(E);A?.t.forEach(R=>{R!==E&&(S(I,R),G(I,R))})},$=(I,E,A)=>{let R=!0,N=(ie,Zr)=>{let Ar=k(I,ie);if("e"in Ar)throw Ar.e;if("p"in Ar){if(Zr?.unstable_promise)return Ar.p.then(()=>{let ef=d(I,ie);return ef&&"p"in ef&&ef.p===Ar.p?new Promise(Bg=>setTimeout(Bg)).then(()=>N(ie,Zr)):N(ie,Zr)});throw(Ie.env&&Ie.env.MODE)!=="production"&&console.info("Reading pending atom state in write operation. We throw a promise for now.",ie),Ar.p}if("v"in Ar)return Ar.v;throw(Ie.env&&Ie.env.MODE)!=="production"&&console.warn("[Bug] no value found while reading atom in write operation. This is probably a bug.",ie),new Error("no value found")},D=(ie,Zr)=>{let Ar;if(ie===E){if(!Fp(ie))throw new Error("atom not writable");c(ie).forEach(nS=>{nS!==I&&x(nS,ie,Zr)});let Bg=d(I,ie),UB=x(I,ie,Zr);Bg!==UB&&G(I,ie)}else Ar=$(I,ie,Zr);return R||F(I),Ar},H=E.write(N,D,A);return R=!1,H},te=(I,E,A)=>{let R=$(A,I,E);return F(A),R},C=I=>!!I.write,T=(I,E,A)=>{let R={t:new Set(A&&[A]),l:new Set};if(r.set(E,R),(Ie.env&&Ie.env.MODE)!=="production"&&i.add(E),k(void 0,E).d.forEach((D,H)=>{let ie=r.get(H);ie?ie.t.add(E):H!==E&&T(I,H,E)}),C(E)&&E.onMount){let D=ie=>te(E,ie,I),H=E.onMount(D);I=void 0,H&&(R.u=H)}return R},O=(I,E)=>{var A;let R=(A=r.get(E))==null?void 0:A.u;R&&R(),r.delete(E),(Ie.env&&Ie.env.MODE)!=="production"&&i.delete(E);let N=d(I,E);N?("p"in N&&Ql(N.p),N.d.forEach((D,H)=>{if(H!==E){let ie=r.get(H);ie&&(ie.t.delete(E),X(H,ie)&&O(I,H))}})):(Ie.env&&Ie.env.MODE)!=="production"&&console.warn("[Bug] could not find atom state to unmount",E)},U=(I,E,A,R)=>{let N=new Set(A.d.keys());R?.forEach((D,H)=>{if(N.has(H)){N.delete(H);return}let ie=r.get(H);ie&&(ie.t.delete(E),X(H,ie)&&O(I,H))}),N.forEach(D=>{let H=r.get(D);H?H.t.add(E):r.has(E)&&T(I,D,E)})},F=I=>{if(I){u(I).forEach((A,R)=>{let N=e.get(R);if(A!==N){let D=r.get(R);D?.l.forEach(H=>H(I))}});return}for(;n.size;){let E=Array.from(n);n.clear(),E.forEach(([A,R])=>{let N=d(void 0,A);if(N&&N.d!==R?.d&&U(void 0,A,N,R?.d),R&&!R.y&&N?.y)return;let D=r.get(A);D?.l.forEach(H=>H())})}(Ie.env&&Ie.env.MODE)!=="production"&&o.forEach(E=>E())},se=I=>{u(I).forEach((A,R)=>{let N=e.get(R);(!N||A.r>N.r||A.y!==N.y||A.r===N.r&&A.d!==N.d)&&(e.set(R,A),A.d!==N?.d&&U(I,R,A,N?.d))})},le=(I,E)=>{E&&se(E),F(void 0)},we=(I,E,A)=>{let N=Z(A,I).l;return N.add(E),()=>{N.delete(E),J(A,I)}},fe=(I,E)=>{for(let[A,R]of I)Fp(A)&&(x(E,A,R),G(E,A));F(E)};return(Ie.env&&Ie.env.MODE)!=="production"?{[tv]:j,[rv]:te,[ec]:le,[nv]:we,[LA]:fe,[C7]:I=>(o.add(I),()=>{o.delete(I)}),[k7]:()=>i.values(),[A7]:I=>e.get(I),[R7]:I=>r.get(I)}:{[tv]:j,[rv]:te,[ec]:le,[nv]:we,[LA]:fe}};var qA=(t,e)=>({s:e?e(t).SECRET_INTERNAL_store:N7(t)}),ev=new Map,ov=t=>(ev.has(t)||ev.set(t,Ke(qA())),ev.get(t)),BA=({children:t,initialValues:e,scope:r,unstable_createStore:n,unstable_enableVersionedWrite:o})=>{let[i,s]=q({});K(()=>{let f=l.current;f.w&&(f.s[ec](null,i),delete i.p,f.v=i)},[i]);let l=M();if(!l.current){let f=qA(e,n);if(o){let u=0;f.w=d=>{s(m=>{let h=u?m:{p:m};return d(h),h})},f.v=i,f.r=d=>{++u,d(),--u}}l.current=f}let c=ov(r);return V(c.Provider,{value:l.current},t)},D7=0;function Xt(t,e){let r=`atom${++D7}`,n={toString:()=>r};return typeof t=="function"?n.read=t:(n.init=t,n.read=o=>o(n),n.write=(o,i,s)=>i(n,typeof s=="function"?s(o(n)):s)),e&&(n.write=e),n}function St(t,e){let r=ov(e),n=re(r),{s:o,v:i}=n,s=m=>{let h=o[tv](t,m);if((Ie.env&&Ie.env.MODE)!=="production"&&!h.y)throw new Error("should not be invalidated");if("e"in h)throw h.e;if("p"in h)throw h.p;if("v"in h)return h.v;throw new Error("no atom value")},[[l,c,f],u]=ln((m,h)=>{let y=s(h);return Object.is(m[1],y)&&m[2]===t?m:[h,y,t]},i,m=>{let h=s(m);return[m,h,t]}),d=c;return f!==t&&(u(l),d=s(l)),K(()=>{let{v:m}=n;m&&o[ec](t,m);let h=o[nv](t,u,m);return u(m),h},[o,t,n]),K(()=>{o[ec](t,l)}),Oi(d),d}function iv(t,e){let r=ov(e),{s:n,w:o}=re(r);return ee(s=>{if((Ie.env&&Ie.env.MODE)!=="production"&&!("write"in t))throw new Error("not writable atom");let l=c=>n[rv](t,s,c);return o?o(l):l()},[n,o,t])}var yN=require("obsidian");_();a();var zA=()=>{let t=[];return{get:()=>t,set:(n,o)=>{t.push([n,o])}}};a();var _o=Xt(null),sv=Xt(t=>{let{arch:e,platform:r,modules:n}=t(_o).platform;return`better-sqlite3-${Uf}-electron-v${n}-${r}-${e}.tar.gz`}),tc=Xt(t=>`https://github.com/WiseLibs/better-sqlite3/releases/download/${Uf}/${t(sv)}`),Nxe=Xt(t=>t(tc).replace("github.com","download.fastgit.org")),Mp=Xt(()=>Ps()),UA=Xt(t=>t(_o).mode);a();var hN=Y(Ds(),1);a();a();a();_();var WA=function(t){return function(e,r){var n=M(!1);t(function(){return function(){n.current=!1}},[]),t(function(){if(!n.current)n.current=!0;else return e()},r)}};a();function Oo(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],s;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(l){s={error:l}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i}a();_();a();var rc=function(t){return typeof t=="function"};var HA=function(t){return typeof t>"u"};a();var P7=!1,KA=P7;function F7(t){KA&&(rc(t)||console.error("useMemoizedFn expected parameter is a function, got ".concat(typeof t)));var e=M(t);e.current=ae(function(){return t},[t]);var r=M();return r.current||(r.current=function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return e.current.apply(this,n)}),r.current}var Qt=F7;a();_();var VA=WA(K);a();var $7=!!(typeof window<"u"&&window.document&&window.document.createElement),GA=$7;a();a();_();function ZA(t){function e(r,n){var o;try{o=t()}catch(m){console.error(m)}var i=function(m){return n?.serializer?n?.serializer(m):JSON.stringify(m)},s=function(m){return n?.deserializer?n?.deserializer(m):JSON.parse(m)};function l(){try{var m=o?.getItem(r);if(m)return s(m)}catch(h){console.error(h)}return rc(n?.defaultValue)?n?.defaultValue():n?.defaultValue}var c=Oo(q(function(){return l()}),2),f=c[0],u=c[1];VA(function(){u(l())},[r]);var d=function(m){var h=rc(m)?m(f):m;if(u(h),HA(h))o?.removeItem(r);else try{o?.setItem(r,i(h))}catch(y){console.error(y)}};return[f,Qt(d)]}return e}var M7=ZA(function(){return GA?localStorage:void 0}),av=M7;a();function JA(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e<t.length;e++)t[e]&&(r=JA(t[e]))&&(n&&(n+=" "),n+=r);else for(e in t)t[e]&&(n&&(n+=" "),n+=e);return n}function lv(){for(var t,e,r=0,n="";r<arguments.length;)(t=arguments[r++])&&(e=JA(t))&&(n&&(n+=" "),n+=e);return n}var Xs=lv;a();var YA=require("obsidian");_();var jt=t=>{let e=M(null);return[ee(n=>{e.current&&e.current.empty(),n&&(0,YA.setIcon)(n,t),e.current=n},[t])]};a();a();a();Gs();Gs();var L7=0;function g(t,e,r,n,o){var i,s,l={};for(s in e)s=="ref"?i=e[s]:l[s]=e[s];var c={type:t,props:l,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--L7,__source:o,__self:n};if(typeof t=="function"&&(i=t.defaultProps))for(s in i)l[s]===void 0&&(l[s]=i[s]);return z.vnode&&z.vnode(c),c}var nc=({name:t,desc:e,button:r,onClick:n,icon:o,className:i,...s})=>g("div",{className:Xs("setting-item",i),...s,children:[o&&g("div",{className:"setting-icon",children:o}),g("div",{className:"setting-item-info",children:[g("div",{className:"setting-item-name",children:t}),g("div",{className:"setting-item-description",children:e})]}),g("div",{className:"setting-item-control",children:r&&g("button",{className:"mod-cta",onClick:n,children:r})})]});a();_();var j7=()=>g("svg",{className:"icon-blank svg-icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",height:"32",width:"32"}),q7=()=>g("svg",{className:"icon-spin svg-icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",height:"32",width:"32",children:[g("path",{opacity:".25",d:"M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4"}),g("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z",children:g("animateTransform",{attributeName:"transform",type:"rotate",from:"0 16 16",to:"360 16 16",dur:"0.8s",repeatCount:"indefinite"})})]}),XA=({color:t="var(--icon-color, black)",delay:e=0,height:r=16,width:n=16,style:o,...i})=>{let[s,l]=q(e>0);return K(()=>{let c=-1;return s&&(c=window.setTimeout(()=>{l(!1)},e)),()=>{window.clearTimeout(c)}},[]),g("div",{style:{...o,fill:t,height:Number(r)||r,width:Number(n)||n},...i,children:s?g(j7,{}):g(q7,{})})};a();var iN=require("fs"),Ld=require("fs/promises"),sN=require("stream"),I0=require("stream/promises"),EK=require("@electron/remote");a();var Lp=class extends Error{},cv=class extends Lp{},uv=class extends Lp{},B7=(t,e=",")=>t.join(e),z7={accept:"*",multiple:!1,strict:!1},QA=t=>{let{accept:e,multiple:r,strict:n}={...z7,...t},o=H7({multiple:r,accept:Array.isArray(e)?B7(e):e});return new Promise(i=>{o.onchange=()=>{i(U7(o.files,r,n)),o.remove()},o.click()})},U7=(t,e,r)=>new Promise((n,o)=>{if(!t)return o(new cv);let i=W7(t,e,r);if(!i)return o(new uv);n(i)}),W7=(t,e,r)=>!e&&r?t.length===1?t[0]:null:t.length?t:null,H7=({accept:t,multiple:e})=>{let r=document.createElement("input");return r.type="file",r.multiple=e,r.accept=t,r};var _0=require("obsidian");a();a();a();var iR=Y(require("events"),1),_t=Y(require("fs"),1);a();var Hp=require("node:events"),yv=Y(require("node:stream"),1),oR=require("node:string_decoder"),eR=typeof process=="object"&&process?process:{stdout:null,stderr:null},K7=t=>!!t&&typeof t=="object"&&(t instanceof qt||t instanceof yv.default||V7(t)||G7(t)),V7=t=>!!t&&typeof t=="object"&&t instanceof Hp.EventEmitter&&typeof t.pipe=="function"&&t.pipe!==yv.default.Writable.prototype.pipe,G7=t=>!!t&&typeof t=="object"&&t instanceof Hp.EventEmitter&&typeof t.write=="function"&&typeof t.end=="function",Pn=Symbol("EOF"),Fn=Symbol("maybeEmitEnd"),To=Symbol("emittedEnd"),jp=Symbol("emittingEnd"),oc=Symbol("emittedError"),qp=Symbol("closed"),tR=Symbol("read"),Bp=Symbol("flush"),rR=Symbol("flushChunk"),Fr=Symbol("encoding"),Qs=Symbol("decoder"),rt=Symbol("flowing"),ic=Symbol("paused"),ea=Symbol("resume"),nt=Symbol("buffer"),It=Symbol("pipes"),ot=Symbol("bufferLength"),fv=Symbol("bufferPush"),zp=Symbol("bufferShift"),bt=Symbol("objectMode"),qe=Symbol("destroyed"),pv=Symbol("error"),dv=Symbol("emitData"),nR=Symbol("emitEnd"),mv=Symbol("emitEnd2"),un=Symbol("async"),hv=Symbol("abort"),Up=Symbol("aborted"),sc=Symbol("signal"),Ti=Symbol("dataListeners"),er=Symbol("discarded"),ac=t=>Promise.resolve().then(t),Z7=t=>t(),J7=t=>t==="end"||t==="finish"||t==="prefinish",Y7=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,X7=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),Wp=class{src;dest;opts;ondrain;constructor(e,r,n){this.src=e,this.dest=r,this.opts=n,this.ondrain=()=>e[ea](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},gv=class extends Wp{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,r,n){super(e,r,n),this.proxyErrors=o=>r.emit("error",o),e.on("error",this.proxyErrors)}},Q7=t=>!!t.objectMode,eH=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",qt=class extends Hp.EventEmitter{[rt]=!1;[ic]=!1;[It]=[];[nt]=[];[bt];[Fr];[un];[Qs];[Pn]=!1;[To]=!1;[jp]=!1;[qp]=!1;[oc]=null;[ot]=0;[qe]=!1;[sc];[Up]=!1;[Ti]=0;[er]=!1;writable=!0;readable=!0;constructor(...e){let r=e[0]||{};if(super(),r.objectMode&&typeof r.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Q7(r)?(this[bt]=!0,this[Fr]=null):eH(r)?(this[Fr]=r.encoding,this[bt]=!1):(this[bt]=!1,this[Fr]=null),this[un]=!!r.async,this[Qs]=this[Fr]?new oR.StringDecoder(this[Fr]):null,r&&r.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[nt]}),r&&r.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[It]});let{signal:n}=r;n&&(this[sc]=n,n.aborted?this[hv]():n.addEventListener("abort",()=>this[hv]()))}get bufferLength(){return this[ot]}get encoding(){return this[Fr]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[bt]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[un]}set async(e){this[un]=this[un]||!!e}[hv](){this[Up]=!0,this.emit("abort",this[sc]?.reason),this.destroy(this[sc]?.reason)}get aborted(){return this[Up]}set aborted(e){}write(e,r,n){if(this[Up])return!1;if(this[Pn])throw new Error("write after end");if(this[qe])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof r=="function"&&(n=r,r="utf8"),r||(r="utf8");let o=this[un]?ac:Z7;if(!this[bt]&&!Buffer.isBuffer(e)){if(X7(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(Y7(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[bt]?(this[rt]&&this[ot]!==0&&this[Bp](!0),this[rt]?this.emit("data",e):this[fv](e),this[ot]!==0&&this.emit("readable"),n&&o(n),this[rt]):e.length?(typeof e=="string"&&!(r===this[Fr]&&!this[Qs]?.lastNeed)&&(e=Buffer.from(e,r)),Buffer.isBuffer(e)&&this[Fr]&&(e=this[Qs].write(e)),this[rt]&&this[ot]!==0&&this[Bp](!0),this[rt]?this.emit("data",e):this[fv](e),this[ot]!==0&&this.emit("readable"),n&&o(n),this[rt]):(this[ot]!==0&&this.emit("readable"),n&&o(n),this[rt])}read(e){if(this[qe])return null;if(this[er]=!1,this[ot]===0||e===0||e&&e>this[ot])return this[Fn](),null;this[bt]&&(e=null),this[nt].length>1&&!this[bt]&&(this[nt]=[this[Fr]?this[nt].join(""):Buffer.concat(this[nt],this[ot])]);let r=this[tR](e||null,this[nt][0]);return this[Fn](),r}[tR](e,r){if(this[bt])this[zp]();else{let n=r;e===n.length||e===null?this[zp]():typeof n=="string"?(this[nt][0]=n.slice(e),r=n.slice(0,e),this[ot]-=e):(this[nt][0]=n.subarray(e),r=n.subarray(0,e),this[ot]-=e)}return this.emit("data",r),!this[nt].length&&!this[Pn]&&this.emit("drain"),r}end(e,r,n){return typeof e=="function"&&(n=e,e=void 0),typeof r=="function"&&(n=r,r="utf8"),e!==void 0&&this.write(e,r),n&&this.once("end",n),this[Pn]=!0,this.writable=!1,(this[rt]||!this[ic])&&this[Fn](),this}[ea](){this[qe]||(!this[Ti]&&!this[It].length&&(this[er]=!0),this[ic]=!1,this[rt]=!0,this.emit("resume"),this[nt].length?this[Bp]():this[Pn]?this[Fn]():this.emit("drain"))}resume(){return this[ea]()}pause(){this[rt]=!1,this[ic]=!0,this[er]=!1}get destroyed(){return this[qe]}get flowing(){return this[rt]}get paused(){return this[ic]}[fv](e){this[bt]?this[ot]+=1:this[ot]+=e.length,this[nt].push(e)}[zp](){return this[bt]?this[ot]-=1:this[ot]-=this[nt][0].length,this[nt].shift()}[Bp](e=!1){do;while(this[rR](this[zp]())&&this[nt].length);!e&&!this[nt].length&&!this[Pn]&&this.emit("drain")}[rR](e){return this.emit("data",e),this[rt]}pipe(e,r){if(this[qe])return e;this[er]=!1;let n=this[To];return r=r||{},e===eR.stdout||e===eR.stderr?r.end=!1:r.end=r.end!==!1,r.proxyErrors=!!r.proxyErrors,n?r.end&&e.end():(this[It].push(r.proxyErrors?new gv(this,e,r):new Wp(this,e,r)),this[un]?ac(()=>this[ea]()):this[ea]()),e}unpipe(e){let r=this[It].find(n=>n.dest===e);r&&(this[It].length===1?(this[rt]&&this[Ti]===0&&(this[rt]=!1),this[It]=[]):this[It].splice(this[It].indexOf(r),1),r.unpipe())}addListener(e,r){return this.on(e,r)}on(e,r){let n=super.on(e,r);if(e==="data")this[er]=!1,this[Ti]++,!this[It].length&&!this[rt]&&this[ea]();else if(e==="readable"&&this[ot]!==0)super.emit("readable");else if(J7(e)&&this[To])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[oc]){let o=r;this[un]?ac(()=>o.call(this,this[oc])):o.call(this,this[oc])}return n}removeListener(e,r){return this.off(e,r)}off(e,r){let n=super.off(e,r);return e==="data"&&(this[Ti]=this.listeners("data").length,this[Ti]===0&&!this[er]&&!this[It].length&&(this[rt]=!1)),n}removeAllListeners(e){let r=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Ti]=0,!this[er]&&!this[It].length&&(this[rt]=!1)),r}get emittedEnd(){return this[To]}[Fn](){!this[jp]&&!this[To]&&!this[qe]&&this[nt].length===0&&this[Pn]&&(this[jp]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[qp]&&this.emit("close"),this[jp]=!1)}emit(e,...r){let n=r[0];if(e!=="error"&&e!=="close"&&e!==qe&&this[qe])return!1;if(e==="data")return!this[bt]&&!n?!1:this[un]?(ac(()=>this[dv](n)),!0):this[dv](n);if(e==="end")return this[nR]();if(e==="close"){if(this[qp]=!0,!this[To]&&!this[qe])return!1;let i=super.emit("close");return this.removeAllListeners("close"),i}else if(e==="error"){this[oc]=n,super.emit(pv,n);let i=!this[sc]||this.listeners("error").length?super.emit("error",n):!1;return this[Fn](),i}else if(e==="resume"){let i=super.emit("resume");return this[Fn](),i}else if(e==="finish"||e==="prefinish"){let i=super.emit(e);return this.removeAllListeners(e),i}let o=super.emit(e,...r);return this[Fn](),o}[dv](e){for(let n of this[It])n.dest.write(e)===!1&&this.pause();let r=this[er]?!1:super.emit("data",e);return this[Fn](),r}[nR](){return this[To]?!1:(this[To]=!0,this.readable=!1,this[un]?(ac(()=>this[mv]()),!0):this[mv]())}[mv](){if(this[Qs]){let r=this[Qs].end();if(r){for(let n of this[It])n.dest.write(r);this[er]||super.emit("data",r)}}for(let r of this[It])r.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[bt]||(e.dataLength=0);let r=this.promise();return this.on("data",n=>{e.push(n),this[bt]||(e.dataLength+=n.length)}),await r,e}async concat(){if(this[bt])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Fr]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,r)=>{this.on(qe,()=>r(new Error("stream destroyed"))),this.on("error",n=>r(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[er]=!1;let e=!1,r=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return r();let o=this.read();if(o!==null)return Promise.resolve({done:!1,value:o});if(this[Pn])return r();let i,s,l=d=>{this.off("data",c),this.off("end",f),this.off(qe,u),r(),s(d)},c=d=>{this.off("error",l),this.off("end",f),this.off(qe,u),this.pause(),i({value:d,done:!!this[Pn]})},f=()=>{this.off("error",l),this.off("data",c),this.off(qe,u),r(),i({done:!0,value:void 0})},u=()=>l(new Error("stream destroyed"));return new Promise((d,m)=>{s=m,i=d,this.once(qe,u),this.once("error",l),this.once("end",f),this.once("data",c)})},throw:r,return:r,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[er]=!1;let e=!1,r=()=>(this.pause(),this.off(pv,r),this.off(qe,r),this.off("end",r),e=!0,{done:!0,value:void 0}),n=()=>{if(e)return r();let o=this.read();return o===null?r():{done:!1,value:o}};return this.once("end",r),this.once(pv,r),this.once(qe,r),{next:n,throw:r,return:r,[Symbol.iterator](){return this}}}destroy(e){if(this[qe])return e?this.emit("error",e):this.emit(qe),this;this[qe]=!0,this[er]=!0,this[nt].length=0,this[ot]=0;let r=this;return typeof r.close=="function"&&!this[qp]&&r.close(),e?this.emit("error",e):this.emit(qe),this}static get isStream(){return K7}};var tH=_t.default.writev,ko=Symbol("_autoClose"),Mr=Symbol("_close"),lc=Symbol("_ended"),ve=Symbol("_fd"),bv=Symbol("_finished"),Mn=Symbol("_flags"),vv=Symbol("_flush"),Sv=Symbol("_handleChunk"),Iv=Symbol("_makeBuf"),uc=Symbol("_mode"),Kp=Symbol("_needDrain"),na=Symbol("_onerror"),oa=Symbol("_onopen"),wv=Symbol("_onread"),ta=Symbol("_onwrite"),Ao=Symbol("_open"),$r=Symbol("_path"),Co=Symbol("_pos"),fn=Symbol("_queue"),ra=Symbol("_read"),xv=Symbol("_readSize"),$n=Symbol("_reading"),cc=Symbol("_remain"),Ev=Symbol("_size"),Vp=Symbol("_write"),Ci=Symbol("_writing"),Gp=Symbol("_defaultFlag"),ki=Symbol("_errored"),Ai=class extends qt{[ki]=!1;[ve];[$r];[xv];[$n]=!1;[Ev];[cc];[ko];constructor(e,r){if(r=r||{},super(r),this.readable=!0,this.writable=!1,typeof e!="string")throw new TypeError("path must be a string");this[ki]=!1,this[ve]=typeof r.fd=="number"?r.fd:void 0,this[$r]=e,this[xv]=r.readSize||16*1024*1024,this[$n]=!1,this[Ev]=typeof r.size=="number"?r.size:1/0,this[cc]=this[Ev],this[ko]=typeof r.autoClose=="boolean"?r.autoClose:!0,typeof this[ve]=="number"?this[ra]():this[Ao]()}get fd(){return this[ve]}get path(){return this[$r]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[Ao](){_t.default.open(this[$r],"r",(e,r)=>this[oa](e,r))}[oa](e,r){e?this[na](e):(this[ve]=r,this.emit("open",r),this[ra]())}[Iv](){return Buffer.allocUnsafe(Math.min(this[xv],this[cc]))}[ra](){if(!this[$n]){this[$n]=!0;let e=this[Iv]();if(e.length===0)return process.nextTick(()=>this[wv](null,0,e));_t.default.read(this[ve],e,0,e.length,null,(r,n,o)=>this[wv](r,n,o))}}[wv](e,r,n){this[$n]=!1,e?this[na](e):this[Sv](r,n)&&this[ra]()}[Mr](){if(this[ko]&&typeof this[ve]=="number"){let e=this[ve];this[ve]=void 0,_t.default.close(e,r=>r?this.emit("error",r):this.emit("close"))}}[na](e){this[$n]=!0,this[Mr](),this.emit("error",e)}[Sv](e,r){let n=!1;return this[cc]-=e,e>0&&(n=super.write(e<r.length?r.subarray(0,e):r)),(e===0||this[cc]<=0)&&(n=!1,this[Mr](),super.end()),n}emit(e,...r){switch(e){case"prefinish":case"finish":return!1;case"drain":return typeof this[ve]=="number"&&this[ra](),!1;case"error":return this[ki]?!1:(this[ki]=!0,super.emit(e,...r));default:return super.emit(e,...r)}}},Zp=class extends Ai{[Ao](){let e=!0;try{this[oa](null,_t.default.openSync(this[$r],"r")),e=!1}finally{e&&this[Mr]()}}[ra](){let e=!0;try{if(!this[$n]){this[$n]=!0;do{let r=this[Iv](),n=r.length===0?0:_t.default.readSync(this[ve],r,0,r.length,null);if(!this[Sv](n,r))break}while(!0);this[$n]=!1}e=!1}finally{e&&this[Mr]()}}[Mr](){if(this[ko]&&typeof this[ve]=="number"){let e=this[ve];this[ve]=void 0,_t.default.closeSync(e),this.emit("close")}}},Ln=class extends iR.default{readable=!1;writable=!0;[ki]=!1;[Ci]=!1;[lc]=!1;[fn]=[];[Kp]=!1;[$r];[uc];[ko];[ve];[Gp];[Mn];[bv]=!1;[Co];constructor(e,r){r=r||{},super(r),this[$r]=e,this[ve]=typeof r.fd=="number"?r.fd:void 0,this[uc]=r.mode===void 0?438:r.mode,this[Co]=typeof r.start=="number"?r.start:void 0,this[ko]=typeof r.autoClose=="boolean"?r.autoClose:!0;let n=this[Co]!==void 0?"r+":"w";this[Gp]=r.flags===void 0,this[Mn]=r.flags===void 0?n:r.flags,this[ve]===void 0&&this[Ao]()}emit(e,...r){if(e==="error"){if(this[ki])return!1;this[ki]=!0}return super.emit(e,...r)}get fd(){return this[ve]}get path(){return this[$r]}[na](e){this[Mr](),this[Ci]=!0,this.emit("error",e)}[Ao](){_t.default.open(this[$r],this[Mn],this[uc],(e,r)=>this[oa](e,r))}[oa](e,r){this[Gp]&&this[Mn]==="r+"&&e&&e.code==="ENOENT"?(this[Mn]="w",this[Ao]()):e?this[na](e):(this[ve]=r,this.emit("open",r),this[Ci]||this[vv]())}end(e,r){return e&&this.write(e,r),this[lc]=!0,!this[Ci]&&!this[fn].length&&typeof this[ve]=="number"&&this[ta](null,0),this}write(e,r){return typeof e=="string"&&(e=Buffer.from(e,r)),this[lc]?(this.emit("error",new Error("write() after end()")),!1):this[ve]===void 0||this[Ci]||this[fn].length?(this[fn].push(e),this[Kp]=!0,!1):(this[Ci]=!0,this[Vp](e),!0)}[Vp](e){_t.default.write(this[ve],e,0,e.length,this[Co],(r,n)=>this[ta](r,n))}[ta](e,r){e?this[na](e):(this[Co]!==void 0&&typeof r=="number"&&(this[Co]+=r),this[fn].length?this[vv]():(this[Ci]=!1,this[lc]&&!this[bv]?(this[bv]=!0,this[Mr](),this.emit("finish")):this[Kp]&&(this[Kp]=!1,this.emit("drain"))))}[vv](){if(this[fn].length===0)this[lc]&&this[ta](null,0);else if(this[fn].length===1)this[Vp](this[fn].pop());else{let e=this[fn];this[fn]=[],tH(this[ve],e,this[Co],(r,n)=>this[ta](r,n))}}[Mr](){if(this[ko]&&typeof this[ve]=="number"){let e=this[ve];this[ve]=void 0,_t.default.close(e,r=>r?this.emit("error",r):this.emit("close"))}}},ia=class extends Ln{[Ao](){let e;if(this[Gp]&&this[Mn]==="r+")try{e=_t.default.openSync(this[$r],this[Mn],this[uc])}catch(r){if(r?.code==="ENOENT")return this[Mn]="w",this[Ao]();throw r}else e=_t.default.openSync(this[$r],this[Mn],this[uc]);this[oa](null,e)}[Mr](){if(this[ko]&&typeof this[ve]=="number"){let e=this[ve];this[ve]=void 0,_t.default.closeSync(e),this.emit("close")}}[Vp](e){let r=!0;try{this[ta](null,_t.default.writeSync(this[ve],e,0,e.length,this[Co])),r=!1}finally{if(r)try{this[Mr]()}catch{}}}};var Qv=Y(require("node:path"),1);a();var ji=Y(require("node:fs"),1),pd=require("path");a();a();var rH=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),sR=t=>!!t.sync&&!!t.file,aR=t=>!t.sync&&!!t.file,lR=t=>!!t.sync&&!t.file,cR=t=>!t.sync&&!t.file;var uR=t=>!!t.file;var nH=t=>{let e=rH.get(t);return e||t},fc=(t={})=>{if(!t)return{};let e={};for(let[r,n]of Object.entries(t)){let o=nH(r);e[o]=n}return e.chmod===void 0&&e.noChmod===!1&&(e.chmod=!0),delete e.noChmod,e};var pn=(t,e,r,n,o)=>Object.assign((i=[],s,l)=>{Array.isArray(i)&&(s=i,i={}),typeof s=="function"&&(l=s,s=void 0),s?s=Array.from(s):s=[];let c=fc(i);if(o?.(c,s),sR(c)){if(typeof l=="function")throw new TypeError("callback not supported for sync tar functions");return t(c,s)}else if(aR(c)){let f=e(c,s),u=l||void 0;return u?f.then(()=>u(),u):f}else if(lR(c)){if(typeof l=="function")throw new TypeError("callback not supported for sync tar functions");return r(c,s)}else if(cR(c)){if(typeof l=="function")throw new TypeError("callback only supported with file option");return n(c,s)}else throw new Error("impossible options??")},{syncFile:t,asyncFile:e,syncNoFile:r,asyncNoFile:n,validate:o});a();var OR=require("events");a();var Jp=Y(require("assert"),1),qn=require("buffer");var dR=Y(require("zlib"),1);a();var fR=Y(require("zlib"),1),oH=fR.default.constants||{ZLIB_VERNUM:4736},jn=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},oH));var pR=qn.Buffer.concat,Ri=Symbol("_superWrite"),sa=class extends Error{code;errno;constructor(e){super("zlib: "+e.message),this.code=e.code,this.errno=e.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+e.message,Error.captureStackTrace(this,this.constructor)}get name(){return"ZlibError"}},Ov=Symbol("flushFlag"),Yp=class extends qt{#e=!1;#t=!1;#n;#o;#i;#r;#s;get sawError(){return this.#e}get handle(){return this.#r}get flushFlag(){return this.#n}constructor(e,r){if(!e||typeof e!="object")throw new TypeError("invalid options for ZlibBase constructor");super(e),this.#n=e.flush??0,this.#o=e.finishFlush??0,this.#i=e.fullFlushFlag??0;try{this.#r=new dR.default[r](e)}catch(n){throw new sa(n)}this.#s=n=>{this.#e||(this.#e=!0,this.close(),this.emit("error",n))},this.#r?.on("error",n=>this.#s(new sa(n))),this.once("end",()=>this.close)}close(){this.#r&&(this.#r.close(),this.#r=void 0,this.emit("close"))}reset(){if(!this.#e)return(0,Jp.default)(this.#r,"zlib binding closed"),this.#r.reset?.()}flush(e){this.ended||(typeof e!="number"&&(e=this.#i),this.write(Object.assign(qn.Buffer.alloc(0),{[Ov]:e})))}end(e,r,n){return typeof e=="function"&&(n=e,r=void 0,e=void 0),typeof r=="function"&&(n=r,r=void 0),e&&(r?this.write(e,r):this.write(e)),this.flush(this.#o),this.#t=!0,super.end(n)}get ended(){return this.#t}[Ri](e){return super.write(e)}write(e,r,n){if(typeof r=="function"&&(n=r,r="utf8"),typeof e=="string"&&(e=qn.Buffer.from(e,r)),this.#e)return;(0,Jp.default)(this.#r,"zlib binding closed");let o=this.#r._handle,i=o.close;o.close=()=>{};let s=this.#r.close;this.#r.close=()=>{},qn.Buffer.concat=f=>f;let l;try{let f=typeof e[Ov]=="number"?e[Ov]:this.#n;l=this.#r._processChunk(e,f),qn.Buffer.concat=pR}catch(f){qn.Buffer.concat=pR,this.#s(new sa(f))}finally{this.#r&&(this.#r._handle=o,o.close=i,this.#r.close=s,this.#r.removeAllListeners("error"))}this.#r&&this.#r.on("error",f=>this.#s(new sa(f)));let c;if(l)if(Array.isArray(l)&&l.length>0){let f=l[0];c=this[Ri](qn.Buffer.from(f));for(let u=1;u<l.length;u++)c=this[Ri](l[u])}else c=this[Ri](qn.Buffer.from(l));return n&&n(),c}},Xp=class extends Yp{#e;#t;constructor(e,r){e=e||{},e.flush=e.flush||jn.Z_NO_FLUSH,e.finishFlush=e.finishFlush||jn.Z_FINISH,e.fullFlushFlag=jn.Z_FULL_FLUSH,super(e,r),this.#e=e.level,this.#t=e.strategy}params(e,r){if(!this.sawError){if(!this.handle)throw new Error("cannot switch params when binding is closed");if(!this.handle.params)throw new Error("not supported in this implementation");if(this.#e!==e||this.#t!==r){this.flush(jn.Z_SYNC_FLUSH),(0,Jp.default)(this.handle,"zlib binding closed");let n=this.handle.flush;this.handle.flush=(o,i)=>{typeof o=="function"&&(i=o,o=this.flushFlag),this.flush(o),i?.()};try{this.handle.params(e,r)}finally{this.handle.flush=n}this.handle&&(this.#e=e,this.#t=r)}}}};var Qp=class extends Xp{#e;constructor(e){super(e,"Gzip"),this.#e=e&&!!e.portable}[Ri](e){return this.#e?(this.#e=!1,e[9]=255,super[Ri](e)):super[Ri](e)}};var ed=class extends Xp{constructor(e){super(e,"Unzip")}},td=class extends Yp{constructor(e,r){e=e||{},e.flush=e.flush||jn.BROTLI_OPERATION_PROCESS,e.finishFlush=e.finishFlush||jn.BROTLI_OPERATION_FINISH,e.fullFlushFlag=jn.BROTLI_OPERATION_FLUSH,super(e,r)}},rd=class extends td{constructor(e){super(e,"BrotliCompress")}},nd=class extends td{constructor(e){super(e,"BrotliDecompress")}};a();var vr=class{tail;head;length=0;static create(e=[]){return new vr(e)}constructor(e=[]){for(let r of e)this.push(r)}*[Symbol.iterator](){for(let e=this.head;e;e=e.next)yield e.value}removeNode(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");let r=e.next,n=e.prev;return r&&(r.prev=n),n&&(n.next=r),e===this.head&&(this.head=r),e===this.tail&&(this.tail=n),this.length--,e.next=void 0,e.prev=void 0,e.list=void 0,r}unshiftNode(e){if(e===this.head)return;e.list&&e.list.removeNode(e);let r=this.head;e.list=this,e.next=r,r&&(r.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}pushNode(e){if(e===this.tail)return;e.list&&e.list.removeNode(e);let r=this.tail;e.list=this,e.prev=r,r&&(r.next=e),this.tail=e,this.head||(this.head=e),this.length++}push(...e){for(let r=0,n=e.length;r<n;r++)aH(this,e[r]);return this.length}unshift(...e){for(var r=0,n=e.length;r<n;r++)lH(this,e[r]);return this.length}pop(){if(!this.tail)return;let e=this.tail.value,r=this.tail;return this.tail=this.tail.prev,this.tail?this.tail.next=void 0:this.head=void 0,r.list=void 0,this.length--,e}shift(){if(!this.head)return;let e=this.head.value,r=this.head;return this.head=this.head.next,this.head?this.head.prev=void 0:this.tail=void 0,r.list=void 0,this.length--,e}forEach(e,r){r=r||this;for(let n=this.head,o=0;n;o++)e.call(r,n.value,o,this),n=n.next}forEachReverse(e,r){r=r||this;for(let n=this.tail,o=this.length-1;n;o--)e.call(r,n.value,o,this),n=n.prev}get(e){let r=0,n=this.head;for(;n&&r<e;r++)n=n.next;if(r===e&&n)return n.value}getReverse(e){let r=0,n=this.tail;for(;n&&r<e;r++)n=n.prev;if(r===e&&n)return n.value}map(e,r){r=r||this;let n=new vr;for(let o=this.head;o;)n.push(e.call(r,o.value,this)),o=o.next;return n}mapReverse(e,r){r=r||this;var n=new vr;for(let o=this.tail;o;)n.push(e.call(r,o.value,this)),o=o.prev;return n}reduce(e,r){let n,o=this.head;if(arguments.length>1)n=r;else if(this.head)o=this.head.next,n=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var i=0;o;i++)n=e(n,o.value,i),o=o.next;return n}reduceReverse(e,r){let n,o=this.tail;if(arguments.length>1)n=r;else if(this.tail)o=this.tail.prev,n=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(let i=this.length-1;o;i--)n=e(n,o.value,i),o=o.prev;return n}toArray(){let e=new Array(this.length);for(let r=0,n=this.head;n;r++)e[r]=n.value,n=n.next;return e}toArrayReverse(){let e=new Array(this.length);for(let r=0,n=this.tail;n;r++)e[r]=n.value,n=n.prev;return e}slice(e=0,r=this.length){r<0&&(r+=this.length),e<0&&(e+=this.length);let n=new vr;if(r<e||r<0)return n;e<0&&(e=0),r>this.length&&(r=this.length);let o=this.head,i=0;for(i=0;o&&i<e;i++)o=o.next;for(;o&&i<r;i++,o=o.next)n.push(o.value);return n}sliceReverse(e=0,r=this.length){r<0&&(r+=this.length),e<0&&(e+=this.length);let n=new vr;if(r<e||r<0)return n;e<0&&(e=0),r>this.length&&(r=this.length);let o=this.length,i=this.tail;for(;i&&o>r;o--)i=i.prev;for(;i&&o>e;o--,i=i.prev)n.push(i.value);return n}splice(e,r=0,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);let o=this.head;for(let s=0;o&&s<e;s++)o=o.next;let i=[];for(let s=0;o&&s<r;s++)i.push(o.value),o=this.removeNode(o);o?o!==this.tail&&(o=o.prev):o=this.tail;for(let s of n)o=sH(this,o,s);return i}reverse(){let e=this.head,r=this.tail;for(let n=e;n;n=n.prev){let o=n.prev;n.prev=n.next,n.next=o}return this.head=r,this.tail=e,this}};function sH(t,e,r){let n=e,o=e?e.next:t.head,i=new pc(r,n,o,t);return i.next===void 0&&(t.tail=i),i.prev===void 0&&(t.head=i),t.length++,i}function aH(t,e){t.tail=new pc(e,t.tail,void 0,t),t.head||(t.head=t.tail),t.length++}function lH(t,e){t.head=new pc(e,void 0,t.head,t),t.tail||(t.tail=t.head),t.length++}var pc=class{list;next;prev;value;constructor(e,r,n,o){this.list=o,this.value=e,r?(r.next=this,this.prev=r):this.prev=void 0,n?(n.prev=this,this.next=n):this.next=void 0}};a();var Pi=require("node:path");a();var mR=(t,e)=>{if(Number.isSafeInteger(t))t<0?uH(t,e):cH(t,e);else throw Error("cannot encode number outside of javascript safe integer range");return e},cH=(t,e)=>{e[0]=128;for(var r=e.length;r>1;r--)e[r-1]=t&255,t=Math.floor(t/256)},uH=(t,e)=>{e[0]=255;var r=!1;t=t*-1;for(var n=e.length;n>1;n--){var o=t&255;t=Math.floor(t/256),r?e[n-1]=gR(o):o===0?e[n-1]=0:(r=!0,e[n-1]=yR(o))}},hR=t=>{let e=t[0],r=e===128?pH(t.subarray(1,t.length)):e===255?fH(t):null;if(r===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(r))throw Error("parsed number outside of javascript safe integer range");return r},fH=t=>{for(var e=t.length,r=0,n=!1,o=e-1;o>-1;o--){var i=Number(t[o]),s;n?s=gR(i):i===0?s=i:(n=!0,s=yR(i)),s!==0&&(r-=s*Math.pow(256,e-o-1))}return r},pH=t=>{for(var e=t.length,r=0,n=e-1;n>-1;n--){var o=Number(t[n]);o!==0&&(r+=o*Math.pow(256,e-n-1))}return r},gR=t=>(255^t)&255,yR=t=>(255^t)+1&255;a();var od=t=>id.has(t);var id=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),bR=new Map(Array.from(id).map(t=>[t[1],t[0]]));var tr=class{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#e="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(e,r=0,n,o){Buffer.isBuffer(e)?this.decode(e,r||0,n,o):e&&this.#t(e)}decode(e,r,n,o){if(r||(r=0),!e||!(e.length>=r+512))throw new Error("need 512 bytes for header");this.path=Ni(e,r,100),this.mode=Ro(e,r+100,8),this.uid=Ro(e,r+108,8),this.gid=Ro(e,r+116,8),this.size=Ro(e,r+124,12),this.mtime=Tv(e,r+136,12),this.cksum=Ro(e,r+148,12),o&&this.#t(o,!0),n&&this.#t(n);let i=Ni(e,r+156,1);if(od(i)&&(this.#e=i||"0"),this.#e==="0"&&this.path.slice(-1)==="/"&&(this.#e="5"),this.#e==="5"&&(this.size=0),this.linkpath=Ni(e,r+157,100),e.subarray(r+257,r+265).toString()==="ustar\x0000")if(this.uname=Ni(e,r+265,32),this.gname=Ni(e,r+297,32),this.devmaj=Ro(e,r+329,8)??0,this.devmin=Ro(e,r+337,8)??0,e[r+475]!==0){let l=Ni(e,r+345,155);this.path=l+"/"+this.path}else{let l=Ni(e,r+345,130);l&&(this.path=l+"/"+this.path),this.atime=Tv(e,r+476,12),this.ctime=Tv(e,r+488,12)}let s=8*32;for(let l=r;l<r+148;l++)s+=e[l];for(let l=r+156;l<r+512;l++)s+=e[l];this.cksumValid=s===this.cksum,this.cksum===void 0&&s===8*32&&(this.nullBlock=!0)}#t(e,r=!1){Object.assign(this,Object.fromEntries(Object.entries(e).filter(([n,o])=>!(o==null||n==="path"&&r||n==="linkpath"&&r||n==="global"))))}encode(e,r=0){if(e||(e=this.block=Buffer.alloc(512)),this.#e==="Unsupported"&&(this.#e="0"),!(e.length>=r+512))throw new Error("need 512 bytes for header");let n=this.ctime||this.atime?130:155,o=mH(this.path||"",n),i=o[0],s=o[1];this.needPax=!!o[2],this.needPax=Di(e,r,100,i)||this.needPax,this.needPax=No(e,r+100,8,this.mode)||this.needPax,this.needPax=No(e,r+108,8,this.uid)||this.needPax,this.needPax=No(e,r+116,8,this.gid)||this.needPax,this.needPax=No(e,r+124,12,this.size)||this.needPax,this.needPax=Cv(e,r+136,12,this.mtime)||this.needPax,e[r+156]=this.#e.charCodeAt(0),this.needPax=Di(e,r+157,100,this.linkpath)||this.needPax,e.write("ustar\x0000",r+257,8),this.needPax=Di(e,r+265,32,this.uname)||this.needPax,this.needPax=Di(e,r+297,32,this.gname)||this.needPax,this.needPax=No(e,r+329,8,this.devmaj)||this.needPax,this.needPax=No(e,r+337,8,this.devmin)||this.needPax,this.needPax=Di(e,r+345,n,s)||this.needPax,e[r+475]!==0?this.needPax=Di(e,r+345,155,s)||this.needPax:(this.needPax=Di(e,r+345,130,s)||this.needPax,this.needPax=Cv(e,r+476,12,this.atime)||this.needPax,this.needPax=Cv(e,r+488,12,this.ctime)||this.needPax);let l=8*32;for(let c=r;c<r+148;c++)l+=e[c];for(let c=r+156;c<r+512;c++)l+=e[c];return this.cksum=l,No(e,r+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return this.#e==="Unsupported"?this.#e:id.get(this.#e)}get typeKey(){return this.#e}set type(e){let r=String(bR.get(e));if(od(r)||r==="Unsupported")this.#e=r;else if(od(e))this.#e=e;else throw new TypeError("invalid entry type: "+e)}},mH=(t,e)=>{let n=t,o="",i,s=Pi.posix.parse(t).root||".";if(Buffer.byteLength(n)<100)i=[n,o,!1];else{o=Pi.posix.dirname(n),n=Pi.posix.basename(n);do Buffer.byteLength(n)<=100&&Buffer.byteLength(o)<=e?i=[n,o,!1]:Buffer.byteLength(n)>100&&Buffer.byteLength(o)<=e?i=[n.slice(0,100-1),o,!0]:(n=Pi.posix.join(Pi.posix.basename(o),n),o=Pi.posix.dirname(o));while(o!==s&&i===void 0);i||(i=[t.slice(0,100-1),"",!0])}return i},Ni=(t,e,r)=>t.subarray(e,e+r).toString("utf8").replace(/\0.*/,""),Tv=(t,e,r)=>hH(Ro(t,e,r)),hH=t=>t===void 0?void 0:new Date(t*1e3),Ro=(t,e,r)=>Number(t[e])&128?hR(t.subarray(e,e+r)):yH(t,e,r),gH=t=>isNaN(t)?void 0:t,yH=(t,e,r)=>gH(parseInt(t.subarray(e,e+r).toString("utf8").replace(/\0.*$/,"").trim(),8)),bH={12:8589934591,8:2097151},No=(t,e,r,n)=>n===void 0?!1:n>bH[r]||n<0?(mR(n,t.subarray(e,e+r)),!0):(vH(t,e,r,n),!1),vH=(t,e,r,n)=>t.write(wH(n,r),e,r,"ascii"),wH=(t,e)=>xH(Math.floor(t).toString(8),e),xH=(t,e)=>(t.length===e-1?t:new Array(e-t.length-1).join("0")+t+" ")+"\0",Cv=(t,e,r,n)=>n===void 0?!1:No(t,e,r,n.getTime()/1e3),EH=new Array(156).join("\0"),Di=(t,e,r,n)=>n===void 0?!1:(t.write(n+EH,e,r,"utf8"),n.length!==Buffer.byteLength(n)||n.length>r);a();var wR=require("node:path");var dn=class{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(e,r=!1){this.atime=e.atime,this.charset=e.charset,this.comment=e.comment,this.ctime=e.ctime,this.dev=e.dev,this.gid=e.gid,this.global=r,this.gname=e.gname,this.ino=e.ino,this.linkpath=e.linkpath,this.mtime=e.mtime,this.nlink=e.nlink,this.path=e.path,this.size=e.size,this.uid=e.uid,this.uname=e.uname}encode(){let e=this.encodeBody();if(e==="")return Buffer.allocUnsafe(0);let r=Buffer.byteLength(e),n=512*Math.ceil(1+r/512),o=Buffer.allocUnsafe(n);for(let i=0;i<512;i++)o[i]=0;new tr({path:("PaxHeader/"+(0,wR.basename)(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:r,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(o),o.write(e,512,r,"utf8");for(let i=r+512;i<o.length;i++)o[i]=0;return o}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(e){if(this[e]===void 0)return"";let r=this[e],n=r instanceof Date?r.getTime()/1e3:r,o=" "+(e==="dev"||e==="ino"||e==="nlink"?"SCHILY.":"")+e+"="+n+`
|
|
`,i=Buffer.byteLength(o),s=Math.floor(Math.log(i)/Math.log(10))+1;return i+s>=Math.pow(10,s)&&(s+=1),s+i+o}static parse(e,r,n=!1){return new dn(SH(IH(e),r),n)}},SH=(t,e)=>e?Object.assign({},e,t):t,IH=t=>t.replace(/\n$/,"").split(`
|
|
`).reduce(_H,Object.create(null)),_H=(t,e)=>{let r=parseInt(e,10);if(r!==Buffer.byteLength(e)+1)return t;e=e.slice((r+" ").length);let n=e.split("="),o=n.shift();if(!o)return t;let i=o.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),s=n.join("=");return t[i]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(i)?new Date(Number(s)*1e3):/^[0-9]+$/.test(s)?+s:s,t};a();a();var OH=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,ne=OH!=="win32"?t=>t:t=>t&&t.replace(/\\/g,"/");var aa=class extends qt{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(e,r,n){switch(super({}),this.pause(),this.extended=r,this.globalExtended=n,this.header=e,this.remain=e.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=e.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!e.path)throw new Error("no path provided for tar.ReadEntry");this.path=ne(e.path),this.mode=e.mode,this.mode&&(this.mode=this.mode&4095),this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,this.size=this.remain,this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime,this.linkpath=e.linkpath?ne(e.linkpath):void 0,this.uname=e.uname,this.gname=e.gname,r&&this.#e(r),n&&this.#e(n,!0)}write(e){let r=e.length;if(r>this.blockRemain)throw new Error("writing more to entry than is appropriate");let n=this.remain,o=this.blockRemain;return this.remain=Math.max(0,n-r),this.blockRemain=Math.max(0,o-r),this.ignore?!0:n>=r?super.write(e):super.write(e.subarray(0,n))}#e(e,r=!1){e.path&&(e.path=ne(e.path)),e.linkpath&&(e.linkpath=ne(e.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(e).filter(([n,o])=>!(o==null||n==="path"&&r))))}};a();var Fi=(t,e,r,n={})=>{t.file&&(n.file=t.file),t.cwd&&(n.cwd=t.cwd),n.code=r instanceof Error&&r.code||e,n.tarCode=e,!t.strict&&n.recoverable!==!1?(r instanceof Error&&(n=Object.assign(r,n),r=r.message),t.emit("warn",e,r,n)):r instanceof Error?t.emit("error",Object.assign(r,n)):t.emit("error",Object.assign(new Error(`${e}: ${r}`),n))};var TH=1024*1024,kv=Buffer.from([31,139]),wr=Symbol("state"),$i=Symbol("writeEntry"),Bn=Symbol("readEntry"),Av=Symbol("nextEntry"),xR=Symbol("processEntry"),mn=Symbol("extendedHeader"),dc=Symbol("globalExtendedHeader"),Do=Symbol("meta"),ER=Symbol("emitMeta"),_e=Symbol("buffer"),zn=Symbol("queue"),Po=Symbol("ended"),Rv=Symbol("emittedEnd"),Mi=Symbol("emit"),Ge=Symbol("unzip"),sd=Symbol("consumeChunk"),ad=Symbol("consumeChunkSub"),Nv=Symbol("consumeBody"),SR=Symbol("consumeMeta"),IR=Symbol("consumeHeader"),mc=Symbol("consuming"),Dv=Symbol("bufferConcat"),ld=Symbol("maybeEnd"),la=Symbol("writing"),Fo=Symbol("aborted"),cd=Symbol("onDone"),Li=Symbol("sawValidEntry"),ud=Symbol("sawNullBlock"),fd=Symbol("sawEOF"),_R=Symbol("closeStream"),CH=()=>!0,Un=class extends OR.EventEmitter{file;strict;maxMetaEntrySize;filter;brotli;writable=!0;readable=!1;[zn]=new vr;[_e];[Bn];[$i];[wr]="begin";[Do]="";[mn];[dc];[Po]=!1;[Ge];[Fo]=!1;[Li];[ud]=!1;[fd]=!1;[la]=!1;[mc]=!1;[Rv]=!1;constructor(e={}){super(),this.file=e.file||"",this.on(cd,()=>{(this[wr]==="begin"||this[Li]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),e.ondone?this.on(cd,e.ondone):this.on(cd,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!e.strict,this.maxMetaEntrySize=e.maxMetaEntrySize||TH,this.filter=typeof e.filter=="function"?e.filter:CH;let r=e.file&&(e.file.endsWith(".tar.br")||e.file.endsWith(".tbr"));this.brotli=!e.gzip&&e.brotli!==void 0?e.brotli:r?void 0:!1,this.on("end",()=>this[_R]()),typeof e.onwarn=="function"&&this.on("warn",e.onwarn),typeof e.onReadEntry=="function"&&this.on("entry",e.onReadEntry)}warn(e,r,n={}){Fi(this,e,r,n)}[IR](e,r){this[Li]===void 0&&(this[Li]=!1);let n;try{n=new tr(e,r,this[mn],this[dc])}catch(o){return this.warn("TAR_ENTRY_INVALID",o)}if(n.nullBlock)this[ud]?(this[fd]=!0,this[wr]==="begin"&&(this[wr]="header"),this[Mi]("eof")):(this[ud]=!0,this[Mi]("nullBlock"));else if(this[ud]=!1,!n.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:n});else if(!n.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:n});else{let o=n.type;if(/^(Symbolic)?Link$/.test(o)&&!n.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:n});else if(!/^(Symbolic)?Link$/.test(o)&&!/^(Global)?ExtendedHeader$/.test(o)&&n.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:n});else{let i=this[$i]=new aa(n,this[mn],this[dc]);if(!this[Li])if(i.remain){let s=()=>{i.invalid||(this[Li]=!0)};i.on("end",s)}else this[Li]=!0;i.meta?i.size>this.maxMetaEntrySize?(i.ignore=!0,this[Mi]("ignoredEntry",i),this[wr]="ignore",i.resume()):i.size>0&&(this[Do]="",i.on("data",s=>this[Do]+=s),this[wr]="meta"):(this[mn]=void 0,i.ignore=i.ignore||!this.filter(i.path,i),i.ignore?(this[Mi]("ignoredEntry",i),this[wr]=i.remain?"ignore":"header",i.resume()):(i.remain?this[wr]="body":(this[wr]="header",i.end()),this[Bn]?this[zn].push(i):(this[zn].push(i),this[Av]())))}}}[_R](){queueMicrotask(()=>this.emit("close"))}[xR](e){let r=!0;if(!e)this[Bn]=void 0,r=!1;else if(Array.isArray(e)){let[n,...o]=e;this.emit(n,...o)}else this[Bn]=e,this.emit("entry",e),e.emittedEnd||(e.on("end",()=>this[Av]()),r=!1);return r}[Av](){do;while(this[xR](this[zn].shift()));if(!this[zn].length){let e=this[Bn];!e||e.flowing||e.size===e.remain?this[la]||this.emit("drain"):e.once("drain",()=>this.emit("drain"))}}[Nv](e,r){let n=this[$i];if(!n)throw new Error("attempt to consume body without entry??");let o=n.blockRemain??0,i=o>=e.length&&r===0?e:e.subarray(r,r+o);return n.write(i),n.blockRemain||(this[wr]="header",this[$i]=void 0,n.end()),i.length}[SR](e,r){let n=this[$i],o=this[Nv](e,r);return!this[$i]&&n&&this[ER](n),o}[Mi](e,r,n){!this[zn].length&&!this[Bn]?this.emit(e,r,n):this[zn].push([e,r,n])}[ER](e){switch(this[Mi]("meta",this[Do]),e.type){case"ExtendedHeader":case"OldExtendedHeader":this[mn]=dn.parse(this[Do],this[mn],!1);break;case"GlobalExtendedHeader":this[dc]=dn.parse(this[Do],this[dc],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let r=this[mn]??Object.create(null);this[mn]=r,r.path=this[Do].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let r=this[mn]||Object.create(null);this[mn]=r,r.linkpath=this[Do].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+e.type)}}abort(e){this[Fo]=!0,this.emit("abort",e),this.warn("TAR_ABORT",e,{recoverable:!1})}write(e,r,n){if(typeof r=="function"&&(n=r,r=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof r=="string"?r:"utf8")),this[Fo])return n?.(),!1;if((this[Ge]===void 0||this.brotli===void 0&&this[Ge]===!1)&&e){if(this[_e]&&(e=Buffer.concat([this[_e],e]),this[_e]=void 0),e.length<kv.length)return this[_e]=e,n?.(),!0;for(let l=0;this[Ge]===void 0&&l<kv.length;l++)e[l]!==kv[l]&&(this[Ge]=!1);let s=this.brotli===void 0;if(this[Ge]===!1&&s)if(e.length<512)if(this[Po])this.brotli=!0;else return this[_e]=e,n?.(),!0;else try{new tr(e.subarray(0,512)),this.brotli=!1}catch{this.brotli=!0}if(this[Ge]===void 0||this[Ge]===!1&&this.brotli){let l=this[Po];this[Po]=!1,this[Ge]=this[Ge]===void 0?new ed({}):new nd({}),this[Ge].on("data",f=>this[sd](f)),this[Ge].on("error",f=>this.abort(f)),this[Ge].on("end",()=>{this[Po]=!0,this[sd]()}),this[la]=!0;let c=!!this[Ge][l?"end":"write"](e);return this[la]=!1,n?.(),c}}this[la]=!0,this[Ge]?this[Ge].write(e):this[sd](e),this[la]=!1;let i=this[zn].length?!1:this[Bn]?this[Bn].flowing:!0;return!i&&!this[zn].length&&this[Bn]?.once("drain",()=>this.emit("drain")),n?.(),i}[Dv](e){e&&!this[Fo]&&(this[_e]=this[_e]?Buffer.concat([this[_e],e]):e)}[ld](){if(this[Po]&&!this[Rv]&&!this[Fo]&&!this[mc]){this[Rv]=!0;let e=this[$i];if(e&&e.blockRemain){let r=this[_e]?this[_e].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${e.blockRemain} more bytes, only ${r} available)`,{entry:e}),this[_e]&&e.write(this[_e]),e.end()}this[Mi](cd)}}[sd](e){if(this[mc]&&e)this[Dv](e);else if(!e&&!this[_e])this[ld]();else if(e){if(this[mc]=!0,this[_e]){this[Dv](e);let r=this[_e];this[_e]=void 0,this[ad](r)}else this[ad](e);for(;this[_e]&&this[_e]?.length>=512&&!this[Fo]&&!this[fd];){let r=this[_e];this[_e]=void 0,this[ad](r)}this[mc]=!1}(!this[_e]||this[Po])&&this[ld]()}[ad](e){let r=0,n=e.length;for(;r+512<=n&&!this[Fo]&&!this[fd];)switch(this[wr]){case"begin":case"header":this[IR](e,r),r+=512;break;case"ignore":case"body":r+=this[Nv](e,r);break;case"meta":r+=this[SR](e,r);break;default:throw new Error("invalid state: "+this[wr])}r<n&&(this[_e]?this[_e]=Buffer.concat([e.subarray(r),this[_e]]):this[_e]=e.subarray(r))}end(e,r,n){return typeof e=="function"&&(n=e,r=void 0,e=void 0),typeof r=="function"&&(n=r,r=void 0),typeof e=="string"&&(e=Buffer.from(e,r)),n&&this.once("finish",n),this[Fo]||(this[Ge]?(e&&this[Ge].write(e),this[Ge].end()):(this[Po]=!0,this.brotli===void 0&&(e=e||Buffer.alloc(0)),e&&this.write(e),this[ld]())),this}};a();var hn=t=>{let e=t.length-1,r=-1;for(;e>-1&&t.charAt(e)==="/";)r=e,e--;return r===-1?t:t.slice(0,r)};var kH=t=>{let e=t.onReadEntry;t.onReadEntry=e?r=>{e(r),r.resume()}:r=>r.resume()},Pv=(t,e)=>{let r=new Map(e.map(i=>[hn(i),!0])),n=t.filter,o=(i,s="")=>{let l=s||(0,pd.parse)(i).root||".",c;if(i===l)c=!1;else{let f=r.get(i);f!==void 0?c=f:c=o((0,pd.dirname)(i),l)}return r.set(i,c),c};t.filter=n?(i,s)=>n(i,s)&&o(hn(i)):i=>o(hn(i))},AH=t=>{let e=new Un(t),r=t.file,n;try{let o=ji.default.statSync(r),i=t.maxReadSize||16*1024*1024;if(o.size<i)e.end(ji.default.readFileSync(r));else{let s=0,l=Buffer.allocUnsafe(i);for(n=ji.default.openSync(r,"r");s<o.size;){let c=ji.default.readSync(n,l,0,i,s);s+=c,e.write(l.subarray(0,c))}e.end()}}finally{if(typeof n=="number")try{ji.default.closeSync(n)}catch{}}},RH=(t,e)=>{let r=new Un(t),n=t.maxReadSize||16*1024*1024,o=t.file;return new Promise((s,l)=>{r.on("error",l),r.on("end",s),ji.default.stat(o,(c,f)=>{if(c)l(c);else{let u=new Ai(o,{readSize:n,size:f.size});u.on("error",l),u.pipe(r)}})})},Wn=pn(AH,RH,t=>new Un(t),t=>new Un(t),(t,e)=>{e?.length&&Pv(t,e),t.noResume||kH(t)});a();var wc=Y(require("fs"),1);a();var Lr=Y(require("fs"),1);var jv=Y(require("path"),1);a();var Fv=(t,e,r)=>(t&=4095,r&&(t=(t|384)&-19),e&&(t&256&&(t|=64),t&32&&(t|=8),t&4&&(t|=1)),t);a();var CR=require("node:path"),{isAbsolute:NH,parse:TR}=CR.win32,hc=t=>{let e="",r=TR(t);for(;NH(t)||r.root;){let n=t.charAt(0)==="/"&&t.slice(0,4)!=="//?/"?"/":r.root;t=t.slice(n.length),e+=n,r=TR(t)}return[e,t]};a();var dd=["|","<",">","?",":"],$v=dd.map(t=>String.fromCharCode(61440+t.charCodeAt(0))),DH=new Map(dd.map((t,e)=>[t,$v[e]])),PH=new Map($v.map((t,e)=>[t,dd[e]])),Mv=t=>dd.reduce((e,r)=>e.split(r).join(DH.get(r)),t),kR=t=>$v.reduce((e,r)=>e.split(r).join(PH.get(r)),t);var FR=(t,e)=>e?(t=ne(t).replace(/^\.(\/|$)/,""),hn(e)+"/"+t):ne(t),FH=16*1024*1024,RR=Symbol("process"),NR=Symbol("file"),DR=Symbol("directory"),qv=Symbol("symlink"),PR=Symbol("hardlink"),gc=Symbol("header"),md=Symbol("read"),Bv=Symbol("lstat"),hd=Symbol("onlstat"),zv=Symbol("onread"),Uv=Symbol("onreadlink"),Wv=Symbol("openfile"),Hv=Symbol("onopenfile"),$o=Symbol("close"),gd=Symbol("mode"),Kv=Symbol("awaitDrain"),Lv=Symbol("ondrain"),gn=Symbol("prefix"),yc=class extends qt{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;#e=!1;constructor(e,r={}){let n=fc(r);super(),this.path=ne(e),this.portable=!!n.portable,this.maxReadSize=n.maxReadSize||FH,this.linkCache=n.linkCache||new Map,this.statCache=n.statCache||new Map,this.preservePaths=!!n.preservePaths,this.cwd=ne(n.cwd||process.cwd()),this.strict=!!n.strict,this.noPax=!!n.noPax,this.noMtime=!!n.noMtime,this.mtime=n.mtime,this.prefix=n.prefix?ne(n.prefix):void 0,typeof n.onwarn=="function"&&this.on("warn",n.onwarn);let o=!1;if(!this.preservePaths){let[s,l]=hc(this.path);s&&typeof l=="string"&&(this.path=l,o=s)}this.win32=!!n.win32||process.platform==="win32",this.win32&&(this.path=kR(this.path.replace(/\\/g,"/")),e=e.replace(/\\/g,"/")),this.absolute=ne(n.absolute||jv.default.resolve(this.cwd,e)),this.path===""&&(this.path="./"),o&&this.warn("TAR_ENTRY_INFO",`stripping ${o} from absolute path`,{entry:this,path:o+this.path});let i=this.statCache.get(this.absolute);i?this[hd](i):this[Bv]()}warn(e,r,n={}){return Fi(this,e,r,n)}emit(e,...r){return e==="error"&&(this.#e=!0),super.emit(e,...r)}[Bv](){Lr.default.lstat(this.absolute,(e,r)=>{if(e)return this.emit("error",e);this[hd](r)})}[hd](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=$H(e),this.emit("stat",e),this[RR]()}[RR](){switch(this.type){case"File":return this[NR]();case"Directory":return this[DR]();case"SymbolicLink":return this[qv]();default:return this.end()}}[gd](e){return Fv(e,this.type==="Directory",this.portable)}[gn](e){return FR(e,this.prefix)}[gc](){if(!this.stat)throw new Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.header=new tr({path:this[gn](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[gn](this.linkpath):this.linkpath,mode:this[gd](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new dn({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[gn](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[gn](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let e=this.header?.block;if(!e)throw new Error("failed to encode header");super.write(e)}[DR](){if(!this.stat)throw new Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[gc](),this.end()}[qv](){Lr.default.readlink(this.absolute,(e,r)=>{if(e)return this.emit("error",e);this[Uv](r)})}[Uv](e){this.linkpath=ne(e),this[gc](),this.end()}[PR](e){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=ne(jv.default.relative(this.cwd,e)),this.stat.size=0,this[gc](),this.end()}[NR](){if(!this.stat)throw new Error("cannot create file entry without stat");if(this.stat.nlink>1){let e=`${this.stat.dev}:${this.stat.ino}`,r=this.linkCache.get(e);if(r?.indexOf(this.cwd)===0)return this[PR](r);this.linkCache.set(e,this.absolute)}if(this[gc](),this.stat.size===0)return this.end();this[Wv]()}[Wv](){Lr.default.open(this.absolute,"r",(e,r)=>{if(e)return this.emit("error",e);this[Hv](r)})}[Hv](e){if(this.fd=e,this.#e)return this[$o]();if(!this.stat)throw new Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let r=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(r),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[md]()}[md](){let{fd:e,buf:r,offset:n,length:o,pos:i}=this;if(e===void 0||r===void 0)throw new Error("cannot read file without first opening");Lr.default.read(e,r,n,o,i,(s,l)=>{if(s)return this[$o](()=>this.emit("error",s));this[zv](l)})}[$o](e=()=>{}){this.fd!==void 0&&Lr.default.close(this.fd,e)}[zv](e){if(e<=0&&this.remain>0){let o=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[$o](()=>this.emit("error",o))}if(e>this.remain){let o=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[$o](()=>this.emit("error",o))}if(!this.buf)throw new Error("should have created buffer prior to reading");if(e===this.remain)for(let o=e;o<this.length&&e<this.blockRemain;o++)this.buf[o+this.offset]=0,e++,this.remain++;let r=this.offset===0&&e===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+e);this.write(r)?this[Lv]():this[Kv](()=>this[Lv]())}[Kv](e){this.once("drain",e)}write(e,r,n){if(typeof r=="function"&&(n=r,r=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof r=="string"?r:"utf8")),this.blockRemain<e.length){let o=Object.assign(new Error("writing more data than expected"),{path:this.absolute});return this.emit("error",o)}return this.remain-=e.length,this.blockRemain-=e.length,this.pos+=e.length,this.offset+=e.length,super.write(e,null,n)}[Lv](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[$o](e=>e?this.emit("error",e):this.end());if(!this.buf)throw new Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[md]()}},yd=class extends yc{sync=!0;[Bv](){this[hd](Lr.default.lstatSync(this.absolute))}[qv](){this[Uv](Lr.default.readlinkSync(this.absolute))}[Wv](){this[Hv](Lr.default.openSync(this.absolute,"r"))}[md](){let e=!0;try{let{fd:r,buf:n,offset:o,length:i,pos:s}=this;if(r===void 0||n===void 0)throw new Error("fd and buf must be set in READ method");let l=Lr.default.readSync(r,n,o,i,s);this[zv](l),e=!1}finally{if(e)try{this[$o](()=>{})}catch{}}}[Kv](e){e()}[$o](e=()=>{}){this.fd!==void 0&&Lr.default.closeSync(this.fd),e()}},bd=class extends qt{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;warn(e,r,n={}){return Fi(this,e,r,n)}constructor(e,r={}){let n=fc(r);super(),this.preservePaths=!!n.preservePaths,this.portable=!!n.portable,this.strict=!!n.strict,this.noPax=!!n.noPax,this.noMtime=!!n.noMtime,this.readEntry=e;let{type:o}=e;if(o==="Unsupported")throw new Error("writing entry that should be ignored");this.type=o,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=n.prefix,this.path=ne(e.path),this.mode=e.mode!==void 0?this[gd](e.mode):void 0,this.uid=this.portable?void 0:e.uid,this.gid=this.portable?void 0:e.gid,this.uname=this.portable?void 0:e.uname,this.gname=this.portable?void 0:e.gname,this.size=e.size,this.mtime=this.noMtime?void 0:n.mtime||e.mtime,this.atime=this.portable?void 0:e.atime,this.ctime=this.portable?void 0:e.ctime,this.linkpath=e.linkpath!==void 0?ne(e.linkpath):void 0,typeof n.onwarn=="function"&&this.on("warn",n.onwarn);let i=!1;if(!this.preservePaths){let[l,c]=hc(this.path);l&&typeof c=="string"&&(this.path=c,i=l)}this.remain=e.size,this.blockRemain=e.startBlockSize,this.header=new tr({path:this[gn](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[gn](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),i&&this.warn("TAR_ENTRY_INFO",`stripping ${i} from absolute path`,{entry:this,path:i+this.path}),this.header.encode()&&!this.noPax&&super.write(new dn({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[gn](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[gn](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let s=this.header?.block;if(!s)throw new Error("failed to encode header");super.write(s),e.pipe(this)}[gn](e){return FR(e,this.prefix)}[gd](e){return Fv(e,this.type==="Directory",this.portable)}write(e,r,n){typeof r=="function"&&(n=r,r=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof r=="string"?r:"utf8"));let o=e.length;if(o>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=o,super.write(e,n)}end(e,r,n){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof e=="function"&&(n=e,r=void 0,e=void 0),typeof r=="function"&&(n=r,r=void 0),typeof e=="string"&&(e=Buffer.from(e,r??"utf8")),n&&this.once("finish",n),e?super.end(e,n):super.end(n),this}},$H=t=>t.isFile()?"File":t.isDirectory()?"Directory":t.isSymbolicLink()?"SymbolicLink":"Unsupported";var Xv=Y(require("path"),1);var Id=class{path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor(e,r){this.path=e||"./",this.absolute=r}},$R=Buffer.alloc(1024),vd=Symbol("onStat"),bc=Symbol("ended"),jr=Symbol("queue"),ca=Symbol("current"),qi=Symbol("process"),vc=Symbol("processing"),MR=Symbol("processJob"),qr=Symbol("jobs"),Vv=Symbol("jobDone"),wd=Symbol("addFSEntry"),LR=Symbol("addTarEntry"),Jv=Symbol("stat"),Yv=Symbol("readdir"),xd=Symbol("onreaddir"),Ed=Symbol("pipe"),jR=Symbol("entry"),Gv=Symbol("entryOpt"),Sd=Symbol("writeEntryClass"),qR=Symbol("write"),Zv=Symbol("ondrain"),Mo=class extends qt{opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[Sd];onWriteEntry;[jr];[qr]=0;[vc]=!1;[bc]=!1;constructor(e={}){if(super(),this.opt=e,this.file=e.file||"",this.cwd=e.cwd||process.cwd(),this.maxReadSize=e.maxReadSize,this.preservePaths=!!e.preservePaths,this.strict=!!e.strict,this.noPax=!!e.noPax,this.prefix=ne(e.prefix||""),this.linkCache=e.linkCache||new Map,this.statCache=e.statCache||new Map,this.readdirCache=e.readdirCache||new Map,this.onWriteEntry=e.onWriteEntry,this[Sd]=yc,typeof e.onwarn=="function"&&this.on("warn",e.onwarn),this.portable=!!e.portable,e.gzip||e.brotli){if(e.gzip&&e.brotli)throw new TypeError("gzip and brotli are mutually exclusive");if(e.gzip&&(typeof e.gzip!="object"&&(e.gzip={}),this.portable&&(e.gzip.portable=!0),this.zip=new Qp(e.gzip)),e.brotli&&(typeof e.brotli!="object"&&(e.brotli={}),this.zip=new rd(e.brotli)),!this.zip)throw new Error("impossible");let r=this.zip;r.on("data",n=>super.write(n)),r.on("end",()=>super.end()),r.on("drain",()=>this[Zv]()),this.on("resume",()=>r.resume())}else this.on("drain",this[Zv]);this.noDirRecurse=!!e.noDirRecurse,this.follow=!!e.follow,this.noMtime=!!e.noMtime,e.mtime&&(this.mtime=e.mtime),this.filter=typeof e.filter=="function"?e.filter:()=>!0,this[jr]=new vr,this[qr]=0,this.jobs=Number(e.jobs)||4,this[vc]=!1,this[bc]=!1}[qR](e){return super.write(e)}add(e){return this.write(e),this}end(e){return e&&this.add(e),this[bc]=!0,this[qi](),this}write(e){if(this[bc])throw new Error("write after end");return e instanceof aa?this[LR](e):this[wd](e),this.flowing}[LR](e){let r=ne(Xv.default.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else{let n=new Id(e.path,r);n.entry=new bd(e,this[Gv](n)),n.entry.on("end",()=>this[Vv](n)),this[qr]+=1,this[jr].push(n)}this[qi]()}[wd](e){let r=ne(Xv.default.resolve(this.cwd,e));this[jr].push(new Id(e,r)),this[qi]()}[Jv](e){e.pending=!0,this[qr]+=1;let r=this.follow?"stat":"lstat";wc.default[r](e.absolute,(n,o)=>{e.pending=!1,this[qr]-=1,n?this.emit("error",n):this[vd](e,o)})}[vd](e,r){this.statCache.set(e.absolute,r),e.stat=r,this.filter(e.path,r)||(e.ignore=!0),this[qi]()}[Yv](e){e.pending=!0,this[qr]+=1,wc.default.readdir(e.absolute,(r,n)=>{if(e.pending=!1,this[qr]-=1,r)return this.emit("error",r);this[xd](e,n)})}[xd](e,r){this.readdirCache.set(e.absolute,r),e.readdir=r,this[qi]()}[qi](){if(!this[vc]){this[vc]=!0;for(let e=this[jr].head;e&&this[qr]<this.jobs;e=e.next)if(this[MR](e.value),e.value.ignore){let r=e.next;this[jr].removeNode(e),e.next=r}this[vc]=!1,this[bc]&&!this[jr].length&&this[qr]===0&&(this.zip?this.zip.end($R):(super.write($R),super.end()))}}get[ca](){return this[jr]&&this[jr].head&&this[jr].head.value}[Vv](e){this[jr].shift(),this[qr]-=1,this[qi]()}[MR](e){if(!e.pending){if(e.entry){e===this[ca]&&!e.piped&&this[Ed](e);return}if(!e.stat){let r=this.statCache.get(e.absolute);r?this[vd](e,r):this[Jv](e)}if(e.stat&&!e.ignore){if(!this.noDirRecurse&&e.stat.isDirectory()&&!e.readdir){let r=this.readdirCache.get(e.absolute);if(r?this[xd](e,r):this[Yv](e),!e.readdir)return}if(e.entry=this[jR](e),!e.entry){e.ignore=!0;return}e===this[ca]&&!e.piped&&this[Ed](e)}}}[Gv](e){return{onwarn:(r,n,o)=>this.warn(r,n,o),noPax:this.noPax,cwd:this.cwd,absolute:e.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix}}[jR](e){this[qr]+=1;try{let r=new this[Sd](e.path,this[Gv](e));return this.onWriteEntry?.(r),r.on("end",()=>this[Vv](e)).on("error",n=>this.emit("error",n))}catch(r){this.emit("error",r)}}[Zv](){this[ca]&&this[ca].entry&&this[ca].entry.resume()}[Ed](e){e.piped=!0,e.readdir&&e.readdir.forEach(o=>{let i=e.path,s=i==="./"?"":i.replace(/\/*$/,"/");this[wd](s+o)});let r=e.entry,n=this.zip;if(!r)throw new Error("cannot pipe without source");n?r.on("data",o=>{n.write(o)||r.pause()}):r.on("data",o=>{super.write(o)||r.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(e,r,n={}){Fi(this,e,r,n)}},Bi=class extends Mo{sync=!0;constructor(e){super(e),this[Sd]=yd}pause(){}resume(){}[Jv](e){let r=this.follow?"statSync":"lstatSync";this[vd](e,wc.default[r](e.absolute))}[Yv](e){this[xd](e,wc.default.readdirSync(e.absolute))}[Ed](e){let r=e.entry,n=this.zip;if(e.readdir&&e.readdir.forEach(o=>{let i=e.path,s=i==="./"?"":i.replace(/\/*$/,"/");this[wd](s+o)}),!r)throw new Error("Cannot pipe without source");n?r.on("data",o=>{n.write(o)}):r.on("data",o=>{super[qR](o)})}};var MH=(t,e)=>{let r=new Bi(t),n=new ia(t.file,{mode:t.mode||438});r.pipe(n),BR(r,e)},LH=(t,e)=>{let r=new Mo(t),n=new Ln(t.file,{mode:t.mode||438});r.pipe(n);let o=new Promise((i,s)=>{n.on("error",s),n.on("close",i),r.on("error",s)});return zR(r,e),o},BR=(t,e)=>{e.forEach(r=>{r.charAt(0)==="@"?Wn({file:Qv.default.resolve(t.cwd,r.slice(1)),sync:!0,noResume:!0,onReadEntry:n=>t.add(n)}):t.add(r)}),t.end()},zR=async(t,e)=>{for(let r=0;r<e.length;r++){let n=String(e[r]);n.charAt(0)==="@"?await Wn({file:Qv.default.resolve(String(t.cwd),n.slice(1)),noResume:!0,onReadEntry:o=>{t.add(o)}}):t.add(n)}t.end()},jH=(t,e)=>{let r=new Bi(t);return BR(r,e),r},qH=(t,e)=>{let r=new Mo(t);return zR(r,e),r},BH=pn(MH,LH,jH,qH,(t,e)=>{if(!e?.length)throw new TypeError("no paths specified to add to archive")});a();var E0=Y(require("node:fs"),1);a();var oN=Y(require("node:assert"),1),x0=require("node:crypto"),pe=Y(require("node:fs"),1),bn=Y(require("node:path"),1);a();var e0=Y(require("fs"),1),zH=process.env.__FAKE_PLATFORM__||process.platform,UH=zH==="win32",{O_CREAT:WH,O_TRUNC:HH,O_WRONLY:KH}=e0.default.constants,UR=Number(process.env.__FAKE_FS_O_FILENAME__)||e0.default.constants.UV_FS_O_FILEMAP||0,VH=UH&&!!UR,GH=512*1024,ZH=UR|HH|WH|KH,t0=VH?t=>t<GH?ZH:"w":()=>"w";a();a();var xc=Y(require("node:fs"),1),ua=Y(require("node:path"),1),r0=(t,e,r)=>{try{return xc.default.lchownSync(t,e,r)}catch(n){if(n?.code!=="ENOENT")throw n}},_d=(t,e,r,n)=>{xc.default.lchown(t,e,r,o=>{n(o&&o?.code!=="ENOENT"?o:null)})},JH=(t,e,r,n,o)=>{if(e.isDirectory())n0(ua.default.resolve(t,e.name),r,n,i=>{if(i)return o(i);let s=ua.default.resolve(t,e.name);_d(s,r,n,o)});else{let i=ua.default.resolve(t,e.name);_d(i,r,n,o)}},n0=(t,e,r,n)=>{xc.default.readdir(t,{withFileTypes:!0},(o,i)=>{if(o){if(o.code==="ENOENT")return n();if(o.code!=="ENOTDIR"&&o.code!=="ENOTSUP")return n(o)}if(o||!i.length)return _d(t,e,r,n);let s=i.length,l=null,c=f=>{if(!l){if(f)return n(l=f);if(--s===0)return _d(t,e,r,n)}};for(let f of i)JH(t,f,e,r,c)})},YH=(t,e,r,n)=>{e.isDirectory()&&o0(ua.default.resolve(t,e.name),r,n),r0(ua.default.resolve(t,e.name),r,n)},o0=(t,e,r)=>{let n;try{n=xc.default.readdirSync(t,{withFileTypes:!0})}catch(o){let i=o;if(i?.code==="ENOENT")return;if(i?.code==="ENOTDIR"||i?.code==="ENOTSUP")return r0(t,e,r);throw i}for(let o of n)YH(t,o,e,r);return r0(t,e,r)};var rr=Y(require("fs"),1);a();a();var i0=require("path");a();var Lo=require("fs"),xr=t=>{if(!t)t={mode:511};else if(typeof t=="object")t={mode:511,...t};else if(typeof t=="number")t={mode:t};else if(typeof t=="string")t={mode:parseInt(t,8)};else throw new TypeError("invalid options argument");let e=t,r=t.fs||{};return t.mkdir=t.mkdir||r.mkdir||Lo.mkdir,t.mkdirAsync=t.mkdirAsync?t.mkdirAsync:async(n,o)=>new Promise((i,s)=>e.mkdir(n,o,(l,c)=>l?s(l):i(c))),t.stat=t.stat||r.stat||Lo.stat,t.statAsync=t.statAsync?t.statAsync:async n=>new Promise((o,i)=>e.stat(n,(s,l)=>s?i(s):o(l))),t.statSync=t.statSync||r.statSync||Lo.statSync,t.mkdirSync=t.mkdirSync||r.mkdirSync||Lo.mkdirSync,e};var yn=(t,e,r)=>{let n=(0,i0.dirname)(t),o={...xr(e),recursive:!1};if(n===t)try{return o.mkdirSync(t,o)}catch(i){let s=i;if(s&&s.code!=="EISDIR")throw i;return}try{return o.mkdirSync(t,o),r||t}catch(i){let s=i;if(s&&s.code==="ENOENT")return yn(t,o,yn(n,o,r));if(s&&s.code!=="EEXIST"&&s&&s.code!=="EROFS")throw i;try{if(!o.statSync(t).isDirectory())throw i}catch{throw i}}},Hn=Object.assign(async(t,e,r)=>{let n=xr(e);n.recursive=!1;let o=(0,i0.dirname)(t);return o===t?n.mkdirAsync(t,n).catch(i=>{let s=i;if(s&&s.code!=="EISDIR")throw i}):n.mkdirAsync(t,n).then(()=>r||t,async i=>{let s=i;if(s&&s.code==="ENOENT")return Hn(o,n).then(l=>Hn(t,n,l));if(s&&s.code!=="EEXIST"&&s.code!=="EROFS")throw i;return n.statAsync(t).then(l=>{if(l.isDirectory())return r;throw i},()=>{throw i})})},{sync:yn});a();var c0=require("path");a();var s0=require("path"),a0=async(t,e,r)=>{if(r!==e)return t.statAsync(e).then(n=>n.isDirectory()?r:void 0,n=>{let o=n;return o&&o.code==="ENOENT"?a0(t,(0,s0.dirname)(e),e):void 0})},l0=(t,e,r)=>{if(r!==e)try{return t.statSync(e).isDirectory()?r:void 0}catch(n){let o=n;return o&&o.code==="ENOENT"?l0(t,(0,s0.dirname)(e),e):void 0}};var fa=(t,e)=>{let r=xr(e);if(r.recursive=!0,(0,c0.dirname)(t)===t)return r.mkdirSync(t,r);let o=l0(r,t);try{return r.mkdirSync(t,r),o}catch(i){let s=i;if(s&&s.code==="ENOENT")return yn(t,r);throw i}},Ec=Object.assign(async(t,e)=>{let r={...xr(e),recursive:!0};return(0,c0.dirname)(t)===t?await r.mkdirAsync(t,r):a0(r,t).then(o=>r.mkdirAsync(t,r).then(i=>o||i).catch(i=>{let s=i;if(s&&s.code==="ENOENT")return Hn(t,r);throw i}))},{sync:fa});a();var Od=require("path"),XH=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform,u0=t=>{if(/\0/.test(t))throw Object.assign(new TypeError("path must be a string without null bytes"),{path:t,code:"ERR_INVALID_ARG_VALUE"});if(t=(0,Od.resolve)(t),XH==="win32"){let e=/[*|"<>?:]/,{root:r}=(0,Od.parse)(t);if(e.test(t.substring(r.length)))throw Object.assign(new Error("Illegal characters in path."),{path:t,code:"EINVAL"})}return t};a();var Td=require("fs");var QH=process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version,f0=QH.replace(/^v/,"").split("."),WR=+f0[0]>10||+f0[0]==10&&+f0[1]>=12,Sc=WR?t=>xr(t).mkdirSync===Td.mkdirSync:()=>!1,Cd=Object.assign(WR?t=>xr(t).mkdir===Td.mkdir:()=>!1,{sync:Sc});var kd=(t,e)=>{t=u0(t);let r=xr(e);return Sc(r)?fa(t,r):yn(t,r)};var HR=Object.assign(async(t,e)=>{t=u0(t);let r=xr(e);return Cd(r)?Ec(t,r):Hn(t,r)},{mkdirpSync:kd,mkdirpNative:Ec,mkdirpNativeSync:fa,mkdirpManual:Hn,mkdirpManualSync:yn,sync:kd,native:Ec,nativeSync:fa,manual:Hn,manualSync:yn,useNative:Cd,useNativeSync:Sc});var Tc=Y(require("node:path"),1);a();var Ic=class extends Error{path;code;syscall="chdir";constructor(e,r){super(`${r}: Cannot cd into '${e}'`),this.path=e,this.code=r}get name(){return"CwdError"}};a();var _c=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(e,r){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=e,this.path=r}get name(){return"SymlinkError"}};var Ad=(t,e)=>t.get(ne(e)),Oc=(t,e,r)=>t.set(ne(e),r),eK=(t,e)=>{rr.default.stat(t,(r,n)=>{(r||!n.isDirectory())&&(r=new Ic(t,r?.code||"ENOTDIR")),e(r)})},KR=(t,e,r)=>{t=ne(t);let n=e.umask??18,o=e.mode|448,i=(o&n)!==0,s=e.uid,l=e.gid,c=typeof s=="number"&&typeof l=="number"&&(s!==e.processUid||l!==e.processGid),f=e.preserve,u=e.unlink,d=e.cache,m=ne(e.cwd),h=(v,x)=>{v?r(v):(Oc(d,t,!0),x&&c?n0(x,s,l,S=>h(S)):i?rr.default.chmod(t,o,r):r())};if(d&&Ad(d,t)===!0)return h();if(t===m)return eK(t,h);if(f)return HR(t,{mode:o}).then(v=>h(null,v??void 0),h);let w=ne(Tc.default.relative(m,t)).split("/");Rd(m,w,o,d,u,m,void 0,h)},Rd=(t,e,r,n,o,i,s,l)=>{if(!e.length)return l(null,s);let c=e.shift(),f=ne(Tc.default.resolve(t+"/"+c));if(Ad(n,f))return Rd(f,e,r,n,o,i,s,l);rr.default.mkdir(f,r,VR(f,e,r,n,o,i,s,l))},VR=(t,e,r,n,o,i,s,l)=>c=>{c?rr.default.lstat(t,(f,u)=>{if(f)f.path=f.path&&ne(f.path),l(f);else if(u.isDirectory())Rd(t,e,r,n,o,i,s,l);else if(o)rr.default.unlink(t,d=>{if(d)return l(d);rr.default.mkdir(t,r,VR(t,e,r,n,o,i,s,l))});else{if(u.isSymbolicLink())return l(new _c(t,t+"/"+e.join("/")));l(c)}}):(s=s||t,Rd(t,e,r,n,o,i,s,l))},tK=t=>{let e=!1,r;try{e=rr.default.statSync(t).isDirectory()}catch(n){r=n?.code}finally{if(!e)throw new Ic(t,r??"ENOTDIR")}},GR=(t,e)=>{t=ne(t);let r=e.umask??18,n=e.mode|448,o=(n&r)!==0,i=e.uid,s=e.gid,l=typeof i=="number"&&typeof s=="number"&&(i!==e.processUid||s!==e.processGid),c=e.preserve,f=e.unlink,u=e.cache,d=ne(e.cwd),m=v=>{Oc(u,t,!0),v&&l&&o0(v,i,s),o&&rr.default.chmodSync(t,n)};if(u&&Ad(u,t)===!0)return m();if(t===d)return tK(d),m();if(c)return m(kd(t,n)??void 0);let y=ne(Tc.default.relative(d,t)).split("/"),w;for(let v=y.shift(),x=d;v&&(x+="/"+v);v=y.shift())if(x=ne(Tc.default.resolve(x)),!Ad(u,x))try{rr.default.mkdirSync(x,n),w=w||x,Oc(u,x,!0)}catch{let k=rr.default.lstatSync(x);if(k.isDirectory()){Oc(u,x,!0);continue}else if(f){rr.default.unlinkSync(x),rr.default.mkdirSync(x,n),w=w||x,Oc(u,x,!0);continue}else if(k.isSymbolicLink())return new _c(x,x+"/"+y.join("/"))}return m(w)};a();var p0=Object.create(null),{hasOwnProperty:rK}=Object.prototype,Nd=t=>(rK.call(p0,t)||(p0[t]=t.normalize("NFD")),p0[t]);a();var d0=require("node:path");var nK=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,oK=nK==="win32",iK=t=>t.split("/").slice(0,-1).reduce((r,n)=>{let o=r[r.length-1];return o!==void 0&&(n=(0,d0.join)(o,n)),r.push(n||"/"),r},[]),Dd=class{#e=new Map;#t=new Map;#n=new Set;reserve(e,r){e=oK?["win32 parallelization disabled"]:e.map(o=>hn((0,d0.join)(Nd(o))).toLowerCase());let n=new Set(e.map(o=>iK(o)).reduce((o,i)=>o.concat(i)));this.#t.set(r,{dirs:n,paths:e});for(let o of e){let i=this.#e.get(o);i?i.push(r):this.#e.set(o,[r])}for(let o of n){let i=this.#e.get(o);if(!i)this.#e.set(o,[new Set([r])]);else{let s=i[i.length-1];s instanceof Set?s.add(r):i.push(new Set([r]))}}return this.#i(r)}#o(e){let r=this.#t.get(e);if(!r)throw new Error("function does not have any path reservations");return{paths:r.paths.map(n=>this.#e.get(n)),dirs:[...r.dirs].map(n=>this.#e.get(n))}}check(e){let{paths:r,dirs:n}=this.#o(e);return r.every(o=>o&&o[0]===e)&&n.every(o=>o&&o[0]instanceof Set&&o[0].has(e))}#i(e){return this.#n.has(e)||!this.check(e)?!1:(this.#n.add(e),e(()=>this.#r(e)),!0)}#r(e){if(!this.#n.has(e))return!1;let r=this.#t.get(e);if(!r)throw new Error("invalid reservation");let{paths:n,dirs:o}=r,i=new Set;for(let s of n){let l=this.#e.get(s);if(!l||l?.[0]!==e)continue;let c=l[1];if(!c){this.#e.delete(s);continue}if(l.shift(),typeof c=="function")i.add(c);else for(let f of c)i.add(f)}for(let s of o){let l=this.#e.get(s),c=l?.[0];if(!(!l||!(c instanceof Set)))if(c.size===1&&l.length===1){this.#e.delete(s);continue}else if(c.size===1){l.shift();let f=l[0];typeof f=="function"&&i.add(f)}else c.delete(e)}return this.#n.delete(e),i.forEach(s=>this.#i(s)),!0}};var ZR=Symbol("onEntry"),g0=Symbol("checkFs"),JR=Symbol("checkFs2"),$d=Symbol("pruneCache"),y0=Symbol("isReusable"),Er=Symbol("makeFs"),b0=Symbol("file"),v0=Symbol("directory"),Md=Symbol("link"),YR=Symbol("symlink"),XR=Symbol("hardlink"),QR=Symbol("unsupported"),eN=Symbol("checkPath"),jo=Symbol("mkdir"),vt=Symbol("onError"),Pd=Symbol("pending"),tN=Symbol("pend"),pa=Symbol("unpend"),m0=Symbol("ended"),h0=Symbol("maybeClose"),w0=Symbol("skip"),Cc=Symbol("doChown"),kc=Symbol("uid"),Ac=Symbol("gid"),Rc=Symbol("checkedCwd"),sK=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,Nc=sK==="win32",aK=1024,lK=(t,e)=>{if(!Nc)return pe.default.unlink(t,e);let r=t+".DELETE."+(0,x0.randomBytes)(16).toString("hex");pe.default.rename(t,r,n=>{if(n)return e(n);pe.default.unlink(r,e)})},cK=t=>{if(!Nc)return pe.default.unlinkSync(t);let e=t+".DELETE."+(0,x0.randomBytes)(16).toString("hex");pe.default.renameSync(t,e),pe.default.unlinkSync(e)},rN=(t,e,r)=>t!==void 0&&t===t>>>0?t:e!==void 0&&e===e>>>0?e:r,nN=t=>hn(ne(Nd(t))).toLowerCase(),uK=(t,e)=>{e=nN(e);for(let r of t.keys()){let n=nN(r);(n===e||n.indexOf(e+"/")===0)&&t.delete(r)}},fK=t=>{for(let e of t.keys())t.delete(e)},da=class extends Un{[m0]=!1;[Rc]=!1;[Pd]=0;reservations=new Dd;transform;writable=!0;readable=!1;dirCache;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(e={}){if(e.ondone=()=>{this[m0]=!0,this[h0]()},super(e),this.transform=e.transform,this.dirCache=e.dirCache||new Map,this.chmod=!!e.chmod,typeof e.uid=="number"||typeof e.gid=="number"){if(typeof e.uid!="number"||typeof e.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(e.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=e.uid,this.gid=e.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;e.preserveOwner===void 0&&typeof e.uid!="number"?this.preserveOwner=!!(process.getuid&&process.getuid()===0):this.preserveOwner=!!e.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:aK,this.forceChown=e.forceChown===!0,this.win32=!!e.win32||Nc,this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=ne(bn.default.resolve(e.cwd||process.cwd())),this.strip=Number(e.strip)||0,this.processUmask=this.chmod?typeof e.processUmask=="number"?e.processUmask:process.umask():0,this.umask=typeof e.umask=="number"?e.umask:this.processUmask,this.dmode=e.dmode||511&~this.umask,this.fmode=e.fmode||438&~this.umask,this.on("entry",r=>this[ZR](r))}warn(e,r,n={}){return(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(n.recoverable=!1),super.warn(e,r,n)}[h0](){this[m0]&&this[Pd]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[eN](e){let r=ne(e.path),n=r.split("/");if(this.strip){if(n.length<this.strip)return!1;if(e.type==="Link"){let o=ne(String(e.linkpath)).split("/");if(o.length>=this.strip)e.linkpath=o.slice(this.strip).join("/");else return!1}n.splice(0,this.strip),e.path=n.join("/")}if(isFinite(this.maxDepth)&&n.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:e,path:r,depth:n.length,maxDepth:this.maxDepth}),!1;if(!this.preservePaths){if(n.includes("..")||Nc&&/^[a-z]:\.\.$/i.test(n[0]??""))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:e,path:r}),!1;let[o,i]=hc(r);o&&(e.path=String(i),this.warn("TAR_ENTRY_INFO",`stripping ${o} from absolute path`,{entry:e,path:r}))}if(bn.default.isAbsolute(e.path)?e.absolute=ne(bn.default.resolve(e.path)):e.absolute=ne(bn.default.resolve(this.cwd,e.path)),!this.preservePaths&&typeof e.absolute=="string"&&e.absolute.indexOf(this.cwd+"/")!==0&&e.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:e,path:ne(e.path),resolvedPath:e.absolute,cwd:this.cwd}),!1;if(e.absolute===this.cwd&&e.type!=="Directory"&&e.type!=="GNUDumpDir")return!1;if(this.win32){let{root:o}=bn.default.win32.parse(String(e.absolute));e.absolute=o+Mv(String(e.absolute).slice(o.length));let{root:i}=bn.default.win32.parse(e.path);e.path=i+Mv(e.path.slice(i.length))}return!0}[ZR](e){if(!this[eN](e))return e.resume();switch(oN.default.equal(typeof e.absolute,"string"),e.type){case"Directory":case"GNUDumpDir":e.mode&&(e.mode=e.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[g0](e);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[QR](e)}}[vt](e,r){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:r}),this[pa](),r.resume())}[jo](e,r,n){KR(ne(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:r},n)}[Cc](e){return this.forceChown||this.preserveOwner&&(typeof e.uid=="number"&&e.uid!==this.processUid||typeof e.gid=="number"&&e.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[kc](e){return rN(this.uid,e.uid,this.processUid)}[Ac](e){return rN(this.gid,e.gid,this.processGid)}[b0](e,r){let n=typeof e.mode=="number"?e.mode&4095:this.fmode,o=new Ln(String(e.absolute),{flags:t0(e.size),mode:n,autoClose:!1});o.on("error",c=>{o.fd&&pe.default.close(o.fd,()=>{}),o.write=()=>!0,this[vt](c,e),r()});let i=1,s=c=>{if(c){o.fd&&pe.default.close(o.fd,()=>{}),this[vt](c,e),r();return}--i===0&&o.fd!==void 0&&pe.default.close(o.fd,f=>{f?this[vt](f,e):this[pa](),r()})};o.on("finish",()=>{let c=String(e.absolute),f=o.fd;if(typeof f=="number"&&e.mtime&&!this.noMtime){i++;let u=e.atime||new Date,d=e.mtime;pe.default.futimes(f,u,d,m=>m?pe.default.utimes(c,u,d,h=>s(h&&m)):s())}if(typeof f=="number"&&this[Cc](e)){i++;let u=this[kc](e),d=this[Ac](e);typeof u=="number"&&typeof d=="number"&&pe.default.fchown(f,u,d,m=>m?pe.default.chown(c,u,d,h=>s(h&&m)):s())}s()});let l=this.transform&&this.transform(e)||e;l!==e&&(l.on("error",c=>{this[vt](c,e),r()}),e.pipe(l)),l.pipe(o)}[v0](e,r){let n=typeof e.mode=="number"?e.mode&4095:this.dmode;this[jo](String(e.absolute),n,o=>{if(o){this[vt](o,e),r();return}let i=1,s=()=>{--i===0&&(r(),this[pa](),e.resume())};e.mtime&&!this.noMtime&&(i++,pe.default.utimes(String(e.absolute),e.atime||new Date,e.mtime,s)),this[Cc](e)&&(i++,pe.default.chown(String(e.absolute),Number(this[kc](e)),Number(this[Ac](e)),s)),s()})}[QR](e){e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume()}[YR](e,r){this[Md](e,String(e.linkpath),"symlink",r)}[XR](e,r){let n=ne(bn.default.resolve(this.cwd,String(e.linkpath)));this[Md](e,n,"link",r)}[tN](){this[Pd]++}[pa](){this[Pd]--,this[h0]()}[w0](e){this[pa](),e.resume()}[y0](e,r){return e.type==="File"&&!this.unlink&&r.isFile()&&r.nlink<=1&&!Nc}[g0](e){this[tN]();let r=[e.path];e.linkpath&&r.push(e.linkpath),this.reservations.reserve(r,n=>this[JR](e,n))}[$d](e){e.type==="SymbolicLink"?fK(this.dirCache):e.type!=="Directory"&&uK(this.dirCache,String(e.absolute))}[JR](e,r){this[$d](e);let n=l=>{this[$d](e),r(l)},o=()=>{this[jo](this.cwd,this.dmode,l=>{if(l){this[vt](l,e),n();return}this[Rc]=!0,i()})},i=()=>{if(e.absolute!==this.cwd){let l=ne(bn.default.dirname(String(e.absolute)));if(l!==this.cwd)return this[jo](l,this.dmode,c=>{if(c){this[vt](c,e),n();return}s()})}s()},s=()=>{pe.default.lstat(String(e.absolute),(l,c)=>{if(c&&(this.keep||this.newer&&c.mtime>(e.mtime??c.mtime))){this[w0](e),n();return}if(l||this[y0](e,c))return this[Er](null,e,n);if(c.isDirectory()){if(e.type==="Directory"){let f=this.chmod&&e.mode&&(c.mode&4095)!==e.mode,u=d=>this[Er](d??null,e,n);return f?pe.default.chmod(String(e.absolute),Number(e.mode),u):u()}if(e.absolute!==this.cwd)return pe.default.rmdir(String(e.absolute),f=>this[Er](f??null,e,n))}if(e.absolute===this.cwd)return this[Er](null,e,n);lK(String(e.absolute),f=>this[Er](f??null,e,n))})};this[Rc]?i():o()}[Er](e,r,n){if(e){this[vt](e,r),n();return}switch(r.type){case"File":case"OldFile":case"ContiguousFile":return this[b0](r,n);case"Link":return this[XR](r,n);case"SymbolicLink":return this[YR](r,n);case"Directory":case"GNUDumpDir":return this[v0](r,n)}}[Md](e,r,n,o){pe.default[n](r,String(e.absolute),i=>{i?this[vt](i,e):(this[pa](),e.resume()),o()})}},Fd=t=>{try{return[null,t()]}catch(e){return[e,null]}},Dc=class extends da{sync=!0;[Er](e,r){return super[Er](e,r,()=>{})}[g0](e){if(this[$d](e),!this[Rc]){let i=this[jo](this.cwd,this.dmode);if(i)return this[vt](i,e);this[Rc]=!0}if(e.absolute!==this.cwd){let i=ne(bn.default.dirname(String(e.absolute)));if(i!==this.cwd){let s=this[jo](i,this.dmode);if(s)return this[vt](s,e)}}let[r,n]=Fd(()=>pe.default.lstatSync(String(e.absolute)));if(n&&(this.keep||this.newer&&n.mtime>(e.mtime??n.mtime)))return this[w0](e);if(r||this[y0](e,n))return this[Er](null,e);if(n.isDirectory()){if(e.type==="Directory"){let s=this.chmod&&e.mode&&(n.mode&4095)!==e.mode,[l]=s?Fd(()=>{pe.default.chmodSync(String(e.absolute),Number(e.mode))}):[];return this[Er](l,e)}let[i]=Fd(()=>pe.default.rmdirSync(String(e.absolute)));this[Er](i,e)}let[o]=e.absolute===this.cwd?[]:Fd(()=>cK(String(e.absolute)));this[Er](o,e)}[b0](e,r){let n=typeof e.mode=="number"?e.mode&4095:this.fmode,o=l=>{let c;try{pe.default.closeSync(i)}catch(f){c=f}(l||c)&&this[vt](l||c,e),r()},i;try{i=pe.default.openSync(String(e.absolute),t0(e.size),n)}catch(l){return o(l)}let s=this.transform&&this.transform(e)||e;s!==e&&(s.on("error",l=>this[vt](l,e)),e.pipe(s)),s.on("data",l=>{try{pe.default.writeSync(i,l,0,l.length)}catch(c){o(c)}}),s.on("end",()=>{let l=null;if(e.mtime&&!this.noMtime){let c=e.atime||new Date,f=e.mtime;try{pe.default.futimesSync(i,c,f)}catch(u){try{pe.default.utimesSync(String(e.absolute),c,f)}catch{l=u}}}if(this[Cc](e)){let c=this[kc](e),f=this[Ac](e);try{pe.default.fchownSync(i,Number(c),Number(f))}catch(u){try{pe.default.chownSync(String(e.absolute),Number(c),Number(f))}catch{l=l||u}}}o(l)})}[v0](e,r){let n=typeof e.mode=="number"?e.mode&4095:this.dmode,o=this[jo](String(e.absolute),n);if(o){this[vt](o,e),r();return}if(e.mtime&&!this.noMtime)try{pe.default.utimesSync(String(e.absolute),e.atime||new Date,e.mtime)}catch{}if(this[Cc](e))try{pe.default.chownSync(String(e.absolute),Number(this[kc](e)),Number(this[Ac](e)))}catch{}r(),e.resume()}[jo](e,r){try{return GR(ne(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:r})}catch(n){return n}}[Md](e,r,n,o){let i=`${n}Sync`;try{pe.default[i](r,String(e.absolute)),o(),e.resume()}catch(s){return this[vt](s,e)}}};var pK=t=>{let e=new Dc(t),r=t.file,n=E0.default.statSync(r),o=t.maxReadSize||16*1024*1024;new Zp(r,{readSize:o,size:n.size}).pipe(e)},dK=(t,e)=>{let r=new da(t),n=t.maxReadSize||16*1024*1024,o=t.file;return new Promise((s,l)=>{r.on("error",l),r.on("close",s),E0.default.stat(o,(c,f)=>{if(c)l(c);else{let u=new Ai(o,{readSize:n,size:f.size});u.on("error",l),u.pipe(r)}})})},mK=pn(pK,dK,t=>new Dc(t),t=>new da(t),(t,e)=>{e?.length&&Pv(t,e)});a();var Bt=Y(require("node:fs"),1),S0=Y(require("node:path"),1);var hK=(t,e)=>{let r=new Bi(t),n=!0,o,i;try{try{o=Bt.default.openSync(t.file,"r+")}catch(c){if(c?.code==="ENOENT")o=Bt.default.openSync(t.file,"w+");else throw c}let s=Bt.default.fstatSync(o),l=Buffer.alloc(512);e:for(i=0;i<s.size;i+=512){for(let u=0,d=0;u<512;u+=d){if(d=Bt.default.readSync(o,l,u,l.length-u,i+u),i===0&&l[0]===31&&l[1]===139)throw new Error("cannot append to compressed archives");if(!d)break e}let c=new tr(l);if(!c.cksumValid)break;let f=512*Math.ceil((c.size||0)/512);if(i+f+512>s.size)break;i+=f,t.mtimeCache&&c.mtime&&t.mtimeCache.set(String(c.path),c.mtime)}n=!1,gK(t,r,i,o,e)}finally{if(n)try{Bt.default.closeSync(o)}catch{}}},gK=(t,e,r,n,o)=>{let i=new ia(t.file,{fd:n,start:r});e.pipe(i),bK(e,o)},yK=(t,e)=>{e=Array.from(e);let r=new Mo(t),n=(i,s,l)=>{let c=(h,y)=>{h?Bt.default.close(i,w=>l(h)):l(null,y)},f=0;if(s===0)return c(null,0);let u=0,d=Buffer.alloc(512),m=(h,y)=>{if(h||typeof y>"u")return c(h);if(u+=y,u<512&&y)return Bt.default.read(i,d,u,d.length-u,f+u,m);if(f===0&&d[0]===31&&d[1]===139)return c(new Error("cannot append to compressed archives"));if(u<512)return c(null,f);let w=new tr(d);if(!w.cksumValid)return c(null,f);let v=512*Math.ceil((w.size??0)/512);if(f+v+512>s||(f+=v+512,f>=s))return c(null,f);t.mtimeCache&&w.mtime&&t.mtimeCache.set(String(w.path),w.mtime),u=0,Bt.default.read(i,d,0,512,f,m)};Bt.default.read(i,d,0,512,f,m)};return new Promise((i,s)=>{r.on("error",s);let l="r+",c=(f,u)=>{if(f&&f.code==="ENOENT"&&l==="r+")return l="w+",Bt.default.open(t.file,l,c);if(f||!u)return s(f);Bt.default.fstat(u,(d,m)=>{if(d)return Bt.default.close(u,()=>s(d));n(u,m.size,(h,y)=>{if(h)return s(h);let w=new Ln(t.file,{fd:u,start:y});r.pipe(w),w.on("error",s),w.on("close",i),vK(r,e)})})};Bt.default.open(t.file,l,c)})},bK=(t,e)=>{e.forEach(r=>{r.charAt(0)==="@"?Wn({file:S0.default.resolve(t.cwd,r.slice(1)),sync:!0,noResume:!0,onReadEntry:n=>t.add(n)}):t.add(r)}),t.end()},vK=async(t,e)=>{for(let r=0;r<e.length;r++){let n=String(e[r]);n.charAt(0)==="@"?await Wn({file:S0.default.resolve(String(t.cwd),n.slice(1)),noResume:!0,onReadEntry:o=>t.add(o)}):t.add(n)}t.end()},zi=pn(hK,yK,()=>{throw new TypeError("file is required")},()=>{throw new TypeError("file is required")},(t,e)=>{if(!uR(t))throw new TypeError("file is required");if(t.gzip||t.brotli||t.file.endsWith(".br")||t.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!e?.length)throw new TypeError("no paths specified to add/replace")});a();var wK=pn(zi.syncFile,zi.asyncFile,zi.syncNoFile,zi.asyncNoFile,(t,e=[])=>{zi.validate?.(t,e),xK(t)}),xK=t=>{let e=t.filter;t.mtimeCache||(t.mtimeCache=new Map),t.filter=e?(r,n)=>e(r,n)&&!((t.mtimeCache?.get(r)??n.mtime??0)>(n.mtime??0)):(r,n)=>!((t.mtimeCache?.get(r)??n.mtime??0)>(n.mtime??0))};var jd=async(t,e,r)=>{if(r){await(0,Ld.writeFile)(e,Buffer.from(t));return}let n=(0,iN.createWriteStream)(e);try{let o="build/Release/better_sqlite3.node",i=[];i.push((0,I0.pipeline)(sN.Readable.from(Buffer.from(t)),Wn({gzip:!0,onReadEntry:s=>{s.path===o&&i.push((0,I0.pipeline)(s,n))}},[o]))),await Promise.all(i)}catch(o){throw n.destroy(),await(0,Ld.rm)(e,{force:!0}),o}},aN=async()=>{let t=await QA({multiple:!1,accept:[".tar.gz",".node"],strict:!0});return t?{decompressed:!t.name.endsWith(".gz"),arrayBuffer:await t.arrayBuffer()}:null},lN=async t=>(await(0,_0.requestUrl)({url:t,method:"HEAD"})).status,cN=async t=>(await(0,_0.requestUrl)({url:t})).arrayBuffer;var uN=(i=>(i[i.Idle=0]="Idle",i[i.Downloading=1]="Downloading",i[i.Importing=2]="Importing",i[i.Success=3]="Success",i[i.Failed=4]="Failed",i))(uN||{}),ma=Xt(0),SK=Xt(t=>t(ma)===4),fN=Xt(null),IK=Xt(t=>{switch(t(ma)){case 0:return null;case 1:return"Downloading...";case 2:return"Importing...";case 3:return"Module successfully installed";case 4:return`Module install failed: ${t(fN)}`;default:break}}),_K=Xt(null,(t,e,[r,n])=>{e(ma,4);let o="Failed to install module when "+uN[r];gt(o,n),e(fN,o+": "+(n instanceof Error?n.message:`${n}`))}),OK=()=>{let t=iv(ma),e=iv(_K),r=St(tc),n=St(Mp);return Qt(async()=>{if(!n){e([0,new Error("Cannot find binary version")]);return}t(1);let o;try{if(await lN(r)===404)throw new Error(`Requested module not available (${r}), please open an issue on GitHub`);o=await cN(r)}catch(i){e([1,i]);return}t(2);try{await jd(o,n,!1)}catch(i){e([2,i]);return}t(3)})},pN=()=>{let t=St(ma),e=St(IK),r=St(_o),n=OK();return g("div",{className:"zt-auto-install",children:[g(nc,{name:"Auto Install",desc:"Recommended",button:t===0?"Install":void 0,onClick:n}),t!==0&&g(nc,{className:Xs("zt-auto-install-status",{"mod-warning":t===4,"mod-success":t===3}),icon:g(CK,{}),name:e,button:t===3?"Reload Plugin":void 0,onClick:()=>r.reloadPlugin()})]})},TK=()=>{let t=St(SK),[e]=jt(t?"slash":"check");return g("div",{className:"zt-install-done-icon",style:{display:"contents"},ref:e})},CK=()=>{switch(St(ma)){case 0:return null;case 1:case 2:return g(XA,{className:"zt-install-spin-icon",style:{display:"contents"}});case 3:case 4:return g(TK,{})}};a();var dN=require("obsidian");_();var kK=async t=>{try{let e=await aN();return e?(await jd(e.arrayBuffer,t,e.decompressed),!0):(W.info("No file selected, skip import module"),!1)}catch(e){return new dN.Notice(`Failed to import module from ${t}: ${e}`),gt("import module "+t,e),!1}},AK=()=>{let[t,e]=q(!1),r=St(Mp),n=async()=>{if(!r)return;await kK(r)&&e(!0)},o=St(tc),i=St(sv),s=St(_o);return g("ol",{children:[g("li",{children:["Download ",g("code",{children:".node.gz"})," file from"," ",g("a",{href:o,children:"GitHub"}),"."]}),g("li",{children:["Select downloaded ",g("code",{children:i})," or uncompressed"," ",g("code",{children:"better-sqlite3.node"}),"to install:",g(RK,{onClick:n,done:t})]}),g("li",{children:["Reload ZotLit:",g(NK,{onClick:()=>s.reloadPlugin()})]})]})},mN=()=>{let[t,e]=q(!1);return g("div",{className:"zt-manual-install",children:[g(nc,{name:"Manual Install",desc:"Use this option if you have trouble downloading the module with auto install.",button:`${t?"Hide":"Show"} Guide`,onClick:()=>e(r=>!r)}),g("div",{hidden:!t,children:g(AK,{})})]})},RK=({done:t,onClick:e})=>g("button",{className:Xs({"zt-import-done":t}),onClick:e,children:t?"Library file imported":"Select"}),NK=({disabled:t,onClick:e})=>g("button",{disabled:t,onClick:e,children:"Reload Plugin"});var DK=()=>{let t=St(UA);switch(t){case"install":return g(L,{children:["ZotLit requires latest version of ",g("code",{children:"better-sqlite3"})," to be installed. Use one of the method below to install or update it."]});case"reset":return g(L,{children:[g("code",{children:"better-sqlite3"})," seems to be broken and failed to load. you can try to use one of the method below to reinstall it."]});default:(0,hN.default)(t)}},gN=()=>g(L,{children:[g("style",{children:`
|
|
.modal.mod-zt-install-guide .modal-content {
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
.zt-install-methods {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: var(--size-4-4);
|
|
flex-grow: 1;
|
|
padding: var(--size-4-4);
|
|
padding-bottom: var(--size-4-2);
|
|
}
|
|
.zt-install-methods .setting-item {
|
|
padding: 0;
|
|
}
|
|
.zt-auto-install {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: var(--size-4-4);
|
|
}
|
|
.modal.mod-zt-install-guide button:disabled {
|
|
background-color: var(--background-modifier-cover);
|
|
}
|
|
.modal.mod-zt-install-guide button:disabled:hover {
|
|
box-shadow: var(--input-shadow);
|
|
}
|
|
.modal.mod-zt-install-guide button.zt-import-done {
|
|
background-color: var(--background-modifier-success);
|
|
}
|
|
.zt-auto-install-status {
|
|
border-top: none;
|
|
}
|
|
.zt-auto-install-status.mod-success .setting-icon ,
|
|
.zt-auto-install-status.mod-success .setting-item-name {
|
|
color: var(--text-success);
|
|
}
|
|
.zt-auto-install-status.mod-warning .setting-icon ,
|
|
.zt-auto-install-status.mod-warning .setting-item-name {
|
|
color: var(--text-error);
|
|
}
|
|
.zt-auto-install-status .setting-icon ,
|
|
.zt-auto-install-status .setting-item-name {
|
|
color: var(--text-muted);
|
|
}
|
|
`}),g("div",{className:"zt-install-desc",children:g(DK,{})}),g("div",{className:"zt-install-methods",children:[g(pN,{}),g(mN,{})]})]});var Pc=class extends yN.Modal{constructor(r,n,o,i){super(i);this.manifest=r;this.platform=n;this.mode=o;this.app=i;this.titleEl.setText("Setup ZotLit"),this.modalEl.addClass("mod-zt-install-guide")}onOpen(){let r=zA();r.set(_o,this),P.render(g(BA,{initialValues:r.get(),children:g(gN,{})}),this.contentEl)}onClose(){P.unmountComponentAtNode(this.contentEl)}async reloadPlugin(){await this.app.plugins.disablePlugin(this.manifest.id),this.close(),await this.app.plugins.enablePlugin(this.manifest.id)}};var bN=(t,e,r,n)=>{let o=TT();if(!o)throw new Error("Not in desktop app");let i=_T(o);if(i<0)new Kn.Notice(`The electron (electron: ${o.electron}, module version: ${o.modules}) in current version of obsidian is not supported by zotlit, please reinstall using latest obsidian installer (.exe/.dmg/...) from obsidian.md`);else if(i>0)new Kn.Notice(`The electron (electron: ${o.electron}, module version: ${o.modules}) in current version of obsidian is newer than the one supported by installed zotlit, please update zotlit to the latest version`);else if(!OT(o))new Kn.Notice(`Your device (${o.arch}-${o.platform}) is not supported by zotlit`);else try{(0,vN.statSync)(t).isFile()?r==="reset"&&new Pc(e,o,r,n).open():new Kn.Notice("Path to database library occupied, please check the location manually: "+t,2e3)}catch(s){let l=s;l.code==="ENOENT"?new Pc(e,o,r,n).open():(new Kn.Notice(`Unexpected error while checking path of better-sqlite3, please check the location manually: ${t}, error: ${l}`,2e3),gt("checking better-sqlite3 path:"+t,l))}},PK=(t,e)=>{if(!Kn.Platform.isDesktopApp)throw new Error("Not in desktop app");let r=Ps();if(!r)throw new Error(`Cannot find binary version for ${t.name} v${t.version}`);try{return require(r),!0}catch(n){return n?.code==="MODULE_NOT_FOUND"?bN(r,t,"install",e):(new Kn.Notice(`Failed to load database library: ${n}`),gt("Failed to load database library",n),bN(r,t,"reset",e)),!1}},wN=PK;a();var Wq=require("path/posix");var oo=require("obsidian");a();a();a();a();a();a();a();a();var Re;(function(t){t[t.highlight=1]="highlight",t[t.note=2]="note",t[t.image=3]="image",t[t.ink=4]="ink",t[t.underline=5]="underline",t[t.text=6]="text"})(Re||(Re={}));var Ui;(function(t){t[t.manual=0]="manual",t[t.auto=1]="auto"})(Ui||(Ui={}));var qd;(function(t){t[t.importedFile=0]="importedFile",t[t.importedUrl=1]="importedUrl",t[t.linkedFile=2]="linkedFile",t[t.linkedUrl=3]="linkedUrl",t[t.embeddedImage=4]="embeddedImage"})(qd||(qd={}));var Fc;(function(t){t[t.fullName=0]="fullName",t[t.nameOnly=1]="nameOnly"})(Fc||(Fc={}));a();var Bd=["attachment","note","annotation"];a();a();var zd=Bd.map(t=>`'${t}'`).join(",");var it=(t="itemID")=>`--sql
|
|
${t} IS NOT NULL
|
|
${t==="itemID"?`AND ${t} NOT IN (SELECT itemID FROM deletedItems)`:""}
|
|
`,Sr=(t,e="$itemId")=>typeof t=="boolean"?"":`AND ${t} = ${e}`;a();a();a();var Ud=(t,e)=>{for(let r=0;r<t.length;r++)if(t[r]!==e[r])return t[r]-e[r];return 0},FK=new Set(["application/pdf","text/html","application/epub+zip"]),O0=t=>!!t.path,$c=t=>O0(t)&&!!t.contentType&&FK.has(t.contentType),xN=t=>`obzt-active-atch-${t.itemID}-${t.libraryID}`,T0=(t,e)=>{let r=t.getItem(xN(e));if(!r)return null;let n=parseInt(r,10);return n>0?n:null},ha=(t,e,r)=>t.setItem(xN(e),r.toString());var Wd=`--sql
|
|
items.itemID,
|
|
items.key,
|
|
items.clientDateModified,
|
|
items.dateAdded,
|
|
items.dateModified,
|
|
annots.type,
|
|
annots.authorName,
|
|
annots.text,
|
|
annots.comment,
|
|
annots.color,
|
|
annots.pageLabel,
|
|
annots.sortIndex,
|
|
annots.position,
|
|
annots.isExternal
|
|
`,Hd=`--sql
|
|
itemAnnotations annots
|
|
JOIN items USING (itemID)
|
|
`;var hOe=`--sql
|
|
SELECT
|
|
${Wd},
|
|
annots.parentItemID,
|
|
parentItems.key as parentItem
|
|
FROM
|
|
${Hd}
|
|
JOIN items as parentItems ON annots.parentItemID = parentItems.itemID
|
|
WHERE
|
|
items.key = $annotKey
|
|
AND items.libraryID = $libId
|
|
AND ${it("items.itemID")}
|
|
`;a();var xOe=`--sql
|
|
SELECT
|
|
${Wd}
|
|
FROM
|
|
${Hd}
|
|
WHERE
|
|
parentItemID = $attachmentId
|
|
AND items.libraryID = $libId
|
|
AND ${it()}
|
|
`;a();a();var Kd=`--sql
|
|
items.itemID,
|
|
items.key,
|
|
items.clientDateModified,
|
|
items.dateAdded,
|
|
items.dateModified,
|
|
notes.note,
|
|
notes.title
|
|
`,Vd=`--sql
|
|
itemNotes notes
|
|
JOIN items USING (itemID)
|
|
`;var COe=`--sql
|
|
SELECT
|
|
${Kd},
|
|
notes.parentItemID,
|
|
parentItems.key as parentItem
|
|
FROM
|
|
${Vd}
|
|
JOIN items as parentItems ON notes.parentItemID = parentItems.itemID
|
|
WHERE
|
|
items.key = $noteKey
|
|
AND items.libraryID = $libId
|
|
AND ${it("items.itemID")}
|
|
`;a();var DOe=`--sql
|
|
SELECT
|
|
${Kd}
|
|
FROM
|
|
${Vd}
|
|
WHERE
|
|
parentItemID = $itemID
|
|
AND items.libraryID = $libId
|
|
AND ${it()}
|
|
`;a();var MOe=`--sql
|
|
SELECT
|
|
atchs.itemID,
|
|
atchs.path,
|
|
atchs.contentType,
|
|
atchs.linkMode,
|
|
charsets.charset,
|
|
items.key,
|
|
COUNT(atchs.itemID) as annotCount
|
|
FROM
|
|
itemAttachments atchs
|
|
JOIN items USING (itemID)
|
|
LEFT JOIN charsets USING (charsetID)
|
|
LEFT JOIN itemAnnotations annots ON atchs.itemID = annots.parentItemID
|
|
WHERE
|
|
atchs.parentItemID = $itemId
|
|
AND libraryID = $libId
|
|
AND ${it("atchs.itemID")}
|
|
GROUP BY atchs.itemID
|
|
`;a();a();var Mc="bbts";var WOe=`--sql
|
|
SELECT
|
|
citekey
|
|
FROM
|
|
${Mc}.citekeys
|
|
WHERE
|
|
itemID = $itemID
|
|
AND (libraryID IS NULL OR libraryID = $libId)
|
|
`;a();var ZOe=`--sql
|
|
SELECT
|
|
itemID
|
|
FROM
|
|
${Mc}.citekeys
|
|
WHERE
|
|
citekey = $citekey
|
|
`;a();a();var Gd=t=>`--sql
|
|
SELECT
|
|
itemID,
|
|
creators.firstName,
|
|
creators.lastName,
|
|
creators.fieldMode,
|
|
creatorTypes.creatorType,
|
|
orderIndex
|
|
FROM
|
|
items
|
|
LEFT JOIN itemCreators USING (itemID)
|
|
JOIN creators USING (creatorID)
|
|
JOIN creatorTypes USING (creatorTypeID)
|
|
WHERE
|
|
libraryID = $libId
|
|
${Sr(t||"itemID")}
|
|
AND ${it()}
|
|
ORDER BY
|
|
itemID,
|
|
orderIndex
|
|
`;var nTe=Gd(!0);a();a();a();a();a();function SN(t){return t===void 0?{BS_PRIVATE_NESTED_SOME_NONE:0}:t!==null&&t.BS_PRIVATE_NESTED_SOME_NONE!==void 0?{BS_PRIVATE_NESTED_SOME_NONE:t.BS_PRIVATE_NESTED_SOME_NONE+1|0}:t}a();function IN(t,e){for(var r=t.length,n=e.length,o=new Array(r+n|0),i=0;i<r;++i)o[i]=t[i];for(var s=0;s<n;++s)o[r+s|0]=e[s];return o}function C0(t,e){for(var r=0,n=t.length;r<n;++r)e(t[r])}function Zd(t,e){for(var r=t.length,n=new Array(r),o=0;o<r;++o)n[o]=e(t[o]);return n}function Lc(t,e,r){for(var n=e,o=0,i=t.length;o<i;++o)n=r(n,t[o]);return n}a();var _N=function(t,e){for(var r in t)e(r)};function jc(t,e){if(t===e)return!0;var r=typeof t;if(r==="string"||r==="number"||r==="boolean"||r==="undefined"||t===null)return!1;var n=typeof e;if(r==="function"||n==="function")throw{RE_EXN_ID:"Invalid_argument",_1:"equal: functional value",Error:new Error};if(n==="number"||n==="undefined"||e===null)return!1;var o=0|t.TAG,i=0|e.TAG;if(o===248)return t[1]===e[1];if(o===251)throw{RE_EXN_ID:"Invalid_argument",_1:"equal: abstract value",Error:new Error};if(o!==i)return!1;var s=0|t.length;if(s===(0|e.length))if(Array.isArray(t))for(var l=0;;){var c=l;if(c===s)return!0;if(!jc(t[c],e[c]))return!1;l=c+1|0}else{if(t instanceof Date&&e instanceof Date)return!(t>e||t<e);var f={contents:!0};return _N(t,function(u){if(!Object.prototype.hasOwnProperty.call(e,u)){f.contents=!1;return}}),f.contents&&_N(e,function(u){if(!Object.prototype.hasOwnProperty.call(t,u)||!jc(e[u],t[u])){f.contents=!1;return}}),f.contents}else return!1}function Jd(t,e){if(e in t)return SN(t[e])}var k0=function(t,e){delete t[e]};function CN(t){for(var e=Object.keys(t),r=e.length,n=new Array(r),o=0;o<r;++o)n[o]=t[e[o]];return n}function ga(t){for(var e={},r=t.length,n=0;n<r;++n){var o=t[n];e[o[0]]=o[1]}return e}function ON(t,e){return IN(t,[e])}function Yd(){if(arguments.length===1){let t=arguments;return function(r){return ON(r,t[0])}}return ON(arguments[0],arguments[1])}function TN(t,e){return Lc(t,{},function(r,n){var o=e(n),i=Jd(r,o);return i!==void 0?i.push(n):r[o]=[n],r})}function Wi(){if(arguments.length===1){let t=arguments;return function(r){return TN(r,t[0])}}return TN(arguments[0],arguments[1])}function HN(t){}function KN(t){return{}}function kN(t,e){return t[e]}function VN(){if(arguments.length===1){let t=arguments;return function(r){return kN(r,t[0])}}return kN(arguments[0],arguments[1])}var AN=Jd;function GN(){if(arguments.length===1){let t=arguments;return function(r){return AN(r,t[0])}}return AN(arguments[0],arguments[1])}function RN(t,e){return t[e]}function ZN(){if(arguments.length===1){let t=arguments;return function(r){return RN(r,t[0])}}return RN(arguments[0],arguments[1])}function JN(t){return Object.entries(t)}var Xd=CN;function YN(t){return Object.keys(t)}var XN=ga;function NN(t,e){return Object.assign({},t,e)}function Hi(){if(arguments.length===1){let t=arguments;return function(r){return NN(r,t[0])}}return NN(arguments[0],arguments[1])}function DN(t,e,r){var n=Hi({},t);return n[e]=r,n}function Qd(){if(arguments.length===2){let t=arguments;return function(r){return DN(r,t[0],t[1])}}return DN(arguments[0],arguments[1],arguments[2])}function PN(t,e,r){return Qd(t,e,r(Jd(t,e)))}function QN(){if(arguments.length===2){let t=arguments;return function(r){return PN(r,t[0],t[1])}}return PN(arguments[0],arguments[1],arguments[2])}function FN(t,e,r){return Qd(t,e,r(t[e]))}function eD(){if(arguments.length===2){let t=arguments;return function(r){return FN(r,t[0],t[1])}}return FN(arguments[0],arguments[1],arguments[2])}function $N(t,e){var r=Hi({},t);return k0(r,e),r}function tD(){if(arguments.length===1){let t=arguments;return function(r){return $N(r,t[0])}}return $N(arguments[0],arguments[1])}function MN(t,e){var r=Hi({},t);return C0(e,function(n){k0(r,n)}),r}function rD(){if(arguments.length===1){let t=arguments;return function(r){return MN(r,t[0])}}return MN(arguments[0],arguments[1])}function LN(t,e){return ga(Zd(Object.keys(t),function(r){return[r,e(t[r])]}))}function ya(){if(arguments.length===1){let t=arguments;return function(r){return LN(r,t[0])}}return LN(arguments[0],arguments[1])}function jN(t,e){return ga(Zd(Object.keys(t),function(r){return[r,e(r,t[r])]}))}function ba(){if(arguments.length===1){let t=arguments;return function(r){return jN(r,t[0])}}return jN(arguments[0],arguments[1])}function qN(t,e){return ga(Lc(Object.keys(t),[],function(r,n){var o=t[n];return e(o)?Yd(r,[n,o]):r}))}function qc(){if(arguments.length===1){let t=arguments;return function(r){return qN(r,t[0])}}return qN(arguments[0],arguments[1])}function BN(t,e){return ga(Lc(Object.keys(t),[],function(r,n){var o=t[n];return e(n,o)?Yd(r,[n,o]):r}))}function em(){if(arguments.length===1){let t=arguments;return function(r){return BN(r,t[0])}}return BN(arguments[0],arguments[1])}function zN(t,e){return qc(t,function(r){return!e(r)})}function nD(){if(arguments.length===1){let t=arguments;return function(r){return zN(r,t[0])}}return zN(arguments[0],arguments[1])}function UN(t,e){return em(t,function(r,n){return!e(r,n)})}function oD(){if(arguments.length===1){let t=arguments;return function(r){return UN(r,t[0])}}return UN(arguments[0],arguments[1])}function WN(t,e){return em(t,function(r,n){return function(i,s){return s.includes(i)}(r,e)})}function tm(){if(arguments.length===1){let t=arguments;return function(r){return WN(r,t[0])}}return WN(arguments[0],arguments[1])}function iD(t){return jc(t,{})}function sD(t){return!jc(t,{})}var A0={__proto__:null,placeholder:HN,makeEmpty:KN,getUnsafe:VN,get:GN,prop:ZN,toPairs:JN,values:Xd,keys:YN,fromPairs:XN,merge:Hi,set:Qd,update:QN,updateUnsafe:eD,deleteKey:tD,deleteKeys:rD,map:ya,mapWithKey:ba,filter:qc,filterWithKey:em,reject:nD,rejectWithKey:oD,selectKeys:tm,isEmpty:iD,isNotEmpty:sD};var eCe=Gd(!1);a();a();var rm=t=>`--sql
|
|
SELECT
|
|
items.itemID,
|
|
fieldsCombined.fieldName,
|
|
itemDataValues.value
|
|
FROM
|
|
items
|
|
JOIN itemData USING (itemID)
|
|
JOIN itemDataValues USING (valueID)
|
|
JOIN fieldsCombined USING (fieldID)
|
|
JOIN itemTypesCombined USING (itemTypeID)
|
|
WHERE
|
|
libraryID = $libId
|
|
${Sr(t||"items.itemID")}
|
|
AND itemTypesCombined.typeName NOT IN (${zd})
|
|
AND ${it()}
|
|
`;var lCe=rm(!0);a();var dCe=rm(!1);a();a();var Bc=t=>`--sql
|
|
SELECT
|
|
items.libraryID,
|
|
items.itemID,
|
|
items.key,
|
|
items.clientDateModified,
|
|
items.dateAdded,
|
|
items.dateModified,
|
|
itemTypesCombined.typeName as itemType,
|
|
json_group_array(collectionID) filter (where collectionID is not null) as collectionIDs
|
|
FROM
|
|
items
|
|
JOIN itemTypesCombined USING (itemTypeID)
|
|
LEFT JOIN collectionItems USING (itemID)
|
|
WHERE
|
|
libraryID = $libId
|
|
${t==="full"?Sr(!1):t==="id"?Sr("items.itemID"):Sr("items.key","$key")}
|
|
AND ${it()}
|
|
AND itemType NOT IN (${zd})
|
|
GROUP BY itemID
|
|
`;var xCe=Bc("full");a();var OCe=Bc("id"),TCe=Bc("key");a();a();var zc=t=>`--sql
|
|
WITH
|
|
RECURSIVE CollectionPath AS (
|
|
-- Base case: collections without a parent
|
|
SELECT
|
|
collectionID,
|
|
parentCollectionID,
|
|
collectionName AS path
|
|
FROM
|
|
collections
|
|
WHERE
|
|
libraryID = $libId
|
|
${t==="full"?Sr(!1):t==="id"?Sr("collectionID","$collectionID"):Sr("key","$key")}
|
|
AND ${it("collectionID")}
|
|
UNION ALL
|
|
-- Recursive case: join with parent collections
|
|
SELECT
|
|
prev.collectionID,
|
|
c.parentCollectionID,
|
|
c.collectionName
|
|
FROM
|
|
collections c
|
|
JOIN CollectionPath prev ON c.collectionID = prev.parentCollectionID
|
|
)
|
|
SELECT
|
|
p.collectionID,
|
|
json_group_array(p.path) path,
|
|
c.key,
|
|
c.collectionName,
|
|
c.libraryID
|
|
FROM
|
|
CollectionPath p
|
|
JOIN collections c USING (collectionID)
|
|
GROUP BY
|
|
collectionID
|
|
ORDER BY
|
|
collectionID;
|
|
`;var FCe=zc("full");a();var qCe=zc("id"),BCe=zc("key");a();a();a();var aD=require("path"),qo=({groupID:t,key:e},r)=>{let n=[r,"cache"];return t?n.push("groups",t.toString()):n.push("library"),(0,aD.join)(...n,e+".png")};a();a();var Uc=t=>nm(t)?[t.firstName,t.lastName].join(" "):om(t)?t.lastName:null,nm=t=>{let e=t;return e.fieldMode===Fc.fullName&&e.firstName!==null&&e.lastName!==null},om=t=>{let e=t;return e.fieldMode===Fc.nameOnly&&e.lastName!==null},R0=new Set(lo()("creators","itemID","itemType","key","libraryID","collections")),N0=t=>!Bd.includes(t.itemType)&&typeof t.key=="string",Wc=t=>t.itemType==="annotation"&&!!t.parentItem;var lD=t=>typeof t.groupID=="number"?`groups/${t.groupID}`:"library",Bo=t=>{let e;if(N0(t))e=new URL(`zotero://select/${lD(t)}/items/${t.key}`);else if(Wc(t)){e=new URL(`zotero://open-pdf/${lD(t)}/items/${t.parentItem}`);let r;try{r=xs(t.position.pageIndex,!0)}catch(n){console.warn(n),r=null}typeof r=="number"&&e.searchParams.append("page",r.toString()),t.key&&e.searchParams.append("annotation",t.key)}else return"";return e.toString()};var uD=require("obsidian");a();var sm=require("obsidian");async function cD(t){let e=await Ki(t);if(!e)return null;let{value:r,evt:n}=e;return{value:r.item,evt:n}}function Ki(t){let e,r=new Promise((o,i)=>{e=o}),n=sr(t,{selectSuggestion:o=>function(s,l,...c){return e(s!==null?{value:s,evt:l}:null),o.call(this,s,l,...c)},onClose:o=>function(...s){return e(null),o.call(this,...s)}});return r.finally(n),t.open(),r}var im=class extends sm.SuggestModal{initial=!0;async#e(){let e=this.inputEl.value,r=await this.getSuggestions(e);if(r.length!==0){let n=this.limit;n&&n>0&&(r=r.slice(0,n)),this.chooser.setSuggestions(r)}else e?this.onNoSuggestion():this.chooser.setSuggestions(null)}#t=(0,sm.debounce)(this.#e.bind(this),250,!0);updateSuggestions(){this.initial?(this.#e(),this.initial=!1):this.#t()}};var D0=class extends uD.FuzzySuggestModal{constructor(r,n){super(n);this.attachments=r}getItems(){return this.attachments}renderSuggestion(r,n){n.addClass("mod-complex");let o=n.createDiv("suggestion-content").createDiv("suggestion-title").createSpan(),i=n.createDiv("suggestion-aux");super.renderSuggestion(r,o),i.createEl("kbd","suggestion-hotkey").setText((r.item.annotCount??0).toString())}getItemText(r){return r.path?.replace(/^storage:/,"")??r.key}onChooseItem(){}};async function BK(t,e){return t.length===1?t[0]:t.length?(await cD(new D0(t,e)))?.value??null:null}function va(t,e){ha(window.localStorage,e,t.itemID)}async function Vn(t,e){let r=t.filter($c);return await BK(r,e)}a();a();var nx=require("obsidian");a();a();var Ct=require("obsidian");a();var wa=require("obsidian"),fD=()=>`Press ${wa.Platform.isMacOS?"\u2318 Cmd":"Ctrl"} + ${wa.Platform.isMacOS?"\u2325 Option":"Shift"} + I, then go to the "Console" tab to see the log.`;var wt=t=>t instanceof wa.TFile&&t.extension==="md",pD=t=>typeof t=="string"?t:t.path;a();a();function P0(t){let e=Wi(t,o=>o.comment?.match(Ky)?.[1]??-1),r=e[-1]??[],n=new Map(r.map(o=>[o.itemID,[o]]));delete e[-1];for(let[o,i]of Object.entries(e)){let s=n.get(+o);i.forEach(l=>{l.comment&&=l.comment.replace(Ky,"")??null}),s?s.push(...i.sort((l,c)=>Ud(l.sortIndex,c.sortIndex))):i.forEach(l=>{n.set(l.itemID,[l])})}for(let[o,...i]of n.values())if(!(i.length<=0)){for(let s of i)s.comment&&(o.comment=(o.comment??"")+`
|
|
`+s.comment),s.text&&(o.text?o.text.endsWith("-")&&!o.text.endsWith("--")?o.text.substring(0,o.text.length-1)+s.text.trimStart():o.text.match(/[a-zA-Z\d]\s*$/)&&s.text.match(/^\s*[a-zA-Z\d]/)?o.text=o.text.trimEnd()+" "+s.text.trimStart():o.text=o.text.trimEnd()+s.text.trimStart():o.text=s.text);o.comment=o.comment?.replace(/\n+/,`
|
|
`).replace(/^\s+|\s+$/g,"")??null}return[...n.values()]}function F0(t){return t.map(e=>e[0])}function $0(t,e){let r=t.map(([n,...o])=>{if(o.length===0)return[n.itemID,e[n.itemID]];let i=new Map(e[n.itemID].map(s=>[s.tagID,s]));return o.forEach(s=>{e[s.itemID].forEach(l=>{i.set(l.tagID,l)})}),[n.itemID,Array.from(i.values())]});return Object.fromEntries(r)}function dD(t,e){let r=P0(t);return{annotations:F0(r),tags:$0(r,e)}}a();a();var fm=class{constructor(e){this.cache=void 0,this.cache=e}define(e,r){this.cache[e]=r}get(e){return this.cache[e]}remove(e){delete this.cache[e]}reset(){this.cache={}}load(e){this.cache={...this.cache,...e}}},ft=class extends Error{constructor(e){super(e),this.name="Eta Error"}};function Hc(t,e,r){let n=e.slice(0,r).split(/\n/),o=n.length,i=n[o-1].length+1;throw t+=" at line "+o+" col "+i+`:
|
|
|
|
`+e.split(/\n/)[o-1]+`
|
|
`+Array(i).join(" ")+"^",new ft(t)}function zK(t,e,r,n){let o=e.split(`
|
|
`),i=Math.max(r-3,0),s=Math.min(o.length,r+3),l=n,c=o.slice(i,s).map(function(d,m){let h=m+i+1;return(h==r?" >> ":" ")+h+"| "+d}).join(`
|
|
`),f=l?l+":"+r+`
|
|
`:"line "+r+`
|
|
`,u=new ft(f+c+`
|
|
|
|
`+t.message);throw u.name=t.name,u}var UK=async function(){}.constructor;function WK(t,e){let r=this.config,n=e&&e.async?UK:Function;try{let o=new n(r.varName,"options",this.compileToString.call(this,t,e));return o.mtime=e?.mtime,o}catch(o){throw o instanceof SyntaxError?new ft(`Bad template syntax
|
|
|
|
`+o.message+`
|
|
`+Array(o.message.length+1).join("=")+`
|
|
`+this.compileToString.call(this,t,e)+`
|
|
`):o}}function HK(t,e){let r=this.config,n=e&&e.async,o=this.compileBody,i=this.parse.call(this,t),s=`${r.functionHeader}
|
|
let include = (template, data) => this.render(template, data, options);
|
|
let includeAsync = (template, data) => this.renderAsync(template, data, options);
|
|
|
|
let __eta = {res: "", e: this.config.escapeFunction, f: this.config.filterFunction${r.debug?', line: 1, templateStr: "'+t.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n")+'"':""}};
|
|
|
|
function layout(path, data) {
|
|
__eta.layout = path;
|
|
__eta.layoutData = data;
|
|
}${r.debug?"try {":""}${r.useWith?"with("+r.varName+"||{}){":""}
|
|
|
|
${o.call(this,i)}
|
|
if (__eta.layout) {
|
|
__eta.res = ${n?"await includeAsync":"include"} (__eta.layout, {...${r.varName}, body: __eta.res, ...__eta.layoutData});
|
|
}
|
|
${r.useWith?"}":""}${r.debug?"} catch (e) { this.RuntimeErr(e, __eta.templateStr, __eta.line, options.filepath) }":""}
|
|
return __eta.res;
|
|
`;if(r.plugins)for(let l=0;l<r.plugins.length;l++){let c=r.plugins[l];c.processFnString&&(s=c.processFnString(s,r))}return s}function KK(t){let e=this.config,r=0,n=t.length,o="";for(r;r<n;r++){let i=t[r];if(typeof i=="string")o+="__eta.res+='"+i+`'
|
|
`;else{let s=i.t,l=i.val||"";e.debug&&(o+="__eta.line="+i.lineNo+`
|
|
`),s==="r"?(e.autoFilter&&(l="__eta.f("+l+")"),o+="__eta.res+="+l+`
|
|
`):s==="i"?(e.autoFilter&&(l="__eta.f("+l+")"),e.autoEscape&&(l="__eta.e("+l+")"),o+="__eta.res+="+l+`
|
|
`):s==="e"&&(o+=l+`
|
|
`)}}return o}function VK(t,e,r,n){let o,i;return Array.isArray(e.autoTrim)?(o=e.autoTrim[1],i=e.autoTrim[0]):o=i=e.autoTrim,(r||r===!1)&&(o=r),(n||n===!1)&&(i=n),!i&&!o?t:o==="slurp"&&i==="slurp"?t.trim():(o==="_"||o==="slurp"?t=t.trimStart():(o==="-"||o==="nl")&&(t=t.replace(/^(?:\r\n|\n|\r)/,"")),i==="_"||i==="slurp"?t=t.trimEnd():(i==="-"||i==="nl")&&(t=t.replace(/(?:\r\n|\n|\r)$/,"")),t)}var GK={"&":"&","<":"<",">":">",'"':""","'":"'"};function ZK(t){return GK[t]}function JK(t){let e=String(t);return/[&<>"']/.test(e)?e.replace(/[&<>"']/g,ZK):e}var mD={autoEscape:!0,autoFilter:!1,autoTrim:[!1,"nl"],cache:!1,cacheFilepaths:!0,debug:!1,escapeFunction:JK,filterFunction:t=>String(t),functionHeader:"",parse:{exec:"",interpolate:"=",raw:"~"},plugins:[],rmWhitespace:!1,tags:["<%","%>"],useWith:!1,varName:"it"},am=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,lm=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,cm=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g;function um(t){return t.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&")}function YK(t,e){return t.slice(0,e).split(`
|
|
`).length}function XK(t){let e=this.config,r=[],n=!1,o=0,i=e.parse;if(e.plugins)for(let d=0;d<e.plugins.length;d++){let m=e.plugins[d];m.processTemplate&&(t=m.processTemplate(t,e))}e.rmWhitespace&&(t=t.replace(/[\r\n]+/g,`
|
|
`).replace(/^\s+|\s+$/gm,"")),am.lastIndex=0,lm.lastIndex=0,cm.lastIndex=0;function s(d,m){d&&(d=VK(d,e,n,m),d&&(d=d.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),r.push(d)))}let l=[i.exec,i.interpolate,i.raw].reduce(function(d,m){return d&&m?d+"|"+um(m):m?um(m):d},""),c=new RegExp(um(e.tags[0])+"(-|_)?\\s*("+l+")?\\s*","g"),f=new RegExp("'|\"|`|\\/\\*|(\\s*(-|_)?"+um(e.tags[1])+")","g"),u;for(;u=c.exec(t);){let d=t.slice(o,u.index);o=u[0].length+u.index;let m=u[1],h=u[2]||"";s(d,m),f.lastIndex=o;let y,w=!1;for(;y=f.exec(t);)if(y[1]){let v=t.slice(o,y.index);c.lastIndex=o=f.lastIndex,n=y[2],w={t:h===i.exec?"e":h===i.raw?"r":h===i.interpolate?"i":"",val:v};break}else{let v=y[0];if(v==="/*"){let x=t.indexOf("*/",f.lastIndex);x===-1&&Hc("unclosed comment",t,y.index),f.lastIndex=x}else v==="'"?(lm.lastIndex=y.index,lm.exec(t)?f.lastIndex=lm.lastIndex:Hc("unclosed string",t,y.index)):v==='"'?(cm.lastIndex=y.index,cm.exec(t)?f.lastIndex=cm.lastIndex:Hc("unclosed string",t,y.index)):v==="`"&&(am.lastIndex=y.index,am.exec(t)?f.lastIndex=am.lastIndex:Hc("unclosed string",t,y.index))}w?(e.debug&&(w.lineNo=YK(t,u.index)),r.push(w)):Hc("unclosed tag",t,u.index)}if(s(t.slice(o,t.length),!1),e.plugins)for(let d=0;d<e.plugins.length;d++){let m=e.plugins[d];m.processAST&&(r=m.processAST(r,e))}return r}function hD(t,e){let r=e&&e.async?this.templatesAsync:this.templatesSync;if(this.resolvePath&&this.readFile&&!t.startsWith("@")){let n=e.filepath,o=r.get(n);if(this.config.cache&&o)return o;{let i=this.readFile(n),s=this.compile(i,e);return this.config.cache&&r.define(n,s),s}}else{let n=r.get(t);if(n)return n;throw new ft("Failed to get template '"+t+"'")}}function gD(t,e,r){let n,o={...r,async:!1};return typeof t=="string"?(this.resolvePath&&this.readFile&&!t.startsWith("@")&&(o.filepath=this.resolvePath(t,o)),n=hD.call(this,t,o)):n=t,n.call(this,e,o)}function yD(t,e,r){let n,o={...r,async:!0};typeof t=="string"?(this.resolvePath&&this.readFile&&!t.startsWith("@")&&(o.filepath=this.resolvePath(t,o)),n=hD.call(this,t,o)):n=t;let i=n.call(this,e,o);return Promise.resolve(i)}function QK(t,e){let r=this.compile(t,{async:!1});return gD.call(this,r,e)}function eV(t,e){let r=this.compile(t,{async:!0});return yD.call(this,r,e)}var pm=class{constructor(e){this.config=void 0,this.RuntimeErr=zK,this.compile=WK,this.compileToString=HK,this.compileBody=KK,this.parse=XK,this.render=gD,this.renderAsync=yD,this.renderString=QK,this.renderStringAsync=eV,this.filepathCache={},this.templatesSync=new fm({}),this.templatesAsync=new fm({}),this.resolvePath=null,this.readFile=null,e?this.config={...mD,...e}:this.config={...mD}}configure(e){this.config={...this.config,...e}}withConfig(e){return{...this,config:{...this.config,...e}}}loadTemplate(e,r,n){if(typeof r=="string")(n&&n.async?this.templatesAsync:this.templatesSync).define(e,this.compile(r,n));else{let o=this.templatesSync;(r.constructor.name==="AsyncFunction"||n&&n.async)&&(o=this.templatesAsync),o.define(e,r)}}};var ID=require("obsidian");a();var Gn=require("node:path/posix");var M0=require("obsidian");function tV(t){if(!t)return"";let e=Zy(t);return e||(t.endsWith(".eta.md")?t:t.endsWith(".eta")?t+".md":t+".eta.md")}function bD(t){let e=Et(t,this.settings.templateDir);if(e?.type==="embeded")return this.settings.simpleTemplates[e.name];let r=this.getFile(t);if(typeof r=="string"){if(!e)throw new ft(`File '${t}' not found`);return ht.Ejectable[e.name]}if(!this.tplFileCache.has(r))throw new ft(`File '${t}' not loaded`);return this.tplFileCache.get(r)}function vD(t){let e=Et(t,this.settings.templateDir);if(e?.type==="embeded")return-1;let r=this.getFile(t);if(typeof r=="string"){if(!e)throw new ft(`File '${t}' not found`);return}if(!this.tplFileCache.has(r))throw new ft(`File '${t}' not loaded`);return r.stat.mtime}function wD(t,e){let r="",n=this.config.views;if(!n)throw new ft("Views directory is not defined");let o=e&&e.filepath,i=JSON.stringify({filename:o,path:t,views:this.config.views});if(t=tV(t),o){if(this.config.cacheFilepaths&&this.filepathCache[i])return this.filepathCache[i];(0,Gn.isAbsolute)(t)?r=(0,Gn.join)(n,(0,M0.normalizePath)(t)):r=(0,Gn.join)(o,"..",(0,M0.normalizePath)(t))}else r=(0,Gn.join)(n,t);if(rV(n,r))return o&&this.config.cacheFilepaths&&(this.filepathCache[i]=r),r;throw new ft(`Template '${t}' is not in the views directory`)}function rV(t,e){let r=(0,Gn.relative)(t,e);return r&&!r.startsWith("..")&&!(0,Gn.isAbsolute)(r)}a();function xD(t,e){let r=e&&e.async?this.templatesAsync:this.templatesSync;if(t.startsWith("@")){let n=r.get(t);if(n)return n;throw new ft("Failed to get template '"+t+"'")}else{let n=e.filepath,o=r.get(n),i=this.readModTime(n),s=o?.mtime;if(this.config.cache&&o&&(i===void 0||i>0&&s!==void 0&&i<=s))return o;let l=this.readFile(n),c=this.compile(l,e);return this.config.cache&&r.define(n,c),c}}function L0(t,e,r){let n,o={...r,async:!1};return typeof t=="string"?(t.startsWith("@")||(o.filepath=this.resolvePath(t,o)),n=xD.call(this,t,o)):n=t,n.call(this,e,o)}function j0(t,e,r){let n,o={...r,async:!0};typeof t=="string"?(t.startsWith("@")||(o.filepath=this.resolvePath(t,o)),n=xD.call(this,t,o)):n=t;let i=n.call(this,e,o);return Promise.resolve(i)}function ED(t,e){let r=this.compile(t,{async:!1});return L0.call(this,r,e)}function SD(t,e){let r=this.compile(t,{async:!0});return j0.call(this,r,e)}var dm=class extends pm{use=ws.this;settings=this.use(be);app=this.use(ID.App);tplFileCache=new WeakMap;constructor(){super();let e=this;this.config={...this.config,cache:!0,autoEscape:!1,autoFilter:!0,filterFunction:r=>r==null?"":r instanceof Date?r.toISOString():r,plugins:[],get autoTrim(){return e.settings.current?.autoTrim},get views(){return e.settings.templateDir}}}resolvePath=wD;readFile=bD;readModTime=vD;render=L0;renderAsync=j0;renderString=ED;renderStringAsync=SD;getFile(e){let r=this.app.vault.getAbstractFileByPath(e);if(!r)return e;if(!wt(r))throw new ft(`'${e}' is not a markdown file`);return r}};a();var c2=Y(QM(),1),u2=Y(i2(),1);var Zm=require("obsidian");a();var BQ="\\ufeff?",zQ=typeof process<"u"?process.platform:"",UQ="^("+BQ+"(= yaml =|---)$([\\s\\S]*?)^(?:\\2|\\.\\.\\.)\\s*$"+(zQ==="win32"?"\\r?":"")+"(?:\\n)?)",WQ=new RegExp(UQ,"m");function Um(t){t=t||"";let e=t.split(/(\r?\n)/);return e[0]&&/= yaml =|---/.test(e[0])?KQ(t):{yaml:null,body:t,bodyBegin:1}}function HQ(t,e){let r=1,n=e.indexOf(`
|
|
`),o=t.index+t[0].length;for(;n!==-1;){if(n>=o)return r;r++,n=e.indexOf(`
|
|
`,n+1)}return r}function KQ(t){let e=WQ.exec(t);if(!e)return{yaml:null,body:t,bodyBegin:1};let r=e[e.length-1].replace(/^\s+|\s+$/g,""),n=t.replace(e[0],""),o=HQ(e,t);return{yaml:r,body:n,bodyBegin:o}}a();var Hm=require("path"),Hw=require("url");a();a();a();a();function zw(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Uw(t,e){if(typeof t!="string"||typeof e!="string")throw new TypeError("Expected a string");let r=new RegExp(`(?:${zw(e)}){2,}`,"g");return t.replace(r,e)}a();function Wm(){return/[<>:"/\\|?*\u0000-\u001F]/g}function s2(){return/^(con|prn|aux|nul|com\d|lpt\d)$/i}a();function Ww(t,e){if(typeof t!="string"||typeof e!="string")throw new TypeError("Expected a string");return t.startsWith(e)&&(t=t.slice(e.length)),t.endsWith(e)&&(t=t.slice(0,-e.length)),t}var VQ=100,a2=/[\u0000-\u001F\u0080-\u009F]/g,GQ=/^\.+(\\|\/)|^\.+$/,ZQ=/\.+$/;function Qi(t,e={}){if(typeof t!="string")throw new TypeError("Expected a string");let r=e.replacement===void 0?"!":e.replacement;if(Wm().test(r)&&a2.test(r))throw new Error("Replacement string cannot contain reserved filename characters");if(t=t.normalize("NFD"),t=t.replace(GQ,r),t=t.replace(Wm(),r),t=t.replace(a2,r),t=t.replace(ZQ,""),r.length>0){let o=t[0]===".";t=Uw(t,r),t=t.length>1?Ww(t,r):t,!o&&t[0]==="."&&(t=r+t),t[t.length-1]==="."&&(t+=r)}t=s2().test(t)?t+r:t;let n=typeof e.maxLength=="number"?e.maxLength:VQ;if(t.length>n){let o=t.lastIndexOf(".");if(o===-1)t=t.slice(0,n);else{let i=t.slice(0,o),s=t.slice(o);t=i.slice(0,Math.max(1,n-s.length))+s}}return t}a();var Kw=t=>encodeURI(t)===t?t:`<${t}>`,Km=t=>t.name.endsWith(".eta.md"),Vw=(t,e)=>e.path?e.path.startsWith("storage:")?(0,Hm.join)(t,"storage",e.key,e.path.replace(/^storage:/,"")):e.path:"",Vm=(t,e,r,n=null,o=null)=>{if(!n?.path)return"";let i=o?`#page=${o}`:void 0,s=e.vault.adapter.getBasePath(),l=Vw(t,n),c=(0,Hm.relative)(s,l);if(c.startsWith(".."))return`[attachment](${Kw((0,Hw.pathToFileURL)(l).href+(i??""))})`;{let f=e.metadataCache.getFirstLinkpathDest(c,"");return f?e.fileManager.generateMarkdownLink(f,r??"",i).replace(/^!/,""):(W.warn("fileLink: file not found",c,l),"")}},l2=t=>Qi(t,{replacement:"_"}),Gm=t=>Wc(t)&&t.type===Re.image,JQ=(t,e,r)=>e?`[${r??""}](${Kw(t)})`:`[[${t}${r?"|"+r:""}]]`,Gw=(t,e)=>{if(Gm(t)){let r=e.imgCacheImporter.import(t);if(r)return JQ(r,e.app.vault.getConfig("useMarkdownLinks"));{let n=e.imgCacheImporter.getCachePath(t);return`[Annotation ${t.key}](${Kw((0,Hw.pathToFileURL)(n).href)})`}}else return""};function f2(t){sr(t,{compile:e=>function(n,o){let i=this,s=e.call(this,n,o);if(!o?.filepath)return s;let l=o.filepath,c=Et(l,i.settings.templateDir);if(!c)return s;let f=s;switch(c.name){case"filename":f=(u,d)=>l2(s.call(this,u,d));break;case"annotation":f=(u,d)=>{let m=s.call(this,u,d),h=!0,{yaml:y,body:w}=Um(m);if(y)try{(0,Zm.parseYaml)(y).callout===!1&&(h=!1)}catch(x){new Zm.Notice(`Error parsing frontmatter, ${x}`)}if(!h)return w;let v=w.trim().split(`
|
|
`);return v.push(`^${u.blockID}`),v.map(x=>`> ${x}`).join(`
|
|
`)};break;default:break}return Object.groupBy&&Map.groupBy?f:(u,d)=>{let m=YQ(),h=f.call(this,u,d);return m(),h}}})}function YQ(){let t=[];return Object.groupBy||(Object.groupBy=u2.default,t.push(()=>delete Object.groupBy)),Map.groupBy||(Map.groupBy=c2.default,t.push(()=>delete Map.groupBy)),()=>t.forEach(e=>e())}a();var es="zotero-key",Oa="zt-attachments";a();a();var p2=require("url");var d2=require("obsidian");a();var Ho=t=>t.plugin.settings.current?.zoteroDataDir,uu=Symbol("proxied"),Jm=t=>!!t[uu];var Ym={"#FF6666":"red","#FF8C19":"orange","#F19837":"orange","#FFD400":"yellow","#999999":"gray","#AAAAAA":"gray","#5FB236":"green","#009980":"cyan","#2EA8E5":"blue","#576DD9":"navy","#A28AE5":"purple","#A6507B":"brown","#E56EEE":"magenta"};var Zw=new Set(lo()("attachment","tags")),Jw=(t,e,r)=>new Proxy({get page(){return xs(t.position.pageIndex,!0)??NaN},get backlink(){return Bo(t)},get blockID(){let n=ar(t),o=xs(t.position.pageIndex,!0);return typeof o=="number"&&(n+=`p${o}`),n},get commentMd(){return t.comment?(0,d2.htmlToMarkdown)(t.comment):""},get imgPath(){return Gm(this)?qo(this,Ho(r)):""},get imgUrl(){if(Gm(this)){let n=qo(this,Ho(r));return(0,p2.pathToFileURL)(n).href}else return""},get imgLink(){return Gw(this,r.plugin)},get imgEmbed(){let n=Gw(this,r.plugin);return n?`!${n}`:""},get fileLink(){return Vm(Ho(r),r.plugin.app,r.sourcePath,e.attachment,xs(t.position.pageIndex,!0))},get textBlock(){return t.text?`\`\`\`zotero-annot
|
|
> ${t.text} [zotero](${Bo(t)})
|
|
\`\`\``:""},get colorName(){let n=t.color?.toUpperCase();return Ym[n]||this.color},docItem:"not-loaded"},{get(n,o,i){if(o==="tags"){if(!e.tags[t.itemID])throw console.error(e,t.itemID),new Error("No tags loaded for item "+t.itemID);return e.tags[t.itemID]}if(o==="docItem"){if(n.docItem==="not-loaded")throw new Error("Doc Item not loaded for item "+t.itemID);return n.docItem}return Zw.has(o)?Reflect.get(e,o,i):Reflect.get(t,o,i)??Reflect.get(n,o,i)},ownKeys(n){return[...Reflect.ownKeys(t),...Zw,...Reflect.ownKeys(n)]},getOwnPropertyDescriptor(n,o){return Object.prototype.hasOwnProperty.call(t,o)?Reflect.getOwnPropertyDescriptor(t,o):Zw.has(o)?Reflect.getOwnPropertyDescriptor(e,o):Reflect.getOwnPropertyDescriptor(n,o)}});a();function Yw(t,e){return!t||Jm(t)?t:new Proxy({get filePath(){return Vw(Ho(e),t)}},{get(r,n,o){return n===uu?!0:Reflect.get(t,n,o)??Reflect.get(r,n,o)},ownKeys(r){return[...Reflect.ownKeys(t),...Reflect.ownKeys(r)]},getOwnPropertyDescriptor(r,n){return Object.prototype.hasOwnProperty.call(t,n)?Reflect.getOwnPropertyDescriptor(t,n):Reflect.getOwnPropertyDescriptor(r,n)}})}a();a();var Xw=class extends Array{toString(){return this.join(" > ")}},Qw=({path:t,...e})=>{let r={path:Xw.from(t),toString(){return e.name}};return new Proxy(r,{get(n,o,i){return Reflect.get(n,o,i)??Reflect.get(e,o,i)},ownKeys(n){return[...Reflect.ownKeys(e),...Reflect.ownKeys(n).filter(o=>!(o==="toJSON"||o==="toString"))]},getOwnPropertyDescriptor(n,o){return Object.prototype.hasOwnProperty.call(e,o)?Reflect.getOwnPropertyDescriptor(e,o):Reflect.getOwnPropertyDescriptor(n,o)}})};a();var ex=t=>{let e={get fullname(){return Uc(t)??""},toString(){return this.fullname},toJSON(){return this.fullname}};return new Proxy(e,{get(r,n,o){return Reflect.get(r,n,o)??Reflect.get(t,n,o)},ownKeys(r){return[...Reflect.ownKeys(t),...Reflect.ownKeys(r).filter(n=>!(n==="toJSON"||n==="toString"))]},getOwnPropertyDescriptor(r,n){return Object.prototype.hasOwnProperty.call(t,n)?Reflect.getOwnPropertyDescriptor(t,n):Reflect.getOwnPropertyDescriptor(r,n)}})};var tx=new Set(lo()("attachment","allAttachments","tags","notes")),rx=({creators:t,collections:e,...r},n,o)=>{let i=t.map(s=>ex(s));return new Proxy({get backlink(){return Bo(r)},get fileLink(){return Vm(Ho(o),o.plugin.app,o.sourcePath,n.attachment)},get authorsShort(){let s=this.authors;if(!s.length)return"";let l=s[0],c=l.lastName??l.fullname;return s.length===1?c:`${c} et al.`},annotations:"not-loaded",creators:i,collections:e.map(s=>Qw(s)),get authors(){return i.filter(s=>s.creatorType==="author")}},{get(s,l,c){if(l==="tags"){if(!n.tags[r.itemID])throw new Error("No tags loaded for item "+r.itemID);return n.tags[r.itemID]}return tx.has(l)?n[l]:l==="annotations"?s.annotations:Reflect.get(r,l,c)??Reflect.get(s,l,c)},ownKeys(s){return[...Reflect.ownKeys(r),...tx,...Reflect.ownKeys(s)]},getOwnPropertyDescriptor(s,l){return Object.prototype.hasOwnProperty.call(r,l)?Reflect.getOwnPropertyDescriptor(r,l):tx.has(l)?Reflect.getOwnPropertyDescriptor(n,l):Reflect.getOwnPropertyDescriptor(s,l)}})};a();function m2(t){return!t||Jm(t)?t:new Proxy({toString(){return t.name},toJSON(){return t.name}},{get(e,r,n){return r===uu?!0:Reflect.get(e,r,n)??Reflect.get(t,r,n)},ownKeys(e){return[...Reflect.ownKeys(t),...Reflect.ownKeys(e).filter(r=>!(r==="toJSON"||r==="toString"))]},getOwnPropertyDescriptor(e,r){return Object.prototype.hasOwnProperty.call(t,r)?Reflect.getOwnPropertyDescriptor(t,r):Reflect.getOwnPropertyDescriptor(e,r)}})}function zt(t,e,r){let n={...t,attachement:Yw(t.attachment,e),allAttachments:t.allAttachments.map(l=>Yw(l,e)),tags:ya(t.tags,l=>l.map(c=>m2(c)))},o=rx(t.docItem,n,e),i=t.annotations.map(l=>{let c=Jw(l,n,e);return c.docItem=o,c}),s=r?i[t.annotations.findIndex(l=>l.itemID===r.itemID)]:void 0;return o.annotations=i,{annotation:s,annotations:i,docItem:o}}var Ko=class extends de{eta=this.use(dm);plugin=this.use(Se);settings=this.use(be);app=this.use(Ct.App);get vault(){return this.app.vault}get folder(){return this.settings.templateDir}get filenameTemplate(){return this.settings.simpleTemplates?.filename}get autoTrim(){return this.settings.current?.autoTrim}async loadTemplates(){let e=this.vault.getAbstractFileByPath(this.folder);if(!e)return;if(!(e instanceof Ct.TFolder)){W.warn("Template folder is occupied by a file");return}let r=[];Ct.Vault.recurseChildren(e,async n=>{!wt(n)||!n.path.endsWith(".eta.md")||r.push(n)}),await Promise.all(r.map(async n=>this.eta.tplFileCache.set(n,await this.vault.cachedRead(n))))}onload(){f2(this.eta),this.settings.once(async()=>{await this.loadTemplates()}),this.register(Ve(ut(()=>this.plugin.app.vault.trigger("zotero:template-updated","filename"),()=>this.filenameTemplate,!0))),this.register(Ve(ut(async()=>tn.All.forEach(e=>this.plugin.app.vault.trigger("zotero:template-updated",e)),()=>this.autoTrim,!0))),this.registerEvent(this.vault.on("create",this.onFileChange,this)),this.registerEvent(this.vault.on("modify",this.onFileChange,this)),this.registerEvent(this.vault.on("delete",async e=>{if(!wt(e))return;let r=this.fromPath(e.path);r&&(this.eta.tplFileCache.delete(e),this.vault.trigger("zotero:template-updated",r))})),this.registerEvent(this.vault.on("rename",async(e,r)=>{await this.onFileChange(e);let n=this.fromPath(r);n&&this.vault.trigger("zotero:template-updated",n)}))}async onFileChange(e){if(!wt(e))return;let r=this.fromPath(e.path);this.eta.tplFileCache.set(e,await this.vault.cachedRead(e)),this.vault.trigger("zotero:template-updated",r)}fromPath(e){let r=Et(e,this.folder);return r?.type==="ejectable"?r.name:null}onFileUpdate(e){wt(e)&&this.fromPath(e.path)}onFileRename(e,r){wt(e)&&this.fromPath(e.path),this.fromPath(r)}mergeAnnotTags(e){if(e.annotations.length===0)return e;let r=dD(e.annotations,e.tags);return e.annotations=r.annotations,e.tags={...e.tags,...r.tags},e}render(e,r){try{let n=this.eta.render(e,r);return this.plugin.imgCacheImporter.flush(),n}catch(n){throw console.error("Error while rendering",e,n),n}}renderAnnot(e,r,n){n.merge!==!1&&(r=this.mergeAnnotTags(r));let o=zt(r,n,e);return this.render("annotation",o.annotation)}renderNote(e,r,n){r.merge!==!1&&(e=this.mergeAnnotTags(e));let o=zt(e,r),i=this.#e(o.docItem,n),s=this.render("note",o.docItem);return["",i,s].join(`---
|
|
`)}renderAnnots(e,r){r.merge!==!1&&(e=this.mergeAnnotTags(e));let n=zt(e,r);return this.render("annots",n.annotations)}renderCitations(e,r,n=!1){let o=e.map(i=>zt(i,r));return this.render(n?"cite2":"cite",o.map(i=>i.docItem))}renderColored(e){return this.render("colored",e)}renderFilename(e,r){let n=zt(e,r);return this.render("filename",n.docItem)}toFrontmatterRecord(e){let r=this.render("field",e),n=!1,{yaml:o,body:i}=Um(r);if(o)try{(0,Ct.parseYaml)(o).raw===!0&&(n=!0)}catch(d){new Ct.Notice(`Error parsing frontmatter, ${d}`)}let s=ar(e,!0),l=e.attachment?[e.attachment.itemID.toString()]:void 0,{[es]:c,[Oa]:f,...u}=(0,Ct.parseYaml)(i);return{mode:n?"raw":"parsed",yaml:[`${es}: ${s}`,`${Oa}: ${f??l}`,i.trim(),""].join(`
|
|
`),data:{[es]:s,[Oa]:l,...qc(u,d=>!(d===""||d===null||d===void 0))}}}renderFrontmatter(e,r,n){let o=zt(e,r);return this.#e(o.docItem,n)}#e(e,r){try{let n=this.toFrontmatterRecord(e);return n.mode==="raw"?n.yaml:(0,Ct.stringifyYaml)(r!==void 0?Hi(n.data,r):n.data)}catch(n){throw gt("Failed to renderYaml",n,e),new Ct.Notice("Failed to renderYaml"),n}}async setFrontmatterTo(e,r){try{let n=this.toFrontmatterRecord(r).data;await this.plugin.app.fileManager.processFrontMatter(e,o=>Object.assign(o,n))}catch(n){gt("Failed to set frontmatter to file "+e.path,n,r),new Ct.Notice("Failed to set frontmatter to file "+e.path)}}};he([ge],Ko.prototype,"folder",1),he([ge],Ko.prototype,"filenameTemplate",1),he([ge],Ko.prototype,"autoTrim",1);a();a();var Xm=require("@codemirror/state"),h2=require("obsidian");var g2=t=>Xm.Prec.highest(Xm.EditorState.languageData.of(e=>{let r=[],n=t.getConfig("autoPairBrackets"),o=t.getConfig("autoPairMarkdown");n&&r.push("(","[","{","'",'"'),o&&r.push("*","_","`","```");let i=e.field(h2.editorInfoField);return i?.file&&Km(i?.file)&&r.push("<","%"),[{closeBrackets:{brackets:r}}]}));a();var b2=require("obsidian");var y2=[{prefix:"=",name:"interpolate tag",description:"An interpolation outputs data into the template"},{prefix:" ",name:"evaluation tag",description:"An evaluate tag inserts its contents into the template function."}],Qm=class extends b2.EditorSuggest{onTrigger(e,r,n){if(!n||!Km(n))return null;let o=r.getLine(e.line),s=o.substring(0,e.ch).match(/<%([ =]?)$/);if(!s)return null;let[l,c]=s,f=o.substring(e.ch).match(/^([\w ]*)%>/),u;if(!f)u={...e};else{let[,d]=f;if(c===" "&&d.length===1)return null;u={...e,ch:e.ch+d.length}}return{end:u,start:{ch:s.index+l.length-c.length,line:e.line},query:s[1]}}getSuggestions(e){return e.query?y2.filter(r=>r.prefix===e.query):y2}renderSuggestion({prefix:e,name:r,description:n},o){e===" "?o.createSpan({text:"No Prefix"}):o.createEl("code",{text:e}),o.createDiv({text:r}),o.createDiv({text:n})}selectSuggestion({prefix:e},r){if(!this.context)return;let{editor:n,end:o,start:i}=this.context,s=e===" "?" ":"= it. ";n.transaction({changes:[{from:i,to:o,text:s}],selection:{from:{...i,ch:i.ch+s.length-1}}})}};var Ta=class extends de{#e=null;plugin=this.use(Se);settings=this.use(be);#t(){this.plugin.registerEditorSuggest(new Qm(this.plugin.app))}get etaBracketPairing(){return this.settings.current?.autoPairEta}#n(e){let r=this.#e!==null;this.#e===null?(this.#e=[],this.plugin.registerEditorExtension(this.#e)):this.#e.length=0,e&&this.#e.push(g2(this.plugin.app.vault)),r&&this.plugin.app.workspace.updateOptions()}onload(){this.#t(),this.register(Ve(ut(()=>this.#n(this.etaBracketPairing),()=>this.etaBracketPairing)))}};he([ge],Ta.prototype,"etaBracketPairing",1);a();var ox=t=>{let e=t?.frontmatter?.[es];return e&&typeof e=="string"&&OS.test(e)?e:null},ts=(t,e)=>{if(!t)return null;let r=typeof t=="string"?e.getCache(t):t instanceof nx.TFile?e.getFileCache(t):null;return ox(r)},rs=(t,e)=>{if(!t)return null;let n=(typeof t=="string"?e.getCache(t):t instanceof nx.TFile?e.getFileCache(t):null)?.frontmatter?.[Oa];if(n&&Array.isArray(n)&&n.length>0){let o=[];for(let i of n)if(typeof i=="string"){let s=Number(i);if(!(s>0&&Number.isInteger(s)))return null;o.push(s)}else if(typeof i=="number"){if(!(i>0&&Number.isInteger(i)))return null;o.push(i)}return o}return null},fu=({id:t})=>!!t&&CS.test(t),pu=t=>t.split("n").map(e=>{let[,r,,n]=e.split("p")[0].match(TS);return ar({key:r,groupID:n?+n:void 0},!0)});function du(t,e){let r=pD(t);return!!ts(r,e.metadataCache)}a();var qq=require("url");a();a();_();var Vo=Ke({});a();a();_();var Ze=Ke({});a();a();a();_();a();var v2=function(t){return typeof t=="function"};a();var QQ=!1,w2=QQ;function eee(t){w2&&(v2(t)||console.error("useMemoizedFn expected parameter is a function, got ".concat(typeof t)));var e=M(t);e.current=ae(function(){return t},[t]);var r=M();return r.current||(r.current=function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return e.current.apply(this,n)}),r.current}var Hr=eee;a();_();a();_();function tee(t,e){t===void 0&&(t=!1);var r=Oo(q(t),2),n=r[0],o=r[1],i=ae(function(){var s=e===void 0?!t:e,l=function(){return o(function(d){return d===t?s:t})},c=function(d){return o(d)},f=function(){return o(t)},u=function(){return o(s)};return{toggle:l,set:c,setLeft:f,setRight:u}},[]);return[n,i]}var x2=tee;function eh(t){t===void 0&&(t=!1);var e=Oo(x2(!!t),2),r=e[0],n=e[1],o=n.toggle,i=n.set,s=ae(function(){var l=function(){return i(!0)},c=function(){return i(!1)};return{toggle:o,set:function(f){return i(!!f)},setTrue:l,setFalse:c}},[]);return[r,s]}a();_();function ree(t){var e=function(){return new Set(t)},r=Oo(q(e),2),n=r[0],o=r[1],i=function(c){n.has(c)||o(function(f){var u=new Set(f);return u.add(c),u})},s=function(c){n.has(c)&&o(function(f){var u=new Set(f);return u.delete(c),u})},l=function(){return o(e())};return[n,{add:Hr(i),remove:Hr(s),reset:Hr(l)}]}var ix=ree;_();a();a();var S2={},E2=t=>{let e,r=new Set,n=(c,f)=>{let u=typeof c=="function"?c(e):c;if(!Object.is(u,e)){let d=e;e=f??typeof u!="object"?u:Object.assign({},e,u),r.forEach(m=>m(e,d))}},o=()=>e,l={setState:n,getState:o,subscribe:c=>(r.add(c),()=>r.delete(c)),destroy:()=>{(S2.env&&S2.env.MODE)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,o,l),l},mu=t=>t?E2(t):E2;_();var N2=Y(R2(),1);var{useSyncExternalStoreWithSelector:wee}=N2.default;function Ut(t,e=t.getState,r){let n=wee(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return Oi(n),n}a();function ka(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(let[n,o]of t)if(!Object.is(o,e.get(n)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(let n of t)if(!e.has(n))return!1;return!0}let r=Object.keys(t);if(r.length!==Object.keys(e).length)return!1;for(let n=0;n<r.length;n++)if(!Object.prototype.hasOwnProperty.call(e,r[n])||!Object.is(t[r[n]],e[r[n]]))return!1;return!0}a();_();a();a();function D2(){for(var t=0,e,r,n="";t<arguments.length;)(e=arguments[t++])&&(r=P2(e))&&(n&&(n+=" "),n+=r);return n}function P2(t){if(typeof t=="string")return t;for(var e,r="",n=0;n<t.length;n++)t[n]&&(e=P2(t[n]))&&(r&&(r+=" "),r+=e);return r}a();a();a();a();var lx="-";function M2(t){var e=Eee(t);function r(o){var i=o.split(lx);return i[0]===""&&i.length!==1&&i.shift(),L2(i,e)||xee(o)}function n(o){return t.conflictingClassGroups[o]||[]}return{getClassGroupId:r,getConflictingClassGroupIds:n}}function L2(t,e){if(t.length===0)return e.classGroupId;var r=t[0],n=e.nextPart.get(r),o=n?L2(t.slice(1),n):void 0;if(o)return o;if(e.validators.length!==0){var i=t.join(lx);return e.validators.find(function(s){var l=s.validator;return l(i)})?.classGroupId}}var F2=/^\[(.+)\]$/;function xee(t){if(F2.test(t)){var e=F2.exec(t)[1],r=e?.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}}function Eee(t){var e=t.theme,r=t.prefix,n={nextPart:new Map,validators:[]},o=Iee(Object.entries(t.classGroups),r);return o.forEach(function(i){var s=i[0],l=i[1];ax(l,n,s,e)}),n}function ax(t,e,r,n){t.forEach(function(o){if(typeof o=="string"){var i=o===""?e:$2(e,o);i.classGroupId=r;return}if(typeof o=="function"){if(See(o)){ax(o(n),e,r,n);return}e.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(function(s){var l=s[0],c=s[1];ax(c,$2(e,l),r,n)})})}function $2(t,e){var r=t;return e.split(lx).forEach(function(n){r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r}function See(t){return t.isThemeGetter}function Iee(t,e){return e?t.map(function(r){var n=r[0],o=r[1],i=o.map(function(s){return typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(function(l){var c=l[0],f=l[1];return[e+c,f]})):s});return[n,i]}):t}a();function j2(t){if(t<1)return{get:function(){},set:function(){}};var e=0,r=new Map,n=new Map;function o(i,s){r.set(i,s),e++,e>t&&(e=0,n=r,r=new Map)}return{get:function(s){var l=r.get(s);if(l!==void 0)return l;if((l=n.get(s))!==void 0)return o(s,l),l},set:function(s,l){r.has(s)?r.set(s,l):o(s,l)}}}a();var cx="!";function q2(t){var e=t.separator||":";return function(n){for(var o=0,i=[],s=0,l=0;l<n.length;l++){var c=n[l];o===0&&c===e[0]&&(e.length===1||n.slice(l,l+e.length)===e)&&(i.push(n.slice(s,l)),s=l+e.length),c==="["?o++:c==="]"&&o--}var f=i.length===0?n:n.substring(s),u=f.startsWith(cx),d=u?f.substring(1):f;return{modifiers:i,hasImportantModifier:u,baseClassName:d}}}function B2(t){if(t.length<=1)return t;var e=[],r=[];return t.forEach(function(n){var o=n[0]==="[";o?(e.push.apply(e,r.sort().concat([n])),r=[]):r.push(n)}),e.push.apply(e,r.sort()),e}function z2(t){return{cache:j2(t.cacheSize),splitModifiers:q2(t),...M2(t)}}a();var _ee=/\s+/;function U2(t,e){var r=e.splitModifiers,n=e.getClassGroupId,o=e.getConflictingClassGroupIds,i=new Set;return t.trim().split(_ee).map(function(s){var l=r(s),c=l.modifiers,f=l.hasImportantModifier,u=l.baseClassName,d=n(u);if(!d)return{isTailwindClass:!1,originalClassName:s};var m=B2(c).join(":"),h=f?m+cx:m;return{isTailwindClass:!0,modifierId:h,classGroupId:d,originalClassName:s}}).reverse().filter(function(s){if(!s.isTailwindClass)return!0;var l=s.modifierId,c=s.classGroupId,f=l+c;return i.has(f)?!1:(i.add(f),o(c).forEach(function(u){return i.add(l+u)}),!0)}).reverse().map(function(s){return s.originalClassName}).join(" ")}function W2(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n,o,i,s=l;function l(f){var u=e[0],d=e.slice(1),m=d.reduce(function(h,y){return y(h)},u());return n=z2(m),o=n.cache.get,i=n.cache.set,s=c,c(f)}function c(f){var u=o(f);if(u)return u;var d=U2(f,n);return i(f,d),d}return function(){return s(D2.apply(null,arguments))}}a();a();function ke(t){var e=function(n){return n[t]||[]};return e.isThemeGetter=!0,e}a();var K2=/^\[(?:([a-z-]+):)?(.+)\]$/i,Oee=/^\d+\/\d+$/,Tee=new Set(["px","full","screen"]),Cee=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,kee=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh)/,Aee=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;function Or(t){return Aa(t)||Tee.has(t)||Oee.test(t)||Go(t)}function Go(t){return ns(t,"length",Ree)}function V2(t){return ns(t,"size",Y2)}function G2(t){return ns(t,"position",Y2)}function Z2(t){return ns(t,"url",Nee)}function rh(t){return ns(t,"number",Aa)}function Aa(t){return!Number.isNaN(Number(t))}function Ra(t){return H2(t)||ns(t,"number",H2)}function Be(t){return K2.test(t)}function Na(){return!0}function Xn(t){return Cee.test(t)}function J2(t){return ns(t,"",Dee)}function ns(t,e,r){var n=K2.exec(t);return n?n[1]?n[1]===e:r(n[2]):!1}function Ree(t){return kee.test(t)}function Y2(){return!1}function Nee(t){return t.startsWith("url(")}function H2(t){return Number.isInteger(Number(t))}function Dee(t){return Aee.test(t)}function X2(){var t=ke("colors"),e=ke("spacing"),r=ke("blur"),n=ke("brightness"),o=ke("borderColor"),i=ke("borderRadius"),s=ke("borderSpacing"),l=ke("borderWidth"),c=ke("contrast"),f=ke("grayscale"),u=ke("hueRotate"),d=ke("invert"),m=ke("gap"),h=ke("gradientColorStops"),y=ke("inset"),w=ke("margin"),v=ke("opacity"),x=ke("padding"),S=ke("saturate"),k=ke("scale"),j=ke("sepia"),Z=ke("skew"),X=ke("space"),J=ke("translate"),G=function(){return["auto","contain","none"]},$=function(){return["auto","hidden","clip","visible","scroll"]},te=function(){return["auto",e]},C=function(){return["",Or]},T=function(){return["auto",Aa,Be]},O=function(){return["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"]},U=function(){return["solid","dashed","dotted","double","none"]},F=function(){return["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"]},se=function(){return["start","end","center","between","around","evenly"]},le=function(){return["","0",Be]},we=function(){return["auto","avoid","all","avoid-page","page","left","right","column"]},fe=function(){return[Aa,rh]},I=function(){return[Aa,Be]};return{cacheSize:500,theme:{colors:[Na],spacing:[Or],blur:["none","",Xn,Go],brightness:fe(),borderColor:[t],borderRadius:["none","","full",Xn,Go],borderSpacing:[e],borderWidth:C(),contrast:fe(),grayscale:le(),hueRotate:I(),invert:le(),gap:[e],gradientColorStops:[t],inset:te(),margin:te(),opacity:fe(),padding:[e],saturate:fe(),scale:fe(),sepia:le(),skew:I(),space:[e],translate:[e]},classGroups:{aspect:[{aspect:["auto","square","video",Be]}],container:["container"],columns:[{columns:[Xn]}],"break-after":[{"break-after":we()}],"break-before":[{"break-before":we()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none"]}],clear:[{clear:["left","right","both","none"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[].concat(O(),[Be])}],overflow:[{overflow:$()}],"overflow-x":[{"overflow-x":$()}],"overflow-y":[{"overflow-y":$()}],overscroll:[{overscroll:G()}],"overscroll-x":[{"overscroll-x":G()}],"overscroll-y":[{"overscroll-y":G()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ra]}],basis:[{basis:[e]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Be]}],grow:[{grow:le()}],shrink:[{shrink:le()}],order:[{order:["first","last","none",Ra]}],"grid-cols":[{"grid-cols":[Na]}],"col-start-end":[{col:["auto",{span:[Ra]},Be]}],"col-start":[{"col-start":T()}],"col-end":[{"col-end":T()}],"grid-rows":[{"grid-rows":[Na]}],"row-start-end":[{row:["auto",{span:[Ra]},Be]}],"row-start":[{"row-start":T()}],"row-end":[{"row-end":T()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Be]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Be]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:se()}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:[].concat(se(),["baseline"])}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[].concat(se(),["baseline","stretch"])}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[X]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[X]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",e]}],"min-w":[{"min-w":["min","max","fit",Or]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[Xn]},Xn,Go]}],h:[{h:[e,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",Or]}],"max-h":[{"max-h":[e,"min","max","fit"]}],"font-size":[{text:["base",Xn,Go]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",rh]}],"font-family":[{font:[Na]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Go]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Or]}],"list-style-type":[{list:["none","disc","decimal",Be]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[v]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[v]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[].concat(U(),["wavy"])}],"text-decoration-thickness":[{decoration:["auto","from-font",Or]}],"underline-offset":[{"underline-offset":["auto",Or]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:[e]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Go]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap"]}],break:[{break:["normal","words","all","keep"]}],content:[{content:["none",Be]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[v]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[].concat(O(),[G2])}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",V2]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Z2]}],"bg-color":[{bg:[t]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[v]}],"border-style":[{border:[].concat(U(),["hidden"])}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[v]}],"divide-style":[{divide:U()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:[""].concat(U())}],"outline-offset":[{"outline-offset":[Or]}],"outline-w":[{outline:[Or]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:C()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[v]}],"ring-offset-w":[{"ring-offset":[Or]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Xn,J2]}],"shadow-color":[{shadow:[Na]}],opacity:[{opacity:[v]}],"mix-blend":[{"mix-blend":F()}],"bg-blend":[{"bg-blend":F()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Xn,Be]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[S]}],sepia:[{sepia:[j]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[f]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[v]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[j]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Be]}],duration:[{duration:I()}],ease:[{ease:["linear","in","out","in-out",Be]}],delay:[{delay:I()}],animate:[{animate:["none","spin","ping","pulse","bounce",Be]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[k]}],"scale-x":[{"scale-x":[k]}],"scale-y":[{"scale-y":[k]}],rotate:[{rotate:[Ra,Be]}],"translate-x":[{"translate-x":[J]}],"translate-y":[{"translate-y":[J]}],"skew-x":[{"skew-x":[Z]}],"skew-y":[{"skew-y":[Z]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Be]}],accent:[{accent:["auto",t]}],appearance:["appearance-none"],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Be]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":[e]}],"scroll-mx":[{"scroll-mx":[e]}],"scroll-my":[{"scroll-my":[e]}],"scroll-mt":[{"scroll-mt":[e]}],"scroll-mr":[{"scroll-mr":[e]}],"scroll-mb":[{"scroll-mb":[e]}],"scroll-ml":[{"scroll-ml":[e]}],"scroll-p":[{"scroll-p":[e]}],"scroll-px":[{"scroll-px":[e]}],"scroll-py":[{"scroll-py":[e]}],"scroll-pt":[{"scroll-pt":[e]}],"scroll-pr":[{"scroll-pr":[e]}],"scroll-pb":[{"scroll-pb":[e]}],"scroll-pl":[{"scroll-pl":[e]}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","pinch-zoom","manipulation",{pan:["x","left","right","y","up","down"]}]}],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Be]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Or,rh]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],rounded:["rounded-t","rounded-r","rounded-b","rounded-l","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"]}}}var ux=W2(X2);function oe(...t){return ux(lv(t))}a();a();a();_();a();_();function nh(...t){return e=>{t.forEach(r=>{typeof r=="function"?r(e):r!=null&&(r.current=e)})}}var oh=(t,e)=>{let{setIcon:r}=re(Vo),n=M(null);return ee(i=>{n.current&&Pee.call(n.current),i&&(r(i,t),e&&i.firstElementChild instanceof SVGSVGElement&&i.firstElementChild.style.setProperty("--icon-size",typeof e=="number"||!Number.isNaN(Number(e))?`${e}px`:e)),n.current=i},[t,e,r])};function Pee(){for(;this.lastChild;)this.removeChild(this.lastChild)}var Zo=yt(Q(function({icon:e,size:r,className:n,...o},i){let s=oh(e,r),l=nh(s,i);return g("div",{ref:l,className:oe("zt-icon",n),...o})}));a();_();var os=Q(function({onClick:e,onKeyDown:r,className:n,...o},i){return g(Zo,{onClick:e,onKeyDown:r??e,className:oe("clickable-icon",n),...o,ref:i,role:"button",tabIndex:0})});a();_();a();_();var Q2=yt(Q(function({icon:e,...r},n){let o=oh(e);return g("button",{ref:nh(o,n),...r})}));var is=Q(function({className:e,active:r=!1,...n},o){return g(Q2,{...n,ref:o,className:oe("clickable-icon",{"is-active":r},e)})});function hu(t){return g(os,{size:16,icon:"info","aria-label":"Show details",...t})}a();a();a();a();function gu(){let t=arguments[0];for(let e=1,r=arguments.length;e<r;e++)t=arguments[e](t);return t}_();a();_();var eL=yt(function({content:e,className:r,...n}){let{sanitize:o,renderMarkdown:i}=re(Vo),s=ae(()=>o(e).replace(/<\/?b>/g,"**").replace(/<\/?i>/g,"*"),[e,o]);return g("div",{className:oe("annot-comment select-text overflow-x-auto break-words px-2 py-1",r),...n,children:i(s)})});a();_();var tL=Q(function({className:e,...r},n){return g("div",{ref:n,className:oe("annot-excerpt",e),...r})});a();_();a();function fx({text:t,pageLabel:e,className:r,collapsed:n=!1,...o}){let i=t??`Area Excerpt for Page ${e??"?"}`;return g("img",{className:oe("w-full",n?"max-h-20 object-cover object-left-top":"object-scale-down",r),alt:i,...o})}var rL=yt(function({type:e,text:r,pageLabel:n,imgSrc:o,collapsed:i}){switch(e){case Re.highlight:case Re.underline:case Re.text:return g("p",{className:"select-text",children:r});case Re.image:if(!o)throw new Error("imgSrc is required for image annotation");return g(fx,{collapsed:i,src:o,pageLabel:n,text:r});default:return g(L,{children:["Unsupported Type: ",Re[e]??e]})}});a();function px({checkbox:t,drag:e,buttons:r,onMoreOptions:n,className:o,children:i,onContextMenu:s,...l}){return g("div",{className:oe("annot-header flex cursor-context-menu items-center gap-1",o),onContextMenu:s??n,...l,children:[t,g("div",{className:"annot-header-drag-container flex flex-row items-center gap-1",children:e}),g("div",{className:"annot-header-buttons-container flex flex-row items-center gap-1 opacity-0 transition-opacity hover:opacity-100",children:r}),g("div",{className:"annot-header-space flex-1"}),i]})}a();a();a();a();a();a();a();var Fee=typeof global=="object"&&global&&global.Object===Object&&global,nL=Fee;var $ee=typeof self=="object"&&self&&self.Object===Object&&self,Mee=nL||$ee||Function("return this")(),oL=Mee;var Lee=oL.Symbol,Qn=Lee;a();var iL=Object.prototype,jee=iL.hasOwnProperty,qee=iL.toString,yu=Qn?Qn.toStringTag:void 0;function Bee(t){var e=jee.call(t,yu),r=t[yu];try{t[yu]=void 0;var n=!0}catch{}var o=qee.call(t);return n&&(e?t[yu]=r:delete t[yu]),o}var sL=Bee;a();var zee=Object.prototype,Uee=zee.toString;function Wee(t){return Uee.call(t)}var aL=Wee;var Hee="[object Null]",Kee="[object Undefined]",lL=Qn?Qn.toStringTag:void 0;function Vee(t){return t==null?t===void 0?Kee:Hee:lL&&lL in Object(t)?sL(t):aL(t)}var cL=Vee;a();function Gee(t){return t!=null&&typeof t=="object"}var uL=Gee;var Zee="[object Symbol]";function Jee(t){return typeof t=="symbol"||uL(t)&&cL(t)==Zee}var fL=Jee;a();a();function Yee(t,e){for(var r=-1,n=t==null?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}var pL=Yee;a();var Xee=Array.isArray,dL=Xee;var Qee=1/0,mL=Qn?Qn.prototype:void 0,hL=mL?mL.toString:void 0;function gL(t){if(typeof t=="string")return t;if(dL(t))return pL(t,gL)+"";if(fL(t))return hL?hL.call(t):"";var e=t+"";return e=="0"&&1/t==-Qee?"-0":e}var yL=gL;a();function ete(t){return t==null?"":yL(t)}var Da=ete;a();a();a();a();function tte(t,e,r){var n=-1,o=t.length;e<0&&(e=-e>o?0:o+e),r=r>o?o:r,r<0&&(r+=o),o=e>r?0:r-e>>>0,e>>>=0;for(var i=Array(o);++n<o;)i[n]=t[n+e];return i}var bL=tte;function rte(t,e,r){var n=t.length;return r=r===void 0?n:r,!e&&r>=n?t:bL(t,e,r)}var vL=rte;a();var nte="\\ud800-\\udfff",ote="\\u0300-\\u036f",ite="\\ufe20-\\ufe2f",ste="\\u20d0-\\u20ff",ate=ote+ite+ste,lte="\\ufe0e\\ufe0f",cte="\\u200d",ute=RegExp("["+cte+nte+ate+lte+"]");function fte(t){return ute.test(t)}var ih=fte;a();a();function pte(t){return t.split("")}var wL=pte;a();var xL="\\ud800-\\udfff",dte="\\u0300-\\u036f",mte="\\ufe20-\\ufe2f",hte="\\u20d0-\\u20ff",gte=dte+mte+hte,yte="\\ufe0e\\ufe0f",bte="["+xL+"]",dx="["+gte+"]",mx="\\ud83c[\\udffb-\\udfff]",vte="(?:"+dx+"|"+mx+")",EL="[^"+xL+"]",SL="(?:\\ud83c[\\udde6-\\uddff]){2}",IL="[\\ud800-\\udbff][\\udc00-\\udfff]",wte="\\u200d",_L=vte+"?",OL="["+yte+"]?",xte="(?:"+wte+"(?:"+[EL,SL,IL].join("|")+")"+OL+_L+")*",Ete=OL+_L+xte,Ste="(?:"+[EL+dx+"?",dx,SL,IL,bte].join("|")+")",Ite=RegExp(mx+"(?="+mx+")|"+Ste+Ete,"g");function _te(t){return t.match(Ite)||[]}var TL=_te;function Ote(t){return ih(t)?TL(t):wL(t)}var CL=Ote;function Tte(t){return function(e){e=Da(e);var r=ih(e)?CL(e):void 0,n=r?r[0]:e.charAt(0),o=r?vL(r,1).join(""):e.slice(1);return n[t]()+o}}var kL=Tte;var Cte=kL("toUpperCase"),AL=Cte;a();a();function kte(t,e,r,n){var o=-1,i=t==null?0:t.length;for(n&&i&&(r=t[++o]);++o<i;)r=e(r,t[o],o,t);return r}var RL=kte;a();a();a();function Ate(t){return function(e){return t?.[e]}}var NL=Ate;var Rte={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Nte=NL(Rte),DL=Nte;var Dte=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Pte="\\u0300-\\u036f",Fte="\\ufe20-\\ufe2f",$te="\\u20d0-\\u20ff",Mte=Pte+Fte+$te,Lte="["+Mte+"]",jte=RegExp(Lte,"g");function qte(t){return t=Da(t),t&&t.replace(Dte,DL).replace(jte,"")}var PL=qte;a();a();var Bte=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function zte(t){return t.match(Bte)||[]}var FL=zte;a();var Ute=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Wte(t){return Ute.test(t)}var $L=Wte;a();var BL="\\ud800-\\udfff",Hte="\\u0300-\\u036f",Kte="\\ufe20-\\ufe2f",Vte="\\u20d0-\\u20ff",Gte=Hte+Kte+Vte,zL="\\u2700-\\u27bf",UL="a-z\\xdf-\\xf6\\xf8-\\xff",Zte="\\xac\\xb1\\xd7\\xf7",Jte="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Yte="\\u2000-\\u206f",Xte=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",WL="A-Z\\xc0-\\xd6\\xd8-\\xde",Qte="\\ufe0e\\ufe0f",HL=Zte+Jte+Yte+Xte,KL="['\u2019]",ML="["+HL+"]",ere="["+Gte+"]",VL="\\d+",tre="["+zL+"]",GL="["+UL+"]",ZL="[^"+BL+HL+VL+zL+UL+WL+"]",rre="\\ud83c[\\udffb-\\udfff]",nre="(?:"+ere+"|"+rre+")",ore="[^"+BL+"]",JL="(?:\\ud83c[\\udde6-\\uddff]){2}",YL="[\\ud800-\\udbff][\\udc00-\\udfff]",Pa="["+WL+"]",ire="\\u200d",LL="(?:"+GL+"|"+ZL+")",sre="(?:"+Pa+"|"+ZL+")",jL="(?:"+KL+"(?:d|ll|m|re|s|t|ve))?",qL="(?:"+KL+"(?:D|LL|M|RE|S|T|VE))?",XL=nre+"?",QL="["+Qte+"]?",are="(?:"+ire+"(?:"+[ore,JL,YL].join("|")+")"+QL+XL+")*",lre="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",cre="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ure=QL+XL+are,fre="(?:"+[tre,JL,YL].join("|")+")"+ure,pre=RegExp([Pa+"?"+GL+"+"+jL+"(?="+[ML,Pa,"$"].join("|")+")",sre+"+"+qL+"(?="+[ML,Pa+LL,"$"].join("|")+")",Pa+"?"+LL+"+"+jL,Pa+"+"+qL,cre,lre,VL,fre].join("|"),"g");function dre(t){return t.match(pre)||[]}var ej=dre;function mre(t,e,r){return t=Da(t),e=r?void 0:e,e===void 0?$L(t)?ej(t):FL(t):t.match(e)||[]}var tj=mre;var hre="['\u2019]",gre=RegExp(hre,"g");function yre(t){return function(e){return RL(tj(PL(e).replace(gre,"")),t,"")}}var rj=yre;a();var bre=rj(function(t,e,r){return t+(r?" ":"")+AL(e)}),hx=bre;_();var nj=yt(function({icon:e,color:r,type:n,className:o,...i}){let s=hx(Re[n]);return g(Zo,{icon:e,style:{color:r??void 0},className:oe(o,"annot-type-icon","flex h-auto cursor-grab items-center justify-center opacity-[var(--icon-opacity)]"),"aria-label":s,"aria-label-delay":"500",...i})});a();var oj=t=>{switch(t){case Re.highlight:return"align-left";case Re.underline:return"underline";case Re.image:return"frame";case Re.text:return"text-select";case Re.note:case Re.ink:default:return"file-question"}};a();_();var ij=t=>{let{annotRenderer:e,store:r}=re(Ze),n=Ut(r,e.storeSelector,ka);return e.get(t,n)};a();_();var sj=t=>{let{getImgSrc:e}=re(Ze);return ae(()=>e(t),[t,e])};a();function gx({className:t,...e}){return g(os,{icon:"more-vertical",className:oe("annot-header-more-options",t),"aria-label":"More options",size:"0.9rem","aria-label-delay":"50",...e})}a();_();var aj=yt(function({pageLabel:e,backlink:r,className:n,...o}){let i=e?`Page ${e}`:"";return r?g("a",{className:oe("annot-page","external-link","bg-[length:12px] bg-[center_right_3px] pr-[18px] text-xs",n),href:r,"aria-label":`Open annotation in Zotero at page ${e}`,"aria-label-delay":"500",...o,children:i}):g("span",{className:oe("annot-page",n),children:i})});a();_();function yx({tags:t}){return t.length===0?null:g("div",{className:"annot-tags-container",children:t.map(e=>g(vre,{...e},e.tagID))})}var vre=yt(function({name:e}){return g("a",{className:oe("tag","annot-tag"),children:e})});function bx({collapsed:t=!1,annotation:e,checkbox:r,tags:n,className:o,...i}){let s=M(null),{onMoreOptions:l,onDragStart:c,onShowDetails:f}=re(Ze),u=A0.selectKeys(e,["type","text","pageLabel"]),d=ij(e),m=Hr(y=>l(y,e)),h=Hr(()=>f("annot",e.itemID));return g("div",{className:oe("annot-preview","bg-primary shadow-border col-span-1 flex flex-col divide-y overflow-auto rounded-sm transition-colors",o),"data-id":e.itemID,...i,children:[g(px,{className:"bg-primary-alt py-1 pl-2 pr-1",checkbox:r,drag:g(nj,{type:e.type,color:e.color,icon:oj(e.type),draggable:d!==null,onDragStart:Hr(y=>d&&c(y,d,s.current)),size:16}),buttons:g(L,{children:[g(hu,{className:"p-0.5",size:14,onClick:h}),g(gx,{className:"p-0",onClick:m})]}),onMoreOptions:m,children:g(aj,{pageLabel:e.pageLabel,backlink:Bo(e)})}),g(tL,{ref:s,className:"px-2 py-1",children:g("blockquote",{className:oe("border-l-blockquote pl-2 leading-tight",{"line-clamp-3":t}),style:{borderColor:e.color??"var(--interactive-accent)"},children:g(rL,{...u,collapsed:t,imgSrc:sj(e)})})}),e.comment&&g(eL,{content:e.comment}),n&&g(yx,{tags:n})]})}function vx({selectable:t=!1,collapsed:e,annotations:r,getTags:n}){let[o,{add:i,remove:s}]=ix();return g("div",{role:"list",className:"@md:grid-cols-2 @md:gap-3 @3xl:grid-cols-4 grid grid-cols-1 gap-2",children:r.map(l=>g(bx,{checkbox:t&&g(wre,{checked:o.has(l.itemID),onChange:c=>c?i(l.itemID):s(l.itemID)}),collapsed:e,role:"listitem",annotation:l,tags:n(l.itemID)},l.itemID))})}function wre({checked:t,onChange:e}){return g("div",{className:"flex h-5 items-center",children:g("input",{type:"checkbox",className:"m-0 h-4 w-4",checked:t,onChange:r=>e(r.target.checked)})})}a();_();var xre=()=>Ut(re(Ze).store,t=>({attachments:t.allAttachments,onChange:t.setActiveAtch,value:t.attachmentID}),ka);function wx(){let{attachments:t,onChange:e,value:r}=xre();return t?t.length===1?null:t.length<=0?g("span",{className:"atch-select-empty",children:"No attachments available"}):g("select",{className:"atch-select",onChange:n=>e(parseInt(n.target.value,10)),value:r??void 0,children:t.map(({itemID:n,path:o,annotCount:i})=>g("option",{value:n,children:["(",i,") ",o?.replace(/^storage:/,"")]},n))}):g(L,{children:"Loading"})}a();function xx({isCollapsed:t,...e}){return g(is,{...e,icon:t?"chevrons-up-down":"chevrons-down-up","aria-label":t?"Expand":"Collapse"})}a();_();function sh(t){let{store:e,onSetFollow:r}=re(Ze),n=Ut(e,s=>s.follow),o=n===null?"not following":n==="ob-note"?"active literature note":"active literature in Zotero reader";return g(L,{children:[g(is,{...t,onClick:r,icon:n===null?"unlink":"link","aria-label":"Choose follow mode"+(n===null?" (Currently linked with literature)":""),"aria-label-delay":"50"}),n!==null&&g("span",{className:"ml-1","aria-label":`Following ${o}`,children:n==="ob-note"?"ob":"zt"})]})}a();function ah({children:t,buttons:e}){return g("div",{className:"nav-header",children:[g("div",{className:"nav-buttons-container",children:e}),t]})}a();function Ex(t){return g(is,{...t,icon:"refresh-ccw","aria-label":"Refresh annotation list","aria-label-delay":"50"})}var Ere=()=>{let{registerDbUpdate:t,store:e}=re(Ze),r=Ut(e,n=>n.refresh);K(()=>t(r),[t,r])};function bu(){Ere();let{store:t}=re(Ze),e=Ut(t,r=>r.doc);return e?g(Sre,{docItem:e.docItem}):g(L,{children:[g(ah,{buttons:g(sh,{})}),g("div",{className:"pane-empty p-2",children:"Active file not literature note"})]})}function Sre({docItem:t}){let{refreshConn:e,onShowDetails:r}=re(Ze),[n,{toggle:o}]=eh(!1),i=Ire();return g(L,{children:[g(ah,{buttons:g(L,{children:[g(hu,{className:"nav-action-button",onClick:Hr(()=>r("doc-item",t.itemID))}),g(xx,{className:"nav-action-button",isCollapsed:n,onClick:o}),g(Ex,{className:"nav-action-button",onClick:e}),g(sh,{})]}),children:g(wx,{})}),g("div",{className:oe("annots-container @container","overflow-auto px-3 pt-1 pb-8 text-xs"),children:i?g(vx,{collapsed:n,...i}):g(L,{children:"Loading"})})]})}var Ire=()=>Ut(re(Ze).store,t=>!t.doc||!t.annotations||!t.attachment?null:{annotations:t.annotations,getTags:e=>t.tags[e]??[]},ka);a();_();a();a();a();a();function me(){return me=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},me.apply(this,arguments)}a();function Sx(t,e){if(t==null)return{};var r={},n=Object.keys(t),o,i;for(i=0;i<n.length;i++)o=n[i],!(e.indexOf(o)>=0)&&(r[o]=t[o]);return r}a();a();function lh(t,e=166){let r;function n(...o){let i=()=>{t.apply(this,o)};clearTimeout(r),r=setTimeout(i,e)}return n.clear=()=>{clearTimeout(r)},n}a();function Ix(t){return t&&t.ownerDocument||document}a();function vu(t){return Ix(t).defaultView||window}a();function _x(t,e){typeof t=="function"?t(e):t&&(t.current=e)}a();_();var _re=typeof window<"u"?Lt:K,Ox=_re;a();_();function ch(...t){return ae(()=>t.every(e=>e==null)?null:e=>{t.forEach(r=>{_x(r,e)})},t)}a();a();_();_();var Ore=["onChange","maxRows","minRows","style","value"];function uh(t){return parseInt(t,10)||0}var Tre={shadow:{visibility:"hidden",position:"absolute",overflow:"hidden",height:0,top:0,left:0,transform:"translateZ(0)"}};function lj(t){return t==null||Object.keys(t).length===0||t.outerHeightStyle===0&&!t.overflow}var Cre=Q(function(e,r){let{onChange:n,maxRows:o,minRows:i=1,style:s,value:l}=e,c=Sx(e,Ore),{current:f}=M(l!=null),u=M(null),d=ch(r,u),m=M(null),h=M(0),[y,w]=q({outerHeightStyle:0}),v=ee(()=>{let Z=u.current,J=vu(Z).getComputedStyle(Z);if(J.width==="0px")return{outerHeightStyle:0};let G=m.current;G.style.width=J.width,G.value=Z.value||e.placeholder||"x",G.value.slice(-1)===`
|
|
`&&(G.value+=" ");let $=J.boxSizing,te=uh(J.paddingBottom)+uh(J.paddingTop),C=uh(J.borderBottomWidth)+uh(J.borderTopWidth),T=G.scrollHeight;G.value="x";let O=G.scrollHeight,U=T;i&&(U=Math.max(Number(i)*O,U)),o&&(U=Math.min(Number(o)*O,U)),U=Math.max(U,O);let F=U+($==="border-box"?te+C:0),se=Math.abs(U-T)<=1;return{outerHeightStyle:F,overflow:se}},[o,i,e.placeholder]),x=(Z,X)=>{let{outerHeightStyle:J,overflow:G}=X;return h.current<20&&(J>0&&Math.abs((Z.outerHeightStyle||0)-J)>1||Z.overflow!==G)?(h.current+=1,{overflow:G,outerHeightStyle:J}):Z},S=ee(()=>{let Z=v();lj(Z)||w(X=>x(X,Z))},[v]),k=()=>{let Z=v();lj(Z)||cn(()=>{w(X=>x(X,Z))})};return K(()=>{let Z=lh(()=>{h.current=0,u.current&&k()}),X,J=u.current,G=vu(J);return G.addEventListener("resize",Z),typeof ResizeObserver<"u"&&(X=new ResizeObserver(Z),X.observe(J)),()=>{Z.clear(),G.removeEventListener("resize",Z),X&&X.disconnect()}}),Ox(()=>{S()}),K(()=>{h.current=0},[l]),g(L,{children:[g("textarea",me({value:l,onChange:Z=>{h.current=0,f||S(),n&&n(Z)},ref:d,rows:i,style:me({height:y.outerHeightStyle,overflow:y.overflow?"hidden":void 0},s)},c)),g("textarea",{"aria-hidden":!0,className:e.className,readOnly:!0,ref:m,tabIndex:-1,style:me({},Tre.shadow,s,{padding:0})})]})}),wu=Cre;_();a();_();a();a();_();a();_();function kre(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function Tx(...t){return e=>t.forEach(r=>kre(r,e))}function fh(...t){return ee(Tx(...t),t)}a();_();function cj(t,e=[]){let r=[];function n(i,s){let l=Ke(s),c=r.length;r=[...r,s];function f(d){let{scope:m,children:h,...y}=d,w=m?.[t][c]||l,v=ae(()=>y,Object.values(y));return V(w.Provider,{value:v},h)}function u(d,m){let h=m?.[t][c]||l,y=re(h);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return f.displayName=i+"Provider",[f,u]}let o=()=>{let i=r.map(s=>Ke(s));return function(l){let c=l?.[t]||i;return ae(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return o.scopeName=t,[n,Are(o,...e)]}function Are(...t){let e=t[0];if(t.length===1)return e;let r=()=>{let n=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){let s=n.reduce((l,{useScope:c,scopeName:f})=>{let d=c(i)[`__scope${f}`];return{...l,...d}},{});return ae(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return r.scopeName=e.scopeName,r}a();function Wt(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}a();_();a();_();function Cx(t){let e=M(t);return K(()=>{e.current=t}),ae(()=>(...r)=>{var n;return(n=e.current)===null||n===void 0?void 0:n.call(e,...r)},[])}function uj({prop:t,defaultProp:e,onChange:r=()=>{}}){let[n,o]=Rre({defaultProp:e,onChange:r}),i=t!==void 0,s=i?t:n,l=Cx(r),c=ee(f=>{if(i){let d=typeof f=="function"?f(t):f;d!==t&&l(d)}else o(f)},[i,t,o,l]);return[s,c]}function Rre({defaultProp:t,onChange:e}){let r=q(t),[n]=r,o=M(n),i=Cx(e);return K(()=>{o.current!==n&&(i(n),o.current=n)},[n,o,i]),r}a();_();function fj(t){let e=M({value:t,previous:t});return ae(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}a();_();a();_();var xu=globalThis?.document?Lt:()=>{};function pj(t){let[e,r]=q(void 0);return xu(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});let n=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;let i=o[0],s,l;if("borderBoxSize"in i){let c=i.borderBoxSize,f=Array.isArray(c)?c[0]:c;s=f.inlineSize,l=f.blockSize}else s=t.offsetWidth,l=t.offsetHeight;r({width:s,height:l})});return n.observe(t,{box:"border-box"}),()=>n.unobserve(t)}else r(void 0)},[t]),e}a();_();_();function Nre(t,e){return ln((r,n)=>{let o=e[r][n];return o??r},t)}var kx=t=>{let{present:e,children:r}=t,n=Dre(e),o=typeof r=="function"?r({present:n.isPresent}):tt.only(r),i=fh(n.ref,o.ref);return typeof r=="function"||n.isPresent?br(o,{ref:i}):null};kx.displayName="Presence";function Dre(t){let[e,r]=q(),n=M({}),o=M(t),i=M("none"),s=t?"mounted":"unmounted",[l,c]=Nre(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return K(()=>{let f=ph(n.current);i.current=l==="mounted"?f:"none"},[l]),xu(()=>{let f=n.current,u=o.current;if(u!==t){let m=i.current,h=ph(f);t?c("MOUNT"):h==="none"||f?.display==="none"?c("UNMOUNT"):c(u&&m!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,c]),xu(()=>{if(e){let f=d=>{let h=ph(n.current).includes(d.animationName);d.target===e&&h&&cn(()=>c("ANIMATION_END"))},u=d=>{d.target===e&&(i.current=ph(n.current))};return e.addEventListener("animationstart",u),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{e.removeEventListener("animationstart",u),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:ee(f=>{f&&(n.current=getComputedStyle(f)),r(f)},[])}}function ph(t){return t?.animationName||"none"}a();_();_();a();_();var Rx=Q((t,e)=>{let{children:r,...n}=t,o=tt.toArray(r),i=o.find(Fre);if(i){let s=i.props.children,l=o.map(c=>c===i?tt.count(s)>1?tt.only(null):Yt(s)?s.props.children:null:c);return V(Ax,me({},n,{ref:e}),Yt(s)?br(s,void 0,l):null)}return V(Ax,me({},n,{ref:e}),r)});Rx.displayName="Slot";var Ax=Q((t,e)=>{let{children:r,...n}=t;return Yt(r)?br(r,{...$re(n,r.props),ref:Tx(e,r.ref)}):tt.count(r)>1?tt.only(null):null});Ax.displayName="SlotClone";var Pre=({children:t})=>V(L,null,t);function Fre(t){return Yt(t)&&t.type===Pre}function $re(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...l)=>{i(...l),o(...l)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}var Mre=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Nx=Mre.reduce((t,e)=>{let r=Q((n,o)=>{let{asChild:i,...s}=n,l=i?Rx:e;return K(()=>{window[Symbol.for("radix-ui")]=!0},[]),V(l,me({},s,{ref:o}))});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var dj="Checkbox",[Lre,N4e]=cj(dj),[jre,qre]=Lre(dj),Bre=Q((t,e)=>{let{__scopeCheckbox:r,name:n,checked:o,defaultChecked:i,required:s,disabled:l,value:c="on",onCheckedChange:f,...u}=t,[d,m]=q(null),h=fh(e,k=>m(k)),y=M(!1),w=d?!!d.closest("form"):!0,[v=!1,x]=uj({prop:o,defaultProp:i,onChange:f}),S=M(v);return K(()=>{let k=d?.form;if(k){let j=()=>x(S.current);return k.addEventListener("reset",j),()=>k.removeEventListener("reset",j)}},[d,x]),V(jre,{scope:r,state:v,disabled:l},V(Nx.button,me({type:"button",role:"checkbox","aria-checked":ss(v)?"mixed":v,"aria-required":s,"data-state":mj(v),"data-disabled":l?"":void 0,disabled:l,value:c},u,{ref:h,onKeyDown:Wt(t.onKeyDown,k=>{k.key==="Enter"&&k.preventDefault()}),onClick:Wt(t.onClick,k=>{x(j=>ss(j)?!0:!j),w&&(y.current=k.isPropagationStopped(),y.current||k.stopPropagation())})})),w&&V(Wre,{control:d,bubbles:!y.current,name:n,value:c,checked:v,required:s,disabled:l,style:{transform:"translateX(-100%)"}}))}),zre="CheckboxIndicator",Ure=Q((t,e)=>{let{__scopeCheckbox:r,forceMount:n,...o}=t,i=qre(zre,r);return V(kx,{present:n||ss(i.state)||i.state===!0},V(Nx.span,me({"data-state":mj(i.state),"data-disabled":i.disabled?"":void 0},o,{ref:e,style:{pointerEvents:"none",...t.style}})))}),Wre=t=>{let{control:e,checked:r,bubbles:n=!0,...o}=t,i=M(null),s=fj(r),l=pj(e);return K(()=>{let c=i.current,f=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(f,"checked").set;if(s!==r&&d){let m=new Event("click",{bubbles:n});c.indeterminate=ss(r),d.call(c,ss(r)?!1:r),c.dispatchEvent(m)}},[s,r,n]),V("input",me({type:"checkbox","aria-hidden":!0,defaultChecked:ss(r)?!1:r},o,{tabIndex:-1,ref:i,style:{...t.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function ss(t){return t==="indeterminate"}function mj(t){return ss(t)?"indeterminate":t?"checked":"unchecked"}var Dx=Bre,hj=Ure;_();var Px=Q(({className:t,checked:e,...r},n)=>g(Dx,{ref:n,className:oe("data-[state=checked]:text-mod-error peer h-3 w-3 shrink-0 rounded-sm border disabled:cursor-not-allowed disabled:opacity-50 bg-primary obzt-btn-reset",t),checked:e,...r,children:g(hj,{className:oe("flex items-center justify-center"),children:g(Zo,{icon:"chevrons-down",size:"0.75rem",className:"contents"})})}));Px.displayName=Dx.displayName;var gj=Q(({id:t,checked:e,onCheckChange:r,title:n,disabled:o,className:i,...s},l)=>g("div",{className:oe("flex items-center gap-x-1","rounded-sm focus-within:outline-none focus-within:ring-2 focus-within:ring-mod-border-focus focus-within:ring-offset-2",e&&"animate-pulse",i),ref:l,...s,children:[g(Px,{className:oe("h-3 w-3",o&&"hidden"),id:t,checked:e,disabled:o,onCheckedChange:r}),g("label",{htmlFor:t,className:"peer-[[data-state=checked]]:text-mod-error text-status-bar text-txt-status-bar leading-none peer-disabled:cursor-not-allowed",children:n})]}));gj.displayName="ImportingStatus";var vg=require("obsidian");_();a();var Fa=require("obsidian");_();var yj={sanitize:DOMPurify.sanitize.bind(DOMPurify),setIcon:Fa.setIcon,renderMarkdown(t){return g(Kre,{content:t})}};function Kre({content:t}){let e=M(null);return g("div",{className:"contents",ref:n=>{n?(n.empty(),e.current&&e.current.unload(),e.current=new Fa.Component,Fa.MarkdownRenderer.renderMarkdown(t,n,"",e.current)):e.current&&(e.current.unload(),e.current=null)}})}a();var as=require("obsidian"),dh=class extends as.FileView{constructor(e){super(e),this.navigation=!1,this.allowNoFile=!0,this.requestUpdate=(0,as.debounce)(()=>this.update(),10)}load(){super.load(),this.registerEvent(this.app.workspace.on("file-open",this.onFileOpen,this))}async setState(e,r){if(!Object.hasOwn(e,"file")&&!Object.hasOwn(e,"group")){let n=this.leaf.workspace.getActiveFile();n&&(e.file=n?.path)}await super.setState(e,r)}onLoadFile(e){return this.requestUpdate()}onUnloadFile(e){return this.requestUpdate()}onFileOpen(e){this.leaf.group||this.leaf.pinned||(e instanceof as.TFile?this.loadFile(e):this.loadFile(null),this.requestUpdate())}onGroupChange(){if(super.onGroupChange(),this.leaf.group)for(let e=0,r=this.leaf.workspace.getGroupLeaves(this.leaf.group);e<r.length;e++){let n=r[e];if(n!==this.leaf&&n.view instanceof as.FileView){let o=n.view.getSyncViewState();this.leaf.openFile(n.view.file,o)}}else{let e=this.leaf.workspace.getActiveFile();this.loadFile(e)}}};a();a();a();a();var bj=require("obsidian");a();var mh=require("obsidian"),hh="zt-citations",gh=async(t,e)=>typeof t=="string"&&t.trim().length>0?await e.database.search(t):await e.database.getItemsOf(50);function yh({item:t,fields:e},r){r.addClass("mod-complex");let n=r.createDiv("suggestion-content").createDiv("suggestion-title").createSpan(),o=r.createDiv("suggestion-aux");for(let l of e){let c=o.createEl("kbd","suggestion-hotkey");switch(c.setAttribute("aria-label",l),l){case"title":(0,mh.setIcon)(c,"type");break;case"creators":(0,mh.setIcon)(c,"user");break;case"date":(0,mh.setIcon)(c,"calendar");break;default:c.setText(l);break}}let[i]=t.title??[],s=n.createDiv({cls:"title"});typeof i=="string"&&i?s.setText(i):s.setText("Title missing"),this.plugin.settings.current?.showCitekeyInSuggester&&t.citekey&&n.createDiv({cls:"citekey",text:t.citekey}),Vre(t)&&n.append(Gre(t))}var Vre=t=>t.itemType==="journalArticle",Gre=t=>{let{creators:e,date:r,publicationTitle:n,volume:o,issue:i,pages:s}=t,l={creators:Zre(e),date:r,publication:n,volume:o,issue:i,pages:s},c=(f,u,d)=>l[u]&&f.createSpan({cls:d??u,text:l[u]??void 0});return createDiv({cls:"meta"},f=>{(l.creators||l.date)&&f.createSpan({cls:"author-year"},u=>{c(u,"creators"),c(u,"date")}),c(f,"publication"),(l.volume||l.issue)&&f.createSpan({cls:"vol-issue"},u=>{c(u,"volume"),c(u,"issue")}),c(f,"pages")})},Zre=t=>{if(!t||!t[0])return"";let e=t[0],r=nm(e)||om(e)?e.lastName:"";return t.length>1&&(r=r.trim()+" et al."),r};var Eu=class extends bj.EditorSuggest{constructor(r){super(r.app);this.plugin=r;this.suggestEl.addClass(hh)}getSuggestions(r){return gh(r.query,this.plugin)}renderSuggestion=yh.bind(this)};a();var eo=class extends im{constructor(r){super(r.app);this.plugin=r;this.modalEl.addClass(hh)}getSuggestions(r){return gh(r,this.plugin)}renderSuggestion=yh.bind(this);onChooseSuggestion(){}};a();var bh=require("obsidian");a();var vj=require("@codemirror/state");async function wj(t,e,r=e.settings.current?.updateOverwrite){let{app:n,noteIndex:o,templateRenderer:i}=e,s=o.getNotesFor(t);if(s.length===0)return null;let l=e.settings.libId,c=await e.databaseAPI.getAttachments(t.itemID,l),f=new Set(s.flatMap(v=>rs(v,e.app.metadataCache))),u=c.filter(v=>f.has(v.itemID)),d;u.length===0&&(d=await Vn(c,e.app),d&&(va(d,t),u.push(d)));let m=await e.databaseAPI.getNotes(t.itemID,l).then(v=>e.noteParser.normalizeNotes(v)),h=await Su(t,{all:c,selected:u,notes:m},e),y=Object.values(h)[0],w={notes:s.length,addedAnnots:0,updatedAnnots:0};for(let v of s){let x=n.metadataCache.getCache(v);if(!x)continue;let S=rs(v,e.app.metadataCache);S||(d===void 0&&(d=await Vn(u,e.app)),d?S=[d.itemID]:S=[]);let k=n.vault.getAbstractFileByPath(v),j={plugin:e,sourcePath:v};if(r){let T=await i.renderNote(h[S[0]],j);await n.vault.modify(k,T);continue}let Z=gu((x.sections?.filter(fu)??[]).flatMap(T=>pu(T.id).map(O=>[O,T.position])),Wi(([T])=>T),ba((T,O)=>({key:T,blocks:O.map(([U,F])=>F)}))),X=new Set(Object.values(x.blocks??{})?.filter(fu).flatMap(T=>pu(T.id).map(O=>O))),J=new Map(S.map(T=>[h[T],[]])),G=[];if(await Promise.all(S.map(async T=>{let O=h[T];if(!(!O.annotations||O.annotations.length===0))return await Promise.all(O.annotations.map(async U=>{let F=ar(U,!0),se=Z[F];if(se){if(!e.settings.current?.updateAnnotBlock)return;let le=await i.renderAnnot(U,O,j);G.push(...se.blocks.map(we=>({from:we.start.offset,to:we.end.offset,insert:le})))}else X.has(F)||J.get(O).push(U)})??[])})),G.length>0){let T=vj.EditorState.create({doc:await n.vault.read(k)}).update({changes:G}).state.doc.toString();await n.vault.modify(k,T)}await i.setFrontmatterTo(k,zt(y,j).docItem);let $=[...J].reduce((T,[O,U])=>{if(U.length===0)return T;let F=i.renderAnnots({...O,annotations:U},j);return(T&&T+`
|
|
`)+F},"");$&&await n.vault.append(k,$);let te=G.length,C=[...J.values()].reduce((T,O)=>T+O.length,0);w.updatedAnnots+=te,w.addedAnnots+=C}return w}async function Su(t,{all:e,selected:r,notes:n},o){let i=o.settings.libId,s=await o.databaseAPI.getTags([[t.itemID,i]]);if(r.length===0)return{[-1]:{docItem:t,attachment:null,tags:s,allAttachments:e,annotations:[],notes:n}};let l={};for(let c of r){let f=c?await o.databaseAPI.getAnnotations(c.itemID,i):[];l[c.itemID]={docItem:t,attachment:c,tags:{...s,...await o.databaseAPI.getTags(f.map(u=>[u.itemID,i]))},allAttachments:e,annotations:f,notes:n}}return l}async function vh({alt:t,item:e},{start:r,end:n,editor:o,file:i},s){let{plugin:l}=s,c=l.settings.libId,f=e;if(!f.citekey){let[x]=await l.databaseAPI.getItems([[e.itemID,c]],!0);x&&(f=x)}if(!f.citekey){new bh.Notice("Selected item has no citekey/citationKey in Zotero.");return}let u=await l.databaseAPI.getAttachments(f.itemID,c),d=new Set(rs(i,l.app.metadataCache)),m=u.filter(x=>d.has(x.itemID)),h;m.length===0&&(h=await Vn(u,l.app),h&&(va(h,e),m.push(h)));let y=await l.databaseAPI.getNotes(f.itemID,c).then(x=>l.noteParser.normalizeNotes(x)),w=await Su(f,{all:u,selected:m,notes:y},s.plugin),v=s.renderCitations(Object.values(w),{plugin:s.plugin},t);o.replaceRange(v,r,n),o.setCursor(o.offsetToPos(o.posToOffset(r)+v.length))}var xj=t=>bh.Keymap.isModifier(t,"Shift");var Jre=[{command:"\u2191\u2193",purpose:"to navigate"},{command:"\u21B5",purpose:"to insert primary Markdown citation"},{command:"\u21B5 (end with /)",purpose:"Insert secondary Markdown citation"}],Iu=class extends Eu{constructor(r){super(r);this.plugin=r;this.setInstructions(Jre)}onTrigger(r,n){if(!this.plugin.settings.current?.citationEditorSuggester)return null;let o=n.getLine(r.line),s=o.substring(0,r.ch).match(/[[【]@([^\]】]*)$/);if(!s)return null;let l={...r};return(o[r.ch]==="]"||o[r.ch]==="\u3011")&&(l.ch+=1),{end:l,start:{ch:s.index,line:r.line,alt:!!s[0]?.endsWith("/")},query:s[1].replaceAll(/\/$/g,"")}}selectSuggestion(r){this.context&&vh({item:r.item,alt:this.context.start.alt??!1},this.context,this.plugin.templateRenderer)}};a();var Yre=[{command:"\u2191\u2193",purpose:"to navigate"},{command:"\u21B5",purpose:"to insert Markdown citation"},{command:"shift \u21B5",purpose:"to insert secondary Markdown citation"},{command:"esc",purpose:"to dismiss"}],Fx=class extends eo{constructor(r){super(r);this.plugin=r;this.setInstructions(Yre)}};async function $x(t,e,r){let n=await wh(r);if(!n)return!1;let o=t.getCursor();return await vh({item:n.value.item,alt:xj(n.evt)},{start:o,end:o,editor:t,file:e},r.templateRenderer),!0}async function wh(t){return await Ki(new Fx(t))}a();var ps=require("obsidian");a();_();_();a();_();a();_();a();var Yo=Y(Jo());_();a();function Lx(t){let e=Object.prototype.toString.call(t).slice(8,-1);return e==="Object"&&typeof t[Symbol.iterator]=="function"?"Iterable":e==="Custom"&&t.constructor!==Object&&t instanceof Object?"Object":e}a();var _j=Y(Jo());_();a();var Ou=Y(Jo());_();a();var Ej=Y(Jo());_();function _u(t){let{styling:e,arrowStyle:r="single",expanded:n,nodeType:o,onClick:i}=t;return P.createElement("div",(0,Ej.default)({},e("arrowContainer",r),{onClick:i}),P.createElement("div",e(["arrow","arrowSign"],o,n,r),"\u25B6",r==="double"&&P.createElement("div",e(["arrowSign","arrowSignInner"]),"\u25B6")))}a();function Xre(t,e){return t==="Object"?Object.keys(e).length:t==="Array"?e.length:1/0}function Qre(t){return typeof t.set=="function"}function ene(t,e,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:1/0,i;if(t==="Object"){let s=Object.getOwnPropertyNames(e);r&&s.sort(r===!0?void 0:r),s=s.slice(n,o+1),i={entries:s.map(l=>({key:l,value:e[l]}))}}else if(t==="Array")i={entries:e.slice(n,o+1).map((s,l)=>({key:l+n,value:s}))};else{let s=0,l=[],c=!0,f=Qre(e);for(let u of e){if(s>o){c=!1;break}n<=s&&(f&&Array.isArray(u)?typeof u[0]=="string"||typeof u[0]=="number"?l.push({key:u[0],value:u[1]}):l.push({key:`[entry ${s}]`,value:{"[key]":u[0],"[value]":u[1]}}):l.push({key:s,value:u})),s++}i={hasMore:!c,entries:l}}return i}function jx(t,e,r){let n=[];for(;e-t>r*r;)r=r*r;for(let o=t;o<=e;o+=r)n.push({from:o,to:Math.min(e,o+r-1)});return n}function qx(t,e,r,n){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:1/0,s=ene.bind(null,t,e,r);if(!n)return s().entries;let l=i<1/0,c=Math.min(i-o,Xre(t,e));if(t!=="Iterable"){if(c<=n||n<7)return s(o,i).entries}else if(c<=n&&!l)return s(o,i).entries;let f;if(t==="Iterable"){let{hasMore:u,entries:d}=s(o,o+n-1);f=u?[...d,...jx(o+n,o+2*n-1,n)]:d}else f=l?jx(o,i,n):[...s(0,n-5).entries,...jx(n-4,c-5,n),...s(c-4,c-1).entries];return f}a();var Sj=Y(Jo());_();function Bx(t){let{styling:e,from:r,to:n,renderChildNodes:o,nodeType:i}=t,[s,l]=q(!1),c=ee(()=>{l(!s)},[s]);return s?P.createElement("div",e("itemRange",s),o(t,r,n)):P.createElement("div",(0,Sj.default)({},e("itemRange",s),{onClick:c}),P.createElement(_u,{nodeType:i,styling:e,expanded:!1,onClick:c,arrowStyle:"double"}),`${r} ... ${n}`)}function tne(t){return t.to!==void 0}function Ij(t,e,r){let{nodeType:n,data:o,collectionLimit:i,circularCache:s,keyPath:l,postprocessValue:c,sortObjectKeys:f}=t,u=[];return qx(n,o,f,i,e,r).forEach(d=>{if(tne(d))u.push(P.createElement(Bx,(0,Ou.default)({},t,{key:`ItemRange--${d.from}-${d.to}`,from:d.from,to:d.to,renderChildNodes:Ij})));else{let{key:m,value:h}=d,y=s.indexOf(h)!==-1;u.push(P.createElement(Tu,(0,Ou.default)({},t,{postprocessValue:c,collectionLimit:i,key:`Node--${m}`,keyPath:[m,...l],value:c(h),circularCache:[...s,h],isCircular:y,hideRoot:!1})))}}),u}function ls(t){let{circularCache:e=[],collectionLimit:r,createItemString:n,data:o,expandable:i,getItemString:s,hideRoot:l,isCircular:c,keyPath:f,labelRenderer:u,level:d=0,nodeType:m,nodeTypeIndicator:h,shouldExpandNodeInitially:y,styling:w}=t,[v,x]=q(c?!1:y(f,o,d)),S=ee(()=>{i&&x(!v)},[i,v]),k=v||l&&d===0?Ij({...t,circularCache:e,level:d+1}):null,j=P.createElement("span",w("nestedNodeItemType",v),h),Z=s(m,o,j,n(o,r),f),X=[f,m,v,i];return l?P.createElement("li",w("rootNode",...X),P.createElement("ul",w("rootNodeChildren",...X),k)):P.createElement("li",w("nestedNode",...X),i&&P.createElement(_u,{styling:w,nodeType:m,expanded:v,onClick:S}),P.createElement("label",(0,Ou.default)({},w(["label","nestedNodeLabel"],...X),{onClick:S}),u(...X)),P.createElement("span",(0,Ou.default)({},w("nestedNodeItemString",...X),{onClick:S}),Z),P.createElement("ul",w("nestedNodeChildren",...X),k))}function rne(t){let e=Object.getOwnPropertyNames(t).length;return`${e} ${e!==1?"keys":"key"}`}function zx(t){let{data:e,...r}=t;return P.createElement(ls,(0,_j.default)({},r,{data:e,nodeType:"Object",nodeTypeIndicator:r.nodeType==="Error"?"Error()":"{}",createItemString:rne,expandable:Object.getOwnPropertyNames(e).length>0}))}a();var Oj=Y(Jo());_();function nne(t){return`${t.length} ${t.length!==1?"items":"item"}`}function Ux(t){let{data:e,...r}=t;return P.createElement(ls,(0,Oj.default)({},r,{data:e,nodeType:"Array",nodeTypeIndicator:"[]",createItemString:nne,expandable:e.length>0}))}a();var Tj=Y(Jo());_();function one(t,e){let r=0,n=!1;if(Number.isSafeInteger(t.size))r=t.size;else for(let o of t){if(e&&r+1>e){n=!0;break}r+=1}return`${n?">":""}${r} ${r!==1?"entries":"entry"}`}function Wx(t){return P.createElement(ls,(0,Tj.default)({},t,{nodeType:"Iterable",nodeTypeIndicator:"()",createItemString:one,expandable:!0}))}a();_();function Kr(t){let{nodeType:e,styling:r,labelRenderer:n,keyPath:o,valueRenderer:i,value:s,valueGetter:l=c=>c}=t;return P.createElement("li",r("value",e,o),P.createElement("label",r(["label","valueLabel"],e,o),n(o,e,!1,!1)),P.createElement("span",r("valueText",e,o),i(l(s),s,...o)))}function Tu(t){let{getItemString:e,keyPath:r,labelRenderer:n,styling:o,value:i,valueRenderer:s,isCustomNode:l,...c}=t,f=l(i)?"Custom":Lx(i),u={getItemString:e,key:r[0],keyPath:r,labelRenderer:n,nodeType:f,styling:o,value:i,valueRenderer:s},d={...c,...u,data:i,isCustomNode:l};switch(f){case"Object":case"Error":case"WeakMap":case"WeakSet":return P.createElement(zx,d);case"Array":return P.createElement(Ux,d);case"Iterable":case"Map":case"Set":return P.createElement(Wx,d);case"String":return P.createElement(Kr,(0,Yo.default)({},u,{valueGetter:m=>`"${m}"`}));case"Number":return P.createElement(Kr,u);case"Boolean":return P.createElement(Kr,(0,Yo.default)({},u,{valueGetter:m=>m?"true":"false"}));case"Date":return P.createElement(Kr,(0,Yo.default)({},u,{valueGetter:m=>m.toISOString()}));case"Null":return P.createElement(Kr,(0,Yo.default)({},u,{valueGetter:()=>"null"}));case"Undefined":return P.createElement(Kr,(0,Yo.default)({},u,{valueGetter:()=>"undefined"}));case"Function":case"Symbol":return P.createElement(Kr,(0,Yo.default)({},u,{valueGetter:m=>m.toString()}));case"Custom":return P.createElement(Kr,u);default:return P.createElement(Kr,(0,Yo.default)({},u,{valueGetter:()=>`<${f}>`}))}}a();a();var pg=Y(xh()),Q3=Y(Rj()),nE=Y(Lj()),oE=Y(i3()),eE=Y(k3()),tE=Y(G3());a();function Z3(t){var e=t[0],r=t[1],n=t[2],o,i,s;return o=e*1+r*0+n*1.13983,i=e*1+r*-.39465+n*-.5806,s=e*1+r*2.02311+n*0,o=Math.min(Math.max(0,o),1),i=Math.min(Math.max(0,i),1),s=Math.min(Math.max(0,s),1),[o*255,i*255,s*255]}function J3(t){var e=t[0]/255,r=t[1]/255,n=t[2]/255,o=e*.299+r*.587+n*.114,i=e*-.14713+r*-.28886+n*.436,s=e*.615+r*-.51499+n*-.10001;return[o,i,s]}function Y3(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,n)}return r}function Ht(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Y3(Object(r),!0).forEach(function(n){(0,Q3.default)(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Y3(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var eq=oE.default,X3=Object.keys(eq),Sie=function(e){return e<.25?1:e<.5?.9-e:1.1-e},Iie=function(e){var r=(0,eE.default)(e),n=J3(r.array()),o=(0,nE.default)(n,3),i=o[0],s=o[1],l=o[2],c=[Sie(i),s,l],f=Z3(c);return eE.default.rgb(f).hex()},ja=function(e){return function(r){return{className:[r.className,e.className].filter(Boolean).join(" "),style:Ht(Ht({},r.style||{}),e.style||{})}}},_ie=function(e,r){if(e===void 0)return r;if(r===void 0)return e;var n=(0,pg.default)(e),o=(0,pg.default)(r);switch(n){case"string":switch(o){case"string":return[r,e].filter(Boolean).join(" ");case"object":return ja({className:e,style:r});case"function":return function(i){for(var s=arguments.length,l=new Array(s>1?s-1:0),c=1;c<s;c++)l[c-1]=arguments[c];return ja({className:e})(r.apply(void 0,[i].concat(l)))}}break;case"object":switch(o){case"string":return ja({className:r,style:e});case"object":return Ht(Ht({},r),e);case"function":return function(i){for(var s=arguments.length,l=new Array(s>1?s-1:0),c=1;c<s;c++)l[c-1]=arguments[c];return ja({style:e})(r.apply(void 0,[i].concat(l)))}}break;case"function":switch(o){case"string":return function(i){for(var s=arguments.length,l=new Array(s>1?s-1:0),c=1;c<s;c++)l[c-1]=arguments[c];return e.apply(void 0,[ja(i)({className:r})].concat(l))};case"object":return function(i){for(var s=arguments.length,l=new Array(s>1?s-1:0),c=1;c<s;c++)l[c-1]=arguments[c];return e.apply(void 0,[ja(i)({style:r})].concat(l))};case"function":return function(i){for(var s=arguments.length,l=new Array(s>1?s-1:0),c=1;c<s;c++)l[c-1]=arguments[c];return e.apply(void 0,[r.apply(void 0,[i].concat(l))].concat(l))}}}},Oie=function(e,r){var n=Object.keys(r);for(var o in e)n.indexOf(o)===-1&&n.push(o);return n.reduce(function(i,s){return i[s]=_ie(e[s],r[s]),i},{})},Tie=function(e,r){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];if(r===null)return e;Array.isArray(r)||(r=[r]);var s=r.map(function(c){return e[c]}).filter(Boolean),l=s.reduce(function(c,f){return typeof f=="string"?c.className=[c.className,f].filter(Boolean).join(" "):(0,pg.default)(f)==="object"?c.style=Ht(Ht({},c.style),f):typeof f=="function"&&(c=Ht(Ht({},c),f.apply(void 0,[c].concat(o)))),c},{className:"",style:{}});return l.className||delete l.className,Object.keys(l.style).length===0&&delete l.style,l},rE=function(e){return Object.keys(e).reduce(function(r,n){return r[n]=/^base/.test(n)?Iie(e[n]):n==="scheme"?e[n]+":inverted":e[n],r},{})},tq=(0,tE.default)(function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=e.defaultBase16,o=n===void 0?eq:n,i=e.base16Themes,s=i===void 0?null:i,l=Cie(r,s);l&&(r=Ht(Ht({},l),r));for(var c=X3.reduce(function(w,v){return w[v]=r[v]||o[v],w},{}),f=Object.keys(r).reduce(function(w,v){return X3.indexOf(v)===-1&&(w[v]=r[v]),w},{}),u=t(c),d=Oie(f,u),m=arguments.length,h=new Array(m>3?m-3:0),y=3;y<m;y++)h[y-3]=arguments[y];return(0,tE.default)(Tie,2).apply(void 0,[d].concat(h))},3),rq=function(e){return!!e.extend},Cie=function(e,r){if(e&&rq(e)&&e.extend&&(e=e.extend),typeof e=="string"){var n=e.split(":"),o=(0,nE.default)(n,2),i=o[0],s=o[1];r?e=r[i]:e=oE[i],s==="inverted"&&(e=rE(e))}return e&&Object.prototype.hasOwnProperty.call(e,"base00")?e:void 0},nq=function(e){return typeof e=="string"?"".concat(e,":inverted"):e&&rq(e)&&e.extend?typeof e.extend=="string"?Ht(Ht({},e),{},{extend:"".concat(e.extend,":inverted")}):Ht(Ht({},e),{},{extend:rE(e.extend)}):e&&rE(e)};a();var oq={scheme:"solarized",author:"ethan schoonover (http://ethanschoonover.com/solarized)",base00:"#002b36",base01:"#073642",base02:"#586e75",base03:"#657b83",base04:"#839496",base05:"#93a1a1",base06:"#eee8d5",base07:"#fdf6e3",base08:"#dc322f",base09:"#cb4b16",base0A:"#b58900",base0B:"#859900",base0C:"#2aa198",base0D:"#268bd2",base0E:"#6c71c4",base0F:"#d33682"};var kie=t=>({BACKGROUND_COLOR:t.base00,TEXT_COLOR:t.base07,STRING_COLOR:t.base0B,DATE_COLOR:t.base0B,NUMBER_COLOR:t.base09,BOOLEAN_COLOR:t.base09,NULL_COLOR:t.base08,UNDEFINED_COLOR:t.base08,FUNCTION_COLOR:t.base08,SYMBOL_COLOR:t.base08,LABEL_COLOR:t.base0D,ARROW_COLOR:t.base0D,ITEM_STRING_COLOR:t.base0B,ITEM_STRING_EXPANDED_COLOR:t.base03}),Aie=t=>({String:t.STRING_COLOR,Date:t.DATE_COLOR,Number:t.NUMBER_COLOR,Boolean:t.BOOLEAN_COLOR,Null:t.NULL_COLOR,Undefined:t.UNDEFINED_COLOR,Function:t.FUNCTION_COLOR,Symbol:t.SYMBOL_COLOR}),Rie=t=>{let e=kie(t);return{tree:{border:0,padding:0,marginTop:"0.5em",marginBottom:"0.5em",marginLeft:"0.125em",marginRight:0,listStyle:"none",MozUserSelect:"none",WebkitUserSelect:"none",backgroundColor:e.BACKGROUND_COLOR},value:(r,n,o)=>{let{style:i}=r;return{style:{...i,paddingTop:"0.25em",paddingRight:0,marginLeft:"0.875em",WebkitUserSelect:"text",MozUserSelect:"text",wordWrap:"break-word",paddingLeft:o.length>1?"2.125em":"1.25em",textIndent:"-0.5em",wordBreak:"break-all"}}},label:{display:"inline-block",color:e.LABEL_COLOR},valueLabel:{margin:"0 0.5em 0 0"},valueText:(r,n)=>{let{style:o}=r;return{style:{...o,color:Aie(e)[n]}}},itemRange:(r,n)=>({style:{paddingTop:n?0:"0.25em",cursor:"pointer",color:e.LABEL_COLOR}}),arrow:(r,n,o)=>{let{style:i}=r;return{style:{...i,marginLeft:0,transition:"150ms",WebkitTransition:"150ms",MozTransition:"150ms",WebkitTransform:o?"rotateZ(90deg)":"rotateZ(0deg)",MozTransform:o?"rotateZ(90deg)":"rotateZ(0deg)",transform:o?"rotateZ(90deg)":"rotateZ(0deg)",transformOrigin:"45% 50%",WebkitTransformOrigin:"45% 50%",MozTransformOrigin:"45% 50%",position:"relative",lineHeight:"1.1em",fontSize:"0.75em"}}},arrowContainer:(r,n)=>{let{style:o}=r;return{style:{...o,display:"inline-block",paddingRight:"0.5em",paddingLeft:n==="double"?"1em":0,cursor:"pointer"}}},arrowSign:{color:e.ARROW_COLOR},arrowSignInner:{position:"absolute",top:0,left:"-0.4em"},nestedNode:(r,n,o,i,s)=>{let{style:l}=r;return{style:{...l,position:"relative",paddingTop:"0.25em",marginLeft:n.length>1?"0.875em":0,paddingLeft:s?0:"1.125em"}}},rootNode:{padding:0,margin:0},nestedNodeLabel:(r,n,o,i,s)=>{let{style:l}=r;return{style:{...l,margin:0,padding:0,WebkitUserSelect:s?"inherit":"text",MozUserSelect:s?"inherit":"text",cursor:s?"pointer":"default"}}},nestedNodeItemString:(r,n,o,i)=>{let{style:s}=r;return{style:{...s,paddingLeft:"0.5em",cursor:"default",color:i?e.ITEM_STRING_EXPANDED_COLOR:e.ITEM_STRING_COLOR}}},nestedNodeItemType:{marginLeft:"0.3em",marginRight:"0.3em"},nestedNodeChildren:(r,n,o)=>{let{style:i}=r;return{style:{...i,padding:0,margin:0,listStyle:"none",display:o?"block":"none"}}},rootNodeChildren:{padding:0,margin:0,listStyle:"none"}}},Nie=tq(Rie,{defaultBase16:oq}),iq=Nie;var sq=t=>t,Die=(t,e,r)=>r===0,Pie=(t,e,r,n)=>P.createElement("span",null,r," ",n),Fie=t=>{let[e]=t;return P.createElement("span",null,e,":")},$ie=()=>!1;function aq(t){let{data:e,theme:r,invertTheme:n,keyPath:o=["root"],labelRenderer:i=Fie,valueRenderer:s=sq,shouldExpandNodeInitially:l=Die,hideRoot:c=!1,getItemString:f=Pie,postprocessValue:u=sq,isCustomNode:d=$ie,collectionLimit:m=50,sortObjectKeys:h=!1}=t,y=ae(()=>iq(n?nq(r):r),[r,n]);return P.createElement("ul",y("tree"),P.createElement(Tu,{keyPath:c?[]:o,value:u(e),isCustomNode:d,styling:y,labelRenderer:i,valueRenderer:s,shouldExpandNodeInitially:l,hideRoot:c,getItemString:f,postprocessValue:u,collectionLimit:m,sortObjectKeys:h}))}a();var lq=require("obsidian");var Mie=()=>{let[t]=jt("clipboard-copy");return g("span",{ref:t})},cq=(t,e,r,n,o)=>{if(o.length===1){let i=async s=>{s.preventDefault(),s.stopPropagation(),await navigator.clipboard.writeText("```json\n"+JSON.stringify(e,null,2)+"\n```"),new lq.Notice("Copied JSON code block to clipboard")};return g("span",{role:"button",tabIndex:0,onClick:i,onKeyDown:i,"aria-label":"Copy item details in JSON",children:[n," ",g(Mie,{})]})}if(o[1]==="creators"&&o.length===3){let i=Uc(e);if(i)return g("span",{children:i})}if(o[1]==="tags"&&o.length===3){let i=e;return g("span",{children:['"',i.name,'"" (',Ui[i.type],")"]})}if(o[0]==="sortIndex"&&o.length===2)return g("span",{children:["[",e.join(", "),"]"]});if(o.length===2&&Array.isArray(e)&&e.length===1){let i=JSON.stringify(e[0]);return g("span",{children:[r," ",i.length>100?i.slice(0,100)+"...":i]})}return g("span",{children:[r," ",n]})};a();var fq=require("obsidian");var pq=(t,e,r,n)=>{let o=t.length===1,i=t.slice(0,-1),s=uq(i);return g("span",{...o?void 0:{onContextMenu:f=>{let u=new fq.Menu().addItem(d=>d.setTitle("Copy template").onClick(()=>{navigator.clipboard.writeText(`<%= ${s} %>`)}));n&&e!=="Array"&&u.addItem(d=>d.setTitle("Copy template (using with)").onClick(()=>{let[m,...h]=i,y=typeof m=="string"&&dq.test(m)?m:`'${m}'`,w=uq(h);navigator.clipboard.writeText(`<% { const { ${y}: $it } = ${w}; %>
|
|
<%= $it %>
|
|
<% } %>`)})),e==="Array"&&u.addItem(d=>d.setTitle("Copy template (using for-of loop)").onClick(()=>{navigator.clipboard.writeText(`<% for (const $it of ${s}) { %>
|
|
<%= $it %>
|
|
<% } %>`)})).addItem(d=>d.setTitle("Copy template (using forEach)").onClick(()=>{navigator.clipboard.writeText(`<% ${s}.forEach(($it, i) => { %>
|
|
<%= $it %>
|
|
<% }) %>`)})).addItem(d=>d.setTitle("Copy template (pick first element)").onClick(()=>{navigator.clipboard.writeText(`<%= ${s}.first() %>`)})).addItem(d=>d.setTitle("Copy template (pick last element)").onClick(()=>{navigator.clipboard.writeText(`<%= ${s}.last() %>`)})),R0.has(i[0])||u.addItem(d=>d.setTitle("Copy template (render when present)").onClick(()=>{navigator.clipboard.writeText(`<% if (${s}) { %>
|
|
<%= ${s} %>
|
|
<% } %>`)})),f.preventDefault(),u.showAtMouseEvent(f.nativeEvent)},style:{cursor:"context-menu"}},children:[t[0],": "]})},uq=t=>"it"+t.map(Lie).reverse().join(""),dq=/^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u,Lie=t=>typeof t=="number"?`[${t}]`:dq.test(t)?`.${t}`:`[${JSON.stringify(t)}]`;a();var jie=new Set(["sortIndex"]),qie=new Set(["creators","tags"]),Bie=new Set(["position"]),mq=(t,e,r)=>{let n=t[0];return jie.has(n)||qie.has(n)&&Array.isArray(e)&&e.length>6?!1:!!(Bie.has(n)||r<1||r<2&&Array.isArray(e)&&e.length>1)};a();a();var zie={grad:.9,turn:360,rad:360/(2*Math.PI)},no=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},at=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=Math.pow(10,e)),Math.round(r*t)/r+0},Tr=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=1),t>r?r:t>e?t:e},Sq=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},hq=function(t){return{r:Tr(t.r,0,255),g:Tr(t.g,0,255),b:Tr(t.b,0,255),a:Tr(t.a)}},iE=function(t){return{r:at(t.r),g:at(t.g),b:at(t.b),a:at(t.a,3)}},Uie=/^#([0-9a-f]{3,8})$/i,dg=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},Iq=function(t){var e=t.r,r=t.g,n=t.b,o=t.a,i=Math.max(e,r,n),s=i-Math.min(e,r,n),l=s?i===e?(r-n)/s:i===r?2+(n-e)/s:4+(e-r)/s:0;return{h:60*(l<0?l+6:l),s:i?s/i*100:0,v:i/255*100,a:o}},_q=function(t){var e=t.h,r=t.s,n=t.v,o=t.a;e=e/360*6,r/=100,n/=100;var i=Math.floor(e),s=n*(1-r),l=n*(1-(e-i)*r),c=n*(1-(1-e+i)*r),f=i%6;return{r:255*[n,l,s,s,c,n][f],g:255*[c,n,n,l,s,s][f],b:255*[s,s,c,n,n,l][f],a:o}},gq=function(t){return{h:Sq(t.h),s:Tr(t.s,0,100),l:Tr(t.l,0,100),a:Tr(t.a)}},yq=function(t){return{h:at(t.h),s:at(t.s),l:at(t.l),a:at(t.a,3)}},bq=function(t){return _q((r=(e=t).s,{h:e.h,s:(r*=((n=e.l)<50?n:100-n)/100)>0?2*r/(n+r)*100:0,v:n+r,a:e.a}));var e,r,n},Wu=function(t){return{h:(e=Iq(t)).h,s:(o=(200-(r=e.s))*(n=e.v)/100)>0&&o<200?r*n/100/(o<=100?o:200-o)*100:0,l:o/2,a:e.a};var e,r,n,o},Wie=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Hie=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Kie=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Vie=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,vq={string:[[function(t){var e=Uie.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?at(parseInt(t[3]+t[3],16)/255,2):1}:t.length===6||t.length===8?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:t.length===8?at(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=Kie.exec(t)||Vie.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:hq({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=Wie.exec(t)||Hie.exec(t);if(!e)return null;var r,n,o=gq({h:(r=e[1],n=e[2],n===void 0&&(n="deg"),Number(r)*(zie[n]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return bq(o)},"hsl"]],object:[[function(t){var e=t.r,r=t.g,n=t.b,o=t.a,i=o===void 0?1:o;return no(e)&&no(r)&&no(n)?hq({r:Number(e),g:Number(r),b:Number(n),a:Number(i)}):null},"rgb"],[function(t){var e=t.h,r=t.s,n=t.l,o=t.a,i=o===void 0?1:o;if(!no(e)||!no(r)||!no(n))return null;var s=gq({h:Number(e),s:Number(r),l:Number(n),a:Number(i)});return bq(s)},"hsl"],[function(t){var e=t.h,r=t.s,n=t.v,o=t.a,i=o===void 0?1:o;if(!no(e)||!no(r)||!no(n))return null;var s=function(l){return{h:Sq(l.h),s:Tr(l.s,0,100),v:Tr(l.v,0,100),a:Tr(l.a)}}({h:Number(e),s:Number(r),v:Number(n),a:Number(i)});return _q(s)},"hsv"]]},wq=function(t,e){for(var r=0;r<e.length;r++){var n=e[r][0](t);if(n)return[n,e[r][1]]}return[null,void 0]},Gie=function(t){return typeof t=="string"?wq(t.trim(),vq.string):typeof t=="object"&&t!==null?wq(t,vq.object):[null,void 0]};var sE=function(t,e){var r=Wu(t);return{h:r.h,s:Tr(r.s+100*e,0,100),l:r.l,a:r.a}},aE=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},xq=function(t,e){var r=Wu(t);return{h:r.h,s:r.s,l:Tr(r.l+100*e,0,100),a:r.a}},Eq=function(){function t(e){this.parsed=Gie(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return this.parsed!==null},t.prototype.brightness=function(){return at(aE(this.rgba),2)},t.prototype.isDark=function(){return aE(this.rgba)<.5},t.prototype.isLight=function(){return aE(this.rgba)>=.5},t.prototype.toHex=function(){return e=iE(this.rgba),r=e.r,n=e.g,o=e.b,s=(i=e.a)<1?dg(at(255*i)):"","#"+dg(r)+dg(n)+dg(o)+s;var e,r,n,o,i,s},t.prototype.toRgb=function(){return iE(this.rgba)},t.prototype.toRgbString=function(){return e=iE(this.rgba),r=e.r,n=e.g,o=e.b,(i=e.a)<1?"rgba("+r+", "+n+", "+o+", "+i+")":"rgb("+r+", "+n+", "+o+")";var e,r,n,o,i},t.prototype.toHsl=function(){return yq(Wu(this.rgba))},t.prototype.toHslString=function(){return e=yq(Wu(this.rgba)),r=e.h,n=e.s,o=e.l,(i=e.a)<1?"hsla("+r+", "+n+"%, "+o+"%, "+i+")":"hsl("+r+", "+n+"%, "+o+"%)";var e,r,n,o,i},t.prototype.toHsv=function(){return e=Iq(this.rgba),{h:at(e.h),s:at(e.s),v:at(e.v),a:at(e.a,3)};var e},t.prototype.invert=function(){return ir({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},t.prototype.saturate=function(e){return e===void 0&&(e=.1),ir(sE(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),ir(sE(this.rgba,-e))},t.prototype.grayscale=function(){return ir(sE(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),ir(xq(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),ir(xq(this.rgba,-e))},t.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},t.prototype.alpha=function(e){return typeof e=="number"?ir({r:(r=this.rgba).r,g:r.g,b:r.b,a:e}):at(this.rgba.a,3);var r},t.prototype.hue=function(e){var r=Wu(this.rgba);return typeof e=="number"?ir({h:e,s:r.s,l:r.l,a:r.a}):at(r.h)},t.prototype.isEqual=function(e){return this.toHex()===ir(e).toHex()},t}(),ir=function(t){return t instanceof Eq?t:new Eq(t)};var Zie=/^#(?:[\dA-F]{3}){1,2}$|^#(?:[\dA-F]{4}){1,2}$/i,Jie=t=>{let e=ir(t),{r,g:n,b:o}=e.rgba;return r*.299+n*.587+o*.114>186},Oq=(t,e,...r)=>{if(typeof e=="string"&&Zie.test(e))return g("span",{style:{backgroundColor:e,padding:"0 0.5em",color:Jie(e)?"black":"white"},children:e});let n;return r[0]==="linkMode"&&typeof e=="number"&&(n=qd[e]),r[0]==="type"&&typeof e=="number"&&(r.length===2&&Re[e]?n=Re[e]:r.length===4&&typeof r[1]=="number"&&r[2]==="tags"&&Ui[e]&&(n=Ui[e])),n?g(L,{children:[t," ",g("span",{children:["(",n,")"]})]}):t};var Tq=()=>document.body.classList.contains("theme-dark"),Yie={scheme:"Solarized Light",author:"Ethan Schoonover (modified by aramisgithub)",base00:"transparent",base01:"#eee8d5",base02:"#93a1a1",base03:"#839496",base04:"#657b83",base05:"#586e75",base06:"#073642",base07:"#002b36",base08:"#dc322f",base09:"#cb4b16",base0A:"#b58900",base0B:"#859900",base0C:"#2aa198",base0D:"#268bd2",base0E:"#6c71c4",base0F:"#d33682"},Xie={scheme:"Solarized Dark",author:"Ethan Schoonover (modified by aramisgithub)",base00:"transparent",base01:"#073642",base02:"#586e75",base03:"#657b83",base04:"#839496",base05:"#93a1a1",base06:"#eee8d5",base07:"#fdf6e3",base08:"#dc322f",base09:"#cb4b16",base0A:"#b58900",base0B:"#859900",base0C:"#2aa198",base0D:"#268bd2",base0E:"#6c71c4",base0F:"#d33682"};function lE({item:t,registerCssChange:e}){let[r,n]=q(()=>Tq());return K(()=>e?.(()=>n(Tq())),[e]),t?g(aq,{data:t,theme:r?Xie:Yie,invertTheme:!1,keyPath:["Zotero Item Data"],shouldExpandNodeInitially:mq,valueRenderer:Oq,labelRenderer:pq,getItemString:cq}):g("div",{children:"No Details Available"})}a();var Cq=require("obsidian");var mg=t=>({plugin:t,sourcePath:""});function Qie(){return mu((t,e)=>({preview:null,templateType:null,setTemplateType(r){t(n=>({...n,templateType:r||void 0}))},setPreview(r){t(({...n})=>({...n,preview:r??null}))},async setPreviewFromState(r,n){let o=e().preview;if(o?.docItem.itemID===r?.docItem&&o?.attachment?.itemID===r?.attachment&&o?.annot?.itemID===r?.annot)return!1;let i=n.database.settings.libId;if(!r.docItem)return console.error("TemplatePreview: no docItem provided"),!1;let[s]=await n.databaseAPI.getItems([[r.docItem,i]]);if(!s)return console.error("TemplatePreview: no docItem found for id "+r.docItem),!1;let l=await n.databaseAPI.getAttachments(r.docItem,i),c=l.find(h=>h.itemID===r.attachment)??null;r.attachment&&!c&&console.error("TemplatePreview: no attachment found for id "+r.attachment);let f=c?await n.databaseAPI.getAnnotations(c.itemID,i):[],u=f.find(h=>h.itemID===r.annot);r.annot&&!u&&console.error("TemplatePreview: no annotation found for id "+r.annot);let d=await n.databaseAPI.getTags([[r.docItem,i],...f.map(h=>[h.itemID,i])]),m;try{m=await n.databaseAPI.getNotes(s.itemID,i).then(h=>n.noteParser.normalizeNotes(h))}catch(h){console.error(h),m=[]}return t(()=>({preview:{docItem:s,allAttachments:l,annotations:f,attachment:c,tags:d,annot:f.find(h=>h.itemID===r.annot),notes:m}})),!0}}))}function kq(t,e){let r=null,n=!1,o=null,i=async s=>{n=!0;try{await t(...s)}catch(l){console.error(l)}for(;o;){let l=o;o=null;try{await t(...l)}catch(c){console.error(c)}}n=!1};return function(...s){if(r&&window.clearTimeout(r),n){o=s;return}r=window.setTimeout(()=>{r=null,i(s)},e)}}var qa=class extends Cq.FileView{constructor(r,n){super(r);this.plugin=n;this.store=Qie()}store;canAcceptExtension(r){return r==="md"}getTemplateType(r){if(!r)return!1;let n=Et(r.path,this.plugin.settings.templateDir);return n?.type!=="ejectable"?!1:n.name}setTemplateType(r){this.store.getState().setTemplateType(r)}async onLoadFile(r){await super.onLoadFile(r),this.setTemplateType(this.getTemplateType(r))}getState(){let r=super.getState(),{preview:n}=this.store.getState(),o;if(!n)o={preview:null};else{let{docItem:i,attachment:s,annot:l}=n;o={preview:{docItem:i.itemID,attachment:s?.itemID,annot:l?.itemID}}}return{...r,...o}}async setState(r,n){if(await super.setState(r,n),r.preview===void 0)return;let o=this.store.getState();r.preview===null?o.setPreview(null):await o.setPreviewFromState(r.preview,this.plugin)}setPreview(r){this.store.getState().setPreview(r)}async onOpen(){await super.onOpen();let[r,n]=Fs(this.plugin);n&&this.register(n),await r}};var Ba="zotero-item-details",Aq=({templateType:t})=>t==="annotation"?t:"note",hg=class extends qa{getViewType(){return Ba}getDisplayText(){let e=this.store.getState();return e.templateType?"Zotero Item Details: "+Aq(e):"Zotero Item Details"}async onOpen(){await super.onOpen();let[e,r]=Fs(this.plugin);r&&this.register(r),await e,P.render(g(ese,{store:this.store,plugin:this.plugin}),this.contentEl)}async onClose(){P.unmountComponentAtNode(this.contentEl),await super.onClose()}};function ese({store:t,plugin:e}){let r=Ut(t,Aq),n=Ut(t,i=>i.preview),o=ae(()=>{let i=mg(e);if(!n)return null;switch(r){case"note":{let s=zt(n,i);return s.docItem.annotations=void 0,s.docItem}case"annotation":{let s=zt(n,i),l=n.annot?s.annotations.find(c=>c.itemID===n.annot?.itemID):s.annotations[0];return l?(l.docItem=void 0,l):null}default:throw new Error("Unsupported template type")}},[e,n,r]);return o?g(lE,{item:o,registerCssChange:i=>(e.app.workspace.on("css-change",i),()=>e.app.workspace.off("css-change",i))}):g("div",{})}a();var Rq=Y(Ds(),1),Cr=require("obsidian");var za="zotero-template-preview",gg=class extends qa{getViewType(){return za}getDisplayText(){let e=this.store.getState().templateType;return e?"Zotero Template Preview: "+e:"Zotero Template Preview"}async switchToTemplate(e){if(!this.leaf.group)return!1;let r=await Nq(this.leaf.group,this.plugin);if(!r)return!1;let n=uE(e,this.plugin.settings.templateDir,this.app);if(!n||!(n instanceof Cr.TFile)){new Cr.Notice("Template file not found: "+e);return}return await r.openFile(n),!0}onload(){let e={annots:this.addAction("list-ordered","Open Template for Annotations",async()=>await this.switchToTemplate("annots")||new Cr.Notice("Cannot switch to template")),note:this.addAction("file-input","Open Note Template",async()=>await this.switchToTemplate("note")||new Cr.Notice("Cannot switch to template")),annotation:this.addAction("highlighter","Open Template for Single Annotation",async()=>await this.switchToTemplate("annotation")||new Cr.Notice("Cannot switch to template")),field:this.addAction("info","Open Template for Note Properties",async()=>await this.switchToTemplate("field")||new Cr.Notice("Cannot switch to template"))};Object.values(e).forEach(r=>r.hide()),this.register(this.store.subscribe((r,n)=>{if(r.templateType!==n.templateType)for(let[o,i]of Object.entries(e))i.toggle(o!==r.templateType)})),this.registerEvent(this.app.vault.on("zotero:template-updated",r=>{let n=this.getTemplateType(this.file);n&&r===n&&(this.setTemplateType(n),this.requestRender())}))}content=null;async render(){let{preview:e,templateType:r}=this.store.getState();if(!r){this.contentEl.empty(),this.contentEl.setText("No template preview available");return}if(!e){this.contentEl.empty(),this.contentEl.setText("No preview data available");return}let n="",o=mg(this.plugin),i=this.plugin.templateRenderer;try{switch(r){case"annotation":{let c=e.annot??e.annotations[0];if(!c){this.contentEl.setText("No annotation data available");return}n=i.renderAnnot(c,e,o);break}case"annots":n=i.renderAnnots(e,o);break;case"note":n=i.renderNote(e,o);break;case"field":n=i.renderFrontmatter(e,o);break;case"cite":n=i.renderCitations([e],o);break;case"cite2":n=i.renderCitations([e],o,!0);break;case"colored":n=i.renderColored({content:"I'm Highlight",color:"#FF000080",colorName:"red",bgColor:"#FF000080",bgColorName:"red"});break;default:(0,Rq.assertNever)(r)}if(n===this.content?.markdown)return;this.content?.unload(),this.contentEl.empty();let s=await(0,Cr.loadPrism)(),l=s.highlight(n,s.languages.markdown,"markdown");this.content=new cE(n),this.contentEl.createEl("pre").createEl("code",{cls:"language-markdown"}).innerHTML=l}catch(s){this.content?.unload(),this.contentEl.empty();let l=s instanceof Error?s.message:String(s);this.contentEl.createEl("h1",{text:`Error while rendering ${r}`,cls:["mod-error","message"]}),this.contentEl.createEl("pre",{text:l})}}requestRender=kq(()=>this.render(),200);async onOpen(){await super.onOpen(),this.register(this.store.subscribe((e,r)=>{e.templateType!==r.templateType?this.requestRender():e.preview!==r.preview&&this.requestRender()}))}},cE=class extends Cr.Component{constructor(r){super();this.markdown=r}};async function ds(t,e,{app:r,settings:n}){let{workspace:o}=r,i=uE(t,n.templateDir,r);if(!i||!(i instanceof ps.TFile)){new ps.Notice("Template file not found: "+t);return}let s=[];for(let u of o.getLeavesOfType("markdown")){let d=await Dq(u);d?.file&&Et(d.file.path,n.templateDir)?.type==="ejectable"&&u.getRoot().type==="floating"&&s.push(u)}if(s.length>0){let u=s[0];if(await u.openFile(i),!u.group)return;let d=o.getGroupLeaves(u.group);for(let m of d){await Pq(m);let h=m.getViewState().type;if(h===za||h===Ba){let y=m.view.getState();await m.view.setState({...y,preview:e},{})}}return}let l=o.openPopoutLeaf(),c=o.createLeafBySplit(l,"vertical"),f=o.createLeafBySplit(c,"vertical");await Promise.all([l.openFile(i,{active:!0}),c.setViewState({type:za,state:{file:i.path,preview:e},group:l}),f.setViewState({type:Ba,state:{file:i.path,preview:e},group:l})])}function uE(t,e,r){let n=gi(t,e),o=r.vault.getAbstractFileByPath(n);return o instanceof ps.TFile?o:null}async function Nq(t,e){for(let r of e.app.workspace.getGroupLeaves(t)){let n=await Dq(r);if(n?.file&&Et(n.file.path,e.settings.templateDir)?.type==="ejectable")return r}}async function Dq(t){return await Pq(t),t.view instanceof ps.MarkdownView?t.view:null}async function Pq(t){let e=t.loadIfDeferred;await e?.()}a();var Fq=t=>(e,r,n)=>{let{imgCacheImporter:o}=t,i=String(e.timeStamp),s="drag-source";e.dataTransfer.setData("text/plain",r()),e.dataTransfer.setData(s,i),e.dataTransfer.dropEffect="copy";let l=e.target.win,{workspace:c}=t.app,f=m=>{m.dataTransfer?.getData(s)===i&&o.flush(),c.off("editor-drop",f),l.removeEventListener("dragend",u)},u=()=>{o.cancel(),c.off("editor-drop",f)},d=c.on("editor-drop",m=>{m.dataTransfer?.getData("drag-source")===i&&o.flush(),c.offref(d)});l.addEventListener("dragend",u,{once:!0}),n&&e.dataTransfer.setDragImage(n,0,0)},$q=t=>({storeSelector:e=>tm(e,["doc","attachment","allAttachments","tags","annotations"]),get:(e,{allAttachments:r,attachment:n,doc:o,tags:i,annotations:s})=>!r||!n||!o||!i[e.itemID]||!s?null:()=>{let l=t.app.workspace.getActiveFile(),c=l&&wt(l)?l.path:null;return t.templateRenderer.renderAnnot(e,{tags:i,attachment:n,allAttachments:r,annotations:s,docItem:o.docItem,notes:[]},{plugin:t,sourcePath:c,merge:!1})}});a();var Ua=require("obsidian");var Mq=t=>(e,r)=>{let n=new Ua.Menu;if(n.addItem(o=>o.setTitle("Jump to note").setIcon("links-going-out").onClick(tse(r,t))),t.app.workspace.trigger("zotero:open-annot-menu",r,n),e.nativeEvent instanceof MouseEvent)n.showAtMouseEvent(e.nativeEvent);else{let o=e.currentTarget.getBoundingClientRect();n.showAtPosition({x:o.left,y:o.bottom})}},tse=(t,e)=>async()=>{let r=e.app.workspace.getActiveFile(),n=r&&wt(r)?r.path:void 0,o=e.plugin.noteIndex.getBlocksFor({item:t,file:n}).shift();if(!o){new Ua.Notice("No embed for this annotation in current note");return}let i=o.blocks.sort((m,h)=>{let y=m.start.offset-h.start.offset;return y!==0?y:m.end.offset-h.end.offset})[0];await sleep(10);let{leaf:s}=e,{workspace:l,vault:c}=e.app,f;if(s.group)f=l.getGroupLeaves(s.group);else{f=[];let m=l.getActiveFileView();m&&f.push(m.leaf)}let u=!1,d=i.end.line+1;for(let m of f)m&&m.view instanceof Ua.MarkdownView&&m.view.file?.path===o.file&&(m.view.setEphemeralState({line:d}),u=!0);if(!u){let m=c.getAbstractFileByPath(o.file);if(!m||!wt(m))throw new Error("File from block info not found: "+o.file);l.getLeaf().openFile(m,{eState:{line:d}})}};a();var Lq=(t,e)=>e.length===0?null:t?e.find(r=>r.itemID===t)??e[0]:e[0],yg=()=>({doc:null,allAttachments:null,attachmentID:null,annotations:null,attachment:null,tags:{}}),rse=()=>({follow:"zt-reader",doc:null,allAttachments:null,attachmentID:null,annotations:null,attachment:null,tags:{}}),Hu=t=>t.databaseAPI,jq=t=>mu((e,r)=>{let n=async(s,l)=>{let c=(await Hu(t).getAttachments(s,l)).filter($c);e(f=>({...f,allAttachments:c,attachment:Lq(f.attachmentID,c)}))},o=async(s,l)=>{let c=await Hu(t).getTags([[s,l]]);return e(f=>({...f,tags:c})),c},i=async s=>{let{attachment:l}=r();if(!l)return;let c=await Hu(t).getAnnotations(l.itemID,s),f=P0(c);e(m=>({...m,annotations:F0(f),attachment:l}));let u=await Hu(t).getTags(c.map(m=>[m.itemID,s])),d=$0(f,u);e(m=>({...m,tags:{...m.tags,...d}}))};return{...rse(),loadDocItem:async(s,l,c,f=!1)=>{if(s<0)return e(yg());if(r().doc?.docItem.itemID===s&&!f)return;let u=(await Hu(t).getItems([[s,c]]))[0];if(!u)return e(yg());let d={docItem:u,lib:c};if(l<0){let m=T0(window.localStorage,u);e({...yg(),doc:d,attachmentID:m})}else ha(window.localStorage,u,l),e({...yg(),doc:d,attachmentID:l});await n(u.itemID,c),await o(u.itemID,c),await i(c)},refresh:async()=>{let{doc:s,attachment:l}=r();if(!s)return;let{docItem:c,lib:f}=s;await n(c.itemID,f),await o(c.itemID,f),l&&await i(f)},setActiveAtch:s=>{let{doc:l,allAttachments:c}=r();if(l)if(ha(window.localStorage,l.docItem,s),!c)e(f=>({...f,attachment:null,attachmentID:s}));else{let f=Lq(s,c);e(u=>({...u,attachment:f,attachmentID:s}))}},setFollow:s=>e({follow:s})}});var wg="zotero-annotation-view",bg=class extends dh{constructor(r,n){super(r);this.plugin=n;this.store=jq(n)}update(){if(this.follow!=="ob-note")return;let r=this.plugin.settings.libId;(async()=>{if(this.file?.extension!=="md")return!1;let n=ts(this.file,this.app.metadataCache),o=rs(this.file,this.app.metadataCache);if(!n)return!1;let[i]=await this.plugin.databaseAPI.getItems([[n,r]]);return i?(this.setStatePrev(s=>({...s,follow:"ob-note",itemId:i.itemID,attachmentId:o?.[0]??void 0})),!0):!1})().then(n=>{n||this.setStatePrev(o=>({...o,follow:"ob-note",itemId:-1}))})}getViewType(){return wg}#e=null;onload(){super.onload(),this.contentEl.addClass("obzt");let r=null,n=!1,o=i=>{if(n)r=i;else{n=!0;let{itemId:s,attachmentId:l}=i;this.setStatePrev(c=>({...c,itemId:s,attachmentId:l})).then(()=>{if(n=!1,r===null)return;let c=r;r=null,o(c)})}};this.registerEvent(this.plugin.server.on("bg:notify",(i,s)=>{s.event==="reader/active"&&(this.#e=s.itemId,!(this.follow!=="zt-reader"||s.itemId<0||s.attachmentId<0)&&o(s))}))}getDisplayText(){return this.follow!=="ob-note"||!this.file?.basename?"Zotero Annotations":`Zotero Annotations for ${this.file.basename}`}getIcon(){return"highlighter"}get lib(){return this.plugin.settings.libId}store;get follow(){return this.store.getState().follow}getState(){let r=super.getState(),n=this.store.getState(),o={itemId:n.doc?.docItem.itemID??-1,attachmentId:n.attachment?.itemID??-1,follow:n.follow};return{...r&&typeof r=="object"?r:{},...o}}async setState(r,n){await super.setState(r,n??{});let{itemId:o=-1,attachmentId:i=-1,follow:s="zt-reader"}=r;this.store.getState().setFollow(s),await this.store.getState().loadDocItem(o,i,this.lib)}async setStatePrev(r){await this.setState(r(this.getState()))}onSetFollowZt=async()=>{this.setStatePrev(r=>({...r,follow:"zt-reader"})),await this.setStatePrev(({attachmentId:r,...n})=>({...n,follow:"zt-reader",...this.#e===null?{attachmentId:r}:{itemId:this.#e}}))};onSetFollowOb=()=>{this.store.getState().setFollow("ob-note"),this.update()};onSetFollowNull=async()=>{let{plugin:r}=this,n=await wh(r);if(!n)return;let{itemID:o}=n.value.item,i=r.settings.libId,s=await r.databaseAPI.getAttachments(o,i),l=await Vn(s,this.app);await this.setStatePrev(({attachmentId:c,...f})=>({...f,follow:null,itemId:o,attachmentId:l?.itemID}))};getContext(){let r=this,{plugin:n,store:o,app:i}=r;return{store:o,registerDbUpdate(s){return i.vault.on("zotero:db-refresh",s),()=>i.vault.off("zotero:db-refresh",s)},refreshConn:async()=>{await n.dbWorker.refresh({task:"dbConn"})},getImgSrc:s=>{let l=qo(s,n.settings.current?.zoteroDataDir);return nse(l)},onShowDetails:async(s,l)=>{let c=o.getState(),f=c.attachmentID??void 0;if(s==="doc-item")await ds("note",{docItem:l,attachment:f},n);else{let u=c.doc?.docItem.itemID;if(!u)throw new Error("Missing doc item when showing annotation details");await ds("annotation",{docItem:u,attachment:f,annot:l},n)}},onDragStart:Fq(n),onMoreOptions:Mq(r),annotRenderer:$q(n),onSetFollow(s){let l=new vg.Menu,c=o.getState().follow;if(c!=="zt-reader"&&l.addItem(f=>f.setIcon("book").setTitle("Follow active literature in Zotero reader").onClick(r.onSetFollowZt)),c!=="ob-note"&&l.addItem(f=>f.setIcon("file-edit").setTitle("Follow active literature note").onClick(r.onSetFollowOb)),l.addItem(f=>f.setIcon("file-lock-2").setTitle("Link with selected literature").onClick(async()=>{s.target.blur(),await r.onSetFollowNull()})),s.nativeEvent instanceof MouseEvent)l.showAtMouseEvent(s.nativeEvent);else{let u=s.target.getBoundingClientRect();l.showAtPosition({x:u.x,y:u.y})}}}}async onOpen(){await super.onOpen();let[r,n]=Fs(this.plugin);n&&this.register(n),this.contentEl.empty(),this.contentEl.createDiv({cls:"pane-empty p-2",text:"Loading..."}),r.then(()=>{this.contentEl.empty(),P.render(g(Vo.Provider,{value:yj,children:g(Ze.Provider,{value:this.getContext(),children:g(bu,{})})}),this.contentEl)}).catch(o=>{this.contentEl.empty(),console.error("Failed to load annot view: ",o),this.contentEl.createDiv({cls:"pane-empty p-2",text:"Failed to load, Check console for details"})}),this.registerEvent(this.plugin.server.on("bg:notify",(o,i)=>{if(i.event!=="reader/annot-select")return;let s=i.updates.filter(([,c])=>c).pop();if(!s)return;let[l]=s;this.highlightAnnot(l)}))}async onClose(){P.unmountComponentAtNode(this.contentEl),await super.onClose()}async highlightAnnot(r){let n=this.contentEl.querySelector(`.annot-preview[data-id="${r}"]`);n instanceof HTMLElement&&(n.addClass("select-flashing"),n.scrollIntoView({behavior:"smooth",block:"center"}),await sleep(1500),n.removeClass("select-flashing"))}};function nse(t){return(vg.Platform.resourcePathPrefix??"app://local/")+(0,qq.pathToFileURL)(t).pathname.substring(1)+`?${Date.now()}`}a();var Bq=require("path/posix");var xg=require("obsidian");var ose=[{command:"\u2191\u2193",purpose:"to navigate"},{command:"\u21B5",purpose:"to continue select note to import"},{command:"esc",purpose:"to dismiss"}],fE=class extends eo{constructor(r){super(r);this.plugin=r;this.setInstructions(ose)}};async function zq(t){let e=await Ki(new fE(t));if(!e)return!1;let{value:{item:r}}=e,n=await t.databaseAPI.getNotes(r.itemID,t.settings.libId);if(n.length===0)return new xg.Notice("No note found for selected literature"),!1;let o=await ES(n,u=>u.title??u.note?.substring(0,20)??`No title (Key ${u.key})`);if(!o.item)return!1;let i=o.item;if(!i.note)return new xg.Notice("Selected note is empty"),!1;let s=await t.noteParser.turndown(i.note),l=t.settings.current?.literatureNoteFolder,c=(0,Bq.join)(l,"zt-import",Qi(i.title??[i.note.substring(0,10),i.key].join("_"),{replacement:"_"})),f=await t.app.fileManager.createNewMarkdownFile(t.app.vault.getRoot(),c,s);return await t.app.workspace.openLinkText(f.path,"",!0),new xg.Notice(`Note imported: ${i.title??i.key}`),!0}a();var xn=require("obsidian");var Eg=class extends de{plugin=this.use(Se);onload(){this.registerEvent(this.plugin.server.on("zotero/open",e=>this.onZtOpen(Bf(e)))),this.registerEvent(this.plugin.server.on("zotero/export",e=>this.onZtExport(Bf(e)))),this.registerEvent(this.plugin.server.on("zotero/update",e=>this.onZtUpdate(Bf(e))))}async onZtOpen(e){if(e.type==="annotation"){new xn.Notice("Not implemented yet");return}if(e.items.length<1){new xn.Notice("No items to open");return}await this.plugin.noteFeatures.openNote(e.items[0])}async onZtUpdate(e){if(e.type==="annotation"){new xn.Notice("Single annotation update not yet supported");return}if(e.items.length<1){new xn.Notice("No items to open");return}if(e.items.length>1){new xn.Notice("Multiple literature note update not yet supported");return}await this.plugin.noteFeatures.updateNoteFromId(e.items[0])}async onZtExport(e){if(e.type==="annotation"){new xn.Notice("Not implemented yet");return}if(e.items.length<1){new xn.Notice("No items to open");return}if(e.items.length>1){new xn.Notice("Multiple items not yet supported");return}let{libraryID:r,id:n}=e.items[0],[o]=await this.plugin.databaseAPI.getItems([[n,r]]);if(!o){new xn.Notice("Item not found: "+n);return}let i=await this.plugin.noteFeatures.createNoteForDocItemFull(o);await this.plugin.app.workspace.openLinkText(i,"",!1,{active:!0})}};a();a();var Uq=require("obsidian");var ise=[{command:"\u2191\u2193",purpose:"to navigate"},{command:"\u21B5",purpose:"to open/create literature note"},{command:"esc",purpose:"to dismiss"}],pE=class extends eo{constructor(r){super(r);this.plugin=r;this.setInstructions(ise)}};async function dE(t){let e=await Ki(new pE(t));if(!e)return!1;let{value:{item:r},evt:n}=e;if(await t.noteFeatures.openNote(r,!0))return!0;let o=await t.noteFeatures.createNoteForDocItemFull(r);return await t.app.workspace.openLinkText(o,"",Uq.Keymap.isModEvent(n),{active:!0}),!0}var mE=class extends de{plugin=this.use(Se);protocol=this.use(Eg);onload(){let{plugin:e}=this,{app:r}=e;e.addCommand({id:"note-quick-switcher",name:"Open quick switcher for literature notes",callback:()=>dE(e)}),e.registerView(wg,o=>new bg(o,e)),e.registerView(za,o=>new gg(o,e)),e.registerView(Ba,o=>new hg(o,e)),e.registerEvent(e.app.workspace.on("file-menu",(o,i)=>{let s=Et(i.path,e.settings.templateDir);s?.type==="ejectable"&&o.addItem(l=>l.setIcon("edit").setTitle("Open template preview").onClick(()=>{ds(s.name,null,e)}))})),e.addCommand({id:"zotero-annot-view",name:"Open Zotero annotation view in side panel",callback:()=>{r.workspace.ensureSideLeaf(wg,"right",{active:!0,state:{file:r.workspace.getActiveFile()?.path}})}}),e.addCommand({id:"insert-markdown-citation",name:"Insert Markdown citation",editorCallback:(o,i)=>$x(o,i.file,e)}),e.registerEditorSuggest(new Iu(e));let n=async(o,i)=>{let s=e.settings.libId,l=ts(o,r.metadataCache);if(!l)return new oo.Notice("Cannot get zotero item key from file name"),!1;let[c]=await e.databaseAPI.getItems([[l,s]]);if(!c)return new oo.Notice("Cannot find zotero item with key "+l),!1;await this.updateNote(c,i)};e.addCommand({id:"update-literature-note",name:"Update literature note",editorCheckCallback(o,i,s){let l=s.file&&du(s.file,r);if(o)return!!l;l&&n(s.file)}}),e.addCommand({id:"overwrite-update-literature-note",name:"Force update literature note by overwriting",editorCheckCallback(o,i,s){let l=s.file&&du(s.file,r);if(o)return!!l;l&&n(s.file,!0)}}),e.addCommand({id:"import-note",name:"Import note",callback:()=>zq(e)}),e.registerEvent(e.app.workspace.on("file-menu",(o,i)=>{du(i,r)&&(o.addItem(s=>s.setTitle("Update literature note").setIcon("sync").onClick(()=>n(i))),e.settings.current?.updateOverwrite||o.addItem(s=>s.setTitle("Force update by overwriting").setIcon("sync").onClick(()=>n(i,!0))))})),e.registerEvent(e.app.workspace.on("file-menu",(o,i)=>{let s=Et(i.path,e.settings.templateDir);s?.type==="ejectable"&&o.addItem(l=>l.setTitle("Reset to default").setIcon("reset").onClick(async()=>{activeWindow.confirm("Reset template to default?")&&await e.app.vault.modify(i,ht.Ejectable[s.name])}))}))}async openNote(e,r=!1){let{workspace:n}=this.plugin.app,{noteIndex:o}=this.plugin,i=o.getNotesFor(e);if(!i.length)return!r&&new oo.Notice(`No literature note found for zotero item with key ${e.key}`),!1;let s=i.sort().shift();return await n.openLinkText(s,"",!1,{active:!0}),!0}async createNoteForDocItem(e,r){let{noteIndex:n}=this.plugin,o=n.getNotesFor(e);if(o.length)throw new Sg(o,e.key);let{vault:i,fileManager:s}=this.plugin.app,{literatureNoteFolder:l}=this.plugin.settings.current,c=this.plugin.templateRenderer,f=(0,Wq.join)(l,r.filename(c,{plugin:this.plugin})),u=i.getAbstractFileByPath(f);if(u&&ts(u,this.plugin.app.metadataCache))throw new Sg([f],e.key);return await s.createNewMarkdownFile(i.getRoot(),f,r.note(c,{plugin:this.plugin,sourcePath:f}))}async createNoteForDocItemFull(e){let r=this.plugin.settings.libId,n=await this.plugin.databaseAPI.getAttachments(e.itemID,r),o=await Vn(n,this.plugin.app);o&&va(o,e);let i=await this.plugin.databaseAPI.getNotes(e.itemID,r).then(f=>this.plugin.noteParser.normalizeNotes(f)),s=await Su(e,{all:n,selected:o?[o]:[],notes:i},this.plugin),l=Object.values(s)[0];return(await this.createNoteForDocItem(e,{note:(f,u)=>f.renderNote(l,u),filename:(f,u)=>f.renderFilename(l,u)})).path}async updateNoteFromId(e){let{noteIndex:r,databaseAPI:n}=this.plugin;if(!r.getNotesFor(e).length){new oo.Notice(`No literature note found for zotero item with key ${e.key}`);return}let[i]=await n.getItems([[e.key,e.libraryID]]);if(!i){new oo.Notice(`Cannot find zotero item with key ${e.key}`);return}await this.updateNote(i)}async updateNote(e,r){let n=await wj(e,this.plugin,r);n?n.addedAnnots>0||n.updatedAnnots>0?new oo.Notice(`Affected ${n.notes} notes, annotations: ${n.addedAnnots} added, ${n.updatedAnnots} updated`):new oo.Notice(`Affected ${n.notes} notes, no annotation updated`):new oo.Notice("No note found for this literature")}},Hq=mE,Sg=class extends Error{constructor(r,n){super(`Note linked to ${n} already exists: ${r.join(",")}`);this.targets=r;this.key=n;this.name="NoteExistsError"}};a();var _g=require("@codemirror/language");var ms=require("obsidian");var Ig=class extends de{plugin=this.use(Se);onload(){this.patchEditorClick()}async patchEditorClick(){let{workspace:e}=this.plugin.app,{noteIndex:r,database:n,settings:o,noteFeatures:i}=this.plugin;await XT(this.plugin.app);let s=()=>e.getLeavesOfType("markdown").length>0,[l,c]=Al({register:u=>e.on("layout-change",()=>{s()&&u()}),unregister:u=>e.offref(u),escape:s,timeout:null});c&&this.register(c),await l;let f=await sse(e);if(!f){new ms.Notice("No markdown editor available for citekey click support");return}this.register(sr(f.editor.constructor.prototype,{getClickableTokenAt:u=>function(d,...m){let h=u.call(this,d,...m);return h||lse.call(this,d,r)}})),this.register(sr(f.editMode.constructor.prototype,{triggerClickableToken:u=>function(d,m){if(d.type==="internal-link"&&d.citekey==="zotero")(async()=>{let h=d.text,{[h]:y}=await n.api.getItemIDsFromCitekey([d.text]);if(y<0){new ms.Notice(`Citekey ${h} not found in Zotero`);return}let[w]=await n.api.getItems([[y,o.libId]]);if(!w){new ms.Notice(`Item not found for citekey ${h}`);return}let v=await i.createNoteForDocItemFull(w);await e.openLinkText(v,"",!0,{active:!0})})();else return u.call(this,d,m)}}))}};async function sse(t){for(let e of t.getLeavesOfType("markdown")){let r=await ase(e);if(r)return r}return null}async function ase(t){let e=t.loadIfDeferred;return t.view instanceof ms.MarkdownView||await e?.(),t.view instanceof ms.MarkdownView?t.view:null}function lse(t,e){let r=this.cm,n=r.state.doc,o=[],i=n.line(t.line+1),s=(0,_g.syntaxTree)(r.state),l=i.from;s.iterate({from:i.from,to:i.to,enter:w=>{let v=w.type,x=w.from,S=w.to,k=v.prop(_g.tokenClassNodeProp);k&&(l<x&&o.push({type:"",from:l,to:x}),o.push({type:k,from:x,to:S}),l=S)}}),l<i.to&&o.push({type:"",from:l,to:i.to});let c=this.posToOffset(t),f=-1;for(let w=0;w<o.length;w++){let v=o[w];if(v.from<=c&&v.to>=c){f=w;break}}if(f<0)return null;let u=o[f];if(!u.type.split(" ").includes("hmd-barelink"))return null;let m=n.sliceString(u.from,u.to);if(!m.startsWith("@"))return null;let h=m.slice(1),y={start:this.offsetToPos(u.from),end:this.offsetToPos(u.to)};if(e.citekeyCache.has(h)){let[w]=e.citekeyCache.get(h);return{type:"internal-link",text:w,...y}}else return{type:"internal-link",text:h,citekey:"zotero",...y}}a();var Og=require("obsidian");var Wa=class extends de{plugin=this.use(Se);settings=this.use(be);app=this.use(Og.App);get meta(){return this.app.metadataCache}get vault(){return this.app.vault}get literatureNoteFolder(){return this.settings.current?.literatureNoteFolder}get joinPath(){return cse(this.literatureNoteFolder)}noteCache=new Map;blockCache={byFile:new Map,byKey:new Map};citekeyCache=new Map;#e(e,r){let n=ox(r);if(n){if(!this.noteCache.has(n))return this.noteCache.set(n,new Set([e])),!0;let i=this.noteCache.get(n),s=i.size;return i.add(e).size!==s}let o=!1;for(let[i,s]of this.noteCache.entries()){let l=s.delete(e);o||=l,l&&s.size===0&&this.noteCache.delete(i)}return o}#t(e,r){let n=c=>{let f=this.blockCache.byFile.get(c);if(!f)return!1;this.blockCache.byFile.delete(c);for(let u of f){let d=this.blockCache.byKey.get(u.key);d.delete(u),d.size===0&&this.blockCache.byKey.delete(u.key)}return!0};if(!r)return n(e);let{blocks:o,sections:i}=r;if(!i||!o)return n(e);let s=i.filter(fu);if(s.length===0)return n(e);n(e);let l=gu(s.flatMap(c=>pu(c.id).map(f=>[f,c.position])),Wi(([c])=>c),ba((c,f)=>({file:e,key:c,blocks:f.map(([u,d])=>d)})),Xd);this.blockCache.byFile.set(e,l);for(let c of l){let f=this.blockCache.byKey.get(c.key);f?f.add(c):this.blockCache.byKey.set(c.key,new Set([c]))}return!0}#n(e,r){let n=r?.frontmatter?.citekey;if(n){if(!this.citekeyCache.has(n))return this.citekeyCache.set(n,new Set([e])),!0;let i=this.citekeyCache.get(n),s=i.size;return i.add(e).size!==s}let o=!1;for(let[i,s]of this.citekeyCache.entries()){let l=s.delete(e);o||=l,l&&s.size===0&&this.citekeyCache.delete(i)}return o}getNotesFor(e){let r=this.noteCache.get(ar(e,!0));return r?[...r]:[]}getBlocksFor({file:e,item:r}){if(!e&&!r)throw new Error("no file or item provided");let n=r?this.blockCache.byKey.get(ar(r,!0)):null,o=e?this.blockCache.byFile.get(e):null;return e&&r?!o||!n?[]:o.filter(i=>n.has(i)):e?o?[...o]:[]:r?n?[...n]:[]:[]}getBlocksIn(e){let r=this.blockCache.byFile.get(e);return r?[...r]:null}#o(e,r){r===void 0&&(r=this.meta.getCache(e)),[this.#e(e,r),this.#t(e,r),this.#n(e,r)].some(o=>o)&&this.meta.trigger("zotero:index-update",e)}#i(e){this.#o(e,null)}#r(){this.noteCache.clear(),this.blockCache.byFile.clear(),this.blockCache.byKey.clear(),this.meta.trigger("zotero:index-clear")}onload(){this.settings.once(()=>{[this.meta.on("changed",this.onMetaChanged,this),this.vault.on("rename",this.onFileRenamed,this),this.vault.on("delete",this.onFileRemoved,this)].forEach(this.registerEvent.bind(this));let[e,r]=YT(this.plugin.app,{});r&&this.register(r),e.then(()=>{this.onMetaBuilt(),this.plugin.addCommand({id:"refresh-note-index",name:"Refresh literature notes index",callback:()=>{this.reload(),new Og.Notice("Literature notes re-indexed")}})})}),this.register(Ve(ut(()=>this.reload(),()=>this.literatureNoteFolder,!0)))}onMetaBuilt(){for(let e of this.vault.getMarkdownFiles())this.#o(e.path)}onMetaChanged(e,r,n){this.#o(e.path,n)}onFileRemoved(e){wt(e)&&this.#i(e.path)}onFileRenamed(e,r){this.#i(r),wt(e)&&this.#o(e.path)}reload(){this.#r(),this.onMetaBuilt(),W.info("Note Index: Reloaded")}};he([ge],Wa.prototype,"literatureNoteFolder",1);var cse=t=>t==="/"?"":t+"/";a();a();var hE=require("crypto");a();var Kq="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var use=128,hs,Ha,fse=t=>{!hs||hs.length<t?(hs=Buffer.allocUnsafe(t*use),(0,hE.randomFillSync)(hs),Ha=0):Ha+t>hs.length&&((0,hE.randomFillSync)(hs),Ha=0),Ha+=t};var Tg=(t=21)=>{fse(t-=0);let e="";for(let r=Ha-t;r<Ha;r++)e+=Kq[hs[r]&63];return e};var Xq=require("obsidian");a();var gE=/^https?:\/\/zotero\.org\/.*\/items\/([A-Z\d]+)$/;function Ka(t){let e=t.match(gE);return e?e[1]:null}var{DataCitation:Vq,DataAnnotation:Gq}=Mt({CitationItem:{uris:[gE]},DataCitation:{citationItems:"CitationItem[]","properties?":"any","locator?":"string"},DataAnnotation:{attachmentURI:gE,annotationKey:"string",citationItem:"CitationItem"}}).compile();a();var Zq=t=>({filter:(e,r)=>e.nodeName==="SPAN"&&!!e.style.color,replacement:(e,r,n)=>{if(!(r instanceof HTMLElement))throw new Error("Unexpected node");let{color:o,colorName:i}=yE(r.style.color),s=r.firstChild,l={bgColor:null,bgColorName:null};if(s===r.lastChild&&s?.nodeName==="SPAN"&&s.style.backgroundColor){let{color:c,colorName:f}=yE(s.style.backgroundColor);l={bgColor:c,bgColorName:f}}return t.renderColored({content:e,color:o,colorName:i,...l})}}),Jq=t=>({filter:(e,r)=>e.nodeName==="SPAN"&&!!e.style.backgroundColor,replacement:(e,r,n)=>{if(!(r instanceof HTMLElement))throw new Error("Unexpected node");let{color:o,colorName:i}=yE(r.style.backgroundColor),s=r.parentElement;return s?.nodeName==="SPAN"&&s.style.color&&!r.nextSibling?e:t.renderColored({content:e,color:null,colorName:null,bgColor:o,bgColorName:i})}});function yE(t){if(!t)return{colorName:null,color:null};let e=ir(t).toHex().toUpperCase();return{colorName:Ym[e.substring(0,7)]??e,color:e}}var Ku={cite:{pattern:/%%ZTNOTE\.CITE:([\w-]{10})%%/g,create:t=>`%%ZTNOTE.CITE:${t}%%`},annot:{pattern:/%%ZTNOTE\.ANNOT:([\w-]{10})%%/g,create:t=>`%%ZTNOTE.ANNOT:${t}%%`}},bE=class{constructor(e){Object.assign(this,e)}toString(){return this.content}},Cg=class extends de{plugin=this.use(Se);citations=new Map;annotations=new Map;tdService=new globalThis.TurndownService({headingStyle:"atx"}).addRule("color",Zq(this.plugin.templateRenderer)).addRule("bg-color",Jq(this.plugin.templateRenderer)).addRule("highlight-imported",{filter:(e,r)=>{if(e.tagName!=="P")return!1;let[n,o,i]=e.childNodes;return n instanceof HTMLElement&&n.classList.contains("highlight")?o instanceof HTMLElement?o.classList.contains("citation"):o instanceof Text&&o.textContent?.trim()===""?i instanceof HTMLElement&&i.classList.contains("citation"):!1:!1},replacement:(e,r,n)=>{let[o,i]=r.children;for(;r.firstChild!==i;)r.removeChild(r.firstChild);r.removeChild(i);let s=Yq(o.dataset.annotation),l=r,c=Tg(10);return this.annotations.set(c,{annotationKey:s.annotationKey,citationKey:Ka(s.citationItem.uris[0]),attachementKey:Ka(s.attachmentURI),commentHTML:l.textContent?.trim()?l.innerHTML:null,inline:!1}),Ku.annot.create(c)}}).addRule("citation",{filter:(e,r)=>e.classList.contains("citation")&&!!e.dataset.citation,replacement:(e,r,n)=>{if(!(r instanceof HTMLElement))throw new Error("Unexpected node");let o=pse(r.dataset.citation),i=Tg(10);return this.citations.set(i,{text:e,itemKeys:o.citationItems.map(({uris:[s]})=>Ka(s))}),Ku.cite.create(i)}}).addRule("highlight",{filter:(e,r)=>e.classList.contains("highlight")&&!!e.dataset.annotation,replacement:(e,r,n)=>{if(!(r instanceof HTMLElement))throw new Error("Unexpected node");let o=Yq(r.dataset.annotation),i=Tg(10);return this.annotations.set(i,{annotationKey:o.annotationKey,citationKey:Ka(o.citationItem.uris[0]),attachementKey:Ka(o.attachmentURI),commentHTML:null,inline:!0}),Ku.annot.create(i)}});onload(){}async normalizeNotes(e){let r=[];for(let{note:n,...o}of e)r.push(new bE({...o,content:n?await this.turndown(n):"",note:n}));return r}async turndown(e){this.citations.clear(),this.annotations.clear();let r=this.tdService.turndown(e),n={citations:[...this.citations.values()].flatMap(u=>u.itemKeys),annotations:[...this.annotations.values()].map(u=>u.citationKey)},o=new Set([...this.annotations.values()].map(u=>u.attachementKey)),i=this.plugin.settings.libId,s=dse([...n.citations,...n.annotations]),l=await this.plugin.databaseAPI.getItems(s.map(u=>[u,i])).then(async u=>{let d=new Map;for(let m=0;m<s.length;m++){let h=s[m],y=u[m];if(y===null){d.set(h,null);continue}let w=await this.plugin.databaseAPI.getAttachments(y.itemID,i),v=new Map;for(let x of w){if(!o.has(x.key))continue;let S=await this.plugin.databaseAPI.getAnnotations(x.itemID,i);for(let k of S)v.set(k.key,k)}d.set(h,{item:y,attachments:w,annotations:v})}return d}),c=await this.plugin.databaseAPI.getTags([...l.values()].flatMap(u=>u?[u.item.itemID,...[...u.annotations.values()].map(d=>d.itemID)]:[]).map(u=>[u,i])),f=r.replaceAll(Ku.cite.pattern,(u,d)=>{let m=this.citations.get(d),h=m.itemKeys.map(w=>{let v=l.get(w);if(!v)throw W.error("citation not found, key: ",w,m),new Error(`citation not found: key ${w}`);return{allAttachments:v.attachments,annotations:[],docItem:v.item,attachment:null,tags:c,notes:[]}});return this.plugin.templateRenderer.renderCitations(h,{plugin:this.plugin})}).replaceAll(Ku.annot.pattern,(u,d)=>{let m=this.annotations.get(d),h=l.get(m.citationKey);if(!h)throw W.error("citation not found, key:",d,m),new Error(`citation key not found: ${d}`);let y=h.annotations.get(m.annotationKey);if(!y)throw W.error("annotation not found, key: ",m.annotationKey,m),new Error(`annotation key not found: ${m.annotationKey}`);let w=this.plugin.templateRenderer.renderAnnot({...y,ztnote:{comment:m.commentHTML,get commentMd(){return m.commentHTML?(0,Xq.htmlToMarkdown)(m.commentHTML):""},inline:m.inline}},{allAttachments:h.attachments,annotations:[...h.annotations.values()],attachment:h.attachments.find(v=>v.itemID===y.parentItemID),docItem:h.item,notes:[],tags:c},{plugin:this.plugin});return m.inline?w:`
|
|
`+w+`
|
|
`}).replace(/\n{3,}/g,`
|
|
|
|
`);return this.citations.clear(),this.annotations.clear(),f}};function pse(t){let e=JSON.parse(decodeURIComponent(t)),{data:r,problems:n}=Vq(e);if(n)throw W.error("Unexpected citation data",e,n),new Error("Unexpected citation data: "+n.summary);return r}function Yq(t){let e=JSON.parse(decodeURIComponent(t)),{data:r,problems:n}=Gq(e);if(n)throw W.error("Unexpected annotation data",e,n),new Error("Unexpected annotation data: "+n.summary);return r}function dse(t){return[...new Set(t)]}a();var Rg=require("fs/promises");a();a();var mse=(t,e)=>e.some(r=>t instanceof r),Qq,eB;function hse(){return Qq||(Qq=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function gse(){return eB||(eB=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var tB=new WeakMap,wE=new WeakMap,rB=new WeakMap,vE=new WeakMap,EE=new WeakMap;function yse(t){let e=new Promise((r,n)=>{let o=()=>{t.removeEventListener("success",i),t.removeEventListener("error",s)},i=()=>{r(En(t.result)),o()},s=()=>{n(t.error),o()};t.addEventListener("success",i),t.addEventListener("error",s)});return e.then(r=>{r instanceof IDBCursor&&tB.set(r,t)}).catch(()=>{}),EE.set(e,t),e}function bse(t){if(wE.has(t))return;let e=new Promise((r,n)=>{let o=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",s),t.removeEventListener("abort",s)},i=()=>{r(),o()},s=()=>{n(t.error||new DOMException("AbortError","AbortError")),o()};t.addEventListener("complete",i),t.addEventListener("error",s),t.addEventListener("abort",s)});wE.set(t,e)}var xE={get(t,e,r){if(t instanceof IDBTransaction){if(e==="done")return wE.get(t);if(e==="objectStoreNames")return t.objectStoreNames||rB.get(t);if(e==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return En(t[e])},set(t,e,r){return t[e]=r,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function nB(t){xE=t(xE)}function vse(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...r){let n=t.call(kg(this),e,...r);return rB.set(n,e.sort?e.sort():[e]),En(n)}:gse().includes(t)?function(...e){return t.apply(kg(this),e),En(tB.get(this))}:function(...e){return En(t.apply(kg(this),e))}}function wse(t){return typeof t=="function"?vse(t):(t instanceof IDBTransaction&&bse(t),mse(t,hse())?new Proxy(t,xE):t)}function En(t){if(t instanceof IDBRequest)return yse(t);if(vE.has(t))return vE.get(t);let e=wse(t);return e!==t&&(vE.set(t,e),EE.set(e,t)),e}var kg=t=>EE.get(t);function iB(t,e,{blocked:r,upgrade:n,blocking:o,terminated:i}={}){let s=indexedDB.open(t,e),l=En(s);return n&&s.addEventListener("upgradeneeded",c=>{n(En(s.result),c.oldVersion,c.newVersion,En(s.transaction),c)}),r&&s.addEventListener("blocked",c=>r(c.oldVersion,c.newVersion,c)),l.then(c=>{i&&c.addEventListener("close",()=>i()),o&&c.addEventListener("versionchange",f=>o(f.oldVersion,f.newVersion,f))}).catch(()=>{}),l}var xse=["get","getKey","getAll","getAllKeys","count"],Ese=["put","add","delete","clear"],SE=new Map;function oB(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(SE.get(e))return SE.get(e);let r=e.replace(/FromIndex$/,""),n=e!==r,o=Ese.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(o||xse.includes(r)))return;let i=async function(s,...l){let c=this.transaction(s,o?"readwrite":"readonly"),f=c.store;return n&&(f=f.index(l.shift())),(await Promise.all([f[r](...l),o&&c.done]))[0]};return SE.set(e,i),i}nB(t=>({...t,get:(e,r,n)=>oB(e,r)||t.get(e,r,n),has:(e,r)=>!!oB(e,r)||t.has(e,r)}));var Ng=require("obsidian");var Sse="zotlit",Ag="pdf-outline",Vu=class extends de{constructor(r){super();this.plugin=r}db=iB(Sse,1,{upgrade(r){r.createObjectStore(Ag,{keyPath:"path"})}});async getCachedOutlineKeys(){return await(await this.db).getAllKeys(Ag)}async getPDFOutline(r,n=!1){let o=await this.db,i=await o.get(Ag,r),s;try{s=await(0,Rg.stat)(r)}catch(c){if(c.code==="ENOENT")return new Ng.Notice("PDF file not found"),null;throw c}if(i&&s.mtimeMs===i.mtime&&!n)return W.debug("PDF outline cache hit",r),i.outline;let l=await this.#e(r);return l?(await o.put(Ag,{path:r,mtime:s.mtimeMs,outline:l,created:Date.now()}),W.debug("PDF outline cache miss and updated",r),l):null}pdfjs;async#e(r){this.pdfjs??=await(0,Ng.loadPdfJs)();let n=this.pdfjs.getDocument(await(0,Rg.readFile)(r)),o=await n.promise,i=sB(await o.getOutline(),0),s=await Promise.all(i.map(async({dest:l,...c})=>{if(!Array.isArray(l))return{...c,page:null};let[f]=l,u=await o.getPageIndex(f);return{...c,page:u}}));return await o.cleanup(),await n.destroy(),s}},sB=(t,e)=>t.flatMap(({title:r,dest:n,items:o})=>[{title:r,dest:n,level:e},...sB(o,e+1)]);a();a();var IE=require("fs");var aB=require("obsidian");var io=class extends de{settings=this.use(be);api=this.use(Zt).api;app=this.use(aB.App);get autoRefresh(){return this.settings.current?.autoRefresh}onDatabaseUpdate(e){return()=>this.app.vault.trigger("zotero:db-updated",e)}onload(){this.register(Ve(ut(()=>this.setAutoRefresh(this.autoRefresh),()=>this.autoRefresh))),W.debug("loading DatabaseWatcher")}onunload(){this.#e()}#e(){this.#n=!1,this.#t=ya(this.#t,e=>(e?.close(),null))}#t={main:null,bbt:null};#n=!1;async setAutoRefresh(e,r=!1){if(!(e===this.#n&&!r)&&(W.debug("Auto refresh set to "+e),this.#n=e,this.#e(),e)){this.#t.main=(0,IE.watch)(this.settings.zoteroDbPath,this.onDatabaseUpdate("main"));let n=await this.api.getLoadStatus();n.bbt&&(this.#t.bbt=(0,IE.watch)(n.bbtVersion==="v0"?this.settings.bbtSearchDbPath:this.settings.zoteroDbPath,this.onDatabaseUpdate("bbt")))}}};he([ge],io.prototype,"autoRefresh",1);a();var Gu=class extends de{onunload(){W.info("ZoteroDB unloaded")}get defaultLibId(){return this.settings.libId}settings=this.use(be);#e=this.use(Zt);watcher=this.use(io);get api(){return this.#e.api}async search(e){let n=this.defaultLibId;if(this.#e.status!==2)throw new Error("Search index not ready");let o=await this.api.search(n,{query:e,limit:50,index:Ise});if(o.length===0)return[];let i=_se(o);return i.length===0?[]:(await this.api.getItems(i.map(l=>[l.id,n]))).map((l,c)=>{let{id:f,fields:u,score:d}=i[c];if(!l)throw new Error("Item not found: "+f);return{item:l,score:d,fields:[...u]}})}async getItemsOf(e=50,r=this.defaultLibId){if(this.#e.status!==2)throw new Error("Search index not ready");return(await this.api.getItemsFromCache(e,r)).map(o=>({item:o,score:-1,fields:[]}))}},Ise=["title","creators[]:firstName","creators[]:lastName","date"];function _se(t){let{size:e}=new Set(t.flatMap(n=>n.result)),r=t.reduce((n,{field:o,result:i})=>(o.startsWith("creators[]")&&(o="creators"),i.forEach((s,l)=>{let c=e-l;switch(o){case"title":c*=100;break;case"creators":case"date":c*=5;break;default:throw new Error("Unknown field: "+o)}if(!n.has(+s))n.set(+s,{id:+s,score:c,fields:new Set([o])});else{let f=n.get(+s);f.fields.add(o),f.score+=c}}),n),new Map);return Array.from(r.values()).sort((n,o)=>o.score-n.score)}a();var Vr=require("fs/promises"),lB=require("path"),cB=require("path/posix");var kr=require("obsidian");var Qo=class extends de{onload(){W.debug("loading ImgCacheImporter")}async onunload(){await this.flush()}get app(){return this.use(Se).app}settings=this.use(be);queue=new Map;getCachePath(e){return qo(e,this.settings.current?.zoteroDataDir)}get mode(){return this.settings.current?.imgExcerptImport}get path(){return this.settings.current?.imgExcerptPath}get imgExcerptDir(){return this.mode?this.path:null}getInVaultPath(e){if(!this.imgExcerptDir||e.type!==Re.image)return null;let r=this.getCachePath(e);return Tse(e,r,this.imgExcerptDir)}import(e){let r=this.getCachePath(e),n=this.getInVaultPath(e);if(!n)return null;let o;return this.queue.has(n)?o=this.queue.get(n):(o=async()=>{let i=await this.linkToVault(n,r);return this.queue.delete(n),i},this.queue.set(n,o)),n}async flush(){return await Promise.all([...this.queue.values()].map(r=>r()))}cancel(){this.queue.clear()}async linkToVault(e,r){let n=await(0,Vr.stat)(r).then(s=>{if(!s.isFile()&&!s.isSymbolicLink()){let l=`failed to link image excerpt cache to vault: given path not file ${r}`;return new kr.Notice(l),gt(l,null),-1}return s.mtimeMs}).catch(s=>{if(s.code==="ENOENT"){let l=`failed to link image excerpt cache to vault: file not found ${r}`;return new kr.Notice(l),gt(l,s),-1}throw s});if(n===-1)return!1;let o=this.mode;if(o===!1)return W.trace("import mode disabled"),!1;let i=(0,cB.dirname)(e);if(i!=="."&&i!==".."&&await this.app.vault.createFolder(i).catch(()=>{}),this.app.vault.adapter instanceof kr.FileSystemAdapter){let s=this.app.vault.adapter.getFullPath(e),l=await(0,Vr.lstat)(s).catch(c=>{if(c.code!=="ENOENT")throw c;return null});if(o==="copy"){let c=-1;if(l)if(l.isSymbolicLink())W.trace(s+" is symlink, unlinking"),await(0,Vr.rm)(s);else if(l.isFile())c=l.mtimeMs;else{let f="Failed to import image excerpt cache: cannot overwrite non-file "+s;return new kr.Notice(f),gt(f,null),!1}if(c<0||n>c)return W.trace(s+" is file, "+(c<0?"creating":"overwritting")),await(0,Vr.copyFile)(r,s),new kr.Notice(`Copied image excerpt cache to vault: ${e}`),!0;W.trace("mtime check pass, skipping")}else{if(l){if(l.isSymbolicLink())return W.trace(s+" is symlink, skipping"),!1;if(l.isFile())W.trace(s+" is file, remove before symlinking"),await(0,Vr.rm)(s);else{let c="Failed to import image excerpt cache: cannot overwrite non-file "+s;return new kr.Notice(c),gt(c,null),!1}}try{await(0,Vr.symlink)(r,s,"file")}catch(c){if(c.code==="EPERM")return new kr.Notice(`Failed to symlink image excerpt cache to vault: permission denied ${r}, check directory permission or change import mode to copy. If you are using FAT32 drive, symlink is not supported.`),gt(`Failed to symlink image excerpt cache to vault: permission denied ${r}`,c),!1;throw c}return new kr.Notice(`linked image excerpt cache to vault: ${e}`),!0}return!1}else throw new Error("Mobile not supported")}};he([ge],Qo.prototype,"mode",1),he([ge],Qo.prototype,"path",1),he([ge],Qo.prototype,"imgExcerptDir",1);var Ose=(t,e)=>(e??"")+(0,lB.basename)(t),Tse=(t,e,r)=>{let n=Ose(e,t.groupID);return[(0,kr.normalizePath)(r),n].join("/")};a();_();a();a();_();a();_();function Va(t,e=[]){let r=[];function n(i,s){let l=Ke(s),c=r.length;r=[...r,s];function f(d){let{scope:m,children:h,...y}=d,w=m?.[t][c]||l,v=ae(()=>y,Object.values(y));return V(w.Provider,{value:v},h)}function u(d,m){let h=m?.[t][c]||l,y=re(h);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return f.displayName=i+"Provider",[f,u]}let o=()=>{let i=r.map(s=>Ke(s));return function(l){let c=l?.[t]||i;return ae(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return o.scopeName=t,[n,Cse(o,...e)]}function Cse(...t){let e=t[0];if(t.length===1)return e;let r=()=>{let n=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){let s=n.reduce((l,{useScope:c,scopeName:f})=>{let d=c(i)[`__scope${f}`];return{...l,...d}},{});return ae(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return r.scopeName=e.scopeName,r}a();_();a();_();a();_();function kse(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function _E(...t){return e=>t.forEach(r=>kse(r,e))}function gs(...t){return ee(_E(...t),t)}a();_();var Ga=Q((t,e)=>{let{children:r,...n}=t,o=tt.toArray(r),i=o.find(Rse);if(i){let s=i.props.children,l=o.map(c=>c===i?tt.count(s)>1?tt.only(null):Yt(s)?s.props.children:null:c);return V(OE,me({},n,{ref:e}),Yt(s)?br(s,void 0,l):null)}return V(OE,me({},n,{ref:e}),r)});Ga.displayName="Slot";var OE=Q((t,e)=>{let{children:r,...n}=t;return Yt(r)?br(r,{...Nse(n,r.props),ref:_E(e,r.ref)}):tt.count(r)>1?tt.only(null):null});OE.displayName="SlotClone";var Ase=({children:t})=>V(L,null,t);function Rse(t){return Yt(t)&&t.type===Ase}function Nse(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...l)=>{i(...l),o(...l)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function uB(t){let e=t+"CollectionProvider",[r,n]=Va(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),s=h=>{let{scope:y,children:w}=h,v=P.useRef(null),x=P.useRef(new Map).current;return P.createElement(o,{scope:y,itemMap:x,collectionRef:v},w)},l=t+"CollectionSlot",c=P.forwardRef((h,y)=>{let{scope:w,children:v}=h,x=i(l,w),S=gs(y,x.collectionRef);return P.createElement(Ga,{ref:S},v)}),f=t+"CollectionItemSlot",u="data-radix-collection-item",d=P.forwardRef((h,y)=>{let{scope:w,children:v,...x}=h,S=P.useRef(null),k=gs(y,S),j=i(f,w);return P.useEffect(()=>(j.itemMap.set(S,{ref:S,...x}),()=>void j.itemMap.delete(S))),P.createElement(Ga,{[u]:"",ref:k},v)});function m(h){let y=i(t+"CollectionConsumer",h);return P.useCallback(()=>{let v=y.collectionRef.current;if(!v)return[];let x=Array.from(v.querySelectorAll(`[${u}]`));return Array.from(y.itemMap.values()).sort((j,Z)=>x.indexOf(j.ref.current)-x.indexOf(Z.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:s,Slot:c,ItemSlot:d},m,n]}a();_();a();_();var Zu=globalThis?.document?Lt:()=>{};var Dse=Pr["useId".toString()]||(()=>{}),Pse=0;function Dg(t){let[e,r]=q(Dse());return Zu(()=>{t||r(n=>n??String(Pse++))},[t]),t||(e?`radix-${e}`:"")}a();_();_();var Fse=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ei=Fse.reduce((t,e)=>{let r=Q((n,o)=>{let{asChild:i,...s}=n,l=i?Ga:e;return K(()=>{window[Symbol.for("radix-ui")]=!0},[]),V(l,me({},s,{ref:o}))});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});a();_();function Ju(t){let e=M(t);return K(()=>{e.current=t}),ae(()=>(...r)=>{var n;return(n=e.current)===null||n===void 0?void 0:n.call(e,...r)},[])}a();_();function Pg({prop:t,defaultProp:e,onChange:r=()=>{}}){let[n,o]=$se({defaultProp:e,onChange:r}),i=t!==void 0,s=i?t:n,l=Ju(r),c=ee(f=>{if(i){let d=typeof f=="function"?f(t):f;d!==t&&l(d)}else o(f)},[i,t,o,l]);return[s,c]}function $se({defaultProp:t,onChange:e}){let r=q(t),[n]=r,o=M(n),i=Ju(e);return K(()=>{o.current!==n&&(i(n),o.current=n)},[n,o,i]),r}a();_();var Mse=Ke(void 0);function Fg(t){let e=re(Mse);return t||e||"ltr"}var TE="rovingFocusGroup.onEntryFocus",Lse={bubbles:!1,cancelable:!0},kE="RovingFocusGroup",[CE,fB,jse]=uB(kE),[qse,AE]=Va(kE,[jse]),[Bse,zse]=qse(kE),Use=Q((t,e)=>V(CE.Provider,{scope:t.__scopeRovingFocusGroup},V(CE.Slot,{scope:t.__scopeRovingFocusGroup},V(Wse,me({},t,{ref:e}))))),Wse=Q((t,e)=>{let{__scopeRovingFocusGroup:r,orientation:n,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:f,...u}=t,d=M(null),m=gs(e,d),h=Fg(i),[y=null,w]=Pg({prop:s,defaultProp:l,onChange:c}),[v,x]=q(!1),S=Ju(f),k=fB(r),j=M(!1),[Z,X]=q(0);return K(()=>{let J=d.current;if(J)return J.addEventListener(TE,S),()=>J.removeEventListener(TE,S)},[S]),V(Bse,{scope:r,orientation:n,dir:h,loop:o,currentTabStopId:y,onItemFocus:ee(J=>w(J),[w]),onItemShiftTab:ee(()=>x(!0),[]),onFocusableItemAdd:ee(()=>X(J=>J+1),[]),onFocusableItemRemove:ee(()=>X(J=>J-1),[])},V(ei.div,me({tabIndex:v||Z===0?-1:0,"data-orientation":n},u,{ref:m,style:{outline:"none",...t.style},onMouseDown:Wt(t.onMouseDown,()=>{j.current=!0}),onFocus:Wt(t.onFocus,J=>{let G=!j.current;if(J.target===J.currentTarget&&G&&!v){let $=new CustomEvent(TE,Lse);if(J.currentTarget.dispatchEvent($),!$.defaultPrevented){let te=k().filter(F=>F.focusable),C=te.find(F=>F.active),T=te.find(F=>F.id===y),U=[C,T,...te].filter(Boolean).map(F=>F.ref.current);pB(U)}}j.current=!1}),onBlur:Wt(t.onBlur,()=>x(!1))})))}),Hse="RovingFocusGroupItem",Kse=Q((t,e)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:o=!1,tabStopId:i,...s}=t,l=Dg(),c=i||l,f=zse(Hse,r),u=f.currentTabStopId===c,d=fB(r),{onFocusableItemAdd:m,onFocusableItemRemove:h}=f;return K(()=>{if(n)return m(),()=>h()},[n,m,h]),V(CE.ItemSlot,{scope:r,id:c,focusable:n,active:o},V(ei.span,me({tabIndex:u?0:-1,"data-orientation":f.orientation},s,{ref:e,onMouseDown:Wt(t.onMouseDown,y=>{n?f.onItemFocus(c):y.preventDefault()}),onFocus:Wt(t.onFocus,()=>f.onItemFocus(c)),onKeyDown:Wt(t.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){f.onItemShiftTab();return}if(y.target!==y.currentTarget)return;let w=Zse(y,f.orientation,f.dir);if(w!==void 0){y.preventDefault();let x=d().filter(S=>S.focusable).map(S=>S.ref.current);if(w==="last")x.reverse();else if(w==="prev"||w==="next"){w==="prev"&&x.reverse();let S=x.indexOf(y.currentTarget);x=f.loop?Jse(x,S+1):x.slice(S+1)}setTimeout(()=>pB(x))}})})))}),Vse={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Gse(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Zse(t,e,r){let n=Gse(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return Vse[n]}function pB(t){let e=document.activeElement;for(let r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function Jse(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var dB=Use,mB=Kse;a();_();_();function Yse(t,e){return ln((r,n)=>{let o=e[r][n];return o??r},t)}var RE=t=>{let{present:e,children:r}=t,n=Xse(e),o=typeof r=="function"?r({present:n.isPresent}):tt.only(r),i=gs(n.ref,o.ref);return typeof r=="function"||n.isPresent?br(o,{ref:i}):null};RE.displayName="Presence";function Xse(t){let[e,r]=q(),n=M({}),o=M(t),i=M("none"),s=t?"mounted":"unmounted",[l,c]=Yse(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return K(()=>{let f=$g(n.current);i.current=l==="mounted"?f:"none"},[l]),Zu(()=>{let f=n.current,u=o.current;if(u!==t){let m=i.current,h=$g(f);t?c("MOUNT"):h==="none"||f?.display==="none"?c("UNMOUNT"):c(u&&m!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,c]),Zu(()=>{if(e){let f=d=>{let h=$g(n.current).includes(d.animationName);d.target===e&&h&&cn(()=>c("ANIMATION_END"))},u=d=>{d.target===e&&(i.current=$g(n.current))};return e.addEventListener("animationstart",u),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{e.removeEventListener("animationstart",u),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:ee(f=>{f&&(n.current=getComputedStyle(f)),r(f)},[])}}function $g(t){return t?.animationName||"none"}var hB="Tabs",[Qse,OZe]=Va(hB,[AE]),gB=AE(),[eae,NE]=Qse(hB),tae=Q((t,e)=>{let{__scopeTabs:r,value:n,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:l,activationMode:c="automatic",...f}=t,u=Fg(l),[d,m]=Pg({prop:n,onChange:o,defaultProp:i});return V(eae,{scope:r,baseId:Dg(),value:d,onValueChange:m,orientation:s,dir:u,activationMode:c},V(ei.div,me({dir:u,"data-orientation":s},f,{ref:e})))}),rae="TabsList",nae=Q((t,e)=>{let{__scopeTabs:r,loop:n=!0,...o}=t,i=NE(rae,r),s=gB(r);return V(dB,me({asChild:!0},s,{orientation:i.orientation,dir:i.dir,loop:n}),V(ei.div,me({role:"tablist","aria-orientation":i.orientation},o,{ref:e})))}),oae="TabsTrigger",iae=Q((t,e)=>{let{__scopeTabs:r,value:n,disabled:o=!1,...i}=t,s=NE(oae,r),l=gB(r),c=yB(s.baseId,n),f=bB(s.baseId,n),u=n===s.value;return V(mB,me({asChild:!0},l,{focusable:!o,active:u}),V(ei.button,me({type:"button",role:"tab","aria-selected":u,"aria-controls":f,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c},i,{ref:e,onMouseDown:Wt(t.onMouseDown,d=>{!o&&d.button===0&&d.ctrlKey===!1?s.onValueChange(n):d.preventDefault()}),onKeyDown:Wt(t.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&s.onValueChange(n)}),onFocus:Wt(t.onFocus,()=>{let d=s.activationMode!=="manual";!u&&!o&&d&&s.onValueChange(n)})})))}),sae="TabsContent",aae=Q((t,e)=>{let{__scopeTabs:r,value:n,forceMount:o,children:i,...s}=t,l=NE(sae,r),c=yB(l.baseId,n),f=bB(l.baseId,n),u=n===l.value,d=M(u);return K(()=>{let m=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(m)},[]),V(RE,{present:o||u},({present:m})=>V(ei.div,me({"data-state":u?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:f,tabIndex:0},s,{ref:e,style:{...t.style,animationDuration:d.current?"0s":void 0}}),m&&i))});function yB(t,e){return`${t}-trigger-${e}`}function bB(t,e){return`${t}-content-${e}`}var vB=tae,DE=nae,PE=iae,FE=aae;_();var wB=vB,$E=Q(({className:t,...e},r)=>g(DE,{ref:r,className:oe("inline-flex items-center justify-center rounded-md bg-secondary p-1",t),...e}));$E.displayName=DE.displayName;var ti=Q(({className:t,...e},r)=>g(PE,{className:oe("obzt-btn-reset","inline-flex min-w-[100px] items-center justify-center rounded-[0.185rem] px-3 py-1.5 text-sm font-medium text-txt-muted transition-all disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-primary data-[state=active]:text-txt-normal data-[state=active]:shadow-sm",t),...e,ref:r}));ti.displayName=PE.displayName;var ri=Q(({className:t,...e},r)=>g(FE,{className:oe("mt-2 rounded-md border p-6",t),...e,ref:r}));ri.displayName=FE.displayName;a();_();a();_();function Za(){return Za=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Za.apply(this,arguments)}var DZe=typeof Symbol<"u"?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator",PZe=typeof Symbol<"u"?Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")):"@@asyncIterator";var cae=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Lt:K,uae=function(e){var r=M(e);return cae(function(){r.current=e}),ee(function(){return r.current},[r])},fae={status:"not-requested",loading:!1,result:void 0,error:void 0},EB={status:"loading",loading:!0,result:void 0,error:void 0},pae=function(e){return EB},dae=function(e,r){return{status:"success",loading:!1,result:e,error:void 0}},mae=function(e,r){return{status:"error",loading:!1,result:void 0,error:e}},xB=function(){},hae={initialState:function(e){return e&&e.executeOnMount?EB:fae},executeOnMount:!0,executeOnUpdate:!0,setLoading:pae,setResult:dae,setError:mae,onSuccess:xB,onError:xB},gae=function(e){return Za({},hae,{},e)},yae=function(e){var r=q(function(){return e.initialState(e)}),n=r[0],o=r[1],i=ee(function(){return o(e.initialState(e))},[o,e]),s=ee(function(){return o(e.setLoading(n))},[n,o]),l=ee(function(u){return o(e.setResult(u,n))},[n,o]),c=ee(function(u){return o(e.setError(u,n))},[n,o]),f=ee(function(u){return o(Za({},n,{},u))},[n,o]);return{value:n,set:o,merge:f,reset:i,setLoading:s,setResult:l,setError:c}},bae=function(){var e=M(!1);return K(function(){return e.current=!0,function(){e.current=!1}},[]),function(){return e.current}},vae=function(){var e=M(null);return{set:function(n){return e.current=n},get:function(){return e.current},is:function(n){return e.current===n}}},SB=function(e,r,n){!r&&(r=[]);var o=gae(n),i=q(null),s=i[0],l=i[1],c=yae(o),f=bae(),u=vae(),d=function(x){return f()&&u.is(x)},m=function(){for(var x=arguments.length,S=new Array(x),k=0;k<x;k++)S[k]=arguments[k];var j=function(){try{return Promise.resolve(e.apply(void 0,S))}catch(Z){return Promise.reject(Z)}}();return l(S),u.set(j),c.setLoading(),j.then(function(Z){d(j)&&c.setResult(Z),o.onSuccess(Z,{isCurrent:function(){return u.is(j)}})},function(Z){d(j)&&c.setError(Z),o.onError(Z,{isCurrent:function(){return u.is(j)}})}),j},h=uae(m),y=ee(function(){return h().apply(void 0,arguments)},[h]),w=!f();return K(function(){var v=function(){return h().apply(void 0,r)};w&&o.executeOnMount&&v(),!w&&o.executeOnUpdate&&v()},r),Za({},c.value,{set:c.set,merge:c.merge,reset:c.reset,execute:y,currentPromise:u.get(),currentParams:s})};function IB(t,e,r){return SB(t,e,r)}var _B=function(e,r){return SB(e,[],Za({},r,{executeOnMount:!1,executeOnUpdate:!1}))};a();var OB=require("obsidian");var Mg=class{constructor(e){this.path=e??Mg.defaultPath}vaildPath;get path(){return this.vaildPath}set path(e){e?this.vaildPath=(0,OB.normalizePath)(e):this.vaildPath=Mg.defaultPath}getFile(e){return e.getAbstractFileByPath(this.vaildPath)}fromJSON(e){return e&&(this.vaildPath=e),this}toJSON(){return this.path}toString(){return this.path}},Yu=Mg;aS(Yu,"defaultPath","/");var At=Ke({});function Ja(t){return new Yu(t).path}function Lg(t,e,r){let[n,o]=q(!1);return[IB(t,[...e,n],r),ee(()=>o(i=>!i),[])]}a();a();var TB=require("obsidian");_();a();_();var Ee=Q(function({name:e,description:r,heading:n,children:o,className:i},s){return g("div",{className:oe("setting-item",n&&"setting-item-heading border-none",i),children:[g("div",{className:"setting-item-info",children:[g("div",{className:"setting-item-name",children:e}),r&&g("div",{className:"setting-item-description",children:r})]}),g("div",{className:"setting-item-control",ref:s,children:o})]})});function wae(t){let e=M(t);return e.current=t,ae(()=>ol(()=>e.current()),[])}function ze(t,e){let r=re(At).settings,n=wae(()=>t(r.current))(),o=Qt(function(s){r.update(l=>e(s,l))});return[n,o]}function ME(t,e){let r=Qt(e),n=M(null);return K(()=>{n.current?.setValue(t)},[t]),ee(o=>{if(!o)n.current?.toggleEl.remove(),n.current=null;else{let i=new TB.ToggleComponent(o);i.setValue(t),i.onChange(r),n.current=i}},[])}function Gr({name:t,children:e,get:r,set:n}){let o=ME(...ze(r,n));return g(LE,{ref:o,name:t,children:e})}var LE=Q(function({name:e,children:r},n){return g(Ee,{className:"mod-toggle",ref:n,name:e,description:r})});a();a();var AB=Y(require("node:net"),1),RB=Y(require("node:os"),1),qg=class extends Error{constructor(e){super(`${e} is locked`)}},Ya={old:new Set,young:new Set},xae=1e3*15;var jg,Eae=()=>{let t=RB.default.networkInterfaces(),e=new Set([void 0,"0.0.0.0"]);for(let r of Object.values(t))for(let n of r)e.add(n.address);return e},CB=t=>new Promise((e,r)=>{let n=AB.default.createServer();n.unref(),n.on("error",r),n.listen(t,()=>{let{port:o}=n.address();n.close(()=>{e(o)})})}),kB=async(t,e)=>{if(t.host||t.port===0)return CB(t);for(let r of e)try{await CB({port:t.port,host:r})}catch(n){if(!["EADDRNOTAVAIL","EINVAL"].includes(n.code))throw n}return t.port},Sae=function*(t){t&&(yield*t),yield 0};async function jE(t){let e,r=new Set;if(t&&(t.port&&(e=typeof t.port=="number"?[t.port]:t.port),t.exclude)){let o=t.exclude;if(typeof o[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(let i of o){if(typeof i!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(i))throw new TypeError(`Number ${i} in the exclude option is not a safe integer and can't be used`)}r=new Set(o)}jg===void 0&&(jg=setInterval(()=>{Ya.old=Ya.young,Ya.young=new Set},xae),jg.unref&&jg.unref());let n=Eae();for(let o of Sae(e))try{if(r.has(o))continue;let i=await kB({...t,port:o},n);for(;Ya.old.has(i)||Ya.young.has(i);){if(o!==0)throw new qg(o);i=await kB({...t,port:o},n)}return Ya.young.add(i),i}catch(i){if(!["EADDRINUSE","EACCES"].includes(i.code)&&!(i instanceof qg))throw i}throw new Error("No available ports found")}var qE=require("obsidian");_();function NB(){let[t,e]=ze(n=>n.enableServer,(n,o)=>({...o,enableServer:n})),r=ME(t,e);return g(L,{children:[g(Ee,{heading:!0,name:"Background connect",description:"Allow Zotero to send status in the background, which is required for some features like focus annotation on selection in Zotero"}),g(LE,{ref:r,name:"Enable",children:"Remember to enable the server in Zotero as well"}),t&&g(Iae,{})]})}function Iae(){let[t,e]=ze(l=>l.serverPort,(l,c)=>({...c,serverPort:l})),[r]=ze(l=>l.serverHostname,(l,c)=>({...c,serverHostname:l})),[n,o]=q(t),[i]=jt("check");async function s(){if(isNaN(n)||n<0||n>65535)return new qE.Notice("Invalid port number: "+n),o(t),!1;if(n===t)return!1;let l=await jE({host:r,port:[n]});return l!==n?(new qE.Notice(`Port is currently occupied, a different port is provided: ${l}, confirm again to apply the change.`),o(l),!1):(e(l),!0)}return g(Ee,{name:"Port number",description:`Default to ${t}`,children:[g("input",{type:"number",value:n,min:0,max:65535,onChange:l=>o(Number.parseInt(l.target.value,10))}),g("button",{"aria-label":"Apply",ref:i,onClick:s})]})}a();var DB=require("@electron/remote"),PB=require("obsidian");_();a();function BE({children:t,path:e,state:r}){return g("div",{children:[t,": ",r==="failed"&&"(Failed to load)",g(zE,{path:e,state:r})]})}function zE({path:t,state:e}){return g("code",{"data-state":e,className:oe("data-[state=success]:text-txt-success","data-[state=failed]:text-txt-error","data-[state=disabled]:text-txt-muted"),children:t})}a();_();function UE(t){let{database:e}=re(At),[r,n]=Lg(()=>e.api.getLoadStatus(),[t]),o;return r.loading?o="disabled":r.error?o="failed":o=t==="zotero"?r.result?.main?"success":"failed":r.result?.bbt?"success":"failed",[o,n,r.result]}function WE(){let{settings:t}=re(At),e=Oae("main"),[r,n,o]=UE("bbt"),i=o?.bbtVersion==="v1"?`${t.zoteroDbPath} (native citationKey field)`:t.bbtMainDbPath,[s,l]=UE("zotero"),[c,f,u]=_ae(()=>{l(),n()});return g(Ee,{name:"Zotero data directory",description:g(L,{children:[g(BE,{path:e,state:s,children:"Zotero"}),g(BE,{path:i,state:r,children:"Better BibTeX"})]}),children:[g(zE,{path:c,state:f}),g("button",{onClick:u,children:"Select"})]})}function _ae(t){let[e,r]=ze(s=>s.zoteroDataDir,(s,l)=>({...l,zoteroDataDir:s})),{app:n}=re(At),o=_B(async()=>{try{let{filePaths:[s]}=await DB.dialog.showOpenDialog({defaultPath:e,properties:["openDirectory"]});s&&e!==s&&(r(s),await new Promise((l,c)=>{function f(){l(),n.vault.off("zotero:db-refresh",f)}n.vault.on("zotero:db-refresh",f),setTimeout(()=>{c(new DOMException("Timeout after 5s","TimeoutError")),n.vault.off("zotero:db-refresh",f)},5e3)}),t())}catch(s){throw console.error("Failed to set data directory",s),new PB.Notice(`Failed to set data directory: ${s}`),s}}),i;return o.loading?i="disabled":o.error?i="failed":i="success",[e,i,o.execute]}function Oae(t){let e=re(At).settings;return t==="main"?e.zoteroDbPath:e.bbtMainDbPath}function HE(){return g(L,{children:[g(WE,{}),g(Gr,{name:"Refresh automatically when Zotero updates database",get:t=>t.autoRefresh,set:(t,e)=>({...e,autoRefresh:t})}),g(NB,{})]})}a();a();_();function ys({name:t,children:e,normalize:r,get:n,set:o}){let[i,s]=ze(n,o),[l,c]=q(i);return g(KE,{name:t,value:l,onChange:f=>c(f.target.value),onSubmit:()=>{let f=r?.(l)??l;f!==l&&c(f),s(f)},children:e})}function KE({name:t,children:e,value:r,onChange:n,onSubmit:o}){let[i]=jt("check");return g(Ee,{name:t,description:e,children:[g(wu,{className:"border",value:r,onChange:n}),g("button",{"aria-label":"Apply",ref:i,onClick:o})]})}a();function FB(){let[t,e]=ze(r=>r.imgExcerptImport===!1?"false":r.imgExcerptImport,(r,n)=>({...n,imgExcerptImport:r==="false"?!1:r}));return g(L,{children:[g(Ee,{heading:!0,name:"Image excerpt",description:"Controls how to import images in annotaion excerpts."}),g(Ee,{name:"Mode",description:g("dl",{className:"mt-2 grid grid-cols-3 gap-1",children:[g("div",{children:[g("dt",{className:"text-xs font-medium text-txt-normal",children:"Direct link"}),g("dd",{className:"mt-1",children:["Use image embed linked directly to the original image in Zotero cache using ",g("code",{children:"file://"})," url"]})]}),g("div",{children:[g("dt",{className:"text-xs font-medium text-txt-normal",children:"Symlink"}),g("dd",{className:"mt-1",children:["Create a symlink to the original image in Zotero cache within the specified folder",g("p",{className:"text-txt-error",children:"Don't use this option if your file system doesn't support symlink."})]})]}),g("div",{children:[g("dt",{className:"text-xs font-medium text-txt-normal",children:"Copy"}),g("dd",{className:"mt-1",children:"Copy the original image to the specified folder."})]})]}),children:g("select",{className:"dropdown",onChange:r=>e(r.target.value),value:t,children:[g("option",{value:"false",children:"direct link"},0),g("option",{value:"symlink",children:"symlink"},1),g("option",{value:"copy",children:"copy"},2)]})}),t!=="false"&&g(L,{children:g(ys,{name:"Default location",get:r=>r.imgExcerptPath,set:(r,n)=>({...n,imgExcerptPath:r}),normalize:Ja,children:"The folder to store image excerpts."})})]})}a();_();function VE(){let{database:t}=re(At),[e,r]=ze(l=>l.citationLibrary,(l,c)=>({...c,citationLibrary:l})),[n,o]=Lg(()=>t.api.getLibs(),[]),i=n.result??[{groupID:null,libraryID:1,name:"My Library"}],[s]=jt("switch");return g(Ee,{name:"Citation library",children:[g("select",{className:"dropdown",onChange:l=>r(Number.parseInt(l.target.value,10)),value:e,children:i.map(({groupID:l,libraryID:c,name:f})=>g("option",{value:c,children:f?l?`${f} (Group)`:f:`Library ${c}`},c))}),g("button",{"aria-label":"Refresh",ref:s,onClick:async()=>{await t.refresh({task:"full"}),o()}})]})}function GE(){return g(L,{children:[g(ys,{name:"Default location for new literature notes",get:t=>t.literatureNoteFolder,set:(t,e)=>({...e,literatureNoteFolder:t}),normalize:Ja}),g(VE,{}),g(FB,{})]})}a();a();function ZE(){let[t,e]=ze(r=>r.logLevel,(r,n)=>({...n,logLevel:r}));return g(L,{children:[g(Ee,{heading:!0,name:"Debug"}),g(Ee,{name:"Log Level",description:g(L,{children:["Change level of logs output to the console.",g("br",{}),"Set to DEBUG if you need to report a issue",g("br",{}),"To check console, ",fD()]}),children:g("select",{className:"dropdown",onChange:r=>{let n=r.target.value;e(n)},value:t,children:Object.entries(AS).map(([r,n])=>g("option",{value:n,children:r},n))})})]})}function JE(){return g(L,{children:g(ZE,{})})}a();var $B=require("obsidian");var Xu=class extends $B.PluginSettingTab{#e(){let e=this.containerEl.parentElement;if(!e)throw new Error("Setting tab is not mounted");if(!e.classList.contains("vertical-tab-content-container"))return W.error("Failed to patch unload, unexpected tabContentContainer"),console.error(e),!1;let r=this,n=sr(e,{empty:o=>function(){r.unload(),o.call(this),n()}});return W.debug("Setting tab unload patched"),!0}#t=[];register(e){this.#t.push(e)}unload(){for(;this.#t.length>0;)this.#t.pop()()}display(){this.containerEl.empty(),this.#e()}};a();function YE(){return g(L,{children:[g(Gr,{name:"Citation editor suggester",get:t=>t.citationEditorSuggester,set:(t,e)=>({...e,citationEditorSuggester:t})}),g(Gr,{name:"Show BibTex citekey in suggester",get:t=>t.showCitekeyInSuggester,set:(t,e)=>({...e,showCitekeyInSuggester:t})})]})}a();a();_();function XE(){let[t,e]=ze(f=>f.autoTrim[0],(f,u)=>({...u,autoTrim:[f,u.autoTrim[1]]})),[r,n]=ze(f=>f.autoTrim[1],(f,u)=>({...u,autoTrim:[u.autoTrim[0],f]})),[o,i]=q(t),[s,l]=q(r),c=Qt(async function(u,d){let m=u==="false"?!1:u;d===0?(i(m),e(m)):(l(m),n(m))});return g(Ee,{name:"Auto trim",description:g(L,{children:[g("p",{className:"text-sm",children:["Controls default whitespace/new line trimming before/after a ejs"," ",g("code",{className:"whitespace-nowrap",children:"<% Tag %>"})]}),g("dl",{className:"mt-2",children:g("div",{className:"grid grid-cols-2 gap-1",children:[g("div",{children:[g("dt",{className:"text-xs font-medium text-txt-normal",children:"Newline slurp"}),g("dd",{className:"mt-1",children:"Removes the following newline before and after the tag."})]}),g("div",{children:[g("dt",{className:"text-xs font-medium text-txt-normal",children:"Whitespace slurp:"}),g("dd",{className:"mt-1",children:"Removes all whitespace before and after the tag."})]})]})})]}),children:g("div",{className:"flex flex-col gap-2",children:[0,1].map(f=>g("div",{className:"flex flex-col items-start gap-1 text-sm",children:[g("span",{children:f===0?"Leading":"Ending"}),g("select",{className:"dropdown",onChange:u=>c(u.target.value,f),value:String(f===0?o:s),children:[g("option",{value:"false",children:"Disable"},0),g("option",{value:"nl",children:"Newline slurp (-)"},1),g("option",{value:"slurp",children:"Whitespace slurp (_)"},2)]})]},f))})})}a();var oi=require("obsidian");_();a();var MB=require("obsidian");_();function QE(t,{icon:e,desc:r,disable:n}){let o=Qt(t),i=M(null);return K(()=>{i.current?.setIcon(e??"")},[e]),K(()=>{i.current?.setTooltip(r??"")},[r]),K(()=>{i.current?.setDisabled(n??!1)},[n]),ee(s=>{if(!s)i.current?.extraSettingsEl.remove(),i.current=null;else{let l=new MB.ExtraButtonComponent(s);l.onClick(o),i.current=l}},[])}a();var ni={filename:{title:"Note filename",desc:"Used to render filename for each imported literature note"},cite:{title:"Primary Markdown citation",desc:"Used to render citation in literature note"},cite2:{title:"Secondary Markdown citation",desc:"Used to render alternative citation in literature note"},field:{title:"Note properties",desc:"Used to render Properties in literature note"},note:{title:"Note content",desc:"Used to render created literature note"},annotation:{title:"Single annotaion",desc:"Used to render single annotation"},annots:{title:"Annotations",desc:"Used to render annotation list when batch importing"},colored:{title:"Colored highlight",desc:"Used to render highlights with color in imported Zotero note"}};function LB({type:t}){let{app:e,settings:r}=re(At),[n]=jt("arrow-up-right"),[o]=jt("folder-input"),[i]=jt("reset"),[s,l]=q(()=>eS(t,{app:e,folder:r.templateDir})),c=gi(t,r.templateDir);return K(()=>{let f=[e.vault.on("delete",u=>{u.path===c&&l(!1)}),e.vault.on("create",u=>{u.path===c&&l(!0)}),e.vault.on("rename",(u,d)=>{u.path===c&&l(!0),d===c&&l(!1)})];return()=>f.forEach(u=>e.vault.offref(u))},[c]),s?g(Ee,{name:ni[t].title,description:ni[t].desc,children:[g("code",{children:c}),g("button",{"aria-label":"Open template file",ref:n,onClick:async()=>{await ds(t,null,{app:e,settings:r})}}),g("button",{"aria-label":"Reset to default",ref:i,onClick:async()=>{if(!activeWindow.confirm("Reset template to default?"))return;let f=e.vault.getAbstractFileByPath(c);f instanceof oi.TFile?(await e.vault.modify(f,ht.Ejectable[t]),new oi.Notice(`Template '${c}' reset`)):l(!0)}})]}):g(Ee,{name:ni[t].title,description:ni[t].desc,children:[g("pre",{className:"text-left max-w-xs overflow-scroll rounded border p-4",children:ht.Ejectable[t]}),g("button",{"aria-label":"Save to template folder",ref:o,onClick:async()=>{let f=await jB(t,{app:e,folder:r.templateDir});l(f)}})]})}async function jB(t,{app:e,folder:r}){let n=gi(t,r),o=e.vault.getAbstractFileByPath(n);return o instanceof oi.TFile?!0:o?(new oi.Notice(`The path '${n}' is occupied by a folder`),!1):(await e.fileManager.createNewMarkdownFile(e.vault.getRoot(),n,ht.Ejectable[t]),new oi.Notice(`Template '${n}' created`),!0)}function eS(t,{app:e,folder:r}){let n=gi(t,r);return e.vault.getAbstractFileByPath(n)instanceof oi.TFile}function qB(){let{app:t,settings:e}=re(At),[r,n]=q(()=>tn.Ejectable.every(i=>eS(i,{app:t,folder:e.templateDir}))),o=QE(async()=>{let i=tn.Ejectable.filter(s=>!eS(s,{app:t,folder:e.templateDir}));await Promise.all(i.map(s=>jB(s,{app:t,folder:e.templateDir}))),n(!0)},{icon:r?"":"folder-input",desc:r?"":"Save template files to template folder",disable:r});return[r,o]}a();_();function BB({type:t}){let[e,r]=ze(i=>i.template.templates[t],(i,s)=>({...s,template:{...s.template,templates:{...s.template.templates,[t]:i}}})),[n,o]=q(e);return g(KE,{name:ni[t].title,value:n,onChange:i=>o(i.target.value),onSubmit:()=>{r(n)},children:ni[t].desc})}function tS(){let[t,e]=qB();return g(L,{children:[g(ys,{name:"Template location",get:r=>r.template.folder,set:(r,n)=>({...n,template:{...n.template,folder:r}}),normalize:Ja,children:"The folder which templates are ejected into and stored"}),g(Gr,{name:"Auto pair for Eta",get:r=>r.autoPairEta,set:(r,n)=>({...n,autoPairEta:r}),children:["Pair `<` and `%` automatically in eta templates.",g("br",{}),"If you have issue with native auto pair features, you can disable this option and report the bug in GitHub"]}),g(XE,{}),g(Ee,{heading:!0,name:"Simple"}),tn.Embeded.map(r=>g(BB,{type:r},r)),g(Ee,{heading:!0,name:"Ejectable",ref:e,description:"These templates can be customized once saved to the template folder",children:t||g("div",{children:"Eject"})}),tn.Ejectable.map(r=>g(LB,{type:r},r))]})}a();function rS(){return g(L,{children:[g(Ee,{heading:!0,name:"Update note",description:g(L,{children:["You can find update note option in ",g("code",{children:"More Options"})," menu and command pallette inside a literature note. When update, all literature notes with the same ",g("code",{children:"zotero-key"})," will be updated."]})}),g(Gr,{name:"Overwrite existing note",get:t=>t.updateOverwrite,set:(t,e)=>({...e,updateOverwrite:t}),children:g("div",{className:"space-y-2",children:g("div",{className:"text-txt-error",children:"\u26A0 WARNING: This will overwrite the whole note content with latest one when update literature note, make sure you didn't add any custom content in the note before enable this option."})})}),g(Gr,{name:"In-place update of existing annotations",get:t=>t.updateAnnotBlock,set:(t,e)=>({...e,updateAnnotBlock:t}),children:g("div",{className:"space-y-2",children:[g("div",{children:"(Experimental)"}),g("div",{className:"text-txt-error",children:"\u26A0 WARNING: When enable, the plugin will try to update existing annotaion callouts marked with block-id in addition to appped newly-added ones, which may cause unexpected behavior. Make sure you have backup of your notes before enable this option."}),g("div",{className:"text-txt-accent",children:"\u24D8 Note: If you disable callout warpping in annotation template, you need to make sure the block-id is added properly in the template."}),g("div",{className:"text-txt-accent",children:"\u24D8 Note: This won't work on annotations imported before this feature is available, unless every annotation is inside a block with proper block-id"})]})})]})}var Qu=class extends Xu{constructor(r){super(r.app,r);this.plugin=r;this.containerEl.addClass("obzt")}display(){super.display(),P.render(g(At.Provider,{value:{settings:this.plugin.settings,app:this.app,database:this.plugin.dbWorker,closeTab:()=>this.setting.close()},children:g(Tae,{})}),this.containerEl),this.register(()=>P.unmountComponentAtNode(this.containerEl))}};function Tae(){let[t,e]=av("obzt-setting-tab",{defaultValue:"general"});return g(wB,{value:t,onValueChange:e,className:"flex h-full flex-col",children:[g($E,{className:"self-start max-w-full",children:[g(ti,{value:"general",children:"General"}),g(ti,{value:"connect",children:"Connect"}),g(ti,{value:"suggester",children:"Suggester"}),g(ti,{value:"template",children:"Template"}),g(ti,{value:"update",children:"Note update"}),g(ti,{value:"misc",children:"Misc"})]}),g(ri,{value:"general",className:"divide-y flex-grow overflow-y-scroll",children:g(GE,{})}),g(ri,{value:"connect",className:"divide-y flex-grow overflow-y-scroll",children:g(HE,{})}),g(ri,{value:"suggester",className:"divide-y flex-grow overflow-y-scroll",children:g(YE,{})}),g(ri,{value:"template",className:"divide-y flex-grow overflow-y-scroll",children:g(tS,{})}),g(ri,{value:"update",className:"divide-y flex-grow overflow-y-scroll",children:g(rS,{})}),g(ri,{value:"misc",className:"divide-y flex-grow overflow-y-scroll",children:g(JE,{})})]})}process.env.SQLITE_USE_URI="1";var Se=class extends zB.Plugin{use=ws.plugin(this);constructor(e,r){if(super(e,r),!wN(r,e))throw new Error("Library check failed")}settings=VT(this);services={_log:this.use(Vl)};noteIndex=this.use(Wa);server=this.use(Cn);citekeyClick=this.use(Ig);templateEditor=this.use(Ta);noteFeatures=this.use(Hq);noteParser=this.use(Cg);get databaseAPI(){return this.dbWorker.api}dbWorker=this.use(Zt);imgCacheImporter=this.use(Qo);dbWatcher=this.use(io);database=this.use(Gu);templateRenderer=this.use(Ko);pdfParser=this.use(Vu);onload(){W.info("loading ZotLit"),this.addSettingTab(new Qu(this)),globalThis.zoteroAPI={version:this.manifest.version,getDocItems:e=>this.databaseAPI.getItems(e),getItemIDsFromCitekey:(...e)=>this.databaseAPI.getItemIDsFromCitekey(...e),getAnnotsFromKeys:(...e)=>this.databaseAPI.getAnnotFromKey(...e),getAnnotsOfAtch:(...e)=>this.databaseAPI.getAnnotations(...e),getAttachments:(...e)=>this.databaseAPI.getAttachments(...e),getLibs:()=>this.databaseAPI.getLibs()},this.register(()=>{delete globalThis.zoteroAPI})}onunload(){W.info("unloading ZotLit")}};0&&(module.exports={});
|
|
/*! Bundled license information:
|
|
|
|
flatted/cjs/index.js:
|
|
(*! (c) 2020 Andrea Giammarchi *)
|
|
|
|
use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js:
|
|
(**
|
|
* @license React
|
|
* use-sync-external-store-shim.production.min.js
|
|
*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*)
|
|
|
|
use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js:
|
|
(**
|
|
* @license React
|
|
* use-sync-external-store-shim/with-selector.production.min.js
|
|
*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*)
|
|
|
|
lodash-es/lodash.js:
|
|
(**
|
|
* @license
|
|
* Lodash (Custom Build) <https://lodash.com/>
|
|
* Build: `lodash modularize exports="es" -o ./`
|
|
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
* Released under MIT license <https://lodash.com/license>
|
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
*)
|
|
|
|
@mui/base/index.js:
|
|
(**
|
|
* @mui/base v5.0.0-alpha.122
|
|
*
|
|
* @license MIT
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*)
|
|
*/
|
|
|
|
/* nosourcemap */ |