@equinor/fusion-framework-cli 15.3.1 â 15.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/bin/build/bin.mjs +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +6 -6
package/bin/build/bin.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{loadConfigFromFile as e,mergeConfig as t,build as n}from"vite";import r from"chalk";import i from"vite-tsconfig-paths";import o,{dirname as s,resolve as a,basename as c,extname as l,relative as u}from"node:path";import{readPackageUp as f}from"read-package-up";import d,{fileURLToPath as p}from"node:url";import h from"node:module";import m from"util";import g,{accessSync as v,constants as y,readFileSync as E,statSync as b,existsSync as w,mkdirSync as L,writeFileSync as I}from"node:fs";import{importConfig as S,FileNotFoundError as C}from"@equinor/fusion-imports";import _ from"deepmerge";import{rawImportsPlugin as D}from"@equinor/fusion-framework-vite-plugin-raw-imports";import P from"node:assert";import{execSync as N}from"node:child_process";import{coerce as O,SemVer as A,satisfies as $}from"semver";import R,{z as x}from"zod";import T from"fs";import k from"path";import F from"zlib";import U from"crypto";import{readdir as B,stat as M,mkdir as G}from"node:fs/promises";import j from"ora";import{processServices as H,createDevServer as z}from"@equinor/fusion-framework-dev-server";import{enableAzureIdentityAuth as q}from"@equinor/fusion-framework-module-azure-identity";function V(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var W,Z,K,Y;function X(){if(Z)return W;Z=1;const e="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};return W=e}function J(){if(Y)return K;Y=1;const e=Number.MAX_SAFE_INTEGER||9007199254740991;return K={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:e,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}}var Q,ee,te,ne,re,ie,oe,se,ae,ce,le,ue,fe,de={exports:{}};function pe(){return Q||(Q=1,function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=J(),o=X(),s=(t=e.exports={}).re=[],a=t.safeRe=[],c=t.src=[],l=t.safeSrc=[],u=t.t={};let f=0;const d="[a-zA-Z0-9-]",p=[["\\s",1],["\\d",i],[d,r]],h=(e,t,n)=>{const r=(e=>{for(const[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e})(t),i=f++;o(e,i,t),u[e]=i,c[i]=t,l[i]=r,s[i]=new RegExp(t,n?"g":void 0),a[i]=new RegExp(r,n?"g":void 0)};h("NUMERICIDENTIFIER","0|[1-9]\\d*"),h("NUMERICIDENTIFIERLOOSE","\\d+"),h("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${d}*`),h("MAINVERSION",`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h("MAINVERSIONLOOSE",`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASEIDENTIFIER",`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h("PRERELEASEIDENTIFIERLOOSE",`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASE",`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h("PRERELEASELOOSE",`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h("BUILDIDENTIFIER",`${d}+`),h("BUILD",`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h("FULLPLAIN",`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h("FULL",`^${c[u.FULLPLAIN]}$`),h("LOOSEPLAIN",`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h("LOOSE",`^${c[u.LOOSEPLAIN]}$`),h("GTLT","((?:<|>)?=?)"),h("XRANGEIDENTIFIERLOOSE",`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h("XRANGEIDENTIFIER",`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h("XRANGEPLAIN",`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h("XRANGEPLAINLOOSE",`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h("XRANGE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h("XRANGELOOSE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h("COERCEPLAIN",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h("COERCE",`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h("COERCEFULL",c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?`+`(?:${c[u.BUILD]})?(?:$|[^\\d])`),h("COERCERTL",c[u.COERCE],!0),h("COERCERTLFULL",c[u.COERCEFULL],!0),h("LONETILDE","(?:~>?)"),h("TILDETRIM",`(\\s*)${c[u.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",h("TILDE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h("TILDELOOSE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h("LONECARET","(?:\\^)"),h("CARETTRIM",`(\\s*)${c[u.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",h("CARET",`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h("CARETLOOSE",`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h("COMPARATORLOOSE",`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h("COMPARATOR",`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h("COMPARATORTRIM",`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",h("HYPHENRANGE",`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h("HYPHENRANGELOOSE",`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h("STAR","(<|>)?=?\\s*\\*"),h("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),h("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(de,de.exports)),de.exports}function he(){if(oe)return ie;oe=1;const e=X(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:n}=J(),{safeRe:r,t:i}=pe(),o=function(){if(te)return ee;te=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return ee=n=>n?"object"!=typeof n?e:n:t}(),{compareIdentifiers:s}=function(){if(re)return ne;re=1;const e=/^[0-9]+$/,t=(t,n)=>{if("number"==typeof t&&"number"==typeof n)return t===n?0:t<n?-1:1;const r=e.test(t),i=e.test(n);return r&&i&&(t=+t,n=+n),t===n?0:r&&!i?-1:i&&!r?1:t<n?-1:1};return ne={compareIdentifiers:t,rcompareIdentifiers:(e,n)=>t(n,e)}}();class a{constructor(s,c){if(c=o(c),s instanceof a){if(s.loose===!!c.loose&&s.includePrerelease===!!c.includePrerelease)return s;s=s.version}else if("string"!=typeof s)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof s}".`);if(s.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",s,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;const l=s.trim().match(c.loose?r[i.LOOSE]:r[i.FULL]);if(!l)throw new TypeError(`Invalid Version: ${s}`);if(this.raw=s,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>n||this.major<0)throw new TypeError("Invalid major version");if(this.minor>n||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>n||this.patch<0)throw new TypeError("Invalid patch version");l[4]?this.prerelease=l[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<n)return t}return e}):this.prerelease=[],this.build=l[5]?l[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(e("SemVer.compare",this.version,this.options,t),!(t instanceof a)){if("string"==typeof t&&t===this.version)return 0;t=new a(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(e){return e instanceof a||(e=new a(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(t){if(t instanceof a||(t=new a(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let n=0;do{const r=this.prerelease[n],i=t.prerelease[n];if(e("prerelease compare",n,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return-1;if(r!==i)return s(r,i)}while(++n)}compareBuild(t){t instanceof a||(t=new a(t,this.options));let n=0;do{const r=this.build[n],i=t.build[n];if(e("build compare",n,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return-1;if(r!==i)return s(r,i)}while(++n)}inc(e,t,n){if(e.startsWith("pre")){if(!t&&!1===n)throw new Error("invalid increment argument: identifier is empty");if(t){const e=`-${t}`.match(this.options.loose?r[i.PRERELEASELOOSE]:r[i.PRERELEASE]);if(!e||e[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,n),this.inc("pre",t,n);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,n),this.inc("pre",t,n);break;case"release":if(0===this.prerelease.length)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(n)?1:0;if(0===this.prerelease.length)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);if(-1===r){if(t===this.prerelease.join(".")&&!1===n)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let r=[t,e];if(!1===n&&(r=[t]),((e,t)=>{const n=t.split(".");if(n.length>e.length)return!1;for(let t=0;t<n.length;t++)if(0!==s(e[t],n[t]))return!1;return!0})(this.prerelease,t)){const e=this.prerelease[t.split(".").length];isNaN(e)&&(this.prerelease=r)}else this.prerelease=r}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return ie=a}function me(){if(ae)return se;ae=1;const e=he();return se=(t,n,r=!1)=>{if(t instanceof e)return t;try{return new e(t,n)}catch(e){if(!r)return null;throw e}},se}var ge,ve,ye,Ee,be,we,Le,Ie,Se,Ce,_e=["0BSD","3D-Slicer-1.0","AAL","ADSL","AFL-1.1","AFL-1.2","AFL-2.0","AFL-2.1","AFL-3.0","AGPL-1.0-only","AGPL-1.0-or-later","AGPL-3.0-only","AGPL-3.0-or-later","AMD-newlib","AMDPLPA","AML","AML-glslang","AMPAS","ANTLR-PD","ANTLR-PD-fallback","APAFML","APL-1.0","APSL-1.0","APSL-1.1","APSL-1.2","APSL-2.0","ASWF-Digital-Assets-1.0","ASWF-Digital-Assets-1.1","Abstyles","AdaCore-doc","Adobe-2006","Adobe-Display-PostScript","Adobe-Glyph","Adobe-Utopia","Afmparse","Aladdin","Apache-1.0","Apache-1.1","Apache-2.0","App-s2p","Arphic-1999","Artistic-1.0","Artistic-1.0-Perl","Artistic-1.0-cl8","Artistic-2.0","Artistic-dist","Aspell-RU","BSD-1-Clause","BSD-2-Clause","BSD-2-Clause-Darwin","BSD-2-Clause-Patent","BSD-2-Clause-Views","BSD-2-Clause-first-lines","BSD-2-Clause-pkgconf-disclaimer","BSD-3-Clause","BSD-3-Clause-Attribution","BSD-3-Clause-Clear","BSD-3-Clause-HP","BSD-3-Clause-LBNL","BSD-3-Clause-Modification","BSD-3-Clause-No-Military-License","BSD-3-Clause-No-Nuclear-License","BSD-3-Clause-No-Nuclear-License-2014","BSD-3-Clause-No-Nuclear-Warranty","BSD-3-Clause-Open-MPI","BSD-3-Clause-Sun","BSD-3-Clause-acpica","BSD-3-Clause-flex","BSD-4-Clause","BSD-4-Clause-Shortened","BSD-4-Clause-UC","BSD-4.3RENO","BSD-4.3TAHOE","BSD-Advertising-Acknowledgement","BSD-Attribution-HPND-disclaimer","BSD-Inferno-Nettverk","BSD-Protection","BSD-Source-Code","BSD-Source-beginning-file","BSD-Systemics","BSD-Systemics-W3Works","BSL-1.0","BUSL-1.1","Baekmuk","Bahyph","Barr","Beerware","BitTorrent-1.0","BitTorrent-1.1","Bitstream-Charter","Bitstream-Vera","BlueOak-1.0.0","Boehm-GC","Boehm-GC-without-fee","Borceux","Brian-Gladman-2-Clause","Brian-Gladman-3-Clause","C-UDA-1.0","CAL-1.0","CAL-1.0-Combined-Work-Exception","CATOSL-1.1","CC-BY-1.0","CC-BY-2.0","CC-BY-2.5","CC-BY-2.5-AU","CC-BY-3.0","CC-BY-3.0-AT","CC-BY-3.0-AU","CC-BY-3.0-DE","CC-BY-3.0-IGO","CC-BY-3.0-NL","CC-BY-3.0-US","CC-BY-4.0","CC-BY-NC-1.0","CC-BY-NC-2.0","CC-BY-NC-2.5","CC-BY-NC-3.0","CC-BY-NC-3.0-DE","CC-BY-NC-4.0","CC-BY-NC-ND-1.0","CC-BY-NC-ND-2.0","CC-BY-NC-ND-2.5","CC-BY-NC-ND-3.0","CC-BY-NC-ND-3.0-DE","CC-BY-NC-ND-3.0-IGO","CC-BY-NC-ND-4.0","CC-BY-NC-SA-1.0","CC-BY-NC-SA-2.0","CC-BY-NC-SA-2.0-DE","CC-BY-NC-SA-2.0-FR","CC-BY-NC-SA-2.0-UK","CC-BY-NC-SA-2.5","CC-BY-NC-SA-3.0","CC-BY-NC-SA-3.0-DE","CC-BY-NC-SA-3.0-IGO","CC-BY-NC-SA-4.0","CC-BY-ND-1.0","CC-BY-ND-2.0","CC-BY-ND-2.5","CC-BY-ND-3.0","CC-BY-ND-3.0-DE","CC-BY-ND-4.0","CC-BY-SA-1.0","CC-BY-SA-2.0","CC-BY-SA-2.0-UK","CC-BY-SA-2.1-JP","CC-BY-SA-2.5","CC-BY-SA-3.0","CC-BY-SA-3.0-AT","CC-BY-SA-3.0-DE","CC-BY-SA-3.0-IGO","CC-BY-SA-4.0","CC-PDDC","CC-PDM-1.0","CC-SA-1.0","CC0-1.0","CDDL-1.0","CDDL-1.1","CDL-1.0","CDLA-Permissive-1.0","CDLA-Permissive-2.0","CDLA-Sharing-1.0","CECILL-1.0","CECILL-1.1","CECILL-2.0","CECILL-2.1","CECILL-B","CECILL-C","CERN-OHL-1.1","CERN-OHL-1.2","CERN-OHL-P-2.0","CERN-OHL-S-2.0","CERN-OHL-W-2.0","CFITSIO","CMU-Mach","CMU-Mach-nodoc","CNRI-Jython","CNRI-Python","CNRI-Python-GPL-Compatible","COIL-1.0","CPAL-1.0","CPL-1.0","CPOL-1.02","CUA-OPL-1.0","Caldera","Caldera-no-preamble","Catharon","ClArtistic","Clips","Community-Spec-1.0","Condor-1.1","Cornell-Lossless-JPEG","Cronyx","Crossword","CryptoSwift","CrystalStacker","Cube","D-FSL-1.0","DEC-3-Clause","DL-DE-BY-2.0","DL-DE-ZERO-2.0","DOC","DRL-1.0","DRL-1.1","DSDP","DocBook-DTD","DocBook-Schema","DocBook-Stylesheet","DocBook-XML","Dotseqn","ECL-1.0","ECL-2.0","EFL-1.0","EFL-2.0","EPICS","EPL-1.0","EPL-2.0","EUDatagrid","EUPL-1.0","EUPL-1.1","EUPL-1.2","Elastic-2.0","Entessa","ErlPL-1.1","Eurosym","FBM","FDK-AAC","FSFAP","FSFAP-no-warranty-disclaimer","FSFUL","FSFULLR","FSFULLRSD","FSFULLRWD","FSL-1.1-ALv2","FSL-1.1-MIT","FTL","Fair","Ferguson-Twofish","Frameworx-1.0","FreeBSD-DOC","FreeImage","Furuseth","GCR-docs","GD","GFDL-1.1-invariants-only","GFDL-1.1-invariants-or-later","GFDL-1.1-no-invariants-only","GFDL-1.1-no-invariants-or-later","GFDL-1.1-only","GFDL-1.1-or-later","GFDL-1.2-invariants-only","GFDL-1.2-invariants-or-later","GFDL-1.2-no-invariants-only","GFDL-1.2-no-invariants-or-later","GFDL-1.2-only","GFDL-1.2-or-later","GFDL-1.3-invariants-only","GFDL-1.3-invariants-or-later","GFDL-1.3-no-invariants-only","GFDL-1.3-no-invariants-or-later","GFDL-1.3-only","GFDL-1.3-or-later","GL2PS","GLWTPL","GPL-1.0-only","GPL-1.0-or-later","GPL-2.0-only","GPL-2.0-or-later","GPL-3.0-only","GPL-3.0-or-later","Game-Programming-Gems","Giftware","Glide","Glulxe","Graphics-Gems","Gutmann","HDF5","HIDAPI","HP-1986","HP-1989","HPND","HPND-DEC","HPND-Fenneberg-Livingston","HPND-INRIA-IMAG","HPND-Intel","HPND-Kevlin-Henney","HPND-MIT-disclaimer","HPND-Markus-Kuhn","HPND-Netrek","HPND-Pbmplus","HPND-UC","HPND-UC-export-US","HPND-doc","HPND-doc-sell","HPND-export-US","HPND-export-US-acknowledgement","HPND-export-US-modify","HPND-export2-US","HPND-merchantability-variant","HPND-sell-MIT-disclaimer-xserver","HPND-sell-regexpr","HPND-sell-variant","HPND-sell-variant-MIT-disclaimer","HPND-sell-variant-MIT-disclaimer-rev","HTMLTIDY","HaskellReport","Hippocratic-2.1","IBM-pibs","ICU","IEC-Code-Components-EULA","IJG","IJG-short","IPA","IPL-1.0","ISC","ISC-Veillard","ImageMagick","Imlib2","Info-ZIP","Inner-Net-2.0","InnoSetup","Intel","Intel-ACPI","Interbase-1.0","JPL-image","JPNIC","JSON","Jam","JasPer-2.0","Kastrup","Kazlib","Knuth-CTAN","LAL-1.2","LAL-1.3","LGPL-2.0-only","LGPL-2.0-or-later","LGPL-2.1-only","LGPL-2.1-or-later","LGPL-3.0-only","LGPL-3.0-or-later","LGPLLR","LOOP","LPD-document","LPL-1.0","LPL-1.02","LPPL-1.0","LPPL-1.1","LPPL-1.2","LPPL-1.3a","LPPL-1.3c","LZMA-SDK-9.11-to-9.20","LZMA-SDK-9.22","Latex2e","Latex2e-translated-notice","Leptonica","LiLiQ-P-1.1","LiLiQ-R-1.1","LiLiQ-Rplus-1.1","Libpng","Linux-OpenIB","Linux-man-pages-1-para","Linux-man-pages-copyleft","Linux-man-pages-copyleft-2-para","Linux-man-pages-copyleft-var","Lucida-Bitmap-Fonts","MIPS","MIT","MIT-0","MIT-CMU","MIT-Click","MIT-Festival","MIT-Khronos-old","MIT-Modern-Variant","MIT-Wu","MIT-advertising","MIT-enna","MIT-feh","MIT-open-group","MIT-testregex","MITNFA","MMIXware","MPEG-SSG","MPL-1.0","MPL-1.1","MPL-2.0","MPL-2.0-no-copyleft-exception","MS-LPL","MS-PL","MS-RL","MTLL","Mackerras-3-Clause","Mackerras-3-Clause-acknowledgment","MakeIndex","Martin-Birgmeier","McPhee-slideshow","Minpack","MirOS","Motosoto","MulanPSL-1.0","MulanPSL-2.0","Multics","Mup","NAIST-2003","NASA-1.3","NBPL-1.0","NCBI-PD","NCGL-UK-2.0","NCL","NCSA","NGPL","NICTA-1.0","NIST-PD","NIST-PD-fallback","NIST-Software","NLOD-1.0","NLOD-2.0","NLPL","NOSL","NPL-1.0","NPL-1.1","NPOSL-3.0","NRL","NTIA-PD","NTP","NTP-0","Naumen","NetCDF","Newsletr","Nokia","Noweb","O-UDA-1.0","OAR","OCCT-PL","OCLC-2.0","ODC-By-1.0","ODbL-1.0","OFFIS","OFL-1.0","OFL-1.0-RFN","OFL-1.0-no-RFN","OFL-1.1","OFL-1.1-RFN","OFL-1.1-no-RFN","OGC-1.0","OGDL-Taiwan-1.0","OGL-Canada-2.0","OGL-UK-1.0","OGL-UK-2.0","OGL-UK-3.0","OGTSL","OLDAP-1.1","OLDAP-1.2","OLDAP-1.3","OLDAP-1.4","OLDAP-2.0","OLDAP-2.0.1","OLDAP-2.1","OLDAP-2.2","OLDAP-2.2.1","OLDAP-2.2.2","OLDAP-2.3","OLDAP-2.4","OLDAP-2.5","OLDAP-2.6","OLDAP-2.7","OLDAP-2.8","OLFL-1.3","OML","OPL-1.0","OPL-UK-3.0","OPUBL-1.0","OSET-PL-2.1","OSL-1.0","OSL-1.1","OSL-2.0","OSL-2.1","OSL-3.0","OpenPBS-2.3","OpenSSL","OpenSSL-standalone","OpenVision","PADL","PDDL-1.0","PHP-3.0","PHP-3.01","PPL","PSF-2.0","Parity-6.0.0","Parity-7.0.0","Pixar","Plexus","PolyForm-Noncommercial-1.0.0","PolyForm-Small-Business-1.0.0","PostgreSQL","Python-2.0","Python-2.0.1","QPL-1.0","QPL-1.0-INRIA-2004","Qhull","RHeCos-1.1","RPL-1.1","RPL-1.5","RPSL-1.0","RSA-MD","RSCPL","Rdisc","Ruby","Ruby-pty","SAX-PD","SAX-PD-2.0","SCEA","SGI-B-1.0","SGI-B-1.1","SGI-B-2.0","SGI-OpenGL","SGP4","SHL-0.5","SHL-0.51","SISSL","SISSL-1.2","SL","SMAIL-GPL","SMLNJ","SMPPL","SNIA","SOFA","SPL-1.0","SSH-OpenSSH","SSH-short","SSLeay-standalone","SSPL-1.0","SUL-1.0","SWL","Saxpath","SchemeReport","Sendmail","Sendmail-8.23","Sendmail-Open-Source-1.1","SimPL-2.0","Sleepycat","Soundex","Spencer-86","Spencer-94","Spencer-99","SugarCRM-1.1.3","Sun-PPP","Sun-PPP-2000","SunPro","Symlinks","TAPR-OHL-1.0","TCL","TCP-wrappers","TGPPL-1.0","TMate","TORQUE-1.1","TOSL","TPDL","TPL-1.0","TTWL","TTYP0","TU-Berlin-1.0","TU-Berlin-2.0","TermReadKey","ThirdEye","TrustedQSL","UCAR","UCL-1.0","UMich-Merit","UPL-1.0","URT-RLE","Ubuntu-font-1.0","Unicode-3.0","Unicode-DFS-2015","Unicode-DFS-2016","Unicode-TOU","UnixCrypt","Unlicense","Unlicense-libtelnet","Unlicense-libwhirlpool","VOSTROM","VSL-1.0","Vim","W3C","W3C-19980720","W3C-20150513","WTFPL","Watcom-1.0","Widget-Workshop","Wsuipa","X11","X11-distribute-modifications-variant","X11-swapped","XFree86-1.1","XSkat","Xdebug-1.03","Xerox","Xfig","Xnet","YPL-1.0","YPL-1.1","ZPL-1.1","ZPL-2.0","ZPL-2.1","Zed","Zeeff","Zend-2.0","Zimbra-1.3","Zimbra-1.4","Zlib","any-OSI","any-OSI-perl-modules","bcrypt-Solar-Designer","blessing","bzip2-1.0.6","check-cvs","checkmk","copyleft-next-0.3.0","copyleft-next-0.3.1","curl","cve-tou","diffmark","dtoa","dvipdfm","eGenix","etalab-2.0","fwlw","gSOAP-1.3b","generic-xts","gnuplot","gtkbook","hdparm","iMatix","jove","libpng-1.6.35","libpng-2.0","libselinux-1.0","libtiff","libutil-David-Nugent","lsof","magaz","mailprio","man2html","metamail","mpi-permissive","mpich2","mplus","ngrep","pkgconf","pnmstitch","psfrag","psutils","python-ldap","radvd","snprintf","softSurfer","ssh-keyscan","swrule","threeparttable","ulem","w3m","wwl","xinetd","xkeyboard-config-Zinoviev","xlock","xpp","xzoom","zlib-acknowledgement"],De=["AGPL-1.0","AGPL-3.0","BSD-2-Clause-FreeBSD","BSD-2-Clause-NetBSD","GFDL-1.1","GFDL-1.2","GFDL-1.3","GPL-1.0","GPL-2.0","GPL-2.0-with-GCC-exception","GPL-2.0-with-autoconf-exception","GPL-2.0-with-bison-exception","GPL-2.0-with-classpath-exception","GPL-2.0-with-font-exception","GPL-3.0","GPL-3.0-with-GCC-exception","GPL-3.0-with-autoconf-exception","LGPL-2.0","LGPL-2.1","LGPL-3.0","Net-SNMP","Nunit","StandardML-NJ","bzip2-1.0.5","eCos-2.0","wxWindows"],Pe=["389-exception","Asterisk-exception","Autoconf-exception-2.0","Autoconf-exception-3.0","Autoconf-exception-generic","Autoconf-exception-generic-3.0","Autoconf-exception-macro","Bison-exception-1.24","Bison-exception-2.2","Bootloader-exception","Classpath-exception-2.0","CLISP-exception-2.0","cryptsetup-OpenSSL-exception","DigiRule-FOSS-exception","eCos-exception-2.0","Fawkes-Runtime-exception","FLTK-exception","fmt-exception","Font-exception-2.0","freertos-exception-2.0","GCC-exception-2.0","GCC-exception-2.0-note","GCC-exception-3.1","Gmsh-exception","GNAT-exception","GNOME-examples-exception","GNU-compiler-exception","gnu-javamail-exception","GPL-3.0-interface-exception","GPL-3.0-linking-exception","GPL-3.0-linking-source-exception","GPL-CC-1.0","GStreamer-exception-2005","GStreamer-exception-2008","i2p-gpl-java-exception","KiCad-libraries-exception","LGPL-3.0-linking-exception","libpri-OpenH323-exception","Libtool-exception","Linux-syscall-note","LLGPL","LLVM-exception","LZMA-exception","mif-exception","OCaml-LGPL-linking-exception","OCCT-exception-1.0","OpenJDK-assembly-exception-1.0","openvpn-openssl-exception","PS-or-PDF-font-exception-20170817","QPL-1.0-INRIA-2004-exception","Qt-GPL-exception-1.0","Qt-LGPL-exception-1.1","Qwt-exception-1.0","SANE-exception","SHL-2.0","SHL-2.1","stunnel-exception","SWI-exception","Swift-exception","Texinfo-exception","u-boot-exception-2.0","UBDL-exception","Universal-FOSS-exception-1.0","vsftpd-openssl-exception","WxWindows-exception-3.1","x11vnc-openssl-exception"];function Ne(){if(ve)return ge;ve=1;var e=[].concat(_e).concat(De),t=Pe;return ge=function(n){var r=0;function i(){return r<n.length}function o(e){if(e instanceof RegExp){var t=n.slice(r).match(e);if(t)return r+=t[0].length,t[0]}else if(n.indexOf(e,r)===r)return r+=e.length,e}function s(){o(/[ ]*/)}function a(){return o(/[A-Za-z0-9-.]+/)}function c(){var e=a();if(!e)throw new Error("Expected idstring at offset "+r);return e}function l(){return function(){for(var e,t=["WITH","AND","OR","(",")",":","+"],i=0;i<t.length&&!(e=o(t[i]));i++);if("+"===e&&r>1&&" "===n[r-2])throw new Error("Space before `+`");return e&&{type:"OPERATOR",string:e}}()||function(){if(o("DocumentRef-"))return{type:"DOCUMENTREF",string:c()}}()||function(){if(o("LicenseRef-"))return{type:"LICENSEREF",string:c()}}()||(i=r,s=a(),-1!==e.indexOf(s)?{type:"LICENSE",string:s}:-1!==t.indexOf(s)?{type:"EXCEPTION",string:s}:void(r=i));var i,s}for(var u=[];i()&&(s(),i());){var f=l();if(!f)throw new Error("Unexpected `"+n[r]+"` at offset "+r);u.push(f)}return u}}function Oe(){return Ee?ye:(Ee=1,ye=function(e){var t=0;function n(){return t<e.length}function r(){return n()?e[t]:null}function i(){if(!n())throw new Error;t++}function o(e){var t=r();if(t&&"OPERATOR"===t.type&&e===t.string)return i(),t.string}function s(){var e=r();if(e&&"LICENSE"===e.type){i();var t={license:e.string};o("+")&&(t.plus=!0);var n=function(){if(o("WITH")){var e=r();if(e&&"EXCEPTION"===e.type)return i(),e.string;throw new Error("Expected exception after `WITH`")}}();return n&&(t.exception=n),t}}function a(e,t){return function n(){var r=t();if(r){if(!o(e))return r;var i=n();if(!i)throw new Error("Expected expression");return{left:r,conjunction:e.toLowerCase(),right:i}}}}var c=a("AND",function(){return function(){if(o("(")){var e=l();if(!o(")"))throw new Error("Expected `)`");return e}}()||function(){var e=t,n="",s=r();if("DOCUMENTREF"===s.type&&(i(),n+="DocumentRef-"+s.string+":",!o(":")))throw new Error("Expected `:` after `DocumentRef-...`");if("LICENSEREF"===(s=r()).type)return i(),{license:n+="LicenseRef-"+s.string};t=e}()||s()}),l=a("OR",c),u=l();if(!u||n())throw new Error("Syntax error");return u})}function Ae(){if(we)return be;we=1;var e=Ne(),t=Oe();return be=function(n){return t(e(n))}}function $e(){if(Ce)return Se;Ce=1;var e=Ae(),t=function(){if(Ie)return Le;Ie=1;var e=Ae(),t=_e;function n(t){try{return e(t),!0}catch(e){return!1}}function r(e,t){var n=t[0].length-e[0].length;return 0!==n?n:e[0].toUpperCase().localeCompare(t[0].toUpperCase())}var i=[["APGL","AGPL"],["Gpl","GPL"],["GLP","GPL"],["APL","Apache"],["ISD","ISC"],["GLP","GPL"],["IST","ISC"],["Claude","Clause"],[" or later","+"],[" International",""],["GNU","GPL"],["GUN","GPL"],["+",""],["GNU GPL","GPL"],["GNU LGPL","LGPL"],["GNU/GPL","GPL"],["GNU GLP","GPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL"],["GNU Lesser General Public License","LGPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["GNU Lesser General Public License","LGPL-2.1"],["LESSER GENERAL PUBLIC LICENSE","LGPL"],["Lesser General Public License","LGPL"],["LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["Lesser General Public License","LGPL-2.1"],["GNU General Public License","GPL"],["Gnu public license","GPL"],["GNU Public License","GPL"],["GNU GENERAL PUBLIC LICENSE","GPL"],["MTI","MIT"],["Mozilla Public License","MPL"],["Universal Permissive License","UPL"],["WTH","WTF"],["WTFGPL","WTFPL"],["-License",""]].sort(r),o=[function(e){return e.toUpperCase()},function(e){return e.trim()},function(e){return e.replace(/\./g,"")},function(e){return e.replace(/\s+/g,"")},function(e){return e.replace(/\s+/g,"-")},function(e){return e.replace("v","-")},function(e){return e.replace(/,?\s*(\d)/,"-$1")},function(e){return e.replace(/,?\s*(\d)/,"-$1.0")},function(e){return e.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2")},function(e){return e.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2.0")},function(e){return e[0].toUpperCase()+e.slice(1)},function(e){return e.replace("/","-")},function(e){return e.replace(/\s*V\s*(\d)/,"-$1").replace(/(\d)$/,"$1.0")},function(e){return-1!==e.indexOf("3.0")?e+"-or-later":e+"-only"},function(e){return e+"only"},function(e){return e.replace(/(\d)$/,"-$1.0")},function(e){return e.replace(/(-| )?(\d)$/,"-$2-Clause")},function(e){return e.replace(/(-| )clause(-| )(\d)/,"-$3-Clause")},function(e){return e.replace(/\b(Modified|New|Revised)(-| )?BSD((-| )License)?/i,"BSD-3-Clause")},function(e){return e.replace(/\bSimplified(-| )?BSD((-| )License)?/i,"BSD-2-Clause")},function(e){return e.replace(/\b(Free|Net)(-| )?BSD((-| )License)?/i,"BSD-2-Clause-$1BSD")},function(e){return e.replace(/\bClear(-| )?BSD((-| )License)?/i,"BSD-3-Clause-Clear")},function(e){return e.replace(/\b(Old|Original)(-| )?BSD((-| )License)?/i,"BSD-4-Clause")},function(e){return"CC-"+e},function(e){return"CC-"+e+"-4.0"},function(e){return e.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")},function(e){return"CC-"+e.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")+"-4.0"}],s=t.map(function(e){var t=/^(.*)-\d+\.\d+$/.exec(e);return t?[t[0],t[1]]:[e,null]}).reduce(function(e,t){var n=t[1];return e[n]=e[n]||[],e[n].push(t[0]),e},{}),a=Object.keys(s).map(function(e){return[e,s[e]]}).filter(function(e){return 1===e[1].length&&null!==e[0]&&"APL"!==e[0]}).map(function(e){return[e[0],e[1][0]]});s=void 0;var c=[["UNLI","Unlicense"],["WTF","WTFPL"],["2 CLAUSE","BSD-2-Clause"],["2-CLAUSE","BSD-2-Clause"],["3 CLAUSE","BSD-3-Clause"],["3-CLAUSE","BSD-3-Clause"],["AFFERO","AGPL-3.0-or-later"],["AGPL","AGPL-3.0-or-later"],["APACHE","Apache-2.0"],["ARTISTIC","Artistic-2.0"],["Affero","AGPL-3.0-or-later"],["BEER","Beerware"],["BOOST","BSL-1.0"],["BSD","BSD-2-Clause"],["CDDL","CDDL-1.1"],["ECLIPSE","EPL-1.0"],["FUCK","WTFPL"],["GNU","GPL-3.0-or-later"],["LGPL","LGPL-3.0-or-later"],["GPLV1","GPL-1.0-only"],["GPL-1","GPL-1.0-only"],["GPLV2","GPL-2.0-only"],["GPL-2","GPL-2.0-only"],["GPL","GPL-3.0-or-later"],["MIT +NO-FALSE-ATTRIBS","MITNFA"],["MIT","MIT"],["MPL","MPL-2.0"],["X11","X11"],["ZLIB","Zlib"]].concat(a).sort(r),l=function(e){for(var t=0;t<o.length;t++){var r=o[t](e).trim();if(r!==e&&n(r))return r}return null},u=function(e){for(var t=e.toUpperCase(),n=0;n<c.length;n++){var r=c[n];if(t.indexOf(r[0])>-1)return r[1]}return null},f=function(e,t){for(var n=0;n<i.length;n++){var r=i[n],o=r[0];if(e.indexOf(o)>-1){var s=t(e.replace(o,r[1]));if(null!==s)return s}}return null};return Le=function(e,t){var r=void 0===(t=t||{}).upgrade||!!t.upgrade;function i(e){return r?function(e){return-1!==["GPL-1.0","LGPL-1.0","AGPL-1.0","GPL-2.0","LGPL-2.0","AGPL-2.0","LGPL-2.1"].indexOf(e)?e+"-only":-1!==["GPL-1.0+","GPL-2.0+","GPL-3.0+","LGPL-2.0+","LGPL-2.1+","LGPL-3.0+","AGPL-1.0+","AGPL-3.0+"].indexOf(e)?e.replace(/\+$/,"-or-later"):-1!==["GPL-3.0","LGPL-3.0","AGPL-3.0"].indexOf(e)?e+"-or-later":e}(e):e}if("string"!=typeof e||0===e.trim().length)throw Error("Invalid argument. Expected non-empty string.");if(n(e=e.trim()))return i(e);var o=e.replace(/\+$/,"").trim();if(n(o))return i(o);var s=l(e);return null!==s||null!==(s=f(e,function(e){return n(e)?e:l(e)}))||null!==(s=u(e))||null!==(s=f(e,u))?i(s):null}}(),n='license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>"',r=/^SEE LICEN[CS]E IN (.+)$/;function i(e,t){return t.slice(0,e.length)===e}function o(e){if(e.hasOwnProperty("license")){var t=e.license;return i("LicenseRef",t)||i("DocumentRef",t)}return o(e.left)||o(e.right)}return Se=function(i){var s;try{s=e(i)}catch(e){var a;if("UNLICENSED"===i||"UNLICENCED"===i)return{validForOldPackages:!0,validForNewPackages:!0,unlicensed:!0};if(a=r.exec(i))return{validForOldPackages:!0,validForNewPackages:!0,inFile:a[1]};var c={validForOldPackages:!1,validForNewPackages:!1,warnings:[n]};if(0!==i.trim().length){var l=t(i);l&&c.warnings.push('license is similar to the valid expression "'+l+'"')}return c}return o(s)?{validForNewPackages:!1,validForOldPackages:!1,spdx:!0,warnings:[n]}:{validForNewPackages:!0,validForOldPackages:!0,spdx:!0}}}var Re,xe,Te,ke,Fe,Ue,Be,Me,Ge,je,He,ze={};function qe(){if(Re)return ze;Re=1;var e=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),t=e(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.tracing=e.metrics=void 0;var t={hasSubscribers:!1};e.metrics=t,e.tracing=t}),n=e(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.defaultPerf=void 0,e.defaultPerf="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date});Object.defineProperty(ze,"__esModule",{value:!0}),ze.LRUCache=void 0;var r=t(),i=n(),o=()=>r.metrics.hasSubscribers||r.tracing.hasSubscribers,s=new Set,a="object"==typeof process&&process?process:{},c=e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),l=e=>c(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?u:null:null,u=class extends Array{constructor(e){super(e),this.fill(0)}},f=class e{heap;length;static#e=!1;static create(t){let n=l(t);if(!n)return[];e.#e=!0;let r=new e(t,n);return e.#e=!1,r}constructor(t,n){if(!e.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new n(t),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},d=class e{#e;#t;#n;#r;#i;#o;#s;#a;get perf(){return this.#a}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;backgroundFetchSize;#c;#l;#u;#f;#d;#p;#h;#m;#g;#v;#y;#E;#b;#w;#L;#I;#S;#C;#_;static unsafeExposeInternals(e){return{starts:e.#b,ttls:e.#w,autopurgeTimers:e.#L,sizes:e.#E,keyMap:e.#u,keyList:e.#f,valList:e.#d,next:e.#p,prev:e.#h,get head(){return e.#m},get tail(){return e.#g},free:e.#v,isBackgroundFetch:t=>e.#D(t),backgroundFetch:(t,n,r,i)=>e.#P(t,n,r,i),moveToTail:t=>e.#N(t),indexes:t=>e.#O(t),rindexes:t=>e.#A(t),isStale:t=>e.#$(t)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#l}get size(){return this.#c}get fetchMethod(){return this.#o}get memoMethod(){return this.#s}get dispose(){return this.#n}get onInsert(){return this.#r}get disposeAfter(){return this.#i}constructor(t){let{max:n=0,ttl:r,ttlResolution:o=1,ttlAutopurge:u,updateAgeOnGet:d,updateAgeOnHas:p,allowStale:h,dispose:m,onInsert:g,disposeAfter:v,noDisposeOnSet:y,noUpdateTTL:E,maxSize:b=0,maxEntrySize:w=0,sizeCalculation:L,fetchMethod:I,memoMethod:S,noDeleteOnFetchRejection:C,noDeleteOnStaleGet:_,allowStaleOnFetchRejection:D,allowStaleOnFetchAbort:P,ignoreFetchAbort:N,backgroundFetchSize:O=1,perf:A}=t;if(this.backgroundFetchSize=O,void 0!==A&&"function"!=typeof A?.now)throw new TypeError("perf option must have a now() method if specified");if(this.#a=A??i.defaultPerf,0!==n&&!c(n))throw new TypeError("max option must be a nonnegative integer");let $=n?l(n):Array;if(!$)throw new Error("invalid max value: "+n);if(this.#e=n,this.#t=b,this.maxEntrySize=w||this.#t,this.sizeCalculation=L,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculation set to non-function")}if(void 0!==S&&"function"!=typeof S)throw new TypeError("memoMethod must be a function if defined");if(this.#s=S,void 0!==I&&"function"!=typeof I)throw new TypeError("fetchMethod must be a function if specified");if(this.#o=I,this.#S=!!I,this.#u=new Map,this.#f=Array.from({length:n}).fill(void 0),this.#d=Array.from({length:n}).fill(void 0),this.#p=new $(n),this.#h=new $(n),this.#m=0,this.#g=0,this.#v=f.create(n),this.#c=0,this.#l=0,"function"==typeof m&&(this.#n=m),"function"==typeof g&&(this.#r=g),"function"==typeof v?(this.#i=v,this.#y=[]):(this.#i=void 0,this.#y=void 0),this.#I=!!this.#n,this.#_=!!this.#r,this.#C=!!this.#i,this.noDisposeOnSet=!!y,this.noUpdateTTL=!!E,this.noDeleteOnFetchRejection=!!C,this.allowStaleOnFetchRejection=!!D,this.allowStaleOnFetchAbort=!!P,this.ignoreFetchAbort=!!N,0!==this.maxEntrySize){if(0!==this.#t&&!c(this.#t))throw new TypeError("maxSize must be a positive integer if specified");if(!c(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#R()}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!_,this.updateAgeOnGet=!!d,this.updateAgeOnHas=!!p,this.ttlResolution=c(o)||0===o?o:1,this.ttlAutopurge=!!u,this.ttl=r||0,this.ttl){if(!c(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#x()}if(0===this.#e&&0===this.ttl&&0===this.#t)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){let t="LRU_CACHE_UNBOUNDED";(e=>!s.has(e))(t)&&(s.add(t),((e,t,n,r)=>{"function"==typeof a.emitWarning?a.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)})("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",t,e))}}getRemainingTTL(e){return this.#u.has(e)?1/0:0}#x(){let e=new u(this.#e),t=new u(this.#e);this.#w=e,this.#b=t;let n=this.ttlAutopurge?Array.from({length:this.#e}):void 0;this.#L=n,this.#T=(n,i,o=this.#a.now())=>{t[n]=0!==i?o:0,e[n]=i,r(n,i)},this.#k=n=>{t[n]=0!==e[n]?this.#a.now():0,r(n,e[n])};let r=this.ttlAutopurge?(e,t)=>{if(n?.[e]&&(clearTimeout(n[e]),n[e]=void 0),t&&0!==t&&n){let i=setTimeout(()=>{this.#$(e)?(this.#F(this.#f[e],"expire"),n[e]=void 0):r(e,s(e))},t+1);i.unref&&i.unref(),n[e]=i}}:()=>{};this.#U=(n,r)=>{if(e[r]){let s=e[r],a=t[r];if(!s||!a)return;n.ttl=s,n.start=a,n.now=i||o();let c=n.now-a;n.remainingTTL=s-c}};let i=0,o=()=>{let e=this.#a.now();if(this.ttlResolution>0){i=e;let t=setTimeout(()=>i=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=e=>{let t=this.#u.get(e);return void 0===t?0:s(t)};let s=n=>{let r=e[n],s=t[n];return r&&s?r-((i||o())-s):1/0};this.#$=n=>{let r=t[n],s=e[n];return!!s&&!!r&&(i||o())-r>s}}#k=()=>{};#U=()=>{};#T=()=>{};#$=()=>!1;#R(){let e=new u(this.#e);this.#l=0,this.#E=e,this.#B=t=>{this.#l-=e[t],e[t]=0},this.#M=(e,t,n,r)=>{if(!c(n)){if(this.#D(t))return this.backgroundFetchSize;if(!r)throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");if("function"!=typeof r)throw new TypeError("sizeCalculation must be a function");if(n=r(t,e),!c(n))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return n},this.#G=(t,n,r)=>{if(e[t]=n,this.#t){let n=this.#t-e[t];for(;this.#l>n;)this.#j(!0)}this.#l+=e[t],r&&(r.entrySize=n,r.totalCalculatedSize=this.#l)}}#B=e=>{};#G=(e,t,n)=>{};#M=(e,t,n,r)=>{if(n||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#O({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#g;this.#H(t)&&((e||!this.#$(t))&&(yield t),t!==this.#m);)t=this.#h[t]}*#A({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#m;this.#H(t)&&((e||!this.#$(t))&&(yield t),t!==this.#g);)t=this.#p[t]}#H(e){return void 0!==e&&this.#u.get(this.#f[e])===e}*entries(){for(let e of this.#O())void 0!==this.#d[e]&&void 0!==this.#f[e]&&!this.#D(this.#d[e])&&(yield[this.#f[e],this.#d[e]])}*rentries(){for(let e of this.#A())void 0!==this.#d[e]&&void 0!==this.#f[e]&&!this.#D(this.#d[e])&&(yield[this.#f[e],this.#d[e]])}*keys(){for(let e of this.#O()){let t=this.#f[e];void 0!==t&&!this.#D(this.#d[e])&&(yield t)}}*rkeys(){for(let e of this.#A()){let t=this.#f[e];void 0!==t&&!this.#D(this.#d[e])&&(yield t)}}*values(){for(let e of this.#O())void 0!==this.#d[e]&&!this.#D(this.#d[e])&&(yield this.#d[e])}*rvalues(){for(let e of this.#A())void 0!==this.#d[e]&&!this.#D(this.#d[e])&&(yield this.#d[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let n of this.#O()){let r=this.#d[n],i=this.#D(r)?r.__staleWhileFetching:r;if(void 0!==i&&e(i,this.#f[n],this))return this.#z(this.#f[n],t)}}forEach(e,t=this){for(let n of this.#O()){let r=this.#d[n],i=this.#D(r)?r.__staleWhileFetching:r;void 0!==i&&e.call(t,i,this.#f[n],this)}}rforEach(e,t=this){for(let n of this.#A()){let r=this.#d[n],i=this.#D(r)?r.__staleWhileFetching:r;void 0!==i&&e.call(t,i,this.#f[n],this)}}purgeStale(){let e=!1;for(let t of this.#A({allowStale:!0}))this.#$(t)&&(this.#F(this.#f[t],"expire"),e=!0);return e}info(e){let t=this.#u.get(e);if(void 0===t)return;let n=this.#d[t],r=this.#D(n)?n.__staleWhileFetching:n;if(void 0===r)return;let i={value:r};if(this.#w&&this.#b){let e=this.#w[t],n=this.#b[t];if(e&&n){let t=e-(this.#a.now()-n);i.ttl=t,i.start=Date.now()}}return this.#E&&(i.size=this.#E[t]),i}dump(){let e=[];for(let t of this.#O({allowStale:!0})){let n=this.#f[t],r=this.#d[t],i=this.#D(r)?r.__staleWhileFetching:r;if(void 0===i||void 0===n)continue;let o={value:i};if(this.#w&&this.#b){o.ttl=this.#w[t];let e=this.#a.now()-this.#b[t];o.start=Math.floor(Date.now()-e)}this.#E&&(o.size=this.#E[t]),e.unshift([n,o])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let e=Date.now()-n.start;n.start=this.#a.now()-e}this.#q(t,n.value,n)}}set(e,t,n={}){let{status:i=(r.metrics.hasSubscribers?{}:void 0)}=n;n.status=i,i&&(i.op="set",i.key=e,void 0!==t&&(i.value=t),i.cache=this);let o=this.#q(e,t,n);return i&&r.metrics.hasSubscribers&&r.metrics.publish(i),o}#q(e,t,n,r){let{ttl:i=this.ttl,start:o,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:c}=n,l=this.#D(t);if(void 0===t)return c&&(c.set="deleted"),this.delete(e),this;let{noUpdateTTL:u=this.noUpdateTTL}=n;c&&!l&&(c.value=t);let f=this.#M(e,t,n.size||0,a,c);if(this.maxEntrySize&&f>this.maxEntrySize)return this.#F(e,"set"),c&&(c.set="miss",c.maxEntrySizeExceeded=!0),this;let d=0===this.#c?void 0:this.#u.get(e);if(void 0===d)d=0===this.#c?this.#g:0!==this.#v.length?this.#v.pop():this.#c===this.#e?this.#j(!1):this.#c,this.#f[d]=e,this.#d[d]=t,this.#u.set(e,d),this.#p[this.#g]=d,this.#h[d]=this.#g,this.#g=d,this.#c++,this.#G(d,f,c),c&&(c.set="add"),u=!1,this.#_&&!l&&this.#r?.(t,e,"add");else{this.#N(d);let n=this.#d[d];if(t!==n){if(!s)if(this.#D(n)){n!==r&&n.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:i}=n;void 0!==i&&i!==t&&(this.#I&&this.#n?.(i,e,"set"),this.#C&&this.#y?.push([i,e,"set"]))}else this.#I&&this.#n?.(n,e,"set"),this.#C&&this.#y?.push([n,e,"set"]);if(this.#B(d),this.#G(d,f,c),this.#d[d]=t,!l){let r=n&&this.#D(n)?n.__staleWhileFetching:n,i=void 0===r?"add":t!==r?"replace":"update";c&&(c.set=i,void 0!==r&&(c.oldValue=r)),this.#_&&this.onInsert?.(t,e,i)}}else l||(c&&(c.set="update"),this.#_&&this.onInsert?.(t,e,"update"))}if(0!==i&&!this.#w&&this.#x(),this.#w&&(u||this.#T(d,i,o),c&&this.#U(c,d)),!s&&this.#C&&this.#y){let e,t=this.#y;for(;e=t?.shift();)this.#i?.(...e)}return this}pop(){try{for(;this.#c;){let e=this.#d[this.#m];if(this.#j(!0),this.#D(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(void 0!==e)return e}}finally{if(this.#C&&this.#y){let e,t=this.#y;for(;e=t?.shift();)this.#i?.(...e)}}}#j(e){let t=this.#m,n=this.#f[t],r=this.#d[t],i=this.#D(r);i&&r.__abortController.abort(new Error("evicted"));let o=i?r.__staleWhileFetching:r;return(this.#I||this.#C)&&void 0!==o&&(this.#I&&this.#n?.(o,n,"evict"),this.#C&&this.#y?.push([o,n,"evict"])),this.#B(t),this.#L?.[t]&&(clearTimeout(this.#L[t]),this.#L[t]=void 0),e&&(this.#f[t]=void 0,this.#d[t]=void 0,this.#v.push(t)),1===this.#c?(this.#m=this.#g=0,this.#v.length=0):this.#m=this.#p[t],this.#u.delete(n),this.#c--,t}has(e,t={}){let{status:n=(r.metrics.hasSubscribers?{}:void 0)}=t;t.status=n,n&&(n.op="has",n.key=e,n.cache=this);let i=this.#V(e,t);return r.metrics.hasSubscribers&&r.metrics.publish(n),i}#V(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:r}=t,i=this.#u.get(e);if(void 0!==i){let e=this.#d[i];if(this.#D(e)&&void 0===e.__staleWhileFetching)return!1;if(!this.#$(i))return n&&this.#k(i),r&&(r.has="hit",this.#U(r,i)),!0;r&&(r.has="stale",this.#U(r,i))}else r&&(r.has="miss");return!1}peek(e,t={}){let{status:n=(o()?{}:void 0)}=t;n&&(n.op="peek",n.key=e,n.cache=this),t.status=n;let i=this.#W(e,t);return r.metrics.hasSubscribers&&r.metrics.publish(n),i}#W(e,t){let{status:n,allowStale:r=this.allowStale}=t,i=this.#u.get(e);if(void 0===i||!r&&this.#$(i))return void(n&&(n.peek=void 0===i?"miss":"stale"));let o=this.#d[i],s=this.#D(o)?o.__staleWhileFetching:o;return n&&(void 0!==s?(n.peek="hit",n.value=s):n.peek="miss"),s}#P(e,t,n,r){let i=void 0===t?void 0:this.#d[t];if(this.#D(i))return i;let o=new AbortController,{signal:s}=n;s?.addEventListener("abort",()=>o.abort(s.reason),{signal:o.signal});let a={signal:o.signal,options:n,context:r},c=(r,i=!1)=>{let{aborted:s}=o.signal,c=n.ignoreFetchAbort&&void 0!==r,f=n.ignoreFetchAbort||!(!n.allowStaleOnFetchAbort||void 0===r);if(n.status&&(s&&!i?(n.status.fetchAborted=!0,n.status.fetchError=o.signal.reason,c&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),s&&!c&&!i)return l(o.signal.reason,f);let d=u,p=this.#d[t];return(p===u||void 0===p&&c&&i)&&(void 0===r?void 0!==d.__staleWhileFetching?this.#d[t]=d.__staleWhileFetching:this.#F(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.#q(e,r,a.options,d))),r},l=(r,i)=>{let{aborted:s}=o.signal,a=s&&n.allowStaleOnFetchAbort,c=a||n.allowStaleOnFetchRejection,l=c||n.noDeleteOnFetchRejection,f=u;if(this.#d[t]===u&&(!l||!i&&void 0===f.__staleWhileFetching?this.#F(e,"fetch"):a||(this.#d[t]=f.__staleWhileFetching)),c)return n.status&&void 0!==f.__staleWhileFetching&&(n.status.returnedStale=!0),f.__staleWhileFetching;if(f.__returned===f)throw r};n.status&&(n.status.fetchDispatched=!0);let u=new Promise((t,r)=>{let s=this.#o?.(e,i,a);o.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(t(void 0),n.allowStaleOnFetchAbort&&(t=e=>c(e,!0)))}),s&&s instanceof Promise?s.then(e=>t(void 0===e?void 0:e),r):void 0!==s&&t(s)}).then(c,e=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=e),l(e,!1))),f=Object.assign(u,{__abortController:o,__staleWhileFetching:i,__returned:void 0});return void 0===t?(this.#q(e,f,{...a.options,status:void 0}),t=this.#u.get(e)):this.#d[t]=f,f}#D(e){if(!this.#S)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof AbortController}fetch(e,t={}){let n=r.tracing.hasSubscribers,{status:i=(o()?{}:void 0)}=t;t.status=i,i&&t.context&&(i.context=t.context);let s=this.#Z(e,t);return i&&n&&(i.trace=!0,r.tracing.tracePromise(()=>s,i).catch(()=>{})),s}async#Z(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:a=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:h,forceRefresh:m=!1,status:g,signal:v}=t;if(g&&(g.op="fetch",g.key=e,m&&(g.forceRefresh=!0),g.cache=this),!this.#S)return g&&(g.fetch="get"),this.#z(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,status:g});let y={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,ttl:o,noDisposeOnSet:s,size:a,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:p,ignoreFetchAbort:d,status:g,signal:v},E=this.#u.get(e);if(void 0===E){g&&(g.fetch="miss");let t=this.#P(e,E,y,h);return t.__returned=t}{let t=this.#d[E];if(this.#D(t)){let e=n&&void 0!==t.__staleWhileFetching;return g&&(g.fetch="inflight",e&&(g.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let i=this.#$(E);if(!m&&!i)return g&&(g.fetch="hit"),this.#N(E),r&&this.#k(E),g&&this.#U(g,E),t;let o=this.#P(e,E,y,h),s=void 0!==o.__staleWhileFetching&&n;return g&&(g.fetch=i?"stale":"refresh",s&&i&&(g.returnedStale=!0)),s?o.__staleWhileFetching:o.__returned=o}}forceFetch(e,t={}){let n=r.tracing.hasSubscribers,{status:i=(o()?{}:void 0)}=t;t.status=i,i&&t.context&&(i.context=t.context);let s=this.#K(e,t);return i&&n&&(i.trace=!0,r.tracing.tracePromise(()=>s,i).catch(()=>{})),s}async#K(e,t={}){let n=await this.#Z(e,t);if(void 0===n)throw new Error("fetch() returned undefined");return n}memo(e,t={}){let{status:n=(r.metrics.hasSubscribers?{}:void 0)}=t;t.status=n,n&&(n.op="memo",n.key=e,t.context&&(n.context=t.context),n.cache=this);let i=this.#Y(e,t);return n&&(n.value=i),r.metrics.hasSubscribers&&r.metrics.publish(n),i}#Y(e,t={}){let n=this.#s;if(!n)throw new Error("no memoMethod provided to constructor");let{context:r,status:i,forceRefresh:o,...s}=t;i&&o&&(i.forceRefresh=!0);let a=this.#z(e,s),c=o||void 0===a;if(i&&(i.memo=c?"miss":"hit",c||(i.value=a)),!c)return a;let l=n(e,a,{options:s,context:r});return i&&(i.value=l),this.#q(e,l,s),l}get(e,t={}){let{status:n=(r.metrics.hasSubscribers?{}:void 0)}=t;t.status=n,n&&(n.op="get",n.key=e,n.cache=this);let i=this.#z(e,t);return n&&(void 0!==i&&(n.value=i),r.metrics.hasSubscribers&&r.metrics.publish(n)),i}#z(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:o}=t,s=this.#u.get(e);if(void 0===s)return void(o&&(o.get="miss"));let a=this.#d[s],c=this.#D(a);return o&&this.#U(o,s),this.#$(s)?c?(o&&(o.get="stale-fetching"),n&&void 0!==a.__staleWhileFetching?(o&&(o.returnedStale=!0),a.__staleWhileFetching):void 0):(i||this.#F(e,"expire"),o&&(o.get="stale"),n?(o&&(o.returnedStale=!0),a):void 0):(o&&(o.get=c?"fetching":"hit"),this.#N(s),r&&this.#k(s),c?a.__staleWhileFetching:a)}#X(e,t){this.#h[t]=e,this.#p[e]=t}#N(e){e!==this.#g&&(e===this.#m?this.#m=this.#p[e]:this.#X(this.#h[e],this.#p[e]),this.#X(this.#g,e),this.#g=e)}delete(e){return this.#F(e,"delete")}#F(e,t){r.metrics.hasSubscribers&&r.metrics.publish({op:"delete",delete:t,key:e,cache:this});let n=!1;if(0!==this.#c){let r=this.#u.get(e);if(void 0!==r)if(this.#L?.[r]&&(clearTimeout(this.#L[r]),this.#L[r]=void 0),n=!0,1===this.#c)this.#J(t);else{this.#B(r);let n=this.#d[r];if(this.#D(n)?n.__abortController.abort(new Error("deleted")):(this.#I||this.#C)&&(this.#I&&this.#n?.(n,e,t),this.#C&&this.#y?.push([n,e,t])),this.#u.delete(e),this.#f[r]=void 0,this.#d[r]=void 0,r===this.#g)this.#g=this.#h[r];else if(r===this.#m)this.#m=this.#p[r];else{let e=this.#h[r];this.#p[e]=this.#p[r];let t=this.#p[r];this.#h[t]=this.#h[r]}this.#c--,this.#v.push(r)}}if(this.#C&&this.#y?.length){let e,t=this.#y;for(;e=t?.shift();)this.#i?.(...e)}return n}clear(){return this.#J("delete")}#J(e){for(let t of this.#A({allowStale:!0})){let n=this.#d[t];if(this.#D(n))n.__abortController.abort(new Error("deleted"));else{let r=this.#f[t];this.#I&&this.#n?.(n,r,e),this.#C&&this.#y?.push([n,r,e])}}if(this.#u.clear(),this.#d.fill(void 0),this.#f.fill(void 0),this.#w&&this.#b){this.#w.fill(0),this.#b.fill(0);for(let e of this.#L??[])void 0!==e&&clearTimeout(e);this.#L?.fill(void 0)}if(this.#E&&this.#E.fill(0),this.#m=0,this.#g=0,this.#v.length=0,this.#l=0,this.#c=0,this.#C&&this.#y){let e,t=this.#y;for(;e=t?.shift();)this.#i?.(...e)}}};return ze.LRUCache=d,ze}function Ve(){if(Fe)return ke;Fe=1;const e=(e,t,n)=>{const r=e.indexOf(n);return e.lastIndexOf(t,r>-1?r:1/0)},t=e=>{try{return new URL(e)}catch{}};return ke=(n,r)=>{const i=r?((e,t)=>{const n=e.indexOf(":"),r=e.slice(0,n+1);if(Object.prototype.hasOwnProperty.call(t,r))return e;if("://"===e.substr(n,3))return e;const i=e.indexOf("@");return i>-1?i>n?`git+ssh://${e}`:e:`${e.slice(0,n+1)}//${e.slice(n+1)}`})(n,r):n;return t(i)||t((t=>{const n=e(t,"@","#"),r=e(t,":","#");return r>n&&(t=t.slice(0,r)+"/"+t.slice(r+1)),-1===e(t,":","#")&&-1===t.indexOf("//")&&(t=`git+ssh://${t}`),t})(i))}}function We(){if(Be)return Ue;Be=1;const e=Ve();return Ue=(t,n,{gitHosts:r,protocols:i})=>{if(!t)return;const o=(e=>{const t=e.indexOf("#"),n=e.indexOf("/"),r=e.indexOf("/",n+1),i=e.indexOf(":"),o=/\s/.exec(e),s=e.indexOf("@"),a=!o||t>-1&&o.index>t,c=-1===s||t>-1&&s>t,l=-1===i||t>-1&&i>t,u=-1===r||t>-1&&r>t,f=n>0,d=t>-1?"/"!==e[t-1]:!e.endsWith("/"),p=!e.startsWith(".");return a&&f&&d&&p&&c&&l&&u})(t)?`github:${t}`:t,s=e(o,i);if(!s)return;const a=r.byShortcut[s.protocol],c=r.byDomain[s.hostname.startsWith("www.")?s.hostname.slice(4):s.hostname],l=a||c;if(!l)return;const u=r[a||c];let f=null;i[s.protocol]?.auth&&(s.username||s.password)&&(f=`${s.username}${s.password?":"+s.password:""}`);let d=null,p=null,h=null,m=null;try{if(a){let e=s.pathname.startsWith("/")?s.pathname.slice(1):s.pathname;const t=e.indexOf("@");t>-1&&(e=e.slice(t+1));const n=e.lastIndexOf("/");n>-1?(p=decodeURIComponent(e.slice(0,n)),p||(p=null),h=decodeURIComponent(e.slice(n+1))):h=decodeURIComponent(e),h.endsWith(".git")&&(h=h.slice(0,-4)),s.hash&&(d=decodeURIComponent(s.hash.slice(1))),m="shortcut"}else{if(!u.protocols.includes(s.protocol))return;const e=u.extract(s);if(!e)return;p=e.user&&decodeURIComponent(e.user),h=decodeURIComponent(e.project),d=decodeURIComponent(e.committish),m=i[s.protocol]?.name||s.protocol.slice(0,-1)}}catch(e){if(e instanceof URIError)return;throw e}return[l,p,f,h,d,m,n]}}function Ze(){if(Ge)return Me;Ge=1;const{LRUCache:e}=qe(),t=function(){if(Te)return xe;Te=1;const e=(...e)=>e.every(e=>e)?e.join(""):"",t=e=>e?encodeURIComponent(e):"",n=e=>e.toLowerCase().replace(/^\W+/g,"").replace(/(?<!\W)\W+$/,"").replace(/\//g,"").replace(/\W+/g,"-"),r={sshtemplate:({domain:t,user:n,project:r,committish:i})=>`git@${t}:${n}/${r}.git${e("#",i)}`,sshurltemplate:({domain:t,user:n,project:r,committish:i})=>`git+ssh://git@${t}/${n}/${r}.git${e("#",i)}`,edittemplate:({domain:n,user:r,project:i,committish:o,editpath:s,path:a})=>`https://${n}/${r}/${i}${e("/",s,"/",t(o||"HEAD"),"/",a)}`,browsetemplate:({domain:n,user:r,project:i,committish:o,treepath:s})=>`https://${n}/${r}/${i}${e("/",s,"/",t(o))}`,browsetreetemplate:({domain:n,user:r,project:i,committish:o,treepath:s,path:a,fragment:c,hashformat:l})=>`https://${n}/${r}/${i}/${s}/${t(o||"HEAD")}/${a}${e("#",l(c||""))}`,browseblobtemplate:({domain:n,user:r,project:i,committish:o,blobpath:s,path:a,fragment:c,hashformat:l})=>`https://${n}/${r}/${i}/${s}/${t(o||"HEAD")}/${a}${e("#",l(c||""))}`,docstemplate:({domain:n,user:r,project:i,treepath:o,committish:s})=>`https://${n}/${r}/${i}${e("/",o,"/",t(s))}#readme`,httpstemplate:({auth:t,domain:n,user:r,project:i,committish:o})=>`git+https://${e(t,"@")}${n}/${r}/${i}.git${e("#",o)}`,filetemplate:({domain:e,user:n,project:r,committish:i,path:o})=>`https://${e}/${n}/${r}/raw/${t(i||"HEAD")}/${o}`,shortcuttemplate:({type:t,user:n,project:r,committish:i})=>`${t}:${n}/${r}${e("#",i)}`,pathtemplate:({user:t,project:n,committish:r})=>`${t}/${n}${e("#",r)}`,bugstemplate:({domain:e,user:t,project:n})=>`https://${e}/${t}/${n}/issues`,hashformat:n},i={};i.github={protocols:["git:","http:","git+ssh:","git+https:","ssh:","https:"],domain:"github.com",treepath:"tree",blobpath:"blob",editpath:"edit",filetemplate:({auth:n,user:r,project:i,committish:o,path:s})=>`https://${e(n,"@")}raw.githubusercontent.com/${r}/${i}/${t(o||"HEAD")}/${s}`,gittemplate:({auth:t,domain:n,user:r,project:i,committish:o})=>`git://${e(t,"@")}${n}/${r}/${i}.git${e("#",o)}`,tarballtemplate:({domain:e,user:n,project:r,committish:i})=>`https://codeload.${e}/${n}/${r}/tar.gz/${t(i||"HEAD")}`,extract:e=>{let[,t,n,r,i]=e.pathname.split("/",5);if((!r||"tree"===r)&&(r||(i=e.hash.slice(1)),n&&n.endsWith(".git")&&(n=n.slice(0,-4)),t&&n))return{user:t,project:n,committish:i}}},i.bitbucket={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"bitbucket.org",treepath:"src",blobpath:"src",editpath:"?mode=edit",edittemplate:({domain:n,user:r,project:i,committish:o,treepath:s,path:a,editpath:c})=>`https://${n}/${r}/${i}${e("/",s,"/",t(o||"HEAD"),"/",a,c)}`,tarballtemplate:({domain:e,user:n,project:r,committish:i})=>`https://${e}/${n}/${r}/get/${t(i||"HEAD")}.tar.gz`,extract:e=>{let[,t,n,r]=e.pathname.split("/",4);if(!["get"].includes(r)&&(n&&n.endsWith(".git")&&(n=n.slice(0,-4)),t&&n))return{user:t,project:n,committish:e.hash.slice(1)}}},i.gitlab={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"gitlab.com",treepath:"tree",blobpath:"tree",editpath:"-/edit",tarballtemplate:({domain:e,user:n,project:r,committish:i})=>`https://${e}/api/v4/projects/${t(n+"/"+r)}/repository/archive.tar.gz?sha=${t(i||"HEAD")}`,extract:e=>{const t=e.pathname.slice(1);if(t.includes("/-/")||t.includes("/archive.tar.gz"))return;const n=t.split("/");let r=n.pop();r.endsWith(".git")&&(r=r.slice(0,-4));const i=n.join("/");return i&&r?{user:i,project:r,committish:e.hash.slice(1)}:void 0}},i.gist={protocols:["git:","git+ssh:","git+https:","ssh:","https:"],domain:"gist.github.com",editpath:"edit",sshtemplate:({domain:t,project:n,committish:r})=>`git@${t}:${n}.git${e("#",r)}`,sshurltemplate:({domain:t,project:n,committish:r})=>`git+ssh://git@${t}/${n}.git${e("#",r)}`,edittemplate:({domain:n,user:r,project:i,committish:o,editpath:s})=>`https://${n}/${r}/${i}${e("/",t(o))}/${s}`,browsetemplate:({domain:n,project:r,committish:i})=>`https://${n}/${r}${e("/",t(i))}`,browsetreetemplate:({domain:n,project:r,committish:i,path:o,hashformat:s})=>`https://${n}/${r}${e("/",t(i))}${e("#",s(o))}`,browseblobtemplate:({domain:n,project:r,committish:i,path:o,hashformat:s})=>`https://${n}/${r}${e("/",t(i))}${e("#",s(o))}`,docstemplate:({domain:n,project:r,committish:i})=>`https://${n}/${r}${e("/",t(i))}`,httpstemplate:({domain:t,project:n,committish:r})=>`git+https://${t}/${n}.git${e("#",r)}`,filetemplate:({user:n,project:r,committish:i,path:o})=>`https://gist.githubusercontent.com/${n}/${r}/raw${e("/",t(i))}/${o}`,shortcuttemplate:({type:t,project:n,committish:r})=>`${t}:${n}${e("#",r)}`,pathtemplate:({project:t,committish:n})=>`${t}${e("#",n)}`,bugstemplate:({domain:e,project:t})=>`https://${e}/${t}`,gittemplate:({domain:t,project:n,committish:r})=>`git://${t}/${n}.git${e("#",r)}`,tarballtemplate:({project:e,committish:n})=>`https://codeload.github.com/gist/${e}/tar.gz/${t(n||"HEAD")}`,extract:e=>{let[,t,n,r]=e.pathname.split("/",4);if("raw"!==r){if(!n){if(!t)return;n=t,t=null}return n.endsWith(".git")&&(n=n.slice(0,-4)),{user:t,project:n,committish:e.hash.slice(1)}}},hashformat:function(e){return e&&"file-"+n(e)}},i.sourcehut={protocols:["git+ssh:","https:"],domain:"git.sr.ht",treepath:"tree",blobpath:"tree",filetemplate:({domain:e,user:n,project:r,committish:i,path:o})=>`https://${e}/${n}/${r}/blob/${t(i)||"HEAD"}/${o}`,httpstemplate:({domain:t,user:n,project:r,committish:i})=>`https://${t}/${n}/${r}${e("#",i)}`,tarballtemplate:({domain:e,user:n,project:r,committish:i})=>`https://${e}/${n}/${r}/archive/${t(i)||"HEAD"}.tar.gz`,bugstemplate:()=>null,extract:e=>{let[,t,n,r]=e.pathname.split("/",4);if(!["archive"].includes(r)&&(n&&n.endsWith(".git")&&(n=n.slice(0,-4)),t&&n))return{user:t,project:n,committish:e.hash.slice(1)}}};for(const[e,t]of Object.entries(i))i[e]=Object.assign({},r,t);return xe=i}(),n=We(),r=Ve(),i=new e({max:1e3});class o{constructor(e,t,n,r,i,s,a={}){Object.assign(this,o.#Q[e],{type:e,user:t,auth:n,project:r,committish:i,default:s,opts:a})}static#Q={byShortcut:{},byDomain:{}};static#ee={"git+ssh:":{name:"sshurl"},"ssh:":{name:"sshurl"},"git+https:":{name:"https",auth:!0},"git:":{auth:!0},"http:":{auth:!0},"https:":{auth:!0},"git+http:":{auth:!0}};static addHost(e,t){o.#Q[e]=t,o.#Q.byDomain[t.domain]=e,o.#Q.byShortcut[`${e}:`]=e,o.#ee[`${e}:`]={name:e}}static fromUrl(e,t){if("string"!=typeof e)return;const r=e+JSON.stringify(t||{});if(!i.has(r)){const s=n(e,t,{gitHosts:o.#Q,protocols:o.#ee});i.set(r,s?new o(...s):void 0)}return i.get(r)}static fromManifest(e,t={}){if(!e||"object"!=typeof e)return;const n=e.repository,r=n&&("string"==typeof n?n:"object"==typeof n&&"string"==typeof n.url?n.url:null);if(!r)throw new Error("no repository");const i=r&&o.fromUrl(r.replace(/^git\+/,""),t)||null;if(i)return i;const s=function(e){try{const{protocol:t,hostname:n,pathname:r}=new URL(e);if(!n)return null;return`${/(?:git\+)http:$/.test(t)?"http:":"https:"}//${n}${r.replace(/\.git$/,"")}`}catch{return null}}(r);return o.fromUrl(s,t)||s}static parseUrl(e){return r(e)}#te(e,t){if("function"!=typeof e)return null;const n={...this,...this.opts,...t};n.path||(n.path=""),n.path.startsWith("/")&&(n.path=n.path.slice(1)),n.noCommittish&&(n.committish=null);const r=e(n);return n.noGitPlus&&r.startsWith("git+")?r.slice(4):r}hash(){return this.committish?`#${this.committish}`:""}ssh(e){return this.#te(this.sshtemplate,e)}sshurl(e){return this.#te(this.sshurltemplate,e)}browse(e,...t){return"string"!=typeof e?this.#te(this.browsetemplate,e):"string"!=typeof t[0]?this.#te(this.browsetreetemplate,{...t[0],path:e}):this.#te(this.browsetreetemplate,{...t[1],fragment:t[0],path:e})}browseFile(e,...t){return"string"!=typeof t[0]?this.#te(this.browseblobtemplate,{...t[0],path:e}):this.#te(this.browseblobtemplate,{...t[1],fragment:t[0],path:e})}docs(e){return this.#te(this.docstemplate,e)}bugs(e){return this.#te(this.bugstemplate,e)}https(e){return this.#te(this.httpstemplate,e)}git(e){return this.#te(this.gittemplate,e)}shortcut(e){return this.#te(this.shortcuttemplate,e)}path(e){return this.#te(this.pathtemplate,e)}tarball(e){return this.#te(this.tarballtemplate,{...e,noCommittish:!1})}file(e,t){return this.#te(this.filetemplate,{...t,path:e})}edit(e,t){return this.#te(this.edittemplate,{...t,path:e})}getDefaultRepresentation(){return this.default}toString(e){return this.default&&"function"==typeof this[this.default]?this[this.default](e):this.sshurl(e)}}for(const[e,n]of Object.entries(t))o.addHost(e,n);return Me=o}var Ke,Ye,Xe={topLevel:{dependancies:"dependencies",dependecies:"dependencies",depdenencies:"dependencies",devEependencies:"devDependencies",depends:"dependencies","dev-dependencies":"devDependencies",devDependences:"devDependencies",devDepenencies:"devDependencies",devdependencies:"devDependencies",repostitory:"repository",repo:"repository",prefereGlobal:"preferGlobal",hompage:"homepage",hampage:"homepage",autohr:"author",autor:"author",contributers:"contributors",publicationConfig:"publishConfig",script:"scripts"},bugs:{web:"url",name:"url"},script:{server:"start",tests:"test"}};function Je(){if(Ye)return Ke;Ye=1;var{URL:e}=d,t=function(){if(le)return ce;le=1;const e=me();return ce=(t,n)=>{const r=e(t,n);return r?r.version:null},ce}(),n=function(){if(fe)return ue;fe=1;const e=me();return ue=(t,n)=>{const r=e(t.trim().replace(/^[=v]+/,""),n);return r?r.version:null},ue}(),r=$e(),i=Ze(),{isBuiltin:o}=h,s=["dependencies","devDependencies","optionalDependencies"],a=He?je:(He=1,je=function(e){if(!e)return;if("ERROR: No README data found!"===e)return;e=e.trim().split("\n");let t=0;for(;e[t]&&e[t].trim().match(/^(#|$)/);)t++;const n=e.length;let r=t+1;for(;r<n&&e[r].trim();)r++;return e.slice(t,r).join(" ").trim()}),c=Xe,l=e=>e.includes("@")&&e.indexOf("@")<e.lastIndexOf(".");function u(e,t){return e.author&&(e.author=t(e.author)),["maintainers","contributors"].forEach(function(n){Array.isArray(e[n])&&(e[n]=e[n].map(t))}),e}function f(e){if("string"==typeof e)return e;var t=e.name||"",n=e.url||e.web,r=n?" ("+n+")":"",i=e.email||e.mail;return t+(i?" <"+i+">":"")+r}function p(e){if("string"!=typeof e)return e;var t=e.match(/^([^(<]+)/),n=e.match(/\(([^()]+)\)/),r=e.match(/<([^<>]+)>/),i={};return t&&t[0].trim()&&(i.name=t[0].trim()),r&&(i.email=r[1]),n&&(i.url=n[1]),i}return Ke={warn:function(){},fixRepositoryField:function(e){if(e.repositories&&(this.warn("repositories"),e.repository=e.repositories[0]),!e.repository)return this.warn("missingRepository");"string"==typeof e.repository&&(e.repository={type:"git",url:e.repository});var t=e.repository.url||"";if(t){var n=i.fromUrl(t);n&&(t=e.repository.url="shortcut"===n.getDefaultRepresentation()?n.https():n.toString())}t.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",t)},fixTypos:function(e){Object.keys(c.topLevel).forEach(function(t){Object.prototype.hasOwnProperty.call(e,t)&&this.warn("typo",t,c.topLevel[t])},this)},fixScriptsField:function(e){if(e.scripts)return"object"!=typeof e.scripts?(this.warn("nonObjectScripts"),void delete e.scripts):void Object.keys(e.scripts).forEach(function(t){"string"!=typeof e.scripts[t]?(this.warn("nonStringScript"),delete e.scripts[t]):c.script[t]&&!e.scripts[c.script[t]]&&this.warn("typo",t,c.script[t],"scripts")},this)},fixFilesField:function(e){var t=e.files;t&&!Array.isArray(t)?(this.warn("nonArrayFiles"),delete e.files):e.files&&(e.files=e.files.filter(function(e){return!(!e||"string"!=typeof e)||(this.warn("invalidFilename",e),!1)},this))},fixBinField:function(e){if(e.bin&&"string"==typeof e.bin){var t,n={};(t=e.name.match(/^@[^/]+[/](.*)$/))?n[t[1]]=e.bin:n[e.name]=e.bin,e.bin=n}},fixManField:function(e){e.man&&"string"==typeof e.man&&(e.man=[e.man])},fixBundleDependenciesField:function(e){var t="bundledDependencies",n="bundleDependencies";e[t]&&!e[n]&&(e[n]=e[t],delete e[t]),e[n]&&!Array.isArray(e[n])?(this.warn("nonArrayBundleDependencies"),delete e[n]):e[n]&&(e[n]=e[n].filter(function(t){return t&&"string"==typeof t?(e.dependencies||(e.dependencies={}),Object.prototype.hasOwnProperty.call(e.dependencies,t)||(this.warn("nonDependencyBundleDependency",t),e.dependencies[t]="*"),!0):(this.warn("nonStringBundleDependency",t),!1)},this))},fixDependencies:function(e){!function(e,t){s.forEach(function(n){e[n]&&(e[n]=function(e,t,n){if(!e)return{};"string"==typeof e&&(e=e.trim().split(/[\n\r\s\t ,]+/));if(!Array.isArray(e))return e;n("deprecatedArrayDependencies",t);var r={};return e.filter(function(e){return"string"==typeof e}).forEach(function(e){var t=(e=e.trim().split(/(:?[@\s><=])/)).shift(),n=e.join("");n=(n=n.trim()).replace(/^@/,""),r[t]=n}),r}(e[n],n,t))})}(e,this.warn),function(e){var t=e.optionalDependencies;if(!t)return;var n=e.dependencies||{};Object.keys(t).forEach(function(e){n[e]=t[e]}),e.dependencies=n}(e,this.warn),this.fixBundleDependenciesField(e),["dependencies","devDependencies"].forEach(function(t){if(t in e)return e[t]&&"object"==typeof e[t]?void Object.keys(e[t]).forEach(function(n){var r=e[t][n];"string"!=typeof r&&(this.warn("nonStringDependency",n,JSON.stringify(r)),delete e[t][n]);var o=i.fromUrl(e[t][n]);o&&(e[t][n]=o.toString())},this):(this.warn("nonObjectDependencies",t),void delete e[t])},this)},fixModulesField:function(e){e.modules&&(this.warn("deprecatedModules"),delete e.modules)},fixKeywordsField:function(e){"string"==typeof e.keywords&&(e.keywords=e.keywords.split(/,\s+/)),e.keywords&&!Array.isArray(e.keywords)?(delete e.keywords,this.warn("nonArrayKeywords")):e.keywords&&(e.keywords=e.keywords.filter(function(e){return!("string"!=typeof e||!e)||(this.warn("nonStringKeyword"),!1)},this))},fixVersionField:function(e,r){var i=!r;if(!e.version)return e.version="",!0;if(!t(e.version,i))throw new Error('Invalid version: "'+e.version+'"');return e.version=n(e.version,i),!0},fixPeople:function(e){u(e,f),u(e,p)},fixNameField:function(e,t){"boolean"==typeof t?t={strict:t}:void 0===t&&(t={});var n=t.strict;if(e.name||n){if("string"!=typeof e.name)throw new Error("name field must be a string.");n||(e.name=e.name.trim()),function(e,t,n){if("."===e.charAt(0)||!function(e){if("@"!==e.charAt(0))return!1;var t=e.slice(1).split("/");if(2!==t.length)return!1;return t[0]&&t[1]&&t[0]===encodeURIComponent(t[0])&&t[1]===encodeURIComponent(t[1])}(e)&&(r=e,r.match(/[/@\s+%:]/)||r!==encodeURIComponent(r))||t&&!n&&e!==e.toLowerCase()||"node_modules"===e.toLowerCase()||"favicon.ico"===e.toLowerCase())throw new Error("Invalid name: "+JSON.stringify(e));var r}(e.name,n,t.allowLegacyCase),o(e.name)&&this.warn("conflictingName",e.name)}else e.name=""},fixDescriptionField:function(e){e.description&&"string"!=typeof e.description&&(this.warn("nonStringDescription"),delete e.description),e.readme&&!e.description&&(e.description=a(e.readme)),void 0===e.description&&delete e.description,e.description||this.warn("missingDescription")},fixReadmeField:function(e){e.readme||(this.warn("missingReadme"),e.readme="ERROR: No README data found!")},fixBugsField:function(t){if(!t.bugs&&t.repository&&t.repository.url){var n=i.fromUrl(t.repository.url);n&&n.bugs()&&(t.bugs={url:n.bugs()})}else if(t.bugs){if("string"==typeof t.bugs)l(t.bugs)?t.bugs={email:t.bugs}:e.canParse(t.bugs)?t.bugs={url:t.bugs}:this.warn("nonEmailUrlBugsString");else{!function(e,t){if(!e)return;Object.keys(e).forEach(function(n){c.bugs[n]&&(t("typo",n,c.bugs[n],"bugs"),e[c.bugs[n]]=e[n],delete e[n])})}(t.bugs,this.warn);var r=t.bugs;t.bugs={},r.url&&(e.canParse(r.url)?t.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&("string"==typeof r.email&&l(r.email)?t.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}t.bugs.email||t.bugs.url||(delete t.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(t){if(!t.homepage&&t.repository&&t.repository.url){var n=i.fromUrl(t.repository.url);n&&n.docs()&&(t.homepage=n.docs())}if(t.homepage)return"string"!=typeof t.homepage?(this.warn("nonUrlHomepage"),delete t.homepage):void(e.canParse(t.homepage)||(t.homepage="http://"+t.homepage))},fixLicenseField:function(e){const t=e.license||e.licence;return t?"string"!=typeof t||t.length<1||""===t.trim()?this.warn("invalidLicense"):r(t).validForNewPackages?void 0:this.warn("invalidLicense"):this.warn("missingLicense")}},Ke}var Qe,et,tt,nt,rt={repositories:"'repositories' (plural) Not supported. Please pick one as the 'repository' field",missingRepository:"No repository field.",brokenGitUrl:"Probably broken git url: %s",nonObjectScripts:"scripts must be an object",nonStringScript:"script values must be string commands",nonArrayFiles:"Invalid 'files' member",invalidFilename:"Invalid filename in 'files' list: %s",nonArrayBundleDependencies:"Invalid 'bundleDependencies' list. Must be array of package names",nonStringBundleDependency:"Invalid bundleDependencies member: %s",nonDependencyBundleDependency:"Non-dependency in bundleDependencies: %s",nonObjectDependencies:"%s field must be an object",nonStringDependency:"Invalid dependency: %s %s",deprecatedArrayDependencies:"specifying %s as array is deprecated",deprecatedModules:"modules field is deprecated",nonArrayKeywords:"keywords should be an array of strings",nonStringKeyword:"keywords should be an array of strings",conflictingName:"%s is also the name of a node core module.",nonStringDescription:"'description' field should be a string",missingDescription:"No description",missingReadme:"No README data",missingLicense:"No license field.",nonEmailUrlBugsString:"Bug string field must be url, email, or {email,url}",nonUrlBugsUrlField:"bugs.url field must be a string url. Deleted.",nonEmailBugsEmailField:"bugs.email field must be a string email. Deleted.",emptyNormalizedBugs:"Normalized value of bugs field is an empty object. Deleted.",nonUrlHomepage:"homepage field must be a string url. Deleted.",invalidLicense:"license should be a valid SPDX license expression",typo:"%s should probably be %s."};function it(){if(et)return Qe;et=1;var e=m,t=rt;function n(n,r,i){return i&&(n=i+"['"+n+"']",r=i+"['"+r+"']"),e.format(t.typo,n,r)}return Qe=function(){var r=Array.prototype.slice.call(arguments,0),i=r.shift();if("typo"===i)return n.apply(null,r);var o=t[i]?t[i]:i+": '%s'";return r.unshift(o),e.format.apply(null,r)},Qe}var ot=function(){if(nt)return tt;nt=1,tt=r;var e=Je();r.fixer=e;var t=it(),n=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"].map(function(e){return i(e)+"Field"});function r(r,o,s){!0===o&&(o=null,s=!0),s||(s=!1),o&&!r.private||(o=function(){}),r.scripts&&"node-gyp rebuild"===r.scripts.install&&!r.scripts.preinstall&&(r.gypfile=!0),e.warn=function(){o(t.apply(null,arguments))},n.forEach(function(t){e["fix"+i(t)](r,s)}),r._id=r.name+"@"+r.version}function i(e){return e.charAt(0).toUpperCase()+e.slice(1)}return n=n.concat(["dependencies","people","typos"]),tt}(),st=V(ot);const at=(e,t)=>{try{return v(e,y.F_OK),!0}catch(e){return!1}},ct=["index.ts","index.tsx","main.ts","main.tsx"],lt=(e,t,n)=>{const r=a(e??process.cwd(),"src"),i=ct,o=i.map(e=>a(r,e)).find(e=>at(e));if(!o)throw new Error(`Unable to resolve entry point, ensure ${i.join(", ")} exists in ${r}`);return o},ut=(e,t)=>_(e,t,{arrayMerge:(e,t)=>{const n=t[0]??e[0];return"object"==typeof n&&"match"in n&&"middleware"in n?((e,t,n)=>{const r=n.reduce((t,n)=>Object.assign(t,{[String(n[e])]:n}),{}),i={...t.reduce((t,n)=>Object.assign(t,{[String(n[e])]:n}),{}),...r};return Object.values(i)})("match",e,t):[...new Set([...e,...t])]}}),ft=/import\s*{\s*[^}]*\b(route|index|layout|prefix)\b[^}]*}\s*from\s*['"]@equinor\/fusion-framework-react-router(?:\/routes)?['"]/g,dt=/\b(route|index|layout|prefix)\s*\(/g,pt=/import\.meta\.resolve\s*\(\s*['"]([^'"]+)['"]\s*\)/g,ht=/\b(index|layout)\s*\(\s*['"]([^'"]+)['"]\s*\)/g,mt=/\blayout\s*\(\s*import\.meta\.resolve\s*\(\s*['"]([^'"]+)['"]\s*\)\s*,\s*[^)]+\s*\)/g,gt=/\blayout\s*\(\s*['"]([^'"]+)['"]\s*,\s*[^)]+\s*\)/g,vt=/\broute\s*\(\s*[^,]+,\s*['"]([^'"]+)['"]\s*\)/g,yt=/\bindex\s*\(\s*['"]([^'"]+)['"]\s*\)/g,Et=/\blayout\s*\(\s*['"]([^'"]+)['"]\s*\)\s*(?!,)/g,bt=/\blayout\s*\(\s*['"]([^'"]+)['"]\s*,\s*/g,wt=/\broute\s*\(\s*([^,]+)\s*,\s*['"]([^'"]+)['"]\s*\)/g,Lt=/\bprefix\s*\(\s*([^,]+)\s*,\s*\[/g,It=/import\s*{\s*[^}]*\b(route|index|layout|prefix)\b[^}]*}\s*from\s*['"]@equinor\/fusion-framework-react-router(?:\/routes)?['"];?\s*/g,St=/export\s+const\s+\w+\s*=\s*/g,Ct=/^import\s+.*?;$/gm,_t=/export\s+default|export\s*{\s*default\s*}/,Dt=e=>new RegExp(`\\bexport\\s+(const|function|class|async\\s+function)\\s+${e}\\b`),Pt=e=>new RegExp(`export\\s*{\\s*[^}]*${e}[^}]*}\\s*from`);function Nt(e,t,n){const r=new Set;try{const i=function(e,t){const n=o.resolve(t,e);if(g.existsSync(n))return n;const r=[".tsx",".ts",".jsx",".js"];for(const e of r){const t=n+e;if(g.existsSync(t))return t}return null}(e,o.dirname(t));if(!i)return n&&console.warn(`[fusion:react-router] File not found: ${e} (resolved from: ${t})`),r;const s=g.readFileSync(i,"utf-8");s.match(_t)&&r.add("default");const a=["clientLoader","action","handle","ErrorElement","HydrateFallback","shouldRevalidate"];for(const e of a)(s.match(Dt(e))||s.match(Pt(e)))&&r.add(e)}catch(t){n&&console.warn(`[fusion:react-router] Error reading file ${e}:`,t)}return r}function Ot(e){const t=[];return e.availableExports.has("default")&&t.push(`Component: ${e.component}`),e.clientLoader&&t.push(`loader: ${e.clientLoader}`),e.action&&t.push(`action: ${e.action}`),e.handle&&t.push(`handle: ${e.handle}`),e.errorElement&&t.push(`errorElement: ${e.errorElement}`),e.hydrateFallback&&t.push(`HydrateFallback: ${e.hydrateFallback}`),e.shouldRevalidate&&t.push(`shouldRevalidate: ${e.shouldRevalidate}`),t.join(",\n ")}function At(e,t,n,r){let i=1,o=t+1;for(;o<e.length&&i>0;){if(e[o]===n&&i++,e[o]===r&&i--,0===i)return o;o++}return null}const $t=(e={})=>{const{debug:t=!1}=e;let n;return{name:"fusion:react-router",config(e){n=e.root??process.cwd(),t&&console.log("[fusion:react-router] Project root:",n)},transform(e,r){try{if(!n||!r.startsWith(n)||r.includes("node_modules"))return null;if(!e.match(ft))return null;if(!e.match(dt))return t&&console.log("[fusion:react-router] File has DSL imports but no route calls, skipping transformation"),null;t&&console.log("[fusion:react-router] Transforming file:",r.replace(n,""));const i=function(e){const t=new Set,n=e=>{var n;e&&((n=e).startsWith("./")||n.startsWith("../"))&&t.add(e)};let r=pt.exec(e);for(;null!==r;)n(r[1]),r=pt.exec(e);for(r=ht.exec(e);null!==r;)n(r[2]),r=ht.exec(e);for(r=mt.exec(e);null!==r;)n(r[1]),r=mt.exec(e);for(r=gt.exec(e);null!==r;)n(r[1]),r=gt.exec(e);for(r=vt.exec(e);null!==r;)n(r[1]),r=vt.exec(e);return t}(e);if(0===i.size)return null;const o=new Map;i.forEach(e=>{const n=function(e){const t=e.replace(/\.[^./]+$/,"").split("/").filter(e=>e&&"."!==e&&".."!==e),n=t[t.length-1]??"index";return("index"===n.toLowerCase()&&t.length>1?t.slice(0,-1):[n]).map(e=>e.replace(/[[\]]/g,"").replace(/[-_.](.)/g,(e,t)=>t.toUpperCase()).replace(/^(.)/,e=>e.toUpperCase())).join("")}(e),i=Nt(e,r,t);o.set(e,{component:n,clientLoader:i.has("clientLoader")?`clientLoader${n}`:void 0,action:i.has("action")?`action${n}`:void 0,handle:i.has("handle")?`handle${n}`:void 0,errorElement:i.has("ErrorElement")?`ErrorElement${n}`:void 0,hydrateFallback:i.has("HydrateFallback")?`HydrateFallback${n}`:void 0,shouldRevalidate:i.has("shouldRevalidate")?`shouldRevalidate${n}`:void 0,availableExports:i})});const s=function(e,t){const n=[];return t&&n.push("import React from 'react';","import { useLoaderData, useActionData, useRouteError, useRouterContext, routerContext } from '@equinor/fusion-framework-react-router';"),e.forEach((e,t)=>{const r=[];e.availableExports.has("default")&&r.push(`default as ${e.component}`),e.clientLoader&&r.push(`clientLoader as ${e.clientLoader}`),e.action&&r.push(`action as ${e.action}`),e.handle&&r.push(`handle as ${e.handle}`),e.errorElement&&r.push(`ErrorElement as ${e.errorElement}`),e.hydrateFallback&&r.push(`HydrateFallback as ${e.hydrateFallback}`),e.shouldRevalidate&&r.push(`shouldRevalidate as ${e.shouldRevalidate}`),r.length>0&&n.push(`import {\n ${r.join(",\n ")}\n} from '${t}';`)}),n}(o,i.size>0);let a=e;return a=a.replace(pt,'"$1"'),a=a.replace(yt,(e,t)=>{const n=o.get(t);if(!n)return e;return`{\n index: true,\n ${Ot(n)}\n }`}),a=a.replace(Et,(e,t)=>{const n=o.get(t);if(!n)return e;return`{\n ${Ot(n)}\n }`}),a=function(e,t,n,r,i){let o=e,s=!0;for(;s;){s=!1;const e=Array.from(o.matchAll(t));for(const t of e){const e=t.index??-1;if(e<0)continue;const a=t[1],c=e+t[0].length,l=o.indexOf("(",e);if(-1===l)continue;const u=At(o,l,"(",")");if(null===u)continue;const f=o.slice(c,u).trim();if(n.test(f))continue;const d=r(a,f,i.get(a));if(null!==d){const t=o.slice(0,e),n=o.slice(u+1);o=t+d+n,s=!0;break}}}return o}(a,bt,/\blayout\s*\(/,(e,t,n)=>{if(!n)return null;return`{\n ${Ot(n)},\n children: ${t}\n }`},o),a=a.replace(wt,(e,t,n)=>{const r=o.get(n);if(!r)return e;return`{\n path: ${t},\n ${Ot(r)}\n }`}),a=function(e){let t=e,n=!0;for(;n;){n=!1;let e=Lt.exec(t);for(;null!==e;){const r=e.index,i=e[1],o=e.index+e[0].length-1,s=At(t,o,"[","]");if(null===s){e=Lt.exec(t);continue}const a=t.slice(o+1,s);if(/\bprefix\s*\(/.test(a)){e=Lt.exec(t);continue}const c=t.indexOf(")",s);if(-1===c){e=Lt.exec(t);continue}const l=t.slice(0,r),u=t.slice(c+1);t=`${l}{\n path: ${i},\n children: [${a}]\n }${u}`,n=!0;break}}return t}(a),a=a.replace(It,""),a=function(e){let t=e,n=St.exec(t);for(;null!==n;){const e=n.index+n[0].length;let r=e;for(;r<t.length&&/\s/.test(t[r]);)r++;if("{"===t[r]){const i=At(t,r,"{","}");if(null!==i){const o=t.slice(r,i+1);if(o.includes("Component:")&&!t.slice(e,r).trim().startsWith("[")){const r=t.slice(0,e),s=t.slice(i+1);t=`${r}[${o}]${s}`,St.lastIndex=0,n=St.exec(t);continue}}}n=St.exec(t)}return t}(a),a=function(e,t){const n=e.match(Ct);if(n&&n.length>0){const r=n[n.length-1],i=e.lastIndexOf(r)+r.length;return e.slice(0,i)+"\n"+t.join("\n")+"\n"+e.slice(i)}return`${t.join("\n")}\n${e}`}(a,s),a}catch(t){return console.error("[fusion:react-router] Error during transformation:",t),e}}}},Rt=async(n,r)=>{const{packageJson:o,root:a}=r,{config:u}=await e(n)??{},f=o.main??o.module??"./dist/bundle.js",d=lt(a);if("build"===n.command){if(s(f)===a)throw new Error("outDir cannot be root, please specify package.main or package.module in package.json");if("src"===s(f))throw new Error("outDir cannot be src, please specify package.main or package.module in package.json");if(s(f)===process.cwd())throw new Error("outDir cannot be the current working directory, please specify package.main or package.module in package.json")}return t({root:a,plugins:[i(),$t({debug:!0}),D({extensions:[".md"]})],define:{"process.env.NODE_ENV":JSON.stringify(n.mode),"process.env.NODE_DEBUG":"production"!==n.mode,"process.env.FUSION_LOG_LEVEL":"production"===n.mode?1:3},build:{outDir:s(f),lib:{entry:d,fileName:c(f,l(f)),formats:["es"]},emptyOutDir:!0}},u??{})};function xt(e,t){P("object"==typeof e,new Error(t))}const Tt=e=>{if(e.repository)return"string"==typeof e.repository?e.repository:e.repository.url},kt=()=>{try{return N("git remote get-url origin").toString().trim().replace("git@github.com:","https://github.com/").replace(/\.git$/,"")}catch(e){return}},Ft=(e="HEAD")=>{try{return N(`git rev-parse ${e}`).toString().trim()}catch(e){return}},Ut=()=>{try{return N("git branch --show-current").toString().trim()||void 0}catch{return}},Bt="15.3.1",Mt=e=>{if(e?.startsWith("refs/heads/"))return e.slice(11)||void 0},Gt=()=>{const e={cliVersion:Bt,source:"local",reason:"manual"};if("true"===process.env.GITHUB_ACTIONS){const t=(()=>{const e=process.env.GITHUB_EVENT_NAME||"unknown",t=process.env.GITHUB_ACTOR||"unknown",n=process.env.GITHUB_RUN_ID||"unknown",r=process.env.GITHUB_REPOSITORY||"unknown",i=process.env.GITHUB_WORKFLOW||"unknown",o=process.env.GITHUB_SERVER_URL||"https://github.com";let s="unknown";"unknown"!==r&&"unknown"!==n&&(s=`${o.replace(/\/$/,"")}/${r}/actions/runs/${n}`);const a={eventName:e,actor:t,runId:n,runUrl:s,workflow:i};if(process.env.GITHUB_EVENT_PATH)try{const e=E(process.env.GITHUB_EVENT_PATH,"utf8");Object.assign(a,JSON.parse(e))}catch{console.error("Failed to parse GitHub event payload")}return a})(),n={...e,source:"github",reason:t.eventName,workflow:t.workflow,runId:t.runId,runUrl:t.runUrl,commitId:t.head_commit?.id,repository:t.repository?.name,repository_homepage:t.repository?.homepage,repository_license:t.repository?.license?.name,repository_owner:t.repository?.owner?.login,repository_owner_avatar_url:t.repository?.owner?.avatar_url,actor:t.actor,sender_login:t.sender?.login,sender_avatar_url:t.sender?.avatar_url};return t.pull_request?{...n,branch:t.pull_request.head?.ref,commitId:t.pull_request.head?.sha,htmlUrl:t.pull_request.html_url}:t.release?{...n,tag:t.release.tag_name,htmlUrl:t.release.html_url}:{...n,branch:Mt(t.ref??process.env.GITHUB_REF)}}if(process.env.SYSTEM_TEAMPROJECT){const t=(()=>{const e=process.env.BUILD_BUILDID||"unknown",t=process.env.BUILD_DEFINITIONNAME||"unknown",n=process.env.BUILD_REPOSITORY_NAME||"unknown",r=process.env.SYSTEM_TEAMPROJECT||"unknown",i=process.env.SYSTEM_COLLECTIONURI||"unknown",o=process.env.BUILD_REQUESTEDFOR||"unknown",s=process.env.BUILD_SOURCEBRANCH||"unknown",a=process.env.BUILD_SOURCEVERSION||"unknown",c=process.env.BUILD_REASON||"unknown";let l="unknown";return"unknown"!==i&&"unknown"!==r&&"unknown"!==e&&(l=`${i.replace(/\/$/,"")}${r}/_build/results?buildId=${e}`),{runId:e,pipelineName:t,repository:n,project:r,orgUrl:i,actor:o,branch:s,commitId:a,runUrl:l,reason:c}})();return{...e,source:"azure_devops",reason:t.reason,repository:t.repository,runId:t.runId,runUrl:t.runUrl,actor:t.actor,branch:t.branch,commitId:t.commitId,workflow:t.pipelineName}}return{...e,branch:Ut()}},jt=["png","jpg","jpeg","gif","svg","ico","webp","mp4","webm","mp3","woff2","woff","eot","ttf","otf","pdf","md","txt"];const Ht=(e,t,n)=>{xt(t,"expected packageJson"),P(t.name,"expected [name] in packageJson"),P(t.version,"expected [version] in packageJson");const r=((e,t)=>"build"===e.command||e.isPreview?t.main||t.module||"dist/app-bundle.js":lt(e.root))(e,t),i=t.name.replace(/^@|\w.*\//gm,""),o=n?.snapshot?function(e,t){const n=O(e)?.version;if(!n)throw new Error(`Invalid semantic version: "${e}". Expected format: major.minor.patch`);const r=Math.floor(Date.now()/1e3);return`${n}-${"string"==typeof t?`${t}.${r}`:`snapshot.${r}`}`}(t.version,n.snapshot):t.version,s="build"===e.command?void 0:`/bundles/apps/${i}@${o}`,a=Tt(t)??kt(),c=jt.map(e=>`.${e}`);return{appKey:i,displayName:t.name,description:t.description||"",keywords:t.keywords,type:"standalone",build:{entryPoint:r,assetPath:s,githubRepo:a,version:o,timestamp:(new Date).toISOString(),commitSha:Ft(),annotations:Gt(),projectPage:t.homepage,allowedExtensions:c}}},zt=(e,t)=>_(e,t),qt=x.object({environment:x.record(x.string(),x.any()).describe("Key-value map of environment-specific variables for the application. Defaults to an empty object if not provided.").optional().default({}),endpoints:x.record(x.string(),x.object({url:x.string({message:"The endpoint URL. This field is required."}),scopes:x.array(x.string()).optional().default([]).describe("List of scopes required for accessing this endpoint. Defaults to an empty array.")})).describe("A mapping of endpoint names to their configuration objects. Each endpoint must specify a URL and may specify scopes.").optional()}).describe("The API application configuration schema, defining environment variables and endpoints for the application."),Vt=(e,t)=>r.blueBright(t?.relative?`./${u(t?.cwd??process.cwd(),e)}`:e),Wt=async(e,t,n)=>{const i=Ht(e,t.packageJson,{snapshot:n?.snapshot});try{n?.log?.start("loading application package...");const{manifest:t,path:r}=await(async(e,t)=>{const n=t?.file??[`app.manifest.${e.environment}`,"app.manifest","app.manifest.config"],r=await S(n,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async n=>{const r=t?.base??{};if("function"==typeof n.default){const t=await n.default(e,{base:r});return zt(r,t??{})}return zt(r,n.default??{})}}});return{manifest:r.config,path:r.path,extension:r.extension}})(e,{base:i,file:n?.manifestPath});if(!t.build)throw new Error(`Application manifest for ${t.appKey} does not contain build information, please check the manifest file.`);return"serve"===e.command&&(t.build.assetPath=`/bundles/apps/${t.appKey}/${t.build.version}`),n?.log?.succeed("generated manifest from",Vt(r,{relative:!0})),t}catch(e){if(e instanceof C){if(n?.manifestPath){const t=new Error(`Failed to load manifest file ${Vt(n.manifestPath)}, please check the path.`,{cause:e});throw n?.log?.fail(t.message),t}return n?.log?.succeed(r.dim("no local manifest config applied, using default generated from package")),i}throw n?.log?.fail(`failed to resolve application manifest ${n?.manifestPath?Vt(n?.manifestPath):""}`),e}};async function Zt(e){e?.start("resolve project package");try{const t=await(async e=>{const t=await f({...e,normalize:!1});if(!t)throw new Error("failed to find package.json");const n={...t.packageJson};return st(n),{packageJson:{...n,version:t.packageJson.version},path:t.path,root:s(t.path)}})();return e?.succeed("ðĶ",r.yellowBright([t.packageJson.name,t.packageJson.version].join("@"))),e?.info("ð ",r.blueBright(t.root)),t}catch(t){throw e?.fail("â ïļ","failed to resolve project package"),t}}const Kt=async e=>{const{log:t}=e??{},n=await Zt(t);t?.debug("package",n);const r={command:"build",mode:process.env.NODE_ENV??"production",root:n.root,...e?.env};t?.debug("env:",r);const i=await Wt(r,n,{log:t,manifestPath:e?.manifest,snapshot:e?.snapshot});return t?.debug("manifest:",i),{manifest:i,pkg:n,env:r}},Yt=async e=>{const{log:t,snapshot:i}=e??{};t?.log(r.bold("Starting to build application"));const{manifest:o,pkg:s,env:a}=await Kt({log:t,manifest:e?.manifest,snapshot:i});t?.start("loading vite config...");const c=await Rt(a,s);t?.succeed("vite config applied"),t?.debug("vite config:",c),t?.start("ðĪðŧ","building application..."),t?.startNativeConsoleCapture(),await n(c),t?.stopNativeConsoleCapture(),t?.succeed("build completed ð");return{pkg:s,manifest:o,outDir:c.build.outDir}};var Xt,Jt,Qt={exports:{}};function en(){return Jt?Xt:(Jt=1,Xt={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24})}var tn,nn,rn,on,sn,an,cn,ln,un={};function fn(){return tn||(tn=1,function(e){const t={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",DESCRIPTOR_NOT_EXIST:"No descriptor present",DESCRIPTOR_UNKNOWN:"Unknown descriptor format",DESCRIPTOR_FAULTY:"Descriptor data is malformed",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed {0}",FILE_IN_THE_WAY:"There is a file in the way: {0}",UNKNOWN_METHOD:"Invalid/unsupported compression method",AVAIL_DATA:"inflate::Available inflate data did not terminate",INVALID_DISTANCE:"inflate::Invalid literal/length or distance code in fixed or dynamic block",TO_MANY_CODES:"inflate::Dynamic block code description: too many length or distance codes",INVALID_REPEAT_LEN:"inflate::Dynamic block code description: repeat more than specified lengths",INVALID_REPEAT_FIRST:"inflate::Dynamic block code description: repeat lengths with no first length",INCOMPLETE_CODES:"inflate::Dynamic block code description: code lengths codes incomplete",INVALID_DYN_DISTANCE:"inflate::Dynamic block code description: invalid distance code lengths",INVALID_CODES_LEN:"inflate::Dynamic block code description: invalid literal/length code lengths",INVALID_STORE_BLOCK:"inflate::Stored block length did not match one's complement",INVALID_BLOCK_TYPE:"inflate::Invalid block type (type == 3)",CANT_EXTRACT_FILE:"Could not extract the file",CANT_OVERRIDE:"Target file already exists",DISK_ENTRY_TOO_LARGE:"Number of disk entries is too large",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:'File not found: "{0}"',NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found",INVALID_PASS_PARAM:"Incompatible password parameter",WRONG_PASSWORD:"Wrong Password",COMMENT_TOO_LONG:"Comment is too long",EXTRA_FIELD_PARSE_ERROR:"Extra field parsing error"};function n(e){return function(...t){return t.length&&(e=e.replace(/\{(\d)\}/g,(e,n)=>t[n]||"")),new Error("ADM-ZIP: "+e)}}for(const r of Object.keys(t))e[r]=n(t[r])}(un)),un}function dn(){return ln||(ln=1,Qt.exports=function(){if(rn)return nn;rn=1;const e=T,t=k,n=en(),r=fn(),i="object"==typeof process&&"win32"===process.platform,o=e=>"object"==typeof e&&null!==e,s=new Uint32Array(256).map((e,t)=>{for(let e=0;e<8;e++)1&t?t=3988292384^t>>>1:t>>>=1;return t>>>0});function a(n){this.sep=t.sep,this.fs=e,o(n)&&o(n.fs)&&"function"==typeof n.fs.statSync&&(this.fs=n.fs)}return nn=a,a.prototype.makeDir=function(e){const t=this;!function(e){let n=e.split(t.sep)[0];e.split(t.sep).forEach(function(e){if(e&&":"!==e.substr(-1,1)){var i;n+=t.sep+e;try{i=t.fs.statSync(n)}catch(e){if(!e.message||!e.message.startsWith("ENOENT"))throw e;t.fs.mkdirSync(n)}if(i&&i.isFile())throw r.FILE_IN_THE_WAY(`"${n}"`)}})}(e)},a.prototype.writeFileTo=function(e,n,r,i){const o=this;if(o.fs.existsSync(e)){if(!r)return!1;if(o.fs.statSync(e).isDirectory())return!1}var s,a=t.dirname(e);o.fs.existsSync(a)||o.makeDir(a);try{s=o.fs.openSync(e,"w",438)}catch(t){o.fs.chmodSync(e,438),s=o.fs.openSync(e,"w",438)}if(s)try{o.fs.writeSync(s,n,0,n.length,0)}finally{o.fs.closeSync(s)}return o.fs.chmodSync(e,i||438),!0},a.prototype.writeFileToAsync=function(e,n,r,i,o){"function"==typeof i&&(o=i,i=void 0);const s=this;s.fs.exists(e,function(a){if(a&&!r)return o(!1);s.fs.stat(e,function(r,c){if(a&&c&&c.isDirectory())return o(!1);var l=t.dirname(e);s.fs.exists(l,function(t){if(!t)try{s.makeDir(l)}catch(e){return o(!1)}const r=function(t){s.fs.write(t,n,0,n.length,0,function(n){s.fs.close(t,function(){if(n)return o(!1);s.fs.chmod(e,i||438,function(){o(!0)})})})};s.fs.open(e,"w",438,function(t,n){t?s.fs.chmod(e,438,function(){s.fs.open(e,"w",438,function(e,t){if(e||!t)return o(!1);r(t)})}):n?r(n):o(!1)})})})})},a.prototype.findFiles=function(e){const n=this;return function e(r,i,o,s){let a=[];return n.fs.readdirSync(r).forEach(function(c){const l=t.join(r,c),u=n.fs.statSync(l);if(a.push(t.normalize(l)+(u.isDirectory()?n.sep:"")),u.isDirectory()&&o){const t=n.fs.realpathSync(l);s.has(t)||(s.add(t),a=a.concat(e(l,i,o,s)))}}),a}(e,void 0,!0,new Set([n.fs.realpathSync(e)]))},a.prototype.findFilesAsync=function(e,n){const r=this,i=[];let o=!1;const s=function(e){o||(o=!0,n(e,e?void 0:i))},a=function(e,n,o){r.fs.readdir(e,function(s,c){if(s)return o(s);let l=c.length;if(!l)return o();c.forEach(function(s){const c=t.join(e,s);r.fs.stat(c,function(e,s){if(e)return o(e);s?(i.push(t.normalize(c)+(s.isDirectory()?r.sep:"")),s.isDirectory()?r.fs.realpath(c,function(e,t){if(e)return o(e);n.has(t)?--l||o():(n.add(t),a(c,n,function(e){if(e)return o(e);--l||o()}))}):--l||o()):--l||o()})})})};r.fs.realpath(e,function(t,n){if(t)return s(t);a(e,new Set([n]),s)})},a.prototype.getAttributes=function(){},a.prototype.setAttributes=function(){},a.crc32update=function(e,t){return s[255&(e^t)]^e>>>8},a.crc32=function(e){"string"==typeof e&&(e=Buffer.from(e,"utf8"));let t=e.length,n=-1;for(let r=0;r<t;)n=a.crc32update(n,e[r++]);return~n>>>0},a.methodToString=function(e){switch(e){case n.STORED:return"STORED ("+e+")";case n.DEFLATED:return"DEFLATED ("+e+")";default:return"UNSUPPORTED ("+e+")"}},a.canonical=function(e){if(!e)return"";const n=t.posix.normalize("/"+e.split("\\").join("/"));return t.join(".",n)},a.zipnamefix=function(e){if(!e)return"";const n=t.posix.normalize("/"+e.split("\\").join("/"));return t.posix.join(".",n)},a.findLast=function(e,t){if(!Array.isArray(e))throw new TypeError("arr is not array");for(let n=(e.length>>>0)-1;n>=0;n--)if(t(e[n],n,e))return e[n]},a.sanitize=function(e,n){e=t.resolve(t.normalize(e));for(var r=n.split("/"),i=0,o=r.length;i<o;i++){var s=t.normalize(t.join(e,r.slice(i,o).join(t.sep)));if(s===e||s.startsWith(e+t.sep))return s}return t.normalize(t.join(e,t.basename(n)))},a.toBuffer=function(e,t){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e):"string"==typeof e?t(e):Buffer.alloc(0)},a.readBigUInt64LE=function(e,t){const n=e.readUInt32LE(t);return 4294967296*e.readUInt32LE(t+4)+n},a.writeBigUInt64LE=function(e,t,n){const r=t>>>0,i=Math.floor(t/4294967296)>>>0;e.writeUInt32LE(r,n),e.writeUInt32LE(i,n+4)},a.fromDOS2Date=function(e){return new Date(1980+(e>>25&127),Math.max((e>>21&15)-1,0),Math.max(e>>16&31,1),e>>11&31,e>>5&63,(31&e)<<1)},a.fromDate2DOS=function(e){let t=0,n=0;return e.getFullYear()>1979&&(t=(e.getFullYear()-1980&127)<<9|e.getMonth()+1<<5|e.getDate(),n=e.getHours()<<11|e.getMinutes()<<5|e.getSeconds()>>1),t<<16|n},a.isWin=i,a.crcTable=s,nn}(),Qt.exports.Constants=en(),Qt.exports.Errors=fn(),Qt.exports.FileAttr=function(){if(sn)return on;sn=1;const e=k;return on=function(t,{fs:n}){var r=t||"",i={directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0},o=null;return r&&n.existsSync(r)?(o=n.statSync(r),i.directory=o.isDirectory(),i.mtime=o.mtime,i.atime=o.atime,i.executable=!!(73&o.mode),i.readonly=!(128&o.mode),i.hidden="."===e.basename(r)[0]):console.warn("Invalid path: "+r),{get directory(){return i.directory},get readOnly(){return i.readonly},get hidden(){return i.hidden},get mtime(){return i.mtime},get atime(){return i.atime},get executable(){return i.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:r,isDirectory:i.directory,isReadOnly:i.readonly,isHidden:i.hidden,isExecutable:i.executable,mTime:i.mtime,aTime:i.atime}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}},on}(),Qt.exports.decoder=cn?an:(cn=1,an={efs:!0,encode:e=>Buffer.from(e,"utf8"),decode:e=>e.toString("utf8")})),Qt.exports}var pn,hn,mn,gn,vn,yn={};function En(){if(hn)return pn;hn=1;var e=dn(),t=e.Constants;return pn=function(){var n=20,r=10,i=0,o=0,s=0,a=0,c=0,l=0,u=0,f=0,d=0,p=0,h=0,m=0,g=0;n|=e.isWin?2560:768,i|=t.FLG_EFS;const v={extraLen:0},y=e=>Math.max(0,e)>>>0;return s=e.fromDate2DOS(new Date),{get made(){return n},set made(e){n=e},get version(){return r},set version(e){r=e},get flags(){return i},set flags(e){i=e},get flags_efs(){return(i&t.FLG_EFS)>0},set flags_efs(e){e?i|=t.FLG_EFS:i&=~t.FLG_EFS},get flags_desc(){return(i&t.FLG_DESC)>0},set flags_desc(e){e?i|=t.FLG_DESC:i&=~t.FLG_DESC},get method(){return o},set method(e){switch(e){case t.STORED:this.version=10;break;case t.DEFLATED:default:this.version=20}o=e},get time(){return e.fromDOS2Date(this.timeval)},set time(t){t=new Date(t),this.timeval=e.fromDate2DOS(t)},get timeval(){return s},set timeval(e){s=y(e)},get timeHighByte(){return e=s>>>8,255&Math.max(0,e);var e},get crc(){return a},set crc(e){a=y(e)},get compressedSize(){return c},set compressedSize(e){c=y(e)},get size(){return l},set size(e){l=y(e)},get fileNameLength(){return u},set fileNameLength(e){u=e},get extraLength(){return f},set extraLength(e){f=e},get extraLocalLength(){return v.extraLen},set extraLocalLength(e){v.extraLen=e},get commentLength(){return d},set commentLength(e){d=e},get diskNumStart(){return p},set diskNumStart(e){p=y(e)},get inAttr(){return h},set inAttr(e){h=y(e)},get attr(){return m},set attr(e){m=y(e)},get fileAttr(){return(m||0)>>16&4095},get offset(){return g},set offset(e){g=y(e)},get encrypted(){return(i&t.FLG_ENC)===t.FLG_ENC},get centralHeaderSize(){return t.CENHDR+u+f+d},get realDataOffset(){return g+t.LOCHDR+v.fnameLen+v.extraLen},get localHeader(){return v},loadLocalHeaderFromBinary:function(n){var r=n.slice(g,g+t.LOCHDR);if(r.readUInt32LE(0)!==t.LOCSIG)throw e.Errors.INVALID_LOC();v.version=r.readUInt16LE(t.LOCVER),v.flags=r.readUInt16LE(t.LOCFLG),v.flags_desc=(v.flags&t.FLG_DESC)>0,v.method=r.readUInt16LE(t.LOCHOW),v.time=r.readUInt32LE(t.LOCTIM),v.crc=r.readUInt32LE(t.LOCCRC),v.compressedSize=r.readUInt32LE(t.LOCSIZ),v.size=r.readUInt32LE(t.LOCLEN),v.fnameLen=r.readUInt16LE(t.LOCNAM),v.extraLen=r.readUInt16LE(t.LOCEXT);const i=g+t.LOCHDR+v.fnameLen,o=i+v.extraLen;return n.slice(i,o)},loadFromBinary:function(v){if(v.length!==t.CENHDR||v.readUInt32LE(0)!==t.CENSIG)throw e.Errors.INVALID_CEN();n=v.readUInt16LE(t.CENVEM),r=v.readUInt16LE(t.CENVER),i=v.readUInt16LE(t.CENFLG),o=v.readUInt16LE(t.CENHOW),s=v.readUInt32LE(t.CENTIM),a=v.readUInt32LE(t.CENCRC),c=v.readUInt32LE(t.CENSIZ),l=v.readUInt32LE(t.CENLEN),u=v.readUInt16LE(t.CENNAM),f=v.readUInt16LE(t.CENEXT),d=v.readUInt16LE(t.CENCOM),p=v.readUInt16LE(t.CENDSK),h=v.readUInt16LE(t.CENATT),m=v.readUInt32LE(t.CENATX),g=v.readUInt32LE(t.CENOFF)},localHeaderToBinary:function(){var e=Buffer.alloc(t.LOCHDR);return e.writeUInt32LE(t.LOCSIG,0),e.writeUInt16LE(r,t.LOCVER),e.writeUInt16LE(i&~t.FLG_DESC,t.LOCFLG),e.writeUInt16LE(o,t.LOCHOW),e.writeUInt32LE(s,t.LOCTIM),e.writeUInt32LE(a,t.LOCCRC),e.writeUInt32LE(c,t.LOCSIZ),e.writeUInt32LE(l,t.LOCLEN),e.writeUInt16LE(u,t.LOCNAM),e.writeUInt16LE(v.extraLen,t.LOCEXT),e},centralHeaderToBinary:function(){var e=Buffer.alloc(t.CENHDR+u+f+d);return e.writeUInt32LE(t.CENSIG,0),e.writeUInt16LE(n,t.CENVEM),e.writeUInt16LE(r,t.CENVER),e.writeUInt16LE(i&~t.FLG_DESC,t.CENFLG),e.writeUInt16LE(o,t.CENHOW),e.writeUInt32LE(s,t.CENTIM),e.writeUInt32LE(a,t.CENCRC),e.writeUInt32LE(c,t.CENSIZ),e.writeUInt32LE(l,t.CENLEN),e.writeUInt16LE(u,t.CENNAM),e.writeUInt16LE(f,t.CENEXT),e.writeUInt16LE(d,t.CENCOM),e.writeUInt16LE(p,t.CENDSK),e.writeUInt16LE(h,t.CENATT),e.writeUInt32LE(m,t.CENATX),e.writeUInt32LE(g,t.CENOFF),e},toJSON:function(){const s=function(e){return e+" bytes"};return{made:n,version:r,flags:i,method:e.methodToString(o),time:this.time,crc:"0x"+a.toString(16).toUpperCase(),compressedSize:s(c),size:s(l),fileNameLength:s(u),extraLength:s(f),commentLength:s(d),diskNumStart:p,inAttr:h,attr:m,offset:g,centralHeaderSize:s(t.CENHDR+u+f+d)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}}function bn(){return vn||(vn=1,yn.EntryHeader=En(),yn.MainHeader=function(){if(gn)return mn;gn=1;var e=dn(),t=e.Constants;return mn=function(){var n=0,r=0,i=0,o=0,s=0;const a=()=>n>t.EF_ZIP64_OR_16||r>t.EF_ZIP64_OR_16||i>t.EF_ZIP64_OR_32||o>t.EF_ZIP64_OR_32;return{get diskEntries(){return n},set diskEntries(e){n=r=e},get totalEntries(){return r},set totalEntries(e){r=n=e},get size(){return i},set size(e){i=e},get offset(){return o},set offset(e){o=e},get commentLength(){return s},set commentLength(e){s=e},get mainHeaderSize(){return(a()?t.ZIP64HDR+t.END64HDR:0)+t.ENDHDR+s},loadFromBinary:function(a){if((a.length!==t.ENDHDR||a.readUInt32LE(0)!==t.ENDSIG)&&(a.length<t.ZIP64HDR||a.readUInt32LE(0)!==t.ZIP64SIG))throw e.Errors.INVALID_END();a.readUInt32LE(0)===t.ENDSIG?(n=a.readUInt16LE(t.ENDSUB),r=a.readUInt16LE(t.ENDTOT),i=a.readUInt32LE(t.ENDSIZ),o=a.readUInt32LE(t.ENDOFF),s=a.readUInt16LE(t.ENDCOM)):(n=e.readBigUInt64LE(a,t.ZIP64SUB),r=e.readBigUInt64LE(a,t.ZIP64TOT),i=e.readBigUInt64LE(a,t.ZIP64SIZB),o=e.readBigUInt64LE(a,t.ZIP64OFF),s=0)},toBinary:function(){var c;if(!a())return(c=Buffer.alloc(t.ENDHDR+s)).writeUInt32LE(t.ENDSIG,0),c.writeUInt32LE(0,4),c.writeUInt16LE(n,t.ENDSUB),c.writeUInt16LE(r,t.ENDTOT),c.writeUInt32LE(i,t.ENDSIZ),c.writeUInt32LE(o,t.ENDOFF),c.writeUInt16LE(s,t.ENDCOM),c.fill(" ",t.ENDHDR),c;let l=0;(c=Buffer.alloc(this.mainHeaderSize)).writeUInt32LE(t.ZIP64SIG,l),e.writeBigUInt64LE(c,t.ZIP64HDR-t.ZIP64LEAD,l+t.ZIP64SIZE),c.writeUInt16LE(45,l+t.ZIP64VEM),c.writeUInt16LE(45,l+t.ZIP64VER),c.writeUInt32LE(0,l+t.ZIP64DSK),c.writeUInt32LE(0,l+t.ZIP64DSKDIR),e.writeBigUInt64LE(c,n,l+t.ZIP64SUB),e.writeBigUInt64LE(c,r,l+t.ZIP64TOT),e.writeBigUInt64LE(c,i,l+t.ZIP64SIZB),e.writeBigUInt64LE(c,o,l+t.ZIP64OFF);const u=o+i;return l+=t.ZIP64HDR,c.writeUInt32LE(t.END64SIG,l),c.writeUInt32LE(0,l+t.END64START),e.writeBigUInt64LE(c,u,l+t.END64OFF),c.writeUInt32LE(1,l+t.END64NUMDISKS),l+=t.END64HDR,c.writeUInt32LE(t.ENDSIG,l),c.writeUInt32LE(0,l+4),c.writeUInt16LE(Math.min(n,t.EF_ZIP64_OR_16),l+t.ENDSUB),c.writeUInt16LE(Math.min(r,t.EF_ZIP64_OR_16),l+t.ENDTOT),c.writeUInt32LE(Math.min(i,t.EF_ZIP64_OR_32),l+t.ENDSIZ),c.writeUInt32LE(Math.min(o,t.EF_ZIP64_OR_32),l+t.ENDOFF),c.writeUInt16LE(s,l+t.ENDCOM),c.fill(" ",l+t.ENDHDR),c},toJSON:function(){return{diskEntries:n,totalEntries:r,size:i+" bytes",offset:function(e,t){let n=e.toString(16).toUpperCase();for(;n.length<t;)n="0"+n;return"0x"+n}(o,4),commentLength:s}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}}()),yn}var wn,Ln,In,Sn,Cn,_n,Dn,Pn,Nn,On,An,$n,Rn,xn={};function Tn(){if(_n)return Cn;_n=1;const{randomFillSync:e}=U,t=fn(),n=new Uint32Array(256).map((e,t)=>{for(let e=0;e<8;e++)1&t?t=t>>>1^3988292384:t>>>=1;return t>>>0}),r=(e,t)=>Math.imul(e,t)>>>0,i=(e,t)=>n[255&(e^t)]^e>>>8,o=()=>"function"==typeof e?e(Buffer.alloc(12)):o.node();o.node=()=>{const e=Buffer.alloc(12),t=e.length;for(let n=0;n<t;n++)e[n]=256*Math.random()&255;return e};const s={genSalt:o};function a(e){const t=Buffer.isBuffer(e)?e:Buffer.from(e);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let e=0;e<t.length;e++)this.updateKeys(t[e])}return a.prototype.updateKeys=function(e){const t=this.keys;return t[0]=i(t[0],e),t[1]+=255&t[0],t[1]=r(t[1],134775813)+1,t[2]=i(t[2],t[1]>>>24),e},a.prototype.next=function(){const e=(2|this.keys[2])>>>0;return r(e,1^e)>>8&255},Cn={decrypt:function(e,n,r){if(!e||!Buffer.isBuffer(e)||e.length<12)return Buffer.alloc(0);const i=function(e){const t=new a(e);return function(e){const n=Buffer.alloc(e.length);let r=0;for(let i of e)n[r++]=t.updateKeys(i^t.next());return n}}(r),o=i(e.slice(0,12)),s=8&~n.flags?n.crc>>>24:n.timeHighByte;if(o[11]!==s)throw t.WRONG_PASSWORD();return i(e.slice(12))},encrypt:function(e,t,n,r=!1){null==e&&(e=Buffer.alloc(0)),Buffer.isBuffer(e)||(e=Buffer.from(e.toString()));const i=function(e){const t=new a(e);return function(e,n,r=0){n||(n=Buffer.alloc(e.length));for(let i of e){const e=t.next();n[r++]=i^e,t.updateKeys(i)}return n}}(n),o=s.genSalt();o[11]=t.crc>>>24&255,r&&(o[10]=t.crc>>>16&255);const c=Buffer.alloc(e.length+12);return i(o,c),i(e,c,12)},_salter:function(e){Buffer.isBuffer(e)&&e.length>=12?s.genSalt=function(){return e.slice(0,12)}:s.genSalt="node"===e?o.node:o}}}function kn(){return Dn||(Dn=1,xn.Deflater=Ln?wn:(Ln=1,wn=function(e){var t=F,n={chunkSize:1024*(parseInt(e.length/1024)+1)};return{deflate:function(){return t.deflateRawSync(e,n)},deflateAsync:function(r){var i=t.createDeflateRaw(n),o=[],s=0;i.on("data",function(e){o.push(e),s+=e.length}),i.on("end",function(){var e=Buffer.alloc(s),t=0;e.fill(0);for(var n=0;n<o.length;n++){var i=o[n];i.copy(e,t),t+=i.length}r&&r(e)}),i.end(e)}}}),xn.Inflater=function(){if(Sn)return In;Sn=1;const e=+(process?.versions?.node??"").split(".")[0]||0;return In=function(t,n){var r=F;const i=e>=15&&n>0?{maxOutputLength:n}:{};return{inflate:function(){return r.inflateRawSync(t,i)},inflateAsync:function(e){var n=r.createInflateRaw(i),o=[],s=0;n.on("data",function(e){o.push(e),s+=e.length}),n.on("end",function(){var t=Buffer.alloc(s),n=0;t.fill(0);for(var r=0;r<o.length;r++){var i=o[r];i.copy(t,n),n+=i.length}e&&e(t)}),n.end(t)}}}}(),xn.ZipCrypto=Tn()),xn}function Fn(){if(Nn)return Pn;Nn=1;var e=dn(),t=bn(),n=e.Constants,r=kn();return Pn=function(i,o){var s=new t.EntryHeader,a=Buffer.alloc(0),c=Buffer.alloc(0),l=!1,u=null,f=Buffer.alloc(0),d=Buffer.alloc(0),p=!0;const h=i,m="object"==typeof h.decoder?h.decoder:e.decoder;function g(){return o&&o instanceof Uint8Array?(d=s.loadLocalHeaderFromBinary(o),o.slice(s.realDataOffset,s.realDataOffset+s.compressedSize)):Buffer.alloc(0)}function v(t){const n=s.flags_desc||s.localHeader.flags_desc?s.crc:s.localHeader.crc;return e.crc32(t)===n}function y(t,n,i){if(void 0===n&&"string"==typeof t&&(i=t,t=void 0),l)return t&&n&&n(Buffer.alloc(0),e.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var o,c=g();if(0===c.length)return t&&n&&n(c),c;if(s.encrypted){if("string"!=typeof i&&!Buffer.isBuffer(i))throw e.Errors.INVALID_PASS_PARAM();c=r.ZipCrypto.decrypt(c,s,i)}switch(s.method){case e.Constants.STORED:if(o=Buffer.alloc(c.length),c.copy(o),v(o))return t&&n&&n(o),o;throw t&&n&&n(o,e.Errors.BAD_CRC()),e.Errors.BAD_CRC();case e.Constants.DEFLATED:var u=new r.Inflater(c,s.size);if(!t){if(!v(o=u.inflate()))throw e.Errors.BAD_CRC(`"${m.decode(a)}"`);return o}u.inflateAsync(function(t){n&&(v(t)?n(t):n(t,e.Errors.BAD_CRC()))});break;default:throw t&&n&&n(Buffer.alloc(0),e.Errors.UNKNOWN_METHOD()),e.Errors.UNKNOWN_METHOD()}}function E(t,n){if((!u||!u.length)&&Buffer.isBuffer(o))return t&&n&&n(g()),g();if(u.length&&!l){var i;switch(s.method){case e.Constants.STORED:return s.compressedSize=s.size,i=Buffer.alloc(u.length),u.copy(i),t&&n&&n(i),i;default:case e.Constants.DEFLATED:var a=new r.Deflater(u);if(!t){var c=a.deflate();return s.compressedSize=c.length,c}a.deflateAsync(function(e){i=Buffer.alloc(e.length),s.compressedSize=e.length,e.copy(i),n&&n(i)}),a=null}}else{if(!t||!n)return Buffer.alloc(0);n(Buffer.alloc(0))}}function b(t,n){return e.readBigUInt64LE(t,n)}function w(e){var t,r,i,o;e.length>=n.EF_ZIP64_SCOMP&&(t=b(e,n.EF_ZIP64_SUNCOMP),s.size===n.EF_ZIP64_OR_32&&(s.size=t)),e.length>=n.EF_ZIP64_RHO&&(r=b(e,n.EF_ZIP64_SCOMP),s.compressedSize===n.EF_ZIP64_OR_32&&(s.compressedSize=r)),e.length>=n.EF_ZIP64_DSN&&(i=b(e,n.EF_ZIP64_RHO),s.offset===n.EF_ZIP64_OR_32&&(s.offset=i)),e.length>=n.EF_ZIP64_DSN+4&&(o=e.readUInt32LE(n.EF_ZIP64_DSN),s.diskNumStart===n.EF_ZIP64_OR_16&&(s.diskNumStart=o))}return p=!!m.hasOwnProperty("efs")&&m.efs,{get entryName(){return m.decode(a)},get rawEntryName(){return a},set entryName(t){var n=(a=e.toBuffer(t,m.encode))[a.length-1];l=47===n||92===n,s.fileNameLength=a.length},get efs(){return"function"==typeof p?p(this.entryName):p},get extra(){return f},set extra(t){f=t,s.extraLength=t.length,function(t){try{for(var r,i,o,s=0;s+4<t.length;)r=t.readUInt16LE(s),s+=2,i=t.readUInt16LE(s),s+=2,o=t.slice(s,s+i),s+=i,n.ID_ZIP64===r&&w(o)}catch(t){throw e.Errors.EXTRA_FIELD_PARSE_ERROR()}}(t)},get comment(){return m.decode(c)},set comment(t){if(c=e.toBuffer(t,m.encode),s.commentLength=c.length,c.length>65535)throw e.Errors.COMMENT_TOO_LONG()},get name(){const e=m.decode(a);return l?e.replace(/[/\\]$/,"").split("/").pop():e.split("/").pop()},get isDirectory(){return l},getCompressedData:function(){return E(!1,null)},getCompressedDataAsync:function(e){E(!0,e)},setData:function(t){u=e.toBuffer(t,e.decoder.encode),!l&&u.length?(s.size=u.length,s.method=e.Constants.DEFLATED,s.crc=e.crc32(t),s.changed=!0):s.method=e.Constants.STORED},getData:function(e){return s.changed?u:y(!1,null,e)},getDataAsync:function(e,t){s.changed?e(u):y(!0,e,t)},set attr(e){s.attr=e},get attr(){return s.attr},set header(e){s.loadFromBinary(e)},get header(){return s},packCentralHeader:function(){s.flags_efs=this.efs,s.extraLength=f.length;var t=s.centralHeaderToBinary(),n=e.Constants.CENHDR;return a.copy(t,n),n+=a.length,f.copy(t,n),n+=s.extraLength,c.copy(t,n),t},packLocalHeader:function(){let e=0;s.flags_efs=this.efs,s.extraLocalLength=d.length;const t=s.localHeaderToBinary(),n=Buffer.alloc(t.length+a.length+s.extraLocalLength);return t.copy(n,e),e+=t.length,a.copy(n,e),e+=a.length,d.copy(n,e),e+=d.length,n},toJSON:function(){const e=function(e){return"<"+(e&&e.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:s.toJSON(),compressedData:e(o),data:e(u)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}},Pn}function Un(){if(An)return On;An=1;const e=Fn(),t=bn(),n=dn();return On=function(r,i){var o=[],s=Object.create(null),a=Buffer.alloc(0),c=new t.MainHeader,l=!1;const u=new Set,f=i,{noSort:d,decoder:p}=f;function h(){if(l=!0,s=Object.create(null),c.diskEntries>(r.length-c.offset)/n.Constants.CENHDR)throw n.Errors.DISK_ENTRY_TOO_LARGE();o=new Array(c.diskEntries);for(var t=c.offset,i=0;i<o.length;i++){var a=t,d=new e(f,r);d.header=r.slice(a,a+=n.Constants.CENHDR),d.entryName=r.slice(a,a+=d.header.fileNameLength),d.header.extraLength&&(d.extra=r.slice(a,a+=d.header.extraLength)),d.header.commentLength&&(d.comment=r.slice(a,a+d.header.commentLength)),t+=d.header.centralHeaderSize,o[i]=d,s[d.entryName]=d}u.clear(),function(){const t=new Set;for(const e of Object.keys(s)){const n=e.split("/");if(n.pop(),n.length)for(let e=0;e<n.length;e++){const r=n.slice(0,e+1).join("/")+"/";t.add(r)}}for(const n of t)if(!(n in s)){const t=new e(f);t.entryName=n,t.attr=16,t.temporary=!0,o.push(t),s[t.entryName]=t,u.add(t)}}()}function m(){o.length>1&&!d&&(o=o.map(e=>({entry:e,key:e.entryName.toLowerCase()})).sort((e,t)=>e.key.localeCompare(t.key)).map(e=>e.entry))}return r?function(e){var t=r.length-n.Constants.ENDHDR,i=Math.max(0,t-65535),o=i,s=r.length,l=-1,u=0;"boolean"==typeof f.trailingSpace&&f.trailingSpace&&(i=0);for(;t>=o;t--)if(80===r[t])if(r.readUInt32LE(t)!==n.Constants.ENDSIG)if(r.readUInt32LE(t)!==n.Constants.END64SIG){if(r.readUInt32LE(t)===n.Constants.ZIP64SIG){l=t,s=t+n.readBigUInt64LE(r,t+n.Constants.ZIP64SIZE)+n.Constants.ZIP64LEAD;break}}else o=i;else l=t,u=t,s=t+n.Constants.ENDHDR,o=t-n.Constants.END64HDR;if(-1==l)throw n.Errors.INVALID_FORMAT();c.loadFromBinary(r.slice(l,s)),c.commentLength&&(a=r.slice(u+n.Constants.ENDHDR));e&&h()}(f.readEntries):l=!0,{get entries(){return l||h(),o.filter(e=>!u.has(e))},get comment(){return p.decode(a)},set comment(e){a=n.toBuffer(e,p.encode),c.commentLength=a.length},getEntryCount:function(){return l?o.length:c.diskEntries},forEach:function(e){this.entries.forEach(e)},getEntry:function(e){return l||h(),s[e]||null},setEntry:function(e){l||h(),o.push(e),s[e.entryName]=e,c.totalEntries=o.length},deleteFile:function(e,t=!0){l||h();const n=s[e];this.getEntryChildren(n,t).map(e=>e.entryName).forEach(this.deleteEntry)},deleteEntry:function(e){l||h();const t=s[e],n=o.indexOf(t);n>=0&&(o.splice(n,1),delete s[e],c.totalEntries=o.length)},getEntryChildren:function(e,t=!0){if(l||h(),"object"==typeof e){if(e.isDirectory&&t){const t=[],n=e.entryName;for(const e of o)e.entryName.startsWith(n)&&t.push(e);return t}return[e]}return[]},getChildCount:function(e){if(e&&e.isDirectory){const t=this.getEntryChildren(e);return t.includes(e)?t.length-1:t.length}return 0},compressToBuffer:function(){l||h(),m();const e=[],t=[];let n=0,i=0;c.size=0,c.offset=0;let o=0;for(const r of this.entries){const s=r.getCompressedData();r.header.offset=i;const a=r.packLocalHeader(),l=a.length+s.length;i+=l,e.push(a),e.push(s);const u=r.packCentralHeader();t.push(u),c.size+=u.length,n+=l+u.length,o++}n+=c.mainHeaderSize,c.offset=i,c.totalEntries=o,i=0;const s=Buffer.alloc(n);for(const t of e)t.copy(s,i),i+=t.length;for(const e of t)e.copy(s,i),i+=e.length;const u=c.toBinary();return a&&a.copy(u,u.length-a.length),u.copy(s,i),r=s,l=!1,s},toAsyncBuffer:function(e,t,n,i){try{l||h(),m();const t=[],o=[];let s=0,u=0,f=0;c.size=0,c.offset=0;const d=function(p){if(p.length>0){const e=p.shift(),r=e.entryName+e.extra.toString();n&&n(r),e.getCompressedDataAsync(function(n){i&&i(r),e.header.offset=u;const a=e.packLocalHeader(),l=a.length+n.length;u+=l,t.push(a),t.push(n);const h=e.packCentralHeader();o.push(h),c.size+=h.length,s+=l+h.length,f++,d(p)})}else{s+=c.mainHeaderSize,c.offset=u,c.totalEntries=f,u=0;const n=Buffer.alloc(s);t.forEach(function(e){e.copy(n,u),u+=e.length}),o.forEach(function(e){e.copy(n,u),u+=e.length});const i=c.toBinary();a&&a.copy(i,i.length-a.length),i.copy(n,u),r=n,l=!1,e(n)}};d(Array.from(this.entries))}catch(e){t(e)}}}},On}var Bn=function(){if(Rn)return $n;Rn=1;const e=dn(),t=k,n=Fn(),r=Un(),i=(...t)=>e.findLast(t,e=>"boolean"==typeof e),o=(...t)=>e.findLast(t,e=>"string"==typeof e),s={noSort:!1,readEntries:!1,method:e.Constants.NONE,fs:null};return $n=function(a,c){let l=null;const u=Object.assign(Object.create(null),s);a&&"object"==typeof a&&(a instanceof Uint8Array||(Object.assign(u,a),a=u.input?u.input:void 0,u.input&&delete u.input),Buffer.isBuffer(a)&&(l=a,u.method=e.Constants.BUFFER,a=void 0)),Object.assign(u,c);const f=new e(u),d=e=>{e.filter(e=>e.attr).sort((e,t)=>t.path.length-e.path.length).forEach(e=>f.fs.chmodSync(e.path,e.attr))};if("object"==typeof u.decoder&&"function"==typeof u.decoder.encode&&"function"==typeof u.decoder.decode||(u.decoder=e.decoder),a&&"string"==typeof a){if(!f.fs.existsSync(a))throw e.Errors.INVALID_FILENAME();u.method=e.Constants.FILE,u.filename=a,l=f.fs.readFileSync(a)}const p=new r(l,u),{canonical:h,sanitize:m,zipnamefix:g}=e;function v(e){var n;if(e&&p&&("string"==typeof e&&(n=p.getEntry(t.posix.normalize(e))),"object"==typeof e&&void 0!==e.entryName&&void 0!==e.header&&(n=p.getEntry(e.entryName)),n))return n;return null}function y(e){const{join:n,normalize:r,sep:i}=t.posix;return n(t.isAbsolute(e)?"/":".",r(i+e.split("\\").join(i)+i))}function E(e){return e instanceof RegExp?(t=e,function(e){return t.test(e)}):"function"!=typeof e?()=>!0:e;var t}const b=(e,n)=>{let r=n.slice(-1);return r=r===f.sep?f.sep:"",t.relative(e,n)+r};return{readFile:function(e,t){var n=v(e);return n&&n.getData(t)||null},childCount:function(e){const t=v(e);if(t)return p.getChildCount(t)},readFileAsync:function(e,t){var n=v(e);n?n.getDataAsync(t):t(null,"getEntry failed for:"+e)},readAsText:function(e,t){var n=v(e);if(n){var r=n.getData();if(r&&r.length)return r.toString(t||"utf8")}return""},readAsTextAsync:function(e,t,n){var r=v(e);r?r.getDataAsync(function(e,r){r?t(e,r):e&&e.length?t(e.toString(n||"utf8")):t("")}):t("")},deleteFile:function(e,t=!0){var n=v(e);n&&p.deleteFile(n.entryName,t)},deleteEntry:function(e){var t=v(e);t&&p.deleteEntry(t.entryName)},addZipComment:function(e){p.comment=e},getZipComment:function(){return p.comment||""},addZipEntryComment:function(e,t){var n=v(e);n&&(n.comment=t)},getZipEntryComment:function(e){var t=v(e);return t&&t.comment||""},updateFile:function(e,t){var n=v(e);n&&n.setData(t)},addLocalFile:function(n,r,i,o){if(!f.fs.existsSync(n))throw e.Errors.FILE_NOT_FOUND(n);{r=r?y(r):"";const e=t.win32.basename(t.win32.normalize(n));r+=i||e;const s=f.fs.statSync(n),a=s.isFile()?f.fs.readFileSync(n):Buffer.alloc(0);s.isDirectory()&&(r+=f.sep),this.addFile(r,a,o,s)}},addLocalFileAsync:function(e,n){e="object"==typeof e?e:{localPath:e};const r=t.resolve(e.localPath),{comment:i}=e;let{zipPath:o,zipName:s}=e;const a=this;f.fs.stat(r,function(e,c){if(e)return n(e,!1);o=o?y(o):"";const l=t.win32.basename(t.win32.normalize(r));if(o+=s||l,c.isFile())f.fs.readFile(r,function(e,t){return e?n(e,!1):(a.addFile(o,t,i,c),setImmediate(n,void 0,!0))});else if(c.isDirectory())return o+=f.sep,a.addFile(o,Buffer.alloc(0),i,c),setImmediate(n,void 0,!0)})},addLocalFolder:function(n,r,i){if(i=E(i),r=r?y(r):"",n=t.normalize(n),!f.fs.existsSync(n))throw e.Errors.FILE_NOT_FOUND(n);{const e=f.findFiles(n),o=this;if(e.length)for(const s of e){const e=t.join(r,b(n,s));i(e)&&o.addLocalFile(s,t.dirname(e))}}},addLocalFolderAsync:function(n,r,i,o){o=E(o),i=i?y(i):"",n=t.normalize(n);var s=this;f.fs.open(n,"r",function(t){if(t&&"ENOENT"===t.code)r(void 0,e.Errors.FILE_NOT_FOUND(n));else if(t)r(void 0,t);else{var a=f.findFiles(n),c=-1,l=function(){if((c+=1)<a.length){var e=a[c],t=b(n,e).split("\\").join("/");t=t.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),o(t)?f.fs.stat(e,function(n,o){n&&r(void 0,n),o.isFile()?f.fs.readFile(e,function(e,n){e?r(void 0,e):(s.addFile(i+t,n,"",o),l())}):(s.addFile(i+t+"/",Buffer.alloc(0),"",o),l())}):process.nextTick(()=>{l()})}else r(!0,void 0)};l()}})},addLocalFolderAsync2:function(n,r){const i=this;n="object"==typeof n?n:{localPath:n};const o=t.resolve(y(n.localPath));let{zipPath:s,filter:a,namefix:c}=n;var l;a instanceof RegExp?(l=a,a=function(e){return l.test(e)}):"function"!=typeof a&&(a=function(){return!0}),s=s?y(s):"","latin1"===c&&(c=e=>e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),"function"!=typeof c&&(c=e=>e);const u=e=>t.join(s,c(b(o,e))),d=e=>t.win32.basename(t.win32.normalize(c(e)));f.fs.open(o,"r",function(n){n&&"ENOENT"===n.code?r(void 0,e.Errors.FILE_NOT_FOUND(o)):n?r(void 0,n):f.findFilesAsync(o,function(e,n){if(e)return r(e);(n=n.filter(e=>a(u(e)))).length||r(void 0,!1),setImmediate(n.reverse().reduce(function(e,n){return function(r,o){if(r||!1===o)return setImmediate(e,r,!1);i.addLocalFileAsync({localPath:n,zipPath:t.dirname(u(n)),zipName:d(n)},e)}},r))})})},addLocalFolderPromise:function(e,t){return new Promise((n,r)=>{this.addLocalFolderAsync2(Object.assign({localPath:e},t),(e,t)=>{e&&r(e),t&&n(this)})})},addFile:function(e,t,r,i){let o=v(e=g(e));const s=null!=o;s||(o=new n(u),o.entryName=e),o.comment=r||"";const a="object"==typeof i&&i instanceof f.fs.Stats;a&&(o.header.time=i.mtime);var c=o.isDirectory?16:0;let l=o.isDirectory?16384:32768;return l|=a?4095&i.mode:"number"==typeof i?4095&i:o.isDirectory?493:420,c=(c|l<<16)>>>0,o.attr=c,o.setData(t),s||p.setEntry(o),o},getEntries:function(e){return p.password=e,p?p.entries:[]},getEntry:function(e){return v(e)},getEntryCount:function(){return p.getEntryCount()},forEach:function(e){return p.forEach(e)},extractEntryTo:function(n,r,s,a,c,l){a=i(!1,a),c=i(!1,c),s=i(!0,s),l=o(c,l);var u=v(n);if(!u)throw e.Errors.NO_ENTRY();var d=h(u.entryName),g=m(r,l&&!u.isDirectory?h(l):s?d:t.basename(d));if(u.isDirectory)return p.getEntryChildren(u).forEach(function(t){if(t.isDirectory)return;var n=t.getData();if(!n)throw e.Errors.CANT_EXTRACT_FILE();var i=h(s?t.entryName:t.entryName.substring(u.entryName.length)),o=m(r,i);const l=c?t.header.fileAttr:void 0;f.writeFileTo(o,n,a,l)}),!0;var y=u.getData(p.password);if(!y)throw e.Errors.CANT_EXTRACT_FILE();if(f.fs.existsSync(g)&&!a)throw e.Errors.CANT_OVERRIDE();const E=c?n.header.fileAttr:void 0;return f.writeFileTo(g,y,a,E),!0},test:function(e){if(!p)return!1;for(var t of p.entries)try{if(t.isDirectory)continue;if(!t.getData(e))return!1}catch(e){return!1}return!0},extractAllTo:function(t,n,r,s){if(r=i(!1,r),s=o(r,s),n=i(!1,n),!p)throw e.Errors.NO_ZIP();const a=[];p.entries.forEach(function(i){var o=m(t,h(i.entryName));if(i.isDirectory)return f.makeDir(o),void(r&&a.push({path:o,attr:i.header.fileAttr}));var c=i.getData(s);if(!c)throw e.Errors.CANT_EXTRACT_FILE();const l=r?i.header.fileAttr:void 0;f.writeFileTo(o,c,n,l);try{f.fs.utimesSync(o,i.header.time,i.header.time)}catch(e){}}),d(a)},extractAllToAsync:function(n,r,o,s){if(s=((...t)=>e.findLast(t,e=>"function"==typeof e))(r,o,s),o=i(!1,o),r=i(!1,r),!s)return new Promise((e,t)=>{this.extractAllToAsync(n,r,o,function(n){n?t(n):e(this)})});if(!p)return void s(e.Errors.NO_ZIP());n=t.resolve(n);const a=e=>m(n,t.normalize(h(e.entryName))),c=(e,t)=>new Error(e+': "'+t+'"'),l=[],u=[];p.entries.forEach(e=>{e.isDirectory?l.push(e):u.push(e)});const g=[];for(const e of l){const t=a(e),n=o?e.header.fileAttr:void 0;try{f.makeDir(t)}catch(e){s(c("Unable to create folder",t));continue}n&&g.push({path:t,attr:n});try{f.fs.utimesSync(t,e.header.time,e.header.time)}catch(e){}}u.reverse().reduce(function(i,s){return function(a){if(a)i(a);else{const a=t.normalize(h(s.entryName)),l=m(n,a);s.getDataAsync(function(t,n){if(n)i(n);else if(t){const e=o?s.header.fileAttr:void 0;f.writeFileToAsync(l,t,r,e,function(e){if(!e)return i(c("Unable to write file",l));f.fs.utimes(l,s.header.time,s.header.time,function(){i()})})}else i(e.Errors.CANT_EXTRACT_FILE())})}}},e=>{if(!e)try{d(g)}catch(e){return s(c("Unable to set folder permissions",e.path||""))}s(e)})()},writeZip:function(e,t){if(1===arguments.length&&"function"==typeof e&&(t=e,e=""),!e&&u.filename&&(e=u.filename),e){var n=p.compressToBuffer();if(n){var r=f.writeFileTo(e,n,!0);"function"==typeof t&&t(r?null:new Error("failed"),"")}}},writeZipPromise:function(e,t){const{overwrite:n,perm:r}=Object.assign({overwrite:!0},t);return new Promise((t,i)=>{!e&&u.filename&&(e=u.filename),e||i("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(o=>{f.writeFileToAsync(e,o,n,r,e=>e?t(e):i("ADM-ZIP: Wasn't able to write zip file"))},i)})},toBufferPromise:function(){return new Promise((e,t)=>{p.toAsyncBuffer(e,t)})},toBuffer:function(e,t,n,r){return"function"==typeof e?(p.toAsyncBuffer(e,t,n,r),null):p.compressToBuffer()}}},$n}(),Mn=V(Bn);const Gn=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],jn=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],Hn=["b","kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],zn=["b","kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],qn=e=>{if("number"==typeof e)return Math.log10(e);const t=e.toString(10);return t.length+Math.log10(`0.${t.slice(0,15)}`)},Vn=(e,t)=>{if(void 0===t)return e;if("number"!=typeof t||!Number.isSafeInteger(t)||t<0)throw new TypeError(`Expected fixedWidth to be a non-negative integer, got ${typeof t}: ${t}`);return 0===t?e:e.length<t?e.padStart(t," "):e};function Wn(e,t){if("bigint"!=typeof e&&!Number.isFinite(e))throw new TypeError(`Expected a finite number, got ${typeof e}: ${e}`);const n=(t={bits:!1,binary:!1,space:!0,nonBreakingSpace:!1,...t}).bits?t.binary?zn:Hn:t.binary?jn:Gn,r=t.space?t.nonBreakingSpace?" ":" ":"",i="number"==typeof e?0===e:0n===e;if(t.signed&&i){return Vn(` 0${r}${n[0]}`,t.fixedWidth)}const o=e<0,s=o?"-":t.signed?"+":"";o&&(e=-e);const a=(e=>{const{minimumFractionDigits:t,maximumFractionDigits:n}=e;if(void 0!==t||void 0!==n)return{...void 0!==t&&{minimumFractionDigits:t},...void 0!==n&&{maximumFractionDigits:n},roundingMode:"trunc"}})(t);let c=0;var l;if(e>=1&&(c=Math.min(Math.floor(t.binary?("number"==typeof(l=e)?Math.log(l):qn(l)*Math.log(10))/Math.log(1024):qn(e)/3),n.length-1)),e=((e,t)=>{if("number"==typeof e)return e/t;const n=e/BigInt(t),r=e%BigInt(t);return Number(n)+Number(r)/t})(e,(t.binary?1024:1e3)**c),!a){const t=Math.max(3,Math.floor(e).toString().length);e=Number(e.toPrecision(t))}const u=((e,t,n)=>{let r=e;return"string"==typeof t||Array.isArray(t)?r=e.toLocaleString(t,n):!0!==t&&void 0===n||(r=e.toLocaleString(void 0,n)),r})(e,t.locale,a);return Vn(s+u+r+n[c],t.fixedWidth)}const Zn=e=>"string"==typeof e?Zn(b(e).size):r.yellowBright(Wn(e));class Kn{#ne;get ora(){return this.#ne}set attachConsole(e){e?(console.log=this.info.bind(this),console.info=this.info.bind(this)):console=Jn}static Global(e){return Yn=new Kn(e),Yn}static Clone(e){const{prefixText:t}=e||Yn;return new Kn({prefixText:t})}static get Current(){return Yn}static set Current(e){Yn=e}constructor(e){this.#ne=j(e)}get prefixText(){return this.#ne.prefixText}info(...e){this.#ne.info(Xn(e))}succeed(...e){this.#ne.succeed(Xn(e))}start(...e){this.#ne.start(Xn(e))}fail(...e){this.#ne.fail(Xn(e))}warn(...e){this.#ne.warn(Xn(e))}clear(){this.#ne.clear()}stop(){this.#ne.stop()}stopAndPersist(...e){this.#ne.stopAndPersist(...e)}}let Yn=new Kn;const Xn=e=>e.length?e.join(" "):void 0,Jn=console;class Qn{spinner;debugMode;constructor(e,t){this.spinner=new Kn({prefixText:e}),this.debugMode=t?.debug??!1}start(...e){this.spinner.start(...e)}succeed(...e){this.spinner.succeed(...e)}fail(...e){this.spinner.fail(...e)}error(...e){console.log(...e)}warn(...e){this.spinner.warn(...e)}info(...e){this.spinner.info(...e)}log(...e){this.spinner.info(...e)}debug(...e){this.debugMode&&console.debug(...e)}startNativeConsoleCapture(){this.spinner.attachConsole=!0}stopNativeConsoleCapture(){this.spinner.attachConsole=!1}}const er=e=>{const t={spa:{templateEnv:(n=e.template,r=e.mock,{portal:{id:"@equinor/fusion-framework-dev-portal"},title:"Fusion Dev Portal",serviceDiscovery:{url:"/@fusion-services",scopes:["5a842df8-3238-415d-b168-9f16a6a6031b/.default"]},msal:{clientId:"9b707e3a-3e90-41ed-a47e-652a1e3b53d0",tenantId:"3aa4a235-b6e2-48d5-9195-7fcf05b459b0",redirectUri:"/authentication/login-callback",requiresAuth:"true",...r?{mock:"true"}:{}},serviceWorker:{resources:[{url:"/apps-proxy",rewrite:"/@fusion-api/apps",scopes:["5a842df8-3238-415d-b168-9f16a6a6031b/.default"]},{url:"/@fusion-api/apps",scopes:["5a842df8-3238-415d-b168-9f16a6a6031b/.default"]},{url:"/help-proxy",rewrite:"/@fusion-api/help",scopes:["5a842df8-3238-415d-b168-9f16a6a6031b/.default"]},{url:"/portal-proxy",rewrite:"/@fusion-api/portal-config",scopes:["5a842df8-3238-415d-b168-9f16a6a6031b/.default"]},{url:"/@fusion-api/portal-config",scopes:["5a842df8-3238-415d-b168-9f16a6a6031b/.default"]}]},...n})},api:{serviceDiscoveryUrl:e.mock?new URL("/@fusion-mock/discovery",e.mock).href:"https://discovery.fusion.equinor.com/service-registry/environments/ci/services/",processServices:(e,t)=>{const{data:n,routes:r}=H(e,t);return{data:n.concat({key:"portals",name:"Portal Service - MOCK",uri:"/@fusion-api/portals"}),routes:r}}}};var n,r;return e.app&&((e,t,n)=>{const{build:r,appKey:i}=t;if(!r)throw new Error("App manifest does not contain build information");e.api.routes??=[],e.api.routes.push({match:[`/apps/bundles/apps/${i}/${r.version}/*path`,`/apps/bundles/apps/${i}@${r.version}/*path`],middleware:async(e,t,n)=>{const r=e.params?.path;!1===Array.isArray(r)&&n(),t.writeHead(302,{"content-type":"application/javascript",location:`/${r.join("/")}`}),t.end()}}),e.api.routes.push({match:`/apps/persons/me/apps/${i}`,middleware:async(e,n)=>{n.writeHead(200,{"content-type":"application/json"}),n.end(JSON.stringify({id:"dev-server-generated-id",...t}))}}),e.api.routes.push({match:`/apps/apps/${i}/builds/${r.version}/config`,middleware:async(e,t)=>{t.writeHead(200,{"content-type":"application/json"}),t.end(JSON.stringify(n))}})})(t,e.app.manifest,e.app.config),e.portal&&((e,t,n)=>{e.api.routes??=[];const r="portal-config";e.api.routes.push({match:`/${r}/portals/${t.name}{@:tag}`,middleware:async(e,n)=>{n.writeHead(200,{"content-type":"application/json"}),n.end(JSON.stringify(t))}}),n&&e.api.routes.push({match:`/${r}/portals/${t.name}{@:tag}/config`,middleware:async(e,t)=>{t.writeHead(200,{"content-type":"application/json"}),t.end(JSON.stringify(n))}})})(t,e.portal.manifest,e.portal.config),t};const tr=e=>({portal:"object"==typeof e.spa?.templateEnv?e.spa.templateEnv.portal:void 0,msal:"object"==typeof e.spa?.templateEnv?e.spa.templateEnv.msal:void 0,proxy:"object"==typeof e.spa?.templateEnv?e.spa.templateEnv.serviceWorker?.resources:void 0,serviceDiscoveryUrl:e.api.serviceDiscoveryUrl,routes:e.api.routes}),nr=/\.mock\.(?:ts|mjs|js)$/;async function rr(e,t){const n=l(t),r=t.slice(0,-n.length),{config:i}=await S(r,{baseDir:e,extensions:[n]});return function(e,t){if(null===e||"object"!=typeof e||Array.isArray(e))throw new Error(`Expected "${t}" to default-export defineService({...}).`);const n=e;if("string"!=typeof n.key||!n.key)throw new Error(`Expected "${t}" to provide a non-empty service key.`);if(!1!==n.serviceDiscovery&&"merge"!==n.serviceDiscovery&&"new"!==n.serviceDiscovery&&"replace"!==n.serviceDiscovery)throw new Error(`Expected "${t}" to declare a valid serviceDiscovery mode.`);return n}(i,t)}const ir=async(e,t,n)=>{const{overrides:r,log:i}=n??{},o=er(t);i?.debug("\nBase dev server config:",tr(o)),i?.debug("\nCreating dev server with overrides:",r);let s,c=o;try{const t=await(async(e,t,n)=>S("dev-server.config",{baseDir:e.root,extensions:n?.extensions,script:{resolve:async n=>{let r;if("function"==typeof n.default){const i={...t};r=await n.default(e,{base:i})}else r=n.default;return ut(t,r??{})}}}))(e,o);c=t.config;const{path:n}=t;i?.debug(`\nLoaded dev server config from ${n}`),i?.debug("\nLoaded dev server config:",tr(c)),s=((e,t)=>({name:"fusion:dev-server-config-watcher",configureServer(n){n.watcher.add(e),n.watcher.on("change",r=>{r===e&&(t?.info(`\n${e} changed, restarting dev server...`),n.restart())}),t?.debug(`Watching dev-server.config.ts at: ${e}`)}}))(n,i)}catch(e){i?.warn("\nFailed to load dev server config:",e instanceof Error?e.message:String(e))}if(!t.mock){const t=a(e.root??process.cwd(),c.mockServer?.path??"mocks");c=function(e,t){const n=e.api.processServices??H,r=new Set(t.map(e=>e.key));return{...e,api:{...e.api,processServices(e,i){if(!Array.isArray(e))return n(e,i);const o=new Set(e.map(e=>e.key)),s=t.find(e=>"new"===e.serviceDiscovery&&o.has(e.key));if(s)throw new Error(`Mock service "${s.key}" is marked as new but already exists in upstream service discovery.`);const a=e.filter(e=>!r.has(e.key)),c=t.map(({serviceDiscovery:e,...t})=>t);return n([...a,...c],i)}}}}(c,await async function(e,t){let n;try{n=await B(e)}catch(e){if("ENOENT"===e.code)return[];throw e}const r=n.filter(e=>nr.test(e)).sort();return(await Promise.all(r.map(t=>rr(e,t)))).filter(e=>!1!==e.serviceDiscovery).map(e=>({key:e.key,name:`${e.key} mock`,uri:`http://${e.key}.localhost:${t}`,serviceDiscovery:e.serviceDiscovery}))}(t,c.mockServer?.port??4010))}const l=s?{...r,plugins:[...r?.plugins??[],s]}:r;return z(c,l)},or="fusion-framework-cli",sr={"X-Fusion-CLI-Name":or,"X-Fusion-CLI-Version":Bt,"User-Agent":`${or}/${Bt}`},ar={AUTH_DOCS_URL:"https://github.com/equinor/fusion-framework/blob/main/packages/cli/docs/auth.md",APP_DOCS_URL:"https://github.com/equinor/fusion-framework/blob/main/packages/cli/docs/application.md"};function cr(){if(process.env.FUSION_TOKEN)return[r.bold("ðĄ FUSION_TOKEN detected"),r.dim(" The CLI is using this token instead of your interactive login session."),r.dim(" If this is unintended, unset the variable and retry, or verify that the token has the correct scope/audience.")].join("\n")}const{AUTH_DOCS_URL:lr,APP_DOCS_URL:ur}=ar;function fr(e,t){switch(e){case 401:return function(e){const t=["",r.redBright(`ðŦ Authentication failed: unable to ${e}`),""," No valid token was provided or the token has expired.",""],n=cr();return n&&t.push(n,""),t.push(r.whiteBright(" Troubleshooting:"),"",` ${r.cyan("1.")} For CI/CD, verify that ${r.bold("FUSION_TOKEN")} is set and the token has not expired.`,` ${r.cyan("2.")} For local development, run ${r.greenBright.bold("ffc auth login")} to refresh your credentials.`,` ${r.cyan("3.")} Verify that ${r.bold("--scope")} targets the correct API audience for your environment.`,"",` ${r.dim("Auth docs:")} ${r.blueBright.underline(lr)}`,` ${r.dim("Publish docs:")} ${r.blueBright.underline(ur)}`,""),t.join("\n")}(t);case 403:return function(e){const t=["",r.redBright(`ðŦ Authorization failed: not permitted to ${e}`),"","â ïļ Your token is valid but does not have the required permissions for this operation.",""],n=cr();return n&&t.push(n,""),t.push(r.whiteBright(" Troubleshooting:"),"",` ${r.cyan("1.")} Verify that your user or service principal has publish permissions for this application.`,` ${r.cyan("2.")} Check that the token's ${r.bold("scope / audience")} matches the target environment.`,` ${r.cyan("3.")} Confirm that the application is registered and your account has the correct role assignment.`,"",` ${r.dim("Auth docs:")} ${r.blueBright.underline(lr)}`,` ${r.dim("Publish docs:")} ${r.blueBright.underline(ur)}`,""),t.join("\n")}(t);default:return}}const{AUTH_DOCS_URL:dr,APP_DOCS_URL:pr}=ar;function hr(e,t){if(!(e instanceof Error))return;const n="SilentTokenAcquisitionError"===e.name,i=e,o=i.response?i.response.status:void 0,s=401===o||403===o;let a=!1,c=e.cause;for(let e=0;e<5&&c&&c instanceof Error;e++){if("SilentTokenAcquisitionError"===c.name){a=!0;break}c=c.cause}if(!n&&!s&&!a)return;if(s&&!n&&!a)return fr(o,t);const l=function(e){let t=e;for(let e=0;e<5&&t;e++){if(!(t instanceof Error)){if("object"==typeof t&&"errorMessage"in t){const e=t.errorMessage;if("string"==typeof e){const t=e.match(/Description:\s*(.+?)(?:\s*Trace ID:|$)/);return t?.[1]?.trim()??e.split(" - ")[0]?.trim()}break}break}{const e=t;if("string"==typeof e.errorMessage){const t=e.errorMessage,n=t.match(/Description:\s*(.+?)(?:\s*Trace ID:|$)/);return n?.[1]?.trim()??t.split(" - ")[0]?.trim()}t=t.cause}}}(e),u=["",r.redBright(`ð Token acquisition failed: unable to ${t}`),"",r.yellow(`â ïļ ${l??"The CLI could not silently acquire an access token for this operation."}`),""],f=cr();return f&&u.push(f,""),u.push(r.whiteBright(" Troubleshooting:"),"",` ${r.cyan("1.")} Run ${r.greenBright.bold("ffc auth login")} to refresh your local credentials.`,` ${r.cyan("2.")} For CI/CD, set a fresh ${r.bold("FUSION_TOKEN")} â cached refresh tokens may have expired.`,` ${r.cyan("3.")} Verify that ${r.bold("--scope")} targets the correct API audience for your environment.`,"",` ${r.dim("Auth docs:")} ${r.blueBright.underline(dr)}`,` ${r.dim("Publish docs:")} ${r.blueBright.underline(pr)}`,""),u.join("\n")}const mr=(e,t,n)=>{const r=s(String(e));w(r)||L(r,{recursive:!0}),I(e,t,n)},gr=["package.json","LICENSE.md","README.md","CHANGELOG.md"],vr=async(e,t)=>{const{archive:n,log:i}=t??{},o=s(e.path),c=t?.buildDir??"dist",l=a(o,c);if(!(await M(l)).isDirectory())throw new Error(`Build directory ${c} does not exist`);i?.log(r.bold("Starting to pack bundle"));const u=new Mn;if(u.addLocalFolder(l,c),t?.content)for(const[e,n]of Object.entries(t.content))u.addFile(e,Buffer.from(n)),i?.info("ð",Vt(e,{relative:!0}));i?.info("ð",Vt(l,{relative:!0}));for(const t of gr.concat(e.packageJson.files??[])){const e=a(o,t),n=s(e.replace(o,""));at(e)?(u.addLocalFile(e,n),i?.info("ð",Vt(e,{relative:!0}))):i?.warn(r.dim("ð",Vt(e,{relative:!0})))}return n&&(at(s(n))||await G(s(n),{recursive:!0}),i?.start("compressing content"),await u.writeZipPromise(n),i?.succeed("ð",Vt(n,{relative:!0}),Zn(n))),u},yr=async e=>{const{log:t,manifest:n,snapshot:r}=e;process.env.NODE_ENV,process.cwd();const{pkg:i,manifest:o}=await Yt({log:t,manifest:n,snapshot:r});if(!o.build)throw new Error("Manifest build config not found");return{archive:await vr(i,{log:t,archive:e?.archive,content:{"app-manifest.json":JSON.stringify(o.build,null,2),"metadata.json":JSON.stringify({appKey:o.appKey,name:o.appKey,version:o.build.version})}}).catch(e=>{t?.error("Failed to create package:",e),process.exit(1)}),manifest:o}},Er=async(e,t)=>{const{log:n}=t;try{n?.start("create application configuration"),n?.info(`generating config with ${r.red.dim(e.command)} command in ${r.green.dim(e.mode)} mode`);const i=await((e,t)=>{const n=t?.file??[`app.config.${e.environment}`,"app.config"];return S(n,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async n=>{const r=t?.base??{environment:{}};if("function"==typeof n.default){const t=await n.default(e,{base:r})??r;return qt.parse(t??r)}return qt.parse(n.default??r)}}})})(e,{file:t?.config});return n?.succeed("âïļ generated config from ",Vt(i.path,{relative:!0})),i.config}catch(e){if(e instanceof C){if(!t.config)return n?.succeed(r.dim("âïļ no local application config applied, using built-in")),{environment:{},endpoints:{}};n?.warn(`failed to load config file ${Vt(t.config)}, please check the path.`)}throw n?.fail("failed to resolve application config"),n?.debug(e),e}},br=async e=>{const{log:t}=e??{};let n;try{t?.start("resolve project package"),n=await Zt(null),t?.succeed("ðĶ",r.yellowBright([n.packageJson.name,n.packageJson.version].join("@"))),t?.info("ð ",r.blueBright(n.root))}catch{t?.info("Failed to resolve project package, using current directory as root")}const i=n?.root??process.cwd(),o={command:"build",mode:process.env.NODE_ENV??"production",root:i,...e?.env},s=await Er(o,{log:t,config:e?.config});if(t?.debug("config:",s),e?.output){t?.start("writing config to file");try{await mr(e.output,JSON.stringify(s,null,2)),t?.succeed("config written successfully",Vt(e.output,{relative:!0}))}catch(e){throw t?.fail("failed to write config"),e}}return{config:s,pkg:n}};class wr extends Error{response;static Name="HttpResponseError";constructor(e,t,n){super(e,n),this.response=t}}class Lr extends wr{static Name="HttpJsonResponseError";data;constructor(e,t,n){super(e,t,n),this.name=Lr.Name,this.data=n?.data}}class Ir extends wr{static Name="ServerSentEventResponseError";constructor(e,t,n){super(e,t,n),this.name=Ir.Name}}class Sr extends Error{}const Cr=async e=>{const{log:t,config:n,appKey:r,buildVersion:i,framework:o}=e;try{const e=await o.serviceDiscovery.createClient("apps");e.request$.subscribe(e=>{t?.debug("Request:",e),t?.info("ð","Executing request to:",Vt(e.uri))}),t?.start("Publishing application config");const s=await e.json(`/apps/${r}/builds/${i}/config`,{method:"PUT",body:n,headers:sr});t?.debug("Response:",s),t?.succeed("Published application config")}catch(e){if(e instanceof Lr)switch(e.response.status){case 410:t?.fail("ðĪŽ",`App ${r} is deleted from apps-service. Please check the app key and try again.`);break;case 404:t?.fail("ðĪŽ",`App ${r} not found. Please check the app key and try again.`);break;case 403:case 401:{const n=fr(e.response.status,`publish config for ${r}`);t?.fail("ð","Authentication/authorization error publishing app config."),n&&t?.error(n),process.exit(1);break}default:t?.fail("ðĪŽ","Failed to publish application config.",`Status code: ${e.response.status}`,`Message: ${e.response.statusText}`)}const n=hr(e,`publish config for ${r}`);n&&(t?.fail("ð",`Token acquisition failed publishing config for ${r}`),t?.error(n),process.exit(1)),t?.fail("ðĪŽ","Failed to publish app config:",e instanceof Error?e.message:String(e)),process.exit(1)}},_r=async e=>{const{log:n}=e??{},r="@equinor/fusion-framework-dev-portal",i=await Zt(n),o={root:i.root,environment:"local",...e?.env,mode:"development",command:"serve"},a=await Wt(o,i,{log:n,manifestPath:e?.manifest}),c=await Er(o,{log:n,config:e?.config});let l,u;const d=p(import.meta.resolve(r));at(d)?(l=d,u=await f({cwd:d}).then(e=>e?s(e?.path):void 0)):n?.info(`Portal ${r} is external, skipping entry point resolution`);const h=await Rt(o,i),m=u?[i.root,u]:[i.root];n?.debug(`File system access allowed for: \n${m.join("\n")}\n`);const g=t(h,{server:{port:e?.port||3e3,host:e?.host||h.server?.host||"localhost",fs:{allow:m}}}),v={template:{portal:{id:r}},app:{manifest:a,config:c},mock:e?.mock};l&&(v.portal={manifest:{name:r,build:{templateEntry:l,assetPath:"/@fs"}},config:{}}),n?.debug("vite config:",g),n?.debug("dev server config:",v),n?.start("Starting app development server...");const y=await ir(o,v,{overrides:g,log:n});await y.listen(),n?.succeed("App development server started successfully");const E=y.config.server.https?"https":"http",b=y.config.server.host||"localhost",w=y.config.server.port||5173;return n?.info(`App development server is running at: ${E}://${b}:${w}/apps/${a.appKey}`),y},Dr=async e=>{const{log:n,dir:r,port:i=4173,host:o="localhost"}=e??{};n?.log("Starting to serve application");const c="@equinor/fusion-framework-dev-portal",l=await Zt(n);n?.start("Loading Vite config...");const u=await Rt({root:l.root,command:"build",mode:"production"},l);n?.succeed("Vite config loaded");const d=r||(u.build?.outDir||"dist"),h=a(l.root,d),m={root:l.root,environment:"local",mode:"production",command:"serve",isPreview:!0},g=await Wt(m,l,{log:n,manifestPath:e?.manifest}),v=await Er(m,{log:n,config:e?.config});if(n?.debug("Output directory:",h),!w(h))throw new Error(`Build directory does not exist: ${h}\nPlease build the application first using \`ffc app build\``);let y,E;const b=p(import.meta.resolve(c));at(b)?(y=b,E=await f({cwd:b}).then(e=>e?s(e?.path):void 0)):n?.info(`Portal ${c} is external, skipping entry point resolution`);const L=await Rt(m,l),I=E?[l.root,E,h]:[l.root,h];n?.debug(`File system access allowed for: \n${I.join("\n")}\n`);const S=t(L,{server:{port:i,host:o||L.server?.host||"localhost",fs:{allow:I}}}),C={template:{portal:{id:c}},app:{manifest:g,config:v},mock:e?.mock};y&&(C.portal={manifest:{name:c,build:{templateEntry:y,assetPath:"/@fs"}},config:{}}),n?.debug("vite config:",S),n?.debug("dev server config:",C),n?.start("Starting preview server with dev-portal...");try{const e=await ir(m,C,{overrides:S,log:n});await e.listen(),n?.succeed("Preview server started successfully");const t=e.config.server?.https?"https":"http",r=e.config.server?.host||o,s=e.config.server?.port||i;return n?.info(`Preview server is running at: ${t}://${r}:${s}`),g.appKey&&n?.info(`App URL: ${t}://${r}:${s}/apps/${g.appKey}`),e}catch(e){throw n?.fail("Failed to start preview server"),e}};class Pr extends A{satisfies(e){return $(this,e)}}var Nr=function(e,t){return Nr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Nr(e,t)};function Or(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Nr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Ar=function(){return Ar=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ar.apply(this,arguments)};function $r(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}c((r=r.apply(e,t||[])).next())})}function Rr(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function xr(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Tr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function kr(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function Fr(e){return this instanceof Fr?(this.v=e,this):new Fr(e)}function Ur(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",function(e){return function(t){return Promise.resolve(t).then(e,l)}}),r[Symbol.asyncIterator]=function(){return this},r;function s(e,t){i[e]&&(r[e]=function(t){return new Promise(function(n,r){o.push([e,t,n,r])>1||a(e,t)})},t&&(r[e]=t(r[e])))}function a(e,t){try{(n=i[e](t)).value instanceof Fr?Promise.resolve(n.value.v).then(c,l):u(o[0][2],n)}catch(e){u(o[0][3],e)}var n}function c(e){a("next",e)}function l(e){a("throw",e)}function u(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function Br(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=xr(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,i){(function(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)})(r,i,(t=e[n](t)).done,t.value)})}}}function Mr(e){return"function"==typeof e}function Gr(e){var t=e(function(e){Error.call(e),e.stack=(new Error).stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}"function"==typeof SuppressedError&&SuppressedError;var jr=Gr(function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(e,t){return t+1+") "+e.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}});function Hr(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var zr=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var s=xr(o),a=s.next();!a.done;a=s.next()){a.value.remove(this)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else o.remove(this);var c=this.initialTeardown;if(Mr(c))try{c()}catch(e){i=e instanceof jr?e.errors:[e]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var u=xr(l),f=u.next();!f.done;f=u.next()){var d=f.value;try{Wr(d)}catch(e){i=null!=i?i:[],e instanceof jr?i=kr(kr([],Tr(i)),Tr(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}if(i)throw new jr(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)Wr(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Hr(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&Hr(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),qr=zr.EMPTY;function Vr(e){return e instanceof zr||e&&"closed"in e&&Mr(e.remove)&&Mr(e.add)&&Mr(e.unsubscribe)}function Wr(e){Mr(e)?e():e.unsubscribe()}var Zr={Promise:void 0},Kr=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,kr([e,t],Tr(n)))};function Yr(e){Kr(function(){throw e})}function Xr(){}function Jr(e){e()}var Qr=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,Vr(t)&&t.add(n)):n.destination=ri,n}return Or(t,e),t.create=function(e,t,n){return new ti(e,t,n)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(zr),ei=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){ni(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){ni(e)}else ni(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){ni(e)}},e}(),ti=function(e){function t(t,n,r){var i,o=e.call(this)||this;return i=Mr(t)||!t?{next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:t,o.destination=new ei(i),o}return Or(t,e),t}(Qr);function ni(e){Yr(e)}var ri={closed:!0,next:Xr,error:function(e){throw e},complete:Xr},ii="function"==typeof Symbol&&Symbol.observable||"@@observable";function oi(e){return e}var si=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r,i=this,o=(r=e)&&r instanceof Qr||function(e){return e&&Mr(e.next)&&Mr(e.error)&&Mr(e.complete)}(r)&&Vr(r)?e:new ti(e,t,n);return Jr(function(){var e=i,t=e.operator,n=e.source;o.add(t?t.call(o,n):n?i._subscribe(o):i._trySubscribe(o))}),o},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=ai(t))(function(t,r){var i=new ti({next:function(t){try{e(t)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t});n.subscribe(i)})},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[ii]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(0===(e=t).length?oi:1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=ai(e))(function(e,n){var r;t.subscribe(function(e){return r=e},function(e){return n(e)},function(){return e(r)})})},e.create=function(t){return new e(t)},e}();function ai(e){var t;return null!==(t=null!=e?e:Zr.Promise)&&void 0!==t?t:Promise}function ci(e){return function(t){if(function(e){return Mr(null==e?void 0:e.lift)}(t))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw new TypeError("Unable to lift unknown Observable type")}}function li(e,t,n,r,i){return new ui(e,t,n,r,i)}var ui=function(e){function t(t,n,r,i,o,s){var a=e.call(this,t)||this;return a.onFinalize=o,a.shouldUnsubscribe=s,a._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return Or(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(Qr),fi=Gr(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),di=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return Or(t,e),t.prototype.lift=function(e){var t=new pi(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new fi},t.prototype.next=function(e){var t=this;Jr(function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=xr(t.currentObservers),o=i.next();!o.done;o=i.next()){o.value.next(e)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}})},t.prototype.error=function(e){var t=this;Jr(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}})},t.prototype.complete=function(){var e=this;Jr(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,i=n.isStopped,o=n.observers;return r||i?qr:(this.currentObservers=null,o.push(e),new zr(function(){t.currentObservers=null,Hr(o,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},t.prototype.asObservable=function(){var e=new si;return e.source=this,e},t.create=function(e,t){return new pi(e,t)},t}(si),pi=function(e){function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return Or(t,e),t.prototype.next=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===n||n.call(t,e)},t.prototype.error=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===n||n.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,n;return null!==(n=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==n?n:qr},t}(di),hi=function(e){function t(t){var n=e.call(this)||this;return n._value=t,n}return Or(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},t.prototype.getValue=function(){var e=this,t=e.hasError,n=e.thrownError,r=e._value;if(t)throw n;return this._throwIfClosed(),r},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(di),mi={now:function(){return(mi.delegate||Date).now()},delegate:void 0},gi=function(e){function t(t,n,r){void 0===t&&(t=1/0),void 0===n&&(n=1/0),void 0===r&&(r=mi);var i=e.call(this)||this;return i._bufferSize=t,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,n),i}return Or(t,e),t.prototype.next=function(t){var n=this,r=n.isStopped,i=n._buffer,o=n._infiniteTimeWindow,s=n._timestampProvider,a=n._windowTime;r||(i.push(t),!o&&i.push(s.now()+a)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),n=this._infiniteTimeWindow,r=this._buffer.slice(),i=0;i<r.length&&!e.closed;i+=n?1:2)e.next(r[i]);return this._checkFinalizedStatuses(e),t},t.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,n=e._timestampProvider,r=e._buffer,i=e._infiniteTimeWindow,o=(i?1:2)*t;if(t<1/0&&o<r.length&&r.splice(0,r.length-o),!i){for(var s=n.now(),a=0,c=1;c<r.length&&r[c]<=s;c+=2)a=c;a&&r.splice(0,a+1)}},t}(di),vi=function(e){function t(t,n){return e.call(this)||this}return Or(t,e),t.prototype.schedule=function(e,t){return this},t}(zr),yi=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,kr([e,t],Tr(n)))},Ei=function(e){return clearInterval(e)},bi=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return Or(t,e),t.prototype.schedule=function(e,t){var n;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var r=this.id,i=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(i,r,t)),this.pending=!0,this.delay=t,this.id=null!==(n=this.id)&&void 0!==n?n:this.requestAsyncId(i,this.id,t),this},t.prototype.requestAsyncId=function(e,t,n){return void 0===n&&(n=0),yi(e.flush.bind(e,this),n)},t.prototype.recycleAsyncId=function(e,t,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return t;null!=t&&Ei(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(e,t);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var n,r=!1;try{this.work(e)}catch(e){r=!0,n=e||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Hr(r,this),null!=t&&(this.id=this.recycleAsyncId(n,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(vi),wi=function(){function e(t,n){void 0===n&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(e,t,n){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},e.now=mi.now,e}(),Li=function(e){function t(t,n){void 0===n&&(n=wi.now);var r=e.call(this,t,n)||this;return r.actions=[],r._active=!1,r}return Or(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var n;this._active=!0;do{if(n=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}}},t}(wi),Ii=new Li(bi),Si=Ii,Ci=new si(function(e){return e.complete()});function _i(e){return e&&Mr(e.schedule)}function Di(e){return e[e.length-1]}var Pi=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function Ni(e){return Mr(null==e?void 0:e.then)}function Oi(e){return Mr(e[ii])}function Ai(e){return Symbol.asyncIterator&&Mr(null==e?void 0:e[Symbol.asyncIterator])}function $i(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var Ri="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function xi(e){return Mr(null==e?void 0:e[Ri])}function Ti(e){return Ur(this,arguments,function(){var t,n,r;return Rr(this,function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,Fr(t.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,Fr(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,Fr(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function ki(e){return Mr(null==e?void 0:e.getReader)}function Fi(e){if(e instanceof si)return e;if(null!=e){if(Oi(e))return i=e,new si(function(e){var t=i[ii]();if(Mr(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(Pi(e))return r=e,new si(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()});if(Ni(e))return n=e,new si(function(e){n.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,Yr)});if(Ai(e))return Ui(e);if(xi(e))return t=e,new si(function(e){var n,r;try{for(var i=xr(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.next(s),e.closed)return}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()});if(ki(e))return Ui(Ti(e))}var t,n,r,i;throw $i(e)}function Ui(e){return new si(function(t){(function(e,t){var n,r,i,o;return $r(this,void 0,void 0,function(){var s,a;return Rr(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=Br(e),c.label=1;case 1:return[4,n.next()];case 2:if((r=c.sent()).done)return[3,4];if(s=r.value,t.next(s),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),i={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})})(e,t).catch(function(e){return t.error(e)})})}function Bi(e,t,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var o=t.schedule(function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(o),!i)return o}function Mi(e,t){return void 0===t&&(t=0),ci(function(n,r){n.subscribe(li(r,function(n){return Bi(r,e,function(){return r.next(n)},t)},function(){return Bi(r,e,function(){return r.complete()},t)},function(n){return Bi(r,e,function(){return r.error(n)},t)}))})}function Gi(e,t){return void 0===t&&(t=0),ci(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}function ji(e,t){if(!e)throw new Error("Iterable cannot be null");return new si(function(n){Bi(n,t,function(){var r=e[Symbol.asyncIterator]();Bi(n,t,function(){r.next().then(function(e){e.done?n.complete():n.next(e.value)})},0,!0)})})}function Hi(e,t){if(null!=e){if(Oi(e))return function(e,t){return Fi(e).pipe(Gi(t),Mi(t))}(e,t);if(Pi(e))return function(e,t){return new si(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}(e,t);if(Ni(e))return function(e,t){return Fi(e).pipe(Gi(t),Mi(t))}(e,t);if(Ai(e))return ji(e,t);if(xi(e))return function(e,t){return new si(function(n){var r;return Bi(n,t,function(){r=e[Ri](),Bi(n,t,function(){var e,t,i;try{t=(e=r.next()).value,i=e.done}catch(e){return void n.error(e)}i?n.complete():n.next(t)},0,!0)}),function(){return Mr(null==r?void 0:r.return)&&r.return()}})}(e,t);if(ki(e))return function(e,t){return ji(Ti(e),t)}(e,t)}throw $i(e)}function zi(e,t){return t?Hi(e,t):Fi(e)}function qi(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=function(e){return _i(Di(e))?e.pop():void 0}(e);return zi(e,n)}var Vi=Gr(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function Wi(e,t){var n="object"==typeof t;return new Promise(function(r,i){var o,s=!1;e.subscribe({next:function(e){o=e,s=!0},error:i,complete:function(){s?r(o):n?r(t.defaultValue):i(new Vi)}})})}function Zi(e,t){var n="object"==typeof t;return new Promise(function(r,i){var o=new ti({next:function(e){r(e),o.unsubscribe()},error:i,complete:function(){n?r(t.defaultValue):i(new Vi)}});e.subscribe(o)})}function Ki(e){return e instanceof Date&&!isNaN(e)}var Yi=Gr(function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}});function Xi(e){throw new Yi(e)}function Ji(e,t){return ci(function(n,r){var i=0;n.subscribe(li(r,function(n){r.next(e.call(t,n,i++))}))})}var Qi=Array.isArray;function eo(e){return Ji(function(t){return function(e,t){return Qi(t)?e.apply(void 0,kr([],Tr(t))):e(t)}(e,t)})}function to(e,t,n,r,i,o,s,a){var c=[],l=0,u=0,f=!1,d=function(){!f||c.length||l||t.complete()},p=function(e){return l<r?h(e):c.push(e)},h=function(e){o&&t.next(e),l++;var a=!1;Fi(n(e,u++)).subscribe(li(t,function(e){null==i||i(e),o?p(e):t.next(e)},function(){a=!0},void 0,function(){if(a)try{l--;for(var e=function(){var e=c.shift();s||h(e)};c.length&&l<r;)e();d()}catch(e){t.error(e)}}))};return e.subscribe(li(t,p,function(){f=!0,d()})),function(){null==a||a()}}function no(e,t,n){return void 0===n&&(n=1/0),Mr(t)?no(function(n,r){return Ji(function(e,i){return t(n,e,r,i)})(Fi(e(n,r)))},n):("number"==typeof t&&(n=t),ci(function(t,r){return to(t,r,e,n)}))}var ro=["addListener","removeListener"],io=["addEventListener","removeEventListener"],oo=["on","off"];function so(e,t,n,r){if(Mr(n)&&(r=n,n=void 0),r)return so(e,t,n).pipe(eo(r));var i=Tr(function(e){return Mr(e.addEventListener)&&Mr(e.removeEventListener)}(e)?io.map(function(r){return function(i){return e[r](t,i,n)}}):function(e){return Mr(e.addListener)&&Mr(e.removeListener)}(e)?ro.map(ao(e,t)):function(e){return Mr(e.on)&&Mr(e.off)}(e)?oo.map(ao(e,t)):[],2),o=i[0],s=i[1];if(!o&&Pi(e))return no(function(e){return so(e,t,n)})(Fi(e));if(!o)throw new TypeError("Invalid event target");return new si(function(e){var t=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.next(1<t.length?t:t[0])};return o(t),function(){return s(t)}})}function ao(e,t){return function(n){return function(r){return e[n](t,r)}}}function co(e,t,n){void 0===e&&(e=0),void 0===n&&(n=Si);var r=-1;return null!=t&&(_i(t)?n=t:r=t),new si(function(t){var i=Ki(e)?+e-n.now():e;i<0&&(i=0);var o=0;return n.schedule(function(){t.closed||(t.next(o++),0<=r?this.schedule(void 0,r):t.complete())},i)})}function lo(e,t){return ci(function(n,r){var i=0;n.subscribe(li(r,function(n){return e.call(t,n,i++)&&r.next(n)}))})}function uo(e){return ci(function(t,n){var r,i=null,o=!1;i=t.subscribe(li(n,void 0,void 0,function(s){r=Fi(e(s,uo(e)(t))),i?(i.unsubscribe(),i=null,r.subscribe(n)):o=!0})),o&&(i.unsubscribe(),i=null,r.subscribe(n))})}function fo(e,t,n,r,i){return function(o,s){var a=n,c=t,l=0;o.subscribe(li(s,function(t){var n=l++;c=a?e(c,t,n):(a=!0,t),r&&s.next(c)},i&&function(){a&&s.next(c),s.complete()}))}}function po(e,t){return ci(fo(e,t,arguments.length>=2,!1,!0))}function ho(e){return ci(function(t,n){var r=!1;t.subscribe(li(n,function(e){r=!0,n.next(e)},function(){r||n.next(e),n.complete()}))})}function mo(e,t){return void 0===t&&(t=oi),e=null!=e?e:go,ci(function(n,r){var i,o=!0;n.subscribe(li(r,function(n){var s=t(n);!o&&e(i,s)||(o=!1,i=s,r.next(n))}))})}function go(e,t){return e===t}function vo(e){return void 0===e&&(e=yo),ci(function(t,n){var r=!1;t.subscribe(li(n,function(e){r=!0,n.next(e)},function(){return r?n.complete():n.error(e())}))})}function yo(){return new Vi}function Eo(e){return ci(function(t,n){try{t.subscribe(n)}finally{n.add(e)}})}function bo(e,t){var n=arguments.length>=2;return function(e){return e.pipe(oi,(r=1)<=0?function(){return Ci}:ci(function(e,t){var n=[];e.subscribe(li(t,function(e){n.push(e),r<n.length&&n.shift()},function(){var e,r;try{for(var i=xr(n),o=i.next();!o.done;o=i.next()){var s=o.value;t.next(s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}t.complete()},void 0,function(){n=null}))}),n?ho(t):vo(function(){return new Vi}));var r}}function wo(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!0!==t){if(!1!==t){var i=new ti({next:function(){i.unsubscribe(),e()}});return Fi(t.apply(void 0,kr([],Tr(n)))).subscribe(i)}}else e()}function Lo(e,t){return ci(function(n,r){var i=null,o=0,s=!1,a=function(){return s&&!i&&r.complete()};n.subscribe(li(r,function(n){null==i||i.unsubscribe();var s=0,c=o++;Fi(e(n,c)).subscribe(i=li(r,function(e){return r.next(t?t(n,e,c,s++):e)},function(){i=null,a()}))},function(){s=!0,a()}))})}function Io(e){return ci(function(t,n){Fi(e).subscribe(li(n,function(){return n.complete()},Xr)),!n.closed&&t.subscribe(n)})}function So(e,t,n){var r=Mr(e)||t||n?{next:e,error:t,complete:n}:e;return r?ci(function(e,t){var n;null===(n=r.subscribe)||void 0===n||n.call(r);var i=!0;e.subscribe(li(t,function(e){var n;null===(n=r.next)||void 0===n||n.call(r,e),t.next(e)},function(){var e;i=!1,null===(e=r.complete)||void 0===e||e.call(r),t.complete()},function(e){var n;i=!1,null===(n=r.error)||void 0===n||n.call(r,e),t.error(e)},function(){var e,t;i&&(null===(e=r.unsubscribe)||void 0===e||e.call(r)),null===(t=r.finalize)||void 0===t||t.call(r)}))}):oi}function Co(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n,r=Mr(Di(n=e))?n.pop():void 0;return ci(function(t,n){for(var i=e.length,o=new Array(i),s=e.map(function(){return!1}),a=!1,c=function(t){Fi(e[t]).subscribe(li(n,function(e){o[t]=e,a||s[t]||(s[t]=!0,(a=s.every(oi))&&(s=null))},Xr))},l=0;l<i;l++)c(l);t.subscribe(li(n,function(e){if(a){var t=kr([e],Tr(o));n.next(r?r.apply(void 0,kr([],Tr(t))):t)}}))})}const _o=(e,t,n)=>{const r="string"==typeof t?t.split("."):t,i=r.shift();return i&&(e[i]??={},r.length?_o(e[i],r,n):Object.assign(e,{[i]:n})),e};class Do{#re={};createConfig(e,t){return zi(this._createConfig(e,t))}async createConfigAsync(e,t){return Wi(this.createConfig(e,t))}_set(e,t){const n="function"==typeof t?t:async()=>t;this.#re[e]=n}_get(e){return this.#re[e]}_has(e){return e in this.#re}_createConfig(e,t){return zi(this._buildConfig(e,t)).pipe(Lo(t=>this._processConfig(t,e)))}_buildConfig(e,t){return zi(Object.entries(this.#re)).pipe(no(([t,n])=>zi(n(e)).pipe(lo(e=>void 0!==e),Ji(e=>({target:t,value:e})),uo(e=>(console.error(`Failed to execute config callback: ${n.name} for attribute: '${t}'`,e),Ci)))),po((e,{target:t,value:n})=>_o(e,t,n),t??{}))}_processConfig(e,t){return qi(e)}}class Po extends Error{constructor(){super("Module initialization timed out"),this.name="RequiredModuleTimeoutError"}}const No="ModuleConfigurator",Oo={ModuleConfigAdded:`${No}.module.configAdded`,OnConfiguredAdded:`${No}.onConfigured.added`,OnInitializedAdded:`${No}.onInitialized.added`,PluginAdded:`${No}.plugin.added`,InitializeConfigLoaded:`${No}.config.loaded`,InitializeInstanceInitialized:`${No}.instance.initialized`,Initialize:`${No}.initialize.complete`,ConfiguratorCreated:`${No}.configurator.created`,ConfiguratorFailed:`${No}.configurator.failed`,ModulePostConfigured:`${No}.module.postConfigured`,ModulePostConfigureError:`${No}.module.postConfigureError`,PostConfigureHooks:`${No}.postConfigureHooks.started`,PostConfigureHooksComplete:`${No}.postConfigureHooks.complete`,PostConfigureHooksError:`${No}.postConfigureHooks.error`,ModuleInitializeError:`${No}.module.initializeError`,ModuleInitializing:`${No}.module.initializing`,ProviderNotBaseModuleProvider:`${No}.provider.invalidBase`,ProviderVersionWarning:`${No}.provider.versionMissing`,ModuleInitialized:`${No}.module.initialized`,RequireInstanceModuleNotDefined:`${No}.requireInstance.moduleNotDefined`,RequireInstanceModuleAlreadyInitialized:`${No}.requireInstance.moduleAlreadyInitialized`,RequireInstanceAwaitingModule:`${No}.requireInstance.awaitingModule`,RequireInstanceTimeout:`${No}.requireInstance.timeout`,RequireInstanceModuleResolved:`${No}.requireInstance.moduleResolved`,ModuleInitializeComplete:`${No}.modules.initializeComplete`,InitializeComplete:`${No}.initialize.instanceComplete`,ConfiguratorPostInitializeStart:`${No}.postInitialize.started`,ModulePostInitializeStart:`${No}.modulePostInitialize.started`,ModulePostInitializeComplete:`${No}.modulePostInitialize.complete`,ModulePostInitializeError:`${No}.modulePostInitialize.error`,PostInitializeComplete:`${No}.postInitialize.complete`,PostInitializeCompleteNoHooks:`${No}.postInitialize.noHooks`,PostInitializeHooks:`${No}.postInitializeHooks.started`,PostInitializeHooksComplete:`${No}.postInitializeHooks.complete`,PostInitializeHooksError:`${No}.postInitializeHooks.error`,PluginsRegister:`${No}.plugins.registering`,PluginRegistered:`${No}.plugin.registered`,PluginRegisterError:`${No}.plugin.registerError`,PluginsRegistered:`${No}.plugins.registered`,Dispose:`${No}.dispose.started`,PluginsDisposing:`${No}.plugins.disposing`,PluginDisposed:`${No}.plugin.disposed`,PluginDisposeError:`${No}.plugin.disposeError`,ModulesDispose:`${No}.modules.disposing`,ModuleDisposed:`${No}.module.disposed`,ModuleDisposeError:`${No}.module.disposeError`,ModulesDisposed:`${No}.modules.disposed`};var Ao;async function $o(e,t){const n=await async function(e,t){const{modules:n,afterConfiguration:r,afterInit:i,registerEvent:o}=e;return Wi(zi(n).pipe(no(async e=>{const n=performance.now();try{const r=await(e.configure?.(t)),i=Math.round(performance.now()-n);return o({level:Ao.Debug,name:Oo.ConfiguratorCreated,message:`Configurator created for ${e.name} in ${i}ms`,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown",configLoadTime:i},metric:i}),{[e.name]:r}}catch(t){throw o({level:Ao.Error,name:Oo.ConfiguratorFailed,message:`Failed to create configurator for ${e.name}`,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown"},metric:Math.round(performance.now()-n),error:t}),t}}),po((e,t)=>Object.assign(e,t),{onAfterConfiguration(e){r.push(e)},onAfterInit(e){i.push(e)}})))}(e,t);return await Promise.all(e.configs.map(e=>Promise.resolve(e(n,t)))),await async function(e,t){const{modules:n,afterConfiguration:r,registerEvent:i}=e;if(await Promise.allSettled(n.filter(e=>!!e.postConfigure).map(async e=>{try{const n=performance.now();await(e.postConfigure?.(t)),i({level:Ao.Debug,name:Oo.ModulePostConfigured,message:`Module ${e.name} post-configured successfully`,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown",postConfigTime:Math.round(performance.now()-n)}})}catch(t){i({level:Ao.Warning,name:Oo.ModulePostConfigureError,message:`Module ${e.name} post-configure failed`,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown"},error:t})}})),r.length)try{i({level:Ao.Debug,name:Oo.PostConfigureHooks,message:`Post configure hooks [${r.length}] called`});const e=performance.now();await Promise.allSettled(r.map(e=>Promise.resolve(e(t))));const n=Math.round(performance.now()-e);i({level:Ao.Debug,name:Oo.PostConfigureHooksComplete,message:"Post configure hooks complete",properties:{count:r.length,postConfigHooksTime:n},metric:n})}catch(e){i({level:Ao.Warning,name:Oo.PostConfigureHooksError,message:"Post configure hook failed",error:e})}}(e,n),n}!function(e){e[e.Debug=0]="Debug",e[e.Information=1]="Information",e[e.Warning=2]="Warning",e[e.Error=3]="Error",e[e.Critical=4]="Critical"}(Ao||(Ao={}));class Ro{static[Symbol.hasInstance](e){if(null!==e&&"object"==typeof e&&"version"in e&&"dispose"in e){const t=e,n=O(String(t.version)),r=t.dispose;return!!n&&"function"==typeof r}return!1}#ie;#oe;get version(){return this.#ie}constructor(e){const{version:t}=e;this.#ie=new Pr(t),this.#oe=new zr}_addTeardown(e){return this.#oe.add(e),()=>this.#oe.remove(e)}dispose(){this.#oe.unsubscribe()}}function xo(e,t,n){return function(r,i=60){if(!e.includes(r)){const e=new Error(`Cannot require [${String(r)}] since module is not defined!`);throw e.name="ModuleNotDefinedError",n({level:Ao.Error,name:Oo.RequireInstanceModuleNotDefined,message:e.message,properties:{moduleName:String(r),wait:i},error:e}),e}if(t.value[r])return n({level:Ao.Debug,name:Oo.RequireInstanceModuleAlreadyInitialized,message:`Module [${String(r)}] is already initialized, skipping queue`,properties:{moduleName:String(r),wait:i}}),Promise.resolve(t.value[r]);const o=performance.now();return n({level:Ao.Debug,name:Oo.RequireInstanceAwaitingModule,message:`Awaiting module [${String(r)}] initialization, timeout ${i}s`,properties:{moduleName:String(r),wait:i}}),Zi(t.pipe(lo(e=>!!e[r]),Ji(e=>e[r]),function(e){var t=Ki(e)?{first:e}:"number"==typeof e?{each:e}:e,n=t.first,r=t.each,i=t.with,o=void 0===i?Xi:i,s=t.scheduler,a=void 0===s?Ii:s,c=t.meta,l=void 0===c?null:c;if(null==n&&null==r)throw new TypeError("No timeout provided.");return ci(function(e,t){var i,s,c=null,u=0,f=function(e){s=Bi(t,a,function(){try{i.unsubscribe(),Fi(o({meta:l,lastValue:c,seen:u})).subscribe(t)}catch(e){t.error(e)}},e)};i=e.subscribe(li(t,function(e){null==s||s.unsubscribe(),u++,t.next(c=e),r>0&&f(r)},void 0,void 0,function(){(null==s?void 0:s.closed)||null==s||s.unsubscribe(),c=null})),!u&&f(null!=n?"number"==typeof n?n:+n-a.now():r)})}({each:1e3*i,with:()=>{return t=Mr(e=()=>{const e=new Po;return n({level:Ao.Error,name:Oo.RequireInstanceTimeout,message:`Module [${String(r)}] initialization timed out after ${i}s`,properties:{moduleName:String(r),wait:i},error:e}),e})?e:function(){return e},new si(function(e){return e.error(t())});var e,t}}),So(()=>{const e=Math.round(performance.now()-o);n({level:Ao.Debug,name:Oo.RequireInstanceModuleResolved,message:`Module [${String(r)}] required in ${e}ms`,properties:{moduleName:String(r),wait:i,requireTime:e},metric:e})})))}}async function To(e,t,n){const{modules:r,registerEvent:i}=e;if(0===r.length)return Object.seal({});const o=r.map(e=>e.name),s=new hi({}),a=e=>o.includes(e),c=xo(o,s,i),l=zi(r).pipe(no(e=>async function(e,t){const{config:n,ref:r,requireInstance:i,hasModule:o,registerEvent:s}=t,a=e.name;if(!e.initialize){const t=new Error(`Module ${e.name} does not have initialize method`);throw t.name="ModuleInitializeError",s({level:Ao.Error,name:Oo.ModuleInitializeError,message:t.message,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown"},error:t}),t}s({level:Ao.Debug,name:Oo.ModuleInitializing,message:`Initializing module ${e.name}`,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown"}});const c=performance.now(),l=await e.initialize({ref:r,config:n[a],requireInstance:i,hasModule:o});l instanceof Ro||s({level:Ao.Warning,name:Oo.ProviderNotBaseModuleProvider,message:`Provider for module ${e.name} does not extend BaseModuleProvider`,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown"}});const u=l;u.version||s({level:Ao.Warning,name:Oo.ProviderVersionWarning,message:`Provider for module ${e.name} does not expose version`,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown"}});const f=Math.round(performance.now()-c);return s({level:Ao.Debug,name:Oo.ModuleInitialized,message:`Module ${e.name} initialized in ${f}ms`,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown",providerName:typeof l,providerVersion:u.version?.toString()||"unknown",moduleInitTime:f},metric:f}),[a,l]}(e,{config:t,ref:n,requireInstance:c,hasModule:a,registerEvent:i}))),u=performance.now();l.subscribe({next:([e,t])=>{const n=Object.assign(s.value,{[e]:t});s.next(n)},error:e=>{i({level:Ao.Error,name:Oo.ModuleInitializeError,message:`Failed to initialize module ${e.name||"unknown"}`,error:e}),s.error(e)},complete:()=>{const e=Math.round(performance.now()-u);i({level:Ao.Debug,name:Oo.ModuleInitializeComplete,message:`All modules initialized in ${e}ms`,properties:{modules:Object.keys(s.value).join(", "),loadTime:e},metric:e}),s.complete()}});const f=performance.now(),d=await Wi(s),p=Math.round(performance.now()-f);return i({level:Ao.Debug,name:Oo.InitializeComplete,message:`Modules instance created in ${p}ms`,properties:{modules:Object.keys(d).join(", "),initTime:p},metric:p}),Object.seal(d),d}function ko(e){return"function"==typeof e?e.name||"anonymous":"dispose"}async function Fo(e){"function"!=typeof e?await e.dispose():await e()}class Uo{static className="ModulesConfigurator";get version(){return"6.1.4"}#se=new gi(100);get event$(){return this.#se.asObservable()}_configs=[];_afterConfiguration=[];_afterInit=[];_plugins=[];_pluginTeardowns=[];_modules;constructor(e){this._modules=new Set(e?this._dedupeModulesByName(e):[])}_dedupeModulesByName(e){const t=new Map;for(const n of e)t.set(n.name,n);return Array.from(t.values())}_removeModuleCallbacks(e){this._configs=this._configs.filter(t=>t.moduleName!==e),this._afterConfiguration=this._afterConfiguration.filter(t=>t.moduleName!==e),this._afterInit=this._afterInit.filter(t=>t.moduleName!==e)}get modules(){return[...this._modules]}configure(...e){for(const t of e)this.addConfig(t)}addConfig(e){const{module:t,afterConfig:n,afterInit:r,configure:i}=e,o=Array.from(this._modules).find(e=>e.name===t.name);if(o){if(o!==t){this._removeModuleCallbacks(t.name);const e=Array.from(this._modules).map(e=>e.name===t.name?t:e);this._modules=new Set(e)}}else this._modules.add(t);if(this._registerEvent({level:Ao.Debug,name:Oo.ModuleConfigAdded,message:`Module configurator added for ${t.name}`,properties:{moduleName:t.name,moduleVersion:t.version?.toString()||"unknown",configure:!!i,afterConfig:!!n,afterInit:!!r}}),i){const e=(e,n)=>i(e[t.name],n);e.moduleName=t.name,this._configs.push(e)}if(n){const e=e=>n(e[t.name]);e.moduleName=t.name,this._afterConfiguration.push(e)}if(r){const e=e=>r(e[t.name]);e.moduleName=t.name,this._afterInit.push(e)}}onConfigured(e){this._afterConfiguration.push(e),this._registerEvent({level:Ao.Debug,name:Oo.OnConfiguredAdded,message:"Added onConfigured callback",properties:{count:this._afterConfiguration.length,name:e.name||"anonymous"}})}onInitialized(e){this._afterInit.push(e),this._registerEvent({level:Ao.Debug,name:Oo.OnInitializedAdded,message:"Added onInitialized callback",properties:{count:this._afterInit.length,name:e.name||"anonymous"}})}registerPlugin(e){this._plugins.push(e),this._registerEvent({level:Ao.Debug,name:Oo.PluginAdded,message:"Added plugin callback",properties:{count:this._plugins.length,name:e.name||"anonymous"}})}async initialize(e){const t=performance.now(),n=await this._configure(e),r=Math.round(performance.now()-t),i=this.modules.map(e=>e.name).join(", ");this._registerEvent({level:Ao.Debug,name:Oo.InitializeConfigLoaded,message:`Modules configured in ${r}ms`,properties:{modules:i,count:this.modules.length,loadTime:r},metric:r});const o=performance.now(),s=await this._initialize(n,e),a=Math.round(performance.now()-o),c=this.modules.map(e=>e.name).join(", ");this._registerEvent({level:Ao.Debug,name:Oo.InitializeInstanceInitialized,message:`Modules initialized in ${a}ms`,properties:{modules:c,count:this.modules.length,loadTime:a},metric:a});const l=r+a,u=this.modules.map(e=>e.name).join(", ");this._registerEvent({level:Ao.Information,name:Oo.Initialize,message:`initialize in ${l}ms`,properties:{modules:u,configLoadTime:r,instanceLoadTime:a,totalLoadTime:l},metric:l}),await this._postInitialize(s,e);const f=Object.seal(Object.assign({},s,{dispose:()=>this.dispose(s)}));return await this._registerPlugins(f,e),f}_registerEvent(e){const t=e.name.split("::");this.#se.next({...e,name:`${this.constructor.className}::${t[t.length-1]}`})}async _configure(e){return $o({modules:this.modules,configs:this._configs,afterConfiguration:this._afterConfiguration,afterInit:this._afterInit,registerEvent:this._registerEvent.bind(this)},e)}async _initialize(e,t){return To({modules:this.modules,registerEvent:this._registerEvent.bind(this)},e,t)}async _postInitialize(e,t){return async function(e,t,n){const{modules:r,afterInit:i,registerEvent:o}=e;o({level:Ao.Debug,name:Oo.ConfiguratorPostInitializeStart,message:`Post-initializing all modules [${Object.keys(t).length}]`,properties:{modules:Object.keys(t).join(", ")}});const s=zi(r).pipe(lo(e=>!!e.postInitialize),So(e=>{o({level:Ao.Debug,name:Oo.ModulePostInitializeStart,message:`Module ${e.name} is being post-initialized`,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown"}})}),no(e=>{const r=performance.now();return zi(e.postInitialize({ref:n,modules:t,instance:t[e.name]})).pipe(So(()=>{const t=Math.round(performance.now()-r);o({level:Ao.Debug,name:Oo.ModulePostInitializeComplete,message:`Module ${e.name} has been post-initialized in ${t}ms`,metric:t,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown",postInitTime:t}})}),ho(null),uo(t=>(o({level:Ao.Warning,name:Oo.ModulePostInitializeError,message:`Module ${e.name} post-initialize failed`,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown"},error:t}),Ci)))}),ho(null)),a=performance.now();await Wi(s);const c=Math.round(performance.now()-a);if(o({level:Ao.Debug,name:Oo.PostInitializeComplete,message:`Post-initialization of all modules completed in ${c}ms`,properties:{modules:Object.keys(t).join(", "),postInitTime:c},metric:c}),!i.length)return void o({level:Ao.Debug,name:Oo.PostInitializeCompleteNoHooks,message:"Post-initialization complete",properties:{modules:Object.keys(t).join(", "),postInitCompleteTime:c}});try{const e=i.map(e=>e.name||"anonymous").join(", ");o({level:Ao.Debug,name:Oo.PostInitializeHooks,message:`Executing post-initialize hooks [${i.length}]`,properties:{hooks:e}});const n=performance.now();await Promise.allSettled(i.map(e=>Promise.resolve(e(t))));const r=Math.round(performance.now()-n);o({level:Ao.Debug,name:Oo.PostInitializeHooksComplete,message:`Post-initialize hooks completed in ${r}ms`,properties:{hooks:e,afterInitTime:r},metric:r})}catch(e){const t=i.map(e=>e.name||"anonymous").join(", ");o({level:Ao.Warning,name:Oo.PostInitializeHooksError,message:"Post-initialize hooks failed",properties:{hooks:t},error:e})}const l=Math.round(performance.now()-a);o({level:Ao.Debug,name:Oo.PostInitializeComplete,message:"Post-initialization complete",properties:{modules:Object.keys(t).join(", "),postInitCompleteTime:l}})}({modules:this.modules,afterInit:this._afterInit,registerEvent:this._registerEvent.bind(this)},e,t)}async _registerPlugins(e,t){return async function(e,t,n){const{plugins:r,teardowns:i,registerEvent:o}=e;if(!r.length)return;o({level:Ao.Debug,name:Oo.PluginsRegister,message:`Registering plugins [${r.length}]`,properties:{count:r.length}});const s=await Promise.all(r.map(async e=>{const r=performance.now(),i=e.name||"anonymous";try{const a=await e({modules:t,ref:n}),c=Math.round(performance.now()-r);return o({level:Ao.Debug,name:Oo.PluginRegistered,message:`Plugin ${i} registered in ${c}ms`,properties:{name:i,pluginTime:c},metric:c}),"function"==typeof(s=a)||"object"==typeof s&&null!==s&&"dispose"in s&&"function"==typeof s.dispose?a:void 0}catch(e){return void o({level:Ao.Warning,name:Oo.PluginRegisterError,message:`Plugin ${i} registration failed`,properties:{name:i},error:e})}var s}));for(const e of s)e&&i.push(e);o({level:Ao.Debug,name:Oo.PluginsRegistered,message:"Plugin registration complete",properties:{count:r.length,teardowns:i.length}})}({plugins:this._plugins,teardowns:this._pluginTeardowns,registerEvent:this._registerEvent.bind(this)},e,t)}async dispose(e,t){return async function(e,t,n){const{modules:r,registerEvent:i,event$:o,pluginTeardowns:s=[]}=e;if(i({level:Ao.Debug,name:Oo.Dispose,message:"Disposing modules instance",properties:{modules:Object.keys(t).join(", ")}}),s.length){i({level:Ao.Debug,name:Oo.PluginsDisposing,message:`Disposing plugins [${s.length}]`,properties:{count:s.length}});for(const e of s.splice(0).reverse()){const t=ko(e);try{await Fo(e),i({level:Ao.Debug,name:Oo.PluginDisposed,message:`Plugin ${t} disposed successfully`,properties:{name:t}})}catch(e){i({level:Ao.Warning,name:Oo.PluginDisposeError,message:`Plugin ${t} dispose failed`,properties:{name:t},error:e})}}}i({level:Ao.Debug,name:Oo.ModulesDispose,message:"Disposing modules",properties:{count:r.length}}),await Promise.allSettled(r.filter(e=>!!e.dispose).map(async e=>{if(e.dispose)try{await e.dispose({ref:n,modules:t,instance:t[e.name]}),i({level:Ao.Debug,name:Oo.ModuleDisposed,message:`Module ${e.name} disposed successfully`,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown"}})}catch(t){i({level:Ao.Warning,name:Oo.ModuleDisposeError,message:`Module ${e.name} dispose failed`,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown"},error:t})}})),i({level:Ao.Debug,name:Oo.ModulesDisposed,message:"Module dispose complete",properties:{count:r.length}}),o.complete()}({modules:this.modules,registerEvent:this._registerEvent.bind(this),event$:this.#se,pluginTeardowns:this._pluginTeardowns},e,t)}}class Bo{_operators;get operators(){return this._operators}constructor(e){this._operators=e&&"operators"in e?{...e.operators}:e??{}}add(e,t){if(Object.keys(this._operators).includes(e))throw Error(`Operator [${e}] already defined`);return this.set(e,t)}set(e,t){return this._operators[e]=t,this}remove(e){return delete this._operators[e],this}get(e){return this._operators[e]}process(e){return Object.values(this._operators).length?zi(Object.values(this._operators)).pipe((t=(e,t)=>Promise.resolve(t(e)).then(t=>t??e),n=e,r=1,ci(function(e,i){var o=n;return to(e,i,function(e,n){return t(o,e,n)},r,function(e){o=e},!1,void 0,function(){return o=null})})),bo()):qi(e);var t,n,r}}class Mo extends Bo{setHeader(e,t){const n=((e,t)=>n=>{const r=new Headers(n.headers);return r.append(e,t),{...n,headers:r}})(e,t);return this.set(`header-${e}`,n)}}class Go extends Bo{}class jo{#ae;constructor(e){this.#ae=e?[...e.middleware]:[]}get middleware(){return this.#ae}use(e){return this.#ae.push(e),this}process(e,t,n){const r=this.#ae.reduceRight((e,t)=>(n,r)=>t(n,r,(t,n)=>function(e){return e instanceof Response?Promise.resolve(e):Zi(zi(e))}(e(t,n))),n),i=r(e,t);return i instanceof Response?qi(i):zi(i)}}const Ho=x.object({attributionReporting:x.object({eventSourceEligible:x.boolean().optional(),triggerEligible:x.boolean().optional()}).optional(),body:x.union([x.string(),x.instanceof(Blob),x.instanceof(ArrayBuffer),x.instanceof(FormData),x.instanceof(URLSearchParams),x.instanceof(ReadableStream)]).optional(),browsingTopics:x.boolean().optional(),cache:x.enum(["default","no-store","reload","no-cache","force-cache","only-if-cached"]).optional(),credentials:x.enum(["omit","same-origin","include"]).optional(),headers:x.record(x.string(),x.string()).optional().or(x.instanceof(Headers)),integrity:x.string().optional(),keepalive:x.boolean().optional(),method:x.enum(["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD","CONNECT","TRACE"],{message:"Invalid request method. Expected one of: GET, POST, PUT, DELETE, PATCH, OPTIONS, HEAD, CONNECT, TRACE. See RFC 2615 Section 9 for more information: https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html"}).optional().optional(),mode:x.enum(["same-origin","cors","no-cors","navigate","websocket"]).optional(),priority:x.enum(["low","high","auto"]).optional(),redirect:x.enum(["follow","error","manual"]).optional(),referrer:x.string().optional(),referrerPolicy:x.enum(["no-referrer","no-referrer-when-downgrade","origin","origin-when-cross-origin","same-origin","strict-origin","strict-origin-when-cross-origin","unsafe-url"]).optional(),signal:x.instanceof(AbortSignal).optional()}).extend({uri:x.string(),path:x.string().optional()}),zo=e=>e=>{const{error:t,success:n,data:r}=x.string().optional().refine(e=>void 0===e||e===e?.toUpperCase(),{message:["Provided HTTP method must be in uppercase.","See RFC 7231 Section 4.1 for more information","https://www.rfc-editor.org/rfc/rfc7231#section-4.1"].join(" ")}).safeParse(e.method);if(e.method=n?r:e.method?.toUpperCase(),t)for(const e of t.issues)console.warn(e.message);return e},qo=e=>e=>{const{strict:t,parse:n}={},r=t?Ho:Ho.passthrough();try{const t=r.parse(e);return n?t:void 0}catch(e){if(n)throw e;console.error("Invalid request options",e.message)}},Vo=e=>{try{return JSON.parse(e)}catch{return e}};function*Wo(e,t){const n=e.split("\n\n"),r=t?.dataParser||Vo;for(const e of n){if(!e.trim())continue;const t=e.split("\n").reduce((e,t)=>{if(!t)return e;const n=t.indexOf(":");if(-1===n)return e;const i=t.slice(0,n).trim(),o=t.slice(n+1).trim();return"data"===i?e.data=r(o):e[i]=o,e},{});Object.keys(t).length&&(yield t)}}const Zo=e=>t=>{if(!t.ok)throw new Ir(`HTTP error! Status: ${t.status}`,t);if(!t.body)throw new Ir("Response body is not readable",t);if(!t.headers.get("Content-Type")?.includes("text/event-stream"))throw new Ir("Response is not a text/event-stream",t);const n=t.body.getReader();return zi(async function*(e,t){const n=!!t?.skipHeartbeats,r=t?.eventFilter?Array.isArray(t.eventFilter)?t.eventFilter:[t.eventFilter]:null,i=new TextDecoder;for(;;){const{done:o,value:s}=await e.read();if(o)break;const a=Wo(i.decode(s,{stream:!0}),{dataParser:t?.dataParser});for(const e of a)if(e.retry)await new Promise(t=>setTimeout(t,Number.parseInt(e.retry??"300",10)));else{if(n){if(!e.event&&!e.data&&!e.id)continue;if(e.event&&["heartbeat","ping"].includes(e.event))continue}(!r||e.event&&r.includes(e.event))&&(yield e)}}}(n,{dataParser:e?.dataParser,skipHeartbeats:e?.skipHeartbeats,eventFilter:e?.eventFilter})).pipe(Io(e?.abortSignal?so(e.abortSignal,"abort"):Ci),Eo(async()=>{await n.cancel().catch(()=>{}),n.releaseLock()}))};class Ko{_clients={};get clients(){return{...this._clients}}defaultHttpClientCtor;defaultHttpRequestHandler=new Mo({"capitalize-method":zo(),"request-validation":qo()});defaultHttpMiddlewareHandler=new jo;constructor(e){this.defaultHttpClientCtor=e}hasClient(e){return Object.keys(this._clients).includes(e)}addMiddleware(e){return this.defaultHttpMiddlewareHandler.use(e),this}configureClient(e,t){const n="string"==typeof t?{baseUri:t}:t,r="function"==typeof n?{onCreate:n}:n;return this._clients[e]={...this._clients[e],...r},this}}const Yo=["http:","https:","ws:","wss:"];class Xo extends Ro{config;get defaultHttpRequestHandler(){return this.config.defaultHttpRequestHandler}get defaultHttpMiddlewareHandler(){return this.config.defaultHttpMiddlewareHandler}constructor(e){super({version:"8.1.1",config:e}),this.config=e}hasClient(e){return Object.keys(this.config.clients).includes(e)}createClient(e){const t=this._resolveConfig(e),{baseUri:n,defaultScopes:r=[],onCreate:i,ctor:o=this.config.defaultHttpClientCtor,requestHandler:s=this.defaultHttpRequestHandler,responseHandler:a,middlewareHandler:c=this.defaultHttpMiddlewareHandler}=t,l=new o(n||"",{requestHandler:s,responseHandler:a,middlewareHandler:c});return Object.assign(l,{defaultScopes:r}),i?.(l),l}createCustomClient(e){return this.createClient(e)}_resolveConfig(e){if("string"==typeof e){const n=this.config.clients[e];if(!n&&(e=>{try{const t=new URL(e);return Yo.includes(t.protocol)}catch{return!1}})(e))return{baseUri:e};if(!n&&!(t=e).includes(" ")&&/^[a-z\d]([a-z\d-]*\.)+[a-z]{2,}/i.test(t))return console.warn(`[HttpClientProvider] "${e}" looks like a URL but is missing the http:// or https:// protocol. Treating it as "https://${e}". Pass a fully-qualified URL to silence this warning.`),{baseUri:`https://${e}`};if(!n)throw new Sr(`No registered http client for key [${e}]`);return n}var t;return e}}function Jo(e,t){void 0===t&&(t={});var n=t.selector,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(t,["selector"]);return new si(function(t){var i=new AbortController,o=i.signal,s=!0,a=r.signal;if(a)if(a.aborted)i.abort();else{var c=function(){o.aborted||i.abort()};a.addEventListener("abort",c),t.add(function(){return a.removeEventListener("abort",c)})}var l=Ar(Ar({},r),{signal:o}),u=function(e){s=!1,t.error(e)};return fetch(e,l).then(function(e){n?Fi(n(e)).subscribe(li(t,void 0,function(){s=!1,t.complete()},u)):(s=!1,t.next(e),t.complete())}).catch(u),function(){s&&i.abort()}})}const Qo=async e=>{if(204===e.status)return Promise.resolve();try{const t=await e.json();if(!e.ok)throw new Lr("network response was not OK",e,{data:t});return t}catch(t){if(t instanceof Lr)throw t;throw new Lr("failed to parse response",e,{cause:t})}},es=async e=>{if(!e.ok)throw new Error("network response was not OK");if(204===e.status)throw new Error("no content");const t=e.headers.get("content-disposition")?.split(";").find(e=>e.includes("filename="))?.replace("filename=","")?.trim();try{return{filename:t,blob:await e.blob()}}catch(e){throw Error("failed to parse response")}};class ts{uri;requestHandler;responseHandler;middlewareHandler;_request$=new di;_response$=new di;_abort$=new di;get request$(){return this._request$.asObservable()}get response$(){return this._response$.asObservable()}constructor(e,t){this.uri=e,this.requestHandler=new Mo(t?.requestHandler),this.responseHandler=new Go(t?.responseHandler),this.middlewareHandler=new jo(t?.middlewareHandler),this._init()}_init(){}fetch$(e,t){return this._fetch$(e,t)}fetch(e,t){return Zi(this.fetch$(e,t))}fetchAsync(e,t){return this.fetch(e,t)}json$(e,t){const n="object"==typeof t?.body?JSON.stringify(t?.body):t?.body,r=t?.selector??Qo,i=new Headers(t?.headers);return i.append("Accept","application/json"),i.append("Content-Type","application/json"),this.fetch$(e,{...t,body:n,selector:r,headers:i})}json(e,t){return Zi(this.json$(e,t))}blob$(e,t){const n=t?.selector??es,r={...t,selector:n};return this.fetch$(e,r)}blob(e,t){return Zi(this.blob$(e,t))}sse$(e,t,n){const r=new Headers(t?.headers);r.append("Accept","text/event-stream"),r.append("Content-Type","text/event-stream"),r.append("Cache-Control","no-cache"),r.append("Connection","keep-alive");const i=Zo({...n,abortSignal:t?.signal});return this._fetch$(e,{selector:i,...t,headers:r})}jsonAsync(e,t){return this.json(e,t)}execute(e,t,n){return this[e](t,n)}abort(){this._abort$.next()}_fetch$(e,t){const{selector:n,...r}=t||{},i=new AbortController,o=this._abort$.pipe((s=1,s<=0?function(){return Ci}:ci(function(e,t){var n=0;e.subscribe(li(t,function(e){++n<=s&&(t.next(e),s<=n&&t.complete())}))}))).subscribe(()=>i.abort());var s;const a=r.signal,c=a?AbortSignal.any([a,i.signal]):i.signal;return qi({...r,signal:c,path:e,uri:this._resolveUrl(e)}).pipe(Lo(e=>this._prepareRequest(e)),So(e=>this._request$.next(e)),Lo(({uri:e,path:t,...n})=>this.middlewareHandler.process(e,n,(e,t)=>this._performFetch(e,t))),Lo(e=>this._prepareResponse(e)),So(e=>this._response$.next(e)),Lo(e=>{if(n)try{return n(e)}catch(t){throw new wr("failed to execute response selector",e,{cause:t})}return qi(e)}),Io(this._abort$),Eo(()=>o.unsubscribe()))}_performFetch(e,t){return Jo(e,t)}_prepareRequest(e){return this.requestHandler.process(e)}_prepareResponse(e){return this.responseHandler.process(e)}_resolveUrl(e){const{origin:t,pathname:n}=new URL(this.uri,this.uri.startsWith("http")?void 0:window.location.origin),r=[n,e].join("/").replace(/\/{2,}/g,"/");return new URL(r,t).href}}class ns extends ts{defaultScopes=[];fetch$(e,t){const n={...t,scopes:this.defaultScopes.concat(t?.scopes||[])};return super._fetch$(e,n)}}const rs={name:"http",configure:()=>new Ko(ns),initialize:async({config:e,hasModule:t,requireInstance:n})=>{const r=new Xo(e);if(t("auth")){const e=await n("auth");r.defaultHttpRequestHandler.set("MSAL",async t=>{const{scopes:n=[]}=t;if(n.length){const r=await e.acquireAccessToken({request:{scopes:n}});if(r){const e=new Headers(t.headers);return e.set("Authorization",`Bearer ${r}`),{...t,headers:e}}}})}return r}},is=(...e)=>t=>t.pipe(function(e,t){return Mr(t)?no(e,t,1):no(e,1)}(...e)),os=(...e)=>t=>t.pipe(no(...e)),ss=(...e)=>t=>t.pipe(Lo(...e)),as=e=>e.pipe(Ji(e=>e.value));var cs=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function ls(e){if(!function(e){return"string"==typeof e&&cs.test(e)}(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,255&t,(t=parseInt(e.slice(9,13),16))>>>8,255&t,(t=parseInt(e.slice(14,18),16))>>>8,255&t,(t=parseInt(e.slice(19,23),16))>>>8,255&t,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,255&t)}const us=[];for(let e=0;e<256;++e)us.push((e+256).toString(16).slice(1));function fs(e,t=0){return(us[e[t+0]]+us[e[t+1]]+us[e[t+2]]+us[e[t+3]]+"-"+us[e[t+4]]+us[e[t+5]]+"-"+us[e[t+6]]+us[e[t+7]]+"-"+us[e[t+8]]+us[e[t+9]]+"-"+us[e[t+10]]+us[e[t+11]]+us[e[t+12]]+us[e[t+13]]+us[e[t+14]]+us[e[t+15]]).toLowerCase()}const ds=new Uint8Array(16);function ps(e,t,n,r,i,o){const s="string"==typeof n?function(e){e=unescape(encodeURIComponent(e));const t=new Uint8Array(e.length);for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}(n):n,a="string"==typeof r?ls(r):r;if("string"==typeof r&&(r=ls(r)),16!==r?.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+s.length);if(c.set(a),c.set(s,a.length),c=t(c),c[6]=15&c[6]|e,c[8]=63&c[8]|128,i){if(o??=0,o<0||o+16>i.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`);for(let e=0;e<16;++e)i[o+e]=c[e];return i}return fs(c)}function hs(e,t,n){return crypto.randomUUID?crypto.randomUUID():function(e){e=e||{};const t=e.random??e.rng?.()??crypto.getRandomValues(ds);if(t.length<16)throw new Error("Random bytes length must be >= 16");return t[6]=15&t[6]|64,t[8]=63&t[8]|128,fs(t)}(e)}function ms(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:case 3:return t^n^r;case 2:return t&n^t&r^n&r}}function gs(e,t){return e<<t|e>>>32-t}function vs(e){const t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520],r=new Uint8Array(e.length+1);r.set(e),r[e.length]=128;const i=(e=r).length/4+2,o=Math.ceil(i/16),s=new Array(o);for(let t=0;t<o;++t){const n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=e[64*t+4*r]<<24|e[64*t+4*r+1]<<16|e[64*t+4*r+2]<<8|e[64*t+4*r+3];s[t]=n}s[o-1][14]=8*(e.length-1)/2**32,s[o-1][14]=Math.floor(s[o-1][14]),s[o-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<o;++e){const r=new Uint32Array(80);for(let t=0;t<16;++t)r[t]=s[e][t];for(let e=16;e<80;++e)r[e]=gs(r[e-3]^r[e-8]^r[e-14]^r[e-16],1);let i=n[0],o=n[1],a=n[2],c=n[3],l=n[4];for(let e=0;e<80;++e){const n=Math.floor(e/20),s=gs(i,5)+ms(n,o,a,c)+l+t[n]+r[e]>>>0;l=c,c=a,a=gs(o,30)>>>0,o=i,i=s}n[0]=n[0]+i>>>0,n[1]=n[1]+o>>>0,n[2]=n[2]+a>>>0,n[3]=n[3]+c>>>0,n[4]=n[4]+l>>>0}return Uint8Array.of(n[0]>>24,n[0]>>16,n[0]>>8,n[0],n[1]>>24,n[1]>>16,n[1]>>8,n[1],n[2]>>24,n[2]>>16,n[2]>>8,n[2],n[3]>>24,n[3]>>16,n[3]>>8,n[3],n[4]>>24,n[4]>>16,n[4]>>8,n[4])}function ys(e,t,n,r){return ps(80,vs,e,t,n,r)}ys.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",ys.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";class Es extends Error{type;request;constructor(e,t){super(t.message,{cause:t.cause}),this.type=e,this.name="QueryClientError",this.request=t.request}}var bs=Symbol.for("immer-nothing"),ws=Symbol.for("immer-draftable"),Ls=Symbol.for("immer-state"),Is="production"!==process.env.NODE_ENV?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function Ss(e,...t){if("production"!==process.env.NODE_ENV){const n=Is[e],r=Ws(n)?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Cs=Object,_s=Cs.getPrototypeOf,Ds="constructor",Ps="prototype",Ns="configurable",Os="enumerable",As="writable",$s="value",Rs=e=>!!e&&!!e[Ls];function xs(e){return!!e&&(Fs(e)||Hs(e)||!!e[ws]||!!e[Ds]?.[ws]||zs(e)||qs(e))}var Ts=Cs[Ps][Ds].toString(),ks=new WeakMap;function Fs(e){if(!e||!Vs(e))return!1;const t=_s(e);if(null===t||t===Cs[Ps])return!0;const n=Cs.hasOwnProperty.call(t,Ds)&&t[Ds];if(n===Object)return!0;if(!Ws(n))return!1;let r=ks.get(n);return void 0===r&&(r=Function.toString.call(n),ks.set(n,r)),r===Ts}function Us(e,t,n=!0){if(0===Bs(e)){(n?Reflect.ownKeys(e):Cs.keys(e)).forEach(n=>{t(n,e[n],e)})}else e.forEach((n,r)=>t(r,n,e))}function Bs(e){const t=e[Ls];return t?t.type_:Hs(e)?1:zs(e)?2:qs(e)?3:0}var Ms=(e,t,n=Bs(e))=>2===n?e.has(t):Cs[Ps].hasOwnProperty.call(e,t),Gs=(e,t,n=Bs(e))=>2===n?e.get(t):e[t],js=(e,t,n,r=Bs(e))=>{2===r?e.set(t,n):3===r?e.add(n):e[t]=n};var Hs=Array.isArray,zs=e=>e instanceof Map,qs=e=>e instanceof Set,Vs=e=>"object"==typeof e,Ws=e=>"function"==typeof e,Zs=e=>"boolean"==typeof e;var Ks=e=>e.copy_||e.base_,Ys=e=>e.modified_?e.copy_:e.base_;function Xs(e,t){if(zs(e))return new Map(e);if(qs(e))return new Set(e);if(Hs(e))return Array[Ps].slice.call(e);const n=Fs(e);if(!0===t||"class_only"===t&&!n){const t=Cs.getOwnPropertyDescriptors(e);delete t[Ls];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const i=n[r],o=t[i];!1===o[As]&&(o[As]=!0,o[Ns]=!0),(o.get||o.set)&&(t[i]={[Ns]:!0,[As]:!0,[Os]:o[Os],[$s]:e[i]})}return Cs.create(_s(e),t)}{const t=_s(e);if(null!==t&&n)return{...e};const r=Cs.create(t);return Cs.assign(r,e)}}function Js(e,t=!1){return ea(e)||Rs(e)||!xs(e)||(Bs(e)>1&&Cs.defineProperties(e,{set:Qs,add:Qs,clear:Qs,delete:Qs}),Cs.freeze(e),t&&Us(e,(e,t)=>{Js(t,!0)},!1)),e}var Qs={[$s]:function(){Ss(2)}};function ea(e){return null===e||!Vs(e)||Cs.isFrozen(e)}var ta="MapSet",na="Patches",ra="ArrayMethods",ia={};function oa(e){const t=ia[e];return t||Ss(0,e),t}var sa,aa=e=>!!ia[e],ca=()=>sa;function la(e,t){t&&(e.patchPlugin_=oa(na),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ua(e){fa(e),e.drafts_.forEach(pa),e.drafts_=null}function fa(e){e===sa&&(sa=e.parent_)}var da=e=>sa={drafts_:[],parent_:sa,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:aa(ta)?oa(ta):void 0,arrayMethodsPlugin_:aa(ra)?oa(ra):void 0};function pa(e){const t=e[Ls];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function ha(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(void 0!==e&&e!==n){n[Ls].modified_&&(ua(t),Ss(4)),xs(e)&&(e=ma(t,e));const{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[Ls].base_,e,t)}else e=ma(t,n);return function(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Js(t,n)}(t,e,!0),ua(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==bs?e:void 0}function ma(e,t){if(ea(t))return t;const n=t[Ls];if(!n){return wa(t,e.handledSet_,e)}if(!va(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:t}=n;if(t)for(;t.length>0;){t.pop()(e)}ba(n,e)}return n.copy_}function ga(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var va=(e,t)=>e.scope_===t,ya=[];function Ea(e,t,n,r){const i=Ks(e),o=e.type_;if(void 0!==r){if(Gs(i,r,o)===t)return void js(i,r,n,o)}if(!e.draftLocations_){const t=e.draftLocations_=new Map;Us(i,(e,n)=>{if(Rs(n)){const r=t.get(n)||[];r.push(e),t.set(n,r)}})}const s=e.draftLocations_.get(t)??ya;for(const e of s)js(i,e,n,o)}function ba(e,t){if(e.modified_&&!e.finalized_&&(3===e.type_||1===e.type_&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){const{patchPlugin_:n}=t;if(n){const r=n.getPath(e);r&&n.generatePatches_(e,r,t)}ga(e)}}function wa(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Rs(e)||t.has(e)||!xs(e)||ea(e)||(t.add(e),Us(e,(r,i)=>{if(Rs(i)){const t=i[Ls];if(va(t,n)){const n=Ys(t);js(e,r,n,e.type_),ga(t)}}else xs(i)&&wa(i,t,n)})),e}var La={get(e,t){if(t===Ls)return e;let n=e.scope_.arrayMethodsPlugin_;const r=1===e.type_&&"string"==typeof t;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const i=Ks(e);if(!Ms(i,t,e.type_))return function(e,t,n){const r=Ca(t,n);return r?$s in r?r[$s]:r.get?.call(e.draft_):void 0}(e,i,t);const o=i[t];if(e.finalized_||!xs(o))return o;if(r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&function(e){const t=+e;return Number.isInteger(t)&&String(t)===e}(t))return o;if(o===Sa(e.base_,t)||function(e,t,n){if(1!==e.type_||!e.allIndicesReassigned_||e.assigned_?.get(t)||!xs(n)||n[Ls])return!1;return e.baseRefs_.has(n)}(e,t,o)){Da(e);const n=1===e.type_?+t:t,r=Pa(e.scope_,o,e,n);return e.copy_[n]=r}return o},has:(e,t)=>t in Ks(e),ownKeys:e=>Reflect.ownKeys(Ks(e)),set(e,t,n){const r=Ca(Ks(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=Sa(Ks(e),t),s=r?.[Ls];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(((i=n)===(o=r)?0!==i||1/i==1/o:i!=i&&o!=o)&&(void 0!==n||Ms(e.base_,t,e.type_)))return!0;Da(e),_a(e)}var i,o;return e.copy_[t]===n&&(void 0!==n||Ms(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),function(e,t,n){const{scope_:r}=e;if(Rs(n)){const i=n[Ls];va(i,r)&&i.callbacks_.push(function(){Da(e);const r=Ys(i);Ea(e,n,r,t)})}else xs(n)&&e.callbacks_.push(function(){const i=Ks(e);3===e.type_?i.has(n)&&wa(n,r.handledSet_,r):Gs(i,t,e.type_)===n&&r.drafts_.length>1&&!0===(e.assigned_.get(t)??!1)&&e.copy_&&wa(Gs(e.copy_,t,e.type_),r.handledSet_,r)})}(e,t,n)),!0},deleteProperty:(e,t)=>(Da(e),void 0!==Sa(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),_a(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=Ks(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{[As]:!0,[Ns]:1!==e.type_||"length"!==t,[Os]:r[Os],[$s]:n[t]}:r},defineProperty(){Ss(11)},getPrototypeOf:e=>_s(e.base_),setPrototypeOf(){Ss(12)}},Ia={};for(let e in La){let t=La[e];Ia[e]=function(){const e=arguments;return e[0]=e[0][0],t.apply(this,e)}}function Sa(e,t){const n=e[Ls];return(n?Ks(n):e)[t]}function Ca(e,t){if(!(t in e))return;let n=_s(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=_s(n)}}function _a(e){e.modified_||(e.modified_=!0,e.parent_&&_a(e.parent_))}function Da(e){e.copy_||(e.assigned_=new Map,e.copy_=Xs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}Ia.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&Ss(13),Ia.set.call(this,e,t,void 0)},Ia.set=function(e,t,n){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&Ss(14),La.set.call(this,e[0],t,n,e[0])};function Pa(e,t,n,r){const[i,o]=zs(t)?oa(ta).proxyMap_(t,n):qs(t)?oa(ta).proxySet_(t,n):function(e,t){const n=Hs(e),r={type_:n?1:0,scope_:t?t.scope_:ca(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,o=La;n&&(i=[r],o=Ia);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,[a,r]}(t,n);return(n?.scope_??ca()).drafts_.push(i),o.callbacks_=n?.callbacks_??[],o.key_=r,n&&void 0!==r?function(e,t,n){e.callbacks_.push(function(r){const i=t;if(!i||!va(i,r))return;r.mapSetPlugin_?.fixSetContents(i);const o=Ys(i);Ea(e,i.draft_??i,o,n),ba(i,r)})}(n,o,r):o.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(o);const{patchPlugin_:t}=e;o.modified_&&t&&t.generatePatches_(o,[],e)}),i}function Na(e){if(!xs(e)||ea(e))return e;const t=e[Ls];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Xs(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Xs(e,!0);return Us(n,(e,t)=>{js(n,e,Na(t))},r),t&&(t.finalized_=!1),n}globalThis.Iterator;var Oa=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(Ws(e)&&!Ws(t)){const n=t;t=e;const r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}let r;if(Ws(t)||Ss(6),void 0===n||Ws(n)||Ss(7),xs(e)){const i=da(this),o=Pa(i,e,void 0);let s=!0;try{r=t(o),s=!1}finally{s?ua(i):fa(i)}return la(i,n),ha(r,i)}if(!e||!Vs(e)){if(r=t(e),void 0===r&&(r=e),r===bs&&(r=void 0),this.autoFreeze_&&Js(r,!0),n){const t=[],i=[];oa(na).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}Ss(1,e)},this.produceWithPatches=(e,t)=>{if(Ws(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},Zs(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Zs(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Zs(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){xs(e)||Ss(8),Rs(e)&&(e=function(e){Rs(e)||Ss(10,e);return Na(e)}(e));const t=da(this),n=Pa(t,e,void 0);return n[Ls].isManual_=!0,fa(t),n}finishDraft(e,t){const n=e&&e[Ls];n&&n.isManual_||Ss(9);const{scope_:r}=n;return la(r,t),ha(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=oa(na).applyPatches_;return Rs(e)?r(e,t):this.produce(e,e=>r(e,t))}},Aa=Oa.produce;const $a=(...e)=>lo(t=>e.includes(t.type));class Ra extends si{#ce=new di;#le;get action$(){return this.#ce.asObservable()}get value(){return this.#le.value}get closed(){return this.#le.closed||this.#ce.closed}constructor(e,t){super(e=>this.#le.subscribe(e));const n="getInitialState"in e?e.getInitialState():t;this.#le=new hi(n),this.#ce.pipe(function(e,t){return ci(fo(e,t,arguments.length>=2,!0))}(e,n),mo()).subscribe(this.#le),this.reset=()=>this.#le.next(n)}reset;next(e){this.#ce.next(e)}select(e,t){return this.#le.pipe(Ji(e),mo(t))}addEffect(e,t){const n="function"==typeof e?this.action$:Array.isArray(e)?this.action$.pipe($a(...e)):this.action$.pipe($a(e)),r=t||e;return n.pipe(no(e=>zi(new Promise((t,n)=>{try{t(r(e,this.value))}catch(e){n(e)}})).pipe(uo(e=>(console.warn("unhandled effect",e),Ci)))),lo(e=>!!e),Mi(Ii)).subscribe(this.#ce)}addEpic(e){return this.addFlow(e)}addFlow(e){const t=e(this.action$,this);if(!t)throw new TypeError(`addEpic: one of the provided effects "${e.name||"<anonymous>"}" does not return a stream. Double check you're not missing a return statement!`);return t.pipe(uo(e=>(console.trace("unhandled exception, epic closed!",e),Ci)),Mi(Ii)).subscribe(this.#ce)}unsubscribe(){this.#ce.unsubscribe(),this.#le.unsubscribe()}complete(){this.#ce.complete(),this.#le.complete()}asObservable(){return this.#le.asObservable()}}const xa="::";function Ta(e,t){function n(...n){if(t){const r=t(...n);if(!r)throw new Error("prepareAction did not return an object");return{type:e,payload:r.payload,..."meta"in r&&{meta:r.meta},..."error"in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>t.type===e,n}function ka(e,t,n,r){const i=Ta([e,"request"].join(xa),t);return n&&Object.assign(i,{success:Ta([e,"success"].join(xa),n)}),r&&Object.assign(i,{failure:Ta([e,"failure"].join(xa),r)}),i}function Fa(e){return xs(e)?Aa(e,()=>{}):e}function Ua(e,t){const[n,r,i]=function(e){const t={},n=[];let r;const i={addCase(e,o){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("`builder.addCase` should only be called before calling `builder.addMatcher`");if(r)throw new Error("`builder.addCase` should only be called before calling `builder.addDefaultCase`")}const s="string"==typeof e?e:e.type;if(s in t)throw new Error("addCase cannot be called with two reducers for the same action type");return t[s]=o,i},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&r)throw new Error("`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){if("production"!==process.env.NODE_ENV&&r)throw new Error("`builder.addDefaultCase` can only be called once");return r=e,i}};return e(i),[t,n,r]}(t);let o;if("function"==typeof e)o=()=>Fa(e());else{const t=Fa(e);o=()=>t}function s(e,t){let s=[n[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];const a=s.filter(e=>!!e).length>0;return i&&!a&&(s=[i]),s.reduce((e,n)=>{if(n){if(Rs(e)){const r=n(e,t);return void 0===r?e:r}if(xs(e))return Aa(e,e=>n(e,t));{const r=n(e,t);if(void 0===r){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}}return e},e??o())}return s.getInitialState=o,s}const Ba={request:Ta("client/request",(e,t)=>({payload:{args:e,options:t},meta:{transaction:hs(),created:Date.now()}})),execute:ka("client/execute",e=>({payload:e,meta:{transaction:e,created:Date.now()}}),e=>({payload:e,meta:{transaction:e.transaction,created:Date.now()}}),(e,t)=>({payload:{error:e},meta:{transaction:t,created:Date.now()}})),cancel:Ta("client/cancel",(e,t)=>({payload:{transaction:e,reason:t},meta:{transaction:e,created:Date.now()}})),error:Ta("client/error",(e,t)=>({payload:{transaction:e,error:t},meta:{transaction:e,created:Date.now()}}))},Ma=e=>e.pipe(lo(Ba.request.match),Ji(e=>Ba.execute(e.meta.transaction)));class Ga extends si{#ue=new hi("idle");get status(){return this.#ue.value}get status$(){return this.#ue.asObservable()}#fe;#de;get transaction(){return this.#de}created=Date.now();get closed(){return"complete"===this.status||"error"===this.status||"canceled"===this.status}constructor(e,t,n){super(t=>{const{transaction:r}=this,i=e.action$.pipe(lo(e=>e.meta.transaction===r));t.add(e.state$.pipe(lo(e=>!!e[r]),Ji(e=>e[r])).subscribe(e=>{this.#ue.next(e.status)})),t.add(i.pipe(lo(Ba.execute.success.match),Ji(({payload:e})=>e)).subscribe(e=>{this.#ue.next("complete"),t.next(e),t.complete()})),t.add(i.pipe(lo(Ba.error.match),Ji(({payload:e})=>e)).subscribe(e=>{this.#ue.next("error"),t.error(e.error)})),t.add(i.pipe(lo(Ba.cancel.match)).subscribe(e=>{this.#ue.next("canceled"),t.error(new Es("abort",{message:e.payload.reason||`job: ${r} was canceled`,request:this.#fe.getRequest(e.meta.transaction)}))})),n?.signal&&t.add(so(n?.signal,"abort").pipe(Ji(()=>Ba.cancel(r,`job: ${r} was aborted on signal from caller: ${n?.ref}`))).subscribe(t=>e.next(t))),t.add(()=>{this.complete()})}),this.#fe=e;const r=Ba.request(t,{ref:n?.ref,retry:n?.retry});this.#de=r.meta.transaction,this.#fe.next(r)}complete(e){this.closed||this.cancel(e??`job: ${this.transaction} was completed`)}cancel(e){const t=this.transaction;this.#fe.cancel(t,e??`job: ${t} was canceled`)}[Symbol.dispose](){this.complete()}}class ja{type;transaction;data;constructor(e,t,n){this.type=e,this.transaction=t,this.data=n}}class Ha extends si{#le;#pe;#he;_registerEvent(e,t,n){this.#he.next(new ja(e,t,n))}get closed(){return this.#le.closed}get state$(){return this.#le.asObservable()}get action$(){return this.#le.action$}get event$(){return this.#he.asObservable()}get success$(){return this.action$.pipe(lo(Ba.execute.success.match),Ji(({payload:e})=>e))}get error$(){return this.action$.pipe($a("client/error"),Co(this.#le),Ji(([e,t])=>{const{payload:n,meta:{transaction:r}}=e,i=t[r];return new Es("error",{request:i,message:`job: ${r} failed`,cause:n})}))}constructor(e,t){super(e=>this.#le.subscribe(e)),this.#le=new Ra(((e={})=>Ua(e,e=>{e.addCase(Ba.request,(e,t)=>{e[t.meta.transaction]={...t.payload,...t.meta,execution:[],errors:[],status:"idle"}}),e.addCase(Ba.execute,(e,t)=>{const n=e[t.payload];n&&(n.execution.push(Date.now()),n.status="active")}),e.addCase(Ba.execute.success,(e,t)=>{delete e[t.payload.transaction]}),e.addCase(Ba.execute.failure,(e,t)=>{const n=e[t.meta.transaction];n&&(n.errors.push(t.payload.error),n.status="failed")}),e.addCase(Ba.error,(e,t)=>{delete e[t.meta.transaction]}),e.addCase(Ba.cancel,(e,t)=>{delete e[t.meta.transaction]})}))({})),this.#pe=new zr(()=>{this.#le.complete(),this.#he.complete()}),this.#he=new di,this.#pe.add(this.#le.addFlow(Ma)),this.#pe.add(this.#le.addFlow((e=>(t,n)=>t.pipe(lo(Ba.execute.match),Co(n),no(([n,r])=>{const i=n.payload,o=r[i],s=new AbortController,a=t.pipe(lo(Ba.cancel.match),lo(e=>e.payload.transaction===i),So(()=>{s.signal.aborted||s.abort()}));try{return zi(e(o.args,s.signal)).pipe(Ji(e=>Ba.execute.success({...o,status:"complete",completed:Date.now(),value:e})),uo(e=>qi(Ba.execute.failure(e,i))),Io(a))}catch(e){return qi(Ba.execute.failure(e,i))}})))(e)));const n=Object.assign({count:0,delay:0},t?.retry);this.#pe.add(this.#le.addFlow((e=>(t,n)=>t.pipe(lo(Ba.execute.failure.match),Co(n),no(([t,r])=>{const{transaction:i}=t.meta,o=r[i];if(!o)return qi(Ba.error(i,new Es("error",{message:"request not found, cannot retry request, most likely removed while scheduled for retry!"})));const s=o.execution.length,a=Object.assign({},e,o.options?.retry),c=o.errors?.slice(-1)[0]??new Es("error",{message:"no errors registered for request!",request:o});if(s>a.count){const e=0===a.count?c:new Es("error",{message:"maximum retries executed!",cause:o.errors,request:o});return qi(Ba.error(i,e))}return("function"==typeof a.delay?zi(a.delay(c)).pipe(uo(e=>qi(Ba.error(i,new Es("error",{message:"retry delay callback failed!",cause:[...o.errors??[],e],request:o}))))):co(a.delay)).pipe(Co(n),lo(([e,t])=>!!t[i]),So(([,e])=>{if(!e[i])throw new Es("error",{message:"request not found, most likely removed while scheduled for retry",cause:o.errors,request:o})}),Ji(()=>Ba.execute(i)))})))(n))),this.#le.addEffect(Ba.request.type,({payload:e,meta:{transaction:t}})=>{this._registerEvent("query_client_job_requested",t,e)}),this.#le.addEffect(Ba.execute.type,({meta:{transaction:e}})=>{this._registerEvent("query_client_job_executing",e)}),this.#le.addEffect(Ba.execute.success.type,({payload:e,meta:{transaction:t}})=>{this._registerEvent("query_client_job_completed",t,{payload:e})}),this.#le.addEffect(Ba.execute.failure.type,({payload:e,meta:{transaction:t}})=>{const n=e.error instanceof Error?e.error:new Error(String(e.error));this._registerEvent("query_client_job_failed",t,{error:n})}),this.#le.addEffect(Ba.cancel.type,({payload:{reason:e},meta:{transaction:t}})=>{this._registerEvent("query_client_job_canceled",t,{reason:e||"no reason provided"})}),this.#le.addEffect(Ba.error.type,({payload:e,meta:{transaction:t}})=>{const n=e.error instanceof Error?e.error:new Error(String(e.error));this._registerEvent("query_client_job_error",t,{error:n})})}next(e){this.#le.next(e)}query(e,t){const n=new Ga(this,e,t),r=n.pipe(function(e){void 0===e&&(e={});var t=e.connector,n=void 0===t?function(){return new di}:t,r=e.resetOnError,i=void 0===r||r,o=e.resetOnComplete,s=void 0===o||o,a=e.resetOnRefCountZero,c=void 0===a||a;return function(e){var t,r,o,a=0,l=!1,u=!1,f=function(){null==r||r.unsubscribe(),r=void 0},d=function(){f(),t=o=void 0,l=u=!1},p=function(){var e=t;d(),null==e||e.unsubscribe()};return ci(function(e,h){a++,u||l||f();var m=o=null!=o?o:n();h.add(function(){0!==--a||u||l||(r=wo(p,c))}),m.subscribe(h),!t&&a>0&&(t=new ti({next:function(e){return m.next(e)},error:function(e){u=!0,f(),r=wo(d,i,e),m.error(e)},complete:function(){l=!0,f(),r=wo(d,s),m.complete()}}),Fi(e).subscribe(t))})(e)}}({connector:()=>new gi,resetOnRefCountZero:!1}));return Object.defineProperties(r,{transaction:{get:()=>n.transaction},created:{get:()=>n.created},status:{get:()=>n.status},closed:{get:()=>n.closed},cancel:{value:e=>n.cancel(e)},complete:{value:()=>n.complete()}}),r}async nextAsync(e,t){return Zi(this.query(e,t))}getRequest(e){return this.#le.value[e]}getRequestByRef(e){return Object.values(this.#le.value).find(t=>t.ref===e)}cancelTaskByRef(e,t){const n=this.getRequestByRef(e);n?.ref&&this.cancel(n.transaction,t)}cancel(e,t){if(e)this.#le.value[e]&&(t??=`cancelation requested for job: ${e}`,this.#le.next(Ba.cancel(e,t)));else for(const e of Object.keys(this.#le.value))this.cancel(e,"all transactions requested canceled")}on(e,t){return this.#le.addEffect(Ba[e].type,e=>{t(e,this)})}complete(){this.#pe.unsubscribe()}}const za={set:Ta("cache/set",(e,t)=>({payload:{key:e,record:t}})),insert:Ta("cache/insert",(e,t)=>({payload:{key:e,entry:t}})),remove:Ta("cache/remove",e=>({payload:e})),invalidate:Ta("cache/invalidate",(e,t)=>({payload:e,meta:{item:t}})),mutate:Ta("cache/mutate",(e,t,n)=>({payload:{...t,key:e},meta:{item:n}})),trim:Ta("cache/trim",e=>({payload:e}))},qa=(e,t)=>(t.updated??0)-(e.updated??0);class Va{type;key;data;constructor(e,t,n){this.type=e,this.key=t,this.data=n}}class Wa{#le;#he;get state(){return this.#le.value}get state$(){return this.#le.asObservable()}get action$(){return this.#le.action$}_registerEvent(e,t){this.#he.next(new Va(e,t?.key,t?.data))}get event$(){return this.#he.asObservable()}constructor(e){const{trimming:t,initial:n}=e??{};this.#le=new Ra(function(e,t={}){return Ua(t,t=>t.addCase(e.set,(e,t)=>{const{key:n,record:r}=t.payload;e[n]=r}).addCase(e.insert,(e,t)=>{const{key:n,entry:r}=t.payload,i=e[n];if(i)i.updated=Date.now(),i.updates??=0,i.updates++,i.value=r.value,i.transaction=r.transaction,i.mutated=void 0;else{const t=Date.now();e[n]={...r,created:t,updated:t}}}).addCase(e.remove,(e,t)=>{delete e[t.payload]}).addCase(e.invalidate,(e,t)=>{const n=t.payload?[t.payload]:Object.keys(e);for(const t of n){const n=e[t];n&&(n.updated=void 0)}}).addCase(e.mutate,(e,t)=>{const{key:n,value:r,updated:i}=t.payload,o=e[n];o&&(o.value=r,o.updated=i,o.mutated=Date.now(),o.updates??=0,o.updates++)}).addCase(e.trim,(e,t)=>{const{payload:n}=t,r=n.sort??qa,i=Object.keys(e),o=Object.entries(e).filter(([e,t])=>!n.validate||n.validate(t)).sort((e,t)=>r(e[1],t[1])).slice(0,n.size??Number.MAX_SAFE_INTEGER).map(([e])=>e);if(i.length!==o.length)for(const t of i){const n=o.indexOf(t);-1!==n?o.splice(n,1):delete e[t]}}))}(za,n)),t&&this.#le.addEffect("cache/set",()=>this.#le.next(za.trim(t))),this.#he=new di}has(e){return e in this.#le.value}setItem(e,t){const{args:n,transaction:r,value:i}=t;this.#le.next(za.insert(e,{args:n,transaction:r,value:i})),this._registerEvent("query_cache_entry_inserted",{key:e,data:{value:i,args:n,transaction:r}})}getItem(e){return this.#le.value[e]}removeItem(e){this.#le.next(za.remove(e)),this._registerEvent("query_cache_entry_removed",{key:e})}invalidate(e){const t=e?this.#le.value[e]:void 0;this.#le.next(za.invalidate(e,t)),e&&this._registerEvent("query_cache_entry_invalidated",{key:e,data:{previousValue:t?.value}})}mutate(e,t){const n=e in this.#le.value?this.#le.value[e]:void 0;if(!n)throw new Error(`Cannot mutate cache item with key ${e}: item not found`);const r="function"==typeof t?t(n?.value):t;return this.#le.next(za.mutate(e,r,n)),this._registerEvent("query_cache_entry_mutated",{key:e,data:{previousValue:n.value,newValue:r,mutation:r}}),()=>this.#le.next(za.set(e,n))}trim(e){const t=new Set(Object.keys(this.#le.value));this.#le.next(za.trim(e));const n=new Set(Object.keys(this.#le.value)),r=Array.from(t).filter(e=>!n.has(e));this._registerEvent("query_cache_trimmed",{data:{removedKeys:r,criteria:e}})}reset(){this.#le.reset(),this._registerEvent("query_cache_reset")}complete(){this.#le.complete(),this.#he.complete()}}class Za extends di{key;args;options;#me=Date.now();get created(){return this.#me}#ge=hs();get uuid(){return this.#ge}constructor(e,t,n){super(),this.key=e,this.args=t,this.options=n}processJob(e){return e.pipe(Ji(t=>{const{key:n,uuid:r,created:i}=this;return{key:n,uuid:r,created:i,status:"complete",transaction:e.transaction,complete:t.completed,value:t.value}}),Eo(()=>{e.complete()})).subscribe(this)}}class Ka{type;key;data;constructor(e,t,n){this.type=e,this.key=t,this.data=n}}class Ya{static extractQueryValue=as;#pe=new zr;#fe;#ve;#ye=new di;#Ee={};#be;#we;#Le=hs();#se;get client(){return this.#fe}_registerEvent(e,t,n){this.#se.next(new Ka(e,t,n))}get cache(){return this.#ve}get event$(){return this.#se.asObservable()}constructor(e){this.#se=new di,this.#be=t=>ys(e.key(t),this.#Le),this.#we=e?.validate??((e=0)=>t=>(t.updated??0)+e>Date.now())(e?.expire),e.client instanceof Ha?this.#fe=e.client:(this.#fe=new Ha(e.client.fn,{...e.client.options}),this.#pe.add(()=>this.#fe.complete())),this.#pe.add(this.#fe.event$.subscribe({next:e=>this.#se.next(e)})),e.cache instanceof Wa?this.#ve=e.cache:(this.#ve=new Wa(e.cache||{}),this.#pe.add(()=>this.#ve.complete())),this.#pe.add(this.#ve.event$.subscribe({next:e=>this.#se.next(e)}));const t=((e="switch")=>"function"==typeof e?e:(()=>{switch(e){case"concat":return is;case"merge":return os;case"switch":return ss;default:throw new Error(`Invalid queue operator: ${e}`)}})())(e.queueOperator);var n,r;this.#pe.add(()=>this.#ye.complete()),this.#pe.add(this.#ye.pipe(So(e=>{this._registerEvent("query_queued",e)}),lo(e=>!!(e in this.#Ee)),t(e=>{const t=this.#Ee[e],{args:n,options:r,uuid:i}=t;if(this._registerEvent("query_job_selected",e,{taskId:i,args:n,options:r}),!t?.observed)return this._registerEvent("query_job_skipped",e,{taskId:i,args:n,options:r}),delete this.#Ee[e],Ci;const o=this.#fe.query(n,{...r,ref:t.uuid});return new si(s=>{const{transaction:a}=o;var c,l;this._registerEvent("query_job_started",e,{taskId:i,transaction:a,args:n,options:r}),s.add(()=>{this._registerEvent("query_job_closed",e,{taskId:i,transaction:a,args:n,options:r}),o.complete("task closed"),delete this.#Ee[e]}),s.add((c=10,void 0===l&&(l=Ii),co(c,c,l)).pipe(lo(()=>!t.observed)).subscribe(()=>{o.cancel(`task: ${t.uuid} is not observed`),s.complete()})),s.add(t.processJob(o).add(()=>{this._registerEvent("query_job_completed",e,{taskId:i,transaction:a,args:n,options:r})})),o.pipe(Ji(e=>({result:e,task:t})),uo(()=>Ci)).subscribe(s)})}),(n=()=>!this.#fe.closed,void 0===r&&(r=!1),ci(function(e,t){var i=0;e.subscribe(li(t,function(e){var o=n(e,i++);(o||r)&&t.next(e),!o&&t.complete()}))}))).subscribe(e=>{const{value:t,transaction:n}=e.result,{args:r,key:i,uuid:o}=e.task;this._registerEvent("query_cache_added",i,{data:t,taskId:o,args:r,transaction:n}),this._registerEvent("query_completed",i,{data:t,hasValidCache:!0}),this.#ve.setItem(i,{value:t,args:r,transaction:n})}))}query(e,t){return this._query(e,t)}queryAsync(e,t){const{skipResolve:n,...r}=t||{},i=n?Zi:Wi;return new Promise((n,o)=>{t?.signal&&t.signal.addEventListener("abort",()=>o(new Error("Query aborted"))),i(this._query(e,r).pipe(vo())).then(n,o)})}persistentQuery(e,t){const n=this.#be(e),r=this._query(e,t);return new si(i=>{i.add(r.subscribe({next:i.next.bind(i),error:i.error.bind(i)}));const o=t?.cache?.validate||this.#we;i.add(this.cache.state$.pipe(lo(e=>n in e),Ji(t=>({...t[n],key:n,status:"cache",hasValidCache:o(t[n],e)}))).subscribe(i))}).pipe(mo((e,t)=>e.transaction===t.transaction&&e.mutated===t.mutated))}generateCacheKey(e){return this.#be(e)}mutate(e,t,n){const r=this.#be(e);if(r in this.cache.state==!1){if(void 0===n?.allowCreation)throw new Error(`Cannot mutate cache item with key ${r}: item not found and option "allowCreation" is false`);if(!1===n.allowCreation)return()=>{};const{value:i}="function"==typeof t?t():t;this.cache.setItem(r,{args:e,transaction:hs(),value:i})}return this.#ve.mutate(r,t)}invalidate(e){this.#ve.invalidate(e&&this.#be(e))}complete(){this.#pe.unsubscribe(),this.#se?.complete()}onInvalidate(e){const t=this.#ve.action$.pipe($a("cache/invalidate")).subscribe(t=>e({detail:{item:t.meta.item}}));return()=>t.unsubscribe()}onMutate(e){const t=this.#ve.action$.pipe($a("cache/mutate")).subscribe(t=>e({detail:{changes:t.payload,current:t.meta.item}}));return()=>t.unsubscribe()}_query(e,t){const n=this.#be(e),r=this._createTask(n,e,t);return this._registerEvent("query_created",n,{args:e,options:t}),r}_createTask(e,t,n){return new si(r=>{if(n?.signal){if(n?.signal.aborted)return this._registerEvent("query_aborted",e),r.complete();r.add(so(n?.signal,"abort").subscribe(()=>{this._registerEvent("query_aborted",e),r.complete()}))}const i=this.#ve.getItem(e);if(i){this._registerEvent("query_cache_hit",e,{cacheEntry:i});const o=n?.cache?.suppressInvalid??!1,s=(n?.cache?.validate||this.#we)(i,t),a={...i,key:e,status:"cache",hasValidCache:s};if(r.next(a),s||o)return this._registerEvent("query_completed",e,{data:i.value,hasValidCache:s}),r.complete();this._registerEvent("query_cache_miss",e)}const o=e in this.#Ee;o?this._registerEvent("query_connected",e,{isExistingTask:!0}):(this.#Ee[e]=new Za(e,t,n),this._registerEvent("query_job_created",e,{taskId:this.#Ee[e].uuid,args:t,options:n}));const s=this.#Ee[e];r.add(s.subscribe(r)),o||this.#ye.next(e)})}}const Xa=R.object({key:R.string().describe("The key used to identify the service"),uri:R.string().describe("The URI of the service"),id:R.string().optional().describe("The ID of the service"),environment:R.string().optional().describe("The environment of the service"),name:R.string().optional().describe("The name of the service"),scopes:R.array(R.string()).optional().default([]).describe("Endpoint authentication scopes"),tags:R.array(R.string()).optional().describe("Tags for the service")}).describe("A service from the service discovery API").transform(e=>({...e,get defaultScopes(){return e.scopes??[]}})),Ja=R.array(Xa).describe("A list of services from the service discovery API");class Qa{#Ie;endpoint;http;constructor(e){this.http=e.http,this.endpoint=e.endpoint;const t=e.postProcess;this.#Ie=new Ya({client:{fn:()=>this.http.fetch$(this.endpoint??"",{selector:e=>((e,t)=>{const n=zi(Qo(e)).pipe(Ji(e=>Ja.default([]).parse(e)));return t?n.pipe(t):n})(e,t)})},key:()=>"services",expire:3e5})}resolveServices(e){return(e?Zi:Wi)(Ya.extractQueryValue(this.#Ie.query()))}async resolveService(e,t){const n=(await this.resolveServices(t)).find(t=>t.key===e);if(!n)throw Error(`Failed to resolve service, invalid key [${e}]`);return n}}class ec extends Do{async _createConfig(e,t){if(!e.hasModule("http"))throw new Error("http module is required");if(!this._has("discoveryClient")){(await e.requireInstance("http")).hasClient("service_discovery")&&this.configureServiceDiscoveryClientByClientKey("service_discovery")}return Wi(zi(super._createConfig(e,t)))}_processConfig(e,t){if(!e.discoveryClient)throw new Error("discoveryClient is required, please configure it");return super._processConfig(e,t)}setServiceDiscoveryClient(e){this._set("discoveryClient","function"==typeof e?e:async()=>e)}configureServiceDiscoveryClient(e){this.setServiceDiscoveryClient(async t=>{const{httpClient:n,endpoint:r}=await Wi(zi(e(t)))??{};if(n)return new Qa({http:n,endpoint:r,postProcess:Ji(e=>{const t="undefined"!=typeof globalThis?globalThis.sessionStorage:void 0;if(!t)return e;try{const n=JSON.parse(t.getItem("overriddenServiceDiscoveryUrls")||"{}");for(const[t,{url:r,scopes:i}]of Object.entries(n)){const n=e.find(e=>e.key===t);n&&(n.uri=r,n.scopes=i,n.overridden=!0)}}catch(e){console.error('Failed to JSON parse session overrides: "overriddenServiceDiscoveryUrls"',e)}return e})});throw Error("httpClient is required")})}configureServiceDiscoveryClientByClientKey(e,t){this.configureServiceDiscoveryClient(async({requireInstance:n})=>({httpClient:(await n("http")).createClient(e),endpoint:t}))}}class tc extends Ro{config;_http;constructor(e,t){super({version:"10.1.1",config:e}),this.config=e,this._http=t}get client(){return this.config.discoveryClient}resolveServices(){return this.config.discoveryClient.resolveServices()}async resolveService(e){return this.config.discoveryClient.resolveService(e)}async createClient(e,t){const n=await this.resolveService(e);if(!n)throw Error(`Could not load configuration of service [${e}]`);return this._http.createClient({...t,baseUri:n.uri,defaultScopes:n.scopes})}async configureClient(e,t){const{key:n,alias:r}="string"==typeof e?{key:e,alias:e}:e,{uri:i,scopes:o}=await this.resolveService(n);var s,a;t.addConfig((s=r,a={baseUri:i,defaultScopes:o},{module:rs,configure:e=>{e.configureClient(s,a)}}))}}const nc={name:"serviceDiscovery",configure:()=>new ec,initialize:async e=>{const{requireInstance:t,ref:n}=e,r=await e.config.createConfigAsync(e,{...n?.serviceDiscovery?.config}),i=await t("http");return new tc(r,i)}},rc=(e,t)=>{e.addConfig((e=>({module:nc,configure:t=>e(t)}))(()=>Promise.resolve()))};var ic,oc,sc,ac={},cc=[{name:"Agola CI",constant:"AGOLA",env:"AGOLA_GIT_REF",pr:"AGOLA_PULL_REQUEST_ID"},{name:"Alpic",constant:"ALPIC",env:"ALPIC_HOST"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE",pr:{env:"AC_GIT_PR",ne:"false"}},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN",pr:{env:"CODEBUILD_WEBHOOK_EVENT",any:["PULL_REQUEST_CREATED","PULL_REQUEST_UPDATED","PULL_REQUEST_REOPENED"]}},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"TF_BUILD",pr:{BUILD_REASON:"PullRequest"}},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Cloudflare Pages",constant:"CLOUDFLARE_PAGES",env:"CF_PAGES"},{name:"Cloudflare Workers",constant:"CLOUDFLARE_WORKERS",env:"WORKERS_CI"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Earthly",constant:"EARTHLY",env:"EARTHLY_CI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"Gitea Actions",constant:"GITEA_ACTIONS",env:"GITEA_ACTIONS"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"Prow",constant:"PROW",env:"PROW_JOB_ID"},{name:"ReleaseHub",constant:"RELEASEHUB",env:"RELEASE_BUILD_ID"},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Sourcehut",constant:"SOURCEHUT",env:{CI_NAME:"sourcehut"}},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vela",constant:"VELA",env:"VELA",pr:{VELA_PULL_REQUEST:"1"}},{name:"Vercel",constant:"VERCEL",env:{any:["NOW_BUILDER","VERCEL"]},pr:"VERCEL_GIT_PULL_REQUEST_ID"},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"},{name:"Woodpecker",constant:"WOODPECKER",env:{CI:"woodpecker"},pr:{CI_BUILD_EVENT:"pull_request"}},{name:"Xcode Cloud",constant:"XCODE_CLOUD",env:"CI_XCODE_PROJECT",pr:"CI_PULL_REQUEST_NUMBER"},{name:"Xcode Server",constant:"XCODE_SERVER",env:"XCS"}];function lc(){return ic||(ic=1,function(e){const t=cc,n=process.env;function r(e){return"string"==typeof e?!!n[e]:"env"in e?n[e.env]&&n[e.env].includes(e.includes):"any"in e?e.any.some(function(e){return!!n[e]}):Object.keys(e).every(function(t){return n[t]===e[t]})}Object.defineProperty(e,"_vendors",{value:t.map(function(e){return e.constant})}),e.name=null,e.isPR=null,e.id=null,"false"!==n.CI&&t.forEach(function(t){const i=(Array.isArray(t.env)?t.env:[t.env]).every(function(e){return r(e)});e[t.constant]=i,i&&(e.name=t.name,e.isPR=function(e){switch(typeof e.pr){case"string":return!!n[e.pr];case"object":return"env"in e.pr?"any"in e.pr?e.pr.any.some(function(t){return n[e.pr.env]===t}):e.pr.env in n&&n[e.pr.env]!==e.pr.ne:"any"in e.pr?e.pr.any.some(function(e){return!!n[e]}):r(e.pr);default:return null}}(t),e.id=t.constant)}),e.isCI=!("false"===n.CI||!(n.BUILD_ID||n.BUILD_NUMBER||n.CI||n.CI_APP_ID||n.CI_BUILD_ID||n.CI_BUILD_NUMBER||n.CI_NAME||n.CONTINUOUS_INTEGRATION||n.RUN_ID||e.name))}(ac)),ac}var uc,fc=V(sc?oc:(sc=1,oc=lc().isCI));!function(e){e.ContinuesIntegration="ci",e.QualityAssurance="fqa",e.Training="tr",e.Production="fprd",e.Development="dev"}(uc||(uc={}));const dc=["5a842df8-3238-415d-b168-9f16a6a6031b/.default"],pc=e=>{const t=new Uo,n=e.env??uc.ContinuesIntegration;t.addConfig({module:rs,configure:t=>{const r=n===uc.Development?uc.ContinuesIntegration:n,i=e.serviceDiscovery?.url??new URL(`/service-registry/environments/${r}/services`,"https://discovery.fusion.equinor.com").toString(),o=e.serviceDiscovery?.scope??dc;t.configureClient("service_discovery",{baseUri:i,defaultScopes:o})}}),rc(t);const{auth:r}=e;return q(t,e=>{if("defaultCredential"in r&&r.defaultCredential)return void e.setDefaultCredential();if("token"in r&&r.token)return void e.setTokenOnly(r.token);const{clientId:t,tenantId:n}=r;if(!t||!n)throw new Error("clientId and tenantId are required for auth module");if("interactive"in r&&r.interactive){const{server:i}=r;if(!i.port)throw new Error("server.port is required for interactive mode");return void e.setInteractive({tenantId:n,clientId:t,redirectPort:i.port,onOpen:i.onOpen})}fc?e.setDefaultCredential():e.setInteractive({tenantId:n,clientId:t,redirectPort:49741})}),t},hc=async(e,t)=>{const n=pc(e);t&&t(n);return await n.initialize()},mc=e=>{const t=e.getEntry("metadata.json");if(!t)throw new Error("Metadata file not found in bundle");return new Promise((e,n)=>{t.getDataAsync((t,r)=>{if(r)return n(new Error("Failed to read metadata file",{cause:r}));try{return e(JSON.parse(String(t)))}catch(e){n(new Error("Failed to parse metadata file",{cause:e}))}})})},gc=async e=>{const{log:t,bundle:n}=e;let r;if(n)try{t?.info("ðïļ","Using artifact-based validation from bundle:",n);const e=new Mn(n),i=await(async e=>{const t=await mc(e);if(!t.appKey||"string"!=typeof t.appKey||""===t.appKey.trim())throw new Error("App manifest is missing required appKey field");return t})(e);r=i.appKey,t?.info("ðĶ",`Resolved app key "${r}" from bundle artifact`)}catch(e){return t?.fail("ðŦ","Failed to resolve app information from bundle:",e instanceof Error?e.message:String(e)),!1}else{t?.info("ð","Using traditional validation from local project files");const e=await Zt(t);r=(await Wt({command:"build",mode:"production"},e,{log:t})).appKey}t?.start("Initializing Fusion Framework...");const i=await hc({env:e.environment,auth:"token"in e.auth?{token:e.auth.token}:e.auth});t?.succeed("Initialized Fusion Framework");try{const e=await i.serviceDiscovery.createClient("apps");e.request$.subscribe(e=>{t?.info("ð","Executing request to:",e.uri),t?.debug("Request:",e)}),t?.info("Checking if",r,"is registered in app store");const n=await e.fetch(`/apps/${r}`,{method:"HEAD",headers:sr});if(n.ok)return t?.succeed("ð",`Application ${r} is registered in app store`),!0;if(404===n.status)return t?.fail("ð",`Application ${r} is not registered in app store`),!1;if(410===n.status)return t?.fail("ð",`Application ${r} is deleted from app store`),!1;const o=fr(n.status,`check registration for ${r}`);throw o&&(t?.fail("ð",`Authentication/authorization error checking ${r}`),t?.error(o),process.exit(1)),new Error(`Unexpected response status: ${n.status}`)}catch(e){const n=hr(e,`check registration for ${r}`);return n&&(t?.fail("ð",`Token acquisition failed checking ${r}`),t?.error(n),process.exit(1)),t?.fail("ð
ââïļ","Error checking application registration"),t?.error("Error checking application registration:",e instanceof Error?e.message:e),!1}};const vc=async e=>{const{log:t,framework:n}=e,i="string"==typeof e.fileOrBundle?new Mn(e.fileOrBundle):e.fileOrBundle,{appKey:o}=e.appKey?{appKey:e.appKey}:await mc(i).catch(e=>{t?.error("Failed to resolve manifest:",e),process.exit(1)});t?.info("ðĶ",`Uploading application bundle for ${r.bold(o)}`);const s=(await i.getEntries()).map(e=>e.entryName);t?.debug("Bundle contents:",s);const a=await i.toBufferPromise().catch(e=>{t?.error("Failed to read bundle content:",e),process.exit(1)});try{const e=await n.serviceDiscovery.createClient("apps");e.request$.subscribe(e=>{t?.info("ð","Executing request to:",e.uri),t?.debug("Request:",e)});const i=await e.fetch(`/bundles/apps/${o}`,{method:"POST",body:new Blob([a],{type:"application/zip"}),headers:{...sr,"Content-Type":"application/zip"}});if(!i.ok){try{const{error:e}=await i.json();t?.debug("Error:",e),e.message&&t?.warn(r.red(`ðĪŊ error: ${e.code}\n`),r.yellowBright(e.message),"\n")}catch(e){t?.debug("Error:",i.statusText)}!function(e,t,n){const r=fr(e.status,`upload bundle for ${t}`);let i;switch(r&&(n?.fail("ð",`Authentication/authorization error uploading ${t}`),n?.error(r),process.exit(1)),e.status){case 409:i=`${e.status} - Version is already published, please generate a new release`;break;case 410:i=`${e.status} - ${t} is removed from Fusion app store`;break;case 404:i=`${e.status} - ${t} not found, please add your application in App Admin before publishing`;break;case 500:i=`${e.status} - Internal server error, please try again later or contact support`;break;default:i=`Failed to upload bundle. HTTP status ${e.status}, ${e.statusText}`}n?.fail("ð
ââïļ",i),process.exit(1)}(i,o,t)}t?.succeed("Successfully uploaded application bundle"),t?.debug("Response:",i);try{return{appKey:o,version:(await i.json()).version}}catch(e){t?.fail("ð
ââïļ",`Failed to parse response from app service: ${e instanceof Error?e.message:e}`),process.exit(1)}}catch(e){const n=hr(e,`upload bundle for ${o}`);n&&(t?.fail("ð",`Token acquisition failed uploading ${o}`),t?.error(n),process.exit(1)),t?.fail("ð
ââïļ","Failed to upload application bundle"),t?.error(e instanceof Error?e.message:e),process.exit(1)}},yc=async e=>{const{tag:t,appKey:n,version:i,framework:o,log:s}=e;t&&"string"==typeof t&&0!==t.trim().length||(s?.fail("ðĪŠ","Tag must be a non-empty string."),process.exit(1)),/^[a-zA-Z0-9.-]+$/.test(t)||(s?.fail("ðĪŠ",'Invalid tag. Use "latest", "preview" or string [a-z, A-Z, 0-9, ".", "-"].'),process.exit(1)),n||(s?.fail("ðĪŠ","Application key is required."),process.exit(1)),i||(s?.fail("ðĪŠ","Version is required."),process.exit(1));try{const e=await o.serviceDiscovery.createClient("apps");e.request$.subscribe(e=>{s?.debug("Request:",e),s?.info("ð","Executing request to:",Vt(e.uri))}),s?.start("Publishing application config");const a=await e.json(`/apps/${n}/tags/${t}`,{method:"PUT",body:{version:i},headers:sr});return s?.debug("Response:",a),s?.succeed("Tagged application successfully",r.greenBright(`${n}@${i} - ${t}`)),a}catch(e){if(e instanceof Lr)switch(e.response.status){case 410:s?.fail("ðĪŽ",`App ${n} is deleted from apps-service. Please check the app key and try again.`);break;case 404:s?.fail("ðĪŽ",`App ${n} not found. Please check the app key and try again.`);break;case 403:case 401:{const t=fr(e.response.status,`tag ${n}@${i}`);s?.fail("ð","Authentication/authorization error tagging application."),t&&s?.error(t),process.exit(1);break}default:s?.fail("ðĪŽ","Failed to tag application",`Status code: ${e.response.status}`,`Error: ${e.message}`)}const t=hr(e,`tag ${n}@${i}`);t&&(s?.fail("ð",`Token acquisition failed tagging ${n}@${i}`),s?.error(t),process.exit(1)),s?.fail("ðĪŽ","Failed to tag application:",e instanceof Error?e.message:String(e)),process.exit(1)}},Ec=x.object({templateEntry:x.string({message:"templateEntry must be a string"}).describe("Main entry point for the portal"),schemaEntry:x.string({message:"schemaEntry must be a string"}).describe("Schema file for portal validation"),assetPath:x.string({message:"assetPath must be a string"}).optional().describe("Asset path for dev/preview builds"),githubRepo:x.string({message:"githubRepo must be a string"}).optional().describe("GitHub repo URL or local git remote"),version:x.string({message:"version must be a string"}).describe("Version from package.json"),timestamp:x.string({message:"timestamp must be a string"}).describe("Current build timestamp (ISO8601)"),commitSha:x.string({message:"commitSha must be a string"}).describe("Current git commit SHA"),annotations:x.record(x.string(),x.string().nullish()).optional().transform(e=>{if(!e)return;const t=Object.entries(e).filter(([,e])=>void 0!==e);return Object.fromEntries(t)}).describe("Optional build annotations"),projectPage:x.string({message:"projectPage must be a string"}).optional().describe("Optional project homepage"),allowedExtensions:x.array(x.string({message:"Each allowed extension must be a string"}),{message:"allowedExtensions must be an array of strings"}).describe("List of allowed asset extensions (with leading dot)"),schema:x.record(x.string(),x.unknown()).optional().describe("Optional schema for the portal"),config:x.record(x.string(),x.unknown()).optional().describe("Optional configuration for the portal")}),bc=x.object({name:x.string({message:"name must be a string"}).describe("Short app key (unscoped, derived from package name)"),displayName:x.string({message:"displayName must be a string"}).optional().describe("Full package name, may include scope"),description:x.string({message:"description must be a string"}).optional().describe("Description of the portal"),build:Ec}),wc=(e,t)=>{xt(t,"expected packageJson"),P(t.name,"expected [name] in packageJson"),P(t.version,"expected [version] in packageJson");const n=((e,t)=>"build"===e.command||e.isPreview?t.main||t.module||"dist/bundle.js":lt(e.root))(e,t),r=t.name.replace(/^@|\w.*\//gm,""),i=t.version,o="build"===e.command?void 0:"/@fs",s=Tt(t)??kt(),a=jt.map(e=>`.${e}`),c={name:r,displayName:t.name,description:t.description||"",build:{templateEntry:n,schemaEntry:"portal.schema.json",assetPath:o,githubRepo:s,version:i,timestamp:(new Date).toISOString(),commitSha:Ft(),annotations:{...Gt()},projectPage:t.homepage,allowedExtensions:a}},l=bc.safeParse(c);if(!l.success){const e=l.error.issues.map(e=>`- ${e.path.join(".")}: ${e.message}`).join("\n");throw new Error(["Invalid portal manifest generated from package.json:",e].join("\n"))}return l.data},Lc=async(e,t,n)=>{const i=wc(e,t.packageJson);try{n?.log?.start("loading manifest...");const t=await(async(e,t)=>{const n=t?.file??[`portal.manifest.${e.environment}`,"portal.manifest"],r=await S(n,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async n=>{const r=t?.base??{};let i;return i="function"==typeof n.default?await n.default(e,{base:r})??void 0:n.default,i?_(r,i):r}}}),i=r.config,o=bc.safeParse(i);if(!o.success){const e=o.error.issues.map(e=>`${e.path.join(".")}: ${e.message}`).join("; ");throw new Error(`Invalid portal manifest: ${e}`)}return{manifest:i,path:r.path,extension:r.extension}})(e,{base:i});return n?.log?.succeed("generated manifest from",Vt(t.path,{relative:!0})),t.manifest}catch(e){if(e instanceof C){if(n?.manifestPath){const t=new Error(`Failed to load manifest file ${Vt(n.manifestPath)}, please check the path.`,{cause:e});throw n?.log?.fail(t.message),t}return n?.log?.succeed(r.dim("no local manifest config applied, using default generated from package")),i}throw n?.log?.fail(`failed to resolve application manifest ${n?.manifestPath?Vt(n?.manifestPath):""}`),e}},Ic=async(e,t)=>{const{log:n}=t;try{n?.start("create portal configuration"),n?.info(`generating config with ${r.red.dim(e.command)} command in ${r.green.dim(e.mode)} mode`);const i=await((e,t)=>{const n=t?.file??[`portal.config.${e.environment}`,"portal.config"];return S(n,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async n=>{const r=t?.schema??R.object({}).passthrough(),i=t?.base??{};if("function"==typeof n.default){const t=await n.default(i,e)??i;return r.parse(t)}return r.parse(n.default??i)}}})})(e,{file:t?.config});return n?.succeed("âïļ generated config from ",Vt(i.path,{relative:!0})),i.config}catch(e){if(e instanceof C){if(!t.config)return n?.succeed(r.dim("âïļ no local portal config applied, using built-in")),{};n?.warn(`failed to load config file ${Vt(t.config)}, please check the path.`)}throw n?.fail("failed to resolve portal config"),n?.debug(e),e}},Sc=async e=>{const{log:n}=e??{},r=await Zt(n),i={root:r.root,environment:"local",...e?.env,mode:"development",command:"serve"},o=await Lc(i,r,{log:n,manifestPath:e?.manifest}),s=await Ic(i,{log:n,config:e?.config}),a=t(await Rt(i,r),{server:{port:e?.server?.port,fs:{allow:[r.root]}}}),c={template:{portal:{id:o.name}},portal:{manifest:o,config:s}};n?.debug("vite config:",a),n?.debug("dev server config:",c),n?.start("Starting app development server...");const l=await ir(i,c,{overrides:a,log:n});return await l.listen(),n?.succeed(`Started app development server on ${l.resolvedUrls?.local?.[0]}`),l},Cc=async e=>{const{log:n,dir:r,port:i=4173,host:o="localhost"}=e??{};n?.log("Starting to serve portal");const s=await Zt(n);n?.start("Loading Vite config...");const c=await Rt({root:s.root,command:"build",mode:"production"},s);n?.succeed("Vite config loaded");const l=r||(c.build?.outDir||"dist"),u=a(s.root,l),f={root:s.root,environment:"local",mode:"production",command:"serve",isPreview:!0},d=await Lc(f,s,{log:n,manifestPath:e?.manifest}),p=await Ic(f,{log:n,config:e?.config});if(n?.debug("Output directory:",u),!w(u))throw new Error(`Build directory does not exist: ${u}\nPlease build the portal first using \`ffc portal build\``);d.build.assetPath=void 0,d.build.templateEntry=`/${d.build.templateEntry}`;const h=await Rt(f,s),m=t(h,{server:{port:i,host:o||h.server?.host||"localhost",fs:{allow:[s.root,u]}}}),g={template:{portal:{id:d.name}},portal:{manifest:d,config:p}};n?.debug("vite config:",m),n?.debug("dev server config:",g),n?.start("Starting preview server...");try{const e=await ir(f,g,{overrides:m,log:n});await e.listen(),n?.succeed("Preview server started successfully");const t=e.config.server?.https?"https":"http",r=e.config.server?.host||o,s=e.config.server?.port||i;return n?.info(`Preview server is running at: ${t}://${r}:${s}`),e}catch(e){throw n?.fail("Failed to start preview server"),e}},_c=async e=>{const{log:t}=e??{},n=await Zt(t);t?.debug("package",n);const r={command:"build",mode:process.env.NODE_ENV??"production",root:n.root,...e?.env};t?.debug("env:",r);const i=await Lc(r,n,{log:t,manifestPath:e?.manifest});return t?.debug("manifest:",i),{manifest:i,pkg:n,env:r}},Dc=async e=>{const{log:t}=e??{};t?.log(r.bold("Starting to build portal"));const{manifest:i,pkg:o,env:s}=await _c({log:t,manifest:e?.manifest});t?.start("loading vite config...");const a=await Rt(s,o);t?.succeed("vite config applied"),t?.debug("vite config:",a),t?.start("ðĪðŧ","building portal..."),t?.startNativeConsoleCapture(),await n(a),t?.stopNativeConsoleCapture(),t?.succeed("build completed ð");return{pkg:o,manifest:i,outDir:a.build.outDir}},Pc=async e=>{const{log:t,manifest:n}=e,r={command:"build",mode:process.env.NODE_ENV??"production",environment:null,root:process.cwd()},{pkg:i,manifest:o}=await Dc({log:t,manifest:n});if(!o.build)throw new Error("Manifest build config not found");const s=await(async(e,t)=>{const n=t?.file??[`portal.schema.${e.environment}`,"portal.schema"],r=await S(n,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async t=>{const n="function"==typeof t.default?await Promise.resolve(t.default(e)):t.default;if(!n)throw new Error("Schema function did not return a valid schema");return n}}});return{schema:r.config,path:r.path,extension:r.extension}})(r,{file:e?.schema});t?.debug("Schema:",s);return{archive:await vr(i,{log:t,archive:e?.archive,content:{"portal-template-manifest.json":JSON.stringify(o.build,null,2),"portal.schema.json":JSON.stringify(s.schema,null,2),"metadata.json":JSON.stringify({name:o.name,version:o.build.version})}}).catch(e=>{t?.error("Failed to create package:",e),process.exit(1)}),manifest:o,schema:s.schema}},Nc=async e=>{const{log:t}=e??{},n=await Zt(t),r={command:"build",mode:process.env.NODE_ENV??"production",root:n.root,...e?.env},i=await Ic(r,{log:t,config:e?.config});if(t?.debug("config:",i),e?.output){t?.start("writing config to file");try{await mr(e.output,JSON.stringify(i,null,2)),t?.succeed("config written successfully",Vt(e.output,{relative:!0}))}catch(e){throw t?.fail("failed to write config"),e}}return{config:i,pkg:n}},Oc=async e=>{const{log:t,portal:n}=e,{config:i}=await Nc({log:t,config:e.config,env:{environment:e.environment}});t?.start("Initializing Fusion Framework...");const o=await hc({env:e.environment,auth:e.auth});t?.succeed("Initialized Fusion Framework");try{const s=await o.serviceDiscovery.createClient("portals");s.request$.subscribe(e=>{t?.debug("Request:",e),t?.info("ð","Executing request to:",Vt(e.uri))}),t?.start("Publishing portal config"),t?.info("Using environment:",r.redBright(e.environment));const a=await s.json(`/portals/${n.name}@${n.version}/config`,{method:"PUT",body:i,headers:sr});t?.debug("Response:",a),t?.succeed("Published portal config")}catch(e){if(e instanceof Lr)switch(e.response.status){case 410:t?.fail("ðĪŽ",`Portal ${n.name} is deleted from portals-service. Please check the portal key and try again.`);break;case 404:t?.fail("ðĪŽ",`Portal ${n.name} not found. Please check the portal key and try again.`);break;case 403:case 401:{const r=fr(e.response.status,`publish config for portal ${n.name}`);t?.fail("ð","Authentication/authorization error publishing portal config."),r&&t?.error(r),process.exit(1);break}default:t?.fail("ðĪŽ","Failed to publish portal config.",`Status code: ${e.response.status}`,`Message: ${e.response.statusText}`)}const r=hr(e,`publish config for portal ${n.name}`);r&&(t?.fail("ð",`Token acquisition failed publishing config for ${n.name}`),t?.error(r),process.exit(1)),t?.fail("ðĪŽ","Failed to publish portal config:",e instanceof Error?e.message:String(e)),process.exit(1)}};const Ac=async e=>{const{log:t,framework:n}=e,i="string"==typeof e.fileOrBundle?new Mn(e.fileOrBundle):e.fileOrBundle,{name:o}=e.name?{name:e.name}:await mc(i).catch(e=>{t?.error("Failed to resolve manifest:",e),process.exit(1)}),s=await i.toBufferPromise().catch(e=>{t?.error("Failed to read bundle content:",e),process.exit(1)});try{const e=await n.serviceDiscovery.createClient("portal-config");e.request$.subscribe(e=>{t?.info("ð","Executing request to:",e.uri),t?.debug("Request:",e)});const i=await e.fetch(`/bundles/templates/${o}`,{method:"POST",body:new Blob([s],{type:"application/zip"}),headers:{...sr,"Content-Type":"application/zip"}});if(!i.ok){try{const{error:e}=await i.json();t?.debug("Error:",e),e.message&&t?.warn(r.red(`ðĪŊ error: ${e.code}\n`),r.yellowBright(e.message),"\n")}catch(e){t?.debug("Error:",i.statusText)}!function(e,t,n){const r=fr(e.status,`upload portal bundle for ${t}`);let i;switch(r&&(n?.fail("ð",`Authentication/authorization error uploading ${t}`),n?.error(r),process.exit(1)),e.status){case 409:i=`${e.status} - Version is already published, please generate a new release`;break;case 410:i=`${e.status} - ${t} is removed from Fusion`;break;case 404:i=`${e.status} - ${t} not found`;break;case 500:i=`${e.status} - Internal server error, please try again later or contact support`;break;default:i=`Failed to upload bundle. HTTP status ${e.status}, ${e.statusText}`}n?.fail("ð
ââïļ",i),process.exit(1)}(i,o,t)}t?.succeed("Successfully uploaded portal bundle"),t?.debug("Response:",i)}catch(e){const n=hr(e,`upload portal bundle for ${o}`);n&&(t?.fail("ð",`Token acquisition failed uploading ${o}`),t?.error(n),process.exit(1)),t?.fail("ð
ââïļ","Failed to upload portal bundle"),t?.error(e instanceof Error?e.message:e),process.exit(1)}},$c=async e=>{const{tag:t,name:n,version:i,framework:o,log:s}=e;t&&"string"==typeof t&&0!==t.trim().length||(s?.fail("ðĪŠ","Tag must be a non-empty string."),process.exit(1)),/^[a-zA-Z0-9.-]+$/.test(t)||(s?.fail("ðĪŠ",'Invalid tag. Use "latest", "preview" or string [a-z, A-Z, 0-9, ".", "-"].'),process.exit(1)),n||(s?.fail("ðĪŠ","Portal name is required."),process.exit(1)),i||(s?.fail("ðĪŠ","Version is required."),process.exit(1)),s?.info("Tagging portal:",r.greenBright(`${n}@${t}`,i));try{const e=await o.serviceDiscovery.createClient("portal-config");e.request$.subscribe(e=>{s?.debug("Request:",e),s?.info("ð","Executing request to:",Vt(e.uri))}),s?.start("Tagging portal template...");const r=await e.json(`/templates/${n}/tags/${t}`,{method:"PUT",body:{version:i},headers:sr});s?.debug("Response:",r),s?.succeed("Tagged portal template successfully"),s?.info("ð",JSON.stringify(r))}catch(e){if(e instanceof Lr){const{data:t,response:o}=e;switch(s?.debug("Error:",t),t&&s?.warn(r.red(`ðĪŊ error: ${t.code}\n`),r.yellowBright(t.message),"\n"),o?.status){case 410:s?.fail(`ðĪŽ - ${o?.status} -`,`${n} is deleted. Please check the name and try again.`);break;case 404:s?.fail(`ðĪŽ - ${o?.status} -`,`${n} not found. Please check the name and try again.`);break;case 403:case 401:{const e=fr(o?.status??401,`tag portal ${n}@${i}`);s?.fail("ð","Authentication/authorization error tagging portal."),e&&s?.error(e),process.exit(1);break}default:s?.fail(`ðĪŽ - ${o?.status} -`,"Failed to tag",`Error: ${e.message}`)}}const t=hr(e,`tag portal ${n}@${i}`);t&&(s?.fail("ð",`Token acquisition failed tagging ${n}@${i}`),s?.error(t),process.exit(1)),s?.fail("ðĪŽ","Failed to tag portal:",e instanceof Error?e.message:String(e)),process.exit(1)}},Rc=e=>e&&!fc?uc.Development:uc.ContinuesIntegration;export{Qn as ConsoleLogger,uc as FusionEnv,Yt as buildApplication,Dc as buildPortal,yr as bundleApp,Pc as bundlePortal,gc as checkApp,pc as configureFramework,br as generateApplicationConfig,Nc as generatePortalConfig,hc as initializeFramework,Kt as loadAppManifest,_c as loadPortalManifest,vr as pack,Cr as publishAppConfig,Oc as publishPortalConfig,Rc as resolveDefaultEnv,Dr as serveApplication,Cc as servePortal,_r as startAppDevServer,Sc as startPortalDevServer,yc as tagApplication,$c as tagPortal,vc as uploadApplication,Ac as uploadPortalBundle};
|
|
1
|
+
import{loadConfigFromFile as e,mergeConfig as t,build as n}from"vite";import r from"chalk";import i from"vite-tsconfig-paths";import o,{dirname as s,resolve as a,basename as c,extname as l,relative as u}from"node:path";import{readPackageUp as f}from"read-package-up";import d,{fileURLToPath as p}from"node:url";import h from"node:module";import m from"util";import g,{accessSync as v,constants as y,readFileSync as E,statSync as b,existsSync as w,mkdirSync as L,writeFileSync as I}from"node:fs";import{importConfig as S,FileNotFoundError as C}from"@equinor/fusion-imports";import _ from"deepmerge";import{rawImportsPlugin as D}from"@equinor/fusion-framework-vite-plugin-raw-imports";import P from"node:assert";import{execSync as N}from"node:child_process";import{coerce as O,SemVer as A,satisfies as $}from"semver";import R,{z as x}from"zod";import T from"fs";import k from"path";import F from"zlib";import U from"crypto";import{readdir as B,stat as M,mkdir as G}from"node:fs/promises";import j from"ora";import{processServices as H,createDevServer as z}from"@equinor/fusion-framework-dev-server";import{enableAzureIdentityAuth as q}from"@equinor/fusion-framework-module-azure-identity";function V(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var W,Z,K,Y;function X(){if(Z)return W;Z=1;const e="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};return W=e}function J(){if(Y)return K;Y=1;const e=Number.MAX_SAFE_INTEGER||9007199254740991;return K={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:e,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}}var Q,ee,te,ne,re,ie,oe,se,ae,ce,le,ue,fe,de={exports:{}};function pe(){return Q||(Q=1,function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=J(),o=X(),s=(t=e.exports={}).re=[],a=t.safeRe=[],c=t.src=[],l=t.safeSrc=[],u=t.t={};let f=0;const d="[a-zA-Z0-9-]",p=[["\\s",1],["\\d",i],[d,r]],h=(e,t,n)=>{const r=(e=>{for(const[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e})(t),i=f++;o(e,i,t),u[e]=i,c[i]=t,l[i]=r,s[i]=new RegExp(t,n?"g":void 0),a[i]=new RegExp(r,n?"g":void 0)};h("NUMERICIDENTIFIER","0|[1-9]\\d*"),h("NUMERICIDENTIFIERLOOSE","\\d+"),h("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${d}*`),h("MAINVERSION",`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h("MAINVERSIONLOOSE",`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASEIDENTIFIER",`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h("PRERELEASEIDENTIFIERLOOSE",`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASE",`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h("PRERELEASELOOSE",`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h("BUILDIDENTIFIER",`${d}+`),h("BUILD",`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h("FULLPLAIN",`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h("FULL",`^${c[u.FULLPLAIN]}$`),h("LOOSEPLAIN",`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h("LOOSE",`^${c[u.LOOSEPLAIN]}$`),h("GTLT","((?:<|>)?=?)"),h("XRANGEIDENTIFIERLOOSE",`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h("XRANGEIDENTIFIER",`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h("XRANGEPLAIN",`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h("XRANGEPLAINLOOSE",`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h("XRANGE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h("XRANGELOOSE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h("COERCEPLAIN",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h("COERCE",`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h("COERCEFULL",c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?`+`(?:${c[u.BUILD]})?(?:$|[^\\d])`),h("COERCERTL",c[u.COERCE],!0),h("COERCERTLFULL",c[u.COERCEFULL],!0),h("LONETILDE","(?:~>?)"),h("TILDETRIM",`(\\s*)${c[u.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",h("TILDE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h("TILDELOOSE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h("LONECARET","(?:\\^)"),h("CARETTRIM",`(\\s*)${c[u.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",h("CARET",`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h("CARETLOOSE",`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h("COMPARATORLOOSE",`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h("COMPARATOR",`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h("COMPARATORTRIM",`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",h("HYPHENRANGE",`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h("HYPHENRANGELOOSE",`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h("STAR","(<|>)?=?\\s*\\*"),h("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),h("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(de,de.exports)),de.exports}function he(){if(oe)return ie;oe=1;const e=X(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:n}=J(),{safeRe:r,t:i}=pe(),o=function(){if(te)return ee;te=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return ee=n=>n?"object"!=typeof n?e:n:t}(),{compareIdentifiers:s}=function(){if(re)return ne;re=1;const e=/^[0-9]+$/,t=(t,n)=>{if("number"==typeof t&&"number"==typeof n)return t===n?0:t<n?-1:1;const r=e.test(t),i=e.test(n);return r&&i&&(t=+t,n=+n),t===n?0:r&&!i?-1:i&&!r?1:t<n?-1:1};return ne={compareIdentifiers:t,rcompareIdentifiers:(e,n)=>t(n,e)}}();class a{constructor(s,c){if(c=o(c),s instanceof a){if(s.loose===!!c.loose&&s.includePrerelease===!!c.includePrerelease)return s;s=s.version}else if("string"!=typeof s)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof s}".`);if(s.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",s,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;const l=s.trim().match(c.loose?r[i.LOOSE]:r[i.FULL]);if(!l)throw new TypeError(`Invalid Version: ${s}`);if(this.raw=s,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>n||this.major<0)throw new TypeError("Invalid major version");if(this.minor>n||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>n||this.patch<0)throw new TypeError("Invalid patch version");l[4]?this.prerelease=l[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<n)return t}return e}):this.prerelease=[],this.build=l[5]?l[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(e("SemVer.compare",this.version,this.options,t),!(t instanceof a)){if("string"==typeof t&&t===this.version)return 0;t=new a(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(e){return e instanceof a||(e=new a(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(t){if(t instanceof a||(t=new a(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let n=0;do{const r=this.prerelease[n],i=t.prerelease[n];if(e("prerelease compare",n,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return-1;if(r!==i)return s(r,i)}while(++n)}compareBuild(t){t instanceof a||(t=new a(t,this.options));let n=0;do{const r=this.build[n],i=t.build[n];if(e("build compare",n,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return-1;if(r!==i)return s(r,i)}while(++n)}inc(e,t,n){if(e.startsWith("pre")){if(!t&&!1===n)throw new Error("invalid increment argument: identifier is empty");if(t){const e=`-${t}`.match(this.options.loose?r[i.PRERELEASELOOSE]:r[i.PRERELEASE]);if(!e||e[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,n),this.inc("pre",t,n);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,n),this.inc("pre",t,n);break;case"release":if(0===this.prerelease.length)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(n)?1:0;if(0===this.prerelease.length)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);if(-1===r){if(t===this.prerelease.join(".")&&!1===n)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let r=[t,e];if(!1===n&&(r=[t]),((e,t)=>{const n=t.split(".");if(n.length>e.length)return!1;for(let t=0;t<n.length;t++)if(0!==s(e[t],n[t]))return!1;return!0})(this.prerelease,t)){const e=this.prerelease[t.split(".").length];isNaN(e)&&(this.prerelease=r)}else this.prerelease=r}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return ie=a}function me(){if(ae)return se;ae=1;const e=he();return se=(t,n,r=!1)=>{if(t instanceof e)return t;try{return new e(t,n)}catch(e){if(!r)return null;throw e}},se}var ge,ve,ye,Ee,be,we,Le,Ie,Se,Ce,_e=["0BSD","3D-Slicer-1.0","AAL","ADSL","AFL-1.1","AFL-1.2","AFL-2.0","AFL-2.1","AFL-3.0","AGPL-1.0-only","AGPL-1.0-or-later","AGPL-3.0-only","AGPL-3.0-or-later","AMD-newlib","AMDPLPA","AML","AML-glslang","AMPAS","ANTLR-PD","ANTLR-PD-fallback","APAFML","APL-1.0","APSL-1.0","APSL-1.1","APSL-1.2","APSL-2.0","ASWF-Digital-Assets-1.0","ASWF-Digital-Assets-1.1","Abstyles","AdaCore-doc","Adobe-2006","Adobe-Display-PostScript","Adobe-Glyph","Adobe-Utopia","Afmparse","Aladdin","Apache-1.0","Apache-1.1","Apache-2.0","App-s2p","Arphic-1999","Artistic-1.0","Artistic-1.0-Perl","Artistic-1.0-cl8","Artistic-2.0","Artistic-dist","Aspell-RU","BSD-1-Clause","BSD-2-Clause","BSD-2-Clause-Darwin","BSD-2-Clause-Patent","BSD-2-Clause-Views","BSD-2-Clause-first-lines","BSD-2-Clause-pkgconf-disclaimer","BSD-3-Clause","BSD-3-Clause-Attribution","BSD-3-Clause-Clear","BSD-3-Clause-HP","BSD-3-Clause-LBNL","BSD-3-Clause-Modification","BSD-3-Clause-No-Military-License","BSD-3-Clause-No-Nuclear-License","BSD-3-Clause-No-Nuclear-License-2014","BSD-3-Clause-No-Nuclear-Warranty","BSD-3-Clause-Open-MPI","BSD-3-Clause-Sun","BSD-3-Clause-acpica","BSD-3-Clause-flex","BSD-4-Clause","BSD-4-Clause-Shortened","BSD-4-Clause-UC","BSD-4.3RENO","BSD-4.3TAHOE","BSD-Advertising-Acknowledgement","BSD-Attribution-HPND-disclaimer","BSD-Inferno-Nettverk","BSD-Protection","BSD-Source-Code","BSD-Source-beginning-file","BSD-Systemics","BSD-Systemics-W3Works","BSL-1.0","BUSL-1.1","Baekmuk","Bahyph","Barr","Beerware","BitTorrent-1.0","BitTorrent-1.1","Bitstream-Charter","Bitstream-Vera","BlueOak-1.0.0","Boehm-GC","Boehm-GC-without-fee","Borceux","Brian-Gladman-2-Clause","Brian-Gladman-3-Clause","C-UDA-1.0","CAL-1.0","CAL-1.0-Combined-Work-Exception","CATOSL-1.1","CC-BY-1.0","CC-BY-2.0","CC-BY-2.5","CC-BY-2.5-AU","CC-BY-3.0","CC-BY-3.0-AT","CC-BY-3.0-AU","CC-BY-3.0-DE","CC-BY-3.0-IGO","CC-BY-3.0-NL","CC-BY-3.0-US","CC-BY-4.0","CC-BY-NC-1.0","CC-BY-NC-2.0","CC-BY-NC-2.5","CC-BY-NC-3.0","CC-BY-NC-3.0-DE","CC-BY-NC-4.0","CC-BY-NC-ND-1.0","CC-BY-NC-ND-2.0","CC-BY-NC-ND-2.5","CC-BY-NC-ND-3.0","CC-BY-NC-ND-3.0-DE","CC-BY-NC-ND-3.0-IGO","CC-BY-NC-ND-4.0","CC-BY-NC-SA-1.0","CC-BY-NC-SA-2.0","CC-BY-NC-SA-2.0-DE","CC-BY-NC-SA-2.0-FR","CC-BY-NC-SA-2.0-UK","CC-BY-NC-SA-2.5","CC-BY-NC-SA-3.0","CC-BY-NC-SA-3.0-DE","CC-BY-NC-SA-3.0-IGO","CC-BY-NC-SA-4.0","CC-BY-ND-1.0","CC-BY-ND-2.0","CC-BY-ND-2.5","CC-BY-ND-3.0","CC-BY-ND-3.0-DE","CC-BY-ND-4.0","CC-BY-SA-1.0","CC-BY-SA-2.0","CC-BY-SA-2.0-UK","CC-BY-SA-2.1-JP","CC-BY-SA-2.5","CC-BY-SA-3.0","CC-BY-SA-3.0-AT","CC-BY-SA-3.0-DE","CC-BY-SA-3.0-IGO","CC-BY-SA-4.0","CC-PDDC","CC-PDM-1.0","CC-SA-1.0","CC0-1.0","CDDL-1.0","CDDL-1.1","CDL-1.0","CDLA-Permissive-1.0","CDLA-Permissive-2.0","CDLA-Sharing-1.0","CECILL-1.0","CECILL-1.1","CECILL-2.0","CECILL-2.1","CECILL-B","CECILL-C","CERN-OHL-1.1","CERN-OHL-1.2","CERN-OHL-P-2.0","CERN-OHL-S-2.0","CERN-OHL-W-2.0","CFITSIO","CMU-Mach","CMU-Mach-nodoc","CNRI-Jython","CNRI-Python","CNRI-Python-GPL-Compatible","COIL-1.0","CPAL-1.0","CPL-1.0","CPOL-1.02","CUA-OPL-1.0","Caldera","Caldera-no-preamble","Catharon","ClArtistic","Clips","Community-Spec-1.0","Condor-1.1","Cornell-Lossless-JPEG","Cronyx","Crossword","CryptoSwift","CrystalStacker","Cube","D-FSL-1.0","DEC-3-Clause","DL-DE-BY-2.0","DL-DE-ZERO-2.0","DOC","DRL-1.0","DRL-1.1","DSDP","DocBook-DTD","DocBook-Schema","DocBook-Stylesheet","DocBook-XML","Dotseqn","ECL-1.0","ECL-2.0","EFL-1.0","EFL-2.0","EPICS","EPL-1.0","EPL-2.0","EUDatagrid","EUPL-1.0","EUPL-1.1","EUPL-1.2","Elastic-2.0","Entessa","ErlPL-1.1","Eurosym","FBM","FDK-AAC","FSFAP","FSFAP-no-warranty-disclaimer","FSFUL","FSFULLR","FSFULLRSD","FSFULLRWD","FSL-1.1-ALv2","FSL-1.1-MIT","FTL","Fair","Ferguson-Twofish","Frameworx-1.0","FreeBSD-DOC","FreeImage","Furuseth","GCR-docs","GD","GFDL-1.1-invariants-only","GFDL-1.1-invariants-or-later","GFDL-1.1-no-invariants-only","GFDL-1.1-no-invariants-or-later","GFDL-1.1-only","GFDL-1.1-or-later","GFDL-1.2-invariants-only","GFDL-1.2-invariants-or-later","GFDL-1.2-no-invariants-only","GFDL-1.2-no-invariants-or-later","GFDL-1.2-only","GFDL-1.2-or-later","GFDL-1.3-invariants-only","GFDL-1.3-invariants-or-later","GFDL-1.3-no-invariants-only","GFDL-1.3-no-invariants-or-later","GFDL-1.3-only","GFDL-1.3-or-later","GL2PS","GLWTPL","GPL-1.0-only","GPL-1.0-or-later","GPL-2.0-only","GPL-2.0-or-later","GPL-3.0-only","GPL-3.0-or-later","Game-Programming-Gems","Giftware","Glide","Glulxe","Graphics-Gems","Gutmann","HDF5","HIDAPI","HP-1986","HP-1989","HPND","HPND-DEC","HPND-Fenneberg-Livingston","HPND-INRIA-IMAG","HPND-Intel","HPND-Kevlin-Henney","HPND-MIT-disclaimer","HPND-Markus-Kuhn","HPND-Netrek","HPND-Pbmplus","HPND-UC","HPND-UC-export-US","HPND-doc","HPND-doc-sell","HPND-export-US","HPND-export-US-acknowledgement","HPND-export-US-modify","HPND-export2-US","HPND-merchantability-variant","HPND-sell-MIT-disclaimer-xserver","HPND-sell-regexpr","HPND-sell-variant","HPND-sell-variant-MIT-disclaimer","HPND-sell-variant-MIT-disclaimer-rev","HTMLTIDY","HaskellReport","Hippocratic-2.1","IBM-pibs","ICU","IEC-Code-Components-EULA","IJG","IJG-short","IPA","IPL-1.0","ISC","ISC-Veillard","ImageMagick","Imlib2","Info-ZIP","Inner-Net-2.0","InnoSetup","Intel","Intel-ACPI","Interbase-1.0","JPL-image","JPNIC","JSON","Jam","JasPer-2.0","Kastrup","Kazlib","Knuth-CTAN","LAL-1.2","LAL-1.3","LGPL-2.0-only","LGPL-2.0-or-later","LGPL-2.1-only","LGPL-2.1-or-later","LGPL-3.0-only","LGPL-3.0-or-later","LGPLLR","LOOP","LPD-document","LPL-1.0","LPL-1.02","LPPL-1.0","LPPL-1.1","LPPL-1.2","LPPL-1.3a","LPPL-1.3c","LZMA-SDK-9.11-to-9.20","LZMA-SDK-9.22","Latex2e","Latex2e-translated-notice","Leptonica","LiLiQ-P-1.1","LiLiQ-R-1.1","LiLiQ-Rplus-1.1","Libpng","Linux-OpenIB","Linux-man-pages-1-para","Linux-man-pages-copyleft","Linux-man-pages-copyleft-2-para","Linux-man-pages-copyleft-var","Lucida-Bitmap-Fonts","MIPS","MIT","MIT-0","MIT-CMU","MIT-Click","MIT-Festival","MIT-Khronos-old","MIT-Modern-Variant","MIT-Wu","MIT-advertising","MIT-enna","MIT-feh","MIT-open-group","MIT-testregex","MITNFA","MMIXware","MPEG-SSG","MPL-1.0","MPL-1.1","MPL-2.0","MPL-2.0-no-copyleft-exception","MS-LPL","MS-PL","MS-RL","MTLL","Mackerras-3-Clause","Mackerras-3-Clause-acknowledgment","MakeIndex","Martin-Birgmeier","McPhee-slideshow","Minpack","MirOS","Motosoto","MulanPSL-1.0","MulanPSL-2.0","Multics","Mup","NAIST-2003","NASA-1.3","NBPL-1.0","NCBI-PD","NCGL-UK-2.0","NCL","NCSA","NGPL","NICTA-1.0","NIST-PD","NIST-PD-fallback","NIST-Software","NLOD-1.0","NLOD-2.0","NLPL","NOSL","NPL-1.0","NPL-1.1","NPOSL-3.0","NRL","NTIA-PD","NTP","NTP-0","Naumen","NetCDF","Newsletr","Nokia","Noweb","O-UDA-1.0","OAR","OCCT-PL","OCLC-2.0","ODC-By-1.0","ODbL-1.0","OFFIS","OFL-1.0","OFL-1.0-RFN","OFL-1.0-no-RFN","OFL-1.1","OFL-1.1-RFN","OFL-1.1-no-RFN","OGC-1.0","OGDL-Taiwan-1.0","OGL-Canada-2.0","OGL-UK-1.0","OGL-UK-2.0","OGL-UK-3.0","OGTSL","OLDAP-1.1","OLDAP-1.2","OLDAP-1.3","OLDAP-1.4","OLDAP-2.0","OLDAP-2.0.1","OLDAP-2.1","OLDAP-2.2","OLDAP-2.2.1","OLDAP-2.2.2","OLDAP-2.3","OLDAP-2.4","OLDAP-2.5","OLDAP-2.6","OLDAP-2.7","OLDAP-2.8","OLFL-1.3","OML","OPL-1.0","OPL-UK-3.0","OPUBL-1.0","OSET-PL-2.1","OSL-1.0","OSL-1.1","OSL-2.0","OSL-2.1","OSL-3.0","OpenPBS-2.3","OpenSSL","OpenSSL-standalone","OpenVision","PADL","PDDL-1.0","PHP-3.0","PHP-3.01","PPL","PSF-2.0","Parity-6.0.0","Parity-7.0.0","Pixar","Plexus","PolyForm-Noncommercial-1.0.0","PolyForm-Small-Business-1.0.0","PostgreSQL","Python-2.0","Python-2.0.1","QPL-1.0","QPL-1.0-INRIA-2004","Qhull","RHeCos-1.1","RPL-1.1","RPL-1.5","RPSL-1.0","RSA-MD","RSCPL","Rdisc","Ruby","Ruby-pty","SAX-PD","SAX-PD-2.0","SCEA","SGI-B-1.0","SGI-B-1.1","SGI-B-2.0","SGI-OpenGL","SGP4","SHL-0.5","SHL-0.51","SISSL","SISSL-1.2","SL","SMAIL-GPL","SMLNJ","SMPPL","SNIA","SOFA","SPL-1.0","SSH-OpenSSH","SSH-short","SSLeay-standalone","SSPL-1.0","SUL-1.0","SWL","Saxpath","SchemeReport","Sendmail","Sendmail-8.23","Sendmail-Open-Source-1.1","SimPL-2.0","Sleepycat","Soundex","Spencer-86","Spencer-94","Spencer-99","SugarCRM-1.1.3","Sun-PPP","Sun-PPP-2000","SunPro","Symlinks","TAPR-OHL-1.0","TCL","TCP-wrappers","TGPPL-1.0","TMate","TORQUE-1.1","TOSL","TPDL","TPL-1.0","TTWL","TTYP0","TU-Berlin-1.0","TU-Berlin-2.0","TermReadKey","ThirdEye","TrustedQSL","UCAR","UCL-1.0","UMich-Merit","UPL-1.0","URT-RLE","Ubuntu-font-1.0","Unicode-3.0","Unicode-DFS-2015","Unicode-DFS-2016","Unicode-TOU","UnixCrypt","Unlicense","Unlicense-libtelnet","Unlicense-libwhirlpool","VOSTROM","VSL-1.0","Vim","W3C","W3C-19980720","W3C-20150513","WTFPL","Watcom-1.0","Widget-Workshop","Wsuipa","X11","X11-distribute-modifications-variant","X11-swapped","XFree86-1.1","XSkat","Xdebug-1.03","Xerox","Xfig","Xnet","YPL-1.0","YPL-1.1","ZPL-1.1","ZPL-2.0","ZPL-2.1","Zed","Zeeff","Zend-2.0","Zimbra-1.3","Zimbra-1.4","Zlib","any-OSI","any-OSI-perl-modules","bcrypt-Solar-Designer","blessing","bzip2-1.0.6","check-cvs","checkmk","copyleft-next-0.3.0","copyleft-next-0.3.1","curl","cve-tou","diffmark","dtoa","dvipdfm","eGenix","etalab-2.0","fwlw","gSOAP-1.3b","generic-xts","gnuplot","gtkbook","hdparm","iMatix","jove","libpng-1.6.35","libpng-2.0","libselinux-1.0","libtiff","libutil-David-Nugent","lsof","magaz","mailprio","man2html","metamail","mpi-permissive","mpich2","mplus","ngrep","pkgconf","pnmstitch","psfrag","psutils","python-ldap","radvd","snprintf","softSurfer","ssh-keyscan","swrule","threeparttable","ulem","w3m","wwl","xinetd","xkeyboard-config-Zinoviev","xlock","xpp","xzoom","zlib-acknowledgement"],De=["AGPL-1.0","AGPL-3.0","BSD-2-Clause-FreeBSD","BSD-2-Clause-NetBSD","GFDL-1.1","GFDL-1.2","GFDL-1.3","GPL-1.0","GPL-2.0","GPL-2.0-with-GCC-exception","GPL-2.0-with-autoconf-exception","GPL-2.0-with-bison-exception","GPL-2.0-with-classpath-exception","GPL-2.0-with-font-exception","GPL-3.0","GPL-3.0-with-GCC-exception","GPL-3.0-with-autoconf-exception","LGPL-2.0","LGPL-2.1","LGPL-3.0","Net-SNMP","Nunit","StandardML-NJ","bzip2-1.0.5","eCos-2.0","wxWindows"],Pe=["389-exception","Asterisk-exception","Autoconf-exception-2.0","Autoconf-exception-3.0","Autoconf-exception-generic","Autoconf-exception-generic-3.0","Autoconf-exception-macro","Bison-exception-1.24","Bison-exception-2.2","Bootloader-exception","Classpath-exception-2.0","CLISP-exception-2.0","cryptsetup-OpenSSL-exception","DigiRule-FOSS-exception","eCos-exception-2.0","Fawkes-Runtime-exception","FLTK-exception","fmt-exception","Font-exception-2.0","freertos-exception-2.0","GCC-exception-2.0","GCC-exception-2.0-note","GCC-exception-3.1","Gmsh-exception","GNAT-exception","GNOME-examples-exception","GNU-compiler-exception","gnu-javamail-exception","GPL-3.0-interface-exception","GPL-3.0-linking-exception","GPL-3.0-linking-source-exception","GPL-CC-1.0","GStreamer-exception-2005","GStreamer-exception-2008","i2p-gpl-java-exception","KiCad-libraries-exception","LGPL-3.0-linking-exception","libpri-OpenH323-exception","Libtool-exception","Linux-syscall-note","LLGPL","LLVM-exception","LZMA-exception","mif-exception","OCaml-LGPL-linking-exception","OCCT-exception-1.0","OpenJDK-assembly-exception-1.0","openvpn-openssl-exception","PS-or-PDF-font-exception-20170817","QPL-1.0-INRIA-2004-exception","Qt-GPL-exception-1.0","Qt-LGPL-exception-1.1","Qwt-exception-1.0","SANE-exception","SHL-2.0","SHL-2.1","stunnel-exception","SWI-exception","Swift-exception","Texinfo-exception","u-boot-exception-2.0","UBDL-exception","Universal-FOSS-exception-1.0","vsftpd-openssl-exception","WxWindows-exception-3.1","x11vnc-openssl-exception"];function Ne(){if(ve)return ge;ve=1;var e=[].concat(_e).concat(De),t=Pe;return ge=function(n){var r=0;function i(){return r<n.length}function o(e){if(e instanceof RegExp){var t=n.slice(r).match(e);if(t)return r+=t[0].length,t[0]}else if(n.indexOf(e,r)===r)return r+=e.length,e}function s(){o(/[ ]*/)}function a(){return o(/[A-Za-z0-9-.]+/)}function c(){var e=a();if(!e)throw new Error("Expected idstring at offset "+r);return e}function l(){return function(){for(var e,t=["WITH","AND","OR","(",")",":","+"],i=0;i<t.length&&!(e=o(t[i]));i++);if("+"===e&&r>1&&" "===n[r-2])throw new Error("Space before `+`");return e&&{type:"OPERATOR",string:e}}()||function(){if(o("DocumentRef-"))return{type:"DOCUMENTREF",string:c()}}()||function(){if(o("LicenseRef-"))return{type:"LICENSEREF",string:c()}}()||(i=r,s=a(),-1!==e.indexOf(s)?{type:"LICENSE",string:s}:-1!==t.indexOf(s)?{type:"EXCEPTION",string:s}:void(r=i));var i,s}for(var u=[];i()&&(s(),i());){var f=l();if(!f)throw new Error("Unexpected `"+n[r]+"` at offset "+r);u.push(f)}return u}}function Oe(){return Ee?ye:(Ee=1,ye=function(e){var t=0;function n(){return t<e.length}function r(){return n()?e[t]:null}function i(){if(!n())throw new Error;t++}function o(e){var t=r();if(t&&"OPERATOR"===t.type&&e===t.string)return i(),t.string}function s(){var e=r();if(e&&"LICENSE"===e.type){i();var t={license:e.string};o("+")&&(t.plus=!0);var n=function(){if(o("WITH")){var e=r();if(e&&"EXCEPTION"===e.type)return i(),e.string;throw new Error("Expected exception after `WITH`")}}();return n&&(t.exception=n),t}}function a(e,t){return function n(){var r=t();if(r){if(!o(e))return r;var i=n();if(!i)throw new Error("Expected expression");return{left:r,conjunction:e.toLowerCase(),right:i}}}}var c=a("AND",function(){return function(){if(o("(")){var e=l();if(!o(")"))throw new Error("Expected `)`");return e}}()||function(){var e=t,n="",s=r();if("DOCUMENTREF"===s.type&&(i(),n+="DocumentRef-"+s.string+":",!o(":")))throw new Error("Expected `:` after `DocumentRef-...`");if("LICENSEREF"===(s=r()).type)return i(),{license:n+="LicenseRef-"+s.string};t=e}()||s()}),l=a("OR",c),u=l();if(!u||n())throw new Error("Syntax error");return u})}function Ae(){if(we)return be;we=1;var e=Ne(),t=Oe();return be=function(n){return t(e(n))}}function $e(){if(Ce)return Se;Ce=1;var e=Ae(),t=function(){if(Ie)return Le;Ie=1;var e=Ae(),t=_e;function n(t){try{return e(t),!0}catch(e){return!1}}function r(e,t){var n=t[0].length-e[0].length;return 0!==n?n:e[0].toUpperCase().localeCompare(t[0].toUpperCase())}var i=[["APGL","AGPL"],["Gpl","GPL"],["GLP","GPL"],["APL","Apache"],["ISD","ISC"],["GLP","GPL"],["IST","ISC"],["Claude","Clause"],[" or later","+"],[" International",""],["GNU","GPL"],["GUN","GPL"],["+",""],["GNU GPL","GPL"],["GNU LGPL","LGPL"],["GNU/GPL","GPL"],["GNU GLP","GPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL"],["GNU Lesser General Public License","LGPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["GNU Lesser General Public License","LGPL-2.1"],["LESSER GENERAL PUBLIC LICENSE","LGPL"],["Lesser General Public License","LGPL"],["LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["Lesser General Public License","LGPL-2.1"],["GNU General Public License","GPL"],["Gnu public license","GPL"],["GNU Public License","GPL"],["GNU GENERAL PUBLIC LICENSE","GPL"],["MTI","MIT"],["Mozilla Public License","MPL"],["Universal Permissive License","UPL"],["WTH","WTF"],["WTFGPL","WTFPL"],["-License",""]].sort(r),o=[function(e){return e.toUpperCase()},function(e){return e.trim()},function(e){return e.replace(/\./g,"")},function(e){return e.replace(/\s+/g,"")},function(e){return e.replace(/\s+/g,"-")},function(e){return e.replace("v","-")},function(e){return e.replace(/,?\s*(\d)/,"-$1")},function(e){return e.replace(/,?\s*(\d)/,"-$1.0")},function(e){return e.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2")},function(e){return e.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2.0")},function(e){return e[0].toUpperCase()+e.slice(1)},function(e){return e.replace("/","-")},function(e){return e.replace(/\s*V\s*(\d)/,"-$1").replace(/(\d)$/,"$1.0")},function(e){return-1!==e.indexOf("3.0")?e+"-or-later":e+"-only"},function(e){return e+"only"},function(e){return e.replace(/(\d)$/,"-$1.0")},function(e){return e.replace(/(-| )?(\d)$/,"-$2-Clause")},function(e){return e.replace(/(-| )clause(-| )(\d)/,"-$3-Clause")},function(e){return e.replace(/\b(Modified|New|Revised)(-| )?BSD((-| )License)?/i,"BSD-3-Clause")},function(e){return e.replace(/\bSimplified(-| )?BSD((-| )License)?/i,"BSD-2-Clause")},function(e){return e.replace(/\b(Free|Net)(-| )?BSD((-| )License)?/i,"BSD-2-Clause-$1BSD")},function(e){return e.replace(/\bClear(-| )?BSD((-| )License)?/i,"BSD-3-Clause-Clear")},function(e){return e.replace(/\b(Old|Original)(-| )?BSD((-| )License)?/i,"BSD-4-Clause")},function(e){return"CC-"+e},function(e){return"CC-"+e+"-4.0"},function(e){return e.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")},function(e){return"CC-"+e.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")+"-4.0"}],s=t.map(function(e){var t=/^(.*)-\d+\.\d+$/.exec(e);return t?[t[0],t[1]]:[e,null]}).reduce(function(e,t){var n=t[1];return e[n]=e[n]||[],e[n].push(t[0]),e},{}),a=Object.keys(s).map(function(e){return[e,s[e]]}).filter(function(e){return 1===e[1].length&&null!==e[0]&&"APL"!==e[0]}).map(function(e){return[e[0],e[1][0]]});s=void 0;var c=[["UNLI","Unlicense"],["WTF","WTFPL"],["2 CLAUSE","BSD-2-Clause"],["2-CLAUSE","BSD-2-Clause"],["3 CLAUSE","BSD-3-Clause"],["3-CLAUSE","BSD-3-Clause"],["AFFERO","AGPL-3.0-or-later"],["AGPL","AGPL-3.0-or-later"],["APACHE","Apache-2.0"],["ARTISTIC","Artistic-2.0"],["Affero","AGPL-3.0-or-later"],["BEER","Beerware"],["BOOST","BSL-1.0"],["BSD","BSD-2-Clause"],["CDDL","CDDL-1.1"],["ECLIPSE","EPL-1.0"],["FUCK","WTFPL"],["GNU","GPL-3.0-or-later"],["LGPL","LGPL-3.0-or-later"],["GPLV1","GPL-1.0-only"],["GPL-1","GPL-1.0-only"],["GPLV2","GPL-2.0-only"],["GPL-2","GPL-2.0-only"],["GPL","GPL-3.0-or-later"],["MIT +NO-FALSE-ATTRIBS","MITNFA"],["MIT","MIT"],["MPL","MPL-2.0"],["X11","X11"],["ZLIB","Zlib"]].concat(a).sort(r),l=function(e){for(var t=0;t<o.length;t++){var r=o[t](e).trim();if(r!==e&&n(r))return r}return null},u=function(e){for(var t=e.toUpperCase(),n=0;n<c.length;n++){var r=c[n];if(t.indexOf(r[0])>-1)return r[1]}return null},f=function(e,t){for(var n=0;n<i.length;n++){var r=i[n],o=r[0];if(e.indexOf(o)>-1){var s=t(e.replace(o,r[1]));if(null!==s)return s}}return null};return Le=function(e,t){var r=void 0===(t=t||{}).upgrade||!!t.upgrade;function i(e){return r?function(e){return-1!==["GPL-1.0","LGPL-1.0","AGPL-1.0","GPL-2.0","LGPL-2.0","AGPL-2.0","LGPL-2.1"].indexOf(e)?e+"-only":-1!==["GPL-1.0+","GPL-2.0+","GPL-3.0+","LGPL-2.0+","LGPL-2.1+","LGPL-3.0+","AGPL-1.0+","AGPL-3.0+"].indexOf(e)?e.replace(/\+$/,"-or-later"):-1!==["GPL-3.0","LGPL-3.0","AGPL-3.0"].indexOf(e)?e+"-or-later":e}(e):e}if("string"!=typeof e||0===e.trim().length)throw Error("Invalid argument. Expected non-empty string.");if(n(e=e.trim()))return i(e);var o=e.replace(/\+$/,"").trim();if(n(o))return i(o);var s=l(e);return null!==s||null!==(s=f(e,function(e){return n(e)?e:l(e)}))||null!==(s=u(e))||null!==(s=f(e,u))?i(s):null}}(),n='license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>"',r=/^SEE LICEN[CS]E IN (.+)$/;function i(e,t){return t.slice(0,e.length)===e}function o(e){if(e.hasOwnProperty("license")){var t=e.license;return i("LicenseRef",t)||i("DocumentRef",t)}return o(e.left)||o(e.right)}return Se=function(i){var s;try{s=e(i)}catch(e){var a;if("UNLICENSED"===i||"UNLICENCED"===i)return{validForOldPackages:!0,validForNewPackages:!0,unlicensed:!0};if(a=r.exec(i))return{validForOldPackages:!0,validForNewPackages:!0,inFile:a[1]};var c={validForOldPackages:!1,validForNewPackages:!1,warnings:[n]};if(0!==i.trim().length){var l=t(i);l&&c.warnings.push('license is similar to the valid expression "'+l+'"')}return c}return o(s)?{validForNewPackages:!1,validForOldPackages:!1,spdx:!0,warnings:[n]}:{validForNewPackages:!0,validForOldPackages:!0,spdx:!0}}}var Re,xe,Te,ke,Fe,Ue,Be,Me,Ge,je,He,ze={};function qe(){if(Re)return ze;Re=1;var e=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),t=e(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.tracing=e.metrics=void 0;var t={hasSubscribers:!1};e.metrics=t,e.tracing=t}),n=e(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.defaultPerf=void 0,e.defaultPerf="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date});Object.defineProperty(ze,"__esModule",{value:!0}),ze.LRUCache=void 0;var r=t(),i=n(),o=()=>r.metrics.hasSubscribers||r.tracing.hasSubscribers,s=new Set,a="object"==typeof process&&process?process:{},c=e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),l=e=>c(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?u:null:null,u=class extends Array{constructor(e){super(e),this.fill(0)}},f=class e{heap;length;static#e=!1;static create(t){let n=l(t);if(!n)return[];e.#e=!0;let r=new e(t,n);return e.#e=!1,r}constructor(t,n){if(!e.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new n(t),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},d=class e{#e;#t;#n;#r;#i;#o;#s;#a;get perf(){return this.#a}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;backgroundFetchSize;#c;#l;#u;#f;#d;#p;#h;#m;#g;#v;#y;#E;#b;#w;#L;#I;#S;#C;#_;static unsafeExposeInternals(e){return{starts:e.#b,ttls:e.#w,autopurgeTimers:e.#L,sizes:e.#E,keyMap:e.#u,keyList:e.#f,valList:e.#d,next:e.#p,prev:e.#h,get head(){return e.#m},get tail(){return e.#g},free:e.#v,isBackgroundFetch:t=>e.#D(t),backgroundFetch:(t,n,r,i)=>e.#P(t,n,r,i),moveToTail:t=>e.#N(t),indexes:t=>e.#O(t),rindexes:t=>e.#A(t),isStale:t=>e.#$(t)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#l}get size(){return this.#c}get fetchMethod(){return this.#o}get memoMethod(){return this.#s}get dispose(){return this.#n}get onInsert(){return this.#r}get disposeAfter(){return this.#i}constructor(t){let{max:n=0,ttl:r,ttlResolution:o=1,ttlAutopurge:u,updateAgeOnGet:d,updateAgeOnHas:p,allowStale:h,dispose:m,onInsert:g,disposeAfter:v,noDisposeOnSet:y,noUpdateTTL:E,maxSize:b=0,maxEntrySize:w=0,sizeCalculation:L,fetchMethod:I,memoMethod:S,noDeleteOnFetchRejection:C,noDeleteOnStaleGet:_,allowStaleOnFetchRejection:D,allowStaleOnFetchAbort:P,ignoreFetchAbort:N,backgroundFetchSize:O=1,perf:A}=t;if(this.backgroundFetchSize=O,void 0!==A&&"function"!=typeof A?.now)throw new TypeError("perf option must have a now() method if specified");if(this.#a=A??i.defaultPerf,0!==n&&!c(n))throw new TypeError("max option must be a nonnegative integer");let $=n?l(n):Array;if(!$)throw new Error("invalid max value: "+n);if(this.#e=n,this.#t=b,this.maxEntrySize=w||this.#t,this.sizeCalculation=L,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculation set to non-function")}if(void 0!==S&&"function"!=typeof S)throw new TypeError("memoMethod must be a function if defined");if(this.#s=S,void 0!==I&&"function"!=typeof I)throw new TypeError("fetchMethod must be a function if specified");if(this.#o=I,this.#S=!!I,this.#u=new Map,this.#f=Array.from({length:n}).fill(void 0),this.#d=Array.from({length:n}).fill(void 0),this.#p=new $(n),this.#h=new $(n),this.#m=0,this.#g=0,this.#v=f.create(n),this.#c=0,this.#l=0,"function"==typeof m&&(this.#n=m),"function"==typeof g&&(this.#r=g),"function"==typeof v?(this.#i=v,this.#y=[]):(this.#i=void 0,this.#y=void 0),this.#I=!!this.#n,this.#_=!!this.#r,this.#C=!!this.#i,this.noDisposeOnSet=!!y,this.noUpdateTTL=!!E,this.noDeleteOnFetchRejection=!!C,this.allowStaleOnFetchRejection=!!D,this.allowStaleOnFetchAbort=!!P,this.ignoreFetchAbort=!!N,0!==this.maxEntrySize){if(0!==this.#t&&!c(this.#t))throw new TypeError("maxSize must be a positive integer if specified");if(!c(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#R()}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!_,this.updateAgeOnGet=!!d,this.updateAgeOnHas=!!p,this.ttlResolution=c(o)||0===o?o:1,this.ttlAutopurge=!!u,this.ttl=r||0,this.ttl){if(!c(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#x()}if(0===this.#e&&0===this.ttl&&0===this.#t)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){let t="LRU_CACHE_UNBOUNDED";(e=>!s.has(e))(t)&&(s.add(t),((e,t,n,r)=>{"function"==typeof a.emitWarning?a.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)})("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",t,e))}}getRemainingTTL(e){return this.#u.has(e)?1/0:0}#x(){let e=new u(this.#e),t=new u(this.#e);this.#w=e,this.#b=t;let n=this.ttlAutopurge?Array.from({length:this.#e}):void 0;this.#L=n,this.#T=(n,i,o=this.#a.now())=>{t[n]=0!==i?o:0,e[n]=i,r(n,i)},this.#k=n=>{t[n]=0!==e[n]?this.#a.now():0,r(n,e[n])};let r=this.ttlAutopurge?(e,t)=>{if(n?.[e]&&(clearTimeout(n[e]),n[e]=void 0),t&&0!==t&&n){let i=setTimeout(()=>{this.#$(e)?(this.#F(this.#f[e],"expire"),n[e]=void 0):r(e,s(e))},t+1);i.unref&&i.unref(),n[e]=i}}:()=>{};this.#U=(n,r)=>{if(e[r]){let s=e[r],a=t[r];if(!s||!a)return;n.ttl=s,n.start=a,n.now=i||o();let c=n.now-a;n.remainingTTL=s-c}};let i=0,o=()=>{let e=this.#a.now();if(this.ttlResolution>0){i=e;let t=setTimeout(()=>i=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=e=>{let t=this.#u.get(e);return void 0===t?0:s(t)};let s=n=>{let r=e[n],s=t[n];return r&&s?r-((i||o())-s):1/0};this.#$=n=>{let r=t[n],s=e[n];return!!s&&!!r&&(i||o())-r>s}}#k=()=>{};#U=()=>{};#T=()=>{};#$=()=>!1;#R(){let e=new u(this.#e);this.#l=0,this.#E=e,this.#B=t=>{this.#l-=e[t],e[t]=0},this.#M=(e,t,n,r)=>{if(!c(n)){if(this.#D(t))return this.backgroundFetchSize;if(!r)throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");if("function"!=typeof r)throw new TypeError("sizeCalculation must be a function");if(n=r(t,e),!c(n))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return n},this.#G=(t,n,r)=>{if(e[t]=n,this.#t){let n=this.#t-e[t];for(;this.#l>n;)this.#j(!0)}this.#l+=e[t],r&&(r.entrySize=n,r.totalCalculatedSize=this.#l)}}#B=e=>{};#G=(e,t,n)=>{};#M=(e,t,n,r)=>{if(n||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#O({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#g;this.#H(t)&&((e||!this.#$(t))&&(yield t),t!==this.#m);)t=this.#h[t]}*#A({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#m;this.#H(t)&&((e||!this.#$(t))&&(yield t),t!==this.#g);)t=this.#p[t]}#H(e){return void 0!==e&&this.#u.get(this.#f[e])===e}*entries(){for(let e of this.#O())void 0!==this.#d[e]&&void 0!==this.#f[e]&&!this.#D(this.#d[e])&&(yield[this.#f[e],this.#d[e]])}*rentries(){for(let e of this.#A())void 0!==this.#d[e]&&void 0!==this.#f[e]&&!this.#D(this.#d[e])&&(yield[this.#f[e],this.#d[e]])}*keys(){for(let e of this.#O()){let t=this.#f[e];void 0!==t&&!this.#D(this.#d[e])&&(yield t)}}*rkeys(){for(let e of this.#A()){let t=this.#f[e];void 0!==t&&!this.#D(this.#d[e])&&(yield t)}}*values(){for(let e of this.#O())void 0!==this.#d[e]&&!this.#D(this.#d[e])&&(yield this.#d[e])}*rvalues(){for(let e of this.#A())void 0!==this.#d[e]&&!this.#D(this.#d[e])&&(yield this.#d[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let n of this.#O()){let r=this.#d[n],i=this.#D(r)?r.__staleWhileFetching:r;if(void 0!==i&&e(i,this.#f[n],this))return this.#z(this.#f[n],t)}}forEach(e,t=this){for(let n of this.#O()){let r=this.#d[n],i=this.#D(r)?r.__staleWhileFetching:r;void 0!==i&&e.call(t,i,this.#f[n],this)}}rforEach(e,t=this){for(let n of this.#A()){let r=this.#d[n],i=this.#D(r)?r.__staleWhileFetching:r;void 0!==i&&e.call(t,i,this.#f[n],this)}}purgeStale(){let e=!1;for(let t of this.#A({allowStale:!0}))this.#$(t)&&(this.#F(this.#f[t],"expire"),e=!0);return e}info(e){let t=this.#u.get(e);if(void 0===t)return;let n=this.#d[t],r=this.#D(n)?n.__staleWhileFetching:n;if(void 0===r)return;let i={value:r};if(this.#w&&this.#b){let e=this.#w[t],n=this.#b[t];if(e&&n){let t=e-(this.#a.now()-n);i.ttl=t,i.start=Date.now()}}return this.#E&&(i.size=this.#E[t]),i}dump(){let e=[];for(let t of this.#O({allowStale:!0})){let n=this.#f[t],r=this.#d[t],i=this.#D(r)?r.__staleWhileFetching:r;if(void 0===i||void 0===n)continue;let o={value:i};if(this.#w&&this.#b){o.ttl=this.#w[t];let e=this.#a.now()-this.#b[t];o.start=Math.floor(Date.now()-e)}this.#E&&(o.size=this.#E[t]),e.unshift([n,o])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let e=Date.now()-n.start;n.start=this.#a.now()-e}this.#q(t,n.value,n)}}set(e,t,n={}){let{status:i=(r.metrics.hasSubscribers?{}:void 0)}=n;n.status=i,i&&(i.op="set",i.key=e,void 0!==t&&(i.value=t),i.cache=this);let o=this.#q(e,t,n);return i&&r.metrics.hasSubscribers&&r.metrics.publish(i),o}#q(e,t,n,r){let{ttl:i=this.ttl,start:o,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:c}=n,l=this.#D(t);if(void 0===t)return c&&(c.set="deleted"),this.delete(e),this;let{noUpdateTTL:u=this.noUpdateTTL}=n;c&&!l&&(c.value=t);let f=this.#M(e,t,n.size||0,a,c);if(this.maxEntrySize&&f>this.maxEntrySize)return this.#F(e,"set"),c&&(c.set="miss",c.maxEntrySizeExceeded=!0),this;let d=0===this.#c?void 0:this.#u.get(e);if(void 0===d)d=0===this.#c?this.#g:0!==this.#v.length?this.#v.pop():this.#c===this.#e?this.#j(!1):this.#c,this.#f[d]=e,this.#d[d]=t,this.#u.set(e,d),this.#p[this.#g]=d,this.#h[d]=this.#g,this.#g=d,this.#c++,this.#G(d,f,c),c&&(c.set="add"),u=!1,this.#_&&!l&&this.#r?.(t,e,"add");else{this.#N(d);let n=this.#d[d];if(t!==n){if(!s)if(this.#D(n)){n!==r&&n.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:i}=n;void 0!==i&&i!==t&&(this.#I&&this.#n?.(i,e,"set"),this.#C&&this.#y?.push([i,e,"set"]))}else this.#I&&this.#n?.(n,e,"set"),this.#C&&this.#y?.push([n,e,"set"]);if(this.#B(d),this.#G(d,f,c),this.#d[d]=t,!l){let r=n&&this.#D(n)?n.__staleWhileFetching:n,i=void 0===r?"add":t!==r?"replace":"update";c&&(c.set=i,void 0!==r&&(c.oldValue=r)),this.#_&&this.onInsert?.(t,e,i)}}else l||(c&&(c.set="update"),this.#_&&this.onInsert?.(t,e,"update"))}if(0!==i&&!this.#w&&this.#x(),this.#w&&(u||this.#T(d,i,o),c&&this.#U(c,d)),!s&&this.#C&&this.#y){let e,t=this.#y;for(;e=t?.shift();)this.#i?.(...e)}return this}pop(){try{for(;this.#c;){let e=this.#d[this.#m];if(this.#j(!0),this.#D(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(void 0!==e)return e}}finally{if(this.#C&&this.#y){let e,t=this.#y;for(;e=t?.shift();)this.#i?.(...e)}}}#j(e){let t=this.#m,n=this.#f[t],r=this.#d[t],i=this.#D(r);i&&r.__abortController.abort(new Error("evicted"));let o=i?r.__staleWhileFetching:r;return(this.#I||this.#C)&&void 0!==o&&(this.#I&&this.#n?.(o,n,"evict"),this.#C&&this.#y?.push([o,n,"evict"])),this.#B(t),this.#L?.[t]&&(clearTimeout(this.#L[t]),this.#L[t]=void 0),e&&(this.#f[t]=void 0,this.#d[t]=void 0,this.#v.push(t)),1===this.#c?(this.#m=this.#g=0,this.#v.length=0):this.#m=this.#p[t],this.#u.delete(n),this.#c--,t}has(e,t={}){let{status:n=(r.metrics.hasSubscribers?{}:void 0)}=t;t.status=n,n&&(n.op="has",n.key=e,n.cache=this);let i=this.#V(e,t);return r.metrics.hasSubscribers&&r.metrics.publish(n),i}#V(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:r}=t,i=this.#u.get(e);if(void 0!==i){let e=this.#d[i];if(this.#D(e)&&void 0===e.__staleWhileFetching)return!1;if(!this.#$(i))return n&&this.#k(i),r&&(r.has="hit",this.#U(r,i)),!0;r&&(r.has="stale",this.#U(r,i))}else r&&(r.has="miss");return!1}peek(e,t={}){let{status:n=(o()?{}:void 0)}=t;n&&(n.op="peek",n.key=e,n.cache=this),t.status=n;let i=this.#W(e,t);return r.metrics.hasSubscribers&&r.metrics.publish(n),i}#W(e,t){let{status:n,allowStale:r=this.allowStale}=t,i=this.#u.get(e);if(void 0===i||!r&&this.#$(i))return void(n&&(n.peek=void 0===i?"miss":"stale"));let o=this.#d[i],s=this.#D(o)?o.__staleWhileFetching:o;return n&&(void 0!==s?(n.peek="hit",n.value=s):n.peek="miss"),s}#P(e,t,n,r){let i=void 0===t?void 0:this.#d[t];if(this.#D(i))return i;let o=new AbortController,{signal:s}=n;s?.addEventListener("abort",()=>o.abort(s.reason),{signal:o.signal});let a={signal:o.signal,options:n,context:r},c=(r,i=!1)=>{let{aborted:s}=o.signal,c=n.ignoreFetchAbort&&void 0!==r,f=n.ignoreFetchAbort||!(!n.allowStaleOnFetchAbort||void 0===r);if(n.status&&(s&&!i?(n.status.fetchAborted=!0,n.status.fetchError=o.signal.reason,c&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),s&&!c&&!i)return l(o.signal.reason,f);let d=u,p=this.#d[t];return(p===u||void 0===p&&c&&i)&&(void 0===r?void 0!==d.__staleWhileFetching?this.#d[t]=d.__staleWhileFetching:this.#F(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.#q(e,r,a.options,d))),r},l=(r,i)=>{let{aborted:s}=o.signal,a=s&&n.allowStaleOnFetchAbort,c=a||n.allowStaleOnFetchRejection,l=c||n.noDeleteOnFetchRejection,f=u;if(this.#d[t]===u&&(!l||!i&&void 0===f.__staleWhileFetching?this.#F(e,"fetch"):a||(this.#d[t]=f.__staleWhileFetching)),c)return n.status&&void 0!==f.__staleWhileFetching&&(n.status.returnedStale=!0),f.__staleWhileFetching;if(f.__returned===f)throw r};n.status&&(n.status.fetchDispatched=!0);let u=new Promise((t,r)=>{let s=this.#o?.(e,i,a);o.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(t(void 0),n.allowStaleOnFetchAbort&&(t=e=>c(e,!0)))}),s&&s instanceof Promise?s.then(e=>t(void 0===e?void 0:e),r):void 0!==s&&t(s)}).then(c,e=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=e),l(e,!1))),f=Object.assign(u,{__abortController:o,__staleWhileFetching:i,__returned:void 0});return void 0===t?(this.#q(e,f,{...a.options,status:void 0}),t=this.#u.get(e)):this.#d[t]=f,f}#D(e){if(!this.#S)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof AbortController}fetch(e,t={}){let n=r.tracing.hasSubscribers,{status:i=(o()?{}:void 0)}=t;t.status=i,i&&t.context&&(i.context=t.context);let s=this.#Z(e,t);return i&&n&&(i.trace=!0,r.tracing.tracePromise(()=>s,i).catch(()=>{})),s}async#Z(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:a=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:h,forceRefresh:m=!1,status:g,signal:v}=t;if(g&&(g.op="fetch",g.key=e,m&&(g.forceRefresh=!0),g.cache=this),!this.#S)return g&&(g.fetch="get"),this.#z(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,status:g});let y={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,ttl:o,noDisposeOnSet:s,size:a,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:p,ignoreFetchAbort:d,status:g,signal:v},E=this.#u.get(e);if(void 0===E){g&&(g.fetch="miss");let t=this.#P(e,E,y,h);return t.__returned=t}{let t=this.#d[E];if(this.#D(t)){let e=n&&void 0!==t.__staleWhileFetching;return g&&(g.fetch="inflight",e&&(g.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let i=this.#$(E);if(!m&&!i)return g&&(g.fetch="hit"),this.#N(E),r&&this.#k(E),g&&this.#U(g,E),t;let o=this.#P(e,E,y,h),s=void 0!==o.__staleWhileFetching&&n;return g&&(g.fetch=i?"stale":"refresh",s&&i&&(g.returnedStale=!0)),s?o.__staleWhileFetching:o.__returned=o}}forceFetch(e,t={}){let n=r.tracing.hasSubscribers,{status:i=(o()?{}:void 0)}=t;t.status=i,i&&t.context&&(i.context=t.context);let s=this.#K(e,t);return i&&n&&(i.trace=!0,r.tracing.tracePromise(()=>s,i).catch(()=>{})),s}async#K(e,t={}){let n=await this.#Z(e,t);if(void 0===n)throw new Error("fetch() returned undefined");return n}memo(e,t={}){let{status:n=(r.metrics.hasSubscribers?{}:void 0)}=t;t.status=n,n&&(n.op="memo",n.key=e,t.context&&(n.context=t.context),n.cache=this);let i=this.#Y(e,t);return n&&(n.value=i),r.metrics.hasSubscribers&&r.metrics.publish(n),i}#Y(e,t={}){let n=this.#s;if(!n)throw new Error("no memoMethod provided to constructor");let{context:r,status:i,forceRefresh:o,...s}=t;i&&o&&(i.forceRefresh=!0);let a=this.#z(e,s),c=o||void 0===a;if(i&&(i.memo=c?"miss":"hit",c||(i.value=a)),!c)return a;let l=n(e,a,{options:s,context:r});return i&&(i.value=l),this.#q(e,l,s),l}get(e,t={}){let{status:n=(r.metrics.hasSubscribers?{}:void 0)}=t;t.status=n,n&&(n.op="get",n.key=e,n.cache=this);let i=this.#z(e,t);return n&&(void 0!==i&&(n.value=i),r.metrics.hasSubscribers&&r.metrics.publish(n)),i}#z(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:o}=t,s=this.#u.get(e);if(void 0===s)return void(o&&(o.get="miss"));let a=this.#d[s],c=this.#D(a);return o&&this.#U(o,s),this.#$(s)?c?(o&&(o.get="stale-fetching"),n&&void 0!==a.__staleWhileFetching?(o&&(o.returnedStale=!0),a.__staleWhileFetching):void 0):(i||this.#F(e,"expire"),o&&(o.get="stale"),n?(o&&(o.returnedStale=!0),a):void 0):(o&&(o.get=c?"fetching":"hit"),this.#N(s),r&&this.#k(s),c?a.__staleWhileFetching:a)}#X(e,t){this.#h[t]=e,this.#p[e]=t}#N(e){e!==this.#g&&(e===this.#m?this.#m=this.#p[e]:this.#X(this.#h[e],this.#p[e]),this.#X(this.#g,e),this.#g=e)}delete(e){return this.#F(e,"delete")}#F(e,t){r.metrics.hasSubscribers&&r.metrics.publish({op:"delete",delete:t,key:e,cache:this});let n=!1;if(0!==this.#c){let r=this.#u.get(e);if(void 0!==r)if(this.#L?.[r]&&(clearTimeout(this.#L[r]),this.#L[r]=void 0),n=!0,1===this.#c)this.#J(t);else{this.#B(r);let n=this.#d[r];if(this.#D(n)?n.__abortController.abort(new Error("deleted")):(this.#I||this.#C)&&(this.#I&&this.#n?.(n,e,t),this.#C&&this.#y?.push([n,e,t])),this.#u.delete(e),this.#f[r]=void 0,this.#d[r]=void 0,r===this.#g)this.#g=this.#h[r];else if(r===this.#m)this.#m=this.#p[r];else{let e=this.#h[r];this.#p[e]=this.#p[r];let t=this.#p[r];this.#h[t]=this.#h[r]}this.#c--,this.#v.push(r)}}if(this.#C&&this.#y?.length){let e,t=this.#y;for(;e=t?.shift();)this.#i?.(...e)}return n}clear(){return this.#J("delete")}#J(e){for(let t of this.#A({allowStale:!0})){let n=this.#d[t];if(this.#D(n))n.__abortController.abort(new Error("deleted"));else{let r=this.#f[t];this.#I&&this.#n?.(n,r,e),this.#C&&this.#y?.push([n,r,e])}}if(this.#u.clear(),this.#d.fill(void 0),this.#f.fill(void 0),this.#w&&this.#b){this.#w.fill(0),this.#b.fill(0);for(let e of this.#L??[])void 0!==e&&clearTimeout(e);this.#L?.fill(void 0)}if(this.#E&&this.#E.fill(0),this.#m=0,this.#g=0,this.#v.length=0,this.#l=0,this.#c=0,this.#C&&this.#y){let e,t=this.#y;for(;e=t?.shift();)this.#i?.(...e)}}};return ze.LRUCache=d,ze}function Ve(){if(Fe)return ke;Fe=1;const e=(e,t,n)=>{const r=e.indexOf(n);return e.lastIndexOf(t,r>-1?r:1/0)},t=e=>{try{return new URL(e)}catch{}};return ke=(n,r)=>{const i=r?((e,t)=>{const n=e.indexOf(":"),r=e.slice(0,n+1);if(Object.prototype.hasOwnProperty.call(t,r))return e;if("://"===e.substr(n,3))return e;const i=e.indexOf("@");return i>-1?i>n?`git+ssh://${e}`:e:`${e.slice(0,n+1)}//${e.slice(n+1)}`})(n,r):n;return t(i)||t((t=>{const n=e(t,"@","#"),r=e(t,":","#");return r>n&&(t=t.slice(0,r)+"/"+t.slice(r+1)),-1===e(t,":","#")&&-1===t.indexOf("//")&&(t=`git+ssh://${t}`),t})(i))}}function We(){if(Be)return Ue;Be=1;const e=Ve();return Ue=(t,n,{gitHosts:r,protocols:i})=>{if(!t)return;const o=(e=>{const t=e.indexOf("#"),n=e.indexOf("/"),r=e.indexOf("/",n+1),i=e.indexOf(":"),o=/\s/.exec(e),s=e.indexOf("@"),a=!o||t>-1&&o.index>t,c=-1===s||t>-1&&s>t,l=-1===i||t>-1&&i>t,u=-1===r||t>-1&&r>t,f=n>0,d=t>-1?"/"!==e[t-1]:!e.endsWith("/"),p=!e.startsWith(".");return a&&f&&d&&p&&c&&l&&u})(t)?`github:${t}`:t,s=e(o,i);if(!s)return;const a=r.byShortcut[s.protocol],c=r.byDomain[s.hostname.startsWith("www.")?s.hostname.slice(4):s.hostname],l=a||c;if(!l)return;const u=r[a||c];let f=null;i[s.protocol]?.auth&&(s.username||s.password)&&(f=`${s.username}${s.password?":"+s.password:""}`);let d=null,p=null,h=null,m=null;try{if(a){let e=s.pathname.startsWith("/")?s.pathname.slice(1):s.pathname;const t=e.indexOf("@");t>-1&&(e=e.slice(t+1));const n=e.lastIndexOf("/");n>-1?(p=decodeURIComponent(e.slice(0,n)),p||(p=null),h=decodeURIComponent(e.slice(n+1))):h=decodeURIComponent(e),h.endsWith(".git")&&(h=h.slice(0,-4)),s.hash&&(d=decodeURIComponent(s.hash.slice(1))),m="shortcut"}else{if(!u.protocols.includes(s.protocol))return;const e=u.extract(s);if(!e)return;p=e.user&&decodeURIComponent(e.user),h=decodeURIComponent(e.project),d=decodeURIComponent(e.committish),m=i[s.protocol]?.name||s.protocol.slice(0,-1)}}catch(e){if(e instanceof URIError)return;throw e}return[l,p,f,h,d,m,n]}}function Ze(){if(Ge)return Me;Ge=1;const{LRUCache:e}=qe(),t=function(){if(Te)return xe;Te=1;const e=(...e)=>e.every(e=>e)?e.join(""):"",t=e=>e?encodeURIComponent(e):"",n=e=>e.toLowerCase().replace(/^\W+/g,"").replace(/(?<!\W)\W+$/,"").replace(/\//g,"").replace(/\W+/g,"-"),r={sshtemplate:({domain:t,user:n,project:r,committish:i})=>`git@${t}:${n}/${r}.git${e("#",i)}`,sshurltemplate:({domain:t,user:n,project:r,committish:i})=>`git+ssh://git@${t}/${n}/${r}.git${e("#",i)}`,edittemplate:({domain:n,user:r,project:i,committish:o,editpath:s,path:a})=>`https://${n}/${r}/${i}${e("/",s,"/",t(o||"HEAD"),"/",a)}`,browsetemplate:({domain:n,user:r,project:i,committish:o,treepath:s})=>`https://${n}/${r}/${i}${e("/",s,"/",t(o))}`,browsetreetemplate:({domain:n,user:r,project:i,committish:o,treepath:s,path:a,fragment:c,hashformat:l})=>`https://${n}/${r}/${i}/${s}/${t(o||"HEAD")}/${a}${e("#",l(c||""))}`,browseblobtemplate:({domain:n,user:r,project:i,committish:o,blobpath:s,path:a,fragment:c,hashformat:l})=>`https://${n}/${r}/${i}/${s}/${t(o||"HEAD")}/${a}${e("#",l(c||""))}`,docstemplate:({domain:n,user:r,project:i,treepath:o,committish:s})=>`https://${n}/${r}/${i}${e("/",o,"/",t(s))}#readme`,httpstemplate:({auth:t,domain:n,user:r,project:i,committish:o})=>`git+https://${e(t,"@")}${n}/${r}/${i}.git${e("#",o)}`,filetemplate:({domain:e,user:n,project:r,committish:i,path:o})=>`https://${e}/${n}/${r}/raw/${t(i||"HEAD")}/${o}`,shortcuttemplate:({type:t,user:n,project:r,committish:i})=>`${t}:${n}/${r}${e("#",i)}`,pathtemplate:({user:t,project:n,committish:r})=>`${t}/${n}${e("#",r)}`,bugstemplate:({domain:e,user:t,project:n})=>`https://${e}/${t}/${n}/issues`,hashformat:n},i={};i.github={protocols:["git:","http:","git+ssh:","git+https:","ssh:","https:"],domain:"github.com",treepath:"tree",blobpath:"blob",editpath:"edit",filetemplate:({auth:n,user:r,project:i,committish:o,path:s})=>`https://${e(n,"@")}raw.githubusercontent.com/${r}/${i}/${t(o||"HEAD")}/${s}`,gittemplate:({auth:t,domain:n,user:r,project:i,committish:o})=>`git://${e(t,"@")}${n}/${r}/${i}.git${e("#",o)}`,tarballtemplate:({domain:e,user:n,project:r,committish:i})=>`https://codeload.${e}/${n}/${r}/tar.gz/${t(i||"HEAD")}`,extract:e=>{let[,t,n,r,i]=e.pathname.split("/",5);if((!r||"tree"===r)&&(r||(i=e.hash.slice(1)),n&&n.endsWith(".git")&&(n=n.slice(0,-4)),t&&n))return{user:t,project:n,committish:i}}},i.bitbucket={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"bitbucket.org",treepath:"src",blobpath:"src",editpath:"?mode=edit",edittemplate:({domain:n,user:r,project:i,committish:o,treepath:s,path:a,editpath:c})=>`https://${n}/${r}/${i}${e("/",s,"/",t(o||"HEAD"),"/",a,c)}`,tarballtemplate:({domain:e,user:n,project:r,committish:i})=>`https://${e}/${n}/${r}/get/${t(i||"HEAD")}.tar.gz`,extract:e=>{let[,t,n,r]=e.pathname.split("/",4);if(!["get"].includes(r)&&(n&&n.endsWith(".git")&&(n=n.slice(0,-4)),t&&n))return{user:t,project:n,committish:e.hash.slice(1)}}},i.gitlab={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"gitlab.com",treepath:"tree",blobpath:"tree",editpath:"-/edit",tarballtemplate:({domain:e,user:n,project:r,committish:i})=>`https://${e}/api/v4/projects/${t(n+"/"+r)}/repository/archive.tar.gz?sha=${t(i||"HEAD")}`,extract:e=>{const t=e.pathname.slice(1);if(t.includes("/-/")||t.includes("/archive.tar.gz"))return;const n=t.split("/");let r=n.pop();r.endsWith(".git")&&(r=r.slice(0,-4));const i=n.join("/");return i&&r?{user:i,project:r,committish:e.hash.slice(1)}:void 0}},i.gist={protocols:["git:","git+ssh:","git+https:","ssh:","https:"],domain:"gist.github.com",editpath:"edit",sshtemplate:({domain:t,project:n,committish:r})=>`git@${t}:${n}.git${e("#",r)}`,sshurltemplate:({domain:t,project:n,committish:r})=>`git+ssh://git@${t}/${n}.git${e("#",r)}`,edittemplate:({domain:n,user:r,project:i,committish:o,editpath:s})=>`https://${n}/${r}/${i}${e("/",t(o))}/${s}`,browsetemplate:({domain:n,project:r,committish:i})=>`https://${n}/${r}${e("/",t(i))}`,browsetreetemplate:({domain:n,project:r,committish:i,path:o,hashformat:s})=>`https://${n}/${r}${e("/",t(i))}${e("#",s(o))}`,browseblobtemplate:({domain:n,project:r,committish:i,path:o,hashformat:s})=>`https://${n}/${r}${e("/",t(i))}${e("#",s(o))}`,docstemplate:({domain:n,project:r,committish:i})=>`https://${n}/${r}${e("/",t(i))}`,httpstemplate:({domain:t,project:n,committish:r})=>`git+https://${t}/${n}.git${e("#",r)}`,filetemplate:({user:n,project:r,committish:i,path:o})=>`https://gist.githubusercontent.com/${n}/${r}/raw${e("/",t(i))}/${o}`,shortcuttemplate:({type:t,project:n,committish:r})=>`${t}:${n}${e("#",r)}`,pathtemplate:({project:t,committish:n})=>`${t}${e("#",n)}`,bugstemplate:({domain:e,project:t})=>`https://${e}/${t}`,gittemplate:({domain:t,project:n,committish:r})=>`git://${t}/${n}.git${e("#",r)}`,tarballtemplate:({project:e,committish:n})=>`https://codeload.github.com/gist/${e}/tar.gz/${t(n||"HEAD")}`,extract:e=>{let[,t,n,r]=e.pathname.split("/",4);if("raw"!==r){if(!n){if(!t)return;n=t,t=null}return n.endsWith(".git")&&(n=n.slice(0,-4)),{user:t,project:n,committish:e.hash.slice(1)}}},hashformat:function(e){return e&&"file-"+n(e)}},i.sourcehut={protocols:["git+ssh:","https:"],domain:"git.sr.ht",treepath:"tree",blobpath:"tree",filetemplate:({domain:e,user:n,project:r,committish:i,path:o})=>`https://${e}/${n}/${r}/blob/${t(i)||"HEAD"}/${o}`,httpstemplate:({domain:t,user:n,project:r,committish:i})=>`https://${t}/${n}/${r}${e("#",i)}`,tarballtemplate:({domain:e,user:n,project:r,committish:i})=>`https://${e}/${n}/${r}/archive/${t(i)||"HEAD"}.tar.gz`,bugstemplate:()=>null,extract:e=>{let[,t,n,r]=e.pathname.split("/",4);if(!["archive"].includes(r)&&(n&&n.endsWith(".git")&&(n=n.slice(0,-4)),t&&n))return{user:t,project:n,committish:e.hash.slice(1)}}};for(const[e,t]of Object.entries(i))i[e]=Object.assign({},r,t);return xe=i}(),n=We(),r=Ve(),i=new e({max:1e3});class o{constructor(e,t,n,r,i,s,a={}){Object.assign(this,o.#Q[e],{type:e,user:t,auth:n,project:r,committish:i,default:s,opts:a})}static#Q={byShortcut:{},byDomain:{}};static#ee={"git+ssh:":{name:"sshurl"},"ssh:":{name:"sshurl"},"git+https:":{name:"https",auth:!0},"git:":{auth:!0},"http:":{auth:!0},"https:":{auth:!0},"git+http:":{auth:!0}};static addHost(e,t){o.#Q[e]=t,o.#Q.byDomain[t.domain]=e,o.#Q.byShortcut[`${e}:`]=e,o.#ee[`${e}:`]={name:e}}static fromUrl(e,t){if("string"!=typeof e)return;const r=e+JSON.stringify(t||{});if(!i.has(r)){const s=n(e,t,{gitHosts:o.#Q,protocols:o.#ee});i.set(r,s?new o(...s):void 0)}return i.get(r)}static fromManifest(e,t={}){if(!e||"object"!=typeof e)return;const n=e.repository,r=n&&("string"==typeof n?n:"object"==typeof n&&"string"==typeof n.url?n.url:null);if(!r)throw new Error("no repository");const i=r&&o.fromUrl(r.replace(/^git\+/,""),t)||null;if(i)return i;const s=function(e){try{const{protocol:t,hostname:n,pathname:r}=new URL(e);if(!n)return null;return`${/(?:git\+)http:$/.test(t)?"http:":"https:"}//${n}${r.replace(/\.git$/,"")}`}catch{return null}}(r);return o.fromUrl(s,t)||s}static parseUrl(e){return r(e)}#te(e,t){if("function"!=typeof e)return null;const n={...this,...this.opts,...t};n.path||(n.path=""),n.path.startsWith("/")&&(n.path=n.path.slice(1)),n.noCommittish&&(n.committish=null);const r=e(n);return n.noGitPlus&&r.startsWith("git+")?r.slice(4):r}hash(){return this.committish?`#${this.committish}`:""}ssh(e){return this.#te(this.sshtemplate,e)}sshurl(e){return this.#te(this.sshurltemplate,e)}browse(e,...t){return"string"!=typeof e?this.#te(this.browsetemplate,e):"string"!=typeof t[0]?this.#te(this.browsetreetemplate,{...t[0],path:e}):this.#te(this.browsetreetemplate,{...t[1],fragment:t[0],path:e})}browseFile(e,...t){return"string"!=typeof t[0]?this.#te(this.browseblobtemplate,{...t[0],path:e}):this.#te(this.browseblobtemplate,{...t[1],fragment:t[0],path:e})}docs(e){return this.#te(this.docstemplate,e)}bugs(e){return this.#te(this.bugstemplate,e)}https(e){return this.#te(this.httpstemplate,e)}git(e){return this.#te(this.gittemplate,e)}shortcut(e){return this.#te(this.shortcuttemplate,e)}path(e){return this.#te(this.pathtemplate,e)}tarball(e){return this.#te(this.tarballtemplate,{...e,noCommittish:!1})}file(e,t){return this.#te(this.filetemplate,{...t,path:e})}edit(e,t){return this.#te(this.edittemplate,{...t,path:e})}getDefaultRepresentation(){return this.default}toString(e){return this.default&&"function"==typeof this[this.default]?this[this.default](e):this.sshurl(e)}}for(const[e,n]of Object.entries(t))o.addHost(e,n);return Me=o}var Ke,Ye,Xe={topLevel:{dependancies:"dependencies",dependecies:"dependencies",depdenencies:"dependencies",devEependencies:"devDependencies",depends:"dependencies","dev-dependencies":"devDependencies",devDependences:"devDependencies",devDepenencies:"devDependencies",devdependencies:"devDependencies",repostitory:"repository",repo:"repository",prefereGlobal:"preferGlobal",hompage:"homepage",hampage:"homepage",autohr:"author",autor:"author",contributers:"contributors",publicationConfig:"publishConfig",script:"scripts"},bugs:{web:"url",name:"url"},script:{server:"start",tests:"test"}};function Je(){if(Ye)return Ke;Ye=1;var{URL:e}=d,t=function(){if(le)return ce;le=1;const e=me();return ce=(t,n)=>{const r=e(t,n);return r?r.version:null},ce}(),n=function(){if(fe)return ue;fe=1;const e=me();return ue=(t,n)=>{const r=e(t.trim().replace(/^[=v]+/,""),n);return r?r.version:null},ue}(),r=$e(),i=Ze(),{isBuiltin:o}=h,s=["dependencies","devDependencies","optionalDependencies"],a=He?je:(He=1,je=function(e){if(!e)return;if("ERROR: No README data found!"===e)return;e=e.trim().split("\n");let t=0;for(;e[t]&&e[t].trim().match(/^(#|$)/);)t++;const n=e.length;let r=t+1;for(;r<n&&e[r].trim();)r++;return e.slice(t,r).join(" ").trim()}),c=Xe,l=e=>e.includes("@")&&e.indexOf("@")<e.lastIndexOf(".");function u(e,t){return e.author&&(e.author=t(e.author)),["maintainers","contributors"].forEach(function(n){Array.isArray(e[n])&&(e[n]=e[n].map(t))}),e}function f(e){if("string"==typeof e)return e;var t=e.name||"",n=e.url||e.web,r=n?" ("+n+")":"",i=e.email||e.mail;return t+(i?" <"+i+">":"")+r}function p(e){if("string"!=typeof e)return e;var t=e.match(/^([^(<]+)/),n=e.match(/\(([^()]+)\)/),r=e.match(/<([^<>]+)>/),i={};return t&&t[0].trim()&&(i.name=t[0].trim()),r&&(i.email=r[1]),n&&(i.url=n[1]),i}return Ke={warn:function(){},fixRepositoryField:function(e){if(e.repositories&&(this.warn("repositories"),e.repository=e.repositories[0]),!e.repository)return this.warn("missingRepository");"string"==typeof e.repository&&(e.repository={type:"git",url:e.repository});var t=e.repository.url||"";if(t){var n=i.fromUrl(t);n&&(t=e.repository.url="shortcut"===n.getDefaultRepresentation()?n.https():n.toString())}t.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",t)},fixTypos:function(e){Object.keys(c.topLevel).forEach(function(t){Object.prototype.hasOwnProperty.call(e,t)&&this.warn("typo",t,c.topLevel[t])},this)},fixScriptsField:function(e){if(e.scripts)return"object"!=typeof e.scripts?(this.warn("nonObjectScripts"),void delete e.scripts):void Object.keys(e.scripts).forEach(function(t){"string"!=typeof e.scripts[t]?(this.warn("nonStringScript"),delete e.scripts[t]):c.script[t]&&!e.scripts[c.script[t]]&&this.warn("typo",t,c.script[t],"scripts")},this)},fixFilesField:function(e){var t=e.files;t&&!Array.isArray(t)?(this.warn("nonArrayFiles"),delete e.files):e.files&&(e.files=e.files.filter(function(e){return!(!e||"string"!=typeof e)||(this.warn("invalidFilename",e),!1)},this))},fixBinField:function(e){if(e.bin&&"string"==typeof e.bin){var t,n={};(t=e.name.match(/^@[^/]+[/](.*)$/))?n[t[1]]=e.bin:n[e.name]=e.bin,e.bin=n}},fixManField:function(e){e.man&&"string"==typeof e.man&&(e.man=[e.man])},fixBundleDependenciesField:function(e){var t="bundledDependencies",n="bundleDependencies";e[t]&&!e[n]&&(e[n]=e[t],delete e[t]),e[n]&&!Array.isArray(e[n])?(this.warn("nonArrayBundleDependencies"),delete e[n]):e[n]&&(e[n]=e[n].filter(function(t){return t&&"string"==typeof t?(e.dependencies||(e.dependencies={}),Object.prototype.hasOwnProperty.call(e.dependencies,t)||(this.warn("nonDependencyBundleDependency",t),e.dependencies[t]="*"),!0):(this.warn("nonStringBundleDependency",t),!1)},this))},fixDependencies:function(e){!function(e,t){s.forEach(function(n){e[n]&&(e[n]=function(e,t,n){if(!e)return{};"string"==typeof e&&(e=e.trim().split(/[\n\r\s\t ,]+/));if(!Array.isArray(e))return e;n("deprecatedArrayDependencies",t);var r={};return e.filter(function(e){return"string"==typeof e}).forEach(function(e){var t=(e=e.trim().split(/(:?[@\s><=])/)).shift(),n=e.join("");n=(n=n.trim()).replace(/^@/,""),r[t]=n}),r}(e[n],n,t))})}(e,this.warn),function(e){var t=e.optionalDependencies;if(!t)return;var n=e.dependencies||{};Object.keys(t).forEach(function(e){n[e]=t[e]}),e.dependencies=n}(e,this.warn),this.fixBundleDependenciesField(e),["dependencies","devDependencies"].forEach(function(t){if(t in e)return e[t]&&"object"==typeof e[t]?void Object.keys(e[t]).forEach(function(n){var r=e[t][n];"string"!=typeof r&&(this.warn("nonStringDependency",n,JSON.stringify(r)),delete e[t][n]);var o=i.fromUrl(e[t][n]);o&&(e[t][n]=o.toString())},this):(this.warn("nonObjectDependencies",t),void delete e[t])},this)},fixModulesField:function(e){e.modules&&(this.warn("deprecatedModules"),delete e.modules)},fixKeywordsField:function(e){"string"==typeof e.keywords&&(e.keywords=e.keywords.split(/,\s+/)),e.keywords&&!Array.isArray(e.keywords)?(delete e.keywords,this.warn("nonArrayKeywords")):e.keywords&&(e.keywords=e.keywords.filter(function(e){return!("string"!=typeof e||!e)||(this.warn("nonStringKeyword"),!1)},this))},fixVersionField:function(e,r){var i=!r;if(!e.version)return e.version="",!0;if(!t(e.version,i))throw new Error('Invalid version: "'+e.version+'"');return e.version=n(e.version,i),!0},fixPeople:function(e){u(e,f),u(e,p)},fixNameField:function(e,t){"boolean"==typeof t?t={strict:t}:void 0===t&&(t={});var n=t.strict;if(e.name||n){if("string"!=typeof e.name)throw new Error("name field must be a string.");n||(e.name=e.name.trim()),function(e,t,n){if("."===e.charAt(0)||!function(e){if("@"!==e.charAt(0))return!1;var t=e.slice(1).split("/");if(2!==t.length)return!1;return t[0]&&t[1]&&t[0]===encodeURIComponent(t[0])&&t[1]===encodeURIComponent(t[1])}(e)&&(r=e,r.match(/[/@\s+%:]/)||r!==encodeURIComponent(r))||t&&!n&&e!==e.toLowerCase()||"node_modules"===e.toLowerCase()||"favicon.ico"===e.toLowerCase())throw new Error("Invalid name: "+JSON.stringify(e));var r}(e.name,n,t.allowLegacyCase),o(e.name)&&this.warn("conflictingName",e.name)}else e.name=""},fixDescriptionField:function(e){e.description&&"string"!=typeof e.description&&(this.warn("nonStringDescription"),delete e.description),e.readme&&!e.description&&(e.description=a(e.readme)),void 0===e.description&&delete e.description,e.description||this.warn("missingDescription")},fixReadmeField:function(e){e.readme||(this.warn("missingReadme"),e.readme="ERROR: No README data found!")},fixBugsField:function(t){if(!t.bugs&&t.repository&&t.repository.url){var n=i.fromUrl(t.repository.url);n&&n.bugs()&&(t.bugs={url:n.bugs()})}else if(t.bugs){if("string"==typeof t.bugs)l(t.bugs)?t.bugs={email:t.bugs}:e.canParse(t.bugs)?t.bugs={url:t.bugs}:this.warn("nonEmailUrlBugsString");else{!function(e,t){if(!e)return;Object.keys(e).forEach(function(n){c.bugs[n]&&(t("typo",n,c.bugs[n],"bugs"),e[c.bugs[n]]=e[n],delete e[n])})}(t.bugs,this.warn);var r=t.bugs;t.bugs={},r.url&&(e.canParse(r.url)?t.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&("string"==typeof r.email&&l(r.email)?t.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}t.bugs.email||t.bugs.url||(delete t.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(t){if(!t.homepage&&t.repository&&t.repository.url){var n=i.fromUrl(t.repository.url);n&&n.docs()&&(t.homepage=n.docs())}if(t.homepage)return"string"!=typeof t.homepage?(this.warn("nonUrlHomepage"),delete t.homepage):void(e.canParse(t.homepage)||(t.homepage="http://"+t.homepage))},fixLicenseField:function(e){const t=e.license||e.licence;return t?"string"!=typeof t||t.length<1||""===t.trim()?this.warn("invalidLicense"):r(t).validForNewPackages?void 0:this.warn("invalidLicense"):this.warn("missingLicense")}},Ke}var Qe,et,tt,nt,rt={repositories:"'repositories' (plural) Not supported. Please pick one as the 'repository' field",missingRepository:"No repository field.",brokenGitUrl:"Probably broken git url: %s",nonObjectScripts:"scripts must be an object",nonStringScript:"script values must be string commands",nonArrayFiles:"Invalid 'files' member",invalidFilename:"Invalid filename in 'files' list: %s",nonArrayBundleDependencies:"Invalid 'bundleDependencies' list. Must be array of package names",nonStringBundleDependency:"Invalid bundleDependencies member: %s",nonDependencyBundleDependency:"Non-dependency in bundleDependencies: %s",nonObjectDependencies:"%s field must be an object",nonStringDependency:"Invalid dependency: %s %s",deprecatedArrayDependencies:"specifying %s as array is deprecated",deprecatedModules:"modules field is deprecated",nonArrayKeywords:"keywords should be an array of strings",nonStringKeyword:"keywords should be an array of strings",conflictingName:"%s is also the name of a node core module.",nonStringDescription:"'description' field should be a string",missingDescription:"No description",missingReadme:"No README data",missingLicense:"No license field.",nonEmailUrlBugsString:"Bug string field must be url, email, or {email,url}",nonUrlBugsUrlField:"bugs.url field must be a string url. Deleted.",nonEmailBugsEmailField:"bugs.email field must be a string email. Deleted.",emptyNormalizedBugs:"Normalized value of bugs field is an empty object. Deleted.",nonUrlHomepage:"homepage field must be a string url. Deleted.",invalidLicense:"license should be a valid SPDX license expression",typo:"%s should probably be %s."};function it(){if(et)return Qe;et=1;var e=m,t=rt;function n(n,r,i){return i&&(n=i+"['"+n+"']",r=i+"['"+r+"']"),e.format(t.typo,n,r)}return Qe=function(){var r=Array.prototype.slice.call(arguments,0),i=r.shift();if("typo"===i)return n.apply(null,r);var o=t[i]?t[i]:i+": '%s'";return r.unshift(o),e.format.apply(null,r)},Qe}var ot=function(){if(nt)return tt;nt=1,tt=r;var e=Je();r.fixer=e;var t=it(),n=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"].map(function(e){return i(e)+"Field"});function r(r,o,s){!0===o&&(o=null,s=!0),s||(s=!1),o&&!r.private||(o=function(){}),r.scripts&&"node-gyp rebuild"===r.scripts.install&&!r.scripts.preinstall&&(r.gypfile=!0),e.warn=function(){o(t.apply(null,arguments))},n.forEach(function(t){e["fix"+i(t)](r,s)}),r._id=r.name+"@"+r.version}function i(e){return e.charAt(0).toUpperCase()+e.slice(1)}return n=n.concat(["dependencies","people","typos"]),tt}(),st=V(ot);const at=(e,t)=>{try{return v(e,y.F_OK),!0}catch(e){return!1}},ct=["index.ts","index.tsx","main.ts","main.tsx"],lt=(e,t,n)=>{const r=a(e??process.cwd(),"src"),i=ct,o=i.map(e=>a(r,e)).find(e=>at(e));if(!o)throw new Error(`Unable to resolve entry point, ensure ${i.join(", ")} exists in ${r}`);return o},ut=(e,t)=>_(e,t,{arrayMerge:(e,t)=>{const n=t[0]??e[0];return"object"==typeof n&&"match"in n&&"middleware"in n?((e,t,n)=>{const r=n.reduce((t,n)=>Object.assign(t,{[String(n[e])]:n}),{}),i={...t.reduce((t,n)=>Object.assign(t,{[String(n[e])]:n}),{}),...r};return Object.values(i)})("match",e,t):[...new Set([...e,...t])]}}),ft=/import\s*{\s*[^}]*\b(route|index|layout|prefix)\b[^}]*}\s*from\s*['"]@equinor\/fusion-framework-react-router(?:\/routes)?['"]/g,dt=/\b(route|index|layout|prefix)\s*\(/g,pt=/import\.meta\.resolve\s*\(\s*['"]([^'"]+)['"]\s*\)/g,ht=/\b(index|layout)\s*\(\s*['"]([^'"]+)['"]\s*\)/g,mt=/\blayout\s*\(\s*import\.meta\.resolve\s*\(\s*['"]([^'"]+)['"]\s*\)\s*,\s*[^)]+\s*\)/g,gt=/\blayout\s*\(\s*['"]([^'"]+)['"]\s*,\s*[^)]+\s*\)/g,vt=/\broute\s*\(\s*[^,]+,\s*['"]([^'"]+)['"]\s*\)/g,yt=/\bindex\s*\(\s*['"]([^'"]+)['"]\s*\)/g,Et=/\blayout\s*\(\s*['"]([^'"]+)['"]\s*\)\s*(?!,)/g,bt=/\blayout\s*\(\s*['"]([^'"]+)['"]\s*,\s*/g,wt=/\broute\s*\(\s*([^,]+)\s*,\s*['"]([^'"]+)['"]\s*\)/g,Lt=/\bprefix\s*\(\s*([^,]+)\s*,\s*\[/g,It=/import\s*{\s*[^}]*\b(route|index|layout|prefix)\b[^}]*}\s*from\s*['"]@equinor\/fusion-framework-react-router(?:\/routes)?['"];?\s*/g,St=/export\s+const\s+\w+\s*=\s*/g,Ct=/^import\s+.*?;$/gm,_t=/export\s+default|export\s*{\s*default\s*}/,Dt=e=>new RegExp(`\\bexport\\s+(const|function|class|async\\s+function)\\s+${e}\\b`),Pt=e=>new RegExp(`export\\s*{\\s*[^}]*${e}[^}]*}\\s*from`);function Nt(e,t,n){const r=new Set;try{const i=function(e,t){const n=o.resolve(t,e);if(g.existsSync(n))return n;const r=[".tsx",".ts",".jsx",".js"];for(const e of r){const t=n+e;if(g.existsSync(t))return t}return null}(e,o.dirname(t));if(!i)return n&&console.warn(`[fusion:react-router] File not found: ${e} (resolved from: ${t})`),r;const s=g.readFileSync(i,"utf-8");s.match(_t)&&r.add("default");const a=["clientLoader","action","handle","ErrorElement","HydrateFallback","shouldRevalidate"];for(const e of a)(s.match(Dt(e))||s.match(Pt(e)))&&r.add(e)}catch(t){n&&console.warn(`[fusion:react-router] Error reading file ${e}:`,t)}return r}function Ot(e){const t=[];return e.availableExports.has("default")&&t.push(`Component: ${e.component}`),e.clientLoader&&t.push(`loader: ${e.clientLoader}`),e.action&&t.push(`action: ${e.action}`),e.handle&&t.push(`handle: ${e.handle}`),e.errorElement&&t.push(`errorElement: ${e.errorElement}`),e.hydrateFallback&&t.push(`HydrateFallback: ${e.hydrateFallback}`),e.shouldRevalidate&&t.push(`shouldRevalidate: ${e.shouldRevalidate}`),t.join(",\n ")}function At(e,t,n,r){let i=1,o=t+1;for(;o<e.length&&i>0;){if(e[o]===n&&i++,e[o]===r&&i--,0===i)return o;o++}return null}const $t=(e={})=>{const{debug:t=!1}=e;let n;return{name:"fusion:react-router",config(e){n=e.root??process.cwd(),t&&console.log("[fusion:react-router] Project root:",n)},transform(e,r){try{if(!n||!r.startsWith(n)||r.includes("node_modules"))return null;if(!e.match(ft))return null;if(!e.match(dt))return t&&console.log("[fusion:react-router] File has DSL imports but no route calls, skipping transformation"),null;t&&console.log("[fusion:react-router] Transforming file:",r.replace(n,""));const i=function(e){const t=new Set,n=e=>{var n;e&&((n=e).startsWith("./")||n.startsWith("../"))&&t.add(e)};let r=pt.exec(e);for(;null!==r;)n(r[1]),r=pt.exec(e);for(r=ht.exec(e);null!==r;)n(r[2]),r=ht.exec(e);for(r=mt.exec(e);null!==r;)n(r[1]),r=mt.exec(e);for(r=gt.exec(e);null!==r;)n(r[1]),r=gt.exec(e);for(r=vt.exec(e);null!==r;)n(r[1]),r=vt.exec(e);return t}(e);if(0===i.size)return null;const o=new Map;i.forEach(e=>{const n=function(e){const t=e.replace(/\.[^./]+$/,"").split("/").filter(e=>e&&"."!==e&&".."!==e),n=t[t.length-1]??"index";return("index"===n.toLowerCase()&&t.length>1?t.slice(0,-1):[n]).map(e=>e.replace(/[[\]]/g,"").replace(/[-_.](.)/g,(e,t)=>t.toUpperCase()).replace(/^(.)/,e=>e.toUpperCase())).join("")}(e),i=Nt(e,r,t);o.set(e,{component:n,clientLoader:i.has("clientLoader")?`clientLoader${n}`:void 0,action:i.has("action")?`action${n}`:void 0,handle:i.has("handle")?`handle${n}`:void 0,errorElement:i.has("ErrorElement")?`ErrorElement${n}`:void 0,hydrateFallback:i.has("HydrateFallback")?`HydrateFallback${n}`:void 0,shouldRevalidate:i.has("shouldRevalidate")?`shouldRevalidate${n}`:void 0,availableExports:i})});const s=function(e,t){const n=[];return t&&n.push("import React from 'react';","import { useLoaderData, useActionData, useRouteError, useRouterContext, routerContext } from '@equinor/fusion-framework-react-router';"),e.forEach((e,t)=>{const r=[];e.availableExports.has("default")&&r.push(`default as ${e.component}`),e.clientLoader&&r.push(`clientLoader as ${e.clientLoader}`),e.action&&r.push(`action as ${e.action}`),e.handle&&r.push(`handle as ${e.handle}`),e.errorElement&&r.push(`ErrorElement as ${e.errorElement}`),e.hydrateFallback&&r.push(`HydrateFallback as ${e.hydrateFallback}`),e.shouldRevalidate&&r.push(`shouldRevalidate as ${e.shouldRevalidate}`),r.length>0&&n.push(`import {\n ${r.join(",\n ")}\n} from '${t}';`)}),n}(o,i.size>0);let a=e;return a=a.replace(pt,'"$1"'),a=a.replace(yt,(e,t)=>{const n=o.get(t);if(!n)return e;return`{\n index: true,\n ${Ot(n)}\n }`}),a=a.replace(Et,(e,t)=>{const n=o.get(t);if(!n)return e;return`{\n ${Ot(n)}\n }`}),a=function(e,t,n,r,i){let o=e,s=!0;for(;s;){s=!1;const e=Array.from(o.matchAll(t));for(const t of e){const e=t.index??-1;if(e<0)continue;const a=t[1],c=e+t[0].length,l=o.indexOf("(",e);if(-1===l)continue;const u=At(o,l,"(",")");if(null===u)continue;const f=o.slice(c,u).trim();if(n.test(f))continue;const d=r(a,f,i.get(a));if(null!==d){const t=o.slice(0,e),n=o.slice(u+1);o=t+d+n,s=!0;break}}}return o}(a,bt,/\blayout\s*\(/,(e,t,n)=>{if(!n)return null;return`{\n ${Ot(n)},\n children: ${t}\n }`},o),a=a.replace(wt,(e,t,n)=>{const r=o.get(n);if(!r)return e;return`{\n path: ${t},\n ${Ot(r)}\n }`}),a=function(e){let t=e,n=!0;for(;n;){n=!1;let e=Lt.exec(t);for(;null!==e;){const r=e.index,i=e[1],o=e.index+e[0].length-1,s=At(t,o,"[","]");if(null===s){e=Lt.exec(t);continue}const a=t.slice(o+1,s);if(/\bprefix\s*\(/.test(a)){e=Lt.exec(t);continue}const c=t.indexOf(")",s);if(-1===c){e=Lt.exec(t);continue}const l=t.slice(0,r),u=t.slice(c+1);t=`${l}{\n path: ${i},\n children: [${a}]\n }${u}`,n=!0;break}}return t}(a),a=a.replace(It,""),a=function(e){let t=e,n=St.exec(t);for(;null!==n;){const e=n.index+n[0].length;let r=e;for(;r<t.length&&/\s/.test(t[r]);)r++;if("{"===t[r]){const i=At(t,r,"{","}");if(null!==i){const o=t.slice(r,i+1);if(o.includes("Component:")&&!t.slice(e,r).trim().startsWith("[")){const r=t.slice(0,e),s=t.slice(i+1);t=`${r}[${o}]${s}`,St.lastIndex=0,n=St.exec(t);continue}}}n=St.exec(t)}return t}(a),a=function(e,t){const n=e.match(Ct);if(n&&n.length>0){const r=n[n.length-1],i=e.lastIndexOf(r)+r.length;return e.slice(0,i)+"\n"+t.join("\n")+"\n"+e.slice(i)}return`${t.join("\n")}\n${e}`}(a,s),a}catch(t){return console.error("[fusion:react-router] Error during transformation:",t),e}}}},Rt=async(n,r)=>{const{packageJson:o,root:a}=r,{config:u}=await e(n)??{},f=o.main??o.module??"./dist/bundle.js",d=lt(a);if("build"===n.command){if(s(f)===a)throw new Error("outDir cannot be root, please specify package.main or package.module in package.json");if("src"===s(f))throw new Error("outDir cannot be src, please specify package.main or package.module in package.json");if(s(f)===process.cwd())throw new Error("outDir cannot be the current working directory, please specify package.main or package.module in package.json")}return t({root:a,plugins:[i(),$t({debug:!0}),D({extensions:[".md"]})],define:{"process.env.NODE_ENV":JSON.stringify(n.mode),"process.env.NODE_DEBUG":"production"!==n.mode,"process.env.FUSION_LOG_LEVEL":"production"===n.mode?1:3},build:{outDir:s(f),lib:{entry:d,fileName:c(f,l(f)),formats:["es"]},emptyOutDir:!0}},u??{})};function xt(e,t){P("object"==typeof e,new Error(t))}const Tt=e=>{if(e.repository)return"string"==typeof e.repository?e.repository:e.repository.url},kt=()=>{try{return N("git remote get-url origin").toString().trim().replace("git@github.com:","https://github.com/").replace(/\.git$/,"")}catch(e){return}},Ft=(e="HEAD")=>{try{return N(`git rev-parse ${e}`).toString().trim()}catch(e){return}},Ut=()=>{try{return N("git branch --show-current").toString().trim()||void 0}catch{return}},Bt="15.3.2",Mt=e=>{if(e?.startsWith("refs/heads/"))return e.slice(11)||void 0},Gt=()=>{const e={cliVersion:Bt,source:"local",reason:"manual"};if("true"===process.env.GITHUB_ACTIONS){const t=(()=>{const e=process.env.GITHUB_EVENT_NAME||"unknown",t=process.env.GITHUB_ACTOR||"unknown",n=process.env.GITHUB_RUN_ID||"unknown",r=process.env.GITHUB_REPOSITORY||"unknown",i=process.env.GITHUB_WORKFLOW||"unknown",o=process.env.GITHUB_SERVER_URL||"https://github.com";let s="unknown";"unknown"!==r&&"unknown"!==n&&(s=`${o.replace(/\/$/,"")}/${r}/actions/runs/${n}`);const a={eventName:e,actor:t,runId:n,runUrl:s,workflow:i};if(process.env.GITHUB_EVENT_PATH)try{const e=E(process.env.GITHUB_EVENT_PATH,"utf8");Object.assign(a,JSON.parse(e))}catch{console.error("Failed to parse GitHub event payload")}return a})(),n={...e,source:"github",reason:t.eventName,workflow:t.workflow,runId:t.runId,runUrl:t.runUrl,commitId:t.head_commit?.id,repository:t.repository?.name,repository_homepage:t.repository?.homepage,repository_license:t.repository?.license?.name,repository_owner:t.repository?.owner?.login,repository_owner_avatar_url:t.repository?.owner?.avatar_url,actor:t.actor,sender_login:t.sender?.login,sender_avatar_url:t.sender?.avatar_url};return t.pull_request?{...n,branch:t.pull_request.head?.ref,commitId:t.pull_request.head?.sha,htmlUrl:t.pull_request.html_url}:t.release?{...n,tag:t.release.tag_name,htmlUrl:t.release.html_url}:{...n,branch:Mt(t.ref??process.env.GITHUB_REF)}}if(process.env.SYSTEM_TEAMPROJECT){const t=(()=>{const e=process.env.BUILD_BUILDID||"unknown",t=process.env.BUILD_DEFINITIONNAME||"unknown",n=process.env.BUILD_REPOSITORY_NAME||"unknown",r=process.env.SYSTEM_TEAMPROJECT||"unknown",i=process.env.SYSTEM_COLLECTIONURI||"unknown",o=process.env.BUILD_REQUESTEDFOR||"unknown",s=process.env.BUILD_SOURCEBRANCH||"unknown",a=process.env.BUILD_SOURCEVERSION||"unknown",c=process.env.BUILD_REASON||"unknown";let l="unknown";return"unknown"!==i&&"unknown"!==r&&"unknown"!==e&&(l=`${i.replace(/\/$/,"")}${r}/_build/results?buildId=${e}`),{runId:e,pipelineName:t,repository:n,project:r,orgUrl:i,actor:o,branch:s,commitId:a,runUrl:l,reason:c}})();return{...e,source:"azure_devops",reason:t.reason,repository:t.repository,runId:t.runId,runUrl:t.runUrl,actor:t.actor,branch:t.branch,commitId:t.commitId,workflow:t.pipelineName}}return{...e,branch:Ut()}},jt=["png","jpg","jpeg","gif","svg","ico","webp","mp4","webm","mp3","woff2","woff","eot","ttf","otf","pdf","md","txt"];const Ht=(e,t,n)=>{xt(t,"expected packageJson"),P(t.name,"expected [name] in packageJson"),P(t.version,"expected [version] in packageJson");const r=((e,t)=>"build"===e.command||e.isPreview?t.main||t.module||"dist/app-bundle.js":lt(e.root))(e,t),i=t.name.replace(/^@|\w.*\//gm,""),o=n?.snapshot?function(e,t){const n=O(e)?.version;if(!n)throw new Error(`Invalid semantic version: "${e}". Expected format: major.minor.patch`);const r=Math.floor(Date.now()/1e3);return`${n}-${"string"==typeof t?`${t}.${r}`:`snapshot.${r}`}`}(t.version,n.snapshot):t.version,s="build"===e.command?void 0:`/bundles/apps/${i}@${o}`,a=Tt(t)??kt(),c=jt.map(e=>`.${e}`);return{appKey:i,displayName:t.name,description:t.description||"",keywords:t.keywords,type:"standalone",build:{entryPoint:r,assetPath:s,githubRepo:a,version:o,timestamp:(new Date).toISOString(),commitSha:Ft(),annotations:Gt(),projectPage:t.homepage,allowedExtensions:c}}},zt=(e,t)=>_(e,t),qt=x.object({environment:x.record(x.string(),x.any()).describe("Key-value map of environment-specific variables for the application. Defaults to an empty object if not provided.").optional().default({}),endpoints:x.record(x.string(),x.object({url:x.string({message:"The endpoint URL. This field is required."}),scopes:x.array(x.string()).optional().default([]).describe("List of scopes required for accessing this endpoint. Defaults to an empty array.")})).describe("A mapping of endpoint names to their configuration objects. Each endpoint must specify a URL and may specify scopes.").optional()}).describe("The API application configuration schema, defining environment variables and endpoints for the application."),Vt=(e,t)=>r.blueBright(t?.relative?`./${u(t?.cwd??process.cwd(),e)}`:e),Wt=async(e,t,n)=>{const i=Ht(e,t.packageJson,{snapshot:n?.snapshot});try{n?.log?.start("loading application package...");const{manifest:t,path:r}=await(async(e,t)=>{const n=t?.file??[`app.manifest.${e.environment}`,"app.manifest","app.manifest.config"],r=await S(n,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async n=>{const r=t?.base??{};if("function"==typeof n.default){const t=await n.default(e,{base:r});return zt(r,t??{})}return zt(r,n.default??{})}}});return{manifest:r.config,path:r.path,extension:r.extension}})(e,{base:i,file:n?.manifestPath});if(!t.build)throw new Error(`Application manifest for ${t.appKey} does not contain build information, please check the manifest file.`);return"serve"===e.command&&(t.build.assetPath=`/bundles/apps/${t.appKey}/${t.build.version}`),n?.log?.succeed("generated manifest from",Vt(r,{relative:!0})),t}catch(e){if(e instanceof C){if(n?.manifestPath){const t=new Error(`Failed to load manifest file ${Vt(n.manifestPath)}, please check the path.`,{cause:e});throw n?.log?.fail(t.message),t}return n?.log?.succeed(r.dim("no local manifest config applied, using default generated from package")),i}throw n?.log?.fail(`failed to resolve application manifest ${n?.manifestPath?Vt(n?.manifestPath):""}`),e}};async function Zt(e){e?.start("resolve project package");try{const t=await(async e=>{const t=await f({...e,normalize:!1});if(!t)throw new Error("failed to find package.json");const n={...t.packageJson};return st(n),{packageJson:{...n,version:t.packageJson.version},path:t.path,root:s(t.path)}})();return e?.succeed("ðĶ",r.yellowBright([t.packageJson.name,t.packageJson.version].join("@"))),e?.info("ð ",r.blueBright(t.root)),t}catch(t){throw e?.fail("â ïļ","failed to resolve project package"),t}}const Kt=async e=>{const{log:t}=e??{},n=await Zt(t);t?.debug("package",n);const r={command:"build",mode:process.env.NODE_ENV??"production",root:n.root,...e?.env};t?.debug("env:",r);const i=await Wt(r,n,{log:t,manifestPath:e?.manifest,snapshot:e?.snapshot});return t?.debug("manifest:",i),{manifest:i,pkg:n,env:r}},Yt=async e=>{const{log:t,snapshot:i}=e??{};t?.log(r.bold("Starting to build application"));const{manifest:o,pkg:s,env:a}=await Kt({log:t,manifest:e?.manifest,snapshot:i});t?.start("loading vite config...");const c=await Rt(a,s);t?.succeed("vite config applied"),t?.debug("vite config:",c),t?.start("ðĪðŧ","building application..."),t?.startNativeConsoleCapture(),await n(c),t?.stopNativeConsoleCapture(),t?.succeed("build completed ð");return{pkg:s,manifest:o,outDir:c.build.outDir}};var Xt,Jt,Qt={exports:{}};function en(){return Jt?Xt:(Jt=1,Xt={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24})}var tn,nn,rn,on,sn,an,cn,ln,un={};function fn(){return tn||(tn=1,function(e){const t={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",DESCRIPTOR_NOT_EXIST:"No descriptor present",DESCRIPTOR_UNKNOWN:"Unknown descriptor format",DESCRIPTOR_FAULTY:"Descriptor data is malformed",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed {0}",FILE_IN_THE_WAY:"There is a file in the way: {0}",UNKNOWN_METHOD:"Invalid/unsupported compression method",AVAIL_DATA:"inflate::Available inflate data did not terminate",INVALID_DISTANCE:"inflate::Invalid literal/length or distance code in fixed or dynamic block",TO_MANY_CODES:"inflate::Dynamic block code description: too many length or distance codes",INVALID_REPEAT_LEN:"inflate::Dynamic block code description: repeat more than specified lengths",INVALID_REPEAT_FIRST:"inflate::Dynamic block code description: repeat lengths with no first length",INCOMPLETE_CODES:"inflate::Dynamic block code description: code lengths codes incomplete",INVALID_DYN_DISTANCE:"inflate::Dynamic block code description: invalid distance code lengths",INVALID_CODES_LEN:"inflate::Dynamic block code description: invalid literal/length code lengths",INVALID_STORE_BLOCK:"inflate::Stored block length did not match one's complement",INVALID_BLOCK_TYPE:"inflate::Invalid block type (type == 3)",CANT_EXTRACT_FILE:"Could not extract the file",CANT_OVERRIDE:"Target file already exists",DISK_ENTRY_TOO_LARGE:"Number of disk entries is too large",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:'File not found: "{0}"',NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found",INVALID_PASS_PARAM:"Incompatible password parameter",WRONG_PASSWORD:"Wrong Password",COMMENT_TOO_LONG:"Comment is too long",EXTRA_FIELD_PARSE_ERROR:"Extra field parsing error"};function n(e){return function(...t){return t.length&&(e=e.replace(/\{(\d)\}/g,(e,n)=>t[n]||"")),new Error("ADM-ZIP: "+e)}}for(const r of Object.keys(t))e[r]=n(t[r])}(un)),un}function dn(){return ln||(ln=1,Qt.exports=function(){if(rn)return nn;rn=1;const e=T,t=k,n=en(),r=fn(),i="object"==typeof process&&"win32"===process.platform,o=e=>"object"==typeof e&&null!==e,s=new Uint32Array(256).map((e,t)=>{for(let e=0;e<8;e++)1&t?t=3988292384^t>>>1:t>>>=1;return t>>>0});function a(n){this.sep=t.sep,this.fs=e,o(n)&&o(n.fs)&&"function"==typeof n.fs.statSync&&(this.fs=n.fs)}return nn=a,a.prototype.makeDir=function(e){const t=this;!function(e){let n=e.split(t.sep)[0];e.split(t.sep).forEach(function(e){if(e&&":"!==e.substr(-1,1)){var i;n+=t.sep+e;try{i=t.fs.statSync(n)}catch(e){if(!e.message||!e.message.startsWith("ENOENT"))throw e;t.fs.mkdirSync(n)}if(i&&i.isFile())throw r.FILE_IN_THE_WAY(`"${n}"`)}})}(e)},a.prototype.writeFileTo=function(e,n,r,i){const o=this;if(o.fs.existsSync(e)){if(!r)return!1;if(o.fs.statSync(e).isDirectory())return!1}var s,a=t.dirname(e);o.fs.existsSync(a)||o.makeDir(a);try{s=o.fs.openSync(e,"w",438)}catch(t){o.fs.chmodSync(e,438),s=o.fs.openSync(e,"w",438)}if(s)try{o.fs.writeSync(s,n,0,n.length,0)}finally{o.fs.closeSync(s)}return o.fs.chmodSync(e,i||438),!0},a.prototype.writeFileToAsync=function(e,n,r,i,o){"function"==typeof i&&(o=i,i=void 0);const s=this;s.fs.exists(e,function(a){if(a&&!r)return o(!1);s.fs.stat(e,function(r,c){if(a&&c&&c.isDirectory())return o(!1);var l=t.dirname(e);s.fs.exists(l,function(t){if(!t)try{s.makeDir(l)}catch(e){return o(!1)}const r=function(t){s.fs.write(t,n,0,n.length,0,function(n){s.fs.close(t,function(){if(n)return o(!1);s.fs.chmod(e,i||438,function(){o(!0)})})})};s.fs.open(e,"w",438,function(t,n){t?s.fs.chmod(e,438,function(){s.fs.open(e,"w",438,function(e,t){if(e||!t)return o(!1);r(t)})}):n?r(n):o(!1)})})})})},a.prototype.findFiles=function(e){const n=this;return function e(r,i,o,s){let a=[];return n.fs.readdirSync(r).forEach(function(c){const l=t.join(r,c),u=n.fs.statSync(l);if(a.push(t.normalize(l)+(u.isDirectory()?n.sep:"")),u.isDirectory()&&o){const t=n.fs.realpathSync(l);s.has(t)||(s.add(t),a=a.concat(e(l,i,o,s)))}}),a}(e,void 0,!0,new Set([n.fs.realpathSync(e)]))},a.prototype.findFilesAsync=function(e,n){const r=this,i=[];let o=!1;const s=function(e){o||(o=!0,n(e,e?void 0:i))},a=function(e,n,o){r.fs.readdir(e,function(s,c){if(s)return o(s);let l=c.length;if(!l)return o();c.forEach(function(s){const c=t.join(e,s);r.fs.stat(c,function(e,s){if(e)return o(e);s?(i.push(t.normalize(c)+(s.isDirectory()?r.sep:"")),s.isDirectory()?r.fs.realpath(c,function(e,t){if(e)return o(e);n.has(t)?--l||o():(n.add(t),a(c,n,function(e){if(e)return o(e);--l||o()}))}):--l||o()):--l||o()})})})};r.fs.realpath(e,function(t,n){if(t)return s(t);a(e,new Set([n]),s)})},a.prototype.getAttributes=function(){},a.prototype.setAttributes=function(){},a.crc32update=function(e,t){return s[255&(e^t)]^e>>>8},a.crc32=function(e){"string"==typeof e&&(e=Buffer.from(e,"utf8"));let t=e.length,n=-1;for(let r=0;r<t;)n=a.crc32update(n,e[r++]);return~n>>>0},a.methodToString=function(e){switch(e){case n.STORED:return"STORED ("+e+")";case n.DEFLATED:return"DEFLATED ("+e+")";default:return"UNSUPPORTED ("+e+")"}},a.canonical=function(e){if(!e)return"";const n=t.posix.normalize("/"+e.split("\\").join("/"));return t.join(".",n)},a.zipnamefix=function(e){if(!e)return"";const n=t.posix.normalize("/"+e.split("\\").join("/"));return t.posix.join(".",n)},a.findLast=function(e,t){if(!Array.isArray(e))throw new TypeError("arr is not array");for(let n=(e.length>>>0)-1;n>=0;n--)if(t(e[n],n,e))return e[n]},a.sanitize=function(e,n){e=t.resolve(t.normalize(e));for(var r=n.split("/"),i=0,o=r.length;i<o;i++){var s=t.normalize(t.join(e,r.slice(i,o).join(t.sep)));if(s===e||s.startsWith(e+t.sep))return s}return t.normalize(t.join(e,t.basename(n)))},a.toBuffer=function(e,t){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e):"string"==typeof e?t(e):Buffer.alloc(0)},a.readBigUInt64LE=function(e,t){const n=e.readUInt32LE(t);return 4294967296*e.readUInt32LE(t+4)+n},a.writeBigUInt64LE=function(e,t,n){const r=t>>>0,i=Math.floor(t/4294967296)>>>0;e.writeUInt32LE(r,n),e.writeUInt32LE(i,n+4)},a.fromDOS2Date=function(e){return new Date(1980+(e>>25&127),Math.max((e>>21&15)-1,0),Math.max(e>>16&31,1),e>>11&31,e>>5&63,(31&e)<<1)},a.fromDate2DOS=function(e){let t=0,n=0;return e.getFullYear()>1979&&(t=(e.getFullYear()-1980&127)<<9|e.getMonth()+1<<5|e.getDate(),n=e.getHours()<<11|e.getMinutes()<<5|e.getSeconds()>>1),t<<16|n},a.isWin=i,a.crcTable=s,nn}(),Qt.exports.Constants=en(),Qt.exports.Errors=fn(),Qt.exports.FileAttr=function(){if(sn)return on;sn=1;const e=k;return on=function(t,{fs:n}){var r=t||"",i={directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0},o=null;return r&&n.existsSync(r)?(o=n.statSync(r),i.directory=o.isDirectory(),i.mtime=o.mtime,i.atime=o.atime,i.executable=!!(73&o.mode),i.readonly=!(128&o.mode),i.hidden="."===e.basename(r)[0]):console.warn("Invalid path: "+r),{get directory(){return i.directory},get readOnly(){return i.readonly},get hidden(){return i.hidden},get mtime(){return i.mtime},get atime(){return i.atime},get executable(){return i.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:r,isDirectory:i.directory,isReadOnly:i.readonly,isHidden:i.hidden,isExecutable:i.executable,mTime:i.mtime,aTime:i.atime}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}},on}(),Qt.exports.decoder=cn?an:(cn=1,an={efs:!0,encode:e=>Buffer.from(e,"utf8"),decode:e=>e.toString("utf8")})),Qt.exports}var pn,hn,mn,gn,vn,yn={};function En(){if(hn)return pn;hn=1;var e=dn(),t=e.Constants;return pn=function(){var n=20,r=10,i=0,o=0,s=0,a=0,c=0,l=0,u=0,f=0,d=0,p=0,h=0,m=0,g=0;n|=e.isWin?2560:768,i|=t.FLG_EFS;const v={extraLen:0},y=e=>Math.max(0,e)>>>0;return s=e.fromDate2DOS(new Date),{get made(){return n},set made(e){n=e},get version(){return r},set version(e){r=e},get flags(){return i},set flags(e){i=e},get flags_efs(){return(i&t.FLG_EFS)>0},set flags_efs(e){e?i|=t.FLG_EFS:i&=~t.FLG_EFS},get flags_desc(){return(i&t.FLG_DESC)>0},set flags_desc(e){e?i|=t.FLG_DESC:i&=~t.FLG_DESC},get method(){return o},set method(e){switch(e){case t.STORED:this.version=10;break;case t.DEFLATED:default:this.version=20}o=e},get time(){return e.fromDOS2Date(this.timeval)},set time(t){t=new Date(t),this.timeval=e.fromDate2DOS(t)},get timeval(){return s},set timeval(e){s=y(e)},get timeHighByte(){return e=s>>>8,255&Math.max(0,e);var e},get crc(){return a},set crc(e){a=y(e)},get compressedSize(){return c},set compressedSize(e){c=y(e)},get size(){return l},set size(e){l=y(e)},get fileNameLength(){return u},set fileNameLength(e){u=e},get extraLength(){return f},set extraLength(e){f=e},get extraLocalLength(){return v.extraLen},set extraLocalLength(e){v.extraLen=e},get commentLength(){return d},set commentLength(e){d=e},get diskNumStart(){return p},set diskNumStart(e){p=y(e)},get inAttr(){return h},set inAttr(e){h=y(e)},get attr(){return m},set attr(e){m=y(e)},get fileAttr(){return(m||0)>>16&4095},get offset(){return g},set offset(e){g=y(e)},get encrypted(){return(i&t.FLG_ENC)===t.FLG_ENC},get centralHeaderSize(){return t.CENHDR+u+f+d},get realDataOffset(){return g+t.LOCHDR+v.fnameLen+v.extraLen},get localHeader(){return v},loadLocalHeaderFromBinary:function(n){var r=n.slice(g,g+t.LOCHDR);if(r.readUInt32LE(0)!==t.LOCSIG)throw e.Errors.INVALID_LOC();v.version=r.readUInt16LE(t.LOCVER),v.flags=r.readUInt16LE(t.LOCFLG),v.flags_desc=(v.flags&t.FLG_DESC)>0,v.method=r.readUInt16LE(t.LOCHOW),v.time=r.readUInt32LE(t.LOCTIM),v.crc=r.readUInt32LE(t.LOCCRC),v.compressedSize=r.readUInt32LE(t.LOCSIZ),v.size=r.readUInt32LE(t.LOCLEN),v.fnameLen=r.readUInt16LE(t.LOCNAM),v.extraLen=r.readUInt16LE(t.LOCEXT);const i=g+t.LOCHDR+v.fnameLen,o=i+v.extraLen;return n.slice(i,o)},loadFromBinary:function(v){if(v.length!==t.CENHDR||v.readUInt32LE(0)!==t.CENSIG)throw e.Errors.INVALID_CEN();n=v.readUInt16LE(t.CENVEM),r=v.readUInt16LE(t.CENVER),i=v.readUInt16LE(t.CENFLG),o=v.readUInt16LE(t.CENHOW),s=v.readUInt32LE(t.CENTIM),a=v.readUInt32LE(t.CENCRC),c=v.readUInt32LE(t.CENSIZ),l=v.readUInt32LE(t.CENLEN),u=v.readUInt16LE(t.CENNAM),f=v.readUInt16LE(t.CENEXT),d=v.readUInt16LE(t.CENCOM),p=v.readUInt16LE(t.CENDSK),h=v.readUInt16LE(t.CENATT),m=v.readUInt32LE(t.CENATX),g=v.readUInt32LE(t.CENOFF)},localHeaderToBinary:function(){var e=Buffer.alloc(t.LOCHDR);return e.writeUInt32LE(t.LOCSIG,0),e.writeUInt16LE(r,t.LOCVER),e.writeUInt16LE(i&~t.FLG_DESC,t.LOCFLG),e.writeUInt16LE(o,t.LOCHOW),e.writeUInt32LE(s,t.LOCTIM),e.writeUInt32LE(a,t.LOCCRC),e.writeUInt32LE(c,t.LOCSIZ),e.writeUInt32LE(l,t.LOCLEN),e.writeUInt16LE(u,t.LOCNAM),e.writeUInt16LE(v.extraLen,t.LOCEXT),e},centralHeaderToBinary:function(){var e=Buffer.alloc(t.CENHDR+u+f+d);return e.writeUInt32LE(t.CENSIG,0),e.writeUInt16LE(n,t.CENVEM),e.writeUInt16LE(r,t.CENVER),e.writeUInt16LE(i&~t.FLG_DESC,t.CENFLG),e.writeUInt16LE(o,t.CENHOW),e.writeUInt32LE(s,t.CENTIM),e.writeUInt32LE(a,t.CENCRC),e.writeUInt32LE(c,t.CENSIZ),e.writeUInt32LE(l,t.CENLEN),e.writeUInt16LE(u,t.CENNAM),e.writeUInt16LE(f,t.CENEXT),e.writeUInt16LE(d,t.CENCOM),e.writeUInt16LE(p,t.CENDSK),e.writeUInt16LE(h,t.CENATT),e.writeUInt32LE(m,t.CENATX),e.writeUInt32LE(g,t.CENOFF),e},toJSON:function(){const s=function(e){return e+" bytes"};return{made:n,version:r,flags:i,method:e.methodToString(o),time:this.time,crc:"0x"+a.toString(16).toUpperCase(),compressedSize:s(c),size:s(l),fileNameLength:s(u),extraLength:s(f),commentLength:s(d),diskNumStart:p,inAttr:h,attr:m,offset:g,centralHeaderSize:s(t.CENHDR+u+f+d)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}}function bn(){return vn||(vn=1,yn.EntryHeader=En(),yn.MainHeader=function(){if(gn)return mn;gn=1;var e=dn(),t=e.Constants;return mn=function(){var n=0,r=0,i=0,o=0,s=0;const a=()=>n>t.EF_ZIP64_OR_16||r>t.EF_ZIP64_OR_16||i>t.EF_ZIP64_OR_32||o>t.EF_ZIP64_OR_32;return{get diskEntries(){return n},set diskEntries(e){n=r=e},get totalEntries(){return r},set totalEntries(e){r=n=e},get size(){return i},set size(e){i=e},get offset(){return o},set offset(e){o=e},get commentLength(){return s},set commentLength(e){s=e},get mainHeaderSize(){return(a()?t.ZIP64HDR+t.END64HDR:0)+t.ENDHDR+s},loadFromBinary:function(a){if((a.length!==t.ENDHDR||a.readUInt32LE(0)!==t.ENDSIG)&&(a.length<t.ZIP64HDR||a.readUInt32LE(0)!==t.ZIP64SIG))throw e.Errors.INVALID_END();a.readUInt32LE(0)===t.ENDSIG?(n=a.readUInt16LE(t.ENDSUB),r=a.readUInt16LE(t.ENDTOT),i=a.readUInt32LE(t.ENDSIZ),o=a.readUInt32LE(t.ENDOFF),s=a.readUInt16LE(t.ENDCOM)):(n=e.readBigUInt64LE(a,t.ZIP64SUB),r=e.readBigUInt64LE(a,t.ZIP64TOT),i=e.readBigUInt64LE(a,t.ZIP64SIZB),o=e.readBigUInt64LE(a,t.ZIP64OFF),s=0)},toBinary:function(){var c;if(!a())return(c=Buffer.alloc(t.ENDHDR+s)).writeUInt32LE(t.ENDSIG,0),c.writeUInt32LE(0,4),c.writeUInt16LE(n,t.ENDSUB),c.writeUInt16LE(r,t.ENDTOT),c.writeUInt32LE(i,t.ENDSIZ),c.writeUInt32LE(o,t.ENDOFF),c.writeUInt16LE(s,t.ENDCOM),c.fill(" ",t.ENDHDR),c;let l=0;(c=Buffer.alloc(this.mainHeaderSize)).writeUInt32LE(t.ZIP64SIG,l),e.writeBigUInt64LE(c,t.ZIP64HDR-t.ZIP64LEAD,l+t.ZIP64SIZE),c.writeUInt16LE(45,l+t.ZIP64VEM),c.writeUInt16LE(45,l+t.ZIP64VER),c.writeUInt32LE(0,l+t.ZIP64DSK),c.writeUInt32LE(0,l+t.ZIP64DSKDIR),e.writeBigUInt64LE(c,n,l+t.ZIP64SUB),e.writeBigUInt64LE(c,r,l+t.ZIP64TOT),e.writeBigUInt64LE(c,i,l+t.ZIP64SIZB),e.writeBigUInt64LE(c,o,l+t.ZIP64OFF);const u=o+i;return l+=t.ZIP64HDR,c.writeUInt32LE(t.END64SIG,l),c.writeUInt32LE(0,l+t.END64START),e.writeBigUInt64LE(c,u,l+t.END64OFF),c.writeUInt32LE(1,l+t.END64NUMDISKS),l+=t.END64HDR,c.writeUInt32LE(t.ENDSIG,l),c.writeUInt32LE(0,l+4),c.writeUInt16LE(Math.min(n,t.EF_ZIP64_OR_16),l+t.ENDSUB),c.writeUInt16LE(Math.min(r,t.EF_ZIP64_OR_16),l+t.ENDTOT),c.writeUInt32LE(Math.min(i,t.EF_ZIP64_OR_32),l+t.ENDSIZ),c.writeUInt32LE(Math.min(o,t.EF_ZIP64_OR_32),l+t.ENDOFF),c.writeUInt16LE(s,l+t.ENDCOM),c.fill(" ",l+t.ENDHDR),c},toJSON:function(){return{diskEntries:n,totalEntries:r,size:i+" bytes",offset:function(e,t){let n=e.toString(16).toUpperCase();for(;n.length<t;)n="0"+n;return"0x"+n}(o,4),commentLength:s}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}}()),yn}var wn,Ln,In,Sn,Cn,_n,Dn,Pn,Nn,On,An,$n,Rn,xn={};function Tn(){if(_n)return Cn;_n=1;const{randomFillSync:e}=U,t=fn(),n=new Uint32Array(256).map((e,t)=>{for(let e=0;e<8;e++)1&t?t=t>>>1^3988292384:t>>>=1;return t>>>0}),r=(e,t)=>Math.imul(e,t)>>>0,i=(e,t)=>n[255&(e^t)]^e>>>8,o=()=>"function"==typeof e?e(Buffer.alloc(12)):o.node();o.node=()=>{const e=Buffer.alloc(12),t=e.length;for(let n=0;n<t;n++)e[n]=256*Math.random()&255;return e};const s={genSalt:o};function a(e){const t=Buffer.isBuffer(e)?e:Buffer.from(e);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let e=0;e<t.length;e++)this.updateKeys(t[e])}return a.prototype.updateKeys=function(e){const t=this.keys;return t[0]=i(t[0],e),t[1]+=255&t[0],t[1]=r(t[1],134775813)+1,t[2]=i(t[2],t[1]>>>24),e},a.prototype.next=function(){const e=(2|this.keys[2])>>>0;return r(e,1^e)>>8&255},Cn={decrypt:function(e,n,r){if(!e||!Buffer.isBuffer(e)||e.length<12)return Buffer.alloc(0);const i=function(e){const t=new a(e);return function(e){const n=Buffer.alloc(e.length);let r=0;for(let i of e)n[r++]=t.updateKeys(i^t.next());return n}}(r),o=i(e.slice(0,12)),s=8&~n.flags?n.crc>>>24:n.timeHighByte;if(o[11]!==s)throw t.WRONG_PASSWORD();return i(e.slice(12))},encrypt:function(e,t,n,r=!1){null==e&&(e=Buffer.alloc(0)),Buffer.isBuffer(e)||(e=Buffer.from(e.toString()));const i=function(e){const t=new a(e);return function(e,n,r=0){n||(n=Buffer.alloc(e.length));for(let i of e){const e=t.next();n[r++]=i^e,t.updateKeys(i)}return n}}(n),o=s.genSalt();o[11]=t.crc>>>24&255,r&&(o[10]=t.crc>>>16&255);const c=Buffer.alloc(e.length+12);return i(o,c),i(e,c,12)},_salter:function(e){Buffer.isBuffer(e)&&e.length>=12?s.genSalt=function(){return e.slice(0,12)}:s.genSalt="node"===e?o.node:o}}}function kn(){return Dn||(Dn=1,xn.Deflater=Ln?wn:(Ln=1,wn=function(e){var t=F,n={chunkSize:1024*(parseInt(e.length/1024)+1)};return{deflate:function(){return t.deflateRawSync(e,n)},deflateAsync:function(r){var i=t.createDeflateRaw(n),o=[],s=0;i.on("data",function(e){o.push(e),s+=e.length}),i.on("end",function(){var e=Buffer.alloc(s),t=0;e.fill(0);for(var n=0;n<o.length;n++){var i=o[n];i.copy(e,t),t+=i.length}r&&r(e)}),i.end(e)}}}),xn.Inflater=function(){if(Sn)return In;Sn=1;const e=+(process?.versions?.node??"").split(".")[0]||0;return In=function(t,n){var r=F;const i=e>=15&&n>0?{maxOutputLength:n}:{};return{inflate:function(){return r.inflateRawSync(t,i)},inflateAsync:function(e){var n=r.createInflateRaw(i),o=[],s=0;n.on("data",function(e){o.push(e),s+=e.length}),n.on("end",function(){var t=Buffer.alloc(s),n=0;t.fill(0);for(var r=0;r<o.length;r++){var i=o[r];i.copy(t,n),n+=i.length}e&&e(t)}),n.end(t)}}}}(),xn.ZipCrypto=Tn()),xn}function Fn(){if(Nn)return Pn;Nn=1;var e=dn(),t=bn(),n=e.Constants,r=kn();return Pn=function(i,o){var s=new t.EntryHeader,a=Buffer.alloc(0),c=Buffer.alloc(0),l=!1,u=null,f=Buffer.alloc(0),d=Buffer.alloc(0),p=!0;const h=i,m="object"==typeof h.decoder?h.decoder:e.decoder;function g(){return o&&o instanceof Uint8Array?(d=s.loadLocalHeaderFromBinary(o),o.slice(s.realDataOffset,s.realDataOffset+s.compressedSize)):Buffer.alloc(0)}function v(t){const n=s.flags_desc||s.localHeader.flags_desc?s.crc:s.localHeader.crc;return e.crc32(t)===n}function y(t,n,i){if(void 0===n&&"string"==typeof t&&(i=t,t=void 0),l)return t&&n&&n(Buffer.alloc(0),e.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var o,c=g();if(0===c.length)return t&&n&&n(c),c;if(s.encrypted){if("string"!=typeof i&&!Buffer.isBuffer(i))throw e.Errors.INVALID_PASS_PARAM();c=r.ZipCrypto.decrypt(c,s,i)}switch(s.method){case e.Constants.STORED:if(o=Buffer.alloc(c.length),c.copy(o),v(o))return t&&n&&n(o),o;throw t&&n&&n(o,e.Errors.BAD_CRC()),e.Errors.BAD_CRC();case e.Constants.DEFLATED:var u=new r.Inflater(c,s.size);if(!t){if(!v(o=u.inflate()))throw e.Errors.BAD_CRC(`"${m.decode(a)}"`);return o}u.inflateAsync(function(t){n&&(v(t)?n(t):n(t,e.Errors.BAD_CRC()))});break;default:throw t&&n&&n(Buffer.alloc(0),e.Errors.UNKNOWN_METHOD()),e.Errors.UNKNOWN_METHOD()}}function E(t,n){if((!u||!u.length)&&Buffer.isBuffer(o))return t&&n&&n(g()),g();if(u.length&&!l){var i;switch(s.method){case e.Constants.STORED:return s.compressedSize=s.size,i=Buffer.alloc(u.length),u.copy(i),t&&n&&n(i),i;default:case e.Constants.DEFLATED:var a=new r.Deflater(u);if(!t){var c=a.deflate();return s.compressedSize=c.length,c}a.deflateAsync(function(e){i=Buffer.alloc(e.length),s.compressedSize=e.length,e.copy(i),n&&n(i)}),a=null}}else{if(!t||!n)return Buffer.alloc(0);n(Buffer.alloc(0))}}function b(t,n){return e.readBigUInt64LE(t,n)}function w(e){var t,r,i,o;e.length>=n.EF_ZIP64_SCOMP&&(t=b(e,n.EF_ZIP64_SUNCOMP),s.size===n.EF_ZIP64_OR_32&&(s.size=t)),e.length>=n.EF_ZIP64_RHO&&(r=b(e,n.EF_ZIP64_SCOMP),s.compressedSize===n.EF_ZIP64_OR_32&&(s.compressedSize=r)),e.length>=n.EF_ZIP64_DSN&&(i=b(e,n.EF_ZIP64_RHO),s.offset===n.EF_ZIP64_OR_32&&(s.offset=i)),e.length>=n.EF_ZIP64_DSN+4&&(o=e.readUInt32LE(n.EF_ZIP64_DSN),s.diskNumStart===n.EF_ZIP64_OR_16&&(s.diskNumStart=o))}return p=!!m.hasOwnProperty("efs")&&m.efs,{get entryName(){return m.decode(a)},get rawEntryName(){return a},set entryName(t){var n=(a=e.toBuffer(t,m.encode))[a.length-1];l=47===n||92===n,s.fileNameLength=a.length},get efs(){return"function"==typeof p?p(this.entryName):p},get extra(){return f},set extra(t){f=t,s.extraLength=t.length,function(t){try{for(var r,i,o,s=0;s+4<t.length;)r=t.readUInt16LE(s),s+=2,i=t.readUInt16LE(s),s+=2,o=t.slice(s,s+i),s+=i,n.ID_ZIP64===r&&w(o)}catch(t){throw e.Errors.EXTRA_FIELD_PARSE_ERROR()}}(t)},get comment(){return m.decode(c)},set comment(t){if(c=e.toBuffer(t,m.encode),s.commentLength=c.length,c.length>65535)throw e.Errors.COMMENT_TOO_LONG()},get name(){const e=m.decode(a);return l?e.replace(/[/\\]$/,"").split("/").pop():e.split("/").pop()},get isDirectory(){return l},getCompressedData:function(){return E(!1,null)},getCompressedDataAsync:function(e){E(!0,e)},setData:function(t){u=e.toBuffer(t,e.decoder.encode),!l&&u.length?(s.size=u.length,s.method=e.Constants.DEFLATED,s.crc=e.crc32(t),s.changed=!0):s.method=e.Constants.STORED},getData:function(e){return s.changed?u:y(!1,null,e)},getDataAsync:function(e,t){s.changed?e(u):y(!0,e,t)},set attr(e){s.attr=e},get attr(){return s.attr},set header(e){s.loadFromBinary(e)},get header(){return s},packCentralHeader:function(){s.flags_efs=this.efs,s.extraLength=f.length;var t=s.centralHeaderToBinary(),n=e.Constants.CENHDR;return a.copy(t,n),n+=a.length,f.copy(t,n),n+=s.extraLength,c.copy(t,n),t},packLocalHeader:function(){let e=0;s.flags_efs=this.efs,s.extraLocalLength=d.length;const t=s.localHeaderToBinary(),n=Buffer.alloc(t.length+a.length+s.extraLocalLength);return t.copy(n,e),e+=t.length,a.copy(n,e),e+=a.length,d.copy(n,e),e+=d.length,n},toJSON:function(){const e=function(e){return"<"+(e&&e.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:s.toJSON(),compressedData:e(o),data:e(u)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}},Pn}function Un(){if(An)return On;An=1;const e=Fn(),t=bn(),n=dn();return On=function(r,i){var o=[],s=Object.create(null),a=Buffer.alloc(0),c=new t.MainHeader,l=!1;const u=new Set,f=i,{noSort:d,decoder:p}=f;function h(){if(l=!0,s=Object.create(null),c.diskEntries>(r.length-c.offset)/n.Constants.CENHDR)throw n.Errors.DISK_ENTRY_TOO_LARGE();o=new Array(c.diskEntries);for(var t=c.offset,i=0;i<o.length;i++){var a=t,d=new e(f,r);d.header=r.slice(a,a+=n.Constants.CENHDR),d.entryName=r.slice(a,a+=d.header.fileNameLength),d.header.extraLength&&(d.extra=r.slice(a,a+=d.header.extraLength)),d.header.commentLength&&(d.comment=r.slice(a,a+d.header.commentLength)),t+=d.header.centralHeaderSize,o[i]=d,s[d.entryName]=d}u.clear(),function(){const t=new Set;for(const e of Object.keys(s)){const n=e.split("/");if(n.pop(),n.length)for(let e=0;e<n.length;e++){const r=n.slice(0,e+1).join("/")+"/";t.add(r)}}for(const n of t)if(!(n in s)){const t=new e(f);t.entryName=n,t.attr=16,t.temporary=!0,o.push(t),s[t.entryName]=t,u.add(t)}}()}function m(){o.length>1&&!d&&(o=o.map(e=>({entry:e,key:e.entryName.toLowerCase()})).sort((e,t)=>e.key.localeCompare(t.key)).map(e=>e.entry))}return r?function(e){var t=r.length-n.Constants.ENDHDR,i=Math.max(0,t-65535),o=i,s=r.length,l=-1,u=0;"boolean"==typeof f.trailingSpace&&f.trailingSpace&&(i=0);for(;t>=o;t--)if(80===r[t])if(r.readUInt32LE(t)!==n.Constants.ENDSIG)if(r.readUInt32LE(t)!==n.Constants.END64SIG){if(r.readUInt32LE(t)===n.Constants.ZIP64SIG){l=t,s=t+n.readBigUInt64LE(r,t+n.Constants.ZIP64SIZE)+n.Constants.ZIP64LEAD;break}}else o=i;else l=t,u=t,s=t+n.Constants.ENDHDR,o=t-n.Constants.END64HDR;if(-1==l)throw n.Errors.INVALID_FORMAT();c.loadFromBinary(r.slice(l,s)),c.commentLength&&(a=r.slice(u+n.Constants.ENDHDR));e&&h()}(f.readEntries):l=!0,{get entries(){return l||h(),o.filter(e=>!u.has(e))},get comment(){return p.decode(a)},set comment(e){a=n.toBuffer(e,p.encode),c.commentLength=a.length},getEntryCount:function(){return l?o.length:c.diskEntries},forEach:function(e){this.entries.forEach(e)},getEntry:function(e){return l||h(),s[e]||null},setEntry:function(e){l||h(),o.push(e),s[e.entryName]=e,c.totalEntries=o.length},deleteFile:function(e,t=!0){l||h();const n=s[e];this.getEntryChildren(n,t).map(e=>e.entryName).forEach(this.deleteEntry)},deleteEntry:function(e){l||h();const t=s[e],n=o.indexOf(t);n>=0&&(o.splice(n,1),delete s[e],c.totalEntries=o.length)},getEntryChildren:function(e,t=!0){if(l||h(),"object"==typeof e){if(e.isDirectory&&t){const t=[],n=e.entryName;for(const e of o)e.entryName.startsWith(n)&&t.push(e);return t}return[e]}return[]},getChildCount:function(e){if(e&&e.isDirectory){const t=this.getEntryChildren(e);return t.includes(e)?t.length-1:t.length}return 0},compressToBuffer:function(){l||h(),m();const e=[],t=[];let n=0,i=0;c.size=0,c.offset=0;let o=0;for(const r of this.entries){const s=r.getCompressedData();r.header.offset=i;const a=r.packLocalHeader(),l=a.length+s.length;i+=l,e.push(a),e.push(s);const u=r.packCentralHeader();t.push(u),c.size+=u.length,n+=l+u.length,o++}n+=c.mainHeaderSize,c.offset=i,c.totalEntries=o,i=0;const s=Buffer.alloc(n);for(const t of e)t.copy(s,i),i+=t.length;for(const e of t)e.copy(s,i),i+=e.length;const u=c.toBinary();return a&&a.copy(u,u.length-a.length),u.copy(s,i),r=s,l=!1,s},toAsyncBuffer:function(e,t,n,i){try{l||h(),m();const t=[],o=[];let s=0,u=0,f=0;c.size=0,c.offset=0;const d=function(p){if(p.length>0){const e=p.shift(),r=e.entryName+e.extra.toString();n&&n(r),e.getCompressedDataAsync(function(n){i&&i(r),e.header.offset=u;const a=e.packLocalHeader(),l=a.length+n.length;u+=l,t.push(a),t.push(n);const h=e.packCentralHeader();o.push(h),c.size+=h.length,s+=l+h.length,f++,d(p)})}else{s+=c.mainHeaderSize,c.offset=u,c.totalEntries=f,u=0;const n=Buffer.alloc(s);t.forEach(function(e){e.copy(n,u),u+=e.length}),o.forEach(function(e){e.copy(n,u),u+=e.length});const i=c.toBinary();a&&a.copy(i,i.length-a.length),i.copy(n,u),r=n,l=!1,e(n)}};d(Array.from(this.entries))}catch(e){t(e)}}}},On}var Bn=function(){if(Rn)return $n;Rn=1;const e=dn(),t=k,n=Fn(),r=Un(),i=(...t)=>e.findLast(t,e=>"boolean"==typeof e),o=(...t)=>e.findLast(t,e=>"string"==typeof e),s={noSort:!1,readEntries:!1,method:e.Constants.NONE,fs:null};return $n=function(a,c){let l=null;const u=Object.assign(Object.create(null),s);a&&"object"==typeof a&&(a instanceof Uint8Array||(Object.assign(u,a),a=u.input?u.input:void 0,u.input&&delete u.input),Buffer.isBuffer(a)&&(l=a,u.method=e.Constants.BUFFER,a=void 0)),Object.assign(u,c);const f=new e(u),d=e=>{e.filter(e=>e.attr).sort((e,t)=>t.path.length-e.path.length).forEach(e=>f.fs.chmodSync(e.path,e.attr))};if("object"==typeof u.decoder&&"function"==typeof u.decoder.encode&&"function"==typeof u.decoder.decode||(u.decoder=e.decoder),a&&"string"==typeof a){if(!f.fs.existsSync(a))throw e.Errors.INVALID_FILENAME();u.method=e.Constants.FILE,u.filename=a,l=f.fs.readFileSync(a)}const p=new r(l,u),{canonical:h,sanitize:m,zipnamefix:g}=e;function v(e){var n;if(e&&p&&("string"==typeof e&&(n=p.getEntry(t.posix.normalize(e))),"object"==typeof e&&void 0!==e.entryName&&void 0!==e.header&&(n=p.getEntry(e.entryName)),n))return n;return null}function y(e){const{join:n,normalize:r,sep:i}=t.posix;return n(t.isAbsolute(e)?"/":".",r(i+e.split("\\").join(i)+i))}function E(e){return e instanceof RegExp?(t=e,function(e){return t.test(e)}):"function"!=typeof e?()=>!0:e;var t}const b=(e,n)=>{let r=n.slice(-1);return r=r===f.sep?f.sep:"",t.relative(e,n)+r};return{readFile:function(e,t){var n=v(e);return n&&n.getData(t)||null},childCount:function(e){const t=v(e);if(t)return p.getChildCount(t)},readFileAsync:function(e,t){var n=v(e);n?n.getDataAsync(t):t(null,"getEntry failed for:"+e)},readAsText:function(e,t){var n=v(e);if(n){var r=n.getData();if(r&&r.length)return r.toString(t||"utf8")}return""},readAsTextAsync:function(e,t,n){var r=v(e);r?r.getDataAsync(function(e,r){r?t(e,r):e&&e.length?t(e.toString(n||"utf8")):t("")}):t("")},deleteFile:function(e,t=!0){var n=v(e);n&&p.deleteFile(n.entryName,t)},deleteEntry:function(e){var t=v(e);t&&p.deleteEntry(t.entryName)},addZipComment:function(e){p.comment=e},getZipComment:function(){return p.comment||""},addZipEntryComment:function(e,t){var n=v(e);n&&(n.comment=t)},getZipEntryComment:function(e){var t=v(e);return t&&t.comment||""},updateFile:function(e,t){var n=v(e);n&&n.setData(t)},addLocalFile:function(n,r,i,o){if(!f.fs.existsSync(n))throw e.Errors.FILE_NOT_FOUND(n);{r=r?y(r):"";const e=t.win32.basename(t.win32.normalize(n));r+=i||e;const s=f.fs.statSync(n),a=s.isFile()?f.fs.readFileSync(n):Buffer.alloc(0);s.isDirectory()&&(r+=f.sep),this.addFile(r,a,o,s)}},addLocalFileAsync:function(e,n){e="object"==typeof e?e:{localPath:e};const r=t.resolve(e.localPath),{comment:i}=e;let{zipPath:o,zipName:s}=e;const a=this;f.fs.stat(r,function(e,c){if(e)return n(e,!1);o=o?y(o):"";const l=t.win32.basename(t.win32.normalize(r));if(o+=s||l,c.isFile())f.fs.readFile(r,function(e,t){return e?n(e,!1):(a.addFile(o,t,i,c),setImmediate(n,void 0,!0))});else if(c.isDirectory())return o+=f.sep,a.addFile(o,Buffer.alloc(0),i,c),setImmediate(n,void 0,!0)})},addLocalFolder:function(n,r,i){if(i=E(i),r=r?y(r):"",n=t.normalize(n),!f.fs.existsSync(n))throw e.Errors.FILE_NOT_FOUND(n);{const e=f.findFiles(n),o=this;if(e.length)for(const s of e){const e=t.join(r,b(n,s));i(e)&&o.addLocalFile(s,t.dirname(e))}}},addLocalFolderAsync:function(n,r,i,o){o=E(o),i=i?y(i):"",n=t.normalize(n);var s=this;f.fs.open(n,"r",function(t){if(t&&"ENOENT"===t.code)r(void 0,e.Errors.FILE_NOT_FOUND(n));else if(t)r(void 0,t);else{var a=f.findFiles(n),c=-1,l=function(){if((c+=1)<a.length){var e=a[c],t=b(n,e).split("\\").join("/");t=t.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),o(t)?f.fs.stat(e,function(n,o){n&&r(void 0,n),o.isFile()?f.fs.readFile(e,function(e,n){e?r(void 0,e):(s.addFile(i+t,n,"",o),l())}):(s.addFile(i+t+"/",Buffer.alloc(0),"",o),l())}):process.nextTick(()=>{l()})}else r(!0,void 0)};l()}})},addLocalFolderAsync2:function(n,r){const i=this;n="object"==typeof n?n:{localPath:n};const o=t.resolve(y(n.localPath));let{zipPath:s,filter:a,namefix:c}=n;var l;a instanceof RegExp?(l=a,a=function(e){return l.test(e)}):"function"!=typeof a&&(a=function(){return!0}),s=s?y(s):"","latin1"===c&&(c=e=>e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),"function"!=typeof c&&(c=e=>e);const u=e=>t.join(s,c(b(o,e))),d=e=>t.win32.basename(t.win32.normalize(c(e)));f.fs.open(o,"r",function(n){n&&"ENOENT"===n.code?r(void 0,e.Errors.FILE_NOT_FOUND(o)):n?r(void 0,n):f.findFilesAsync(o,function(e,n){if(e)return r(e);(n=n.filter(e=>a(u(e)))).length||r(void 0,!1),setImmediate(n.reverse().reduce(function(e,n){return function(r,o){if(r||!1===o)return setImmediate(e,r,!1);i.addLocalFileAsync({localPath:n,zipPath:t.dirname(u(n)),zipName:d(n)},e)}},r))})})},addLocalFolderPromise:function(e,t){return new Promise((n,r)=>{this.addLocalFolderAsync2(Object.assign({localPath:e},t),(e,t)=>{e&&r(e),t&&n(this)})})},addFile:function(e,t,r,i){let o=v(e=g(e));const s=null!=o;s||(o=new n(u),o.entryName=e),o.comment=r||"";const a="object"==typeof i&&i instanceof f.fs.Stats;a&&(o.header.time=i.mtime);var c=o.isDirectory?16:0;let l=o.isDirectory?16384:32768;return l|=a?4095&i.mode:"number"==typeof i?4095&i:o.isDirectory?493:420,c=(c|l<<16)>>>0,o.attr=c,o.setData(t),s||p.setEntry(o),o},getEntries:function(e){return p.password=e,p?p.entries:[]},getEntry:function(e){return v(e)},getEntryCount:function(){return p.getEntryCount()},forEach:function(e){return p.forEach(e)},extractEntryTo:function(n,r,s,a,c,l){a=i(!1,a),c=i(!1,c),s=i(!0,s),l=o(c,l);var u=v(n);if(!u)throw e.Errors.NO_ENTRY();var d=h(u.entryName),g=m(r,l&&!u.isDirectory?h(l):s?d:t.basename(d));if(u.isDirectory)return p.getEntryChildren(u).forEach(function(t){if(t.isDirectory)return;var n=t.getData();if(!n)throw e.Errors.CANT_EXTRACT_FILE();var i=h(s?t.entryName:t.entryName.substring(u.entryName.length)),o=m(r,i);const l=c?t.header.fileAttr:void 0;f.writeFileTo(o,n,a,l)}),!0;var y=u.getData(p.password);if(!y)throw e.Errors.CANT_EXTRACT_FILE();if(f.fs.existsSync(g)&&!a)throw e.Errors.CANT_OVERRIDE();const E=c?n.header.fileAttr:void 0;return f.writeFileTo(g,y,a,E),!0},test:function(e){if(!p)return!1;for(var t of p.entries)try{if(t.isDirectory)continue;if(!t.getData(e))return!1}catch(e){return!1}return!0},extractAllTo:function(t,n,r,s){if(r=i(!1,r),s=o(r,s),n=i(!1,n),!p)throw e.Errors.NO_ZIP();const a=[];p.entries.forEach(function(i){var o=m(t,h(i.entryName));if(i.isDirectory)return f.makeDir(o),void(r&&a.push({path:o,attr:i.header.fileAttr}));var c=i.getData(s);if(!c)throw e.Errors.CANT_EXTRACT_FILE();const l=r?i.header.fileAttr:void 0;f.writeFileTo(o,c,n,l);try{f.fs.utimesSync(o,i.header.time,i.header.time)}catch(e){}}),d(a)},extractAllToAsync:function(n,r,o,s){if(s=((...t)=>e.findLast(t,e=>"function"==typeof e))(r,o,s),o=i(!1,o),r=i(!1,r),!s)return new Promise((e,t)=>{this.extractAllToAsync(n,r,o,function(n){n?t(n):e(this)})});if(!p)return void s(e.Errors.NO_ZIP());n=t.resolve(n);const a=e=>m(n,t.normalize(h(e.entryName))),c=(e,t)=>new Error(e+': "'+t+'"'),l=[],u=[];p.entries.forEach(e=>{e.isDirectory?l.push(e):u.push(e)});const g=[];for(const e of l){const t=a(e),n=o?e.header.fileAttr:void 0;try{f.makeDir(t)}catch(e){s(c("Unable to create folder",t));continue}n&&g.push({path:t,attr:n});try{f.fs.utimesSync(t,e.header.time,e.header.time)}catch(e){}}u.reverse().reduce(function(i,s){return function(a){if(a)i(a);else{const a=t.normalize(h(s.entryName)),l=m(n,a);s.getDataAsync(function(t,n){if(n)i(n);else if(t){const e=o?s.header.fileAttr:void 0;f.writeFileToAsync(l,t,r,e,function(e){if(!e)return i(c("Unable to write file",l));f.fs.utimes(l,s.header.time,s.header.time,function(){i()})})}else i(e.Errors.CANT_EXTRACT_FILE())})}}},e=>{if(!e)try{d(g)}catch(e){return s(c("Unable to set folder permissions",e.path||""))}s(e)})()},writeZip:function(e,t){if(1===arguments.length&&"function"==typeof e&&(t=e,e=""),!e&&u.filename&&(e=u.filename),e){var n=p.compressToBuffer();if(n){var r=f.writeFileTo(e,n,!0);"function"==typeof t&&t(r?null:new Error("failed"),"")}}},writeZipPromise:function(e,t){const{overwrite:n,perm:r}=Object.assign({overwrite:!0},t);return new Promise((t,i)=>{!e&&u.filename&&(e=u.filename),e||i("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(o=>{f.writeFileToAsync(e,o,n,r,e=>e?t(e):i("ADM-ZIP: Wasn't able to write zip file"))},i)})},toBufferPromise:function(){return new Promise((e,t)=>{p.toAsyncBuffer(e,t)})},toBuffer:function(e,t,n,r){return"function"==typeof e?(p.toAsyncBuffer(e,t,n,r),null):p.compressToBuffer()}}},$n}(),Mn=V(Bn);const Gn=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],jn=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],Hn=["b","kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],zn=["b","kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],qn=e=>{if("number"==typeof e)return Math.log10(e);const t=e.toString(10);return t.length+Math.log10(`0.${t.slice(0,15)}`)},Vn=(e,t)=>{if(void 0===t)return e;if("number"!=typeof t||!Number.isSafeInteger(t)||t<0)throw new TypeError(`Expected fixedWidth to be a non-negative integer, got ${typeof t}: ${t}`);return 0===t?e:e.length<t?e.padStart(t," "):e};function Wn(e,t){if("bigint"!=typeof e&&!Number.isFinite(e))throw new TypeError(`Expected a finite number, got ${typeof e}: ${e}`);const n=(t={bits:!1,binary:!1,space:!0,nonBreakingSpace:!1,...t}).bits?t.binary?zn:Hn:t.binary?jn:Gn,r=t.space?t.nonBreakingSpace?" ":" ":"",i="number"==typeof e?0===e:0n===e;if(t.signed&&i){return Vn(` 0${r}${n[0]}`,t.fixedWidth)}const o=e<0,s=o?"-":t.signed?"+":"";o&&(e=-e);const a=(e=>{const{minimumFractionDigits:t,maximumFractionDigits:n}=e;if(void 0!==t||void 0!==n)return{...void 0!==t&&{minimumFractionDigits:t},...void 0!==n&&{maximumFractionDigits:n},roundingMode:"trunc"}})(t),c=t.binary?1024:1e3;let l=0;var u;if(e>=1&&(l=Math.min(Math.floor(t.binary?("number"==typeof(u=e)?Math.log(u):qn(u)*Math.log(10))/Math.log(c):qn(e)/3),n.length-1)),e=((e,t)=>{if("number"==typeof e)return e/t;const n=e/BigInt(t),r=e%BigInt(t);return Number(n)+Number(r)/t})(e,c**l),!a){const t=Math.max(3,Math.floor(e).toString().length);(e=Number(e.toPrecision(t)))>=c&&l<n.length-1&&(e/=c,l+=1)}const f=((e,t,n)=>{let r=e;return"string"==typeof t||Array.isArray(t)?r=e.toLocaleString(t,n):!0!==t&&void 0===n||(r=e.toLocaleString(void 0,n)),r})(e,t.locale,a);return Vn(s+f+r+n[l],t.fixedWidth)}const Zn=e=>"string"==typeof e?Zn(b(e).size):r.yellowBright(Wn(e));class Kn{#ne;get ora(){return this.#ne}set attachConsole(e){e?(console.log=this.info.bind(this),console.info=this.info.bind(this)):console=Jn}static Global(e){return Yn=new Kn(e),Yn}static Clone(e){const{prefixText:t}=e||Yn;return new Kn({prefixText:t})}static get Current(){return Yn}static set Current(e){Yn=e}constructor(e){this.#ne=j(e)}get prefixText(){return this.#ne.prefixText}info(...e){this.#ne.info(Xn(e))}succeed(...e){this.#ne.succeed(Xn(e))}start(...e){this.#ne.start(Xn(e))}fail(...e){this.#ne.fail(Xn(e))}warn(...e){this.#ne.warn(Xn(e))}clear(){this.#ne.clear()}stop(){this.#ne.stop()}stopAndPersist(...e){this.#ne.stopAndPersist(...e)}}let Yn=new Kn;const Xn=e=>e.length?e.join(" "):void 0,Jn=console;class Qn{spinner;debugMode;constructor(e,t){this.spinner=new Kn({prefixText:e}),this.debugMode=t?.debug??!1}start(...e){this.spinner.start(...e)}succeed(...e){this.spinner.succeed(...e)}fail(...e){this.spinner.fail(...e)}error(...e){console.log(...e)}warn(...e){this.spinner.warn(...e)}info(...e){this.spinner.info(...e)}log(...e){this.spinner.info(...e)}debug(...e){this.debugMode&&console.debug(...e)}startNativeConsoleCapture(){this.spinner.attachConsole=!0}stopNativeConsoleCapture(){this.spinner.attachConsole=!1}}const er=e=>{const t={spa:{templateEnv:(n=e.template,r=e.mock,{portal:{id:"@equinor/fusion-framework-dev-portal"},title:"Fusion Dev Portal",serviceDiscovery:{url:"/@fusion-services",scopes:["5a842df8-3238-415d-b168-9f16a6a6031b/.default"]},msal:{clientId:"9b707e3a-3e90-41ed-a47e-652a1e3b53d0",tenantId:"3aa4a235-b6e2-48d5-9195-7fcf05b459b0",redirectUri:"/authentication/login-callback",requiresAuth:"true",...r?{mock:"true"}:{}},serviceWorker:{resources:[{url:"/apps-proxy",rewrite:"/@fusion-api/apps",scopes:["5a842df8-3238-415d-b168-9f16a6a6031b/.default"]},{url:"/@fusion-api/apps",scopes:["5a842df8-3238-415d-b168-9f16a6a6031b/.default"]},{url:"/help-proxy",rewrite:"/@fusion-api/help",scopes:["5a842df8-3238-415d-b168-9f16a6a6031b/.default"]},{url:"/portal-proxy",rewrite:"/@fusion-api/portal-config",scopes:["5a842df8-3238-415d-b168-9f16a6a6031b/.default"]},{url:"/@fusion-api/portal-config",scopes:["5a842df8-3238-415d-b168-9f16a6a6031b/.default"]}]},...n})},api:{serviceDiscoveryUrl:e.mock?new URL("/@fusion-mock/discovery",e.mock).href:"https://discovery.fusion.equinor.com/service-registry/environments/ci/services/",processServices:(e,t)=>{const{data:n,routes:r}=H(e,t);return{data:n.concat({key:"portals",name:"Portal Service - MOCK",uri:"/@fusion-api/portals"}),routes:r}}}};var n,r;return e.app&&((e,t,n)=>{const{build:r,appKey:i}=t;if(!r)throw new Error("App manifest does not contain build information");e.api.routes??=[],e.api.routes.push({match:[`/apps/bundles/apps/${i}/${r.version}/*path`,`/apps/bundles/apps/${i}@${r.version}/*path`],middleware:async(e,t,n)=>{const r=e.params?.path;!1===Array.isArray(r)&&n(),t.writeHead(302,{"content-type":"application/javascript",location:`/${r.join("/")}`}),t.end()}}),e.api.routes.push({match:`/apps/persons/me/apps/${i}`,middleware:async(e,n)=>{n.writeHead(200,{"content-type":"application/json"}),n.end(JSON.stringify({id:"dev-server-generated-id",...t}))}}),e.api.routes.push({match:`/apps/apps/${i}/builds/${r.version}/config`,middleware:async(e,t)=>{t.writeHead(200,{"content-type":"application/json"}),t.end(JSON.stringify(n))}})})(t,e.app.manifest,e.app.config),e.portal&&((e,t,n)=>{e.api.routes??=[];const r="portal-config";e.api.routes.push({match:`/${r}/portals/${t.name}{@:tag}`,middleware:async(e,n)=>{n.writeHead(200,{"content-type":"application/json"}),n.end(JSON.stringify(t))}}),n&&e.api.routes.push({match:`/${r}/portals/${t.name}{@:tag}/config`,middleware:async(e,t)=>{t.writeHead(200,{"content-type":"application/json"}),t.end(JSON.stringify(n))}})})(t,e.portal.manifest,e.portal.config),t};const tr=e=>({portal:"object"==typeof e.spa?.templateEnv?e.spa.templateEnv.portal:void 0,msal:"object"==typeof e.spa?.templateEnv?e.spa.templateEnv.msal:void 0,proxy:"object"==typeof e.spa?.templateEnv?e.spa.templateEnv.serviceWorker?.resources:void 0,serviceDiscoveryUrl:e.api.serviceDiscoveryUrl,routes:e.api.routes}),nr=/\.mock\.(?:ts|mjs|js)$/;async function rr(e,t){const n=l(t),r=t.slice(0,-n.length),{config:i}=await S(r,{baseDir:e,extensions:[n]});return function(e,t){if(null===e||"object"!=typeof e||Array.isArray(e))throw new Error(`Expected "${t}" to default-export defineService({...}).`);const n=e;if("string"!=typeof n.key||!n.key)throw new Error(`Expected "${t}" to provide a non-empty service key.`);if(!1!==n.serviceDiscovery&&"merge"!==n.serviceDiscovery&&"new"!==n.serviceDiscovery&&"replace"!==n.serviceDiscovery)throw new Error(`Expected "${t}" to declare a valid serviceDiscovery mode.`);return n}(i,t)}const ir=async(e,t,n)=>{const{overrides:r,log:i}=n??{},o=er(t);i?.debug("\nBase dev server config:",tr(o)),i?.debug("\nCreating dev server with overrides:",r);let s,c=o;try{const t=await(async(e,t,n)=>S("dev-server.config",{baseDir:e.root,extensions:n?.extensions,script:{resolve:async n=>{let r;if("function"==typeof n.default){const i={...t};r=await n.default(e,{base:i})}else r=n.default;return ut(t,r??{})}}}))(e,o);c=t.config;const{path:n}=t;i?.debug(`\nLoaded dev server config from ${n}`),i?.debug("\nLoaded dev server config:",tr(c)),s=((e,t)=>({name:"fusion:dev-server-config-watcher",configureServer(n){n.watcher.add(e),n.watcher.on("change",r=>{r===e&&(t?.info(`\n${e} changed, restarting dev server...`),n.restart())}),t?.debug(`Watching dev-server.config.ts at: ${e}`)}}))(n,i)}catch(e){i?.warn("\nFailed to load dev server config:",e instanceof Error?e.message:String(e))}if(!t.mock){const t=a(e.root??process.cwd(),c.mockServer?.path??"mocks");c=function(e,t){const n=e.api.processServices??H,r=new Set(t.map(e=>e.key));return{...e,api:{...e.api,processServices(e,i){if(!Array.isArray(e))return n(e,i);const o=new Set(e.map(e=>e.key)),s=t.find(e=>"new"===e.serviceDiscovery&&o.has(e.key));if(s)throw new Error(`Mock service "${s.key}" is marked as new but already exists in upstream service discovery.`);const a=e.filter(e=>!r.has(e.key)),c=t.map(({serviceDiscovery:e,...t})=>t);return n([...a,...c],i)}}}}(c,await async function(e,t){let n;try{n=await B(e)}catch(e){if("ENOENT"===e.code)return[];throw e}const r=n.filter(e=>nr.test(e)).sort();return(await Promise.all(r.map(t=>rr(e,t)))).filter(e=>!1!==e.serviceDiscovery).map(e=>({key:e.key,name:`${e.key} mock`,uri:`http://${e.key}.localhost:${t}`,serviceDiscovery:e.serviceDiscovery}))}(t,c.mockServer?.port??4010))}const l=s?{...r,plugins:[...r?.plugins??[],s]}:r;return z(c,l)},or="fusion-framework-cli",sr={"X-Fusion-CLI-Name":or,"X-Fusion-CLI-Version":Bt,"User-Agent":`${or}/${Bt}`},ar={AUTH_DOCS_URL:"https://github.com/equinor/fusion-framework/blob/main/packages/cli/docs/auth.md",APP_DOCS_URL:"https://github.com/equinor/fusion-framework/blob/main/packages/cli/docs/application.md"};function cr(){if(process.env.FUSION_TOKEN)return[r.bold("ðĄ FUSION_TOKEN detected"),r.dim(" The CLI is using this token instead of your interactive login session."),r.dim(" If this is unintended, unset the variable and retry, or verify that the token has the correct scope/audience.")].join("\n")}const{AUTH_DOCS_URL:lr,APP_DOCS_URL:ur}=ar;function fr(e,t){switch(e){case 401:return function(e){const t=["",r.redBright(`ðŦ Authentication failed: unable to ${e}`),""," No valid token was provided or the token has expired.",""],n=cr();return n&&t.push(n,""),t.push(r.whiteBright(" Troubleshooting:"),"",` ${r.cyan("1.")} For CI/CD, verify that ${r.bold("FUSION_TOKEN")} is set and the token has not expired.`,` ${r.cyan("2.")} For local development, run ${r.greenBright.bold("ffc auth login")} to refresh your credentials.`,` ${r.cyan("3.")} Verify that ${r.bold("--scope")} targets the correct API audience for your environment.`,"",` ${r.dim("Auth docs:")} ${r.blueBright.underline(lr)}`,` ${r.dim("Publish docs:")} ${r.blueBright.underline(ur)}`,""),t.join("\n")}(t);case 403:return function(e){const t=["",r.redBright(`ðŦ Authorization failed: not permitted to ${e}`),"","â ïļ Your token is valid but does not have the required permissions for this operation.",""],n=cr();return n&&t.push(n,""),t.push(r.whiteBright(" Troubleshooting:"),"",` ${r.cyan("1.")} Verify that your user or service principal has publish permissions for this application.`,` ${r.cyan("2.")} Check that the token's ${r.bold("scope / audience")} matches the target environment.`,` ${r.cyan("3.")} Confirm that the application is registered and your account has the correct role assignment.`,"",` ${r.dim("Auth docs:")} ${r.blueBright.underline(lr)}`,` ${r.dim("Publish docs:")} ${r.blueBright.underline(ur)}`,""),t.join("\n")}(t);default:return}}const{AUTH_DOCS_URL:dr,APP_DOCS_URL:pr}=ar;function hr(e,t){if(!(e instanceof Error))return;const n="SilentTokenAcquisitionError"===e.name,i=e,o=i.response?i.response.status:void 0,s=401===o||403===o;let a=!1,c=e.cause;for(let e=0;e<5&&c&&c instanceof Error;e++){if("SilentTokenAcquisitionError"===c.name){a=!0;break}c=c.cause}if(!n&&!s&&!a)return;if(s&&!n&&!a)return fr(o,t);const l=function(e){let t=e;for(let e=0;e<5&&t;e++){if(!(t instanceof Error)){if("object"==typeof t&&"errorMessage"in t){const e=t.errorMessage;if("string"==typeof e){const t=e.match(/Description:\s*(.+?)(?:\s*Trace ID:|$)/);return t?.[1]?.trim()??e.split(" - ")[0]?.trim()}break}break}{const e=t;if("string"==typeof e.errorMessage){const t=e.errorMessage,n=t.match(/Description:\s*(.+?)(?:\s*Trace ID:|$)/);return n?.[1]?.trim()??t.split(" - ")[0]?.trim()}t=t.cause}}}(e),u=["",r.redBright(`ð Token acquisition failed: unable to ${t}`),"",r.yellow(`â ïļ ${l??"The CLI could not silently acquire an access token for this operation."}`),""],f=cr();return f&&u.push(f,""),u.push(r.whiteBright(" Troubleshooting:"),"",` ${r.cyan("1.")} Run ${r.greenBright.bold("ffc auth login")} to refresh your local credentials.`,` ${r.cyan("2.")} For CI/CD, set a fresh ${r.bold("FUSION_TOKEN")} â cached refresh tokens may have expired.`,` ${r.cyan("3.")} Verify that ${r.bold("--scope")} targets the correct API audience for your environment.`,"",` ${r.dim("Auth docs:")} ${r.blueBright.underline(dr)}`,` ${r.dim("Publish docs:")} ${r.blueBright.underline(pr)}`,""),u.join("\n")}const mr=(e,t,n)=>{const r=s(String(e));w(r)||L(r,{recursive:!0}),I(e,t,n)},gr=["package.json","LICENSE.md","README.md","CHANGELOG.md"],vr=async(e,t)=>{const{archive:n,log:i}=t??{},o=s(e.path),c=t?.buildDir??"dist",l=a(o,c);if(!(await M(l)).isDirectory())throw new Error(`Build directory ${c} does not exist`);i?.log(r.bold("Starting to pack bundle"));const u=new Mn;if(u.addLocalFolder(l,c),t?.content)for(const[e,n]of Object.entries(t.content))u.addFile(e,Buffer.from(n)),i?.info("ð",Vt(e,{relative:!0}));i?.info("ð",Vt(l,{relative:!0}));for(const t of gr.concat(e.packageJson.files??[])){const e=a(o,t),n=s(e.replace(o,""));at(e)?(u.addLocalFile(e,n),i?.info("ð",Vt(e,{relative:!0}))):i?.warn(r.dim("ð",Vt(e,{relative:!0})))}return n&&(at(s(n))||await G(s(n),{recursive:!0}),i?.start("compressing content"),await u.writeZipPromise(n),i?.succeed("ð",Vt(n,{relative:!0}),Zn(n))),u},yr=async e=>{const{log:t,manifest:n,snapshot:r}=e;process.env.NODE_ENV,process.cwd();const{pkg:i,manifest:o}=await Yt({log:t,manifest:n,snapshot:r});if(!o.build)throw new Error("Manifest build config not found");return{archive:await vr(i,{log:t,archive:e?.archive,content:{"app-manifest.json":JSON.stringify(o.build,null,2),"metadata.json":JSON.stringify({appKey:o.appKey,name:o.appKey,version:o.build.version})}}).catch(e=>{t?.error("Failed to create package:",e),process.exit(1)}),manifest:o}},Er=async(e,t)=>{const{log:n}=t;try{n?.start("create application configuration"),n?.info(`generating config with ${r.red.dim(e.command)} command in ${r.green.dim(e.mode)} mode`);const i=await((e,t)=>{const n=t?.file??[`app.config.${e.environment}`,"app.config"];return S(n,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async n=>{const r=t?.base??{environment:{}};if("function"==typeof n.default){const t=await n.default(e,{base:r})??r;return qt.parse(t??r)}return qt.parse(n.default??r)}}})})(e,{file:t?.config});return n?.succeed("âïļ generated config from ",Vt(i.path,{relative:!0})),i.config}catch(e){if(e instanceof C){if(!t.config)return n?.succeed(r.dim("âïļ no local application config applied, using built-in")),{environment:{},endpoints:{}};n?.warn(`failed to load config file ${Vt(t.config)}, please check the path.`)}throw n?.fail("failed to resolve application config"),n?.debug(e),e}},br=async e=>{const{log:t}=e??{};let n;try{t?.start("resolve project package"),n=await Zt(null),t?.succeed("ðĶ",r.yellowBright([n.packageJson.name,n.packageJson.version].join("@"))),t?.info("ð ",r.blueBright(n.root))}catch{t?.info("Failed to resolve project package, using current directory as root")}const i=n?.root??process.cwd(),o={command:"build",mode:process.env.NODE_ENV??"production",root:i,...e?.env},s=await Er(o,{log:t,config:e?.config});if(t?.debug("config:",s),e?.output){t?.start("writing config to file");try{await mr(e.output,JSON.stringify(s,null,2)),t?.succeed("config written successfully",Vt(e.output,{relative:!0}))}catch(e){throw t?.fail("failed to write config"),e}}return{config:s,pkg:n}};class wr extends Error{response;static Name="HttpResponseError";constructor(e,t,n){super(e,n),this.response=t}}class Lr extends wr{static Name="HttpJsonResponseError";data;constructor(e,t,n){super(e,t,n),this.name=Lr.Name,this.data=n?.data}}class Ir extends wr{static Name="ServerSentEventResponseError";constructor(e,t,n){super(e,t,n),this.name=Ir.Name}}class Sr extends Error{}const Cr=async e=>{const{log:t,config:n,appKey:r,buildVersion:i,framework:o}=e;try{const e=await o.serviceDiscovery.createClient("apps");e.request$.subscribe(e=>{t?.debug("Request:",e),t?.info("ð","Executing request to:",Vt(e.uri))}),t?.start("Publishing application config");const s=await e.json(`/apps/${r}/builds/${i}/config`,{method:"PUT",body:n,headers:sr});t?.debug("Response:",s),t?.succeed("Published application config")}catch(e){if(e instanceof Lr)switch(e.response.status){case 410:t?.fail("ðĪŽ",`App ${r} is deleted from apps-service. Please check the app key and try again.`);break;case 404:t?.fail("ðĪŽ",`App ${r} not found. Please check the app key and try again.`);break;case 403:case 401:{const n=fr(e.response.status,`publish config for ${r}`);t?.fail("ð","Authentication/authorization error publishing app config."),n&&t?.error(n),process.exit(1);break}default:t?.fail("ðĪŽ","Failed to publish application config.",`Status code: ${e.response.status}`,`Message: ${e.response.statusText}`)}const n=hr(e,`publish config for ${r}`);n&&(t?.fail("ð",`Token acquisition failed publishing config for ${r}`),t?.error(n),process.exit(1)),t?.fail("ðĪŽ","Failed to publish app config:",e instanceof Error?e.message:String(e)),process.exit(1)}},_r=async e=>{const{log:n}=e??{},r="@equinor/fusion-framework-dev-portal",i=await Zt(n),o={root:i.root,environment:"local",...e?.env,mode:"development",command:"serve"},a=await Wt(o,i,{log:n,manifestPath:e?.manifest}),c=await Er(o,{log:n,config:e?.config});let l,u;const d=p(import.meta.resolve(r));at(d)?(l=d,u=await f({cwd:d}).then(e=>e?s(e?.path):void 0)):n?.info(`Portal ${r} is external, skipping entry point resolution`);const h=await Rt(o,i),m=u?[i.root,u]:[i.root];n?.debug(`File system access allowed for: \n${m.join("\n")}\n`);const g=t(h,{server:{port:e?.port||3e3,host:e?.host||h.server?.host||"localhost",fs:{allow:m}}}),v={template:{portal:{id:r}},app:{manifest:a,config:c},mock:e?.mock};l&&(v.portal={manifest:{name:r,build:{templateEntry:l,assetPath:"/@fs"}},config:{}}),n?.debug("vite config:",g),n?.debug("dev server config:",v),n?.start("Starting app development server...");const y=await ir(o,v,{overrides:g,log:n});await y.listen(),n?.succeed("App development server started successfully");const E=y.config.server.https?"https":"http",b=y.config.server.host||"localhost",w=y.config.server.port||5173;return n?.info(`App development server is running at: ${E}://${b}:${w}/apps/${a.appKey}`),y},Dr=async e=>{const{log:n,dir:r,port:i=4173,host:o="localhost"}=e??{};n?.log("Starting to serve application");const c="@equinor/fusion-framework-dev-portal",l=await Zt(n);n?.start("Loading Vite config...");const u=await Rt({root:l.root,command:"build",mode:"production"},l);n?.succeed("Vite config loaded");const d=r||(u.build?.outDir||"dist"),h=a(l.root,d),m={root:l.root,environment:"local",mode:"production",command:"serve",isPreview:!0},g=await Wt(m,l,{log:n,manifestPath:e?.manifest}),v=await Er(m,{log:n,config:e?.config});if(n?.debug("Output directory:",h),!w(h))throw new Error(`Build directory does not exist: ${h}\nPlease build the application first using \`ffc app build\``);let y,E;const b=p(import.meta.resolve(c));at(b)?(y=b,E=await f({cwd:b}).then(e=>e?s(e?.path):void 0)):n?.info(`Portal ${c} is external, skipping entry point resolution`);const L=await Rt(m,l),I=E?[l.root,E,h]:[l.root,h];n?.debug(`File system access allowed for: \n${I.join("\n")}\n`);const S=t(L,{server:{port:i,host:o||L.server?.host||"localhost",fs:{allow:I}}}),C={template:{portal:{id:c}},app:{manifest:g,config:v},mock:e?.mock};y&&(C.portal={manifest:{name:c,build:{templateEntry:y,assetPath:"/@fs"}},config:{}}),n?.debug("vite config:",S),n?.debug("dev server config:",C),n?.start("Starting preview server with dev-portal...");try{const e=await ir(m,C,{overrides:S,log:n});await e.listen(),n?.succeed("Preview server started successfully");const t=e.config.server?.https?"https":"http",r=e.config.server?.host||o,s=e.config.server?.port||i;return n?.info(`Preview server is running at: ${t}://${r}:${s}`),g.appKey&&n?.info(`App URL: ${t}://${r}:${s}/apps/${g.appKey}`),e}catch(e){throw n?.fail("Failed to start preview server"),e}};class Pr extends A{satisfies(e){return $(this,e)}}var Nr=function(e,t){return Nr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Nr(e,t)};function Or(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Nr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Ar=function(){return Ar=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ar.apply(this,arguments)};function $r(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}c((r=r.apply(e,t||[])).next())})}function Rr(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function xr(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Tr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function kr(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function Fr(e){return this instanceof Fr?(this.v=e,this):new Fr(e)}function Ur(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",function(e){return function(t){return Promise.resolve(t).then(e,l)}}),r[Symbol.asyncIterator]=function(){return this},r;function s(e,t){i[e]&&(r[e]=function(t){return new Promise(function(n,r){o.push([e,t,n,r])>1||a(e,t)})},t&&(r[e]=t(r[e])))}function a(e,t){try{(n=i[e](t)).value instanceof Fr?Promise.resolve(n.value.v).then(c,l):u(o[0][2],n)}catch(e){u(o[0][3],e)}var n}function c(e){a("next",e)}function l(e){a("throw",e)}function u(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function Br(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=xr(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,i){(function(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)})(r,i,(t=e[n](t)).done,t.value)})}}}function Mr(e){return"function"==typeof e}function Gr(e){var t=e(function(e){Error.call(e),e.stack=(new Error).stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}"function"==typeof SuppressedError&&SuppressedError;var jr=Gr(function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(e,t){return t+1+") "+e.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}});function Hr(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var zr=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var s=xr(o),a=s.next();!a.done;a=s.next()){a.value.remove(this)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else o.remove(this);var c=this.initialTeardown;if(Mr(c))try{c()}catch(e){i=e instanceof jr?e.errors:[e]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var u=xr(l),f=u.next();!f.done;f=u.next()){var d=f.value;try{Wr(d)}catch(e){i=null!=i?i:[],e instanceof jr?i=kr(kr([],Tr(i)),Tr(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}if(i)throw new jr(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)Wr(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Hr(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&Hr(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),qr=zr.EMPTY;function Vr(e){return e instanceof zr||e&&"closed"in e&&Mr(e.remove)&&Mr(e.add)&&Mr(e.unsubscribe)}function Wr(e){Mr(e)?e():e.unsubscribe()}var Zr={Promise:void 0},Kr=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,kr([e,t],Tr(n)))};function Yr(e){Kr(function(){throw e})}function Xr(){}function Jr(e){e()}var Qr=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,Vr(t)&&t.add(n)):n.destination=ri,n}return Or(t,e),t.create=function(e,t,n){return new ti(e,t,n)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(zr),ei=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){ni(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){ni(e)}else ni(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){ni(e)}},e}(),ti=function(e){function t(t,n,r){var i,o=e.call(this)||this;return i=Mr(t)||!t?{next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:t,o.destination=new ei(i),o}return Or(t,e),t}(Qr);function ni(e){Yr(e)}var ri={closed:!0,next:Xr,error:function(e){throw e},complete:Xr},ii="function"==typeof Symbol&&Symbol.observable||"@@observable";function oi(e){return e}var si=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r,i=this,o=(r=e)&&r instanceof Qr||function(e){return e&&Mr(e.next)&&Mr(e.error)&&Mr(e.complete)}(r)&&Vr(r)?e:new ti(e,t,n);return Jr(function(){var e=i,t=e.operator,n=e.source;o.add(t?t.call(o,n):n?i._subscribe(o):i._trySubscribe(o))}),o},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=ai(t))(function(t,r){var i=new ti({next:function(t){try{e(t)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t});n.subscribe(i)})},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[ii]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(0===(e=t).length?oi:1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=ai(e))(function(e,n){var r;t.subscribe(function(e){return r=e},function(e){return n(e)},function(){return e(r)})})},e.create=function(t){return new e(t)},e}();function ai(e){var t;return null!==(t=null!=e?e:Zr.Promise)&&void 0!==t?t:Promise}function ci(e){return function(t){if(function(e){return Mr(null==e?void 0:e.lift)}(t))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw new TypeError("Unable to lift unknown Observable type")}}function li(e,t,n,r,i){return new ui(e,t,n,r,i)}var ui=function(e){function t(t,n,r,i,o,s){var a=e.call(this,t)||this;return a.onFinalize=o,a.shouldUnsubscribe=s,a._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return Or(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(Qr),fi=Gr(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),di=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return Or(t,e),t.prototype.lift=function(e){var t=new pi(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new fi},t.prototype.next=function(e){var t=this;Jr(function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=xr(t.currentObservers),o=i.next();!o.done;o=i.next()){o.value.next(e)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}})},t.prototype.error=function(e){var t=this;Jr(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}})},t.prototype.complete=function(){var e=this;Jr(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,i=n.isStopped,o=n.observers;return r||i?qr:(this.currentObservers=null,o.push(e),new zr(function(){t.currentObservers=null,Hr(o,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},t.prototype.asObservable=function(){var e=new si;return e.source=this,e},t.create=function(e,t){return new pi(e,t)},t}(si),pi=function(e){function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return Or(t,e),t.prototype.next=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===n||n.call(t,e)},t.prototype.error=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===n||n.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,n;return null!==(n=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==n?n:qr},t}(di),hi=function(e){function t(t){var n=e.call(this)||this;return n._value=t,n}return Or(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},t.prototype.getValue=function(){var e=this,t=e.hasError,n=e.thrownError,r=e._value;if(t)throw n;return this._throwIfClosed(),r},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(di),mi={now:function(){return(mi.delegate||Date).now()},delegate:void 0},gi=function(e){function t(t,n,r){void 0===t&&(t=1/0),void 0===n&&(n=1/0),void 0===r&&(r=mi);var i=e.call(this)||this;return i._bufferSize=t,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,n),i}return Or(t,e),t.prototype.next=function(t){var n=this,r=n.isStopped,i=n._buffer,o=n._infiniteTimeWindow,s=n._timestampProvider,a=n._windowTime;r||(i.push(t),!o&&i.push(s.now()+a)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),n=this._infiniteTimeWindow,r=this._buffer.slice(),i=0;i<r.length&&!e.closed;i+=n?1:2)e.next(r[i]);return this._checkFinalizedStatuses(e),t},t.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,n=e._timestampProvider,r=e._buffer,i=e._infiniteTimeWindow,o=(i?1:2)*t;if(t<1/0&&o<r.length&&r.splice(0,r.length-o),!i){for(var s=n.now(),a=0,c=1;c<r.length&&r[c]<=s;c+=2)a=c;a&&r.splice(0,a+1)}},t}(di),vi=function(e){function t(t,n){return e.call(this)||this}return Or(t,e),t.prototype.schedule=function(e,t){return this},t}(zr),yi=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,kr([e,t],Tr(n)))},Ei=function(e){return clearInterval(e)},bi=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return Or(t,e),t.prototype.schedule=function(e,t){var n;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var r=this.id,i=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(i,r,t)),this.pending=!0,this.delay=t,this.id=null!==(n=this.id)&&void 0!==n?n:this.requestAsyncId(i,this.id,t),this},t.prototype.requestAsyncId=function(e,t,n){return void 0===n&&(n=0),yi(e.flush.bind(e,this),n)},t.prototype.recycleAsyncId=function(e,t,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return t;null!=t&&Ei(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(e,t);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var n,r=!1;try{this.work(e)}catch(e){r=!0,n=e||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Hr(r,this),null!=t&&(this.id=this.recycleAsyncId(n,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(vi),wi=function(){function e(t,n){void 0===n&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(e,t,n){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},e.now=mi.now,e}(),Li=function(e){function t(t,n){void 0===n&&(n=wi.now);var r=e.call(this,t,n)||this;return r.actions=[],r._active=!1,r}return Or(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var n;this._active=!0;do{if(n=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}}},t}(wi),Ii=new Li(bi),Si=Ii,Ci=new si(function(e){return e.complete()});function _i(e){return e&&Mr(e.schedule)}function Di(e){return e[e.length-1]}var Pi=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function Ni(e){return Mr(null==e?void 0:e.then)}function Oi(e){return Mr(e[ii])}function Ai(e){return Symbol.asyncIterator&&Mr(null==e?void 0:e[Symbol.asyncIterator])}function $i(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var Ri="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function xi(e){return Mr(null==e?void 0:e[Ri])}function Ti(e){return Ur(this,arguments,function(){var t,n,r;return Rr(this,function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,Fr(t.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,Fr(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,Fr(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function ki(e){return Mr(null==e?void 0:e.getReader)}function Fi(e){if(e instanceof si)return e;if(null!=e){if(Oi(e))return i=e,new si(function(e){var t=i[ii]();if(Mr(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(Pi(e))return r=e,new si(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()});if(Ni(e))return n=e,new si(function(e){n.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,Yr)});if(Ai(e))return Ui(e);if(xi(e))return t=e,new si(function(e){var n,r;try{for(var i=xr(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.next(s),e.closed)return}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()});if(ki(e))return Ui(Ti(e))}var t,n,r,i;throw $i(e)}function Ui(e){return new si(function(t){(function(e,t){var n,r,i,o;return $r(this,void 0,void 0,function(){var s,a;return Rr(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=Br(e),c.label=1;case 1:return[4,n.next()];case 2:if((r=c.sent()).done)return[3,4];if(s=r.value,t.next(s),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),i={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})})(e,t).catch(function(e){return t.error(e)})})}function Bi(e,t,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var o=t.schedule(function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(o),!i)return o}function Mi(e,t){return void 0===t&&(t=0),ci(function(n,r){n.subscribe(li(r,function(n){return Bi(r,e,function(){return r.next(n)},t)},function(){return Bi(r,e,function(){return r.complete()},t)},function(n){return Bi(r,e,function(){return r.error(n)},t)}))})}function Gi(e,t){return void 0===t&&(t=0),ci(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}function ji(e,t){if(!e)throw new Error("Iterable cannot be null");return new si(function(n){Bi(n,t,function(){var r=e[Symbol.asyncIterator]();Bi(n,t,function(){r.next().then(function(e){e.done?n.complete():n.next(e.value)})},0,!0)})})}function Hi(e,t){if(null!=e){if(Oi(e))return function(e,t){return Fi(e).pipe(Gi(t),Mi(t))}(e,t);if(Pi(e))return function(e,t){return new si(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}(e,t);if(Ni(e))return function(e,t){return Fi(e).pipe(Gi(t),Mi(t))}(e,t);if(Ai(e))return ji(e,t);if(xi(e))return function(e,t){return new si(function(n){var r;return Bi(n,t,function(){r=e[Ri](),Bi(n,t,function(){var e,t,i;try{t=(e=r.next()).value,i=e.done}catch(e){return void n.error(e)}i?n.complete():n.next(t)},0,!0)}),function(){return Mr(null==r?void 0:r.return)&&r.return()}})}(e,t);if(ki(e))return function(e,t){return ji(Ti(e),t)}(e,t)}throw $i(e)}function zi(e,t){return t?Hi(e,t):Fi(e)}function qi(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=function(e){return _i(Di(e))?e.pop():void 0}(e);return zi(e,n)}var Vi=Gr(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function Wi(e,t){var n="object"==typeof t;return new Promise(function(r,i){var o,s=!1;e.subscribe({next:function(e){o=e,s=!0},error:i,complete:function(){s?r(o):n?r(t.defaultValue):i(new Vi)}})})}function Zi(e,t){var n="object"==typeof t;return new Promise(function(r,i){var o=new ti({next:function(e){r(e),o.unsubscribe()},error:i,complete:function(){n?r(t.defaultValue):i(new Vi)}});e.subscribe(o)})}function Ki(e){return e instanceof Date&&!isNaN(e)}var Yi=Gr(function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}});function Xi(e){throw new Yi(e)}function Ji(e,t){return ci(function(n,r){var i=0;n.subscribe(li(r,function(n){r.next(e.call(t,n,i++))}))})}var Qi=Array.isArray;function eo(e){return Ji(function(t){return function(e,t){return Qi(t)?e.apply(void 0,kr([],Tr(t))):e(t)}(e,t)})}function to(e,t,n,r,i,o,s,a){var c=[],l=0,u=0,f=!1,d=function(){!f||c.length||l||t.complete()},p=function(e){return l<r?h(e):c.push(e)},h=function(e){o&&t.next(e),l++;var a=!1;Fi(n(e,u++)).subscribe(li(t,function(e){null==i||i(e),o?p(e):t.next(e)},function(){a=!0},void 0,function(){if(a)try{l--;for(var e=function(){var e=c.shift();s||h(e)};c.length&&l<r;)e();d()}catch(e){t.error(e)}}))};return e.subscribe(li(t,p,function(){f=!0,d()})),function(){null==a||a()}}function no(e,t,n){return void 0===n&&(n=1/0),Mr(t)?no(function(n,r){return Ji(function(e,i){return t(n,e,r,i)})(Fi(e(n,r)))},n):("number"==typeof t&&(n=t),ci(function(t,r){return to(t,r,e,n)}))}var ro=["addListener","removeListener"],io=["addEventListener","removeEventListener"],oo=["on","off"];function so(e,t,n,r){if(Mr(n)&&(r=n,n=void 0),r)return so(e,t,n).pipe(eo(r));var i=Tr(function(e){return Mr(e.addEventListener)&&Mr(e.removeEventListener)}(e)?io.map(function(r){return function(i){return e[r](t,i,n)}}):function(e){return Mr(e.addListener)&&Mr(e.removeListener)}(e)?ro.map(ao(e,t)):function(e){return Mr(e.on)&&Mr(e.off)}(e)?oo.map(ao(e,t)):[],2),o=i[0],s=i[1];if(!o&&Pi(e))return no(function(e){return so(e,t,n)})(Fi(e));if(!o)throw new TypeError("Invalid event target");return new si(function(e){var t=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.next(1<t.length?t:t[0])};return o(t),function(){return s(t)}})}function ao(e,t){return function(n){return function(r){return e[n](t,r)}}}function co(e,t,n){void 0===e&&(e=0),void 0===n&&(n=Si);var r=-1;return null!=t&&(_i(t)?n=t:r=t),new si(function(t){var i=Ki(e)?+e-n.now():e;i<0&&(i=0);var o=0;return n.schedule(function(){t.closed||(t.next(o++),0<=r?this.schedule(void 0,r):t.complete())},i)})}function lo(e,t){return ci(function(n,r){var i=0;n.subscribe(li(r,function(n){return e.call(t,n,i++)&&r.next(n)}))})}function uo(e){return ci(function(t,n){var r,i=null,o=!1;i=t.subscribe(li(n,void 0,void 0,function(s){r=Fi(e(s,uo(e)(t))),i?(i.unsubscribe(),i=null,r.subscribe(n)):o=!0})),o&&(i.unsubscribe(),i=null,r.subscribe(n))})}function fo(e,t,n,r,i){return function(o,s){var a=n,c=t,l=0;o.subscribe(li(s,function(t){var n=l++;c=a?e(c,t,n):(a=!0,t),r&&s.next(c)},i&&function(){a&&s.next(c),s.complete()}))}}function po(e,t){return ci(fo(e,t,arguments.length>=2,!1,!0))}function ho(e){return ci(function(t,n){var r=!1;t.subscribe(li(n,function(e){r=!0,n.next(e)},function(){r||n.next(e),n.complete()}))})}function mo(e,t){return void 0===t&&(t=oi),e=null!=e?e:go,ci(function(n,r){var i,o=!0;n.subscribe(li(r,function(n){var s=t(n);!o&&e(i,s)||(o=!1,i=s,r.next(n))}))})}function go(e,t){return e===t}function vo(e){return void 0===e&&(e=yo),ci(function(t,n){var r=!1;t.subscribe(li(n,function(e){r=!0,n.next(e)},function(){return r?n.complete():n.error(e())}))})}function yo(){return new Vi}function Eo(e){return ci(function(t,n){try{t.subscribe(n)}finally{n.add(e)}})}function bo(e,t){var n=arguments.length>=2;return function(e){return e.pipe(oi,(r=1)<=0?function(){return Ci}:ci(function(e,t){var n=[];e.subscribe(li(t,function(e){n.push(e),r<n.length&&n.shift()},function(){var e,r;try{for(var i=xr(n),o=i.next();!o.done;o=i.next()){var s=o.value;t.next(s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}t.complete()},void 0,function(){n=null}))}),n?ho(t):vo(function(){return new Vi}));var r}}function wo(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!0!==t){if(!1!==t){var i=new ti({next:function(){i.unsubscribe(),e()}});return Fi(t.apply(void 0,kr([],Tr(n)))).subscribe(i)}}else e()}function Lo(e,t){return ci(function(n,r){var i=null,o=0,s=!1,a=function(){return s&&!i&&r.complete()};n.subscribe(li(r,function(n){null==i||i.unsubscribe();var s=0,c=o++;Fi(e(n,c)).subscribe(i=li(r,function(e){return r.next(t?t(n,e,c,s++):e)},function(){i=null,a()}))},function(){s=!0,a()}))})}function Io(e){return ci(function(t,n){Fi(e).subscribe(li(n,function(){return n.complete()},Xr)),!n.closed&&t.subscribe(n)})}function So(e,t,n){var r=Mr(e)||t||n?{next:e,error:t,complete:n}:e;return r?ci(function(e,t){var n;null===(n=r.subscribe)||void 0===n||n.call(r);var i=!0;e.subscribe(li(t,function(e){var n;null===(n=r.next)||void 0===n||n.call(r,e),t.next(e)},function(){var e;i=!1,null===(e=r.complete)||void 0===e||e.call(r),t.complete()},function(e){var n;i=!1,null===(n=r.error)||void 0===n||n.call(r,e),t.error(e)},function(){var e,t;i&&(null===(e=r.unsubscribe)||void 0===e||e.call(r)),null===(t=r.finalize)||void 0===t||t.call(r)}))}):oi}function Co(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n,r=Mr(Di(n=e))?n.pop():void 0;return ci(function(t,n){for(var i=e.length,o=new Array(i),s=e.map(function(){return!1}),a=!1,c=function(t){Fi(e[t]).subscribe(li(n,function(e){o[t]=e,a||s[t]||(s[t]=!0,(a=s.every(oi))&&(s=null))},Xr))},l=0;l<i;l++)c(l);t.subscribe(li(n,function(e){if(a){var t=kr([e],Tr(o));n.next(r?r.apply(void 0,kr([],Tr(t))):t)}}))})}const _o=(e,t,n)=>{const r="string"==typeof t?t.split("."):t,i=r.shift();return i&&(e[i]??={},r.length?_o(e[i],r,n):Object.assign(e,{[i]:n})),e};class Do{#re={};createConfig(e,t){return zi(this._createConfig(e,t))}async createConfigAsync(e,t){return Wi(this.createConfig(e,t))}_set(e,t){const n="function"==typeof t?t:async()=>t;this.#re[e]=n}_get(e){return this.#re[e]}_has(e){return e in this.#re}_createConfig(e,t){return zi(this._buildConfig(e,t)).pipe(Lo(t=>this._processConfig(t,e)))}_buildConfig(e,t){return zi(Object.entries(this.#re)).pipe(no(([t,n])=>zi(n(e)).pipe(lo(e=>void 0!==e),Ji(e=>({target:t,value:e})),uo(e=>(console.error(`Failed to execute config callback: ${n.name} for attribute: '${t}'`,e),Ci)))),po((e,{target:t,value:n})=>_o(e,t,n),t??{}))}_processConfig(e,t){return qi(e)}}class Po extends Error{constructor(){super("Module initialization timed out"),this.name="RequiredModuleTimeoutError"}}const No="ModuleConfigurator",Oo={ModuleConfigAdded:`${No}.module.configAdded`,OnConfiguredAdded:`${No}.onConfigured.added`,OnInitializedAdded:`${No}.onInitialized.added`,PluginAdded:`${No}.plugin.added`,InitializeConfigLoaded:`${No}.config.loaded`,InitializeInstanceInitialized:`${No}.instance.initialized`,Initialize:`${No}.initialize.complete`,ConfiguratorCreated:`${No}.configurator.created`,ConfiguratorFailed:`${No}.configurator.failed`,ModulePostConfigured:`${No}.module.postConfigured`,ModulePostConfigureError:`${No}.module.postConfigureError`,PostConfigureHooks:`${No}.postConfigureHooks.started`,PostConfigureHooksComplete:`${No}.postConfigureHooks.complete`,PostConfigureHooksError:`${No}.postConfigureHooks.error`,ModuleInitializeError:`${No}.module.initializeError`,ModuleInitializing:`${No}.module.initializing`,ProviderNotBaseModuleProvider:`${No}.provider.invalidBase`,ProviderVersionWarning:`${No}.provider.versionMissing`,ModuleInitialized:`${No}.module.initialized`,RequireInstanceModuleNotDefined:`${No}.requireInstance.moduleNotDefined`,RequireInstanceModuleAlreadyInitialized:`${No}.requireInstance.moduleAlreadyInitialized`,RequireInstanceAwaitingModule:`${No}.requireInstance.awaitingModule`,RequireInstanceTimeout:`${No}.requireInstance.timeout`,RequireInstanceModuleResolved:`${No}.requireInstance.moduleResolved`,ModuleInitializeComplete:`${No}.modules.initializeComplete`,InitializeComplete:`${No}.initialize.instanceComplete`,ConfiguratorPostInitializeStart:`${No}.postInitialize.started`,ModulePostInitializeStart:`${No}.modulePostInitialize.started`,ModulePostInitializeComplete:`${No}.modulePostInitialize.complete`,ModulePostInitializeError:`${No}.modulePostInitialize.error`,PostInitializeComplete:`${No}.postInitialize.complete`,PostInitializeCompleteNoHooks:`${No}.postInitialize.noHooks`,PostInitializeHooks:`${No}.postInitializeHooks.started`,PostInitializeHooksComplete:`${No}.postInitializeHooks.complete`,PostInitializeHooksError:`${No}.postInitializeHooks.error`,PluginsRegister:`${No}.plugins.registering`,PluginRegistered:`${No}.plugin.registered`,PluginRegisterError:`${No}.plugin.registerError`,PluginsRegistered:`${No}.plugins.registered`,Dispose:`${No}.dispose.started`,PluginsDisposing:`${No}.plugins.disposing`,PluginDisposed:`${No}.plugin.disposed`,PluginDisposeError:`${No}.plugin.disposeError`,ModulesDispose:`${No}.modules.disposing`,ModuleDisposed:`${No}.module.disposed`,ModuleDisposeError:`${No}.module.disposeError`,ModulesDisposed:`${No}.modules.disposed`};var Ao;async function $o(e,t){const n=await async function(e,t){const{modules:n,afterConfiguration:r,afterInit:i,registerEvent:o}=e;return Wi(zi(n).pipe(no(async e=>{const n=performance.now();try{const r=await(e.configure?.(t)),i=Math.round(performance.now()-n);return o({level:Ao.Debug,name:Oo.ConfiguratorCreated,message:`Configurator created for ${e.name} in ${i}ms`,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown",configLoadTime:i},metric:i}),{[e.name]:r}}catch(t){throw o({level:Ao.Error,name:Oo.ConfiguratorFailed,message:`Failed to create configurator for ${e.name}`,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown"},metric:Math.round(performance.now()-n),error:t}),t}}),po((e,t)=>Object.assign(e,t),{onAfterConfiguration(e){r.push(e)},onAfterInit(e){i.push(e)}})))}(e,t);return await Promise.all(e.configs.map(e=>Promise.resolve(e(n,t)))),await async function(e,t){const{modules:n,afterConfiguration:r,registerEvent:i}=e;if(await Promise.allSettled(n.filter(e=>!!e.postConfigure).map(async e=>{try{const n=performance.now();await(e.postConfigure?.(t)),i({level:Ao.Debug,name:Oo.ModulePostConfigured,message:`Module ${e.name} post-configured successfully`,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown",postConfigTime:Math.round(performance.now()-n)}})}catch(t){i({level:Ao.Warning,name:Oo.ModulePostConfigureError,message:`Module ${e.name} post-configure failed`,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown"},error:t})}})),r.length)try{i({level:Ao.Debug,name:Oo.PostConfigureHooks,message:`Post configure hooks [${r.length}] called`});const e=performance.now();await Promise.allSettled(r.map(e=>Promise.resolve(e(t))));const n=Math.round(performance.now()-e);i({level:Ao.Debug,name:Oo.PostConfigureHooksComplete,message:"Post configure hooks complete",properties:{count:r.length,postConfigHooksTime:n},metric:n})}catch(e){i({level:Ao.Warning,name:Oo.PostConfigureHooksError,message:"Post configure hook failed",error:e})}}(e,n),n}!function(e){e[e.Debug=0]="Debug",e[e.Information=1]="Information",e[e.Warning=2]="Warning",e[e.Error=3]="Error",e[e.Critical=4]="Critical"}(Ao||(Ao={}));class Ro{static[Symbol.hasInstance](e){if(null!==e&&"object"==typeof e&&"version"in e&&"dispose"in e){const t=e,n=O(String(t.version)),r=t.dispose;return!!n&&"function"==typeof r}return!1}#ie;#oe;get version(){return this.#ie}constructor(e){const{version:t}=e;this.#ie=new Pr(t),this.#oe=new zr}_addTeardown(e){return this.#oe.add(e),()=>this.#oe.remove(e)}dispose(){this.#oe.unsubscribe()}}function xo(e,t,n){return function(r,i=60){if(!e.includes(r)){const e=new Error(`Cannot require [${String(r)}] since module is not defined!`);throw e.name="ModuleNotDefinedError",n({level:Ao.Error,name:Oo.RequireInstanceModuleNotDefined,message:e.message,properties:{moduleName:String(r),wait:i},error:e}),e}if(t.value[r])return n({level:Ao.Debug,name:Oo.RequireInstanceModuleAlreadyInitialized,message:`Module [${String(r)}] is already initialized, skipping queue`,properties:{moduleName:String(r),wait:i}}),Promise.resolve(t.value[r]);const o=performance.now();return n({level:Ao.Debug,name:Oo.RequireInstanceAwaitingModule,message:`Awaiting module [${String(r)}] initialization, timeout ${i}s`,properties:{moduleName:String(r),wait:i}}),Zi(t.pipe(lo(e=>!!e[r]),Ji(e=>e[r]),function(e){var t=Ki(e)?{first:e}:"number"==typeof e?{each:e}:e,n=t.first,r=t.each,i=t.with,o=void 0===i?Xi:i,s=t.scheduler,a=void 0===s?Ii:s,c=t.meta,l=void 0===c?null:c;if(null==n&&null==r)throw new TypeError("No timeout provided.");return ci(function(e,t){var i,s,c=null,u=0,f=function(e){s=Bi(t,a,function(){try{i.unsubscribe(),Fi(o({meta:l,lastValue:c,seen:u})).subscribe(t)}catch(e){t.error(e)}},e)};i=e.subscribe(li(t,function(e){null==s||s.unsubscribe(),u++,t.next(c=e),r>0&&f(r)},void 0,void 0,function(){(null==s?void 0:s.closed)||null==s||s.unsubscribe(),c=null})),!u&&f(null!=n?"number"==typeof n?n:+n-a.now():r)})}({each:1e3*i,with:()=>{return t=Mr(e=()=>{const e=new Po;return n({level:Ao.Error,name:Oo.RequireInstanceTimeout,message:`Module [${String(r)}] initialization timed out after ${i}s`,properties:{moduleName:String(r),wait:i},error:e}),e})?e:function(){return e},new si(function(e){return e.error(t())});var e,t}}),So(()=>{const e=Math.round(performance.now()-o);n({level:Ao.Debug,name:Oo.RequireInstanceModuleResolved,message:`Module [${String(r)}] required in ${e}ms`,properties:{moduleName:String(r),wait:i,requireTime:e},metric:e})})))}}async function To(e,t,n){const{modules:r,registerEvent:i}=e;if(0===r.length)return Object.seal({});const o=r.map(e=>e.name),s=new hi({}),a=e=>o.includes(e),c=xo(o,s,i),l=zi(r).pipe(no(e=>async function(e,t){const{config:n,ref:r,requireInstance:i,hasModule:o,registerEvent:s}=t,a=e.name;if(!e.initialize){const t=new Error(`Module ${e.name} does not have initialize method`);throw t.name="ModuleInitializeError",s({level:Ao.Error,name:Oo.ModuleInitializeError,message:t.message,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown"},error:t}),t}s({level:Ao.Debug,name:Oo.ModuleInitializing,message:`Initializing module ${e.name}`,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown"}});const c=performance.now(),l=await e.initialize({ref:r,config:n[a],requireInstance:i,hasModule:o});l instanceof Ro||s({level:Ao.Warning,name:Oo.ProviderNotBaseModuleProvider,message:`Provider for module ${e.name} does not extend BaseModuleProvider`,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown"}});const u=l;u.version||s({level:Ao.Warning,name:Oo.ProviderVersionWarning,message:`Provider for module ${e.name} does not expose version`,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown"}});const f=Math.round(performance.now()-c);return s({level:Ao.Debug,name:Oo.ModuleInitialized,message:`Module ${e.name} initialized in ${f}ms`,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown",providerName:typeof l,providerVersion:u.version?.toString()||"unknown",moduleInitTime:f},metric:f}),[a,l]}(e,{config:t,ref:n,requireInstance:c,hasModule:a,registerEvent:i}))),u=performance.now();l.subscribe({next:([e,t])=>{const n=Object.assign(s.value,{[e]:t});s.next(n)},error:e=>{i({level:Ao.Error,name:Oo.ModuleInitializeError,message:`Failed to initialize module ${e.name||"unknown"}`,error:e}),s.error(e)},complete:()=>{const e=Math.round(performance.now()-u);i({level:Ao.Debug,name:Oo.ModuleInitializeComplete,message:`All modules initialized in ${e}ms`,properties:{modules:Object.keys(s.value).join(", "),loadTime:e},metric:e}),s.complete()}});const f=performance.now(),d=await Wi(s),p=Math.round(performance.now()-f);return i({level:Ao.Debug,name:Oo.InitializeComplete,message:`Modules instance created in ${p}ms`,properties:{modules:Object.keys(d).join(", "),initTime:p},metric:p}),Object.seal(d),d}function ko(e){return"function"==typeof e?e.name||"anonymous":"dispose"}async function Fo(e){"function"!=typeof e?await e.dispose():await e()}class Uo{static className="ModulesConfigurator";get version(){return"6.1.4"}#se=new gi(100);get event$(){return this.#se.asObservable()}_configs=[];_afterConfiguration=[];_afterInit=[];_plugins=[];_pluginTeardowns=[];_modules;constructor(e){this._modules=new Set(e?this._dedupeModulesByName(e):[])}_dedupeModulesByName(e){const t=new Map;for(const n of e)t.set(n.name,n);return Array.from(t.values())}_removeModuleCallbacks(e){this._configs=this._configs.filter(t=>t.moduleName!==e),this._afterConfiguration=this._afterConfiguration.filter(t=>t.moduleName!==e),this._afterInit=this._afterInit.filter(t=>t.moduleName!==e)}get modules(){return[...this._modules]}configure(...e){for(const t of e)this.addConfig(t)}addConfig(e){const{module:t,afterConfig:n,afterInit:r,configure:i}=e,o=Array.from(this._modules).find(e=>e.name===t.name);if(o){if(o!==t){this._removeModuleCallbacks(t.name);const e=Array.from(this._modules).map(e=>e.name===t.name?t:e);this._modules=new Set(e)}}else this._modules.add(t);if(this._registerEvent({level:Ao.Debug,name:Oo.ModuleConfigAdded,message:`Module configurator added for ${t.name}`,properties:{moduleName:t.name,moduleVersion:t.version?.toString()||"unknown",configure:!!i,afterConfig:!!n,afterInit:!!r}}),i){const e=(e,n)=>i(e[t.name],n);e.moduleName=t.name,this._configs.push(e)}if(n){const e=e=>n(e[t.name]);e.moduleName=t.name,this._afterConfiguration.push(e)}if(r){const e=e=>r(e[t.name]);e.moduleName=t.name,this._afterInit.push(e)}}onConfigured(e){this._afterConfiguration.push(e),this._registerEvent({level:Ao.Debug,name:Oo.OnConfiguredAdded,message:"Added onConfigured callback",properties:{count:this._afterConfiguration.length,name:e.name||"anonymous"}})}onInitialized(e){this._afterInit.push(e),this._registerEvent({level:Ao.Debug,name:Oo.OnInitializedAdded,message:"Added onInitialized callback",properties:{count:this._afterInit.length,name:e.name||"anonymous"}})}registerPlugin(e){this._plugins.push(e),this._registerEvent({level:Ao.Debug,name:Oo.PluginAdded,message:"Added plugin callback",properties:{count:this._plugins.length,name:e.name||"anonymous"}})}async initialize(e){const t=performance.now(),n=await this._configure(e),r=Math.round(performance.now()-t),i=this.modules.map(e=>e.name).join(", ");this._registerEvent({level:Ao.Debug,name:Oo.InitializeConfigLoaded,message:`Modules configured in ${r}ms`,properties:{modules:i,count:this.modules.length,loadTime:r},metric:r});const o=performance.now(),s=await this._initialize(n,e),a=Math.round(performance.now()-o),c=this.modules.map(e=>e.name).join(", ");this._registerEvent({level:Ao.Debug,name:Oo.InitializeInstanceInitialized,message:`Modules initialized in ${a}ms`,properties:{modules:c,count:this.modules.length,loadTime:a},metric:a});const l=r+a,u=this.modules.map(e=>e.name).join(", ");this._registerEvent({level:Ao.Information,name:Oo.Initialize,message:`initialize in ${l}ms`,properties:{modules:u,configLoadTime:r,instanceLoadTime:a,totalLoadTime:l},metric:l}),await this._postInitialize(s,e);const f=Object.seal(Object.assign({},s,{dispose:()=>this.dispose(s)}));return await this._registerPlugins(f,e),f}_registerEvent(e){const t=e.name.split("::");this.#se.next({...e,name:`${this.constructor.className}::${t[t.length-1]}`})}async _configure(e){return $o({modules:this.modules,configs:this._configs,afterConfiguration:this._afterConfiguration,afterInit:this._afterInit,registerEvent:this._registerEvent.bind(this)},e)}async _initialize(e,t){return To({modules:this.modules,registerEvent:this._registerEvent.bind(this)},e,t)}async _postInitialize(e,t){return async function(e,t,n){const{modules:r,afterInit:i,registerEvent:o}=e;o({level:Ao.Debug,name:Oo.ConfiguratorPostInitializeStart,message:`Post-initializing all modules [${Object.keys(t).length}]`,properties:{modules:Object.keys(t).join(", ")}});const s=zi(r).pipe(lo(e=>!!e.postInitialize),So(e=>{o({level:Ao.Debug,name:Oo.ModulePostInitializeStart,message:`Module ${e.name} is being post-initialized`,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown"}})}),no(e=>{const r=performance.now();return zi(e.postInitialize({ref:n,modules:t,instance:t[e.name]})).pipe(So(()=>{const t=Math.round(performance.now()-r);o({level:Ao.Debug,name:Oo.ModulePostInitializeComplete,message:`Module ${e.name} has been post-initialized in ${t}ms`,metric:t,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown",postInitTime:t}})}),ho(null),uo(t=>(o({level:Ao.Warning,name:Oo.ModulePostInitializeError,message:`Module ${e.name} post-initialize failed`,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown"},error:t}),Ci)))}),ho(null)),a=performance.now();await Wi(s);const c=Math.round(performance.now()-a);if(o({level:Ao.Debug,name:Oo.PostInitializeComplete,message:`Post-initialization of all modules completed in ${c}ms`,properties:{modules:Object.keys(t).join(", "),postInitTime:c},metric:c}),!i.length)return void o({level:Ao.Debug,name:Oo.PostInitializeCompleteNoHooks,message:"Post-initialization complete",properties:{modules:Object.keys(t).join(", "),postInitCompleteTime:c}});try{const e=i.map(e=>e.name||"anonymous").join(", ");o({level:Ao.Debug,name:Oo.PostInitializeHooks,message:`Executing post-initialize hooks [${i.length}]`,properties:{hooks:e}});const n=performance.now();await Promise.allSettled(i.map(e=>Promise.resolve(e(t))));const r=Math.round(performance.now()-n);o({level:Ao.Debug,name:Oo.PostInitializeHooksComplete,message:`Post-initialize hooks completed in ${r}ms`,properties:{hooks:e,afterInitTime:r},metric:r})}catch(e){const t=i.map(e=>e.name||"anonymous").join(", ");o({level:Ao.Warning,name:Oo.PostInitializeHooksError,message:"Post-initialize hooks failed",properties:{hooks:t},error:e})}const l=Math.round(performance.now()-a);o({level:Ao.Debug,name:Oo.PostInitializeComplete,message:"Post-initialization complete",properties:{modules:Object.keys(t).join(", "),postInitCompleteTime:l}})}({modules:this.modules,afterInit:this._afterInit,registerEvent:this._registerEvent.bind(this)},e,t)}async _registerPlugins(e,t){return async function(e,t,n){const{plugins:r,teardowns:i,registerEvent:o}=e;if(!r.length)return;o({level:Ao.Debug,name:Oo.PluginsRegister,message:`Registering plugins [${r.length}]`,properties:{count:r.length}});const s=await Promise.all(r.map(async e=>{const r=performance.now(),i=e.name||"anonymous";try{const a=await e({modules:t,ref:n}),c=Math.round(performance.now()-r);return o({level:Ao.Debug,name:Oo.PluginRegistered,message:`Plugin ${i} registered in ${c}ms`,properties:{name:i,pluginTime:c},metric:c}),"function"==typeof(s=a)||"object"==typeof s&&null!==s&&"dispose"in s&&"function"==typeof s.dispose?a:void 0}catch(e){return void o({level:Ao.Warning,name:Oo.PluginRegisterError,message:`Plugin ${i} registration failed`,properties:{name:i},error:e})}var s}));for(const e of s)e&&i.push(e);o({level:Ao.Debug,name:Oo.PluginsRegistered,message:"Plugin registration complete",properties:{count:r.length,teardowns:i.length}})}({plugins:this._plugins,teardowns:this._pluginTeardowns,registerEvent:this._registerEvent.bind(this)},e,t)}async dispose(e,t){return async function(e,t,n){const{modules:r,registerEvent:i,event$:o,pluginTeardowns:s=[]}=e;if(i({level:Ao.Debug,name:Oo.Dispose,message:"Disposing modules instance",properties:{modules:Object.keys(t).join(", ")}}),s.length){i({level:Ao.Debug,name:Oo.PluginsDisposing,message:`Disposing plugins [${s.length}]`,properties:{count:s.length}});for(const e of s.splice(0).reverse()){const t=ko(e);try{await Fo(e),i({level:Ao.Debug,name:Oo.PluginDisposed,message:`Plugin ${t} disposed successfully`,properties:{name:t}})}catch(e){i({level:Ao.Warning,name:Oo.PluginDisposeError,message:`Plugin ${t} dispose failed`,properties:{name:t},error:e})}}}i({level:Ao.Debug,name:Oo.ModulesDispose,message:"Disposing modules",properties:{count:r.length}}),await Promise.allSettled(r.filter(e=>!!e.dispose).map(async e=>{if(e.dispose)try{await e.dispose({ref:n,modules:t,instance:t[e.name]}),i({level:Ao.Debug,name:Oo.ModuleDisposed,message:`Module ${e.name} disposed successfully`,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown"}})}catch(t){i({level:Ao.Warning,name:Oo.ModuleDisposeError,message:`Module ${e.name} dispose failed`,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown"},error:t})}})),i({level:Ao.Debug,name:Oo.ModulesDisposed,message:"Module dispose complete",properties:{count:r.length}}),o.complete()}({modules:this.modules,registerEvent:this._registerEvent.bind(this),event$:this.#se,pluginTeardowns:this._pluginTeardowns},e,t)}}class Bo{_operators;get operators(){return this._operators}constructor(e){this._operators=e&&"operators"in e?{...e.operators}:e??{}}add(e,t){if(Object.keys(this._operators).includes(e))throw Error(`Operator [${e}] already defined`);return this.set(e,t)}set(e,t){return this._operators[e]=t,this}remove(e){return delete this._operators[e],this}get(e){return this._operators[e]}process(e){return Object.values(this._operators).length?zi(Object.values(this._operators)).pipe((t=(e,t)=>Promise.resolve(t(e)).then(t=>t??e),n=e,r=1,ci(function(e,i){var o=n;return to(e,i,function(e,n){return t(o,e,n)},r,function(e){o=e},!1,void 0,function(){return o=null})})),bo()):qi(e);var t,n,r}}class Mo extends Bo{setHeader(e,t){const n=((e,t)=>n=>{const r=new Headers(n.headers);return r.append(e,t),{...n,headers:r}})(e,t);return this.set(`header-${e}`,n)}}class Go extends Bo{}class jo{#ae;constructor(e){this.#ae=e?[...e.middleware]:[]}get middleware(){return this.#ae}use(e){return this.#ae.push(e),this}process(e,t,n){const r=this.#ae.reduceRight((e,t)=>(n,r)=>t(n,r,(t,n)=>function(e){return e instanceof Response?Promise.resolve(e):Zi(zi(e))}(e(t,n))),n),i=r(e,t);return i instanceof Response?qi(i):zi(i)}}const Ho=x.object({attributionReporting:x.object({eventSourceEligible:x.boolean().optional(),triggerEligible:x.boolean().optional()}).optional(),body:x.union([x.string(),x.instanceof(Blob),x.instanceof(ArrayBuffer),x.instanceof(FormData),x.instanceof(URLSearchParams),x.instanceof(ReadableStream)]).optional(),browsingTopics:x.boolean().optional(),cache:x.enum(["default","no-store","reload","no-cache","force-cache","only-if-cached"]).optional(),credentials:x.enum(["omit","same-origin","include"]).optional(),headers:x.record(x.string(),x.string()).optional().or(x.instanceof(Headers)),integrity:x.string().optional(),keepalive:x.boolean().optional(),method:x.enum(["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD","CONNECT","TRACE"],{message:"Invalid request method. Expected one of: GET, POST, PUT, DELETE, PATCH, OPTIONS, HEAD, CONNECT, TRACE. See RFC 2615 Section 9 for more information: https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html"}).optional().optional(),mode:x.enum(["same-origin","cors","no-cors","navigate","websocket"]).optional(),priority:x.enum(["low","high","auto"]).optional(),redirect:x.enum(["follow","error","manual"]).optional(),referrer:x.string().optional(),referrerPolicy:x.enum(["no-referrer","no-referrer-when-downgrade","origin","origin-when-cross-origin","same-origin","strict-origin","strict-origin-when-cross-origin","unsafe-url"]).optional(),signal:x.instanceof(AbortSignal).optional()}).extend({uri:x.string(),path:x.string().optional()}),zo=e=>e=>{const{error:t,success:n,data:r}=x.string().optional().refine(e=>void 0===e||e===e?.toUpperCase(),{message:["Provided HTTP method must be in uppercase.","See RFC 7231 Section 4.1 for more information","https://www.rfc-editor.org/rfc/rfc7231#section-4.1"].join(" ")}).safeParse(e.method);if(e.method=n?r:e.method?.toUpperCase(),t)for(const e of t.issues)console.warn(e.message);return e},qo=e=>e=>{const{strict:t,parse:n}={},r=t?Ho:Ho.passthrough();try{const t=r.parse(e);return n?t:void 0}catch(e){if(n)throw e;console.error("Invalid request options",e.message)}},Vo=e=>{try{return JSON.parse(e)}catch{return e}};function*Wo(e,t){const n=e.split("\n\n"),r=t?.dataParser||Vo;for(const e of n){if(!e.trim())continue;const t=e.split("\n").reduce((e,t)=>{if(!t)return e;const n=t.indexOf(":");if(-1===n)return e;const i=t.slice(0,n).trim(),o=t.slice(n+1).trim();return"data"===i?e.data=r(o):e[i]=o,e},{});Object.keys(t).length&&(yield t)}}const Zo=e=>t=>{if(!t.ok)throw new Ir(`HTTP error! Status: ${t.status}`,t);if(!t.body)throw new Ir("Response body is not readable",t);if(!t.headers.get("Content-Type")?.includes("text/event-stream"))throw new Ir("Response is not a text/event-stream",t);const n=t.body.getReader();return zi(async function*(e,t){const n=!!t?.skipHeartbeats,r=t?.eventFilter?Array.isArray(t.eventFilter)?t.eventFilter:[t.eventFilter]:null,i=new TextDecoder;for(;;){const{done:o,value:s}=await e.read();if(o)break;const a=Wo(i.decode(s,{stream:!0}),{dataParser:t?.dataParser});for(const e of a)if(e.retry)await new Promise(t=>setTimeout(t,Number.parseInt(e.retry??"300",10)));else{if(n){if(!e.event&&!e.data&&!e.id)continue;if(e.event&&["heartbeat","ping"].includes(e.event))continue}(!r||e.event&&r.includes(e.event))&&(yield e)}}}(n,{dataParser:e?.dataParser,skipHeartbeats:e?.skipHeartbeats,eventFilter:e?.eventFilter})).pipe(Io(e?.abortSignal?so(e.abortSignal,"abort"):Ci),Eo(async()=>{await n.cancel().catch(()=>{}),n.releaseLock()}))};class Ko{_clients={};get clients(){return{...this._clients}}defaultHttpClientCtor;defaultHttpRequestHandler=new Mo({"capitalize-method":zo(),"request-validation":qo()});defaultHttpMiddlewareHandler=new jo;constructor(e){this.defaultHttpClientCtor=e}hasClient(e){return Object.keys(this._clients).includes(e)}addMiddleware(e){return this.defaultHttpMiddlewareHandler.use(e),this}configureClient(e,t){const n="string"==typeof t?{baseUri:t}:t,r="function"==typeof n?{onCreate:n}:n;return this._clients[e]={...this._clients[e],...r},this}}const Yo=["http:","https:","ws:","wss:"];class Xo extends Ro{config;get defaultHttpRequestHandler(){return this.config.defaultHttpRequestHandler}get defaultHttpMiddlewareHandler(){return this.config.defaultHttpMiddlewareHandler}constructor(e){super({version:"8.1.1",config:e}),this.config=e}hasClient(e){return Object.keys(this.config.clients).includes(e)}createClient(e){const t=this._resolveConfig(e),{baseUri:n,defaultScopes:r=[],onCreate:i,ctor:o=this.config.defaultHttpClientCtor,requestHandler:s=this.defaultHttpRequestHandler,responseHandler:a,middlewareHandler:c=this.defaultHttpMiddlewareHandler}=t,l=new o(n||"",{requestHandler:s,responseHandler:a,middlewareHandler:c});return Object.assign(l,{defaultScopes:r}),i?.(l),l}createCustomClient(e){return this.createClient(e)}_resolveConfig(e){if("string"==typeof e){const n=this.config.clients[e];if(!n&&(e=>{try{const t=new URL(e);return Yo.includes(t.protocol)}catch{return!1}})(e))return{baseUri:e};if(!n&&!(t=e).includes(" ")&&/^[a-z\d]([a-z\d-]*\.)+[a-z]{2,}/i.test(t))return console.warn(`[HttpClientProvider] "${e}" looks like a URL but is missing the http:// or https:// protocol. Treating it as "https://${e}". Pass a fully-qualified URL to silence this warning.`),{baseUri:`https://${e}`};if(!n)throw new Sr(`No registered http client for key [${e}]`);return n}var t;return e}}function Jo(e,t){void 0===t&&(t={});var n=t.selector,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(t,["selector"]);return new si(function(t){var i=new AbortController,o=i.signal,s=!0,a=r.signal;if(a)if(a.aborted)i.abort();else{var c=function(){o.aborted||i.abort()};a.addEventListener("abort",c),t.add(function(){return a.removeEventListener("abort",c)})}var l=Ar(Ar({},r),{signal:o}),u=function(e){s=!1,t.error(e)};return fetch(e,l).then(function(e){n?Fi(n(e)).subscribe(li(t,void 0,function(){s=!1,t.complete()},u)):(s=!1,t.next(e),t.complete())}).catch(u),function(){s&&i.abort()}})}const Qo=async e=>{if(204===e.status)return Promise.resolve();try{const t=await e.json();if(!e.ok)throw new Lr("network response was not OK",e,{data:t});return t}catch(t){if(t instanceof Lr)throw t;throw new Lr("failed to parse response",e,{cause:t})}},es=async e=>{if(!e.ok)throw new Error("network response was not OK");if(204===e.status)throw new Error("no content");const t=e.headers.get("content-disposition")?.split(";").find(e=>e.includes("filename="))?.replace("filename=","")?.trim();try{return{filename:t,blob:await e.blob()}}catch(e){throw Error("failed to parse response")}};class ts{uri;requestHandler;responseHandler;middlewareHandler;_request$=new di;_response$=new di;_abort$=new di;get request$(){return this._request$.asObservable()}get response$(){return this._response$.asObservable()}constructor(e,t){this.uri=e,this.requestHandler=new Mo(t?.requestHandler),this.responseHandler=new Go(t?.responseHandler),this.middlewareHandler=new jo(t?.middlewareHandler),this._init()}_init(){}fetch$(e,t){return this._fetch$(e,t)}fetch(e,t){return Zi(this.fetch$(e,t))}fetchAsync(e,t){return this.fetch(e,t)}json$(e,t){const n="object"==typeof t?.body?JSON.stringify(t?.body):t?.body,r=t?.selector??Qo,i=new Headers(t?.headers);return i.append("Accept","application/json"),i.append("Content-Type","application/json"),this.fetch$(e,{...t,body:n,selector:r,headers:i})}json(e,t){return Zi(this.json$(e,t))}blob$(e,t){const n=t?.selector??es,r={...t,selector:n};return this.fetch$(e,r)}blob(e,t){return Zi(this.blob$(e,t))}sse$(e,t,n){const r=new Headers(t?.headers);r.append("Accept","text/event-stream"),r.append("Content-Type","text/event-stream"),r.append("Cache-Control","no-cache"),r.append("Connection","keep-alive");const i=Zo({...n,abortSignal:t?.signal});return this._fetch$(e,{selector:i,...t,headers:r})}jsonAsync(e,t){return this.json(e,t)}execute(e,t,n){return this[e](t,n)}abort(){this._abort$.next()}_fetch$(e,t){const{selector:n,...r}=t||{},i=new AbortController,o=this._abort$.pipe((s=1,s<=0?function(){return Ci}:ci(function(e,t){var n=0;e.subscribe(li(t,function(e){++n<=s&&(t.next(e),s<=n&&t.complete())}))}))).subscribe(()=>i.abort());var s;const a=r.signal,c=a?AbortSignal.any([a,i.signal]):i.signal;return qi({...r,signal:c,path:e,uri:this._resolveUrl(e)}).pipe(Lo(e=>this._prepareRequest(e)),So(e=>this._request$.next(e)),Lo(({uri:e,path:t,...n})=>this.middlewareHandler.process(e,n,(e,t)=>this._performFetch(e,t))),Lo(e=>this._prepareResponse(e)),So(e=>this._response$.next(e)),Lo(e=>{if(n)try{return n(e)}catch(t){throw new wr("failed to execute response selector",e,{cause:t})}return qi(e)}),Io(this._abort$),Eo(()=>o.unsubscribe()))}_performFetch(e,t){return Jo(e,t)}_prepareRequest(e){return this.requestHandler.process(e)}_prepareResponse(e){return this.responseHandler.process(e)}_resolveUrl(e){const{origin:t,pathname:n}=new URL(this.uri,this.uri.startsWith("http")?void 0:window.location.origin),r=[n,e].join("/").replace(/\/{2,}/g,"/");return new URL(r,t).href}}class ns extends ts{defaultScopes=[];fetch$(e,t){const n={...t,scopes:this.defaultScopes.concat(t?.scopes||[])};return super._fetch$(e,n)}}const rs={name:"http",configure:()=>new Ko(ns),initialize:async({config:e,hasModule:t,requireInstance:n})=>{const r=new Xo(e);if(t("auth")){const e=await n("auth");r.defaultHttpRequestHandler.set("MSAL",async t=>{const{scopes:n=[]}=t;if(n.length){const r=await e.acquireAccessToken({request:{scopes:n}});if(r){const e=new Headers(t.headers);return e.set("Authorization",`Bearer ${r}`),{...t,headers:e}}}})}return r}},is=(...e)=>t=>t.pipe(function(e,t){return Mr(t)?no(e,t,1):no(e,1)}(...e)),os=(...e)=>t=>t.pipe(no(...e)),ss=(...e)=>t=>t.pipe(Lo(...e)),as=e=>e.pipe(Ji(e=>e.value));var cs=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function ls(e){if(!function(e){return"string"==typeof e&&cs.test(e)}(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,255&t,(t=parseInt(e.slice(9,13),16))>>>8,255&t,(t=parseInt(e.slice(14,18),16))>>>8,255&t,(t=parseInt(e.slice(19,23),16))>>>8,255&t,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,255&t)}const us=[];for(let e=0;e<256;++e)us.push((e+256).toString(16).slice(1));function fs(e,t=0){return(us[e[t+0]]+us[e[t+1]]+us[e[t+2]]+us[e[t+3]]+"-"+us[e[t+4]]+us[e[t+5]]+"-"+us[e[t+6]]+us[e[t+7]]+"-"+us[e[t+8]]+us[e[t+9]]+"-"+us[e[t+10]]+us[e[t+11]]+us[e[t+12]]+us[e[t+13]]+us[e[t+14]]+us[e[t+15]]).toLowerCase()}const ds=new Uint8Array(16);function ps(e,t,n,r,i,o){const s="string"==typeof n?function(e){e=unescape(encodeURIComponent(e));const t=new Uint8Array(e.length);for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}(n):n,a="string"==typeof r?ls(r):r;if("string"==typeof r&&(r=ls(r)),16!==r?.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+s.length);if(c.set(a),c.set(s,a.length),c=t(c),c[6]=15&c[6]|e,c[8]=63&c[8]|128,i){if(o??=0,o<0||o+16>i.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`);for(let e=0;e<16;++e)i[o+e]=c[e];return i}return fs(c)}function hs(e,t,n){return crypto.randomUUID?crypto.randomUUID():function(e){e=e||{};const t=e.random??e.rng?.()??crypto.getRandomValues(ds);if(t.length<16)throw new Error("Random bytes length must be >= 16");return t[6]=15&t[6]|64,t[8]=63&t[8]|128,fs(t)}(e)}function ms(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:case 3:return t^n^r;case 2:return t&n^t&r^n&r}}function gs(e,t){return e<<t|e>>>32-t}function vs(e){const t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520],r=new Uint8Array(e.length+1);r.set(e),r[e.length]=128;const i=(e=r).length/4+2,o=Math.ceil(i/16),s=new Array(o);for(let t=0;t<o;++t){const n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=e[64*t+4*r]<<24|e[64*t+4*r+1]<<16|e[64*t+4*r+2]<<8|e[64*t+4*r+3];s[t]=n}s[o-1][14]=8*(e.length-1)/2**32,s[o-1][14]=Math.floor(s[o-1][14]),s[o-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<o;++e){const r=new Uint32Array(80);for(let t=0;t<16;++t)r[t]=s[e][t];for(let e=16;e<80;++e)r[e]=gs(r[e-3]^r[e-8]^r[e-14]^r[e-16],1);let i=n[0],o=n[1],a=n[2],c=n[3],l=n[4];for(let e=0;e<80;++e){const n=Math.floor(e/20),s=gs(i,5)+ms(n,o,a,c)+l+t[n]+r[e]>>>0;l=c,c=a,a=gs(o,30)>>>0,o=i,i=s}n[0]=n[0]+i>>>0,n[1]=n[1]+o>>>0,n[2]=n[2]+a>>>0,n[3]=n[3]+c>>>0,n[4]=n[4]+l>>>0}return Uint8Array.of(n[0]>>24,n[0]>>16,n[0]>>8,n[0],n[1]>>24,n[1]>>16,n[1]>>8,n[1],n[2]>>24,n[2]>>16,n[2]>>8,n[2],n[3]>>24,n[3]>>16,n[3]>>8,n[3],n[4]>>24,n[4]>>16,n[4]>>8,n[4])}function ys(e,t,n,r){return ps(80,vs,e,t,n,r)}ys.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",ys.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";class Es extends Error{type;request;constructor(e,t){super(t.message,{cause:t.cause}),this.type=e,this.name="QueryClientError",this.request=t.request}}var bs=Symbol.for("immer-nothing"),ws=Symbol.for("immer-draftable"),Ls=Symbol.for("immer-state"),Is="production"!==process.env.NODE_ENV?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function Ss(e,...t){if("production"!==process.env.NODE_ENV){const n=Is[e],r=Ws(n)?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Cs=Object,_s=Cs.getPrototypeOf,Ds="constructor",Ps="prototype",Ns="configurable",Os="enumerable",As="writable",$s="value",Rs=e=>!!e&&!!e[Ls];function xs(e){return!!e&&(Fs(e)||Hs(e)||!!e[ws]||!!e[Ds]?.[ws]||zs(e)||qs(e))}var Ts=Cs[Ps][Ds].toString(),ks=new WeakMap;function Fs(e){if(!e||!Vs(e))return!1;const t=_s(e);if(null===t||t===Cs[Ps])return!0;const n=Cs.hasOwnProperty.call(t,Ds)&&t[Ds];if(n===Object)return!0;if(!Ws(n))return!1;let r=ks.get(n);return void 0===r&&(r=Function.toString.call(n),ks.set(n,r)),r===Ts}function Us(e,t,n=!0){if(0===Bs(e)){(n?Reflect.ownKeys(e):Cs.keys(e)).forEach(n=>{t(n,e[n],e)})}else e.forEach((n,r)=>t(r,n,e))}function Bs(e){const t=e[Ls];return t?t.type_:Hs(e)?1:zs(e)?2:qs(e)?3:0}var Ms=(e,t,n=Bs(e))=>2===n?e.has(t):Cs[Ps].hasOwnProperty.call(e,t),Gs=(e,t,n=Bs(e))=>2===n?e.get(t):e[t],js=(e,t,n,r=Bs(e))=>{2===r?e.set(t,n):3===r?e.add(n):e[t]=n};var Hs=Array.isArray,zs=e=>e instanceof Map,qs=e=>e instanceof Set,Vs=e=>"object"==typeof e,Ws=e=>"function"==typeof e,Zs=e=>"boolean"==typeof e;var Ks=e=>e.copy_||e.base_,Ys=e=>e.modified_?e.copy_:e.base_;function Xs(e,t){if(zs(e))return new Map(e);if(qs(e))return new Set(e);if(Hs(e))return Array[Ps].slice.call(e);const n=Fs(e);if(!0===t||"class_only"===t&&!n){const t=Cs.getOwnPropertyDescriptors(e);delete t[Ls];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const i=n[r],o=t[i];!1===o[As]&&(o[As]=!0,o[Ns]=!0),(o.get||o.set)&&(t[i]={[Ns]:!0,[As]:!0,[Os]:o[Os],[$s]:e[i]})}return Cs.create(_s(e),t)}{const t=_s(e);if(null!==t&&n)return{...e};const r=Cs.create(t);return Cs.assign(r,e)}}function Js(e,t=!1){return ea(e)||Rs(e)||!xs(e)||(Bs(e)>1&&Cs.defineProperties(e,{set:Qs,add:Qs,clear:Qs,delete:Qs}),Cs.freeze(e),t&&Us(e,(e,t)=>{Js(t,!0)},!1)),e}var Qs={[$s]:function(){Ss(2)}};function ea(e){return null===e||!Vs(e)||Cs.isFrozen(e)}var ta="MapSet",na="Patches",ra="ArrayMethods",ia={};function oa(e){const t=ia[e];return t||Ss(0,e),t}var sa,aa=e=>!!ia[e],ca=()=>sa;function la(e,t){t&&(e.patchPlugin_=oa(na),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ua(e){fa(e),e.drafts_.forEach(pa),e.drafts_=null}function fa(e){e===sa&&(sa=e.parent_)}var da=e=>sa={drafts_:[],parent_:sa,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:aa(ta)?oa(ta):void 0,arrayMethodsPlugin_:aa(ra)?oa(ra):void 0};function pa(e){const t=e[Ls];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function ha(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(void 0!==e&&e!==n){n[Ls].modified_&&(ua(t),Ss(4)),xs(e)&&(e=ma(t,e));const{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[Ls].base_,e,t)}else e=ma(t,n);return function(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Js(t,n)}(t,e,!0),ua(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==bs?e:void 0}function ma(e,t){if(ea(t))return t;const n=t[Ls];if(!n){return wa(t,e.handledSet_,e)}if(!va(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:t}=n;if(t)for(;t.length>0;){t.pop()(e)}ba(n,e)}return n.copy_}function ga(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var va=(e,t)=>e.scope_===t,ya=[];function Ea(e,t,n,r){const i=Ks(e),o=e.type_;if(void 0!==r){if(Gs(i,r,o)===t)return void js(i,r,n,o)}if(!e.draftLocations_){const t=e.draftLocations_=new Map;Us(i,(e,n)=>{if(Rs(n)){const r=t.get(n)||[];r.push(e),t.set(n,r)}})}const s=e.draftLocations_.get(t)??ya;for(const e of s)js(i,e,n,o)}function ba(e,t){if(e.modified_&&!e.finalized_&&(3===e.type_||1===e.type_&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){const{patchPlugin_:n}=t;if(n){const r=n.getPath(e);r&&n.generatePatches_(e,r,t)}ga(e)}}function wa(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Rs(e)||t.has(e)||!xs(e)||ea(e)||(t.add(e),Us(e,(r,i)=>{if(Rs(i)){const t=i[Ls];if(va(t,n)){const n=Ys(t);js(e,r,n,e.type_),ga(t)}}else xs(i)&&wa(i,t,n)})),e}var La={get(e,t){if(t===Ls)return e;let n=e.scope_.arrayMethodsPlugin_;const r=1===e.type_&&"string"==typeof t;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const i=Ks(e);if(!Ms(i,t,e.type_))return function(e,t,n){const r=Ca(t,n);return r?$s in r?r[$s]:r.get?.call(e.draft_):void 0}(e,i,t);const o=i[t];if(e.finalized_||!xs(o))return o;if(r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&function(e){const t=+e;return Number.isInteger(t)&&String(t)===e}(t))return o;if(o===Sa(e.base_,t)||function(e,t,n){if(1!==e.type_||!e.allIndicesReassigned_||e.assigned_?.get(t)||!xs(n)||n[Ls])return!1;return e.baseRefs_.has(n)}(e,t,o)){Da(e);const n=1===e.type_?+t:t,r=Pa(e.scope_,o,e,n);return e.copy_[n]=r}return o},has:(e,t)=>t in Ks(e),ownKeys:e=>Reflect.ownKeys(Ks(e)),set(e,t,n){const r=Ca(Ks(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=Sa(Ks(e),t),s=r?.[Ls];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(((i=n)===(o=r)?0!==i||1/i==1/o:i!=i&&o!=o)&&(void 0!==n||Ms(e.base_,t,e.type_)))return!0;Da(e),_a(e)}var i,o;return e.copy_[t]===n&&(void 0!==n||Ms(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),function(e,t,n){const{scope_:r}=e;if(Rs(n)){const i=n[Ls];va(i,r)&&i.callbacks_.push(function(){Da(e);const r=Ys(i);Ea(e,n,r,t)})}else xs(n)&&e.callbacks_.push(function(){const i=Ks(e);3===e.type_?i.has(n)&&wa(n,r.handledSet_,r):Gs(i,t,e.type_)===n&&r.drafts_.length>1&&!0===(e.assigned_.get(t)??!1)&&e.copy_&&wa(Gs(e.copy_,t,e.type_),r.handledSet_,r)})}(e,t,n)),!0},deleteProperty:(e,t)=>(Da(e),void 0!==Sa(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),_a(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=Ks(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{[As]:!0,[Ns]:1!==e.type_||"length"!==t,[Os]:r[Os],[$s]:n[t]}:r},defineProperty(){Ss(11)},getPrototypeOf:e=>_s(e.base_),setPrototypeOf(){Ss(12)}},Ia={};for(let e in La){let t=La[e];Ia[e]=function(){const e=arguments;return e[0]=e[0][0],t.apply(this,e)}}function Sa(e,t){const n=e[Ls];return(n?Ks(n):e)[t]}function Ca(e,t){if(!(t in e))return;let n=_s(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=_s(n)}}function _a(e){e.modified_||(e.modified_=!0,e.parent_&&_a(e.parent_))}function Da(e){e.copy_||(e.assigned_=new Map,e.copy_=Xs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}Ia.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&Ss(13),Ia.set.call(this,e,t,void 0)},Ia.set=function(e,t,n){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&Ss(14),La.set.call(this,e[0],t,n,e[0])};function Pa(e,t,n,r){const[i,o]=zs(t)?oa(ta).proxyMap_(t,n):qs(t)?oa(ta).proxySet_(t,n):function(e,t){const n=Hs(e),r={type_:n?1:0,scope_:t?t.scope_:ca(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,o=La;n&&(i=[r],o=Ia);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,[a,r]}(t,n);return(n?.scope_??ca()).drafts_.push(i),o.callbacks_=n?.callbacks_??[],o.key_=r,n&&void 0!==r?function(e,t,n){e.callbacks_.push(function(r){const i=t;if(!i||!va(i,r))return;r.mapSetPlugin_?.fixSetContents(i);const o=Ys(i);Ea(e,i.draft_??i,o,n),ba(i,r)})}(n,o,r):o.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(o);const{patchPlugin_:t}=e;o.modified_&&t&&t.generatePatches_(o,[],e)}),i}function Na(e){if(!xs(e)||ea(e))return e;const t=e[Ls];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Xs(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Xs(e,!0);return Us(n,(e,t)=>{js(n,e,Na(t))},r),t&&(t.finalized_=!1),n}globalThis.Iterator;var Oa=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(Ws(e)&&!Ws(t)){const n=t;t=e;const r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}let r;if(Ws(t)||Ss(6),void 0===n||Ws(n)||Ss(7),xs(e)){const i=da(this),o=Pa(i,e,void 0);let s=!0;try{r=t(o),s=!1}finally{s?ua(i):fa(i)}return la(i,n),ha(r,i)}if(!e||!Vs(e)){if(r=t(e),void 0===r&&(r=e),r===bs&&(r=void 0),this.autoFreeze_&&Js(r,!0),n){const t=[],i=[];oa(na).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}Ss(1,e)},this.produceWithPatches=(e,t)=>{if(Ws(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},Zs(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Zs(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Zs(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){xs(e)||Ss(8),Rs(e)&&(e=function(e){Rs(e)||Ss(10,e);return Na(e)}(e));const t=da(this),n=Pa(t,e,void 0);return n[Ls].isManual_=!0,fa(t),n}finishDraft(e,t){const n=e&&e[Ls];n&&n.isManual_||Ss(9);const{scope_:r}=n;return la(r,t),ha(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=oa(na).applyPatches_;return Rs(e)?r(e,t):this.produce(e,e=>r(e,t))}},Aa=Oa.produce;const $a=(...e)=>lo(t=>e.includes(t.type));class Ra extends si{#ce=new di;#le;get action$(){return this.#ce.asObservable()}get value(){return this.#le.value}get closed(){return this.#le.closed||this.#ce.closed}constructor(e,t){super(e=>this.#le.subscribe(e));const n="getInitialState"in e?e.getInitialState():t;this.#le=new hi(n),this.#ce.pipe(function(e,t){return ci(fo(e,t,arguments.length>=2,!0))}(e,n),mo()).subscribe(this.#le),this.reset=()=>this.#le.next(n)}reset;next(e){this.#ce.next(e)}select(e,t){return this.#le.pipe(Ji(e),mo(t))}addEffect(e,t){const n="function"==typeof e?this.action$:Array.isArray(e)?this.action$.pipe($a(...e)):this.action$.pipe($a(e)),r=t||e;return n.pipe(no(e=>zi(new Promise((t,n)=>{try{t(r(e,this.value))}catch(e){n(e)}})).pipe(uo(e=>(console.warn("unhandled effect",e),Ci)))),lo(e=>!!e),Mi(Ii)).subscribe(this.#ce)}addEpic(e){return this.addFlow(e)}addFlow(e){const t=e(this.action$,this);if(!t)throw new TypeError(`addEpic: one of the provided effects "${e.name||"<anonymous>"}" does not return a stream. Double check you're not missing a return statement!`);return t.pipe(uo(e=>(console.trace("unhandled exception, epic closed!",e),Ci)),Mi(Ii)).subscribe(this.#ce)}unsubscribe(){this.#ce.unsubscribe(),this.#le.unsubscribe()}complete(){this.#ce.complete(),this.#le.complete()}asObservable(){return this.#le.asObservable()}}const xa="::";function Ta(e,t){function n(...n){if(t){const r=t(...n);if(!r)throw new Error("prepareAction did not return an object");return{type:e,payload:r.payload,..."meta"in r&&{meta:r.meta},..."error"in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>t.type===e,n}function ka(e,t,n,r){const i=Ta([e,"request"].join(xa),t);return n&&Object.assign(i,{success:Ta([e,"success"].join(xa),n)}),r&&Object.assign(i,{failure:Ta([e,"failure"].join(xa),r)}),i}function Fa(e){return xs(e)?Aa(e,()=>{}):e}function Ua(e,t){const[n,r,i]=function(e){const t={},n=[];let r;const i={addCase(e,o){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("`builder.addCase` should only be called before calling `builder.addMatcher`");if(r)throw new Error("`builder.addCase` should only be called before calling `builder.addDefaultCase`")}const s="string"==typeof e?e:e.type;if(s in t)throw new Error("addCase cannot be called with two reducers for the same action type");return t[s]=o,i},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&r)throw new Error("`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){if("production"!==process.env.NODE_ENV&&r)throw new Error("`builder.addDefaultCase` can only be called once");return r=e,i}};return e(i),[t,n,r]}(t);let o;if("function"==typeof e)o=()=>Fa(e());else{const t=Fa(e);o=()=>t}function s(e,t){let s=[n[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];const a=s.filter(e=>!!e).length>0;return i&&!a&&(s=[i]),s.reduce((e,n)=>{if(n){if(Rs(e)){const r=n(e,t);return void 0===r?e:r}if(xs(e))return Aa(e,e=>n(e,t));{const r=n(e,t);if(void 0===r){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}}return e},e??o())}return s.getInitialState=o,s}const Ba={request:Ta("client/request",(e,t)=>({payload:{args:e,options:t},meta:{transaction:hs(),created:Date.now()}})),execute:ka("client/execute",e=>({payload:e,meta:{transaction:e,created:Date.now()}}),e=>({payload:e,meta:{transaction:e.transaction,created:Date.now()}}),(e,t)=>({payload:{error:e},meta:{transaction:t,created:Date.now()}})),cancel:Ta("client/cancel",(e,t)=>({payload:{transaction:e,reason:t},meta:{transaction:e,created:Date.now()}})),error:Ta("client/error",(e,t)=>({payload:{transaction:e,error:t},meta:{transaction:e,created:Date.now()}}))},Ma=e=>e.pipe(lo(Ba.request.match),Ji(e=>Ba.execute(e.meta.transaction)));class Ga extends si{#ue=new hi("idle");get status(){return this.#ue.value}get status$(){return this.#ue.asObservable()}#fe;#de;get transaction(){return this.#de}created=Date.now();get closed(){return"complete"===this.status||"error"===this.status||"canceled"===this.status}constructor(e,t,n){super(t=>{const{transaction:r}=this,i=e.action$.pipe(lo(e=>e.meta.transaction===r));t.add(e.state$.pipe(lo(e=>!!e[r]),Ji(e=>e[r])).subscribe(e=>{this.#ue.next(e.status)})),t.add(i.pipe(lo(Ba.execute.success.match),Ji(({payload:e})=>e)).subscribe(e=>{this.#ue.next("complete"),t.next(e),t.complete()})),t.add(i.pipe(lo(Ba.error.match),Ji(({payload:e})=>e)).subscribe(e=>{this.#ue.next("error"),t.error(e.error)})),t.add(i.pipe(lo(Ba.cancel.match)).subscribe(e=>{this.#ue.next("canceled"),t.error(new Es("abort",{message:e.payload.reason||`job: ${r} was canceled`,request:this.#fe.getRequest(e.meta.transaction)}))})),n?.signal&&t.add(so(n?.signal,"abort").pipe(Ji(()=>Ba.cancel(r,`job: ${r} was aborted on signal from caller: ${n?.ref}`))).subscribe(t=>e.next(t))),t.add(()=>{this.complete()})}),this.#fe=e;const r=Ba.request(t,{ref:n?.ref,retry:n?.retry});this.#de=r.meta.transaction,this.#fe.next(r)}complete(e){this.closed||this.cancel(e??`job: ${this.transaction} was completed`)}cancel(e){const t=this.transaction;this.#fe.cancel(t,e??`job: ${t} was canceled`)}[Symbol.dispose](){this.complete()}}class ja{type;transaction;data;constructor(e,t,n){this.type=e,this.transaction=t,this.data=n}}class Ha extends si{#le;#pe;#he;_registerEvent(e,t,n){this.#he.next(new ja(e,t,n))}get closed(){return this.#le.closed}get state$(){return this.#le.asObservable()}get action$(){return this.#le.action$}get event$(){return this.#he.asObservable()}get success$(){return this.action$.pipe(lo(Ba.execute.success.match),Ji(({payload:e})=>e))}get error$(){return this.action$.pipe($a("client/error"),Co(this.#le),Ji(([e,t])=>{const{payload:n,meta:{transaction:r}}=e,i=t[r];return new Es("error",{request:i,message:`job: ${r} failed`,cause:n})}))}constructor(e,t){super(e=>this.#le.subscribe(e)),this.#le=new Ra(((e={})=>Ua(e,e=>{e.addCase(Ba.request,(e,t)=>{e[t.meta.transaction]={...t.payload,...t.meta,execution:[],errors:[],status:"idle"}}),e.addCase(Ba.execute,(e,t)=>{const n=e[t.payload];n&&(n.execution.push(Date.now()),n.status="active")}),e.addCase(Ba.execute.success,(e,t)=>{delete e[t.payload.transaction]}),e.addCase(Ba.execute.failure,(e,t)=>{const n=e[t.meta.transaction];n&&(n.errors.push(t.payload.error),n.status="failed")}),e.addCase(Ba.error,(e,t)=>{delete e[t.meta.transaction]}),e.addCase(Ba.cancel,(e,t)=>{delete e[t.meta.transaction]})}))({})),this.#pe=new zr(()=>{this.#le.complete(),this.#he.complete()}),this.#he=new di,this.#pe.add(this.#le.addFlow(Ma)),this.#pe.add(this.#le.addFlow((e=>(t,n)=>t.pipe(lo(Ba.execute.match),Co(n),no(([n,r])=>{const i=n.payload,o=r[i],s=new AbortController,a=t.pipe(lo(Ba.cancel.match),lo(e=>e.payload.transaction===i),So(()=>{s.signal.aborted||s.abort()}));try{return zi(e(o.args,s.signal)).pipe(Ji(e=>Ba.execute.success({...o,status:"complete",completed:Date.now(),value:e})),uo(e=>qi(Ba.execute.failure(e,i))),Io(a))}catch(e){return qi(Ba.execute.failure(e,i))}})))(e)));const n=Object.assign({count:0,delay:0},t?.retry);this.#pe.add(this.#le.addFlow((e=>(t,n)=>t.pipe(lo(Ba.execute.failure.match),Co(n),no(([t,r])=>{const{transaction:i}=t.meta,o=r[i];if(!o)return qi(Ba.error(i,new Es("error",{message:"request not found, cannot retry request, most likely removed while scheduled for retry!"})));const s=o.execution.length,a=Object.assign({},e,o.options?.retry),c=o.errors?.slice(-1)[0]??new Es("error",{message:"no errors registered for request!",request:o});if(s>a.count){const e=0===a.count?c:new Es("error",{message:"maximum retries executed!",cause:o.errors,request:o});return qi(Ba.error(i,e))}return("function"==typeof a.delay?zi(a.delay(c)).pipe(uo(e=>qi(Ba.error(i,new Es("error",{message:"retry delay callback failed!",cause:[...o.errors??[],e],request:o}))))):co(a.delay)).pipe(Co(n),lo(([e,t])=>!!t[i]),So(([,e])=>{if(!e[i])throw new Es("error",{message:"request not found, most likely removed while scheduled for retry",cause:o.errors,request:o})}),Ji(()=>Ba.execute(i)))})))(n))),this.#le.addEffect(Ba.request.type,({payload:e,meta:{transaction:t}})=>{this._registerEvent("query_client_job_requested",t,e)}),this.#le.addEffect(Ba.execute.type,({meta:{transaction:e}})=>{this._registerEvent("query_client_job_executing",e)}),this.#le.addEffect(Ba.execute.success.type,({payload:e,meta:{transaction:t}})=>{this._registerEvent("query_client_job_completed",t,{payload:e})}),this.#le.addEffect(Ba.execute.failure.type,({payload:e,meta:{transaction:t}})=>{const n=e.error instanceof Error?e.error:new Error(String(e.error));this._registerEvent("query_client_job_failed",t,{error:n})}),this.#le.addEffect(Ba.cancel.type,({payload:{reason:e},meta:{transaction:t}})=>{this._registerEvent("query_client_job_canceled",t,{reason:e||"no reason provided"})}),this.#le.addEffect(Ba.error.type,({payload:e,meta:{transaction:t}})=>{const n=e.error instanceof Error?e.error:new Error(String(e.error));this._registerEvent("query_client_job_error",t,{error:n})})}next(e){this.#le.next(e)}query(e,t){const n=new Ga(this,e,t),r=n.pipe(function(e){void 0===e&&(e={});var t=e.connector,n=void 0===t?function(){return new di}:t,r=e.resetOnError,i=void 0===r||r,o=e.resetOnComplete,s=void 0===o||o,a=e.resetOnRefCountZero,c=void 0===a||a;return function(e){var t,r,o,a=0,l=!1,u=!1,f=function(){null==r||r.unsubscribe(),r=void 0},d=function(){f(),t=o=void 0,l=u=!1},p=function(){var e=t;d(),null==e||e.unsubscribe()};return ci(function(e,h){a++,u||l||f();var m=o=null!=o?o:n();h.add(function(){0!==--a||u||l||(r=wo(p,c))}),m.subscribe(h),!t&&a>0&&(t=new ti({next:function(e){return m.next(e)},error:function(e){u=!0,f(),r=wo(d,i,e),m.error(e)},complete:function(){l=!0,f(),r=wo(d,s),m.complete()}}),Fi(e).subscribe(t))})(e)}}({connector:()=>new gi,resetOnRefCountZero:!1}));return Object.defineProperties(r,{transaction:{get:()=>n.transaction},created:{get:()=>n.created},status:{get:()=>n.status},closed:{get:()=>n.closed},cancel:{value:e=>n.cancel(e)},complete:{value:()=>n.complete()}}),r}async nextAsync(e,t){return Zi(this.query(e,t))}getRequest(e){return this.#le.value[e]}getRequestByRef(e){return Object.values(this.#le.value).find(t=>t.ref===e)}cancelTaskByRef(e,t){const n=this.getRequestByRef(e);n?.ref&&this.cancel(n.transaction,t)}cancel(e,t){if(e)this.#le.value[e]&&(t??=`cancelation requested for job: ${e}`,this.#le.next(Ba.cancel(e,t)));else for(const e of Object.keys(this.#le.value))this.cancel(e,"all transactions requested canceled")}on(e,t){return this.#le.addEffect(Ba[e].type,e=>{t(e,this)})}complete(){this.#pe.unsubscribe()}}const za={set:Ta("cache/set",(e,t)=>({payload:{key:e,record:t}})),insert:Ta("cache/insert",(e,t)=>({payload:{key:e,entry:t}})),remove:Ta("cache/remove",e=>({payload:e})),invalidate:Ta("cache/invalidate",(e,t)=>({payload:e,meta:{item:t}})),mutate:Ta("cache/mutate",(e,t,n)=>({payload:{...t,key:e},meta:{item:n}})),trim:Ta("cache/trim",e=>({payload:e}))},qa=(e,t)=>(t.updated??0)-(e.updated??0);class Va{type;key;data;constructor(e,t,n){this.type=e,this.key=t,this.data=n}}class Wa{#le;#he;get state(){return this.#le.value}get state$(){return this.#le.asObservable()}get action$(){return this.#le.action$}_registerEvent(e,t){this.#he.next(new Va(e,t?.key,t?.data))}get event$(){return this.#he.asObservable()}constructor(e){const{trimming:t,initial:n}=e??{};this.#le=new Ra(function(e,t={}){return Ua(t,t=>t.addCase(e.set,(e,t)=>{const{key:n,record:r}=t.payload;e[n]=r}).addCase(e.insert,(e,t)=>{const{key:n,entry:r}=t.payload,i=e[n];if(i)i.updated=Date.now(),i.updates??=0,i.updates++,i.value=r.value,i.transaction=r.transaction,i.mutated=void 0;else{const t=Date.now();e[n]={...r,created:t,updated:t}}}).addCase(e.remove,(e,t)=>{delete e[t.payload]}).addCase(e.invalidate,(e,t)=>{const n=t.payload?[t.payload]:Object.keys(e);for(const t of n){const n=e[t];n&&(n.updated=void 0)}}).addCase(e.mutate,(e,t)=>{const{key:n,value:r,updated:i}=t.payload,o=e[n];o&&(o.value=r,o.updated=i,o.mutated=Date.now(),o.updates??=0,o.updates++)}).addCase(e.trim,(e,t)=>{const{payload:n}=t,r=n.sort??qa,i=Object.keys(e),o=Object.entries(e).filter(([e,t])=>!n.validate||n.validate(t)).sort((e,t)=>r(e[1],t[1])).slice(0,n.size??Number.MAX_SAFE_INTEGER).map(([e])=>e);if(i.length!==o.length)for(const t of i){const n=o.indexOf(t);-1!==n?o.splice(n,1):delete e[t]}}))}(za,n)),t&&this.#le.addEffect("cache/set",()=>this.#le.next(za.trim(t))),this.#he=new di}has(e){return e in this.#le.value}setItem(e,t){const{args:n,transaction:r,value:i}=t;this.#le.next(za.insert(e,{args:n,transaction:r,value:i})),this._registerEvent("query_cache_entry_inserted",{key:e,data:{value:i,args:n,transaction:r}})}getItem(e){return this.#le.value[e]}removeItem(e){this.#le.next(za.remove(e)),this._registerEvent("query_cache_entry_removed",{key:e})}invalidate(e){const t=e?this.#le.value[e]:void 0;this.#le.next(za.invalidate(e,t)),e&&this._registerEvent("query_cache_entry_invalidated",{key:e,data:{previousValue:t?.value}})}mutate(e,t){const n=e in this.#le.value?this.#le.value[e]:void 0;if(!n)throw new Error(`Cannot mutate cache item with key ${e}: item not found`);const r="function"==typeof t?t(n?.value):t;return this.#le.next(za.mutate(e,r,n)),this._registerEvent("query_cache_entry_mutated",{key:e,data:{previousValue:n.value,newValue:r,mutation:r}}),()=>this.#le.next(za.set(e,n))}trim(e){const t=new Set(Object.keys(this.#le.value));this.#le.next(za.trim(e));const n=new Set(Object.keys(this.#le.value)),r=Array.from(t).filter(e=>!n.has(e));this._registerEvent("query_cache_trimmed",{data:{removedKeys:r,criteria:e}})}reset(){this.#le.reset(),this._registerEvent("query_cache_reset")}complete(){this.#le.complete(),this.#he.complete()}}class Za extends di{key;args;options;#me=Date.now();get created(){return this.#me}#ge=hs();get uuid(){return this.#ge}constructor(e,t,n){super(),this.key=e,this.args=t,this.options=n}processJob(e){return e.pipe(Ji(t=>{const{key:n,uuid:r,created:i}=this;return{key:n,uuid:r,created:i,status:"complete",transaction:e.transaction,complete:t.completed,value:t.value}}),Eo(()=>{e.complete()})).subscribe(this)}}class Ka{type;key;data;constructor(e,t,n){this.type=e,this.key=t,this.data=n}}class Ya{static extractQueryValue=as;#pe=new zr;#fe;#ve;#ye=new di;#Ee={};#be;#we;#Le=hs();#se;get client(){return this.#fe}_registerEvent(e,t,n){this.#se.next(new Ka(e,t,n))}get cache(){return this.#ve}get event$(){return this.#se.asObservable()}constructor(e){this.#se=new di,this.#be=t=>ys(e.key(t),this.#Le),this.#we=e?.validate??((e=0)=>t=>(t.updated??0)+e>Date.now())(e?.expire),e.client instanceof Ha?this.#fe=e.client:(this.#fe=new Ha(e.client.fn,{...e.client.options}),this.#pe.add(()=>this.#fe.complete())),this.#pe.add(this.#fe.event$.subscribe({next:e=>this.#se.next(e)})),e.cache instanceof Wa?this.#ve=e.cache:(this.#ve=new Wa(e.cache||{}),this.#pe.add(()=>this.#ve.complete())),this.#pe.add(this.#ve.event$.subscribe({next:e=>this.#se.next(e)}));const t=((e="switch")=>"function"==typeof e?e:(()=>{switch(e){case"concat":return is;case"merge":return os;case"switch":return ss;default:throw new Error(`Invalid queue operator: ${e}`)}})())(e.queueOperator);var n,r;this.#pe.add(()=>this.#ye.complete()),this.#pe.add(this.#ye.pipe(So(e=>{this._registerEvent("query_queued",e)}),lo(e=>!!(e in this.#Ee)),t(e=>{const t=this.#Ee[e],{args:n,options:r,uuid:i}=t;if(this._registerEvent("query_job_selected",e,{taskId:i,args:n,options:r}),!t?.observed)return this._registerEvent("query_job_skipped",e,{taskId:i,args:n,options:r}),delete this.#Ee[e],Ci;const o=this.#fe.query(n,{...r,ref:t.uuid});return new si(s=>{const{transaction:a}=o;var c,l;this._registerEvent("query_job_started",e,{taskId:i,transaction:a,args:n,options:r}),s.add(()=>{this._registerEvent("query_job_closed",e,{taskId:i,transaction:a,args:n,options:r}),o.complete("task closed"),delete this.#Ee[e]}),s.add((c=10,void 0===l&&(l=Ii),co(c,c,l)).pipe(lo(()=>!t.observed)).subscribe(()=>{o.cancel(`task: ${t.uuid} is not observed`),s.complete()})),s.add(t.processJob(o).add(()=>{this._registerEvent("query_job_completed",e,{taskId:i,transaction:a,args:n,options:r})})),o.pipe(Ji(e=>({result:e,task:t})),uo(()=>Ci)).subscribe(s)})}),(n=()=>!this.#fe.closed,void 0===r&&(r=!1),ci(function(e,t){var i=0;e.subscribe(li(t,function(e){var o=n(e,i++);(o||r)&&t.next(e),!o&&t.complete()}))}))).subscribe(e=>{const{value:t,transaction:n}=e.result,{args:r,key:i,uuid:o}=e.task;this._registerEvent("query_cache_added",i,{data:t,taskId:o,args:r,transaction:n}),this._registerEvent("query_completed",i,{data:t,hasValidCache:!0}),this.#ve.setItem(i,{value:t,args:r,transaction:n})}))}query(e,t){return this._query(e,t)}queryAsync(e,t){const{skipResolve:n,...r}=t||{},i=n?Zi:Wi;return new Promise((n,o)=>{t?.signal&&t.signal.addEventListener("abort",()=>o(new Error("Query aborted"))),i(this._query(e,r).pipe(vo())).then(n,o)})}persistentQuery(e,t){const n=this.#be(e),r=this._query(e,t);return new si(i=>{i.add(r.subscribe({next:i.next.bind(i),error:i.error.bind(i)}));const o=t?.cache?.validate||this.#we;i.add(this.cache.state$.pipe(lo(e=>n in e),Ji(t=>({...t[n],key:n,status:"cache",hasValidCache:o(t[n],e)}))).subscribe(i))}).pipe(mo((e,t)=>e.transaction===t.transaction&&e.mutated===t.mutated))}generateCacheKey(e){return this.#be(e)}mutate(e,t,n){const r=this.#be(e);if(r in this.cache.state==!1){if(void 0===n?.allowCreation)throw new Error(`Cannot mutate cache item with key ${r}: item not found and option "allowCreation" is false`);if(!1===n.allowCreation)return()=>{};const{value:i}="function"==typeof t?t():t;this.cache.setItem(r,{args:e,transaction:hs(),value:i})}return this.#ve.mutate(r,t)}invalidate(e){this.#ve.invalidate(e&&this.#be(e))}complete(){this.#pe.unsubscribe(),this.#se?.complete()}onInvalidate(e){const t=this.#ve.action$.pipe($a("cache/invalidate")).subscribe(t=>e({detail:{item:t.meta.item}}));return()=>t.unsubscribe()}onMutate(e){const t=this.#ve.action$.pipe($a("cache/mutate")).subscribe(t=>e({detail:{changes:t.payload,current:t.meta.item}}));return()=>t.unsubscribe()}_query(e,t){const n=this.#be(e),r=this._createTask(n,e,t);return this._registerEvent("query_created",n,{args:e,options:t}),r}_createTask(e,t,n){return new si(r=>{if(n?.signal){if(n?.signal.aborted)return this._registerEvent("query_aborted",e),r.complete();r.add(so(n?.signal,"abort").subscribe(()=>{this._registerEvent("query_aborted",e),r.complete()}))}const i=this.#ve.getItem(e);if(i){this._registerEvent("query_cache_hit",e,{cacheEntry:i});const o=n?.cache?.suppressInvalid??!1,s=(n?.cache?.validate||this.#we)(i,t),a={...i,key:e,status:"cache",hasValidCache:s};if(r.next(a),s||o)return this._registerEvent("query_completed",e,{data:i.value,hasValidCache:s}),r.complete();this._registerEvent("query_cache_miss",e)}const o=e in this.#Ee;o?this._registerEvent("query_connected",e,{isExistingTask:!0}):(this.#Ee[e]=new Za(e,t,n),this._registerEvent("query_job_created",e,{taskId:this.#Ee[e].uuid,args:t,options:n}));const s=this.#Ee[e];r.add(s.subscribe(r)),o||this.#ye.next(e)})}}const Xa=R.object({key:R.string().describe("The key used to identify the service"),uri:R.string().describe("The URI of the service"),id:R.string().optional().describe("The ID of the service"),environment:R.string().optional().describe("The environment of the service"),name:R.string().optional().describe("The name of the service"),scopes:R.array(R.string()).optional().default([]).describe("Endpoint authentication scopes"),tags:R.array(R.string()).optional().describe("Tags for the service")}).describe("A service from the service discovery API").transform(e=>({...e,get defaultScopes(){return e.scopes??[]}})),Ja=R.array(Xa).describe("A list of services from the service discovery API");class Qa{#Ie;endpoint;http;constructor(e){this.http=e.http,this.endpoint=e.endpoint;const t=e.postProcess;this.#Ie=new Ya({client:{fn:()=>this.http.fetch$(this.endpoint??"",{selector:e=>((e,t)=>{const n=zi(Qo(e)).pipe(Ji(e=>Ja.default([]).parse(e)));return t?n.pipe(t):n})(e,t)})},key:()=>"services",expire:3e5})}resolveServices(e){return(e?Zi:Wi)(Ya.extractQueryValue(this.#Ie.query()))}async resolveService(e,t){const n=(await this.resolveServices(t)).find(t=>t.key===e);if(!n)throw Error(`Failed to resolve service, invalid key [${e}]`);return n}}class ec extends Do{async _createConfig(e,t){if(!e.hasModule("http"))throw new Error("http module is required");if(!this._has("discoveryClient")){(await e.requireInstance("http")).hasClient("service_discovery")&&this.configureServiceDiscoveryClientByClientKey("service_discovery")}return Wi(zi(super._createConfig(e,t)))}_processConfig(e,t){if(!e.discoveryClient)throw new Error("discoveryClient is required, please configure it");return super._processConfig(e,t)}setServiceDiscoveryClient(e){this._set("discoveryClient","function"==typeof e?e:async()=>e)}configureServiceDiscoveryClient(e){this.setServiceDiscoveryClient(async t=>{const{httpClient:n,endpoint:r}=await Wi(zi(e(t)))??{};if(n)return new Qa({http:n,endpoint:r,postProcess:Ji(e=>{const t="undefined"!=typeof globalThis?globalThis.sessionStorage:void 0;if(!t)return e;try{const n=JSON.parse(t.getItem("overriddenServiceDiscoveryUrls")||"{}");for(const[t,{url:r,scopes:i}]of Object.entries(n)){const n=e.find(e=>e.key===t);n&&(n.uri=r,n.scopes=i,n.overridden=!0)}}catch(e){console.error('Failed to JSON parse session overrides: "overriddenServiceDiscoveryUrls"',e)}return e})});throw Error("httpClient is required")})}configureServiceDiscoveryClientByClientKey(e,t){this.configureServiceDiscoveryClient(async({requireInstance:n})=>({httpClient:(await n("http")).createClient(e),endpoint:t}))}}class tc extends Ro{config;_http;constructor(e,t){super({version:"10.1.1",config:e}),this.config=e,this._http=t}get client(){return this.config.discoveryClient}resolveServices(){return this.config.discoveryClient.resolveServices()}async resolveService(e){return this.config.discoveryClient.resolveService(e)}async createClient(e,t){const n=await this.resolveService(e);if(!n)throw Error(`Could not load configuration of service [${e}]`);return this._http.createClient({...t,baseUri:n.uri,defaultScopes:n.scopes})}async configureClient(e,t){const{key:n,alias:r}="string"==typeof e?{key:e,alias:e}:e,{uri:i,scopes:o}=await this.resolveService(n);var s,a;t.addConfig((s=r,a={baseUri:i,defaultScopes:o},{module:rs,configure:e=>{e.configureClient(s,a)}}))}}const nc={name:"serviceDiscovery",configure:()=>new ec,initialize:async e=>{const{requireInstance:t,ref:n}=e,r=await e.config.createConfigAsync(e,{...n?.serviceDiscovery?.config}),i=await t("http");return new tc(r,i)}},rc=(e,t)=>{e.addConfig((e=>({module:nc,configure:t=>e(t)}))(()=>Promise.resolve()))};var ic,oc,sc,ac={},cc=[{name:"Agola CI",constant:"AGOLA",env:"AGOLA_GIT_REF",pr:"AGOLA_PULL_REQUEST_ID"},{name:"Alpic",constant:"ALPIC",env:"ALPIC_HOST"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE",pr:{env:"AC_GIT_PR",ne:"false"}},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN",pr:{env:"CODEBUILD_WEBHOOK_EVENT",any:["PULL_REQUEST_CREATED","PULL_REQUEST_UPDATED","PULL_REQUEST_REOPENED"]}},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"TF_BUILD",pr:{BUILD_REASON:"PullRequest"}},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Cloudflare Pages",constant:"CLOUDFLARE_PAGES",env:"CF_PAGES"},{name:"Cloudflare Workers",constant:"CLOUDFLARE_WORKERS",env:"WORKERS_CI"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Earthly",constant:"EARTHLY",env:"EARTHLY_CI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"Gitea Actions",constant:"GITEA_ACTIONS",env:"GITEA_ACTIONS"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"Prow",constant:"PROW",env:"PROW_JOB_ID"},{name:"ReleaseHub",constant:"RELEASEHUB",env:"RELEASE_BUILD_ID"},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Sourcehut",constant:"SOURCEHUT",env:{CI_NAME:"sourcehut"}},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vela",constant:"VELA",env:"VELA",pr:{VELA_PULL_REQUEST:"1"}},{name:"Vercel",constant:"VERCEL",env:{any:["NOW_BUILDER","VERCEL"]},pr:"VERCEL_GIT_PULL_REQUEST_ID"},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"},{name:"Woodpecker",constant:"WOODPECKER",env:{CI:"woodpecker"},pr:{CI_BUILD_EVENT:"pull_request"}},{name:"Xcode Cloud",constant:"XCODE_CLOUD",env:"CI_XCODE_PROJECT",pr:"CI_PULL_REQUEST_NUMBER"},{name:"Xcode Server",constant:"XCODE_SERVER",env:"XCS"}];function lc(){return ic||(ic=1,function(e){const t=cc,n=process.env;function r(e){return"string"==typeof e?!!n[e]:"env"in e?n[e.env]&&n[e.env].includes(e.includes):"any"in e?e.any.some(function(e){return!!n[e]}):Object.keys(e).every(function(t){return n[t]===e[t]})}Object.defineProperty(e,"_vendors",{value:t.map(function(e){return e.constant})}),e.name=null,e.isPR=null,e.id=null,"false"!==n.CI&&t.forEach(function(t){const i=(Array.isArray(t.env)?t.env:[t.env]).every(function(e){return r(e)});e[t.constant]=i,i&&(e.name=t.name,e.isPR=function(e){switch(typeof e.pr){case"string":return!!n[e.pr];case"object":return"env"in e.pr?"any"in e.pr?e.pr.any.some(function(t){return n[e.pr.env]===t}):e.pr.env in n&&n[e.pr.env]!==e.pr.ne:"any"in e.pr?e.pr.any.some(function(e){return!!n[e]}):r(e.pr);default:return null}}(t),e.id=t.constant)}),e.isCI=!("false"===n.CI||!(n.BUILD_ID||n.BUILD_NUMBER||n.CI||n.CI_APP_ID||n.CI_BUILD_ID||n.CI_BUILD_NUMBER||n.CI_NAME||n.CONTINUOUS_INTEGRATION||n.RUN_ID||e.name))}(ac)),ac}var uc,fc=V(sc?oc:(sc=1,oc=lc().isCI));!function(e){e.ContinuesIntegration="ci",e.QualityAssurance="fqa",e.Training="tr",e.Production="fprd",e.Development="dev"}(uc||(uc={}));const dc=["5a842df8-3238-415d-b168-9f16a6a6031b/.default"],pc=e=>{const t=new Uo,n=e.env??uc.ContinuesIntegration;t.addConfig({module:rs,configure:t=>{const r=n===uc.Development?uc.ContinuesIntegration:n,i=e.serviceDiscovery?.url??new URL(`/service-registry/environments/${r}/services`,"https://discovery.fusion.equinor.com").toString(),o=e.serviceDiscovery?.scope??dc;t.configureClient("service_discovery",{baseUri:i,defaultScopes:o})}}),rc(t);const{auth:r}=e;return q(t,e=>{if("defaultCredential"in r&&r.defaultCredential)return void e.setDefaultCredential();if("token"in r&&r.token)return void e.setTokenOnly(r.token);const{clientId:t,tenantId:n}=r;if(!t||!n)throw new Error("clientId and tenantId are required for auth module");if("interactive"in r&&r.interactive){const{server:i}=r;if(!i.port)throw new Error("server.port is required for interactive mode");return void e.setInteractive({tenantId:n,clientId:t,redirectPort:i.port,onOpen:i.onOpen})}fc?e.setDefaultCredential():e.setInteractive({tenantId:n,clientId:t,redirectPort:49741})}),t},hc=async(e,t)=>{const n=pc(e);t&&t(n);return await n.initialize()},mc=e=>{const t=e.getEntry("metadata.json");if(!t)throw new Error("Metadata file not found in bundle");return new Promise((e,n)=>{t.getDataAsync((t,r)=>{if(r)return n(new Error("Failed to read metadata file",{cause:r}));try{return e(JSON.parse(String(t)))}catch(e){n(new Error("Failed to parse metadata file",{cause:e}))}})})},gc=async e=>{const{log:t,bundle:n}=e;let r;if(n)try{t?.info("ðïļ","Using artifact-based validation from bundle:",n);const e=new Mn(n),i=await(async e=>{const t=await mc(e);if(!t.appKey||"string"!=typeof t.appKey||""===t.appKey.trim())throw new Error("App manifest is missing required appKey field");return t})(e);r=i.appKey,t?.info("ðĶ",`Resolved app key "${r}" from bundle artifact`)}catch(e){return t?.fail("ðŦ","Failed to resolve app information from bundle:",e instanceof Error?e.message:String(e)),!1}else{t?.info("ð","Using traditional validation from local project files");const e=await Zt(t);r=(await Wt({command:"build",mode:"production"},e,{log:t})).appKey}t?.start("Initializing Fusion Framework...");const i=await hc({env:e.environment,auth:"token"in e.auth?{token:e.auth.token}:e.auth});t?.succeed("Initialized Fusion Framework");try{const e=await i.serviceDiscovery.createClient("apps");e.request$.subscribe(e=>{t?.info("ð","Executing request to:",e.uri),t?.debug("Request:",e)}),t?.info("Checking if",r,"is registered in app store");const n=await e.fetch(`/apps/${r}`,{method:"HEAD",headers:sr});if(n.ok)return t?.succeed("ð",`Application ${r} is registered in app store`),!0;if(404===n.status)return t?.fail("ð",`Application ${r} is not registered in app store`),!1;if(410===n.status)return t?.fail("ð",`Application ${r} is deleted from app store`),!1;const o=fr(n.status,`check registration for ${r}`);throw o&&(t?.fail("ð",`Authentication/authorization error checking ${r}`),t?.error(o),process.exit(1)),new Error(`Unexpected response status: ${n.status}`)}catch(e){const n=hr(e,`check registration for ${r}`);return n&&(t?.fail("ð",`Token acquisition failed checking ${r}`),t?.error(n),process.exit(1)),t?.fail("ð
ââïļ","Error checking application registration"),t?.error("Error checking application registration:",e instanceof Error?e.message:e),!1}};const vc=async e=>{const{log:t,framework:n}=e,i="string"==typeof e.fileOrBundle?new Mn(e.fileOrBundle):e.fileOrBundle,{appKey:o}=e.appKey?{appKey:e.appKey}:await mc(i).catch(e=>{t?.error("Failed to resolve manifest:",e),process.exit(1)});t?.info("ðĶ",`Uploading application bundle for ${r.bold(o)}`);const s=(await i.getEntries()).map(e=>e.entryName);t?.debug("Bundle contents:",s);const a=await i.toBufferPromise().catch(e=>{t?.error("Failed to read bundle content:",e),process.exit(1)});try{const e=await n.serviceDiscovery.createClient("apps");e.request$.subscribe(e=>{t?.info("ð","Executing request to:",e.uri),t?.debug("Request:",e)});const i=await e.fetch(`/bundles/apps/${o}`,{method:"POST",body:new Blob([a],{type:"application/zip"}),headers:{...sr,"Content-Type":"application/zip"}});if(!i.ok){try{const{error:e}=await i.json();t?.debug("Error:",e),e.message&&t?.warn(r.red(`ðĪŊ error: ${e.code}\n`),r.yellowBright(e.message),"\n")}catch(e){t?.debug("Error:",i.statusText)}!function(e,t,n){const r=fr(e.status,`upload bundle for ${t}`);let i;switch(r&&(n?.fail("ð",`Authentication/authorization error uploading ${t}`),n?.error(r),process.exit(1)),e.status){case 409:i=`${e.status} - Version is already published, please generate a new release`;break;case 410:i=`${e.status} - ${t} is removed from Fusion app store`;break;case 404:i=`${e.status} - ${t} not found, please add your application in App Admin before publishing`;break;case 500:i=`${e.status} - Internal server error, please try again later or contact support`;break;default:i=`Failed to upload bundle. HTTP status ${e.status}, ${e.statusText}`}n?.fail("ð
ââïļ",i),process.exit(1)}(i,o,t)}t?.succeed("Successfully uploaded application bundle"),t?.debug("Response:",i);try{return{appKey:o,version:(await i.json()).version}}catch(e){t?.fail("ð
ââïļ",`Failed to parse response from app service: ${e instanceof Error?e.message:e}`),process.exit(1)}}catch(e){const n=hr(e,`upload bundle for ${o}`);n&&(t?.fail("ð",`Token acquisition failed uploading ${o}`),t?.error(n),process.exit(1)),t?.fail("ð
ââïļ","Failed to upload application bundle"),t?.error(e instanceof Error?e.message:e),process.exit(1)}},yc=async e=>{const{tag:t,appKey:n,version:i,framework:o,log:s}=e;t&&"string"==typeof t&&0!==t.trim().length||(s?.fail("ðĪŠ","Tag must be a non-empty string."),process.exit(1)),/^[a-zA-Z0-9.-]+$/.test(t)||(s?.fail("ðĪŠ",'Invalid tag. Use "latest", "preview" or string [a-z, A-Z, 0-9, ".", "-"].'),process.exit(1)),n||(s?.fail("ðĪŠ","Application key is required."),process.exit(1)),i||(s?.fail("ðĪŠ","Version is required."),process.exit(1));try{const e=await o.serviceDiscovery.createClient("apps");e.request$.subscribe(e=>{s?.debug("Request:",e),s?.info("ð","Executing request to:",Vt(e.uri))}),s?.start("Publishing application config");const a=await e.json(`/apps/${n}/tags/${t}`,{method:"PUT",body:{version:i},headers:sr});return s?.debug("Response:",a),s?.succeed("Tagged application successfully",r.greenBright(`${n}@${i} - ${t}`)),a}catch(e){if(e instanceof Lr)switch(e.response.status){case 410:s?.fail("ðĪŽ",`App ${n} is deleted from apps-service. Please check the app key and try again.`);break;case 404:s?.fail("ðĪŽ",`App ${n} not found. Please check the app key and try again.`);break;case 403:case 401:{const t=fr(e.response.status,`tag ${n}@${i}`);s?.fail("ð","Authentication/authorization error tagging application."),t&&s?.error(t),process.exit(1);break}default:s?.fail("ðĪŽ","Failed to tag application",`Status code: ${e.response.status}`,`Error: ${e.message}`)}const t=hr(e,`tag ${n}@${i}`);t&&(s?.fail("ð",`Token acquisition failed tagging ${n}@${i}`),s?.error(t),process.exit(1)),s?.fail("ðĪŽ","Failed to tag application:",e instanceof Error?e.message:String(e)),process.exit(1)}},Ec=x.object({templateEntry:x.string({message:"templateEntry must be a string"}).describe("Main entry point for the portal"),schemaEntry:x.string({message:"schemaEntry must be a string"}).describe("Schema file for portal validation"),assetPath:x.string({message:"assetPath must be a string"}).optional().describe("Asset path for dev/preview builds"),githubRepo:x.string({message:"githubRepo must be a string"}).optional().describe("GitHub repo URL or local git remote"),version:x.string({message:"version must be a string"}).describe("Version from package.json"),timestamp:x.string({message:"timestamp must be a string"}).describe("Current build timestamp (ISO8601)"),commitSha:x.string({message:"commitSha must be a string"}).describe("Current git commit SHA"),annotations:x.record(x.string(),x.string().nullish()).optional().transform(e=>{if(!e)return;const t=Object.entries(e).filter(([,e])=>void 0!==e);return Object.fromEntries(t)}).describe("Optional build annotations"),projectPage:x.string({message:"projectPage must be a string"}).optional().describe("Optional project homepage"),allowedExtensions:x.array(x.string({message:"Each allowed extension must be a string"}),{message:"allowedExtensions must be an array of strings"}).describe("List of allowed asset extensions (with leading dot)"),schema:x.record(x.string(),x.unknown()).optional().describe("Optional schema for the portal"),config:x.record(x.string(),x.unknown()).optional().describe("Optional configuration for the portal")}),bc=x.object({name:x.string({message:"name must be a string"}).describe("Short app key (unscoped, derived from package name)"),displayName:x.string({message:"displayName must be a string"}).optional().describe("Full package name, may include scope"),description:x.string({message:"description must be a string"}).optional().describe("Description of the portal"),build:Ec}),wc=(e,t)=>{xt(t,"expected packageJson"),P(t.name,"expected [name] in packageJson"),P(t.version,"expected [version] in packageJson");const n=((e,t)=>"build"===e.command||e.isPreview?t.main||t.module||"dist/bundle.js":lt(e.root))(e,t),r=t.name.replace(/^@|\w.*\//gm,""),i=t.version,o="build"===e.command?void 0:"/@fs",s=Tt(t)??kt(),a=jt.map(e=>`.${e}`),c={name:r,displayName:t.name,description:t.description||"",build:{templateEntry:n,schemaEntry:"portal.schema.json",assetPath:o,githubRepo:s,version:i,timestamp:(new Date).toISOString(),commitSha:Ft(),annotations:{...Gt()},projectPage:t.homepage,allowedExtensions:a}},l=bc.safeParse(c);if(!l.success){const e=l.error.issues.map(e=>`- ${e.path.join(".")}: ${e.message}`).join("\n");throw new Error(["Invalid portal manifest generated from package.json:",e].join("\n"))}return l.data},Lc=async(e,t,n)=>{const i=wc(e,t.packageJson);try{n?.log?.start("loading manifest...");const t=await(async(e,t)=>{const n=t?.file??[`portal.manifest.${e.environment}`,"portal.manifest"],r=await S(n,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async n=>{const r=t?.base??{};let i;return i="function"==typeof n.default?await n.default(e,{base:r})??void 0:n.default,i?_(r,i):r}}}),i=r.config,o=bc.safeParse(i);if(!o.success){const e=o.error.issues.map(e=>`${e.path.join(".")}: ${e.message}`).join("; ");throw new Error(`Invalid portal manifest: ${e}`)}return{manifest:i,path:r.path,extension:r.extension}})(e,{base:i});return n?.log?.succeed("generated manifest from",Vt(t.path,{relative:!0})),t.manifest}catch(e){if(e instanceof C){if(n?.manifestPath){const t=new Error(`Failed to load manifest file ${Vt(n.manifestPath)}, please check the path.`,{cause:e});throw n?.log?.fail(t.message),t}return n?.log?.succeed(r.dim("no local manifest config applied, using default generated from package")),i}throw n?.log?.fail(`failed to resolve application manifest ${n?.manifestPath?Vt(n?.manifestPath):""}`),e}},Ic=async(e,t)=>{const{log:n}=t;try{n?.start("create portal configuration"),n?.info(`generating config with ${r.red.dim(e.command)} command in ${r.green.dim(e.mode)} mode`);const i=await((e,t)=>{const n=t?.file??[`portal.config.${e.environment}`,"portal.config"];return S(n,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async n=>{const r=t?.schema??R.object({}).passthrough(),i=t?.base??{};if("function"==typeof n.default){const t=await n.default(i,e)??i;return r.parse(t)}return r.parse(n.default??i)}}})})(e,{file:t?.config});return n?.succeed("âïļ generated config from ",Vt(i.path,{relative:!0})),i.config}catch(e){if(e instanceof C){if(!t.config)return n?.succeed(r.dim("âïļ no local portal config applied, using built-in")),{};n?.warn(`failed to load config file ${Vt(t.config)}, please check the path.`)}throw n?.fail("failed to resolve portal config"),n?.debug(e),e}},Sc=async e=>{const{log:n}=e??{},r=await Zt(n),i={root:r.root,environment:"local",...e?.env,mode:"development",command:"serve"},o=await Lc(i,r,{log:n,manifestPath:e?.manifest}),s=await Ic(i,{log:n,config:e?.config}),a=t(await Rt(i,r),{server:{port:e?.server?.port,fs:{allow:[r.root]}}}),c={template:{portal:{id:o.name}},portal:{manifest:o,config:s}};n?.debug("vite config:",a),n?.debug("dev server config:",c),n?.start("Starting app development server...");const l=await ir(i,c,{overrides:a,log:n});return await l.listen(),n?.succeed(`Started app development server on ${l.resolvedUrls?.local?.[0]}`),l},Cc=async e=>{const{log:n,dir:r,port:i=4173,host:o="localhost"}=e??{};n?.log("Starting to serve portal");const s=await Zt(n);n?.start("Loading Vite config...");const c=await Rt({root:s.root,command:"build",mode:"production"},s);n?.succeed("Vite config loaded");const l=r||(c.build?.outDir||"dist"),u=a(s.root,l),f={root:s.root,environment:"local",mode:"production",command:"serve",isPreview:!0},d=await Lc(f,s,{log:n,manifestPath:e?.manifest}),p=await Ic(f,{log:n,config:e?.config});if(n?.debug("Output directory:",u),!w(u))throw new Error(`Build directory does not exist: ${u}\nPlease build the portal first using \`ffc portal build\``);d.build.assetPath=void 0,d.build.templateEntry=`/${d.build.templateEntry}`;const h=await Rt(f,s),m=t(h,{server:{port:i,host:o||h.server?.host||"localhost",fs:{allow:[s.root,u]}}}),g={template:{portal:{id:d.name}},portal:{manifest:d,config:p}};n?.debug("vite config:",m),n?.debug("dev server config:",g),n?.start("Starting preview server...");try{const e=await ir(f,g,{overrides:m,log:n});await e.listen(),n?.succeed("Preview server started successfully");const t=e.config.server?.https?"https":"http",r=e.config.server?.host||o,s=e.config.server?.port||i;return n?.info(`Preview server is running at: ${t}://${r}:${s}`),e}catch(e){throw n?.fail("Failed to start preview server"),e}},_c=async e=>{const{log:t}=e??{},n=await Zt(t);t?.debug("package",n);const r={command:"build",mode:process.env.NODE_ENV??"production",root:n.root,...e?.env};t?.debug("env:",r);const i=await Lc(r,n,{log:t,manifestPath:e?.manifest});return t?.debug("manifest:",i),{manifest:i,pkg:n,env:r}},Dc=async e=>{const{log:t}=e??{};t?.log(r.bold("Starting to build portal"));const{manifest:i,pkg:o,env:s}=await _c({log:t,manifest:e?.manifest});t?.start("loading vite config...");const a=await Rt(s,o);t?.succeed("vite config applied"),t?.debug("vite config:",a),t?.start("ðĪðŧ","building portal..."),t?.startNativeConsoleCapture(),await n(a),t?.stopNativeConsoleCapture(),t?.succeed("build completed ð");return{pkg:o,manifest:i,outDir:a.build.outDir}},Pc=async e=>{const{log:t,manifest:n}=e,r={command:"build",mode:process.env.NODE_ENV??"production",environment:null,root:process.cwd()},{pkg:i,manifest:o}=await Dc({log:t,manifest:n});if(!o.build)throw new Error("Manifest build config not found");const s=await(async(e,t)=>{const n=t?.file??[`portal.schema.${e.environment}`,"portal.schema"],r=await S(n,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async t=>{const n="function"==typeof t.default?await Promise.resolve(t.default(e)):t.default;if(!n)throw new Error("Schema function did not return a valid schema");return n}}});return{schema:r.config,path:r.path,extension:r.extension}})(r,{file:e?.schema});t?.debug("Schema:",s);return{archive:await vr(i,{log:t,archive:e?.archive,content:{"portal-template-manifest.json":JSON.stringify(o.build,null,2),"portal.schema.json":JSON.stringify(s.schema,null,2),"metadata.json":JSON.stringify({name:o.name,version:o.build.version})}}).catch(e=>{t?.error("Failed to create package:",e),process.exit(1)}),manifest:o,schema:s.schema}},Nc=async e=>{const{log:t}=e??{},n=await Zt(t),r={command:"build",mode:process.env.NODE_ENV??"production",root:n.root,...e?.env},i=await Ic(r,{log:t,config:e?.config});if(t?.debug("config:",i),e?.output){t?.start("writing config to file");try{await mr(e.output,JSON.stringify(i,null,2)),t?.succeed("config written successfully",Vt(e.output,{relative:!0}))}catch(e){throw t?.fail("failed to write config"),e}}return{config:i,pkg:n}},Oc=async e=>{const{log:t,portal:n}=e,{config:i}=await Nc({log:t,config:e.config,env:{environment:e.environment}});t?.start("Initializing Fusion Framework...");const o=await hc({env:e.environment,auth:e.auth});t?.succeed("Initialized Fusion Framework");try{const s=await o.serviceDiscovery.createClient("portals");s.request$.subscribe(e=>{t?.debug("Request:",e),t?.info("ð","Executing request to:",Vt(e.uri))}),t?.start("Publishing portal config"),t?.info("Using environment:",r.redBright(e.environment));const a=await s.json(`/portals/${n.name}@${n.version}/config`,{method:"PUT",body:i,headers:sr});t?.debug("Response:",a),t?.succeed("Published portal config")}catch(e){if(e instanceof Lr)switch(e.response.status){case 410:t?.fail("ðĪŽ",`Portal ${n.name} is deleted from portals-service. Please check the portal key and try again.`);break;case 404:t?.fail("ðĪŽ",`Portal ${n.name} not found. Please check the portal key and try again.`);break;case 403:case 401:{const r=fr(e.response.status,`publish config for portal ${n.name}`);t?.fail("ð","Authentication/authorization error publishing portal config."),r&&t?.error(r),process.exit(1);break}default:t?.fail("ðĪŽ","Failed to publish portal config.",`Status code: ${e.response.status}`,`Message: ${e.response.statusText}`)}const r=hr(e,`publish config for portal ${n.name}`);r&&(t?.fail("ð",`Token acquisition failed publishing config for ${n.name}`),t?.error(r),process.exit(1)),t?.fail("ðĪŽ","Failed to publish portal config:",e instanceof Error?e.message:String(e)),process.exit(1)}};const Ac=async e=>{const{log:t,framework:n}=e,i="string"==typeof e.fileOrBundle?new Mn(e.fileOrBundle):e.fileOrBundle,{name:o}=e.name?{name:e.name}:await mc(i).catch(e=>{t?.error("Failed to resolve manifest:",e),process.exit(1)}),s=await i.toBufferPromise().catch(e=>{t?.error("Failed to read bundle content:",e),process.exit(1)});try{const e=await n.serviceDiscovery.createClient("portal-config");e.request$.subscribe(e=>{t?.info("ð","Executing request to:",e.uri),t?.debug("Request:",e)});const i=await e.fetch(`/bundles/templates/${o}`,{method:"POST",body:new Blob([s],{type:"application/zip"}),headers:{...sr,"Content-Type":"application/zip"}});if(!i.ok){try{const{error:e}=await i.json();t?.debug("Error:",e),e.message&&t?.warn(r.red(`ðĪŊ error: ${e.code}\n`),r.yellowBright(e.message),"\n")}catch(e){t?.debug("Error:",i.statusText)}!function(e,t,n){const r=fr(e.status,`upload portal bundle for ${t}`);let i;switch(r&&(n?.fail("ð",`Authentication/authorization error uploading ${t}`),n?.error(r),process.exit(1)),e.status){case 409:i=`${e.status} - Version is already published, please generate a new release`;break;case 410:i=`${e.status} - ${t} is removed from Fusion`;break;case 404:i=`${e.status} - ${t} not found`;break;case 500:i=`${e.status} - Internal server error, please try again later or contact support`;break;default:i=`Failed to upload bundle. HTTP status ${e.status}, ${e.statusText}`}n?.fail("ð
ââïļ",i),process.exit(1)}(i,o,t)}t?.succeed("Successfully uploaded portal bundle"),t?.debug("Response:",i)}catch(e){const n=hr(e,`upload portal bundle for ${o}`);n&&(t?.fail("ð",`Token acquisition failed uploading ${o}`),t?.error(n),process.exit(1)),t?.fail("ð
ââïļ","Failed to upload portal bundle"),t?.error(e instanceof Error?e.message:e),process.exit(1)}},$c=async e=>{const{tag:t,name:n,version:i,framework:o,log:s}=e;t&&"string"==typeof t&&0!==t.trim().length||(s?.fail("ðĪŠ","Tag must be a non-empty string."),process.exit(1)),/^[a-zA-Z0-9.-]+$/.test(t)||(s?.fail("ðĪŠ",'Invalid tag. Use "latest", "preview" or string [a-z, A-Z, 0-9, ".", "-"].'),process.exit(1)),n||(s?.fail("ðĪŠ","Portal name is required."),process.exit(1)),i||(s?.fail("ðĪŠ","Version is required."),process.exit(1)),s?.info("Tagging portal:",r.greenBright(`${n}@${t}`,i));try{const e=await o.serviceDiscovery.createClient("portal-config");e.request$.subscribe(e=>{s?.debug("Request:",e),s?.info("ð","Executing request to:",Vt(e.uri))}),s?.start("Tagging portal template...");const r=await e.json(`/templates/${n}/tags/${t}`,{method:"PUT",body:{version:i},headers:sr});s?.debug("Response:",r),s?.succeed("Tagged portal template successfully"),s?.info("ð",JSON.stringify(r))}catch(e){if(e instanceof Lr){const{data:t,response:o}=e;switch(s?.debug("Error:",t),t&&s?.warn(r.red(`ðĪŊ error: ${t.code}\n`),r.yellowBright(t.message),"\n"),o?.status){case 410:s?.fail(`ðĪŽ - ${o?.status} -`,`${n} is deleted. Please check the name and try again.`);break;case 404:s?.fail(`ðĪŽ - ${o?.status} -`,`${n} not found. Please check the name and try again.`);break;case 403:case 401:{const e=fr(o?.status??401,`tag portal ${n}@${i}`);s?.fail("ð","Authentication/authorization error tagging portal."),e&&s?.error(e),process.exit(1);break}default:s?.fail(`ðĪŽ - ${o?.status} -`,"Failed to tag",`Error: ${e.message}`)}}const t=hr(e,`tag portal ${n}@${i}`);t&&(s?.fail("ð",`Token acquisition failed tagging ${n}@${i}`),s?.error(t),process.exit(1)),s?.fail("ðĪŽ","Failed to tag portal:",e instanceof Error?e.message:String(e)),process.exit(1)}},Rc=e=>e&&!fc?uc.Development:uc.ContinuesIntegration;export{Qn as ConsoleLogger,uc as FusionEnv,Yt as buildApplication,Dc as buildPortal,yr as bundleApp,Pc as bundlePortal,gc as checkApp,pc as configureFramework,br as generateApplicationConfig,Nc as generatePortalConfig,hc as initializeFramework,Kt as loadAppManifest,_c as loadPortalManifest,vr as pack,Cr as publishAppConfig,Oc as publishPortalConfig,Rc as resolveDefaultEnv,Dr as serveApplication,Cc as servePortal,_r as startAppDevServer,Sc as startPortalDevServer,yc as tagApplication,$c as tagPortal,vc as uploadApplication,Ac as uploadPortalBundle};
|