413 lines
795 KiB
JavaScript
413 lines
795 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 zB=Object.create;var hs=Object.defineProperty;var nS=Object.getOwnPropertyDescriptor;var UB=Object.getOwnPropertyNames;var WB=Object.getPrototypeOf,HB=Object.prototype.hasOwnProperty;var KB=(t,e,r)=>e in t?hs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Yu=(t,e)=>()=>(t&&(e=t(t=0)),e);var g=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),oS=(t,e)=>{for(var r in e)hs(t,r,{get:e[r],enumerable:!0})},iS=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of UB(e))!HB.call(t,o)&&o!==r&&hs(t,o,{get:()=>e[o],enumerable:!(n=nS(e,o))||n.enumerable});return t};var Z=(t,e,r)=>(r=t!=null?zB(WB(t)):{},iS(e||!t||!t.__esModule?hs(r,"default",{value:t,enumerable:!0}):r,t)),$g=t=>iS(hs({},"__esModule",{value:!0}),t),de=(t,e,r,n)=>{for(var o=n>1?void 0:n?nS(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&&hs(e,r,o),o};var sS=(t,e,r)=>(KB(t,typeof e!="symbol"?e+"":e,r),r);var RS=g((Rue,kS)=>{var vs=1e3,ws=vs*60,xs=ws*60,ni=xs*24,rz=ni*7,nz=ni*365.25;kS.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return oz(t);if(r==="number"&&isFinite(t))return e.long?sz(t):iz(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function oz(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*nz;case"weeks":case"week":case"w":return r*rz;case"days":case"day":case"d":return r*ni;case"hours":case"hour":case"hrs":case"hr":case"h":return r*xs;case"minutes":case"minute":case"mins":case"min":case"m":return r*ws;case"seconds":case"second":case"secs":case"sec":case"s":return r*vs;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function iz(t){var e=Math.abs(t);return e>=ni?Math.round(t/ni)+"d":e>=xs?Math.round(t/xs)+"h":e>=ws?Math.round(t/ws)+"m":e>=vs?Math.round(t/vs)+"s":t+"ms"}function sz(t){var e=Math.abs(t);return e>=ni?af(t,e,ni,"day"):e>=xs?af(t,e,xs,"hour"):e>=ws?af(t,e,ws,"minute"):e>=vs?af(t,e,vs,"second"):t+" ms"}function af(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var DS=g((Nue,NS)=>{function az(t){r.debug=r,r.default=r,r.coerce=l,r.disable=i,r.enable=o,r.enabled=s,r.humanize=RS(),r.destroy=u,Object.keys(t).forEach(c=>{r[c]=t[c]}),r.names=[],r.skips=[],r.formatters={};function e(c){let f=0;for(let p=0;p<c.length;p++)f=(f<<5)-f+c.charCodeAt(p),f|=0;return r.colors[Math.abs(f)%r.colors.length]}r.selectColor=e;function r(c){let f,p=null,d,h;function b(...y){if(!b.enabled)return;let v=b,x=Number(new Date),T=x-(f||x);v.diff=T,v.prev=f,v.curr=x,f=x,y[0]=r.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");let $=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(J,G)=>{if(J==="%%")return"%";$++;let K=r.formatters[G];if(typeof K=="function"){let F=y[$];J=K.call(v,F),y.splice($,1),$--}return J}),r.formatArgs.call(v,y),(v.log||r.log).apply(v,y)}return b.namespace=c,b.useColors=r.useColors(),b.color=r.selectColor(c),b.extend=n,b.destroy=r.destroy,Object.defineProperty(b,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(d!==r.namespaces&&(d=r.namespaces,h=r.enabled(c)),h),set:y=>{p=y}}),typeof r.init=="function"&&r.init(b),b}function n(c,f){let p=r(this.namespace+(typeof f>"u"?":":f)+c);return p.log=this.log,p}function o(c){r.save(c),r.namespaces=c,r.names=[],r.skips=[];let f,p=(typeof c=="string"?c:"").split(/[\s,]+/),d=p.length;for(f=0;f<d;f++)p[f]&&(c=p[f].replace(/\*/g,".*?"),c[0]==="-"?r.skips.push(new RegExp("^"+c.slice(1)+"$")):r.names.push(new RegExp("^"+c+"$")))}function i(){let c=[...r.names.map(a),...r.skips.map(a).map(f=>"-"+f)].join(",");return r.enable(""),c}function s(c){if(c[c.length-1]==="*")return!0;let f,p;for(f=0,p=r.skips.length;f<p;f++)if(r.skips[f].test(c))return!1;for(f=0,p=r.names.length;f<p;f++)if(r.names[f].test(c))return!0;return!1}function a(c){return c.toString().substring(2,c.toString().length-2).replace(/\.\*\?$/,"*")}function l(c){return c instanceof Error?c.stack||c.message:c}function u(){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}NS.exports=az});var Ze=g((Wt,lf)=>{Wt.formatArgs=cz;Wt.save=uz;Wt.load=fz;Wt.useColors=lz;Wt.storage=pz();Wt.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`."))}})();Wt.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 lz(){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 cz(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+lf.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)}Wt.log=console.debug||console.log||(()=>{});function uz(t){try{t?Wt.storage.setItem("debug",t):Wt.storage.removeItem("debug")}catch{}}function fz(){let t;try{t=Wt.storage.getItem("debug")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function pz(){try{return localStorage}catch{}}lf.exports=DS()(Wt);var{formatters:dz}=lf.exports;dz.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var PS=g((Due,FS)=>{"use strict";FS.exports=mz;function Es(t){return t instanceof Buffer?Buffer.from(t):new t.constructor(t.buffer.slice(),t.byteOffset,t.length)}function mz(t){if(t=t||{},t.circles)return hz(t);return t.proto?n:r;function e(o,i){for(var s=Object.keys(o),a=new Array(s.length),l=0;l<s.length;l++){var u=s[l],c=o[u];typeof c!="object"||c===null?a[u]=c:c instanceof Date?a[u]=new Date(c):ArrayBuffer.isView(c)?a[u]=Es(c):a[u]=i(c)}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 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 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(e(Array.from(a),r)):a instanceof Set?i[s]=new Set(e(Array.from(a),r)):ArrayBuffer.isView(a)?i[s]=Es(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 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 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(e(Array.from(a),n)):a instanceof Set?i[s]=new Set(e(Array.from(a),n)):ArrayBuffer.isView(a)?i[s]=Es(a):i[s]=n(a)}return i}}function hz(t){var e=[],r=[];return t.proto?i:o;function n(s,a){for(var l=Object.keys(s),u=new Array(l.length),c=0;c<l.length;c++){var f=l[c],p=s[f];if(typeof p!="object"||p===null)u[f]=p;else if(p instanceof Date)u[f]=new Date(p);else if(ArrayBuffer.isView(p))u[f]=Es(p);else{var d=e.indexOf(p);d!==-1?u[f]=r[d]:u[f]=a(p)}}return u}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={};e.push(s),r.push(a);for(var l in s)if(Object.hasOwnProperty.call(s,l)!==!1){var u=s[l];if(typeof u!="object"||u===null)a[l]=u;else if(u instanceof Date)a[l]=new Date(u);else if(u instanceof Map)a[l]=new Map(n(Array.from(u),o));else if(u instanceof Set)a[l]=new Set(n(Array.from(u),o));else if(ArrayBuffer.isView(u))a[l]=Es(u);else{var c=e.indexOf(u);c!==-1?a[l]=r[c]:a[l]=o(u)}}return e.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={};e.push(s),r.push(a);for(var l in s){var u=s[l];if(typeof u!="object"||u===null)a[l]=u;else if(u instanceof Date)a[l]=new Date(u);else if(u instanceof Map)a[l]=new Map(n(Array.from(u),i));else if(u instanceof Set)a[l]=new Set(n(Array.from(u),i));else if(ArrayBuffer.isView(u))a[l]=Es(u);else{var c=e.indexOf(u);c!==-1?a[l]=r[c]:a[l]=i(u)}}return e.pop(),r.pop(),a}}});var ii=g((Fue,jS)=>{var gz=require("util"),oi=Ze()("log4js:configuration"),cf=[],uf=[],MS=t=>!t,$S=t=>t&&typeof t=="object"&&!Array.isArray(t),yz=t=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(t),bz=t=>t&&typeof t=="number"&&Number.isInteger(t),vz=t=>{uf.push(t),oi(`Added listener, now ${uf.length} listeners`)},wz=t=>{cf.push(t),oi(`Added pre-processing listener, now ${cf.length} listeners`)},LS=(t,e,r)=>{(Array.isArray(e)?e:[e]).forEach(o=>{if(o)throw new Error(`Problem with log4js configuration: (${gz.inspect(t,{depth:5})}) - ${r}`)})},xz=t=>{oi("New configuration to be validated: ",t),LS(t,MS($S(t)),"must be an object."),oi(`Calling pre-processing listeners (${cf.length})`),cf.forEach(e=>e(t)),oi("Configuration pre-processing finished."),oi(`Calling configuration listeners (${uf.length})`),uf.forEach(e=>e(t)),oi("Configuration finished.")};jS.exports={configure:xz,addListener:vz,addPreProcessingListener:wz,throwExceptionIf:LS,anObject:$S,anInteger:bz,validIdentifier:yz,not:MS}});var ff=g((Pue,sr)=>{"use strict";function qS(t,e){for(var r=t.toString();r.length<e;)r="0"+r;return r}function si(t){return qS(t,2)}function Ez(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 BS(t,e){typeof t!="string"&&(e=t,t=sr.exports.ISO8601_FORMAT),e||(e=sr.exports.now());var r=si(e.getDate()),n=si(e.getMonth()+1),o=si(e.getFullYear()),i=si(o.substring(2,4)),s=t.indexOf("yyyy")>-1?o:i,a=si(e.getHours()),l=si(e.getMinutes()),u=si(e.getSeconds()),c=qS(e.getMilliseconds(),3),f=Ez(e.getTimezoneOffset()),p=t.replace(/dd/g,r).replace(/MM/g,n).replace(/y{1,4}/g,s).replace(/hh/g,a).replace(/mm/g,l).replace(/ss/g,u).replace(/SSS/g,c).replace(/O/g,f);return p}function lo(t,e,r,n){t["set"+(n?"":"UTC")+e](r)}function Sz(t,e,r){var n=t.indexOf("O")<0,o=!1,i=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(f,p){lo(f,"FullYear",p,n)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(f,p){lo(f,"Month",p-1,n),f.getMonth()!==p-1&&(o=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(f,p){o&&lo(f,"Month",f.getMonth()-1,n),lo(f,"Date",p,n)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(f,p){lo(f,"Hours",p,n)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(f,p){lo(f,"Minutes",p,n)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(f,p){lo(f,"Seconds",p,n)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(f,p){lo(f,"Milliseconds",p,n)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(f,p){p==="Z"?p=0:p=p.replace(":","");var d=Math.abs(p),h=(p>0?-1:1)*(d%100+Math.floor(d/100)*60);f.setUTCMinutes(f.getUTCMinutes()+h)}}],s=i.reduce(function(f,p){return p.pattern.test(f.regexp)?(p.index=f.regexp.match(p.pattern).index,f.regexp=f.regexp.replace(p.pattern,"("+p.regexp+")")):p.index=-1,f},{regexp:t,index:[]}),a=i.filter(function(f){return f.index>-1});a.sort(function(f,p){return f.index-p.index});var l=new RegExp(s.regexp),u=l.exec(e);if(u){var c=r||sr.exports.now();return a.forEach(function(f,p){f.fn(c,u[p+1])}),c}throw new Error("String '"+e+"' could not be parsed as '"+t+"'")}function Iz(t,e,r){if(!t)throw new Error("pattern must be supplied");return Sz(t,e,r)}function _z(){return new Date}sr.exports=BS;sr.exports.asString=BS;sr.exports.parse=Iz;sr.exports.now=_z;sr.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS";sr.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO";sr.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS";sr.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"});var Yg=g((Mue,QS)=>{var co=ff(),zS=require("os"),tl=require("util"),el=require("path"),US=require("url"),WS=Ze()("log4js:layouts"),HS={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 KS(t){return t?`\x1B[${HS[t][0]}m`:""}function VS(t){return t?`\x1B[${HS[t][1]}m`:""}function Oz(t,e){return KS(e)+t+VS(e)}function GS(t,e){return Oz(tl.format("[%s] [%s] %s - ",co.asString(t.startTime),t.level.toString(),t.categoryName),e)}function ZS(t){return GS(t)+tl.format(...t.data)}function pf(t){return GS(t,t.level.colour)+tl.format(...t.data)}function JS(t){return tl.format(...t.data)}function YS(t){return t.data[0]}function XS(t,e){let r="%r %p %c - %m%n",n=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflos%])(\{([^}]+)\})?|([^%]+)/;t=t||r;function o(O,_){let I=O.categoryName;if(_){let B=parseInt(_,10),D=I.split(".");B<D.length&&(I=D.slice(D.length-B).join("."))}return I}function i(O,_){let I=co.ISO8601_FORMAT;if(_)switch(I=_,I){case"ISO8601":case"ISO8601_FORMAT":I=co.ISO8601_FORMAT;break;case"ISO8601_WITH_TZ_OFFSET":case"ISO8601_WITH_TZ_OFFSET_FORMAT":I=co.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"),WS("[log4js-node-DEP0003]","DEPRECATION: Pattern %d{ABSOLUTE} is deprecated and replaced by %d{ABSOLUTETIME}.");case"ABSOLUTETIME":case"ABSOLUTETIME_FORMAT":I=co.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"),WS("[log4js-node-DEP0004]","DEPRECATION: Pattern %d{DATE} is deprecated and replaced by %d{DATETIME}.");case"DATETIME":case"DATETIME_FORMAT":I=co.DATETIME_FORMAT;break}return co.asString(I,O.startTime)}function s(){return zS.hostname().toString()}function a(O){return tl.format(...O.data)}function l(){return zS.EOL}function u(O){return O.level.toString()}function c(O){return co.asString("hh:mm:ss",O.startTime)}function f(O){return KS(O.level.colour)}function p(O){return VS(O.level.colour)}function d(){return"%"}function h(O){return O&&O.pid?O.pid.toString():process.pid.toString()}function b(){return h()}function y(O,_){return typeof e[_]<"u"?typeof e[_]=="function"?e[_](O):e[_]:null}function v(O,_){let I=O.context[_];return typeof I<"u"?typeof I=="function"?I(O):I:null}function x(O,_){let I=O.fileName||"";if(I=function(D){let oe="file://";return D.startsWith(oe)&&(typeof US.fileURLToPath=="function"?D=US.fileURLToPath(D):(D=el.normalize(D.replace(new RegExp(`^${oe}`),"")),process.platform==="win32"&&(D.startsWith("\\")?D=D.slice(1):D=el.sep+el.sep+D))),D}(I),_){let D=parseInt(_,10),oe=I.split(el.sep);oe.length>D&&(I=oe.slice(-D).join(el.sep))}return I}function T(O){return O.lineNumber?`${O.lineNumber}`:""}function $(O){return O.columnNumber?`${O.columnNumber}`:""}function V(O){return O.callStack||""}let J={c:o,d:i,h:s,m:a,n:l,p:u,r:c,"[":f,"]":p,y:b,z:h,"%":d,x:y,X:v,f:x,l:T,o:$,s:V};function G(O,_,I){return J[O](_,I)}function K(O,_){let I;return O?(I=parseInt(O.slice(1),10),I>0?_.slice(0,I):_.slice(I)):_}function F(O,_){let I;if(O)if(O.charAt(0)==="-")for(I=parseInt(O.slice(1),10);_.length<I;)_+=" ";else for(I=parseInt(O,10);_.length<I;)_=` ${_}`;return _}function Q(O,_,I){let B=O;return B=K(_,B),B=F(I,B),B}return function(O){let _="",I,B=t;for(;(I=n.exec(B))!==null;){let D=I[1],oe=I[2],se=I[3],be=I[5],ce=I[6];if(ce)_+=ce.toString();else{let E=G(se,O,be);_+=Q(E,oe,D)}B=B.slice(I.index+I[0].length)}return _}}var Jg={messagePassThrough(){return JS},basic(){return ZS},colored(){return pf},coloured(){return pf},pattern(t){return XS(t&&t.pattern,t&&t.tokens)},dummy(){return YS}};QS.exports={basicLayout:ZS,messagePassThroughLayout:JS,patternLayout:XS,colouredLayout:pf,coloredLayout:pf,dummyLayout:YS,addLayout(t,e){Jg[t]=e},layout(t,e){return Jg[t]&&Jg[t](e)}}});var ai=g(($ue,t1)=>{var Be=ii(),e1=["white","grey","black","blue","cyan","green","magenta","red","yellow"],ze=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 ze?e:(e instanceof Object&&e.levelStr&&(e=e.levelStr),ze[e.toString().toUpperCase()]||r):r}static addLevels(e){e&&(Object.keys(e).forEach(n=>{let o=n.toUpperCase();ze[o]=new ze(e[n].value,o,e[n].colour);let i=ze.levels.findIndex(s=>s.levelStr===o);i>-1?ze.levels[i]=ze[o]:ze.levels.push(ze[o])}),ze.levels.sort((n,o)=>n.level-o.level))}isLessThanOrEqualTo(e){return typeof e=="string"&&(e=ze.getLevel(e)),this.level<=e.level}isGreaterThanOrEqualTo(e){return typeof e=="string"&&(e=ze.getLevel(e)),this.level>=e.level}isEqualTo(e){return typeof e=="string"&&(e=ze.getLevel(e)),this.level===e.level}};ze.levels=[];ze.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"}});Be.addListener(t=>{let e=t.levels;e&&(Be.throwExceptionIf(t,Be.not(Be.anObject(e)),"levels must be an object"),Object.keys(e).forEach(n=>{Be.throwExceptionIf(t,Be.not(Be.validIdentifier(n)),`level name "${n}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),Be.throwExceptionIf(t,Be.not(Be.anObject(e[n])),`level "${n}" must be an object`),Be.throwExceptionIf(t,Be.not(e[n].value),`level "${n}" must have a 'value' property`),Be.throwExceptionIf(t,Be.not(Be.anInteger(e[n].value)),`level "${n}".value must have an integer value`),Be.throwExceptionIf(t,Be.not(e[n].colour),`level "${n}" must have a 'colour' property`),Be.throwExceptionIf(t,Be.not(e1.indexOf(e[n].colour)>-1),`level "${n}".colour must be one of ${e1.join(", ")}`)}))});Be.addListener(t=>{ze.addLevels(t.levels)});t1.exports=ze});var f1=g(nl=>{"use strict";var{parse:o1,stringify:i1}=JSON,{keys:Tz}=Object,rl=String,s1="string",r1={},df="object",a1=(t,e)=>e,Cz=t=>t instanceof rl?rl(t):t,Az=(t,e)=>typeof e===s1?new rl(e):e,l1=(t,e,r,n)=>{let o=[];for(let i=Tz(r),{length:s}=i,a=0;a<s;a++){let l=i[a],u=r[l];if(u instanceof rl){let c=t[u];typeof c===df&&!e.has(c)?(e.add(c),r[l]=r1,o.push({k:l,a:[t,e,c,n]})):r[l]=n.call(r,l,c)}else r[l]!==r1&&(r[l]=n.call(r,l,u))}for(let{length:i}=o,s=0;s<i;s++){let{k:a,a:l}=o[s];r[a]=n.call(r,a,l1.apply(null,l))}return r},n1=(t,e,r)=>{let n=rl(e.push(r)-1);return t.set(r,n),n},c1=(t,e)=>{let r=o1(t,Az).map(Cz),n=r[0],o=e||a1,i=typeof n===df&&n?l1(r,new Set,n,o):n;return o.call({"":i},"",i)};nl.parse=c1;var u1=(t,e,r)=>{let n=e&&typeof e===df?(c,f)=>c===""||-1<e.indexOf(c)?f:void 0:e||a1,o=new Map,i=[],s=[],a=+n1(o,i,n.call({"":t},"",t)),l=!a;for(;a<i.length;)l=!0,s[a]=i1(i[a++],u,r);return"["+s.join(",")+"]";function u(c,f){if(l)return l=!l,f;let p=n.call(this,c,f);switch(typeof p){case df:if(p===null)return p;case s1:return o.get(p)||n1(o,i,p)}return p}};nl.stringify=u1;var kz=t=>o1(u1(t));nl.toJSON=kz;var Rz=t=>c1(i1(t));nl.fromJSON=Rz});var Xg=g((jue,m1)=>{var p1=f1(),d1=ai(),Ss=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 p1.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=p1.parse(e,(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 Ss(n.categoryName,d1.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 Ss("log4js",d1.ERROR,["Unable to parse log:",e,"because: ",n])}return r}};m1.exports=Ss});var hf=g((que,y1)=>{var ar=Ze()("log4js:clustering"),Nz=Xg(),Dz=ii(),Is=!1,lr=null;try{lr=require("cluster")}catch{ar("cluster module not present"),Is=!0}var ey=[],il=!1,ol="NODE_APP_INSTANCE",h1=()=>il&&process.env[ol]==="0",Qg=()=>Is||lr&&lr.isMaster||h1(),g1=t=>{ey.forEach(e=>e(t))},mf=(t,e)=>{if(ar("cluster message received from worker ",t,": ",e),t.topic&&t.data&&(e=t,t=void 0),e&&e.topic&&e.topic==="log4js:message"){ar("received message: ",e.data);let r=Nz.deserialise(e.data);g1(r)}};Is||Dz.addListener(t=>{ey.length=0,{pm2:il,disableClustering:Is,pm2InstanceVar:ol="NODE_APP_INSTANCE"}=t,ar(`clustering disabled ? ${Is}`),ar(`cluster.isMaster ? ${lr&&lr.isMaster}`),ar(`pm2 enabled ? ${il}`),ar(`pm2InstanceVar = ${ol}`),ar(`process.env[${ol}] = ${process.env[ol]}`),il&&process.removeListener("message",mf),lr&&lr.removeListener&&lr.removeListener("message",mf),Is||t.disableClustering?ar("Not listening for cluster messages, because clustering disabled."):h1()?(ar("listening for PM2 broadcast messages"),process.on("message",mf)):lr&&lr.isMaster?(ar("listening for cluster messages"),lr.on("message",mf)):ar("not listening for messages, because we are not a master process")});y1.exports={onlyOnMaster:(t,e)=>Qg()?t():e,isMaster:Qg,send:t=>{Qg()?g1(t):(il||(t.cluster={workerId:lr.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:t.serialise()}))},onMessage:t=>{ey.push(t)}}});var w1=g((Bue,v1)=>{function Fz(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 Pz(t,e){let r=Object.assign({},e);return Object.keys(t).forEach(n=>{r[n]&&(r[n]=t[n](e[n]))}),r}function ty(t){return Pz({maxLogSize:Fz},t)}var b1={dateFile:ty,file:ty,fileSync:ty};v1.exports.modifyConfig=t=>b1[t.type]?b1[t.type](t):t});var E1=g((zue,x1)=>{var Mz=console.log.bind(console);function $z(t,e){return r=>{Mz(t(r,e))}}function Lz(t,e){let r=e.colouredLayout;return t.layout&&(r=e.layout(t.layout.type,t.layout)),$z(r,t.timezoneOffset)}x1.exports.configure=Lz});var I1=g(S1=>{function jz(t,e){return r=>{process.stdout.write(`${t(r,e)}
|
|
`)}}function qz(t,e){let r=e.colouredLayout;return t.layout&&(r=e.layout(t.layout.type,t.layout)),jz(r,t.timezoneOffset)}S1.configure=qz});var O1=g((Wue,_1)=>{function Bz(t,e){return r=>{process.stderr.write(`${t(r,e)}
|
|
`)}}function zz(t,e){let r=e.colouredLayout;return t.layout&&(r=e.layout(t.layout.type,t.layout)),Bz(r,t.timezoneOffset)}_1.exports.configure=zz});var C1=g((Hue,T1)=>{function Uz(t,e,r,n){let o=n.getLevel(t),i=n.getLevel(e,n.FATAL);return s=>{let a=s.level;o.isLessThanOrEqualTo(a)&&i.isGreaterThanOrEqualTo(a)&&r(s)}}function Wz(t,e,r,n){let o=r(t.appender);return Uz(t.level,t.maxLevel,o,n)}T1.exports.configure=Wz});var R1=g((Kue,k1)=>{var A1=Ze()("log4js:categoryFilter");function Hz(t,e){return typeof t=="string"&&(t=[t]),r=>{A1(`Checking ${r.categoryName} against ${t}`),t.indexOf(r.categoryName)===-1&&(A1("Not excluded, sending to appender"),e(r))}}function Kz(t,e,r){let n=r(t.appender);return Hz(t.exclude,n)}k1.exports.configure=Kz});var F1=g((Vue,D1)=>{var N1=Ze()("log4js:noLogFilter");function Vz(t){return t.filter(r=>r!=null&&r!=="")}function Gz(t,e){return r=>{N1(`Checking data: ${r.data} against filters: ${t}`),typeof t=="string"&&(t=[t]),t=Vz(t);let n=new RegExp(t.join("|"),"i");(t.length===0||r.data.findIndex(o=>n.test(o))<0)&&(N1("Not excluded, sending to appender"),e(r))}}function Zz(t,e,r){let n=r(t.appender);return Gz(t.exclude,n)}D1.exports.configure=Zz});var At=g(ry=>{"use strict";ry.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})};ry.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 M1=g((Zue,P1)=>{var uo=require("constants"),Jz=process.cwd,gf=null,Yz=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return gf||(gf=Jz.call(process)),gf};try{process.cwd()}catch{}typeof process.chdir=="function"&&(ny=process.chdir,process.chdir=function(t){gf=null,ny.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,ny));var ny;P1.exports=Xz;function Xz(t){uo.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=a(t.stat),t.fstat=a(t.fstat),t.lstat=a(t.lstat),t.statSync=l(t.statSync),t.fstatSync=l(t.fstatSync),t.lstatSync=l(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(c,f,p){p&&process.nextTick(p)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(c,f,p,d){d&&process.nextTick(d)},t.lchownSync=function(){}),Yz==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:function(c){function f(p,d,h){var b=Date.now(),y=0;c(p,d,function v(x){if(x&&(x.code==="EACCES"||x.code==="EPERM"||x.code==="EBUSY")&&Date.now()-b<6e4){setTimeout(function(){t.stat(d,function(T,$){T&&T.code==="ENOENT"?c(p,d,v):h(x)})},y),y<100&&(y+=10);return}h&&h(x)})}return Object.setPrototypeOf&&Object.setPrototypeOf(f,c),f}(t.rename)),t.read=typeof t.read!="function"?t.read:function(c){function f(p,d,h,b,y,v){var x;if(v&&typeof v=="function"){var T=0;x=function($,V,J){if($&&$.code==="EAGAIN"&&T<10)return T++,c.call(t,p,d,h,b,y,x);v.apply(this,arguments)}}return c.call(t,p,d,h,b,y,x)}return Object.setPrototypeOf&&Object.setPrototypeOf(f,c),f}(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:function(c){return function(f,p,d,h,b){for(var y=0;;)try{return c.call(t,f,p,d,h,b)}catch(v){if(v.code==="EAGAIN"&&y<10){y++;continue}throw v}}}(t.readSync);function e(c){c.lchmod=function(f,p,d){c.open(f,uo.O_WRONLY|uo.O_SYMLINK,p,function(h,b){if(h){d&&d(h);return}c.fchmod(b,p,function(y){c.close(b,function(v){d&&d(y||v)})})})},c.lchmodSync=function(f,p){var d=c.openSync(f,uo.O_WRONLY|uo.O_SYMLINK,p),h=!0,b;try{b=c.fchmodSync(d,p),h=!1}finally{if(h)try{c.closeSync(d)}catch{}else c.closeSync(d)}return b}}function r(c){uo.hasOwnProperty("O_SYMLINK")&&c.futimes?(c.lutimes=function(f,p,d,h){c.open(f,uo.O_SYMLINK,function(b,y){if(b){h&&h(b);return}c.futimes(y,p,d,function(v){c.close(y,function(x){h&&h(v||x)})})})},c.lutimesSync=function(f,p,d){var h=c.openSync(f,uo.O_SYMLINK),b,y=!0;try{b=c.futimesSync(h,p,d),y=!1}finally{if(y)try{c.closeSync(h)}catch{}else c.closeSync(h)}return b}):c.futimes&&(c.lutimes=function(f,p,d,h){h&&process.nextTick(h)},c.lutimesSync=function(){})}function n(c){return c&&function(f,p,d){return c.call(t,f,p,function(h){u(h)&&(h=null),d&&d.apply(this,arguments)})}}function o(c){return c&&function(f,p){try{return c.call(t,f,p)}catch(d){if(!u(d))throw d}}}function i(c){return c&&function(f,p,d,h){return c.call(t,f,p,d,function(b){u(b)&&(b=null),h&&h.apply(this,arguments)})}}function s(c){return c&&function(f,p,d){try{return c.call(t,f,p,d)}catch(h){if(!u(h))throw h}}}function a(c){return c&&function(f,p,d){typeof p=="function"&&(d=p,p=null);function h(b,y){y&&(y.uid<0&&(y.uid+=4294967296),y.gid<0&&(y.gid+=4294967296)),d&&d.apply(this,arguments)}return p?c.call(t,f,p,h):c.call(t,f,h)}}function l(c){return c&&function(f,p){var d=p?c.call(t,f,p):c.call(t,f);return d&&(d.uid<0&&(d.uid+=4294967296),d.gid<0&&(d.gid+=4294967296)),d}}function u(c){if(!c||c.code==="ENOSYS")return!0;var f=!process.getuid||process.getuid()!==0;return!!(f&&(c.code==="EINVAL"||c.code==="EPERM"))}}});var j1=g((Jue,L1)=>{var $1=require("stream").Stream;L1.exports=Qz;function Qz(t){return{ReadStream:e,WriteStream:r};function e(n,o){if(!(this instanceof e))return new e(n,o);$1.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,l=s.length;a<l;a++){var u=s[a];this[u]=o[u]}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(c,f){if(c){i.emit("error",c),i.readable=!1;return}i.fd=f,i.emit("open",f),i._read()})}function r(n,o){if(!(this instanceof r))return new r(n,o);$1.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 l=i[s];this[l]=o[l]}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 B1=g((Yue,q1)=>{"use strict";q1.exports=t6;var e6=Object.getPrototypeOf||function(t){return t.__proto__};function t6(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:e6(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var Ue=g((Xue,sy)=>{var ke=require("fs"),r6=M1(),n6=j1(),o6=B1(),yf=require("util"),st,vf;typeof Symbol=="function"&&typeof Symbol.for=="function"?(st=Symbol.for("graceful-fs.queue"),vf=Symbol.for("graceful-fs.previous")):(st="___graceful-fs.queue",vf="___graceful-fs.previous");function i6(){}function W1(t,e){Object.defineProperty(t,st,{get:function(){return e}})}var li=i6;yf.debuglog?li=yf.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(li=function(){var t=yf.format.apply(yf,arguments);t="GFS4: "+t.split(/\n/).join(`
|
|
GFS4: `),console.error(t)});ke[st]||(z1=global[st]||[],W1(ke,z1),ke.close=function(t){function e(r,n){return t.call(ke,r,function(o){o||U1(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,vf,{value:t}),e}(ke.close),ke.closeSync=function(t){function e(r){t.apply(ke,arguments),U1()}return Object.defineProperty(e,vf,{value:t}),e}(ke.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){li(ke[st]),require("assert").equal(ke[st].length,0)}));var z1;global[st]||W1(global,ke[st]);sy.exports=oy(o6(ke));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!ke.__patched&&(sy.exports=oy(ke),ke.__patched=!0);function oy(t){r6(t),t.gracefulify=oy,t.createReadStream=V,t.createWriteStream=J;var e=t.readFile;t.readFile=r;function r(F,Q,O){return typeof Q=="function"&&(O=Q,Q=null),_(F,Q,O);function _(I,B,D,oe){return e(I,B,function(se){se&&(se.code==="EMFILE"||se.code==="ENFILE")?_s([_,[I,B,D],se,oe||Date.now(),Date.now()]):typeof D=="function"&&D.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=o;function o(F,Q,O,_){return typeof O=="function"&&(_=O,O=null),I(F,Q,O,_);function I(B,D,oe,se,be){return n(B,D,oe,function(ce){ce&&(ce.code==="EMFILE"||ce.code==="ENFILE")?_s([I,[B,D,oe,se],ce,be||Date.now(),Date.now()]):typeof se=="function"&&se.apply(this,arguments)})}}var i=t.appendFile;i&&(t.appendFile=s);function s(F,Q,O,_){return typeof O=="function"&&(_=O,O=null),I(F,Q,O,_);function I(B,D,oe,se,be){return i(B,D,oe,function(ce){ce&&(ce.code==="EMFILE"||ce.code==="ENFILE")?_s([I,[B,D,oe,se],ce,be||Date.now(),Date.now()]):typeof se=="function"&&se.apply(this,arguments)})}}var a=t.copyFile;a&&(t.copyFile=l);function l(F,Q,O,_){return typeof O=="function"&&(_=O,O=0),I(F,Q,O,_);function I(B,D,oe,se,be){return a(B,D,oe,function(ce){ce&&(ce.code==="EMFILE"||ce.code==="ENFILE")?_s([I,[B,D,oe,se],ce,be||Date.now(),Date.now()]):typeof se=="function"&&se.apply(this,arguments)})}}var u=t.readdir;t.readdir=f;var c=/^v[0-5]\./;function f(F,Q,O){typeof Q=="function"&&(O=Q,Q=null);var _=c.test(process.version)?function(D,oe,se,be){return u(D,I(D,oe,se,be))}:function(D,oe,se,be){return u(D,oe,I(D,oe,se,be))};return _(F,Q,O);function I(B,D,oe,se){return function(be,ce){be&&(be.code==="EMFILE"||be.code==="ENFILE")?_s([_,[B,D,oe],be,se||Date.now(),Date.now()]):(ce&&ce.sort&&ce.sort(),typeof oe=="function"&&oe.call(this,be,ce))}}}if(process.version.substr(0,4)==="v0.8"){var p=n6(t);v=p.ReadStream,T=p.WriteStream}var d=t.ReadStream;d&&(v.prototype=Object.create(d.prototype),v.prototype.open=x);var h=t.WriteStream;h&&(T.prototype=Object.create(h.prototype),T.prototype.open=$),Object.defineProperty(t,"ReadStream",{get:function(){return v},set:function(F){v=F},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return T},set:function(F){T=F},enumerable:!0,configurable:!0});var b=v;Object.defineProperty(t,"FileReadStream",{get:function(){return b},set:function(F){b=F},enumerable:!0,configurable:!0});var y=T;Object.defineProperty(t,"FileWriteStream",{get:function(){return y},set:function(F){y=F},enumerable:!0,configurable:!0});function v(F,Q){return this instanceof v?(d.apply(this,arguments),this):v.apply(Object.create(v.prototype),arguments)}function x(){var F=this;K(F.path,F.flags,F.mode,function(Q,O){Q?(F.autoClose&&F.destroy(),F.emit("error",Q)):(F.fd=O,F.emit("open",O),F.read())})}function T(F,Q){return this instanceof T?(h.apply(this,arguments),this):T.apply(Object.create(T.prototype),arguments)}function $(){var F=this;K(F.path,F.flags,F.mode,function(Q,O){Q?(F.destroy(),F.emit("error",Q)):(F.fd=O,F.emit("open",O))})}function V(F,Q){return new t.ReadStream(F,Q)}function J(F,Q){return new t.WriteStream(F,Q)}var G=t.open;t.open=K;function K(F,Q,O,_){return typeof O=="function"&&(_=O,O=null),I(F,Q,O,_);function I(B,D,oe,se,be){return G(B,D,oe,function(ce,E){ce&&(ce.code==="EMFILE"||ce.code==="ENFILE")?_s([I,[B,D,oe,se],ce,be||Date.now(),Date.now()]):typeof se=="function"&&se.apply(this,arguments)})}}return t}function _s(t){li("ENQUEUE",t[0].name,t[1]),ke[st].push(t),iy()}var bf;function U1(){for(var t=Date.now(),e=0;e<ke[st].length;++e)ke[st][e].length>2&&(ke[st][e][3]=t,ke[st][e][4]=t);iy()}function iy(){if(clearTimeout(bf),bf=void 0,ke[st].length!==0){var t=ke[st].shift(),e=t[0],r=t[1],n=t[2],o=t[3],i=t[4];if(o===void 0)li("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-o>=6e4){li("TIMEOUT",e.name,r);var s=r.pop();typeof s=="function"&&s.call(null,n)}else{var a=Date.now()-i,l=Math.max(i-o,1),u=Math.min(l*1.2,100);a>=u?(li("RETRY",e.name,r),e.apply(null,r.concat([o]))):ke[st].push(t)}bf===void 0&&(bf=setTimeout(iy,0))}}});var ay=g(ci=>{"use strict";var H1=At().fromCallback,cr=Ue(),s6=["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 cr[t]=="function");Object.keys(cr).forEach(t=>{t!=="promises"&&(ci[t]=cr[t])});s6.forEach(t=>{ci[t]=H1(cr[t])});ci.exists=function(t,e){return typeof e=="function"?cr.exists(t,e):new Promise(r=>cr.exists(t,r))};ci.read=function(t,e,r,n,o,i){return typeof i=="function"?cr.read(t,e,r,n,o,i):new Promise((s,a)=>{cr.read(t,e,r,n,o,(l,u,c)=>{if(l)return a(l);s({bytesRead:u,buffer:c})})})};ci.write=function(t,e,...r){return typeof r[r.length-1]=="function"?cr.write(t,e,...r):new Promise((n,o)=>{cr.write(t,e,...r,(i,s,a)=>{if(i)return o(i);n({bytesWritten:s,buffer:a})})})};typeof cr.realpath.native=="function"&&(ci.realpath.native=H1(cr.realpath.native))});var cy=g((efe,V1)=>{"use strict";var ly=require("path");function K1(t){return t=ly.normalize(ly.resolve(t)).split(ly.sep),t.length>0?t[0]:null}var a6=/[<>:"|?*]/;function l6(t){let e=K1(t);return t=t.replace(e,""),a6.test(t)}V1.exports={getRootPath:K1,invalidWin32Path:l6}});var Z1=g((tfe,G1)=>{"use strict";var c6=Ue(),uy=require("path"),u6=cy().invalidWin32Path,f6=parseInt("0777",8);function fy(t,e,r,n){if(typeof e=="function"?(r=e,e={}):(!e||typeof e!="object")&&(e={mode:e}),process.platform==="win32"&&u6(t)){let s=new Error(t+" contains invalid WIN32 path characters.");return s.code="EINVAL",r(s)}let o=e.mode,i=e.fs||c6;o===void 0&&(o=f6&~process.umask()),n||(n=null),r=r||function(){},t=uy.resolve(t),i.mkdir(t,o,s=>{if(!s)return n=n||t,r(null,n);switch(s.code){case"ENOENT":if(uy.dirname(t)===t)return r(s);fy(uy.dirname(t),e,(a,l)=>{a?r(a,l):fy(t,e,r,l)});break;default:i.stat(t,(a,l)=>{a||!l.isDirectory()?r(s,n):r(null,n)});break}})}G1.exports=fy});var Y1=g((rfe,J1)=>{"use strict";var p6=Ue(),py=require("path"),d6=cy().invalidWin32Path,m6=parseInt("0777",8);function dy(t,e,r){(!e||typeof e!="object")&&(e={mode:e});let n=e.mode,o=e.fs||p6;if(process.platform==="win32"&&d6(t)){let i=new Error(t+" contains invalid WIN32 path characters.");throw i.code="EINVAL",i}n===void 0&&(n=m6&~process.umask()),r||(r=null),t=py.resolve(t);try{o.mkdirSync(t,n),r=r||t}catch(i){if(i.code==="ENOENT"){if(py.dirname(t)===t)throw i;r=dy(py.dirname(t),e,r),dy(t,e,r)}else{let s;try{s=o.statSync(t)}catch{throw i}if(!s.isDirectory())throw i}}return r}J1.exports=dy});var Ht=g((nfe,X1)=>{"use strict";var h6=At().fromCallback,my=h6(Z1()),hy=Y1();X1.exports={mkdirs:my,mkdirsSync:hy,mkdirp:my,mkdirpSync:hy,ensureDir:my,ensureDirSync:hy}});var gy=g((ofe,eI)=>{"use strict";var pt=Ue(),Q1=require("os"),wf=require("path");function g6(){let t=wf.join("millis-test-sync"+Date.now().toString()+Math.random().toString().slice(2));t=wf.join(Q1.tmpdir(),t);let e=new Date(1435410243862);pt.writeFileSync(t,"https://github.com/jprichardson/node-fs-extra/pull/141");let r=pt.openSync(t,"r+");return pt.futimesSync(r,e,e),pt.closeSync(r),pt.statSync(t).mtime>1435410243e3}function y6(t){let e=wf.join("millis-test"+Date.now().toString()+Math.random().toString().slice(2));e=wf.join(Q1.tmpdir(),e);let r=new Date(1435410243862);pt.writeFile(e,"https://github.com/jprichardson/node-fs-extra/pull/141",n=>{if(n)return t(n);pt.open(e,"r+",(o,i)=>{if(o)return t(o);pt.futimes(i,r,r,s=>{if(s)return t(s);pt.close(i,a=>{if(a)return t(a);pt.stat(e,(l,u)=>{if(l)return t(l);t(null,u.mtime>1435410243e3)})})})})})}function b6(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 v6(t,e,r,n){pt.open(t,"r+",(o,i)=>{if(o)return n(o);pt.futimes(i,e,r,s=>{pt.close(i,a=>{n&&n(s||a)})})})}function w6(t,e,r){let n=pt.openSync(t,"r+");return pt.futimesSync(n,e,r),pt.closeSync(n)}eI.exports={hasMillisRes:y6,hasMillisResSync:g6,timeRemoveMillis:b6,utimesMillis:v6,utimesMillisSync:w6}});var ll=g((ife,sI)=>{"use strict";var ur=Ue(),kt=require("path"),tI=10,rI=5,x6=0,by=process.versions.node.split("."),nI=Number.parseInt(by[0],10),oI=Number.parseInt(by[1],10),E6=Number.parseInt(by[2],10);function sl(){if(nI>tI)return!0;if(nI===tI){if(oI>rI)return!0;if(oI===rI&&E6>=x6)return!0}return!1}function S6(t,e,r){sl()?ur.stat(t,{bigint:!0},(n,o)=>{if(n)return r(n);ur.stat(e,{bigint:!0},(i,s)=>i?i.code==="ENOENT"?r(null,{srcStat:o,destStat:null}):r(i):r(null,{srcStat:o,destStat:s}))}):ur.stat(t,(n,o)=>{if(n)return r(n);ur.stat(e,(i,s)=>i?i.code==="ENOENT"?r(null,{srcStat:o,destStat:null}):r(i):r(null,{srcStat:o,destStat:s}))})}function I6(t,e){let r,n;sl()?r=ur.statSync(t,{bigint:!0}):r=ur.statSync(t);try{sl()?n=ur.statSync(e,{bigint:!0}):n=ur.statSync(e)}catch(o){if(o.code==="ENOENT")return{srcStat:r,destStat:null};throw o}return{srcStat:r,destStat:n}}function _6(t,e,r,n){S6(t,e,(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()&&vy(t,e)?n(new Error(al(t,e,r))):n(null,{srcStat:s,destStat:a})})}function O6(t,e,r){let{srcStat:n,destStat:o}=I6(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()&&vy(t,e))throw new Error(al(t,e,r));return{srcStat:n,destStat:o}}function yy(t,e,r,n,o){let i=kt.resolve(kt.dirname(t)),s=kt.resolve(kt.dirname(r));if(s===i||s===kt.parse(s).root)return o();sl()?ur.stat(s,{bigint:!0},(a,l)=>a?a.code==="ENOENT"?o():o(a):l.ino&&l.dev&&l.ino===e.ino&&l.dev===e.dev?o(new Error(al(t,r,n))):yy(t,e,s,n,o)):ur.stat(s,(a,l)=>a?a.code==="ENOENT"?o():o(a):l.ino&&l.dev&&l.ino===e.ino&&l.dev===e.dev?o(new Error(al(t,r,n))):yy(t,e,s,n,o))}function iI(t,e,r,n){let o=kt.resolve(kt.dirname(t)),i=kt.resolve(kt.dirname(r));if(i===o||i===kt.parse(i).root)return;let s;try{sl()?s=ur.statSync(i,{bigint:!0}):s=ur.statSync(i)}catch(a){if(a.code==="ENOENT")return;throw a}if(s.ino&&s.dev&&s.ino===e.ino&&s.dev===e.dev)throw new Error(al(t,r,n));return iI(t,e,i,n)}function vy(t,e){let r=kt.resolve(t).split(kt.sep).filter(o=>o),n=kt.resolve(e).split(kt.sep).filter(o=>o);return r.reduce((o,i,s)=>o&&n[s]===i,!0)}function al(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}sI.exports={checkPaths:_6,checkPathsSync:O6,checkParentPaths:yy,checkParentPathsSync:iI,isSrcSubdir:vy}});var lI=g((sfe,aI)=>{"use strict";aI.exports=function(t){if(typeof Buffer.allocUnsafe=="function")try{return Buffer.allocUnsafe(t)}catch{return new Buffer(t)}return new Buffer(t)}});var dI=g((afe,pI)=>{"use strict";var Ce=Ue(),cl=require("path"),T6=Ht().mkdirsSync,C6=gy().utimesMillisSync,ul=ll();function A6(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}=ul.checkPathsSync(t,e,"copy");return ul.checkParentPathsSync(t,n,e,"copy"),k6(o,t,e,r)}function k6(t,e,r,n){if(n.filter&&!n.filter(e,r))return;let o=cl.dirname(r);return Ce.existsSync(o)||T6(o),cI(t,e,r,n)}function cI(t,e,r,n){if(!(n.filter&&!n.filter(e,r)))return R6(t,e,r,n)}function R6(t,e,r,n){let i=(n.dereference?Ce.statSync:Ce.lstatSync)(e);if(i.isDirectory())return P6(i,t,e,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return N6(i,t,e,r,n);if(i.isSymbolicLink())return L6(t,e,r,n)}function N6(t,e,r,n,o){return e?D6(t,r,n,o):uI(t,r,n,o)}function D6(t,e,r,n){if(n.overwrite)return Ce.unlinkSync(r),uI(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function uI(t,e,r,n){return typeof Ce.copyFileSync=="function"?(Ce.copyFileSync(e,r),Ce.chmodSync(r,t.mode),n.preserveTimestamps?C6(r,t.atime,t.mtime):void 0):F6(t,e,r,n)}function F6(t,e,r,n){let i=lI()(65536),s=Ce.openSync(e,"r"),a=Ce.openSync(r,"w",t.mode),l=0;for(;l<t.size;){let u=Ce.readSync(s,i,0,65536,l);Ce.writeSync(a,i,0,u),l+=u}n.preserveTimestamps&&Ce.futimesSync(a,t.atime,t.mtime),Ce.closeSync(s),Ce.closeSync(a)}function P6(t,e,r,n,o){if(!e)return M6(t,r,n,o);if(e&&!e.isDirectory())throw new Error(`Cannot overwrite non-directory '${n}' with directory '${r}'.`);return fI(r,n,o)}function M6(t,e,r,n){return Ce.mkdirSync(r),fI(e,r,n),Ce.chmodSync(r,t.mode)}function fI(t,e,r){Ce.readdirSync(t).forEach(n=>$6(n,t,e,r))}function $6(t,e,r,n){let o=cl.join(e,t),i=cl.join(r,t),{destStat:s}=ul.checkPathsSync(o,i,"copy");return cI(s,o,i,n)}function L6(t,e,r,n){let o=Ce.readlinkSync(e);if(n.dereference&&(o=cl.resolve(process.cwd(),o)),t){let i;try{i=Ce.readlinkSync(r)}catch(s){if(s.code==="EINVAL"||s.code==="UNKNOWN")return Ce.symlinkSync(o,r);throw s}if(n.dereference&&(i=cl.resolve(process.cwd(),i)),ul.isSrcSubdir(o,i))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`);if(Ce.statSync(r).isDirectory()&&ul.isSrcSubdir(i,o))throw new Error(`Cannot overwrite '${i}' with '${o}'.`);return j6(o,r)}else return Ce.symlinkSync(o,r)}function j6(t,e){return Ce.unlinkSync(e),Ce.symlinkSync(t,e)}pI.exports=A6});var wy=g((lfe,mI)=>{"use strict";mI.exports={copySync:dI()}});var Zr=g((cfe,gI)=>{"use strict";var q6=At().fromPromise,hI=ay();function B6(t){return hI.access(t).then(()=>!0).catch(()=>!1)}gI.exports={pathExists:q6(B6),pathExistsSync:hI.existsSync}});var _I=g((ufe,II)=>{"use strict";var at=Ue(),fl=require("path"),z6=Ht().mkdirs,U6=Zr().pathExists,W6=gy().utimesMillis,pl=ll();function H6(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`),pl.checkPaths(t,e,"copy",(o,i)=>{if(o)return n(o);let{srcStat:s,destStat:a}=i;pl.checkParentPaths(t,s,e,"copy",l=>l?n(l):r.filter?vI(yI,a,t,e,r,n):yI(a,t,e,r,n))})}function yI(t,e,r,n,o){let i=fl.dirname(r);U6(i,(s,a)=>{if(s)return o(s);if(a)return xy(t,e,r,n,o);z6(i,l=>l?o(l):xy(t,e,r,n,o))})}function vI(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 xy(t,e,r,n,o){return n.filter?vI(bI,t,e,r,n,o):bI(t,e,r,n,o)}function bI(t,e,r,n,o){(n.dereference?at.stat:at.lstat)(e,(s,a)=>{if(s)return o(s);if(a.isDirectory())return Z6(a,t,e,r,n,o);if(a.isFile()||a.isCharacterDevice()||a.isBlockDevice())return K6(a,t,e,r,n,o);if(a.isSymbolicLink())return X6(t,e,r,n,o)})}function K6(t,e,r,n,o,i){return e?V6(t,r,n,o,i):wI(t,r,n,o,i)}function V6(t,e,r,n,o){if(n.overwrite)at.unlink(r,i=>i?o(i):wI(t,e,r,n,o));else return n.errorOnExist?o(new Error(`'${r}' already exists`)):o()}function wI(t,e,r,n,o){return typeof at.copyFile=="function"?at.copyFile(e,r,i=>i?o(i):xI(t,r,n,o)):G6(t,e,r,n,o)}function G6(t,e,r,n,o){let i=at.createReadStream(e);i.on("error",s=>o(s)).once("open",()=>{let s=at.createWriteStream(r,{mode:t.mode});s.on("error",a=>o(a)).on("open",()=>i.pipe(s)).once("close",()=>xI(t,r,n,o))})}function xI(t,e,r,n){at.chmod(e,t.mode,o=>o?n(o):r.preserveTimestamps?W6(e,t.atime,t.mtime,n):n())}function Z6(t,e,r,n,o,i){return e?e&&!e.isDirectory()?i(new Error(`Cannot overwrite non-directory '${n}' with directory '${r}'.`)):EI(r,n,o,i):J6(t,r,n,o,i)}function J6(t,e,r,n,o){at.mkdir(r,i=>{if(i)return o(i);EI(e,r,n,s=>s?o(s):at.chmod(r,t.mode,o))})}function EI(t,e,r,n){at.readdir(t,(o,i)=>o?n(o):SI(i,t,e,r,n))}function SI(t,e,r,n,o){let i=t.pop();return i?Y6(t,i,e,r,n,o):o()}function Y6(t,e,r,n,o,i){let s=fl.join(r,e),a=fl.join(n,e);pl.checkPaths(s,a,"copy",(l,u)=>{if(l)return i(l);let{destStat:c}=u;xy(c,s,a,o,f=>f?i(f):SI(t,r,n,o,i))})}function X6(t,e,r,n,o){at.readlink(e,(i,s)=>{if(i)return o(i);if(n.dereference&&(s=fl.resolve(process.cwd(),s)),t)at.readlink(r,(a,l)=>a?a.code==="EINVAL"||a.code==="UNKNOWN"?at.symlink(s,r,o):o(a):(n.dereference&&(l=fl.resolve(process.cwd(),l)),pl.isSrcSubdir(s,l)?o(new Error(`Cannot copy '${s}' to a subdirectory of itself, '${l}'.`)):t.isDirectory()&&pl.isSrcSubdir(l,s)?o(new Error(`Cannot overwrite '${l}' with '${s}'.`)):Q6(s,r,o)));else return at.symlink(s,r,o)})}function Q6(t,e,r){at.unlink(e,n=>n?r(n):at.symlink(t,e,r))}II.exports=H6});var Ey=g((ffe,OI)=>{"use strict";var e9=At().fromCallback;OI.exports={copy:e9(_I())}});var PI=g((pfe,FI)=>{"use strict";var TI=Ue(),RI=require("path"),he=require("assert"),dl=process.platform==="win32";function NI(t){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(r=>{t[r]=t[r]||TI[r],r=r+"Sync",t[r]=t[r]||TI[r]}),t.maxBusyTries=t.maxBusyTries||3}function Sy(t,e,r){let n=0;typeof e=="function"&&(r=e,e={}),he(t,"rimraf: missing path"),he.strictEqual(typeof t,"string","rimraf: path should be a string"),he.strictEqual(typeof r,"function","rimraf: callback function required"),he(e,"rimraf: invalid options argument provided"),he.strictEqual(typeof e,"object","rimraf: options should be object"),NI(e),CI(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(()=>CI(t,e,o),s)}i.code==="ENOENT"&&(i=null)}r(i)})}function CI(t,e,r){he(t),he(e),he(typeof r=="function"),e.lstat(t,(n,o)=>{if(n&&n.code==="ENOENT")return r(null);if(n&&n.code==="EPERM"&&dl)return AI(t,e,n,r);if(o&&o.isDirectory())return xf(t,e,n,r);e.unlink(t,i=>{if(i){if(i.code==="ENOENT")return r(null);if(i.code==="EPERM")return dl?AI(t,e,i,r):xf(t,e,i,r);if(i.code==="EISDIR")return xf(t,e,i,r)}return r(i)})})}function AI(t,e,r,n){he(t),he(e),he(typeof n=="function"),r&&he(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()?xf(t,e,r,n):e.unlink(t,n)})})}function kI(t,e,r){let n;he(t),he(e),r&&he(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()?Ef(t,e,r):e.unlinkSync(t)}function xf(t,e,r,n){he(t),he(e),r&&he(r instanceof Error),he(typeof n=="function"),e.rmdir(t,o=>{o&&(o.code==="ENOTEMPTY"||o.code==="EEXIST"||o.code==="EPERM")?t9(t,e,n):o&&o.code==="ENOTDIR"?n(r):n(o)})}function t9(t,e,r){he(t),he(e),he(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(a=>{Sy(RI.join(t,a),e,l=>{if(!s){if(l)return r(s=l);--i===0&&e.rmdir(t,r)}})})})}function DI(t,e){let r;e=e||{},NI(e),he(t,"rimraf: missing path"),he.strictEqual(typeof t,"string","rimraf: path should be a string"),he(e,"rimraf: missing options"),he.strictEqual(typeof e,"object","rimraf: options should be object");try{r=e.lstatSync(t)}catch(n){if(n.code==="ENOENT")return;n.code==="EPERM"&&dl&&kI(t,e,n)}try{r&&r.isDirectory()?Ef(t,e,null):e.unlinkSync(t)}catch(n){if(n.code==="ENOENT")return;if(n.code==="EPERM")return dl?kI(t,e,n):Ef(t,e,n);if(n.code!=="EISDIR")throw n;Ef(t,e,n)}}function Ef(t,e,r){he(t),he(e),r&&he(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")r9(t,e);else if(n.code!=="ENOENT")throw n}}function r9(t,e){if(he(t),he(e),e.readdirSync(t).forEach(r=>DI(RI.join(t,r),e)),dl){let r=Date.now();do try{return e.rmdirSync(t,e)}catch{}while(Date.now()-r<500)}else return e.rmdirSync(t,e)}FI.exports=Sy;Sy.sync=DI});var ml=g((dfe,$I)=>{"use strict";var n9=At().fromCallback,MI=PI();$I.exports={remove:n9(MI),removeSync:MI.sync}});var HI=g((mfe,WI)=>{"use strict";var o9=At().fromCallback,qI=Ue(),BI=require("path"),zI=Ht(),UI=ml(),LI=o9(function(e,r){r=r||function(){},qI.readdir(e,(n,o)=>{if(n)return zI.mkdirs(e,r);o=o.map(s=>BI.join(e,s)),i();function i(){let s=o.pop();if(!s)return r();UI.remove(s,a=>{if(a)return r(a);i()})}})});function jI(t){let e;try{e=qI.readdirSync(t)}catch{return zI.mkdirsSync(t)}e.forEach(r=>{r=BI.join(t,r),UI.removeSync(r)})}WI.exports={emptyDirSync:jI,emptydirSync:jI,emptyDir:LI,emptydir:LI}});var ZI=g((hfe,GI)=>{"use strict";var i9=At().fromCallback,KI=require("path"),hl=Ue(),VI=Ht(),s9=Zr().pathExists;function a9(t,e){function r(){hl.writeFile(t,"",n=>{if(n)return e(n);e()})}hl.stat(t,(n,o)=>{if(!n&&o.isFile())return e();let i=KI.dirname(t);s9(i,(s,a)=>{if(s)return e(s);if(a)return r();VI.mkdirs(i,l=>{if(l)return e(l);r()})})})}function l9(t){let e;try{e=hl.statSync(t)}catch{}if(e&&e.isFile())return;let r=KI.dirname(t);hl.existsSync(r)||VI.mkdirsSync(r),hl.writeFileSync(t,"")}GI.exports={createFile:i9(a9),createFileSync:l9}});var e_=g((gfe,QI)=>{"use strict";var c9=At().fromCallback,YI=require("path"),ui=Ue(),XI=Ht(),JI=Zr().pathExists;function u9(t,e,r){function n(o,i){ui.link(o,i,s=>{if(s)return r(s);r(null)})}JI(e,(o,i)=>{if(o)return r(o);if(i)return r(null);ui.lstat(t,s=>{if(s)return s.message=s.message.replace("lstat","ensureLink"),r(s);let a=YI.dirname(e);JI(a,(l,u)=>{if(l)return r(l);if(u)return n(t,e);XI.mkdirs(a,c=>{if(c)return r(c);n(t,e)})})})})}function f9(t,e){if(ui.existsSync(e))return;try{ui.lstatSync(t)}catch(i){throw i.message=i.message.replace("lstat","ensureLink"),i}let n=YI.dirname(e);return ui.existsSync(n)||XI.mkdirsSync(n),ui.linkSync(t,e)}QI.exports={createLink:c9(u9),createLinkSync:f9}});var r_=g((yfe,t_)=>{"use strict";var fo=require("path"),gl=Ue(),p9=Zr().pathExists;function d9(t,e,r){if(fo.isAbsolute(t))return gl.lstat(t,n=>n?(n.message=n.message.replace("lstat","ensureSymlink"),r(n)):r(null,{toCwd:t,toDst:t}));{let n=fo.dirname(e),o=fo.join(n,t);return p9(o,(i,s)=>i?r(i):s?r(null,{toCwd:o,toDst:t}):gl.lstat(t,a=>a?(a.message=a.message.replace("lstat","ensureSymlink"),r(a)):r(null,{toCwd:t,toDst:fo.relative(n,t)})))}}function m9(t,e){let r;if(fo.isAbsolute(t)){if(r=gl.existsSync(t),!r)throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}else{let n=fo.dirname(e),o=fo.join(n,t);if(r=gl.existsSync(o),r)return{toCwd:o,toDst:t};if(r=gl.existsSync(t),!r)throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:fo.relative(n,t)}}}t_.exports={symlinkPaths:d9,symlinkPathsSync:m9}});var i_=g((bfe,o_)=>{"use strict";var n_=Ue();function h9(t,e,r){if(r=typeof e=="function"?e:r,e=typeof e=="function"?!1:e,e)return r(null,e);n_.lstat(t,(n,o)=>{if(n)return r(null,"file");e=o&&o.isDirectory()?"dir":"file",r(null,e)})}function g9(t,e){let r;if(e)return e;try{r=n_.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}o_.exports={symlinkType:h9,symlinkTypeSync:g9}});var p_=g((vfe,f_)=>{"use strict";var y9=At().fromCallback,a_=require("path"),Os=Ue(),l_=Ht(),b9=l_.mkdirs,v9=l_.mkdirsSync,c_=r_(),w9=c_.symlinkPaths,x9=c_.symlinkPathsSync,u_=i_(),E9=u_.symlinkType,S9=u_.symlinkTypeSync,s_=Zr().pathExists;function I9(t,e,r,n){n=typeof r=="function"?r:n,r=typeof r=="function"?!1:r,s_(e,(o,i)=>{if(o)return n(o);if(i)return n(null);w9(t,e,(s,a)=>{if(s)return n(s);t=a.toDst,E9(a.toCwd,r,(l,u)=>{if(l)return n(l);let c=a_.dirname(e);s_(c,(f,p)=>{if(f)return n(f);if(p)return Os.symlink(t,e,u,n);b9(c,d=>{if(d)return n(d);Os.symlink(t,e,u,n)})})})})})}function _9(t,e,r){if(Os.existsSync(e))return;let o=x9(t,e);t=o.toDst,r=S9(o.toCwd,r);let i=a_.dirname(e);return Os.existsSync(i)||v9(i),Os.symlinkSync(t,e,r)}f_.exports={createSymlink:y9(I9),createSymlinkSync:_9}});var m_=g((wfe,d_)=>{"use strict";var Sf=ZI(),If=e_(),_f=p_();d_.exports={createFile:Sf.createFile,createFileSync:Sf.createFileSync,ensureFile:Sf.createFile,ensureFileSync:Sf.createFileSync,createLink:If.createLink,createLinkSync:If.createLinkSync,ensureLink:If.createLink,ensureLinkSync:If.createLinkSync,createSymlink:_f.createSymlink,createSymlinkSync:_f.createSymlinkSync,ensureSymlink:_f.createSymlink,ensureSymlinkSync:_f.createSymlinkSync}});var b_=g((xfe,y_)=>{var Ts;try{Ts=Ue()}catch{Ts=require("fs")}function O9(t,e,r){r==null&&(r=e,e={}),typeof e=="string"&&(e={encoding:e}),e=e||{};var n=e.fs||Ts,o=!0;"throws"in e&&(o=e.throws),n.readFile(t,e,function(i,s){if(i)return r(i);s=g_(s);var a;try{a=JSON.parse(s,e?e.reviver:null)}catch(l){return o?(l.message=t+": "+l.message,r(l)):r(null,null)}r(null,a)})}function T9(t,e){e=e||{},typeof e=="string"&&(e={encoding:e});var r=e.fs||Ts,n=!0;"throws"in e&&(n=e.throws);try{var o=r.readFileSync(t,e);return o=g_(o),JSON.parse(o,e.reviver)}catch(i){if(n)throw i.message=t+": "+i.message,i;return null}}function h_(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 C9(t,e,r,n){n==null&&(n=r,r={}),r=r||{};var o=r.fs||Ts,i="";try{i=h_(e,r)}catch(s){n&&n(s,null);return}o.writeFile(t,i,r,n)}function A9(t,e,r){r=r||{};var n=r.fs||Ts,o=h_(e,r);return n.writeFileSync(t,o,r)}function g_(t){return Buffer.isBuffer(t)&&(t=t.toString("utf8")),t=t.replace(/^\uFEFF/,""),t}var k9={readFile:O9,readFileSync:T9,writeFile:C9,writeFileSync:A9};y_.exports=k9});var Tf=g((Efe,w_)=>{"use strict";var v_=At().fromCallback,Of=b_();w_.exports={readJson:v_(Of.readFile),readJsonSync:Of.readFileSync,writeJson:v_(Of.writeFile),writeJsonSync:Of.writeFileSync}});var S_=g((Sfe,E_)=>{"use strict";var R9=require("path"),N9=Ht(),D9=Zr().pathExists,x_=Tf();function F9(t,e,r,n){typeof r=="function"&&(n=r,r={});let o=R9.dirname(t);D9(o,(i,s)=>{if(i)return n(i);if(s)return x_.writeJson(t,e,r,n);N9.mkdirs(o,a=>{if(a)return n(a);x_.writeJson(t,e,r,n)})})}E_.exports=F9});var __=g((Ife,I_)=>{"use strict";var P9=Ue(),M9=require("path"),$9=Ht(),L9=Tf();function j9(t,e,r){let n=M9.dirname(t);P9.existsSync(n)||$9.mkdirsSync(n),L9.writeJsonSync(t,e,r)}I_.exports=j9});var T_=g((_fe,O_)=>{"use strict";var q9=At().fromCallback,vt=Tf();vt.outputJson=q9(S_());vt.outputJsonSync=__();vt.outputJSON=vt.outputJson;vt.outputJSONSync=vt.outputJsonSync;vt.writeJSON=vt.writeJson;vt.writeJSONSync=vt.writeJsonSync;vt.readJSON=vt.readJson;vt.readJSONSync=vt.readJsonSync;O_.exports=vt});var D_=g((Ofe,N_)=>{"use strict";var k_=Ue(),B9=require("path"),z9=wy().copySync,R_=ml().removeSync,U9=Ht().mkdirpSync,C_=ll();function W9(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:o}=C_.checkPathsSync(t,e,"move");return C_.checkParentPathsSync(t,o,e,"move"),U9(B9.dirname(e)),H9(t,e,n)}function H9(t,e,r){if(r)return R_(e),A_(t,e,r);if(k_.existsSync(e))throw new Error("dest already exists.");return A_(t,e,r)}function A_(t,e,r){try{k_.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return K9(t,e,r)}}function K9(t,e,r){return z9(t,e,{overwrite:r,errorOnExist:!0}),R_(t)}N_.exports=W9});var P_=g((Tfe,F_)=>{"use strict";F_.exports={moveSync:D_()}});var q_=g((Cfe,j_)=>{"use strict";var V9=Ue(),G9=require("path"),Z9=Ey().copy,L_=ml().remove,J9=Ht().mkdirp,Y9=Zr().pathExists,M_=ll();function X9(t,e,r,n){typeof r=="function"&&(n=r,r={});let o=r.overwrite||r.clobber||!1;M_.checkPaths(t,e,"move",(i,s)=>{if(i)return n(i);let{srcStat:a}=s;M_.checkParentPaths(t,a,e,"move",l=>{if(l)return n(l);J9(G9.dirname(e),u=>u?n(u):Q9(t,e,o,n))})})}function Q9(t,e,r,n){if(r)return L_(e,o=>o?n(o):$_(t,e,r,n));Y9(e,(o,i)=>o?n(o):i?n(new Error("dest already exists.")):$_(t,e,r,n))}function $_(t,e,r,n){V9.rename(t,e,o=>o?o.code!=="EXDEV"?n(o):e4(t,e,r,n):n())}function e4(t,e,r,n){Z9(t,e,{overwrite:r,errorOnExist:!0},i=>i?n(i):L_(t,n))}j_.exports=X9});var z_=g((Afe,B_)=>{"use strict";var t4=At().fromCallback;B_.exports={move:t4(q_())}});var K_=g((kfe,H_)=>{"use strict";var r4=At().fromCallback,yl=Ue(),U_=require("path"),W_=Ht(),n4=Zr().pathExists;function o4(t,e,r,n){typeof r=="function"&&(n=r,r="utf8");let o=U_.dirname(t);n4(o,(i,s)=>{if(i)return n(i);if(s)return yl.writeFile(t,e,r,n);W_.mkdirs(o,a=>{if(a)return n(a);yl.writeFile(t,e,r,n)})})}function i4(t,...e){let r=U_.dirname(t);if(yl.existsSync(r))return yl.writeFileSync(t,...e);W_.mkdirsSync(r),yl.writeFileSync(t,...e)}H_.exports={outputFile:r4(o4),outputFileSync:i4}});var _y=g((Rfe,Iy)=>{"use strict";Iy.exports=Object.assign({},ay(),wy(),Ey(),HI(),m_(),T_(),Ht(),P_(),z_(),K_(),Zr(),ml());var V_=require("fs");Object.getOwnPropertyDescriptor(V_,"promises")&&Object.defineProperty(Iy.exports,"promises",{get(){return V_.promises}})});var Z_=g((Nfe,G_)=>{G_.exports=()=>new Date});var Y_=g((Dfe,J_)=>{var s4=Ze()("streamroller:fileNameFormatter"),a4=require("path"),l4=".gz",c4=".";J_.exports=({file:t,keepFileExt:e,needsIndex:r,alwaysIncludeDate:n,compress:o,fileNameSep:i})=>{let s=i||c4,a=a4.join(t.dir,t.name),l=d=>d+t.ext,u=(d,h,b)=>(r||!b)&&h?d+s+h:d,c=(d,h,b)=>(h>0||n)&&b?d+s+b:d,f=(d,h)=>h&&o?d+l4:d,p=e?[c,u,l,f]:[l,c,u,f];return({date:d,index:h})=>(s4(`_formatFileName: date=${d}, index=${h}`),p.reduce((b,y)=>y(b,h,d),a))}});var tO=g((Ffe,eO)=>{var fi=Ze()("streamroller:fileNameParser"),X_=".gz",Q_=ff(),u4=".";eO.exports=({file:t,keepFileExt:e,pattern:r,fileNameSep:n})=>{let o=n||u4,i=(p,d)=>p.endsWith(X_)?(fi("it is gzipped"),d.isCompressed=!0,p.slice(0,-1*X_.length)):p,s="__NOT_MATCHING__",f=[i,e?p=>p.startsWith(t.name)&&p.endsWith(t.ext)?(fi("it starts and ends with the right things"),p.slice(t.name.length+1,-1*t.ext.length)):s:p=>p.startsWith(t.base)?(fi("it starts with the right things"),p.slice(t.base.length+1)):s,r?(p,d)=>{let h=p.split(o),b=h[h.length-1];fi("items: ",h,", indexStr: ",b);let y=p;b!==void 0&&b.match(/^\d+$/)?(y=p.slice(0,-1*(b.length+1)),fi(`dateStr is ${y}`),r&&!y&&(y=b,b="0")):b="0";try{let v=Q_.parse(r,y,new Date(0,0));return Q_.asString(r,v)!==y?p:(d.index=parseInt(b,10),d.date=y,d.timestamp=v.getTime(),"")}catch(v){return fi(`Problem parsing ${y} as ${r}, error was: `,v),p}}:(p,d)=>p.match(/^\d+$/)?(fi("it has an index"),d.index=parseInt(p,10),""):p];return p=>{let d={filename:p,index:0,isCompressed:!1};return f.reduce((b,y)=>y(b,d),p)?null:d}}});var nO=g((Pfe,rO)=>{var Rt=Ze()("streamroller:moveAndMaybeCompressFile"),In=_y(),f4=require("zlib"),p4=function(t){let e={mode:parseInt("0600",8),compress:!1},r=Object.assign({},e,t);return Rt(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(r)}`),r},d4=async(t,e,r)=>{if(r=p4(r),t===e){Rt("moveAndMaybeCompressFile: source and target are the same, not doing anything");return}if(await In.pathExists(t))if(Rt(`moveAndMaybeCompressFile: moving file from ${t} to ${e} ${r.compress?"with":"without"} compress`),r.compress)await new Promise((n,o)=>{let i=!1,s=In.createWriteStream(e,{mode:r.mode,flags:"wx"}).on("open",()=>{i=!0;let a=In.createReadStream(t).on("open",()=>{a.pipe(f4.createGzip()).pipe(s)}).on("error",l=>{Rt(`moveAndMaybeCompressFile: error reading ${t}`,l),s.destroy(l)})}).on("finish",()=>{Rt(`moveAndMaybeCompressFile: finished compressing ${e}, deleting ${t}`),In.unlink(t).then(n).catch(a=>{Rt(`moveAndMaybeCompressFile: error deleting ${t}, truncating instead`,a),In.truncate(t).then(n).catch(l=>{Rt(`moveAndMaybeCompressFile: error truncating ${t}`,l),o(l)})})}).on("error",a=>{i?(Rt(`moveAndMaybeCompressFile: error writing ${e}, deleting`,a),In.unlink(e).then(()=>{o(a)}).catch(l=>{Rt(`moveAndMaybeCompressFile: error deleting ${e}`,l),o(l)})):(Rt(`moveAndMaybeCompressFile: error creating ${e}`,a),o(a))})}).catch(()=>{});else{Rt(`moveAndMaybeCompressFile: renaming ${t} to ${e}`);try{await In.move(t,e,{overwrite:!0})}catch(n){if(Rt(`moveAndMaybeCompressFile: error renaming ${t} to ${e}`,n),n.code!=="ENOENT"){Rt("moveAndMaybeCompressFile: trying copy+truncate instead");try{await In.copy(t,e,{overwrite:!0}),await In.truncate(t)}catch(o){Rt("moveAndMaybeCompressFile: error copy+truncate",o)}}}}};rO.exports=d4});var kf=g((Mfe,oO)=>{var Kt=Ze()("streamroller:RollingFileWriteStream"),di=_y(),pi=require("path"),m4=require("os"),Cf=Z_(),Af=ff(),{Writable:h4}=require("stream"),g4=Y_(),y4=tO(),b4=nO(),v4=t=>(Kt(`deleteFiles: files to delete: ${t}`),Promise.all(t.map(e=>di.unlink(e).catch(r=>{Kt(`deleteFiles: error when unlinking ${e}, ignoring. Error was ${r}`)})))),Oy=class extends h4{constructor(e,r){if(Kt(`constructor: creating RollingFileWriteStream. path=${e}`),typeof e!="string"||e.length===0)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(pi.sep))throw new Error(`Filename is a directory: ${e}`);e.indexOf(`~${pi.sep}`)===0&&(e=e.replace("~",m4.homedir())),super(r),this.options=this._parseOption(r),this.fileObject=pi.parse(e),this.fileObject.dir===""&&(this.fileObject=pi.parse(pi.join(process.cwd(),e))),this.fileFormatter=g4({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=y4({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=Af(this.options.pattern,Cf())),this.filename=this.fileFormatter({index:0,date:this.state.currentDate}),["a","a+","as","as+"].includes(this.options.flags)&&this._setExistingSizeAndDate(),Kt(`constructor: create new file ${this.filename}, state=${JSON.stringify(this.state)}`),this._renewWriteStream()}_setExistingSizeAndDate(){try{let e=di.statSync(this.filename);this.state.currentSize=e.size,this.options.pattern&&(this.state.currentDate=Af(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 Kt(`_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(()=>{Kt(`_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())&&(Kt(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==Af(this.options.pattern,Cf())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return Kt("_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--){Kt(`_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 b4(o,i,s)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?Af(this.options.pattern,Cf()):null,Kt(`_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 di.readdir(this.fileObject.dir).catch(()=>[]);Kt(`_getExistingFiles: files=${e}`);let r=e.map(o=>this.fileNameParser(o)).filter(o=>o),n=o=>(o.timestamp?o.timestamp:Cf().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 di.mkdirSync(i,{recursive:!0})}catch(s){if(s.code==="ENOENT")return r(pi.dirname(i)),r(i);if(s.code!=="EEXIST"&&s.code!=="EROFS")throw s;try{if(di.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};di.appendFileSync(e,"",o({...n},"flags","flag")),this.currentFileStream=di.createWriteStream(e,n),this.currentFileStream.on("error",i=>{this.emit("error",i)})}async _clean(){let e=await this._getExistingFiles();if(Kt(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${e.length}`),Kt("_clean: existing files are: ",e),this._tooManyFiles(e.length)){let r=e.slice(0,e.length-this.options.numToKeep).map(n=>pi.format({dir:this.fileObject.dir,base:n.filename}));await v4(r)}}_tooManyFiles(e){return this.options.numToKeep>0&&e>this.options.numToKeep}};oO.exports=Oy});var sO=g(($fe,iO)=>{var w4=kf(),Ty=class extends w4{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}};iO.exports=Ty});var lO=g((Lfe,aO)=>{var x4=kf(),Cy=class extends x4{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}};aO.exports=Cy});var Ay=g((jfe,cO)=>{cO.exports={RollingFileWriteStream:kf(),RollingFileStream:sO(),DateRollingFileStream:lO()}});var mO=g((qfe,dO)=>{var uO=Ze()("log4js:file"),ky=require("path"),E4=Ay(),pO=require("os"),S4=pO.EOL,Rf=!1,Nf=new Set;function fO(){Nf.forEach(t=>{t.sighupHandler()})}function I4(t,e,r,n,o,i){if(typeof t!="string"||t.length===0)throw new Error(`Invalid filename: ${t}`);if(t.endsWith(ky.sep))throw new Error(`Filename is a directory: ${t}`);t=t.replace(new RegExp(`^~(?=${ky.sep}.+)`),pO.homedir()),t=ky.normalize(t),n=!n&&n!==0?5:n,uO("Creating file appender (",t,", ",r,", ",n,", ",o,", ",i,")");function s(u,c,f,p){let d=new E4.RollingFileStream(u,c,f,p);return d.on("error",h=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",u,h)}),d.on("drain",()=>{process.emit("log4js:pause",!1)}),d}let a=s(t,r,n,o),l=function(u){if(a.writable){if(o.removeColor===!0){let c=/\x1b[[0-9;]*m/g;u.data=u.data.map(f=>typeof f=="string"?f.replace(c,""):f)}a.write(e(u,i)+S4,"utf8")||process.emit("log4js:pause",!0)}};return l.reopen=function(){a.end(()=>{a=s(t,r,n,o)})},l.sighupHandler=function(){uO("SIGHUP handler called."),l.reopen()},l.shutdown=function(u){Nf.delete(l),Nf.size===0&&Rf&&(process.removeListener("SIGHUP",fO),Rf=!1),a.end("","utf-8",u)},Nf.add(l),Rf||(process.on("SIGHUP",fO),Rf=!0),l}function _4(t,e){let r=e.basicLayout;return t.layout&&(r=e.layout(t.layout.type,t.layout)),t.mode=t.mode||384,I4(t.filename,r,t.maxLogSize,t.backups,t,t.timezoneOffset)}dO.exports.configure=_4});var gO=g((Bfe,hO)=>{var O4=Ay(),T4=require("os"),C4=T4.EOL;function A4(t,e,r){let n=new O4.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 k4(t,e,r,n,o){n.maxSize=n.maxLogSize;let i=A4(t,e,n),s=function(a){i.writable&&(i.write(r(a,o)+C4,"utf8")||process.emit("log4js:pause",!0))};return s.shutdown=function(a){i.end("","utf-8",a)},s}function R4(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,k4(t.filename,t.pattern,r,t,t.timezoneOffset)}hO.exports.configure=R4});var wO=g((zfe,vO)=>{var _n=Ze()("log4js:fileSync"),Yr=require("path"),Jr=require("fs"),yO=require("os"),N4=yO.EOL;function bO(t,e){let r=n=>{try{return Jr.mkdirSync(n,{recursive:!0})}catch(o){if(o.code==="ENOENT")return r(Yr.dirname(n)),r(n);if(o.code!=="EEXIST"&&o.code!=="EROFS")throw o;try{if(Jr.statSync(n).isDirectory())return n;throw o}catch{throw o}}};r(Yr.dirname(t)),Jr.appendFileSync(t,"",{mode:e.mode,flag:e.flags})}var Ry=class{constructor(e,r,n,o){if(_n("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 a=0;try{a=Jr.statSync(s).size}catch{bO(s,o)}return a}this.currentSize=i(this.filename)}shouldRoll(){return _n("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(`^${Yr.basename(e)}`);function o(u){return n.test(u)}function i(u){return parseInt(u.slice(`${Yr.basename(e)}.`.length),10)||0}function s(u,c){return i(u)-i(c)}function a(u){let c=i(u);if(_n(`Index of ${u} is ${c}`),r.backups===0)Jr.truncateSync(e,0);else if(c<r.backups){try{Jr.unlinkSync(`${e}.${c+1}`)}catch{}_n(`Renaming ${u} -> ${e}.${c+1}`),Jr.renameSync(Yr.join(Yr.dirname(e),u),`${e}.${c+1}`)}}function l(){_n("Renaming the old files"),Jr.readdirSync(Yr.dirname(e)).filter(o).sort(s).reverse().forEach(a)}_n("Rolling, rolling, rolling"),l()}write(e,r){let n=this;function o(){_n("writing the chunk to the file"),n.currentSize+=e.length,Jr.appendFileSync(n.filename,e)}_n("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),o()}};function D4(t,e,r,n,o,i){if(typeof t!="string"||t.length===0)throw new Error(`Invalid filename: ${t}`);if(t.endsWith(Yr.sep))throw new Error(`Filename is a directory: ${t}`);t=t.replace(new RegExp(`^~(?=${Yr.sep}.+)`),yO.homedir()),t=Yr.normalize(t),n=!n&&n!==0?5:n,_n("Creating fileSync appender (",t,", ",r,", ",n,", ",o,", ",i,")");function s(l,u,c){let f;return u?f=new Ry(l,u,c,o):f=(p=>(bO(p,o),{write(d){Jr.appendFileSync(p,d)}}))(l),f}let a=s(t,r,n);return l=>{a.write(e(l,i)+N4)}}function F4(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 D4(t.filename,r,t.maxLogSize,t.backups,n,t.timezoneOffset)}vO.exports.configure=F4});var EO=g((Ufe,xO)=>{var Xr=Ze()("log4js:tcp"),P4=require("net");function M4(t,e){let r=!1,n=[],o,i=3,s="__LOG4JS__";function a(f){Xr("Writing log event to socket"),r=o.write(`${e(f)}${s}`,"utf8")}function l(){let f;for(Xr("emptying buffer");f=n.shift();)a(f)}function u(){Xr(`appender creating socket to ${t.host||"localhost"}:${t.port||5e3}`),s=`${t.endMsg||"__LOG4JS__"}`,o=P4.createConnection(t.port||5e3,t.host||"localhost"),o.on("connect",()=>{Xr("socket connected"),l(),r=!0}),o.on("drain",()=>{Xr("drain event received, emptying buffer"),r=!0,l()}),o.on("timeout",o.end.bind(o)),o.on("error",f=>{Xr("connection error",f),r=!1,l()}),o.on("close",u)}u();function c(f){r?a(f):(Xr("buffering log event because it cannot write at the moment"),n.push(f))}return c.shutdown=function(f){Xr("shutdown called"),n.length&&i?(Xr("buffer has items, waiting 100ms to empty"),i-=1,setTimeout(()=>{c.shutdown(f)},100)):(o.removeAllListeners("close"),o.end(f))},c}function $4(t,e){Xr(`configure with config = ${t}`);let r=function(n){return n.serialise()};return t.layout&&(r=e.layout(t.layout.type,t.layout)),M4(t,r)}xO.exports.configure=$4});var Fy=g((Wfe,Dy)=>{var Ny=require("path"),po=Ze()("log4js:appenders"),fr=ii(),SO=hf(),L4=ai(),j4=Yg(),q4=w1(),Ar=new Map;Ar.set("console",E1());Ar.set("stdout",I1());Ar.set("stderr",O1());Ar.set("logLevelFilter",C1());Ar.set("categoryFilter",R1());Ar.set("noLogFilter",F1());Ar.set("file",mO());Ar.set("dateFile",gO());Ar.set("fileSync",wO());Ar.set("tcp",EO());var bl=new Map,Df=(t,e)=>{let r;try{let n=`${t}.cjs`;r=require.resolve(n),po("Loading module from ",n)}catch{r=t,po("Loading module from ",t)}try{return require(r)}catch(n){fr.throwExceptionIf(e,n.code!=="MODULE_NOT_FOUND",`appender "${t}" could not be loaded (error was: ${n})`);return}},B4=(t,e)=>Ar.get(t)||Df(`./${t}`,e)||Df(t,e)||require.main&&require.main.filename&&Df(Ny.join(Ny.dirname(require.main.filename),t),e)||Df(Ny.join(process.cwd(),t),e),Ff=new Set,IO=(t,e)=>{if(bl.has(t))return bl.get(t);if(!e.appenders[t])return!1;if(Ff.has(t))throw new Error(`Dependency loop detected for appender ${t}.`);Ff.add(t),po(`Creating appender ${t}`);let r=z4(t,e);return Ff.delete(t),bl.set(t,r),r},z4=(t,e)=>{let r=e.appenders[t],n=r.type.configure?r.type:B4(r.type,e);return fr.throwExceptionIf(e,fr.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"),po("[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"),po("[log4js-node-DEP0002]",`DEPRECATION: Appender ${r.type} exports a shutdown function.`)),po(`${t}: clustering.isMaster ? ${SO.isMaster()}`),po(`${t}: appenderModule is ${require("util").inspect(n)}`),SO.onlyOnMaster(()=>(po(`calling appenderModule.configure for ${t} / ${r.type}`),n.configure(q4.modifyConfig(r),j4,o=>IO(o,e),L4)),()=>{})},_O=t=>{if(bl.clear(),Ff.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")&&IO(r,t)})},OO=()=>{_O()};OO();fr.addListener(t=>{fr.throwExceptionIf(t,fr.not(fr.anObject(t.appenders)),'must have a property "appenders" of type object.');let e=Object.keys(t.appenders);fr.throwExceptionIf(t,fr.not(e.length),"must define at least one appender."),e.forEach(r=>{fr.throwExceptionIf(t,fr.not(t.appenders[r].type),`appender "${r}" is not valid (must be an object with property "type")`)})});fr.addListener(_O);Dy.exports=bl;Dy.exports.init=OO});var $y=g((Hfe,Pf)=>{var vl=Ze()("log4js:categories"),Fe=ii(),Py=ai(),TO=Fy(),mo=new Map;function CO(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:[]}),CO(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 U4(t){if(!t.categories)return;Object.keys(t.categories).forEach(r=>{let n=t.categories[r];CO(t,n,r)})}Fe.addPreProcessingListener(t=>U4(t));Fe.addListener(t=>{Fe.throwExceptionIf(t,Fe.not(Fe.anObject(t.categories)),'must have a property "categories" of type object.');let e=Object.keys(t.categories);Fe.throwExceptionIf(t,Fe.not(e.length),"must define at least one category."),e.forEach(r=>{let n=t.categories[r];Fe.throwExceptionIf(t,[Fe.not(n.appenders),Fe.not(n.level)],`category "${r}" is not valid (must be an object with properties "appenders" and "level")`),Fe.throwExceptionIf(t,Fe.not(Array.isArray(n.appenders)),`category "${r}" is not valid (appenders must be an array of appender names)`),Fe.throwExceptionIf(t,Fe.not(n.appenders.length),`category "${r}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(n,"enableCallStack")&&Fe.throwExceptionIf(t,typeof n.enableCallStack!="boolean",`category "${r}" is not valid (enableCallStack must be boolean type)`),n.appenders.forEach(o=>{Fe.throwExceptionIf(t,Fe.not(TO.get(o)),`category "${r}" is not valid (appender "${o}" is not defined)`)}),Fe.throwExceptionIf(t,Fe.not(Py.getLevel(n.level)),`category "${r}" is not valid (level "${n.level}" not recognised; valid levels are ${Py.levels.join(", ")})`)}),Fe.throwExceptionIf(t,Fe.not(t.categories.default),'must define a "default" category.')});var My=t=>{if(mo.clear(),!t)return;Object.keys(t.categories).forEach(r=>{let n=t.categories[r],o=[];n.appenders.forEach(i=>{o.push(TO.get(i)),vl(`Creating category ${r}`),mo.set(r,{appenders:o,level:Py.getLevel(n.level),enableCallStack:n.enableCallStack||!1})})})},AO=()=>{My()};AO();Fe.addListener(My);var Cs=t=>{if(vl(`configForCategory: searching for config for ${t}`),mo.has(t))return vl(`configForCategory: ${t} exists in config, returning it`),mo.get(t);let e;return t.indexOf(".")>0?(vl(`configForCategory: ${t} has hierarchy, cloning from parents`),e={...Cs(t.slice(0,t.lastIndexOf(".")))}):(mo.has("default")||My({categories:{default:{appenders:["out"],level:"OFF"}}}),vl("configForCategory: cloning default category"),e={...mo.get("default")}),mo.set(t,e),e},W4=t=>Cs(t).appenders,H4=t=>Cs(t).level,K4=(t,e)=>{Cs(t).level=e},V4=t=>Cs(t).enableCallStack===!0,G4=(t,e)=>{Cs(t).enableCallStack=e};Pf.exports=mo;Pf.exports=Object.assign(Pf.exports,{appendersForCategory:W4,getLevelForCategory:H4,setLevelForCategory:K4,getEnableCallStackForCategory:V4,setEnableCallStackForCategory:G4,init:AO})});var FO=g((Kfe,DO)=>{var kO=Ze()("log4js:logger"),Z4=Xg(),Qr=ai(),J4=hf(),Mf=$y(),RO=ii(),Y4=/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/;function X4(t,e=4){try{let r=t.stack.split(`
|
|
`).slice(e),n=Y4.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 wl=class{constructor(e){if(!e)throw new Error("No category provided.");this.category=e,this.context={},this.parseCallStack=X4,kO(`Logger created (${this.category}, ${this.level})`)}get level(){return Qr.getLevel(Mf.getLevelForCategory(this.category),Qr.OFF)}set level(e){Mf.setLevelForCategory(this.category,Qr.getLevel(e,this.level))}get useCallStack(){return Mf.getEnableCallStackForCategory(this.category)}set useCallStack(e){Mf.setEnableCallStackForCategory(this.category,e===!0)}log(e,...r){let n=Qr.getLevel(e);n?this.isLevelEnabled(n)&&this._log(n,r):RO.validIdentifier(e)&&r.length>0?(this.log(Qr.WARN,"log4js:logger.log: valid log-level not found as first parameter given:",e),this.log(Qr.INFO,`[${e}]`,...r)):this.log(Qr.INFO,e,...r)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(e,r){kO(`sending log data (${e}) to appenders`);let n=new Z4(this.category,e,r,this.context,this.useCallStack&&this.parseCallStack(new Error));J4.send(n)}addContext(e,r){this.context[e]=r}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){this.parseCallStack=e}};function NO(t){let e=Qr.getLevel(t),n=e.toString().toLowerCase().replace(/_([a-z])/g,i=>i[1].toUpperCase()),o=n[0].toUpperCase()+n.slice(1);wl.prototype[`is${o}Enabled`]=function(){return this.isLevelEnabled(e)},wl.prototype[n]=function(...i){this.log(e,...i)}}Qr.levels.forEach(NO);RO.addListener(()=>{Qr.levels.forEach(NO)});DO.exports=wl});var $O=g((Vfe,MO)=>{var As=ai(),Q4=':remote-addr - - ":method :url HTTP/:http-version" :status :content-length ":referrer" ":user-agent"';function eU(t){return t.originalUrl||t.url}function tU(t,e,r){let n=i=>{let s=i.concat();for(let a=0;a<s.length;++a)for(let l=a+1;l<s.length;++l)s[a].token==s[l].token&&s.splice(l--,1);return s},o=[];return o.push({token:":url",replacement:eU(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 PO(t,e){for(let r=0;r<e.length;r++)t=t.replace(e[r].token,e[r].replacement);return t}function rU(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 nU(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=As.getLevel(o.level,n))}return n}MO.exports=function(e,r){typeof r=="string"||typeof r=="function"?r={format:r}:r=r||{};let n=e,o=As.getLevel(r.level,As.INFO),i=r.format||Q4;return(s,a,l)=>{if(s._logging!==void 0)return l();if(typeof r.nolog!="function"){let u=rU(r.nolog);if(u&&u.test(s.originalUrl))return l()}if(n.isLevelEnabled(o)||r.level==="auto"){let u=new Date,{writeHead:c}=a;s._logging=!0,a.writeHead=(d,h)=>{a.writeHead=c,a.writeHead(d,h),a.__statusCode=d,a.__headers=h||{}};let f=!1,p=()=>{if(f)return;if(f=!0,typeof r.nolog=="function"&&r.nolog(s,a)===!0){s._logging=!1;return}a.responseTime=new Date-u,a.statusCode&&r.level==="auto"&&(o=As.INFO,a.statusCode>=300&&(o=As.WARN),a.statusCode>=400&&(o=As.ERROR)),o=nU(a.statusCode,o,r.statusRules);let d=tU(s,a,r.tokens||[]);if(r.context&&n.addContext("res",a),typeof i=="function"){let h=i(s,a,b=>PO(b,d));h&&n.log(o,h)}else n.log(o,PO(i,d));r.context&&n.removeContext("res")};a.on("end",p),a.on("finish",p),a.on("error",p),a.on("close",p)}return l()}}});var zO=g((Gfe,BO)=>{var LO=Ze()("log4js:recording"),$f=[];function oU(){return function(t){LO(`received logEvent, number of events now ${$f.length+1}`),LO("log event was ",t),$f.push(t)}}function jO(){return $f.slice()}function qO(){$f.length=0}BO.exports={configure:oU,replay:jO,playback:jO,reset:qO,erase:qO}});var ZO=g((Zfe,GO)=>{var ho=Ze()("log4js:main"),iU=require("fs"),sU=PS()({proto:!0}),aU=ii(),lU=Yg(),cU=ai(),UO=Fy(),WO=$y(),uU=FO(),fU=hf(),pU=$O(),dU=zO(),xl=!1;function mU(t){if(!xl)return;ho("Received log event ",t),WO.appendersForCategory(t.categoryName).forEach(r=>{r(t)})}function hU(t){ho(`Loading configuration from ${t}`);try{return JSON.parse(iU.readFileSync(t,"utf8"))}catch(e){throw new Error(`Problem reading config from file "${t}". Error was ${e.message}`,e)}}function HO(t){xl&&KO();let e=t;return typeof e=="string"&&(e=hU(t)),ho(`Configuration is ${e}`),aU.configure(sU(e)),fU.onMessage(mU),xl=!0,VO}function gU(){return dU}function KO(t){ho("Shutdown called. Disabling all log writing."),xl=!1;let e=Array.from(UO.values());UO.init(),WO.init();let r=e.reduceRight((s,a)=>a.shutdown?s+1:s,0);if(r===0)return ho("No appenders with shutdown functions found."),t!==void 0&&t();let n=0,o;ho(`Found ${r} appenders with shutdown functions.`);function i(s){o=o||s,n+=1,ho(`Appender shutdowns complete: ${n} / ${r}`),n>=r&&(ho("All shutdown functions completed."),t&&t(o))}return e.filter(s=>s.shutdown).forEach(s=>s.shutdown(i)),null}function yU(t){return xl||HO(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new uU(t||"default")}var VO={getLogger:yU,configure:HO,shutdown:KO,connectLogger:pU,levels:cU,addLayout:lU.addLayout,recording:gU};GO.exports=VO});var ks=g(Lf=>{"use strict";Object.defineProperty(Lf,"__esModule",{value:!0});function JO(t,e){if(e)return t;throw new Error("Unhandled discriminated union member: "+JSON.stringify(t))}Lf.assertNever=JO;Lf.default=JO});var QO=g((Yfe,XO)=>{"use strict";var bU=["h","min","s","ms","\u03BCs","ns"],vU=["hour","minute","second","millisecond","microsecond","nanosecond"],YO=[3600,60,1,1e6,1e3,1];XO.exports=function(t,e){var r,n,o,i,s,a,l,u,c,f;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&&(f=t[0]+t[1]/1e9,t[0]=parseInt(f),t[1]=parseFloat((f%1).toPrecision(9))*1e9),c="",o=0;o<6&&(i=o<3?0:1,s=t[i],o!==3&&o!==0&&(s=s%YO[o-1]),o===2&&(s+=t[1]/1e9),a=s/YO[o],!(a>=1&&(r&&(a=Math.floor(a)),n?u=a.toString():(l=a>=10?0:2,u=a.toFixed(l)),u.indexOf(".")>-1&&u[u.length-1]==="0"&&(u=u.replace(/\.?0+$/,"")),c&&(c+=" "),c+=u,r?(c+=" "+vU[o],u!=="1"&&(c+="s")):c+=" "+bU[o],!r)));o++);return c}});var tT=g((Xfe,eT)=>{"use strict";eT.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var sT=g((Qfe,iT)=>{"use strict";var oT="%[a-f0-9]{2}",rT=new RegExp("("+oT+")|([^%]+?)","gi"),nT=new RegExp("("+oT+")+","gi");function Ly(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([],Ly(r),Ly(n))}function wU(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(rT)||[],r=1;r<e.length;r++)t=Ly(e,r).join(""),e=t.match(rT)||[];return t}}function xU(t){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},r=nT.exec(t);r;){try{e[r[0]]=decodeURIComponent(r[0])}catch{var n=wU(r[0]);n!==r[0]&&(e[r[0]]=n)}r=nT.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}iT.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 xU(t)}}});var lT=g((epe,aT)=>{"use strict";aT.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 uT=g((tpe,cT)=>{"use strict";cT.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],a=t[s];(o?e.indexOf(s)!==-1:e(s,a,t))&&(r[s]=a)}return r}});var qy=g(Nt=>{"use strict";var EU=tT(),SU=sT(),pT=lT(),IU=uT(),_U=t=>t==null,jy=Symbol("encodeFragmentIdentifier");function OU(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,[Me(e,t),"[",o,"]"].join("")]:[...r,[Me(e,t),"[",Me(o,t),"]=",Me(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[Me(e,t),"[]"].join("")]:[...r,[Me(e,t),"[]=",Me(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,[Me(e,t),":list="].join("")]:[...r,[Me(e,t),":list=",Me(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?[[Me(r,t),e,Me(o,t)].join("")]:[[n,Me(o,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,Me(e,t)]:[...r,[Me(e,t),"=",Me(n,t)].join("")]}}function TU(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&&On(n,t).includes(t.arrayFormatSeparator);n=s?On(n,t):n;let a=i||s?n.split(t.arrayFormatSeparator).map(l=>On(l,t)):n===null?n:On(n,t);o[r]=a};case"bracket-separator":return(r,n,o)=>{let i=/(\[\])$/.test(r);if(r=r.replace(/\[\]$/,""),!i){o[r]=n&&On(n,t);return}let s=n===null?[]:n.split(t.arrayFormatSeparator).map(a=>On(a,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 dT(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Me(t,e){return e.encode?e.strict?EU(t):encodeURIComponent(t):t}function On(t,e){return e.decode?SU(t):t}function mT(t){return Array.isArray(t)?t.sort():typeof t=="object"?mT(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function hT(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function CU(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function gT(t){t=hT(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function fT(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 yT(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),dT(e.arrayFormatSeparator);let r=TU(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]=pT(e.decode?o.replace(/\+/g," "):o,"=");s=s===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?s:On(s,e),r(On(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]=fT(i[s],e);else n[o]=fT(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]=mT(s):o[i]=s,o},Object.create(null))}Nt.extract=gT;Nt.parse=yT;Nt.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),dT(e.arrayFormatSeparator);let r=s=>e.skipNull&&_U(t[s])||e.skipEmptyString&&t[s]==="",n=OU(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 a=t[s];return a===void 0?"":a===null?Me(s,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?Me(s,e)+"[]":a.reduce(n(s),[]).join("&"):Me(s,e)+"="+Me(a,e)}).filter(s=>s.length>0).join("&")};Nt.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=pT(t,"#");return Object.assign({url:r.split("?")[0]||"",query:yT(gT(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:On(n,e)}:{})};Nt.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[jy]:!0},e);let r=hT(t.url).split("?")[0]||"",n=Nt.extract(t.url),o=Nt.parse(n,{sort:!1}),i=Object.assign(o,t.query),s=Nt.stringify(i,e);s&&(s=`?${s}`);let a=CU(t.url);return t.fragmentIdentifier&&(a=`#${e[jy]?Me(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${s}${a}`};Nt.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[jy]:!1},r);let{url:n,query:o,fragmentIdentifier:i}=Nt.parseUrl(t,r);return Nt.stringifyUrl({url:n,query:IU(o,e),fragmentIdentifier:i},r)};Nt.exclude=(t,e,r)=>{let n=Array.isArray(e)?o=>!e.includes(o):(o,i)=>!e(o,i);return Nt.pick(t,n,r)}});function Nn(t,e){for(var r in e)t[r]=e[r];return t}function zA(t){var e=t.parentNode;e&&e.removeChild(t)}function H(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?Kl.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 Wl(t,s,n,o,null)}function Wl(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??++jA};return o==null&&q.vnode!=null&&q.vnode(i),i}function Tp(){return{current:null}}function M(t){return t.children}function Gt(t,e){this.props=t,this.context=e}function Hl(t,e){if(e==null)return t.__?Hl(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"?Hl(t):null}function UA(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 UA(t)}}function jb(t){(!t.__d&&(t.__d=!0)&&Ul.push(t)&&!_p.__r++||PA!==q.debounceRendering)&&((PA=q.debounceRendering)||setTimeout)(_p)}function _p(){for(var t;_p.__r=Ul.length;)t=Ul.sort(function(e,r){return e.__v.__b-r.__v.__b}),Ul=[],t.some(function(e){var r,n,o,i,s,a;e.__d&&(s=(i=(r=e).__v).__e,(a=r.__P)&&(n=[],(o=Nn({},i)).__v=i.__v+1,qb(a,i,o,r.__n,a.ownerSVGElement!==void 0,i.__h!=null?[s]:null,n,s??Hl(i),i.__h),VA(n,i),i.__e!=s&&UA(i)))})}function WA(t,e,r,n,o,i,s,a,l,u){var c,f,p,d,h,b,y,v=n&&n.__k||BA,x=v.length;for(r.__k=[],c=0;c<e.length;c++)if((d=r.__k[c]=(d=e[c])==null||typeof d=="boolean"?null:typeof d=="string"||typeof d=="number"||typeof d=="bigint"?Wl(null,d,null,null,d):Array.isArray(d)?Wl(M,{children:d},null,null,null):d.__b>0?Wl(d.type,d.props,d.key,d.ref?d.ref:null,d.__v):d)!=null){if(d.__=r,d.__b=r.__b+1,(p=v[c])===null||p&&d.key==p.key&&d.type===p.type)v[c]=void 0;else for(f=0;f<x;f++){if((p=v[f])&&d.key==p.key&&d.type===p.type){v[f]=void 0;break}p=null}qb(t,d,p=p||Ip,o,i,s,a,l,u),h=d.__e,(f=d.ref)&&p.ref!=f&&(y||(y=[]),p.ref&&y.push(p.ref,null,d),y.push(f,d.__c||h,d)),h!=null?(b==null&&(b=h),typeof d.type=="function"&&d.__k===p.__k?d.__d=l=HA(d,l,t):l=KA(t,d,p,v,h,l),typeof r.type=="function"&&(r.__d=l)):l&&p.__e==l&&l.parentNode!=t&&(l=Hl(p))}for(r.__e=b,c=x;c--;)v[c]!=null&&ZA(v[c],v[c]);if(y)for(c=0;c<y.length;c++)GA(y[c],y[++c],y[++c])}function HA(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"?HA(n,e,r):KA(r,n,n,o,n.__e,e));return e}function sn(t,e){return e=e||[],t==null||typeof t=="boolean"||(Array.isArray(t)?t.some(function(r){sn(r,e)}):e.push(t)),e}function KA(t,e,r,n,o,i){var s,a,l;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(a=i,l=0;(a=a.nextSibling)&&l<n.length;l+=1)if(a==o)break e;t.insertBefore(o,i),s=i}return s!==void 0?s:o.nextSibling}function s7(t,e,r,n,o){var i;for(i in r)i==="children"||i==="key"||i in e||Op(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]||Op(t,i,e[i],r[i],n)}function MA(t,e,r){e[0]==="-"?t.setProperty(e,r):t[e]=r==null?"":typeof r!="number"||i7.test(e)?r:r+"px"}function Op(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||MA(t.style,e,"");if(r)for(e in r)n&&r[e]===n[e]||MA(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?LA:$A,i):t.removeEventListener(e,i?LA:$A,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 $A(t){this.l[t.type+!1](q.event?q.event(t):t)}function LA(t){this.l[t.type+!0](q.event?q.event(t):t)}function qb(t,e,r,n,o,i,s,a,l){var u,c,f,p,d,h,b,y,v,x,T,$,V,J,G,K=e.type;if(e.constructor!==void 0)return null;r.__h!=null&&(l=r.__h,a=e.__e=r.__e,e.__h=null,i=[a]),(u=q.__b)&&u(e);try{e:if(typeof K=="function"){if(y=e.props,v=(u=K.contextType)&&n[u.__c],x=u?v?v.props.value:u.__:n,r.__c?b=(c=e.__c=r.__c).__=c.__E:("prototype"in K&&K.prototype.render?e.__c=c=new K(y,x):(e.__c=c=new Gt(y,x),c.constructor=K,c.render=l7),v&&v.sub(c),c.props=y,c.state||(c.state={}),c.context=x,c.__n=n,f=c.__d=!0,c.__h=[],c._sb=[]),c.__s==null&&(c.__s=c.state),K.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=Nn({},c.__s)),Nn(c.__s,K.getDerivedStateFromProps(y,c.__s))),p=c.props,d=c.state,f)K.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(K.getDerivedStateFromProps==null&&y!==p&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(y,x),!c.__e&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(y,c.__s,x)===!1||e.__v===r.__v){for(c.props=y,c.state=c.__s,e.__v!==r.__v&&(c.__d=!1),c.__v=e,e.__e=r.__e,e.__k=r.__k,e.__k.forEach(function(F){F&&(F.__=e)}),T=0;T<c._sb.length;T++)c.__h.push(c._sb[T]);c._sb=[],c.__h.length&&s.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(y,c.__s,x),c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(p,d,h)})}if(c.context=x,c.props=y,c.__v=e,c.__P=t,$=q.__r,V=0,"prototype"in K&&K.prototype.render){for(c.state=c.__s,c.__d=!1,$&&$(e),u=c.render(c.props,c.state,c.context),J=0;J<c._sb.length;J++)c.__h.push(c._sb[J]);c._sb=[]}else do c.__d=!1,$&&$(e),u=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++V<25);c.state=c.__s,c.getChildContext!=null&&(n=Nn(Nn({},n),c.getChildContext())),f||c.getSnapshotBeforeUpdate==null||(h=c.getSnapshotBeforeUpdate(p,d)),G=u!=null&&u.type===M&&u.key==null?u.props.children:u,WA(t,Array.isArray(G)?G:[G],e,r,n,o,i,s,a,l),c.base=e.__e,e.__h=null,c.__h.length&&s.push(c),b&&(c.__E=c.__=null),c.__e=!1}else i==null&&e.__v===r.__v?(e.__k=r.__k,e.__e=r.__e):e.__e=a7(r.__e,e,r,n,o,i,s,l);(u=q.diffed)&&u(e)}catch(F){e.__v=null,(l||i!=null)&&(e.__e=a,e.__h=!!l,i[i.indexOf(a)]=null),q.__e(F,e,r)}}function VA(t,e){q.__c&&q.__c(e,t),t.some(function(r){try{t=r.__h,r.__h=[],t.some(function(n){n.call(r)})}catch(n){q.__e(n,r.__v)}})}function a7(t,e,r,n,o,i,s,a){var l,u,c,f=r.props,p=e.props,d=e.type,h=0;if(d==="svg"&&(o=!0),i!=null){for(;h<i.length;h++)if((l=i[h])&&"setAttribute"in l==!!d&&(d?l.localName===d:l.nodeType===3)){t=l,i[h]=null;break}}if(t==null){if(d===null)return document.createTextNode(p);t=o?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d,p.is&&p),i=null,a=!1}if(d===null)f===p||a&&t.data===p||(t.data=p);else{if(i=i&&Kl.call(t.childNodes),u=(f=r.props||Ip).dangerouslySetInnerHTML,c=p.dangerouslySetInnerHTML,!a){if(i!=null)for(f={},h=0;h<t.attributes.length;h++)f[t.attributes[h].name]=t.attributes[h].value;(c||u)&&(c&&(u&&c.__html==u.__html||c.__html===t.innerHTML)||(t.innerHTML=c&&c.__html||""))}if(s7(t,p,f,o,a),c)e.__k=[];else if(h=e.props.children,WA(t,Array.isArray(h)?h:[h],e,r,n,o&&d!=="foreignObject",i,s,i?i[0]:r.__k&&Hl(r,0),a),i!=null)for(h=i.length;h--;)i[h]!=null&&zA(i[h]);a||("value"in p&&(h=p.value)!==void 0&&(h!==t.value||d==="progress"&&!h||d==="option"&&h!==f.value)&&Op(t,"value",h,f.value,!1),"checked"in p&&(h=p.checked)!==void 0&&h!==t.checked&&Op(t,"checked",h,f.checked,!1))}return t}function GA(t,e,r){try{typeof t=="function"?t(e):t.current=e}catch(n){q.__e(n,r)}}function ZA(t,e,r){var n,o;if(q.unmount&&q.unmount(t),(n=t.ref)&&(n.current&&n.current!==t.__e||GA(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){q.__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]&&ZA(n[o],e,r||typeof t.type!="function");r||t.__e==null||zA(t.__e),t.__=t.__e=t.__d=void 0}function l7(t,e,r){return this.constructor(t,r)}function Ws(t,e,r){var n,o,i;q.__&&q.__(t,e),o=(n=typeof r=="function")?null:r&&r.__k||e.__k,i=[],qb(e,t=(!n&&r||e).__k=H(M,null,[t]),o||Ip,Ip,e.ownerSVGElement!==void 0,!n&&r?[r]:o?null:e.firstChild?Kl.call(e.childNodes):null,i,!n&&r?r:o?o.__e:e.firstChild,n),VA(i,t)}function Bb(t,e){Ws(t,e,Bb)}function JA(t,e,r){var n,o,i,s=Nn({},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?Kl.call(arguments,2):r),Wl(t.type,s,n||t.key,o||t.ref,null)}function We(t,e){var r={__c:e="__cC"+qA++,__: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(jb)},this.sub=function(s){o.push(s);var a=s.componentWillUnmount;s.componentWillUnmount=function(){o.splice(o.indexOf(s),1),a&&a.call(s)}}),n.children}};return r.Provider.__=r.Consumer.contextType=r}var Kl,q,jA,o7,Ul,PA,qA,Ip,BA,i7,Hs=Yu(()=>{Ip={},BA=[],i7=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;Kl=BA.slice,q={__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(a){t=a}throw t}},jA=0,o7=function(t){return t!=null&&t.constructor===void 0},Gt.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Nn({},this.state),typeof t=="function"&&(t=t(Nn({},r),this.props)),t&&Nn(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),jb(this))},Gt.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),jb(this))},Gt.prototype.render=M,Ul=[],_p.__r=0,qA=0});function Si(t,e){q.__h&&q.__h(Oe,t,Ks||e),Ks=0;var r=Oe.__H||(Oe.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({__V:Cp}),r.__[t]}function L(t){return Ks=1,an(ik,t)}function an(t,e,r){var n=Si(So++,2);if(n.t=t,!n.__c&&(n.__=[r?r(e):ik(void 0,e),function(i){var s=n.__N?n.__N[0]:n.__[0],a=n.t(s,i);s!==a&&(n.__N=[a,n.__[1]],n.__c.setState({}))}],n.__c=Oe,!Oe.u)){Oe.u=!0;var o=Oe.shouldComponentUpdate;Oe.shouldComponentUpdate=function(i,s,a){if(!n.__c.__H)return!0;var l=n.__c.__H.__.filter(function(c){return c.__c});if(l.every(function(c){return!c.__N}))return!o||o.call(this,i,s,a);var u=!1;return l.forEach(function(c){if(c.__N){var f=c.__[0];c.__=c.__N,c.__N=void 0,f!==c.__[0]&&(u=!0)}}),!(!u&&n.__c.props===i)&&(!o||o.call(this,i,s,a))}}return n.__N||n.__}function U(t,e){var r=Si(So++,3);!q.__s&&Kb(r.__H,e)&&(r.__=t,r.i=e,Oe.__H.__h.push(r))}function Pt(t,e){var r=Si(So++,4);!q.__s&&Kb(r.__H,e)&&(r.__=t,r.i=e,Oe.__h.push(r))}function P(t){return Ks=5,ie(function(){return{current:t}},[])}function Wb(t,e,r){Ks=6,Pt(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 ie(t,e){var r=Si(So++,7);return Kb(r.__H,e)?(r.__V=t(),r.i=e,r.__h=t,r.__V):r.__}function X(t,e){return Ks=8,ie(function(){return t},e)}function te(t){var e=Oe.context[t.__c],r=Si(So++,9);return r.c=t,e?(r.__==null&&(r.__=!0,e.sub(Oe)),e.props.value):t.__}function Ii(t,e){q.useDebugValue&&q.useDebugValue(e?e(t):t)}function c7(t){var e=Si(So++,10),r=L();return e.__=t,Oe.componentDidCatch||(Oe.componentDidCatch=function(n,o){e.__&&e.__(n,o),r[1](n)}),[r[0],function(){r[1](void 0)}]}function Hb(){var t=Si(So++,11);if(!t.__){for(var e=Oe.__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 u7(){for(var t;t=ok.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Ap),t.__H.__h.forEach(Ub),t.__H.__h=[]}catch(e){t.__H.__h=[],q.__e(e,t.__v)}}function f7(t){var e,r=function(){clearTimeout(n),nk&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);nk&&(e=requestAnimationFrame(r))}function Ap(t){var e=Oe,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),Oe=e}function Ub(t){var e=Oe;t.__c=t.__(),Oe=e}function Kb(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}function ik(t,e){return typeof e=="function"?e(t):e}var So,Oe,zb,YA,Ks,ok,Cp,XA,QA,ek,tk,rk,nk,Vb=Yu(()=>{Hs();Ks=0,ok=[],Cp=[],XA=q.__b,QA=q.__r,ek=q.diffed,tk=q.__c,rk=q.unmount;q.__b=function(t){Oe=null,XA&&XA(t)},q.__r=function(t){QA&&QA(t),So=0;var e=(Oe=t.__c).__H;e&&(zb===Oe?(e.__h=[],Oe.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.__V=Cp,r.__N=r.i=void 0})):(e.__h.forEach(Ap),e.__h.forEach(Ub),e.__h=[])),zb=Oe},q.diffed=function(t){ek&&ek(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(ok.push(e)!==1&&YA===q.requestAnimationFrame||((YA=q.requestAnimationFrame)||f7)(u7)),e.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.__V!==Cp&&(r.__=r.__V),r.i=void 0,r.__V=Cp})),zb=Oe=null},q.__c=function(t,e){e.some(function(r){try{r.__h.forEach(Ap),r.__h=r.__h.filter(function(n){return!n.__||Ub(n)})}catch(n){e.some(function(o){o.__h&&(o.__h=[])}),e=[],q.__e(n,r.__v)}}),tk&&tk(t,e)},q.unmount=function(t){rk&&rk(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Ap(n)}catch(o){e=o}}),r.__H=void 0,e&&q.__e(e,r.__v))};nk=typeof requestAnimationFrame=="function"});function mk(t,e){for(var r in e)t[r]=e[r];return t}function Zb(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 Gb(t,e){return t===e&&(t!==0||1/t==1/e)||t!=t&&e!=e}function kp(t){this.props=t}function ht(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:Zb(this.props,o)}function n(o){return this.shouldComponentUpdate=r,H(t,o)}return n.displayName="Memo("+(t.displayName||t.name)+")",n.prototype.isReactComponent=!0,n.__f=!0,n}function Y(t){function e(r){var n=mk({},r);return delete n.ref,t(n,r.ref||null)}return e.$$typeof=p7,e.render=e,e.prototype.isReactComponent=e.__f=!0,e.displayName="ForwardRef("+(t.displayName||t.name)+")",e}function hk(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=mk({},t)).__c!=null&&(t.__c.__P===r&&(t.__c.__P=e),t.__c=null),t.__k=t.__k&&t.__k.map(function(n){return hk(n,e,r)})),t}function gk(t,e,r){return t&&(t.__v=null,t.__k=t.__k&&t.__k.map(function(n){return gk(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 Vl(){this.__u=0,this.t=null,this.__b=null}function yk(t){var e=t.__.__c;return e&&e.__a&&e.__a(t)}function bk(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 H(r,i)}return o.displayName="Lazy",o.__f=!0,o}function Vs(){this.u=null,this.o=null}function m7(t){return this.getChildContext=function(){return t.context},t.children}function h7(t){var e=this,r=t.i;e.componentWillUnmount=function(){Ws(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)}}),Ws(H(m7,{context:e.context},t.__v),e.l)):e.l&&e.componentWillUnmount()}function vk(t,e){var r=H(h7,{__v:t,i:e});return r.containerInfo=e,r}function xk(t,e,r){return e.__k==null&&(e.textContent=""),Ws(t,e),typeof r=="function"&&r(),t?t.__c:null}function Ek(t,e,r){return Bb(t,e),typeof r=="function"&&r(),t?t.__c:null}function v7(){}function w7(){return this.cancelBubble}function x7(){return this.defaultPrevented}function _k(t){return H.bind(null,t)}function Zt(t){return!!t&&t.$$typeof===wk}function gr(t){return Zt(t)?JA.apply(null,arguments):t}function Ok(t){return!!t.__k&&(Ws(null,t),!0)}function Tk(t){return t&&(t.base||t.nodeType===1&&t)||null}function Jb(t){t()}function kk(t){return t}function Rk(){return[!1,Jb]}function Dk(t,e){var r=e(),n=L({h:{__:r,v:e}}),o=n[0].h,i=n[1];return Pt(function(){o.__=r,o.v=e,Gb(o.__,e())||i({h:o})},[t,r,e]),U(function(){return Gb(o.__,o.v())||i({h:o}),t(function(){Gb(o.__,o.v())||i({h:o})})},[t]),r}var sk,p7,ak,Qe,d7,lk,ck,wk,g7,y7,b7,uk,Sk,fk,pk,dk,Ik,E7,Ck,ln,Ak,Nk,N,Yb=Yu(()=>{Hs();Hs();Vb();Vb();(kp.prototype=new Gt).isPureReactComponent=!0,kp.prototype.shouldComponentUpdate=function(t,e){return Zb(this.props,t)||Zb(this.state,e)};sk=q.__b;q.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),sk&&sk(t)};p7=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;ak=function(t,e){return t==null?null:sn(sn(t).map(e))},Qe={map:ak,forEach:ak,count:function(t){return t?sn(t).length:0},only:function(t){var e=sn(t);if(e.length!==1)throw"Children.only";return e[0]},toArray:sn},d7=q.__e;q.__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)}d7(t,e,r,n)};lk=q.unmount;q.unmount=function(t){var e=t.__c;e&&e.__R&&e.__R(),e&&t.__h===!0&&(t.type=null),lk&&lk(t)},(Vl.prototype=new Gt).__c=function(t,e){var r=e.__c,n=this;n.t==null&&(n.t=[]),n.t.push(r);var o=yk(n.__v),i=!1,s=function(){i||(i=!0,r.__R=null,o?o(a):a())};r.__R=s;var a=function(){if(!--n.__u){if(n.state.__a){var u=n.state.__a;n.__v.__k[0]=gk(u,u.__c.__P,u.__c.__O)}var c;for(n.setState({__a:n.__b=null});c=n.t.pop();)c.forceUpdate()}},l=e.__h===!0;n.__u++||l||n.setState({__a:n.__b=n.__v.__k[0]}),t.then(s,s)},Vl.prototype.componentWillUnmount=function(){this.t=[]},Vl.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]=hk(this.__b,r,n.__O=n.__P)}this.__b=null}var o=e.__a&&H(M,null,t.fallback);return o&&(o.__h=null),[H(M,null,e.__a?null:t.children),o]};ck=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]}};(Vs.prototype=new Gt).__a=function(t){var e=this,r=yk(e.__v),n=e.o.get(t);return n[0]++,function(o){var i=function(){e.props.revealOrder?(n.push(o),ck(e,t,n)):o()};r?r(i):i()}},Vs.prototype.render=function(t){this.u=null,this.o=new Map;var e=sn(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},Vs.prototype.componentDidUpdate=Vs.prototype.componentDidMount=function(){var t=this;this.o.forEach(function(e,r){ck(t,r,e)})};wk=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,g7=/^(?: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]/,y7=typeof document<"u",b7=function(t){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/i:/fil|che|ra/i).test(t)};Gt.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(Gt.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})});uk=q.event;q.event=function(t){return uk&&(t=uk(t)),t.persist=v7,t.isPropagationStopped=w7,t.isDefaultPrevented=x7,t.nativeEvent=t};fk={configurable:!0,get:function(){return this.class}},pk=q.vnode;q.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];y7&&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)&&!b7(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&&g7.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=sn(r.children).forEach(function(a){a.props.selected=n.value.indexOf(a.props.value)!=-1})),e=="select"&&n.defaultValue!=null&&(n.value=sn(r.children).forEach(function(a){a.props.selected=n.multiple?n.defaultValue.indexOf(a.props.value)!=-1:n.defaultValue==a.props.value})),t.props=n,r.class!=r.className&&(fk.enumerable="className"in r,r.className!=null&&(n.class=r.className),Object.defineProperty(n,"className",fk))}t.$$typeof=wk,pk&&pk(t)};dk=q.__r;q.__r=function(t){dk&&dk(t),Sk=t.__c};Ik={ReactCurrentDispatcher:{current:{readContext:function(t){return Sk.__n[t.__c].props.value}}}},E7="17.0.2";Ck=function(t,e){return t(e)},ln=function(t,e){return t(e)},Ak=M;Nk=Pt;N={useState:L,useId:Hb,useReducer:an,useEffect:U,useLayoutEffect:Pt,useInsertionEffect:Nk,useTransition:Rk,useDeferredValue:kk,useSyncExternalStore:Dk,startTransition:Jb,useRef:P,useImperativeHandle:Wb,useMemo:ie,useCallback:X,useContext:te,useDebugValue:Ii,version:"17.0.2",Children:Qe,render:xk,hydrate:Ek,unmountComponentAtNode:Ok,createPortal:vk,createElement:H,createContext:We,createFactory:_k,cloneElement:gr,createRef:Tp,Fragment:M,isValidElement:Zt,findDOMNode:Tk,Component:Gt,PureComponent:kp,memo:ht,forwardRef:Y,flushSync:ln,unstable_batchedUpdates:Ck,StrictMode:Ak,Suspense:Vl,SuspenseList:Vs,lazy:bk,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Ik}});var Nr={};oS(Nr,{Children:()=>Qe,Component:()=>Gt,Fragment:()=>M,PureComponent:()=>kp,StrictMode:()=>Ak,Suspense:()=>Vl,SuspenseList:()=>Vs,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:()=>Ik,cloneElement:()=>gr,createContext:()=>We,createElement:()=>H,createFactory:()=>_k,createPortal:()=>vk,createRef:()=>Tp,default:()=>N,findDOMNode:()=>Tk,flushSync:()=>ln,forwardRef:()=>Y,hydrate:()=>Ek,isValidElement:()=>Zt,lazy:()=>bk,memo:()=>ht,render:()=>xk,startTransition:()=>Jb,unmountComponentAtNode:()=>Ok,unstable_batchedUpdates:()=>Ck,useCallback:()=>X,useContext:()=>te,useDebugValue:()=>Ii,useDeferredValue:()=>kk,useEffect:()=>U,useErrorBoundary:()=>c7,useId:()=>Hb,useImperativeHandle:()=>Wb,useInsertionEffect:()=>Nk,useLayoutEffect:()=>Pt,useMemo:()=>ie,useReducer:()=>an,useRef:()=>P,useState:()=>L,useSyncExternalStore:()=>Dk,useTransition:()=>Rk,version:()=>E7});var S=Yu(()=>{Yb();Yb()});var Er=g((SD,ID)=>{"use strict";var um=function(t){return t&&t.Math===Math&&t};ID.exports=um(typeof globalThis=="object"&&globalThis)||um(typeof window=="object"&&window)||um(typeof self=="object"&&self)||um(typeof global=="object"&&global)||function(){return this}()||SD||Function("return this")()});var It=g((IOe,_D)=>{"use strict";_D.exports=function(t){try{return!!t()}catch{return!0}}});var zc=g((_Oe,OD)=>{"use strict";var QK=It();OD.exports=!QK(function(){var t=function(){}.bind();return typeof t!="function"||t.hasOwnProperty("prototype")})});var RD=g((OOe,kD)=>{"use strict";var eV=zc(),AD=Function.prototype,TD=AD.apply,CD=AD.call;kD.exports=typeof Reflect=="object"&&Reflect.apply||(eV?CD.bind(TD):function(){return CD.apply(TD,arguments)})});var _t=g((TOe,FD)=>{"use strict";var ND=zc(),DD=Function.prototype,L0=DD.call,tV=ND&&DD.bind.bind(L0,L0);FD.exports=ND?tV:function(t){return function(){return L0.apply(t,arguments)}}});var Hi=g((COe,MD)=>{"use strict";var PD=_t(),rV=PD({}.toString),nV=PD("".slice);MD.exports=function(t){return nV(rV(t),8,-1)}});var j0=g((AOe,$D)=>{"use strict";var oV=Hi(),iV=_t();$D.exports=function(t){if(oV(t)==="Function")return iV(t)}});var B0=g((kOe,LD)=>{"use strict";var q0=typeof document=="object"&&document.all,sV=typeof q0>"u"&&q0!==void 0;LD.exports={all:q0,IS_HTMLDDA:sV}});var ot=g((ROe,qD)=>{"use strict";var jD=B0(),aV=jD.all;qD.exports=jD.IS_HTMLDDA?function(t){return typeof t=="function"||t===aV}:function(t){return typeof t=="function"}});var Sr=g((NOe,BD)=>{"use strict";var lV=It();BD.exports=!lV(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var Gn=g((DOe,zD)=>{"use strict";var cV=zc(),fm=Function.prototype.call;zD.exports=cV?fm.bind(fm):function(){return fm.apply(fm,arguments)}});var KD=g(HD=>{"use strict";var UD={}.propertyIsEnumerable,WD=Object.getOwnPropertyDescriptor,uV=WD&&!UD.call({1:2},1);HD.f=uV?function(e){var r=WD(this,e);return!!r&&r.enumerable}:UD});var Uc=g((POe,VD)=>{"use strict";VD.exports=function(t,e){return{enumerable:!(t&1),configurable:!(t&2),writable:!(t&4),value:e}}});var U0=g((MOe,GD)=>{"use strict";var fV=_t(),pV=It(),dV=Hi(),z0=Object,mV=fV("".split);GD.exports=pV(function(){return!z0("z").propertyIsEnumerable(0)})?function(t){return dV(t)==="String"?mV(t,""):z0(t)}:z0});var ba=g(($Oe,ZD)=>{"use strict";ZD.exports=function(t){return t==null}});var Wc=g((LOe,JD)=>{"use strict";var hV=ba(),gV=TypeError;JD.exports=function(t){if(hV(t))throw gV("Can't call method on "+t);return t}});var va=g((jOe,YD)=>{"use strict";var yV=U0(),bV=Wc();YD.exports=function(t){return yV(bV(t))}});var qr=g((qOe,eF)=>{"use strict";var XD=ot(),QD=B0(),vV=QD.all;eF.exports=QD.IS_HTMLDDA?function(t){return typeof t=="object"?t!==null:XD(t)||t===vV}:function(t){return typeof t=="object"?t!==null:XD(t)}});var Hc=g((BOe,tF)=>{"use strict";tF.exports={}});var Ki=g((zOe,nF)=>{"use strict";var W0=Hc(),H0=Er(),wV=ot(),rF=function(t){return wV(t)?t:void 0};nF.exports=function(t,e){return arguments.length<2?rF(W0[t])||rF(H0[t]):W0[t]&&W0[t][e]||H0[t]&&H0[t][e]}});var pm=g((UOe,oF)=>{"use strict";var xV=_t();oF.exports=xV({}.isPrototypeOf)});var sF=g((WOe,iF)=>{"use strict";iF.exports=typeof navigator<"u"&&String(navigator.userAgent)||""});var dF=g((HOe,pF)=>{"use strict";var fF=Er(),K0=sF(),aF=fF.process,lF=fF.Deno,cF=aF&&aF.versions||lF&&lF.version,uF=cF&&cF.v8,Br,dm;uF&&(Br=uF.split("."),dm=Br[0]>0&&Br[0]<4?1:+(Br[0]+Br[1]));!dm&&K0&&(Br=K0.match(/Edge\/(\d+)/),(!Br||Br[1]>=74)&&(Br=K0.match(/Chrome\/(\d+)/),Br&&(dm=+Br[1])));pF.exports=dm});var V0=g((KOe,hF)=>{"use strict";var mF=dF(),EV=It(),SV=Er(),IV=SV.String;hF.exports=!!Object.getOwnPropertySymbols&&!EV(function(){var t=Symbol("symbol detection");return!IV(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&mF&&mF<41})});var G0=g((VOe,gF)=>{"use strict";var _V=V0();gF.exports=_V&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Z0=g((GOe,yF)=>{"use strict";var OV=Ki(),TV=ot(),CV=pm(),AV=G0(),kV=Object;yF.exports=AV?function(t){return typeof t=="symbol"}:function(t){var e=OV("Symbol");return TV(e)&&CV(e.prototype,kV(t))}});var mm=g((ZOe,bF)=>{"use strict";var RV=String;bF.exports=function(t){try{return RV(t)}catch{return"Object"}}});var Vi=g((JOe,vF)=>{"use strict";var NV=ot(),DV=mm(),FV=TypeError;vF.exports=function(t){if(NV(t))return t;throw FV(DV(t)+" is not a function")}});var hm=g((YOe,wF)=>{"use strict";var PV=Vi(),MV=ba();wF.exports=function(t,e){var r=t[e];return MV(r)?void 0:PV(r)}});var EF=g((XOe,xF)=>{"use strict";var J0=Gn(),Y0=ot(),X0=qr(),$V=TypeError;xF.exports=function(t,e){var r,n;if(e==="string"&&Y0(r=t.toString)&&!X0(n=J0(r,t))||Y0(r=t.valueOf)&&!X0(n=J0(r,t))||e!=="string"&&Y0(r=t.toString)&&!X0(n=J0(r,t)))return n;throw $V("Can't convert object to primitive value")}});var Kc=g((QOe,SF)=>{"use strict";SF.exports=!0});var OF=g((eTe,_F)=>{"use strict";var IF=Er(),LV=Object.defineProperty;_F.exports=function(t,e){try{LV(IF,t,{value:e,configurable:!0,writable:!0})}catch{IF[t]=e}return e}});var gm=g((tTe,CF)=>{"use strict";var jV=Er(),qV=OF(),TF="__core-js_shared__",BV=jV[TF]||qV(TF,{});CF.exports=BV});var Q0=g((rTe,kF)=>{"use strict";var zV=Kc(),AF=gm();(kF.exports=function(t,e){return AF[t]||(AF[t]=e!==void 0?e:{})})("versions",[]).push({version:"3.32.1",mode:zV?"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 ym=g((nTe,RF)=>{"use strict";var UV=Wc(),WV=Object;RF.exports=function(t){return WV(UV(t))}});var vn=g((oTe,NF)=>{"use strict";var HV=_t(),KV=ym(),VV=HV({}.hasOwnProperty);NF.exports=Object.hasOwn||function(e,r){return VV(KV(e),r)}});var bm=g((iTe,DF)=>{"use strict";var GV=_t(),ZV=0,JV=Math.random(),YV=GV(1 .toString);DF.exports=function(t){return"Symbol("+(t===void 0?"":t)+")_"+YV(++ZV+JV,36)}});var zr=g((sTe,PF)=>{"use strict";var XV=Er(),QV=Q0(),FF=vn(),eG=bm(),tG=V0(),rG=G0(),wa=XV.Symbol,ew=QV("wks"),nG=rG?wa.for||wa:wa&&wa.withoutSetter||eG;PF.exports=function(t){return FF(ew,t)||(ew[t]=tG&&FF(wa,t)?wa[t]:nG("Symbol."+t)),ew[t]}});var jF=g((aTe,LF)=>{"use strict";var oG=Gn(),MF=qr(),$F=Z0(),iG=hm(),sG=EF(),aG=zr(),lG=TypeError,cG=aG("toPrimitive");LF.exports=function(t,e){if(!MF(t)||$F(t))return t;var r=iG(t,cG),n;if(r){if(e===void 0&&(e="default"),n=oG(r,t,e),!MF(n)||$F(n))return n;throw lG("Can't convert object to primitive value")}return e===void 0&&(e="number"),sG(t,e)}});var Vc=g((lTe,qF)=>{"use strict";var uG=jF(),fG=Z0();qF.exports=function(t){var e=uG(t,"string");return fG(e)?e:e+""}});var rw=g((cTe,zF)=>{"use strict";var pG=Er(),BF=qr(),tw=pG.document,dG=BF(tw)&&BF(tw.createElement);zF.exports=function(t){return dG?tw.createElement(t):{}}});var nw=g((uTe,UF)=>{"use strict";var mG=Sr(),hG=It(),gG=rw();UF.exports=!mG&&!hG(function(){return Object.defineProperty(gG("div"),"a",{get:function(){return 7}}).a!==7})});var KF=g(HF=>{"use strict";var yG=Sr(),bG=Gn(),vG=KD(),wG=Uc(),xG=va(),EG=Vc(),SG=vn(),IG=nw(),WF=Object.getOwnPropertyDescriptor;HF.f=yG?WF:function(e,r){if(e=xG(e),r=EG(r),IG)try{return WF(e,r)}catch{}if(SG(e,r))return wG(!bG(vG.f,e,r),e[r])}});var GF=g((pTe,VF)=>{"use strict";var _G=It(),OG=ot(),TG=/#|\.prototype\./,Gc=function(t,e){var r=AG[CG(t)];return r===RG?!0:r===kG?!1:OG(e)?_G(e):!!e},CG=Gc.normalize=function(t){return String(t).replace(TG,".").toLowerCase()},AG=Gc.data={},kG=Gc.NATIVE="N",RG=Gc.POLYFILL="P";VF.exports=Gc});var Zc=g((dTe,JF)=>{"use strict";var ZF=j0(),NG=Vi(),DG=zc(),FG=ZF(ZF.bind);JF.exports=function(t,e){return NG(t),e===void 0?t:DG?FG(t,e):function(){return t.apply(e,arguments)}}});var ow=g((mTe,YF)=>{"use strict";var PG=Sr(),MG=It();YF.exports=PG&&MG(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var qo=g((hTe,XF)=>{"use strict";var $G=qr(),LG=String,jG=TypeError;XF.exports=function(t){if($G(t))return t;throw jG(LG(t)+" is not an object")}});var Bo=g(eP=>{"use strict";var qG=Sr(),BG=nw(),zG=ow(),vm=qo(),QF=Vc(),UG=TypeError,iw=Object.defineProperty,WG=Object.getOwnPropertyDescriptor,sw="enumerable",aw="configurable",lw="writable";eP.f=qG?zG?function(e,r,n){if(vm(e),r=QF(r),vm(n),typeof e=="function"&&r==="prototype"&&"value"in n&&lw in n&&!n[lw]){var o=WG(e,r);o&&o[lw]&&(e[r]=n.value,n={configurable:aw in n?n[aw]:o[aw],enumerable:sw in n?n[sw]:o[sw],writable:!1})}return iw(e,r,n)}:iw:function(e,r,n){if(vm(e),r=QF(r),vm(n),BG)try{return iw(e,r,n)}catch{}if("get"in n||"set"in n)throw UG("Accessors not supported");return"value"in n&&(e[r]=n.value),e}});var Gi=g((yTe,tP)=>{"use strict";var HG=Sr(),KG=Bo(),VG=Uc();tP.exports=HG?function(t,e,r){return KG.f(t,e,VG(1,r))}:function(t,e,r){return t[e]=r,t}});var Zi=g((bTe,nP)=>{"use strict";var wm=Er(),GG=RD(),ZG=j0(),JG=ot(),YG=KF().f,XG=GF(),xa=Hc(),QG=Zc(),Ea=Gi(),rP=vn(),eZ=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 GG(t,this,arguments)};return e.prototype=t.prototype,e};nP.exports=function(t,e){var r=t.target,n=t.global,o=t.stat,i=t.proto,s=n?wm:o?wm[r]:(wm[r]||{}).prototype,a=n?xa:xa[r]||Ea(xa,r,{})[r],l=a.prototype,u,c,f,p,d,h,b,y,v;for(p in e)u=XG(n?p:r+(o?".":"#")+p,t.forced),c=!u&&s&&rP(s,p),h=a[p],c&&(t.dontCallGetSet?(v=YG(s,p),b=v&&v.value):b=s[p]),d=c&&b?b:e[p],!(c&&typeof h==typeof d)&&(t.bind&&c?y=QG(d,wm):t.wrap&&c?y=eZ(d):i&&JG(d)?y=ZG(d):y=d,(t.sham||d&&d.sham||h&&h.sham)&&Ea(y,"sham",!0),Ea(a,p,y),i&&(f=r+"Prototype",rP(xa,f)||Ea(xa,f,{}),Ea(xa[f],p,d),t.real&&l&&(u||!l[p])&&Ea(l,p,d)))}});var Jc=g((vTe,oP)=>{"use strict";oP.exports={}});var sP=g((wTe,iP)=>{"use strict";var tZ=Math.ceil,rZ=Math.floor;iP.exports=Math.trunc||function(e){var r=+e;return(r>0?rZ:tZ)(r)}});var cw=g((xTe,aP)=>{"use strict";var nZ=sP();aP.exports=function(t){var e=+t;return e!==e||e===0?0:nZ(e)}});var uw=g((ETe,lP)=>{"use strict";var oZ=cw(),iZ=Math.max,sZ=Math.min;lP.exports=function(t,e){var r=oZ(t);return r<0?iZ(r+e,0):sZ(r,e)}});var uP=g((STe,cP)=>{"use strict";var aZ=cw(),lZ=Math.min;cP.exports=function(t){return t>0?lZ(aZ(t),9007199254740991):0}});var Yc=g((ITe,fP)=>{"use strict";var cZ=uP();fP.exports=function(t){return cZ(t.length)}});var mP=g((_Te,dP)=>{"use strict";var uZ=va(),fZ=uw(),pZ=Yc(),pP=function(t){return function(e,r,n){var o=uZ(e),i=pZ(o),s=fZ(n,i),a;if(t&&r!==r){for(;i>s;)if(a=o[s++],a!==a)return!0}else for(;i>s;s++)if((t||s in o)&&o[s]===r)return t||s||0;return!t&&-1}};dP.exports={includes:pP(!0),indexOf:pP(!1)}});var pw=g((OTe,gP)=>{"use strict";var dZ=_t(),fw=vn(),mZ=va(),hZ=mP().indexOf,gZ=Jc(),hP=dZ([].push);gP.exports=function(t,e){var r=mZ(t),n=0,o=[],i;for(i in r)!fw(gZ,i)&&fw(r,i)&&hP(o,i);for(;e.length>n;)fw(r,i=e[n++])&&(~hZ(o,i)||hP(o,i));return o}});var xm=g((TTe,yP)=>{"use strict";yP.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var dw=g(bP=>{"use strict";var yZ=pw(),bZ=xm(),vZ=bZ.concat("length","prototype");bP.f=Object.getOwnPropertyNames||function(e){return yZ(e,vZ)}});var wP=g((ATe,vP)=>{"use strict";var wZ=Vc(),xZ=Bo(),EZ=Uc();vP.exports=function(t,e,r){var n=wZ(e);n in t?xZ.f(t,n,EZ(0,r)):t[n]=r}});var SP=g((kTe,EP)=>{"use strict";var xP=uw(),SZ=Yc(),IZ=wP(),_Z=Array,OZ=Math.max;EP.exports=function(t,e,r){for(var n=SZ(t),o=xP(e,n),i=xP(r===void 0?n:r,n),s=_Z(OZ(i-o,0)),a=0;o<i;o++,a++)IZ(s,a,t[o]);return s.length=a,s}});var TP=g((RTe,OP)=>{"use strict";var TZ=Hi(),CZ=va(),IP=dw().f,AZ=SP(),_P=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],kZ=function(t){try{return IP(t)}catch{return AZ(_P)}};OP.exports.f=function(e){return _P&&TZ(e)==="Window"?kZ(e):IP(CZ(e))}});var AP=g((NTe,CP)=>{"use strict";var RZ=It();CP.exports=RZ(function(){if(typeof ArrayBuffer=="function"){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}})});var NP=g((DTe,RP)=>{"use strict";var NZ=It(),DZ=qr(),FZ=Hi(),kP=AP(),Em=Object.isExtensible,PZ=NZ(function(){Em(1)});RP.exports=PZ||kP?function(e){return!DZ(e)||kP&&FZ(e)==="ArrayBuffer"?!1:Em?Em(e):!0}:Em});var FP=g((FTe,DP)=>{"use strict";var MZ=It();DP.exports=!MZ(function(){return Object.isExtensible(Object.preventExtensions({}))})});var yw=g((PTe,$P)=>{"use strict";var $Z=Zi(),LZ=_t(),jZ=Jc(),qZ=qr(),mw=vn(),BZ=Bo().f,PP=dw(),zZ=TP(),hw=NP(),UZ=bm(),WZ=FP(),MP=!1,Zn=UZ("meta"),HZ=0,gw=function(t){BZ(t,Zn,{value:{objectID:"O"+HZ++,weakData:{}}})},KZ=function(t,e){if(!qZ(t))return typeof t=="symbol"?t:(typeof t=="string"?"S":"P")+t;if(!mw(t,Zn)){if(!hw(t))return"F";if(!e)return"E";gw(t)}return t[Zn].objectID},VZ=function(t,e){if(!mw(t,Zn)){if(!hw(t))return!0;if(!e)return!1;gw(t)}return t[Zn].weakData},GZ=function(t){return WZ&&MP&&hw(t)&&!mw(t,Zn)&&gw(t),t},ZZ=function(){JZ.enable=function(){},MP=!0;var t=PP.f,e=LZ([].splice),r={};r[Zn]=1,t(r).length&&(PP.f=function(n){for(var o=t(n),i=0,s=o.length;i<s;i++)if(o[i]===Zn){e(o,i,1);break}return o},$Z({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:zZ.f}))},JZ=$P.exports={enable:ZZ,fastKey:KZ,getWeakData:VZ,onFreeze:GZ};jZ[Zn]=!0});var Xc=g((MTe,LP)=>{"use strict";LP.exports={}});var qP=g(($Te,jP)=>{"use strict";var YZ=zr(),XZ=Xc(),QZ=YZ("iterator"),eJ=Array.prototype;jP.exports=function(t){return t!==void 0&&(XZ.Array===t||eJ[QZ]===t)}});var Sm=g((LTe,zP)=>{"use strict";var tJ=zr(),rJ=tJ("toStringTag"),BP={};BP[rJ]="z";zP.exports=String(BP)==="[object z]"});var _m=g((jTe,UP)=>{"use strict";var nJ=Sm(),oJ=ot(),Im=Hi(),iJ=zr(),sJ=iJ("toStringTag"),aJ=Object,lJ=Im(function(){return arguments}())==="Arguments",cJ=function(t,e){try{return t[e]}catch{}};UP.exports=nJ?Im:function(t){var e,r,n;return t===void 0?"Undefined":t===null?"Null":typeof(r=cJ(e=aJ(t),sJ))=="string"?r:lJ?Im(e):(n=Im(e))==="Object"&&oJ(e.callee)?"Arguments":n}});var bw=g((qTe,HP)=>{"use strict";var uJ=_m(),WP=hm(),fJ=ba(),pJ=Xc(),dJ=zr(),mJ=dJ("iterator");HP.exports=function(t){if(!fJ(t))return WP(t,mJ)||WP(t,"@@iterator")||pJ[uJ(t)]}});var VP=g((BTe,KP)=>{"use strict";var hJ=Gn(),gJ=Vi(),yJ=qo(),bJ=mm(),vJ=bw(),wJ=TypeError;KP.exports=function(t,e){var r=arguments.length<2?vJ(t):e;if(gJ(r))return yJ(hJ(r,t));throw wJ(bJ(t)+" is not iterable")}});var JP=g((zTe,ZP)=>{"use strict";var xJ=Gn(),GP=qo(),EJ=hm();ZP.exports=function(t,e,r){var n,o;GP(t);try{if(n=EJ(t,"return"),!n){if(e==="throw")throw r;return r}n=xJ(n,t)}catch(i){o=!0,n=i}if(e==="throw")throw r;if(o)throw n;return GP(n),r}});var Qc=g((UTe,eM)=>{"use strict";var SJ=Zc(),IJ=Gn(),_J=qo(),OJ=mm(),TJ=qP(),CJ=Yc(),YP=pm(),AJ=VP(),kJ=bw(),XP=JP(),RJ=TypeError,Om=function(t,e){this.stopped=t,this.result=e},QP=Om.prototype;eM.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),a=!!(r&&r.INTERRUPTED),l=SJ(e,n),u,c,f,p,d,h,b,y=function(x){return u&&XP(u,"normal",x),new Om(!0,x)},v=function(x){return o?(_J(x),a?l(x[0],x[1],y):l(x[0],x[1])):a?l(x,y):l(x)};if(i)u=t.iterator;else if(s)u=t;else{if(c=kJ(t),!c)throw RJ(OJ(t)+" is not iterable");if(TJ(c)){for(f=0,p=CJ(t);p>f;f++)if(d=v(t[f]),d&&YP(QP,d))return d;return new Om(!1)}u=AJ(t,c)}for(h=i?t.next:u.next;!(b=IJ(h,u)).done;){try{d=v(b.value)}catch(x){XP(u,"throw",x)}if(typeof d=="object"&&d&&YP(QP,d))return d}return new Om(!1)}});var vw=g((WTe,tM)=>{"use strict";var NJ=pm(),DJ=TypeError;tM.exports=function(t,e){if(NJ(e,t))return t;throw DJ("Incorrect invocation")}});var nM=g((HTe,rM)=>{"use strict";var FJ=Sm(),PJ=_m();rM.exports=FJ?{}.toString:function(){return"[object "+PJ(this)+"]"}});var Tm=g((KTe,iM)=>{"use strict";var MJ=Sm(),$J=Bo().f,LJ=Gi(),jJ=vn(),qJ=nM(),BJ=zr(),oM=BJ("toStringTag");iM.exports=function(t,e,r,n){if(t){var o=r?t:t.prototype;jJ(o,oM)||$J(o,oM,{configurable:!0,value:e}),n&&!MJ&&LJ(o,"toString",qJ)}}});var aM=g((VTe,sM)=>{"use strict";var zJ=Hi();sM.exports=Array.isArray||function(e){return zJ(e)==="Array"}});var cM=g((GTe,lM)=>{"use strict";var UJ=_t(),WJ=ot(),ww=gm(),HJ=UJ(Function.toString);WJ(ww.inspectSource)||(ww.inspectSource=function(t){return HJ(t)});lM.exports=ww.inspectSource});var hM=g((ZTe,mM)=>{"use strict";var KJ=_t(),VJ=It(),uM=ot(),GJ=_m(),ZJ=Ki(),JJ=cM(),fM=function(){},YJ=[],pM=ZJ("Reflect","construct"),xw=/^\s*(?:class|function)\b/,XJ=KJ(xw.exec),QJ=!xw.exec(fM),eu=function(e){if(!uM(e))return!1;try{return pM(fM,YJ,e),!0}catch{return!1}},dM=function(e){if(!uM(e))return!1;switch(GJ(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return QJ||!!XJ(xw,JJ(e))}catch{return!0}};dM.sham=!0;mM.exports=!pM||VJ(function(){var t;return eu(eu.call)||!eu(Object)||!eu(function(){t=!0})||t})?dM:eu});var vM=g((JTe,bM)=>{"use strict";var gM=aM(),eY=hM(),tY=qr(),rY=zr(),nY=rY("species"),yM=Array;bM.exports=function(t){var e;return gM(t)&&(e=t.constructor,eY(e)&&(e===yM||gM(e.prototype))?e=void 0:tY(e)&&(e=e[nY],e===null&&(e=void 0))),e===void 0?yM:e}});var xM=g((YTe,wM)=>{"use strict";var oY=vM();wM.exports=function(t,e){return new(oY(t))(e===0?0:e)}});var IM=g((XTe,SM)=>{"use strict";var iY=Zc(),sY=_t(),aY=U0(),lY=ym(),cY=Yc(),uY=xM(),EM=sY([].push),zo=function(t){var e=t===1,r=t===2,n=t===3,o=t===4,i=t===6,s=t===7,a=t===5||i;return function(l,u,c,f){for(var p=lY(l),d=aY(p),h=iY(u,c),b=cY(d),y=0,v=f||uY,x=e?v(l,b):r||s?v(l,0):void 0,T,$;b>y;y++)if((a||y in d)&&(T=d[y],$=h(T,y,p),t))if(e)x[y]=$;else if($)switch(t){case 3:return!0;case 5:return T;case 6:return y;case 2:EM(x,T)}else switch(t){case 4:return!1;case 7:EM(x,T)}return i?-1:n||o?o:x}};SM.exports={forEach:zo(0),map:zo(1),filter:zo(2),some:zo(3),every:zo(4),find:zo(5),findIndex:zo(6),filterReject:zo(7)}});var TM=g((QTe,OM)=>{"use strict";var fY=Er(),pY=ot(),_M=fY.WeakMap;OM.exports=pY(_M)&&/native code/.test(String(_M))});var Cm=g((eCe,AM)=>{"use strict";var dY=Q0(),mY=bm(),CM=dY("keys");AM.exports=function(t){return CM[t]||(CM[t]=mY(t))}});var _w=g((tCe,NM)=>{"use strict";var hY=TM(),RM=Er(),gY=qr(),yY=Gi(),Ew=vn(),Sw=gm(),bY=Cm(),vY=Jc(),kM="Object already initialized",Iw=RM.TypeError,wY=RM.WeakMap,Am,tu,km,xY=function(t){return km(t)?tu(t):Am(t,{})},EY=function(t){return function(e){var r;if(!gY(e)||(r=tu(e)).type!==t)throw Iw("Incompatible receiver, "+t+" required");return r}};hY||Sw.state?(Ur=Sw.state||(Sw.state=new wY),Ur.get=Ur.get,Ur.has=Ur.has,Ur.set=Ur.set,Am=function(t,e){if(Ur.has(t))throw Iw(kM);return e.facade=t,Ur.set(t,e),e},tu=function(t){return Ur.get(t)||{}},km=function(t){return Ur.has(t)}):(Ji=bY("state"),vY[Ji]=!0,Am=function(t,e){if(Ew(t,Ji))throw Iw(kM);return e.facade=t,yY(t,Ji,e),e},tu=function(t){return Ew(t,Ji)?t[Ji]:{}},km=function(t){return Ew(t,Ji)});var Ur,Ji;NM.exports={set:Am,get:tu,has:km,enforce:xY,getterFor:EY}});var PM=g((rCe,FM)=>{"use strict";var SY=Zi(),IY=Er(),_Y=yw(),OY=It(),TY=Gi(),CY=Qc(),AY=vw(),kY=ot(),RY=qr(),NY=ba(),DY=Tm(),FY=Bo().f,PY=IM().forEach,MY=Sr(),DM=_w(),$Y=DM.set,LY=DM.getterFor;FM.exports=function(t,e,r){var n=t.indexOf("Map")!==-1,o=t.indexOf("Weak")!==-1,i=n?"set":"add",s=IY[t],a=s&&s.prototype,l={},u;if(!MY||!kY(s)||!(o||a.forEach&&!OY(function(){new s().entries().next()})))u=r.getConstructor(e,t,n,i),_Y.enable();else{u=e(function(p,d){$Y(AY(p,c),{type:t,collection:new s}),NY(d)||CY(d,p[i],{that:p,AS_ENTRIES:n})});var c=u.prototype,f=LY(t);PY(["add","clear","delete","forEach","get","has","set","keys","values","entries"],function(p){var d=p==="add"||p==="set";p in a&&!(o&&p==="clear")&&TY(c,p,function(h,b){var y=f(this).collection;if(!d&&o&&!RY(h))return p==="get"?void 0:!1;var v=y[p](h===0?0:h,b);return d?this:v})}),o||FY(c,"size",{configurable:!0,get:function(){return f(this).collection.size}})}return DY(u,t,!1,!0),l[t]=u,SY({global:!0,forced:!0},l),o||r.setStrong(u,t,n),u}});var $M=g((nCe,MM)=>{"use strict";var jY=pw(),qY=xm();MM.exports=Object.keys||function(e){return jY(e,qY)}});var jM=g(LM=>{"use strict";var BY=Sr(),zY=ow(),UY=Bo(),WY=qo(),HY=va(),KY=$M();LM.f=BY&&!zY?Object.defineProperties:function(e,r){WY(e);for(var n=HY(r),o=KY(r),i=o.length,s=0,a;i>s;)UY.f(e,a=o[s++],n[a]);return e}});var BM=g((iCe,qM)=>{"use strict";var VY=Ki();qM.exports=VY("document","documentElement")});var ru=g((sCe,GM)=>{"use strict";var GY=qo(),ZY=jM(),zM=xm(),JY=Jc(),YY=BM(),XY=rw(),QY=Cm(),UM=">",WM="<",Tw="prototype",Cw="script",KM=QY("IE_PROTO"),Ow=function(){},VM=function(t){return WM+Cw+UM+t+WM+"/"+Cw+UM},HM=function(t){t.write(VM("")),t.close();var e=t.parentWindow.Object;return t=null,e},eX=function(){var t=XY("iframe"),e="java"+Cw+":",r;return t.style.display="none",YY.appendChild(t),t.src=String(e),r=t.contentWindow.document,r.open(),r.write(VM("document.F=Object")),r.close(),r.F},Rm,Nm=function(){try{Rm=new ActiveXObject("htmlfile")}catch{}Nm=typeof document<"u"?document.domain&&Rm?HM(Rm):eX():HM(Rm);for(var t=zM.length;t--;)delete Nm[Tw][zM[t]];return Nm()};JY[KM]=!0;GM.exports=Object.create||function(e,r){var n;return e!==null?(Ow[Tw]=GY(e),n=new Ow,Ow[Tw]=null,n[KM]=e):n=Nm(),r===void 0?n:ZY.f(n,r)}});var Aw=g((aCe,ZM)=>{"use strict";var tX=Bo();ZM.exports=function(t,e,r){return tX.f(t,e,r)}});var Dm=g((lCe,JM)=>{"use strict";var rX=Gi();JM.exports=function(t,e,r,n){return n&&n.enumerable?t[e]=r:rX(t,e,r),t}});var XM=g((cCe,YM)=>{"use strict";var nX=Dm();YM.exports=function(t,e,r){for(var n in e)r&&r.unsafe&&t[n]?t[n]=e[n]:nX(t,n,e[n],r);return t}});var t$=g((uCe,e$)=>{"use strict";var kw=Sr(),oX=vn(),QM=Function.prototype,iX=kw&&Object.getOwnPropertyDescriptor,Rw=oX(QM,"name"),sX=Rw&&function(){}.name==="something",aX=Rw&&(!kw||kw&&iX(QM,"name").configurable);e$.exports={EXISTS:Rw,PROPER:sX,CONFIGURABLE:aX}});var n$=g((fCe,r$)=>{"use strict";var lX=It();r$.exports=!lX(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})});var Dw=g((pCe,i$)=>{"use strict";var cX=vn(),uX=ot(),fX=ym(),pX=Cm(),dX=n$(),o$=pX("IE_PROTO"),Nw=Object,mX=Nw.prototype;i$.exports=dX?Nw.getPrototypeOf:function(t){var e=fX(t);if(cX(e,o$))return e[o$];var r=e.constructor;return uX(r)&&e instanceof r?r.prototype:e instanceof Nw?mX:null}});var $w=g((dCe,l$)=>{"use strict";var hX=It(),gX=ot(),yX=qr(),bX=ru(),s$=Dw(),vX=Dm(),wX=zr(),xX=Kc(),Mw=wX("iterator"),a$=!1,Jn,Fw,Pw;[].keys&&(Pw=[].keys(),"next"in Pw?(Fw=s$(s$(Pw)),Fw!==Object.prototype&&(Jn=Fw)):a$=!0);var EX=!yX(Jn)||hX(function(){var t={};return Jn[Mw].call(t)!==t});EX?Jn={}:xX&&(Jn=bX(Jn));gX(Jn[Mw])||vX(Jn,Mw,function(){return this});l$.exports={IteratorPrototype:Jn,BUGGY_SAFARI_ITERATORS:a$}});var u$=g((mCe,c$)=>{"use strict";var SX=$w().IteratorPrototype,IX=ru(),_X=Uc(),OX=Tm(),TX=Xc(),CX=function(){return this};c$.exports=function(t,e,r,n){var o=e+" Iterator";return t.prototype=IX(SX,{next:_X(+!n,r)}),OX(t,o,!1,!0),TX[o]=CX,t}});var p$=g((hCe,f$)=>{"use strict";var AX=_t(),kX=Vi();f$.exports=function(t,e,r){try{return AX(kX(Object.getOwnPropertyDescriptor(t,e)[r]))}catch{}}});var m$=g((gCe,d$)=>{"use strict";var RX=ot(),NX=String,DX=TypeError;d$.exports=function(t){if(typeof t=="object"||RX(t))return t;throw DX("Can't set "+NX(t)+" as a prototype")}});var g$=g((yCe,h$)=>{"use strict";var FX=p$(),PX=qo(),MX=m$();h$.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t=!1,e={},r;try{r=FX(Object.prototype,"__proto__","set"),r(e,[]),t=e instanceof Array}catch{}return function(o,i){return PX(o),MX(i),t?r(o,i):o.__proto__=i,o}}():void 0)});var T$=g((bCe,O$)=>{"use strict";var $X=Zi(),LX=Gn(),Fm=Kc(),I$=t$(),jX=ot(),qX=u$(),y$=Dw(),b$=g$(),BX=Tm(),zX=Gi(),Lw=Dm(),UX=zr(),v$=Xc(),_$=$w(),WX=I$.PROPER,HX=I$.CONFIGURABLE,w$=_$.IteratorPrototype,Pm=_$.BUGGY_SAFARI_ITERATORS,nu=UX("iterator"),x$="keys",ou="values",E$="entries",S$=function(){return this};O$.exports=function(t,e,r,n,o,i,s){qX(r,e,n);var a=function(v){if(v===o&&p)return p;if(!Pm&&v in c)return c[v];switch(v){case x$:return function(){return new r(this,v)};case ou:return function(){return new r(this,v)};case E$:return function(){return new r(this,v)}}return function(){return new r(this)}},l=e+" Iterator",u=!1,c=t.prototype,f=c[nu]||c["@@iterator"]||o&&c[o],p=!Pm&&f||a(o),d=e==="Array"&&c.entries||f,h,b,y;if(d&&(h=y$(d.call(new t)),h!==Object.prototype&&h.next&&(!Fm&&y$(h)!==w$&&(b$?b$(h,w$):jX(h[nu])||Lw(h,nu,S$)),BX(h,l,!0,!0),Fm&&(v$[l]=S$))),WX&&o===ou&&f&&f.name!==ou&&(!Fm&&HX?zX(c,"name",ou):(u=!0,p=function(){return LX(f,this)})),o)if(b={values:a(ou),keys:i?p:a(x$),entries:a(E$)},s)for(y in b)(Pm||u||!(y in c))&&Lw(c,y,b[y]);else $X({target:e,proto:!0,forced:Pm||u},b);return(!Fm||s)&&c[nu]!==p&&Lw(c,nu,p,{name:o}),v$[e]=p,b}});var A$=g((vCe,C$)=>{"use strict";C$.exports=function(t,e){return{value:t,done:e}}});var N$=g((wCe,R$)=>{"use strict";var KX=Ki(),VX=Aw(),GX=zr(),ZX=Sr(),k$=GX("species");R$.exports=function(t){var e=KX(t);ZX&&e&&!e[k$]&&VX(e,k$,{configurable:!0,get:function(){return this}})}});var L$=g((xCe,$$)=>{"use strict";var JX=ru(),YX=Aw(),D$=XM(),XX=Zc(),QX=vw(),eQ=ba(),tQ=Qc(),rQ=T$(),Mm=A$(),nQ=N$(),iu=Sr(),F$=yw().fastKey,M$=_w(),P$=M$.set,jw=M$.getterFor;$$.exports={getConstructor:function(t,e,r,n){var o=t(function(u,c){QX(u,i),P$(u,{type:e,index:JX(null),first:void 0,last:void 0,size:0}),iu||(u.size=0),eQ(c)||tQ(c,u[n],{that:u,AS_ENTRIES:r})}),i=o.prototype,s=jw(e),a=function(u,c,f){var p=s(u),d=l(u,c),h,b;return d?d.value=f:(p.last=d={index:b=F$(c,!0),key:c,value:f,previous:h=p.last,next:void 0,removed:!1},p.first||(p.first=d),h&&(h.next=d),iu?p.size++:u.size++,b!=="F"&&(p.index[b]=d)),u},l=function(u,c){var f=s(u),p=F$(c),d;if(p!=="F")return f.index[p];for(d=f.first;d;d=d.next)if(d.key===c)return d};return D$(i,{clear:function(){for(var c=this,f=s(c),p=f.index,d=f.first;d;)d.removed=!0,d.previous&&(d.previous=d.previous.next=void 0),delete p[d.index],d=d.next;f.first=f.last=void 0,iu?f.size=0:c.size=0},delete:function(u){var c=this,f=s(c),p=l(c,u);if(p){var d=p.next,h=p.previous;delete f.index[p.index],p.removed=!0,h&&(h.next=d),d&&(d.previous=h),f.first===p&&(f.first=d),f.last===p&&(f.last=h),iu?f.size--:c.size--}return!!p},forEach:function(c){for(var f=s(this),p=XX(c,arguments.length>1?arguments[1]:void 0),d;d=d?d.next:f.first;)for(p(d.value,d.key,this);d&&d.removed;)d=d.previous},has:function(c){return!!l(this,c)}}),D$(i,r?{get:function(c){var f=l(this,c);return f&&f.value},set:function(c,f){return a(this,c===0?0:c,f)}}:{add:function(c){return a(this,c=c===0?0:c,c)}}),iu&&YX(i,"size",{configurable:!0,get:function(){return s(this).size}}),o},setStrong:function(t,e,r){var n=e+" Iterator",o=jw(e),i=jw(n);rQ(t,e,function(s,a){P$(this,{type:n,target:s,state:o(s),kind:a,last:void 0})},function(){for(var s=i(this),a=s.kind,l=s.last;l&&l.removed;)l=l.previous;return!s.target||!(s.last=l=l?l.next:s.state.first)?(s.target=void 0,Mm(void 0,!0)):Mm(a==="keys"?l.key:a==="values"?l.value:[l.key,l.value],!1)},r?"entries":"values",!r,!0),nQ(e)}}});var j$=g(()=>{"use strict";var oQ=PM(),iQ=L$();oQ("Map",function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},iQ)});var q$=g(()=>{"use strict";j$()});var z$=g((OCe,B$)=>{"use strict";B$.exports=function(t,e){return e===1?function(r,n){return r[t](n)}:function(r,n,o){return r[t](n,o)}}});var H$=g((TCe,W$)=>{"use strict";var sQ=Ki(),$m=z$(),U$=sQ("Map");W$.exports={Map:U$,set:$m("set",2),get:$m("get",1),has:$m("has",1),remove:$m("delete",1),proto:U$.prototype}});var K$=g(()=>{"use strict";var aQ=Zi(),lQ=_t(),cQ=Vi(),uQ=Wc(),fQ=Qc(),Lm=H$(),pQ=Kc(),dQ=Lm.Map,mQ=Lm.has,hQ=Lm.get,gQ=Lm.set,yQ=lQ([].push);aQ({target:"Map",stat:!0,forced:pQ},{groupBy:function(e,r){uQ(e),cQ(r);var n=new dQ,o=0;return fQ(e,function(i){var s=r(i,o++);mQ(n,s)?yQ(hQ(n,s),i):gQ(n,s,[i])}),n}})});var Z$=g((kCe,G$)=>{"use strict";q$();K$();var bQ=Gn(),vQ=ot(),wQ=Hc(),V$=wQ.Map,xQ=V$.groupBy;G$.exports=function(e,r,n){return bQ(xQ,vQ(this)?this:V$,e,r,n)}});var Y$=g((RCe,J$)=>{"use strict";var EQ=Z$();J$.exports=EQ});var X$=g(()=>{"use strict";var SQ=Zi(),IQ=Sr(),_Q=ru();SQ({target:"Object",stat:!0,sham:!IQ},{create:_Q})});var Q$=g(()=>{"use strict";var OQ=Zi(),TQ=Ki(),CQ=_t(),AQ=Vi(),kQ=Wc(),RQ=Vc(),NQ=Qc(),DQ=TQ("Object","create"),FQ=CQ([].push);OQ({target:"Object",stat:!0},{groupBy:function(e,r){kQ(e),AQ(r);var n=DQ(null),o=0;return NQ(e,function(i){var s=RQ(r(i,o++));s in n?FQ(n[s],i):n[s]=[i]}),n}})});var t2=g((MCe,e2)=>{"use strict";X$();Q$();var PQ=Hc();e2.exports=PQ.Object.groupBy});var n2=g(($Ce,r2)=>{"use strict";var MQ=t2();r2.exports=MQ});var S2=g(E2=>{"use strict";var _a=(S(),$g(Nr));function QQ(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var eee=typeof Object.is=="function"?Object.is:QQ,tee=_a.useState,ree=_a.useEffect,nee=_a.useLayoutEffect,oee=_a.useDebugValue;function iee(t,e){var r=e(),n=tee({inst:{value:r,getSnapshot:e}}),o=n[0].inst,i=n[1];return nee(function(){o.value=r,o.getSnapshot=e,ox(o)&&i({inst:o})},[t,r,e]),ree(function(){return ox(o)&&i({inst:o}),t(function(){ox(o)&&i({inst:o})})},[t]),oee(r),r}function ox(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!eee(t,r)}catch{return!0}}function see(t,e){return e()}var aee=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?see:iee;E2.useSyncExternalStore=_a.useSyncExternalStore!==void 0?_a.useSyncExternalStore:aee});var _2=g((iRe,I2)=>{"use strict";I2.exports=S2()});var T2=g(O2=>{"use strict";var Ym=(S(),$g(Nr)),lee=_2();function cee(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var uee=typeof Object.is=="function"?Object.is:cee,fee=lee.useSyncExternalStore,pee=Ym.useRef,dee=Ym.useEffect,mee=Ym.useMemo,hee=Ym.useDebugValue;O2.useSyncExternalStoreWithSelector=function(t,e,r,n,o){var i=pee(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=mee(function(){function l(d){if(!u){if(u=!0,c=d,d=n(d),o!==void 0&&s.hasValue){var h=s.value;if(o(h,d))return f=h}return f=d}if(h=f,uee(c,d))return h;var b=n(d);return o!==void 0&&o(h,b)?h:(c=d,f=b)}var u=!1,c,f,p=r===void 0?null:r;return[function(){return l(e())},p===null?void 0:function(){return l(p())}]},[e,r,n,o]);var a=fee(t,i[0],i[1]);return dee(function(){s.hasValue=!0,s.value=a},[a]),hee(a),a}});var A2=g((aRe,C2)=>{"use strict";C2.exports=T2()});var Go=g((Y2e,eo)=>{function Px(){return eo.exports=Px=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},eo.exports.__esModule=!0,eo.exports.default=eo.exports,Px.apply(this,arguments)}eo.exports=Px,eo.exports.__esModule=!0,eo.exports.default=eo.exports});var gh=g((ALe,to)=>{function Ux(t){return to.exports=Ux=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},to.exports.__esModule=!0,to.exports.default=to.exports,Ux(t)}to.exports=Ux,to.exports.__esModule=!0,to.exports.default=to.exports});var Cj=g((kLe,Iu)=>{var Tj=gh().default;function tne(t,e){if(Tj(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Tj(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}Iu.exports=tne,Iu.exports.__esModule=!0,Iu.exports.default=Iu.exports});var Aj=g((RLe,_u)=>{var rne=gh().default,nne=Cj();function one(t){var e=nne(t,"string");return rne(e)==="symbol"?e:String(e)}_u.exports=one,_u.exports.__esModule=!0,_u.exports.default=_u.exports});var kj=g((NLe,Ou)=>{var ine=Aj();function sne(t,e,r){return e=ine(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}Ou.exports=sne,Ou.exports.__esModule=!0,Ou.exports.default=Ou.exports});var Rj=g((DLe,Tu)=>{function ane(t){if(Array.isArray(t))return t}Tu.exports=ane,Tu.exports.__esModule=!0,Tu.exports.default=Tu.exports});var Nj=g((FLe,Cu)=>{function lne(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,o,i,s,a=[],l=!0,u=!1;try{if(i=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(c){u=!0,o=c}finally{try{if(!l&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw o}}return a}}Cu.exports=lne,Cu.exports.__esModule=!0,Cu.exports.default=Cu.exports});var Dj=g((PLe,Au)=>{function cne(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}Au.exports=cne,Au.exports.__esModule=!0,Au.exports.default=Au.exports});var Pj=g((MLe,ku)=>{var Fj=Dj();function une(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)}}ku.exports=une,ku.exports.__esModule=!0,ku.exports.default=ku.exports});var Mj=g(($Le,Ru)=>{function fne(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}Ru.exports=fne,Ru.exports.__esModule=!0,Ru.exports.default=Ru.exports});var $j=g((LLe,Nu)=>{var pne=Rj(),dne=Nj(),mne=Pj(),hne=Mj();function gne(t,e){return pne(t)||dne(t,e)||mne(t,e)||hne()}Nu.exports=gne,Nu.exports.__esModule=!0,Nu.exports.default=Nu.exports});var jj=g((yh,Lj)=>{"use strict";yh.__esModule=!0;yh.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"};Lj.exports=yh.default});var Bj=g((bh,qj)=>{"use strict";bh.__esModule=!0;bh.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"};qj.exports=bh.default});var Uj=g((vh,zj)=>{"use strict";vh.__esModule=!0;vh.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"};zj.exports=vh.default});var Hj=g((wh,Wj)=>{"use strict";wh.__esModule=!0;wh.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"};Wj.exports=wh.default});var Vj=g((xh,Kj)=>{"use strict";xh.__esModule=!0;xh.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"};Kj.exports=xh.default});var Zj=g((Eh,Gj)=>{"use strict";Eh.__esModule=!0;Eh.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"};Gj.exports=Eh.default});var Yj=g((Sh,Jj)=>{"use strict";Sh.__esModule=!0;Sh.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"};Jj.exports=Sh.default});var Qj=g((Ih,Xj)=>{"use strict";Ih.__esModule=!0;Ih.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"};Xj.exports=Ih.default});var t5=g((_h,e5)=>{"use strict";_h.__esModule=!0;_h.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"};e5.exports=_h.default});var n5=g((Oh,r5)=>{"use strict";Oh.__esModule=!0;Oh.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"};r5.exports=Oh.default});var i5=g((Th,o5)=>{"use strict";Th.__esModule=!0;Th.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"};o5.exports=Th.default});var a5=g((Ch,s5)=>{"use strict";Ch.__esModule=!0;Ch.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"};s5.exports=Ch.default});var c5=g((Ah,l5)=>{"use strict";Ah.__esModule=!0;Ah.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"};l5.exports=Ah.default});var f5=g((kh,u5)=>{"use strict";kh.__esModule=!0;kh.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"};u5.exports=kh.default});var d5=g((Rh,p5)=>{"use strict";Rh.__esModule=!0;Rh.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"};p5.exports=Rh.default});var h5=g((Nh,m5)=>{"use strict";Nh.__esModule=!0;Nh.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"};m5.exports=Nh.default});var y5=g((Dh,g5)=>{"use strict";Dh.__esModule=!0;Dh.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"};g5.exports=Dh.default});var v5=g((Fh,b5)=>{"use strict";Fh.__esModule=!0;Fh.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"};b5.exports=Fh.default});var x5=g((Ph,w5)=>{"use strict";Ph.__esModule=!0;Ph.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"};w5.exports=Ph.default});var S5=g((Mh,E5)=>{"use strict";Mh.__esModule=!0;Mh.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"};E5.exports=Mh.default});var _5=g(($h,I5)=>{"use strict";$h.__esModule=!0;$h.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"};I5.exports=$h.default});var T5=g((Lh,O5)=>{"use strict";Lh.__esModule=!0;Lh.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"};O5.exports=Lh.default});var A5=g((jh,C5)=>{"use strict";jh.__esModule=!0;jh.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"};C5.exports=jh.default});var R5=g((qh,k5)=>{"use strict";qh.__esModule=!0;qh.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"};k5.exports=qh.default});var D5=g((Bh,N5)=>{"use strict";Bh.__esModule=!0;Bh.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"};N5.exports=Bh.default});var P5=g((zh,F5)=>{"use strict";zh.__esModule=!0;zh.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=zh.default});var $5=g((Uh,M5)=>{"use strict";Uh.__esModule=!0;Uh.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=Uh.default});var j5=g((Wh,L5)=>{"use strict";Wh.__esModule=!0;Wh.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"};L5.exports=Wh.default});var B5=g((Hh,q5)=>{"use strict";Hh.__esModule=!0;Hh.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"};q5.exports=Hh.default});var U5=g((Kh,z5)=>{"use strict";Kh.__esModule=!0;Kh.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"};z5.exports=Kh.default});var H5=g((Vh,W5)=>{"use strict";Vh.__esModule=!0;Vh.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"};W5.exports=Vh.default});var V5=g((Gh,K5)=>{"use strict";Gh.__esModule=!0;Gh.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"};K5.exports=Gh.default});var Z5=g((Zh,G5)=>{"use strict";Zh.__esModule=!0;Zh.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"};G5.exports=Zh.default});var Y5=g((Jh,J5)=>{"use strict";Jh.__esModule=!0;Jh.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"};J5.exports=Jh.default});var Q5=g((Yh,X5)=>{"use strict";Yh.__esModule=!0;Yh.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"};X5.exports=Yh.default});var t3=g((Xh,e3)=>{"use strict";Xh.__esModule=!0;Xh.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"};e3.exports=Xh.default});var n3=g((Qh,r3)=>{"use strict";Qh.__esModule=!0;Qh.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"};r3.exports=Qh.default});var o3=g(ae=>{"use strict";ae.__esModule=!0;function le(t){return t&&t.__esModule?t.default:t}var yne=jj();ae.threezerotwofour=le(yne);var bne=Bj();ae.apathy=le(bne);var vne=Uj();ae.ashes=le(vne);var wne=Hj();ae.atelierDune=le(wne);var xne=Vj();ae.atelierForest=le(xne);var Ene=Zj();ae.atelierHeath=le(Ene);var Sne=Yj();ae.atelierLakeside=le(Sne);var Ine=Qj();ae.atelierSeaside=le(Ine);var _ne=t5();ae.bespin=le(_ne);var One=n5();ae.brewer=le(One);var Tne=i5();ae.bright=le(Tne);var Cne=a5();ae.chalk=le(Cne);var Ane=c5();ae.codeschool=le(Ane);var kne=f5();ae.colors=le(kne);var Rne=d5();ae.default=le(Rne);var Nne=h5();ae.eighties=le(Nne);var Dne=y5();ae.embers=le(Dne);var Fne=v5();ae.flat=le(Fne);var Pne=x5();ae.google=le(Pne);var Mne=S5();ae.grayscale=le(Mne);var $ne=_5();ae.greenscreen=le($ne);var Lne=T5();ae.harmonic=le(Lne);var jne=A5();ae.hopscotch=le(jne);var qne=R5();ae.isotope=le(qne);var Bne=D5();ae.marrakesh=le(Bne);var zne=P5();ae.mocha=le(zne);var Une=$5();ae.monokai=le(Une);var Wne=j5();ae.ocean=le(Wne);var Hne=B5();ae.paraiso=le(Hne);var Kne=U5();ae.pop=le(Kne);var Vne=H5();ae.railscasts=le(Vne);var Gne=V5();ae.shapeshifter=le(Gne);var Zne=Z5();ae.solarized=le(Zne);var Jne=Y5();ae.summerfruit=le(Jne);var Yne=Q5();ae.tomorrow=le(Yne);var Xne=t3();ae.tube=le(Xne);var Qne=n3();ae.twilight=le(Qne)});var s3=g((qLe,i3)=>{"use strict";i3.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 l3=g((BLe,a3)=>{a3.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 f3=g((zLe,u3)=>{"use strict";var eoe=l3(),toe=Array.prototype.concat,roe=Array.prototype.slice,c3=u3.exports=function(e){for(var r=[],n=0,o=e.length;n<o;n++){var i=e[n];eoe(i)?r=toe.call(r,roe.call(i)):r.push(i)}return r};c3.wrap=function(t){return function(){return t(c3(arguments))}}});var h3=g((ULe,m3)=>{var Du=s3(),Fu=f3(),p3=Object.hasOwnProperty,d3=Object.create(null);for(eg in Du)p3.call(Du,eg)&&(d3[Du[eg]]=eg);var eg,tr=m3.exports={to:{},get:{}};tr.get=function(t){var e=t.substring(0,3).toLowerCase(),r,n;switch(e){case"hsl":r=tr.get.hsl(t),n="hsl";break;case"hwb":r=tr.get.hwb(t),n="hwb";break;default:r=tr.get.rgb(t),n="rgb";break}return r?{model:n,value:r}:null};tr.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],a,l,u;if(a=t.match(r)){for(u=a[2],a=a[1],l=0;l<3;l++){var c=l*2;s[l]=parseInt(a.slice(c,c+2),16)}u&&(s[3]=parseInt(u,16)/255)}else if(a=t.match(e)){for(a=a[1],u=a[3],l=0;l<3;l++)s[l]=parseInt(a[l]+a[l],16);u&&(s[3]=parseInt(u+u,16)/255)}else if(a=t.match(n)){for(l=0;l<3;l++)s[l]=parseInt(a[l+1],0);a[4]&&(a[5]?s[3]=parseFloat(a[4])*.01:s[3]=parseFloat(a[4]))}else if(a=t.match(o)){for(l=0;l<3;l++)s[l]=Math.round(parseFloat(a[l+1])*2.55);a[4]&&(a[5]?s[3]=parseFloat(a[4])*.01:s[3]=parseFloat(a[4]))}else return(a=t.match(i))?a[1]==="transparent"?[0,0,0,0]:p3.call(Du,a[1])?(s=Du[a[1]],s[3]=1,s):null:null;for(l=0;l<3;l++)s[l]=Jo(s[l],0,255);return s[3]=Jo(s[3],0,1),s};tr.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=Jo(parseFloat(r[2]),0,100),s=Jo(parseFloat(r[3]),0,100),a=Jo(isNaN(n)?1:n,0,1);return[o,i,s,a]}return null};tr.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=Jo(parseFloat(r[2]),0,100),s=Jo(parseFloat(r[3]),0,100),a=Jo(isNaN(n)?1:n,0,1);return[o,i,s,a]}return null};tr.to.hex=function(){var t=Fu(arguments);return"#"+tg(t[0])+tg(t[1])+tg(t[2])+(t[3]<1?tg(Math.round(t[3]*255)):"")};tr.to.rgb=function(){var t=Fu(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]+")"};tr.to.rgb.percent=function(){var t=Fu(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]+")"};tr.to.hsl=function(){var t=Fu(arguments);return t.length<4||t[3]===1?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"};tr.to.hwb=function(){var t=Fu(arguments),e="";return t.length>=4&&t[3]!==1&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"};tr.to.keyword=function(t){return d3[t.slice(0,3)]};function Jo(t,e,r){return Math.min(Math.max(e,t),r)}function tg(t){var e=Math.round(t).toString(16).toUpperCase();return e.length<2?"0"+e:e}});var y3=g((WLe,g3)=>{"use strict";g3.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 Wx=g((HLe,x3)=>{var as=y3(),w3={};for(rg in as)as.hasOwnProperty(rg)&&(w3[as[rg]]=rg);var rg,j=x3.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(Tt in j)if(j.hasOwnProperty(Tt)){if(!("channels"in j[Tt]))throw new Error("missing channels property: "+Tt);if(!("labels"in j[Tt]))throw new Error("missing channel labels property: "+Tt);if(j[Tt].labels.length!==j[Tt].channels)throw new Error("channel and label counts mismatch: "+Tt);b3=j[Tt].channels,v3=j[Tt].labels,delete j[Tt].channels,delete j[Tt].labels,Object.defineProperty(j[Tt],"channels",{value:b3}),Object.defineProperty(j[Tt],"labels",{value:v3})}var b3,v3,Tt;j.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,a,l,u;return i===o?a=0:e===i?a=(r-n)/s:r===i?a=2+(n-e)/s:n===i&&(a=4+(e-r)/s),a=Math.min(a*60,360),a<0&&(a+=360),u=(o+i)/2,i===o?l=0:u<=.5?l=s/(i+o):l=s/(2-i-o),[a,l*100,u*100]};j.rgb.hsv=function(t){var e,r,n,o,i,s=t[0]/255,a=t[1]/255,l=t[2]/255,u=Math.max(s,a,l),c=u-Math.min(s,a,l),f=function(p){return(u-p)/6/c+1/2};return c===0?o=i=0:(i=c/u,e=f(s),r=f(a),n=f(l),s===u?o=n-r:a===u?o=1/3+e-n:l===u&&(o=2/3+r-e),o<0?o+=1:o>1&&(o-=1)),[o*360,i*100,u*100]};j.rgb.hwb=function(t){var e=t[0],r=t[1],n=t[2],o=j.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]};j.rgb.cmyk=function(t){var e=t[0]/255,r=t[1]/255,n=t[2]/255,o,i,s,a;return a=Math.min(1-e,1-r,1-n),o=(1-e-a)/(1-a)||0,i=(1-r-a)/(1-a)||0,s=(1-n-a)/(1-a)||0,[o*100,i*100,s*100,a*100]};function noe(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)+Math.pow(t[2]-e[2],2)}j.rgb.keyword=function(t){var e=w3[t];if(e)return e;var r=1/0,n;for(var o in as)if(as.hasOwnProperty(o)){var i=as[o],s=noe(t,i);s<r&&(r=s,n=o)}return n};j.keyword.rgb=function(t){return as[t]};j.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]};j.rgb.lab=function(t){var e=j.rgb.xyz(t),r=e[0],n=e[1],o=e[2],i,s,a;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),a=200*(n-o),[i,s,a]};j.hsl.rgb=function(t){var e=t[0]/360,r=t[1]/100,n=t[2]/100,o,i,s,a,l;if(r===0)return l=n*255,[l,l,l];n<.5?i=n*(1+r):i=n+r-n*r,o=2*n-i,a=[0,0,0];for(var u=0;u<3;u++)s=e+1/3*-(u-1),s<0&&s++,s>1&&s--,6*s<1?l=o+(i-o)*6*s:2*s<1?l=i:3*s<2?l=o+(i-o)*(2/3-s)*6:l=o,a[u]=l*255;return a};j.hsl.hsv=function(t){var e=t[0],r=t[1]/100,n=t[2]/100,o=r,i=Math.max(n,.01),s,a;return n*=2,r*=n<=1?n:2-n,o*=i<=1?i:2-i,a=(n+r)/2,s=n===0?2*o/(i+o):2*r/(n+r),[e,s*100,a*100]};j.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),a=255*n*(1-r*i),l=255*n*(1-r*(1-i));switch(n*=255,o){case 0:return[n,l,s];case 1:return[a,n,s];case 2:return[s,n,l];case 3:return[s,a,n];case 4:return[l,s,n];case 5:return[n,s,a]}};j.hsv.hsl=function(t){var e=t[0],r=t[1]/100,n=t[2]/100,o=Math.max(n,.01),i,s,a;return a=(2-r)*n,i=(2-r)*o,s=r*o,s/=i<=1?i:2-i,s=s||0,a/=2,[e,s*100,a*100]};j.hwb.rgb=function(t){var e=t[0]/360,r=t[1]/100,n=t[2]/100,o=r+n,i,s,a,l;o>1&&(r/=o,n/=o),i=Math.floor(6*e),s=1-n,a=6*e-i,i&1&&(a=1-a),l=r+a*(s-r);var u,c,f;switch(i){default:case 6:case 0:u=s,c=l,f=r;break;case 1:u=l,c=s,f=r;break;case 2:u=r,c=s,f=l;break;case 3:u=r,c=l,f=s;break;case 4:u=l,c=r,f=s;break;case 5:u=s,c=r,f=l;break}return[u*255,c*255,f*255]};j.cmyk.rgb=function(t){var e=t[0]/100,r=t[1]/100,n=t[2]/100,o=t[3]/100,i,s,a;return i=1-Math.min(1,e*(1-o)+o),s=1-Math.min(1,r*(1-o)+o),a=1-Math.min(1,n*(1-o)+o),[i*255,s*255,a*255]};j.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]};j.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]};j.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 a=Math.pow(i,3),l=Math.pow(o,3),u=Math.pow(s,3);return i=a>.008856?a:(i-16/116)/7.787,o=l>.008856?l:(o-16/116)/7.787,s=u>.008856?u:(s-16/116)/7.787,o*=95.047,i*=100,s*=108.883,[o,i,s]};j.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]};j.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]};j.rgb.ansi16=function(t){var e=t[0],r=t[1],n=t[2],o=1 in arguments?arguments[1]:j.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};j.hsv.ansi16=function(t){return j.rgb.ansi16(j.hsv.rgb(t),t[2])};j.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};j.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]};j.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]};j.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};j.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(a){return a+a}).join(""));var n=parseInt(r,16),o=n>>16&255,i=n>>8&255,s=n&255;return[o,i,s]};j.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,a,l;return s<1?a=i/(1-s):a=0,s<=0?l=0:o===e?l=(r-n)/s%6:o===r?l=2+(n-e)/s:l=4+(e-r)/s+4,l/=6,l%=1,[l*360,s*100,a*100]};j.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]};j.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]};j.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,a=1-s,l=0;switch(Math.floor(i)){case 0:o[0]=1,o[1]=s,o[2]=0;break;case 1:o[0]=a,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]=a,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]=a}return l=(1-r)*n,[(r*o[0]+l)*255,(r*o[1]+l)*255,(r*o[2]+l)*255]};j.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]};j.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]};j.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]};j.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]};j.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};j.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};j.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};j.gray.hsl=j.gray.hsv=function(t){return[0,0,t[0]]};j.gray.hwb=function(t){return[0,100,t[0]]};j.gray.cmyk=function(t){return[0,0,0,t[0]]};j.gray.lab=function(t){return[t[0],0,0]};j.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};j.rgb.gray=function(t){var e=(t[0]+t[1]+t[2])/3;return[e/255*100]}});var S3=g((KLe,E3)=>{var ng=Wx();function ooe(){for(var t={},e=Object.keys(ng),r=e.length,n=0;n<r;n++)t[e[n]]={distance:-1,parent:null};return t}function ioe(t){var e=ooe(),r=[t];for(e[t].distance=0;r.length;)for(var n=r.pop(),o=Object.keys(ng[n]),i=o.length,s=0;s<i;s++){var a=o[s],l=e[a];l.distance===-1&&(l.distance=e[n].distance+1,l.parent=n,r.unshift(a))}return e}function soe(t,e){return function(r){return e(t(r))}}function aoe(t,e){for(var r=[e[t].parent,t],n=ng[e[t].parent][t],o=e[t].parent;e[o].parent;)r.unshift(e[o].parent),n=soe(ng[e[o].parent][o],n),o=e[o].parent;return n.conversion=r,n}E3.exports=function(t){for(var e=ioe(t),r={},n=Object.keys(e),o=n.length,i=0;i<o;i++){var s=n[i],a=e[s];a.parent!==null&&(r[s]=aoe(s,e))}return r}});var _3=g((VLe,I3)=>{var Hx=Wx(),loe=S3(),Da={},coe=Object.keys(Hx);function uoe(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 foe(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}coe.forEach(function(t){Da[t]={},Object.defineProperty(Da[t],"channels",{value:Hx[t].channels}),Object.defineProperty(Da[t],"labels",{value:Hx[t].labels});var e=loe(t),r=Object.keys(e);r.forEach(function(n){var o=e[n];Da[t][n]=foe(o),Da[t][n].raw=uoe(o)})});I3.exports=Da});var C3=g((GLe,T3)=>{"use strict";var Pu=h3(),rr=_3(),Gx=[].slice,O3=["keyword","gray","hex"],Kx={};Object.keys(rr).forEach(function(t){Kx[Gx.call(rr[t].labels).sort().join("")]=t});var og={};function ut(t,e){if(!(this instanceof ut))return new ut(t,e);if(e&&e in O3&&(e=null),e&&!(e in rr))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 ut)this.model=t.model,this.color=t.color.slice(),this.valpha=t.valpha;else if(typeof t=="string"){var o=Pu.get(t);if(o===null)throw new Error("Unable to parse color from string: "+t);this.model=o.model,n=rr[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=rr[this.model].channels;var i=Gx.call(t,0,n);this.color=Vx(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 a=s.sort().join("");if(!(a in Kx))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=Kx[a];var l=rr[this.model].labels,u=[];for(r=0;r<l.length;r++)u.push(t[l[r]]);this.color=Vx(u)}if(og[this.model])for(n=rr[this.model].channels,r=0;r<n;r++){var c=og[this.model][r];c&&(this.color[r]=c(this.color[r]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}ut.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(t){var e=this.model in Pu.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 Pu.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 Pu.to.rgb.percent(r)},array:function(){return this.valpha===1?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var t={},e=rr[this.model].channels,r=rr[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 ut(this.color.map(doe(t)).concat(this.valpha),this.model)},alpha:function(t){return arguments.length?new ut(this.color.concat(Math.max(0,Math.min(1,t))),this.model):this.valpha},red:Pe("rgb",0,Ge(255)),green:Pe("rgb",1,Ge(255)),blue:Pe("rgb",2,Ge(255)),hue:Pe(["hsl","hsv","hsl","hwb","hcg"],0,function(t){return(t%360+360)%360}),saturationl:Pe("hsl",1,Ge(100)),lightness:Pe("hsl",2,Ge(100)),saturationv:Pe("hsv",1,Ge(100)),value:Pe("hsv",2,Ge(100)),chroma:Pe("hcg",1,Ge(100)),gray:Pe("hcg",2,Ge(100)),white:Pe("hwb",1,Ge(100)),wblack:Pe("hwb",2,Ge(100)),cyan:Pe("cmyk",0,Ge(100)),magenta:Pe("cmyk",1,Ge(100)),yellow:Pe("cmyk",2,Ge(100)),black:Pe("cmyk",3,Ge(100)),x:Pe("xyz",0,Ge(100)),y:Pe("xyz",1,Ge(100)),z:Pe("xyz",2,Ge(100)),l:Pe("lab",0,Ge(100)),a:Pe("lab",1),b:Pe("lab",2),keyword:function(t){return arguments.length?new ut(t):rr[this.model].keyword(this.color)},hex:function(t){return arguments.length?new ut(t):Pu.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 ut.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(),a=((i*s===-1?i:(i+s)/(1+i*s))+1)/2,l=1-a;return ut.rgb(a*r.red()+l*n.red(),a*r.green()+l*n.green(),a*r.blue()+l*n.blue(),r.alpha()*o+n.alpha()*(1-o))}};Object.keys(rr).forEach(function(t){if(O3.indexOf(t)===-1){var e=rr[t].channels;ut.prototype[t]=function(){if(this.model===t)return new ut(this);if(arguments.length)return new ut(arguments,t);var r=typeof arguments[e]=="number"?e:this.valpha;return new ut(moe(rr[this.model][t].raw(this.color)).concat(r),t)},ut[t]=function(r){return typeof r=="number"&&(r=Vx(Gx.call(arguments),e)),new ut(r,t)}}});function poe(t,e){return Number(t.toFixed(e))}function doe(t){return function(e){return poe(e,t)}}function Pe(t,e,r){return t=Array.isArray(t)?t:[t],t.forEach(function(n){(og[n]||(og[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 Ge(t){return function(e){return Math.max(0,Math.min(t,e))}}function moe(t){return Array.isArray(t)?t:[t]}function Vx(t,e){for(var r=0;r<e;r++)typeof t[r]!="number"&&(t[r]=0);return t}T3.exports=ut});var V3=g((ZLe,K3)=>{var hoe="Expected a function",A3="__lodash_placeholder__",cs=1,sg=2,goe=4,ls=8,Mu=16,Fa=32,$u=64,M3=128,yoe=256,$3=512,k3=1/0,boe=9007199254740991,voe=17976931348623157e292,R3=0/0,woe=[["ary",M3],["bind",cs],["bindKey",sg],["curry",ls],["curryRight",Mu],["flip",$3],["partial",Fa],["partialRight",$u],["rearg",yoe]],xoe="[object Function]",Eoe="[object GeneratorFunction]",Soe="[object Symbol]",Ioe=/[\\^$.*+?()[\]{}|]/g,_oe=/^\s+|\s+$/g,Ooe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Toe=/\{\n\/\* \[wrapped with (.+)\] \*/,Coe=/,? & /,Aoe=/^[-+]0x[0-9a-f]+$/i,koe=/^0b[01]+$/i,Roe=/^\[object .+?Constructor\]$/,Noe=/^0o[0-7]+$/i,Doe=/^(?:0|[1-9]\d*)$/,Foe=parseInt,Poe=typeof global=="object"&&global&&global.Object===Object&&global,Moe=typeof self=="object"&&self&&self.Object===Object&&self,ju=Poe||Moe||Function("return this")();function L3(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 $oe(t,e){for(var r=-1,n=t?t.length:0;++r<n&&e(t[r],r,t)!==!1;);return t}function Loe(t,e){var r=t?t.length:0;return!!r&&qoe(t,e,0)>-1}function joe(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 qoe(t,e,r){if(e!==e)return joe(t,Boe,r);for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}function Boe(t){return t!==t}function zoe(t,e){for(var r=t.length,n=0;r--;)t[r]===e&&n++;return n}function Uoe(t,e){return t?.[e]}function Woe(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function j3(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 Hoe=Function.prototype,q3=Object.prototype,Zx=ju["__core-js_shared__"],N3=function(){var t=/[^.]+$/.exec(Zx&&Zx.keys&&Zx.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),B3=Hoe.toString,Koe=q3.hasOwnProperty,z3=q3.toString,Voe=RegExp("^"+B3.call(Koe).replace(Ioe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Goe=Object.create,ig=Math.max,Zoe=Math.min,D3=function(){var t=F3(Object,"defineProperty"),e=F3.name;return e&&e.length>2?t:void 0}();function Joe(t){return Pa(t)?Goe(t):{}}function Yoe(t){if(!Pa(t)||lie(t))return!1;var e=pie(t)||Woe(t)?Voe:Roe;return e.test(uie(t))}function Xoe(t,e,r,n){for(var o=-1,i=t.length,s=r.length,a=-1,l=e.length,u=ig(i-s,0),c=Array(l+u),f=!n;++a<l;)c[a]=e[a];for(;++o<s;)(f||o<i)&&(c[r[o]]=t[o]);for(;u--;)c[a++]=t[o++];return c}function Qoe(t,e,r,n){for(var o=-1,i=t.length,s=-1,a=r.length,l=-1,u=e.length,c=ig(i-a,0),f=Array(c+u),p=!n;++o<c;)f[o]=t[o];for(var d=o;++l<u;)f[d+l]=e[l];for(;++s<a;)(p||o<i)&&(f[d+r[s]]=t[o++]);return f}function eie(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}function tie(t,e,r){var n=e&cs,o=Lu(t);function i(){var s=this&&this!==ju&&this instanceof i?o:t;return s.apply(n?r:this,arguments)}return i}function Lu(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=Joe(t.prototype),n=t.apply(r,e);return Pa(n)?n:r}}function rie(t,e,r){var n=Lu(t);function o(){for(var i=arguments.length,s=Array(i),a=i,l=W3(o);a--;)s[a]=arguments[a];var u=i<3&&s[0]!==l&&s[i-1]!==l?[]:j3(s,l);if(i-=u.length,i<r)return U3(t,e,Jx,o.placeholder,void 0,s,u,void 0,void 0,r-i);var c=this&&this!==ju&&this instanceof o?n:t;return L3(c,this,s)}return o}function Jx(t,e,r,n,o,i,s,a,l,u){var c=e&M3,f=e&cs,p=e&sg,d=e&(ls|Mu),h=e&$3,b=p?void 0:Lu(t);function y(){for(var v=arguments.length,x=Array(v),T=v;T--;)x[T]=arguments[T];if(d)var $=W3(y),V=zoe(x,$);if(n&&(x=Xoe(x,n,o,d)),i&&(x=Qoe(x,i,s,d)),v-=V,d&&v<u){var J=j3(x,$);return U3(t,e,Jx,y.placeholder,r,x,J,a,l,u-v)}var G=f?r:this,K=p?G[t]:t;return v=x.length,a?x=cie(x,a):h&&v>1&&x.reverse(),c&&l<v&&(x.length=l),this&&this!==ju&&this instanceof y&&(K=b||Lu(K)),K.apply(G,x)}return y}function nie(t,e,r,n){var o=e&cs,i=Lu(t);function s(){for(var a=-1,l=arguments.length,u=-1,c=n.length,f=Array(c+l),p=this&&this!==ju&&this instanceof s?i:t;++u<c;)f[u]=n[u];for(;l--;)f[u++]=arguments[++a];return L3(p,o?r:this,f)}return s}function U3(t,e,r,n,o,i,s,a,l,u){var c=e&ls,f=c?s:void 0,p=c?void 0:s,d=c?i:void 0,h=c?void 0:i;e|=c?Fa:$u,e&=~(c?$u:Fa),e&goe||(e&=~(cs|sg));var b=r(t,e,o,d,f,h,p,a,l,u);return b.placeholder=n,H3(b,t,e)}function oie(t,e,r,n,o,i,s,a){var l=e&sg;if(!l&&typeof t!="function")throw new TypeError(hoe);var u=n?n.length:0;if(u||(e&=~(Fa|$u),n=o=void 0),s=s===void 0?s:ig(P3(s),0),a=a===void 0?a:P3(a),u-=o?o.length:0,e&$u){var c=n,f=o;n=o=void 0}var p=[t,e,r,n,o,c,f,i,s,a];if(t=p[0],e=p[1],r=p[2],n=p[3],o=p[4],a=p[9]=p[9]==null?l?0:t.length:ig(p[9]-u,0),!a&&e&(ls|Mu)&&(e&=~(ls|Mu)),!e||e==cs)var d=tie(t,e,r);else e==ls||e==Mu?d=rie(t,e,a):(e==Fa||e==(cs|Fa))&&!o.length?d=nie(t,e,r,n):d=Jx.apply(void 0,p);return H3(d,t,e)}function W3(t){var e=t;return e.placeholder}function F3(t,e){var r=Uoe(t,e);return Yoe(r)?r:void 0}function iie(t){var e=t.match(Toe);return e?e[1].split(Coe):[]}function sie(t,e){var r=e.length,n=r-1;return e[n]=(r>1?"& ":"")+e[n],e=e.join(r>2?", ":" "),t.replace(Ooe,`{
|
|
/* [wrapped with `+e+`] */
|
|
`)}function aie(t,e){return e=e??boe,!!e&&(typeof t=="number"||Doe.test(t))&&t>-1&&t%1==0&&t<e}function lie(t){return!!N3&&N3 in t}function cie(t,e){for(var r=t.length,n=Zoe(e.length,r),o=eie(t);n--;){var i=e[n];t[n]=aie(i,r)?o[i]:void 0}return t}var H3=D3?function(t,e,r){var n=e+"";return D3(t,"toString",{configurable:!0,enumerable:!1,value:yie(sie(n,fie(iie(n),r)))})}:bie;function uie(t){if(t!=null){try{return B3.call(t)}catch{}try{return t+""}catch{}}return""}function fie(t,e){return $oe(woe,function(r){var n="_."+r[0];e&r[1]&&!Loe(t,n)&&t.push(n)}),t.sort()}function Yx(t,e,r){e=r?void 0:e;var n=oie(t,ls,void 0,void 0,void 0,void 0,void 0,e);return n.placeholder=Yx.placeholder,n}function pie(t){var e=Pa(t)?z3.call(t):"";return e==xoe||e==Eoe}function Pa(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function die(t){return!!t&&typeof t=="object"}function mie(t){return typeof t=="symbol"||die(t)&&z3.call(t)==Soe}function hie(t){if(!t)return t===0?t:0;if(t=gie(t),t===k3||t===-k3){var e=t<0?-1:1;return e*voe}return t===t?t:0}function P3(t){var e=hie(t),r=e%1;return e===e?r?e-r:e:0}function gie(t){if(typeof t=="number")return t;if(mie(t))return R3;if(Pa(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Pa(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(_oe,"");var r=koe.test(t);return r||Noe.test(t)?Foe(t.slice(2),r?2:8):Aoe.test(t)?R3:+t}function yie(t){return function(){return t}}function bie(t){return t}Yx.placeholder={};K3.exports=Yx});var xae={};oS(xae,{default:()=>xe});module.exports=$g(xae);function aS(t){var e=new WeakMap;return r=>e.has(r)?e.get(r):VB(e,r,t(r,e))}function VB(t,e,r){return t.set(e,r),r}function lS(t){return t&&typeof t=="object"?JSON.parse(JSON.stringify(t)):t}var En=typeof queueMicrotask=="function"?queueMicrotask:(t=>e=>t.then(e))(Promise.resolve());function cS(t){let e=Promise.resolve(t);return(r,n)=>r||n?(typeof n>"u"&&(n=console.error),e=e.then(r,n)):e}function uS(){let t,e,r=new Promise((n,o)=>{t=n,e=o});return{resolve:t,reject:e,promise:r}}var Dae=require("obsidian"),ft;(function(t){Object.assign(t,require("obsidian"))})(ft||(ft={}));var Lg="use.me",jg="use.factory",gs,Za,qg=function(){return Object.defineProperties(t(),{this:{get(){if(gs)return gs;throw new TypeError("No current context")}},me:{value:Lg},factory:{value:jg}});function t(o){let i=new Map;i.prev=o;let s=Object.assign(o?l=>{let u=i.get(l);if(!u){for(let d=i.prev;d;d=d.prev)if(u=d.get(l)){u=Object.assign(Object.assign({},u),{s:u.s||1});break}u=u||{s:2,v:r},i.set(l,u)}let c,f,p;for(;;)switch(u.s){case 0:return gs===s&&Za&&Za.push(l),u.v;case 1:if(c=u.d,!c||a(()=>c.k.every(d=>s(d)===c.c(d)))){u.s=0;break}u.v=c.f;case 2:u.s=4;try{e(i,l,0,a(f=u.v,l,p=[])),p.length&&(u.d={c:s,f,k:p});break}catch(d){u.s=3,u.v=d,u.d=null}case 3:throw u.v;case 4:throw new Error(`Factory ${String(u.v)} didn't resolve ${String(l)}`)}}:l=>qg.this(l),{def(l,u){return e(i,l,2,u),s},set(l,u){return e(i,l,1,u),s},fork(l){let u=t(i);return l!=null?u(l):u}});return o?s.use=s:s;function a(l,u,c){let f=gs,p=Za;try{return gs=s,Za=c,l(u)}finally{gs=f,Za=p}}}function e(o,i,s,a){if(o.has(i)){let l=o.get(i);if(!l.s)throw new Error(`Already read: ${String(i)}`);l.s=s,l.v=a,l.d=null}else o.set(i,{s,v:a})}function r(o){if(typeof o[Lg]=="function")return o[Lg](o);if(n(o))return typeof o.prototype[jg]=="function"?o.prototype[jg]():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 GB,ys=(t=>(t.service=function(e){return t(Xu).addChild(e),t.this},t.plugin=function(e){if(!Sn)GB=e.app,Sn=t.fork(),Sn.set(ft.Plugin,e),Sn.set(e.constructor,e),e.addChild(Sn.use(Xu));else if(e!==Sn.use(ft.Plugin))throw new TypeError("use.plugin() called on multiple plugins");return Sn},t.def(ft.Plugin,()=>{throw new Error("Plugin not created yet")}),t.def(ft.App,()=>t(ft.Plugin).app),t))(qg),Sn;function Bg(t){if(t?.use)return t.use;if(Sn)return Sn;if(t instanceof ft.Plugin)return t.use=ys.plugin(t);throw new Error("No context available: did you forget to `use.plugin()`?")}var fe=class extends ft.Component{constructor(){super(...arguments),this.use=ys.service(this)}},Xu=class extends ft.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?En(()=>super.addChild(e)):super.addChild(e)),e}};function ZB(t,e){En(()=>t.removeChild(e))}function fS(t,e){let r=new ft.Component;r.onload=()=>{ZB(t,r),t=null,e()},t.addChild(r)}function ef(){throw new Error("Cycle detected")}function tf(){if(io>1){io--;return}let t,e=!1;for(;Ja!==void 0;){let r=Ja;for(Ja=void 0,zg++;r!==void 0;){let n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&hS(r))try{r.c()}catch(o){e||(t=o,e=!0)}r=n}}if(zg=0,io--,e)throw t}function pS(t){if(io>0)return t();io++;try{return t()}finally{tf()}}var De,Ja;var io=0,zg=0,Qu=0;function dS(t){if(De===void 0)return;let e=t.n;if(e===void 0||e.t!==De)return e={i:0,S:t,p:De.s,n:void 0,t:De,e:void 0,x:void 0,r:e},De.s!==void 0&&(De.s.n=e),De.s=e,t.n=e,32&De.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=De.s,e.n=void 0,De.s.n=e,De.s=e),e}function Ct(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}Ct.prototype.h=function(){return!0};Ct.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)};Ct.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)}};Ct.prototype.subscribe=function(t){let e=this;return Wg(function(){let r=e.value,n=32&this.f;this.f&=-33;try{t(r)}finally{this.f|=n}})};Ct.prototype.valueOf=function(){return this.value};Ct.prototype.toString=function(){return this.value+""};Ct.prototype.toJSON=function(){return this.value};Ct.prototype.peek=function(){return this.v};Object.defineProperty(Ct.prototype,"value",{get(){let t=dS(this);return t!==void 0&&(t.i=this.i),this.v},set(t){if(De instanceof so&&function(){throw new Error("Computed cannot have side-effects")}(),t!==this.v){zg>100&&ef(),this.v=t,this.i++,Qu++,io++;try{for(let e=this.t;e!==void 0;e=e.x)e.t.N()}finally{tf()}}}});function mS(t){return new Ct(t)}function hS(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 gS(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 yS(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 so(t){Ct.call(this,void 0),this.x=t,this.s=void 0,this.g=Qu-1,this.f=4}(so.prototype=new Ct).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Qu))return!0;if(this.g=Qu,this.f|=1,this.i>0&&!hS(this))return this.f&=-2,!0;let t=De;try{gS(this),De=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 De=t,yS(this),this.f&=-2,!0};so.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)}Ct.prototype.S.call(this,t)};so.prototype.U=function(t){if(this.t!==void 0&&(Ct.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)}};so.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let t=this.t;t!==void 0;t=t.x)t.t.N()}};so.prototype.peek=function(){if(this.h()||ef(),16&this.f)throw this.v;return this.v};Object.defineProperty(so.prototype,"value",{get(){1&this.f&&ef();let t=dS(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function rf(t){return new so(t)}function bS(t){let e=t.u;if(t.u=void 0,typeof e=="function"){io++;let r=De;De=void 0;try{e()}catch(n){throw t.f&=-2,t.f|=8,Ug(t),n}finally{De=r,tf()}}}function Ug(t){for(let e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,bS(t)}function JB(t){if(De!==this)throw new Error("Out-of-order effect");yS(this),De=t,this.f&=-2,8&this.f&&Ug(this),tf()}function Ya(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}Ya.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()}};Ya.prototype.S=function(){1&this.f&&ef(),this.f|=1,this.f&=-9,bS(this),gS(this),io++;let t=De;return De=this,JB.bind(this,t)};Ya.prototype.N=function(){2&this.f||(this.f|=2,this.o=Ja,Ja=this)};Ya.prototype.d=function(){this.f|=8,1&this.f||Ug(this)};function Wg(t){let e=new Ya(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}function Hg(t){let e=rf(t);return()=>e.value}function vS(t){let e=mS(t);function r(){return e.value,t}return r.set=function(n){t!==n&&(Qa.size||En(YB),Qa.set(e,t=n))},r}var Qa=new Map;function YB(){Qa.size&&pS(()=>{for(let[t,e]of Qa.entries())Qa.delete(t),t.value=e})}var XB=aS(function(t){return{}});function me(t,e,r){let n=r.get;return{...r,get(){var o,i;return((o=(i=XB(this))[e])!==null&&o!==void 0?o:i[e]=Hg(n.bind(this)))()}}}var Xa;function He(t){let e=Wg(function(){let r=Xa,n=Xa=[];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{Xa=r}});return Xa&&Xa.push(e),e}function or(t,e){let r=Object.keys(e).map(n=>QB(t,n,e[n]));return r.length===1?r[0]:function(){r.forEach(n=>n())}}function QB(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,a;function s(...l){return i===n&&t[e]===s&&a(),i.apply(this,l)}function a(){t[e]===s&&(o?t[e]=n:delete t[e]),i!==n&&(i=n,Object.setPrototypeOf(s,n||Function))}}var nf=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)},ez=new Set(["__proto__","prototype","constructor"]),Kg=(t,e)=>{if(!nf(e))return t;t||(t={});for(let[r,n]of Object.entries(e)){if(ez.has(r))continue;let o=t[r];if(nf(o)&&nf(n))t[r]=Kg(o,n);else{if(n===void 0)continue;nf(n)?t[r]=Kg({},n):Array.isArray(n)?t[r]=[...n]:t[r]=n}}return t};function of(t={},e={}){return Kg({...e},{...t})}var sf=class extends fe{get current(){return this.cloned()}addDefaults(e){this.data=of(this.data,e)}constructor(){super(),this.plugin=this.use(ft.Plugin),this.queue=cS(),this.data={},this.version=vS(0),this.cloned=Hg(()=>this.version()?lS(this.data):null),this.queue(async()=>{var e;await new Promise(r=>fS(this.plugin,r)),this.data=of((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 He(()=>{this.current&&En(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})}};function wS(t,e,r,n){let{resolve:o,promise:i}=uS(),s=new class extends ft.FuzzySuggestModal{getItemText(a){var l;return(l=e?.(a))!==null&&l!==void 0?l:""+a}getItems(){return t}onChooseItem(a,l){o({item:a,event:l})}onClose(){super.onClose(),En(()=>o({item:null,event:null}))}}(app);return r&&s.setPlaceholder(r),n?.(s),s.open(),i}var qB=require("obsidian");var xS=t=>`obsidian-zotero:${t}`;var ir=({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("")},ES=(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)},Zg=(t=!0,e)=>ES(r=>r,r=>new RegExp(t?"^"+r+"$":r,e),!0),Vg=String.raw`[23456789ABCDEFGHIJKLMNPQRSTUVWXYZ]{8}`,Gg=String.raw`\d+`,SS=t=>{let e={annotKey:Vg,parentKey:Vg,groupID:Gg,page:Gg};if(t)for(let r in e)e[r]=`(${e[r]})`;return ES(r=>e[r],r=>r)`${"annotKey"}a${"parentKey"}(?:g${"groupID"})?(?:p${"page"})?`},IS=Zg()`${Vg}(?:g${Gg})?`,_S=Zg()`${SS(!0)}`,OS=Zg()`(?:${SS(!1)}n?)+`,bs=(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};var TS=(t,e,{getLogger:r,configure:n})=>{let o=xS(t);return n({appenders:{out:{type:"console"}},categories:{default:{appenders:["out"],level:e},[o]:{appenders:["out"],level:e}}}),r(o)},CS={ALL:"ALL",TRACE:"TRACE",DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR",FATAL:"FATAL",MARK:"MARK",OFF:"OFF"};var ao=()=>(...t)=>t;var AS=t=>`better-sqlite3-${t}.node`;var Sp=Z(ZO(),1);var $b=Z(ks(),1),Eo=require("obsidian"),NA=Z(QO(),1);var KT=require("http");var AU=Z(ks(),1),kU=Z(qy(),1),By=Z(qy(),1);var vT=ao()("open","export","update");var bT=(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))},jf=t=>{if(t.type==="item")return{version:t.version,type:t.type,items:bT(t,"items")};if(t.type==="annotation")return{version:t.version,type:t.type,annots:bT(t,"annots"),parent:JSON.parse(t.parent)};throw new TypeError("Unrecognized query type: "+t.type)};var zy=/^<!--merge:(\d+)-->/;var qf=require("obsidian");var El=require("path");var ET=require("path/posix");var Wy=require("obsidian");var wT={"123":{darwin:["arm64","x64"],linux:["x64"],win32:["ia32","x64","arm64"]},"125":{darwin:["arm64","x64"],linux:["x64"],win32:["ia32","x64","arm64"]}};var xT=Wy.Platform.isDesktopApp?require("@electron/remote").app.getPath("userData"):null,{arch:ppe,platform:dpe,versions:{modules:NU,electron:mpe}}=process,Uy=wT,ST=({modules:t})=>{if(t in Uy)return 0;let r=Object.keys(Uy).map(o=>parseInt(o,10)).sort((o,i)=>o-i);return parseInt(t,10)>r[r.length-1]?1:-1},IT=({platform:t,arch:e})=>!!Uy[NU][t]?.includes(e),_T=()=>Wy.Platform.isDesktopApp?{arch:process.arch,platform:process.platform,modules:process.versions.modules,electron:process.versions.electron}:null,Hy=t=>t.versions?.["better-sqlite3"],Rs=t=>{if(!xT)return null;let e=Hy(t);return e?(0,ET.join)(xT,AS(e)):null};var OT={citationEditorSuggester:!0,showCitekeyInSuggester:!1};var TT={literatureNoteFolder:"LiteratureNotes"};var CT={enableServer:!1,serverPort:9091,serverHostname:"127.0.0.1"};var Ky=require("path/posix");var AT=`[!note] Page <%= it.pageLabel %>
|
|
|
|
<%= it.imgEmbed %><%= it.text %>
|
|
<% if (it.comment) { %>
|
|
---
|
|
<%= it.comment %>
|
|
<% } %>`;var kT=`<% for (const annotation of it) { %>
|
|
<%~ include("annotation", annotation) %>
|
|
<% } %>`;var RT='[<%= it.map(lit => `@${lit.citekey}`).join("; ") %>]';var NT='<%= it.map(lit => `@${lit.citekey}`).join("; ") %>';var DT=`<mark style="
|
|
<%- if (it.color) { _%> color: <%= it.color %>; <%_ } -%>
|
|
<%- if (it.bgColor) { _%> background-color: <%= it.bgColor %>; <%_ } -%>
|
|
"><%= it.content %></mark>`;var FT=`title: "<%= it.title %>"
|
|
citekey: "<%= it.citekey %>"`;var PT=`# <%= it.title %>
|
|
|
|
[Zotero](<%= it.backlink %>) <%= it.fileLink %>
|
|
<%~ include("annots", it.annotations) %>`;var dt={Ejectable:{note:PT,field:FT,annots:kT,annotation:AT,cite:RT,cite2:NT,colored:DT},Embeded:{filename:"<%= it.citekey ?? it.DOI ?? it.title ?? it.key %>.md"}},en={Ejectable:Object.keys(dt.Ejectable),Embeded:Object.keys(dt.Embeded),All:Object.keys(dt.Ejectable).concat(Object.keys(dt.Embeded))};function Vy(t){return Object.hasOwn(dt.Embeded,t)?`zt-${t}.eta.md`:Object.hasOwn(dt.Ejectable,t)?t==="annotation"?"zt-annot.eta.md":`zt-${t}.eta.md`:null}function mi(t,e){return(0,Ky.join)(e,Vy(t))}function wt(t,e){let r=en.Embeded.find(o=>(0,Ky.join)(e,`zt-${o}.eta.md`)===t);if(r)return{type:"embeded",name:r};let n=en.Ejectable.find(o=>mi(o,e)===t);return n?{type:"ejectable",name:n}:null}var MT={template:{folder:"ZtTemplates",templates:dt.Embeded},updateAnnotBlock:!1,updateOverwrite:!1,autoPairEta:!1,autoTrim:[!1,!1]};var $T={autoRefresh:!0};var LT=require("os"),jT=require("path"),qT=()=>({zoteroDataDir:(0,jT.join)((0,LT.homedir)(),"Zotero"),citationLibrary:1});var BT=require("obsidian"),zT={imgExcerptImport:BT.Platform.isWin?"copy":"symlink",imgExcerptPath:"ZtImgExcerpt"};var UT=()=>({...WT,...OT,...TT,...CT,...MT,...$T,...qT(),...zT});function lt(t,e,r=!1){let n=0;return(...o)=>{if(e(),n++>(r?1:0))return t(...o)}}var ge=class extends sf{#e=this.use(xe);#t;get nativeBinding(){if(this.#t)return this.#t;let e=Rs(this.#e.manifest);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,El.join)(this.current?.zoteroDataDir,"zotero.sqlite")}get bbtSearchDbPath(){return(0,El.join)(this.current?.zoteroDataDir,"better-bibtex-search.sqlite")}get bbtMainDbPath(){return(0,El.join)(this.current?.zoteroDataDir,"better-bibtex.sqlite")}get zoteroCacheDirPath(){return(0,El.join)(this.current?.zoteroDataDir,"cache")}get dbConnParams(){return[{zotero:this.zoteroDbPath,bbtSearch:this.bbtSearchDbPath,bbtMain:this.bbtMainDbPath},{nativeBinding:this.nativeBinding}]}};de([me],ge.prototype,"templateDir",1),de([me],ge.prototype,"libId",1),de([me],ge.prototype,"simpleTemplates",1),de([me],ge.prototype,"zoteroDbPath",1),de([me],ge.prototype,"bbtSearchDbPath",1),de([me],ge.prototype,"bbtMainDbPath",1),de([me],ge.prototype,"zoteroCacheDirPath",1),de([me],ge.prototype,"dbConnParams",1);function HT(t){let e=Bg(t)(ge);return e.addDefaults(UT()),e}var qU=new Set(["notify"]),BU=new Set([...vT.map(t=>`zotero/${t}`)]),Tn=class extends fe{#e=new qf.Events;settings=this.use(ge);plugin=this.use(xe);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(He(lt(()=>{this.enableServer?this.initServer():this.closeServer()},()=>this.enableServer))),this.register(He(lt(()=>{this.reloadPort(),new qf.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 BU)this.plugin.registerObsidianProtocolHandler(r,e)}#t(){this.server??=(0,KT.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(qU.has(i)){let a=Object.fromEntries(o.entries());e.headers["content-type"]==="application/json"?new Promise((l,u)=>{let c="";e.on("data",f=>c+=f),e.on("error",f=>u(f)),e.on("end",()=>{try{l(JSON.parse(c))}catch(f){u(f)}})}).then(l=>{this.trigger(s,a,l),r.end()}):(this.trigger(s,a),r.end())}else r.statusCode=404,r.end()}listeningListener(){this.server&&W.info(`Server is listening at ${zU(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)}};de([me],Tn.prototype,"port",1),de([me],Tn.prototype,"hostname",1),de([me],Tn.prototype,"enableServer",1);function zU(t){let e=t.address();return e?typeof e=="string"?e:`${e.address}:${e.port}`:"?"}var VT=Z(ks(),1),GT=require("obsidian");function ZT(t,e={}){return _l({...e,register:r=>t.metadataCache.on("initialized",r),unregister:r=>t.metadataCache.offref(r),escape:()=>t.metadataCache.initialized,timeout:e.timeout??null})}function Gy(t,e={}){return _l({...e,register:r=>t.vault.on("zotero:db-refresh",r),unregister:r=>t.vault.offref(r)})}function Ns(t,e={}){return _l({...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,VT.assertNever)(n)}})}var JT=t=>new Promise(e=>{t.workspace.onLayoutReady(e)}),_l=({register:t,unregister:e,escape:r,timeout:n=1e4,waitAfterEvent:o,debounce:i=1e3})=>{let s=null;return[new Promise((l,u)=>{if(r?.()){l();return}s=function(){e(p),u(new Il)};function c(){e(p),l()}async function f(){o!==void 0&&await sleep(o),c()}let p=t(i?(0,GT.debounce)(f,i,!0):f);n!==null&&sleep(n).then(()=>{e(p),r?.()?c():u(new Sl(n))})}),s]},Sl=class extends Error{constructor(r){super(`Timeout after ${r}ms`);this.timeout=r}},Il=class extends Error{constructor(){super("Manually cancelled")}};var WU=t=>{let e=new Blob([t],{type:"text/javascript"});return URL.createObjectURL(e)},YT=(t,e)=>{let r=WU(t),n=new Worker(r,e);return URL.revokeObjectURL(r),n};var Zy=class extends Error{},Ie=t=>{throw new Zy(t)},Jy=class extends Error{},ve=t=>{throw new Jy(t)};var go=(t,e)=>$e(t)===e,$e=t=>{let e=typeof t;return e==="object"?t===null?"null":"object":e==="function"?"object":e},Yy={bigint:"a bigint",boolean:"boolean",null:"null",number:"a number",object:"an object",string:"a string",symbol:"a symbol",undefined:"undefined"};var pr=(t,e)=>t in e,XT=t=>Object.entries(t),_e=t=>Object.keys(t),hi=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},Ds=(t,e)=>{let r=t?.[e];return r!=null};var QT=t=>Object.keys(t).length,Ol=t=>go(t,"object")?Object.keys(t).length!==0:!1,dde=Symbol("id");var tn=t=>Array.isArray(t)?t:[t];var Je=class extends Array{static fromString(e,r="/"){return e===r?new Je:new Je(...e.split(r))}toString(e="/"){return this.length?this.join(e):e}},eC=(t,e)=>{let r=t;for(let n of e){if(typeof r!="object"||r===null)return;r=r[n]}return r};var Xy=/^(?!^-0$)-?(?:0|[1-9]\d*)(?:\.\d*[1-9])?$/,HU=t=>Xy.test(t),KU=/^-?\d*\.?\d*$/,VU=t=>t.length!==0&&KU.test(t),Bf=/^(?:0|(?:-?[1-9]\d*))$/,Tl=t=>Bf.test(t),Cl=/^(?:0|(?:[1-9]\d*))$/,tC=/^-?\d+$/,GU=t=>tC.test(t),rC={number:"a number",bigint:"a bigint",integer:"an integer"},nC=(t,e)=>`'${t}' was parsed as ${rC[e]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`,ZU=(t,e)=>e==="number"?HU(t):Tl(t),JU=(t,e)=>e==="number"?Number(t):Number.parseInt(t),YU=(t,e)=>e==="number"?VU(t):GU(t),Al=(t,e)=>oC(t,"number",e),zf=(t,e)=>oC(t,"integer",e),oC=(t,e,r)=>{let n=JU(t,e);if(!Number.isNaN(n)){if(ZU(t,e))return n;if(YU(t,e))return ve(nC(t,e))}return r?ve(r===!0?`Failed to parse ${rC[e]} from '${t}'`:r):void 0},Qy=t=>{if(t[t.length-1]!=="n")return;let e=t.slice(0,-1),r;try{r=BigInt(e)}catch{return}if(Bf.test(e))return r;if(tC.test(e))return ve(nC(t,"bigint"))};var Re=(t,e)=>{switch($e(t)){case"object":return JSON.stringify(eb(t,Uf,[]),null,e);case"symbol":return Uf.onSymbol(t);default:return tb(t)}},Uf={onCycle:()=>"(cycle)",onSymbol:t=>`(symbol${t.description&&` ${t.description}`})`,onFunction:t=>`(function${t.name&&` ${t.name}`})`},eb=(t,e,r)=>{switch($e(t)){case"object":if(typeof t=="function")return Uf.onFunction(t);if(r.includes(t))return"(cycle)";let n=[...r,t];if(Array.isArray(t))return t.map(i=>eb(i,e,n));let o={};for(let i in t)o[i]=eb(t[i],e,n);return o;case"symbol":return Uf.onSymbol(t);case"bigint":return`${t}n`;case"undefined":return"undefined";default:return t}},tb=t=>typeof t=="string"?`'${t}'`:typeof t=="bigint"?`${t}n`:`${t}`;function XU(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function QU(t,e){return e.get?e.get.call(t):e.value}function e8(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 sC(t,e,r){if(!e.has(t))throw new TypeError("attempted to "+r+" private field on non-instance");return e.get(t)}function iC(t,e){var r=sC(t,e,"get");return QU(t,r)}function t8(t,e,r){XU(t,e),e.set(t,r)}function r8(t,e,r){var n=sC(t,e,"set");return e8(t,n,r),r}function Wf(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var dr=t=>(e,r,n)=>e===void 0?r===void 0?Ie(Vf):r:r===void 0?e:t(e,r,n),Vf="Unexpected operation two undefined operands",rb={domain:({l:t,r:e})=>`${t.join(", ")} and ${e.join(", ")}`,range:({l:t,r:e})=>`${Kf(t)} and ${Kf(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 ${Re(t)} and ${Re(e)}`,leftAssignability:({l:t,r:e})=>`literal value ${Re(t.value)} and ${Re(e)}`,rightAssignability:({l:t,r:e})=>`literal value ${Re(e.value)} and ${Re(t)}`,union:({l:t,r:e})=>`branches ${Re(t)} and branches ${Re(e)}`},Kf=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",Hf=new WeakMap,yo=class{get disjoints(){return iC(this,Hf)}addDisjoint(e,r,n){return iC(this,Hf)[`${this.path}`]={kind:e,l:r,r:n},Gf}constructor(e,r){Wf(this,"type",void 0),Wf(this,"lastOperator",void 0),Wf(this,"path",void 0),Wf(this,"domain",void 0),t8(this,Hf,{writable:!0,value:void 0}),this.type=e,this.lastOperator=r,this.path=new Je,r8(this,Hf,{})}},Gf=Symbol("empty"),aC=()=>Gf,kr=t=>t===Gf,lC=Symbol("equal"),Ye=()=>lC,mr=t=>t===lC,Fs=(t,e)=>(r,n,o)=>{let i={},s=_e({...r,...n}),a=!0,l=!0;for(let u of s){let c=typeof t=="function"?t(u,r[u],n[u],o):t[u](r[u],n[u],o);if(mr(c))r[u]!==void 0&&(i[u]=r[u]);else if(kr(c))if(e.onEmpty==="omit")a=!1,l=!1;else return Gf;else c!==void 0&&(i[u]=c),a&&(a=c===r[u]),l&&(l=c===n[u])}return a?l?Ye():r:l?n:i};var cC=t=>{let e=_e(t);if(e.length===1){let n=e[0];return`${n==="/"?"":`At ${n}: `}Intersection of ${rb[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}: ${rb[t[n].kind](t[n])}
|
|
`;return r},Zf=(t,e,r)=>`${t.length?`At ${t}: `:""}${e} ${r?`${r} `:""}results in an unsatisfiable type`;var kl={Array,Date,Error,Function,Map,RegExp,Set,Object,String,Number,Boolean,WeakMap,WeakSet,Promise},Ps=(t,e)=>{if($e(t)!=="object")return;let r=e??kl,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 bo=t=>Array.isArray(t),nb={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"},Jf=t=>{let e=Object(t).name;return e&&pr(e,kl)&&kl[e]===t?e:void 0};var uC=dr((t,e,r)=>t===e?Ye():t instanceof e?t:e instanceof t?e:r.addDisjoint("class",t,e)),fC=(t,e)=>typeof t=="string"?Ps(e.data)===t||!e.problems.add("class",t):e.data instanceof t||!e.problems.add("class",t);var Yf=(t,e)=>{if(Array.isArray(t)){if(Array.isArray(e)){let r=n8(t,e);return r.length===t.length?r.length===e.length?Ye():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?Ye():[t,e]},n8=(t,e)=>{let r=[...t];for(let n of e)t.includes(n)||r.push(n);return r};var pC=dr((t,e)=>t===e?Ye():Math.abs(t*e/o8(t,e))),o8=(t,e)=>{let r,n=t,o=e;for(;o!==0;)r=o,o=n%o,n=r;return n},dC=(t,e)=>e.data%t===0||!e.problems.add("divisor",t);var Rl=t=>t[0]==="?",Xf=t=>t[0]==="!",nn={index:"[index]"},vo=t=>Rl(t)||Xf(t)?t[1]:t,i8=t=>{if(typeof t.length=="object"&&Xf(t.length)&&typeof t.length[1]!="string"&&ep(t.length[1],"number"))return t.length[1].number.value},mC=dr((t,e,r)=>{let n=s8(t,e,r);if(typeof n=="symbol")return n;let o=i8(n);if(o===void 0||!(nn.index in n))return n;let{[nn.index]:i,...s}=n,a=vo(i);for(let l=0;l<o;l++){if(!s[l]){s[l]=a;continue}let u=vo(s[l]);r.path.push(`${l}`);let c=Qf(u,a,r);if(r.path.pop(),kr(c))return c;!mr(c)&&c!==u&&(s[l]=c)}return s}),s8=Fs((t,e,r,n)=>{if(e===void 0)return r===void 0?Ye():r;if(r===void 0)return e;n.path.push(t);let o=Qf(vo(e),vo(r),n);n.path.pop();let i=Rl(e)&&Rl(r);return kr(o)&&i?{}:o},{onEmpty:"bubble"}),hC=(t,e,r)=>{let n=r.type.config?.keys??r.type.scope.config.keys;return n==="loose"?a8(t,e,r):l8(n,t,e,r)},a8=(t,e,r)=>{for(let n in e){let o=e[n];r.path.push(n),n===nn.index?t.push(["indexProp",rn(vo(o),r)]):Rl(o)?t.push(["optionalProp",[n,rn(o[1],r)]]):Xf(o)?t.push(["prerequisiteProp",[n,rn(o[1],r)]]):t.push(["requiredProp",[n,rn(o,r)]]),r.path.pop()}},l8=(t,e,r,n)=>{let o={required:{},optional:{}};for(let i in r){let s=r[i];n.path.push(i),i===nn.index?o.index=rn(vo(s),n):Rl(s)?o.optional[i]=rn(s[1],n):Xf(s)?e.push(["prerequisiteProp",[i,rn(s[1],n)]]):o.required[i]=rn(s,n),n.path.pop()}e.push([`${t}Props`,o])};function c8(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var ob=t=>typeof t=="string"||Array.isArray(t)?t.length:typeof t=="number"?t:0,u8=t=>typeof t=="string"?"characters":Array.isArray(t)?"items long":"",tp=class{toString(){return Re(this.value)}get domain(){return $e(this.value)}get size(){return ob(this.value)}get units(){return u8(this.value)}get className(){return Object(this.value).constructor.name}constructor(e){c8(this,"value",void 0),this.value=e}};var rp={">":!0,">=":!0},ib={"<":!0,"<=":!0},Nl=t=>"comparator"in t,yC=dr((t,e,r)=>{if(Nl(t))return Nl(e)?t.limit===e.limit?Ye():r.addDisjoint("range",t,e):gC(e,t.limit)?t:r.addDisjoint("range",t,e);if(Nl(e))return gC(t,e.limit)?e:r.addDisjoint("range",t,e);let n=Ms("min",t.min,e.min),o=Ms("max",t.max,e.max);return n==="l"?o==="r"?Ms("min",t.min,e.max)==="l"?r.addDisjoint("range",t,e):{min:t.min,max:e.max}:t:n==="r"?o==="l"?Ms("max",t.max,e.min)==="l"?r.addDisjoint("range",t,e):{min:e.min,max:t.max}:e:o==="l"?t:o==="r"?e:Ye()}),gC=(t,e)=>Nl(t)?e===t.limit:f8(t.min,e)&&p8(t.max,e),f8=(t,e)=>!t||e>t.limit||e===t.limit&&!Dl(t.comparator),p8=(t,e)=>!t||e<t.limit||e===t.limit&&!Dl(t.comparator),bC=(t,e,r)=>{let n=r.lastDomain==="string"?"characters":r.lastDomain==="object"?"items long":void 0;if(Nl(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])},vC=(t,e)=>d8[t.comparator](ob(e.data),t.limit)||!e.problems.add("bound",t),d8={"<":(t,e)=>t<e,">":(t,e)=>t>e,"<=":(t,e)=>t<=e,">=":(t,e)=>t>=e,"==":(t,e)=>t===e},Ms=(t,e,r)=>e?r?e.limit===r.limit?Dl(e.comparator)?Dl(r.comparator)?"=":"l":Dl(r.comparator)?"r":"=":t==="min"?e.limit>r.limit?"l":"r":e.limit<r.limit?"l":"r":"l":r?"r":"=",Dl=t=>t.length===1;var sb={},ab=t=>(sb[t]||(sb[t]=new RegExp(t)),sb[t]),wC=(t,e)=>ab(t).test(e.data)||!e.problems.add("regex",`/${t}/`),xC=dr(Yf);var SC=(t,e,r)=>"value"in t?"value"in e?t.value===e.value?Ye():r.addDisjoint("value",t.value,e.value):EC(t.value,e,r)?t:r.addDisjoint("leftAssignability",t,e):"value"in e?EC(e.value,t,r)?e:r.addDisjoint("rightAssignability",t,e):h8(t,e,r),m8=dr(Yf),h8=Fs({divisor:pC,regex:xC,props:mC,class:uC,range:yC,narrow:m8},{onEmpty:"bubble"}),lb=(t,e)=>{let r=[],n;for(n in t)g8[n](r,t[n],e);return r.sort((o,i)=>Fl[o[0]]-Fl[i[0]])},g8={regex:(t,e)=>{for(let r of tn(e))t.push(["regex",r])},divisor:(t,e)=>{t.push(["divisor",e])},range:bC,class:(t,e)=>{t.push(["class",e])},props:hC,narrow:(t,e)=>{for(let r of tn(e))t.push(["narrow",r])},value:(t,e)=>{t.push(["value",e])}},Fl={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},EC=(t,e,r)=>!r.type.scope.type(["node",{[r.domain]:e}])(t).problems;var cb=t=>t?.lBranches!==void 0,_C=(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 a=!1,l=o.map((u,c)=>{if(a||!u.distinct)return null;let f=u.condition,p=Ml(i,f,r);return kr(p)?null:p===i?(n.lExtendsR.push(s),a=!0,null):p===f?(n.rExtendsL.push(c),u.distinct=null,null):mr(p)?(n.equalities.push([s,c]),a=!0,u.distinct=null,null):go(p,"object")?p:Ie(`Unexpected predicate intersection result of type '${$e(p)}'`)});if(!a)for(let u=0;u<o.length;u++)l[u]&&o[u].distinct?.push(l[u])}),n.distinctIntersections=o.flatMap(i=>i.distinct??[]),n},ub=t=>"rules"in t,Pl=(t,e)=>{if(ub(t)){let r=lb(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 lb(t,e)},IC=t=>t.rules??t,Ml=(t,e,r)=>{let n=IC(t),o=IC(e),i=SC(n,o,r);return"morph"in t?"morph"in e?t.morph===e.morph?mr(i)||kr(i)?i:{rules:i,morph:t.morph}:r.lastOperator==="&"?ve(Zf(r.path,"Intersection","of morphs")):{}:kr(i)?i:{rules:mr(i)?t.rules:i,morph:t.morph}:"morph"in e?kr(i)?i:{rules:mr(i)?e.rules:i,morph:e.morph}:i};var OC=t=>`${t==="/"?"A":`At ${t}, a`} union including one or more morphs must be discriminatable`;var CC=(t,e)=>{let r=b8(t,e),n=t.map((o,i)=>i);return AC(t,n,r,e)},AC=(t,e,r,n)=>{if(e.length===1)return Pl(t[e[0]],n);let o=w8(e,r);if(!o)return[["branches",e.map(s=>pb(t[s],n.type.scope)?ve(OC(`${n.path}`)):Pl(t[s],n))]];let i={};for(let s in o.indexCases){let a=o.indexCases[s];i[s]=AC(t,a,r,n),s!=="default"&&$l(i[s],o.path,o,n)}return[["switch",{path:o.path,kind:o.kind,cases:i}]]},$l=(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 fb(r);t.splice(o,1);return}$l(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(QT(s)!==1||!s.object)return fb(r);$l(s.object,e,r,n);return}else if(i==="switch"){for(let a in s.cases)$l(s.cases[a],e,r,n);return}else if(i==="branches"){for(let a of s)$l(a,e,r,n);return}}return fb(r)},fb=t=>Ie(`Unexpectedly failed to discriminate ${t.kind} at path '${t.path}'`),y8={domain:!0,class:!0,value:!0},b8=(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 a=new yo(e.type,"|");Ml(t[n],t[o],a);for(let l in a.disjoints){if(l.includes(nn.index))continue;let{l:u,r:c,kind:f}=a.disjoints[l];if(!pr(f,y8))continue;let p=TC(f,u),d=TC(f,c);if(p===void 0||d===void 0)continue;let h=l==="/"?f:`${l}/${f}`;if(s.push(h),!r.casesByDisjoint[h]){r.casesByDisjoint[h]={[p]:[n],[d]:[o]};continue}let b=r.casesByDisjoint[h],y=b[p];y?y.includes(n)||y.push(n):b[p]=[n];let v=b[d];v?v.includes(o)||v.push(o):b[d]=[o]}}return r},v8=t=>{let e=Je.fromString(t);return[e,e.pop()]},w8=(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],a=e.disjointsByPair[`${o}/${s}`];for(let l of a){let u=e.casesByDisjoint[l],c={},f=[...t],p=0;for(let h in u){let b=u[h].filter(y=>{let v=t.indexOf(y);if(v!==-1)return delete f[v],!0});b.length!==0&&(c[h]=b,p++)}let d=_e(f);if(d.length&&(c.default=d.map(h=>parseInt(h))),!r||p>r.score){let[h,b]=v8(l);if(r={path:h,kind:b,indexCases:c,score:p},p===t.length)return r}}}}return r},TC=(t,e)=>{switch(t){case"value":return kC(e);case"domain":return e;case"class":return Jf(e);default:return}},kC=t=>{let e=$e(t);return e==="object"||e==="symbol"?void 0:tb(t)},x8={value:t=>kC(t)??"default",class:t=>Ps(t)??"default",domain:$e},RC=(t,e)=>x8[t](e),pb=(t,e)=>"morph"in t?!0:"props"in t?Object.values(t.props).some(r=>E8(vo(r),e)):!1,E8=(t,e)=>typeof t=="string"?e.resolve(t).includesMorph:Object.values(e.resolveTypeNode(t)).some(r=>r===!0?!1:bo(r)?r.some(n=>pb(n,e)):pb(r,e));var $s=t=>t===!0?{}:t,NC=(t,e,r)=>{if(t===!0&&e===!0)return Ye();if(!bo(t)&&!bo(e)){let s=Ml($s(t),$s(e),r);return s===t?t:s===e?e:s}let n=tn($s(t)),o=tn($s(e)),i=_C(n,o,r);return i.equalities.length===n.length&&i.equalities.length===o.length?Ye():i.lExtendsR.length+i.equalities.length===n.length?t:i.rExtendsL.length+i.equalities.length===o.length?e:i},DC=(t,e,r,n)=>{n.domain=t;let o=NC(e,r,n);if(!cb(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},FC=(t,e,r,n)=>{let o=new yo(n,"|"),i=NC(e,r,o);if(!cb(i))return mr(i)||i===e?r:i===r?e:t==="boolean"?!0:[$s(e),$s(r)];let s=[...i.lBranches.filter((a,l)=>!i.lExtendsR.includes(l)&&!i.equalities.some(u=>u[0]===l)),...i.rBranches.filter((a,l)=>!i.rExtendsL.includes(l)&&!i.equalities.some(u=>u[1]===l))];return s.length===1?s[0]:s},db=(t,e)=>t===!0?[]:bo(t)?CC(t,e):Pl(t,e),PC=t=>typeof t=="object"&&"value"in t;var Ll=t=>"config"in t,Qf=(t,e,r)=>{r.domain=void 0;let n=r.type.scope.resolveTypeNode(t),o=r.type.scope.resolveTypeNode(e),i=S8(n,o,r);return typeof i=="object"&&!Ol(i)?Ol(r.disjoints)?aC():r.addDisjoint("domain",_e(n),_e(o)):i===n?t:i===o?e:i},S8=Fs((t,e,r,n)=>{if(e===void 0)return r===void 0?Ie(Vf):void 0;if(r!==void 0)return DC(t,e,r,n)},{onEmpty:"omit"}),wo=(t,e,r)=>{let n=new yo(r,"&"),o=Qf(t,e,n);return kr(o)?ve(cC(n.disjoints)):mr(o)?t:o},np=(t,e,r)=>{let n=r.scope.resolveTypeNode(t),o=r.scope.resolveTypeNode(e),i={},s=_e({...n,...o});for(let a of s)i[a]=Ds(n,a)?Ds(o,a)?FC(a,n[a],o[a],r):n[a]:Ds(o,a)?o[a]:Ie(Vf);return i},I8=t=>t[0]&&(t[0][0]==="value"||t[0][0]==="class"),mb=t=>{let e={type:t,path:new Je,lastDomain:"undefined"};return rn(t.node,e)},rn=(t,e)=>{if(typeof t=="string")return e.type.scope.resolve(t).flat;let r=Ll(t),n=_8(r?t.node:t,e);return r?[["config",{config:XT(t.config),node:n}]]:n},_8=(t,e)=>{let r=_e(t);if(r.length===1){let o=r[0],i=t[o];if(i===!0)return o;e.lastDomain=o;let s=db(i,e);return I8(s)?s:[["domain",o],...s]}let n={};for(let o of r)e.lastDomain=o,n[o]=db(t[o],e);return[["domains",n]]},ep=(t,e)=>O8(t,e)&&PC(t[e]),O8=(t,e)=>{let r=_e(t);return r.length===1&&r[0]===e},Ls=t=>({object:{class:Array,props:{[nn.index]:t}}});function hb(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Ne=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]===Ne.escapeToken)r=r.slice(0,-1);else break;r+=this.shift()}return r}shiftUntilNextTerminator(){return this.shiftUntil(Ne.lookaheadIsNotWhitespace),this.shiftUntil(Ne.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){hb(this,"chars",void 0),hb(this,"i",void 0),hb(this,"finalized",!1),this.chars=[...e],this.i=0}};(function(t){var e=t.lookaheadIsTerminator=p=>p.lookahead in o,r=t.lookaheadIsNotWhitespace=p=>p.lookahead!==f,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},a=t.comparatorDescriptions={"<":"less than",">":"more than","<=":"at most",">=":"at least","==":"exactly"},l=t.invertedComparators={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},u=t.branchTokens={"|":!0,"&":!0},c=t.escapeToken="\\",f=t.whiteSpaceToken=" "})(Ne||(Ne={}));function T8(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function C8(t,e){return e.get?e.get.call(t):e.value}function A8(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 MC(t,e,r){if(!e.has(t))throw new TypeError("attempted to "+r+" private field on non-instance");return e.get(t)}function op(t,e){var r=MC(t,e,"get");return C8(t,r)}function k8(t,e,r){T8(t,e),e.set(t,r)}function R8(t,e,r){var n=MC(t,e,"set");return A8(t,n,r),r}function Cn(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var yb=class extends TypeError{constructor(e){super(`${e}`),Cn(this,"cause",void 0),this.cause=e}},bi=class{toString(){return this.message}get message(){return this.writers.addContext(this.reason,this.path)}get reason(){return this.writers.writeReason(this.mustBe,new tp(this.data))}get mustBe(){return typeof this.writers.mustBe=="string"?this.writers.mustBe:this.writers.mustBe(this.source)}constructor(e,r,n,o,i){Cn(this,"code",void 0),Cn(this,"path",void 0),Cn(this,"data",void 0),Cn(this,"source",void 0),Cn(this,"writers",void 0),Cn(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)}},js=new WeakMap,bb=class extends Array{mustBe(e,r){return this.add("custom",e,r)}add(e,r,n){let o=Je.from(n?.path??op(this,js).path),i=n&&"data"in n?n.data:op(this,js).data,s=new bi(e,o,i,r,op(this,js).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 bi("multi",n.path,n.data,[n,e],op(this,js).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 yb(this)}constructor(e){super(),Cn(this,"byPath",{}),Cn(this,"count",0),k8(this,js,{writable:!0,value:void 0}),R8(this,js,e)}},ip=bb,N8=t=>t[0].toUpperCase()+t.slice(1),vb=t=>t.map(e=>Yy[e]),$C=t=>t.map(e=>nb[e]),gb=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},gi=(t,e)=>`must be ${t}${e&&` (was ${e})`}`,LC=(t,e)=>e.length===0?N8(t):e.length===1&&Tl(e[0])?`Item at index ${e[0]} ${t}`:`${e} ${t}`,yi={divisor:{mustBe:t=>t===1?"an integer":`a multiple of ${t}`},class:{mustBe:t=>{let e=Jf(t);return e?nb[e]:`an instance of ${t.name}`},writeReason:(t,e)=>gi(t,e.className)},domain:{mustBe:t=>Yy[t],writeReason:(t,e)=>gi(t,e.domain)},missing:{mustBe:()=>"defined",writeReason:t=>gi(t,"")},extraneous:{mustBe:()=>"removed",writeReason:t=>gi(t,"")},bound:{mustBe:t=>`${Ne.comparatorDescriptions[t.comparator]} ${t.limit}${t.units?` ${t.units}`:""}`,writeReason:(t,e)=>gi(t,`${e.size}`)},regex:{mustBe:t=>`a string matching ${t}`},value:{mustBe:Re},branches:{mustBe:t=>gb(t.map(e=>`${e.path} must be ${e.parts?gb(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=>gb(t)}},jC=_e(yi),D8=()=>{let t={},e;for(e of jC)t[e]={mustBe:yi[e].mustBe,writeReason:yi[e].writeReason??gi,addContext:yi[e].addContext??LC};return t},F8=D8(),qC=t=>{if(!t)return F8;let e={};for(let r of jC)e[r]={mustBe:t[r]?.mustBe??yi[r].mustBe,writeReason:t[r]?.writeReason??yi[r].writeReason??t.writeReason??gi,addContext:t[r]?.addContext??yi[r].addContext??t.addContext??LC};return e};function P8(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function M8(t,e){return e.get?e.get.call(t):e.value}function $8(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 UC(t,e,r){if(!e.has(t))throw new TypeError("attempted to "+r+" private field on non-instance");return e.get(t)}function wb(t,e){var r=UC(t,e,"get");return M8(t,r)}function L8(t,e,r){P8(t,e),e.set(t,r)}function j8(t,e,r){var n=UC(t,e,"set");return $8(t,n,r),r}function on(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var q8=()=>({mustBe:[],writeReason:[],addContext:[],keys:[]}),B8=["mustBe","writeReason","addContext"],WC=(t,e)=>{let r=new xb(e,t);sp(t.flat,r);let n=new HC(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},HC=class{constructor(){on(this,"data",void 0),on(this,"problems",void 0)}},jl=new WeakMap,xb=class{getProblemConfig(e){let r={};for(let n of B8)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=sp(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=sp(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=go(o,"object");if(i){let l=wb(this,jl)[n];if(l){if(l.includes(o))return!0;l.push(o)}else wb(this,jl)[n]=[o]}let s=this.type;this.type=r;let a=sp(r.flat,this);return this.type=s,i&&wb(this,jl)[n].pop(),a}traverseBranches(e){let r=this.failFast;this.failFast=!0;let n=this.problems,o=new ip(this);this.problems=o;let i=this.path,s=this.entriesToPrune,a=!1;for(let l of e)if(this.path=new Je,this.entriesToPrune=[],ap(l,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(e,r){on(this,"data",void 0),on(this,"type",void 0),on(this,"path",void 0),on(this,"problems",void 0),on(this,"entriesToPrune",void 0),on(this,"failFast",void 0),on(this,"traversalConfig",void 0),on(this,"rootScope",void 0),L8(this,jl,{writable:!0,value:void 0}),this.data=e,this.type=r,this.path=new Je,this.problems=new ip(this),this.entriesToPrune=[],this.failFast=!1,this.traversalConfig=q8(),j8(this,jl,{}),this.rootScope=r.scope}},sp=(t,e)=>typeof t=="string"?$e(e.data)===t||!e.problems.add("domain",t):ap(t,e),ap=(t,e)=>{let r=!0;for(let n=0;n<t.length;n++){let[o,i]=t[n],s=z8[o](i,e);if(r&&(r=s),!r&&(e.failFast||n<t.length-1&&Fl[o]<Fl[t[n+1][0]]))return!1}return r},BC=(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),zC=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&&Bf.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},z8={regex:wC,divisor:dC,domains:(t,e)=>{let r=t[$e(e.data)];return r?ap(r,e):!e.problems.add("cases",vb(_e(t)))},domain:(t,e)=>$e(e.data)===t||!e.problems.add("domain",t),bound:vC,optionalProp:(t,e)=>t[0]in e.data?e.traverseKey(t[0],t[1]):!0,requiredProp:BC,prerequisiteProp:BC,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=eC(e.data,t.path),n=RC(t.kind,r);if(Ds(t.cases,n))return ap(t.cases[n],e);let o=_e(t.cases),i=e.path.concat(t.path),s=t.kind==="value"?o:t.kind==="domain"?vb(o):t.kind==="class"?$C(o):Ie(`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:fC,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 bi)return e.problems.addProblem(r),!1;if(r instanceof HC){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:zC("distilledProps"),strictProps:zC("strictProps")};var xo=new Proxy(()=>xo,{get:()=>xo});var Eb=(t,e,r,n)=>{let o={node:t,flat:[["alias",t]],allows:a=>!i(a).problems,assert:a=>{let l=i(a);return l.problems?l.problems.throw():l.data},infer:xo,inferIn:xo,qualifiedName:U8(t)?n.getAnonymousQualifiedName(t):`${n.name}.${t}`,definition:e,scope:n,includesMorph:!1,config:r},i={[t]:a=>WC(i,a)}[t];return Object.assign(i,o)},Sb=t=>t?.infer===xo,U8=t=>t[0]==="\u03BB";var KC=t=>{let e=t.scanner.shiftUntilNextTerminator();t.setRoot(W8(t,e))},W8=(t,e)=>t.ctx.type.scope.addParsedReferenceIfResolvable(e,t.ctx)?e:H8(e)??t.error(e===""?Ib(t):K8(e)),H8=t=>{let e=Al(t);if(e!==void 0)return{number:{value:e}};let r=Qy(t);if(r!==void 0)return{bigint:{value:r}}},K8=t=>`'${t}' is unresolvable`,Ib=t=>{let e=t.previousOperator();return e?_b(e,t.scanner.unscanned):V8(t.scanner.unscanned)},_b=(t,e)=>`Token '${t}' requires a right operand${e?` before '${e}'`:""}`,V8=t=>`Expected an expression${t?` before '${t}'`:""}`;var Ob=(t,e)=>({node:e.type.scope.resolveTypeNode(Xe(t[0],e)),config:t[2]});var hr=t=>Object.isFrozen(t)?t:Array.isArray(t)?Object.freeze(t.map(hr)):G8(t),G8=t=>{for(let e in t)hr(t[e]);return t};var Z8=hr({regex:Cl.source}),J8=hr({range:{min:{comparator:">=",limit:0}},divisor:1}),VC=(t,e)=>{let r=e.type.scope.resolveNode(Xe(t[1],e)),n=_e(r).map(c=>X8(c,r[c])),o=GC(n);if(!o.length)return Zf(e.path,"keyof");let i={};for(let c of o){let f=typeof c;if(f==="string"||f==="number"||f==="symbol"){var s,a;(s=i)[a=f]??(s[a]=[]),i[f].push({value:c})}else if(c===Cl){var l,u;(l=i).string??(l.string=[]),i.string.push(Z8),(u=i).number??(u.number=[]),i.number.push(J8)}else return Ie(`Unexpected keyof key '${Re(c)}'`)}return Object.fromEntries(Object.entries(i).map(([c,f])=>[c,f.length===1?f[0]:f]))},Y8={bigint:hi(0n),boolean:hi(!1),null:[],number:hi(0),object:[],string:hi(""),symbol:hi(Symbol()),undefined:[]},X8=(t,e)=>t!=="object"||e===!0?Y8[t]:GC(tn(e).map(r=>Q8(r))),GC=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},Q8=t=>{let e=[];if("props"in t)for(let r of Object.keys(t.props))r===nn.index?e.push(Cl):e.includes(r)||(e.push(r),Cl.test(r)&&e.push(zf(r,`Unexpectedly failed to parse an integer from key '${r}'`)));if("class"in t){let r=typeof t.class=="string"?kl[t.class]:t.class;for(let n of hi(r.prototype))e.includes(n)||e.push(n)}return e};var JC=(t,e)=>{if(typeof t[2]!="function")return ve(eW(t[2]));let r=Xe(t[0],e),n=e.type.scope.resolveTypeNode(r),o=t[2];e.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]=bo(a)?a.map(l=>ZC(l,o)):ZC(a,o):Ie(`Unexpected predicate value for domain '${i}': ${Re(a)}`)}return s},ZC=(t,e)=>ub(t)?{...t,morph:t.morph?Array.isArray(t.morph)?[...t.morph,e]:[t.morph,e]:e}:{rules:t,morph:e},eW=t=>`Morph expression requires a function following '|>' (was ${typeof t})`;var YC=t=>`Expected a Function or Record<Domain, Function> operand (${Re(t)} was invalid)`,XC=(t,e,r,n)=>{let o=_e(e);if(!go(t,"object"))return ve(YC(t));let i={};if(typeof t=="function"){let s={[n]:t};for(let a of o)i[a]=s}else for(let s of o){if(t[s]===void 0)continue;let a={[n]:t[s]};if(typeof a[n]!="function")return ve(YC(a));i[s]=a}return i};var QC=(t,e)=>{let r=Xe(t[0],e),n=e.type.scope.resolveNode(r),o=Ll(n),i=o?n.node:n,s=wo(r,XC(t[2],i,e,"narrow"),e.type);return o?{config:n.config,node:s}:s};var tA=(t,e)=>{if(rW(t))return rA[t[1]](t,e);if(nW(t))return nA[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]=Xe(t[n],e),e.path.pop();return{object:{class:Array,props:r}}},eA=(t,e)=>{if(t[2]===void 0)return ve(_b(t[1],""));let r=Xe(t[0],e),n=Xe(t[2],e);return t[1]==="&"?wo(r,n,e.type):np(r,n,e.type)},tW=(t,e)=>Ls(Xe(t[0],e));var rW=t=>rA[t[1]]!==void 0,rA={"|":eA,"&":eA,"[]":tW,"=>":QC,"|>":JC,":":Ob},nA={keyof:VC,instanceof:t=>typeof t[1]!="function"?ve(`Expected a constructor following 'instanceof' operator (was ${typeof t[1]}).`):{object:{class:t[1]}},"===":t=>({[$e(t[1])]:{value:t[1]}}),node:t=>t[1]},nW=t=>nA[t[0]]!==void 0;var oA=(t,e)=>{let r={};for(let n in t){let o=n,i=!1;n[n.length-1]==="?"&&(n[n.length-2]===Ne.escapeToken?o=`${n.slice(0,-2)}?`:(o=n.slice(0,-1),i=!0)),e.path.push(o);let s=Xe(t[n],e);e.path.pop(),r[o]=i?["?",s]:s}return{object:{props:r}}};var iA=t=>`Unmatched )${t===""?"":` before ${t}`}`,sA="Missing )",aA=(t,e)=>`Left bounds are only valid when paired with right bounds (try ...${e}${t})`,lp=t=>`Left-bounded expressions must specify their limits using < or <= (was ${t})`,lA=(t,e,r,n)=>`An expression may have at most one left bound (parsed ${t}${Ne.invertedComparators[e]}, ${r}${Ne.invertedComparators[n]})`;function ql(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var cp=class{error(e){return ve(e)}hasRoot(){return this.root!==void 0}resolveRoot(){return this.assertHasRoot(),this.ctx.type.scope.resolveTypeNode(this.root)}rootToString(){return this.assertHasRoot(),Re(this.root)}ejectRootIfLimit(){this.assertHasRoot();let e=typeof this.root=="string"?this.ctx.type.scope.resolveNode(this.root):this.root;if(ep(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 Ie("Unexpected interaction with unset root")}assertUnsetRoot(){if(this.root!==void 0)return Ie("Unexpected attempt to overwrite root")}setRoot(e){this.assertUnsetRoot(),this.root=e}rootToArray(){this.root=Ls(this.ejectRoot())}intersect(e){this.root=wo(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=oW,e}finalize(){if(this.groups.length)return this.error(sA);this.finalizeBranches(),this.scanner.finalized=!0}reduceLeftBound(e,r){let n=Ne.invertedComparators[r];if(!pr(n,rp))return this.error(lp(r));if(this.branches.range)return this.error(lA(`${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(wo(this.branches.intersection,this.ejectRoot(),this.ctx.type))}finalizeGroup(){this.finalizeBranches();let e=this.groups.pop();if(!e)return this.error(iA(this.scanner.unscanned));this.branches=e}pushRootToBranch(e){this.assertRangeUnset(),this.branches.intersection=this.branches.intersection?wo(this.branches.intersection,this.ejectRoot(),this.ctx.type):this.ejectRoot(),e==="|"&&(this.branches.union=this.branches.union?np(this.branches.union,this.branches.intersection,this.ctx.type):this.branches.intersection,delete this.branches.intersection)}assertRangeUnset(){if(this.branches.range)return this.error(aA(`${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){ql(this,"ctx",void 0),ql(this,"scanner",void 0),ql(this,"root",void 0),ql(this,"branches",void 0),ql(this,"groups",void 0),this.ctx=r,this.branches={},this.groups=[],this.scanner=new Ne(e)}},oW=new Proxy({},{get:()=>Ie("Unexpected attempt to access ejected attributes")});var cA=(t,e)=>{let r=t.scanner.shiftUntil(iW[e]);if(t.scanner.lookahead==="")return t.error(aW(r,e));t.scanner.shift()==="/"?(ab(r),t.setRoot({string:{regex:r}})):t.setRoot({string:{value:r}})},uA={"'":1,'"':1,"/":1},iW={"'":t=>t.lookahead==="'",'"':t=>t.lookahead==='"',"/":t=>t.lookahead==="/"},sW={'"':"double-quote","'":"single-quote","/":"forward slash"},aW=(t,e)=>`${e}${t} requires a closing ${sW[e]}`;var up=t=>t.scanner.lookahead===""?t.error(Ib(t)):t.scanner.lookahead==="("?t.shiftedByOne().reduceGroupOpen():t.scanner.lookaheadIsIn(uA)?cA(t,t.scanner.shift()):t.scanner.lookahead===" "?up(t.shiftedByOne()):KC(t);var fA=t=>`Bounded expression ${t} must be a number, string or array`;var pA=(t,e)=>{let r=lW(t,e),n=t.ejectRootIfLimit();return n===void 0?uW(t,r):t.reduceLeftBound(n,r)},lW=(t,e)=>t.scanner.lookaheadIs("=")?`${e}${t.scanner.shift()}`:pr(e,Ne.oneCharComparators)?e:t.error(cW),cW="= is not a valid comparator. Use == to check for equality",uW=(t,e)=>{let r=t.scanner.shiftUntilNextTerminator(),n=Al(r,dW(e,r+t.scanner.unscanned)),o=t.ejectRangeIfOpen(),i={comparator:e,limit:n},s=o?Tb(i,ib)?Ms("min",o,i)==="l"?t.error(mW({min:o,max:i})):{min:o,max:i}:t.error(lp(e)):pW(i,"==")?i:Tb(i,rp)?{min:i}:Tb(i,ib)?{max:i}:Ie(`Unexpected comparator '${i.comparator}'`);t.intersect(fW(s,t))},fW=(t,e)=>{let r=e.resolveRoot(),n=_e(r),o={},i={range:t};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:tn(r.object).every(l=>"class"in l&&l.class===Array);default:return!1}})||e.error(fA(e.rootToString())),o},pW=(t,e)=>t.comparator===e,Tb=(t,e)=>t.comparator in e,dW=(t,e)=>`Comparator ${t} must be followed by a number literal (was '${e}')`,mW=t=>`${Kf(t)} is empty`;var dA=t=>`Divisibility operand ${t} must be a number`;var hA=t=>{let e=t.scanner.shiftUntilNextTerminator(),r=zf(e,mA(e));r===0&&t.error(mA(0));let n=_e(t.resolveRoot());n.length===1&&n[0]==="number"?t.intersect({number:{divisor:r}}):t.error(dA(t.rootToString()))},mA=t=>`% operator must be followed by a non-zero integer literal (was ${t})`;var Cb=t=>{let e=t.scanner.shift();return e===""?t.finalize():e==="["?t.scanner.shift()==="]"?t.rootToArray():t.error(gW):pr(e,Ne.branchTokens)?t.pushRootToBranch(e):e===")"?t.finalizeGroup():pr(e,Ne.comparatorStartChars)?pA(t,e):e==="%"?hA(t):e===" "?Cb(t):Ie(hW(e))},hW=t=>`Unexpected character '${t}'`,gW="Missing expected ']'";var gA=(t,e)=>e.type.scope.parseCache.get(t)??e.type.scope.parseCache.set(t,yW(t,e)??bW(t,e)),yW=(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 Ls(r)}},bW=(t,e)=>{let r=new cp(t,e);return up(r),vW(r)},vW=t=>{for(;!t.scanner.finalized;)wW(t);return t.ejectFinalizedRoot()},wW=t=>t.hasRoot()?Cb(t):up(t);var Xe=(t,e)=>{let r=$e(t);if(r==="string")return gA(t,e);if(r!=="object")return ve(Ab(r));let n=Ps(t);switch(n){case"Object":return oA(t,e);case"Array":return tA(t,e);case"RegExp":return{string:{regex:t.source}};case"Function":if(Sb(t))return e.type.scope.addAnonymousTypeReference(t,e);if(xW(t)){let o=t();if(Sb(o))return e.type.scope.addAnonymousTypeReference(o,e)}return ve(Ab("Function"));default:return ve(Ab(n??Re(t)))}},Yge=Symbol("as"),xW=t=>typeof t=="function"&&t.length===0,Ab=t=>`Type definitions must be strings or objects (was ${t})`;function EW(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var qs=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(){EW(this,"cache",{})}},fp=class extends qs{set(e,r){return this.cache[e]=hr(r),r}};function xA(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function SW(t,e){return e.get?e.get.call(t):e.value}function IW(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 EA(t,e,r){if(!e.has(t))throw new TypeError("attempted to "+r+" private field on non-instance");return e.get(t)}function kn(t,e){var r=EA(t,e,"get");return SW(t,r)}function yA(t,e,r){xA(t,e),e.set(t,r)}function bA(t,e,r){var n=EA(t,e,"set");return IW(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 pp(t,e){xA(t,e),e.add(t)}function Dt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var _W=t=>({codes:qC(t.codes),keys:t.keys??"loose"}),OW=0,vA={},kb={};var vi=new WeakMap,Bs=new WeakMap,wA=new WeakSet,dp=new WeakSet,Nb=new WeakSet,mp=new WeakSet,Db=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 xo}compile(){if(!kb[this.name]){for(let e in this.aliases)this.resolve(e);kb[this.name]=kn(this,Bs).root}return kn(this,Bs).root}addParsedReferenceIfResolvable(e,r){var n;let o=An(this,mp,Fb).call(this,e,"undefined",[e]);return o?((n=r.type).includesMorph||(n.includesMorph=o.includesMorph),!0):!1}resolve(e){return An(this,mp,Fb).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 Ll(r)?r.node:r}isResolvable(e){return kn(this,vi).has(e)||this.aliases[e]}constructor(e,r={}){pp(this,wA),pp(this,dp),pp(this,Nb),pp(this,mp),Dt(this,"aliases",void 0),Dt(this,"name",void 0),Dt(this,"config",void 0),Dt(this,"parseCache",void 0),yA(this,vi,{writable:!0,value:void 0}),yA(this,Bs,{writable:!0,value:void 0}),Dt(this,"expressions",void 0),Dt(this,"intersection",void 0),Dt(this,"union",void 0),Dt(this,"arrayOf",void 0),Dt(this,"keyOf",void 0),Dt(this,"valueOf",void 0),Dt(this,"instanceOf",void 0),Dt(this,"narrow",void 0),Dt(this,"morph",void 0),Dt(this,"type",void 0),this.aliases=e,this.parseCache=new fp,bA(this,vi,new qs),bA(this,Bs,new qs),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=Eb("\u03BBtype",n,o,this),s=An(this,Nb,SA).call(this,i),a=Xe(n,s);return i.node=hr(Ol(o)?{config:o,node:this.resolveTypeNode(a)}:a),i.flat=hr(mb(i)),i},{from:this.expressions.node}),this.name=An(this,wA,TW).call(this,r),r.standard!==!1&&An(this,dp,Rb).call(this,[kb.standard],"imports"),r.imports&&An(this,dp,Rb).call(this,r.imports,"imports"),r.includes&&An(this,dp,Rb).call(this,r.includes,"includes"),this.config=_W(r)}};function TW(t){let e=t.name?vA[t.name]?ve(`A scope named '${t.name}' already exists`):t.name:`scope${++OW}`;return vA[e]=this,e}function Rb(t,e){for(let r of t)for(let n in r)(kn(this,vi).has(n)||n in this.aliases)&&ve(AW(n)),kn(this,vi).set(n,r[n]),e==="includes"&&kn(this,Bs).set(n,r[n])}function SA(t){return{type:t,path:new Je}}function Fb(t,e,r){let n=kn(this,vi).get(t);if(n)return n;let o=this.aliases[t];if(!o)return e==="throw"?Ie(`Unexpectedly failed to resolve alias '${t}'`):void 0;let i=Eb(t,o,{},this),s=An(this,Nb,SA).call(this,i);kn(this,vi).set(t,i),kn(this,Bs).set(t,i);let a=Xe(o,s);if(typeof a=="string"){if(r.includes(a))return ve(CW(t,r));r.push(a),a=An(this,mp,Fb).call(this,a,"throw",r).node}return i.node=hr(a),i.flat=hr(mb(i)),i}var Ft=(t,e={})=>new Db(t,e),Pb=Ft({},{name:"root",standard:!1}),Rr=Pb.type,CW=(t,e)=>`Alias '${t}' has a shallow resolution cycle: ${[...e,t].join("=>")}`,AW=t=>`Alias '${t}' is already defined`;var hp=Ft({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}),IA=hp.compile();var _A={bigint:!0,boolean:!0,null:!0,number:!0,object:!0,string:!0,symbol:!0,undefined:!0},gp=Ft({any:["node",_A],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",_A],void:["node",{undefined:!0}],undefined:["node",{undefined:!0}]},{name:"ts",standard:!1}),wi=gp.compile();var kW=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)},RW=/^(?: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}))$/,OA=Rr([RW,"=>",(t,e)=>kW(t)||!e.mustBe("a valid credit card number")],{mustBe:"a valid credit card number"});var NW=/^[./-]$/,DW=/^([+-]?\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)?)?)?)?$/,FW=t=>!isNaN(t),yp=t=>`a ${t}-formatted date`,PW=(t,e)=>{if(!e?.format){let a=new Date(t);return FW(a)?a:"a valid date"}if(e.format==="iso8601")return DW.test(t)?new Date(t):yp("iso8601");let r=t.split(NW),n=t[r[0].length],o=n?e.format.split(n):[e.format];if(r.length!==o.length)return yp(e.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 yp(e.format);i[o[a][0]]=r[a]}let s=new Date(`${i.m}/${i.d}/${i.y}`);return`${s.getDate()}`===i.d?s:yp(e.format)},TA=Rr([wi.string,"|>",(t,e)=>{let r=PW(t);return typeof r=="string"?e.mustBe(r):r}]);var MW=Rr([Xy,"|>",t=>parseFloat(t)],{mustBe:"a well-formed numeric string"}),$W=Rr([wi.string,"|>",(t,e)=>{if(!Tl(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")}]),LW=Rr(/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/,{mustBe:"a valid email"}),jW=Rr(/^[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"}),qW=Rr(/^(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/)"}),BW=Rr([wi.string,"|>",t=>JSON.parse(t)],{mustBe:"a JSON-parsable string"}),bp=Ft({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:OA,email:LW,uuid:jW,parsedNumber:MW,parsedInteger:$W,parsedDate:TA,semver:qW,json:BW,integer:["node",{number:{divisor:1}}]},{name:"validation",standard:!1}),CA=bp.compile();var vp=Ft({},{name:"standard",includes:[wi,IA,CA],standard:!1}),zW=vp.compile(),Rn={root:Pb,tsKeywords:gp,jsObjects:hp,validation:bp,ark:vp};var Bl=vp.type;var UW=Rn.ark.intersection,WW=Rn.ark.union,HW=Rn.ark.arrayOf,KW=Rn.ark.keyOf,VW=Rn.ark.instanceOf,GW=Rn.ark.valueOf,ZW=Rn.ark.narrow,JW=Rn.ark.morph;var{DataRequest:Wye,DataResponse:AA}=Ft({DataRequest:{id:"number",method:"string",params:"any[]"},DataResponse:{id:"number","eventName?":"string",payload:"any",error:"any"}}).compile(),wp="__METHODS__",xp="__EVAL__";var kA=()=>({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 xi(){let t=kA();return t.once=(e,r)=>{let n=(...i)=>{o(),r(...i)},o=t.on(e,n);return o},t}function YW(t){return Object.assign(new Error,t)}var Ei=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=xi();evt=xi();task=xi();onMessage(e){if(this.terminateState==="finished")return;if(e==="ready"){this.internal.emit("ready");return}let{data:r,problems:n}=AA(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(wp)}eval(e,r,n){let o=[e,...r];return this.invoke(xp,o,{transfer:n})}send({id:e,method:r,params:n,transfer:o,timeout:i},s=new AbortController){let a=s.signal;return this.pending.set(e,s),new Promise((l,u)=>{this.worker.send({id:e,method:r,params:n},{transfer:o});let c=-1,f=()=>{u(a?.reason),p(),window.clearTimeout(c)};i!==void 0&&(c=window.setTimeout(()=>{s.abort(new DOMException(`Timeout after ${i}ms`,"TimeoutError"))},i)),a?.addEventListener("abort",f);let p=this.task.once(e,(d,h)=>{a?.removeEventListener("abort",f),h?u(YW(h)):l(d)})}).catch(l=>{if(l instanceof DOMException&&["AbortError","TimeoutError"].includes(l.name))return this.terminate(!0).then(()=>{throw l});throw l}).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,XW(r)]).then():n}return this.worker.terminate(),Promise.resolve()}};function XW(t){return new Promise(e=>setTimeout(()=>e(new DOMException(`Timeout after ${t}ms`,"TimeoutError")),t))}var zs=class extends Ei{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 or(r,{terminate:n=>function(){r.killed||(n.call(this),r.killed=!0,e.internal.emit("terminate")),e.terminateState="finished"}}),r}};var Us=class{workers=[];tasks=[];pending=new Map;emitter=xi();#e=xi();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=e7.assert(e.maxQueueSize)),e.maxWorkers!==void 0&&(this.maxWorkers=QW.assert(e.maxWorkers)),e.minWorkers!==void 0){let o=t7.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(xp,[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 a=[this.#e.on("complete",(l,u)=>{o===l&&(a.forEach(c=>c()),i(u))}),this.#e.on("error",(l,u)=>{o===l&&(a.forEach(c=>c()),s(u))})]})}methods(){return this.invoke(wp)}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}},QW=Bl("integer>=1"),e7=Bl("integer>=1"),t7=Bl('integer>=0|"max"');var RA='"use strict";var Zg=Object.create;var vu=Object.defineProperty;var Qg=Object.getOwnPropertyDescriptor;var Xg=Object.getOwnPropertyNames;var ey=Object.getPrototypeOf,ty=Object.prototype.hasOwnProperty;var D=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ry=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Xg(t))!ty.call(e,o)&&o!==r&&vu(e,o,{get:()=>t[o],enumerable:!(n=Qg(t,o))||n.enumerable});return e};var $r=(e,t,r)=>(r=e!=null?Zg(ey(e)):{},ry(t||!e||!e.__esModule?vu(r,"default",{value:e,enumerable:!0}):r,e));var Js=D((pl,Hs)=>{(function(e){if(typeof pl=="object"&&typeof Hs<"u")Hs.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(l,d){if(!i[l]){if(!o[l]){var f=typeof require=="function"&&require;if(!d&&f)return f(l,!0);if(u)return u(l,!0);var g=new Error("Cannot find module \'"+l+"\'");throw g.code="MODULE_NOT_FOUND",g}var w=i[l]={exports:{}};o[l][0].call(w.exports,function(x){var S=o[l][1][x];return a(S||x)},w,w.exports,n,o,i,s)}return i[l].exports}for(var u=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,u;if(a){var m=0,l=new a(x),d=s.document.createTextNode("");l.observe(d,{characterData:!0}),u=function(){d.data=m=++m%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var f=new s.MessageChannel;f.port1.onmessage=x,u=function(){f.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?u=function(){var N=s.document.createElement("script");N.onreadystatechange=function(){x(),N.onreadystatechange=null,N.parentNode.removeChild(N),N=null},s.document.documentElement.appendChild(N)}:u=function(){setTimeout(x,0)};var g,w=[];function x(){g=!0;for(var N,M,k=w.length;k;){for(M=w,w=[],N=-1;++N<k;)M[N]();k=w.length}g=!1}o.exports=S;function S(N){w.push(N)===1&&!g&&u()}}).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 u={},m=["REJECTED"],l=["FULFILLED"],d=["PENDING"];o.exports=f;function f(A){if(typeof A!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,A!==a&&S(this,A)}f.prototype.catch=function(A){return this.then(null,A)},f.prototype.then=function(A,B){if(typeof A!="function"&&this.state===l||typeof B!="function"&&this.state===m)return this;var L=new this.constructor(a);if(this.state!==d){var F=this.state===l?A:B;w(L,F,this.outcome)}else this.queue.push(new g(L,A,B));return L};function g(A,B,L){this.promise=A,typeof B=="function"&&(this.onFulfilled=B,this.callFulfilled=this.otherCallFulfilled),typeof L=="function"&&(this.onRejected=L,this.callRejected=this.otherCallRejected)}g.prototype.callFulfilled=function(A){u.resolve(this.promise,A)},g.prototype.otherCallFulfilled=function(A){w(this.promise,this.onFulfilled,A)},g.prototype.callRejected=function(A){u.reject(this.promise,A)},g.prototype.otherCallRejected=function(A){w(this.promise,this.onRejected,A)};function w(A,B,L){s(function(){var F;try{F=B(L)}catch(j){return u.reject(A,j)}F===A?u.reject(A,new TypeError("Cannot resolve promise with itself")):u.resolve(A,F)})}u.resolve=function(A,B){var L=N(x,B);if(L.status==="error")return u.reject(A,L.value);var F=L.value;if(F)S(A,F);else{A.state=l,A.outcome=B;for(var j=-1,O=A.queue.length;++j<O;)A.queue[j].callFulfilled(B)}return A},u.reject=function(A,B){A.state=m,A.outcome=B;for(var L=-1,F=A.queue.length;++L<F;)A.queue[L].callRejected(B);return A};function x(A){var B=A&&A.then;if(A&&(typeof A=="object"||typeof A=="function")&&typeof B=="function")return function(){B.apply(A,arguments)}}function S(A,B){var L=!1;function F(R){L||(L=!0,u.reject(A,R))}function j(R){L||(L=!0,u.resolve(A,R))}function O(){B(j,F)}var $=N(O);$.status==="error"&&F($.value)}function N(A,B){var L={};try{L.value=A(B),L.status="success"}catch(F){L.status="error",L.value=F}return L}f.resolve=M;function M(A){return A instanceof this?A:u.resolve(new this(a),A)}f.reject=k;function k(A){var B=new this(a);return u.reject(B,A)}f.all=ee;function ee(A){var B=this;if(Object.prototype.toString.call(A)!=="[object Array]")return this.reject(new TypeError("must be an array"));var L=A.length,F=!1;if(!L)return this.resolve([]);for(var j=new Array(L),O=0,$=-1,R=new this(a);++$<L;)U(A[$],$);return R;function U(q,W){B.resolve(q).then(K,function(X){F||(F=!0,u.reject(R,X))});function K(X){j[W]=X,++O===L&&!F&&(F=!0,u.resolve(R,j))}}}f.race=xe;function xe(A){var B=this;if(Object.prototype.toString.call(A)!=="[object Array]")return this.reject(new TypeError("must be an array"));var L=A.length,F=!1;if(!L)return this.resolve([]);for(var j=-1,O=new this(a);++j<L;)$(A[j]);return O;function $(R){B.resolve(R).then(function(U){F||(F=!0,u.resolve(O,U))},function(U){F||(F=!0,u.reject(O,U))})}}},{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(c){return typeof c}:function(c){return c&&typeof Symbol=="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c};function a(c,h){if(!(c instanceof h))throw new TypeError("Cannot call a class as a function")}function u(){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=u();function l(){try{if(!m||!m.open)return!1;var c=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),h=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!c||h)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function d(c,h){c=c||[],h=h||{};try{return new Blob(c,h)}catch(y){if(y.name!=="TypeError")throw y;for(var p=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,b=new p,v=0;v<c.length;v+=1)b.append(c[v]);return b.getBlob(h.type)}}typeof Promise>"u"&&n(3);var f=Promise;function g(c,h){h&&c.then(function(p){h(null,p)},function(p){h(p)})}function w(c,h,p){typeof h=="function"&&c.then(h),typeof p=="function"&&c.catch(p)}function x(c){return typeof c!="string"&&(console.warn(c+" used as a key, but it is not a string."),c=String(c)),c}function S(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var N="local-forage-detect-blob-support",M=void 0,k={},ee=Object.prototype.toString,xe="readonly",A="readwrite";function B(c){for(var h=c.length,p=new ArrayBuffer(h),b=new Uint8Array(p),v=0;v<h;v++)b[v]=c.charCodeAt(v);return p}function L(c){return new f(function(h){var p=c.transaction(N,A),b=d([""]);p.objectStore(N).put(b,"key"),p.onabort=function(v){v.preventDefault(),v.stopPropagation(),h(!1)},p.oncomplete=function(){var v=navigator.userAgent.match(/Chrome\\/(\\d+)/),y=navigator.userAgent.match(/Edge\\//);h(y||!v||parseInt(v[1],10)>=43)}}).catch(function(){return!1})}function F(c){return typeof M=="boolean"?f.resolve(M):L(c).then(function(h){return M=h,M})}function j(c){var h=k[c.name],p={};p.promise=new f(function(b,v){p.resolve=b,p.reject=v}),h.deferredOperations.push(p),h.dbReady?h.dbReady=h.dbReady.then(function(){return p.promise}):h.dbReady=p.promise}function O(c){var h=k[c.name],p=h.deferredOperations.pop();if(p)return p.resolve(),p.promise}function $(c,h){var p=k[c.name],b=p.deferredOperations.pop();if(b)return b.reject(h),b.promise}function R(c,h){return new f(function(p,b){if(k[c.name]=k[c.name]||Xa(),c.db)if(h)j(c),c.db.close();else return p(c.db);var v=[c.name];h&&v.push(c.version);var y=m.open.apply(m,v);h&&(y.onupgradeneeded=function(E){var I=y.result;try{I.createObjectStore(c.storeName),E.oldVersion<=1&&I.createObjectStore(N)}catch(_){if(_.name==="ConstraintError")console.warn(\'The database "\'+c.name+\'" has been upgraded from version \'+E.oldVersion+" to version "+E.newVersion+\', but the storage "\'+c.storeName+\'" already exists.\');else throw _}}),y.onerror=function(E){E.preventDefault(),b(y.error)},y.onsuccess=function(){var E=y.result;E.onversionchange=function(I){I.target.close()},p(E),O(c)}})}function U(c){return R(c,!1)}function q(c){return R(c,!0)}function W(c,h){if(!c.db)return!0;var p=!c.db.objectStoreNames.contains(c.storeName),b=c.version<c.db.version,v=c.version>c.db.version;if(b&&(c.version!==h&&console.warn(\'The database "\'+c.name+`" can\'t be downgraded from version `+c.db.version+" to version "+c.version+"."),c.version=c.db.version),v||p){if(p){var y=c.db.version+1;y>c.version&&(c.version=y)}return!0}return!1}function K(c){return new f(function(h,p){var b=new FileReader;b.onerror=p,b.onloadend=function(v){var y=btoa(v.target.result||"");h({__local_forage_encoded_blob:!0,data:y,type:c.type})},b.readAsBinaryString(c)})}function X(c){var h=B(atob(c.data));return d([h],{type:c.type})}function J(c){return c&&c.__local_forage_encoded_blob}function Zn(c){var h=this,p=h._initReady().then(function(){var b=k[h._dbInfo.name];if(b&&b.dbReady)return b.dbReady});return w(p,c,c),p}function Xh(c){j(c);for(var h=k[c.name],p=h.forages,b=0;b<p.length;b++){var v=p[b];v._dbInfo.db&&(v._dbInfo.db.close(),v._dbInfo.db=null)}return c.db=null,U(c).then(function(y){return c.db=y,W(c)?q(c):y}).then(function(y){c.db=h.db=y;for(var E=0;E<p.length;E++)p[E]._dbInfo.db=y}).catch(function(y){throw $(c,y),y})}function ft(c,h,p,b){b===void 0&&(b=1);try{var v=c.db.transaction(c.storeName,h);p(null,v)}catch(y){if(b>0&&(!c.db||y.name==="InvalidStateError"||y.name==="NotFoundError"))return f.resolve().then(function(){if(!c.db||y.name==="NotFoundError"&&!c.db.objectStoreNames.contains(c.storeName)&&c.version<=c.db.version)return c.db&&(c.version=c.db.version+1),q(c)}).then(function(){return Xh(c).then(function(){ft(c,h,p,b-1)})}).catch(p);p(y)}}function Xa(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function eg(c){var h=this,p={db:null};if(c)for(var b in c)p[b]=c[b];var v=k[p.name];v||(v=Xa(),k[p.name]=v),v.forages.push(h),h._initReady||(h._initReady=h.ready,h.ready=Zn);var y=[];function E(){return f.resolve()}for(var I=0;I<v.forages.length;I++){var _=v.forages[I];_!==h&&y.push(_._initReady().catch(E))}var T=v.forages.slice(0);return f.all(y).then(function(){return p.db=v.db,U(p)}).then(function(C){return p.db=C,W(p,h._defaultConfig.version)?q(p):C}).then(function(C){p.db=v.db=C,h._dbInfo=p;for(var P=0;P<T.length;P++){var z=T[P];z!==h&&(z._dbInfo.db=p.db,z._dbInfo.version=p.version)}})}function tg(c,h){var p=this;c=x(c);var b=new f(function(v,y){p.ready().then(function(){ft(p._dbInfo,xe,function(E,I){if(E)return y(E);try{var _=I.objectStore(p._dbInfo.storeName),T=_.get(c);T.onsuccess=function(){var C=T.result;C===void 0&&(C=null),J(C)&&(C=X(C)),v(C)},T.onerror=function(){y(T.error)}}catch(C){y(C)}})}).catch(y)});return g(b,h),b}function rg(c,h){var p=this,b=new f(function(v,y){p.ready().then(function(){ft(p._dbInfo,xe,function(E,I){if(E)return y(E);try{var _=I.objectStore(p._dbInfo.storeName),T=_.openCursor(),C=1;T.onsuccess=function(){var P=T.result;if(P){var z=P.value;J(z)&&(z=X(z));var V=c(z,P.key,C++);V!==void 0?v(V):P.continue()}else v()},T.onerror=function(){y(T.error)}}catch(P){y(P)}})}).catch(y)});return g(b,h),b}function ng(c,h,p){var b=this;c=x(c);var v=new f(function(y,E){var I;b.ready().then(function(){return I=b._dbInfo,ee.call(h)==="[object Blob]"?F(I.db).then(function(_){return _?h:K(h)}):h}).then(function(_){ft(b._dbInfo,A,function(T,C){if(T)return E(T);try{var P=C.objectStore(b._dbInfo.storeName);_===null&&(_=void 0);var z=P.put(_,c);C.oncomplete=function(){_===void 0&&(_=null),y(_)},C.onabort=C.onerror=function(){var V=z.error?z.error:z.transaction.error;E(V)}}catch(V){E(V)}})}).catch(E)});return g(v,p),v}function og(c,h){var p=this;c=x(c);var b=new f(function(v,y){p.ready().then(function(){ft(p._dbInfo,A,function(E,I){if(E)return y(E);try{var _=I.objectStore(p._dbInfo.storeName),T=_.delete(c);I.oncomplete=function(){v()},I.onerror=function(){y(T.error)},I.onabort=function(){var C=T.error?T.error:T.transaction.error;y(C)}}catch(C){y(C)}})}).catch(y)});return g(b,h),b}function ig(c){var h=this,p=new f(function(b,v){h.ready().then(function(){ft(h._dbInfo,A,function(y,E){if(y)return v(y);try{var I=E.objectStore(h._dbInfo.storeName),_=I.clear();E.oncomplete=function(){b()},E.onabort=E.onerror=function(){var T=_.error?_.error:_.transaction.error;v(T)}}catch(T){v(T)}})}).catch(v)});return g(p,c),p}function sg(c){var h=this,p=new f(function(b,v){h.ready().then(function(){ft(h._dbInfo,xe,function(y,E){if(y)return v(y);try{var I=E.objectStore(h._dbInfo.storeName),_=I.count();_.onsuccess=function(){b(_.result)},_.onerror=function(){v(_.error)}}catch(T){v(T)}})}).catch(v)});return g(p,c),p}function ag(c,h){var p=this,b=new f(function(v,y){if(c<0){v(null);return}p.ready().then(function(){ft(p._dbInfo,xe,function(E,I){if(E)return y(E);try{var _=I.objectStore(p._dbInfo.storeName),T=!1,C=_.openKeyCursor();C.onsuccess=function(){var P=C.result;if(!P){v(null);return}c===0||T?v(P.key):(T=!0,P.advance(c))},C.onerror=function(){y(C.error)}}catch(P){y(P)}})}).catch(y)});return g(b,h),b}function ug(c){var h=this,p=new f(function(b,v){h.ready().then(function(){ft(h._dbInfo,xe,function(y,E){if(y)return v(y);try{var I=E.objectStore(h._dbInfo.storeName),_=I.openKeyCursor(),T=[];_.onsuccess=function(){var C=_.result;if(!C){b(T);return}T.push(C.key),C.continue()},_.onerror=function(){v(_.error)}}catch(C){v(C)}})}).catch(v)});return g(p,c),p}function cg(c,h){h=S.apply(this,arguments);var p=this.config();c=typeof c!="function"&&c||{},c.name||(c.name=c.name||p.name,c.storeName=c.storeName||p.storeName);var b=this,v;if(!c.name)v=f.reject("Invalid arguments");else{var y=c.name===p.name&&b._dbInfo.db,E=y?f.resolve(b._dbInfo.db):U(c).then(function(I){var _=k[c.name],T=_.forages;_.db=I;for(var C=0;C<T.length;C++)T[C]._dbInfo.db=I;return I});c.storeName?v=E.then(function(I){if(I.objectStoreNames.contains(c.storeName)){var _=I.version+1;j(c);var T=k[c.name],C=T.forages;I.close();for(var P=0;P<C.length;P++){var z=C[P];z._dbInfo.db=null,z._dbInfo.version=_}var V=new f(function(Y,pe){var ce=m.open(c.name,_);ce.onerror=function(ke){var Fr=ce.result;Fr.close(),pe(ke)},ce.onupgradeneeded=function(){var ke=ce.result;ke.deleteObjectStore(c.storeName)},ce.onsuccess=function(){var ke=ce.result;ke.close(),Y(ke)}});return V.then(function(Y){T.db=Y;for(var pe=0;pe<C.length;pe++){var ce=C[pe];ce._dbInfo.db=Y,O(ce._dbInfo)}}).catch(function(Y){throw($(c,Y)||f.resolve()).catch(function(){}),Y})}}):v=E.then(function(I){j(c);var _=k[c.name],T=_.forages;I.close();for(var C=0;C<T.length;C++){var P=T[C];P._dbInfo.db=null}var z=new f(function(V,Y){var pe=m.deleteDatabase(c.name);pe.onerror=function(){var ce=pe.result;ce&&ce.close(),Y(pe.error)},pe.onblocked=function(){console.warn(\'dropInstance blocked for database "\'+c.name+\'" until all open connections are closed\')},pe.onsuccess=function(){var ce=pe.result;ce&&ce.close(),V(ce)}});return z.then(function(V){_.db=V;for(var Y=0;Y<T.length;Y++){var pe=T[Y];O(pe._dbInfo)}}).catch(function(V){throw($(c,V)||f.resolve()).catch(function(){}),V})})}return g(v,h),v}var lg={_driver:"asyncStorage",_initStorage:eg,_support:l(),iterate:rg,getItem:tg,setItem:ng,removeItem:og,clear:ig,length:sg,key:ag,keys:ug,dropInstance:cg};function fg(){return typeof openDatabase=="function"}var vt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",pg="~~local_forage_type~",eu=/^~~local_forage_type~([^~]+)~/,Qn="__lfsc__:",Ui=Qn.length,zi="arbf",Wi="blob",tu="si08",ru="ui08",nu="uic8",ou="si16",iu="si32",su="ur16",au="ui32",uu="fl32",cu="fl64",lu=Ui+zi.length,fu=Object.prototype.toString;function pu(c){var h=c.length*.75,p=c.length,b,v=0,y,E,I,_;c[c.length-1]==="="&&(h--,c[c.length-2]==="="&&h--);var T=new ArrayBuffer(h),C=new Uint8Array(T);for(b=0;b<p;b+=4)y=vt.indexOf(c[b]),E=vt.indexOf(c[b+1]),I=vt.indexOf(c[b+2]),_=vt.indexOf(c[b+3]),C[v++]=y<<2|E>>4,C[v++]=(E&15)<<4|I>>2,C[v++]=(I&3)<<6|_&63;return T}function Ki(c){var h=new Uint8Array(c),p="",b;for(b=0;b<h.length;b+=3)p+=vt[h[b]>>2],p+=vt[(h[b]&3)<<4|h[b+1]>>4],p+=vt[(h[b+1]&15)<<2|h[b+2]>>6],p+=vt[h[b+2]&63];return h.length%3===2?p=p.substring(0,p.length-1)+"=":h.length%3===1&&(p=p.substring(0,p.length-2)+"=="),p}function mg(c,h){var p="";if(c&&(p=fu.call(c)),c&&(p==="[object ArrayBuffer]"||c.buffer&&fu.call(c.buffer)==="[object ArrayBuffer]")){var b,v=Qn;c instanceof ArrayBuffer?(b=c,v+=zi):(b=c.buffer,p==="[object Int8Array]"?v+=tu:p==="[object Uint8Array]"?v+=ru:p==="[object Uint8ClampedArray]"?v+=nu:p==="[object Int16Array]"?v+=ou:p==="[object Uint16Array]"?v+=su:p==="[object Int32Array]"?v+=iu:p==="[object Uint32Array]"?v+=au:p==="[object Float32Array]"?v+=uu:p==="[object Float64Array]"?v+=cu:h(new Error("Failed to get type for BinaryArray"))),h(v+Ki(b))}else if(p==="[object Blob]"){var y=new FileReader;y.onload=function(){var E=pg+c.type+"~"+Ki(this.result);h(Qn+Wi+E)},y.readAsArrayBuffer(c)}else try{h(JSON.stringify(c))}catch(E){console.error("Couldn\'t convert value into a JSON string: ",c),h(null,E)}}function dg(c){if(c.substring(0,Ui)!==Qn)return JSON.parse(c);var h=c.substring(lu),p=c.substring(Ui,lu),b;if(p===Wi&&eu.test(h)){var v=h.match(eu);b=v[1],h=h.substring(v[0].length)}var y=pu(h);switch(p){case zi:return y;case Wi:return d([y],{type:b});case tu:return new Int8Array(y);case ru:return new Uint8Array(y);case nu:return new Uint8ClampedArray(y);case ou:return new Int16Array(y);case su:return new Uint16Array(y);case iu:return new Int32Array(y);case au:return new Uint32Array(y);case uu:return new Float32Array(y);case cu:return new Float64Array(y);default:throw new Error("Unkown type: "+p)}}var Gi={serialize:mg,deserialize:dg,stringToBuffer:pu,bufferToString:Ki};function mu(c,h,p,b){c.executeSql("CREATE TABLE IF NOT EXISTS "+h.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],p,b)}function hg(c){var h=this,p={db:null};if(c)for(var b in c)p[b]=typeof c[b]!="string"?c[b].toString():c[b];var v=new f(function(y,E){try{p.db=openDatabase(p.name,String(p.version),p.description,p.size)}catch(I){return E(I)}p.db.transaction(function(I){mu(I,p,function(){h._dbInfo=p,y()},function(_,T){E(T)})},E)});return p.serializer=Gi,v}function wt(c,h,p,b,v,y){c.executeSql(p,b,v,function(E,I){I.code===I.SYNTAX_ERR?E.executeSql("SELECT name FROM sqlite_master WHERE type=\'table\' AND name = ?",[h.storeName],function(_,T){T.rows.length?y(_,I):mu(_,h,function(){_.executeSql(p,b,v,y)},y)},y):y(E,I)},y)}function gg(c,h){var p=this;c=x(c);var b=new f(function(v,y){p.ready().then(function(){var E=p._dbInfo;E.db.transaction(function(I){wt(I,E,"SELECT * FROM "+E.storeName+" WHERE key = ? LIMIT 1",[c],function(_,T){var C=T.rows.length?T.rows.item(0).value:null;C&&(C=E.serializer.deserialize(C)),v(C)},function(_,T){y(T)})})}).catch(y)});return g(b,h),b}function yg(c,h){var p=this,b=new f(function(v,y){p.ready().then(function(){var E=p._dbInfo;E.db.transaction(function(I){wt(I,E,"SELECT * FROM "+E.storeName,[],function(_,T){for(var C=T.rows,P=C.length,z=0;z<P;z++){var V=C.item(z),Y=V.value;if(Y&&(Y=E.serializer.deserialize(Y)),Y=c(Y,V.key,z+1),Y!==void 0){v(Y);return}}v()},function(_,T){y(T)})})}).catch(y)});return g(b,h),b}function du(c,h,p,b){var v=this;c=x(c);var y=new f(function(E,I){v.ready().then(function(){h===void 0&&(h=null);var _=h,T=v._dbInfo;T.serializer.serialize(h,function(C,P){P?I(P):T.db.transaction(function(z){wt(z,T,"INSERT OR REPLACE INTO "+T.storeName+" (key, value) VALUES (?, ?)",[c,C],function(){E(_)},function(V,Y){I(Y)})},function(z){if(z.code===z.QUOTA_ERR){if(b>0){E(du.apply(v,[c,_,p,b-1]));return}I(z)}})})}).catch(I)});return g(y,p),y}function bg(c,h,p){return du.apply(this,[c,h,p,1])}function vg(c,h){var p=this;c=x(c);var b=new f(function(v,y){p.ready().then(function(){var E=p._dbInfo;E.db.transaction(function(I){wt(I,E,"DELETE FROM "+E.storeName+" WHERE key = ?",[c],function(){v()},function(_,T){y(T)})})}).catch(y)});return g(b,h),b}function wg(c){var h=this,p=new f(function(b,v){h.ready().then(function(){var y=h._dbInfo;y.db.transaction(function(E){wt(E,y,"DELETE FROM "+y.storeName,[],function(){b()},function(I,_){v(_)})})}).catch(v)});return g(p,c),p}function xg(c){var h=this,p=new f(function(b,v){h.ready().then(function(){var y=h._dbInfo;y.db.transaction(function(E){wt(E,y,"SELECT COUNT(key) as c FROM "+y.storeName,[],function(I,_){var T=_.rows.item(0).c;b(T)},function(I,_){v(_)})})}).catch(v)});return g(p,c),p}function Eg(c,h){var p=this,b=new f(function(v,y){p.ready().then(function(){var E=p._dbInfo;E.db.transaction(function(I){wt(I,E,"SELECT key FROM "+E.storeName+" WHERE id = ? LIMIT 1",[c+1],function(_,T){var C=T.rows.length?T.rows.item(0).key:null;v(C)},function(_,T){y(T)})})}).catch(y)});return g(b,h),b}function Ig(c){var h=this,p=new f(function(b,v){h.ready().then(function(){var y=h._dbInfo;y.db.transaction(function(E){wt(E,y,"SELECT key FROM "+y.storeName,[],function(I,_){for(var T=[],C=0;C<_.rows.length;C++)T.push(_.rows.item(C).key);b(T)},function(I,_){v(_)})})}).catch(v)});return g(p,c),p}function Sg(c){return new f(function(h,p){c.transaction(function(b){b.executeSql("SELECT name FROM sqlite_master WHERE type=\'table\' AND name <> \'__WebKitDatabaseInfoTable__\'",[],function(v,y){for(var E=[],I=0;I<y.rows.length;I++)E.push(y.rows.item(I).name);h({db:c,storeNames:E})},function(v,y){p(y)})},function(b){p(b)})})}function Og(c,h){h=S.apply(this,arguments);var p=this.config();c=typeof c!="function"&&c||{},c.name||(c.name=c.name||p.name,c.storeName=c.storeName||p.storeName);var b=this,v;return c.name?v=new f(function(y){var E;c.name===p.name?E=b._dbInfo.db:E=openDatabase(c.name,"","",0),c.storeName?y({db:E,storeNames:[c.storeName]}):y(Sg(E))}).then(function(y){return new f(function(E,I){y.db.transaction(function(_){function T(V){return new f(function(Y,pe){_.executeSql("DROP TABLE IF EXISTS "+V,[],function(){Y()},function(ce,ke){pe(ke)})})}for(var C=[],P=0,z=y.storeNames.length;P<z;P++)C.push(T(y.storeNames[P]));f.all(C).then(function(){E()}).catch(function(V){I(V)})},function(_){I(_)})})}):v=f.reject("Invalid arguments"),g(v,h),v}var Dg={_driver:"webSQLStorage",_initStorage:hg,_support:fg(),iterate:yg,getItem:gg,setItem:bg,removeItem:vg,clear:wg,length:xg,key:Eg,keys:Ig,dropInstance:Og};function _g(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function hu(c,h){var p=c.name+"/";return c.storeName!==h.storeName&&(p+=c.storeName+"/"),p}function Tg(){var c="_localforage_support_test";try{return localStorage.setItem(c,!0),localStorage.removeItem(c),!1}catch{return!0}}function Ng(){return!Tg()||localStorage.length>0}function Cg(c){var h=this,p={};if(c)for(var b in c)p[b]=c[b];return p.keyPrefix=hu(c,h._defaultConfig),Ng()?(h._dbInfo=p,p.serializer=Gi,f.resolve()):f.reject()}function Ag(c){var h=this,p=h.ready().then(function(){for(var b=h._dbInfo.keyPrefix,v=localStorage.length-1;v>=0;v--){var y=localStorage.key(v);y.indexOf(b)===0&&localStorage.removeItem(y)}});return g(p,c),p}function Rg(c,h){var p=this;c=x(c);var b=p.ready().then(function(){var v=p._dbInfo,y=localStorage.getItem(v.keyPrefix+c);return y&&(y=v.serializer.deserialize(y)),y});return g(b,h),b}function Fg(c,h){var p=this,b=p.ready().then(function(){for(var v=p._dbInfo,y=v.keyPrefix,E=y.length,I=localStorage.length,_=1,T=0;T<I;T++){var C=localStorage.key(T);if(C.indexOf(y)===0){var P=localStorage.getItem(C);if(P&&(P=v.serializer.deserialize(P)),P=c(P,C.substring(E),_++),P!==void 0)return P}}});return g(b,h),b}function $g(c,h){var p=this,b=p.ready().then(function(){var v=p._dbInfo,y;try{y=localStorage.key(c)}catch{y=null}return y&&(y=y.substring(v.keyPrefix.length)),y});return g(b,h),b}function Pg(c){var h=this,p=h.ready().then(function(){for(var b=h._dbInfo,v=localStorage.length,y=[],E=0;E<v;E++){var I=localStorage.key(E);I.indexOf(b.keyPrefix)===0&&y.push(I.substring(b.keyPrefix.length))}return y});return g(p,c),p}function kg(c){var h=this,p=h.keys().then(function(b){return b.length});return g(p,c),p}function Mg(c,h){var p=this;c=x(c);var b=p.ready().then(function(){var v=p._dbInfo;localStorage.removeItem(v.keyPrefix+c)});return g(b,h),b}function qg(c,h,p){var b=this;c=x(c);var v=b.ready().then(function(){h===void 0&&(h=null);var y=h;return new f(function(E,I){var _=b._dbInfo;_.serializer.serialize(h,function(T,C){if(C)I(C);else try{localStorage.setItem(_.keyPrefix+c,T),E(y)}catch(P){(P.name==="QuotaExceededError"||P.name==="NS_ERROR_DOM_QUOTA_REACHED")&&I(P),I(P)}})})});return g(v,p),v}function jg(c,h){if(h=S.apply(this,arguments),c=typeof c!="function"&&c||{},!c.name){var p=this.config();c.name=c.name||p.name,c.storeName=c.storeName||p.storeName}var b=this,v;return c.name?v=new f(function(y){c.storeName?y(hu(c,b._defaultConfig)):y(c.name+"/")}).then(function(y){for(var E=localStorage.length-1;E>=0;E--){var I=localStorage.key(E);I.indexOf(y)===0&&localStorage.removeItem(I)}}):v=f.reject("Invalid arguments"),g(v,h),v}var Lg={_driver:"localStorageWrapper",_initStorage:Cg,_support:_g(),iterate:Fg,getItem:Rg,setItem:qg,removeItem:Mg,clear:Ag,length:kg,key:$g,keys:Pg,dropInstance:jg},Bg=function(h,p){return h===p||typeof h=="number"&&typeof p=="number"&&isNaN(h)&&isNaN(p)},Ug=function(h,p){for(var b=h.length,v=0;v<b;){if(Bg(h[v],p))return!0;v++}return!1},gu=Array.isArray||function(c){return Object.prototype.toString.call(c)==="[object Array]"},Rr={},yu={},or={INDEXEDDB:lg,WEBSQL:Dg,LOCALSTORAGE:Lg},zg=[or.INDEXEDDB._driver,or.WEBSQL._driver,or.LOCALSTORAGE._driver],Xn=["dropInstance"],Hi=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Xn),Wg={description:"",driver:zg.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Kg(c,h){c[h]=function(){var p=arguments;return c.ready().then(function(){return c[h].apply(c,p)})}}function Ji(){for(var c=1;c<arguments.length;c++){var h=arguments[c];if(h)for(var p in h)h.hasOwnProperty(p)&&(gu(h[p])?arguments[0][p]=h[p].slice():arguments[0][p]=h[p])}return arguments[0]}var Gg=function(){function c(h){a(this,c);for(var p in or)if(or.hasOwnProperty(p)){var b=or[p],v=b._driver;this[p]=v,Rr[v]||this.defineDriver(b)}this._defaultConfig=Ji({},Wg),this._config=Ji({},this._defaultConfig,h),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return c.prototype.config=function(p){if((typeof p>"u"?"undefined":s(p))==="object"){if(this._ready)return new Error("Can\'t call config() after localforage has been used.");for(var b in p){if(b==="storeName"&&(p[b]=p[b].replace(/\\W/g,"_")),b==="version"&&typeof p[b]!="number")return new Error("Database version must be a number.");this._config[b]=p[b]}return"driver"in p&&p.driver?this.setDriver(this._config.driver):!0}else return typeof p=="string"?this._config[p]:this._config},c.prototype.defineDriver=function(p,b,v){var y=new f(function(E,I){try{var _=p._driver,T=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!p._driver){I(T);return}for(var C=Hi.concat("_initStorage"),P=0,z=C.length;P<z;P++){var V=C[P],Y=!Ug(Xn,V);if((Y||p[V])&&typeof p[V]!="function"){I(T);return}}var pe=function(){for(var Fr=function(Vg){return function(){var Yg=new Error("Method "+Vg+" is not implemented by the current driver"),bu=f.reject(Yg);return g(bu,arguments[arguments.length-1]),bu}},Vi=0,Jg=Xn.length;Vi<Jg;Vi++){var Yi=Xn[Vi];p[Yi]||(p[Yi]=Fr(Yi))}};pe();var ce=function(Fr){Rr[_]&&console.info("Redefining LocalForage driver: "+_),Rr[_]=p,yu[_]=Fr,E()};"_support"in p?p._support&&typeof p._support=="function"?p._support().then(ce,I):ce(!!p._support):ce(!0)}catch(ke){I(ke)}});return w(y,b,v),y},c.prototype.driver=function(){return this._driver||null},c.prototype.getDriver=function(p,b,v){var y=Rr[p]?f.resolve(Rr[p]):f.reject(new Error("Driver not found."));return w(y,b,v),y},c.prototype.getSerializer=function(p){var b=f.resolve(Gi);return w(b,p),b},c.prototype.ready=function(p){var b=this,v=b._driverSet.then(function(){return b._ready===null&&(b._ready=b._initDriver()),b._ready});return w(v,p,p),v},c.prototype.setDriver=function(p,b,v){var y=this;gu(p)||(p=[p]);var E=this._getSupportedDrivers(p);function I(){y._config.driver=y.driver()}function _(P){return y._extend(P),I(),y._ready=y._initStorage(y._config),y._ready}function T(P){return function(){var z=0;function V(){for(;z<P.length;){var Y=P[z];return z++,y._dbInfo=null,y._ready=null,y.getDriver(Y).then(_).catch(V)}I();var pe=new Error("No available storage method found.");return y._driverSet=f.reject(pe),y._driverSet}return V()}}var C=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=C.then(function(){var P=E[0];return y._dbInfo=null,y._ready=null,y.getDriver(P).then(function(z){y._driver=z._driver,I(),y._wrapLibraryMethodsWithReady(),y._initDriver=T(E)})}).catch(function(){I();var P=new Error("No available storage method found.");return y._driverSet=f.reject(P),y._driverSet}),w(this._driverSet,b,v),this._driverSet},c.prototype.supports=function(p){return!!yu[p]},c.prototype._extend=function(p){Ji(this,p)},c.prototype._getSupportedDrivers=function(p){for(var b=[],v=0,y=p.length;v<y;v++){var E=p[v];this.supports(E)&&b.push(E)}return b},c.prototype._wrapLibraryMethodsWithReady=function(){for(var p=0,b=Hi.length;p<b;p++)Kg(this,Hi[p])},c.prototype.createInstance=function(p){return new c(p)},c}(),Hg=new Gg;o.exports=Hg},{3:3}]},{},[4])(4)})});var dl=D((eA,ml)=>{var gr=1e3,yr=gr*60,br=yr*60,zt=br*24,Lv=zt*7,Bv=zt*365.25;ml.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return Uv(e);if(r==="number"&&isFinite(e))return t.long?Wv(e):zv(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Uv(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*Bv;case"weeks":case"week":case"w":return r*Lv;case"days":case"day":case"d":return r*zt;case"hours":case"hour":case"hrs":case"hr":case"h":return r*br;case"minutes":case"minute":case"mins":case"min":case"m":return r*yr;case"seconds":case"second":case"secs":case"sec":case"s":return r*gr;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function zv(e){var t=Math.abs(e);return t>=zt?Math.round(e/zt)+"d":t>=br?Math.round(e/br)+"h":t>=yr?Math.round(e/yr)+"m":t>=gr?Math.round(e/gr)+"s":e+"ms"}function Wv(e){var t=Math.abs(e);return t>=zt?Wo(e,t,zt,"day"):t>=br?Wo(e,t,br,"hour"):t>=yr?Wo(e,t,yr,"minute"):t>=gr?Wo(e,t,gr,"second"):e+" ms"}function Wo(e,t,r,n){var o=t>=r*1.5;return Math.round(e/r)+" "+n+(o?"s":"")}});var gl=D((tA,hl)=>{function Kv(e){r.debug=r,r.default=r,r.coerce=u,r.disable=i,r.enable=o,r.enabled=s,r.humanize=dl(),r.destroy=m,Object.keys(e).forEach(l=>{r[l]=e[l]}),r.names=[],r.skips=[],r.formatters={};function t(l){let d=0;for(let f=0;f<l.length;f++)d=(d<<5)-d+l.charCodeAt(f),d|=0;return r.colors[Math.abs(d)%r.colors.length]}r.selectColor=t;function r(l){let d,f=null,g,w;function x(...S){if(!x.enabled)return;let N=x,M=Number(new Date),k=M-(d||M);N.diff=k,N.prev=d,N.curr=M,d=M,S[0]=r.coerce(S[0]),typeof S[0]!="string"&&S.unshift("%O");let ee=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,(A,B)=>{if(A==="%%")return"%";ee++;let L=r.formatters[B];if(typeof L=="function"){let F=S[ee];A=L.call(N,F),S.splice(ee,1),ee--}return A}),r.formatArgs.call(N,S),(N.log||r.log).apply(N,S)}return x.namespace=l,x.useColors=r.useColors(),x.color=r.selectColor(l),x.extend=n,x.destroy=r.destroy,Object.defineProperty(x,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(g!==r.namespaces&&(g=r.namespaces,w=r.enabled(l)),w),set:S=>{f=S}}),typeof r.init=="function"&&r.init(x),x}function n(l,d){let f=r(this.namespace+(typeof d>"u"?":":d)+l);return f.log=this.log,f}function o(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let d,f=(typeof l=="string"?l:"").split(/[\\s,]+/),g=f.length;for(d=0;d<g;d++)f[d]&&(l=f[d].replace(/\\*/g,".*?"),l[0]==="-"?r.skips.push(new RegExp("^"+l.slice(1)+"$")):r.names.push(new RegExp("^"+l+"$")))}function i(){let l=[...r.names.map(a),...r.skips.map(a).map(d=>"-"+d)].join(",");return r.enable(""),l}function s(l){if(l[l.length-1]==="*")return!0;let d,f;for(d=0,f=r.skips.length;d<f;d++)if(r.skips[d].test(l))return!1;for(d=0,f=r.names.length;d<f;d++)if(r.names[d].test(l))return!0;return!1}function a(l){return l.toString().substring(2,l.toString().length-2).replace(/\\.\\*\\?$/,"*")}function u(l){return l instanceof Error?l.stack||l.message:l}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}hl.exports=Kv});var we=D((Fe,Ko)=>{Fe.formatArgs=Hv;Fe.save=Jv;Fe.load=Vv;Fe.useColors=Gv;Fe.storage=Yv();Fe.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`."))}})();Fe.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 Gv(){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 Hv(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+Ko.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)}Fe.log=console.debug||console.log||(()=>{});function Jv(e){try{e?Fe.storage.setItem("debug",e):Fe.storage.removeItem("debug")}catch{}}function Vv(){let e;try{e=Fe.storage.getItem("debug")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function Yv(){try{return localStorage}catch{}}Ko.exports=gl()(Fe);var{formatters:Zv}=Ko.exports;Zv.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var bl=D((rA,yl)=>{"use strict";yl.exports=Qv;function vr(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function Qv(e){if(e=e||{},e.circles)return Xv(e);return e.proto?n:r;function t(o,i){for(var s=Object.keys(o),a=new Array(s.length),u=0;u<s.length;u++){var m=s[u],l=o[m];typeof l!="object"||l===null?a[m]=l:l instanceof Date?a[m]=new Date(l):ArrayBuffer.isView(l)?a[m]=vr(l):a[m]=i(l)}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]=vr(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]=vr(a):i[s]=n(a)}return i}}function Xv(e){var t=[],r=[];return e.proto?i:o;function n(s,a){for(var u=Object.keys(s),m=new Array(u.length),l=0;l<u.length;l++){var d=u[l],f=s[d];if(typeof f!="object"||f===null)m[d]=f;else if(f instanceof Date)m[d]=new Date(f);else if(ArrayBuffer.isView(f))m[d]=vr(f);else{var g=t.indexOf(f);g!==-1?m[d]=r[g]:m[d]=a(f)}}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 u in s)if(Object.hasOwnProperty.call(s,u)!==!1){var m=s[u];if(typeof m!="object"||m===null)a[u]=m;else if(m instanceof Date)a[u]=new Date(m);else if(m instanceof Map)a[u]=new Map(n(Array.from(m),o));else if(m instanceof Set)a[u]=new Set(n(Array.from(m),o));else if(ArrayBuffer.isView(m))a[u]=vr(m);else{var l=t.indexOf(m);l!==-1?a[u]=r[l]:a[u]=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 u in s){var m=s[u];if(typeof m!="object"||m===null)a[u]=m;else if(m instanceof Date)a[u]=new Date(m);else if(m instanceof Map)a[u]=new Map(n(Array.from(m),i));else if(m instanceof Set)a[u]=new Set(n(Array.from(m),i));else if(ArrayBuffer.isView(m))a[u]=vr(m);else{var l=t.indexOf(m);l!==-1?a[u]=r[l]:a[u]=i(m)}}return t.pop(),r.pop(),a}}});var Kt=D((nA,El)=>{var ew=require("util"),Wt=we()("log4js:configuration"),Go=[],Ho=[],vl=e=>!e,wl=e=>e&&typeof e=="object"&&!Array.isArray(e),tw=e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),rw=e=>e&&typeof e=="number"&&Number.isInteger(e),nw=e=>{Ho.push(e),Wt(`Added listener, now ${Ho.length} listeners`)},ow=e=>{Go.push(e),Wt(`Added pre-processing listener, now ${Go.length} listeners`)},xl=(e,t,r)=>{(Array.isArray(t)?t:[t]).forEach(o=>{if(o)throw new Error(`Problem with log4js configuration: (${ew.inspect(e,{depth:5})}) - ${r}`)})},iw=e=>{Wt("New configuration to be validated: ",e),xl(e,vl(wl(e)),"must be an object."),Wt(`Calling pre-processing listeners (${Go.length})`),Go.forEach(t=>t(e)),Wt("Configuration pre-processing finished."),Wt(`Calling configuration listeners (${Ho.length})`),Ho.forEach(t=>t(e)),Wt("Configuration finished.")};El.exports={configure:iw,addListener:nw,addPreProcessingListener:ow,throwExceptionIf:xl,anObject:wl,anInteger:rw,validIdentifier:tw,not:vl}});var Jo=D((oA,ze)=>{"use strict";function Il(e,t){for(var r=e.toString();r.length<t;)r="0"+r;return r}function Gt(e){return Il(e,2)}function sw(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 Sl(e,t){typeof e!="string"&&(t=e,e=ze.exports.ISO8601_FORMAT),t||(t=ze.exports.now());var r=Gt(t.getDate()),n=Gt(t.getMonth()+1),o=Gt(t.getFullYear()),i=Gt(o.substring(2,4)),s=e.indexOf("yyyy")>-1?o:i,a=Gt(t.getHours()),u=Gt(t.getMinutes()),m=Gt(t.getSeconds()),l=Il(t.getMilliseconds(),3),d=sw(t.getTimezoneOffset()),f=e.replace(/dd/g,r).replace(/MM/g,n).replace(/y{1,4}/g,s).replace(/hh/g,a).replace(/mm/g,u).replace(/ss/g,m).replace(/SSS/g,l).replace(/O/g,d);return f}function _t(e,t,r,n){e["set"+(n?"":"UTC")+t](r)}function aw(e,t,r){var n=e.indexOf("O")<0,o=!1,i=[{pattern:/y{1,4}/,regexp:"\\\\d{1,4}",fn:function(d,f){_t(d,"FullYear",f,n)}},{pattern:/MM/,regexp:"\\\\d{1,2}",fn:function(d,f){_t(d,"Month",f-1,n),d.getMonth()!==f-1&&(o=!0)}},{pattern:/dd/,regexp:"\\\\d{1,2}",fn:function(d,f){o&&_t(d,"Month",d.getMonth()-1,n),_t(d,"Date",f,n)}},{pattern:/hh/,regexp:"\\\\d{1,2}",fn:function(d,f){_t(d,"Hours",f,n)}},{pattern:/mm/,regexp:"\\\\d\\\\d",fn:function(d,f){_t(d,"Minutes",f,n)}},{pattern:/ss/,regexp:"\\\\d\\\\d",fn:function(d,f){_t(d,"Seconds",f,n)}},{pattern:/SSS/,regexp:"\\\\d\\\\d\\\\d",fn:function(d,f){_t(d,"Milliseconds",f,n)}},{pattern:/O/,regexp:"[+-]\\\\d{1,2}:?\\\\d{2}?|Z",fn:function(d,f){f==="Z"?f=0:f=f.replace(":","");var g=Math.abs(f),w=(f>0?-1:1)*(g%100+Math.floor(g/100)*60);d.setUTCMinutes(d.getUTCMinutes()+w)}}],s=i.reduce(function(d,f){return f.pattern.test(d.regexp)?(f.index=d.regexp.match(f.pattern).index,d.regexp=d.regexp.replace(f.pattern,"("+f.regexp+")")):f.index=-1,d},{regexp:e,index:[]}),a=i.filter(function(d){return d.index>-1});a.sort(function(d,f){return d.index-f.index});var u=new RegExp(s.regexp),m=u.exec(t);if(m){var l=r||ze.exports.now();return a.forEach(function(d,f){d.fn(l,m[f+1])}),l}throw new Error("String \'"+t+"\' could not be parsed as \'"+e+"\'")}function uw(e,t,r){if(!e)throw new Error("pattern must be supplied");return aw(e,t,r)}function cw(){return new Date}ze.exports=Sl;ze.exports.asString=Sl;ze.exports.parse=uw;ze.exports.now=cw;ze.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS";ze.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO";ze.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS";ze.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"});var Ys=D((iA,kl)=>{var Tt=Jo(),Ol=require("os"),bn=require("util"),yn=require("path"),Dl=require("url"),_l=we()("log4js:layouts"),Tl={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 Nl(e){return e?`\\x1B[${Tl[e][0]}m`:""}function Cl(e){return e?`\\x1B[${Tl[e][1]}m`:""}function lw(e,t){return Nl(t)+e+Cl(t)}function Al(e,t){return lw(bn.format("[%s] [%s] %s - ",Tt.asString(e.startTime),e.level.toString(),e.categoryName),t)}function Rl(e){return Al(e)+bn.format(...e.data)}function Vo(e){return Al(e,e.level.colour)+bn.format(...e.data)}function Fl(e){return bn.format(...e.data)}function $l(e){return e.data[0]}function Pl(e,t){let r="%r %p %c - %m%n",n=/%(-?[0-9]+)?(\\.?-?[0-9]+)?([[\\]cdhmnprzxXyflos%])(\\{([^}]+)\\})?|([^%]+)/;e=e||r;function o(O,$){let R=O.categoryName;if($){let U=parseInt($,10),q=R.split(".");U<q.length&&(R=q.slice(q.length-U).join("."))}return R}function i(O,$){let R=Tt.ISO8601_FORMAT;if($)switch(R=$,R){case"ISO8601":case"ISO8601_FORMAT":R=Tt.ISO8601_FORMAT;break;case"ISO8601_WITH_TZ_OFFSET":case"ISO8601_WITH_TZ_OFFSET_FORMAT":R=Tt.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"),_l("[log4js-node-DEP0003]","DEPRECATION: Pattern %d{ABSOLUTE} is deprecated and replaced by %d{ABSOLUTETIME}.");case"ABSOLUTETIME":case"ABSOLUTETIME_FORMAT":R=Tt.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"),_l("[log4js-node-DEP0004]","DEPRECATION: Pattern %d{DATE} is deprecated and replaced by %d{DATETIME}.");case"DATETIME":case"DATETIME_FORMAT":R=Tt.DATETIME_FORMAT;break}return Tt.asString(R,O.startTime)}function s(){return Ol.hostname().toString()}function a(O){return bn.format(...O.data)}function u(){return Ol.EOL}function m(O){return O.level.toString()}function l(O){return Tt.asString("hh:mm:ss",O.startTime)}function d(O){return Nl(O.level.colour)}function f(O){return Cl(O.level.colour)}function g(){return"%"}function w(O){return O&&O.pid?O.pid.toString():process.pid.toString()}function x(){return w()}function S(O,$){return typeof t[$]<"u"?typeof t[$]=="function"?t[$](O):t[$]:null}function N(O,$){let R=O.context[$];return typeof R<"u"?typeof R=="function"?R(O):R:null}function M(O,$){let R=O.fileName||"";if(R=function(q){let W="file://";return q.startsWith(W)&&(typeof Dl.fileURLToPath=="function"?q=Dl.fileURLToPath(q):(q=yn.normalize(q.replace(new RegExp(`^${W}`),"")),process.platform==="win32"&&(q.startsWith("\\\\")?q=q.slice(1):q=yn.sep+yn.sep+q))),q}(R),$){let q=parseInt($,10),W=R.split(yn.sep);W.length>q&&(R=W.slice(-q).join(yn.sep))}return R}function k(O){return O.lineNumber?`${O.lineNumber}`:""}function ee(O){return O.columnNumber?`${O.columnNumber}`:""}function xe(O){return O.callStack||""}let A={c:o,d:i,h:s,m:a,n:u,p:m,r:l,"[":d,"]":f,y:x,z:w,"%":g,x:S,X:N,f:M,l:k,o:ee,s:xe};function B(O,$,R){return A[O]($,R)}function L(O,$){let R;return O?(R=parseInt(O.slice(1),10),R>0?$.slice(0,R):$.slice(R)):$}function F(O,$){let R;if(O)if(O.charAt(0)==="-")for(R=parseInt(O.slice(1),10);$.length<R;)$+=" ";else for(R=parseInt(O,10);$.length<R;)$=` ${$}`;return $}function j(O,$,R){let U=O;return U=L($,U),U=F(R,U),U}return function(O){let $="",R,U=e;for(;(R=n.exec(U))!==null;){let q=R[1],W=R[2],K=R[3],X=R[5],J=R[6];if(J)$+=J.toString();else{let Zn=B(K,O,X);$+=j(Zn,W,q)}U=U.slice(R.index+R[0].length)}return $}}var Vs={messagePassThrough(){return Fl},basic(){return Rl},colored(){return Vo},coloured(){return Vo},pattern(e){return Pl(e&&e.pattern,e&&e.tokens)},dummy(){return $l}};kl.exports={basicLayout:Rl,messagePassThroughLayout:Fl,patternLayout:Pl,colouredLayout:Vo,coloredLayout:Vo,dummyLayout:$l,addLayout(e,t){Vs[e]=t},layout(e,t){return Vs[e]&&Vs[e](t)}}});var Ht=D((sA,ql)=>{var me=Kt(),Ml=["white","grey","black","blue","cyan","green","magenta","red","yellow"],de=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 de?t:(t instanceof Object&&t.levelStr&&(t=t.levelStr),de[t.toString().toUpperCase()]||r):r}static addLevels(t){t&&(Object.keys(t).forEach(n=>{let o=n.toUpperCase();de[o]=new de(t[n].value,o,t[n].colour);let i=de.levels.findIndex(s=>s.levelStr===o);i>-1?de.levels[i]=de[o]:de.levels.push(de[o])}),de.levels.sort((n,o)=>n.level-o.level))}isLessThanOrEqualTo(t){return typeof t=="string"&&(t=de.getLevel(t)),this.level<=t.level}isGreaterThanOrEqualTo(t){return typeof t=="string"&&(t=de.getLevel(t)),this.level>=t.level}isEqualTo(t){return typeof t=="string"&&(t=de.getLevel(t)),this.level===t.level}};de.levels=[];de.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"}});me.addListener(e=>{let t=e.levels;t&&(me.throwExceptionIf(e,me.not(me.anObject(t)),"levels must be an object"),Object.keys(t).forEach(n=>{me.throwExceptionIf(e,me.not(me.validIdentifier(n)),`level name "${n}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),me.throwExceptionIf(e,me.not(me.anObject(t[n])),`level "${n}" must be an object`),me.throwExceptionIf(e,me.not(t[n].value),`level "${n}" must have a \'value\' property`),me.throwExceptionIf(e,me.not(me.anInteger(t[n].value)),`level "${n}".value must have an integer value`),me.throwExceptionIf(e,me.not(t[n].colour),`level "${n}" must have a \'colour\' property`),me.throwExceptionIf(e,me.not(Ml.indexOf(t[n].colour)>-1),`level "${n}".colour must be one of ${Ml.join(", ")}`)}))});me.addListener(e=>{de.addLevels(e.levels)});ql.exports=de});var Jl=D(wn=>{"use strict";var{parse:Bl,stringify:Ul}=JSON,{keys:fw}=Object,vn=String,zl="string",jl={},Yo="object",Wl=(e,t)=>t,pw=e=>e instanceof vn?vn(e):e,mw=(e,t)=>typeof t===zl?new vn(t):t,Kl=(e,t,r,n)=>{let o=[];for(let i=fw(r),{length:s}=i,a=0;a<s;a++){let u=i[a],m=r[u];if(m instanceof vn){let l=e[m];typeof l===Yo&&!t.has(l)?(t.add(l),r[u]=jl,o.push({k:u,a:[e,t,l,n]})):r[u]=n.call(r,u,l)}else r[u]!==jl&&(r[u]=n.call(r,u,m))}for(let{length:i}=o,s=0;s<i;s++){let{k:a,a:u}=o[s];r[a]=n.call(r,a,Kl.apply(null,u))}return r},Ll=(e,t,r)=>{let n=vn(t.push(r)-1);return e.set(r,n),n},Gl=(e,t)=>{let r=Bl(e,mw).map(pw),n=r[0],o=t||Wl,i=typeof n===Yo&&n?Kl(r,new Set,n,o):n;return o.call({"":i},"",i)};wn.parse=Gl;var Hl=(e,t,r)=>{let n=t&&typeof t===Yo?(l,d)=>l===""||-1<t.indexOf(l)?d:void 0:t||Wl,o=new Map,i=[],s=[],a=+Ll(o,i,n.call({"":e},"",e)),u=!a;for(;a<i.length;)u=!0,s[a]=Ul(i[a++],m,r);return"["+s.join(",")+"]";function m(l,d){if(u)return u=!u,d;let f=n.call(this,l,d);switch(typeof f){case Yo:if(f===null)return f;case zl:return o.get(f)||Ll(o,i,f)}return f}};wn.stringify=Hl;var dw=e=>Bl(Hl(e));wn.toJSON=dw;var hw=e=>Gl(Ul(e));wn.fromJSON=hw});var Zs=D((uA,Zl)=>{var Vl=Jl(),Yl=Ht(),wr=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 Vl.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=Vl.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 wr(n.categoryName,Yl.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 wr("log4js",Yl.ERROR,["Unable to parse log:",t,"because: ",n])}return r}};Zl.exports=wr});var Qo=D((cA,ef)=>{var We=we()("log4js:clustering"),gw=Zs(),yw=Kt(),xr=!1,Ke=null;try{Ke=require("cluster")}catch{We("cluster module not present"),xr=!0}var Xs=[],En=!1,xn="NODE_APP_INSTANCE",Ql=()=>En&&process.env[xn]==="0",Qs=()=>xr||Ke&&Ke.isMaster||Ql(),Xl=e=>{Xs.forEach(t=>t(e))},Zo=(e,t)=>{if(We("cluster message received from worker ",e,": ",t),e.topic&&e.data&&(t=e,e=void 0),t&&t.topic&&t.topic==="log4js:message"){We("received message: ",t.data);let r=gw.deserialise(t.data);Xl(r)}};xr||yw.addListener(e=>{Xs.length=0,{pm2:En,disableClustering:xr,pm2InstanceVar:xn="NODE_APP_INSTANCE"}=e,We(`clustering disabled ? ${xr}`),We(`cluster.isMaster ? ${Ke&&Ke.isMaster}`),We(`pm2 enabled ? ${En}`),We(`pm2InstanceVar = ${xn}`),We(`process.env[${xn}] = ${process.env[xn]}`),En&&process.removeListener("message",Zo),Ke&&Ke.removeListener&&Ke.removeListener("message",Zo),xr||e.disableClustering?We("Not listening for cluster messages, because clustering disabled."):Ql()?(We("listening for PM2 broadcast messages"),process.on("message",Zo)):Ke&&Ke.isMaster?(We("listening for cluster messages"),Ke.on("message",Zo)):We("not listening for messages, because we are not a master process")});ef.exports={onlyOnMaster:(e,t)=>Qs()?e():t,isMaster:Qs,send:e=>{Qs()?Xl(e):(En||(e.cluster={workerId:Ke.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{Xs.push(e)}}});var nf=D((lA,rf)=>{function bw(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 vw(e,t){let r=Object.assign({},t);return Object.keys(e).forEach(n=>{r[n]&&(r[n]=e[n](t[n]))}),r}function ea(e){return vw({maxLogSize:bw},e)}var tf={dateFile:ea,file:ea,fileSync:ea};rf.exports.modifyConfig=e=>tf[e.type]?tf[e.type](e):e});var sf=D((fA,of)=>{var ww=console.log.bind(console);function xw(e,t){return r=>{ww(e(r,t))}}function Ew(e,t){let r=t.colouredLayout;return e.layout&&(r=t.layout(e.layout.type,e.layout)),xw(r,e.timezoneOffset)}of.exports.configure=Ew});var uf=D(af=>{function Iw(e,t){return r=>{process.stdout.write(`${e(r,t)}\n`)}}function Sw(e,t){let r=t.colouredLayout;return e.layout&&(r=t.layout(e.layout.type,e.layout)),Iw(r,e.timezoneOffset)}af.configure=Sw});var lf=D((mA,cf)=>{function Ow(e,t){return r=>{process.stderr.write(`${e(r,t)}\n`)}}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=D((dA,ff)=>{function _w(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 Tw(e,t,r,n){let o=r(e.appender);return _w(e.level,e.maxLevel,o,n)}ff.exports.configure=Tw});var hf=D((hA,df)=>{var mf=we()("log4js:categoryFilter");function Nw(e,t){return typeof e=="string"&&(e=[e]),r=>{mf(`Checking ${r.categoryName} against ${e}`),e.indexOf(r.categoryName)===-1&&(mf("Not excluded, sending to appender"),t(r))}}function Cw(e,t,r){let n=r(e.appender);return Nw(e.exclude,n)}df.exports.configure=Cw});var bf=D((gA,yf)=>{var gf=we()("log4js:noLogFilter");function Aw(e){return e.filter(r=>r!=null&&r!=="")}function Rw(e,t){return r=>{gf(`Checking data: ${r.data} against filters: ${e}`),typeof e=="string"&&(e=[e]),e=Aw(e);let n=new RegExp(e.join("|"),"i");(e.length===0||r.data.findIndex(o=>n.test(o))<0)&&(gf("Not excluded, sending to appender"),t(r))}}function Fw(e,t,r){let n=r(e.appender);return Rw(e.exclude,n)}yf.exports.configure=Fw});var Ce=D(ta=>{"use strict";ta.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})};ta.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 wf=D((bA,vf)=>{var Nt=require("constants"),$w=process.cwd,Xo=null,Pw=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Xo||(Xo=$w.call(process)),Xo};try{process.cwd()}catch{}typeof process.chdir=="function"&&(ra=process.chdir,process.chdir=function(e){Xo=null,ra.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,ra));var ra;vf.exports=kw;function kw(e){Nt.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=u(e.statSync),e.fstatSync=u(e.fstatSync),e.lstatSync=u(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(l,d,f){f&&process.nextTick(f)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(l,d,f,g){g&&process.nextTick(g)},e.lchownSync=function(){}),Pw==="win32"&&(e.rename=typeof e.rename!="function"?e.rename:function(l){function d(f,g,w){var x=Date.now(),S=0;l(f,g,function N(M){if(M&&(M.code==="EACCES"||M.code==="EPERM"||M.code==="EBUSY")&&Date.now()-x<6e4){setTimeout(function(){e.stat(g,function(k,ee){k&&k.code==="ENOENT"?l(f,g,N):w(M)})},S),S<100&&(S+=10);return}w&&w(M)})}return Object.setPrototypeOf&&Object.setPrototypeOf(d,l),d}(e.rename)),e.read=typeof e.read!="function"?e.read:function(l){function d(f,g,w,x,S,N){var M;if(N&&typeof N=="function"){var k=0;M=function(ee,xe,A){if(ee&&ee.code==="EAGAIN"&&k<10)return k++,l.call(e,f,g,w,x,S,M);N.apply(this,arguments)}}return l.call(e,f,g,w,x,S,M)}return Object.setPrototypeOf&&Object.setPrototypeOf(d,l),d}(e.read),e.readSync=typeof e.readSync!="function"?e.readSync:function(l){return function(d,f,g,w,x){for(var S=0;;)try{return l.call(e,d,f,g,w,x)}catch(N){if(N.code==="EAGAIN"&&S<10){S++;continue}throw N}}}(e.readSync);function t(l){l.lchmod=function(d,f,g){l.open(d,Nt.O_WRONLY|Nt.O_SYMLINK,f,function(w,x){if(w){g&&g(w);return}l.fchmod(x,f,function(S){l.close(x,function(N){g&&g(S||N)})})})},l.lchmodSync=function(d,f){var g=l.openSync(d,Nt.O_WRONLY|Nt.O_SYMLINK,f),w=!0,x;try{x=l.fchmodSync(g,f),w=!1}finally{if(w)try{l.closeSync(g)}catch{}else l.closeSync(g)}return x}}function r(l){Nt.hasOwnProperty("O_SYMLINK")&&l.futimes?(l.lutimes=function(d,f,g,w){l.open(d,Nt.O_SYMLINK,function(x,S){if(x){w&&w(x);return}l.futimes(S,f,g,function(N){l.close(S,function(M){w&&w(N||M)})})})},l.lutimesSync=function(d,f,g){var w=l.openSync(d,Nt.O_SYMLINK),x,S=!0;try{x=l.futimesSync(w,f,g),S=!1}finally{if(S)try{l.closeSync(w)}catch{}else l.closeSync(w)}return x}):l.futimes&&(l.lutimes=function(d,f,g,w){w&&process.nextTick(w)},l.lutimesSync=function(){})}function n(l){return l&&function(d,f,g){return l.call(e,d,f,function(w){m(w)&&(w=null),g&&g.apply(this,arguments)})}}function o(l){return l&&function(d,f){try{return l.call(e,d,f)}catch(g){if(!m(g))throw g}}}function i(l){return l&&function(d,f,g,w){return l.call(e,d,f,g,function(x){m(x)&&(x=null),w&&w.apply(this,arguments)})}}function s(l){return l&&function(d,f,g){try{return l.call(e,d,f,g)}catch(w){if(!m(w))throw w}}}function a(l){return l&&function(d,f,g){typeof f=="function"&&(g=f,f=null);function w(x,S){S&&(S.uid<0&&(S.uid+=4294967296),S.gid<0&&(S.gid+=4294967296)),g&&g.apply(this,arguments)}return f?l.call(e,d,f,w):l.call(e,d,w)}}function u(l){return l&&function(d,f){var g=f?l.call(e,d,f):l.call(e,d);return g&&(g.uid<0&&(g.uid+=4294967296),g.gid<0&&(g.gid+=4294967296)),g}}function m(l){if(!l||l.code==="ENOSYS")return!0;var d=!process.getuid||process.getuid()!==0;return!!(d&&(l.code==="EINVAL"||l.code==="EPERM"))}}});var If=D((vA,Ef)=>{var xf=require("stream").Stream;Ef.exports=Mw;function Mw(e){return{ReadStream:t,WriteStream:r};function t(n,o){if(!(this instanceof t))return new t(n,o);xf.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,u=s.length;a<u;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(l,d){if(l){i.emit("error",l),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);xf.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 u=i[s];this[u]=o[u]}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 Of=D((wA,Sf)=>{"use strict";Sf.exports=jw;var qw=Object.getPrototypeOf||function(e){return e.__proto__};function jw(e){if(e===null||typeof e!="object")return e;if(e instanceof Object)var t={__proto__:qw(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}});var he=D((xA,ia)=>{var ae=require("fs"),Lw=wf(),Bw=If(),Uw=Of(),ei=require("util"),Ee,ri;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Ee=Symbol.for("graceful-fs.queue"),ri=Symbol.for("graceful-fs.previous")):(Ee="___graceful-fs.queue",ri="___graceful-fs.previous");function zw(){}function Tf(e,t){Object.defineProperty(e,Ee,{get:function(){return t}})}var Jt=zw;ei.debuglog?Jt=ei.debuglog("gfs4"):/\\bgfs4\\b/i.test(process.env.NODE_DEBUG||"")&&(Jt=function(){var e=ei.format.apply(ei,arguments);e="GFS4: "+e.split(/\\n/).join(`\nGFS4: `),console.error(e)});ae[Ee]||(Df=global[Ee]||[],Tf(ae,Df),ae.close=function(e){function t(r,n){return e.call(ae,r,function(o){o||_f(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(t,ri,{value:e}),t}(ae.close),ae.closeSync=function(e){function t(r){e.apply(ae,arguments),_f()}return Object.defineProperty(t,ri,{value:e}),t}(ae.closeSync),/\\bgfs4\\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Jt(ae[Ee]),require("assert").equal(ae[Ee].length,0)}));var Df;global[Ee]||Tf(global,ae[Ee]);ia.exports=na(Uw(ae));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!ae.__patched&&(ia.exports=na(ae),ae.__patched=!0);function na(e){Lw(e),e.gracefulify=na,e.createReadStream=xe,e.createWriteStream=A;var t=e.readFile;e.readFile=r;function r(F,j,O){return typeof j=="function"&&(O=j,j=null),$(F,j,O);function $(R,U,q,W){return t(R,U,function(K){K&&(K.code==="EMFILE"||K.code==="ENFILE")?Er([$,[R,U,q],K,W||Date.now(),Date.now()]):typeof q=="function"&&q.apply(this,arguments)})}}var n=e.writeFile;e.writeFile=o;function o(F,j,O,$){return typeof O=="function"&&($=O,O=null),R(F,j,O,$);function R(U,q,W,K,X){return n(U,q,W,function(J){J&&(J.code==="EMFILE"||J.code==="ENFILE")?Er([R,[U,q,W,K],J,X||Date.now(),Date.now()]):typeof K=="function"&&K.apply(this,arguments)})}}var i=e.appendFile;i&&(e.appendFile=s);function s(F,j,O,$){return typeof O=="function"&&($=O,O=null),R(F,j,O,$);function R(U,q,W,K,X){return i(U,q,W,function(J){J&&(J.code==="EMFILE"||J.code==="ENFILE")?Er([R,[U,q,W,K],J,X||Date.now(),Date.now()]):typeof K=="function"&&K.apply(this,arguments)})}}var a=e.copyFile;a&&(e.copyFile=u);function u(F,j,O,$){return typeof O=="function"&&($=O,O=0),R(F,j,O,$);function R(U,q,W,K,X){return a(U,q,W,function(J){J&&(J.code==="EMFILE"||J.code==="ENFILE")?Er([R,[U,q,W,K],J,X||Date.now(),Date.now()]):typeof K=="function"&&K.apply(this,arguments)})}}var m=e.readdir;e.readdir=d;var l=/^v[0-5]\\./;function d(F,j,O){typeof j=="function"&&(O=j,j=null);var $=l.test(process.version)?function(q,W,K,X){return m(q,R(q,W,K,X))}:function(q,W,K,X){return m(q,W,R(q,W,K,X))};return $(F,j,O);function R(U,q,W,K){return function(X,J){X&&(X.code==="EMFILE"||X.code==="ENFILE")?Er([$,[U,q,W],X,K||Date.now(),Date.now()]):(J&&J.sort&&J.sort(),typeof W=="function"&&W.call(this,X,J))}}}if(process.version.substr(0,4)==="v0.8"){var f=Bw(e);N=f.ReadStream,k=f.WriteStream}var g=e.ReadStream;g&&(N.prototype=Object.create(g.prototype),N.prototype.open=M);var w=e.WriteStream;w&&(k.prototype=Object.create(w.prototype),k.prototype.open=ee),Object.defineProperty(e,"ReadStream",{get:function(){return N},set:function(F){N=F},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return k},set:function(F){k=F},enumerable:!0,configurable:!0});var x=N;Object.defineProperty(e,"FileReadStream",{get:function(){return x},set:function(F){x=F},enumerable:!0,configurable:!0});var S=k;Object.defineProperty(e,"FileWriteStream",{get:function(){return S},set:function(F){S=F},enumerable:!0,configurable:!0});function N(F,j){return this instanceof N?(g.apply(this,arguments),this):N.apply(Object.create(N.prototype),arguments)}function M(){var F=this;L(F.path,F.flags,F.mode,function(j,O){j?(F.autoClose&&F.destroy(),F.emit("error",j)):(F.fd=O,F.emit("open",O),F.read())})}function k(F,j){return this instanceof k?(w.apply(this,arguments),this):k.apply(Object.create(k.prototype),arguments)}function ee(){var F=this;L(F.path,F.flags,F.mode,function(j,O){j?(F.destroy(),F.emit("error",j)):(F.fd=O,F.emit("open",O))})}function xe(F,j){return new e.ReadStream(F,j)}function A(F,j){return new e.WriteStream(F,j)}var B=e.open;e.open=L;function L(F,j,O,$){return typeof O=="function"&&($=O,O=null),R(F,j,O,$);function R(U,q,W,K,X){return B(U,q,W,function(J,Zn){J&&(J.code==="EMFILE"||J.code==="ENFILE")?Er([R,[U,q,W,K],J,X||Date.now(),Date.now()]):typeof K=="function"&&K.apply(this,arguments)})}}return e}function Er(e){Jt("ENQUEUE",e[0].name,e[1]),ae[Ee].push(e),oa()}var ti;function _f(){for(var e=Date.now(),t=0;t<ae[Ee].length;++t)ae[Ee][t].length>2&&(ae[Ee][t][3]=e,ae[Ee][t][4]=e);oa()}function oa(){if(clearTimeout(ti),ti=void 0,ae[Ee].length!==0){var e=ae[Ee].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,u=Math.max(i-o,1),m=Math.min(u*1.2,100);a>=m?(Jt("RETRY",t.name,r),t.apply(null,r.concat([o]))):ae[Ee].push(e)}ti===void 0&&(ti=setTimeout(oa,0))}}});var sa=D(Vt=>{"use strict";var Nf=Ce().fromCallback,Ge=he(),Ww=["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 Ge[e]=="function");Object.keys(Ge).forEach(e=>{e!=="promises"&&(Vt[e]=Ge[e])});Ww.forEach(e=>{Vt[e]=Nf(Ge[e])});Vt.exists=function(e,t){return typeof t=="function"?Ge.exists(e,t):new Promise(r=>Ge.exists(e,r))};Vt.read=function(e,t,r,n,o,i){return typeof i=="function"?Ge.read(e,t,r,n,o,i):new Promise((s,a)=>{Ge.read(e,t,r,n,o,(u,m,l)=>{if(u)return a(u);s({bytesRead:m,buffer:l})})})};Vt.write=function(e,t,...r){return typeof r[r.length-1]=="function"?Ge.write(e,t,...r):new Promise((n,o)=>{Ge.write(e,t,...r,(i,s,a)=>{if(i)return o(i);n({bytesWritten:s,buffer:a})})})};typeof Ge.realpath.native=="function"&&(Vt.realpath.native=Nf(Ge.realpath.native))});var ua=D((IA,Af)=>{"use strict";var aa=require("path");function Cf(e){return e=aa.normalize(aa.resolve(e)).split(aa.sep),e.length>0?e[0]:null}var Kw=/[<>:"|?*]/;function Gw(e){let t=Cf(e);return e=e.replace(t,""),Kw.test(e)}Af.exports={getRootPath:Cf,invalidWin32Path:Gw}});var Ff=D((SA,Rf)=>{"use strict";var Hw=he(),ca=require("path"),Jw=ua().invalidWin32Path,Vw=parseInt("0777",8);function la(e,t,r,n){if(typeof t=="function"?(r=t,t={}):(!t||typeof t!="object")&&(t={mode:t}),process.platform==="win32"&&Jw(e)){let s=new Error(e+" contains invalid WIN32 path characters.");return s.code="EINVAL",r(s)}let o=t.mode,i=t.fs||Hw;o===void 0&&(o=Vw&~process.umask()),n||(n=null),r=r||function(){},e=ca.resolve(e),i.mkdir(e,o,s=>{if(!s)return n=n||e,r(null,n);switch(s.code){case"ENOENT":if(ca.dirname(e)===e)return r(s);la(ca.dirname(e),t,(a,u)=>{a?r(a,u):la(e,t,r,u)});break;default:i.stat(e,(a,u)=>{a||!u.isDirectory()?r(s,n):r(null,n)});break}})}Rf.exports=la});var Pf=D((OA,$f)=>{"use strict";var Yw=he(),fa=require("path"),Zw=ua().invalidWin32Path,Qw=parseInt("0777",8);function pa(e,t,r){(!t||typeof t!="object")&&(t={mode:t});let n=t.mode,o=t.fs||Yw;if(process.platform==="win32"&&Zw(e)){let i=new Error(e+" contains invalid WIN32 path characters.");throw i.code="EINVAL",i}n===void 0&&(n=Qw&~process.umask()),r||(r=null),e=fa.resolve(e);try{o.mkdirSync(e,n),r=r||e}catch(i){if(i.code==="ENOENT"){if(fa.dirname(e)===e)throw i;r=pa(fa.dirname(e),t,r),pa(e,t,r)}else{let s;try{s=o.statSync(e)}catch{throw i}if(!s.isDirectory())throw i}}return r}$f.exports=pa});var $e=D((DA,kf)=>{"use strict";var Xw=Ce().fromCallback,ma=Xw(Ff()),da=Pf();kf.exports={mkdirs:ma,mkdirsSync:da,mkdirp:ma,mkdirpSync:da,ensureDir:ma,ensureDirSync:da}});var ha=D((_A,qf)=>{"use strict";var Se=he(),Mf=require("os"),ni=require("path");function ex(){let e=ni.join("millis-test-sync"+Date.now().toString()+Math.random().toString().slice(2));e=ni.join(Mf.tmpdir(),e);let t=new Date(1435410243862);Se.writeFileSync(e,"https://github.com/jprichardson/node-fs-extra/pull/141");let r=Se.openSync(e,"r+");return Se.futimesSync(r,t,t),Se.closeSync(r),Se.statSync(e).mtime>1435410243e3}function tx(e){let t=ni.join("millis-test"+Date.now().toString()+Math.random().toString().slice(2));t=ni.join(Mf.tmpdir(),t);let r=new Date(1435410243862);Se.writeFile(t,"https://github.com/jprichardson/node-fs-extra/pull/141",n=>{if(n)return e(n);Se.open(t,"r+",(o,i)=>{if(o)return e(o);Se.futimes(i,r,r,s=>{if(s)return e(s);Se.close(i,a=>{if(a)return e(a);Se.stat(t,(u,m)=>{if(u)return e(u);e(null,m.mtime>1435410243e3)})})})})})}function rx(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 nx(e,t,r,n){Se.open(e,"r+",(o,i)=>{if(o)return n(o);Se.futimes(i,t,r,s=>{Se.close(i,a=>{n&&n(s||a)})})})}function ox(e,t,r){let n=Se.openSync(e,"r+");return Se.futimesSync(n,t,r),Se.closeSync(n)}qf.exports={hasMillisRes:tx,hasMillisResSync:ex,timeRemoveMillis:rx,utimesMillis:nx,utimesMillisSync:ox}});var On=D((TA,Wf)=>{"use strict";var He=he(),Ae=require("path"),jf=10,Lf=5,ix=0,ya=process.versions.node.split("."),Bf=Number.parseInt(ya[0],10),Uf=Number.parseInt(ya[1],10),sx=Number.parseInt(ya[2],10);function In(){if(Bf>jf)return!0;if(Bf===jf){if(Uf>Lf)return!0;if(Uf===Lf&&sx>=ix)return!0}return!1}function ax(e,t,r){In()?He.stat(e,{bigint:!0},(n,o)=>{if(n)return r(n);He.stat(t,{bigint:!0},(i,s)=>i?i.code==="ENOENT"?r(null,{srcStat:o,destStat:null}):r(i):r(null,{srcStat:o,destStat:s}))}):He.stat(e,(n,o)=>{if(n)return r(n);He.stat(t,(i,s)=>i?i.code==="ENOENT"?r(null,{srcStat:o,destStat:null}):r(i):r(null,{srcStat:o,destStat:s}))})}function ux(e,t){let r,n;In()?r=He.statSync(e,{bigint:!0}):r=He.statSync(e);try{In()?n=He.statSync(t,{bigint:!0}):n=He.statSync(t)}catch(o){if(o.code==="ENOENT")return{srcStat:r,destStat:null};throw o}return{srcStat:r,destStat:n}}function cx(e,t,r,n){ax(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()&&ba(e,t)?n(new Error(Sn(e,t,r))):n(null,{srcStat:s,destStat:a})})}function lx(e,t,r){let{srcStat:n,destStat:o}=ux(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()&&ba(e,t))throw new Error(Sn(e,t,r));return{srcStat:n,destStat:o}}function ga(e,t,r,n,o){let i=Ae.resolve(Ae.dirname(e)),s=Ae.resolve(Ae.dirname(r));if(s===i||s===Ae.parse(s).root)return o();In()?He.stat(s,{bigint:!0},(a,u)=>a?a.code==="ENOENT"?o():o(a):u.ino&&u.dev&&u.ino===t.ino&&u.dev===t.dev?o(new Error(Sn(e,r,n))):ga(e,t,s,n,o)):He.stat(s,(a,u)=>a?a.code==="ENOENT"?o():o(a):u.ino&&u.dev&&u.ino===t.ino&&u.dev===t.dev?o(new Error(Sn(e,r,n))):ga(e,t,s,n,o))}function zf(e,t,r,n){let o=Ae.resolve(Ae.dirname(e)),i=Ae.resolve(Ae.dirname(r));if(i===o||i===Ae.parse(i).root)return;let s;try{In()?s=He.statSync(i,{bigint:!0}):s=He.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(Sn(e,r,n));return zf(e,t,i,n)}function ba(e,t){let r=Ae.resolve(e).split(Ae.sep).filter(o=>o),n=Ae.resolve(t).split(Ae.sep).filter(o=>o);return r.reduce((o,i,s)=>o&&n[s]===i,!0)}function Sn(e,t,r){return`Cannot ${r} \'${e}\' to a subdirectory of itself, \'${t}\'.`}Wf.exports={checkPaths:cx,checkPathsSync:lx,checkParentPaths:ga,checkParentPathsSync:zf,isSrcSubdir:ba}});var Gf=D((NA,Kf)=>{"use strict";Kf.exports=function(e){if(typeof Buffer.allocUnsafe=="function")try{return Buffer.allocUnsafe(e)}catch{return new Buffer(e)}return new Buffer(e)}});var Zf=D((CA,Yf)=>{"use strict";var ne=he(),Dn=require("path"),fx=$e().mkdirsSync,px=ha().utimesMillisSync,_n=On();function mx(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}=_n.checkPathsSync(e,t,"copy");return _n.checkParentPathsSync(e,n,t,"copy"),dx(o,e,t,r)}function dx(e,t,r,n){if(n.filter&&!n.filter(t,r))return;let o=Dn.dirname(r);return ne.existsSync(o)||fx(o),Hf(e,t,r,n)}function Hf(e,t,r,n){if(!(n.filter&&!n.filter(t,r)))return hx(e,t,r,n)}function hx(e,t,r,n){let i=(n.dereference?ne.statSync:ne.lstatSync)(t);if(i.isDirectory())return vx(i,e,t,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return gx(i,e,t,r,n);if(i.isSymbolicLink())return Ex(e,t,r,n)}function gx(e,t,r,n,o){return t?yx(e,r,n,o):Jf(e,r,n,o)}function yx(e,t,r,n){if(n.overwrite)return ne.unlinkSync(r),Jf(e,t,r,n);if(n.errorOnExist)throw new Error(`\'${r}\' already exists`)}function Jf(e,t,r,n){return typeof ne.copyFileSync=="function"?(ne.copyFileSync(t,r),ne.chmodSync(r,e.mode),n.preserveTimestamps?px(r,e.atime,e.mtime):void 0):bx(e,t,r,n)}function bx(e,t,r,n){let i=Gf()(65536),s=ne.openSync(t,"r"),a=ne.openSync(r,"w",e.mode),u=0;for(;u<e.size;){let m=ne.readSync(s,i,0,65536,u);ne.writeSync(a,i,0,m),u+=m}n.preserveTimestamps&&ne.futimesSync(a,e.atime,e.mtime),ne.closeSync(s),ne.closeSync(a)}function vx(e,t,r,n,o){if(!t)return wx(e,r,n,o);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory \'${n}\' with directory \'${r}\'.`);return Vf(r,n,o)}function wx(e,t,r,n){return ne.mkdirSync(r),Vf(t,r,n),ne.chmodSync(r,e.mode)}function Vf(e,t,r){ne.readdirSync(e).forEach(n=>xx(n,e,t,r))}function xx(e,t,r,n){let o=Dn.join(t,e),i=Dn.join(r,e),{destStat:s}=_n.checkPathsSync(o,i,"copy");return Hf(s,o,i,n)}function Ex(e,t,r,n){let o=ne.readlinkSync(t);if(n.dereference&&(o=Dn.resolve(process.cwd(),o)),e){let i;try{i=ne.readlinkSync(r)}catch(s){if(s.code==="EINVAL"||s.code==="UNKNOWN")return ne.symlinkSync(o,r);throw s}if(n.dereference&&(i=Dn.resolve(process.cwd(),i)),_n.isSrcSubdir(o,i))throw new Error(`Cannot copy \'${o}\' to a subdirectory of itself, \'${i}\'.`);if(ne.statSync(r).isDirectory()&&_n.isSrcSubdir(i,o))throw new Error(`Cannot overwrite \'${i}\' with \'${o}\'.`);return Ix(o,r)}else return ne.symlinkSync(o,r)}function Ix(e,t){return ne.unlinkSync(t),ne.symlinkSync(e,t)}Yf.exports=mx});var va=D((AA,Qf)=>{"use strict";Qf.exports={copySync:Zf()}});var it=D((RA,ep)=>{"use strict";var Sx=Ce().fromPromise,Xf=sa();function Ox(e){return Xf.access(e).then(()=>!0).catch(()=>!1)}ep.exports={pathExists:Sx(Ox),pathExistsSync:Xf.existsSync}});var cp=D((FA,up)=>{"use strict";var Ie=he(),Tn=require("path"),Dx=$e().mkdirs,_x=it().pathExists,Tx=ha().utimesMillis,Nn=On();function Nx(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`),Nn.checkPaths(e,t,"copy",(o,i)=>{if(o)return n(o);let{srcStat:s,destStat:a}=i;Nn.checkParentPaths(e,s,t,"copy",u=>u?n(u):r.filter?np(tp,a,e,t,r,n):tp(a,e,t,r,n))})}function tp(e,t,r,n,o){let i=Tn.dirname(r);_x(i,(s,a)=>{if(s)return o(s);if(a)return wa(e,t,r,n,o);Dx(i,u=>u?o(u):wa(e,t,r,n,o))})}function np(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 wa(e,t,r,n,o){return n.filter?np(rp,e,t,r,n,o):rp(e,t,r,n,o)}function rp(e,t,r,n,o){(n.dereference?Ie.stat:Ie.lstat)(t,(s,a)=>{if(s)return o(s);if(a.isDirectory())return Fx(a,e,t,r,n,o);if(a.isFile()||a.isCharacterDevice()||a.isBlockDevice())return Cx(a,e,t,r,n,o);if(a.isSymbolicLink())return kx(e,t,r,n,o)})}function Cx(e,t,r,n,o,i){return t?Ax(e,r,n,o,i):op(e,r,n,o,i)}function Ax(e,t,r,n,o){if(n.overwrite)Ie.unlink(r,i=>i?o(i):op(e,t,r,n,o));else return n.errorOnExist?o(new Error(`\'${r}\' already exists`)):o()}function op(e,t,r,n,o){return typeof Ie.copyFile=="function"?Ie.copyFile(t,r,i=>i?o(i):ip(e,r,n,o)):Rx(e,t,r,n,o)}function Rx(e,t,r,n,o){let i=Ie.createReadStream(t);i.on("error",s=>o(s)).once("open",()=>{let s=Ie.createWriteStream(r,{mode:e.mode});s.on("error",a=>o(a)).on("open",()=>i.pipe(s)).once("close",()=>ip(e,r,n,o))})}function ip(e,t,r,n){Ie.chmod(t,e.mode,o=>o?n(o):r.preserveTimestamps?Tx(t,e.atime,e.mtime,n):n())}function Fx(e,t,r,n,o,i){return t?t&&!t.isDirectory()?i(new Error(`Cannot overwrite non-directory \'${n}\' with directory \'${r}\'.`)):sp(r,n,o,i):$x(e,r,n,o,i)}function $x(e,t,r,n,o){Ie.mkdir(r,i=>{if(i)return o(i);sp(t,r,n,s=>s?o(s):Ie.chmod(r,e.mode,o))})}function sp(e,t,r,n){Ie.readdir(e,(o,i)=>o?n(o):ap(i,e,t,r,n))}function ap(e,t,r,n,o){let i=e.pop();return i?Px(e,i,t,r,n,o):o()}function Px(e,t,r,n,o,i){let s=Tn.join(r,t),a=Tn.join(n,t);Nn.checkPaths(s,a,"copy",(u,m)=>{if(u)return i(u);let{destStat:l}=m;wa(l,s,a,o,d=>d?i(d):ap(e,r,n,o,i))})}function kx(e,t,r,n,o){Ie.readlink(t,(i,s)=>{if(i)return o(i);if(n.dereference&&(s=Tn.resolve(process.cwd(),s)),e)Ie.readlink(r,(a,u)=>a?a.code==="EINVAL"||a.code==="UNKNOWN"?Ie.symlink(s,r,o):o(a):(n.dereference&&(u=Tn.resolve(process.cwd(),u)),Nn.isSrcSubdir(s,u)?o(new Error(`Cannot copy \'${s}\' to a subdirectory of itself, \'${u}\'.`)):e.isDirectory()&&Nn.isSrcSubdir(u,s)?o(new Error(`Cannot overwrite \'${u}\' with \'${s}\'.`)):Mx(s,r,o)));else return Ie.symlink(s,r,o)})}function Mx(e,t,r){Ie.unlink(t,n=>n?r(n):Ie.symlink(e,t,r))}up.exports=Nx});var xa=D(($A,lp)=>{"use strict";var qx=Ce().fromCallback;lp.exports={copy:qx(cp())}});var vp=D((PA,bp)=>{"use strict";var fp=he(),hp=require("path"),G=require("assert"),Cn=process.platform==="win32";function gp(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(r=>{e[r]=e[r]||fp[r],r=r+"Sync",e[r]=e[r]||fp[r]}),e.maxBusyTries=e.maxBusyTries||3}function Ea(e,t,r){let n=0;typeof t=="function"&&(r=t,t={}),G(e,"rimraf: missing path"),G.strictEqual(typeof e,"string","rimraf: path should be a string"),G.strictEqual(typeof r,"function","rimraf: callback function required"),G(t,"rimraf: invalid options argument provided"),G.strictEqual(typeof t,"object","rimraf: options should be object"),gp(t),pp(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(()=>pp(e,t,o),s)}i.code==="ENOENT"&&(i=null)}r(i)})}function pp(e,t,r){G(e),G(t),G(typeof r=="function"),t.lstat(e,(n,o)=>{if(n&&n.code==="ENOENT")return r(null);if(n&&n.code==="EPERM"&&Cn)return mp(e,t,n,r);if(o&&o.isDirectory())return oi(e,t,n,r);t.unlink(e,i=>{if(i){if(i.code==="ENOENT")return r(null);if(i.code==="EPERM")return Cn?mp(e,t,i,r):oi(e,t,i,r);if(i.code==="EISDIR")return oi(e,t,i,r)}return r(i)})})}function mp(e,t,r,n){G(e),G(t),G(typeof n=="function"),r&&G(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()?oi(e,t,r,n):t.unlink(e,n)})})}function dp(e,t,r){let n;G(e),G(t),r&&G(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()?ii(e,t,r):t.unlinkSync(e)}function oi(e,t,r,n){G(e),G(t),r&&G(r instanceof Error),G(typeof n=="function"),t.rmdir(e,o=>{o&&(o.code==="ENOTEMPTY"||o.code==="EEXIST"||o.code==="EPERM")?jx(e,t,n):o&&o.code==="ENOTDIR"?n(r):n(o)})}function jx(e,t,r){G(e),G(t),G(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=>{Ea(hp.join(e,a),t,u=>{if(!s){if(u)return r(s=u);--i===0&&t.rmdir(e,r)}})})})}function yp(e,t){let r;t=t||{},gp(t),G(e,"rimraf: missing path"),G.strictEqual(typeof e,"string","rimraf: path should be a string"),G(t,"rimraf: missing options"),G.strictEqual(typeof t,"object","rimraf: options should be object");try{r=t.lstatSync(e)}catch(n){if(n.code==="ENOENT")return;n.code==="EPERM"&&Cn&&dp(e,t,n)}try{r&&r.isDirectory()?ii(e,t,null):t.unlinkSync(e)}catch(n){if(n.code==="ENOENT")return;if(n.code==="EPERM")return Cn?dp(e,t,n):ii(e,t,n);if(n.code!=="EISDIR")throw n;ii(e,t,n)}}function ii(e,t,r){G(e),G(t),r&&G(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")Lx(e,t);else if(n.code!=="ENOENT")throw n}}function Lx(e,t){if(G(e),G(t),t.readdirSync(e).forEach(r=>yp(hp.join(e,r),t)),Cn){let r=Date.now();do try{return t.rmdirSync(e,t)}catch{}while(Date.now()-r<500)}else return t.rmdirSync(e,t)}bp.exports=Ea;Ea.sync=yp});var An=D((kA,xp)=>{"use strict";var Bx=Ce().fromCallback,wp=vp();xp.exports={remove:Bx(wp),removeSync:wp.sync}});var Np=D((MA,Tp)=>{"use strict";var Ux=Ce().fromCallback,Sp=he(),Op=require("path"),Dp=$e(),_p=An(),Ep=Ux(function(t,r){r=r||function(){},Sp.readdir(t,(n,o)=>{if(n)return Dp.mkdirs(t,r);o=o.map(s=>Op.join(t,s)),i();function i(){let s=o.pop();if(!s)return r();_p.remove(s,a=>{if(a)return r(a);i()})}})});function Ip(e){let t;try{t=Sp.readdirSync(e)}catch{return Dp.mkdirsSync(e)}t.forEach(r=>{r=Op.join(e,r),_p.removeSync(r)})}Tp.exports={emptyDirSync:Ip,emptydirSync:Ip,emptyDir:Ep,emptydir:Ep}});var Fp=D((qA,Rp)=>{"use strict";var zx=Ce().fromCallback,Cp=require("path"),Rn=he(),Ap=$e(),Wx=it().pathExists;function Kx(e,t){function r(){Rn.writeFile(e,"",n=>{if(n)return t(n);t()})}Rn.stat(e,(n,o)=>{if(!n&&o.isFile())return t();let i=Cp.dirname(e);Wx(i,(s,a)=>{if(s)return t(s);if(a)return r();Ap.mkdirs(i,u=>{if(u)return t(u);r()})})})}function Gx(e){let t;try{t=Rn.statSync(e)}catch{}if(t&&t.isFile())return;let r=Cp.dirname(e);Rn.existsSync(r)||Ap.mkdirsSync(r),Rn.writeFileSync(e,"")}Rp.exports={createFile:zx(Kx),createFileSync:Gx}});var qp=D((jA,Mp)=>{"use strict";var Hx=Ce().fromCallback,Pp=require("path"),Yt=he(),kp=$e(),$p=it().pathExists;function Jx(e,t,r){function n(o,i){Yt.link(o,i,s=>{if(s)return r(s);r(null)})}$p(t,(o,i)=>{if(o)return r(o);if(i)return r(null);Yt.lstat(e,s=>{if(s)return s.message=s.message.replace("lstat","ensureLink"),r(s);let a=Pp.dirname(t);$p(a,(u,m)=>{if(u)return r(u);if(m)return n(e,t);kp.mkdirs(a,l=>{if(l)return r(l);n(e,t)})})})})}function Vx(e,t){if(Yt.existsSync(t))return;try{Yt.lstatSync(e)}catch(i){throw i.message=i.message.replace("lstat","ensureLink"),i}let n=Pp.dirname(t);return Yt.existsSync(n)||kp.mkdirsSync(n),Yt.linkSync(e,t)}Mp.exports={createLink:Hx(Jx),createLinkSync:Vx}});var Lp=D((LA,jp)=>{"use strict";var Ct=require("path"),Fn=he(),Yx=it().pathExists;function Zx(e,t,r){if(Ct.isAbsolute(e))return Fn.lstat(e,n=>n?(n.message=n.message.replace("lstat","ensureSymlink"),r(n)):r(null,{toCwd:e,toDst:e}));{let n=Ct.dirname(t),o=Ct.join(n,e);return Yx(o,(i,s)=>i?r(i):s?r(null,{toCwd:o,toDst:e}):Fn.lstat(e,a=>a?(a.message=a.message.replace("lstat","ensureSymlink"),r(a)):r(null,{toCwd:e,toDst:Ct.relative(n,e)})))}}function Qx(e,t){let r;if(Ct.isAbsolute(e)){if(r=Fn.existsSync(e),!r)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}else{let n=Ct.dirname(t),o=Ct.join(n,e);if(r=Fn.existsSync(o),r)return{toCwd:o,toDst:e};if(r=Fn.existsSync(e),!r)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:Ct.relative(n,e)}}}jp.exports={symlinkPaths:Zx,symlinkPathsSync:Qx}});var zp=D((BA,Up)=>{"use strict";var Bp=he();function Xx(e,t,r){if(r=typeof t=="function"?t:r,t=typeof t=="function"?!1:t,t)return r(null,t);Bp.lstat(e,(n,o)=>{if(n)return r(null,"file");t=o&&o.isDirectory()?"dir":"file",r(null,t)})}function e0(e,t){let r;if(t)return t;try{r=Bp.lstatSync(e)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}Up.exports={symlinkType:Xx,symlinkTypeSync:e0}});var Yp=D((UA,Vp)=>{"use strict";var t0=Ce().fromCallback,Kp=require("path"),Ir=he(),Gp=$e(),r0=Gp.mkdirs,n0=Gp.mkdirsSync,Hp=Lp(),o0=Hp.symlinkPaths,i0=Hp.symlinkPathsSync,Jp=zp(),s0=Jp.symlinkType,a0=Jp.symlinkTypeSync,Wp=it().pathExists;function u0(e,t,r,n){n=typeof r=="function"?r:n,r=typeof r=="function"?!1:r,Wp(t,(o,i)=>{if(o)return n(o);if(i)return n(null);o0(e,t,(s,a)=>{if(s)return n(s);e=a.toDst,s0(a.toCwd,r,(u,m)=>{if(u)return n(u);let l=Kp.dirname(t);Wp(l,(d,f)=>{if(d)return n(d);if(f)return Ir.symlink(e,t,m,n);r0(l,g=>{if(g)return n(g);Ir.symlink(e,t,m,n)})})})})})}function c0(e,t,r){if(Ir.existsSync(t))return;let o=i0(e,t);e=o.toDst,r=a0(o.toCwd,r);let i=Kp.dirname(t);return Ir.existsSync(i)||n0(i),Ir.symlinkSync(e,t,r)}Vp.exports={createSymlink:t0(u0),createSymlinkSync:c0}});var Qp=D((zA,Zp)=>{"use strict";var si=Fp(),ai=qp(),ui=Yp();Zp.exports={createFile:si.createFile,createFileSync:si.createFileSync,ensureFile:si.createFile,ensureFileSync:si.createFileSync,createLink:ai.createLink,createLinkSync:ai.createLinkSync,ensureLink:ai.createLink,ensureLinkSync:ai.createLinkSync,createSymlink:ui.createSymlink,createSymlinkSync:ui.createSymlinkSync,ensureSymlink:ui.createSymlink,ensureSymlinkSync:ui.createSymlinkSync}});var rm=D((WA,tm)=>{var Sr;try{Sr=he()}catch{Sr=require("fs")}function l0(e,t,r){r==null&&(r=t,t={}),typeof t=="string"&&(t={encoding:t}),t=t||{};var n=t.fs||Sr,o=!0;"throws"in t&&(o=t.throws),n.readFile(e,t,function(i,s){if(i)return r(i);s=em(s);var a;try{a=JSON.parse(s,t?t.reviver:null)}catch(u){return o?(u.message=e+": "+u.message,r(u)):r(null,null)}r(null,a)})}function f0(e,t){t=t||{},typeof t=="string"&&(t={encoding:t});var r=t.fs||Sr,n=!0;"throws"in t&&(n=t.throws);try{var o=r.readFileSync(e,t);return o=em(o),JSON.parse(o,t.reviver)}catch(i){if(n)throw i.message=e+": "+i.message,i;return null}}function Xp(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 p0(e,t,r,n){n==null&&(n=r,r={}),r=r||{};var o=r.fs||Sr,i="";try{i=Xp(t,r)}catch(s){n&&n(s,null);return}o.writeFile(e,i,r,n)}function m0(e,t,r){r=r||{};var n=r.fs||Sr,o=Xp(t,r);return n.writeFileSync(e,o,r)}function em(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e=e.replace(/^\\uFEFF/,""),e}var d0={readFile:l0,readFileSync:f0,writeFile:p0,writeFileSync:m0};tm.exports=d0});var li=D((KA,om)=>{"use strict";var nm=Ce().fromCallback,ci=rm();om.exports={readJson:nm(ci.readFile),readJsonSync:ci.readFileSync,writeJson:nm(ci.writeFile),writeJsonSync:ci.writeFileSync}});var am=D((GA,sm)=>{"use strict";var h0=require("path"),g0=$e(),y0=it().pathExists,im=li();function b0(e,t,r,n){typeof r=="function"&&(n=r,r={});let o=h0.dirname(e);y0(o,(i,s)=>{if(i)return n(i);if(s)return im.writeJson(e,t,r,n);g0.mkdirs(o,a=>{if(a)return n(a);im.writeJson(e,t,r,n)})})}sm.exports=b0});var cm=D((HA,um)=>{"use strict";var v0=he(),w0=require("path"),x0=$e(),E0=li();function I0(e,t,r){let n=w0.dirname(e);v0.existsSync(n)||x0.mkdirsSync(n),E0.writeJsonSync(e,t,r)}um.exports=I0});var fm=D((JA,lm)=>{"use strict";var S0=Ce().fromCallback,De=li();De.outputJson=S0(am());De.outputJsonSync=cm();De.outputJSON=De.outputJson;De.outputJSONSync=De.outputJsonSync;De.writeJSON=De.writeJson;De.writeJSONSync=De.writeJsonSync;De.readJSON=De.readJson;De.readJSONSync=De.readJsonSync;lm.exports=De});var ym=D((VA,gm)=>{"use strict";var dm=he(),O0=require("path"),D0=va().copySync,hm=An().removeSync,_0=$e().mkdirpSync,pm=On();function T0(e,t,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:o}=pm.checkPathsSync(e,t,"move");return pm.checkParentPathsSync(e,o,t,"move"),_0(O0.dirname(t)),N0(e,t,n)}function N0(e,t,r){if(r)return hm(t),mm(e,t,r);if(dm.existsSync(t))throw new Error("dest already exists.");return mm(e,t,r)}function mm(e,t,r){try{dm.renameSync(e,t)}catch(n){if(n.code!=="EXDEV")throw n;return C0(e,t,r)}}function C0(e,t,r){return D0(e,t,{overwrite:r,errorOnExist:!0}),hm(e)}gm.exports=T0});var vm=D((YA,bm)=>{"use strict";bm.exports={moveSync:ym()}});var Sm=D((ZA,Im)=>{"use strict";var A0=he(),R0=require("path"),F0=xa().copy,Em=An().remove,$0=$e().mkdirp,P0=it().pathExists,wm=On();function k0(e,t,r,n){typeof r=="function"&&(n=r,r={});let o=r.overwrite||r.clobber||!1;wm.checkPaths(e,t,"move",(i,s)=>{if(i)return n(i);let{srcStat:a}=s;wm.checkParentPaths(e,a,t,"move",u=>{if(u)return n(u);$0(R0.dirname(t),m=>m?n(m):M0(e,t,o,n))})})}function M0(e,t,r,n){if(r)return Em(t,o=>o?n(o):xm(e,t,r,n));P0(t,(o,i)=>o?n(o):i?n(new Error("dest already exists.")):xm(e,t,r,n))}function xm(e,t,r,n){A0.rename(e,t,o=>o?o.code!=="EXDEV"?n(o):q0(e,t,r,n):n())}function q0(e,t,r,n){F0(e,t,{overwrite:r,errorOnExist:!0},i=>i?n(i):Em(e,n))}Im.exports=k0});var Dm=D((QA,Om)=>{"use strict";var j0=Ce().fromCallback;Om.exports={move:j0(Sm())}});var Cm=D((XA,Nm)=>{"use strict";var L0=Ce().fromCallback,$n=he(),_m=require("path"),Tm=$e(),B0=it().pathExists;function U0(e,t,r,n){typeof r=="function"&&(n=r,r="utf8");let o=_m.dirname(e);B0(o,(i,s)=>{if(i)return n(i);if(s)return $n.writeFile(e,t,r,n);Tm.mkdirs(o,a=>{if(a)return n(a);$n.writeFile(e,t,r,n)})})}function z0(e,...t){let r=_m.dirname(e);if($n.existsSync(r))return $n.writeFileSync(e,...t);Tm.mkdirsSync(r),$n.writeFileSync(e,...t)}Nm.exports={outputFile:L0(U0),outputFileSync:z0}});var Sa=D((eR,Ia)=>{"use strict";Ia.exports=Object.assign({},sa(),va(),xa(),Np(),Qp(),fm(),$e(),vm(),Dm(),Cm(),it(),An());var Am=require("fs");Object.getOwnPropertyDescriptor(Am,"promises")&&Object.defineProperty(Ia.exports,"promises",{get(){return Am.promises}})});var Fm=D((tR,Rm)=>{Rm.exports=()=>new Date});var Pm=D((rR,$m)=>{var W0=we()("streamroller:fileNameFormatter"),K0=require("path"),G0=".gz",H0=".";$m.exports=({file:e,keepFileExt:t,needsIndex:r,alwaysIncludeDate:n,compress:o,fileNameSep:i})=>{let s=i||H0,a=K0.join(e.dir,e.name),u=g=>g+e.ext,m=(g,w,x)=>(r||!x)&&w?g+s+w:g,l=(g,w,x)=>(w>0||n)&&x?g+s+x:g,d=(g,w)=>w&&o?g+G0:g,f=t?[l,m,u,d]:[u,l,m,d];return({date:g,index:w})=>(W0(`_formatFileName: date=${g}, index=${w}`),f.reduce((x,S)=>S(x,w,g),a))}});var jm=D((nR,qm)=>{var Zt=we()("streamroller:fileNameParser"),km=".gz",Mm=Jo(),J0=".";qm.exports=({file:e,keepFileExt:t,pattern:r,fileNameSep:n})=>{let o=n||J0,i=(f,g)=>f.endsWith(km)?(Zt("it is gzipped"),g.isCompressed=!0,f.slice(0,-1*km.length)):f,s="__NOT_MATCHING__",d=[i,t?f=>f.startsWith(e.name)&&f.endsWith(e.ext)?(Zt("it starts and ends with the right things"),f.slice(e.name.length+1,-1*e.ext.length)):s:f=>f.startsWith(e.base)?(Zt("it starts with the right things"),f.slice(e.base.length+1)):s,r?(f,g)=>{let w=f.split(o),x=w[w.length-1];Zt("items: ",w,", indexStr: ",x);let S=f;x!==void 0&&x.match(/^\\d+$/)?(S=f.slice(0,-1*(x.length+1)),Zt(`dateStr is ${S}`),r&&!S&&(S=x,x="0")):x="0";try{let N=Mm.parse(r,S,new Date(0,0));return Mm.asString(r,N)!==S?f:(g.index=parseInt(x,10),g.date=S,g.timestamp=N.getTime(),"")}catch(N){return Zt(`Problem parsing ${S} as ${r}, error was: `,N),f}}:(f,g)=>f.match(/^\\d+$/)?(Zt("it has an index"),g.index=parseInt(f,10),""):f];return f=>{let g={filename:f,index:0,isCompressed:!1};return d.reduce((x,S)=>S(x,g),f)?null:g}}});var Bm=D((oR,Lm)=>{var Re=we()("streamroller:moveAndMaybeCompressFile"),gt=Sa(),V0=require("zlib"),Y0=function(e){let t={mode:parseInt("0600",8),compress:!1},r=Object.assign({},t,e);return Re(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(r)}`),r},Z0=async(e,t,r)=>{if(r=Y0(r),e===t){Re("moveAndMaybeCompressFile: source and target are the same, not doing anything");return}if(await gt.pathExists(e))if(Re(`moveAndMaybeCompressFile: moving file from ${e} to ${t} ${r.compress?"with":"without"} compress`),r.compress)await new Promise((n,o)=>{let i=!1,s=gt.createWriteStream(t,{mode:r.mode,flags:"wx"}).on("open",()=>{i=!0;let a=gt.createReadStream(e).on("open",()=>{a.pipe(V0.createGzip()).pipe(s)}).on("error",u=>{Re(`moveAndMaybeCompressFile: error reading ${e}`,u),s.destroy(u)})}).on("finish",()=>{Re(`moveAndMaybeCompressFile: finished compressing ${t}, deleting ${e}`),gt.unlink(e).then(n).catch(a=>{Re(`moveAndMaybeCompressFile: error deleting ${e}, truncating instead`,a),gt.truncate(e).then(n).catch(u=>{Re(`moveAndMaybeCompressFile: error truncating ${e}`,u),o(u)})})}).on("error",a=>{i?(Re(`moveAndMaybeCompressFile: error writing ${t}, deleting`,a),gt.unlink(t).then(()=>{o(a)}).catch(u=>{Re(`moveAndMaybeCompressFile: error deleting ${t}`,u),o(u)})):(Re(`moveAndMaybeCompressFile: error creating ${t}`,a),o(a))})}).catch(()=>{});else{Re(`moveAndMaybeCompressFile: renaming ${e} to ${t}`);try{await gt.move(e,t,{overwrite:!0})}catch(n){if(Re(`moveAndMaybeCompressFile: error renaming ${e} to ${t}`,n),n.code!=="ENOENT"){Re("moveAndMaybeCompressFile: trying copy+truncate instead");try{await gt.copy(e,t,{overwrite:!0}),await gt.truncate(e)}catch(o){Re("moveAndMaybeCompressFile: error copy+truncate",o)}}}}};Lm.exports=Z0});var mi=D((iR,Um)=>{var Pe=we()("streamroller:RollingFileWriteStream"),Xt=Sa(),Qt=require("path"),Q0=require("os"),fi=Fm(),pi=Jo(),{Writable:X0}=require("stream"),eE=Pm(),tE=jm(),rE=Bm(),nE=e=>(Pe(`deleteFiles: files to delete: ${e}`),Promise.all(e.map(t=>Xt.unlink(t).catch(r=>{Pe(`deleteFiles: error when unlinking ${t}, ignoring. Error was ${r}`)})))),Oa=class extends X0{constructor(t,r){if(Pe(`constructor: creating RollingFileWriteStream. path=${t}`),typeof t!="string"||t.length===0)throw new Error(`Invalid filename: ${t}`);if(t.endsWith(Qt.sep))throw new Error(`Filename is a directory: ${t}`);t.indexOf(`~${Qt.sep}`)===0&&(t=t.replace("~",Q0.homedir())),super(r),this.options=this._parseOption(r),this.fileObject=Qt.parse(t),this.fileObject.dir===""&&(this.fileObject=Qt.parse(Qt.join(process.cwd(),t))),this.fileFormatter=eE({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=tE({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=pi(this.options.pattern,fi())),this.filename=this.fileFormatter({index:0,date:this.state.currentDate}),["a","a+","as","as+"].includes(this.options.flags)&&this._setExistingSizeAndDate(),Pe(`constructor: create new file ${this.filename}, state=${JSON.stringify(this.state)}`),this._renewWriteStream()}_setExistingSizeAndDate(){try{let t=Xt.statSync(this.filename);this.state.currentSize=t.size,this.options.pattern&&(this.state.currentDate=pi(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 Pe(`_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(()=>{Pe(`_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())&&(Pe(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==pi(this.options.pattern,fi())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return Pe("_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--){Pe(`_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 rE(o,i,s)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?pi(this.options.pattern,fi()):null,Pe(`_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 Xt.readdir(this.fileObject.dir).catch(()=>[]);Pe(`_getExistingFiles: files=${t}`);let r=t.map(o=>this.fileNameParser(o)).filter(o=>o),n=o=>(o.timestamp?o.timestamp:fi().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 Xt.mkdirSync(i,{recursive:!0})}catch(s){if(s.code==="ENOENT")return r(Qt.dirname(i)),r(i);if(s.code!=="EEXIST"&&s.code!=="EROFS")throw s;try{if(Xt.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};Xt.appendFileSync(t,"",o({...n},"flags","flag")),this.currentFileStream=Xt.createWriteStream(t,n),this.currentFileStream.on("error",i=>{this.emit("error",i)})}async _clean(){let t=await this._getExistingFiles();if(Pe(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${t.length}`),Pe("_clean: existing files are: ",t),this._tooManyFiles(t.length)){let r=t.slice(0,t.length-this.options.numToKeep).map(n=>Qt.format({dir:this.fileObject.dir,base:n.filename}));await nE(r)}}_tooManyFiles(t){return this.options.numToKeep>0&&t>this.options.numToKeep}};Um.exports=Oa});var Wm=D((sR,zm)=>{var oE=mi(),Da=class extends oE{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}};zm.exports=Da});var Gm=D((aR,Km)=>{var iE=mi(),_a=class extends iE{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}};Km.exports=_a});var Ta=D((uR,Hm)=>{Hm.exports={RollingFileWriteStream:mi(),RollingFileStream:Wm(),DateRollingFileStream:Gm()}});var Qm=D((cR,Zm)=>{var Jm=we()("log4js:file"),Na=require("path"),sE=Ta(),Ym=require("os"),aE=Ym.EOL,di=!1,hi=new Set;function Vm(){hi.forEach(e=>{e.sighupHandler()})}function uE(e,t,r,n,o,i){if(typeof e!="string"||e.length===0)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(Na.sep))throw new Error(`Filename is a directory: ${e}`);e=e.replace(new RegExp(`^~(?=${Na.sep}.+)`),Ym.homedir()),e=Na.normalize(e),n=!n&&n!==0?5:n,Jm("Creating file appender (",e,", ",r,", ",n,", ",o,", ",i,")");function s(m,l,d,f){let g=new sE.RollingFileStream(m,l,d,f);return g.on("error",w=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",m,w)}),g.on("drain",()=>{process.emit("log4js:pause",!1)}),g}let a=s(e,r,n,o),u=function(m){if(a.writable){if(o.removeColor===!0){let l=/\\x1b[[0-9;]*m/g;m.data=m.data.map(d=>typeof d=="string"?d.replace(l,""):d)}a.write(t(m,i)+aE,"utf8")||process.emit("log4js:pause",!0)}};return u.reopen=function(){a.end(()=>{a=s(e,r,n,o)})},u.sighupHandler=function(){Jm("SIGHUP handler called."),u.reopen()},u.shutdown=function(m){hi.delete(u),hi.size===0&&di&&(process.removeListener("SIGHUP",Vm),di=!1),a.end("","utf-8",m)},hi.add(u),di||(process.on("SIGHUP",Vm),di=!0),u}function cE(e,t){let r=t.basicLayout;return e.layout&&(r=t.layout(e.layout.type,e.layout)),e.mode=e.mode||384,uE(e.filename,r,e.maxLogSize,e.backups,e,e.timezoneOffset)}Zm.exports.configure=cE});var ed=D((lR,Xm)=>{var lE=Ta(),fE=require("os"),pE=fE.EOL;function mE(e,t,r){let n=new lE.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 dE(e,t,r,n,o){n.maxSize=n.maxLogSize;let i=mE(e,t,n),s=function(a){i.writable&&(i.write(r(a,o)+pE,"utf8")||process.emit("log4js:pause",!0))};return s.shutdown=function(a){i.end("","utf-8",a)},s}function hE(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,dE(e.filename,e.pattern,r,e,e.timezoneOffset)}Xm.exports.configure=hE});var od=D((fR,nd)=>{var yt=we()("log4js:fileSync"),at=require("path"),st=require("fs"),td=require("os"),gE=td.EOL;function rd(e,t){let r=n=>{try{return st.mkdirSync(n,{recursive:!0})}catch(o){if(o.code==="ENOENT")return r(at.dirname(n)),r(n);if(o.code!=="EEXIST"&&o.code!=="EROFS")throw o;try{if(st.statSync(n).isDirectory())return n;throw o}catch{throw o}}};r(at.dirname(e)),st.appendFileSync(e,"",{mode:t.mode,flag:t.flags})}var Ca=class{constructor(t,r,n,o){if(yt("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=st.statSync(s).size}catch{rd(s,o)}return a}this.currentSize=i(this.filename)}shouldRoll(){return yt("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(`^${at.basename(t)}`);function o(m){return n.test(m)}function i(m){return parseInt(m.slice(`${at.basename(t)}.`.length),10)||0}function s(m,l){return i(m)-i(l)}function a(m){let l=i(m);if(yt(`Index of ${m} is ${l}`),r.backups===0)st.truncateSync(t,0);else if(l<r.backups){try{st.unlinkSync(`${t}.${l+1}`)}catch{}yt(`Renaming ${m} -> ${t}.${l+1}`),st.renameSync(at.join(at.dirname(t),m),`${t}.${l+1}`)}}function u(){yt("Renaming the old files"),st.readdirSync(at.dirname(t)).filter(o).sort(s).reverse().forEach(a)}yt("Rolling, rolling, rolling"),u()}write(t,r){let n=this;function o(){yt("writing the chunk to the file"),n.currentSize+=t.length,st.appendFileSync(n.filename,t)}yt("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),o()}};function yE(e,t,r,n,o,i){if(typeof e!="string"||e.length===0)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(at.sep))throw new Error(`Filename is a directory: ${e}`);e=e.replace(new RegExp(`^~(?=${at.sep}.+)`),td.homedir()),e=at.normalize(e),n=!n&&n!==0?5:n,yt("Creating fileSync appender (",e,", ",r,", ",n,", ",o,", ",i,")");function s(u,m,l){let d;return m?d=new Ca(u,m,l,o):d=(f=>(rd(f,o),{write(g){st.appendFileSync(f,g)}}))(u),d}let a=s(e,r,n);return u=>{a.write(t(u,i)+gE)}}function bE(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 yE(e.filename,r,e.maxLogSize,e.backups,n,e.timezoneOffset)}nd.exports.configure=bE});var sd=D((pR,id)=>{var ut=we()("log4js:tcp"),vE=require("net");function wE(e,t){let r=!1,n=[],o,i=3,s="__LOG4JS__";function a(d){ut("Writing log event to socket"),r=o.write(`${t(d)}${s}`,"utf8")}function u(){let d;for(ut("emptying buffer");d=n.shift();)a(d)}function m(){ut(`appender creating socket to ${e.host||"localhost"}:${e.port||5e3}`),s=`${e.endMsg||"__LOG4JS__"}`,o=vE.createConnection(e.port||5e3,e.host||"localhost"),o.on("connect",()=>{ut("socket connected"),u(),r=!0}),o.on("drain",()=>{ut("drain event received, emptying buffer"),r=!0,u()}),o.on("timeout",o.end.bind(o)),o.on("error",d=>{ut("connection error",d),r=!1,u()}),o.on("close",m)}m();function l(d){r?a(d):(ut("buffering log event because it cannot write at the moment"),n.push(d))}return l.shutdown=function(d){ut("shutdown called"),n.length&&i?(ut("buffer has items, waiting 100ms to empty"),i-=1,setTimeout(()=>{l.shutdown(d)},100)):(o.removeAllListeners("close"),o.end(d))},l}function xE(e,t){ut(`configure with config = ${e}`);let r=function(n){return n.serialise()};return e.layout&&(r=t.layout(e.layout.type,e.layout)),wE(e,r)}id.exports.configure=xE});var Fa=D((mR,Ra)=>{var Aa=require("path"),At=we()("log4js:appenders"),Je=Kt(),ad=Qo(),EE=Ht(),IE=Ys(),SE=nf(),Qe=new Map;Qe.set("console",sf());Qe.set("stdout",uf());Qe.set("stderr",lf());Qe.set("logLevelFilter",pf());Qe.set("categoryFilter",hf());Qe.set("noLogFilter",bf());Qe.set("file",Qm());Qe.set("dateFile",ed());Qe.set("fileSync",od());Qe.set("tcp",sd());var Pn=new Map,gi=(e,t)=>{let r;try{let n=`${e}.cjs`;r=require.resolve(n),At("Loading module from ",n)}catch{r=e,At("Loading module from ",e)}try{return require(r)}catch(n){Je.throwExceptionIf(t,n.code!=="MODULE_NOT_FOUND",`appender "${e}" could not be loaded (error was: ${n})`);return}},OE=(e,t)=>Qe.get(e)||gi(`./${e}`,t)||gi(e,t)||require.main&&require.main.filename&&gi(Aa.join(Aa.dirname(require.main.filename),e),t)||gi(Aa.join(process.cwd(),e),t),yi=new Set,ud=(e,t)=>{if(Pn.has(e))return Pn.get(e);if(!t.appenders[e])return!1;if(yi.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);yi.add(e),At(`Creating appender ${e}`);let r=DE(e,t);return yi.delete(e),Pn.set(e,r),r},DE=(e,t)=>{let r=t.appenders[e],n=r.type.configure?r.type:OE(r.type,t);return Je.throwExceptionIf(t,Je.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"),At("[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"),At("[log4js-node-DEP0002]",`DEPRECATION: Appender ${r.type} exports a shutdown function.`)),At(`${e}: clustering.isMaster ? ${ad.isMaster()}`),At(`${e}: appenderModule is ${require("util").inspect(n)}`),ad.onlyOnMaster(()=>(At(`calling appenderModule.configure for ${e} / ${r.type}`),n.configure(SE.modifyConfig(r),IE,o=>ud(o,t),EE)),()=>{})},cd=e=>{if(Pn.clear(),yi.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")&&ud(r,e)})},ld=()=>{cd()};ld();Je.addListener(e=>{Je.throwExceptionIf(e,Je.not(Je.anObject(e.appenders)),\'must have a property "appenders" of type object.\');let t=Object.keys(e.appenders);Je.throwExceptionIf(e,Je.not(t.length),"must define at least one appender."),t.forEach(r=>{Je.throwExceptionIf(e,Je.not(e.appenders[r].type),`appender "${r}" is not valid (must be an object with property "type")`)})});Je.addListener(cd);Ra.exports=Pn;Ra.exports.init=ld});var ka=D((dR,bi)=>{var kn=we()("log4js:categories"),ue=Kt(),$a=Ht(),fd=Fa(),Rt=new Map;function pd(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:[]}),pd(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 _E(e){if(!e.categories)return;Object.keys(e.categories).forEach(r=>{let n=e.categories[r];pd(e,n,r)})}ue.addPreProcessingListener(e=>_E(e));ue.addListener(e=>{ue.throwExceptionIf(e,ue.not(ue.anObject(e.categories)),\'must have a property "categories" of type object.\');let t=Object.keys(e.categories);ue.throwExceptionIf(e,ue.not(t.length),"must define at least one category."),t.forEach(r=>{let n=e.categories[r];ue.throwExceptionIf(e,[ue.not(n.appenders),ue.not(n.level)],`category "${r}" is not valid (must be an object with properties "appenders" and "level")`),ue.throwExceptionIf(e,ue.not(Array.isArray(n.appenders)),`category "${r}" is not valid (appenders must be an array of appender names)`),ue.throwExceptionIf(e,ue.not(n.appenders.length),`category "${r}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(n,"enableCallStack")&&ue.throwExceptionIf(e,typeof n.enableCallStack!="boolean",`category "${r}" is not valid (enableCallStack must be boolean type)`),n.appenders.forEach(o=>{ue.throwExceptionIf(e,ue.not(fd.get(o)),`category "${r}" is not valid (appender "${o}" is not defined)`)}),ue.throwExceptionIf(e,ue.not($a.getLevel(n.level)),`category "${r}" is not valid (level "${n.level}" not recognised; valid levels are ${$a.levels.join(", ")})`)}),ue.throwExceptionIf(e,ue.not(e.categories.default),\'must define a "default" category.\')});var Pa=e=>{if(Rt.clear(),!e)return;Object.keys(e.categories).forEach(r=>{let n=e.categories[r],o=[];n.appenders.forEach(i=>{o.push(fd.get(i)),kn(`Creating category ${r}`),Rt.set(r,{appenders:o,level:$a.getLevel(n.level),enableCallStack:n.enableCallStack||!1})})})},md=()=>{Pa()};md();ue.addListener(Pa);var Or=e=>{if(kn(`configForCategory: searching for config for ${e}`),Rt.has(e))return kn(`configForCategory: ${e} exists in config, returning it`),Rt.get(e);let t;return e.indexOf(".")>0?(kn(`configForCategory: ${e} has hierarchy, cloning from parents`),t={...Or(e.slice(0,e.lastIndexOf(".")))}):(Rt.has("default")||Pa({categories:{default:{appenders:["out"],level:"OFF"}}}),kn("configForCategory: cloning default category"),t={...Rt.get("default")}),Rt.set(e,t),t},TE=e=>Or(e).appenders,NE=e=>Or(e).level,CE=(e,t)=>{Or(e).level=t},AE=e=>Or(e).enableCallStack===!0,RE=(e,t)=>{Or(e).enableCallStack=t};bi.exports=Rt;bi.exports=Object.assign(bi.exports,{appendersForCategory:TE,getLevelForCategory:NE,setLevelForCategory:CE,getEnableCallStackForCategory:AE,setEnableCallStackForCategory:RE,init:md})});var bd=D((hR,yd)=>{var dd=we()("log4js:logger"),FE=Zs(),ct=Ht(),$E=Qo(),vi=ka(),hd=Kt(),PE=/at (?:(.+)\\s+\\()?(?:(.+?):(\\d+)(?::(\\d+))?|([^)]+))\\)?/;function kE(e,t=4){try{let r=e.stack.split(`\n`).slice(t),n=PE.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 Mn=class{constructor(t){if(!t)throw new Error("No category provided.");this.category=t,this.context={},this.parseCallStack=kE,dd(`Logger created (${this.category}, ${this.level})`)}get level(){return ct.getLevel(vi.getLevelForCategory(this.category),ct.OFF)}set level(t){vi.setLevelForCategory(this.category,ct.getLevel(t,this.level))}get useCallStack(){return vi.getEnableCallStackForCategory(this.category)}set useCallStack(t){vi.setEnableCallStackForCategory(this.category,t===!0)}log(t,...r){let n=ct.getLevel(t);n?this.isLevelEnabled(n)&&this._log(n,r):hd.validIdentifier(t)&&r.length>0?(this.log(ct.WARN,"log4js:logger.log: valid log-level not found as first parameter given:",t),this.log(ct.INFO,`[${t}]`,...r)):this.log(ct.INFO,t,...r)}isLevelEnabled(t){return this.level.isLessThanOrEqualTo(t)}_log(t,r){dd(`sending log data (${t}) to appenders`);let n=new FE(this.category,t,r,this.context,this.useCallStack&&this.parseCallStack(new Error));$E.send(n)}addContext(t,r){this.context[t]=r}removeContext(t){delete this.context[t]}clearContext(){this.context={}}setParseCallStackFunction(t){this.parseCallStack=t}};function gd(e){let t=ct.getLevel(e),n=t.toString().toLowerCase().replace(/_([a-z])/g,i=>i[1].toUpperCase()),o=n[0].toUpperCase()+n.slice(1);Mn.prototype[`is${o}Enabled`]=function(){return this.isLevelEnabled(t)},Mn.prototype[n]=function(...i){this.log(t,...i)}}ct.levels.forEach(gd);hd.addListener(()=>{ct.levels.forEach(gd)});yd.exports=Mn});var xd=D((gR,wd)=>{var Dr=Ht(),ME=\':remote-addr - - ":method :url HTTP/:http-version" :status :content-length ":referrer" ":user-agent"\';function qE(e){return e.originalUrl||e.url}function jE(e,t,r){let n=i=>{let s=i.concat();for(let a=0;a<s.length;++a)for(let u=a+1;u<s.length;++u)s[a].token==s[u].token&&s.splice(u--,1);return s},o=[];return o.push({token:":url",replacement:qE(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 vd(e,t){for(let r=0;r<t.length;r++)e=e.replace(t[r].token,t[r].replacement);return e}function LE(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 BE(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=Dr.getLevel(o.level,n))}return n}wd.exports=function(t,r){typeof r=="string"||typeof r=="function"?r={format:r}:r=r||{};let n=t,o=Dr.getLevel(r.level,Dr.INFO),i=r.format||ME;return(s,a,u)=>{if(s._logging!==void 0)return u();if(typeof r.nolog!="function"){let m=LE(r.nolog);if(m&&m.test(s.originalUrl))return u()}if(n.isLevelEnabled(o)||r.level==="auto"){let m=new Date,{writeHead:l}=a;s._logging=!0,a.writeHead=(g,w)=>{a.writeHead=l,a.writeHead(g,w),a.__statusCode=g,a.__headers=w||{}};let d=!1,f=()=>{if(d)return;if(d=!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=Dr.INFO,a.statusCode>=300&&(o=Dr.WARN),a.statusCode>=400&&(o=Dr.ERROR)),o=BE(a.statusCode,o,r.statusRules);let g=jE(s,a,r.tokens||[]);if(r.context&&n.addContext("res",a),typeof i=="function"){let w=i(s,a,x=>vd(x,g));w&&n.log(o,w)}else n.log(o,vd(i,g));r.context&&n.removeContext("res")};a.on("end",f),a.on("finish",f),a.on("error",f),a.on("close",f)}return u()}}});var Dd=D((yR,Od)=>{var Ed=we()("log4js:recording"),wi=[];function UE(){return function(e){Ed(`received logEvent, number of events now ${wi.length+1}`),Ed("log event was ",e),wi.push(e)}}function Id(){return wi.slice()}function Sd(){wi.length=0}Od.exports={configure:UE,replay:Id,playback:Id,reset:Sd,erase:Sd}});var Fd=D((bR,Rd)=>{var Ft=we()("log4js:main"),zE=require("fs"),WE=bl()({proto:!0}),KE=Kt(),GE=Ys(),HE=Ht(),_d=Fa(),Td=ka(),JE=bd(),VE=Qo(),YE=xd(),ZE=Dd(),qn=!1;function QE(e){if(!qn)return;Ft("Received log event ",e),Td.appendersForCategory(e.categoryName).forEach(r=>{r(e)})}function XE(e){Ft(`Loading configuration from ${e}`);try{return JSON.parse(zE.readFileSync(e,"utf8"))}catch(t){throw new Error(`Problem reading config from file "${e}". Error was ${t.message}`,t)}}function Nd(e){qn&&Cd();let t=e;return typeof t=="string"&&(t=XE(e)),Ft(`Configuration is ${t}`),KE.configure(WE(t)),VE.onMessage(QE),qn=!0,Ad}function eI(){return ZE}function Cd(e){Ft("Shutdown called. Disabling all log writing."),qn=!1;let t=Array.from(_d.values());_d.init(),Td.init();let r=t.reduceRight((s,a)=>a.shutdown?s+1:s,0);if(r===0)return Ft("No appenders with shutdown functions found."),e!==void 0&&e();let n=0,o;Ft(`Found ${r} appenders with shutdown functions.`);function i(s){o=o||s,n+=1,Ft(`Appender shutdowns complete: ${n} / ${r}`),n>=r&&(Ft("All shutdown functions completed."),e&&e(o))}return t.filter(s=>s.shutdown).forEach(s=>s.shutdown(i)),null}function tI(e){return qn||Nd(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new JE(e||"default")}var Ad={getLogger:tI,configure:Nd,shutdown:Cd,connectLogger:YE,levels:HE,addLayout:GE.addLayout,recording:eI};Rd.exports=Ad});var lt=D(Ei=>{"use strict";Ei.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};Ei.cppdb=Symbol();Ei.inspect=Symbol.for("nodejs.util.inspect.custom")});var ja=D((ER,kd)=>{"use strict";var qa={value:"SqliteError",writable:!0,enumerable:!1,configurable:!0};function er(e,t){if(new.target!==er)return new er(e,t);if(typeof t!="string")throw new TypeError("Expected second argument to be a string");Error.call(this,e),qa.value=""+e,Object.defineProperty(this,"message",qa),Error.captureStackTrace(this,er),this.code=t}Object.setPrototypeOf(er,Error);Object.setPrototypeOf(er.prototype,Error.prototype);Object.defineProperty(er.prototype,"name",qa);kd.exports=er});var qd=D((IR,Md)=>{var Ii=require("path").sep||"/";Md.exports=nI;function nI(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=Ii+Ii+n),o=o.replace(/^(.+)\\|/,"$1:"),Ii=="\\\\"&&(o=o.replace(/\\//g,"\\\\")),/^.+\\:/.test(o)||(o=Ii+o),n+o}});var Ud=D((_r,Bd)=>{var La=require("fs"),Oi=require("path"),oI=qd(),Si=Oi.join,iI=Oi.dirname,jd=La.accessSync&&function(e){try{La.accessSync(e)}catch{return!1}return!0}||La.existsSync||Oi.existsSync,Ld={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 sI(e){typeof e=="string"?e={bindings:e}:e||(e={}),Object.keys(Ld).map(function(u){u in e||(e[u]=Ld[u])}),e.module_root||(e.module_root=_r.getRoot(_r.getFileName())),Oi.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=Si.apply(null,e.try[n].map(function(u){return e[u]||u})),r.push(i);try{return s=e.path?t.resolve(i):t(i),e.path||(s.path=i),s}catch(u){if(u.code!=="MODULE_NOT_FOUND"&&u.code!=="QUALIFIED_PATH_RESOLUTION_FAILED"&&!/not find/i.test(u.message))throw u}}throw a=new Error(`Could not locate the bindings file. Tried:\n`+r.map(function(u){return e.arrow+u}).join(`\n`)),a.tries=r,a}Bd.exports=_r=sI;_r.getFileName=function(t){var r=Error.prepareStackTrace,n=Error.stackTraceLimit,o={},i;Error.stackTraceLimit=10,Error.prepareStackTrace=function(a,u){for(var m=0,l=u.length;m<l;m++)if(i=u[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=oI(i)),i};_r.getRoot=function(t){for(var r=iI(t),n;;){if(r==="."&&(r=process.cwd()),jd(Si(r,"package.json"))||jd(Si(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=Si(r,"..")}}});var zd=D($t=>{"use strict";var{cppdb:Xe}=lt();$t.prepare=function(t){return this[Xe].prepare(t,this,!1)};$t.exec=function(t){return this[Xe].exec(t),this};$t.close=function(){return this[Xe].close(),this};$t.loadExtension=function(...t){return this[Xe].loadExtension(...t),this};$t.defaultSafeIntegers=function(...t){return this[Xe].defaultSafeIntegers(...t),this};$t.unsafeMode=function(...t){return this[Xe].unsafeMode(...t),this};$t.getters={name:{get:function(){return this[Xe].name},enumerable:!0},open:{get:function(){return this[Xe].open},enumerable:!0},inTransaction:{get:function(){return this[Xe].inTransaction},enumerable:!0},readonly:{get:function(){return this[Xe].readonly},enumerable:!0},memory:{get:function(){return this[Xe].memory},enumerable:!0}}});var Gd=D((OR,Kd)=>{"use strict";var{cppdb:aI}=lt(),Wd=new WeakMap;Kd.exports=function(t){if(typeof t!="function")throw new TypeError("Expected first argument to be a function");let r=this[aI],n=uI(r,this),{apply:o}=Function.prototype,i={default:{value:Di(o,t,r,n.default)},deferred:{value:Di(o,t,r,n.deferred)},immediate:{value:Di(o,t,r,n.immediate)},exclusive:{value:Di(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 uI=(e,t)=>{let r=Wd.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)};Wd.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},Di=(e,t,r,{begin:n,commit:o,rollback:i,savepoint:s,release:a,rollbackTo:u})=>function(){let l,d,f;r.inTransaction?(l=s,d=a,f=u):(l=n,d=o,f=i),l.run();try{let g=e.call(t,this,arguments);return d.run(),g}catch(g){throw r.inTransaction&&(f.run(),f!==i&&d.run()),g}}});var Jd=D((DR,Hd)=>{"use strict";var{getBooleanOption:cI,cppdb:lI}=lt();Hd.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=cI(r,"simple"),o=this[lI].prepare(`PRAGMA ${t}`,this,!0);return n?o.pluck().get():o.all()}});var Zd=D((_R,Yd)=>{"use strict";var fI=require("fs"),pI=require("path"),{promisify:mI}=require("util"),{cppdb:dI}=lt(),Vd=mI(fI.access);Yd.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 Vd(pI.dirname(t)).catch(()=>{throw new TypeError("Cannot save backup because the directory does not exist")});let i=await Vd(t).then(()=>!1,()=>!0);return hI(this[dI].backup(this,n,t,i),o||null)};var hI=(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 u=t(a);if(u!==void 0)if(typeof u=="number"&&u===u)r=Math.max(0,Math.min(2147483647,Math.round(u)));else throw new TypeError("Expected progress callback to return a number or undefined")}setImmediate(s)}catch(a){e.close(),i(a)}})})}});var Xd=D((TR,Qd)=>{"use strict";var{cppdb:gI}=lt();Qd.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[gI].serialize(r)}});var th=D((NR,eh)=>{"use strict";var{getBooleanOption:_i,cppdb:yI}=lt();eh.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?+_i(r,"safeIntegers"):2,i=_i(r,"deterministic"),s=_i(r,"directOnly"),a=_i(r,"varargs"),u=-1;if(!a){if(u=n.length,!Number.isInteger(u)||u<0)throw new TypeError("Expected function.length to be a positive integer");if(u>100)throw new RangeError("User-defined functions cannot have more than 100 arguments")}return this[yI].function(n,t,u,o,i,s),this}});var oh=D((CR,nh)=>{"use strict";var{getBooleanOption:Ti,cppdb:bI}=lt();nh.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=Ba(r,"step",!0),i=Ba(r,"inverse",!1),s=Ba(r,"result",!1),a="safeIntegers"in r?+Ti(r,"safeIntegers"):2,u=Ti(r,"deterministic"),m=Ti(r,"directOnly"),l=Ti(r,"varargs"),d=-1;if(!l&&(d=Math.max(rh(o),i?rh(i):0),d>0&&(d-=1),d>100))throw new RangeError("User-defined functions cannot have more than 100 arguments");return this[bI].aggregate(n,o,i,s,t,d,a,u,m),this};var Ba=(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},rh=({length:e})=>{if(Number.isInteger(e)&&e>=0)return e;throw new TypeError("Expected function.length to be a positive integer")}});var uh=D((AR,ah)=>{"use strict";var{cppdb:vI}=lt();ah.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=_I(sh(r,"used",t));else{if(typeof r!="function")throw new TypeError("Expected second argument to be a function or a table definition object");r=wI(r)}return this[vI].table(r,t,n),this};function wI(e){return function(r,n,o,...i){let s={module:r,database:n,table:o},a=OI.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 sh(a,"returned",r)}}function sh(e,t,r){if(!jn.call(e,"rows"))throw new TypeError(`Virtual table module "${r}" ${t} a table definition without a "rows" property`);if(!jn.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)!==DI)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(jn.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=SI(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(jn.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(jn.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(ih).map(m=>`${m} HIDDEN`),...o.map(ih)].join(", ")});`,xI(n,new Map(o.map((m,l)=>[m,i.length+l])),r),i,s,a]}function xI(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))EI(s,i,t.size,r),yield i;else if(typeof s=="object"&&s!==null)II(s,i,t,r),yield i;else throw new TypeError(`Virtual table module "${r}" yielded something that isn\'t a valid row object`)}}function EI(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 II(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 SI({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:jn}=Object.prototype,{apply:OI}=Function.prototype,DI=Object.getPrototypeOf(function*(){}),ih=e=>`"${e.replace(/"/g,\'""\')}"`,_I=e=>()=>e});var lh=D((RR,ch)=>{"use strict";var TI=function(){};ch.exports=function(t,r){return Object.assign(new TI,this)}});var dh=D((FR,mh)=>{"use strict";var NI=require("fs"),fh=require("path"),Ln=lt(),CI=ja(),ph;function Oe(e,t){if(new.target==null)return new Oe(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=Ln.getBooleanOption(t,"readonly"),s=Ln.getBooleanOption(t,"uriPath"),a=Ln.getBooleanOption(t,"fileMustExist"),u="timeout"in t?t.timeout:5e3,m="verbose"in t?t.verbose:null,l="nativeBinding"in t?t.nativeBinding:null;if(i&&o&&!r)throw new TypeError("In-memory/temporary databases cannot be readonly");if(!Number.isInteger(u)||u<0)throw new TypeError(\'Expected the "timeout" option to be a positive integer\');if(u>2147483647)throw new RangeError(\'Option "timeout" cannot be greater than 2147483647\');if(m!=null&&typeof m!="function")throw new TypeError(\'Expected the "verbose" option to be a function\');if(l!=null&&typeof l!="string"&&typeof l!="object")throw new TypeError(\'Expected the "nativeBinding" option to be a string or addon object\');let d;if(l==null?d=ph||(ph=Ud()("better_sqlite3.node")):typeof l=="string"?d=(typeof __non_webpack_require__=="function"?__non_webpack_require__:require)(fh.resolve(l).replace(/(\\.node)?$/,".node")):d=l,d.isInitialized||(d.setErrorConstructor(CI),d.isInitialized=!0),!o&&!s&&!NI.existsSync(fh.dirname(n)))throw new TypeError("Cannot open database because the directory does not exist");Object.defineProperties(this,{[Ln.cppdb]:{value:new d.Database(n,e,o,i,a,u,m||null,r||null,s||null)},...tr.getters})}var tr=zd();Oe.prototype.prepare=tr.prepare;Oe.prototype.transaction=Gd();Oe.prototype.pragma=Jd();Oe.prototype.backup=Zd();Oe.prototype.serialize=Xd();Oe.prototype.function=th();Oe.prototype.aggregate=oh();Oe.prototype.table=uh();Oe.prototype.loadExtension=tr.loadExtension;Oe.prototype.exec=tr.exec;Oe.prototype.close=tr.close;Oe.prototype.defaultSafeIntegers=tr.defaultSafeIntegers;Oe.prototype.unsafeMode=tr.unsafeMode;Oe.prototype[Ln.inspect]=lh();mh.exports=Oe});var hh=D(($R,Ua)=>{"use strict";Ua.exports=dh();Ua.exports.SqliteError=ja()});var wh=D(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});function vh(e,t){if(t)return e;throw new Error("Unhandled discriminated union member: "+JSON.stringify(e))}Ni.assertNever=vh;Ni.default=vh});var Zi=class extends Error{},te=e=>{throw new Zi(e)},Qi=class extends Error{},Q=e=>{throw new Qi(e)};var xt=(e,t)=>le(e)===t,le=e=>{let t=typeof e;return t==="object"?e===null?"null":"object":t==="function"?"object":t},Xi={bigint:"a bigint",boolean:"boolean",null:"null",number:"a number",object:"an object",string:"a string",symbol:"a symbol",undefined:"undefined"};var Me=(e,t)=>e in t,wu=e=>Object.entries(e),re=e=>Object.keys(e),Pt=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},ir=(e,t)=>{let r=e?.[t];return r!=null};var xu=e=>Object.keys(e).length,Pr=e=>xt(e,"object")?Object.keys(e).length!==0:!1,tS=Symbol("id");var et=e=>Array.isArray(e)?e:[e];var ge=class extends Array{static fromString(t,r="/"){return t===r?new ge:new ge(...t.split(r))}toString(t="/"){return this.length?this.join(t):t}},Eu=(e,t)=>{let r=e;for(let n of t){if(typeof r!="object"||r===null)return;r=r[n]}return r};var es=/^(?!^-0$)-?(?:0|[1-9]\\d*)(?:\\.\\d*[1-9])?$/,ny=e=>es.test(e),oy=/^-?\\d*\\.?\\d*$/,iy=e=>e.length!==0&&oy.test(e),eo=/^(?:0|(?:-?[1-9]\\d*))$/,kr=e=>eo.test(e),Mr=/^(?:0|(?:[1-9]\\d*))$/,Iu=/^-?\\d+$/,sy=e=>Iu.test(e),Su={number:"a number",bigint:"a bigint",integer:"an integer"},Ou=(e,t)=>`\'${e}\' was parsed as ${Su[t]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`,ay=(e,t)=>t==="number"?ny(e):kr(e),uy=(e,t)=>t==="number"?Number(e):Number.parseInt(e),cy=(e,t)=>t==="number"?iy(e):sy(e),qr=(e,t)=>Du(e,"number",t),to=(e,t)=>Du(e,"integer",t),Du=(e,t,r)=>{let n=uy(e,t);if(!Number.isNaN(n)){if(ay(e,t))return n;if(cy(e,t))return Q(Ou(e,t))}return r?Q(r===!0?`Failed to parse ${Su[t]} from \'${e}\'`:r):void 0},ts=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(Iu.test(t))return Q(Ou(e,"bigint"))};var ie=(e,t)=>{switch(le(e)){case"object":return JSON.stringify(rs(e,ro,[]),null,t);case"symbol":return ro.onSymbol(e);default:return ns(e)}},ro={onCycle:()=>"(cycle)",onSymbol:e=>`(symbol${e.description&&` ${e.description}`})`,onFunction:e=>`(function${e.name&&` ${e.name}`})`},rs=(e,t,r)=>{switch(le(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=>rs(i,t,n));let o={};for(let i in e)o[i]=rs(e[i],t,n);return o;case"symbol":return ro.onSymbol(e);case"bigint":return`${e}n`;case"undefined":return"undefined";default:return e}},ns=e=>typeof e=="string"?`\'${e}\'`:typeof e=="bigint"?`${e}n`:`${e}`;function ly(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function fy(e,t){return t.get?t.get.call(e):t.value}function py(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 Tu(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function _u(e,t){var r=Tu(e,t,"get");return fy(e,r)}function my(e,t,r){ly(e,t),t.set(e,r)}function dy(e,t,r){var n=Tu(e,t,"set");return py(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 qe=e=>(t,r,n)=>t===void 0?r===void 0?te(so):r:r===void 0?t:e(t,r,n),so="Unexpected operation two undefined operands",os={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 ${ie(e)} and ${ie(t)}`,leftAssignability:({l:e,r:t})=>`literal value ${ie(e.value)} and ${ie(t)}`,rightAssignability:({l:e,r:t})=>`literal value ${ie(t.value)} and ${ie(e)}`,union:({l:e,r:t})=>`branches ${ie(e)} and branches ${ie(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,Et=class{get disjoints(){return _u(this,oo)}addDisjoint(t,r,n){return _u(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),my(this,oo,{writable:!0,value:void 0}),this.type=t,this.lastOperator=r,this.path=new ge,dy(this,oo,{})}},ao=Symbol("empty"),Nu=()=>ao,Ye=e=>e===ao,Cu=Symbol("equal"),ye=()=>Cu,je=e=>e===Cu,sr=(e,t)=>(r,n,o)=>{let i={},s=re({...r,...n}),a=!0,u=!0;for(let m of s){let l=typeof e=="function"?e(m,r[m],n[m],o):e[m](r[m],n[m],o);if(je(l))r[m]!==void 0&&(i[m]=r[m]);else if(Ye(l))if(t.onEmpty==="omit")a=!1,u=!1;else return ao;else l!==void 0&&(i[m]=l),a&&(a=l===r[m]),u&&(u=l===n[m])}return a?u?ye():r:u?n:i};var Au=e=>{let t=re(e);if(t.length===1){let n=t[0];return`${n==="/"?"":`At ${n}: `}Intersection of ${os[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}: ${os[e[n].kind](e[n])}\n`;return r},uo=(e,t,r)=>`${e.length?`At ${e}: `:""}${t} ${r?`${r} `:""}results in an unsatisfiable type`;var jr={Array,Date,Error,Function,Map,RegExp,Set,Object,String,Number,Boolean,WeakMap,WeakSet,Promise},ar=(e,t)=>{if(le(e)!=="object")return;let r=t??jr,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 It=e=>Array.isArray(e),is={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&&Me(t,jr)&&jr[t]===e?t:void 0};var Ru=qe((e,t,r)=>e===t?ye():e instanceof t?e:t instanceof e?t:r.addDisjoint("class",e,t)),Fu=(e,t)=>typeof e=="string"?ar(t.data)===e||!t.problems.add("class",e):t.data instanceof e||!t.problems.add("class",e);var lo=(e,t)=>{if(Array.isArray(e)){if(Array.isArray(t)){let r=hy(e,t);return r.length===e.length?r.length===t.length?ye():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?ye():[e,t]},hy=(e,t)=>{let r=[...e];for(let n of t)e.includes(n)||r.push(n);return r};var $u=qe((e,t)=>e===t?ye():Math.abs(e*t/gy(e,t))),gy=(e,t)=>{let r,n=e,o=t;for(;o!==0;)r=o,o=n%o,n=r;return n},Pu=(e,t)=>t.data%e===0||!t.problems.add("divisor",e);var Lr=e=>e[0]==="?",fo=e=>e[0]==="!",rt={index:"[index]"},St=e=>Lr(e)||fo(e)?e[1]:e,yy=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},ku=qe((e,t,r)=>{let n=by(e,t,r);if(typeof n=="symbol")return n;let o=yy(n);if(o===void 0||!(rt.index in n))return n;let{[rt.index]:i,...s}=n,a=St(i);for(let u=0;u<o;u++){if(!s[u]){s[u]=a;continue}let m=St(s[u]);r.path.push(`${u}`);let l=po(m,a,r);if(r.path.pop(),Ye(l))return l;!je(l)&&l!==m&&(s[u]=l)}return s}),by=sr((e,t,r,n)=>{if(t===void 0)return r===void 0?ye():r;if(r===void 0)return t;n.path.push(e);let o=po(St(t),St(r),n);n.path.pop();let i=Lr(t)&&Lr(r);return Ye(o)&&i?{}:o},{onEmpty:"bubble"}),Mu=(e,t,r)=>{let n=r.type.config?.keys??r.type.scope.config.keys;return n==="loose"?vy(e,t,r):wy(n,e,t,r)},vy=(e,t,r)=>{for(let n in t){let o=t[n];r.path.push(n),n===rt.index?e.push(["indexProp",tt(St(o),r)]):Lr(o)?e.push(["optionalProp",[n,tt(o[1],r)]]):fo(o)?e.push(["prerequisiteProp",[n,tt(o[1],r)]]):e.push(["requiredProp",[n,tt(o,r)]]),r.path.pop()}},wy=(e,t,r,n)=>{let o={required:{},optional:{}};for(let i in r){let s=r[i];n.path.push(i),i===rt.index?o.index=tt(St(s),n):Lr(s)?o.optional[i]=tt(s[1],n):fo(s)?t.push(["prerequisiteProp",[i,tt(s[1],n)]]):o.required[i]=tt(s,n),n.path.pop()}t.push([`${e}Props`,o])};function xy(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ss=e=>typeof e=="string"||Array.isArray(e)?e.length:typeof e=="number"?e:0,Ey=e=>typeof e=="string"?"characters":Array.isArray(e)?"items long":"",ho=class{toString(){return ie(this.value)}get domain(){return le(this.value)}get size(){return ss(this.value)}get units(){return Ey(this.value)}get className(){return Object(this.value).constructor.name}constructor(t){xy(this,"value",void 0),this.value=t}};var go={">":!0,">=":!0},as={"<":!0,"<=":!0},Br=e=>"comparator"in e,ju=qe((e,t,r)=>{if(Br(e))return Br(t)?e.limit===t.limit?ye():r.addDisjoint("range",e,t):qu(t,e.limit)?e:r.addDisjoint("range",e,t);if(Br(t))return qu(e,t.limit)?t:r.addDisjoint("range",e,t);let n=ur("min",e.min,t.min),o=ur("max",e.max,t.max);return n==="l"?o==="r"?ur("min",e.min,t.max)==="l"?r.addDisjoint("range",e,t):{min:e.min,max:t.max}:e:n==="r"?o==="l"?ur("max",e.max,t.min)==="l"?r.addDisjoint("range",e,t):{min:t.min,max:e.max}:t:o==="l"?e:o==="r"?t:ye()}),qu=(e,t)=>Br(e)?t===e.limit:Iy(e.min,t)&&Sy(e.max,t),Iy=(e,t)=>!e||t>e.limit||t===e.limit&&!Ur(e.comparator),Sy=(e,t)=>!e||t<e.limit||t===e.limit&&!Ur(e.comparator),Lu=(e,t,r)=>{let n=r.lastDomain==="string"?"characters":r.lastDomain==="object"?"items long":void 0;if(Br(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])},Bu=(e,t)=>Oy[e.comparator](ss(t.data),e.limit)||!t.problems.add("bound",e),Oy={"<":(e,t)=>e<t,">":(e,t)=>e>t,"<=":(e,t)=>e<=t,">=":(e,t)=>e>=t,"==":(e,t)=>e===t},ur=(e,t,r)=>t?r?t.limit===r.limit?Ur(t.comparator)?Ur(r.comparator)?"=":"l":Ur(r.comparator)?"r":"=":e==="min"?t.limit>r.limit?"l":"r":t.limit<r.limit?"l":"r":"l":r?"r":"=",Ur=e=>e.length===1;var us={},cs=e=>(us[e]||(us[e]=new RegExp(e)),us[e]),Uu=(e,t)=>cs(e).test(t.data)||!t.problems.add("regex",`/${e}/`),zu=qe(lo);var Ku=(e,t,r)=>"value"in e?"value"in t?e.value===t.value?ye():r.addDisjoint("value",e.value,t.value):Wu(e.value,t,r)?e:r.addDisjoint("leftAssignability",e,t):"value"in t?Wu(t.value,e,r)?t:r.addDisjoint("rightAssignability",e,t):_y(e,t,r),Dy=qe(lo),_y=sr({divisor:$u,regex:zu,props:ku,class:Ru,range:ju,narrow:Dy},{onEmpty:"bubble"}),ls=(e,t)=>{let r=[],n;for(n in e)Ty[n](r,e[n],t);return r.sort((o,i)=>zr[o[0]]-zr[i[0]])},Ty={regex:(e,t)=>{for(let r of et(t))e.push(["regex",r])},divisor:(e,t)=>{e.push(["divisor",t])},range:Lu,class:(e,t)=>{e.push(["class",t])},props:Mu,narrow:(e,t)=>{for(let r of et(t))e.push(["narrow",r])},value:(e,t)=>{e.push(["value",t])}},zr={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},Wu=(e,t,r)=>!r.type.scope.type(["node",{[r.domain]:t}])(e).problems;var fs=e=>e?.lBranches!==void 0,Hu=(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,u=o.map((m,l)=>{if(a||!m.distinct)return null;let d=m.condition,f=Kr(i,d,r);return Ye(f)?null:f===i?(n.lExtendsR.push(s),a=!0,null):f===d?(n.rExtendsL.push(l),m.distinct=null,null):je(f)?(n.equalities.push([s,l]),a=!0,m.distinct=null,null):xt(f,"object")?f:te(`Unexpected predicate intersection result of type \'${le(f)}\'`)});if(!a)for(let m=0;m<o.length;m++)u[m]&&o[m].distinct?.push(u[m])}),n.distinctIntersections=o.flatMap(i=>i.distinct??[]),n},ps=e=>"rules"in e,Wr=(e,t)=>{if(ps(e)){let r=ls(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 ls(e,t)},Gu=e=>e.rules??e,Kr=(e,t,r)=>{let n=Gu(e),o=Gu(t),i=Ku(n,o,r);return"morph"in e?"morph"in t?e.morph===t.morph?je(i)||Ye(i)?i:{rules:i,morph:e.morph}:r.lastOperator==="&"?Q(uo(r.path,"Intersection","of morphs")):{}:Ye(i)?i:{rules:je(i)?e.rules:i,morph:e.morph}:"morph"in t?Ye(i)?i:{rules:je(i)?t.rules:i,morph:t.morph}:i};var Ju=e=>`${e==="/"?"A":`At ${e}, a`} union including one or more morphs must be discriminatable`;var Yu=(e,t)=>{let r=Cy(e,t),n=e.map((o,i)=>i);return Zu(e,n,r,t)},Zu=(e,t,r,n)=>{if(t.length===1)return Wr(e[t[0]],n);let o=Ry(t,r);if(!o)return[["branches",t.map(s=>ds(e[s],n.type.scope)?Q(Ju(`${n.path}`)):Wr(e[s],n))]];let i={};for(let s in o.indexCases){let a=o.indexCases[s];i[s]=Zu(e,a,r,n),s!=="default"&&Gr(i[s],o.path,o,n)}return[["switch",{path:o.path,kind:o.kind,cases:i}]]},Gr=(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 ms(r);e.splice(o,1);return}Gr(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(xu(s)!==1||!s.object)return ms(r);Gr(s.object,t,r,n);return}else if(i==="switch"){for(let a in s.cases)Gr(s.cases[a],t,r,n);return}else if(i==="branches"){for(let a of s)Gr(a,t,r,n);return}}return ms(r)},ms=e=>te(`Unexpectedly failed to discriminate ${e.kind} at path \'${e.path}\'`),Ny={domain:!0,class:!0,value:!0},Cy=(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 Et(t.type,"|");Kr(e[n],e[o],a);for(let u in a.disjoints){if(u.includes(rt.index))continue;let{l:m,r:l,kind:d}=a.disjoints[u];if(!Me(d,Ny))continue;let f=Vu(d,m),g=Vu(d,l);if(f===void 0||g===void 0)continue;let w=u==="/"?d:`${u}/${d}`;if(s.push(w),!r.casesByDisjoint[w]){r.casesByDisjoint[w]={[f]:[n],[g]:[o]};continue}let x=r.casesByDisjoint[w],S=x[f];S?S.includes(n)||S.push(n):x[f]=[n];let N=x[g];N?N.includes(o)||N.push(o):x[g]=[o]}}return r},Ay=e=>{let t=ge.fromString(e);return[t,t.pop()]},Ry=(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 u of a){let m=t.casesByDisjoint[u],l={},d=[...e],f=0;for(let w in m){let x=m[w].filter(S=>{let N=e.indexOf(S);if(N!==-1)return delete d[N],!0});x.length!==0&&(l[w]=x,f++)}let g=re(d);if(g.length&&(l.default=g.map(w=>parseInt(w))),!r||f>r.score){let[w,x]=Ay(u);if(r={path:w,kind:x,indexCases:l,score:f},f===e.length)return r}}}}return r},Vu=(e,t)=>{switch(e){case"value":return Qu(t);case"domain":return t;case"class":return co(t);default:return}},Qu=e=>{let t=le(e);return t==="object"||t==="symbol"?void 0:ns(e)},Fy={value:e=>Qu(e)??"default",class:e=>ar(e)??"default",domain:le},Xu=(e,t)=>Fy[e](t),ds=(e,t)=>"morph"in e?!0:"props"in e?Object.values(e.props).some(r=>$y(St(r),t)):!1,$y=(e,t)=>typeof e=="string"?t.resolve(e).includesMorph:Object.values(t.resolveTypeNode(e)).some(r=>r===!0?!1:It(r)?r.some(n=>ds(n,t)):ds(r,t));var cr=e=>e===!0?{}:e,ec=(e,t,r)=>{if(e===!0&&t===!0)return ye();if(!It(e)&&!It(t)){let s=Kr(cr(e),cr(t),r);return s===e?e:s===t?t:s}let n=et(cr(e)),o=et(cr(t)),i=Hu(n,o,r);return i.equalities.length===n.length&&i.equalities.length===o.length?ye():i.lExtendsR.length+i.equalities.length===n.length?e:i.rExtendsL.length+i.equalities.length===o.length?t:i},tc=(e,t,r,n)=>{n.domain=e;let o=ec(t,r,n);if(!fs(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},rc=(e,t,r,n)=>{let o=new Et(n,"|"),i=ec(t,r,o);if(!fs(i))return je(i)||i===t?r:i===r?t:e==="boolean"?!0:[cr(t),cr(r)];let s=[...i.lBranches.filter((a,u)=>!i.lExtendsR.includes(u)&&!i.equalities.some(m=>m[0]===u)),...i.rBranches.filter((a,u)=>!i.rExtendsL.includes(u)&&!i.equalities.some(m=>m[1]===u))];return s.length===1?s[0]:s},hs=(e,t)=>e===!0?[]:It(e)?Yu(e,t):Wr(e,t),nc=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=Py(n,o,r);return typeof i=="object"&&!Pr(i)?Pr(r.disjoints)?Nu():r.addDisjoint("domain",re(n),re(o)):i===n?e:i===o?t:i},Py=sr((e,t,r,n)=>{if(t===void 0)return r===void 0?te(so):void 0;if(r!==void 0)return tc(e,t,r,n)},{onEmpty:"omit"}),Ot=(e,t,r)=>{let n=new Et(r,"&"),o=po(e,t,n);return Ye(o)?Q(Au(n.disjoints)):je(o)?e:o},yo=(e,t,r)=>{let n=r.scope.resolveTypeNode(e),o=r.scope.resolveTypeNode(t),i={},s=re({...n,...o});for(let a of s)i[a]=ir(n,a)?ir(o,a)?rc(a,n[a],o[a],r):n[a]:ir(o,a)?o[a]:te(so);return i},ky=e=>e[0]&&(e[0][0]==="value"||e[0][0]==="class"),gs=e=>{let t={type:e,path:new ge,lastDomain:"undefined"};return tt(e.node,t)},tt=(e,t)=>{if(typeof e=="string")return t.type.scope.resolve(e).flat;let r=Hr(e),n=My(r?e.node:e,t);return r?[["config",{config:wu(e.config),node:n}]]:n},My=(e,t)=>{let r=re(e);if(r.length===1){let o=r[0],i=e[o];if(i===!0)return o;t.lastDomain=o;let s=hs(i,t);return ky(s)?s:[["domain",o],...s]}let n={};for(let o of r)t.lastDomain=o,n[o]=hs(e[o],t);return[["domains",n]]},mo=(e,t)=>qy(e,t)&&nc(e[t]),qy=(e,t)=>{let r=re(e);return r.length===1&&r[0]===t},lr=e=>({object:{class:Array,props:{[rt.index]:e}}});function ys(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var se=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]===se.escapeToken)r=r.slice(0,-1);else break;r+=this.shift()}return r}shiftUntilNextTerminator(){return this.shiftUntil(se.lookaheadIsNotWhitespace),this.shiftUntil(se.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){ys(this,"chars",void 0),ys(this,"i",void 0),ys(this,"finalized",!1),this.chars=[...t],this.i=0}};(function(e){var t=e.lookaheadIsTerminator=f=>f.lookahead in o,r=e.lookaheadIsNotWhitespace=f=>f.lookahead!==d,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"},u=e.invertedComparators={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},m=e.branchTokens={"|":!0,"&":!0},l=e.escapeToken="\\\\",d=e.whiteSpaceToken=" "})(se||(se={}));function jy(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Ly(e,t){return t.get?t.get.call(e):t.value}function By(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 oc(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=oc(e,t,"get");return Ly(e,r)}function Uy(e,t,r){jy(e,t),t.set(e,r)}function zy(e,t,r){var n=oc(e,t,"set");return By(e,n,r),r}function pt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var vs=class extends TypeError{constructor(t){super(`${t}`),pt(this,"cause",void 0),this.cause=t}},qt=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){pt(this,"code",void 0),pt(this,"path",void 0),pt(this,"data",void 0),pt(this,"source",void 0),pt(this,"writers",void 0),pt(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)}},fr=new WeakMap,ws=class extends Array{mustBe(t,r){return this.add("custom",t,r)}add(t,r,n){let o=ge.from(n?.path??bo(this,fr).path),i=n&&"data"in n?n.data:bo(this,fr).data,s=new qt(t,o,i,r,bo(this,fr).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 qt("multi",n.path,n.data,[n,t],bo(this,fr).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 vs(this)}constructor(t){super(),pt(this,"byPath",{}),pt(this,"count",0),Uy(this,fr,{writable:!0,value:void 0}),zy(this,fr,t)}},vo=ws,Wy=e=>e[0].toUpperCase()+e.slice(1),xs=e=>e.map(t=>Xi[t]),ic=e=>e.map(t=>is[t]),bs=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},kt=(e,t)=>`must be ${e}${t&&` (was ${t})`}`,sc=(e,t)=>t.length===0?Wy(e):t.length===1&&kr(t[0])?`Item at index ${t[0]} ${e}`:`${t} ${e}`,Mt={divisor:{mustBe:e=>e===1?"an integer":`a multiple of ${e}`},class:{mustBe:e=>{let t=co(e);return t?is[t]:`an instance of ${e.name}`},writeReason:(e,t)=>kt(e,t.className)},domain:{mustBe:e=>Xi[e],writeReason:(e,t)=>kt(e,t.domain)},missing:{mustBe:()=>"defined",writeReason:e=>kt(e,"")},extraneous:{mustBe:()=>"removed",writeReason:e=>kt(e,"")},bound:{mustBe:e=>`${se.comparatorDescriptions[e.comparator]} ${e.limit}${e.units?` ${e.units}`:""}`,writeReason:(e,t)=>kt(e,`${t.size}`)},regex:{mustBe:e=>`a string matching ${e}`},value:{mustBe:ie},branches:{mustBe:e=>bs(e.map(t=>`${t.path} must be ${t.parts?bs(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=>bs(e)}},ac=re(Mt),Ky=()=>{let e={},t;for(t of ac)e[t]={mustBe:Mt[t].mustBe,writeReason:Mt[t].writeReason??kt,addContext:Mt[t].addContext??sc};return e},Gy=Ky(),uc=e=>{if(!e)return Gy;let t={};for(let r of ac)t[r]={mustBe:e[r]?.mustBe??Mt[r].mustBe,writeReason:e[r]?.writeReason??Mt[r].writeReason??e.writeReason??kt,addContext:e[r]?.addContext??Mt[r].addContext??e.addContext??sc};return t};function Hy(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Jy(e,t){return t.get?t.get.call(e):t.value}function Vy(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 fc(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function Es(e,t){var r=fc(e,t,"get");return Jy(e,r)}function Yy(e,t,r){Hy(e,t),t.set(e,r)}function Zy(e,t,r){var n=fc(e,t,"set");return Vy(e,n,r),r}function nt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Qy=()=>({mustBe:[],writeReason:[],addContext:[],keys:[]}),Xy=["mustBe","writeReason","addContext"],pc=(e,t)=>{let r=new Is(t,e);wo(e.flat,r);let n=new mc(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},mc=class{constructor(){nt(this,"data",void 0),nt(this,"problems",void 0)}},Jr=new WeakMap,Is=class{getProblemConfig(t){let r={};for(let n of Xy)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=xt(o,"object");if(i){let u=Es(this,Jr)[n];if(u){if(u.includes(o))return!0;u.push(o)}else Es(this,Jr)[n]=[o]}let s=this.type;this.type=r;let a=wo(r.flat,this);return this.type=s,i&&Es(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 u of t)if(this.path=new ge,this.entriesToPrune=[],xo(u,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){nt(this,"data",void 0),nt(this,"type",void 0),nt(this,"path",void 0),nt(this,"problems",void 0),nt(this,"entriesToPrune",void 0),nt(this,"failFast",void 0),nt(this,"traversalConfig",void 0),nt(this,"rootScope",void 0),Yy(this,Jr,{writable:!0,value:void 0}),this.data=t,this.type=r,this.path=new ge,this.problems=new vo(this),this.entriesToPrune=[],this.failFast=!1,this.traversalConfig=Qy(),Zy(this,Jr,{}),this.rootScope=r.scope}},wo=(e,t)=>typeof e=="string"?le(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=eb[o](i,t);if(r&&(r=s),!r&&(t.failFast||n<e.length-1&&zr[o]<zr[e[n+1][0]]))return!1}return r},cc=(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),lc=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},eb={regex:Uu,divisor:Pu,domains:(e,t)=>{let r=e[le(t.data)];return r?xo(r,t):!t.problems.add("cases",xs(re(e)))},domain:(e,t)=>le(t.data)===e||!t.problems.add("domain",e),bound:Bu,optionalProp:(e,t)=>e[0]in t.data?t.traverseKey(e[0],e[1]):!0,requiredProp:cc,prerequisiteProp:cc,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=Eu(t.data,e.path),n=Xu(e.kind,r);if(ir(e.cases,n))return xo(e.cases[n],t);let o=re(e.cases),i=t.path.concat(e.path),s=e.kind==="value"?o:e.kind==="domain"?xs(o):e.kind==="class"?ic(o):te(`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:Fu,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 qt)return t.problems.addProblem(r),!1;if(r instanceof mc){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:lc("distilledProps"),strictProps:lc("strictProps")};var Dt=new Proxy(()=>Dt,{get:()=>Dt});var Ss=(e,t,r,n)=>{let o={node:e,flat:[["alias",e]],allows:a=>!i(a).problems,assert:a=>{let u=i(a);return u.problems?u.problems.throw():u.data},infer:Dt,inferIn:Dt,qualifiedName:tb(e)?n.getAnonymousQualifiedName(e):`${n.name}.${e}`,definition:t,scope:n,includesMorph:!1,config:r},i={[e]:a=>pc(i,a)}[e];return Object.assign(i,o)},Os=e=>e?.infer===Dt,tb=e=>e[0]==="\\u03BB";var dc=e=>{let t=e.scanner.shiftUntilNextTerminator();e.setRoot(rb(e,t))},rb=(e,t)=>e.ctx.type.scope.addParsedReferenceIfResolvable(t,e.ctx)?t:nb(t)??e.error(t===""?Ds(e):ob(t)),nb=e=>{let t=qr(e);if(t!==void 0)return{number:{value:t}};let r=ts(e);if(r!==void 0)return{bigint:{value:r}}},ob=e=>`\'${e}\' is unresolvable`,Ds=e=>{let t=e.previousOperator();return t?_s(t,e.scanner.unscanned):ib(e.scanner.unscanned)},_s=(e,t)=>`Token \'${e}\' requires a right operand${t?` before \'${t}\'`:""}`,ib=e=>`Expected an expression${e?` before \'${e}\'`:""}`;var Ts=(e,t)=>({node:t.type.scope.resolveTypeNode(be(e[0],t)),config:e[2]});var Le=e=>Object.isFrozen(e)?e:Array.isArray(e)?Object.freeze(e.map(Le)):sb(e),sb=e=>{for(let t in e)Le(e[t]);return e};var ab=Le({regex:Mr.source}),ub=Le({range:{min:{comparator:">=",limit:0}},divisor:1}),hc=(e,t)=>{let r=t.type.scope.resolveNode(be(e[1],t)),n=re(r).map(l=>lb(l,r[l])),o=gc(n);if(!o.length)return uo(t.path,"keyof");let i={};for(let l of o){let d=typeof l;if(d==="string"||d==="number"||d==="symbol"){var s,a;(s=i)[a=d]??(s[a]=[]),i[d].push({value:l})}else if(l===Mr){var u,m;(u=i).string??(u.string=[]),i.string.push(ab),(m=i).number??(m.number=[]),i.number.push(ub)}else return te(`Unexpected keyof key \'${ie(l)}\'`)}return Object.fromEntries(Object.entries(i).map(([l,d])=>[l,d.length===1?d[0]:d]))},cb={bigint:Pt(0n),boolean:Pt(!1),null:[],number:Pt(0),object:[],string:Pt(""),symbol:Pt(Symbol()),undefined:[]},lb=(e,t)=>e!=="object"||t===!0?cb[e]:gc(et(t).map(r=>fb(r))),gc=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},fb=e=>{let t=[];if("props"in e)for(let r of Object.keys(e.props))r===rt.index?t.push(Mr):t.includes(r)||(t.push(r),Mr.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"?jr[e.class]:e.class;for(let n of Pt(r.prototype))t.includes(n)||t.push(n)}return t};var bc=(e,t)=>{if(typeof e[2]!="function")return Q(pb(e[2]));let r=be(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]=It(a)?a.map(u=>yc(u,o)):yc(a,o):te(`Unexpected predicate value for domain \'${i}\': ${ie(a)}`)}return s},yc=(e,t)=>ps(e)?{...e,morph:e.morph?Array.isArray(e.morph)?[...e.morph,t]:[e.morph,t]:t}:{rules:e,morph:t},pb=e=>`Morph expression requires a function following \'|>\' (was ${typeof e})`;var vc=e=>`Expected a Function or Record<Domain, Function> operand (${ie(e)} was invalid)`,wc=(e,t,r,n)=>{let o=re(t);if(!xt(e,"object"))return Q(vc(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 Q(vc(a));i[s]=a}return i};var xc=(e,t)=>{let r=be(e[0],t),n=t.type.scope.resolveNode(r),o=Hr(n),i=o?n.node:n,s=Ot(r,wc(e[2],i,t,"narrow"),t.type);return o?{config:n.config,node:s}:s};var Ic=(e,t)=>{if(db(e))return Sc[e[1]](e,t);if(hb(e))return Oc[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]=be(e[n],t),t.path.pop();return{object:{class:Array,props:r}}},Ec=(e,t)=>{if(e[2]===void 0)return Q(_s(e[1],""));let r=be(e[0],t),n=be(e[2],t);return e[1]==="&"?Ot(r,n,t.type):yo(r,n,t.type)},mb=(e,t)=>lr(be(e[0],t));var db=e=>Sc[e[1]]!==void 0,Sc={"|":Ec,"&":Ec,"[]":mb,"=>":xc,"|>":bc,":":Ts},Oc={keyof:hc,instanceof:e=>typeof e[1]!="function"?Q(`Expected a constructor following \'instanceof\' operator (was ${typeof e[1]}).`):{object:{class:e[1]}},"===":e=>({[le(e[1])]:{value:e[1]}}),node:e=>e[1]},hb=e=>Oc[e[0]]!==void 0;var Dc=(e,t)=>{let r={};for(let n in e){let o=n,i=!1;n[n.length-1]==="?"&&(n[n.length-2]===se.escapeToken?o=`${n.slice(0,-2)}?`:(o=n.slice(0,-1),i=!0)),t.path.push(o);let s=be(e[n],t);t.path.pop(),r[o]=i?["?",s]:s}return{object:{props:r}}};var _c=e=>`Unmatched )${e===""?"":` before ${e}`}`,Tc="Missing )",Nc=(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})`,Cc=(e,t,r,n)=>`An expression may have at most one left bound (parsed ${e}${se.invertedComparators[t]}, ${r}${se.invertedComparators[n]})`;function Vr(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 Q(t)}hasRoot(){return this.root!==void 0}resolveRoot(){return this.assertHasRoot(),this.ctx.type.scope.resolveTypeNode(this.root)}rootToString(){return this.assertHasRoot(),ie(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 te("Unexpected interaction with unset root")}assertUnsetRoot(){if(this.root!==void 0)return te("Unexpected attempt to overwrite root")}setRoot(t){this.assertUnsetRoot(),this.root=t}rootToArray(){this.root=lr(this.ejectRoot())}intersect(t){this.root=Ot(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=gb,t}finalize(){if(this.groups.length)return this.error(Tc);this.finalizeBranches(),this.scanner.finalized=!0}reduceLeftBound(t,r){let n=se.invertedComparators[r];if(!Me(n,go))return this.error(Eo(r));if(this.branches.range)return this.error(Cc(`${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(Ot(this.branches.intersection,this.ejectRoot(),this.ctx.type))}finalizeGroup(){this.finalizeBranches();let t=this.groups.pop();if(!t)return this.error(_c(this.scanner.unscanned));this.branches=t}pushRootToBranch(t){this.assertRangeUnset(),this.branches.intersection=this.branches.intersection?Ot(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(Nc(`${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){Vr(this,"ctx",void 0),Vr(this,"scanner",void 0),Vr(this,"root",void 0),Vr(this,"branches",void 0),Vr(this,"groups",void 0),this.ctx=r,this.branches={},this.groups=[],this.scanner=new se(t)}},gb=new Proxy({},{get:()=>te("Unexpected attempt to access ejected attributes")});var Ac=(e,t)=>{let r=e.scanner.shiftUntil(yb[t]);if(e.scanner.lookahead==="")return e.error(vb(r,t));e.scanner.shift()==="/"?(cs(r),e.setRoot({string:{regex:r}})):e.setRoot({string:{value:r}})},Rc={"\'":1,\'"\':1,"/":1},yb={"\'":e=>e.lookahead==="\'",\'"\':e=>e.lookahead===\'"\',"/":e=>e.lookahead==="/"},bb={\'"\':"double-quote","\'":"single-quote","/":"forward slash"},vb=(e,t)=>`${t}${e} requires a closing ${bb[t]}`;var So=e=>e.scanner.lookahead===""?e.error(Ds(e)):e.scanner.lookahead==="("?e.shiftedByOne().reduceGroupOpen():e.scanner.lookaheadIsIn(Rc)?Ac(e,e.scanner.shift()):e.scanner.lookahead===" "?So(e.shiftedByOne()):dc(e);var Fc=e=>`Bounded expression ${e} must be a number, string or array`;var $c=(e,t)=>{let r=wb(e,t),n=e.ejectRootIfLimit();return n===void 0?Eb(e,r):e.reduceLeftBound(n,r)},wb=(e,t)=>e.scanner.lookaheadIs("=")?`${t}${e.scanner.shift()}`:Me(t,se.oneCharComparators)?t:e.error(xb),xb="= is not a valid comparator. Use == to check for equality",Eb=(e,t)=>{let r=e.scanner.shiftUntilNextTerminator(),n=qr(r,Ob(t,r+e.scanner.unscanned)),o=e.ejectRangeIfOpen(),i={comparator:t,limit:n},s=o?Ns(i,as)?ur("min",o,i)==="l"?e.error(Db({min:o,max:i})):{min:o,max:i}:e.error(Eo(t)):Sb(i,"==")?i:Ns(i,go)?{min:i}:Ns(i,as)?{max:i}:te(`Unexpected comparator \'${i.comparator}\'`);e.intersect(Ib(s,e))},Ib=(e,t)=>{let r=t.resolveRoot(),n=re(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:et(r.object).every(u=>"class"in u&&u.class===Array);default:return!1}})||t.error(Fc(t.rootToString())),o},Sb=(e,t)=>e.comparator===t,Ns=(e,t)=>e.comparator in t,Ob=(e,t)=>`Comparator ${e} must be followed by a number literal (was \'${t}\')`,Db=e=>`${io(e)} is empty`;var Pc=e=>`Divisibility operand ${e} must be a number`;var Mc=e=>{let t=e.scanner.shiftUntilNextTerminator(),r=to(t,kc(t));r===0&&e.error(kc(0));let n=re(e.resolveRoot());n.length===1&&n[0]==="number"?e.intersect({number:{divisor:r}}):e.error(Pc(e.rootToString()))},kc=e=>`% operator must be followed by a non-zero integer literal (was ${e})`;var Cs=e=>{let t=e.scanner.shift();return t===""?e.finalize():t==="["?e.scanner.shift()==="]"?e.rootToArray():e.error(Tb):Me(t,se.branchTokens)?e.pushRootToBranch(t):t===")"?e.finalizeGroup():Me(t,se.comparatorStartChars)?$c(e,t):t==="%"?Mc(e):t===" "?Cs(e):te(_b(t))},_b=e=>`Unexpected character \'${e}\'`,Tb="Missing expected \']\'";var qc=(e,t)=>t.type.scope.parseCache.get(e)??t.type.scope.parseCache.set(e,Nb(e,t)??Cb(e,t)),Nb=(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 lr(r)}},Cb=(e,t)=>{let r=new Io(e,t);return So(r),Ab(r)},Ab=e=>{for(;!e.scanner.finalized;)Rb(e);return e.ejectFinalizedRoot()},Rb=e=>e.hasRoot()?Cs(e):So(e);var be=(e,t)=>{let r=le(e);if(r==="string")return qc(e,t);if(r!=="object")return Q(As(r));let n=ar(e);switch(n){case"Object":return Dc(e,t);case"Array":return Ic(e,t);case"RegExp":return{string:{regex:e.source}};case"Function":if(Os(e))return t.type.scope.addAnonymousTypeReference(e,t);if(Fb(e)){let o=e();if(Os(o))return t.type.scope.addAnonymousTypeReference(o,t)}return Q(As("Function"));default:return Q(As(n??ie(e)))}},j_=Symbol("as"),Fb=e=>typeof e=="function"&&e.length===0,As=e=>`Type definitions must be strings or objects (was ${e})`;function $b(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var pr=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(){$b(this,"cache",{})}},Oo=class extends pr{set(t,r){return this.cache[t]=Le(r),r}};function zc(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Pb(e,t){return t.get?t.get.call(e):t.value}function kb(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 Wc(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function dt(e,t){var r=Wc(e,t,"get");return Pb(e,r)}function jc(e,t,r){zc(e,t),t.set(e,r)}function Lc(e,t,r){var n=Wc(e,t,"set");return kb(e,n,r),r}function mt(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}function Do(e,t){zc(e,t),t.add(e)}function Ne(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Mb=e=>({codes:uc(e.codes),keys:e.keys??"loose"}),qb=0,Bc={},Rs={};var jt=new WeakMap,mr=new WeakMap,Uc=new WeakSet,_o=new WeakSet,$s=new WeakSet,To=new WeakSet,Ps=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 Dt}compile(){if(!Rs[this.name]){for(let t in this.aliases)this.resolve(t);Rs[this.name]=dt(this,mr).root}return dt(this,mr).root}addParsedReferenceIfResolvable(t,r){var n;let o=mt(this,To,ks).call(this,t,"undefined",[t]);return o?((n=r.type).includesMorph||(n.includesMorph=o.includesMorph),!0):!1}resolve(t){return mt(this,To,ks).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 dt(this,jt).has(t)||this.aliases[t]}constructor(t,r={}){Do(this,Uc),Do(this,_o),Do(this,$s),Do(this,To),Ne(this,"aliases",void 0),Ne(this,"name",void 0),Ne(this,"config",void 0),Ne(this,"parseCache",void 0),jc(this,jt,{writable:!0,value:void 0}),jc(this,mr,{writable:!0,value:void 0}),Ne(this,"expressions",void 0),Ne(this,"intersection",void 0),Ne(this,"union",void 0),Ne(this,"arrayOf",void 0),Ne(this,"keyOf",void 0),Ne(this,"valueOf",void 0),Ne(this,"instanceOf",void 0),Ne(this,"narrow",void 0),Ne(this,"morph",void 0),Ne(this,"type",void 0),this.aliases=t,this.parseCache=new Oo,Lc(this,jt,new pr),Lc(this,mr,new pr),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=Ss("\\u03BBtype",n,o,this),s=mt(this,$s,Kc).call(this,i),a=be(n,s);return i.node=Le(Pr(o)?{config:o,node:this.resolveTypeNode(a)}:a),i.flat=Le(gs(i)),i},{from:this.expressions.node}),this.name=mt(this,Uc,jb).call(this,r),r.standard!==!1&&mt(this,_o,Fs).call(this,[Rs.standard],"imports"),r.imports&&mt(this,_o,Fs).call(this,r.imports,"imports"),r.includes&&mt(this,_o,Fs).call(this,r.includes,"includes"),this.config=Mb(r)}};function jb(e){let t=e.name?Bc[e.name]?Q(`A scope named \'${e.name}\' already exists`):e.name:`scope${++qb}`;return Bc[t]=this,t}function Fs(e,t){for(let r of e)for(let n in r)(dt(this,jt).has(n)||n in this.aliases)&&Q(Bb(n)),dt(this,jt).set(n,r[n]),t==="includes"&&dt(this,mr).set(n,r[n])}function Kc(e){return{type:e,path:new ge}}function ks(e,t,r){let n=dt(this,jt).get(e);if(n)return n;let o=this.aliases[e];if(!o)return t==="throw"?te(`Unexpectedly failed to resolve alias \'${e}\'`):void 0;let i=Ss(e,o,{},this),s=mt(this,$s,Kc).call(this,i);dt(this,jt).set(e,i),dt(this,mr).set(e,i);let a=be(o,s);if(typeof a=="string"){if(r.includes(a))return Q(Lb(e,r));r.push(a),a=mt(this,To,ks).call(this,a,"throw",r).node}return i.node=Le(a),i.flat=Le(gs(i)),i}var Be=(e,t={})=>new Ps(e,t),Ms=Be({},{name:"root",standard:!1}),Ze=Ms.type,Lb=(e,t)=>`Alias \'${e}\' has a shallow resolution cycle: ${[...t,e].join("=>")}`,Bb=e=>`Alias \'${e}\' is already defined`;var No=Be({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}),Gc=No.compile();var Hc={bigint:!0,boolean:!0,null:!0,number:!0,object:!0,string:!0,symbol:!0,undefined:!0},Co=Be({any:["node",Hc],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",Hc],void:["node",{undefined:!0}],undefined:["node",{undefined:!0}]},{name:"ts",standard:!1}),Lt=Co.compile();var Ub=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)},zb=/^(?: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}))$/,Jc=Ze([zb,"=>",(e,t)=>Ub(e)||!t.mustBe("a valid credit card number")],{mustBe:"a valid credit card number"});var Wb=/^[./-]$/,Kb=/^([+-]?\\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)?)?)?)?$/,Gb=e=>!isNaN(e),Ao=e=>`a ${e}-formatted date`,Hb=(e,t)=>{if(!t?.format){let a=new Date(e);return Gb(a)?a:"a valid date"}if(t.format==="iso8601")return Kb.test(e)?new Date(e):Ao("iso8601");let r=e.split(Wb),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)},Vc=Ze([Lt.string,"|>",(e,t)=>{let r=Hb(e);return typeof r=="string"?t.mustBe(r):r}]);var Jb=Ze([es,"|>",e=>parseFloat(e)],{mustBe:"a well-formed numeric string"}),Vb=Ze([Lt.string,"|>",(e,t)=>{if(!kr(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")}]),Yb=Ze(/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$/,{mustBe:"a valid email"}),Zb=Ze(/^[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"}),Qb=Ze(/^(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/)"}),Xb=Ze([Lt.string,"|>",e=>JSON.parse(e)],{mustBe:"a JSON-parsable string"}),Ro=Be({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:Jc,email:Yb,uuid:Zb,parsedNumber:Jb,parsedInteger:Vb,parsedDate:Vc,semver:Qb,json:Xb,integer:["node",{number:{divisor:1}}]},{name:"validation",standard:!1}),Yc=Ro.compile();var Fo=Be({},{name:"standard",includes:[Lt,Gc,Yc],standard:!1}),ev=Fo.compile(),ht={root:Ms,tsKeywords:Co,jsObjects:No,validation:Ro,ark:Fo};var tv=Fo.type;var rv=ht.ark.intersection,nv=ht.ark.union,ov=ht.ark.arrayOf,iv=ht.ark.keyOf,sv=ht.ark.instanceOf,av=ht.ark.valueOf,uv=ht.ark.narrow,cv=ht.ark.morph;var{DataRequest:Zc,DataResponse:R1}=Be({DataRequest:{id:"number",method:"string",params:"any[]"},DataResponse:{id:"number","eventName?":"string",payload:"any",error:"any"}}).compile(),Qc="__METHODS__",Xc="__EVAL__";var lv=typeof parent<"u"&&typeof window<"u"&&window!==parent?parent.postMessage:postMessage,Yr=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,[Qc]:()=>Object.keys(t),[Xc]:(r,...n)=>new Function(`return (${r})`)()(...n)},addEventListener("message",r=>this.onMessage(r.data)),this.send("ready")}send(t,r){lv(t,r)}async onMessage(t){let{data:r,problems:n}=Zc(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:fv(o)})}}emit(t,r){this.send({eventName:t,payload:r,id:-1,error:null})}};function fv(e){return Object.getOwnPropertyNames(e).reduce((t,r)=>Object.defineProperty(t,r,{value:e[r],enumerable:!0}),{})}var el=e=>`obsidian-zotero:${e}`;var Ls=({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("")},tl=(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)},Bs=(e=!0,t)=>tl(r=>r,r=>new RegExp(e?"^"+r+"$":r,t),!0),qs=String.raw`[23456789ABCDEFGHIJKLMNPQRSTUVWXYZ]{8}`,js=String.raw`\\d+`,rl=e=>{let t={annotKey:qs,parentKey:qs,groupID:js,page:js};if(e)for(let r in t)t[r]=`(${t[r]})`;return tl(r=>t[r],r=>r)`${"annotKey"}a${"parentKey"}(?:g${"groupID"})?(?:p${"page"})?`},k1=Bs()`${qs}(?:g${js})?`,M1=Bs()`${rl(!0)}`,q1=Bs()`(?:${rl(!1)}n?)+`;var mv=/^[0-9]{4}\\-(0[0-9]|10|11|12)\\-(0[0-9]|[1-2][0-9]|30|31) /;var dv=/^\\-?[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])$/,hv=/^\\-?[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])$/,gv=e=>yv(e)||bv(e)?!1:mv.test(e),nl=e=>e?gv(e)?e.substring(0,10):"0000-00-00":"";var yv=e=>dv.test(e),bv=e=>hv.test(e);var ol=(e,t,{getLogger:r,configure:n})=>{let o=el(e);return n({appenders:{out:{type:"console"}},categories:{default:{appenders:["out"],level:t},[o]:{appenders:["out"],level:t}}}),r(o)};var il=()=>(...e)=>e;function sl(e,t){let r=Object.keys(t).map(n=>vv(e,n,t[n]));return r.length===1?r[0]:function(){r.forEach(n=>n())}}function vv(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(...u){return i===n&&e[t]===s&&a(),i.apply(this,u)}function a(){e[t]===s&&(o?e[t]=n:delete e[t]),i!==n&&(i=n,Object.setPrototypeOf(s,n||Function))}}var al=e=>{let t=r=>async(...n)=>{try{return await r(...n)}catch(o){throw console.error(o),o}};return sl(e,Object.fromEntries(Object.keys(e).map(r=>[r,t]))),e};var ul;(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"})(ul||(ul={}));var cl;(function(e){e[e.manual=0]="manual",e[e.auto=1]="auto"})(cl||(cl={}));var ll;(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"})(ll||(ll={}));var Us;(function(e){e[e.fullName=0]="fullName",e[e.nameOnly=1]="nameOnly"})(Us||(Us={}));var zs=["attachment","note","annotation"];var $o=zs.map(e=>`\'${e}\'`).join(",");var ve=(e="itemID")=>`--sql\n ${e} IS NOT NULL\n ${e==="itemID"?`AND ${e} NOT IN (SELECT itemID FROM deletedItems)`:""}\n`,Ue=(e,t="$itemId")=>typeof e=="boolean"?"":`AND ${e} = ${t}`;var Z=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)}},dr=class extends Z{query(t){return this.all(t)}},Po=class extends Z{query(){return this.all([])}},hr=class extends Z{query(t){return this.all(t).map(r=>this.parse(r,t))}};var Ws=(e,t)=>{for(let r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]-t[r];return 0};var Ks=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:Ks(e.sortIndex),position:JSON.parse(e.position),libraryID:t,groupID:r,itemType:"annotation"});var wv=`--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 ${ve("items.itemID")}\n`,Zr=class extends Z{trxCache={};sql(){return wv}parse(t,r){return qo(t,r.libId,r.groupID)}query(t){let{annotKeys:r,libId:n}=t,o=s=>s.reduce((a,u)=>{let m=this.get({annotKey:u,libId:n});return m&&(a[u]=this.parse(m,t)),a},{});return(this.trxCache[n]??=this.database.transaction(o))(r)}};var xv=`--sql\nSELECT\n ${ko}\nFROM\n ${Mo}\nWHERE\n parentItemID = $attachmentId\n AND items.libraryID = $libId\n AND ${ve()}\n`,Qr=class extends hr{sql(){return xv}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)=>Ws(n.sortIndex,o.sortIndex))}};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 Ev=`--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 ${ve("items.itemID")}\n`,Xr=class extends Z{trxCache={};sql(){return Ev}parse(t,r){return Bo(t,r.libId,r.groupID)}query(t){let{noteKeys:r,libId:n}=t,o=s=>s.reduce((a,u)=>{let m=this.get({noteKey:u,libId:n});return m&&(a[u]=this.parse(m,t)),a},{});return(this.trxCache[n]??=this.database.transaction(o))(r)}};var Iv=`--sql\nSELECT\n ${jo}\nFROM\n ${Lo}\nWHERE\n parentItemID = $itemID\n AND items.libraryID = $libId\n AND ${ve()}\n`,en=class extends hr{sql(){return Iv}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))}};var Sv=`--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 ${ve("atchs.itemID")}\nGROUP BY atchs.itemID\n`,tn=class extends dr{sql(){return Sv}};var ot="betterbibtex",Bt="bbts";var Ov=`--sql\nSELECT\n citationkey as citekey\nFROM\n ${ot}.citationkey\nWHERE\n itemID = $itemID\n AND (libraryID IS NULL OR libraryID = $libId)\n`,Dv=`--sql\nSELECT\n citekey\nFROM\n ${Bt}.citekeys\nWHERE\n itemID = $itemID\n AND (libraryID IS NULL OR libraryID = $libId)\n`,rn=class extends Z{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 Ov}query(t){return this.trx(t.items)}},nn=class extends Z{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 Dv}query(t){return this.trx(t.items)}};var _v=`--sql\nSELECT\n itemID\nFROM\n ${ot}.citationkey\nWHERE\n citationkey = $citekey\n`,Tv=`--sql\nSELECT\n itemID\nFROM\n ${Bt}.citekeys\nWHERE\n citekey = $citekey\n`,on=class extends Z{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 _v}query(t){return this.trx(t.citekeys)}},sn=class extends Z{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 Tv}query(t){return this.trx(t.citekeys)}};var Uo=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 ${Ue(e||"itemID")}\n AND ${ve()}\nORDER BY\n itemID,\n orderIndex\n`;var KT=Uo(!0);function fl(e){for(var t={},r=e.length,n=0;n<r;++n){var o=e[n];t[o[0]]=o[1]}return t}var Ut=fl;var Nv=Uo(!1),an=class extends Z{trxFunc=t=>t.map(([r,n])=>[r,this.all({itemId:r,libId:n})]);trx=this.database.transaction(this.trxFunc);sql(){return Nv}query(t){return Ut(this.trx(t))}};var zo=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 ${Ue(e||"items.itemID")}\n AND itemTypesCombined.typeName NOT IN (${$o})\n AND ${ve()}\n`;var FN=zo(!0);var Cv=zo(!1),un=class extends Z{trxFunc=t=>t.map(([r,n])=>[r,this.all({itemId:r,libId:n})]);trx=this.database.transaction(this.trxFunc);sql(){return Cv}query(t){return Ut(this.trx(t))}};var cn=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"?Ue(!1):e==="id"?Ue("items.itemID"):Ue("items.key","$key")}\n AND ${ve()}\n AND itemType NOT IN (${$o})\nGROUP BY itemID\n`;var Av=cn("full"),ln=class extends Z{sql(){return Av}query(t){return this.all(t).map(({collectionIDs:n,...o})=>({...o,collectionIDs:JSON.parse(n)}))}};var Rv=cn("id"),Fv=cn("key"),fn=class extends Z{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 Rv}query(t){return this.trx(t)}},pn=class extends Z{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 Fv}query(t){return this.trx(t)}};var mn=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"?Ue(!1):e==="id"?Ue("collectionID","$collectionID"):Ue("key","$key")}\n AND ${ve("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 Gs({collectionID:e,collectionName:t,path:r,...n}){return{...n,id:e,name:t,path:JSON.parse(r)}}var ZN=mn("full");var $v=mn("id"),tC=mn("key"),dn=class extends Z{trxFunc=t=>t.reduce((r,[n,o])=>{let i=this.get({collectionID:n,libId:o});return i&&r.set(n,Gs(i)),r},new Map);trx=this.database.transaction(this.trxFunc);sql(){return $v}query(t){return this.trx(t)}};var Pv=`--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`,hn=class extends Po{sql(){return Pv}};var kv=`--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`,gn=class extends Z{trxFunc=t=>t.map(([r,n])=>[r,this.all({itemId:r,libId:n})]);trx=this.database.transaction(this.trxFunc);sql(){return kv}query(t){return Ut(this.trx(t))}};var Mv=new Set(il()("creators","itemID","itemType","key","libraryID","collections"));var Qh=$r(Js(),1);var $d=$r(Js(),1),xi=$r(Fd(),1),rI="INFO",Pd=ol("db-worker",rI,xi.default),Ma="log4js_loglevel";$d.default.getItem(Ma).then(e=>{typeof e=="string"&&e in xi.levels&&(Pd.level=e,console.debug(`Read from localforage: loglevel ${e}`))});var oe=Pd;var yh=require("fs"),bh=$r(hh(),1);var bt=class extends Error{constructor(){super("Database not set")}},gh=e=>{try{return(0,yh.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 bt;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 bt;this.instance.prepare(`ATTACH DATABASE $path AS ${r}`).run({path:t})}detachDatabase(t){if(!this.instance)throw new bt;this.instance.prepare(`DETACH DATABASE ${t}`).run()}isUpToDate(){if(!this.database)return null;let t=gh(this.database.file);return t===-1?null:this.database.mtime===t}opened=!1;open(t,r){try{this.database?.instance&&(oe.debug("Database opened before, closing: ",this.database.instance.name),this.close());let n=gh(t);return n===-1?(this.opened=!1,!1):(this.database={mtime:n,instance:AI(t,r),file:t,existStatements:{},prepared:new Map},oe.debug("Database opened: ",t),this.opened=!0,!0)}catch(n){throw oe.error("Failed to open database",t),n}}close(){this.opened=!1,this.instance?.close(),this.database=null}prepare(t){if(!this.database)throw new bt;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}};function AI(e,t){return new bh.default(`file:${e}?mode=ro&immutable=1`,{nativeBinding:t.nativeBinding,uriPath:!0,verbose:void 0})}function RI(e){return e.tableExists("citationkey",ot)}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(){if(this.#e?.zotero.opened!==!0)return{main:!1,bbtMain:!1,bbtSearch:null};let t=this.#e.zotero.databaseList;return t.some(o=>o.name===ot)?this.#e.bbtAfterMigration?{main:!0,bbtMain:!0,bbtSearch:null}:{main:!0,bbtMain:!0,bbtSearch:t.some(o=>o.name===Bt)}:{main:!0,bbtMain:!1,bbtSearch:null}}get bbtLoadStatus(){let t=this.loadStatus;return t.bbtMain?t.bbtSearch!==!1:!1}getItemIDsFromCitekey(t){if(!this.#e)throw new bt;let r=this.#e.bbtAfterMigration?on:sn;return this.#e.zotero.prepare(r).query({citekeys:t})}getCitekeys(t){if(!this.#e)throw new bt;let r=this.#e.bbtAfterMigration?rn: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=FI(t,n.zotero),s=n.zotero.prepare(hn).query().reduce((a,u)=>(a[u.libraryID]=u,a),{});return this.#e={...n,bbtAfterMigration:i.bbtSearch===null,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 FI(e,t){try{t.attachDatabase(`file:${e.bbtMain}?mode=ro&immutable=1`,ot)}catch(n){let{code:o}=n;return o==="SQLITE_CANTOPEN"?oe.debug(`Unable to open bbt main database, no database found at ${e.bbtMain}`):oe.debug(`Unable to open bbt main database, ${o} @ ${e.bbtMain}`),{bbtMain:!1,bbtSearch:null}}if(RI(t))return{bbtMain:!0,bbtSearch:null};try{t.attachDatabase(`file:${e.bbtSearch}?mode=ro&immutable=1`,ot)}catch(n){let{code:o}=n;return o==="SQLITE_CANTOPEN"?oe.debug(`Unable to open bbt search database, no database found at ${e.bbtSearch}`):oe.debug(`Unable to open bbt search database, ${o} @ ${e.bbtSearch}`),{bbtMain:!0,bbtSearch:!1}}return{bbtMain:!0,bbtSearch:!0}}var xh=$r(wh(),1);var $I=e=>typeof e[0][0]=="string";function Eh(e){return[...new Set(e)]}var zn=class{#e=Ci;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=$I(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,xh.assertNever)(t),null)}};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;function Tr(e,t){return typeof e<"u"?e:t}function za(e){let t=new Array(e);for(let r=0;r<e;r++)t[r]=H();return t}function Ih(e){return Object.keys(e)}function H(){return Object.create(null)}function Sh(e){return[].concat.apply([],e)}function Oh(e,t){return t.length-e.length}function rr(e){return e.constructor===Array}function fe(e){return typeof e=="string"}function Ve(e){return typeof e=="object"}function Kn(e){return typeof e=="function"}function _h(e,t,r,n){if(e&&(t&&(e=Wa(e,t)),this.matcher&&(e=Wa(e,this.matcher)),this.stemmer&&e.length>1&&(e=Wa(e,this.stemmer)),n&&e.length>1&&(e=PI(e)),r||r==="")){let o=e.split(r);return this.filter?kI(o,this.filter):o}return e}var Th=/[\\p{Z}\\p{S}\\p{P}\\p{C}]+/u;function Nh(e){let t=H();for(let r=0,n=e.length;r<n;r++)t[e[r]]=1;return t}function Ka(e,t){let r=Ih(e),n=r.length,o=[],i="",s=0;for(let a=0,u,m;a<n;a++)u=r[a],m=e[u],m?(o[s++]=Dh(t?"(?!\\\\b)"+u+"(\\\\b|_)":u),o[s++]=m):i+=(i?"|":"")+u;return i&&(o[s++]=Dh(t?"(?!\\\\b)("+i+")(\\\\b|_)":"("+i+")"),o[s]=""),o}function Wa(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 Dh(e){return new RegExp(e,"g")}function PI(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 kI(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 MI=!1,qI="",Ch={encode:Ga,rtl:MI,tokenize:qI};function Ga(e){return _h.call(this,(""+e).toLowerCase(),!1,Th,!1)}var Ah={},Rh={};function Ai(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 u=r[t].apply(r,n);r.async=!1,a(u)})});return i?(s.then(i),this):s}}function Ri(e,t,r,n){let o=e.length,i=[],s,a,u=0;n&&(n=[]);for(let m=o-1;m>=0;m--){let l=e[m],d=l.length,f=H(),g=!s;for(let w=0;w<d;w++){let x=l[w],S=x.length;if(S)for(let N=0,M,k;N<S;N++)if(k=x[N],s){if(s[k]){if(!m){if(r)r--;else if(i[u++]=k,u===t)return i}(m||n)&&(f[k]=1),g=!0}if(n&&(M=(a[k]||0)+1,a[k]=M,M<o)){let ee=n[M-2]||(n[M-2]=[]);ee[ee.length]=k}}else f[k]=1}if(n)s||(a=f);else if(!g)return[];s=f}if(n)for(let m=n.length-1,l,d;m>=0;m--){l=n[m],d=l.length;for(let f=0,g;f<d;f++)if(g=l[f],!s[g]){if(r)r--;else if(i[u++]=g,u===t)return i;s[g]=1}}return i}function Fh(e,t){let r=H(),n=H(),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,u;a<s.length;a++)u=s[a],r[u]&&(n[u]||(n[u]=1,o[o.length]=u))}return o}function Fi(e){this.limit=e!==!0&&e,this.cache=H(),this.queue=[]}var $i=Fi;function Pi(e,t,r){Ve(e)&&(e=e.query);let n=this.cache.get(e);return n||(n=this.search(e,t,r),this.cache.set(e,n)),n}Fi.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};Fi.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};Fi.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])};var Ph={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 Ha(e){if(fe(e))!1&&!Ph[e]&&console.warn("Preset not found: "+e),e=Ph[e];else{let t=e.preset;t&&(!1&&!t[t]&&console.warn("Preset not found: "+t),e=Object.assign({},t[t],e))}return e}function kh(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 Mh(e,t,r,n,o){let i,s;switch(o||(o=0)){case 0:if(i="reg",this.fastupdate){s=H();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 kh(e,t||this,r,i,n,o,s),!0}function qh(e,t){if(t)switch(fe(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 jh(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}kh(e,this,r,i,n,o,s)}}function Lh(e,t){if(t)switch(fe(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 _e(e,t){if(!(this instanceof _e))return new _e(e);let r,n,o;e?(!0&&(e=Ha(e)),r=e.charset,n=e.lang,fe(r)&&(r.indexOf(":")===-1&&(r+=":default"),r=Rh[r]),fe(n)&&(n=Ah[n])):e={};let i,s,a=e.context||{};this.encode=e.encode||r&&r.encode||Ga,this.register=t||H(),this.resolution=i=e.resolution||9,this.tokenize=o=r&&r.tokenize||e.tokenize||"strict",this.depth=o==="strict"&&a.depth,this.bidirectional=Tr(a.bidirectional,!0),this.optimize=s=Tr(e.optimize,!0),this.fastupdate=Tr(e.fastupdate,!0),this.minlength=e.minlength||1,this.boost=e.boost,this.map=s?za(i):H(),this.resolution_ctx=i=a.resolution||1,this.ctx=s?za(i):H(),this.rtl=r&&r.rtl||e.rtl,this.matcher=(o=e.matcher||n&&n.matcher)&&Ka(o,!1),this.stemmer=(o=e.stemmer||n&&n.stemmer)&&Ka(o,!0),this.filter=(o=e.filter||n&&n.filter)&&Nh(o),!0&&(this.cache=(o=e.cache)&&new $i(o))}var ji=_e;_e.prototype.append=function(e,t){return this.add(e,t,!0)};_e.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=H(),s=H(),a=this.depth,u=this.resolution;for(let m=0;m<o;m++){let l=t[this.rtl?o-1-m:m],d=l.length;if(l&&d>=this.minlength&&(a||!s[l])){let f=ki(u,o,m),g="";switch(this.tokenize){case"full":if(d>2){for(let w=0;w<d;w++)for(let x=d;x>w;x--)if(x-w>=this.minlength){let S=ki(u,o,m,d,w);g=l.substring(w,x),this.push_index(s,g,S,e,r)}break}case"reverse":if(d>1){for(let w=d-1;w>0;w--)if(g=l[w]+g,g.length>=this.minlength){let x=ki(u,o,m,d,w);this.push_index(s,g,x,e,r)}g=""}case"forward":if(d>1){for(let w=0;w<d;w++)g+=l[w],g.length>=this.minlength&&this.push_index(s,g,f,e,r);break}default:if(this.boost&&(f=Math.min(f/this.boost(t,l,m)|0,u-1)),this.push_index(s,l,f,e,r),a&&o>1&&m<o-1){let w=H(),x=this.resolution_ctx,S=l,N=Math.min(a+1,o-m);w[S]=1;for(let M=1;M<N;M++)if(l=t[this.rtl?o-1-m-M:m+M],l&&l.length>=this.minlength&&!w[l]){w[l]=1;let k=ki(x+(o/2>x?0:1),o,m,N-1,M-1),ee=this.bidirectional&&l>S;this.push_index(i,ee?S:l,k,e,r,ee?l:S)}}}}}this.fastupdate||(this.register[e]=1)}}return this};function ki(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}_e.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]=H()),e[i]=1,s=s[i]||(s[i]=H())):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}};_e.prototype.search=function(e,t,r){r||(!t&&Ve(e)?(r=e,e=r.query):Ve(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 d=H(),f=[];for(let g=0,w=0,x;g<o;g++)if(x=e[g],x&&x.length>=this.minlength&&!d[x]){if(!this.optimize&&!s&&!this.map[x])return n;f[w++]=x,d[x]=1}e=f,o=e.length}if(!o)return n;t||(t=100);let u=this.depth&&o>1&&i!==!1,m=0,l;u?(l=e[0],m=1):o>1&&e.sort(Oh);for(let d,f;m<o;m++){if(f=e[m],u?(d=this.add_result(n,s,t,a,o===2,f,l),(!s||d!==!1||!n.length)&&(l=f)):d=this.add_result(n,s,t,a,o===1,f),d)return d;if(s&&m===o-1){let g=n.length;if(g){if(g===1)return Uh(n[0],t,a)}else{if(u){u=0,m=-1;continue}return n}}}return Ri(n,t,a,s)};_e.prototype.add_result=function(e,t,r,n,o,i,s){let a=[],u=s?this.ctx:this.map;if(this.optimize||(u=Bh(u,i,s,this.bidirectional)),u){let m=0,l=Math.min(u.length,s?this.resolution_ctx:this.resolution);for(let d=0,f=0,g,w;d<l&&(g=u[d],!(g&&(this.optimize&&(g=Bh(g,i,s,this.bidirectional)),n&&g&&o&&(w=g.length,w<=n?(n-=w,g=null):(g=g.slice(n),n=0)),g&&(a[m++]=g,o&&(f+=g.length,f>=r)))));d++);if(m){if(o)return Uh(a,r,0);e[e.length]=a;return}}return!t&&a};function Uh(e,t,r){return e.length===1?e=e[0]:e=Sh(e),r||e.length>t?e.slice(r,r+t):e}function Bh(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}_e.prototype.contain=function(e){return!!this.register[e]};_e.prototype.update=function(e,t){return this.remove(e).add(e,t)};_e.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 Mi(this.map,e,this.resolution,this.optimize),this.depth&&Mi(this.ctx,e,this.resolution_ctx,this.optimize);t||delete this.register[e],!0&&this.cache&&this.cache.del(e)}return this};function Mi(e,t,r,n,o){let i=0;if(rr(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=Mi(a,t,r,n,o),!n&&!i&&delete e[s])}else for(let s in e)i=Mi(e[s],t,r,n,o),i||delete e[s];return i}!0&&(_e.prototype.searchCache=Pi);!0&&(_e.prototype.export=Mh,_e.prototype.import=qh);!0&&Ai(_e.prototype);function zh(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 ji(o);break;default:let a=e.id,u=t[n].apply(t,r);postMessage(n==="search"?{id:a,msg:u}:{id:a})}}var Wh=0;function Hn(e){if(!(this instanceof Hn))return new Hn(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=BI(r,n,e.worker),this.resolver=H(),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 Kh=Hn;Jn("add");Jn("append");Jn("search");Jn("update");Jn("remove");function Jn(e){Hn.prototype[e]=Hn.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[++Wh]=s,t.worker.postMessage({task:e,id:Wh,args:r})})});return o?(i.then(o),this):i}}function BI(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="+zh.toString()],{type:"text/javascript"}))):new Worker(fe(worker_path)?worker_path:"worker/worker.js",{type:"module"})}catch(e){}return worker}function Te(e){if(!(this instanceof Te))return new Te(e);let t=e.document||e.doc||e,r;this.tree=[],this.field=[],this.marker=[],this.register=H(),this.key=(r=t.key||t.id)&&Li(r,this.marker)||"id",this.fastupdate=Tr(e.fastupdate,!0),!0&&(this.storetree=(r=t.store)&&r!==!0&&[],this.store=r&&H()),!0&&(this.tag=(r=t.tag)&&Li(r,this.marker),this.tagindex=r&&H()),!0&&(this.cache=(r=e.cache)&&new $i(r),e.cache=!1),!0&&(this.worker=e.worker),!0&&(this.async=!1),this.index=UI.call(this,e,t)}var Hh=Te;function UI(e,t){let r=H(),n=t.index||t.field||t;fe(n)&&(n=[n]);for(let o=0,i,s;o<n.length;o++)i=n[o],fe(i)||(s=i,i=i.field),s=Ve(s)?Object.assign({},e,s):e,!0&&this.worker&&(r[i]=new Kh(s),r[i].worker||(this.worker=!1)),this.worker||(r[i]=new ji(s,this.register)),this.tree[o]=Li(i,this.marker),this.field[o]=i;if(!0&&this.storetree){let o=t.store;fe(o)&&(o=[o]);for(let i=0;i<o.length;i++)this.storetree[i]=Li(o[i],this.marker)}return r}function Li(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 Va(e,t){if(fe(t))e=e[t];else for(let r=0;e&&r<t.length;r++)e=e[t[r]];return e}function Ya(e,t,r,n,o){if(e=e[o],n===r.length-1)t[o]=e;else if(e)if(rr(e)){t=t[o]=new Array(e.length);for(let i=0;i<e.length;i++)Ya(e,t,r,n,i)}else t=t[o]||(t[o]=H()),o=r[++n],Ya(e,t,r,n,o)}function Za(e,t,r,n,o,i,s,a){if(e=e[s],e)if(n===t.length-1){if(rr(e)){if(r[n]){for(let u=0;u<e.length;u++)o.add(i,e[u],!0,!0);return}e=e.join(" ")}o.add(i,e,a,!0)}else if(rr(e))for(let u=0;u<e.length;u++)Za(e,t,r,n,o,i,u,a);else s=t[++n],Za(e,t,r,n,o,i,s,a)}Te.prototype.add=function(e,t,r){if(Ve(e)&&(t=e,e=Va(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],fe(o)&&(o=[o]),Za(t,o,this.marker,0,this.index[i],e,o[0],r);if(!0&&this.tag){let n=Va(t,this.tag),o=H();fe(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 u=this.register[e]||(this.register[e]=[]);u[u.length]=a}}if(!0&&this.store&&(!r||!this.store[e])){let n;if(this.storetree){n=H();for(let o=0,i;o<this.storetree.length;o++)i=this.storetree[o],fe(i)?n[i]=t[i]:Ya(t,n,i,0,i[0])}this.store[e]=n||t}}return this};Te.prototype.append=function(e,t){return this.add(e,t,!0)};Te.prototype.update=function(e,t){return this.remove(e).add(e,t)};Te.prototype.remove=function(e){if(Ve(e)&&(e=Va(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};Te.prototype.search=function(e,t,r,n){r||(!t&&Ve(e)?(r=e,e=""):Ve(t)&&(r=t,t=0));let o=[],i=[],s,a,u,m,l,d,f=0;if(r)if(rr(r))u=r,r=null;else{if(e=r.query||e,s=r.pluck,u=s||r.index||r.field,m=!0&&r.tag,a=!0&&this.store&&r.enrich,l=r.bool==="and",t=r.limit||t||100,d=r.offset||0,m&&(fe(m)&&(m=[m]),!e)){for(let w=0,x;w<m.length;w++)x=zI.call(this,m[w],t,d,a),x&&(o[o.length]=x,f++);return f?o:[]}fe(u)&&(u=[u])}u||(u=this.field),l=l&&(u.length>1||m&&m.length>1);let g=!n&&(this.worker||this.async)&&[];for(let w=0,x,S,N;w<u.length;w++){let M;if(S=u[w],fe(S)||(M=S,S=M.field,e=M.query||e,t=M.limit||t),g){g[w]=this.index[S].searchAsync(e,t,M||r);continue}else n?x=n[w]:x=this.index[S].search(e,t,M||r);if(N=x&&x.length,m&&N){let k=[],ee=0;l&&(k[0]=[x]);for(let xe=0,A,B;xe<m.length;xe++)A=m[xe],B=this.tagindex[A],N=B&&B.length,N&&(ee++,k[k.length]=l?[B]:B);ee&&(l?x=Ri(k,t||100,d||0):x=Fh(x,k),N=x.length)}if(N)i[f]=S,o[f++]=x;else if(l)return[]}if(g){let w=this;return new Promise(function(x){Promise.all(g).then(function(S){x(w.search(e,t,r,S))})})}if(!f)return[];if(s&&(!a||!this.store))return o[0];for(let w=0,x;w<i.length;w++){if(x=o[w],x.length&&a&&(x=Jh.call(this,x)),s)return x;o[w]={field:i[w],result:x}}return o};function zI(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=Jh.call(this,o)),{tag:e,result:o}}function Jh(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}Te.prototype.contain=function(e){return!!this.register[e]};!0&&(Te.prototype.get=function(e){return this.store[e]},Te.prototype.set=function(e,t){return this.store[e]=t,this});!0&&(Te.prototype.searchCache=Pi);!0&&(Te.prototype.export=jh,Te.prototype.import=Lh);!0&&Ai(Te.prototype);var WI=["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"],KI={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:""},GI={},Vh={filter:WI,stemmer:KI,matcher:GI};function Yh(){let e,t,r=new Promise((n,o)=>{e=n,t=o});return{resolve:e,reject:t,promise:r}}var Vn=class{#e=Ar;readCitekeys(t){if(oe.debug("Reading Better BibTex database"),!this.#e.bbtLoadStatus)return oe.info("Better BibTex database not enabled, skipping..."),[];let r=this.#e.getCitekeys(t);return oe.info("Finished reading Better BibTex"),r}toItemObjects(t,r){let n=this.readCitekeys(r),o=this.#e.zotero.prepare(un).query(r),i=this.#e.zotero.prepare(an).query(r),s=Eh(r.flatMap(([u])=>t[u]?.collectionIDs?.map(m=>`${m}-${t[u].libraryID}`)??[])).filter(u=>u!==null),a=this.#e.zotero.prepare(dn).query(s.map(u=>u.split("-").map(m=>+m)));return r.reduce((u,[m,l])=>{if(!m)return u;let d=n[m];d||oe.warn(`Citekey: No item found for itemID ${m}`,d);let f=o[m].reduce((N,M)=>{let{value:k}=M;return M.fieldName==="date"&&(k=nl(k).split("-")[0]),(N[M.fieldName]??=[]).push(k),N},{}),{collectionIDs:g,...w}=t[m],x=g.map(N=>a.get(N)).filter(N=>N!==void 0),S={...w,libraryID:l,groupID:this.#e.groupOf(l),itemID:m,creators:i[m],collections:x,citekey:n[m],...f,dateAccessed:HI(f)?JI(f.accessDate[0]):null};return u[m]=S,u},{})}};function HI(e){let t=e;return Array.isArray(t.accessDate)&&t.accessDate.length===1&&typeof t.accessDate[0]=="string"}function JI(e){let t=e.replace(" ","T")+"Z";try{return new Date(t)}catch{return null}}var Yn=class{#e=Ar;#t=new Vn;#r=new Hh({worker:!0,charset:Ch,language:Vh,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=Yh();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){oe.debug("Reading main Zotero database for index");let{zotero:r}=this.#e,n=this.#s(r.prepare(ln).query({libId:t}));return oe.info("Finished reading main Zotero database for index"),n}readItemByKey(t){let{zotero:r}=this.#e,n=r.prepare(pn).query(t);return this.#s(t.map(([i])=>n[i]))}readItemById(t){let{zotero:r}=this.#e,n=r.prepare(fn).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){oe.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=>[Ls(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))])}oe.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(Ls(r,!0),r),await this.#r.updateAsync(r.itemID,r)}))}};var Ar=new Un,Ci=new Yn,Zh=new zn;function nr(e,t){return(...r)=>{oe.debug(`Reading Zotero database for ${typeof t=="string"?t:t(null,...r)}`);let n=e.apply(null,r);return Promise.resolve(n).then(o=>oe.debug(`Finished reading Zotero database for ${typeof t=="string"?t:t(o,...r)}`)),n}}var Qa=class{#e=Ar;#t=Ci;#r=Zh;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:nr(t=>this.#e.zotero.prepare(gn).query(t),"tags"),getItemIDsFromCitekey:t=>this.#e.getItemIDsFromCitekey(t),getItemsFromCache:(t,r)=>this.#t.getCachedItems(t,r),getAttachments:nr((t,r)=>this.#e.zotero.prepare(tn).query({itemId:t,libId:r}),(t,r)=>`attachments of item ${r}`+(t?`, count: ${t.length}`:"")),getAnnotations:nr((t,r)=>this.#e.zotero.prepare(Qr).query({attachmentId:t,libId:r,groupID:this.#e.groupOf(r)}),(t,r)=>`annotations of attachment ${r}`+(t?`, count: ${t.length}`:"")),getAnnotFromKey:nr((t,r)=>this.#e.zotero.prepare(Zr).query({annotKeys:t,libId:r,groupID:this.#e.groupOf(r)}),(t,r)=>`annotations with keys: ${r.join(",")}`+(t?`, count: ${t.length}`:"")),getNotes:nr((t,r)=>this.#e.zotero.prepare(en).query({itemID:t,libId:r,groupID:this.#e.groupOf(r)}),(t,r)=>`notes of literature ${r}`+(t?`, count: ${t.length}`:"")),getNoteFromKey:nr((t,r)=>this.#e.zotero.prepare(Xr).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=>{oe.level=t,Qh.default.setItem(Ma,t)}};toAPI(){return al(this.api)}},VI=new Qa;new Yr(VI.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 Mb=class extends zs{initWebWorker(){return YT(RA,{name:"zotlit database worker"})}},Ep=class extends Us{workerCtor(){return new Mb}};var Vt=class extends fe{settings=this.use(ge);app=this.use(Eo.App);plugin=this.use(xe);server=this.use(Tn);get zoteroDataDir(){return this.settings.current?.zoteroDataDir}onload(){W.debug("loading DatabaseWorker"),this.settings.once(async()=>{let e=(0,Eo.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,NA.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(He(lt(async()=>{this.status===0?await this.initialize():await this.refresh({task:"full"})},()=>this.zoteroDataDir))),this.register(He(lt(async()=>{await this.refresh({task:"searchIndex",force:!0}),new Eo.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,Eo.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]=Gy(e.app,{timeout:1e4});await s}catch(s){if(s instanceof Sl){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[a,l]=Gy(e.app,{timeout:null});n=l,a.then(()=>{W.debug("db refresh while requesting auto refresh search index"),r=!0,n=null}).catch(u=>{u instanceof Il||console.error("error while waiting for db refresh during request",u)})}}async onunload(){await this.#e.terminate(),this.#t=0,this.#s=null}#e=new Ep({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,{main:n,bbtMain:o,bbtSearch:i}=await this.api.openDb(e,r);if((!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,$b.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,$b.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 Eo.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"}}};de([me],Vt.prototype,"zoteroDataDir",1);var DA="INFO",FA="log4js_loglevel",n7=()=>{let t=localStorage.getItem(FA);return typeof t=="string"&&t in Sp.levels?(console.debug(`Read from localstorage: loglevel ${t}`),t):DA},Lb=TS("main",n7(),Sp.default),W=Lb,mt=(t,e,...r)=>{if(!e){Lb.error(t,...r);return}Lb.error(t,e instanceof Error?e.message:String(e),...r),console.error(e)},WT={logLevel:DA},zl=class extends fe{settings=this.use(ge);get level(){return this.settings.current?.logLevel}async applyLogLevel(){localStorage.setItem(FA,this.level),await this.use(Vt).api.setLoglevel(this.level)}onload(){this.register(He(lt(()=>this.applyLogLevel(),()=>this.level)))}};de([me],zl.prototype,"level",1);var yN=require("fs"),Hn=require("obsidian");S();var Ee={},Gs=Symbol(),$k=t=>!!t[Gs],Fk=t=>!t[Gs].c,Gl=t=>{var e;let{b:r,c:n}=t[Gs];n&&(n(),(e=S7.get(r))==null||e())},Np=(t,e)=>{let r=t[Gs].o,n=e[Gs].o;return r===n||t===n||$k(r)&&Np(r,e)},Pk=(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[Gs]=r,n},S7=new WeakMap;var Rp=t=>"init"in t,Qb="r",ev="w",Zl="c",tv="s",Mk="h",I7="n",_7="l",O7="a",T7="m",C7=t=>{let e=new WeakMap,r=new WeakMap,n=new Map,o,i;if((Ee.env&&Ee.env.MODE)!=="production"&&(o=new Set,i=new Set),t)for(let[E,w]of t){let C={v:w,r:0,y:!0,d:new Map};(Ee.env&&Ee.env.MODE)!=="production"&&(Object.freeze(C),Rp(E)||console.warn("Found initial value for derived atom which can cause unexpected behavior",E)),e.set(E,C)}let s=new WeakMap,a=(E,w,C)=>{let A=s.get(w);A||(A=new Map,s.set(w,A)),C.then(()=>{A.get(E)===C&&(A.delete(E),A.size||s.delete(w))}),A.set(E,C)},l=E=>{let w=new Set,C=s.get(E);return C&&(s.delete(E),C.forEach((A,k)=>{Gl(A),w.add(k)})),w},u=new WeakMap,c=E=>{let w=u.get(E);return w||(w=new Map,u.set(E,w)),w},f=(E,w)=>{if(E){let C=c(E),A=C.get(w);return A||(A=f(E.p,w),A&&"p"in A&&Fk(A.p)&&(A=void 0),A&&C.set(w,A)),A}return e.get(w)},p=(E,w,C)=>{if((Ee.env&&Ee.env.MODE)!=="production"&&Object.freeze(C),E)c(E).set(w,C);else{let A=e.get(w);e.set(w,C),n.has(w)||n.set(w,A)}},d=(E,w=new Map,C)=>{if(!C)return w;let A=new Map,k=!1;return C.forEach(R=>{var z;let ne=((z=f(E,R))==null?void 0:z.r)||0;A.set(R,ne),w.get(R)!==ne&&(k=!0)}),w.size===A.size&&!k?w:A},h=(E,w,C,A,k)=>{let R=f(E,w);if(R){if(k&&(!("p"in R)||!Np(R.p,k)))return R;"p"in R&&Gl(R.p)}let z={v:C,r:R?.r||0,y:!0,d:d(E,R?.d,A)},ne=!R?.y;return!R||!("v"in R)||!Object.is(R.v,C)?(ne=!0,++z.r,z.d.has(w)&&(z.d=new Map(z.d).set(w,z.r))):z.d!==R.d&&(z.d.size!==R.d.size||!Array.from(z.d.keys()).every(Gr=>R.d.has(Gr)))&&(ne=!0,Promise.resolve().then(()=>{D(E)})),R&&!ne?R:(p(E,w,z),z)},b=(E,w,C,A,k)=>{let R=f(E,w);if(R){if(k&&(!("p"in R)||!Np(R.p,k)))return R;"p"in R&&Gl(R.p)}let z={e:C,r:(R?.r||0)+1,y:!0,d:d(E,R?.d,A)};return p(E,w,z),z},y=(E,w,C,A)=>{let k=f(E,w);if(k&&"p"in k){if(Np(k.p,C))return k.y?k:{...k,y:!0};Gl(k.p)}a(E,w,C);let R={p:C,r:(k?.r||0)+1,y:!0,d:d(E,k?.d,A)};return p(E,w,R),R},v=(E,w,C,A)=>{if(C instanceof Promise){let k=Pk(C,C.then(R=>{h(E,w,R,A,k)}).catch(R=>{if(R instanceof Promise)return $k(R)?R.then(()=>{T(E,w,!0)}):R;b(E,w,R,A,k)}));return y(E,w,k,A)}return h(E,w,C,A)},x=(E,w)=>{let C=f(E,w);if(C){let A={...C,y:!1};p(E,w,A)}else(Ee.env&&Ee.env.MODE)!=="production"&&console.warn("[Bug] could not invalidate non existing atom",w)},T=(E,w,C)=>{if(!C){let k=f(E,w);if(k){if(k.y&&"p"in k&&!Fk(k.p))return k;if(k.d.forEach((R,z)=>{if(z!==w)if(!r.has(z))T(E,z);else{let ne=f(E,z);ne&&!ne.y&&T(E,z)}}),Array.from(k.d).every(([R,z])=>{let ne=f(E,R);return ne&&!("p"in ne)&&ne.r===z}))return k.y?k:{...k,y:!0}}}let A=new Set;try{let k=w.read(R=>{A.add(R);let z=R===w?f(E,R):T(E,R);if(z){if("e"in z)throw z.e;if("p"in z)throw z.p;return z.v}if(Rp(R))return R.init;throw new Error("no atom init")});return v(E,w,k,A)}catch(k){if(k instanceof Promise){let R=Pk(k,k);return y(E,w,R,A)}return b(E,w,k,A)}},$=(E,w)=>T(w,E),V=(E,w)=>{let C=r.get(w);return C||(C=_(E,w)),C},J=(E,w)=>!w.l.size&&(!w.t.size||w.t.size===1&&w.t.has(E)),G=(E,w)=>{let C=r.get(w);C&&J(w,C)&&I(E,w)},K=(E,w)=>{let C=r.get(w);C?.t.forEach(A=>{A!==w&&(x(E,A),K(E,A))})},F=(E,w,C)=>{let A=!0,k=(ne,Gr)=>{let Cr=T(E,ne);if("e"in Cr)throw Cr.e;if("p"in Cr){if(Gr?.unstable_promise)return Cr.p.then(()=>{let Ju=f(E,ne);return Ju&&"p"in Ju&&Ju.p===Cr.p?new Promise(Mg=>setTimeout(Mg)).then(()=>k(ne,Gr)):k(ne,Gr)});throw(Ee.env&&Ee.env.MODE)!=="production"&&console.info("Reading pending atom state in write operation. We throw a promise for now.",ne),Cr.p}if("v"in Cr)return Cr.v;throw(Ee.env&&Ee.env.MODE)!=="production"&&console.warn("[Bug] no value found while reading atom in write operation. This is probably a bug.",ne),new Error("no value found")},R=(ne,Gr)=>{let Cr;if(ne===w){if(!Rp(ne))throw new Error("atom not writable");l(ne).forEach(rS=>{rS!==E&&v(rS,ne,Gr)});let Mg=f(E,ne),BB=v(E,ne,Gr);Mg!==BB&&K(E,ne)}else Cr=F(E,ne,Gr);return A||D(E),Cr},z=w.write(k,R,C);return A=!1,z},Q=(E,w,C)=>{let A=F(C,E,w);return D(C),A},O=E=>!!E.write,_=(E,w,C)=>{let A={t:new Set(C&&[C]),l:new Set};if(r.set(w,A),(Ee.env&&Ee.env.MODE)!=="production"&&i.add(w),T(void 0,w).d.forEach((R,z)=>{let ne=r.get(z);ne?ne.t.add(w):z!==w&&_(E,z,w)}),O(w)&&w.onMount){let R=ne=>Q(w,ne,E),z=w.onMount(R);E=void 0,z&&(A.u=z)}return A},I=(E,w)=>{var C;let A=(C=r.get(w))==null?void 0:C.u;A&&A(),r.delete(w),(Ee.env&&Ee.env.MODE)!=="production"&&i.delete(w);let k=f(E,w);k?("p"in k&&Gl(k.p),k.d.forEach((R,z)=>{if(z!==w){let ne=r.get(z);ne&&(ne.t.delete(w),J(z,ne)&&I(E,z))}})):(Ee.env&&Ee.env.MODE)!=="production"&&console.warn("[Bug] could not find atom state to unmount",w)},B=(E,w,C,A)=>{let k=new Set(C.d.keys());A?.forEach((R,z)=>{if(k.has(z)){k.delete(z);return}let ne=r.get(z);ne&&(ne.t.delete(w),J(z,ne)&&I(E,z))}),k.forEach(R=>{let z=r.get(R);z?z.t.add(w):r.has(w)&&_(E,R,w)})},D=E=>{if(E){c(E).forEach((C,A)=>{let k=e.get(A);if(C!==k){let R=r.get(A);R?.l.forEach(z=>z(E))}});return}for(;n.size;){let w=Array.from(n);n.clear(),w.forEach(([C,A])=>{let k=f(void 0,C);if(k&&k.d!==A?.d&&B(void 0,C,k,A?.d),A&&!A.y&&k?.y)return;let R=r.get(C);R?.l.forEach(z=>z())})}(Ee.env&&Ee.env.MODE)!=="production"&&o.forEach(w=>w())},oe=E=>{c(E).forEach((C,A)=>{let k=e.get(A);(!k||C.r>k.r||C.y!==k.y||C.r===k.r&&C.d!==k.d)&&(e.set(A,C),C.d!==k?.d&&B(E,A,C,k?.d))})},se=(E,w)=>{w&&oe(w),D(void 0)},be=(E,w,C)=>{let k=V(C,E).l;return k.add(w),()=>{k.delete(w),G(C,E)}},ce=(E,w)=>{for(let[C,A]of E)Rp(C)&&(v(w,C,A),K(w,C));D(w)};return(Ee.env&&Ee.env.MODE)!=="production"?{[Qb]:$,[ev]:Q,[Zl]:se,[tv]:be,[Mk]:ce,[I7]:E=>(o.add(E),()=>{o.delete(E)}),[_7]:()=>i.values(),[O7]:E=>e.get(E),[T7]:E=>r.get(E)}:{[Qb]:$,[ev]:Q,[Zl]:se,[tv]:be,[Mk]:ce}};var Lk=(t,e)=>({s:e?e(t).SECRET_INTERNAL_store:C7(t)}),Xb=new Map,rv=t=>(Xb.has(t)||Xb.set(t,We(Lk())),Xb.get(t)),jk=({children:t,initialValues:e,scope:r,unstable_createStore:n,unstable_enableVersionedWrite:o})=>{let[i,s]=L({});U(()=>{let u=a.current;u.w&&(u.s[Zl](null,i),delete i.p,u.v=i)},[i]);let a=P();if(!a.current){let u=Lk(e,n);if(o){let c=0;u.w=f=>{s(p=>{let d=c?p:{p};return f(d),d})},u.v=i,u.r=f=>{++c,f(),--c}}a.current=u}let l=rv(r);return H(l.Provider,{value:a.current},t)},A7=0;function Jt(t,e){let r=`atom${++A7}`,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 xt(t,e){let r=rv(e),n=te(r),{s:o,v:i}=n,s=p=>{let d=o[Qb](t,p);if((Ee.env&&Ee.env.MODE)!=="production"&&!d.y)throw new Error("should not be invalidated");if("e"in d)throw d.e;if("p"in d)throw d.p;if("v"in d)return d.v;throw new Error("no atom value")},[[a,l,u],c]=an((p,d)=>{let h=s(d);return Object.is(p[1],h)&&p[2]===t?p:[d,h,t]},i,p=>{let d=s(p);return[p,d,t]}),f=l;return u!==t&&(c(a),f=s(a)),U(()=>{let{v:p}=n;p&&o[Zl](t,p);let d=o[tv](t,c,p);return c(p),d},[o,t,n]),U(()=>{o[Zl](t,a)}),Ii(f),f}function nv(t,e){let r=rv(e),{s:n,w:o}=te(r);return X(s=>{if((Ee.env&&Ee.env.MODE)!=="production"&&!("write"in t))throw new Error("not writable atom");let a=l=>n[ev](t,s,l);return o?o(a):a()},[n,o,t])}var hN=require("obsidian");S();var qk=()=>{let t=[];return{get:()=>t,set:(n,o)=>{t.push([n,o])}}};var Dr=Jt(null),ov=Jt(t=>{let{arch:e,platform:r,modules:n}=t(Dr).platform;return`better-sqlite3-${t(Dr).binaryVersion}-electron-v${n}-${r}-${e}.tar.gz`}),Jl=Jt(t=>`https://github.com/aidenlx/better-sqlite3/releases/download/${t(Dr).binaryVersion}/${t(ov)}`),Gbe=Jt(t=>t(Jl).replace("github.com","download.fastgit.org")),Dp=Jt(t=>Rs(t(Dr).manifest)),Bk=Jt(t=>t(Dr).mode);var dN=Z(ks(),1);S();var zk=function(t){return function(e,r){var n=P(!1);t(function(){return function(){n.current=!1}},[]),t(function(){if(!n.current)n.current=!0;else return e()},r)}};function Io(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(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i}S();var Yl=function(t){return typeof t=="function"};var Uk=function(t){return typeof t>"u"};var k7=!1,Wk=k7;function R7(t){Wk&&(Yl(t)||console.error("useMemoizedFn expected parameter is a function, got ".concat(typeof t)));var e=P(t);e.current=ie(function(){return t},[t]);var r=P();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 Yt=R7;S();var Hk=zk(U);var N7=!!(typeof window<"u"&&window.document&&window.document.createElement),Kk=N7;S();function Vk(t){function e(r,n){var o;try{o=t()}catch(p){console.error(p)}var i=function(p){return n?.serializer?n?.serializer(p):JSON.stringify(p)},s=function(p){return n?.deserializer?n?.deserializer(p):JSON.parse(p)};function a(){try{var p=o?.getItem(r);if(p)return s(p)}catch(d){console.error(d)}return Yl(n?.defaultValue)?n?.defaultValue():n?.defaultValue}var l=Io(L(function(){return a()}),2),u=l[0],c=l[1];Hk(function(){c(a())},[r]);var f=function(p){var d=Yl(p)?p(u):p;if(c(d),Uk(d))o?.removeItem(r);else try{o?.setItem(r,i(d))}catch(h){console.error(h)}};return[u,Yt(f)]}return e}var D7=Vk(function(){return Kk?localStorage:void 0}),iv=D7;function Gk(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=Gk(t[e]))&&(n&&(n+=" "),n+=r);else for(e in t)t[e]&&(n&&(n+=" "),n+=e);return n}function sv(){for(var t,e,r=0,n="";r<arguments.length;)(t=arguments[r++])&&(e=Gk(t))&&(n&&(n+=" "),n+=e);return n}var Zs=sv;var Zk=require("obsidian");S();var Mt=t=>{let e=P(null);return[X(n=>{e.current&&e.current.empty(),n&&(0,Zk.setIcon)(n,t),e.current=n},[t])]};Hs();Hs();var F7=0;function m(t,e,r,n,o){var i,s,a={};for(s in e)s=="ref"?i=e[s]:a[s]=e[s];var l={type:t,props:a,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--F7,__source:o,__self:n};if(typeof t=="function"&&(i=t.defaultProps))for(s in i)a[s]===void 0&&(a[s]=i[s]);return q.vnode&&q.vnode(l),l}var Xl=({name:t,desc:e,button:r,onClick:n,icon:o,className:i,...s})=>m("div",{className:Zs("setting-item",i),...s,children:[o&&m("div",{className:"setting-icon",children:o}),m("div",{className:"setting-item-info",children:[m("div",{className:"setting-item-name",children:t}),m("div",{className:"setting-item-description",children:e})]}),m("div",{className:"setting-item-control",children:r&&m("button",{className:"mod-cta",onClick:n,children:r})})]});S();var P7=()=>m("svg",{className:"icon-blank svg-icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",height:"32",width:"32"}),M7=()=>m("svg",{className:"icon-spin svg-icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",height:"32",width:"32",children:[m("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"}),m("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z",children:m("animateTransform",{attributeName:"transform",type:"rotate",from:"0 16 16",to:"360 16 16",dur:"0.8s",repeatCount:"indefinite"})})]}),Jk=({color:t="var(--icon-color, black)",delay:e=0,height:r=16,width:n=16,style:o,...i})=>{let[s,a]=L(e>0);return U(()=>{let l=-1;return s&&(l=window.setTimeout(()=>{a(!1)},e)),()=>{window.clearTimeout(l)}},[]),m("div",{style:{...o,fill:t,height:Number(r)||r,width:Number(n)||n},...i,children:s?m(P7,{}):m(M7,{})})};var nN=require("fs"),Fd=require("fs/promises"),oN=require("stream"),E0=require("stream/promises"),bK=require("@electron/remote");var Fp=class extends Error{},av=class extends Fp{},lv=class extends Fp{},$7=(t,e=",")=>t.join(e),L7={accept:"*",multiple:!1,strict:!1},Yk=t=>{let{accept:e,multiple:r,strict:n}={...L7,...t},o=B7({multiple:r,accept:Array.isArray(e)?$7(e):e});return new Promise(i=>{o.onchange=()=>{i(j7(o.files,r,n)),o.remove()},o.click()})},j7=(t,e,r)=>new Promise((n,o)=>{if(!t)return o(new av);let i=q7(t,e,r);if(!i)return o(new lv);n(i)}),q7=(t,e,r)=>!e&&r?t.length===1?t[0]:null:t.length?t:null,B7=({accept:t,multiple:e})=>{let r=document.createElement("input");return r.type="file",r.multiple=e,r.accept=t,r};var S0=require("obsidian");var nR=Z(require("events"),1),St=Z(require("fs"),1);var Bp=require("node:events"),hv=Z(require("node:stream"),1),rR=require("node:string_decoder"),Xk=typeof process=="object"&&process?process:{stdout:null,stderr:null},z7=t=>!!t&&typeof t=="object"&&(t instanceof $t||t instanceof hv.default||U7(t)||W7(t)),U7=t=>!!t&&typeof t=="object"&&t instanceof Bp.EventEmitter&&typeof t.pipe=="function"&&t.pipe!==hv.default.Writable.prototype.pipe,W7=t=>!!t&&typeof t=="object"&&t instanceof Bp.EventEmitter&&typeof t.write=="function"&&typeof t.end=="function",Dn=Symbol("EOF"),Fn=Symbol("maybeEmitEnd"),_o=Symbol("emittedEnd"),Pp=Symbol("emittingEnd"),Ql=Symbol("emittedError"),Mp=Symbol("closed"),Qk=Symbol("read"),$p=Symbol("flush"),eR=Symbol("flushChunk"),Fr=Symbol("encoding"),Js=Symbol("decoder"),et=Symbol("flowing"),ec=Symbol("paused"),Ys=Symbol("resume"),tt=Symbol("buffer"),Et=Symbol("pipes"),rt=Symbol("bufferLength"),cv=Symbol("bufferPush"),Lp=Symbol("bufferShift"),gt=Symbol("objectMode"),Le=Symbol("destroyed"),uv=Symbol("error"),fv=Symbol("emitData"),tR=Symbol("emitEnd"),pv=Symbol("emitEnd2"),cn=Symbol("async"),dv=Symbol("abort"),jp=Symbol("aborted"),tc=Symbol("signal"),_i=Symbol("dataListeners"),Xt=Symbol("discarded"),rc=t=>Promise.resolve().then(t),H7=t=>t(),K7=t=>t==="end"||t==="finish"||t==="prefinish",V7=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,G7=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),qp=class{src;dest;opts;ondrain;constructor(e,r,n){this.src=e,this.dest=r,this.opts=n,this.ondrain=()=>e[Ys](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},mv=class extends qp{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)}},Z7=t=>!!t.objectMode,J7=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",$t=class extends Bp.EventEmitter{[et]=!1;[ec]=!1;[Et]=[];[tt]=[];[gt];[Fr];[cn];[Js];[Dn]=!1;[_o]=!1;[Pp]=!1;[Mp]=!1;[Ql]=null;[rt]=0;[Le]=!1;[tc];[jp]=!1;[_i]=0;[Xt]=!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");Z7(r)?(this[gt]=!0,this[Fr]=null):J7(r)?(this[Fr]=r.encoding,this[gt]=!1):(this[gt]=!1,this[Fr]=null),this[cn]=!!r.async,this[Js]=this[Fr]?new rR.StringDecoder(this[Fr]):null,r&&r.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[tt]}),r&&r.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[Et]});let{signal:n}=r;n&&(this[tc]=n,n.aborted?this[dv]():n.addEventListener("abort",()=>this[dv]()))}get bufferLength(){return this[rt]}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[gt]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[cn]}set async(e){this[cn]=this[cn]||!!e}[dv](){this[jp]=!0,this.emit("abort",this[tc]?.reason),this.destroy(this[tc]?.reason)}get aborted(){return this[jp]}set aborted(e){}write(e,r,n){if(this[jp])return!1;if(this[Dn])throw new Error("write after end");if(this[Le])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[cn]?rc:H7;if(!this[gt]&&!Buffer.isBuffer(e)){if(G7(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(V7(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[gt]?(this[et]&&this[rt]!==0&&this[$p](!0),this[et]?this.emit("data",e):this[cv](e),this[rt]!==0&&this.emit("readable"),n&&o(n),this[et]):e.length?(typeof e=="string"&&!(r===this[Fr]&&!this[Js]?.lastNeed)&&(e=Buffer.from(e,r)),Buffer.isBuffer(e)&&this[Fr]&&(e=this[Js].write(e)),this[et]&&this[rt]!==0&&this[$p](!0),this[et]?this.emit("data",e):this[cv](e),this[rt]!==0&&this.emit("readable"),n&&o(n),this[et]):(this[rt]!==0&&this.emit("readable"),n&&o(n),this[et])}read(e){if(this[Le])return null;if(this[Xt]=!1,this[rt]===0||e===0||e&&e>this[rt])return this[Fn](),null;this[gt]&&(e=null),this[tt].length>1&&!this[gt]&&(this[tt]=[this[Fr]?this[tt].join(""):Buffer.concat(this[tt],this[rt])]);let r=this[Qk](e||null,this[tt][0]);return this[Fn](),r}[Qk](e,r){if(this[gt])this[Lp]();else{let n=r;e===n.length||e===null?this[Lp]():typeof n=="string"?(this[tt][0]=n.slice(e),r=n.slice(0,e),this[rt]-=e):(this[tt][0]=n.subarray(e),r=n.subarray(0,e),this[rt]-=e)}return this.emit("data",r),!this[tt].length&&!this[Dn]&&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[Dn]=!0,this.writable=!1,(this[et]||!this[ec])&&this[Fn](),this}[Ys](){this[Le]||(!this[_i]&&!this[Et].length&&(this[Xt]=!0),this[ec]=!1,this[et]=!0,this.emit("resume"),this[tt].length?this[$p]():this[Dn]?this[Fn]():this.emit("drain"))}resume(){return this[Ys]()}pause(){this[et]=!1,this[ec]=!0,this[Xt]=!1}get destroyed(){return this[Le]}get flowing(){return this[et]}get paused(){return this[ec]}[cv](e){this[gt]?this[rt]+=1:this[rt]+=e.length,this[tt].push(e)}[Lp](){return this[gt]?this[rt]-=1:this[rt]-=this[tt][0].length,this[tt].shift()}[$p](e=!1){do;while(this[eR](this[Lp]())&&this[tt].length);!e&&!this[tt].length&&!this[Dn]&&this.emit("drain")}[eR](e){return this.emit("data",e),this[et]}pipe(e,r){if(this[Le])return e;this[Xt]=!1;let n=this[_o];return r=r||{},e===Xk.stdout||e===Xk.stderr?r.end=!1:r.end=r.end!==!1,r.proxyErrors=!!r.proxyErrors,n?r.end&&e.end():(this[Et].push(r.proxyErrors?new mv(this,e,r):new qp(this,e,r)),this[cn]?rc(()=>this[Ys]()):this[Ys]()),e}unpipe(e){let r=this[Et].find(n=>n.dest===e);r&&(this[Et].length===1?(this[et]&&this[_i]===0&&(this[et]=!1),this[Et]=[]):this[Et].splice(this[Et].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[Xt]=!1,this[_i]++,!this[Et].length&&!this[et]&&this[Ys]();else if(e==="readable"&&this[rt]!==0)super.emit("readable");else if(K7(e)&&this[_o])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Ql]){let o=r;this[cn]?rc(()=>o.call(this,this[Ql])):o.call(this,this[Ql])}return n}removeListener(e,r){return this.off(e,r)}off(e,r){let n=super.off(e,r);return e==="data"&&(this[_i]=this.listeners("data").length,this[_i]===0&&!this[Xt]&&!this[Et].length&&(this[et]=!1)),n}removeAllListeners(e){let r=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[_i]=0,!this[Xt]&&!this[Et].length&&(this[et]=!1)),r}get emittedEnd(){return this[_o]}[Fn](){!this[Pp]&&!this[_o]&&!this[Le]&&this[tt].length===0&&this[Dn]&&(this[Pp]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Mp]&&this.emit("close"),this[Pp]=!1)}emit(e,...r){let n=r[0];if(e!=="error"&&e!=="close"&&e!==Le&&this[Le])return!1;if(e==="data")return!this[gt]&&!n?!1:this[cn]?(rc(()=>this[fv](n)),!0):this[fv](n);if(e==="end")return this[tR]();if(e==="close"){if(this[Mp]=!0,!this[_o]&&!this[Le])return!1;let i=super.emit("close");return this.removeAllListeners("close"),i}else if(e==="error"){this[Ql]=n,super.emit(uv,n);let i=!this[tc]||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}[fv](e){for(let n of this[Et])n.dest.write(e)===!1&&this.pause();let r=this[Xt]?!1:super.emit("data",e);return this[Fn](),r}[tR](){return this[_o]?!1:(this[_o]=!0,this.readable=!1,this[cn]?(rc(()=>this[pv]()),!0):this[pv]())}[pv](){if(this[Js]){let r=this[Js].end();if(r){for(let n of this[Et])n.dest.write(r);this[Xt]||super.emit("data",r)}}for(let r of this[Et])r.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[gt]||(e.dataLength=0);let r=this.promise();return this.on("data",n=>{e.push(n),this[gt]||(e.dataLength+=n.length)}),await r,e}async concat(){if(this[gt])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(Le,()=>r(new Error("stream destroyed"))),this.on("error",n=>r(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[Xt]=!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[Dn])return r();let i,s,a=f=>{this.off("data",l),this.off("end",u),this.off(Le,c),r(),s(f)},l=f=>{this.off("error",a),this.off("end",u),this.off(Le,c),this.pause(),i({value:f,done:!!this[Dn]})},u=()=>{this.off("error",a),this.off("data",l),this.off(Le,c),r(),i({done:!0,value:void 0})},c=()=>a(new Error("stream destroyed"));return new Promise((f,p)=>{s=p,i=f,this.once(Le,c),this.once("error",a),this.once("end",u),this.once("data",l)})},throw:r,return:r,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[Xt]=!1;let e=!1,r=()=>(this.pause(),this.off(uv,r),this.off(Le,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(uv,r),this.once(Le,r),{next:n,throw:r,return:r,[Symbol.iterator](){return this}}}destroy(e){if(this[Le])return e?this.emit("error",e):this.emit(Le),this;this[Le]=!0,this[Xt]=!0,this[tt].length=0,this[rt]=0;let r=this;return typeof r.close=="function"&&!this[Mp]&&r.close(),e?this.emit("error",e):this.emit(Le),this}static get isStream(){return z7}};var Y7=St.default.writev,To=Symbol("_autoClose"),Mr=Symbol("_close"),nc=Symbol("_ended"),ye=Symbol("_fd"),gv=Symbol("_finished"),Mn=Symbol("_flags"),yv=Symbol("_flush"),xv=Symbol("_handleChunk"),Ev=Symbol("_makeBuf"),ic=Symbol("_mode"),zp=Symbol("_needDrain"),ea=Symbol("_onerror"),ta=Symbol("_onopen"),bv=Symbol("_onread"),Xs=Symbol("_onwrite"),Co=Symbol("_open"),Pr=Symbol("_path"),Oo=Symbol("_pos"),un=Symbol("_queue"),Qs=Symbol("_read"),vv=Symbol("_readSize"),Pn=Symbol("_reading"),oc=Symbol("_remain"),wv=Symbol("_size"),Up=Symbol("_write"),Oi=Symbol("_writing"),Wp=Symbol("_defaultFlag"),Ti=Symbol("_errored"),Ci=class extends $t{[Ti]=!1;[ye];[Pr];[vv];[Pn]=!1;[wv];[oc];[To];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[Ti]=!1,this[ye]=typeof r.fd=="number"?r.fd:void 0,this[Pr]=e,this[vv]=r.readSize||16*1024*1024,this[Pn]=!1,this[wv]=typeof r.size=="number"?r.size:1/0,this[oc]=this[wv],this[To]=typeof r.autoClose=="boolean"?r.autoClose:!0,typeof this[ye]=="number"?this[Qs]():this[Co]()}get fd(){return this[ye]}get path(){return this[Pr]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[Co](){St.default.open(this[Pr],"r",(e,r)=>this[ta](e,r))}[ta](e,r){e?this[ea](e):(this[ye]=r,this.emit("open",r),this[Qs]())}[Ev](){return Buffer.allocUnsafe(Math.min(this[vv],this[oc]))}[Qs](){if(!this[Pn]){this[Pn]=!0;let e=this[Ev]();if(e.length===0)return process.nextTick(()=>this[bv](null,0,e));St.default.read(this[ye],e,0,e.length,null,(r,n,o)=>this[bv](r,n,o))}}[bv](e,r,n){this[Pn]=!1,e?this[ea](e):this[xv](r,n)&&this[Qs]()}[Mr](){if(this[To]&&typeof this[ye]=="number"){let e=this[ye];this[ye]=void 0,St.default.close(e,r=>r?this.emit("error",r):this.emit("close"))}}[ea](e){this[Pn]=!0,this[Mr](),this.emit("error",e)}[xv](e,r){let n=!1;return this[oc]-=e,e>0&&(n=super.write(e<r.length?r.subarray(0,e):r)),(e===0||this[oc]<=0)&&(n=!1,this[Mr](),super.end()),n}emit(e,...r){switch(e){case"prefinish":case"finish":return!1;case"drain":return typeof this[ye]=="number"&&this[Qs](),!1;case"error":return this[Ti]?!1:(this[Ti]=!0,super.emit(e,...r));default:return super.emit(e,...r)}}},Hp=class extends Ci{[Co](){let e=!0;try{this[ta](null,St.default.openSync(this[Pr],"r")),e=!1}finally{e&&this[Mr]()}}[Qs](){let e=!0;try{if(!this[Pn]){this[Pn]=!0;do{let r=this[Ev](),n=r.length===0?0:St.default.readSync(this[ye],r,0,r.length,null);if(!this[xv](n,r))break}while(!0);this[Pn]=!1}e=!1}finally{e&&this[Mr]()}}[Mr](){if(this[To]&&typeof this[ye]=="number"){let e=this[ye];this[ye]=void 0,St.default.closeSync(e),this.emit("close")}}},$n=class extends nR.default{readable=!1;writable=!0;[Ti]=!1;[Oi]=!1;[nc]=!1;[un]=[];[zp]=!1;[Pr];[ic];[To];[ye];[Wp];[Mn];[gv]=!1;[Oo];constructor(e,r){r=r||{},super(r),this[Pr]=e,this[ye]=typeof r.fd=="number"?r.fd:void 0,this[ic]=r.mode===void 0?438:r.mode,this[Oo]=typeof r.start=="number"?r.start:void 0,this[To]=typeof r.autoClose=="boolean"?r.autoClose:!0;let n=this[Oo]!==void 0?"r+":"w";this[Wp]=r.flags===void 0,this[Mn]=r.flags===void 0?n:r.flags,this[ye]===void 0&&this[Co]()}emit(e,...r){if(e==="error"){if(this[Ti])return!1;this[Ti]=!0}return super.emit(e,...r)}get fd(){return this[ye]}get path(){return this[Pr]}[ea](e){this[Mr](),this[Oi]=!0,this.emit("error",e)}[Co](){St.default.open(this[Pr],this[Mn],this[ic],(e,r)=>this[ta](e,r))}[ta](e,r){this[Wp]&&this[Mn]==="r+"&&e&&e.code==="ENOENT"?(this[Mn]="w",this[Co]()):e?this[ea](e):(this[ye]=r,this.emit("open",r),this[Oi]||this[yv]())}end(e,r){return e&&this.write(e,r),this[nc]=!0,!this[Oi]&&!this[un].length&&typeof this[ye]=="number"&&this[Xs](null,0),this}write(e,r){return typeof e=="string"&&(e=Buffer.from(e,r)),this[nc]?(this.emit("error",new Error("write() after end()")),!1):this[ye]===void 0||this[Oi]||this[un].length?(this[un].push(e),this[zp]=!0,!1):(this[Oi]=!0,this[Up](e),!0)}[Up](e){St.default.write(this[ye],e,0,e.length,this[Oo],(r,n)=>this[Xs](r,n))}[Xs](e,r){e?this[ea](e):(this[Oo]!==void 0&&typeof r=="number"&&(this[Oo]+=r),this[un].length?this[yv]():(this[Oi]=!1,this[nc]&&!this[gv]?(this[gv]=!0,this[Mr](),this.emit("finish")):this[zp]&&(this[zp]=!1,this.emit("drain"))))}[yv](){if(this[un].length===0)this[nc]&&this[Xs](null,0);else if(this[un].length===1)this[Up](this[un].pop());else{let e=this[un];this[un]=[],Y7(this[ye],e,this[Oo],(r,n)=>this[Xs](r,n))}}[Mr](){if(this[To]&&typeof this[ye]=="number"){let e=this[ye];this[ye]=void 0,St.default.close(e,r=>r?this.emit("error",r):this.emit("close"))}}},ra=class extends $n{[Co](){let e;if(this[Wp]&&this[Mn]==="r+")try{e=St.default.openSync(this[Pr],this[Mn],this[ic])}catch(r){if(r?.code==="ENOENT")return this[Mn]="w",this[Co]();throw r}else e=St.default.openSync(this[Pr],this[Mn],this[ic]);this[ta](null,e)}[Mr](){if(this[To]&&typeof this[ye]=="number"){let e=this[ye];this[ye]=void 0,St.default.closeSync(e),this.emit("close")}}[Up](e){let r=!0;try{this[Xs](null,St.default.writeSync(this[ye],e,0,e.length,this[Oo])),r=!1}finally{if(r)try{this[Mr]()}catch{}}}};var Yv=Z(require("node:path"),1);var $i=Z(require("node:fs"),1),ld=require("path");var X7=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"]]),oR=t=>!!t.sync&&!!t.file,iR=t=>!t.sync&&!!t.file,sR=t=>!!t.sync&&!t.file,aR=t=>!t.sync&&!t.file;var lR=t=>!!t.file;var Q7=t=>{let e=X7.get(t);return e||t},sc=(t={})=>{if(!t)return{};let e={};for(let[r,n]of Object.entries(t)){let o=Q7(r);e[o]=n}return e.chmod===void 0&&e.noChmod===!1&&(e.chmod=!0),delete e.noChmod,e};var fn=(t,e,r,n,o)=>Object.assign((i=[],s,a)=>{Array.isArray(i)&&(s=i,i={}),typeof s=="function"&&(a=s,s=void 0),s?s=Array.from(s):s=[];let l=sc(i);if(o?.(l,s),oR(l)){if(typeof a=="function")throw new TypeError("callback not supported for sync tar functions");return t(l,s)}else if(iR(l)){let u=e(l,s),c=a||void 0;return c?u.then(()=>c(),c):u}else if(sR(l)){if(typeof a=="function")throw new TypeError("callback not supported for sync tar functions");return r(l,s)}else if(aR(l)){if(typeof a=="function")throw new TypeError("callback only supported with file option");return n(l,s)}else throw new Error("impossible options??")},{syncFile:t,asyncFile:e,syncNoFile:r,asyncNoFile:n,validate:o});var IR=require("events");var Kp=Z(require("assert"),1),jn=require("buffer");var fR=Z(require("zlib"),1);var cR=Z(require("zlib"),1),eH=cR.default.constants||{ZLIB_VERNUM:4736},Ln=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},eH));var uR=jn.Buffer.concat,Ai=Symbol("_superWrite"),na=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"}},Iv=Symbol("flushFlag"),Vp=class extends $t{#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 fR.default[r](e)}catch(n){throw new na(n)}this.#s=n=>{this.#e||(this.#e=!0,this.close(),this.emit("error",n))},this.#r?.on("error",n=>this.#s(new na(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,Kp.default)(this.#r,"zlib binding closed"),this.#r.reset?.()}flush(e){this.ended||(typeof e!="number"&&(e=this.#i),this.write(Object.assign(jn.Buffer.alloc(0),{[Iv]: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}[Ai](e){return super.write(e)}write(e,r,n){if(typeof r=="function"&&(n=r,r="utf8"),typeof e=="string"&&(e=jn.Buffer.from(e,r)),this.#e)return;(0,Kp.default)(this.#r,"zlib binding closed");let o=this.#r._handle,i=o.close;o.close=()=>{};let s=this.#r.close;this.#r.close=()=>{},jn.Buffer.concat=u=>u;let a;try{let u=typeof e[Iv]=="number"?e[Iv]:this.#n;a=this.#r._processChunk(e,u),jn.Buffer.concat=uR}catch(u){jn.Buffer.concat=uR,this.#s(new na(u))}finally{this.#r&&(this.#r._handle=o,o.close=i,this.#r.close=s,this.#r.removeAllListeners("error"))}this.#r&&this.#r.on("error",u=>this.#s(new na(u)));let l;if(a)if(Array.isArray(a)&&a.length>0){let u=a[0];l=this[Ai](jn.Buffer.from(u));for(let c=1;c<a.length;c++)l=this[Ai](a[c])}else l=this[Ai](jn.Buffer.from(a));return n&&n(),l}},Gp=class extends Vp{#e;#t;constructor(e,r){e=e||{},e.flush=e.flush||Ln.Z_NO_FLUSH,e.finishFlush=e.finishFlush||Ln.Z_FINISH,e.fullFlushFlag=Ln.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(Ln.Z_SYNC_FLUSH),(0,Kp.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 Zp=class extends Gp{#e;constructor(e){super(e,"Gzip"),this.#e=e&&!!e.portable}[Ai](e){return this.#e?(this.#e=!1,e[9]=255,super[Ai](e)):super[Ai](e)}};var Jp=class extends Gp{constructor(e){super(e,"Unzip")}},Yp=class extends Vp{constructor(e,r){e=e||{},e.flush=e.flush||Ln.BROTLI_OPERATION_PROCESS,e.finishFlush=e.finishFlush||Ln.BROTLI_OPERATION_FINISH,e.fullFlushFlag=Ln.BROTLI_OPERATION_FLUSH,super(e,r)}},Xp=class extends Yp{constructor(e){super(e,"BrotliCompress")}},Qp=class extends Yp{constructor(e){super(e,"BrotliDecompress")}};var yr=class{tail;head;length=0;static create(e=[]){return new yr(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++)nH(this,e[r]);return this.length}unshift(...e){for(var r=0,n=e.length;r<n;r++)oH(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 yr;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 yr;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 yr;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 yr;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=rH(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 rH(t,e,r){let n=e,o=e?e.next:t.head,i=new ac(r,n,o,t);return i.next===void 0&&(t.tail=i),i.prev===void 0&&(t.head=i),t.length++,i}function nH(t,e){t.tail=new ac(e,t.tail,void 0,t),t.head||(t.head=t.tail),t.length++}function oH(t,e){t.head=new ac(e,void 0,t.head,t),t.tail||(t.tail=t.head),t.length++}var ac=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}};var Ni=require("node:path");var pR=(t,e)=>{if(Number.isSafeInteger(t))t<0?sH(t,e):iH(t,e);else throw Error("cannot encode number outside of javascript safe integer range");return e},iH=(t,e)=>{e[0]=128;for(var r=e.length;r>1;r--)e[r-1]=t&255,t=Math.floor(t/256)},sH=(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]=mR(o):o===0?e[n-1]=0:(r=!0,e[n-1]=hR(o))}},dR=t=>{let e=t[0],r=e===128?lH(t.subarray(1,t.length)):e===255?aH(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},aH=t=>{for(var e=t.length,r=0,n=!1,o=e-1;o>-1;o--){var i=Number(t[o]),s;n?s=mR(i):i===0?s=i:(n=!0,s=hR(i)),s!==0&&(r-=s*Math.pow(256,e-o-1))}return r},lH=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},mR=t=>(255^t)&255,hR=t=>(255^t)+1&255;var ed=t=>td.has(t);var td=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"]]),gR=new Map(Array.from(td).map(t=>[t[1],t[0]]));var Qt=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=ki(e,r,100),this.mode=Ao(e,r+100,8),this.uid=Ao(e,r+108,8),this.gid=Ao(e,r+116,8),this.size=Ao(e,r+124,12),this.mtime=_v(e,r+136,12),this.cksum=Ao(e,r+148,12),o&&this.#t(o,!0),n&&this.#t(n);let i=ki(e,r+156,1);if(ed(i)&&(this.#e=i||"0"),this.#e==="0"&&this.path.slice(-1)==="/"&&(this.#e="5"),this.#e==="5"&&(this.size=0),this.linkpath=ki(e,r+157,100),e.subarray(r+257,r+265).toString()==="ustar\x0000")if(this.uname=ki(e,r+265,32),this.gname=ki(e,r+297,32),this.devmaj=Ao(e,r+329,8)??0,this.devmin=Ao(e,r+337,8)??0,e[r+475]!==0){let a=ki(e,r+345,155);this.path=a+"/"+this.path}else{let a=ki(e,r+345,130);a&&(this.path=a+"/"+this.path),this.atime=_v(e,r+476,12),this.ctime=_v(e,r+488,12)}let s=8*32;for(let a=r;a<r+148;a++)s+=e[a];for(let a=r+156;a<r+512;a++)s+=e[a];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=uH(this.path||"",n),i=o[0],s=o[1];this.needPax=!!o[2],this.needPax=Ri(e,r,100,i)||this.needPax,this.needPax=ko(e,r+100,8,this.mode)||this.needPax,this.needPax=ko(e,r+108,8,this.uid)||this.needPax,this.needPax=ko(e,r+116,8,this.gid)||this.needPax,this.needPax=ko(e,r+124,12,this.size)||this.needPax,this.needPax=Ov(e,r+136,12,this.mtime)||this.needPax,e[r+156]=this.#e.charCodeAt(0),this.needPax=Ri(e,r+157,100,this.linkpath)||this.needPax,e.write("ustar\x0000",r+257,8),this.needPax=Ri(e,r+265,32,this.uname)||this.needPax,this.needPax=Ri(e,r+297,32,this.gname)||this.needPax,this.needPax=ko(e,r+329,8,this.devmaj)||this.needPax,this.needPax=ko(e,r+337,8,this.devmin)||this.needPax,this.needPax=Ri(e,r+345,n,s)||this.needPax,e[r+475]!==0?this.needPax=Ri(e,r+345,155,s)||this.needPax:(this.needPax=Ri(e,r+345,130,s)||this.needPax,this.needPax=Ov(e,r+476,12,this.atime)||this.needPax,this.needPax=Ov(e,r+488,12,this.ctime)||this.needPax);let a=8*32;for(let l=r;l<r+148;l++)a+=e[l];for(let l=r+156;l<r+512;l++)a+=e[l];return this.cksum=a,ko(e,r+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return this.#e==="Unsupported"?this.#e:td.get(this.#e)}get typeKey(){return this.#e}set type(e){let r=String(gR.get(e));if(ed(r)||r==="Unsupported")this.#e=r;else if(ed(e))this.#e=e;else throw new TypeError("invalid entry type: "+e)}},uH=(t,e)=>{let n=t,o="",i,s=Ni.posix.parse(t).root||".";if(Buffer.byteLength(n)<100)i=[n,o,!1];else{o=Ni.posix.dirname(n),n=Ni.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=Ni.posix.join(Ni.posix.basename(o),n),o=Ni.posix.dirname(o));while(o!==s&&i===void 0);i||(i=[t.slice(0,100-1),"",!0])}return i},ki=(t,e,r)=>t.subarray(e,e+r).toString("utf8").replace(/\0.*/,""),_v=(t,e,r)=>fH(Ao(t,e,r)),fH=t=>t===void 0?void 0:new Date(t*1e3),Ao=(t,e,r)=>Number(t[e])&128?dR(t.subarray(e,e+r)):dH(t,e,r),pH=t=>isNaN(t)?void 0:t,dH=(t,e,r)=>pH(parseInt(t.subarray(e,e+r).toString("utf8").replace(/\0.*$/,"").trim(),8)),mH={12:8589934591,8:2097151},ko=(t,e,r,n)=>n===void 0?!1:n>mH[r]||n<0?(pR(n,t.subarray(e,e+r)),!0):(hH(t,e,r,n),!1),hH=(t,e,r,n)=>t.write(gH(n,r),e,r,"ascii"),gH=(t,e)=>yH(Math.floor(t).toString(8),e),yH=(t,e)=>(t.length===e-1?t:new Array(e-t.length-1).join("0")+t+" ")+"\0",Ov=(t,e,r,n)=>n===void 0?!1:ko(t,e,r,n.getTime()/1e3),bH=new Array(156).join("\0"),Ri=(t,e,r,n)=>n===void 0?!1:(t.write(n+bH,e,r,"utf8"),n.length!==Buffer.byteLength(n)||n.length>r);var bR=require("node:path");var pn=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 Qt({path:("PaxHeader/"+(0,bR.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 pn(vH(wH(e),r),n)}},vH=(t,e)=>e?Object.assign({},e,t):t,wH=t=>t.replace(/\n$/,"").split(`
|
|
`).reduce(xH,Object.create(null)),xH=(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};var EH=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,ee=EH!=="win32"?t=>t:t=>t&&t.replace(/\\/g,"/");var oa=class extends $t{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=ee(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?ee(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=ee(e.path)),e.linkpath&&(e.linkpath=ee(e.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(e).filter(([n,o])=>!(o==null||n==="path"&&r))))}};var Di=(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 SH=1024*1024,Tv=Buffer.from([31,139]),br=Symbol("state"),Fi=Symbol("writeEntry"),qn=Symbol("readEntry"),Cv=Symbol("nextEntry"),vR=Symbol("processEntry"),dn=Symbol("extendedHeader"),lc=Symbol("globalExtendedHeader"),Ro=Symbol("meta"),wR=Symbol("emitMeta"),Se=Symbol("buffer"),Bn=Symbol("queue"),No=Symbol("ended"),Av=Symbol("emittedEnd"),Pi=Symbol("emit"),Ke=Symbol("unzip"),rd=Symbol("consumeChunk"),nd=Symbol("consumeChunkSub"),kv=Symbol("consumeBody"),xR=Symbol("consumeMeta"),ER=Symbol("consumeHeader"),cc=Symbol("consuming"),Rv=Symbol("bufferConcat"),od=Symbol("maybeEnd"),ia=Symbol("writing"),Do=Symbol("aborted"),id=Symbol("onDone"),Mi=Symbol("sawValidEntry"),sd=Symbol("sawNullBlock"),ad=Symbol("sawEOF"),SR=Symbol("closeStream"),IH=()=>!0,zn=class extends IR.EventEmitter{file;strict;maxMetaEntrySize;filter;brotli;writable=!0;readable=!1;[Bn]=new yr;[Se];[qn];[Fi];[br]="begin";[Ro]="";[dn];[lc];[No]=!1;[Ke];[Do]=!1;[Mi];[sd]=!1;[ad]=!1;[ia]=!1;[cc]=!1;[Av]=!1;constructor(e={}){super(),this.file=e.file||"",this.on(id,()=>{(this[br]==="begin"||this[Mi]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),e.ondone?this.on(id,e.ondone):this.on(id,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!e.strict,this.maxMetaEntrySize=e.maxMetaEntrySize||SH,this.filter=typeof e.filter=="function"?e.filter:IH;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[SR]()),typeof e.onwarn=="function"&&this.on("warn",e.onwarn),typeof e.onReadEntry=="function"&&this.on("entry",e.onReadEntry)}warn(e,r,n={}){Di(this,e,r,n)}[ER](e,r){this[Mi]===void 0&&(this[Mi]=!1);let n;try{n=new Qt(e,r,this[dn],this[lc])}catch(o){return this.warn("TAR_ENTRY_INVALID",o)}if(n.nullBlock)this[sd]?(this[ad]=!0,this[br]==="begin"&&(this[br]="header"),this[Pi]("eof")):(this[sd]=!0,this[Pi]("nullBlock"));else if(this[sd]=!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[Fi]=new oa(n,this[dn],this[lc]);if(!this[Mi])if(i.remain){let s=()=>{i.invalid||(this[Mi]=!0)};i.on("end",s)}else this[Mi]=!0;i.meta?i.size>this.maxMetaEntrySize?(i.ignore=!0,this[Pi]("ignoredEntry",i),this[br]="ignore",i.resume()):i.size>0&&(this[Ro]="",i.on("data",s=>this[Ro]+=s),this[br]="meta"):(this[dn]=void 0,i.ignore=i.ignore||!this.filter(i.path,i),i.ignore?(this[Pi]("ignoredEntry",i),this[br]=i.remain?"ignore":"header",i.resume()):(i.remain?this[br]="body":(this[br]="header",i.end()),this[qn]?this[Bn].push(i):(this[Bn].push(i),this[Cv]())))}}}[SR](){queueMicrotask(()=>this.emit("close"))}[vR](e){let r=!0;if(!e)this[qn]=void 0,r=!1;else if(Array.isArray(e)){let[n,...o]=e;this.emit(n,...o)}else this[qn]=e,this.emit("entry",e),e.emittedEnd||(e.on("end",()=>this[Cv]()),r=!1);return r}[Cv](){do;while(this[vR](this[Bn].shift()));if(!this[Bn].length){let e=this[qn];!e||e.flowing||e.size===e.remain?this[ia]||this.emit("drain"):e.once("drain",()=>this.emit("drain"))}}[kv](e,r){let n=this[Fi];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[br]="header",this[Fi]=void 0,n.end()),i.length}[xR](e,r){let n=this[Fi],o=this[kv](e,r);return!this[Fi]&&n&&this[wR](n),o}[Pi](e,r,n){!this[Bn].length&&!this[qn]?this.emit(e,r,n):this[Bn].push([e,r,n])}[wR](e){switch(this[Pi]("meta",this[Ro]),e.type){case"ExtendedHeader":case"OldExtendedHeader":this[dn]=pn.parse(this[Ro],this[dn],!1);break;case"GlobalExtendedHeader":this[lc]=pn.parse(this[Ro],this[lc],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let r=this[dn]??Object.create(null);this[dn]=r,r.path=this[Ro].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let r=this[dn]||Object.create(null);this[dn]=r,r.linkpath=this[Ro].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+e.type)}}abort(e){this[Do]=!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[Do])return n?.(),!1;if((this[Ke]===void 0||this.brotli===void 0&&this[Ke]===!1)&&e){if(this[Se]&&(e=Buffer.concat([this[Se],e]),this[Se]=void 0),e.length<Tv.length)return this[Se]=e,n?.(),!0;for(let a=0;this[Ke]===void 0&&a<Tv.length;a++)e[a]!==Tv[a]&&(this[Ke]=!1);let s=this.brotli===void 0;if(this[Ke]===!1&&s)if(e.length<512)if(this[No])this.brotli=!0;else return this[Se]=e,n?.(),!0;else try{new Qt(e.subarray(0,512)),this.brotli=!1}catch{this.brotli=!0}if(this[Ke]===void 0||this[Ke]===!1&&this.brotli){let a=this[No];this[No]=!1,this[Ke]=this[Ke]===void 0?new Jp({}):new Qp({}),this[Ke].on("data",u=>this[rd](u)),this[Ke].on("error",u=>this.abort(u)),this[Ke].on("end",()=>{this[No]=!0,this[rd]()}),this[ia]=!0;let l=!!this[Ke][a?"end":"write"](e);return this[ia]=!1,n?.(),l}}this[ia]=!0,this[Ke]?this[Ke].write(e):this[rd](e),this[ia]=!1;let i=this[Bn].length?!1:this[qn]?this[qn].flowing:!0;return!i&&!this[Bn].length&&this[qn]?.once("drain",()=>this.emit("drain")),n?.(),i}[Rv](e){e&&!this[Do]&&(this[Se]=this[Se]?Buffer.concat([this[Se],e]):e)}[od](){if(this[No]&&!this[Av]&&!this[Do]&&!this[cc]){this[Av]=!0;let e=this[Fi];if(e&&e.blockRemain){let r=this[Se]?this[Se].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${e.blockRemain} more bytes, only ${r} available)`,{entry:e}),this[Se]&&e.write(this[Se]),e.end()}this[Pi](id)}}[rd](e){if(this[cc]&&e)this[Rv](e);else if(!e&&!this[Se])this[od]();else if(e){if(this[cc]=!0,this[Se]){this[Rv](e);let r=this[Se];this[Se]=void 0,this[nd](r)}else this[nd](e);for(;this[Se]&&this[Se]?.length>=512&&!this[Do]&&!this[ad];){let r=this[Se];this[Se]=void 0,this[nd](r)}this[cc]=!1}(!this[Se]||this[No])&&this[od]()}[nd](e){let r=0,n=e.length;for(;r+512<=n&&!this[Do]&&!this[ad];)switch(this[br]){case"begin":case"header":this[ER](e,r),r+=512;break;case"ignore":case"body":r+=this[kv](e,r);break;case"meta":r+=this[xR](e,r);break;default:throw new Error("invalid state: "+this[br])}r<n&&(this[Se]?this[Se]=Buffer.concat([e.subarray(r),this[Se]]):this[Se]=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[Do]||(this[Ke]?(e&&this[Ke].write(e),this[Ke].end()):(this[No]=!0,this.brotli===void 0&&(e=e||Buffer.alloc(0)),e&&this.write(e),this[od]())),this}};var mn=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 _H=t=>{let e=t.onReadEntry;t.onReadEntry=e?r=>{e(r),r.resume()}:r=>r.resume()},Nv=(t,e)=>{let r=new Map(e.map(i=>[mn(i),!0])),n=t.filter,o=(i,s="")=>{let a=s||(0,ld.parse)(i).root||".",l;if(i===a)l=!1;else{let u=r.get(i);u!==void 0?l=u:l=o((0,ld.dirname)(i),a)}return r.set(i,l),l};t.filter=n?(i,s)=>n(i,s)&&o(mn(i)):i=>o(mn(i))},OH=t=>{let e=new zn(t),r=t.file,n;try{let o=$i.default.statSync(r),i=t.maxReadSize||16*1024*1024;if(o.size<i)e.end($i.default.readFileSync(r));else{let s=0,a=Buffer.allocUnsafe(i);for(n=$i.default.openSync(r,"r");s<o.size;){let l=$i.default.readSync(n,a,0,i,s);s+=l,e.write(a.subarray(0,l))}e.end()}}finally{if(typeof n=="number")try{$i.default.closeSync(n)}catch{}}},TH=(t,e)=>{let r=new zn(t),n=t.maxReadSize||16*1024*1024,o=t.file;return new Promise((s,a)=>{r.on("error",a),r.on("end",s),$i.default.stat(o,(l,u)=>{if(l)a(l);else{let c=new Ci(o,{readSize:n,size:u.size});c.on("error",a),c.pipe(r)}})})},Un=fn(OH,TH,t=>new zn(t),t=>new zn(t),(t,e)=>{e?.length&&Nv(t,e),t.noResume||_H(t)});var hc=Z(require("fs"),1);var $r=Z(require("fs"),1);var $v=Z(require("path"),1);var Dv=(t,e,r)=>(t&=4095,r&&(t=(t|384)&-19),e&&(t&256&&(t|=64),t&32&&(t|=8),t&4&&(t|=1)),t);var OR=require("node:path"),{isAbsolute:CH,parse:_R}=OR.win32,uc=t=>{let e="",r=_R(t);for(;CH(t)||r.root;){let n=t.charAt(0)==="/"&&t.slice(0,4)!=="//?/"?"/":r.root;t=t.slice(n.length),e+=n,r=_R(t)}return[e,t]};var cd=["|","<",">","?",":"],Fv=cd.map(t=>String.fromCharCode(61440+t.charCodeAt(0))),AH=new Map(cd.map((t,e)=>[t,Fv[e]])),kH=new Map(Fv.map((t,e)=>[t,cd[e]])),Pv=t=>cd.reduce((e,r)=>e.split(r).join(AH.get(r)),t),TR=t=>Fv.reduce((e,r)=>e.split(r).join(kH.get(r)),t);var DR=(t,e)=>e?(t=ee(t).replace(/^\.(\/|$)/,""),mn(e)+"/"+t):ee(t),RH=16*1024*1024,AR=Symbol("process"),kR=Symbol("file"),RR=Symbol("directory"),Lv=Symbol("symlink"),NR=Symbol("hardlink"),fc=Symbol("header"),ud=Symbol("read"),jv=Symbol("lstat"),fd=Symbol("onlstat"),qv=Symbol("onread"),Bv=Symbol("onreadlink"),zv=Symbol("openfile"),Uv=Symbol("onopenfile"),Fo=Symbol("close"),pd=Symbol("mode"),Wv=Symbol("awaitDrain"),Mv=Symbol("ondrain"),hn=Symbol("prefix"),pc=class extends $t{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=sc(r);super(),this.path=ee(e),this.portable=!!n.portable,this.maxReadSize=n.maxReadSize||RH,this.linkCache=n.linkCache||new Map,this.statCache=n.statCache||new Map,this.preservePaths=!!n.preservePaths,this.cwd=ee(n.cwd||process.cwd()),this.strict=!!n.strict,this.noPax=!!n.noPax,this.noMtime=!!n.noMtime,this.mtime=n.mtime,this.prefix=n.prefix?ee(n.prefix):void 0,typeof n.onwarn=="function"&&this.on("warn",n.onwarn);let o=!1;if(!this.preservePaths){let[s,a]=uc(this.path);s&&typeof a=="string"&&(this.path=a,o=s)}this.win32=!!n.win32||process.platform==="win32",this.win32&&(this.path=TR(this.path.replace(/\\/g,"/")),e=e.replace(/\\/g,"/")),this.absolute=ee(n.absolute||$v.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[fd](i):this[jv]()}warn(e,r,n={}){return Di(this,e,r,n)}emit(e,...r){return e==="error"&&(this.#e=!0),super.emit(e,...r)}[jv](){$r.default.lstat(this.absolute,(e,r)=>{if(e)return this.emit("error",e);this[fd](r)})}[fd](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=NH(e),this.emit("stat",e),this[AR]()}[AR](){switch(this.type){case"File":return this[kR]();case"Directory":return this[RR]();case"SymbolicLink":return this[Lv]();default:return this.end()}}[pd](e){return Dv(e,this.type==="Directory",this.portable)}[hn](e){return DR(e,this.prefix)}[fc](){if(!this.stat)throw new Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.header=new Qt({path:this[hn](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[hn](this.linkpath):this.linkpath,mode:this[pd](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 pn({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[hn](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[hn](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)}[RR](){if(!this.stat)throw new Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[fc](),this.end()}[Lv](){$r.default.readlink(this.absolute,(e,r)=>{if(e)return this.emit("error",e);this[Bv](r)})}[Bv](e){this.linkpath=ee(e),this[fc](),this.end()}[NR](e){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=ee($v.default.relative(this.cwd,e)),this.stat.size=0,this[fc](),this.end()}[kR](){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[NR](r);this.linkCache.set(e,this.absolute)}if(this[fc](),this.stat.size===0)return this.end();this[zv]()}[zv](){$r.default.open(this.absolute,"r",(e,r)=>{if(e)return this.emit("error",e);this[Uv](r)})}[Uv](e){if(this.fd=e,this.#e)return this[Fo]();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[ud]()}[ud](){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");$r.default.read(e,r,n,o,i,(s,a)=>{if(s)return this[Fo](()=>this.emit("error",s));this[qv](a)})}[Fo](e=()=>{}){this.fd!==void 0&&$r.default.close(this.fd,e)}[qv](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[Fo](()=>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[Fo](()=>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[Mv]():this[Wv](()=>this[Mv]())}[Wv](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)}[Mv](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[Fo](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[ud]()}},dd=class extends pc{sync=!0;[jv](){this[fd]($r.default.lstatSync(this.absolute))}[Lv](){this[Bv]($r.default.readlinkSync(this.absolute))}[zv](){this[Uv]($r.default.openSync(this.absolute,"r"))}[ud](){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 a=$r.default.readSync(r,n,o,i,s);this[qv](a),e=!1}finally{if(e)try{this[Fo](()=>{})}catch{}}}[Wv](e){e()}[Fo](e=()=>{}){this.fd!==void 0&&$r.default.closeSync(this.fd),e()}},md=class extends $t{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 Di(this,e,r,n)}constructor(e,r={}){let n=sc(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=ee(e.path),this.mode=e.mode!==void 0?this[pd](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?ee(e.linkpath):void 0,typeof n.onwarn=="function"&&this.on("warn",n.onwarn);let i=!1;if(!this.preservePaths){let[a,l]=uc(this.path);a&&typeof l=="string"&&(this.path=l,i=a)}this.remain=e.size,this.blockRemain=e.startBlockSize,this.header=new Qt({path:this[hn](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[hn](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 pn({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[hn](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[hn](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)}[hn](e){return DR(e,this.prefix)}[pd](e){return Dv(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}},NH=t=>t.isFile()?"File":t.isDirectory()?"Directory":t.isSymbolicLink()?"SymbolicLink":"Unsupported";var Jv=Z(require("path"),1);var wd=class{path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor(e,r){this.path=e||"./",this.absolute=r}},FR=Buffer.alloc(1024),hd=Symbol("onStat"),dc=Symbol("ended"),Lr=Symbol("queue"),sa=Symbol("current"),Li=Symbol("process"),mc=Symbol("processing"),PR=Symbol("processJob"),jr=Symbol("jobs"),Hv=Symbol("jobDone"),gd=Symbol("addFSEntry"),MR=Symbol("addTarEntry"),Gv=Symbol("stat"),Zv=Symbol("readdir"),yd=Symbol("onreaddir"),bd=Symbol("pipe"),$R=Symbol("entry"),Kv=Symbol("entryOpt"),vd=Symbol("writeEntryClass"),LR=Symbol("write"),Vv=Symbol("ondrain"),Po=class extends $t{opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[vd];onWriteEntry;[Lr];[jr]=0;[mc]=!1;[dc]=!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=ee(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[vd]=pc,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 Zp(e.gzip)),e.brotli&&(typeof e.brotli!="object"&&(e.brotli={}),this.zip=new Xp(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[Vv]()),this.on("resume",()=>r.resume())}else this.on("drain",this[Vv]);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[Lr]=new yr,this[jr]=0,this.jobs=Number(e.jobs)||4,this[mc]=!1,this[dc]=!1}[LR](e){return super.write(e)}add(e){return this.write(e),this}end(e){return e&&this.add(e),this[dc]=!0,this[Li](),this}write(e){if(this[dc])throw new Error("write after end");return e instanceof oa?this[MR](e):this[gd](e),this.flowing}[MR](e){let r=ee(Jv.default.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else{let n=new wd(e.path,r);n.entry=new md(e,this[Kv](n)),n.entry.on("end",()=>this[Hv](n)),this[jr]+=1,this[Lr].push(n)}this[Li]()}[gd](e){let r=ee(Jv.default.resolve(this.cwd,e));this[Lr].push(new wd(e,r)),this[Li]()}[Gv](e){e.pending=!0,this[jr]+=1;let r=this.follow?"stat":"lstat";hc.default[r](e.absolute,(n,o)=>{e.pending=!1,this[jr]-=1,n?this.emit("error",n):this[hd](e,o)})}[hd](e,r){this.statCache.set(e.absolute,r),e.stat=r,this.filter(e.path,r)||(e.ignore=!0),this[Li]()}[Zv](e){e.pending=!0,this[jr]+=1,hc.default.readdir(e.absolute,(r,n)=>{if(e.pending=!1,this[jr]-=1,r)return this.emit("error",r);this[yd](e,n)})}[yd](e,r){this.readdirCache.set(e.absolute,r),e.readdir=r,this[Li]()}[Li](){if(!this[mc]){this[mc]=!0;for(let e=this[Lr].head;e&&this[jr]<this.jobs;e=e.next)if(this[PR](e.value),e.value.ignore){let r=e.next;this[Lr].removeNode(e),e.next=r}this[mc]=!1,this[dc]&&!this[Lr].length&&this[jr]===0&&(this.zip?this.zip.end(FR):(super.write(FR),super.end()))}}get[sa](){return this[Lr]&&this[Lr].head&&this[Lr].head.value}[Hv](e){this[Lr].shift(),this[jr]-=1,this[Li]()}[PR](e){if(!e.pending){if(e.entry){e===this[sa]&&!e.piped&&this[bd](e);return}if(!e.stat){let r=this.statCache.get(e.absolute);r?this[hd](e,r):this[Gv](e)}if(e.stat&&!e.ignore){if(!this.noDirRecurse&&e.stat.isDirectory()&&!e.readdir){let r=this.readdirCache.get(e.absolute);if(r?this[yd](e,r):this[Zv](e),!e.readdir)return}if(e.entry=this[$R](e),!e.entry){e.ignore=!0;return}e===this[sa]&&!e.piped&&this[bd](e)}}}[Kv](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}}[$R](e){this[jr]+=1;try{let r=new this[vd](e.path,this[Kv](e));return this.onWriteEntry?.(r),r.on("end",()=>this[Hv](e)).on("error",n=>this.emit("error",n))}catch(r){this.emit("error",r)}}[Vv](){this[sa]&&this[sa].entry&&this[sa].entry.resume()}[bd](e){e.piped=!0,e.readdir&&e.readdir.forEach(o=>{let i=e.path,s=i==="./"?"":i.replace(/\/*$/,"/");this[gd](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={}){Di(this,e,r,n)}},ji=class extends Po{sync=!0;constructor(e){super(e),this[vd]=dd}pause(){}resume(){}[Gv](e){let r=this.follow?"statSync":"lstatSync";this[hd](e,hc.default[r](e.absolute))}[Zv](e){this[yd](e,hc.default.readdirSync(e.absolute))}[bd](e){let r=e.entry,n=this.zip;if(e.readdir&&e.readdir.forEach(o=>{let i=e.path,s=i==="./"?"":i.replace(/\/*$/,"/");this[gd](s+o)}),!r)throw new Error("Cannot pipe without source");n?r.on("data",o=>{n.write(o)}):r.on("data",o=>{super[LR](o)})}};var DH=(t,e)=>{let r=new ji(t),n=new ra(t.file,{mode:t.mode||438});r.pipe(n),jR(r,e)},FH=(t,e)=>{let r=new Po(t),n=new $n(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 qR(r,e),o},jR=(t,e)=>{e.forEach(r=>{r.charAt(0)==="@"?Un({file:Yv.default.resolve(t.cwd,r.slice(1)),sync:!0,noResume:!0,onReadEntry:n=>t.add(n)}):t.add(r)}),t.end()},qR=async(t,e)=>{for(let r=0;r<e.length;r++){let n=String(e[r]);n.charAt(0)==="@"?await Un({file:Yv.default.resolve(String(t.cwd),n.slice(1)),noResume:!0,onReadEntry:o=>{t.add(o)}}):t.add(n)}t.end()},PH=(t,e)=>{let r=new ji(t);return jR(r,e),r},MH=(t,e)=>{let r=new Po(t);return qR(r,e),r},$H=fn(DH,FH,PH,MH,(t,e)=>{if(!e?.length)throw new TypeError("no paths specified to add to archive")});var w0=Z(require("node:fs"),1);var rN=Z(require("node:assert"),1),v0=require("node:crypto"),ue=Z(require("node:fs"),1),yn=Z(require("node:path"),1);var Xv=Z(require("fs"),1),LH=process.env.__FAKE_PLATFORM__||process.platform,jH=LH==="win32",{O_CREAT:qH,O_TRUNC:BH,O_WRONLY:zH}=Xv.default.constants,BR=Number(process.env.__FAKE_FS_O_FILENAME__)||Xv.default.constants.UV_FS_O_FILEMAP||0,UH=jH&&!!BR,WH=512*1024,HH=BR|BH|qH|zH,Qv=UH?t=>t<WH?HH:"w":()=>"w";var gc=Z(require("node:fs"),1),aa=Z(require("node:path"),1),e0=(t,e,r)=>{try{return gc.default.lchownSync(t,e,r)}catch(n){if(n?.code!=="ENOENT")throw n}},xd=(t,e,r,n)=>{gc.default.lchown(t,e,r,o=>{n(o&&o?.code!=="ENOENT"?o:null)})},KH=(t,e,r,n,o)=>{if(e.isDirectory())t0(aa.default.resolve(t,e.name),r,n,i=>{if(i)return o(i);let s=aa.default.resolve(t,e.name);xd(s,r,n,o)});else{let i=aa.default.resolve(t,e.name);xd(i,r,n,o)}},t0=(t,e,r,n)=>{gc.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 xd(t,e,r,n);let s=i.length,a=null,l=u=>{if(!a){if(u)return n(a=u);if(--s===0)return xd(t,e,r,n)}};for(let u of i)KH(t,u,e,r,l)})},VH=(t,e,r,n)=>{e.isDirectory()&&r0(aa.default.resolve(t,e.name),r,n),e0(aa.default.resolve(t,e.name),r,n)},r0=(t,e,r)=>{let n;try{n=gc.default.readdirSync(t,{withFileTypes:!0})}catch(o){let i=o;if(i?.code==="ENOENT")return;if(i?.code==="ENOTDIR"||i?.code==="ENOTSUP")return e0(t,e,r);throw i}for(let o of n)VH(t,o,e,r);return e0(t,e,r)};var er=Z(require("fs"),1);var n0=require("path");var Mo=require("fs"),vr=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||Mo.mkdir,t.mkdirAsync=t.mkdirAsync?t.mkdirAsync:async(n,o)=>new Promise((i,s)=>e.mkdir(n,o,(a,l)=>a?s(a):i(l))),t.stat=t.stat||r.stat||Mo.stat,t.statAsync=t.statAsync?t.statAsync:async n=>new Promise((o,i)=>e.stat(n,(s,a)=>s?i(s):o(a))),t.statSync=t.statSync||r.statSync||Mo.statSync,t.mkdirSync=t.mkdirSync||r.mkdirSync||Mo.mkdirSync,e};var gn=(t,e,r)=>{let n=(0,n0.dirname)(t),o={...vr(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 gn(t,o,gn(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}}},Wn=Object.assign(async(t,e,r)=>{let n=vr(e);n.recursive=!1;let o=(0,n0.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 Wn(o,n).then(a=>Wn(t,n,a));if(s&&s.code!=="EEXIST"&&s.code!=="EROFS")throw i;return n.statAsync(t).then(a=>{if(a.isDirectory())return r;throw i},()=>{throw i})})},{sync:gn});var a0=require("path");var o0=require("path"),i0=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"?i0(t,(0,o0.dirname)(e),e):void 0})},s0=(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"?s0(t,(0,o0.dirname)(e),e):void 0}};var la=(t,e)=>{let r=vr(e);if(r.recursive=!0,(0,a0.dirname)(t)===t)return r.mkdirSync(t,r);let o=s0(r,t);try{return r.mkdirSync(t,r),o}catch(i){let s=i;if(s&&s.code==="ENOENT")return gn(t,r);throw i}},yc=Object.assign(async(t,e)=>{let r={...vr(e),recursive:!0};return(0,a0.dirname)(t)===t?await r.mkdirAsync(t,r):i0(r,t).then(o=>r.mkdirAsync(t,r).then(i=>o||i).catch(i=>{let s=i;if(s&&s.code==="ENOENT")return Wn(t,r);throw i}))},{sync:la});var Ed=require("path"),GH=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform,l0=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,Ed.resolve)(t),GH==="win32"){let e=/[*|"<>?:]/,{root:r}=(0,Ed.parse)(t);if(e.test(t.substring(r.length)))throw Object.assign(new Error("Illegal characters in path."),{path:t,code:"EINVAL"})}return t};var Sd=require("fs");var ZH=process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version,c0=ZH.replace(/^v/,"").split("."),zR=+c0[0]>10||+c0[0]==10&&+c0[1]>=12,bc=zR?t=>vr(t).mkdirSync===Sd.mkdirSync:()=>!1,Id=Object.assign(zR?t=>vr(t).mkdir===Sd.mkdir:()=>!1,{sync:bc});var _d=(t,e)=>{t=l0(t);let r=vr(e);return bc(r)?la(t,r):gn(t,r)};var UR=Object.assign(async(t,e)=>{t=l0(t);let r=vr(e);return Id(r)?yc(t,r):Wn(t,r)},{mkdirpSync:_d,mkdirpNative:yc,mkdirpNativeSync:la,mkdirpManual:Wn,mkdirpManualSync:gn,sync:_d,native:yc,nativeSync:la,manual:Wn,manualSync:gn,useNative:Id,useNativeSync:bc});var Ec=Z(require("node:path"),1);var vc=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"}};var wc=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 Od=(t,e)=>t.get(ee(e)),xc=(t,e,r)=>t.set(ee(e),r),JH=(t,e)=>{er.default.stat(t,(r,n)=>{(r||!n.isDirectory())&&(r=new vc(t,r?.code||"ENOTDIR")),e(r)})},WR=(t,e,r)=>{t=ee(t);let n=e.umask??18,o=e.mode|448,i=(o&n)!==0,s=e.uid,a=e.gid,l=typeof s=="number"&&typeof a=="number"&&(s!==e.processUid||a!==e.processGid),u=e.preserve,c=e.unlink,f=e.cache,p=ee(e.cwd),d=(y,v)=>{y?r(y):(xc(f,t,!0),v&&l?t0(v,s,a,x=>d(x)):i?er.default.chmod(t,o,r):r())};if(f&&Od(f,t)===!0)return d();if(t===p)return JH(t,d);if(u)return UR(t,{mode:o}).then(y=>d(null,y??void 0),d);let b=ee(Ec.default.relative(p,t)).split("/");Td(p,b,o,f,c,p,void 0,d)},Td=(t,e,r,n,o,i,s,a)=>{if(!e.length)return a(null,s);let l=e.shift(),u=ee(Ec.default.resolve(t+"/"+l));if(Od(n,u))return Td(u,e,r,n,o,i,s,a);er.default.mkdir(u,r,HR(u,e,r,n,o,i,s,a))},HR=(t,e,r,n,o,i,s,a)=>l=>{l?er.default.lstat(t,(u,c)=>{if(u)u.path=u.path&&ee(u.path),a(u);else if(c.isDirectory())Td(t,e,r,n,o,i,s,a);else if(o)er.default.unlink(t,f=>{if(f)return a(f);er.default.mkdir(t,r,HR(t,e,r,n,o,i,s,a))});else{if(c.isSymbolicLink())return a(new wc(t,t+"/"+e.join("/")));a(l)}}):(s=s||t,Td(t,e,r,n,o,i,s,a))},YH=t=>{let e=!1,r;try{e=er.default.statSync(t).isDirectory()}catch(n){r=n?.code}finally{if(!e)throw new vc(t,r??"ENOTDIR")}},KR=(t,e)=>{t=ee(t);let r=e.umask??18,n=e.mode|448,o=(n&r)!==0,i=e.uid,s=e.gid,a=typeof i=="number"&&typeof s=="number"&&(i!==e.processUid||s!==e.processGid),l=e.preserve,u=e.unlink,c=e.cache,f=ee(e.cwd),p=y=>{xc(c,t,!0),y&&a&&r0(y,i,s),o&&er.default.chmodSync(t,n)};if(c&&Od(c,t)===!0)return p();if(t===f)return YH(f),p();if(l)return p(_d(t,n)??void 0);let h=ee(Ec.default.relative(f,t)).split("/"),b;for(let y=h.shift(),v=f;y&&(v+="/"+y);y=h.shift())if(v=ee(Ec.default.resolve(v)),!Od(c,v))try{er.default.mkdirSync(v,n),b=b||v,xc(c,v,!0)}catch{let T=er.default.lstatSync(v);if(T.isDirectory()){xc(c,v,!0);continue}else if(u){er.default.unlinkSync(v),er.default.mkdirSync(v,n),b=b||v,xc(c,v,!0);continue}else if(T.isSymbolicLink())return new wc(v,v+"/"+h.join("/"))}return p(b)};var u0=Object.create(null),{hasOwnProperty:XH}=Object.prototype,Cd=t=>(XH.call(u0,t)||(u0[t]=t.normalize("NFD")),u0[t]);var f0=require("node:path");var QH=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,eK=QH==="win32",tK=t=>t.split("/").slice(0,-1).reduce((r,n)=>{let o=r[r.length-1];return o!==void 0&&(n=(0,f0.join)(o,n)),r.push(n||"/"),r},[]),Ad=class{#e=new Map;#t=new Map;#n=new Set;reserve(e,r){e=eK?["win32 parallelization disabled"]:e.map(o=>mn((0,f0.join)(Cd(o))).toLowerCase());let n=new Set(e.map(o=>tK(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 a=this.#e.get(s);if(!a||a?.[0]!==e)continue;let l=a[1];if(!l){this.#e.delete(s);continue}if(a.shift(),typeof l=="function")i.add(l);else for(let u of l)i.add(u)}for(let s of o){let a=this.#e.get(s),l=a?.[0];if(!(!a||!(l instanceof Set)))if(l.size===1&&a.length===1){this.#e.delete(s);continue}else if(l.size===1){a.shift();let u=a[0];typeof u=="function"&&i.add(u)}else l.delete(e)}return this.#n.delete(e),i.forEach(s=>this.#i(s)),!0}};var VR=Symbol("onEntry"),m0=Symbol("checkFs"),GR=Symbol("checkFs2"),Nd=Symbol("pruneCache"),h0=Symbol("isReusable"),wr=Symbol("makeFs"),g0=Symbol("file"),y0=Symbol("directory"),Dd=Symbol("link"),ZR=Symbol("symlink"),JR=Symbol("hardlink"),YR=Symbol("unsupported"),XR=Symbol("checkPath"),$o=Symbol("mkdir"),yt=Symbol("onError"),kd=Symbol("pending"),QR=Symbol("pend"),ca=Symbol("unpend"),p0=Symbol("ended"),d0=Symbol("maybeClose"),b0=Symbol("skip"),Sc=Symbol("doChown"),Ic=Symbol("uid"),_c=Symbol("gid"),Oc=Symbol("checkedCwd"),rK=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,Tc=rK==="win32",nK=1024,oK=(t,e)=>{if(!Tc)return ue.default.unlink(t,e);let r=t+".DELETE."+(0,v0.randomBytes)(16).toString("hex");ue.default.rename(t,r,n=>{if(n)return e(n);ue.default.unlink(r,e)})},iK=t=>{if(!Tc)return ue.default.unlinkSync(t);let e=t+".DELETE."+(0,v0.randomBytes)(16).toString("hex");ue.default.renameSync(t,e),ue.default.unlinkSync(e)},eN=(t,e,r)=>t!==void 0&&t===t>>>0?t:e!==void 0&&e===e>>>0?e:r,tN=t=>mn(ee(Cd(t))).toLowerCase(),sK=(t,e)=>{e=tN(e);for(let r of t.keys()){let n=tN(r);(n===e||n.indexOf(e+"/")===0)&&t.delete(r)}},aK=t=>{for(let e of t.keys())t.delete(e)},ua=class extends zn{[p0]=!1;[Oc]=!1;[kd]=0;reservations=new Ad;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[p0]=!0,this[d0]()},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:nK,this.forceChown=e.forceChown===!0,this.win32=!!e.win32||Tc,this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=ee(yn.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[VR](r))}warn(e,r,n={}){return(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(n.recoverable=!1),super.warn(e,r,n)}[d0](){this[p0]&&this[kd]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[XR](e){let r=ee(e.path),n=r.split("/");if(this.strip){if(n.length<this.strip)return!1;if(e.type==="Link"){let o=ee(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("..")||Tc&&/^[a-z]:\.\.$/i.test(n[0]??""))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:e,path:r}),!1;let[o,i]=uc(r);o&&(e.path=String(i),this.warn("TAR_ENTRY_INFO",`stripping ${o} from absolute path`,{entry:e,path:r}))}if(yn.default.isAbsolute(e.path)?e.absolute=ee(yn.default.resolve(e.path)):e.absolute=ee(yn.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:ee(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}=yn.default.win32.parse(String(e.absolute));e.absolute=o+Pv(String(e.absolute).slice(o.length));let{root:i}=yn.default.win32.parse(e.path);e.path=i+Pv(e.path.slice(i.length))}return!0}[VR](e){if(!this[XR](e))return e.resume();switch(rN.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[m0](e);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[YR](e)}}[yt](e,r){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:r}),this[ca](),r.resume())}[$o](e,r,n){WR(ee(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)}[Sc](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}[Ic](e){return eN(this.uid,e.uid,this.processUid)}[_c](e){return eN(this.gid,e.gid,this.processGid)}[g0](e,r){let n=typeof e.mode=="number"?e.mode&4095:this.fmode,o=new $n(String(e.absolute),{flags:Qv(e.size),mode:n,autoClose:!1});o.on("error",l=>{o.fd&&ue.default.close(o.fd,()=>{}),o.write=()=>!0,this[yt](l,e),r()});let i=1,s=l=>{if(l){o.fd&&ue.default.close(o.fd,()=>{}),this[yt](l,e),r();return}--i===0&&o.fd!==void 0&&ue.default.close(o.fd,u=>{u?this[yt](u,e):this[ca](),r()})};o.on("finish",()=>{let l=String(e.absolute),u=o.fd;if(typeof u=="number"&&e.mtime&&!this.noMtime){i++;let c=e.atime||new Date,f=e.mtime;ue.default.futimes(u,c,f,p=>p?ue.default.utimes(l,c,f,d=>s(d&&p)):s())}if(typeof u=="number"&&this[Sc](e)){i++;let c=this[Ic](e),f=this[_c](e);typeof c=="number"&&typeof f=="number"&&ue.default.fchown(u,c,f,p=>p?ue.default.chown(l,c,f,d=>s(d&&p)):s())}s()});let a=this.transform&&this.transform(e)||e;a!==e&&(a.on("error",l=>{this[yt](l,e),r()}),e.pipe(a)),a.pipe(o)}[y0](e,r){let n=typeof e.mode=="number"?e.mode&4095:this.dmode;this[$o](String(e.absolute),n,o=>{if(o){this[yt](o,e),r();return}let i=1,s=()=>{--i===0&&(r(),this[ca](),e.resume())};e.mtime&&!this.noMtime&&(i++,ue.default.utimes(String(e.absolute),e.atime||new Date,e.mtime,s)),this[Sc](e)&&(i++,ue.default.chown(String(e.absolute),Number(this[Ic](e)),Number(this[_c](e)),s)),s()})}[YR](e){e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume()}[ZR](e,r){this[Dd](e,String(e.linkpath),"symlink",r)}[JR](e,r){let n=ee(yn.default.resolve(this.cwd,String(e.linkpath)));this[Dd](e,n,"link",r)}[QR](){this[kd]++}[ca](){this[kd]--,this[d0]()}[b0](e){this[ca](),e.resume()}[h0](e,r){return e.type==="File"&&!this.unlink&&r.isFile()&&r.nlink<=1&&!Tc}[m0](e){this[QR]();let r=[e.path];e.linkpath&&r.push(e.linkpath),this.reservations.reserve(r,n=>this[GR](e,n))}[Nd](e){e.type==="SymbolicLink"?aK(this.dirCache):e.type!=="Directory"&&sK(this.dirCache,String(e.absolute))}[GR](e,r){this[Nd](e);let n=a=>{this[Nd](e),r(a)},o=()=>{this[$o](this.cwd,this.dmode,a=>{if(a){this[yt](a,e),n();return}this[Oc]=!0,i()})},i=()=>{if(e.absolute!==this.cwd){let a=ee(yn.default.dirname(String(e.absolute)));if(a!==this.cwd)return this[$o](a,this.dmode,l=>{if(l){this[yt](l,e),n();return}s()})}s()},s=()=>{ue.default.lstat(String(e.absolute),(a,l)=>{if(l&&(this.keep||this.newer&&l.mtime>(e.mtime??l.mtime))){this[b0](e),n();return}if(a||this[h0](e,l))return this[wr](null,e,n);if(l.isDirectory()){if(e.type==="Directory"){let u=this.chmod&&e.mode&&(l.mode&4095)!==e.mode,c=f=>this[wr](f??null,e,n);return u?ue.default.chmod(String(e.absolute),Number(e.mode),c):c()}if(e.absolute!==this.cwd)return ue.default.rmdir(String(e.absolute),u=>this[wr](u??null,e,n))}if(e.absolute===this.cwd)return this[wr](null,e,n);oK(String(e.absolute),u=>this[wr](u??null,e,n))})};this[Oc]?i():o()}[wr](e,r,n){if(e){this[yt](e,r),n();return}switch(r.type){case"File":case"OldFile":case"ContiguousFile":return this[g0](r,n);case"Link":return this[JR](r,n);case"SymbolicLink":return this[ZR](r,n);case"Directory":case"GNUDumpDir":return this[y0](r,n)}}[Dd](e,r,n,o){ue.default[n](r,String(e.absolute),i=>{i?this[yt](i,e):(this[ca](),e.resume()),o()})}},Rd=t=>{try{return[null,t()]}catch(e){return[e,null]}},Cc=class extends ua{sync=!0;[wr](e,r){return super[wr](e,r,()=>{})}[m0](e){if(this[Nd](e),!this[Oc]){let i=this[$o](this.cwd,this.dmode);if(i)return this[yt](i,e);this[Oc]=!0}if(e.absolute!==this.cwd){let i=ee(yn.default.dirname(String(e.absolute)));if(i!==this.cwd){let s=this[$o](i,this.dmode);if(s)return this[yt](s,e)}}let[r,n]=Rd(()=>ue.default.lstatSync(String(e.absolute)));if(n&&(this.keep||this.newer&&n.mtime>(e.mtime??n.mtime)))return this[b0](e);if(r||this[h0](e,n))return this[wr](null,e);if(n.isDirectory()){if(e.type==="Directory"){let s=this.chmod&&e.mode&&(n.mode&4095)!==e.mode,[a]=s?Rd(()=>{ue.default.chmodSync(String(e.absolute),Number(e.mode))}):[];return this[wr](a,e)}let[i]=Rd(()=>ue.default.rmdirSync(String(e.absolute)));this[wr](i,e)}let[o]=e.absolute===this.cwd?[]:Rd(()=>iK(String(e.absolute)));this[wr](o,e)}[g0](e,r){let n=typeof e.mode=="number"?e.mode&4095:this.fmode,o=a=>{let l;try{ue.default.closeSync(i)}catch(u){l=u}(a||l)&&this[yt](a||l,e),r()},i;try{i=ue.default.openSync(String(e.absolute),Qv(e.size),n)}catch(a){return o(a)}let s=this.transform&&this.transform(e)||e;s!==e&&(s.on("error",a=>this[yt](a,e)),e.pipe(s)),s.on("data",a=>{try{ue.default.writeSync(i,a,0,a.length)}catch(l){o(l)}}),s.on("end",()=>{let a=null;if(e.mtime&&!this.noMtime){let l=e.atime||new Date,u=e.mtime;try{ue.default.futimesSync(i,l,u)}catch(c){try{ue.default.utimesSync(String(e.absolute),l,u)}catch{a=c}}}if(this[Sc](e)){let l=this[Ic](e),u=this[_c](e);try{ue.default.fchownSync(i,Number(l),Number(u))}catch(c){try{ue.default.chownSync(String(e.absolute),Number(l),Number(u))}catch{a=a||c}}}o(a)})}[y0](e,r){let n=typeof e.mode=="number"?e.mode&4095:this.dmode,o=this[$o](String(e.absolute),n);if(o){this[yt](o,e),r();return}if(e.mtime&&!this.noMtime)try{ue.default.utimesSync(String(e.absolute),e.atime||new Date,e.mtime)}catch{}if(this[Sc](e))try{ue.default.chownSync(String(e.absolute),Number(this[Ic](e)),Number(this[_c](e)))}catch{}r(),e.resume()}[$o](e,r){try{return KR(ee(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}}[Dd](e,r,n,o){let i=`${n}Sync`;try{ue.default[i](r,String(e.absolute)),o(),e.resume()}catch(s){return this[yt](s,e)}}};var lK=t=>{let e=new Cc(t),r=t.file,n=w0.default.statSync(r),o=t.maxReadSize||16*1024*1024;new Hp(r,{readSize:o,size:n.size}).pipe(e)},cK=(t,e)=>{let r=new ua(t),n=t.maxReadSize||16*1024*1024,o=t.file;return new Promise((s,a)=>{r.on("error",a),r.on("close",s),w0.default.stat(o,(l,u)=>{if(l)a(l);else{let c=new Ci(o,{readSize:n,size:u.size});c.on("error",a),c.pipe(r)}})})},uK=fn(lK,cK,t=>new Cc(t),t=>new ua(t),(t,e)=>{e?.length&&Nv(t,e)});var Lt=Z(require("node:fs"),1),x0=Z(require("node:path"),1);var fK=(t,e)=>{let r=new ji(t),n=!0,o,i;try{try{o=Lt.default.openSync(t.file,"r+")}catch(l){if(l?.code==="ENOENT")o=Lt.default.openSync(t.file,"w+");else throw l}let s=Lt.default.fstatSync(o),a=Buffer.alloc(512);e:for(i=0;i<s.size;i+=512){for(let c=0,f=0;c<512;c+=f){if(f=Lt.default.readSync(o,a,c,a.length-c,i+c),i===0&&a[0]===31&&a[1]===139)throw new Error("cannot append to compressed archives");if(!f)break e}let l=new Qt(a);if(!l.cksumValid)break;let u=512*Math.ceil((l.size||0)/512);if(i+u+512>s.size)break;i+=u,t.mtimeCache&&l.mtime&&t.mtimeCache.set(String(l.path),l.mtime)}n=!1,pK(t,r,i,o,e)}finally{if(n)try{Lt.default.closeSync(o)}catch{}}},pK=(t,e,r,n,o)=>{let i=new ra(t.file,{fd:n,start:r});e.pipe(i),mK(e,o)},dK=(t,e)=>{e=Array.from(e);let r=new Po(t),n=(i,s,a)=>{let l=(d,h)=>{d?Lt.default.close(i,b=>a(d)):a(null,h)},u=0;if(s===0)return l(null,0);let c=0,f=Buffer.alloc(512),p=(d,h)=>{if(d||typeof h>"u")return l(d);if(c+=h,c<512&&h)return Lt.default.read(i,f,c,f.length-c,u+c,p);if(u===0&&f[0]===31&&f[1]===139)return l(new Error("cannot append to compressed archives"));if(c<512)return l(null,u);let b=new Qt(f);if(!b.cksumValid)return l(null,u);let y=512*Math.ceil((b.size??0)/512);if(u+y+512>s||(u+=y+512,u>=s))return l(null,u);t.mtimeCache&&b.mtime&&t.mtimeCache.set(String(b.path),b.mtime),c=0,Lt.default.read(i,f,0,512,u,p)};Lt.default.read(i,f,0,512,u,p)};return new Promise((i,s)=>{r.on("error",s);let a="r+",l=(u,c)=>{if(u&&u.code==="ENOENT"&&a==="r+")return a="w+",Lt.default.open(t.file,a,l);if(u||!c)return s(u);Lt.default.fstat(c,(f,p)=>{if(f)return Lt.default.close(c,()=>s(f));n(c,p.size,(d,h)=>{if(d)return s(d);let b=new $n(t.file,{fd:c,start:h});r.pipe(b),b.on("error",s),b.on("close",i),hK(r,e)})})};Lt.default.open(t.file,a,l)})},mK=(t,e)=>{e.forEach(r=>{r.charAt(0)==="@"?Un({file:x0.default.resolve(t.cwd,r.slice(1)),sync:!0,noResume:!0,onReadEntry:n=>t.add(n)}):t.add(r)}),t.end()},hK=async(t,e)=>{for(let r=0;r<e.length;r++){let n=String(e[r]);n.charAt(0)==="@"?await Un({file:x0.default.resolve(String(t.cwd),n.slice(1)),noResume:!0,onReadEntry:o=>t.add(o)}):t.add(n)}t.end()},qi=fn(fK,dK,()=>{throw new TypeError("file is required")},()=>{throw new TypeError("file is required")},(t,e)=>{if(!lR(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")});var gK=fn(qi.syncFile,qi.asyncFile,qi.syncNoFile,qi.asyncNoFile,(t,e=[])=>{qi.validate?.(t,e),yK(t)}),yK=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 Pd=async(t,e,r)=>{if(r){await(0,Fd.writeFile)(e,Buffer.from(t));return}let n=(0,nN.createWriteStream)(e);try{let o="build/Release/better_sqlite3.node",i=[];i.push((0,E0.pipeline)(oN.Readable.from(Buffer.from(t)),Un({gzip:!0,onReadEntry:s=>{s.path===o&&i.push((0,E0.pipeline)(s,n))}},[o]))),await Promise.all(i)}catch(o){throw n.destroy(),await(0,Fd.rm)(e,{force:!0}),o}},iN=async()=>{let t=await Yk({multiple:!1,accept:[".tar.gz",".node"],strict:!0});return t?{decompressed:!t.name.endsWith(".gz"),arrayBuffer:await t.arrayBuffer()}:null},sN=async t=>(await(0,S0.requestUrl)({url:t,method:"HEAD"})).status,aN=async t=>(await(0,S0.requestUrl)({url:t})).arrayBuffer;var lN=(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))(lN||{}),fa=Jt(0),vK=Jt(t=>t(fa)===4),cN=Jt(null),wK=Jt(t=>{switch(t(fa)){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(cN)}`;default:break}}),xK=Jt(null,(t,e,[r,n])=>{e(fa,4);let o="Failed to install module when "+lN[r];mt(o,n),e(cN,o+": "+(n instanceof Error?n.message:`${n}`))}),EK=()=>{let t=nv(fa),e=nv(xK),r=xt(Jl),n=xt(Dp);return Yt(async()=>{if(!n){e([0,new Error("Cannot find binary version")]);return}t(1);let o;try{if(await sN(r)===404)throw new Error(`Requested module not available (${r}), please open an issue on GitHub`);o=await aN(r)}catch(i){e([1,i]);return}t(2);try{await Pd(o,n,!1)}catch(i){e([2,i]);return}t(3)})},uN=()=>{let t=xt(fa),e=xt(wK),r=xt(Dr),n=EK();return m("div",{className:"zt-auto-install",children:[m(Xl,{name:"Auto Install",desc:"Recommended",button:t===0?"Install":void 0,onClick:n}),t!==0&&m(Xl,{className:Zs("zt-auto-install-status",{"mod-warning":t===4,"mod-success":t===3}),icon:m(IK,{}),name:e,button:t===3?"Reload Plugin":void 0,onClick:()=>r.reloadPlugin()})]})},SK=()=>{let t=xt(vK),[e]=Mt(t?"slash":"check");return m("div",{className:"zt-install-done-icon",style:{display:"contents"},ref:e})},IK=()=>{switch(xt(fa)){case 0:return null;case 1:case 2:return m(Jk,{className:"zt-install-spin-icon",style:{display:"contents"}});case 3:case 4:return m(SK,{})}};var fN=require("obsidian");S();var _K=async t=>{try{let e=await iN();return e?(await Pd(e.arrayBuffer,t,e.decompressed),!0):(W.info("No file selected, skip import module"),!1)}catch(e){return new fN.Notice(`Failed to import module from ${t}: ${e}`),mt("import module "+t,e),!1}},OK=()=>{let[t,e]=L(!1),r=xt(Dp),n=async()=>{if(!r)return;await _K(r)&&e(!0)},o=xt(Jl),i=xt(ov),s=xt(Dr);return m("ol",{children:[m("li",{children:["Download ",m("code",{children:".node.gz"})," file from"," ",m("a",{href:o,children:"GitHub"}),"."]}),m("li",{children:["Select downloaded ",m("code",{children:i})," or uncompressed"," ",m("code",{children:"better-sqlite3.node"}),"to install:",m(TK,{onClick:n,done:t})]}),m("li",{children:["Reload ZotLit:",m(CK,{onClick:()=>s.reloadPlugin()})]})]})},pN=()=>{let[t,e]=L(!1);return m("div",{className:"zt-manual-install",children:[m(Xl,{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)}),m("div",{hidden:!t,children:m(OK,{})})]})},TK=({done:t,onClick:e})=>m("button",{className:Zs({"zt-import-done":t}),onClick:e,children:t?"Library file imported":"Select"}),CK=({disabled:t,onClick:e})=>m("button",{disabled:t,onClick:e,children:"Reload Plugin"});var AK=()=>{let t=xt(Bk);switch(t){case"install":return m(M,{children:["ZotLit requires latest version of ",m("code",{children:"better-sqlite3"})," to be installed. Use one of the method below to install or update it."]});case"reset":return m(M,{children:[m("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,dN.default)(t)}},mN=()=>m(M,{children:[m("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);
|
|
}
|
|
`}),m("div",{className:"zt-install-desc",children:m(AK,{})}),m("div",{className:"zt-install-methods",children:[m(uN,{}),m(pN,{})]})]});var Ac=class extends hN.Modal{constructor(r,n,o,i,s){super(s);this.manifest=r;this.platform=n;this.binaryVersion=o;this.mode=i;this.app=s;this.titleEl.setText("Setup ZotLit"),this.modalEl.addClass("mod-zt-install-guide")}onOpen(){let r=qk();r.set(Dr,this),N.render(m(jk,{initialValues:r.get(),children:m(mN,{})}),this.contentEl)}onClose(){N.unmountComponentAtNode(this.contentEl)}async reloadPlugin(){await this.app.plugins.disablePlugin(this.manifest.id),this.close(),await this.app.plugins.enablePlugin(this.manifest.id)}};var gN=(t,e,r,n)=>{let o=_T();if(!o)throw new Error("Not in desktop app");let i=ST(o);if(i<0)new Hn.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 Hn.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(!IT(o))new Hn.Notice(`Your device (${o.arch}-${o.platform}) is not supported by zotlit`);else{let s=Hy(e);if(!s)throw new Error(`Cannot find binary version for ${e.name} v${e.version}`);try{(0,yN.statSync)(t).isFile()?r==="reset"&&new Ac(e,o,s,r,n).open():new Hn.Notice("Path to database library occupied, please check the location manually: "+t,2e3)}catch(a){let l=a;l.code==="ENOENT"?new Ac(e,o,s,r,n).open():(new Hn.Notice(`Unexpected error while checking path of better-sqlite3, please check the location manually: ${t}, error: ${l}`,2e3),mt("checking better-sqlite3 path:"+t,l))}}},kK=(t,e)=>{if(!Hn.Platform.isDesktopApp)throw new Error("Not in desktop app");let r=Rs(t);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"?gN(r,t,"install",e):(new Hn.Notice(`Failed to load database library: ${n}`),mt("Failed to load database library",n),gN(r,t,"reset",e)),!1}},bN=kK;var Bq=require("path/posix");var no=require("obsidian");var Ae;(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"})(Ae||(Ae={}));var Bi;(function(t){t[t.manual=0]="manual",t[t.auto=1]="auto"})(Bi||(Bi={}));var Md;(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"})(Md||(Md={}));var kc;(function(t){t[t.fullName=0]="fullName",t[t.nameOnly=1]="nameOnly"})(kc||(kc={}));var $d=["attachment","note","annotation"];var Ld=$d.map(t=>`'${t}'`).join(",");var nt=(t="itemID")=>`--sql
|
|
${t} IS NOT NULL
|
|
${t==="itemID"?`AND ${t} NOT IN (SELECT itemID FROM deletedItems)`:""}
|
|
`,xr=(t,e="$itemId")=>typeof t=="boolean"?"":`AND ${t} = ${e}`;var jd=(t,e)=>{for(let r=0;r<t.length;r++)if(t[r]!==e[r])return t[r]-e[r];return 0},RK=new Set(["application/pdf","text/html","application/epub+zip"]),I0=t=>!!t.path,Rc=t=>I0(t)&&!!t.contentType&&RK.has(t.contentType),vN=t=>`obzt-active-atch-${t.itemID}-${t.libraryID}`,_0=(t,e)=>{let r=t.getItem(vN(e));if(!r)return null;let n=parseInt(r,10);return n>0?n:null},pa=(t,e,r)=>t.setItem(vN(e),r.toString());var qd=`--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
|
|
`,Bd=`--sql
|
|
itemAnnotations annots
|
|
JOIN items USING (itemID)
|
|
`;var lEe=`--sql
|
|
SELECT
|
|
${qd},
|
|
annots.parentItemID,
|
|
parentItems.key as parentItem
|
|
FROM
|
|
${Bd}
|
|
JOIN items as parentItems ON annots.parentItemID = parentItems.itemID
|
|
WHERE
|
|
items.key = $annotKey
|
|
AND items.libraryID = $libId
|
|
AND ${nt("items.itemID")}
|
|
`;var dEe=`--sql
|
|
SELECT
|
|
${qd}
|
|
FROM
|
|
${Bd}
|
|
WHERE
|
|
parentItemID = $attachmentId
|
|
AND items.libraryID = $libId
|
|
AND ${nt()}
|
|
`;var zd=`--sql
|
|
items.itemID,
|
|
items.key,
|
|
items.clientDateModified,
|
|
items.dateAdded,
|
|
items.dateModified,
|
|
notes.note,
|
|
notes.title
|
|
`,Ud=`--sql
|
|
itemNotes notes
|
|
JOIN items USING (itemID)
|
|
`;var bEe=`--sql
|
|
SELECT
|
|
${zd},
|
|
notes.parentItemID,
|
|
parentItems.key as parentItem
|
|
FROM
|
|
${Ud}
|
|
JOIN items as parentItems ON notes.parentItemID = parentItems.itemID
|
|
WHERE
|
|
items.key = $noteKey
|
|
AND items.libraryID = $libId
|
|
AND ${nt("items.itemID")}
|
|
`;var EEe=`--sql
|
|
SELECT
|
|
${zd}
|
|
FROM
|
|
${Ud}
|
|
WHERE
|
|
parentItemID = $itemID
|
|
AND items.libraryID = $libId
|
|
AND ${nt()}
|
|
`;var _Ee=`--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 ${nt("atchs.itemID")}
|
|
GROUP BY atchs.itemID
|
|
`;var Nc="betterbibtex",Dc="bbts";var kEe=`--sql
|
|
SELECT
|
|
citationkey as citekey
|
|
FROM
|
|
${Nc}.citationkey
|
|
WHERE
|
|
itemID = $itemID
|
|
AND (libraryID IS NULL OR libraryID = $libId)
|
|
`,REe=`--sql
|
|
SELECT
|
|
citekey
|
|
FROM
|
|
${Dc}.citekeys
|
|
WHERE
|
|
itemID = $itemID
|
|
AND (libraryID IS NULL OR libraryID = $libId)
|
|
`;var PEe=`--sql
|
|
SELECT
|
|
itemID
|
|
FROM
|
|
${Nc}.citationkey
|
|
WHERE
|
|
citationkey = $citekey
|
|
`,MEe=`--sql
|
|
SELECT
|
|
itemID
|
|
FROM
|
|
${Dc}.citekeys
|
|
WHERE
|
|
citekey = $citekey
|
|
`;var Wd=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
|
|
${xr(t||"itemID")}
|
|
AND ${nt()}
|
|
ORDER BY
|
|
itemID,
|
|
orderIndex
|
|
`;var zEe=Wd(!0);function xN(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}function EN(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 O0(t,e){for(var r=0,n=t.length;r<n;++r)e(t[r])}function Hd(t,e){for(var r=t.length,n=new Array(r),o=0;o<r;++o)n[o]=e(t[o]);return n}function Fc(t,e,r){for(var n=e,o=0,i=t.length;o<i;++o)n=r(n,t[o]);return n}var SN=function(t,e){for(var r in t)e(r)};function Pc(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 a=0;;){var l=a;if(l===s)return!0;if(!Pc(t[l],e[l]))return!1;a=l+1|0}else{if(t instanceof Date&&e instanceof Date)return!(t>e||t<e);var u={contents:!0};return SN(t,function(c){if(!Object.prototype.hasOwnProperty.call(e,c)){u.contents=!1;return}}),u.contents&&SN(e,function(c){if(!Object.prototype.hasOwnProperty.call(t,c)||!Pc(e[c],t[c])){u.contents=!1;return}}),u.contents}else return!1}function Kd(t,e){if(e in t)return xN(t[e])}var T0=function(t,e){delete t[e]};function ON(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 da(t){for(var e={},r=t.length,n=0;n<r;++n){var o=t[n];e[o[0]]=o[1]}return e}function IN(t,e){return EN(t,[e])}function Vd(){if(arguments.length===1){let t=arguments;return function(r){return IN(r,t[0])}}return IN(arguments[0],arguments[1])}function _N(t,e){return Fc(t,{},function(r,n){var o=e(n),i=Kd(r,o);return i!==void 0?i.push(n):r[o]=[n],r})}function zi(){if(arguments.length===1){let t=arguments;return function(r){return _N(r,t[0])}}return _N(arguments[0],arguments[1])}function UN(t){}function WN(t){return{}}function TN(t,e){return t[e]}function HN(){if(arguments.length===1){let t=arguments;return function(r){return TN(r,t[0])}}return TN(arguments[0],arguments[1])}var CN=Kd;function KN(){if(arguments.length===1){let t=arguments;return function(r){return CN(r,t[0])}}return CN(arguments[0],arguments[1])}function AN(t,e){return t[e]}function VN(){if(arguments.length===1){let t=arguments;return function(r){return AN(r,t[0])}}return AN(arguments[0],arguments[1])}function GN(t){return Object.entries(t)}var Gd=ON;function ZN(t){return Object.keys(t)}var JN=da;function kN(t,e){return Object.assign({},t,e)}function Ui(){if(arguments.length===1){let t=arguments;return function(r){return kN(r,t[0])}}return kN(arguments[0],arguments[1])}function RN(t,e,r){var n=Ui({},t);return n[e]=r,n}function Zd(){if(arguments.length===2){let t=arguments;return function(r){return RN(r,t[0],t[1])}}return RN(arguments[0],arguments[1],arguments[2])}function NN(t,e,r){return Zd(t,e,r(Kd(t,e)))}function YN(){if(arguments.length===2){let t=arguments;return function(r){return NN(r,t[0],t[1])}}return NN(arguments[0],arguments[1],arguments[2])}function DN(t,e,r){return Zd(t,e,r(t[e]))}function XN(){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 FN(t,e){var r=Ui({},t);return T0(r,e),r}function QN(){if(arguments.length===1){let t=arguments;return function(r){return FN(r,t[0])}}return FN(arguments[0],arguments[1])}function PN(t,e){var r=Ui({},t);return O0(e,function(n){T0(r,n)}),r}function eD(){if(arguments.length===1){let t=arguments;return function(r){return PN(r,t[0])}}return PN(arguments[0],arguments[1])}function MN(t,e){return da(Hd(Object.keys(t),function(r){return[r,e(t[r])]}))}function ma(){if(arguments.length===1){let t=arguments;return function(r){return MN(r,t[0])}}return MN(arguments[0],arguments[1])}function $N(t,e){return da(Hd(Object.keys(t),function(r){return[r,e(r,t[r])]}))}function ha(){if(arguments.length===1){let t=arguments;return function(r){return $N(r,t[0])}}return $N(arguments[0],arguments[1])}function LN(t,e){return da(Fc(Object.keys(t),[],function(r,n){var o=t[n];return e(o)?Vd(r,[n,o]):r}))}function Mc(){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 da(Fc(Object.keys(t),[],function(r,n){var o=t[n];return e(n,o)?Vd(r,[n,o]):r}))}function Jd(){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 Mc(t,function(r){return!e(r)})}function tD(){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 Jd(t,function(r,n){return!e(r,n)})}function rD(){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 Jd(t,function(r,n){return function(i,s){return s.includes(i)}(r,e)})}function Yd(){if(arguments.length===1){let t=arguments;return function(r){return zN(r,t[0])}}return zN(arguments[0],arguments[1])}function nD(t){return Pc(t,{})}function oD(t){return!Pc(t,{})}var C0={__proto__:null,placeholder:UN,makeEmpty:WN,getUnsafe:HN,get:KN,prop:VN,toPairs:GN,values:Gd,keys:ZN,fromPairs:JN,merge:Ui,set:Zd,update:YN,updateUnsafe:XN,deleteKey:QN,deleteKeys:eD,map:ma,mapWithKey:ha,filter:Mc,filterWithKey:Jd,reject:tD,rejectWithKey:rD,selectKeys:Yd,isEmpty:nD,isNotEmpty:oD};var NSe=Wd(!1);var Xd=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
|
|
${xr(t||"items.itemID")}
|
|
AND itemTypesCombined.typeName NOT IN (${Ld})
|
|
AND ${nt()}
|
|
`;var LSe=Xd(!0);var zSe=Xd(!1);var $c=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"?xr(!1):t==="id"?xr("items.itemID"):xr("items.key","$key")}
|
|
AND ${nt()}
|
|
AND itemType NOT IN (${Ld})
|
|
GROUP BY itemID
|
|
`;var GSe=$c("full");var XSe=$c("id"),QSe=$c("key");var Lc=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"?xr(!1):t==="id"?xr("collectionID","$collectionID"):xr("key","$key")}
|
|
AND ${nt("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 i1e=Lc("full");var c1e=Lc("id"),u1e=Lc("key");var iD=require("path"),Lo=({groupID:t,key:e},r)=>{let n=[r,"cache"];return t?n.push("groups",t.toString()):n.push("library"),(0,iD.join)(...n,e+".png")};var jc=t=>Qd(t)?[t.firstName,t.lastName].join(" "):em(t)?t.lastName:null,Qd=t=>{let e=t;return e.fieldMode===kc.fullName&&e.firstName!==null&&e.lastName!==null},em=t=>{let e=t;return e.fieldMode===kc.nameOnly&&e.lastName!==null},A0=new Set(ao()("creators","itemID","itemType","key","libraryID","collections")),k0=t=>!$d.includes(t.itemType)&&typeof t.key=="string",qc=t=>t.itemType==="annotation"&&!!t.parentItem;var sD=t=>typeof t.groupID=="number"?`groups/${t.groupID}`:"library",jo=t=>{let e;if(k0(t))e=new URL(`zotero://select/${sD(t)}/items/${t.key}`);else if(qc(t)){e=new URL(`zotero://open-pdf/${sD(t)}/items/${t.parentItem}`);let r;try{r=bs(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 lD=require("obsidian");var rm=require("obsidian");async function aD(t){let e=await Wi(t);if(!e)return null;let{value:r,evt:n}=e;return{value:r.item,evt:n}}function Wi(t){let e,r=new Promise((o,i)=>{e=o}),n=or(t,{selectSuggestion:o=>function(s,a,...l){return e(s!==null?{value:s,evt:a}:null),o.call(this,s,a,...l)},onClose:o=>function(...s){return e(null),o.call(this,...s)}});return r.finally(n),t.open(),r}var tm=class extends rm.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,rm.debounce)(this.#e.bind(this),250,!0);updateSuggestions(){this.initial?(this.#e(),this.initial=!1):this.#t()}};var R0=class extends lD.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 $K(t,e){return t.length===1?t[0]:t.length?(await aD(new R0(t,e)))?.value??null:null}function ga(t,e){pa(window.localStorage,e,t.itemID)}async function Kn(t,e){let r=t.filter(Rc);return await $K(r,e)}var tx=require("obsidian");var Ot=require("obsidian");var ya=require("obsidian"),cD=()=>`Press ${ya.Platform.isMacOS?"\u2318 Cmd":"Ctrl"} + ${ya.Platform.isMacOS?"\u2325 Option":"Shift"} + I, then go to the "Console" tab to see the log.`;var bt=t=>t instanceof ya.TFile&&t.extension==="md",uD=t=>typeof t=="string"?t:t.path;function N0(t){let e=zi(t,o=>o.comment?.match(zy)?.[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(a=>{a.comment&&=a.comment.replace(zy,"")??null}),s?s.push(...i.sort((a,l)=>jd(a.sortIndex,l.sortIndex))):i.forEach(a=>{n.set(a.itemID,[a])})}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 D0(t){return t.map(e=>e[0])}function F0(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(a=>{i.set(a.tagID,a)})}),[n.itemID,Array.from(i.values())]});return Object.fromEntries(r)}function fD(t,e){let r=N0(t);return{annotations:D0(r),tags:F0(r,e)}}var am=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}}},ct=class extends Error{constructor(e){super(e),this.name="Eta Error"}};function Bc(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 ct(t)}function LK(t,e,r,n){let o=e.split(`
|
|
`),i=Math.max(r-3,0),s=Math.min(o.length,r+3),a=n,l=o.slice(i,s).map(function(f,p){let d=p+i+1;return(d==r?" >> ":" ")+d+"| "+f}).join(`
|
|
`),u=a?a+":"+r+`
|
|
`:"line "+r+`
|
|
`,c=new ct(u+l+`
|
|
|
|
`+t.message);throw c.name=t.name,c}var jK=async function(){}.constructor;function qK(t,e){let r=this.config,n=e&&e.async?jK: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 ct(`Bad template syntax
|
|
|
|
`+o.message+`
|
|
`+Array(o.message.length+1).join("=")+`
|
|
`+this.compileToString.call(this,t,e)+`
|
|
`):o}}function BK(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 a=0;a<r.plugins.length;a++){let l=r.plugins[a];l.processFnString&&(s=l.processFnString(s,r))}return s}function zK(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,a=i.val||"";e.debug&&(o+="__eta.line="+i.lineNo+`
|
|
`),s==="r"?(e.autoFilter&&(a="__eta.f("+a+")"),o+="__eta.res+="+a+`
|
|
`):s==="i"?(e.autoFilter&&(a="__eta.f("+a+")"),e.autoEscape&&(a="__eta.e("+a+")"),o+="__eta.res+="+a+`
|
|
`):s==="e"&&(o+=a+`
|
|
`)}}return o}function UK(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 WK={"&":"&","<":"<",">":">",'"':""","'":"'"};function HK(t){return WK[t]}function KK(t){let e=String(t);return/[&<>"']/.test(e)?e.replace(/[&<>"']/g,HK):e}var pD={autoEscape:!0,autoFilter:!1,autoTrim:[!1,"nl"],cache:!1,cacheFilepaths:!0,debug:!1,escapeFunction:KK,filterFunction:t=>String(t),functionHeader:"",parse:{exec:"",interpolate:"=",raw:"~"},plugins:[],rmWhitespace:!1,tags:["<%","%>"],useWith:!1,varName:"it"},nm=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,om=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,im=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g;function sm(t){return t.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&")}function VK(t,e){return t.slice(0,e).split(`
|
|
`).length}function GK(t){let e=this.config,r=[],n=!1,o=0,i=e.parse;if(e.plugins)for(let f=0;f<e.plugins.length;f++){let p=e.plugins[f];p.processTemplate&&(t=p.processTemplate(t,e))}e.rmWhitespace&&(t=t.replace(/[\r\n]+/g,`
|
|
`).replace(/^\s+|\s+$/gm,"")),nm.lastIndex=0,om.lastIndex=0,im.lastIndex=0;function s(f,p){f&&(f=UK(f,e,n,p),f&&(f=f.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),r.push(f)))}let a=[i.exec,i.interpolate,i.raw].reduce(function(f,p){return f&&p?f+"|"+sm(p):p?sm(p):f},""),l=new RegExp(sm(e.tags[0])+"(-|_)?\\s*("+a+")?\\s*","g"),u=new RegExp("'|\"|`|\\/\\*|(\\s*(-|_)?"+sm(e.tags[1])+")","g"),c;for(;c=l.exec(t);){let f=t.slice(o,c.index);o=c[0].length+c.index;let p=c[1],d=c[2]||"";s(f,p),u.lastIndex=o;let h,b=!1;for(;h=u.exec(t);)if(h[1]){let y=t.slice(o,h.index);l.lastIndex=o=u.lastIndex,n=h[2],b={t:d===i.exec?"e":d===i.raw?"r":d===i.interpolate?"i":"",val:y};break}else{let y=h[0];if(y==="/*"){let v=t.indexOf("*/",u.lastIndex);v===-1&&Bc("unclosed comment",t,h.index),u.lastIndex=v}else y==="'"?(om.lastIndex=h.index,om.exec(t)?u.lastIndex=om.lastIndex:Bc("unclosed string",t,h.index)):y==='"'?(im.lastIndex=h.index,im.exec(t)?u.lastIndex=im.lastIndex:Bc("unclosed string",t,h.index)):y==="`"&&(nm.lastIndex=h.index,nm.exec(t)?u.lastIndex=nm.lastIndex:Bc("unclosed string",t,h.index))}b?(e.debug&&(b.lineNo=VK(t,c.index)),r.push(b)):Bc("unclosed tag",t,c.index)}if(s(t.slice(o,t.length),!1),e.plugins)for(let f=0;f<e.plugins.length;f++){let p=e.plugins[f];p.processAST&&(r=p.processAST(r,e))}return r}function dD(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 ct("Failed to get template '"+t+"'")}}function mD(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=dD.call(this,t,o)):n=t,n.call(this,e,o)}function hD(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=dD.call(this,t,o)):n=t;let i=n.call(this,e,o);return Promise.resolve(i)}function ZK(t,e){let r=this.compile(t,{async:!1});return mD.call(this,r,e)}function JK(t,e){let r=this.compile(t,{async:!0});return hD.call(this,r,e)}var lm=class{constructor(e){this.config=void 0,this.RuntimeErr=LK,this.compile=qK,this.compileToString=BK,this.compileBody=zK,this.parse=GK,this.render=mD,this.renderAsync=hD,this.renderString=ZK,this.renderStringAsync=JK,this.filepathCache={},this.templatesSync=new am({}),this.templatesAsync=new am({}),this.resolvePath=null,this.readFile=null,e?this.config={...pD,...e}:this.config={...pD}}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 ED=require("obsidian");var Vn=require("node:path/posix");var P0=require("obsidian");function YK(t){if(!t)return"";let e=Vy(t);return e||(t.endsWith(".eta.md")?t:t.endsWith(".eta")?t+".md":t+".eta.md")}function gD(t){let e=wt(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 ct(`File '${t}' not found`);return dt.Ejectable[e.name]}if(!this.tplFileCache.has(r))throw new ct(`File '${t}' not loaded`);return this.tplFileCache.get(r)}function yD(t){let e=wt(t,this.settings.templateDir);if(e?.type==="embeded")return-1;let r=this.getFile(t);if(typeof r=="string"){if(!e)throw new ct(`File '${t}' not found`);return}if(!this.tplFileCache.has(r))throw new ct(`File '${t}' not loaded`);return r.stat.mtime}function bD(t,e){let r="",n=this.config.views;if(!n)throw new ct("Views directory is not defined");let o=e&&e.filepath,i=JSON.stringify({filename:o,path:t,views:this.config.views});if(t=YK(t),o){if(this.config.cacheFilepaths&&this.filepathCache[i])return this.filepathCache[i];(0,Vn.isAbsolute)(t)?r=(0,Vn.join)(n,(0,P0.normalizePath)(t)):r=(0,Vn.join)(o,"..",(0,P0.normalizePath)(t))}else r=(0,Vn.join)(n,t);if(XK(n,r))return o&&this.config.cacheFilepaths&&(this.filepathCache[i]=r),r;throw new ct(`Template '${t}' is not in the views directory`)}function XK(t,e){let r=(0,Vn.relative)(t,e);return r&&!r.startsWith("..")&&!(0,Vn.isAbsolute)(r)}function vD(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 ct("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 a=this.readFile(n),l=this.compile(a,e);return this.config.cache&&r.define(n,l),l}}function M0(t,e,r){let n,o={...r,async:!1};return typeof t=="string"?(t.startsWith("@")||(o.filepath=this.resolvePath(t,o)),n=vD.call(this,t,o)):n=t,n.call(this,e,o)}function $0(t,e,r){let n,o={...r,async:!0};typeof t=="string"?(t.startsWith("@")||(o.filepath=this.resolvePath(t,o)),n=vD.call(this,t,o)):n=t;let i=n.call(this,e,o);return Promise.resolve(i)}function wD(t,e){let r=this.compile(t,{async:!1});return M0.call(this,r,e)}function xD(t,e){let r=this.compile(t,{async:!0});return $0.call(this,r,e)}var cm=class extends lm{use=ys.this;settings=this.use(ge);app=this.use(ED.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=bD;readFile=gD;readModTime=yD;render=M0;renderAsync=$0;renderString=wD;renderStringAsync=xD;getFile(e){let r=this.app.vault.getAbstractFileByPath(e);if(!r)return e;if(!bt(r))throw new ct(`'${e}' is not a markdown file`);return r}};var a2=Z(Y$(),1),l2=Z(n2(),1);var Hm=require("obsidian");var $Q="\\ufeff?",LQ=typeof process<"u"?process.platform:"",jQ="^("+$Q+"(= yaml =|---)$([\\s\\S]*?)^(?:\\2|\\.\\.\\.)\\s*$"+(LQ==="win32"?"\\r?":"")+"(?:\\n)?)",qQ=new RegExp(jQ,"m");function jm(t){t=t||"";let e=t.split(/(\r?\n)/);return e[0]&&/= yaml =|---/.test(e[0])?zQ(t):{yaml:null,body:t,bodyBegin:1}}function BQ(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 zQ(t){let e=qQ.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=BQ(e,t);return{yaml:r,body:n,bodyBegin:o}}var Bm=require("path"),Uw=require("url");function qw(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Bw(t,e){if(typeof t!="string"||typeof e!="string")throw new TypeError("Expected a string");let r=new RegExp(`(?:${qw(e)}){2,}`,"g");return t.replace(r,e)}function qm(){return/[<>:"/\\|?*\u0000-\u001F]/g}function o2(){return/^(con|prn|aux|nul|com\d|lpt\d)$/i}function zw(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 UQ=100,i2=/[\u0000-\u001F\u0080-\u009F]/g,WQ=/^\.+(\\|\/)|^\.+$/,HQ=/\.+$/;function Yi(t,e={}){if(typeof t!="string")throw new TypeError("Expected a string");let r=e.replacement===void 0?"!":e.replacement;if(qm().test(r)&&i2.test(r))throw new Error("Replacement string cannot contain reserved filename characters");if(t=t.normalize("NFD"),t=t.replace(WQ,r),t=t.replace(qm(),r),t=t.replace(i2,r),t=t.replace(HQ,""),r.length>0){let o=t[0]===".";t=Bw(t,r),t=t.length>1?zw(t,r):t,!o&&t[0]==="."&&(t=r+t),t[t.length-1]==="."&&(t+=r)}t=o2().test(t)?t+r:t;let n=typeof e.maxLength=="number"?e.maxLength:UQ;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}var Ww=t=>encodeURI(t)===t?t:`<${t}>`,zm=t=>t.name.endsWith(".eta.md"),Hw=(t,e)=>e.path?e.path.startsWith("storage:")?(0,Bm.join)(t,"storage",e.key,e.path.replace(/^storage:/,"")):e.path:"",Um=(t,e,r,n=null,o=null)=>{if(!n?.path)return"";let i=o?`#page=${o}`:void 0,s=e.vault.adapter.getBasePath(),a=Hw(t,n),l=(0,Bm.relative)(s,a);if(l.startsWith(".."))return`[attachment](${Ww((0,Uw.pathToFileURL)(a).href+(i??""))})`;{let u=e.metadataCache.getFirstLinkpathDest(l,"");return u?e.fileManager.generateMarkdownLink(u,r??"",i).replace(/^!/,""):(W.warn("fileLink: file not found",l,a),"")}},s2=t=>Yi(t,{replacement:"_"}),Wm=t=>qc(t)&&t.type===Ae.image,KQ=(t,e,r)=>e?`[${r??""}](${Ww(t)})`:`[[${t}${r?"|"+r:""}]]`,Kw=(t,e)=>{if(Wm(t)){let r=e.imgCacheImporter.import(t);if(r)return KQ(r,e.app.vault.getConfig("useMarkdownLinks"));{let n=e.imgCacheImporter.getCachePath(t);return`[Annotation ${t.key}](${Ww((0,Uw.pathToFileURL)(n).href)})`}}else return""};function c2(t){or(t,{compile:e=>function(n,o){let i=this,s=e.call(this,n,o);if(!o?.filepath)return s;let a=o.filepath,l=wt(a,i.settings.templateDir);if(!l)return s;let u=s;switch(l.name){case"filename":u=(c,f)=>s2(s.call(this,c,f));break;case"annotation":u=(c,f)=>{let p=s.call(this,c,f),d=!0,{yaml:h,body:b}=jm(p);if(h)try{(0,Hm.parseYaml)(h).callout===!1&&(d=!1)}catch(v){new Hm.Notice(`Error parsing frontmatter, ${v}`)}if(!d)return b;let y=b.trim().split(`
|
|
`);return y.push(`^${c.blockID}`),y.map(v=>`> ${v}`).join(`
|
|
`)};break;default:break}return Object.groupBy&&Map.groupBy?u:(c,f)=>{let p=VQ(),d=u.call(this,c,f);return p(),d}}})}function VQ(){let t=[];return Object.groupBy||(Object.groupBy=l2.default,t.push(()=>delete Object.groupBy)),Map.groupBy||(Map.groupBy=a2.default,t.push(()=>delete Map.groupBy)),()=>t.forEach(e=>e())}var Xi="zotero-key",Sa="zt-attachments";var u2=require("url");var f2=require("obsidian");var Uo=t=>t.plugin.settings.current?.zoteroDataDir,su=Symbol("proxied"),Km=t=>!!t[su];var Vm={"#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 Vw=new Set(ao()("attachment","tags")),Gw=(t,e,r)=>new Proxy({get page(){return bs(t.position.pageIndex,!0)??NaN},get backlink(){return jo(t)},get blockID(){let n=ir(t),o=bs(t.position.pageIndex,!0);return typeof o=="number"&&(n+=`p${o}`),n},get commentMd(){return t.comment?(0,f2.htmlToMarkdown)(t.comment):""},get imgPath(){return Wm(this)?Lo(this,Uo(r)):""},get imgUrl(){if(Wm(this)){let n=Lo(this,Uo(r));return(0,u2.pathToFileURL)(n).href}else return""},get imgLink(){return Kw(this,r.plugin)},get imgEmbed(){let n=Kw(this,r.plugin);return n?`!${n}`:""},get fileLink(){return Um(Uo(r),r.plugin.app,r.sourcePath,e.attachment,bs(t.position.pageIndex,!0))},get textBlock(){return t.text?`\`\`\`zotero-annot
|
|
> ${t.text} [zotero](${jo(t)})
|
|
\`\`\``:""},get colorName(){let n=t.color?.toUpperCase();return Vm[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 Vw.has(o)?Reflect.get(e,o,i):Reflect.get(t,o,i)??Reflect.get(n,o,i)},ownKeys(n){return[...Reflect.ownKeys(t),...Vw,...Reflect.ownKeys(n)]},getOwnPropertyDescriptor(n,o){return Object.prototype.hasOwnProperty.call(t,o)?Reflect.getOwnPropertyDescriptor(t,o):Vw.has(o)?Reflect.getOwnPropertyDescriptor(e,o):Reflect.getOwnPropertyDescriptor(n,o)}});function Zw(t,e){return!t||Km(t)?t:new Proxy({get filePath(){return Hw(Uo(e),t)}},{get(r,n,o){return n===su?!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)}})}var Jw=class extends Array{toString(){return this.join(" > ")}},Yw=({path:t,...e})=>{let r={path:Jw.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)}})};var Xw=t=>{let e={get fullname(){return jc(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 Qw=new Set(ao()("attachment","allAttachments","tags","notes")),ex=({creators:t,collections:e,...r},n,o)=>{let i=t.map(s=>Xw(s));return new Proxy({get backlink(){return jo(r)},get fileLink(){return Um(Uo(o),o.plugin.app,o.sourcePath,n.attachment)},get authorsShort(){let s=this.authors;if(!s.length)return"";let a=s[0],l=a.lastName??a.fullname;return s.length===1?l:`${l} et al.`},annotations:"not-loaded",creators:i,collections:e.map(s=>Yw(s)),get authors(){return i.filter(s=>s.creatorType==="author")}},{get(s,a,l){if(a==="tags"){if(!n.tags[r.itemID])throw new Error("No tags loaded for item "+r.itemID);return n.tags[r.itemID]}return Qw.has(a)?n[a]:a==="annotations"?s.annotations:Reflect.get(r,a,l)??Reflect.get(s,a,l)},ownKeys(s){return[...Reflect.ownKeys(r),...Qw,...Reflect.ownKeys(s)]},getOwnPropertyDescriptor(s,a){return Object.prototype.hasOwnProperty.call(r,a)?Reflect.getOwnPropertyDescriptor(r,a):Qw.has(a)?Reflect.getOwnPropertyDescriptor(n,a):Reflect.getOwnPropertyDescriptor(s,a)}})};function p2(t){return!t||Km(t)?t:new Proxy({toString(){return t.name},toJSON(){return t.name}},{get(e,r,n){return r===su?!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 jt(t,e,r){let n={...t,attachement:Zw(t.attachment,e),allAttachments:t.allAttachments.map(a=>Zw(a,e)),tags:ma(t.tags,a=>a.map(l=>p2(l)))},o=ex(t.docItem,n,e),i=t.annotations.map(a=>{let l=Gw(a,n,e);return l.docItem=o,l}),s=r?i[t.annotations.findIndex(a=>a.itemID===r.itemID)]:void 0;return o.annotations=i,{annotation:s,annotations:i,docItem:o}}var Wo=class extends fe{eta=this.use(cm);plugin=this.use(xe);settings=this.use(ge);app=this.use(Ot.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 Ot.TFolder)){W.warn("Template folder is occupied by a file");return}let r=[];Ot.Vault.recurseChildren(e,async n=>{!bt(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(){c2(this.eta),this.settings.once(async()=>{await this.loadTemplates()}),this.register(He(lt(()=>this.plugin.app.vault.trigger("zotero:template-updated","filename"),()=>this.filenameTemplate,!0))),this.register(He(lt(async()=>en.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(!bt(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(!bt(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=wt(e,this.folder);return r?.type==="ejectable"?r.name:null}onFileUpdate(e){bt(e)&&this.fromPath(e.path)}onFileRename(e,r){bt(e)&&this.fromPath(e.path),this.fromPath(r)}mergeAnnotTags(e){if(e.annotations.length===0)return e;let r=fD(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=jt(r,n,e);return this.render("annotation",o.annotation)}renderNote(e,r,n){r.merge!==!1&&(e=this.mergeAnnotTags(e));let o=jt(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=jt(e,r);return this.render("annots",n.annotations)}renderCitations(e,r,n=!1){let o=e.map(i=>jt(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=jt(e,r);return this.render("filename",n.docItem)}toFrontmatterRecord(e){let r=this.render("field",e),n=!1,{yaml:o,body:i}=jm(r);if(o)try{(0,Ot.parseYaml)(o).raw===!0&&(n=!0)}catch(f){new Ot.Notice(`Error parsing frontmatter, ${f}`)}let s=ir(e,!0),a=e.attachment?[e.attachment.itemID.toString()]:void 0,{[Xi]:l,[Sa]:u,...c}=(0,Ot.parseYaml)(i);return{mode:n?"raw":"parsed",yaml:[`${Xi}: ${s}`,`${Sa}: ${u??a}`,i.trim(),""].join(`
|
|
`),data:{[Xi]:s,[Sa]:a,...Mc(c,f=>!(f===""||f===null||f===void 0))}}}renderFrontmatter(e,r,n){let o=jt(e,r);return this.#e(o.docItem,n)}#e(e,r){try{let n=this.toFrontmatterRecord(e);return n.mode==="raw"?n.yaml:(0,Ot.stringifyYaml)(r!==void 0?Ui(n.data,r):n.data)}catch(n){throw mt("Failed to renderYaml",n,e),new Ot.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){mt("Failed to set frontmatter to file "+e.path,n,r),new Ot.Notice("Failed to set frontmatter to file "+e.path)}}};de([me],Wo.prototype,"folder",1),de([me],Wo.prototype,"filenameTemplate",1),de([me],Wo.prototype,"autoTrim",1);var Gm=require("@codemirror/state"),d2=require("obsidian");var m2=t=>Gm.Prec.highest(Gm.EditorState.languageData.of(e=>{let r=[],n=t.getConfig("autoPairBrackets"),o=t.getConfig("autoPairMarkdown");n&&r.push("(","[","{","'",'"'),o&&r.push("*","_","`","```");let i=e.field(d2.editorInfoField);return i?.file&&zm(i?.file)&&r.push("<","%"),[{closeBrackets:{brackets:r}}]}));var g2=require("obsidian");var h2=[{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."}],Zm=class extends g2.EditorSuggest{onTrigger(e,r,n){if(!n||!zm(n))return null;let o=r.getLine(e.line),s=o.substring(0,e.ch).match(/<%([ =]?)$/);if(!s)return null;let[a,l]=s,u=o.substring(e.ch).match(/^([\w ]*)%>/),c;if(!u)c={...e};else{let[,f]=u;if(l===" "&&f.length===1)return null;c={...e,ch:e.ch+f.length}}return{end:c,start:{ch:s.index+a.length-l.length,line:e.line},query:s[1]}}getSuggestions(e){return e.query?h2.filter(r=>r.prefix===e.query):h2}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 Ia=class extends fe{#e=null;plugin=this.use(xe);settings=this.use(ge);#t(){this.plugin.registerEditorSuggest(new Zm(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(m2(this.plugin.app.vault)),r&&this.plugin.app.workspace.updateOptions()}onload(){this.#t(),this.register(He(lt(()=>this.#n(this.etaBracketPairing),()=>this.etaBracketPairing)))}};de([me],Ia.prototype,"etaBracketPairing",1);var rx=t=>{let e=t?.frontmatter?.[Xi];return e&&typeof e=="string"&&IS.test(e)?e:null},Qi=(t,e)=>{if(!t)return null;let r=typeof t=="string"?e.getCache(t):t instanceof tx.TFile?e.getFileCache(t):null;return rx(r)},es=(t,e)=>{if(!t)return null;let n=(typeof t=="string"?e.getCache(t):t instanceof tx.TFile?e.getFileCache(t):null)?.frontmatter?.[Sa];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},au=({id:t})=>!!t&&OS.test(t),lu=t=>t.split("n").map(e=>{let[,r,,n]=e.split("p")[0].match(_S);return ir({key:r,groupID:n?+n:void 0},!0)});function cu(t,e){let r=uD(t);return!!Qi(r,e.metadataCache)}var $q=require("url");S();var Ho=We({});S();var Ve=We({});S();var y2=function(t){return typeof t=="function"};var ZQ=!1,b2=ZQ;function JQ(t){b2&&(y2(t)||console.error("useMemoizedFn expected parameter is a function, got ".concat(typeof t)));var e=P(t);e.current=ie(function(){return t},[t]);var r=P();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 Wr=JQ;S();S();function YQ(t,e){t===void 0&&(t=!1);var r=Io(L(t),2),n=r[0],o=r[1],i=ie(function(){var s=e===void 0?!t:e,a=function(){return o(function(f){return f===t?s:t})},l=function(f){return o(f)},u=function(){return o(t)},c=function(){return o(s)};return{toggle:a,set:l,setLeft:u,setRight:c}},[]);return[n,i]}var v2=YQ;function Jm(t){t===void 0&&(t=!1);var e=Io(v2(!!t),2),r=e[0],n=e[1],o=n.toggle,i=n.set,s=ie(function(){var a=function(){return i(!0)},l=function(){return i(!1)};return{toggle:o,set:function(u){return i(!!u)},setTrue:a,setFalse:l}},[]);return[r,s]}S();function XQ(t){var e=function(){return new Set(t)},r=Io(L(e),2),n=r[0],o=r[1],i=function(l){n.has(l)||o(function(u){var c=new Set(u);return c.add(l),c})},s=function(l){n.has(l)&&o(function(u){var c=new Set(u);return c.delete(l),c})},a=function(){return o(e())};return[n,{add:Wr(i),remove:Wr(s),reset:Wr(a)}]}var nx=XQ;S();var x2={},w2=t=>{let e,r=new Set,n=(l,u)=>{let c=typeof l=="function"?l(e):l;if(!Object.is(c,e)){let f=e;e=u??typeof c!="object"?c:Object.assign({},e,c),r.forEach(p=>p(e,f))}},o=()=>e,a={setState:n,getState:o,subscribe:l=>(r.add(l),()=>r.delete(l)),destroy:()=>{(x2.env&&x2.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,a),a},uu=t=>t?w2(t):w2;S();var k2=Z(A2(),1);var{useSyncExternalStoreWithSelector:gee}=k2.default;function qt(t,e=t.getState,r){let n=gee(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return Ii(n),n}function Oa(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}S();function R2(){for(var t=0,e,r,n="";t<arguments.length;)(e=arguments[t++])&&(r=N2(e))&&(n&&(n+=" "),n+=r);return n}function N2(t){if(typeof t=="string")return t;for(var e,r="",n=0;n<t.length;n++)t[n]&&(e=N2(t[n]))&&(r&&(r+=" "),r+=e);return r}var sx="-";function P2(t){var e=bee(t);function r(o){var i=o.split(sx);return i[0]===""&&i.length!==1&&i.shift(),M2(i,e)||yee(o)}function n(o){return t.conflictingClassGroups[o]||[]}return{getClassGroupId:r,getConflictingClassGroupIds:n}}function M2(t,e){if(t.length===0)return e.classGroupId;var r=t[0],n=e.nextPart.get(r),o=n?M2(t.slice(1),n):void 0;if(o)return o;if(e.validators.length!==0){var i=t.join(sx);return e.validators.find(function(s){var a=s.validator;return a(i)})?.classGroupId}}var D2=/^\[(.+)\]$/;function yee(t){if(D2.test(t)){var e=D2.exec(t)[1],r=e?.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}}function bee(t){var e=t.theme,r=t.prefix,n={nextPart:new Map,validators:[]},o=wee(Object.entries(t.classGroups),r);return o.forEach(function(i){var s=i[0],a=i[1];ix(a,n,s,e)}),n}function ix(t,e,r,n){t.forEach(function(o){if(typeof o=="string"){var i=o===""?e:F2(e,o);i.classGroupId=r;return}if(typeof o=="function"){if(vee(o)){ix(o(n),e,r,n);return}e.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(function(s){var a=s[0],l=s[1];ix(l,F2(e,a),r,n)})})}function F2(t,e){var r=t;return e.split(sx).forEach(function(n){r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r}function vee(t){return t.isThemeGetter}function wee(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(a){var l=a[0],u=a[1];return[e+l,u]})):s});return[n,i]}):t}function $2(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 a=r.get(s);if(a!==void 0)return a;if((a=n.get(s))!==void 0)return o(s,a),a},set:function(s,a){r.has(s)?r.set(s,a):o(s,a)}}}var ax="!";function L2(t){var e=t.separator||":";return function(n){for(var o=0,i=[],s=0,a=0;a<n.length;a++){var l=n[a];o===0&&l===e[0]&&(e.length===1||n.slice(a,a+e.length)===e)&&(i.push(n.slice(s,a)),s=a+e.length),l==="["?o++:l==="]"&&o--}var u=i.length===0?n:n.substring(s),c=u.startsWith(ax),f=c?u.substring(1):u;return{modifiers:i,hasImportantModifier:c,baseClassName:f}}}function j2(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 q2(t){return{cache:$2(t.cacheSize),splitModifiers:L2(t),...P2(t)}}var xee=/\s+/;function B2(t,e){var r=e.splitModifiers,n=e.getClassGroupId,o=e.getConflictingClassGroupIds,i=new Set;return t.trim().split(xee).map(function(s){var a=r(s),l=a.modifiers,u=a.hasImportantModifier,c=a.baseClassName,f=n(c);if(!f)return{isTailwindClass:!1,originalClassName:s};var p=j2(l).join(":"),d=u?p+ax:p;return{isTailwindClass:!0,modifierId:d,classGroupId:f,originalClassName:s}}).reverse().filter(function(s){if(!s.isTailwindClass)return!0;var a=s.modifierId,l=s.classGroupId,u=a+l;return i.has(u)?!1:(i.add(u),o(l).forEach(function(c){return i.add(a+c)}),!0)}).reverse().map(function(s){return s.originalClassName}).join(" ")}function z2(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n,o,i,s=a;function a(u){var c=e[0],f=e.slice(1),p=f.reduce(function(d,h){return h(d)},c());return n=q2(p),o=n.cache.get,i=n.cache.set,s=l,l(u)}function l(u){var c=o(u);if(c)return c;var f=B2(u,n);return i(u,f),f}return function(){return s(R2.apply(null,arguments))}}function Te(t){var e=function(n){return n[t]||[]};return e.isThemeGetter=!0,e}var W2=/^\[(?:([a-z-]+):)?(.+)\]$/i,Eee=/^\d+\/\d+$/,See=new Set(["px","full","screen"]),Iee=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,_ee=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh)/,Oee=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;function Ir(t){return Ta(t)||See.has(t)||Eee.test(t)||Ko(t)}function Ko(t){return ts(t,"length",Tee)}function H2(t){return ts(t,"size",Z2)}function K2(t){return ts(t,"position",Z2)}function V2(t){return ts(t,"url",Cee)}function Xm(t){return ts(t,"number",Ta)}function Ta(t){return!Number.isNaN(Number(t))}function Ca(t){return U2(t)||ts(t,"number",U2)}function je(t){return W2.test(t)}function Aa(){return!0}function Yn(t){return Iee.test(t)}function G2(t){return ts(t,"",Aee)}function ts(t,e,r){var n=W2.exec(t);return n?n[1]?n[1]===e:r(n[2]):!1}function Tee(t){return _ee.test(t)}function Z2(){return!1}function Cee(t){return t.startsWith("url(")}function U2(t){return Number.isInteger(Number(t))}function Aee(t){return Oee.test(t)}function J2(){var t=Te("colors"),e=Te("spacing"),r=Te("blur"),n=Te("brightness"),o=Te("borderColor"),i=Te("borderRadius"),s=Te("borderSpacing"),a=Te("borderWidth"),l=Te("contrast"),u=Te("grayscale"),c=Te("hueRotate"),f=Te("invert"),p=Te("gap"),d=Te("gradientColorStops"),h=Te("inset"),b=Te("margin"),y=Te("opacity"),v=Te("padding"),x=Te("saturate"),T=Te("scale"),$=Te("sepia"),V=Te("skew"),J=Te("space"),G=Te("translate"),K=function(){return["auto","contain","none"]},F=function(){return["auto","hidden","clip","visible","scroll"]},Q=function(){return["auto",e]},O=function(){return["",Ir]},_=function(){return["auto",Ta,je]},I=function(){return["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"]},B=function(){return["solid","dashed","dotted","double","none"]},D=function(){return["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"]},oe=function(){return["start","end","center","between","around","evenly"]},se=function(){return["","0",je]},be=function(){return["auto","avoid","all","avoid-page","page","left","right","column"]},ce=function(){return[Ta,Xm]},E=function(){return[Ta,je]};return{cacheSize:500,theme:{colors:[Aa],spacing:[Ir],blur:["none","",Yn,Ko],brightness:ce(),borderColor:[t],borderRadius:["none","","full",Yn,Ko],borderSpacing:[e],borderWidth:O(),contrast:ce(),grayscale:se(),hueRotate:E(),invert:se(),gap:[e],gradientColorStops:[t],inset:Q(),margin:Q(),opacity:ce(),padding:[e],saturate:ce(),scale:ce(),sepia:se(),skew:E(),space:[e],translate:[e]},classGroups:{aspect:[{aspect:["auto","square","video",je]}],container:["container"],columns:[{columns:[Yn]}],"break-after":[{"break-after":be()}],"break-before":[{"break-before":be()}],"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(I(),[je])}],overflow:[{overflow:F()}],"overflow-x":[{"overflow-x":F()}],"overflow-y":[{"overflow-y":F()}],overscroll:[{overscroll:K()}],"overscroll-x":[{"overscroll-x":K()}],"overscroll-y":[{"overscroll-y":K()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ca]}],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",je]}],grow:[{grow:se()}],shrink:[{shrink:se()}],order:[{order:["first","last","none",Ca]}],"grid-cols":[{"grid-cols":[Aa]}],"col-start-end":[{col:["auto",{span:[Ca]},je]}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":[Aa]}],"row-start-end":[{row:["auto",{span:[Ca]},je]}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",je]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",je]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:oe()}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:[].concat(oe(),["baseline"])}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[].concat(oe(),["baseline","stretch"])}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[J]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[J]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",e]}],"min-w":[{"min-w":["min","max","fit",Ir]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[Yn]},Yn,Ko]}],h:[{h:[e,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",Ir]}],"max-h":[{"max-h":[e,"min","max","fit"]}],"font-size":[{text:["base",Yn,Ko]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Xm]}],"font-family":[{font:[Aa]}],"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",Ko]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ir]}],"list-style-type":[{list:["none","disc","decimal",je]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[].concat(B(),["wavy"])}],"text-decoration-thickness":[{decoration:["auto","from-font",Ir]}],"underline-offset":[{"underline-offset":["auto",Ir]}],"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",Ko]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap"]}],break:[{break:["normal","words","all","keep"]}],content:[{content:["none",je]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[].concat(I(),[K2])}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",H2]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},V2]}],"bg-color":[{bg:[t]}],"gradient-from":[{from:[d]}],"gradient-via":[{via:[d]}],"gradient-to":[{to:[d]}],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:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[].concat(B(),["hidden"])}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:B()}],"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(B())}],"outline-offset":[{"outline-offset":[Ir]}],"outline-w":[{outline:[Ir]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:O()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[Ir]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Yn,G2]}],"shadow-color":[{shadow:[Aa]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":D()}],"bg-blend":[{"bg-blend":D()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Yn,je]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[f]}],saturate:[{saturate:[x]}],sepia:[{sepia:[$]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[x]}],"backdrop-sepia":[{"backdrop-sepia":[$]}],"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",je]}],duration:[{duration:E()}],ease:[{ease:["linear","in","out","in-out",je]}],delay:[{delay:E()}],animate:[{animate:["none","spin","ping","pulse","bounce",je]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[T]}],"scale-x":[{"scale-x":[T]}],"scale-y":[{"scale-y":[T]}],rotate:[{rotate:[Ca,je]}],"translate-x":[{"translate-x":[G]}],"translate-y":[{"translate-y":[G]}],"skew-x":[{"skew-x":[V]}],"skew-y":[{"skew-y":[V]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",je]}],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",je]}],"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",je]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Ir,Xm]}],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 lx=z2(J2);function re(...t){return lx(sv(t))}S();S();function Qm(...t){return e=>{t.forEach(r=>{typeof r=="function"?r(e):r!=null&&(r.current=e)})}}var eh=(t,e)=>{let{setIcon:r}=te(Ho),n=P(null);return X(i=>{n.current&&kee.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 kee(){for(;this.lastChild;)this.removeChild(this.lastChild)}var Vo=ht(Y(function({icon:e,size:r,className:n,...o},i){let s=eh(e,r),a=Qm(s,i);return m("div",{ref:a,className:re("zt-icon",n),...o})}));S();var rs=Y(function({onClick:e,onKeyDown:r,className:n,...o},i){return m(Vo,{onClick:e,onKeyDown:r??e,className:re("clickable-icon",n),...o,ref:i,role:"button",tabIndex:0})});S();S();var Y2=ht(Y(function({icon:e,...r},n){let o=eh(e);return m("button",{ref:Qm(o,n),...r})}));var ns=Y(function({className:e,active:r=!1,...n},o){return m(Y2,{...n,ref:o,className:re("clickable-icon",{"is-active":r},e)})});function fu(t){return m(rs,{size:16,icon:"info","aria-label":"Show details",...t})}function pu(){let t=arguments[0];for(let e=1,r=arguments.length;e<r;e++)t=arguments[e](t);return t}S();S();var X2=ht(function({content:e,className:r,...n}){let{sanitize:o,renderMarkdown:i}=te(Ho),s=ie(()=>o(e).replace(/<\/?b>/g,"**").replace(/<\/?i>/g,"*"),[e,o]);return m("div",{className:re("annot-comment select-text overflow-x-auto break-words px-2 py-1",r),...n,children:i(s)})});S();var Q2=Y(function({className:e,...r},n){return m("div",{ref:n,className:re("annot-excerpt",e),...r})});S();function cx({text:t,pageLabel:e,className:r,collapsed:n=!1,...o}){let i=t??`Area Excerpt for Page ${e??"?"}`;return m("img",{className:re("w-full",n?"max-h-20 object-cover object-left-top":"object-scale-down",r),alt:i,...o})}var eL=ht(function({type:e,text:r,pageLabel:n,imgSrc:o,collapsed:i}){switch(e){case Ae.highlight:case Ae.underline:case Ae.text:return m("p",{className:"select-text",children:r});case Ae.image:if(!o)throw new Error("imgSrc is required for image annotation");return m(cx,{collapsed:i,src:o,pageLabel:n,text:r});default:return m(M,{children:["Unsupported Type: ",Ae[e]??e]})}});function ux({checkbox:t,drag:e,buttons:r,onMoreOptions:n,className:o,children:i,onContextMenu:s,...a}){return m("div",{className:re("annot-header flex cursor-context-menu items-center gap-1",o),onContextMenu:s??n,...a,children:[t,m("div",{className:"annot-header-drag-container flex flex-row items-center gap-1",children:e}),m("div",{className:"annot-header-buttons-container flex flex-row items-center gap-1 opacity-0 transition-opacity hover:opacity-100",children:r}),m("div",{className:"annot-header-space flex-1"}),i]})}var Ree=typeof global=="object"&&global&&global.Object===Object&&global,tL=Ree;var Nee=typeof self=="object"&&self&&self.Object===Object&&self,Dee=tL||Nee||Function("return this")(),rL=Dee;var Fee=rL.Symbol,Xn=Fee;var nL=Object.prototype,Pee=nL.hasOwnProperty,Mee=nL.toString,du=Xn?Xn.toStringTag:void 0;function $ee(t){var e=Pee.call(t,du),r=t[du];try{t[du]=void 0;var n=!0}catch{}var o=Mee.call(t);return n&&(e?t[du]=r:delete t[du]),o}var oL=$ee;var Lee=Object.prototype,jee=Lee.toString;function qee(t){return jee.call(t)}var iL=qee;var Bee="[object Null]",zee="[object Undefined]",sL=Xn?Xn.toStringTag:void 0;function Uee(t){return t==null?t===void 0?zee:Bee:sL&&sL in Object(t)?oL(t):iL(t)}var aL=Uee;function Wee(t){return t!=null&&typeof t=="object"}var lL=Wee;var Hee="[object Symbol]";function Kee(t){return typeof t=="symbol"||lL(t)&&aL(t)==Hee}var cL=Kee;function Vee(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 uL=Vee;var Gee=Array.isArray,fL=Gee;var Zee=1/0,pL=Xn?Xn.prototype:void 0,dL=pL?pL.toString:void 0;function mL(t){if(typeof t=="string")return t;if(fL(t))return uL(t,mL)+"";if(cL(t))return dL?dL.call(t):"";var e=t+"";return e=="0"&&1/t==-Zee?"-0":e}var hL=mL;function Jee(t){return t==null?"":hL(t)}var ka=Jee;function Yee(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 gL=Yee;function Xee(t,e,r){var n=t.length;return r=r===void 0?n:r,!e&&r>=n?t:gL(t,e,r)}var yL=Xee;var Qee="\\ud800-\\udfff",ete="\\u0300-\\u036f",tte="\\ufe20-\\ufe2f",rte="\\u20d0-\\u20ff",nte=ete+tte+rte,ote="\\ufe0e\\ufe0f",ite="\\u200d",ste=RegExp("["+ite+Qee+nte+ote+"]");function ate(t){return ste.test(t)}var th=ate;function lte(t){return t.split("")}var bL=lte;var vL="\\ud800-\\udfff",cte="\\u0300-\\u036f",ute="\\ufe20-\\ufe2f",fte="\\u20d0-\\u20ff",pte=cte+ute+fte,dte="\\ufe0e\\ufe0f",mte="["+vL+"]",fx="["+pte+"]",px="\\ud83c[\\udffb-\\udfff]",hte="(?:"+fx+"|"+px+")",wL="[^"+vL+"]",xL="(?:\\ud83c[\\udde6-\\uddff]){2}",EL="[\\ud800-\\udbff][\\udc00-\\udfff]",gte="\\u200d",SL=hte+"?",IL="["+dte+"]?",yte="(?:"+gte+"(?:"+[wL,xL,EL].join("|")+")"+IL+SL+")*",bte=IL+SL+yte,vte="(?:"+[wL+fx+"?",fx,xL,EL,mte].join("|")+")",wte=RegExp(px+"(?="+px+")|"+vte+bte,"g");function xte(t){return t.match(wte)||[]}var _L=xte;function Ete(t){return th(t)?_L(t):bL(t)}var OL=Ete;function Ste(t){return function(e){e=ka(e);var r=th(e)?OL(e):void 0,n=r?r[0]:e.charAt(0),o=r?yL(r,1).join(""):e.slice(1);return n[t]()+o}}var TL=Ste;var Ite=TL("toUpperCase"),CL=Ite;function _te(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 AL=_te;function Ote(t){return function(e){return t?.[e]}}var kL=Ote;var Tte={\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"},Cte=kL(Tte),RL=Cte;var Ate=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,kte="\\u0300-\\u036f",Rte="\\ufe20-\\ufe2f",Nte="\\u20d0-\\u20ff",Dte=kte+Rte+Nte,Fte="["+Dte+"]",Pte=RegExp(Fte,"g");function Mte(t){return t=ka(t),t&&t.replace(Ate,RL).replace(Pte,"")}var NL=Mte;var $te=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Lte(t){return t.match($te)||[]}var DL=Lte;var jte=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function qte(t){return jte.test(t)}var FL=qte;var jL="\\ud800-\\udfff",Bte="\\u0300-\\u036f",zte="\\ufe20-\\ufe2f",Ute="\\u20d0-\\u20ff",Wte=Bte+zte+Ute,qL="\\u2700-\\u27bf",BL="a-z\\xdf-\\xf6\\xf8-\\xff",Hte="\\xac\\xb1\\xd7\\xf7",Kte="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Vte="\\u2000-\\u206f",Gte=" \\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",zL="A-Z\\xc0-\\xd6\\xd8-\\xde",Zte="\\ufe0e\\ufe0f",UL=Hte+Kte+Vte+Gte,WL="['\u2019]",PL="["+UL+"]",Jte="["+Wte+"]",HL="\\d+",Yte="["+qL+"]",KL="["+BL+"]",VL="[^"+jL+UL+HL+qL+BL+zL+"]",Xte="\\ud83c[\\udffb-\\udfff]",Qte="(?:"+Jte+"|"+Xte+")",ere="[^"+jL+"]",GL="(?:\\ud83c[\\udde6-\\uddff]){2}",ZL="[\\ud800-\\udbff][\\udc00-\\udfff]",Ra="["+zL+"]",tre="\\u200d",ML="(?:"+KL+"|"+VL+")",rre="(?:"+Ra+"|"+VL+")",$L="(?:"+WL+"(?:d|ll|m|re|s|t|ve))?",LL="(?:"+WL+"(?:D|LL|M|RE|S|T|VE))?",JL=Qte+"?",YL="["+Zte+"]?",nre="(?:"+tre+"(?:"+[ere,GL,ZL].join("|")+")"+YL+JL+")*",ore="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ire="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",sre=YL+JL+nre,are="(?:"+[Yte,GL,ZL].join("|")+")"+sre,lre=RegExp([Ra+"?"+KL+"+"+$L+"(?="+[PL,Ra,"$"].join("|")+")",rre+"+"+LL+"(?="+[PL,Ra+ML,"$"].join("|")+")",Ra+"?"+ML+"+"+$L,Ra+"+"+LL,ire,ore,HL,are].join("|"),"g");function cre(t){return t.match(lre)||[]}var XL=cre;function ure(t,e,r){return t=ka(t),e=r?void 0:e,e===void 0?FL(t)?XL(t):DL(t):t.match(e)||[]}var QL=ure;var fre="['\u2019]",pre=RegExp(fre,"g");function dre(t){return function(e){return AL(QL(NL(e).replace(pre,"")),t,"")}}var ej=dre;var mre=ej(function(t,e,r){return t+(r?" ":"")+CL(e)}),dx=mre;S();var tj=ht(function({icon:e,color:r,type:n,className:o,...i}){let s=dx(Ae[n]);return m(Vo,{icon:e,style:{color:r??void 0},className:re(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})});var rj=t=>{switch(t){case Ae.highlight:return"align-left";case Ae.underline:return"underline";case Ae.image:return"frame";case Ae.text:return"text-select";case Ae.note:case Ae.ink:default:return"file-question"}};S();var nj=t=>{let{annotRenderer:e,store:r}=te(Ve),n=qt(r,e.storeSelector,Oa);return e.get(t,n)};S();var oj=t=>{let{getImgSrc:e}=te(Ve);return ie(()=>e(t),[t,e])};function mx({className:t,...e}){return m(rs,{icon:"more-vertical",className:re("annot-header-more-options",t),"aria-label":"More options",size:"0.9rem","aria-label-delay":"50",...e})}S();var ij=ht(function({pageLabel:e,backlink:r,className:n,...o}){let i=e?`Page ${e}`:"";return r?m("a",{className:re("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}):m("span",{className:re("annot-page",n),children:i})});S();function hx({tags:t}){return t.length===0?null:m("div",{className:"annot-tags-container",children:t.map(e=>m(hre,{...e},e.tagID))})}var hre=ht(function({name:e}){return m("a",{className:re("tag","annot-tag"),children:e})});function gx({collapsed:t=!1,annotation:e,checkbox:r,tags:n,className:o,...i}){let s=P(null),{onMoreOptions:a,onDragStart:l,onShowDetails:u}=te(Ve),c=C0.selectKeys(e,["type","text","pageLabel"]),f=nj(e),p=Wr(h=>a(h,e)),d=Wr(()=>u("annot",e.itemID));return m("div",{className:re("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:[m(ux,{className:"bg-primary-alt py-1 pl-2 pr-1",checkbox:r,drag:m(tj,{type:e.type,color:e.color,icon:rj(e.type),draggable:f!==null,onDragStart:Wr(h=>f&&l(h,f,s.current)),size:16}),buttons:m(M,{children:[m(fu,{className:"p-0.5",size:14,onClick:d}),m(mx,{className:"p-0",onClick:p})]}),onMoreOptions:p,children:m(ij,{pageLabel:e.pageLabel,backlink:jo(e)})}),m(Q2,{ref:s,className:"px-2 py-1",children:m("blockquote",{className:re("border-l-blockquote pl-2 leading-tight",{"line-clamp-3":t}),style:{borderColor:e.color??"var(--interactive-accent)"},children:m(eL,{...c,collapsed:t,imgSrc:oj(e)})})}),e.comment&&m(X2,{content:e.comment}),n&&m(hx,{tags:n})]})}function yx({selectable:t=!1,collapsed:e,annotations:r,getTags:n}){let[o,{add:i,remove:s}]=nx();return m("div",{role:"list",className:"@md:grid-cols-2 @md:gap-3 @3xl:grid-cols-4 grid grid-cols-1 gap-2",children:r.map(a=>m(gx,{checkbox:t&&m(gre,{checked:o.has(a.itemID),onChange:l=>l?i(a.itemID):s(a.itemID)}),collapsed:e,role:"listitem",annotation:a,tags:n(a.itemID)},a.itemID))})}function gre({checked:t,onChange:e}){return m("div",{className:"flex h-5 items-center",children:m("input",{type:"checkbox",className:"m-0 h-4 w-4",checked:t,onChange:r=>e(r.target.checked)})})}S();var yre=()=>qt(te(Ve).store,t=>({attachments:t.allAttachments,onChange:t.setActiveAtch,value:t.attachmentID}),Oa);function bx(){let{attachments:t,onChange:e,value:r}=yre();return t?t.length===1?null:t.length<=0?m("span",{className:"atch-select-empty",children:"No attachments available"}):m("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})=>m("option",{value:n,children:["(",i,") ",o?.replace(/^storage:/,"")]},n))}):m(M,{children:"Loading"})}function vx({isCollapsed:t,...e}){return m(ns,{...e,icon:t?"chevrons-up-down":"chevrons-down-up","aria-label":t?"Expand":"Collapse"})}S();function rh(t){let{store:e,onSetFollow:r}=te(Ve),n=qt(e,s=>s.follow),o=n===null?"not following":n==="ob-note"?"active literature note":"active literature in Zotero reader";return m(M,{children:[m(ns,{...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&&m("span",{className:"ml-1","aria-label":`Following ${o}`,children:n==="ob-note"?"ob":"zt"})]})}function nh({children:t,buttons:e}){return m("div",{className:"nav-header",children:[m("div",{className:"nav-buttons-container",children:e}),t]})}function wx(t){return m(ns,{...t,icon:"refresh-ccw","aria-label":"Refresh annotation list","aria-label-delay":"50"})}var bre=()=>{let{registerDbUpdate:t,store:e}=te(Ve),r=qt(e,n=>n.refresh);U(()=>t(r),[t,r])};function mu(){bre();let{store:t}=te(Ve),e=qt(t,r=>r.doc);return e?m(vre,{docItem:e.docItem}):m(M,{children:[m(nh,{buttons:m(rh,{})}),m("div",{className:"pane-empty p-2",children:"Active file not literature note"})]})}function vre({docItem:t}){let{refreshConn:e,onShowDetails:r}=te(Ve),[n,{toggle:o}]=Jm(!1),i=wre();return m(M,{children:[m(nh,{buttons:m(M,{children:[m(fu,{className:"nav-action-button",onClick:Wr(()=>r("doc-item",t.itemID))}),m(vx,{className:"nav-action-button",isCollapsed:n,onClick:o}),m(wx,{className:"nav-action-button",onClick:e}),m(rh,{})]}),children:m(bx,{})}),m("div",{className:re("annots-container @container","overflow-auto px-3 pt-1 pb-8 text-xs"),children:i?m(yx,{collapsed:n,...i}):m(M,{children:"Loading"})})]})}var wre=()=>qt(te(Ve).store,t=>!t.doc||!t.annotations||!t.attachment?null:{annotations:t.annotations,getTags:e=>t.tags[e]??[]},Oa);S();function pe(){return pe=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},pe.apply(this,arguments)}function xx(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}function oh(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}function Ex(t){return t&&t.ownerDocument||document}function hu(t){return Ex(t).defaultView||window}function Sx(t,e){typeof t=="function"?t(e):t&&(t.current=e)}S();var xre=typeof window<"u"?Pt:U,Ix=xre;S();function ih(...t){return ie(()=>t.every(e=>e==null)?null:e=>{t.forEach(r=>{Sx(r,e)})},t)}S();S();var Ere=["onChange","maxRows","minRows","style","value"];function sh(t){return parseInt(t,10)||0}var Sre={shadow:{visibility:"hidden",position:"absolute",overflow:"hidden",height:0,top:0,left:0,transform:"translateZ(0)"}};function sj(t){return t==null||Object.keys(t).length===0||t.outerHeightStyle===0&&!t.overflow}var Ire=Y(function(e,r){let{onChange:n,maxRows:o,minRows:i=1,style:s,value:a}=e,l=xx(e,Ere),{current:u}=P(a!=null),c=P(null),f=ih(r,c),p=P(null),d=P(0),[h,b]=L({outerHeightStyle:0}),y=X(()=>{let V=c.current,G=hu(V).getComputedStyle(V);if(G.width==="0px")return{outerHeightStyle:0};let K=p.current;K.style.width=G.width,K.value=V.value||e.placeholder||"x",K.value.slice(-1)===`
|
|
`&&(K.value+=" ");let F=G.boxSizing,Q=sh(G.paddingBottom)+sh(G.paddingTop),O=sh(G.borderBottomWidth)+sh(G.borderTopWidth),_=K.scrollHeight;K.value="x";let I=K.scrollHeight,B=_;i&&(B=Math.max(Number(i)*I,B)),o&&(B=Math.min(Number(o)*I,B)),B=Math.max(B,I);let D=B+(F==="border-box"?Q+O:0),oe=Math.abs(B-_)<=1;return{outerHeightStyle:D,overflow:oe}},[o,i,e.placeholder]),v=(V,J)=>{let{outerHeightStyle:G,overflow:K}=J;return d.current<20&&(G>0&&Math.abs((V.outerHeightStyle||0)-G)>1||V.overflow!==K)?(d.current+=1,{overflow:K,outerHeightStyle:G}):V},x=X(()=>{let V=y();sj(V)||b(J=>v(J,V))},[y]),T=()=>{let V=y();sj(V)||ln(()=>{b(J=>v(J,V))})};return U(()=>{let V=oh(()=>{d.current=0,c.current&&T()}),J,G=c.current,K=hu(G);return K.addEventListener("resize",V),typeof ResizeObserver<"u"&&(J=new ResizeObserver(V),J.observe(G)),()=>{V.clear(),K.removeEventListener("resize",V),J&&J.disconnect()}}),Ix(()=>{x()}),U(()=>{d.current=0},[a]),m(M,{children:[m("textarea",pe({value:a,onChange:V=>{d.current=0,u||x(),n&&n(V)},ref:f,rows:i,style:pe({height:h.outerHeightStyle,overflow:h.overflow?"hidden":void 0},s)},l)),m("textarea",{"aria-hidden":!0,className:e.className,readOnly:!0,ref:p,tabIndex:-1,style:pe({},Sre.shadow,s,{padding:0})})]})}),gu=Ire;S();S();S();S();function _re(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function _x(...t){return e=>t.forEach(r=>_re(r,e))}function ah(...t){return X(_x(...t),t)}S();function aj(t,e=[]){let r=[];function n(i,s){let a=We(s),l=r.length;r=[...r,s];function u(f){let{scope:p,children:d,...h}=f,b=p?.[t][l]||a,y=ie(()=>h,Object.values(h));return H(b.Provider,{value:y},d)}function c(f,p){let d=p?.[t][l]||a,h=te(d);if(h)return h;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,c]}let o=()=>{let i=r.map(s=>We(s));return function(a){let l=a?.[t]||i;return ie(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return o.scopeName=t,[n,Ore(o,...e)]}function Ore(...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((a,{useScope:l,scopeName:u})=>{let f=l(i)[`__scope${u}`];return{...a,...f}},{});return ie(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return r.scopeName=e.scopeName,r}function Bt(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}S();S();function Ox(t){let e=P(t);return U(()=>{e.current=t}),ie(()=>(...r)=>{var n;return(n=e.current)===null||n===void 0?void 0:n.call(e,...r)},[])}function lj({prop:t,defaultProp:e,onChange:r=()=>{}}){let[n,o]=Tre({defaultProp:e,onChange:r}),i=t!==void 0,s=i?t:n,a=Ox(r),l=X(u=>{if(i){let f=typeof u=="function"?u(t):u;f!==t&&a(f)}else o(u)},[i,t,o,a]);return[s,l]}function Tre({defaultProp:t,onChange:e}){let r=L(t),[n]=r,o=P(n),i=Ox(e);return U(()=>{o.current!==n&&(i(n),o.current=n)},[n,o,i]),r}S();function cj(t){let e=P({value:t,previous:t});return ie(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}S();S();var yu=globalThis?.document?Pt:()=>{};function uj(t){let[e,r]=L(void 0);return yu(()=>{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,a;if("borderBoxSize"in i){let l=i.borderBoxSize,u=Array.isArray(l)?l[0]:l;s=u.inlineSize,a=u.blockSize}else s=t.offsetWidth,a=t.offsetHeight;r({width:s,height:a})});return n.observe(t,{box:"border-box"}),()=>n.unobserve(t)}else r(void 0)},[t]),e}S();S();function Cre(t,e){return an((r,n)=>{let o=e[r][n];return o??r},t)}var Tx=t=>{let{present:e,children:r}=t,n=Are(e),o=typeof r=="function"?r({present:n.isPresent}):Qe.only(r),i=ah(n.ref,o.ref);return typeof r=="function"||n.isPresent?gr(o,{ref:i}):null};Tx.displayName="Presence";function Are(t){let[e,r]=L(),n=P({}),o=P(t),i=P("none"),s=t?"mounted":"unmounted",[a,l]=Cre(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return U(()=>{let u=lh(n.current);i.current=a==="mounted"?u:"none"},[a]),yu(()=>{let u=n.current,c=o.current;if(c!==t){let p=i.current,d=lh(u);t?l("MOUNT"):d==="none"||u?.display==="none"?l("UNMOUNT"):l(c&&p!==d?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,l]),yu(()=>{if(e){let u=f=>{let d=lh(n.current).includes(f.animationName);f.target===e&&d&&ln(()=>l("ANIMATION_END"))},c=f=>{f.target===e&&(i.current=lh(n.current))};return e.addEventListener("animationstart",c),e.addEventListener("animationcancel",u),e.addEventListener("animationend",u),()=>{e.removeEventListener("animationstart",c),e.removeEventListener("animationcancel",u),e.removeEventListener("animationend",u)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:X(u=>{u&&(n.current=getComputedStyle(u)),r(u)},[])}}function lh(t){return t?.animationName||"none"}S();S();S();var Ax=Y((t,e)=>{let{children:r,...n}=t,o=Qe.toArray(r),i=o.find(Rre);if(i){let s=i.props.children,a=o.map(l=>l===i?Qe.count(s)>1?Qe.only(null):Zt(s)?s.props.children:null:l);return H(Cx,pe({},n,{ref:e}),Zt(s)?gr(s,void 0,a):null)}return H(Cx,pe({},n,{ref:e}),r)});Ax.displayName="Slot";var Cx=Y((t,e)=>{let{children:r,...n}=t;return Zt(r)?gr(r,{...Nre(n,r.props),ref:_x(e,r.ref)}):Qe.count(r)>1?Qe.only(null):null});Cx.displayName="SlotClone";var kre=({children:t})=>H(M,null,t);function Rre(t){return Zt(t)&&t.type===kre}function Nre(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]=(...a)=>{i(...a),o(...a)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}var Dre=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],kx=Dre.reduce((t,e)=>{let r=Y((n,o)=>{let{asChild:i,...s}=n,a=i?Ax:e;return U(()=>{window[Symbol.for("radix-ui")]=!0},[]),H(a,pe({},s,{ref:o}))});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var fj="Checkbox",[Fre,V$e]=aj(fj),[Pre,Mre]=Fre(fj),$re=Y((t,e)=>{let{__scopeCheckbox:r,name:n,checked:o,defaultChecked:i,required:s,disabled:a,value:l="on",onCheckedChange:u,...c}=t,[f,p]=L(null),d=ah(e,T=>p(T)),h=P(!1),b=f?!!f.closest("form"):!0,[y=!1,v]=lj({prop:o,defaultProp:i,onChange:u}),x=P(y);return U(()=>{let T=f?.form;if(T){let $=()=>v(x.current);return T.addEventListener("reset",$),()=>T.removeEventListener("reset",$)}},[f,v]),H(Pre,{scope:r,state:y,disabled:a},H(kx.button,pe({type:"button",role:"checkbox","aria-checked":os(y)?"mixed":y,"aria-required":s,"data-state":pj(y),"data-disabled":a?"":void 0,disabled:a,value:l},c,{ref:d,onKeyDown:Bt(t.onKeyDown,T=>{T.key==="Enter"&&T.preventDefault()}),onClick:Bt(t.onClick,T=>{v($=>os($)?!0:!$),b&&(h.current=T.isPropagationStopped(),h.current||T.stopPropagation())})})),b&&H(qre,{control:f,bubbles:!h.current,name:n,value:l,checked:y,required:s,disabled:a,style:{transform:"translateX(-100%)"}}))}),Lre="CheckboxIndicator",jre=Y((t,e)=>{let{__scopeCheckbox:r,forceMount:n,...o}=t,i=Mre(Lre,r);return H(Tx,{present:n||os(i.state)||i.state===!0},H(kx.span,pe({"data-state":pj(i.state),"data-disabled":i.disabled?"":void 0},o,{ref:e,style:{pointerEvents:"none",...t.style}})))}),qre=t=>{let{control:e,checked:r,bubbles:n=!0,...o}=t,i=P(null),s=cj(r),a=uj(e);return U(()=>{let l=i.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(s!==r&&f){let p=new Event("click",{bubbles:n});l.indeterminate=os(r),f.call(l,os(r)?!1:r),l.dispatchEvent(p)}},[s,r,n]),H("input",pe({type:"checkbox","aria-hidden":!0,defaultChecked:os(r)?!1:r},o,{tabIndex:-1,ref:i,style:{...t.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function os(t){return t==="indeterminate"}function pj(t){return os(t)?"indeterminate":t?"checked":"unchecked"}var Rx=$re,dj=jre;S();var Nx=Y(({className:t,checked:e,...r},n)=>m(Rx,{ref:n,className:re("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:m(dj,{className:re("flex items-center justify-center"),children:m(Vo,{icon:"chevrons-down",size:"0.75rem",className:"contents"})})}));Nx.displayName=Rx.displayName;var mj=Y(({id:t,checked:e,onCheckChange:r,title:n,disabled:o,className:i,...s},a)=>m("div",{className:re("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:a,...s,children:[m(Nx,{className:re("h-3 w-3",o&&"hidden"),id:t,checked:e,disabled:o,onCheckedChange:r}),m("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})]}));mj.displayName="ImportingStatus";var mg=require("obsidian");S();var Na=require("obsidian");S();var hj={sanitize:DOMPurify.sanitize.bind(DOMPurify),setIcon:Na.setIcon,renderMarkdown(t){return m(zre,{content:t})}};function zre({content:t}){let e=P(null);return m("div",{className:"contents",ref:n=>{n?(n.empty(),e.current&&e.current.unload(),e.current=new Na.Component,Na.MarkdownRenderer.renderMarkdown(t,n,"",e.current)):e.current&&(e.current.unload(),e.current=null)}})}var is=require("obsidian"),ch=class extends is.FileView{constructor(e){super(e),this.navigation=!1,this.allowNoFile=!0,this.requestUpdate=(0,is.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 is.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 is.FileView){let o=n.view.getSyncViewState();this.leaf.openFile(n.view.file,o)}}else{let e=this.leaf.workspace.getActiveFile();this.loadFile(e)}}};var gj=require("obsidian");var uh=require("obsidian"),fh="zt-citations",ph=async(t,e)=>typeof t=="string"&&t.trim().length>0?await e.database.search(t):await e.database.getItemsOf(50);function dh({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 a of e){let l=o.createEl("kbd","suggestion-hotkey");switch(l.setAttribute("aria-label",a),a){case"title":(0,uh.setIcon)(l,"type");break;case"creators":(0,uh.setIcon)(l,"user");break;case"date":(0,uh.setIcon)(l,"calendar");break;default:l.setText(a);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}),Ure(t)&&n.append(Wre(t))}var Ure=t=>t.itemType==="journalArticle",Wre=t=>{let{creators:e,date:r,publicationTitle:n,volume:o,issue:i,pages:s}=t,a={creators:Hre(e),date:r,publication:n,volume:o,issue:i,pages:s},l=(u,c,f)=>a[c]&&u.createSpan({cls:f??c,text:a[c]??void 0});return createDiv({cls:"meta"},u=>{(a.creators||a.date)&&u.createSpan({cls:"author-year"},c=>{l(c,"creators"),l(c,"date")}),l(u,"publication"),(a.volume||a.issue)&&u.createSpan({cls:"vol-issue"},c=>{l(c,"volume"),l(c,"issue")}),l(u,"pages")})},Hre=t=>{if(!t||!t[0])return"";let e=t[0],r=Qd(e)||em(e)?e.lastName:"";return t.length>1&&(r=r.trim()+" et al."),r};var bu=class extends gj.EditorSuggest{constructor(r){super(r.app);this.plugin=r;this.suggestEl.addClass(fh)}getSuggestions(r){return ph(r.query,this.plugin)}renderSuggestion=dh.bind(this)};var Qn=class extends tm{constructor(r){super(r.app);this.plugin=r;this.modalEl.addClass(fh)}getSuggestions(r){return ph(r,this.plugin)}renderSuggestion=dh.bind(this);onChooseSuggestion(){}};var vj=require("obsidian");var yj=require("@codemirror/state");async function bj(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 a=e.settings.libId,l=await e.databaseAPI.getAttachments(t.itemID,a),u=new Set(s.flatMap(y=>es(y,e.app.metadataCache))),c=l.filter(y=>u.has(y.itemID)),f;c.length===0&&(f=await Kn(l,e.app),f&&(ga(f,t),c.push(f)));let p=await e.databaseAPI.getNotes(t.itemID,a).then(y=>e.noteParser.normalizeNotes(y)),d=await vu(t,{all:l,selected:c,notes:p},e),h=Object.values(d)[0],b={notes:s.length,addedAnnots:0,updatedAnnots:0};for(let y of s){let v=n.metadataCache.getCache(y);if(!v)continue;let x=es(y,e.app.metadataCache);x||(f===void 0&&(f=await Kn(c,e.app)),f?x=[f.itemID]:x=[]);let T=n.vault.getAbstractFileByPath(y),$={plugin:e,sourcePath:y};if(r){let _=await i.renderNote(d[x[0]],$);await n.vault.modify(T,_);continue}let V=pu((v.sections?.filter(au)??[]).flatMap(_=>lu(_.id).map(I=>[I,_.position])),zi(([_])=>_),ha((_,I)=>({key:_,blocks:I.map(([B,D])=>D)}))),J=new Set(Object.values(v.blocks??{})?.filter(au).flatMap(_=>lu(_.id).map(I=>I))),G=new Map(x.map(_=>[d[_],[]])),K=[];if(await Promise.all(x.map(async _=>{let I=d[_];if(!(!I.annotations||I.annotations.length===0))return await Promise.all(I.annotations.map(async B=>{let D=ir(B,!0),oe=V[D];if(oe){if(!e.settings.current?.updateAnnotBlock)return;let se=await i.renderAnnot(B,I,$);K.push(...oe.blocks.map(be=>({from:be.start.offset,to:be.end.offset,insert:se})))}else J.has(D)||G.get(I).push(B)})??[])})),K.length>0){let _=yj.EditorState.create({doc:await n.vault.read(T)}).update({changes:K}).state.doc.toString();await n.vault.modify(T,_)}await i.setFrontmatterTo(T,jt(h,$).docItem);let F=[...G].reduce((_,[I,B])=>{if(B.length===0)return _;let D=i.renderAnnots({...I,annotations:B},$);return(_&&_+`
|
|
`)+D},"");F&&await n.vault.append(T,F);let Q=K.length,O=[...G.values()].reduce((_,I)=>_+I.length,0);b.updatedAnnots+=Q,b.addedAnnots+=O}return b}async function vu(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 a={};for(let l of r){let u=l?await o.databaseAPI.getAnnotations(l.itemID,i):[];a[l.itemID]={docItem:t,attachment:l,tags:{...s,...await o.databaseAPI.getTags(u.map(c=>[c.itemID,i]))},allAttachments:e,annotations:u,notes:n}}return a}async function mh({alt:t,item:e},{start:r,end:n,editor:o,file:i},s){let{plugin:a}=s,l=a.settings.libId,u=await a.databaseAPI.getAttachments(e.itemID,l),c=new Set(es(i,a.app.metadataCache)),f=u.filter(y=>c.has(y.itemID)),p;f.length===0&&(p=await Kn(u,a.app),p&&(ga(p,e),f.push(p)));let d=await a.databaseAPI.getNotes(e.itemID,l).then(y=>a.noteParser.normalizeNotes(y)),h=await vu(e,{all:u,selected:f,notes:d},s.plugin),b=s.renderCitations(Object.values(h),{plugin:s.plugin},t);o.replaceRange(b,r,n),o.setCursor(o.offsetToPos(o.posToOffset(r)+b.length))}var wj=t=>vj.Keymap.isModifier(t,"Shift");var Kre=[{command:"\u2191\u2193",purpose:"to navigate"},{command:"\u21B5",purpose:"to insert primary Markdown citation"},{command:"\u21B5 (end with /)",purpose:"Insert secondary Markdown citation"}],wu=class extends bu{constructor(r){super(r);this.plugin=r;this.setInstructions(Kre)}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 a={...r};return(o[r.ch]==="]"||o[r.ch]==="\u3011")&&(a.ch+=1),{end:a,start:{ch:s.index,line:r.line,alt:!!s[0]?.endsWith("/")},query:s[1].replaceAll(/\/$/g,"")}}selectSuggestion(r){this.context&&mh({item:r.item,alt:this.context.start.alt??!1},this.context,this.plugin.templateRenderer)}};var Vre=[{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"}],Dx=class extends Qn{constructor(r){super(r);this.plugin=r;this.setInstructions(Vre)}};async function Fx(t,e,r){let n=await hh(r);if(!n)return!1;let o=t.getCursor();return await mh({item:n.value.item,alt:wj(n.evt)},{start:o,end:o,editor:t,file:e},r.templateRenderer),!0}async function hh(t){return await Wi(new Dx(t))}var us=require("obsidian");S();S();S();S();var Zo=Z(Go());S();function Mx(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}var Ij=Z(Go());S();var Eu=Z(Go());S();var xj=Z(Go());S();function xu(t){let{styling:e,arrowStyle:r="single",expanded:n,nodeType:o,onClick:i}=t;return N.createElement("div",(0,xj.default)({},e("arrowContainer",r),{onClick:i}),N.createElement("div",e(["arrow","arrowSign"],o,n,r),"\u25B6",r==="double"&&N.createElement("div",e(["arrowSign","arrowSignInner"]),"\u25B6")))}function Gre(t,e){return t==="Object"?Object.keys(e).length:t==="Array"?e.length:1/0}function Zre(t){return typeof t.set=="function"}function Jre(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(a=>({key:a,value:e[a]}))}}else if(t==="Array")i={entries:e.slice(n,o+1).map((s,a)=>({key:a+n,value:s}))};else{let s=0,a=[],l=!0,u=Zre(e);for(let c of e){if(s>o){l=!1;break}n<=s&&(u&&Array.isArray(c)?typeof c[0]=="string"||typeof c[0]=="number"?a.push({key:c[0],value:c[1]}):a.push({key:`[entry ${s}]`,value:{"[key]":c[0],"[value]":c[1]}}):a.push({key:s,value:c})),s++}i={hasMore:!l,entries:a}}return i}function $x(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 Lx(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=Jre.bind(null,t,e,r);if(!n)return s().entries;let a=i<1/0,l=Math.min(i-o,Gre(t,e));if(t!=="Iterable"){if(l<=n||n<7)return s(o,i).entries}else if(l<=n&&!a)return s(o,i).entries;let u;if(t==="Iterable"){let{hasMore:c,entries:f}=s(o,o+n-1);u=c?[...f,...$x(o+n,o+2*n-1,n)]:f}else u=a?$x(o,i,n):[...s(0,n-5).entries,...$x(n-4,l-5,n),...s(l-4,l-1).entries];return u}var Ej=Z(Go());S();function jx(t){let{styling:e,from:r,to:n,renderChildNodes:o,nodeType:i}=t,[s,a]=L(!1),l=X(()=>{a(!s)},[s]);return s?N.createElement("div",e("itemRange",s),o(t,r,n)):N.createElement("div",(0,Ej.default)({},e("itemRange",s),{onClick:l}),N.createElement(xu,{nodeType:i,styling:e,expanded:!1,onClick:l,arrowStyle:"double"}),`${r} ... ${n}`)}function Yre(t){return t.to!==void 0}function Sj(t,e,r){let{nodeType:n,data:o,collectionLimit:i,circularCache:s,keyPath:a,postprocessValue:l,sortObjectKeys:u}=t,c=[];return Lx(n,o,u,i,e,r).forEach(f=>{if(Yre(f))c.push(N.createElement(jx,(0,Eu.default)({},t,{key:`ItemRange--${f.from}-${f.to}`,from:f.from,to:f.to,renderChildNodes:Sj})));else{let{key:p,value:d}=f,h=s.indexOf(d)!==-1;c.push(N.createElement(Su,(0,Eu.default)({},t,{postprocessValue:l,collectionLimit:i,key:`Node--${p}`,keyPath:[p,...a],value:l(d),circularCache:[...s,d],isCircular:h,hideRoot:!1})))}}),c}function ss(t){let{circularCache:e=[],collectionLimit:r,createItemString:n,data:o,expandable:i,getItemString:s,hideRoot:a,isCircular:l,keyPath:u,labelRenderer:c,level:f=0,nodeType:p,nodeTypeIndicator:d,shouldExpandNodeInitially:h,styling:b}=t,[y,v]=L(l?!1:h(u,o,f)),x=X(()=>{i&&v(!y)},[i,y]),T=y||a&&f===0?Sj({...t,circularCache:e,level:f+1}):null,$=N.createElement("span",b("nestedNodeItemType",y),d),V=s(p,o,$,n(o,r),u),J=[u,p,y,i];return a?N.createElement("li",b("rootNode",...J),N.createElement("ul",b("rootNodeChildren",...J),T)):N.createElement("li",b("nestedNode",...J),i&&N.createElement(xu,{styling:b,nodeType:p,expanded:y,onClick:x}),N.createElement("label",(0,Eu.default)({},b(["label","nestedNodeLabel"],...J),{onClick:x}),c(...J)),N.createElement("span",(0,Eu.default)({},b("nestedNodeItemString",...J),{onClick:x}),V),N.createElement("ul",b("nestedNodeChildren",...J),T))}function Xre(t){let e=Object.getOwnPropertyNames(t).length;return`${e} ${e!==1?"keys":"key"}`}function qx(t){let{data:e,...r}=t;return N.createElement(ss,(0,Ij.default)({},r,{data:e,nodeType:"Object",nodeTypeIndicator:r.nodeType==="Error"?"Error()":"{}",createItemString:Xre,expandable:Object.getOwnPropertyNames(e).length>0}))}var _j=Z(Go());S();function Qre(t){return`${t.length} ${t.length!==1?"items":"item"}`}function Bx(t){let{data:e,...r}=t;return N.createElement(ss,(0,_j.default)({},r,{data:e,nodeType:"Array",nodeTypeIndicator:"[]",createItemString:Qre,expandable:e.length>0}))}var Oj=Z(Go());S();function ene(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 zx(t){return N.createElement(ss,(0,Oj.default)({},t,{nodeType:"Iterable",nodeTypeIndicator:"()",createItemString:ene,expandable:!0}))}S();function Hr(t){let{nodeType:e,styling:r,labelRenderer:n,keyPath:o,valueRenderer:i,value:s,valueGetter:a=l=>l}=t;return N.createElement("li",r("value",e,o),N.createElement("label",r(["label","valueLabel"],e,o),n(o,e,!1,!1)),N.createElement("span",r("valueText",e,o),i(a(s),s,...o)))}function Su(t){let{getItemString:e,keyPath:r,labelRenderer:n,styling:o,value:i,valueRenderer:s,isCustomNode:a,...l}=t,u=a(i)?"Custom":Mx(i),c={getItemString:e,key:r[0],keyPath:r,labelRenderer:n,nodeType:u,styling:o,value:i,valueRenderer:s},f={...l,...c,data:i,isCustomNode:a};switch(u){case"Object":case"Error":case"WeakMap":case"WeakSet":return N.createElement(qx,f);case"Array":return N.createElement(Bx,f);case"Iterable":case"Map":case"Set":return N.createElement(zx,f);case"String":return N.createElement(Hr,(0,Zo.default)({},c,{valueGetter:p=>`"${p}"`}));case"Number":return N.createElement(Hr,c);case"Boolean":return N.createElement(Hr,(0,Zo.default)({},c,{valueGetter:p=>p?"true":"false"}));case"Date":return N.createElement(Hr,(0,Zo.default)({},c,{valueGetter:p=>p.toISOString()}));case"Null":return N.createElement(Hr,(0,Zo.default)({},c,{valueGetter:()=>"null"}));case"Undefined":return N.createElement(Hr,(0,Zo.default)({},c,{valueGetter:()=>"undefined"}));case"Function":case"Symbol":return N.createElement(Hr,(0,Zo.default)({},c,{valueGetter:p=>p.toString()}));case"Custom":return N.createElement(Hr,c);default:return N.createElement(Hr,(0,Zo.default)({},c,{valueGetter:()=>`<${u}>`}))}}var ag=Z(gh()),X3=Z(kj()),tE=Z($j()),rE=Z(o3()),Xx=Z(C3()),Qx=Z(V3());function G3(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 Z3(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 J3(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 zt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?J3(Object(r),!0).forEach(function(n){(0,X3.default)(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):J3(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var Q3=rE.default,Y3=Object.keys(Q3),vie=function(e){return e<.25?1:e<.5?.9-e:1.1-e},wie=function(e){var r=(0,Xx.default)(e),n=Z3(r.array()),o=(0,tE.default)(n,3),i=o[0],s=o[1],a=o[2],l=[vie(i),s,a],u=G3(l);return Xx.default.rgb(u).hex()},Ma=function(e){return function(r){return{className:[r.className,e.className].filter(Boolean).join(" "),style:zt(zt({},r.style||{}),e.style||{})}}},xie=function(e,r){if(e===void 0)return r;if(r===void 0)return e;var n=(0,ag.default)(e),o=(0,ag.default)(r);switch(n){case"string":switch(o){case"string":return[r,e].filter(Boolean).join(" ");case"object":return Ma({className:e,style:r});case"function":return function(i){for(var s=arguments.length,a=new Array(s>1?s-1:0),l=1;l<s;l++)a[l-1]=arguments[l];return Ma({className:e})(r.apply(void 0,[i].concat(a)))}}break;case"object":switch(o){case"string":return Ma({className:r,style:e});case"object":return zt(zt({},r),e);case"function":return function(i){for(var s=arguments.length,a=new Array(s>1?s-1:0),l=1;l<s;l++)a[l-1]=arguments[l];return Ma({style:e})(r.apply(void 0,[i].concat(a)))}}break;case"function":switch(o){case"string":return function(i){for(var s=arguments.length,a=new Array(s>1?s-1:0),l=1;l<s;l++)a[l-1]=arguments[l];return e.apply(void 0,[Ma(i)({className:r})].concat(a))};case"object":return function(i){for(var s=arguments.length,a=new Array(s>1?s-1:0),l=1;l<s;l++)a[l-1]=arguments[l];return e.apply(void 0,[Ma(i)({style:r})].concat(a))};case"function":return function(i){for(var s=arguments.length,a=new Array(s>1?s-1:0),l=1;l<s;l++)a[l-1]=arguments[l];return e.apply(void 0,[r.apply(void 0,[i].concat(a))].concat(a))}}}},Eie=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]=xie(e[s],r[s]),i},{})},Sie=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(l){return e[l]}).filter(Boolean),a=s.reduce(function(l,u){return typeof u=="string"?l.className=[l.className,u].filter(Boolean).join(" "):(0,ag.default)(u)==="object"?l.style=zt(zt({},l.style),u):typeof u=="function"&&(l=zt(zt({},l),u.apply(void 0,[l].concat(o)))),l},{className:"",style:{}});return a.className||delete a.className,Object.keys(a.style).length===0&&delete a.style,a},eE=function(e){return Object.keys(e).reduce(function(r,n){return r[n]=/^base/.test(n)?wie(e[n]):n==="scheme"?e[n]+":inverted":e[n],r},{})},eq=(0,Qx.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?Q3:n,i=e.base16Themes,s=i===void 0?null:i,a=Iie(r,s);a&&(r=zt(zt({},a),r));for(var l=Y3.reduce(function(b,y){return b[y]=r[y]||o[y],b},{}),u=Object.keys(r).reduce(function(b,y){return Y3.indexOf(y)===-1&&(b[y]=r[y]),b},{}),c=t(l),f=Eie(u,c),p=arguments.length,d=new Array(p>3?p-3:0),h=3;h<p;h++)d[h-3]=arguments[h];return(0,Qx.default)(Sie,2).apply(void 0,[f].concat(d))},3),tq=function(e){return!!e.extend},Iie=function(e,r){if(e&&tq(e)&&e.extend&&(e=e.extend),typeof e=="string"){var n=e.split(":"),o=(0,tE.default)(n,2),i=o[0],s=o[1];r?e=r[i]:e=rE[i],s==="inverted"&&(e=eE(e))}return e&&Object.prototype.hasOwnProperty.call(e,"base00")?e:void 0},rq=function(e){return typeof e=="string"?"".concat(e,":inverted"):e&&tq(e)&&e.extend?typeof e.extend=="string"?zt(zt({},e),{},{extend:"".concat(e.extend,":inverted")}):zt(zt({},e),{},{extend:eE(e.extend)}):e&&eE(e)};var nq={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 _ie=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}),Oie=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}),Tie=t=>{let e=_ie(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:Oie(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:a}=r;return{style:{...a,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:a}=r;return{style:{...a,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"}}},Cie=eq(Tie,{defaultBase16:nq}),oq=Cie;var iq=t=>t,Aie=(t,e,r)=>r===0,kie=(t,e,r,n)=>N.createElement("span",null,r," ",n),Rie=t=>{let[e]=t;return N.createElement("span",null,e,":")},Nie=()=>!1;function sq(t){let{data:e,theme:r,invertTheme:n,keyPath:o=["root"],labelRenderer:i=Rie,valueRenderer:s=iq,shouldExpandNodeInitially:a=Aie,hideRoot:l=!1,getItemString:u=kie,postprocessValue:c=iq,isCustomNode:f=Nie,collectionLimit:p=50,sortObjectKeys:d=!1}=t,h=ie(()=>oq(n?rq(r):r),[r,n]);return N.createElement("ul",h("tree"),N.createElement(Su,{keyPath:l?[]:o,value:c(e),isCustomNode:f,styling:h,labelRenderer:i,valueRenderer:s,shouldExpandNodeInitially:a,hideRoot:l,getItemString:u,postprocessValue:c,collectionLimit:p,sortObjectKeys:d}))}var aq=require("obsidian");var Die=()=>{let[t]=Mt("clipboard-copy");return m("span",{ref:t})},lq=(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 aq.Notice("Copied JSON code block to clipboard")};return m("span",{role:"button",tabIndex:0,onClick:i,onKeyDown:i,"aria-label":"Copy item details in JSON",children:[n," ",m(Die,{})]})}if(o[1]==="creators"&&o.length===3){let i=jc(e);if(i)return m("span",{children:i})}if(o[1]==="tags"&&o.length===3){let i=e;return m("span",{children:['"',i.name,'"" (',Bi[i.type],")"]})}if(o[0]==="sortIndex"&&o.length===2)return m("span",{children:["[",e.join(", "),"]"]});if(o.length===2&&Array.isArray(e)&&e.length===1){let i=JSON.stringify(e[0]);return m("span",{children:[r," ",i.length>100?i.slice(0,100)+"...":i]})}return m("span",{children:[r," ",n]})};var uq=require("obsidian");var fq=(t,e,r,n)=>{let o=t.length===1,i=t.slice(0,-1),s=cq(i);return m("span",{...o?void 0:{onContextMenu:u=>{let c=new uq.Menu().addItem(f=>f.setTitle("Copy template").onClick(()=>{navigator.clipboard.writeText(`<%= ${s} %>`)}));n&&e!=="Array"&&c.addItem(f=>f.setTitle("Copy template (using with)").onClick(()=>{let[p,...d]=i,h=typeof p=="string"&&pq.test(p)?p:`'${p}'`,b=cq(d);navigator.clipboard.writeText(`<% { const { ${h}: $it } = ${b}; %>
|
|
<%= $it %>
|
|
<% } %>`)})),e==="Array"&&c.addItem(f=>f.setTitle("Copy template (using for-of loop)").onClick(()=>{navigator.clipboard.writeText(`<% for (const $it of ${s}) { %>
|
|
<%= $it %>
|
|
<% } %>`)})).addItem(f=>f.setTitle("Copy template (using forEach)").onClick(()=>{navigator.clipboard.writeText(`<% ${s}.forEach(($it, i) => { %>
|
|
<%= $it %>
|
|
<% }) %>`)})).addItem(f=>f.setTitle("Copy template (pick first element)").onClick(()=>{navigator.clipboard.writeText(`<%= ${s}.first() %>`)})).addItem(f=>f.setTitle("Copy template (pick last element)").onClick(()=>{navigator.clipboard.writeText(`<%= ${s}.last() %>`)})),A0.has(i[0])||c.addItem(f=>f.setTitle("Copy template (render when present)").onClick(()=>{navigator.clipboard.writeText(`<% if (${s}) { %>
|
|
<%= ${s} %>
|
|
<% } %>`)})),u.preventDefault(),c.showAtMouseEvent(u.nativeEvent)},style:{cursor:"context-menu"}},children:[t[0],": "]})},cq=t=>"it"+t.map(Fie).reverse().join(""),pq=/^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u,Fie=t=>typeof t=="number"?`[${t}]`:pq.test(t)?`.${t}`:`[${JSON.stringify(t)}]`;var Pie=new Set(["sortIndex"]),Mie=new Set(["creators","tags"]),$ie=new Set(["position"]),dq=(t,e,r)=>{let n=t[0];return Pie.has(n)||Mie.has(n)&&Array.isArray(e)&&e.length>6?!1:!!($ie.has(n)||r<1||r<2&&Array.isArray(e)&&e.length>1)};var Lie={grad:.9,turn:360,rad:360/(2*Math.PI)},ro=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},it=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=Math.pow(10,e)),Math.round(r*t)/r+0},_r=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=1),t>r?r:t>e?t:e},Eq=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},mq=function(t){return{r:_r(t.r,0,255),g:_r(t.g,0,255),b:_r(t.b,0,255),a:_r(t.a)}},nE=function(t){return{r:it(t.r),g:it(t.g),b:it(t.b),a:it(t.a,3)}},jie=/^#([0-9a-f]{3,8})$/i,lg=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},Sq=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),a=s?i===e?(r-n)/s:i===r?2+(n-e)/s:4+(e-r)/s:0;return{h:60*(a<0?a+6:a),s:i?s/i*100:0,v:i/255*100,a:o}},Iq=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),a=n*(1-(e-i)*r),l=n*(1-(1-e+i)*r),u=i%6;return{r:255*[n,a,s,s,l,n][u],g:255*[l,n,n,a,s,s][u],b:255*[s,s,l,n,n,a][u],a:o}},hq=function(t){return{h:Eq(t.h),s:_r(t.s,0,100),l:_r(t.l,0,100),a:_r(t.a)}},gq=function(t){return{h:it(t.h),s:it(t.s),l:it(t.l),a:it(t.a,3)}},yq=function(t){return Iq((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},qu=function(t){return{h:(e=Sq(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},qie=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Bie=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,zie=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Uie=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,bq={string:[[function(t){var e=jie.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?it(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?it(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=zie.exec(t)||Uie.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:mq({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=qie.exec(t)||Bie.exec(t);if(!e)return null;var r,n,o=hq({h:(r=e[1],n=e[2],n===void 0&&(n="deg"),Number(r)*(Lie[n]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return yq(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 ro(e)&&ro(r)&&ro(n)?mq({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(!ro(e)||!ro(r)||!ro(n))return null;var s=hq({h:Number(e),s:Number(r),l:Number(n),a:Number(i)});return yq(s)},"hsl"],[function(t){var e=t.h,r=t.s,n=t.v,o=t.a,i=o===void 0?1:o;if(!ro(e)||!ro(r)||!ro(n))return null;var s=function(a){return{h:Eq(a.h),s:_r(a.s,0,100),v:_r(a.v,0,100),a:_r(a.a)}}({h:Number(e),s:Number(r),v:Number(n),a:Number(i)});return Iq(s)},"hsv"]]},vq=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]},Wie=function(t){return typeof t=="string"?vq(t.trim(),bq.string):typeof t=="object"&&t!==null?vq(t,bq.object):[null,void 0]};var oE=function(t,e){var r=qu(t);return{h:r.h,s:_r(r.s+100*e,0,100),l:r.l,a:r.a}},iE=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},wq=function(t,e){var r=qu(t);return{h:r.h,s:r.s,l:_r(r.l+100*e,0,100),a:r.a}},xq=function(){function t(e){this.parsed=Wie(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 it(iE(this.rgba),2)},t.prototype.isDark=function(){return iE(this.rgba)<.5},t.prototype.isLight=function(){return iE(this.rgba)>=.5},t.prototype.toHex=function(){return e=nE(this.rgba),r=e.r,n=e.g,o=e.b,s=(i=e.a)<1?lg(it(255*i)):"","#"+lg(r)+lg(n)+lg(o)+s;var e,r,n,o,i,s},t.prototype.toRgb=function(){return nE(this.rgba)},t.prototype.toRgbString=function(){return e=nE(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 gq(qu(this.rgba))},t.prototype.toHslString=function(){return e=gq(qu(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=Sq(this.rgba),{h:it(e.h),s:it(e.s),v:it(e.v),a:it(e.a,3)};var e},t.prototype.invert=function(){return nr({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),nr(oE(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),nr(oE(this.rgba,-e))},t.prototype.grayscale=function(){return nr(oE(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),nr(wq(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),nr(wq(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"?nr({r:(r=this.rgba).r,g:r.g,b:r.b,a:e}):it(this.rgba.a,3);var r},t.prototype.hue=function(e){var r=qu(this.rgba);return typeof e=="number"?nr({h:e,s:r.s,l:r.l,a:r.a}):it(r.h)},t.prototype.isEqual=function(e){return this.toHex()===nr(e).toHex()},t}(),nr=function(t){return t instanceof xq?t:new xq(t)};var Hie=/^#(?:[\dA-F]{3}){1,2}$|^#(?:[\dA-F]{4}){1,2}$/i,Kie=t=>{let e=nr(t),{r,g:n,b:o}=e.rgba;return r*.299+n*.587+o*.114>186},_q=(t,e,...r)=>{if(typeof e=="string"&&Hie.test(e))return m("span",{style:{backgroundColor:e,padding:"0 0.5em",color:Kie(e)?"black":"white"},children:e});let n;return r[0]==="linkMode"&&typeof e=="number"&&(n=Md[e]),r[0]==="type"&&typeof e=="number"&&(r.length===2&&Ae[e]?n=Ae[e]:r.length===4&&typeof r[1]=="number"&&r[2]==="tags"&&Bi[e]&&(n=Bi[e])),n?m(M,{children:[t," ",m("span",{children:["(",n,")"]})]}):t};var Oq=()=>document.body.classList.contains("theme-dark"),Vie={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"},Gie={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 sE({item:t,registerCssChange:e}){let[r,n]=L(()=>Oq());return U(()=>e?.(()=>n(Oq())),[e]),t?m(sq,{data:t,theme:r?Gie:Vie,invertTheme:!1,keyPath:["Zotero Item Data"],shouldExpandNodeInitially:dq,valueRenderer:_q,labelRenderer:fq,getItemString:lq}):m("div",{children:"No Details Available"})}var Tq=require("obsidian");var cg=t=>({plugin:t,sourcePath:""});function Zie(){return uu((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 a=await n.databaseAPI.getAttachments(r.docItem,i),l=a.find(d=>d.itemID===r.attachment)??null;r.attachment&&!l&&console.error("TemplatePreview: no attachment found for id "+r.attachment);let u=l?await n.databaseAPI.getAnnotations(l.itemID,i):[],c=u.find(d=>d.itemID===r.annot);r.annot&&!c&&console.error("TemplatePreview: no annotation found for id "+r.annot);let f=await n.databaseAPI.getTags([[r.docItem,i],...u.map(d=>[d.itemID,i])]),p;try{p=await n.databaseAPI.getNotes(s.itemID,i).then(d=>n.noteParser.normalizeNotes(d))}catch(d){console.error(d),p=[]}return t(()=>({preview:{docItem:s,allAttachments:a,annotations:u,attachment:l,tags:f,annot:u.find(d=>d.itemID===r.annot),notes:p}})),!0}}))}function Cq(t,e){let r=null,n=null,o=null;return function(...i){if(r&&window.clearTimeout(r),n){o=i;return}r=window.setTimeout(()=>{r=null,n=t(...i).then(()=>{o?n=t(...o):n=null}).catch(s=>{console.error(s),n=null})},e)}}var $a=class extends Tq.FileView{constructor(r,n){super(r);this.plugin=n;this.store=Zie()}store;canAcceptExtension(r){return r==="md"}getTemplateType(r){if(!r)return!1;let n=wt(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:a}=n;o={preview:{docItem:i.itemID,attachment:s?.itemID,annot:a?.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]=Ns(this.plugin);n&&this.register(n),await r}};var La="zotero-item-details",Aq=({templateType:t})=>t==="annotation"?t:"note",ug=class extends $a{getViewType(){return La}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]=Ns(this.plugin);r&&this.register(r),await e,N.render(m(Jie,{store:this.store,plugin:this.plugin}),this.contentEl)}async onClose(){N.unmountComponentAtNode(this.contentEl),await super.onClose()}};function Jie({store:t,plugin:e}){let r=qt(t,Aq),n=qt(t,i=>i.preview),o=ie(()=>{let i=cg(e);if(!n)return null;switch(r){case"note":{let s=jt(n,i);return s.docItem.annotations=void 0,s.docItem}case"annotation":{let s=jt(n,i),a=n.annot?s.annotations.find(l=>l.itemID===n.annot?.itemID):s.annotations[0];return a?(a.docItem=void 0,a):null}default:throw new Error("Unsupported template type")}},[e,n,r]);return o?m(sE,{item:o,registerCssChange:i=>(e.app.workspace.on("css-change",i),()=>e.app.workspace.off("css-change",i))}):m("div",{})}var kq=Z(ks(),1),Or=require("obsidian");var ja="zotero-template-preview",fg=class extends $a{getViewType(){return ja}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=Rq(this.leaf.group,this.plugin);if(!r)return!1;let n=lE(e,this.plugin.settings.templateDir,this.app);if(!n||!(n instanceof Or.TFile)){new Or.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 Or.Notice("Cannot switch to template")),note:this.addAction("file-input","Open Note Template",async()=>await this.switchToTemplate("note")||new Or.Notice("Cannot switch to template")),annotation:this.addAction("highlighter","Open Template for Single Annotation",async()=>await this.switchToTemplate("annotation")||new Or.Notice("Cannot switch to template")),field:this.addAction("info","Open Template for Note Properties",async()=>await this.switchToTemplate("field")||new Or.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=cg(this.plugin),i=this.plugin.templateRenderer;try{switch(r){case"annotation":{let l=e.annot??e.annotations[0];if(!l){this.contentEl.setText("No annotation data available");return}n=i.renderAnnot(l,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,kq.assertNever)(r)}if(n===this.content?.markdown)return;this.content?.unload(),this.contentEl.empty();let s=await(0,Or.loadPrism)(),a=s.highlight(n,s.languages.markdown,"markdown");this.content=new aE(n),this.contentEl.createEl("pre").createEl("code",{cls:"language-markdown"}).innerHTML=a}catch(s){this.content?.unload(),this.contentEl.empty();let a=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:a})}}requestRender=Cq(()=>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()}))}},aE=class extends Or.Component{constructor(r){super();this.markdown=r}};async function fs(t,e,{app:r,settings:n}){let{workspace:o}=r,i=lE(t,n.templateDir,r);if(!i||!(i instanceof us.TFile)){new us.Notice("Template file not found: "+t);return}let s=o.getLeavesOfType("markdown").filter(c=>{let f=c.view;return f.file?wt(f.file.path,n.templateDir)?.type==="ejectable"&&c.getRoot().type==="floating":!1});if(s.length>0){let c=s[0];if(await c.openFile(i),!c.group)return;let f=o.getGroupLeaves(c.group);for(let p of f){let d=p.view.getViewType();if(d===ja||d===La){let h=p.view.getState();await p.view.setState({...h,preview:e},{})}}return}let a=o.openPopoutLeaf(),l=o.createLeafBySplit(a,"vertical"),u=o.createLeafBySplit(l,"vertical");await Promise.all([a.openFile(i,{active:!0}),l.setViewState({type:ja,state:{file:i.path,preview:e},group:a}),u.setViewState({type:La,state:{file:i.path,preview:e},group:a})])}function lE(t,e,r){let n=mi(t,e),o=r.vault.getAbstractFileByPath(n);return o instanceof us.TFile?o:null}function Rq(t,e){return e.app.workspace.getGroupLeaves(t).find(n=>n.view instanceof us.MarkdownView&&n.view.file&&wt(n.view.file.path,e.settings.templateDir)?.type==="ejectable")}var Nq=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 a=e.target.win,{workspace:l}=t.app,u=p=>{p.dataTransfer?.getData(s)===i&&o.flush(),l.off("editor-drop",u),a.removeEventListener("dragend",c)},c=()=>{o.cancel(),l.off("editor-drop",u)},f=l.on("editor-drop",p=>{p.dataTransfer?.getData("drag-source")===i&&o.flush(),l.offref(f)});a.addEventListener("dragend",c,{once:!0}),n&&e.dataTransfer.setDragImage(n,0,0)},Dq=t=>({storeSelector:e=>Yd(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 a=t.app.workspace.getActiveFile(),l=a&&bt(a)?a.path:null;return t.templateRenderer.renderAnnot(e,{tags:i,attachment:n,allAttachments:r,annotations:s,docItem:o.docItem,notes:[]},{plugin:t,sourcePath:l,merge:!1})}});var qa=require("obsidian");var Fq=t=>(e,r)=>{let n=new qa.Menu;if(n.addItem(o=>o.setTitle("Jump to note").setIcon("links-going-out").onClick(Yie(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})}},Yie=(t,e)=>async()=>{let r=e.app.workspace.getActiveFile(),n=r&&bt(r)?r.path:void 0,o=e.plugin.noteIndex.getBlocksFor({item:t,file:n}).shift();if(!o){new qa.Notice("No embed for this annotation in current note");return}let i=o.blocks.sort((p,d)=>{let h=p.start.offset-d.start.offset;return h!==0?h:p.end.offset-d.end.offset})[0];await sleep(10);let{leaf:s}=e,{workspace:a,vault:l}=e.app,u;if(s.group)u=a.getGroupLeaves(s.group);else{u=[];let p=a.getActiveFileView();p&&u.push(p.leaf)}let c=!1,f=i.end.line+1;for(let p of u)p&&p.view instanceof qa.MarkdownView&&p.view.file?.path===o.file&&(p.view.setEphemeralState({line:f}),c=!0);if(!c){let p=l.getAbstractFileByPath(o.file);if(!p||!bt(p))throw new Error("File from block info not found: "+o.file);a.getLeaf().openFile(p,{eState:{line:f}})}};var Pq=(t,e)=>e.length===0?null:t?e.find(r=>r.itemID===t)??e[0]:e[0],pg=()=>({doc:null,allAttachments:null,attachmentID:null,annotations:null,attachment:null,tags:{}}),Xie=()=>({follow:"zt-reader",doc:null,allAttachments:null,attachmentID:null,annotations:null,attachment:null,tags:{}}),Bu=t=>t.databaseAPI,Mq=t=>uu((e,r)=>{let n=async(s,a)=>{let l=(await Bu(t).getAttachments(s,a)).filter(Rc);e(u=>({...u,allAttachments:l,attachment:Pq(u.attachmentID,l)}))},o=async(s,a)=>{let l=await Bu(t).getTags([[s,a]]);return e(u=>({...u,tags:l})),l},i=async s=>{let{attachment:a}=r();if(!a)return;let l=await Bu(t).getAnnotations(a.itemID,s),u=N0(l);e(p=>({...p,annotations:D0(u),attachment:a}));let c=await Bu(t).getTags(l.map(p=>[p.itemID,s])),f=F0(u,c);e(p=>({...p,tags:{...p.tags,...f}}))};return{...Xie(),loadDocItem:async(s,a,l,u=!1)=>{if(s<0)return e(pg());if(r().doc?.docItem.itemID===s&&!u)return;let c=(await Bu(t).getItems([[s,l]]))[0];if(!c)return e(pg());let f={docItem:c,lib:l};if(a<0){let p=_0(window.localStorage,c);e({...pg(),doc:f,attachmentID:p})}else pa(window.localStorage,c,a),e({...pg(),doc:f,attachmentID:a});await n(c.itemID,l),await o(c.itemID,l),await i(l)},refresh:async()=>{let{doc:s,attachment:a}=r();if(!s)return;let{docItem:l,lib:u}=s;await n(l.itemID,u),await o(l.itemID,u),a&&await i(u)},setActiveAtch:s=>{let{doc:a,allAttachments:l}=r();if(a)if(pa(window.localStorage,a.docItem,s),!l)e(u=>({...u,attachment:null,attachmentID:s}));else{let u=Pq(s,l);e(c=>({...c,attachment:u,attachmentID:s}))}},setFollow:s=>e({follow:s})}});var hg="zotero-annotation-view",dg=class extends ch{constructor(r,n){super(r);this.plugin=n;this.store=Mq(n)}update(){if(this.follow!=="ob-note")return;let r=this.plugin.settings.libId;(async()=>{if(this.file?.extension!=="md")return!1;let n=Qi(this.file,this.app.metadataCache),o=es(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 hg}#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:a}=i;this.setStatePrev(l=>({...l,itemId:s,attachmentId:a})).then(()=>{if(n=!1,r===null)return;let l=r;r=null,o(l)})}};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 hh(r);if(!n)return;let{itemID:o}=n.value.item,i=r.settings.libId,s=await r.databaseAPI.getAttachments(o,i),a=await Kn(s,this.app);await this.setStatePrev(({attachmentId:l,...u})=>({...u,follow:null,itemId:o,attachmentId:a?.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 a=Lo(s,n.settings.current?.zoteroDataDir);return Qie(a)},onShowDetails:async(s,a)=>{let l=o.getState(),u=l.attachmentID??void 0;if(s==="doc-item")await fs("note",{docItem:a,attachment:u},n);else{let c=l.doc?.docItem.itemID;if(!c)throw new Error("Missing doc item when showing annotation details");await fs("annotation",{docItem:c,attachment:u,annot:a},n)}},onDragStart:Nq(n),onMoreOptions:Fq(r),annotRenderer:Dq(n),onSetFollow(s){let a=new mg.Menu,l=o.getState().follow;if(l!=="zt-reader"&&a.addItem(u=>u.setIcon("book").setTitle("Follow active literature in Zotero reader").onClick(r.onSetFollowZt)),l!=="ob-note"&&a.addItem(u=>u.setIcon("file-edit").setTitle("Follow active literature note").onClick(r.onSetFollowOb)),a.addItem(u=>u.setIcon("file-lock-2").setTitle("Link with selected literature").onClick(async()=>{s.target.blur(),await r.onSetFollowNull()})),s.nativeEvent instanceof MouseEvent)a.showAtMouseEvent(s.nativeEvent);else{let c=s.target.getBoundingClientRect();a.showAtPosition({x:c.x,y:c.y})}}}}async onOpen(){await super.onOpen();let[r,n]=Ns(this.plugin);n&&this.register(n),this.contentEl.empty(),this.contentEl.createDiv({cls:"pane-empty p-2",text:"Loading..."}),r.then(()=>{this.contentEl.empty(),N.render(m(Ho.Provider,{value:hj,children:m(Ve.Provider,{value:this.getContext(),children:m(mu,{})})}),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(([,l])=>l).pop();if(!s)return;let[a]=s;this.highlightAnnot(a)}))}async onClose(){N.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 Qie(t){return(mg.Platform.resourcePathPrefix??"app://local/")+(0,$q.pathToFileURL)(t).pathname.substring(1)+`?${Date.now()}`}var Lq=require("path/posix");var gg=require("obsidian");var ese=[{command:"\u2191\u2193",purpose:"to navigate"},{command:"\u21B5",purpose:"to continue select note to import"},{command:"esc",purpose:"to dismiss"}],cE=class extends Qn{constructor(r){super(r);this.plugin=r;this.setInstructions(ese)}};async function jq(t){let e=await Wi(new cE(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 gg.Notice("No note found for selected literature"),!1;let o=await wS(n,c=>c.title??c.note?.substring(0,20)??`No title (Key ${c.key})`);if(!o.item)return!1;let i=o.item;if(!i.note)return new gg.Notice("Selected note is empty"),!1;let s=await t.noteParser.turndown(i.note),a=t.settings.current?.literatureNoteFolder,l=(0,Lq.join)(a,"zt-import",Yi(i.title??[i.note.substring(0,10),i.key].join("_"),{replacement:"_"})),u=await t.app.fileManager.createNewMarkdownFile(t.app.vault.getRoot(),l,s);return await t.app.workspace.openLinkText(u.path,"",!0),new gg.Notice(`Note imported: ${i.title??i.key}`),!0}var wn=require("obsidian");var yg=class extends fe{plugin=this.use(xe);onload(){this.registerEvent(this.plugin.server.on("zotero/open",e=>this.onZtOpen(jf(e)))),this.registerEvent(this.plugin.server.on("zotero/export",e=>this.onZtExport(jf(e)))),this.registerEvent(this.plugin.server.on("zotero/update",e=>this.onZtExport(jf(e))))}async onZtOpen(e){if(e.type==="annotation"){new wn.Notice("Not implemented yet");return}if(e.items.length<1){new wn.Notice("No items to open");return}await this.plugin.noteFeatures.openNote(e.items[0])}async onZtUpdate(e){if(e.type==="annotation"){new wn.Notice("Single annotation update not yet supported");return}if(e.items.length<1){new wn.Notice("No items to open");return}if(e.items.length>1){new wn.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 wn.Notice("Not implemented yet");return}e.items.length<1?new wn.Notice("No items to open"):e.items.length>1&&new wn.Notice("Multiple items not yet supported");let{libraryID:r,id:n}=e.items[0],[o]=await this.plugin.databaseAPI.getItems([[n,r]]);if(!o){new wn.Notice("Item not found: "+n);return}let i=await this.plugin.noteFeatures.createNoteForDocItemFull(o);await this.plugin.app.workspace.openLinkText(i,"",!1,{active:!0})}};var qq=require("obsidian");var tse=[{command:"\u2191\u2193",purpose:"to navigate"},{command:"\u21B5",purpose:"to open/create literature note"},{command:"esc",purpose:"to dismiss"}],uE=class extends Qn{constructor(r){super(r);this.plugin=r;this.setInstructions(tse)}};async function fE(t){let e=await Wi(new uE(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,"",qq.Keymap.isModEvent(n),{active:!0}),!0}var pE=class extends fe{plugin=this.use(xe);protocol=this.use(yg);onload(){let{plugin:e}=this,{app:r}=e;e.addCommand({id:"note-quick-switcher",name:"Open quick switcher for literature notes",callback:()=>fE(e)}),e.registerView(hg,o=>new dg(o,e)),e.registerView(ja,o=>new fg(o,e)),e.registerView(La,o=>new ug(o,e)),e.registerEvent(e.app.workspace.on("file-menu",(o,i)=>{let s=wt(i.path,e.settings.templateDir);s?.type==="ejectable"&&o.addItem(a=>a.setIcon("edit").setTitle("Open template preview").onClick(()=>{fs(s.name,null,e)}))})),e.addCommand({id:"zotero-annot-view",name:"Open Zotero annotation view in side panel",callback:()=>{r.workspace.ensureSideLeaf(hg,"right",{active:!0,state:{file:r.workspace.getActiveFile()?.path}})}}),e.addCommand({id:"insert-markdown-citation",name:"Insert Markdown citation",editorCallback:(o,i)=>Fx(o,i.file,e)}),e.registerEditorSuggest(new wu(e));let n=async(o,i)=>{let s=e.settings.libId,a=Qi(o,r.metadataCache);if(!a)return new no.Notice("Cannot get zotero item key from file name"),!1;let[l]=await e.databaseAPI.getItems([[a,s]]);if(!l)return new no.Notice("Cannot find zotero item with key "+a),!1;await this.updateNote(l,i)};e.addCommand({id:"update-literature-note",name:"Update literature note",editorCheckCallback(o,i,s){let a=s.file&&cu(s.file,r);if(o)return!!a;a&&n(s.file)}}),e.addCommand({id:"overwrite-update-literature-note",name:"Force update literature note by overwriting",editorCheckCallback(o,i,s){let a=s.file&&cu(s.file,r);if(o)return!!a;a&&n(s.file,!0)}}),e.addCommand({id:"import-note",name:"Import note",callback:()=>jq(e)}),e.registerEvent(e.app.workspace.on("file-menu",(o,i)=>{cu(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=wt(i.path,e.settings.templateDir);s?.type==="ejectable"&&o.addItem(a=>a.setTitle("Reset to default").setIcon("reset").onClick(async()=>{activeWindow.confirm("Reset template to default?")&&await e.app.vault.modify(i,dt.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 no.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 bg(o,e.key);let{vault:i,fileManager:s}=this.plugin.app,{literatureNoteFolder:a}=this.plugin.settings.current,l=this.plugin.templateRenderer,u=(0,Bq.join)(a,r.filename(l,{plugin:this.plugin})),c=i.getAbstractFileByPath(u);if(c&&Qi(c,this.plugin.app.metadataCache))throw new bg([u],e.key);return await s.createNewMarkdownFile(i.getRoot(),u,r.note(l,{plugin:this.plugin,sourcePath:u}))}async createNoteForDocItemFull(e){let r=this.plugin.settings.libId,n=await this.plugin.databaseAPI.getAttachments(e.itemID,r),o=await Kn(n,this.plugin.app);o&&ga(o,e);let i=await this.plugin.databaseAPI.getNotes(e.itemID,r).then(u=>this.plugin.noteParser.normalizeNotes(u)),s=await vu(e,{all:n,selected:o?[o]:[],notes:i},this.plugin),a=Object.values(s)[0];return(await this.createNoteForDocItem(e,{note:(u,c)=>u.renderNote(a,c),filename:(u,c)=>u.renderFilename(a,c)})).path}async updateNoteFromId(e){let{noteIndex:r,databaseAPI:n}=this.plugin;if(!r.getNotesFor(e).length){new no.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 no.Notice(`Cannot find zotero item with key ${e.key}`);return}await this.updateNote(i)}async updateNote(e,r){let n=await bj(e,this.plugin,r);n?n.addedAnnots>0||n.updatedAnnots>0?new no.Notice(`Affected ${n.notes} notes, annotations: ${n.addedAnnots} added, ${n.updatedAnnots} updated`):new no.Notice(`Affected ${n.notes} notes, no annotation updated`):new no.Notice("No note found for this literature")}},zq=pE,bg=class extends Error{constructor(r,n){super(`Note linked to ${n} already exists: ${r.join(",")}`);this.targets=r;this.key=n;this.name="NoteExistsError"}};var wg=require("@codemirror/language");var dE=require("obsidian");var vg=class extends fe{plugin=this.use(xe);onload(){this.patchEditorClick()}async patchEditorClick(){let{workspace:e}=this.plugin.app,{noteIndex:r,database:n,settings:o,noteFeatures:i}=this.plugin;await JT(this.plugin.app);let s=()=>e.getLeavesOfType("markdown").length>0,[a,l]=_l({register:c=>e.on("layout-change",()=>{s()&&c()}),unregister:c=>e.offref(c),escape:s,timeout:null});l&&this.register(l),await a;let u=e.getLeavesOfType("markdown")[0].view;this.register(or(u.editor.constructor.prototype,{getClickableTokenAt:c=>function(f,...p){let d=c.call(this,f,...p);return d||rse.call(this,f,r)}})),this.register(or(u.editMode.constructor.prototype,{triggerClickableToken:c=>function(f,p){if(f.type==="internal-link"&&f.citekey==="zotero")(async()=>{let d=f.text,{[d]:h}=await n.api.getItemIDsFromCitekey([f.text]);if(h<0){new dE.Notice(`Citekey ${d} not found in Zotero`);return}let[b]=await n.api.getItems([[h,o.libId]]);if(!b){new dE.Notice(`Item not found for citekey ${d}`);return}let y=await i.createNoteForDocItemFull(b);await e.openLinkText(y,"",!0,{active:!0})})();else return c.call(this,f,p)}}))}};function rse(t,e){let r=this.cm,n=r.state.doc,o=[],i=n.line(t.line+1),s=(0,wg.syntaxTree)(r.state),a=i.from;s.iterate({from:i.from,to:i.to,enter:b=>{let y=b.type,v=b.from,x=b.to,T=y.prop(wg.tokenClassNodeProp);T&&(a<v&&o.push({type:"",from:a,to:v}),o.push({type:T,from:v,to:x}),a=x)}}),a<i.to&&o.push({type:"",from:a,to:i.to});let l=this.posToOffset(t),u=-1;for(let b=0;b<o.length;b++){let y=o[b];if(y.from<=l&&y.to>=l){u=b;break}}if(u<0)return null;let c=o[u];if(!c.type.split(" ").includes("hmd-barelink"))return null;let p=n.sliceString(c.from,c.to);if(!p.startsWith("@"))return null;let d=p.slice(1),h={start:this.offsetToPos(c.from),end:this.offsetToPos(c.to)};if(e.citekeyCache.has(d)){let[b]=e.citekeyCache.get(d);return{type:"internal-link",text:b,...h}}else return{type:"internal-link",text:d,citekey:"zotero",...h}}var xg=require("obsidian");var Ba=class extends fe{plugin=this.use(xe);settings=this.use(ge);app=this.use(xg.App);get meta(){return this.app.metadataCache}get vault(){return this.app.vault}get literatureNoteFolder(){return this.settings.current?.literatureNoteFolder}get joinPath(){return nse(this.literatureNoteFolder)}noteCache=new Map;blockCache={byFile:new Map,byKey:new Map};citekeyCache=new Map;#e(e,r){let n=rx(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 a=s.delete(e);o||=a,a&&s.size===0&&this.noteCache.delete(i)}return o}#t(e,r){let n=l=>{let u=this.blockCache.byFile.get(l);if(!u)return!1;this.blockCache.byFile.delete(l);for(let c of u){let f=this.blockCache.byKey.get(c.key);f.delete(c),f.size===0&&this.blockCache.byKey.delete(c.key)}return!0};if(!r)return n(e);let{blocks:o,sections:i}=r;if(!i||!o)return n(e);let s=i.filter(au);if(s.length===0)return n(e);n(e);let a=pu(s.flatMap(l=>lu(l.id).map(u=>[u,l.position])),zi(([l])=>l),ha((l,u)=>({file:e,key:l,blocks:u.map(([c,f])=>f)})),Gd);this.blockCache.byFile.set(e,a);for(let l of a){let u=this.blockCache.byKey.get(l.key);u?u.add(l):this.blockCache.byKey.set(l.key,new Set([l]))}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 a=s.delete(e);o||=a,a&&s.size===0&&this.citekeyCache.delete(i)}return o}getNotesFor(e){let r=this.noteCache.get(ir(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(ir(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]=ZT(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 xg.Notice("Literature notes re-indexed")}})})}),this.register(He(lt(()=>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){bt(e)&&this.#i(e.path)}onFileRenamed(e,r){this.#i(r),bt(e)&&this.#o(e.path)}reload(){this.#r(),this.onMetaBuilt(),W.info("Note Index: Reloaded")}};de([me],Ba.prototype,"literatureNoteFolder",1);var nse=t=>t==="/"?"":t+"/";var mE=require("crypto");var Uq="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var ose=128,ps,za,ise=t=>{!ps||ps.length<t?(ps=Buffer.allocUnsafe(t*ose),(0,mE.randomFillSync)(ps),za=0):za+t>ps.length&&((0,mE.randomFillSync)(ps),za=0),za+=t};var Eg=(t=21)=>{ise(t-=0);let e="";for(let r=za-t;r<za;r++)e+=Uq[ps[r]&63];return e};var Zq=require("obsidian");var hE=/^https?:\/\/zotero\.org\/.*\/items\/([A-Z\d]+)$/;function Ua(t){let e=t.match(hE);return e?e[1]:null}var{DataCitation:Wq,DataAnnotation:Hq}=Ft({CitationItem:{uris:[hE]},DataCitation:{citationItems:"CitationItem[]","properties?":"any","locator?":"string"},DataAnnotation:{attachmentURI:hE,annotationKey:"string",citationItem:"CitationItem"}}).compile();var Kq=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}=gE(r.style.color),s=r.firstChild,a={bgColor:null,bgColorName:null};if(s===r.lastChild&&s?.nodeName==="SPAN"&&s.style.backgroundColor){let{color:l,colorName:u}=gE(s.style.backgroundColor);a={bgColor:l,bgColorName:u}}return t.renderColored({content:e,color:o,colorName:i,...a})}}),Vq=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}=gE(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 gE(t){if(!t)return{colorName:null,color:null};let e=nr(t).toHex().toUpperCase();return{colorName:Vm[e.substring(0,7)]??e,color:e}}var zu={cite:{pattern:/%%ZTNOTE\.CITE:([\w-]{10})%%/g,create:t=>`%%ZTNOTE.CITE:${t}%%`},annot:{pattern:/%%ZTNOTE\.ANNOT:([\w-]{10})%%/g,create:t=>`%%ZTNOTE.ANNOT:${t}%%`}},yE=class{constructor(e){Object.assign(this,e)}toString(){return this.content}},Sg=class extends fe{plugin=this.use(xe);citations=new Map;annotations=new Map;tdService=new globalThis.TurndownService({headingStyle:"atx"}).addRule("color",Kq(this.plugin.templateRenderer)).addRule("bg-color",Vq(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=Gq(o.dataset.annotation),a=r,l=Eg(10);return this.annotations.set(l,{annotationKey:s.annotationKey,citationKey:Ua(s.citationItem.uris[0]),attachementKey:Ua(s.attachmentURI),commentHTML:a.textContent?.trim()?a.innerHTML:null,inline:!1}),zu.annot.create(l)}}).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=sse(r.dataset.citation),i=Eg(10);return this.citations.set(i,{text:e,itemKeys:o.citationItems.map(({uris:[s]})=>Ua(s))}),zu.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=Gq(r.dataset.annotation),i=Eg(10);return this.annotations.set(i,{annotationKey:o.annotationKey,citationKey:Ua(o.citationItem.uris[0]),attachementKey:Ua(o.attachmentURI),commentHTML:null,inline:!0}),zu.annot.create(i)}});onload(){}async normalizeNotes(e){let r=[];for(let{note:n,...o}of e)r.push(new yE({...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(c=>c.itemKeys),annotations:[...this.annotations.values()].map(c=>c.citationKey)},o=new Set([...this.annotations.values()].map(c=>c.attachementKey)),i=this.plugin.settings.libId,s=ase([...n.citations,...n.annotations]),a=await this.plugin.databaseAPI.getItems(s.map(c=>[c,i])).then(async c=>{let f=new Map;for(let p=0;p<s.length;p++){let d=s[p],h=c[p];if(h===null){f.set(d,null);continue}let b=await this.plugin.databaseAPI.getAttachments(h.itemID,i),y=new Map;for(let v of b){if(!o.has(v.key))continue;let x=await this.plugin.databaseAPI.getAnnotations(v.itemID,i);for(let T of x)y.set(T.key,T)}f.set(d,{item:h,attachments:b,annotations:y})}return f}),l=await this.plugin.databaseAPI.getTags([...a.values()].flatMap(c=>c?[c.item.itemID,...[...c.annotations.values()].map(f=>f.itemID)]:[]).map(c=>[c,i])),u=r.replaceAll(zu.cite.pattern,(c,f)=>{let p=this.citations.get(f),d=p.itemKeys.map(b=>{let y=a.get(b);if(!y)throw W.error("citation not found, key: ",b,p),new Error(`citation not found: key ${b}`);return{allAttachments:y.attachments,annotations:[],docItem:y.item,attachment:null,tags:l,notes:[]}});return this.plugin.templateRenderer.renderCitations(d,{plugin:this.plugin})}).replaceAll(zu.annot.pattern,(c,f)=>{let p=this.annotations.get(f),d=a.get(p.citationKey);if(!d)throw W.error("citation not found, key:",f,p),new Error(`citation key not found: ${f}`);let h=d.annotations.get(p.annotationKey);if(!h)throw W.error("annotation not found, key: ",p.annotationKey,p),new Error(`annotation key not found: ${p.annotationKey}`);let b=this.plugin.templateRenderer.renderAnnot({...h,ztnote:{comment:p.commentHTML,get commentMd(){return p.commentHTML?(0,Zq.htmlToMarkdown)(p.commentHTML):""},inline:p.inline}},{allAttachments:d.attachments,annotations:[...d.annotations.values()],attachment:d.attachments.find(y=>y.itemID===h.parentItemID),docItem:d.item,notes:[],tags:l},{plugin:this.plugin});return p.inline?b:`
|
|
`+b+`
|
|
`}).replace(/\n{3,}/g,`
|
|
|
|
`);return this.citations.clear(),this.annotations.clear(),u}};function sse(t){let e=JSON.parse(decodeURIComponent(t)),{data:r,problems:n}=Wq(e);if(n)throw W.error("Unexpected citation data",e,n),new Error("Unexpected citation data: "+n.summary);return r}function Gq(t){let e=JSON.parse(decodeURIComponent(t)),{data:r,problems:n}=Hq(e);if(n)throw W.error("Unexpected annotation data",e,n),new Error("Unexpected annotation data: "+n.summary);return r}function ase(t){return[...new Set(t)]}var Og=require("fs/promises");var lse=(t,e)=>e.some(r=>t instanceof r),Jq,Yq;function cse(){return Jq||(Jq=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function use(){return Yq||(Yq=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Xq=new WeakMap,vE=new WeakMap,Qq=new WeakMap,bE=new WeakMap,xE=new WeakMap;function fse(t){let e=new Promise((r,n)=>{let o=()=>{t.removeEventListener("success",i),t.removeEventListener("error",s)},i=()=>{r(xn(t.result)),o()},s=()=>{n(t.error),o()};t.addEventListener("success",i),t.addEventListener("error",s)});return e.then(r=>{r instanceof IDBCursor&&Xq.set(r,t)}).catch(()=>{}),xE.set(e,t),e}function pse(t){if(vE.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)});vE.set(t,e)}var wE={get(t,e,r){if(t instanceof IDBTransaction){if(e==="done")return vE.get(t);if(e==="objectStoreNames")return t.objectStoreNames||Qq.get(t);if(e==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return xn(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 eB(t){wE=t(wE)}function dse(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...r){let n=t.call(Ig(this),e,...r);return Qq.set(n,e.sort?e.sort():[e]),xn(n)}:use().includes(t)?function(...e){return t.apply(Ig(this),e),xn(Xq.get(this))}:function(...e){return xn(t.apply(Ig(this),e))}}function mse(t){return typeof t=="function"?dse(t):(t instanceof IDBTransaction&&pse(t),lse(t,cse())?new Proxy(t,wE):t)}function xn(t){if(t instanceof IDBRequest)return fse(t);if(bE.has(t))return bE.get(t);let e=mse(t);return e!==t&&(bE.set(t,e),xE.set(e,t)),e}var Ig=t=>xE.get(t);function rB(t,e,{blocked:r,upgrade:n,blocking:o,terminated:i}={}){let s=indexedDB.open(t,e),a=xn(s);return n&&s.addEventListener("upgradeneeded",l=>{n(xn(s.result),l.oldVersion,l.newVersion,xn(s.transaction),l)}),r&&s.addEventListener("blocked",l=>r(l.oldVersion,l.newVersion,l)),a.then(l=>{i&&l.addEventListener("close",()=>i()),o&&l.addEventListener("versionchange",u=>o(u.oldVersion,u.newVersion,u))}).catch(()=>{}),a}var hse=["get","getKey","getAll","getAllKeys","count"],gse=["put","add","delete","clear"],EE=new Map;function tB(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(EE.get(e))return EE.get(e);let r=e.replace(/FromIndex$/,""),n=e!==r,o=gse.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(o||hse.includes(r)))return;let i=async function(s,...a){let l=this.transaction(s,o?"readwrite":"readonly"),u=l.store;return n&&(u=u.index(a.shift())),(await Promise.all([u[r](...a),o&&l.done]))[0]};return EE.set(e,i),i}eB(t=>({...t,get:(e,r,n)=>tB(e,r)||t.get(e,r,n),has:(e,r)=>!!tB(e,r)||t.has(e,r)}));var Tg=require("obsidian");var yse="zotlit",_g="pdf-outline",Uu=class extends fe{constructor(r){super();this.plugin=r}db=rB(yse,1,{upgrade(r){r.createObjectStore(_g,{keyPath:"path"})}});async getCachedOutlineKeys(){return await(await this.db).getAllKeys(_g)}async getPDFOutline(r,n=!1){let o=await this.db,i=await o.get(_g,r),s;try{s=await(0,Og.stat)(r)}catch(l){if(l.code==="ENOENT")return new Tg.Notice("PDF file not found"),null;throw l}if(i&&s.mtimeMs===i.mtime&&!n)return W.debug("PDF outline cache hit",r),i.outline;let a=await this.#e(r);return a?(await o.put(_g,{path:r,mtime:s.mtimeMs,outline:a,created:Date.now()}),W.debug("PDF outline cache miss and updated",r),a):null}pdfjs;async#e(r){this.pdfjs??=await(0,Tg.loadPdfJs)();let n=this.pdfjs.getDocument(await(0,Og.readFile)(r)),o=await n.promise,i=nB(await o.getOutline(),0),s=await Promise.all(i.map(async({dest:a,...l})=>{if(!Array.isArray(a))return{...l,page:null};let[u]=a,c=await o.getPageIndex(u);return{...l,page:c}}));return await o.cleanup(),await n.destroy(),s}},nB=(t,e)=>t.flatMap(({title:r,dest:n,items:o})=>[{title:r,dest:n,level:e},...nB(o,e+1)]);var SE=require("fs");var oB=require("obsidian");var oo=class extends fe{settings=this.use(ge);api=this.use(Vt).api;app=this.use(oB.App);get autoRefresh(){return this.settings.current?.autoRefresh}onDatabaseUpdate(e){return()=>this.app.vault.trigger("zotero:db-updated",e)}onload(){this.register(He(lt(()=>this.setAutoRefresh(this.autoRefresh),()=>this.autoRefresh))),W.debug("loading DatabaseWatcher")}onunload(){this.#e()}#e(){this.#n=!1,this.#t=ma(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,SE.watch)(this.settings.zoteroDbPath,this.onDatabaseUpdate("main"));let n=await this.api.getLoadStatus();n.bbt&&(this.#t.bbt=(0,SE.watch)(n.bbtVersion==="v0"?this.settings.bbtSearchDbPath:this.settings.bbtMainDbPath,this.onDatabaseUpdate("bbt")))}}};de([me],oo.prototype,"autoRefresh",1);var Wu=class extends fe{onunload(){W.info("ZoteroDB unloaded")}get defaultLibId(){return this.settings.libId}settings=this.use(ge);#e=this.use(Vt);watcher=this.use(oo);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:bse});if(o.length===0)return[];let i=vse(o);return i.length===0?[]:(await this.api.getItems(i.map(a=>[a.id,n]))).map((a,l)=>{let{id:u,fields:c,score:f}=i[l];if(!a)throw new Error("Item not found: "+u);return{item:a,score:f,fields:[...c]}})}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:[]}))}},bse=["title","creators[]:firstName","creators[]:lastName","date"];function vse(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,a)=>{let l=e-a;switch(o){case"title":l*=100;break;case"creators":case"date":l*=5;break;default:throw new Error("Unknown field: "+o)}if(!n.has(+s))n.set(+s,{id:+s,score:l,fields:new Set([o])});else{let u=n.get(+s);u.fields.add(o),u.score+=l}}),n),new Map);return Array.from(r.values()).sort((n,o)=>o.score-n.score)}var Kr=require("fs/promises"),iB=require("path"),sB=require("path/posix");var Tr=require("obsidian");var Yo=class extends fe{onload(){W.debug("loading ImgCacheImporter")}async onunload(){await this.flush()}get app(){return this.use(xe).app}settings=this.use(ge);queue=new Map;getCachePath(e){return Lo(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!==Ae.image)return null;let r=this.getCachePath(e);return xse(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,Kr.stat)(r).then(s=>{if(!s.isFile()&&!s.isSymbolicLink()){let a=`failed to link image excerpt cache to vault: given path not file ${r}`;return new Tr.Notice(a),mt(a,null),-1}return s.mtimeMs}).catch(s=>{if(s.code==="ENOENT"){let a=`failed to link image excerpt cache to vault: file not found ${r}`;return new Tr.Notice(a),mt(a,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,sB.dirname)(e);if(i!=="."&&i!==".."&&await this.app.vault.createFolder(i).catch(()=>{}),this.app.vault.adapter instanceof Tr.FileSystemAdapter){let s=this.app.vault.adapter.getFullPath(e),a=await(0,Kr.lstat)(s).catch(l=>{if(l.code!=="ENOENT")throw l;return null});if(o==="copy"){let l=-1;if(a)if(a.isSymbolicLink())W.trace(s+" is symlink, unlinking"),await(0,Kr.rm)(s);else if(a.isFile())l=a.mtimeMs;else{let u="Failed to import image excerpt cache: cannot overwrite non-file "+s;return new Tr.Notice(u),mt(u,null),!1}if(l<0||n>l)return W.trace(s+" is file, "+(l<0?"creating":"overwritting")),await(0,Kr.copyFile)(r,s),new Tr.Notice(`Copied image excerpt cache to vault: ${e}`),!0;W.trace("mtime check pass, skipping")}else{if(a){if(a.isSymbolicLink())return W.trace(s+" is symlink, skipping"),!1;if(a.isFile())W.trace(s+" is file, remove before symlinking"),await(0,Kr.rm)(s);else{let l="Failed to import image excerpt cache: cannot overwrite non-file "+s;return new Tr.Notice(l),mt(l,null),!1}}try{await(0,Kr.symlink)(r,s,"file")}catch(l){if(l.code==="EPERM")return new Tr.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.`),mt(`Failed to symlink image excerpt cache to vault: permission denied ${r}`,l),!1;throw l}return new Tr.Notice(`linked image excerpt cache to vault: ${e}`),!0}return!1}else throw new Error("Mobile not supported")}};de([me],Yo.prototype,"mode",1),de([me],Yo.prototype,"path",1),de([me],Yo.prototype,"imgExcerptDir",1);var wse=(t,e)=>(e??"")+(0,iB.basename)(t),xse=(t,e,r)=>{let n=wse(e,t.groupID);return[(0,Tr.normalizePath)(r),n].join("/")};S();S();S();function Wa(t,e=[]){let r=[];function n(i,s){let a=We(s),l=r.length;r=[...r,s];function u(f){let{scope:p,children:d,...h}=f,b=p?.[t][l]||a,y=ie(()=>h,Object.values(h));return H(b.Provider,{value:y},d)}function c(f,p){let d=p?.[t][l]||a,h=te(d);if(h)return h;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,c]}let o=()=>{let i=r.map(s=>We(s));return function(a){let l=a?.[t]||i;return ie(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return o.scopeName=t,[n,Ese(o,...e)]}function Ese(...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((a,{useScope:l,scopeName:u})=>{let f=l(i)[`__scope${u}`];return{...a,...f}},{});return ie(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return r.scopeName=e.scopeName,r}S();S();S();function Sse(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function IE(...t){return e=>t.forEach(r=>Sse(r,e))}function ds(...t){return X(IE(...t),t)}S();var Ha=Y((t,e)=>{let{children:r,...n}=t,o=Qe.toArray(r),i=o.find(_se);if(i){let s=i.props.children,a=o.map(l=>l===i?Qe.count(s)>1?Qe.only(null):Zt(s)?s.props.children:null:l);return H(_E,pe({},n,{ref:e}),Zt(s)?gr(s,void 0,a):null)}return H(_E,pe({},n,{ref:e}),r)});Ha.displayName="Slot";var _E=Y((t,e)=>{let{children:r,...n}=t;return Zt(r)?gr(r,{...Ose(n,r.props),ref:IE(e,r.ref)}):Qe.count(r)>1?Qe.only(null):null});_E.displayName="SlotClone";var Ise=({children:t})=>H(M,null,t);function _se(t){return Zt(t)&&t.type===Ise}function Ose(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]=(...a)=>{i(...a),o(...a)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function aB(t){let e=t+"CollectionProvider",[r,n]=Wa(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),s=d=>{let{scope:h,children:b}=d,y=N.useRef(null),v=N.useRef(new Map).current;return N.createElement(o,{scope:h,itemMap:v,collectionRef:y},b)},a=t+"CollectionSlot",l=N.forwardRef((d,h)=>{let{scope:b,children:y}=d,v=i(a,b),x=ds(h,v.collectionRef);return N.createElement(Ha,{ref:x},y)}),u=t+"CollectionItemSlot",c="data-radix-collection-item",f=N.forwardRef((d,h)=>{let{scope:b,children:y,...v}=d,x=N.useRef(null),T=ds(h,x),$=i(u,b);return N.useEffect(()=>($.itemMap.set(x,{ref:x,...v}),()=>void $.itemMap.delete(x))),N.createElement(Ha,{[c]:"",ref:T},y)});function p(d){let h=i(t+"CollectionConsumer",d);return N.useCallback(()=>{let y=h.collectionRef.current;if(!y)return[];let v=Array.from(y.querySelectorAll(`[${c}]`));return Array.from(h.itemMap.values()).sort(($,V)=>v.indexOf($.ref.current)-v.indexOf(V.ref.current))},[h.collectionRef,h.itemMap])}return[{Provider:s,Slot:l,ItemSlot:f},p,n]}S();S();var Hu=globalThis?.document?Pt:()=>{};var Tse=Nr["useId".toString()]||(()=>{}),Cse=0;function Cg(t){let[e,r]=L(Tse());return Hu(()=>{t||r(n=>n??String(Cse++))},[t]),t||(e?`radix-${e}`:"")}S();S();var Ase=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Xo=Ase.reduce((t,e)=>{let r=Y((n,o)=>{let{asChild:i,...s}=n,a=i?Ha:e;return U(()=>{window[Symbol.for("radix-ui")]=!0},[]),H(a,pe({},s,{ref:o}))});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});S();function Ku(t){let e=P(t);return U(()=>{e.current=t}),ie(()=>(...r)=>{var n;return(n=e.current)===null||n===void 0?void 0:n.call(e,...r)},[])}S();function Ag({prop:t,defaultProp:e,onChange:r=()=>{}}){let[n,o]=kse({defaultProp:e,onChange:r}),i=t!==void 0,s=i?t:n,a=Ku(r),l=X(u=>{if(i){let f=typeof u=="function"?u(t):u;f!==t&&a(f)}else o(u)},[i,t,o,a]);return[s,l]}function kse({defaultProp:t,onChange:e}){let r=L(t),[n]=r,o=P(n),i=Ku(e);return U(()=>{o.current!==n&&(i(n),o.current=n)},[n,o,i]),r}S();var Rse=We(void 0);function kg(t){let e=te(Rse);return t||e||"ltr"}var OE="rovingFocusGroup.onEntryFocus",Nse={bubbles:!1,cancelable:!0},CE="RovingFocusGroup",[TE,lB,Dse]=aB(CE),[Fse,AE]=Wa(CE,[Dse]),[Pse,Mse]=Fse(CE),$se=Y((t,e)=>H(TE.Provider,{scope:t.__scopeRovingFocusGroup},H(TE.Slot,{scope:t.__scopeRovingFocusGroup},H(Lse,pe({},t,{ref:e}))))),Lse=Y((t,e)=>{let{__scopeRovingFocusGroup:r,orientation:n,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:u,...c}=t,f=P(null),p=ds(e,f),d=kg(i),[h=null,b]=Ag({prop:s,defaultProp:a,onChange:l}),[y,v]=L(!1),x=Ku(u),T=lB(r),$=P(!1),[V,J]=L(0);return U(()=>{let G=f.current;if(G)return G.addEventListener(OE,x),()=>G.removeEventListener(OE,x)},[x]),H(Pse,{scope:r,orientation:n,dir:d,loop:o,currentTabStopId:h,onItemFocus:X(G=>b(G),[b]),onItemShiftTab:X(()=>v(!0),[]),onFocusableItemAdd:X(()=>J(G=>G+1),[]),onFocusableItemRemove:X(()=>J(G=>G-1),[])},H(Xo.div,pe({tabIndex:y||V===0?-1:0,"data-orientation":n},c,{ref:p,style:{outline:"none",...t.style},onMouseDown:Bt(t.onMouseDown,()=>{$.current=!0}),onFocus:Bt(t.onFocus,G=>{let K=!$.current;if(G.target===G.currentTarget&&K&&!y){let F=new CustomEvent(OE,Nse);if(G.currentTarget.dispatchEvent(F),!F.defaultPrevented){let Q=T().filter(D=>D.focusable),O=Q.find(D=>D.active),_=Q.find(D=>D.id===h),B=[O,_,...Q].filter(Boolean).map(D=>D.ref.current);cB(B)}}$.current=!1}),onBlur:Bt(t.onBlur,()=>v(!1))})))}),jse="RovingFocusGroupItem",qse=Y((t,e)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:o=!1,tabStopId:i,...s}=t,a=Cg(),l=i||a,u=Mse(jse,r),c=u.currentTabStopId===l,f=lB(r),{onFocusableItemAdd:p,onFocusableItemRemove:d}=u;return U(()=>{if(n)return p(),()=>d()},[n,p,d]),H(TE.ItemSlot,{scope:r,id:l,focusable:n,active:o},H(Xo.span,pe({tabIndex:c?0:-1,"data-orientation":u.orientation},s,{ref:e,onMouseDown:Bt(t.onMouseDown,h=>{n?u.onItemFocus(l):h.preventDefault()}),onFocus:Bt(t.onFocus,()=>u.onItemFocus(l)),onKeyDown:Bt(t.onKeyDown,h=>{if(h.key==="Tab"&&h.shiftKey){u.onItemShiftTab();return}if(h.target!==h.currentTarget)return;let b=Use(h,u.orientation,u.dir);if(b!==void 0){h.preventDefault();let v=f().filter(x=>x.focusable).map(x=>x.ref.current);if(b==="last")v.reverse();else if(b==="prev"||b==="next"){b==="prev"&&v.reverse();let x=v.indexOf(h.currentTarget);v=u.loop?Wse(v,x+1):v.slice(x+1)}setTimeout(()=>cB(v))}})})))}),Bse={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function zse(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Use(t,e,r){let n=zse(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return Bse[n]}function cB(t){let e=document.activeElement;for(let r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function Wse(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var uB=$se,fB=qse;S();S();function Hse(t,e){return an((r,n)=>{let o=e[r][n];return o??r},t)}var kE=t=>{let{present:e,children:r}=t,n=Kse(e),o=typeof r=="function"?r({present:n.isPresent}):Qe.only(r),i=ds(n.ref,o.ref);return typeof r=="function"||n.isPresent?gr(o,{ref:i}):null};kE.displayName="Presence";function Kse(t){let[e,r]=L(),n=P({}),o=P(t),i=P("none"),s=t?"mounted":"unmounted",[a,l]=Hse(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return U(()=>{let u=Rg(n.current);i.current=a==="mounted"?u:"none"},[a]),Hu(()=>{let u=n.current,c=o.current;if(c!==t){let p=i.current,d=Rg(u);t?l("MOUNT"):d==="none"||u?.display==="none"?l("UNMOUNT"):l(c&&p!==d?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,l]),Hu(()=>{if(e){let u=f=>{let d=Rg(n.current).includes(f.animationName);f.target===e&&d&&ln(()=>l("ANIMATION_END"))},c=f=>{f.target===e&&(i.current=Rg(n.current))};return e.addEventListener("animationstart",c),e.addEventListener("animationcancel",u),e.addEventListener("animationend",u),()=>{e.removeEventListener("animationstart",c),e.removeEventListener("animationcancel",u),e.removeEventListener("animationend",u)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:X(u=>{u&&(n.current=getComputedStyle(u)),r(u)},[])}}function Rg(t){return t?.animationName||"none"}var pB="Tabs",[Vse,hBe]=Wa(pB,[AE]),dB=AE(),[Gse,RE]=Vse(pB),Zse=Y((t,e)=>{let{__scopeTabs:r,value:n,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:l="automatic",...u}=t,c=kg(a),[f,p]=Ag({prop:n,onChange:o,defaultProp:i});return H(Gse,{scope:r,baseId:Cg(),value:f,onValueChange:p,orientation:s,dir:c,activationMode:l},H(Xo.div,pe({dir:c,"data-orientation":s},u,{ref:e})))}),Jse="TabsList",Yse=Y((t,e)=>{let{__scopeTabs:r,loop:n=!0,...o}=t,i=RE(Jse,r),s=dB(r);return H(uB,pe({asChild:!0},s,{orientation:i.orientation,dir:i.dir,loop:n}),H(Xo.div,pe({role:"tablist","aria-orientation":i.orientation},o,{ref:e})))}),Xse="TabsTrigger",Qse=Y((t,e)=>{let{__scopeTabs:r,value:n,disabled:o=!1,...i}=t,s=RE(Xse,r),a=dB(r),l=mB(s.baseId,n),u=hB(s.baseId,n),c=n===s.value;return H(fB,pe({asChild:!0},a,{focusable:!o,active:c}),H(Xo.button,pe({type:"button",role:"tab","aria-selected":c,"aria-controls":u,"data-state":c?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l},i,{ref:e,onMouseDown:Bt(t.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?s.onValueChange(n):f.preventDefault()}),onKeyDown:Bt(t.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(n)}),onFocus:Bt(t.onFocus,()=>{let f=s.activationMode!=="manual";!c&&!o&&f&&s.onValueChange(n)})})))}),eae="TabsContent",tae=Y((t,e)=>{let{__scopeTabs:r,value:n,forceMount:o,children:i,...s}=t,a=RE(eae,r),l=mB(a.baseId,n),u=hB(a.baseId,n),c=n===a.value,f=P(c);return U(()=>{let p=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(p)},[]),H(kE,{present:o||c},({present:p})=>H(Xo.div,pe({"data-state":c?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!p,id:u,tabIndex:0},s,{ref:e,style:{...t.style,animationDuration:f.current?"0s":void 0}}),p&&i))});function mB(t,e){return`${t}-trigger-${e}`}function hB(t,e){return`${t}-content-${e}`}var gB=Zse,NE=Yse,DE=Qse,FE=tae;S();var yB=gB,PE=Y(({className:t,...e},r)=>m(NE,{ref:r,className:re("inline-flex items-center justify-center rounded-md bg-secondary p-1",t),...e}));PE.displayName=NE.displayName;var Qo=Y(({className:t,...e},r)=>m(DE,{className:re("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}));Qo.displayName=DE.displayName;var ei=Y(({className:t,...e},r)=>m(FE,{className:re("mt-2 rounded-md border p-6",t),...e,ref:r}));ei.displayName=FE.displayName;S();S();function Ka(){return Ka=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},Ka.apply(this,arguments)}var wBe=typeof Symbol<"u"?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator",xBe=typeof Symbol<"u"?Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")):"@@asyncIterator";var nae=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Pt:U,oae=function(e){var r=P(e);return nae(function(){r.current=e}),X(function(){return r.current},[r])},iae={status:"not-requested",loading:!1,result:void 0,error:void 0},vB={status:"loading",loading:!0,result:void 0,error:void 0},sae=function(e){return vB},aae=function(e,r){return{status:"success",loading:!1,result:e,error:void 0}},lae=function(e,r){return{status:"error",loading:!1,result:void 0,error:e}},bB=function(){},cae={initialState:function(e){return e&&e.executeOnMount?vB:iae},executeOnMount:!0,executeOnUpdate:!0,setLoading:sae,setResult:aae,setError:lae,onSuccess:bB,onError:bB},uae=function(e){return Ka({},cae,{},e)},fae=function(e){var r=L(function(){return e.initialState(e)}),n=r[0],o=r[1],i=X(function(){return o(e.initialState(e))},[o,e]),s=X(function(){return o(e.setLoading(n))},[n,o]),a=X(function(c){return o(e.setResult(c,n))},[n,o]),l=X(function(c){return o(e.setError(c,n))},[n,o]),u=X(function(c){return o(Ka({},n,{},c))},[n,o]);return{value:n,set:o,merge:u,reset:i,setLoading:s,setResult:a,setError:l}},pae=function(){var e=P(!1);return U(function(){return e.current=!0,function(){e.current=!1}},[]),function(){return e.current}},dae=function(){var e=P(null);return{set:function(n){return e.current=n},get:function(){return e.current},is:function(n){return e.current===n}}},wB=function(e,r,n){!r&&(r=[]);var o=uae(n),i=L(null),s=i[0],a=i[1],l=fae(o),u=pae(),c=dae(),f=function(v){return u()&&c.is(v)},p=function(){for(var v=arguments.length,x=new Array(v),T=0;T<v;T++)x[T]=arguments[T];var $=function(){try{return Promise.resolve(e.apply(void 0,x))}catch(V){return Promise.reject(V)}}();return a(x),c.set($),l.setLoading(),$.then(function(V){f($)&&l.setResult(V),o.onSuccess(V,{isCurrent:function(){return c.is($)}})},function(V){f($)&&l.setError(V),o.onError(V,{isCurrent:function(){return c.is($)}})}),$},d=oae(p),h=X(function(){return d().apply(void 0,arguments)},[d]),b=!u();return U(function(){var y=function(){return d().apply(void 0,r)};b&&o.executeOnMount&&y(),!b&&o.executeOnUpdate&&y()},r),Ka({},l.value,{set:l.set,merge:l.merge,reset:l.reset,execute:h,currentPromise:c.get(),currentParams:s})};function xB(t,e,r){return wB(t,e,r)}var EB=function(e,r){return wB(e,[],Ka({},r,{executeOnMount:!1,executeOnUpdate:!1}))};var SB=require("obsidian");var Ng=class{constructor(e){this.path=e??Ng.defaultPath}vaildPath;get path(){return this.vaildPath}set path(e){e?this.vaildPath=(0,SB.normalizePath)(e):this.vaildPath=Ng.defaultPath}getFile(e){return e.getAbstractFileByPath(this.vaildPath)}fromJSON(e){return e&&(this.vaildPath=e),this}toJSON(){return this.path}toString(){return this.path}},Vu=Ng;sS(Vu,"defaultPath","/");var Ut=We({});function Va(t){return new Vu(t).path}function Dg(t,e,r){let[n,o]=L(!1);return[xB(t,[...e,n],r),X(()=>o(i=>!i),[])]}var IB=require("obsidian");S();S();var we=Y(function({name:e,description:r,heading:n,children:o,className:i},s){return m("div",{className:re("setting-item",n&&"setting-item-heading border-none",i),children:[m("div",{className:"setting-item-info",children:[m("div",{className:"setting-item-name",children:e}),r&&m("div",{className:"setting-item-description",children:r})]}),m("div",{className:"setting-item-control",ref:s,children:o})]})});function mae(t){let e=P(t);return e.current=t,ie(()=>rf(()=>e.current()),[])}function qe(t,e){let r=te(Ut).settings,n=mae(()=>t(r.current)).value,o=Yt(function(s){r.update(a=>e(s,a))});return[n,o]}function ME(t,e){let r=Yt(e),n=P(null);return U(()=>{n.current?.setValue(t)},[t]),X(o=>{if(!o)n.current?.toggleEl.remove(),n.current=null;else{let i=new IB.ToggleComponent(o);i.setValue(t),i.onChange(r),n.current=i}},[])}function Vr({name:t,children:e,get:r,set:n}){let o=ME(...qe(r,n));return m($E,{ref:o,name:t,children:e})}var $E=Y(function({name:e,children:r},n){return m(we,{className:"mod-toggle",ref:n,name:e,description:r})});var TB=Z(require("node:net"),1),CB=Z(require("node:os"),1),Pg=class extends Error{constructor(e){super(`${e} is locked`)}},Ga={old:new Set,young:new Set},hae=1e3*15;var Fg,gae=()=>{let t=CB.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},_B=t=>new Promise((e,r)=>{let n=TB.default.createServer();n.unref(),n.on("error",r),n.listen(t,()=>{let{port:o}=n.address();n.close(()=>{e(o)})})}),OB=async(t,e)=>{if(t.host||t.port===0)return _B(t);for(let r of e)try{await _B({port:t.port,host:r})}catch(n){if(!["EADDRNOTAVAIL","EINVAL"].includes(n.code))throw n}return t.port},yae=function*(t){t&&(yield*t),yield 0};async function LE(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)}Fg===void 0&&(Fg=setInterval(()=>{Ga.old=Ga.young,Ga.young=new Set},hae),Fg.unref&&Fg.unref());let n=gae();for(let o of yae(e))try{if(r.has(o))continue;let i=await OB({...t,port:o},n);for(;Ga.old.has(i)||Ga.young.has(i);){if(o!==0)throw new Pg(o);i=await OB({...t,port:o},n)}return Ga.young.add(i),i}catch(i){if(!["EADDRINUSE","EACCES"].includes(i.code)&&!(i instanceof Pg))throw i}throw new Error("No available ports found")}var jE=require("obsidian");S();function AB(){let[t,e]=qe(n=>n.enableServer,(n,o)=>({...o,enableServer:n})),r=ME(t,e);return m(M,{children:[m(we,{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"}),m($E,{ref:r,name:"Enable",children:"Remember to enable the server in Zotero as well"}),t&&m(bae,{})]})}function bae(){let[t,e]=qe(a=>a.serverPort,(a,l)=>({...l,serverPort:a})),[r]=qe(a=>a.serverHostname,(a,l)=>({...l,serverHostname:a})),[n,o]=L(t),[i]=Mt("check");async function s(){if(isNaN(n)||n<0||n>65535)return new jE.Notice("Invalid port number: "+n),o(t),!1;if(n===t)return!1;let a=await LE({host:r,port:[n]});return a!==n?(new jE.Notice(`Port is currently occupied, a different port is provided: ${a}, confirm again to apply the change.`),o(a),!1):(e(a),!0)}return m(we,{name:"Port number",description:`Default to ${t}`,children:[m("input",{type:"number",value:n,min:0,max:65535,onChange:a=>o(Number.parseInt(a.target.value,10))}),m("button",{"aria-label":"Apply",ref:i,onClick:s})]})}var RB=require("@electron/remote"),NB=require("obsidian");S();function qE({children:t,path:e,state:r}){return m("div",{children:[t,": ",r==="failed"&&"(Failed to load)",m(BE,{path:e,state:r})]})}function BE({path:t,state:e}){return m("code",{"data-state":e,className:re("data-[state=success]:text-txt-success","data-[state=failed]:text-txt-error","data-[state=disabled]:text-txt-muted"),children:t})}S();function zE(t){let{database:e}=te(Ut),[r,n]=Dg(()=>e.api.getLoadStatus().then(i=>t==="zotero"?i.main:i.bbt),[t]),o;return r.loading?o="disabled":r.error?o="failed":o=r.result?"success":"failed",[o,n]}function UE(){let t=kB("main"),e=kB("bbt"),[r,n]=zE("zotero"),[o,i]=zE("bbt"),[s,a,l]=vae(()=>{n(),i()});return m(we,{name:"Zotero data directory",description:m(M,{children:[m(qE,{path:t,state:r,children:"Zotero"}),m(qE,{path:e,state:o,children:"Better BibTeX"})]}),children:[m(BE,{path:s,state:a}),m("button",{onClick:l,children:"Select"})]})}function vae(t){let[e,r]=qe(s=>s.zoteroDataDir,(s,a)=>({...a,zoteroDataDir:s})),{app:n}=te(Ut),o=EB(async()=>{try{let{filePaths:[s]}=await RB.dialog.showOpenDialog({defaultPath:e,properties:["openDirectory"]});s&&e!==s&&(r(s),await new Promise((a,l)=>{function u(){a(),n.vault.off("zotero:db-refresh",u)}n.vault.on("zotero:db-refresh",u),setTimeout(()=>{l(new DOMException("Timeout after 5s","TimeoutError")),n.vault.off("zotero:db-refresh",u)},5e3)}),t())}catch(s){throw console.error("Failed to set data directory",s),new NB.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 kB(t){let e=te(Ut).settings;return t==="main"?e.zoteroDbPath:e.bbtMainDbPath}function WE(){return m(M,{children:[m(UE,{}),m(Vr,{name:"Refresh automatically when Zotero updates database",get:t=>t.autoRefresh,set:(t,e)=>({...e,autoRefresh:t})}),m(AB,{})]})}S();function ms({name:t,children:e,normalize:r,get:n,set:o}){let[i,s]=qe(n,o),[a,l]=L(i);return m(HE,{name:t,value:a,onChange:u=>l(u.target.value),onSubmit:()=>{let u=r?.(a)??a;u!==a&&l(u),s(u)},children:e})}function HE({name:t,children:e,value:r,onChange:n,onSubmit:o}){let[i]=Mt("check");return m(we,{name:t,description:e,children:[m(gu,{className:"border",value:r,onChange:n}),m("button",{"aria-label":"Apply",ref:i,onClick:o})]})}function DB(){let[t,e]=qe(r=>r.imgExcerptImport===!1?"false":r.imgExcerptImport,(r,n)=>({...n,imgExcerptImport:r==="false"?!1:r}));return m(M,{children:[m(we,{heading:!0,name:"Image excerpt",description:"Controls how to import images in annotaion excerpts."}),m(we,{name:"Mode",description:m("dl",{className:"mt-2 grid grid-cols-3 gap-1",children:[m("div",{children:[m("dt",{className:"text-xs font-medium text-txt-normal",children:"Direct link"}),m("dd",{className:"mt-1",children:["Use image embed linked directly to the original image in Zotero cache using ",m("code",{children:"file://"})," url"]})]}),m("div",{children:[m("dt",{className:"text-xs font-medium text-txt-normal",children:"Symlink"}),m("dd",{className:"mt-1",children:["Create a symlink to the original image in Zotero cache within the specified folder",m("p",{className:"text-txt-error",children:"Don't use this option if your file system doesn't support symlink."})]})]}),m("div",{children:[m("dt",{className:"text-xs font-medium text-txt-normal",children:"Copy"}),m("dd",{className:"mt-1",children:"Copy the original image to the specified folder."})]})]}),children:m("select",{className:"dropdown",onChange:r=>e(r.target.value),value:t,children:[m("option",{value:"false",children:"direct link"},0),m("option",{value:"symlink",children:"symlink"},1),m("option",{value:"copy",children:"copy"},2)]})}),t!=="false"&&m(M,{children:m(ms,{name:"Default location",get:r=>r.imgExcerptPath,set:(r,n)=>({...n,imgExcerptPath:r}),normalize:Va,children:"The folder to store image excerpts."})})]})}S();function KE(){let{database:t}=te(Ut),[e,r]=qe(a=>a.citationLibrary,(a,l)=>({...l,citationLibrary:a})),[n,o]=Dg(()=>t.api.getLibs(),[]),i=n.result??[{groupID:null,libraryID:1,name:"My Library"}],[s]=Mt("switch");return m(we,{name:"Citation library",children:[m("select",{className:"dropdown",onChange:a=>r(Number.parseInt(a.target.value,10)),value:e,children:i.map(({groupID:a,libraryID:l,name:u})=>m("option",{value:l,children:u?a?`${u} (Group)`:u:`Library ${l}`},l))}),m("button",{"aria-label":"Refresh",ref:s,onClick:async()=>{await t.refresh({task:"full"}),o()}})]})}function VE(){return m(M,{children:[m(ms,{name:"Default location for new literature notes",get:t=>t.literatureNoteFolder,set:(t,e)=>({...e,literatureNoteFolder:t}),normalize:Va}),m(KE,{}),m(DB,{})]})}function GE(){let[t,e]=qe(r=>r.logLevel,(r,n)=>({...n,logLevel:r}));return m(M,{children:[m(we,{heading:!0,name:"Debug"}),m(we,{name:"Log Level",description:m(M,{children:["Change level of logs output to the console.",m("br",{}),"Set to DEBUG if you need to report a issue",m("br",{}),"To check console, ",cD()]}),children:m("select",{className:"dropdown",onChange:r=>{let n=r.target.value;e(n)},value:t,children:Object.entries(CS).map(([r,n])=>m("option",{value:n,children:r},n))})})]})}function ZE(){return m(M,{children:m(GE,{})})}var FB=require("obsidian");var Gu=class extends FB.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=or(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()}};function JE(){return m(M,{children:[m(Vr,{name:"Citation editor suggester",get:t=>t.citationEditorSuggester,set:(t,e)=>({...e,citationEditorSuggester:t})}),m(Vr,{name:"Show BibTex citekey in suggester",get:t=>t.showCitekeyInSuggester,set:(t,e)=>({...e,showCitekeyInSuggester:t})})]})}S();function YE(){let[t,e]=qe(u=>u.autoTrim[0],(u,c)=>({...c,autoTrim:[u,c.autoTrim[1]]})),[r,n]=qe(u=>u.autoTrim[1],(u,c)=>({...c,autoTrim:[c.autoTrim[0],u]})),[o,i]=L(t),[s,a]=L(r),l=Yt(async function(c,f){let p=c==="false"?!1:c;f===0?(i(p),e(p)):(a(p),n(p))});return m(we,{name:"Auto trim",description:m(M,{children:[m("p",{className:"text-sm",children:["Controls default whitespace/new line trimming before/after a ejs"," ",m("code",{className:"whitespace-nowrap",children:"<% Tag %>"})]}),m("dl",{className:"mt-2",children:m("div",{className:"grid grid-cols-2 gap-1",children:[m("div",{children:[m("dt",{className:"text-xs font-medium text-txt-normal",children:"Newline slurp"}),m("dd",{className:"mt-1",children:"Removes the following newline before and after the tag."})]}),m("div",{children:[m("dt",{className:"text-xs font-medium text-txt-normal",children:"Whitespace slurp:"}),m("dd",{className:"mt-1",children:"Removes all whitespace before and after the tag."})]})]})})]}),children:m("div",{className:"flex flex-col gap-2",children:[0,1].map(u=>m("div",{className:"flex flex-col items-start gap-1 text-sm",children:[m("span",{children:u===0?"Leading":"Ending"}),m("select",{className:"dropdown",onChange:c=>l(c.target.value,u),value:String(u===0?o:s),children:[m("option",{value:"false",children:"Disable"},0),m("option",{value:"nl",children:"Newline slurp (-)"},1),m("option",{value:"slurp",children:"Whitespace slurp (_)"},2)]})]},u))})})}var ri=require("obsidian");S();var PB=require("obsidian");S();function XE(t,{icon:e,desc:r,disable:n}){let o=Yt(t),i=P(null);return U(()=>{i.current?.setIcon(e??"")},[e]),U(()=>{i.current?.setTooltip(r??"")},[r]),U(()=>{i.current?.setDisabled(n??!1)},[n]),X(s=>{if(!s)i.current?.extraSettingsEl.remove(),i.current=null;else{let a=new PB.ExtraButtonComponent(s);a.onClick(o),i.current=a}},[])}var ti={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 MB({type:t}){let{app:e,settings:r}=te(Ut),[n]=Mt("arrow-up-right"),[o]=Mt("folder-input"),[i]=Mt("reset"),[s,a]=L(()=>QE(t,{app:e,folder:r.templateDir})),l=mi(t,r.templateDir);return U(()=>{let u=[e.vault.on("delete",c=>{c.path===l&&a(!1)}),e.vault.on("create",c=>{c.path===l&&a(!0)}),e.vault.on("rename",(c,f)=>{c.path===l&&a(!0),f===l&&a(!1)})];return()=>u.forEach(c=>e.vault.offref(c))},[l]),s?m(we,{name:ti[t].title,description:ti[t].desc,children:[m("code",{children:l}),m("button",{"aria-label":"Open template file",ref:n,onClick:async()=>{await fs(t,null,{app:e,settings:r})}}),m("button",{"aria-label":"Reset to default",ref:i,onClick:async()=>{if(!activeWindow.confirm("Reset template to default?"))return;let u=e.vault.getAbstractFileByPath(l);u instanceof ri.TFile?(await e.vault.modify(u,dt.Ejectable[t]),new ri.Notice(`Template '${l}' reset`)):a(!0)}})]}):m(we,{name:ti[t].title,description:ti[t].desc,children:[m("pre",{className:"text-left max-w-xs overflow-scroll rounded border p-4",children:dt.Ejectable[t]}),m("button",{"aria-label":"Save to template folder",ref:o,onClick:async()=>{let u=await $B(t,{app:e,folder:r.templateDir});a(u)}})]})}async function $B(t,{app:e,folder:r}){let n=mi(t,r),o=e.vault.getAbstractFileByPath(n);return o instanceof ri.TFile?!0:o?(new ri.Notice(`The path '${n}' is occupied by a folder`),!1):(await e.fileManager.createNewMarkdownFile(e.vault.getRoot(),n,dt.Ejectable[t]),new ri.Notice(`Template '${n}' created`),!0)}function QE(t,{app:e,folder:r}){let n=mi(t,r);return e.vault.getAbstractFileByPath(n)instanceof ri.TFile}function LB(){let{app:t,settings:e}=te(Ut),[r,n]=L(()=>en.Ejectable.every(i=>QE(i,{app:t,folder:e.templateDir}))),o=XE(async()=>{let i=en.Ejectable.filter(s=>!QE(s,{app:t,folder:e.templateDir}));await Promise.all(i.map(s=>$B(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]}S();function jB({type:t}){let[e,r]=qe(i=>i.template.templates[t],(i,s)=>({...s,template:{...s.template,templates:{...s.template.templates,[t]:i}}})),[n,o]=L(e);return m(HE,{name:ti[t].title,value:n,onChange:i=>o(i.target.value),onSubmit:()=>{r(n)},children:ti[t].desc})}function eS(){let[t,e]=LB();return m(M,{children:[m(ms,{name:"Template location",get:r=>r.template.folder,set:(r,n)=>({...n,template:{...n.template,folder:r}}),normalize:Va,children:"The folder which templates are ejected into and stored"}),m(Vr,{name:"Auto pair for Eta",get:r=>r.autoPairEta,set:(r,n)=>({...n,autoPairEta:r}),children:["Pair `<` and `%` automatically in eta templates.",m("br",{}),"If you have issue with native auto pair features, you can disable this option and report the bug in GitHub"]}),m(YE,{}),m(we,{heading:!0,name:"Simple"}),en.Embeded.map(r=>m(jB,{type:r},r)),m(we,{heading:!0,name:"Ejectable",ref:e,description:"These templates can be customized once saved to the template folder",children:t||m("div",{children:"Eject"})}),en.Ejectable.map(r=>m(MB,{type:r},r))]})}function tS(){return m(M,{children:[m(we,{heading:!0,name:"Update note",description:m(M,{children:["You can find update note option in ",m("code",{children:"More Options"})," menu and command pallette inside a literature note. When update, all literature notes with the same ",m("code",{children:"zotero-key"})," will be updated."]})}),m(Vr,{name:"Overwrite existing note",get:t=>t.updateOverwrite,set:(t,e)=>({...e,updateOverwrite:t}),children:m("div",{className:"space-y-2",children:m("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."})})}),m(Vr,{name:"In-place update of existing annotations",get:t=>t.updateAnnotBlock,set:(t,e)=>({...e,updateAnnotBlock:t}),children:m("div",{className:"space-y-2",children:[m("div",{children:"(Experimental)"}),m("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."}),m("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."}),m("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 Zu=class extends Gu{constructor(r){super(r.app,r);this.plugin=r;this.containerEl.addClass("obzt")}display(){super.display(),N.render(m(Ut.Provider,{value:{settings:this.plugin.settings,app:this.app,database:this.plugin.dbWorker,closeTab:()=>this.setting.close()},children:m(wae,{})}),this.containerEl),this.register(()=>N.unmountComponentAtNode(this.containerEl))}};function wae(){let[t,e]=iv("obzt-setting-tab",{defaultValue:"general"});return m(yB,{value:t,onValueChange:e,className:"flex h-full flex-col",children:[m(PE,{className:"self-start max-w-full",children:[m(Qo,{value:"general",children:"General"}),m(Qo,{value:"connect",children:"Connect"}),m(Qo,{value:"suggester",children:"Suggester"}),m(Qo,{value:"template",children:"Template"}),m(Qo,{value:"update",children:"Note update"}),m(Qo,{value:"misc",children:"Misc"})]}),m(ei,{value:"general",className:"divide-y flex-grow overflow-y-scroll",children:m(VE,{})}),m(ei,{value:"connect",className:"divide-y flex-grow overflow-y-scroll",children:m(WE,{})}),m(ei,{value:"suggester",className:"divide-y flex-grow overflow-y-scroll",children:m(JE,{})}),m(ei,{value:"template",className:"divide-y flex-grow overflow-y-scroll",children:m(eS,{})}),m(ei,{value:"update",className:"divide-y flex-grow overflow-y-scroll",children:m(tS,{})}),m(ei,{value:"misc",className:"divide-y flex-grow overflow-y-scroll",children:m(ZE,{})})]})}var xe=class extends qB.Plugin{use=ys.plugin(this);constructor(e,r){if(super(e,r),!bN(r,e))throw new Error("Library check failed")}settings=HT(this);services={_log:this.use(zl)};noteIndex=this.use(Ba);server=this.use(Tn);citekeyClick=this.use(vg);templateEditor=this.use(Ia);noteFeatures=this.use(zq);noteParser=this.use(Sg);get databaseAPI(){return this.dbWorker.api}dbWorker=this.use(Vt);imgCacheImporter=this.use(Yo);dbWatcher=this.use(oo);database=this.use(Wu);templateRenderer=this.use(Wo);pdfParser=this.use(Uu);onload(){W.info("loading ZotLit"),this.addSettingTab(new Zu(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.
|
|
*)
|
|
*/
|