@nutrient-sdk/document-authoring 1.4.0 → 1.5.0

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/ACKNOWLEDGEMENTS CHANGED
@@ -562,7 +562,7 @@ limitations under the License.
562
562
 
563
563
  ---
564
564
 
565
- The following software may be included in this product: @react-aria/actiongroup, @react-aria/breadcrumbs, @react-aria/button, @react-aria/calendar, @react-aria/checkbox, @react-aria/color, @react-aria/combobox, @react-aria/datepicker, @react-aria/dialog, @react-aria/dnd, @react-aria/focus, @react-aria/form, @react-aria/grid, @react-aria/gridlist, @react-aria/interactions, @react-aria/link, @react-aria/listbox, @react-aria/live-announcer, @react-aria/menu, @react-aria/numberfield, @react-aria/overlays, @react-aria/radio, @react-aria/searchfield, @react-aria/select, @react-aria/selection, @react-aria/slider, @react-aria/switch, @react-aria/table, @react-aria/tabs, @react-aria/tag, @react-aria/textfield, @react-aria/toggle, @react-aria/toolbar, @react-aria/tooltip, @react-aria/visually-hidden, @react-stately/color, @react-stately/utils, @react-types/color, @react-types/shared, @react-types/tabs, react-aria, react-stately
565
+ The following software may be included in this product: @internationalized/date, @internationalized/message, @internationalized/number, @internationalized/string, @react-aria/actiongroup, @react-aria/breadcrumbs, @react-aria/button, @react-aria/calendar, @react-aria/checkbox, @react-aria/color, @react-aria/combobox, @react-aria/datepicker, @react-aria/dialog, @react-aria/dnd, @react-aria/focus, @react-aria/form, @react-aria/grid, @react-aria/gridlist, @react-aria/i18n, @react-aria/interactions, @react-aria/link, @react-aria/listbox, @react-aria/live-announcer, @react-aria/menu, @react-aria/numberfield, @react-aria/overlays, @react-aria/radio, @react-aria/searchfield, @react-aria/select, @react-aria/selection, @react-aria/slider, @react-aria/ssr, @react-aria/switch, @react-aria/table, @react-aria/tabs, @react-aria/tag, @react-aria/textfield, @react-aria/toggle, @react-aria/toolbar, @react-aria/tooltip, @react-aria/visually-hidden, @react-stately/color, @react-stately/utils, @react-types/color, @react-types/shared, @react-types/tabs, react-aria, react-stately
566
566
  This software contains the following license and notice below:
567
567
 
568
568
  Apache License
@@ -10255,6 +10255,32 @@ that were granted to the IJG for code derived from their software.
10255
10255
 
10256
10256
  =============================================================
10257
10257
 
10258
+ ## magic_enum (https://github.com/Neargye/magic_enum)
10259
+
10260
+ MIT License
10261
+
10262
+ Copyright (c) 2019 - 2024 Daniil Goncharov
10263
+
10264
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10265
+ of this software and associated documentation files (the "Software"), to deal
10266
+ in the Software without restriction, including without limitation the rights
10267
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10268
+ copies of the Software, and to permit persons to whom the Software is
10269
+ furnished to do so, subject to the following conditions:
10270
+
10271
+ The above copyright notice and this permission notice shall be included in all
10272
+ copies or substantial portions of the Software.
10273
+
10274
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10275
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10276
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
10277
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
10278
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
10279
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
10280
+ SOFTWARE.
10281
+
10282
+ =============================================================
10283
+
10258
10284
  ## musl-emscripten (https://github.com/kripken/musl-emscripten)
10259
10285
 
10260
10286
  musl as a whole is licensed under the following standard MIT license:
@@ -11345,7 +11371,7 @@ zlib.h -- interface of the 'zlib' general purpose compression library
11345
11371
 
11346
11372
  ## PorterTokenizer (https://github.com/mozilla/releases-comm-central/blob/master/mailnews/extensions/fts3/src/Normalize.c)
11347
11373
 
11348
- Modified file can be obtained by emailing legal@pspdfkit.com
11374
+ Modified file can be obtained by emailing legal@nutrient.io
11349
11375
 
11350
11376
  This Source Code Form is subject to the terms of the Mozilla Public
11351
11377
  License, v. 2.0. If a copy of the MPL was not distributed with this
package/README.md CHANGED
@@ -78,7 +78,7 @@ the SDK via `npm`).
78
78
 
79
79
  ### Example
80
80
 
81
- You can download an example project demoing both TypeScript and JavaScript integration from [here](https://document-authoring.cdn.nutrient.io/releases/document-authoring-1.4.0-example.zip), unzip it and run:
81
+ You can download an example project demoing both TypeScript and JavaScript integration from [here](https://document-authoring.cdn.nutrient.io/releases/document-authoring-1.5.0-example.zip), unzip it and run:
82
82
 
83
83
  ```bash
84
84
  npm install
@@ -92,7 +92,7 @@ By default, the Document Authoring SDK will fetch the required files (fonts, emo
92
92
 
93
93
  ### Self-hosting the assets
94
94
 
95
- To host the assets on your own infrastructure you can download them from [here](https://document-authoring.cdn.nutrient.io/releases/document-authoring-1.4.0-assets.zip) and deploy them to a suitable location.
95
+ To host the assets on your own infrastructure you can download them from [here](https://document-authoring.cdn.nutrient.io/releases/document-authoring-1.5.0-assets.zip) and deploy them to a suitable location.
96
96
  Provide an appropriate base path when initializing the Document Authoring SDK.
97
97
 
98
98
  #### Example:
package/lib/cli.js CHANGED
@@ -1,43 +1,40 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var ns=Object.create;var jt=Object.defineProperty;var is=Object.getOwnPropertyDescriptor;var os=Object.getOwnPropertyNames;var ss=Object.getPrototypeOf,as=Object.prototype.hasOwnProperty;var ge=(g,i)=>()=>(i||g((i={exports:{}}).exports,i),i.exports);var ls=(g,i,l,a)=>{if(i&&typeof i=="object"||typeof i=="function")for(let d of os(i))!as.call(g,d)&&d!==l&&jt(g,d,{get:()=>i[d],enumerable:!(a=is(i,d))||a.enumerable});return g};var Ar=(g,i,l)=>(l=g!=null?ns(ss(g)):{},ls(i||!g||!g.__esModule?jt(l,"default",{value:g,enumerable:!0}):l,g));var Me=ge(Sr=>{var tr=class extends Error{constructor(i,l,a){super(a),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=l,this.exitCode=i,this.nestedError=void 0}},Or=class extends tr{constructor(i){super(1,"commander.invalidArgument",i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Sr.CommanderError=tr;Sr.InvalidArgumentError=Or});var nr=ge(Fr=>{var{InvalidArgumentError:ms}=Me(),Pr=class{constructor(i,l){switch(this.description=l||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,i[0]){case"<":this.required=!0,this._name=i.slice(1,-1);break;case"[":this.required=!1,this._name=i.slice(1,-1);break;default:this.required=!0,this._name=i;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(i,l){return l===this.defaultValue||!Array.isArray(l)?[i]:l.concat(i)}default(i,l){return this.defaultValue=i,this.defaultValueDescription=l,this}argParser(i){return this.parseArg=i,this}choices(i){return this.argChoices=i.slice(),this.parseArg=(l,a)=>{if(!this.argChoices.includes(l))throw new ms(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(l,a):l},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function vs(g){let i=g.name()+(g.variadic===!0?"...":"");return g.required?"<"+i+">":"["+i+"]"}Fr.Argument=Pr;Fr.humanReadableArgName=vs});var xr=ge(Gt=>{var{humanReadableArgName:gs}=nr(),Tr=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(i){let l=i.commands.filter(d=>!d._hidden),a=i._getHelpCommand();return a&&!a._hidden&&l.push(a),this.sortSubcommands&&l.sort((d,p)=>d.name().localeCompare(p.name())),l}compareOptions(i,l){let a=d=>d.short?d.short.replace(/^-/,""):d.long.replace(/^--/,"");return a(i).localeCompare(a(l))}visibleOptions(i){let l=i.options.filter(d=>!d.hidden),a=i._getHelpOption();if(a&&!a.hidden){let d=a.short&&i._findOption(a.short),p=a.long&&i._findOption(a.long);!d&&!p?l.push(a):a.long&&!p?l.push(i.createOption(a.long,a.description)):a.short&&!d&&l.push(i.createOption(a.short,a.description))}return this.sortOptions&&l.sort(this.compareOptions),l}visibleGlobalOptions(i){if(!this.showGlobalOptions)return[];let l=[];for(let a=i.parent;a;a=a.parent){let d=a.options.filter(p=>!p.hidden);l.push(...d)}return this.sortOptions&&l.sort(this.compareOptions),l}visibleArguments(i){return i._argsDescription&&i.registeredArguments.forEach(l=>{l.description=l.description||i._argsDescription[l.name()]||""}),i.registeredArguments.find(l=>l.description)?i.registeredArguments:[]}subcommandTerm(i){let l=i.registeredArguments.map(a=>gs(a)).join(" ");return i._name+(i._aliases[0]?"|"+i._aliases[0]:"")+(i.options.length?" [options]":"")+(l?" "+l:"")}optionTerm(i){return i.flags}argumentTerm(i){return i.name()}longestSubcommandTermLength(i,l){return l.visibleCommands(i).reduce((a,d)=>Math.max(a,l.subcommandTerm(d).length),0)}longestOptionTermLength(i,l){return l.visibleOptions(i).reduce((a,d)=>Math.max(a,l.optionTerm(d).length),0)}longestGlobalOptionTermLength(i,l){return l.visibleGlobalOptions(i).reduce((a,d)=>Math.max(a,l.optionTerm(d).length),0)}longestArgumentTermLength(i,l){return l.visibleArguments(i).reduce((a,d)=>Math.max(a,l.argumentTerm(d).length),0)}commandUsage(i){let l=i._name;i._aliases[0]&&(l=l+"|"+i._aliases[0]);let a="";for(let d=i.parent;d;d=d.parent)a=d.name()+" "+a;return a+l+" "+i.usage()}commandDescription(i){return i.description()}subcommandDescription(i){return i.summary()||i.description()}optionDescription(i){let l=[];return i.argChoices&&l.push(`choices: ${i.argChoices.map(a=>JSON.stringify(a)).join(", ")}`),i.defaultValue!==void 0&&(i.required||i.optional||i.isBoolean()&&typeof i.defaultValue=="boolean")&&l.push(`default: ${i.defaultValueDescription||JSON.stringify(i.defaultValue)}`),i.presetArg!==void 0&&i.optional&&l.push(`preset: ${JSON.stringify(i.presetArg)}`),i.envVar!==void 0&&l.push(`env: ${i.envVar}`),l.length>0?`${i.description} (${l.join(", ")})`:i.description}argumentDescription(i){let l=[];if(i.argChoices&&l.push(`choices: ${i.argChoices.map(a=>JSON.stringify(a)).join(", ")}`),i.defaultValue!==void 0&&l.push(`default: ${i.defaultValueDescription||JSON.stringify(i.defaultValue)}`),l.length>0){let a=`(${l.join(", ")})`;return i.description?`${i.description} ${a}`:a}return i.description}formatHelp(i,l){let a=l.padWidth(i,l),d=l.helpWidth||80,p=2,_=2;function A(R,Q){if(Q){let de=`${R.padEnd(a+_)}${Q}`;return l.wrap(de,d-p,a+_)}return R}function b(R){return R.join(`
3
- `).replace(/^/gm," ".repeat(p))}let k=[`Usage: ${l.commandUsage(i)}`,""],S=l.commandDescription(i);S.length>0&&(k=k.concat([l.wrap(S,d,0),""]));let F=l.visibleArguments(i).map(R=>A(l.argumentTerm(R),l.argumentDescription(R)));F.length>0&&(k=k.concat(["Arguments:",b(F),""]));let W=l.visibleOptions(i).map(R=>A(l.optionTerm(R),l.optionDescription(R)));if(W.length>0&&(k=k.concat(["Options:",b(W),""])),this.showGlobalOptions){let R=l.visibleGlobalOptions(i).map(Q=>A(l.optionTerm(Q),l.optionDescription(Q)));R.length>0&&(k=k.concat(["Global Options:",b(R),""]))}let B=l.visibleCommands(i).map(R=>A(l.subcommandTerm(R),l.subcommandDescription(R)));return B.length>0&&(k=k.concat(["Commands:",b(B),""])),k.join(`
4
- `)}padWidth(i,l){return Math.max(l.longestOptionTermLength(i,l),l.longestGlobalOptionTermLength(i,l),l.longestSubcommandTermLength(i,l),l.longestArgumentTermLength(i,l))}wrap(i,l,a,d=40){let p=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",_=new RegExp(`[\\n][${p}]+`);if(i.match(_))return i;let A=l-a;if(A<d)return i;let b=i.slice(0,a),k=i.slice(a).replace(`\r
2
+ "use strict";var ss=Object.create;var Ut=Object.defineProperty;var as=Object.getOwnPropertyDescriptor;var ls=Object.getOwnPropertyNames;var us=Object.getPrototypeOf,cs=Object.prototype.hasOwnProperty;var ge=(g,i)=>()=>(i||g((i={exports:{}}).exports,i),i.exports);var fs=(g,i,a,l)=>{if(i&&typeof i=="object"||typeof i=="function")for(let d of ls(i))!cs.call(g,d)&&d!==a&&Ut(g,d,{get:()=>i[d],enumerable:!(l=as(i,d))||l.enumerable});return g};var Er=(g,i,a)=>(a=g!=null?ss(us(g)):{},fs(i||!g||!g.__esModule?Ut(a,"default",{value:g,enumerable:!0}):a,g));var Te=ge(kr=>{var er=class extends Error{constructor(i,a,l){super(l),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=a,this.exitCode=i,this.nestedError=void 0}},Ar=class extends er{constructor(i){super(1,"commander.invalidArgument",i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};kr.CommanderError=er;kr.InvalidArgumentError=Ar});var rr=ge(Or=>{var{InvalidArgumentError:_s}=Te(),$r=class{constructor(i,a){switch(this.description=a||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,i[0]){case"<":this.required=!0,this._name=i.slice(1,-1);break;case"[":this.required=!1,this._name=i.slice(1,-1);break;default:this.required=!0,this._name=i;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(i,a){return a===this.defaultValue||!Array.isArray(a)?[i]:a.concat(i)}default(i,a){return this.defaultValue=i,this.defaultValueDescription=a,this}argParser(i){return this.parseArg=i,this}choices(i){return this.argChoices=i.slice(),this.parseArg=(a,l)=>{if(!this.argChoices.includes(a))throw new _s(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(a,l):a},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function ys(g){let i=g.name()+(g.variadic===!0?"...":"");return g.required?"<"+i+">":"["+i+"]"}Or.Argument=$r;Or.humanReadableArgName=ys});var Pr=ge(Qt=>{var{humanReadableArgName:ws}=rr(),Sr=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(i){let a=i.commands.filter(d=>!d._hidden),l=i._getHelpCommand();return l&&!l._hidden&&a.push(l),this.sortSubcommands&&a.sort((d,h)=>d.name().localeCompare(h.name())),a}compareOptions(i,a){let l=d=>d.short?d.short.replace(/^-/,""):d.long.replace(/^--/,"");return l(i).localeCompare(l(a))}visibleOptions(i){let a=i.options.filter(d=>!d.hidden),l=i._getHelpOption();if(l&&!l.hidden){let d=l.short&&i._findOption(l.short),h=l.long&&i._findOption(l.long);!d&&!h?a.push(l):l.long&&!h?a.push(i.createOption(l.long,l.description)):l.short&&!d&&a.push(i.createOption(l.short,l.description))}return this.sortOptions&&a.sort(this.compareOptions),a}visibleGlobalOptions(i){if(!this.showGlobalOptions)return[];let a=[];for(let l=i.parent;l;l=l.parent){let d=l.options.filter(h=>!h.hidden);a.push(...d)}return this.sortOptions&&a.sort(this.compareOptions),a}visibleArguments(i){return i._argsDescription&&i.registeredArguments.forEach(a=>{a.description=a.description||i._argsDescription[a.name()]||""}),i.registeredArguments.find(a=>a.description)?i.registeredArguments:[]}subcommandTerm(i){let a=i.registeredArguments.map(l=>ws(l)).join(" ");return i._name+(i._aliases[0]?"|"+i._aliases[0]:"")+(i.options.length?" [options]":"")+(a?" "+a:"")}optionTerm(i){return i.flags}argumentTerm(i){return i.name()}longestSubcommandTermLength(i,a){return a.visibleCommands(i).reduce((l,d)=>Math.max(l,a.subcommandTerm(d).length),0)}longestOptionTermLength(i,a){return a.visibleOptions(i).reduce((l,d)=>Math.max(l,a.optionTerm(d).length),0)}longestGlobalOptionTermLength(i,a){return a.visibleGlobalOptions(i).reduce((l,d)=>Math.max(l,a.optionTerm(d).length),0)}longestArgumentTermLength(i,a){return a.visibleArguments(i).reduce((l,d)=>Math.max(l,a.argumentTerm(d).length),0)}commandUsage(i){let a=i._name;i._aliases[0]&&(a=a+"|"+i._aliases[0]);let l="";for(let d=i.parent;d;d=d.parent)l=d.name()+" "+l;return l+a+" "+i.usage()}commandDescription(i){return i.description()}subcommandDescription(i){return i.summary()||i.description()}optionDescription(i){let a=[];return i.argChoices&&a.push(`choices: ${i.argChoices.map(l=>JSON.stringify(l)).join(", ")}`),i.defaultValue!==void 0&&(i.required||i.optional||i.isBoolean()&&typeof i.defaultValue=="boolean")&&a.push(`default: ${i.defaultValueDescription||JSON.stringify(i.defaultValue)}`),i.presetArg!==void 0&&i.optional&&a.push(`preset: ${JSON.stringify(i.presetArg)}`),i.envVar!==void 0&&a.push(`env: ${i.envVar}`),a.length>0?`${i.description} (${a.join(", ")})`:i.description}argumentDescription(i){let a=[];if(i.argChoices&&a.push(`choices: ${i.argChoices.map(l=>JSON.stringify(l)).join(", ")}`),i.defaultValue!==void 0&&a.push(`default: ${i.defaultValueDescription||JSON.stringify(i.defaultValue)}`),a.length>0){let l=`(${a.join(", ")})`;return i.description?`${i.description} ${l}`:l}return i.description}formatHelp(i,a){let l=a.padWidth(i,a),d=a.helpWidth||80,h=2,y=2;function k(W,Q){if(Q){let fe=`${W.padEnd(l+y)}${Q}`;return a.wrap(fe,d-h,l+y)}return W}function b(W){return W.join(`
3
+ `).replace(/^/gm," ".repeat(h))}let $=[`Usage: ${a.commandUsage(i)}`,""],S=a.commandDescription(i);S.length>0&&($=$.concat([a.wrap(S,d,0),""]));let T=a.visibleArguments(i).map(W=>k(a.argumentTerm(W),a.argumentDescription(W)));T.length>0&&($=$.concat(["Arguments:",b(T),""]));let I=a.visibleOptions(i).map(W=>k(a.optionTerm(W),a.optionDescription(W)));if(I.length>0&&($=$.concat(["Options:",b(I),""])),this.showGlobalOptions){let W=a.visibleGlobalOptions(i).map(Q=>k(a.optionTerm(Q),a.optionDescription(Q)));W.length>0&&($=$.concat(["Global Options:",b(W),""]))}let B=a.visibleCommands(i).map(W=>k(a.subcommandTerm(W),a.subcommandDescription(W)));return B.length>0&&($=$.concat(["Commands:",b(B),""])),$.join(`
4
+ `)}padWidth(i,a){return Math.max(a.longestOptionTermLength(i,a),a.longestGlobalOptionTermLength(i,a),a.longestSubcommandTermLength(i,a),a.longestArgumentTermLength(i,a))}wrap(i,a,l,d=40){let h=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",y=new RegExp(`[\\n][${h}]+`);if(i.match(y))return i;let k=a-l;if(k<d)return i;let b=i.slice(0,l),$=i.slice(l).replace(`\r
5
5
  `,`
6
- `),S=" ".repeat(a),W="\\s\u200B",B=new RegExp(`
7
- |.{1,${A-1}}([${W}]|$)|[^${W}]+?([${W}]|$)`,"g"),R=k.match(B)||[];return b+R.map((Q,de)=>Q===`
8
- `?"":(de>0?S:"")+Q.trimEnd()).join(`
9
- `)}};Gt.Help=Tr});var Hr=ge(jr=>{var{InvalidArgumentError:_s}=Me(),Dr=class{constructor(i,l){this.flags=i,this.description=l||"",this.required=i.includes("<"),this.optional=i.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(i),this.mandatory=!1;let a=ws(i);this.short=a.shortFlag,this.long=a.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(i,l){return this.defaultValue=i,this.defaultValueDescription=l,this}preset(i){return this.presetArg=i,this}conflicts(i){return this.conflictsWith=this.conflictsWith.concat(i),this}implies(i){let l=i;return typeof i=="string"&&(l={[i]:!0}),this.implied=Object.assign(this.implied||{},l),this}env(i){return this.envVar=i,this}argParser(i){return this.parseArg=i,this}makeOptionMandatory(i=!0){return this.mandatory=!!i,this}hideHelp(i=!0){return this.hidden=!!i,this}_concatValue(i,l){return l===this.defaultValue||!Array.isArray(l)?[i]:l.concat(i)}choices(i){return this.argChoices=i.slice(),this.parseArg=(l,a)=>{if(!this.argChoices.includes(l))throw new _s(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(l,a):l},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return ys(this.name().replace(/^no-/,""))}is(i){return this.short===i||this.long===i}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Mr=class{constructor(i){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,i.forEach(l=>{l.negate?this.negativeOptions.set(l.attributeName(),l):this.positiveOptions.set(l.attributeName(),l)}),this.negativeOptions.forEach((l,a)=>{this.positiveOptions.has(a)&&this.dualOptions.add(a)})}valueFromOption(i,l){let a=l.attributeName();if(!this.dualOptions.has(a))return!0;let d=this.negativeOptions.get(a).presetArg,p=d!==void 0?d:!1;return l.negate===(p===i)}};function ys(g){return g.split("-").reduce((i,l)=>i+l[0].toUpperCase()+l.slice(1))}function ws(g){let i,l,a=g.split(/[ |,]+/);return a.length>1&&!/^[[<]/.test(a[1])&&(i=a.shift()),l=a.shift(),!i&&/^-[^-]$/.test(l)&&(i=l,l=void 0),{shortFlag:i,longFlag:l}}jr.Option=Dr;jr.DualOptions=Mr});var Yt=ge(Jt=>{function Es(g,i){if(Math.abs(g.length-i.length)>3)return Math.max(g.length,i.length);let l=[];for(let a=0;a<=g.length;a++)l[a]=[a];for(let a=0;a<=i.length;a++)l[0][a]=a;for(let a=1;a<=i.length;a++)for(let d=1;d<=g.length;d++){let p=1;g[d-1]===i[a-1]?p=0:p=1,l[d][a]=Math.min(l[d-1][a]+1,l[d][a-1]+1,l[d-1][a-1]+p),d>1&&a>1&&g[d-1]===i[a-2]&&g[d-2]===i[a-1]&&(l[d][a]=Math.min(l[d][a],l[d-2][a-2]+1))}return l[g.length][i.length]}function bs(g,i){if(!i||i.length===0)return"";i=Array.from(new Set(i));let l=g.startsWith("--");l&&(g=g.slice(2),i=i.map(_=>_.slice(2)));let a=[],d=3,p=.4;return i.forEach(_=>{if(_.length<=1)return;let A=Es(g,_),b=Math.max(g.length,_.length);(b-A)/b>p&&(A<d?(d=A,a=[_]):A===d&&a.push(_))}),a.sort((_,A)=>_.localeCompare(A)),l&&(a=a.map(_=>`--${_}`)),a.length>1?`
10
- (Did you mean one of ${a.join(", ")}?)`:a.length===1?`
11
- (Did you mean ${a[0]}?)`:""}Jt.suggestSimilar=bs});var en=ge(Zt=>{var Cs=require("node:events").EventEmitter,Rr=require("node:child_process"),ue=require("node:path"),Vr=require("node:fs"),L=require("node:process"),{Argument:As,humanReadableArgName:ks}=nr(),{CommanderError:Wr}=Me(),{Help:$s}=xr(),{Option:Kt,DualOptions:Os}=Hr(),{suggestSimilar:Xt}=Yt(),Ur=class g extends Cs{constructor(i){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=i||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:l=>L.stdout.write(l),writeErr:l=>L.stderr.write(l),getOutHelpWidth:()=>L.stdout.isTTY?L.stdout.columns:void 0,getErrHelpWidth:()=>L.stderr.isTTY?L.stderr.columns:void 0,outputError:(l,a)=>a(l)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(i){return this._outputConfiguration=i._outputConfiguration,this._helpOption=i._helpOption,this._helpCommand=i._helpCommand,this._helpConfiguration=i._helpConfiguration,this._exitCallback=i._exitCallback,this._storeOptionsAsProperties=i._storeOptionsAsProperties,this._combineFlagAndOptionalValue=i._combineFlagAndOptionalValue,this._allowExcessArguments=i._allowExcessArguments,this._enablePositionalOptions=i._enablePositionalOptions,this._showHelpAfterError=i._showHelpAfterError,this._showSuggestionAfterError=i._showSuggestionAfterError,this}_getCommandAndAncestors(){let i=[];for(let l=this;l;l=l.parent)i.push(l);return i}command(i,l,a){let d=l,p=a;typeof d=="object"&&d!==null&&(p=d,d=null),p=p||{};let[,_,A]=i.match(/([^ ]+) *(.*)/),b=this.createCommand(_);return d&&(b.description(d),b._executableHandler=!0),p.isDefault&&(this._defaultCommandName=b._name),b._hidden=!!(p.noHelp||p.hidden),b._executableFile=p.executableFile||null,A&&b.arguments(A),this._registerCommand(b),b.parent=this,b.copyInheritedSettings(this),d?this:b}createCommand(i){return new g(i)}createHelp(){return Object.assign(new $s,this.configureHelp())}configureHelp(i){return i===void 0?this._helpConfiguration:(this._helpConfiguration=i,this)}configureOutput(i){return i===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,i),this)}showHelpAfterError(i=!0){return typeof i!="string"&&(i=!!i),this._showHelpAfterError=i,this}showSuggestionAfterError(i=!0){return this._showSuggestionAfterError=!!i,this}addCommand(i,l){if(!i._name)throw new Error(`Command passed to .addCommand() must have a name
12
- - specify the name in Command constructor or using .name()`);return l=l||{},l.isDefault&&(this._defaultCommandName=i._name),(l.noHelp||l.hidden)&&(i._hidden=!0),this._registerCommand(i),i.parent=this,i._checkForBrokenPassThrough(),this}createArgument(i,l){return new As(i,l)}argument(i,l,a,d){let p=this.createArgument(i,l);return typeof a=="function"?p.default(d).argParser(a):p.default(a),this.addArgument(p),this}arguments(i){return i.trim().split(/ +/).forEach(l=>{this.argument(l)}),this}addArgument(i){let l=this.registeredArguments.slice(-1)[0];if(l&&l.variadic)throw new Error(`only the last argument can be variadic '${l.name()}'`);if(i.required&&i.defaultValue!==void 0&&i.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${i.name()}'`);return this.registeredArguments.push(i),this}helpCommand(i,l){if(typeof i=="boolean")return this._addImplicitHelpCommand=i,this;i=i??"help [command]";let[,a,d]=i.match(/([^ ]+) *(.*)/),p=l??"display help for command",_=this.createCommand(a);return _.helpOption(!1),d&&_.arguments(d),p&&_.description(p),this._addImplicitHelpCommand=!0,this._helpCommand=_,this}addHelpCommand(i,l){return typeof i!="object"?(this.helpCommand(i,l),this):(this._addImplicitHelpCommand=!0,this._helpCommand=i,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(i,l){let a=["preSubcommand","preAction","postAction"];if(!a.includes(i))throw new Error(`Unexpected value for event passed to hook : '${i}'.
13
- Expecting one of '${a.join("', '")}'`);return this._lifeCycleHooks[i]?this._lifeCycleHooks[i].push(l):this._lifeCycleHooks[i]=[l],this}exitOverride(i){return i?this._exitCallback=i:this._exitCallback=l=>{if(l.code!=="commander.executeSubCommandAsync")throw l},this}_exit(i,l,a){this._exitCallback&&this._exitCallback(new Wr(i,l,a)),L.exit(i)}action(i){let l=a=>{let d=this.registeredArguments.length,p=a.slice(0,d);return this._storeOptionsAsProperties?p[d]=this:p[d]=this.opts(),p.push(this),i.apply(this,p)};return this._actionHandler=l,this}createOption(i,l){return new Kt(i,l)}_callParseArg(i,l,a,d){try{return i.parseArg(l,a)}catch(p){if(p.code==="commander.invalidArgument"){let _=`${d} ${p.message}`;this.error(_,{exitCode:p.exitCode,code:p.code})}throw p}}_registerOption(i){let l=i.short&&this._findOption(i.short)||i.long&&this._findOption(i.long);if(l){let a=i.long&&this._findOption(i.long)?i.long:i.short;throw new Error(`Cannot add option '${i.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${a}'
14
- - already used by option '${l.flags}'`)}this.options.push(i)}_registerCommand(i){let l=d=>[d.name()].concat(d.aliases()),a=l(i).find(d=>this._findCommand(d));if(a){let d=l(this._findCommand(a)).join("|"),p=l(i).join("|");throw new Error(`cannot add command '${p}' as already have command '${d}'`)}this.commands.push(i)}addOption(i){this._registerOption(i);let l=i.name(),a=i.attributeName();if(i.negate){let p=i.long.replace(/^--no-/,"--");this._findOption(p)||this.setOptionValueWithSource(a,i.defaultValue===void 0?!0:i.defaultValue,"default")}else i.defaultValue!==void 0&&this.setOptionValueWithSource(a,i.defaultValue,"default");let d=(p,_,A)=>{p==null&&i.presetArg!==void 0&&(p=i.presetArg);let b=this.getOptionValue(a);p!==null&&i.parseArg?p=this._callParseArg(i,p,b,_):p!==null&&i.variadic&&(p=i._concatValue(p,b)),p==null&&(i.negate?p=!1:i.isBoolean()||i.optional?p=!0:p=""),this.setOptionValueWithSource(a,p,A)};return this.on("option:"+l,p=>{let _=`error: option '${i.flags}' argument '${p}' is invalid.`;d(p,_,"cli")}),i.envVar&&this.on("optionEnv:"+l,p=>{let _=`error: option '${i.flags}' value '${p}' from env '${i.envVar}' is invalid.`;d(p,_,"env")}),this}_optionEx(i,l,a,d,p){if(typeof l=="object"&&l instanceof Kt)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let _=this.createOption(l,a);if(_.makeOptionMandatory(!!i.mandatory),typeof d=="function")_.default(p).argParser(d);else if(d instanceof RegExp){let A=d;d=(b,k)=>{let S=A.exec(b);return S?S[0]:k},_.default(p).argParser(d)}else _.default(d);return this.addOption(_)}option(i,l,a,d){return this._optionEx({},i,l,a,d)}requiredOption(i,l,a,d){return this._optionEx({mandatory:!0},i,l,a,d)}combineFlagAndOptionalValue(i=!0){return this._combineFlagAndOptionalValue=!!i,this}allowUnknownOption(i=!0){return this._allowUnknownOption=!!i,this}allowExcessArguments(i=!0){return this._allowExcessArguments=!!i,this}enablePositionalOptions(i=!0){return this._enablePositionalOptions=!!i,this}passThroughOptions(i=!0){return this._passThroughOptions=!!i,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(i=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!i,this}getOptionValue(i){return this._storeOptionsAsProperties?this[i]:this._optionValues[i]}setOptionValue(i,l){return this.setOptionValueWithSource(i,l,void 0)}setOptionValueWithSource(i,l,a){return this._storeOptionsAsProperties?this[i]=l:this._optionValues[i]=l,this._optionValueSources[i]=a,this}getOptionValueSource(i){return this._optionValueSources[i]}getOptionValueSourceWithGlobals(i){let l;return this._getCommandAndAncestors().forEach(a=>{a.getOptionValueSource(i)!==void 0&&(l=a.getOptionValueSource(i))}),l}_prepareUserArgs(i,l){if(i!==void 0&&!Array.isArray(i))throw new Error("first parameter to parse must be array or undefined");if(l=l||{},i===void 0&&l.from===void 0){L.versions?.electron&&(l.from="electron");let d=L.execArgv??[];(d.includes("-e")||d.includes("--eval")||d.includes("-p")||d.includes("--print"))&&(l.from="eval")}i===void 0&&(i=L.argv),this.rawArgs=i.slice();let a;switch(l.from){case void 0:case"node":this._scriptPath=i[1],a=i.slice(2);break;case"electron":L.defaultApp?(this._scriptPath=i[1],a=i.slice(2)):a=i.slice(1);break;case"user":a=i.slice(0);break;case"eval":a=i.slice(1);break;default:throw new Error(`unexpected parse option { from: '${l.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",a}parse(i,l){let a=this._prepareUserArgs(i,l);return this._parseCommand([],a),this}async parseAsync(i,l){let a=this._prepareUserArgs(i,l);return await this._parseCommand([],a),this}_executeSubCommand(i,l){l=l.slice();let a=!1,d=[".js",".ts",".tsx",".mjs",".cjs"];function p(S,F){let W=ue.resolve(S,F);if(Vr.existsSync(W))return W;if(d.includes(ue.extname(F)))return;let B=d.find(R=>Vr.existsSync(`${W}${R}`));if(B)return`${W}${B}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let _=i._executableFile||`${this._name}-${i._name}`,A=this._executableDir||"";if(this._scriptPath){let S;try{S=Vr.realpathSync(this._scriptPath)}catch{S=this._scriptPath}A=ue.resolve(ue.dirname(S),A)}if(A){let S=p(A,_);if(!S&&!i._executableFile&&this._scriptPath){let F=ue.basename(this._scriptPath,ue.extname(this._scriptPath));F!==this._name&&(S=p(A,`${F}-${i._name}`))}_=S||_}a=d.includes(ue.extname(_));let b;L.platform!=="win32"?a?(l.unshift(_),l=Qt(L.execArgv).concat(l),b=Rr.spawn(L.argv[0],l,{stdio:"inherit"})):b=Rr.spawn(_,l,{stdio:"inherit"}):(l.unshift(_),l=Qt(L.execArgv).concat(l),b=Rr.spawn(L.execPath,l,{stdio:"inherit"})),b.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(F=>{L.on(F,()=>{b.killed===!1&&b.exitCode===null&&b.kill(F)})});let k=this._exitCallback;b.on("close",S=>{S=S??1,k?k(new Wr(S,"commander.executeSubCommandAsync","(close)")):L.exit(S)}),b.on("error",S=>{if(S.code==="ENOENT"){let F=A?`searched for local subcommand relative to directory '${A}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",W=`'${_}' does not exist
6
+ `),S=" ".repeat(l),I="\\s\u200B",B=new RegExp(`
7
+ |.{1,${k-1}}([${I}]|$)|[^${I}]+?([${I}]|$)`,"g"),W=$.match(B)||[];return b+W.map((Q,fe)=>Q===`
8
+ `?"":(fe>0?S:"")+Q.trimEnd()).join(`
9
+ `)}};Qt.Help=Sr});var Dr=ge(xr=>{var{InvalidArgumentError:Es}=Te(),Fr=class{constructor(i,a){this.flags=i,this.description=a||"",this.required=i.includes("<"),this.optional=i.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(i),this.mandatory=!1;let l=Cs(i);this.short=l.shortFlag,this.long=l.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(i,a){return this.defaultValue=i,this.defaultValueDescription=a,this}preset(i){return this.presetArg=i,this}conflicts(i){return this.conflictsWith=this.conflictsWith.concat(i),this}implies(i){let a=i;return typeof i=="string"&&(a={[i]:!0}),this.implied=Object.assign(this.implied||{},a),this}env(i){return this.envVar=i,this}argParser(i){return this.parseArg=i,this}makeOptionMandatory(i=!0){return this.mandatory=!!i,this}hideHelp(i=!0){return this.hidden=!!i,this}_concatValue(i,a){return a===this.defaultValue||!Array.isArray(a)?[i]:a.concat(i)}choices(i){return this.argChoices=i.slice(),this.parseArg=(a,l)=>{if(!this.argChoices.includes(a))throw new Es(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(a,l):a},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return bs(this.name().replace(/^no-/,""))}is(i){return this.short===i||this.long===i}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Tr=class{constructor(i){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,i.forEach(a=>{a.negate?this.negativeOptions.set(a.attributeName(),a):this.positiveOptions.set(a.attributeName(),a)}),this.negativeOptions.forEach((a,l)=>{this.positiveOptions.has(l)&&this.dualOptions.add(l)})}valueFromOption(i,a){let l=a.attributeName();if(!this.dualOptions.has(l))return!0;let d=this.negativeOptions.get(l).presetArg,h=d!==void 0?d:!1;return a.negate===(h===i)}};function bs(g){return g.split("-").reduce((i,a)=>i+a[0].toUpperCase()+a.slice(1))}function Cs(g){let i,a,l=g.split(/[ |,]+/);return l.length>1&&!/^[[<]/.test(l[1])&&(i=l.shift()),a=l.shift(),!i&&/^-[^-]$/.test(a)&&(i=a,a=void 0),{shortFlag:i,longFlag:a}}xr.Option=Fr;xr.DualOptions=Tr});var en=ge(Zt=>{function As(g,i){if(Math.abs(g.length-i.length)>3)return Math.max(g.length,i.length);let a=[];for(let l=0;l<=g.length;l++)a[l]=[l];for(let l=0;l<=i.length;l++)a[0][l]=l;for(let l=1;l<=i.length;l++)for(let d=1;d<=g.length;d++){let h=1;g[d-1]===i[l-1]?h=0:h=1,a[d][l]=Math.min(a[d-1][l]+1,a[d][l-1]+1,a[d-1][l-1]+h),d>1&&l>1&&g[d-1]===i[l-2]&&g[d-2]===i[l-1]&&(a[d][l]=Math.min(a[d][l],a[d-2][l-2]+1))}return a[g.length][i.length]}function ks(g,i){if(!i||i.length===0)return"";i=Array.from(new Set(i));let a=g.startsWith("--");a&&(g=g.slice(2),i=i.map(y=>y.slice(2)));let l=[],d=3,h=.4;return i.forEach(y=>{if(y.length<=1)return;let k=As(g,y),b=Math.max(g.length,y.length);(b-k)/b>h&&(k<d?(d=k,l=[y]):k===d&&l.push(y))}),l.sort((y,k)=>y.localeCompare(k)),a&&(l=l.map(y=>`--${y}`)),l.length>1?`
10
+ (Did you mean one of ${l.join(", ")}?)`:l.length===1?`
11
+ (Did you mean ${l[0]}?)`:""}Zt.suggestSimilar=ks});var sn=ge(on=>{var $s=require("node:events").EventEmitter,Mr=require("node:child_process"),le=require("node:path"),jr=require("node:fs"),L=require("node:process"),{Argument:Os,humanReadableArgName:Ss}=rr(),{CommanderError:Hr}=Te(),{Help:Ps}=Pr(),{Option:rn,DualOptions:Fs}=Dr(),{suggestSimilar:tn}=en(),Rr=class g extends $s{constructor(i){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=i||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:a=>L.stdout.write(a),writeErr:a=>L.stderr.write(a),getOutHelpWidth:()=>L.stdout.isTTY?L.stdout.columns:void 0,getErrHelpWidth:()=>L.stderr.isTTY?L.stderr.columns:void 0,outputError:(a,l)=>l(a)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(i){return this._outputConfiguration=i._outputConfiguration,this._helpOption=i._helpOption,this._helpCommand=i._helpCommand,this._helpConfiguration=i._helpConfiguration,this._exitCallback=i._exitCallback,this._storeOptionsAsProperties=i._storeOptionsAsProperties,this._combineFlagAndOptionalValue=i._combineFlagAndOptionalValue,this._allowExcessArguments=i._allowExcessArguments,this._enablePositionalOptions=i._enablePositionalOptions,this._showHelpAfterError=i._showHelpAfterError,this._showSuggestionAfterError=i._showSuggestionAfterError,this}_getCommandAndAncestors(){let i=[];for(let a=this;a;a=a.parent)i.push(a);return i}command(i,a,l){let d=a,h=l;typeof d=="object"&&d!==null&&(h=d,d=null),h=h||{};let[,y,k]=i.match(/([^ ]+) *(.*)/),b=this.createCommand(y);return d&&(b.description(d),b._executableHandler=!0),h.isDefault&&(this._defaultCommandName=b._name),b._hidden=!!(h.noHelp||h.hidden),b._executableFile=h.executableFile||null,k&&b.arguments(k),this._registerCommand(b),b.parent=this,b.copyInheritedSettings(this),d?this:b}createCommand(i){return new g(i)}createHelp(){return Object.assign(new Ps,this.configureHelp())}configureHelp(i){return i===void 0?this._helpConfiguration:(this._helpConfiguration=i,this)}configureOutput(i){return i===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,i),this)}showHelpAfterError(i=!0){return typeof i!="string"&&(i=!!i),this._showHelpAfterError=i,this}showSuggestionAfterError(i=!0){return this._showSuggestionAfterError=!!i,this}addCommand(i,a){if(!i._name)throw new Error(`Command passed to .addCommand() must have a name
12
+ - specify the name in Command constructor or using .name()`);return a=a||{},a.isDefault&&(this._defaultCommandName=i._name),(a.noHelp||a.hidden)&&(i._hidden=!0),this._registerCommand(i),i.parent=this,i._checkForBrokenPassThrough(),this}createArgument(i,a){return new Os(i,a)}argument(i,a,l,d){let h=this.createArgument(i,a);return typeof l=="function"?h.default(d).argParser(l):h.default(l),this.addArgument(h),this}arguments(i){return i.trim().split(/ +/).forEach(a=>{this.argument(a)}),this}addArgument(i){let a=this.registeredArguments.slice(-1)[0];if(a&&a.variadic)throw new Error(`only the last argument can be variadic '${a.name()}'`);if(i.required&&i.defaultValue!==void 0&&i.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${i.name()}'`);return this.registeredArguments.push(i),this}helpCommand(i,a){if(typeof i=="boolean")return this._addImplicitHelpCommand=i,this;i=i??"help [command]";let[,l,d]=i.match(/([^ ]+) *(.*)/),h=a??"display help for command",y=this.createCommand(l);return y.helpOption(!1),d&&y.arguments(d),h&&y.description(h),this._addImplicitHelpCommand=!0,this._helpCommand=y,this}addHelpCommand(i,a){return typeof i!="object"?(this.helpCommand(i,a),this):(this._addImplicitHelpCommand=!0,this._helpCommand=i,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(i,a){let l=["preSubcommand","preAction","postAction"];if(!l.includes(i))throw new Error(`Unexpected value for event passed to hook : '${i}'.
13
+ Expecting one of '${l.join("', '")}'`);return this._lifeCycleHooks[i]?this._lifeCycleHooks[i].push(a):this._lifeCycleHooks[i]=[a],this}exitOverride(i){return i?this._exitCallback=i:this._exitCallback=a=>{if(a.code!=="commander.executeSubCommandAsync")throw a},this}_exit(i,a,l){this._exitCallback&&this._exitCallback(new Hr(i,a,l)),L.exit(i)}action(i){let a=l=>{let d=this.registeredArguments.length,h=l.slice(0,d);return this._storeOptionsAsProperties?h[d]=this:h[d]=this.opts(),h.push(this),i.apply(this,h)};return this._actionHandler=a,this}createOption(i,a){return new rn(i,a)}_callParseArg(i,a,l,d){try{return i.parseArg(a,l)}catch(h){if(h.code==="commander.invalidArgument"){let y=`${d} ${h.message}`;this.error(y,{exitCode:h.exitCode,code:h.code})}throw h}}_registerOption(i){let a=i.short&&this._findOption(i.short)||i.long&&this._findOption(i.long);if(a){let l=i.long&&this._findOption(i.long)?i.long:i.short;throw new Error(`Cannot add option '${i.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${l}'
14
+ - already used by option '${a.flags}'`)}this.options.push(i)}_registerCommand(i){let a=d=>[d.name()].concat(d.aliases()),l=a(i).find(d=>this._findCommand(d));if(l){let d=a(this._findCommand(l)).join("|"),h=a(i).join("|");throw new Error(`cannot add command '${h}' as already have command '${d}'`)}this.commands.push(i)}addOption(i){this._registerOption(i);let a=i.name(),l=i.attributeName();if(i.negate){let h=i.long.replace(/^--no-/,"--");this._findOption(h)||this.setOptionValueWithSource(l,i.defaultValue===void 0?!0:i.defaultValue,"default")}else i.defaultValue!==void 0&&this.setOptionValueWithSource(l,i.defaultValue,"default");let d=(h,y,k)=>{h==null&&i.presetArg!==void 0&&(h=i.presetArg);let b=this.getOptionValue(l);h!==null&&i.parseArg?h=this._callParseArg(i,h,b,y):h!==null&&i.variadic&&(h=i._concatValue(h,b)),h==null&&(i.negate?h=!1:i.isBoolean()||i.optional?h=!0:h=""),this.setOptionValueWithSource(l,h,k)};return this.on("option:"+a,h=>{let y=`error: option '${i.flags}' argument '${h}' is invalid.`;d(h,y,"cli")}),i.envVar&&this.on("optionEnv:"+a,h=>{let y=`error: option '${i.flags}' value '${h}' from env '${i.envVar}' is invalid.`;d(h,y,"env")}),this}_optionEx(i,a,l,d,h){if(typeof a=="object"&&a instanceof rn)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let y=this.createOption(a,l);if(y.makeOptionMandatory(!!i.mandatory),typeof d=="function")y.default(h).argParser(d);else if(d instanceof RegExp){let k=d;d=(b,$)=>{let S=k.exec(b);return S?S[0]:$},y.default(h).argParser(d)}else y.default(d);return this.addOption(y)}option(i,a,l,d){return this._optionEx({},i,a,l,d)}requiredOption(i,a,l,d){return this._optionEx({mandatory:!0},i,a,l,d)}combineFlagAndOptionalValue(i=!0){return this._combineFlagAndOptionalValue=!!i,this}allowUnknownOption(i=!0){return this._allowUnknownOption=!!i,this}allowExcessArguments(i=!0){return this._allowExcessArguments=!!i,this}enablePositionalOptions(i=!0){return this._enablePositionalOptions=!!i,this}passThroughOptions(i=!0){return this._passThroughOptions=!!i,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(i=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!i,this}getOptionValue(i){return this._storeOptionsAsProperties?this[i]:this._optionValues[i]}setOptionValue(i,a){return this.setOptionValueWithSource(i,a,void 0)}setOptionValueWithSource(i,a,l){return this._storeOptionsAsProperties?this[i]=a:this._optionValues[i]=a,this._optionValueSources[i]=l,this}getOptionValueSource(i){return this._optionValueSources[i]}getOptionValueSourceWithGlobals(i){let a;return this._getCommandAndAncestors().forEach(l=>{l.getOptionValueSource(i)!==void 0&&(a=l.getOptionValueSource(i))}),a}_prepareUserArgs(i,a){if(i!==void 0&&!Array.isArray(i))throw new Error("first parameter to parse must be array or undefined");if(a=a||{},i===void 0&&a.from===void 0){L.versions?.electron&&(a.from="electron");let d=L.execArgv??[];(d.includes("-e")||d.includes("--eval")||d.includes("-p")||d.includes("--print"))&&(a.from="eval")}i===void 0&&(i=L.argv),this.rawArgs=i.slice();let l;switch(a.from){case void 0:case"node":this._scriptPath=i[1],l=i.slice(2);break;case"electron":L.defaultApp?(this._scriptPath=i[1],l=i.slice(2)):l=i.slice(1);break;case"user":l=i.slice(0);break;case"eval":l=i.slice(1);break;default:throw new Error(`unexpected parse option { from: '${a.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",l}parse(i,a){let l=this._prepareUserArgs(i,a);return this._parseCommand([],l),this}async parseAsync(i,a){let l=this._prepareUserArgs(i,a);return await this._parseCommand([],l),this}_executeSubCommand(i,a){a=a.slice();let l=!1,d=[".js",".ts",".tsx",".mjs",".cjs"];function h(S,T){let I=le.resolve(S,T);if(jr.existsSync(I))return I;if(d.includes(le.extname(T)))return;let B=d.find(W=>jr.existsSync(`${I}${W}`));if(B)return`${I}${B}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let y=i._executableFile||`${this._name}-${i._name}`,k=this._executableDir||"";if(this._scriptPath){let S;try{S=jr.realpathSync(this._scriptPath)}catch{S=this._scriptPath}k=le.resolve(le.dirname(S),k)}if(k){let S=h(k,y);if(!S&&!i._executableFile&&this._scriptPath){let T=le.basename(this._scriptPath,le.extname(this._scriptPath));T!==this._name&&(S=h(k,`${T}-${i._name}`))}y=S||y}l=d.includes(le.extname(y));let b;L.platform!=="win32"?l?(a.unshift(y),a=nn(L.execArgv).concat(a),b=Mr.spawn(L.argv[0],a,{stdio:"inherit"})):b=Mr.spawn(y,a,{stdio:"inherit"}):(a.unshift(y),a=nn(L.execArgv).concat(a),b=Mr.spawn(L.execPath,a,{stdio:"inherit"})),b.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(T=>{L.on(T,()=>{b.killed===!1&&b.exitCode===null&&b.kill(T)})});let $=this._exitCallback;b.on("close",S=>{S=S??1,$?$(new Hr(S,"commander.executeSubCommandAsync","(close)")):L.exit(S)}),b.on("error",S=>{if(S.code==="ENOENT"){let T=k?`searched for local subcommand relative to directory '${k}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",I=`'${y}' does not exist
15
15
  - if '${i._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
16
16
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
17
- - ${F}`;throw new Error(W)}else if(S.code==="EACCES")throw new Error(`'${_}' not executable`);if(!k)L.exit(1);else{let F=new Wr(1,"commander.executeSubCommandAsync","(error)");F.nestedError=S,k(F)}}),this.runningCommand=b}_dispatchSubcommand(i,l,a){let d=this._findCommand(i);d||this.help({error:!0});let p;return p=this._chainOrCallSubCommandHook(p,d,"preSubcommand"),p=this._chainOrCall(p,()=>{if(d._executableHandler)this._executeSubCommand(d,l.concat(a));else return d._parseCommand(l,a)}),p}_dispatchHelpCommand(i){i||this.help();let l=this._findCommand(i);return l&&!l._executableHandler&&l.help(),this._dispatchSubcommand(i,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((i,l)=>{i.required&&this.args[l]==null&&this.missingArgument(i.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let i=(a,d,p)=>{let _=d;if(d!==null&&a.parseArg){let A=`error: command-argument value '${d}' is invalid for argument '${a.name()}'.`;_=this._callParseArg(a,d,p,A)}return _};this._checkNumberOfArguments();let l=[];this.registeredArguments.forEach((a,d)=>{let p=a.defaultValue;a.variadic?d<this.args.length?(p=this.args.slice(d),a.parseArg&&(p=p.reduce((_,A)=>i(a,A,_),a.defaultValue))):p===void 0&&(p=[]):d<this.args.length&&(p=this.args[d],a.parseArg&&(p=i(a,p,a.defaultValue))),l[d]=p}),this.processedArgs=l}_chainOrCall(i,l){return i&&i.then&&typeof i.then=="function"?i.then(()=>l()):l()}_chainOrCallHooks(i,l){let a=i,d=[];return this._getCommandAndAncestors().reverse().filter(p=>p._lifeCycleHooks[l]!==void 0).forEach(p=>{p._lifeCycleHooks[l].forEach(_=>{d.push({hookedCommand:p,callback:_})})}),l==="postAction"&&d.reverse(),d.forEach(p=>{a=this._chainOrCall(a,()=>p.callback(p.hookedCommand,this))}),a}_chainOrCallSubCommandHook(i,l,a){let d=i;return this._lifeCycleHooks[a]!==void 0&&this._lifeCycleHooks[a].forEach(p=>{d=this._chainOrCall(d,()=>p(this,l))}),d}_parseCommand(i,l){let a=this.parseOptions(l);if(this._parseOptionsEnv(),this._parseOptionsImplied(),i=i.concat(a.operands),l=a.unknown,this.args=i.concat(l),i&&this._findCommand(i[0]))return this._dispatchSubcommand(i[0],i.slice(1),l);if(this._getHelpCommand()&&i[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(i[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(l),this._dispatchSubcommand(this._defaultCommandName,i,l);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(a.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let d=()=>{a.unknown.length>0&&this.unknownOption(a.unknown[0])},p=`command:${this.name()}`;if(this._actionHandler){d(),this._processArguments();let _;return _=this._chainOrCallHooks(_,"preAction"),_=this._chainOrCall(_,()=>this._actionHandler(this.processedArgs)),this.parent&&(_=this._chainOrCall(_,()=>{this.parent.emit(p,i,l)})),_=this._chainOrCallHooks(_,"postAction"),_}if(this.parent&&this.parent.listenerCount(p))d(),this._processArguments(),this.parent.emit(p,i,l);else if(i.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",i,l);this.listenerCount("command:*")?this.emit("command:*",i,l):this.commands.length?this.unknownCommand():(d(),this._processArguments())}else this.commands.length?(d(),this.help({error:!0})):(d(),this._processArguments())}_findCommand(i){if(i)return this.commands.find(l=>l._name===i||l._aliases.includes(i))}_findOption(i){return this.options.find(l=>l.is(i))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(i=>{i.options.forEach(l=>{l.mandatory&&i.getOptionValue(l.attributeName())===void 0&&i.missingMandatoryOptionValue(l)})})}_checkForConflictingLocalOptions(){let i=this.options.filter(a=>{let d=a.attributeName();return this.getOptionValue(d)===void 0?!1:this.getOptionValueSource(d)!=="default"});i.filter(a=>a.conflictsWith.length>0).forEach(a=>{let d=i.find(p=>a.conflictsWith.includes(p.attributeName()));d&&this._conflictingOption(a,d)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(i=>{i._checkForConflictingLocalOptions()})}parseOptions(i){let l=[],a=[],d=l,p=i.slice();function _(b){return b.length>1&&b[0]==="-"}let A=null;for(;p.length;){let b=p.shift();if(b==="--"){d===a&&d.push(b),d.push(...p);break}if(A&&!_(b)){this.emit(`option:${A.name()}`,b);continue}if(A=null,_(b)){let k=this._findOption(b);if(k){if(k.required){let S=p.shift();S===void 0&&this.optionMissingArgument(k),this.emit(`option:${k.name()}`,S)}else if(k.optional){let S=null;p.length>0&&!_(p[0])&&(S=p.shift()),this.emit(`option:${k.name()}`,S)}else this.emit(`option:${k.name()}`);A=k.variadic?k:null;continue}}if(b.length>2&&b[0]==="-"&&b[1]!=="-"){let k=this._findOption(`-${b[1]}`);if(k){k.required||k.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${k.name()}`,b.slice(2)):(this.emit(`option:${k.name()}`),p.unshift(`-${b.slice(2)}`));continue}}if(/^--[^=]+=/.test(b)){let k=b.indexOf("="),S=this._findOption(b.slice(0,k));if(S&&(S.required||S.optional)){this.emit(`option:${S.name()}`,b.slice(k+1));continue}}if(_(b)&&(d=a),(this._enablePositionalOptions||this._passThroughOptions)&&l.length===0&&a.length===0){if(this._findCommand(b)){l.push(b),p.length>0&&a.push(...p);break}else if(this._getHelpCommand()&&b===this._getHelpCommand().name()){l.push(b),p.length>0&&l.push(...p);break}else if(this._defaultCommandName){a.push(b),p.length>0&&a.push(...p);break}}if(this._passThroughOptions){d.push(b),p.length>0&&d.push(...p);break}d.push(b)}return{operands:l,unknown:a}}opts(){if(this._storeOptionsAsProperties){let i={},l=this.options.length;for(let a=0;a<l;a++){let d=this.options[a].attributeName();i[d]=d===this._versionOptionName?this._version:this[d]}return i}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((i,l)=>Object.assign(i,l.opts()),{})}error(i,l){this._outputConfiguration.outputError(`${i}
17
+ - ${T}`;throw new Error(I)}else if(S.code==="EACCES")throw new Error(`'${y}' not executable`);if(!$)L.exit(1);else{let T=new Hr(1,"commander.executeSubCommandAsync","(error)");T.nestedError=S,$(T)}}),this.runningCommand=b}_dispatchSubcommand(i,a,l){let d=this._findCommand(i);d||this.help({error:!0});let h;return h=this._chainOrCallSubCommandHook(h,d,"preSubcommand"),h=this._chainOrCall(h,()=>{if(d._executableHandler)this._executeSubCommand(d,a.concat(l));else return d._parseCommand(a,l)}),h}_dispatchHelpCommand(i){i||this.help();let a=this._findCommand(i);return a&&!a._executableHandler&&a.help(),this._dispatchSubcommand(i,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((i,a)=>{i.required&&this.args[a]==null&&this.missingArgument(i.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let i=(l,d,h)=>{let y=d;if(d!==null&&l.parseArg){let k=`error: command-argument value '${d}' is invalid for argument '${l.name()}'.`;y=this._callParseArg(l,d,h,k)}return y};this._checkNumberOfArguments();let a=[];this.registeredArguments.forEach((l,d)=>{let h=l.defaultValue;l.variadic?d<this.args.length?(h=this.args.slice(d),l.parseArg&&(h=h.reduce((y,k)=>i(l,k,y),l.defaultValue))):h===void 0&&(h=[]):d<this.args.length&&(h=this.args[d],l.parseArg&&(h=i(l,h,l.defaultValue))),a[d]=h}),this.processedArgs=a}_chainOrCall(i,a){return i&&i.then&&typeof i.then=="function"?i.then(()=>a()):a()}_chainOrCallHooks(i,a){let l=i,d=[];return this._getCommandAndAncestors().reverse().filter(h=>h._lifeCycleHooks[a]!==void 0).forEach(h=>{h._lifeCycleHooks[a].forEach(y=>{d.push({hookedCommand:h,callback:y})})}),a==="postAction"&&d.reverse(),d.forEach(h=>{l=this._chainOrCall(l,()=>h.callback(h.hookedCommand,this))}),l}_chainOrCallSubCommandHook(i,a,l){let d=i;return this._lifeCycleHooks[l]!==void 0&&this._lifeCycleHooks[l].forEach(h=>{d=this._chainOrCall(d,()=>h(this,a))}),d}_parseCommand(i,a){let l=this.parseOptions(a);if(this._parseOptionsEnv(),this._parseOptionsImplied(),i=i.concat(l.operands),a=l.unknown,this.args=i.concat(a),i&&this._findCommand(i[0]))return this._dispatchSubcommand(i[0],i.slice(1),a);if(this._getHelpCommand()&&i[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(i[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(a),this._dispatchSubcommand(this._defaultCommandName,i,a);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(l.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let d=()=>{l.unknown.length>0&&this.unknownOption(l.unknown[0])},h=`command:${this.name()}`;if(this._actionHandler){d(),this._processArguments();let y;return y=this._chainOrCallHooks(y,"preAction"),y=this._chainOrCall(y,()=>this._actionHandler(this.processedArgs)),this.parent&&(y=this._chainOrCall(y,()=>{this.parent.emit(h,i,a)})),y=this._chainOrCallHooks(y,"postAction"),y}if(this.parent&&this.parent.listenerCount(h))d(),this._processArguments(),this.parent.emit(h,i,a);else if(i.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",i,a);this.listenerCount("command:*")?this.emit("command:*",i,a):this.commands.length?this.unknownCommand():(d(),this._processArguments())}else this.commands.length?(d(),this.help({error:!0})):(d(),this._processArguments())}_findCommand(i){if(i)return this.commands.find(a=>a._name===i||a._aliases.includes(i))}_findOption(i){return this.options.find(a=>a.is(i))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(i=>{i.options.forEach(a=>{a.mandatory&&i.getOptionValue(a.attributeName())===void 0&&i.missingMandatoryOptionValue(a)})})}_checkForConflictingLocalOptions(){let i=this.options.filter(l=>{let d=l.attributeName();return this.getOptionValue(d)===void 0?!1:this.getOptionValueSource(d)!=="default"});i.filter(l=>l.conflictsWith.length>0).forEach(l=>{let d=i.find(h=>l.conflictsWith.includes(h.attributeName()));d&&this._conflictingOption(l,d)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(i=>{i._checkForConflictingLocalOptions()})}parseOptions(i){let a=[],l=[],d=a,h=i.slice();function y(b){return b.length>1&&b[0]==="-"}let k=null;for(;h.length;){let b=h.shift();if(b==="--"){d===l&&d.push(b),d.push(...h);break}if(k&&!y(b)){this.emit(`option:${k.name()}`,b);continue}if(k=null,y(b)){let $=this._findOption(b);if($){if($.required){let S=h.shift();S===void 0&&this.optionMissingArgument($),this.emit(`option:${$.name()}`,S)}else if($.optional){let S=null;h.length>0&&!y(h[0])&&(S=h.shift()),this.emit(`option:${$.name()}`,S)}else this.emit(`option:${$.name()}`);k=$.variadic?$:null;continue}}if(b.length>2&&b[0]==="-"&&b[1]!=="-"){let $=this._findOption(`-${b[1]}`);if($){$.required||$.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${$.name()}`,b.slice(2)):(this.emit(`option:${$.name()}`),h.unshift(`-${b.slice(2)}`));continue}}if(/^--[^=]+=/.test(b)){let $=b.indexOf("="),S=this._findOption(b.slice(0,$));if(S&&(S.required||S.optional)){this.emit(`option:${S.name()}`,b.slice($+1));continue}}if(y(b)&&(d=l),(this._enablePositionalOptions||this._passThroughOptions)&&a.length===0&&l.length===0){if(this._findCommand(b)){a.push(b),h.length>0&&l.push(...h);break}else if(this._getHelpCommand()&&b===this._getHelpCommand().name()){a.push(b),h.length>0&&a.push(...h);break}else if(this._defaultCommandName){l.push(b),h.length>0&&l.push(...h);break}}if(this._passThroughOptions){d.push(b),h.length>0&&d.push(...h);break}d.push(b)}return{operands:a,unknown:l}}opts(){if(this._storeOptionsAsProperties){let i={},a=this.options.length;for(let l=0;l<a;l++){let d=this.options[l].attributeName();i[d]=d===this._versionOptionName?this._version:this[d]}return i}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((i,a)=>Object.assign(i,a.opts()),{})}error(i,a){this._outputConfiguration.outputError(`${i}
18
18
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
19
19
  `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
20
- `),this.outputHelp({error:!0}));let a=l||{},d=a.exitCode||1,p=a.code||"commander.error";this._exit(d,p,i)}_parseOptionsEnv(){this.options.forEach(i=>{if(i.envVar&&i.envVar in L.env){let l=i.attributeName();(this.getOptionValue(l)===void 0||["default","config","env"].includes(this.getOptionValueSource(l)))&&(i.required||i.optional?this.emit(`optionEnv:${i.name()}`,L.env[i.envVar]):this.emit(`optionEnv:${i.name()}`))}})}_parseOptionsImplied(){let i=new Os(this.options),l=a=>this.getOptionValue(a)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(a));this.options.filter(a=>a.implied!==void 0&&l(a.attributeName())&&i.valueFromOption(this.getOptionValue(a.attributeName()),a)).forEach(a=>{Object.keys(a.implied).filter(d=>!l(d)).forEach(d=>{this.setOptionValueWithSource(d,a.implied[d],"implied")})})}missingArgument(i){let l=`error: missing required argument '${i}'`;this.error(l,{code:"commander.missingArgument"})}optionMissingArgument(i){let l=`error: option '${i.flags}' argument missing`;this.error(l,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(i){let l=`error: required option '${i.flags}' not specified`;this.error(l,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(i,l){let a=_=>{let A=_.attributeName(),b=this.getOptionValue(A),k=this.options.find(F=>F.negate&&A===F.attributeName()),S=this.options.find(F=>!F.negate&&A===F.attributeName());return k&&(k.presetArg===void 0&&b===!1||k.presetArg!==void 0&&b===k.presetArg)?k:S||_},d=_=>{let A=a(_),b=A.attributeName();return this.getOptionValueSource(b)==="env"?`environment variable '${A.envVar}'`:`option '${A.flags}'`},p=`error: ${d(i)} cannot be used with ${d(l)}`;this.error(p,{code:"commander.conflictingOption"})}unknownOption(i){if(this._allowUnknownOption)return;let l="";if(i.startsWith("--")&&this._showSuggestionAfterError){let d=[],p=this;do{let _=p.createHelp().visibleOptions(p).filter(A=>A.long).map(A=>A.long);d=d.concat(_),p=p.parent}while(p&&!p._enablePositionalOptions);l=Xt(i,d)}let a=`error: unknown option '${i}'${l}`;this.error(a,{code:"commander.unknownOption"})}_excessArguments(i){if(this._allowExcessArguments)return;let l=this.registeredArguments.length,a=l===1?"":"s",p=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${l} argument${a} but got ${i.length}.`;this.error(p,{code:"commander.excessArguments"})}unknownCommand(){let i=this.args[0],l="";if(this._showSuggestionAfterError){let d=[];this.createHelp().visibleCommands(this).forEach(p=>{d.push(p.name()),p.alias()&&d.push(p.alias())}),l=Xt(i,d)}let a=`error: unknown command '${i}'${l}`;this.error(a,{code:"commander.unknownCommand"})}version(i,l,a){if(i===void 0)return this._version;this._version=i,l=l||"-V, --version",a=a||"output the version number";let d=this.createOption(l,a);return this._versionOptionName=d.attributeName(),this._registerOption(d),this.on("option:"+d.name(),()=>{this._outputConfiguration.writeOut(`${i}
21
- `),this._exit(0,"commander.version",i)}),this}description(i,l){return i===void 0&&l===void 0?this._description:(this._description=i,l&&(this._argsDescription=l),this)}summary(i){return i===void 0?this._summary:(this._summary=i,this)}alias(i){if(i===void 0)return this._aliases[0];let l=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(l=this.commands[this.commands.length-1]),i===l._name)throw new Error("Command alias can't be the same as its name");let a=this.parent?._findCommand(i);if(a){let d=[a.name()].concat(a.aliases()).join("|");throw new Error(`cannot add alias '${i}' to command '${this.name()}' as already have command '${d}'`)}return l._aliases.push(i),this}aliases(i){return i===void 0?this._aliases:(i.forEach(l=>this.alias(l)),this)}usage(i){if(i===void 0){if(this._usage)return this._usage;let l=this.registeredArguments.map(a=>ks(a));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?l:[]).join(" ")}return this._usage=i,this}name(i){return i===void 0?this._name:(this._name=i,this)}nameFromFilename(i){return this._name=ue.basename(i,ue.extname(i)),this}executableDir(i){return i===void 0?this._executableDir:(this._executableDir=i,this)}helpInformation(i){let l=this.createHelp();return l.helpWidth===void 0&&(l.helpWidth=i&&i.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),l.formatHelp(this,l)}_getHelpContext(i){i=i||{};let l={error:!!i.error},a;return l.error?a=d=>this._outputConfiguration.writeErr(d):a=d=>this._outputConfiguration.writeOut(d),l.write=i.write||a,l.command=this,l}outputHelp(i){let l;typeof i=="function"&&(l=i,i=void 0);let a=this._getHelpContext(i);this._getCommandAndAncestors().reverse().forEach(p=>p.emit("beforeAllHelp",a)),this.emit("beforeHelp",a);let d=this.helpInformation(a);if(l&&(d=l(d),typeof d!="string"&&!Buffer.isBuffer(d)))throw new Error("outputHelp callback must return a string or a Buffer");a.write(d),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",a),this._getCommandAndAncestors().forEach(p=>p.emit("afterAllHelp",a))}helpOption(i,l){return typeof i=="boolean"?(i?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(i=i??"-h, --help",l=l??"display help for command",this._helpOption=this.createOption(i,l),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(i){return this._helpOption=i,this}help(i){this.outputHelp(i);let l=L.exitCode||0;l===0&&i&&typeof i!="function"&&i.error&&(l=1),this._exit(l,"commander.help","(outputHelp)")}addHelpText(i,l){let a=["beforeAll","before","after","afterAll"];if(!a.includes(i))throw new Error(`Unexpected value for position to addHelpText.
22
- Expecting one of '${a.join("', '")}'`);let d=`${i}Help`;return this.on(d,p=>{let _;typeof l=="function"?_=l({error:p.error,command:p.command}):_=l,_&&p.write(`${_}
23
- `)}),this}_outputHelpIfRequested(i){let l=this._getHelpOption();l&&i.find(d=>l.is(d))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Qt(g){return g.map(i=>{if(!i.startsWith("--inspect"))return i;let l,a="127.0.0.1",d="9229",p;return(p=i.match(/^(--inspect(-brk)?)$/))!==null?l=p[1]:(p=i.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(l=p[1],/^\d+$/.test(p[3])?d=p[3]:a=p[3]):(p=i.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(l=p[1],a=p[3],d=p[4]),l&&d!=="0"?`${l}=${a}:${parseInt(d)+1}`:i})}Zt.Command=Ur});var on=ge(re=>{var{Argument:rn}=nr(),{Command:Ir}=en(),{CommanderError:Ss,InvalidArgumentError:tn}=Me(),{Help:Ps}=xr(),{Option:nn}=Hr();re.program=new Ir;re.createCommand=g=>new Ir(g);re.createOption=(g,i)=>new nn(g,i);re.createArgument=(g,i)=>new rn(g,i);re.Command=Ir;re.Option=nn;re.Argument=rn;re.Help=Ps;re.CommanderError=Ss;re.InvalidArgumentError=tn;re.InvalidOptionArgumentError=tn});var Nr=Ar(require("fs")),ln=require("path");function kr(g,i){if(!g)throw new Error(i);return g}function Ht(g){return kr(g),g}function Rt(g){throw new Error("Should not be reachable")}var Vt=async(g,i)=>{let l={instantiateWasm:async(a,d)=>{switch(g.type){case"response":{let p=await WebAssembly.instantiateStreaming(g.response,a);d(p.instance,p.module)}break;case"buffer":{let p=await WebAssembly.instantiate(await g.buffer,a);d(p.instance,p.module)}break;default:Rt(g)}}};return Ht(await(await i)(l))};var us=new TextEncoder,$r=g=>us.encode(g),cs=new TextDecoder,Wt=g=>cs.decode(g);var fs=!1,ds=g=>{if(typeof g=="string")return $r(g);if(g instanceof Uint8Array)return g;if(g instanceof Object)return $r(JSON.stringify(g));throw new Error("unsupported type")},Ut=g=>{let i=new g.DocumentEngine.create;return{exec:(p,..._)=>(()=>{let{error:b,values:k}=(()=>{let F=new g.MemoryHandleVector;try{for(let W of _){let B=ds(W),R=g.allocateMemory(B.byteLength);try{kr(R.size===B.byteLength),R.view.set(B),F.push_back(R)}finally{R.delete()}}try{return i.exec(p,F)}catch(W){throw console.error("exception while calling exec",p,W),W}}finally{F.delete()}})();if(b)throw k.delete(),fs&&console.error("WASM request",p,_,"yielded error",b),b;let S=[];for(let F=0;F<k.size();++F){let W=k.get(F);S.push(W.view.slice()),W.delete()}return k.delete(),S})(),destroy:()=>{i.delete()}}};var Ce=Ar(require("fs")),Lt=require("path");var It=g=>JSON.parse(Wt(g));var Nt=(g,i,l)=>{let{wasmExecutor:a}=g;return It(a.exec("fonts/index",{id:l},i)[0])},Bt=g=>({v:1,availableFonts:g});var hs=[".ttf",".otf",".ttc",".otc"],qt=(g,i)=>{let l=[];return Ce.readdirSync(i).forEach(a=>{let d=(0,Lt.resolve)(i,a);if(!Ce.statSync(d).isFile()||hs.every(A=>!a.toLowerCase().endsWith(A)))return;let p=(()=>{try{return new Uint8Array(Ce.readFileSync(d))}catch{throw new Error(`Error processing file '${a}'.`)}})(),_=Nt(g,p,a);l=l.concat(_)}),l};var ps=(()=>{var g=typeof document<"u"?document.currentScript?.src:void 0;return function(i={}){var l,a=i,d,p,_=new Promise((e,r)=>{d=e,p=r}),A=!0,b=!1,k=Object.assign({},a),S=[],F="./this.program",W=(e,r)=>{throw r},B="";function R(e){return a.locateFile?a.locateFile(e,B):B+e}var Q,de;(A||b)&&(b?B=self.location.href:typeof document<"u"&&document.currentScript&&(B=document.currentScript.src),g&&(B=g),B.startsWith("blob:")?B="":B=B.substr(0,B.replace(/[?#].*/,"").lastIndexOf("/")+1),Q=e=>fetch(e,{credentials:"same-origin"}).then(r=>r.ok?r.arrayBuffer():Promise.reject(new Error(r.status+" : "+r.url))));var ir=a.print||console.log.bind(console),ce=a.printErr||console.error.bind(console);Object.assign(a,k),k=null,a.arguments&&(S=a.arguments),a.thisProgram&&(F=a.thisProgram),a.quit&&(W=a.quit);var Ae;a.wasmBinary&&(Ae=a.wasmBinary);var je,or=!1,He,K,Y,te,Re,C,M,Lr,qr;function zr(){var e=je.buffer;a.HEAP8=K=new Int8Array(e),a.HEAP16=te=new Int16Array(e),a.HEAPU8=Y=new Uint8Array(e),a.HEAPU16=Re=new Uint16Array(e),a.HEAP32=C=new Int32Array(e),a.HEAPU32=M=new Uint32Array(e),a.HEAPF32=Lr=new Float32Array(e),a.HEAPF64=qr=new Float64Array(e)}var Gr=[],Jr=[],un=[],Yr=[],Kr=!1;function cn(){if(a.preRun)for(typeof a.preRun=="function"&&(a.preRun=[a.preRun]);a.preRun.length;)pn(a.preRun.shift());Ie(Gr)}function fn(){Kr=!0,!a.noFSInit&&!s.init.initialized&&s.init(),s.ignorePermissions=!1,fe.init(),Ie(Jr)}function dn(){Ie(un)}function hn(){if(a.postRun)for(typeof a.postRun=="function"&&(a.postRun=[a.postRun]);a.postRun.length;)vn(a.postRun.shift());Ie(Yr)}function pn(e){Gr.unshift(e)}function mn(e){Jr.unshift(e)}function vn(e){Yr.unshift(e)}var he=0,sr=null,ke=null;function Ds(e){return e}function ar(e){he++,a.monitorRunDependencies?.(he)}function Ve(e){if(he--,a.monitorRunDependencies?.(he),he==0&&(sr!==null&&(clearInterval(sr),sr=null),ke)){var r=ke;ke=null,r()}}function We(e){a.onAbort?.(e),e="Aborted("+e+")",ce(e),or=!0,He=1,e+=". Build with -sASSERTIONS for more info.",Kr&&Ft();var r=new WebAssembly.RuntimeError(e);throw p(r),r}var gn="data:application/octet-stream;base64,",Xr=e=>e.startsWith(gn);function _n(){var e="docauth.wasm";return Xr(e)?e:R(e)}var Ue;function Qr(e){if(e==Ue&&Ae)return new Uint8Array(Ae);if(de)return de(e);throw"both async and sync fetching of the wasm failed"}function yn(e){return Ae?Promise.resolve().then(()=>Qr(e)):Q(e).then(r=>new Uint8Array(r),()=>Qr(e))}function Zr(e,r,t){return yn(e).then(n=>WebAssembly.instantiate(n,r)).then(t,n=>{ce(`failed to asynchronously prepare wasm: ${n}`),We(n)})}function wn(e,r,t,n){return!e&&typeof WebAssembly.instantiateStreaming=="function"&&!Xr(r)&&typeof fetch=="function"?fetch(r,{credentials:"same-origin"}).then(o=>{var u=WebAssembly.instantiateStreaming(o,t);return u.then(n,function(c){return ce(`wasm streaming compile failed: ${c}`),ce("falling back to ArrayBuffer instantiation"),Zr(r,t,n)})}):Zr(r,t,n)}function En(){return{a:Wo}}function bn(){var e=En();function r(n,o){return j=n.exports,je=j.fa,zr(),pt=j.la,mn(j.ga),Ve("wasm-instantiate"),j}ar("wasm-instantiate");function t(n){r(n.instance)}if(a.instantiateWasm)try{return a.instantiateWasm(e,r)}catch(n){ce(`Module.instantiateWasm callback failed with error: ${n}`),p(n)}return Ue||(Ue=_n()),wn(Ae,Ue,e,t).catch(p),{}}var O,U;function et(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}var Ie=e=>{for(;e.length>0;)e.shift()(a)},Cn=a.noExitRuntime||!0,V={isAbs:e=>e.charAt(0)==="/",splitPath:e=>{var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return r.exec(e).slice(1)},normalizeArray:(e,r)=>{for(var t=0,n=e.length-1;n>=0;n--){var o=e[n];o==="."?e.splice(n,1):o===".."?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=V.isAbs(e),t=e.substr(-1)==="/";return e=V.normalizeArray(e.split("/").filter(n=>!!n),!r).join("/"),!e&&!r&&(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=V.splitPath(e),t=r[0],n=r[1];return!t&&!n?".":(n&&(n=n.substr(0,n.length-1)),t+n)},basename:e=>{if(e==="/")return"/";e=V.normalize(e),e=e.replace(/\/$/,"");var r=e.lastIndexOf("/");return r===-1?e:e.substr(r+1)},join:(...e)=>V.normalize(e.join("/")),join2:(e,r)=>V.normalize(e+"/"+r)},An=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return e=>crypto.getRandomValues(e);We("initRandomDevice")},rt=e=>(rt=An())(e),ne={resolve:(...e)=>{for(var r="",t=!1,n=e.length-1;n>=-1&&!t;n--){var o=n>=0?e[n]:s.cwd();if(typeof o!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!o)return"";r=o+"/"+r,t=V.isAbs(o)}return r=V.normalizeArray(r.split("/").filter(u=>!!u),!t).join("/"),(t?"/":"")+r||"."},relative:(e,r)=>{e=ne.resolve(e).substr(1),r=ne.resolve(r).substr(1);function t(m){for(var v=0;v<m.length&&m[v]==="";v++);for(var y=m.length-1;y>=0&&m[y]==="";y--);return v>y?[]:m.slice(v,y-v+1)}for(var n=t(e.split("/")),o=t(r.split("/")),u=Math.min(n.length,o.length),c=u,f=0;f<u;f++)if(n[f]!==o[f]){c=f;break}for(var h=[],f=c;f<n.length;f++)h.push("..");return h=h.concat(o.slice(c)),h.join("/")}},tt=typeof TextDecoder<"u"?new TextDecoder:void 0,_e=(e,r,t)=>{for(var n=r+t,o=r;e[o]&&!(o>=n);)++o;if(o-r>16&&e.buffer&&tt)return tt.decode(e.subarray(r,o));for(var u="";r<o;){var c=e[r++];if(!(c&128)){u+=String.fromCharCode(c);continue}var f=e[r++]&63;if((c&224)==192){u+=String.fromCharCode((c&31)<<6|f);continue}var h=e[r++]&63;if((c&240)==224?c=(c&15)<<12|f<<6|h:c=(c&7)<<18|f<<12|h<<6|e[r++]&63,c<65536)u+=String.fromCharCode(c);else{var m=c-65536;u+=String.fromCharCode(55296|m>>10,56320|m&1023)}}return u},lr=[],Ne=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n<=127?r++:n<=2047?r+=2:n>=55296&&n<=57343?(r+=4,++t):r+=3}return r},ur=(e,r,t,n)=>{if(!(n>0))return 0;for(var o=t,u=t+n-1,c=0;c<e.length;++c){var f=e.charCodeAt(c);if(f>=55296&&f<=57343){var h=e.charCodeAt(++c);f=65536+((f&1023)<<10)|h&1023}if(f<=127){if(t>=u)break;r[t++]=f}else if(f<=2047){if(t+1>=u)break;r[t++]=192|f>>6,r[t++]=128|f&63}else if(f<=65535){if(t+2>=u)break;r[t++]=224|f>>12,r[t++]=128|f>>6&63,r[t++]=128|f&63}else{if(t+3>=u)break;r[t++]=240|f>>18,r[t++]=128|f>>12&63,r[t++]=128|f>>6&63,r[t++]=128|f&63}}return r[t]=0,t-o};function nt(e,r,t){var n=t>0?t:Ne(e)+1,o=new Array(n),u=ur(e,o,0,o.length);return r&&(o.length=u),o}var kn=()=>{if(!lr.length){var e=null;if(typeof window<"u"&&typeof window.prompt=="function"&&(e=window.prompt("Input: "),e!==null&&(e+=`
24
- `)),!e)return null;lr=nt(e,!0)}return lr.shift()},fe={ttys:[],init(){},shutdown(){},register(e,r){fe.ttys[e]={input:[],output:[],ops:r},s.registerDevice(e,fe.stream_ops)},stream_ops:{open(e){var r=fe.ttys[e.node.rdev];if(!r)throw new s.ErrnoError(43);e.tty=r,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,r,t,n,o){if(!e.tty||!e.tty.ops.get_char)throw new s.ErrnoError(60);for(var u=0,c=0;c<n;c++){var f;try{f=e.tty.ops.get_char(e.tty)}catch{throw new s.ErrnoError(29)}if(f===void 0&&u===0)throw new s.ErrnoError(6);if(f==null)break;u++,r[t+c]=f}return u&&(e.node.timestamp=Date.now()),u},write(e,r,t,n,o){if(!e.tty||!e.tty.ops.put_char)throw new s.ErrnoError(60);try{for(var u=0;u<n;u++)e.tty.ops.put_char(e.tty,r[t+u])}catch{throw new s.ErrnoError(29)}return n&&(e.node.timestamp=Date.now()),u}},default_tty_ops:{get_char(e){return kn()},put_char(e,r){r===null||r===10?(ir(_e(e.output,0)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(ir(_e(e.output,0)),e.output=[])},ioctl_tcgets(e){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(e,r,t){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,r){r===null||r===10?(ce(_e(e.output,0)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(ce(_e(e.output,0)),e.output=[])}}},$n=(e,r)=>(Y.fill(0,e,e+r),e),On=(e,r)=>Math.ceil(e/r)*r,it=e=>{e=On(e,65536);var r=Pt(65536,e);return r?$n(r,e):0},P={ops_table:null,mount(e){return P.createNode(null,"/",16895,0)},createNode(e,r,t,n){if(s.isBlkdev(t)||s.isFIFO(t))throw new s.ErrnoError(63);P.ops_table||={dir:{node:{getattr:P.node_ops.getattr,setattr:P.node_ops.setattr,lookup:P.node_ops.lookup,mknod:P.node_ops.mknod,rename:P.node_ops.rename,unlink:P.node_ops.unlink,rmdir:P.node_ops.rmdir,readdir:P.node_ops.readdir,symlink:P.node_ops.symlink},stream:{llseek:P.stream_ops.llseek}},file:{node:{getattr:P.node_ops.getattr,setattr:P.node_ops.setattr},stream:{llseek:P.stream_ops.llseek,read:P.stream_ops.read,write:P.stream_ops.write,allocate:P.stream_ops.allocate,mmap:P.stream_ops.mmap,msync:P.stream_ops.msync}},link:{node:{getattr:P.node_ops.getattr,setattr:P.node_ops.setattr,readlink:P.node_ops.readlink},stream:{}},chrdev:{node:{getattr:P.node_ops.getattr,setattr:P.node_ops.setattr},stream:s.chrdev_stream_ops}};var o=s.createNode(e,r,t,n);return s.isDir(o.mode)?(o.node_ops=P.ops_table.dir.node,o.stream_ops=P.ops_table.dir.stream,o.contents={}):s.isFile(o.mode)?(o.node_ops=P.ops_table.file.node,o.stream_ops=P.ops_table.file.stream,o.usedBytes=0,o.contents=null):s.isLink(o.mode)?(o.node_ops=P.ops_table.link.node,o.stream_ops=P.ops_table.link.stream):s.isChrdev(o.mode)&&(o.node_ops=P.ops_table.chrdev.node,o.stream_ops=P.ops_table.chrdev.stream),o.timestamp=Date.now(),e&&(e.contents[r]=o,e.timestamp=o.timestamp),o},getFileDataAsTypedArray(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage(e,r){var t=e.contents?e.contents.length:0;if(!(t>=r)){var n=1024*1024;r=Math.max(r,t*(t<n?2:1.125)>>>0),t!=0&&(r=Math.max(r,256));var o=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(o.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,r){if(e.usedBytes!=r)if(r==0)e.contents=null,e.usedBytes=0;else{var t=e.contents;e.contents=new Uint8Array(r),t&&e.contents.set(t.subarray(0,Math.min(r,e.usedBytes))),e.usedBytes=r}},node_ops:{getattr(e){var r={};return r.dev=s.isChrdev(e.mode)?e.id:1,r.ino=e.id,r.mode=e.mode,r.nlink=1,r.uid=0,r.gid=0,r.rdev=e.rdev,s.isDir(e.mode)?r.size=4096:s.isFile(e.mode)?r.size=e.usedBytes:s.isLink(e.mode)?r.size=e.link.length:r.size=0,r.atime=new Date(e.timestamp),r.mtime=new Date(e.timestamp),r.ctime=new Date(e.timestamp),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr(e,r){r.mode!==void 0&&(e.mode=r.mode),r.timestamp!==void 0&&(e.timestamp=r.timestamp),r.size!==void 0&&P.resizeFileStorage(e,r.size)},lookup(e,r){throw s.genericErrors[44]},mknod(e,r,t,n){return P.createNode(e,r,t,n)},rename(e,r,t){if(s.isDir(e.mode)){var n;try{n=s.lookupNode(r,t)}catch{}if(n)for(var o in n.contents)throw new s.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=t,r.contents[t]=e,r.timestamp=e.parent.timestamp},unlink(e,r){delete e.contents[r],e.timestamp=Date.now()},rmdir(e,r){var t=s.lookupNode(e,r);for(var n in t.contents)throw new s.ErrnoError(55);delete e.contents[r],e.timestamp=Date.now()},readdir(e){var r=[".",".."];for(var t of Object.keys(e.contents))r.push(t);return r},symlink(e,r,t){var n=P.createNode(e,r,41471,0);return n.link=t,n},readlink(e){if(!s.isLink(e.mode))throw new s.ErrnoError(28);return e.link}},stream_ops:{read(e,r,t,n,o){var u=e.node.contents;if(o>=e.node.usedBytes)return 0;var c=Math.min(e.node.usedBytes-o,n);if(c>8&&u.subarray)r.set(u.subarray(o,o+c),t);else for(var f=0;f<c;f++)r[t+f]=u[o+f];return c},write(e,r,t,n,o,u){if(r.buffer===K.buffer&&(u=!1),!n)return 0;var c=e.node;if(c.timestamp=Date.now(),r.subarray&&(!c.contents||c.contents.subarray)){if(u)return c.contents=r.subarray(t,t+n),c.usedBytes=n,n;if(c.usedBytes===0&&o===0)return c.contents=r.slice(t,t+n),c.usedBytes=n,n;if(o+n<=c.usedBytes)return c.contents.set(r.subarray(t,t+n),o),n}if(P.expandFileStorage(c,o+n),c.contents.subarray&&r.subarray)c.contents.set(r.subarray(t,t+n),o);else for(var f=0;f<n;f++)c.contents[o+f]=r[t+f];return c.usedBytes=Math.max(c.usedBytes,o+n),n},llseek(e,r,t){var n=r;if(t===1?n+=e.position:t===2&&s.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new s.ErrnoError(28);return n},allocate(e,r,t){P.expandFileStorage(e.node,r+t),e.node.usedBytes=Math.max(e.node.usedBytes,r+t)},mmap(e,r,t,n,o){if(!s.isFile(e.node.mode))throw new s.ErrnoError(43);var u,c,f=e.node.contents;if(!(o&2)&&f.buffer===K.buffer)c=!1,u=f.byteOffset;else{if((t>0||t+r<f.length)&&(f.subarray?f=f.subarray(t,t+r):f=Array.prototype.slice.call(f,t,t+r)),c=!0,u=it(r),!u)throw new s.ErrnoError(48);K.set(f,u)}return{ptr:u,allocated:c}},msync(e,r,t,n,o){return P.stream_ops.write(e,r,0,n,t,!1),0}}},Sn=(e,r,t,n)=>{var o=n?"":`al ${e}`;Q(e).then(u=>{r(new Uint8Array(u)),o&&Ve(o)},u=>{if(t)t();else throw`Loading data file "${e}" failed.`}),o&&ar(o)},Pn=(e,r,t,n,o,u)=>{s.createDataFile(e,r,t,n,o,u)},Fn=a.preloadPlugins||[],Tn=(e,r,t,n)=>{typeof Browser<"u"&&Browser.init();var o=!1;return Fn.forEach(u=>{o||u.canHandle(r)&&(u.handle(e,r,t,n),o=!0)}),o},xn=(e,r,t,n,o,u,c,f,h,m)=>{var v=r?ne.resolve(V.join2(e,r)):e,y=`cp ${v}`;function w(E){function $(D){m?.(),f||Pn(e,r,D,n,o,h),u?.(),Ve(y)}Tn(E,v,$,()=>{c?.(),Ve(y)})||$(E)}ar(y),typeof t=="string"?Sn(t,w,c):w(t)},Dn=e=>{var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},t=r[e];if(typeof t>"u")throw new Error(`Unknown file open mode: ${e}`);return t},cr=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},s={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{constructor(e){this.name="ErrnoError",this.errno=e}},genericErrors:{},filesystems:null,syncFSRequests:0,FSStream:class{constructor(){this.shared={}}get object(){return this.node}set object(e){this.node=e}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{constructor(e,r,t,n){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=s.nextInode++,this.name=r,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=n,this.readMode=365,this.writeMode=146}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return s.isDir(this.mode)}get isDevice(){return s.isChrdev(this.mode)}},lookupPath(e,r={}){if(e=ne.resolve(e),!e)return{path:"",node:null};var t={follow_mount:!0,recurse_count:0};if(r=Object.assign(t,r),r.recurse_count>8)throw new s.ErrnoError(32);for(var n=e.split("/").filter(y=>!!y),o=s.root,u="/",c=0;c<n.length;c++){var f=c===n.length-1;if(f&&r.parent)break;if(o=s.lookupNode(o,n[c]),u=V.join2(u,n[c]),s.isMountpoint(o)&&(!f||f&&r.follow_mount)&&(o=o.mounted.root),!f||r.follow)for(var h=0;s.isLink(o.mode);){var m=s.readlink(u);u=ne.resolve(V.dirname(u),m);var v=s.lookupPath(u,{recurse_count:r.recurse_count+1});if(o=v.node,h++>40)throw new s.ErrnoError(32)}}return{path:u,node:o}},getPath(e){for(var r;;){if(s.isRoot(e)){var t=e.mount.mountpoint;return r?t[t.length-1]!=="/"?`${t}/${r}`:t+r:t}r=r?`${e.name}/${r}`:e.name,e=e.parent}},hashName(e,r){for(var t=0,n=0;n<r.length;n++)t=(t<<5)-t+r.charCodeAt(n)|0;return(e+t>>>0)%s.nameTable.length},hashAddNode(e){var r=s.hashName(e.parent.id,e.name);e.name_next=s.nameTable[r],s.nameTable[r]=e},hashRemoveNode(e){var r=s.hashName(e.parent.id,e.name);if(s.nameTable[r]===e)s.nameTable[r]=e.name_next;else for(var t=s.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode(e,r){var t=s.mayLookup(e);if(t)throw new s.ErrnoError(t);for(var n=s.hashName(e.id,r),o=s.nameTable[n];o;o=o.name_next){var u=o.name;if(o.parent.id===e.id&&u===r)return o}return s.lookup(e,r)},createNode(e,r,t,n){var o=new s.FSNode(e,r,t,n);return s.hashAddNode(o),o},destroyNode(e){s.hashRemoveNode(e)},isRoot(e){return e===e.parent},isMountpoint(e){return!!e.mounted},isFile(e){return(e&61440)===32768},isDir(e){return(e&61440)===16384},isLink(e){return(e&61440)===40960},isChrdev(e){return(e&61440)===8192},isBlkdev(e){return(e&61440)===24576},isFIFO(e){return(e&61440)===4096},isSocket(e){return(e&49152)===49152},flagsToPermissionString(e){var r=["r","w","rw"][e&3];return e&512&&(r+="w"),r},nodePermissions(e,r){return s.ignorePermissions?0:r.includes("r")&&!(e.mode&292)||r.includes("w")&&!(e.mode&146)||r.includes("x")&&!(e.mode&73)?2:0},mayLookup(e){if(!s.isDir(e.mode))return 54;var r=s.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate(e,r){try{var t=s.lookupNode(e,r);return 20}catch{}return s.nodePermissions(e,"wx")},mayDelete(e,r,t){var n;try{n=s.lookupNode(e,r)}catch(u){return u.errno}var o=s.nodePermissions(e,"wx");if(o)return o;if(t){if(!s.isDir(n.mode))return 54;if(s.isRoot(n)||s.getPath(n)===s.cwd())return 10}else if(s.isDir(n.mode))return 31;return 0},mayOpen(e,r){return e?s.isLink(e.mode)?32:s.isDir(e.mode)&&(s.flagsToPermissionString(r)!=="r"||r&512)?31:s.nodePermissions(e,s.flagsToPermissionString(r)):44},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=s.MAX_OPEN_FDS;e++)if(!s.streams[e])return e;throw new s.ErrnoError(33)},getStreamChecked(e){var r=s.getStream(e);if(!r)throw new s.ErrnoError(8);return r},getStream:e=>s.streams[e],createStream(e,r=-1){return e=Object.assign(new s.FSStream,e),r==-1&&(r=s.nextfd()),e.fd=r,s.streams[r]=e,e},closeStream(e){s.streams[e]=null},dupStream(e,r=-1){var t=s.createStream(e,r);return t.stream_ops?.dup?.(t),t},chrdev_stream_ops:{open(e){var r=s.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new s.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,r)=>e<<8|r,registerDevice(e,r){s.devices[e]={stream_ops:r}},getDevice:e=>s.devices[e],getMounts(e){for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push(...n.mounts)}return r},syncfs(e,r){typeof e=="function"&&(r=e,e=!1),s.syncFSRequests++,s.syncFSRequests>1&&ce(`warning: ${s.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=s.getMounts(s.root.mount),n=0;function o(c){return s.syncFSRequests--,r(c)}function u(c){if(c)return u.errored?void 0:(u.errored=!0,o(c));++n>=t.length&&o(null)}t.forEach(c=>{if(!c.type.syncfs)return u(null);c.type.syncfs(c,e,u)})},mount(e,r,t){var n=t==="/",o=!t,u;if(n&&s.root)throw new s.ErrnoError(10);if(!n&&!o){var c=s.lookupPath(t,{follow_mount:!1});if(t=c.path,u=c.node,s.isMountpoint(u))throw new s.ErrnoError(10);if(!s.isDir(u.mode))throw new s.ErrnoError(54)}var f={type:e,opts:r,mountpoint:t,mounts:[]},h=e.mount(f);return h.mount=f,f.root=h,n?s.root=h:u&&(u.mounted=f,u.mount&&u.mount.mounts.push(f)),h},unmount(e){var r=s.lookupPath(e,{follow_mount:!1});if(!s.isMountpoint(r.node))throw new s.ErrnoError(28);var t=r.node,n=t.mounted,o=s.getMounts(n);Object.keys(s.nameTable).forEach(c=>{for(var f=s.nameTable[c];f;){var h=f.name_next;o.includes(f.mount)&&s.destroyNode(f),f=h}}),t.mounted=null;var u=t.mount.mounts.indexOf(n);t.mount.mounts.splice(u,1)},lookup(e,r){return e.node_ops.lookup(e,r)},mknod(e,r,t){var n=s.lookupPath(e,{parent:!0}),o=n.node,u=V.basename(e);if(!u||u==="."||u==="..")throw new s.ErrnoError(28);var c=s.mayCreate(o,u);if(c)throw new s.ErrnoError(c);if(!o.node_ops.mknod)throw new s.ErrnoError(63);return o.node_ops.mknod(o,u,r,t)},create(e,r){return r=r!==void 0?r:438,r&=4095,r|=32768,s.mknod(e,r,0)},mkdir(e,r){return r=r!==void 0?r:511,r&=1023,r|=16384,s.mknod(e,r,0)},mkdirTree(e,r){for(var t=e.split("/"),n="",o=0;o<t.length;++o)if(t[o]){n+="/"+t[o];try{s.mkdir(n,r)}catch(u){if(u.errno!=20)throw u}}},mkdev(e,r,t){return typeof t>"u"&&(t=r,r=438),r|=8192,s.mknod(e,r,t)},symlink(e,r){if(!ne.resolve(e))throw new s.ErrnoError(44);var t=s.lookupPath(r,{parent:!0}),n=t.node;if(!n)throw new s.ErrnoError(44);var o=V.basename(r),u=s.mayCreate(n,o);if(u)throw new s.ErrnoError(u);if(!n.node_ops.symlink)throw new s.ErrnoError(63);return n.node_ops.symlink(n,o,e)},rename(e,r){var t=V.dirname(e),n=V.dirname(r),o=V.basename(e),u=V.basename(r),c,f,h;if(c=s.lookupPath(e,{parent:!0}),f=c.node,c=s.lookupPath(r,{parent:!0}),h=c.node,!f||!h)throw new s.ErrnoError(44);if(f.mount!==h.mount)throw new s.ErrnoError(75);var m=s.lookupNode(f,o),v=ne.relative(e,n);if(v.charAt(0)!==".")throw new s.ErrnoError(28);if(v=ne.relative(r,t),v.charAt(0)!==".")throw new s.ErrnoError(55);var y;try{y=s.lookupNode(h,u)}catch{}if(m!==y){var w=s.isDir(m.mode),E=s.mayDelete(f,o,w);if(E)throw new s.ErrnoError(E);if(E=y?s.mayDelete(h,u,w):s.mayCreate(h,u),E)throw new s.ErrnoError(E);if(!f.node_ops.rename)throw new s.ErrnoError(63);if(s.isMountpoint(m)||y&&s.isMountpoint(y))throw new s.ErrnoError(10);if(h!==f&&(E=s.nodePermissions(f,"w"),E))throw new s.ErrnoError(E);s.hashRemoveNode(m);try{f.node_ops.rename(m,h,u),m.parent=h}catch($){throw $}finally{s.hashAddNode(m)}}},rmdir(e){var r=s.lookupPath(e,{parent:!0}),t=r.node,n=V.basename(e),o=s.lookupNode(t,n),u=s.mayDelete(t,n,!0);if(u)throw new s.ErrnoError(u);if(!t.node_ops.rmdir)throw new s.ErrnoError(63);if(s.isMountpoint(o))throw new s.ErrnoError(10);t.node_ops.rmdir(t,n),s.destroyNode(o)},readdir(e){var r=s.lookupPath(e,{follow:!0}),t=r.node;if(!t.node_ops.readdir)throw new s.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var r=s.lookupPath(e,{parent:!0}),t=r.node;if(!t)throw new s.ErrnoError(44);var n=V.basename(e),o=s.lookupNode(t,n),u=s.mayDelete(t,n,!1);if(u)throw new s.ErrnoError(u);if(!t.node_ops.unlink)throw new s.ErrnoError(63);if(s.isMountpoint(o))throw new s.ErrnoError(10);t.node_ops.unlink(t,n),s.destroyNode(o)},readlink(e){var r=s.lookupPath(e),t=r.node;if(!t)throw new s.ErrnoError(44);if(!t.node_ops.readlink)throw new s.ErrnoError(28);return ne.resolve(s.getPath(t.parent),t.node_ops.readlink(t))},stat(e,r){var t=s.lookupPath(e,{follow:!r}),n=t.node;if(!n)throw new s.ErrnoError(44);if(!n.node_ops.getattr)throw new s.ErrnoError(63);return n.node_ops.getattr(n)},lstat(e){return s.stat(e,!0)},chmod(e,r,t){var n;if(typeof e=="string"){var o=s.lookupPath(e,{follow:!t});n=o.node}else n=e;if(!n.node_ops.setattr)throw new s.ErrnoError(63);n.node_ops.setattr(n,{mode:r&4095|n.mode&-4096,timestamp:Date.now()})},lchmod(e,r){s.chmod(e,r,!0)},fchmod(e,r){var t=s.getStreamChecked(e);s.chmod(t.node,r)},chown(e,r,t,n){var o;if(typeof e=="string"){var u=s.lookupPath(e,{follow:!n});o=u.node}else o=e;if(!o.node_ops.setattr)throw new s.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(e,r,t){s.chown(e,r,t,!0)},fchown(e,r,t){var n=s.getStreamChecked(e);s.chown(n.node,r,t)},truncate(e,r){if(r<0)throw new s.ErrnoError(28);var t;if(typeof e=="string"){var n=s.lookupPath(e,{follow:!0});t=n.node}else t=e;if(!t.node_ops.setattr)throw new s.ErrnoError(63);if(s.isDir(t.mode))throw new s.ErrnoError(31);if(!s.isFile(t.mode))throw new s.ErrnoError(28);var o=s.nodePermissions(t,"w");if(o)throw new s.ErrnoError(o);t.node_ops.setattr(t,{size:r,timestamp:Date.now()})},ftruncate(e,r){var t=s.getStreamChecked(e);if(!(t.flags&2097155))throw new s.ErrnoError(28);s.truncate(t.node,r)},utime(e,r,t){var n=s.lookupPath(e,{follow:!0}),o=n.node;o.node_ops.setattr(o,{timestamp:Math.max(r,t)})},open(e,r,t){if(e==="")throw new s.ErrnoError(44);r=typeof r=="string"?Dn(r):r,r&64?(t=typeof t>"u"?438:t,t=t&4095|32768):t=0;var n;if(typeof e=="object")n=e;else{e=V.normalize(e);try{var o=s.lookupPath(e,{follow:!(r&131072)});n=o.node}catch{}}var u=!1;if(r&64)if(n){if(r&128)throw new s.ErrnoError(20)}else n=s.mknod(e,t,0),u=!0;if(!n)throw new s.ErrnoError(44);if(s.isChrdev(n.mode)&&(r&=-513),r&65536&&!s.isDir(n.mode))throw new s.ErrnoError(54);if(!u){var c=s.mayOpen(n,r);if(c)throw new s.ErrnoError(c)}r&512&&!u&&s.truncate(n,0),r&=-131713;var f=s.createStream({node:n,path:s.getPath(n),flags:r,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return f.stream_ops.open&&f.stream_ops.open(f),a.logReadFiles&&!(r&1)&&(s.readFiles||(s.readFiles={}),e in s.readFiles||(s.readFiles[e]=1)),f},close(e){if(s.isClosed(e))throw new s.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(r){throw r}finally{s.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,r,t){if(s.isClosed(e))throw new s.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new s.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new s.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read(e,r,t,n,o){if(n<0||o<0)throw new s.ErrnoError(28);if(s.isClosed(e))throw new s.ErrnoError(8);if((e.flags&2097155)===1)throw new s.ErrnoError(8);if(s.isDir(e.node.mode))throw new s.ErrnoError(31);if(!e.stream_ops.read)throw new s.ErrnoError(28);var u=typeof o<"u";if(!u)o=e.position;else if(!e.seekable)throw new s.ErrnoError(70);var c=e.stream_ops.read(e,r,t,n,o);return u||(e.position+=c),c},write(e,r,t,n,o,u){if(n<0||o<0)throw new s.ErrnoError(28);if(s.isClosed(e))throw new s.ErrnoError(8);if(!(e.flags&2097155))throw new s.ErrnoError(8);if(s.isDir(e.node.mode))throw new s.ErrnoError(31);if(!e.stream_ops.write)throw new s.ErrnoError(28);e.seekable&&e.flags&1024&&s.llseek(e,0,2);var c=typeof o<"u";if(!c)o=e.position;else if(!e.seekable)throw new s.ErrnoError(70);var f=e.stream_ops.write(e,r,t,n,o,u);return c||(e.position+=f),f},allocate(e,r,t){if(s.isClosed(e))throw new s.ErrnoError(8);if(r<0||t<=0)throw new s.ErrnoError(28);if(!(e.flags&2097155))throw new s.ErrnoError(8);if(!s.isFile(e.node.mode)&&!s.isDir(e.node.mode))throw new s.ErrnoError(43);if(!e.stream_ops.allocate)throw new s.ErrnoError(138);e.stream_ops.allocate(e,r,t)},mmap(e,r,t,n,o){if(n&2&&!(o&2)&&(e.flags&2097155)!==2)throw new s.ErrnoError(2);if((e.flags&2097155)===1)throw new s.ErrnoError(2);if(!e.stream_ops.mmap)throw new s.ErrnoError(43);return e.stream_ops.mmap(e,r,t,n,o)},msync(e,r,t,n,o){return e.stream_ops.msync?e.stream_ops.msync(e,r,t,n,o):0},ioctl(e,r,t){if(!e.stream_ops.ioctl)throw new s.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile(e,r={}){if(r.flags=r.flags||0,r.encoding=r.encoding||"binary",r.encoding!=="utf8"&&r.encoding!=="binary")throw new Error(`Invalid encoding type "${r.encoding}"`);var t,n=s.open(e,r.flags),o=s.stat(e),u=o.size,c=new Uint8Array(u);return s.read(n,c,0,u,0),r.encoding==="utf8"?t=_e(c,0):r.encoding==="binary"&&(t=c),s.close(n),t},writeFile(e,r,t={}){t.flags=t.flags||577;var n=s.open(e,t.flags,t.mode);if(typeof r=="string"){var o=new Uint8Array(Ne(r)+1),u=ur(r,o,0,o.length);s.write(n,o,0,u,void 0,t.canOwn)}else if(ArrayBuffer.isView(r))s.write(n,r,0,r.byteLength,void 0,t.canOwn);else throw new Error("Unsupported data type");s.close(n)},cwd:()=>s.currentPath,chdir(e){var r=s.lookupPath(e,{follow:!0});if(r.node===null)throw new s.ErrnoError(44);if(!s.isDir(r.node.mode))throw new s.ErrnoError(54);var t=s.nodePermissions(r.node,"x");if(t)throw new s.ErrnoError(t);s.currentPath=r.path},createDefaultDirectories(){s.mkdir("/tmp"),s.mkdir("/home"),s.mkdir("/home/web_user")},createDefaultDevices(){s.mkdir("/dev"),s.registerDevice(s.makedev(1,3),{read:()=>0,write:(n,o,u,c,f)=>c}),s.mkdev("/dev/null",s.makedev(1,3)),fe.register(s.makedev(5,0),fe.default_tty_ops),fe.register(s.makedev(6,0),fe.default_tty1_ops),s.mkdev("/dev/tty",s.makedev(5,0)),s.mkdev("/dev/tty1",s.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(r===0&&(r=rt(e).byteLength),e[--r]);s.createDevice("/dev","random",t),s.createDevice("/dev","urandom",t),s.mkdir("/dev/shm"),s.mkdir("/dev/shm/tmp")},createSpecialDirectories(){s.mkdir("/proc");var e=s.mkdir("/proc/self");s.mkdir("/proc/self/fd"),s.mount({mount(){var r=s.createNode(e,"fd",16895,73);return r.node_ops={lookup(t,n){var o=+n,u=s.getStreamChecked(o),c={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>u.path}};return c.parent=c,c}},r}},{},"/proc/self/fd")},createStandardStreams(){a.stdin?s.createDevice("/dev","stdin",a.stdin):s.symlink("/dev/tty","/dev/stdin"),a.stdout?s.createDevice("/dev","stdout",null,a.stdout):s.symlink("/dev/tty","/dev/stdout"),a.stderr?s.createDevice("/dev","stderr",null,a.stderr):s.symlink("/dev/tty1","/dev/stderr");var e=s.open("/dev/stdin",0),r=s.open("/dev/stdout",1),t=s.open("/dev/stderr",1)},staticInit(){[44].forEach(e=>{s.genericErrors[e]=new s.ErrnoError(e),s.genericErrors[e].stack="<generic error, no stack>"}),s.nameTable=new Array(4096),s.mount(P,{},"/"),s.createDefaultDirectories(),s.createDefaultDevices(),s.createSpecialDirectories(),s.filesystems={MEMFS:P}},init(e,r,t){s.init.initialized=!0,a.stdin=e||a.stdin,a.stdout=r||a.stdout,a.stderr=t||a.stderr,s.createStandardStreams()},quit(){s.init.initialized=!1;for(var e=0;e<s.streams.length;e++){var r=s.streams[e];r&&s.close(r)}},findObject(e,r){var t=s.analyzePath(e,r);return t.exists?t.object:null},analyzePath(e,r){try{var t=s.lookupPath(e,{follow:!r});e=t.path}catch{}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=s.lookupPath(e,{parent:!0});n.parentExists=!0,n.parentPath=t.path,n.parentObject=t.node,n.name=V.basename(e),t=s.lookupPath(e,{follow:!r}),n.exists=!0,n.path=t.path,n.object=t.node,n.name=t.node.name,n.isRoot=t.path==="/"}catch(o){n.error=o.errno}return n},createPath(e,r,t,n){e=typeof e=="string"?e:s.getPath(e);for(var o=r.split("/").reverse();o.length;){var u=o.pop();if(u){var c=V.join2(e,u);try{s.mkdir(c)}catch{}e=c}}return c},createFile(e,r,t,n,o){var u=V.join2(typeof e=="string"?e:s.getPath(e),r),c=cr(n,o);return s.create(u,c)},createDataFile(e,r,t,n,o,u){var c=r;e&&(e=typeof e=="string"?e:s.getPath(e),c=r?V.join2(e,r):e);var f=cr(n,o),h=s.create(c,f);if(t){if(typeof t=="string"){for(var m=new Array(t.length),v=0,y=t.length;v<y;++v)m[v]=t.charCodeAt(v);t=m}s.chmod(h,f|146);var w=s.open(h,577);s.write(w,t,0,t.length,0,u),s.close(w),s.chmod(h,f)}},createDevice(e,r,t,n){var o=V.join2(typeof e=="string"?e:s.getPath(e),r),u=cr(!!t,!!n);s.createDevice.major||(s.createDevice.major=64);var c=s.makedev(s.createDevice.major++,0);return s.registerDevice(c,{open(f){f.seekable=!1},close(f){n?.buffer?.length&&n(10)},read(f,h,m,v,y){for(var w=0,E=0;E<v;E++){var $;try{$=t()}catch{throw new s.ErrnoError(29)}if($===void 0&&w===0)throw new s.ErrnoError(6);if($==null)break;w++,h[m+E]=$}return w&&(f.node.timestamp=Date.now()),w},write(f,h,m,v,y){for(var w=0;w<v;w++)try{n(h[m+w])}catch{throw new s.ErrnoError(29)}return v&&(f.node.timestamp=Date.now()),w}}),s.mkdev(o,u,c)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(typeof XMLHttpRequest<"u")throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");try{e.contents=de(e.url),e.usedBytes=e.contents.length}catch{throw new s.ErrnoError(29)}},createLazyFile(e,r,t,n,o){class u{constructor(){this.lengthKnown=!1,this.chunks=[]}get(E){if(!(E>this.length-1||E<0)){var $=E%this.chunkSize,D=E/this.chunkSize|0;return this.getter(D)[$]}}setDataGetter(E){this.getter=E}cacheLength(){var E=new XMLHttpRequest;if(E.open("HEAD",t,!1),E.send(null),!(E.status>=200&&E.status<300||E.status===304))throw new Error("Couldn't load "+t+". Status: "+E.status);var $=Number(E.getResponseHeader("Content-length")),D,I=(D=E.getResponseHeader("Accept-Ranges"))&&D==="bytes",N=(D=E.getResponseHeader("Content-Encoding"))&&D==="gzip",z=1024*1024;I||(z=$);var H=(X,le)=>{if(X>le)throw new Error("invalid range ("+X+", "+le+") or no bytes requested!");if(le>$-1)throw new Error("only "+$+" bytes available! programmer error!");var q=new XMLHttpRequest;if(q.open("GET",t,!1),$!==z&&q.setRequestHeader("Range","bytes="+X+"-"+le),q.responseType="arraybuffer",q.overrideMimeType&&q.overrideMimeType("text/plain; charset=x-user-defined"),q.send(null),!(q.status>=200&&q.status<300||q.status===304))throw new Error("Couldn't load "+t+". Status: "+q.status);return q.response!==void 0?new Uint8Array(q.response||[]):nt(q.responseText||"",!0)},ve=this;ve.setDataGetter(X=>{var le=X*z,q=(X+1)*z-1;if(q=Math.min(q,$-1),typeof ve.chunks[X]>"u"&&(ve.chunks[X]=H(le,q)),typeof ve.chunks[X]>"u")throw new Error("doXHR failed!");return ve.chunks[X]}),(N||!$)&&(z=$=1,$=this.getter(0).length,z=$,ir("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=$,this._chunkSize=z,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest<"u"){if(!b)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var c=new u,f={isDevice:!1,contents:c}}else var f={isDevice:!1,url:t};var h=s.createFile(e,r,f,n,o);f.contents?h.contents=f.contents:f.url&&(h.contents=null,h.url=f.url),Object.defineProperties(h,{usedBytes:{get:function(){return this.contents.length}}});var m={},v=Object.keys(h.stream_ops);v.forEach(w=>{var E=h.stream_ops[w];m[w]=(...$)=>(s.forceLoadFile(h),E(...$))});function y(w,E,$,D,I){var N=w.node.contents;if(I>=N.length)return 0;var z=Math.min(N.length-I,D);if(N.slice)for(var H=0;H<z;H++)E[$+H]=N[I+H];else for(var H=0;H<z;H++)E[$+H]=N.get(I+H);return z}return m.read=(w,E,$,D,I)=>(s.forceLoadFile(h),y(w,E,$,D,I)),m.mmap=(w,E,$,D,I)=>{s.forceLoadFile(h);var N=it(E);if(!N)throw new s.ErrnoError(48);return y(w,K,N,E,$),{ptr:N,allocated:!0}},h.stream_ops=m,h}},ot=(e,r)=>e?_e(Y,e,r):"",T={DEFAULT_POLLMASK:5,calculateAt(e,r,t){if(V.isAbs(r))return r;var n;if(e===-100)n=s.cwd();else{var o=T.getStreamFromFD(e);n=o.path}if(r.length==0){if(!t)throw new s.ErrnoError(44);return n}return V.join2(n,r)},doStat(e,r,t){var n=e(r);C[t>>2]=n.dev,C[t+4>>2]=n.mode,M[t+8>>2]=n.nlink,C[t+12>>2]=n.uid,C[t+16>>2]=n.gid,C[t+20>>2]=n.rdev,U=[n.size>>>0,(O=n.size,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],C[t+24>>2]=U[0],C[t+28>>2]=U[1],C[t+32>>2]=4096,C[t+36>>2]=n.blocks;var o=n.atime.getTime(),u=n.mtime.getTime(),c=n.ctime.getTime();return U=[Math.floor(o/1e3)>>>0,(O=Math.floor(o/1e3),+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],C[t+40>>2]=U[0],C[t+44>>2]=U[1],M[t+48>>2]=o%1e3*1e3,U=[Math.floor(u/1e3)>>>0,(O=Math.floor(u/1e3),+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],C[t+56>>2]=U[0],C[t+60>>2]=U[1],M[t+64>>2]=u%1e3*1e3,U=[Math.floor(c/1e3)>>>0,(O=Math.floor(c/1e3),+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],C[t+72>>2]=U[0],C[t+76>>2]=U[1],M[t+80>>2]=c%1e3*1e3,U=[n.ino>>>0,(O=n.ino,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],C[t+88>>2]=U[0],C[t+92>>2]=U[1],0},doMsync(e,r,t,n,o){if(!s.isFile(r.node.mode))throw new s.ErrnoError(43);if(n&2)return 0;var u=Y.slice(e,e+t);s.msync(r,u,o,t,n)},getStreamFromFD(e){var r=s.getStreamChecked(e);return r},varargs:void 0,getStr(e){var r=ot(e);return r}};function Mn(e,r,t,n){try{if(r=T.getStr(r),r=T.calculateAt(e,r),t&-8)return-28;var o=s.lookupPath(r,{follow:!0}),u=o.node;if(!u)return-44;var c="";return t&4&&(c+="r"),t&2&&(c+="w"),t&1&&(c+="x"),c&&s.nodePermissions(u,c)?-2:0}catch(f){if(typeof s>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}function Be(){var e=C[+T.varargs>>2];return T.varargs+=4,e}var ye=Be;function jn(e,r,t){T.varargs=t;try{var n=T.getStreamFromFD(e);switch(r){case 0:{var o=Be();if(o<0)return-28;for(;s.streams[o];)o++;var u;return u=s.dupStream(n,o),u.fd}case 1:case 2:return 0;case 3:return n.flags;case 4:{var o=Be();return n.flags|=o,0}case 12:{var o=ye(),c=0;return te[o+c>>1]=2,0}case 13:case 14:return 0}return-28}catch(f){if(typeof s>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}function Hn(e,r){try{var t=T.getStreamFromFD(e);return T.doStat(s.stat,t.path,r)}catch(n){if(typeof s>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}var we=(e,r)=>r+2097152>>>0<4194305-!!e?(e>>>0)+r*4294967296:NaN;function Rn(e,r,t){var n=we(r,t);try{return isNaN(n)?61:(s.ftruncate(e,n),0)}catch(o){if(typeof s>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}var fr=(e,r,t)=>ur(e,Y,r,t);function Vn(e,r,t){try{var n=T.getStreamFromFD(e);n.getdents||=s.readdir(n.path);for(var o=280,u=0,c=s.llseek(n,0,1),f=Math.floor(c/o);f<n.getdents.length&&u+o<=t;){var h,m,v=n.getdents[f];if(v===".")h=n.node.id,m=4;else if(v===".."){var y=s.lookupPath(n.path,{parent:!0});h=y.node.id,m=4}else{var w=s.lookupNode(n.node,v);h=w.id,m=s.isChrdev(w.mode)?2:s.isDir(w.mode)?4:s.isLink(w.mode)?10:8}U=[h>>>0,(O=h,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],C[r+u>>2]=U[0],C[r+u+4>>2]=U[1],U=[(f+1)*o>>>0,(O=(f+1)*o,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],C[r+u+8>>2]=U[0],C[r+u+12>>2]=U[1],te[r+u+16>>1]=280,K[r+u+18]=m,fr(v,r+u+19,256),u+=o,f+=1}return s.llseek(n,f*o,0),u}catch(E){if(typeof s>"u"||E.name!=="ErrnoError")throw E;return-E.errno}}function Wn(e,r,t){T.varargs=t;try{var n=T.getStreamFromFD(e);switch(r){case 21509:return n.tty?0:-59;case 21505:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcgets){var o=n.tty.ops.ioctl_tcgets(n),u=ye();C[u>>2]=o.c_iflag||0,C[u+4>>2]=o.c_oflag||0,C[u+8>>2]=o.c_cflag||0,C[u+12>>2]=o.c_lflag||0;for(var c=0;c<32;c++)K[u+c+17]=o.c_cc[c]||0;return 0}return 0}case 21510:case 21511:case 21512:return n.tty?0:-59;case 21506:case 21507:case 21508:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcsets){for(var u=ye(),f=C[u>>2],h=C[u+4>>2],m=C[u+8>>2],v=C[u+12>>2],y=[],c=0;c<32;c++)y.push(K[u+c+17]);return n.tty.ops.ioctl_tcsets(n.tty,r,{c_iflag:f,c_oflag:h,c_cflag:m,c_lflag:v,c_cc:y})}return 0}case 21519:{if(!n.tty)return-59;var u=ye();return C[u>>2]=0,0}case 21520:return n.tty?-28:-59;case 21531:{var u=ye();return s.ioctl(n,r,u)}case 21523:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tiocgwinsz){var w=n.tty.ops.ioctl_tiocgwinsz(n.tty),u=ye();te[u>>1]=w[0],te[u+2>>1]=w[1]}return 0}case 21524:return n.tty?0:-59;case 21515:return n.tty?0:-59;default:return-28}}catch(E){if(typeof s>"u"||E.name!=="ErrnoError")throw E;return-E.errno}}function Un(e,r){try{return e=T.getStr(e),T.doStat(s.lstat,e,r)}catch(t){if(typeof s>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}function In(e,r,t,n){try{r=T.getStr(r);var o=n&256,u=n&4096;return n=n&-6401,r=T.calculateAt(e,r,u),T.doStat(o?s.lstat:s.stat,r,t)}catch(c){if(typeof s>"u"||c.name!=="ErrnoError")throw c;return-c.errno}}function Nn(e,r,t,n){T.varargs=n;try{r=T.getStr(r),r=T.calculateAt(e,r);var o=n?Be():0;return s.open(r,t,o).fd}catch(u){if(typeof s>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}function Bn(e,r,t,n){try{return r=T.getStr(r),n=T.getStr(n),r=T.calculateAt(e,r),n=T.calculateAt(t,n),s.rename(r,n),0}catch(o){if(typeof s>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}function Ln(e){try{return e=T.getStr(e),s.rmdir(e),0}catch(r){if(typeof s>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}function qn(e,r){try{return e=T.getStr(e),T.doStat(s.stat,e,r)}catch(t){if(typeof s>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}function zn(e,r,t){try{return r=T.getStr(r),r=T.calculateAt(e,r),t===0?s.unlink(r):t===512?s.rmdir(r):We("Invalid flags passed to unlinkat"),0}catch(n){if(typeof s>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}var Gn=()=>{We("")},Le={},qe=e=>{for(;e.length;){var r=e.pop(),t=e.pop();t(r)}};function $e(e){return this.fromWireType(M[e>>2])}var Ee={},pe={},ze={},st,Ge=e=>{throw new st(e)},Z=(e,r,t)=>{e.forEach(function(f){ze[f]=r});function n(f){var h=t(f);h.length!==e.length&&Ge("Mismatched type converter count");for(var m=0;m<e.length;++m)ie(e[m],h[m])}var o=new Array(r.length),u=[],c=0;r.forEach((f,h)=>{pe.hasOwnProperty(f)?o[h]=pe[f]:(u.push(f),Ee.hasOwnProperty(f)||(Ee[f]=[]),Ee[f].push(()=>{o[h]=pe[f],++c,c===u.length&&n(o)}))}),u.length===0&&n(o)},Jn=e=>{var r=Le[e];delete Le[e];var t=r.rawConstructor,n=r.rawDestructor,o=r.fields,u=o.map(c=>c.getterReturnType).concat(o.map(c=>c.setterArgumentType));Z([e],u,c=>{var f={};return o.forEach((h,m)=>{var v=h.fieldName,y=c[m],w=h.getter,E=h.getterContext,$=c[m+o.length],D=h.setter,I=h.setterContext;f[v]={read:N=>y.fromWireType(w(E,N)),write:(N,z)=>{var H=[];D(I,N,$.toWireType(H,z)),qe(H)}}}),[{name:r.name,fromWireType:h=>{var m={};for(var v in f)m[v]=f[v].read(h);return n(h),m},toWireType:(h,m)=>{for(var v in f)if(!(v in m))throw new TypeError(`Missing field: "${v}"`);var y=t();for(v in f)f[v].write(y,m[v]);return h!==null&&h.push(n,y),y},argPackAdvance:oe,readValueFromPointer:$e,destructorFunction:n}]})},Yn=(e,r,t,n,o)=>{},Kn=()=>{for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);at=e},at,G=e=>{for(var r="",t=e;Y[t];)r+=at[Y[t++]];return r},be,x=e=>{throw new be(e)};function Xn(e,r,t={}){var n=r.name;if(e||x(`type "${n}" must have a positive integer typeid pointer`),pe.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;x(`Cannot register type '${n}' twice`)}if(pe[e]=r,delete ze[e],Ee.hasOwnProperty(e)){var o=Ee[e];delete Ee[e],o.forEach(u=>u())}}function ie(e,r,t={}){if(!("argPackAdvance"in r))throw new TypeError("registerType registeredInstance requires argPackAdvance");return Xn(e,r,t)}var oe=8,Qn=(e,r,t,n)=>{r=G(r),ie(e,{name:r,fromWireType:function(o){return!!o},toWireType:function(o,u){return u?t:n},argPackAdvance:oe,readValueFromPointer:function(o){return this.fromWireType(Y[o])},destructorFunction:null})},Zn=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),dr=e=>{function r(t){return t.$$.ptrType.registeredClass.name}x(r(e)+" instance already deleted")},hr=!1,lt=e=>{},ei=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},ut=e=>{e.count.value-=1;var r=e.count.value===0;r&&ei(e)},ct=(e,r,t)=>{if(r===t)return e;if(t.baseClass===void 0)return null;var n=ct(e,r,t.baseClass);return n===null?null:t.downcast(n)},ft={},ri=()=>Object.keys(Pe).length,ti=()=>{var e=[];for(var r in Pe)Pe.hasOwnProperty(r)&&e.push(Pe[r]);return e},Oe=[],pr=()=>{for(;Oe.length;){var e=Oe.pop();e.$$.deleteScheduled=!1,e.delete()}},Se,ni=e=>{Se=e,Oe.length&&Se&&Se(pr)},ii=()=>{a.getInheritedInstanceCount=ri,a.getLiveInheritedInstances=ti,a.flushPendingDeletes=pr,a.setDelayFunction=ni},Pe={},oi=(e,r)=>{for(r===void 0&&x("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},si=(e,r)=>(r=oi(e,r),Pe[r]),Je=(e,r)=>{(!r.ptrType||!r.ptr)&&Ge("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,n=!!r.smartPtr;return t!==n&&Ge("Both smartPtrType and smartPtr must be specified"),r.count={value:1},Fe(Object.create(e,{$$:{value:r,writable:!0}}))};function ai(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=si(this.registeredClass,r);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();var n=t.clone();return this.destructor(e),n}function o(){return this.isSmartPointer?Je(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):Je(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var u=this.registeredClass.getActualType(r),c=ft[u];if(!c)return o.call(this);var f;this.isConst?f=c.constPointerType:f=c.pointerType;var h=ct(r,this.registeredClass,f.registeredClass);return h===null?o.call(this):this.isSmartPointer?Je(f.registeredClass.instancePrototype,{ptrType:f,ptr:h,smartPtrType:this,smartPtr:e}):Je(f.registeredClass.instancePrototype,{ptrType:f,ptr:h})}var Fe=e=>typeof FinalizationRegistry>"u"?(Fe=r=>r,e):(hr=new FinalizationRegistry(r=>{ut(r.$$)}),Fe=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var o={$$:t};hr.register(r,o,r)}return r},lt=r=>hr.unregister(r),Fe(e)),li=()=>{Object.assign(Ye.prototype,{isAliasOf(e){if(!(this instanceof Ye)||!(e instanceof Ye))return!1;var r=this.$$.ptrType.registeredClass,t=this.$$.ptr;e.$$=e.$$;for(var n=e.$$.ptrType.registeredClass,o=e.$$.ptr;r.baseClass;)t=r.upcast(t),r=r.baseClass;for(;n.baseClass;)o=n.upcast(o),n=n.baseClass;return r===n&&t===o},clone(){if(this.$$.ptr||dr(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=Fe(Object.create(Object.getPrototypeOf(this),{$$:{value:Zn(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||dr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&x("Object already scheduled for deletion"),lt(this),ut(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||dr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&x("Object already scheduled for deletion"),Oe.push(this),Oe.length===1&&Se&&Se(pr),this.$$.deleteScheduled=!0,this}})};function Ye(){}var Te=(e,r)=>Object.defineProperty(r,"name",{value:e}),mr=(e,r,t)=>{if(e[r].overloadTable===void 0){var n=e[r];e[r]=function(...o){return e[r].overloadTable.hasOwnProperty(o.length)||x(`Function '${t}' called with an invalid number of arguments (${o.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[o.length].apply(this,o)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}},dt=(e,r,t)=>{a.hasOwnProperty(e)?((t===void 0||a[e].overloadTable!==void 0&&a[e].overloadTable[t]!==void 0)&&x(`Cannot register public name '${e}' twice`),mr(a,e,e),a.hasOwnProperty(t)&&x(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),a[e].overloadTable[t]=r):(a[e]=r,t!==void 0&&(a[e].numArguments=t))},ui=48,ci=57,fi=e=>{if(e===void 0)return"_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=ui&&r<=ci?`_${e}`:e};function di(e,r,t,n,o,u,c,f){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=o,this.getActualType=u,this.upcast=c,this.downcast=f,this.pureVirtualFunctions=[]}var Ke=(e,r,t)=>{for(;r!==t;)r.upcast||x(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e};function hi(e,r){if(r===null)return this.isReference&&x(`null is not a valid ${this.name}`),0;r.$$||x(`Cannot pass "${yr(r)}" as a ${this.name}`),r.$$.ptr||x(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=Ke(r.$$.ptr,t,this.registeredClass);return n}function pi(e,r){var t;if(r===null)return this.isReference&&x(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;(!r||!r.$$)&&x(`Cannot pass "${yr(r)}" as a ${this.name}`),r.$$.ptr||x(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&x(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var n=r.$$.ptrType.registeredClass;if(t=Ke(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&x("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:x(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else{var o=r.clone();t=this.rawShare(t,ee.toHandle(()=>o.delete())),e!==null&&e.push(this.rawDestructor,t)}break;default:x("Unsupporting sharing policy")}return t}function mi(e,r){if(r===null)return this.isReference&&x(`null is not a valid ${this.name}`),0;r.$$||x(`Cannot pass "${yr(r)}" as a ${this.name}`),r.$$.ptr||x(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&x(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=Ke(r.$$.ptr,t,this.registeredClass);return n}var vi=()=>{Object.assign(xe.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e)},argPackAdvance:oe,readValueFromPointer:$e,fromWireType:ai})};function xe(e,r,t,n,o,u,c,f,h,m,v){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=o,this.pointeeType=u,this.sharingPolicy=c,this.rawGetPointee=f,this.rawConstructor=h,this.rawShare=m,this.rawDestructor=v,!o&&r.baseClass===void 0?n?(this.toWireType=hi,this.destructorFunction=null):(this.toWireType=mi,this.destructorFunction=null):this.toWireType=pi}var ht=(e,r,t)=>{a.hasOwnProperty(e)||Ge("Replacing nonexistent public symbol"),a[e].overloadTable!==void 0&&t!==void 0?a[e].overloadTable[t]=r:(a[e]=r,a[e].argCount=t)},gi=(e,r,t)=>{e=e.replace(/p/g,"i");var n=a["dynCall_"+e];return n(r,...t)},Xe=[],pt,mt=e=>{var r=Xe[e];return r||(e>=Xe.length&&(Xe.length=e+1),Xe[e]=r=pt.get(e)),r},_i=(e,r,t=[])=>{if(e.includes("j"))return gi(e,r,t);var n=mt(r)(...t);return n},yi=(e,r)=>(...t)=>_i(e,r,t),J=(e,r)=>{e=G(e);function t(){return e.includes("j")?yi(e,r):mt(r)}var n=t();return typeof n!="function"&&x(`unknown function pointer with signature ${e}: ${r}`),n},wi=(e,r)=>{var t=Te(r,function(n){this.name=r,this.message=n;var o=new Error(n).stack;o!==void 0&&(this.stack=this.toString()+`
25
- `+o.replace(/^Error(:[^\n]*)?\n/,""))});return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},t},vt,gt=e=>{var r=Ot(e),t=G(r);return ae(r),t},me=(e,r)=>{var t=[],n={};function o(u){if(!n[u]&&!pe[u]){if(ze[u]){ze[u].forEach(o);return}t.push(u),n[u]=!0}}throw r.forEach(o),new vt(`${e}: `+t.map(gt).join([", "]))},Ei=(e,r,t,n,o,u,c,f,h,m,v,y,w)=>{v=G(v),u=J(o,u),f&&=J(c,f),m&&=J(h,m),w=J(y,w);var E=fi(v);dt(E,function(){me(`Cannot construct ${v} due to unbound types`,[n])}),Z([e,r,t],n?[n]:[],$=>{$=$[0];var D,I;n?(D=$.registeredClass,I=D.instancePrototype):I=Ye.prototype;var N=Te(v,function(...q){if(Object.getPrototypeOf(this)!==z)throw new be("Use 'new' to construct "+v);if(H.constructor_body===void 0)throw new be(v+" has no accessible constructor");var Mt=H.constructor_body[q.length];if(Mt===void 0)throw new be(`Tried to invoke ctor of ${v} with invalid number of parameters (${q.length}) - expected (${Object.keys(H.constructor_body).toString()}) parameters instead!`);return Mt.apply(this,q)}),z=Object.create(I,{constructor:{value:N}});N.prototype=z;var H=new di(v,N,z,w,D,u,f,m);H.baseClass&&(H.baseClass.__derivedClasses??=[],H.baseClass.__derivedClasses.push(H));var ve=new xe(v,H,!0,!1,!1),X=new xe(v+"*",H,!1,!1,!1),le=new xe(v+" const*",H,!1,!0,!1);return ft[e]={pointerType:X,constPointerType:le},ht(E,N),[ve,X,le]})};function _t(e){for(var r=1;r<e.length;++r)if(e[r]!==null&&e[r].destructorFunction===void 0)return!0;return!1}function yt(e,r){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var t=Te(e.name||"unknownFunctionName",function(){});t.prototype=e.prototype;var n=new t,o=e.apply(n,r);return o instanceof Object?o:n}function bi(e,r,t,n){for(var o=_t(e),u=e.length,c="",f="",h=0;h<u-2;++h)c+=(h!==0?", ":"")+"arg"+h,f+=(h!==0?", ":"")+"arg"+h+"Wired";var m=`
26
- return function (${c}) {
27
- if (arguments.length !== ${u-2}) {
28
- throwBindingError('function ' + humanName + ' called with ' + arguments.length + ' arguments, expected ${u-2}');
29
- }`;o&&(m+=`var destructors = [];
30
- `);var v=o?"destructors":"null",y=["humanName","throwBindingError","invoker","fn","runDestructors","retType","classParam"];r&&(m+="var thisWired = classParam['toWireType']("+v+`, this);
31
- `);for(var h=0;h<u-2;++h)m+="var arg"+h+"Wired = argType"+h+"['toWireType']("+v+", arg"+h+`);
32
- `,y.push("argType"+h);if(r&&(f="thisWired"+(f.length>0?", ":"")+f),m+=(t||n?"var rv = ":"")+"invoker(fn"+(f.length>0?", ":"")+f+`);
33
- `,o)m+=`runDestructors(destructors);
34
- `;else for(var h=r?1:2;h<e.length;++h){var w=h===1?"thisWired":"arg"+(h-2)+"Wired";e[h].destructorFunction!==null&&(m+=`${w}_dtor(${w});
35
- `,y.push(`${w}_dtor`))}return t&&(m+=`var ret = retType['fromWireType'](rv);
20
+ `),this.outputHelp({error:!0}));let l=a||{},d=l.exitCode||1,h=l.code||"commander.error";this._exit(d,h,i)}_parseOptionsEnv(){this.options.forEach(i=>{if(i.envVar&&i.envVar in L.env){let a=i.attributeName();(this.getOptionValue(a)===void 0||["default","config","env"].includes(this.getOptionValueSource(a)))&&(i.required||i.optional?this.emit(`optionEnv:${i.name()}`,L.env[i.envVar]):this.emit(`optionEnv:${i.name()}`))}})}_parseOptionsImplied(){let i=new Fs(this.options),a=l=>this.getOptionValue(l)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(l));this.options.filter(l=>l.implied!==void 0&&a(l.attributeName())&&i.valueFromOption(this.getOptionValue(l.attributeName()),l)).forEach(l=>{Object.keys(l.implied).filter(d=>!a(d)).forEach(d=>{this.setOptionValueWithSource(d,l.implied[d],"implied")})})}missingArgument(i){let a=`error: missing required argument '${i}'`;this.error(a,{code:"commander.missingArgument"})}optionMissingArgument(i){let a=`error: option '${i.flags}' argument missing`;this.error(a,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(i){let a=`error: required option '${i.flags}' not specified`;this.error(a,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(i,a){let l=y=>{let k=y.attributeName(),b=this.getOptionValue(k),$=this.options.find(T=>T.negate&&k===T.attributeName()),S=this.options.find(T=>!T.negate&&k===T.attributeName());return $&&($.presetArg===void 0&&b===!1||$.presetArg!==void 0&&b===$.presetArg)?$:S||y},d=y=>{let k=l(y),b=k.attributeName();return this.getOptionValueSource(b)==="env"?`environment variable '${k.envVar}'`:`option '${k.flags}'`},h=`error: ${d(i)} cannot be used with ${d(a)}`;this.error(h,{code:"commander.conflictingOption"})}unknownOption(i){if(this._allowUnknownOption)return;let a="";if(i.startsWith("--")&&this._showSuggestionAfterError){let d=[],h=this;do{let y=h.createHelp().visibleOptions(h).filter(k=>k.long).map(k=>k.long);d=d.concat(y),h=h.parent}while(h&&!h._enablePositionalOptions);a=tn(i,d)}let l=`error: unknown option '${i}'${a}`;this.error(l,{code:"commander.unknownOption"})}_excessArguments(i){if(this._allowExcessArguments)return;let a=this.registeredArguments.length,l=a===1?"":"s",h=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${a} argument${l} but got ${i.length}.`;this.error(h,{code:"commander.excessArguments"})}unknownCommand(){let i=this.args[0],a="";if(this._showSuggestionAfterError){let d=[];this.createHelp().visibleCommands(this).forEach(h=>{d.push(h.name()),h.alias()&&d.push(h.alias())}),a=tn(i,d)}let l=`error: unknown command '${i}'${a}`;this.error(l,{code:"commander.unknownCommand"})}version(i,a,l){if(i===void 0)return this._version;this._version=i,a=a||"-V, --version",l=l||"output the version number";let d=this.createOption(a,l);return this._versionOptionName=d.attributeName(),this._registerOption(d),this.on("option:"+d.name(),()=>{this._outputConfiguration.writeOut(`${i}
21
+ `),this._exit(0,"commander.version",i)}),this}description(i,a){return i===void 0&&a===void 0?this._description:(this._description=i,a&&(this._argsDescription=a),this)}summary(i){return i===void 0?this._summary:(this._summary=i,this)}alias(i){if(i===void 0)return this._aliases[0];let a=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(a=this.commands[this.commands.length-1]),i===a._name)throw new Error("Command alias can't be the same as its name");let l=this.parent?._findCommand(i);if(l){let d=[l.name()].concat(l.aliases()).join("|");throw new Error(`cannot add alias '${i}' to command '${this.name()}' as already have command '${d}'`)}return a._aliases.push(i),this}aliases(i){return i===void 0?this._aliases:(i.forEach(a=>this.alias(a)),this)}usage(i){if(i===void 0){if(this._usage)return this._usage;let a=this.registeredArguments.map(l=>Ss(l));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?a:[]).join(" ")}return this._usage=i,this}name(i){return i===void 0?this._name:(this._name=i,this)}nameFromFilename(i){return this._name=le.basename(i,le.extname(i)),this}executableDir(i){return i===void 0?this._executableDir:(this._executableDir=i,this)}helpInformation(i){let a=this.createHelp();return a.helpWidth===void 0&&(a.helpWidth=i&&i.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),a.formatHelp(this,a)}_getHelpContext(i){i=i||{};let a={error:!!i.error},l;return a.error?l=d=>this._outputConfiguration.writeErr(d):l=d=>this._outputConfiguration.writeOut(d),a.write=i.write||l,a.command=this,a}outputHelp(i){let a;typeof i=="function"&&(a=i,i=void 0);let l=this._getHelpContext(i);this._getCommandAndAncestors().reverse().forEach(h=>h.emit("beforeAllHelp",l)),this.emit("beforeHelp",l);let d=this.helpInformation(l);if(a&&(d=a(d),typeof d!="string"&&!Buffer.isBuffer(d)))throw new Error("outputHelp callback must return a string or a Buffer");l.write(d),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",l),this._getCommandAndAncestors().forEach(h=>h.emit("afterAllHelp",l))}helpOption(i,a){return typeof i=="boolean"?(i?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(i=i??"-h, --help",a=a??"display help for command",this._helpOption=this.createOption(i,a),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(i){return this._helpOption=i,this}help(i){this.outputHelp(i);let a=L.exitCode||0;a===0&&i&&typeof i!="function"&&i.error&&(a=1),this._exit(a,"commander.help","(outputHelp)")}addHelpText(i,a){let l=["beforeAll","before","after","afterAll"];if(!l.includes(i))throw new Error(`Unexpected value for position to addHelpText.
22
+ Expecting one of '${l.join("', '")}'`);let d=`${i}Help`;return this.on(d,h=>{let y;typeof a=="function"?y=a({error:h.error,command:h.command}):y=a,y&&h.write(`${y}
23
+ `)}),this}_outputHelpIfRequested(i){let a=this._getHelpOption();a&&i.find(d=>a.is(d))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function nn(g){return g.map(i=>{if(!i.startsWith("--inspect"))return i;let a,l="127.0.0.1",d="9229",h;return(h=i.match(/^(--inspect(-brk)?)$/))!==null?a=h[1]:(h=i.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(a=h[1],/^\d+$/.test(h[3])?d=h[3]:l=h[3]):(h=i.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(a=h[1],l=h[3],d=h[4]),a&&d!=="0"?`${a}=${l}:${parseInt(d)+1}`:i})}on.Command=Rr});var cn=ge(re=>{var{Argument:an}=rr(),{Command:Vr}=sn(),{CommanderError:Ts,InvalidArgumentError:ln}=Te(),{Help:xs}=Pr(),{Option:un}=Dr();re.program=new Vr;re.createCommand=g=>new Vr(g);re.createOption=(g,i)=>new un(g,i);re.createArgument=(g,i)=>new an(g,i);re.Command=Vr;re.Option=un;re.Argument=an;re.Help=xs;re.CommanderError=Ts;re.InvalidArgumentError=ln;re.InvalidOptionArgumentError=ln});var Wr=Er(require("fs")),hn=require("path");function br(g,i){if(!g)throw new Error(i);return g}function It(g){return br(g),g}function Nt(g){throw new Error("Should not be reachable")}var Bt=async(g,i)=>{let a={instantiateWasm:async(l,d)=>{switch(g.type){case"response":{let h=await WebAssembly.instantiateStreaming(g.response,l);d(h.instance,h.module)}break;case"buffer":{let h=await WebAssembly.instantiate(await g.buffer,l);d(h.instance,h.module)}break;default:Nt(g)}}};return It(await(await i)(a))};var ds=new TextEncoder,Cr=g=>ds.encode(g),hs=new TextDecoder,Lt=g=>hs.decode(g);var ms=!1,ps=g=>{if(typeof g=="string")return Cr(g);if(g instanceof Uint8Array)return g;if(g instanceof Object)return Cr(JSON.stringify(g));throw new Error("unsupported type")},qt=g=>{let i=new g.DocumentEngine.create;return{exec:(h,...y)=>(()=>{let{error:b,values:$}=(()=>{let T=new g.MemoryHandleVector;try{for(let I of y){let B=ps(I),W=g.allocateMemory(B.byteLength);try{br(W.size===B.byteLength),W.view.set(B),T.push_back(W)}finally{W.delete()}}try{return i.exec(h,T)}catch(I){throw console.error("exception while calling exec",h,I),I}}finally{T.delete()}})();if(b)throw $.delete(),ms&&console.error("WASM request",h,y,"yielded error",b),b;let S=[];for(let T=0;T<$.size();++T){let I=$.get(T);S.push(I.view.slice()),I.delete()}return $.delete(),S})(),destroy:()=>{i.delete()}}};var Ce=Er(require("fs")),Yt=require("path");var zt=g=>JSON.parse(Lt(g));var Gt=(g,i,a)=>{let{wasmExecutor:l}=g;return zt(l.exec("fonts/index",{id:a},i)[0])},Jt=g=>({v:1,availableFonts:g});var vs=[".ttf",".otf",".ttc",".otc"],Kt=(g,i)=>{let a=[];return Ce.readdirSync(i).forEach(l=>{let d=(0,Yt.resolve)(i,l);if(!Ce.statSync(d).isFile()||vs.every(k=>!l.toLowerCase().endsWith(k)))return;let h=(()=>{try{return new Uint8Array(Ce.readFileSync(d))}catch{throw new Error(`Error processing file '${l}'.`)}})(),y=Gt(g,h,l);a=a.concat(y)}),a};var gs=(()=>{var g=typeof document<"u"?document.currentScript?.src:void 0;return function(i={}){var a,l=i,d,h,y=new Promise((e,r)=>{d=e,h=r}),k=!0,b=!1,$=Object.assign({},l),S=[],T="./this.program",I=(e,r)=>{throw r},B="";function W(e){return l.locateFile?l.locateFile(e,B):B+e}var Q,fe;(k||b)&&(b?B=self.location.href:typeof document<"u"&&document.currentScript&&(B=document.currentScript.src),g&&(B=g),B.startsWith("blob:")?B="":B=B.substr(0,B.replace(/[?#].*/,"").lastIndexOf("/")+1),Q=async e=>{var r=await fetch(e,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)});var tr=l.print||console.log.bind(console),ue=l.printErr||console.error.bind(console);Object.assign(l,$),$=null,l.arguments&&(S=l.arguments),l.thisProgram&&(T=l.thisProgram);var xe=l.wasmBinary,De,Me=!1,je,K,Y,ne,He,A,j,Ir,Nr;function Br(){var e=De.buffer;l.HEAP8=K=new Int8Array(e),l.HEAP16=ne=new Int16Array(e),l.HEAPU8=Y=new Uint8Array(e),l.HEAPU16=He=new Uint16Array(e),l.HEAP32=A=new Int32Array(e),l.HEAPU32=j=new Uint32Array(e),l.HEAPF32=Ir=new Float32Array(e),l.HEAPF64=Nr=new Float64Array(e)}var Lr=[],qr=[],mn=[],zr=[],Gr=!1;function pn(){if(l.preRun)for(typeof l.preRun=="function"&&(l.preRun=[l.preRun]);l.preRun.length;)yn(l.preRun.shift());Ve(Lr)}function vn(){Gr=!0,!l.noFSInit&&!s.initialized&&s.init(),s.ignorePermissions=!1,ce.init(),Ve(qr)}function gn(){Ve(mn)}function _n(){if(l.postRun)for(typeof l.postRun=="function"&&(l.postRun=[l.postRun]);l.postRun.length;)En(l.postRun.shift());Ve(zr)}function yn(e){Lr.unshift(e)}function wn(e){qr.unshift(e)}function En(e){zr.unshift(e)}var de=0,Ae=null;function Hs(e){return e}function Jr(e){de++,l.monitorRunDependencies?.(de)}function nr(e){if(de--,l.monitorRunDependencies?.(de),de==0&&Ae){var r=Ae;Ae=null,r()}}function Re(e){l.onAbort?.(e),e="Aborted("+e+")",ue(e),Me=!0,e+=". Build with -sASSERTIONS for more info.",Gr&&jt();var r=new WebAssembly.RuntimeError(e);throw h(r),r}var bn="data:application/octet-stream;base64,",Yr=e=>e.startsWith(bn);function Cn(){var e="docauth.wasm";return Yr(e)?e:W(e)}var ir;function An(e){if(e==ir&&xe)return new Uint8Array(xe);if(fe)return fe(e);throw"both async and sync fetching of the wasm failed"}async function kn(e){if(!xe)try{var r=await Q(e);return new Uint8Array(r)}catch{}return An(e)}async function $n(e,r){try{var t=await kn(e),n=await WebAssembly.instantiate(t,r);return n}catch(o){ue(`failed to asynchronously prepare wasm: ${o}`),Re(o)}}async function On(e,r,t){if(!e&&typeof WebAssembly.instantiateStreaming=="function"&&!Yr(r)&&typeof fetch=="function")try{var n=fetch(r,{credentials:"same-origin"}),o=await WebAssembly.instantiateStreaming(n,t);return o}catch(u){ue(`wasm streaming compile failed: ${u}`),ue("falling back to ArrayBuffer instantiation")}return $n(r,t)}function Sn(){return{a:Bo}}async function Pn(){function e(o,u){return R=o.exports,De=R.ha,Br(),ht=R.na,wn(R.ia),nr("wasm-instantiate"),R}Jr("wasm-instantiate");function r(o){e(o.instance)}var t=Sn();if(l.instantiateWasm)try{return l.instantiateWasm(t,e)}catch(o){ue(`Module.instantiateWasm callback failed with error: ${o}`),h(o)}ir??=Cn();try{var n=await On(xe,ir,t);return r(n),n}catch(o){h(o);return}}var O,U;class Kr{name="ExitStatus";constructor(r){this.message=`Program terminated with exit(${r})`,this.status=r}}var Ve=e=>{for(;e.length>0;)e.shift()(l)},Xr=l.noExitRuntime||!0,H={isAbs:e=>e.charAt(0)==="/",splitPath:e=>{var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return r.exec(e).slice(1)},normalizeArray:(e,r)=>{for(var t=0,n=e.length-1;n>=0;n--){var o=e[n];o==="."?e.splice(n,1):o===".."?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=H.isAbs(e),t=e.substr(-1)==="/";return e=H.normalizeArray(e.split("/").filter(n=>!!n),!r).join("/"),!e&&!r&&(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=H.splitPath(e),t=r[0],n=r[1];return!t&&!n?".":(n&&(n=n.substr(0,n.length-1)),t+n)},basename:e=>{if(e==="/")return"/";e=H.normalize(e),e=e.replace(/\/$/,"");var r=e.lastIndexOf("/");return r===-1?e:e.substr(r+1)},join:(...e)=>H.normalize(e.join("/")),join2:(e,r)=>H.normalize(e+"/"+r)},Fn=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return e=>crypto.getRandomValues(e);Re("initRandomDevice")},Qr=e=>(Qr=Fn())(e),_e={resolve:(...e)=>{for(var r="",t=!1,n=e.length-1;n>=-1&&!t;n--){var o=n>=0?e[n]:s.cwd();if(typeof o!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!o)return"";r=o+"/"+r,t=H.isAbs(o)}return r=H.normalizeArray(r.split("/").filter(u=>!!u),!t).join("/"),(t?"/":"")+r||"."},relative:(e,r)=>{e=_e.resolve(e).substr(1),r=_e.resolve(r).substr(1);function t(p){for(var v=0;v<p.length&&p[v]==="";v++);for(var _=p.length-1;_>=0&&p[_]==="";_--);return v>_?[]:p.slice(v,_-v+1)}for(var n=t(e.split("/")),o=t(r.split("/")),u=Math.min(n.length,o.length),c=u,f=0;f<u;f++)if(n[f]!==o[f]){c=f;break}for(var m=[],f=c;f<n.length;f++)m.push("..");return m=m.concat(o.slice(c)),m.join("/")}},Zr=typeof TextDecoder<"u"?new TextDecoder:void 0,ye=(e,r=0,t=NaN)=>{for(var n=r+t,o=r;e[o]&&!(o>=n);)++o;if(o-r>16&&e.buffer&&Zr)return Zr.decode(e.subarray(r,o));for(var u="";r<o;){var c=e[r++];if(!(c&128)){u+=String.fromCharCode(c);continue}var f=e[r++]&63;if((c&224)==192){u+=String.fromCharCode((c&31)<<6|f);continue}var m=e[r++]&63;if((c&240)==224?c=(c&15)<<12|f<<6|m:c=(c&7)<<18|f<<12|m<<6|e[r++]&63,c<65536)u+=String.fromCharCode(c);else{var p=c-65536;u+=String.fromCharCode(55296|p>>10,56320|p&1023)}}return u},or=[],We=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n<=127?r++:n<=2047?r+=2:n>=55296&&n<=57343?(r+=4,++t):r+=3}return r},sr=(e,r,t,n)=>{if(!(n>0))return 0;for(var o=t,u=t+n-1,c=0;c<e.length;++c){var f=e.charCodeAt(c);if(f>=55296&&f<=57343){var m=e.charCodeAt(++c);f=65536+((f&1023)<<10)|m&1023}if(f<=127){if(t>=u)break;r[t++]=f}else if(f<=2047){if(t+1>=u)break;r[t++]=192|f>>6,r[t++]=128|f&63}else if(f<=65535){if(t+2>=u)break;r[t++]=224|f>>12,r[t++]=128|f>>6&63,r[t++]=128|f&63}else{if(t+3>=u)break;r[t++]=240|f>>18,r[t++]=128|f>>12&63,r[t++]=128|f>>6&63,r[t++]=128|f&63}}return r[t]=0,t-o};function et(e,r,t){var n=t>0?t:We(e)+1,o=new Array(n),u=sr(e,o,0,o.length);return r&&(o.length=u),o}var Tn=()=>{if(!or.length){var e=null;if(typeof window<"u"&&typeof window.prompt=="function"&&(e=window.prompt("Input: "),e!==null&&(e+=`
24
+ `)),!e)return null;or=et(e,!0)}return or.shift()},ce={ttys:[],init(){},shutdown(){},register(e,r){ce.ttys[e]={input:[],output:[],ops:r},s.registerDevice(e,ce.stream_ops)},stream_ops:{open(e){var r=ce.ttys[e.node.rdev];if(!r)throw new s.ErrnoError(43);e.tty=r,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,r,t,n,o){if(!e.tty||!e.tty.ops.get_char)throw new s.ErrnoError(60);for(var u=0,c=0;c<n;c++){var f;try{f=e.tty.ops.get_char(e.tty)}catch{throw new s.ErrnoError(29)}if(f===void 0&&u===0)throw new s.ErrnoError(6);if(f==null)break;u++,r[t+c]=f}return u&&(e.node.atime=Date.now()),u},write(e,r,t,n,o){if(!e.tty||!e.tty.ops.put_char)throw new s.ErrnoError(60);try{for(var u=0;u<n;u++)e.tty.ops.put_char(e.tty,r[t+u])}catch{throw new s.ErrnoError(29)}return n&&(e.node.mtime=e.node.ctime=Date.now()),u}},default_tty_ops:{get_char(e){return Tn()},put_char(e,r){r===null||r===10?(tr(ye(e.output)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(tr(ye(e.output)),e.output=[])},ioctl_tcgets(e){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(e,r,t){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,r){r===null||r===10?(ue(ye(e.output)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(ue(ye(e.output)),e.output=[])}}},xn=(e,r)=>{Y.fill(0,e,e+r)},rt=(e,r)=>Math.ceil(e/r)*r,tt=e=>{e=rt(e,65536);var r=Dt(65536,e);return r&&xn(r,e),r},P={ops_table:null,mount(e){return P.createNode(null,"/",16895,0)},createNode(e,r,t,n){if(s.isBlkdev(t)||s.isFIFO(t))throw new s.ErrnoError(63);P.ops_table||={dir:{node:{getattr:P.node_ops.getattr,setattr:P.node_ops.setattr,lookup:P.node_ops.lookup,mknod:P.node_ops.mknod,rename:P.node_ops.rename,unlink:P.node_ops.unlink,rmdir:P.node_ops.rmdir,readdir:P.node_ops.readdir,symlink:P.node_ops.symlink},stream:{llseek:P.stream_ops.llseek}},file:{node:{getattr:P.node_ops.getattr,setattr:P.node_ops.setattr},stream:{llseek:P.stream_ops.llseek,read:P.stream_ops.read,write:P.stream_ops.write,allocate:P.stream_ops.allocate,mmap:P.stream_ops.mmap,msync:P.stream_ops.msync}},link:{node:{getattr:P.node_ops.getattr,setattr:P.node_ops.setattr,readlink:P.node_ops.readlink},stream:{}},chrdev:{node:{getattr:P.node_ops.getattr,setattr:P.node_ops.setattr},stream:s.chrdev_stream_ops}};var o=s.createNode(e,r,t,n);return s.isDir(o.mode)?(o.node_ops=P.ops_table.dir.node,o.stream_ops=P.ops_table.dir.stream,o.contents={}):s.isFile(o.mode)?(o.node_ops=P.ops_table.file.node,o.stream_ops=P.ops_table.file.stream,o.usedBytes=0,o.contents=null):s.isLink(o.mode)?(o.node_ops=P.ops_table.link.node,o.stream_ops=P.ops_table.link.stream):s.isChrdev(o.mode)&&(o.node_ops=P.ops_table.chrdev.node,o.stream_ops=P.ops_table.chrdev.stream),o.atime=o.mtime=o.ctime=Date.now(),e&&(e.contents[r]=o,e.atime=e.mtime=e.ctime=o.atime),o},getFileDataAsTypedArray(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage(e,r){var t=e.contents?e.contents.length:0;if(!(t>=r)){var n=1024*1024;r=Math.max(r,t*(t<n?2:1.125)>>>0),t!=0&&(r=Math.max(r,256));var o=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(o.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,r){if(e.usedBytes!=r)if(r==0)e.contents=null,e.usedBytes=0;else{var t=e.contents;e.contents=new Uint8Array(r),t&&e.contents.set(t.subarray(0,Math.min(r,e.usedBytes))),e.usedBytes=r}},node_ops:{getattr(e){var r={};return r.dev=s.isChrdev(e.mode)?e.id:1,r.ino=e.id,r.mode=e.mode,r.nlink=1,r.uid=0,r.gid=0,r.rdev=e.rdev,s.isDir(e.mode)?r.size=4096:s.isFile(e.mode)?r.size=e.usedBytes:s.isLink(e.mode)?r.size=e.link.length:r.size=0,r.atime=new Date(e.atime),r.mtime=new Date(e.mtime),r.ctime=new Date(e.ctime),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr(e,r){for(let t of["mode","atime","mtime","ctime"])r[t]&&(e[t]=r[t]);r.size!==void 0&&P.resizeFileStorage(e,r.size)},lookup(e,r){throw P.doesNotExistError},mknod(e,r,t,n){return P.createNode(e,r,t,n)},rename(e,r,t){var n;try{n=s.lookupNode(r,t)}catch{}if(n){if(s.isDir(e.mode))for(var o in n.contents)throw new s.ErrnoError(55);s.hashRemoveNode(n)}delete e.parent.contents[e.name],r.contents[t]=e,e.name=t,r.ctime=r.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,r){delete e.contents[r],e.ctime=e.mtime=Date.now()},rmdir(e,r){var t=s.lookupNode(e,r);for(var n in t.contents)throw new s.ErrnoError(55);delete e.contents[r],e.ctime=e.mtime=Date.now()},readdir(e){return[".","..",...Object.keys(e.contents)]},symlink(e,r,t){var n=P.createNode(e,r,41471,0);return n.link=t,n},readlink(e){if(!s.isLink(e.mode))throw new s.ErrnoError(28);return e.link}},stream_ops:{read(e,r,t,n,o){var u=e.node.contents;if(o>=e.node.usedBytes)return 0;var c=Math.min(e.node.usedBytes-o,n);if(c>8&&u.subarray)r.set(u.subarray(o,o+c),t);else for(var f=0;f<c;f++)r[t+f]=u[o+f];return c},write(e,r,t,n,o,u){if(r.buffer===K.buffer&&(u=!1),!n)return 0;var c=e.node;if(c.mtime=c.ctime=Date.now(),r.subarray&&(!c.contents||c.contents.subarray)){if(u)return c.contents=r.subarray(t,t+n),c.usedBytes=n,n;if(c.usedBytes===0&&o===0)return c.contents=r.slice(t,t+n),c.usedBytes=n,n;if(o+n<=c.usedBytes)return c.contents.set(r.subarray(t,t+n),o),n}if(P.expandFileStorage(c,o+n),c.contents.subarray&&r.subarray)c.contents.set(r.subarray(t,t+n),o);else for(var f=0;f<n;f++)c.contents[o+f]=r[t+f];return c.usedBytes=Math.max(c.usedBytes,o+n),n},llseek(e,r,t){var n=r;if(t===1?n+=e.position:t===2&&s.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new s.ErrnoError(28);return n},allocate(e,r,t){P.expandFileStorage(e.node,r+t),e.node.usedBytes=Math.max(e.node.usedBytes,r+t)},mmap(e,r,t,n,o){if(!s.isFile(e.node.mode))throw new s.ErrnoError(43);var u,c,f=e.node.contents;if(!(o&2)&&f&&f.buffer===K.buffer)c=!1,u=f.byteOffset;else{if(c=!0,u=tt(r),!u)throw new s.ErrnoError(48);f&&((t>0||t+r<f.length)&&(f.subarray?f=f.subarray(t,t+r):f=Array.prototype.slice.call(f,t,t+r)),K.set(f,u))}return{ptr:u,allocated:c}},msync(e,r,t,n,o){return P.stream_ops.write(e,r,0,n,t,!1),0}}},Dn=async e=>{var r=await Q(e);return new Uint8Array(r)},Mn=(e,r,t,n,o,u)=>{s.createDataFile(e,r,t,n,o,u)},jn=l.preloadPlugins||[],Hn=(e,r,t,n)=>{typeof Browser<"u"&&Browser.init();var o=!1;return jn.forEach(u=>{o||u.canHandle(r)&&(u.handle(e,r,t,n),o=!0)}),o},Rn=(e,r,t,n,o,u,c,f,m,p)=>{var v=r?_e.resolve(H.join2(e,r)):e,_=`cp ${v}`;function w(E){function C(F){p?.(),f||Mn(e,r,F,n,o,m),u?.(),nr(_)}Hn(E,v,C,()=>{c?.(),nr(_)})||C(E)}Jr(_),typeof t=="string"?Dn(t).then(w,c):w(t)},Vn=e=>{var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},t=r[e];if(typeof t>"u")throw new Error(`Unknown file open mode: ${e}`);return t},ar=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},s={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{name="ErrnoError";constructor(e){this.errno=e}},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{shared={};get object(){return this.node}set object(e){this.node=e}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{node_ops={};stream_ops={};readMode=365;writeMode=146;mounted=null;constructor(e,r,t,n){e||(e=this),this.parent=e,this.mount=e.mount,this.id=s.nextInode++,this.name=r,this.mode=t,this.rdev=n,this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return s.isDir(this.mode)}get isDevice(){return s.isChrdev(this.mode)}},lookupPath(e,r={}){if(!e)return{path:"",node:null};r.follow_mount??=!0,H.isAbs(e)||(e=s.cwd()+"/"+e);e:for(var t=0;t<40;t++){for(var n=e.split("/").filter(p=>!!p&&p!=="."),o=s.root,u="/",c=0;c<n.length;c++){var f=c===n.length-1;if(f&&r.parent)break;if(n[c]===".."){u=H.dirname(u),o=o.parent;continue}u=H.join2(u,n[c]);try{o=s.lookupNode(o,n[c])}catch(p){if(p?.errno===44&&f&&r.noent_okay)return{path:u};throw p}if(s.isMountpoint(o)&&(!f||r.follow_mount)&&(o=o.mounted.root),s.isLink(o.mode)&&(!f||r.follow)){if(!o.node_ops.readlink)throw new s.ErrnoError(52);var m=o.node_ops.readlink(o);H.isAbs(m)||(m=H.dirname(u)+"/"+m),e=m+"/"+n.slice(c+1).join("/");continue e}}return{path:u,node:o}}throw new s.ErrnoError(32)},getPath(e){for(var r;;){if(s.isRoot(e)){var t=e.mount.mountpoint;return r?t[t.length-1]!=="/"?`${t}/${r}`:t+r:t}r=r?`${e.name}/${r}`:e.name,e=e.parent}},hashName(e,r){for(var t=0,n=0;n<r.length;n++)t=(t<<5)-t+r.charCodeAt(n)|0;return(e+t>>>0)%s.nameTable.length},hashAddNode(e){var r=s.hashName(e.parent.id,e.name);e.name_next=s.nameTable[r],s.nameTable[r]=e},hashRemoveNode(e){var r=s.hashName(e.parent.id,e.name);if(s.nameTable[r]===e)s.nameTable[r]=e.name_next;else for(var t=s.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode(e,r){var t=s.mayLookup(e);if(t)throw new s.ErrnoError(t);for(var n=s.hashName(e.id,r),o=s.nameTable[n];o;o=o.name_next){var u=o.name;if(o.parent.id===e.id&&u===r)return o}return s.lookup(e,r)},createNode(e,r,t,n){var o=new s.FSNode(e,r,t,n);return s.hashAddNode(o),o},destroyNode(e){s.hashRemoveNode(e)},isRoot(e){return e===e.parent},isMountpoint(e){return!!e.mounted},isFile(e){return(e&61440)===32768},isDir(e){return(e&61440)===16384},isLink(e){return(e&61440)===40960},isChrdev(e){return(e&61440)===8192},isBlkdev(e){return(e&61440)===24576},isFIFO(e){return(e&61440)===4096},isSocket(e){return(e&49152)===49152},flagsToPermissionString(e){var r=["r","w","rw"][e&3];return e&512&&(r+="w"),r},nodePermissions(e,r){return s.ignorePermissions?0:r.includes("r")&&!(e.mode&292)||r.includes("w")&&!(e.mode&146)||r.includes("x")&&!(e.mode&73)?2:0},mayLookup(e){if(!s.isDir(e.mode))return 54;var r=s.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate(e,r){if(!s.isDir(e.mode))return 54;try{var t=s.lookupNode(e,r);return 20}catch{}return s.nodePermissions(e,"wx")},mayDelete(e,r,t){var n;try{n=s.lookupNode(e,r)}catch(u){return u.errno}var o=s.nodePermissions(e,"wx");if(o)return o;if(t){if(!s.isDir(n.mode))return 54;if(s.isRoot(n)||s.getPath(n)===s.cwd())return 10}else if(s.isDir(n.mode))return 31;return 0},mayOpen(e,r){return e?s.isLink(e.mode)?32:s.isDir(e.mode)&&(s.flagsToPermissionString(r)!=="r"||r&512)?31:s.nodePermissions(e,s.flagsToPermissionString(r)):44},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=s.MAX_OPEN_FDS;e++)if(!s.streams[e])return e;throw new s.ErrnoError(33)},getStreamChecked(e){var r=s.getStream(e);if(!r)throw new s.ErrnoError(8);return r},getStream:e=>s.streams[e],createStream(e,r=-1){return e=Object.assign(new s.FSStream,e),r==-1&&(r=s.nextfd()),e.fd=r,s.streams[r]=e,e},closeStream(e){s.streams[e]=null},dupStream(e,r=-1){var t=s.createStream(e,r);return t.stream_ops?.dup?.(t),t},chrdev_stream_ops:{open(e){var r=s.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new s.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,r)=>e<<8|r,registerDevice(e,r){s.devices[e]={stream_ops:r}},getDevice:e=>s.devices[e],getMounts(e){for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push(...n.mounts)}return r},syncfs(e,r){typeof e=="function"&&(r=e,e=!1),s.syncFSRequests++,s.syncFSRequests>1&&ue(`warning: ${s.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=s.getMounts(s.root.mount),n=0;function o(c){return s.syncFSRequests--,r(c)}function u(c){if(c)return u.errored?void 0:(u.errored=!0,o(c));++n>=t.length&&o(null)}t.forEach(c=>{if(!c.type.syncfs)return u(null);c.type.syncfs(c,e,u)})},mount(e,r,t){var n=t==="/",o=!t,u;if(n&&s.root)throw new s.ErrnoError(10);if(!n&&!o){var c=s.lookupPath(t,{follow_mount:!1});if(t=c.path,u=c.node,s.isMountpoint(u))throw new s.ErrnoError(10);if(!s.isDir(u.mode))throw new s.ErrnoError(54)}var f={type:e,opts:r,mountpoint:t,mounts:[]},m=e.mount(f);return m.mount=f,f.root=m,n?s.root=m:u&&(u.mounted=f,u.mount&&u.mount.mounts.push(f)),m},unmount(e){var r=s.lookupPath(e,{follow_mount:!1});if(!s.isMountpoint(r.node))throw new s.ErrnoError(28);var t=r.node,n=t.mounted,o=s.getMounts(n);Object.keys(s.nameTable).forEach(c=>{for(var f=s.nameTable[c];f;){var m=f.name_next;o.includes(f.mount)&&s.destroyNode(f),f=m}}),t.mounted=null;var u=t.mount.mounts.indexOf(n);t.mount.mounts.splice(u,1)},lookup(e,r){return e.node_ops.lookup(e,r)},mknod(e,r,t){var n=s.lookupPath(e,{parent:!0}),o=n.node,u=H.basename(e);if(!u||u==="."||u==="..")throw new s.ErrnoError(28);var c=s.mayCreate(o,u);if(c)throw new s.ErrnoError(c);if(!o.node_ops.mknod)throw new s.ErrnoError(63);return o.node_ops.mknod(o,u,r,t)},statfs(e){var r={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:s.nextInode,ffree:s.nextInode-1,fsid:42,flags:2,namelen:255},t=s.lookupPath(e,{follow:!0}).node;return t?.node_ops.statfs&&Object.assign(r,t.node_ops.statfs(t.mount.opts.root)),r},create(e,r=438){return r&=4095,r|=32768,s.mknod(e,r,0)},mkdir(e,r=511){return r&=1023,r|=16384,s.mknod(e,r,0)},mkdirTree(e,r){for(var t=e.split("/"),n="",o=0;o<t.length;++o)if(t[o]){n+="/"+t[o];try{s.mkdir(n,r)}catch(u){if(u.errno!=20)throw u}}},mkdev(e,r,t){return typeof t>"u"&&(t=r,r=438),r|=8192,s.mknod(e,r,t)},symlink(e,r){if(!_e.resolve(e))throw new s.ErrnoError(44);var t=s.lookupPath(r,{parent:!0}),n=t.node;if(!n)throw new s.ErrnoError(44);var o=H.basename(r),u=s.mayCreate(n,o);if(u)throw new s.ErrnoError(u);if(!n.node_ops.symlink)throw new s.ErrnoError(63);return n.node_ops.symlink(n,o,e)},rename(e,r){var t=H.dirname(e),n=H.dirname(r),o=H.basename(e),u=H.basename(r),c,f,m;if(c=s.lookupPath(e,{parent:!0}),f=c.node,c=s.lookupPath(r,{parent:!0}),m=c.node,!f||!m)throw new s.ErrnoError(44);if(f.mount!==m.mount)throw new s.ErrnoError(75);var p=s.lookupNode(f,o),v=_e.relative(e,n);if(v.charAt(0)!==".")throw new s.ErrnoError(28);if(v=_e.relative(r,t),v.charAt(0)!==".")throw new s.ErrnoError(55);var _;try{_=s.lookupNode(m,u)}catch{}if(p!==_){var w=s.isDir(p.mode),E=s.mayDelete(f,o,w);if(E)throw new s.ErrnoError(E);if(E=_?s.mayDelete(m,u,w):s.mayCreate(m,u),E)throw new s.ErrnoError(E);if(!f.node_ops.rename)throw new s.ErrnoError(63);if(s.isMountpoint(p)||_&&s.isMountpoint(_))throw new s.ErrnoError(10);if(m!==f&&(E=s.nodePermissions(f,"w"),E))throw new s.ErrnoError(E);s.hashRemoveNode(p);try{f.node_ops.rename(p,m,u),p.parent=m}catch(C){throw C}finally{s.hashAddNode(p)}}},rmdir(e){var r=s.lookupPath(e,{parent:!0}),t=r.node,n=H.basename(e),o=s.lookupNode(t,n),u=s.mayDelete(t,n,!0);if(u)throw new s.ErrnoError(u);if(!t.node_ops.rmdir)throw new s.ErrnoError(63);if(s.isMountpoint(o))throw new s.ErrnoError(10);t.node_ops.rmdir(t,n),s.destroyNode(o)},readdir(e){var r=s.lookupPath(e,{follow:!0}),t=r.node;if(!t.node_ops.readdir)throw new s.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var r=s.lookupPath(e,{parent:!0}),t=r.node;if(!t)throw new s.ErrnoError(44);var n=H.basename(e),o=s.lookupNode(t,n),u=s.mayDelete(t,n,!1);if(u)throw new s.ErrnoError(u);if(!t.node_ops.unlink)throw new s.ErrnoError(63);if(s.isMountpoint(o))throw new s.ErrnoError(10);t.node_ops.unlink(t,n),s.destroyNode(o)},readlink(e){var r=s.lookupPath(e),t=r.node;if(!t)throw new s.ErrnoError(44);if(!t.node_ops.readlink)throw new s.ErrnoError(28);return t.node_ops.readlink(t)},stat(e,r){var t=s.lookupPath(e,{follow:!r}),n=t.node;if(!n)throw new s.ErrnoError(44);if(!n.node_ops.getattr)throw new s.ErrnoError(63);return n.node_ops.getattr(n)},lstat(e){return s.stat(e,!0)},chmod(e,r,t){var n;if(typeof e=="string"){var o=s.lookupPath(e,{follow:!t});n=o.node}else n=e;if(!n.node_ops.setattr)throw new s.ErrnoError(63);n.node_ops.setattr(n,{mode:r&4095|n.mode&-4096,ctime:Date.now()})},lchmod(e,r){s.chmod(e,r,!0)},fchmod(e,r){var t=s.getStreamChecked(e);s.chmod(t.node,r)},chown(e,r,t,n){var o;if(typeof e=="string"){var u=s.lookupPath(e,{follow:!n});o=u.node}else o=e;if(!o.node_ops.setattr)throw new s.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(e,r,t){s.chown(e,r,t,!0)},fchown(e,r,t){var n=s.getStreamChecked(e);s.chown(n.node,r,t)},truncate(e,r){if(r<0)throw new s.ErrnoError(28);var t;if(typeof e=="string"){var n=s.lookupPath(e,{follow:!0});t=n.node}else t=e;if(!t.node_ops.setattr)throw new s.ErrnoError(63);if(s.isDir(t.mode))throw new s.ErrnoError(31);if(!s.isFile(t.mode))throw new s.ErrnoError(28);var o=s.nodePermissions(t,"w");if(o)throw new s.ErrnoError(o);t.node_ops.setattr(t,{size:r,timestamp:Date.now()})},ftruncate(e,r){var t=s.getStreamChecked(e);if(!(t.flags&2097155))throw new s.ErrnoError(28);s.truncate(t.node,r)},utime(e,r,t){var n=s.lookupPath(e,{follow:!0}),o=n.node;o.node_ops.setattr(o,{atime:r,mtime:t})},open(e,r,t=438){if(e==="")throw new s.ErrnoError(44);r=typeof r=="string"?Vn(r):r,r&64?t=t&4095|32768:t=0;var n;if(typeof e=="object")n=e;else{var o=s.lookupPath(e,{follow:!(r&131072),noent_okay:!0});n=o.node,e=o.path}var u=!1;if(r&64)if(n){if(r&128)throw new s.ErrnoError(20)}else n=s.mknod(e,t,0),u=!0;if(!n)throw new s.ErrnoError(44);if(s.isChrdev(n.mode)&&(r&=-513),r&65536&&!s.isDir(n.mode))throw new s.ErrnoError(54);if(!u){var c=s.mayOpen(n,r);if(c)throw new s.ErrnoError(c)}r&512&&!u&&s.truncate(n,0),r&=-131713;var f=s.createStream({node:n,path:s.getPath(n),flags:r,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return f.stream_ops.open&&f.stream_ops.open(f),l.logReadFiles&&!(r&1)&&(e in s.readFiles||(s.readFiles[e]=1)),f},close(e){if(s.isClosed(e))throw new s.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(r){throw r}finally{s.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,r,t){if(s.isClosed(e))throw new s.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new s.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new s.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read(e,r,t,n,o){if(n<0||o<0)throw new s.ErrnoError(28);if(s.isClosed(e))throw new s.ErrnoError(8);if((e.flags&2097155)===1)throw new s.ErrnoError(8);if(s.isDir(e.node.mode))throw new s.ErrnoError(31);if(!e.stream_ops.read)throw new s.ErrnoError(28);var u=typeof o<"u";if(!u)o=e.position;else if(!e.seekable)throw new s.ErrnoError(70);var c=e.stream_ops.read(e,r,t,n,o);return u||(e.position+=c),c},write(e,r,t,n,o,u){if(n<0||o<0)throw new s.ErrnoError(28);if(s.isClosed(e))throw new s.ErrnoError(8);if(!(e.flags&2097155))throw new s.ErrnoError(8);if(s.isDir(e.node.mode))throw new s.ErrnoError(31);if(!e.stream_ops.write)throw new s.ErrnoError(28);e.seekable&&e.flags&1024&&s.llseek(e,0,2);var c=typeof o<"u";if(!c)o=e.position;else if(!e.seekable)throw new s.ErrnoError(70);var f=e.stream_ops.write(e,r,t,n,o,u);return c||(e.position+=f),f},allocate(e,r,t){if(s.isClosed(e))throw new s.ErrnoError(8);if(r<0||t<=0)throw new s.ErrnoError(28);if(!(e.flags&2097155))throw new s.ErrnoError(8);if(!s.isFile(e.node.mode)&&!s.isDir(e.node.mode))throw new s.ErrnoError(43);if(!e.stream_ops.allocate)throw new s.ErrnoError(138);e.stream_ops.allocate(e,r,t)},mmap(e,r,t,n,o){if(n&2&&!(o&2)&&(e.flags&2097155)!==2)throw new s.ErrnoError(2);if((e.flags&2097155)===1)throw new s.ErrnoError(2);if(!e.stream_ops.mmap)throw new s.ErrnoError(43);if(!r)throw new s.ErrnoError(28);return e.stream_ops.mmap(e,r,t,n,o)},msync(e,r,t,n,o){return e.stream_ops.msync?e.stream_ops.msync(e,r,t,n,o):0},ioctl(e,r,t){if(!e.stream_ops.ioctl)throw new s.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile(e,r={}){if(r.flags=r.flags||0,r.encoding=r.encoding||"binary",r.encoding!=="utf8"&&r.encoding!=="binary")throw new Error(`Invalid encoding type "${r.encoding}"`);var t,n=s.open(e,r.flags),o=s.stat(e),u=o.size,c=new Uint8Array(u);return s.read(n,c,0,u,0),r.encoding==="utf8"?t=ye(c):r.encoding==="binary"&&(t=c),s.close(n),t},writeFile(e,r,t={}){t.flags=t.flags||577;var n=s.open(e,t.flags,t.mode);if(typeof r=="string"){var o=new Uint8Array(We(r)+1),u=sr(r,o,0,o.length);s.write(n,o,0,u,void 0,t.canOwn)}else if(ArrayBuffer.isView(r))s.write(n,r,0,r.byteLength,void 0,t.canOwn);else throw new Error("Unsupported data type");s.close(n)},cwd:()=>s.currentPath,chdir(e){var r=s.lookupPath(e,{follow:!0});if(r.node===null)throw new s.ErrnoError(44);if(!s.isDir(r.node.mode))throw new s.ErrnoError(54);var t=s.nodePermissions(r.node,"x");if(t)throw new s.ErrnoError(t);s.currentPath=r.path},createDefaultDirectories(){s.mkdir("/tmp"),s.mkdir("/home"),s.mkdir("/home/web_user")},createDefaultDevices(){s.mkdir("/dev"),s.registerDevice(s.makedev(1,3),{read:()=>0,write:(n,o,u,c,f)=>c,llseek:()=>0}),s.mkdev("/dev/null",s.makedev(1,3)),ce.register(s.makedev(5,0),ce.default_tty_ops),ce.register(s.makedev(6,0),ce.default_tty1_ops),s.mkdev("/dev/tty",s.makedev(5,0)),s.mkdev("/dev/tty1",s.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(r===0&&(r=Qr(e).byteLength),e[--r]);s.createDevice("/dev","random",t),s.createDevice("/dev","urandom",t),s.mkdir("/dev/shm"),s.mkdir("/dev/shm/tmp")},createSpecialDirectories(){s.mkdir("/proc");var e=s.mkdir("/proc/self");s.mkdir("/proc/self/fd"),s.mount({mount(){var r=s.createNode(e,"fd",16895,73);return r.stream_ops={llseek:P.stream_ops.llseek},r.node_ops={lookup(t,n){var o=+n,u=s.getStreamChecked(o),c={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>u.path},id:o+1};return c.parent=c,c},readdir(){return Array.from(s.streams.entries()).filter(([t,n])=>n).map(([t,n])=>t.toString())}},r}},{},"/proc/self/fd")},createStandardStreams(e,r,t){e?s.createDevice("/dev","stdin",e):s.symlink("/dev/tty","/dev/stdin"),r?s.createDevice("/dev","stdout",null,r):s.symlink("/dev/tty","/dev/stdout"),t?s.createDevice("/dev","stderr",null,t):s.symlink("/dev/tty1","/dev/stderr");var n=s.open("/dev/stdin",0),o=s.open("/dev/stdout",1),u=s.open("/dev/stderr",1)},staticInit(){s.nameTable=new Array(4096),s.mount(P,{},"/"),s.createDefaultDirectories(),s.createDefaultDevices(),s.createSpecialDirectories(),s.filesystems={MEMFS:P}},init(e,r,t){s.initialized=!0,e??=l.stdin,r??=l.stdout,t??=l.stderr,s.createStandardStreams(e,r,t)},quit(){s.initialized=!1;for(var e=0;e<s.streams.length;e++){var r=s.streams[e];r&&s.close(r)}},findObject(e,r){var t=s.analyzePath(e,r);return t.exists?t.object:null},analyzePath(e,r){try{var t=s.lookupPath(e,{follow:!r});e=t.path}catch{}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=s.lookupPath(e,{parent:!0});n.parentExists=!0,n.parentPath=t.path,n.parentObject=t.node,n.name=H.basename(e),t=s.lookupPath(e,{follow:!r}),n.exists=!0,n.path=t.path,n.object=t.node,n.name=t.node.name,n.isRoot=t.path==="/"}catch(o){n.error=o.errno}return n},createPath(e,r,t,n){e=typeof e=="string"?e:s.getPath(e);for(var o=r.split("/").reverse();o.length;){var u=o.pop();if(u){var c=H.join2(e,u);try{s.mkdir(c)}catch{}e=c}}return c},createFile(e,r,t,n,o){var u=H.join2(typeof e=="string"?e:s.getPath(e),r),c=ar(n,o);return s.create(u,c)},createDataFile(e,r,t,n,o,u){var c=r;e&&(e=typeof e=="string"?e:s.getPath(e),c=r?H.join2(e,r):e);var f=ar(n,o),m=s.create(c,f);if(t){if(typeof t=="string"){for(var p=new Array(t.length),v=0,_=t.length;v<_;++v)p[v]=t.charCodeAt(v);t=p}s.chmod(m,f|146);var w=s.open(m,577);s.write(w,t,0,t.length,0,u),s.close(w),s.chmod(m,f)}},createDevice(e,r,t,n){var o=H.join2(typeof e=="string"?e:s.getPath(e),r),u=ar(!!t,!!n);s.createDevice.major??=64;var c=s.makedev(s.createDevice.major++,0);return s.registerDevice(c,{open(f){f.seekable=!1},close(f){n?.buffer?.length&&n(10)},read(f,m,p,v,_){for(var w=0,E=0;E<v;E++){var C;try{C=t()}catch{throw new s.ErrnoError(29)}if(C===void 0&&w===0)throw new s.ErrnoError(6);if(C==null)break;w++,m[p+E]=C}return w&&(f.node.atime=Date.now()),w},write(f,m,p,v,_){for(var w=0;w<v;w++)try{n(m[p+w])}catch{throw new s.ErrnoError(29)}return v&&(f.node.mtime=f.node.ctime=Date.now()),w}}),s.mkdev(o,u,c)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(typeof XMLHttpRequest<"u")throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");try{e.contents=fe(e.url),e.usedBytes=e.contents.length}catch{throw new s.ErrnoError(29)}},createLazyFile(e,r,t,n,o){class u{lengthKnown=!1;chunks=[];get(E){if(!(E>this.length-1||E<0)){var C=E%this.chunkSize,F=E/this.chunkSize|0;return this.getter(F)[C]}}setDataGetter(E){this.getter=E}cacheLength(){var E=new XMLHttpRequest;if(E.open("HEAD",t,!1),E.send(null),!(E.status>=200&&E.status<300||E.status===304))throw new Error("Couldn't load "+t+". Status: "+E.status);var C=Number(E.getResponseHeader("Content-length")),F,N=(F=E.getResponseHeader("Accept-Ranges"))&&F==="bytes",M=(F=E.getResponseHeader("Content-Encoding"))&&F==="gzip",z=1024*1024;N||(z=C);var V=(X,ae)=>{if(X>ae)throw new Error("invalid range ("+X+", "+ae+") or no bytes requested!");if(ae>C-1)throw new Error("only "+C+" bytes available! programmer error!");var q=new XMLHttpRequest;if(q.open("GET",t,!1),C!==z&&q.setRequestHeader("Range","bytes="+X+"-"+ae),q.responseType="arraybuffer",q.overrideMimeType&&q.overrideMimeType("text/plain; charset=x-user-defined"),q.send(null),!(q.status>=200&&q.status<300||q.status===304))throw new Error("Couldn't load "+t+". Status: "+q.status);return q.response!==void 0?new Uint8Array(q.response||[]):et(q.responseText||"",!0)},ve=this;ve.setDataGetter(X=>{var ae=X*z,q=(X+1)*z-1;if(q=Math.min(q,C-1),typeof ve.chunks[X]>"u"&&(ve.chunks[X]=V(ae,q)),typeof ve.chunks[X]>"u")throw new Error("doXHR failed!");return ve.chunks[X]}),(M||!C)&&(z=C=1,C=this.getter(0).length,z=C,tr("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=C,this._chunkSize=z,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest<"u"){if(!b)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var c=new u,f={isDevice:!1,contents:c}}else var f={isDevice:!1,url:t};var m=s.createFile(e,r,f,n,o);f.contents?m.contents=f.contents:f.url&&(m.contents=null,m.url=f.url),Object.defineProperties(m,{usedBytes:{get:function(){return this.contents.length}}});var p={},v=Object.keys(m.stream_ops);v.forEach(w=>{var E=m.stream_ops[w];p[w]=(...C)=>(s.forceLoadFile(m),E(...C))});function _(w,E,C,F,N){var M=w.node.contents;if(N>=M.length)return 0;var z=Math.min(M.length-N,F);if(M.slice)for(var V=0;V<z;V++)E[C+V]=M[N+V];else for(var V=0;V<z;V++)E[C+V]=M.get(N+V);return z}return p.read=(w,E,C,F,N)=>(s.forceLoadFile(m),_(w,E,C,F,N)),p.mmap=(w,E,C,F,N)=>{s.forceLoadFile(m);var M=tt(E);if(!M)throw new s.ErrnoError(48);return _(w,K,M,E,C),{ptr:M,allocated:!0}},m.stream_ops=p,m}},nt=(e,r)=>e?ye(Y,e,r):"",x={DEFAULT_POLLMASK:5,calculateAt(e,r,t){if(H.isAbs(r))return r;var n;if(e===-100)n=s.cwd();else{var o=x.getStreamFromFD(e);n=o.path}if(r.length==0){if(!t)throw new s.ErrnoError(44);return n}return n+"/"+r},doStat(e,r,t){var n=e(r);A[t>>2]=n.dev,A[t+4>>2]=n.mode,j[t+8>>2]=n.nlink,A[t+12>>2]=n.uid,A[t+16>>2]=n.gid,A[t+20>>2]=n.rdev,U=[n.size>>>0,(O=n.size,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[t+24>>2]=U[0],A[t+28>>2]=U[1],A[t+32>>2]=4096,A[t+36>>2]=n.blocks;var o=n.atime.getTime(),u=n.mtime.getTime(),c=n.ctime.getTime();return U=[Math.floor(o/1e3)>>>0,(O=Math.floor(o/1e3),+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[t+40>>2]=U[0],A[t+44>>2]=U[1],j[t+48>>2]=o%1e3*1e3*1e3,U=[Math.floor(u/1e3)>>>0,(O=Math.floor(u/1e3),+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[t+56>>2]=U[0],A[t+60>>2]=U[1],j[t+64>>2]=u%1e3*1e3*1e3,U=[Math.floor(c/1e3)>>>0,(O=Math.floor(c/1e3),+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[t+72>>2]=U[0],A[t+76>>2]=U[1],j[t+80>>2]=c%1e3*1e3*1e3,U=[n.ino>>>0,(O=n.ino,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[t+88>>2]=U[0],A[t+92>>2]=U[1],0},doMsync(e,r,t,n,o){if(!s.isFile(r.node.mode))throw new s.ErrnoError(43);if(n&2)return 0;var u=Y.slice(e,e+t);s.msync(r,u,o,t,n)},getStreamFromFD(e){var r=s.getStreamChecked(e);return r},varargs:void 0,getStr(e){var r=nt(e);return r}};function Wn(e,r,t,n){try{if(r=x.getStr(r),r=x.calculateAt(e,r),t&-8)return-28;var o=s.lookupPath(r,{follow:!0}),u=o.node;if(!u)return-44;var c="";return t&4&&(c+="r"),t&2&&(c+="w"),t&1&&(c+="x"),c&&s.nodePermissions(u,c)?-2:0}catch(f){if(typeof s>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}var Ue=()=>{var e=A[+x.varargs>>2];return x.varargs+=4,e},we=Ue;function Un(e,r,t){x.varargs=t;try{var n=x.getStreamFromFD(e);switch(r){case 0:{var o=Ue();if(o<0)return-28;for(;s.streams[o];)o++;var u;return u=s.dupStream(n,o),u.fd}case 1:case 2:return 0;case 3:return n.flags;case 4:{var o=Ue();return n.flags|=o,0}case 12:{var o=we(),c=0;return ne[o+c>>1]=2,0}case 13:case 14:return 0}return-28}catch(f){if(typeof s>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}function In(e,r){try{var t=x.getStreamFromFD(e);return x.doStat(s.stat,t.path,r)}catch(n){if(typeof s>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}var he=(e,r)=>r+2097152>>>0<4194305-!!e?(e>>>0)+r*4294967296:NaN;function Nn(e,r,t){var n=he(r,t);try{return isNaN(n)?61:(s.ftruncate(e,n),0)}catch(o){if(typeof s>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}var lr=(e,r,t)=>sr(e,Y,r,t);function Bn(e,r,t){try{var n=x.getStreamFromFD(e);n.getdents||=s.readdir(n.path);for(var o=280,u=0,c=s.llseek(n,0,1),f=Math.floor(c/o),m=Math.min(n.getdents.length,f+Math.floor(t/o)),p=f;p<m;p++){var v,_,w=n.getdents[p];if(w===".")v=n.node.id,_=4;else if(w===".."){var E=s.lookupPath(n.path,{parent:!0});v=E.node.id,_=4}else{var C;try{C=s.lookupNode(n.node,w)}catch(F){if(F?.errno===28)continue;throw F}v=C.id,_=s.isChrdev(C.mode)?2:s.isDir(C.mode)?4:s.isLink(C.mode)?10:8}U=[v>>>0,(O=v,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[r+u>>2]=U[0],A[r+u+4>>2]=U[1],U=[(p+1)*o>>>0,(O=(p+1)*o,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[r+u+8>>2]=U[0],A[r+u+12>>2]=U[1],ne[r+u+16>>1]=280,K[r+u+18]=_,lr(w,r+u+19,256),u+=o}return s.llseek(n,p*o,0),u}catch(F){if(typeof s>"u"||F.name!=="ErrnoError")throw F;return-F.errno}}function Ln(e,r,t){x.varargs=t;try{var n=x.getStreamFromFD(e);switch(r){case 21509:return n.tty?0:-59;case 21505:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcgets){var o=n.tty.ops.ioctl_tcgets(n),u=we();A[u>>2]=o.c_iflag||0,A[u+4>>2]=o.c_oflag||0,A[u+8>>2]=o.c_cflag||0,A[u+12>>2]=o.c_lflag||0;for(var c=0;c<32;c++)K[u+c+17]=o.c_cc[c]||0;return 0}return 0}case 21510:case 21511:case 21512:return n.tty?0:-59;case 21506:case 21507:case 21508:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcsets){for(var u=we(),f=A[u>>2],m=A[u+4>>2],p=A[u+8>>2],v=A[u+12>>2],_=[],c=0;c<32;c++)_.push(K[u+c+17]);return n.tty.ops.ioctl_tcsets(n.tty,r,{c_iflag:f,c_oflag:m,c_cflag:p,c_lflag:v,c_cc:_})}return 0}case 21519:{if(!n.tty)return-59;var u=we();return A[u>>2]=0,0}case 21520:return n.tty?-28:-59;case 21531:{var u=we();return s.ioctl(n,r,u)}case 21523:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tiocgwinsz){var w=n.tty.ops.ioctl_tiocgwinsz(n.tty),u=we();ne[u>>1]=w[0],ne[u+2>>1]=w[1]}return 0}case 21524:return n.tty?0:-59;case 21515:return n.tty?0:-59;default:return-28}}catch(E){if(typeof s>"u"||E.name!=="ErrnoError")throw E;return-E.errno}}function qn(e,r){try{return e=x.getStr(e),x.doStat(s.lstat,e,r)}catch(t){if(typeof s>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}function zn(e,r,t,n){try{r=x.getStr(r);var o=n&256,u=n&4096;return n=n&-6401,r=x.calculateAt(e,r,u),x.doStat(o?s.lstat:s.stat,r,t)}catch(c){if(typeof s>"u"||c.name!=="ErrnoError")throw c;return-c.errno}}function Gn(e,r,t,n){x.varargs=n;try{r=x.getStr(r),r=x.calculateAt(e,r);var o=n?Ue():0;return s.open(r,t,o).fd}catch(u){if(typeof s>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}function Jn(e,r,t,n){try{return r=x.getStr(r),n=x.getStr(n),r=x.calculateAt(e,r),n=x.calculateAt(t,n),s.rename(r,n),0}catch(o){if(typeof s>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}function Yn(e){try{return e=x.getStr(e),s.rmdir(e),0}catch(r){if(typeof s>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}function Kn(e,r){try{return e=x.getStr(e),x.doStat(s.stat,e,r)}catch(t){if(typeof s>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}function Xn(e,r,t){try{return r=x.getStr(r),r=x.calculateAt(e,r),t===0?s.unlink(r):t===512?s.rmdir(r):Re("Invalid flags passed to unlinkat"),0}catch(n){if(typeof s>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}var Qn=()=>Re(""),Ie={},Ne=e=>{for(;e.length;){var r=e.pop(),t=e.pop();t(r)}};function ke(e){return this.fromWireType(j[e>>2])}var Ee={},me={},Be={},it,Le=e=>{throw new it(e)},Z=(e,r,t)=>{e.forEach(f=>Be[f]=r);function n(f){var m=t(f);m.length!==e.length&&Le("Mismatched type converter count");for(var p=0;p<e.length;++p)te(e[p],m[p])}var o=new Array(r.length),u=[],c=0;r.forEach((f,m)=>{me.hasOwnProperty(f)?o[m]=me[f]:(u.push(f),Ee.hasOwnProperty(f)||(Ee[f]=[]),Ee[f].push(()=>{o[m]=me[f],++c,c===u.length&&n(o)}))}),u.length===0&&n(o)},Zn=e=>{var r=Ie[e];delete Ie[e];var t=r.rawConstructor,n=r.rawDestructor,o=r.fields,u=o.map(c=>c.getterReturnType).concat(o.map(c=>c.setterArgumentType));Z([e],u,c=>{var f={};return o.forEach((m,p)=>{var v=m.fieldName,_=c[p],w=m.getter,E=m.getterContext,C=c[p+o.length],F=m.setter,N=m.setterContext;f[v]={read:M=>_.fromWireType(w(E,M)),write:(M,z)=>{var V=[];F(N,M,C.toWireType(V,z)),Ne(V)}}}),[{name:r.name,fromWireType:m=>{var p={};for(var v in f)p[v]=f[v].read(m);return n(m),p},toWireType:(m,p)=>{for(var v in f)if(!(v in p))throw new TypeError(`Missing field: "${v}"`);var _=t();for(v in f)f[v].write(_,p[v]);return m!==null&&m.push(n,_),_},argPackAdvance:ie,readValueFromPointer:ke,destructorFunction:n}]})},ei=(e,r,t,n,o)=>{},ri=()=>{for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);ot=e},ot,G=e=>{for(var r="",t=e;Y[t];)r+=ot[Y[t++]];return r},be,D=e=>{throw new be(e)};function ti(e,r,t={}){var n=r.name;if(e||D(`type "${n}" must have a positive integer typeid pointer`),me.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;D(`Cannot register type '${n}' twice`)}if(me[e]=r,delete Be[e],Ee.hasOwnProperty(e)){var o=Ee[e];delete Ee[e],o.forEach(u=>u())}}function te(e,r,t={}){return ti(e,r,t)}var ie=8,ni=(e,r,t,n)=>{r=G(r),te(e,{name:r,fromWireType:function(o){return!!o},toWireType:function(o,u){return u?t:n},argPackAdvance:ie,readValueFromPointer:function(o){return this.fromWireType(Y[o])},destructorFunction:null})},ii=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),ur=e=>{function r(t){return t.$$.ptrType.registeredClass.name}D(r(e)+" instance already deleted")},cr=!1,st=e=>{},oi=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},at=e=>{e.count.value-=1;var r=e.count.value===0;r&&oi(e)},lt=(e,r,t)=>{if(r===t)return e;if(t.baseClass===void 0)return null;var n=lt(e,r,t.baseClass);return n===null?null:t.downcast(n)},ut={},si={},ai=(e,r)=>{for(r===void 0&&D("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},li=(e,r)=>(r=ai(e,r),si[r]),qe=(e,r)=>{(!r.ptrType||!r.ptr)&&Le("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,n=!!r.smartPtr;return t!==n&&Le("Both smartPtrType and smartPtr must be specified"),r.count={value:1},$e(Object.create(e,{$$:{value:r,writable:!0}}))};function ui(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=li(this.registeredClass,r);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();var n=t.clone();return this.destructor(e),n}function o(){return this.isSmartPointer?qe(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):qe(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var u=this.registeredClass.getActualType(r),c=ut[u];if(!c)return o.call(this);var f;this.isConst?f=c.constPointerType:f=c.pointerType;var m=lt(r,this.registeredClass,f.registeredClass);return m===null?o.call(this):this.isSmartPointer?qe(f.registeredClass.instancePrototype,{ptrType:f,ptr:m,smartPtrType:this,smartPtr:e}):qe(f.registeredClass.instancePrototype,{ptrType:f,ptr:m})}var $e=e=>typeof FinalizationRegistry>"u"?($e=r=>r,e):(cr=new FinalizationRegistry(r=>{at(r.$$)}),$e=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var o={$$:t};cr.register(r,o,r)}return r},st=r=>cr.unregister(r),$e(e)),ze=[],ci=()=>{for(;ze.length;){var e=ze.pop();e.$$.deleteScheduled=!1,e.delete()}},ct,fi=()=>{Object.assign(Ge.prototype,{isAliasOf(e){if(!(this instanceof Ge)||!(e instanceof Ge))return!1;var r=this.$$.ptrType.registeredClass,t=this.$$.ptr;e.$$=e.$$;for(var n=e.$$.ptrType.registeredClass,o=e.$$.ptr;r.baseClass;)t=r.upcast(t),r=r.baseClass;for(;n.baseClass;)o=n.upcast(o),n=n.baseClass;return r===n&&t===o},clone(){if(this.$$.ptr||ur(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=$e(Object.create(Object.getPrototypeOf(this),{$$:{value:ii(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||ur(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&D("Object already scheduled for deletion"),st(this),at(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||ur(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&D("Object already scheduled for deletion"),ze.push(this),ze.length===1&&ct&&ct(ci),this.$$.deleteScheduled=!0,this}})};function Ge(){}var Oe=(e,r)=>Object.defineProperty(r,"name",{value:e}),fr=(e,r,t)=>{if(e[r].overloadTable===void 0){var n=e[r];e[r]=function(...o){return e[r].overloadTable.hasOwnProperty(o.length)||D(`Function '${t}' called with an invalid number of arguments (${o.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[o.length].apply(this,o)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}},ft=(e,r,t)=>{l.hasOwnProperty(e)?((t===void 0||l[e].overloadTable!==void 0&&l[e].overloadTable[t]!==void 0)&&D(`Cannot register public name '${e}' twice`),fr(l,e,e),l[e].overloadTable.hasOwnProperty(t)&&D(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),l[e].overloadTable[t]=r):(l[e]=r,l[e].argCount=t)},di=48,hi=57,mi=e=>{e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=di&&r<=hi?`_${e}`:e};function pi(e,r,t,n,o,u,c,f){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=o,this.getActualType=u,this.upcast=c,this.downcast=f,this.pureVirtualFunctions=[]}var Je=(e,r,t)=>{for(;r!==t;)r.upcast||D(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e};function vi(e,r){if(r===null)return this.isReference&&D(`null is not a valid ${this.name}`),0;r.$$||D(`Cannot pass "${pr(r)}" as a ${this.name}`),r.$$.ptr||D(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=Je(r.$$.ptr,t,this.registeredClass);return n}function gi(e,r){var t;if(r===null)return this.isReference&&D(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;(!r||!r.$$)&&D(`Cannot pass "${pr(r)}" as a ${this.name}`),r.$$.ptr||D(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&D(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var n=r.$$.ptrType.registeredClass;if(t=Je(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&D("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:D(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else{var o=r.clone();t=this.rawShare(t,ee.toHandle(()=>o.delete())),e!==null&&e.push(this.rawDestructor,t)}break;default:D("Unsupporting sharing policy")}return t}function _i(e,r){if(r===null)return this.isReference&&D(`null is not a valid ${this.name}`),0;r.$$||D(`Cannot pass "${pr(r)}" as a ${this.name}`),r.$$.ptr||D(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&D(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=Je(r.$$.ptr,t,this.registeredClass);return n}var yi=()=>{Object.assign(Se.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e)},argPackAdvance:ie,readValueFromPointer:ke,fromWireType:ui})};function Se(e,r,t,n,o,u,c,f,m,p,v){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=o,this.pointeeType=u,this.sharingPolicy=c,this.rawGetPointee=f,this.rawConstructor=m,this.rawShare=p,this.rawDestructor=v,!o&&r.baseClass===void 0?n?(this.toWireType=vi,this.destructorFunction=null):(this.toWireType=_i,this.destructorFunction=null):this.toWireType=gi}var dt=(e,r,t)=>{l.hasOwnProperty(e)||Le("Replacing nonexistent public symbol"),l[e].overloadTable!==void 0&&t!==void 0?l[e].overloadTable[t]=r:(l[e]=r,l[e].argCount=t)},wi=(e,r,t)=>{e=e.replace(/p/g,"i");var n=l["dynCall_"+e];return n(r,...t)},Ye=[],ht,mt=e=>{var r=Ye[e];return r||(e>=Ye.length&&(Ye.length=e+1),Ye[e]=r=ht.get(e)),r},Ei=(e,r,t=[])=>{if(e.includes("j"))return wi(e,r,t);var n=mt(r)(...t);return n},bi=(e,r)=>(...t)=>Ei(e,r,t),J=(e,r)=>{e=G(e);function t(){return e.includes("j")?bi(e,r):mt(r)}var n=t();return typeof n!="function"&&D(`unknown function pointer with signature ${e}: ${r}`),n},Ci=(e,r)=>{var t=Oe(r,function(n){this.name=r,this.message=n;var o=new Error(n).stack;o!==void 0&&(this.stack=this.toString()+`
25
+ `+o.replace(/^Error(:[^\n]*)?\n/,""))});return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},t},pt,vt=e=>{var r=Tt(e),t=G(r);return se(r),t},pe=(e,r)=>{var t=[],n={};function o(u){if(!n[u]&&!me[u]){if(Be[u]){Be[u].forEach(o);return}t.push(u),n[u]=!0}}throw r.forEach(o),new pt(`${e}: `+t.map(vt).join([", "]))},Ai=(e,r,t,n,o,u,c,f,m,p,v,_,w)=>{v=G(v),u=J(o,u),f&&=J(c,f),p&&=J(m,p),w=J(_,w);var E=mi(v);ft(E,function(){pe(`Cannot construct ${v} due to unbound types`,[n])}),Z([e,r,t],n?[n]:[],C=>{C=C[0];var F,N;n?(F=C.registeredClass,N=F.instancePrototype):N=Ge.prototype;var M=Oe(v,function(...q){if(Object.getPrototypeOf(this)!==z)throw new be("Use 'new' to construct "+v);if(V.constructor_body===void 0)throw new be(v+" has no accessible constructor");var Wt=V.constructor_body[q.length];if(Wt===void 0)throw new be(`Tried to invoke ctor of ${v} with invalid number of parameters (${q.length}) - expected (${Object.keys(V.constructor_body).toString()}) parameters instead!`);return Wt.apply(this,q)}),z=Object.create(N,{constructor:{value:M}});M.prototype=z;var V=new pi(v,M,z,w,F,u,f,p);V.baseClass&&(V.baseClass.__derivedClasses??=[],V.baseClass.__derivedClasses.push(V));var ve=new Se(v,V,!0,!1,!1),X=new Se(v+"*",V,!1,!1,!1),ae=new Se(v+" const*",V,!1,!0,!1);return ut[e]={pointerType:X,constPointerType:ae},dt(E,M),[ve,X,ae]})};function gt(e){for(var r=1;r<e.length;++r)if(e[r]!==null&&e[r].destructorFunction===void 0)return!0;return!1}function _t(e,r){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var t=Oe(e.name||"unknownFunctionName",function(){});t.prototype=e.prototype;var n=new t,o=e.apply(n,r);return o instanceof Object?o:n}function ki(e,r,t,n){var o=gt(e),u=e.length-2,c=[],f=["fn"];r&&f.push("thisWired");for(var m=0;m<u;++m)c.push(`arg${m}`),f.push(`arg${m}Wired`);c=c.join(","),f=f.join(",");var p=`return function (${c}) {
26
+ `;o&&(p+=`var destructors = [];
27
+ `);var v=o?"destructors":"null",_=["humanName","throwBindingError","invoker","fn","runDestructors","retType","classParam"];r&&(p+=`var thisWired = classParam['toWireType'](${v}, this);
28
+ `);for(var m=0;m<u;++m)p+=`var arg${m}Wired = argType${m}['toWireType'](${v}, arg${m});
29
+ `,_.push(`argType${m}`);if(p+=(t||n?"var rv = ":"")+`invoker(${f});
30
+ `,o)p+=`runDestructors(destructors);
31
+ `;else for(var m=r?1:2;m<e.length;++m){var w=m===1?"thisWired":"arg"+(m-2)+"Wired";e[m].destructorFunction!==null&&(p+=`${w}_dtor(${w});
32
+ `,_.push(`${w}_dtor`))}return t&&(p+=`var ret = retType['fromWireType'](rv);
36
33
  return ret;
37
- `),m+=`}
38
- `,[y,m]}function Qe(e,r,t,n,o,u){var c=r.length;c<2&&x("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var f=r[1]!==null&&t!==null,h=_t(r),m=r[0].name!=="void",v=[e,x,n,o,qe,r[0],r[1]],y=0;y<c-2;++y)v.push(r[y+2]);if(!h)for(var y=f?1:2;y<r.length;++y)r[y].destructorFunction!==null&&v.push(r[y].destructorFunction);let[w,E]=bi(r,f,m,u);w.push(E);var $=yt(Function,w)(...v);return Te(e,$)}var Ze=(e,r)=>{for(var t=[],n=0;n<e;n++)t.push(M[r+n*4>>2]);return t},vr=e=>{e=e.trim();let r=e.indexOf("(");return r!==-1?e.substr(0,r):e},Ci=(e,r,t,n,o,u,c,f)=>{var h=Ze(t,n);r=G(r),r=vr(r),u=J(o,u),Z([],[e],m=>{m=m[0];var v=`${m.name}.${r}`;function y(){me(`Cannot call ${v} due to unbound types`,h)}r.startsWith("@@")&&(r=Symbol[r.substring(2)]);var w=m.registeredClass.constructor;return w[r]===void 0?(y.argCount=t-1,w[r]=y):(mr(w,r,v),w[r].overloadTable[t-1]=y),Z([],h,E=>{var $=[E[0],null].concat(E.slice(1)),D=Qe(v,$,null,u,c,f);if(w[r].overloadTable===void 0?(D.argCount=t-1,w[r]=D):w[r].overloadTable[t-1]=D,m.registeredClass.__derivedClasses)for(let I of m.registeredClass.__derivedClasses)I.constructor.hasOwnProperty(r)||(I.constructor[r]=D);return[]}),[]})},Ai=(e,r,t,n,o,u)=>{var c=Ze(r,t);o=J(n,o),Z([],[e],f=>{f=f[0];var h=`constructor ${f.name}`;if(f.registeredClass.constructor_body===void 0&&(f.registeredClass.constructor_body=[]),f.registeredClass.constructor_body[r-1]!==void 0)throw new be(`Cannot register multiple constructors with identical number of parameters (${r-1}) for class '${f.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return f.registeredClass.constructor_body[r-1]=()=>{me(`Cannot construct ${f.name} due to unbound types`,c)},Z([],c,m=>(m.splice(1,0,null),f.registeredClass.constructor_body[r-1]=Qe(h,m,null,o,u),[])),[]})},ki=(e,r,t,n,o,u,c,f,h)=>{var m=Ze(t,n);r=G(r),r=vr(r),u=J(o,u),Z([],[e],v=>{v=v[0];var y=`${v.name}.${r}`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),f&&v.registeredClass.pureVirtualFunctions.push(r);function w(){me(`Cannot call ${y} due to unbound types`,m)}var E=v.registeredClass.instancePrototype,$=E[r];return $===void 0||$.overloadTable===void 0&&$.className!==v.name&&$.argCount===t-2?(w.argCount=t-2,w.className=v.name,E[r]=w):(mr(E,r,y),E[r].overloadTable[t-2]=w),Z([],m,D=>{var I=Qe(y,D,v,u,c,h);return E[r].overloadTable===void 0?(I.argCount=t-2,E[r]=I):E[r].overloadTable[t-2]=I,[]}),[]})},wt=(e,r,t)=>(e instanceof Object||x(`${t} with invalid "this": ${e}`),e instanceof r.registeredClass.constructor||x(`${t} incompatible with "this" of type ${e.constructor.name}`),e.$$.ptr||x(`cannot call emscripten binding method ${t} on deleted object`),Ke(e.$$.ptr,e.$$.ptrType.registeredClass,r.registeredClass)),$i=(e,r,t,n,o,u,c,f,h,m)=>{r=G(r),o=J(n,o),Z([],[e],v=>{v=v[0];var y=`${v.name}.${r}`,w={get(){me(`Cannot access ${y} due to unbound types`,[t,c])},enumerable:!0,configurable:!0};return h?w.set=()=>me(`Cannot access ${y} due to unbound types`,[t,c]):w.set=E=>x(y+" is a read-only property"),Object.defineProperty(v.registeredClass.instancePrototype,r,w),Z([],h?[t,c]:[t],E=>{var $=E[0],D={get(){var N=wt(this,v,y+" getter");return $.fromWireType(o(u,N))},enumerable:!0};if(h){h=J(f,h);var I=E[1];D.set=function(N){var z=wt(this,v,y+" setter"),H=[];h(m,z,I.toWireType(H,N)),qe(H)}}return Object.defineProperty(v.registeredClass.instancePrototype,r,D),[]}),[]})},gr=[],se=[],_r=e=>{e>9&&--se[e+1]===0&&(se[e]=void 0,gr.push(e))},Oi=()=>se.length/2-5-gr.length,Si=()=>{se.push(0,1,void 0,1,null,1,!0,1,!1,1),a.count_emval_handles=Oi},ee={toValue:e=>(e||x("Cannot use deleted val. handle = "+e),se[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let r=gr.pop()||se.length;return se[r]=e,se[r+1]=1,r}}}},Pi={name:"emscripten::val",fromWireType:e=>{var r=ee.toValue(e);return _r(e),r},toWireType:(e,r)=>ee.toHandle(r),argPackAdvance:oe,readValueFromPointer:$e,destructorFunction:null},Et=e=>ie(e,Pi),yr=e=>{if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e},Fi=(e,r)=>{switch(r){case 4:return function(t){return this.fromWireType(Lr[t>>2])};case 8:return function(t){return this.fromWireType(qr[t>>3])};default:throw new TypeError(`invalid float width (${r}): ${e}`)}},Ti=(e,r,t)=>{r=G(r),ie(e,{name:r,fromWireType:n=>n,toWireType:(n,o)=>o,argPackAdvance:oe,readValueFromPointer:Fi(r,t),destructorFunction:null})},xi=(e,r,t,n,o,u,c)=>{var f=Ze(r,t);e=G(e),e=vr(e),o=J(n,o),dt(e,function(){me(`Cannot call ${e} due to unbound types`,f)},r-1),Z([],f,h=>{var m=[h[0],null].concat(h.slice(1));return ht(e,Qe(e,m,null,o,u,c),r-1),[]})},Di=(e,r,t)=>{switch(r){case 1:return t?n=>K[n]:n=>Y[n];case 2:return t?n=>te[n>>1]:n=>Re[n>>1];case 4:return t?n=>C[n>>2]:n=>M[n>>2];default:throw new TypeError(`invalid integer width (${r}): ${e}`)}},Mi=(e,r,t,n,o)=>{r=G(r),o===-1&&(o=4294967295);var u=v=>v;if(n===0){var c=32-8*t;u=v=>v<<c>>>c}var f=r.includes("unsigned"),h=(v,y)=>{},m;f?m=function(v,y){return h(y,this.name),y>>>0}:m=function(v,y){return h(y,this.name),y},ie(e,{name:r,fromWireType:u,toWireType:m,argPackAdvance:oe,readValueFromPointer:Di(r,t,n!==0),destructorFunction:null})},ji=(e,r,t)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],o=n[r];function u(c){var f=M[c>>2],h=M[c+4>>2];return new o(K.buffer,h,f)}t=G(t),ie(e,{name:t,fromWireType:u,argPackAdvance:oe,readValueFromPointer:u},{ignoreDuplicateRegistrations:!0})},Hi=(e,r)=>{Et(e)},Ri=(e,r,t,n,o,u,c,f,h,m,v,y)=>{t=G(t),u=J(o,u),f=J(c,f),m=J(h,m),y=J(v,y),Z([e],[r],w=>{w=w[0];var E=new xe(t,w.registeredClass,!1,!1,!0,w,n,u,f,m,y);return[E]})},Vi=(e,r)=>{r=G(r);var t=r==="std::string";ie(e,{name:r,fromWireType(n){var o=M[n>>2],u=n+4,c;if(t)for(var f=u,h=0;h<=o;++h){var m=u+h;if(h==o||Y[m]==0){var v=m-f,y=ot(f,v);c===void 0?c=y:(c+="\0",c+=y),f=m+1}}else{for(var w=new Array(o),h=0;h<o;++h)w[h]=String.fromCharCode(Y[u+h]);c=w.join("")}return ae(n),c},toWireType(n,o){o instanceof ArrayBuffer&&(o=new Uint8Array(o));var u,c=typeof o=="string";c||o instanceof Uint8Array||o instanceof Uint8ClampedArray||o instanceof Int8Array||x("Cannot pass non-string to std::string"),t&&c?u=Ne(o):u=o.length;var f=Cr(4+u+1),h=f+4;if(M[f>>2]=u,t&&c)fr(o,h,u+1);else if(c)for(var m=0;m<u;++m){var v=o.charCodeAt(m);v>255&&(ae(h),x("String has UTF-16 code units that do not fit in 8 bits")),Y[h+m]=v}else for(var m=0;m<u;++m)Y[h+m]=o[m];return n!==null&&n.push(ae,f),f},argPackAdvance:oe,readValueFromPointer:$e,destructorFunction(n){ae(n)}})},bt=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,Wi=(e,r)=>{for(var t=e,n=t>>1,o=n+r/2;!(n>=o)&&Re[n];)++n;if(t=n<<1,t-e>32&&bt)return bt.decode(Y.subarray(e,t));for(var u="",c=0;!(c>=r/2);++c){var f=te[e+c*2>>1];if(f==0)break;u+=String.fromCharCode(f)}return u},Ui=(e,r,t)=>{if(t??=2147483647,t<2)return 0;t-=2;for(var n=r,o=t<e.length*2?t/2:e.length,u=0;u<o;++u){var c=e.charCodeAt(u);te[r>>1]=c,r+=2}return te[r>>1]=0,r-n},Ii=e=>e.length*2,Ni=(e,r)=>{for(var t=0,n="";!(t>=r/4);){var o=C[e+t*4>>2];if(o==0)break;if(++t,o>=65536){var u=o-65536;n+=String.fromCharCode(55296|u>>10,56320|u&1023)}else n+=String.fromCharCode(o)}return n},Bi=(e,r,t)=>{if(t??=2147483647,t<4)return 0;for(var n=r,o=n+t-4,u=0;u<e.length;++u){var c=e.charCodeAt(u);if(c>=55296&&c<=57343){var f=e.charCodeAt(++u);c=65536+((c&1023)<<10)|f&1023}if(C[r>>2]=c,r+=4,r+4>o)break}return C[r>>2]=0,r-n},Li=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n>=55296&&n<=57343&&++t,r+=4}return r},qi=(e,r,t)=>{t=G(t);var n,o,u,c;r===2?(n=Wi,o=Ui,c=Ii,u=f=>Re[f>>1]):r===4&&(n=Ni,o=Bi,c=Li,u=f=>M[f>>2]),ie(e,{name:t,fromWireType:f=>{for(var h=M[f>>2],m,v=f+4,y=0;y<=h;++y){var w=f+4+y*r;if(y==h||u(w)==0){var E=w-v,$=n(v,E);m===void 0?m=$:(m+="\0",m+=$),v=w+r}}return ae(f),m},toWireType:(f,h)=>{typeof h!="string"&&x(`Cannot pass non-string to C++ string type ${t}`);var m=c(h),v=Cr(4+m+r);return M[v>>2]=m/r,o(h,v+4,m+r),f!==null&&f.push(ae,v),v},argPackAdvance:oe,readValueFromPointer:$e,destructorFunction(f){ae(f)}})},zi=(e,r,t,n,o,u)=>{Le[e]={name:G(r),rawConstructor:J(t,n),rawDestructor:J(o,u),fields:[]}},Gi=(e,r,t,n,o,u,c,f,h,m)=>{Le[e].fields.push({fieldName:G(r),getterReturnType:t,getter:J(n,o),getterContext:u,setterArgumentType:c,setter:J(f,h),setterContext:m})},Ji=(e,r)=>{r=G(r),ie(e,{isVoid:!0,name:r,argPackAdvance:0,fromWireType:()=>{},toWireType:(t,n)=>{}})},Yi=1,Ki=()=>Yi,Xi=(e,r,t)=>Y.copyWithin(e,r,r+t),wr=(e,r)=>{var t=pe[e];return t===void 0&&x(`${r} has unknown type ${gt(e)}`),t},Ct=(e,r,t)=>{var n=[],o=e.toWireType(n,t);return n.length&&(M[r>>2]=ee.toHandle(n)),o},Qi=(e,r,t)=>(e=ee.toValue(e),r=wr(r,"emval::as"),Ct(r,t,e)),er=[],Zi=(e,r,t,n)=>(e=er[e],r=ee.toValue(r),e(null,r,t,n)),eo={},Er=e=>{var r=eo[e];return r===void 0?G(e):r},ro=(e,r,t,n,o)=>(e=er[e],r=ee.toValue(r),t=Er(t),e(r,r[t],n,o)),At=()=>typeof globalThis=="object"?globalThis:function(){return Function}()("return this")(),to=e=>e===0?ee.toHandle(At()):(e=Er(e),ee.toHandle(At()[e])),no=e=>{var r=er.length;return er.push(e),r},io=(e,r)=>{for(var t=new Array(e),n=0;n<e;++n)t[n]=wr(M[r+n*4>>2],"parameter "+n);return t},Ms=Reflect.construct,oo=(e,r,t)=>{var n=io(e,r),o=n.shift();e--;var u=`return function (obj, func, destructorsRef, args) {
39
- `,c=0,f=[];t===0&&f.push("obj");for(var h=["retType"],m=[o],v=0;v<e;++v)f.push("arg"+v),h.push("argType"+v),m.push(n[v]),u+=` var arg${v} = argType${v}.readValueFromPointer(args${c?"+"+c:""});
40
- `,c+=n[v].argPackAdvance;var y=t===1?"new func":"func.call";u+=` var rv = ${y}(${f.join(", ")});
41
- `,o.isVoid||(h.push("emval_returnValue"),m.push(Ct),u+=` return emval_returnValue(retType, destructorsRef, rv);
34
+ `),p+=`}
35
+ `,[_,p]}function Ke(e,r,t,n,o,u){var c=r.length;c<2&&D("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var f=r[1]!==null&&t!==null,m=gt(r),p=r[0].name!=="void",v=[e,D,n,o,Ne,r[0],r[1]],_=0;_<c-2;++_)v.push(r[_+2]);if(!m)for(var _=f?1:2;_<r.length;++_)r[_].destructorFunction!==null&&v.push(r[_].destructorFunction);let[w,E]=ki(r,f,p,u);w.push(E);var C=_t(Function,w)(...v);return Oe(e,C)}var Xe=(e,r)=>{for(var t=[],n=0;n<e;n++)t.push(j[r+n*4>>2]);return t},dr=e=>{e=e.trim();let r=e.indexOf("(");return r!==-1?e.substr(0,r):e},$i=(e,r,t,n,o,u,c,f,m)=>{var p=Xe(t,n);r=G(r),r=dr(r),u=J(o,u),Z([],[e],v=>{v=v[0];var _=`${v.name}.${r}`;function w(){pe(`Cannot call ${_} due to unbound types`,p)}r.startsWith("@@")&&(r=Symbol[r.substring(2)]);var E=v.registeredClass.constructor;return E[r]===void 0?(w.argCount=t-1,E[r]=w):(fr(E,r,_),E[r].overloadTable[t-1]=w),Z([],p,C=>{var F=[C[0],null].concat(C.slice(1)),N=Ke(_,F,null,u,c,f);if(E[r].overloadTable===void 0?(N.argCount=t-1,E[r]=N):E[r].overloadTable[t-1]=N,v.registeredClass.__derivedClasses)for(let M of v.registeredClass.__derivedClasses)M.constructor.hasOwnProperty(r)||(M.constructor[r]=N);return[]}),[]})},Oi=(e,r,t,n,o,u)=>{var c=Xe(r,t);o=J(n,o),Z([],[e],f=>{f=f[0];var m=`constructor ${f.name}`;if(f.registeredClass.constructor_body===void 0&&(f.registeredClass.constructor_body=[]),f.registeredClass.constructor_body[r-1]!==void 0)throw new be(`Cannot register multiple constructors with identical number of parameters (${r-1}) for class '${f.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return f.registeredClass.constructor_body[r-1]=()=>{pe(`Cannot construct ${f.name} due to unbound types`,c)},Z([],c,p=>(p.splice(1,0,null),f.registeredClass.constructor_body[r-1]=Ke(m,p,null,o,u),[])),[]})},Si=(e,r,t,n,o,u,c,f,m,p)=>{var v=Xe(t,n);r=G(r),r=dr(r),u=J(o,u),Z([],[e],_=>{_=_[0];var w=`${_.name}.${r}`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),f&&_.registeredClass.pureVirtualFunctions.push(r);function E(){pe(`Cannot call ${w} due to unbound types`,v)}var C=_.registeredClass.instancePrototype,F=C[r];return F===void 0||F.overloadTable===void 0&&F.className!==_.name&&F.argCount===t-2?(E.argCount=t-2,E.className=_.name,C[r]=E):(fr(C,r,w),C[r].overloadTable[t-2]=E),Z([],v,N=>{var M=Ke(w,N,_,u,c,m);return C[r].overloadTable===void 0?(M.argCount=t-2,C[r]=M):C[r].overloadTable[t-2]=M,[]}),[]})},yt=(e,r,t)=>(e instanceof Object||D(`${t} with invalid "this": ${e}`),e instanceof r.registeredClass.constructor||D(`${t} incompatible with "this" of type ${e.constructor.name}`),e.$$.ptr||D(`cannot call emscripten binding method ${t} on deleted object`),Je(e.$$.ptr,e.$$.ptrType.registeredClass,r.registeredClass)),Pi=(e,r,t,n,o,u,c,f,m,p)=>{r=G(r),o=J(n,o),Z([],[e],v=>{v=v[0];var _=`${v.name}.${r}`,w={get(){pe(`Cannot access ${_} due to unbound types`,[t,c])},enumerable:!0,configurable:!0};return m?w.set=()=>pe(`Cannot access ${_} due to unbound types`,[t,c]):w.set=E=>D(_+" is a read-only property"),Object.defineProperty(v.registeredClass.instancePrototype,r,w),Z([],m?[t,c]:[t],E=>{var C=E[0],F={get(){var M=yt(this,v,_+" getter");return C.fromWireType(o(u,M))},enumerable:!0};if(m){m=J(f,m);var N=E[1];F.set=function(M){var z=yt(this,v,_+" setter"),V=[];m(p,z,N.toWireType(V,M)),Ne(V)}}return Object.defineProperty(v.registeredClass.instancePrototype,r,F),[]}),[]})},hr=[],oe=[],mr=e=>{e>9&&--oe[e+1]===0&&(oe[e]=void 0,hr.push(e))},Fi=()=>oe.length/2-5-hr.length,Ti=()=>{oe.push(0,1,void 0,1,null,1,!0,1,!1,1),l.count_emval_handles=Fi},ee={toValue:e=>(e||D("Cannot use deleted val. handle = "+e),oe[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let r=hr.pop()||oe.length;return oe[r]=e,oe[r+1]=1,r}}}},wt={name:"emscripten::val",fromWireType:e=>{var r=ee.toValue(e);return mr(e),r},toWireType:(e,r)=>ee.toHandle(r),argPackAdvance:ie,readValueFromPointer:ke,destructorFunction:null},xi=e=>te(e,wt),pr=e=>{if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e},Di=(e,r)=>{switch(r){case 4:return function(t){return this.fromWireType(Ir[t>>2])};case 8:return function(t){return this.fromWireType(Nr[t>>3])};default:throw new TypeError(`invalid float width (${r}): ${e}`)}},Mi=(e,r,t)=>{r=G(r),te(e,{name:r,fromWireType:n=>n,toWireType:(n,o)=>o,argPackAdvance:ie,readValueFromPointer:Di(r,t),destructorFunction:null})},ji=(e,r,t,n,o,u,c,f)=>{var m=Xe(r,t);e=G(e),e=dr(e),o=J(n,o),ft(e,function(){pe(`Cannot call ${e} due to unbound types`,m)},r-1),Z([],m,p=>{var v=[p[0],null].concat(p.slice(1));return dt(e,Ke(e,v,null,o,u,c),r-1),[]})},Hi=(e,r,t)=>{switch(r){case 1:return t?n=>K[n]:n=>Y[n];case 2:return t?n=>ne[n>>1]:n=>He[n>>1];case 4:return t?n=>A[n>>2]:n=>j[n>>2];default:throw new TypeError(`invalid integer width (${r}): ${e}`)}},Ri=(e,r,t,n,o)=>{r=G(r),o===-1&&(o=4294967295);var u=v=>v;if(n===0){var c=32-8*t;u=v=>v<<c>>>c}var f=r.includes("unsigned"),m=(v,_)=>{},p;f?p=function(v,_){return m(_,this.name),_>>>0}:p=function(v,_){return m(_,this.name),_},te(e,{name:r,fromWireType:u,toWireType:p,argPackAdvance:ie,readValueFromPointer:Hi(r,t,n!==0),destructorFunction:null})},Vi=(e,r,t)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],o=n[r];function u(c){var f=j[c>>2],m=j[c+4>>2];return new o(K.buffer,m,f)}t=G(t),te(e,{name:t,fromWireType:u,argPackAdvance:ie,readValueFromPointer:u},{ignoreDuplicateRegistrations:!0})},Wi=Object.assign({optional:!0},wt),Ui=(e,r)=>{te(e,Wi)},Ii=(e,r,t,n,o,u,c,f,m,p,v,_)=>{t=G(t),u=J(o,u),f=J(c,f),p=J(m,p),_=J(v,_),Z([e],[r],w=>{w=w[0];var E=new Se(t,w.registeredClass,!1,!1,!0,w,n,u,f,p,_);return[E]})},Ni=(e,r)=>{r=G(r);var t=!0;te(e,{name:r,fromWireType(n){var o=j[n>>2],u=n+4,c;if(t)for(var f=u,m=0;m<=o;++m){var p=u+m;if(m==o||Y[p]==0){var v=p-f,_=nt(f,v);c===void 0?c=_:(c+="\0",c+=_),f=p+1}}else{for(var w=new Array(o),m=0;m<o;++m)w[m]=String.fromCharCode(Y[u+m]);c=w.join("")}return se(n),c},toWireType(n,o){o instanceof ArrayBuffer&&(o=new Uint8Array(o));var u,c=typeof o=="string";c||o instanceof Uint8Array||o instanceof Uint8ClampedArray||o instanceof Int8Array||D("Cannot pass non-string to std::string"),t&&c?u=We(o):u=o.length;var f=wr(4+u+1),m=f+4;if(j[f>>2]=u,t&&c)lr(o,m,u+1);else if(c)for(var p=0;p<u;++p){var v=o.charCodeAt(p);v>255&&(se(m),D("String has UTF-16 code units that do not fit in 8 bits")),Y[m+p]=v}else for(var p=0;p<u;++p)Y[m+p]=o[p];return n!==null&&n.push(se,f),f},argPackAdvance:ie,readValueFromPointer:ke,destructorFunction(n){se(n)}})},Et=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,Bi=(e,r)=>{for(var t=e,n=t>>1,o=n+r/2;!(n>=o)&&He[n];)++n;if(t=n<<1,t-e>32&&Et)return Et.decode(Y.subarray(e,t));for(var u="",c=0;!(c>=r/2);++c){var f=ne[e+c*2>>1];if(f==0)break;u+=String.fromCharCode(f)}return u},Li=(e,r,t)=>{if(t??=2147483647,t<2)return 0;t-=2;for(var n=r,o=t<e.length*2?t/2:e.length,u=0;u<o;++u){var c=e.charCodeAt(u);ne[r>>1]=c,r+=2}return ne[r>>1]=0,r-n},qi=e=>e.length*2,zi=(e,r)=>{for(var t=0,n="";!(t>=r/4);){var o=A[e+t*4>>2];if(o==0)break;if(++t,o>=65536){var u=o-65536;n+=String.fromCharCode(55296|u>>10,56320|u&1023)}else n+=String.fromCharCode(o)}return n},Gi=(e,r,t)=>{if(t??=2147483647,t<4)return 0;for(var n=r,o=n+t-4,u=0;u<e.length;++u){var c=e.charCodeAt(u);if(c>=55296&&c<=57343){var f=e.charCodeAt(++u);c=65536+((c&1023)<<10)|f&1023}if(A[r>>2]=c,r+=4,r+4>o)break}return A[r>>2]=0,r-n},Ji=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n>=55296&&n<=57343&&++t,r+=4}return r},Yi=(e,r,t)=>{t=G(t);var n,o,u,c;r===2?(n=Bi,o=Li,c=qi,u=f=>He[f>>1]):r===4&&(n=zi,o=Gi,c=Ji,u=f=>j[f>>2]),te(e,{name:t,fromWireType:f=>{for(var m=j[f>>2],p,v=f+4,_=0;_<=m;++_){var w=f+4+_*r;if(_==m||u(w)==0){var E=w-v,C=n(v,E);p===void 0?p=C:(p+="\0",p+=C),v=w+r}}return se(f),p},toWireType:(f,m)=>{typeof m!="string"&&D(`Cannot pass non-string to C++ string type ${t}`);var p=c(m),v=wr(4+p+r);return j[v>>2]=p/r,o(m,v+4,p+r),f!==null&&f.push(se,v),v},argPackAdvance:ie,readValueFromPointer:ke,destructorFunction(f){se(f)}})},Ki=(e,r,t,n,o,u)=>{Ie[e]={name:G(r),rawConstructor:J(t,n),rawDestructor:J(o,u),fields:[]}},Xi=(e,r,t,n,o,u,c,f,m,p)=>{Ie[e].fields.push({fieldName:G(r),getterReturnType:t,getter:J(n,o),getterContext:u,setterArgumentType:c,setter:J(f,m),setterContext:p})},Qi=(e,r)=>{r=G(r),te(e,{isVoid:!0,name:r,argPackAdvance:0,fromWireType:()=>{},toWireType:(t,n)=>{}})},Zi=(e,r,t)=>Y.copyWithin(e,r,r+t),bt=0,eo=()=>{Xr=!1,bt=0},vr=(e,r)=>{var t=me[e];return t===void 0&&D(`${r} has unknown type ${vt(e)}`),t},Ct=(e,r,t)=>{var n=[],o=e.toWireType(n,t);return n.length&&(j[r>>2]=ee.toHandle(n)),o},ro=(e,r,t)=>(e=ee.toValue(e),r=vr(r,"emval::as"),Ct(r,t,e)),Qe=[],to=(e,r,t,n)=>(e=Qe[e],r=ee.toValue(r),e(null,r,t,n)),no={},gr=e=>{var r=no[e];return r===void 0?G(e):r},io=(e,r,t,n,o)=>(e=Qe[e],r=ee.toValue(r),t=gr(t),e(r,r[t],n,o)),At=()=>typeof globalThis=="object"?globalThis:function(){return Function}()("return this")(),oo=e=>e===0?ee.toHandle(At()):(e=gr(e),ee.toHandle(At()[e])),so=e=>{var r=Qe.length;return Qe.push(e),r},ao=(e,r)=>{for(var t=new Array(e),n=0;n<e;++n)t[n]=vr(j[r+n*4>>2],"parameter "+n);return t},Rs=Reflect.construct,lo=(e,r,t)=>{var n=ao(e,r),o=n.shift();e--;var u=`return function (obj, func, destructorsRef, args) {
36
+ `,c=0,f=[];t===0&&f.push("obj");for(var m=["retType"],p=[o],v=0;v<e;++v)f.push("arg"+v),m.push("argType"+v),p.push(n[v]),u+=` var arg${v} = argType${v}.readValueFromPointer(args${c?"+"+c:""});
37
+ `,c+=n[v].argPackAdvance;var _=t===1?"new func":"func.call";u+=` var rv = ${_}(${f.join(", ")});
38
+ `,o.isVoid||(m.push("emval_returnValue"),p.push(Ct),u+=` return emval_returnValue(retType, destructorsRef, rv);
42
39
  `),u+=`};
43
- `,h.push(u);var w=yt(Function,h)(...m),E=`methodCaller<(${n.map($=>$.name).join(", ")}) => ${o.name}>`;return no(Te(E,w))},so=e=>(e=Er(e),ee.toHandle(a[e])),ao=e=>{e>9&&(se[e+1]+=1)},lo=e=>{var r=ee.toValue(e);qe(r),_r(e)},uo=(e,r)=>{e=wr(e,"_emval_take_value");var t=e.readValueFromPointer(r);return ee.toHandle(t)};function co(e,r,t){var n=we(e,r),o=new Date(n*1e3);C[t>>2]=o.getUTCSeconds(),C[t+4>>2]=o.getUTCMinutes(),C[t+8>>2]=o.getUTCHours(),C[t+12>>2]=o.getUTCDate(),C[t+16>>2]=o.getUTCMonth(),C[t+20>>2]=o.getUTCFullYear()-1900,C[t+24>>2]=o.getUTCDay();var u=Date.UTC(o.getUTCFullYear(),0,1,0,0,0,0),c=(o.getTime()-u)/(1e3*60*60*24)|0;C[t+28>>2]=c}var fo=e=>e%4===0&&(e%100!==0||e%400===0),ho=[0,31,60,91,121,152,182,213,244,274,305,335],po=[0,31,59,90,120,151,181,212,243,273,304,334],mo=e=>{var r=fo(e.getFullYear()),t=r?ho:po,n=t[e.getMonth()]+e.getDate()-1;return n};function vo(e,r,t){var n=we(e,r),o=new Date(n*1e3);C[t>>2]=o.getSeconds(),C[t+4>>2]=o.getMinutes(),C[t+8>>2]=o.getHours(),C[t+12>>2]=o.getDate(),C[t+16>>2]=o.getMonth(),C[t+20>>2]=o.getFullYear()-1900,C[t+24>>2]=o.getDay();var u=mo(o)|0;C[t+28>>2]=u,C[t+36>>2]=-(o.getTimezoneOffset()*60);var c=new Date(o.getFullYear(),0,1),f=new Date(o.getFullYear(),6,1).getTimezoneOffset(),h=c.getTimezoneOffset(),m=(f!=h&&o.getTimezoneOffset()==Math.min(h,f))|0;C[t+32>>2]=m}function go(e,r,t,n,o,u,c,f){var h=we(o,u);try{if(isNaN(h))return 61;var m=T.getStreamFromFD(n),v=s.mmap(m,e,h,r,t),y=v.ptr;return C[c>>2]=v.allocated,M[f>>2]=y,0}catch(w){if(typeof s>"u"||w.name!=="ErrnoError")throw w;return-w.errno}}function _o(e,r,t,n,o,u,c){var f=we(u,c);try{var h=T.getStreamFromFD(o);t&2&&T.doMsync(e,h,r,n,f)}catch(m){if(typeof s>"u"||m.name!=="ErrnoError")throw m;return-m.errno}}var yo=()=>Date.now(),kt;kt=()=>performance.now();var wo=()=>2147483648,Eo=e=>{var r=je.buffer,t=(e-r.byteLength+65535)/65536;try{return je.grow(t),zr(),1}catch{}},bo=e=>{var r=Y.length;e>>>=0;var t=wo();if(e>t)return!1;for(var n=(h,m)=>h+(m-h%m)%m,o=1;o<=4;o*=2){var u=r*(1+.2/o);u=Math.min(u,e+100663296);var c=Math.min(t,n(Math.max(e,u),65536)),f=Eo(c);if(f)return!0}return!1},br={},Co=()=>F||"./this.program",De=()=>{if(!De.strings){var e=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:Co()};for(var t in br)br[t]===void 0?delete r[t]:r[t]=br[t];var n=[];for(var t in r)n.push(`${t}=${r[t]}`);De.strings=n}return De.strings},Ao=(e,r)=>{for(var t=0;t<e.length;++t)K[r++]=e.charCodeAt(t);K[r]=0},ko=(e,r)=>{var t=0;return De().forEach((n,o)=>{var u=r+t;M[e+o*4>>2]=u,Ao(n,u),t+=n.length+1}),0},$o=(e,r)=>{var t=De();M[e>>2]=t.length;var n=0;return t.forEach(o=>n+=o.length+1),M[r>>2]=n,0};function Oo(e){try{var r=T.getStreamFromFD(e);return s.close(r),0}catch(t){if(typeof s>"u"||t.name!=="ErrnoError")throw t;return t.errno}}var So=(e,r,t,n)=>{for(var o=0,u=0;u<t;u++){var c=M[r>>2],f=M[r+4>>2];r+=8;var h=s.read(e,K,c,f,n);if(h<0)return-1;if(o+=h,h<f)break;typeof n<"u"&&(n+=h)}return o};function Po(e,r,t,n){try{var o=T.getStreamFromFD(e),u=So(o,r,t);return M[n>>2]=u,0}catch(c){if(typeof s>"u"||c.name!=="ErrnoError")throw c;return c.errno}}function Fo(e,r,t,n,o){var u=we(r,t);try{if(isNaN(u))return 61;var c=T.getStreamFromFD(e);return s.llseek(c,u,n),U=[c.position>>>0,(O=c.position,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],C[o>>2]=U[0],C[o+4>>2]=U[1],c.getdents&&u===0&&n===0&&(c.getdents=null),0}catch(f){if(typeof s>"u"||f.name!=="ErrnoError")throw f;return f.errno}}var To=(e,r,t,n)=>{for(var o=0,u=0;u<t;u++){var c=M[r>>2],f=M[r+4>>2];r+=8;var h=s.write(e,K,c,f,n);if(h<0)return-1;o+=h,typeof n<"u"&&(n+=h)}return o};function xo(e,r,t,n){try{var o=T.getStreamFromFD(e),u=To(o,r,t);return M[n>>2]=u,0}catch(c){if(typeof s>"u"||c.name!=="ErrnoError")throw c;return c.errno}}var Do=0,Mo=()=>Cn||Do>0,jo=e=>{He=e,Mo()||(a.onExit?.(e),or=!0),W(e,new et(e))},Ho=(e,r)=>{He=e,jo(e)},Ro=e=>{if(e instanceof et||e=="unwind")return He;W(1,e)},$t=e=>Tt(e),Vo=e=>{var r=Ne(e)+1,t=$t(r);return fr(e,t,r),t};s.createPreloadedFile=xn,s.staticInit(),st=a.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},Kn(),be=a.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},li(),ii(),vi(),vt=a.UnboundTypeError=wi(Error,"UnboundTypeError"),Si();var Wo={U:Mn,s:jn,P:Hn,F:Rn,J:Vn,R:Wn,N:Un,M:In,h:Nn,I:Bn,o:Ln,O:qn,p:zn,V:Gn,u:Jn,G:Yn,ba:Qn,k:Ei,_:Ci,$:Ai,d:ki,y:$i,aa:Et,w:Ti,da:xi,c:Mi,a:ji,ea:Hi,n:Ri,x:Vi,j:qi,Z:zi,v:Gi,ca:Ji,T:Ki,Q:Xi,t:Qi,z:Zi,X:ro,b:_r,Y:to,l:oo,W:so,m:ao,g:lo,f:uo,C:co,D:vo,A:go,B:_o,i:yo,S:kt,H:bo,K:ko,L:$o,e:Oo,r:Po,E:Fo,q:xo},j=bn(),Uo=()=>(Uo=j.ga)(),Ot=e=>(Ot=j.ha)(e),Cr=e=>(Cr=j.ia)(e),ae=e=>(ae=j.ja)(e),St=a._main=(e,r)=>(St=a._main=j.ka)(e,r),Pt=(e,r)=>(Pt=j.ma)(e,r),Ft=()=>(Ft=j.na)(),Tt=e=>(Tt=j.oa)(e),Io=a.dynCall_ji=(e,r)=>(Io=a.dynCall_ji=j.pa)(e,r),No=a.dynCall_jiji=(e,r,t,n,o)=>(No=a.dynCall_jiji=j.qa)(e,r,t,n,o),Bo=a.dynCall_viij=(e,r,t,n,o)=>(Bo=a.dynCall_viij=j.ra)(e,r,t,n,o),Lo=a.dynCall_iij=(e,r,t,n)=>(Lo=a.dynCall_iij=j.sa)(e,r,t,n),qo=a.dynCall_iiji=(e,r,t,n,o)=>(qo=a.dynCall_iiji=j.ta)(e,r,t,n,o),zo=a.dynCall_jji=(e,r,t,n)=>(zo=a.dynCall_jji=j.ua)(e,r,t,n),Go=a.dynCall_iji=(e,r,t,n)=>(Go=a.dynCall_iji=j.va)(e,r,t,n),Jo=a.dynCall_iiij=(e,r,t,n,o)=>(Jo=a.dynCall_iiij=j.wa)(e,r,t,n,o),Yo=a.dynCall_viijj=(e,r,t,n,o,u,c)=>(Yo=a.dynCall_viijj=j.xa)(e,r,t,n,o,u,c),Ko=a.dynCall_vij=(e,r,t,n)=>(Ko=a.dynCall_vij=j.ya)(e,r,t,n),Xo=a.dynCall_viijii=(e,r,t,n,o,u,c)=>(Xo=a.dynCall_viijii=j.za)(e,r,t,n,o,u,c),Qo=a.dynCall_iiiij=(e,r,t,n,o,u)=>(Qo=a.dynCall_iiiij=j.Aa)(e,r,t,n,o,u),Zo=a.dynCall_iiiiij=(e,r,t,n,o,u,c)=>(Zo=a.dynCall_iiiiij=j.Ba)(e,r,t,n,o,u,c),es=a.dynCall_iiiiijj=(e,r,t,n,o,u,c,f,h)=>(es=a.dynCall_iiiiijj=j.Ca)(e,r,t,n,o,u,c,f,h),rs=a.dynCall_iiiiiijj=(e,r,t,n,o,u,c,f,h,m)=>(rs=a.dynCall_iiiiiijj=j.Da)(e,r,t,n,o,u,c,f,h,m),rr;ke=function e(){rr||xt(),rr||(ke=e)};function ts(e=[]){var r=St;e.unshift(F);var t=e.length,n=$t((t+1)*4),o=n;e.forEach(c=>{M[o>>2]=Vo(c),o+=4}),M[o>>2]=0;try{var u=r(t,n);return Ho(u,!0),u}catch(c){return Ro(c)}}function xt(e=S){if(he>0||(cn(),he>0))return;function r(){rr||(rr=!0,a.calledRun=!0,!or&&(fn(),dn(),d(a),a.onRuntimeInitialized?.(),Dt&&ts(e),hn()))}a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1),r()},1)):r()}if(a.preInit)for(typeof a.preInit=="function"&&(a.preInit=[a.preInit]);a.preInit.length>0;)a.preInit.pop()();var Dt=!0;return a.noInitialRun&&(Dt=!1),xt(),l=_,l}})(),zt=ps;var sn=Ar(on(),1),{program:ua,createCommand:ca,createArgument:fa,createOption:da,CommanderError:ha,InvalidArgumentError:pa,InvalidOptionArgumentError:ma,Command:an,Argument:va,Option:ga,Help:_a}=sn.default;var Fs=()=>Nr.default.openAsBlob((0,ln.resolve)(__dirname,"docauth.wasm")),Ts=async()=>{let g=await Vt({type:"buffer",buffer:(await Fs()).arrayBuffer()},Promise.resolve(zt));return Ut(g)},Br=new an,xs=async g=>{let i=await Ts(),l=qt({wasmExecutor:i},g.scanDirectory);Nr.default.writeFileSync(g.writeTo,JSON.stringify(Bt(l)),"utf-8")};Br.name("document-authoring");Br.command("create-font-index").description("Create a dynamic font index").requiredOption("-d, --scan-directory <string>","The directory to scan for fonts").requiredOption("-w, --write-to <string>","The font index JSON file to create").action(xs);Br.parse();
40
+ `,m.push(u);var w=_t(Function,m)(...p),E=`methodCaller<(${n.map(C=>C.name).join(", ")}) => ${o.name}>`;return so(Oe(E,w))},uo=e=>(e=gr(e),ee.toHandle(l[e])),co=e=>{e>9&&(oe[e+1]+=1)},fo=e=>{var r=ee.toValue(e);Ne(r),mr(e)},ho=(e,r)=>{e=vr(e,"_emval_take_value");var t=e.readValueFromPointer(r);return ee.toHandle(t)};function mo(e,r,t){var n=he(e,r),o=new Date(n*1e3);A[t>>2]=o.getUTCSeconds(),A[t+4>>2]=o.getUTCMinutes(),A[t+8>>2]=o.getUTCHours(),A[t+12>>2]=o.getUTCDate(),A[t+16>>2]=o.getUTCMonth(),A[t+20>>2]=o.getUTCFullYear()-1900,A[t+24>>2]=o.getUTCDay();var u=Date.UTC(o.getUTCFullYear(),0,1,0,0,0,0),c=(o.getTime()-u)/(1e3*60*60*24)|0;A[t+28>>2]=c}var po=e=>e%4===0&&(e%100!==0||e%400===0),vo=[0,31,60,91,121,152,182,213,244,274,305,335],go=[0,31,59,90,120,151,181,212,243,273,304,334],_o=e=>{var r=po(e.getFullYear()),t=r?vo:go,n=t[e.getMonth()]+e.getDate()-1;return n};function yo(e,r,t){var n=he(e,r),o=new Date(n*1e3);A[t>>2]=o.getSeconds(),A[t+4>>2]=o.getMinutes(),A[t+8>>2]=o.getHours(),A[t+12>>2]=o.getDate(),A[t+16>>2]=o.getMonth(),A[t+20>>2]=o.getFullYear()-1900,A[t+24>>2]=o.getDay();var u=_o(o)|0;A[t+28>>2]=u,A[t+36>>2]=-(o.getTimezoneOffset()*60);var c=new Date(o.getFullYear(),0,1),f=new Date(o.getFullYear(),6,1).getTimezoneOffset(),m=c.getTimezoneOffset(),p=(f!=m&&o.getTimezoneOffset()==Math.min(m,f))|0;A[t+32>>2]=p}function wo(e,r,t,n,o,u,c,f){var m=he(o,u);try{if(isNaN(m))return 61;var p=x.getStreamFromFD(n),v=s.mmap(p,e,m,r,t),_=v.ptr;return A[c>>2]=v.allocated,j[f>>2]=_,0}catch(w){if(typeof s>"u"||w.name!=="ErrnoError")throw w;return-w.errno}}function Eo(e,r,t,n,o,u,c){var f=he(u,c);try{var m=x.getStreamFromFD(o);t&2&&x.doMsync(e,m,r,n,f)}catch(p){if(typeof s>"u"||p.name!=="ErrnoError")throw p;return-p.errno}}var Pe={},_r=e=>{if(e instanceof Kr||e=="unwind")return je;I(1,e)},kt=()=>Xr||bt>0,$t=e=>{je=e,kt()||(l.onExit?.(e),Me=!0),I(e,new Kr(e))},Ot=(e,r)=>{je=e,$t(e)},bo=Ot,Co=()=>{if(!kt())try{bo(je)}catch(e){_r(e)}},Ao=e=>{if(!Me)try{e(),Co()}catch(r){_r(r)}},St=()=>performance.now(),ko=(e,r)=>{if(Pe[e]&&(clearTimeout(Pe[e].id),delete Pe[e]),!r)return 0;var t=setTimeout(()=>{delete Pe[e],Ao(()=>Mt(e,St()))},r);return Pe[e]={id:t,timeout_ms:r},0},Pt=()=>Date.now(),$o=1,Oo=e=>e>=0&&e<=3;function So(e,r,t,n){var o=he(r,t);if(!Oo(e))return 28;var u;if(e===0)u=Pt();else if($o)u=St();else return 52;var c=Math.round(u*1e3*1e3);return U=[c>>>0,(O=c,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[n>>2]=U[0],A[n+4>>2]=U[1],0}var Po=()=>2147483648,Fo=e=>{var r=De.buffer,t=(e-r.byteLength+65535)/65536|0;try{return De.grow(t),Br(),1}catch{}},To=e=>{var r=Y.length;e>>>=0;var t=Po();if(e>t)return!1;for(var n=1;n<=4;n*=2){var o=r*(1+.2/n);o=Math.min(o,e+100663296);var u=Math.min(t,rt(Math.max(e,o),65536)),c=Fo(u);if(c)return!0}return!1},yr={},xo=()=>T||"./this.program",Fe=()=>{if(!Fe.strings){var e=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:xo()};for(var t in yr)yr[t]===void 0?delete r[t]:r[t]=yr[t];var n=[];for(var t in r)n.push(`${t}=${r[t]}`);Fe.strings=n}return Fe.strings},Do=(e,r)=>{for(var t=0;t<e.length;++t)K[r++]=e.charCodeAt(t);K[r]=0},Mo=(e,r)=>{var t=0;return Fe().forEach((n,o)=>{var u=r+t;j[e+o*4>>2]=u,Do(n,u),t+=n.length+1}),0},jo=(e,r)=>{var t=Fe();j[e>>2]=t.length;var n=0;return t.forEach(o=>n+=o.length+1),j[r>>2]=n,0};function Ho(e){try{var r=x.getStreamFromFD(e);return s.close(r),0}catch(t){if(typeof s>"u"||t.name!=="ErrnoError")throw t;return t.errno}}var Ro=(e,r,t,n)=>{for(var o=0,u=0;u<t;u++){var c=j[r>>2],f=j[r+4>>2];r+=8;var m=s.read(e,K,c,f,n);if(m<0)return-1;if(o+=m,m<f)break;typeof n<"u"&&(n+=m)}return o};function Vo(e,r,t,n){try{var o=x.getStreamFromFD(e),u=Ro(o,r,t);return j[n>>2]=u,0}catch(c){if(typeof s>"u"||c.name!=="ErrnoError")throw c;return c.errno}}function Wo(e,r,t,n,o){var u=he(r,t);try{if(isNaN(u))return 61;var c=x.getStreamFromFD(e);return s.llseek(c,u,n),U=[c.position>>>0,(O=c.position,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[o>>2]=U[0],A[o+4>>2]=U[1],c.getdents&&u===0&&n===0&&(c.getdents=null),0}catch(f){if(typeof s>"u"||f.name!=="ErrnoError")throw f;return f.errno}}var Uo=(e,r,t,n)=>{for(var o=0,u=0;u<t;u++){var c=j[r>>2],f=j[r+4>>2];r+=8;var m=s.write(e,K,c,f,n);if(m<0)return-1;if(o+=m,m<f)break;typeof n<"u"&&(n+=m)}return o};function Io(e,r,t,n){try{var o=x.getStreamFromFD(e),u=Uo(o,r,t);return j[n>>2]=u,0}catch(c){if(typeof s>"u"||c.name!=="ErrnoError")throw c;return c.errno}}var Ft=e=>Ht(e),No=e=>{var r=We(e)+1,t=Ft(r);return lr(e,t,r),t};s.createPreloadedFile=Rn,s.staticInit(),P.doesNotExistError=new s.ErrnoError(44),P.doesNotExistError.stack="<generic error, no stack>",it=l.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},ri(),be=l.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},fi(),yi(),pt=l.UnboundTypeError=Ci(Error,"UnboundTypeError"),Ti();var Bo={V:Wn,r:Un,S:In,E:Nn,M:Bn,U:Ln,Q:qn,P:zn,h:Gn,L:Jn,n:Yn,R:Kn,o:Xn,W:Qn,u:Zn,G:ei,da:ni,j:Ai,$:$i,aa:Oi,d:Si,x:Pi,ba:xi,w:Mi,fa:ji,c:Ri,a:Vi,ga:Ui,m:Ii,ca:Ni,i:Yi,_:Ki,v:Xi,ea:Qi,T:Zi,I:eo,t:ro,y:to,Y:io,b:mr,Z:oo,k:lo,X:uo,l:co,g:fo,f:ho,B:mo,C:yo,z:wo,A:Eo,J:ko,F:So,s:Pt,K:To,N:Mo,O:jo,e:Ho,q:Vo,D:Wo,p:Io,H:$t},R;Pn();var Lo=()=>(Lo=R.ia)(),Tt=e=>(Tt=R.ja)(e),wr=e=>(wr=R.ka)(e),se=e=>(se=R.la)(e),xt=l._main=(e,r)=>(xt=l._main=R.ma)(e,r),Dt=(e,r)=>(Dt=R.oa)(e,r),Mt=(e,r)=>(Mt=R.pa)(e,r),jt=()=>(jt=R.qa)(),Ht=e=>(Ht=R.ra)(e),qo=l.dynCall_ji=(e,r)=>(qo=l.dynCall_ji=R.sa)(e,r),zo=l.dynCall_jiji=(e,r,t,n,o)=>(zo=l.dynCall_jiji=R.ta)(e,r,t,n,o),Go=l.dynCall_viij=(e,r,t,n,o)=>(Go=l.dynCall_viij=R.ua)(e,r,t,n,o),Jo=l.dynCall_iij=(e,r,t,n)=>(Jo=l.dynCall_iij=R.va)(e,r,t,n),Yo=l.dynCall_iiji=(e,r,t,n,o)=>(Yo=l.dynCall_iiji=R.wa)(e,r,t,n,o),Ko=l.dynCall_jji=(e,r,t,n)=>(Ko=l.dynCall_jji=R.xa)(e,r,t,n),Xo=l.dynCall_iji=(e,r,t,n)=>(Xo=l.dynCall_iji=R.ya)(e,r,t,n),Qo=l.dynCall_iiij=(e,r,t,n,o)=>(Qo=l.dynCall_iiij=R.za)(e,r,t,n,o),Zo=l.dynCall_viijj=(e,r,t,n,o,u,c)=>(Zo=l.dynCall_viijj=R.Aa)(e,r,t,n,o,u,c),es=l.dynCall_vij=(e,r,t,n)=>(es=l.dynCall_vij=R.Ba)(e,r,t,n),rs=l.dynCall_viijii=(e,r,t,n,o,u,c)=>(rs=l.dynCall_viijii=R.Ca)(e,r,t,n,o,u,c),ts=l.dynCall_iiiiij=(e,r,t,n,o,u,c)=>(ts=l.dynCall_iiiiij=R.Da)(e,r,t,n,o,u,c),ns=l.dynCall_iiiiijj=(e,r,t,n,o,u,c,f,m)=>(ns=l.dynCall_iiiiijj=R.Ea)(e,r,t,n,o,u,c,f,m),is=l.dynCall_iiiiiijj=(e,r,t,n,o,u,c,f,m,p)=>(is=l.dynCall_iiiiiijj=R.Fa)(e,r,t,n,o,u,c,f,m,p),Ze;Ae=function e(){Ze||Rt(),Ze||(Ae=e)};function os(e=[]){var r=xt;e.unshift(T);var t=e.length,n=Ft((t+1)*4),o=n;e.forEach(c=>{j[o>>2]=No(c),o+=4}),j[o>>2]=0;try{var u=r(t,n);return Ot(u,!0),u}catch(c){return _r(c)}}function Rt(e=S){if(de>0||(pn(),de>0))return;function r(){Ze||(Ze=!0,l.calledRun=!0,!Me&&(vn(),gn(),d(l),l.onRuntimeInitialized?.(),Vt&&os(e),_n()))}l.setStatus?(l.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>l.setStatus(""),1),r()},1)):r()}if(l.preInit)for(typeof l.preInit=="function"&&(l.preInit=[l.preInit]);l.preInit.length>0;)l.preInit.pop()();var Vt=!0;return l.noInitialRun&&(Vt=!1),Rt(),a=y,a}})(),Xt=gs;var fn=Er(cn(),1),{program:da,createCommand:ha,createArgument:ma,createOption:pa,CommanderError:va,InvalidArgumentError:ga,InvalidOptionArgumentError:_a,Command:dn,Argument:ya,Option:wa,Help:Ea}=fn.default;var Ds=()=>Wr.default.openAsBlob((0,hn.resolve)(__dirname,"docauth.wasm")),Ms=async()=>{let g=await Bt({type:"buffer",buffer:(await Ds()).arrayBuffer()},Promise.resolve(Xt));return qt(g)},Ur=new dn,js=async g=>{let i=await Ms(),a=Kt({wasmExecutor:i},g.scanDirectory);Wr.default.writeFileSync(g.writeTo,JSON.stringify(Jt(a)),"utf-8")};Ur.name("document-authoring");Ur.command("create-font-index").description("Create a dynamic font index").requiredOption("-d, --scan-directory <string>","The directory to scan for fonts").requiredOption("-w, --write-to <string>","The font index JSON file to create").action(js);Ur.parse();
package/lib/docauth.mjs CHANGED
@@ -1,4 +1,4 @@
1
- const t={type:"default-index"},e=async t=>(await(async t=>{const e=new URL(t??"https://document-authoring.cdn.nutrient.io/2025/1/",window.location.href).href,a=new URL("docauth-impl-cfacda1557b52c3a.js",e).href;return import(
1
+ const t={type:"default-index"},e=async t=>(await(async t=>{const e=new URL(t??"https://document-authoring.cdn.nutrient.io/2025/1/",window.location.href).href,a=new URL("docauth-impl-2c997ca7ad2e829e.js",e).href;return import(
2
2
  /*webpackIgnore: true*/
3
3
  /* @vite-ignore */
4
4
  a)})(t?.assets?.base)).createDocAuthSystem(t);var a={createDocAuthSystem:e,defaultFontIndex:t};export{e as createDocAuthSystem,a as default,t as defaultFontIndex};
@@ -1,4 +1,4 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).DocAuth={})}(this,(function(e){"use strict";const t={type:"default-index"},n=async e=>(await(async e=>{const t=new URL(e??"https://document-authoring.cdn.nutrient.io/2025/1/",window.location.href).href,n=new URL("docauth-impl-cfacda1557b52c3a.js",t).href;return import(
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).DocAuth={})}(this,(function(e){"use strict";const t={type:"default-index"},n=async e=>(await(async e=>{const t=new URL(e??"https://document-authoring.cdn.nutrient.io/2025/1/",window.location.href).href,n=new URL("docauth-impl-2c997ca7ad2e829e.js",t).href;return import(
2
2
  /*webpackIgnore: true*/
3
3
  /* @vite-ignore */
4
4
  n)})(e?.assets?.base)).createDocAuthSystem(e);var o={createDocAuthSystem:n,defaultFontIndex:t};e.createDocAuthSystem=n,e.default=o,e.defaultFontIndex=t,Object.defineProperty(e,"__esModule",{value:!0})}));
package/lib/docauth.wasm CHANGED
Binary file
package/lib/index.d.cts CHANGED
@@ -74,6 +74,12 @@ export declare type CreateEditorOptions = {
74
74
  * @see {@link DocAuthEditor.setCurrentDocument}
75
75
  */
76
76
  document?: DocAuthDocument;
77
+ /**
78
+ * Allows toggling/changing various UI options.
79
+ *
80
+ * See {@link UIOptions}
81
+ */
82
+ ui?: UIOptions;
77
83
 
78
84
 
79
85
  };
@@ -82,7 +88,7 @@ export declare type CreateEditorOptions = {
82
88
  * @hidden
83
89
  */
84
90
  declare const _default: {
85
- createDocAuthSystem: (options?: CreateDocAuthSystemOptions | undefined) => Promise<DocAuthSystem>;
91
+ createDocAuthSystem: (options?: CreateDocAuthSystemOptions) => Promise<DocAuthSystem>;
86
92
  defaultFontIndex: DefaultFontIndex;
87
93
  };
88
94
  export default _default;
@@ -328,4 +334,55 @@ export declare type ImportDOCXOptions = {
328
334
  abortSignal?: AbortSignal;
329
335
  };
330
336
 
337
+ /**
338
+ * English, French and German are currently supported (two-letter ISO 639-1 codes).
339
+ *
340
+ * See {@link UIOptions | UIOptions.locale}
341
+ *
342
+ * @public
343
+ */
344
+ export declare type Locale = 'en' | 'fr' | 'de';
345
+
346
+ /**
347
+ * Configuration options for the user interface.
348
+ *
349
+ * @public
350
+ */
351
+ export declare type UIOptions = {
352
+ /**
353
+ * The locale to use for displaying text, formatting numbers etc.
354
+ *
355
+ * `auto` will automatically detect the user's locale based on their browser settings. If this doesn't match a supported locale, it will fall back to `en`.
356
+ *
357
+ * @defaultValue `auto`
358
+ */
359
+ locale?: Locale | 'auto';
360
+ /**
361
+ * The unit system for measurements shown in the UI.
362
+ *
363
+ * @defaultValue `pt`
364
+ */
365
+ unit?: Unit;
366
+ /**
367
+ * Configuration for the ruler feature.
368
+ */
369
+ ruler?: {
370
+ /**
371
+ * Controls whether the ruler is shown by default when the editor loads.
372
+ *
373
+ * @defaultValue `true`
374
+ */
375
+ enabled: boolean;
376
+ };
377
+ };
378
+
379
+ /**
380
+ * The list of supported units in Document Authoring.
381
+ *
382
+ * See {@link UIOptions | UIOptions.unit}
383
+ *
384
+ * @public
385
+ */
386
+ export declare type Unit = 'cm' | 'in' | 'pt' | 'pc' | 'mm';
387
+
331
388
  export { }
package/lib/index.d.mts CHANGED
@@ -74,6 +74,12 @@ export declare type CreateEditorOptions = {
74
74
  * @see {@link DocAuthEditor.setCurrentDocument}
75
75
  */
76
76
  document?: DocAuthDocument;
77
+ /**
78
+ * Allows toggling/changing various UI options.
79
+ *
80
+ * See {@link UIOptions}
81
+ */
82
+ ui?: UIOptions;
77
83
 
78
84
 
79
85
  };
@@ -82,7 +88,7 @@ export declare type CreateEditorOptions = {
82
88
  * @hidden
83
89
  */
84
90
  declare const _default: {
85
- createDocAuthSystem: (options?: CreateDocAuthSystemOptions | undefined) => Promise<DocAuthSystem>;
91
+ createDocAuthSystem: (options?: CreateDocAuthSystemOptions) => Promise<DocAuthSystem>;
86
92
  defaultFontIndex: DefaultFontIndex;
87
93
  };
88
94
  export default _default;
@@ -328,4 +334,55 @@ export declare type ImportDOCXOptions = {
328
334
  abortSignal?: AbortSignal;
329
335
  };
330
336
 
337
+ /**
338
+ * English, French and German are currently supported (two-letter ISO 639-1 codes).
339
+ *
340
+ * See {@link UIOptions | UIOptions.locale}
341
+ *
342
+ * @public
343
+ */
344
+ export declare type Locale = 'en' | 'fr' | 'de';
345
+
346
+ /**
347
+ * Configuration options for the user interface.
348
+ *
349
+ * @public
350
+ */
351
+ export declare type UIOptions = {
352
+ /**
353
+ * The locale to use for displaying text, formatting numbers etc.
354
+ *
355
+ * `auto` will automatically detect the user's locale based on their browser settings. If this doesn't match a supported locale, it will fall back to `en`.
356
+ *
357
+ * @defaultValue `auto`
358
+ */
359
+ locale?: Locale | 'auto';
360
+ /**
361
+ * The unit system for measurements shown in the UI.
362
+ *
363
+ * @defaultValue `pt`
364
+ */
365
+ unit?: Unit;
366
+ /**
367
+ * Configuration for the ruler feature.
368
+ */
369
+ ruler?: {
370
+ /**
371
+ * Controls whether the ruler is shown by default when the editor loads.
372
+ *
373
+ * @defaultValue `true`
374
+ */
375
+ enabled: boolean;
376
+ };
377
+ };
378
+
379
+ /**
380
+ * The list of supported units in Document Authoring.
381
+ *
382
+ * See {@link UIOptions | UIOptions.unit}
383
+ *
384
+ * @public
385
+ */
386
+ export declare type Unit = 'cm' | 'in' | 'pt' | 'pc' | 'mm';
387
+
331
388
  export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nutrient-sdk/document-authoring",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "A web SDK for word processing and rich text capabilities.",
5
5
  "type": "commonjs",
6
6
  "main": "lib/docauth.umd.js",
@@ -36,7 +36,9 @@
36
36
  "React",
37
37
  "JavaScript",
38
38
  "text formatting",
39
- "DOCX"
39
+ "DOCX",
40
+ "PDF",
41
+ "DocJSON"
40
42
  ],
41
43
  "homepage": "https://www.nutrient.io/sdk/document-authoring/",
42
44
  "author": {