diff --git a/README.md b/README.md
index 9887893..17b71d8 100644
--- a/README.md
+++ b/README.md
@@ -75,11 +75,13 @@ In the scripts you are able to use the following features:
* Globals `undefined`, `NaN`, `isNaN`, `Infinity`, `isFinite`, `atob`, `btoa`,
`encodeURI`, `encodeURIComponent`, `decodeURI`, `decodeURIComponent`, `parseFloat`,
`parseInt`, `JSON`, `Number`, `String`, `Array`, `BigInt`, `Blob`, `Boolean`,
- `Date`, `Map`, `Math`, `Object`, `RegExp`, `Set`, `Intl`, `Buffer`, `Promise`
+ `Date`, `Map`, `Math`, `Object`, `RegExp`, `Set`, `Intl`, `Buffer`, `Promise`,
+ `setTimeout`, `clearTimeout`
* `async`/`await`
* Adapter log functions `log.warn('something')`, `log.info('something')`, `log.debug('something')`
-* `getStateAsync('id')` and `getObjectAsync('id')` where `id` is the partial ID of the state/object below the current adapter instance
-* `getForeignStateAsync('id')` and `getForeignObjectAsync('id')` where `id` is the full ID of the state/object
+* `getStateAsync('id')`, `getObjectAsync('id')`, `setStateAsync('id', 'value', ack)` where `id` is the partial ID of the state/object below the current adapter instance
+* `getForeignStateAsync('id')`, `getForeignObjectAsync('id')` and `setForeignStateAsync('id', 'value', ack)` where `id` is the full ID of the state/object
+* Function `wait(ms)` which returns a Promise which resolves after the given time
* An object `sharedData` which is shared between all custom scripts of an adapter instance
Errors in the scripts will be logged by the adapter.
@@ -164,6 +166,12 @@ By writing JSON data to the `raw.send` state you are able to send CAN messages c
Placeholder for the next version (at the beginning of the line):
### **WORK IN PROGRESS**
-->
+### **WORK IN PROGRESS**
+
+* (crycode-de) Allow `setStateAsync` and `setForeignStateAsync` in custom parser scripts
+* (crycode-de) Allow `setTimeout` and `clearTimeout` in custom parser scripts (using the adapters setTimeout implementation)
+* (crycode-de) Added `wait` function to custom parser scripts
+
### 2.0.0 (2024-11-02)
* (crycode-de) Node.js >= 18, Admin >= 6.17, js-contoller >= 5.0.19 are required
diff --git a/admin/build/index.js b/admin/build/index.js
index e6142b4..cd95933 100644
--- a/admin/build/index.js
+++ b/admin/build/index.js
@@ -414,7 +414,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
`&&i?(r==="\r"&&(n[o]=n[o].slice(0,-1)),n=u[++a]=[s=""],o=0):n[o]+=s,r=s;return u}renderMarkdown(e){return e=e.replace(/<[^>]+>/,""),e=z_(e),e=e.replace(/]+)>/g,''),e}};Et([Tt],Bi.prototype,"handleExportSelectMsg",1),Et([Tt],Bi.prototype,"fetchPredefinedConfigs",1),Et([Tt],Bi.prototype,"export",1),Et([Tt],Bi.prototype,"importFromFile",1),Et([Tt],Bi.prototype,"handleImportFileSelect",1),Et([Tt],Bi.prototype,"importPredefinedConfig",1);var pt=q(z());var Yie=q(rm()),X_=q(g_());var gB=q(xj()),Jie=q(pB()),Xie=q(Uie()),ht=q(_o());var mB=q(z()),hB=q(Sm()),BI=(0,hB.default)(mB.default.createElement("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"}),"ContentCopy"),UI=(0,hB.default)(mB.default.createElement("path",{d:"M19 2h-4.18C14.4.84 13.3 0 12 0c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm7 18H5V4h2v3h10V4h2v16z"}),"ContentPaste");var Ge=q(z());var $I=q(g_()),Gie=q(h_()),Vie=q(pB()),Kie=q(zie()),He=q(_o());var Js=q(z());var Wie=q(Wm()),$ie=q(zC());var Hie=q(VC());var WI=class extends Js.default.PureComponent{constructor(e){super(e);let r=[];for(let n=0;n0;this.state={value:this.props.value,bits:r}}componentDidUpdate(e){if(e.value!==this.props.value){let r=[];for(let n=0;n0;this.setState({value:this.props.value,bits:r})}}render(){return Js.default.createElement(Ke,{item:!0,xs:this.props.xs,sm:this.props.sm,md:this.props.md,lg:this.props.lg,xl:this.props.xl},Js.default.createElement(Wie.default,null,Js.default.createElement(bd,{shrink:!0,style:{marginTop:"-5px"}},this.props.label),Js.default.createElement("div",null,this.state.bits.map((e,r)=>Js.default.createElement($ie.default,{key:r,control:Js.default.createElement(Hie.default,{checked:e,disabled:this.props.disabled,onChange:()=>this.changeBit(r)}),label:r}))),this.props.children&&Js.default.createElement(ja,null,this.props.children)))}changeBit(e){let r=[...this.state.bits];r[e]=!r[e];let n=0;r.forEach((o,a)=>{o&&(n|=1<{this.props.onChange(this.state.value)})}};var CVe={int8:"int8",uint8:"uint8",int16_be:"int16 BE",int16_le:"int16 LE",uint16_be:"uint16 BE",uint16_le:"uint16 LE",int32_be:"int32 BE",int32_le:"int32 LE",uint32_be:"uint32 BE",uint32_le:"uint32 LE",float32_be:"float32 BE",float32_le:"float32 LE",double64_be:"double64 BE",double64_le:"double64 LE",boolean:"boolean",string:"string",custom:"custom"},IVe=["state","button","indicator","level","level.temperature","switch","switch.power","switch.light","text","value","value.temperature","button.close.blind","button.close.tilt","button.fastforward","button.fastreverse","button.forward","button.long","button.mode.auto","button.mode.manual","button.mode.silent","button.next","button.open.blind","button.open.door","button.open.tilt","button.open.window","button.pause","button.play","button.press","button.prev","button.reverse","button.start","button.stop","button.stop.tilt","button.volume.down","button.volume.up","date","date.end","date.forecast.1","date.start","date.sunrise","date.sunset","dayofweek","html","indicator.alarm","indicator.alarm.fire","indicator.alarm.flood","indicator.alarm.health","indicator.alarm.secure","indicator.connected","indicator.lowbat","indicator.maintenance","indicator.maintenance.alarm","indicator.maintenance.lowbat","indicator.maintenance.unreach","indicator.maintenance.waste","indicator.reachable","indicator.working","info.address","info.display","info.ip","info.mac","info.name","info.port","info.standby","info.status","json","level.bass","level.blind","level.co2","level.color.blue","level.color.green","level.color.hue","level.color.luminance","level.color.red","level.color.rgb","level.color.saturation","level.color.temperature","level.color.white","level.curtain","level.dimmer","level.mode.cleanup","level.mode.fan","level.mode.swing","level.mode.thermostat","level.mode.work","level.tilt","level.timer","level.timer.sleep","level.treble","level.valve","level.volume","level.volume.group","list","location","media.add","media.album","media.artist","media.bitrate","media.broadcastDate","media.browser","media.clear","media.content","media.cover","media.cover.big","media.cover.small","media.date","media.duration","media.duration.text","media.elapsed","media.elapsed.text","media.episode","media.genre","media.input","media.jump","media.link","media.mode.repeat","media.mode.shuffle","media.mute","media.mute.group","media.playid","media.playlist","media.season","media.seek","media.state","media.title","media.title.next","media.track","media.tts","media.url","media.url.announcement","sensor.alarm","sensor.alarm.fire","sensor.alarm.flood","sensor.alarm.power","sensor.alarm.secure","sensor.door","sensor.light","sensor.lock","sensor.motion","sensor.noise","sensor.rain","sensor.window","switch.boost","switch.comfort","switch.enable","switch.lock","switch.lock.door","switch.lock.window","switch.mode.auto","switch.mode.color","switch.mode.manual","switch.mode.moonlight","switch.mode.silent","switch.pause","switch.power.zone","text.phone","text.url","url","url.audio","url.blank","url.cam","url.icon","url.same","value.battery","value.blind","value.blood.sugar","value.brightness","value.clouds","value.current","value.curtain","value.default","value.direction","value.direction.max.wind","value.direction.min.wind","value.direction.wind","value.direction.wind.forecast.0","value.direction.wind.forecast.1","value.distance","value.distance.visibility","value.fill","value.gps","value.gps.elevation","value.gps.latitude","value.gps.longitude","value.health.bmi","value.health.bpm","value.health.calories","value.health.fat","value.health.steps","value.health.weight","value.humidity","value.humidity.max","value.humidity.min","value.interval","value.lock","value.max","value.min","value.power.consumption","value.precipitation","value.precipitation.day.forecast.0","value.precipitation.forecast.0","value.precipitation.forecast.1","value.precipitation.hour","value.precipitation.night.forecast.0","value.precipitation.today","value.pressure","value.pressure.forecast.0","value.pressure.forecast.1","value.radiation","value.rain","value.rain.hour","value.rain.today","value.severity","value.snow","value.snow.hour","value.snow.today","value.snowline","value.speed","value.speed.max.wind","value.speed.min.wind","value.speed.wind","value.speed.wind.forecast.0","value.speed.wind.forecast.1","value.speed.wind.gust","value.state","value.sun.azimuth","value.sun.elevation","value.temperature.dewpoint","value.temperature.feelslike","value.temperature.max","value.temperature.max.forecast.0","value.temperature.max.forecast.1","value.temperature.min","value.temperature.min.forecast.0","value.temperature.min.forecast.1","value.temperature.windchill","value.tilt","value.time","value.uv","value.valve","value.voltage","value.warning","value.waste","value.water","value.window","weather.chart.url","weather.chart.url.forecast","weather.direction.wind","weather.direction.wind.forecast.0","weather.html","weather.icon","weather.icon.forecast.1","weather.icon.name","weather.icon.wind","weather.json","weather.state","weather.state.forecast.0","weather.state.forecast.1","weather.title","weather.title.forecast.0","weather.title.short","weather.type"],gh=class extends Ge.default.PureComponent{constructor(e){super(e),this.state=this.validateState(this.updateDependedElements({...this.props.config,idError:null,commonStatesError:null,disabledDataLengths:[],disabledDataOffsets:[],disabledDataEncoding:!1,disabledDataUnit:!1,disabledDataOffsetAndLength:!1}))}render(){let{classes:e}=this.props,r="number";return(this.state.dataType==="boolean"||this.state.dataType==="custom"&&this.state.customDataType==="boolean")&&(r="boolean"),(this.state.dataType==="string"||this.state.dataType==="custom"&&this.state.customDataType==="string")&&(r="string"),Ge.default.createElement(Ge.default.Fragment,null,Ge.default.createElement("div",{className:e.fabTopRight},Ge.default.createElement($I.default,{size:"small",color:"primary","aria-label":"copy",title:He.default.t("Copy"),onClick:this.copy},Ge.default.createElement(BI,null)),Ge.default.createElement($I.default,{size:"small",color:"primary","aria-label":"paste",title:He.default.t("Paste"),onClick:this.paste,disabled:this.props.readonly||!Mi.parser},Ge.default.createElement(UI,null)),Ge.default.createElement($I.default,{size:"small",color:"primary","aria-label":"delete",title:He.default.t("Remove"),onClick:()=>this.props.onDelete&&this.props.onDelete(this.props.uuid),disabled:this.props.readonly||!this.props.onDelete},Ge.default.createElement(Vie.default,null))),Ge.default.createElement(Ke,{container:!0,spacing:3},Ge.default.createElement(tn,{xs:12,sm:6,md:4,lg:4,label:He.default.t("Parser ID"),value:this.state.id,disabled:this.props.readonly,onChange:n=>this.handleChange("id",n),errorMsg:this.state.idError,transform:"lowerCase",maxLength:64},Ge.default.createElement("code",null,this.props.context.adapterName,".",this.props.context.instance,".",this.props.msgId||"",".",this.state.id||"")),Ge.default.createElement(tn,{xs:12,sm:6,md:6,lg:4,label:He.default.t("Name"),value:this.state.name,disabled:this.props.readonly,onChange:n=>this.handleChange("name",n)},He.default.t("e.g.")," ",Ge.default.createElement("code",null,He.default.t("Temperature")))),Ge.default.createElement(Ke,{container:!0,spacing:3},Ge.default.createElement(No,{xs:12,sm:6,md:4,lg:2,label:He.default.t("Data type"),value:this.state.dataType,disabled:this.props.readonly,onChange:n=>this.handleChange("dataType",n),options:CVe},He.default.t("Data type in the can message")),this.state.dataType==="custom"&&Ge.default.createElement(No,{xs:12,sm:6,md:4,lg:2,label:He.default.t("Data type"),value:this.state.customDataType,disabled:this.props.readonly,onChange:n=>this.handleChange("customDataType",n),options:["boolean","number","string","mixed"]},He.default.t("Data type in ioBroker")),!this.state.disabledDataOffsetAndLength&&Ge.default.createElement(Ge.default.Fragment,null,Ge.default.createElement(No,{xs:12,sm:6,md:2,lg:1,label:He.default.t("Offset"),value:this.state.dataOffset.toString(),disabled:this.props.readonly,onChange:n=>this.handleChange("dataOffset",parseInt(n,10)),options:["0","1","2","3","4","5","6","7"],disabledOptions:this.state.disabledDataOffsets}),Ge.default.createElement(No,{xs:12,sm:6,md:2,lg:1,label:He.default.t("Length"),value:this.state.dataLength.toString(),disabled:this.props.readonly,onChange:n=>this.handleChange("dataLength",parseInt(n,10)),options:["1","2","3","4","5","6","7","8"],disabledOptions:this.state.disabledDataLengths})),!this.state.disabledDataEncoding&&Ge.default.createElement(No,{xs:12,sm:6,md:2,lg:1,label:He.default.t("Encoding"),value:this.state.dataEncoding,disabled:this.props.readonly,onChange:n=>this.handleChange("dataEncoding",n),options:["ascii","base64","hex","latin1","utf8","utf16le"]}),!this.state.disabledDataUnit&&Ge.default.createElement(tn,{xs:12,sm:6,md:2,lg:1,label:He.default.t("Unit"),value:this.state.dataUnit,disabled:this.props.readonly,onChange:n=>this.handleChange("dataUnit",n)},He.default.t("e.g.")," ",Ge.default.createElement("code",null,"\xB0C")),Ge.default.createElement(tn,{xs:12,sm:6,md:4,lg:3,label:He.default.t("Role"),value:this.state.commonRole,disabled:this.props.readonly,onChange:n=>this.handleChange("commonRole",n),autoCompleteOptions:IVe},He.default.t('Select a suitable role for the ioBroker state or just use "state" if you are not sure.'),Ge.default.createElement(Gie.default,{color:"primary",size:"small",title:He.default.t("Information about the state roles in ioBroker on GitHub"),onClick:()=>window.open("https://github.com/ioBroker/ioBroker.docs/blob/master/docs/en/dev/stateroles.md")},Ge.default.createElement(Kie.default,{fontSize:"inherit"}))),Ge.default.createElement(xr,{xs:12,sm:6,md:4,lg:3,label:He.default.t("Define possible states"),value:!!this.state.commonStates,disabled:this.props.readonly,onChange:n=>this.handleChange("commonStates",n?"":!1)},He.default.t("Setup a list of predefined state values"))),typeof this.state.commonStates=="string"&&Ge.default.createElement(Ke,{container:!0,spacing:3},Ge.default.createElement(tn,{xs:12,sm:12,md:12,lg:12,label:He.default.t("Possible states"),value:this.state.commonStates,disabled:this.props.readonly,onChange:n=>this.handleChange("commonStates",n),errorMsg:this.state.commonStatesError},He.default.t("Comma separated list of real values and display values. Example: 0=Off,1=On,2=Auto"))),this.state.dataType==="boolean"&&Ge.default.createElement(Ke,{container:!0,spacing:3},Ge.default.createElement(WI,{xs:12,sm:12,md:12,lg:8,label:He.default.t("Boolean bitmask"),bits:8,value:this.state.booleanMask,disabled:this.props.readonly,onChange:n=>this.handleChange("booleanMask",n)},Ge.default.createElement("span",{dangerouslySetInnerHTML:{__html:He.default.t("Bitmask to apply to detect/set a %s value. If no bits are selected any byte value greater than 0 will be interpreted as %s.","true
","true
")}})),Ge.default.createElement(xr,{xs:12,sm:12,md:6,lg:3,label:He.default.t("Boolean invert"),value:this.state.booleanInvert,disabled:this.props.readonly,onChange:n=>this.handleChange("booleanInvert",n)},He.default.t("Invert the boolean value"))),this.state.dataType==="custom"&&Ge.default.createElement(Ke,{container:!0,spacing:3},Ge.default.createElement(tn,{xs:12,sm:12,md:6,label:He.default.t("Custom script read"),multiline:!0,value:this.state.customScriptRead,disabled:this.props.readonly,onChange:n=>this.handleChange("customScriptRead",n),placeholder:`// example:
value = buffer[0] + buffer[1];`},Ge.default.createElement("span",{dangerouslySetInnerHTML:{__html:He.default.t("Script to read the value from the buffer. The buffer is available as %s and the value has to be written into %s.","buffer
","value
")}})),Ge.default.createElement(tn,{xs:12,sm:12,md:6,label:He.default.t("Custom script write"),multiline:!0,value:this.state.customScriptWrite,disabled:this.props.readonly,onChange:n=>this.handleChange("customScriptWrite",n),placeholder:`// example:
buffer[0] = value & 0xff;
-buffer[1] = (value >> 8);`},Ge.default.createElement("span",{dangerouslySetInnerHTML:{__html:He.default.t("Script to write the value to the buffer. The buffer is available as %s and the value as %s.","buffer
","value
")}}))),this.props.msgSend&&Ge.default.createElement(Ke,{container:!0,spacing:3},Ge.default.createElement(xr,{xs:12,sm:6,md:4,lg:3,label:He.default.t("Automatically set a certain value"),value:typeof this.state.autoSetInterval=="number",disabled:this.props.readonly,onChange:n=>this.handleChange("autoSetInterval",n?6e4:!1)},He.default.t("Set a certain value automatically in a given interval")),typeof this.state.autoSetInterval=="number"&&Ge.default.createElement(Ge.default.Fragment,null,Ge.default.createElement(tn,{xs:12,sm:6,md:4,lg:3,label:He.default.t("Interval for automatic set"),value:this.state.autoSetInterval.toString(),disabled:this.props.readonly,onChange:n=>this.handleChange("autoSetInterval",parseInt(n,10)||0),transform:n=>n.replace(/\D/g,"")},He.default.t("Interval in milliseconds to automatically set the value")),r==="number"&&Ge.default.createElement(tn,{xs:12,sm:6,md:4,lg:3,label:He.default.t("Value to set"),value:(this.state.autoSetValue||0).toString(),disabled:this.props.readonly,onChange:n=>this.handleChange("autoSetValue",parseFloat(n)||0),transform:n=>n.replace(",",".").replace(/[^\d.]/g,"")},He.default.t("The value to set automatically in the given interval (%s)",r)),r==="boolean"&&Ge.default.createElement(xr,{xs:12,sm:6,md:4,lg:3,label:He.default.t("Value to set"),value:!!this.state.autoSetValue,disabled:this.props.readonly,onChange:n=>this.handleChange("autoSetValue",n)},He.default.t("The value to set automatically in the given interval (%s)",r)),r==="string"&&Ge.default.createElement(tn,{xs:12,sm:6,md:4,lg:3,label:He.default.t("Value to set"),value:this.state.autoSetValue||"",disabled:this.props.readonly,onChange:n=>this.handleChange("autoSetValue",n)},He.default.t("The value to set automatically in the given interval (%s)",r)),!this.props.msgAutoSend&&Ge.default.createElement(xr,{xs:12,sm:6,md:4,lg:3,label:He.default.t("Trigger send"),value:!!this.state.autoSetTriggerSend,disabled:this.props.readonly,onChange:n=>this.handleChange("autoSetTriggerSend",n)},He.default.t("Trigger the send action every time the value is set automatically")))))}onChange(){this.props.onChange(this.props.uuid,{id:this.state.id,name:this.state.name,dataType:this.state.dataType,dataLength:this.state.dataLength,dataOffset:this.state.dataOffset,dataUnit:this.state.dataUnit,dataEncoding:this.state.dataEncoding,booleanMask:this.state.booleanMask,booleanInvert:this.state.booleanInvert,customScriptRead:this.state.customScriptRead,customScriptWrite:this.state.customScriptWrite,customDataType:this.state.customDataType,commonRole:this.state.commonRole,commonStates:this.state.commonStates,autoSetInterval:this.state.autoSetInterval,autoSetValue:this.state.autoSetValue,autoSetTriggerSend:this.state.autoSetTriggerSend})}handleChange(e,r){let n={[e]:r};this.updateDependedElements(n),this.validateState(n),this.setState(n,()=>{this.onChange()})}updateDependedElements(e){var n,o,a;switch(e.dataType||((n=this.state)==null?void 0:n.dataType)||"uint8"){case"boolean":e.disabledDataOffsets=[],e.disabledDataLengths=["2","3","4","5","6","7","8"],e.dataLength=1,e.disabledDataEncoding=!0,e.disabledDataUnit=!0,e.disabledDataOffsetAndLength=!1,e.dataUnit="";break;case"int8":case"uint8":e.disabledDataOffsets=[],e.disabledDataLengths=["2","3","4","5","6","7","8"],e.dataLength=1,e.disabledDataEncoding=!0,e.disabledDataUnit=!1,e.disabledDataOffsetAndLength=!1;break;case"int16_be":case"int16_le":case"uint16_be":case"uint16_le":e.disabledDataOffsets=["7"],e.disabledDataLengths=["1","3","4","5","6","7","8"],e.dataLength=2,e.disabledDataEncoding=!0,e.disabledDataUnit=!1,e.disabledDataOffsetAndLength=!1;break;case"int32_be":case"int32_le":case"uint32_be":case"uint32_le":case"float32_be":case"float32_le":e.disabledDataOffsets=["5","6","7"],e.disabledDataLengths=["1","2","3","5","6","7","8"],e.dataLength=4,e.disabledDataEncoding=!0,e.disabledDataUnit=!1,e.disabledDataOffsetAndLength=!1;break;case"double64_be":case"double64_le":e.disabledDataOffsets=["1","2","3","4","5","6","7"],e.disabledDataLengths=["1","2","3","4","5","6","7"],e.dataLength=8,e.disabledDataEncoding=!0,e.disabledDataUnit=!1,e.disabledDataOffsetAndLength=!1;break;case"string":{e.disabledDataOffsets=[],e.disabledDataLengths=[],e.disabledDataEncoding=!1,e.disabledDataUnit=!0,e.disabledDataOffsetAndLength=!1,e.dataUnit="";let i=(o=e.dataOffset)!=null?o:this.state.dataOffset;((a=e.dataLength)!=null?a:this.state.dataLength)+i>8&&(e.dataLength=8-i);for(let u=1;u<=8;u++)u+i>8&&e.disabledDataLengths.push(u.toString());break}case"custom":e.disabledDataOffsets=[],e.disabledDataLengths=[],e.dataOffset=0,e.dataLength=8,e.disabledDataEncoding=!0,e.disabledDataUnit=!1,e.disabledDataOffsetAndLength=!0;break}return e}validateState(e){var n,o;let r=!0;return e.id!==void 0?goe.includes(e.id)?(e.idError=He.default.t("This ID is reserved and can't be used"),r=!1):e.id.match(hoe)?e.idError=null:(e.idError=He.default.t("Only allowed chars: %s","0-9a-z-_"),r=!1):((n=this.state)==null?void 0:n.idError)!==null&&(r=!1),e.commonStates!==void 0?e.commonStates!==!1&&!e.commonStates.match(voe)?(e.commonStatesError=He.default.t("Invalid format! Please use the format value=text,value=text,..."),r=!1):e.commonStatesError=null:(o=this.state)!=null&&o.commonStatesError&&(r=!1),this.props.onValidate(this.props.uuid,r),e}copy(){Mi.parser=JSON.stringify(this.state),this.props.showToast&&this.props.showToast(He.default.t("Parser configuration copied. Use the paste button to paste this configuration to an other parser."))}paste(){if(!Mi.parser){this.props.showToast&&this.props.showToast(He.default.t("Nothing to paste. Please use the copy button first."));return}try{let e=JSON.parse(Mi.parser);this.setState(this.validateState({...e}),()=>{this.onChange(),this.props.showToast&&this.props.showToast(He.default.t("Pasted"))})}catch(e){this.props.showToast&&this.props.showToast(He.default.t("Error while pasting: %s",`${e}`))}}};Et([Tt],gh.prototype,"copy",1),Et([Tt],gh.prototype,"paste",1);var da=class extends pt.default.Component{constructor(e){super(e),this.state=this.validateState({tabIndex:0,id:this.props.config.id||"",idError:null,name:this.props.config.name||"",dlc:typeof this.props.config.dlc=="number"?this.props.config.dlc:-1,receive:this.props.config.receive||!1,send:this.props.config.send||!1,autosend:this.props.config.autosend||!1,parsers:this.props.config.parsers||{},parsersValid:{},showRemoveConfirm:!1})}componentDidMount(){this.validateState()}render(){let{classes:e,context:r}=this.props;return pt.default.createElement(pt.default.Fragment,null,pt.default.createElement("div",{className:e.fabTopRight},pt.default.createElement(X_.default,{size:"small",color:"primary","aria-label":"copy",title:ht.default.t("Copy"),onClick:this.copy},pt.default.createElement(BI,null)),pt.default.createElement(X_.default,{size:"small",color:"primary","aria-label":"paste",title:ht.default.t("Paste"),onClick:this.paste,disabled:this.props.readonly||!Mi.message},pt.default.createElement(UI,null)),pt.default.createElement(X_.default,{size:"small",color:"primary","aria-label":"delete",title:ht.default.t("Remove"),onClick:()=>this.setState({showRemoveConfirm:!0}),disabled:this.props.readonly||!this.props.onDelete},pt.default.createElement(Jie.default,null)),this.props.onAdd&&pt.default.createElement(X_.default,{size:"small",color:"primary","aria-label":"add",title:ht.default.t("Add"),onClick:()=>this.props.onAdd&&this.props.onAdd(this.props.uuid)},pt.default.createElement(gB.default,null))),pt.default.createElement("h2",null,ht.default.t("Message")),pt.default.createElement(Ke,{container:!0,spacing:3},pt.default.createElement(tn,{xs:12,sm:6,md:4,lg:2,label:ht.default.t("Message ID"),value:this.state.id,required:!0,errorMsg:this.state.idError,disabled:this.props.readonly,transform:"upperCase",onChange:n=>this.handleChange("id",n)},ht.default.t("CAN message ID in hex"),", ",ht.default.t("e.g.")," ",pt.default.createElement("code",null,"00A0123B")," ",ht.default.t("or")," ",pt.default.createElement("code",null,"1AB")),pt.default.createElement(tn,{xs:12,sm:6,md:4,lg:4,label:ht.default.t("Name"),value:this.state.name,disabled:this.props.readonly,onChange:n=>this.handleChange("name",n)},ht.default.t("e.g.")," ",pt.default.createElement("code",null,ht.default.t("My super message"))),pt.default.createElement(No,{xs:12,sm:6,md:4,lg:3,label:ht.default.t("Data length"),value:this.state.dlc.toString(),options:{"-1":ht.default.t("Not set"),0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8"},disabled:this.props.readonly,onChange:n=>this.handleChange("dlc",parseInt(n,10))},ht.default.t("Optionally set a fixed data length for this message"))),pt.default.createElement(Ke,{container:!0,spacing:3},pt.default.createElement(xr,{xs:12,sm:12,md:4,lg:4,label:ht.default.t("Receive"),value:this.state.receive,disabled:this.props.readonly,onChange:n=>this.handleChange("receive",n)},ht.default.t("Receive messages with the given ID")),pt.default.createElement(xr,{xs:12,sm:12,md:4,lg:4,label:ht.default.t("Send"),value:this.state.send,disabled:this.props.readonly,onChange:n=>this.handleChange("send",n)},ht.default.t("Send messages with the given ID")),pt.default.createElement(xr,{xs:12,sm:12,md:4,lg:4,label:ht.default.t("Autosend"),value:this.state.autosend,disabled:this.props.readonly,onChange:n=>this.handleChange("autosend",n)},ht.default.t("Automatically send the message when some data part changed"))),pt.default.createElement("h2",null,ht.default.t("Parsers")),pt.default.createElement("div",{className:e.root},pt.default.createElement(C_,{orientation:"vertical",variant:"scrollable",value:this.state.tabIndex,onChange:this.handleTabChange,className:e.tabs},Object.keys(this.state.parsers).map((n,o)=>pt.default.createElement(vl,{key:`tab-${o}`,label:this.getParserTabLabel(this.state.parsers[n]),id:`${this.props.uuid}-tab-${o}`,className:e.tab,style:{color:this.state.parsersValid[n]===!1?"red":void 0,fontStyle:this.state.parsers[n].id?void 0:"italic"}})),!this.props.readonly&&pt.default.createElement(Yie.default,{color:"primary",startIcon:pt.default.createElement(gB.default,null),onClick:this.onParserAdd},ht.default.t("Add"))),Object.keys(this.state.parsers).map((n,o)=>pt.default.createElement($s,{key:`tabpanel-${o}`,value:this.state.tabIndex,index:o,className:e.tabpanel},pt.default.createElement(gh,{uuid:n,config:this.state.parsers[n],msgId:this.state.dlc>=0?`${this.state.id}-${this.state.dlc}`:this.state.id,msgReceive:this.state.receive,msgSend:this.state.send,msgAutoSend:this.state.autosend,onChange:this.onParserChange,onValidate:this.onParserValidate,onDelete:this.onParserDelete,showToast:this.props.showToast,context:r,classes:e,readonly:this.props.readonly})))),this.state.showRemoveConfirm&&pt.default.createElement(Xie.default,{title:ht.default.t("Remove this message?"),text:ht.default.t("Are you sure you want to remove this message? This will also remove all it's parsers. The message will be treated as unconfigured and may be deleted on adapter restart."),onClose:n=>{n&&this.props.onDelete&&this.props.onDelete(this.props.uuid),this.setState({showRemoveConfirm:!1})}}))}getParserTabLabel(e){return e!=null&&e.id?e.name?`${e.name} (${e.id})`:e.id:ht.default.t("ID missing")}handleTabChange(e,r){this.setState({tabIndex:r})}async handleChange(e,r){let n={[e]:r};e==="id"&&n.dlc===void 0?n.dlc=this.state.dlc:e==="dlc"&&n.id===void 0&&(n.id=this.state.id),this.validateState(n),await new Promise(o=>{this.setState(n,()=>{this.onChange(),o()})})}onChange(){this.props.onChange&&this.props.onChange(this.props.uuid,{id:this.state.id,name:this.state.name,dlc:this.state.dlc,receive:this.state.receive,send:this.state.send,autosend:this.state.autosend,parsers:{...this.state.parsers}})}validateState(e={}){var n,o;let r=!0;if(e.id!==void 0?e.id.match(fI)?this.props.knownMessageIds.find(a=>a.id===e.id&&a.dlc===e.dlc&&a.uuid!==this.props.uuid)?(e.idError=ht.default.t("This ID is configured multiple times with this data length"),r=!1):e.idError=null:(e.idError=ht.default.t("Must be a 3 or 8 char hex ID"),r=!1):((n=this.state)==null?void 0:n.idError)!==null&&(r=!1),(o=this.state)!=null&&o.parsersValid)for(let a in this.state.parsersValid)this.state.parsersValid[a]||(r=!1);return this.props.onValidate&&this.props.onValidate(this.props.uuid,r),e}async onParserAdd(){let e=Cl(),r={id:"",name:"",dataType:"int8",dataLength:1,dataOffset:0,dataUnit:"",dataEncoding:"latin1",booleanMask:0,booleanInvert:!1,customScriptRead:"",customScriptWrite:"",customDataType:"number",commonRole:"state",commonStates:!1,autoSetInterval:!1,autoSetValue:void 0},n={...this.state.parsers};n[e]=r,await this.handleChange("parsers",n),await this.onParserValidate(e,!1),this.setState({tabIndex:Object.keys(this.state.parsers).length-1})}async onParserValidate(e,r){let n={...this.state.parsersValid};return n[e]=r,await new Promise(o=>{this.setState({parsersValid:n},()=>{this.validateState(),o()})})}onParserChange(e,r){let n={...this.state.parsers};n[e]=r,this.handleChange("parsers",n)}async onParserDelete(e){let r={...this.state.parsers},n={...this.state.parsersValid};delete r[e],delete n[e],await this.handleChange("parsers",r),this.setState({tabIndex:this.state.tabIndex-1,parsersValid:n},()=>{this.validateState(),this.state.tabIndex<0&&this.setState({tabIndex:0})})}copy(){Mi.message=JSON.stringify(this.state),this.props.showToast&&this.props.showToast(ht.default.t("Message configuration copied. Use the paste button to paste this configuration to an other message."))}paste(){if(!Mi.message){this.props.showToast&&this.props.showToast(ht.default.t("Nothing to paste. Please use the copy button first."));return}try{let e=JSON.parse(Mi.message),r=Object.keys(e.parsers);for(let n of r){let o=Cl();e.parsers[o]=e.parsers[n],delete e.parsers[n]}this.setState(this.validateState({...e}),()=>{this.onChange(),this.props.showToast&&this.props.showToast(ht.default.t("Pasted"))})}catch(e){this.props.showToast&&this.props.showToast(ht.default.t("Error while pasting: %s",`${e}`))}}};Et([Tt],da.prototype,"handleTabChange",1),Et([Tt],da.prototype,"onParserAdd",1),Et([Tt],da.prototype,"onParserValidate",1),Et([Tt],da.prototype,"onParserChange",1),Et([Tt],da.prototype,"onParserDelete",1),Et([Tt],da.prototype,"copy",1),Et([Tt],da.prototype,"paste",1);var kVe=t=>({root:{flexGrow:1,backgroundColor:t.palette.background.paper,display:"flex",height:"calc(100% - 102px)"},tabs:{borderRight:`1px solid ${t.palette.divider}`},tab:{textTransform:"none"},tabpanel:{position:"relative",width:"100%",overflowY:"auto"},fabTopRight:{"& > button":{margin:t.spacing(1)},position:"absolute",top:t.spacing(2),right:t.spacing(2)}}),qo=class extends br.default.Component{constructor(e){var n;super(e);let r=(n=this.props.native.messages)!=null?n:{};this.state={tabIndex:0,generalValid:!0,messages:r,messagesKeys:Object.keys(r).sort((o,a)=>W_(r,o,a)),messagesValid:{},messagesUnconfigured:{},messagesUnconfiguredKeys:[]}}componentDidMount(){let{socket:e,instance:r,adapterName:n}=this.props.context;e.subscribeObject(`${n}.${r}.*`,this.handleObjChange),this.loadUnconfiguredMessages()}componentWillUnmount(){let{socket:e,instance:r,adapterName:n}=this.props.context;e.unsubscribeObject(`${n}.${r}.*`,this.handleObjChange)}render(){let{classes:e,native:r,common:n,context:o}=this.props,a=0,i=Object.keys(this.state.messages).map(s=>({id:this.state.messages[s].id,dlc:this.state.messages[s].dlc,uuid:s}));return br.default.createElement("div",{className:e.root},br.default.createElement(C_,{orientation:"vertical",variant:"scrollable",value:this.state.tabIndex,onChange:this.handleTabChange,className:e.tabs},br.default.createElement(vl,{label:Ad.default.t("General"),id:"tab-0",className:e.tab,style:{color:this.state.generalValid===!1?"red":void 0}}),br.default.createElement(vl,{label:Ad.default.t("Import / Export"),id:"tab-1",className:e.tab}),br.default.createElement(jm,{textAlign:"center"},Ad.default.t("Messages")),this.state.messagesKeys.map((s,u)=>this.state.messages[s]&&br.default.createElement(vl,{key:`tab-${u+1}`,label:this.getMessageTabLabel(this.state.messages[s]),id:`tab-${u+1}`,className:e.tab,style:{color:this.state.messagesValid[s]===!1?"red":void 0,fontStyle:this.state.messages[s].id?void 0:"italic"}})),this.state.messagesUnconfiguredKeys.length>0&&br.default.createElement(jm,{textAlign:"center"},Ad.default.t("Unconfigured messages")),this.state.messagesUnconfiguredKeys.map((s,u)=>this.state.messagesUnconfigured[s]&&br.default.createElement(vl,{key:`tab-unconf-${u}`,label:this.getMessageTabLabel(this.state.messagesUnconfigured[s]),id:`tab-unconf-${u}`,className:e.tab})),br.default.createElement(Zie.default,{color:"primary",startIcon:br.default.createElement(ese.default,null),onClick:this.onMessageAdd},Ad.default.t("Add"))),br.default.createElement($s,{value:this.state.tabIndex,index:a++,className:e.tabpanel},br.default.createElement(pI,{common:n,context:o,native:r,onChange:this.onGeneralChange,onError:this.props.onError,onValidate:this.onGeneralValidate,setNative:this.props.setNative})),br.default.createElement($s,{value:this.state.tabIndex,index:a++,className:e.tabpanel},br.default.createElement(Bi,{context:o,native:r,onError:this.props.onError,setNative:this.props.setNative,showToast:this.props.showToast})),br.default.createElement($s,{value:this.state.tabIndex,index:a++}),this.state.messagesKeys.map((s,u)=>this.state.messages[s]&&br.default.createElement($s,{key:`tabpanel-${u}`,value:this.state.tabIndex,index:a++,className:e.tabpanel},br.default.createElement(da,{key:s,context:o,classes:e,uuid:s,config:this.state.messages[s],knownMessageIds:i,onChange:this.onMessageChange,onDelete:this.onMessageDelete,onValidate:this.onMessageValidate,showToast:this.props.showToast}))),this.state.messagesUnconfiguredKeys.length>0&&br.default.createElement($s,{value:this.state.tabIndex,index:a++}),this.state.messagesUnconfiguredKeys.map((s,u)=>this.state.messagesUnconfigured[s]&&br.default.createElement($s,{key:`tabpanel-${u}`,value:this.state.tabIndex,index:a++,className:e.tabpanel},br.default.createElement(da,{key:s,context:o,classes:e,uuid:s,config:this.state.messagesUnconfigured[s],knownMessageIds:[],readonly:!0,onAdd:this.onMessageAddFromUnconfigured,showToast:this.props.showToast}))))}getMessageTabLabel(e){return e!=null&&e.id?e.dlc>=0?`${e.id}-${e.dlc} ${e.name}`:`${e.id} ${e.name}`:Ad.default.t("ID missing")}handleTabChange(e,r){this.setState({tabIndex:r})}async onGeneralChange(e,r){this.props.onChange(e,r),e==="messages"&&(Object.keys(r).length===0?await new Promise(n=>{this.setState({messages:r,tabIndex:0},n)}):await new Promise(n=>{this.setState({messages:r},n)}))}onMessageChange(e,r){let n={...this.state.messages};n[e]=r,this.onGeneralChange("messages",n)}async onMessageDelete(e){let r={...this.state.messages},n={...this.state.messagesValid},o=this.state.messagesKeys.filter(a=>a!==e);delete r[e],delete n[e],await this.onGeneralChange("messages",r),this.setState({tabIndex:this.state.tabIndex-1,messagesKeys:o,messagesValid:n},()=>{this.validate(),this.state.tabIndex<3&&this.setState({tabIndex:0})}),this.loadUnconfiguredMessages()}async onGeneralValidate(e){return await new Promise(r=>{this.setState({generalValid:e},()=>{this.validate(),r()})})}async onMessageValidate(e,r){let n={...this.state.messagesValid};return n[e]=r,await new Promise(o=>{this.setState({messagesValid:n},()=>{this.validate(),o()})})}async onMessageAdd(){let e=Cl(),r={id:"",name:"",dlc:-1,receive:!1,send:!1,autosend:!1,parsers:{}},n={...this.state.messages},o=[...this.state.messagesKeys,e];n[e]=r,await this.onGeneralChange("messages",n),await this.onMessageValidate(e,!1),this.setState({tabIndex:Object.keys(this.state.messages).length+2,messagesKeys:o})}async onMessageAddFromUnconfigured(e){let r=Cl(),n={...this.state.messagesUnconfigured[e]},o={...this.state.messages},a=[...this.state.messagesKeys,r];o[r]=n,await this.onGeneralChange("messages",o);let i={...this.state.messagesUnconfigured},s=this.state.messagesUnconfiguredKeys.filter(u=>u!==e);delete i[e],this.setState({tabIndex:Object.keys(this.state.messages).length+2,messagesKeys:a,messagesUnconfigured:i,messagesUnconfiguredKeys:s})}async loadUnconfiguredMessages(){let{socket:e,instance:r,adapterName:n}=this.props.context,o=await e.getObjectView(`${n}.${r}.`,`${n}.${r}.\u9999`,"channel"),a={};for(let i in o)this.addPossiblyUnconfiguredMessage(a,o[i]);this.setState({messagesUnconfigured:a,messagesUnconfiguredKeys:Object.keys(a).sort((i,s)=>W_(a,i,s))})}addPossiblyUnconfiguredMessage(e,r){if(r.type!=="channel")return!1;let n=r._id.split(".");if(!n[2].match(moe))return!1;let[o,a]=n[2].split("-"),i=a===void 0?-1:parseInt(a,10);for(let s in this.state.messages)if(this.state.messages[s].id===o&&this.state.messages[s].dlc===i)return!1;return e[n[2]]={id:o,name:r.common.name,dlc:i,receive:!0,send:!1,autosend:!1,parsers:{}},!0}handleObjChange(e,r){let{instance:n,adapterName:o}=this.props.context;if(!e.startsWith(`${o}.${n}.`))return;let a=e.split(".");if(!a[2].match(fI))return;if(!r){this.setState(s=>{let u={...s,messagesUnconfigured:{...s.messagesUnconfigured},messagesUnconfiguredKeys:s.messagesUnconfiguredKeys.filter(l=>l!==a[2])};return delete u.messagesUnconfigured[a[2]],u});return}let i={};this.addPossiblyUnconfiguredMessage(i,r)&&this.setState(s=>({...s,messagesUnconfigured:{...s.messagesUnconfigured,...i},messagesUnconfiguredKeys:[...s.messagesUnconfiguredKeys,a[2]]}))}validate(){let e=this.state.generalValid;if(e)for(let r in this.state.messagesValid)this.state.messagesValid[r]||(e=!1);return this.props.onValidate(e),e}};Et([Tt],qo.prototype,"handleTabChange",1),Et([Tt],qo.prototype,"onGeneralChange",1),Et([Tt],qo.prototype,"onMessageChange",1),Et([Tt],qo.prototype,"onMessageDelete",1),Et([Tt],qo.prototype,"onGeneralValidate",1),Et([Tt],qo.prototype,"onMessageValidate",1),Et([Tt],qo.prototype,"onMessageAdd",1),Et([Tt],qo.prototype,"onMessageAddFromUnconfigured",1),Et([Tt],qo.prototype,"loadUnconfiguredMessages",1),Et([Tt],qo.prototype,"handleObjChange",1);var tse=(0,Qie.withStyles)(kVe)(qo);var HI={name:"canbus",version:"2.0.0",news:{"2.0.0":{en:"Node.js >= 18, Admin >= 6.17, js-contoller >= 5.0.19 are required\nChanged how custom parser scripts are interpreted. Most custom parser scripts should work as before but they have a limited scope now.\nCustom parser scripts now support `getStateAsync`, `getForeignStateAsync`, `getObjectAsync` and `getForeignObjectAsync`. If you have used `getStateAsync`/`getObjectAsync` before you need to change them to `getForeignStateAsync`/`getForeignObjectAsync` or update the IDs if you get data from the same adapter instance.\nCustom write parser scripts an now return false to cancel the write\nUpdated dependencies",de:"Node.js >= 18, Admin >= 6.17, js-contoller >= 5.0.19 sind erforderlich\nWie benutzerdefinierte Parser-Skripte interpretiert werden. Die meisten benutzerdefinierten Parser-Skripte sollten wie fr\xFCher funktionieren, aber sie haben jetzt einen begrenzten Umfang.\nBenutzerdefinierte Parser-Skripte unterst\xFCtzen jetzt `getStateAsync`, `getForeignStateAsync`, `getObjectAsync` und `getForeignObjectAsync`. Wenn Sie `getStateAsync`/`getObjectAsync` verwendet haben, bevor Sie diese auf `getForeignStateAsync`/`getForeignObjectAsync \xE4ndern m\xFCssen oder die IDs aktualisieren, wenn Sie Daten von der gleichen Adapterinstanz erhalten.\nBenutzerdefinierte Schreib-Parser-Skripte eine jetzt falsche zur\xFCck, um den schreiben\nAktualisierte Abh\xE4ngigkeiten",ru:"Node.js >= 18, \u0410\u0434\u043C\u0438\u043D >= 6.17, js-contoller >= 5.0.19 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F\n\u0418\u0437\u043C\u0435\u043D\u0438\u043B\u0441\u044F \u0441\u043F\u043E\u0441\u043E\u0431 \u0438\u043D\u0442\u0435\u0440\u043F\u0440\u0435\u0442\u0430\u0446\u0438\u0438 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0445 \u0441\u0446\u0435\u043D\u0430\u0440\u0438\u0435\u0432. \u0411\u043E\u043B\u044C\u0448\u0438\u043D\u0441\u0442\u0432\u043E \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0445 \u0441\u0446\u0435\u043D\u0430\u0440\u0438\u0435\u0432 \u043F\u0430\u0440\u0441\u0435\u0440\u0430 \u0434\u043E\u043B\u0436\u043D\u044B \u0440\u0430\u0431\u043E\u0442\u0430\u0442\u044C \u0442\u0430\u043A, \u043A\u0430\u043A \u0440\u0430\u043D\u044C\u0448\u0435, \u043D\u043E \u0442\u0435\u043F\u0435\u0440\u044C \u043E\u043D\u0438 \u0438\u043C\u0435\u044E\u0442 \u043E\u0433\u0440\u0430\u043D\u0438\u0447\u0435\u043D\u043D\u044B\u0439 \u043E\u0445\u0432\u0430\u0442.\nCustom parserScripts \u0442\u0435\u043F\u0435\u0440\u044C \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 `getStateAsync', `getForeignStateAsync', `getObjectAsync' \u0438 `getForeignObjectAsync'. \u0415\u0441\u043B\u0438 \u0432\u044B \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043B\u0438 `getStateAsync'/`getObjectAsync', \u043F\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043C \u0432\u0430\u043C \u043D\u0443\u0436\u043D\u043E \u0438\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u0438\u0445 \u043D\u0430 `getForeignStateAsync'/`getForeignObjectAsync' \u0438\u043B\u0438 \u043E\u0431\u043D\u043E\u0432\u0438\u0442\u044C \u0438\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440\u044B, \u0435\u0441\u043B\u0438 \u0432\u044B \u043F\u043E\u043B\u0443\u0447\u0438\u0442\u0435 \u0434\u0430\u043D\u043D\u044B\u0435 \u0438\u0437 \u0442\u043E\u0433\u043E \u0436\u0435 \u044D\u043A\u0437\u0435\u043C\u043F\u043B\u044F\u0440\u0430 \u0430\u0434\u0430\u043F\u0442\u0435\u0440\u0430.\n\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0439 \u043F\u0438\u0441\u0430\u0442\u044C \u043F\u0430\u0440\u0441\u0435\u0440 \u0441\u043A\u0440\u0438\u043F\u0442\u044B \u0442\u0435\u043F\u0435\u0440\u044C \u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044F \u043B\u043E\u0436\u043D\u044B\u043C, \u0447\u0442\u043E\u0431\u044B \u043E\u0442\u043C\u0435\u043D\u0438\u0442\u044C \u0437\u0430\u043F\u0438\u0441\u044C\n\u041E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u043D\u044B\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043C\u043E\u0441\u0442\u0438",pt:"Node.js >= 18, Admin >= 6.17, js-contoller >= 5.0.19 s\xE3o necess\xE1rios\nAlterado como scripts de parser personalizados s\xE3o interpretados. A maioria dos scripts de parser personalizados deve funcionar como antes, mas eles t\xEAm um escopo limitado agora.\nScripts de parser personalizados agora suportam `getStateAsync`, `getForeignStateAsync`, `getObjectAsync` e `getForeignObjectAsync`. Se voc\xEA tiver usado `getStateAsync`/`getObjectAsync` antes de precisar alter\xE1-los para `getForeignStateAsync`/`getForeignObjectAsync ou atualizar os IDs se voc\xEA receber dados da mesma inst\xE2ncia do adaptador.\nCustom escrever scripts parser um agora retornar falso para cancelar a grava\xE7\xE3o\nDepend\xEAncias atualizadas",nl:`Voor de toepassing van deze onderverdeling wordt verstaan onder: 5.0.19 zijn vereist
+buffer[1] = (value >> 8);`},Ge.default.createElement("span",{dangerouslySetInnerHTML:{__html:He.default.t("Script to write the value to the buffer. The buffer is available as %s and the value as %s.","buffer
","value
")}}))),this.props.msgSend&&Ge.default.createElement(Ke,{container:!0,spacing:3},Ge.default.createElement(xr,{xs:12,sm:6,md:4,lg:3,label:He.default.t("Automatically set a certain value"),value:typeof this.state.autoSetInterval=="number",disabled:this.props.readonly,onChange:n=>this.handleChange("autoSetInterval",n?6e4:!1)},He.default.t("Set a certain value automatically in a given interval")),typeof this.state.autoSetInterval=="number"&&Ge.default.createElement(Ge.default.Fragment,null,Ge.default.createElement(tn,{xs:12,sm:6,md:4,lg:3,label:He.default.t("Interval for automatic set"),value:this.state.autoSetInterval.toString(),disabled:this.props.readonly,onChange:n=>this.handleChange("autoSetInterval",parseInt(n,10)||0),transform:n=>n.replace(/\D/g,"")},He.default.t("Interval in milliseconds to automatically set the value")),r==="number"&&Ge.default.createElement(tn,{xs:12,sm:6,md:4,lg:3,label:He.default.t("Value to set"),value:(this.state.autoSetValue||0).toString(),disabled:this.props.readonly,onChange:n=>this.handleChange("autoSetValue",parseFloat(n)||0),transform:n=>n.replace(",",".").replace(/[^\d.]/g,"")},He.default.t("The value to set automatically in the given interval (%s)",r)),r==="boolean"&&Ge.default.createElement(xr,{xs:12,sm:6,md:4,lg:3,label:He.default.t("Value to set"),value:!!this.state.autoSetValue,disabled:this.props.readonly,onChange:n=>this.handleChange("autoSetValue",n)},He.default.t("The value to set automatically in the given interval (%s)",r)),r==="string"&&Ge.default.createElement(tn,{xs:12,sm:6,md:4,lg:3,label:He.default.t("Value to set"),value:this.state.autoSetValue||"",disabled:this.props.readonly,onChange:n=>this.handleChange("autoSetValue",n)},He.default.t("The value to set automatically in the given interval (%s)",r)),!this.props.msgAutoSend&&Ge.default.createElement(xr,{xs:12,sm:6,md:4,lg:3,label:He.default.t("Trigger send"),value:!!this.state.autoSetTriggerSend,disabled:this.props.readonly,onChange:n=>this.handleChange("autoSetTriggerSend",n)},He.default.t("Trigger the send action every time the value is set automatically")))))}onChange(){this.props.onChange(this.props.uuid,{id:this.state.id,name:this.state.name,dataType:this.state.dataType,dataLength:this.state.dataLength,dataOffset:this.state.dataOffset,dataUnit:this.state.dataUnit,dataEncoding:this.state.dataEncoding,booleanMask:this.state.booleanMask,booleanInvert:this.state.booleanInvert,customScriptRead:this.state.customScriptRead,customScriptWrite:this.state.customScriptWrite,customDataType:this.state.customDataType,commonRole:this.state.commonRole,commonStates:this.state.commonStates,autoSetInterval:this.state.autoSetInterval,autoSetValue:this.state.autoSetValue,autoSetTriggerSend:this.state.autoSetTriggerSend})}handleChange(e,r){let n={[e]:r};this.updateDependedElements(n),this.validateState(n),this.setState(n,()=>{this.onChange()})}updateDependedElements(e){var n,o,a;switch(e.dataType||((n=this.state)==null?void 0:n.dataType)||"uint8"){case"boolean":e.disabledDataOffsets=[],e.disabledDataLengths=["2","3","4","5","6","7","8"],e.dataLength=1,e.disabledDataEncoding=!0,e.disabledDataUnit=!0,e.disabledDataOffsetAndLength=!1,e.dataUnit="";break;case"int8":case"uint8":e.disabledDataOffsets=[],e.disabledDataLengths=["2","3","4","5","6","7","8"],e.dataLength=1,e.disabledDataEncoding=!0,e.disabledDataUnit=!1,e.disabledDataOffsetAndLength=!1;break;case"int16_be":case"int16_le":case"uint16_be":case"uint16_le":e.disabledDataOffsets=["7"],e.disabledDataLengths=["1","3","4","5","6","7","8"],e.dataLength=2,e.disabledDataEncoding=!0,e.disabledDataUnit=!1,e.disabledDataOffsetAndLength=!1;break;case"int32_be":case"int32_le":case"uint32_be":case"uint32_le":case"float32_be":case"float32_le":e.disabledDataOffsets=["5","6","7"],e.disabledDataLengths=["1","2","3","5","6","7","8"],e.dataLength=4,e.disabledDataEncoding=!0,e.disabledDataUnit=!1,e.disabledDataOffsetAndLength=!1;break;case"double64_be":case"double64_le":e.disabledDataOffsets=["1","2","3","4","5","6","7"],e.disabledDataLengths=["1","2","3","4","5","6","7"],e.dataLength=8,e.disabledDataEncoding=!0,e.disabledDataUnit=!1,e.disabledDataOffsetAndLength=!1;break;case"string":{e.disabledDataOffsets=[],e.disabledDataLengths=[],e.disabledDataEncoding=!1,e.disabledDataUnit=!0,e.disabledDataOffsetAndLength=!1,e.dataUnit="";let i=(o=e.dataOffset)!=null?o:this.state.dataOffset;((a=e.dataLength)!=null?a:this.state.dataLength)+i>8&&(e.dataLength=8-i);for(let u=1;u<=8;u++)u+i>8&&e.disabledDataLengths.push(u.toString());break}case"custom":e.disabledDataOffsets=[],e.disabledDataLengths=[],e.dataOffset=0,e.dataLength=8,e.disabledDataEncoding=!0,e.disabledDataUnit=!1,e.disabledDataOffsetAndLength=!0;break}return e}validateState(e){var n,o;let r=!0;return e.id!==void 0?goe.includes(e.id)?(e.idError=He.default.t("This ID is reserved and can't be used"),r=!1):e.id.match(hoe)?e.idError=null:(e.idError=He.default.t("Only allowed chars: %s","0-9a-z-_"),r=!1):((n=this.state)==null?void 0:n.idError)!==null&&(r=!1),e.commonStates!==void 0?e.commonStates!==!1&&!e.commonStates.match(voe)?(e.commonStatesError=He.default.t("Invalid format! Please use the format value=text,value=text,..."),r=!1):e.commonStatesError=null:(o=this.state)!=null&&o.commonStatesError&&(r=!1),this.props.onValidate(this.props.uuid,r),e}copy(){Mi.parser=JSON.stringify(this.state),this.props.showToast&&this.props.showToast(He.default.t("Parser configuration copied. Use the paste button to paste this configuration to an other parser."))}paste(){if(!Mi.parser){this.props.showToast&&this.props.showToast(He.default.t("Nothing to paste. Please use the copy button first."));return}try{let e=JSON.parse(Mi.parser);this.setState(this.validateState({...e}),()=>{this.onChange(),this.props.showToast&&this.props.showToast(He.default.t("Pasted"))})}catch(e){this.props.showToast&&this.props.showToast(He.default.t("Error while pasting: %s",`${e}`))}}};Et([Tt],gh.prototype,"copy",1),Et([Tt],gh.prototype,"paste",1);var da=class extends pt.default.Component{constructor(e){super(e),this.state=this.validateState({tabIndex:0,id:this.props.config.id||"",idError:null,name:this.props.config.name||"",dlc:typeof this.props.config.dlc=="number"?this.props.config.dlc:-1,receive:this.props.config.receive||!1,send:this.props.config.send||!1,autosend:this.props.config.autosend||!1,parsers:this.props.config.parsers||{},parsersValid:{},showRemoveConfirm:!1})}componentDidMount(){this.validateState()}render(){let{classes:e,context:r}=this.props;return pt.default.createElement(pt.default.Fragment,null,pt.default.createElement("div",{className:e.fabTopRight},pt.default.createElement(X_.default,{size:"small",color:"primary","aria-label":"copy",title:ht.default.t("Copy"),onClick:this.copy},pt.default.createElement(BI,null)),pt.default.createElement(X_.default,{size:"small",color:"primary","aria-label":"paste",title:ht.default.t("Paste"),onClick:this.paste,disabled:this.props.readonly||!Mi.message},pt.default.createElement(UI,null)),pt.default.createElement(X_.default,{size:"small",color:"primary","aria-label":"delete",title:ht.default.t("Remove"),onClick:()=>this.setState({showRemoveConfirm:!0}),disabled:this.props.readonly||!this.props.onDelete},pt.default.createElement(Jie.default,null)),this.props.onAdd&&pt.default.createElement(X_.default,{size:"small",color:"primary","aria-label":"add",title:ht.default.t("Add"),onClick:()=>this.props.onAdd&&this.props.onAdd(this.props.uuid)},pt.default.createElement(gB.default,null))),pt.default.createElement("h2",null,ht.default.t("Message")),pt.default.createElement(Ke,{container:!0,spacing:3},pt.default.createElement(tn,{xs:12,sm:6,md:4,lg:2,label:ht.default.t("Message ID"),value:this.state.id,required:!0,errorMsg:this.state.idError,disabled:this.props.readonly,transform:"upperCase",onChange:n=>this.handleChange("id",n)},ht.default.t("CAN message ID in hex"),", ",ht.default.t("e.g.")," ",pt.default.createElement("code",null,"00A0123B")," ",ht.default.t("or")," ",pt.default.createElement("code",null,"1AB")),pt.default.createElement(tn,{xs:12,sm:6,md:4,lg:4,label:ht.default.t("Name"),value:this.state.name,disabled:this.props.readonly,onChange:n=>this.handleChange("name",n)},ht.default.t("e.g.")," ",pt.default.createElement("code",null,ht.default.t("My super message"))),pt.default.createElement(No,{xs:12,sm:6,md:4,lg:3,label:ht.default.t("Data length"),value:this.state.dlc.toString(),options:{"-1":ht.default.t("Not set"),0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8"},disabled:this.props.readonly,onChange:n=>this.handleChange("dlc",parseInt(n,10))},ht.default.t("Optionally set a fixed data length for this message"))),pt.default.createElement(Ke,{container:!0,spacing:3},pt.default.createElement(xr,{xs:12,sm:12,md:4,lg:4,label:ht.default.t("Receive"),value:this.state.receive,disabled:this.props.readonly,onChange:n=>this.handleChange("receive",n)},ht.default.t("Receive messages with the given ID")),pt.default.createElement(xr,{xs:12,sm:12,md:4,lg:4,label:ht.default.t("Send"),value:this.state.send,disabled:this.props.readonly,onChange:n=>this.handleChange("send",n)},ht.default.t("Send messages with the given ID")),pt.default.createElement(xr,{xs:12,sm:12,md:4,lg:4,label:ht.default.t("Autosend"),value:this.state.autosend,disabled:this.props.readonly,onChange:n=>this.handleChange("autosend",n)},ht.default.t("Automatically send the message when some data part changed"))),pt.default.createElement("h2",null,ht.default.t("Parsers")),pt.default.createElement("div",{className:e.root},pt.default.createElement(C_,{orientation:"vertical",variant:"scrollable",value:this.state.tabIndex,onChange:this.handleTabChange,className:e.tabs},Object.keys(this.state.parsers).map((n,o)=>pt.default.createElement(vl,{key:`tab-${o}`,label:this.getParserTabLabel(this.state.parsers[n]),id:`${this.props.uuid}-tab-${o}`,className:e.tab,style:{color:this.state.parsersValid[n]===!1?"red":void 0,fontStyle:this.state.parsers[n].id?void 0:"italic"}})),!this.props.readonly&&pt.default.createElement(Yie.default,{color:"primary",startIcon:pt.default.createElement(gB.default,null),onClick:this.onParserAdd},ht.default.t("Add"))),Object.keys(this.state.parsers).map((n,o)=>pt.default.createElement($s,{key:`tabpanel-${o}`,value:this.state.tabIndex,index:o,className:e.tabpanel},pt.default.createElement(gh,{uuid:n,config:this.state.parsers[n],msgId:this.state.dlc>=0?`${this.state.id}-${this.state.dlc}`:this.state.id,msgReceive:this.state.receive,msgSend:this.state.send,msgAutoSend:this.state.autosend,onChange:this.onParserChange,onValidate:this.onParserValidate,onDelete:this.onParserDelete,showToast:this.props.showToast,context:r,classes:e,readonly:this.props.readonly})))),this.state.showRemoveConfirm&&pt.default.createElement(Xie.default,{title:ht.default.t("Remove this message?"),text:ht.default.t("Are you sure you want to remove this message? This will also remove all it's parsers. The message will be treated as unconfigured and may be deleted on adapter restart."),onClose:n=>{n&&this.props.onDelete&&this.props.onDelete(this.props.uuid),this.setState({showRemoveConfirm:!1})}}))}getParserTabLabel(e){return e!=null&&e.id?e.name?`${e.name} (${e.id})`:e.id:ht.default.t("ID missing")}handleTabChange(e,r){this.setState({tabIndex:r})}async handleChange(e,r){let n={[e]:r};e==="id"&&n.dlc===void 0?n.dlc=this.state.dlc:e==="dlc"&&n.id===void 0&&(n.id=this.state.id),this.validateState(n),await new Promise(o=>{this.setState(n,()=>{this.onChange(),o()})})}onChange(){this.props.onChange&&this.props.onChange(this.props.uuid,{id:this.state.id,name:this.state.name,dlc:this.state.dlc,receive:this.state.receive,send:this.state.send,autosend:this.state.autosend,parsers:{...this.state.parsers}})}validateState(e={}){var n,o;let r=!0;if(e.id!==void 0?e.id.match(fI)?this.props.knownMessageIds.find(a=>a.id===e.id&&a.dlc===e.dlc&&a.uuid!==this.props.uuid)?(e.idError=ht.default.t("This ID is configured multiple times with this data length"),r=!1):e.idError=null:(e.idError=ht.default.t("Must be a 3 or 8 char hex ID"),r=!1):((n=this.state)==null?void 0:n.idError)!==null&&(r=!1),(o=this.state)!=null&&o.parsersValid)for(let a in this.state.parsersValid)this.state.parsersValid[a]||(r=!1);return this.props.onValidate&&this.props.onValidate(this.props.uuid,r),e}async onParserAdd(){let e=Cl(),r={id:"",name:"",dataType:"int8",dataLength:1,dataOffset:0,dataUnit:"",dataEncoding:"latin1",booleanMask:0,booleanInvert:!1,customScriptRead:"",customScriptWrite:"",customDataType:"number",commonRole:"state",commonStates:!1,autoSetInterval:!1,autoSetValue:void 0},n={...this.state.parsers};n[e]=r,await this.handleChange("parsers",n),await this.onParserValidate(e,!1),this.setState({tabIndex:Object.keys(this.state.parsers).length-1})}async onParserValidate(e,r){let n={...this.state.parsersValid};return n[e]=r,await new Promise(o=>{this.setState({parsersValid:n},()=>{this.validateState(),o()})})}onParserChange(e,r){let n={...this.state.parsers};n[e]=r,this.handleChange("parsers",n)}async onParserDelete(e){let r={...this.state.parsers},n={...this.state.parsersValid};delete r[e],delete n[e],await this.handleChange("parsers",r),this.setState({tabIndex:this.state.tabIndex-1,parsersValid:n},()=>{this.validateState(),this.state.tabIndex<0&&this.setState({tabIndex:0})})}copy(){Mi.message=JSON.stringify(this.state),this.props.showToast&&this.props.showToast(ht.default.t("Message configuration copied. Use the paste button to paste this configuration to an other message."))}paste(){if(!Mi.message){this.props.showToast&&this.props.showToast(ht.default.t("Nothing to paste. Please use the copy button first."));return}try{let e=JSON.parse(Mi.message),r=Object.keys(e.parsers);for(let n of r){let o=Cl();e.parsers[o]=e.parsers[n],delete e.parsers[n]}this.setState(this.validateState({...e}),()=>{this.onChange(),this.props.showToast&&this.props.showToast(ht.default.t("Pasted"))})}catch(e){this.props.showToast&&this.props.showToast(ht.default.t("Error while pasting: %s",`${e}`))}}};Et([Tt],da.prototype,"handleTabChange",1),Et([Tt],da.prototype,"onParserAdd",1),Et([Tt],da.prototype,"onParserValidate",1),Et([Tt],da.prototype,"onParserChange",1),Et([Tt],da.prototype,"onParserDelete",1),Et([Tt],da.prototype,"copy",1),Et([Tt],da.prototype,"paste",1);var kVe=t=>({root:{flexGrow:1,backgroundColor:t.palette.background.paper,display:"flex",height:"calc(100% - 102px)"},tabs:{borderRight:`1px solid ${t.palette.divider}`},tab:{textTransform:"none"},tabpanel:{position:"relative",width:"100%",overflowY:"auto"},fabTopRight:{"& > button":{margin:t.spacing(1)},position:"absolute",top:t.spacing(2),right:t.spacing(2)}}),qo=class extends br.default.Component{constructor(e){var n;super(e);let r=(n=this.props.native.messages)!=null?n:{};this.state={tabIndex:0,generalValid:!0,messages:r,messagesKeys:Object.keys(r).sort((o,a)=>W_(r,o,a)),messagesValid:{},messagesUnconfigured:{},messagesUnconfiguredKeys:[]}}componentDidMount(){let{socket:e,instance:r,adapterName:n}=this.props.context;e.subscribeObject(`${n}.${r}.*`,this.handleObjChange),this.loadUnconfiguredMessages()}componentWillUnmount(){let{socket:e,instance:r,adapterName:n}=this.props.context;e.unsubscribeObject(`${n}.${r}.*`,this.handleObjChange)}render(){let{classes:e,native:r,common:n,context:o}=this.props,a=0,i=Object.keys(this.state.messages).map(s=>({id:this.state.messages[s].id,dlc:this.state.messages[s].dlc,uuid:s}));return br.default.createElement("div",{className:e.root},br.default.createElement(C_,{orientation:"vertical",variant:"scrollable",value:this.state.tabIndex,onChange:this.handleTabChange,className:e.tabs},br.default.createElement(vl,{label:Ad.default.t("General"),id:"tab-0",className:e.tab,style:{color:this.state.generalValid===!1?"red":void 0}}),br.default.createElement(vl,{label:Ad.default.t("Import / Export"),id:"tab-1",className:e.tab}),br.default.createElement(jm,{textAlign:"center"},Ad.default.t("Messages")),this.state.messagesKeys.map((s,u)=>this.state.messages[s]&&br.default.createElement(vl,{key:`tab-${u+1}`,label:this.getMessageTabLabel(this.state.messages[s]),id:`tab-${u+1}`,className:e.tab,style:{color:this.state.messagesValid[s]===!1?"red":void 0,fontStyle:this.state.messages[s].id?void 0:"italic"}})),this.state.messagesUnconfiguredKeys.length>0&&br.default.createElement(jm,{textAlign:"center"},Ad.default.t("Unconfigured messages")),this.state.messagesUnconfiguredKeys.map((s,u)=>this.state.messagesUnconfigured[s]&&br.default.createElement(vl,{key:`tab-unconf-${u}`,label:this.getMessageTabLabel(this.state.messagesUnconfigured[s]),id:`tab-unconf-${u}`,className:e.tab})),br.default.createElement(Zie.default,{color:"primary",startIcon:br.default.createElement(ese.default,null),onClick:this.onMessageAdd},Ad.default.t("Add"))),br.default.createElement($s,{value:this.state.tabIndex,index:a++,className:e.tabpanel},br.default.createElement(pI,{common:n,context:o,native:r,onChange:this.onGeneralChange,onError:this.props.onError,onValidate:this.onGeneralValidate,setNative:this.props.setNative})),br.default.createElement($s,{value:this.state.tabIndex,index:a++,className:e.tabpanel},br.default.createElement(Bi,{context:o,native:r,onError:this.props.onError,setNative:this.props.setNative,showToast:this.props.showToast})),br.default.createElement($s,{value:this.state.tabIndex,index:a++}),this.state.messagesKeys.map((s,u)=>this.state.messages[s]&&br.default.createElement($s,{key:`tabpanel-${u}`,value:this.state.tabIndex,index:a++,className:e.tabpanel},br.default.createElement(da,{key:s,context:o,classes:e,uuid:s,config:this.state.messages[s],knownMessageIds:i,onChange:this.onMessageChange,onDelete:this.onMessageDelete,onValidate:this.onMessageValidate,showToast:this.props.showToast}))),this.state.messagesUnconfiguredKeys.length>0&&br.default.createElement($s,{value:this.state.tabIndex,index:a++}),this.state.messagesUnconfiguredKeys.map((s,u)=>this.state.messagesUnconfigured[s]&&br.default.createElement($s,{key:`tabpanel-${u}`,value:this.state.tabIndex,index:a++,className:e.tabpanel},br.default.createElement(da,{key:s,context:o,classes:e,uuid:s,config:this.state.messagesUnconfigured[s],knownMessageIds:[],readonly:!0,onAdd:this.onMessageAddFromUnconfigured,showToast:this.props.showToast}))))}getMessageTabLabel(e){return e!=null&&e.id?e.dlc>=0?`${e.id}-${e.dlc} ${e.name}`:`${e.id} ${e.name}`:Ad.default.t("ID missing")}handleTabChange(e,r){this.setState({tabIndex:r})}async onGeneralChange(e,r){this.props.onChange(e,r),e==="messages"&&(Object.keys(r).length===0?await new Promise(n=>{this.setState({messages:r,tabIndex:0},n)}):await new Promise(n=>{this.setState({messages:r},n)}))}onMessageChange(e,r){let n={...this.state.messages};n[e]=r,this.onGeneralChange("messages",n)}async onMessageDelete(e){let r={...this.state.messages},n={...this.state.messagesValid},o=this.state.messagesKeys.filter(a=>a!==e);delete r[e],delete n[e],await this.onGeneralChange("messages",r),this.setState({tabIndex:this.state.tabIndex-1,messagesKeys:o,messagesValid:n},()=>{this.validate(),this.state.tabIndex<3&&this.setState({tabIndex:0})}),this.loadUnconfiguredMessages()}async onGeneralValidate(e){return await new Promise(r=>{this.setState({generalValid:e},()=>{this.validate(),r()})})}async onMessageValidate(e,r){let n={...this.state.messagesValid};return n[e]=r,await new Promise(o=>{this.setState({messagesValid:n},()=>{this.validate(),o()})})}async onMessageAdd(){let e=Cl(),r={id:"",name:"",dlc:-1,receive:!1,send:!1,autosend:!1,parsers:{}},n={...this.state.messages},o=[...this.state.messagesKeys,e];n[e]=r,await this.onGeneralChange("messages",n),await this.onMessageValidate(e,!1),this.setState({tabIndex:Object.keys(this.state.messages).length+2,messagesKeys:o})}async onMessageAddFromUnconfigured(e){let r=Cl(),n={...this.state.messagesUnconfigured[e]},o={...this.state.messages},a=[...this.state.messagesKeys,r];o[r]=n,await this.onGeneralChange("messages",o);let i={...this.state.messagesUnconfigured},s=this.state.messagesUnconfiguredKeys.filter(u=>u!==e);delete i[e],this.setState({tabIndex:Object.keys(this.state.messages).length+2,messagesKeys:a,messagesUnconfigured:i,messagesUnconfiguredKeys:s})}async loadUnconfiguredMessages(){let{socket:e,instance:r,adapterName:n}=this.props.context,o=await e.getObjectView(`${n}.${r}.`,`${n}.${r}.\u9999`,"channel"),a={};for(let i in o)this.addPossiblyUnconfiguredMessage(a,o[i]);this.setState({messagesUnconfigured:a,messagesUnconfiguredKeys:Object.keys(a).sort((i,s)=>W_(a,i,s))})}addPossiblyUnconfiguredMessage(e,r){if(r.type!=="channel")return!1;let n=r._id.split(".");if(!n[2].match(moe))return!1;let[o,a]=n[2].split("-"),i=a===void 0?-1:parseInt(a,10);for(let s in this.state.messages)if(this.state.messages[s].id===o&&this.state.messages[s].dlc===i)return!1;return e[n[2]]={id:o,name:r.common.name,dlc:i,receive:!0,send:!1,autosend:!1,parsers:{}},!0}handleObjChange(e,r){let{instance:n,adapterName:o}=this.props.context;if(!e.startsWith(`${o}.${n}.`))return;let a=e.split(".");if(!a[2].match(fI))return;if(!r){this.setState(s=>{let u={...s,messagesUnconfigured:{...s.messagesUnconfigured},messagesUnconfiguredKeys:s.messagesUnconfiguredKeys.filter(l=>l!==a[2])};return delete u.messagesUnconfigured[a[2]],u});return}let i={};this.addPossiblyUnconfiguredMessage(i,r)&&this.setState(s=>({...s,messagesUnconfigured:{...s.messagesUnconfigured,...i},messagesUnconfiguredKeys:[...s.messagesUnconfiguredKeys,a[2]]}))}validate(){let e=this.state.generalValid;if(e)for(let r in this.state.messagesValid)this.state.messagesValid[r]||(e=!1);return this.props.onValidate(e),e}};Et([Tt],qo.prototype,"handleTabChange",1),Et([Tt],qo.prototype,"onGeneralChange",1),Et([Tt],qo.prototype,"onMessageChange",1),Et([Tt],qo.prototype,"onMessageDelete",1),Et([Tt],qo.prototype,"onGeneralValidate",1),Et([Tt],qo.prototype,"onMessageValidate",1),Et([Tt],qo.prototype,"onMessageAdd",1),Et([Tt],qo.prototype,"onMessageAddFromUnconfigured",1),Et([Tt],qo.prototype,"loadUnconfiguredMessages",1),Et([Tt],qo.prototype,"handleObjChange",1);var tse=(0,Qie.withStyles)(kVe)(qo);var HI={name:"canbus",version:"2.0.0",news:{"2.0.0":{en:"Node.js >= 18, Admin >= 6.17, js-contoller >= 5.0.19 are required\nChanged how custom parser scripts are interpreted. Most custom parser scripts should work as before but they have a limited scope now.\nCustom parser scripts now support `getStateAsync`, `getForeignStateAsync`, `getObjectAsync` and `getForeignObjectAsync`. If you have used `getStateAsync`/`getObjectAsync` before you need to change them to `getForeignStateAsync`/`getForeignObjectAsync` or update the IDs if you get data from the same adapter instance.\nCustom write parser scripts an now return false to cancel the write\nUpdated dependencies",de:"Node.js >= 18, Admin >= 6.17, js-contoller >= 5.0.19 sind erforderlich\nArt der Ausf\xFChrung der Skripte in benutzerdefinierten Parsern ge\xE4ndert. Skripte sollten wie fr\xFCher funktionieren, aber sie werden jetzt in einer eingeschr\xE4nkten Umgebung ausgef\xFChrt.\nSkripte benutzerdefinierter Parser unterst\xFCtzen jetzt `getStateAsync`, `getForeignStateAsync`, `getObjectAsync` und `getForeignObjectAsync`. Wenn zuvor `getStateAsync`/`getObjectAsync` verwendet wurde, m\xFCssen diese ggf. auf `getForeignStateAsync`/`getForeignObjectAsync ge\xE4ndert werden oder die IDs m\xFCssen aktualisiert werden, wenn Sie Daten von der gleichen Adapterinstanz erhalten.\nSchreiben-Skripte benutzerdefinierter Parser k\xF6nnen jetzt `false` zur\xFCckgeben, um das Schreiben abzubrechen\nAbh\xE4ngigkeiten aktualisiert",ru:"Node.js >= 18, \u0410\u0434\u043C\u0438\u043D >= 6.17, js-contoller >= 5.0.19 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F\n\u0418\u0437\u043C\u0435\u043D\u0438\u043B\u0441\u044F \u0441\u043F\u043E\u0441\u043E\u0431 \u0438\u043D\u0442\u0435\u0440\u043F\u0440\u0435\u0442\u0430\u0446\u0438\u0438 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0445 \u0441\u0446\u0435\u043D\u0430\u0440\u0438\u0435\u0432. \u0411\u043E\u043B\u044C\u0448\u0438\u043D\u0441\u0442\u0432\u043E \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0445 \u0441\u0446\u0435\u043D\u0430\u0440\u0438\u0435\u0432 \u043F\u0430\u0440\u0441\u0435\u0440\u0430 \u0434\u043E\u043B\u0436\u043D\u044B \u0440\u0430\u0431\u043E\u0442\u0430\u0442\u044C \u0442\u0430\u043A, \u043A\u0430\u043A \u0440\u0430\u043D\u044C\u0448\u0435, \u043D\u043E \u0442\u0435\u043F\u0435\u0440\u044C \u043E\u043D\u0438 \u0438\u043C\u0435\u044E\u0442 \u043E\u0433\u0440\u0430\u043D\u0438\u0447\u0435\u043D\u043D\u044B\u0439 \u043E\u0445\u0432\u0430\u0442.\nCustom parserScripts \u0442\u0435\u043F\u0435\u0440\u044C \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 `getStateAsync', `getForeignStateAsync', `getObjectAsync' \u0438 `getForeignObjectAsync'. \u0415\u0441\u043B\u0438 \u0432\u044B \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043B\u0438 `getStateAsync'/`getObjectAsync', \u043F\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043C \u0432\u0430\u043C \u043D\u0443\u0436\u043D\u043E \u0438\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u0438\u0445 \u043D\u0430 `getForeignStateAsync'/`getForeignObjectAsync' \u0438\u043B\u0438 \u043E\u0431\u043D\u043E\u0432\u0438\u0442\u044C \u0438\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440\u044B, \u0435\u0441\u043B\u0438 \u0432\u044B \u043F\u043E\u043B\u0443\u0447\u0438\u0442\u0435 \u0434\u0430\u043D\u043D\u044B\u0435 \u0438\u0437 \u0442\u043E\u0433\u043E \u0436\u0435 \u044D\u043A\u0437\u0435\u043C\u043F\u043B\u044F\u0440\u0430 \u0430\u0434\u0430\u043F\u0442\u0435\u0440\u0430.\n\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0439 \u043F\u0438\u0441\u0430\u0442\u044C \u043F\u0430\u0440\u0441\u0435\u0440 \u0441\u043A\u0440\u0438\u043F\u0442\u044B \u0442\u0435\u043F\u0435\u0440\u044C \u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044F \u043B\u043E\u0436\u043D\u044B\u043C, \u0447\u0442\u043E\u0431\u044B \u043E\u0442\u043C\u0435\u043D\u0438\u0442\u044C \u0437\u0430\u043F\u0438\u0441\u044C\n\u041E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u043D\u044B\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043C\u043E\u0441\u0442\u0438",pt:"Node.js >= 18, Admin >= 6.17, js-contoller >= 5.0.19 s\xE3o necess\xE1rios\nAlterado como scripts de parser personalizados s\xE3o interpretados. A maioria dos scripts de parser personalizados deve funcionar como antes, mas eles t\xEAm um escopo limitado agora.\nScripts de parser personalizados agora suportam `getStateAsync`, `getForeignStateAsync`, `getObjectAsync` e `getForeignObjectAsync`. Se voc\xEA tiver usado `getStateAsync`/`getObjectAsync` antes de precisar alter\xE1-los para `getForeignStateAsync`/`getForeignObjectAsync ou atualizar os IDs se voc\xEA receber dados da mesma inst\xE2ncia do adaptador.\nCustom escrever scripts parser um agora retornar falso para cancelar a grava\xE7\xE3o\nDepend\xEAncias atualizadas",nl:`Voor de toepassing van deze onderverdeling wordt verstaan onder: 5.0.19 zijn vereist
Veranderd hoe aangepaste parser scripts worden ge\xEFnterpreteerd. De meeste aangepaste parser scripts moeten werken als voorheen, maar ze hebben een beperkte reikwijdte nu.
Aangepaste parser scripts ondersteunen nu Als u gebruik hebt gemaakt van .
Aangepast schrijven parser scripts an now return false to cancel the write
diff --git a/admin/build/index.js.map b/admin/build/index.js.map
index 8dff69f..96109ab 100644
--- a/admin/build/index.js.map
+++ b/admin/build/index.js.map
@@ -1,7 +1,7 @@
{
"version": 3,
"sources": ["../../node_modules/object-assign/index.js", "../../node_modules/react/cjs/react.production.min.js", "../../node_modules/react/index.js", "../../node_modules/scheduler/cjs/scheduler.production.min.js", "../../node_modules/scheduler/index.js", "../../node_modules/react-dom/cjs/react-dom.production.min.js", "../../node_modules/react-dom/index.js", "../../node_modules/@babel/runtime/helpers/interopRequireDefault.js", "../../node_modules/@babel/runtime/helpers/typeof.js", "../../node_modules/@babel/runtime/helpers/interopRequireWildcard.js", "../../node_modules/@material-ui/utils/chainPropTypes.js", "../../node_modules/@babel/runtime/helpers/extends.js", "../../node_modules/@material-ui/utils/deepmerge.js", "../../node_modules/prop-types/lib/ReactPropTypesSecret.js", "../../node_modules/prop-types/factoryWithThrowingShims.js", "../../node_modules/prop-types/index.js", "../../node_modules/@material-ui/utils/elementAcceptingRef.js", "../../node_modules/@material-ui/utils/elementTypeAcceptingRef.js", "../../node_modules/@babel/runtime/helpers/toPrimitive.js", "../../node_modules/@babel/runtime/helpers/toPropertyKey.js", "../../node_modules/@babel/runtime/helpers/defineProperty.js", "../../node_modules/@material-ui/utils/exactProp.js", "../../node_modules/@material-ui/utils/formatMuiErrorMessage.js", "../../node_modules/react-is/cjs/react-is.production.min.js", "../../node_modules/react-is/index.js", "../../node_modules/@material-ui/utils/getDisplayName.js", "../../node_modules/@material-ui/utils/HTMLElementType.js", "../../node_modules/@material-ui/utils/ponyfillGlobal.js", "../../node_modules/@material-ui/utils/refType.js", "../../node_modules/@material-ui/utils/index.js", "../../node_modules/@material-ui/core/styles/colorManipulator.js", "../../node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js", "../../node_modules/@babel/runtime/helpers/objectWithoutProperties.js", "../../node_modules/@material-ui/core/styles/createBreakpoints.js", "../../node_modules/@material-ui/core/styles/createMixins.js", "../../node_modules/@material-ui/core/colors/common.js", "../../node_modules/@material-ui/core/colors/grey.js", "../../node_modules/@material-ui/core/colors/indigo.js", "../../node_modules/@material-ui/core/colors/pink.js", "../../node_modules/@material-ui/core/colors/red.js", "../../node_modules/@material-ui/core/colors/orange.js", "../../node_modules/@material-ui/core/colors/blue.js", "../../node_modules/@material-ui/core/colors/green.js", "../../node_modules/@material-ui/core/styles/createPalette.js", "../../node_modules/@material-ui/core/styles/createTypography.js", "../../node_modules/@material-ui/core/styles/shadows.js", "../../node_modules/@material-ui/core/styles/shape.js", "../../node_modules/@material-ui/system/responsivePropType.js", "../../node_modules/@babel/runtime/helpers/arrayLikeToArray.js", "../../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js", "../../node_modules/@babel/runtime/helpers/iterableToArray.js", "../../node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js", "../../node_modules/@babel/runtime/helpers/nonIterableSpread.js", "../../node_modules/@babel/runtime/helpers/toConsumableArray.js", "../../node_modules/@material-ui/system/merge.js", "../../node_modules/@material-ui/system/breakpoints.js", "../../node_modules/@material-ui/system/style.js", "../../node_modules/@material-ui/system/compose.js", "../../node_modules/@material-ui/system/borders.js", "../../node_modules/@material-ui/system/styleFunctionSx.js", "../../node_modules/@material-ui/system/display.js", "../../node_modules/@material-ui/system/flexbox.js", "../../node_modules/@material-ui/system/grid.js", "../../node_modules/@material-ui/system/palette.js", "../../node_modules/@material-ui/system/positions.js", "../../node_modules/@material-ui/system/shadows.js", "../../node_modules/@material-ui/system/sizing.js", "../../node_modules/@babel/runtime/helpers/arrayWithHoles.js", "../../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js", "../../node_modules/@babel/runtime/helpers/nonIterableRest.js", "../../node_modules/@babel/runtime/helpers/slicedToArray.js", "../../node_modules/@material-ui/system/memoize.js", "../../node_modules/@material-ui/system/spacing.js", "../../node_modules/@material-ui/system/typography.js", "../../node_modules/@material-ui/system/index.js", "../../node_modules/@material-ui/core/styles/createSpacing.js", "../../node_modules/@material-ui/core/styles/transitions.js", "../../node_modules/@material-ui/core/styles/zIndex.js", "../../node_modules/@material-ui/core/styles/createTheme.js", "../../node_modules/@material-ui/core/styles/createMuiStrictModeTheme.js", "../../node_modules/@material-ui/styles/ThemeProvider/nested.js", "../../node_modules/@material-ui/styles/createGenerateClassName/createGenerateClassName.js", "../../node_modules/@material-ui/styles/createGenerateClassName/index.js", "../../node_modules/@material-ui/styles/createStyles/createStyles.js", "../../node_modules/@material-ui/styles/createStyles/index.js", "../../node_modules/@material-ui/styles/getThemeProps/getThemeProps.js", "../../node_modules/@material-ui/styles/getThemeProps/index.js", "../../node_modules/tiny-warning/dist/tiny-warning.cjs.js", "../../node_modules/is-in-browser/dist/index.js", "../../node_modules/@babel/runtime/helpers/createClass.js", "../../node_modules/@babel/runtime/helpers/setPrototypeOf.js", "../../node_modules/@babel/runtime/helpers/inheritsLoose.js", "../../node_modules/@babel/runtime/helpers/assertThisInitialized.js", "../../node_modules/jss/dist/jss.cjs.js", "../../node_modules/jss-plugin-rule-value-function/dist/jss-plugin-rule-value-function.cjs.js", "../../node_modules/jss-plugin-global/dist/jss-plugin-global.cjs.js", "../../node_modules/jss-plugin-nested/dist/jss-plugin-nested.cjs.js", "../../node_modules/hyphenate-style-name/index.cjs.js", "../../node_modules/jss-plugin-camel-case/dist/jss-plugin-camel-case.cjs.js", "../../node_modules/jss-plugin-default-unit/dist/jss-plugin-default-unit.cjs.js", "../../node_modules/css-vendor/dist/css-vendor.cjs.js", "../../node_modules/jss-plugin-vendor-prefixer/dist/jss-plugin-vendor-prefixer.cjs.js", "../../node_modules/jss-plugin-props-sort/dist/jss-plugin-props-sort.cjs.js", "../../node_modules/@material-ui/styles/jssPreset/jssPreset.js", "../../node_modules/@material-ui/styles/jssPreset/index.js", "../../node_modules/@material-ui/styles/mergeClasses/mergeClasses.js", "../../node_modules/@material-ui/styles/mergeClasses/index.js", "../../node_modules/@material-ui/styles/makeStyles/multiKeyStore.js", "../../node_modules/@material-ui/styles/useTheme/ThemeContext.js", "../../node_modules/@material-ui/styles/useTheme/useTheme.js", "../../node_modules/@material-ui/styles/useTheme/index.js", "../../node_modules/@material-ui/styles/StylesProvider/StylesProvider.js", "../../node_modules/@material-ui/styles/StylesProvider/index.js", "../../node_modules/@material-ui/styles/makeStyles/indexCounter.js", "../../node_modules/@material-ui/styles/getStylesCreator/noopTheme.js", "../../node_modules/@material-ui/styles/getStylesCreator/getStylesCreator.js", "../../node_modules/@material-ui/styles/getStylesCreator/index.js", "../../node_modules/@material-ui/styles/makeStyles/makeStyles.js", "../../node_modules/@material-ui/styles/makeStyles/index.js", "../../node_modules/@babel/runtime/helpers/classCallCheck.js", "../../node_modules/@material-ui/styles/ServerStyleSheets/ServerStyleSheets.js", "../../node_modules/@material-ui/styles/ServerStyleSheets/index.js", "../../node_modules/clsx/dist/clsx.js", "../../node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.production.min.js", "../../node_modules/hoist-non-react-statics/node_modules/react-is/index.js", "../../node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js", "../../node_modules/@material-ui/styles/styled/styled.js", "../../node_modules/@material-ui/styles/styled/index.js", "../../node_modules/@material-ui/styles/ThemeProvider/ThemeProvider.js", "../../node_modules/@material-ui/styles/ThemeProvider/index.js", "../../node_modules/@material-ui/styles/withStyles/withStyles.js", "../../node_modules/@material-ui/styles/withStyles/index.js", "../../node_modules/@material-ui/styles/withTheme/withTheme.js", "../../node_modules/@material-ui/styles/withTheme/index.js", "../../node_modules/@material-ui/styles/index.js", "../../node_modules/@material-ui/core/styles/createStyles.js", "../../node_modules/@material-ui/core/styles/defaultTheme.js", "../../node_modules/@material-ui/core/styles/makeStyles.js", "../../node_modules/@material-ui/core/styles/cssUtils.js", "../../node_modules/@material-ui/core/styles/responsiveFontSizes.js", "../../node_modules/@material-ui/core/styles/styled.js", "../../node_modules/@material-ui/core/styles/useTheme.js", "../../node_modules/@material-ui/core/styles/withStyles.js", "../../node_modules/@material-ui/core/styles/withTheme.js", "../../node_modules/@material-ui/core/styles/index.js", "../../node_modules/@iobroker/adapter-react/Theme.js", "../../node_modules/@iobroker/adapter-react/i18n.js", "../../node_modules/@iobroker/adapter-react/Components/Utils.js", "../../node_modules/@babel/runtime/helpers/getPrototypeOf.js", "../../node_modules/@babel/runtime/helpers/superPropBase.js", "../../node_modules/@babel/runtime/helpers/get.js", "../../node_modules/@babel/runtime/helpers/inherits.js", "../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js", "../../node_modules/@iobroker/adapter-react/Connection.js", "../../node_modules/@sentry/src/is.ts", "../../node_modules/@sentry/src/string.ts", "../../node_modules/@sentry/src/aggregate-errors.ts", "../../node_modules/@sentry/src/worldwide.ts", "../../node_modules/@sentry/src/browser.ts", "../../node_modules/@sentry/src/debug-build.ts", "../../node_modules/@sentry/src/logger.ts", "../../node_modules/@sentry/src/dsn.ts", "../../node_modules/@sentry/src/error.ts", "../../node_modules/@sentry/src/object.ts", "../../node_modules/@sentry/src/node-stack-trace.ts", "../../node_modules/@sentry/src/stacktrace.ts", "../../node_modules/@sentry/src/instrument/_handlers.ts", "../../node_modules/@sentry/src/instrument/console.ts", "../../node_modules/@sentry/src/misc.ts", "../../node_modules/@sentry/src/instrument/dom.ts", "../../node_modules/@sentry/src/supports.ts", "../../node_modules/@sentry/src/instrument/fetch.ts", "../../node_modules/@sentry/src/instrument/globalError.ts", "../../node_modules/@sentry/src/instrument/globalUnhandledRejection.ts", "../../node_modules/@sentry/src/vendor/supportsHistory.ts", "../../node_modules/@sentry/src/instrument/history.ts", "../../node_modules/@sentry/src/instrument/xhr.ts", "../../node_modules/@sentry/src/instrument/index.ts", "../../node_modules/@sentry/src/env.ts", "../../node_modules/@sentry/src/node.ts", "../../node_modules/@sentry/src/isBrowser.ts", "../../node_modules/@sentry/src/memo.ts", "../../node_modules/@sentry/src/normalize.ts", "../../node_modules/@sentry/src/path.ts", "../../node_modules/@sentry/src/syncpromise.ts", "../../node_modules/@sentry/src/promisebuffer.ts", "../../node_modules/@sentry/src/cookie.ts", "../../node_modules/@sentry/src/url.ts", "../../node_modules/@sentry/src/requestdata.ts", "../../node_modules/@sentry/src/severity.ts", "../../node_modules/@sentry/src/time.ts", "../../node_modules/@sentry/src/baggage.ts", "../../node_modules/@sentry/src/tracing.ts", "../../node_modules/@sentry/src/envelope.ts", "../../node_modules/@sentry/src/clientreport.ts", "../../node_modules/@sentry/src/ratelimit.ts", "../../node_modules/@sentry/src/userIntegrations.ts", "../../node_modules/@sentry/src/cache.ts", "../../node_modules/@sentry/src/eventbuilder.ts", "../../node_modules/@sentry/src/anr.ts", "../../node_modules/@sentry/src/lru.ts", "../../node_modules/@sentry/src/buildPolyfills/_nullishCoalesce.ts", "../../node_modules/@sentry/src/buildPolyfills/_asyncNullishCoalesce.ts", "../../node_modules/@sentry/src/buildPolyfills/_asyncOptionalChain.ts", "../../node_modules/@sentry/src/buildPolyfills/_asyncOptionalChainDelete.ts", "../../node_modules/@sentry/src/buildPolyfills/_optionalChain.ts", "../../node_modules/@sentry/src/buildPolyfills/_optionalChainDelete.ts", "../../node_modules/@sentry/src/vendor/escapeStringForRegex.ts", "../../node_modules/@sentry/utils/cjs/index.js", "../../node_modules/@sentry/src/debug-build.ts", "../../node_modules/@sentry/src/constants.ts", "../../node_modules/@sentry/src/eventProcessors.ts", "../../node_modules/@sentry/src/session.ts", "../../node_modules/@sentry/src/utils/spanUtils.ts", "../../node_modules/@sentry/src/utils/prepareEvent.ts", "../../node_modules/@sentry/src/exports.ts", "../../node_modules/@sentry/src/utils/getRootSpan.ts", "../../node_modules/@sentry/src/tracing/dynamicSamplingContext.ts", "../../node_modules/@sentry/src/utils/applyScopeDataToEvent.ts", "../../node_modules/@sentry/src/scope.ts", "../../node_modules/@sentry/src/version.ts", "../../node_modules/@sentry/src/hub.ts", "../../node_modules/@sentry/src/tracing/utils.ts", "../../node_modules/@sentry/src/tracing/errors.ts", "../../node_modules/@sentry/src/tracing/spanstatus.ts", "../../node_modules/@sentry/src/utils/handleCallbackErrors.ts", "../../node_modules/@sentry/src/utils/hasTracingEnabled.ts", "../../node_modules/@sentry/src/tracing/trace.ts", "../../node_modules/@sentry/src/metrics/metric-summary.ts", "../../node_modules/@sentry/src/semanticAttributes.ts", "../../node_modules/@sentry/src/tracing/span.ts", "../../node_modules/@sentry/src/tracing/transaction.ts", "../../node_modules/@sentry/src/tracing/idletransaction.ts", "../../node_modules/@sentry/src/tracing/sampling.ts", "../../node_modules/@sentry/src/tracing/hubextensions.ts", "../../node_modules/@sentry/src/tracing/measurement.ts", "../../node_modules/@sentry/src/envelope.ts", "../../node_modules/@sentry/src/sessionflusher.ts", "../../node_modules/@sentry/src/api.ts", "../../node_modules/@sentry/src/integration.ts", "../../node_modules/@sentry/src/metrics/utils.ts", "../../node_modules/@sentry/src/metrics/envelope.ts", "../../node_modules/@sentry/src/baseclient.ts", "../../node_modules/@sentry/src/checkin.ts", "../../node_modules/@sentry/src/metrics/constants.ts", "../../node_modules/@sentry/src/metrics/instance.ts", "../../node_modules/@sentry/src/metrics/aggregator.ts", "../../node_modules/@sentry/src/server-runtime-client.ts", "../../node_modules/@sentry/src/sdk.ts", "../../node_modules/@sentry/src/transports/base.ts", "../../node_modules/@sentry/src/transports/offline.ts", "../../node_modules/@sentry/src/transports/multiplexed.ts", "../../node_modules/@sentry/src/span.ts", "../../node_modules/@sentry/src/utils/isSentryRequestUrl.ts", "../../node_modules/@sentry/src/utils/parameterize.ts", "../../node_modules/@sentry/src/utils/sdkMetadata.ts", "../../node_modules/@sentry/src/metadata.ts", "../../node_modules/@sentry/src/integrations/metadata.ts", "../../node_modules/@sentry/src/integrations/requestdata.ts", "../../node_modules/@sentry/src/integrations/inboundfilters.ts", "../../node_modules/@sentry/src/integrations/functiontostring.ts", "../../node_modules/@sentry/src/integrations/linkederrors.ts", "../../node_modules/@sentry/src/metrics/browser-aggregator.ts", "../../node_modules/@sentry/src/metrics/integration.ts", "../../node_modules/@sentry/src/metrics/exports.ts", "../../node_modules/@sentry/src/index.ts", "../../node_modules/@sentry-internal/src/common/debug-build.ts", "../../node_modules/@sentry-internal/src/node/integrations/utils/node-utils.ts", "../../node_modules/@sentry-internal/src/node/integrations/express.ts", "../../node_modules/@sentry-internal/src/node/integrations/postgres.ts", "../../node_modules/@sentry-internal/src/node/integrations/mysql.ts", "../../node_modules/@sentry-internal/src/node/integrations/mongo.ts", "../../node_modules/@sentry-internal/src/node/integrations/prisma.ts", "../../node_modules/@sentry-internal/src/node/integrations/graphql.ts", "../../node_modules/@sentry-internal/src/node/integrations/apollo.ts", "../../node_modules/@sentry-internal/src/node/integrations/lazy.ts", "../../node_modules/@sentry-internal/src/browser/types.ts", "../../node_modules/@sentry-internal/src/browser/backgroundtab.ts", "../../node_modules/@sentry-internal/src/browser/web-vitals/lib/bindReporter.ts", "../../node_modules/@sentry-internal/src/browser/web-vitals/lib/generateUniqueID.ts", "../../node_modules/@sentry-internal/src/browser/web-vitals/lib/getNavigationEntry.ts", "../../node_modules/@sentry-internal/src/browser/web-vitals/lib/getActivationStart.ts", "../../node_modules/@sentry-internal/src/browser/web-vitals/lib/initMetric.ts", "../../node_modules/@sentry-internal/src/browser/web-vitals/lib/observe.ts", "../../node_modules/@sentry-internal/src/browser/web-vitals/lib/onHidden.ts", "../../node_modules/@sentry-internal/src/browser/web-vitals/getCLS.ts", "../../node_modules/@sentry-internal/src/browser/web-vitals/lib/getVisibilityWatcher.ts", "../../node_modules/@sentry-internal/src/browser/web-vitals/getFID.ts", "../../node_modules/@sentry-internal/src/browser/web-vitals/lib/polyfills/interactionCountPolyfill.ts", "../../node_modules/@sentry-internal/src/browser/web-vitals/getINP.ts", "../../node_modules/@sentry-internal/src/browser/web-vitals/getLCP.ts", "../../node_modules/@sentry-internal/src/browser/web-vitals/onTTFB.ts", "../../node_modules/@sentry-internal/src/browser/instrument.ts", "../../node_modules/@sentry-internal/src/browser/metrics/utils.ts", "../../node_modules/@sentry-internal/src/browser/metrics/index.ts", "../../node_modules/@sentry-internal/src/common/fetch.ts", "../../node_modules/@sentry-internal/src/browser/request.ts", "../../node_modules/@sentry-internal/src/browser/router.ts", "../../node_modules/@sentry-internal/src/browser/browsertracing.ts", "../../node_modules/@sentry-internal/src/browser/browserTracingIntegration.ts", "../../node_modules/@sentry-internal/src/extensions.ts", "../../node_modules/@sentry-internal/tracing/cjs/index.js", "../../node_modules/src/helpers.ts", "../../node_modules/src/debug-build.ts", "../../node_modules/src/eventbuilder.ts", "../../node_modules/src/userfeedback.ts", "../../node_modules/src/client.ts", "../../node_modules/src/transports/utils.ts", "../../node_modules/src/transports/fetch.ts", "../../node_modules/src/transports/xhr.ts", "../../node_modules/src/stack-parsers.ts", "../../node_modules/src/integrations/breadcrumbs.ts", "../../node_modules/src/integrations/dedupe.ts", "../../node_modules/src/integrations/globalhandlers.ts", "../../node_modules/src/integrations/httpcontext.ts", "../../node_modules/src/integrations/linkederrors.ts", "../../node_modules/src/integrations/trycatch.ts", "../../node_modules/src/sdk.ts", "../../node_modules/src/constants.ts", "../../../node_modules/@sentry-internal/rrweb/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js", "../../../node_modules/@sentry-internal/rrweb/es/rrweb/packages/rrweb/src/utils.js", "../../../node_modules/@sentry-internal/rrweb/es/rrweb/packages/types/dist/rrweb-types.js", "../../../node_modules/@sentry-internal/rrweb/es/rrweb/packages/rrweb/src/record/mutation.js", "../../../node_modules/@sentry-internal/rrweb/es/rrweb/packages/rrweb/src/record/error-handler.js", "../../../node_modules/@sentry-internal/rrweb/es/rrweb/packages/rrweb/src/record/observer.js", "../../../node_modules/@sentry-internal/rrweb/es/rrweb/packages/rrweb/src/record/cross-origin-iframe-mirror.js", "../../../node_modules/@sentry-internal/rrweb/es/rrweb/packages/rrweb/src/record/iframe-manager.js", "../../../node_modules/@sentry-internal/rrweb/es/rrweb/packages/rrweb/src/record/shadow-dom-manager.js", "../../../node_modules/@sentry-internal/rrweb/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js", "../../../node_modules/@sentry-internal/rrweb/es/rrweb/packages/rrweb/src/record/stylesheet-manager.js", "../../../node_modules/@sentry-internal/rrweb/es/rrweb/packages/rrweb/src/record/processed-node-manager.js", "../../../node_modules/@sentry-internal/rrweb/es/rrweb/packages/rrweb/src/record/index.js", "../../node_modules/src/types/rrweb.ts", "../../node_modules/src/util/timestamp.ts", "../../node_modules/src/coreHandlers/util/addBreadcrumbEvent.ts", "../../node_modules/src/coreHandlers/util/domUtils.ts", "../../node_modules/src/coreHandlers/util/onWindowOpen.ts", "../../node_modules/src/coreHandlers/handleClick.ts", "../../node_modules/src/util/createBreadcrumb.ts", "../../../node_modules/@sentry-internal/rrweb-snapshot/es/rrweb-snapshot.js", "../../node_modules/src/coreHandlers/util/getAttributesToRecord.ts", "../../node_modules/src/coreHandlers/handleDom.ts", "../../node_modules/src/coreHandlers/handleKeyboardEvent.ts", "../../node_modules/src/util/createPerformanceEntries.ts", "../../node_modules/src/coreHandlers/performanceObserver.ts", "../../node_modules/src/debug-build.ts", "../../replay-worker/build/npm/esm/worker.ts", "../../replay-worker/build/npm/esm/index.js", "../../node_modules/src/util/log.ts", "../../node_modules/src/eventBuffer/error.ts", "../../node_modules/src/eventBuffer/EventBufferArray.ts", "../../node_modules/src/eventBuffer/WorkerHandler.ts", "../../node_modules/src/eventBuffer/EventBufferCompressionWorker.ts", "../../node_modules/src/eventBuffer/EventBufferProxy.ts", "../../node_modules/src/eventBuffer/index.ts", "../../node_modules/src/util/hasSessionStorage.ts", "../../node_modules/src/session/clearSession.ts", "../../node_modules/src/util/isSampled.ts", "../../node_modules/src/session/Session.ts", "../../node_modules/src/session/saveSession.ts", "../../node_modules/src/session/createSession.ts", "../../node_modules/src/session/fetchSession.ts", "../../node_modules/src/util/isExpired.ts", "../../node_modules/src/util/isSessionExpired.ts", "../../node_modules/src/session/shouldRefreshSession.ts", "../../node_modules/src/session/loadOrCreateSession.ts", "../../node_modules/src/util/addEvent.ts", "../../node_modules/src/util/eventUtils.ts", "../../node_modules/src/coreHandlers/handleAfterSendEvent.ts", "../../node_modules/src/coreHandlers/handleBeforeSendEvent.ts", "../../node_modules/src/util/isRrwebError.ts", "../../node_modules/src/coreHandlers/util/addFeedbackBreadcrumb.ts", "../../node_modules/src/coreHandlers/util/shouldSampleForBufferEvent.ts", "../../node_modules/src/coreHandlers/handleGlobalEvent.ts", "../../node_modules/src/util/createPerformanceSpans.ts", "../../node_modules/src/coreHandlers/handleHistory.ts", "../../node_modules/src/util/shouldFilterRequest.ts", "../../node_modules/src/coreHandlers/util/addNetworkBreadcrumb.ts", "../../node_modules/src/coreHandlers/handleFetch.ts", "../../node_modules/src/coreHandlers/handleXhr.ts", "../../node_modules/src/coreHandlers/util/networkUtils.ts", "../../node_modules/src/coreHandlers/util/fetchUtils.ts", "../../node_modules/src/coreHandlers/util/xhrUtils.ts", "../../node_modules/src/coreHandlers/handleNetworkBreadcrumbs.ts", "../../node_modules/src/coreHandlers/handleScope.ts", "../../node_modules/src/util/addGlobalListeners.ts", "../../node_modules/src/util/addMemoryEntry.ts", "../../node_modules/src/util/debounce.ts", "../../node_modules/src/util/handleRecordingEmit.ts", "../../node_modules/src/util/createReplayEnvelope.ts", "../../node_modules/src/util/prepareRecordingData.ts", "../../node_modules/src/util/prepareReplayEvent.ts", "../../node_modules/src/util/sendReplayRequest.ts", "../../node_modules/src/util/sendReplay.ts", "../../node_modules/src/util/throttle.ts", "../../node_modules/src/replay.ts", "../../node_modules/src/util/getPrivacyOptions.ts", "../../node_modules/src/util/maskAttribute.ts", "../../node_modules/src/integration.ts", "../../node_modules/src/util/getReplay.ts", "../../node_modules/src/index.ts", "../../../node_modules/@sentry-internal/rrweb/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js", "../../../node_modules/@sentry-internal/rrweb/es/rrweb/packages/rrweb/src/utils.js", "../../../node_modules/@sentry-internal/rrweb/es/rrweb/packages/types/dist/rrweb-types.js", "../../../node_modules/@sentry-internal/rrweb/es/rrweb/packages/rrweb/src/record/error-handler.js", "../../../node_modules/@sentry-internal/rrweb/es/rrweb/ext/base64-arraybuffer/dist/base64-arraybuffer.es5.js", "../../../node_modules/@sentry-internal/rrweb/es/rrweb/packages/rrweb/src/record/observers/canvas/serialize-args.js", "../../../node_modules/@sentry-internal/rrweb/es/rrweb/packages/rrweb/src/record/observers/canvas/2d.js", "../../../node_modules/@sentry-internal/rrweb/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas.js", "../../../node_modules/@sentry-internal/rrweb/es/rrweb/packages/rrweb/src/record/observers/canvas/webgl.js", "../../../node_modules/@sentry-internal/rrweb/es/rrweb/packages/rrweb-worker/es/rrweb-worker/image-bitmap-data-url-worker.js", "../../../node_modules/@sentry-internal/rrweb/es/rrweb/packages/rrweb-worker/es/rrweb-worker/index.js", "../../../node_modules/@sentry-internal/rrweb/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js", "../../node_modules/src/canvas.ts", "../../node_modules/src/constants.ts", "../../node_modules/src/util/prepareFeedbackEvent.ts", "../../node_modules/src/util/sendFeedbackRequest.ts", "../../node_modules/src/sendFeedback.ts", "../../node_modules/src/debug-build.ts", "../../node_modules/src/util/mergeOptions.ts", "../../node_modules/src/widget/Actor.css.ts", "../../node_modules/src/widget/Dialog.css.ts", "../../node_modules/src/widget/Main.css.ts", "../../node_modules/src/widget/createShadowHost.ts", "../../node_modules/src/util/handleFeedbackSubmit.ts", "../../node_modules/src/util/setAttributesNS.ts", "../../node_modules/src/widget/Icon.ts", "../../node_modules/src/widget/util/createElement.ts", "../../node_modules/src/widget/Actor.ts", "../../node_modules/src/widget/SubmitButton.ts", "../../node_modules/src/widget/Form.ts", "../../node_modules/src/widget/Logo.ts", "../../node_modules/src/widget/Dialog.ts", "../../node_modules/src/widget/SuccessIcon.ts", "../../node_modules/src/widget/SuccessMessage.ts", "../../node_modules/src/widget/createWidget.ts", "../../node_modules/src/integration.ts", "../../node_modules/src/captureconsole.ts", "../../node_modules/src/debug.ts", "../../node_modules/src/debug-build.ts", "../../node_modules/src/dedupe.ts", "../../node_modules/src/extraerrordata.ts", "../../node_modules/localforage/dist/localforage.js", "../../node_modules/src/offline.ts", "../../node_modules/src/reportingobserver.ts", "../../node_modules/src/rewriteframes.ts", "../../node_modules/src/sessiontiming.ts", "../../node_modules/src/transaction.ts", "../../node_modules/src/httpclient.ts", "../../node_modules/src/contextlines.ts", "../../node_modules/@sentry/integrations/cjs/index.js", "../../node_modules/src/transports/offline.ts", "../../node_modules/src/profiling/utils.ts", "../../node_modules/src/profiling/hubextensions.ts", "../../node_modules/src/profiling/integration.ts", "../../node_modules/src/index.ts", "../../node_modules/@material-ui/core/utils/setRef.js", "../../node_modules/@material-ui/core/utils/useForkRef.js", "../../node_modules/@material-ui/core/utils/useEventCallback.js", "../../node_modules/@material-ui/core/utils/deprecatedPropType.js", "../../node_modules/@material-ui/core/utils/useIsFocusVisible.js", "../../node_modules/dom-helpers/cjs/hasClass.js", "../../node_modules/dom-helpers/cjs/addClass.js", "../../node_modules/dom-helpers/cjs/removeClass.js", "../../node_modules/react-transition-group/cjs/config.js", "../../node_modules/react-transition-group/cjs/utils/PropTypes.js", "../../node_modules/react-transition-group/cjs/TransitionGroupContext.js", "../../node_modules/react-transition-group/cjs/utils/reflow.js", "../../node_modules/react-transition-group/cjs/Transition.js", "../../node_modules/react-transition-group/cjs/CSSTransition.js", "../../node_modules/react-transition-group/cjs/utils/ChildMapping.js", "../../node_modules/react-transition-group/cjs/TransitionGroup.js", "../../node_modules/react-transition-group/cjs/ReplaceTransition.js", "../../node_modules/react-transition-group/cjs/SwitchTransition.js", "../../node_modules/react-transition-group/cjs/index.js", "../../node_modules/@material-ui/core/ButtonBase/Ripple.js", "../../node_modules/@material-ui/core/ButtonBase/TouchRipple.js", "../../node_modules/@material-ui/core/ButtonBase/ButtonBase.js", "../../node_modules/@material-ui/core/ButtonBase/index.js", "../../node_modules/@material-ui/core/utils/capitalize.js", "../../node_modules/@material-ui/core/Button/Button.js", "../../node_modules/@material-ui/core/Button/index.js", "../../node_modules/@material-ui/core/utils/ownerDocument.js", "../../node_modules/@material-ui/core/Portal/Portal.js", "../../node_modules/@material-ui/core/Portal/index.js", "../../node_modules/@material-ui/core/utils/createChainedFunction.js", "../../node_modules/@material-ui/core/utils/getScrollbarSize.js", "../../node_modules/@material-ui/core/utils/ownerWindow.js", "../../node_modules/@material-ui/core/Modal/ModalManager.js", "../../node_modules/@material-ui/core/Unstable_TrapFocus/Unstable_TrapFocus.js", "../../node_modules/@material-ui/core/Unstable_TrapFocus/index.js", "../../node_modules/@material-ui/core/Modal/SimpleBackdrop.js", "../../node_modules/@material-ui/core/Modal/Modal.js", "../../node_modules/@material-ui/core/Modal/index.js", "../../node_modules/@material-ui/core/transitions/utils.js", "../../node_modules/@material-ui/core/Fade/Fade.js", "../../node_modules/@material-ui/core/Fade/index.js", "../../node_modules/@material-ui/core/Backdrop/Backdrop.js", "../../node_modules/@material-ui/core/Backdrop/index.js", "../../node_modules/@material-ui/core/Paper/Paper.js", "../../node_modules/@material-ui/core/Paper/index.js", "../../node_modules/@material-ui/core/Dialog/Dialog.js", "../../node_modules/@material-ui/core/Dialog/index.js", "../../node_modules/@material-ui/core/DialogActions/DialogActions.js", "../../node_modules/@material-ui/core/DialogActions/index.js", "../../node_modules/@material-ui/core/DialogContent/DialogContent.js", "../../node_modules/@material-ui/core/DialogContent/index.js", "../../node_modules/@material-ui/core/Typography/Typography.js", "../../node_modules/@material-ui/core/Typography/index.js", "../../node_modules/@material-ui/core/DialogContentText/DialogContentText.js", "../../node_modules/@material-ui/core/DialogContentText/index.js", "../../node_modules/@material-ui/core/DialogTitle/DialogTitle.js", "../../node_modules/@material-ui/core/DialogTitle/index.js", "../../node_modules/@material-ui/core/SvgIcon/SvgIcon.js", "../../node_modules/@material-ui/core/SvgIcon/index.js", "../../node_modules/@material-ui/core/utils/createSvgIcon.js", "../../node_modules/@material-ui/core/utils/debounce.js", "../../node_modules/@material-ui/core/utils/isMuiElement.js", "../../node_modules/@material-ui/core/utils/requirePropFactory.js", "../../node_modules/@material-ui/core/utils/unsupportedProp.js", "../../node_modules/@material-ui/core/utils/useControlled.js", "../../node_modules/@material-ui/core/utils/unstable_useId.js", "../../node_modules/@material-ui/core/utils/index.js", "../../node_modules/@material-ui/icons/utils/createSvgIcon.js", "../../node_modules/@material-ui/icons/Check.js", "../../node_modules/@iobroker/adapter-react/Dialogs/Error.js", "../../node_modules/@material-ui/core/ClickAwayListener/ClickAwayListener.js", "../../node_modules/@material-ui/core/ClickAwayListener/index.js", "../../node_modules/@material-ui/core/Grow/Grow.js", "../../node_modules/@material-ui/core/Grow/index.js", "../../node_modules/@material-ui/core/SnackbarContent/SnackbarContent.js", "../../node_modules/@material-ui/core/SnackbarContent/index.js", "../../node_modules/@material-ui/core/Snackbar/Snackbar.js", "../../node_modules/@material-ui/core/Snackbar/index.js", "../../node_modules/@material-ui/core/IconButton/IconButton.js", "../../node_modules/@material-ui/core/IconButton/index.js", "../../node_modules/@material-ui/icons/Close.js", "../../node_modules/@iobroker/adapter-react/Prompt.js", "../../node_modules/@iobroker/adapter-react/Components/loader.css", "../../node_modules/@iobroker/adapter-react/Components/Loader.js", "../../node_modules/@iobroker/adapter-react/Components/Router.js", "../../node_modules/@material-ui/core/Fab/Fab.js", "../../node_modules/@material-ui/core/Fab/index.js", "../../node_modules/@material-ui/core/Toolbar/Toolbar.js", "../../node_modules/@material-ui/core/Toolbar/index.js", "../../node_modules/@material-ui/icons/Save.js", "../../node_modules/@iobroker/adapter-react/Components/SaveCloseButtons.js", "../../node_modules/@iobroker/adapter-react/index.css", "../../node_modules/@iobroker/adapter-react/i18n/en.json", "../../node_modules/@iobroker/adapter-react/i18n/de.json", "../../node_modules/@iobroker/adapter-react/i18n/ru.json", "../../node_modules/@iobroker/adapter-react/i18n/pt.json", "../../node_modules/@iobroker/adapter-react/i18n/nl.json", "../../node_modules/@iobroker/adapter-react/i18n/fr.json", "../../node_modules/@iobroker/adapter-react/i18n/it.json", "../../node_modules/@iobroker/adapter-react/i18n/es.json", "../../node_modules/@iobroker/adapter-react/i18n/pl.json", "../../node_modules/@iobroker/adapter-react/i18n/zh-cn.json", "../../node_modules/@iobroker/adapter-react/GenericApp.js", "../../node_modules/@material-ui/icons/Add.js", "../../node_modules/@material-ui/icons/Help.js", "../../node_modules/@material-ui/icons/VerticalAlignTop.js", "../../node_modules/@material-ui/icons/VerticalAlignBottom.js", "../../node_modules/@iobroker/adapter-react/Components/Logo.js", "../../node_modules/@material-ui/core/InputBase/utils.js", "../../node_modules/@material-ui/core/FormControl/FormControlContext.js", "../../node_modules/@material-ui/core/FormControl/FormControl.js", "../../node_modules/@material-ui/core/FormControl/useFormControl.js", "../../node_modules/@material-ui/core/FormControl/index.js", "../../node_modules/@material-ui/core/FormControlLabel/FormControlLabel.js", "../../node_modules/@material-ui/core/FormControlLabel/index.js", "../../node_modules/@material-ui/core/internal/SwitchBase.js", "../../node_modules/@material-ui/core/internal/svg-icons/CheckBoxOutlineBlank.js", "../../node_modules/@material-ui/core/internal/svg-icons/CheckBox.js", "../../node_modules/@material-ui/core/internal/svg-icons/IndeterminateCheckBox.js", "../../node_modules/@material-ui/core/Checkbox/Checkbox.js", "../../node_modules/@material-ui/core/Checkbox/index.js", "../../node_modules/@material-ui/icons/Cached.js", "../../node_modules/@material-ui/icons/Visibility.js", "../../node_modules/punycode/punycode.js", "../../node_modules/es-errors/index.js", "../../node_modules/es-errors/eval.js", "../../node_modules/es-errors/range.js", "../../node_modules/es-errors/ref.js", "../../node_modules/es-errors/syntax.js", "../../node_modules/es-errors/type.js", "../../node_modules/es-errors/uri.js", "../../node_modules/has-symbols/shams.js", "../../node_modules/has-symbols/index.js", "../../node_modules/has-proto/index.js", "../../node_modules/function-bind/implementation.js", "../../node_modules/function-bind/index.js", "../../node_modules/hasown/index.js", "../../node_modules/get-intrinsic/index.js", "../../node_modules/es-define-property/index.js", "../../node_modules/gopd/index.js", "../../node_modules/define-data-property/index.js", "../../node_modules/has-property-descriptors/index.js", "../../node_modules/set-function-length/index.js", "../../node_modules/call-bind/index.js", "../../node_modules/call-bind/callBound.js", "../../node_modules/object-inspect/index.js", "../../node_modules/side-channel/index.js", "../../node_modules/qs/lib/formats.js", "../../node_modules/qs/lib/utils.js", "../../node_modules/qs/lib/stringify.js", "../../node_modules/qs/lib/parse.js", "../../node_modules/qs/lib/index.js", "../../node_modules/url/url.js", "../../node_modules/jsonschema/lib/helpers.js", "../../node_modules/jsonschema/lib/attribute.js", "../../node_modules/jsonschema/lib/scan.js", "../../node_modules/jsonschema/lib/validator.js", "../../node_modules/jsonschema/lib/index.js", "../../well-known-messages/schemas/messages.json", "../../well-known-messages/schemas/index.json", "../../node_modules/@material-ui/icons/Delete.js", "../../node_modules/@iobroker/adapter-react/Dialogs/Confirm.js", "../../node_modules/@material-ui/icons/Info.js", "../src/i18n/en.json", "../src/i18n/de.json", "../src/i18n/ru.json", "../src/i18n/pt.json", "../src/i18n/nl.json", "../src/i18n/fr.json", "../src/i18n/it.json", "../src/i18n/es.json", "../src/i18n/pl.json", "../src/i18n/zh-cn.json", "../src/index.tsx", "../../node_modules/autobind-decorator/lib/esm/index.js", "../src/app.tsx", "../../node_modules/@sentry/react/node_modules/@sentry/utils/src/is.ts", "../../node_modules/@sentry/react/node_modules/@sentry/utils/src/version.ts", "../../node_modules/@sentry/react/node_modules/@sentry/utils/src/worldwide.ts", "../../node_modules/@sentry/react/node_modules/@sentry/utils/src/debug-build.ts", "../../node_modules/@sentry/react/node_modules/@sentry/utils/src/logger.ts", "../../node_modules/@sentry/react/node_modules/@sentry/utils/src/dsn.ts", "../../node_modules/@sentry/react/node_modules/@sentry/utils/src/object.ts", "../../node_modules/@sentry/react/node_modules/@sentry/utils/src/time.ts", "../../node_modules/@sentry/react/node_modules/@sentry/utils/src/misc.ts", "../../node_modules/@sentry/react/node_modules/@sentry/utils/src/propagationContext.ts", "../../node_modules/@sentry/react/node_modules/@sentry/core/src/carrier.ts", "../../node_modules/@sentry/react/node_modules/@sentry/core/src/session.ts", "../../node_modules/@sentry/react/node_modules/@sentry/core/src/utils/spanOnScope.ts", "../../node_modules/@sentry/react/node_modules/@sentry/core/src/scope.ts", "../../node_modules/@sentry/react/node_modules/@sentry/core/src/defaultScopes.ts", "../../node_modules/@sentry/react/node_modules/@sentry/core/src/asyncContext/stackStrategy.ts", "../../node_modules/@sentry/react/node_modules/@sentry/core/src/asyncContext/index.ts", "../../node_modules/@sentry/react/node_modules/@sentry/core/src/currentScopes.ts", "../../node_modules/@sentry/react/node_modules/@sentry/core/src/utils/prepareEvent.ts", "../../node_modules/@sentry/react/node_modules/@sentry/core/src/exports.ts", "../../node_modules/@sentry/react/node_modules/@sentry/core/src/api.ts", "../../node_modules/@sentry/react/node_modules/@sentry/browser/src/helpers.ts", "../../node_modules/@sentry/react/node_modules/@sentry/browser/src/debug-build.ts", "../../node_modules/@sentry/react/node_modules/@sentry/browser/src/sdk.ts", "../../node_modules/@sentry/react/src/error.ts", "../../node_modules/@sentry/react/src/debug-build.ts", "../../node_modules/@sentry/react/src/errorboundary.tsx", "../src/components/settings.tsx", "../../node_modules/@material-ui/core/esm/Box/Box.js", "../../node_modules/@babel/runtime/helpers/esm/extends.js", "../../node_modules/@material-ui/core/esm/styles/styled.js", "../../node_modules/@babel/runtime/helpers/esm/typeof.js", "../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js", "../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js", "../../node_modules/@babel/runtime/helpers/esm/defineProperty.js", "../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js", "../../node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js", "../../node_modules/@material-ui/core/esm/styles/createTheme.js", "../../node_modules/@material-ui/core/esm/styles/createBreakpoints.js", "../../node_modules/@material-ui/core/esm/styles/createMixins.js", "../../node_modules/@material-ui/core/esm/styles/createPalette.js", "../../node_modules/@material-ui/core/esm/colors/common.js", "../../node_modules/@material-ui/core/esm/colors/grey.js", "../../node_modules/@material-ui/core/esm/colors/indigo.js", "../../node_modules/@material-ui/core/esm/colors/pink.js", "../../node_modules/@material-ui/core/esm/colors/red.js", "../../node_modules/@material-ui/core/esm/colors/orange.js", "../../node_modules/@material-ui/core/esm/colors/blue.js", "../../node_modules/@material-ui/core/esm/colors/green.js", "../../node_modules/@material-ui/core/esm/styles/colorManipulator.js", "../../node_modules/@material-ui/core/esm/styles/createTypography.js", "../../node_modules/@material-ui/core/esm/styles/shadows.js", "../../node_modules/@material-ui/core/esm/styles/shape.js", "../../node_modules/@material-ui/core/esm/styles/createSpacing.js", "../../node_modules/@material-ui/core/esm/styles/transitions.js", "../../node_modules/@material-ui/core/esm/styles/zIndex.js", "../../node_modules/@material-ui/core/esm/styles/defaultTheme.js", "../../node_modules/@material-ui/core/esm/Tab/Tab.js", "../../node_modules/@material-ui/core/esm/styles/withStyles.js", "../../node_modules/@material-ui/core/esm/ButtonBase/ButtonBase.js", "../../node_modules/@material-ui/core/esm/utils/useForkRef.js", "../../node_modules/@material-ui/core/esm/utils/setRef.js", "../../node_modules/@material-ui/core/esm/utils/useEventCallback.js", "../../node_modules/@material-ui/core/esm/utils/useIsFocusVisible.js", "../../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js", "../../node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js", "../../node_modules/@babel/runtime/helpers/esm/iterableToArray.js", "../../node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js", "../../node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js", "../../node_modules/@babel/runtime/helpers/esm/toConsumableArray.js", "../../node_modules/@material-ui/core/esm/ButtonBase/TouchRipple.js", "../../node_modules/@material-ui/core/esm/ButtonBase/Ripple.js", "../../node_modules/@material-ui/core/esm/utils/capitalize.js", "../../node_modules/@material-ui/core/esm/Tabs/Tabs.js", "../../node_modules/@material-ui/core/esm/utils/debounce.js", "../../node_modules/@material-ui/core/esm/utils/ownerDocument.js", "../../node_modules/@material-ui/core/esm/utils/ownerWindow.js", "../../node_modules/@material-ui/core/esm/utils/scrollLeft.js", "../../node_modules/@material-ui/core/esm/internal/animate.js", "../../node_modules/@material-ui/core/esm/Tabs/ScrollbarSize.js", "../../node_modules/@material-ui/core/esm/Tabs/TabIndicator.js", "../../node_modules/@material-ui/core/esm/TabScrollButton/TabScrollButton.js", "../../node_modules/@material-ui/core/esm/internal/svg-icons/KeyboardArrowLeft.js", "../../node_modules/@material-ui/core/esm/utils/createSvgIcon.js", "../../node_modules/@material-ui/core/esm/SvgIcon/SvgIcon.js", "../../node_modules/@material-ui/core/esm/internal/svg-icons/KeyboardArrowRight.js", "../../node_modules/@material-ui/core/esm/styles/useTheme.js", "../src/components/tab-panel.tsx", "../src/components/general.tsx", "../../node_modules/@material-ui/core/esm/Grid/Grid.js", "../src/components/input-checkbox.tsx", "../../node_modules/@material-ui/core/esm/FormHelperText/FormHelperText.js", "../../node_modules/@material-ui/core/esm/FormControl/formControlState.js", "../../node_modules/@material-ui/core/esm/FormControl/useFormControl.js", "../../node_modules/@material-ui/core/esm/FormControl/FormControlContext.js", "../src/components/input-text.tsx", "../../node_modules/@material-ui/core/esm/TextField/TextField.js", "../../node_modules/@material-ui/core/esm/Input/Input.js", "../../node_modules/@material-ui/core/esm/InputBase/InputBase.js", "../../node_modules/@material-ui/core/esm/TextareaAutosize/TextareaAutosize.js", "../../node_modules/@material-ui/core/esm/InputBase/utils.js", "../../node_modules/@material-ui/core/esm/FilledInput/FilledInput.js", "../../node_modules/@material-ui/core/esm/OutlinedInput/OutlinedInput.js", "../../node_modules/@material-ui/core/esm/OutlinedInput/NotchedOutline.js", "../../node_modules/@material-ui/core/esm/InputLabel/InputLabel.js", "../../node_modules/@material-ui/core/esm/FormLabel/FormLabel.js", "../../node_modules/@material-ui/core/esm/FormControl/FormControl.js", "../../node_modules/@material-ui/core/esm/utils/isMuiElement.js", "../../node_modules/@material-ui/core/esm/Select/Select.js", "../../node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js", "../../node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js", "../../node_modules/@babel/runtime/helpers/esm/nonIterableRest.js", "../../node_modules/@babel/runtime/helpers/esm/slicedToArray.js", "../../node_modules/@material-ui/core/esm/Select/SelectInput.js", "../../node_modules/@material-ui/core/esm/Menu/Menu.js", "../../node_modules/@material-ui/core/esm/Popover/Popover.js", "../../node_modules/@material-ui/core/esm/utils/createChainedFunction.js", "../../node_modules/@material-ui/core/esm/Modal/Modal.js", "../../node_modules/@material-ui/core/esm/Portal/Portal.js", "../../node_modules/@babel/runtime/helpers/esm/classCallCheck.js", "../../node_modules/@babel/runtime/helpers/esm/createClass.js", "../../node_modules/@material-ui/core/esm/utils/getScrollbarSize.js", "../../node_modules/@material-ui/core/esm/Modal/ModalManager.js", "../../node_modules/@material-ui/core/esm/Unstable_TrapFocus/Unstable_TrapFocus.js", "../../node_modules/@material-ui/core/esm/Modal/SimpleBackdrop.js", "../../node_modules/@material-ui/core/esm/Grow/Grow.js", "../../node_modules/@material-ui/core/esm/transitions/utils.js", "../../node_modules/@material-ui/core/esm/Paper/Paper.js", "../../node_modules/@material-ui/core/esm/MenuList/MenuList.js", "../../node_modules/@material-ui/core/esm/List/List.js", "../../node_modules/@material-ui/core/esm/List/ListContext.js", "../../node_modules/@material-ui/core/esm/utils/useControlled.js", "../../node_modules/@material-ui/core/esm/internal/svg-icons/ArrowDropDown.js", "../../node_modules/@material-ui/core/esm/NativeSelect/NativeSelect.js", "../../node_modules/@material-ui/core/esm/NativeSelect/NativeSelectInput.js", "../../node_modules/@material-ui/lab/esm/Autocomplete/Autocomplete.js", "../../node_modules/@material-ui/core/esm/Popper/Popper.js", "../../node_modules/popper.js/src/utils/isBrowser.js", "../../node_modules/popper.js/src/utils/debounce.js", "../../node_modules/popper.js/src/utils/isFunction.js", "../../node_modules/popper.js/src/utils/getStyleComputedProperty.js", "../../node_modules/popper.js/src/utils/getParentNode.js", "../../node_modules/popper.js/src/utils/getScrollParent.js", "../../node_modules/popper.js/src/utils/getReferenceNode.js", "../../node_modules/popper.js/src/utils/isIE.js", "../../node_modules/popper.js/src/utils/getOffsetParent.js", "../../node_modules/popper.js/src/utils/isOffsetContainer.js", "../../node_modules/popper.js/src/utils/getRoot.js", "../../node_modules/popper.js/src/utils/findCommonOffsetParent.js", "../../node_modules/popper.js/src/utils/getScroll.js", "../../node_modules/popper.js/src/utils/includeScroll.js", "../../node_modules/popper.js/src/utils/getBordersSize.js", "../../node_modules/popper.js/src/utils/getWindowSizes.js", "../../node_modules/popper.js/src/utils/getClientRect.js", "../../node_modules/popper.js/src/utils/getBoundingClientRect.js", "../../node_modules/popper.js/src/utils/getOffsetRectRelativeToArbitraryNode.js", "../../node_modules/popper.js/src/utils/getViewportOffsetRectRelativeToArtbitraryNode.js", "../../node_modules/popper.js/src/utils/isFixed.js", "../../node_modules/popper.js/src/utils/getFixedPositionOffsetParent.js", "../../node_modules/popper.js/src/utils/getBoundaries.js", "../../node_modules/popper.js/src/utils/computeAutoPlacement.js", "../../node_modules/popper.js/src/utils/getReferenceOffsets.js", "../../node_modules/popper.js/src/utils/getOuterSizes.js", "../../node_modules/popper.js/src/utils/getOppositePlacement.js", "../../node_modules/popper.js/src/utils/getPopperOffsets.js", "../../node_modules/popper.js/src/utils/find.js", "../../node_modules/popper.js/src/utils/findIndex.js", "../../node_modules/popper.js/src/utils/runModifiers.js", "../../node_modules/popper.js/src/methods/update.js", "../../node_modules/popper.js/src/utils/isModifierEnabled.js", "../../node_modules/popper.js/src/utils/getSupportedPropertyName.js", "../../node_modules/popper.js/src/methods/destroy.js", "../../node_modules/popper.js/src/utils/getWindow.js", "../../node_modules/popper.js/src/utils/setupEventListeners.js", "../../node_modules/popper.js/src/methods/enableEventListeners.js", "../../node_modules/popper.js/src/utils/removeEventListeners.js", "../../node_modules/popper.js/src/methods/disableEventListeners.js", "../../node_modules/popper.js/src/utils/isNumeric.js", "../../node_modules/popper.js/src/utils/setStyles.js", "../../node_modules/popper.js/src/utils/setAttributes.js", "../../node_modules/popper.js/src/modifiers/applyStyle.js", "../../node_modules/popper.js/src/utils/getRoundedOffsets.js", "../../node_modules/popper.js/src/modifiers/computeStyle.js", "../../node_modules/popper.js/src/utils/isModifierRequired.js", "../../node_modules/popper.js/src/modifiers/arrow.js", "../../node_modules/popper.js/src/utils/getOppositeVariation.js", "../../node_modules/popper.js/src/methods/placements.js", "../../node_modules/popper.js/src/utils/clockwise.js", "../../node_modules/popper.js/src/modifiers/flip.js", "../../node_modules/popper.js/src/modifiers/keepTogether.js", "../../node_modules/popper.js/src/modifiers/offset.js", "../../node_modules/popper.js/src/modifiers/preventOverflow.js", "../../node_modules/popper.js/src/modifiers/shift.js", "../../node_modules/popper.js/src/modifiers/hide.js", "../../node_modules/popper.js/src/modifiers/inner.js", "../../node_modules/popper.js/src/modifiers/index.js", "../../node_modules/popper.js/src/methods/defaults.js", "../../node_modules/popper.js/src/index.js", "../../node_modules/@material-ui/core/esm/ListSubheader/ListSubheader.js", "../../node_modules/@material-ui/core/esm/Chip/Chip.js", "../../node_modules/@material-ui/core/esm/internal/svg-icons/Cancel.js", "../../node_modules/@material-ui/lab/esm/internal/svg-icons/Close.js", "../../node_modules/@material-ui/lab/esm/internal/svg-icons/ArrowDropDown.js", "../../node_modules/@material-ui/lab/esm/useAutocomplete/useAutocomplete.js", "../../src/consts.ts", "../src/components/import-export.tsx", "../../node_modules/@material-ui/core/esm/Divider/Divider.js", "../../node_modules/snarkdown/src/index.js", "../src/lib/helpers.ts", "../src/components/input-select.tsx", "../../node_modules/@material-ui/core/esm/MenuItem/MenuItem.js", "../../node_modules/@material-ui/core/esm/ListItem/ListItem.js", "../src/components/message.tsx", "../src/lib/icons.tsx", "../src/components/parser.tsx", "../src/components/input-bitmask.tsx", "../../io-package.json"],
- "sourcesContent": ["/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n", "/** @license React v17.0.2\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var l=require(\"object-assign\"),n=60103,p=60106;exports.Fragment=60107;exports.StrictMode=60108;exports.Profiler=60114;var q=60109,r=60110,t=60112;exports.Suspense=60113;var u=60115,v=60116;\nif(\"function\"===typeof Symbol&&Symbol.for){var w=Symbol.for;n=w(\"react.element\");p=w(\"react.portal\");exports.Fragment=w(\"react.fragment\");exports.StrictMode=w(\"react.strict_mode\");exports.Profiler=w(\"react.profiler\");q=w(\"react.provider\");r=w(\"react.context\");t=w(\"react.forward_ref\");exports.Suspense=w(\"react.suspense\");u=w(\"react.memo\");v=w(\"react.lazy\")}var x=\"function\"===typeof Symbol&&Symbol.iterator;\nfunction y(a){if(null===a||\"object\"!==typeof a)return null;a=x&&a[x]||a[\"@@iterator\"];return\"function\"===typeof a?a:null}function z(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;c=\nE};k=function(){};exports.unstable_forceFrameRate=function(a){0>a||125>>1,e=a[d];if(void 0!==e&&0I(n,c))void 0!==r&&0>I(r,n)?(a[d]=r,a[v]=c,d=v):(a[d]=n,a[m]=c,d=m);else if(void 0!==r&&0>I(r,c))a[d]=r,a[v]=c,d=v;else break a}}return b}return null}function I(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}var L=[],M=[],N=1,O=null,P=3,Q=!1,R=!1,S=!1;\nfunction T(a){for(var b=J(M);null!==b;){if(null===b.callback)K(M);else if(b.startTime<=a)K(M),b.sortIndex=b.expirationTime,H(L,b);else break;b=J(M)}}function U(a){S=!1;T(a);if(!R)if(null!==J(L))R=!0,f(V);else{var b=J(M);null!==b&&g(U,b.startTime-a)}}\nfunction V(a,b){R=!1;S&&(S=!1,h());Q=!0;var c=P;try{T(b);for(O=J(L);null!==O&&(!(O.expirationTime>b)||a&&!exports.unstable_shouldYield());){var d=O.callback;if(\"function\"===typeof d){O.callback=null;P=O.priorityLevel;var e=d(O.expirationTime<=b);b=exports.unstable_now();\"function\"===typeof e?O.callback=e:O===J(L)&&K(L);T(b)}else K(L);O=J(L)}if(null!==O)var m=!0;else{var n=J(M);null!==n&&g(U,n.startTime-b);m=!1}return m}finally{O=null,P=c,Q=!1}}var W=k;exports.unstable_IdlePriority=5;\nexports.unstable_ImmediatePriority=1;exports.unstable_LowPriority=4;exports.unstable_NormalPriority=3;exports.unstable_Profiling=null;exports.unstable_UserBlockingPriority=2;exports.unstable_cancelCallback=function(a){a.callback=null};exports.unstable_continueExecution=function(){R||Q||(R=!0,f(V))};exports.unstable_getCurrentPriorityLevel=function(){return P};exports.unstable_getFirstCallbackNode=function(){return J(L)};\nexports.unstable_next=function(a){switch(P){case 1:case 2:case 3:var b=3;break;default:b=P}var c=P;P=b;try{return a()}finally{P=c}};exports.unstable_pauseExecution=function(){};exports.unstable_requestPaint=W;exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var c=P;P=a;try{return b()}finally{P=c}};\nexports.unstable_scheduleCallback=function(a,b,c){var d=exports.unstable_now();\"object\"===typeof c&&null!==c?(c=c.delay,c=\"number\"===typeof c&&0d?(a.sortIndex=c,H(M,a),null===J(L)&&a===J(M)&&(S?h():S=!0,g(U,c-d))):(a.sortIndex=e,H(L,a),R||Q||(R=!0,f(V)));return a};\nexports.unstable_wrapCallback=function(a){var b=P;return function(){var c=P;P=b;try{return a.apply(this,arguments)}finally{P=c}}};\n", "'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/scheduler.production.min.js');\n} else {\n module.exports = require('./cjs/scheduler.development.js');\n}\n", "/** @license React v17.0.2\n * react-dom.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n/*\n Modernizr 3.0.0pre (Custom Build) | MIT\n*/\n'use strict';var aa=require(\"react\"),m=require(\"object-assign\"),r=require(\"scheduler\");function y(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;cb}return!1}function B(a,b,c,d,e,f,g){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=e;this.mustUseProperty=c;this.propertyName=a;this.type=b;this.sanitizeURL=f;this.removeEmptyString=g}var D={};\n\"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style\".split(\" \").forEach(function(a){D[a]=new B(a,0,!1,a,null,!1,!1)});[[\"acceptCharset\",\"accept-charset\"],[\"className\",\"class\"],[\"htmlFor\",\"for\"],[\"httpEquiv\",\"http-equiv\"]].forEach(function(a){var b=a[0];D[b]=new B(b,1,!1,a[1],null,!1,!1)});[\"contentEditable\",\"draggable\",\"spellCheck\",\"value\"].forEach(function(a){D[a]=new B(a,2,!1,a.toLowerCase(),null,!1,!1)});\n[\"autoReverse\",\"externalResourcesRequired\",\"focusable\",\"preserveAlpha\"].forEach(function(a){D[a]=new B(a,2,!1,a,null,!1,!1)});\"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope\".split(\" \").forEach(function(a){D[a]=new B(a,3,!1,a.toLowerCase(),null,!1,!1)});\n[\"checked\",\"multiple\",\"muted\",\"selected\"].forEach(function(a){D[a]=new B(a,3,!0,a,null,!1,!1)});[\"capture\",\"download\"].forEach(function(a){D[a]=new B(a,4,!1,a,null,!1,!1)});[\"cols\",\"rows\",\"size\",\"span\"].forEach(function(a){D[a]=new B(a,6,!1,a,null,!1,!1)});[\"rowSpan\",\"start\"].forEach(function(a){D[a]=new B(a,5,!1,a.toLowerCase(),null,!1,!1)});var oa=/[\\-:]([a-z])/g;function pa(a){return a[1].toUpperCase()}\n\"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height\".split(\" \").forEach(function(a){var b=a.replace(oa,\npa);D[b]=new B(b,1,!1,a,null,!1,!1)});\"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type\".split(\" \").forEach(function(a){var b=a.replace(oa,pa);D[b]=new B(b,1,!1,a,\"http://www.w3.org/1999/xlink\",!1,!1)});[\"xml:base\",\"xml:lang\",\"xml:space\"].forEach(function(a){var b=a.replace(oa,pa);D[b]=new B(b,1,!1,a,\"http://www.w3.org/XML/1998/namespace\",!1,!1)});[\"tabIndex\",\"crossOrigin\"].forEach(function(a){D[a]=new B(a,1,!1,a.toLowerCase(),null,!1,!1)});\nD.xlinkHref=new B(\"xlinkHref\",1,!1,\"xlink:href\",\"http://www.w3.org/1999/xlink\",!0,!1);[\"src\",\"href\",\"action\",\"formAction\"].forEach(function(a){D[a]=new B(a,1,!1,a.toLowerCase(),null,!0,!0)});\nfunction qa(a,b,c,d){var e=D.hasOwnProperty(b)?D[b]:null;var f=null!==e?0===e.type:d?!1:!(2h||e[g]!==f[h])return\"\\n\"+e[g].replace(\" at new \",\" at \");while(1<=g&&0<=h)}break}}}finally{Oa=!1,Error.prepareStackTrace=c}return(a=a?a.displayName||a.name:\"\")?Na(a):\"\"}\nfunction Qa(a){switch(a.tag){case 5:return Na(a.type);case 16:return Na(\"Lazy\");case 13:return Na(\"Suspense\");case 19:return Na(\"SuspenseList\");case 0:case 2:case 15:return a=Pa(a.type,!1),a;case 11:return a=Pa(a.type.render,!1),a;case 22:return a=Pa(a.type._render,!1),a;case 1:return a=Pa(a.type,!0),a;default:return\"\"}}\nfunction Ra(a){if(null==a)return null;if(\"function\"===typeof a)return a.displayName||a.name||null;if(\"string\"===typeof a)return a;switch(a){case ua:return\"Fragment\";case ta:return\"Portal\";case xa:return\"Profiler\";case wa:return\"StrictMode\";case Ba:return\"Suspense\";case Ca:return\"SuspenseList\"}if(\"object\"===typeof a)switch(a.$$typeof){case za:return(a.displayName||\"Context\")+\".Consumer\";case ya:return(a._context.displayName||\"Context\")+\".Provider\";case Aa:var b=a.render;b=b.displayName||b.name||\"\";\nreturn a.displayName||(\"\"!==b?\"ForwardRef(\"+b+\")\":\"ForwardRef\");case Da:return Ra(a.type);case Fa:return Ra(a._render);case Ea:b=a._payload;a=a._init;try{return Ra(a(b))}catch(c){}}return null}function Sa(a){switch(typeof a){case \"boolean\":case \"number\":case \"object\":case \"string\":case \"undefined\":return a;default:return\"\"}}function Ta(a){var b=a.type;return(a=a.nodeName)&&\"input\"===a.toLowerCase()&&(\"checkbox\"===b||\"radio\"===b)}\nfunction Ua(a){var b=Ta(a)?\"checked\":\"value\",c=Object.getOwnPropertyDescriptor(a.constructor.prototype,b),d=\"\"+a[b];if(!a.hasOwnProperty(b)&&\"undefined\"!==typeof c&&\"function\"===typeof c.get&&\"function\"===typeof c.set){var e=c.get,f=c.set;Object.defineProperty(a,b,{configurable:!0,get:function(){return e.call(this)},set:function(a){d=\"\"+a;f.call(this,a)}});Object.defineProperty(a,b,{enumerable:c.enumerable});return{getValue:function(){return d},setValue:function(a){d=\"\"+a},stopTracking:function(){a._valueTracker=\nnull;delete a[b]}}}}function Va(a){a._valueTracker||(a._valueTracker=Ua(a))}function Wa(a){if(!a)return!1;var b=a._valueTracker;if(!b)return!0;var c=b.getValue();var d=\"\";a&&(d=Ta(a)?a.checked?\"true\":\"false\":a.value);a=d;return a!==c?(b.setValue(a),!0):!1}function Xa(a){a=a||(\"undefined\"!==typeof document?document:void 0);if(\"undefined\"===typeof a)return null;try{return a.activeElement||a.body}catch(b){return a.body}}\nfunction Ya(a,b){var c=b.checked;return m({},b,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=c?c:a._wrapperState.initialChecked})}function Za(a,b){var c=null==b.defaultValue?\"\":b.defaultValue,d=null!=b.checked?b.checked:b.defaultChecked;c=Sa(null!=b.value?b.value:c);a._wrapperState={initialChecked:d,initialValue:c,controlled:\"checkbox\"===b.type||\"radio\"===b.type?null!=b.checked:null!=b.value}}function $a(a,b){b=b.checked;null!=b&&qa(a,\"checked\",b,!1)}\nfunction ab(a,b){$a(a,b);var c=Sa(b.value),d=b.type;if(null!=c)if(\"number\"===d){if(0===c&&\"\"===a.value||a.value!=c)a.value=\"\"+c}else a.value!==\"\"+c&&(a.value=\"\"+c);else if(\"submit\"===d||\"reset\"===d){a.removeAttribute(\"value\");return}b.hasOwnProperty(\"value\")?bb(a,b.type,c):b.hasOwnProperty(\"defaultValue\")&&bb(a,b.type,Sa(b.defaultValue));null==b.checked&&null!=b.defaultChecked&&(a.defaultChecked=!!b.defaultChecked)}\nfunction cb(a,b,c){if(b.hasOwnProperty(\"value\")||b.hasOwnProperty(\"defaultValue\")){var d=b.type;if(!(\"submit\"!==d&&\"reset\"!==d||void 0!==b.value&&null!==b.value))return;b=\"\"+a._wrapperState.initialValue;c||b===a.value||(a.value=b);a.defaultValue=b}c=a.name;\"\"!==c&&(a.name=\"\");a.defaultChecked=!!a._wrapperState.initialChecked;\"\"!==c&&(a.name=c)}\nfunction bb(a,b,c){if(\"number\"!==b||Xa(a.ownerDocument)!==a)null==c?a.defaultValue=\"\"+a._wrapperState.initialValue:a.defaultValue!==\"\"+c&&(a.defaultValue=\"\"+c)}function db(a){var b=\"\";aa.Children.forEach(a,function(a){null!=a&&(b+=a)});return b}function eb(a,b){a=m({children:void 0},b);if(b=db(b.children))a.children=b;return a}\nfunction fb(a,b,c,d){a=a.options;if(b){b={};for(var e=0;e=c.length))throw Error(y(93));c=c[0]}b=c}null==b&&(b=\"\");c=b}a._wrapperState={initialValue:Sa(c)}}\nfunction ib(a,b){var c=Sa(b.value),d=Sa(b.defaultValue);null!=c&&(c=\"\"+c,c!==a.value&&(a.value=c),null==b.defaultValue&&a.defaultValue!==c&&(a.defaultValue=c));null!=d&&(a.defaultValue=\"\"+d)}function jb(a){var b=a.textContent;b===a._wrapperState.initialValue&&\"\"!==b&&null!==b&&(a.value=b)}var kb={html:\"http://www.w3.org/1999/xhtml\",mathml:\"http://www.w3.org/1998/Math/MathML\",svg:\"http://www.w3.org/2000/svg\"};\nfunction lb(a){switch(a){case \"svg\":return\"http://www.w3.org/2000/svg\";case \"math\":return\"http://www.w3.org/1998/Math/MathML\";default:return\"http://www.w3.org/1999/xhtml\"}}function mb(a,b){return null==a||\"http://www.w3.org/1999/xhtml\"===a?lb(b):\"http://www.w3.org/2000/svg\"===a&&\"foreignObject\"===b?\"http://www.w3.org/1999/xhtml\":a}\nvar nb,ob=function(a){return\"undefined\"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(b,c,d,e){MSApp.execUnsafeLocalFunction(function(){return a(b,c,d,e)})}:a}(function(a,b){if(a.namespaceURI!==kb.svg||\"innerHTML\"in a)a.innerHTML=b;else{nb=nb||document.createElement(\"div\");nb.innerHTML=\"\";for(b=nb.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;b.firstChild;)a.appendChild(b.firstChild)}});\nfunction pb(a,b){if(b){var c=a.firstChild;if(c&&c===a.lastChild&&3===c.nodeType){c.nodeValue=b;return}}a.textContent=b}\nvar qb={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,\nfloodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},rb=[\"Webkit\",\"ms\",\"Moz\",\"O\"];Object.keys(qb).forEach(function(a){rb.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);qb[b]=qb[a]})});function sb(a,b,c){return null==b||\"boolean\"===typeof b||\"\"===b?\"\":c||\"number\"!==typeof b||0===b||qb.hasOwnProperty(a)&&qb[a]?(\"\"+b).trim():b+\"px\"}\nfunction tb(a,b){a=a.style;for(var c in b)if(b.hasOwnProperty(c)){var d=0===c.indexOf(\"--\"),e=sb(c,b[c],d);\"float\"===c&&(c=\"cssFloat\");d?a.setProperty(c,e):a[c]=e}}var ub=m({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});\nfunction vb(a,b){if(b){if(ub[a]&&(null!=b.children||null!=b.dangerouslySetInnerHTML))throw Error(y(137,a));if(null!=b.dangerouslySetInnerHTML){if(null!=b.children)throw Error(y(60));if(!(\"object\"===typeof b.dangerouslySetInnerHTML&&\"__html\"in b.dangerouslySetInnerHTML))throw Error(y(61));}if(null!=b.style&&\"object\"!==typeof b.style)throw Error(y(62));}}\nfunction wb(a,b){if(-1===a.indexOf(\"-\"))return\"string\"===typeof b.is;switch(a){case \"annotation-xml\":case \"color-profile\":case \"font-face\":case \"font-face-src\":case \"font-face-uri\":case \"font-face-format\":case \"font-face-name\":case \"missing-glyph\":return!1;default:return!0}}function xb(a){a=a.target||a.srcElement||window;a.correspondingUseElement&&(a=a.correspondingUseElement);return 3===a.nodeType?a.parentNode:a}var yb=null,zb=null,Ab=null;\nfunction Bb(a){if(a=Cb(a)){if(\"function\"!==typeof yb)throw Error(y(280));var b=a.stateNode;b&&(b=Db(b),yb(a.stateNode,a.type,b))}}function Eb(a){zb?Ab?Ab.push(a):Ab=[a]:zb=a}function Fb(){if(zb){var a=zb,b=Ab;Ab=zb=null;Bb(a);if(b)for(a=0;ad?0:1<c;c++)b.push(a);return b}\nfunction $c(a,b,c){a.pendingLanes|=b;var d=b-1;a.suspendedLanes&=d;a.pingedLanes&=d;a=a.eventTimes;b=31-Vc(b);a[b]=c}var Vc=Math.clz32?Math.clz32:ad,bd=Math.log,cd=Math.LN2;function ad(a){return 0===a?32:31-(bd(a)/cd|0)|0}var dd=r.unstable_UserBlockingPriority,ed=r.unstable_runWithPriority,fd=!0;function gd(a,b,c,d){Kb||Ib();var e=hd,f=Kb;Kb=!0;try{Hb(e,a,b,c,d)}finally{(Kb=f)||Mb()}}function id(a,b,c,d){ed(dd,hd.bind(null,a,b,c,d))}\nfunction hd(a,b,c,d){if(fd){var e;if((e=0===(b&4))&&0=be),ee=String.fromCharCode(32),fe=!1;\nfunction ge(a,b){switch(a){case \"keyup\":return-1!==$d.indexOf(b.keyCode);case \"keydown\":return 229!==b.keyCode;case \"keypress\":case \"mousedown\":case \"focusout\":return!0;default:return!1}}function he(a){a=a.detail;return\"object\"===typeof a&&\"data\"in a?a.data:null}var ie=!1;function je(a,b){switch(a){case \"compositionend\":return he(b);case \"keypress\":if(32!==b.which)return null;fe=!0;return ee;case \"textInput\":return a=b.data,a===ee&&fe?null:a;default:return null}}\nfunction ke(a,b){if(ie)return\"compositionend\"===a||!ae&&ge(a,b)?(a=nd(),md=ld=kd=null,ie=!1,a):null;switch(a){case \"paste\":return null;case \"keypress\":if(!(b.ctrlKey||b.altKey||b.metaKey)||b.ctrlKey&&b.altKey){if(b.char&&1=b)return{node:c,offset:b-a};a=d}a:{for(;c;){if(c.nextSibling){c=c.nextSibling;break a}c=c.parentNode}c=void 0}c=Ke(c)}}function Me(a,b){return a&&b?a===b?!0:a&&3===a.nodeType?!1:b&&3===b.nodeType?Me(a,b.parentNode):\"contains\"in a?a.contains(b):a.compareDocumentPosition?!!(a.compareDocumentPosition(b)&16):!1:!1}\nfunction Ne(){for(var a=window,b=Xa();b instanceof a.HTMLIFrameElement;){try{var c=\"string\"===typeof b.contentWindow.location.href}catch(d){c=!1}if(c)a=b.contentWindow;else break;b=Xa(a.document)}return b}function Oe(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return b&&(\"input\"===b&&(\"text\"===a.type||\"search\"===a.type||\"tel\"===a.type||\"url\"===a.type||\"password\"===a.type)||\"textarea\"===b||\"true\"===a.contentEditable)}\nvar Pe=fa&&\"documentMode\"in document&&11>=document.documentMode,Qe=null,Re=null,Se=null,Te=!1;\nfunction Ue(a,b,c){var d=c.window===c?c.document:9===c.nodeType?c:c.ownerDocument;Te||null==Qe||Qe!==Xa(d)||(d=Qe,\"selectionStart\"in d&&Oe(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Se&&Je(Se,d)||(Se=d,d=oe(Re,\"onSelect\"),0Af||(a.current=zf[Af],zf[Af]=null,Af--)}function I(a,b){Af++;zf[Af]=a.current;a.current=b}var Cf={},M=Bf(Cf),N=Bf(!1),Df=Cf;\nfunction Ef(a,b){var c=a.type.contextTypes;if(!c)return Cf;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e}function Ff(a){a=a.childContextTypes;return null!==a&&void 0!==a}function Gf(){H(N);H(M)}function Hf(a,b,c){if(M.current!==Cf)throw Error(y(168));I(M,b);I(N,c)}\nfunction If(a,b,c){var d=a.stateNode;a=b.childContextTypes;if(\"function\"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)if(!(e in a))throw Error(y(108,Ra(b)||\"Unknown\",e));return m({},c,d)}function Jf(a){a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Cf;Df=M.current;I(M,a);I(N,N.current);return!0}function Kf(a,b,c){var d=a.stateNode;if(!d)throw Error(y(169));c?(a=If(a,b,Df),d.__reactInternalMemoizedMergedChildContext=a,H(N),H(M),I(M,a)):H(N);I(N,c)}\nvar Lf=null,Mf=null,Nf=r.unstable_runWithPriority,Of=r.unstable_scheduleCallback,Pf=r.unstable_cancelCallback,Qf=r.unstable_shouldYield,Rf=r.unstable_requestPaint,Sf=r.unstable_now,Tf=r.unstable_getCurrentPriorityLevel,Uf=r.unstable_ImmediatePriority,Vf=r.unstable_UserBlockingPriority,Wf=r.unstable_NormalPriority,Xf=r.unstable_LowPriority,Yf=r.unstable_IdlePriority,Zf={},$f=void 0!==Rf?Rf:function(){},ag=null,bg=null,cg=!1,dg=Sf(),O=1E4>dg?Sf:function(){return Sf()-dg};\nfunction eg(){switch(Tf()){case Uf:return 99;case Vf:return 98;case Wf:return 97;case Xf:return 96;case Yf:return 95;default:throw Error(y(332));}}function fg(a){switch(a){case 99:return Uf;case 98:return Vf;case 97:return Wf;case 96:return Xf;case 95:return Yf;default:throw Error(y(332));}}function gg(a,b){a=fg(a);return Nf(a,b)}function hg(a,b,c){a=fg(a);return Of(a,b,c)}function ig(){if(null!==bg){var a=bg;bg=null;Pf(a)}jg()}\nfunction jg(){if(!cg&&null!==ag){cg=!0;var a=0;try{var b=ag;gg(99,function(){for(;az?(q=u,u=null):q=u.sibling;var n=p(e,u,h[z],k);if(null===n){null===u&&(u=q);break}a&&u&&null===\nn.alternate&&b(e,u);g=f(n,g,z);null===t?l=n:t.sibling=n;t=n;u=q}if(z===h.length)return c(e,u),l;if(null===u){for(;zz?(q=u,u=null):q=u.sibling;var w=p(e,u,n.value,k);if(null===w){null===u&&(u=q);break}a&&u&&null===w.alternate&&b(e,u);g=f(w,g,z);null===t?l=w:t.sibling=w;t=w;u=q}if(n.done)return c(e,u),l;if(null===u){for(;!n.done;z++,n=h.next())n=A(e,n.value,k),null!==n&&(g=f(n,g,z),null===t?l=n:t.sibling=n,t=n);return l}for(u=d(e,u);!n.done;z++,n=h.next())n=C(u,e,z,n.value,k),null!==n&&(a&&null!==n.alternate&&\nu.delete(null===n.key?z:n.key),g=f(n,g,z),null===t?l=n:t.sibling=n,t=n);a&&u.forEach(function(a){return b(e,a)});return l}return function(a,d,f,h){var k=\"object\"===typeof f&&null!==f&&f.type===ua&&null===f.key;k&&(f=f.props.children);var l=\"object\"===typeof f&&null!==f;if(l)switch(f.$$typeof){case sa:a:{l=f.key;for(k=d;null!==k;){if(k.key===l){switch(k.tag){case 7:if(f.type===ua){c(a,k.sibling);d=e(k,f.props.children);d.return=a;a=d;break a}break;default:if(k.elementType===f.type){c(a,k.sibling);\nd=e(k,f.props);d.ref=Qg(a,k,f);d.return=a;a=d;break a}}c(a,k);break}else b(a,k);k=k.sibling}f.type===ua?(d=Xg(f.props.children,a.mode,h,f.key),d.return=a,a=d):(h=Vg(f.type,f.key,f.props,null,a.mode,h),h.ref=Qg(a,d,f),h.return=a,a=h)}return g(a);case ta:a:{for(k=f.key;null!==d;){if(d.key===k)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[]);d.return=a;a=d;break a}else{c(a,d);break}else b(a,d);d=d.sibling}d=\nWg(f,a.mode,h);d.return=a;a=d}return g(a)}if(\"string\"===typeof f||\"number\"===typeof f)return f=\"\"+f,null!==d&&6===d.tag?(c(a,d.sibling),d=e(d,f),d.return=a,a=d):(c(a,d),d=Ug(f,a.mode,h),d.return=a,a=d),g(a);if(Pg(f))return x(a,d,f,h);if(La(f))return w(a,d,f,h);l&&Rg(a,f);if(\"undefined\"===typeof f&&!k)switch(a.tag){case 1:case 22:case 0:case 11:case 15:throw Error(y(152,Ra(a.type)||\"Component\"));}return c(a,d)}}var Yg=Sg(!0),Zg=Sg(!1),$g={},ah=Bf($g),bh=Bf($g),ch=Bf($g);\nfunction dh(a){if(a===$g)throw Error(y(174));return a}function eh(a,b){I(ch,b);I(bh,a);I(ah,$g);a=b.nodeType;switch(a){case 9:case 11:b=(b=b.documentElement)?b.namespaceURI:mb(null,\"\");break;default:a=8===a?b.parentNode:b,b=a.namespaceURI||null,a=a.tagName,b=mb(b,a)}H(ah);I(ah,b)}function fh(){H(ah);H(bh);H(ch)}function gh(a){dh(ch.current);var b=dh(ah.current);var c=mb(b,a.type);b!==c&&(I(bh,a),I(ah,c))}function hh(a){bh.current===a&&(H(ah),H(bh))}var P=Bf(0);\nfunction ih(a){for(var b=a;null!==b;){if(13===b.tag){var c=b.memoizedState;if(null!==c&&(c=c.dehydrated,null===c||\"$?\"===c.data||\"$!\"===c.data))return b}else if(19===b.tag&&void 0!==b.memoizedProps.revealOrder){if(0!==(b.flags&64))return b}else if(null!==b.child){b.child.return=b;b=b.child;continue}if(b===a)break;for(;null===b.sibling;){if(null===b.return||b.return===a)return null;b=b.return}b.sibling.return=b.return;b=b.sibling}return null}var jh=null,kh=null,lh=!1;\nfunction mh(a,b){var c=nh(5,null,null,0);c.elementType=\"DELETED\";c.type=\"DELETED\";c.stateNode=b;c.return=a;c.flags=8;null!==a.lastEffect?(a.lastEffect.nextEffect=c,a.lastEffect=c):a.firstEffect=a.lastEffect=c}function oh(a,b){switch(a.tag){case 5:var c=a.type;b=1!==b.nodeType||c.toLowerCase()!==b.nodeName.toLowerCase()?null:b;return null!==b?(a.stateNode=b,!0):!1;case 6:return b=\"\"===a.pendingProps||3!==b.nodeType?null:b,null!==b?(a.stateNode=b,!0):!1;case 13:return!1;default:return!1}}\nfunction ph(a){if(lh){var b=kh;if(b){var c=b;if(!oh(a,b)){b=rf(c.nextSibling);if(!b||!oh(a,b)){a.flags=a.flags&-1025|2;lh=!1;jh=a;return}mh(jh,c)}jh=a;kh=rf(b.firstChild)}else a.flags=a.flags&-1025|2,lh=!1,jh=a}}function qh(a){for(a=a.return;null!==a&&5!==a.tag&&3!==a.tag&&13!==a.tag;)a=a.return;jh=a}\nfunction rh(a){if(a!==jh)return!1;if(!lh)return qh(a),lh=!0,!1;var b=a.type;if(5!==a.tag||\"head\"!==b&&\"body\"!==b&&!nf(b,a.memoizedProps))for(b=kh;b;)mh(a,b),b=rf(b.nextSibling);qh(a);if(13===a.tag){a=a.memoizedState;a=null!==a?a.dehydrated:null;if(!a)throw Error(y(317));a:{a=a.nextSibling;for(b=0;a;){if(8===a.nodeType){var c=a.data;if(\"/$\"===c){if(0===b){kh=rf(a.nextSibling);break a}b--}else\"$\"!==c&&\"$!\"!==c&&\"$?\"!==c||b++}a=a.nextSibling}kh=null}}else kh=jh?rf(a.stateNode.nextSibling):null;return!0}\nfunction sh(){kh=jh=null;lh=!1}var th=[];function uh(){for(var a=0;af))throw Error(y(301));f+=1;T=S=null;b.updateQueue=null;vh.current=Fh;a=c(d,e)}while(zh)}vh.current=Gh;b=null!==S&&null!==S.next;xh=0;T=S=R=null;yh=!1;if(b)throw Error(y(300));return a}function Hh(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};null===T?R.memoizedState=T=a:T=T.next=a;return T}\nfunction Ih(){if(null===S){var a=R.alternate;a=null!==a?a.memoizedState:null}else a=S.next;var b=null===T?R.memoizedState:T.next;if(null!==b)T=b,S=a;else{if(null===a)throw Error(y(310));S=a;a={memoizedState:S.memoizedState,baseState:S.baseState,baseQueue:S.baseQueue,queue:S.queue,next:null};null===T?R.memoizedState=T=a:T=T.next=a}return T}function Jh(a,b){return\"function\"===typeof b?b(a):b}\nfunction Kh(a){var b=Ih(),c=b.queue;if(null===c)throw Error(y(311));c.lastRenderedReducer=a;var d=S,e=d.baseQueue,f=c.pending;if(null!==f){if(null!==e){var g=e.next;e.next=f.next;f.next=g}d.baseQueue=e=f;c.pending=null}if(null!==e){e=e.next;d=d.baseState;var h=g=f=null,k=e;do{var l=k.lane;if((xh&l)===l)null!==h&&(h=h.next={lane:0,action:k.action,eagerReducer:k.eagerReducer,eagerState:k.eagerState,next:null}),d=k.eagerReducer===a?k.eagerState:a(d,k.action);else{var n={lane:l,action:k.action,eagerReducer:k.eagerReducer,\neagerState:k.eagerState,next:null};null===h?(g=h=n,f=d):h=h.next=n;R.lanes|=l;Dg|=l}k=k.next}while(null!==k&&k!==e);null===h?f=d:h.next=g;He(d,b.memoizedState)||(ug=!0);b.memoizedState=d;b.baseState=f;b.baseQueue=h;c.lastRenderedState=d}return[b.memoizedState,c.dispatch]}\nfunction Lh(a){var b=Ih(),c=b.queue;if(null===c)throw Error(y(311));c.lastRenderedReducer=a;var d=c.dispatch,e=c.pending,f=b.memoizedState;if(null!==e){c.pending=null;var g=e=e.next;do f=a(f,g.action),g=g.next;while(g!==e);He(f,b.memoizedState)||(ug=!0);b.memoizedState=f;null===b.baseQueue&&(b.baseState=f);c.lastRenderedState=f}return[f,d]}\nfunction Mh(a,b,c){var d=b._getVersion;d=d(b._source);var e=b._workInProgressVersionPrimary;if(null!==e)a=e===d;else if(a=a.mutableReadLanes,a=(xh&a)===a)b._workInProgressVersionPrimary=d,th.push(b);if(a)return c(b._source);th.push(b);throw Error(y(350));}\nfunction Nh(a,b,c,d){var e=U;if(null===e)throw Error(y(349));var f=b._getVersion,g=f(b._source),h=vh.current,k=h.useState(function(){return Mh(e,b,c)}),l=k[1],n=k[0];k=T;var A=a.memoizedState,p=A.refs,C=p.getSnapshot,x=A.source;A=A.subscribe;var w=R;a.memoizedState={refs:p,source:b,subscribe:d};h.useEffect(function(){p.getSnapshot=c;p.setSnapshot=l;var a=f(b._source);if(!He(g,a)){a=c(b._source);He(n,a)||(l(a),a=Ig(w),e.mutableReadLanes|=a&e.pendingLanes);a=e.mutableReadLanes;e.entangledLanes|=a;for(var d=\ne.entanglements,h=a;0c?98:c,function(){a(!0)});gg(97\\x3c/script>\",a=a.removeChild(a.firstChild)):\"string\"===typeof d.is?a=g.createElement(c,{is:d.is}):(a=g.createElement(c),\"select\"===c&&(g=a,d.multiple?g.multiple=!0:d.size&&(g.size=d.size))):a=g.createElementNS(a,c);a[wf]=b;a[xf]=d;Bi(a,b,!1,!1);b.stateNode=a;g=wb(c,d);switch(c){case \"dialog\":G(\"cancel\",a);G(\"close\",a);\ne=d;break;case \"iframe\":case \"object\":case \"embed\":G(\"load\",a);e=d;break;case \"video\":case \"audio\":for(e=0;eJi&&(b.flags|=64,f=!0,Fi(d,!1),b.lanes=33554432)}else{if(!f)if(a=ih(g),null!==a){if(b.flags|=64,f=!0,c=a.updateQueue,null!==c&&(b.updateQueue=c,b.flags|=4),Fi(d,!0),null===d.tail&&\"hidden\"===d.tailMode&&!g.alternate&&!lh)return b=b.lastEffect=d.lastEffect,null!==b&&(b.nextEffect=null),null}else 2*O()-d.renderingStartTime>Ji&&1073741824!==c&&(b.flags|=\n64,f=!0,Fi(d,!1),b.lanes=33554432);d.isBackwards?(g.sibling=b.child,b.child=g):(c=d.last,null!==c?c.sibling=g:b.child=g,d.last=g)}return null!==d.tail?(c=d.tail,d.rendering=c,d.tail=c.sibling,d.lastEffect=b.lastEffect,d.renderingStartTime=O(),c.sibling=null,b=P.current,I(P,f?b&1|2:b&1),c):null;case 23:case 24:return Ki(),null!==a&&null!==a.memoizedState!==(null!==b.memoizedState)&&\"unstable-defer-without-hiding\"!==d.mode&&(b.flags|=4),null}throw Error(y(156,b.tag));}\nfunction Li(a){switch(a.tag){case 1:Ff(a.type)&&Gf();var b=a.flags;return b&4096?(a.flags=b&-4097|64,a):null;case 3:fh();H(N);H(M);uh();b=a.flags;if(0!==(b&64))throw Error(y(285));a.flags=b&-4097|64;return a;case 5:return hh(a),null;case 13:return H(P),b=a.flags,b&4096?(a.flags=b&-4097|64,a):null;case 19:return H(P),null;case 4:return fh(),null;case 10:return rg(a),null;case 23:case 24:return Ki(),null;default:return null}}\nfunction Mi(a,b){try{var c=\"\",d=b;do c+=Qa(d),d=d.return;while(d);var e=c}catch(f){e=\"\\nError generating stack: \"+f.message+\"\\n\"+f.stack}return{value:a,source:b,stack:e}}function Ni(a,b){try{console.error(b.value)}catch(c){setTimeout(function(){throw c;})}}var Oi=\"function\"===typeof WeakMap?WeakMap:Map;function Pi(a,b,c){c=zg(-1,c);c.tag=3;c.payload={element:null};var d=b.value;c.callback=function(){Qi||(Qi=!0,Ri=d);Ni(a,b)};return c}\nfunction Si(a,b,c){c=zg(-1,c);c.tag=3;var d=a.type.getDerivedStateFromError;if(\"function\"===typeof d){var e=b.value;c.payload=function(){Ni(a,b);return d(e)}}var f=a.stateNode;null!==f&&\"function\"===typeof f.componentDidCatch&&(c.callback=function(){\"function\"!==typeof d&&(null===Ti?Ti=new Set([this]):Ti.add(this),Ni(a,b));var c=b.stack;this.componentDidCatch(b.value,{componentStack:null!==c?c:\"\"})});return c}var Ui=\"function\"===typeof WeakSet?WeakSet:Set;\nfunction Vi(a){var b=a.ref;if(null!==b)if(\"function\"===typeof b)try{b(null)}catch(c){Wi(a,c)}else b.current=null}function Xi(a,b){switch(b.tag){case 0:case 11:case 15:case 22:return;case 1:if(b.flags&256&&null!==a){var c=a.memoizedProps,d=a.memoizedState;a=b.stateNode;b=a.getSnapshotBeforeUpdate(b.elementType===b.type?c:lg(b.type,c),d);a.__reactInternalSnapshotBeforeUpdate=b}return;case 3:b.flags&256&&qf(b.stateNode.containerInfo);return;case 5:case 6:case 4:case 17:return}throw Error(y(163));}\nfunction Yi(a,b,c){switch(c.tag){case 0:case 11:case 15:case 22:b=c.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){a=b=b.next;do{if(3===(a.tag&3)){var d=a.create;a.destroy=d()}a=a.next}while(a!==b)}b=c.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){a=b=b.next;do{var e=a;d=e.next;e=e.tag;0!==(e&4)&&0!==(e&1)&&(Zi(c,a),$i(c,a));a=d}while(a!==b)}return;case 1:a=c.stateNode;c.flags&4&&(null===b?a.componentDidMount():(d=c.elementType===c.type?b.memoizedProps:lg(c.type,b.memoizedProps),a.componentDidUpdate(d,\nb.memoizedState,a.__reactInternalSnapshotBeforeUpdate)));b=c.updateQueue;null!==b&&Eg(c,b,a);return;case 3:b=c.updateQueue;if(null!==b){a=null;if(null!==c.child)switch(c.child.tag){case 5:a=c.child.stateNode;break;case 1:a=c.child.stateNode}Eg(c,b,a)}return;case 5:a=c.stateNode;null===b&&c.flags&4&&mf(c.type,c.memoizedProps)&&a.focus();return;case 6:return;case 4:return;case 12:return;case 13:null===c.memoizedState&&(c=c.alternate,null!==c&&(c=c.memoizedState,null!==c&&(c=c.dehydrated,null!==c&&Cc(c))));\nreturn;case 19:case 17:case 20:case 21:case 23:case 24:return}throw Error(y(163));}\nfunction aj(a,b){for(var c=a;;){if(5===c.tag){var d=c.stateNode;if(b)d=d.style,\"function\"===typeof d.setProperty?d.setProperty(\"display\",\"none\",\"important\"):d.display=\"none\";else{d=c.stateNode;var e=c.memoizedProps.style;e=void 0!==e&&null!==e&&e.hasOwnProperty(\"display\")?e.display:null;d.style.display=sb(\"display\",e)}}else if(6===c.tag)c.stateNode.nodeValue=b?\"\":c.memoizedProps;else if((23!==c.tag&&24!==c.tag||null===c.memoizedState||c===a)&&null!==c.child){c.child.return=c;c=c.child;continue}if(c===\na)break;for(;null===c.sibling;){if(null===c.return||c.return===a)return;c=c.return}c.sibling.return=c.return;c=c.sibling}}\nfunction bj(a,b){if(Mf&&\"function\"===typeof Mf.onCommitFiberUnmount)try{Mf.onCommitFiberUnmount(Lf,b)}catch(f){}switch(b.tag){case 0:case 11:case 14:case 15:case 22:a=b.updateQueue;if(null!==a&&(a=a.lastEffect,null!==a)){var c=a=a.next;do{var d=c,e=d.destroy;d=d.tag;if(void 0!==e)if(0!==(d&4))Zi(b,c);else{d=b;try{e()}catch(f){Wi(d,f)}}c=c.next}while(c!==a)}break;case 1:Vi(b);a=b.stateNode;if(\"function\"===typeof a.componentWillUnmount)try{a.props=b.memoizedProps,a.state=b.memoizedState,a.componentWillUnmount()}catch(f){Wi(b,\nf)}break;case 5:Vi(b);break;case 4:cj(a,b)}}function dj(a){a.alternate=null;a.child=null;a.dependencies=null;a.firstEffect=null;a.lastEffect=null;a.memoizedProps=null;a.memoizedState=null;a.pendingProps=null;a.return=null;a.updateQueue=null}function ej(a){return 5===a.tag||3===a.tag||4===a.tag}\nfunction fj(a){a:{for(var b=a.return;null!==b;){if(ej(b))break a;b=b.return}throw Error(y(160));}var c=b;b=c.stateNode;switch(c.tag){case 5:var d=!1;break;case 3:b=b.containerInfo;d=!0;break;case 4:b=b.containerInfo;d=!0;break;default:throw Error(y(161));}c.flags&16&&(pb(b,\"\"),c.flags&=-17);a:b:for(c=a;;){for(;null===c.sibling;){if(null===c.return||ej(c.return)){c=null;break a}c=c.return}c.sibling.return=c.return;for(c=c.sibling;5!==c.tag&&6!==c.tag&&18!==c.tag;){if(c.flags&2)continue b;if(null===\nc.child||4===c.tag)continue b;else c.child.return=c,c=c.child}if(!(c.flags&2)){c=c.stateNode;break a}}d?gj(a,c,b):hj(a,c,b)}\nfunction gj(a,b,c){var d=a.tag,e=5===d||6===d;if(e)a=e?a.stateNode:a.stateNode.instance,b?8===c.nodeType?c.parentNode.insertBefore(a,b):c.insertBefore(a,b):(8===c.nodeType?(b=c.parentNode,b.insertBefore(a,c)):(b=c,b.appendChild(a)),c=c._reactRootContainer,null!==c&&void 0!==c||null!==b.onclick||(b.onclick=jf));else if(4!==d&&(a=a.child,null!==a))for(gj(a,b,c),a=a.sibling;null!==a;)gj(a,b,c),a=a.sibling}\nfunction hj(a,b,c){var d=a.tag,e=5===d||6===d;if(e)a=e?a.stateNode:a.stateNode.instance,b?c.insertBefore(a,b):c.appendChild(a);else if(4!==d&&(a=a.child,null!==a))for(hj(a,b,c),a=a.sibling;null!==a;)hj(a,b,c),a=a.sibling}\nfunction cj(a,b){for(var c=b,d=!1,e,f;;){if(!d){d=c.return;a:for(;;){if(null===d)throw Error(y(160));e=d.stateNode;switch(d.tag){case 5:f=!1;break a;case 3:e=e.containerInfo;f=!0;break a;case 4:e=e.containerInfo;f=!0;break a}d=d.return}d=!0}if(5===c.tag||6===c.tag){a:for(var g=a,h=c,k=h;;)if(bj(g,k),null!==k.child&&4!==k.tag)k.child.return=k,k=k.child;else{if(k===h)break a;for(;null===k.sibling;){if(null===k.return||k.return===h)break a;k=k.return}k.sibling.return=k.return;k=k.sibling}f?(g=e,h=c.stateNode,\n8===g.nodeType?g.parentNode.removeChild(h):g.removeChild(h)):e.removeChild(c.stateNode)}else if(4===c.tag){if(null!==c.child){e=c.stateNode.containerInfo;f=!0;c.child.return=c;c=c.child;continue}}else if(bj(a,c),null!==c.child){c.child.return=c;c=c.child;continue}if(c===b)break;for(;null===c.sibling;){if(null===c.return||c.return===b)return;c=c.return;4===c.tag&&(d=!1)}c.sibling.return=c.return;c=c.sibling}}\nfunction ij(a,b){switch(b.tag){case 0:case 11:case 14:case 15:case 22:var c=b.updateQueue;c=null!==c?c.lastEffect:null;if(null!==c){var d=c=c.next;do 3===(d.tag&3)&&(a=d.destroy,d.destroy=void 0,void 0!==a&&a()),d=d.next;while(d!==c)}return;case 1:return;case 5:c=b.stateNode;if(null!=c){d=b.memoizedProps;var e=null!==a?a.memoizedProps:d;a=b.type;var f=b.updateQueue;b.updateQueue=null;if(null!==f){c[xf]=d;\"input\"===a&&\"radio\"===d.type&&null!=d.name&&$a(c,d);wb(a,e);b=wb(a,d);for(e=0;ee&&(e=g);c&=~f}c=e;c=O()-c;c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3E3>c?3E3:4320>\nc?4320:1960*nj(c/1960))-c;if(10 component higher in the tree to provide a loading indicator or placeholder to display.\")}5!==V&&(V=2);k=Mi(k,h);p=\ng;do{switch(p.tag){case 3:f=k;p.flags|=4096;b&=-b;p.lanes|=b;var J=Pi(p,f,b);Bg(p,J);break a;case 1:f=k;var K=p.type,Q=p.stateNode;if(0===(p.flags&64)&&(\"function\"===typeof K.getDerivedStateFromError||null!==Q&&\"function\"===typeof Q.componentDidCatch&&(null===Ti||!Ti.has(Q)))){p.flags|=4096;b&=-b;p.lanes|=b;var L=Si(p,f,b);Bg(p,L);break a}}p=p.return}while(null!==p)}Zj(c)}catch(va){b=va;Y===c&&null!==c&&(Y=c=c.return);continue}break}while(1)}\nfunction Pj(){var a=oj.current;oj.current=Gh;return null===a?Gh:a}function Tj(a,b){var c=X;X|=16;var d=Pj();U===a&&W===b||Qj(a,b);do try{ak();break}catch(e){Sj(a,e)}while(1);qg();X=c;oj.current=d;if(null!==Y)throw Error(y(261));U=null;W=0;return V}function ak(){for(;null!==Y;)bk(Y)}function Rj(){for(;null!==Y&&!Qf();)bk(Y)}function bk(a){var b=ck(a.alternate,a,qj);a.memoizedProps=a.pendingProps;null===b?Zj(a):Y=b;pj.current=null}\nfunction Zj(a){var b=a;do{var c=b.alternate;a=b.return;if(0===(b.flags&2048)){c=Gi(c,b,qj);if(null!==c){Y=c;return}c=b;if(24!==c.tag&&23!==c.tag||null===c.memoizedState||0!==(qj&1073741824)||0===(c.mode&4)){for(var d=0,e=c.child;null!==e;)d|=e.lanes|e.childLanes,e=e.sibling;c.childLanes=d}null!==a&&0===(a.flags&2048)&&(null===a.firstEffect&&(a.firstEffect=b.firstEffect),null!==b.lastEffect&&(null!==a.lastEffect&&(a.lastEffect.nextEffect=b.firstEffect),a.lastEffect=b.lastEffect),1g&&(h=g,g=J,J=h),h=Le(t,J),f=Le(t,g),h&&f&&(1!==v.rangeCount||v.anchorNode!==h.node||v.anchorOffset!==h.offset||v.focusNode!==f.node||v.focusOffset!==f.offset)&&(q=q.createRange(),q.setStart(h.node,h.offset),v.removeAllRanges(),J>g?(v.addRange(q),v.extend(f.node,f.offset)):(q.setEnd(f.node,f.offset),v.addRange(q))))));q=[];for(v=t;v=v.parentNode;)1===v.nodeType&&q.push({element:v,left:v.scrollLeft,top:v.scrollTop});\"function\"===typeof t.focus&&t.focus();for(t=\n0;tO()-jj?Qj(a,0):uj|=c);Mj(a,b)}function lj(a,b){var c=a.stateNode;null!==c&&c.delete(b);b=0;0===b&&(b=a.mode,0===(b&2)?b=1:0===(b&4)?b=99===eg()?1:2:(0===Gj&&(Gj=tj),b=Yc(62914560&~Gj),0===b&&(b=4194304)));c=Hg();a=Kj(a,b);null!==a&&($c(a,b,c),Mj(a,c))}var ck;\nck=function(a,b,c){var d=b.lanes;if(null!==a)if(a.memoizedProps!==b.pendingProps||N.current)ug=!0;else if(0!==(c&d))ug=0!==(a.flags&16384)?!0:!1;else{ug=!1;switch(b.tag){case 3:ri(b);sh();break;case 5:gh(b);break;case 1:Ff(b.type)&&Jf(b);break;case 4:eh(b,b.stateNode.containerInfo);break;case 10:d=b.memoizedProps.value;var e=b.type._context;I(mg,e._currentValue);e._currentValue=d;break;case 13:if(null!==b.memoizedState){if(0!==(c&b.child.childLanes))return ti(a,b,c);I(P,P.current&1);b=hi(a,b,c);return null!==\nb?b.sibling:null}I(P,P.current&1);break;case 19:d=0!==(c&b.childLanes);if(0!==(a.flags&64)){if(d)return Ai(a,b,c);b.flags|=64}e=b.memoizedState;null!==e&&(e.rendering=null,e.tail=null,e.lastEffect=null);I(P,P.current);if(d)break;else return null;case 23:case 24:return b.lanes=0,mi(a,b,c)}return hi(a,b,c)}else ug=!1;b.lanes=0;switch(b.tag){case 2:d=b.type;null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2);a=b.pendingProps;e=Ef(b,M.current);tg(b,c);e=Ch(null,b,d,a,e,c);b.flags|=1;if(\"object\"===\ntypeof e&&null!==e&&\"function\"===typeof e.render&&void 0===e.$$typeof){b.tag=1;b.memoizedState=null;b.updateQueue=null;if(Ff(d)){var f=!0;Jf(b)}else f=!1;b.memoizedState=null!==e.state&&void 0!==e.state?e.state:null;xg(b);var g=d.getDerivedStateFromProps;\"function\"===typeof g&&Gg(b,d,g,a);e.updater=Kg;b.stateNode=e;e._reactInternals=b;Og(b,d,a,c);b=qi(null,b,d,!0,f,c)}else b.tag=0,fi(null,b,e,c),b=b.child;return b;case 16:e=b.elementType;a:{null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2);\na=b.pendingProps;f=e._init;e=f(e._payload);b.type=e;f=b.tag=hk(e);a=lg(e,a);switch(f){case 0:b=li(null,b,e,a,c);break a;case 1:b=pi(null,b,e,a,c);break a;case 11:b=gi(null,b,e,a,c);break a;case 14:b=ii(null,b,e,lg(e.type,a),d,c);break a}throw Error(y(306,e,\"\"));}return b;case 0:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:lg(d,e),li(a,b,d,e,c);case 1:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:lg(d,e),pi(a,b,d,e,c);case 3:ri(b);d=b.updateQueue;if(null===a||null===d)throw Error(y(282));\nd=b.pendingProps;e=b.memoizedState;e=null!==e?e.element:null;yg(a,b);Cg(b,d,null,c);d=b.memoizedState.element;if(d===e)sh(),b=hi(a,b,c);else{e=b.stateNode;if(f=e.hydrate)kh=rf(b.stateNode.containerInfo.firstChild),jh=b,f=lh=!0;if(f){a=e.mutableSourceEagerHydrationData;if(null!=a)for(e=0;e 2 && arguments[2] !== undefined ? arguments[2] : {\n clone: true\n };\n var output = options.clone ? (0, _extends2.default)({}, target) : target;\n\n if (isPlainObject(target) && isPlainObject(source)) {\n Object.keys(source).forEach(function (key) {\n // Avoid prototype pollution\n if (key === '__proto__') {\n return;\n }\n\n if (isPlainObject(source[key]) && key in target) {\n output[key] = deepmerge(target[key], source[key], options);\n } else {\n output[key] = source[key];\n }\n });\n }\n\n return output;\n}", "/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n", "/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\n\nfunction emptyFunction() {}\nfunction emptyFunctionWithReset() {}\nemptyFunctionWithReset.resetWarningCache = emptyFunction;\n\nmodule.exports = function() {\n function shim(props, propName, componentName, location, propFullName, secret) {\n if (secret === ReactPropTypesSecret) {\n // It is still safe when called from React.\n return;\n }\n var err = new Error(\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use PropTypes.checkPropTypes() to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n err.name = 'Invariant Violation';\n throw err;\n };\n shim.isRequired = shim;\n function getShim() {\n return shim;\n };\n // Important!\n // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n var ReactPropTypes = {\n array: shim,\n bigint: shim,\n bool: shim,\n func: shim,\n number: shim,\n object: shim,\n string: shim,\n symbol: shim,\n\n any: shim,\n arrayOf: getShim,\n element: shim,\n elementType: shim,\n instanceOf: getShim,\n node: shim,\n objectOf: getShim,\n oneOf: getShim,\n oneOfType: getShim,\n shape: getShim,\n exact: getShim,\n\n checkPropTypes: emptyFunctionWithReset,\n resetWarningCache: emptyFunction\n };\n\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n", "/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (process.env.NODE_ENV !== 'production') {\n var ReactIs = require('react-is');\n\n // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n var throwOnDirectAccess = true;\n module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = require('./factoryWithThrowingShims')();\n}\n", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _propTypes = _interopRequireDefault(require(\"prop-types\"));\n\nvar _chainPropTypes = _interopRequireDefault(require(\"./chainPropTypes\"));\n\nfunction isClassComponent(elementType) {\n // elementType.prototype?.isReactComponent\n var _elementType$prototyp = elementType.prototype,\n prototype = _elementType$prototyp === void 0 ? {} : _elementType$prototyp;\n return Boolean(prototype.isReactComponent);\n}\n\nfunction acceptingRef(props, propName, componentName, location, propFullName) {\n var element = props[propName];\n var safePropName = propFullName || propName;\n\n if (element == null) {\n return null;\n }\n\n var warningHint;\n var elementType = element.type;\n /**\n * Blacklisting instead of whitelisting\n *\n * Blacklisting will miss some components, such as React.Fragment. Those will at least\n * trigger a warning in React.\n * We can't whitelist because there is no safe way to detect React.forwardRef\n * or class components. \"Safe\" means there's no public API.\n *\n */\n\n if (typeof elementType === 'function' && !isClassComponent(elementType)) {\n warningHint = 'Did you accidentally use a plain function component for an element instead?';\n }\n\n if (warningHint !== undefined) {\n return new Error(\"Invalid \".concat(location, \" `\").concat(safePropName, \"` supplied to `\").concat(componentName, \"`. \") + \"Expected an element that can hold a ref. \".concat(warningHint, \" \") + 'For more information see https://mui.com/r/caveat-with-refs-guide');\n }\n\n return null;\n}\n\nvar elementAcceptingRef = (0, _chainPropTypes.default)(_propTypes.default.element, acceptingRef);\nelementAcceptingRef.isRequired = (0, _chainPropTypes.default)(_propTypes.default.element.isRequired, acceptingRef);\nvar _default = elementAcceptingRef;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nvar _interopRequireWildcard = require(\"@babel/runtime/helpers/interopRequireWildcard\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar PropTypes = _interopRequireWildcard(require(\"prop-types\"));\n\nvar _chainPropTypes = _interopRequireDefault(require(\"./chainPropTypes\"));\n\nfunction isClassComponent(elementType) {\n // elementType.prototype?.isReactComponent\n var _elementType$prototyp = elementType.prototype,\n prototype = _elementType$prototyp === void 0 ? {} : _elementType$prototyp;\n return Boolean(prototype.isReactComponent);\n}\n\nfunction elementTypeAcceptingRef(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n var safePropName = propFullName || propName;\n\n if (propValue == null) {\n return null;\n }\n\n var warningHint;\n /**\n * Blacklisting instead of whitelisting\n *\n * Blacklisting will miss some components, such as React.Fragment. Those will at least\n * trigger a warning in React.\n * We can't whitelist because there is no safe way to detect React.forwardRef\n * or class components. \"Safe\" means there's no public API.\n *\n */\n\n if (typeof propValue === 'function' && !isClassComponent(propValue)) {\n warningHint = 'Did you accidentally provide a plain function component instead?';\n }\n\n if (warningHint !== undefined) {\n return new Error(\"Invalid \".concat(location, \" `\").concat(safePropName, \"` supplied to `\").concat(componentName, \"`. \") + \"Expected an element type that can hold a ref. \".concat(warningHint, \" \") + 'For more information see https://mui.com/r/caveat-with-refs-guide');\n }\n\n return null;\n}\n\nvar _default = (0, _chainPropTypes.default)(PropTypes.elementType, elementTypeAcceptingRef);\n\nexports.default = _default;", "var _typeof = require(\"./typeof.js\")[\"default\"];\nfunction toPrimitive(t, r) {\n if (\"object\" != _typeof(t) || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != _typeof(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nmodule.exports = toPrimitive, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;", "var _typeof = require(\"./typeof.js\")[\"default\"];\nvar toPrimitive = require(\"./toPrimitive.js\");\nfunction toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == _typeof(i) ? i : i + \"\";\n}\nmodule.exports = toPropertyKey, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;", "var toPropertyKey = require(\"./toPropertyKey.js\");\nfunction _defineProperty(e, r, t) {\n return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {\n value: t,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[r] = t, e;\n}\nmodule.exports = _defineProperty, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exactProp;\nexports.specialProperty = void 0;\n\nvar _defineProperty2 = _interopRequireDefault(require(\"@babel/runtime/helpers/defineProperty\"));\n\nvar _extends3 = _interopRequireDefault(require(\"@babel/runtime/helpers/extends\"));\n\n// This module is based on https://github.com/airbnb/prop-types-exact repository.\n// However, in order to reduce the number of dependencies and to remove some extra safe checks\n// the module was forked.\n// Only exported for test purposes.\nvar specialProperty = \"exact-prop: \\u200B\";\nexports.specialProperty = specialProperty;\n\nfunction exactProp(propTypes) {\n if (process.env.NODE_ENV === 'production') {\n return propTypes;\n }\n\n return (0, _extends3.default)({}, propTypes, (0, _defineProperty2.default)({}, specialProperty, function (props) {\n var unsupportedProps = Object.keys(props).filter(function (prop) {\n return !propTypes.hasOwnProperty(prop);\n });\n\n if (unsupportedProps.length > 0) {\n return new Error(\"The following props are not supported: \".concat(unsupportedProps.map(function (prop) {\n return \"`\".concat(prop, \"`\");\n }).join(', '), \". Please remove them.\"));\n }\n\n return null;\n }));\n}", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = formatMuiErrorMessage;\n\n/**\n * WARNING: Don't import this directly.\n * Use `MuiError` from `@material-ui/utils/macros/MuiError.macro` instead.\n * @param {number} code\n */\nfunction formatMuiErrorMessage(code) {\n // Apply babel-plugin-transform-template-literals in loose mode\n // loose mode is safe iff we're concatenating primitives\n // see https://babeljs.io/docs/en/babel-plugin-transform-template-literals#loose\n\n /* eslint-disable prefer-template */\n var url = 'https://mui.com/production-error/?code=' + code;\n\n for (var i = 1; i < arguments.length; i += 1) {\n // rest params over-transpile for this case\n // eslint-disable-next-line prefer-rest-params\n url += '&args[]=' + encodeURIComponent(arguments[i]);\n }\n\n return 'Minified Material-UI error #' + code + '; visit ' + url + ' for the full message.';\n /* eslint-enable prefer-template */\n}", "/** @license React v17.0.2\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var b=60103,c=60106,d=60107,e=60108,f=60114,g=60109,h=60110,k=60112,l=60113,m=60120,n=60115,p=60116,q=60121,r=60122,u=60117,v=60129,w=60131;\nif(\"function\"===typeof Symbol&&Symbol.for){var x=Symbol.for;b=x(\"react.element\");c=x(\"react.portal\");d=x(\"react.fragment\");e=x(\"react.strict_mode\");f=x(\"react.profiler\");g=x(\"react.provider\");h=x(\"react.context\");k=x(\"react.forward_ref\");l=x(\"react.suspense\");m=x(\"react.suspense_list\");n=x(\"react.memo\");p=x(\"react.lazy\");q=x(\"react.block\");r=x(\"react.server.block\");u=x(\"react.fundamental\");v=x(\"react.debug_trace_mode\");w=x(\"react.legacy_hidden\")}\nfunction y(a){if(\"object\"===typeof a&&null!==a){var t=a.$$typeof;switch(t){case b:switch(a=a.type,a){case d:case f:case e:case l:case m:return a;default:switch(a=a&&a.$$typeof,a){case h:case k:case p:case n:case g:return a;default:return t}}case c:return t}}}var z=g,A=b,B=k,C=d,D=p,E=n,F=c,G=f,H=e,I=l;exports.ContextConsumer=h;exports.ContextProvider=z;exports.Element=A;exports.ForwardRef=B;exports.Fragment=C;exports.Lazy=D;exports.Memo=E;exports.Portal=F;exports.Profiler=G;exports.StrictMode=H;\nexports.Suspense=I;exports.isAsyncMode=function(){return!1};exports.isConcurrentMode=function(){return!1};exports.isContextConsumer=function(a){return y(a)===h};exports.isContextProvider=function(a){return y(a)===g};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return y(a)===k};exports.isFragment=function(a){return y(a)===d};exports.isLazy=function(a){return y(a)===p};exports.isMemo=function(a){return y(a)===n};\nexports.isPortal=function(a){return y(a)===c};exports.isProfiler=function(a){return y(a)===f};exports.isStrictMode=function(a){return y(a)===e};exports.isSuspense=function(a){return y(a)===l};exports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===d||a===f||a===v||a===e||a===l||a===m||a===w||\"object\"===typeof a&&null!==a&&(a.$$typeof===p||a.$$typeof===n||a.$$typeof===g||a.$$typeof===h||a.$$typeof===k||a.$$typeof===u||a.$$typeof===q||a[0]===r)?!0:!1};\nexports.typeOf=y;\n", "'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.getFunctionName = getFunctionName;\nexports.default = getDisplayName;\n\nvar _typeof2 = _interopRequireDefault(require(\"@babel/runtime/helpers/typeof\"));\n\nvar _reactIs = require(\"react-is\");\n\n// Simplified polyfill for IE 11 support\n// https://github.com/JamesMGreene/Function.name/blob/58b314d4a983110c3682f1228f845d39ccca1817/Function.name.js#L3\nvar fnNameMatchRegex = /^\\s*function(?:\\s|\\s*\\/\\*.*\\*\\/\\s*)+([^(\\s/]*)\\s*/;\n\nfunction getFunctionName(fn) {\n var match = \"\".concat(fn).match(fnNameMatchRegex);\n var name = match && match[1];\n return name || '';\n}\n/**\n * @param {function} Component\n * @param {string} fallback\n * @returns {string | undefined}\n */\n\n\nfunction getFunctionComponentName(Component) {\n var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n return Component.displayName || Component.name || getFunctionName(Component) || fallback;\n}\n\nfunction getWrappedName(outerType, innerType, wrapperName) {\n var functionName = getFunctionComponentName(innerType);\n return outerType.displayName || (functionName !== '' ? \"\".concat(wrapperName, \"(\").concat(functionName, \")\") : wrapperName);\n}\n/**\n * cherry-pick from\n * https://github.com/facebook/react/blob/769b1f270e1251d9dbdce0fcbd9e92e502d059b8/packages/shared/getComponentName.js\n * originally forked from recompose/getDisplayName with added IE 11 support\n *\n * @param {React.ReactType} Component\n * @returns {string | undefined}\n */\n\n\nfunction getDisplayName(Component) {\n if (Component == null) {\n return undefined;\n }\n\n if (typeof Component === 'string') {\n return Component;\n }\n\n if (typeof Component === 'function') {\n return getFunctionComponentName(Component, 'Component');\n }\n\n if ((0, _typeof2.default)(Component) === 'object') {\n switch (Component.$$typeof) {\n case _reactIs.ForwardRef:\n return getWrappedName(Component, Component.render, 'ForwardRef');\n\n case _reactIs.Memo:\n return getWrappedName(Component, Component.type, 'memo');\n\n default:\n return undefined;\n }\n }\n\n return undefined;\n}", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = HTMLElementType;\n\nfunction HTMLElementType(props, propName, componentName, location, propFullName) {\n if (process.env.NODE_ENV === 'production') {\n return null;\n }\n\n var propValue = props[propName];\n var safePropName = propFullName || propName;\n\n if (propValue == null) {\n return null;\n }\n\n if (propValue && propValue.nodeType !== 1) {\n return new Error(\"Invalid \".concat(location, \" `\").concat(safePropName, \"` supplied to `\").concat(componentName, \"`. \") + \"Expected an HTMLElement.\");\n }\n\n return null;\n}", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\n/* eslint-disable */\n// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nvar _default = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();\n\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _propTypes = _interopRequireDefault(require(\"prop-types\"));\n\nvar refType = _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]);\n\nvar _default = refType;\nexports.default = _default;", "/** @license Material-UI v4.11.3\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"chainPropTypes\", {\n enumerable: true,\n get: function get() {\n return _chainPropTypes.default;\n }\n});\nObject.defineProperty(exports, \"deepmerge\", {\n enumerable: true,\n get: function get() {\n return _deepmerge.default;\n }\n});\nObject.defineProperty(exports, \"elementAcceptingRef\", {\n enumerable: true,\n get: function get() {\n return _elementAcceptingRef.default;\n }\n});\nObject.defineProperty(exports, \"elementTypeAcceptingRef\", {\n enumerable: true,\n get: function get() {\n return _elementTypeAcceptingRef.default;\n }\n});\nObject.defineProperty(exports, \"exactProp\", {\n enumerable: true,\n get: function get() {\n return _exactProp.default;\n }\n});\nObject.defineProperty(exports, \"formatMuiErrorMessage\", {\n enumerable: true,\n get: function get() {\n return _formatMuiErrorMessage.default;\n }\n});\nObject.defineProperty(exports, \"getDisplayName\", {\n enumerable: true,\n get: function get() {\n return _getDisplayName.default;\n }\n});\nObject.defineProperty(exports, \"HTMLElementType\", {\n enumerable: true,\n get: function get() {\n return _HTMLElementType.default;\n }\n});\nObject.defineProperty(exports, \"ponyfillGlobal\", {\n enumerable: true,\n get: function get() {\n return _ponyfillGlobal.default;\n }\n});\nObject.defineProperty(exports, \"refType\", {\n enumerable: true,\n get: function get() {\n return _refType.default;\n }\n});\n\nvar _chainPropTypes = _interopRequireDefault(require(\"./chainPropTypes\"));\n\nvar _deepmerge = _interopRequireDefault(require(\"./deepmerge\"));\n\nvar _elementAcceptingRef = _interopRequireDefault(require(\"./elementAcceptingRef\"));\n\nvar _elementTypeAcceptingRef = _interopRequireDefault(require(\"./elementTypeAcceptingRef\"));\n\nvar _exactProp = _interopRequireDefault(require(\"./exactProp\"));\n\nvar _formatMuiErrorMessage = _interopRequireDefault(require(\"./formatMuiErrorMessage\"));\n\nvar _getDisplayName = _interopRequireDefault(require(\"./getDisplayName\"));\n\nvar _HTMLElementType = _interopRequireDefault(require(\"./HTMLElementType\"));\n\nvar _ponyfillGlobal = _interopRequireDefault(require(\"./ponyfillGlobal\"));\n\nvar _refType = _interopRequireDefault(require(\"./refType\"));", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.hexToRgb = hexToRgb;\nexports.rgbToHex = rgbToHex;\nexports.hslToRgb = hslToRgb;\nexports.decomposeColor = decomposeColor;\nexports.recomposeColor = recomposeColor;\nexports.getContrastRatio = getContrastRatio;\nexports.getLuminance = getLuminance;\nexports.emphasize = emphasize;\nexports.fade = fade;\nexports.alpha = alpha;\nexports.darken = darken;\nexports.lighten = lighten;\n\nvar _utils = require(\"@material-ui/utils\");\n\n/* eslint-disable no-use-before-define */\n\n/**\n * Returns a number whose value is limited to the given range.\n *\n * @param {number} value The value to be clamped\n * @param {number} min The lower boundary of the output range\n * @param {number} max The upper boundary of the output range\n * @returns {number} A number in the range [min, max]\n */\nfunction clamp(value) {\n var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n\n if (process.env.NODE_ENV !== 'production') {\n if (value < min || value > max) {\n console.error(\"Material-UI: The value provided \".concat(value, \" is out of range [\").concat(min, \", \").concat(max, \"].\"));\n }\n }\n\n return Math.min(Math.max(min, value), max);\n}\n/**\n * Converts a color from CSS hex format to CSS rgb format.\n *\n * @param {string} color - Hex color, i.e. #nnn or #nnnnnn\n * @returns {string} A CSS rgb color string\n */\n\n\nfunction hexToRgb(color) {\n color = color.substr(1);\n var re = new RegExp(\".{1,\".concat(color.length >= 6 ? 2 : 1, \"}\"), 'g');\n var colors = color.match(re);\n\n if (colors && colors[0].length === 1) {\n colors = colors.map(function (n) {\n return n + n;\n });\n }\n\n return colors ? \"rgb\".concat(colors.length === 4 ? 'a' : '', \"(\").concat(colors.map(function (n, index) {\n return index < 3 ? parseInt(n, 16) : Math.round(parseInt(n, 16) / 255 * 1000) / 1000;\n }).join(', '), \")\") : '';\n}\n\nfunction intToHex(int) {\n var hex = int.toString(16);\n return hex.length === 1 ? \"0\".concat(hex) : hex;\n}\n/**\n * Converts a color from CSS rgb format to CSS hex format.\n *\n * @param {string} color - RGB color, i.e. rgb(n, n, n)\n * @returns {string} A CSS rgb color string, i.e. #nnnnnn\n */\n\n\nfunction rgbToHex(color) {\n // Idempotent\n if (color.indexOf('#') === 0) {\n return color;\n }\n\n var _decomposeColor = decomposeColor(color),\n values = _decomposeColor.values;\n\n return \"#\".concat(values.map(function (n) {\n return intToHex(n);\n }).join(''));\n}\n/**\n * Converts a color from hsl format to rgb format.\n *\n * @param {string} color - HSL color values\n * @returns {string} rgb color values\n */\n\n\nfunction hslToRgb(color) {\n color = decomposeColor(color);\n var _color = color,\n values = _color.values;\n var h = values[0];\n var s = values[1] / 100;\n var l = values[2] / 100;\n var a = s * Math.min(l, 1 - l);\n\n var f = function f(n) {\n var k = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (n + h / 30) % 12;\n return l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);\n };\n\n var type = 'rgb';\n var rgb = [Math.round(f(0) * 255), Math.round(f(8) * 255), Math.round(f(4) * 255)];\n\n if (color.type === 'hsla') {\n type += 'a';\n rgb.push(values[3]);\n }\n\n return recomposeColor({\n type: type,\n values: rgb\n });\n}\n/**\n * Returns an object with the type and values of a color.\n *\n * Note: Does not support rgb % values.\n *\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()\n * @returns {object} - A MUI color object: {type: string, values: number[]}\n */\n\n\nfunction decomposeColor(color) {\n // Idempotent\n if (color.type) {\n return color;\n }\n\n if (color.charAt(0) === '#') {\n return decomposeColor(hexToRgb(color));\n }\n\n var marker = color.indexOf('(');\n var type = color.substring(0, marker);\n\n if (['rgb', 'rgba', 'hsl', 'hsla'].indexOf(type) === -1) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? \"Material-UI: Unsupported `\".concat(color, \"` color.\\nWe support the following formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla().\") : (0, _utils.formatMuiErrorMessage)(3, color));\n }\n\n var values = color.substring(marker + 1, color.length - 1).split(',');\n values = values.map(function (value) {\n return parseFloat(value);\n });\n return {\n type: type,\n values: values\n };\n}\n/**\n * Converts a color object with type and values to a string.\n *\n * @param {object} color - Decomposed color\n * @param {string} color.type - One of: 'rgb', 'rgba', 'hsl', 'hsla'\n * @param {array} color.values - [n,n,n] or [n,n,n,n]\n * @returns {string} A CSS color string\n */\n\n\nfunction recomposeColor(color) {\n var type = color.type;\n var values = color.values;\n\n if (type.indexOf('rgb') !== -1) {\n // Only convert the first 3 values to int (i.e. not alpha)\n values = values.map(function (n, i) {\n return i < 3 ? parseInt(n, 10) : n;\n });\n } else if (type.indexOf('hsl') !== -1) {\n values[1] = \"\".concat(values[1], \"%\");\n values[2] = \"\".concat(values[2], \"%\");\n }\n\n return \"\".concat(type, \"(\").concat(values.join(', '), \")\");\n}\n/**\n * Calculates the contrast ratio between two colors.\n *\n * Formula: https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests\n *\n * @param {string} foreground - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()\n * @param {string} background - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()\n * @returns {number} A contrast ratio value in the range 0 - 21.\n */\n\n\nfunction getContrastRatio(foreground, background) {\n var lumA = getLuminance(foreground);\n var lumB = getLuminance(background);\n return (Math.max(lumA, lumB) + 0.05) / (Math.min(lumA, lumB) + 0.05);\n}\n/**\n * The relative brightness of any point in a color space,\n * normalized to 0 for darkest black and 1 for lightest white.\n *\n * Formula: https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests\n *\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()\n * @returns {number} The relative brightness of the color in the range 0 - 1\n */\n\n\nfunction getLuminance(color) {\n color = decomposeColor(color);\n var rgb = color.type === 'hsl' ? decomposeColor(hslToRgb(color)).values : color.values;\n rgb = rgb.map(function (val) {\n val /= 255; // normalized\n\n return val <= 0.03928 ? val / 12.92 : Math.pow((val + 0.055) / 1.055, 2.4);\n }); // Truncate at 3 digits\n\n return Number((0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]).toFixed(3));\n}\n/**\n * Darken or lighten a color, depending on its luminance.\n * Light colors are darkened, dark colors are lightened.\n *\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()\n * @param {number} coefficient=0.15 - multiplier in the range 0 - 1\n * @returns {string} A CSS color string. Hex input values are returned as rgb\n */\n\n\nfunction emphasize(color) {\n var coefficient = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.15;\n return getLuminance(color) > 0.5 ? darken(color, coefficient) : lighten(color, coefficient);\n}\n\nvar warnedOnce = false;\n/**\n * Set the absolute transparency of a color.\n * Any existing alpha values are overwritten.\n *\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()\n * @param {number} value - value to set the alpha channel to in the range 0 -1\n * @returns {string} A CSS color string. Hex input values are returned as rgb\n *\n * @deprecated\n * Use `import { alpha } from '@material-ui/core/styles'` instead.\n */\n\nfunction fade(color, value) {\n if (process.env.NODE_ENV !== 'production') {\n if (!warnedOnce) {\n warnedOnce = true;\n console.error(['Material-UI: The `fade` color utility was renamed to `alpha` to better describe its functionality.', '', \"You should use `import { alpha } from '@material-ui/core/styles'`\"].join('\\n'));\n }\n }\n\n return alpha(color, value);\n}\n/**\n * Set the absolute transparency of a color.\n * Any existing alpha value is overwritten.\n *\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()\n * @param {number} value - value to set the alpha channel to in the range 0-1\n * @returns {string} A CSS color string. Hex input values are returned as rgb\n */\n\n\nfunction alpha(color, value) {\n color = decomposeColor(color);\n value = clamp(value);\n\n if (color.type === 'rgb' || color.type === 'hsl') {\n color.type += 'a';\n }\n\n color.values[3] = value;\n return recomposeColor(color);\n}\n/**\n * Darkens a color.\n *\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()\n * @param {number} coefficient - multiplier in the range 0 - 1\n * @returns {string} A CSS color string. Hex input values are returned as rgb\n */\n\n\nfunction darken(color, coefficient) {\n color = decomposeColor(color);\n coefficient = clamp(coefficient);\n\n if (color.type.indexOf('hsl') !== -1) {\n color.values[2] *= 1 - coefficient;\n } else if (color.type.indexOf('rgb') !== -1) {\n for (var i = 0; i < 3; i += 1) {\n color.values[i] *= 1 - coefficient;\n }\n }\n\n return recomposeColor(color);\n}\n/**\n * Lightens a color.\n *\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()\n * @param {number} coefficient - multiplier in the range 0 - 1\n * @returns {string} A CSS color string. Hex input values are returned as rgb\n */\n\n\nfunction lighten(color, coefficient) {\n color = decomposeColor(color);\n coefficient = clamp(coefficient);\n\n if (color.type.indexOf('hsl') !== -1) {\n color.values[2] += (100 - color.values[2]) * coefficient;\n } else if (color.type.indexOf('rgb') !== -1) {\n for (var i = 0; i < 3; i += 1) {\n color.values[i] += (255 - color.values[i]) * coefficient;\n }\n }\n\n return recomposeColor(color);\n}", "function _objectWithoutPropertiesLoose(r, e) {\n if (null == r) return {};\n var t = {};\n for (var n in r) if ({}.hasOwnProperty.call(r, n)) {\n if (e.includes(n)) continue;\n t[n] = r[n];\n }\n return t;\n}\nmodule.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;", "var objectWithoutPropertiesLoose = require(\"./objectWithoutPropertiesLoose.js\");\nfunction _objectWithoutProperties(e, t) {\n if (null == e) return {};\n var o,\n r,\n i = objectWithoutPropertiesLoose(e, t);\n if (Object.getOwnPropertySymbols) {\n var s = Object.getOwnPropertySymbols(e);\n for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);\n }\n return i;\n}\nmodule.exports = _objectWithoutProperties, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = createBreakpoints;\nexports.keys = void 0;\n\nvar _extends2 = _interopRequireDefault(require(\"@babel/runtime/helpers/extends\"));\n\nvar _objectWithoutProperties2 = _interopRequireDefault(require(\"@babel/runtime/helpers/objectWithoutProperties\"));\n\n// Sorted ASC by size. That's important.\n// It can't be configured as it's used statically for propTypes.\nvar keys = ['xs', 'sm', 'md', 'lg', 'xl']; // Keep in mind that @media is inclusive by the CSS specification.\n\nexports.keys = keys;\n\nfunction createBreakpoints(breakpoints) {\n var _breakpoints$values = breakpoints.values,\n values = _breakpoints$values === void 0 ? {\n xs: 0,\n sm: 600,\n md: 960,\n lg: 1280,\n xl: 1920\n } : _breakpoints$values,\n _breakpoints$unit = breakpoints.unit,\n unit = _breakpoints$unit === void 0 ? 'px' : _breakpoints$unit,\n _breakpoints$step = breakpoints.step,\n step = _breakpoints$step === void 0 ? 5 : _breakpoints$step,\n other = (0, _objectWithoutProperties2.default)(breakpoints, [\"values\", \"unit\", \"step\"]);\n\n function up(key) {\n var value = typeof values[key] === 'number' ? values[key] : key;\n return \"@media (min-width:\".concat(value).concat(unit, \")\");\n }\n\n function down(key) {\n var endIndex = keys.indexOf(key) + 1;\n var upperbound = values[keys[endIndex]];\n\n if (endIndex === keys.length) {\n // xl down applies to all sizes\n return up('xs');\n }\n\n var value = typeof upperbound === 'number' && endIndex > 0 ? upperbound : key;\n return \"@media (max-width:\".concat(value - step / 100).concat(unit, \")\");\n }\n\n function between(start, end) {\n var endIndex = keys.indexOf(end);\n\n if (endIndex === keys.length - 1) {\n return up(start);\n }\n\n return \"@media (min-width:\".concat(typeof values[start] === 'number' ? values[start] : start).concat(unit, \") and \") + \"(max-width:\".concat((endIndex !== -1 && typeof values[keys[endIndex + 1]] === 'number' ? values[keys[endIndex + 1]] : end) - step / 100).concat(unit, \")\");\n }\n\n function only(key) {\n return between(key, key);\n }\n\n var warnedOnce = false;\n\n function width(key) {\n if (process.env.NODE_ENV !== 'production') {\n if (!warnedOnce) {\n warnedOnce = true;\n console.warn([\"Material-UI: The `theme.breakpoints.width` utility is deprecated because it's redundant.\", 'Use the `theme.breakpoints.values` instead.'].join('\\n'));\n }\n }\n\n return values[key];\n }\n\n return (0, _extends2.default)({\n keys: keys,\n values: values,\n up: up,\n down: down,\n between: between,\n only: only,\n width: width\n }, other);\n}", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = createMixins;\n\nvar _defineProperty2 = _interopRequireDefault(require(\"@babel/runtime/helpers/defineProperty\"));\n\nvar _extends3 = _interopRequireDefault(require(\"@babel/runtime/helpers/extends\"));\n\nfunction createMixins(breakpoints, spacing, mixins) {\n var _toolbar;\n\n return (0, _extends3.default)({\n gutters: function gutters() {\n var styles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n console.warn(['Material-UI: theme.mixins.gutters() is deprecated.', 'You can use the source of the mixin directly:', \"\\n paddingLeft: theme.spacing(2),\\n paddingRight: theme.spacing(2),\\n [theme.breakpoints.up('sm')]: {\\n paddingLeft: theme.spacing(3),\\n paddingRight: theme.spacing(3),\\n },\\n \"].join('\\n'));\n return (0, _extends3.default)({\n paddingLeft: spacing(2),\n paddingRight: spacing(2)\n }, styles, (0, _defineProperty2.default)({}, breakpoints.up('sm'), (0, _extends3.default)({\n paddingLeft: spacing(3),\n paddingRight: spacing(3)\n }, styles[breakpoints.up('sm')])));\n },\n toolbar: (_toolbar = {\n minHeight: 56\n }, (0, _defineProperty2.default)(_toolbar, \"\".concat(breakpoints.up('xs'), \" and (orientation: landscape)\"), {\n minHeight: 48\n }), (0, _defineProperty2.default)(_toolbar, breakpoints.up('sm'), {\n minHeight: 64\n }), _toolbar)\n }, mixins);\n}", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar common = {\n black: '#000',\n white: '#fff'\n};\nvar _default = common;\nexports.default = _default;", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar grey = {\n 50: '#fafafa',\n 100: '#f5f5f5',\n 200: '#eeeeee',\n 300: '#e0e0e0',\n 400: '#bdbdbd',\n 500: '#9e9e9e',\n 600: '#757575',\n 700: '#616161',\n 800: '#424242',\n 900: '#212121',\n A100: '#d5d5d5',\n A200: '#aaaaaa',\n A400: '#303030',\n A700: '#616161'\n};\nvar _default = grey;\nexports.default = _default;", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar indigo = {\n 50: '#e8eaf6',\n 100: '#c5cae9',\n 200: '#9fa8da',\n 300: '#7986cb',\n 400: '#5c6bc0',\n 500: '#3f51b5',\n 600: '#3949ab',\n 700: '#303f9f',\n 800: '#283593',\n 900: '#1a237e',\n A100: '#8c9eff',\n A200: '#536dfe',\n A400: '#3d5afe',\n A700: '#304ffe'\n};\nvar _default = indigo;\nexports.default = _default;", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar pink = {\n 50: '#fce4ec',\n 100: '#f8bbd0',\n 200: '#f48fb1',\n 300: '#f06292',\n 400: '#ec407a',\n 500: '#e91e63',\n 600: '#d81b60',\n 700: '#c2185b',\n 800: '#ad1457',\n 900: '#880e4f',\n A100: '#ff80ab',\n A200: '#ff4081',\n A400: '#f50057',\n A700: '#c51162'\n};\nvar _default = pink;\nexports.default = _default;", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar red = {\n 50: '#ffebee',\n 100: '#ffcdd2',\n 200: '#ef9a9a',\n 300: '#e57373',\n 400: '#ef5350',\n 500: '#f44336',\n 600: '#e53935',\n 700: '#d32f2f',\n 800: '#c62828',\n 900: '#b71c1c',\n A100: '#ff8a80',\n A200: '#ff5252',\n A400: '#ff1744',\n A700: '#d50000'\n};\nvar _default = red;\nexports.default = _default;", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar orange = {\n 50: '#fff3e0',\n 100: '#ffe0b2',\n 200: '#ffcc80',\n 300: '#ffb74d',\n 400: '#ffa726',\n 500: '#ff9800',\n 600: '#fb8c00',\n 700: '#f57c00',\n 800: '#ef6c00',\n 900: '#e65100',\n A100: '#ffd180',\n A200: '#ffab40',\n A400: '#ff9100',\n A700: '#ff6d00'\n};\nvar _default = orange;\nexports.default = _default;", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar blue = {\n 50: '#e3f2fd',\n 100: '#bbdefb',\n 200: '#90caf9',\n 300: '#64b5f6',\n 400: '#42a5f5',\n 500: '#2196f3',\n 600: '#1e88e5',\n 700: '#1976d2',\n 800: '#1565c0',\n 900: '#0d47a1',\n A100: '#82b1ff',\n A200: '#448aff',\n A400: '#2979ff',\n A700: '#2962ff'\n};\nvar _default = blue;\nexports.default = _default;", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar green = {\n 50: '#e8f5e9',\n 100: '#c8e6c9',\n 200: '#a5d6a7',\n 300: '#81c784',\n 400: '#66bb6a',\n 500: '#4caf50',\n 600: '#43a047',\n 700: '#388e3c',\n 800: '#2e7d32',\n 900: '#1b5e20',\n A100: '#b9f6ca',\n A200: '#69f0ae',\n A400: '#00e676',\n A700: '#00c853'\n};\nvar _default = green;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = createPalette;\nexports.dark = exports.light = void 0;\n\nvar _extends2 = _interopRequireDefault(require(\"@babel/runtime/helpers/extends\"));\n\nvar _objectWithoutProperties2 = _interopRequireDefault(require(\"@babel/runtime/helpers/objectWithoutProperties\"));\n\nvar _utils = require(\"@material-ui/utils\");\n\nvar _common = _interopRequireDefault(require(\"../colors/common\"));\n\nvar _grey = _interopRequireDefault(require(\"../colors/grey\"));\n\nvar _indigo = _interopRequireDefault(require(\"../colors/indigo\"));\n\nvar _pink = _interopRequireDefault(require(\"../colors/pink\"));\n\nvar _red = _interopRequireDefault(require(\"../colors/red\"));\n\nvar _orange = _interopRequireDefault(require(\"../colors/orange\"));\n\nvar _blue = _interopRequireDefault(require(\"../colors/blue\"));\n\nvar _green = _interopRequireDefault(require(\"../colors/green\"));\n\nvar _colorManipulator = require(\"./colorManipulator\");\n\nvar light = {\n // The colors used to style the text.\n text: {\n // The most important text.\n primary: 'rgba(0, 0, 0, 0.87)',\n // Secondary text.\n secondary: 'rgba(0, 0, 0, 0.54)',\n // Disabled text have even lower visual prominence.\n disabled: 'rgba(0, 0, 0, 0.38)',\n // Text hints.\n hint: 'rgba(0, 0, 0, 0.38)'\n },\n // The color used to divide different elements.\n divider: 'rgba(0, 0, 0, 0.12)',\n // The background colors used to style the surfaces.\n // Consistency between these values is important.\n background: {\n paper: _common.default.white,\n default: _grey.default[50]\n },\n // The colors used to style the action elements.\n action: {\n // The color of an active action like an icon button.\n active: 'rgba(0, 0, 0, 0.54)',\n // The color of an hovered action.\n hover: 'rgba(0, 0, 0, 0.04)',\n hoverOpacity: 0.04,\n // The color of a selected action.\n selected: 'rgba(0, 0, 0, 0.08)',\n selectedOpacity: 0.08,\n // The color of a disabled action.\n disabled: 'rgba(0, 0, 0, 0.26)',\n // The background color of a disabled action.\n disabledBackground: 'rgba(0, 0, 0, 0.12)',\n disabledOpacity: 0.38,\n focus: 'rgba(0, 0, 0, 0.12)',\n focusOpacity: 0.12,\n activatedOpacity: 0.12\n }\n};\nexports.light = light;\nvar dark = {\n text: {\n primary: _common.default.white,\n secondary: 'rgba(255, 255, 255, 0.7)',\n disabled: 'rgba(255, 255, 255, 0.5)',\n hint: 'rgba(255, 255, 255, 0.5)',\n icon: 'rgba(255, 255, 255, 0.5)'\n },\n divider: 'rgba(255, 255, 255, 0.12)',\n background: {\n paper: _grey.default[800],\n default: '#303030'\n },\n action: {\n active: _common.default.white,\n hover: 'rgba(255, 255, 255, 0.08)',\n hoverOpacity: 0.08,\n selected: 'rgba(255, 255, 255, 0.16)',\n selectedOpacity: 0.16,\n disabled: 'rgba(255, 255, 255, 0.3)',\n disabledBackground: 'rgba(255, 255, 255, 0.12)',\n disabledOpacity: 0.38,\n focus: 'rgba(255, 255, 255, 0.12)',\n focusOpacity: 0.12,\n activatedOpacity: 0.24\n }\n};\nexports.dark = dark;\n\nfunction addLightOrDark(intent, direction, shade, tonalOffset) {\n var tonalOffsetLight = tonalOffset.light || tonalOffset;\n var tonalOffsetDark = tonalOffset.dark || tonalOffset * 1.5;\n\n if (!intent[direction]) {\n if (intent.hasOwnProperty(shade)) {\n intent[direction] = intent[shade];\n } else if (direction === 'light') {\n intent.light = (0, _colorManipulator.lighten)(intent.main, tonalOffsetLight);\n } else if (direction === 'dark') {\n intent.dark = (0, _colorManipulator.darken)(intent.main, tonalOffsetDark);\n }\n }\n}\n\nfunction createPalette(palette) {\n var _palette$primary = palette.primary,\n primary = _palette$primary === void 0 ? {\n light: _indigo.default[300],\n main: _indigo.default[500],\n dark: _indigo.default[700]\n } : _palette$primary,\n _palette$secondary = palette.secondary,\n secondary = _palette$secondary === void 0 ? {\n light: _pink.default.A200,\n main: _pink.default.A400,\n dark: _pink.default.A700\n } : _palette$secondary,\n _palette$error = palette.error,\n error = _palette$error === void 0 ? {\n light: _red.default[300],\n main: _red.default[500],\n dark: _red.default[700]\n } : _palette$error,\n _palette$warning = palette.warning,\n warning = _palette$warning === void 0 ? {\n light: _orange.default[300],\n main: _orange.default[500],\n dark: _orange.default[700]\n } : _palette$warning,\n _palette$info = palette.info,\n info = _palette$info === void 0 ? {\n light: _blue.default[300],\n main: _blue.default[500],\n dark: _blue.default[700]\n } : _palette$info,\n _palette$success = palette.success,\n success = _palette$success === void 0 ? {\n light: _green.default[300],\n main: _green.default[500],\n dark: _green.default[700]\n } : _palette$success,\n _palette$type = palette.type,\n type = _palette$type === void 0 ? 'light' : _palette$type,\n _palette$contrastThre = palette.contrastThreshold,\n contrastThreshold = _palette$contrastThre === void 0 ? 3 : _palette$contrastThre,\n _palette$tonalOffset = palette.tonalOffset,\n tonalOffset = _palette$tonalOffset === void 0 ? 0.2 : _palette$tonalOffset,\n other = (0, _objectWithoutProperties2.default)(palette, [\"primary\", \"secondary\", \"error\", \"warning\", \"info\", \"success\", \"type\", \"contrastThreshold\", \"tonalOffset\"]); // Use the same logic as\n // Bootstrap: https://github.com/twbs/bootstrap/blob/1d6e3710dd447de1a200f29e8fa521f8a0908f70/scss/_functions.scss#L59\n // and material-components-web https://github.com/material-components/material-components-web/blob/ac46b8863c4dab9fc22c4c662dc6bd1b65dd652f/packages/mdc-theme/_functions.scss#L54\n\n function getContrastText(background) {\n var contrastText = (0, _colorManipulator.getContrastRatio)(background, dark.text.primary) >= contrastThreshold ? dark.text.primary : light.text.primary;\n\n if (process.env.NODE_ENV !== 'production') {\n var contrast = (0, _colorManipulator.getContrastRatio)(background, contrastText);\n\n if (contrast < 3) {\n console.error([\"Material-UI: The contrast ratio of \".concat(contrast, \":1 for \").concat(contrastText, \" on \").concat(background), 'falls below the WCAG recommended absolute minimum contrast ratio of 3:1.', 'https://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast-contrast'].join('\\n'));\n }\n }\n\n return contrastText;\n }\n\n var augmentColor = function augmentColor(color) {\n var mainShade = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;\n var lightShade = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 300;\n var darkShade = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 700;\n color = (0, _extends2.default)({}, color);\n\n if (!color.main && color[mainShade]) {\n color.main = color[mainShade];\n }\n\n if (!color.main) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? \"Material-UI: The color provided to augmentColor(color) is invalid.\\nThe color object needs to have a `main` property or a `\".concat(mainShade, \"` property.\") : (0, _utils.formatMuiErrorMessage)(4, mainShade));\n }\n\n if (typeof color.main !== 'string') {\n throw new Error(process.env.NODE_ENV !== \"production\" ? \"Material-UI: The color provided to augmentColor(color) is invalid.\\n`color.main` should be a string, but `\".concat(JSON.stringify(color.main), \"` was provided instead.\\n\\nDid you intend to use one of the following approaches?\\n\\nimport {\\xA0green } from \\\"@material-ui/core/colors\\\";\\n\\nconst theme1 = createTheme({ palette: {\\n primary: green,\\n} });\\n\\nconst theme2 = createTheme({ palette: {\\n primary: { main: green[500] },\\n} });\") : _formatMuiErrorMessage(5, JSON.stringify(color.main)));\n }\n\n addLightOrDark(color, 'light', lightShade, tonalOffset);\n addLightOrDark(color, 'dark', darkShade, tonalOffset);\n\n if (!color.contrastText) {\n color.contrastText = getContrastText(color.main);\n }\n\n return color;\n };\n\n var types = {\n dark: dark,\n light: light\n };\n\n if (process.env.NODE_ENV !== 'production') {\n if (!types[type]) {\n console.error(\"Material-UI: The palette type `\".concat(type, \"` is not supported.\"));\n }\n }\n\n var paletteOutput = (0, _utils.deepmerge)((0, _extends2.default)({\n // A collection of common colors.\n common: _common.default,\n // The palette type, can be light or dark.\n type: type,\n // The colors used to represent primary interface elements for a user.\n primary: augmentColor(primary),\n // The colors used to represent secondary interface elements for a user.\n secondary: augmentColor(secondary, 'A400', 'A200', 'A700'),\n // The colors used to represent interface elements that the user should be made aware of.\n error: augmentColor(error),\n // The colors used to represent potentially dangerous actions or important messages.\n warning: augmentColor(warning),\n // The colors used to present information to the user that is neutral and not necessarily important.\n info: augmentColor(info),\n // The colors used to indicate the successful completion of an action that user triggered.\n success: augmentColor(success),\n // The grey colors.\n grey: _grey.default,\n // Used by `getContrastText()` to maximize the contrast between\n // the background and the text.\n contrastThreshold: contrastThreshold,\n // Takes a background color and returns the text color that maximizes the contrast.\n getContrastText: getContrastText,\n // Generate a rich color object.\n augmentColor: augmentColor,\n // Used by the functions below to shift a color's luminance by approximately\n // two indexes within its tonal palette.\n // E.g., shift from Red 500 to Red 300 or Red 700.\n tonalOffset: tonalOffset\n }, types[type]), other);\n return paletteOutput;\n}", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = createTypography;\n\nvar _extends2 = _interopRequireDefault(require(\"@babel/runtime/helpers/extends\"));\n\nvar _objectWithoutProperties2 = _interopRequireDefault(require(\"@babel/runtime/helpers/objectWithoutProperties\"));\n\nvar _utils = require(\"@material-ui/utils\");\n\nfunction round(value) {\n return Math.round(value * 1e5) / 1e5;\n}\n\nvar warnedOnce = false;\n\nfunction roundWithDeprecationWarning(value) {\n if (process.env.NODE_ENV !== 'production') {\n if (!warnedOnce) {\n console.warn(['Material-UI: The `theme.typography.round` helper is deprecated.', 'Head to https://mui.com/r/migration-v4/#theme for a migration path.'].join('\\n'));\n warnedOnce = true;\n }\n }\n\n return round(value);\n}\n\nvar caseAllCaps = {\n textTransform: 'uppercase'\n};\nvar defaultFontFamily = '\"Roboto\", \"Helvetica\", \"Arial\", sans-serif';\n/**\n * @see @link{https://material.io/design/typography/the-type-system.html}\n * @see @link{https://material.io/design/typography/understanding-typography.html}\n */\n\nfunction createTypography(palette, typography) {\n var _ref = typeof typography === 'function' ? typography(palette) : typography,\n _ref$fontFamily = _ref.fontFamily,\n fontFamily = _ref$fontFamily === void 0 ? defaultFontFamily : _ref$fontFamily,\n _ref$fontSize = _ref.fontSize,\n fontSize = _ref$fontSize === void 0 ? 14 : _ref$fontSize,\n _ref$fontWeightLight = _ref.fontWeightLight,\n fontWeightLight = _ref$fontWeightLight === void 0 ? 300 : _ref$fontWeightLight,\n _ref$fontWeightRegula = _ref.fontWeightRegular,\n fontWeightRegular = _ref$fontWeightRegula === void 0 ? 400 : _ref$fontWeightRegula,\n _ref$fontWeightMedium = _ref.fontWeightMedium,\n fontWeightMedium = _ref$fontWeightMedium === void 0 ? 500 : _ref$fontWeightMedium,\n _ref$fontWeightBold = _ref.fontWeightBold,\n fontWeightBold = _ref$fontWeightBold === void 0 ? 700 : _ref$fontWeightBold,\n _ref$htmlFontSize = _ref.htmlFontSize,\n htmlFontSize = _ref$htmlFontSize === void 0 ? 16 : _ref$htmlFontSize,\n allVariants = _ref.allVariants,\n pxToRem2 = _ref.pxToRem,\n other = (0, _objectWithoutProperties2.default)(_ref, [\"fontFamily\", \"fontSize\", \"fontWeightLight\", \"fontWeightRegular\", \"fontWeightMedium\", \"fontWeightBold\", \"htmlFontSize\", \"allVariants\", \"pxToRem\"]);\n\n if (process.env.NODE_ENV !== 'production') {\n if (typeof fontSize !== 'number') {\n console.error('Material-UI: `fontSize` is required to be a number.');\n }\n\n if (typeof htmlFontSize !== 'number') {\n console.error('Material-UI: `htmlFontSize` is required to be a number.');\n }\n }\n\n var coef = fontSize / 14;\n\n var pxToRem = pxToRem2 || function (size) {\n return \"\".concat(size / htmlFontSize * coef, \"rem\");\n };\n\n var buildVariant = function buildVariant(fontWeight, size, lineHeight, letterSpacing, casing) {\n return (0, _extends2.default)({\n fontFamily: fontFamily,\n fontWeight: fontWeight,\n fontSize: pxToRem(size),\n // Unitless following https://meyerweb.com/eric/thoughts/2006/02/08/unitless-line-heights/\n lineHeight: lineHeight\n }, fontFamily === defaultFontFamily ? {\n letterSpacing: \"\".concat(round(letterSpacing / size), \"em\")\n } : {}, casing, allVariants);\n };\n\n var variants = {\n h1: buildVariant(fontWeightLight, 96, 1.167, -1.5),\n h2: buildVariant(fontWeightLight, 60, 1.2, -0.5),\n h3: buildVariant(fontWeightRegular, 48, 1.167, 0),\n h4: buildVariant(fontWeightRegular, 34, 1.235, 0.25),\n h5: buildVariant(fontWeightRegular, 24, 1.334, 0),\n h6: buildVariant(fontWeightMedium, 20, 1.6, 0.15),\n subtitle1: buildVariant(fontWeightRegular, 16, 1.75, 0.15),\n subtitle2: buildVariant(fontWeightMedium, 14, 1.57, 0.1),\n body1: buildVariant(fontWeightRegular, 16, 1.5, 0.15),\n body2: buildVariant(fontWeightRegular, 14, 1.43, 0.15),\n button: buildVariant(fontWeightMedium, 14, 1.75, 0.4, caseAllCaps),\n caption: buildVariant(fontWeightRegular, 12, 1.66, 0.4),\n overline: buildVariant(fontWeightRegular, 12, 2.66, 1, caseAllCaps)\n };\n return (0, _utils.deepmerge)((0, _extends2.default)({\n htmlFontSize: htmlFontSize,\n pxToRem: pxToRem,\n round: roundWithDeprecationWarning,\n // TODO v5: remove\n fontFamily: fontFamily,\n fontSize: fontSize,\n fontWeightLight: fontWeightLight,\n fontWeightRegular: fontWeightRegular,\n fontWeightMedium: fontWeightMedium,\n fontWeightBold: fontWeightBold\n }, variants), other, {\n clone: false // No need to clone deep\n\n });\n}", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar shadowKeyUmbraOpacity = 0.2;\nvar shadowKeyPenumbraOpacity = 0.14;\nvar shadowAmbientShadowOpacity = 0.12;\n\nfunction createShadow() {\n return [\"\".concat(arguments.length <= 0 ? undefined : arguments[0], \"px \").concat(arguments.length <= 1 ? undefined : arguments[1], \"px \").concat(arguments.length <= 2 ? undefined : arguments[2], \"px \").concat(arguments.length <= 3 ? undefined : arguments[3], \"px rgba(0,0,0,\").concat(shadowKeyUmbraOpacity, \")\"), \"\".concat(arguments.length <= 4 ? undefined : arguments[4], \"px \").concat(arguments.length <= 5 ? undefined : arguments[5], \"px \").concat(arguments.length <= 6 ? undefined : arguments[6], \"px \").concat(arguments.length <= 7 ? undefined : arguments[7], \"px rgba(0,0,0,\").concat(shadowKeyPenumbraOpacity, \")\"), \"\".concat(arguments.length <= 8 ? undefined : arguments[8], \"px \").concat(arguments.length <= 9 ? undefined : arguments[9], \"px \").concat(arguments.length <= 10 ? undefined : arguments[10], \"px \").concat(arguments.length <= 11 ? undefined : arguments[11], \"px rgba(0,0,0,\").concat(shadowAmbientShadowOpacity, \")\")].join(',');\n} // Values from https://github.com/material-components/material-components-web/blob/be8747f94574669cb5e7add1a7c54fa41a89cec7/packages/mdc-elevation/_variables.scss\n\n\nvar shadows = ['none', createShadow(0, 2, 1, -1, 0, 1, 1, 0, 0, 1, 3, 0), createShadow(0, 3, 1, -2, 0, 2, 2, 0, 0, 1, 5, 0), createShadow(0, 3, 3, -2, 0, 3, 4, 0, 0, 1, 8, 0), createShadow(0, 2, 4, -1, 0, 4, 5, 0, 0, 1, 10, 0), createShadow(0, 3, 5, -1, 0, 5, 8, 0, 0, 1, 14, 0), createShadow(0, 3, 5, -1, 0, 6, 10, 0, 0, 1, 18, 0), createShadow(0, 4, 5, -2, 0, 7, 10, 1, 0, 2, 16, 1), createShadow(0, 5, 5, -3, 0, 8, 10, 1, 0, 3, 14, 2), createShadow(0, 5, 6, -3, 0, 9, 12, 1, 0, 3, 16, 2), createShadow(0, 6, 6, -3, 0, 10, 14, 1, 0, 4, 18, 3), createShadow(0, 6, 7, -4, 0, 11, 15, 1, 0, 4, 20, 3), createShadow(0, 7, 8, -4, 0, 12, 17, 2, 0, 5, 22, 4), createShadow(0, 7, 8, -4, 0, 13, 19, 2, 0, 5, 24, 4), createShadow(0, 7, 9, -4, 0, 14, 21, 2, 0, 5, 26, 4), createShadow(0, 8, 9, -5, 0, 15, 22, 2, 0, 6, 28, 5), createShadow(0, 8, 10, -5, 0, 16, 24, 2, 0, 6, 30, 5), createShadow(0, 8, 11, -5, 0, 17, 26, 2, 0, 6, 32, 5), createShadow(0, 9, 11, -5, 0, 18, 28, 2, 0, 7, 34, 6), createShadow(0, 9, 12, -6, 0, 19, 29, 2, 0, 7, 36, 6), createShadow(0, 10, 13, -6, 0, 20, 31, 3, 0, 8, 38, 7), createShadow(0, 10, 13, -6, 0, 21, 33, 3, 0, 8, 40, 7), createShadow(0, 10, 14, -6, 0, 22, 35, 3, 0, 8, 42, 7), createShadow(0, 11, 14, -7, 0, 23, 36, 3, 0, 9, 44, 8), createShadow(0, 11, 15, -7, 0, 24, 38, 3, 0, 9, 46, 8)];\nvar _default = shadows;\nexports.default = _default;", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar shape = {\n borderRadius: 4\n};\nvar _default = shape;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _propTypes = _interopRequireDefault(require(\"prop-types\"));\n\nvar responsivePropType = process.env.NODE_ENV !== 'production' ? _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string, _propTypes.default.object, _propTypes.default.array]) : {};\nvar _default = responsivePropType;\nexports.default = _default;", "function _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nmodule.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;", "var arrayLikeToArray = require(\"./arrayLikeToArray.js\");\nfunction _arrayWithoutHoles(r) {\n if (Array.isArray(r)) return arrayLikeToArray(r);\n}\nmodule.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;", "function _iterableToArray(r) {\n if (\"undefined\" != typeof Symbol && null != r[Symbol.iterator] || null != r[\"@@iterator\"]) return Array.from(r);\n}\nmodule.exports = _iterableToArray, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;", "var arrayLikeToArray = require(\"./arrayLikeToArray.js\");\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? arrayLikeToArray(r, a) : void 0;\n }\n}\nmodule.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;", "function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nmodule.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;", "var arrayWithoutHoles = require(\"./arrayWithoutHoles.js\");\nvar iterableToArray = require(\"./iterableToArray.js\");\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray.js\");\nvar nonIterableSpread = require(\"./nonIterableSpread.js\");\nfunction _toConsumableArray(r) {\n return arrayWithoutHoles(r) || iterableToArray(r) || unsupportedIterableToArray(r) || nonIterableSpread();\n}\nmodule.exports = _toConsumableArray, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _utils = require(\"@material-ui/utils\");\n\nfunction merge(acc, item) {\n if (!item) {\n return acc;\n }\n\n return (0, _utils.deepmerge)(acc, item, {\n clone: false // No need to clone deep, it's way faster.\n\n });\n}\n\nvar _default = merge;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.handleBreakpoints = handleBreakpoints;\nexports.default = void 0;\n\nvar _toConsumableArray2 = _interopRequireDefault(require(\"@babel/runtime/helpers/toConsumableArray\"));\n\nvar _extends2 = _interopRequireDefault(require(\"@babel/runtime/helpers/extends\"));\n\nvar _typeof2 = _interopRequireDefault(require(\"@babel/runtime/helpers/typeof\"));\n\nvar _propTypes = _interopRequireDefault(require(\"prop-types\"));\n\nvar _merge = _interopRequireDefault(require(\"./merge\"));\n\n// The breakpoint **start** at this value.\n// For instance with the first breakpoint xs: [xs, sm[.\nvar values = {\n xs: 0,\n sm: 600,\n md: 960,\n lg: 1280,\n xl: 1920\n};\nvar defaultBreakpoints = {\n // Sorted ASC by size. That's important.\n // It can't be configured as it's used statically for propTypes.\n keys: ['xs', 'sm', 'md', 'lg', 'xl'],\n up: function up(key) {\n return \"@media (min-width:\".concat(values[key], \"px)\");\n }\n};\n\nfunction handleBreakpoints(props, propValue, styleFromPropValue) {\n if (process.env.NODE_ENV !== 'production') {\n if (!props.theme) {\n console.error('Material-UI: You are calling a style function without a theme value.');\n }\n }\n\n if (Array.isArray(propValue)) {\n var themeBreakpoints = props.theme.breakpoints || defaultBreakpoints;\n return propValue.reduce(function (acc, item, index) {\n acc[themeBreakpoints.up(themeBreakpoints.keys[index])] = styleFromPropValue(propValue[index]);\n return acc;\n }, {});\n }\n\n if ((0, _typeof2.default)(propValue) === 'object') {\n var _themeBreakpoints = props.theme.breakpoints || defaultBreakpoints;\n\n return Object.keys(propValue).reduce(function (acc, breakpoint) {\n acc[_themeBreakpoints.up(breakpoint)] = styleFromPropValue(propValue[breakpoint]);\n return acc;\n }, {});\n }\n\n var output = styleFromPropValue(propValue);\n return output;\n}\n\nfunction breakpoints(styleFunction) {\n var newStyleFunction = function newStyleFunction(props) {\n var base = styleFunction(props);\n var themeBreakpoints = props.theme.breakpoints || defaultBreakpoints;\n var extended = themeBreakpoints.keys.reduce(function (acc, key) {\n if (props[key]) {\n acc = acc || {};\n acc[themeBreakpoints.up(key)] = styleFunction((0, _extends2.default)({\n theme: props.theme\n }, props[key]));\n }\n\n return acc;\n }, null);\n return (0, _merge.default)(base, extended);\n };\n\n newStyleFunction.propTypes = process.env.NODE_ENV !== 'production' ? (0, _extends2.default)({}, styleFunction.propTypes, {\n xs: _propTypes.default.object,\n sm: _propTypes.default.object,\n md: _propTypes.default.object,\n lg: _propTypes.default.object,\n xl: _propTypes.default.object\n }) : {};\n newStyleFunction.filterProps = ['xs', 'sm', 'md', 'lg', 'xl'].concat((0, _toConsumableArray2.default)(styleFunction.filterProps));\n return newStyleFunction;\n}\n\nvar _default = breakpoints;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _defineProperty2 = _interopRequireDefault(require(\"@babel/runtime/helpers/defineProperty\"));\n\nvar _responsivePropType = _interopRequireDefault(require(\"./responsivePropType\"));\n\nvar _breakpoints = require(\"./breakpoints\");\n\nfunction getPath(obj, path) {\n if (!path || typeof path !== 'string') {\n return null;\n }\n\n return path.split('.').reduce(function (acc, item) {\n return acc && acc[item] ? acc[item] : null;\n }, obj);\n}\n\nfunction style(options) {\n var prop = options.prop,\n _options$cssProperty = options.cssProperty,\n cssProperty = _options$cssProperty === void 0 ? options.prop : _options$cssProperty,\n themeKey = options.themeKey,\n transform = options.transform;\n\n var fn = function fn(props) {\n if (props[prop] == null) {\n return null;\n }\n\n var propValue = props[prop];\n var theme = props.theme;\n var themeMapping = getPath(theme, themeKey) || {};\n\n var styleFromPropValue = function styleFromPropValue(propValueFinal) {\n var value;\n\n if (typeof themeMapping === 'function') {\n value = themeMapping(propValueFinal);\n } else if (Array.isArray(themeMapping)) {\n value = themeMapping[propValueFinal] || propValueFinal;\n } else {\n value = getPath(themeMapping, propValueFinal) || propValueFinal;\n\n if (transform) {\n value = transform(value);\n }\n }\n\n if (cssProperty === false) {\n return value;\n }\n\n return (0, _defineProperty2.default)({}, cssProperty, value);\n };\n\n return (0, _breakpoints.handleBreakpoints)(props, propValue, styleFromPropValue);\n };\n\n fn.propTypes = process.env.NODE_ENV !== 'production' ? (0, _defineProperty2.default)({}, prop, _responsivePropType.default) : {};\n fn.filterProps = [prop];\n return fn;\n}\n\nvar _default = style;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _extends2 = _interopRequireDefault(require(\"@babel/runtime/helpers/extends\"));\n\nvar _merge = _interopRequireDefault(require(\"./merge\"));\n\nfunction compose() {\n for (var _len = arguments.length, styles = new Array(_len), _key = 0; _key < _len; _key++) {\n styles[_key] = arguments[_key];\n }\n\n var fn = function fn(props) {\n return styles.reduce(function (acc, style) {\n var output = style(props);\n\n if (output) {\n return (0, _merge.default)(acc, output);\n }\n\n return acc;\n }, {});\n }; // Alternative approach that doesn't yield any performance gain.\n // const handlers = styles.reduce((acc, style) => {\n // style.filterProps.forEach(prop => {\n // acc[prop] = style;\n // });\n // return acc;\n // }, {});\n // const fn = props => {\n // return Object.keys(props).reduce((acc, prop) => {\n // if (handlers[prop]) {\n // return merge(acc, handlers[prop](props));\n // }\n // return acc;\n // }, {});\n // };\n\n\n fn.propTypes = process.env.NODE_ENV !== 'production' ? styles.reduce(function (acc, style) {\n return (0, _extends2.default)(acc, style.propTypes);\n }, {}) : {};\n fn.filterProps = styles.reduce(function (acc, style) {\n return acc.concat(style.filterProps);\n }, []);\n return fn;\n}\n\nvar _default = compose;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.borderRadius = exports.borderColor = exports.borderLeft = exports.borderBottom = exports.borderRight = exports.borderTop = exports.border = void 0;\n\nvar _style = _interopRequireDefault(require(\"./style\"));\n\nvar _compose = _interopRequireDefault(require(\"./compose\"));\n\nfunction getBorder(value) {\n if (typeof value !== 'number') {\n return value;\n }\n\n return \"\".concat(value, \"px solid\");\n}\n\nvar border = (0, _style.default)({\n prop: 'border',\n themeKey: 'borders',\n transform: getBorder\n});\nexports.border = border;\nvar borderTop = (0, _style.default)({\n prop: 'borderTop',\n themeKey: 'borders',\n transform: getBorder\n});\nexports.borderTop = borderTop;\nvar borderRight = (0, _style.default)({\n prop: 'borderRight',\n themeKey: 'borders',\n transform: getBorder\n});\nexports.borderRight = borderRight;\nvar borderBottom = (0, _style.default)({\n prop: 'borderBottom',\n themeKey: 'borders',\n transform: getBorder\n});\nexports.borderBottom = borderBottom;\nvar borderLeft = (0, _style.default)({\n prop: 'borderLeft',\n themeKey: 'borders',\n transform: getBorder\n});\nexports.borderLeft = borderLeft;\nvar borderColor = (0, _style.default)({\n prop: 'borderColor',\n themeKey: 'palette'\n});\nexports.borderColor = borderColor;\nvar borderRadius = (0, _style.default)({\n prop: 'borderRadius',\n themeKey: 'shape'\n});\nexports.borderRadius = borderRadius;\nvar borders = (0, _compose.default)(border, borderTop, borderRight, borderBottom, borderLeft, borderColor, borderRadius);\nvar _default = borders;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.css = css;\nexports.default = void 0;\n\nvar _toConsumableArray2 = _interopRequireDefault(require(\"@babel/runtime/helpers/toConsumableArray\"));\n\nvar _extends2 = _interopRequireDefault(require(\"@babel/runtime/helpers/extends\"));\n\nvar _propTypes = _interopRequireDefault(require(\"prop-types\"));\n\nvar _utils = require(\"@material-ui/utils\");\n\nvar _merge = _interopRequireDefault(require(\"./merge\"));\n\nfunction omit(input, fields) {\n var output = {};\n Object.keys(input).forEach(function (prop) {\n if (fields.indexOf(prop) === -1) {\n output[prop] = input[prop];\n }\n });\n return output;\n}\n\nvar warnedOnce = false;\n\nfunction styleFunctionSx(styleFunction) {\n var newStyleFunction = function newStyleFunction(props) {\n var output = styleFunction(props);\n\n if (props.css) {\n return (0, _extends2.default)({}, (0, _merge.default)(output, styleFunction((0, _extends2.default)({\n theme: props.theme\n }, props.css))), omit(props.css, [styleFunction.filterProps]));\n }\n\n if (props.sx) {\n return (0, _extends2.default)({}, (0, _merge.default)(output, styleFunction((0, _extends2.default)({\n theme: props.theme\n }, props.sx))), omit(props.sx, [styleFunction.filterProps]));\n }\n\n return output;\n };\n\n newStyleFunction.propTypes = process.env.NODE_ENV !== 'production' ? (0, _extends2.default)({}, styleFunction.propTypes, {\n css: (0, _utils.chainPropTypes)(_propTypes.default.object, function (props) {\n if (!warnedOnce && props.css !== undefined) {\n warnedOnce = true;\n return new Error('Material-UI: The `css` prop is deprecated, please use the `sx` prop instead.');\n }\n\n return null;\n }),\n sx: _propTypes.default.object\n }) : {};\n newStyleFunction.filterProps = ['css', 'sx'].concat((0, _toConsumableArray2.default)(styleFunction.filterProps));\n return newStyleFunction;\n}\n/**\n *\n * @deprecated\n * The css style function is deprecated. Use the `styleFunctionSx` instead.\n */\n\n\nfunction css(styleFunction) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Material-UI: The `css` function is deprecated. Use the `styleFunctionSx` instead.');\n }\n\n return styleFunctionSx(styleFunction);\n}\n\nvar _default = styleFunctionSx;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.whiteSpace = exports.visibility = exports.textOverflow = exports.overflow = exports.displayRaw = exports.displayPrint = void 0;\n\nvar _style = _interopRequireDefault(require(\"./style\"));\n\nvar _compose = _interopRequireDefault(require(\"./compose\"));\n\nvar displayPrint = (0, _style.default)({\n prop: 'displayPrint',\n cssProperty: false,\n transform: function transform(value) {\n return {\n '@media print': {\n display: value\n }\n };\n }\n});\nexports.displayPrint = displayPrint;\nvar displayRaw = (0, _style.default)({\n prop: 'display'\n});\nexports.displayRaw = displayRaw;\nvar overflow = (0, _style.default)({\n prop: 'overflow'\n});\nexports.overflow = overflow;\nvar textOverflow = (0, _style.default)({\n prop: 'textOverflow'\n});\nexports.textOverflow = textOverflow;\nvar visibility = (0, _style.default)({\n prop: 'visibility'\n});\nexports.visibility = visibility;\nvar whiteSpace = (0, _style.default)({\n prop: 'whiteSpace'\n});\nexports.whiteSpace = whiteSpace;\n\nvar _default = (0, _compose.default)(displayPrint, displayRaw, overflow, textOverflow, visibility, whiteSpace);\n\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.justifySelf = exports.justifyItems = exports.alignSelf = exports.flexShrink = exports.flexGrow = exports.flex = exports.order = exports.alignContent = exports.alignItems = exports.justifyContent = exports.flexWrap = exports.flexDirection = exports.flexBasis = void 0;\n\nvar _style = _interopRequireDefault(require(\"./style\"));\n\nvar _compose = _interopRequireDefault(require(\"./compose\"));\n\nvar flexBasis = (0, _style.default)({\n prop: 'flexBasis'\n});\nexports.flexBasis = flexBasis;\nvar flexDirection = (0, _style.default)({\n prop: 'flexDirection'\n});\nexports.flexDirection = flexDirection;\nvar flexWrap = (0, _style.default)({\n prop: 'flexWrap'\n});\nexports.flexWrap = flexWrap;\nvar justifyContent = (0, _style.default)({\n prop: 'justifyContent'\n});\nexports.justifyContent = justifyContent;\nvar alignItems = (0, _style.default)({\n prop: 'alignItems'\n});\nexports.alignItems = alignItems;\nvar alignContent = (0, _style.default)({\n prop: 'alignContent'\n});\nexports.alignContent = alignContent;\nvar order = (0, _style.default)({\n prop: 'order'\n});\nexports.order = order;\nvar flex = (0, _style.default)({\n prop: 'flex'\n});\nexports.flex = flex;\nvar flexGrow = (0, _style.default)({\n prop: 'flexGrow'\n});\nexports.flexGrow = flexGrow;\nvar flexShrink = (0, _style.default)({\n prop: 'flexShrink'\n});\nexports.flexShrink = flexShrink;\nvar alignSelf = (0, _style.default)({\n prop: 'alignSelf'\n});\nexports.alignSelf = alignSelf;\nvar justifyItems = (0, _style.default)({\n prop: 'justifyItems'\n});\nexports.justifyItems = justifyItems;\nvar justifySelf = (0, _style.default)({\n prop: 'justifySelf'\n});\nexports.justifySelf = justifySelf;\nvar flexbox = (0, _compose.default)(flexBasis, flexDirection, flexWrap, justifyContent, alignItems, alignContent, order, flex, flexGrow, flexShrink, alignSelf, justifyItems, justifySelf);\nvar _default = flexbox;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.gridArea = exports.gridTemplateAreas = exports.gridTemplateRows = exports.gridTemplateColumns = exports.gridAutoRows = exports.gridAutoColumns = exports.gridAutoFlow = exports.gridRow = exports.gridColumn = exports.gridRowGap = exports.gridColumnGap = exports.gridGap = void 0;\n\nvar _style = _interopRequireDefault(require(\"./style\"));\n\nvar _compose = _interopRequireDefault(require(\"./compose\"));\n\nvar gridGap = (0, _style.default)({\n prop: 'gridGap'\n});\nexports.gridGap = gridGap;\nvar gridColumnGap = (0, _style.default)({\n prop: 'gridColumnGap'\n});\nexports.gridColumnGap = gridColumnGap;\nvar gridRowGap = (0, _style.default)({\n prop: 'gridRowGap'\n});\nexports.gridRowGap = gridRowGap;\nvar gridColumn = (0, _style.default)({\n prop: 'gridColumn'\n});\nexports.gridColumn = gridColumn;\nvar gridRow = (0, _style.default)({\n prop: 'gridRow'\n});\nexports.gridRow = gridRow;\nvar gridAutoFlow = (0, _style.default)({\n prop: 'gridAutoFlow'\n});\nexports.gridAutoFlow = gridAutoFlow;\nvar gridAutoColumns = (0, _style.default)({\n prop: 'gridAutoColumns'\n});\nexports.gridAutoColumns = gridAutoColumns;\nvar gridAutoRows = (0, _style.default)({\n prop: 'gridAutoRows'\n});\nexports.gridAutoRows = gridAutoRows;\nvar gridTemplateColumns = (0, _style.default)({\n prop: 'gridTemplateColumns'\n});\nexports.gridTemplateColumns = gridTemplateColumns;\nvar gridTemplateRows = (0, _style.default)({\n prop: 'gridTemplateRows'\n});\nexports.gridTemplateRows = gridTemplateRows;\nvar gridTemplateAreas = (0, _style.default)({\n prop: 'gridTemplateAreas'\n});\nexports.gridTemplateAreas = gridTemplateAreas;\nvar gridArea = (0, _style.default)({\n prop: 'gridArea'\n});\nexports.gridArea = gridArea;\nvar grid = (0, _compose.default)(gridGap, gridColumnGap, gridRowGap, gridColumn, gridRow, gridAutoFlow, gridAutoColumns, gridAutoRows, gridTemplateColumns, gridTemplateRows, gridTemplateAreas, gridArea);\nvar _default = grid;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.bgcolor = exports.color = void 0;\n\nvar _style = _interopRequireDefault(require(\"./style\"));\n\nvar _compose = _interopRequireDefault(require(\"./compose\"));\n\nvar color = (0, _style.default)({\n prop: 'color',\n themeKey: 'palette'\n});\nexports.color = color;\nvar bgcolor = (0, _style.default)({\n prop: 'bgcolor',\n cssProperty: 'backgroundColor',\n themeKey: 'palette'\n});\nexports.bgcolor = bgcolor;\nvar palette = (0, _compose.default)(color, bgcolor);\nvar _default = palette;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.left = exports.bottom = exports.right = exports.top = exports.zIndex = exports.position = void 0;\n\nvar _style = _interopRequireDefault(require(\"./style\"));\n\nvar _compose = _interopRequireDefault(require(\"./compose\"));\n\nvar position = (0, _style.default)({\n prop: 'position'\n});\nexports.position = position;\nvar zIndex = (0, _style.default)({\n prop: 'zIndex',\n themeKey: 'zIndex'\n});\nexports.zIndex = zIndex;\nvar top = (0, _style.default)({\n prop: 'top'\n});\nexports.top = top;\nvar right = (0, _style.default)({\n prop: 'right'\n});\nexports.right = right;\nvar bottom = (0, _style.default)({\n prop: 'bottom'\n});\nexports.bottom = bottom;\nvar left = (0, _style.default)({\n prop: 'left'\n});\nexports.left = left;\n\nvar _default = (0, _compose.default)(position, zIndex, top, right, bottom, left);\n\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _style = _interopRequireDefault(require(\"./style\"));\n\nvar boxShadow = (0, _style.default)({\n prop: 'boxShadow',\n themeKey: 'shadows'\n});\nvar _default = boxShadow;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.boxSizing = exports.sizeHeight = exports.sizeWidth = exports.minHeight = exports.maxHeight = exports.height = exports.minWidth = exports.maxWidth = exports.width = void 0;\n\nvar _style = _interopRequireDefault(require(\"./style\"));\n\nvar _compose = _interopRequireDefault(require(\"./compose\"));\n\nfunction transform(value) {\n return value <= 1 ? \"\".concat(value * 100, \"%\") : value;\n}\n\nvar width = (0, _style.default)({\n prop: 'width',\n transform: transform\n});\nexports.width = width;\nvar maxWidth = (0, _style.default)({\n prop: 'maxWidth',\n transform: transform\n});\nexports.maxWidth = maxWidth;\nvar minWidth = (0, _style.default)({\n prop: 'minWidth',\n transform: transform\n});\nexports.minWidth = minWidth;\nvar height = (0, _style.default)({\n prop: 'height',\n transform: transform\n});\nexports.height = height;\nvar maxHeight = (0, _style.default)({\n prop: 'maxHeight',\n transform: transform\n});\nexports.maxHeight = maxHeight;\nvar minHeight = (0, _style.default)({\n prop: 'minHeight',\n transform: transform\n});\nexports.minHeight = minHeight;\nvar sizeWidth = (0, _style.default)({\n prop: 'size',\n cssProperty: 'width',\n transform: transform\n});\nexports.sizeWidth = sizeWidth;\nvar sizeHeight = (0, _style.default)({\n prop: 'size',\n cssProperty: 'height',\n transform: transform\n});\nexports.sizeHeight = sizeHeight;\nvar boxSizing = (0, _style.default)({\n prop: 'boxSizing'\n});\nexports.boxSizing = boxSizing;\nvar sizing = (0, _compose.default)(width, maxWidth, minWidth, height, maxHeight, minHeight, boxSizing);\nvar _default = sizing;\nexports.default = _default;", "function _arrayWithHoles(r) {\n if (Array.isArray(r)) return r;\n}\nmodule.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;", "function _iterableToArrayLimit(r, l) {\n var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (null != t) {\n var e,\n n,\n i,\n u,\n a = [],\n f = !0,\n o = !1;\n try {\n if (i = (t = t.call(r)).next, 0 === l) {\n if (Object(t) !== t) return;\n f = !1;\n } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);\n } catch (r) {\n o = !0, n = r;\n } finally {\n try {\n if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return;\n } finally {\n if (o) throw n;\n }\n }\n return a;\n }\n}\nmodule.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;", "function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nmodule.exports = _nonIterableRest, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;", "var arrayWithHoles = require(\"./arrayWithHoles.js\");\nvar iterableToArrayLimit = require(\"./iterableToArrayLimit.js\");\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray.js\");\nvar nonIterableRest = require(\"./nonIterableRest.js\");\nfunction _slicedToArray(r, e) {\n return arrayWithHoles(r) || iterableToArrayLimit(r, e) || unsupportedIterableToArray(r, e) || nonIterableRest();\n}\nmodule.exports = _slicedToArray, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = memoize;\n\nfunction memoize(fn) {\n var cache = {};\n return function (arg) {\n if (cache[arg] === undefined) {\n cache[arg] = fn(arg);\n }\n\n return cache[arg];\n };\n}", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.createUnarySpacing = createUnarySpacing;\nexports.default = void 0;\n\nvar _slicedToArray2 = _interopRequireDefault(require(\"@babel/runtime/helpers/slicedToArray\"));\n\nvar _responsivePropType = _interopRequireDefault(require(\"./responsivePropType\"));\n\nvar _breakpoints = require(\"./breakpoints\");\n\nvar _merge = _interopRequireDefault(require(\"./merge\"));\n\nvar _memoize = _interopRequireDefault(require(\"./memoize\"));\n\nvar properties = {\n m: 'margin',\n p: 'padding'\n};\nvar directions = {\n t: 'Top',\n r: 'Right',\n b: 'Bottom',\n l: 'Left',\n x: ['Left', 'Right'],\n y: ['Top', 'Bottom']\n};\nvar aliases = {\n marginX: 'mx',\n marginY: 'my',\n paddingX: 'px',\n paddingY: 'py'\n}; // memoize() impact:\n// From 300,000 ops/sec\n// To 350,000 ops/sec\n\nvar getCssProperties = (0, _memoize.default)(function (prop) {\n // It's not a shorthand notation.\n if (prop.length > 2) {\n if (aliases[prop]) {\n prop = aliases[prop];\n } else {\n return [prop];\n }\n }\n\n var _prop$split = prop.split(''),\n _prop$split2 = (0, _slicedToArray2.default)(_prop$split, 2),\n a = _prop$split2[0],\n b = _prop$split2[1];\n\n var property = properties[a];\n var direction = directions[b] || '';\n return Array.isArray(direction) ? direction.map(function (dir) {\n return property + dir;\n }) : [property + direction];\n});\nvar spacingKeys = ['m', 'mt', 'mr', 'mb', 'ml', 'mx', 'my', 'p', 'pt', 'pr', 'pb', 'pl', 'px', 'py', 'margin', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft', 'marginX', 'marginY', 'padding', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'paddingX', 'paddingY'];\n\nfunction createUnarySpacing(theme) {\n var themeSpacing = theme.spacing || 8;\n\n if (typeof themeSpacing === 'number') {\n return function (abs) {\n if (process.env.NODE_ENV !== 'production') {\n if (typeof abs !== 'number') {\n console.error(\"Material-UI: Expected spacing argument to be a number, got \".concat(abs, \".\"));\n }\n }\n\n return themeSpacing * abs;\n };\n }\n\n if (Array.isArray(themeSpacing)) {\n return function (abs) {\n if (process.env.NODE_ENV !== 'production') {\n if (abs > themeSpacing.length - 1) {\n console.error([\"Material-UI: The value provided (\".concat(abs, \") overflows.\"), \"The supported values are: \".concat(JSON.stringify(themeSpacing), \".\"), \"\".concat(abs, \" > \").concat(themeSpacing.length - 1, \", you need to add the missing values.\")].join('\\n'));\n }\n }\n\n return themeSpacing[abs];\n };\n }\n\n if (typeof themeSpacing === 'function') {\n return themeSpacing;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n console.error([\"Material-UI: The `theme.spacing` value (\".concat(themeSpacing, \") is invalid.\"), 'It should be a number, an array or a function.'].join('\\n'));\n }\n\n return function () {\n return undefined;\n };\n}\n\nfunction getValue(transformer, propValue) {\n if (typeof propValue === 'string' || propValue == null) {\n return propValue;\n }\n\n var abs = Math.abs(propValue);\n var transformed = transformer(abs);\n\n if (propValue >= 0) {\n return transformed;\n }\n\n if (typeof transformed === 'number') {\n return -transformed;\n }\n\n return \"-\".concat(transformed);\n}\n\nfunction getStyleFromPropValue(cssProperties, transformer) {\n return function (propValue) {\n return cssProperties.reduce(function (acc, cssProperty) {\n acc[cssProperty] = getValue(transformer, propValue);\n return acc;\n }, {});\n };\n}\n\nfunction spacing(props) {\n var theme = props.theme;\n var transformer = createUnarySpacing(theme);\n return Object.keys(props).map(function (prop) {\n // Using a hash computation over an array iteration could be faster, but with only 28 items,\n // it's doesn't worth the bundle size.\n if (spacingKeys.indexOf(prop) === -1) {\n return null;\n }\n\n var cssProperties = getCssProperties(prop);\n var styleFromPropValue = getStyleFromPropValue(cssProperties, transformer);\n var propValue = props[prop];\n return (0, _breakpoints.handleBreakpoints)(props, propValue, styleFromPropValue);\n }).reduce(_merge.default, {});\n}\n\nspacing.propTypes = process.env.NODE_ENV !== 'production' ? spacingKeys.reduce(function (obj, key) {\n obj[key] = _responsivePropType.default;\n return obj;\n}, {}) : {};\nspacing.filterProps = spacingKeys;\nvar _default = spacing;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.textAlign = exports.lineHeight = exports.letterSpacing = exports.fontWeight = exports.fontStyle = exports.fontSize = exports.fontFamily = void 0;\n\nvar _style = _interopRequireDefault(require(\"./style\"));\n\nvar _compose = _interopRequireDefault(require(\"./compose\"));\n\nvar fontFamily = (0, _style.default)({\n prop: 'fontFamily',\n themeKey: 'typography'\n});\nexports.fontFamily = fontFamily;\nvar fontSize = (0, _style.default)({\n prop: 'fontSize',\n themeKey: 'typography'\n});\nexports.fontSize = fontSize;\nvar fontStyle = (0, _style.default)({\n prop: 'fontStyle',\n themeKey: 'typography'\n});\nexports.fontStyle = fontStyle;\nvar fontWeight = (0, _style.default)({\n prop: 'fontWeight',\n themeKey: 'typography'\n});\nexports.fontWeight = fontWeight;\nvar letterSpacing = (0, _style.default)({\n prop: 'letterSpacing'\n});\nexports.letterSpacing = letterSpacing;\nvar lineHeight = (0, _style.default)({\n prop: 'lineHeight'\n});\nexports.lineHeight = lineHeight;\nvar textAlign = (0, _style.default)({\n prop: 'textAlign'\n});\nexports.textAlign = textAlign;\nvar typography = (0, _compose.default)(fontFamily, fontSize, fontStyle, fontWeight, letterSpacing, lineHeight, textAlign);\nvar _default = typography;\nexports.default = _default;", "/** @license Material-UI v4.12.2\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nvar _interopRequireWildcard = require(\"@babel/runtime/helpers/interopRequireWildcard\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar _exportNames = {\n borders: true,\n breakpoints: true,\n compose: true,\n styleFunctionSx: true,\n display: true,\n flexbox: true,\n grid: true,\n palette: true,\n positions: true,\n shadows: true,\n sizing: true,\n spacing: true,\n style: true,\n typography: true\n};\nObject.defineProperty(exports, \"borders\", {\n enumerable: true,\n get: function get() {\n return _borders.default;\n }\n});\nObject.defineProperty(exports, \"breakpoints\", {\n enumerable: true,\n get: function get() {\n return _breakpoints.default;\n }\n});\nObject.defineProperty(exports, \"compose\", {\n enumerable: true,\n get: function get() {\n return _compose.default;\n }\n});\nObject.defineProperty(exports, \"styleFunctionSx\", {\n enumerable: true,\n get: function get() {\n return _styleFunctionSx.default;\n }\n});\nObject.defineProperty(exports, \"display\", {\n enumerable: true,\n get: function get() {\n return _display.default;\n }\n});\nObject.defineProperty(exports, \"flexbox\", {\n enumerable: true,\n get: function get() {\n return _flexbox.default;\n }\n});\nObject.defineProperty(exports, \"grid\", {\n enumerable: true,\n get: function get() {\n return _grid.default;\n }\n});\nObject.defineProperty(exports, \"palette\", {\n enumerable: true,\n get: function get() {\n return _palette.default;\n }\n});\nObject.defineProperty(exports, \"positions\", {\n enumerable: true,\n get: function get() {\n return _positions.default;\n }\n});\nObject.defineProperty(exports, \"shadows\", {\n enumerable: true,\n get: function get() {\n return _shadows.default;\n }\n});\nObject.defineProperty(exports, \"sizing\", {\n enumerable: true,\n get: function get() {\n return _sizing.default;\n }\n});\nObject.defineProperty(exports, \"spacing\", {\n enumerable: true,\n get: function get() {\n return _spacing.default;\n }\n});\nObject.defineProperty(exports, \"style\", {\n enumerable: true,\n get: function get() {\n return _style.default;\n }\n});\nObject.defineProperty(exports, \"typography\", {\n enumerable: true,\n get: function get() {\n return _typography.default;\n }\n});\n\nvar _borders = _interopRequireWildcard(require(\"./borders\"));\n\nObject.keys(_borders).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _borders[key];\n }\n });\n});\n\nvar _breakpoints = _interopRequireDefault(require(\"./breakpoints\"));\n\nvar _compose = _interopRequireDefault(require(\"./compose\"));\n\nvar _styleFunctionSx = _interopRequireWildcard(require(\"./styleFunctionSx\"));\n\nObject.keys(_styleFunctionSx).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _styleFunctionSx[key];\n }\n });\n});\n\nvar _display = _interopRequireDefault(require(\"./display\"));\n\nvar _flexbox = _interopRequireWildcard(require(\"./flexbox\"));\n\nObject.keys(_flexbox).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _flexbox[key];\n }\n });\n});\n\nvar _grid = _interopRequireWildcard(require(\"./grid\"));\n\nObject.keys(_grid).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _grid[key];\n }\n });\n});\n\nvar _palette = _interopRequireWildcard(require(\"./palette\"));\n\nObject.keys(_palette).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _palette[key];\n }\n });\n});\n\nvar _positions = _interopRequireWildcard(require(\"./positions\"));\n\nObject.keys(_positions).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _positions[key];\n }\n });\n});\n\nvar _shadows = _interopRequireDefault(require(\"./shadows\"));\n\nvar _sizing = _interopRequireWildcard(require(\"./sizing\"));\n\nObject.keys(_sizing).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _sizing[key];\n }\n });\n});\n\nvar _spacing = _interopRequireWildcard(require(\"./spacing\"));\n\nObject.keys(_spacing).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _spacing[key];\n }\n });\n});\n\nvar _style = _interopRequireDefault(require(\"./style\"));\n\nvar _typography = _interopRequireWildcard(require(\"./typography\"));\n\nObject.keys(_typography).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _typography[key];\n }\n });\n});", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = createSpacing;\n\nvar _system = require(\"@material-ui/system\");\n\nvar warnOnce;\n\nfunction createSpacing() {\n var spacingInput = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 8;\n\n // Already transformed.\n if (spacingInput.mui) {\n return spacingInput;\n } // Material Design layouts are visually balanced. Most measurements align to an 8dp grid applied, which aligns both spacing and the overall layout.\n // Smaller components, such as icons and type, can align to a 4dp grid.\n // https://material.io/design/layout/understanding-layout.html#usage\n\n\n var transform = (0, _system.createUnarySpacing)({\n spacing: spacingInput\n });\n\n var spacing = function spacing() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (!(args.length <= 4)) {\n console.error(\"Material-UI: Too many arguments provided, expected between 0 and 4, got \".concat(args.length));\n }\n }\n\n if (args.length === 0) {\n return transform(1);\n }\n\n if (args.length === 1) {\n return transform(args[0]);\n }\n\n return args.map(function (argument) {\n if (typeof argument === 'string') {\n return argument;\n }\n\n var output = transform(argument);\n return typeof output === 'number' ? \"\".concat(output, \"px\") : output;\n }).join(' ');\n }; // Backward compatibility, to remove in v5.\n\n\n Object.defineProperty(spacing, 'unit', {\n get: function get() {\n if (process.env.NODE_ENV !== 'production') {\n if (!warnOnce || process.env.NODE_ENV === 'test') {\n console.error(['Material-UI: theme.spacing.unit usage has been deprecated.', 'It will be removed in v5.', 'You can replace `theme.spacing.unit * y` with `theme.spacing(y)`.', '', 'You can use the `https://github.com/mui-org/material-ui/tree/master/packages/material-ui-codemod/README.md#theme-spacing-api` migration helper to make the process smoother.'].join('\\n'));\n }\n\n warnOnce = true;\n }\n\n return spacingInput;\n }\n });\n spacing.mui = true;\n return spacing;\n}", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.duration = exports.easing = void 0;\n\nvar _objectWithoutProperties2 = _interopRequireDefault(require(\"@babel/runtime/helpers/objectWithoutProperties\"));\n\n// Follow https://material.google.com/motion/duration-easing.html#duration-easing-natural-easing-curves\n// to learn the context in which each easing should be used.\nvar easing = {\n // This is the most common easing curve.\n easeInOut: 'cubic-bezier(0.4, 0, 0.2, 1)',\n // Objects enter the screen at full velocity from off-screen and\n // slowly decelerate to a resting point.\n easeOut: 'cubic-bezier(0.0, 0, 0.2, 1)',\n // Objects leave the screen at full velocity. They do not decelerate when off-screen.\n easeIn: 'cubic-bezier(0.4, 0, 1, 1)',\n // The sharp curve is used by objects that may return to the screen at any time.\n sharp: 'cubic-bezier(0.4, 0, 0.6, 1)'\n}; // Follow https://material.io/guidelines/motion/duration-easing.html#duration-easing-common-durations\n// to learn when use what timing\n\nexports.easing = easing;\nvar duration = {\n shortest: 150,\n shorter: 200,\n short: 250,\n // most basic recommended timing\n standard: 300,\n // this is to be used in complex animations\n complex: 375,\n // recommended when something is entering screen\n enteringScreen: 225,\n // recommended when something is leaving screen\n leavingScreen: 195\n};\nexports.duration = duration;\n\nfunction formatMs(milliseconds) {\n return \"\".concat(Math.round(milliseconds), \"ms\");\n}\n/**\n * @param {string|Array} props\n * @param {object} param\n * @param {string} param.prop\n * @param {number} param.duration\n * @param {string} param.easing\n * @param {number} param.delay\n */\n\n\nvar _default = {\n easing: easing,\n duration: duration,\n create: function create() {\n var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['all'];\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var _options$duration = options.duration,\n durationOption = _options$duration === void 0 ? duration.standard : _options$duration,\n _options$easing = options.easing,\n easingOption = _options$easing === void 0 ? easing.easeInOut : _options$easing,\n _options$delay = options.delay,\n delay = _options$delay === void 0 ? 0 : _options$delay,\n other = (0, _objectWithoutProperties2.default)(options, [\"duration\", \"easing\", \"delay\"]);\n\n if (process.env.NODE_ENV !== 'production') {\n var isString = function isString(value) {\n return typeof value === 'string';\n };\n\n var isNumber = function isNumber(value) {\n return !isNaN(parseFloat(value));\n };\n\n if (!isString(props) && !Array.isArray(props)) {\n console.error('Material-UI: Argument \"props\" must be a string or Array.');\n }\n\n if (!isNumber(durationOption) && !isString(durationOption)) {\n console.error(\"Material-UI: Argument \\\"duration\\\" must be a number or a string but found \".concat(durationOption, \".\"));\n }\n\n if (!isString(easingOption)) {\n console.error('Material-UI: Argument \"easing\" must be a string.');\n }\n\n if (!isNumber(delay) && !isString(delay)) {\n console.error('Material-UI: Argument \"delay\" must be a number or a string.');\n }\n\n if (Object.keys(other).length !== 0) {\n console.error(\"Material-UI: Unrecognized argument(s) [\".concat(Object.keys(other).join(','), \"].\"));\n }\n }\n\n return (Array.isArray(props) ? props : [props]).map(function (animatedProp) {\n return \"\".concat(animatedProp, \" \").concat(typeof durationOption === 'string' ? durationOption : formatMs(durationOption), \" \").concat(easingOption, \" \").concat(typeof delay === 'string' ? delay : formatMs(delay));\n }).join(',');\n },\n getAutoHeightDuration: function getAutoHeightDuration(height) {\n if (!height) {\n return 0;\n }\n\n var constant = height / 36; // https://www.wolframalpha.com/input/?i=(4+%2B+15+*+(x+%2F+36+)+**+0.25+%2B+(x+%2F+36)+%2F+5)+*+10\n\n return Math.round((4 + 15 * Math.pow(constant, 0.25) + constant / 5) * 10);\n }\n};\nexports.default = _default;", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n// We need to centralize the zIndex definitions as they work\n// like global values in the browser.\nvar zIndex = {\n mobileStepper: 1000,\n speedDial: 1050,\n appBar: 1100,\n drawer: 1200,\n modal: 1300,\n snackbar: 1400,\n tooltip: 1500\n};\nvar _default = zIndex;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.createMuiTheme = createMuiTheme;\nexports.default = void 0;\n\nvar _defineProperty2 = _interopRequireDefault(require(\"@babel/runtime/helpers/defineProperty\"));\n\nvar _objectWithoutProperties2 = _interopRequireDefault(require(\"@babel/runtime/helpers/objectWithoutProperties\"));\n\nvar _utils = require(\"@material-ui/utils\");\n\nvar _createBreakpoints = _interopRequireDefault(require(\"./createBreakpoints\"));\n\nvar _createMixins = _interopRequireDefault(require(\"./createMixins\"));\n\nvar _createPalette = _interopRequireDefault(require(\"./createPalette\"));\n\nvar _createTypography = _interopRequireDefault(require(\"./createTypography\"));\n\nvar _shadows = _interopRequireDefault(require(\"./shadows\"));\n\nvar _shape = _interopRequireDefault(require(\"./shape\"));\n\nvar _createSpacing = _interopRequireDefault(require(\"./createSpacing\"));\n\nvar _transitions = _interopRequireDefault(require(\"./transitions\"));\n\nvar _zIndex = _interopRequireDefault(require(\"./zIndex\"));\n\nfunction createTheme() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var _options$breakpoints = options.breakpoints,\n breakpointsInput = _options$breakpoints === void 0 ? {} : _options$breakpoints,\n _options$mixins = options.mixins,\n mixinsInput = _options$mixins === void 0 ? {} : _options$mixins,\n _options$palette = options.palette,\n paletteInput = _options$palette === void 0 ? {} : _options$palette,\n spacingInput = options.spacing,\n _options$typography = options.typography,\n typographyInput = _options$typography === void 0 ? {} : _options$typography,\n other = (0, _objectWithoutProperties2.default)(options, [\"breakpoints\", \"mixins\", \"palette\", \"spacing\", \"typography\"]);\n var palette = (0, _createPalette.default)(paletteInput);\n var breakpoints = (0, _createBreakpoints.default)(breakpointsInput);\n var spacing = (0, _createSpacing.default)(spacingInput);\n var muiTheme = (0, _utils.deepmerge)({\n breakpoints: breakpoints,\n direction: 'ltr',\n mixins: (0, _createMixins.default)(breakpoints, spacing, mixinsInput),\n overrides: {},\n // Inject custom styles\n palette: palette,\n props: {},\n // Provide default props\n shadows: _shadows.default,\n typography: (0, _createTypography.default)(palette, typographyInput),\n spacing: spacing,\n shape: _shape.default,\n transitions: _transitions.default,\n zIndex: _zIndex.default\n }, other);\n\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n muiTheme = args.reduce(function (acc, argument) {\n return (0, _utils.deepmerge)(acc, argument);\n }, muiTheme);\n\n if (process.env.NODE_ENV !== 'production') {\n var pseudoClasses = ['checked', 'disabled', 'error', 'focused', 'focusVisible', 'required', 'expanded', 'selected'];\n\n var traverse = function traverse(node, parentKey) {\n var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n var key; // eslint-disable-next-line guard-for-in, no-restricted-syntax\n\n for (key in node) {\n var child = node[key];\n\n if (depth === 1) {\n if (key.indexOf('Mui') === 0 && child) {\n traverse(child, key, depth + 1);\n }\n } else if (pseudoClasses.indexOf(key) !== -1 && Object.keys(child).length > 0) {\n if (process.env.NODE_ENV !== 'production') {\n console.error([\"Material-UI: The `\".concat(parentKey, \"` component increases \") + \"the CSS specificity of the `\".concat(key, \"` internal state.\"), 'You can not override it like this: ', JSON.stringify(node, null, 2), '', 'Instead, you need to use the $ruleName syntax:', JSON.stringify({\n root: (0, _defineProperty2.default)({}, \"&$\".concat(key), child)\n }, null, 2), '', 'https://mui.com/r/pseudo-classes-guide'].join('\\n'));\n } // Remove the style to prevent global conflicts.\n\n\n node[key] = {};\n }\n }\n };\n\n traverse(muiTheme.overrides);\n }\n\n return muiTheme;\n}\n\nvar warnedOnce = false;\n\nfunction createMuiTheme() {\n if (process.env.NODE_ENV !== 'production') {\n if (!warnedOnce) {\n warnedOnce = true;\n console.error(['Material-UI: the createMuiTheme function was renamed to createTheme.', '', \"You should use `import { createTheme } from '@material-ui/core/styles'`\"].join('\\n'));\n }\n }\n\n return createTheme.apply(void 0, arguments);\n}\n\nvar _default = createTheme;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = createMuiStrictModeTheme;\n\nvar _utils = require(\"@material-ui/utils\");\n\nvar _createTheme = _interopRequireDefault(require(\"./createTheme\"));\n\nfunction createMuiStrictModeTheme(options) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n return _createTheme.default.apply(void 0, [(0, _utils.deepmerge)({\n unstable_strictMode: true\n }, options)].concat(args));\n}", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar hasSymbol = typeof Symbol === 'function' && Symbol.for;\n\nvar _default = hasSymbol ? Symbol.for('mui.nested') : '__THEME_NESTED__';\n\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = createGenerateClassName;\n\nvar _nested = _interopRequireDefault(require(\"../ThemeProvider/nested\"));\n\n/**\n * This is the list of the style rule name we use as drop in replacement for the built-in\n * pseudo classes (:checked, :disabled, :focused, etc.).\n *\n * Why do they exist in the first place?\n * These classes are used at a specificity of 2.\n * It allows them to override previously definied styles as well as\n * being untouched by simple user overrides.\n */\nvar pseudoClasses = ['checked', 'disabled', 'error', 'focused', 'focusVisible', 'required', 'expanded', 'selected']; // Returns a function which generates unique class names based on counters.\n// When new generator function is created, rule counter is reset.\n// We need to reset the rule counter for SSR for each request.\n//\n// It's inspired by\n// https://github.com/cssinjs/jss/blob/4e6a05dd3f7b6572fdd3ab216861d9e446c20331/src/utils/createGenerateClassName.js\n\nfunction createGenerateClassName() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var _options$disableGloba = options.disableGlobal,\n disableGlobal = _options$disableGloba === void 0 ? false : _options$disableGloba,\n _options$productionPr = options.productionPrefix,\n productionPrefix = _options$productionPr === void 0 ? 'jss' : _options$productionPr,\n _options$seed = options.seed,\n seed = _options$seed === void 0 ? '' : _options$seed;\n var seedPrefix = seed === '' ? '' : \"\".concat(seed, \"-\");\n var ruleCounter = 0;\n\n var getNextCounterId = function getNextCounterId() {\n ruleCounter += 1;\n\n if (process.env.NODE_ENV !== 'production') {\n if (ruleCounter >= 1e10) {\n console.warn(['Material-UI: You might have a memory leak.', 'The ruleCounter is not supposed to grow that much.'].join(''));\n }\n }\n\n return ruleCounter;\n };\n\n return function (rule, styleSheet) {\n var name = styleSheet.options.name; // Is a global static MUI style?\n\n if (name && name.indexOf('Mui') === 0 && !styleSheet.options.link && !disableGlobal) {\n // We can use a shorthand class name, we never use the keys to style the components.\n if (pseudoClasses.indexOf(rule.key) !== -1) {\n return \"Mui-\".concat(rule.key);\n }\n\n var prefix = \"\".concat(seedPrefix).concat(name, \"-\").concat(rule.key);\n\n if (!styleSheet.options.theme[_nested.default] || seed !== '') {\n return prefix;\n }\n\n return \"\".concat(prefix, \"-\").concat(getNextCounterId());\n }\n\n if (process.env.NODE_ENV === 'production') {\n return \"\".concat(seedPrefix).concat(productionPrefix).concat(getNextCounterId());\n }\n\n var suffix = \"\".concat(rule.key, \"-\").concat(getNextCounterId()); // Help with debuggability.\n\n if (styleSheet.options.classNamePrefix) {\n return \"\".concat(seedPrefix).concat(styleSheet.options.classNamePrefix, \"-\").concat(suffix);\n }\n\n return \"\".concat(seedPrefix).concat(suffix);\n };\n}", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function get() {\n return _createGenerateClassName.default;\n }\n});\n\nvar _createGenerateClassName = _interopRequireDefault(require(\"./createGenerateClassName\"));", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = createStyles;\n\nfunction createStyles(styles) {\n return styles;\n}", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function get() {\n return _createStyles.default;\n }\n});\n\nvar _createStyles = _interopRequireDefault(require(\"./createStyles\"));", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = getThemeProps;\n\n/* eslint-disable no-restricted-syntax */\nfunction getThemeProps(params) {\n var theme = params.theme,\n name = params.name,\n props = params.props;\n\n if (!theme || !theme.props || !theme.props[name]) {\n return props;\n } // Resolve default props, code borrow from React source.\n // https://github.com/facebook/react/blob/15a8f031838a553e41c0b66eb1bcf1da8448104d/packages/react/src/ReactElement.js#L221\n\n\n var defaultProps = theme.props[name];\n var propName;\n\n for (propName in defaultProps) {\n if (props[propName] === undefined) {\n props[propName] = defaultProps[propName];\n }\n }\n\n return props;\n}", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function get() {\n return _getThemeProps.default;\n }\n});\n\nvar _getThemeProps = _interopRequireDefault(require(\"./getThemeProps\"));", "'use strict';\n\nvar isProduction = process.env.NODE_ENV === 'production';\nfunction warning(condition, message) {\n if (!isProduction) {\n if (condition) {\n return;\n }\n\n var text = \"Warning: \" + message;\n\n if (typeof console !== 'undefined') {\n console.warn(text);\n }\n\n try {\n throw Error(text);\n } catch (x) {}\n }\n}\n\nmodule.exports = warning;\n", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar isBrowser = exports.isBrowser = (typeof window === \"undefined\" ? \"undefined\" : _typeof(window)) === \"object\" && (typeof document === \"undefined\" ? \"undefined\" : _typeof(document)) === 'object' && document.nodeType === 9;\n\nexports.default = isBrowser;", "var toPropertyKey = require(\"./toPropertyKey.js\");\nfunction _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);\n }\n}\nfunction _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\nmodule.exports = _createClass, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;", "function _setPrototypeOf(t, e) {\n return module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports, _setPrototypeOf(t, e);\n}\nmodule.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;", "var setPrototypeOf = require(\"./setPrototypeOf.js\");\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, setPrototypeOf(t, o);\n}\nmodule.exports = _inheritsLoose, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;", "function _assertThisInitialized(e) {\n if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n return e;\n}\nmodule.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;", "'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nvar _extends = require('@babel/runtime/helpers/extends');\nvar isInBrowser = require('is-in-browser');\nvar warning = require('tiny-warning');\nvar _createClass = require('@babel/runtime/helpers/createClass');\nvar _inheritsLoose = require('@babel/runtime/helpers/inheritsLoose');\nvar _assertThisInitialized = require('@babel/runtime/helpers/assertThisInitialized');\nvar _objectWithoutPropertiesLoose = require('@babel/runtime/helpers/objectWithoutPropertiesLoose');\n\nfunction _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }\n\nvar _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);\nvar isInBrowser__default = /*#__PURE__*/_interopDefaultLegacy(isInBrowser);\nvar warning__default = /*#__PURE__*/_interopDefaultLegacy(warning);\nvar _createClass__default = /*#__PURE__*/_interopDefaultLegacy(_createClass);\nvar _inheritsLoose__default = /*#__PURE__*/_interopDefaultLegacy(_inheritsLoose);\nvar _assertThisInitialized__default = /*#__PURE__*/_interopDefaultLegacy(_assertThisInitialized);\nvar _objectWithoutPropertiesLoose__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutPropertiesLoose);\n\nvar plainObjectConstrurctor = {}.constructor;\nfunction cloneStyle(style) {\n if (style == null || typeof style !== 'object') return style;\n if (Array.isArray(style)) return style.map(cloneStyle);\n if (style.constructor !== plainObjectConstrurctor) return style;\n var newStyle = {};\n\n for (var name in style) {\n newStyle[name] = cloneStyle(style[name]);\n }\n\n return newStyle;\n}\n\n/**\n * Create a rule instance.\n */\n\nfunction createRule(name, decl, options) {\n if (name === void 0) {\n name = 'unnamed';\n }\n\n var jss = options.jss;\n var declCopy = cloneStyle(decl);\n var rule = jss.plugins.onCreateRule(name, declCopy, options);\n if (rule) return rule; // It is an at-rule and it has no instance.\n\n if (name[0] === '@') {\n process.env.NODE_ENV !== \"production\" ? warning__default['default'](false, \"[JSS] Unknown rule \" + name) : void 0;\n }\n\n return null;\n}\n\nvar join = function join(value, by) {\n var result = '';\n\n for (var i = 0; i < value.length; i++) {\n // Remove !important from the value, it will be readded later.\n if (value[i] === '!important') break;\n if (result) result += by;\n result += value[i];\n }\n\n return result;\n};\n/**\n * Converts JSS array value to a CSS string.\n *\n * `margin: [['5px', '10px']]` > `margin: 5px 10px;`\n * `border: ['1px', '2px']` > `border: 1px, 2px;`\n * `margin: [['5px', '10px'], '!important']` > `margin: 5px 10px !important;`\n * `color: ['red', !important]` > `color: red !important;`\n */\n\n\nvar toCssValue = function toCssValue(value) {\n if (!Array.isArray(value)) return value;\n var cssValue = ''; // Support space separated values via `[['5px', '10px']]`.\n\n if (Array.isArray(value[0])) {\n for (var i = 0; i < value.length; i++) {\n if (value[i] === '!important') break;\n if (cssValue) cssValue += ', ';\n cssValue += join(value[i], ' ');\n }\n } else cssValue = join(value, ', '); // Add !important, because it was ignored.\n\n\n if (value[value.length - 1] === '!important') {\n cssValue += ' !important';\n }\n\n return cssValue;\n};\n\nfunction getWhitespaceSymbols(options) {\n if (options && options.format === false) {\n return {\n linebreak: '',\n space: ''\n };\n }\n\n return {\n linebreak: '\\n',\n space: ' '\n };\n}\n\n/**\n * Indent a string.\n * http://jsperf.com/array-join-vs-for\n */\n\nfunction indentStr(str, indent) {\n var result = '';\n\n for (var index = 0; index < indent; index++) {\n result += ' ';\n }\n\n return result + str;\n}\n/**\n * Converts a Rule to CSS string.\n */\n\n\nfunction toCss(selector, style, options) {\n if (options === void 0) {\n options = {};\n }\n\n var result = '';\n if (!style) return result;\n var _options = options,\n _options$indent = _options.indent,\n indent = _options$indent === void 0 ? 0 : _options$indent;\n var fallbacks = style.fallbacks;\n\n if (options.format === false) {\n indent = -Infinity;\n }\n\n var _getWhitespaceSymbols = getWhitespaceSymbols(options),\n linebreak = _getWhitespaceSymbols.linebreak,\n space = _getWhitespaceSymbols.space;\n\n if (selector) indent++; // Apply fallbacks first.\n\n if (fallbacks) {\n // Array syntax {fallbacks: [{prop: value}]}\n if (Array.isArray(fallbacks)) {\n for (var index = 0; index < fallbacks.length; index++) {\n var fallback = fallbacks[index];\n\n for (var prop in fallback) {\n var value = fallback[prop];\n\n if (value != null) {\n if (result) result += linebreak;\n result += indentStr(prop + \":\" + space + toCssValue(value) + \";\", indent);\n }\n }\n }\n } else {\n // Object syntax {fallbacks: {prop: value}}\n for (var _prop in fallbacks) {\n var _value = fallbacks[_prop];\n\n if (_value != null) {\n if (result) result += linebreak;\n result += indentStr(_prop + \":\" + space + toCssValue(_value) + \";\", indent);\n }\n }\n }\n }\n\n for (var _prop2 in style) {\n var _value2 = style[_prop2];\n\n if (_value2 != null && _prop2 !== 'fallbacks') {\n if (result) result += linebreak;\n result += indentStr(_prop2 + \":\" + space + toCssValue(_value2) + \";\", indent);\n }\n } // Allow empty style in this case, because properties will be added dynamically.\n\n\n if (!result && !options.allowEmpty) return result; // When rule is being stringified before selector was defined.\n\n if (!selector) return result;\n indent--;\n if (result) result = \"\" + linebreak + result + linebreak;\n return indentStr(\"\" + selector + space + \"{\" + result, indent) + indentStr('}', indent);\n}\n\nvar escapeRegex = /([[\\].#*$><+~=|^:(),\"'`\\s])/g;\nvar nativeEscape = typeof CSS !== 'undefined' && CSS.escape;\nvar escape = (function (str) {\n return nativeEscape ? nativeEscape(str) : str.replace(escapeRegex, '\\\\$1');\n});\n\nvar BaseStyleRule =\n/*#__PURE__*/\nfunction () {\n function BaseStyleRule(key, style, options) {\n this.type = 'style';\n this.isProcessed = false;\n var sheet = options.sheet,\n Renderer = options.Renderer;\n this.key = key;\n this.options = options;\n this.style = style;\n if (sheet) this.renderer = sheet.renderer;else if (Renderer) this.renderer = new Renderer();\n }\n /**\n * Get or set a style property.\n */\n\n\n var _proto = BaseStyleRule.prototype;\n\n _proto.prop = function prop(name, value, options) {\n // It's a getter.\n if (value === undefined) return this.style[name]; // Don't do anything if the value has not changed.\n\n var force = options ? options.force : false;\n if (!force && this.style[name] === value) return this;\n var newValue = value;\n\n if (!options || options.process !== false) {\n newValue = this.options.jss.plugins.onChangeValue(value, name, this);\n }\n\n var isEmpty = newValue == null || newValue === false;\n var isDefined = name in this.style; // Value is empty and wasn't defined before.\n\n if (isEmpty && !isDefined && !force) return this; // We are going to remove this value.\n\n var remove = isEmpty && isDefined;\n if (remove) delete this.style[name];else this.style[name] = newValue; // Renderable is defined if StyleSheet option `link` is true.\n\n if (this.renderable && this.renderer) {\n if (remove) this.renderer.removeProperty(this.renderable, name);else this.renderer.setProperty(this.renderable, name, newValue);\n return this;\n }\n\n var sheet = this.options.sheet;\n\n if (sheet && sheet.attached) {\n process.env.NODE_ENV !== \"production\" ? warning__default['default'](false, '[JSS] Rule is not linked. Missing sheet option \"link: true\".') : void 0;\n }\n\n return this;\n };\n\n return BaseStyleRule;\n}();\nvar StyleRule =\n/*#__PURE__*/\nfunction (_BaseStyleRule) {\n _inheritsLoose__default['default'](StyleRule, _BaseStyleRule);\n\n function StyleRule(key, style, options) {\n var _this;\n\n _this = _BaseStyleRule.call(this, key, style, options) || this;\n var selector = options.selector,\n scoped = options.scoped,\n sheet = options.sheet,\n generateId = options.generateId;\n\n if (selector) {\n _this.selectorText = selector;\n } else if (scoped !== false) {\n _this.id = generateId(_assertThisInitialized__default['default'](_assertThisInitialized__default['default'](_this)), sheet);\n _this.selectorText = \".\" + escape(_this.id);\n }\n\n return _this;\n }\n /**\n * Set selector string.\n * Attention: use this with caution. Most browsers didn't implement\n * selectorText setter, so this may result in rerendering of entire Style Sheet.\n */\n\n\n var _proto2 = StyleRule.prototype;\n\n /**\n * Apply rule to an element inline.\n */\n _proto2.applyTo = function applyTo(renderable) {\n var renderer = this.renderer;\n\n if (renderer) {\n var json = this.toJSON();\n\n for (var prop in json) {\n renderer.setProperty(renderable, prop, json[prop]);\n }\n }\n\n return this;\n }\n /**\n * Returns JSON representation of the rule.\n * Fallbacks are not supported.\n * Useful for inline styles.\n */\n ;\n\n _proto2.toJSON = function toJSON() {\n var json = {};\n\n for (var prop in this.style) {\n var value = this.style[prop];\n if (typeof value !== 'object') json[prop] = value;else if (Array.isArray(value)) json[prop] = toCssValue(value);\n }\n\n return json;\n }\n /**\n * Generates a CSS string.\n */\n ;\n\n _proto2.toString = function toString(options) {\n var sheet = this.options.sheet;\n var link = sheet ? sheet.options.link : false;\n var opts = link ? _extends__default['default']({}, options, {\n allowEmpty: true\n }) : options;\n return toCss(this.selectorText, this.style, opts);\n };\n\n _createClass__default['default'](StyleRule, [{\n key: \"selector\",\n set: function set(selector) {\n if (selector === this.selectorText) return;\n this.selectorText = selector;\n var renderer = this.renderer,\n renderable = this.renderable;\n if (!renderable || !renderer) return;\n var hasChanged = renderer.setSelector(renderable, selector); // If selector setter is not implemented, rerender the rule.\n\n if (!hasChanged) {\n renderer.replaceRule(renderable, this);\n }\n }\n /**\n * Get selector string.\n */\n ,\n get: function get() {\n return this.selectorText;\n }\n }]);\n\n return StyleRule;\n}(BaseStyleRule);\nvar pluginStyleRule = {\n onCreateRule: function onCreateRule(key, style, options) {\n if (key[0] === '@' || options.parent && options.parent.type === 'keyframes') {\n return null;\n }\n\n return new StyleRule(key, style, options);\n }\n};\n\nvar defaultToStringOptions = {\n indent: 1,\n children: true\n};\nvar atRegExp = /@([\\w-]+)/;\n/**\n * Conditional rule for @media, @supports\n */\n\nvar ConditionalRule =\n/*#__PURE__*/\nfunction () {\n function ConditionalRule(key, styles, options) {\n this.type = 'conditional';\n this.isProcessed = false;\n this.key = key;\n var atMatch = key.match(atRegExp);\n this.at = atMatch ? atMatch[1] : 'unknown'; // Key might contain a unique suffix in case the `name` passed by user was duplicate.\n\n this.query = options.name || \"@\" + this.at;\n this.options = options;\n this.rules = new RuleList(_extends__default['default']({}, options, {\n parent: this\n }));\n\n for (var name in styles) {\n this.rules.add(name, styles[name]);\n }\n\n this.rules.process();\n }\n /**\n * Get a rule.\n */\n\n\n var _proto = ConditionalRule.prototype;\n\n _proto.getRule = function getRule(name) {\n return this.rules.get(name);\n }\n /**\n * Get index of a rule.\n */\n ;\n\n _proto.indexOf = function indexOf(rule) {\n return this.rules.indexOf(rule);\n }\n /**\n * Create and register rule, run plugins.\n */\n ;\n\n _proto.addRule = function addRule(name, style, options) {\n var rule = this.rules.add(name, style, options);\n if (!rule) return null;\n this.options.jss.plugins.onProcessRule(rule);\n return rule;\n }\n /**\n * Replace rule, run plugins.\n */\n ;\n\n _proto.replaceRule = function replaceRule(name, style, options) {\n var newRule = this.rules.replace(name, style, options);\n if (newRule) this.options.jss.plugins.onProcessRule(newRule);\n return newRule;\n }\n /**\n * Generates a CSS string.\n */\n ;\n\n _proto.toString = function toString(options) {\n if (options === void 0) {\n options = defaultToStringOptions;\n }\n\n var _getWhitespaceSymbols = getWhitespaceSymbols(options),\n linebreak = _getWhitespaceSymbols.linebreak;\n\n if (options.indent == null) options.indent = defaultToStringOptions.indent;\n if (options.children == null) options.children = defaultToStringOptions.children;\n\n if (options.children === false) {\n return this.query + \" {}\";\n }\n\n var children = this.rules.toString(options);\n return children ? this.query + \" {\" + linebreak + children + linebreak + \"}\" : '';\n };\n\n return ConditionalRule;\n}();\nvar keyRegExp = /@container|@media|@supports\\s+/;\nvar pluginConditionalRule = {\n onCreateRule: function onCreateRule(key, styles, options) {\n return keyRegExp.test(key) ? new ConditionalRule(key, styles, options) : null;\n }\n};\n\nvar defaultToStringOptions$1 = {\n indent: 1,\n children: true\n};\nvar nameRegExp = /@keyframes\\s+([\\w-]+)/;\n/**\n * Rule for @keyframes\n */\n\nvar KeyframesRule =\n/*#__PURE__*/\nfunction () {\n function KeyframesRule(key, frames, options) {\n this.type = 'keyframes';\n this.at = '@keyframes';\n this.isProcessed = false;\n var nameMatch = key.match(nameRegExp);\n\n if (nameMatch && nameMatch[1]) {\n this.name = nameMatch[1];\n } else {\n this.name = 'noname';\n process.env.NODE_ENV !== \"production\" ? warning__default['default'](false, \"[JSS] Bad keyframes name \" + key) : void 0;\n }\n\n this.key = this.type + \"-\" + this.name;\n this.options = options;\n var scoped = options.scoped,\n sheet = options.sheet,\n generateId = options.generateId;\n this.id = scoped === false ? this.name : escape(generateId(this, sheet));\n this.rules = new RuleList(_extends__default['default']({}, options, {\n parent: this\n }));\n\n for (var name in frames) {\n this.rules.add(name, frames[name], _extends__default['default']({}, options, {\n parent: this\n }));\n }\n\n this.rules.process();\n }\n /**\n * Generates a CSS string.\n */\n\n\n var _proto = KeyframesRule.prototype;\n\n _proto.toString = function toString(options) {\n if (options === void 0) {\n options = defaultToStringOptions$1;\n }\n\n var _getWhitespaceSymbols = getWhitespaceSymbols(options),\n linebreak = _getWhitespaceSymbols.linebreak;\n\n if (options.indent == null) options.indent = defaultToStringOptions$1.indent;\n if (options.children == null) options.children = defaultToStringOptions$1.children;\n\n if (options.children === false) {\n return this.at + \" \" + this.id + \" {}\";\n }\n\n var children = this.rules.toString(options);\n if (children) children = \"\" + linebreak + children + linebreak;\n return this.at + \" \" + this.id + \" {\" + children + \"}\";\n };\n\n return KeyframesRule;\n}();\nvar keyRegExp$1 = /@keyframes\\s+/;\nvar refRegExp = /\\$([\\w-]+)/g;\n\nvar findReferencedKeyframe = function findReferencedKeyframe(val, keyframes) {\n if (typeof val === 'string') {\n return val.replace(refRegExp, function (match, name) {\n if (name in keyframes) {\n return keyframes[name];\n }\n\n process.env.NODE_ENV !== \"production\" ? warning__default['default'](false, \"[JSS] Referenced keyframes rule \\\"\" + name + \"\\\" is not defined.\") : void 0;\n return match;\n });\n }\n\n return val;\n};\n/**\n * Replace the reference for a animation name.\n */\n\n\nvar replaceRef = function replaceRef(style, prop, keyframes) {\n var value = style[prop];\n var refKeyframe = findReferencedKeyframe(value, keyframes);\n\n if (refKeyframe !== value) {\n style[prop] = refKeyframe;\n }\n};\n\nvar pluginKeyframesRule = {\n onCreateRule: function onCreateRule(key, frames, options) {\n return typeof key === 'string' && keyRegExp$1.test(key) ? new KeyframesRule(key, frames, options) : null;\n },\n // Animation name ref replacer.\n onProcessStyle: function onProcessStyle(style, rule, sheet) {\n if (rule.type !== 'style' || !sheet) return style;\n if ('animation-name' in style) replaceRef(style, 'animation-name', sheet.keyframes);\n if ('animation' in style) replaceRef(style, 'animation', sheet.keyframes);\n return style;\n },\n onChangeValue: function onChangeValue(val, prop, rule) {\n var sheet = rule.options.sheet;\n\n if (!sheet) {\n return val;\n }\n\n switch (prop) {\n case 'animation':\n return findReferencedKeyframe(val, sheet.keyframes);\n\n case 'animation-name':\n return findReferencedKeyframe(val, sheet.keyframes);\n\n default:\n return val;\n }\n }\n};\n\nvar KeyframeRule =\n/*#__PURE__*/\nfunction (_BaseStyleRule) {\n _inheritsLoose__default['default'](KeyframeRule, _BaseStyleRule);\n\n function KeyframeRule() {\n return _BaseStyleRule.apply(this, arguments) || this;\n }\n\n var _proto = KeyframeRule.prototype;\n\n /**\n * Generates a CSS string.\n */\n _proto.toString = function toString(options) {\n var sheet = this.options.sheet;\n var link = sheet ? sheet.options.link : false;\n var opts = link ? _extends__default['default']({}, options, {\n allowEmpty: true\n }) : options;\n return toCss(this.key, this.style, opts);\n };\n\n return KeyframeRule;\n}(BaseStyleRule);\nvar pluginKeyframeRule = {\n onCreateRule: function onCreateRule(key, style, options) {\n if (options.parent && options.parent.type === 'keyframes') {\n return new KeyframeRule(key, style, options);\n }\n\n return null;\n }\n};\n\nvar FontFaceRule =\n/*#__PURE__*/\nfunction () {\n function FontFaceRule(key, style, options) {\n this.type = 'font-face';\n this.at = '@font-face';\n this.isProcessed = false;\n this.key = key;\n this.style = style;\n this.options = options;\n }\n /**\n * Generates a CSS string.\n */\n\n\n var _proto = FontFaceRule.prototype;\n\n _proto.toString = function toString(options) {\n var _getWhitespaceSymbols = getWhitespaceSymbols(options),\n linebreak = _getWhitespaceSymbols.linebreak;\n\n if (Array.isArray(this.style)) {\n var str = '';\n\n for (var index = 0; index < this.style.length; index++) {\n str += toCss(this.at, this.style[index]);\n if (this.style[index + 1]) str += linebreak;\n }\n\n return str;\n }\n\n return toCss(this.at, this.style, options);\n };\n\n return FontFaceRule;\n}();\nvar keyRegExp$2 = /@font-face/;\nvar pluginFontFaceRule = {\n onCreateRule: function onCreateRule(key, style, options) {\n return keyRegExp$2.test(key) ? new FontFaceRule(key, style, options) : null;\n }\n};\n\nvar ViewportRule =\n/*#__PURE__*/\nfunction () {\n function ViewportRule(key, style, options) {\n this.type = 'viewport';\n this.at = '@viewport';\n this.isProcessed = false;\n this.key = key;\n this.style = style;\n this.options = options;\n }\n /**\n * Generates a CSS string.\n */\n\n\n var _proto = ViewportRule.prototype;\n\n _proto.toString = function toString(options) {\n return toCss(this.key, this.style, options);\n };\n\n return ViewportRule;\n}();\nvar pluginViewportRule = {\n onCreateRule: function onCreateRule(key, style, options) {\n return key === '@viewport' || key === '@-ms-viewport' ? new ViewportRule(key, style, options) : null;\n }\n};\n\nvar SimpleRule =\n/*#__PURE__*/\nfunction () {\n function SimpleRule(key, value, options) {\n this.type = 'simple';\n this.isProcessed = false;\n this.key = key;\n this.value = value;\n this.options = options;\n }\n /**\n * Generates a CSS string.\n */\n // eslint-disable-next-line no-unused-vars\n\n\n var _proto = SimpleRule.prototype;\n\n _proto.toString = function toString(options) {\n if (Array.isArray(this.value)) {\n var str = '';\n\n for (var index = 0; index < this.value.length; index++) {\n str += this.key + \" \" + this.value[index] + \";\";\n if (this.value[index + 1]) str += '\\n';\n }\n\n return str;\n }\n\n return this.key + \" \" + this.value + \";\";\n };\n\n return SimpleRule;\n}();\nvar keysMap = {\n '@charset': true,\n '@import': true,\n '@namespace': true\n};\nvar pluginSimpleRule = {\n onCreateRule: function onCreateRule(key, value, options) {\n return key in keysMap ? new SimpleRule(key, value, options) : null;\n }\n};\n\nvar plugins = [pluginStyleRule, pluginConditionalRule, pluginKeyframesRule, pluginKeyframeRule, pluginFontFaceRule, pluginViewportRule, pluginSimpleRule];\n\nvar defaultUpdateOptions = {\n process: true\n};\nvar forceUpdateOptions = {\n force: true,\n process: true\n /**\n * Contains rules objects and allows adding/removing etc.\n * Is used for e.g. by `StyleSheet` or `ConditionalRule`.\n */\n\n};\n\nvar RuleList =\n/*#__PURE__*/\nfunction () {\n // Rules registry for access by .get() method.\n // It contains the same rule registered by name and by selector.\n // Original styles object.\n // Used to ensure correct rules order.\n function RuleList(options) {\n this.map = {};\n this.raw = {};\n this.index = [];\n this.counter = 0;\n this.options = options;\n this.classes = options.classes;\n this.keyframes = options.keyframes;\n }\n /**\n * Create and register rule.\n *\n * Will not render after Style Sheet was rendered the first time.\n */\n\n\n var _proto = RuleList.prototype;\n\n _proto.add = function add(name, decl, ruleOptions) {\n var _this$options = this.options,\n parent = _this$options.parent,\n sheet = _this$options.sheet,\n jss = _this$options.jss,\n Renderer = _this$options.Renderer,\n generateId = _this$options.generateId,\n scoped = _this$options.scoped;\n\n var options = _extends__default['default']({\n classes: this.classes,\n parent: parent,\n sheet: sheet,\n jss: jss,\n Renderer: Renderer,\n generateId: generateId,\n scoped: scoped,\n name: name,\n keyframes: this.keyframes,\n selector: undefined\n }, ruleOptions); // When user uses .createStyleSheet(), duplicate names are not possible, but\n // `sheet.addRule()` opens the door for any duplicate rule name. When this happens\n // we need to make the key unique within this RuleList instance scope.\n\n\n var key = name;\n\n if (name in this.raw) {\n key = name + \"-d\" + this.counter++;\n } // We need to save the original decl before creating the rule\n // because cache plugin needs to use it as a key to return a cached rule.\n\n\n this.raw[key] = decl;\n\n if (key in this.classes) {\n // E.g. rules inside of @media container\n options.selector = \".\" + escape(this.classes[key]);\n }\n\n var rule = createRule(key, decl, options);\n if (!rule) return null;\n this.register(rule);\n var index = options.index === undefined ? this.index.length : options.index;\n this.index.splice(index, 0, rule);\n return rule;\n }\n /**\n * Replace rule.\n * Create a new rule and remove old one instead of overwriting\n * because we want to invoke onCreateRule hook to make plugins work.\n */\n ;\n\n _proto.replace = function replace(name, decl, ruleOptions) {\n var oldRule = this.get(name);\n var oldIndex = this.index.indexOf(oldRule);\n\n if (oldRule) {\n this.remove(oldRule);\n }\n\n var options = ruleOptions;\n if (oldIndex !== -1) options = _extends__default['default']({}, ruleOptions, {\n index: oldIndex\n });\n return this.add(name, decl, options);\n }\n /**\n * Get a rule by name or selector.\n */\n ;\n\n _proto.get = function get(nameOrSelector) {\n return this.map[nameOrSelector];\n }\n /**\n * Delete a rule.\n */\n ;\n\n _proto.remove = function remove(rule) {\n this.unregister(rule);\n delete this.raw[rule.key];\n this.index.splice(this.index.indexOf(rule), 1);\n }\n /**\n * Get index of a rule.\n */\n ;\n\n _proto.indexOf = function indexOf(rule) {\n return this.index.indexOf(rule);\n }\n /**\n * Run `onProcessRule()` plugins on every rule.\n */\n ;\n\n _proto.process = function process() {\n var plugins = this.options.jss.plugins; // We need to clone array because if we modify the index somewhere else during a loop\n // we end up with very hard-to-track-down side effects.\n\n this.index.slice(0).forEach(plugins.onProcessRule, plugins);\n }\n /**\n * Register a rule in `.map`, `.classes` and `.keyframes` maps.\n */\n ;\n\n _proto.register = function register(rule) {\n this.map[rule.key] = rule;\n\n if (rule instanceof StyleRule) {\n this.map[rule.selector] = rule;\n if (rule.id) this.classes[rule.key] = rule.id;\n } else if (rule instanceof KeyframesRule && this.keyframes) {\n this.keyframes[rule.name] = rule.id;\n }\n }\n /**\n * Unregister a rule.\n */\n ;\n\n _proto.unregister = function unregister(rule) {\n delete this.map[rule.key];\n\n if (rule instanceof StyleRule) {\n delete this.map[rule.selector];\n delete this.classes[rule.key];\n } else if (rule instanceof KeyframesRule) {\n delete this.keyframes[rule.name];\n }\n }\n /**\n * Update the function values with a new data.\n */\n ;\n\n _proto.update = function update() {\n var name;\n var data;\n var options;\n\n if (typeof (arguments.length <= 0 ? undefined : arguments[0]) === 'string') {\n name = arguments.length <= 0 ? undefined : arguments[0];\n data = arguments.length <= 1 ? undefined : arguments[1];\n options = arguments.length <= 2 ? undefined : arguments[2];\n } else {\n data = arguments.length <= 0 ? undefined : arguments[0];\n options = arguments.length <= 1 ? undefined : arguments[1];\n name = null;\n }\n\n if (name) {\n this.updateOne(this.get(name), data, options);\n } else {\n for (var index = 0; index < this.index.length; index++) {\n this.updateOne(this.index[index], data, options);\n }\n }\n }\n /**\n * Execute plugins, update rule props.\n */\n ;\n\n _proto.updateOne = function updateOne(rule, data, options) {\n if (options === void 0) {\n options = defaultUpdateOptions;\n }\n\n var _this$options2 = this.options,\n plugins = _this$options2.jss.plugins,\n sheet = _this$options2.sheet; // It is a rules container like for e.g. ConditionalRule.\n\n if (rule.rules instanceof RuleList) {\n rule.rules.update(data, options);\n return;\n }\n\n var style = rule.style;\n plugins.onUpdate(data, rule, sheet, options); // We rely on a new `style` ref in case it was mutated during onUpdate hook.\n\n if (options.process && style && style !== rule.style) {\n // We need to run the plugins in case new `style` relies on syntax plugins.\n plugins.onProcessStyle(rule.style, rule, sheet); // Update and add props.\n\n for (var prop in rule.style) {\n var nextValue = rule.style[prop];\n var prevValue = style[prop]; // We need to use `force: true` because `rule.style` has been updated during onUpdate hook, so `rule.prop()` will not update the CSSOM rule.\n // We do this comparison to avoid unneeded `rule.prop()` calls, since we have the old `style` object here.\n\n if (nextValue !== prevValue) {\n rule.prop(prop, nextValue, forceUpdateOptions);\n }\n } // Remove props.\n\n\n for (var _prop in style) {\n var _nextValue = rule.style[_prop];\n var _prevValue = style[_prop]; // We need to use `force: true` because `rule.style` has been updated during onUpdate hook, so `rule.prop()` will not update the CSSOM rule.\n // We do this comparison to avoid unneeded `rule.prop()` calls, since we have the old `style` object here.\n\n if (_nextValue == null && _nextValue !== _prevValue) {\n rule.prop(_prop, null, forceUpdateOptions);\n }\n }\n }\n }\n /**\n * Convert rules to a CSS string.\n */\n ;\n\n _proto.toString = function toString(options) {\n var str = '';\n var sheet = this.options.sheet;\n var link = sheet ? sheet.options.link : false;\n\n var _getWhitespaceSymbols = getWhitespaceSymbols(options),\n linebreak = _getWhitespaceSymbols.linebreak;\n\n for (var index = 0; index < this.index.length; index++) {\n var rule = this.index[index];\n var css = rule.toString(options); // No need to render an empty rule.\n\n if (!css && !link) continue;\n if (str) str += linebreak;\n str += css;\n }\n\n return str;\n };\n\n return RuleList;\n}();\n\nvar StyleSheet =\n/*#__PURE__*/\nfunction () {\n function StyleSheet(styles, options) {\n this.attached = false;\n this.deployed = false;\n this.classes = {};\n this.keyframes = {};\n this.options = _extends__default['default']({}, options, {\n sheet: this,\n parent: this,\n classes: this.classes,\n keyframes: this.keyframes\n });\n\n if (options.Renderer) {\n this.renderer = new options.Renderer(this);\n }\n\n this.rules = new RuleList(this.options);\n\n for (var name in styles) {\n this.rules.add(name, styles[name]);\n }\n\n this.rules.process();\n }\n /**\n * Attach renderable to the render tree.\n */\n\n\n var _proto = StyleSheet.prototype;\n\n _proto.attach = function attach() {\n if (this.attached) return this;\n if (this.renderer) this.renderer.attach();\n this.attached = true; // Order is important, because we can't use insertRule API if style element is not attached.\n\n if (!this.deployed) this.deploy();\n return this;\n }\n /**\n * Remove renderable from render tree.\n */\n ;\n\n _proto.detach = function detach() {\n if (!this.attached) return this;\n if (this.renderer) this.renderer.detach();\n this.attached = false;\n return this;\n }\n /**\n * Add a rule to the current stylesheet.\n * Will insert a rule also after the stylesheet has been rendered first time.\n */\n ;\n\n _proto.addRule = function addRule(name, decl, options) {\n var queue = this.queue; // Plugins can create rules.\n // In order to preserve the right order, we need to queue all `.addRule` calls,\n // which happen after the first `rules.add()` call.\n\n if (this.attached && !queue) this.queue = [];\n var rule = this.rules.add(name, decl, options);\n if (!rule) return null;\n this.options.jss.plugins.onProcessRule(rule);\n\n if (this.attached) {\n if (!this.deployed) return rule; // Don't insert rule directly if there is no stringified version yet.\n // It will be inserted all together when .attach is called.\n\n if (queue) queue.push(rule);else {\n this.insertRule(rule);\n\n if (this.queue) {\n this.queue.forEach(this.insertRule, this);\n this.queue = undefined;\n }\n }\n return rule;\n } // We can't add rules to a detached style node.\n // We will redeploy the sheet once user will attach it.\n\n\n this.deployed = false;\n return rule;\n }\n /**\n * Replace a rule in the current stylesheet.\n */\n ;\n\n _proto.replaceRule = function replaceRule(nameOrSelector, decl, options) {\n var oldRule = this.rules.get(nameOrSelector);\n if (!oldRule) return this.addRule(nameOrSelector, decl, options);\n var newRule = this.rules.replace(nameOrSelector, decl, options);\n\n if (newRule) {\n this.options.jss.plugins.onProcessRule(newRule);\n }\n\n if (this.attached) {\n if (!this.deployed) return newRule; // Don't replace / delete rule directly if there is no stringified version yet.\n // It will be inserted all together when .attach is called.\n\n if (this.renderer) {\n if (!newRule) {\n this.renderer.deleteRule(oldRule);\n } else if (oldRule.renderable) {\n this.renderer.replaceRule(oldRule.renderable, newRule);\n }\n }\n\n return newRule;\n } // We can't replace rules to a detached style node.\n // We will redeploy the sheet once user will attach it.\n\n\n this.deployed = false;\n return newRule;\n }\n /**\n * Insert rule into the StyleSheet\n */\n ;\n\n _proto.insertRule = function insertRule(rule) {\n if (this.renderer) {\n this.renderer.insertRule(rule);\n }\n }\n /**\n * Create and add rules.\n * Will render also after Style Sheet was rendered the first time.\n */\n ;\n\n _proto.addRules = function addRules(styles, options) {\n var added = [];\n\n for (var name in styles) {\n var rule = this.addRule(name, styles[name], options);\n if (rule) added.push(rule);\n }\n\n return added;\n }\n /**\n * Get a rule by name or selector.\n */\n ;\n\n _proto.getRule = function getRule(nameOrSelector) {\n return this.rules.get(nameOrSelector);\n }\n /**\n * Delete a rule by name.\n * Returns `true`: if rule has been deleted from the DOM.\n */\n ;\n\n _proto.deleteRule = function deleteRule(name) {\n var rule = typeof name === 'object' ? name : this.rules.get(name);\n\n if (!rule || // Style sheet was created without link: true and attached, in this case we\n // won't be able to remove the CSS rule from the DOM.\n this.attached && !rule.renderable) {\n return false;\n }\n\n this.rules.remove(rule);\n\n if (this.attached && rule.renderable && this.renderer) {\n return this.renderer.deleteRule(rule.renderable);\n }\n\n return true;\n }\n /**\n * Get index of a rule.\n */\n ;\n\n _proto.indexOf = function indexOf(rule) {\n return this.rules.indexOf(rule);\n }\n /**\n * Deploy pure CSS string to a renderable.\n */\n ;\n\n _proto.deploy = function deploy() {\n if (this.renderer) this.renderer.deploy();\n this.deployed = true;\n return this;\n }\n /**\n * Update the function values with a new data.\n */\n ;\n\n _proto.update = function update() {\n var _this$rules;\n\n (_this$rules = this.rules).update.apply(_this$rules, arguments);\n\n return this;\n }\n /**\n * Updates a single rule.\n */\n ;\n\n _proto.updateOne = function updateOne(rule, data, options) {\n this.rules.updateOne(rule, data, options);\n return this;\n }\n /**\n * Convert rules to a CSS string.\n */\n ;\n\n _proto.toString = function toString(options) {\n return this.rules.toString(options);\n };\n\n return StyleSheet;\n}();\n\nvar PluginsRegistry =\n/*#__PURE__*/\nfunction () {\n function PluginsRegistry() {\n this.plugins = {\n internal: [],\n external: []\n };\n this.registry = {};\n }\n\n var _proto = PluginsRegistry.prototype;\n\n /**\n * Call `onCreateRule` hooks and return an object if returned by a hook.\n */\n _proto.onCreateRule = function onCreateRule(name, decl, options) {\n for (var i = 0; i < this.registry.onCreateRule.length; i++) {\n var rule = this.registry.onCreateRule[i](name, decl, options);\n if (rule) return rule;\n }\n\n return null;\n }\n /**\n * Call `onProcessRule` hooks.\n */\n ;\n\n _proto.onProcessRule = function onProcessRule(rule) {\n if (rule.isProcessed) return;\n var sheet = rule.options.sheet;\n\n for (var i = 0; i < this.registry.onProcessRule.length; i++) {\n this.registry.onProcessRule[i](rule, sheet);\n }\n\n if (rule.style) this.onProcessStyle(rule.style, rule, sheet);\n rule.isProcessed = true;\n }\n /**\n * Call `onProcessStyle` hooks.\n */\n ;\n\n _proto.onProcessStyle = function onProcessStyle(style, rule, sheet) {\n for (var i = 0; i < this.registry.onProcessStyle.length; i++) {\n rule.style = this.registry.onProcessStyle[i](rule.style, rule, sheet);\n }\n }\n /**\n * Call `onProcessSheet` hooks.\n */\n ;\n\n _proto.onProcessSheet = function onProcessSheet(sheet) {\n for (var i = 0; i < this.registry.onProcessSheet.length; i++) {\n this.registry.onProcessSheet[i](sheet);\n }\n }\n /**\n * Call `onUpdate` hooks.\n */\n ;\n\n _proto.onUpdate = function onUpdate(data, rule, sheet, options) {\n for (var i = 0; i < this.registry.onUpdate.length; i++) {\n this.registry.onUpdate[i](data, rule, sheet, options);\n }\n }\n /**\n * Call `onChangeValue` hooks.\n */\n ;\n\n _proto.onChangeValue = function onChangeValue(value, prop, rule) {\n var processedValue = value;\n\n for (var i = 0; i < this.registry.onChangeValue.length; i++) {\n processedValue = this.registry.onChangeValue[i](processedValue, prop, rule);\n }\n\n return processedValue;\n }\n /**\n * Register a plugin.\n */\n ;\n\n _proto.use = function use(newPlugin, options) {\n if (options === void 0) {\n options = {\n queue: 'external'\n };\n }\n\n var plugins = this.plugins[options.queue]; // Avoids applying same plugin twice, at least based on ref.\n\n if (plugins.indexOf(newPlugin) !== -1) {\n return;\n }\n\n plugins.push(newPlugin);\n this.registry = [].concat(this.plugins.external, this.plugins.internal).reduce(function (registry, plugin) {\n for (var name in plugin) {\n if (name in registry) {\n registry[name].push(plugin[name]);\n } else {\n process.env.NODE_ENV !== \"production\" ? warning__default['default'](false, \"[JSS] Unknown hook \\\"\" + name + \"\\\".\") : void 0;\n }\n }\n\n return registry;\n }, {\n onCreateRule: [],\n onProcessRule: [],\n onProcessStyle: [],\n onProcessSheet: [],\n onChangeValue: [],\n onUpdate: []\n });\n };\n\n return PluginsRegistry;\n}();\n\n/**\n * Sheets registry to access all instances in one place.\n */\n\nvar SheetsRegistry =\n/*#__PURE__*/\nfunction () {\n function SheetsRegistry() {\n this.registry = [];\n }\n\n var _proto = SheetsRegistry.prototype;\n\n /**\n * Register a Style Sheet.\n */\n _proto.add = function add(sheet) {\n var registry = this.registry;\n var index = sheet.options.index;\n if (registry.indexOf(sheet) !== -1) return;\n\n if (registry.length === 0 || index >= this.index) {\n registry.push(sheet);\n return;\n } // Find a position.\n\n\n for (var i = 0; i < registry.length; i++) {\n if (registry[i].options.index > index) {\n registry.splice(i, 0, sheet);\n return;\n }\n }\n }\n /**\n * Reset the registry.\n */\n ;\n\n _proto.reset = function reset() {\n this.registry = [];\n }\n /**\n * Remove a Style Sheet.\n */\n ;\n\n _proto.remove = function remove(sheet) {\n var index = this.registry.indexOf(sheet);\n this.registry.splice(index, 1);\n }\n /**\n * Convert all attached sheets to a CSS string.\n */\n ;\n\n _proto.toString = function toString(_temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n attached = _ref.attached,\n options = _objectWithoutPropertiesLoose__default['default'](_ref, [\"attached\"]);\n\n var _getWhitespaceSymbols = getWhitespaceSymbols(options),\n linebreak = _getWhitespaceSymbols.linebreak;\n\n var css = '';\n\n for (var i = 0; i < this.registry.length; i++) {\n var sheet = this.registry[i];\n\n if (attached != null && sheet.attached !== attached) {\n continue;\n }\n\n if (css) css += linebreak;\n css += sheet.toString(options);\n }\n\n return css;\n };\n\n _createClass__default['default'](SheetsRegistry, [{\n key: \"index\",\n\n /**\n * Current highest index number.\n */\n get: function get() {\n return this.registry.length === 0 ? 0 : this.registry[this.registry.length - 1].options.index;\n }\n }]);\n\n return SheetsRegistry;\n}();\n\n/**\n * This is a global sheets registry. Only DomRenderer will add sheets to it.\n * On the server one should use an own SheetsRegistry instance and add the\n * sheets to it, because you need to make sure to create a new registry for\n * each request in order to not leak sheets across requests.\n */\n\nvar sheets = new SheetsRegistry();\n\n/* eslint-disable */\n\n/**\n * Now that `globalThis` is available on most platforms\n * (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis#browser_compatibility)\n * we check for `globalThis` first. `globalThis` is necessary for jss\n * to run in Agoric's secure version of JavaScript (SES). Under SES,\n * `globalThis` exists, but `window`, `self`, and `Function('return\n * this')()` are all undefined for security reasons.\n *\n * https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\n */\nvar globalThis$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' && window.Math === Math ? window : typeof self !== 'undefined' && self.Math === Math ? self : Function('return this')();\n\nvar ns = '2f1acc6c3a606b082e5eef5e54414ffb';\nif (globalThis$1[ns] == null) globalThis$1[ns] = 0; // Bundle may contain multiple JSS versions at the same time. In order to identify\n// the current version with just one short number and use it for classes generation\n// we use a counter. Also it is more accurate, because user can manually reevaluate\n// the module.\n\nvar moduleId = globalThis$1[ns]++;\n\nvar maxRules = 1e10;\n/**\n * Returns a function which generates unique class names based on counters.\n * When new generator function is created, rule counter is reseted.\n * We need to reset the rule counter for SSR for each request.\n */\n\nvar createGenerateId = function createGenerateId(options) {\n if (options === void 0) {\n options = {};\n }\n\n var ruleCounter = 0;\n\n var generateId = function generateId(rule, sheet) {\n ruleCounter += 1;\n\n if (ruleCounter > maxRules) {\n process.env.NODE_ENV !== \"production\" ? warning__default['default'](false, \"[JSS] You might have a memory leak. Rule counter is at \" + ruleCounter + \".\") : void 0;\n }\n\n var jssId = '';\n var prefix = '';\n\n if (sheet) {\n if (sheet.options.classNamePrefix) {\n prefix = sheet.options.classNamePrefix;\n }\n\n if (sheet.options.jss.id != null) {\n jssId = String(sheet.options.jss.id);\n }\n }\n\n if (options.minify) {\n // Using \"c\" because a number can't be the first char in a class name.\n return \"\" + (prefix || 'c') + moduleId + jssId + ruleCounter;\n }\n\n return prefix + rule.key + \"-\" + moduleId + (jssId ? \"-\" + jssId : '') + \"-\" + ruleCounter;\n };\n\n return generateId;\n};\n\n/**\n * Cache the value from the first time a function is called.\n */\n\nvar memoize = function memoize(fn) {\n var value;\n return function () {\n if (!value) value = fn();\n return value;\n };\n};\n/**\n * Get a style property value.\n */\n\n\nvar getPropertyValue = function getPropertyValue(cssRule, prop) {\n try {\n // Support CSSTOM.\n if (cssRule.attributeStyleMap) {\n return cssRule.attributeStyleMap.get(prop);\n }\n\n return cssRule.style.getPropertyValue(prop);\n } catch (err) {\n // IE may throw if property is unknown.\n return '';\n }\n};\n/**\n * Set a style property.\n */\n\n\nvar setProperty = function setProperty(cssRule, prop, value) {\n try {\n var cssValue = value;\n\n if (Array.isArray(value)) {\n cssValue = toCssValue(value);\n } // Support CSSTOM.\n\n\n if (cssRule.attributeStyleMap) {\n cssRule.attributeStyleMap.set(prop, cssValue);\n } else {\n var indexOfImportantFlag = cssValue ? cssValue.indexOf('!important') : -1;\n var cssValueWithoutImportantFlag = indexOfImportantFlag > -1 ? cssValue.substr(0, indexOfImportantFlag - 1) : cssValue;\n cssRule.style.setProperty(prop, cssValueWithoutImportantFlag, indexOfImportantFlag > -1 ? 'important' : '');\n }\n } catch (err) {\n // IE may throw if property is unknown.\n return false;\n }\n\n return true;\n};\n/**\n * Remove a style property.\n */\n\n\nvar removeProperty = function removeProperty(cssRule, prop) {\n try {\n // Support CSSTOM.\n if (cssRule.attributeStyleMap) {\n cssRule.attributeStyleMap.delete(prop);\n } else {\n cssRule.style.removeProperty(prop);\n }\n } catch (err) {\n process.env.NODE_ENV !== \"production\" ? warning__default['default'](false, \"[JSS] DOMException \\\"\" + err.message + \"\\\" was thrown. Tried to remove property \\\"\" + prop + \"\\\".\") : void 0;\n }\n};\n/**\n * Set the selector.\n */\n\n\nvar setSelector = function setSelector(cssRule, selectorText) {\n cssRule.selectorText = selectorText; // Return false if setter was not successful.\n // Currently works in chrome only.\n\n return cssRule.selectorText === selectorText;\n};\n/**\n * Gets the `head` element upon the first call and caches it.\n * We assume it can't be null.\n */\n\n\nvar getHead = memoize(function () {\n return document.querySelector('head');\n});\n/**\n * Find attached sheet with an index higher than the passed one.\n */\n\nfunction findHigherSheet(registry, options) {\n for (var i = 0; i < registry.length; i++) {\n var sheet = registry[i];\n\n if (sheet.attached && sheet.options.index > options.index && sheet.options.insertionPoint === options.insertionPoint) {\n return sheet;\n }\n }\n\n return null;\n}\n/**\n * Find attached sheet with the highest index.\n */\n\n\nfunction findHighestSheet(registry, options) {\n for (var i = registry.length - 1; i >= 0; i--) {\n var sheet = registry[i];\n\n if (sheet.attached && sheet.options.insertionPoint === options.insertionPoint) {\n return sheet;\n }\n }\n\n return null;\n}\n/**\n * Find a comment with \"jss\" inside.\n */\n\n\nfunction findCommentNode(text) {\n var head = getHead();\n\n for (var i = 0; i < head.childNodes.length; i++) {\n var node = head.childNodes[i];\n\n if (node.nodeType === 8 && node.nodeValue.trim() === text) {\n return node;\n }\n }\n\n return null;\n}\n/**\n * Find a node before which we can insert the sheet.\n */\n\n\nfunction findPrevNode(options) {\n var registry = sheets.registry;\n\n if (registry.length > 0) {\n // Try to insert before the next higher sheet.\n var sheet = findHigherSheet(registry, options);\n\n if (sheet && sheet.renderer) {\n return {\n parent: sheet.renderer.element.parentNode,\n node: sheet.renderer.element\n };\n } // Otherwise insert after the last attached.\n\n\n sheet = findHighestSheet(registry, options);\n\n if (sheet && sheet.renderer) {\n return {\n parent: sheet.renderer.element.parentNode,\n node: sheet.renderer.element.nextSibling\n };\n }\n } // Try to find a comment placeholder if registry is empty.\n\n\n var insertionPoint = options.insertionPoint;\n\n if (insertionPoint && typeof insertionPoint === 'string') {\n var comment = findCommentNode(insertionPoint);\n\n if (comment) {\n return {\n parent: comment.parentNode,\n node: comment.nextSibling\n };\n } // If user specifies an insertion point and it can't be found in the document -\n // bad specificity issues may appear.\n\n\n process.env.NODE_ENV !== \"production\" ? warning__default['default'](false, \"[JSS] Insertion point \\\"\" + insertionPoint + \"\\\" not found.\") : void 0;\n }\n\n return false;\n}\n/**\n * Insert style element into the DOM.\n */\n\n\nfunction insertStyle(style, options) {\n var insertionPoint = options.insertionPoint;\n var nextNode = findPrevNode(options);\n\n if (nextNode !== false && nextNode.parent) {\n nextNode.parent.insertBefore(style, nextNode.node);\n return;\n } // Works with iframes and any node types.\n\n\n if (insertionPoint && typeof insertionPoint.nodeType === 'number') {\n var insertionPointElement = insertionPoint;\n var parentNode = insertionPointElement.parentNode;\n if (parentNode) parentNode.insertBefore(style, insertionPointElement.nextSibling);else process.env.NODE_ENV !== \"production\" ? warning__default['default'](false, '[JSS] Insertion point is not in the DOM.') : void 0;\n return;\n }\n\n getHead().appendChild(style);\n}\n/**\n * Read jss nonce setting from the page if the user has set it.\n */\n\n\nvar getNonce = memoize(function () {\n var node = document.querySelector('meta[property=\"csp-nonce\"]');\n return node ? node.getAttribute('content') : null;\n});\n\nvar _insertRule = function insertRule(container, rule, index) {\n try {\n if ('insertRule' in container) {\n container.insertRule(rule, index);\n } // Keyframes rule.\n else if ('appendRule' in container) {\n container.appendRule(rule);\n }\n } catch (err) {\n process.env.NODE_ENV !== \"production\" ? warning__default['default'](false, \"[JSS] \" + err.message) : void 0;\n return false;\n }\n\n return container.cssRules[index];\n};\n\nvar getValidRuleInsertionIndex = function getValidRuleInsertionIndex(container, index) {\n var maxIndex = container.cssRules.length; // In case previous insertion fails, passed index might be wrong\n\n if (index === undefined || index > maxIndex) {\n // eslint-disable-next-line no-param-reassign\n return maxIndex;\n }\n\n return index;\n};\n\nvar createStyle = function createStyle() {\n var el = document.createElement('style'); // Without it, IE will have a broken source order specificity if we\n // insert rules after we insert the style tag.\n // It seems to kick-off the source order specificity algorithm.\n\n el.textContent = '\\n';\n return el;\n};\n\nvar DomRenderer =\n/*#__PURE__*/\nfunction () {\n // Will be empty if link: true option is not set, because\n // it is only for use together with insertRule API.\n function DomRenderer(sheet) {\n this.getPropertyValue = getPropertyValue;\n this.setProperty = setProperty;\n this.removeProperty = removeProperty;\n this.setSelector = setSelector;\n this.hasInsertedRules = false;\n this.cssRules = [];\n // There is no sheet when the renderer is used from a standalone StyleRule.\n if (sheet) sheets.add(sheet);\n this.sheet = sheet;\n\n var _ref = this.sheet ? this.sheet.options : {},\n media = _ref.media,\n meta = _ref.meta,\n element = _ref.element;\n\n this.element = element || createStyle();\n this.element.setAttribute('data-jss', '');\n if (media) this.element.setAttribute('media', media);\n if (meta) this.element.setAttribute('data-meta', meta);\n var nonce = getNonce();\n if (nonce) this.element.setAttribute('nonce', nonce);\n }\n /**\n * Insert style element into render tree.\n */\n\n\n var _proto = DomRenderer.prototype;\n\n _proto.attach = function attach() {\n // In the case the element node is external and it is already in the DOM.\n if (this.element.parentNode || !this.sheet) return;\n insertStyle(this.element, this.sheet.options); // When rules are inserted using `insertRule` API, after `sheet.detach().attach()`\n // most browsers create a new CSSStyleSheet, except of all IEs.\n\n var deployed = Boolean(this.sheet && this.sheet.deployed);\n\n if (this.hasInsertedRules && deployed) {\n this.hasInsertedRules = false;\n this.deploy();\n }\n }\n /**\n * Remove style element from render tree.\n */\n ;\n\n _proto.detach = function detach() {\n if (!this.sheet) return;\n var parentNode = this.element.parentNode;\n if (parentNode) parentNode.removeChild(this.element); // In the most browsers, rules inserted using insertRule() API will be lost when style element is removed.\n // Though IE will keep them and we need a consistent behavior.\n\n if (this.sheet.options.link) {\n this.cssRules = [];\n this.element.textContent = '\\n';\n }\n }\n /**\n * Inject CSS string into element.\n */\n ;\n\n _proto.deploy = function deploy() {\n var sheet = this.sheet;\n if (!sheet) return;\n\n if (sheet.options.link) {\n this.insertRules(sheet.rules);\n return;\n }\n\n this.element.textContent = \"\\n\" + sheet.toString() + \"\\n\";\n }\n /**\n * Insert RuleList into an element.\n */\n ;\n\n _proto.insertRules = function insertRules(rules, nativeParent) {\n for (var i = 0; i < rules.index.length; i++) {\n this.insertRule(rules.index[i], i, nativeParent);\n }\n }\n /**\n * Insert a rule into element.\n */\n ;\n\n _proto.insertRule = function insertRule(rule, index, nativeParent) {\n if (nativeParent === void 0) {\n nativeParent = this.element.sheet;\n }\n\n if (rule.rules) {\n var parent = rule;\n var latestNativeParent = nativeParent;\n\n if (rule.type === 'conditional' || rule.type === 'keyframes') {\n var _insertionIndex = getValidRuleInsertionIndex(nativeParent, index); // We need to render the container without children first.\n\n\n latestNativeParent = _insertRule(nativeParent, parent.toString({\n children: false\n }), _insertionIndex);\n\n if (latestNativeParent === false) {\n return false;\n }\n\n this.refCssRule(rule, _insertionIndex, latestNativeParent);\n }\n\n this.insertRules(parent.rules, latestNativeParent);\n return latestNativeParent;\n }\n\n var ruleStr = rule.toString();\n if (!ruleStr) return false;\n var insertionIndex = getValidRuleInsertionIndex(nativeParent, index);\n\n var nativeRule = _insertRule(nativeParent, ruleStr, insertionIndex);\n\n if (nativeRule === false) {\n return false;\n }\n\n this.hasInsertedRules = true;\n this.refCssRule(rule, insertionIndex, nativeRule);\n return nativeRule;\n };\n\n _proto.refCssRule = function refCssRule(rule, index, cssRule) {\n rule.renderable = cssRule; // We only want to reference the top level rules, deleteRule API doesn't support removing nested rules\n // like rules inside media queries or keyframes\n\n if (rule.options.parent instanceof StyleSheet) {\n this.cssRules.splice(index, 0, cssRule);\n }\n }\n /**\n * Delete a rule.\n */\n ;\n\n _proto.deleteRule = function deleteRule(cssRule) {\n var sheet = this.element.sheet;\n var index = this.indexOf(cssRule);\n if (index === -1) return false;\n sheet.deleteRule(index);\n this.cssRules.splice(index, 1);\n return true;\n }\n /**\n * Get index of a CSS Rule.\n */\n ;\n\n _proto.indexOf = function indexOf(cssRule) {\n return this.cssRules.indexOf(cssRule);\n }\n /**\n * Generate a new CSS rule and replace the existing one.\n */\n ;\n\n _proto.replaceRule = function replaceRule(cssRule, rule) {\n var index = this.indexOf(cssRule);\n if (index === -1) return false;\n this.element.sheet.deleteRule(index);\n this.cssRules.splice(index, 1);\n return this.insertRule(rule, index);\n }\n /**\n * Get all rules elements.\n */\n ;\n\n _proto.getRules = function getRules() {\n return this.element.sheet.cssRules;\n };\n\n return DomRenderer;\n}();\n\nvar instanceCounter = 0;\n\nvar Jss =\n/*#__PURE__*/\nfunction () {\n function Jss(options) {\n this.id = instanceCounter++;\n this.version = \"10.10.0\";\n this.plugins = new PluginsRegistry();\n this.options = {\n id: {\n minify: false\n },\n createGenerateId: createGenerateId,\n Renderer: isInBrowser__default['default'] ? DomRenderer : null,\n plugins: []\n };\n this.generateId = createGenerateId({\n minify: false\n });\n\n for (var i = 0; i < plugins.length; i++) {\n this.plugins.use(plugins[i], {\n queue: 'internal'\n });\n }\n\n this.setup(options);\n }\n /**\n * Prepares various options, applies plugins.\n * Should not be used twice on the same instance, because there is no plugins\n * deduplication logic.\n */\n\n\n var _proto = Jss.prototype;\n\n _proto.setup = function setup(options) {\n if (options === void 0) {\n options = {};\n }\n\n if (options.createGenerateId) {\n this.options.createGenerateId = options.createGenerateId;\n }\n\n if (options.id) {\n this.options.id = _extends__default['default']({}, this.options.id, options.id);\n }\n\n if (options.createGenerateId || options.id) {\n this.generateId = this.options.createGenerateId(this.options.id);\n }\n\n if (options.insertionPoint != null) this.options.insertionPoint = options.insertionPoint;\n\n if ('Renderer' in options) {\n this.options.Renderer = options.Renderer;\n } // eslint-disable-next-line prefer-spread\n\n\n if (options.plugins) this.use.apply(this, options.plugins);\n return this;\n }\n /**\n * Create a Style Sheet.\n */\n ;\n\n _proto.createStyleSheet = function createStyleSheet(styles, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n index = _options.index;\n\n if (typeof index !== 'number') {\n index = sheets.index === 0 ? 0 : sheets.index + 1;\n }\n\n var sheet = new StyleSheet(styles, _extends__default['default']({}, options, {\n jss: this,\n generateId: options.generateId || this.generateId,\n insertionPoint: this.options.insertionPoint,\n Renderer: this.options.Renderer,\n index: index\n }));\n this.plugins.onProcessSheet(sheet);\n return sheet;\n }\n /**\n * Detach the Style Sheet and remove it from the registry.\n */\n ;\n\n _proto.removeStyleSheet = function removeStyleSheet(sheet) {\n sheet.detach();\n sheets.remove(sheet);\n return this;\n }\n /**\n * Create a rule without a Style Sheet.\n * [Deprecated] will be removed in the next major version.\n */\n ;\n\n _proto.createRule = function createRule$1(name, style, options) {\n if (style === void 0) {\n style = {};\n }\n\n if (options === void 0) {\n options = {};\n }\n\n // Enable rule without name for inline styles.\n if (typeof name === 'object') {\n return this.createRule(undefined, name, style);\n }\n\n var ruleOptions = _extends__default['default']({}, options, {\n name: name,\n jss: this,\n Renderer: this.options.Renderer\n });\n\n if (!ruleOptions.generateId) ruleOptions.generateId = this.generateId;\n if (!ruleOptions.classes) ruleOptions.classes = {};\n if (!ruleOptions.keyframes) ruleOptions.keyframes = {};\n\n var rule = createRule(name, style, ruleOptions);\n\n if (rule) this.plugins.onProcessRule(rule);\n return rule;\n }\n /**\n * Register plugin. Passed function will be invoked with a rule instance.\n */\n ;\n\n _proto.use = function use() {\n var _this = this;\n\n for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {\n plugins[_key] = arguments[_key];\n }\n\n plugins.forEach(function (plugin) {\n _this.plugins.use(plugin);\n });\n return this;\n };\n\n return Jss;\n}();\n\nvar createJss = function createJss(options) {\n return new Jss(options);\n};\n\n/**\n * SheetsManager is like a WeakMap which is designed to count StyleSheet\n * instances and attach/detach automatically.\n * Used in react-jss.\n */\n\nvar SheetsManager =\n/*#__PURE__*/\nfunction () {\n function SheetsManager() {\n this.length = 0;\n this.sheets = new WeakMap();\n }\n\n var _proto = SheetsManager.prototype;\n\n _proto.get = function get(key) {\n var entry = this.sheets.get(key);\n return entry && entry.sheet;\n };\n\n _proto.add = function add(key, sheet) {\n if (this.sheets.has(key)) return;\n this.length++;\n this.sheets.set(key, {\n sheet: sheet,\n refs: 0\n });\n };\n\n _proto.manage = function manage(key) {\n var entry = this.sheets.get(key);\n\n if (entry) {\n if (entry.refs === 0) {\n entry.sheet.attach();\n }\n\n entry.refs++;\n return entry.sheet;\n }\n\n warning__default['default'](false, \"[JSS] SheetsManager: can't find sheet to manage\");\n return undefined;\n };\n\n _proto.unmanage = function unmanage(key) {\n var entry = this.sheets.get(key);\n\n if (entry) {\n if (entry.refs > 0) {\n entry.refs--;\n if (entry.refs === 0) entry.sheet.detach();\n }\n } else {\n warning__default['default'](false, \"SheetsManager: can't find sheet to unmanage\");\n }\n };\n\n _createClass__default['default'](SheetsManager, [{\n key: \"size\",\n get: function get() {\n return this.length;\n }\n }]);\n\n return SheetsManager;\n}();\n\n/**\n* Export a constant indicating if this browser has CSSTOM support.\n* https://developers.google.com/web/updates/2018/03/cssom\n*/\nvar hasCSSTOMSupport = typeof CSS === 'object' && CSS != null && 'number' in CSS;\n\n/**\n * Extracts a styles object with only props that contain function values.\n */\nfunction getDynamicStyles(styles) {\n var to = null;\n\n for (var key in styles) {\n var value = styles[key];\n var type = typeof value;\n\n if (type === 'function') {\n if (!to) to = {};\n to[key] = value;\n } else if (type === 'object' && value !== null && !Array.isArray(value)) {\n var extracted = getDynamicStyles(value);\n\n if (extracted) {\n if (!to) to = {};\n to[key] = extracted;\n }\n }\n }\n\n return to;\n}\n\n/**\n * A better abstraction over CSS.\n *\n * @copyright Oleg Isonen (Slobodskoi) / Isonen 2014-present\n * @website https://github.com/cssinjs/jss\n * @license MIT\n */\nvar index = createJss();\n\nexports.RuleList = RuleList;\nexports.SheetsManager = SheetsManager;\nexports.SheetsRegistry = SheetsRegistry;\nexports.create = createJss;\nexports.createGenerateId = createGenerateId;\nexports.createRule = createRule;\nexports.default = index;\nexports.getDynamicStyles = getDynamicStyles;\nexports.hasCSSTOMSupport = hasCSSTOMSupport;\nexports.sheets = sheets;\nexports.toCssValue = toCssValue;\n", "'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nvar warning = require('tiny-warning');\nvar jss = require('jss');\n\nfunction _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }\n\nvar warning__default = /*#__PURE__*/_interopDefaultLegacy(warning);\n\nvar now = Date.now();\nvar fnValuesNs = \"fnValues\" + now;\nvar fnRuleNs = \"fnStyle\" + ++now;\n\nvar functionPlugin = function functionPlugin() {\n return {\n onCreateRule: function onCreateRule(name, decl, options) {\n if (typeof decl !== 'function') return null;\n var rule = jss.createRule(name, {}, options);\n rule[fnRuleNs] = decl;\n return rule;\n },\n onProcessStyle: function onProcessStyle(style, rule) {\n // We need to extract function values from the declaration, so that we can keep core unaware of them.\n // We need to do that only once.\n // We don't need to extract functions on each style update, since this can happen only once.\n // We don't support function values inside of function rules.\n if (fnValuesNs in rule || fnRuleNs in rule) return style;\n var fnValues = {};\n\n for (var prop in style) {\n var value = style[prop];\n if (typeof value !== 'function') continue;\n delete style[prop];\n fnValues[prop] = value;\n }\n\n rule[fnValuesNs] = fnValues;\n return style;\n },\n onUpdate: function onUpdate(data, rule, sheet, options) {\n var styleRule = rule;\n var fnRule = styleRule[fnRuleNs]; // If we have a style function, the entire rule is dynamic and style object\n // will be returned from that function.\n\n if (fnRule) {\n // Empty object will remove all currently defined props\n // in case function rule returns a falsy value.\n styleRule.style = fnRule(data) || {};\n\n if (process.env.NODE_ENV === 'development') {\n for (var prop in styleRule.style) {\n if (typeof styleRule.style[prop] === 'function') {\n process.env.NODE_ENV !== \"production\" ? warning__default['default'](false, '[JSS] Function values inside function rules are not supported.') : void 0;\n break;\n }\n }\n }\n }\n\n var fnValues = styleRule[fnValuesNs]; // If we have a fn values map, it is a rule with function values.\n\n if (fnValues) {\n for (var _prop in fnValues) {\n styleRule.prop(_prop, fnValues[_prop](data), options);\n }\n }\n }\n };\n};\n\nexports.default = functionPlugin;\n", "'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nvar _extends = require('@babel/runtime/helpers/extends');\nvar jss = require('jss');\n\nfunction _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }\n\nvar _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);\n\nvar at = '@global';\nvar atPrefix = '@global ';\n\nvar GlobalContainerRule =\n/*#__PURE__*/\nfunction () {\n function GlobalContainerRule(key, styles, options) {\n this.type = 'global';\n this.at = at;\n this.isProcessed = false;\n this.key = key;\n this.options = options;\n this.rules = new jss.RuleList(_extends__default['default']({}, options, {\n parent: this\n }));\n\n for (var selector in styles) {\n this.rules.add(selector, styles[selector]);\n }\n\n this.rules.process();\n }\n /**\n * Get a rule.\n */\n\n\n var _proto = GlobalContainerRule.prototype;\n\n _proto.getRule = function getRule(name) {\n return this.rules.get(name);\n }\n /**\n * Create and register rule, run plugins.\n */\n ;\n\n _proto.addRule = function addRule(name, style, options) {\n var rule = this.rules.add(name, style, options);\n if (rule) this.options.jss.plugins.onProcessRule(rule);\n return rule;\n }\n /**\n * Replace rule, run plugins.\n */\n ;\n\n _proto.replaceRule = function replaceRule(name, style, options) {\n var newRule = this.rules.replace(name, style, options);\n if (newRule) this.options.jss.plugins.onProcessRule(newRule);\n return newRule;\n }\n /**\n * Get index of a rule.\n */\n ;\n\n _proto.indexOf = function indexOf(rule) {\n return this.rules.indexOf(rule);\n }\n /**\n * Generates a CSS string.\n */\n ;\n\n _proto.toString = function toString(options) {\n return this.rules.toString(options);\n };\n\n return GlobalContainerRule;\n}();\n\nvar GlobalPrefixedRule =\n/*#__PURE__*/\nfunction () {\n function GlobalPrefixedRule(key, style, options) {\n this.type = 'global';\n this.at = at;\n this.isProcessed = false;\n this.key = key;\n this.options = options;\n var selector = key.substr(atPrefix.length);\n this.rule = options.jss.createRule(selector, style, _extends__default['default']({}, options, {\n parent: this\n }));\n }\n\n var _proto2 = GlobalPrefixedRule.prototype;\n\n _proto2.toString = function toString(options) {\n return this.rule ? this.rule.toString(options) : '';\n };\n\n return GlobalPrefixedRule;\n}();\n\nvar separatorRegExp = /\\s*,\\s*/g;\n\nfunction addScope(selector, scope) {\n var parts = selector.split(separatorRegExp);\n var scoped = '';\n\n for (var i = 0; i < parts.length; i++) {\n scoped += scope + \" \" + parts[i].trim();\n if (parts[i + 1]) scoped += ', ';\n }\n\n return scoped;\n}\n\nfunction handleNestedGlobalContainerRule(rule, sheet) {\n var options = rule.options,\n style = rule.style;\n var rules = style ? style[at] : null;\n if (!rules) return;\n\n for (var name in rules) {\n sheet.addRule(name, rules[name], _extends__default['default']({}, options, {\n selector: addScope(name, rule.selector)\n }));\n }\n\n delete style[at];\n}\n\nfunction handlePrefixedGlobalRule(rule, sheet) {\n var options = rule.options,\n style = rule.style;\n\n for (var prop in style) {\n if (prop[0] !== '@' || prop.substr(0, at.length) !== at) continue;\n var selector = addScope(prop.substr(at.length), rule.selector);\n sheet.addRule(selector, style[prop], _extends__default['default']({}, options, {\n selector: selector\n }));\n delete style[prop];\n }\n}\n/**\n * Convert nested rules to separate, remove them from original styles.\n */\n\n\nfunction jssGlobal() {\n function onCreateRule(name, styles, options) {\n if (!name) return null;\n\n if (name === at) {\n return new GlobalContainerRule(name, styles, options);\n }\n\n if (name[0] === '@' && name.substr(0, atPrefix.length) === atPrefix) {\n return new GlobalPrefixedRule(name, styles, options);\n }\n\n var parent = options.parent;\n\n if (parent) {\n if (parent.type === 'global' || parent.options.parent && parent.options.parent.type === 'global') {\n options.scoped = false;\n }\n }\n\n if (!options.selector && options.scoped === false) {\n options.selector = name;\n }\n\n return null;\n }\n\n function onProcessRule(rule, sheet) {\n if (rule.type !== 'style' || !sheet) return;\n handleNestedGlobalContainerRule(rule, sheet);\n handlePrefixedGlobalRule(rule, sheet);\n }\n\n return {\n onCreateRule: onCreateRule,\n onProcessRule: onProcessRule\n };\n}\n\nexports.default = jssGlobal;\n", "'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nvar _extends = require('@babel/runtime/helpers/extends');\nvar warning = require('tiny-warning');\n\nfunction _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }\n\nvar _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);\nvar warning__default = /*#__PURE__*/_interopDefaultLegacy(warning);\n\nvar separatorRegExp = /\\s*,\\s*/g;\nvar parentRegExp = /&/g;\nvar refRegExp = /\\$([\\w-]+)/g;\n/**\n * Convert nested rules to separate, remove them from original styles.\n */\n\nfunction jssNested() {\n // Get a function to be used for $ref replacement.\n function getReplaceRef(container, sheet) {\n return function (match, key) {\n var rule = container.getRule(key) || sheet && sheet.getRule(key);\n\n if (rule) {\n return rule.selector;\n }\n\n process.env.NODE_ENV !== \"production\" ? warning__default['default'](false, \"[JSS] Could not find the referenced rule \\\"\" + key + \"\\\" in \\\"\" + (container.options.meta || container.toString()) + \"\\\".\") : void 0;\n return key;\n };\n }\n\n function replaceParentRefs(nestedProp, parentProp) {\n var parentSelectors = parentProp.split(separatorRegExp);\n var nestedSelectors = nestedProp.split(separatorRegExp);\n var result = '';\n\n for (var i = 0; i < parentSelectors.length; i++) {\n var parent = parentSelectors[i];\n\n for (var j = 0; j < nestedSelectors.length; j++) {\n var nested = nestedSelectors[j];\n if (result) result += ', '; // Replace all & by the parent or prefix & with the parent.\n\n result += nested.indexOf('&') !== -1 ? nested.replace(parentRegExp, parent) : parent + \" \" + nested;\n }\n }\n\n return result;\n }\n\n function getOptions(rule, container, prevOptions) {\n // Options has been already created, now we only increase index.\n if (prevOptions) return _extends__default['default']({}, prevOptions, {\n index: prevOptions.index + 1\n });\n var nestingLevel = rule.options.nestingLevel;\n nestingLevel = nestingLevel === undefined ? 1 : nestingLevel + 1;\n\n var options = _extends__default['default']({}, rule.options, {\n nestingLevel: nestingLevel,\n index: container.indexOf(rule) + 1 // We don't need the parent name to be set options for chlid.\n\n });\n\n delete options.name;\n return options;\n }\n\n function onProcessStyle(style, rule, sheet) {\n if (rule.type !== 'style') return style;\n var styleRule = rule;\n var container = styleRule.options.parent;\n var options;\n var replaceRef;\n\n for (var prop in style) {\n var isNested = prop.indexOf('&') !== -1;\n var isNestedConditional = prop[0] === '@';\n if (!isNested && !isNestedConditional) continue;\n options = getOptions(styleRule, container, options);\n\n if (isNested) {\n var selector = replaceParentRefs(prop, styleRule.selector); // Lazily create the ref replacer function just once for\n // all nested rules within the sheet.\n\n if (!replaceRef) replaceRef = getReplaceRef(container, sheet); // Replace all $refs.\n\n selector = selector.replace(refRegExp, replaceRef);\n var name = styleRule.key + \"-\" + prop;\n\n if ('replaceRule' in container) {\n // for backward compatibility\n container.replaceRule(name, style[prop], _extends__default['default']({}, options, {\n selector: selector\n }));\n } else {\n container.addRule(name, style[prop], _extends__default['default']({}, options, {\n selector: selector\n }));\n }\n } else if (isNestedConditional) {\n // Place conditional right after the parent rule to ensure right ordering.\n container.addRule(prop, {}, options).addRule(styleRule.key, style[prop], {\n selector: styleRule.selector\n });\n }\n\n delete style[prop];\n }\n\n return style;\n }\n\n return {\n onProcessStyle: onProcessStyle\n };\n}\n\nexports.default = jssNested;\n", "'use strict';\n\n/* eslint-disable no-var, prefer-template */\nvar uppercasePattern = /[A-Z]/g;\nvar msPattern = /^ms-/;\nvar cache = {};\n\nfunction toHyphenLower(match) {\n return '-' + match.toLowerCase()\n}\n\nfunction hyphenateStyleName(name) {\n if (cache.hasOwnProperty(name)) {\n return cache[name]\n }\n\n var hName = name.replace(uppercasePattern, toHyphenLower);\n return (cache[name] = msPattern.test(hName) ? '-' + hName : hName)\n}\n\nmodule.exports = hyphenateStyleName;\n", "'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nvar hyphenate = require('hyphenate-style-name');\n\nfunction _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }\n\nvar hyphenate__default = /*#__PURE__*/_interopDefaultLegacy(hyphenate);\n\n/**\n * Convert camel cased property names to dash separated.\n */\n\nfunction convertCase(style) {\n var converted = {};\n\n for (var prop in style) {\n var key = prop.indexOf('--') === 0 ? prop : hyphenate__default['default'](prop);\n converted[key] = style[prop];\n }\n\n if (style.fallbacks) {\n if (Array.isArray(style.fallbacks)) converted.fallbacks = style.fallbacks.map(convertCase);else converted.fallbacks = convertCase(style.fallbacks);\n }\n\n return converted;\n}\n/**\n * Allow camel cased property names by converting them back to dasherized.\n */\n\n\nfunction camelCase() {\n function onProcessStyle(style) {\n if (Array.isArray(style)) {\n // Handle rules like @font-face, which can have multiple styles in an array\n for (var index = 0; index < style.length; index++) {\n style[index] = convertCase(style[index]);\n }\n\n return style;\n }\n\n return convertCase(style);\n }\n\n function onChangeValue(value, prop, rule) {\n if (prop.indexOf('--') === 0) {\n return value;\n }\n\n var hyphenatedProp = hyphenate__default['default'](prop); // There was no camel case in place\n\n if (prop === hyphenatedProp) return value;\n rule.prop(hyphenatedProp, value); // Core will ignore that property value we set the proper one above.\n\n return null;\n }\n\n return {\n onProcessStyle: onProcessStyle,\n onChangeValue: onChangeValue\n };\n}\n\nexports.default = camelCase;\n", "'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nvar jss = require('jss');\n\nvar px = jss.hasCSSTOMSupport && CSS ? CSS.px : 'px';\nvar ms = jss.hasCSSTOMSupport && CSS ? CSS.ms : 'ms';\nvar percent = jss.hasCSSTOMSupport && CSS ? CSS.percent : '%';\n/**\n * Generated jss-plugin-default-unit CSS property units\n */\n\nvar defaultUnits = {\n // Animation properties\n 'animation-delay': ms,\n 'animation-duration': ms,\n // Background properties\n 'background-position': px,\n 'background-position-x': px,\n 'background-position-y': px,\n 'background-size': px,\n // Border Properties\n border: px,\n 'border-bottom': px,\n 'border-bottom-left-radius': px,\n 'border-bottom-right-radius': px,\n 'border-bottom-width': px,\n 'border-left': px,\n 'border-left-width': px,\n 'border-radius': px,\n 'border-right': px,\n 'border-right-width': px,\n 'border-top': px,\n 'border-top-left-radius': px,\n 'border-top-right-radius': px,\n 'border-top-width': px,\n 'border-width': px,\n 'border-block': px,\n 'border-block-end': px,\n 'border-block-end-width': px,\n 'border-block-start': px,\n 'border-block-start-width': px,\n 'border-block-width': px,\n 'border-inline': px,\n 'border-inline-end': px,\n 'border-inline-end-width': px,\n 'border-inline-start': px,\n 'border-inline-start-width': px,\n 'border-inline-width': px,\n 'border-start-start-radius': px,\n 'border-start-end-radius': px,\n 'border-end-start-radius': px,\n 'border-end-end-radius': px,\n // Margin properties\n margin: px,\n 'margin-bottom': px,\n 'margin-left': px,\n 'margin-right': px,\n 'margin-top': px,\n 'margin-block': px,\n 'margin-block-end': px,\n 'margin-block-start': px,\n 'margin-inline': px,\n 'margin-inline-end': px,\n 'margin-inline-start': px,\n // Padding properties\n padding: px,\n 'padding-bottom': px,\n 'padding-left': px,\n 'padding-right': px,\n 'padding-top': px,\n 'padding-block': px,\n 'padding-block-end': px,\n 'padding-block-start': px,\n 'padding-inline': px,\n 'padding-inline-end': px,\n 'padding-inline-start': px,\n // Mask properties\n 'mask-position-x': px,\n 'mask-position-y': px,\n 'mask-size': px,\n // Width and height properties\n height: px,\n width: px,\n 'min-height': px,\n 'max-height': px,\n 'min-width': px,\n 'max-width': px,\n // Position properties\n bottom: px,\n left: px,\n top: px,\n right: px,\n inset: px,\n 'inset-block': px,\n 'inset-block-end': px,\n 'inset-block-start': px,\n 'inset-inline': px,\n 'inset-inline-end': px,\n 'inset-inline-start': px,\n // Shadow properties\n 'box-shadow': px,\n 'text-shadow': px,\n // Column properties\n 'column-gap': px,\n 'column-rule': px,\n 'column-rule-width': px,\n 'column-width': px,\n // Font and text properties\n 'font-size': px,\n 'font-size-delta': px,\n 'letter-spacing': px,\n 'text-decoration-thickness': px,\n 'text-indent': px,\n 'text-stroke': px,\n 'text-stroke-width': px,\n 'word-spacing': px,\n // Motion properties\n motion: px,\n 'motion-offset': px,\n // Outline properties\n outline: px,\n 'outline-offset': px,\n 'outline-width': px,\n // Perspective properties\n perspective: px,\n 'perspective-origin-x': percent,\n 'perspective-origin-y': percent,\n // Transform properties\n 'transform-origin': percent,\n 'transform-origin-x': percent,\n 'transform-origin-y': percent,\n 'transform-origin-z': percent,\n // Transition properties\n 'transition-delay': ms,\n 'transition-duration': ms,\n // Alignment properties\n 'vertical-align': px,\n 'flex-basis': px,\n // Some random properties\n 'shape-margin': px,\n size: px,\n gap: px,\n // Grid properties\n grid: px,\n 'grid-gap': px,\n 'row-gap': px,\n 'grid-row-gap': px,\n 'grid-column-gap': px,\n 'grid-template-rows': px,\n 'grid-template-columns': px,\n 'grid-auto-rows': px,\n 'grid-auto-columns': px,\n // Not existing properties.\n // Used to avoid issues with jss-plugin-expand integration.\n 'box-shadow-x': px,\n 'box-shadow-y': px,\n 'box-shadow-blur': px,\n 'box-shadow-spread': px,\n 'font-line-height': px,\n 'text-shadow-x': px,\n 'text-shadow-y': px,\n 'text-shadow-blur': px\n};\n\n/**\n * Clones the object and adds a camel cased property version.\n */\n\nfunction addCamelCasedVersion(obj) {\n var regExp = /(-[a-z])/g;\n\n var replace = function replace(str) {\n return str[1].toUpperCase();\n };\n\n var newObj = {};\n\n for (var key in obj) {\n newObj[key] = obj[key];\n newObj[key.replace(regExp, replace)] = obj[key];\n }\n\n return newObj;\n}\n\nvar units = addCamelCasedVersion(defaultUnits);\n/**\n * Recursive deep style passing function\n */\n\nfunction iterate(prop, value, options) {\n if (value == null) return value;\n\n if (Array.isArray(value)) {\n for (var i = 0; i < value.length; i++) {\n value[i] = iterate(prop, value[i], options);\n }\n } else if (typeof value === 'object') {\n if (prop === 'fallbacks') {\n for (var innerProp in value) {\n value[innerProp] = iterate(innerProp, value[innerProp], options);\n }\n } else {\n for (var _innerProp in value) {\n value[_innerProp] = iterate(prop + \"-\" + _innerProp, value[_innerProp], options);\n }\n } // eslint-disable-next-line no-restricted-globals\n\n } else if (typeof value === 'number' && isNaN(value) === false) {\n var unit = options[prop] || units[prop]; // Add the unit if available, except for the special case of 0px.\n\n if (unit && !(value === 0 && unit === px)) {\n return typeof unit === 'function' ? unit(value).toString() : \"\" + value + unit;\n }\n\n return value.toString();\n }\n\n return value;\n}\n/**\n * Add unit to numeric values.\n */\n\n\nfunction defaultUnit(options) {\n if (options === void 0) {\n options = {};\n }\n\n var camelCasedOptions = addCamelCasedVersion(options);\n\n function onProcessStyle(style, rule) {\n if (rule.type !== 'style') return style;\n\n for (var prop in style) {\n style[prop] = iterate(prop, style[prop], camelCasedOptions);\n }\n\n return style;\n }\n\n function onChangeValue(value, prop) {\n return iterate(prop, value, camelCasedOptions);\n }\n\n return {\n onProcessStyle: onProcessStyle,\n onChangeValue: onChangeValue\n };\n}\n\nexports.default = defaultUnit;\n", "'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nfunction _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }\n\nvar isInBrowser = _interopDefault(require('is-in-browser'));\nvar _toConsumableArray = _interopDefault(require('@babel/runtime/helpers/toConsumableArray'));\n\n// Export javascript style and css style vendor prefixes.\nvar js = '';\nvar css = '';\nvar vendor = '';\nvar browser = '';\nvar isTouch = isInBrowser && 'ontouchstart' in document.documentElement; // We should not do anything if required serverside.\n\nif (isInBrowser) {\n // Order matters. We need to check Webkit the last one because\n // other vendors use to add Webkit prefixes to some properties\n var jsCssMap = {\n Moz: '-moz-',\n ms: '-ms-',\n O: '-o-',\n Webkit: '-webkit-'\n };\n\n var _document$createEleme = document.createElement('p'),\n style = _document$createEleme.style;\n\n var testProp = 'Transform';\n\n for (var key in jsCssMap) {\n if (key + testProp in style) {\n js = key;\n css = jsCssMap[key];\n break;\n }\n } // Correctly detect the Edge browser.\n\n\n if (js === 'Webkit' && 'msHyphens' in style) {\n js = 'ms';\n css = jsCssMap.ms;\n browser = 'edge';\n } // Correctly detect the Safari browser.\n\n\n if (js === 'Webkit' && '-apple-trailing-word' in style) {\n vendor = 'apple';\n }\n}\n/**\n * Vendor prefix string for the current browser.\n *\n * @type {{js: String, css: String, vendor: String, browser: String}}\n * @api public\n */\n\n\nvar prefix = {\n js: js,\n css: css,\n vendor: vendor,\n browser: browser,\n isTouch: isTouch\n};\n\n/**\n * Test if a keyframe at-rule should be prefixed or not\n *\n * @param {String} vendor prefix string for the current browser.\n * @return {String}\n * @api public\n */\n\nfunction supportedKeyframes(key) {\n // Keyframes is already prefixed. e.g. key = '@-webkit-keyframes a'\n if (key[1] === '-') return key; // No need to prefix IE/Edge. Older browsers will ignore unsupported rules.\n // https://caniuse.com/#search=keyframes\n\n if (prefix.js === 'ms') return key;\n return \"@\" + prefix.css + \"keyframes\" + key.substr(10);\n}\n\n// https://caniuse.com/#search=appearance\n\nvar appearence = {\n noPrefill: ['appearance'],\n supportedProperty: function supportedProperty(prop) {\n if (prop !== 'appearance') return false;\n if (prefix.js === 'ms') return \"-webkit-\" + prop;\n return prefix.css + prop;\n }\n};\n\n// https://caniuse.com/#search=color-adjust\n\nvar colorAdjust = {\n noPrefill: ['color-adjust'],\n supportedProperty: function supportedProperty(prop) {\n if (prop !== 'color-adjust') return false;\n if (prefix.js === 'Webkit') return prefix.css + \"print-\" + prop;\n return prop;\n }\n};\n\nvar regExp = /[-\\s]+(.)?/g;\n/**\n * Replaces the letter with the capital letter\n *\n * @param {String} match\n * @param {String} c\n * @return {String}\n * @api private\n */\n\nfunction toUpper(match, c) {\n return c ? c.toUpperCase() : '';\n}\n/**\n * Convert dash separated strings to camel-cased.\n *\n * @param {String} str\n * @return {String}\n * @api private\n */\n\n\nfunction camelize(str) {\n return str.replace(regExp, toUpper);\n}\n\n/**\n * Convert dash separated strings to pascal cased.\n *\n * @param {String} str\n * @return {String}\n * @api private\n */\n\nfunction pascalize(str) {\n return camelize(\"-\" + str);\n}\n\n// but we can use a longhand property instead.\n// https://caniuse.com/#search=mask\n\nvar mask = {\n noPrefill: ['mask'],\n supportedProperty: function supportedProperty(prop, style) {\n if (!/^mask/.test(prop)) return false;\n\n if (prefix.js === 'Webkit') {\n var longhand = 'mask-image';\n\n if (camelize(longhand) in style) {\n return prop;\n }\n\n if (prefix.js + pascalize(longhand) in style) {\n return prefix.css + prop;\n }\n }\n\n return prop;\n }\n};\n\n// https://caniuse.com/#search=text-orientation\n\nvar textOrientation = {\n noPrefill: ['text-orientation'],\n supportedProperty: function supportedProperty(prop) {\n if (prop !== 'text-orientation') return false;\n\n if (prefix.vendor === 'apple' && !prefix.isTouch) {\n return prefix.css + prop;\n }\n\n return prop;\n }\n};\n\n// https://caniuse.com/#search=transform\n\nvar transform = {\n noPrefill: ['transform'],\n supportedProperty: function supportedProperty(prop, style, options) {\n if (prop !== 'transform') return false;\n\n if (options.transform) {\n return prop;\n }\n\n return prefix.css + prop;\n }\n};\n\n// https://caniuse.com/#search=transition\n\nvar transition = {\n noPrefill: ['transition'],\n supportedProperty: function supportedProperty(prop, style, options) {\n if (prop !== 'transition') return false;\n\n if (options.transition) {\n return prop;\n }\n\n return prefix.css + prop;\n }\n};\n\n// https://caniuse.com/#search=writing-mode\n\nvar writingMode = {\n noPrefill: ['writing-mode'],\n supportedProperty: function supportedProperty(prop) {\n if (prop !== 'writing-mode') return false;\n\n if (prefix.js === 'Webkit' || prefix.js === 'ms' && prefix.browser !== 'edge') {\n return prefix.css + prop;\n }\n\n return prop;\n }\n};\n\n// https://caniuse.com/#search=user-select\n\nvar userSelect = {\n noPrefill: ['user-select'],\n supportedProperty: function supportedProperty(prop) {\n if (prop !== 'user-select') return false;\n\n if (prefix.js === 'Moz' || prefix.js === 'ms' || prefix.vendor === 'apple') {\n return prefix.css + prop;\n }\n\n return prop;\n }\n};\n\n// https://caniuse.com/#search=multicolumn\n// https://github.com/postcss/autoprefixer/issues/491\n// https://github.com/postcss/autoprefixer/issues/177\n\nvar breakPropsOld = {\n supportedProperty: function supportedProperty(prop, style) {\n if (!/^break-/.test(prop)) return false;\n\n if (prefix.js === 'Webkit') {\n var jsProp = \"WebkitColumn\" + pascalize(prop);\n return jsProp in style ? prefix.css + \"column-\" + prop : false;\n }\n\n if (prefix.js === 'Moz') {\n var _jsProp = \"page\" + pascalize(prop);\n\n return _jsProp in style ? \"page-\" + prop : false;\n }\n\n return false;\n }\n};\n\n// See https://github.com/postcss/autoprefixer/issues/324.\n\nvar inlineLogicalOld = {\n supportedProperty: function supportedProperty(prop, style) {\n if (!/^(border|margin|padding)-inline/.test(prop)) return false;\n if (prefix.js === 'Moz') return prop;\n var newProp = prop.replace('-inline', '');\n return prefix.js + pascalize(newProp) in style ? prefix.css + newProp : false;\n }\n};\n\n// Camelization is required because we can't test using.\n// CSS syntax for e.g. in FF.\n\nvar unprefixed = {\n supportedProperty: function supportedProperty(prop, style) {\n return camelize(prop) in style ? prop : false;\n }\n};\n\nvar prefixed = {\n supportedProperty: function supportedProperty(prop, style) {\n var pascalized = pascalize(prop); // Return custom CSS variable without prefixing.\n\n if (prop[0] === '-') return prop; // Return already prefixed value without prefixing.\n\n if (prop[0] === '-' && prop[1] === '-') return prop;\n if (prefix.js + pascalized in style) return prefix.css + prop; // Try webkit fallback.\n\n if (prefix.js !== 'Webkit' && \"Webkit\" + pascalized in style) return \"-webkit-\" + prop;\n return false;\n }\n};\n\n// https://caniuse.com/#search=scroll-snap\n\nvar scrollSnap = {\n supportedProperty: function supportedProperty(prop) {\n if (prop.substring(0, 11) !== 'scroll-snap') return false;\n\n if (prefix.js === 'ms') {\n return \"\" + prefix.css + prop;\n }\n\n return prop;\n }\n};\n\n// https://caniuse.com/#search=overscroll-behavior\n\nvar overscrollBehavior = {\n supportedProperty: function supportedProperty(prop) {\n if (prop !== 'overscroll-behavior') return false;\n\n if (prefix.js === 'ms') {\n return prefix.css + \"scroll-chaining\";\n }\n\n return prop;\n }\n};\n\nvar propMap = {\n 'flex-grow': 'flex-positive',\n 'flex-shrink': 'flex-negative',\n 'flex-basis': 'flex-preferred-size',\n 'justify-content': 'flex-pack',\n order: 'flex-order',\n 'align-items': 'flex-align',\n 'align-content': 'flex-line-pack' // 'align-self' is handled by 'align-self' plugin.\n\n}; // Support old flex spec from 2012.\n\nvar flex2012 = {\n supportedProperty: function supportedProperty(prop, style) {\n var newProp = propMap[prop];\n if (!newProp) return false;\n return prefix.js + pascalize(newProp) in style ? prefix.css + newProp : false;\n }\n};\n\nvar propMap$1 = {\n flex: 'box-flex',\n 'flex-grow': 'box-flex',\n 'flex-direction': ['box-orient', 'box-direction'],\n order: 'box-ordinal-group',\n 'align-items': 'box-align',\n 'flex-flow': ['box-orient', 'box-direction'],\n 'justify-content': 'box-pack'\n};\nvar propKeys = Object.keys(propMap$1);\n\nvar prefixCss = function prefixCss(p) {\n return prefix.css + p;\n}; // Support old flex spec from 2009.\n\n\nvar flex2009 = {\n supportedProperty: function supportedProperty(prop, style, _ref) {\n var multiple = _ref.multiple;\n\n if (propKeys.indexOf(prop) > -1) {\n var newProp = propMap$1[prop];\n\n if (!Array.isArray(newProp)) {\n return prefix.js + pascalize(newProp) in style ? prefix.css + newProp : false;\n }\n\n if (!multiple) return false;\n\n for (var i = 0; i < newProp.length; i++) {\n if (!(prefix.js + pascalize(newProp[0]) in style)) {\n return false;\n }\n }\n\n return newProp.map(prefixCss);\n }\n\n return false;\n }\n};\n\n// plugins = [\n// ...plugins,\n// breakPropsOld,\n// inlineLogicalOld,\n// unprefixed,\n// prefixed,\n// scrollSnap,\n// flex2012,\n// flex2009\n// ]\n// Plugins without 'noPrefill' value, going last.\n// 'flex-*' plugins should be at the bottom.\n// 'flex2009' going after 'flex2012'.\n// 'prefixed' going after 'unprefixed'\n\nvar plugins = [appearence, colorAdjust, mask, textOrientation, transform, transition, writingMode, userSelect, breakPropsOld, inlineLogicalOld, unprefixed, prefixed, scrollSnap, overscrollBehavior, flex2012, flex2009];\nvar propertyDetectors = plugins.filter(function (p) {\n return p.supportedProperty;\n}).map(function (p) {\n return p.supportedProperty;\n});\nvar noPrefill = plugins.filter(function (p) {\n return p.noPrefill;\n}).reduce(function (a, p) {\n a.push.apply(a, _toConsumableArray(p.noPrefill));\n return a;\n}, []);\n\nvar el;\nvar cache = {};\n\nif (isInBrowser) {\n el = document.createElement('p'); // We test every property on vendor prefix requirement.\n // Once tested, result is cached. It gives us up to 70% perf boost.\n // http://jsperf.com/element-style-object-access-vs-plain-object\n //\n // Prefill cache with known css properties to reduce amount of\n // properties we need to feature test at runtime.\n // http://davidwalsh.name/vendor-prefix\n\n var computed = window.getComputedStyle(document.documentElement, '');\n\n for (var key$1 in computed) {\n // eslint-disable-next-line no-restricted-globals\n if (!isNaN(key$1)) cache[computed[key$1]] = computed[key$1];\n } // Properties that cannot be correctly detected using the\n // cache prefill method.\n\n\n noPrefill.forEach(function (x) {\n return delete cache[x];\n });\n}\n/**\n * Test if a property is supported, returns supported property with vendor\n * prefix if required. Returns `false` if not supported.\n *\n * @param {String} prop dash separated\n * @param {Object} [options]\n * @return {String|Boolean}\n * @api public\n */\n\n\nfunction supportedProperty(prop, options) {\n if (options === void 0) {\n options = {};\n }\n\n // For server-side rendering.\n if (!el) return prop; // Remove cache for benchmark tests or return property from the cache.\n\n if (process.env.NODE_ENV !== 'benchmark' && cache[prop] != null) {\n return cache[prop];\n } // Check if 'transition' or 'transform' natively supported in browser.\n\n\n if (prop === 'transition' || prop === 'transform') {\n options[prop] = prop in el.style;\n } // Find a plugin for current prefix property.\n\n\n for (var i = 0; i < propertyDetectors.length; i++) {\n cache[prop] = propertyDetectors[i](prop, el.style, options); // Break loop, if value found.\n\n if (cache[prop]) break;\n } // Reset styles for current property.\n // Firefox can even throw an error for invalid properties, e.g., \"0\".\n\n\n try {\n el.style[prop] = '';\n } catch (err) {\n return false;\n }\n\n return cache[prop];\n}\n\nvar cache$1 = {};\nvar transitionProperties = {\n transition: 1,\n 'transition-property': 1,\n '-webkit-transition': 1,\n '-webkit-transition-property': 1\n};\nvar transPropsRegExp = /(^\\s*[\\w-]+)|, (\\s*[\\w-]+)(?![^()]*\\))/g;\nvar el$1;\n/**\n * Returns prefixed value transition/transform if needed.\n *\n * @param {String} match\n * @param {String} p1\n * @param {String} p2\n * @return {String}\n * @api private\n */\n\nfunction prefixTransitionCallback(match, p1, p2) {\n if (p1 === 'var') return 'var';\n if (p1 === 'all') return 'all';\n if (p2 === 'all') return ', all';\n var prefixedValue = p1 ? supportedProperty(p1) : \", \" + supportedProperty(p2);\n if (!prefixedValue) return p1 || p2;\n return prefixedValue;\n}\n\nif (isInBrowser) el$1 = document.createElement('p');\n/**\n * Returns prefixed value if needed. Returns `false` if value is not supported.\n *\n * @param {String} property\n * @param {String} value\n * @return {String|Boolean}\n * @api public\n */\n\nfunction supportedValue(property, value) {\n // For server-side rendering.\n var prefixedValue = value;\n if (!el$1 || property === 'content') return value; // It is a string or a number as a string like '1'.\n // We want only prefixable values here.\n // eslint-disable-next-line no-restricted-globals\n\n if (typeof prefixedValue !== 'string' || !isNaN(parseInt(prefixedValue, 10))) {\n return prefixedValue;\n } // Create cache key for current value.\n\n\n var cacheKey = property + prefixedValue; // Remove cache for benchmark tests or return value from cache.\n\n if (process.env.NODE_ENV !== 'benchmark' && cache$1[cacheKey] != null) {\n return cache$1[cacheKey];\n } // IE can even throw an error in some cases, for e.g. style.content = 'bar'.\n\n\n try {\n // Test value as it is.\n el$1.style[property] = prefixedValue;\n } catch (err) {\n // Return false if value not supported.\n cache$1[cacheKey] = false;\n return false;\n } // If 'transition' or 'transition-property' property.\n\n\n if (transitionProperties[property]) {\n prefixedValue = prefixedValue.replace(transPropsRegExp, prefixTransitionCallback);\n } else if (el$1.style[property] === '') {\n // Value with a vendor prefix.\n prefixedValue = prefix.css + prefixedValue; // Hardcode test to convert \"flex\" to \"-ms-flexbox\" for IE10.\n\n if (prefixedValue === '-ms-flex') el$1.style[property] = '-ms-flexbox'; // Test prefixed value.\n\n el$1.style[property] = prefixedValue; // Return false if value not supported.\n\n if (el$1.style[property] === '') {\n cache$1[cacheKey] = false;\n return false;\n }\n } // Reset styles for current property.\n\n\n el$1.style[property] = ''; // Write current value to cache.\n\n cache$1[cacheKey] = prefixedValue;\n return cache$1[cacheKey];\n}\n\nexports.prefix = prefix;\nexports.supportedKeyframes = supportedKeyframes;\nexports.supportedProperty = supportedProperty;\nexports.supportedValue = supportedValue;\n", "'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nvar vendor = require('css-vendor');\nvar jss = require('jss');\n\n/**\n * Add vendor prefix to a property name when needed.\n */\n\nfunction jssVendorPrefixer() {\n function onProcessRule(rule) {\n if (rule.type === 'keyframes') {\n var atRule = rule;\n atRule.at = vendor.supportedKeyframes(atRule.at);\n }\n }\n\n function prefixStyle(style) {\n for (var prop in style) {\n var value = style[prop];\n\n if (prop === 'fallbacks' && Array.isArray(value)) {\n style[prop] = value.map(prefixStyle);\n continue;\n }\n\n var changeProp = false;\n var supportedProp = vendor.supportedProperty(prop);\n if (supportedProp && supportedProp !== prop) changeProp = true;\n var changeValue = false;\n var supportedValue = vendor.supportedValue(supportedProp, jss.toCssValue(value));\n if (supportedValue && supportedValue !== value) changeValue = true;\n\n if (changeProp || changeValue) {\n if (changeProp) delete style[prop];\n style[supportedProp || prop] = supportedValue || value;\n }\n }\n\n return style;\n }\n\n function onProcessStyle(style, rule) {\n if (rule.type !== 'style') return style;\n return prefixStyle(style);\n }\n\n function onChangeValue(value, prop) {\n return vendor.supportedValue(prop, jss.toCssValue(value)) || value;\n }\n\n return {\n onProcessRule: onProcessRule,\n onProcessStyle: onProcessStyle,\n onChangeValue: onChangeValue\n };\n}\n\nexports.default = jssVendorPrefixer;\n", "'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\n/**\n * Sort props by length.\n */\nfunction jssPropsSort() {\n var sort = function sort(prop0, prop1) {\n if (prop0.length === prop1.length) {\n return prop0 > prop1 ? 1 : -1;\n }\n\n return prop0.length - prop1.length;\n };\n\n return {\n onProcessStyle: function onProcessStyle(style, rule) {\n if (rule.type !== 'style') return style;\n var newStyle = {};\n var props = Object.keys(style).sort(sort);\n\n for (var i = 0; i < props.length; i++) {\n newStyle[props[i]] = style[props[i]];\n }\n\n return newStyle;\n }\n };\n}\n\nexports.default = jssPropsSort;\n", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = jssPreset;\n\nvar _jssPluginRuleValueFunction = _interopRequireDefault(require(\"jss-plugin-rule-value-function\"));\n\nvar _jssPluginGlobal = _interopRequireDefault(require(\"jss-plugin-global\"));\n\nvar _jssPluginNested = _interopRequireDefault(require(\"jss-plugin-nested\"));\n\nvar _jssPluginCamelCase = _interopRequireDefault(require(\"jss-plugin-camel-case\"));\n\nvar _jssPluginDefaultUnit = _interopRequireDefault(require(\"jss-plugin-default-unit\"));\n\nvar _jssPluginVendorPrefixer = _interopRequireDefault(require(\"jss-plugin-vendor-prefixer\"));\n\nvar _jssPluginPropsSort = _interopRequireDefault(require(\"jss-plugin-props-sort\"));\n\n// Subset of jss-preset-default with only the plugins the Material-UI components are using.\nfunction jssPreset() {\n return {\n plugins: [(0, _jssPluginRuleValueFunction.default)(), (0, _jssPluginGlobal.default)(), (0, _jssPluginNested.default)(), (0, _jssPluginCamelCase.default)(), (0, _jssPluginDefaultUnit.default)(), // Disable the vendor prefixer server-side, it does nothing.\n // This way, we can get a performance boost.\n // In the documentation, we are using `autoprefixer` to solve this problem.\n typeof window === 'undefined' ? null : (0, _jssPluginVendorPrefixer.default)(), (0, _jssPluginPropsSort.default)()]\n };\n}", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function get() {\n return _jssPreset.default;\n }\n});\n\nvar _jssPreset = _interopRequireDefault(require(\"./jssPreset\"));", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = mergeClasses;\n\nvar _extends2 = _interopRequireDefault(require(\"@babel/runtime/helpers/extends\"));\n\nvar _utils = require(\"@material-ui/utils\");\n\nfunction mergeClasses() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var baseClasses = options.baseClasses,\n newClasses = options.newClasses,\n Component = options.Component;\n\n if (!newClasses) {\n return baseClasses;\n }\n\n var nextClasses = (0, _extends2.default)({}, baseClasses);\n\n if (process.env.NODE_ENV !== 'production') {\n if (typeof newClasses === 'string') {\n console.error([\"Material-UI: The value `\".concat(newClasses, \"` \") + \"provided to the classes prop of \".concat((0, _utils.getDisplayName)(Component), \" is incorrect.\"), 'You might want to use the className prop instead.'].join('\\n'));\n return baseClasses;\n }\n }\n\n Object.keys(newClasses).forEach(function (key) {\n if (process.env.NODE_ENV !== 'production') {\n if (!baseClasses[key] && newClasses[key]) {\n console.error([\"Material-UI: The key `\".concat(key, \"` \") + \"provided to the classes prop is not implemented in \".concat((0, _utils.getDisplayName)(Component), \".\"), \"You can only override one of the following: \".concat(Object.keys(baseClasses).join(','), \".\")].join('\\n'));\n }\n\n if (newClasses[key] && typeof newClasses[key] !== 'string') {\n console.error([\"Material-UI: The key `\".concat(key, \"` \") + \"provided to the classes prop is not valid for \".concat((0, _utils.getDisplayName)(Component), \".\"), \"You need to provide a non empty string instead of: \".concat(newClasses[key], \".\")].join('\\n'));\n }\n }\n\n if (newClasses[key]) {\n nextClasses[key] = \"\".concat(baseClasses[key], \" \").concat(newClasses[key]);\n }\n });\n return nextClasses;\n}", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function get() {\n return _mergeClasses.default;\n }\n});\n\nvar _mergeClasses = _interopRequireDefault(require(\"./mergeClasses\"));", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n// Used https://github.com/thinkloop/multi-key-cache as inspiration\nvar multiKeyStore = {\n set: function set(cache, key1, key2, value) {\n var subCache = cache.get(key1);\n\n if (!subCache) {\n subCache = new Map();\n cache.set(key1, subCache);\n }\n\n subCache.set(key2, value);\n },\n get: function get(cache, key1, key2) {\n var subCache = cache.get(key1);\n return subCache ? subCache.get(key2) : undefined;\n },\n delete: function _delete(cache, key1, key2) {\n var subCache = cache.get(key1);\n subCache.delete(key2);\n }\n};\nvar _default = multiKeyStore;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _react = _interopRequireDefault(require(\"react\"));\n\nvar ThemeContext = _react.default.createContext(null);\n\nif (process.env.NODE_ENV !== 'production') {\n ThemeContext.displayName = 'ThemeContext';\n}\n\nvar _default = ThemeContext;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = useTheme;\n\nvar _react = _interopRequireDefault(require(\"react\"));\n\nvar _ThemeContext = _interopRequireDefault(require(\"./ThemeContext\"));\n\nfunction useTheme() {\n var theme = _react.default.useContext(_ThemeContext.default);\n\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n _react.default.useDebugValue(theme);\n }\n\n return theme;\n}", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function get() {\n return _useTheme.default;\n }\n});\n\nvar _useTheme = _interopRequireDefault(require(\"./useTheme\"));", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = StylesProvider;\nexports.StylesContext = exports.sheetsManager = void 0;\n\nvar _extends2 = _interopRequireDefault(require(\"@babel/runtime/helpers/extends\"));\n\nvar _objectWithoutProperties2 = _interopRequireDefault(require(\"@babel/runtime/helpers/objectWithoutProperties\"));\n\nvar _react = _interopRequireDefault(require(\"react\"));\n\nvar _propTypes = _interopRequireDefault(require(\"prop-types\"));\n\nvar _utils = require(\"@material-ui/utils\");\n\nvar _createGenerateClassName = _interopRequireDefault(require(\"../createGenerateClassName\"));\n\nvar _jss = require(\"jss\");\n\nvar _jssPreset = _interopRequireDefault(require(\"../jssPreset\"));\n\n// Default JSS instance.\nvar jss = (0, _jss.create)((0, _jssPreset.default)()); // Use a singleton or the provided one by the context.\n//\n// The counter-based approach doesn't tolerate any mistake.\n// It's much safer to use the same counter everywhere.\n\nvar generateClassName = (0, _createGenerateClassName.default)(); // Exported for test purposes\n\nvar sheetsManager = new Map();\nexports.sheetsManager = sheetsManager;\nvar defaultOptions = {\n disableGeneration: false,\n generateClassName: generateClassName,\n jss: jss,\n sheetsCache: null,\n sheetsManager: sheetsManager,\n sheetsRegistry: null\n};\n\nvar StylesContext = _react.default.createContext(defaultOptions);\n\nexports.StylesContext = StylesContext;\n\nif (process.env.NODE_ENV !== 'production') {\n StylesContext.displayName = 'StylesContext';\n}\n\nvar injectFirstNode;\n\nfunction StylesProvider(props) {\n var children = props.children,\n _props$injectFirst = props.injectFirst,\n injectFirst = _props$injectFirst === void 0 ? false : _props$injectFirst,\n _props$disableGenerat = props.disableGeneration,\n disableGeneration = _props$disableGenerat === void 0 ? false : _props$disableGenerat,\n localOptions = (0, _objectWithoutProperties2.default)(props, [\"children\", \"injectFirst\", \"disableGeneration\"]);\n\n var outerOptions = _react.default.useContext(StylesContext);\n\n var context = (0, _extends2.default)({}, outerOptions, {\n disableGeneration: disableGeneration\n }, localOptions);\n\n if (process.env.NODE_ENV !== 'production') {\n if (typeof window === 'undefined' && !context.sheetsManager) {\n console.error('Material-UI: You need to use the ServerStyleSheets API when rendering on the server.');\n }\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (context.jss.options.insertionPoint && injectFirst) {\n console.error('Material-UI: You cannot use a custom insertionPoint and at the same time.');\n }\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (injectFirst && localOptions.jss) {\n console.error('Material-UI: You cannot use the jss and injectFirst props at the same time.');\n }\n }\n\n if (!context.jss.options.insertionPoint && injectFirst && typeof window !== 'undefined') {\n if (!injectFirstNode) {\n var head = document.head;\n injectFirstNode = document.createComment('mui-inject-first');\n head.insertBefore(injectFirstNode, head.firstChild);\n }\n\n context.jss = (0, _jss.create)({\n plugins: (0, _jssPreset.default)().plugins,\n insertionPoint: injectFirstNode\n });\n }\n\n return /*#__PURE__*/_react.default.createElement(StylesContext.Provider, {\n value: context\n }, children);\n}\n\nprocess.env.NODE_ENV !== \"production\" ? StylesProvider.propTypes = {\n /**\n * Your component tree.\n */\n children: _propTypes.default.node.isRequired,\n\n /**\n * You can disable the generation of the styles with this option.\n * It can be useful when traversing the React tree outside of the HTML\n * rendering step on the server.\n * Let's say you are using react-apollo to extract all\n * the queries made by the interface server-side - you can significantly speed up the traversal with this prop.\n */\n disableGeneration: _propTypes.default.bool,\n\n /**\n * JSS's class name generator.\n */\n generateClassName: _propTypes.default.func,\n\n /**\n * By default, the styles are injected last in the element of the page.\n * As a result, they gain more specificity than any other style sheet.\n * If you want to override Material-UI's styles, set this prop.\n */\n injectFirst: _propTypes.default.bool,\n\n /**\n * JSS's instance.\n */\n jss: _propTypes.default.object,\n\n /**\n * @ignore\n */\n serverGenerateClassName: _propTypes.default.func,\n\n /**\n * @ignore\n *\n * Beta feature.\n *\n * Cache for the sheets.\n */\n sheetsCache: _propTypes.default.object,\n\n /**\n * @ignore\n *\n * The sheetsManager is used to deduplicate style sheet injection in the page.\n * It's deduplicating using the (theme, styles) couple.\n * On the server, you should provide a new instance for each request.\n */\n sheetsManager: _propTypes.default.object,\n\n /**\n * @ignore\n *\n * Collect the sheets.\n */\n sheetsRegistry: _propTypes.default.object\n} : void 0;\n\nif (process.env.NODE_ENV !== 'production') {\n process.env.NODE_ENV !== \"production\" ? StylesProvider.propTypes = (0, _utils.exactProp)(StylesProvider.propTypes) : void 0;\n}", "\"use strict\";\n\nvar _interopRequireWildcard = require(\"@babel/runtime/helpers/interopRequireWildcard\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar _exportNames = {};\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function get() {\n return _StylesProvider.default;\n }\n});\n\nvar _StylesProvider = _interopRequireWildcard(require(\"./StylesProvider\"));\n\nObject.keys(_StylesProvider).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _StylesProvider[key];\n }\n });\n});", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.increment = increment;\n\n/* eslint-disable import/prefer-default-export */\n// Global index counter to preserve source order.\n// We create the style sheet during the creation of the component,\n// children are handled after the parents, so the order of style elements would be parent->child.\n// It is a problem though when a parent passes a className\n// which needs to override any child's styles.\n// StyleSheet of the child has a higher specificity, because of the source order.\n// So our solution is to render sheets them in the reverse order child->sheet, so\n// that parent has a higher specificity.\nvar indexCounter = -1e9;\n\nfunction increment() {\n indexCounter += 1;\n\n if (process.env.NODE_ENV !== 'production') {\n if (indexCounter >= 0) {\n console.warn(['Material-UI: You might have a memory leak.', 'The indexCounter is not supposed to grow that much.'].join('\\n'));\n }\n }\n\n return indexCounter;\n}", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n// We use the same empty object to ref count the styles that don't need a theme object.\nvar noopTheme = {};\nvar _default = noopTheme;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = getStylesCreator;\n\nvar _extends2 = _interopRequireDefault(require(\"@babel/runtime/helpers/extends\"));\n\nvar _typeof2 = _interopRequireDefault(require(\"@babel/runtime/helpers/typeof\"));\n\nvar _utils = require(\"@material-ui/utils\");\n\nvar _noopTheme = _interopRequireDefault(require(\"./noopTheme\"));\n\nfunction getStylesCreator(stylesOrCreator) {\n var themingEnabled = typeof stylesOrCreator === 'function';\n\n if (process.env.NODE_ENV !== 'production') {\n if ((0, _typeof2.default)(stylesOrCreator) !== 'object' && !themingEnabled) {\n console.error(['Material-UI: The `styles` argument provided is invalid.', 'You need to provide a function generating the styles or a styles object.'].join('\\n'));\n }\n }\n\n return {\n create: function create(theme, name) {\n var styles;\n\n try {\n styles = themingEnabled ? stylesOrCreator(theme) : stylesOrCreator;\n } catch (err) {\n if (process.env.NODE_ENV !== 'production') {\n if (themingEnabled === true && theme === _noopTheme.default) {\n // TODO: prepend error message/name instead\n console.error(['Material-UI: The `styles` argument provided is invalid.', 'You are providing a function without a theme in the context.', 'One of the parent elements needs to use a ThemeProvider.'].join('\\n'));\n }\n }\n\n throw err;\n }\n\n if (!name || !theme.overrides || !theme.overrides[name]) {\n return styles;\n }\n\n var overrides = theme.overrides[name];\n var stylesWithOverrides = (0, _extends2.default)({}, styles);\n Object.keys(overrides).forEach(function (key) {\n if (process.env.NODE_ENV !== 'production') {\n if (!stylesWithOverrides[key]) {\n console.warn(['Material-UI: You are trying to override a style that does not exist.', \"Fix the `\".concat(key, \"` key of `theme.overrides.\").concat(name, \"`.\")].join('\\n'));\n }\n }\n\n stylesWithOverrides[key] = (0, _utils.deepmerge)(stylesWithOverrides[key], overrides[key]);\n });\n return stylesWithOverrides;\n },\n options: {}\n };\n}", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function get() {\n return _getStylesCreator.default;\n }\n});\n\nvar _getStylesCreator = _interopRequireDefault(require(\"./getStylesCreator\"));", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = makeStyles;\n\nvar _objectWithoutProperties2 = _interopRequireDefault(require(\"@babel/runtime/helpers/objectWithoutProperties\"));\n\nvar _extends2 = _interopRequireDefault(require(\"@babel/runtime/helpers/extends\"));\n\nvar _react = _interopRequireDefault(require(\"react\"));\n\nvar _jss = require(\"jss\");\n\nvar _mergeClasses = _interopRequireDefault(require(\"../mergeClasses\"));\n\nvar _multiKeyStore = _interopRequireDefault(require(\"./multiKeyStore\"));\n\nvar _useTheme = _interopRequireDefault(require(\"../useTheme\"));\n\nvar _StylesProvider = require(\"../StylesProvider\");\n\nvar _indexCounter = require(\"./indexCounter\");\n\nvar _getStylesCreator = _interopRequireDefault(require(\"../getStylesCreator\"));\n\nvar _noopTheme = _interopRequireDefault(require(\"../getStylesCreator/noopTheme\"));\n\nfunction getClasses(_ref, classes, Component) {\n var state = _ref.state,\n stylesOptions = _ref.stylesOptions;\n\n if (stylesOptions.disableGeneration) {\n return classes || {};\n }\n\n if (!state.cacheClasses) {\n state.cacheClasses = {\n // Cache for the finalized classes value.\n value: null,\n // Cache for the last used classes prop pointer.\n lastProp: null,\n // Cache for the last used rendered classes pointer.\n lastJSS: {}\n };\n } // Tracks if either the rendered classes or classes prop has changed,\n // requiring the generation of a new finalized classes object.\n\n\n var generate = false;\n\n if (state.classes !== state.cacheClasses.lastJSS) {\n state.cacheClasses.lastJSS = state.classes;\n generate = true;\n }\n\n if (classes !== state.cacheClasses.lastProp) {\n state.cacheClasses.lastProp = classes;\n generate = true;\n }\n\n if (generate) {\n state.cacheClasses.value = (0, _mergeClasses.default)({\n baseClasses: state.cacheClasses.lastJSS,\n newClasses: classes,\n Component: Component\n });\n }\n\n return state.cacheClasses.value;\n}\n\nfunction attach(_ref2, props) {\n var state = _ref2.state,\n theme = _ref2.theme,\n stylesOptions = _ref2.stylesOptions,\n stylesCreator = _ref2.stylesCreator,\n name = _ref2.name;\n\n if (stylesOptions.disableGeneration) {\n return;\n }\n\n var sheetManager = _multiKeyStore.default.get(stylesOptions.sheetsManager, stylesCreator, theme);\n\n if (!sheetManager) {\n sheetManager = {\n refs: 0,\n staticSheet: null,\n dynamicStyles: null\n };\n\n _multiKeyStore.default.set(stylesOptions.sheetsManager, stylesCreator, theme, sheetManager);\n }\n\n var options = (0, _extends2.default)({}, stylesCreator.options, stylesOptions, {\n theme: theme,\n flip: typeof stylesOptions.flip === 'boolean' ? stylesOptions.flip : theme.direction === 'rtl'\n });\n options.generateId = options.serverGenerateClassName || options.generateClassName;\n var sheetsRegistry = stylesOptions.sheetsRegistry;\n\n if (sheetManager.refs === 0) {\n var staticSheet;\n\n if (stylesOptions.sheetsCache) {\n staticSheet = _multiKeyStore.default.get(stylesOptions.sheetsCache, stylesCreator, theme);\n }\n\n var styles = stylesCreator.create(theme, name);\n\n if (!staticSheet) {\n staticSheet = stylesOptions.jss.createStyleSheet(styles, (0, _extends2.default)({\n link: false\n }, options));\n staticSheet.attach();\n\n if (stylesOptions.sheetsCache) {\n _multiKeyStore.default.set(stylesOptions.sheetsCache, stylesCreator, theme, staticSheet);\n }\n }\n\n if (sheetsRegistry) {\n sheetsRegistry.add(staticSheet);\n }\n\n sheetManager.staticSheet = staticSheet;\n sheetManager.dynamicStyles = (0, _jss.getDynamicStyles)(styles);\n }\n\n if (sheetManager.dynamicStyles) {\n var dynamicSheet = stylesOptions.jss.createStyleSheet(sheetManager.dynamicStyles, (0, _extends2.default)({\n link: true\n }, options));\n dynamicSheet.update(props);\n dynamicSheet.attach();\n state.dynamicSheet = dynamicSheet;\n state.classes = (0, _mergeClasses.default)({\n baseClasses: sheetManager.staticSheet.classes,\n newClasses: dynamicSheet.classes\n });\n\n if (sheetsRegistry) {\n sheetsRegistry.add(dynamicSheet);\n }\n } else {\n state.classes = sheetManager.staticSheet.classes;\n }\n\n sheetManager.refs += 1;\n}\n\nfunction update(_ref3, props) {\n var state = _ref3.state;\n\n if (state.dynamicSheet) {\n state.dynamicSheet.update(props);\n }\n}\n\nfunction detach(_ref4) {\n var state = _ref4.state,\n theme = _ref4.theme,\n stylesOptions = _ref4.stylesOptions,\n stylesCreator = _ref4.stylesCreator;\n\n if (stylesOptions.disableGeneration) {\n return;\n }\n\n var sheetManager = _multiKeyStore.default.get(stylesOptions.sheetsManager, stylesCreator, theme);\n\n sheetManager.refs -= 1;\n var sheetsRegistry = stylesOptions.sheetsRegistry;\n\n if (sheetManager.refs === 0) {\n _multiKeyStore.default.delete(stylesOptions.sheetsManager, stylesCreator, theme);\n\n stylesOptions.jss.removeStyleSheet(sheetManager.staticSheet);\n\n if (sheetsRegistry) {\n sheetsRegistry.remove(sheetManager.staticSheet);\n }\n }\n\n if (state.dynamicSheet) {\n stylesOptions.jss.removeStyleSheet(state.dynamicSheet);\n\n if (sheetsRegistry) {\n sheetsRegistry.remove(state.dynamicSheet);\n }\n }\n}\n\nfunction useSynchronousEffect(func, values) {\n var key = _react.default.useRef([]);\n\n var output; // Store \"generation\" key. Just returns a new object every time\n\n var currentKey = _react.default.useMemo(function () {\n return {};\n }, values); // eslint-disable-line react-hooks/exhaustive-deps\n // \"the first render\", or \"memo dropped the value\"\n\n\n if (key.current !== currentKey) {\n key.current = currentKey;\n output = func();\n }\n\n _react.default.useEffect(function () {\n return function () {\n if (output) {\n output();\n }\n };\n }, [currentKey] // eslint-disable-line react-hooks/exhaustive-deps\n );\n}\n\nfunction makeStyles(stylesOrCreator) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var name = options.name,\n classNamePrefixOption = options.classNamePrefix,\n Component = options.Component,\n _options$defaultTheme = options.defaultTheme,\n defaultTheme = _options$defaultTheme === void 0 ? _noopTheme.default : _options$defaultTheme,\n stylesOptions2 = (0, _objectWithoutProperties2.default)(options, [\"name\", \"classNamePrefix\", \"Component\", \"defaultTheme\"]);\n var stylesCreator = (0, _getStylesCreator.default)(stylesOrCreator);\n var classNamePrefix = name || classNamePrefixOption || 'makeStyles';\n stylesCreator.options = {\n index: (0, _indexCounter.increment)(),\n name: name,\n meta: classNamePrefix,\n classNamePrefix: classNamePrefix\n };\n\n var useStyles = function useStyles() {\n var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var theme = (0, _useTheme.default)() || defaultTheme;\n var stylesOptions = (0, _extends2.default)({}, _react.default.useContext(_StylesProvider.StylesContext), stylesOptions2);\n\n var instance = _react.default.useRef();\n\n var shouldUpdate = _react.default.useRef();\n\n useSynchronousEffect(function () {\n var current = {\n name: name,\n state: {},\n stylesCreator: stylesCreator,\n stylesOptions: stylesOptions,\n theme: theme\n };\n attach(current, props);\n shouldUpdate.current = false;\n instance.current = current;\n return function () {\n detach(current);\n };\n }, [theme, stylesCreator]);\n\n _react.default.useEffect(function () {\n if (shouldUpdate.current) {\n update(instance.current, props);\n }\n\n shouldUpdate.current = true;\n });\n\n var classes = getClasses(instance.current, props.classes, Component);\n\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n _react.default.useDebugValue(classes);\n }\n\n return classes;\n };\n\n return useStyles;\n}", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function get() {\n return _makeStyles.default;\n }\n});\n\nvar _makeStyles = _interopRequireDefault(require(\"./makeStyles\"));", "function _classCallCheck(a, n) {\n if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\");\n}\nmodule.exports = _classCallCheck, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _extends2 = _interopRequireDefault(require(\"@babel/runtime/helpers/extends\"));\n\nvar _classCallCheck2 = _interopRequireDefault(require(\"@babel/runtime/helpers/classCallCheck\"));\n\nvar _createClass2 = _interopRequireDefault(require(\"@babel/runtime/helpers/createClass\"));\n\nvar _react = _interopRequireDefault(require(\"react\"));\n\nvar _jss = require(\"jss\");\n\nvar _StylesProvider = _interopRequireDefault(require(\"../StylesProvider\"));\n\nvar _createGenerateClassName = _interopRequireDefault(require(\"../createGenerateClassName\"));\n\nvar ServerStyleSheets = /*#__PURE__*/function () {\n function ServerStyleSheets() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n (0, _classCallCheck2.default)(this, ServerStyleSheets);\n this.options = options;\n }\n\n (0, _createClass2.default)(ServerStyleSheets, [{\n key: \"collect\",\n value: function collect(children) {\n // This is needed in order to deduplicate the injection of CSS in the page.\n var sheetsManager = new Map(); // This is needed in order to inject the critical CSS.\n\n this.sheetsRegistry = new _jss.SheetsRegistry(); // A new class name generator\n\n var generateClassName = (0, _createGenerateClassName.default)();\n return /*#__PURE__*/_react.default.createElement(_StylesProvider.default, (0, _extends2.default)({\n sheetsManager: sheetsManager,\n serverGenerateClassName: generateClassName,\n sheetsRegistry: this.sheetsRegistry\n }, this.options), children);\n }\n }, {\n key: \"toString\",\n value: function toString() {\n return this.sheetsRegistry ? this.sheetsRegistry.toString() : '';\n }\n }, {\n key: \"getStyleElement\",\n value: function getStyleElement(props) {\n return /*#__PURE__*/_react.default.createElement('style', (0, _extends2.default)({\n id: 'jss-server-side',\n key: 'jss-server-side',\n dangerouslySetInnerHTML: {\n __html: this.toString()\n }\n }, props));\n }\n }]);\n return ServerStyleSheets;\n}();\n\nexports.default = ServerStyleSheets;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function get() {\n return _ServerStyleSheets.default;\n }\n});\n\nvar _ServerStyleSheets = _interopRequireDefault(require(\"./ServerStyleSheets\"));", "function e(r){var o,t,f=\"\";if(\"string\"==typeof r||\"number\"==typeof r)f+=r;else if(\"object\"==typeof r)if(Array.isArray(r))for(o=0;o 1 && arguments[1] !== undefined ? arguments[1] : {};\n var name = options.name,\n stylesOptions = (0, _objectWithoutProperties2.default)(options, [\"name\"]);\n\n if (process.env.NODE_ENV !== 'production' && Component === undefined) {\n throw new Error(['You are calling styled(Component)(style) with an undefined component.', 'You may have forgotten to import it.'].join('\\n'));\n }\n\n var classNamePrefix = name;\n\n if (process.env.NODE_ENV !== 'production') {\n if (!name) {\n // Provide a better DX outside production.\n var displayName = (0, _utils.getDisplayName)(Component);\n\n if (displayName !== undefined) {\n classNamePrefix = displayName;\n }\n }\n }\n\n var stylesOrCreator = typeof style === 'function' ? function (theme) {\n return {\n root: function root(props) {\n return style((0, _extends2.default)({\n theme: theme\n }, props));\n }\n };\n } : {\n root: style\n };\n var useStyles = (0, _makeStyles.default)(stylesOrCreator, (0, _extends2.default)({\n Component: Component,\n name: name || Component.displayName,\n classNamePrefix: classNamePrefix\n }, stylesOptions));\n var filterProps;\n var propTypes = {};\n\n if (style.filterProps) {\n filterProps = style.filterProps;\n delete style.filterProps;\n }\n /* eslint-disable react/forbid-foreign-prop-types */\n\n\n if (style.propTypes) {\n propTypes = style.propTypes;\n delete style.propTypes;\n }\n /* eslint-enable react/forbid-foreign-prop-types */\n\n\n var StyledComponent = /*#__PURE__*/_react.default.forwardRef(function StyledComponent(props, ref) {\n var children = props.children,\n classNameProp = props.className,\n clone = props.clone,\n ComponentProp = props.component,\n other = (0, _objectWithoutProperties2.default)(props, [\"children\", \"className\", \"clone\", \"component\"]);\n var classes = useStyles(props);\n var className = (0, _clsx.default)(classes.root, classNameProp);\n var spread = other;\n\n if (filterProps) {\n spread = omit(spread, filterProps);\n }\n\n if (clone) {\n return /*#__PURE__*/_react.default.cloneElement(children, (0, _extends2.default)({\n className: (0, _clsx.default)(children.props.className, className)\n }, spread));\n }\n\n if (typeof children === 'function') {\n return children((0, _extends2.default)({\n className: className\n }, spread));\n }\n\n var FinalComponent = ComponentProp || Component;\n return /*#__PURE__*/_react.default.createElement(FinalComponent, (0, _extends2.default)({\n ref: ref,\n className: className\n }, spread), children);\n });\n\n process.env.NODE_ENV !== \"production\" ? StyledComponent.propTypes = (0, _extends2.default)({\n /**\n * A render function or node.\n */\n children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),\n\n /**\n * @ignore\n */\n className: _propTypes.default.string,\n\n /**\n * If `true`, the component will recycle it's children HTML element.\n * It's using `React.cloneElement` internally.\n *\n * This prop will be deprecated and removed in v5\n */\n clone: (0, _utils.chainPropTypes)(_propTypes.default.bool, function (props) {\n if (props.clone && props.component) {\n return new Error('You can not use the clone and component prop at the same time.');\n }\n\n return null;\n }),\n\n /**\n * The component used for the root node.\n * Either a string to use a HTML element or a component.\n */\n component: _propTypes.default\n /* @typescript-to-proptypes-ignore */\n .elementType\n }, propTypes) : void 0;\n\n if (process.env.NODE_ENV !== 'production') {\n StyledComponent.displayName = \"Styled(\".concat(classNamePrefix, \")\");\n }\n\n (0, _hoistNonReactStatics.default)(StyledComponent, Component);\n return StyledComponent;\n };\n\n return componentCreator;\n}", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function get() {\n return _styled.default;\n }\n});\n\nvar _styled = _interopRequireDefault(require(\"./styled\"));", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _extends2 = _interopRequireDefault(require(\"@babel/runtime/helpers/extends\"));\n\nvar _react = _interopRequireDefault(require(\"react\"));\n\nvar _propTypes = _interopRequireDefault(require(\"prop-types\"));\n\nvar _utils = require(\"@material-ui/utils\");\n\nvar _ThemeContext = _interopRequireDefault(require(\"../useTheme/ThemeContext\"));\n\nvar _useTheme = _interopRequireDefault(require(\"../useTheme\"));\n\nvar _nested = _interopRequireDefault(require(\"./nested\"));\n\n// To support composition of theme.\nfunction mergeOuterLocalTheme(outerTheme, localTheme) {\n if (typeof localTheme === 'function') {\n var mergedTheme = localTheme(outerTheme);\n\n if (process.env.NODE_ENV !== 'production') {\n if (!mergedTheme) {\n console.error(['Material-UI: You should return an object from your theme function, i.e.', ' ({})} />'].join('\\n'));\n }\n }\n\n return mergedTheme;\n }\n\n return (0, _extends2.default)({}, outerTheme, localTheme);\n}\n/**\n * This component takes a `theme` prop.\n * It makes the `theme` available down the React tree thanks to React context.\n * This component should preferably be used at **the root of your component tree**.\n */\n\n\nfunction ThemeProvider(props) {\n var children = props.children,\n localTheme = props.theme;\n var outerTheme = (0, _useTheme.default)();\n\n if (process.env.NODE_ENV !== 'production') {\n if (outerTheme === null && typeof localTheme === 'function') {\n console.error(['Material-UI: You are providing a theme function prop to the ThemeProvider component:', ' outerTheme} />', '', 'However, no outer theme is present.', 'Make sure a theme is already injected higher in the React tree ' + 'or provide a theme object.'].join('\\n'));\n }\n }\n\n var theme = _react.default.useMemo(function () {\n var output = outerTheme === null ? localTheme : mergeOuterLocalTheme(outerTheme, localTheme);\n\n if (output != null) {\n output[_nested.default] = outerTheme !== null;\n }\n\n return output;\n }, [localTheme, outerTheme]);\n\n return /*#__PURE__*/_react.default.createElement(_ThemeContext.default.Provider, {\n value: theme\n }, children);\n}\n\nprocess.env.NODE_ENV !== \"production\" ? ThemeProvider.propTypes = {\n /**\n * Your component tree.\n */\n children: _propTypes.default.node.isRequired,\n\n /**\n * A theme object. You can provide a function to extend the outer theme.\n */\n theme: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.func]).isRequired\n} : void 0;\n\nif (process.env.NODE_ENV !== 'production') {\n process.env.NODE_ENV !== \"production\" ? ThemeProvider.propTypes = (0, _utils.exactProp)(ThemeProvider.propTypes) : void 0;\n}\n\nvar _default = ThemeProvider;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function get() {\n return _ThemeProvider.default;\n }\n});\n\nvar _ThemeProvider = _interopRequireDefault(require(\"./ThemeProvider\"));", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _extends2 = _interopRequireDefault(require(\"@babel/runtime/helpers/extends\"));\n\nvar _objectWithoutProperties2 = _interopRequireDefault(require(\"@babel/runtime/helpers/objectWithoutProperties\"));\n\nvar _react = _interopRequireDefault(require(\"react\"));\n\nvar _propTypes = _interopRequireDefault(require(\"prop-types\"));\n\nvar _hoistNonReactStatics = _interopRequireDefault(require(\"hoist-non-react-statics\"));\n\nvar _utils = require(\"@material-ui/utils\");\n\nvar _makeStyles = _interopRequireDefault(require(\"../makeStyles\"));\n\nvar _getThemeProps = _interopRequireDefault(require(\"../getThemeProps\"));\n\nvar _useTheme = _interopRequireDefault(require(\"../useTheme\"));\n\n// Link a style sheet with a component.\n// It does not modify the component passed to it;\n// instead, it returns a new component, with a `classes` property.\nvar withStyles = function withStyles(stylesOrCreator) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return function (Component) {\n var defaultTheme = options.defaultTheme,\n _options$withTheme = options.withTheme,\n withTheme = _options$withTheme === void 0 ? false : _options$withTheme,\n name = options.name,\n stylesOptions = (0, _objectWithoutProperties2.default)(options, [\"defaultTheme\", \"withTheme\", \"name\"]);\n\n if (process.env.NODE_ENV !== 'production') {\n if (Component === undefined) {\n throw new Error(['You are calling withStyles(styles)(Component) with an undefined component.', 'You may have forgotten to import it.'].join('\\n'));\n }\n }\n\n var classNamePrefix = name;\n\n if (process.env.NODE_ENV !== 'production') {\n if (!name) {\n // Provide a better DX outside production.\n var displayName = (0, _utils.getDisplayName)(Component);\n\n if (displayName !== undefined) {\n classNamePrefix = displayName;\n }\n }\n }\n\n var useStyles = (0, _makeStyles.default)(stylesOrCreator, (0, _extends2.default)({\n defaultTheme: defaultTheme,\n Component: Component,\n name: name || Component.displayName,\n classNamePrefix: classNamePrefix\n }, stylesOptions));\n\n var WithStyles = /*#__PURE__*/_react.default.forwardRef(function WithStyles(props, ref) {\n var classesProp = props.classes,\n innerRef = props.innerRef,\n other = (0, _objectWithoutProperties2.default)(props, [\"classes\", \"innerRef\"]); // The wrapper receives only user supplied props, which could be a subset of\n // the actual props Component might receive due to merging with defaultProps.\n // So copying it here would give us the same result in the wrapper as well.\n\n var classes = useStyles((0, _extends2.default)({}, Component.defaultProps, props));\n var theme;\n var more = other;\n\n if (typeof name === 'string' || withTheme) {\n // name and withTheme are invariant in the outer scope\n // eslint-disable-next-line react-hooks/rules-of-hooks\n theme = (0, _useTheme.default)() || defaultTheme;\n\n if (name) {\n more = (0, _getThemeProps.default)({\n theme: theme,\n name: name,\n props: other\n });\n } // Provide the theme to the wrapped component.\n // So we don't have to use the `withTheme()` Higher-order Component.\n\n\n if (withTheme && !more.theme) {\n more.theme = theme;\n }\n }\n\n return /*#__PURE__*/_react.default.createElement(Component, (0, _extends2.default)({\n ref: innerRef || ref,\n classes: classes\n }, more));\n });\n\n process.env.NODE_ENV !== \"production\" ? WithStyles.propTypes = {\n /**\n * Override or extend the styles applied to the component.\n */\n classes: _propTypes.default.object,\n\n /**\n * Use that prop to pass a ref to the decorated component.\n * @deprecated\n */\n innerRef: (0, _utils.chainPropTypes)(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]), function (props) {\n if (props.innerRef == null) {\n return null;\n }\n\n return null; // return new Error(\n // 'Material-UI: The `innerRef` prop is deprecated and will be removed in v5. ' +\n // 'Refs are now automatically forwarded to the inner component.',\n // );\n })\n } : void 0;\n\n if (process.env.NODE_ENV !== 'production') {\n WithStyles.displayName = \"WithStyles(\".concat((0, _utils.getDisplayName)(Component), \")\");\n }\n\n (0, _hoistNonReactStatics.default)(WithStyles, Component);\n\n if (process.env.NODE_ENV !== 'production') {\n // Exposed for test purposes.\n WithStyles.Naked = Component;\n WithStyles.options = options;\n WithStyles.useStyles = useStyles;\n }\n\n return WithStyles;\n };\n};\n\nvar _default = withStyles;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function get() {\n return _withStyles.default;\n }\n});\n\nvar _withStyles = _interopRequireDefault(require(\"./withStyles\"));", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.withThemeCreator = withThemeCreator;\nexports.default = void 0;\n\nvar _extends2 = _interopRequireDefault(require(\"@babel/runtime/helpers/extends\"));\n\nvar _objectWithoutProperties2 = _interopRequireDefault(require(\"@babel/runtime/helpers/objectWithoutProperties\"));\n\nvar _react = _interopRequireDefault(require(\"react\"));\n\nvar _propTypes = _interopRequireDefault(require(\"prop-types\"));\n\nvar _hoistNonReactStatics = _interopRequireDefault(require(\"hoist-non-react-statics\"));\n\nvar _utils = require(\"@material-ui/utils\");\n\nvar _useTheme = _interopRequireDefault(require(\"../useTheme\"));\n\nfunction withThemeCreator() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var defaultTheme = options.defaultTheme;\n\n var withTheme = function withTheme(Component) {\n if (process.env.NODE_ENV !== 'production') {\n if (Component === undefined) {\n throw new Error(['You are calling withTheme(Component) with an undefined component.', 'You may have forgotten to import it.'].join('\\n'));\n }\n }\n\n var WithTheme = /*#__PURE__*/_react.default.forwardRef(function WithTheme(props, ref) {\n var innerRef = props.innerRef,\n other = (0, _objectWithoutProperties2.default)(props, [\"innerRef\"]);\n var theme = (0, _useTheme.default)() || defaultTheme;\n return /*#__PURE__*/_react.default.createElement(Component, (0, _extends2.default)({\n theme: theme,\n ref: innerRef || ref\n }, other));\n });\n\n process.env.NODE_ENV !== \"production\" ? WithTheme.propTypes = {\n /**\n * Use that prop to pass a ref to the decorated component.\n * @deprecated\n */\n innerRef: (0, _utils.chainPropTypes)(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]), function (props) {\n if (props.innerRef == null) {\n return null;\n }\n\n return new Error('Material-UI: The `innerRef` prop is deprecated and will be removed in v5. ' + 'Refs are now automatically forwarded to the inner component.');\n })\n } : void 0;\n\n if (process.env.NODE_ENV !== 'production') {\n WithTheme.displayName = \"WithTheme(\".concat((0, _utils.getDisplayName)(Component), \")\");\n }\n\n (0, _hoistNonReactStatics.default)(WithTheme, Component);\n\n if (process.env.NODE_ENV !== 'production') {\n // Exposed for test purposes.\n WithTheme.Naked = Component;\n }\n\n return WithTheme;\n };\n\n return withTheme;\n} // Provide the theme object as a prop to the input component.\n// It's an alternative API to useTheme().\n// We encourage the usage of useTheme() where possible.\n\n\nvar withTheme = withThemeCreator();\nvar _default = withTheme;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireWildcard = require(\"@babel/runtime/helpers/interopRequireWildcard\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar _exportNames = {};\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function get() {\n return _withTheme.default;\n }\n});\n\nvar _withTheme = _interopRequireWildcard(require(\"./withTheme\"));\n\nObject.keys(_withTheme).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _withTheme[key];\n }\n });\n});", "/** @license Material-UI v4.11.5\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\"use strict\";\n\nvar _interopRequireWildcard = require(\"@babel/runtime/helpers/interopRequireWildcard\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar _exportNames = {\n createGenerateClassName: true,\n createStyles: true,\n getThemeProps: true,\n jssPreset: true,\n makeStyles: true,\n mergeClasses: true,\n ServerStyleSheets: true,\n styled: true,\n StylesProvider: true,\n ThemeProvider: true,\n useTheme: true,\n withStyles: true,\n withTheme: true\n};\nObject.defineProperty(exports, \"createGenerateClassName\", {\n enumerable: true,\n get: function get() {\n return _createGenerateClassName.default;\n }\n});\nObject.defineProperty(exports, \"createStyles\", {\n enumerable: true,\n get: function get() {\n return _createStyles.default;\n }\n});\nObject.defineProperty(exports, \"getThemeProps\", {\n enumerable: true,\n get: function get() {\n return _getThemeProps.default;\n }\n});\nObject.defineProperty(exports, \"jssPreset\", {\n enumerable: true,\n get: function get() {\n return _jssPreset.default;\n }\n});\nObject.defineProperty(exports, \"makeStyles\", {\n enumerable: true,\n get: function get() {\n return _makeStyles.default;\n }\n});\nObject.defineProperty(exports, \"mergeClasses\", {\n enumerable: true,\n get: function get() {\n return _mergeClasses.default;\n }\n});\nObject.defineProperty(exports, \"ServerStyleSheets\", {\n enumerable: true,\n get: function get() {\n return _ServerStyleSheets.default;\n }\n});\nObject.defineProperty(exports, \"styled\", {\n enumerable: true,\n get: function get() {\n return _styled.default;\n }\n});\nObject.defineProperty(exports, \"StylesProvider\", {\n enumerable: true,\n get: function get() {\n return _StylesProvider.default;\n }\n});\nObject.defineProperty(exports, \"ThemeProvider\", {\n enumerable: true,\n get: function get() {\n return _ThemeProvider.default;\n }\n});\nObject.defineProperty(exports, \"useTheme\", {\n enumerable: true,\n get: function get() {\n return _useTheme.default;\n }\n});\nObject.defineProperty(exports, \"withStyles\", {\n enumerable: true,\n get: function get() {\n return _withStyles.default;\n }\n});\nObject.defineProperty(exports, \"withTheme\", {\n enumerable: true,\n get: function get() {\n return _withTheme.default;\n }\n});\n\nvar _utils = require(\"@material-ui/utils\");\n\nvar _createGenerateClassName = _interopRequireWildcard(require(\"./createGenerateClassName\"));\n\nObject.keys(_createGenerateClassName).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _createGenerateClassName[key];\n }\n });\n});\n\nvar _createStyles = _interopRequireWildcard(require(\"./createStyles\"));\n\nObject.keys(_createStyles).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _createStyles[key];\n }\n });\n});\n\nvar _getThemeProps = _interopRequireWildcard(require(\"./getThemeProps\"));\n\nObject.keys(_getThemeProps).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _getThemeProps[key];\n }\n });\n});\n\nvar _jssPreset = _interopRequireWildcard(require(\"./jssPreset\"));\n\nObject.keys(_jssPreset).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _jssPreset[key];\n }\n });\n});\n\nvar _makeStyles = _interopRequireWildcard(require(\"./makeStyles\"));\n\nObject.keys(_makeStyles).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _makeStyles[key];\n }\n });\n});\n\nvar _mergeClasses = _interopRequireWildcard(require(\"./mergeClasses\"));\n\nObject.keys(_mergeClasses).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _mergeClasses[key];\n }\n });\n});\n\nvar _ServerStyleSheets = _interopRequireWildcard(require(\"./ServerStyleSheets\"));\n\nObject.keys(_ServerStyleSheets).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _ServerStyleSheets[key];\n }\n });\n});\n\nvar _styled = _interopRequireWildcard(require(\"./styled\"));\n\nObject.keys(_styled).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _styled[key];\n }\n });\n});\n\nvar _StylesProvider = _interopRequireWildcard(require(\"./StylesProvider\"));\n\nObject.keys(_StylesProvider).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _StylesProvider[key];\n }\n });\n});\n\nvar _ThemeProvider = _interopRequireWildcard(require(\"./ThemeProvider\"));\n\nObject.keys(_ThemeProvider).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _ThemeProvider[key];\n }\n });\n});\n\nvar _useTheme = _interopRequireWildcard(require(\"./useTheme\"));\n\nObject.keys(_useTheme).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _useTheme[key];\n }\n });\n});\n\nvar _withStyles = _interopRequireWildcard(require(\"./withStyles\"));\n\nObject.keys(_withStyles).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _withStyles[key];\n }\n });\n});\n\nvar _withTheme = _interopRequireWildcard(require(\"./withTheme\"));\n\nObject.keys(_withTheme).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _withTheme[key];\n }\n });\n});\n\n/* eslint-disable import/export */\n\n/* Warning if there are several instances of @material-ui/styles */\nif (process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'test' && typeof window !== 'undefined') {\n _utils.ponyfillGlobal['__@material-ui/styles-init__'] = _utils.ponyfillGlobal['__@material-ui/styles-init__'] || 0;\n\n if (_utils.ponyfillGlobal['__@material-ui/styles-init__'] === 1) {\n console.warn(['It looks like there are several instances of `@material-ui/styles` initialized in this application.', 'This may cause theme propagation issues, broken class names, ' + 'specificity issues, and makes your application bigger without a good reason.', '', 'See https://mui.com/r/styles-instance-warning for more info.'].join('\\n'));\n }\n\n _utils.ponyfillGlobal['__@material-ui/styles-init__'] += 1;\n}", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = createStyles;\n\nvar _styles = require(\"@material-ui/styles\");\n\n// let warnOnce = false;\n// To remove in v5\nfunction createStyles(styles) {\n // warning(\n // warnOnce,\n // [\n // 'Material-UI: createStyles from @material-ui/core/styles is deprecated.',\n // 'Please use @material-ui/styles/createStyles',\n // ].join('\\n'),\n // );\n // warnOnce = true;\n return (0, _styles.createStyles)(styles);\n}", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _createTheme = _interopRequireDefault(require(\"./createTheme\"));\n\nvar defaultTheme = (0, _createTheme.default)();\nvar _default = defaultTheme;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _extends2 = _interopRequireDefault(require(\"@babel/runtime/helpers/extends\"));\n\nvar _styles = require(\"@material-ui/styles\");\n\nvar _defaultTheme = _interopRequireDefault(require(\"./defaultTheme\"));\n\nfunction makeStyles(stylesOrCreator) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return (0, _styles.makeStyles)(stylesOrCreator, (0, _extends2.default)({\n defaultTheme: _defaultTheme.default\n }, options));\n}\n\nvar _default = makeStyles;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.isUnitless = isUnitless;\nexports.getUnit = getUnit;\nexports.toUnitless = toUnitless;\nexports.convertLength = convertLength;\nexports.alignProperty = alignProperty;\nexports.fontGrid = fontGrid;\nexports.responsiveProperty = responsiveProperty;\n\nvar _defineProperty2 = _interopRequireDefault(require(\"@babel/runtime/helpers/defineProperty\"));\n\nfunction isUnitless(value) {\n return String(parseFloat(value)).length === String(value).length;\n} // Ported from Compass\n// https://github.com/Compass/compass/blob/master/core/stylesheets/compass/typography/_units.scss\n// Emulate the sass function \"unit\"\n\n\nfunction getUnit(input) {\n return String(input).match(/[\\d.\\-+]*\\s*(.*)/)[1] || '';\n} // Emulate the sass function \"unitless\"\n\n\nfunction toUnitless(length) {\n return parseFloat(length);\n} // Convert any CSS or value to any another.\n// From https://github.com/KyleAMathews/convert-css-length\n\n\nfunction convertLength(baseFontSize) {\n return function (length, toUnit) {\n var fromUnit = getUnit(length); // Optimize for cases where `from` and `to` units are accidentally the same.\n\n if (fromUnit === toUnit) {\n return length;\n } // Convert input length to pixels.\n\n\n var pxLength = toUnitless(length);\n\n if (fromUnit !== 'px') {\n if (fromUnit === 'em') {\n pxLength = toUnitless(length) * toUnitless(baseFontSize);\n } else if (fromUnit === 'rem') {\n pxLength = toUnitless(length) * toUnitless(baseFontSize);\n return length;\n }\n } // Convert length in pixels to the output unit\n\n\n var outputLength = pxLength;\n\n if (toUnit !== 'px') {\n if (toUnit === 'em') {\n outputLength = pxLength / toUnitless(baseFontSize);\n } else if (toUnit === 'rem') {\n outputLength = pxLength / toUnitless(baseFontSize);\n } else {\n return length;\n }\n }\n\n return parseFloat(outputLength.toFixed(5)) + toUnit;\n };\n}\n\nfunction alignProperty(_ref) {\n var size = _ref.size,\n grid = _ref.grid;\n var sizeBelow = size - size % grid;\n var sizeAbove = sizeBelow + grid;\n return size - sizeBelow < sizeAbove - size ? sizeBelow : sizeAbove;\n} // fontGrid finds a minimal grid (in rem) for the fontSize values so that the\n// lineHeight falls under a x pixels grid, 4px in the case of Material Design,\n// without changing the relative line height\n\n\nfunction fontGrid(_ref2) {\n var lineHeight = _ref2.lineHeight,\n pixels = _ref2.pixels,\n htmlFontSize = _ref2.htmlFontSize;\n return pixels / (lineHeight * htmlFontSize);\n}\n/**\n * generate a responsive version of a given CSS property\n * @example\n * responsiveProperty({\n * cssProperty: 'fontSize',\n * min: 15,\n * max: 20,\n * unit: 'px',\n * breakpoints: [300, 600],\n * })\n *\n * // this returns\n *\n * {\n * fontSize: '15px',\n * '@media (min-width:300px)': {\n * fontSize: '17.5px',\n * },\n * '@media (min-width:600px)': {\n * fontSize: '20px',\n * },\n * }\n *\n * @param {Object} params\n * @param {string} params.cssProperty - The CSS property to be made responsive\n * @param {number} params.min - The smallest value of the CSS property\n * @param {number} params.max - The largest value of the CSS property\n * @param {string} [params.unit] - The unit to be used for the CSS property\n * @param {Array.number} [params.breakpoints] - An array of breakpoints\n * @param {number} [params.alignStep] - Round scaled value to fall under this grid\n * @returns {Object} responsive styles for {params.cssProperty}\n */\n\n\nfunction responsiveProperty(_ref3) {\n var cssProperty = _ref3.cssProperty,\n min = _ref3.min,\n max = _ref3.max,\n _ref3$unit = _ref3.unit,\n unit = _ref3$unit === void 0 ? 'rem' : _ref3$unit,\n _ref3$breakpoints = _ref3.breakpoints,\n breakpoints = _ref3$breakpoints === void 0 ? [600, 960, 1280] : _ref3$breakpoints,\n _ref3$transform = _ref3.transform,\n transform = _ref3$transform === void 0 ? null : _ref3$transform;\n var output = (0, _defineProperty2.default)({}, cssProperty, \"\".concat(min).concat(unit));\n var factor = (max - min) / breakpoints[breakpoints.length - 1];\n breakpoints.forEach(function (breakpoint) {\n var value = min + factor * breakpoint;\n\n if (transform !== null) {\n value = transform(value);\n }\n\n output[\"@media (min-width:\".concat(breakpoint, \"px)\")] = (0, _defineProperty2.default)({}, cssProperty, \"\".concat(Math.round(value * 10000) / 10000).concat(unit));\n });\n return output;\n}", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = responsiveFontSizes;\n\nvar _extends2 = _interopRequireDefault(require(\"@babel/runtime/helpers/extends\"));\n\nvar _utils = require(\"@material-ui/utils\");\n\nvar _cssUtils = require(\"./cssUtils\");\n\nfunction responsiveFontSizes(themeInput) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var _options$breakpoints = options.breakpoints,\n breakpoints = _options$breakpoints === void 0 ? ['sm', 'md', 'lg'] : _options$breakpoints,\n _options$disableAlign = options.disableAlign,\n disableAlign = _options$disableAlign === void 0 ? false : _options$disableAlign,\n _options$factor = options.factor,\n factor = _options$factor === void 0 ? 2 : _options$factor,\n _options$variants = options.variants,\n variants = _options$variants === void 0 ? ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'subtitle1', 'subtitle2', 'body1', 'body2', 'caption', 'button', 'overline'] : _options$variants;\n var theme = (0, _extends2.default)({}, themeInput);\n theme.typography = (0, _extends2.default)({}, theme.typography);\n var typography = theme.typography; // Convert between css lengths e.g. em->px or px->rem\n // Set the baseFontSize for your project. Defaults to 16px (also the browser default).\n\n var convert = (0, _cssUtils.convertLength)(typography.htmlFontSize);\n var breakpointValues = breakpoints.map(function (x) {\n return theme.breakpoints.values[x];\n });\n variants.forEach(function (variant) {\n var style = typography[variant];\n var remFontSize = parseFloat(convert(style.fontSize, 'rem'));\n\n if (remFontSize <= 1) {\n return;\n }\n\n var maxFontSize = remFontSize;\n var minFontSize = 1 + (maxFontSize - 1) / factor;\n var lineHeight = style.lineHeight;\n\n if (!(0, _cssUtils.isUnitless)(lineHeight) && !disableAlign) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? \"Material-UI: Unsupported non-unitless line height with grid alignment.\\nUse unitless line heights instead.\" : (0, _utils.formatMuiErrorMessage)(6));\n }\n\n if (!(0, _cssUtils.isUnitless)(lineHeight)) {\n // make it unitless\n lineHeight = parseFloat(convert(lineHeight, 'rem')) / parseFloat(remFontSize);\n }\n\n var transform = null;\n\n if (!disableAlign) {\n transform = function transform(value) {\n return (0, _cssUtils.alignProperty)({\n size: value,\n grid: (0, _cssUtils.fontGrid)({\n pixels: 4,\n lineHeight: lineHeight,\n htmlFontSize: typography.htmlFontSize\n })\n });\n };\n }\n\n typography[variant] = (0, _extends2.default)({}, style, (0, _cssUtils.responsiveProperty)({\n cssProperty: 'fontSize',\n min: minFontSize,\n max: maxFontSize,\n unit: 'rem',\n breakpoints: breakpointValues,\n transform: transform\n }));\n });\n return theme;\n}", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _extends2 = _interopRequireDefault(require(\"@babel/runtime/helpers/extends\"));\n\nvar _styles = require(\"@material-ui/styles\");\n\nvar _defaultTheme = _interopRequireDefault(require(\"./defaultTheme\"));\n\nvar styled = function styled(Component) {\n var componentCreator = (0, _styles.styled)(Component);\n return function (style, options) {\n return componentCreator(style, (0, _extends2.default)({\n defaultTheme: _defaultTheme.default\n }, options));\n };\n};\n\nvar _default = styled;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = useTheme;\n\nvar _styles = require(\"@material-ui/styles\");\n\nvar _react = _interopRequireDefault(require(\"react\"));\n\nvar _defaultTheme = _interopRequireDefault(require(\"./defaultTheme\"));\n\nfunction useTheme() {\n var theme = (0, _styles.useTheme)() || _defaultTheme.default;\n\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n _react.default.useDebugValue(theme);\n }\n\n return theme;\n}", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _extends2 = _interopRequireDefault(require(\"@babel/runtime/helpers/extends\"));\n\nvar _styles = require(\"@material-ui/styles\");\n\nvar _defaultTheme = _interopRequireDefault(require(\"./defaultTheme\"));\n\nfunction withStyles(stylesOrCreator, options) {\n return (0, _styles.withStyles)(stylesOrCreator, (0, _extends2.default)({\n defaultTheme: _defaultTheme.default\n }, options));\n}\n\nvar _default = withStyles;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _styles = require(\"@material-ui/styles\");\n\nvar _defaultTheme = _interopRequireDefault(require(\"./defaultTheme\"));\n\nvar withTheme = (0, _styles.withThemeCreator)({\n defaultTheme: _defaultTheme.default\n});\nvar _default = withTheme;\nexports.default = _default;", "\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nvar _interopRequireWildcard = require(\"@babel/runtime/helpers/interopRequireWildcard\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar _exportNames = {\n createTheme: true,\n createMuiTheme: true,\n unstable_createMuiStrictModeTheme: true,\n createStyles: true,\n makeStyles: true,\n responsiveFontSizes: true,\n styled: true,\n useTheme: true,\n withStyles: true,\n withTheme: true,\n createGenerateClassName: true,\n jssPreset: true,\n ServerStyleSheets: true,\n StylesProvider: true,\n MuiThemeProvider: true,\n ThemeProvider: true\n};\nObject.defineProperty(exports, \"createTheme\", {\n enumerable: true,\n get: function get() {\n return _createTheme.default;\n }\n});\nObject.defineProperty(exports, \"createMuiTheme\", {\n enumerable: true,\n get: function get() {\n return _createTheme.createMuiTheme;\n }\n});\nObject.defineProperty(exports, \"unstable_createMuiStrictModeTheme\", {\n enumerable: true,\n get: function get() {\n return _createMuiStrictModeTheme.default;\n }\n});\nObject.defineProperty(exports, \"createStyles\", {\n enumerable: true,\n get: function get() {\n return _createStyles.default;\n }\n});\nObject.defineProperty(exports, \"makeStyles\", {\n enumerable: true,\n get: function get() {\n return _makeStyles.default;\n }\n});\nObject.defineProperty(exports, \"responsiveFontSizes\", {\n enumerable: true,\n get: function get() {\n return _responsiveFontSizes.default;\n }\n});\nObject.defineProperty(exports, \"styled\", {\n enumerable: true,\n get: function get() {\n return _styled.default;\n }\n});\nObject.defineProperty(exports, \"useTheme\", {\n enumerable: true,\n get: function get() {\n return _useTheme.default;\n }\n});\nObject.defineProperty(exports, \"withStyles\", {\n enumerable: true,\n get: function get() {\n return _withStyles.default;\n }\n});\nObject.defineProperty(exports, \"withTheme\", {\n enumerable: true,\n get: function get() {\n return _withTheme.default;\n }\n});\nObject.defineProperty(exports, \"createGenerateClassName\", {\n enumerable: true,\n get: function get() {\n return _styles.createGenerateClassName;\n }\n});\nObject.defineProperty(exports, \"jssPreset\", {\n enumerable: true,\n get: function get() {\n return _styles.jssPreset;\n }\n});\nObject.defineProperty(exports, \"ServerStyleSheets\", {\n enumerable: true,\n get: function get() {\n return _styles.ServerStyleSheets;\n }\n});\nObject.defineProperty(exports, \"StylesProvider\", {\n enumerable: true,\n get: function get() {\n return _styles.StylesProvider;\n }\n});\nObject.defineProperty(exports, \"MuiThemeProvider\", {\n enumerable: true,\n get: function get() {\n return _styles.ThemeProvider;\n }\n});\nObject.defineProperty(exports, \"ThemeProvider\", {\n enumerable: true,\n get: function get() {\n return _styles.ThemeProvider;\n }\n});\n\nvar _colorManipulator = require(\"./colorManipulator\");\n\nObject.keys(_colorManipulator).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _colorManipulator[key];\n }\n });\n});\n\nvar _createTheme = _interopRequireWildcard(require(\"./createTheme\"));\n\nvar _createMuiStrictModeTheme = _interopRequireDefault(require(\"./createMuiStrictModeTheme\"));\n\nvar _createStyles = _interopRequireDefault(require(\"./createStyles\"));\n\nvar _makeStyles = _interopRequireDefault(require(\"./makeStyles\"));\n\nvar _responsiveFontSizes = _interopRequireDefault(require(\"./responsiveFontSizes\"));\n\nvar _styled = _interopRequireDefault(require(\"./styled\"));\n\nvar _transitions = require(\"./transitions\");\n\nObject.keys(_transitions).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function get() {\n return _transitions[key];\n }\n });\n});\n\nvar _useTheme = _interopRequireDefault(require(\"./useTheme\"));\n\nvar _withStyles = _interopRequireDefault(require(\"./withStyles\"));\n\nvar _withTheme = _interopRequireDefault(require(\"./withTheme\"));\n\nvar _styles = require(\"@material-ui/styles\");", "import { createTheme } from '@material-ui/core/styles';\n\nimport orange from '@material-ui/core/colors/orange';\n\nconst step = (16 - 5) / 23 / 100;\n\n/**\n * Convert hex color in the format '#rrggbb' or '#rgb' to an RGB object.\n * @param {string} hex\n * @returns {{r: number, g: number, b: number}}\n */\nfunction toInt(hex) {\n const rgb = {\n r: 0,\n g: 0,\n b: 0,\n };\n\n if (hex.length === 7) {\n rgb.r = parseInt(hex.substr(1, 2), 16);\n rgb.g = parseInt(hex.substr(3, 2), 16);\n rgb.b = parseInt(hex.substr(5, 2), 16);\n } else if (hex.length === 4) {\n const r = hex.substr(1, 1);\n const g = hex.substr(2, 1);\n const b = hex.substr(3, 1);\n\n rgb.r = parseInt(r + r, 16);\n rgb.g = parseInt(g + g, 16);\n rgb.b = parseInt(b + b, 16);\n }\n\n return rgb;\n}\n\n/**\n * Convert an RGB object to a hex color string in the format '#rrggbb'.\n * @param {{r: number, g: number, b: number}} int\n * @returns {string}\n */\nfunction toHex(int) {\n return `#${Math.round(int.r).toString(16)}${Math.round(int.g).toString(16)}${Math.round(int.b).toString(16)}`;\n}\n\n/**\n * @param {string} color color in the format '#rrggbb' or '#rgb'\n * @param {string} overlayColor overlay color in the format '#rrggbb' or '#rgb'\n * @param {number} elevation elevation as an integer starting with 1\n * @returns {string} the hex color string in the format '#rrggbb'\n */\nfunction getElevation(color, overlayColor, elevation) {\n const rgb = toInt(color);\n const overlay = toInt(overlayColor);\n\n rgb.r += overlay.r * (0.05 + step * (elevation - 1));\n rgb.g += overlay.g * (0.05 + step * (elevation - 1));\n rgb.b += overlay.b * (0.05 + step * (elevation - 1));\n\n return toHex(rgb);\n}\n\n/**\n * Get all 24 elevations of the given color and overlay.\n * @param {string} color color in the format '#rrggbb' or '#rgb'\n * @param {string} overlay overlay color in the format '#rrggbb' or '#rgb'\n * @returns {import('@material-ui/core/styles/withStyles').CSSProperties}\n */\nfunction getElevations(color, overlay) {\n /** @type {import('@material-ui/core/styles/withStyles').CSSProperties} */\n const elevations = {};\n\n for (let i = 1; i <= 24; i++) {\n elevations[`elevation${i}`] = {\n backgroundColor: getElevation(color, overlay, i),\n };\n }\n\n return elevations;\n}\n\n/**\n * The theme creation factory function.\n * @param {string} type\n * @returns {import('./types').Theme}\n */\nconst Theme = type => {\n let theme;\n if (type === 'dark') {\n theme = {\n name: type,\n palette: {\n type: 'dark',\n background: {\n paper: '#121212',\n default: '#121212'\n },\n primary: {\n main: '#4dabf5'\n },\n secondary: {\n main: '#436a93'\n },\n expert: '#14bb00',\n text: {\n primary: '#ffffff',\n secondary: '#ffffff'\n }\n },\n overrides: {\n MuiAppBar: {\n colorDefault: {\n backgroundColor: '#272727'\n }\n },\n MuiLink: {\n root: {\n textTransform: 'uppercase',\n transition: 'color .3s ease',\n color: orange[200],\n '&:hover': {\n color: orange[100]\n }\n }\n },\n MuiPaper: getElevations('#121212', '#fff')\n }\n };\n } else if (type === 'blue') {\n theme = {\n name: type,\n palette: {\n type: 'dark',\n background: {\n paper: '#151d21',\n default: '#151d21'\n },\n primary: {\n main: '#4dabf5'\n },\n secondary: {\n main: '#436a93'\n },\n expert: '#14bb00',\n text: {\n primary: '#ffffff',\n secondary: '#ffffff'\n }\n },\n overrides: {\n MuiAppBar: {\n colorDefault: {\n backgroundColor: '#2a3135'\n }\n },\n MuiLink: {\n root: {\n textTransform: 'uppercase',\n transition: 'color .3s ease',\n color: orange[200],\n '&:hover': {\n color: orange[100]\n }\n }\n },\n MuiPaper: getElevations('#151d21', '#fff')\n }\n };\n } else if (type === 'colored') {\n theme = {\n name: type,\n palette: {\n type: 'light',\n primary: {\n main: '#3399CC'\n },\n secondary: {\n main: '#164477'\n },\n expert: '#96fc96'\n },\n overrides: {\n MuiAppBar: {\n colorDefault: {\n backgroundColor: '#3399CC'\n }\n },\n MuiLink: {\n root: {\n textTransform: 'uppercase',\n transition: 'color .3s ease',\n color: orange[400],\n '&:hover': {\n color: orange[300]\n }\n }\n }\n }\n };\n } else if (type === 'PT') {\n theme = {\n name: type,\n palette: {\n type: 'light',\n primary: {\n main: '#0F99DE'\n },\n secondary: {\n main: '#88A536'\n },\n expert: '#BD1B24'\n },\n overrides: {\n MuiAppBar: {\n colorDefault: {\n backgroundColor: '#0F99DE'\n }\n },\n MuiLink: {\n root: {\n textTransform: 'uppercase',\n transition: 'color .3s ease',\n color: orange[400],\n '&:hover': {\n color: orange[300]\n }\n }\n }\n }\n };\n } else if (type === 'DX') {\n theme = {\n name: type,\n palette: {\n type: 'light',\n primary: {\n main: '#F5F5F7'\n },\n secondary: {\n main: '#a9a9a9'\n },\n expert: '#BD1B24',\n text: {\n primary: '#007AFE',\n secondary: '#007AFE',\n disabled: '#007AFEAA',\n }\n },\n overrides: {\n MuiAppBar: {\n colorDefault: {\n backgroundColor: '#a9a9a9'\n }\n },\n MuiLink: {\n root: {\n textTransform: 'uppercase',\n transition: 'color .3s ease',\n color: orange[400],\n '&:hover': {\n color: orange[300]\n }\n }\n }\n }\n };\n } else {\n theme = {\n name: type,\n palette: {\n type: 'light',\n primary: {\n main: '#3399CC'\n },\n secondary: {\n main: '#164477'\n },\n expert: '#14bb00'\n },\n overrides: {\n MuiLink: {\n root: {\n textTransform: 'uppercase',\n transition: 'color .3s ease',\n color: orange[400],\n '&:hover': {\n color: orange[300]\n }\n }\n }\n }\n };\n }\n\n theme.toolbar = {\n height: 48\n };\n\n // add save toolbar\n theme.saveToolbar = {\n background: theme.palette.primary.main,\n button: {\n borderRadius: 3,\n height: 32\n }\n };\n\n return createTheme(theme);\n};\n\nexport default Theme;\n", "/***\n * Copyright 2018-2022 bluefox \n *\n * MIT License\n *\n ***/\n\n /**\n * Translation string management.\n */\nclass I18n {\n /**\n * List of all languages with their translations.\n * @type {{ [lang in ioBroker.Languages]?: Record; }}\n */\n static translations = {};\n\n /**\n * The currently displayed language.\n * @type {ioBroker.Languages}\n */\n static lang = window.sysLang || 'en';\n\n static _disableWarning = false;\n\n /**\n * Set the language to display.\n * @param {ioBroker.Languages} lang\n */\n static setLanguage(lang) {\n if (lang) {\n I18n.lang = lang;\n }\n }\n\n /**\n * Add translations\n * User can provide two types of structures:\n * - {\"word1\": \"translated word1\", \"word2\": \"translated word2\"}, but in this case the lang must be provided\n * - {\"word1\": {\"en\": \"translated en word1\", \"de\": \"translated de word1\"}, \"word2\": {\"en\": \"translated en word2\", \"de\": \"translated de word2\"}}, but no lang must be provided\n * @param {object} words additional words for specific language\n * @param {ioBroker.Languages} lang\n */\n static extendTranslations(words, lang) {\n try {\n if (!lang) {\n Object.keys(words).forEach(word => {\n Object.keys(words[word]).forEach(lang => {\n if (!I18n.translations[lang]) {\n console.warn(`Used unknown language: ${lang}`);\n }\n if (!I18n.translations[lang][word]) {\n I18n.translations[lang][word] = words[word][lang];\n } else if (I18n.translations[lang][word] !== words[word][lang]) {\n console.warn(`Translation for word \"${word}\" in \"${lang}\" was ignored: existing = \"${I18n.translations[lang][word]}\", new = ${words[word][lang]}`);\n }\n });\n });\n } else {\n if (!I18n.translations[lang]) {\n console.warn(`Used unknown language: ${lang}`);\n }\n I18n.translations[lang] = I18n.translations[lang] || {};\n Object.keys(words)\n .forEach(word => {\n if (!I18n.translations[lang][word]) {\n I18n.translations[lang][word] = words[word];\n } else if (I18n.translations[lang][word] !== words[word]) {\n console.warn(`Translation for word \"${word}\" in \"${lang}\" was ignored: existing = \"${I18n.translations[lang][word]}\", new = ${words[word]}`);\n }\n });\n }\n } catch (e) {\n console.error(`Cannot apply translations: ${e}`);\n }\n }\n\n /**\n * Sets all translations (in all languages).\n * @param {{ [lang in ioBroker.Languages]?: Record; }} translations\n */\n static setTranslations(translations) {\n if (translations) {\n I18n.translations = translations;\n }\n }\n\n /**\n * Get the currently chosen language.\n * @returns {ioBroker.Languages} The current language.\n */\n static getLanguage() {\n return I18n.lang;\n }\n\n /**\n * Translate the given string to the selected language.\n * @param {string} word The (key) word to look up the string.\n * @param {string[]} args Optional arguments which will replace the first (second, third, ...) occurrences of %s\n */\n static t(word, ...args) {\n const translation = I18n.translations[I18n.lang];\n if (translation) {\n const w = translation[word];\n if (w) {\n word = w;\n } else {\n I18n._disableWarning && console.log(`Translate: ${word}`);\n }\n }\n for (const arg of args) {\n word = word.replace('%s', arg);\n }\n return word;\n }\n\n /**\n * Disable warning about non-translated words\n * Required during development\n * @param {boolean} disable Do the warning should be disabled\n */\n static disableWarning(disable) {\n I18n._disableWarning = !!disable;\n }\n}\n\n/*I18n.translations = {\n 'en': require('./i18n/en'),\n 'ru': require('./i18n/ru'),\n 'de': require('./i18n/de'),\n};\nI18n.fallbacks = true;\nI18n.t = function () {};*/\n\nexport default I18n;", "/**\r\n * Copyright 2018-2022 bluefox \r\n *\r\n * MIT License\r\n *\r\n **/\r\nimport React from 'react';\r\nimport I18n from '../i18n';\r\n\r\nconst NAMESPACE = 'material';\r\nconst days = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];\r\nconst months = ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\r\nconst QUALITY_BITS = {\r\n 0x00: '0x00 - good',\r\n\r\n 0x01: '0x01 - general problem',\r\n 0x02: '0x02 - no connection problem',\r\n\r\n 0x10: '0x10 - substitute value from controller',\r\n 0x20: '0x20 - substitute initial value',\r\n 0x40: '0x40 - substitute value from device or instance',\r\n 0x80: '0x80 - substitute value from sensor',\r\n\r\n 0x11: '0x11 - general problem by instance',\r\n 0x41: '0x41 - general problem by device',\r\n 0x81: '0x81 - general problem by sensor',\r\n\r\n 0x12: '0x12 - instance not connected',\r\n 0x42: '0x42 - device not connected',\r\n 0x82: '0x82 - sensor not connected',\r\n\r\n 0x44: '0x44 - device reports error',\r\n 0x84: '0x84 - sensor reports error',\r\n};\r\n\r\nclass Utils {\r\n static namespace = NAMESPACE;\r\n static INSTANCES = 'instances';\r\n static dateFormat = ['DD', 'MM'];\r\n static FORBIDDEN_CHARS = /[^._\\-/ :!#$%&()+=@^{}|~\\p{Ll}\\p{Lu}\\p{Nd}]+/gu;\r\n\r\n /**\r\n * Capitalize words.\r\n * @param {string | undefined} name\r\n * @returns {string}\r\n */\r\n static CapitalWords(name) {\r\n return (name || '').split(/[\\s_]/)\r\n .filter(item => item)\r\n .map(word => word ? word[0].toUpperCase() + word.substring(1).toLowerCase() : '')\r\n .join(' ');\r\n }\r\n\r\n static formatSeconds(seconds) {\r\n const days = Math.floor(seconds / (3600 * 24));\r\n seconds %= 3600 * 24;\r\n let hours = Math.floor(seconds / 3600);\r\n if (hours < 10) {\r\n hours = '0' + hours;\r\n }\r\n seconds %= 3600;\r\n let minutes = Math.floor(seconds / 60);\r\n if (minutes < 10) {\r\n minutes = '0' + minutes;\r\n }\r\n seconds %= 60;\r\n seconds = Math.floor(seconds);\r\n if (seconds < 10) {\r\n seconds = '0' + seconds;\r\n }\r\n let text = '';\r\n if (days) {\r\n text += `${days} ${I18n.t('ra_daysShortText')} `;\r\n }\r\n text += `${hours}:${minutes}:${seconds}`;\r\n\r\n return text;\r\n }\r\n\r\n /**\r\n * Get the name of the object by id from the name or description.\r\n * @param {Record} objects\r\n * @param {string} id\r\n * @param {{ name: any; } | ioBroker.Languages | null} settings\r\n * @param {{ language?: ioBroker.Languages; }} options\r\n * @param {boolean} [isDesc] Set to true to get the description.\r\n * @returns {string}\r\n */\r\n static getObjectName(objects, id, settings, options, isDesc) {\r\n let item = objects[id];\r\n let text = id;\r\n const attr = isDesc ? 'desc' : 'name';\r\n\r\n if (typeof settings === 'string' && !options) {\r\n options = {language: settings};\r\n settings = null;\r\n }\r\n\r\n options = options || {};\r\n if (!options.language) {\r\n options.language = (objects['system.config'] && objects['system.config'].common && objects['system.config'].common.language) || window.sysLang || 'en';\r\n }\r\n if (settings && settings.name) {\r\n text = settings.name;\r\n if (typeof text === 'object') {\r\n text = text[options.language] || text.en;\r\n }\r\n } else\r\n if (item && item.common && item.common[attr]) {\r\n text = item.common[attr];\r\n if (attr !== 'desc' && !text && item.common.desc) {\r\n text = item.common.desc;\r\n }\r\n if (typeof text === 'object') {\r\n text = text[options.language] || text.en || text.de || text.ru || '';\r\n }\r\n text = (text || '').toString().replace(/[_.]/g, ' ');\r\n\r\n if (text === text.toUpperCase()) {\r\n text = text[0] + text.substring(1).toLowerCase();\r\n }\r\n } else {\r\n let pos = id.lastIndexOf('.');\r\n text = id.substring(pos + 1).replace(/[_.]/g, ' ');\r\n text = Utils.CapitalWords(text);\r\n }\r\n\r\n return text.trim();\r\n }\r\n\r\n /**\r\n * Get the name of the object from the name or description.\r\n * @param {ioBroker.PartialObject} obj\r\n * @param {{ name: any; } | ioBroker.Languages | null } settings or language\r\n * @param {{ language?: ioBroker.Languages; } } options\r\n * @param {boolean} [isDesc] Set to true to get the description.\r\n * @returns {string}\r\n */\r\n static getObjectNameFromObj(obj, settings, options, isDesc) {\r\n let item = obj;\r\n let text = (obj && obj._id) || '';\r\n const attr = isDesc ? 'desc' : 'name';\r\n\r\n if (typeof settings === 'string' && !options) {\r\n options = {language: settings};\r\n settings = null;\r\n }\r\n\r\n options = options || {};\r\n\r\n if (settings && settings.name) {\r\n text = settings.name;\r\n if (typeof text === 'object') {\r\n text = text[options.language] || text.en;\r\n }\r\n } else\r\n if (item && item.common && item.common[attr]) {\r\n text = item.common[attr];\r\n if (attr !== 'desc' && !text && item.common.desc) {\r\n text = item.common.desc;\r\n }\r\n if (typeof text === 'object') {\r\n text = text[options.language] || text.en;\r\n }\r\n text = (text || '').toString().replace(/[_.]/g, ' ');\r\n\r\n if (text === text.toUpperCase()) {\r\n text = text[0] + text.substring(1).toLowerCase();\r\n }\r\n }\r\n return text.trim();\r\n }\r\n\r\n /**\r\n * @param {ioBroker.PartialObject | ioBroker.ObjectCommon} obj\r\n * @param {string} forEnumId\r\n * @param {{ user: string; }} options\r\n * @returns {string | null}\r\n */\r\n static getSettingsOrder(obj, forEnumId, options) {\r\n if (obj && obj.hasOwnProperty('common')) {\r\n obj = obj.common;\r\n }\r\n let settings;\r\n if (obj && obj.custom) {\r\n settings = (obj.custom || {})[NAMESPACE];\r\n const user = options.user || 'admin';\r\n if (settings && settings[user]) {\r\n if (forEnumId) {\r\n if (settings[user].subOrder && settings[user].subOrder[forEnumId]) {\r\n return JSON.parse(JSON.stringify(settings[user].subOrder[forEnumId]));\r\n }\r\n } else {\r\n if (settings[user].order) {\r\n return JSON.parse(JSON.stringify(settings[user].order));\r\n }\r\n }\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * @param {ioBroker.PartialObject | ioBroker.ObjectCommon} obj\r\n * @param {string} forEnumId\r\n * @param {{ user: string; }} options\r\n */\r\n static getSettingsCustomURLs(obj, forEnumId, options) {\r\n if (obj && obj.hasOwnProperty('common')) {\r\n obj = obj.common;\r\n }\r\n let settings;\r\n if (obj && obj.custom) {\r\n settings = (obj.custom || {})[NAMESPACE];\r\n const user = options.user || 'admin';\r\n if (settings && settings[user]) {\r\n if (forEnumId) {\r\n if (settings[user].subURLs && settings[user].subURLs[forEnumId]) {\r\n return JSON.parse(JSON.stringify(settings[user].subURLs[forEnumId]));\r\n }\r\n } else {\r\n if (settings[user].URLs) {\r\n return JSON.parse(JSON.stringify(settings[user].URLs));\r\n }\r\n }\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Reorder the array items in list between source and dest.\r\n * @param {Iterable | ArrayLike} list\r\n * @param {number} source\r\n * @param {number} dest\r\n */\r\n static reorder(list, source, dest) {\r\n const result = Array.from(list);\r\n const [removed] = result.splice(source, 1);\r\n result.splice(dest, 0, removed);\r\n return result;\r\n };\r\n\r\n /**\r\n * @param {any} obj\r\n * @param {{ id: any; user: any; name: any; icon: any; color: any; language: ioBroker.Languages; }} options\r\n * @param {boolean} [defaultEnabling]\r\n */\r\n static getSettings(obj, options, defaultEnabling) {\r\n let settings;\r\n const id = (obj && obj._id) || (options && options.id);\r\n if (obj && obj.hasOwnProperty('common')) {\r\n obj = obj.common;\r\n }\r\n if (obj && obj.custom) {\r\n settings = obj.custom || {};\r\n settings = settings[NAMESPACE] && settings[NAMESPACE][options.user || 'admin'] ? JSON.parse(JSON.stringify(settings[NAMESPACE][options.user || 'admin'])) : {enabled: true};\r\n } else {\r\n settings = {enabled: defaultEnabling === undefined ? true : defaultEnabling, useCustom: false};\r\n }\r\n\r\n if (!settings.hasOwnProperty('enabled')) {\r\n settings.enabled = defaultEnabling === undefined ? true : defaultEnabling;\r\n }\r\n\r\n if (false && settings.useCommon) {\r\n if (obj.color) settings.color = obj.color;\r\n if (obj.icon) settings.icon = obj.icon;\r\n if (obj.name) settings.name = obj.name;\r\n } else {\r\n if (options) {\r\n if (!settings.name && options.name) settings.name = options.name;\r\n if (!settings.icon && options.icon) settings.icon = options.icon;\r\n if (!settings.color && options.color) settings.color = options.color;\r\n }\r\n\r\n if (obj) {\r\n if (!settings.color && obj.color) settings.color = obj.color;\r\n if (!settings.icon && obj.icon) settings.icon = obj.icon;\r\n if (!settings.name && obj.name) settings.name = obj.name;\r\n }\r\n }\r\n\r\n if (typeof settings.name === 'object') {\r\n settings.name = settings.name[options.language] || settings.name.en;\r\n\r\n settings.name = (settings.name || '').toString().replace(/_/g, ' ');\r\n\r\n if (settings.name === settings.name.toUpperCase()) {\r\n settings.name = settings.name[0] + settings.name.substring(1).toLowerCase();\r\n }\r\n }\r\n if (!settings.name && id) {\r\n let pos = id.lastIndexOf('.');\r\n settings.name = id.substring(pos + 1).replace(/[_.]/g, ' ');\r\n settings.name = (settings.name || '').toString().replace(/_/g, ' ');\r\n settings.name = Utils.CapitalWords(settings.name);\r\n }\r\n\r\n return settings;\r\n }\r\n\r\n /**\r\n * @param {any} obj\r\n * @param {any} settings\r\n * @param {{ user: any; language: ioBroker.Languages; }} options\r\n */\r\n static setSettings(obj, settings, options) {\r\n if (obj) {\r\n obj.common = obj.common || {};\r\n obj.common.custom = obj.common.custom || {};\r\n obj.common.custom[NAMESPACE] = obj.common.custom[NAMESPACE] || {};\r\n obj.common.custom[NAMESPACE][options.user || 'admin'] = settings;\r\n const s = obj.common.custom[NAMESPACE][options.user || 'admin'];\r\n if (s.useCommon) {\r\n if (s.color !== undefined) {\r\n obj.common.color = s.color;\r\n delete s.color;\r\n }\r\n if (s.icon !== undefined) {\r\n obj.common.icon = s.icon;\r\n delete s.icon;\r\n }\r\n if (s.name !== undefined) {\r\n if (typeof obj.common.name !== 'object') {\r\n obj.common.name = {};\r\n obj.common.name[options.language] = s.name;\r\n } else{\r\n obj.common.name[options.language] = s.name;\r\n }\r\n delete s.name;\r\n }\r\n }\r\n\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * Get the icon for the given settings.\r\n * @param {{ icon: string | undefined; name: string | undefined; prefix: string | undefined}} settings\r\n * @param {any} style\r\n * @returns {JSX.Element | null}\r\n */\r\n static getIcon(settings, style) {\r\n if (settings && settings.icon) {\r\n // If UTF-8 icon\r\n if (settings.icon.length <= 2) {\r\n return {settings.icon};\r\n } else\r\n if (settings.icon.startsWith('data:image')) {\r\n return ;\r\n } else { // may be later some changes for second type\r\n return ;\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Get the icon for the given object.\r\n * @param {string} id\r\n * @param {{ common: { icon: any; }; }} obj\r\n * @returns {string | null}\r\n */\r\n static getObjectIcon(id, obj) {\r\n // If id is Object\r\n if (typeof id === 'object') {\r\n obj = id;\r\n id = obj._id;\r\n }\r\n\r\n if (obj && obj.common && obj.common.icon) {\r\n let icon = obj.common.icon;\r\n // If UTF-8 icon\r\n if (typeof icon === 'string' && icon.length <= 2) {\r\n return icon;\r\n } else\r\n if (icon.startsWith('data:image')) {\r\n return icon;\r\n } else {\r\n const parts = id.split('.');\r\n if (parts[0] === 'system') {\r\n icon = 'adapter/' + parts[2] + (icon.startsWith('/') ? '' : '/') + icon;\r\n } else {\r\n icon = 'adapter/' + parts[0] + (icon.startsWith('/') ? '' : '/') + icon;\r\n }\r\n\r\n if (window.location.pathname.match(/adapter\\/[^/]+\\/[^/]+\\.html/)) {\r\n icon = '../../' + icon;\r\n } else if (window.location.pathname.match(/material\\/[.\\d]+/)) {\r\n icon = '../../' + icon;\r\n } else\r\n if (window.location.pathname.match(/material\\//)) {\r\n icon = '../' + icon;\r\n }\r\n return icon;\r\n }\r\n } else {\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * Splits CamelCase into words.\r\n * @param {string | undefined} text\r\n * @returns {string}\r\n */\r\n static splitCamelCase(text) {\r\n if (false && text !== text.toUpperCase()) {\r\n const words = text.split(/\\s+/);\r\n for (let i = 0; i < words.length; i++) {\r\n let word = words[i];\r\n if (word.toLowerCase() !== word && word.toUpperCase() !== word) {\r\n let z = 0;\r\n const ww = [];\r\n let start = 0;\r\n while (z < word.length) {\r\n if (word[z].match(/[A-ZÜÄÖА-Я]/)) {\r\n ww.push(word.substring(start, z));\r\n start = z;\r\n }\r\n z++;\r\n }\r\n if (start !== z) {\r\n ww.push(word.substring(start, z));\r\n }\r\n for (let k = 0; k < ww.length; k++) {\r\n words.splice(i + k, 0, ww[k]);\r\n }\r\n i += ww.length;\r\n }\r\n }\r\n\r\n return words.map(w => {\r\n w = w.trim();\r\n if (w) {\r\n return w[0].toUpperCase() + w.substring(1).toLowerCase();\r\n }\r\n return '';\r\n }).join(' ');\r\n } else {\r\n return Utils.CapitalWords(text);\r\n }\r\n }\r\n\r\n /**\r\n * Check if the given color is bright.\r\n * https://stackoverflow.com/questions/35969656/how-can-i-generate-the-opposite-color-according-to-current-color\r\n * @param {string | null | undefined} color\r\n * @param {boolean} [defaultValue]\r\n * @returns {boolean}\r\n */\r\n static isUseBright(color, defaultValue) {\r\n if (color === null || color === undefined || color === '') {\r\n return defaultValue === undefined ? true : defaultValue;\r\n }\r\n color = color.toString();\r\n if (color.indexOf('#') === 0) {\r\n color = color.slice(1);\r\n }\r\n let r;\r\n let g;\r\n let b;\r\n\r\n const rgb = color.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i);\r\n if (rgb && rgb.length === 4) {\r\n r = parseInt(rgb[1], 10);\r\n g = parseInt(rgb[2], 10);\r\n b = parseInt(rgb[3], 10);\r\n } else {\r\n // convert 3-digit hex to 6-digits.\r\n if (color.length === 3) {\r\n color = color[0] + color[0] + color[1] + color[1] + color[2] + color[2];\r\n }\r\n if (color.length !== 6) {\r\n return false;\r\n }\r\n\r\n r = parseInt(color.slice(0, 2), 16);\r\n g = parseInt(color.slice(2, 4), 16);\r\n b = parseInt(color.slice(4, 6), 16);\r\n }\r\n\r\n // http://stackoverflow.com/a/3943023/112731\r\n return (r * 0.299 + g * 0.587 + b * 0.114) <= 186;\r\n };\r\n\r\n /**\r\n * Get the time string in the format 00:00.\r\n * @param {string | number} seconds\r\n */\r\n static getTimeString(seconds) {\r\n seconds = parseFloat(seconds);\r\n if (isNaN(seconds)) {\r\n return '--:--';\r\n }\r\n const hours = Math.floor(seconds / 3600);\r\n let minutes = Math.floor((seconds % 3600) / 60);\r\n let secs = seconds % 60;\r\n if (hours) {\r\n if (minutes < 10) minutes = '0' + minutes;\r\n if (secs < 10) secs = '0' + secs;\r\n return hours + ':' + minutes + ':' + secs;\r\n } else {\r\n if (secs < 10) secs = '0' + secs;\r\n return minutes + ':' + secs;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the wind direction with the given angle (degrees).\r\n * @param {number} angle in degrees.\r\n * @returns {string | undefined}\r\n */\r\n static getWindDirection(angle) {\r\n if (angle >= 0 && angle < 11.25) {\r\n return 'N'\r\n } else if (angle >= 11.25 && angle < 33.75) {\r\n return 'NNE'\r\n } else if (angle >= 33.75 && angle < 56.25) {\r\n return 'NE'\r\n } else if (angle >= 56.25 && angle < 78.75) {\r\n return 'ENE'\r\n } else if (angle >= 78.75 && angle < 101.25) {\r\n return 'E'\r\n } else if (angle >= 101.25 && angle < 123.75) {\r\n return 'ESE'\r\n } else if (angle >= 123.75 && angle < 146.25) {\r\n return 'SE'\r\n } else if (angle >= 146.25 && angle < 168.75) {\r\n return 'SSE'\r\n } else if (angle >= 168.75 && angle < 191.25) {\r\n return 'S'\r\n } else if (angle >= 191.25 && angle < 213.75) {\r\n return 'SSW'\r\n } else if (angle >= 213.75 && angle < 236.25) {\r\n return 'SW'\r\n } else if (angle >= 236.25 && angle < 258.75) {\r\n return 'WSW'\r\n } else if (angle >= 258.75 && angle < 281.25) {\r\n return 'W'\r\n } else if (angle >= 281.25 && angle < 303.75) {\r\n return 'WNW'\r\n } else if (angle >= 303.75 && angle < 326.25) {\r\n return 'NW'\r\n } else if (angle >= 326.25 && angle < 348.75) {\r\n return 'NNW'\r\n } else if (angle >= 348.75) {\r\n return 'N'\r\n }\r\n }\r\n\r\n /**\r\n * Pad the given number with a zero if its not 2 digits long.\r\n * @param {string | number} num\r\n */\r\n static padding(num) {\r\n if (typeof num === 'string') {\r\n if (num.length < 2) {\r\n return '0' + num;\r\n } else {\r\n return num;\r\n }\r\n } else if (num < 10) {\r\n return '0' + num;\r\n } else {\r\n return num;\r\n }\r\n }\r\n\r\n /**\r\n * Sets the date format.\r\n * @param {string} format\r\n */\r\n static setDataFormat(format) {\r\n if (format) {\r\n Utils.dateFormat = format.toUpperCase().split(/[.-/]/);\r\n Utils.dateFormat.splice(Utils.dateFormat.indexOf('YYYY'), 1);\r\n }\r\n }\r\n\r\n /**\r\n * Converts the date to a string.\r\n * @param {string | number | Date} now\r\n * @returns {string}\r\n */\r\n static date2string(now) {\r\n if (typeof now === 'string') {\r\n now = now.trim();\r\n if (!now) return '';\r\n // only letters\r\n if (now.match(/^[\\w\\s]+$/)) {\r\n // Day of week\r\n return now;\r\n }\r\n let m = now.match(/(\\d{1,4})[-./](\\d{1,2})[-./](\\d{1,4})/);\r\n if (m) {\r\n let a = [parseInt(m[1], 10), parseInt(m[2], 10), parseInt(m[3], 10)];\r\n let year = a.find(y => y > 31);\r\n a.splice(a.indexOf(year), 1);\r\n let day = a.find(m => m > 12);\r\n if (day) {\r\n a.splice(a.indexOf(day), 1);\r\n now = new Date(year, a[0] - 1, day);\r\n } else {\r\n // MM DD\r\n if (Utils.dateFormat[0][0] === 'M' && Utils.dateFormat[1][0] === 'D') {\r\n now = new Date(year, a[0] - 1, a[1]);\r\n if (Math.abs(now.getTime - Date.now()) > 3600000 * 24 * 10) {\r\n now = new Date(year, a[1] - 1, a[0]);\r\n }\r\n } else\r\n // DD MM\r\n if (Utils.dateFormat[0][0] === 'D' && Utils.dateFormat[1][0] === 'M') {\r\n now = new Date(year, a[1] - 1, a[0]);\r\n if (Math.abs(now.getTime - Date.now()) > 3600000 * 24 * 10) {\r\n now = new Date(year, a[0] - 1, a[1]);\r\n }\r\n } else {\r\n now = new Date(now);\r\n }\r\n }\r\n } else {\r\n now = new Date(now);\r\n }\r\n } else {\r\n now = new Date(now);\r\n }\r\n\r\n let date = I18n.t('ra_dow_' + days[now.getDay()]).replace('ra_dow_', '');\r\n date += '. ' + now.getDate() + ' ' + I18n.t('ra_month_' + months[now.getMonth()]).replace('ra_month_', '');\r\n return date;\r\n }\r\n\r\n /**\r\n * Render a text as a link.\r\n * @param {string} text\r\n * @returns {string | JSX.Element[]}\r\n */\r\n static renderTextWithA(text) {\r\n let m = text.match(/|
/);\r\n if (m) {\r\n const result = [];\r\n let key = 1;\r\n do {\r\n const p = text.split(m[0]);\r\n p[0] && result.push({p[0]});\r\n\r\n if (m[0].startsWith('
);\r\n } else {\r\n let href = m[0].match(/href=\"([^\"]+)\"/) || m[0].match(/href='([^']+)'/);\r\n let target = m[0].match(/target=\"([^\"]+)\"/) || m[0].match(/target='([^']+)'/);\r\n let rel = m[0].match(/rel=\"([^\"]+)\"/) || m[0].match(/rel='([^']+)'/);\r\n const title = m[0].match(/>([^<]*));\r\n\r\n // eslint-disable-next-line\r\n result.push({title ? title[1] : ''});\r\n }\r\n\r\n text = p[1];\r\n\r\n m = text && text.match(/|
/);\r\n if (!m) {\r\n p[1] && result.push({p[1]});\r\n }\r\n } while (m);\r\n\r\n return result;\r\n } else {\r\n return text;\r\n }\r\n }\r\n\r\n /**\r\n * Get the smart name of the given state.\r\n * @param {Record | ioBroker.StateObject} states\r\n * @param {string} id\r\n * @param {string} instanceId\r\n * @param {boolean} [noCommon]\r\n */\r\n static getSmartName(states, id, instanceId, noCommon) {\r\n if (!id) {\r\n if (!noCommon) {\r\n if (!states.common) {\r\n return states.smartName;\r\n } else {\r\n if (states && !states.common) {\r\n return states.smartName;\r\n } else {\r\n return states.common.smartName;\r\n }\r\n }\r\n } else {\r\n if (states && !states.common) {\r\n return states.smartName;\r\n } else {\r\n return (states &&\r\n states.common &&\r\n states.common.custom &&\r\n states.common.custom[instanceId]) ?\r\n states.common.custom[instanceId].smartName : undefined;\r\n }\r\n }\r\n } else\r\n if (!noCommon) {\r\n return states[id].common.smartName;\r\n } else {\r\n return (states[id] &&\r\n states[id].common &&\r\n states[id].common.custom &&\r\n states[id].common.custom[instanceId]) ?\r\n states[id].common.custom[instanceId].smartName || null : null;\r\n }\r\n }\r\n\r\n /**\r\n * Get the smart name from a state.\r\n * @param {ioBroker.StateObject} obj\r\n * @param {string} instanceId\r\n * @param {boolean} [noCommon]\r\n */\r\n static getSmartNameFromObj(obj, instanceId, noCommon) {\r\n if (!noCommon) {\r\n if (!obj.common) {\r\n return obj.smartName;\r\n } else {\r\n if (obj && !obj.common) {\r\n return obj.smartName;\r\n } else {\r\n return obj.common.smartName;\r\n }\r\n }\r\n } else {\r\n if (obj && !obj.common) {\r\n return obj.smartName;\r\n } else {\r\n return (obj &&\r\n obj.common &&\r\n obj.common.custom &&\r\n obj.common.custom[instanceId]) ?\r\n obj.common.custom[instanceId].smartName : undefined;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Enable smart name for a state.\r\n * @param {ioBroker.StateObject} obj\r\n * @param {string} instanceId\r\n * @param {boolean} [noCommon]\r\n */\r\n static enableSmartName(obj, instanceId, noCommon) {\r\n if (noCommon) {\r\n obj.common.custom = obj.common.custom || {};\r\n obj.common.custom[instanceId] = obj.common.custom[instanceId] || {};\r\n obj.common.custom[instanceId].smartName = {};\r\n } else {\r\n obj.common.smartName = {};\r\n }\r\n }\r\n\r\n /**\r\n * Completely remove smart name from a state.\r\n * @param {ioBroker.StateObject} obj\r\n * @param {string | number} instanceId\r\n * @param {boolean} [noCommon]\r\n */\r\n static removeSmartName(obj, instanceId, noCommon) {\r\n if (noCommon) {\r\n if (obj.common && obj.common.custom && obj.common.custom[instanceId]) {\r\n obj.common.custom[instanceId] = null;\r\n }\r\n } else {\r\n obj.common.smartName = null;\r\n }\r\n }\r\n\r\n /**\r\n * Update the smartname of a state.\r\n * @param {ioBroker.StateObject} obj\r\n * @param {string} newSmartName\r\n * @param {string | undefined} byON\r\n * @param {string | undefined} smartType\r\n * @param {string} instanceId\r\n * @param {boolean} [noCommon]\r\n */\r\n static updateSmartName(obj, newSmartName, byON, smartType, instanceId, noCommon) {\r\n const language = I18n.getLanguage();\r\n\r\n // convert Old format\r\n if (typeof obj.common.smartName === 'string') {\r\n const nnn = obj.common.smartName;\r\n obj.common.smartName = {};\r\n obj.common.smartName[language] = nnn;\r\n }\r\n\r\n // convert old settings\r\n if (obj.native && obj.native.byON) {\r\n delete obj.native.byON;\r\n let _smartName = obj.common.smartName;\r\n\r\n if (!_smartName || typeof _smartName !== 'object') {\r\n _smartName = {en: _smartName};\r\n _smartName[language] = _smartName.en;\r\n }\r\n obj.common.smartName = _smartName;\r\n }\r\n if (smartType !== undefined) {\r\n if (noCommon) {\r\n obj.common.custom = obj.common.custom || {};\r\n obj.common.custom[instanceId] = obj.common.custom[instanceId] || {};\r\n obj.common.custom[instanceId].smartName = obj.common.custom[instanceId].smartName || {};\r\n if (!smartType) {\r\n delete obj.common.custom[instanceId].smartName.smartType;\r\n } else {\r\n obj.common.custom[instanceId].smartName.smartType = smartType;\r\n }\r\n } else {\r\n obj.common.smartName = obj.common.smartName || {};\r\n if (!smartType) {\r\n delete obj.common.smartName.smartType;\r\n } else {\r\n obj.common.smartName.smartType = smartType;\r\n }\r\n\r\n }\r\n }\r\n if (byON !== undefined) {\r\n if (noCommon) {\r\n obj.common.custom = obj.common.custom || {};\r\n obj.common.custom[instanceId] = obj.common.custom[instanceId] || {};\r\n obj.common.custom[instanceId].smartName = obj.common.custom[instanceId].smartName || {};\r\n obj.common.custom[instanceId].smartName.byON = byON;\r\n } else {\r\n obj.common.smartName = obj.common.smartName || {};\r\n obj.common.smartName.byON = byON;\r\n }\r\n }\r\n if (newSmartName !== undefined) {\r\n let smartName;\r\n if (noCommon) {\r\n obj.common.custom = obj.common.custom || {};\r\n obj.common.custom[instanceId] = obj.common.custom[instanceId] || {};\r\n obj.common.custom[instanceId].smartName = obj.common.custom[instanceId].smartName || {};\r\n smartName = obj.common.custom[instanceId].smartName;\r\n } else {\r\n obj.common.smartName = obj.common.smartName || {};\r\n smartName = obj.common.smartName;\r\n }\r\n smartName[language] = newSmartName;\r\n\r\n // If smart name deleted\r\n if (smartName && (!smartName[language] ||\r\n (smartName[language] === obj.common.name &&\r\n (!obj.common.role || obj.common.role.indexOf('button') >= 0)))) {\r\n delete smartName[language];\r\n let empty = true;\r\n // Check if structure has any definitions\r\n for (const key in smartName) {\r\n if (smartName.hasOwnProperty(key)) {\r\n empty = false;\r\n break;\r\n }\r\n }\r\n // If empty => delete smartName completely\r\n if (empty) {\r\n if (noCommon) {\r\n if (obj.common.custom[instanceId].smartName.byON === undefined) {\r\n delete obj.common.custom[instanceId];\r\n } else {\r\n delete obj.common.custom[instanceId].en;\r\n delete obj.common.custom[instanceId].de;\r\n delete obj.common.custom[instanceId].ru;\r\n delete obj.common.custom[instanceId].nl;\r\n delete obj.common.custom[instanceId].pl;\r\n delete obj.common.custom[instanceId].it;\r\n delete obj.common.custom[instanceId].fr;\r\n delete obj.common.custom[instanceId].pt;\r\n delete obj.common.custom[instanceId].es;\r\n delete obj.common.custom[instanceId]['zh-cn'];\r\n }\r\n } else {\r\n if (obj.common.smartName.byON !== undefined) {\r\n delete obj.common.smartName.en;\r\n delete obj.common.smartName.de;\r\n delete obj.common.smartName.ru;\r\n delete obj.common.smartName.nl;\r\n delete obj.common.smartName.pl;\r\n delete obj.common.smartName.it;\r\n delete obj.common.smartName.fr;\r\n delete obj.common.smartName.pt;\r\n delete obj.common.smartName.es;\r\n delete obj.common.smartName['zh-cn'];\r\n } else {\r\n obj.common.smartName = null;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Disable the smart name of a state.\r\n * @param {ioBroker.StateObject} obj\r\n * @param {string} instanceId\r\n * @param {boolean} [noCommon]\r\n */\r\n static disableSmartName(obj, instanceId, noCommon) {\r\n if (noCommon) {\r\n obj.common.custom = obj.common.custom || {};\r\n obj.common.custom[instanceId] = obj.common.custom[instanceId] || {};\r\n obj.common.custom[instanceId].smartName = false;\r\n } else {\r\n obj.common.smartName = false;\r\n }\r\n }\r\n\r\n /**\r\n * Copy text to the clipboard.\r\n * @param {string} text\r\n * @param {Event} [e]\r\n */\r\n static copyToClipboard(text, e) {\r\n const el = window.document.createElement('textarea');\r\n el.value = text;\r\n window.document.body.appendChild(el);\r\n el.select();\r\n window.document.execCommand('copy');\r\n window.document.body.removeChild(el);\r\n console.log(text);\r\n e && e.stopPropagation();\r\n e && e.preventDefault();\r\n }\r\n\r\n /**\r\n * Gets the extension of a file name.\r\n * @param {string | null} [fileName] the file name.\r\n * @returns {string | null} The extension in lower case.\r\n */\r\n static getFileExtension(fileName) {\r\n const pos = (fileName || '').lastIndexOf('.');\r\n if (pos !== -1) {\r\n return fileName.substring(pos + 1).toLowerCase();\r\n } else {\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * Format number of bytes as a string with B, KB, MB or GB.\r\n * The base for all calculations is 1024.\r\n * @param {number} bytes The number of bytes.\r\n * @returns {string} The formatted string (e.g. '723.5 KB')\r\n */\r\n static formatBytes(bytes) {\r\n if (Math.abs(bytes) < 1024) {\r\n return bytes + ' B';\r\n }\r\n\r\n const units = ['KB','MB','GB'];\r\n //const units = ['KiB','MiB','GiB','TiB','PiB','EiB','ZiB','YiB'];\r\n let u = -1;\r\n\r\n do {\r\n bytes /= 1024;\r\n ++u;\r\n } while (Math.abs(bytes) >= 1024 && u < units.length - 1);\r\n\r\n return bytes.toFixed(1) + ' ' + units[u];\r\n }\r\n\r\n /**\r\n * Invert the given color according to theme type to get the inverted text color for background\r\n * @param {string} color Color in the format '#rrggbb' or '#rgb' (or without hash)\r\n * @param {string} themeType theme type\r\n * @param {string} invert dark theme has light color in control or light theme has light color in control\r\n * @returns {string}\r\n */\r\n static getInvertedColor(color, themeType, invert) {\r\n if (!color) {\r\n return undefined;\r\n } else {\r\n const invertedColor = Utils.invertColor(color, true);\r\n if (invertedColor === '#FFFFFF' && (themeType === 'dark' || (invert && themeType === 'light'))) {\r\n return '#DDD';\r\n } else\r\n if (invertedColor === '#000000' && (themeType === 'light' || (invert && themeType === 'dark'))) {\r\n return '#222';\r\n } else {\r\n return undefined;\r\n }\r\n }\r\n }\r\n\r\n // Big thanks to: https://stackoverflow.com/questions/35969656/how-can-i-generate-the-opposite-color-according-to-current-color\r\n /**\r\n * Invert the given color\r\n * @param {string} hex Color in the format '#rrggbb' or '#rgb' (or without hash)\r\n * @param {boolean} bw Set to black or white.\r\n * @returns {string}\r\n */\r\n static invertColor(hex, bw) {\r\n if (hex === undefined || hex === null || hex === '' || typeof hex !== 'string') {\r\n return '';\r\n }\r\n if (hex.startsWith('rgba')) {\r\n const m = hex.match(/rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+),\\s*([.\\d]+)\\)/);\r\n if (m) {\r\n hex = parseInt(m[1], 10).toString(16).padStart(2, '0') +\r\n parseInt(m[2], 10).toString(16).padStart(2, '0') +\r\n parseInt(m[2], 10).toString(16).padStart(2, '0');\r\n }\r\n } else if (hex.startsWith('rgba')) {\r\n const m = hex.match(/rgb?\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)/);\r\n if (m) {\r\n hex = parseInt(m[1], 10).toString(16).padStart(2, '0') +\r\n parseInt(m[2], 10).toString(16).padStart(2, '0') +\r\n parseInt(m[2], 10).toString(16).padStart(2, '0');\r\n }\r\n } else\r\n if (hex.startsWith('#')) {\r\n hex = hex.slice(1);\r\n }\r\n // convert 3-digit hex to 6-digits.\r\n if (hex.length === 3) {\r\n hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];\r\n }\r\n if (hex.length !== 6) {\r\n console.warn('Cannot invert color: ' + hex);\r\n return hex;\r\n }\r\n let r = parseInt(hex.slice(0, 2), 16);\r\n let g = parseInt(hex.slice(2, 4), 16);\r\n let b = parseInt(hex.slice(4, 6), 16);\r\n\r\n if (bw) {\r\n // http://stackoverflow.com/a/3943023/112731\r\n return (r * 0.299 + g * 0.587 + b * 0.114) > 186\r\n ? '#000000'\r\n : '#FFFFFF';\r\n }\r\n // invert color components\r\n r = (255 - r).toString(16);\r\n g = (255 - g).toString(16);\r\n b = (255 - b).toString(16);\r\n // pad each with zeros and return\r\n return '#' + r.padStart(2, '0') + g.padStart(2, '0') + b.padStart(2, '0');\r\n }\r\n\r\n // https://github.com/lukeed/clsx/blob/master/src/index.js\r\n // License\r\n // MIT © Luke Edwards\r\n /**\r\n * @private\r\n * @param {any} mix\r\n * @returns {string}\r\n */\r\n static _toVal(mix) {\r\n let k, y, str='';\r\n\r\n if (typeof mix === 'string' || typeof mix === 'number') {\r\n str += mix;\r\n } else if (typeof mix === 'object') {\r\n if (Array.isArray(mix)) {\r\n for (k=0; k < mix.length; k++) {\r\n if (mix[k]) {\r\n if ((y = Utils._toVal(mix[k]))) {\r\n str && (str += ' ');\r\n str += y;\r\n }\r\n }\r\n }\r\n } else {\r\n for (k in mix) {\r\n if (mix[k]) {\r\n str && (str += ' ');\r\n str += k;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return str;\r\n }\r\n\r\n // https://github.com/lukeed/clsx/blob/master/src/index.js\r\n // License\r\n // MIT © Luke Edwards\r\n /**\r\n * Convert any object to a string with its values.\r\n * @returns {string}\r\n */\r\n static clsx () {\r\n let i = 0;\r\n let tmp;\r\n let x;\r\n let str = '';\r\n while (i < arguments.length) {\r\n if ((tmp = arguments[i++])) {\r\n if ((x = Utils._toVal(tmp))) {\r\n str && (str += ' ');\r\n str += x\r\n }\r\n }\r\n }\r\n return str;\r\n }\r\n\r\n /**\r\n * Get the current theme name (either from local storage or the browser settings).\r\n * @param {string} [themeName]\r\n * @returns {string}\r\n */\r\n static getThemeName(themeName = '') {\r\n if (window.vendorPrefix && window.vendorPrefix !== '@@vendorPrefix@@') {\r\n return window.vendorPrefix;\r\n }\r\n\r\n return themeName ? themeName : window.localStorage && window.localStorage.getItem('App.themeName') ?\r\n window.localStorage.getItem('App.themeName') : window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'colored';\r\n }\r\n\r\n /**\r\n * Get the type of theme.\r\n * @param {string} [themeName]\r\n * @returns {'dark' | 'light'}\r\n */\r\n static getThemeType(themeName = '') {\r\n if (window.vendorPrefix && window.vendorPrefix !== '@@vendorPrefix@@') {\r\n return 'light';\r\n }\r\n\r\n themeName = themeName || (window.localStorage && window.localStorage.getItem('App.themeName'));\r\n return themeName === 'dark' || themeName === 'blue' ? 'dark' : 'light';\r\n }\r\n\r\n /**\r\n * Set the theme name and theme type.\r\n * @param {string} themeName\r\n */\r\n static setThemeName(themeName) {\r\n if (window.vendorPrefix && window.vendorPrefix !== '@@vendorPrefix@@') {\r\n return; // ignore\r\n }\r\n window.localStorage.setItem('App.themeName', themeName);\r\n window.localStorage.setItem('App.theme', themeName === 'dark' || themeName === 'blue' ? 'dark' : 'light');\r\n }\r\n\r\n /**\r\n * Toggle the theme name between 'dark' and 'colored'.\r\n * @param {string | null} themeName\r\n * @returns {string} the new theme name.\r\n */\r\n static toggleTheme(themeName) {\r\n if (window.vendorPrefix && window.vendorPrefix !== '@@vendorPrefix@@') {\r\n return window.vendorPrefix;\r\n }\r\n themeName = themeName || (window.localStorage && window.localStorage.getItem('App.themeName'));\r\n\r\n // dark => blue => colored => light => dark\r\n const themes = Utils.getThemeNames();\r\n const pos = themes.indexOf(themeName);\r\n let newTheme;\r\n if (pos !== -1) {\r\n newTheme = themes[(pos + 1) % themes.length];\r\n } else {\r\n newTheme = themes[0];\r\n }\r\n Utils.setThemeName(newTheme);\r\n\r\n return newTheme;\r\n }\r\n\r\n /**\r\n * Get the list of themes\r\n * @returns {array} list of possible themes\r\n */\r\n static getThemeNames() {\r\n if (window.vendorPrefix && window.vendorPrefix !== '@@vendorPrefix@@') {\r\n return [window.vendorPrefix];\r\n }\r\n\r\n return ['light', 'dark', 'blue', 'colored'];\r\n }\r\n\r\n /**\r\n * Parse a query string into its parts.\r\n * @param {string} query\r\n * @returns {Record}\r\n */\r\n static parseQuery(query) {\r\n query = (query || '').toString().replace(/^\\?/, '');\r\n /** @type {Record} */\r\n const result = {};\r\n query.split('&').forEach(part => {\r\n part = part.trim();\r\n if (part) {\r\n const parts = part.split('=');\r\n const attr = decodeURIComponent(parts[0]).trim();\r\n if (parts.length > 1) {\r\n result[attr] = decodeURIComponent(parts[1]);\r\n if (result[attr] === 'true') {\r\n result[attr] = true;\r\n } else if (result[attr] === 'false') {\r\n result[attr] = false;\r\n } else {\r\n const f = parseFloat(result[attr]);\r\n if (f.toString() === result[attr]) {\r\n result[attr] = f;\r\n }\r\n }\r\n } else {\r\n result[attr] = true;\r\n }\r\n }\r\n });\r\n return result;\r\n }\r\n\r\n /**\r\n * Returns parent ID.\r\n * @param {string} id\r\n * @returns {string | null} parent ID or null if no parent\r\n */\r\n static getParentId(id) {\r\n const p = (id || '').toString().split('.');\r\n if (p.length > 1) {\r\n p.pop();\r\n return p.join('.');\r\n } else {\r\n return null;\r\n }\r\n }\r\n\r\n static formatDate(dateObj, dateFormat) {\r\n // format could be DD.MM.YYYY, YYYY.MM.DD or MM/DD/YYYY\r\n\r\n if (!dateObj) {\r\n return '';\r\n }\r\n\r\n let text;\r\n let mm = dateObj.getMonth() + 1;\r\n if (mm < 10) {\r\n mm = '0' + mm;\r\n }\r\n\r\n let dd = dateObj.getDate();\r\n if (dd < 10) {\r\n dd = '0' + dd;\r\n }\r\n\r\n if (dateFormat === 'MM/DD/YYYY') {\r\n text = mm + '/' + dd + '/' + dateObj.getFullYear();\r\n } else {\r\n text = dateObj.getFullYear() + '-' + mm + '-' + dd;\r\n }\r\n\r\n // time\r\n let v = dateObj.getHours();\r\n if (v < 10) {\r\n text += ' 0' + v;\r\n } else {\r\n text += ' ' + v;\r\n }\r\n v = dateObj.getMinutes();\r\n if (v < 10) {\r\n text += ':0' + v;\r\n } else {\r\n text += ':' + v;\r\n }\r\n\r\n v = dateObj.getSeconds();\r\n if (v < 10) {\r\n text += ':0' + v;\r\n } else {\r\n text += ':' + v;\r\n }\r\n\r\n v = dateObj.getMilliseconds();\r\n if (v < 10) {\r\n text += '.00' + v;\r\n } else if (v < 100) {\r\n text += '.0' + v;\r\n } else {\r\n text += '.' + v;\r\n }\r\n\r\n return text;\r\n }\r\n\r\n static formatTime(seconds) {\r\n if (seconds) {\r\n seconds = Math.round(seconds);\r\n const d = Math.floor(seconds / (3600 * 24));\r\n const h = Math.floor((seconds % (3600 * 24)) / 3600);\r\n const m = Math.floor((seconds % 3600) / 60);\r\n const s = seconds % 60;\r\n if (d) {\r\n return `${d}.${h.toString().padStart(2, '0')}:${m.toString().padStart(2, '0')}:${s.toString().padStart(2, '0')}`;\r\n } else if (h) {\r\n return `${h}:${m.toString().padStart(2, '0')}:${s.toString().padStart(2, '0')}`;\r\n } else {\r\n return `0:${m.toString().padStart(2, '0')}:${s.toString().padStart(2, '0')}`;\r\n }\r\n } else {\r\n return '0:00:00';\r\n }\r\n }\r\n\r\n static MDtext2link(text) {\r\n const m = text.match(/\\d+\\.\\)\\s/);\r\n if (m) {\r\n text = text.replace(m[0], m[0].replace(/\\s/, ' '));\r\n }\r\n\r\n return text.replace(/[^a-zA-Zа-яА-Я0-9]/g, '').trim().replace(/\\s/g, '').toLowerCase();\r\n }\r\n\r\n static openLink(url, target) {\r\n // replace IPv6 Address with [ipv6]:port\r\n url = url.replace(/\\/\\/([0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*)(:\\d+)?\\//i, '//[$1]$2/');\r\n\r\n if (target === 'this') {\r\n window.location = url;\r\n } else {\r\n window.open(url, target || '_blank');\r\n }\r\n }\r\n\r\n static MDgetTitle(text) {\r\n let {body, header} = Utils.extractHeader(text);\r\n if (!header.title) {\r\n // remove {docsify-bla}\r\n body = body.replace(/{[^}]*}/g, '');\r\n body = body.trim();\r\n const lines = body.replace(/\\r/g, '').split('\\n');\r\n for (let i = 0; i < lines.length; i++) {\r\n if (lines[i].startsWith('# ')) {\r\n return lines[i].substring(2).trim();\r\n }\r\n }\r\n return '';\r\n } else {\r\n return header.title;\r\n }\r\n }\r\n\r\n static MDextractHeader(text) {\r\n const attrs = {};\r\n if (text.substring(0, 3) === '---') {\r\n const pos = text.substring(3).indexOf('\\n---');\r\n if (pos !== -1) {\r\n const _header = text.substring(3, pos + 3);\r\n const lines = _header.replace(/\\r/g, '').split('\\n');\r\n lines.forEach(line => {\r\n if (!line.trim()) {\r\n return;\r\n }\r\n const pos = line.indexOf(':');\r\n if (pos !== -1) {\r\n const attr = line.substring(0, pos).trim();\r\n attrs[attr] = line.substring(pos + 1).trim();\r\n attrs[attr] = attrs[attr].replace(/^['\"]|['\"]$/g, '');\r\n if (attrs[attr] === 'true') {\r\n attrs[attr] = true;\r\n } else if (attrs[attr] === 'false') {\r\n attrs[attr] = false;\r\n } else if (parseFloat(attrs[attr]).toString() === attrs[attr]) {\r\n attrs[attr] = parseFloat(attrs[attr]);\r\n }\r\n } else {\r\n attrs[line.trim()] = true;\r\n }\r\n });\r\n text = text.substring(pos + 7);\r\n }\r\n }\r\n return {header: attrs, body: text};\r\n }\r\n\r\n static MDremoveDocsify(text) {\r\n const m = text.match(/{docsify-[^}]*}/g);\r\n if (m) {\r\n m.forEach(doc => text = text.replace(doc, ''));\r\n }\r\n return text;\r\n }\r\n\r\n /**\r\n * Generate the json file on the file for download.\r\n * @param {string} filename file name\r\n * @returns {object} json structure (not stringified)\r\n */\r\n static generateFile(filename, json) {\r\n let el = document.createElement('a');\r\n el.setAttribute('href', 'data:application/json;charset=utf-8,' + encodeURIComponent(JSON.stringify(json, null, 2)));\r\n el.setAttribute('download', filename);\r\n\r\n el.style.display = 'none';\r\n document.body.appendChild(el);\r\n\r\n el.click();\r\n\r\n document.body.removeChild(el);\r\n }\r\n\r\n /**\r\n * Convert quality code into text\r\n * @param {number} quality code\r\n * @returns {array} lines that decode qulity\r\n */\r\n static quality2text(quality) {\r\n const custom = quality & 0xFFFF0000;\r\n const text = QUALITY_BITS[quality];\r\n let result;\r\n if (text) {\r\n result = [text];\r\n } else if (quality & 0x01) {\r\n result = [QUALITY_BITS[0x01], '0x' + (quality & (0xFFFF & ~1)).toString(16)];\r\n } else if (quality & 0x02) {\r\n result = [QUALITY_BITS[0x02], '0x' + (quality & (0xFFFF & ~2)).toString(16)];\r\n } else {\r\n result = ['0x' + quality.toString(16)];\r\n }\r\n if (custom) {\r\n result.push('0x' + (custom >> 16).toString(16).toUpperCase());\r\n }\r\n return result;\r\n }\r\n\r\n /**\r\n * Deep copy object\r\n * @param {object} object\r\n * @returns {object}\r\n */\r\n static clone(object) {\r\n return JSON.parse(JSON.stringify(object));\r\n }\r\n\r\n /**\r\n * Get states of object\r\n * @param {object} obj\r\n * @returns {object} states as an object in form {\"value1\": \"label1\", \"value2\": \"label2\"} or null\r\n */\r\n static getStates(obj) {\r\n let states = obj?.common?.states;\r\n if (states) {\r\n if (typeof states === 'string' && states[0] === '{') {\r\n try {\r\n states = JSON.parse(states);\r\n } catch (ex) {\r\n console.error(`Cannot parse states: ${states}`);\r\n states = null;\r\n }\r\n } else\r\n // if old format val1:text1;val2:text2\r\n if (typeof states === 'string') {\r\n const parts = states.split(';');\r\n states = {};\r\n for (let p = 0; p < parts.length; p++) {\r\n const s = parts[p].split(':');\r\n states[s[0]] = s[1];\r\n }\r\n } else if (Array.isArray(states)) {\r\n const result = {};\r\n states.forEach((value, key) => result[key] = value);\r\n return result;\r\n }\r\n }\r\n return states;\r\n }\r\n\r\n /**\r\n * Get svg file as text\r\n * @param {string} url URL of SVG file\r\n * @returns {object} Promise with \"data:image...\"\r\n */\r\n static getSvg(url) {\r\n return fetch(url)\r\n .then(response => response.blob())\r\n .then(blob => {\r\n return new Promise(resolve => {\r\n const reader = new FileReader();\r\n reader.onload = function() { // do not optimize this function. \"this\" is important.\r\n resolve(this.result);\r\n };\r\n reader.readAsDataURL(blob);\r\n });\r\n });\r\n }\r\n}\r\n\r\nexport default Utils;\r\n", "function _getPrototypeOf(t) {\n return module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {\n return t.__proto__ || Object.getPrototypeOf(t);\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports, _getPrototypeOf(t);\n}\nmodule.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;", "var getPrototypeOf = require(\"./getPrototypeOf.js\");\nfunction _superPropBase(t, o) {\n for (; !{}.hasOwnProperty.call(t, o) && null !== (t = getPrototypeOf(t)););\n return t;\n}\nmodule.exports = _superPropBase, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;", "var superPropBase = require(\"./superPropBase.js\");\nfunction _get() {\n return module.exports = _get = \"undefined\" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) {\n var p = superPropBase(e, t);\n if (p) {\n var n = Object.getOwnPropertyDescriptor(p, t);\n return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value;\n }\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports, _get.apply(null, arguments);\n}\nmodule.exports = _get, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;", "var setPrototypeOf = require(\"./setPrototypeOf.js\");\nfunction _inherits(t, e) {\n if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\");\n t.prototype = Object.create(e && e.prototype, {\n constructor: {\n value: t,\n writable: !0,\n configurable: !0\n }\n }), Object.defineProperty(t, \"prototype\", {\n writable: !1\n }), e && setPrototypeOf(t, e);\n}\nmodule.exports = _inherits, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;", "var _typeof = require(\"./typeof.js\")[\"default\"];\nvar assertThisInitialized = require(\"./assertThisInitialized.js\");\nfunction _possibleConstructorReturn(t, e) {\n if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e;\n if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\");\n return assertThisInitialized(t);\n}\nmodule.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;", "/**\r\n * Copyright 2020-2022, bluefox \r\n *\r\n * MIT License\r\n *\r\n **/\r\nimport PropTypes from 'prop-types';\r\n\r\n/** Possible progress states. */\r\nexport const PROGRESS = {\r\n /** The socket is connecting. */\r\n CONNECTING: 0,\r\n /** The socket is successfully connected. */\r\n CONNECTED: 1,\r\n /** All objects are loaded. */\r\n OBJECTS_LOADED: 2,\r\n /** The socket is ready for use. */\r\n READY: 3\r\n};\r\n\r\nconst PERMISSION_ERROR = 'permissionError';\r\nconst NOT_CONNECTED = 'notConnectedError';\r\nconst TIMEOUT_FOR_ADMIN4 = 1300;\r\n\r\nexport const ERRORS = {\r\n PERMISSION_ERROR,\r\n NOT_CONNECTED\r\n};\r\n\r\nfunction fixAdminUI(obj) {\r\n if (obj && obj.common && !obj.common.adminUI) {\r\n if (obj.common.noConfig) {\r\n obj.common.adminUI = obj.common.adminUI || {};\r\n obj.common.adminUI.config = 'none';\r\n } else if (obj.common.jsonConfig) {\r\n obj.common.adminUI = obj.common.adminUI || {};\r\n obj.common.adminUI.config = 'json';\r\n } else if (obj.common.materialize) {\r\n obj.common.adminUI = obj.common.adminUI || {};\r\n obj.common.adminUI.config = 'materialize';\r\n } else {\r\n obj.common.adminUI = obj.common.adminUI || {};\r\n obj.common.adminUI.config = 'html';\r\n }\r\n\r\n if (obj.common.jsonCustom) {\r\n obj.common.adminUI = obj.common.adminUI || {};\r\n obj.common.adminUI.custom = 'json';\r\n } else if (obj.common.supportCustoms) {\r\n obj.common.adminUI = obj.common.adminUI || {};\r\n obj.common.adminUI.custom = 'json';\r\n }\r\n\r\n if (obj.common.materializeTab && obj.common.adminTab) {\r\n obj.common.adminUI = obj.common.adminUI || {};\r\n obj.common.adminUI.tab = 'materialize';\r\n } else if (obj.common.adminTab) {\r\n obj.common.adminUI = obj.common.adminUI || {};\r\n obj.common.adminUI.tab = 'html';\r\n }\r\n\r\n obj.common.adminUI && console.debug(`Please add to \"${obj._id.replace(/\\.\\d+$/, '')}\" common.adminUI=${JSON.stringify(obj.common.adminUI)}`);\r\n }\r\n return obj;\r\n}\r\n\r\nclass Connection {\r\n /**\r\n * @param {import('./types').ConnectionProps} props\r\n */\r\n constructor(props) {\r\n props = props || { protocol: window.location.protocol, host: window.location.hostname };\r\n this.props = props;\r\n\r\n this.autoSubscribes = this.props.autoSubscribes || [];\r\n this.autoSubscribeLog = this.props.autoSubscribeLog;\r\n\r\n this.props.protocol = this.props.protocol || window.location.protocol;\r\n this.props.host = this.props.host || window.location.hostname;\r\n this.props.port = this.props.port || (window.location.port === '3000' ? (Connection.isWeb() ? 8082 : 8081) : window.location.port);\r\n this.props.ioTimeout = Math.max(this.props.ioTimeout || 20000, 20000);\r\n this.props.cmdTimeout = Math.max(this.props.cmdTimeout || 5000, 5000);\r\n\r\n // breaking change. Do not load all objects by default is true\r\n this.doNotLoadAllObjects = this.props.doNotLoadAllObjects === undefined ? true : this.props.doNotLoadAllObjects;\r\n this.doNotLoadACL = this.props.doNotLoadACL === undefined ? true : this.props.doNotLoadACL;\r\n\r\n /** @type {Record} */\r\n this.states = {};\r\n this.objects = null;\r\n this.acl = null;\r\n this.firstConnect = true;\r\n this.waitForRestart = false;\r\n /** @type {ioBroker.Languages} */\r\n this.systemLang = 'en';\r\n this.connected = false;\r\n this._waitForFirstConnection = new Promise(resolve => { this._waitForFirstConnectionResolve = resolve });\r\n\r\n /** @type {Record} */\r\n this.statesSubscribes = {}; // subscribe for states\r\n\r\n /** @type {Record} */\r\n this.objectsSubscribes = {}; // subscribe for objects\r\n this.onProgress = this.props.onProgress || function () { };\r\n this.onError = this.props.onError || function (err) { console.error(err); };\r\n this.loaded = false;\r\n this.loadTimer = null;\r\n this.loadCounter = 0;\r\n this.admin5only = this.props.admin5only || false;\r\n\r\n /** @type {((connected: boolean) => void)[]} */\r\n this.onConnectionHandlers = [];\r\n /** @type {((message: string) => void)[]} */\r\n this.onLogHandlers = [];\r\n\r\n /** @type {Record>} */\r\n this._promises = {};\r\n\r\n this.log.error = text => this.log(text, 'error');\r\n this.log.warn = text => this.log(text, 'warn');\r\n this.log.info = text => this.log(text, 'info');\r\n this.log.debug = text => this.log(text, 'debug');\r\n this.log.silly = text => this.log(text, 'silly');\r\n\r\n this.startSocket();\r\n }\r\n\r\n /**\r\n * Checks if this connection is running in a web adapter and not in an admin.\r\n * @returns {boolean} True if running in a web adapter or in a socketio adapter.\r\n */\r\n static isWeb() {\r\n return window.adapterName === 'material' ||\r\n window.adapterName === 'vis' ||\r\n window.adapterName === 'echarts-show' ||\r\n window.socketUrl !== undefined;\r\n }\r\n\r\n /**\r\n * Starts the socket.io connection.\r\n * @returns {void}\r\n */\r\n startSocket() {\r\n // if socket io is not yet loaded\r\n if (typeof window.io === 'undefined') {\r\n // if in index.html the onLoad function not defined\r\n if (typeof window.registerSocketOnLoad !== 'function') {\r\n // poll if loaded\r\n this.scriptLoadCounter = this.scriptLoadCounter || 0;\r\n this.scriptLoadCounter++;\r\n\r\n if (this.scriptLoadCounter < 30) {\r\n // wait till the script loaded\r\n setTimeout(() => this.startSocket(), 100);\r\n return;\r\n } else {\r\n window.alert('Cannot load socket.io.js!');\r\n }\r\n } else {\r\n // register on load\r\n window.registerSocketOnLoad(() => this.startSocket());\r\n }\r\n return;\r\n } else {\r\n // socket was initialized, do not repeat\r\n if (this._socket) {\r\n return;\r\n }\r\n }\r\n\r\n let host = this.props.host;\r\n let port = this.props.port;\r\n let protocol = this.props.protocol.replace(':', '');\r\n let path = window.location.pathname;\r\n\r\n if (\r\n window.location.hostname === 'iobroker.net' ||\r\n window.location.hostname === 'iobroker.pro'\r\n ) {\r\n path = '';\r\n } else {\r\n // if web adapter, socket io could be on other port or even host\r\n if (window.socketUrl) {\r\n let parts = window.socketUrl.split(':');\r\n host = parts[0] || host;\r\n port = parts[1] || port;\r\n if (host.includes('://')) {\r\n parts = host.split('://');\r\n protocol = parts[0];\r\n host = parts[1];\r\n }\r\n }\r\n // get current path\r\n const pos = path.lastIndexOf('/');\r\n if (pos !== -1) {\r\n path = path.substring(0, pos + 1);\r\n }\r\n\r\n if (Connection.isWeb()) {\r\n // remove one level, like echarts, vis, .... We have here: '/echarts/'\r\n const parts = path.split('/');\r\n if (parts.length > 2) {\r\n parts.pop();\r\n parts.pop();\r\n path = parts.join('/');\r\n if (!path.endsWith('/')) {\r\n path += '/';\r\n }\r\n }\r\n }\r\n }\r\n\r\n const url = port ? `${protocol}://${host}:${port}${path}` : `${protocol}://${host}${path}`;\r\n\r\n this._socket = window.io.connect(\r\n url,\r\n {\r\n path: path.endsWith('/') ? path + 'socket.io' : path + '/socket.io',\r\n query: 'ws=true',\r\n name: this.props.name,\r\n timeout: this.props.ioTimeout\r\n }\r\n );\r\n\r\n this._socket.on('connect', noTimeout => {\r\n // If the user is not admin it takes some time to install the handlers, because all rights must be checked\r\n if (noTimeout !== true) {\r\n setTimeout(() =>\r\n this.getVersion()\r\n .then(info => {\r\n const [major, minor, patch] = info.version.split('.');\r\n const v = parseInt(major, 10) * 10000 + parseInt(minor, 10) * 100 + parseInt(patch, 10);\r\n if (v < 40102) {\r\n this._authTimer = null;\r\n // possible this is old version of admin\r\n this.onPreConnect(false, false);\r\n } else {\r\n this._socket.emit('authenticate', (isOk, isSecure) => this.onPreConnect(isOk, isSecure));\r\n }\r\n }), 500);\r\n } else {\r\n // iobroker websocket waits, till all handlers are installed\r\n this._socket.emit('authenticate', (isOk, isSecure) => this.onPreConnect(isOk, isSecure));\r\n }\r\n });\r\n\r\n this._socket.on('reconnect', () => {\r\n this.onProgress(PROGRESS.READY);\r\n this.connected = true;\r\n\r\n if (this.waitForRestart) {\r\n window.location.reload(false);\r\n } else {\r\n this._subscribe(true);\r\n this.onConnectionHandlers.forEach(cb => cb(true));\r\n }\r\n });\r\n\r\n this._socket.on('disconnect', () => {\r\n this.connected = false;\r\n this.subscribed = false;\r\n this.onProgress(PROGRESS.CONNECTING);\r\n this.onConnectionHandlers.forEach(cb => cb(false));\r\n });\r\n\r\n this._socket.on('reauthenticate', () =>\r\n this.authenticate());\r\n\r\n this._socket.on('log', message => {\r\n this.props.onLog && this.props.onLog(message);\r\n this.onLogHandlers.forEach(cb => cb(message));\r\n });\r\n\r\n this._socket.on('error', err => {\r\n let _err = err || '';\r\n if (typeof _err.toString !== 'function') {\r\n _err = JSON.stringify(_err);\r\n console.error(`Received strange error: ${_err}`);\r\n }\r\n _err = _err.toString();\r\n if (_err.includes('User not authorized')) {\r\n this.authenticate();\r\n } else {\r\n window.alert(`Socket Error: ${err}`);\r\n }\r\n });\r\n\r\n this._socket.on('connect_error', err =>\r\n console.error(`Connect error: ${err}`));\r\n\r\n this._socket.on('permissionError', err =>\r\n this.onError({ message: 'no permission', operation: err.operation, type: err.type, id: (err.id || '') }));\r\n\r\n this._socket.on('objectChange', (id, obj) =>\r\n setTimeout(() => this.objectChange(id, obj), 0));\r\n\r\n this._socket.on('stateChange', (id, state) =>\r\n setTimeout(() => this.stateChange(id, state), 0));\r\n\r\n this._socket.on('cmdStdout', (id, text) =>\r\n this.onCmdStdoutHandler && this.onCmdStdoutHandler(id, text));\r\n\r\n this._socket.on('cmdStderr', (id, text) =>\r\n this.onCmdStderrHandler && this.onCmdStderrHandler(id, text));\r\n\r\n this._socket.on('cmdExit', (id, exitCode) =>\r\n this.onCmdExitHandler && this.onCmdExitHandler(id, exitCode));\r\n }\r\n\r\n /**\r\n * Called internally.\r\n * @private\r\n * @param {boolean} isOk\r\n * @param {boolean} isSecure\r\n */\r\n onPreConnect(isOk, isSecure) {\r\n if (this._authTimer) {\r\n clearTimeout(this._authTimer);\r\n this._authTimer = null;\r\n }\r\n\r\n this.connected = true;\r\n this.isSecure = isSecure;\r\n\r\n if (this.waitForRestart) {\r\n window.location.reload(false);\r\n } else {\r\n if (this.firstConnect) {\r\n // retry strategy\r\n this.loadTimer = setTimeout(() => {\r\n this.loadTimer = null;\r\n this.loadCounter++;\r\n if (this.loadCounter < 10) {\r\n this.onConnect();\r\n }\r\n }, 1000);\r\n\r\n if (!this.loaded) {\r\n this.onConnect();\r\n }\r\n } else {\r\n this.onProgress(PROGRESS.READY);\r\n }\r\n\r\n this._subscribe(true);\r\n this.onConnectionHandlers.forEach(cb => cb(true));\r\n }\r\n\r\n if (this._waitForFirstConnectionResolve) {\r\n this._waitForFirstConnectionResolve();\r\n this._waitForFirstConnectionResolve = null;\r\n }\r\n }\r\n\r\n /**\r\n * Checks if the socket is connected.\r\n * @returns {boolean} true if connected.\r\n */\r\n isConnected() {\r\n return this.connected;\r\n }\r\n\r\n /**\r\n * Checks if the socket is connected.\r\n * @returns {Promise} Promise resolves if once connected.\r\n */\r\n waitForFirstConnection() {\r\n return this._waitForFirstConnection;\r\n }\r\n\r\n /**\r\n * Called internally.\r\n * @private\r\n */\r\n _getUserPermissions(cb) {\r\n if (this.doNotLoadACL) {\r\n return cb && cb();\r\n } else {\r\n this._socket.emit('getUserPermissions', cb);\r\n }\r\n }\r\n\r\n /**\r\n * Called internally.\r\n * @private\r\n */\r\n onConnect() {\r\n this._getUserPermissions((err, acl) => {\r\n if (err) {\r\n return this.onError('Cannot read user permissions: ' + err);\r\n } else\r\n if (!this.doNotLoadACL) {\r\n if (this.loaded) {\r\n return;\r\n }\r\n this.loaded = true;\r\n clearTimeout(this.loadTimer);\r\n this.loadTimer = null;\r\n\r\n this.onProgress(PROGRESS.CONNECTED);\r\n this.firstConnect = false;\r\n\r\n this.acl = acl;\r\n }\r\n\r\n // Read system configuration\r\n return (this.admin5only && !window.vendorPrefix ? this.getCompactSystemConfig() : this.getSystemConfig())\r\n .then(data => {\r\n if (this.doNotLoadACL) {\r\n if (this.loaded) {\r\n return undefined;\r\n }\r\n this.loaded = true;\r\n clearTimeout(this.loadTimer);\r\n this.loadTimer = null;\r\n\r\n this.onProgress(PROGRESS.CONNECTED);\r\n this.firstConnect = false;\r\n }\r\n\r\n this.systemConfig = data;\r\n if (this.systemConfig && this.systemConfig.common) {\r\n this.systemLang = this.systemConfig.common.language;\r\n } else {\r\n this.systemLang = window.navigator.userLanguage || window.navigator.language;\r\n\r\n if (this.systemLang !== 'en' && this.systemLang !== 'de' && this.systemLang !== 'ru') {\r\n this.systemConfig.common.language = 'en';\r\n this.systemLang = 'en';\r\n }\r\n }\r\n\r\n this.props.onLanguage && this.props.onLanguage(this.systemLang);\r\n\r\n if (!this.doNotLoadAllObjects) {\r\n return this.getObjects()\r\n .then(() => {\r\n this.onProgress(PROGRESS.READY);\r\n this.props.onReady && this.props.onReady(this.objects);\r\n });\r\n } else {\r\n this.objects = this.admin5only ? {} : { 'system.config': data };\r\n this.onProgress(PROGRESS.READY);\r\n this.props.onReady && this.props.onReady(this.objects);\r\n }\r\n return undefined;\r\n })\r\n .catch(e => this.onError('Cannot read system config: ' + e));\r\n });\r\n }\r\n\r\n /**\r\n * Called internally.\r\n * @private\r\n */\r\n authenticate() {\r\n if (window.location.search.includes('&href=')) {\r\n window.location = `${window.location.protocol}//${window.location.host}${window.location.pathname}${window.location.search}${window.location.hash}`;\r\n } else {\r\n window.location = `${window.location.protocol}//${window.location.host}${window.location.pathname}?login&href=${window.location.search}${window.location.hash}`;\r\n }\r\n }\r\n\r\n /**\r\n * Subscribe to changes of the given state.\r\n * @param {string} id The ioBroker state ID.\r\n * @param {ioBroker.StateChangeHandler} cb The callback.\r\n */\r\n /**\r\n * Subscribe to changes of the given state.\r\n * @param {string} id The ioBroker state ID.\r\n * @param {boolean} binary Set to true if the given state is binary and requires Base64 decoding.\r\n * @param {ioBroker.StateChangeHandler} cb The callback.\r\n */\r\n subscribeState(id, binary, cb) {\r\n if (typeof binary === 'function') {\r\n cb = binary;\r\n binary = false;\r\n }\r\n\r\n if (!this.statesSubscribes[id]) {\r\n let reg = id\r\n .replace(/\\./g, '\\\\.')\r\n .replace(/\\*/g, '.*')\r\n .replace(/\\(/g, '\\\\(')\r\n .replace(/\\)/g, '\\\\)')\r\n .replace(/\\+/g, '\\\\+')\r\n .replace(/\\[/g, '\\\\[');\r\n\r\n if (reg.indexOf('*') === -1) {\r\n reg += '$';\r\n }\r\n this.statesSubscribes[id] = { reg: new RegExp(reg), cbs: [] };\r\n this.statesSubscribes[id].cbs.push(cb);\r\n if (this.connected) {\r\n this._socket.emit('subscribe', id);\r\n }\r\n } else {\r\n !this.statesSubscribes[id].cbs.includes(cb) && this.statesSubscribes[id].cbs.push(cb);\r\n }\r\n if (typeof cb === 'function' && this.connected) {\r\n if (binary) {\r\n this.getBinaryState(id)\r\n .then(base64 => cb(id, base64))\r\n .catch(e => console.error(`Cannot getForeignStates \"${id}\": ${JSON.stringify(e)}`));\r\n } else {\r\n if (Connection.isWeb()) {\r\n this._socket.emit('getStates', id, (err, states) => {\r\n err && console.error(`Cannot getForeignStates \"${id}\": ${JSON.stringify(err)}`);\r\n states && Object.keys(states).forEach(id => cb(id, states[id]));\r\n });\r\n } else {\r\n this._socket.emit('getForeignStates', id, (err, states) => {\r\n err && console.error(`Cannot getForeignStates \"${id}\": ${JSON.stringify(err)}`);\r\n states && Object.keys(states).forEach(id => cb(id, states[id]));\r\n });\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Unsubscribes all callbacks from changes of the given state.\r\n * @param {string} id The ioBroker state ID.\r\n */\r\n /**\r\n * Unsubscribes the given callback from changes of the given state.\r\n * @param {string} id The ioBroker state ID.\r\n * @param {ioBroker.StateChangeHandler} cb The callback.\r\n */\r\n unsubscribeState(id, cb) {\r\n if (this.statesSubscribes[id]) {\r\n if (cb) {\r\n const pos = this.statesSubscribes[id].cbs.indexOf(cb);\r\n pos !== -1 && this.statesSubscribes[id].cbs.splice(pos, 1);\r\n } else {\r\n this.statesSubscribes[id].cbs = [];\r\n }\r\n\r\n if (!this.statesSubscribes[id].cbs || !this.statesSubscribes[id].cbs.length) {\r\n delete this.statesSubscribes[id];\r\n this.connected && this._socket.emit('unsubscribe', id);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Subscribe to changes of the given object.\r\n * @param {string} id The ioBroker object ID.\r\n * @param {import('./types').ObjectChangeHandler} cb The callback.\r\n * @returns {Promise}\r\n */\r\n subscribeObject(id, cb) {\r\n if (!this.objectsSubscribes[id]) {\r\n let reg = id.replace(/\\./g, '\\\\.').replace(/\\*/g, '.*');\r\n if (!reg.includes('*')) {\r\n reg += '$';\r\n }\r\n this.objectsSubscribes[id] = { reg: new RegExp(reg), cbs: [] };\r\n this.objectsSubscribes[id].cbs.push(cb);\r\n this.connected && this._socket.emit('subscribeObjects', id);\r\n } else {\r\n !this.objectsSubscribes[id].cbs.includes(cb) && this.objectsSubscribes[id].cbs.push(cb);\r\n }\r\n return Promise.resolve();\r\n }\r\n\r\n /**\r\n * Unsubscribes all callbacks from changes of the given object.\r\n * @param {string} id The ioBroker object ID.\r\n * @returns {Promise}\r\n */\r\n /**\r\n * Unsubscribes the given callback from changes of the given object.\r\n * @param {string} id The ioBroker object ID.\r\n * @param {import('./types').ObjectChangeHandler} cb The callback.\r\n * @returns {Promise}\r\n */\r\n unsubscribeObject(id, cb) {\r\n if (this.objectsSubscribes[id]) {\r\n if (cb) {\r\n const pos = this.objectsSubscribes[id].cbs.indexOf(cb);\r\n pos !== -1 && this.objectsSubscribes[id].cbs.splice(pos, 1);\r\n } else {\r\n this.objectsSubscribes[id].cbs = [];\r\n }\r\n\r\n if (this.connected && (!this.objectsSubscribes[id].cbs || !this.objectsSubscribes[id].cbs.length)) {\r\n delete this.objectsSubscribes[id];\r\n this.connected && this._socket.emit('unsubscribeObjects', id);\r\n }\r\n }\r\n return Promise.resolve();\r\n }\r\n\r\n /**\r\n * Called internally.\r\n * @private\r\n * @param {string} id\r\n * @param {ioBroker.Object | null | undefined} obj\r\n */\r\n objectChange(id, obj) {\r\n // update main.objects cache\r\n if (!this.objects) {\r\n return;\r\n }\r\n\r\n /** @type {import(\"./types\").OldObject} */\r\n let oldObj;\r\n\r\n let changed = false;\r\n if (obj) {\r\n if (obj._rev && this.objects[id]) {\r\n this.objects[id]._rev = obj._rev;\r\n }\r\n\r\n if (this.objects[id]) {\r\n oldObj = { _id: id, type: this.objects[id].type };\r\n }\r\n\r\n if (!this.objects[id] || JSON.stringify(this.objects[id]) !== JSON.stringify(obj)) {\r\n this.objects[id] = obj;\r\n changed = true;\r\n }\r\n } else if (this.objects[id]) {\r\n oldObj = { _id: id, type: this.objects[id].type };\r\n delete this.objects[id];\r\n changed = true;\r\n }\r\n\r\n Object.keys(this.objectsSubscribes).forEach(_id => {\r\n if (_id === id || this.objectsSubscribes[_id].reg.test(id)) {\r\n //@ts-ignore\r\n this.objectsSubscribes[_id].cbs.forEach(cb => cb(id, obj, oldObj));\r\n }\r\n });\r\n\r\n if (changed && this.props.onObjectChange) {\r\n this.props.onObjectChange(id, obj);\r\n }\r\n }\r\n\r\n /**\r\n * Called internally.\r\n * @private\r\n * @param {string} id\r\n * @param {ioBroker.State | null | undefined} state\r\n */\r\n stateChange(id, state) {\r\n for (const task in this.statesSubscribes) {\r\n if (this.statesSubscribes.hasOwnProperty(task) && this.statesSubscribes[task].reg.test(id)) {\r\n this.statesSubscribes[task].cbs.forEach(cb => cb(id, state));\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets all states.\r\n * @param {boolean} disableProgressUpdate don't call onProgress() when done\r\n * @returns {Promise>}\r\n */\r\n getStates(disableProgressUpdate) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('getStates', (err, res) => {\r\n this.states = res;\r\n //@ts-ignore\r\n !disableProgressUpdate && this.onProgress(PROGRESS.STATES_LOADED);\r\n return err ? reject(err) : resolve(this.states);\r\n }));\r\n }\r\n\r\n /**\r\n * Gets the given state.\r\n * @param {string} id The state ID.\r\n * @returns {Promise}\r\n */\r\n getState(id) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('getState', id, (err, state) => err ? reject(err) : resolve(state)));\r\n }\r\n\r\n /**\r\n * Gets the given binary state.\r\n * @param {string} id The state ID.\r\n * @returns {Promise}\r\n */\r\n getBinaryState(id) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n // the data will come in base64\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('getBinaryState', id, (err, state) => err ? reject(err) : resolve(state)));\r\n }\r\n\r\n /**\r\n * Sets the given binary state.\r\n * @param {string} id The state ID.\r\n * @param {string} base64 The Base64 encoded binary data.\r\n * @returns {Promise}\r\n */\r\n setBinaryState(id, base64) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n // the data will come in base64\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('setBinaryState', id, base64, err => err ? reject(err) : resolve()));\r\n }\r\n\r\n /**\r\n * Sets the given state value.\r\n * @param {string} id The state ID.\r\n * @param {string | number | boolean | ioBroker.State | ioBroker.SettableState | null} val The state value.\r\n * @returns {Promise}\r\n */\r\n setState(id, val) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('setState', id, val, err =>\r\n err ? reject(err) : resolve()));\r\n }\r\n\r\n /**\r\n * Gets all objects.\r\n * @param {(objects?: Record) => void} update Callback that is executed when all objects are retrieved.\r\n * @returns {void}\r\n */\r\n /**\r\n * Gets all objects.\r\n * @param {boolean} update Set to true to retrieve all objects from the server (instead of using the local cache).\r\n * @param {boolean} disableProgressUpdate don't call onProgress() when done\r\n * @returns {Promise> | undefined}\r\n */\r\n getObjects(update, disableProgressUpdate) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n } else {\r\n return new Promise((resolve, reject) => {\r\n if (!update && this.objects) {\r\n return resolve(this.objects);\r\n }\r\n\r\n this._socket.emit(Connection.isWeb() ? 'getObjects' : 'getAllObjects', (err, res) => {\r\n this.objects = res;\r\n disableProgressUpdate && this.onProgress(PROGRESS.OBJECTS_LOADED);\r\n err ? reject(err) : resolve(this.objects);\r\n });\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Called internally.\r\n * @private\r\n * @param {boolean} isEnable\r\n */\r\n _subscribe(isEnable) {\r\n if (isEnable && !this.subscribed) {\r\n this.subscribed = true;\r\n this.autoSubscribes.forEach(id => this._socket.emit('subscribeObjects', id));\r\n // re subscribe objects\r\n Object.keys(this.objectsSubscribes).forEach(id => this._socket.emit('subscribeObjects', id));\r\n // re-subscribe logs\r\n this.autoSubscribeLog && this._socket.emit('requireLog', true);\r\n // re subscribe states\r\n Object.keys(this.statesSubscribes).forEach(id => this._socket.emit('subscribe', id));\r\n } else if (!isEnable && this.subscribed) {\r\n this.subscribed = false;\r\n // un-subscribe objects\r\n this.autoSubscribes.forEach(id => this._socket.emit('unsubscribeObjects', id));\r\n Object.keys(this.objectsSubscribes).forEach(id => this._socket.emit('unsubscribeObjects', id));\r\n // un-subscribe logs\r\n this.autoSubscribeLog && this._socket.emit('requireLog', false);\r\n\r\n // un-subscribe states\r\n Object.keys(this.statesSubscribes).forEach(id => this._socket.emit('unsubscribe', id));\r\n }\r\n }\r\n\r\n /**\r\n * Requests log updates.\r\n * @param {boolean} isEnabled Set to true to get logs.\r\n * @returns {Promise}\r\n */\r\n requireLog(isEnabled) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('requireLog', isEnabled, err =>\r\n err ? reject(err) : resolve()));\r\n }\r\n\r\n /**\r\n * Deletes the given object.\r\n * @param {string} id The object ID.\r\n * @param {boolean} maintenance Force deletion of non conform IDs.\r\n * @returns {Promise}\r\n */\r\n delObject(id, maintenance) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('delObject', id, { maintenance: !!maintenance }, err =>\r\n err ? reject(err) : resolve()));\r\n }\r\n\r\n /**\r\n * Deletes the given object and all its children.\r\n * @param {string} id The object ID.\r\n * @param {boolean} maintenance Force deletion of non conform IDs.\r\n * @returns {Promise}\r\n */\r\n delObjects(id, maintenance) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('delObjects', id, {maintenance: !!maintenance}, err =>\r\n err ? reject(err) : resolve()));\r\n }\r\n\r\n /**\r\n * Sets the object.\r\n * @param {string} id The object ID.\r\n * @param {ioBroker.SettableObject} obj The object.\r\n * @returns {Promise}\r\n */\r\n setObject(id, obj) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n if (!obj) {\r\n return Promise.reject('Null object is not allowed');\r\n }\r\n\r\n obj = JSON.parse(JSON.stringify(obj));\r\n\r\n if (obj.hasOwnProperty('from')) {\r\n delete obj.from;\r\n }\r\n if (obj.hasOwnProperty('user')) {\r\n delete obj.user;\r\n }\r\n if (obj.hasOwnProperty('ts')) {\r\n delete obj.ts;\r\n }\r\n\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('setObject', id, obj, err =>\r\n err ? reject(err) : resolve()));\r\n }\r\n\r\n /**\r\n * Gets the object with the given id from the server.\r\n * @param {string} id The object ID.\r\n * @returns {ioBroker.GetObjectPromise} The object.\r\n */\r\n getObject(id) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('getObject', id, (err, obj) =>\r\n err ? reject(err) : resolve(obj)));\r\n }\r\n\r\n /**\r\n * Get all adapter instances.\r\n * @param {boolean} [update] Force update.\r\n * @returns {Promise}\r\n */\r\n /**\r\n * Get all instances of the given adapter.\r\n * @param {string} adapter The name of the adapter.\r\n * @param {boolean} [update] Force update.\r\n * @returns {Promise}\r\n */\r\n getAdapterInstances(adapter, update) {\r\n if (typeof adapter === 'boolean') {\r\n update = adapter;\r\n adapter = '';\r\n }\r\n adapter = adapter || '';\r\n\r\n if (!update && this._promises['instances_' + adapter]) {\r\n return this._promises['instances_' + adapter];\r\n }\r\n\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n this._promises['instances_' + adapter] = new Promise((resolve, reject) => {\r\n let timeout = setTimeout(() => {\r\n timeout = null;\r\n this.getObjectView(\r\n `system.adapter.${adapter ? adapter + '.' : ''}`,\r\n `system.adapter.${adapter ? adapter + '.' : ''}\\u9999`,\r\n 'instance'\r\n )\r\n .then(items => resolve(Object.keys(items).map(id => fixAdminUI(items[id]))))\r\n .catch(e => reject(e));\r\n }, TIMEOUT_FOR_ADMIN4);\r\n\r\n this._socket.emit('getAdapterInstances', adapter, (err, instances) => {\r\n if (timeout) {\r\n clearTimeout(timeout);\r\n timeout = null;\r\n return err ? reject(err) : resolve(instances);\r\n }\r\n });\r\n });\r\n\r\n return this._promises['instances_' + adapter];\r\n }\r\n\r\n /**\r\n * Get all adapters.\r\n * @param {boolean} [update] Force update.\r\n * @returns {Promise}\r\n */\r\n /**\r\n * Get adapters with the given name.\r\n * @param {string} adapter The name of the adapter.\r\n * @param {boolean} [update] Force update.\r\n * @returns {Promise}\r\n */\r\n getAdapters(adapter, update) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n\r\n if (typeof adapter === 'boolean') {\r\n update = adapter;\r\n adapter = '';\r\n }\r\n\r\n adapter = adapter || '';\r\n\r\n if (!update && this._promises['adapter_' + adapter]) {\r\n return this._promises['adapter_' + adapter];\r\n }\r\n\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n this._promises['adapter_' + adapter] = new Promise((resolve, reject) => {\r\n let timeout = setTimeout(() => {\r\n timeout = null;\r\n this.getObjectView(\r\n `system.adapter.${adapter}.`,\r\n `system.adapter.${adapter}.\\u9999`,\r\n 'adapter'\r\n )\r\n .then(items => resolve(Object.keys(items).map(id => fixAdminUI(items[id]))))\r\n .catch(e => reject(e));\r\n }, TIMEOUT_FOR_ADMIN4);\r\n\r\n this._socket.emit('getAdapters', adapter, (err, adapters) => {\r\n if (timeout) {\r\n clearTimeout(timeout);\r\n timeout = null;\r\n return err ? reject(err) : resolve(adapters);\r\n }\r\n });\r\n });\r\n\r\n return this._promises['adapter_' + adapter];\r\n }\r\n\r\n /**\r\n * Called internally.\r\n * @private\r\n * @param {any[]} objs\r\n * @param {(err?: any) => void} cb\r\n */\r\n _renameGroups(objs, cb) {\r\n if (!objs || !objs.length) {\r\n cb && cb();\r\n } else {\r\n let obj = objs.pop();\r\n let oldId = obj._id;\r\n obj._id = obj.newId;\r\n delete obj.newId;\r\n\r\n this.setObject(obj._id, obj)\r\n .then(() => this.delObject(oldId))\r\n .then(() => setTimeout(() => this._renameGroups(objs, cb), 0))\r\n .catch(err => cb && cb(err));\r\n }\r\n }\r\n\r\n /**\r\n * Rename a group.\r\n * @param {string} id The id.\r\n * @param {string} newId The new id.\r\n * @param {string | { [lang in ioBroker.Languages]?: string; }} newName The new name.\r\n */\r\n renameGroup(id, newId, newName) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n\r\n return this.getGroups(true)\r\n .then(groups => {\r\n if (groups.length) {\r\n // find all elements\r\n const groupsToRename = groups\r\n .filter(group => group._id.startsWith(id + '.'));\r\n\r\n groupsToRename.forEach(group => group.newId = newId + group._id.substring(id.length));\r\n\r\n return new Promise((resolve, reject) =>\r\n this._renameGroups(groupsToRename, err => err ? reject(err) : resolve()))\r\n .then(() => {\r\n const obj = groups.find(group => group._id === id);\r\n\r\n if (obj) {\r\n obj._id = newId;\r\n if (newName !== undefined) {\r\n obj.common = obj.common || {};\r\n obj.common.name = newName;\r\n }\r\n\r\n return this.setObject(obj._id, obj)\r\n .then(() => this.delObject(id));\r\n }\r\n });\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Sends a message to a specific instance or all instances of some specific adapter.\r\n * @param {string} instance The instance to send this message to.\r\n * @param {string} [command] Command name of the target instance.\r\n * @param {ioBroker.MessagePayload} [data] The message data to send.\r\n * @returns {Promise}\r\n */\r\n sendTo(instance, command, data) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n return new Promise(resolve =>\r\n this._socket.emit('sendTo', instance, command, data, result =>\r\n resolve(result)));\r\n }\r\n\r\n /**\r\n * Extend an object and create it if it might not exist.\r\n * @param {string} id The id.\r\n * @param {ioBroker.PartialObject} obj The object.\r\n */\r\n extendObject(id, obj) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n obj = JSON.parse(JSON.stringify(obj));\r\n\r\n if (obj.hasOwnProperty('from')) {\r\n delete obj.from;\r\n }\r\n if (obj.hasOwnProperty('user')) {\r\n delete obj.user;\r\n }\r\n if (obj.hasOwnProperty('ts')) {\r\n delete obj.ts;\r\n }\r\n\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('extendObject', id, obj, err => err ? reject(err) : resolve()));\r\n }\r\n\r\n /**\r\n * Register a handler for log messages.\r\n * @param {(message: string) => void} handler The handler.\r\n */\r\n registerLogHandler(handler) {\r\n !this.onLogHandlers.includes(handler) && this.onLogHandlers.push(handler);\r\n }\r\n\r\n /**\r\n * Unregister a handler for log messages.\r\n * @param {(message: string) => void} handler The handler.\r\n */\r\n unregisterLogHandler(handler) {\r\n const pos = this.onLogHandlers.indexOf(handler);\r\n pos !== -1 && this.onLogHandlers.splice(pos, 1);\r\n }\r\n\r\n /**\r\n * Register a handler for the connection state.\r\n * @param {(connected: boolean) => void} handler The handler.\r\n */\r\n registerConnectionHandler(handler) {\r\n !this.onConnectionHandlers.includes(handler) && this.onConnectionHandlers.push(handler);\r\n }\r\n\r\n /**\r\n * Unregister a handler for the connection state.\r\n * @param {(connected: boolean) => void} handler The handler.\r\n */\r\n unregisterConnectionHandler(handler) {\r\n const pos = this.onConnectionHandlers.indexOf(handler);\r\n pos !== -1 && this.onConnectionHandlers.splice(pos, 1);\r\n }\r\n\r\n /**\r\n * Set the handler for standard output of a command.\r\n * @param {(id: string, text: string) => void} handler The handler.\r\n */\r\n registerCmdStdoutHandler(handler) {\r\n this.onCmdStdoutHandler = handler;\r\n }\r\n\r\n /**\r\n * Unset the handler for standard output of a command.\r\n * @param {(id: string, text: string) => void} handler The handler.\r\n */\r\n unregisterCmdStdoutHandler(handler) {\r\n this.onCmdStdoutHandler = null;\r\n }\r\n\r\n /**\r\n * Set the handler for standard error of a command.\r\n * @param {(id: string, text: string) => void} handler The handler.\r\n */\r\n registerCmdStderrHandler(handler) {\r\n this.onCmdStderrHandler = handler;\r\n }\r\n\r\n /**\r\n * Unset the handler for standard error of a command.\r\n * @param {(id: string, text: string) => void} handler The handler.\r\n */\r\n unregisterCmdStderrHandler(handler) {\r\n this.onCmdStderrHandler = null;\r\n }\r\n\r\n /**\r\n * Set the handler for exit of a command.\r\n * @param {(id: string, exitCode: number) => void} handler The handler.\r\n */\r\n registerCmdExitHandler(handler) {\r\n this.onCmdExitHandler = handler;\r\n }\r\n\r\n /**\r\n * Unset the handler for exit of a command.\r\n * @param {(id: string, exitCode: number) => void} handler The handler.\r\n */\r\n unregisterCmdExitHandler(handler) {\r\n this.onCmdExitHandler = null;\r\n }\r\n\r\n /**\r\n * Get all enums with the given name.\r\n * @param {string} [_enum] The name of the enum\r\n * @param {boolean} [update] Force update.\r\n * @returns {Promise>}\r\n */\r\n getEnums(_enum, update) {\r\n if (!update && this._promises['enums_' + (_enum || 'all')]) {\r\n return this._promises['enums_' + (_enum || 'all')];\r\n }\r\n\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n this._promises['enums_' + (_enum || 'all')] = new Promise((resolve, reject) => {\r\n this._socket.emit('getObjectView', 'system', 'enum', { startkey: 'enum.' + (_enum || ''), endkey: 'enum.' + (_enum ? (_enum + '.') : '') + '\\u9999' }, (err, res) => {\r\n if (!err && res) {\r\n const _res = {};\r\n for (let i = 0; i < res.rows.length; i++) {\r\n if (_enum && res.rows[i].id === 'enum.' + _enum) {\r\n continue;\r\n }\r\n _res[res.rows[i].id] = res.rows[i].value;\r\n }\r\n resolve(_res);\r\n } else {\r\n reject(err);\r\n }\r\n });\r\n });\r\n\r\n return this._promises['enums_' + (_enum || 'all')];\r\n }\r\n\r\n /**\r\n * Query a predefined object view.\r\n * @param {string} start The start ID.\r\n * @param {string} end The end ID.\r\n * @param {string} type The type of object.\r\n * @returns {Promise>}\r\n */\r\n getObjectView(start, end, type) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n start = start || '';\r\n end = end || '\\u9999';\r\n\r\n return new Promise((resolve, reject) => {\r\n this._socket.emit('getObjectView', 'system', type, { startkey: start, endkey: end }, (err, res) => {\r\n if (!err) {\r\n const _res = {};\r\n if (res && res.rows) {\r\n for (let i = 0; i < res.rows.length; i++) {\r\n _res[res.rows[i].id] = res.rows[i].value;\r\n }\r\n }\r\n resolve(_res);\r\n } else {\r\n reject(err);\r\n }\r\n });\r\n });\r\n }\r\n\r\n /**\r\n * Get the stored certificates.\r\n * @param {boolean} [update] Force update.\r\n * @returns {Promise<{name: string; type: 'public' | 'private' | 'chained'}[]>}\r\n */\r\n getCertificates(update) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n\r\n if (this._promises.cert && !update) {\r\n return this._promises.cert;\r\n }\r\n\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n this._promises.cert = this.getObject('system.certificates')\r\n .then(res => {\r\n const certs = [];\r\n if (res && res.native && res.native.certificates) {\r\n Object.keys(res.native.certificates).forEach(c => {\r\n const cert = res.native.certificates[c];\r\n if (!cert) {\r\n return;\r\n }\r\n const _cert = {\r\n name: c,\r\n type: ''\r\n };\r\n // If it is filename, it could be everything\r\n if (cert.length < 700 && (cert.indexOf('/') !== -1 || cert.indexOf('\\\\') !== -1)) {\r\n if (c.toLowerCase().includes('private')) {\r\n _cert.type = 'private';\r\n } else if (cert.toLowerCase().includes('private')) {\r\n _cert.type = 'private';\r\n } else if (c.toLowerCase().includes('public')) {\r\n _cert.type = 'public';\r\n } else if (cert.toLowerCase().includes('public')) {\r\n _cert.type = 'public';\r\n }\r\n certs.push(_cert);\r\n } else {\r\n _cert.type = (cert.substring(0, '-----BEGIN RSA PRIVATE KEY'.length) === '-----BEGIN RSA PRIVATE KEY' || cert.substring(0, '-----BEGIN PRIVATE KEY'.length) === '-----BEGIN PRIVATE KEY') ? 'private' : 'public';\r\n\r\n if (_cert.type === 'public') {\r\n const m = cert.split('-----END CERTIFICATE-----');\r\n if (m.filter(t => t.replace(/\\r\\n|\\r|\\n/, '').trim()).length > 1) {\r\n _cert.type = 'chained';\r\n }\r\n }\r\n\r\n certs.push(_cert);\r\n }\r\n });\r\n }\r\n return certs;\r\n });\r\n\r\n return this._promises.cert;\r\n }\r\n\r\n /**\r\n * Get the logs from a host (only for admin connection).\r\n * @param {string} host\r\n * @param {number} [linesNumber]\r\n * @returns {Promise}\r\n */\r\n getLogs(host, linesNumber) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n return new Promise(resolve =>\r\n this._socket.emit('sendToHost', host, 'getLogs', linesNumber || 200, lines =>\r\n resolve(lines)));\r\n }\r\n\r\n /**\r\n * Get the log files (only for admin connection).\r\n * @returns {Promise}\r\n */\r\n getLogsFiles(host) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('readLogs', host, (err, files) =>\r\n err ? reject(err) : resolve(files)));\r\n }\r\n\r\n /**\r\n * Delete the logs from a host (only for admin connection).\r\n * @param {string} host\r\n * @returns {Promise}\r\n */\r\n delLogs(host) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('sendToHost', host, 'delLogs', null, error =>\r\n error ? reject(error) : resolve()));\r\n }\r\n\r\n /**\r\n * Read the meta items.\r\n * @returns {Promise}\r\n */\r\n readMetaItems() {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('getObjectView', 'system', 'meta', { startkey: '', endkey: '\\u9999' }, (err, objs) =>\r\n err ? reject(err) : resolve(objs.rows && objs.rows.map(obj => obj.value))));\r\n }\r\n\r\n /**\r\n * Read the directory of an adapter.\r\n * @param {string} adapter The adapter name.\r\n * @param {string} fileName The directory name.\r\n * @returns {Promise}\r\n */\r\n readDir(adapter, fileName) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('readDir', adapter, fileName, (err, files) =>\r\n err ? reject(err) : resolve(files)));\r\n }\r\n\r\n /**\r\n * Read a file of an adapter.\r\n * @param {string} adapter The adapter name.\r\n * @param {string} fileName The file name.\r\n * @param {boolean} base64 If it must be a base64 format\r\n * @returns {Promise}\r\n */\r\n readFile(adapter, fileName, base64) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n return new Promise((resolve, reject) => {\r\n if (!base64) {\r\n this._socket.emit('readFile', adapter, fileName, (err, data, type) => {\r\n //@ts-ignore\r\n err ? reject(err) : resolve({data, type});\r\n });\r\n } else {\r\n this._socket.emit('readFile64', adapter, fileName, base64, (err, data) =>\r\n err ? reject(err) : resolve(data));\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Write a file of an adapter.\r\n * @param {string} adapter The adapter name.\r\n * @param {string} fileName The file name.\r\n * @param {Buffer | string} data The data (if it's a Buffer, it will be converted to Base64).\r\n * @returns {Promise}\r\n */\r\n writeFile64(adapter, fileName, data) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n return new Promise((resolve, reject) => {\r\n if (typeof data === 'string') {\r\n this._socket.emit('writeFile', adapter, fileName, data, err =>\r\n err ? reject(err) : resolve());\r\n } else {\r\n const base64 = btoa(\r\n new Uint8Array(data)\r\n .reduce((data, byte) => data + String.fromCharCode(byte), '')\r\n );\r\n\r\n this._socket.emit('writeFile64', adapter, fileName, base64, err =>\r\n err ? reject(err) : resolve());\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Rename a file or folder of an adapter.\r\n *\r\n * All files in folder will be renamed too.\r\n * @param {string} adapter The adapter name.\r\n * @param {string} oldName The file name of the file to be renamed.\r\n * @param {string} newName The new file name.\r\n * @returns {Promise}\r\n */\r\n rename(adapter, oldName, newName) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('rename', adapter, oldName, newName, err =>\r\n err ? reject(err) : resolve()));\r\n }\r\n\r\n /**\r\n * Delete a file of an adapter.\r\n * @param {string} adapter The adapter name.\r\n * @param {string} fileName The file name.\r\n * @returns {Promise}\r\n */\r\n deleteFile(adapter, fileName) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('unlink', adapter, fileName, err =>\r\n err ? reject(err) : resolve()));\r\n }\r\n\r\n /**\r\n * Delete a folder of an adapter.\r\n * All files in folder will be deleted.\r\n * @param {string} adapter The adapter name.\r\n * @param {string} folderName The folder name.\r\n * @returns {Promise}\r\n */\r\n deleteFolder(adapter, folderName) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('deleteFolder', adapter, folderName, err =>\r\n err ? reject(err) : resolve()));\r\n }\r\n\r\n /**\r\n * Get the list of all hosts.\r\n * @param {boolean} [update] Force update.\r\n * @returns {Promise}\r\n */\r\n getHosts(update) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n if (!update && this._promises.hosts) {\r\n return this._promises.hosts;\r\n }\r\n\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n this._promises.hosts = new Promise((resolve, reject) =>\r\n this._socket.emit(\r\n 'getObjectView',\r\n 'system',\r\n 'host',\r\n {startkey: 'system.host.', endkey: 'system.host.\\u9999'},\r\n (err, doc) => {\r\n if (err) {\r\n reject(err);\r\n } else {\r\n resolve(doc.rows.map(item => item.value));\r\n }\r\n }));\r\n\r\n return this._promises.hosts;\r\n }\r\n\r\n /**\r\n * Get the list of all users.\r\n * @param {boolean} [update] Force update.\r\n * @returns {Promise}\r\n */\r\n getUsers(update) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n if (!update && this._promises.users) {\r\n return this._promises.users;\r\n }\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n this._promises.users = new Promise((resolve, reject) =>\r\n this._socket.emit(\r\n 'getObjectView',\r\n 'system',\r\n 'user',\r\n {startkey: 'system.user.', endkey: 'system.user.\\u9999'},\r\n (err, doc) => {\r\n if (err) {\r\n reject(err);\r\n } else {\r\n resolve(doc.rows.map(item => item.value));\r\n }\r\n }));\r\n\r\n return this._promises.users;\r\n }\r\n\r\n /**\r\n * Get the list of all groups.\r\n * @param {boolean} [update] Force update.\r\n * @returns {Promise}\r\n */\r\n getGroups(update) {\r\n if (!update && this._promises.groups) {\r\n return this._promises.groups;\r\n }\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n this._promises.groups = new Promise((resolve, reject) =>\r\n this._socket.emit(\r\n 'getObjectView',\r\n 'system',\r\n 'group',\r\n {startkey: 'system.group.', endkey: 'system.group.\\u9999'},\r\n (err, doc) => {\r\n if (err) {\r\n reject(err);\r\n } else {\r\n resolve(doc.rows.map(item => item.value));\r\n }\r\n }));\r\n\r\n return this._promises.groups;\r\n }\r\n\r\n /**\r\n * Get the host information.\r\n * @param {string} host\r\n * @param {boolean} [update] Force update.\r\n * @param {number} [timeoutMs] optional read timeout.\r\n * @returns {Promise}\r\n */\r\n getHostInfo(host, update, timeoutMs) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n if (!host.startsWith('system.host.')) {\r\n host += 'system.host.' + host;\r\n }\r\n\r\n if (!update && this._promises['hostInfo' + host]) {\r\n return this._promises['hostInfo' + host];\r\n }\r\n\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n this._promises['hostInfo' + host] = new Promise((resolve, reject) => {\r\n let timeout = setTimeout(() => {\r\n if (timeout) {\r\n timeout = null;\r\n reject('getHostInfo timeout');\r\n }\r\n }, timeoutMs || this.props.cmdTimeout);\r\n\r\n this._socket.emit('sendToHost', host, 'getHostInfo', null, data => {\r\n if (timeout) {\r\n clearTimeout(timeout);\r\n timeout = null;\r\n if (data === PERMISSION_ERROR) {\r\n reject('May not read \"getHostInfo\"');\r\n } else if (!data) {\r\n reject('Cannot read \"getHostInfo\"');\r\n } else {\r\n resolve(data);\r\n }\r\n }\r\n });\r\n });\r\n\r\n return this._promises['hostInfo' + host];\r\n }\r\n\r\n /**\r\n * Get the host information (short version).\r\n * @param {string} host\r\n * @param {boolean} [update] Force update.\r\n * @param {number} [timeoutMs] optional read timeout.\r\n * @returns {Promise}\r\n */\r\n getHostInfoShort(host, update, timeoutMs) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n if (!host.startsWith('system.host.')) {\r\n host += 'system.host.' + host;\r\n }\r\n\r\n if (!update && this._promises['hostInfoShort' + host]) {\r\n return this._promises['hostInfoShort' + host];\r\n }\r\n\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n this._promises['hostInfoShort' + host] = new Promise((resolve, reject) => {\r\n let timeout = setTimeout(() => {\r\n if (timeout) {\r\n timeout = null;\r\n reject('hostInfoShort timeout');\r\n }\r\n }, timeoutMs || this.props.cmdTimeout);\r\n\r\n this._socket.emit('sendToHost', host, 'getHostInfoShort', null, data => {\r\n if (timeout) {\r\n clearTimeout(timeout);\r\n timeout = null;\r\n if (data === PERMISSION_ERROR) {\r\n reject('May not read \"getHostInfoShort\"');\r\n } else if (!data) {\r\n reject('Cannot read \"getHostInfoShort\"');\r\n } else {\r\n resolve(data);\r\n }\r\n }\r\n });\r\n });\r\n\r\n return this._promises['hostInfoShort' + host];\r\n }\r\n\r\n /**\r\n * Get the repository.\r\n * @param {string} host\r\n * @param {any} [args]\r\n * @param {boolean} [update] Force update.\r\n * @param {number} [timeoutMs] timeout in ms.\r\n * @returns {Promise}\r\n */\r\n getRepository(host, args, update, timeoutMs) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n if (!update && this._promises.repo) {\r\n return this._promises.repo;\r\n }\r\n\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n if (!host.startsWith('system.host.')) {\r\n host += 'system.host.' + host;\r\n }\r\n\r\n this._promises.repo = new Promise((resolve, reject) => {\r\n let timeout = setTimeout(() => {\r\n if (timeout) {\r\n timeout = null;\r\n reject('getRepository timeout');\r\n }\r\n }, timeoutMs || this.props.cmdTimeout);\r\n\r\n this._socket.emit('sendToHost', host, 'getRepository', args, data => {\r\n if (timeout) {\r\n clearTimeout(timeout);\r\n timeout = null;\r\n if (data === PERMISSION_ERROR) {\r\n reject('May not read \"getRepository\"');\r\n } else if (!data) {\r\n reject('Cannot read \"getRepository\"');\r\n } else {\r\n resolve(data);\r\n }\r\n }\r\n });\r\n });\r\n\r\n return this._promises.repo;\r\n }\r\n\r\n /**\r\n * Get the installed.\r\n * @param {string} host\r\n * @param {boolean} [update] Force update.\r\n * @param {number} [cmdTimeout] timeout in ms (optional)\r\n * @returns {Promise}\r\n */\r\n getInstalled(host, update, cmdTimeout) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n\r\n this._promises.installed = this._promises.installed || {};\r\n\r\n if (!update && this._promises.installed[host]) {\r\n return this._promises.installed[host];\r\n }\r\n\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n if (!host.startsWith('system.host.')) {\r\n host += 'system.host.' + host;\r\n }\r\n\r\n this._promises.installed[host] = new Promise((resolve, reject) => {\r\n let timeout = setTimeout(() => {\r\n if (timeout) {\r\n timeout = null;\r\n reject('getInstalled timeout');\r\n }\r\n }, cmdTimeout || this.props.cmdTimeout);\r\n\r\n this._socket.emit('sendToHost', host, 'getInstalled', null, data => {\r\n if (timeout) {\r\n clearTimeout(timeout);\r\n timeout = null;\r\n if (data === PERMISSION_ERROR) {\r\n reject('May not read \"getInstalled\"');\r\n } else if (!data) {\r\n reject('Cannot read \"getInstalled\"');\r\n } else {\r\n resolve(data);\r\n }\r\n }\r\n });\r\n });\r\n\r\n return this._promises.installed[host];\r\n }\r\n\r\n /**\r\n * Execute a command on a host.\r\n * @param {string} host The host name.\r\n * @param {string} cmd The command.\r\n * @param {string} cmdId The command ID.\r\n * @param {number} cmdTimeout Timeout of command in ms\r\n * @returns {Promise}\r\n */\r\n cmdExec(host, cmd, cmdId, cmdTimeout) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n if (!host.startsWith(host)) {\r\n host += 'system.host.' + host;\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n let timeout = cmdTimeout && setTimeout(() => {\r\n if (timeout) {\r\n timeout = null;\r\n reject('cmdExec timeout');\r\n }\r\n }, cmdTimeout);\r\n\r\n this._socket.emit('cmdExec', host, cmdId, cmd, null, err => {\r\n if (!cmdTimeout || timeout) {\r\n timeout && clearTimeout(timeout);\r\n timeout = null;\r\n if (err) {\r\n reject(err);\r\n } else {\r\n resolve();\r\n }\r\n }\r\n });\r\n });\r\n }\r\n\r\n /**\r\n * Checks if a given feature is supported.\r\n * @param {string} feature The feature to check.\r\n * @param {boolean} [update] Force update.\r\n * @returns {Promise}\r\n */\r\n checkFeatureSupported(feature, update) {\r\n if (!update && this._promises['supportedFeatures_' + feature]) {\r\n return this._promises['supportedFeatures_' + feature];\r\n }\r\n\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n this._promises['supportedFeatures_' + feature] = new Promise((resolve, reject) =>\r\n this._socket.emit('checkFeatureSupported', feature, (err, features) => {\r\n err ? reject(err) : resolve(features)\r\n }));\r\n\r\n return this._promises['supportedFeatures_' + feature];\r\n }\r\n\r\n /**\r\n * Read the base settings of a given host.\r\n * @param {string} host\r\n * @returns {Promise}\r\n */\r\n readBaseSettings(host) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n return this.checkFeatureSupported('CONTROLLER_READWRITE_BASE_SETTINGS')\r\n .then(result => {\r\n if (result) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n return new Promise((resolve, reject) => {\r\n let timeout = setTimeout(() => {\r\n if (timeout) {\r\n timeout = null;\r\n reject('readBaseSettings timeout');\r\n }\r\n }, this.props.cmdTimeout);\r\n\r\n if (host.startsWith('system.host.')) {\r\n host = host.replace(/^system\\.host\\./, '');\r\n }\r\n\r\n this._socket.emit('sendToHost', host, 'readBaseSettings', null, data => {\r\n if (timeout) {\r\n clearTimeout(timeout);\r\n timeout = null;\r\n\r\n if (data === PERMISSION_ERROR) {\r\n reject('May not read \"BaseSettings\"');\r\n } else if (!data) {\r\n reject('Cannot read \"BaseSettings\"');\r\n } else {\r\n resolve(data);\r\n }\r\n }\r\n });\r\n });\r\n } else {\r\n return Promise.reject('Not supported');\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Write the base settings of a given host.\r\n * @param {string} host\r\n * @param {any} config\r\n * @returns {Promise}\r\n */\r\n writeBaseSettings(host, config) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n return this.checkFeatureSupported('CONTROLLER_READWRITE_BASE_SETTINGS')\r\n .then(result => {\r\n if (result) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n return new Promise((resolve, reject) => {\r\n let timeout = setTimeout(() => {\r\n if (timeout) {\r\n timeout = null;\r\n reject('writeBaseSettings timeout');\r\n }\r\n }, this.props.cmdTimeout);\r\n\r\n this._socket.emit('sendToHost', host, 'writeBaseSettings', config, data => {\r\n if (timeout) {\r\n clearTimeout(timeout);\r\n timeout = null;\r\n\r\n if (data === PERMISSION_ERROR) {\r\n reject('May not write \"BaseSettings\"');\r\n } else if (!data) {\r\n reject('Cannot write \"BaseSettings\"');\r\n } else {\r\n resolve(data);\r\n }\r\n }\r\n });\r\n });\r\n } else {\r\n return Promise.reject('Not supported');\r\n }\r\n })\r\n }\r\n\r\n /**\r\n * Send command to restart the iobroker on host\r\n * @param {string} host\r\n * @returns {Promise}\r\n */\r\n restartController(host) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n return new Promise((resolve, reject) => {\r\n this._socket.emit('sendToHost', host, 'restartController', null, error => {\r\n error ? reject(error) : resolve(true);\r\n });\r\n });\r\n }\r\n\r\n /**\r\n * Read statistics information from host\r\n * @param {string} host\r\n * @param {string} typeOfDiag one of none, normal, no-city, extended\r\n * @returns {Promise}\r\n */\r\n getDiagData(host, typeOfDiag) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n return new Promise(resolve => {\r\n this._socket.emit('sendToHost', host, 'getDiagData', typeOfDiag, result =>\r\n resolve(result));\r\n });\r\n }\r\n\r\n /**\r\n * Read all states (which might not belong to this adapter) which match the given pattern.\r\n * @param {string} pattern\r\n * @returns {ioBroker.GetStatesPromise}\r\n */\r\n getForeignStates(pattern) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n if (Connection.isWeb()) {\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('getStates', pattern || '*', (err, states) =>\r\n err ? reject(err) : resolve(states)));\r\n } else {\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('getForeignStates', pattern || '*', (err, states) =>\r\n err ? reject(err) : resolve(states)));\r\n }\r\n }\r\n\r\n /**\r\n * Get foreign objects by pattern, by specific type and resolve their enums.\r\n * @param {string} pattern\r\n * @param {string} [type]\r\n * @returns {ioBroker.GetObjectsPromise}\r\n */\r\n getForeignObjects(pattern, type) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('getForeignObjects', pattern || '*', type, (err, states) =>\r\n err ? reject(err) : resolve(states)));\r\n }\r\n\r\n /**\r\n * Gets the system configuration.\r\n * @param {boolean} [update] Force update.\r\n * @returns {Promise}\r\n */\r\n getSystemConfig(update) {\r\n if (!update && this._promises.systemConfig) {\r\n return this._promises.systemConfig;\r\n }\r\n\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n this._promises.systemConfig = this.getObject('system.config')\r\n .then(systemConfig => {\r\n //@ts-ignore\r\n systemConfig = systemConfig || {};\r\n //@ts-ignore\r\n systemConfig.common = systemConfig.common || {};\r\n //@ts-ignore\r\n systemConfig.native = systemConfig.native || {};\r\n return systemConfig;\r\n });\r\n\r\n return this._promises.systemConfig;\r\n }\r\n\r\n /**\r\n * Sets the system configuration.\r\n * @param {ioBroker.SettableObjectWorker} obj\r\n * @returns {Promise>}\r\n */\r\n setSystemConfig(obj) {\r\n return this.setObject('system.config', obj)\r\n .then(() => this._promises.systemConfig = Promise.resolve(obj));\r\n }\r\n\r\n /**\r\n * Get the raw socket.io socket.\r\n * @returns {any}\r\n */\r\n getRawSocket() {\r\n return this._socket;\r\n }\r\n\r\n /**\r\n * Get the history of a given state.\r\n * @param {string} id\r\n * @param {ioBroker.GetHistoryOptions} options\r\n * @returns {Promise}\r\n */\r\n getHistory(id, options) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('getHistory', id, options, (err, values) =>\r\n err ? reject(err) : resolve(values)));\r\n }\r\n\r\n /**\r\n * Get the history of a given state.\r\n * @param {string} id\r\n * @param {ioBroker.GetHistoryOptions} options\r\n * @returns {Promise<{values: ioBroker.GetHistoryResult; sesionId: string; stepIgnore: number}>}\r\n */\r\n getHistoryEx(id, options) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('getHistory', id, options, (err, values, stepIgnore, sessionId) =>\r\n err ? reject(err) : resolve({ values, sessionId, stepIgnore })));\r\n }\r\n\r\n /**\r\n * Change the password of the given user.\r\n * @param {string} user\r\n * @param {string} password\r\n * @returns {Promise}\r\n */\r\n changePassword(user, password) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('changePassword', user, password, err =>\r\n err ? reject(err) : resolve()));\r\n }\r\n\r\n /**\r\n * Get the IP addresses of the given host.\r\n * @param {string} host\r\n * @param {boolean} [update] Force update.\r\n * @returns {Promise}\r\n */\r\n getIpAddresses(host, update) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n if (!host.startsWith('system.host.')) {\r\n host = 'system.host.' + host;\r\n }\r\n\r\n if (!update && this._promises['IPs_' + host]) {\r\n return this._promises['IPs_' + host];\r\n }\r\n this._promises['IPs_' + host] = this.getObject(host)\r\n .then(obj => obj && obj.common ? obj.common.address || [] : []);\r\n\r\n return this._promises['IPs_' + host];\r\n }\r\n\r\n /**\r\n * Get the IP addresses with interface names of the given host or find host by IP.\r\n * @param {string} ipOrHostName\r\n * @param {boolean} [update] Force update.\r\n * @returns {Promise]>}\r\n */\r\n getHostByIp(ipOrHostName, update) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n if (ipOrHostName.startsWith('system.host.')) {\r\n ipOrHostName = ipOrHostName.replace(/^system\\.host\\./, '');\r\n }\r\n\r\n if (!update && this._promises['rIPs_' + ipOrHostName]) {\r\n return this._promises['rIPs_' + ipOrHostName];\r\n }\r\n this._promises['rIPs_' + ipOrHostName] = new Promise(resolve =>\r\n this._socket.emit('getHostByIp', ipOrHostName, (ip, host) => {\r\n const IPs4 = [{name: '[IPv4] 0.0.0.0 - Listen on all IPs', address: '0.0.0.0', family: 'ipv4'}];\r\n const IPs6 = [{name: '[IPv6] :: - Listen on all IPs', address: '::', family: 'ipv6'}];\r\n if (host?.native?.hardware?.networkInterfaces) {\r\n for (const eth in host.native.hardware.networkInterfaces) {\r\n if (!host.native.hardware.networkInterfaces.hasOwnProperty(eth)) {\r\n continue;\r\n }\r\n for (let num = 0; num < host.native.hardware.networkInterfaces[eth].length; num++) {\r\n if (host.native.hardware.networkInterfaces[eth][num].family !== 'IPv6') {\r\n IPs4.push({name: `[${host.native.hardware.networkInterfaces[eth][num].family}] ${host.native.hardware.networkInterfaces[eth][num].address} - ${eth}`, address: host.native.hardware.networkInterfaces[eth][num].address, family: 'ipv4'});\r\n } else {\r\n IPs6.push({name: `[${host.native.hardware.networkInterfaces[eth][num].family}] ${host.native.hardware.networkInterfaces[eth][num].address} - ${eth}`, address: host.native.hardware.networkInterfaces[eth][num].address, family: 'ipv6'});\r\n }\r\n }\r\n }\r\n }\r\n for (let i = 0; i < IPs6.length; i++) {\r\n IPs4.push(IPs6[i]);\r\n }\r\n resolve(IPs4);\r\n }));\r\n\r\n return this._promises['rIPs_' + ipOrHostName];\r\n }\r\n\r\n /**\r\n * Encrypt a text\r\n * @param {string} text\r\n * @returns {Promise}\r\n */\r\n encrypt(text) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('encrypt', text, (err, text) =>\r\n err ? reject(err) : resolve(text)));\r\n }\r\n\r\n /**\r\n * Decrypt a text\r\n * @param {string} encryptedText\r\n * @returns {Promise}\r\n */\r\n decrypt(encryptedText) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('decrypt', encryptedText, (err, text) =>\r\n err ? reject(err) : resolve(text)));\r\n }\r\n\r\n /**\r\n * Gets the version.\r\n * @returns {Promise<{version: string; serverName: string}>}\r\n */\r\n getVersion(update) {\r\n if (update && this._promises.version) {\r\n this._promises.version = null;\r\n }\r\n\r\n this._promises.version = this._promises.version || new Promise((resolve, reject) =>\r\n this._socket.emit('getVersion', (err, version, serverName) => {\r\n // support of old socket.io\r\n if (err && !version && typeof err === 'string' && err.match(/\\d+\\.\\d+\\.\\d+/)) {\r\n resolve({ version: err, serverName: 'socketio' });\r\n } else {\r\n return err ? reject(err) : resolve({ version, serverName });\r\n }\r\n }));\r\n\r\n return this._promises.version;\r\n }\r\n\r\n /**\r\n * Gets the web server name.\r\n * @returns {Promise}\r\n */\r\n getWebServerName() {\r\n this._promises.webName = this._promises.webName || new Promise((resolve, reject) =>\r\n this._socket.emit('getAdapterName', (err, name) =>\r\n err ? reject(err) : resolve(name)));\r\n\r\n return this._promises.webName;\r\n }\r\n\r\n /**\r\n * Gets the admin version.\r\n * @deprecated use getVersion()\r\n * @returns {Promise<{version: string; serverName: string}>}\r\n */\r\n getAdminVersion() {\r\n console.log('Deprecated: use getVersion');\r\n return this.getVersion();\r\n }\r\n\r\n /**\r\n * Change access rights for file\r\n * @param {string} [adapter] adapter name\r\n * @param {string} [filename] file name with full path. it could be like vis.0/*\r\n * @param {object} [options] like {mode: 0x644}\r\n * @returns {Promise<{entries: array}>}\r\n */\r\n chmodFile(adapter, filename, options) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('chmodFile', adapter, filename, options, (err, entries, id) =>\r\n err ? reject(err) : resolve({entries, id})));\r\n }\r\n\r\n /**\r\n * Change owner or/and owner group for file\r\n * @param {string} [adapter] adapter name\r\n * @param {string} [filename] file name with full path. it could be like vis.0/*\r\n * @param {object} [options] like {owner: 'newOwner', ownerGroup: 'newGroup'}\r\n * @returns {Promise<{entries: array}>}\r\n */\r\n chownFile(adapter, filename, options) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('chownFile', adapter, filename, options, (err, entries, id) =>\r\n err ? reject(err) : resolve({entries, id})));\r\n }\r\n\r\n /**\r\n * Check if the file exists\r\n * @param {string} [adapter] adapter name\r\n * @param {string} [filename] file name with full path. it could be like vis.0/*\r\n * @returns {Promise}\r\n */\r\n fileExists(adapter, filename) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('fileExists', adapter, filename, (err, exists) =>\r\n err ? reject(err) : resolve(exists)));\r\n }\r\n\r\n /**\r\n * Get the alarm notifications from a host (only for admin connection).\r\n * @param {string} host\r\n * @param {string} [category] - optional\r\n * @returns {Promise}\r\n */\r\n getNotifications(host, category) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n return new Promise(resolve =>\r\n this._socket.emit('sendToHost', host, 'getNotifications', {category}, notifications =>\r\n resolve(notifications)));\r\n }\r\n\r\n /**\r\n * Clear the alarm notifications on a host (only for admin connection).\r\n * @param {string} host\r\n * @param {string} [category] - optional\r\n * @returns {Promise}\r\n */\r\n clearNotifications(host, category) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n return new Promise(resolve =>\r\n this._socket.emit('sendToHost', host, 'clearNotifications', {category}, notifications =>\r\n resolve(notifications)));\r\n }\r\n\r\n /**\r\n * Read if only easy mode is allowed (only for admin connection).\r\n * @returns {Promise}\r\n */\r\n getIsEasyModeStrict() {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('getIsEasyModeStrict', (error, isStrict) =>\r\n error ? reject(error) : resolve(isStrict)));\r\n }\r\n\r\n /**\r\n * Read easy mode configuration (only for admin connection).\r\n * @returns {Promise}\r\n */\r\n getEasyMode() {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('getEasyMode', (error, config) =>\r\n error ? reject(error) : resolve(config)));\r\n }\r\n\r\n /**\r\n * Read current user\r\n * @returns {Promise}\r\n */\r\n getCurrentUser() {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n return new Promise(resolve =>\r\n this._socket.emit('authEnabled', (isSecure, user) =>\r\n resolve(user)));\r\n }\r\n\r\n getCurrentSession(cmdTimeout) {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n const controller = new AbortController();\r\n\r\n let timeout = setTimeout(() => {\r\n if (timeout) {\r\n timeout = null;\r\n controller.abort();\r\n reject('getCurrentSession timeout');\r\n }\r\n }, cmdTimeout || 5000);\r\n\r\n return fetch('./session', { signal: controller.signal })\r\n .then(res => res.json())\r\n .then(json => {\r\n if (timeout) {\r\n clearTimeout(timeout);\r\n timeout = null;\r\n resolve(json);\r\n }\r\n })\r\n .catch(e =>\r\n reject('getCurrentSession: ' + e));\r\n });\r\n }\r\n\r\n /**\r\n * Read adapter ratings\r\n * @returns {Promise}\r\n */\r\n getRatings(update) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('getRatings', update, (err, ratings) =>\r\n err ? reject(err) : resolve(ratings)));\r\n }\r\n\r\n /**\r\n * Read current web, socketio or admin namespace, like admin.0\r\n * @returns {Promise}\r\n */\r\n getCurrentInstance() {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n this._promises.currentInstance = this._promises.currentInstance ||\r\n new Promise((resolve, reject) =>\r\n this._socket.emit('getCurrentInstance', (err, namespace) =>\r\n err ? reject(err) : resolve(namespace)));\r\n\r\n return this._promises.currentInstance;\r\n }\r\n\r\n // returns very optimized information for adapters to minimize connection load\r\n getCompactAdapters(update) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n if (!update && this._promises.compactAdapters) {\r\n return this._promises.compactAdapters;\r\n }\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n this._promises.compactAdapters = new Promise((resolve, reject) =>\r\n this._socket.emit('getCompactAdapters', (err, adapters) =>\r\n err ? reject(err) : resolve(adapters)));\r\n\r\n return this._promises.compactAdapters;\r\n }\r\n\r\n // returns very optimized information for adapters to minimize connection load\r\n getCompactInstances(update) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n if (!update && this._promises.compactInstances) {\r\n return this._promises.compactInstances;\r\n }\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n this._promises.compactInstances = new Promise((resolve, reject) =>\r\n this._socket.emit('getCompactInstances', (err, instances) =>\r\n err ? reject(err) : resolve(instances)));\r\n\r\n return this._promises.compactInstances;\r\n }\r\n\r\n // returns very optimized information for adapters to minimize connection load\r\n // reads only version of installed adapter\r\n getCompactInstalled(host, update, cmdTimeout) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n\r\n this._promises.installedCompact = this._promises.installedCompact || {};\r\n\r\n if (!update && this._promises.installedCompact[host]) {\r\n return this._promises.installedCompact[host];\r\n }\r\n\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n if (!host.startsWith('system.host.')) {\r\n host += 'system.host.' + host;\r\n }\r\n\r\n this._promises.installedCompact[host] = new Promise((resolve, reject) => {\r\n let timeout = setTimeout(() => {\r\n if (timeout) {\r\n timeout = null;\r\n reject('getCompactInstalled timeout');\r\n }\r\n }, cmdTimeout || this.props.cmdTimeout);\r\n\r\n this._socket.emit('getCompactInstalled', host, data => {\r\n if (timeout) {\r\n clearTimeout(timeout);\r\n timeout = null;\r\n if (data === PERMISSION_ERROR) {\r\n reject('May not read \"getCompactInstalled\"');\r\n } else if (!data) {\r\n reject('Cannot read \"getCompactInstalled\"');\r\n } else {\r\n resolve(data);\r\n }\r\n }\r\n });\r\n });\r\n\r\n return this._promises.installedCompact[host];\r\n }\r\n\r\n // returns very optimized information for adapters to minimize connection load\r\n getCompactSystemConfig(update) {\r\n if (!update && this._promises.systemConfigCommon) {\r\n return this._promises.systemConfigCommon;\r\n }\r\n\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n this._promises.systemConfigCommon = new Promise((resolve, reject) =>\r\n this._socket.emit('getCompactSystemConfig', (err, systemConfig) =>\r\n err ? reject(err) : resolve(systemConfig)));\r\n\r\n return this._promises.systemConfigCommon;\r\n }\r\n\r\n /**\r\n * Get the repository in compact form (only version and icon).\r\n * @param {string} host\r\n * @param {boolean} [update] Force update.\r\n * @param {number} [timeoutMs] timeout in ms.\r\n * @returns {Promise}\r\n */\r\n getCompactRepository(host, update, timeoutMs) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n if (!update && this._promises.repoCompact) {\r\n return this._promises.repoCompact;\r\n }\r\n\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n if (!host.startsWith('system.host.')) {\r\n host += 'system.host.' + host;\r\n }\r\n\r\n this._promises.repoCompact = new Promise((resolve, reject) => {\r\n let timeout = setTimeout(() => {\r\n if (timeout) {\r\n timeout = null;\r\n reject('getCompactRepository timeout');\r\n }\r\n }, timeoutMs || this.props.cmdTimeout);\r\n\r\n this._socket.emit('getCompactRepository', host, data => {\r\n if (timeout) {\r\n clearTimeout(timeout);\r\n timeout = null;\r\n if (data === PERMISSION_ERROR) {\r\n reject('May not read \"getCompactRepository\"');\r\n } else if (!data) {\r\n reject('Cannot read \"getCompactRepository\"');\r\n } else {\r\n resolve(data);\r\n }\r\n }\r\n });\r\n });\r\n\r\n return this._promises.repoCompact;\r\n }\r\n\r\n /**\r\n * Get the list of all hosts in compact form (only _id, common.name, common.icon, common.color, native.hardware.networkInterfaces)\r\n * @param {boolean} [update] Force update.\r\n * @returns {Promise}\r\n */\r\n getCompactHosts(update) {\r\n if (Connection.isWeb()) {\r\n return Promise.reject('Allowed only in admin');\r\n }\r\n if (!update && this._promises.hostsCompact) {\r\n return this._promises.hostsCompact;\r\n }\r\n\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n this._promises.hostsCompact = new Promise((resolve, reject) =>\r\n this._socket.emit('getCompactHosts', (err, hosts) =>\r\n err ? reject(err) : resolve(hosts)));\r\n\r\n return this._promises.hostsCompact;\r\n }\r\n\r\n /**\r\n * Get uuid\r\n * @returns {Promise}\r\n */\r\n getUuid() {\r\n if (this._promises.uuid) {\r\n return this._promises.uuid;\r\n }\r\n\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n this._promises.uuid = this.getObject('system.meta.uuid')\r\n //@ts-ignore\r\n .then(obj => obj?.native?.uuid);\r\n\r\n return this._promises.uuid;\r\n }\r\n\r\n /**\r\n * Send log to ioBroker log\r\n * @param {string} [text] Log text\r\n * @param {string} [level] `info`, `debug`, `warn`, `error` or `silly`\r\n * @returns {void}\r\n */\r\n log(text, level) {\r\n text && this._socket.emit('log', text, level || 'debug');\r\n }\r\n\r\n /**\r\n * Logout current user\r\n * @returns {Promise}\r\n */\r\n logout() {\r\n if (!this.connected) {\r\n return Promise.reject(NOT_CONNECTED);\r\n }\r\n\r\n return new Promise((resolve, reject) =>\r\n this._socket.emit('logout', err =>\r\n err ? reject(err) : resolve(null)));\r\n }\r\n}\r\n\r\nConnection.Connection = {\r\n onLog: PropTypes.func,\r\n onReady: PropTypes.func,\r\n onProgress: PropTypes.func,\r\n};\r\n\r\nexport default Connection;\r\n", "/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n\nimport type { ParameterizedString, PolymorphicEvent, Primitive } from '@sentry/types';\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst objectToString = Object.prototype.toString;\n\n/**\n * Checks whether given value's type is one of a few Error or Error-like\n * {@link isError}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isError(wat: unknown): wat is Error {\n switch (objectToString.call(wat)) {\n case '[object Error]':\n case '[object Exception]':\n case '[object DOMException]':\n return true;\n default:\n return isInstanceOf(wat, Error);\n }\n}\n/**\n * Checks whether given value is an instance of the given built-in class.\n *\n * @param wat The value to be checked\n * @param className\n * @returns A boolean representing the result.\n */\nfunction isBuiltin(wat: unknown, className: string): boolean {\n return objectToString.call(wat) === `[object ${className}]`;\n}\n\n/**\n * Checks whether given value's type is ErrorEvent\n * {@link isErrorEvent}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isErrorEvent(wat: unknown): boolean {\n return isBuiltin(wat, 'ErrorEvent');\n}\n\n/**\n * Checks whether given value's type is DOMError\n * {@link isDOMError}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isDOMError(wat: unknown): boolean {\n return isBuiltin(wat, 'DOMError');\n}\n\n/**\n * Checks whether given value's type is DOMException\n * {@link isDOMException}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isDOMException(wat: unknown): boolean {\n return isBuiltin(wat, 'DOMException');\n}\n\n/**\n * Checks whether given value's type is a string\n * {@link isString}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isString(wat: unknown): wat is string {\n return isBuiltin(wat, 'String');\n}\n\n/**\n * Checks whether given string is parameterized\n * {@link isParameterizedString}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isParameterizedString(wat: unknown): wat is ParameterizedString {\n return (\n typeof wat === 'object' &&\n wat !== null &&\n '__sentry_template_string__' in wat &&\n '__sentry_template_values__' in wat\n );\n}\n\n/**\n * Checks whether given value is a primitive (undefined, null, number, boolean, string, bigint, symbol)\n * {@link isPrimitive}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isPrimitive(wat: unknown): wat is Primitive {\n return wat === null || isParameterizedString(wat) || (typeof wat !== 'object' && typeof wat !== 'function');\n}\n\n/**\n * Checks whether given value's type is an object literal, or a class instance.\n * {@link isPlainObject}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isPlainObject(wat: unknown): wat is Record {\n return isBuiltin(wat, 'Object');\n}\n\n/**\n * Checks whether given value's type is an Event instance\n * {@link isEvent}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isEvent(wat: unknown): wat is PolymorphicEvent {\n return typeof Event !== 'undefined' && isInstanceOf(wat, Event);\n}\n\n/**\n * Checks whether given value's type is an Element instance\n * {@link isElement}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isElement(wat: unknown): boolean {\n return typeof Element !== 'undefined' && isInstanceOf(wat, Element);\n}\n\n/**\n * Checks whether given value's type is an regexp\n * {@link isRegExp}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isRegExp(wat: unknown): wat is RegExp {\n return isBuiltin(wat, 'RegExp');\n}\n\n/**\n * Checks whether given value has a then function.\n * @param wat A value to be checked.\n */\nexport function isThenable(wat: any): wat is PromiseLike {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return Boolean(wat && wat.then && typeof wat.then === 'function');\n}\n\n/**\n * Checks whether given value's type is a SyntheticEvent\n * {@link isSyntheticEvent}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isSyntheticEvent(wat: unknown): boolean {\n return isPlainObject(wat) && 'nativeEvent' in wat && 'preventDefault' in wat && 'stopPropagation' in wat;\n}\n\n/**\n * Checks whether given value is NaN\n * {@link isNaN}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isNaN(wat: unknown): boolean {\n return typeof wat === 'number' && wat !== wat;\n}\n\n/**\n * Checks whether given value's type is an instance of provided constructor.\n * {@link isInstanceOf}.\n *\n * @param wat A value to be checked.\n * @param base A constructor to be used in a check.\n * @returns A boolean representing the result.\n */\nexport function isInstanceOf(wat: any, base: any): boolean {\n try {\n return wat instanceof base;\n } catch (_e) {\n return false;\n }\n}\n\ninterface VueViewModel {\n // Vue3\n __isVue?: boolean;\n // Vue2\n _isVue?: boolean;\n}\n/**\n * Checks whether given value's type is a Vue ViewModel.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isVueViewModel(wat: unknown): boolean {\n // Not using Object.prototype.toString because in Vue 3 it would read the instance's Symbol(Symbol.toStringTag) property.\n return !!(typeof wat === 'object' && wat !== null && ((wat as VueViewModel).__isVue || (wat as VueViewModel)._isVue));\n}\n", "import { isRegExp, isString, isVueViewModel } from './is';\n\nexport { escapeStringForRegex } from './vendor/escapeStringForRegex';\n\n/**\n * Truncates given string to the maximum characters count\n *\n * @param str An object that contains serializable values\n * @param max Maximum number of characters in truncated string (0 = unlimited)\n * @returns string Encoded\n */\nexport function truncate(str: string, max: number = 0): string {\n if (typeof str !== 'string' || max === 0) {\n return str;\n }\n return str.length <= max ? str : `${str.slice(0, max)}...`;\n}\n\n/**\n * This is basically just `trim_line` from\n * https://github.com/getsentry/sentry/blob/master/src/sentry/lang/javascript/processor.py#L67\n *\n * @param str An object that contains serializable values\n * @param max Maximum number of characters in truncated string\n * @returns string Encoded\n */\nexport function snipLine(line: string, colno: number): string {\n let newLine = line;\n const lineLength = newLine.length;\n if (lineLength <= 150) {\n return newLine;\n }\n if (colno > lineLength) {\n // eslint-disable-next-line no-param-reassign\n colno = lineLength;\n }\n\n let start = Math.max(colno - 60, 0);\n if (start < 5) {\n start = 0;\n }\n\n let end = Math.min(start + 140, lineLength);\n if (end > lineLength - 5) {\n end = lineLength;\n }\n if (end === lineLength) {\n start = Math.max(end - 140, 0);\n }\n\n newLine = newLine.slice(start, end);\n if (start > 0) {\n newLine = `'{snip} ${newLine}`;\n }\n if (end < lineLength) {\n newLine += ' {snip}';\n }\n\n return newLine;\n}\n\n/**\n * Join values in array\n * @param input array of values to be joined together\n * @param delimiter string to be placed in-between values\n * @returns Joined values\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function safeJoin(input: any[], delimiter?: string): string {\n if (!Array.isArray(input)) {\n return '';\n }\n\n const output = [];\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < input.length; i++) {\n const value = input[i];\n try {\n // This is a hack to fix a Vue3-specific bug that causes an infinite loop of\n // console warnings. This happens when a Vue template is rendered with\n // an undeclared variable, which we try to stringify, ultimately causing\n // Vue to issue another warning which repeats indefinitely.\n // see: https://github.com/getsentry/sentry-javascript/pull/8981\n if (isVueViewModel(value)) {\n output.push('[VueViewModel]');\n } else {\n output.push(String(value));\n }\n } catch (e) {\n output.push('[value cannot be serialized]');\n }\n }\n\n return output.join(delimiter);\n}\n\n/**\n * Checks if the given value matches a regex or string\n *\n * @param value The string to test\n * @param pattern Either a regex or a string against which `value` will be matched\n * @param requireExactStringMatch If true, `value` must match `pattern` exactly. If false, `value` will match\n * `pattern` if it contains `pattern`. Only applies to string-type patterns.\n */\nexport function isMatchingPattern(\n value: string,\n pattern: RegExp | string,\n requireExactStringMatch: boolean = false,\n): boolean {\n if (!isString(value)) {\n return false;\n }\n\n if (isRegExp(pattern)) {\n return pattern.test(value);\n }\n if (isString(pattern)) {\n return requireExactStringMatch ? value === pattern : value.includes(pattern);\n }\n\n return false;\n}\n\n/**\n * Test the given string against an array of strings and regexes. By default, string matching is done on a\n * substring-inclusion basis rather than a strict equality basis\n *\n * @param testString The string to test\n * @param patterns The patterns against which to test the string\n * @param requireExactStringMatch If true, `testString` must match one of the given string patterns exactly in order to\n * count. If false, `testString` will match a string pattern if it contains that pattern.\n * @returns\n */\nexport function stringMatchesSomePattern(\n testString: string,\n patterns: Array = [],\n requireExactStringMatch: boolean = false,\n): boolean {\n return patterns.some(pattern => isMatchingPattern(testString, pattern, requireExactStringMatch));\n}\n", "import type { Event, EventHint, Exception, ExtendedError, StackParser } from '@sentry/types';\n\nimport { isInstanceOf } from './is';\nimport { truncate } from './string';\n\n/**\n * Creates exceptions inside `event.exception.values` for errors that are nested on properties based on the `key` parameter.\n */\nexport function applyAggregateErrorsToEvent(\n exceptionFromErrorImplementation: (stackParser: StackParser, ex: Error) => Exception,\n parser: StackParser,\n maxValueLimit: number = 250,\n key: string,\n limit: number,\n event: Event,\n hint?: EventHint,\n): void {\n if (!event.exception || !event.exception.values || !hint || !isInstanceOf(hint.originalException, Error)) {\n return;\n }\n\n // Generally speaking the last item in `event.exception.values` is the exception originating from the original Error\n const originalException: Exception | undefined =\n event.exception.values.length > 0 ? event.exception.values[event.exception.values.length - 1] : undefined;\n\n // We only create exception grouping if there is an exception in the event.\n if (originalException) {\n event.exception.values = truncateAggregateExceptions(\n aggregateExceptionsFromError(\n exceptionFromErrorImplementation,\n parser,\n limit,\n hint.originalException as ExtendedError,\n key,\n event.exception.values,\n originalException,\n 0,\n ),\n maxValueLimit,\n );\n }\n}\n\nfunction aggregateExceptionsFromError(\n exceptionFromErrorImplementation: (stackParser: StackParser, ex: Error) => Exception,\n parser: StackParser,\n limit: number,\n error: ExtendedError,\n key: string,\n prevExceptions: Exception[],\n exception: Exception,\n exceptionId: number,\n): Exception[] {\n if (prevExceptions.length >= limit + 1) {\n return prevExceptions;\n }\n\n let newExceptions = [...prevExceptions];\n\n // Recursively call this function in order to walk down a chain of errors\n if (isInstanceOf(error[key], Error)) {\n applyExceptionGroupFieldsForParentException(exception, exceptionId);\n const newException = exceptionFromErrorImplementation(parser, error[key]);\n const newExceptionId = newExceptions.length;\n applyExceptionGroupFieldsForChildException(newException, key, newExceptionId, exceptionId);\n newExceptions = aggregateExceptionsFromError(\n exceptionFromErrorImplementation,\n parser,\n limit,\n error[key],\n key,\n [newException, ...newExceptions],\n newException,\n newExceptionId,\n );\n }\n\n // This will create exception grouping for AggregateErrors\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AggregateError\n if (Array.isArray(error.errors)) {\n error.errors.forEach((childError, i) => {\n if (isInstanceOf(childError, Error)) {\n applyExceptionGroupFieldsForParentException(exception, exceptionId);\n const newException = exceptionFromErrorImplementation(parser, childError);\n const newExceptionId = newExceptions.length;\n applyExceptionGroupFieldsForChildException(newException, `errors[${i}]`, newExceptionId, exceptionId);\n newExceptions = aggregateExceptionsFromError(\n exceptionFromErrorImplementation,\n parser,\n limit,\n childError,\n key,\n [newException, ...newExceptions],\n newException,\n newExceptionId,\n );\n }\n });\n }\n\n return newExceptions;\n}\n\nfunction applyExceptionGroupFieldsForParentException(exception: Exception, exceptionId: number): void {\n // Don't know if this default makes sense. The protocol requires us to set these values so we pick *some* default.\n exception.mechanism = exception.mechanism || { type: 'generic', handled: true };\n\n exception.mechanism = {\n ...exception.mechanism,\n ...(exception.type === 'AggregateError' && { is_exception_group: true }),\n exception_id: exceptionId,\n };\n}\n\nfunction applyExceptionGroupFieldsForChildException(\n exception: Exception,\n source: string,\n exceptionId: number,\n parentId: number | undefined,\n): void {\n // Don't know if this default makes sense. The protocol requires us to set these values so we pick *some* default.\n exception.mechanism = exception.mechanism || { type: 'generic', handled: true };\n\n exception.mechanism = {\n ...exception.mechanism,\n type: 'chained',\n source,\n exception_id: exceptionId,\n parent_id: parentId,\n };\n}\n\n/**\n * Truncate the message (exception.value) of all exceptions in the event.\n * Because this event processor is ran after `applyClientOptions`,\n * we need to truncate the message of the added exceptions here.\n */\nfunction truncateAggregateExceptions(exceptions: Exception[], maxValueLength: number): Exception[] {\n return exceptions.map(exception => {\n if (exception.value) {\n exception.value = truncate(exception.value, maxValueLength);\n }\n return exception;\n });\n}\n", "/**\n * NOTE: In order to avoid circular dependencies, if you add a function to this module and it needs to print something,\n * you must either a) use `console.log` rather than the logger, or b) put your function elsewhere.\n *\n * Note: This file was originally called `global.ts`, but was changed to unblock users which might be doing\n * string replaces with bundlers like Vite for `global` (would break imports that rely on importing from utils/src/global).\n *\n * Why worldwide?\n *\n * Why not?\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { Integration } from '@sentry/types';\n\nimport type { SdkSource } from './env';\n\n/** Internal global with common properties and Sentry extensions */\nexport interface InternalGlobal {\n navigator?: { userAgent?: string };\n console: Console;\n Sentry?: {\n Integrations?: Integration[];\n };\n onerror?: {\n (event: object | string, source?: string, lineno?: number, colno?: number, error?: Error): any;\n __SENTRY_INSTRUMENTED__?: true;\n __SENTRY_LOADER__?: true;\n };\n onunhandledrejection?: {\n (event: unknown): boolean;\n __SENTRY_INSTRUMENTED__?: true;\n __SENTRY_LOADER__?: true;\n };\n SENTRY_ENVIRONMENT?: string;\n SENTRY_DSN?: string;\n SENTRY_RELEASE?: {\n id?: string;\n };\n SENTRY_SDK_SOURCE?: SdkSource;\n /**\n * Debug IDs are indirectly injected by Sentry CLI or bundler plugins to directly reference a particular source map\n * for resolving of a source file. The injected code will place an entry into the record for each loaded bundle/JS\n * file.\n */\n _sentryDebugIds?: Record;\n __SENTRY__: {\n globalEventProcessors: any;\n hub: any;\n logger: any;\n extensions?: {\n /** Extension methods for the hub, which are bound to the current Hub instance */\n // eslint-disable-next-line @typescript-eslint/ban-types\n [key: string]: Function;\n };\n };\n /**\n * Raw module metadata that is injected by bundler plugins.\n *\n * Keys are `error.stack` strings, values are the metadata.\n */\n _sentryModuleMetadata?: Record;\n}\n\n// The code below for 'isGlobalObj' and 'GLOBAL_OBJ' was copied from core-js before modification\n// https://github.com/zloirock/core-js/blob/1b944df55282cdc99c90db5f49eb0b6eda2cc0a3/packages/core-js/internals/global.js\n// core-js has the following licence:\n//\n// Copyright (c) 2014-2022 Denis Pushkarev\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n/** Returns 'obj' if it's the global object, otherwise returns undefined */\nfunction isGlobalObj(obj: { Math?: Math }): any | undefined {\n return obj && obj.Math == Math ? obj : undefined;\n}\n\n/** Get's the global object for the current JavaScript runtime */\nexport const GLOBAL_OBJ: InternalGlobal =\n (typeof globalThis == 'object' && isGlobalObj(globalThis)) ||\n // eslint-disable-next-line no-restricted-globals\n (typeof window == 'object' && isGlobalObj(window)) ||\n (typeof self == 'object' && isGlobalObj(self)) ||\n (typeof global == 'object' && isGlobalObj(global)) ||\n (function (this: any) {\n return this;\n })() ||\n {};\n\n/**\n * @deprecated Use GLOBAL_OBJ instead or WINDOW from @sentry/browser. This will be removed in v8\n */\nexport function getGlobalObject(): T & InternalGlobal {\n return GLOBAL_OBJ as T & InternalGlobal;\n}\n\n/**\n * Returns a global singleton contained in the global `__SENTRY__` object.\n *\n * If the singleton doesn't already exist in `__SENTRY__`, it will be created using the given factory\n * function and added to the `__SENTRY__` object.\n *\n * @param name name of the global singleton on __SENTRY__\n * @param creator creator Factory function to create the singleton if it doesn't already exist on `__SENTRY__`\n * @param obj (Optional) The global object on which to look for `__SENTRY__`, if not `GLOBAL_OBJ`'s return value\n * @returns the singleton\n */\nexport function getGlobalSingleton(name: keyof InternalGlobal['__SENTRY__'], creator: () => T, obj?: unknown): T {\n const gbl = (obj || GLOBAL_OBJ) as InternalGlobal;\n const __SENTRY__ = (gbl.__SENTRY__ = gbl.__SENTRY__ || {});\n const singleton = __SENTRY__[name] || (__SENTRY__[name] = creator());\n return singleton;\n}\n", "import { isString } from './is';\nimport { getGlobalObject } from './worldwide';\n\n// eslint-disable-next-line deprecation/deprecation\nconst WINDOW = getGlobalObject();\n\nconst DEFAULT_MAX_STRING_LENGTH = 80;\n\ntype SimpleNode = {\n parentNode: SimpleNode;\n} | null;\n\n/**\n * Given a child DOM element, returns a query-selector statement describing that\n * and its ancestors\n * e.g. [HTMLElement] => body > div > input#foo.btn[name=baz]\n * @returns generated DOM path\n */\nexport function htmlTreeAsString(\n elem: unknown,\n options: string[] | { keyAttrs?: string[]; maxStringLength?: number } = {},\n): string {\n if (!elem) {\n return '';\n }\n\n // try/catch both:\n // - accessing event.target (see getsentry/raven-js#838, #768)\n // - `htmlTreeAsString` because it's complex, and just accessing the DOM incorrectly\n // - can throw an exception in some circumstances.\n try {\n let currentElem = elem as SimpleNode;\n const MAX_TRAVERSE_HEIGHT = 5;\n const out = [];\n let height = 0;\n let len = 0;\n const separator = ' > ';\n const sepLength = separator.length;\n let nextStr;\n const keyAttrs = Array.isArray(options) ? options : options.keyAttrs;\n const maxStringLength = (!Array.isArray(options) && options.maxStringLength) || DEFAULT_MAX_STRING_LENGTH;\n\n while (currentElem && height++ < MAX_TRAVERSE_HEIGHT) {\n nextStr = _htmlElementAsString(currentElem, keyAttrs);\n // bail out if\n // - nextStr is the 'html' element\n // - the length of the string that would be created exceeds maxStringLength\n // (ignore this limit if we are on the first iteration)\n if (nextStr === 'html' || (height > 1 && len + out.length * sepLength + nextStr.length >= maxStringLength)) {\n break;\n }\n\n out.push(nextStr);\n\n len += nextStr.length;\n currentElem = currentElem.parentNode;\n }\n\n return out.reverse().join(separator);\n } catch (_oO) {\n return '';\n }\n}\n\n/**\n * Returns a simple, query-selector representation of a DOM element\n * e.g. [HTMLElement] => input#foo.btn[name=baz]\n * @returns generated DOM path\n */\nfunction _htmlElementAsString(el: unknown, keyAttrs?: string[]): string {\n const elem = el as {\n tagName?: string;\n id?: string;\n className?: string;\n getAttribute(key: string): string;\n };\n\n const out = [];\n let className;\n let classes;\n let key;\n let attr;\n let i;\n\n if (!elem || !elem.tagName) {\n return '';\n }\n\n // @ts-expect-error WINDOW has HTMLElement\n if (WINDOW.HTMLElement) {\n // If using the component name annotation plugin, this value may be available on the DOM node\n if (elem instanceof HTMLElement && elem.dataset && elem.dataset['sentryComponent']) {\n return elem.dataset['sentryComponent'];\n }\n }\n\n out.push(elem.tagName.toLowerCase());\n\n // Pairs of attribute keys defined in `serializeAttribute` and their values on element.\n const keyAttrPairs =\n keyAttrs && keyAttrs.length\n ? keyAttrs.filter(keyAttr => elem.getAttribute(keyAttr)).map(keyAttr => [keyAttr, elem.getAttribute(keyAttr)])\n : null;\n\n if (keyAttrPairs && keyAttrPairs.length) {\n keyAttrPairs.forEach(keyAttrPair => {\n out.push(`[${keyAttrPair[0]}=\"${keyAttrPair[1]}\"]`);\n });\n } else {\n if (elem.id) {\n out.push(`#${elem.id}`);\n }\n\n // eslint-disable-next-line prefer-const\n className = elem.className;\n if (className && isString(className)) {\n classes = className.split(/\\s+/);\n for (i = 0; i < classes.length; i++) {\n out.push(`.${classes[i]}`);\n }\n }\n }\n const allowedAttrs = ['aria-label', 'type', 'name', 'title', 'alt'];\n for (i = 0; i < allowedAttrs.length; i++) {\n key = allowedAttrs[i];\n attr = elem.getAttribute(key);\n if (attr) {\n out.push(`[${key}=\"${attr}\"]`);\n }\n }\n return out.join('');\n}\n\n/**\n * A safe form of location.href\n */\nexport function getLocationHref(): string {\n try {\n return WINDOW.document.location.href;\n } catch (oO) {\n return '';\n }\n}\n\n/**\n * Gets a DOM element by using document.querySelector.\n *\n * This wrapper will first check for the existance of the function before\n * actually calling it so that we don't have to take care of this check,\n * every time we want to access the DOM.\n *\n * Reason: DOM/querySelector is not available in all environments.\n *\n * We have to cast to any because utils can be consumed by a variety of environments,\n * and we don't want to break TS users. If you know what element will be selected by\n * `document.querySelector`, specify it as part of the generic call. For example,\n * `const element = getDomElement('selector');`\n *\n * @param selector the selector string passed on to document.querySelector\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getDomElement(selector: string): E | null {\n if (WINDOW.document && WINDOW.document.querySelector) {\n return WINDOW.document.querySelector(selector) as unknown as E;\n }\n return null;\n}\n\n/**\n * Given a DOM element, traverses up the tree until it finds the first ancestor node\n * that has the `data-sentry-component` attribute. This attribute is added at build-time\n * by projects that have the component name annotation plugin installed.\n *\n * @returns a string representation of the component for the provided DOM element, or `null` if not found\n */\nexport function getComponentName(elem: unknown): string | null {\n // @ts-expect-error WINDOW has HTMLElement\n if (!WINDOW.HTMLElement) {\n return null;\n }\n\n let currentElem = elem as SimpleNode;\n const MAX_TRAVERSE_HEIGHT = 5;\n for (let i = 0; i < MAX_TRAVERSE_HEIGHT; i++) {\n if (!currentElem) {\n return null;\n }\n\n if (currentElem instanceof HTMLElement && currentElem.dataset['sentryComponent']) {\n return currentElem.dataset['sentryComponent'];\n }\n\n currentElem = currentElem.parentNode;\n }\n\n return null;\n}\n", "declare const __DEBUG_BUILD__: boolean;\n\n/**\n * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.\n *\n * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.\n */\nexport const DEBUG_BUILD = __DEBUG_BUILD__;\n", "import type { ConsoleLevel } from '@sentry/types';\n\nimport { DEBUG_BUILD } from './debug-build';\nimport { GLOBAL_OBJ } from './worldwide';\n\n/** Prefix for logging strings */\nconst PREFIX = 'Sentry Logger ';\n\nexport const CONSOLE_LEVELS: readonly ConsoleLevel[] = [\n 'debug',\n 'info',\n 'warn',\n 'error',\n 'log',\n 'assert',\n 'trace',\n] as const;\n\ntype LoggerMethod = (...args: unknown[]) => void;\ntype LoggerConsoleMethods = Record;\n\n/** This may be mutated by the console instrumentation. */\nexport const originalConsoleMethods: {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key in ConsoleLevel]?: (...args: any[]) => void;\n} = {};\n\n/** JSDoc */\ninterface Logger extends LoggerConsoleMethods {\n disable(): void;\n enable(): void;\n isEnabled(): boolean;\n}\n\n/**\n * Temporarily disable sentry console instrumentations.\n *\n * @param callback The function to run against the original `console` messages\n * @returns The results of the callback\n */\nexport function consoleSandbox(callback: () => T): T {\n if (!('console' in GLOBAL_OBJ)) {\n return callback();\n }\n\n const console = GLOBAL_OBJ.console as Console;\n const wrappedFuncs: Partial = {};\n\n const wrappedLevels = Object.keys(originalConsoleMethods) as ConsoleLevel[];\n\n // Restore all wrapped console methods\n wrappedLevels.forEach(level => {\n const originalConsoleMethod = originalConsoleMethods[level] as LoggerMethod;\n wrappedFuncs[level] = console[level] as LoggerMethod | undefined;\n console[level] = originalConsoleMethod;\n });\n\n try {\n return callback();\n } finally {\n // Revert restoration to wrapped state\n wrappedLevels.forEach(level => {\n console[level] = wrappedFuncs[level] as LoggerMethod;\n });\n }\n}\n\nfunction makeLogger(): Logger {\n let enabled = false;\n const logger: Partial = {\n enable: () => {\n enabled = true;\n },\n disable: () => {\n enabled = false;\n },\n isEnabled: () => enabled,\n };\n\n if (DEBUG_BUILD) {\n CONSOLE_LEVELS.forEach(name => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n logger[name] = (...args: any[]) => {\n if (enabled) {\n consoleSandbox(() => {\n GLOBAL_OBJ.console[name](`${PREFIX}[${name}]:`, ...args);\n });\n }\n };\n });\n } else {\n CONSOLE_LEVELS.forEach(name => {\n logger[name] = () => undefined;\n });\n }\n\n return logger as Logger;\n}\n\nexport const logger = makeLogger();\n", "import type { DsnComponents, DsnLike, DsnProtocol } from '@sentry/types';\n\nimport { DEBUG_BUILD } from './debug-build';\nimport { consoleSandbox, logger } from './logger';\n\n/** Regular expression used to parse a Dsn. */\nconst DSN_REGEX = /^(?:(\\w+):)\\/\\/(?:(\\w+)(?::(\\w+)?)?@)([\\w.-]+)(?::(\\d+))?\\/(.+)/;\n\nfunction isValidProtocol(protocol?: string): protocol is DsnProtocol {\n return protocol === 'http' || protocol === 'https';\n}\n\n/**\n * Renders the string representation of this Dsn.\n *\n * By default, this will render the public representation without the password\n * component. To get the deprecated private representation, set `withPassword`\n * to true.\n *\n * @param withPassword When set to true, the password will be included.\n */\nexport function dsnToString(dsn: DsnComponents, withPassword: boolean = false): string {\n const { host, path, pass, port, projectId, protocol, publicKey } = dsn;\n return (\n `${protocol}://${publicKey}${withPassword && pass ? `:${pass}` : ''}` +\n `@${host}${port ? `:${port}` : ''}/${path ? `${path}/` : path}${projectId}`\n );\n}\n\n/**\n * Parses a Dsn from a given string.\n *\n * @param str A Dsn as string\n * @returns Dsn as DsnComponents or undefined if @param str is not a valid DSN string\n */\nexport function dsnFromString(str: string): DsnComponents | undefined {\n const match = DSN_REGEX.exec(str);\n\n if (!match) {\n // This should be logged to the console\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.error(`Invalid Sentry Dsn: ${str}`);\n });\n return undefined;\n }\n\n const [protocol, publicKey, pass = '', host, port = '', lastPath] = match.slice(1);\n let path = '';\n let projectId = lastPath;\n\n const split = projectId.split('/');\n if (split.length > 1) {\n path = split.slice(0, -1).join('/');\n projectId = split.pop() as string;\n }\n\n if (projectId) {\n const projectMatch = projectId.match(/^\\d+/);\n if (projectMatch) {\n projectId = projectMatch[0];\n }\n }\n\n return dsnFromComponents({ host, pass, path, projectId, port, protocol: protocol as DsnProtocol, publicKey });\n}\n\nfunction dsnFromComponents(components: DsnComponents): DsnComponents {\n return {\n protocol: components.protocol,\n publicKey: components.publicKey || '',\n pass: components.pass || '',\n host: components.host,\n port: components.port || '',\n path: components.path || '',\n projectId: components.projectId,\n };\n}\n\nfunction validateDsn(dsn: DsnComponents): boolean {\n if (!DEBUG_BUILD) {\n return true;\n }\n\n const { port, projectId, protocol } = dsn;\n\n const requiredComponents: ReadonlyArray = ['protocol', 'publicKey', 'host', 'projectId'];\n const hasMissingRequiredComponent = requiredComponents.find(component => {\n if (!dsn[component]) {\n logger.error(`Invalid Sentry Dsn: ${component} missing`);\n return true;\n }\n return false;\n });\n\n if (hasMissingRequiredComponent) {\n return false;\n }\n\n if (!projectId.match(/^\\d+$/)) {\n logger.error(`Invalid Sentry Dsn: Invalid projectId ${projectId}`);\n return false;\n }\n\n if (!isValidProtocol(protocol)) {\n logger.error(`Invalid Sentry Dsn: Invalid protocol ${protocol}`);\n return false;\n }\n\n if (port && isNaN(parseInt(port, 10))) {\n logger.error(`Invalid Sentry Dsn: Invalid port ${port}`);\n return false;\n }\n\n return true;\n}\n\n/**\n * Creates a valid Sentry Dsn object, identifying a Sentry instance and project.\n * @returns a valid DsnComponents object or `undefined` if @param from is an invalid DSN source\n */\nexport function makeDsn(from: DsnLike): DsnComponents | undefined {\n const components = typeof from === 'string' ? dsnFromString(from) : dsnFromComponents(from);\n if (!components || !validateDsn(components)) {\n return undefined;\n }\n return components;\n}\n", "import type { ConsoleLevel } from '@sentry/types';\n\n/** An error emitted by Sentry SDKs and related utilities. */\nexport class SentryError extends Error {\n /** Display name of this error instance. */\n public name: string;\n\n public logLevel: ConsoleLevel;\n\n public constructor(public message: string, logLevel: ConsoleLevel = 'warn') {\n super(message);\n\n this.name = new.target.prototype.constructor.name;\n // This sets the prototype to be `Error`, not `SentryError`. It's unclear why we do this, but commenting this line\n // out causes various (seemingly totally unrelated) playwright tests consistently time out. FYI, this makes\n // instances of `SentryError` fail `obj instanceof SentryError` checks.\n Object.setPrototypeOf(this, new.target.prototype);\n this.logLevel = logLevel;\n }\n}\n", "/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { WrappedFunction } from '@sentry/types';\n\nimport { htmlTreeAsString } from './browser';\nimport { DEBUG_BUILD } from './debug-build';\nimport { isElement, isError, isEvent, isInstanceOf, isPlainObject, isPrimitive } from './is';\nimport { logger } from './logger';\nimport { truncate } from './string';\n\n/**\n * Replace a method in an object with a wrapped version of itself.\n *\n * @param source An object that contains a method to be wrapped.\n * @param name The name of the method to be wrapped.\n * @param replacementFactory A higher-order function that takes the original version of the given method and returns a\n * wrapped version. Note: The function returned by `replacementFactory` needs to be a non-arrow function, in order to\n * preserve the correct value of `this`, and the original method must be called using `origMethod.call(this, )` or `origMethod.apply(this, [])` (rather than being called directly), again to preserve `this`.\n * @returns void\n */\nexport function fill(source: { [key: string]: any }, name: string, replacementFactory: (...args: any[]) => any): void {\n if (!(name in source)) {\n return;\n }\n\n const original = source[name] as () => any;\n const wrapped = replacementFactory(original) as WrappedFunction;\n\n // Make sure it's a function first, as we need to attach an empty prototype for `defineProperties` to work\n // otherwise it'll throw \"TypeError: Object.defineProperties called on non-object\"\n if (typeof wrapped === 'function') {\n markFunctionWrapped(wrapped, original);\n }\n\n source[name] = wrapped;\n}\n\n/**\n * Defines a non-enumerable property on the given object.\n *\n * @param obj The object on which to set the property\n * @param name The name of the property to be set\n * @param value The value to which to set the property\n */\nexport function addNonEnumerableProperty(obj: object, name: string, value: unknown): void {\n try {\n Object.defineProperty(obj, name, {\n // enumerable: false, // the default, so we can save on bundle size by not explicitly setting it\n value: value,\n writable: true,\n configurable: true,\n });\n } catch (o_O) {\n DEBUG_BUILD && logger.log(`Failed to add non-enumerable property \"${name}\" to object`, obj);\n }\n}\n\n/**\n * Remembers the original function on the wrapped function and\n * patches up the prototype.\n *\n * @param wrapped the wrapper function\n * @param original the original function that gets wrapped\n */\nexport function markFunctionWrapped(wrapped: WrappedFunction, original: WrappedFunction): void {\n try {\n const proto = original.prototype || {};\n wrapped.prototype = original.prototype = proto;\n addNonEnumerableProperty(wrapped, '__sentry_original__', original);\n } catch (o_O) {} // eslint-disable-line no-empty\n}\n\n/**\n * This extracts the original function if available. See\n * `markFunctionWrapped` for more information.\n *\n * @param func the function to unwrap\n * @returns the unwrapped version of the function if available.\n */\nexport function getOriginalFunction(func: WrappedFunction): WrappedFunction | undefined {\n return func.__sentry_original__;\n}\n\n/**\n * Encodes given object into url-friendly format\n *\n * @param object An object that contains serializable values\n * @returns string Encoded\n */\nexport function urlEncode(object: { [key: string]: any }): string {\n return Object.keys(object)\n .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(object[key])}`)\n .join('&');\n}\n\n/**\n * Transforms any `Error` or `Event` into a plain object with all of their enumerable properties, and some of their\n * non-enumerable properties attached.\n *\n * @param value Initial source that we have to transform in order for it to be usable by the serializer\n * @returns An Event or Error turned into an object - or the value argurment itself, when value is neither an Event nor\n * an Error.\n */\nexport function convertToPlainObject(\n value: V,\n):\n | {\n [ownProps: string]: unknown;\n type: string;\n target: string;\n currentTarget: string;\n detail?: unknown;\n }\n | {\n [ownProps: string]: unknown;\n message: string;\n name: string;\n stack?: string;\n }\n | V {\n if (isError(value)) {\n return {\n message: value.message,\n name: value.name,\n stack: value.stack,\n ...getOwnProperties(value),\n };\n } else if (isEvent(value)) {\n const newObj: {\n [ownProps: string]: unknown;\n type: string;\n target: string;\n currentTarget: string;\n detail?: unknown;\n } = {\n type: value.type,\n target: serializeEventTarget(value.target),\n currentTarget: serializeEventTarget(value.currentTarget),\n ...getOwnProperties(value),\n };\n\n if (typeof CustomEvent !== 'undefined' && isInstanceOf(value, CustomEvent)) {\n newObj.detail = value.detail;\n }\n\n return newObj;\n } else {\n return value;\n }\n}\n\n/** Creates a string representation of the target of an `Event` object */\nfunction serializeEventTarget(target: unknown): string {\n try {\n return isElement(target) ? htmlTreeAsString(target) : Object.prototype.toString.call(target);\n } catch (_oO) {\n return '';\n }\n}\n\n/** Filters out all but an object's own properties */\nfunction getOwnProperties(obj: unknown): { [key: string]: unknown } {\n if (typeof obj === 'object' && obj !== null) {\n const extractedProps: { [key: string]: unknown } = {};\n for (const property in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, property)) {\n extractedProps[property] = (obj as Record)[property];\n }\n }\n return extractedProps;\n } else {\n return {};\n }\n}\n\n/**\n * Given any captured exception, extract its keys and create a sorted\n * and truncated list that will be used inside the event message.\n * eg. `Non-error exception captured with keys: foo, bar, baz`\n */\nexport function extractExceptionKeysForMessage(exception: Record, maxLength: number = 40): string {\n const keys = Object.keys(convertToPlainObject(exception));\n keys.sort();\n\n if (!keys.length) {\n return '[object has no keys]';\n }\n\n if (keys[0].length >= maxLength) {\n return truncate(keys[0], maxLength);\n }\n\n for (let includedKeys = keys.length; includedKeys > 0; includedKeys--) {\n const serialized = keys.slice(0, includedKeys).join(', ');\n if (serialized.length > maxLength) {\n continue;\n }\n if (includedKeys === keys.length) {\n return serialized;\n }\n return truncate(serialized, maxLength);\n }\n\n return '';\n}\n\n/**\n * Given any object, return a new object having removed all fields whose value was `undefined`.\n * Works recursively on objects and arrays.\n *\n * Attention: This function keeps circular references in the returned object.\n */\nexport function dropUndefinedKeys(inputValue: T): T {\n // This map keeps track of what already visited nodes map to.\n // Our Set - based memoBuilder doesn't work here because we want to the output object to have the same circular\n // references as the input object.\n const memoizationMap = new Map();\n\n // This function just proxies `_dropUndefinedKeys` to keep the `memoBuilder` out of this function's API\n return _dropUndefinedKeys(inputValue, memoizationMap);\n}\n\nfunction _dropUndefinedKeys(inputValue: T, memoizationMap: Map): T {\n if (isPojo(inputValue)) {\n // If this node has already been visited due to a circular reference, return the object it was mapped to in the new object\n const memoVal = memoizationMap.get(inputValue);\n if (memoVal !== undefined) {\n return memoVal as T;\n }\n\n const returnValue: { [key: string]: any } = {};\n // Store the mapping of this value in case we visit it again, in case of circular data\n memoizationMap.set(inputValue, returnValue);\n\n for (const key of Object.keys(inputValue)) {\n if (typeof inputValue[key] !== 'undefined') {\n returnValue[key] = _dropUndefinedKeys(inputValue[key], memoizationMap);\n }\n }\n\n return returnValue as T;\n }\n\n if (Array.isArray(inputValue)) {\n // If this node has already been visited due to a circular reference, return the array it was mapped to in the new object\n const memoVal = memoizationMap.get(inputValue);\n if (memoVal !== undefined) {\n return memoVal as T;\n }\n\n const returnValue: unknown[] = [];\n // Store the mapping of this value in case we visit it again, in case of circular data\n memoizationMap.set(inputValue, returnValue);\n\n inputValue.forEach((item: unknown) => {\n returnValue.push(_dropUndefinedKeys(item, memoizationMap));\n });\n\n return returnValue as unknown as T;\n }\n\n return inputValue;\n}\n\nfunction isPojo(input: unknown): input is Record {\n if (!isPlainObject(input)) {\n return false;\n }\n\n try {\n const name = (Object.getPrototypeOf(input) as { constructor: { name: string } }).constructor.name;\n return !name || name === 'Object';\n } catch {\n return true;\n }\n}\n\n/**\n * Ensure that something is an object.\n *\n * Turns `undefined` and `null` into `String`s and all other primitives into instances of their respective wrapper\n * classes (String, Boolean, Number, etc.). Acts as the identity function on non-primitives.\n *\n * @param wat The subject of the objectification\n * @returns A version of `wat` which can safely be used with `Object` class methods\n */\nexport function objectify(wat: unknown): typeof Object {\n let objectified;\n switch (true) {\n case wat === undefined || wat === null:\n objectified = new String(wat);\n break;\n\n // Though symbols and bigints do have wrapper classes (`Symbol` and `BigInt`, respectively), for whatever reason\n // those classes don't have constructors which can be used with the `new` keyword. We therefore need to cast each as\n // an object in order to wrap it.\n case typeof wat === 'symbol' || typeof wat === 'bigint':\n objectified = Object(wat);\n break;\n\n // this will catch the remaining primitives: `String`, `Number`, and `Boolean`\n case isPrimitive(wat):\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n objectified = new (wat as any).constructor(wat);\n break;\n\n // by process of elimination, at this point we know that `wat` must already be an object\n default:\n objectified = wat;\n break;\n }\n return objectified;\n}\n", "// This code was originally forked from https://github.com/felixge/node-stack-trace\n// Since then it has been highly modified to fit our needs.\n\n// Copyright (c) 2011 Felix Geisendörfer (felix@debuggable.com)//\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions://\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.//\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport type { StackLineParserFn } from '@sentry/types';\n\nexport type GetModuleFn = (filename: string | undefined) => string | undefined;\n\n/**\n * Does this filename look like it's part of the app code?\n */\nexport function filenameIsInApp(filename: string, isNative: boolean = false): boolean {\n const isInternal =\n isNative ||\n (filename &&\n // It's not internal if it's an absolute linux path\n !filename.startsWith('/') &&\n // It's not internal if it's an absolute windows path\n !filename.match(/^[A-Z]:/) &&\n // It's not internal if the path is starting with a dot\n !filename.startsWith('.') &&\n // It's not internal if the frame has a protocol. In node, this is usually the case if the file got pre-processed with a bundler like webpack\n !filename.match(/^[a-zA-Z]([a-zA-Z0-9.\\-+])*:\\/\\//)); // Schema from: https://stackoverflow.com/a/3641782\n\n // in_app is all that's not an internal Node function or a module within node_modules\n // note that isNative appears to return true even for node core libraries\n // see https://github.com/getsentry/raven-node/issues/176\n\n return !isInternal && filename !== undefined && !filename.includes('node_modules/');\n}\n\n/** Node Stack line parser */\n// eslint-disable-next-line complexity\nexport function node(getModule?: GetModuleFn): StackLineParserFn {\n const FILENAME_MATCH = /^\\s*[-]{4,}$/;\n const FULL_MATCH = /at (?:async )?(?:(.+?)\\s+\\()?(?:(.+):(\\d+):(\\d+)?|([^)]+))\\)?/;\n\n // eslint-disable-next-line complexity\n return (line: string) => {\n const lineMatch = line.match(FULL_MATCH);\n\n if (lineMatch) {\n let object: string | undefined;\n let method: string | undefined;\n let functionName: string | undefined;\n let typeName: string | undefined;\n let methodName: string | undefined;\n\n if (lineMatch[1]) {\n functionName = lineMatch[1];\n\n let methodStart = functionName.lastIndexOf('.');\n if (functionName[methodStart - 1] === '.') {\n methodStart--;\n }\n\n if (methodStart > 0) {\n object = functionName.slice(0, methodStart);\n method = functionName.slice(methodStart + 1);\n const objectEnd = object.indexOf('.Module');\n if (objectEnd > 0) {\n functionName = functionName.slice(objectEnd + 1);\n object = object.slice(0, objectEnd);\n }\n }\n typeName = undefined;\n }\n\n if (method) {\n typeName = object;\n methodName = method;\n }\n\n if (method === '') {\n methodName = undefined;\n functionName = undefined;\n }\n\n if (functionName === undefined) {\n methodName = methodName || '';\n functionName = typeName ? `${typeName}.${methodName}` : methodName;\n }\n\n let filename = lineMatch[2] && lineMatch[2].startsWith('file://') ? lineMatch[2].slice(7) : lineMatch[2];\n const isNative = lineMatch[5] === 'native';\n\n // If it's a Windows path, trim the leading slash so that `/C:/foo` becomes `C:/foo`\n if (filename && filename.match(/\\/[A-Z]:/)) {\n filename = filename.slice(1);\n }\n\n if (!filename && lineMatch[5] && !isNative) {\n filename = lineMatch[5];\n }\n\n return {\n filename,\n module: getModule ? getModule(filename) : undefined,\n function: functionName,\n lineno: parseInt(lineMatch[3], 10) || undefined,\n colno: parseInt(lineMatch[4], 10) || undefined,\n in_app: filenameIsInApp(filename, isNative),\n };\n }\n\n if (line.match(FILENAME_MATCH)) {\n return {\n filename: line,\n };\n }\n\n return undefined;\n };\n}\n", "import type { StackFrame, StackLineParser, StackParser } from '@sentry/types';\n\nimport type { GetModuleFn } from './node-stack-trace';\nimport { filenameIsInApp, node } from './node-stack-trace';\n\nexport { filenameIsInApp };\n\nconst STACKTRACE_FRAME_LIMIT = 50;\n// Used to sanitize webpack (error: *) wrapped stack errors\nconst WEBPACK_ERROR_REGEXP = /\\(error: (.*)\\)/;\nconst STRIP_FRAME_REGEXP = /captureMessage|captureException/;\n\n/**\n * Creates a stack parser with the supplied line parsers\n *\n * StackFrames are returned in the correct order for Sentry Exception\n * frames and with Sentry SDK internal frames removed from the top and bottom\n *\n */\nexport function createStackParser(...parsers: StackLineParser[]): StackParser {\n const sortedParsers = parsers.sort((a, b) => a[0] - b[0]).map(p => p[1]);\n\n return (stack: string, skipFirst: number = 0): StackFrame[] => {\n const frames: StackFrame[] = [];\n const lines = stack.split('\\n');\n\n for (let i = skipFirst; i < lines.length; i++) {\n const line = lines[i];\n // Ignore lines over 1kb as they are unlikely to be stack frames.\n // Many of the regular expressions use backtracking which results in run time that increases exponentially with\n // input size. Huge strings can result in hangs/Denial of Service:\n // https://github.com/getsentry/sentry-javascript/issues/2286\n if (line.length > 1024) {\n continue;\n }\n\n // https://github.com/getsentry/sentry-javascript/issues/5459\n // Remove webpack (error: *) wrappers\n const cleanedLine = WEBPACK_ERROR_REGEXP.test(line) ? line.replace(WEBPACK_ERROR_REGEXP, '$1') : line;\n\n // https://github.com/getsentry/sentry-javascript/issues/7813\n // Skip Error: lines\n if (cleanedLine.match(/\\S*Error: /)) {\n continue;\n }\n\n for (const parser of sortedParsers) {\n const frame = parser(cleanedLine);\n\n if (frame) {\n frames.push(frame);\n break;\n }\n }\n\n if (frames.length >= STACKTRACE_FRAME_LIMIT) {\n break;\n }\n }\n\n return stripSentryFramesAndReverse(frames);\n };\n}\n\n/**\n * Gets a stack parser implementation from Options.stackParser\n * @see Options\n *\n * If options contains an array of line parsers, it is converted into a parser\n */\nexport function stackParserFromStackParserOptions(stackParser: StackParser | StackLineParser[]): StackParser {\n if (Array.isArray(stackParser)) {\n return createStackParser(...stackParser);\n }\n return stackParser;\n}\n\n/**\n * Removes Sentry frames from the top and bottom of the stack if present and enforces a limit of max number of frames.\n * Assumes stack input is ordered from top to bottom and returns the reverse representation so call site of the\n * function that caused the crash is the last frame in the array.\n * @hidden\n */\nexport function stripSentryFramesAndReverse(stack: ReadonlyArray): StackFrame[] {\n if (!stack.length) {\n return [];\n }\n\n const localStack = Array.from(stack);\n\n // If stack starts with one of our API calls, remove it (starts, meaning it's the top of the stack - aka last call)\n if (/sentryWrapped/.test(localStack[localStack.length - 1].function || '')) {\n localStack.pop();\n }\n\n // Reversing in the middle of the procedure allows us to just pop the values off the stack\n localStack.reverse();\n\n // If stack ends with one of our internal API calls, remove it (ends, meaning it's the bottom of the stack - aka top-most call)\n if (STRIP_FRAME_REGEXP.test(localStack[localStack.length - 1].function || '')) {\n localStack.pop();\n\n // When using synthetic events, we will have a 2 levels deep stack, as `new Error('Sentry syntheticException')`\n // is produced within the hub itself, making it:\n //\n // Sentry.captureException()\n // getCurrentHub().captureException()\n //\n // instead of just the top `Sentry` call itself.\n // This forces us to possibly strip an additional frame in the exact same was as above.\n if (STRIP_FRAME_REGEXP.test(localStack[localStack.length - 1].function || '')) {\n localStack.pop();\n }\n }\n\n return localStack.slice(0, STACKTRACE_FRAME_LIMIT).map(frame => ({\n ...frame,\n filename: frame.filename || localStack[localStack.length - 1].filename,\n function: frame.function || '?',\n }));\n}\n\nconst defaultFunctionName = '';\n\n/**\n * Safely extract function name from itself\n */\nexport function getFunctionName(fn: unknown): string {\n try {\n if (!fn || typeof fn !== 'function') {\n return defaultFunctionName;\n }\n return fn.name || defaultFunctionName;\n } catch (e) {\n // Just accessing custom props in some Selenium environments\n // can cause a \"Permission denied\" exception (see raven-js#495).\n return defaultFunctionName;\n }\n}\n\n/**\n * Node.js stack line parser\n *\n * This is in @sentry/utils so it can be used from the Electron SDK in the browser for when `nodeIntegration == true`.\n * This allows it to be used without referencing or importing any node specific code which causes bundlers to complain\n */\nexport function nodeStackLineParser(getModule?: GetModuleFn): StackLineParser {\n return [90, node(getModule)];\n}\n", "import { DEBUG_BUILD } from '../debug-build';\nimport { logger } from '../logger';\nimport { getFunctionName } from '../stacktrace';\n\nexport type InstrumentHandlerType = 'console' | 'dom' | 'fetch' | 'history' | 'xhr' | 'error' | 'unhandledrejection';\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type InstrumentHandlerCallback = (data: any) => void;\n\n// We keep the handlers globally\nconst handlers: { [key in InstrumentHandlerType]?: InstrumentHandlerCallback[] } = {};\nconst instrumented: { [key in InstrumentHandlerType]?: boolean } = {};\n\n/** Add a handler function. */\nexport function addHandler(type: InstrumentHandlerType, handler: InstrumentHandlerCallback): void {\n handlers[type] = handlers[type] || [];\n (handlers[type] as InstrumentHandlerCallback[]).push(handler);\n}\n\n/**\n * Reset all instrumentation handlers.\n * This can be used by tests to ensure we have a clean slate of instrumentation handlers.\n */\nexport function resetInstrumentationHandlers(): void {\n Object.keys(handlers).forEach(key => {\n handlers[key as InstrumentHandlerType] = undefined;\n });\n}\n\n/** Maybe run an instrumentation function, unless it was already called. */\nexport function maybeInstrument(type: InstrumentHandlerType, instrumentFn: () => void): void {\n if (!instrumented[type]) {\n instrumentFn();\n instrumented[type] = true;\n }\n}\n\n/** Trigger handlers for a given instrumentation type. */\nexport function triggerHandlers(type: InstrumentHandlerType, data: unknown): void {\n const typeHandlers = type && handlers[type];\n if (!typeHandlers) {\n return;\n }\n\n for (const handler of typeHandlers) {\n try {\n handler(data);\n } catch (e) {\n DEBUG_BUILD &&\n logger.error(\n `Error while triggering instrumentation handler.\\nType: ${type}\\nName: ${getFunctionName(handler)}\\nError:`,\n e,\n );\n }\n }\n}\n", "/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { ConsoleLevel, HandlerDataConsole } from '@sentry/types';\n\nimport { CONSOLE_LEVELS, originalConsoleMethods } from '../logger';\nimport { fill } from '../object';\nimport { GLOBAL_OBJ } from '../worldwide';\nimport { addHandler, maybeInstrument, triggerHandlers } from './_handlers';\n\n/**\n * Add an instrumentation handler for when a console.xxx method is called.\n *\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nexport function addConsoleInstrumentationHandler(handler: (data: HandlerDataConsole) => void): void {\n const type = 'console';\n addHandler(type, handler);\n maybeInstrument(type, instrumentConsole);\n}\n\nfunction instrumentConsole(): void {\n if (!('console' in GLOBAL_OBJ)) {\n return;\n }\n\n CONSOLE_LEVELS.forEach(function (level: ConsoleLevel): void {\n if (!(level in GLOBAL_OBJ.console)) {\n return;\n }\n\n fill(GLOBAL_OBJ.console, level, function (originalConsoleMethod: () => any): Function {\n originalConsoleMethods[level] = originalConsoleMethod;\n\n return function (...args: any[]): void {\n const handlerData: HandlerDataConsole = { args, level };\n triggerHandlers('console', handlerData);\n\n const log = originalConsoleMethods[level];\n log && log.apply(GLOBAL_OBJ.console, args);\n };\n });\n });\n}\n", "/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { Event, Exception, Mechanism, StackFrame } from '@sentry/types';\n\nimport { addNonEnumerableProperty } from './object';\nimport { snipLine } from './string';\nimport { GLOBAL_OBJ } from './worldwide';\n\ninterface CryptoInternal {\n getRandomValues(array: Uint8Array): Uint8Array;\n randomUUID?(): string;\n}\n\n/** An interface for common properties on global */\ninterface CryptoGlobal {\n msCrypto?: CryptoInternal;\n crypto?: CryptoInternal;\n}\n\n/**\n * UUID4 generator\n *\n * @returns string Generated UUID4.\n */\nexport function uuid4(): string {\n const gbl = GLOBAL_OBJ as typeof GLOBAL_OBJ & CryptoGlobal;\n const crypto = gbl.crypto || gbl.msCrypto;\n\n let getRandomByte = (): number => Math.random() * 16;\n try {\n if (crypto && crypto.randomUUID) {\n return crypto.randomUUID().replace(/-/g, '');\n }\n if (crypto && crypto.getRandomValues) {\n getRandomByte = () => {\n // crypto.getRandomValues might return undefined instead of the typed array\n // in old Chromium versions (e.g. 23.0.1235.0 (151422))\n // However, `typedArray` is still filled in-place.\n // @see https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues#typedarray\n const typedArray = new Uint8Array(1);\n crypto.getRandomValues(typedArray);\n return typedArray[0];\n };\n }\n } catch (_) {\n // some runtimes can crash invoking crypto\n // https://github.com/getsentry/sentry-javascript/issues/8935\n }\n\n // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523\n // Concatenating the following numbers as strings results in '10000000100040008000100000000000'\n return (([1e7] as unknown as string) + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, c =>\n // eslint-disable-next-line no-bitwise\n ((c as unknown as number) ^ ((getRandomByte() & 15) >> ((c as unknown as number) / 4))).toString(16),\n );\n}\n\nfunction getFirstException(event: Event): Exception | undefined {\n return event.exception && event.exception.values ? event.exception.values[0] : undefined;\n}\n\n/**\n * Extracts either message or type+value from an event that can be used for user-facing logs\n * @returns event's description\n */\nexport function getEventDescription(event: Event): string {\n const { message, event_id: eventId } = event;\n if (message) {\n return message;\n }\n\n const firstException = getFirstException(event);\n if (firstException) {\n if (firstException.type && firstException.value) {\n return `${firstException.type}: ${firstException.value}`;\n }\n return firstException.type || firstException.value || eventId || '';\n }\n return eventId || '';\n}\n\n/**\n * Adds exception values, type and value to an synthetic Exception.\n * @param event The event to modify.\n * @param value Value of the exception.\n * @param type Type of the exception.\n * @hidden\n */\nexport function addExceptionTypeValue(event: Event, value?: string, type?: string): void {\n const exception = (event.exception = event.exception || {});\n const values = (exception.values = exception.values || []);\n const firstException = (values[0] = values[0] || {});\n if (!firstException.value) {\n firstException.value = value || '';\n }\n if (!firstException.type) {\n firstException.type = type || 'Error';\n }\n}\n\n/**\n * Adds exception mechanism data to a given event. Uses defaults if the second parameter is not passed.\n *\n * @param event The event to modify.\n * @param newMechanism Mechanism data to add to the event.\n * @hidden\n */\nexport function addExceptionMechanism(event: Event, newMechanism?: Partial): void {\n const firstException = getFirstException(event);\n if (!firstException) {\n return;\n }\n\n const defaultMechanism = { type: 'generic', handled: true };\n const currentMechanism = firstException.mechanism;\n firstException.mechanism = { ...defaultMechanism, ...currentMechanism, ...newMechanism };\n\n if (newMechanism && 'data' in newMechanism) {\n const mergedData = { ...(currentMechanism && currentMechanism.data), ...newMechanism.data };\n firstException.mechanism.data = mergedData;\n }\n}\n\n// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string\nconst SEMVER_REGEXP =\n /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$/;\n\n/**\n * Represents Semantic Versioning object\n */\ninterface SemVer {\n major?: number;\n minor?: number;\n patch?: number;\n prerelease?: string;\n buildmetadata?: string;\n}\n\n/**\n * Parses input into a SemVer interface\n * @param input string representation of a semver version\n */\nexport function parseSemver(input: string): SemVer {\n const match = input.match(SEMVER_REGEXP) || [];\n const major = parseInt(match[1], 10);\n const minor = parseInt(match[2], 10);\n const patch = parseInt(match[3], 10);\n return {\n buildmetadata: match[5],\n major: isNaN(major) ? undefined : major,\n minor: isNaN(minor) ? undefined : minor,\n patch: isNaN(patch) ? undefined : patch,\n prerelease: match[4],\n };\n}\n\n/**\n * This function adds context (pre/post/line) lines to the provided frame\n *\n * @param lines string[] containing all lines\n * @param frame StackFrame that will be mutated\n * @param linesOfContext number of context lines we want to add pre/post\n */\nexport function addContextToFrame(lines: string[], frame: StackFrame, linesOfContext: number = 5): void {\n // When there is no line number in the frame, attaching context is nonsensical and will even break grouping\n if (frame.lineno === undefined) {\n return;\n }\n\n const maxLines = lines.length;\n const sourceLine = Math.max(Math.min(maxLines - 1, frame.lineno - 1), 0);\n\n frame.pre_context = lines\n .slice(Math.max(0, sourceLine - linesOfContext), sourceLine)\n .map((line: string) => snipLine(line, 0));\n\n frame.context_line = snipLine(lines[Math.min(maxLines - 1, sourceLine)], frame.colno || 0);\n\n frame.post_context = lines\n .slice(Math.min(sourceLine + 1, maxLines), sourceLine + 1 + linesOfContext)\n .map((line: string) => snipLine(line, 0));\n}\n\n/**\n * Checks whether or not we've already captured the given exception (note: not an identical exception - the very object\n * in question), and marks it captured if not.\n *\n * This is useful because it's possible for an error to get captured by more than one mechanism. After we intercept and\n * record an error, we rethrow it (assuming we've intercepted it before it's reached the top-level global handlers), so\n * that we don't interfere with whatever effects the error might have had were the SDK not there. At that point, because\n * the error has been rethrown, it's possible for it to bubble up to some other code we've instrumented. If it's not\n * caught after that, it will bubble all the way up to the global handlers (which of course we also instrument). This\n * function helps us ensure that even if we encounter the same error more than once, we only record it the first time we\n * see it.\n *\n * Note: It will ignore primitives (always return `false` and not mark them as seen), as properties can't be set on\n * them. {@link: Object.objectify} can be used on exceptions to convert any that are primitives into their equivalent\n * object wrapper forms so that this check will always work. However, because we need to flag the exact object which\n * will get rethrown, and because that rethrowing happens outside of the event processing pipeline, the objectification\n * must be done before the exception captured.\n *\n * @param A thrown exception to check or flag as having been seen\n * @returns `true` if the exception has already been captured, `false` if not (with the side effect of marking it seen)\n */\nexport function checkOrSetAlreadyCaught(exception: unknown): boolean {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (exception && (exception as any).__sentry_captured__) {\n return true;\n }\n\n try {\n // set it this way rather than by assignment so that it's not ennumerable and therefore isn't recorded by the\n // `ExtraErrorData` integration\n addNonEnumerableProperty(exception as { [key: string]: unknown }, '__sentry_captured__', true);\n } catch (err) {\n // `exception` is a primitive, so we can't mark it seen\n }\n\n return false;\n}\n\n/**\n * Checks whether the given input is already an array, and if it isn't, wraps it in one.\n *\n * @param maybeArray Input to turn into an array, if necessary\n * @returns The input, if already an array, or an array with the input as the only element, if not\n */\nexport function arrayify(maybeArray: T | T[]): T[] {\n return Array.isArray(maybeArray) ? maybeArray : [maybeArray];\n}\n", "// TODO(v8): Move everything in this file into the browser package. Nothing here is generic and we run risk of leaking browser types into non-browser packages.\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { HandlerDataDom } from '@sentry/types';\n\nimport { uuid4 } from '../misc';\nimport { addNonEnumerableProperty, fill } from '../object';\nimport { GLOBAL_OBJ } from '../worldwide';\nimport { addHandler, maybeInstrument, triggerHandlers } from './_handlers';\n\ntype SentryWrappedTarget = HTMLElement & { _sentryId?: string };\n\ntype AddEventListener = (\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n) => void;\ntype RemoveEventListener = (\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n) => void;\n\ntype InstrumentedElement = Element & {\n __sentry_instrumentation_handlers__?: {\n [key in 'click' | 'keypress']?: {\n handler?: Function;\n /** The number of custom listeners attached to this element */\n refCount: number;\n };\n };\n};\n\nconst WINDOW = GLOBAL_OBJ as unknown as Window;\nconst DEBOUNCE_DURATION = 1000;\n\nlet debounceTimerID: number | undefined;\nlet lastCapturedEventType: string | undefined;\nlet lastCapturedEventTargetId: string | undefined;\n\n/**\n * Add an instrumentation handler for when a click or a keypress happens.\n *\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nexport function addClickKeypressInstrumentationHandler(handler: (data: HandlerDataDom) => void): void {\n const type = 'dom';\n addHandler(type, handler);\n maybeInstrument(type, instrumentDOM);\n}\n\n/** Exported for tests only. */\nexport function instrumentDOM(): void {\n if (!WINDOW.document) {\n return;\n }\n\n // Make it so that any click or keypress that is unhandled / bubbled up all the way to the document triggers our dom\n // handlers. (Normally we have only one, which captures a breadcrumb for each click or keypress.) Do this before\n // we instrument `addEventListener` so that we don't end up attaching this handler twice.\n const triggerDOMHandler = triggerHandlers.bind(null, 'dom');\n const globalDOMEventHandler = makeDOMEventHandler(triggerDOMHandler, true);\n WINDOW.document.addEventListener('click', globalDOMEventHandler, false);\n WINDOW.document.addEventListener('keypress', globalDOMEventHandler, false);\n\n // After hooking into click and keypress events bubbled up to `document`, we also hook into user-handled\n // clicks & keypresses, by adding an event listener of our own to any element to which they add a listener. That\n // way, whenever one of their handlers is triggered, ours will be, too. (This is needed because their handler\n // could potentially prevent the event from bubbling up to our global listeners. This way, our handler are still\n // guaranteed to fire at least once.)\n ['EventTarget', 'Node'].forEach((target: string) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const proto = (WINDOW as any)[target] && (WINDOW as any)[target].prototype;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, no-prototype-builtins\n if (!proto || !proto.hasOwnProperty || !proto.hasOwnProperty('addEventListener')) {\n return;\n }\n\n fill(proto, 'addEventListener', function (originalAddEventListener: AddEventListener): AddEventListener {\n return function (\n this: Element,\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ): AddEventListener {\n if (type === 'click' || type == 'keypress') {\n try {\n const el = this as InstrumentedElement;\n const handlers = (el.__sentry_instrumentation_handlers__ = el.__sentry_instrumentation_handlers__ || {});\n const handlerForType = (handlers[type] = handlers[type] || { refCount: 0 });\n\n if (!handlerForType.handler) {\n const handler = makeDOMEventHandler(triggerDOMHandler);\n handlerForType.handler = handler;\n originalAddEventListener.call(this, type, handler, options);\n }\n\n handlerForType.refCount++;\n } catch (e) {\n // Accessing dom properties is always fragile.\n // Also allows us to skip `addEventListenrs` calls with no proper `this` context.\n }\n }\n\n return originalAddEventListener.call(this, type, listener, options);\n };\n });\n\n fill(\n proto,\n 'removeEventListener',\n function (originalRemoveEventListener: RemoveEventListener): RemoveEventListener {\n return function (\n this: Element,\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ): () => void {\n if (type === 'click' || type == 'keypress') {\n try {\n const el = this as InstrumentedElement;\n const handlers = el.__sentry_instrumentation_handlers__ || {};\n const handlerForType = handlers[type];\n\n if (handlerForType) {\n handlerForType.refCount--;\n // If there are no longer any custom handlers of the current type on this element, we can remove ours, too.\n if (handlerForType.refCount <= 0) {\n originalRemoveEventListener.call(this, type, handlerForType.handler, options);\n handlerForType.handler = undefined;\n delete handlers[type]; // eslint-disable-line @typescript-eslint/no-dynamic-delete\n }\n\n // If there are no longer any custom handlers of any type on this element, cleanup everything.\n if (Object.keys(handlers).length === 0) {\n delete el.__sentry_instrumentation_handlers__;\n }\n }\n } catch (e) {\n // Accessing dom properties is always fragile.\n // Also allows us to skip `addEventListenrs` calls with no proper `this` context.\n }\n }\n\n return originalRemoveEventListener.call(this, type, listener, options);\n };\n },\n );\n });\n}\n\n/**\n * Check whether the event is similar to the last captured one. For example, two click events on the same button.\n */\nfunction isSimilarToLastCapturedEvent(event: Event): boolean {\n // If both events have different type, then user definitely performed two separate actions. e.g. click + keypress.\n if (event.type !== lastCapturedEventType) {\n return false;\n }\n\n try {\n // If both events have the same type, it's still possible that actions were performed on different targets.\n // e.g. 2 clicks on different buttons.\n if (!event.target || (event.target as SentryWrappedTarget)._sentryId !== lastCapturedEventTargetId) {\n return false;\n }\n } catch (e) {\n // just accessing `target` property can throw an exception in some rare circumstances\n // see: https://github.com/getsentry/sentry-javascript/issues/838\n }\n\n // If both events have the same type _and_ same `target` (an element which triggered an event, _not necessarily_\n // to which an event listener was attached), we treat them as the same action, as we want to capture\n // only one breadcrumb. e.g. multiple clicks on the same button, or typing inside a user input box.\n return true;\n}\n\n/**\n * Decide whether an event should be captured.\n * @param event event to be captured\n */\nfunction shouldSkipDOMEvent(eventType: string, target: SentryWrappedTarget | null): boolean {\n // We are only interested in filtering `keypress` events for now.\n if (eventType !== 'keypress') {\n return false;\n }\n\n if (!target || !target.tagName) {\n return true;\n }\n\n // Only consider keypress events on actual input elements. This will disregard keypresses targeting body\n // e.g.tabbing through elements, hotkeys, etc.\n if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.isContentEditable) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Wraps addEventListener to capture UI breadcrumbs\n */\nfunction makeDOMEventHandler(\n handler: (data: HandlerDataDom) => void,\n globalListener: boolean = false,\n): (event: Event) => void {\n return (event: Event & { _sentryCaptured?: true }): void => {\n // It's possible this handler might trigger multiple times for the same\n // event (e.g. event propagation through node ancestors).\n // Ignore if we've already captured that event.\n if (!event || event['_sentryCaptured']) {\n return;\n }\n\n const target = getEventTarget(event);\n\n // We always want to skip _some_ events.\n if (shouldSkipDOMEvent(event.type, target)) {\n return;\n }\n\n // Mark event as \"seen\"\n addNonEnumerableProperty(event, '_sentryCaptured', true);\n\n if (target && !target._sentryId) {\n // Add UUID to event target so we can identify if\n addNonEnumerableProperty(target, '_sentryId', uuid4());\n }\n\n const name = event.type === 'keypress' ? 'input' : event.type;\n\n // If there is no last captured event, it means that we can safely capture the new event and store it for future comparisons.\n // If there is a last captured event, see if the new event is different enough to treat it as a unique one.\n // If that's the case, emit the previous event and store locally the newly-captured DOM event.\n if (!isSimilarToLastCapturedEvent(event)) {\n const handlerData: HandlerDataDom = { event, name, global: globalListener };\n handler(handlerData);\n lastCapturedEventType = event.type;\n lastCapturedEventTargetId = target ? target._sentryId : undefined;\n }\n\n // Start a new debounce timer that will prevent us from capturing multiple events that should be grouped together.\n clearTimeout(debounceTimerID);\n debounceTimerID = WINDOW.setTimeout(() => {\n lastCapturedEventTargetId = undefined;\n lastCapturedEventType = undefined;\n }, DEBOUNCE_DURATION);\n };\n}\n\nfunction getEventTarget(event: Event): SentryWrappedTarget | null {\n try {\n return event.target as SentryWrappedTarget | null;\n } catch (e) {\n // just accessing `target` property can throw an exception in some rare circumstances\n // see: https://github.com/getsentry/sentry-javascript/issues/838\n return null;\n }\n}\n", "import { DEBUG_BUILD } from './debug-build';\nimport { logger } from './logger';\nimport { getGlobalObject } from './worldwide';\n\n// eslint-disable-next-line deprecation/deprecation\nconst WINDOW = getGlobalObject();\n\ndeclare const EdgeRuntime: string | undefined;\n\nexport { supportsHistory } from './vendor/supportsHistory';\n\n/**\n * Tells whether current environment supports ErrorEvent objects\n * {@link supportsErrorEvent}.\n *\n * @returns Answer to the given question.\n */\nexport function supportsErrorEvent(): boolean {\n try {\n new ErrorEvent('');\n return true;\n } catch (e) {\n return false;\n }\n}\n\n/**\n * Tells whether current environment supports DOMError objects\n * {@link supportsDOMError}.\n *\n * @returns Answer to the given question.\n */\nexport function supportsDOMError(): boolean {\n try {\n // Chrome: VM89:1 Uncaught TypeError: Failed to construct 'DOMError':\n // 1 argument required, but only 0 present.\n // @ts-expect-error It really needs 1 argument, not 0.\n new DOMError('');\n return true;\n } catch (e) {\n return false;\n }\n}\n\n/**\n * Tells whether current environment supports DOMException objects\n * {@link supportsDOMException}.\n *\n * @returns Answer to the given question.\n */\nexport function supportsDOMException(): boolean {\n try {\n new DOMException('');\n return true;\n } catch (e) {\n return false;\n }\n}\n\n/**\n * Tells whether current environment supports Fetch API\n * {@link supportsFetch}.\n *\n * @returns Answer to the given question.\n */\nexport function supportsFetch(): boolean {\n if (!('fetch' in WINDOW)) {\n return false;\n }\n\n try {\n new Headers();\n new Request('http://www.example.com');\n new Response();\n return true;\n } catch (e) {\n return false;\n }\n}\n/**\n * isNativeFetch checks if the given function is a native implementation of fetch()\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function isNativeFetch(func: Function): boolean {\n return func && /^function fetch\\(\\)\\s+\\{\\s+\\[native code\\]\\s+\\}$/.test(func.toString());\n}\n\n/**\n * Tells whether current environment supports Fetch API natively\n * {@link supportsNativeFetch}.\n *\n * @returns true if `window.fetch` is natively implemented, false otherwise\n */\nexport function supportsNativeFetch(): boolean {\n if (typeof EdgeRuntime === 'string') {\n return true;\n }\n\n if (!supportsFetch()) {\n return false;\n }\n\n // Fast path to avoid DOM I/O\n // eslint-disable-next-line @typescript-eslint/unbound-method\n if (isNativeFetch(WINDOW.fetch)) {\n return true;\n }\n\n // window.fetch is implemented, but is polyfilled or already wrapped (e.g: by a chrome extension)\n // so create a \"pure\" iframe to see if that has native fetch\n let result = false;\n const doc = WINDOW.document;\n // eslint-disable-next-line deprecation/deprecation\n if (doc && typeof (doc.createElement as unknown) === 'function') {\n try {\n const sandbox = doc.createElement('iframe');\n sandbox.hidden = true;\n doc.head.appendChild(sandbox);\n if (sandbox.contentWindow && sandbox.contentWindow.fetch) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n result = isNativeFetch(sandbox.contentWindow.fetch);\n }\n doc.head.removeChild(sandbox);\n } catch (err) {\n DEBUG_BUILD &&\n logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', err);\n }\n }\n\n return result;\n}\n\n/**\n * Tells whether current environment supports ReportingObserver API\n * {@link supportsReportingObserver}.\n *\n * @returns Answer to the given question.\n */\nexport function supportsReportingObserver(): boolean {\n return 'ReportingObserver' in WINDOW;\n}\n\n/**\n * Tells whether current environment supports Referrer Policy API\n * {@link supportsReferrerPolicy}.\n *\n * @returns Answer to the given question.\n */\nexport function supportsReferrerPolicy(): boolean {\n // Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default'\n // (see https://caniuse.com/#feat=referrer-policy),\n // it doesn't. And it throws an exception instead of ignoring this parameter...\n // REF: https://github.com/getsentry/raven-js/issues/1233\n\n if (!supportsFetch()) {\n return false;\n }\n\n try {\n new Request('_', {\n referrerPolicy: 'origin' as ReferrerPolicy,\n });\n return true;\n } catch (e) {\n return false;\n }\n}\n", "/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { HandlerDataFetch } from '@sentry/types';\n\nimport { fill } from '../object';\nimport { supportsNativeFetch } from '../supports';\nimport { GLOBAL_OBJ } from '../worldwide';\nimport { addHandler, maybeInstrument, triggerHandlers } from './_handlers';\n\ntype FetchResource = string | { toString(): string } | { url: string };\n\n/**\n * Add an instrumentation handler for when a fetch request happens.\n * The handler function is called once when the request starts and once when it ends,\n * which can be identified by checking if it has an `endTimestamp`.\n *\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nexport function addFetchInstrumentationHandler(handler: (data: HandlerDataFetch) => void): void {\n const type = 'fetch';\n addHandler(type, handler);\n maybeInstrument(type, instrumentFetch);\n}\n\nfunction instrumentFetch(): void {\n if (!supportsNativeFetch()) {\n return;\n }\n\n fill(GLOBAL_OBJ, 'fetch', function (originalFetch: () => void): () => void {\n return function (...args: any[]): void {\n const { method, url } = parseFetchArgs(args);\n\n const handlerData: HandlerDataFetch = {\n args,\n fetchData: {\n method,\n url,\n },\n startTimestamp: Date.now(),\n };\n\n triggerHandlers('fetch', {\n ...handlerData,\n });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return originalFetch.apply(GLOBAL_OBJ, args).then(\n (response: Response) => {\n const finishedHandlerData: HandlerDataFetch = {\n ...handlerData,\n endTimestamp: Date.now(),\n response,\n };\n\n triggerHandlers('fetch', finishedHandlerData);\n return response;\n },\n (error: Error) => {\n const erroredHandlerData: HandlerDataFetch = {\n ...handlerData,\n endTimestamp: Date.now(),\n error,\n };\n\n triggerHandlers('fetch', erroredHandlerData);\n // NOTE: If you are a Sentry user, and you are seeing this stack frame,\n // it means the sentry.javascript SDK caught an error invoking your application code.\n // This is expected behavior and NOT indicative of a bug with sentry.javascript.\n throw error;\n },\n );\n };\n });\n}\n\nfunction hasProp(obj: unknown, prop: T): obj is Record {\n return !!obj && typeof obj === 'object' && !!(obj as Record)[prop];\n}\n\nfunction getUrlFromResource(resource: FetchResource): string {\n if (typeof resource === 'string') {\n return resource;\n }\n\n if (!resource) {\n return '';\n }\n\n if (hasProp(resource, 'url')) {\n return resource.url;\n }\n\n if (resource.toString) {\n return resource.toString();\n }\n\n return '';\n}\n\n/**\n * Parses the fetch arguments to find the used Http method and the url of the request.\n * Exported for tests only.\n */\nexport function parseFetchArgs(fetchArgs: unknown[]): { method: string; url: string } {\n if (fetchArgs.length === 0) {\n return { method: 'GET', url: '' };\n }\n\n if (fetchArgs.length === 2) {\n const [url, options] = fetchArgs as [FetchResource, object];\n\n return {\n url: getUrlFromResource(url),\n method: hasProp(options, 'method') ? String(options.method).toUpperCase() : 'GET',\n };\n }\n\n const arg = fetchArgs[0];\n return {\n url: getUrlFromResource(arg as FetchResource),\n method: hasProp(arg, 'method') ? String(arg.method).toUpperCase() : 'GET',\n };\n}\n", "import type { HandlerDataError } from '@sentry/types';\n\nimport { GLOBAL_OBJ } from '../worldwide';\nimport { addHandler, maybeInstrument, triggerHandlers } from './_handlers';\n\nlet _oldOnErrorHandler: (typeof GLOBAL_OBJ)['onerror'] | null = null;\n\n/**\n * Add an instrumentation handler for when an error is captured by the global error handler.\n *\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nexport function addGlobalErrorInstrumentationHandler(handler: (data: HandlerDataError) => void): void {\n const type = 'error';\n addHandler(type, handler);\n maybeInstrument(type, instrumentError);\n}\n\nfunction instrumentError(): void {\n _oldOnErrorHandler = GLOBAL_OBJ.onerror;\n\n GLOBAL_OBJ.onerror = function (\n msg: string | object,\n url?: string,\n line?: number,\n column?: number,\n error?: Error,\n ): boolean {\n const handlerData: HandlerDataError = {\n column,\n error,\n line,\n msg,\n url,\n };\n triggerHandlers('error', handlerData);\n\n if (_oldOnErrorHandler && !_oldOnErrorHandler.__SENTRY_LOADER__) {\n // eslint-disable-next-line prefer-rest-params\n return _oldOnErrorHandler.apply(this, arguments);\n }\n\n return false;\n };\n\n GLOBAL_OBJ.onerror.__SENTRY_INSTRUMENTED__ = true;\n}\n", "/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { HandlerDataUnhandledRejection } from '@sentry/types';\n\nimport { GLOBAL_OBJ } from '../worldwide';\nimport { addHandler, maybeInstrument, triggerHandlers } from './_handlers';\n\nlet _oldOnUnhandledRejectionHandler: (typeof GLOBAL_OBJ)['onunhandledrejection'] | null = null;\n\n/**\n * Add an instrumentation handler for when an unhandled promise rejection is captured.\n *\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nexport function addGlobalUnhandledRejectionInstrumentationHandler(\n handler: (data: HandlerDataUnhandledRejection) => void,\n): void {\n const type = 'unhandledrejection';\n addHandler(type, handler);\n maybeInstrument(type, instrumentUnhandledRejection);\n}\n\nfunction instrumentUnhandledRejection(): void {\n _oldOnUnhandledRejectionHandler = GLOBAL_OBJ.onunhandledrejection;\n\n GLOBAL_OBJ.onunhandledrejection = function (e: any): boolean {\n const handlerData: HandlerDataUnhandledRejection = e;\n triggerHandlers('unhandledrejection', handlerData);\n\n if (_oldOnUnhandledRejectionHandler && !_oldOnUnhandledRejectionHandler.__SENTRY_LOADER__) {\n // eslint-disable-next-line prefer-rest-params\n return _oldOnUnhandledRejectionHandler.apply(this, arguments);\n }\n\n return true;\n };\n\n GLOBAL_OBJ.onunhandledrejection.__SENTRY_INSTRUMENTED__ = true;\n}\n", "// Based on https://github.com/angular/angular.js/pull/13945/files\n// The MIT License\n\n// Copyright (c) 2010-2016 Google, Inc. http://angularjs.org\n\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport { getGlobalObject } from '../worldwide';\n\n// eslint-disable-next-line deprecation/deprecation\nconst WINDOW = getGlobalObject();\n\n/**\n * Tells whether current environment supports History API\n * {@link supportsHistory}.\n *\n * @returns Answer to the given question.\n */\nexport function supportsHistory(): boolean {\n // NOTE: in Chrome App environment, touching history.pushState, *even inside\n // a try/catch block*, will cause Chrome to output an error to console.error\n // borrowed from: https://github.com/angular/angular.js/pull/13945/files\n /* eslint-disable @typescript-eslint/no-unsafe-member-access */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const chromeVar = (WINDOW as any).chrome;\n const isChromePackagedApp = chromeVar && chromeVar.app && chromeVar.app.runtime;\n /* eslint-enable @typescript-eslint/no-unsafe-member-access */\n const hasHistoryApi = 'history' in WINDOW && !!WINDOW.history.pushState && !!WINDOW.history.replaceState;\n\n return !isChromePackagedApp && hasHistoryApi;\n}\n", "// TODO(v8): Move everything in this file into the browser package. Nothing here is generic and we run risk of leaking browser types into non-browser packages.\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { HandlerDataHistory } from '@sentry/types';\n\nimport { fill } from '../object';\nimport { supportsHistory } from '../supports';\nimport { GLOBAL_OBJ } from '../worldwide';\nimport { addHandler, maybeInstrument, triggerHandlers } from './_handlers';\n\nconst WINDOW = GLOBAL_OBJ as unknown as Window;\n\nlet lastHref: string | undefined;\n\n/**\n * Add an instrumentation handler for when a fetch request happens.\n * The handler function is called once when the request starts and once when it ends,\n * which can be identified by checking if it has an `endTimestamp`.\n *\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nexport function addHistoryInstrumentationHandler(handler: (data: HandlerDataHistory) => void): void {\n const type = 'history';\n addHandler(type, handler);\n maybeInstrument(type, instrumentHistory);\n}\n\nfunction instrumentHistory(): void {\n if (!supportsHistory()) {\n return;\n }\n\n const oldOnPopState = WINDOW.onpopstate;\n WINDOW.onpopstate = function (this: WindowEventHandlers, ...args: any[]): any {\n const to = WINDOW.location.href;\n // keep track of the current URL state, as we always receive only the updated state\n const from = lastHref;\n lastHref = to;\n const handlerData: HandlerDataHistory = { from, to };\n triggerHandlers('history', handlerData);\n if (oldOnPopState) {\n // Apparently this can throw in Firefox when incorrectly implemented plugin is installed.\n // https://github.com/getsentry/sentry-javascript/issues/3344\n // https://github.com/bugsnag/bugsnag-js/issues/469\n try {\n return oldOnPopState.apply(this, args);\n } catch (_oO) {\n // no-empty\n }\n }\n };\n\n function historyReplacementFunction(originalHistoryFunction: () => void): () => void {\n return function (this: History, ...args: any[]): void {\n const url = args.length > 2 ? args[2] : undefined;\n if (url) {\n // coerce to string (this is what pushState does)\n const from = lastHref;\n const to = String(url);\n // keep track of the current URL state, as we always receive only the updated state\n lastHref = to;\n const handlerData: HandlerDataHistory = { from, to };\n triggerHandlers('history', handlerData);\n }\n return originalHistoryFunction.apply(this, args);\n };\n }\n\n fill(WINDOW.history, 'pushState', historyReplacementFunction);\n fill(WINDOW.history, 'replaceState', historyReplacementFunction);\n}\n", "// TODO(v8): Move everything in this file into the browser package. Nothing here is generic and we run risk of leaking browser types into non-browser packages.\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { HandlerDataXhr, SentryWrappedXMLHttpRequest, WrappedFunction } from '@sentry/types';\n\nimport { isString } from '../is';\nimport { fill } from '../object';\nimport { GLOBAL_OBJ } from '../worldwide';\nimport { addHandler, maybeInstrument, triggerHandlers } from './_handlers';\n\nconst WINDOW = GLOBAL_OBJ as unknown as Window;\n\nexport const SENTRY_XHR_DATA_KEY = '__sentry_xhr_v3__';\n\n/**\n * Add an instrumentation handler for when an XHR request happens.\n * The handler function is called once when the request starts and once when it ends,\n * which can be identified by checking if it has an `endTimestamp`.\n *\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nexport function addXhrInstrumentationHandler(handler: (data: HandlerDataXhr) => void): void {\n const type = 'xhr';\n addHandler(type, handler);\n maybeInstrument(type, instrumentXHR);\n}\n\n/** Exported only for tests. */\nexport function instrumentXHR(): void {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (!(WINDOW as any).XMLHttpRequest) {\n return;\n }\n\n const xhrproto = XMLHttpRequest.prototype;\n\n fill(xhrproto, 'open', function (originalOpen: () => void): () => void {\n return function (this: XMLHttpRequest & SentryWrappedXMLHttpRequest, ...args: any[]): void {\n const startTimestamp = Date.now();\n\n // open() should always be called with two or more arguments\n // But to be on the safe side, we actually validate this and bail out if we don't have a method & url\n const method = isString(args[0]) ? args[0].toUpperCase() : undefined;\n const url = parseUrl(args[1]);\n\n if (!method || !url) {\n return originalOpen.apply(this, args);\n }\n\n this[SENTRY_XHR_DATA_KEY] = {\n method,\n url,\n request_headers: {},\n };\n\n // if Sentry key appears in URL, don't capture it as a request\n if (method === 'POST' && url.match(/sentry_key/)) {\n this.__sentry_own_request__ = true;\n }\n\n const onreadystatechangeHandler: () => void = () => {\n // For whatever reason, this is not the same instance here as from the outer method\n const xhrInfo = this[SENTRY_XHR_DATA_KEY];\n\n if (!xhrInfo) {\n return;\n }\n\n if (this.readyState === 4) {\n try {\n // touching statusCode in some platforms throws\n // an exception\n xhrInfo.status_code = this.status;\n } catch (e) {\n /* do nothing */\n }\n\n const handlerData: HandlerDataXhr = {\n args: [method, url],\n endTimestamp: Date.now(),\n startTimestamp,\n xhr: this,\n };\n triggerHandlers('xhr', handlerData);\n }\n };\n\n if ('onreadystatechange' in this && typeof this.onreadystatechange === 'function') {\n fill(this, 'onreadystatechange', function (original: WrappedFunction): Function {\n return function (this: SentryWrappedXMLHttpRequest, ...readyStateArgs: any[]): void {\n onreadystatechangeHandler();\n return original.apply(this, readyStateArgs);\n };\n });\n } else {\n this.addEventListener('readystatechange', onreadystatechangeHandler);\n }\n\n // Intercepting `setRequestHeader` to access the request headers of XHR instance.\n // This will only work for user/library defined headers, not for the default/browser-assigned headers.\n // Request cookies are also unavailable for XHR, as `Cookie` header can't be defined by `setRequestHeader`.\n fill(this, 'setRequestHeader', function (original: WrappedFunction): Function {\n return function (this: SentryWrappedXMLHttpRequest, ...setRequestHeaderArgs: unknown[]): void {\n const [header, value] = setRequestHeaderArgs;\n\n const xhrInfo = this[SENTRY_XHR_DATA_KEY];\n\n if (xhrInfo && isString(header) && isString(value)) {\n xhrInfo.request_headers[header.toLowerCase()] = value;\n }\n\n return original.apply(this, setRequestHeaderArgs);\n };\n });\n\n return originalOpen.apply(this, args);\n };\n });\n\n fill(xhrproto, 'send', function (originalSend: () => void): () => void {\n return function (this: XMLHttpRequest & SentryWrappedXMLHttpRequest, ...args: any[]): void {\n const sentryXhrData = this[SENTRY_XHR_DATA_KEY];\n\n if (!sentryXhrData) {\n return originalSend.apply(this, args);\n }\n\n if (args[0] !== undefined) {\n sentryXhrData.body = args[0];\n }\n\n const handlerData: HandlerDataXhr = {\n args: [sentryXhrData.method, sentryXhrData.url],\n startTimestamp: Date.now(),\n xhr: this,\n };\n triggerHandlers('xhr', handlerData);\n\n return originalSend.apply(this, args);\n };\n });\n}\n\nfunction parseUrl(url: string | unknown): string | undefined {\n if (isString(url)) {\n return url;\n }\n\n try {\n // url can be a string or URL\n // but since URL is not available in IE11, we do not check for it,\n // but simply assume it is an URL and return `toString()` from it (which returns the full URL)\n // If that fails, we just return undefined\n return (url as URL).toString();\n } catch {} // eslint-disable-line no-empty\n\n return undefined;\n}\n", "// TODO(v8): Consider moving this file (or at least parts of it) into the browser package. The registered handlers are mostly non-generic and we risk leaking runtime specific code into generic packages.\n\nimport { DEBUG_BUILD } from '../debug-build';\nimport { logger } from './../logger';\nimport type {\n InstrumentHandlerCallback as _InstrumentHandlerCallback,\n InstrumentHandlerType as _InstrumentHandlerType,\n} from './_handlers';\nimport { resetInstrumentationHandlers } from './_handlers';\nimport { addConsoleInstrumentationHandler } from './console';\nimport { addClickKeypressInstrumentationHandler } from './dom';\nimport { addFetchInstrumentationHandler } from './fetch';\nimport { addGlobalErrorInstrumentationHandler } from './globalError';\nimport { addGlobalUnhandledRejectionInstrumentationHandler } from './globalUnhandledRejection';\nimport { addHistoryInstrumentationHandler } from './history';\nimport { SENTRY_XHR_DATA_KEY, addXhrInstrumentationHandler } from './xhr';\n\n/**\n * Add handler that will be called when given type of instrumentation triggers.\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n * @deprecated Use the proper function per instrumentation type instead!\n */\nexport function addInstrumentationHandler(type: _InstrumentHandlerType, callback: _InstrumentHandlerCallback): void {\n switch (type) {\n case 'console':\n return addConsoleInstrumentationHandler(callback);\n case 'dom':\n return addClickKeypressInstrumentationHandler(callback);\n case 'xhr':\n return addXhrInstrumentationHandler(callback);\n case 'fetch':\n return addFetchInstrumentationHandler(callback);\n case 'history':\n return addHistoryInstrumentationHandler(callback);\n case 'error':\n return addGlobalErrorInstrumentationHandler(callback);\n case 'unhandledrejection':\n return addGlobalUnhandledRejectionInstrumentationHandler(callback);\n default:\n DEBUG_BUILD && logger.warn('unknown instrumentation type:', type);\n }\n}\n\n/**\n * @deprecated Use the specific handler data types from @sentry/types instead, e.g. HandlerDataFetch, HandlerDataConsole, ...\n */\ntype InstrumentHandlerCallback = _InstrumentHandlerCallback;\n\n/**\n * @deprecated Use the specific handler functions instead, e.g. addConsoleInstrumentationHandler, ...\n */\ntype InstrumentHandlerType = _InstrumentHandlerType;\n\n// eslint-disable-next-line deprecation/deprecation\nexport type { InstrumentHandlerCallback, InstrumentHandlerType };\n\nexport {\n addConsoleInstrumentationHandler,\n addClickKeypressInstrumentationHandler,\n addXhrInstrumentationHandler,\n addFetchInstrumentationHandler,\n addHistoryInstrumentationHandler,\n addGlobalErrorInstrumentationHandler,\n addGlobalUnhandledRejectionInstrumentationHandler,\n SENTRY_XHR_DATA_KEY,\n // Only exported for tests\n resetInstrumentationHandlers,\n};\n", "/*\n * This module exists for optimizations in the build process through rollup and terser. We define some global\n * constants, which can be overridden during build. By guarding certain pieces of code with functions that return these\n * constants, we can control whether or not they appear in the final bundle. (Any code guarded by a false condition will\n * never run, and will hence be dropped during treeshaking.) The two primary uses for this are stripping out calls to\n * `logger` and preventing node-related code from appearing in browser bundles.\n *\n * Attention:\n * This file should not be used to define constants/flags that are intended to be used for tree-shaking conducted by\n * users. These flags should live in their respective packages, as we identified user tooling (specifically webpack)\n * having issues tree-shaking these constants across package boundaries.\n * An example for this is the __SENTRY_DEBUG__ constant. It is declared in each package individually because we want\n * users to be able to shake away expressions that it guards.\n */\n\ndeclare const __SENTRY_BROWSER_BUNDLE__: boolean | undefined;\n\nexport type SdkSource = 'npm' | 'cdn' | 'loader';\n\n/**\n * Figures out if we're building a browser bundle.\n *\n * @returns true if this is a browser bundle build.\n */\nexport function isBrowserBundle(): boolean {\n return typeof __SENTRY_BROWSER_BUNDLE__ !== 'undefined' && !!__SENTRY_BROWSER_BUNDLE__;\n}\n\n/**\n * Get source of SDK.\n */\nexport function getSDKSource(): SdkSource {\n // @ts-expect-error __SENTRY_SDK_SOURCE__ is injected by rollup during build process\n return __SENTRY_SDK_SOURCE__;\n}\n", "/**\n * NOTE: In order to avoid circular dependencies, if you add a function to this module and it needs to print something,\n * you must either a) use `console.log` rather than the logger, or b) put your function elsewhere.\n */\n\nimport { isBrowserBundle } from './env';\n\n/**\n * Checks whether we're in the Node.js or Browser environment\n *\n * @returns Answer to given question\n */\nexport function isNodeEnv(): boolean {\n // explicitly check for browser bundles as those can be optimized statically\n // by terser/rollup.\n return (\n !isBrowserBundle() &&\n Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]'\n );\n}\n\n/**\n * Requires a module which is protected against bundler minification.\n *\n * @param request The module path to resolve\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any\nexport function dynamicRequire(mod: any, request: string): any {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return mod.require(request);\n}\n\n/**\n * Helper for dynamically loading module that should work with linked dependencies.\n * The problem is that we _should_ be using `require(require.resolve(moduleName, { paths: [cwd()] }))`\n * However it's _not possible_ to do that with Webpack, as it has to know all the dependencies during\n * build time. `require.resolve` is also not available in any other way, so we cannot create,\n * a fake helper like we do with `dynamicRequire`.\n *\n * We always prefer to use local package, thus the value is not returned early from each `try/catch` block.\n * That is to mimic the behavior of `require.resolve` exactly.\n *\n * @param moduleName module name to require\n * @returns possibly required module\n */\nexport function loadModule(moduleName: string): T | undefined {\n let mod: T | undefined;\n\n try {\n mod = dynamicRequire(module, moduleName);\n } catch (e) {\n // no-empty\n }\n\n try {\n const { cwd } = dynamicRequire(module, 'process');\n mod = dynamicRequire(module, `${cwd()}/node_modules/${moduleName}`) as T;\n } catch (e) {\n // no-empty\n }\n\n return mod;\n}\n", "import { isNodeEnv } from './node';\nimport { GLOBAL_OBJ } from './worldwide';\n\n/**\n * Returns true if we are in the browser.\n */\nexport function isBrowser(): boolean {\n // eslint-disable-next-line no-restricted-globals\n return typeof window !== 'undefined' && (!isNodeEnv() || isElectronNodeRenderer());\n}\n\ntype ElectronProcess = { type?: string };\n\n// Electron renderers with nodeIntegration enabled are detected as Node.js so we specifically test for them\nfunction isElectronNodeRenderer(): boolean {\n return (\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n (GLOBAL_OBJ as any).process !== undefined && ((GLOBAL_OBJ as any).process as ElectronProcess).type === 'renderer'\n );\n}\n", "/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nexport type MemoFunc = [\n // memoize\n (obj: any) => boolean,\n // unmemoize\n (obj: any) => void,\n];\n\n/**\n * Helper to decycle json objects\n */\nexport function memoBuilder(): MemoFunc {\n const hasWeakSet = typeof WeakSet === 'function';\n const inner: any = hasWeakSet ? new WeakSet() : [];\n function memoize(obj: any): boolean {\n if (hasWeakSet) {\n if (inner.has(obj)) {\n return true;\n }\n inner.add(obj);\n return false;\n }\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < inner.length; i++) {\n const value = inner[i];\n if (value === obj) {\n return true;\n }\n }\n inner.push(obj);\n return false;\n }\n\n function unmemoize(obj: any): void {\n if (hasWeakSet) {\n inner.delete(obj);\n } else {\n for (let i = 0; i < inner.length; i++) {\n if (inner[i] === obj) {\n inner.splice(i, 1);\n break;\n }\n }\n }\n }\n return [memoize, unmemoize];\n}\n", "import type { Primitive } from '@sentry/types';\n\nimport { isNaN, isSyntheticEvent, isVueViewModel } from './is';\nimport type { MemoFunc } from './memo';\nimport { memoBuilder } from './memo';\nimport { convertToPlainObject } from './object';\nimport { getFunctionName } from './stacktrace';\n\ntype Prototype = { constructor: (...args: unknown[]) => unknown };\n// This is a hack to placate TS, relying on the fact that technically, arrays are objects with integer keys. Normally we\n// think of those keys as actual numbers, but `arr['0']` turns out to work just as well as `arr[0]`, and doing it this\n// way lets us use a single type in the places where behave as if we are only dealing with objects, even if some of them\n// might be arrays.\ntype ObjOrArray = { [key: string]: T };\n\n/**\n * Recursively normalizes the given object.\n *\n * - Creates a copy to prevent original input mutation\n * - Skips non-enumerable properties\n * - When stringifying, calls `toJSON` if implemented\n * - Removes circular references\n * - Translates non-serializable values (`undefined`/`NaN`/functions) to serializable format\n * - Translates known global objects/classes to a string representations\n * - Takes care of `Error` object serialization\n * - Optionally limits depth of final output\n * - Optionally limits number of properties/elements included in any single object/array\n *\n * @param input The object to be normalized.\n * @param depth The max depth to which to normalize the object. (Anything deeper stringified whole.)\n * @param maxProperties The max number of elements or properties to be included in any single array or\n * object in the normallized output.\n * @returns A normalized version of the object, or `\"**non-serializable**\"` if any errors are thrown during normalization.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function normalize(input: unknown, depth: number = 100, maxProperties: number = +Infinity): any {\n try {\n // since we're at the outermost level, we don't provide a key\n return visit('', input, depth, maxProperties);\n } catch (err) {\n return { ERROR: `**non-serializable** (${err})` };\n }\n}\n\n/** JSDoc */\nexport function normalizeToSize(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n object: { [key: string]: any },\n // Default Node.js REPL depth\n depth: number = 3,\n // 100kB, as 200kB is max payload size, so half sounds reasonable\n maxSize: number = 100 * 1024,\n): T {\n const normalized = normalize(object, depth);\n\n if (jsonSize(normalized) > maxSize) {\n return normalizeToSize(object, depth - 1, maxSize);\n }\n\n return normalized as T;\n}\n\n/**\n * Visits a node to perform normalization on it\n *\n * @param key The key corresponding to the given node\n * @param value The node to be visited\n * @param depth Optional number indicating the maximum recursion depth\n * @param maxProperties Optional maximum number of properties/elements included in any single object/array\n * @param memo Optional Memo class handling decycling\n */\nfunction visit(\n key: string,\n value: unknown,\n depth: number = +Infinity,\n maxProperties: number = +Infinity,\n memo: MemoFunc = memoBuilder(),\n): Primitive | ObjOrArray {\n const [memoize, unmemoize] = memo;\n\n // Get the simple cases out of the way first\n if (\n value == null || // this matches null and undefined -> eqeq not eqeqeq\n (['number', 'boolean', 'string'].includes(typeof value) && !isNaN(value))\n ) {\n return value as Primitive;\n }\n\n const stringified = stringifyValue(key, value);\n\n // Anything we could potentially dig into more (objects or arrays) will have come back as `\"[object XXXX]\"`.\n // Everything else will have already been serialized, so if we don't see that pattern, we're done.\n if (!stringified.startsWith('[object ')) {\n return stringified;\n }\n\n // From here on, we can assert that `value` is either an object or an array.\n\n // Do not normalize objects that we know have already been normalized. As a general rule, the\n // \"__sentry_skip_normalization__\" property should only be used sparingly and only should only be set on objects that\n // have already been normalized.\n if ((value as ObjOrArray)['__sentry_skip_normalization__']) {\n return value as ObjOrArray;\n }\n\n // We can set `__sentry_override_normalization_depth__` on an object to ensure that from there\n // We keep a certain amount of depth.\n // This should be used sparingly, e.g. we use it for the redux integration to ensure we get a certain amount of state.\n const remainingDepth =\n typeof (value as ObjOrArray)['__sentry_override_normalization_depth__'] === 'number'\n ? ((value as ObjOrArray)['__sentry_override_normalization_depth__'] as number)\n : depth;\n\n // We're also done if we've reached the max depth\n if (remainingDepth === 0) {\n // At this point we know `serialized` is a string of the form `\"[object XXXX]\"`. Clean it up so it's just `\"[XXXX]\"`.\n return stringified.replace('object ', '');\n }\n\n // If we've already visited this branch, bail out, as it's circular reference. If not, note that we're seeing it now.\n if (memoize(value)) {\n return '[Circular ~]';\n }\n\n // If the value has a `toJSON` method, we call it to extract more information\n const valueWithToJSON = value as unknown & { toJSON?: () => unknown };\n if (valueWithToJSON && typeof valueWithToJSON.toJSON === 'function') {\n try {\n const jsonValue = valueWithToJSON.toJSON();\n // We need to normalize the return value of `.toJSON()` in case it has circular references\n return visit('', jsonValue, remainingDepth - 1, maxProperties, memo);\n } catch (err) {\n // pass (The built-in `toJSON` failed, but we can still try to do it ourselves)\n }\n }\n\n // At this point we know we either have an object or an array, we haven't seen it before, and we're going to recurse\n // because we haven't yet reached the max depth. Create an accumulator to hold the results of visiting each\n // property/entry, and keep track of the number of items we add to it.\n const normalized = (Array.isArray(value) ? [] : {}) as ObjOrArray;\n let numAdded = 0;\n\n // Before we begin, convert`Error` and`Event` instances into plain objects, since some of each of their relevant\n // properties are non-enumerable and otherwise would get missed.\n const visitable = convertToPlainObject(value as ObjOrArray);\n\n for (const visitKey in visitable) {\n // Avoid iterating over fields in the prototype if they've somehow been exposed to enumeration.\n if (!Object.prototype.hasOwnProperty.call(visitable, visitKey)) {\n continue;\n }\n\n if (numAdded >= maxProperties) {\n normalized[visitKey] = '[MaxProperties ~]';\n break;\n }\n\n // Recursively visit all the child nodes\n const visitValue = visitable[visitKey];\n normalized[visitKey] = visit(visitKey, visitValue, remainingDepth - 1, maxProperties, memo);\n\n numAdded++;\n }\n\n // Once we've visited all the branches, remove the parent from memo storage\n unmemoize(value);\n\n // Return accumulated values\n return normalized;\n}\n\n/**\n * @deprecated This export will be removed in v8.\n */\nexport { visit as walk };\n\n/* eslint-disable complexity */\n/**\n * Stringify the given value. Handles various known special values and types.\n *\n * Not meant to be used on simple primitives which already have a string representation, as it will, for example, turn\n * the number 1231 into \"[Object Number]\", nor on `null`, as it will throw.\n *\n * @param value The value to stringify\n * @returns A stringified representation of the given value\n */\nfunction stringifyValue(\n key: unknown,\n // this type is a tiny bit of a cheat, since this function does handle NaN (which is technically a number), but for\n // our internal use, it'll do\n value: Exclude,\n): string {\n try {\n if (key === 'domain' && value && typeof value === 'object' && (value as { _events: unknown })._events) {\n return '[Domain]';\n }\n\n if (key === 'domainEmitter') {\n return '[DomainEmitter]';\n }\n\n // It's safe to use `global`, `window`, and `document` here in this manner, as we are asserting using `typeof` first\n // which won't throw if they are not present.\n\n if (typeof global !== 'undefined' && value === global) {\n return '[Global]';\n }\n\n // eslint-disable-next-line no-restricted-globals\n if (typeof window !== 'undefined' && value === window) {\n return '[Window]';\n }\n\n // eslint-disable-next-line no-restricted-globals\n if (typeof document !== 'undefined' && value === document) {\n return '[Document]';\n }\n\n if (isVueViewModel(value)) {\n return '[VueViewModel]';\n }\n\n // React's SyntheticEvent thingy\n if (isSyntheticEvent(value)) {\n return '[SyntheticEvent]';\n }\n\n if (typeof value === 'number' && value !== value) {\n return '[NaN]';\n }\n\n if (typeof value === 'function') {\n return `[Function: ${getFunctionName(value)}]`;\n }\n\n if (typeof value === 'symbol') {\n return `[${String(value)}]`;\n }\n\n // stringified BigInts are indistinguishable from regular numbers, so we need to label them to avoid confusion\n if (typeof value === 'bigint') {\n return `[BigInt: ${String(value)}]`;\n }\n\n // Now that we've knocked out all the special cases and the primitives, all we have left are objects. Simply casting\n // them to strings means that instances of classes which haven't defined their `toStringTag` will just come out as\n // `\"[object Object]\"`. If we instead look at the constructor's name (which is the same as the name of the class),\n // we can make sure that only plain objects come out that way.\n const objName = getConstructorName(value);\n\n // Handle HTML Elements\n if (/^HTML(\\w*)Element$/.test(objName)) {\n return `[HTMLElement: ${objName}]`;\n }\n\n return `[object ${objName}]`;\n } catch (err) {\n return `**non-serializable** (${err})`;\n }\n}\n/* eslint-enable complexity */\n\nfunction getConstructorName(value: unknown): string {\n const prototype: Prototype | null = Object.getPrototypeOf(value);\n\n return prototype ? prototype.constructor.name : 'null prototype';\n}\n\n/** Calculates bytes size of input string */\nfunction utf8Length(value: string): number {\n // eslint-disable-next-line no-bitwise\n return ~-encodeURI(value).split(/%..|./).length;\n}\n\n/** Calculates bytes size of input object */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction jsonSize(value: any): number {\n return utf8Length(JSON.stringify(value));\n}\n\n/**\n * Normalizes URLs in exceptions and stacktraces to a base path so Sentry can fingerprint\n * across platforms and working directory.\n *\n * @param url The URL to be normalized.\n * @param basePath The application base path.\n * @returns The normalized URL.\n */\nexport function normalizeUrlToBase(url: string, basePath: string): string {\n const escapedBase = basePath\n // Backslash to forward\n .replace(/\\\\/g, '/')\n // Escape RegExp special characters\n .replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&');\n\n let newUrl = url;\n try {\n newUrl = decodeURI(url);\n } catch (_Oo) {\n // Sometime this breaks\n }\n return (\n newUrl\n .replace(/\\\\/g, '/')\n .replace(/webpack:\\/?/g, '') // Remove intermediate base path\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n .replace(new RegExp(`(file://)?/*${escapedBase}/*`, 'ig'), 'app:///')\n );\n}\n", "// Slightly modified (no IE8 support, ES6) and transcribed to TypeScript\n// https://github.com/calvinmetcalf/rollup-plugin-node-builtins/blob/63ab8aacd013767445ca299e468d9a60a95328d7/src/es6/path.js\n//\n// Copyright Joyent, Inc.and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n/** JSDoc */\nfunction normalizeArray(parts: string[], allowAboveRoot?: boolean): string[] {\n // if the path tries to go above the root, `up` ends up > 0\n let up = 0;\n for (let i = parts.length - 1; i >= 0; i--) {\n const last = parts[i];\n if (last === '.') {\n parts.splice(i, 1);\n } else if (last === '..') {\n parts.splice(i, 1);\n up++;\n } else if (up) {\n parts.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift('..');\n }\n }\n\n return parts;\n}\n\n// Split a filename into [root, dir, basename, ext], unix version\n// 'root' is just a slash, or nothing.\nconst splitPathRe = /^(\\S+:\\\\|\\/?)([\\s\\S]*?)((?:\\.{1,2}|[^/\\\\]+?|)(\\.[^./\\\\]*|))(?:[/\\\\]*)$/;\n/** JSDoc */\nfunction splitPath(filename: string): string[] {\n // Truncate files names greater than 1024 characters to avoid regex dos\n // https://github.com/getsentry/sentry-javascript/pull/8737#discussion_r1285719172\n const truncated = filename.length > 1024 ? `${filename.slice(-1024)}` : filename;\n const parts = splitPathRe.exec(truncated);\n return parts ? parts.slice(1) : [];\n}\n\n// path.resolve([from ...], to)\n// posix version\n/** JSDoc */\nexport function resolve(...args: string[]): string {\n let resolvedPath = '';\n let resolvedAbsolute = false;\n\n for (let i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n const path = i >= 0 ? args[i] : '/';\n\n // Skip empty entries\n if (!path) {\n continue;\n }\n\n resolvedPath = `${path}/${resolvedPath}`;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(\n resolvedPath.split('/').filter(p => !!p),\n !resolvedAbsolute,\n ).join('/');\n\n return (resolvedAbsolute ? '/' : '') + resolvedPath || '.';\n}\n\n/** JSDoc */\nfunction trim(arr: string[]): string[] {\n let start = 0;\n for (; start < arr.length; start++) {\n if (arr[start] !== '') {\n break;\n }\n }\n\n let end = arr.length - 1;\n for (; end >= 0; end--) {\n if (arr[end] !== '') {\n break;\n }\n }\n\n if (start > end) {\n return [];\n }\n return arr.slice(start, end - start + 1);\n}\n\n// path.relative(from, to)\n// posix version\n/** JSDoc */\nexport function relative(from: string, to: string): string {\n /* eslint-disable no-param-reassign */\n from = resolve(from).slice(1);\n to = resolve(to).slice(1);\n /* eslint-enable no-param-reassign */\n\n const fromParts = trim(from.split('/'));\n const toParts = trim(to.split('/'));\n\n const length = Math.min(fromParts.length, toParts.length);\n let samePartsLength = length;\n for (let i = 0; i < length; i++) {\n if (fromParts[i] !== toParts[i]) {\n samePartsLength = i;\n break;\n }\n }\n\n let outputParts = [];\n for (let i = samePartsLength; i < fromParts.length; i++) {\n outputParts.push('..');\n }\n\n outputParts = outputParts.concat(toParts.slice(samePartsLength));\n\n return outputParts.join('/');\n}\n\n// path.normalize(path)\n// posix version\n/** JSDoc */\nexport function normalizePath(path: string): string {\n const isPathAbsolute = isAbsolute(path);\n const trailingSlash = path.slice(-1) === '/';\n\n // Normalize the path\n let normalizedPath = normalizeArray(\n path.split('/').filter(p => !!p),\n !isPathAbsolute,\n ).join('/');\n\n if (!normalizedPath && !isPathAbsolute) {\n normalizedPath = '.';\n }\n if (normalizedPath && trailingSlash) {\n normalizedPath += '/';\n }\n\n return (isPathAbsolute ? '/' : '') + normalizedPath;\n}\n\n// posix version\n/** JSDoc */\nexport function isAbsolute(path: string): boolean {\n return path.charAt(0) === '/';\n}\n\n// posix version\n/** JSDoc */\nexport function join(...args: string[]): string {\n return normalizePath(args.join('/'));\n}\n\n/** JSDoc */\nexport function dirname(path: string): string {\n const result = splitPath(path);\n const root = result[0];\n let dir = result[1];\n\n if (!root && !dir) {\n // No dirname whatsoever\n return '.';\n }\n\n if (dir) {\n // It has a dirname, strip trailing slash\n dir = dir.slice(0, dir.length - 1);\n }\n\n return root + dir;\n}\n\n/** JSDoc */\nexport function basename(path: string, ext?: string): string {\n let f = splitPath(path)[2];\n if (ext && f.slice(ext.length * -1) === ext) {\n f = f.slice(0, f.length - ext.length);\n }\n return f;\n}\n", "/* eslint-disable @typescript-eslint/explicit-function-return-type */\n/* eslint-disable @typescript-eslint/typedef */\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { isThenable } from './is';\n\n/** SyncPromise internal states */\nconst enum States {\n /** Pending */\n PENDING = 0,\n /** Resolved / OK */\n RESOLVED = 1,\n /** Rejected / Error */\n REJECTED = 2,\n}\n\n// Overloads so we can call resolvedSyncPromise without arguments and generic argument\nexport function resolvedSyncPromise(): PromiseLike;\nexport function resolvedSyncPromise(value: T | PromiseLike): PromiseLike;\n\n/**\n * Creates a resolved sync promise.\n *\n * @param value the value to resolve the promise with\n * @returns the resolved sync promise\n */\nexport function resolvedSyncPromise(value?: T | PromiseLike): PromiseLike {\n return new SyncPromise(resolve => {\n resolve(value);\n });\n}\n\n/**\n * Creates a rejected sync promise.\n *\n * @param value the value to reject the promise with\n * @returns the rejected sync promise\n */\nexport function rejectedSyncPromise(reason?: any): PromiseLike {\n return new SyncPromise((_, reject) => {\n reject(reason);\n });\n}\n\n/**\n * Thenable class that behaves like a Promise and follows it's interface\n * but is not async internally\n */\nclass SyncPromise implements PromiseLike {\n private _state: States;\n private _handlers: Array<[boolean, (value: T) => void, (reason: any) => any]>;\n private _value: any;\n\n public constructor(\n executor: (resolve: (value?: T | PromiseLike | null) => void, reject: (reason?: any) => void) => void,\n ) {\n this._state = States.PENDING;\n this._handlers = [];\n\n try {\n executor(this._resolve, this._reject);\n } catch (e) {\n this._reject(e);\n }\n }\n\n /** JSDoc */\n public then(\n onfulfilled?: ((value: T) => TResult1 | PromiseLike) | null,\n onrejected?: ((reason: any) => TResult2 | PromiseLike) | null,\n ): PromiseLike {\n return new SyncPromise((resolve, reject) => {\n this._handlers.push([\n false,\n result => {\n if (!onfulfilled) {\n // TODO: ¯\\_(ツ)_/¯\n // TODO: FIXME\n resolve(result as any);\n } else {\n try {\n resolve(onfulfilled(result));\n } catch (e) {\n reject(e);\n }\n }\n },\n reason => {\n if (!onrejected) {\n reject(reason);\n } else {\n try {\n resolve(onrejected(reason));\n } catch (e) {\n reject(e);\n }\n }\n },\n ]);\n this._executeHandlers();\n });\n }\n\n /** JSDoc */\n public catch(\n onrejected?: ((reason: any) => TResult | PromiseLike) | null,\n ): PromiseLike {\n return this.then(val => val, onrejected);\n }\n\n /** JSDoc */\n public finally(onfinally?: (() => void) | null): PromiseLike {\n return new SyncPromise((resolve, reject) => {\n let val: TResult | any;\n let isRejected: boolean;\n\n return this.then(\n value => {\n isRejected = false;\n val = value;\n if (onfinally) {\n onfinally();\n }\n },\n reason => {\n isRejected = true;\n val = reason;\n if (onfinally) {\n onfinally();\n }\n },\n ).then(() => {\n if (isRejected) {\n reject(val);\n return;\n }\n\n resolve(val as unknown as any);\n });\n });\n }\n\n /** JSDoc */\n private readonly _resolve = (value?: T | PromiseLike | null) => {\n this._setResult(States.RESOLVED, value);\n };\n\n /** JSDoc */\n private readonly _reject = (reason?: any) => {\n this._setResult(States.REJECTED, reason);\n };\n\n /** JSDoc */\n private readonly _setResult = (state: States, value?: T | PromiseLike | any) => {\n if (this._state !== States.PENDING) {\n return;\n }\n\n if (isThenable(value)) {\n void (value as PromiseLike).then(this._resolve, this._reject);\n return;\n }\n\n this._state = state;\n this._value = value;\n\n this._executeHandlers();\n };\n\n /** JSDoc */\n private readonly _executeHandlers = () => {\n if (this._state === States.PENDING) {\n return;\n }\n\n const cachedHandlers = this._handlers.slice();\n this._handlers = [];\n\n cachedHandlers.forEach(handler => {\n if (handler[0]) {\n return;\n }\n\n if (this._state === States.RESOLVED) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n handler[1](this._value as unknown as any);\n }\n\n if (this._state === States.REJECTED) {\n handler[2](this._value);\n }\n\n handler[0] = true;\n });\n };\n}\n\nexport { SyncPromise };\n", "import { SentryError } from './error';\nimport { SyncPromise, rejectedSyncPromise, resolvedSyncPromise } from './syncpromise';\n\nexport interface PromiseBuffer {\n // exposes the internal array so tests can assert on the state of it.\n // XXX: this really should not be public api.\n $: Array>;\n add(taskProducer: () => PromiseLike): PromiseLike;\n drain(timeout?: number): PromiseLike;\n}\n\n/**\n * Creates an new PromiseBuffer object with the specified limit\n * @param limit max number of promises that can be stored in the buffer\n */\nexport function makePromiseBuffer(limit?: number): PromiseBuffer {\n const buffer: Array> = [];\n\n function isReady(): boolean {\n return limit === undefined || buffer.length < limit;\n }\n\n /**\n * Remove a promise from the queue.\n *\n * @param task Can be any PromiseLike\n * @returns Removed promise.\n */\n function remove(task: PromiseLike): PromiseLike {\n return buffer.splice(buffer.indexOf(task), 1)[0];\n }\n\n /**\n * Add a promise (representing an in-flight action) to the queue, and set it to remove itself on fulfillment.\n *\n * @param taskProducer A function producing any PromiseLike; In previous versions this used to be `task:\n * PromiseLike`, but under that model, Promises were instantly created on the call-site and their executor\n * functions therefore ran immediately. Thus, even if the buffer was full, the action still happened. By\n * requiring the promise to be wrapped in a function, we can defer promise creation until after the buffer\n * limit check.\n * @returns The original promise.\n */\n function add(taskProducer: () => PromiseLike): PromiseLike {\n if (!isReady()) {\n return rejectedSyncPromise(new SentryError('Not adding Promise because buffer limit was reached.'));\n }\n\n // start the task and add its promise to the queue\n const task = taskProducer();\n if (buffer.indexOf(task) === -1) {\n buffer.push(task);\n }\n void task\n .then(() => remove(task))\n // Use `then(null, rejectionHandler)` rather than `catch(rejectionHandler)` so that we can use `PromiseLike`\n // rather than `Promise`. `PromiseLike` doesn't have a `.catch` method, making its polyfill smaller. (ES5 didn't\n // have promises, so TS has to polyfill when down-compiling.)\n .then(null, () =>\n remove(task).then(null, () => {\n // We have to add another catch here because `remove()` starts a new promise chain.\n }),\n );\n return task;\n }\n\n /**\n * Wait for all promises in the queue to resolve or for timeout to expire, whichever comes first.\n *\n * @param timeout The time, in ms, after which to resolve to `false` if the queue is still non-empty. Passing `0` (or\n * not passing anything) will make the promise wait as long as it takes for the queue to drain before resolving to\n * `true`.\n * @returns A promise which will resolve to `true` if the queue is already empty or drains before the timeout, and\n * `false` otherwise\n */\n function drain(timeout?: number): PromiseLike {\n return new SyncPromise((resolve, reject) => {\n let counter = buffer.length;\n\n if (!counter) {\n return resolve(true);\n }\n\n // wait for `timeout` ms and then resolve to `false` (if not cancelled first)\n const capturedSetTimeout = setTimeout(() => {\n if (timeout && timeout > 0) {\n resolve(false);\n }\n }, timeout);\n\n // if all promises resolve in time, cancel the timer and resolve to `true`\n buffer.forEach(item => {\n void resolvedSyncPromise(item).then(() => {\n if (!--counter) {\n clearTimeout(capturedSetTimeout);\n resolve(true);\n }\n }, reject);\n });\n });\n }\n\n return {\n $: buffer,\n add,\n drain,\n };\n}\n", "/**\n * This code was originally copied from the 'cookie` module at v0.5.0 and was simplified for our use case.\n * https://github.com/jshttp/cookie/blob/a0c84147aab6266bdb3996cf4062e93907c0b0fc/index.js\n * It had the following license:\n *\n * (The MIT License)\n *\n * Copyright (c) 2012-2014 Roman Shtylman \n * Copyright (c) 2015 Douglas Christopher Wilson \n *\n * Permission is hereby granted, free of charge, to any person obtaining\n * a copy of this software and associated documentation files (the\n * 'Software'), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to\n * permit persons to whom the Software is furnished to do so, subject to\n * the following conditions:\n *\n * The above copyright notice and this permission notice shall be\n * included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n/**\n * Parses a cookie string\n */\nexport function parseCookie(str: string): Record {\n const obj: Record = {};\n let index = 0;\n\n while (index < str.length) {\n const eqIdx = str.indexOf('=', index);\n\n // no more cookie pairs\n if (eqIdx === -1) {\n break;\n }\n\n let endIdx = str.indexOf(';', index);\n\n if (endIdx === -1) {\n endIdx = str.length;\n } else if (endIdx < eqIdx) {\n // backtrack on prior semicolon\n index = str.lastIndexOf(';', eqIdx - 1) + 1;\n continue;\n }\n\n const key = str.slice(index, eqIdx).trim();\n\n // only assign once\n if (undefined === obj[key]) {\n let val = str.slice(eqIdx + 1, endIdx).trim();\n\n // quoted values\n if (val.charCodeAt(0) === 0x22) {\n val = val.slice(1, -1);\n }\n\n try {\n obj[key] = val.indexOf('%') !== -1 ? decodeURIComponent(val) : val;\n } catch (e) {\n obj[key] = val;\n }\n }\n\n index = endIdx + 1;\n }\n\n return obj;\n}\n", "type PartialURL = {\n host?: string;\n path?: string;\n protocol?: string;\n relative?: string;\n search?: string;\n hash?: string;\n};\n\n/**\n * Parses string form of URL into an object\n * // borrowed from https://tools.ietf.org/html/rfc3986#appendix-B\n * // intentionally using regex and not href parsing trick because React Native and other\n * // environments where DOM might not be available\n * @returns parsed URL object\n */\nexport function parseUrl(url: string): PartialURL {\n if (!url) {\n return {};\n }\n\n const match = url.match(/^(([^:/?#]+):)?(\\/\\/([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$/);\n\n if (!match) {\n return {};\n }\n\n // coerce to undefined values to empty string so we don't get 'undefined'\n const query = match[6] || '';\n const fragment = match[8] || '';\n return {\n host: match[4],\n path: match[5],\n protocol: match[2],\n search: query,\n hash: fragment,\n relative: match[5] + query + fragment, // everything minus origin\n };\n}\n\n/**\n * Strip the query string and fragment off of a given URL or path (if present)\n *\n * @param urlPath Full URL or path, including possible query string and/or fragment\n * @returns URL or path without query string or fragment\n */\nexport function stripUrlQueryAndFragment(urlPath: string): string {\n // eslint-disable-next-line no-useless-escape\n return urlPath.split(/[\\?#]/, 1)[0];\n}\n\n/**\n * Returns number of URL segments of a passed string URL.\n */\nexport function getNumberOfUrlSegments(url: string): number {\n // split at '/' or at '\\/' to split regex urls correctly\n return url.split(/\\\\?\\//).filter(s => s.length > 0 && s !== ',').length;\n}\n\n/**\n * Takes a URL object and returns a sanitized string which is safe to use as span description\n * see: https://develop.sentry.dev/sdk/data-handling/#structuring-data\n */\nexport function getSanitizedUrlString(url: PartialURL): string {\n const { protocol, host, path } = url;\n\n const filteredHost =\n (host &&\n host\n // Always filter out authority\n .replace(/^.*@/, '[filtered]:[filtered]@')\n // Don't show standard :80 (http) and :443 (https) ports to reduce the noise\n // TODO: Use new URL global if it exists\n .replace(/(:80)$/, '')\n .replace(/(:443)$/, '')) ||\n '';\n\n return `${protocol ? `${protocol}://` : ''}${filteredHost}${path}`;\n}\n", "import type {\n Event,\n ExtractedNodeRequestData,\n PolymorphicRequest,\n Transaction,\n TransactionSource,\n WebFetchHeaders,\n WebFetchRequest,\n} from '@sentry/types';\n\nimport { parseCookie } from './cookie';\nimport { DEBUG_BUILD } from './debug-build';\nimport { isPlainObject, isString } from './is';\nimport { logger } from './logger';\nimport { normalize } from './normalize';\nimport { stripUrlQueryAndFragment } from './url';\n\nconst DEFAULT_INCLUDES = {\n ip: false,\n request: true,\n transaction: true,\n user: true,\n};\nconst DEFAULT_REQUEST_INCLUDES = ['cookies', 'data', 'headers', 'method', 'query_string', 'url'];\nexport const DEFAULT_USER_INCLUDES = ['id', 'username', 'email'];\n\ntype InjectedNodeDeps = {\n cookie: {\n parse: (cookieStr: string) => Record;\n };\n url: {\n parse: (urlStr: string) => {\n query: string | null;\n };\n };\n};\n\n/**\n * Options deciding what parts of the request to use when enhancing an event\n */\nexport type AddRequestDataToEventOptions = {\n /** Flags controlling whether each type of data should be added to the event */\n include?: {\n ip?: boolean;\n request?: boolean | Array<(typeof DEFAULT_REQUEST_INCLUDES)[number]>;\n transaction?: boolean | TransactionNamingScheme;\n user?: boolean | Array<(typeof DEFAULT_USER_INCLUDES)[number]>;\n };\n\n /** Injected platform-specific dependencies */\n deps?: {\n cookie: {\n parse: (cookieStr: string) => Record;\n };\n url: {\n parse: (urlStr: string) => {\n query: string | null;\n };\n };\n };\n};\n\nexport type TransactionNamingScheme = 'path' | 'methodPath' | 'handler';\n\n/**\n * Sets parameterized route as transaction name e.g.: `GET /users/:id`\n * Also adds more context data on the transaction from the request.\n *\n * @deprecated This utility will be removed in v8.\n */\nexport function addRequestDataToTransaction(\n transaction: Transaction | undefined,\n req: PolymorphicRequest,\n deps?: InjectedNodeDeps,\n): void {\n if (!transaction) return;\n // eslint-disable-next-line deprecation/deprecation\n if (!transaction.metadata.source || transaction.metadata.source === 'url') {\n // Attempt to grab a parameterized route off of the request\n const [name, source] = extractPathForTransaction(req, { path: true, method: true });\n transaction.updateName(name);\n // TODO: SEMANTIC_ATTRIBUTE_SENTRY_SOURCE is in core, align this once we merge utils & core\n // eslint-disable-next-line deprecation/deprecation\n transaction.setMetadata({ source });\n }\n transaction.setAttribute('url', req.originalUrl || req.url);\n if (req.baseUrl) {\n transaction.setAttribute('baseUrl', req.baseUrl);\n }\n // TODO: We need to rewrite this to a flat format?\n // eslint-disable-next-line deprecation/deprecation\n transaction.setData('query', extractQueryParams(req, deps));\n}\n\n/**\n * Extracts a complete and parameterized path from the request object and uses it to construct transaction name.\n * If the parameterized transaction name cannot be extracted, we fall back to the raw URL.\n *\n * Additionally, this function determines and returns the transaction name source\n *\n * eg. GET /mountpoint/user/:id\n *\n * @param req A request object\n * @param options What to include in the transaction name (method, path, or a custom route name to be\n * used instead of the request's route)\n *\n * @returns A tuple of the fully constructed transaction name [0] and its source [1] (can be either 'route' or 'url')\n */\nexport function extractPathForTransaction(\n req: PolymorphicRequest,\n options: { path?: boolean; method?: boolean; customRoute?: string } = {},\n): [string, TransactionSource] {\n const method = req.method && req.method.toUpperCase();\n\n let path = '';\n let source: TransactionSource = 'url';\n\n // Check to see if there's a parameterized route we can use (as there is in Express)\n if (options.customRoute || req.route) {\n path = options.customRoute || `${req.baseUrl || ''}${req.route && req.route.path}`;\n source = 'route';\n }\n\n // Otherwise, just take the original URL\n else if (req.originalUrl || req.url) {\n path = stripUrlQueryAndFragment(req.originalUrl || req.url || '');\n }\n\n let name = '';\n if (options.method && method) {\n name += method;\n }\n if (options.method && options.path) {\n name += ' ';\n }\n if (options.path && path) {\n name += path;\n }\n\n return [name, source];\n}\n\n/** JSDoc */\nfunction extractTransaction(req: PolymorphicRequest, type: boolean | TransactionNamingScheme): string {\n switch (type) {\n case 'path': {\n return extractPathForTransaction(req, { path: true })[0];\n }\n case 'handler': {\n return (req.route && req.route.stack && req.route.stack[0] && req.route.stack[0].name) || '';\n }\n case 'methodPath':\n default: {\n // if exist _reconstructedRoute return that path instead of route.path\n const customRoute = req._reconstructedRoute ? req._reconstructedRoute : undefined;\n return extractPathForTransaction(req, { path: true, method: true, customRoute })[0];\n }\n }\n}\n\n/** JSDoc */\nfunction extractUserData(\n user: {\n [key: string]: unknown;\n },\n keys: boolean | string[],\n): { [key: string]: unknown } {\n const extractedUser: { [key: string]: unknown } = {};\n const attributes = Array.isArray(keys) ? keys : DEFAULT_USER_INCLUDES;\n\n attributes.forEach(key => {\n if (user && key in user) {\n extractedUser[key] = user[key];\n }\n });\n\n return extractedUser;\n}\n\n/**\n * Normalize data from the request object, accounting for framework differences.\n *\n * @param req The request object from which to extract data\n * @param options.include An optional array of keys to include in the normalized data. Defaults to\n * DEFAULT_REQUEST_INCLUDES if not provided.\n * @param options.deps Injected, platform-specific dependencies\n * @returns An object containing normalized request data\n */\nexport function extractRequestData(\n req: PolymorphicRequest,\n options?: {\n include?: string[];\n deps?: InjectedNodeDeps;\n },\n): ExtractedNodeRequestData {\n const { include = DEFAULT_REQUEST_INCLUDES, deps } = options || {};\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const requestData: { [key: string]: any } = {};\n\n // headers:\n // node, express, koa, nextjs: req.headers\n const headers = (req.headers || {}) as {\n host?: string;\n cookie?: string;\n };\n // method:\n // node, express, koa, nextjs: req.method\n const method = req.method;\n // host:\n // express: req.hostname in > 4 and req.host in < 4\n // koa: req.host\n // node, nextjs: req.headers.host\n // Express 4 mistakenly strips off port number from req.host / req.hostname so we can't rely on them\n // See: https://github.com/expressjs/express/issues/3047#issuecomment-236653223\n // Also: https://github.com/getsentry/sentry-javascript/issues/1917\n const host = headers.host || req.hostname || req.host || '';\n // protocol:\n // node, nextjs: \n // express, koa: req.protocol\n const protocol = req.protocol === 'https' || (req.socket && req.socket.encrypted) ? 'https' : 'http';\n // url (including path and query string):\n // node, express: req.originalUrl\n // koa, nextjs: req.url\n const originalUrl = req.originalUrl || req.url || '';\n // absolute url\n const absoluteUrl = originalUrl.startsWith(protocol) ? originalUrl : `${protocol}://${host}${originalUrl}`;\n include.forEach(key => {\n switch (key) {\n case 'headers': {\n requestData.headers = headers;\n\n // Remove the Cookie header in case cookie data should not be included in the event\n if (!include.includes('cookies')) {\n delete (requestData.headers as { cookie?: string }).cookie;\n }\n\n break;\n }\n case 'method': {\n requestData.method = method;\n break;\n }\n case 'url': {\n requestData.url = absoluteUrl;\n break;\n }\n case 'cookies': {\n // cookies:\n // node, express, koa: req.headers.cookie\n // vercel, sails.js, express (w/ cookie middleware), nextjs: req.cookies\n requestData.cookies =\n // TODO (v8 / #5257): We're only sending the empty object for backwards compatibility, so the last bit can\n // come off in v8\n req.cookies || (headers.cookie && parseCookie(headers.cookie)) || {};\n break;\n }\n case 'query_string': {\n // query string:\n // node: req.url (raw)\n // express, koa, nextjs: req.query\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n requestData.query_string = extractQueryParams(req, deps);\n break;\n }\n case 'data': {\n if (method === 'GET' || method === 'HEAD') {\n break;\n }\n // body data:\n // express, koa, nextjs: req.body\n //\n // when using node by itself, you have to read the incoming stream(see\n // https://nodejs.dev/learn/get-http-request-body-data-using-nodejs); if a user is doing that, we can't know\n // where they're going to store the final result, so they'll have to capture this data themselves\n if (req.body !== undefined) {\n requestData.data = isString(req.body) ? req.body : JSON.stringify(normalize(req.body));\n }\n break;\n }\n default: {\n if ({}.hasOwnProperty.call(req, key)) {\n requestData[key] = (req as { [key: string]: unknown })[key];\n }\n }\n }\n });\n\n return requestData;\n}\n\n/**\n * Add data from the given request to the given event\n *\n * @param event The event to which the request data will be added\n * @param req Request object\n * @param options.include Flags to control what data is included\n * @param options.deps Injected platform-specific dependencies\n * @returns The mutated `Event` object\n */\nexport function addRequestDataToEvent(\n event: Event,\n req: PolymorphicRequest,\n options?: AddRequestDataToEventOptions,\n): Event {\n const include = {\n ...DEFAULT_INCLUDES,\n ...(options && options.include),\n };\n\n if (include.request) {\n const extractedRequestData = Array.isArray(include.request)\n ? extractRequestData(req, { include: include.request, deps: options && options.deps })\n : extractRequestData(req, { deps: options && options.deps });\n\n event.request = {\n ...event.request,\n ...extractedRequestData,\n };\n }\n\n if (include.user) {\n const extractedUser = req.user && isPlainObject(req.user) ? extractUserData(req.user, include.user) : {};\n\n if (Object.keys(extractedUser).length) {\n event.user = {\n ...event.user,\n ...extractedUser,\n };\n }\n }\n\n // client ip:\n // node, nextjs: req.socket.remoteAddress\n // express, koa: req.ip\n if (include.ip) {\n const ip = req.ip || (req.socket && req.socket.remoteAddress);\n if (ip) {\n event.user = {\n ...event.user,\n ip_address: ip,\n };\n }\n }\n\n if (include.transaction && !event.transaction) {\n // TODO do we even need this anymore?\n // TODO make this work for nextjs\n event.transaction = extractTransaction(req, include.transaction);\n }\n\n return event;\n}\n\nfunction extractQueryParams(\n req: PolymorphicRequest,\n deps?: InjectedNodeDeps,\n): string | Record | undefined {\n // url (including path and query string):\n // node, express: req.originalUrl\n // koa, nextjs: req.url\n let originalUrl = req.originalUrl || req.url || '';\n\n if (!originalUrl) {\n return;\n }\n\n // The `URL` constructor can't handle internal URLs of the form `/some/path/here`, so stick a dummy protocol and\n // hostname on the beginning. Since the point here is just to grab the query string, it doesn't matter what we use.\n if (originalUrl.startsWith('/')) {\n originalUrl = `http://dogs.are.great${originalUrl}`;\n }\n\n try {\n return (\n req.query ||\n (typeof URL !== 'undefined' && new URL(originalUrl).search.slice(1)) ||\n // In Node 8, `URL` isn't in the global scope, so we have to use the built-in module from Node\n (deps && deps.url && deps.url.parse(originalUrl).query) ||\n undefined\n );\n } catch {\n return undefined;\n }\n}\n\n/**\n * Transforms a `Headers` object that implements the `Web Fetch API` (https://developer.mozilla.org/en-US/docs/Web/API/Headers) into a simple key-value dict.\n * The header keys will be lower case: e.g. A \"Content-Type\" header will be stored as \"content-type\".\n */\n// TODO(v8): Make this function return undefined when the extraction fails.\nexport function winterCGHeadersToDict(winterCGHeaders: WebFetchHeaders): Record {\n const headers: Record = {};\n try {\n winterCGHeaders.forEach((value, key) => {\n if (typeof value === 'string') {\n // We check that value is a string even though it might be redundant to make sure prototype pollution is not possible.\n headers[key] = value;\n }\n });\n } catch (e) {\n DEBUG_BUILD &&\n logger.warn('Sentry failed extracting headers from a request object. If you see this, please file an issue.');\n }\n\n return headers;\n}\n\n/**\n * Converts a `Request` object that implements the `Web Fetch API` (https://developer.mozilla.org/en-US/docs/Web/API/Headers) into the format that the `RequestData` integration understands.\n */\nexport function winterCGRequestToRequestData(req: WebFetchRequest): PolymorphicRequest {\n const headers = winterCGHeadersToDict(req.headers);\n return {\n method: req.method,\n url: req.url,\n headers,\n };\n}\n", "/* eslint-disable deprecation/deprecation */\nimport type { Severity, SeverityLevel } from '@sentry/types';\n\n// Note: Ideally the `SeverityLevel` type would be derived from `validSeverityLevels`, but that would mean either\n//\n// a) moving `validSeverityLevels` to `@sentry/types`,\n// b) moving the`SeverityLevel` type here, or\n// c) importing `validSeverityLevels` from here into `@sentry/types`.\n//\n// Option A would make `@sentry/types` a runtime dependency of `@sentry/utils` (not good), and options B and C would\n// create a circular dependency between `@sentry/types` and `@sentry/utils` (also not good). So a TODO accompanying the\n// type, reminding anyone who changes it to change this list also, will have to do.\n\nexport const validSeverityLevels = ['fatal', 'error', 'warning', 'log', 'info', 'debug'];\n\n/**\n * Converts a string-based level into a member of the deprecated {@link Severity} enum.\n *\n * @deprecated `severityFromString` is deprecated. Please use `severityLevelFromString` instead.\n *\n * @param level String representation of Severity\n * @returns Severity\n */\nexport function severityFromString(level: Severity | SeverityLevel | string): Severity {\n return severityLevelFromString(level) as Severity;\n}\n\n/**\n * Converts a string-based level into a `SeverityLevel`, normalizing it along the way.\n *\n * @param level String representation of desired `SeverityLevel`.\n * @returns The `SeverityLevel` corresponding to the given string, or 'log' if the string isn't a valid level.\n */\nexport function severityLevelFromString(level: SeverityLevel | string): SeverityLevel {\n return (level === 'warn' ? 'warning' : validSeverityLevels.includes(level) ? level : 'log') as SeverityLevel;\n}\n", "import { GLOBAL_OBJ } from './worldwide';\n\nconst ONE_SECOND_IN_MS = 1000;\n\n/**\n * A partial definition of the [Performance Web API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Performance}\n * for accessing a high-resolution monotonic clock.\n */\ninterface Performance {\n /**\n * The millisecond timestamp at which measurement began, measured in Unix time.\n */\n timeOrigin: number;\n /**\n * Returns the current millisecond timestamp, where 0 represents the start of measurement.\n */\n now(): number;\n}\n\n/**\n * Returns a timestamp in seconds since the UNIX epoch using the Date API.\n *\n * TODO(v8): Return type should be rounded.\n */\nexport function dateTimestampInSeconds(): number {\n return Date.now() / ONE_SECOND_IN_MS;\n}\n\n/**\n * Returns a wrapper around the native Performance API browser implementation, or undefined for browsers that do not\n * support the API.\n *\n * Wrapping the native API works around differences in behavior from different browsers.\n */\nfunction createUnixTimestampInSecondsFunc(): () => number {\n const { performance } = GLOBAL_OBJ as typeof GLOBAL_OBJ & { performance?: Performance };\n if (!performance || !performance.now) {\n return dateTimestampInSeconds;\n }\n\n // Some browser and environments don't have a timeOrigin, so we fallback to\n // using Date.now() to compute the starting time.\n const approxStartingTimeOrigin = Date.now() - performance.now();\n const timeOrigin = performance.timeOrigin == undefined ? approxStartingTimeOrigin : performance.timeOrigin;\n\n // performance.now() is a monotonic clock, which means it starts at 0 when the process begins. To get the current\n // wall clock time (actual UNIX timestamp), we need to add the starting time origin and the current time elapsed.\n //\n // TODO: This does not account for the case where the monotonic clock that powers performance.now() drifts from the\n // wall clock time, which causes the returned timestamp to be inaccurate. We should investigate how to detect and\n // correct for this.\n // See: https://github.com/getsentry/sentry-javascript/issues/2590\n // See: https://github.com/mdn/content/issues/4713\n // See: https://dev.to/noamr/when-a-millisecond-is-not-a-millisecond-3h6\n return () => {\n return (timeOrigin + performance.now()) / ONE_SECOND_IN_MS;\n };\n}\n\n/**\n * Returns a timestamp in seconds since the UNIX epoch using either the Performance or Date APIs, depending on the\n * availability of the Performance API.\n *\n * BUG: Note that because of how browsers implement the Performance API, the clock might stop when the computer is\n * asleep. This creates a skew between `dateTimestampInSeconds` and `timestampInSeconds`. The\n * skew can grow to arbitrary amounts like days, weeks or months.\n * See https://github.com/getsentry/sentry-javascript/issues/2590.\n */\nexport const timestampInSeconds = createUnixTimestampInSecondsFunc();\n\n/**\n * Re-exported with an old name for backwards-compatibility.\n * TODO (v8): Remove this\n *\n * @deprecated Use `timestampInSeconds` instead.\n */\nexport const timestampWithMs = timestampInSeconds;\n\n/**\n * Internal helper to store what is the source of browserPerformanceTimeOrigin below. For debugging only.\n */\nexport let _browserPerformanceTimeOriginMode: string;\n\n/**\n * The number of milliseconds since the UNIX epoch. This value is only usable in a browser, and only when the\n * performance API is available.\n */\nexport const browserPerformanceTimeOrigin = ((): number | undefined => {\n // Unfortunately browsers may report an inaccurate time origin data, through either performance.timeOrigin or\n // performance.timing.navigationStart, which results in poor results in performance data. We only treat time origin\n // data as reliable if they are within a reasonable threshold of the current time.\n\n const { performance } = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window;\n if (!performance || !performance.now) {\n _browserPerformanceTimeOriginMode = 'none';\n return undefined;\n }\n\n const threshold = 3600 * 1000;\n const performanceNow = performance.now();\n const dateNow = Date.now();\n\n // if timeOrigin isn't available set delta to threshold so it isn't used\n const timeOriginDelta = performance.timeOrigin\n ? Math.abs(performance.timeOrigin + performanceNow - dateNow)\n : threshold;\n const timeOriginIsReliable = timeOriginDelta < threshold;\n\n // While performance.timing.navigationStart is deprecated in favor of performance.timeOrigin, performance.timeOrigin\n // is not as widely supported. Namely, performance.timeOrigin is undefined in Safari as of writing.\n // Also as of writing, performance.timing is not available in Web Workers in mainstream browsers, so it is not always\n // a valid fallback. In the absence of an initial time provided by the browser, fallback to the current time from the\n // Date API.\n // eslint-disable-next-line deprecation/deprecation\n const navigationStart = performance.timing && performance.timing.navigationStart;\n const hasNavigationStart = typeof navigationStart === 'number';\n // if navigationStart isn't available set delta to threshold so it isn't used\n const navigationStartDelta = hasNavigationStart ? Math.abs(navigationStart + performanceNow - dateNow) : threshold;\n const navigationStartIsReliable = navigationStartDelta < threshold;\n\n if (timeOriginIsReliable || navigationStartIsReliable) {\n // Use the more reliable time origin\n if (timeOriginDelta <= navigationStartDelta) {\n _browserPerformanceTimeOriginMode = 'timeOrigin';\n return performance.timeOrigin;\n } else {\n _browserPerformanceTimeOriginMode = 'navigationStart';\n return navigationStart;\n }\n }\n\n // Either both timeOrigin and navigationStart are skewed or neither is available, fallback to Date.\n _browserPerformanceTimeOriginMode = 'dateNow';\n return dateNow;\n})();\n", "import type { DynamicSamplingContext } from '@sentry/types';\n\nimport { DEBUG_BUILD } from './debug-build';\nimport { isString } from './is';\nimport { logger } from './logger';\n\nexport const BAGGAGE_HEADER_NAME = 'baggage';\n\nexport const SENTRY_BAGGAGE_KEY_PREFIX = 'sentry-';\n\nexport const SENTRY_BAGGAGE_KEY_PREFIX_REGEX = /^sentry-/;\n\n/**\n * Max length of a serialized baggage string\n *\n * https://www.w3.org/TR/baggage/#limits\n */\nexport const MAX_BAGGAGE_STRING_LENGTH = 8192;\n\n/**\n * Takes a baggage header and turns it into Dynamic Sampling Context, by extracting all the \"sentry-\" prefixed values\n * from it.\n *\n * @param baggageHeader A very bread definition of a baggage header as it might appear in various frameworks.\n * @returns The Dynamic Sampling Context that was found on `baggageHeader`, if there was any, `undefined` otherwise.\n */\nexport function baggageHeaderToDynamicSamplingContext(\n // Very liberal definition of what any incoming header might look like\n baggageHeader: string | string[] | number | null | undefined | boolean,\n): Partial | undefined {\n if (!isString(baggageHeader) && !Array.isArray(baggageHeader)) {\n return undefined;\n }\n\n // Intermediary object to store baggage key value pairs of incoming baggage headers on.\n // It is later used to read Sentry-DSC-values from.\n let baggageObject: Readonly> = {};\n\n if (Array.isArray(baggageHeader)) {\n // Combine all baggage headers into one object containing the baggage values so we can later read the Sentry-DSC-values from it\n baggageObject = baggageHeader.reduce>((acc, curr) => {\n const currBaggageObject = baggageHeaderToObject(curr);\n for (const key of Object.keys(currBaggageObject)) {\n acc[key] = currBaggageObject[key];\n }\n return acc;\n }, {});\n } else {\n // Return undefined if baggage header is an empty string (technically an empty baggage header is not spec conform but\n // this is how we choose to handle it)\n if (!baggageHeader) {\n return undefined;\n }\n\n baggageObject = baggageHeaderToObject(baggageHeader);\n }\n\n // Read all \"sentry-\" prefixed values out of the baggage object and put it onto a dynamic sampling context object.\n const dynamicSamplingContext = Object.entries(baggageObject).reduce>((acc, [key, value]) => {\n if (key.match(SENTRY_BAGGAGE_KEY_PREFIX_REGEX)) {\n const nonPrefixedKey = key.slice(SENTRY_BAGGAGE_KEY_PREFIX.length);\n acc[nonPrefixedKey] = value;\n }\n return acc;\n }, {});\n\n // Only return a dynamic sampling context object if there are keys in it.\n // A keyless object means there were no sentry values on the header, which means that there is no DSC.\n if (Object.keys(dynamicSamplingContext).length > 0) {\n return dynamicSamplingContext as Partial;\n } else {\n return undefined;\n }\n}\n\n/**\n * Turns a Dynamic Sampling Object into a baggage header by prefixing all the keys on the object with \"sentry-\".\n *\n * @param dynamicSamplingContext The Dynamic Sampling Context to turn into a header. For convenience and compatibility\n * with the `getDynamicSamplingContext` method on the Transaction class ,this argument can also be `undefined`. If it is\n * `undefined` the function will return `undefined`.\n * @returns a baggage header, created from `dynamicSamplingContext`, or `undefined` either if `dynamicSamplingContext`\n * was `undefined`, or if `dynamicSamplingContext` didn't contain any values.\n */\nexport function dynamicSamplingContextToSentryBaggageHeader(\n // this also takes undefined for convenience and bundle size in other places\n dynamicSamplingContext?: Partial,\n): string | undefined {\n if (!dynamicSamplingContext) {\n return undefined;\n }\n\n // Prefix all DSC keys with \"sentry-\" and put them into a new object\n const sentryPrefixedDSC = Object.entries(dynamicSamplingContext).reduce>(\n (acc, [dscKey, dscValue]) => {\n if (dscValue) {\n acc[`${SENTRY_BAGGAGE_KEY_PREFIX}${dscKey}`] = dscValue;\n }\n return acc;\n },\n {},\n );\n\n return objectToBaggageHeader(sentryPrefixedDSC);\n}\n\n/**\n * Will parse a baggage header, which is a simple key-value map, into a flat object.\n *\n * @param baggageHeader The baggage header to parse.\n * @returns a flat object containing all the key-value pairs from `baggageHeader`.\n */\nfunction baggageHeaderToObject(baggageHeader: string): Record {\n return baggageHeader\n .split(',')\n .map(baggageEntry => baggageEntry.split('=').map(keyOrValue => decodeURIComponent(keyOrValue.trim())))\n .reduce>((acc, [key, value]) => {\n acc[key] = value;\n return acc;\n }, {});\n}\n\n/**\n * Turns a flat object (key-value pairs) into a baggage header, which is also just key-value pairs.\n *\n * @param object The object to turn into a baggage header.\n * @returns a baggage header string, or `undefined` if the object didn't have any values, since an empty baggage header\n * is not spec compliant.\n */\nfunction objectToBaggageHeader(object: Record): string | undefined {\n if (Object.keys(object).length === 0) {\n // An empty baggage header is not spec compliant: We return undefined.\n return undefined;\n }\n\n return Object.entries(object).reduce((baggageHeader, [objectKey, objectValue], currentIndex) => {\n const baggageEntry = `${encodeURIComponent(objectKey)}=${encodeURIComponent(objectValue)}`;\n const newBaggageHeader = currentIndex === 0 ? baggageEntry : `${baggageHeader},${baggageEntry}`;\n if (newBaggageHeader.length > MAX_BAGGAGE_STRING_LENGTH) {\n DEBUG_BUILD &&\n logger.warn(\n `Not adding key: ${objectKey} with val: ${objectValue} to baggage header due to exceeding baggage size limits.`,\n );\n return baggageHeader;\n } else {\n return newBaggageHeader;\n }\n }, '');\n}\n", "import type { PropagationContext, TraceparentData } from '@sentry/types';\n\nimport { baggageHeaderToDynamicSamplingContext } from './baggage';\nimport { uuid4 } from './misc';\n\n// eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor -- RegExp is used for readability here\nexport const TRACEPARENT_REGEXP = new RegExp(\n '^[ \\\\t]*' + // whitespace\n '([0-9a-f]{32})?' + // trace_id\n '-?([0-9a-f]{16})?' + // span_id\n '-?([01])?' + // sampled\n '[ \\\\t]*$', // whitespace\n);\n\n/**\n * Extract transaction context data from a `sentry-trace` header.\n *\n * @param traceparent Traceparent string\n *\n * @returns Object containing data from the header, or undefined if traceparent string is malformed\n */\nexport function extractTraceparentData(traceparent?: string): TraceparentData | undefined {\n if (!traceparent) {\n return undefined;\n }\n\n const matches = traceparent.match(TRACEPARENT_REGEXP);\n if (!matches) {\n return undefined;\n }\n\n let parentSampled: boolean | undefined;\n if (matches[3] === '1') {\n parentSampled = true;\n } else if (matches[3] === '0') {\n parentSampled = false;\n }\n\n return {\n traceId: matches[1],\n parentSampled,\n parentSpanId: matches[2],\n };\n}\n\n/**\n * Create tracing context from incoming headers.\n *\n * @deprecated Use `propagationContextFromHeaders` instead.\n */\n// TODO(v8): Remove this function\nexport function tracingContextFromHeaders(\n sentryTrace: Parameters[0],\n baggage: Parameters[0],\n): {\n traceparentData: ReturnType;\n dynamicSamplingContext: ReturnType;\n propagationContext: PropagationContext;\n} {\n const traceparentData = extractTraceparentData(sentryTrace);\n const dynamicSamplingContext = baggageHeaderToDynamicSamplingContext(baggage);\n\n const { traceId, parentSpanId, parentSampled } = traceparentData || {};\n\n if (!traceparentData) {\n return {\n traceparentData,\n dynamicSamplingContext: undefined,\n propagationContext: {\n traceId: traceId || uuid4(),\n spanId: uuid4().substring(16),\n },\n };\n } else {\n return {\n traceparentData,\n dynamicSamplingContext: dynamicSamplingContext || {}, // If we have traceparent data but no DSC it means we are not head of trace and we must freeze it\n propagationContext: {\n traceId: traceId || uuid4(),\n parentSpanId: parentSpanId || uuid4().substring(16),\n spanId: uuid4().substring(16),\n sampled: parentSampled,\n dsc: dynamicSamplingContext || {}, // If we have traceparent data but no DSC it means we are not head of trace and we must freeze it\n },\n };\n }\n}\n\n/**\n * Create a propagation context from incoming headers.\n */\nexport function propagationContextFromHeaders(\n sentryTrace: string | undefined,\n baggage: string | number | boolean | string[] | null | undefined,\n): PropagationContext {\n const traceparentData = extractTraceparentData(sentryTrace);\n const dynamicSamplingContext = baggageHeaderToDynamicSamplingContext(baggage);\n\n const { traceId, parentSpanId, parentSampled } = traceparentData || {};\n\n if (!traceparentData) {\n return {\n traceId: traceId || uuid4(),\n spanId: uuid4().substring(16),\n };\n } else {\n return {\n traceId: traceId || uuid4(),\n parentSpanId: parentSpanId || uuid4().substring(16),\n spanId: uuid4().substring(16),\n sampled: parentSampled,\n dsc: dynamicSamplingContext || {}, // If we have traceparent data but no DSC it means we are not head of trace and we must freeze it\n };\n }\n}\n\n/**\n * Create sentry-trace header from span context values.\n */\nexport function generateSentryTraceHeader(\n traceId: string = uuid4(),\n spanId: string = uuid4().substring(16),\n sampled?: boolean,\n): string {\n let sampledString = '';\n if (sampled !== undefined) {\n sampledString = sampled ? '-1' : '-0';\n }\n return `${traceId}-${spanId}${sampledString}`;\n}\n", "import type {\n Attachment,\n AttachmentItem,\n BaseEnvelopeHeaders,\n BaseEnvelopeItemHeaders,\n DataCategory,\n DsnComponents,\n Envelope,\n EnvelopeItemType,\n Event,\n EventEnvelopeHeaders,\n SdkInfo,\n SdkMetadata,\n TextEncoderInternal,\n} from '@sentry/types';\n\nimport { dsnToString } from './dsn';\nimport { normalize } from './normalize';\nimport { dropUndefinedKeys } from './object';\n\n/**\n * Creates an envelope.\n * Make sure to always explicitly provide the generic to this function\n * so that the envelope types resolve correctly.\n */\nexport function createEnvelope(headers: E[0], items: E[1] = []): E {\n return [headers, items] as E;\n}\n\n/**\n * Add an item to an envelope.\n * Make sure to always explicitly provide the generic to this function\n * so that the envelope types resolve correctly.\n */\nexport function addItemToEnvelope(envelope: E, newItem: E[1][number]): E {\n const [headers, items] = envelope;\n return [headers, [...items, newItem]] as unknown as E;\n}\n\n/**\n * Convenience function to loop through the items and item types of an envelope.\n * (This function was mostly created because working with envelope types is painful at the moment)\n *\n * If the callback returns true, the rest of the items will be skipped.\n */\nexport function forEachEnvelopeItem(\n envelope: Envelope,\n callback: (envelopeItem: E[1][number], envelopeItemType: E[1][number][0]['type']) => boolean | void,\n): boolean {\n const envelopeItems = envelope[1];\n\n for (const envelopeItem of envelopeItems) {\n const envelopeItemType = envelopeItem[0].type;\n const result = callback(envelopeItem, envelopeItemType);\n\n if (result) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Returns true if the envelope contains any of the given envelope item types\n */\nexport function envelopeContainsItemType(envelope: Envelope, types: EnvelopeItemType[]): boolean {\n return forEachEnvelopeItem(envelope, (_, type) => types.includes(type));\n}\n\n/**\n * Encode a string to UTF8.\n */\nfunction encodeUTF8(input: string, textEncoder?: TextEncoderInternal): Uint8Array {\n const utf8 = textEncoder || new TextEncoder();\n return utf8.encode(input);\n}\n\n/**\n * Serializes an envelope.\n */\nexport function serializeEnvelope(envelope: Envelope, textEncoder?: TextEncoderInternal): string | Uint8Array {\n const [envHeaders, items] = envelope;\n\n // Initially we construct our envelope as a string and only convert to binary chunks if we encounter binary data\n let parts: string | Uint8Array[] = JSON.stringify(envHeaders);\n\n function append(next: string | Uint8Array): void {\n if (typeof parts === 'string') {\n parts = typeof next === 'string' ? parts + next : [encodeUTF8(parts, textEncoder), next];\n } else {\n parts.push(typeof next === 'string' ? encodeUTF8(next, textEncoder) : next);\n }\n }\n\n for (const item of items) {\n const [itemHeaders, payload] = item;\n\n append(`\\n${JSON.stringify(itemHeaders)}\\n`);\n\n if (typeof payload === 'string' || payload instanceof Uint8Array) {\n append(payload);\n } else {\n let stringifiedPayload: string;\n try {\n stringifiedPayload = JSON.stringify(payload);\n } catch (e) {\n // In case, despite all our efforts to keep `payload` circular-dependency-free, `JSON.strinify()` still\n // fails, we try again after normalizing it again with infinite normalization depth. This of course has a\n // performance impact but in this case a performance hit is better than throwing.\n stringifiedPayload = JSON.stringify(normalize(payload));\n }\n append(stringifiedPayload);\n }\n }\n\n return typeof parts === 'string' ? parts : concatBuffers(parts);\n}\n\nfunction concatBuffers(buffers: Uint8Array[]): Uint8Array {\n const totalLength = buffers.reduce((acc, buf) => acc + buf.length, 0);\n\n const merged = new Uint8Array(totalLength);\n let offset = 0;\n for (const buffer of buffers) {\n merged.set(buffer, offset);\n offset += buffer.length;\n }\n\n return merged;\n}\n\nexport interface TextDecoderInternal {\n decode(input?: Uint8Array): string;\n}\n\n/**\n * Parses an envelope\n */\nexport function parseEnvelope(\n env: string | Uint8Array,\n textEncoder: TextEncoderInternal,\n textDecoder: TextDecoderInternal,\n): Envelope {\n let buffer = typeof env === 'string' ? textEncoder.encode(env) : env;\n\n function readBinary(length: number): Uint8Array {\n const bin = buffer.subarray(0, length);\n // Replace the buffer with the remaining data excluding trailing newline\n buffer = buffer.subarray(length + 1);\n return bin;\n }\n\n function readJson(): T {\n let i = buffer.indexOf(0xa);\n // If we couldn't find a newline, we must have found the end of the buffer\n if (i < 0) {\n i = buffer.length;\n }\n\n return JSON.parse(textDecoder.decode(readBinary(i))) as T;\n }\n\n const envelopeHeader = readJson();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const items: [any, any][] = [];\n\n while (buffer.length) {\n const itemHeader = readJson();\n const binaryLength = typeof itemHeader.length === 'number' ? itemHeader.length : undefined;\n\n items.push([itemHeader, binaryLength ? readBinary(binaryLength) : readJson()]);\n }\n\n return [envelopeHeader, items];\n}\n\n/**\n * Creates attachment envelope items\n */\nexport function createAttachmentEnvelopeItem(\n attachment: Attachment,\n textEncoder?: TextEncoderInternal,\n): AttachmentItem {\n const buffer = typeof attachment.data === 'string' ? encodeUTF8(attachment.data, textEncoder) : attachment.data;\n\n return [\n dropUndefinedKeys({\n type: 'attachment',\n length: buffer.length,\n filename: attachment.filename,\n content_type: attachment.contentType,\n attachment_type: attachment.attachmentType,\n }),\n buffer,\n ];\n}\n\nconst ITEM_TYPE_TO_DATA_CATEGORY_MAP: Record = {\n session: 'session',\n sessions: 'session',\n attachment: 'attachment',\n transaction: 'transaction',\n event: 'error',\n client_report: 'internal',\n user_report: 'default',\n profile: 'profile',\n replay_event: 'replay',\n replay_recording: 'replay',\n check_in: 'monitor',\n feedback: 'feedback',\n span: 'span',\n statsd: 'metric_bucket',\n};\n\n/**\n * Maps the type of an envelope item to a data category.\n */\nexport function envelopeItemTypeToDataCategory(type: EnvelopeItemType): DataCategory {\n return ITEM_TYPE_TO_DATA_CATEGORY_MAP[type];\n}\n\n/** Extracts the minimal SDK info from the metadata or an events */\nexport function getSdkMetadataForEnvelopeHeader(metadataOrEvent?: SdkMetadata | Event): SdkInfo | undefined {\n if (!metadataOrEvent || !metadataOrEvent.sdk) {\n return;\n }\n const { name, version } = metadataOrEvent.sdk;\n return { name, version };\n}\n\n/**\n * Creates event envelope headers, based on event, sdk info and tunnel\n * Note: This function was extracted from the core package to make it available in Replay\n */\nexport function createEventEnvelopeHeaders(\n event: Event,\n sdkInfo: SdkInfo | undefined,\n tunnel: string | undefined,\n dsn?: DsnComponents,\n): EventEnvelopeHeaders {\n const dynamicSamplingContext = event.sdkProcessingMetadata && event.sdkProcessingMetadata.dynamicSamplingContext;\n return {\n event_id: event.event_id as string,\n sent_at: new Date().toISOString(),\n ...(sdkInfo && { sdk: sdkInfo }),\n ...(!!tunnel && dsn && { dsn: dsnToString(dsn) }),\n ...(dynamicSamplingContext && {\n trace: dropUndefinedKeys({ ...dynamicSamplingContext }),\n }),\n };\n}\n", "import type { ClientReport, ClientReportEnvelope, ClientReportItem } from '@sentry/types';\n\nimport { createEnvelope } from './envelope';\nimport { dateTimestampInSeconds } from './time';\n\n/**\n * Creates client report envelope\n * @param discarded_events An array of discard events\n * @param dsn A DSN that can be set on the header. Optional.\n */\nexport function createClientReportEnvelope(\n discarded_events: ClientReport['discarded_events'],\n dsn?: string,\n timestamp?: number,\n): ClientReportEnvelope {\n const clientReportItem: ClientReportItem = [\n { type: 'client_report' },\n {\n timestamp: timestamp || dateTimestampInSeconds(),\n discarded_events,\n },\n ];\n return createEnvelope(dsn ? { dsn } : {}, [clientReportItem]);\n}\n", "import type { DataCategory, TransportMakeRequestResponse } from '@sentry/types';\n\n// Intentionally keeping the key broad, as we don't know for sure what rate limit headers get returned from backend\nexport type RateLimits = Record;\n\nexport const DEFAULT_RETRY_AFTER = 60 * 1000; // 60 seconds\n\n/**\n * Extracts Retry-After value from the request header or returns default value\n * @param header string representation of 'Retry-After' header\n * @param now current unix timestamp\n *\n */\nexport function parseRetryAfterHeader(header: string, now: number = Date.now()): number {\n const headerDelay = parseInt(`${header}`, 10);\n if (!isNaN(headerDelay)) {\n return headerDelay * 1000;\n }\n\n const headerDate = Date.parse(`${header}`);\n if (!isNaN(headerDate)) {\n return headerDate - now;\n }\n\n return DEFAULT_RETRY_AFTER;\n}\n\n/**\n * Gets the time that the given category is disabled until for rate limiting.\n * In case no category-specific limit is set but a general rate limit across all categories is active,\n * that time is returned.\n *\n * @return the time in ms that the category is disabled until or 0 if there's no active rate limit.\n */\nexport function disabledUntil(limits: RateLimits, dataCategory: DataCategory): number {\n return limits[dataCategory] || limits.all || 0;\n}\n\n/**\n * Checks if a category is rate limited\n */\nexport function isRateLimited(limits: RateLimits, dataCategory: DataCategory, now: number = Date.now()): boolean {\n return disabledUntil(limits, dataCategory) > now;\n}\n\n/**\n * Update ratelimits from incoming headers.\n *\n * @return the updated RateLimits object.\n */\nexport function updateRateLimits(\n limits: RateLimits,\n { statusCode, headers }: TransportMakeRequestResponse,\n now: number = Date.now(),\n): RateLimits {\n const updatedRateLimits: RateLimits = {\n ...limits,\n };\n\n // \"The name is case-insensitive.\"\n // https://developer.mozilla.org/en-US/docs/Web/API/Headers/get\n const rateLimitHeader = headers && headers['x-sentry-rate-limits'];\n const retryAfterHeader = headers && headers['retry-after'];\n\n if (rateLimitHeader) {\n /**\n * rate limit headers are of the form\n *