@gisce/ooui 0.19.1-rc.0 → 0.19.1

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/dist/ooui.umd.js CHANGED
@@ -1,21 +1,21 @@
1
- (function(C,De){typeof exports=="object"&&typeof module<"u"?De(exports,require("html-entities"),require("moment")):typeof define=="function"&&define.amd?define(["exports","html-entities","moment"],De):(C=typeof globalThis<"u"?globalThis:C||self,De(C.ooui={},C.htmlEntities,C.moment))})(this,function(C,De,rn){"use strict";const Me=(t=>t&&typeof t=="object"&&"default"in t?t:{default:t})(rn),We=class{constructor(t){if(this._type="",this._parsedWidgetProps={},this._colspan=We._defaultColspan,this._readOnly=!1,this._invisible=!1,t){if(t.colspan&&(this._colspan=+t.colspan),t.readonly&&(t.readonly==="1"||t.readonly===1||t.readonly===!0)&&(this._readOnly=!0),t.invisible&&(t.invisible===1||t.invisible==="1"||t.invisible===!0)&&(this._invisible=!0),t.type&&(this._type=t.type),t.context&&(this._context=t.context),t.domain&&(typeof t.domain!="string"?this._domain=JSON.stringify(t.domain):this._domain=t.domain),t.widget_props)try{this._parsedWidgetProps=JSON.parse(t.widget_props.replace(/'/g,'"'))}catch{throw new Error("Error parsing widget_props")}t.key&&(this._key=t.key)}}static get defaultColspan(){return We._defaultColspan}static set defaultColspan(t){We._defaultColspan=t}get readOnly(){return this._readOnly}set readOnly(t){this._readOnly=t}get colspan(){return this._colspan}set colspan(t){this._colspan=+t}get invisible(){return this._invisible}set invisible(t){this._invisible=t}get type(){return this._type}set type(t){this._type=t}get context(){return this._context}set context(t){this._context=t}get domain(){return this._domain}set domain(t){this._domain=t}get key(){return this._key}set key(t){this._key=t}get parsedWidgetProps(){return this._parsedWidgetProps}set parsedWidgetProps(t){this._parsedWidgetProps=t}};let he=We;he._defaultColspan=1;const nn=({entry:t,values:e,fields:r})=>{const[i,n,s]=t;if(r[i]===void 0||e[i]===void 0&&r[i].type!=="boolean"&&r[i].type!=="many2one")return!1;let a=s,u=r[i].type==="boolean"?!!e[i]:e[i];switch(r[i].type==="many2one"&&s===!1&&e[i]===void 0?a=void 0:(u=u===void 0?!1:u,u=u===null?!1:u),r[i].type==="many2one"&&Array.isArray(u)&&u[0]===void 0&&(u=!1),r[i].type==="boolean"&&(s===0||s===1)&&(a=s!==0),n.toLowerCase()){case"=":case"==":return u==a;case"<>":case"!=":return u!=a;case">":return u>a;case">=":return u>=a;case"<":return u<a;case"<=":return u<=a;case"in":return a.includes(u);case"not in":return!a.includes(u);default:return!1}},G=t=>De.decode(t,{level:"xml"}),an=({attrs:t,values:e,fields:r})=>{const u=t.replace(/\(/g,"[").replace(/\)/g,"]").replace(/\'/g,'"').replace(/True/g,"true").replace(/False/g,"false"),f=G(u),_=JSON.parse(f),b={};for(const w of Object.keys(_))_[w].map(T=>nn({entry:T,values:e,fields:r})).every(T=>T===!0)&&(b[w]=!0);return b},sn=({tagAttributes:t,values:e,fields:r})=>{const i=t.attrs?an({attrs:t.attrs,values:e,fields:r}):{};return{...t,...i,attrs:void 0}};class W extends he{constructor(e){super(e),this._id="",this._label="",this._nolabel=!1,this._required=!1,this._activated=!0,this._selectionValues=new Map([]),this._activated=!0,e&&(e.name&&(this._id=e.name),e.activated&&(this._activated=e.activated),e.string&&(this._label=G(e.string)),e.help&&(this._tooltip=G(e.help)),e.nolabel&&(e.nolabel==="1"||typeof e.nolabel=="boolean"&&e.nolabel===!0)&&(this._nolabel=!0),e.required&&(e.required==="1"||e.required===!0||e.required==="True")&&(this._required=!0),e.sum&&(this._sum=e.sum),e.selection&&(this._selectionValues=new Map(e.selection)))}get id(){return this._id}set id(e){this._id=e}get label(){return this._label}set label(e){this._label=e}get nolabel(){return this._nolabel}set nolabel(e){this._nolabel=e}get required(){return this._required}set required(e){this._required=e}get tooltip(){return this._tooltip}set tooltip(e){this._tooltip=e}get activated(){return this._activated}set activated(e){this._activated=e}get sum(){return this._sum}set sum(e){this._sum=e}get selectionValues(){return this._selectionValues}set selectionValues(e){this._selectionValues=e}findById(e){let r=null;return this._id===e&&(r=this),r}}class yt extends he{findById(e){return null}}class wt extends W{constructor(e){super({...e,nolabel:!0}),this._text="",this._align="left",this._labelType="default",this._labelSize="text",this._fieldForLabel=null,e!=null&&e.fieldForLabel&&(this._fieldForLabel=e.fieldForLabel),e.widget_props&&(this.parsedWidgetProps.label_type&&(this.labelType=this.parsedWidgetProps.label_type),this.parsedWidgetProps.label_size&&(this.labelSize=this.parsedWidgetProps.label_size))}get text(){return this._text}set text(e){this._text=e}get align(){return this._align}set align(e){this._align=e}get labelType(){return this._labelType}set labelType(e){this._labelType=e}get labelSize(){return this._labelSize}set labelSize(e){this._labelSize=e}get fieldForLabel(){return this._fieldForLabel}set fieldForLabel(e){this._fieldForLabel=e}}class Oe{get columns(){return this._columns}set columns(e){this._columns=e}get colspan(){return this._colspan}set colspan(e){this._colspan=e}get rows(){return this._rows}set rows(e){this._rows=e}get index(){return this._index}get readOnly(){return this._readOnly}set readOnly(e){this._readOnly=e}get key(){return this._key}set key(e){this._key=e}constructor(e=4,r=6,i=!1,n=void 0){this._columns=e,this._colspan=r,this._rows=[[]],this._index=0,this._readOnly=i,this._key=n}freePosition(){const e=this._rows[this._index].filter(r=>!r.invisible).reduce((r,i)=>r+i.colspan,0);return this._columns-e}addWidget(e,r){const i=[],n=r?r.addLabel:!0;if(e instanceof yt){this._rows.push([]),this._index++;return}if(e.colspan>this._columns&&(e.colspan=this._columns),e.readOnly=e.readOnly||this.readOnly,n&&e instanceof W&&!e.nolabel){e.colspan>1&&(e.colspan-=1);const a=new wt({name:e.id+"_label",string:e.label,invisible:e.invisible,help:e.tooltip,fieldForLabel:e.id,key:e.key+"-label"});a.type="label",i.push(a),i.push(e)}else i.push(e);i.reduce((a,u)=>a+u.colspan,0)>this.freePosition()&&(this._rows.push([]),this._index++),this._rows[this._index]=this._rows[this._index].concat(i)}findById(e){let r=null;return this._rows&&this._rows.length&&this._rows.forEach(i=>{r||i&&i.length&&i.forEach(n=>{r||n&&(r=n.findById(e))})}),r}}const je=class extends he{constructor(t){super(t),this._id="",this._mustExpand=!1,this._label="",this._container=new Oe(t&&t.col,je._defaultColspan,this.readOnly,t&&t.key),t&&(t.name&&(this._id=t.name),t.colspan?this._container.colspan=+t.colspan:this._mustExpand=!0,t.string&&(this._label=G(t.string)))}get id(){return this._id}set id(t){this._id=t}static get defaultColspan(){return je._defaultColspan}static set defaultColspan(t){je._defaultColspan=t}get container(){return this._container}set container(t){this._container=t}get colspan(){return this._container.colspan}set colspan(t){this._container.colspan=+t}get mustExpand(){return this._mustExpand}set mustExpand(t){this._mustExpand=t}get label(){return this._label}set label(t){this._label=t}findById(t){return t===this.id?this:this.container.findById(t)}};let de=je;de._defaultColspan=6;const Ye=class extends de{constructor(t){super(t),this._tabPosition="top",this._pages=[],this.colspan=Ye._defaultColspan,t&&(t.colspan&&(this.colspan=t.colspan),t.tabpos&&(this._tabPosition=t.tabpos))}static get defaultColspan(){return Ye._defaultColspan}static set defaultColspan(t){Ye._defaultColspan=t}get tabPosition(){return this._tabPosition}set tabPosition(t){this._tabPosition=t}get pages(){return[].concat.apply([],this._container.rows)}};let bt=Ye;bt._defaultColspan=3;class hr extends de{constructor(e){super(e),this._icon=null,e.icon&&(this._icon=e.icon)}get icon(){return this._icon}set icon(e){this._icon=e}}class dr extends de{constructor(e){super(e)}}class gr extends W{constructor(e){if(super({...e,nolabel:(e==null?void 0:e.nolabel)!==void 0?e.nolabel:!0}),this._buttonType="workflow",this._caption="",this._confirmMessage="",this._primary=!1,this._danger=!1,e){if(e.string&&(this._caption=G(e.string)),e.buttonType&&(this._buttonType=e.buttonType),e.confirm&&(this._confirmMessage=G(e.confirm)),e.special&&e.special==="cancel"&&(this._buttonType="cancel"),e.icon&&(this._icon=e.icon),e.primary){const r=e.primary;(r==="1"||r===1||r===!0)&&(this._primary=!0)}if(e.danger){const r=e.danger;(r==="1"||r===1||r===!0)&&(this._danger=!0)}}}get buttonType(){return this._buttonType}set buttonType(e){this._buttonType=e}get caption(){return this._caption}set caption(e){this._caption=e}get icon(){return this._icon}set icon(e){this._icon=e}get confirmMessage(){return this._confirmMessage}set confirm(e){this._confirmMessage=e}get primary(){return this._primary}set primary(e){this._primary=e}get danger(){return this._danger}set danger(e){this._danger=e}}class _r extends de{constructor(e){super(e),this._defaultName="",e.default&&(this._defaultName=e.default)}get defaultName(){return this._defaultName}get defaultButton(){return this.buttons.find(e=>e.id===this.defaultName)}get secondaryButtons(){return this.buttons.filter(e=>e.id!==this.defaultName)}get buttons(){return this._container.rows[0]}}class ze extends W{constructor(e){super(e),this._placeholder="",this._isPassword=!1,this._translatable=!1,e&&(e.size&&(this._size=e.size),e.password&&(this.isPassword=e.password==="True"),e.translate&&(this.translatable=e.translate==="True"||e.translate===!0))}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e}get size(){return this._size}set size(e){this._size=e}get isPassword(){return this._isPassword}set isPassword(e){this._isPassword=e}get translatable(){return this._translatable}set translatable(e){this._translatable=e}}class mt extends W{constructor(e){if(super(e),this._placeholder="",this._mustExpand=!1,this._translatable=!1,e){if(e.placeholder&&(this._placeholder=G(e.placeholder)),e.colspan||(this._mustExpand=!0),e.height)try{this._height=parseInt(e.height)}catch{this._height=void 0}e.translate&&(this.translatable=e.translate==="True"||e.translate===!0)}}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e}get mustExpand(){return this._mustExpand}set mustExpand(e){this._mustExpand=e}get height(){return this._height}set height(e){this._height=e}get translatable(){return this._translatable}set translatable(e){this._translatable=e}}class ve extends W{constructor(e){super(e),this._size=150,e&&e.size&&(this._size=e.size)}get size(){return this._size}set size(e){this._size=e}}class pr extends W{constructor(e){super(e),this._size=150,this._relation="",e&&(e.size&&(this._size=e.size),e.relation&&(this._relation=e.relation))}get size(){return this._size}set size(e){this._size=e}get relation(){return this._relation}set relation(e){this._relation=e}}class vt extends W{constructor(e){super(e)}}class yr extends W{constructor(e){super(e)}}class qe extends W{constructor(e){if(super(e),this._integerDigits=16,this._decimalDigits=2,e!=null&&e.digits){const[r,i]=e.digits;this._integerDigits=r,this._decimalDigits=i}}get integerDigits(){return this._integerDigits}set integerDigits(e){this._integerDigits=e}get decimalDigits(){return this._decimalDigits}set decimalDigits(e){this._decimalDigits=e}}class wr extends qe{}class br extends qe{}class mr extends W{constructor(e){super(e)}}class vr extends W{constructor(e){super(e)}}class Er extends W{constructor(e){super(e),this._size=150,this._relation="",this._mustExpand=!1,e&&(e.size&&(this._size=e.size),e.relation&&(this._relation=e.relation),e.colspan||(this._mustExpand=!0))}get size(){return this._size}set size(e){this._size=e}get relation(){return this._relation}set relation(e){this._relation=e}get mustExpand(){return this._mustExpand}set mustExpand(e){this._mustExpand=e}}class Et extends W{constructor(e){super(e),this._size=150,this._relation="",this._views=null,this._mode=[],this._mustExpand=!1,e&&(e.size&&(this._size=e.size),e.relation&&(this._relation=e.relation),e.mode&&(this._mode=e.mode.split(",")),e.views&&(this._views=e.views),e.colspan?this.colspan=e.colspan:this._mustExpand=!0,e.inv_field&&(this._inv_field=e.inv_field))}get size(){return this._size}set size(e){this._size=e}get relation(){return this._relation}set relation(e){this._relation=e}get inv_field(){return this._inv_field}set inv_field(e){this._inv_field=e}get views(){return this._views}set views(e){this._views=e}get mode(){return this._mode}set mode(e){this._mode=e}get mustExpand(){return this._mustExpand}set mustExpand(e){this._mustExpand=e}}class xr extends he{constructor(e){super(e),this._label="",this._icon=null,e&&(e.string&&(this._label=G(e.string)),e.icon&&(this._icon=e.icon))}get label(){return this._label}set label(e){this._label=e}get icon(){return this._icon}set icon(e){this._icon=e}findById(e){return null}}class Rr extends ve{}class Tr extends W{constructor(e){super(e),this._filenameField="",e&&e.filename&&(this._filenameField=e.filename)}get filenameField(){return this._filenameField}set filenameField(e){this._filenameField=e}}class Sr extends W{}class on extends W{constructor(e){super(e)}}class Cr extends Et{constructor(e){super(e),this._titleField="",this._summaryField="",this._parsedWidgetProps&&(this._titleField=this._parsedWidgetProps.titleField,this._summaryField=this.parsedWidgetProps.summaryField)}get titleField(){return this._titleField}set titleField(e){this._titleField=e}get summaryField(){return this._summaryField}set summaryField(e){this._summaryField=e}get iconField(){return this.parsedWidgetProps.iconField}get colorField(){return this.parsedWidgetProps.colorField}}class Ar extends ve{constructor(e){super(e),this._nolabel=!0,this._card=!1,this._icon="",this._suffix="",this._parsedWidgetProps&&(this._card=this._parsedWidgetProps.card||!1,this._icon=this._parsedWidgetProps.icon||"",this._suffix=this._parsedWidgetProps.suffix||"")}get card(){return this._card}set card(e){this._card=e}get icon(){return this._icon}set icon(e){this._icon=e}get suffix(){return this._suffix}set suffix(e){this._suffix=e}}class xt extends W{constructor(e){super(e),this._size=150,this._relation="",this._field="name",this._columns=4,e&&(e.size&&(this._size=e.size),e.relation&&(this._relation=e.relation),e.inv_field&&(this._inv_field=e.inv_field),this.parsedWidgetProps.hasOwnProperty("field")&&(this._field=this.parsedWidgetProps.field),this.parsedWidgetProps.columns&&(this._columns=this.parsedWidgetProps.columns))}get size(){return this._size}set size(e){this._size=e}get relation(){return this._relation}set relation(e){this._relation=e}get inv_field(){return this._inv_field}set inv_field(e){this._inv_field=e}get field(){return this._field}set field(e){this._field=e}get columns(){return this._columns}set columns(e){this._columns=e}}class Fr extends xt{}class Dr extends ve{get colors(){return this._parsedWidgetProps.colors||{}}}class Mr extends ve{constructor(e){super(e),this._direction="horizontal",e&&this.parsedWidgetProps.hasOwnProperty("direction")&&(this._direction=this.parsedWidgetProps.direction)}get direction(){return this._direction}set direction(e){this._direction=e}}class Or extends vt{}class kr extends W{constructor(e){super(e),this._relation="",this._errorField=null,e&&(e.relation&&(this._relation=e.relation),this.parsedWidgetProps.hasOwnProperty("error_field")&&(this._errorField=this.parsedWidgetProps.error_field))}get relation(){return this._relation}set relation(e){this._relation=e}get errorField(){return this._errorField}set errorField(e){this._errorField=e}}class Pr extends mt{constructor(e){super(e),this._lang=null,e&&this.parsedWidgetProps.lang&&(this._lang=this.parsedWidgetProps.lang)}get lang(){return this._lang}set lang(e){this._lang=e}}class Rt{setWidgetClass(e){switch(e){case"notebook":this._widgetClass=bt;break;case"page":this._widgetClass=hr;break;case"group":this._widgetClass=dr;break;case"label":this._widgetClass=wt;break;case"char":this._widgetClass=ze;break;case"text":this._widgetClass=mt;break;case"button":this._widgetClass=gr;break;case"buttonGroup":this._widgetClass=_r;break;case"selection":this._widgetClass=ve;break;case"many2one":this._widgetClass=pr;break;case"boolean":this._widgetClass=vt;break;case"integer":this._widgetClass=yr;break;case"float":this._widgetClass=qe;break;case"float_time":this._widgetClass=wr;break;case"date":this._widgetClass=mr;break;case"datetime":this._widgetClass=vr;break;case"progressbar":this._widgetClass=br;break;case"many2many":this._widgetClass=Er;break;case"one2many":case"one2many_list":this._widgetClass=Et;break;case"newline":this._widgetClass=yt;break;case"separator":this._widgetClass=xr;break;case"url":this._widgetClass=ze;break;case"email":this._widgetClass=ze;break;case"reference":this._widgetClass=Rr;break;case"binary":this._widgetClass=Tr;break;case"image":this._widgetClass=Sr;break;case"fiber_grid":this._widgetClass=on;break;case"timeline":this._widgetClass=Cr;break;case"indicator":this._widgetClass=Ar;break;case"tags":this._widgetClass=Fr;break;case"tag":this._widgetClass=Dr;break;case"radio":this._widgetClass=Mr;break;case"multicheckbox":this._widgetClass=xt;break;case"switch":this._widgetClass=Or;break;case"steps":this._widgetClass=kr;break;case"codeeditor":this._widgetClass=Pr;break}}createWidget(e,r){let i=e;switch(this.setWidgetClass(e),this._widgetClass===void 0&&(i=r.fieldsWidgetType,this.setWidgetClass(r.fieldsWidgetType)),this._widgetClass===void 0&&(this._widgetClass=he),e){case"notebook":case"page":case"group":return new this._widgetClass({...r,type:i});case"button":return new this._widgetClass({...r,type:e,buttonType:r.type});default:return new this._widgetClass({...r,type:i})}}}const ln=({fieldName:t,values:e,fields:r})=>{var i;if(!t)return{};const n=(i=r[t])==null?void 0:i.states;if(!n)return{};const s={},a={};for(const u of Object.keys(n))if(e.state===u){const f=n[u];for(const _ of f){const[b,w]=_;a[b]||(a[b]=[]),a[b].push(w)}}for(const u of Object.keys(a)){const f=a[u];s[u]=f.some(_=>_===!0)}return s},un=({states:t,values:e})=>{if(!(e!=null&&e.state))return{};const r=t.split(",");return r.length===0?{}:r.includes(e.state)?{}:{invisible:!0}};function fn({values:t={},fieldName:e,fields:r={}}){var i;const n=((i=r[e])==null?void 0:i.type)||"passthrough";return n==="many2one"?t[e]?t[e][0]||null:!1:n==="one2many"||n==="many2many"?t[e].map(s=>s.id):t!=null&&t[e]?t==null?void 0:t[e]:e.indexOf("'")!==-1?e:parseInt(e)}const Nr=({context:t,values:e,fields:r})=>{try{if(!t||t.trim().length===0)return;var i=t.replace(/\"/g,"'").replace(/\s/g,"").replace(/True/g,"true"),n=i.replace(/False/g,"false");const b=n.replace(/\{/g,"").replace(/\}/g,"").split(",").map(g=>g.split(":")),w={};return b.forEach(g=>{const E=g[1];if(g[1].indexOf("'")===-1&&g[1]!=="true"&&g[1]!=="false"){const v=fn({values:e,fields:r,fieldName:E==="active_id"?"id":E});w[g[0].replace(/'/g,"")]=v||void 0}else g[1]==="true"?w[g[0].replace(/'/g,"")]=!0:g[1]==="false"?w[g[0].replace(/'/g,"")]=!1:w[g[0].replace(/'/g,"")]=g[1].replace(/'/g,"")}),w}catch{return}},cn=t=>{const e=t.trim().replace(")","").split("("),r=e[0],n=e[1].split(",").map(s=>s.trim());return{method:r,args:n}};function $e(t,e){e=e||{};var r=e.pos||0,i=!!e.keepComments,n=!!e.keepWhitespace,s="<",a="<".charCodeAt(0),u=">",f=">".charCodeAt(0),_="-".charCodeAt(0),b="/".charCodeAt(0),w="!".charCodeAt(0),g="'".charCodeAt(0),E='"'.charCodeAt(0),v="[".charCodeAt(0),T="]".charCodeAt(0);function D(F){for(var L=[];t[r];)if(t.charCodeAt(r)==a){if(t.charCodeAt(r+1)===b){var V=r+2;r=t.indexOf(u,r);var ne=t.substring(V,r);if(ne.indexOf(F)==-1){var K=t.substring(0,r).split(`
1
+ (function(C,De){typeof exports=="object"&&typeof module<"u"?De(exports,require("html-entities"),require("moment")):typeof define=="function"&&define.amd?define(["exports","html-entities","moment"],De):(C=typeof globalThis<"u"?globalThis:C||self,De(C.ooui={},C.htmlEntities,C.moment))})(this,function(C,De,rn){"use strict";const Me=(t=>t&&typeof t=="object"&&"default"in t?t:{default:t})(rn),We=class{constructor(t){if(this._type="",this._parsedWidgetProps={},this._colspan=We._defaultColspan,this._readOnly=!1,this._invisible=!1,t){if(t.colspan&&(this._colspan=+t.colspan),t.readonly&&(t.readonly==="1"||t.readonly===1||t.readonly===!0)&&(this._readOnly=!0),t.invisible&&(t.invisible===1||t.invisible==="1"||t.invisible===!0)&&(this._invisible=!0),t.type&&(this._type=t.type),t.context&&(this._context=t.context),t.domain&&(typeof t.domain!="string"?this._domain=JSON.stringify(t.domain):this._domain=t.domain),t.widget_props)try{this._parsedWidgetProps=JSON.parse(t.widget_props.replace(/'/g,'"'))}catch{throw new Error("Error parsing widget_props")}t.key&&(this._key=t.key)}}static get defaultColspan(){return We._defaultColspan}static set defaultColspan(t){We._defaultColspan=t}get readOnly(){return this._readOnly}set readOnly(t){this._readOnly=t}get colspan(){return this._colspan}set colspan(t){this._colspan=+t}get invisible(){return this._invisible}set invisible(t){this._invisible=t}get type(){return this._type}set type(t){this._type=t}get context(){return this._context}set context(t){this._context=t}get domain(){return this._domain}set domain(t){this._domain=t}get key(){return this._key}set key(t){this._key=t}get parsedWidgetProps(){return this._parsedWidgetProps}set parsedWidgetProps(t){this._parsedWidgetProps=t}};let he=We;he._defaultColspan=1;const nn=({entry:t,values:e,fields:r})=>{const[i,n,s]=t;if(r[i]===void 0||e[i]===void 0&&r[i].type!=="boolean"&&r[i].type!=="many2one")return!1;let a=s,u=r[i].type==="boolean"?!!e[i]:e[i];switch(r[i].type==="many2one"&&s===!1&&e[i]===void 0?a=void 0:(u=u===void 0?!1:u,u=u===null?!1:u),r[i].type==="many2one"&&Array.isArray(u)&&u[0]===void 0&&(u=!1),r[i].type==="boolean"&&(s===0||s===1)&&(a=s!==0),n.toLowerCase()){case"=":case"==":return u==a;case"<>":case"!=":return u!=a;case">":return u>a;case">=":return u>=a;case"<":return u<a;case"<=":return u<=a;case"in":return a.includes(u);case"not in":return!a.includes(u);default:return!1}},G=t=>De.decode(t,{level:"xml"}),an=({attrs:t,values:e,fields:r})=>{const u=t.replace(/\(/g,"[").replace(/\)/g,"]").replace(/\'/g,'"').replace(/True/g,"true").replace(/False/g,"false"),f=G(u),g=JSON.parse(f),b={};for(const w of Object.keys(g))g[w].map(T=>nn({entry:T,values:e,fields:r})).every(T=>T===!0)&&(b[w]=!0);return b},sn=({tagAttributes:t,values:e,fields:r})=>{const i=t.attrs?an({attrs:t.attrs,values:e,fields:r}):{};return{...t,...i,attrs:void 0}};class W extends he{constructor(e){super(e),this._id="",this._label="",this._nolabel=!1,this._required=!1,this._activated=!0,this._selectionValues=new Map([]),this._activated=!0,e&&(e.name&&(this._id=e.name),e.activated&&(this._activated=e.activated),e.string&&(this._label=G(e.string)),e.help&&(this._tooltip=G(e.help)),e.nolabel&&(e.nolabel==="1"||typeof e.nolabel=="boolean"&&e.nolabel===!0)&&(this._nolabel=!0),e.required&&(e.required==="1"||e.required===!0||e.required==="True")&&(this._required=!0),e.sum&&(this._sum=e.sum),e.selection&&(this._selectionValues=new Map(e.selection)))}get id(){return this._id}set id(e){this._id=e}get label(){return this._label}set label(e){this._label=e}get nolabel(){return this._nolabel}set nolabel(e){this._nolabel=e}get required(){return this._required}set required(e){this._required=e}get tooltip(){return this._tooltip}set tooltip(e){this._tooltip=e}get activated(){return this._activated}set activated(e){this._activated=e}get sum(){return this._sum}set sum(e){this._sum=e}get selectionValues(){return this._selectionValues}set selectionValues(e){this._selectionValues=e}findById(e){let r=null;return this._id===e&&(r=this),r}}class yt extends he{findById(e){return null}}class wt extends W{constructor(e){super({...e,nolabel:!0}),this._text="",this._align="left",this._labelType="default",this._labelSize="text",this._fieldForLabel=null,e!=null&&e.fieldForLabel&&(this._fieldForLabel=e.fieldForLabel),e.widget_props&&(this.parsedWidgetProps.label_type&&(this.labelType=this.parsedWidgetProps.label_type),this.parsedWidgetProps.label_size&&(this.labelSize=this.parsedWidgetProps.label_size))}get text(){return this._text}set text(e){this._text=e}get align(){return this._align}set align(e){this._align=e}get labelType(){return this._labelType}set labelType(e){this._labelType=e}get labelSize(){return this._labelSize}set labelSize(e){this._labelSize=e}get fieldForLabel(){return this._fieldForLabel}set fieldForLabel(e){this._fieldForLabel=e}}class Oe{get columns(){return this._columns}set columns(e){this._columns=e}get colspan(){return this._colspan}set colspan(e){this._colspan=e}get rows(){return this._rows}set rows(e){this._rows=e}get index(){return this._index}get readOnly(){return this._readOnly}set readOnly(e){this._readOnly=e}get key(){return this._key}set key(e){this._key=e}constructor(e=4,r=6,i=!1,n=void 0){this._columns=e,this._colspan=r,this._rows=[[]],this._index=0,this._readOnly=i,this._key=n}freePosition(){const e=this._rows[this._index].filter(r=>!r.invisible).reduce((r,i)=>r+i.colspan,0);return this._columns-e}addWidget(e,r){const i=[],n=r?r.addLabel:!0;if(e instanceof yt){this._rows.push([]),this._index++;return}if(e.colspan>this._columns&&(e.colspan=this._columns),e.readOnly=e.readOnly||this.readOnly,n&&e instanceof W&&!e.nolabel){e.colspan>1&&(e.colspan-=1);const a=new wt({name:e.id+"_label",string:e.label,invisible:e.invisible,help:e.tooltip,fieldForLabel:e.id,key:e.key+"-label"});a.type="label",i.push(a),i.push(e)}else i.push(e);i.reduce((a,u)=>a+u.colspan,0)>this.freePosition()&&(this._rows.push([]),this._index++),this._rows[this._index]=this._rows[this._index].concat(i)}findById(e){let r=null;return this._rows&&this._rows.length&&this._rows.forEach(i=>{r||i&&i.length&&i.forEach(n=>{r||n&&(r=n.findById(e))})}),r}}const je=class extends he{constructor(t){super(t),this._id="",this._mustExpand=!1,this._label="",this._container=new Oe(t&&t.col,je._defaultColspan,this.readOnly,t&&t.key),t&&(t.name&&(this._id=t.name),t.colspan?this._container.colspan=+t.colspan:this._mustExpand=!0,t.string&&(this._label=G(t.string)))}get id(){return this._id}set id(t){this._id=t}static get defaultColspan(){return je._defaultColspan}static set defaultColspan(t){je._defaultColspan=t}get container(){return this._container}set container(t){this._container=t}get colspan(){return this._container.colspan}set colspan(t){this._container.colspan=+t}get mustExpand(){return this._mustExpand}set mustExpand(t){this._mustExpand=t}get label(){return this._label}set label(t){this._label=t}findById(t){return t===this.id?this:this.container.findById(t)}};let de=je;de._defaultColspan=6;const Ye=class extends de{constructor(t){super(t),this._tabPosition="top",this._pages=[],this.colspan=Ye._defaultColspan,t&&(t.colspan&&(this.colspan=t.colspan),t.tabpos&&(this._tabPosition=t.tabpos))}static get defaultColspan(){return Ye._defaultColspan}static set defaultColspan(t){Ye._defaultColspan=t}get tabPosition(){return this._tabPosition}set tabPosition(t){this._tabPosition=t}get pages(){return[].concat.apply([],this._container.rows)}};let bt=Ye;bt._defaultColspan=3;class hr extends de{constructor(e){super(e),this._icon=null,e.icon&&(this._icon=e.icon)}get icon(){return this._icon}set icon(e){this._icon=e}}class dr extends de{constructor(e){super(e),this._icon=null,e&&e.icon&&(this._icon=e.icon)}get icon(){return this._icon}set icon(e){this._icon=e}}class _r extends W{constructor(e){if(super({...e,nolabel:(e==null?void 0:e.nolabel)!==void 0?e.nolabel:!0}),this._buttonType="workflow",this._caption="",this._confirmMessage="",this._primary=!1,this._danger=!1,e){if(e.string&&(this._caption=G(e.string)),e.buttonType&&(this._buttonType=e.buttonType),e.confirm&&(this._confirmMessage=G(e.confirm)),e.special&&e.special==="cancel"&&(this._buttonType="cancel"),e.icon&&(this._icon=e.icon),e.primary){const r=e.primary;(r==="1"||r===1||r===!0)&&(this._primary=!0)}if(e.danger){const r=e.danger;(r==="1"||r===1||r===!0)&&(this._danger=!0)}}}get buttonType(){return this._buttonType}set buttonType(e){this._buttonType=e}get caption(){return this._caption}set caption(e){this._caption=e}get icon(){return this._icon}set icon(e){this._icon=e}get confirmMessage(){return this._confirmMessage}set confirm(e){this._confirmMessage=e}get primary(){return this._primary}set primary(e){this._primary=e}get danger(){return this._danger}set danger(e){this._danger=e}}class gr extends de{constructor(e){super(e),this._defaultName="",e.default&&(this._defaultName=e.default)}get defaultName(){return this._defaultName}get defaultButton(){return this.buttons.find(e=>e.id===this.defaultName)}get secondaryButtons(){return this.buttons.filter(e=>e.id!==this.defaultName)}get buttons(){return this._container.rows[0]}}class ze extends W{constructor(e){super(e),this._placeholder="",this._isPassword=!1,this._translatable=!1,e&&(e.size&&(this._size=e.size),e.password&&(this.isPassword=e.password==="True"),e.translate&&(this.translatable=e.translate==="True"||e.translate===!0))}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e}get size(){return this._size}set size(e){this._size=e}get isPassword(){return this._isPassword}set isPassword(e){this._isPassword=e}get translatable(){return this._translatable}set translatable(e){this._translatable=e}}class mt extends W{constructor(e){if(super(e),this._placeholder="",this._mustExpand=!1,this._translatable=!1,e){if(e.placeholder&&(this._placeholder=G(e.placeholder)),e.colspan||(this._mustExpand=!0),e.height)try{this._height=parseInt(e.height)}catch{this._height=void 0}e.translate&&(this.translatable=e.translate==="True"||e.translate===!0)}}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e}get mustExpand(){return this._mustExpand}set mustExpand(e){this._mustExpand=e}get height(){return this._height}set height(e){this._height=e}get translatable(){return this._translatable}set translatable(e){this._translatable=e}}class ve extends W{constructor(e){super(e),this._size=150,e&&e.size&&(this._size=e.size)}get size(){return this._size}set size(e){this._size=e}}class pr extends W{constructor(e){super(e),this._size=150,this._relation="",e&&(e.size&&(this._size=e.size),e.relation&&(this._relation=e.relation))}get size(){return this._size}set size(e){this._size=e}get relation(){return this._relation}set relation(e){this._relation=e}}class vt extends W{constructor(e){super(e)}}class yr extends W{constructor(e){super(e)}}class qe extends W{constructor(e){if(super(e),this._integerDigits=16,this._decimalDigits=2,e!=null&&e.digits){const[r,i]=e.digits;this._integerDigits=r,this._decimalDigits=i}}get integerDigits(){return this._integerDigits}set integerDigits(e){this._integerDigits=e}get decimalDigits(){return this._decimalDigits}set decimalDigits(e){this._decimalDigits=e}}class wr extends qe{}class br extends qe{}class mr extends W{constructor(e){super(e)}}class vr extends W{constructor(e){super(e)}}class Er extends W{constructor(e){super(e),this._size=150,this._relation="",this._mustExpand=!1,e&&(e.size&&(this._size=e.size),e.relation&&(this._relation=e.relation),e.colspan||(this._mustExpand=!0))}get size(){return this._size}set size(e){this._size=e}get relation(){return this._relation}set relation(e){this._relation=e}get mustExpand(){return this._mustExpand}set mustExpand(e){this._mustExpand=e}}class Et extends W{constructor(e){super(e),this._size=150,this._relation="",this._views=null,this._mode=[],this._mustExpand=!1,e&&(e.size&&(this._size=e.size),e.relation&&(this._relation=e.relation),e.mode&&(this._mode=e.mode.split(",")),e.views&&(this._views=e.views),e.colspan?this.colspan=e.colspan:this._mustExpand=!0,e.inv_field&&(this._inv_field=e.inv_field))}get size(){return this._size}set size(e){this._size=e}get relation(){return this._relation}set relation(e){this._relation=e}get inv_field(){return this._inv_field}set inv_field(e){this._inv_field=e}get views(){return this._views}set views(e){this._views=e}get mode(){return this._mode}set mode(e){this._mode=e}get mustExpand(){return this._mustExpand}set mustExpand(e){this._mustExpand=e}}class xr extends he{constructor(e){super(e),this._label="",this._icon=null,e&&(e.string&&(this._label=G(e.string)),e.icon&&(this._icon=e.icon))}get label(){return this._label}set label(e){this._label=e}get icon(){return this._icon}set icon(e){this._icon=e}findById(e){return null}}class Rr extends ve{}class Tr extends W{constructor(e){super(e),this._filenameField="",e&&e.filename&&(this._filenameField=e.filename)}get filenameField(){return this._filenameField}set filenameField(e){this._filenameField=e}}class Sr extends W{}class on extends W{constructor(e){super(e)}}class Cr extends Et{constructor(e){super(e),this._titleField="",this._summaryField="",this._parsedWidgetProps&&(this._titleField=this._parsedWidgetProps.titleField,this._summaryField=this.parsedWidgetProps.summaryField)}get titleField(){return this._titleField}set titleField(e){this._titleField=e}get summaryField(){return this._summaryField}set summaryField(e){this._summaryField=e}}class Ar extends ve{constructor(e){super(e),this._nolabel=!0,this._card=!1,this._icon="",this._suffix="",this._parsedWidgetProps&&(this._card=this._parsedWidgetProps.card||!1,this._icon=this._parsedWidgetProps.icon||"",this._suffix=this._parsedWidgetProps.suffix||"")}get card(){return this._card}set card(e){this._card=e}get icon(){return this._icon}set icon(e){this._icon=e}get suffix(){return this._suffix}set suffix(e){this._suffix=e}}class xt extends W{constructor(e){super(e),this._size=150,this._relation="",this._field="name",this._columns=4,e&&(e.size&&(this._size=e.size),e.relation&&(this._relation=e.relation),e.inv_field&&(this._inv_field=e.inv_field),this.parsedWidgetProps.hasOwnProperty("field")&&(this._field=this.parsedWidgetProps.field),this.parsedWidgetProps.columns&&(this._columns=this.parsedWidgetProps.columns))}get size(){return this._size}set size(e){this._size=e}get relation(){return this._relation}set relation(e){this._relation=e}get inv_field(){return this._inv_field}set inv_field(e){this._inv_field=e}get field(){return this._field}set field(e){this._field=e}get columns(){return this._columns}set columns(e){this._columns=e}}class Fr extends xt{}class Dr extends ve{get colors(){return this._parsedWidgetProps.colors||{}}}class Mr extends ve{constructor(e){super(e),this._direction="horizontal",e&&this.parsedWidgetProps.hasOwnProperty("direction")&&(this._direction=this.parsedWidgetProps.direction)}get direction(){return this._direction}set direction(e){this._direction=e}}class Or extends vt{}class kr extends W{constructor(e){super(e),this._relation="",this._errorField=null,e&&(e.relation&&(this._relation=e.relation),this.parsedWidgetProps.hasOwnProperty("error_field")&&(this._errorField=this.parsedWidgetProps.error_field))}get relation(){return this._relation}set relation(e){this._relation=e}get errorField(){return this._errorField}set errorField(e){this._errorField=e}}class Pr extends mt{constructor(e){super(e),this._lang=null,e&&this.parsedWidgetProps.lang&&(this._lang=this.parsedWidgetProps.lang)}get lang(){return this._lang}set lang(e){this._lang=e}}class Rt{setWidgetClass(e){switch(e){case"notebook":this._widgetClass=bt;break;case"page":this._widgetClass=hr;break;case"group":this._widgetClass=dr;break;case"label":this._widgetClass=wt;break;case"char":this._widgetClass=ze;break;case"text":this._widgetClass=mt;break;case"button":this._widgetClass=_r;break;case"buttonGroup":this._widgetClass=gr;break;case"selection":this._widgetClass=ve;break;case"many2one":this._widgetClass=pr;break;case"boolean":this._widgetClass=vt;break;case"integer":this._widgetClass=yr;break;case"float":this._widgetClass=qe;break;case"float_time":this._widgetClass=wr;break;case"date":this._widgetClass=mr;break;case"datetime":this._widgetClass=vr;break;case"progressbar":this._widgetClass=br;break;case"many2many":this._widgetClass=Er;break;case"one2many":case"one2many_list":this._widgetClass=Et;break;case"newline":this._widgetClass=yt;break;case"separator":this._widgetClass=xr;break;case"url":this._widgetClass=ze;break;case"email":this._widgetClass=ze;break;case"reference":this._widgetClass=Rr;break;case"binary":this._widgetClass=Tr;break;case"image":this._widgetClass=Sr;break;case"fiber_grid":this._widgetClass=on;break;case"timeline":this._widgetClass=Cr;break;case"indicator":this._widgetClass=Ar;break;case"tags":this._widgetClass=Fr;break;case"tag":this._widgetClass=Dr;break;case"radio":this._widgetClass=Mr;break;case"multicheckbox":this._widgetClass=xt;break;case"switch":this._widgetClass=Or;break;case"steps":this._widgetClass=kr;break;case"codeeditor":this._widgetClass=Pr;break}}createWidget(e,r){let i=e;switch(this.setWidgetClass(e),this._widgetClass===void 0&&(i=r.fieldsWidgetType,this.setWidgetClass(r.fieldsWidgetType)),this._widgetClass===void 0&&(this._widgetClass=he),e){case"notebook":case"page":case"group":return new this._widgetClass({...r,type:i});case"button":return new this._widgetClass({...r,type:e,buttonType:r.type});default:return new this._widgetClass({...r,type:i})}}}const ln=({fieldName:t,values:e,fields:r})=>{var i;if(!t)return{};const n=(i=r[t])==null?void 0:i.states;if(!n)return{};const s={},a={};for(const u of Object.keys(n))if(e.state===u){const f=n[u];for(const g of f){const[b,w]=g;a[b]||(a[b]=[]),a[b].push(w)}}for(const u of Object.keys(a)){const f=a[u];s[u]=f.some(g=>g===!0)}return s},un=({states:t,values:e})=>{if(!(e!=null&&e.state))return{};const r=t.split(",");return r.length===0?{}:r.includes(e.state)?{}:{invisible:!0}};function fn({values:t={},fieldName:e,fields:r={}}){var i;const n=((i=r[e])==null?void 0:i.type)||"passthrough";return n==="many2one"?t[e]?t[e][0]||null:!1:n==="one2many"||n==="many2many"?t[e].map(s=>s.id):t!=null&&t[e]?t==null?void 0:t[e]:e.indexOf("'")!==-1?e:parseInt(e)}const Nr=({context:t,values:e,fields:r})=>{try{if(!t||t.trim().length===0)return;var i=t.replace(/\"/g,"'").replace(/\s/g,"").replace(/True/g,"true"),n=i.replace(/False/g,"false");const b=n.replace(/\{/g,"").replace(/\}/g,"").split(",").map(_=>_.split(":")),w={};return b.forEach(_=>{const E=_[1];if(_[1].indexOf("'")===-1&&_[1]!=="true"&&_[1]!=="false"){const v=fn({values:e,fields:r,fieldName:E==="active_id"?"id":E});w[_[0].replace(/'/g,"")]=v||void 0}else _[1]==="true"?w[_[0].replace(/'/g,"")]=!0:_[1]==="false"?w[_[0].replace(/'/g,"")]=!1:w[_[0].replace(/'/g,"")]=_[1].replace(/'/g,"")}),w}catch{return}},cn=t=>{const e=t.trim().replace(")","").split("("),r=e[0],n=e[1].split(",").map(s=>s.trim());return{method:r,args:n}};function $e(t,e){e=e||{};var r=e.pos||0,i=!!e.keepComments,n=!!e.keepWhitespace,s="<",a="<".charCodeAt(0),u=">",f=">".charCodeAt(0),g="-".charCodeAt(0),b="/".charCodeAt(0),w="!".charCodeAt(0),_="'".charCodeAt(0),E='"'.charCodeAt(0),v="[".charCodeAt(0),T="]".charCodeAt(0);function D(F){for(var L=[];t[r];)if(t.charCodeAt(r)==a){if(t.charCodeAt(r+1)===b){var V=r+2;r=t.indexOf(u,r);var ne=t.substring(V,r);if(ne.indexOf(F)==-1){var K=t.substring(0,r).split(`
2
2
  `);throw new Error(`Unexpected close tag
3
3
  Line: `+(K.length-1)+`
4
4
  Column: `+(K[K.length-1].length+1)+`
5
- Char: `+t[r])}return r+1&&(r+=1),L}else if(t.charCodeAt(r+1)===w){if(t.charCodeAt(r+2)==_){const ae=r;for(;r!==-1&&!(t.charCodeAt(r)===f&&t.charCodeAt(r-1)==_&&t.charCodeAt(r-2)==_&&r!=-1);)r=t.indexOf(u,r+1);r===-1&&(r=t.length),i&&L.push(t.substring(ae,r+1))}else if(t.charCodeAt(r+2)===v&&t.charCodeAt(r+8)===v&&t.substr(r+3,5).toLowerCase()==="cdata"){var Y=t.indexOf("]]>",r);Y==-1?(L.push(t.substr(r+9)),r=t.length):(L.push(t.substring(r+9,Y)),r=Y+3);continue}else{const ae=r+1;r+=2;for(var J=!1;(t.charCodeAt(r)!==f||J===!0)&&t[r];)t.charCodeAt(r)===v?J=!0:J===!0&&t.charCodeAt(r)===T&&(J=!1),r++;L.push(t.substring(ae,r))}r++;continue}var Q=O();L.push(Q),Q.tagName[0]==="?"&&(L.push(...Q.children),Q.children=[])}else{var Z=c();if(n)Z.length>0&&L.push(Z);else{var be=Z.trim();be.length>0&&L.push(be)}r++}return L}function c(){var F=r;return r=t.indexOf(s,r)-1,r===-2&&(r=t.length),t.slice(F,r+1)}var p=`\r
6
- >/= `;function R(){for(var F=r;p.indexOf(t[r])===-1&&t[r];)r++;return t.slice(F,r)}var A=e.noChildNodes||["img","br","input","meta","link","hr"];function O(){r++;const F=R(),L={};let V=[];for(;t.charCodeAt(r)!==f&&t[r];){var ne=t.charCodeAt(r);if(ne>64&&ne<91||ne>96&&ne<123){for(var K=R(),Y=t.charCodeAt(r);Y&&Y!==g&&Y!==E&&!(Y>64&&Y<91||Y>96&&Y<123)&&Y!==f;)r++,Y=t.charCodeAt(r);if(Y===g||Y===E){var J=j();if(r===-1)return{tagName:F,attributes:L,children:V}}else J=null,r--;L[K]=J}r++}if(t.charCodeAt(r-1)!==b)if(F=="script"){var Q=r+1;r=t.indexOf("<\/script>",r),V=[t.slice(Q,r)],r+=9}else if(F=="style"){var Q=r+1;r=t.indexOf("</style>",r),V=[t.slice(Q,r)],r+=8}else A.indexOf(F)===-1?(r++,V=D(F)):r++;else r++;return{tagName:F,attributes:L,children:V}}function j(){var F=t[r],L=r+1;return r=t.indexOf(F,L),t.slice(L,r)}function q(){var F=new RegExp("\\s"+e.attrName+`\\s*=['"]`+e.attrValue+`['"]`).exec(t);return F?F.index:-1}var k=null;if(e.attrValue!==void 0){e.attrName=e.attrName||"id";for(var k=[];(r=q())!==-1;)r=t.lastIndexOf("<",r),r!==-1&&k.push(O()),t=t.substr(r),r=0}else e.parseNode?k=O():k=D("");return e.filter&&(k=Br(k,e.filter)),e.simplify?Ir(Array.isArray(k)?k:[k]):(e.setPos&&(k.pos=r),k)}function Ir(t){var e={};if(!t.length)return"";if(t.length===1&&typeof t[0]=="string")return t[0];t.forEach(function(i){if(typeof i=="object"){e[i.tagName]||(e[i.tagName]=[]);var n=Ir(i.children);e[i.tagName].push(n),Object.keys(i.attributes).length&&typeof n!="string"&&(n._attributes=i.attributes)}});for(var r in e)e[r].length==1&&(e[r]=e[r][0]);return e}function Br(t,e,r=0,i=""){var n=[];return t.forEach(function(s,a){if(typeof s=="object"&&e(s,a,r,i)&&n.push(s),s.children){var u=Br(s.children,e,r+1,(i?i+".":"")+a+"."+s.tagName);n=n.concat(u)}}),n}const Ee=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{};function Lr(){throw new Error("setTimeout has not been defined")}function Ur(){throw new Error("clearTimeout has not been defined")}var ue=Lr,fe=Ur;typeof Ee.setTimeout=="function"&&(ue=setTimeout),typeof Ee.clearTimeout=="function"&&(fe=clearTimeout);function Wr(t){if(ue===setTimeout)return setTimeout(t,0);if((ue===Lr||!ue)&&setTimeout)return ue=setTimeout,setTimeout(t,0);try{return ue(t,0)}catch{try{return ue.call(null,t,0)}catch{return ue.call(this,t,0)}}}function hn(t){if(fe===clearTimeout)return clearTimeout(t);if((fe===Ur||!fe)&&clearTimeout)return fe=clearTimeout,clearTimeout(t);try{return fe(t)}catch{try{return fe.call(null,t)}catch{return fe.call(this,t)}}}var se=[],xe=!1,ge,Ge=-1;function dn(){!xe||!ge||(xe=!1,ge.length?se=ge.concat(se):Ge=-1,se.length&&jr())}function jr(){if(!xe){var t=Wr(dn);xe=!0;for(var e=se.length;e;){for(ge=se,se=[];++Ge<e;)ge&&ge[Ge].run();Ge=-1,e=se.length}ge=null,xe=!1,hn(t)}}function gn(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];se.push(new Yr(t,e)),se.length===1&&!xe&&Wr(jr)}function Yr(t,e){this.fun=t,this.array=e}Yr.prototype.run=function(){this.fun.apply(null,this.array)};var _n="browser",pn="browser",yn=!0,wn={},bn=[],mn="",vn={},En={},xn={};function _e(){}var Rn=_e,Tn=_e,Sn=_e,Cn=_e,An=_e,Fn=_e,Dn=_e;function Mn(t){throw new Error("process.binding is not supported")}function On(){return"/"}function kn(t){throw new Error("process.chdir is not supported")}function Pn(){return 0}var Re=Ee.performance||{},Nn=Re.now||Re.mozNow||Re.msNow||Re.oNow||Re.webkitNow||function(){return new Date().getTime()};function In(t){var e=Nn.call(Re)*.001,r=Math.floor(e),i=Math.floor(e%1*1e9);return t&&(r=r-t[0],i=i-t[1],i<0&&(r--,i+=1e9)),[r,i]}var Bn=new Date;function Ln(){var t=new Date,e=t-Bn;return e/1e3}var I={nextTick:gn,title:_n,browser:yn,env:wn,argv:bn,version:mn,versions:vn,on:Rn,addListener:Tn,once:Sn,off:Cn,removeListener:An,removeAllListeners:Fn,emit:Dn,binding:Mn,cwd:On,chdir:kn,umask:Pn,hrtime:In,platform:pn,release:En,config:xn,uptime:Ln},Ve=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Tt(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(r,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}),r}var St={exports:{}},Ct={exports:{}};const zr=Tt(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var qr=zr.EventEmitter,ee=[],H=[],Un=typeof Uint8Array<"u"?Uint8Array:Array,At=!1;function $r(){At=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,r=t.length;e<r;++e)ee[e]=t[e],H[t.charCodeAt(e)]=e;H["-".charCodeAt(0)]=62,H["_".charCodeAt(0)]=63}function Wn(t){At||$r();var e,r,i,n,s,a,u=t.length;if(u%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s=t[u-2]==="="?2:t[u-1]==="="?1:0,a=new Un(u*3/4-s),i=s>0?u-4:u;var f=0;for(e=0,r=0;e<i;e+=4,r+=3)n=H[t.charCodeAt(e)]<<18|H[t.charCodeAt(e+1)]<<12|H[t.charCodeAt(e+2)]<<6|H[t.charCodeAt(e+3)],a[f++]=n>>16&255,a[f++]=n>>8&255,a[f++]=n&255;return s===2?(n=H[t.charCodeAt(e)]<<2|H[t.charCodeAt(e+1)]>>4,a[f++]=n&255):s===1&&(n=H[t.charCodeAt(e)]<<10|H[t.charCodeAt(e+1)]<<4|H[t.charCodeAt(e+2)]>>2,a[f++]=n>>8&255,a[f++]=n&255),a}function jn(t){return ee[t>>18&63]+ee[t>>12&63]+ee[t>>6&63]+ee[t&63]}function Yn(t,e,r){for(var i,n=[],s=e;s<r;s+=3)i=(t[s]<<16)+(t[s+1]<<8)+t[s+2],n.push(jn(i));return n.join("")}function Gr(t){At||$r();for(var e,r=t.length,i=r%3,n="",s=[],a=16383,u=0,f=r-i;u<f;u+=a)s.push(Yn(t,u,u+a>f?f:u+a));return i===1?(e=t[r-1],n+=ee[e>>2],n+=ee[e<<4&63],n+="=="):i===2&&(e=(t[r-2]<<8)+t[r-1],n+=ee[e>>10],n+=ee[e>>4&63],n+=ee[e<<2&63],n+="="),s.push(n),s.join("")}function He(t,e,r,i,n){var s,a,u=n*8-i-1,f=(1<<u)-1,_=f>>1,b=-7,w=r?n-1:0,g=r?-1:1,E=t[e+w];for(w+=g,s=E&(1<<-b)-1,E>>=-b,b+=u;b>0;s=s*256+t[e+w],w+=g,b-=8);for(a=s&(1<<-b)-1,s>>=-b,b+=i;b>0;a=a*256+t[e+w],w+=g,b-=8);if(s===0)s=1-_;else{if(s===f)return a?NaN:(E?-1:1)*(1/0);a=a+Math.pow(2,i),s=s-_}return(E?-1:1)*a*Math.pow(2,s-i)}function Vr(t,e,r,i,n,s){var a,u,f,_=s*8-n-1,b=(1<<_)-1,w=b>>1,g=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=i?0:s-1,v=i?1:-1,T=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,a=b):(a=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-a))<1&&(a--,f*=2),a+w>=1?e+=g/f:e+=g*Math.pow(2,1-w),e*f>=2&&(a++,f/=2),a+w>=b?(u=0,a=b):a+w>=1?(u=(e*f-1)*Math.pow(2,n),a=a+w):(u=e*Math.pow(2,w-1)*Math.pow(2,n),a=0));n>=8;t[r+E]=u&255,E+=v,u/=256,n-=8);for(a=a<<n|u,_+=n;_>0;t[r+E]=a&255,E+=v,a/=256,_-=8);t[r+E-v]|=T*128}var zn={}.toString,Hr=Array.isArray||function(t){return zn.call(t)=="[object Array]"};/*!
5
+ Char: `+t[r])}return r+1&&(r+=1),L}else if(t.charCodeAt(r+1)===w){if(t.charCodeAt(r+2)==g){const ae=r;for(;r!==-1&&!(t.charCodeAt(r)===f&&t.charCodeAt(r-1)==g&&t.charCodeAt(r-2)==g&&r!=-1);)r=t.indexOf(u,r+1);r===-1&&(r=t.length),i&&L.push(t.substring(ae,r+1))}else if(t.charCodeAt(r+2)===v&&t.charCodeAt(r+8)===v&&t.substr(r+3,5).toLowerCase()==="cdata"){var Y=t.indexOf("]]>",r);Y==-1?(L.push(t.substr(r+9)),r=t.length):(L.push(t.substring(r+9,Y)),r=Y+3);continue}else{const ae=r+1;r+=2;for(var J=!1;(t.charCodeAt(r)!==f||J===!0)&&t[r];)t.charCodeAt(r)===v?J=!0:J===!0&&t.charCodeAt(r)===T&&(J=!1),r++;L.push(t.substring(ae,r))}r++;continue}var Q=O();L.push(Q),Q.tagName[0]==="?"&&(L.push(...Q.children),Q.children=[])}else{var Z=c();if(n)Z.length>0&&L.push(Z);else{var be=Z.trim();be.length>0&&L.push(be)}r++}return L}function c(){var F=r;return r=t.indexOf(s,r)-1,r===-2&&(r=t.length),t.slice(F,r+1)}var p=`\r
6
+ >/= `;function R(){for(var F=r;p.indexOf(t[r])===-1&&t[r];)r++;return t.slice(F,r)}var A=e.noChildNodes||["img","br","input","meta","link","hr"];function O(){r++;const F=R(),L={};let V=[];for(;t.charCodeAt(r)!==f&&t[r];){var ne=t.charCodeAt(r);if(ne>64&&ne<91||ne>96&&ne<123){for(var K=R(),Y=t.charCodeAt(r);Y&&Y!==_&&Y!==E&&!(Y>64&&Y<91||Y>96&&Y<123)&&Y!==f;)r++,Y=t.charCodeAt(r);if(Y===_||Y===E){var J=j();if(r===-1)return{tagName:F,attributes:L,children:V}}else J=null,r--;L[K]=J}r++}if(t.charCodeAt(r-1)!==b)if(F=="script"){var Q=r+1;r=t.indexOf("<\/script>",r),V=[t.slice(Q,r)],r+=9}else if(F=="style"){var Q=r+1;r=t.indexOf("</style>",r),V=[t.slice(Q,r)],r+=8}else A.indexOf(F)===-1?(r++,V=D(F)):r++;else r++;return{tagName:F,attributes:L,children:V}}function j(){var F=t[r],L=r+1;return r=t.indexOf(F,L),t.slice(L,r)}function q(){var F=new RegExp("\\s"+e.attrName+`\\s*=['"]`+e.attrValue+`['"]`).exec(t);return F?F.index:-1}var k=null;if(e.attrValue!==void 0){e.attrName=e.attrName||"id";for(var k=[];(r=q())!==-1;)r=t.lastIndexOf("<",r),r!==-1&&k.push(O()),t=t.substr(r),r=0}else e.parseNode?k=O():k=D("");return e.filter&&(k=Br(k,e.filter)),e.simplify?Ir(Array.isArray(k)?k:[k]):(e.setPos&&(k.pos=r),k)}function Ir(t){var e={};if(!t.length)return"";if(t.length===1&&typeof t[0]=="string")return t[0];t.forEach(function(i){if(typeof i=="object"){e[i.tagName]||(e[i.tagName]=[]);var n=Ir(i.children);e[i.tagName].push(n),Object.keys(i.attributes).length&&typeof n!="string"&&(n._attributes=i.attributes)}});for(var r in e)e[r].length==1&&(e[r]=e[r][0]);return e}function Br(t,e,r=0,i=""){var n=[];return t.forEach(function(s,a){if(typeof s=="object"&&e(s,a,r,i)&&n.push(s),s.children){var u=Br(s.children,e,r+1,(i?i+".":"")+a+"."+s.tagName);n=n.concat(u)}}),n}const Ee=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{};function Lr(){throw new Error("setTimeout has not been defined")}function Ur(){throw new Error("clearTimeout has not been defined")}var ue=Lr,fe=Ur;typeof Ee.setTimeout=="function"&&(ue=setTimeout),typeof Ee.clearTimeout=="function"&&(fe=clearTimeout);function Wr(t){if(ue===setTimeout)return setTimeout(t,0);if((ue===Lr||!ue)&&setTimeout)return ue=setTimeout,setTimeout(t,0);try{return ue(t,0)}catch{try{return ue.call(null,t,0)}catch{return ue.call(this,t,0)}}}function hn(t){if(fe===clearTimeout)return clearTimeout(t);if((fe===Ur||!fe)&&clearTimeout)return fe=clearTimeout,clearTimeout(t);try{return fe(t)}catch{try{return fe.call(null,t)}catch{return fe.call(this,t)}}}var se=[],xe=!1,_e,Ge=-1;function dn(){!xe||!_e||(xe=!1,_e.length?se=_e.concat(se):Ge=-1,se.length&&jr())}function jr(){if(!xe){var t=Wr(dn);xe=!0;for(var e=se.length;e;){for(_e=se,se=[];++Ge<e;)_e&&_e[Ge].run();Ge=-1,e=se.length}_e=null,xe=!1,hn(t)}}function _n(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];se.push(new Yr(t,e)),se.length===1&&!xe&&Wr(jr)}function Yr(t,e){this.fun=t,this.array=e}Yr.prototype.run=function(){this.fun.apply(null,this.array)};var gn="browser",pn="browser",yn=!0,wn={},bn=[],mn="",vn={},En={},xn={};function ge(){}var Rn=ge,Tn=ge,Sn=ge,Cn=ge,An=ge,Fn=ge,Dn=ge;function Mn(t){throw new Error("process.binding is not supported")}function On(){return"/"}function kn(t){throw new Error("process.chdir is not supported")}function Pn(){return 0}var Re=Ee.performance||{},Nn=Re.now||Re.mozNow||Re.msNow||Re.oNow||Re.webkitNow||function(){return new Date().getTime()};function In(t){var e=Nn.call(Re)*.001,r=Math.floor(e),i=Math.floor(e%1*1e9);return t&&(r=r-t[0],i=i-t[1],i<0&&(r--,i+=1e9)),[r,i]}var Bn=new Date;function Ln(){var t=new Date,e=t-Bn;return e/1e3}var I={nextTick:_n,title:gn,browser:yn,env:wn,argv:bn,version:mn,versions:vn,on:Rn,addListener:Tn,once:Sn,off:Cn,removeListener:An,removeAllListeners:Fn,emit:Dn,binding:Mn,cwd:On,chdir:kn,umask:Pn,hrtime:In,platform:pn,release:En,config:xn,uptime:Ln},Ve=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Tt(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(r,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}),r}var St={exports:{}},Ct={exports:{}};const zr=Tt(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var qr=zr.EventEmitter,ee=[],H=[],Un=typeof Uint8Array<"u"?Uint8Array:Array,At=!1;function $r(){At=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,r=t.length;e<r;++e)ee[e]=t[e],H[t.charCodeAt(e)]=e;H["-".charCodeAt(0)]=62,H["_".charCodeAt(0)]=63}function Wn(t){At||$r();var e,r,i,n,s,a,u=t.length;if(u%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s=t[u-2]==="="?2:t[u-1]==="="?1:0,a=new Un(u*3/4-s),i=s>0?u-4:u;var f=0;for(e=0,r=0;e<i;e+=4,r+=3)n=H[t.charCodeAt(e)]<<18|H[t.charCodeAt(e+1)]<<12|H[t.charCodeAt(e+2)]<<6|H[t.charCodeAt(e+3)],a[f++]=n>>16&255,a[f++]=n>>8&255,a[f++]=n&255;return s===2?(n=H[t.charCodeAt(e)]<<2|H[t.charCodeAt(e+1)]>>4,a[f++]=n&255):s===1&&(n=H[t.charCodeAt(e)]<<10|H[t.charCodeAt(e+1)]<<4|H[t.charCodeAt(e+2)]>>2,a[f++]=n>>8&255,a[f++]=n&255),a}function jn(t){return ee[t>>18&63]+ee[t>>12&63]+ee[t>>6&63]+ee[t&63]}function Yn(t,e,r){for(var i,n=[],s=e;s<r;s+=3)i=(t[s]<<16)+(t[s+1]<<8)+t[s+2],n.push(jn(i));return n.join("")}function Gr(t){At||$r();for(var e,r=t.length,i=r%3,n="",s=[],a=16383,u=0,f=r-i;u<f;u+=a)s.push(Yn(t,u,u+a>f?f:u+a));return i===1?(e=t[r-1],n+=ee[e>>2],n+=ee[e<<4&63],n+="=="):i===2&&(e=(t[r-2]<<8)+t[r-1],n+=ee[e>>10],n+=ee[e>>4&63],n+=ee[e<<2&63],n+="="),s.push(n),s.join("")}function He(t,e,r,i,n){var s,a,u=n*8-i-1,f=(1<<u)-1,g=f>>1,b=-7,w=r?n-1:0,_=r?-1:1,E=t[e+w];for(w+=_,s=E&(1<<-b)-1,E>>=-b,b+=u;b>0;s=s*256+t[e+w],w+=_,b-=8);for(a=s&(1<<-b)-1,s>>=-b,b+=i;b>0;a=a*256+t[e+w],w+=_,b-=8);if(s===0)s=1-g;else{if(s===f)return a?NaN:(E?-1:1)*(1/0);a=a+Math.pow(2,i),s=s-g}return(E?-1:1)*a*Math.pow(2,s-i)}function Vr(t,e,r,i,n,s){var a,u,f,g=s*8-n-1,b=(1<<g)-1,w=b>>1,_=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=i?0:s-1,v=i?1:-1,T=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,a=b):(a=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-a))<1&&(a--,f*=2),a+w>=1?e+=_/f:e+=_*Math.pow(2,1-w),e*f>=2&&(a++,f/=2),a+w>=b?(u=0,a=b):a+w>=1?(u=(e*f-1)*Math.pow(2,n),a=a+w):(u=e*Math.pow(2,w-1)*Math.pow(2,n),a=0));n>=8;t[r+E]=u&255,E+=v,u/=256,n-=8);for(a=a<<n|u,g+=n;g>0;t[r+E]=a&255,E+=v,a/=256,g-=8);t[r+E-v]|=T*128}var zn={}.toString,Hr=Array.isArray||function(t){return zn.call(t)=="[object Array]"};/*!
7
7
  * The buffer module from node.js, for the browser.
8
8
  *
9
9
  * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
10
10
  * @license MIT
11
- */var Xr=50;y.TYPED_ARRAY_SUPPORT=Ee.TYPED_ARRAY_SUPPORT!==void 0?Ee.TYPED_ARRAY_SUPPORT:!0;var qn=Xe();function Xe(){return y.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function oe(t,e){if(Xe()<e)throw new RangeError("Invalid typed array length");return y.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=y.prototype):(t===null&&(t=new y(e)),t.length=e),t}function y(t,e,r){if(!y.TYPED_ARRAY_SUPPORT&&!(this instanceof y))return new y(t,e,r);if(typeof t=="number"){if(typeof e=="string")throw new Error("If encoding is specified then the first argument must be a string");return Ft(this,t)}return Kr(this,t,e,r)}y.poolSize=8192,y._augment=function(t){return t.__proto__=y.prototype,t};function Kr(t,e,r,i){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?Vn(t,e,r,i):typeof e=="string"?Gn(t,e,r):Hn(t,e)}y.from=function(t,e,r){return Kr(null,t,e,r)},y.TYPED_ARRAY_SUPPORT&&(y.prototype.__proto__=Uint8Array.prototype,y.__proto__=Uint8Array);function Jr(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function $n(t,e,r,i){return Jr(e),e<=0?oe(t,e):r!==void 0?typeof i=="string"?oe(t,e).fill(r,i):oe(t,e).fill(r):oe(t,e)}y.alloc=function(t,e,r){return $n(null,t,e,r)};function Ft(t,e){if(Jr(e),t=oe(t,e<0?0:Mt(e)|0),!y.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}y.allocUnsafe=function(t){return Ft(null,t)},y.allocUnsafeSlow=function(t){return Ft(null,t)};function Gn(t,e,r){if((typeof r!="string"||r==="")&&(r="utf8"),!y.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var i=Qr(e,r)|0;t=oe(t,i);var n=t.write(e,r);return n!==i&&(t=t.slice(0,n)),t}function Dt(t,e){var r=e.length<0?0:Mt(e.length)|0;t=oe(t,r);for(var i=0;i<r;i+=1)t[i]=e[i]&255;return t}function Vn(t,e,r,i){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");return r===void 0&&i===void 0?e=new Uint8Array(e):i===void 0?e=new Uint8Array(e,r):e=new Uint8Array(e,r,i),y.TYPED_ARRAY_SUPPORT?(t=e,t.__proto__=y.prototype):t=Dt(t,e),t}function Hn(t,e){if(te(e)){var r=Mt(e.length)|0;return t=oe(t,r),t.length===0||e.copy(t,0,0,r),t}if(e){if(typeof ArrayBuffer<"u"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||ga(e.length)?oe(t,0):Dt(t,e);if(e.type==="Buffer"&&Hr(e.data))return Dt(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Mt(t){if(t>=Xe())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Xe().toString(16)+" bytes");return t|0}function Xn(t){return+t!=t&&(t=0),y.alloc(+t)}y.isBuffer=li;function te(t){return!!(t!=null&&t._isBuffer)}y.compare=function(e,r){if(!te(e)||!te(r))throw new TypeError("Arguments must be Buffers");if(e===r)return 0;for(var i=e.length,n=r.length,s=0,a=Math.min(i,n);s<a;++s)if(e[s]!==r[s]){i=e[s],n=r[s];break}return i<n?-1:n<i?1:0},y.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},y.concat=function(e,r){if(!Hr(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return y.alloc(0);var i;if(r===void 0)for(r=0,i=0;i<e.length;++i)r+=e[i].length;var n=y.allocUnsafe(r),s=0;for(i=0;i<e.length;++i){var a=e[i];if(!te(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,s),s+=a.length}return n};function Qr(t,e){if(te(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var r=t.length;if(r===0)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Qe(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return oi(t).length;default:if(i)return Qe(t).length;e=(""+e).toLowerCase(),i=!0}}y.byteLength=Qr;function Kn(t,e,r){var i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return sa(this,e,r);case"utf8":case"utf-8":return ri(this,e,r);case"ascii":return na(this,e,r);case"latin1":case"binary":return aa(this,e,r);case"base64":return ra(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return oa(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}y.prototype._isBuffer=!0;function pe(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}y.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<e;r+=2)pe(this,r,r+1);return this},y.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<e;r+=4)pe(this,r,r+3),pe(this,r+1,r+2);return this},y.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<e;r+=8)pe(this,r,r+7),pe(this,r+1,r+6),pe(this,r+2,r+5),pe(this,r+3,r+4);return this},y.prototype.toString=function(){var e=this.length|0;return e===0?"":arguments.length===0?ri(this,0,e):Kn.apply(this,arguments)},y.prototype.equals=function(e){if(!te(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:y.compare(this,e)===0},y.prototype.inspect=function(){var e="",r=Xr;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"},y.prototype.compare=function(e,r,i,n,s){if(!te(e))throw new TypeError("Argument must be a Buffer");if(r===void 0&&(r=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),r<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&r>=i)return 0;if(n>=s)return-1;if(r>=i)return 1;if(r>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;for(var a=s-n,u=i-r,f=Math.min(a,u),_=this.slice(n,s),b=e.slice(r,i),w=0;w<f;++w)if(_[w]!==b[w]){a=_[w],u=b[w];break}return a<u?-1:u<a?1:0};function Zr(t,e,r,i,n){if(t.length===0)return-1;if(typeof r=="string"?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0)if(n)r=0;else return-1;if(typeof e=="string"&&(e=y.from(e,i)),te(e))return e.length===0?-1:ei(t,e,r,i,n);if(typeof e=="number")return e=e&255,y.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):ei(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function ei(t,e,r,i,n){var s=1,a=t.length,u=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function f(E,v){return s===1?E[v]:E.readUInt16BE(v*s)}var _;if(n){var b=-1;for(_=r;_<a;_++)if(f(t,_)===f(e,b===-1?0:_-b)){if(b===-1&&(b=_),_-b+1===u)return b*s}else b!==-1&&(_-=_-b),b=-1}else for(r+u>a&&(r=a-u),_=r;_>=0;_--){for(var w=!0,g=0;g<u;g++)if(f(t,_+g)!==f(e,g)){w=!1;break}if(w)return _}return-1}y.prototype.includes=function(e,r,i){return this.indexOf(e,r,i)!==-1},y.prototype.indexOf=function(e,r,i){return Zr(this,e,r,i,!0)},y.prototype.lastIndexOf=function(e,r,i){return Zr(this,e,r,i,!1)};function Jn(t,e,r,i){r=Number(r)||0;var n=t.length-r;i?(i=Number(i),i>n&&(i=n)):i=n;var s=e.length;if(s%2!==0)throw new TypeError("Invalid hex string");i>s/2&&(i=s/2);for(var a=0;a<i;++a){var u=parseInt(e.substr(a*2,2),16);if(isNaN(u))return a;t[r+a]=u}return a}function Qn(t,e,r,i){return Ze(Qe(e,t.length-r),t,r,i)}function ti(t,e,r,i){return Ze(ha(e),t,r,i)}function Zn(t,e,r,i){return ti(t,e,r,i)}function ea(t,e,r,i){return Ze(oi(e),t,r,i)}function ta(t,e,r,i){return Ze(da(e,t.length-r),t,r,i)}y.prototype.write=function(e,r,i,n){if(r===void 0)n="utf8",i=this.length,r=0;else if(i===void 0&&typeof r=="string")n=r,i=this.length,r=0;else if(isFinite(r))r=r|0,isFinite(i)?(i=i|0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-r;if((i===void 0||i>s)&&(i=s),e.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return Jn(this,e,r,i);case"utf8":case"utf-8":return Qn(this,e,r,i);case"ascii":return ti(this,e,r,i);case"latin1":case"binary":return Zn(this,e,r,i);case"base64":return ea(this,e,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ta(this,e,r,i);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},y.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ra(t,e,r){return e===0&&r===t.length?Gr(t):Gr(t.slice(e,r))}function ri(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n<r;){var s=t[n],a=null,u=s>239?4:s>223?3:s>191?2:1;if(n+u<=r){var f,_,b,w;switch(u){case 1:s<128&&(a=s);break;case 2:f=t[n+1],(f&192)===128&&(w=(s&31)<<6|f&63,w>127&&(a=w));break;case 3:f=t[n+1],_=t[n+2],(f&192)===128&&(_&192)===128&&(w=(s&15)<<12|(f&63)<<6|_&63,w>2047&&(w<55296||w>57343)&&(a=w));break;case 4:f=t[n+1],_=t[n+2],b=t[n+3],(f&192)===128&&(_&192)===128&&(b&192)===128&&(w=(s&15)<<18|(f&63)<<12|(_&63)<<6|b&63,w>65535&&w<1114112&&(a=w))}}a===null?(a=65533,u=1):a>65535&&(a-=65536,i.push(a>>>10&1023|55296),a=56320|a&1023),i.push(a),n+=u}return ia(i)}var ii=4096;function ia(t){var e=t.length;if(e<=ii)return String.fromCharCode.apply(String,t);for(var r="",i=0;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=ii));return r}function na(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(t[n]&127);return i}function aa(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(t[n]);return i}function sa(t,e,r){var i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);for(var n="",s=e;s<r;++s)n+=ca(t[s]);return n}function oa(t,e,r){for(var i=t.slice(e,r),n="",s=0;s<i.length;s+=2)n+=String.fromCharCode(i[s]+i[s+1]*256);return n}y.prototype.slice=function(e,r){var i=this.length;e=~~e,r=r===void 0?i:~~r,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<e&&(r=e);var n;if(y.TYPED_ARRAY_SUPPORT)n=this.subarray(e,r),n.__proto__=y.prototype;else{var s=r-e;n=new y(s,void 0);for(var a=0;a<s;++a)n[a]=this[a+e]}return n};function z(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}y.prototype.readUIntLE=function(e,r,i){e=e|0,r=r|0,i||z(e,r,this.length);for(var n=this[e],s=1,a=0;++a<r&&(s*=256);)n+=this[e+a]*s;return n},y.prototype.readUIntBE=function(e,r,i){e=e|0,r=r|0,i||z(e,r,this.length);for(var n=this[e+--r],s=1;r>0&&(s*=256);)n+=this[e+--r]*s;return n},y.prototype.readUInt8=function(e,r){return r||z(e,1,this.length),this[e]},y.prototype.readUInt16LE=function(e,r){return r||z(e,2,this.length),this[e]|this[e+1]<<8},y.prototype.readUInt16BE=function(e,r){return r||z(e,2,this.length),this[e]<<8|this[e+1]},y.prototype.readUInt32LE=function(e,r){return r||z(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},y.prototype.readUInt32BE=function(e,r){return r||z(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},y.prototype.readIntLE=function(e,r,i){e=e|0,r=r|0,i||z(e,r,this.length);for(var n=this[e],s=1,a=0;++a<r&&(s*=256);)n+=this[e+a]*s;return s*=128,n>=s&&(n-=Math.pow(2,8*r)),n},y.prototype.readIntBE=function(e,r,i){e=e|0,r=r|0,i||z(e,r,this.length);for(var n=r,s=1,a=this[e+--n];n>0&&(s*=256);)a+=this[e+--n]*s;return s*=128,a>=s&&(a-=Math.pow(2,8*r)),a},y.prototype.readInt8=function(e,r){return r||z(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},y.prototype.readInt16LE=function(e,r){r||z(e,2,this.length);var i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i},y.prototype.readInt16BE=function(e,r){r||z(e,2,this.length);var i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i},y.prototype.readInt32LE=function(e,r){return r||z(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},y.prototype.readInt32BE=function(e,r){return r||z(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},y.prototype.readFloatLE=function(e,r){return r||z(e,4,this.length),He(this,e,!0,23,4)},y.prototype.readFloatBE=function(e,r){return r||z(e,4,this.length),He(this,e,!1,23,4)},y.prototype.readDoubleLE=function(e,r){return r||z(e,8,this.length),He(this,e,!0,52,8)},y.prototype.readDoubleBE=function(e,r){return r||z(e,8,this.length),He(this,e,!1,52,8)};function $(t,e,r,i,n,s){if(!te(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<s)throw new RangeError('"value" argument is out of bounds');if(r+i>t.length)throw new RangeError("Index out of range")}y.prototype.writeUIntLE=function(e,r,i,n){if(e=+e,r=r|0,i=i|0,!n){var s=Math.pow(2,8*i)-1;$(this,e,r,i,s,0)}var a=1,u=0;for(this[r]=e&255;++u<i&&(a*=256);)this[r+u]=e/a&255;return r+i},y.prototype.writeUIntBE=function(e,r,i,n){if(e=+e,r=r|0,i=i|0,!n){var s=Math.pow(2,8*i)-1;$(this,e,r,i,s,0)}var a=i-1,u=1;for(this[r+a]=e&255;--a>=0&&(u*=256);)this[r+a]=e/u&255;return r+i},y.prototype.writeUInt8=function(e,r,i){return e=+e,r=r|0,i||$(this,e,r,1,255,0),y.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[r]=e&255,r+1};function Ke(t,e,r,i){e<0&&(e=65535+e+1);for(var n=0,s=Math.min(t.length-r,2);n<s;++n)t[r+n]=(e&255<<8*(i?n:1-n))>>>(i?n:1-n)*8}y.prototype.writeUInt16LE=function(e,r,i){return e=+e,r=r|0,i||$(this,e,r,2,65535,0),y.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8):Ke(this,e,r,!0),r+2},y.prototype.writeUInt16BE=function(e,r,i){return e=+e,r=r|0,i||$(this,e,r,2,65535,0),y.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=e&255):Ke(this,e,r,!1),r+2};function Je(t,e,r,i){e<0&&(e=4294967295+e+1);for(var n=0,s=Math.min(t.length-r,4);n<s;++n)t[r+n]=e>>>(i?n:3-n)*8&255}y.prototype.writeUInt32LE=function(e,r,i){return e=+e,r=r|0,i||$(this,e,r,4,4294967295,0),y.TYPED_ARRAY_SUPPORT?(this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255):Je(this,e,r,!0),r+4},y.prototype.writeUInt32BE=function(e,r,i){return e=+e,r=r|0,i||$(this,e,r,4,4294967295,0),y.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255):Je(this,e,r,!1),r+4},y.prototype.writeIntLE=function(e,r,i,n){if(e=+e,r=r|0,!n){var s=Math.pow(2,8*i-1);$(this,e,r,i,s-1,-s)}var a=0,u=1,f=0;for(this[r]=e&255;++a<i&&(u*=256);)e<0&&f===0&&this[r+a-1]!==0&&(f=1),this[r+a]=(e/u>>0)-f&255;return r+i},y.prototype.writeIntBE=function(e,r,i,n){if(e=+e,r=r|0,!n){var s=Math.pow(2,8*i-1);$(this,e,r,i,s-1,-s)}var a=i-1,u=1,f=0;for(this[r+a]=e&255;--a>=0&&(u*=256);)e<0&&f===0&&this[r+a+1]!==0&&(f=1),this[r+a]=(e/u>>0)-f&255;return r+i},y.prototype.writeInt8=function(e,r,i){return e=+e,r=r|0,i||$(this,e,r,1,127,-128),y.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[r]=e&255,r+1},y.prototype.writeInt16LE=function(e,r,i){return e=+e,r=r|0,i||$(this,e,r,2,32767,-32768),y.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8):Ke(this,e,r,!0),r+2},y.prototype.writeInt16BE=function(e,r,i){return e=+e,r=r|0,i||$(this,e,r,2,32767,-32768),y.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=e&255):Ke(this,e,r,!1),r+2},y.prototype.writeInt32LE=function(e,r,i){return e=+e,r=r|0,i||$(this,e,r,4,2147483647,-2147483648),y.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24):Je(this,e,r,!0),r+4},y.prototype.writeInt32BE=function(e,r,i){return e=+e,r=r|0,i||$(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),y.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255):Je(this,e,r,!1),r+4};function ni(t,e,r,i,n,s){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function ai(t,e,r,i,n){return n||ni(t,e,r,4),Vr(t,e,r,i,23,4),r+4}y.prototype.writeFloatLE=function(e,r,i){return ai(this,e,r,!0,i)},y.prototype.writeFloatBE=function(e,r,i){return ai(this,e,r,!1,i)};function si(t,e,r,i,n){return n||ni(t,e,r,8),Vr(t,e,r,i,52,8),r+8}y.prototype.writeDoubleLE=function(e,r,i){return si(this,e,r,!0,i)},y.prototype.writeDoubleBE=function(e,r,i){return si(this,e,r,!1,i)},y.prototype.copy=function(e,r,i,n){if(i||(i=0),!n&&n!==0&&(n=this.length),r>=e.length&&(r=e.length),r||(r=0),n>0&&n<i&&(n=i),n===i||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-r<n-i&&(n=e.length-r+i);var s=n-i,a;if(this===e&&i<r&&r<n)for(a=s-1;a>=0;--a)e[a+r]=this[a+i];else if(s<1e3||!y.TYPED_ARRAY_SUPPORT)for(a=0;a<s;++a)e[a+r]=this[a+i];else Uint8Array.prototype.set.call(e,this.subarray(i,i+s),r);return s},y.prototype.fill=function(e,r,i,n){if(typeof e=="string"){if(typeof r=="string"?(n=r,r=0,i=this.length):typeof i=="string"&&(n=i,i=this.length),e.length===1){var s=e.charCodeAt(0);s<256&&(e=s)}if(n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!y.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else typeof e=="number"&&(e=e&255);if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,e||(e=0);var a;if(typeof e=="number")for(a=r;a<i;++a)this[a]=e;else{var u=te(e)?e:Qe(new y(e,n).toString()),f=u.length;for(a=0;a<i-r;++a)this[a+r]=u[a%f]}return this};var la=/[^+\/0-9A-Za-z-_]/g;function ua(t){if(t=fa(t).replace(la,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function fa(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function ca(t){return t<16?"0"+t.toString(16):t.toString(16)}function Qe(t,e){e=e||1/0;for(var r,i=t.length,n=null,s=[],a=0;a<i;++a){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(a+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function ha(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function da(t,e){for(var r,i,n,s=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),i=r>>8,n=r%256,s.push(n),s.push(i);return s}function oi(t){return Wn(ua(t))}function Ze(t,e,r,i){for(var n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function ga(t){return t!==t}function li(t){return t!=null&&(!!t._isBuffer||ui(t)||_a(t))}function ui(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function _a(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&ui(t.slice(0,0))}const et=Tt(Object.freeze(Object.defineProperty({__proto__:null,Buffer:y,INSPECT_MAX_BYTES:Xr,SlowBuffer:Xn,isBuffer:li,kMaxLength:qn},Symbol.toStringTag,{value:"Module"})));var Ot;typeof Object.create=="function"?Ot=function(e,r){e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:Ot=function(e,r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e};const fi=Ot;var pa=/%[sdj%]/g;function tt(t){if(!Pe(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(re(arguments[r]));return e.join(" ")}for(var r=1,i=arguments,n=i.length,s=String(t).replace(pa,function(u){if(u==="%%")return"%";if(r>=n)return u;switch(u){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch{return"[Circular]"}default:return u}}),a=i[r];r<n;a=i[++r])ke(a)||!ye(a)?s+=" "+a:s+=" "+re(a);return s}function kt(t,e){if(ie(Ee.process))return function(){return kt(t,e).apply(this,arguments)};if(I.noDeprecation===!0)return t;var r=!1;function i(){if(!r){if(I.throwDeprecation)throw new Error(e);I.traceDeprecation?console.trace(e):console.error(e),r=!0}return t.apply(this,arguments)}return i}var rt={},Pt;function ci(t){if(ie(Pt)&&(Pt=I.env.NODE_DEBUG||""),t=t.toUpperCase(),!rt[t])if(new RegExp("\\b"+t+"\\b","i").test(Pt)){var e=0;rt[t]=function(){var r=tt.apply(null,arguments);console.error("%s %d: %s",t,e,r)}}else rt[t]=function(){};return rt[t]}function re(t,e){var r={seen:[],stylize:wa};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),nt(e)?r.showHidden=e:e&&jt(r,e),ie(r.showHidden)&&(r.showHidden=!1),ie(r.depth)&&(r.depth=2),ie(r.colors)&&(r.colors=!1),ie(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=ya),it(r,t,r.depth)}re.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},re.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function ya(t,e){var r=re.styles[e];return r?"\x1B["+re.colors[r][0]+"m"+t+"\x1B["+re.colors[r][1]+"m":t}function wa(t,e){return t}function ba(t){var e={};return t.forEach(function(r,i){e[r]=!0}),e}function it(t,e,r){if(t.customInspect&&e&&Be(e.inspect)&&e.inspect!==re&&!(e.constructor&&e.constructor.prototype===e)){var i=e.inspect(r,t);return Pe(i)||(i=it(t,i,r)),i}var n=ma(t,e);if(n)return n;var s=Object.keys(e),a=ba(s);if(t.showHidden&&(s=Object.getOwnPropertyNames(e)),Ie(e)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return Nt(e);if(s.length===0){if(Be(e)){var u=e.name?": "+e.name:"";return t.stylize("[Function"+u+"]","special")}if(Ne(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(at(e))return t.stylize(Date.prototype.toString.call(e),"date");if(Ie(e))return Nt(e)}var f="",_=!1,b=["{","}"];if(Bt(e)&&(_=!0,b=["[","]"]),Be(e)){var w=e.name?": "+e.name:"";f=" [Function"+w+"]"}if(Ne(e)&&(f=" "+RegExp.prototype.toString.call(e)),at(e)&&(f=" "+Date.prototype.toUTCString.call(e)),Ie(e)&&(f=" "+Nt(e)),s.length===0&&(!_||e.length==0))return b[0]+f+b[1];if(r<0)return Ne(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var g;return _?g=va(t,e,r,a,s):g=s.map(function(E){return It(t,e,r,a,E,_)}),t.seen.pop(),Ea(g,f,b)}function ma(t,e){if(ie(e))return t.stylize("undefined","undefined");if(Pe(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(Lt(e))return t.stylize(""+e,"number");if(nt(e))return t.stylize(""+e,"boolean");if(ke(e))return t.stylize("null","null")}function Nt(t){return"["+Error.prototype.toString.call(t)+"]"}function va(t,e,r,i,n){for(var s=[],a=0,u=e.length;a<u;++a)yi(e,String(a))?s.push(It(t,e,r,i,String(a),!0)):s.push("");return n.forEach(function(f){f.match(/^\d+$/)||s.push(It(t,e,r,i,f,!0))}),s}function It(t,e,r,i,n,s){var a,u,f;if(f=Object.getOwnPropertyDescriptor(e,n)||{value:e[n]},f.get?f.set?u=t.stylize("[Getter/Setter]","special"):u=t.stylize("[Getter]","special"):f.set&&(u=t.stylize("[Setter]","special")),yi(i,n)||(a="["+n+"]"),u||(t.seen.indexOf(f.value)<0?(ke(r)?u=it(t,f.value,null):u=it(t,f.value,r-1),u.indexOf(`
11
+ */var Xr=50;y.TYPED_ARRAY_SUPPORT=Ee.TYPED_ARRAY_SUPPORT!==void 0?Ee.TYPED_ARRAY_SUPPORT:!0;var qn=Xe();function Xe(){return y.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function oe(t,e){if(Xe()<e)throw new RangeError("Invalid typed array length");return y.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=y.prototype):(t===null&&(t=new y(e)),t.length=e),t}function y(t,e,r){if(!y.TYPED_ARRAY_SUPPORT&&!(this instanceof y))return new y(t,e,r);if(typeof t=="number"){if(typeof e=="string")throw new Error("If encoding is specified then the first argument must be a string");return Ft(this,t)}return Kr(this,t,e,r)}y.poolSize=8192,y._augment=function(t){return t.__proto__=y.prototype,t};function Kr(t,e,r,i){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?Vn(t,e,r,i):typeof e=="string"?Gn(t,e,r):Hn(t,e)}y.from=function(t,e,r){return Kr(null,t,e,r)},y.TYPED_ARRAY_SUPPORT&&(y.prototype.__proto__=Uint8Array.prototype,y.__proto__=Uint8Array);function Jr(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function $n(t,e,r,i){return Jr(e),e<=0?oe(t,e):r!==void 0?typeof i=="string"?oe(t,e).fill(r,i):oe(t,e).fill(r):oe(t,e)}y.alloc=function(t,e,r){return $n(null,t,e,r)};function Ft(t,e){if(Jr(e),t=oe(t,e<0?0:Mt(e)|0),!y.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}y.allocUnsafe=function(t){return Ft(null,t)},y.allocUnsafeSlow=function(t){return Ft(null,t)};function Gn(t,e,r){if((typeof r!="string"||r==="")&&(r="utf8"),!y.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var i=Qr(e,r)|0;t=oe(t,i);var n=t.write(e,r);return n!==i&&(t=t.slice(0,n)),t}function Dt(t,e){var r=e.length<0?0:Mt(e.length)|0;t=oe(t,r);for(var i=0;i<r;i+=1)t[i]=e[i]&255;return t}function Vn(t,e,r,i){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");return r===void 0&&i===void 0?e=new Uint8Array(e):i===void 0?e=new Uint8Array(e,r):e=new Uint8Array(e,r,i),y.TYPED_ARRAY_SUPPORT?(t=e,t.__proto__=y.prototype):t=Dt(t,e),t}function Hn(t,e){if(te(e)){var r=Mt(e.length)|0;return t=oe(t,r),t.length===0||e.copy(t,0,0,r),t}if(e){if(typeof ArrayBuffer<"u"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||_a(e.length)?oe(t,0):Dt(t,e);if(e.type==="Buffer"&&Hr(e.data))return Dt(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Mt(t){if(t>=Xe())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Xe().toString(16)+" bytes");return t|0}function Xn(t){return+t!=t&&(t=0),y.alloc(+t)}y.isBuffer=li;function te(t){return!!(t!=null&&t._isBuffer)}y.compare=function(e,r){if(!te(e)||!te(r))throw new TypeError("Arguments must be Buffers");if(e===r)return 0;for(var i=e.length,n=r.length,s=0,a=Math.min(i,n);s<a;++s)if(e[s]!==r[s]){i=e[s],n=r[s];break}return i<n?-1:n<i?1:0},y.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},y.concat=function(e,r){if(!Hr(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return y.alloc(0);var i;if(r===void 0)for(r=0,i=0;i<e.length;++i)r+=e[i].length;var n=y.allocUnsafe(r),s=0;for(i=0;i<e.length;++i){var a=e[i];if(!te(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,s),s+=a.length}return n};function Qr(t,e){if(te(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var r=t.length;if(r===0)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Qe(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return oi(t).length;default:if(i)return Qe(t).length;e=(""+e).toLowerCase(),i=!0}}y.byteLength=Qr;function Kn(t,e,r){var i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return sa(this,e,r);case"utf8":case"utf-8":return ri(this,e,r);case"ascii":return na(this,e,r);case"latin1":case"binary":return aa(this,e,r);case"base64":return ra(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return oa(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}y.prototype._isBuffer=!0;function pe(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}y.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<e;r+=2)pe(this,r,r+1);return this},y.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<e;r+=4)pe(this,r,r+3),pe(this,r+1,r+2);return this},y.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<e;r+=8)pe(this,r,r+7),pe(this,r+1,r+6),pe(this,r+2,r+5),pe(this,r+3,r+4);return this},y.prototype.toString=function(){var e=this.length|0;return e===0?"":arguments.length===0?ri(this,0,e):Kn.apply(this,arguments)},y.prototype.equals=function(e){if(!te(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:y.compare(this,e)===0},y.prototype.inspect=function(){var e="",r=Xr;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"},y.prototype.compare=function(e,r,i,n,s){if(!te(e))throw new TypeError("Argument must be a Buffer");if(r===void 0&&(r=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),r<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&r>=i)return 0;if(n>=s)return-1;if(r>=i)return 1;if(r>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;for(var a=s-n,u=i-r,f=Math.min(a,u),g=this.slice(n,s),b=e.slice(r,i),w=0;w<f;++w)if(g[w]!==b[w]){a=g[w],u=b[w];break}return a<u?-1:u<a?1:0};function Zr(t,e,r,i,n){if(t.length===0)return-1;if(typeof r=="string"?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0)if(n)r=0;else return-1;if(typeof e=="string"&&(e=y.from(e,i)),te(e))return e.length===0?-1:ei(t,e,r,i,n);if(typeof e=="number")return e=e&255,y.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):ei(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function ei(t,e,r,i,n){var s=1,a=t.length,u=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function f(E,v){return s===1?E[v]:E.readUInt16BE(v*s)}var g;if(n){var b=-1;for(g=r;g<a;g++)if(f(t,g)===f(e,b===-1?0:g-b)){if(b===-1&&(b=g),g-b+1===u)return b*s}else b!==-1&&(g-=g-b),b=-1}else for(r+u>a&&(r=a-u),g=r;g>=0;g--){for(var w=!0,_=0;_<u;_++)if(f(t,g+_)!==f(e,_)){w=!1;break}if(w)return g}return-1}y.prototype.includes=function(e,r,i){return this.indexOf(e,r,i)!==-1},y.prototype.indexOf=function(e,r,i){return Zr(this,e,r,i,!0)},y.prototype.lastIndexOf=function(e,r,i){return Zr(this,e,r,i,!1)};function Jn(t,e,r,i){r=Number(r)||0;var n=t.length-r;i?(i=Number(i),i>n&&(i=n)):i=n;var s=e.length;if(s%2!==0)throw new TypeError("Invalid hex string");i>s/2&&(i=s/2);for(var a=0;a<i;++a){var u=parseInt(e.substr(a*2,2),16);if(isNaN(u))return a;t[r+a]=u}return a}function Qn(t,e,r,i){return Ze(Qe(e,t.length-r),t,r,i)}function ti(t,e,r,i){return Ze(ha(e),t,r,i)}function Zn(t,e,r,i){return ti(t,e,r,i)}function ea(t,e,r,i){return Ze(oi(e),t,r,i)}function ta(t,e,r,i){return Ze(da(e,t.length-r),t,r,i)}y.prototype.write=function(e,r,i,n){if(r===void 0)n="utf8",i=this.length,r=0;else if(i===void 0&&typeof r=="string")n=r,i=this.length,r=0;else if(isFinite(r))r=r|0,isFinite(i)?(i=i|0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-r;if((i===void 0||i>s)&&(i=s),e.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return Jn(this,e,r,i);case"utf8":case"utf-8":return Qn(this,e,r,i);case"ascii":return ti(this,e,r,i);case"latin1":case"binary":return Zn(this,e,r,i);case"base64":return ea(this,e,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ta(this,e,r,i);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},y.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ra(t,e,r){return e===0&&r===t.length?Gr(t):Gr(t.slice(e,r))}function ri(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n<r;){var s=t[n],a=null,u=s>239?4:s>223?3:s>191?2:1;if(n+u<=r){var f,g,b,w;switch(u){case 1:s<128&&(a=s);break;case 2:f=t[n+1],(f&192)===128&&(w=(s&31)<<6|f&63,w>127&&(a=w));break;case 3:f=t[n+1],g=t[n+2],(f&192)===128&&(g&192)===128&&(w=(s&15)<<12|(f&63)<<6|g&63,w>2047&&(w<55296||w>57343)&&(a=w));break;case 4:f=t[n+1],g=t[n+2],b=t[n+3],(f&192)===128&&(g&192)===128&&(b&192)===128&&(w=(s&15)<<18|(f&63)<<12|(g&63)<<6|b&63,w>65535&&w<1114112&&(a=w))}}a===null?(a=65533,u=1):a>65535&&(a-=65536,i.push(a>>>10&1023|55296),a=56320|a&1023),i.push(a),n+=u}return ia(i)}var ii=4096;function ia(t){var e=t.length;if(e<=ii)return String.fromCharCode.apply(String,t);for(var r="",i=0;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=ii));return r}function na(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(t[n]&127);return i}function aa(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(t[n]);return i}function sa(t,e,r){var i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);for(var n="",s=e;s<r;++s)n+=ca(t[s]);return n}function oa(t,e,r){for(var i=t.slice(e,r),n="",s=0;s<i.length;s+=2)n+=String.fromCharCode(i[s]+i[s+1]*256);return n}y.prototype.slice=function(e,r){var i=this.length;e=~~e,r=r===void 0?i:~~r,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<e&&(r=e);var n;if(y.TYPED_ARRAY_SUPPORT)n=this.subarray(e,r),n.__proto__=y.prototype;else{var s=r-e;n=new y(s,void 0);for(var a=0;a<s;++a)n[a]=this[a+e]}return n};function z(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}y.prototype.readUIntLE=function(e,r,i){e=e|0,r=r|0,i||z(e,r,this.length);for(var n=this[e],s=1,a=0;++a<r&&(s*=256);)n+=this[e+a]*s;return n},y.prototype.readUIntBE=function(e,r,i){e=e|0,r=r|0,i||z(e,r,this.length);for(var n=this[e+--r],s=1;r>0&&(s*=256);)n+=this[e+--r]*s;return n},y.prototype.readUInt8=function(e,r){return r||z(e,1,this.length),this[e]},y.prototype.readUInt16LE=function(e,r){return r||z(e,2,this.length),this[e]|this[e+1]<<8},y.prototype.readUInt16BE=function(e,r){return r||z(e,2,this.length),this[e]<<8|this[e+1]},y.prototype.readUInt32LE=function(e,r){return r||z(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},y.prototype.readUInt32BE=function(e,r){return r||z(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},y.prototype.readIntLE=function(e,r,i){e=e|0,r=r|0,i||z(e,r,this.length);for(var n=this[e],s=1,a=0;++a<r&&(s*=256);)n+=this[e+a]*s;return s*=128,n>=s&&(n-=Math.pow(2,8*r)),n},y.prototype.readIntBE=function(e,r,i){e=e|0,r=r|0,i||z(e,r,this.length);for(var n=r,s=1,a=this[e+--n];n>0&&(s*=256);)a+=this[e+--n]*s;return s*=128,a>=s&&(a-=Math.pow(2,8*r)),a},y.prototype.readInt8=function(e,r){return r||z(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},y.prototype.readInt16LE=function(e,r){r||z(e,2,this.length);var i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i},y.prototype.readInt16BE=function(e,r){r||z(e,2,this.length);var i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i},y.prototype.readInt32LE=function(e,r){return r||z(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},y.prototype.readInt32BE=function(e,r){return r||z(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},y.prototype.readFloatLE=function(e,r){return r||z(e,4,this.length),He(this,e,!0,23,4)},y.prototype.readFloatBE=function(e,r){return r||z(e,4,this.length),He(this,e,!1,23,4)},y.prototype.readDoubleLE=function(e,r){return r||z(e,8,this.length),He(this,e,!0,52,8)},y.prototype.readDoubleBE=function(e,r){return r||z(e,8,this.length),He(this,e,!1,52,8)};function $(t,e,r,i,n,s){if(!te(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<s)throw new RangeError('"value" argument is out of bounds');if(r+i>t.length)throw new RangeError("Index out of range")}y.prototype.writeUIntLE=function(e,r,i,n){if(e=+e,r=r|0,i=i|0,!n){var s=Math.pow(2,8*i)-1;$(this,e,r,i,s,0)}var a=1,u=0;for(this[r]=e&255;++u<i&&(a*=256);)this[r+u]=e/a&255;return r+i},y.prototype.writeUIntBE=function(e,r,i,n){if(e=+e,r=r|0,i=i|0,!n){var s=Math.pow(2,8*i)-1;$(this,e,r,i,s,0)}var a=i-1,u=1;for(this[r+a]=e&255;--a>=0&&(u*=256);)this[r+a]=e/u&255;return r+i},y.prototype.writeUInt8=function(e,r,i){return e=+e,r=r|0,i||$(this,e,r,1,255,0),y.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[r]=e&255,r+1};function Ke(t,e,r,i){e<0&&(e=65535+e+1);for(var n=0,s=Math.min(t.length-r,2);n<s;++n)t[r+n]=(e&255<<8*(i?n:1-n))>>>(i?n:1-n)*8}y.prototype.writeUInt16LE=function(e,r,i){return e=+e,r=r|0,i||$(this,e,r,2,65535,0),y.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8):Ke(this,e,r,!0),r+2},y.prototype.writeUInt16BE=function(e,r,i){return e=+e,r=r|0,i||$(this,e,r,2,65535,0),y.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=e&255):Ke(this,e,r,!1),r+2};function Je(t,e,r,i){e<0&&(e=4294967295+e+1);for(var n=0,s=Math.min(t.length-r,4);n<s;++n)t[r+n]=e>>>(i?n:3-n)*8&255}y.prototype.writeUInt32LE=function(e,r,i){return e=+e,r=r|0,i||$(this,e,r,4,4294967295,0),y.TYPED_ARRAY_SUPPORT?(this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255):Je(this,e,r,!0),r+4},y.prototype.writeUInt32BE=function(e,r,i){return e=+e,r=r|0,i||$(this,e,r,4,4294967295,0),y.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255):Je(this,e,r,!1),r+4},y.prototype.writeIntLE=function(e,r,i,n){if(e=+e,r=r|0,!n){var s=Math.pow(2,8*i-1);$(this,e,r,i,s-1,-s)}var a=0,u=1,f=0;for(this[r]=e&255;++a<i&&(u*=256);)e<0&&f===0&&this[r+a-1]!==0&&(f=1),this[r+a]=(e/u>>0)-f&255;return r+i},y.prototype.writeIntBE=function(e,r,i,n){if(e=+e,r=r|0,!n){var s=Math.pow(2,8*i-1);$(this,e,r,i,s-1,-s)}var a=i-1,u=1,f=0;for(this[r+a]=e&255;--a>=0&&(u*=256);)e<0&&f===0&&this[r+a+1]!==0&&(f=1),this[r+a]=(e/u>>0)-f&255;return r+i},y.prototype.writeInt8=function(e,r,i){return e=+e,r=r|0,i||$(this,e,r,1,127,-128),y.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[r]=e&255,r+1},y.prototype.writeInt16LE=function(e,r,i){return e=+e,r=r|0,i||$(this,e,r,2,32767,-32768),y.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8):Ke(this,e,r,!0),r+2},y.prototype.writeInt16BE=function(e,r,i){return e=+e,r=r|0,i||$(this,e,r,2,32767,-32768),y.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=e&255):Ke(this,e,r,!1),r+2},y.prototype.writeInt32LE=function(e,r,i){return e=+e,r=r|0,i||$(this,e,r,4,2147483647,-2147483648),y.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24):Je(this,e,r,!0),r+4},y.prototype.writeInt32BE=function(e,r,i){return e=+e,r=r|0,i||$(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),y.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255):Je(this,e,r,!1),r+4};function ni(t,e,r,i,n,s){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function ai(t,e,r,i,n){return n||ni(t,e,r,4),Vr(t,e,r,i,23,4),r+4}y.prototype.writeFloatLE=function(e,r,i){return ai(this,e,r,!0,i)},y.prototype.writeFloatBE=function(e,r,i){return ai(this,e,r,!1,i)};function si(t,e,r,i,n){return n||ni(t,e,r,8),Vr(t,e,r,i,52,8),r+8}y.prototype.writeDoubleLE=function(e,r,i){return si(this,e,r,!0,i)},y.prototype.writeDoubleBE=function(e,r,i){return si(this,e,r,!1,i)},y.prototype.copy=function(e,r,i,n){if(i||(i=0),!n&&n!==0&&(n=this.length),r>=e.length&&(r=e.length),r||(r=0),n>0&&n<i&&(n=i),n===i||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-r<n-i&&(n=e.length-r+i);var s=n-i,a;if(this===e&&i<r&&r<n)for(a=s-1;a>=0;--a)e[a+r]=this[a+i];else if(s<1e3||!y.TYPED_ARRAY_SUPPORT)for(a=0;a<s;++a)e[a+r]=this[a+i];else Uint8Array.prototype.set.call(e,this.subarray(i,i+s),r);return s},y.prototype.fill=function(e,r,i,n){if(typeof e=="string"){if(typeof r=="string"?(n=r,r=0,i=this.length):typeof i=="string"&&(n=i,i=this.length),e.length===1){var s=e.charCodeAt(0);s<256&&(e=s)}if(n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!y.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else typeof e=="number"&&(e=e&255);if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,e||(e=0);var a;if(typeof e=="number")for(a=r;a<i;++a)this[a]=e;else{var u=te(e)?e:Qe(new y(e,n).toString()),f=u.length;for(a=0;a<i-r;++a)this[a+r]=u[a%f]}return this};var la=/[^+\/0-9A-Za-z-_]/g;function ua(t){if(t=fa(t).replace(la,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function fa(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function ca(t){return t<16?"0"+t.toString(16):t.toString(16)}function Qe(t,e){e=e||1/0;for(var r,i=t.length,n=null,s=[],a=0;a<i;++a){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(a+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function ha(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function da(t,e){for(var r,i,n,s=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),i=r>>8,n=r%256,s.push(n),s.push(i);return s}function oi(t){return Wn(ua(t))}function Ze(t,e,r,i){for(var n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function _a(t){return t!==t}function li(t){return t!=null&&(!!t._isBuffer||ui(t)||ga(t))}function ui(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function ga(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&ui(t.slice(0,0))}const et=Tt(Object.freeze(Object.defineProperty({__proto__:null,Buffer:y,INSPECT_MAX_BYTES:Xr,SlowBuffer:Xn,isBuffer:li,kMaxLength:qn},Symbol.toStringTag,{value:"Module"})));var Ot;typeof Object.create=="function"?Ot=function(e,r){e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:Ot=function(e,r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e};const fi=Ot;var pa=/%[sdj%]/g;function tt(t){if(!Pe(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(re(arguments[r]));return e.join(" ")}for(var r=1,i=arguments,n=i.length,s=String(t).replace(pa,function(u){if(u==="%%")return"%";if(r>=n)return u;switch(u){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch{return"[Circular]"}default:return u}}),a=i[r];r<n;a=i[++r])ke(a)||!ye(a)?s+=" "+a:s+=" "+re(a);return s}function kt(t,e){if(ie(Ee.process))return function(){return kt(t,e).apply(this,arguments)};if(I.noDeprecation===!0)return t;var r=!1;function i(){if(!r){if(I.throwDeprecation)throw new Error(e);I.traceDeprecation?console.trace(e):console.error(e),r=!0}return t.apply(this,arguments)}return i}var rt={},Pt;function ci(t){if(ie(Pt)&&(Pt=I.env.NODE_DEBUG||""),t=t.toUpperCase(),!rt[t])if(new RegExp("\\b"+t+"\\b","i").test(Pt)){var e=0;rt[t]=function(){var r=tt.apply(null,arguments);console.error("%s %d: %s",t,e,r)}}else rt[t]=function(){};return rt[t]}function re(t,e){var r={seen:[],stylize:wa};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),nt(e)?r.showHidden=e:e&&jt(r,e),ie(r.showHidden)&&(r.showHidden=!1),ie(r.depth)&&(r.depth=2),ie(r.colors)&&(r.colors=!1),ie(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=ya),it(r,t,r.depth)}re.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},re.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function ya(t,e){var r=re.styles[e];return r?"\x1B["+re.colors[r][0]+"m"+t+"\x1B["+re.colors[r][1]+"m":t}function wa(t,e){return t}function ba(t){var e={};return t.forEach(function(r,i){e[r]=!0}),e}function it(t,e,r){if(t.customInspect&&e&&Be(e.inspect)&&e.inspect!==re&&!(e.constructor&&e.constructor.prototype===e)){var i=e.inspect(r,t);return Pe(i)||(i=it(t,i,r)),i}var n=ma(t,e);if(n)return n;var s=Object.keys(e),a=ba(s);if(t.showHidden&&(s=Object.getOwnPropertyNames(e)),Ie(e)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return Nt(e);if(s.length===0){if(Be(e)){var u=e.name?": "+e.name:"";return t.stylize("[Function"+u+"]","special")}if(Ne(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(at(e))return t.stylize(Date.prototype.toString.call(e),"date");if(Ie(e))return Nt(e)}var f="",g=!1,b=["{","}"];if(Bt(e)&&(g=!0,b=["[","]"]),Be(e)){var w=e.name?": "+e.name:"";f=" [Function"+w+"]"}if(Ne(e)&&(f=" "+RegExp.prototype.toString.call(e)),at(e)&&(f=" "+Date.prototype.toUTCString.call(e)),Ie(e)&&(f=" "+Nt(e)),s.length===0&&(!g||e.length==0))return b[0]+f+b[1];if(r<0)return Ne(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var _;return g?_=va(t,e,r,a,s):_=s.map(function(E){return It(t,e,r,a,E,g)}),t.seen.pop(),Ea(_,f,b)}function ma(t,e){if(ie(e))return t.stylize("undefined","undefined");if(Pe(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(Lt(e))return t.stylize(""+e,"number");if(nt(e))return t.stylize(""+e,"boolean");if(ke(e))return t.stylize("null","null")}function Nt(t){return"["+Error.prototype.toString.call(t)+"]"}function va(t,e,r,i,n){for(var s=[],a=0,u=e.length;a<u;++a)yi(e,String(a))?s.push(It(t,e,r,i,String(a),!0)):s.push("");return n.forEach(function(f){f.match(/^\d+$/)||s.push(It(t,e,r,i,f,!0))}),s}function It(t,e,r,i,n,s){var a,u,f;if(f=Object.getOwnPropertyDescriptor(e,n)||{value:e[n]},f.get?f.set?u=t.stylize("[Getter/Setter]","special"):u=t.stylize("[Getter]","special"):f.set&&(u=t.stylize("[Setter]","special")),yi(i,n)||(a="["+n+"]"),u||(t.seen.indexOf(f.value)<0?(ke(r)?u=it(t,f.value,null):u=it(t,f.value,r-1),u.indexOf(`
12
12
  `)>-1&&(s?u=u.split(`
13
- `).map(function(_){return" "+_}).join(`
13
+ `).map(function(g){return" "+g}).join(`
14
14
  `).substr(2):u=`
15
15
  `+u.split(`
16
- `).map(function(_){return" "+_}).join(`
16
+ `).map(function(g){return" "+g}).join(`
17
17
  `))):u=t.stylize("[Circular]","special")),ie(a)){if(s&&n.match(/^\d+$/))return u;a=JSON.stringify(""+n),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+u}function Ea(t,e,r){var i=t.reduce(function(n,s){return s.indexOf(`
18
18
  `)>=0,n+s.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(e===""?"":e+`
19
19
  `)+" "+t.join(`,
20
- `)+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function Bt(t){return Array.isArray(t)}function nt(t){return typeof t=="boolean"}function ke(t){return t===null}function hi(t){return t==null}function Lt(t){return typeof t=="number"}function Pe(t){return typeof t=="string"}function di(t){return typeof t=="symbol"}function ie(t){return t===void 0}function Ne(t){return ye(t)&&Ut(t)==="[object RegExp]"}function ye(t){return typeof t=="object"&&t!==null}function at(t){return ye(t)&&Ut(t)==="[object Date]"}function Ie(t){return ye(t)&&(Ut(t)==="[object Error]"||t instanceof Error)}function Be(t){return typeof t=="function"}function gi(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||typeof t>"u"}function _i(t){return y.isBuffer(t)}function Ut(t){return Object.prototype.toString.call(t)}function Wt(t){return t<10?"0"+t.toString(10):t.toString(10)}var xa=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ra(){var t=new Date,e=[Wt(t.getHours()),Wt(t.getMinutes()),Wt(t.getSeconds())].join(":");return[t.getDate(),xa[t.getMonth()],e].join(" ")}function pi(){console.log("%s - %s",Ra(),tt.apply(null,arguments))}function jt(t,e){if(!e||!ye(e))return t;for(var r=Object.keys(e),i=r.length;i--;)t[r[i]]=e[r[i]];return t}function yi(t,e){return Object.prototype.hasOwnProperty.call(t,e)}const wi=Tt(Object.freeze(Object.defineProperty({__proto__:null,format:tt,deprecate:kt,debuglog:ci,inspect:re,isArray:Bt,isBoolean:nt,isNull:ke,isNullOrUndefined:hi,isNumber:Lt,isString:Pe,isSymbol:di,isUndefined:ie,isRegExp:Ne,isObject:ye,isDate:at,isError:Ie,isFunction:Be,isPrimitive:gi,isBuffer:_i,log:pi,inherits:fi,_extend:jt,default:{inherits:fi,_extend:jt,log:pi,isBuffer:_i,isPrimitive:gi,isFunction:Be,isError:Ie,isDate:at,isObject:ye,isRegExp:Ne,isUndefined:ie,isSymbol:di,isString:Pe,isNumber:Lt,isNullOrUndefined:hi,isNull:ke,isBoolean:nt,isArray:Bt,inspect:re,deprecate:kt,format:tt,debuglog:ci}},Symbol.toStringTag,{value:"Module"})));var Yt,bi;function Ta(){if(bi)return Yt;bi=1;function t(g,E){var v=Object.keys(g);if(Object.getOwnPropertySymbols){var T=Object.getOwnPropertySymbols(g);E&&(T=T.filter(function(D){return Object.getOwnPropertyDescriptor(g,D).enumerable})),v.push.apply(v,T)}return v}function e(g){for(var E=1;E<arguments.length;E++){var v=arguments[E]!=null?arguments[E]:{};E%2?t(Object(v),!0).forEach(function(T){r(g,T,v[T])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(v)):t(Object(v)).forEach(function(T){Object.defineProperty(g,T,Object.getOwnPropertyDescriptor(v,T))})}return g}function r(g,E,v){return E in g?Object.defineProperty(g,E,{value:v,enumerable:!0,configurable:!0,writable:!0}):g[E]=v,g}function i(g,E){if(!(g instanceof E))throw new TypeError("Cannot call a class as a function")}function n(g,E){for(var v=0;v<E.length;v++){var T=E[v];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(g,T.key,T)}}function s(g,E,v){return E&&n(g.prototype,E),v&&n(g,v),g}var a=et,u=a.Buffer,f=wi,_=f.inspect,b=_&&_.custom||"inspect";function w(g,E,v){u.prototype.copy.call(g,E,v)}return Yt=function(){function g(){i(this,g),this.head=null,this.tail=null,this.length=0}return s(g,[{key:"push",value:function(v){var T={data:v,next:null};this.length>0?this.tail.next=T:this.head=T,this.tail=T,++this.length}},{key:"unshift",value:function(v){var T={data:v,next:this.head};this.length===0&&(this.tail=T),this.head=T,++this.length}},{key:"shift",value:function(){if(this.length!==0){var v=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,v}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(v){if(this.length===0)return"";for(var T=this.head,D=""+T.data;T=T.next;)D+=v+T.data;return D}},{key:"concat",value:function(v){if(this.length===0)return u.alloc(0);for(var T=u.allocUnsafe(v>>>0),D=this.head,c=0;D;)w(D.data,T,c),c+=D.data.length,D=D.next;return T}},{key:"consume",value:function(v,T){var D;return v<this.head.data.length?(D=this.head.data.slice(0,v),this.head.data=this.head.data.slice(v)):v===this.head.data.length?D=this.shift():D=T?this._getString(v):this._getBuffer(v),D}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(v){var T=this.head,D=1,c=T.data;for(v-=c.length;T=T.next;){var p=T.data,R=v>p.length?p.length:v;if(R===p.length?c+=p:c+=p.slice(0,v),v-=R,v===0){R===p.length?(++D,T.next?this.head=T.next:this.head=this.tail=null):(this.head=T,T.data=p.slice(R));break}++D}return this.length-=D,c}},{key:"_getBuffer",value:function(v){var T=u.allocUnsafe(v),D=this.head,c=1;for(D.data.copy(T),v-=D.data.length;D=D.next;){var p=D.data,R=v>p.length?p.length:v;if(p.copy(T,T.length-v,0,R),v-=R,v===0){R===p.length?(++c,D.next?this.head=D.next:this.head=this.tail=null):(this.head=D,D.data=p.slice(R));break}++c}return this.length-=c,T}},{key:b,value:function(v,T){return _(this,e({},T,{depth:0,customInspect:!1}))}}]),g}(),Yt}function Sa(t,e){var r=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return i||n?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,I.nextTick(zt,this,t)):I.nextTick(zt,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(s){!e&&s?r._writableState?r._writableState.errorEmitted?I.nextTick(st,r):(r._writableState.errorEmitted=!0,I.nextTick(mi,r,s)):I.nextTick(mi,r,s):e?(I.nextTick(st,r),e(s)):I.nextTick(st,r)}),this)}function mi(t,e){zt(t,e),st(t)}function st(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function Ca(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function zt(t,e){t.emit("error",e)}function Aa(t,e){var r=t._readableState,i=t._writableState;r&&r.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit("error",e)}var vi={destroy:Sa,undestroy:Ca,errorOrDestroy:Aa},we={};function Fa(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var Ei={};function X(t,e,r){r||(r=Error);function i(s,a,u){return typeof e=="string"?e:e(s,a,u)}var n=function(s){Fa(a,s);function a(u,f,_){return s.call(this,i(u,f,_))||this}return a}(r);n.prototype.name=r.name,n.prototype.code=t,Ei[t]=n}function xi(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map(function(i){return String(i)}),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:r===2?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}else return"of ".concat(e," ").concat(String(t))}function Da(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function Ma(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function Oa(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}X("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError),X("ERR_INVALID_ARG_TYPE",function(t,e,r){var i;typeof e=="string"&&Da(e,"not ")?(i="must not be",e=e.replace(/^not /,"")):i="must be";var n;if(Ma(t," argument"))n="The ".concat(t," ").concat(i," ").concat(xi(e,"type"));else{var s=Oa(t,".")?"property":"argument";n='The "'.concat(t,'" ').concat(s," ").concat(i," ").concat(xi(e,"type"))}return n+=". Received type ".concat(typeof r),n},TypeError),X("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),X("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"}),X("ERR_STREAM_PREMATURE_CLOSE","Premature close"),X("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"}),X("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),X("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),X("ERR_STREAM_WRITE_AFTER_END","write after end"),X("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),X("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError),X("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),we.codes=Ei;var ka=we.codes.ERR_INVALID_OPT_VALUE;function Pa(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function Na(t,e,r,i){var n=Pa(e,i,r);if(n!=null){if(!(isFinite(n)&&Math.floor(n)===n)||n<0){var s=i?r:"highWaterMark";throw new ka(s,n)}return Math.floor(n)}return t.objectMode?16:16*1024}var Ri={getHighWaterMark:Na},ce={exports:{}};typeof Object.create=="function"?ce.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:ce.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}};var Ia=Ba;function Ba(t,e){if(qt("noDeprecation"))return t;var r=!1;function i(){if(!r){if(qt("throwDeprecation"))throw new Error(e);qt("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return i}function qt(t){try{if(!Ve.localStorage)return!1}catch{return!1}var e=Ve.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}var $t,Ti;function Si(){if(Ti)return $t;Ti=1,$t=k;function t(d){var h=this;this.next=null,this.entry=null,this.finish=function(){lr(h,d)}}var e;k.WritableState=j;var r={deprecate:Ia},i=qr,n=et.Buffer,s=Ve.Uint8Array||function(){};function a(d){return n.from(d)}function u(d){return n.isBuffer(d)||d instanceof s}var f=vi,_=Ri,b=_.getHighWaterMark,w=we.codes,g=w.ERR_INVALID_ARG_TYPE,E=w.ERR_METHOD_NOT_IMPLEMENTED,v=w.ERR_MULTIPLE_CALLBACK,T=w.ERR_STREAM_CANNOT_PIPE,D=w.ERR_STREAM_DESTROYED,c=w.ERR_STREAM_NULL_VALUES,p=w.ERR_STREAM_WRITE_AFTER_END,R=w.ERR_UNKNOWN_ENCODING,A=f.errorOrDestroy;ce.exports(k,i);function O(){}function j(d,h,x){e=e||Te(),d=d||{},typeof x!="boolean"&&(x=h instanceof e),this.objectMode=!!d.objectMode,x&&(this.objectMode=this.objectMode||!!d.writableObjectMode),this.highWaterMark=b(this,d,"writableHighWaterMark",x),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var M=d.decodeStrings===!1;this.decodeStrings=!M,this.defaultEncoding=d.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(N){Q(h,N)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=d.emitClose!==!1,this.autoDestroy=!!d.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}j.prototype.getBuffer=function(){for(var h=this.bufferedRequest,x=[];h;)x.push(h),h=h.next;return x},function(){try{Object.defineProperty(j.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var q;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(q=Function.prototype[Symbol.hasInstance],Object.defineProperty(k,Symbol.hasInstance,{value:function(h){return q.call(this,h)?!0:this!==k?!1:h&&h._writableState instanceof j}})):q=function(h){return h instanceof this};function k(d){e=e||Te();var h=this instanceof e;if(!h&&!q.call(k,this))return new k(d);this._writableState=new j(d,this,h),this.writable=!0,d&&(typeof d.write=="function"&&(this._write=d.write),typeof d.writev=="function"&&(this._writev=d.writev),typeof d.destroy=="function"&&(this._destroy=d.destroy),typeof d.final=="function"&&(this._final=d.final)),i.call(this)}k.prototype.pipe=function(){A(this,new T)};function F(d,h){var x=new p;A(d,x),I.nextTick(h,x)}function L(d,h,x,M){var N;return x===null?N=new c:typeof x!="string"&&!h.objectMode&&(N=new g("chunk",["string","Buffer"],x)),N?(A(d,N),I.nextTick(M,N),!1):!0}k.prototype.write=function(d,h,x){var M=this._writableState,N=!1,o=!M.objectMode&&u(d);return o&&!n.isBuffer(d)&&(d=a(d)),typeof h=="function"&&(x=h,h=null),o?h="buffer":h||(h=M.defaultEncoding),typeof x!="function"&&(x=O),M.ending?F(this,x):(o||L(this,M,d,x))&&(M.pendingcb++,N=ne(this,M,o,d,h,x)),N},k.prototype.cork=function(){this._writableState.corked++},k.prototype.uncork=function(){var d=this._writableState;d.corked&&(d.corked--,!d.writing&&!d.corked&&!d.bufferProcessing&&d.bufferedRequest&&ae(this,d))},k.prototype.setDefaultEncoding=function(h){if(typeof h=="string"&&(h=h.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((h+"").toLowerCase())>-1))throw new R(h);return this._writableState.defaultEncoding=h,this},Object.defineProperty(k.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function V(d,h,x){return!d.objectMode&&d.decodeStrings!==!1&&typeof h=="string"&&(h=n.from(h,x)),h}Object.defineProperty(k.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function ne(d,h,x,M,N,o){if(!x){var l=V(h,M,N);M!==l&&(x=!0,N="buffer",M=l)}var m=h.objectMode?1:M.length;h.length+=m;var S=h.length<h.highWaterMark;if(S||(h.needDrain=!0),h.writing||h.corked){var U=h.lastBufferedRequest;h.lastBufferedRequest={chunk:M,encoding:N,isBuf:x,callback:o,next:null},U?U.next=h.lastBufferedRequest:h.bufferedRequest=h.lastBufferedRequest,h.bufferedRequestCount+=1}else K(d,h,!1,m,M,N,o);return S}function K(d,h,x,M,N,o,l){h.writelen=M,h.writecb=l,h.writing=!0,h.sync=!0,h.destroyed?h.onwrite(new D("write")):x?d._writev(N,h.onwrite):d._write(N,o,h.onwrite),h.sync=!1}function Y(d,h,x,M,N){--h.pendingcb,x?(I.nextTick(N,M),I.nextTick(me,d,h),d._writableState.errorEmitted=!0,A(d,M)):(N(M),d._writableState.errorEmitted=!0,A(d,M),me(d,h))}function J(d){d.writing=!1,d.writecb=null,d.length-=d.writelen,d.writelen=0}function Q(d,h){var x=d._writableState,M=x.sync,N=x.writecb;if(typeof N!="function")throw new v;if(J(x),h)Y(d,x,M,h,N);else{var o=gt(x)||d.destroyed;!o&&!x.corked&&!x.bufferProcessing&&x.bufferedRequest&&ae(d,x),M?I.nextTick(Z,d,x,o,N):Z(d,x,o,N)}}function Z(d,h,x,M){x||be(d,h),h.pendingcb--,M(),me(d,h)}function be(d,h){h.length===0&&h.needDrain&&(h.needDrain=!1,d.emit("drain"))}function ae(d,h){h.bufferProcessing=!0;var x=h.bufferedRequest;if(d._writev&&x&&x.next){var M=h.bufferedRequestCount,N=new Array(M),o=h.corkedRequestsFree;o.entry=x;for(var l=0,m=!0;x;)N[l]=x,x.isBuf||(m=!1),x=x.next,l+=1;N.allBuffers=m,K(d,h,!0,h.length,N,"",o.finish),h.pendingcb++,h.lastBufferedRequest=null,o.next?(h.corkedRequestsFree=o.next,o.next=null):h.corkedRequestsFree=new t(h),h.bufferedRequestCount=0}else{for(;x;){var S=x.chunk,U=x.encoding,P=x.callback,B=h.objectMode?1:S.length;if(K(d,h,!1,B,S,U,P),x=x.next,h.bufferedRequestCount--,h.writing)break}x===null&&(h.lastBufferedRequest=null)}h.bufferedRequest=x,h.bufferProcessing=!1}k.prototype._write=function(d,h,x){x(new E("_write()"))},k.prototype._writev=null,k.prototype.end=function(d,h,x){var M=this._writableState;return typeof d=="function"?(x=d,d=null,h=null):typeof h=="function"&&(x=h,h=null),d!=null&&this.write(d,h),M.corked&&(M.corked=1,this.uncork()),M.ending||or(this,M,x),this},Object.defineProperty(k.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function gt(d){return d.ending&&d.length===0&&d.bufferedRequest===null&&!d.finished&&!d.writing}function sr(d,h){d._final(function(x){h.pendingcb--,x&&A(d,x),h.prefinished=!0,d.emit("prefinish"),me(d,h)})}function _t(d,h){!h.prefinished&&!h.finalCalled&&(typeof d._final=="function"&&!h.destroyed?(h.pendingcb++,h.finalCalled=!0,I.nextTick(sr,d,h)):(h.prefinished=!0,d.emit("prefinish")))}function me(d,h){var x=gt(h);if(x&&(_t(d,h),h.pendingcb===0&&(h.finished=!0,d.emit("finish"),h.autoDestroy))){var M=d._readableState;(!M||M.autoDestroy&&M.endEmitted)&&d.destroy()}return x}function or(d,h,x){h.ending=!0,me(d,h),x&&(h.finished?I.nextTick(x):d.once("finish",x)),h.ended=!0,d.writable=!1}function lr(d,h,x){var M=d.entry;for(d.entry=null;M;){var N=M.callback;h.pendingcb--,N(x),M=M.next}h.corkedRequestsFree.next=d}return Object.defineProperty(k.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(h){!this._writableState||(this._writableState.destroyed=h)}}),k.prototype.destroy=f.destroy,k.prototype._undestroy=f.undestroy,k.prototype._destroy=function(d,h){h(d)},$t}var Gt,Ci;function Te(){if(Ci)return Gt;Ci=1;var t=Object.keys||function(_){var b=[];for(var w in _)b.push(w);return b};Gt=a;var e=Ii(),r=Si();ce.exports(a,e);for(var i=t(r.prototype),n=0;n<i.length;n++){var s=i[n];a.prototype[s]||(a.prototype[s]=r.prototype[s])}function a(_){if(!(this instanceof a))return new a(_);e.call(this,_),r.call(this,_),this.allowHalfOpen=!0,_&&(_.readable===!1&&(this.readable=!1),_.writable===!1&&(this.writable=!1),_.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",u)))}Object.defineProperty(a.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(a.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(a.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function u(){this._writableState.ended||I.nextTick(f,this)}function f(_){_.end()}return Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(b){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=b,this._writableState.destroyed=b)}}),Gt}var Vt={},ot={exports:{}},Ai;function La(){return Ai||(Ai=1,function(t,e){var r=et,i=r.Buffer;function n(a,u){for(var f in a)u[f]=a[f]}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(n(r,e),e.Buffer=s);function s(a,u,f){return i(a,u,f)}n(i,s),s.from=function(a,u,f){if(typeof a=="number")throw new TypeError("Argument must not be a number");return i(a,u,f)},s.alloc=function(a,u,f){if(typeof a!="number")throw new TypeError("Argument must be a number");var _=i(a);return u!==void 0?typeof f=="string"?_.fill(u,f):_.fill(u):_.fill(0),_},s.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return i(a)},s.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(a)}}(ot,ot.exports)),ot.exports}var Fi;function Di(){if(Fi)return Vt;Fi=1;var t=La().Buffer,e=t.isEncoding||function(c){switch(c=""+c,c&&c.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(c){if(!c)return"utf8";for(var p;;)switch(c){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return c;default:if(p)return;c=(""+c).toLowerCase(),p=!0}}function i(c){var p=r(c);if(typeof p!="string"&&(t.isEncoding===e||!e(c)))throw new Error("Unknown encoding: "+c);return p||c}Vt.StringDecoder=n;function n(c){this.encoding=i(c);var p;switch(this.encoding){case"utf16le":this.text=w,this.end=g,p=4;break;case"utf8":this.fillLast=f,p=4;break;case"base64":this.text=E,this.end=v,p=3;break;default:this.write=T,this.end=D;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(p)}n.prototype.write=function(c){if(c.length===0)return"";var p,R;if(this.lastNeed){if(p=this.fillLast(c),p===void 0)return"";R=this.lastNeed,this.lastNeed=0}else R=0;return R<c.length?p?p+this.text(c,R):this.text(c,R):p||""},n.prototype.end=b,n.prototype.text=_,n.prototype.fillLast=function(c){if(this.lastNeed<=c.length)return c.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);c.copy(this.lastChar,this.lastTotal-this.lastNeed,0,c.length),this.lastNeed-=c.length};function s(c){return c<=127?0:c>>5===6?2:c>>4===14?3:c>>3===30?4:c>>6===2?-1:-2}function a(c,p,R){var A=p.length-1;if(A<R)return 0;var O=s(p[A]);return O>=0?(O>0&&(c.lastNeed=O-1),O):--A<R||O===-2?0:(O=s(p[A]),O>=0?(O>0&&(c.lastNeed=O-2),O):--A<R||O===-2?0:(O=s(p[A]),O>=0?(O>0&&(O===2?O=0:c.lastNeed=O-3),O):0))}function u(c,p,R){if((p[0]&192)!==128)return c.lastNeed=0,"\uFFFD";if(c.lastNeed>1&&p.length>1){if((p[1]&192)!==128)return c.lastNeed=1,"\uFFFD";if(c.lastNeed>2&&p.length>2&&(p[2]&192)!==128)return c.lastNeed=2,"\uFFFD"}}function f(c){var p=this.lastTotal-this.lastNeed,R=u(this,c);if(R!==void 0)return R;if(this.lastNeed<=c.length)return c.copy(this.lastChar,p,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);c.copy(this.lastChar,p,0,c.length),this.lastNeed-=c.length}function _(c,p){var R=a(this,c,p);if(!this.lastNeed)return c.toString("utf8",p);this.lastTotal=R;var A=c.length-(R-this.lastNeed);return c.copy(this.lastChar,0,A),c.toString("utf8",p,A)}function b(c){var p=c&&c.length?this.write(c):"";return this.lastNeed?p+"\uFFFD":p}function w(c,p){if((c.length-p)%2===0){var R=c.toString("utf16le",p);if(R){var A=R.charCodeAt(R.length-1);if(A>=55296&&A<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=c[c.length-2],this.lastChar[1]=c[c.length-1],R.slice(0,-1)}return R}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=c[c.length-1],c.toString("utf16le",p,c.length-1)}function g(c){var p=c&&c.length?this.write(c):"";if(this.lastNeed){var R=this.lastTotal-this.lastNeed;return p+this.lastChar.toString("utf16le",0,R)}return p}function E(c,p){var R=(c.length-p)%3;return R===0?c.toString("base64",p):(this.lastNeed=3-R,this.lastTotal=3,R===1?this.lastChar[0]=c[c.length-1]:(this.lastChar[0]=c[c.length-2],this.lastChar[1]=c[c.length-1]),c.toString("base64",p,c.length-R))}function v(c){var p=c&&c.length?this.write(c):"";return this.lastNeed?p+this.lastChar.toString("base64",0,3-this.lastNeed):p}function T(c){return c.toString(this.encoding)}function D(c){return c&&c.length?this.write(c):""}return Vt}var Mi=we.codes.ERR_STREAM_PREMATURE_CLOSE;function Ua(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];t.apply(this,i)}}}function Wa(){}function ja(t){return t.setHeader&&typeof t.abort=="function"}function Oi(t,e,r){if(typeof e=="function")return Oi(t,null,e);e||(e={}),r=Ua(r||Wa);var i=e.readable||e.readable!==!1&&t.readable,n=e.writable||e.writable!==!1&&t.writable,s=function(){t.writable||u()},a=t._writableState&&t._writableState.finished,u=function(){n=!1,a=!0,i||r.call(t)},f=t._readableState&&t._readableState.endEmitted,_=function(){i=!1,f=!0,n||r.call(t)},b=function(v){r.call(t,v)},w=function(){var v;if(i&&!f)return(!t._readableState||!t._readableState.ended)&&(v=new Mi),r.call(t,v);if(n&&!a)return(!t._writableState||!t._writableState.ended)&&(v=new Mi),r.call(t,v)},g=function(){t.req.on("finish",u)};return ja(t)?(t.on("complete",u),t.on("abort",w),t.req?g():t.on("request",g)):n&&!t._writableState&&(t.on("end",s),t.on("close",s)),t.on("end",_),t.on("finish",u),e.error!==!1&&t.on("error",b),t.on("close",w),function(){t.removeListener("complete",u),t.removeListener("abort",w),t.removeListener("request",g),t.req&&t.req.removeListener("finish",u),t.removeListener("end",s),t.removeListener("close",s),t.removeListener("finish",u),t.removeListener("end",_),t.removeListener("error",b),t.removeListener("close",w)}}var Ht=Oi,Xt,ki;function Ya(){if(ki)return Xt;ki=1;var t;function e(c,p,R){return p in c?Object.defineProperty(c,p,{value:R,enumerable:!0,configurable:!0,writable:!0}):c[p]=R,c}var r=Ht,i=Symbol("lastResolve"),n=Symbol("lastReject"),s=Symbol("error"),a=Symbol("ended"),u=Symbol("lastPromise"),f=Symbol("handlePromise"),_=Symbol("stream");function b(c,p){return{value:c,done:p}}function w(c){var p=c[i];if(p!==null){var R=c[_].read();R!==null&&(c[u]=null,c[i]=null,c[n]=null,p(b(R,!1)))}}function g(c){I.nextTick(w,c)}function E(c,p){return function(R,A){c.then(function(){if(p[a]){R(b(void 0,!0));return}p[f](R,A)},A)}}var v=Object.getPrototypeOf(function(){}),T=Object.setPrototypeOf((t={get stream(){return this[_]},next:function(){var p=this,R=this[s];if(R!==null)return Promise.reject(R);if(this[a])return Promise.resolve(b(void 0,!0));if(this[_].destroyed)return new Promise(function(q,k){I.nextTick(function(){p[s]?k(p[s]):q(b(void 0,!0))})});var A=this[u],O;if(A)O=new Promise(E(A,this));else{var j=this[_].read();if(j!==null)return Promise.resolve(b(j,!1));O=new Promise(this[f])}return this[u]=O,O}},e(t,Symbol.asyncIterator,function(){return this}),e(t,"return",function(){var p=this;return new Promise(function(R,A){p[_].destroy(null,function(O){if(O){A(O);return}R(b(void 0,!0))})})}),t),v),D=function(p){var R,A=Object.create(T,(R={},e(R,_,{value:p,writable:!0}),e(R,i,{value:null,writable:!0}),e(R,n,{value:null,writable:!0}),e(R,s,{value:null,writable:!0}),e(R,a,{value:p._readableState.endEmitted,writable:!0}),e(R,f,{value:function(j,q){var k=A[_].read();k?(A[u]=null,A[i]=null,A[n]=null,j(b(k,!1))):(A[i]=j,A[n]=q)},writable:!0}),R));return A[u]=null,r(p,function(O){if(O&&O.code!=="ERR_STREAM_PREMATURE_CLOSE"){var j=A[n];j!==null&&(A[u]=null,A[i]=null,A[n]=null,j(O)),A[s]=O;return}var q=A[i];q!==null&&(A[u]=null,A[i]=null,A[n]=null,q(b(void 0,!0))),A[a]=!0}),p.on("readable",g.bind(null,A)),A};return Xt=D,Xt}var Kt,Pi;function za(){return Pi||(Pi=1,Kt=function(){throw new Error("Readable.from is not available in the browser")}),Kt}var Jt,Ni;function Ii(){if(Ni)return Jt;Ni=1,Jt=F;var t;F.ReadableState=k,zr.EventEmitter;var e=function(l,m){return l.listeners(m).length},r=qr,i=et.Buffer,n=Ve.Uint8Array||function(){};function s(o){return i.from(o)}function a(o){return i.isBuffer(o)||o instanceof n}var u=wi,f;u&&u.debuglog?f=u.debuglog("stream"):f=function(){};var _=Ta(),b=vi,w=Ri,g=w.getHighWaterMark,E=we.codes,v=E.ERR_INVALID_ARG_TYPE,T=E.ERR_STREAM_PUSH_AFTER_EOF,D=E.ERR_METHOD_NOT_IMPLEMENTED,c=E.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,p,R,A;ce.exports(F,r);var O=b.errorOrDestroy,j=["error","close","destroy","pause","resume"];function q(o,l,m){if(typeof o.prependListener=="function")return o.prependListener(l,m);!o._events||!o._events[l]?o.on(l,m):Array.isArray(o._events[l])?o._events[l].unshift(m):o._events[l]=[m,o._events[l]]}function k(o,l,m){t=t||Te(),o=o||{},typeof m!="boolean"&&(m=l instanceof t),this.objectMode=!!o.objectMode,m&&(this.objectMode=this.objectMode||!!o.readableObjectMode),this.highWaterMark=g(this,o,"readableHighWaterMark",m),this.buffer=new _,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=o.emitClose!==!1,this.autoDestroy=!!o.autoDestroy,this.destroyed=!1,this.defaultEncoding=o.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,o.encoding&&(p||(p=Di().StringDecoder),this.decoder=new p(o.encoding),this.encoding=o.encoding)}function F(o){if(t=t||Te(),!(this instanceof F))return new F(o);var l=this instanceof t;this._readableState=new k(o,this,l),this.readable=!0,o&&(typeof o.read=="function"&&(this._read=o.read),typeof o.destroy=="function"&&(this._destroy=o.destroy)),r.call(this)}Object.defineProperty(F.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(l){!this._readableState||(this._readableState.destroyed=l)}}),F.prototype.destroy=b.destroy,F.prototype._undestroy=b.undestroy,F.prototype._destroy=function(o,l){l(o)},F.prototype.push=function(o,l){var m=this._readableState,S;return m.objectMode?S=!0:typeof o=="string"&&(l=l||m.defaultEncoding,l!==m.encoding&&(o=i.from(o,l),l=""),S=!0),L(this,o,l,!1,S)},F.prototype.unshift=function(o){return L(this,o,null,!0,!1)};function L(o,l,m,S,U){f("readableAddChunk",l);var P=o._readableState;if(l===null)P.reading=!1,Q(o,P);else{var B;if(U||(B=ne(P,l)),B)O(o,B);else if(P.objectMode||l&&l.length>0)if(typeof l!="string"&&!P.objectMode&&Object.getPrototypeOf(l)!==i.prototype&&(l=s(l)),S)P.endEmitted?O(o,new c):V(o,P,l,!0);else if(P.ended)O(o,new T);else{if(P.destroyed)return!1;P.reading=!1,P.decoder&&!m?(l=P.decoder.write(l),P.objectMode||l.length!==0?V(o,P,l,!1):ae(o,P)):V(o,P,l,!1)}else S||(P.reading=!1,ae(o,P))}return!P.ended&&(P.length<P.highWaterMark||P.length===0)}function V(o,l,m,S){l.flowing&&l.length===0&&!l.sync?(l.awaitDrain=0,o.emit("data",m)):(l.length+=l.objectMode?1:m.length,S?l.buffer.unshift(m):l.buffer.push(m),l.needReadable&&Z(o)),ae(o,l)}function ne(o,l){var m;return!a(l)&&typeof l!="string"&&l!==void 0&&!o.objectMode&&(m=new v("chunk",["string","Buffer","Uint8Array"],l)),m}F.prototype.isPaused=function(){return this._readableState.flowing===!1},F.prototype.setEncoding=function(o){p||(p=Di().StringDecoder);var l=new p(o);this._readableState.decoder=l,this._readableState.encoding=this._readableState.decoder.encoding;for(var m=this._readableState.buffer.head,S="";m!==null;)S+=l.write(m.data),m=m.next;return this._readableState.buffer.clear(),S!==""&&this._readableState.buffer.push(S),this._readableState.length=S.length,this};var K=1073741824;function Y(o){return o>=K?o=K:(o--,o|=o>>>1,o|=o>>>2,o|=o>>>4,o|=o>>>8,o|=o>>>16,o++),o}function J(o,l){return o<=0||l.length===0&&l.ended?0:l.objectMode?1:o!==o?l.flowing&&l.length?l.buffer.head.data.length:l.length:(o>l.highWaterMark&&(l.highWaterMark=Y(o)),o<=l.length?o:l.ended?l.length:(l.needReadable=!0,0))}F.prototype.read=function(o){f("read",o),o=parseInt(o,10);var l=this._readableState,m=o;if(o!==0&&(l.emittedReadable=!1),o===0&&l.needReadable&&((l.highWaterMark!==0?l.length>=l.highWaterMark:l.length>0)||l.ended))return f("read: emitReadable",l.length,l.ended),l.length===0&&l.ended?x(this):Z(this),null;if(o=J(o,l),o===0&&l.ended)return l.length===0&&x(this),null;var S=l.needReadable;f("need readable",S),(l.length===0||l.length-o<l.highWaterMark)&&(S=!0,f("length less than watermark",S)),l.ended||l.reading?(S=!1,f("reading or ended",S)):S&&(f("do read"),l.reading=!0,l.sync=!0,l.length===0&&(l.needReadable=!0),this._read(l.highWaterMark),l.sync=!1,l.reading||(o=J(m,l)));var U;return o>0?U=h(o,l):U=null,U===null?(l.needReadable=l.length<=l.highWaterMark,o=0):(l.length-=o,l.awaitDrain=0),l.length===0&&(l.ended||(l.needReadable=!0),m!==o&&l.ended&&x(this)),U!==null&&this.emit("data",U),U};function Q(o,l){if(f("onEofChunk"),!l.ended){if(l.decoder){var m=l.decoder.end();m&&m.length&&(l.buffer.push(m),l.length+=l.objectMode?1:m.length)}l.ended=!0,l.sync?Z(o):(l.needReadable=!1,l.emittedReadable||(l.emittedReadable=!0,be(o)))}}function Z(o){var l=o._readableState;f("emitReadable",l.needReadable,l.emittedReadable),l.needReadable=!1,l.emittedReadable||(f("emitReadable",l.flowing),l.emittedReadable=!0,I.nextTick(be,o))}function be(o){var l=o._readableState;f("emitReadable_",l.destroyed,l.length,l.ended),!l.destroyed&&(l.length||l.ended)&&(o.emit("readable"),l.emittedReadable=!1),l.needReadable=!l.flowing&&!l.ended&&l.length<=l.highWaterMark,d(o)}function ae(o,l){l.readingMore||(l.readingMore=!0,I.nextTick(gt,o,l))}function gt(o,l){for(;!l.reading&&!l.ended&&(l.length<l.highWaterMark||l.flowing&&l.length===0);){var m=l.length;if(f("maybeReadMore read 0"),o.read(0),m===l.length)break}l.readingMore=!1}F.prototype._read=function(o){O(this,new D("_read()"))},F.prototype.pipe=function(o,l){var m=this,S=this._readableState;switch(S.pipesCount){case 0:S.pipes=o;break;case 1:S.pipes=[S.pipes,o];break;default:S.pipes.push(o);break}S.pipesCount+=1,f("pipe count=%d opts=%j",S.pipesCount,l);var U=(!l||l.end!==!1)&&o!==I.stdout&&o!==I.stderr,P=U?Ce:Ue;S.endEmitted?I.nextTick(P):m.once("end",P),o.on("unpipe",B);function B(Ae,Fe){f("onunpipe"),Ae===m&&Fe&&Fe.hasUnpiped===!1&&(Fe.hasUnpiped=!0,As())}function Ce(){f("onend"),o.end()}var pt=sr(m);o.on("drain",pt);var en=!1;function As(){f("cleanup"),o.removeListener("close",fr),o.removeListener("finish",cr),o.removeListener("drain",pt),o.removeListener("error",ur),o.removeListener("unpipe",B),m.removeListener("end",Ce),m.removeListener("end",Ue),m.removeListener("data",tn),en=!0,S.awaitDrain&&(!o._writableState||o._writableState.needDrain)&&pt()}m.on("data",tn);function tn(Ae){f("ondata");var Fe=o.write(Ae);f("dest.write",Fe),Fe===!1&&((S.pipesCount===1&&S.pipes===o||S.pipesCount>1&&N(S.pipes,o)!==-1)&&!en&&(f("false write response, pause",S.awaitDrain),S.awaitDrain++),m.pause())}function ur(Ae){f("onerror",Ae),Ue(),o.removeListener("error",ur),e(o,"error")===0&&O(o,Ae)}q(o,"error",ur);function fr(){o.removeListener("finish",cr),Ue()}o.once("close",fr);function cr(){f("onfinish"),o.removeListener("close",fr),Ue()}o.once("finish",cr);function Ue(){f("unpipe"),m.unpipe(o)}return o.emit("pipe",m),S.flowing||(f("pipe resume"),m.resume()),o};function sr(o){return function(){var m=o._readableState;f("pipeOnDrain",m.awaitDrain),m.awaitDrain&&m.awaitDrain--,m.awaitDrain===0&&e(o,"data")&&(m.flowing=!0,d(o))}}F.prototype.unpipe=function(o){var l=this._readableState,m={hasUnpiped:!1};if(l.pipesCount===0)return this;if(l.pipesCount===1)return o&&o!==l.pipes?this:(o||(o=l.pipes),l.pipes=null,l.pipesCount=0,l.flowing=!1,o&&o.emit("unpipe",this,m),this);if(!o){var S=l.pipes,U=l.pipesCount;l.pipes=null,l.pipesCount=0,l.flowing=!1;for(var P=0;P<U;P++)S[P].emit("unpipe",this,{hasUnpiped:!1});return this}var B=N(l.pipes,o);return B===-1?this:(l.pipes.splice(B,1),l.pipesCount-=1,l.pipesCount===1&&(l.pipes=l.pipes[0]),o.emit("unpipe",this,m),this)},F.prototype.on=function(o,l){var m=r.prototype.on.call(this,o,l),S=this._readableState;return o==="data"?(S.readableListening=this.listenerCount("readable")>0,S.flowing!==!1&&this.resume()):o==="readable"&&!S.endEmitted&&!S.readableListening&&(S.readableListening=S.needReadable=!0,S.flowing=!1,S.emittedReadable=!1,f("on readable",S.length,S.reading),S.length?Z(this):S.reading||I.nextTick(me,this)),m},F.prototype.addListener=F.prototype.on,F.prototype.removeListener=function(o,l){var m=r.prototype.removeListener.call(this,o,l);return o==="readable"&&I.nextTick(_t,this),m},F.prototype.removeAllListeners=function(o){var l=r.prototype.removeAllListeners.apply(this,arguments);return(o==="readable"||o===void 0)&&I.nextTick(_t,this),l};function _t(o){var l=o._readableState;l.readableListening=o.listenerCount("readable")>0,l.resumeScheduled&&!l.paused?l.flowing=!0:o.listenerCount("data")>0&&o.resume()}function me(o){f("readable nexttick read 0"),o.read(0)}F.prototype.resume=function(){var o=this._readableState;return o.flowing||(f("resume"),o.flowing=!o.readableListening,or(this,o)),o.paused=!1,this};function or(o,l){l.resumeScheduled||(l.resumeScheduled=!0,I.nextTick(lr,o,l))}function lr(o,l){f("resume",l.reading),l.reading||o.read(0),l.resumeScheduled=!1,o.emit("resume"),d(o),l.flowing&&!l.reading&&o.read(0)}F.prototype.pause=function(){return f("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(f("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function d(o){var l=o._readableState;for(f("flow",l.flowing);l.flowing&&o.read()!==null;);}F.prototype.wrap=function(o){var l=this,m=this._readableState,S=!1;o.on("end",function(){if(f("wrapped end"),m.decoder&&!m.ended){var B=m.decoder.end();B&&B.length&&l.push(B)}l.push(null)}),o.on("data",function(B){if(f("wrapped data"),m.decoder&&(B=m.decoder.write(B)),!(m.objectMode&&B==null)&&!(!m.objectMode&&(!B||!B.length))){var Ce=l.push(B);Ce||(S=!0,o.pause())}});for(var U in o)this[U]===void 0&&typeof o[U]=="function"&&(this[U]=function(Ce){return function(){return o[Ce].apply(o,arguments)}}(U));for(var P=0;P<j.length;P++)o.on(j[P],this.emit.bind(this,j[P]));return this._read=function(B){f("wrapped _read",B),S&&(S=!1,o.resume())},this},typeof Symbol=="function"&&(F.prototype[Symbol.asyncIterator]=function(){return R===void 0&&(R=Ya()),R(this)}),Object.defineProperty(F.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(F.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(F.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(l){this._readableState&&(this._readableState.flowing=l)}}),F._fromList=h,Object.defineProperty(F.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function h(o,l){if(l.length===0)return null;var m;return l.objectMode?m=l.buffer.shift():!o||o>=l.length?(l.decoder?m=l.buffer.join(""):l.buffer.length===1?m=l.buffer.first():m=l.buffer.concat(l.length),l.buffer.clear()):m=l.buffer.consume(o,l.decoder),m}function x(o){var l=o._readableState;f("endReadable",l.endEmitted),l.endEmitted||(l.ended=!0,I.nextTick(M,l,o))}function M(o,l){if(f("endReadableNT",o.endEmitted,o.length),!o.endEmitted&&o.length===0&&(o.endEmitted=!0,l.readable=!1,l.emit("end"),o.autoDestroy)){var m=l._writableState;(!m||m.autoDestroy&&m.finished)&&l.destroy()}}typeof Symbol=="function"&&(F.from=function(o,l){return A===void 0&&(A=za()),A(F,o,l)});function N(o,l){for(var m=0,S=o.length;m<S;m++)if(o[m]===l)return m;return-1}return Jt}var Bi=le,lt=we.codes,qa=lt.ERR_METHOD_NOT_IMPLEMENTED,$a=lt.ERR_MULTIPLE_CALLBACK,Ga=lt.ERR_TRANSFORM_ALREADY_TRANSFORMING,Va=lt.ERR_TRANSFORM_WITH_LENGTH_0,ut=Te();ce.exports(le,ut);function Ha(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(i===null)return this.emit("error",new $a);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function le(t){if(!(this instanceof le))return new le(t);ut.call(this,t),this._transformState={afterTransform:Ha.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",Xa)}function Xa(){var t=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(e,r){Li(t,e,r)}):Li(this,null,null)}le.prototype.push=function(t,e){return this._transformState.needTransform=!1,ut.prototype.push.call(this,t,e)},le.prototype._transform=function(t,e,r){r(new qa("_transform()"))},le.prototype._write=function(t,e,r){var i=this._transformState;if(i.writecb=r,i.writechunk=t,i.writeencoding=e,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},le.prototype._read=function(t){var e=this._transformState;e.writechunk!==null&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},le.prototype._destroy=function(t,e){ut.prototype._destroy.call(this,t,function(r){e(r)})};function Li(t,e,r){if(e)return t.emit("error",e);if(r!=null&&t.push(r),t._writableState.length)throw new Va;if(t._transformState.transforming)throw new Ga;return t.push(null)}var Ka=Le,Ui=Bi;ce.exports(Le,Ui);function Le(t){if(!(this instanceof Le))return new Le(t);Ui.call(this,t)}Le.prototype._transform=function(t,e,r){r(null,t)};var Qt;function Ja(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var Wi=we.codes,Qa=Wi.ERR_MISSING_ARGS,Za=Wi.ERR_STREAM_DESTROYED;function ji(t){if(t)throw t}function es(t){return t.setHeader&&typeof t.abort=="function"}function ts(t,e,r,i){i=Ja(i);var n=!1;t.on("close",function(){n=!0}),Qt===void 0&&(Qt=Ht),Qt(t,{readable:e,writable:r},function(a){if(a)return i(a);n=!0,i()});var s=!1;return function(a){if(!n&&!s){if(s=!0,es(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();i(a||new Za("pipe"))}}}function Yi(t){t()}function rs(t,e){return t.pipe(e)}function is(t){return!t.length||typeof t[t.length-1]!="function"?ji:t.pop()}function ns(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var i=is(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new Qa("streams");var n,s=e.map(function(a,u){var f=u<e.length-1,_=u>0;return ts(a,f,_,function(b){n||(n=b),b&&s.forEach(Yi),!f&&(s.forEach(Yi),i(n))})});return e.reduce(rs)}var as=ns;(function(t,e){e=t.exports=Ii(),e.Stream=e,e.Readable=e,e.Writable=Si(),e.Duplex=Te(),e.Transform=Bi,e.PassThrough=Ka,e.finished=Ht,e.pipeline=as})(Ct,Ct.exports);var zi=Ct.exports.Transform,qi=ce.exports;function Se(t){zi.call(this,t),this._destroyed=!1}qi(Se,zi),Se.prototype.destroy=function(t){if(!this._destroyed){this._destroyed=!0;var e=this;I.nextTick(function(){t&&e.emit("error",t),e.emit("close")})}};function ss(t,e,r){r(null,t)}function Zt(t){return function(e,r,i){return typeof e=="function"&&(i=r,r=e,e={}),typeof r!="function"&&(r=ss),typeof i!="function"&&(i=null),t(e,r,i)}}St.exports=Zt(function(t,e,r){var i=new Se(t);return i._transform=e,r&&(i._flush=r),i}),St.exports.ctor=Zt(function(t,e,r){function i(n){if(!(this instanceof i))return new i(n);this.options=Object.assign({},t,n),Se.call(this,this.options)}return qi(i,Se),i.prototype._transform=e,r&&(i.prototype._flush=r),i}),St.exports.obj=Zt(function(t,e,r){var i=new Se(Object.assign({objectMode:!0,highWaterMark:16},t));return i._transform=e,r&&(i._flush=r),i});class $i{constructor(e,r=4){this._string=null,this._type="form",this._readOnly=!1,this._context={},this._onChangeFields={},this._keyIdx=0,this._invisibleFields=[],this._fields=e,this._container=new Oe(r,6,!1,"root")}get fields(){return this._fields}get container(){return this._container}get string(){return this._string}get type(){return this._type}get readOnly(){return this._readOnly}set readOnly(e){this._readOnly=e}get context(){return this._context}set context(e){this._context=e}get onChangeFields(){return this._onChangeFields}set onChangeFields(e){this._onChangeFields=e}get keyIdx(){return this._keyIdx}set keyIdx(e){this._keyIdx=e}get invisibleFields(){return this._invisibleFields}set invisibleFields(e){this._invisibleFields=e}parse(e,r){var i;const{values:n={},readOnly:s=!1}=r||{},a=$e(e).filter(u=>u.tagName==="form")[0];this._string=((i=a.attributes)==null?void 0:i.string)||null,this._string&&(this._string=G(this._string)),this._readOnly=s,this._context=n.id?{active_id:n.id,active_ids:[n.id]}:{},this._invisibleFields=[],this.parseNode({fields:a.children,container:this._container,values:n})}parseNode({fields:e,container:r,values:i}){const n=new Rt;e.filter(s=>typeof s=="object").forEach(s=>{var a,u;const{tagName:f,attributes:_,children:b}=s;let w=f,g=_;if(f==="field"){const{name:R,widget:A}=_;if(A)w=A;else if(R){if(!this._fields[R])throw new Error(`Field ${R} doesn't exist in fields defintion`);w=this._fields[R].type}g={...this._fields[R],..._,fieldsWidgetType:this._fields[R].type}}const E=sn({tagAttributes:g,values:i,fields:this._fields});let v;f==="button"&&g.states?v=un({states:g.states,values:i}):v=ln({fieldName:g.name,values:i,fields:this._fields});const T=Nr({context:g.context||((a=this._fields[g.name])==null?void 0:a.context),values:i,fields:this._fields});g.on_change&&(this._onChangeFields[g.name]=cn(g.on_change));let D;Gi(g.domain)&&(D=g.domain),Gi((u=this._fields[g.name])==null?void 0:u.domain)&&(D=this._fields[g.name].domain),this._keyIdx=this._keyIdx+1;const c={...E,...v,context:T,domain:D,key:`${this._keyIdx}`},p=n.createWidget(w,c);p.invisible&&p instanceof W&&this._invisibleFields.push(c.name),p instanceof de&&this.parseNode({fields:b,container:p.container,values:i}),p.readOnly=p.readOnly||this.readOnly,r.addWidget(p)})}findById(e){return this.container.findById(e)}}function Gi(t){return t?Array.isArray(t)&&t.length>0?!0:typeof t=="string"&&t!==""&&t!=="[]":!1}class os{constructor(e){this._columns=[],this._string=null,this._type="tree",this._colors=null,this._editable=null,this._fields=e}get fields(){return this._fields}get columns(){return this._columns}get string(){return this._string}get type(){return this._type}get colors(){return this._colors}get editable(){return this._editable}parse(e){const r=$e(e).filter(n=>n.tagName==="tree")[0];this._string=r.attributes.string||null,this._string&&(this._string=G(this._string)),this._colors=r.attributes.colors||null,this._colors&&(this._colors=G(this._colors)),this._editable=r.attributes.editable||null;const i=new Rt;r.children.forEach(n=>{const{tagName:s,attributes:a}=n;let u=null;if(s==="field"){const{name:f,widget:_}=a;let b=a;if(f){if(!this._fields[f])throw new Error(`Field ${f} doesn't exist in fields defintion`);const w=this._fields[f];u=w.type,(Array.isArray(w==null?void 0:w.domain)&&(w==null?void 0:w.domain.length)===0||(w==null?void 0:w.domain)===!1)&&a.domain&&a.domain.length>0&&delete w.domain,b={...w,...a,fieldsWidgetType:w==null?void 0:w.type}}if(_&&(u=_),!b.invisible){const w=i.createWidget(u,b);this._columns.push(w)}}})}findById(e){return this._columns.find(r=>{if(r.findById)return r.findById(e)})}}class ls{get searchFields(){return this._searchFields}get fields(){return this._fields}get simpleSearchContainer(){return this._simpleSearchContainer}get advancedSearchContainer(){return this._advancedSearchContainer}get formXml(){return this._formXml}constructor(e,r,i,n=8){this._searchFields=e,this._fields=r,this._formXml=i,this._simpleSearchContainer=new Oe(n),this._advancedSearchContainer=new Oe(n)}parse(){const e=new Rt,r=new $i(this.fields);r.parse(this.formXml),this.parseFields(this.searchFields.primary,e,r).forEach(s=>{this.simpleSearchContainer.addWidget(s,{addLabel:!1}),this.advancedSearchContainer.addWidget(s,{addLabel:!1})}),this.parseFields(this.searchFields.secondary,e,r).forEach(s=>{this.advancedSearchContainer.addWidget(s,{addLabel:!1})})}parseFields(e,r,i){return e.map(n=>{var s,a;const u={...this.fields[n],name:n,colspan:2},{type:f}=u,_=(a=(s=i.findById(n))==null?void 0:s.type)!=null?a:f;return r.createWidget(_,u)})}findById(e){return this.advancedSearchContainer.findById(e)}}const us=({domain:t,widgetFieldName:e})=>{const r=[];return t.forEach(i=>{if(!Array.isArray(i))return;const[n,s,a]=i;let u,f;n.indexOf(".")!==-1?(u=n.substr(0,n.indexOf(".")),f=n.substr(n.indexOf(".")+1,n.length-1)):(u=n,f="id"),u===e&&r.push([f,s,a])}),r};class Vi{constructor(e){this._action_id=null,this._position=null,e.action_id&&(this._action_id=e.action_id),e.position&&(this._position=e.position)}get action_id(){return this._action_id}get position(){return this._position}}class fs{constructor(e){this._string=null,this._items=[];const r=$e(e).filter(n=>n.tagName==="dashboard")[0];this._string=r.attributes.string||null;const{children:i}=r;i.forEach(n=>{n.tagName==="dashboard_item"&&this._items.push(new Vi(n.attributes))})}get string(){return this._string}get items(){return this._items}}class er{constructor(e){this._string=null,this._timerange=null,this._string=e.attributes.string||null,this._timerange=e.attributes.timerange||null}get string(){return this._string}get type(){return this._type}get timerange(){return this._timerange}}const cs=t=>t===1||t==="1"||t===!0||t==="True";class tr extends er{constructor(e,r){super(r),this._color=null,this._icon=null,this._totalDomain=null,this._showPercent=!1,this._suffix=null,this._type=e,this._color=r.attributes.color||null,this._color&&(this._color=G(this._color)),this._icon=r.attributes.icon||null,this._icon&&(this._icon=G(this._icon)),this._suffix=r.attributes.suffix||null,this._totalDomain=r.attributes.totalDomain||null,this._showPercent=cs(r.attributes.showPercent)}get color(){return this._color}get icon(){return this._icon}get totalDomain(){return this._totalDomain}get showPercent(){return this._showPercent}get suffix(){return this._suffix}}class Hi extends tr{constructor(e,r){super(e,r);const{children:i}=r;i.forEach(n=>{if(n.tagName==="field"){const s=n.attributes.name,a=n.attributes.operator;this._field=s||void 0,this._operator=a}})}get field(){return this._field}get operator(){return this._operator}}const hs=t=>{const e=[];let r;if(t.forEach(i=>{if(i.tagName==="field"){const n=i.attributes.axis,s=i.attributes.operator,a=i.attributes.name,u=i.attributes.label||void 0,f=i.attributes.stacked||void 0;if(!n)throw new Error(`Field ${a} doesn't have an axis`);if(!a)throw new Error("Missing name attribute for field");n==="x"?r=new Ki({name:a}):n==="y"&&e.push(new Xi({name:a,operator:s,label:u,stacked:f}))}}),!r)throw new Error("No x axis found");if(!e.length)throw new Error("No y axis found. At least we need one y axis");return{x:r,y:e}};class ft extends er{constructor(e,r){super(r),this._type=e;const i=hs(r.children);this._x=i.x,this._y=i.y}get x(){return this._x}get y(){return this._y}}const ds={indicator:tr,indicatorField:Hi,line:ft,bar:ft,pie:ft},gs=t=>{const e=$e(t).filter(n=>n.tagName==="graph")[0],r=e.attributes.type;if(!r)throw new Error(`${r} is not a valid graph`);const i=ds[r];if(!i)throw new Error(`${r} not found as a GraphModel`);return new i(r,e)};class rr{get name(){return this._name}get axis(){return this._axis}constructor({name:e,axis:r}){this._name=e,this._axis=r}}class Xi extends rr{constructor({name:e,operator:r,label:i,stacked:n}){super({name:e,axis:"y"}),this._operator=r,this._label=i,this._stacked=n}get operator(){return this._operator}get label(){return this._label}get stacked(){return this._stacked}}class Ki extends rr{constructor({name:e}){super({name:e,axis:"x"})}}const _s=({ooui:t})=>{const r=[t.x.name];return t.y?(t.y.forEach(i=>{i.operator!=="count"&&!r.includes(i.name)&&r.push(i.name),i.label&&!r.includes(i.label)&&r.push(i.label)}),r):[]};function ir({fields:t,values:e,fieldName:r}){const i=t[r],n=e[r];if(!i)throw new Error(`Field ${r} not found`);if(i.type==="many2one")return n?{value:n[0],label:n[1]}:{value:!1,label:void 0};if(i.type==="selection"){const a=i.selection.find(u=>u[0]===n);return a?{value:n,label:a[1]}:{value:!1,label:void 0}}return{value:n,label:n}}const ps=Object.freeze(Object.defineProperty({__proto__:null,getFieldsToRetrieve:_s,getValueAndLabelForField:ir},Symbol.toStringTag,{value:"Module"}));function ys({values:t,timerange:e}){const r=ms({values:t,timerange:e});return ws({values:r,timerange:e})}function ws({values:t,timerange:e}){let r=[];const i=Qi({values:t,groupBy:"type-stacked"}),n=`${e}s`;return Object.keys(i).forEach(a=>{const u=i[a];for(let f=0;f<u.length;f++){const _=u[f];if(r.push(_),f===u.length-1)return;const b=_.x,w=u[f+1].x;if(!Ji([b,w],n)){const g=bs({dates:[b,w],timerange:e});r=r.concat(g.map(E=>({x:E,value:0,type:_.type,stacked:_.stacked})))}}}),r.sort((a,u)=>a.x<u.x?-1:a.x>u.x?1:0)}function bs({dates:t,timerange:e}){const r=[],i=`${e}s`;if(t.length===1)return t;const n=t.sort((s,a)=>s<a?-1:s>a?1:0);for(let s=0;s<n.length-1;s++){const a=n[s],u=n[s+1];if(!Ji([a,u],i)){let f=Me.default(a,ct(i)).add(1,i),_=Me.default(u,ct(i));for(;f.isBefore(_);)r.push(f.format(ct(i))),f.add(1,i)}}return r}function ms({values:t,timerange:e}){const r=vs({values:t,timerange:e});let i=[];const n=Qi({values:r,groupBy:"all"});return Object.keys(n).forEach(s=>{const a=n[s],u=a[0].operator==="count"?"+":a[0].operator,f=ht({values:a.map(_=>_.value),operator:u});i.push({...a[0],value:f})}),i}function vs({values:t,timerange:e}){return t.map(r=>({...r,x:Es({date:r.x,timerange:e})}))}function Es({date:t,timerange:e}){let r=xs(t);const i=Me.default(t,r);switch(e){case"hour":{r="YYYY-MM-DD HH:00";break}case"day":{r="YYYY-MM-DD";break}case"week":{r="YYYY-WW";break}case"month":{r="YYYY-MM";break}case"year":{r="YYYY";break}}return i.format(r)}function xs(t){return t.indexOf(":")?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD"}function Ji(t,e){let r=!1;const i=ct(e);if(t.length===0)return!1;if(t.length===1)return!0;for(let n=0;n<t.length-1;n++){const s=Me.default(t[n],i),u=Me.default(t[n+1],i).diff(s,e);Math.abs(u)===1?r=!0:r=!1}return r}function Qi({values:t,groupBy:e}){const r={};return t.forEach(i=>{const n=i.x,s=i.type,a=i.stacked,u=e==="all"?`${n}-${s}-${a}`:`${s}-${a}`;r[u]||(r[u]=[]),r[u].push(i)}),r}function ct(t){switch(t){default:case"hours":return"YYYY-MM-DD HH:mm";case"days":return"YYYY-MM-DD";case"weeks":return"YYYY-WW";case"months":return"YYYY-MM";case"years":return"YYYY"}}const Rs={count:"count","+":"sum","-":"subtract","*":"multiply",avg:"average",min:"min",max:"max"},Ts=({ooui:t,values:e,fields:r,options:i})=>{const n=ar({fieldName:t.x.name,values:e,fields:r}),s=[];t.y.forEach(g=>{Object.keys(n).forEach(E=>{const v=n[E].label,T=n[E].entries;if(g.label){const D=ar({fieldName:g.label,values:T,fields:r});Object.keys(D).forEach(c=>{const p=D[c].entries,R=D[c].label,A=nr({entries:p,fields:r,fieldName:g.name}),O=ht({values:A,operator:g.operator});s.push({x:v||!1,value:O,type:R,operator:g.operator,stacked:g.stacked})})}else{const D=nr({entries:T,fields:r,fieldName:g.name}),c=ht({values:D,operator:g.operator});s.push({x:v||!1,value:c,type:Zi({yAxis:g,fields:r}),operator:g.operator,stacked:g.stacked})}})});const a=t.y.some(g=>g.label!==void 0),u=t.y.some(g=>g.stacked!==void 0);let _=[...s.sort((g,E)=>g.x<E.x?-1:g.x>E.x?1:0)];u&&t.y.filter(g=>g.stacked!==void 0).length>1&&(_=_.map(g=>({...g,type:`${g.type} - ${g.stacked}`})));let b=[..._];t.type==="pie"&&b.some(g=>g.x===!1)?b=b.map(g=>g.x===!1?{...g,x:(i==null?void 0:i.uninformedString)||"Not informed"}:g):_.some(g=>g.x===!1)&&(b=b.filter(g=>g.x!==!1));let w=b;return t.timerange?w=ys({values:w,timerange:t.timerange}):t.type=="pie"&&(w=b.sort((g,E)=>E.value-g.value)),{data:w,isGroup:u||a,isStack:u}};function nr({entries:t,fieldName:e,fields:r}){return t.map(i=>ir({fieldName:e,values:i,fields:r})).map(({value:i,label:n})=>n)}function ht({operator:t,values:e}){switch(t){case"count":return e.length;case"+":return dt(e.reduce(function(r,i){return r+i}));case"-":return dt(e.reduce(function(r,i){return r-i}));case"*":return dt(e.reduce(function(r,i){return r*i}));case"avg":{const i=e.reduce((n,s)=>n+s,0)/e.length||0;return dt(i)}case"min":return Math.min(...e);case"max":return Math.max(...e)}}function dt(t){return Math.round((t+Number.EPSILON)*100)/100}function ar({fieldName:t,fields:e,values:r}){const i={};return r.forEach(n=>{const{value:s,label:a}=ir({fields:e,values:n,fieldName:t});i[s]||(i[s]={label:a,entries:[]}),i[s].entries.push(n)}),i}function Ss(t){let e=[];return Object.keys(t).forEach(r=>{const i=t[r];e=e.concat(i.entries)}),e}function Zi({yAxis:t,fields:e}){const r=e[t.name];return r&&r.string?r.string:t.name}const Cs=Object.freeze(Object.defineProperty({__proto__:null,labelsForOperator:Rs,processGraphData:Ts,getValuesForYField:nr,getValueForOperator:ht,getValuesGroupedByField:ar,getAllObjectsInGroupedValues:Ss,getYAxisFieldname:Zi},Symbol.toStringTag,{value:"Module"}));C.Binary=Tr,C.Boolean=vt,C.Button=gr,C.ButtonGroup=_r,C.Char=ze,C.CodeEditor=Pr,C.Container=Oe,C.ContainerWidget=de,C.Dashboard=fs,C.DashboardItem=Vi,C.Date=mr,C.DateTime=vr,C.Field=W,C.Float=qe,C.FloatTime=wr,C.Form=$i,C.Graph=er,C.GraphAxis=rr,C.GraphChart=ft,C.GraphIndicator=tr,C.GraphIndicatorField=Hi,C.GraphXAxis=Ki,C.GraphYAxis=Xi,C.Group=dr,C.Image=Sr,C.Indicator=Ar,C.Integer=yr,C.Label=wt,C.Many2many=Er,C.Many2one=pr,C.MultiCheckbox=xt,C.NewLine=yt,C.Notebook=bt,C.One2many=Et,C.Page=hr,C.ProgressBar=br,C.Radio=Mr,C.Reference=Rr,C.SearchFilter=ls,C.Selection=ve,C.Separator=xr,C.Steps=kr,C.Switch=Or,C.Tag=Dr,C.Tags=Fr,C.Text=mt,C.Timeline=Cr,C.Tree=os,C.Widget=he,C.graphFieldUtils=ps,C.graphProcessor=Cs,C.parseContext=Nr,C.parseGraph=gs,C.transformDomainForChildWidget=us,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
20
+ `)+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function Bt(t){return Array.isArray(t)}function nt(t){return typeof t=="boolean"}function ke(t){return t===null}function hi(t){return t==null}function Lt(t){return typeof t=="number"}function Pe(t){return typeof t=="string"}function di(t){return typeof t=="symbol"}function ie(t){return t===void 0}function Ne(t){return ye(t)&&Ut(t)==="[object RegExp]"}function ye(t){return typeof t=="object"&&t!==null}function at(t){return ye(t)&&Ut(t)==="[object Date]"}function Ie(t){return ye(t)&&(Ut(t)==="[object Error]"||t instanceof Error)}function Be(t){return typeof t=="function"}function _i(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||typeof t>"u"}function gi(t){return y.isBuffer(t)}function Ut(t){return Object.prototype.toString.call(t)}function Wt(t){return t<10?"0"+t.toString(10):t.toString(10)}var xa=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ra(){var t=new Date,e=[Wt(t.getHours()),Wt(t.getMinutes()),Wt(t.getSeconds())].join(":");return[t.getDate(),xa[t.getMonth()],e].join(" ")}function pi(){console.log("%s - %s",Ra(),tt.apply(null,arguments))}function jt(t,e){if(!e||!ye(e))return t;for(var r=Object.keys(e),i=r.length;i--;)t[r[i]]=e[r[i]];return t}function yi(t,e){return Object.prototype.hasOwnProperty.call(t,e)}const wi=Tt(Object.freeze(Object.defineProperty({__proto__:null,format:tt,deprecate:kt,debuglog:ci,inspect:re,isArray:Bt,isBoolean:nt,isNull:ke,isNullOrUndefined:hi,isNumber:Lt,isString:Pe,isSymbol:di,isUndefined:ie,isRegExp:Ne,isObject:ye,isDate:at,isError:Ie,isFunction:Be,isPrimitive:_i,isBuffer:gi,log:pi,inherits:fi,_extend:jt,default:{inherits:fi,_extend:jt,log:pi,isBuffer:gi,isPrimitive:_i,isFunction:Be,isError:Ie,isDate:at,isObject:ye,isRegExp:Ne,isUndefined:ie,isSymbol:di,isString:Pe,isNumber:Lt,isNullOrUndefined:hi,isNull:ke,isBoolean:nt,isArray:Bt,inspect:re,deprecate:kt,format:tt,debuglog:ci}},Symbol.toStringTag,{value:"Module"})));var Yt,bi;function Ta(){if(bi)return Yt;bi=1;function t(_,E){var v=Object.keys(_);if(Object.getOwnPropertySymbols){var T=Object.getOwnPropertySymbols(_);E&&(T=T.filter(function(D){return Object.getOwnPropertyDescriptor(_,D).enumerable})),v.push.apply(v,T)}return v}function e(_){for(var E=1;E<arguments.length;E++){var v=arguments[E]!=null?arguments[E]:{};E%2?t(Object(v),!0).forEach(function(T){r(_,T,v[T])}):Object.getOwnPropertyDescriptors?Object.defineProperties(_,Object.getOwnPropertyDescriptors(v)):t(Object(v)).forEach(function(T){Object.defineProperty(_,T,Object.getOwnPropertyDescriptor(v,T))})}return _}function r(_,E,v){return E in _?Object.defineProperty(_,E,{value:v,enumerable:!0,configurable:!0,writable:!0}):_[E]=v,_}function i(_,E){if(!(_ instanceof E))throw new TypeError("Cannot call a class as a function")}function n(_,E){for(var v=0;v<E.length;v++){var T=E[v];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(_,T.key,T)}}function s(_,E,v){return E&&n(_.prototype,E),v&&n(_,v),_}var a=et,u=a.Buffer,f=wi,g=f.inspect,b=g&&g.custom||"inspect";function w(_,E,v){u.prototype.copy.call(_,E,v)}return Yt=function(){function _(){i(this,_),this.head=null,this.tail=null,this.length=0}return s(_,[{key:"push",value:function(v){var T={data:v,next:null};this.length>0?this.tail.next=T:this.head=T,this.tail=T,++this.length}},{key:"unshift",value:function(v){var T={data:v,next:this.head};this.length===0&&(this.tail=T),this.head=T,++this.length}},{key:"shift",value:function(){if(this.length!==0){var v=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,v}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(v){if(this.length===0)return"";for(var T=this.head,D=""+T.data;T=T.next;)D+=v+T.data;return D}},{key:"concat",value:function(v){if(this.length===0)return u.alloc(0);for(var T=u.allocUnsafe(v>>>0),D=this.head,c=0;D;)w(D.data,T,c),c+=D.data.length,D=D.next;return T}},{key:"consume",value:function(v,T){var D;return v<this.head.data.length?(D=this.head.data.slice(0,v),this.head.data=this.head.data.slice(v)):v===this.head.data.length?D=this.shift():D=T?this._getString(v):this._getBuffer(v),D}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(v){var T=this.head,D=1,c=T.data;for(v-=c.length;T=T.next;){var p=T.data,R=v>p.length?p.length:v;if(R===p.length?c+=p:c+=p.slice(0,v),v-=R,v===0){R===p.length?(++D,T.next?this.head=T.next:this.head=this.tail=null):(this.head=T,T.data=p.slice(R));break}++D}return this.length-=D,c}},{key:"_getBuffer",value:function(v){var T=u.allocUnsafe(v),D=this.head,c=1;for(D.data.copy(T),v-=D.data.length;D=D.next;){var p=D.data,R=v>p.length?p.length:v;if(p.copy(T,T.length-v,0,R),v-=R,v===0){R===p.length?(++c,D.next?this.head=D.next:this.head=this.tail=null):(this.head=D,D.data=p.slice(R));break}++c}return this.length-=c,T}},{key:b,value:function(v,T){return g(this,e({},T,{depth:0,customInspect:!1}))}}]),_}(),Yt}function Sa(t,e){var r=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return i||n?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,I.nextTick(zt,this,t)):I.nextTick(zt,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(s){!e&&s?r._writableState?r._writableState.errorEmitted?I.nextTick(st,r):(r._writableState.errorEmitted=!0,I.nextTick(mi,r,s)):I.nextTick(mi,r,s):e?(I.nextTick(st,r),e(s)):I.nextTick(st,r)}),this)}function mi(t,e){zt(t,e),st(t)}function st(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function Ca(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function zt(t,e){t.emit("error",e)}function Aa(t,e){var r=t._readableState,i=t._writableState;r&&r.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit("error",e)}var vi={destroy:Sa,undestroy:Ca,errorOrDestroy:Aa},we={};function Fa(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var Ei={};function X(t,e,r){r||(r=Error);function i(s,a,u){return typeof e=="string"?e:e(s,a,u)}var n=function(s){Fa(a,s);function a(u,f,g){return s.call(this,i(u,f,g))||this}return a}(r);n.prototype.name=r.name,n.prototype.code=t,Ei[t]=n}function xi(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map(function(i){return String(i)}),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:r===2?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}else return"of ".concat(e," ").concat(String(t))}function Da(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function Ma(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function Oa(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}X("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError),X("ERR_INVALID_ARG_TYPE",function(t,e,r){var i;typeof e=="string"&&Da(e,"not ")?(i="must not be",e=e.replace(/^not /,"")):i="must be";var n;if(Ma(t," argument"))n="The ".concat(t," ").concat(i," ").concat(xi(e,"type"));else{var s=Oa(t,".")?"property":"argument";n='The "'.concat(t,'" ').concat(s," ").concat(i," ").concat(xi(e,"type"))}return n+=". Received type ".concat(typeof r),n},TypeError),X("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),X("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"}),X("ERR_STREAM_PREMATURE_CLOSE","Premature close"),X("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"}),X("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),X("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),X("ERR_STREAM_WRITE_AFTER_END","write after end"),X("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),X("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError),X("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),we.codes=Ei;var ka=we.codes.ERR_INVALID_OPT_VALUE;function Pa(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function Na(t,e,r,i){var n=Pa(e,i,r);if(n!=null){if(!(isFinite(n)&&Math.floor(n)===n)||n<0){var s=i?r:"highWaterMark";throw new ka(s,n)}return Math.floor(n)}return t.objectMode?16:16*1024}var Ri={getHighWaterMark:Na},ce={exports:{}};typeof Object.create=="function"?ce.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:ce.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}};var Ia=Ba;function Ba(t,e){if(qt("noDeprecation"))return t;var r=!1;function i(){if(!r){if(qt("throwDeprecation"))throw new Error(e);qt("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return i}function qt(t){try{if(!Ve.localStorage)return!1}catch{return!1}var e=Ve.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}var $t,Ti;function Si(){if(Ti)return $t;Ti=1,$t=k;function t(d){var h=this;this.next=null,this.entry=null,this.finish=function(){lr(h,d)}}var e;k.WritableState=j;var r={deprecate:Ia},i=qr,n=et.Buffer,s=Ve.Uint8Array||function(){};function a(d){return n.from(d)}function u(d){return n.isBuffer(d)||d instanceof s}var f=vi,g=Ri,b=g.getHighWaterMark,w=we.codes,_=w.ERR_INVALID_ARG_TYPE,E=w.ERR_METHOD_NOT_IMPLEMENTED,v=w.ERR_MULTIPLE_CALLBACK,T=w.ERR_STREAM_CANNOT_PIPE,D=w.ERR_STREAM_DESTROYED,c=w.ERR_STREAM_NULL_VALUES,p=w.ERR_STREAM_WRITE_AFTER_END,R=w.ERR_UNKNOWN_ENCODING,A=f.errorOrDestroy;ce.exports(k,i);function O(){}function j(d,h,x){e=e||Te(),d=d||{},typeof x!="boolean"&&(x=h instanceof e),this.objectMode=!!d.objectMode,x&&(this.objectMode=this.objectMode||!!d.writableObjectMode),this.highWaterMark=b(this,d,"writableHighWaterMark",x),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var M=d.decodeStrings===!1;this.decodeStrings=!M,this.defaultEncoding=d.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(N){Q(h,N)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=d.emitClose!==!1,this.autoDestroy=!!d.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}j.prototype.getBuffer=function(){for(var h=this.bufferedRequest,x=[];h;)x.push(h),h=h.next;return x},function(){try{Object.defineProperty(j.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var q;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(q=Function.prototype[Symbol.hasInstance],Object.defineProperty(k,Symbol.hasInstance,{value:function(h){return q.call(this,h)?!0:this!==k?!1:h&&h._writableState instanceof j}})):q=function(h){return h instanceof this};function k(d){e=e||Te();var h=this instanceof e;if(!h&&!q.call(k,this))return new k(d);this._writableState=new j(d,this,h),this.writable=!0,d&&(typeof d.write=="function"&&(this._write=d.write),typeof d.writev=="function"&&(this._writev=d.writev),typeof d.destroy=="function"&&(this._destroy=d.destroy),typeof d.final=="function"&&(this._final=d.final)),i.call(this)}k.prototype.pipe=function(){A(this,new T)};function F(d,h){var x=new p;A(d,x),I.nextTick(h,x)}function L(d,h,x,M){var N;return x===null?N=new c:typeof x!="string"&&!h.objectMode&&(N=new _("chunk",["string","Buffer"],x)),N?(A(d,N),I.nextTick(M,N),!1):!0}k.prototype.write=function(d,h,x){var M=this._writableState,N=!1,o=!M.objectMode&&u(d);return o&&!n.isBuffer(d)&&(d=a(d)),typeof h=="function"&&(x=h,h=null),o?h="buffer":h||(h=M.defaultEncoding),typeof x!="function"&&(x=O),M.ending?F(this,x):(o||L(this,M,d,x))&&(M.pendingcb++,N=ne(this,M,o,d,h,x)),N},k.prototype.cork=function(){this._writableState.corked++},k.prototype.uncork=function(){var d=this._writableState;d.corked&&(d.corked--,!d.writing&&!d.corked&&!d.bufferProcessing&&d.bufferedRequest&&ae(this,d))},k.prototype.setDefaultEncoding=function(h){if(typeof h=="string"&&(h=h.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((h+"").toLowerCase())>-1))throw new R(h);return this._writableState.defaultEncoding=h,this},Object.defineProperty(k.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function V(d,h,x){return!d.objectMode&&d.decodeStrings!==!1&&typeof h=="string"&&(h=n.from(h,x)),h}Object.defineProperty(k.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function ne(d,h,x,M,N,o){if(!x){var l=V(h,M,N);M!==l&&(x=!0,N="buffer",M=l)}var m=h.objectMode?1:M.length;h.length+=m;var S=h.length<h.highWaterMark;if(S||(h.needDrain=!0),h.writing||h.corked){var U=h.lastBufferedRequest;h.lastBufferedRequest={chunk:M,encoding:N,isBuf:x,callback:o,next:null},U?U.next=h.lastBufferedRequest:h.bufferedRequest=h.lastBufferedRequest,h.bufferedRequestCount+=1}else K(d,h,!1,m,M,N,o);return S}function K(d,h,x,M,N,o,l){h.writelen=M,h.writecb=l,h.writing=!0,h.sync=!0,h.destroyed?h.onwrite(new D("write")):x?d._writev(N,h.onwrite):d._write(N,o,h.onwrite),h.sync=!1}function Y(d,h,x,M,N){--h.pendingcb,x?(I.nextTick(N,M),I.nextTick(me,d,h),d._writableState.errorEmitted=!0,A(d,M)):(N(M),d._writableState.errorEmitted=!0,A(d,M),me(d,h))}function J(d){d.writing=!1,d.writecb=null,d.length-=d.writelen,d.writelen=0}function Q(d,h){var x=d._writableState,M=x.sync,N=x.writecb;if(typeof N!="function")throw new v;if(J(x),h)Y(d,x,M,h,N);else{var o=_t(x)||d.destroyed;!o&&!x.corked&&!x.bufferProcessing&&x.bufferedRequest&&ae(d,x),M?I.nextTick(Z,d,x,o,N):Z(d,x,o,N)}}function Z(d,h,x,M){x||be(d,h),h.pendingcb--,M(),me(d,h)}function be(d,h){h.length===0&&h.needDrain&&(h.needDrain=!1,d.emit("drain"))}function ae(d,h){h.bufferProcessing=!0;var x=h.bufferedRequest;if(d._writev&&x&&x.next){var M=h.bufferedRequestCount,N=new Array(M),o=h.corkedRequestsFree;o.entry=x;for(var l=0,m=!0;x;)N[l]=x,x.isBuf||(m=!1),x=x.next,l+=1;N.allBuffers=m,K(d,h,!0,h.length,N,"",o.finish),h.pendingcb++,h.lastBufferedRequest=null,o.next?(h.corkedRequestsFree=o.next,o.next=null):h.corkedRequestsFree=new t(h),h.bufferedRequestCount=0}else{for(;x;){var S=x.chunk,U=x.encoding,P=x.callback,B=h.objectMode?1:S.length;if(K(d,h,!1,B,S,U,P),x=x.next,h.bufferedRequestCount--,h.writing)break}x===null&&(h.lastBufferedRequest=null)}h.bufferedRequest=x,h.bufferProcessing=!1}k.prototype._write=function(d,h,x){x(new E("_write()"))},k.prototype._writev=null,k.prototype.end=function(d,h,x){var M=this._writableState;return typeof d=="function"?(x=d,d=null,h=null):typeof h=="function"&&(x=h,h=null),d!=null&&this.write(d,h),M.corked&&(M.corked=1,this.uncork()),M.ending||or(this,M,x),this},Object.defineProperty(k.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function _t(d){return d.ending&&d.length===0&&d.bufferedRequest===null&&!d.finished&&!d.writing}function sr(d,h){d._final(function(x){h.pendingcb--,x&&A(d,x),h.prefinished=!0,d.emit("prefinish"),me(d,h)})}function gt(d,h){!h.prefinished&&!h.finalCalled&&(typeof d._final=="function"&&!h.destroyed?(h.pendingcb++,h.finalCalled=!0,I.nextTick(sr,d,h)):(h.prefinished=!0,d.emit("prefinish")))}function me(d,h){var x=_t(h);if(x&&(gt(d,h),h.pendingcb===0&&(h.finished=!0,d.emit("finish"),h.autoDestroy))){var M=d._readableState;(!M||M.autoDestroy&&M.endEmitted)&&d.destroy()}return x}function or(d,h,x){h.ending=!0,me(d,h),x&&(h.finished?I.nextTick(x):d.once("finish",x)),h.ended=!0,d.writable=!1}function lr(d,h,x){var M=d.entry;for(d.entry=null;M;){var N=M.callback;h.pendingcb--,N(x),M=M.next}h.corkedRequestsFree.next=d}return Object.defineProperty(k.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(h){!this._writableState||(this._writableState.destroyed=h)}}),k.prototype.destroy=f.destroy,k.prototype._undestroy=f.undestroy,k.prototype._destroy=function(d,h){h(d)},$t}var Gt,Ci;function Te(){if(Ci)return Gt;Ci=1;var t=Object.keys||function(g){var b=[];for(var w in g)b.push(w);return b};Gt=a;var e=Ii(),r=Si();ce.exports(a,e);for(var i=t(r.prototype),n=0;n<i.length;n++){var s=i[n];a.prototype[s]||(a.prototype[s]=r.prototype[s])}function a(g){if(!(this instanceof a))return new a(g);e.call(this,g),r.call(this,g),this.allowHalfOpen=!0,g&&(g.readable===!1&&(this.readable=!1),g.writable===!1&&(this.writable=!1),g.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",u)))}Object.defineProperty(a.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(a.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(a.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function u(){this._writableState.ended||I.nextTick(f,this)}function f(g){g.end()}return Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(b){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=b,this._writableState.destroyed=b)}}),Gt}var Vt={},ot={exports:{}},Ai;function La(){return Ai||(Ai=1,function(t,e){var r=et,i=r.Buffer;function n(a,u){for(var f in a)u[f]=a[f]}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(n(r,e),e.Buffer=s);function s(a,u,f){return i(a,u,f)}n(i,s),s.from=function(a,u,f){if(typeof a=="number")throw new TypeError("Argument must not be a number");return i(a,u,f)},s.alloc=function(a,u,f){if(typeof a!="number")throw new TypeError("Argument must be a number");var g=i(a);return u!==void 0?typeof f=="string"?g.fill(u,f):g.fill(u):g.fill(0),g},s.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return i(a)},s.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(a)}}(ot,ot.exports)),ot.exports}var Fi;function Di(){if(Fi)return Vt;Fi=1;var t=La().Buffer,e=t.isEncoding||function(c){switch(c=""+c,c&&c.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(c){if(!c)return"utf8";for(var p;;)switch(c){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return c;default:if(p)return;c=(""+c).toLowerCase(),p=!0}}function i(c){var p=r(c);if(typeof p!="string"&&(t.isEncoding===e||!e(c)))throw new Error("Unknown encoding: "+c);return p||c}Vt.StringDecoder=n;function n(c){this.encoding=i(c);var p;switch(this.encoding){case"utf16le":this.text=w,this.end=_,p=4;break;case"utf8":this.fillLast=f,p=4;break;case"base64":this.text=E,this.end=v,p=3;break;default:this.write=T,this.end=D;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(p)}n.prototype.write=function(c){if(c.length===0)return"";var p,R;if(this.lastNeed){if(p=this.fillLast(c),p===void 0)return"";R=this.lastNeed,this.lastNeed=0}else R=0;return R<c.length?p?p+this.text(c,R):this.text(c,R):p||""},n.prototype.end=b,n.prototype.text=g,n.prototype.fillLast=function(c){if(this.lastNeed<=c.length)return c.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);c.copy(this.lastChar,this.lastTotal-this.lastNeed,0,c.length),this.lastNeed-=c.length};function s(c){return c<=127?0:c>>5===6?2:c>>4===14?3:c>>3===30?4:c>>6===2?-1:-2}function a(c,p,R){var A=p.length-1;if(A<R)return 0;var O=s(p[A]);return O>=0?(O>0&&(c.lastNeed=O-1),O):--A<R||O===-2?0:(O=s(p[A]),O>=0?(O>0&&(c.lastNeed=O-2),O):--A<R||O===-2?0:(O=s(p[A]),O>=0?(O>0&&(O===2?O=0:c.lastNeed=O-3),O):0))}function u(c,p,R){if((p[0]&192)!==128)return c.lastNeed=0,"\uFFFD";if(c.lastNeed>1&&p.length>1){if((p[1]&192)!==128)return c.lastNeed=1,"\uFFFD";if(c.lastNeed>2&&p.length>2&&(p[2]&192)!==128)return c.lastNeed=2,"\uFFFD"}}function f(c){var p=this.lastTotal-this.lastNeed,R=u(this,c);if(R!==void 0)return R;if(this.lastNeed<=c.length)return c.copy(this.lastChar,p,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);c.copy(this.lastChar,p,0,c.length),this.lastNeed-=c.length}function g(c,p){var R=a(this,c,p);if(!this.lastNeed)return c.toString("utf8",p);this.lastTotal=R;var A=c.length-(R-this.lastNeed);return c.copy(this.lastChar,0,A),c.toString("utf8",p,A)}function b(c){var p=c&&c.length?this.write(c):"";return this.lastNeed?p+"\uFFFD":p}function w(c,p){if((c.length-p)%2===0){var R=c.toString("utf16le",p);if(R){var A=R.charCodeAt(R.length-1);if(A>=55296&&A<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=c[c.length-2],this.lastChar[1]=c[c.length-1],R.slice(0,-1)}return R}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=c[c.length-1],c.toString("utf16le",p,c.length-1)}function _(c){var p=c&&c.length?this.write(c):"";if(this.lastNeed){var R=this.lastTotal-this.lastNeed;return p+this.lastChar.toString("utf16le",0,R)}return p}function E(c,p){var R=(c.length-p)%3;return R===0?c.toString("base64",p):(this.lastNeed=3-R,this.lastTotal=3,R===1?this.lastChar[0]=c[c.length-1]:(this.lastChar[0]=c[c.length-2],this.lastChar[1]=c[c.length-1]),c.toString("base64",p,c.length-R))}function v(c){var p=c&&c.length?this.write(c):"";return this.lastNeed?p+this.lastChar.toString("base64",0,3-this.lastNeed):p}function T(c){return c.toString(this.encoding)}function D(c){return c&&c.length?this.write(c):""}return Vt}var Mi=we.codes.ERR_STREAM_PREMATURE_CLOSE;function Ua(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];t.apply(this,i)}}}function Wa(){}function ja(t){return t.setHeader&&typeof t.abort=="function"}function Oi(t,e,r){if(typeof e=="function")return Oi(t,null,e);e||(e={}),r=Ua(r||Wa);var i=e.readable||e.readable!==!1&&t.readable,n=e.writable||e.writable!==!1&&t.writable,s=function(){t.writable||u()},a=t._writableState&&t._writableState.finished,u=function(){n=!1,a=!0,i||r.call(t)},f=t._readableState&&t._readableState.endEmitted,g=function(){i=!1,f=!0,n||r.call(t)},b=function(v){r.call(t,v)},w=function(){var v;if(i&&!f)return(!t._readableState||!t._readableState.ended)&&(v=new Mi),r.call(t,v);if(n&&!a)return(!t._writableState||!t._writableState.ended)&&(v=new Mi),r.call(t,v)},_=function(){t.req.on("finish",u)};return ja(t)?(t.on("complete",u),t.on("abort",w),t.req?_():t.on("request",_)):n&&!t._writableState&&(t.on("end",s),t.on("close",s)),t.on("end",g),t.on("finish",u),e.error!==!1&&t.on("error",b),t.on("close",w),function(){t.removeListener("complete",u),t.removeListener("abort",w),t.removeListener("request",_),t.req&&t.req.removeListener("finish",u),t.removeListener("end",s),t.removeListener("close",s),t.removeListener("finish",u),t.removeListener("end",g),t.removeListener("error",b),t.removeListener("close",w)}}var Ht=Oi,Xt,ki;function Ya(){if(ki)return Xt;ki=1;var t;function e(c,p,R){return p in c?Object.defineProperty(c,p,{value:R,enumerable:!0,configurable:!0,writable:!0}):c[p]=R,c}var r=Ht,i=Symbol("lastResolve"),n=Symbol("lastReject"),s=Symbol("error"),a=Symbol("ended"),u=Symbol("lastPromise"),f=Symbol("handlePromise"),g=Symbol("stream");function b(c,p){return{value:c,done:p}}function w(c){var p=c[i];if(p!==null){var R=c[g].read();R!==null&&(c[u]=null,c[i]=null,c[n]=null,p(b(R,!1)))}}function _(c){I.nextTick(w,c)}function E(c,p){return function(R,A){c.then(function(){if(p[a]){R(b(void 0,!0));return}p[f](R,A)},A)}}var v=Object.getPrototypeOf(function(){}),T=Object.setPrototypeOf((t={get stream(){return this[g]},next:function(){var p=this,R=this[s];if(R!==null)return Promise.reject(R);if(this[a])return Promise.resolve(b(void 0,!0));if(this[g].destroyed)return new Promise(function(q,k){I.nextTick(function(){p[s]?k(p[s]):q(b(void 0,!0))})});var A=this[u],O;if(A)O=new Promise(E(A,this));else{var j=this[g].read();if(j!==null)return Promise.resolve(b(j,!1));O=new Promise(this[f])}return this[u]=O,O}},e(t,Symbol.asyncIterator,function(){return this}),e(t,"return",function(){var p=this;return new Promise(function(R,A){p[g].destroy(null,function(O){if(O){A(O);return}R(b(void 0,!0))})})}),t),v),D=function(p){var R,A=Object.create(T,(R={},e(R,g,{value:p,writable:!0}),e(R,i,{value:null,writable:!0}),e(R,n,{value:null,writable:!0}),e(R,s,{value:null,writable:!0}),e(R,a,{value:p._readableState.endEmitted,writable:!0}),e(R,f,{value:function(j,q){var k=A[g].read();k?(A[u]=null,A[i]=null,A[n]=null,j(b(k,!1))):(A[i]=j,A[n]=q)},writable:!0}),R));return A[u]=null,r(p,function(O){if(O&&O.code!=="ERR_STREAM_PREMATURE_CLOSE"){var j=A[n];j!==null&&(A[u]=null,A[i]=null,A[n]=null,j(O)),A[s]=O;return}var q=A[i];q!==null&&(A[u]=null,A[i]=null,A[n]=null,q(b(void 0,!0))),A[a]=!0}),p.on("readable",_.bind(null,A)),A};return Xt=D,Xt}var Kt,Pi;function za(){return Pi||(Pi=1,Kt=function(){throw new Error("Readable.from is not available in the browser")}),Kt}var Jt,Ni;function Ii(){if(Ni)return Jt;Ni=1,Jt=F;var t;F.ReadableState=k,zr.EventEmitter;var e=function(l,m){return l.listeners(m).length},r=qr,i=et.Buffer,n=Ve.Uint8Array||function(){};function s(o){return i.from(o)}function a(o){return i.isBuffer(o)||o instanceof n}var u=wi,f;u&&u.debuglog?f=u.debuglog("stream"):f=function(){};var g=Ta(),b=vi,w=Ri,_=w.getHighWaterMark,E=we.codes,v=E.ERR_INVALID_ARG_TYPE,T=E.ERR_STREAM_PUSH_AFTER_EOF,D=E.ERR_METHOD_NOT_IMPLEMENTED,c=E.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,p,R,A;ce.exports(F,r);var O=b.errorOrDestroy,j=["error","close","destroy","pause","resume"];function q(o,l,m){if(typeof o.prependListener=="function")return o.prependListener(l,m);!o._events||!o._events[l]?o.on(l,m):Array.isArray(o._events[l])?o._events[l].unshift(m):o._events[l]=[m,o._events[l]]}function k(o,l,m){t=t||Te(),o=o||{},typeof m!="boolean"&&(m=l instanceof t),this.objectMode=!!o.objectMode,m&&(this.objectMode=this.objectMode||!!o.readableObjectMode),this.highWaterMark=_(this,o,"readableHighWaterMark",m),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=o.emitClose!==!1,this.autoDestroy=!!o.autoDestroy,this.destroyed=!1,this.defaultEncoding=o.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,o.encoding&&(p||(p=Di().StringDecoder),this.decoder=new p(o.encoding),this.encoding=o.encoding)}function F(o){if(t=t||Te(),!(this instanceof F))return new F(o);var l=this instanceof t;this._readableState=new k(o,this,l),this.readable=!0,o&&(typeof o.read=="function"&&(this._read=o.read),typeof o.destroy=="function"&&(this._destroy=o.destroy)),r.call(this)}Object.defineProperty(F.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(l){!this._readableState||(this._readableState.destroyed=l)}}),F.prototype.destroy=b.destroy,F.prototype._undestroy=b.undestroy,F.prototype._destroy=function(o,l){l(o)},F.prototype.push=function(o,l){var m=this._readableState,S;return m.objectMode?S=!0:typeof o=="string"&&(l=l||m.defaultEncoding,l!==m.encoding&&(o=i.from(o,l),l=""),S=!0),L(this,o,l,!1,S)},F.prototype.unshift=function(o){return L(this,o,null,!0,!1)};function L(o,l,m,S,U){f("readableAddChunk",l);var P=o._readableState;if(l===null)P.reading=!1,Q(o,P);else{var B;if(U||(B=ne(P,l)),B)O(o,B);else if(P.objectMode||l&&l.length>0)if(typeof l!="string"&&!P.objectMode&&Object.getPrototypeOf(l)!==i.prototype&&(l=s(l)),S)P.endEmitted?O(o,new c):V(o,P,l,!0);else if(P.ended)O(o,new T);else{if(P.destroyed)return!1;P.reading=!1,P.decoder&&!m?(l=P.decoder.write(l),P.objectMode||l.length!==0?V(o,P,l,!1):ae(o,P)):V(o,P,l,!1)}else S||(P.reading=!1,ae(o,P))}return!P.ended&&(P.length<P.highWaterMark||P.length===0)}function V(o,l,m,S){l.flowing&&l.length===0&&!l.sync?(l.awaitDrain=0,o.emit("data",m)):(l.length+=l.objectMode?1:m.length,S?l.buffer.unshift(m):l.buffer.push(m),l.needReadable&&Z(o)),ae(o,l)}function ne(o,l){var m;return!a(l)&&typeof l!="string"&&l!==void 0&&!o.objectMode&&(m=new v("chunk",["string","Buffer","Uint8Array"],l)),m}F.prototype.isPaused=function(){return this._readableState.flowing===!1},F.prototype.setEncoding=function(o){p||(p=Di().StringDecoder);var l=new p(o);this._readableState.decoder=l,this._readableState.encoding=this._readableState.decoder.encoding;for(var m=this._readableState.buffer.head,S="";m!==null;)S+=l.write(m.data),m=m.next;return this._readableState.buffer.clear(),S!==""&&this._readableState.buffer.push(S),this._readableState.length=S.length,this};var K=1073741824;function Y(o){return o>=K?o=K:(o--,o|=o>>>1,o|=o>>>2,o|=o>>>4,o|=o>>>8,o|=o>>>16,o++),o}function J(o,l){return o<=0||l.length===0&&l.ended?0:l.objectMode?1:o!==o?l.flowing&&l.length?l.buffer.head.data.length:l.length:(o>l.highWaterMark&&(l.highWaterMark=Y(o)),o<=l.length?o:l.ended?l.length:(l.needReadable=!0,0))}F.prototype.read=function(o){f("read",o),o=parseInt(o,10);var l=this._readableState,m=o;if(o!==0&&(l.emittedReadable=!1),o===0&&l.needReadable&&((l.highWaterMark!==0?l.length>=l.highWaterMark:l.length>0)||l.ended))return f("read: emitReadable",l.length,l.ended),l.length===0&&l.ended?x(this):Z(this),null;if(o=J(o,l),o===0&&l.ended)return l.length===0&&x(this),null;var S=l.needReadable;f("need readable",S),(l.length===0||l.length-o<l.highWaterMark)&&(S=!0,f("length less than watermark",S)),l.ended||l.reading?(S=!1,f("reading or ended",S)):S&&(f("do read"),l.reading=!0,l.sync=!0,l.length===0&&(l.needReadable=!0),this._read(l.highWaterMark),l.sync=!1,l.reading||(o=J(m,l)));var U;return o>0?U=h(o,l):U=null,U===null?(l.needReadable=l.length<=l.highWaterMark,o=0):(l.length-=o,l.awaitDrain=0),l.length===0&&(l.ended||(l.needReadable=!0),m!==o&&l.ended&&x(this)),U!==null&&this.emit("data",U),U};function Q(o,l){if(f("onEofChunk"),!l.ended){if(l.decoder){var m=l.decoder.end();m&&m.length&&(l.buffer.push(m),l.length+=l.objectMode?1:m.length)}l.ended=!0,l.sync?Z(o):(l.needReadable=!1,l.emittedReadable||(l.emittedReadable=!0,be(o)))}}function Z(o){var l=o._readableState;f("emitReadable",l.needReadable,l.emittedReadable),l.needReadable=!1,l.emittedReadable||(f("emitReadable",l.flowing),l.emittedReadable=!0,I.nextTick(be,o))}function be(o){var l=o._readableState;f("emitReadable_",l.destroyed,l.length,l.ended),!l.destroyed&&(l.length||l.ended)&&(o.emit("readable"),l.emittedReadable=!1),l.needReadable=!l.flowing&&!l.ended&&l.length<=l.highWaterMark,d(o)}function ae(o,l){l.readingMore||(l.readingMore=!0,I.nextTick(_t,o,l))}function _t(o,l){for(;!l.reading&&!l.ended&&(l.length<l.highWaterMark||l.flowing&&l.length===0);){var m=l.length;if(f("maybeReadMore read 0"),o.read(0),m===l.length)break}l.readingMore=!1}F.prototype._read=function(o){O(this,new D("_read()"))},F.prototype.pipe=function(o,l){var m=this,S=this._readableState;switch(S.pipesCount){case 0:S.pipes=o;break;case 1:S.pipes=[S.pipes,o];break;default:S.pipes.push(o);break}S.pipesCount+=1,f("pipe count=%d opts=%j",S.pipesCount,l);var U=(!l||l.end!==!1)&&o!==I.stdout&&o!==I.stderr,P=U?Ce:Ue;S.endEmitted?I.nextTick(P):m.once("end",P),o.on("unpipe",B);function B(Ae,Fe){f("onunpipe"),Ae===m&&Fe&&Fe.hasUnpiped===!1&&(Fe.hasUnpiped=!0,As())}function Ce(){f("onend"),o.end()}var pt=sr(m);o.on("drain",pt);var en=!1;function As(){f("cleanup"),o.removeListener("close",fr),o.removeListener("finish",cr),o.removeListener("drain",pt),o.removeListener("error",ur),o.removeListener("unpipe",B),m.removeListener("end",Ce),m.removeListener("end",Ue),m.removeListener("data",tn),en=!0,S.awaitDrain&&(!o._writableState||o._writableState.needDrain)&&pt()}m.on("data",tn);function tn(Ae){f("ondata");var Fe=o.write(Ae);f("dest.write",Fe),Fe===!1&&((S.pipesCount===1&&S.pipes===o||S.pipesCount>1&&N(S.pipes,o)!==-1)&&!en&&(f("false write response, pause",S.awaitDrain),S.awaitDrain++),m.pause())}function ur(Ae){f("onerror",Ae),Ue(),o.removeListener("error",ur),e(o,"error")===0&&O(o,Ae)}q(o,"error",ur);function fr(){o.removeListener("finish",cr),Ue()}o.once("close",fr);function cr(){f("onfinish"),o.removeListener("close",fr),Ue()}o.once("finish",cr);function Ue(){f("unpipe"),m.unpipe(o)}return o.emit("pipe",m),S.flowing||(f("pipe resume"),m.resume()),o};function sr(o){return function(){var m=o._readableState;f("pipeOnDrain",m.awaitDrain),m.awaitDrain&&m.awaitDrain--,m.awaitDrain===0&&e(o,"data")&&(m.flowing=!0,d(o))}}F.prototype.unpipe=function(o){var l=this._readableState,m={hasUnpiped:!1};if(l.pipesCount===0)return this;if(l.pipesCount===1)return o&&o!==l.pipes?this:(o||(o=l.pipes),l.pipes=null,l.pipesCount=0,l.flowing=!1,o&&o.emit("unpipe",this,m),this);if(!o){var S=l.pipes,U=l.pipesCount;l.pipes=null,l.pipesCount=0,l.flowing=!1;for(var P=0;P<U;P++)S[P].emit("unpipe",this,{hasUnpiped:!1});return this}var B=N(l.pipes,o);return B===-1?this:(l.pipes.splice(B,1),l.pipesCount-=1,l.pipesCount===1&&(l.pipes=l.pipes[0]),o.emit("unpipe",this,m),this)},F.prototype.on=function(o,l){var m=r.prototype.on.call(this,o,l),S=this._readableState;return o==="data"?(S.readableListening=this.listenerCount("readable")>0,S.flowing!==!1&&this.resume()):o==="readable"&&!S.endEmitted&&!S.readableListening&&(S.readableListening=S.needReadable=!0,S.flowing=!1,S.emittedReadable=!1,f("on readable",S.length,S.reading),S.length?Z(this):S.reading||I.nextTick(me,this)),m},F.prototype.addListener=F.prototype.on,F.prototype.removeListener=function(o,l){var m=r.prototype.removeListener.call(this,o,l);return o==="readable"&&I.nextTick(gt,this),m},F.prototype.removeAllListeners=function(o){var l=r.prototype.removeAllListeners.apply(this,arguments);return(o==="readable"||o===void 0)&&I.nextTick(gt,this),l};function gt(o){var l=o._readableState;l.readableListening=o.listenerCount("readable")>0,l.resumeScheduled&&!l.paused?l.flowing=!0:o.listenerCount("data")>0&&o.resume()}function me(o){f("readable nexttick read 0"),o.read(0)}F.prototype.resume=function(){var o=this._readableState;return o.flowing||(f("resume"),o.flowing=!o.readableListening,or(this,o)),o.paused=!1,this};function or(o,l){l.resumeScheduled||(l.resumeScheduled=!0,I.nextTick(lr,o,l))}function lr(o,l){f("resume",l.reading),l.reading||o.read(0),l.resumeScheduled=!1,o.emit("resume"),d(o),l.flowing&&!l.reading&&o.read(0)}F.prototype.pause=function(){return f("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(f("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function d(o){var l=o._readableState;for(f("flow",l.flowing);l.flowing&&o.read()!==null;);}F.prototype.wrap=function(o){var l=this,m=this._readableState,S=!1;o.on("end",function(){if(f("wrapped end"),m.decoder&&!m.ended){var B=m.decoder.end();B&&B.length&&l.push(B)}l.push(null)}),o.on("data",function(B){if(f("wrapped data"),m.decoder&&(B=m.decoder.write(B)),!(m.objectMode&&B==null)&&!(!m.objectMode&&(!B||!B.length))){var Ce=l.push(B);Ce||(S=!0,o.pause())}});for(var U in o)this[U]===void 0&&typeof o[U]=="function"&&(this[U]=function(Ce){return function(){return o[Ce].apply(o,arguments)}}(U));for(var P=0;P<j.length;P++)o.on(j[P],this.emit.bind(this,j[P]));return this._read=function(B){f("wrapped _read",B),S&&(S=!1,o.resume())},this},typeof Symbol=="function"&&(F.prototype[Symbol.asyncIterator]=function(){return R===void 0&&(R=Ya()),R(this)}),Object.defineProperty(F.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(F.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(F.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(l){this._readableState&&(this._readableState.flowing=l)}}),F._fromList=h,Object.defineProperty(F.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function h(o,l){if(l.length===0)return null;var m;return l.objectMode?m=l.buffer.shift():!o||o>=l.length?(l.decoder?m=l.buffer.join(""):l.buffer.length===1?m=l.buffer.first():m=l.buffer.concat(l.length),l.buffer.clear()):m=l.buffer.consume(o,l.decoder),m}function x(o){var l=o._readableState;f("endReadable",l.endEmitted),l.endEmitted||(l.ended=!0,I.nextTick(M,l,o))}function M(o,l){if(f("endReadableNT",o.endEmitted,o.length),!o.endEmitted&&o.length===0&&(o.endEmitted=!0,l.readable=!1,l.emit("end"),o.autoDestroy)){var m=l._writableState;(!m||m.autoDestroy&&m.finished)&&l.destroy()}}typeof Symbol=="function"&&(F.from=function(o,l){return A===void 0&&(A=za()),A(F,o,l)});function N(o,l){for(var m=0,S=o.length;m<S;m++)if(o[m]===l)return m;return-1}return Jt}var Bi=le,lt=we.codes,qa=lt.ERR_METHOD_NOT_IMPLEMENTED,$a=lt.ERR_MULTIPLE_CALLBACK,Ga=lt.ERR_TRANSFORM_ALREADY_TRANSFORMING,Va=lt.ERR_TRANSFORM_WITH_LENGTH_0,ut=Te();ce.exports(le,ut);function Ha(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(i===null)return this.emit("error",new $a);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function le(t){if(!(this instanceof le))return new le(t);ut.call(this,t),this._transformState={afterTransform:Ha.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",Xa)}function Xa(){var t=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(e,r){Li(t,e,r)}):Li(this,null,null)}le.prototype.push=function(t,e){return this._transformState.needTransform=!1,ut.prototype.push.call(this,t,e)},le.prototype._transform=function(t,e,r){r(new qa("_transform()"))},le.prototype._write=function(t,e,r){var i=this._transformState;if(i.writecb=r,i.writechunk=t,i.writeencoding=e,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},le.prototype._read=function(t){var e=this._transformState;e.writechunk!==null&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},le.prototype._destroy=function(t,e){ut.prototype._destroy.call(this,t,function(r){e(r)})};function Li(t,e,r){if(e)return t.emit("error",e);if(r!=null&&t.push(r),t._writableState.length)throw new Va;if(t._transformState.transforming)throw new Ga;return t.push(null)}var Ka=Le,Ui=Bi;ce.exports(Le,Ui);function Le(t){if(!(this instanceof Le))return new Le(t);Ui.call(this,t)}Le.prototype._transform=function(t,e,r){r(null,t)};var Qt;function Ja(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var Wi=we.codes,Qa=Wi.ERR_MISSING_ARGS,Za=Wi.ERR_STREAM_DESTROYED;function ji(t){if(t)throw t}function es(t){return t.setHeader&&typeof t.abort=="function"}function ts(t,e,r,i){i=Ja(i);var n=!1;t.on("close",function(){n=!0}),Qt===void 0&&(Qt=Ht),Qt(t,{readable:e,writable:r},function(a){if(a)return i(a);n=!0,i()});var s=!1;return function(a){if(!n&&!s){if(s=!0,es(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();i(a||new Za("pipe"))}}}function Yi(t){t()}function rs(t,e){return t.pipe(e)}function is(t){return!t.length||typeof t[t.length-1]!="function"?ji:t.pop()}function ns(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var i=is(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new Qa("streams");var n,s=e.map(function(a,u){var f=u<e.length-1,g=u>0;return ts(a,f,g,function(b){n||(n=b),b&&s.forEach(Yi),!f&&(s.forEach(Yi),i(n))})});return e.reduce(rs)}var as=ns;(function(t,e){e=t.exports=Ii(),e.Stream=e,e.Readable=e,e.Writable=Si(),e.Duplex=Te(),e.Transform=Bi,e.PassThrough=Ka,e.finished=Ht,e.pipeline=as})(Ct,Ct.exports);var zi=Ct.exports.Transform,qi=ce.exports;function Se(t){zi.call(this,t),this._destroyed=!1}qi(Se,zi),Se.prototype.destroy=function(t){if(!this._destroyed){this._destroyed=!0;var e=this;I.nextTick(function(){t&&e.emit("error",t),e.emit("close")})}};function ss(t,e,r){r(null,t)}function Zt(t){return function(e,r,i){return typeof e=="function"&&(i=r,r=e,e={}),typeof r!="function"&&(r=ss),typeof i!="function"&&(i=null),t(e,r,i)}}St.exports=Zt(function(t,e,r){var i=new Se(t);return i._transform=e,r&&(i._flush=r),i}),St.exports.ctor=Zt(function(t,e,r){function i(n){if(!(this instanceof i))return new i(n);this.options=Object.assign({},t,n),Se.call(this,this.options)}return qi(i,Se),i.prototype._transform=e,r&&(i.prototype._flush=r),i}),St.exports.obj=Zt(function(t,e,r){var i=new Se(Object.assign({objectMode:!0,highWaterMark:16},t));return i._transform=e,r&&(i._flush=r),i});class $i{constructor(e,r=4){this._string=null,this._type="form",this._readOnly=!1,this._context={},this._onChangeFields={},this._keyIdx=0,this._invisibleFields=[],this._fields=e,this._container=new Oe(r,6,!1,"root")}get fields(){return this._fields}get container(){return this._container}get string(){return this._string}get type(){return this._type}get readOnly(){return this._readOnly}set readOnly(e){this._readOnly=e}get context(){return this._context}set context(e){this._context=e}get onChangeFields(){return this._onChangeFields}set onChangeFields(e){this._onChangeFields=e}get keyIdx(){return this._keyIdx}set keyIdx(e){this._keyIdx=e}get invisibleFields(){return this._invisibleFields}set invisibleFields(e){this._invisibleFields=e}parse(e,r){var i;const{values:n={},readOnly:s=!1}=r||{},a=$e(e).filter(u=>u.tagName==="form")[0];this._string=((i=a.attributes)==null?void 0:i.string)||null,this._string&&(this._string=G(this._string)),this._readOnly=s,this._context=n.id?{active_id:n.id,active_ids:[n.id]}:{},this._invisibleFields=[],this.parseNode({fields:a.children,container:this._container,values:n})}parseNode({fields:e,container:r,values:i}){const n=new Rt;e.filter(s=>typeof s=="object").forEach(s=>{var a,u;const{tagName:f,attributes:g,children:b}=s;let w=f,_=g;if(f==="field"){const{name:R,widget:A}=g;if(A)w=A;else if(R){if(!this._fields[R])throw new Error(`Field ${R} doesn't exist in fields defintion`);w=this._fields[R].type}_={...this._fields[R],...g,fieldsWidgetType:this._fields[R].type}}const E=sn({tagAttributes:_,values:i,fields:this._fields});let v;f==="button"&&_.states?v=un({states:_.states,values:i}):v=ln({fieldName:_.name,values:i,fields:this._fields});const T=Nr({context:_.context||((a=this._fields[_.name])==null?void 0:a.context),values:i,fields:this._fields});_.on_change&&(this._onChangeFields[_.name]=cn(_.on_change));let D;Gi(_.domain)&&(D=_.domain),Gi((u=this._fields[_.name])==null?void 0:u.domain)&&(D=this._fields[_.name].domain),this._keyIdx=this._keyIdx+1;const c={...E,...v,context:T,domain:D,key:`${this._keyIdx}`},p=n.createWidget(w,c);p.invisible&&p instanceof W&&this._invisibleFields.push(c.name),p instanceof de&&this.parseNode({fields:b,container:p.container,values:i}),p.readOnly=p.readOnly||this.readOnly,r.addWidget(p)})}findById(e){return this.container.findById(e)}}function Gi(t){return t?Array.isArray(t)&&t.length>0?!0:typeof t=="string"&&t!==""&&t!=="[]":!1}class os{constructor(e){this._columns=[],this._string=null,this._type="tree",this._colors=null,this._editable=null,this._fields=e}get fields(){return this._fields}get columns(){return this._columns}get string(){return this._string}get type(){return this._type}get colors(){return this._colors}get editable(){return this._editable}parse(e){const r=$e(e).filter(n=>n.tagName==="tree")[0];this._string=r.attributes.string||null,this._string&&(this._string=G(this._string)),this._colors=r.attributes.colors||null,this._colors&&(this._colors=G(this._colors)),this._editable=r.attributes.editable||null;const i=new Rt;r.children.forEach(n=>{const{tagName:s,attributes:a}=n;let u=null;if(s==="field"){const{name:f,widget:g}=a;let b=a;if(f){if(!this._fields[f])throw new Error(`Field ${f} doesn't exist in fields defintion`);const w=this._fields[f];u=w.type,(Array.isArray(w==null?void 0:w.domain)&&(w==null?void 0:w.domain.length)===0||(w==null?void 0:w.domain)===!1)&&a.domain&&a.domain.length>0&&delete w.domain,b={...w,...a,fieldsWidgetType:w==null?void 0:w.type}}if(g&&(u=g),!b.invisible){const w=i.createWidget(u,b);this._columns.push(w)}}})}findById(e){return this._columns.find(r=>{if(r.findById)return r.findById(e)})}}class ls{get searchFields(){return this._searchFields}get fields(){return this._fields}get simpleSearchContainer(){return this._simpleSearchContainer}get advancedSearchContainer(){return this._advancedSearchContainer}get formXml(){return this._formXml}constructor(e,r,i,n=8){this._searchFields=e,this._fields=r,this._formXml=i,this._simpleSearchContainer=new Oe(n),this._advancedSearchContainer=new Oe(n)}parse(){const e=new Rt,r=new $i(this.fields);r.parse(this.formXml),this.parseFields(this.searchFields.primary,e,r).forEach(s=>{this.simpleSearchContainer.addWidget(s,{addLabel:!1}),this.advancedSearchContainer.addWidget(s,{addLabel:!1})}),this.parseFields(this.searchFields.secondary,e,r).forEach(s=>{this.advancedSearchContainer.addWidget(s,{addLabel:!1})})}parseFields(e,r,i){return e.map(n=>{var s,a;const u={...this.fields[n],name:n,colspan:2},{type:f}=u,g=(a=(s=i.findById(n))==null?void 0:s.type)!=null?a:f;return r.createWidget(g,u)})}findById(e){return this.advancedSearchContainer.findById(e)}}const us=({domain:t,widgetFieldName:e})=>{const r=[];return t.forEach(i=>{if(!Array.isArray(i))return;const[n,s,a]=i;let u,f;n.indexOf(".")!==-1?(u=n.substr(0,n.indexOf(".")),f=n.substr(n.indexOf(".")+1,n.length-1)):(u=n,f="id"),u===e&&r.push([f,s,a])}),r};class Vi{constructor(e){this._action_id=null,this._position=null,e.action_id&&(this._action_id=e.action_id),e.position&&(this._position=e.position)}get action_id(){return this._action_id}get position(){return this._position}}class fs{constructor(e){this._string=null,this._items=[];const r=$e(e).filter(n=>n.tagName==="dashboard")[0];this._string=r.attributes.string||null;const{children:i}=r;i.forEach(n=>{n.tagName==="dashboard_item"&&this._items.push(new Vi(n.attributes))})}get string(){return this._string}get items(){return this._items}}class er{constructor(e){this._string=null,this._timerange=null,this._string=e.attributes.string||null,this._timerange=e.attributes.timerange||null}get string(){return this._string}get type(){return this._type}get timerange(){return this._timerange}}const cs=t=>t===1||t==="1"||t===!0||t==="True";class tr extends er{constructor(e,r){super(r),this._color=null,this._icon=null,this._totalDomain=null,this._showPercent=!1,this._suffix=null,this._type=e,this._color=r.attributes.color||null,this._color&&(this._color=G(this._color)),this._icon=r.attributes.icon||null,this._icon&&(this._icon=G(this._icon)),this._suffix=r.attributes.suffix||null,this._totalDomain=r.attributes.totalDomain||null,this._showPercent=cs(r.attributes.showPercent)}get color(){return this._color}get icon(){return this._icon}get totalDomain(){return this._totalDomain}get showPercent(){return this._showPercent}get suffix(){return this._suffix}}class Hi extends tr{constructor(e,r){super(e,r);const{children:i}=r;i.forEach(n=>{if(n.tagName==="field"){const s=n.attributes.name,a=n.attributes.operator;this._field=s||void 0,this._operator=a}})}get field(){return this._field}get operator(){return this._operator}}const hs=t=>{const e=[];let r;if(t.forEach(i=>{if(i.tagName==="field"){const n=i.attributes.axis,s=i.attributes.operator,a=i.attributes.name,u=i.attributes.label||void 0,f=i.attributes.stacked||void 0;if(!n)throw new Error(`Field ${a} doesn't have an axis`);if(!a)throw new Error("Missing name attribute for field");n==="x"?r=new Ki({name:a}):n==="y"&&e.push(new Xi({name:a,operator:s,label:u,stacked:f}))}}),!r)throw new Error("No x axis found");if(!e.length)throw new Error("No y axis found. At least we need one y axis");return{x:r,y:e}};class ft extends er{constructor(e,r){super(r),this._type=e;const i=hs(r.children);this._x=i.x,this._y=i.y}get x(){return this._x}get y(){return this._y}}const ds={indicator:tr,indicatorField:Hi,line:ft,bar:ft,pie:ft},_s=t=>{const e=$e(t).filter(n=>n.tagName==="graph")[0],r=e.attributes.type;if(!r)throw new Error(`${r} is not a valid graph`);const i=ds[r];if(!i)throw new Error(`${r} not found as a GraphModel`);return new i(r,e)};class rr{get name(){return this._name}get axis(){return this._axis}constructor({name:e,axis:r}){this._name=e,this._axis=r}}class Xi extends rr{constructor({name:e,operator:r,label:i,stacked:n}){super({name:e,axis:"y"}),this._operator=r,this._label=i,this._stacked=n}get operator(){return this._operator}get label(){return this._label}get stacked(){return this._stacked}}class Ki extends rr{constructor({name:e}){super({name:e,axis:"x"})}}const gs=({ooui:t})=>{const r=[t.x.name];return t.y?(t.y.forEach(i=>{i.operator!=="count"&&!r.includes(i.name)&&r.push(i.name),i.label&&!r.includes(i.label)&&r.push(i.label)}),r):[]};function ir({fields:t,values:e,fieldName:r}){const i=t[r],n=e[r];if(!i)throw new Error(`Field ${r} not found`);if(i.type==="many2one")return n?{value:n[0],label:n[1]}:{value:!1,label:void 0};if(i.type==="selection"){const a=i.selection.find(u=>u[0]===n);return a?{value:n,label:a[1]}:{value:!1,label:void 0}}return{value:n,label:n}}const ps=Object.freeze(Object.defineProperty({__proto__:null,getFieldsToRetrieve:gs,getValueAndLabelForField:ir},Symbol.toStringTag,{value:"Module"}));function ys({values:t,timerange:e}){const r=ms({values:t,timerange:e});return ws({values:r,timerange:e})}function ws({values:t,timerange:e}){let r=[];const i=Qi({values:t,groupBy:"type-stacked"}),n=`${e}s`;return Object.keys(i).forEach(a=>{const u=i[a];for(let f=0;f<u.length;f++){const g=u[f];if(r.push(g),f===u.length-1)return;const b=g.x,w=u[f+1].x;if(!Ji([b,w],n)){const _=bs({dates:[b,w],timerange:e});r=r.concat(_.map(E=>({x:E,value:0,type:g.type,stacked:g.stacked})))}}}),r.sort((a,u)=>a.x<u.x?-1:a.x>u.x?1:0)}function bs({dates:t,timerange:e}){const r=[],i=`${e}s`;if(t.length===1)return t;const n=t.sort((s,a)=>s<a?-1:s>a?1:0);for(let s=0;s<n.length-1;s++){const a=n[s],u=n[s+1];if(!Ji([a,u],i)){let f=Me.default(a,ct(i)).add(1,i),g=Me.default(u,ct(i));for(;f.isBefore(g);)r.push(f.format(ct(i))),f.add(1,i)}}return r}function ms({values:t,timerange:e}){const r=vs({values:t,timerange:e});let i=[];const n=Qi({values:r,groupBy:"all"});return Object.keys(n).forEach(s=>{const a=n[s],u=a[0].operator==="count"?"+":a[0].operator,f=ht({values:a.map(g=>g.value),operator:u});i.push({...a[0],value:f})}),i}function vs({values:t,timerange:e}){return t.map(r=>({...r,x:Es({date:r.x,timerange:e})}))}function Es({date:t,timerange:e}){let r=xs(t);const i=Me.default(t,r);switch(e){case"hour":{r="YYYY-MM-DD HH:00";break}case"day":{r="YYYY-MM-DD";break}case"week":{r="YYYY-WW";break}case"month":{r="YYYY-MM";break}case"year":{r="YYYY";break}}return i.format(r)}function xs(t){return t.indexOf(":")?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD"}function Ji(t,e){let r=!1;const i=ct(e);if(t.length===0)return!1;if(t.length===1)return!0;for(let n=0;n<t.length-1;n++){const s=Me.default(t[n],i),u=Me.default(t[n+1],i).diff(s,e);Math.abs(u)===1?r=!0:r=!1}return r}function Qi({values:t,groupBy:e}){const r={};return t.forEach(i=>{const n=i.x,s=i.type,a=i.stacked,u=e==="all"?`${n}-${s}-${a}`:`${s}-${a}`;r[u]||(r[u]=[]),r[u].push(i)}),r}function ct(t){switch(t){default:case"hours":return"YYYY-MM-DD HH:mm";case"days":return"YYYY-MM-DD";case"weeks":return"YYYY-WW";case"months":return"YYYY-MM";case"years":return"YYYY"}}const Rs={count:"count","+":"sum","-":"subtract","*":"multiply",avg:"average",min:"min",max:"max"},Ts=({ooui:t,values:e,fields:r,options:i})=>{const n=ar({fieldName:t.x.name,values:e,fields:r}),s=[];t.y.forEach(_=>{Object.keys(n).forEach(E=>{const v=n[E].label,T=n[E].entries;if(_.label){const D=ar({fieldName:_.label,values:T,fields:r});Object.keys(D).forEach(c=>{const p=D[c].entries,R=D[c].label,A=nr({entries:p,fields:r,fieldName:_.name}),O=ht({values:A,operator:_.operator});s.push({x:v||!1,value:O,type:R,operator:_.operator,stacked:_.stacked})})}else{const D=nr({entries:T,fields:r,fieldName:_.name}),c=ht({values:D,operator:_.operator});s.push({x:v||!1,value:c,type:Zi({yAxis:_,fields:r}),operator:_.operator,stacked:_.stacked})}})});const a=t.y.some(_=>_.label!==void 0),u=t.y.some(_=>_.stacked!==void 0);let g=[...s.sort((_,E)=>_.x<E.x?-1:_.x>E.x?1:0)];u&&t.y.filter(_=>_.stacked!==void 0).length>1&&(g=g.map(_=>({..._,type:`${_.type} - ${_.stacked}`})));let b=[...g];t.type==="pie"&&b.some(_=>_.x===!1)?b=b.map(_=>_.x===!1?{..._,x:(i==null?void 0:i.uninformedString)||"Not informed"}:_):g.some(_=>_.x===!1)&&(b=b.filter(_=>_.x!==!1));let w=b;return t.timerange?w=ys({values:w,timerange:t.timerange}):t.type=="pie"&&(w=b.sort((_,E)=>E.value-_.value)),{data:w,isGroup:u||a,isStack:u}};function nr({entries:t,fieldName:e,fields:r}){return t.map(i=>ir({fieldName:e,values:i,fields:r})).map(({value:i,label:n})=>n)}function ht({operator:t,values:e}){switch(t){case"count":return e.length;case"+":return dt(e.reduce(function(r,i){return r+i}));case"-":return dt(e.reduce(function(r,i){return r-i}));case"*":return dt(e.reduce(function(r,i){return r*i}));case"avg":{const i=e.reduce((n,s)=>n+s,0)/e.length||0;return dt(i)}case"min":return Math.min(...e);case"max":return Math.max(...e)}}function dt(t){return Math.round((t+Number.EPSILON)*100)/100}function ar({fieldName:t,fields:e,values:r}){const i={};return r.forEach(n=>{const{value:s,label:a}=ir({fields:e,values:n,fieldName:t});i[s]||(i[s]={label:a,entries:[]}),i[s].entries.push(n)}),i}function Ss(t){let e=[];return Object.keys(t).forEach(r=>{const i=t[r];e=e.concat(i.entries)}),e}function Zi({yAxis:t,fields:e}){const r=e[t.name];return r&&r.string?r.string:t.name}const Cs=Object.freeze(Object.defineProperty({__proto__:null,labelsForOperator:Rs,processGraphData:Ts,getValuesForYField:nr,getValueForOperator:ht,getValuesGroupedByField:ar,getAllObjectsInGroupedValues:Ss,getYAxisFieldname:Zi},Symbol.toStringTag,{value:"Module"}));C.Binary=Tr,C.Boolean=vt,C.Button=_r,C.ButtonGroup=gr,C.Char=ze,C.CodeEditor=Pr,C.Container=Oe,C.ContainerWidget=de,C.Dashboard=fs,C.DashboardItem=Vi,C.Date=mr,C.DateTime=vr,C.Field=W,C.Float=qe,C.FloatTime=wr,C.Form=$i,C.Graph=er,C.GraphAxis=rr,C.GraphChart=ft,C.GraphIndicator=tr,C.GraphIndicatorField=Hi,C.GraphXAxis=Ki,C.GraphYAxis=Xi,C.Group=dr,C.Image=Sr,C.Indicator=Ar,C.Integer=yr,C.Label=wt,C.Many2many=Er,C.Many2one=pr,C.MultiCheckbox=xt,C.NewLine=yt,C.Notebook=bt,C.One2many=Et,C.Page=hr,C.ProgressBar=br,C.Radio=Mr,C.Reference=Rr,C.SearchFilter=ls,C.Selection=ve,C.Separator=xr,C.Steps=kr,C.Switch=Or,C.Tag=Dr,C.Tags=Fr,C.Text=mt,C.Timeline=Cr,C.Tree=os,C.Widget=he,C.graphFieldUtils=ps,C.graphProcessor=Cs,C.parseContext=Nr,C.parseGraph=_s,C.transformDomainForChildWidget=us,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
21
21
  //# sourceMappingURL=ooui.umd.js.map