iobroker.modbus 8.0.1 → 8.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -315,6 +315,9 @@ There are some programs in folder `test` to test the TCP communication:
|
|
|
315
315
|
### **WORK IN PROGRESS**
|
|
316
316
|
-->
|
|
317
317
|
## Changelog
|
|
318
|
+
### 8.0.2 (2026-02-17)
|
|
319
|
+
* (@GermanBluefox) Set default value of slave to '0' and not to 0
|
|
320
|
+
|
|
318
321
|
### 8.0.1 (2026-02-16)
|
|
319
322
|
* (@GermanBluefox) Disable logging of request timeout if `disableLogging` parameter is set to true
|
|
320
323
|
|
|
@@ -2751,7 +2751,7 @@ ${e.comment}`:e.comment}this.doc.range[2]=e.offset;break}default:this.errors.pus
|
|
|
2751
2751
|
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
2752
2752
|
`,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){var M;const e=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,e.value){const j="end"in e.value?e.value.end:void 0,z=Array.isArray(j)?j[j.length-1]:void 0;(z==null?void 0:z.type)==="comment"?j==null||j.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else e.sep?e.sep.push(this.sourceToken):e.start.push(this.sourceToken);return;case"space":case"comment":if(e.value)t.items.push({start:[this.sourceToken]});else if(e.sep)e.sep.push(this.sourceToken);else{if(this.atIndentedComment(e.start,t.indent)){const j=t.items[t.items.length-2],z=(M=j==null?void 0:j.value)==null?void 0:M.end;if(Array.isArray(z)){Array.prototype.push.apply(z,e.start),z.push(this.sourceToken),t.items.pop();return}}e.start.push(this.sourceToken)}return}if(this.indent>=t.indent){const j=!this.onKeyLine&&this.indent===t.indent,z=j&&(e.sep||e.explicitKey)&&this.type!=="seq-item-ind";let E=[];if(z&&e.sep&&!e.value){const N=[];for(let R=0;R<e.sep.length;++R){const A=e.sep[R];switch(A.type){case"newline":N.push(R);break;case"space":break;case"comment":A.indent>t.indent&&(N.length=0);break;default:N.length=0}}N.length>=2&&(E=e.sep.splice(N[1]))}switch(this.type){case"anchor":case"tag":z||e.value?(E.push(this.sourceToken),t.items.push({start:E}),this.onKeyLine=!0):e.sep?e.sep.push(this.sourceToken):e.start.push(this.sourceToken);return;case"explicit-key-ind":!e.sep&&!e.explicitKey?(e.start.push(this.sourceToken),e.explicitKey=!0):z||e.value?(E.push(this.sourceToken),t.items.push({start:E,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(e.explicitKey)if(e.sep)if(e.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(includesToken(e.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:E,key:null,sep:[this.sourceToken]}]});else if(isFlowToken(e.key)&&!includesToken(e.sep,"newline")){const N=getFirstKeyStartProps(e.start),R=e.key,A=e.sep;A.push(this.sourceToken),delete e.key,delete e.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:N,key:R,sep:A}]})}else E.length>0?e.sep=e.sep.concat(E,this.sourceToken):e.sep.push(this.sourceToken);else if(includesToken(e.start,"newline"))Object.assign(e,{key:null,sep:[this.sourceToken]});else{const N=getFirstKeyStartProps(e.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:N,key:null,sep:[this.sourceToken]}]})}else e.sep?e.value||z?t.items.push({start:E,key:null,sep:[this.sourceToken]}):includesToken(e.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):e.sep.push(this.sourceToken):Object.assign(e,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const N=this.flowScalar(this.type);z||e.value?(t.items.push({start:E,key:N,sep:[]}),this.onKeyLine=!0):e.sep?this.stack.push(N):(Object.assign(e,{key:N,sep:[]}),this.onKeyLine=!0);return}default:{const N=this.startBlockValue(t);if(N){if(N.type==="block-seq"){if(!e.explicitKey&&e.sep&&!includesToken(e.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else j&&t.items.push({start:E});this.stack.push(N);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){var M;const e=t.items[t.items.length-1];switch(this.type){case"newline":if(e.value){const j="end"in e.value?e.value.end:void 0,z=Array.isArray(j)?j[j.length-1]:void 0;(z==null?void 0:z.type)==="comment"?j==null||j.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else e.start.push(this.sourceToken);return;case"space":case"comment":if(e.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(e.start,t.indent)){const j=t.items[t.items.length-2],z=(M=j==null?void 0:j.value)==null?void 0:M.end;if(Array.isArray(z)){Array.prototype.push.apply(z,e.start),z.push(this.sourceToken),t.items.pop();return}}e.start.push(this.sourceToken)}return;case"anchor":case"tag":if(e.value||this.indent<=t.indent)break;e.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;e.value||includesToken(e.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):e.start.push(this.sourceToken);return}if(this.indent>t.indent){const j=this.startBlockValue(t);if(j){this.stack.push(j);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){const e=t.items[t.items.length-1];if(this.type==="flow-error-end"){let M;do yield*this.pop(),M=this.peek(1);while((M==null?void 0:M.type)==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!e||e.sep?t.items.push({start:[this.sourceToken]}):e.start.push(this.sourceToken);return;case"map-value-ind":!e||e.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):e.sep?e.sep.push(this.sourceToken):Object.assign(e,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!e||e.value?t.items.push({start:[this.sourceToken]}):e.sep?e.sep.push(this.sourceToken):e.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const j=this.flowScalar(this.type);!e||e.value?t.items.push({start:[],key:j,sep:[]}):e.sep?this.stack.push(j):Object.assign(e,{key:j,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}const M=this.startBlockValue(t);M?this.stack.push(M):(yield*this.pop(),yield*this.step())}else{const M=this.peek(2);if(M.type==="block-map"&&(this.type==="map-value-ind"&&M.indent===t.indent||this.type==="newline"&&!M.items[M.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&M.type!=="flow-collection"){const j=getPrevProps(M),z=getFirstKeyStartProps(j);fixFlowSeqItems(t);const E=t.end.splice(1,t.end.length);E.push(this.sourceToken);const N={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:z,key:t,sep:E}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=N}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let e=this.source.indexOf(`
|
|
2753
2753
|
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
2754
|
-
`,e)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const e=getPrevProps(t),M=getFirstKeyStartProps(e);return M.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:M,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const e=getPrevProps(t),M=getFirstKeyStartProps(e);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:M,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,e){return this.type!=="comment"||this.indent<=e?!1:t.every(M=>M.type==="newline"||M.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function parseOptions(o){const t=o.prettyErrors!==!1;return{lineCounter:o.lineCounter||t&&new LineCounter||null,prettyErrors:t}}function parseDocument(o,t={}){const{lineCounter:e,prettyErrors:M}=parseOptions(t),j=new Parser(e==null?void 0:e.addNewLine),z=new Composer(t);let E=null;for(const N of z.compose(j.parse(o),!0,o.length))if(!E)E=N;else if(E.options.logLevel!=="silent"){E.errors.push(new YAMLParseError(N.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return M&&e&&(E.errors.forEach(prettifyError(o,e)),E.warnings.forEach(prettifyError(o,e))),E}function parse(o,t,e){let M;const j=parseDocument(o,e);if(!j)return null;if(j.warnings.forEach(z=>warn(j.options.logLevel,z)),j.errors.length>0){if(j.options.logLevel!=="silent")throw j.errors[0];j.errors=[]}return j.toJS(Object.assign({reviver:M},e))}const styles$7={flex:{display:"flex"},button:{height:48,minWidth:48},wrapper:{width:"calc(100vw - 40px)",height:"calc(100vh - 188px)"}};class ConfigYamlEditor extends ConfigGeneric{componentDidMount(){super.componentDidMount();const{data:t,attr:e}=this.props,M=ConfigGeneric.getValue(t,e)||"";this.setState({value:M,initialized:!0,yamlError:this.validateYaml(M)})}validateYaml(t){let e=!1;if(this.props.schema.validateYaml!==!1&&(t||!this.props.schema.allowEmpty))try{parse(t)}catch(M){console.log("Error in YAML",M),e=!0}return e}renderItem(t,e){if(!this.state.initialized)return null;const{schema:M,data:j,attr:z}=this.props,{value:E,showSelectId:N}=this.state,R=M.readOnly===!0||e;return React.createElement(FormControl,{fullWidth:!0,variant:"standard"},React.createElement("div",{style:styles$7.flex},React.createElement(Button,{color:"grey",style:styles$7.button,size:"small",variant:"outlined",onClick:()=>this.setState({showSelectId:!0})},I18n.t("ra_YAML editor"))),N?React.createElement(CustomModal,{title:this.getText(M.label),overflowHidden:!0,applyDisabled:this.state.yamlError&&this.props.schema.doNotApplyWithError||R,onClose:()=>{R?this.setState({showSelectId:!1}):this.setState({showSelectId:!1,value:ConfigGeneric.getValue(j,z)||""})},onApply:R?void 0:()=>this.setState({showSelectId:!1},()=>this.onChange(z,E))},React.createElement("div",{style:{...styles$7.wrapper,border:this.state.yamlError?"2px solid red":"2px solid transparent"}},React.createElement(Editor,{mode:"yaml",value:typeof E=="object"?JSON.stringify(E):E,onChange:R?void 0:A=>this.setState({value:A,yamlError:this.validateYaml(A)}),name:"ConfigYamlEditor",themeType:this.props.oContext.themeType}))):null,M.help||this.state.yamlError?React.createElement(FormHelperText,null,this.state.yamlError?I18n.t("ra_Invalid YAML"):this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const scriptRel="modulepreload",assetsURL=function(o,t){return new URL(o,t).href},seen={},__vitePreload=function o(t,e,M){let j=Promise.resolve();if(e&&e.length>0){let E=function(_){return Promise.all(_.map(O=>Promise.resolve(O).then(H=>({status:"fulfilled",value:H}),H=>({status:"rejected",reason:H}))))};const N=document.getElementsByTagName("link"),R=document.querySelector("meta[property=csp-nonce]"),A=(R==null?void 0:R.nonce)||(R==null?void 0:R.getAttribute("nonce"));j=E(e.map(_=>{if(_=assetsURL(_,M),_ in seen)return;seen[_]=!0;const O=_.endsWith(".css"),H=O?'[rel="stylesheet"]':"";if(!!M)for(let B=N.length-1;B>=0;B--){const e1=N[B];if(e1.href===_&&(!O||e1.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${_}"]${H}`))return;const P=document.createElement("link");if(P.rel=O?"stylesheet":scriptRel,O||(P.as="script"),P.crossOrigin="",P.href=_,A&&P.setAttribute("nonce",A),document.head.appendChild(P),O)return new Promise((B,e1)=>{P.addEventListener("load",B),P.addEventListener("error",()=>e1(new Error(`Unable to preload CSS for ${_}`)))})}))}function z(E){const N=new Event("vite:preloadError",{cancelable:!0});if(N.payload=E,window.dispatchEvent(N),!N.defaultPrevented)throw E}return j.then(E=>{for(const N of E||[])N.status==="rejected"&&z(N.reason);return t().catch(z)})};class ConfigQrCode extends ConfigGeneric{async componentDidMount(){super.componentDidMount();const t=await __vitePreload(()=>import("./index-BqgN9ld9.js").then(e=>e.i),[],import.meta.url);this.setState({QRCode:t.default})}renderItem(){const t=this.state.QRCode;return t?React.createElement(t,{value:this.props.schema.data,size:this.props.schema.size,fgColor:this.props.schema.fgColor,bgColor:this.props.schema.bgColor,level:this.props.schema.level}):null}}const components={accordion:ConfigAccordion,alive:ConfigAlive,autocomplete:ConfigAutocomplete,autocompleteSendTo:ConfigAutocompleteSendTo,certCollection:ConfigCertCollection,certificate:ConfigCertificateSelect,certificates:ConfigCertificates,checkbox:ConfigCheckbox,checkDocker:ConfigCheckDocker,checkLicense:ConfigCheckLicense,chip:ConfigChip,chips:ConfigChip,color:ConfigColor,coordinates:ConfigCoordinates,cron:ConfigCRON,custom:ConfigCustom,datePicker:ConfigDatePicker,deviceManager:ConfigDeviceManager,divider:ConfigStaticDivider,file:ConfigFile,fileSelector:ConfigFileSelector,func:ConfigFunc,header:ConfigStaticHeader,iframe:ConfigIFrame,iframeSendTo:ConfigIFrameSendTo,image:ConfigImageUpload,imageSendTo:ConfigImageSendTo,infoBox:ConfigInfoBox,instance:ConfigInstanceSelect,interface:ConfigInterface,ip:ConfigIP,jsonEditor:ConfigJsonEditor,language:ConfigLanguage,license:ConfigLicense,number:ConfigNumber,oauth2:ConfigOAuth2,objectId:ConfigObjectId,password:ConfigPassword,pattern:ConfigPattern,port:ConfigPort,qrCode:ConfigQrCode,room:ConfigRoom,select:ConfigSelect,selectSendTo:ConfigSelectSendTo,sendto:ConfigSendto,sendTo:ConfigSendto,setState:ConfigSetState,slider:ConfigSlider,state:ConfigState,staticImage:ConfigStaticImage,staticInfo:ConfigStaticInfo,staticLink:ConfigStaticText,staticText:ConfigStaticText,table:ConfigTable,text:ConfigText,textSendTo:ConfigTextSendTo,timePicker:ConfigTimePicker,topic:ConfigTopic,uuid:ConfigUUID,user:ConfigUser,yamlEditor:ConfigYamlEditor},styles$6={fullWidth:{width:"100%"},paper:{margin:1,width:"auto !important",overflowY:"auto",paddingBottom:1},paperWithIcons:{height:"calc(100vh - 259px) !important"},paperWithoutIcons:{height:"calc(100vh - 235px) !important"},padding:{padding:"10px"},heading:{},primary:o=>({backgroundColor:o.palette.primary.main,color:o.palette.mode==="dark"?"inherit":"#FFF"}),secondary:o=>({backgroundColor:o.palette.secondary.main})};class ConfigPanel extends ConfigGeneric{componentDidMount(){var t;super.componentDidMount(),(t=this.props.schema)!=null&&t.collapsable&&this.setState({expanded:(window._localStorage||window.localStorage).getItem(`${this.props.oContext.adapterName}.${this.props.attr}`)==="true"})}renderItems(t,e){return t?Object.keys(t).map(M=>{if(this.props.oContext.multiEdit&&t[M].noMultiEdit)return null;const j=t[M].type||"panel";let z,E="Use this.props.oContext.socket!";return j==="custom"?(t[M].url?z=ConfigCustom:this.props.oContext.customs&&this.props.oContext.customs[t[M].component]?z=this.props.oContext.customs[t[M].component]:(console.error(`Cannot find custom component: ${t[M].component}`),z=ConfigGeneric),E=this.props.oContext.socket):j==="panel"?z=ConfigPanel:z=components[j]||ConfigGeneric,React.createElement(z,{socket:E,globalData:this.props.globalData,oContext:this.props.oContext,key:`${M}_${this.props.index===void 0?"":this.props.index}`,index:this.props.index,changed:this.props.changed,arrayIndex:this.props.arrayIndex,expertMode:this.props.expertMode,commandRunning:this.props.commandRunning,style:styles$6.panel,common:this.props.common,alive:this.props.alive,themeName:this.props.themeName,data:this.props.data,originalData:this.props.originalData,onError:this.props.onError,onHiddenChanged:this.props.onHiddenChanged,onChange:this.props.onChange,disabled:e,customObj:this.props.customObj,custom:this.props.custom,schema:t[M],attr:M,table:this.props.table})}):null}render(){const t=this.props.schema;if(!t)return null;const{disabled:e,hidden:M}=this.calculate(t),j=this.props.schema.items,z=this.props.schema.style||{};if(M){if(t.hideOnlyControl){const N=React.createElement(Grid2,{size:{xs:t.xs||void 0,sm:t.sm||void 0,md:t.md||void 0,lg:t.lg||void 0,xl:t.xl||void 0},sx:Utils.getStyle(this.props.oContext.theme,{marginBottom:0,textAlign:"left"},z,this.props.oContext.themeType==="dark"&&t.darkStyle)});return t.newLine?React.createElement(React.Fragment,null,React.createElement("div",{style:{flexBasis:"100%",height:0}}),N):N}return null}if(this.props.table)return this.renderItems(j,e);if(this.props.custom)return React.createElement(Grid2,{key:`${this.props.attr}_${this.props.index}`,container:!0,style:styles$6.fullWidth,columnSpacing:2,rowSpacing:1,sx:z},this.renderItems(j,e));let E;if(t.collapsable)E=React.createElement(Accordion,{key:`${this.props.attr}_${this.props.index}`,style:styles$6.fullWidth,expanded:!!this.state.expanded,onChange:()=>{(window._localStorage||window.localStorage).setItem(`${this.props.oContext.adapterName}.${this.props.attr}`,this.state.expanded?"false":"true"),this.setState({expanded:!this.state.expanded})}},React.createElement(AccordionSummary,{expandIcon:React.createElement(ExpandMoreIcon,null),sx:Utils.getStyle(this.props.oContext.theme,z,this.props.oContext.themeType&&t.darkStyle,t.color==="primary"?styles$6.primary:t.color==="secondary"&&styles$6.secondary,{width:"100%"})},React.createElement(Typography,{style:styles$6.heading},this.getText(t.label))),React.createElement(AccordionDetails,null,React.createElement(Grid2,{container:!0,columnSpacing:2,rowSpacing:1,sx:{...z,width:"100%",padding:"10px"}},this.renderItems(j,e))));else{const N=Utils.getStyle(this.props.oContext.theme,this.props.style,z,{width:"100%"},this.props.isParentTab&&styles$6.paper,this.props.isParentTab&&(this.props.withoutSaveButtons?this.props.withIcons?{height:"calc(100% - 88px) !important"}:{height:"calc(100% - 64px) !important"}:this.props.withIcons?styles$6.paperWithIcons:styles$6.paperWithoutIcons));E=React.createElement(Box,{component:"div",key:`${this.props.attr}_${this.props.index}`,className:this.props.className,sx:N},React.createElement(Grid2,{container:!0,columnSpacing:2,rowSpacing:1,sx:Utils.getStyle(this.props.oContext.theme,{width:"100%"},this.props.isParentTab&&styles$6.padding,this.props.schema.innerStyle)},this.renderItems(j,e)))}if(!this.props.isParentTab){const N=React.createElement(Grid2,{title:this.getText(t.tooltip),size:{xs:t.xs||void 0,sm:t.sm||void 0,md:t.md||void 0,lg:t.lg||void 0,xl:t.xl||void 0},sx:{marginBottom:0,textAlign:"left",...z}},E);return t.newLine?React.createElement(React.Fragment,null,React.createElement("div",{style:{flexBasis:"100%",height:0}}),N):N}return E}}const styles$5={tabs:{height:"100%",width:"100%"},panel:{width:"100%",display:"block"},panelWithIcons:{height:"calc(100% - 72px)"},panelWithoutIcons:{height:"calc(100% - 48px)"}};class ConfigTabs extends ConfigGeneric{constructor(e){super(e);_1(this,"resizeTimeout",null);_1(this,"refDiv");_1(this,"onTabError",(e,M)=>{const j=this.state.tab;if(!j){this.props.onError(e,M);return}const z={...this.state.tabErrors};z[j]||(z[j]={}),M?z[j][e]=M:(delete z[j][e],Object.keys(z[j]).length===0&&delete z[j]),this.setState({tabErrors:z}),this.props.onError(e,M)});_1(this,"hasTabErrors",e=>!!(this.state.tabErrors[e]&&Object.keys(this.state.tabErrors[e]).length>0));_1(this,"onHashTabsChanged",()=>{const e=(window.location.hash||"").replace(/^#/,"").split("/");if(e.length>3&&e[1]==="config"){const M=e[3],j=parseInt(M,10);let z;j.toString()===M?j>=0&&j<Object.keys(this.props.schema.items).length&&(z=Object.keys(this.props.schema.items)[j]):Object.keys(this.props.schema.items).includes(M)&&(z=M),z!==void 0&&z!==this.state.tab&&((window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.${this.props.oContext.adapterName}`,z),this.setState({tab:z}))}});let M;if(this.props.root){const j=(window.location.hash||"").replace(/^#/,"").split("/");if(j.length>=3&&j[1]==="config"){const z=j[3],E=parseInt(z,10);z&&E.toString()===z?E>=0&&E<Object.keys(this.props.schema.items).length&&(M=Object.keys(this.props.schema.items)[E]):z&&Object.keys(this.props.schema.items).includes(z)&&(M=z),window.addEventListener("hashchange",this.onHashTabsChanged,!1)}}M===void 0&&(M=(window._localStorage||window.localStorage).getItem(`${this.props.dialogName||"App"}.${this.props.oContext.adapterName}`)||Object.keys(this.props.schema.items)[0],Object.keys(this.props.schema.items).includes(M)||(M=Object.keys(this.props.schema.items)[0])),this.refDiv=React.createRef(),Object.assign(this.state,{tab:M,width:0,openMenu:null,tabErrors:{}})}componentWillUnmount(){this.resizeTimeout&&(clearTimeout(this.resizeTimeout),this.resizeTimeout=null),window.removeEventListener("hashchange",this.onHashTabsChanged,!1),super.componentWillUnmount()}getCurrentBreakpoint(){if(!this.state.width)return"md";if(!this.state.initialBreakpoint){let e;return this.state.width<600?e="xs":this.state.width<900?e="sm":this.state.width<1200?e="md":this.state.width<1536?e="lg":e="xl",setTimeout(()=>{this.setState({initialBreakpoint:e})},50),e}return this.state.initialBreakpoint}componentDidUpdate(){var e;!this.state.initialBreakpoint&&((e=this.refDiv.current)!=null&&e.clientWidth)&&this.refDiv.current.clientWidth!==this.state.width&&(this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{var M;this.resizeTimeout=null,this.setState({width:(M=this.refDiv.current)==null?void 0:M.clientWidth})},50))}onMenuChange(e){(window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.${this.props.oContext.adapterName}`,e),this.setState({tab:e},()=>{if(this.props.root){const M=(window.location.hash||"").split("/");M.length>=3&&M[1]==="config"&&(M[3]=this.state.tab,window.location.hash=M.join("/"))}})}render(){const e=this.props.schema.items;let M=!1;const j=[];Object.keys(e).map(N=>{let R;if(e[N].expertMode&&!this.props.expertMode)return;if(this.props.custom){if(this.executeCustom(e[N].hidden,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.index,this.props.globalData))return;R=this.executeCustom(e[N].disabled,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.index,this.props.globalData)}else{if(this.execute(e[N].hidden,!1,this.props.data,this.props.index,this.props.globalData))return;R=this.execute(e[N].disabled,!1,this.props.data,this.props.index,this.props.globalData)}const A=this.getIcon(e[N].icon);M=M||!!A,j.push({icon:A,disabled:R,label:this.getText(e[N].label),name:N})}),j.find(N=>N.name===this.state.tab)||setTimeout(()=>this.setState({tab:j[0].name}),50);const z=this.getCurrentBreakpoint();let E;return z==="xs"&&j.length>2?E=React.createElement(Toolbar,{style:{top:2,backgroundColor:this.props.oContext.themeType==="dark"?"#222":"#DDD"},variant:"dense"},React.createElement(IconButton,{onClick:N=>this.setState({openMenu:N.currentTarget})},React.createElement(MenuIcon,null)),this.state.openMenu?React.createElement(Menu,{open:!0,anchorEl:this.state.openMenu,onClose:()=>this.setState({openMenu:null})},j.map(N=>{const R=this.hasTabErrors(N.name);return React.createElement(MenuItem,{disabled:N.disabled,key:N.name,onClick:()=>{this.setState({openMenu:null},()=>this.onMenuChange(N.name))},selected:N.name===this.state.tab,sx:R?{color:"error.main"}:void 0},M?React.createElement(ListItemIcon,null,N.icon):null,React.createElement(Box,{sx:{display:"flex",alignItems:"center",gap:.5,width:"100%"}},N.label,R&&React.createElement(ErrorIcon$1,{sx:{fontSize:16,color:"error.main"}})))})):null):E=React.createElement(Tabs,{variant:"scrollable",scrollButtons:"auto",style:this.props.schema.tabsStyle,value:this.state.tab,onChange:(N,R)=>this.onMenuChange(R)},j.map(N=>{const R=this.hasTabErrors(N.name),A=R?React.createElement(Box,{sx:{display:"flex",alignItems:"center",gap:.5}},N.label,React.createElement(ErrorIcon$1,{sx:{fontSize:16,color:"error.main"}})):N.label;return React.createElement(Tab$1,{id:N.name,wrapped:!0,disabled:N.disabled,key:N.name,value:N.name,iconPosition:this.props.schema.iconPosition||"start",icon:N.icon,label:A,sx:R?{"& .MuiTab-wrapper":{color:"error.main"}}:void 0})})),React.createElement("div",{style:styles$5.tabs,ref:this.refDiv},E,React.createElement(ConfigPanel,{oContext:this.props.oContext,withoutSaveButtons:this.props.withoutSaveButtons,isParentTab:!0,changed:this.props.changed,key:this.state.tab,expertMode:this.props.expertMode,index:1001,arrayIndex:this.props.arrayIndex,globalData:this.props.globalData,commandRunning:this.props.commandRunning,style:{...styles$5.panel,...M?styles$5.panelWithIcons:styles$5.panelWithoutIcons},common:this.props.common,alive:this.props.alive,themeName:this.props.themeName,data:this.props.data,originalData:this.props.originalData,onChange:this.props.onChange,onError:this.onTabError,customObj:this.props.customObj,custom:this.props.custom,schema:e[this.state.tab],table:this.props.table,withIcons:M}))}}const styles$4={root:{width:"100%",height:"100%"}};class JsonConfigComponent extends reactExports.Component{constructor(e){super(e);_1(this,"forceUpdateHandlers");_1(this,"errorTimeout",null);_1(this,"errorCached",null);_1(this,"oContext");_1(this,"onCommandRunning",e=>this.setState({commandRunning:e}));_1(this,"onAlive",(e,M)=>{!!(M!=null&&M.val)!==this.state.alive&&this.setState({alive:!!(M!=null&&M.val)})});_1(this,"onChange",(e,M,j,z)=>{if(this.props.onValueChange)this.props.onValueChange(e,M,z),j&&j();else if(e&&this.props.onChange){const E={changed:JSON.stringify(e)!==this.state.originalData};this.setState(E,()=>{this.props.onChange(e,E.changed,z),j&&j()})}else z&&this.props.onChange(null,null,z)});_1(this,"onError",(e,M)=>{this.errorCached=this.errorCached||JSON.parse(JSON.stringify(this.state.errors));const j=this.errorCached;M?j[e]=M:delete j[e],this.errorTimeout&&clearTimeout(this.errorTimeout),JSON.stringify(j)!==JSON.stringify(this.state.errors)?this.errorTimeout=setTimeout(()=>this.setState({errors:this.errorCached},()=>{this.errorTimeout=null,this.errorCached=null,this.props.onError(!!Object.keys(this.state.errors).length)}),50):this.errorCached=null});_1(this,"changeLanguage",()=>{this.forceUpdate()});_1(this,"forceAttrUpdate",(e,M)=>{Array.isArray(e)?e.forEach(j=>this.forceUpdateHandlers[j]&&this.forceUpdateHandlers[j](M)):this.forceUpdateHandlers[e]&&this.forceUpdateHandlers[e](M)});_1(this,"registerOnForceUpdate",(e,M)=>{M?this.forceUpdateHandlers[e]=M:this.forceUpdateHandlers[e]&&delete this.forceUpdateHandlers[e]});this.state={originalData:JSON.stringify(this.props.data),changed:!1,errors:{},updateData:this.props.updateData||0,systemConfig:null,alive:!1,commandRunning:!1,schema:JSON.parse(JSON.stringify(this.props.schema))},this.forceUpdateHandlers={},this.buildDependencies(this.state.schema),this.readData()}static getDerivedStateFromProps(e,M){return e.updateData!==M.updateData?{updateData:e.updateData,originalData:JSON.stringify(e.data),schema:JSON.parse(JSON.stringify(e.schema))}:null}static async loadI18n(e,M,j){if(M===!0||M&&typeof M=="string"){const z=I18n.getLanguage(),E=typeof M=="string"?M:"i18n";let N=await e.fileExists(`${j}.admin`,`${E}/${z}.json`),R;if(N?R=`${E}/${z}.json`:(N=await e.fileExists(`${j}.admin`,`${E}/${z}/translations.json`),N?R=`${E}/${z}/translations.json`:z!=="en"&&(N=await e.fileExists(`${j}.admin`,`${E}/en.json`),N?R=`${E}/en.json`:(N=await e.fileExists(`${j}.admin`,`${E}/en/translations.json`),N&&(R=`${E}/en/translations.json`)))),R){const A=await e.readFile(`${j}.admin`,R);let _;A.file!==void 0?_=A.file:_=A;try{const O=JSON.parse(_);I18n.extendTranslations(O,z)}catch(O){return console.error(`Cannot parse language file "${j}.admin/${R}: ${O}`),""}return R}return console.warn(`Cannot find i18n for ${j} / ${R}`),""}return M&&typeof M=="object"&&I18n.extendTranslations(M),""}readData(){this.props.socket.getCompactSystemConfig().then(e=>this.props.socket.getState(`system.adapter.${this.props.adapterName}.${this.props.instance}.alive`).then(M=>this.setState({systemConfig:e.common,alive:!!(M&&M.val)},()=>{this.updateContext(!0),this.props.custom||this.props.socket.subscribeState(`system.adapter.${this.props.adapterName}.${this.props.instance}.alive`,this.onAlive)}))).catch(e=>console.error(`Cannot read system config: ${e}`))}flatten(e,M){return M=M||{},e.items&&Object.keys(e.items).forEach(j=>{M[j]=e.items[j],this.flatten(e.items[j],M)}),M}buildDependencies(e){const M=this.flatten(e);Object.keys(M).forEach(j=>{var z,E,N,R,A,_,O,H,k,P;(z=M[j].confirm)!=null&&z.alsoDependsOn&&((E=M[j].confirm)==null||E.alsoDependsOn.forEach(B=>{if(!M[B])console.error(`[JsonConfigComponent] Attribute ${B} does not exist!`),B.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${B.replace(/^data\./,"")}" instead of "${B}"`);else{M[B].confirmDependsOn=M[B].confirmDependsOn||[];const e1={...M[j],attr:j};e1.confirm&&(e1.confirm.cancel="Undo"),M[B].confirmDependsOn.push(e1)}})),(N=M[j].onChange)!=null&&N.alsoDependsOn&&((R=M[j].onChange)==null||R.alsoDependsOn.forEach(B=>{if(!M[B])console.error(`[JsonConfigComponent] Attribute ${B} does not exist!`),B.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${B.replace(/^data\./,"")}" instead of "${B}"`);else{M[B].onChangeDependsOn=M[B].onChangeDependsOn||[];const e1={...M[j],attr:j};M[B].onChangeDependsOn.push(e1)}})),(A=M[j].hidden)!=null&&A.alsoDependsOn&&((_=M[j].hidden)==null||_.alsoDependsOn.forEach(B=>{if(!M[B])console.error(`[JsonConfigComponent] Attribute ${B} does not exist!`),B.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${B.replace(/^data\./,"")}" instead of "${B}"`);else{M[B].hiddenDependsOn=M[B].hiddenDependsOn||[];const e1={...M[j],attr:j};M[B].hiddenDependsOn.push(e1)}})),(O=M[j].label)!=null&&O.alsoDependsOn&&((H=M[j].label)==null||H.alsoDependsOn.forEach(B=>{if(!M[B])console.error(`[JsonConfigComponent] Attribute ${B} does not exist!`),B.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${B.replace(/^data\./,"")}" instead of "${B}"`);else{M[B].labelDependsOn=M[B].labelDependsOn||[];const e1={...M[j],attr:j};M[B].labelDependsOn.push(e1)}})),(k=M[j].help)!=null&&k.alsoDependsOn&&((P=M[j].help)==null||P.alsoDependsOn.forEach(B=>{if(!M[B])console.error(`[JsonConfigComponent] Attribute ${B} does not exist!`),B.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${B.replace(/^data\./,"")}" instead of "${B}"`);else{M[B].helpDependsOn=M[B].helpDependsOn||[];const e1={...M[j],attr:j};M[B].helpDependsOn.push(e1)}}))})}updateContext(e){this.oContext={DeviceManager:this.props.DeviceManager,adapterName:this.props.adapterName,changeLanguage:this.changeLanguage,common:this.props.common,customs:this.props.customs,dateFormat:this.props.dateFormat,embedded:this.props.embedded,forceUpdate:this.forceAttrUpdate,imagePrefix:this.props.imagePrefix,instance:this.props.instance,instanceObj:this.props.instanceObj,isFloatComma:this.props.isFloatComma,multiEdit:this.props.multiEdit,onBackEndCommand:this.props.onBackEndCommand,onCommandRunning:this.onCommandRunning,onValueChange:this.props.onValueChange,registerOnForceUpdate:this.registerOnForceUpdate,socket:this.props.socket,systemConfig:this.state.systemConfig,theme:this.props.theme,themeType:this.props.themeType,_themeName:this.props.themeName,updateData:this.state.updateData},e&&this.forceUpdate()}renderItem(e){return e.type==="tabs"?React.createElement(ConfigTabs,{withoutSaveButtons:this.props.withoutSaveButtons,oContext:this.oContext,alive:this.state.alive,changed:this.state.changed,commandRunning:this.state.commandRunning,common:this.props.common,custom:this.props.custom,customObj:this.props.customObj,data:this.props.data,onChange:this.onChange,onError:(M,j)=>this.onError(M,j),originalData:JSON.parse(this.state.originalData),root:!0,schema:e,expertMode:this.props.expertMode,themeName:this.props.themeName}):e.type==="panel"||!e.type?React.createElement(ConfigPanel,{withoutSaveButtons:this.props.withoutSaveButtons,oContext:this.oContext,alive:this.state.alive,changed:this.state.changed,commandRunning:this.state.commandRunning,common:this.props.common,custom:this.props.custom,customObj:this.props.customObj,data:this.props.data,expertMode:this.props.expertMode,index:1e3,isParentTab:!this.props.embedded&&!this.props.withoutSaveButtons,onChange:this.onChange,onError:(M,j)=>this.onError(M,j),originalData:JSON.parse(this.state.originalData),root:!0,schema:e,themeName:this.props.themeName}):(console.error(`Unknown item type in root: ${JSON.stringify(e)}`),null)}render(){return!this.state.systemConfig||!this.oContext?React.createElement(LinearProgress,null):(this.oContext._themeName!==this.props.themeName&&(this.oContext._themeName=this.props.themeName,setTimeout(()=>this.updateContext(!0),0)),React.createElement("div",{style:{...!this.props.embedded||this.props.withoutSaveButtons?styles$4.root:void 0,...this.props.style,...this.state.schema.style}},this.renderItem(this.state.schema)))}}const styles$3={root:{width:"100%",height:"100%",overflow:"hidden",position:"relative"},scroll:{height:"calc(100% - 48px)",overflowY:"auto"},exportImportButtons:{position:"absolute",top:5,right:0,zIndex:3},button:{marginRight:"5px"},tooltip:{pointerEvents:"none"}};function decryptLegacy(o,t){let e="";for(let M=0;M<t.length;M++)e+=String.fromCharCode(o[M%o.length].charCodeAt(0)^t.charCodeAt(M));return e}function encryptLegacy(o,t){let e="";for(let M=0;M<t.length;M++)e+=String.fromCharCode(o[M%o.length].charCodeAt(0)^t.charCodeAt(M));return e}function decrypt(o,t){if(typeof t!="string")return t;if(!t.startsWith("$/aes-192-cbc:")||!/^[0-9a-f]{48}$/.test(o))return decryptLegacy(o,t);const e=t.split(":",3),M=window.CryptoJS.enc.Hex.parse(o),j=window.CryptoJS.enc.Hex.parse(e[1]),z=window.CryptoJS.lib.CipherParams.create({ciphertext:window.CryptoJS.enc.Hex.parse(e[2])}),E=window.CryptoJS.AES.decrypt(z,M,{iv:j});return window.CryptoJS.enc.Utf8.stringify(E)}function encrypt(o,t,e){if(typeof t!="string")return t;if(!/^[0-9a-f]{48}$/.test(o))return encryptLegacy(o,t);let M;M=window.CryptoJS.lib.WordArray.random(128/8);const j=window.CryptoJS.enc.Hex.parse(o),z=window.CryptoJS.AES.encrypt(t,j,{iv:M}).ciphertext;return`$/aes-192-cbc:${window.CryptoJS.enc.Hex.stringify(M)}:${z}`}function loadScript(o,t){var e;return document.getElementById(t)?(e=document.getElementById(t))==null?void 0:e.onload:new Promise(M=>{const j=document.createElement("script");j.setAttribute("id",t),j.onload=M,j.src=o,document.getElementsByTagName("head")[0].appendChild(j)})}let JsonConfig$1=class extends Router{constructor(e){super(e);_1(this,"fileSubscribed",[]);_1(this,"fileLangSubscribed","");_1(this,"secret");_1(this,"handleFileSelect",e=>{const M=e.target.files[0];if(M){const j=new FileReader;j.onload=z=>{if(!z.target)return;const E=z.target.result;try{const N=JSON.parse(E);this.setState({data:N,changed:JSON.stringify(N)!==JSON.stringify(this.state.originalData)})}catch{window.alert(I18n.t("[JsonConfig] Failed to parse JSON file"))}},j.readAsText(M)}else window.alert(I18n.t("[JsonConfig] Failed to open JSON File"))});_1(this,"onFileChange",async(e,M,j)=>{var z;if(e===`${this.props.adapterName}.admin`&&j){if(M===this.fileLangSubscribed)try{await JsonConfigComponent.loadI18n(this.props.socket,(z=this.state.schema)==null?void 0:z.i18n,this.props.adapterName),this.setState({hash:`${this.state.hash}1`})}catch{}else if(this.fileSubscribed.includes(M))try{const E=await this.getConfigFile(this.fileSubscribed[0]);this.setState({schema:E,hash:MD5(JSON.stringify(E)).toString()})}catch{}}});this.state={updateData:0,changed:!1,confirmDialog:!1,theme:Theme(e.themeName),saveConfigDialog:!1,hash:"_"},this.secret=e.secret||"",this.getInstanceObject().then(M=>this.getConfigFile().then(j=>JsonConfigComponent.loadI18n(this.props.socket,j==null?void 0:j.i18n,this.props.adapterName).then(z=>{z&&(this.fileLangSubscribed||(this.fileLangSubscribed=z,this.props.socket.subscribeFiles(`${this.props.adapterName}.admin`,this.fileLangSubscribed,this.onFileChange))),M?this.setState({schema:j,data:M.native,common:M.common,hash:MD5(JSON.stringify(j)).toString()}):window.alert(`Instance system.adapter.${this.props.adapterName}.${this.props.instance} not found!`)})))}componentWillUnmount(){super.componentWillUnmount(),this.fileSubscribed.length&&(this.props.socket.unsubscribeFiles(`${this.props.adapterName}.admin`,this.fileSubscribed,this.onFileChange),this.fileSubscribed=[]),this.fileLangSubscribed&&(this.props.socket.unsubscribeFiles(`${this.props.adapterName}.admin`,this.fileLangSubscribed,this.onFileChange),this.fileLangSubscribed="")}getExportImportButtons(){return React.createElement("div",{style:styles$3.exportImportButtons},React.createElement(Tooltip,{title:this.props.t("Import settings from JSON file"),slotProps:{popper:{sx:styles$3.tooltip}}},React.createElement(Fab,{size:"small",sx:{"&.MuiFab-root":styles$3.button},onClick:()=>{const e=document.createElement("input");e.setAttribute("type","file"),e.setAttribute("id","files"),e.setAttribute("opacity",0),e.addEventListener("change",M=>this.handleFileSelect(M),!1),e.click()}},React.createElement(PublishIcon,null))),React.createElement(Tooltip,{title:this.props.t("Export setting to JSON file"),slotProps:{popper:{sx:styles$3.tooltip}}},React.createElement(Fab,{size:"small",sx:{"&.MuiFab-root":styles$3.button},onClick:()=>{this.state.data&&Utils.generateFile(`${this.props.adapterName}.${this.props.instance}.json`,this.state.data)}},React.createElement(PublishIcon,{style:{transform:"rotate(180deg)"}}))))}async getInstanceObject(){var e;try{const M=await this.props.socket.getObject(`system.adapter.${this.props.adapterName}.${this.props.instance}`);if(Array.isArray(M.encryptedNative)){if(!this.secret){const j=await this.props.socket.getSystemConfig();await loadScript("../../lib/js/crypto-js/crypto-js.js","crypto-js"),this.secret=j.native.secret}return(e=M.encryptedNative)==null||e.forEach(j=>{M.native[j]&&(M.native[j]=decrypt(this.secret,M.native[j]))}),M}return M}catch(M){window.alert(`[JsonConfig] Cannot read instance object: ${M}`)}return null}renderDialogConfirm(){return this.state.confirmDialog?React.createElement(DialogConfirm,{title:I18n.t("ra_Please confirm"),text:I18n.t("ra_Some data are not stored. Discard?"),ok:I18n.t("ra_Discard"),cancel:I18n.t("ra_Cancel"),onClose:e=>this.setState({confirmDialog:!1},()=>e&&Router.doNavigate(null))}):null}async scanForInclude(e,M){if(typeof e["#include"]=="string"){const z=await this._getConfigFile(e["#include"],[...M]);return delete e["#include"],z&&(e={...e,...z}),e}const j=Object.keys(e);for(let z=0;z<j.length;z++)e[j[z]]&&typeof e[j[z]]=="object"&&(e[j[z]]=await this.scanForInclude(e[j[z]],M));return e}async getConfigFile(e){return this._getConfigFile(e)}async _getConfigFile(e,M){if(e=e||"jsonConfig.json5",M=M||[],M.includes(e))return window.alert(`[JsonConfig] Circular reference in file: ${e} => ${M.join(" => ")}`),null;M.push(e);try{await this.props.socket.fileExists(`${this.props.adapterName}.admin`,e)||(e="jsonConfig.json");const z=await this.props.socket.readFile(`${this.props.adapterName}.admin`,e);let E="",N="";if(z.file!==void 0&&(N=z.file),typeof N=="string")E=N;else if(N.type==="Buffer"){let R="";const A=new Uint8Array(N.data),_=A.byteLength;for(let O=0;O<_;O++)R+=String.fromCharCode(A[O]);E=R}this.fileSubscribed.includes(e)||(this.fileSubscribed.push(e),await this.props.socket.subscribeFiles(`${this.props.adapterName}.admin`,e,this.onFileChange));try{return await this.scanForInclude(lib$1.parse(E),M)}catch(R){window.alert("[JsonConfig] Cannot parse json5 config!"),console.log(R)}}catch(j){this.state.schema||window.alert(`[JsonConfig] Cannot read file "${e}: ${j}`)}return null}renderSaveConfigDialog(){return this.state.saveConfigDialog?React.createElement(DialogConfirm,{title:I18n.t("ra_Please confirm"),text:I18n.t("Save configuration?"),ok:I18n.t("ra_Save"),cancel:I18n.t("ra_Cancel"),onClose:e=>this.setState({saveConfigDialog:!1},()=>e&&this.onSave(!0))}):null}findAttr(e,M){if(M=M||this.state.schema,M!=null&&M.items){if(e in M.items)return M.items[e];for(const j of Object.values(M.items)){const z=this.findAttr(e,j);if(z)return z}}return null}postProcessing(e,M,j){if(j=j||this.state.schema,!e){console.error(`Data is empty in postProcessing: ${M}, ${JSON.stringify(j)}`);return}const z=e[M];if(j.items)if(j.type==="table"){const E=z;if(!Array.isArray(E))return;for(const N of E)for(const R of j.items)this.postProcessing(N,R.attr,R)}else for(const[E,N]of Object.entries(j.items)){if(N.type==="panel"||N.type==="tabs"||N.type==="accordion")return;this.postProcessing(e,E,N)}else if(M&&typeof z=="string")if(j.type==="text")j.trim!==!1&&(e[M]=z.trim());else if(j.type==="ip")e[M]=z.trim();else if(j.type==="number"){const E=parseFloat(z.toString().replace(",","."));j.min!==void 0&&E<j.min?e[M]=j.min:j.max!==void 0&&E>j.max?e[M]=j.max:e[M]=E}else if(j.type==="port"){const E=parseInt(z.toString(),10);j.min!==void 0&&E<j.min?e[M]=j.min:j.max!==void 0&&E>j.max&&(e[M]=j.max),e[M]!==0&&E<20?e[M]=20:E>65535?e[M]=65535:e[M]=E}else j.type==="checkbox"&&(e[M]=e[M]===!0||e[M]==="true"||e[M]==="on"||e[M]===1||e[M]==="1")}async onSave(e,M){if(e){const j=await this.getInstanceObject();if(!j){console.error("Something went wrong: may be no connection?"),window.alert("Something went wrong: may be no connection?");return}if(!this.state.data||!this.state.schema)return;const z={};for(const N of Object.keys(this.state.data)){const R=this.findAttr(N);(!R||!R.doNotSave||R.type==="state")&&!N.startsWith("_")?ConfigGeneric.setValue(j.native,N,this.state.data[N]):(ConfigGeneric.setValue(j.native,N,null),z[N]=this.state.data[N])}try{const N=JSON.parse(JSON.stringify(j));if(Array.isArray(N.encryptedNative)){await loadScript("../../lib/js/crypto-js/crypto-js.js","crypto-js");for(const R of N.encryptedNative)N.native[R]&&(N.native[R]=encrypt(this.secret,N.native[R]))}await this.props.socket.setObject(N._id,N)}catch(N){window.alert(`[JsonConfig] Cannot set object: ${N}`)}const E={...j.native,...z};console.log(E),this.setState({changed:!1,data:E,updateData:this.state.updateData+1,originalData:E},()=>M&&Router.doNavigate(null))}else this.state.changed?this.setState({confirmDialog:!0}):Router.doNavigate(null)}componentDidUpdate(e,M){M.changed!==this.state.changed&&this.props.configStored(!this.state.changed)}async componentDidMount(){const e=`${window.location.protocol}//${window.location.host}${window.location.pathname}validate_config/${this.props.adapterName}`;console.log(`fetch ${e}`),await fetch(e)}render(){return!this.state.data||!this.state.schema?React.createElement(LinearProgress,null):React.createElement("div",{style:styles$3.root},this.renderDialogConfirm(),this.getExportImportButtons(),this.renderSaveConfigDialog(),React.createElement(JsonConfigComponent,{key:this.state.hash,style:styles$3.scroll,socket:this.props.socket,themeName:this.props.themeName,themeType:this.props.themeType,adapterName:this.props.adapterName,instance:this.props.instance,isFloatComma:this.props.isFloatComma,dateFormat:this.props.dateFormat,schema:this.state.schema,common:this.state.common,expertMode:this.props.expertMode,data:this.state.data,updateData:this.state.updateData,onError:e=>this.setState({error:e}),onChange:(e,M,j)=>{j&&this.state.error&&(window.alert(I18n.t("Cannot save configuration because of error in configuration")),j=!1),j&&!this.state.changed&&!M&&(j=!1),e?this.setState({data:e,changed:M,saveConfigDialog:j}):j!==void 0&&this.setState({saveConfigDialog:j})},DeviceManager:this.props.DeviceManager,theme:this.state.theme}),React.createElement(SaveCloseButtons,{isIFrame:!1,dense:!0,paddingLeft:0,newReact:!0,theme:this.state.theme,noTextOnButtons:this.props.width==="xs"||this.props.width==="sm"||this.props.width==="md",changed:!!(this.state.error||this.state.changed),error:!!this.state.error,onSave:e=>this.onSave(!0,e),onClose:()=>this.onSave(!1)}))}};const schema$1={type:"panel",label:"Connection",items:{_header1:{newLine:!0,type:"header",label:"Address and ID options",xs:12},_showAliasesInfo:{newLine:!0,type:"infoBox",text:"showAliasesExplanation",title:"Using aliases as address",xs:12},showAliases:{newLine:!0,type:"checkbox",label:"Use aliases as address",xs:12},_showDirectAddresses:{newLine:!0,type:"infoBox",text:"directAddressesExplanation",title:"Using direct addresses",xs:12,hidden:"!data.showAliases"},directAddresses:{type:"checkbox",label:"Use direct addresses by aliases",xs:12,hidden:"!data.showAliases"},doNotRoundAddressToWord:{newLine:!0,type:"checkbox",label:"Do not align addresses to word",help:"doNotRoundAddressToWord_help",xs:12},doNotIncludeAdrInId:{type:"checkbox",label:"do not include address in ID",help:"doNotIncludeAdrInId_help",hidden:"!!data.showAliases",xs:12},preserveDotsInId:{type:"checkbox",label:"preserve dots in ID",help:"preserveDotsInId_help",xs:12},removeUnderscorePrefix:{type:"checkbox",label:'Remove leading "_" in ID if address is not included',xs:12,hidden:"!!data.showAliases || !data.doNotIncludeAdrInId"},_header2:{newLine:!0,type:"header",label:"Read/Write settings",xs:12},doNotUseWriteMultipleRegisters:{newLine:!0,type:"checkbox",hidden:'data.slave === "1" || !!data.onlyUseWriteMultipleRegisters',label:'Do not use "Write multiple registers"',help:"Write only with FC5/FC6",xs:12,md:6},onlyUseWriteMultipleRegisters:{type:"checkbox",hidden:'data.slave === "1" || !!data.doNotUseWriteMultipleRegisters',label:'Use only "Write multiple registers"',help:"Write only with FC15/FC16",xs:12,md:6},maxBlock:{newLine:!0,type:"number",label:"Max read request length",unit:"registers",xs:12,hidden:'data.slave === "1"',md:6},maxBoolBlock:{type:"number",label:"Max read request length (booleans)",unit:"registers",xs:12,hidden:'data.slave === "1"',md:6},alwaysUpdate:{newLine:!0,type:"checkbox",label:"Update unchanged states",help:"alwaysUpdate_help",hidden:'data.slave === "1"',xs:12,md:6},round:{type:"number",min:0,max:20,label:"Round Real to",md:6},_headerTimings:{newLine:!0,type:"header",label:"Timings",xs:12,hidden:'data.slave === "1"'},poll:{newLine:!0,type:"number",min:1,label:"Poll delay",unit:"ms",help:"poll_help",xs:12,hidden:'data.slave === "1"'},recon:{type:"number",min:1,label:"Reconnect time",unit:"ms",xs:12,hidden:'data.slave === "1"'},timeout:{type:"number",min:100,label:"Read timeout",unit:"ms",help:"timeout_help",xs:12,hidden:'data.slave === "1"'},pulseTime:{type:"number",label:"Pulse time",unit:"ms",help:"pulsetime_help",xs:12,hidden:'data.slave === "1"'},waitTime:{type:"number",label:"Wait time",unit:"ms",help:"waitTime_help",xs:12,hidden:'data.slave === "1"'},readInterval:{newLine:!0,type:"number",label:"Read interval",unit:"ms",help:"readInterval_help",xs:12,md:6,hidden:'data.slave === "1"'},writeInterval:{type:"number",label:"Write interval",unit:"ms",help:"writeInterval_help",xs:12,md:6,hidden:'data.slave === "1"'},_headerOthers:{newLine:!0,type:"header",label:"Others",xs:12},disableLogging:{type:"checkbox",label:"Disable connection error logging",help:"disableLogging_help"}}};function Settings$b(o){const[t,e]=React.useState(o.native.params.directAddresses),[M,j]=React.useState(o.native.params.showAliases);return jsxRuntimeExports.jsx("div",{style:{width:"calc(100% - 8px)",minHeight:"100%"},children:jsxRuntimeExports.jsx(JsonConfigComponent,{common:o.common,socket:o.socket,themeName:o.themeName,themeType:o.themeType,adapterName:"modbus",instance:o.instance||0,isFloatComma:o.systemConfig.common.isFloatComma,dateFormat:o.systemConfig.common.dateFormat,schema:schema$1,onChange:z=>{const E=JSON.parse(JSON.stringify(o.native));E.params=z,E.params.showAliases!==M&&(j(E.params.showAliases),["disInputs","inputRegs","holdingRegs","coils"].forEach(N=>{E[N].forEach(R=>{E.params.showAliases?(R._address=address2alias$1(N,R._address),E.params.directAddresses&&(R._address=nonDirect2direct(N,R._address))):(E.params.directAddresses&&(R._address=direct2nonDirect(N,R._address)),R._address=alias2address(N,R._address))})})),E.params.directAddresses!==t&&(e(E.params.directAddresses),E.params.showAliases&&["disInputs","coils"].forEach(N=>{E[N].forEach(R=>{E.params.directAddresses?R._address=nonDirect2direct(N,R._address):R._address=direct2nonDirect(N,R._address)})})),o.changeNative(E)},data:o.native.params,onError:()=>{},theme:o.theme,withoutSaveButtons:!0})})}const types=[{value:"",title:""},{value:"uint16be",title:"Unsigned 16 bit (Big Endian)"},{value:"uint16le",title:"Unsigned 16 bit (Little Endian)"},{value:"int16be",title:"Signed 16 bit (Big Endian)"},{value:"int16le",title:"Signed 16 bit (Little Endian)"},{value:"uint32be",title:"Unsigned 32 bit (Big Endian)"},{value:"uint32le",title:"Unsigned 32 bit (Little Endian)"},{value:"uint32sw",title:"Unsigned 32 bit (Big Endian Word Swap)"},{value:"uint32sb",title:"Unsigned 32 bit (Big Endian Byte Swap)"},{value:"int32be",title:"Signed 32 bit (Big Endian)"},{value:"int32le",title:"Signed 32 bit (Little Endian)"},{value:"int32sw",title:"Signed 32 bit (Big Endian Word Swap)"},{value:"int32sb",title:"Signed 32 bit (Big Endian Byte Swap)"},{value:"uint64be",title:"Unsigned 64 bit (Big Endian)"},{value:"uint64le",title:"Unsigned 64 bit (Little Endian)"},{value:"uint8be",title:"Unsigned 8 bit (Big Endian)"},{value:"uint8le",title:"Unsigned 8 bit (Little Endian)"},{value:"int8be",title:"Signed 8 bit (Big Endian)"},{value:"int8le",title:"Signed 8 bit (Little Endian)"},{value:"floatbe",title:"Float (Big Endian)"},{value:"floatle",title:"Float (Little Endian)"},{value:"floatsw",title:"Float (Big Endian Word Swap)"},{value:"floatsb",title:"Float (Big Endian Byte Swap)"},{value:"doublebe",title:"Double (Big Endian)"},{value:"doublele",title:"Double (Little Endian)"},{value:"string",title:"String (Zero-end)"},{value:"stringle",title:"String (Little Endian, Zero-end)"},{value:"string16",title:"String 16 bit (Zero-end)"},{value:"string16le",title:"String 16 bit (Little Endian, Zero-end)"},{value:"rawhex",title:"String with value in hex representation"}],roles=[{value:"",title:""},{value:"value",title:"value"},{value:"level",title:"level"},{value:"state",title:"state"},{value:"switch",title:"switch"},{value:"value.temperature",title:"value.temperature"},{value:"value.humidity",title:"value.humidity"},{value:"value.brightness",title:"value.brightness"},{value:"value.uv",title:"value.uv"},{value:"value.pressure",title:"value.pressure"},{value:"value.battery",title:"value.battery"},{value:"value.valve",title:"value.valve"},{value:"value.time",title:"value.time"},{value:"value.interval",title:"value.interval"},{value:"value.window",title:"value.window"},{value:"button",title:"button"},{value:"indicator",title:"indicator"},{value:"level.dimmer",title:"level.dimmer"},{value:"level.valve",title:"level.valve"},{value:"level.blind",title:"level.blind"},{value:"level.temperature",title:"level.temperature"},{value:"level.interval",title:"level.interval"},{value:"value.power.consumption",title:"value.power.consumption"}];var source={exports:{}},json2tsv={},hasRequiredJson2tsv;function requireJson2tsv(){if(hasRequiredJson2tsv)return json2tsv;hasRequiredJson2tsv=1,Object.defineProperty(json2tsv,"__esModule",{value:!0}),json2tsv.json2tsv=void 0;function o(j){if(!Array.isArray(j))throw new TypeError(`Expected string[][], got ${typeof j}`);for(const z of j){if(!Array.isArray(z))throw new TypeError(`Expected string[][], got ${typeof z}[]`);for(const E of z)if(typeof E!="string")throw new TypeError(`Expected string[][], got ${typeof E}[][]`)}}const t=/[\t\n"]/;function e(j){return t.test(j)}function M(j){return o(j),j.map(z=>z.map(E=>e(E)?`"${E.replace(/"/g,'""')}"`:E).join(" ")).join(`
|
|
2754
|
+
`,e)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const e=getPrevProps(t),M=getFirstKeyStartProps(e);return M.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:M,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const e=getPrevProps(t),M=getFirstKeyStartProps(e);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:M,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,e){return this.type!=="comment"||this.indent<=e?!1:t.every(M=>M.type==="newline"||M.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function parseOptions(o){const t=o.prettyErrors!==!1;return{lineCounter:o.lineCounter||t&&new LineCounter||null,prettyErrors:t}}function parseDocument(o,t={}){const{lineCounter:e,prettyErrors:M}=parseOptions(t),j=new Parser(e==null?void 0:e.addNewLine),z=new Composer(t);let E=null;for(const N of z.compose(j.parse(o),!0,o.length))if(!E)E=N;else if(E.options.logLevel!=="silent"){E.errors.push(new YAMLParseError(N.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return M&&e&&(E.errors.forEach(prettifyError(o,e)),E.warnings.forEach(prettifyError(o,e))),E}function parse(o,t,e){let M;const j=parseDocument(o,e);if(!j)return null;if(j.warnings.forEach(z=>warn(j.options.logLevel,z)),j.errors.length>0){if(j.options.logLevel!=="silent")throw j.errors[0];j.errors=[]}return j.toJS(Object.assign({reviver:M},e))}const styles$7={flex:{display:"flex"},button:{height:48,minWidth:48},wrapper:{width:"calc(100vw - 40px)",height:"calc(100vh - 188px)"}};class ConfigYamlEditor extends ConfigGeneric{componentDidMount(){super.componentDidMount();const{data:t,attr:e}=this.props,M=ConfigGeneric.getValue(t,e)||"";this.setState({value:M,initialized:!0,yamlError:this.validateYaml(M)})}validateYaml(t){let e=!1;if(this.props.schema.validateYaml!==!1&&(t||!this.props.schema.allowEmpty))try{parse(t)}catch(M){console.log("Error in YAML",M),e=!0}return e}renderItem(t,e){if(!this.state.initialized)return null;const{schema:M,data:j,attr:z}=this.props,{value:E,showSelectId:N}=this.state,R=M.readOnly===!0||e;return React.createElement(FormControl,{fullWidth:!0,variant:"standard"},React.createElement("div",{style:styles$7.flex},React.createElement(Button,{color:"grey",style:styles$7.button,size:"small",variant:"outlined",onClick:()=>this.setState({showSelectId:!0})},I18n.t("ra_YAML editor"))),N?React.createElement(CustomModal,{title:this.getText(M.label),overflowHidden:!0,applyDisabled:this.state.yamlError&&this.props.schema.doNotApplyWithError||R,onClose:()=>{R?this.setState({showSelectId:!1}):this.setState({showSelectId:!1,value:ConfigGeneric.getValue(j,z)||""})},onApply:R?void 0:()=>this.setState({showSelectId:!1},()=>this.onChange(z,E))},React.createElement("div",{style:{...styles$7.wrapper,border:this.state.yamlError?"2px solid red":"2px solid transparent"}},React.createElement(Editor,{mode:"yaml",value:typeof E=="object"?JSON.stringify(E):E,onChange:R?void 0:A=>this.setState({value:A,yamlError:this.validateYaml(A)}),name:"ConfigYamlEditor",themeType:this.props.oContext.themeType}))):null,M.help||this.state.yamlError?React.createElement(FormHelperText,null,this.state.yamlError?I18n.t("ra_Invalid YAML"):this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const scriptRel="modulepreload",assetsURL=function(o,t){return new URL(o,t).href},seen={},__vitePreload=function o(t,e,M){let j=Promise.resolve();if(e&&e.length>0){let E=function(_){return Promise.all(_.map(O=>Promise.resolve(O).then(H=>({status:"fulfilled",value:H}),H=>({status:"rejected",reason:H}))))};const N=document.getElementsByTagName("link"),R=document.querySelector("meta[property=csp-nonce]"),A=(R==null?void 0:R.nonce)||(R==null?void 0:R.getAttribute("nonce"));j=E(e.map(_=>{if(_=assetsURL(_,M),_ in seen)return;seen[_]=!0;const O=_.endsWith(".css"),H=O?'[rel="stylesheet"]':"";if(!!M)for(let B=N.length-1;B>=0;B--){const e1=N[B];if(e1.href===_&&(!O||e1.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${_}"]${H}`))return;const P=document.createElement("link");if(P.rel=O?"stylesheet":scriptRel,O||(P.as="script"),P.crossOrigin="",P.href=_,A&&P.setAttribute("nonce",A),document.head.appendChild(P),O)return new Promise((B,e1)=>{P.addEventListener("load",B),P.addEventListener("error",()=>e1(new Error(`Unable to preload CSS for ${_}`)))})}))}function z(E){const N=new Event("vite:preloadError",{cancelable:!0});if(N.payload=E,window.dispatchEvent(N),!N.defaultPrevented)throw E}return j.then(E=>{for(const N of E||[])N.status==="rejected"&&z(N.reason);return t().catch(z)})};class ConfigQrCode extends ConfigGeneric{async componentDidMount(){super.componentDidMount();const t=await __vitePreload(()=>import("./index-pdiNUDo1.js").then(e=>e.i),[],import.meta.url);this.setState({QRCode:t.default})}renderItem(){const t=this.state.QRCode;return t?React.createElement(t,{value:this.props.schema.data,size:this.props.schema.size,fgColor:this.props.schema.fgColor,bgColor:this.props.schema.bgColor,level:this.props.schema.level}):null}}const components={accordion:ConfigAccordion,alive:ConfigAlive,autocomplete:ConfigAutocomplete,autocompleteSendTo:ConfigAutocompleteSendTo,certCollection:ConfigCertCollection,certificate:ConfigCertificateSelect,certificates:ConfigCertificates,checkbox:ConfigCheckbox,checkDocker:ConfigCheckDocker,checkLicense:ConfigCheckLicense,chip:ConfigChip,chips:ConfigChip,color:ConfigColor,coordinates:ConfigCoordinates,cron:ConfigCRON,custom:ConfigCustom,datePicker:ConfigDatePicker,deviceManager:ConfigDeviceManager,divider:ConfigStaticDivider,file:ConfigFile,fileSelector:ConfigFileSelector,func:ConfigFunc,header:ConfigStaticHeader,iframe:ConfigIFrame,iframeSendTo:ConfigIFrameSendTo,image:ConfigImageUpload,imageSendTo:ConfigImageSendTo,infoBox:ConfigInfoBox,instance:ConfigInstanceSelect,interface:ConfigInterface,ip:ConfigIP,jsonEditor:ConfigJsonEditor,language:ConfigLanguage,license:ConfigLicense,number:ConfigNumber,oauth2:ConfigOAuth2,objectId:ConfigObjectId,password:ConfigPassword,pattern:ConfigPattern,port:ConfigPort,qrCode:ConfigQrCode,room:ConfigRoom,select:ConfigSelect,selectSendTo:ConfigSelectSendTo,sendto:ConfigSendto,sendTo:ConfigSendto,setState:ConfigSetState,slider:ConfigSlider,state:ConfigState,staticImage:ConfigStaticImage,staticInfo:ConfigStaticInfo,staticLink:ConfigStaticText,staticText:ConfigStaticText,table:ConfigTable,text:ConfigText,textSendTo:ConfigTextSendTo,timePicker:ConfigTimePicker,topic:ConfigTopic,uuid:ConfigUUID,user:ConfigUser,yamlEditor:ConfigYamlEditor},styles$6={fullWidth:{width:"100%"},paper:{margin:1,width:"auto !important",overflowY:"auto",paddingBottom:1},paperWithIcons:{height:"calc(100vh - 259px) !important"},paperWithoutIcons:{height:"calc(100vh - 235px) !important"},padding:{padding:"10px"},heading:{},primary:o=>({backgroundColor:o.palette.primary.main,color:o.palette.mode==="dark"?"inherit":"#FFF"}),secondary:o=>({backgroundColor:o.palette.secondary.main})};class ConfigPanel extends ConfigGeneric{componentDidMount(){var t;super.componentDidMount(),(t=this.props.schema)!=null&&t.collapsable&&this.setState({expanded:(window._localStorage||window.localStorage).getItem(`${this.props.oContext.adapterName}.${this.props.attr}`)==="true"})}renderItems(t,e){return t?Object.keys(t).map(M=>{if(this.props.oContext.multiEdit&&t[M].noMultiEdit)return null;const j=t[M].type||"panel";let z,E="Use this.props.oContext.socket!";return j==="custom"?(t[M].url?z=ConfigCustom:this.props.oContext.customs&&this.props.oContext.customs[t[M].component]?z=this.props.oContext.customs[t[M].component]:(console.error(`Cannot find custom component: ${t[M].component}`),z=ConfigGeneric),E=this.props.oContext.socket):j==="panel"?z=ConfigPanel:z=components[j]||ConfigGeneric,React.createElement(z,{socket:E,globalData:this.props.globalData,oContext:this.props.oContext,key:`${M}_${this.props.index===void 0?"":this.props.index}`,index:this.props.index,changed:this.props.changed,arrayIndex:this.props.arrayIndex,expertMode:this.props.expertMode,commandRunning:this.props.commandRunning,style:styles$6.panel,common:this.props.common,alive:this.props.alive,themeName:this.props.themeName,data:this.props.data,originalData:this.props.originalData,onError:this.props.onError,onHiddenChanged:this.props.onHiddenChanged,onChange:this.props.onChange,disabled:e,customObj:this.props.customObj,custom:this.props.custom,schema:t[M],attr:M,table:this.props.table})}):null}render(){const t=this.props.schema;if(!t)return null;const{disabled:e,hidden:M}=this.calculate(t),j=this.props.schema.items,z=this.props.schema.style||{};if(M){if(t.hideOnlyControl){const N=React.createElement(Grid2,{size:{xs:t.xs||void 0,sm:t.sm||void 0,md:t.md||void 0,lg:t.lg||void 0,xl:t.xl||void 0},sx:Utils.getStyle(this.props.oContext.theme,{marginBottom:0,textAlign:"left"},z,this.props.oContext.themeType==="dark"&&t.darkStyle)});return t.newLine?React.createElement(React.Fragment,null,React.createElement("div",{style:{flexBasis:"100%",height:0}}),N):N}return null}if(this.props.table)return this.renderItems(j,e);if(this.props.custom)return React.createElement(Grid2,{key:`${this.props.attr}_${this.props.index}`,container:!0,style:styles$6.fullWidth,columnSpacing:2,rowSpacing:1,sx:z},this.renderItems(j,e));let E;if(t.collapsable)E=React.createElement(Accordion,{key:`${this.props.attr}_${this.props.index}`,style:styles$6.fullWidth,expanded:!!this.state.expanded,onChange:()=>{(window._localStorage||window.localStorage).setItem(`${this.props.oContext.adapterName}.${this.props.attr}`,this.state.expanded?"false":"true"),this.setState({expanded:!this.state.expanded})}},React.createElement(AccordionSummary,{expandIcon:React.createElement(ExpandMoreIcon,null),sx:Utils.getStyle(this.props.oContext.theme,z,this.props.oContext.themeType&&t.darkStyle,t.color==="primary"?styles$6.primary:t.color==="secondary"&&styles$6.secondary,{width:"100%"})},React.createElement(Typography,{style:styles$6.heading},this.getText(t.label))),React.createElement(AccordionDetails,null,React.createElement(Grid2,{container:!0,columnSpacing:2,rowSpacing:1,sx:{...z,width:"100%",padding:"10px"}},this.renderItems(j,e))));else{const N=Utils.getStyle(this.props.oContext.theme,this.props.style,z,{width:"100%"},this.props.isParentTab&&styles$6.paper,this.props.isParentTab&&(this.props.withoutSaveButtons?this.props.withIcons?{height:"calc(100% - 88px) !important"}:{height:"calc(100% - 64px) !important"}:this.props.withIcons?styles$6.paperWithIcons:styles$6.paperWithoutIcons));E=React.createElement(Box,{component:"div",key:`${this.props.attr}_${this.props.index}`,className:this.props.className,sx:N},React.createElement(Grid2,{container:!0,columnSpacing:2,rowSpacing:1,sx:Utils.getStyle(this.props.oContext.theme,{width:"100%"},this.props.isParentTab&&styles$6.padding,this.props.schema.innerStyle)},this.renderItems(j,e)))}if(!this.props.isParentTab){const N=React.createElement(Grid2,{title:this.getText(t.tooltip),size:{xs:t.xs||void 0,sm:t.sm||void 0,md:t.md||void 0,lg:t.lg||void 0,xl:t.xl||void 0},sx:{marginBottom:0,textAlign:"left",...z}},E);return t.newLine?React.createElement(React.Fragment,null,React.createElement("div",{style:{flexBasis:"100%",height:0}}),N):N}return E}}const styles$5={tabs:{height:"100%",width:"100%"},panel:{width:"100%",display:"block"},panelWithIcons:{height:"calc(100% - 72px)"},panelWithoutIcons:{height:"calc(100% - 48px)"}};class ConfigTabs extends ConfigGeneric{constructor(e){super(e);_1(this,"resizeTimeout",null);_1(this,"refDiv");_1(this,"onTabError",(e,M)=>{const j=this.state.tab;if(!j){this.props.onError(e,M);return}const z={...this.state.tabErrors};z[j]||(z[j]={}),M?z[j][e]=M:(delete z[j][e],Object.keys(z[j]).length===0&&delete z[j]),this.setState({tabErrors:z}),this.props.onError(e,M)});_1(this,"hasTabErrors",e=>!!(this.state.tabErrors[e]&&Object.keys(this.state.tabErrors[e]).length>0));_1(this,"onHashTabsChanged",()=>{const e=(window.location.hash||"").replace(/^#/,"").split("/");if(e.length>3&&e[1]==="config"){const M=e[3],j=parseInt(M,10);let z;j.toString()===M?j>=0&&j<Object.keys(this.props.schema.items).length&&(z=Object.keys(this.props.schema.items)[j]):Object.keys(this.props.schema.items).includes(M)&&(z=M),z!==void 0&&z!==this.state.tab&&((window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.${this.props.oContext.adapterName}`,z),this.setState({tab:z}))}});let M;if(this.props.root){const j=(window.location.hash||"").replace(/^#/,"").split("/");if(j.length>=3&&j[1]==="config"){const z=j[3],E=parseInt(z,10);z&&E.toString()===z?E>=0&&E<Object.keys(this.props.schema.items).length&&(M=Object.keys(this.props.schema.items)[E]):z&&Object.keys(this.props.schema.items).includes(z)&&(M=z),window.addEventListener("hashchange",this.onHashTabsChanged,!1)}}M===void 0&&(M=(window._localStorage||window.localStorage).getItem(`${this.props.dialogName||"App"}.${this.props.oContext.adapterName}`)||Object.keys(this.props.schema.items)[0],Object.keys(this.props.schema.items).includes(M)||(M=Object.keys(this.props.schema.items)[0])),this.refDiv=React.createRef(),Object.assign(this.state,{tab:M,width:0,openMenu:null,tabErrors:{}})}componentWillUnmount(){this.resizeTimeout&&(clearTimeout(this.resizeTimeout),this.resizeTimeout=null),window.removeEventListener("hashchange",this.onHashTabsChanged,!1),super.componentWillUnmount()}getCurrentBreakpoint(){if(!this.state.width)return"md";if(!this.state.initialBreakpoint){let e;return this.state.width<600?e="xs":this.state.width<900?e="sm":this.state.width<1200?e="md":this.state.width<1536?e="lg":e="xl",setTimeout(()=>{this.setState({initialBreakpoint:e})},50),e}return this.state.initialBreakpoint}componentDidUpdate(){var e;!this.state.initialBreakpoint&&((e=this.refDiv.current)!=null&&e.clientWidth)&&this.refDiv.current.clientWidth!==this.state.width&&(this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{var M;this.resizeTimeout=null,this.setState({width:(M=this.refDiv.current)==null?void 0:M.clientWidth})},50))}onMenuChange(e){(window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.${this.props.oContext.adapterName}`,e),this.setState({tab:e},()=>{if(this.props.root){const M=(window.location.hash||"").split("/");M.length>=3&&M[1]==="config"&&(M[3]=this.state.tab,window.location.hash=M.join("/"))}})}render(){const e=this.props.schema.items;let M=!1;const j=[];Object.keys(e).map(N=>{let R;if(e[N].expertMode&&!this.props.expertMode)return;if(this.props.custom){if(this.executeCustom(e[N].hidden,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.index,this.props.globalData))return;R=this.executeCustom(e[N].disabled,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.index,this.props.globalData)}else{if(this.execute(e[N].hidden,!1,this.props.data,this.props.index,this.props.globalData))return;R=this.execute(e[N].disabled,!1,this.props.data,this.props.index,this.props.globalData)}const A=this.getIcon(e[N].icon);M=M||!!A,j.push({icon:A,disabled:R,label:this.getText(e[N].label),name:N})}),j.find(N=>N.name===this.state.tab)||setTimeout(()=>this.setState({tab:j[0].name}),50);const z=this.getCurrentBreakpoint();let E;return z==="xs"&&j.length>2?E=React.createElement(Toolbar,{style:{top:2,backgroundColor:this.props.oContext.themeType==="dark"?"#222":"#DDD"},variant:"dense"},React.createElement(IconButton,{onClick:N=>this.setState({openMenu:N.currentTarget})},React.createElement(MenuIcon,null)),this.state.openMenu?React.createElement(Menu,{open:!0,anchorEl:this.state.openMenu,onClose:()=>this.setState({openMenu:null})},j.map(N=>{const R=this.hasTabErrors(N.name);return React.createElement(MenuItem,{disabled:N.disabled,key:N.name,onClick:()=>{this.setState({openMenu:null},()=>this.onMenuChange(N.name))},selected:N.name===this.state.tab,sx:R?{color:"error.main"}:void 0},M?React.createElement(ListItemIcon,null,N.icon):null,React.createElement(Box,{sx:{display:"flex",alignItems:"center",gap:.5,width:"100%"}},N.label,R&&React.createElement(ErrorIcon$1,{sx:{fontSize:16,color:"error.main"}})))})):null):E=React.createElement(Tabs,{variant:"scrollable",scrollButtons:"auto",style:this.props.schema.tabsStyle,value:this.state.tab,onChange:(N,R)=>this.onMenuChange(R)},j.map(N=>{const R=this.hasTabErrors(N.name),A=R?React.createElement(Box,{sx:{display:"flex",alignItems:"center",gap:.5}},N.label,React.createElement(ErrorIcon$1,{sx:{fontSize:16,color:"error.main"}})):N.label;return React.createElement(Tab$1,{id:N.name,wrapped:!0,disabled:N.disabled,key:N.name,value:N.name,iconPosition:this.props.schema.iconPosition||"start",icon:N.icon,label:A,sx:R?{"& .MuiTab-wrapper":{color:"error.main"}}:void 0})})),React.createElement("div",{style:styles$5.tabs,ref:this.refDiv},E,React.createElement(ConfigPanel,{oContext:this.props.oContext,withoutSaveButtons:this.props.withoutSaveButtons,isParentTab:!0,changed:this.props.changed,key:this.state.tab,expertMode:this.props.expertMode,index:1001,arrayIndex:this.props.arrayIndex,globalData:this.props.globalData,commandRunning:this.props.commandRunning,style:{...styles$5.panel,...M?styles$5.panelWithIcons:styles$5.panelWithoutIcons},common:this.props.common,alive:this.props.alive,themeName:this.props.themeName,data:this.props.data,originalData:this.props.originalData,onChange:this.props.onChange,onError:this.onTabError,customObj:this.props.customObj,custom:this.props.custom,schema:e[this.state.tab],table:this.props.table,withIcons:M}))}}const styles$4={root:{width:"100%",height:"100%"}};class JsonConfigComponent extends reactExports.Component{constructor(e){super(e);_1(this,"forceUpdateHandlers");_1(this,"errorTimeout",null);_1(this,"errorCached",null);_1(this,"oContext");_1(this,"onCommandRunning",e=>this.setState({commandRunning:e}));_1(this,"onAlive",(e,M)=>{!!(M!=null&&M.val)!==this.state.alive&&this.setState({alive:!!(M!=null&&M.val)})});_1(this,"onChange",(e,M,j,z)=>{if(this.props.onValueChange)this.props.onValueChange(e,M,z),j&&j();else if(e&&this.props.onChange){const E={changed:JSON.stringify(e)!==this.state.originalData};this.setState(E,()=>{this.props.onChange(e,E.changed,z),j&&j()})}else z&&this.props.onChange(null,null,z)});_1(this,"onError",(e,M)=>{this.errorCached=this.errorCached||JSON.parse(JSON.stringify(this.state.errors));const j=this.errorCached;M?j[e]=M:delete j[e],this.errorTimeout&&clearTimeout(this.errorTimeout),JSON.stringify(j)!==JSON.stringify(this.state.errors)?this.errorTimeout=setTimeout(()=>this.setState({errors:this.errorCached},()=>{this.errorTimeout=null,this.errorCached=null,this.props.onError(!!Object.keys(this.state.errors).length)}),50):this.errorCached=null});_1(this,"changeLanguage",()=>{this.forceUpdate()});_1(this,"forceAttrUpdate",(e,M)=>{Array.isArray(e)?e.forEach(j=>this.forceUpdateHandlers[j]&&this.forceUpdateHandlers[j](M)):this.forceUpdateHandlers[e]&&this.forceUpdateHandlers[e](M)});_1(this,"registerOnForceUpdate",(e,M)=>{M?this.forceUpdateHandlers[e]=M:this.forceUpdateHandlers[e]&&delete this.forceUpdateHandlers[e]});this.state={originalData:JSON.stringify(this.props.data),changed:!1,errors:{},updateData:this.props.updateData||0,systemConfig:null,alive:!1,commandRunning:!1,schema:JSON.parse(JSON.stringify(this.props.schema))},this.forceUpdateHandlers={},this.buildDependencies(this.state.schema),this.readData()}static getDerivedStateFromProps(e,M){return e.updateData!==M.updateData?{updateData:e.updateData,originalData:JSON.stringify(e.data),schema:JSON.parse(JSON.stringify(e.schema))}:null}static async loadI18n(e,M,j){if(M===!0||M&&typeof M=="string"){const z=I18n.getLanguage(),E=typeof M=="string"?M:"i18n";let N=await e.fileExists(`${j}.admin`,`${E}/${z}.json`),R;if(N?R=`${E}/${z}.json`:(N=await e.fileExists(`${j}.admin`,`${E}/${z}/translations.json`),N?R=`${E}/${z}/translations.json`:z!=="en"&&(N=await e.fileExists(`${j}.admin`,`${E}/en.json`),N?R=`${E}/en.json`:(N=await e.fileExists(`${j}.admin`,`${E}/en/translations.json`),N&&(R=`${E}/en/translations.json`)))),R){const A=await e.readFile(`${j}.admin`,R);let _;A.file!==void 0?_=A.file:_=A;try{const O=JSON.parse(_);I18n.extendTranslations(O,z)}catch(O){return console.error(`Cannot parse language file "${j}.admin/${R}: ${O}`),""}return R}return console.warn(`Cannot find i18n for ${j} / ${R}`),""}return M&&typeof M=="object"&&I18n.extendTranslations(M),""}readData(){this.props.socket.getCompactSystemConfig().then(e=>this.props.socket.getState(`system.adapter.${this.props.adapterName}.${this.props.instance}.alive`).then(M=>this.setState({systemConfig:e.common,alive:!!(M&&M.val)},()=>{this.updateContext(!0),this.props.custom||this.props.socket.subscribeState(`system.adapter.${this.props.adapterName}.${this.props.instance}.alive`,this.onAlive)}))).catch(e=>console.error(`Cannot read system config: ${e}`))}flatten(e,M){return M=M||{},e.items&&Object.keys(e.items).forEach(j=>{M[j]=e.items[j],this.flatten(e.items[j],M)}),M}buildDependencies(e){const M=this.flatten(e);Object.keys(M).forEach(j=>{var z,E,N,R,A,_,O,H,k,P;(z=M[j].confirm)!=null&&z.alsoDependsOn&&((E=M[j].confirm)==null||E.alsoDependsOn.forEach(B=>{if(!M[B])console.error(`[JsonConfigComponent] Attribute ${B} does not exist!`),B.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${B.replace(/^data\./,"")}" instead of "${B}"`);else{M[B].confirmDependsOn=M[B].confirmDependsOn||[];const e1={...M[j],attr:j};e1.confirm&&(e1.confirm.cancel="Undo"),M[B].confirmDependsOn.push(e1)}})),(N=M[j].onChange)!=null&&N.alsoDependsOn&&((R=M[j].onChange)==null||R.alsoDependsOn.forEach(B=>{if(!M[B])console.error(`[JsonConfigComponent] Attribute ${B} does not exist!`),B.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${B.replace(/^data\./,"")}" instead of "${B}"`);else{M[B].onChangeDependsOn=M[B].onChangeDependsOn||[];const e1={...M[j],attr:j};M[B].onChangeDependsOn.push(e1)}})),(A=M[j].hidden)!=null&&A.alsoDependsOn&&((_=M[j].hidden)==null||_.alsoDependsOn.forEach(B=>{if(!M[B])console.error(`[JsonConfigComponent] Attribute ${B} does not exist!`),B.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${B.replace(/^data\./,"")}" instead of "${B}"`);else{M[B].hiddenDependsOn=M[B].hiddenDependsOn||[];const e1={...M[j],attr:j};M[B].hiddenDependsOn.push(e1)}})),(O=M[j].label)!=null&&O.alsoDependsOn&&((H=M[j].label)==null||H.alsoDependsOn.forEach(B=>{if(!M[B])console.error(`[JsonConfigComponent] Attribute ${B} does not exist!`),B.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${B.replace(/^data\./,"")}" instead of "${B}"`);else{M[B].labelDependsOn=M[B].labelDependsOn||[];const e1={...M[j],attr:j};M[B].labelDependsOn.push(e1)}})),(k=M[j].help)!=null&&k.alsoDependsOn&&((P=M[j].help)==null||P.alsoDependsOn.forEach(B=>{if(!M[B])console.error(`[JsonConfigComponent] Attribute ${B} does not exist!`),B.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${B.replace(/^data\./,"")}" instead of "${B}"`);else{M[B].helpDependsOn=M[B].helpDependsOn||[];const e1={...M[j],attr:j};M[B].helpDependsOn.push(e1)}}))})}updateContext(e){this.oContext={DeviceManager:this.props.DeviceManager,adapterName:this.props.adapterName,changeLanguage:this.changeLanguage,common:this.props.common,customs:this.props.customs,dateFormat:this.props.dateFormat,embedded:this.props.embedded,forceUpdate:this.forceAttrUpdate,imagePrefix:this.props.imagePrefix,instance:this.props.instance,instanceObj:this.props.instanceObj,isFloatComma:this.props.isFloatComma,multiEdit:this.props.multiEdit,onBackEndCommand:this.props.onBackEndCommand,onCommandRunning:this.onCommandRunning,onValueChange:this.props.onValueChange,registerOnForceUpdate:this.registerOnForceUpdate,socket:this.props.socket,systemConfig:this.state.systemConfig,theme:this.props.theme,themeType:this.props.themeType,_themeName:this.props.themeName,updateData:this.state.updateData},e&&this.forceUpdate()}renderItem(e){return e.type==="tabs"?React.createElement(ConfigTabs,{withoutSaveButtons:this.props.withoutSaveButtons,oContext:this.oContext,alive:this.state.alive,changed:this.state.changed,commandRunning:this.state.commandRunning,common:this.props.common,custom:this.props.custom,customObj:this.props.customObj,data:this.props.data,onChange:this.onChange,onError:(M,j)=>this.onError(M,j),originalData:JSON.parse(this.state.originalData),root:!0,schema:e,expertMode:this.props.expertMode,themeName:this.props.themeName}):e.type==="panel"||!e.type?React.createElement(ConfigPanel,{withoutSaveButtons:this.props.withoutSaveButtons,oContext:this.oContext,alive:this.state.alive,changed:this.state.changed,commandRunning:this.state.commandRunning,common:this.props.common,custom:this.props.custom,customObj:this.props.customObj,data:this.props.data,expertMode:this.props.expertMode,index:1e3,isParentTab:!this.props.embedded&&!this.props.withoutSaveButtons,onChange:this.onChange,onError:(M,j)=>this.onError(M,j),originalData:JSON.parse(this.state.originalData),root:!0,schema:e,themeName:this.props.themeName}):(console.error(`Unknown item type in root: ${JSON.stringify(e)}`),null)}render(){return!this.state.systemConfig||!this.oContext?React.createElement(LinearProgress,null):(this.oContext._themeName!==this.props.themeName&&(this.oContext._themeName=this.props.themeName,setTimeout(()=>this.updateContext(!0),0)),React.createElement("div",{style:{...!this.props.embedded||this.props.withoutSaveButtons?styles$4.root:void 0,...this.props.style,...this.state.schema.style}},this.renderItem(this.state.schema)))}}const styles$3={root:{width:"100%",height:"100%",overflow:"hidden",position:"relative"},scroll:{height:"calc(100% - 48px)",overflowY:"auto"},exportImportButtons:{position:"absolute",top:5,right:0,zIndex:3},button:{marginRight:"5px"},tooltip:{pointerEvents:"none"}};function decryptLegacy(o,t){let e="";for(let M=0;M<t.length;M++)e+=String.fromCharCode(o[M%o.length].charCodeAt(0)^t.charCodeAt(M));return e}function encryptLegacy(o,t){let e="";for(let M=0;M<t.length;M++)e+=String.fromCharCode(o[M%o.length].charCodeAt(0)^t.charCodeAt(M));return e}function decrypt(o,t){if(typeof t!="string")return t;if(!t.startsWith("$/aes-192-cbc:")||!/^[0-9a-f]{48}$/.test(o))return decryptLegacy(o,t);const e=t.split(":",3),M=window.CryptoJS.enc.Hex.parse(o),j=window.CryptoJS.enc.Hex.parse(e[1]),z=window.CryptoJS.lib.CipherParams.create({ciphertext:window.CryptoJS.enc.Hex.parse(e[2])}),E=window.CryptoJS.AES.decrypt(z,M,{iv:j});return window.CryptoJS.enc.Utf8.stringify(E)}function encrypt(o,t,e){if(typeof t!="string")return t;if(!/^[0-9a-f]{48}$/.test(o))return encryptLegacy(o,t);let M;M=window.CryptoJS.lib.WordArray.random(128/8);const j=window.CryptoJS.enc.Hex.parse(o),z=window.CryptoJS.AES.encrypt(t,j,{iv:M}).ciphertext;return`$/aes-192-cbc:${window.CryptoJS.enc.Hex.stringify(M)}:${z}`}function loadScript(o,t){var e;return document.getElementById(t)?(e=document.getElementById(t))==null?void 0:e.onload:new Promise(M=>{const j=document.createElement("script");j.setAttribute("id",t),j.onload=M,j.src=o,document.getElementsByTagName("head")[0].appendChild(j)})}let JsonConfig$1=class extends Router{constructor(e){super(e);_1(this,"fileSubscribed",[]);_1(this,"fileLangSubscribed","");_1(this,"secret");_1(this,"handleFileSelect",e=>{const M=e.target.files[0];if(M){const j=new FileReader;j.onload=z=>{if(!z.target)return;const E=z.target.result;try{const N=JSON.parse(E);this.setState({data:N,changed:JSON.stringify(N)!==JSON.stringify(this.state.originalData)})}catch{window.alert(I18n.t("[JsonConfig] Failed to parse JSON file"))}},j.readAsText(M)}else window.alert(I18n.t("[JsonConfig] Failed to open JSON File"))});_1(this,"onFileChange",async(e,M,j)=>{var z;if(e===`${this.props.adapterName}.admin`&&j){if(M===this.fileLangSubscribed)try{await JsonConfigComponent.loadI18n(this.props.socket,(z=this.state.schema)==null?void 0:z.i18n,this.props.adapterName),this.setState({hash:`${this.state.hash}1`})}catch{}else if(this.fileSubscribed.includes(M))try{const E=await this.getConfigFile(this.fileSubscribed[0]);this.setState({schema:E,hash:MD5(JSON.stringify(E)).toString()})}catch{}}});this.state={updateData:0,changed:!1,confirmDialog:!1,theme:Theme(e.themeName),saveConfigDialog:!1,hash:"_"},this.secret=e.secret||"",this.getInstanceObject().then(M=>this.getConfigFile().then(j=>JsonConfigComponent.loadI18n(this.props.socket,j==null?void 0:j.i18n,this.props.adapterName).then(z=>{z&&(this.fileLangSubscribed||(this.fileLangSubscribed=z,this.props.socket.subscribeFiles(`${this.props.adapterName}.admin`,this.fileLangSubscribed,this.onFileChange))),M?this.setState({schema:j,data:M.native,common:M.common,hash:MD5(JSON.stringify(j)).toString()}):window.alert(`Instance system.adapter.${this.props.adapterName}.${this.props.instance} not found!`)})))}componentWillUnmount(){super.componentWillUnmount(),this.fileSubscribed.length&&(this.props.socket.unsubscribeFiles(`${this.props.adapterName}.admin`,this.fileSubscribed,this.onFileChange),this.fileSubscribed=[]),this.fileLangSubscribed&&(this.props.socket.unsubscribeFiles(`${this.props.adapterName}.admin`,this.fileLangSubscribed,this.onFileChange),this.fileLangSubscribed="")}getExportImportButtons(){return React.createElement("div",{style:styles$3.exportImportButtons},React.createElement(Tooltip,{title:this.props.t("Import settings from JSON file"),slotProps:{popper:{sx:styles$3.tooltip}}},React.createElement(Fab,{size:"small",sx:{"&.MuiFab-root":styles$3.button},onClick:()=>{const e=document.createElement("input");e.setAttribute("type","file"),e.setAttribute("id","files"),e.setAttribute("opacity",0),e.addEventListener("change",M=>this.handleFileSelect(M),!1),e.click()}},React.createElement(PublishIcon,null))),React.createElement(Tooltip,{title:this.props.t("Export setting to JSON file"),slotProps:{popper:{sx:styles$3.tooltip}}},React.createElement(Fab,{size:"small",sx:{"&.MuiFab-root":styles$3.button},onClick:()=>{this.state.data&&Utils.generateFile(`${this.props.adapterName}.${this.props.instance}.json`,this.state.data)}},React.createElement(PublishIcon,{style:{transform:"rotate(180deg)"}}))))}async getInstanceObject(){var e;try{const M=await this.props.socket.getObject(`system.adapter.${this.props.adapterName}.${this.props.instance}`);if(Array.isArray(M.encryptedNative)){if(!this.secret){const j=await this.props.socket.getSystemConfig();await loadScript("../../lib/js/crypto-js/crypto-js.js","crypto-js"),this.secret=j.native.secret}return(e=M.encryptedNative)==null||e.forEach(j=>{M.native[j]&&(M.native[j]=decrypt(this.secret,M.native[j]))}),M}return M}catch(M){window.alert(`[JsonConfig] Cannot read instance object: ${M}`)}return null}renderDialogConfirm(){return this.state.confirmDialog?React.createElement(DialogConfirm,{title:I18n.t("ra_Please confirm"),text:I18n.t("ra_Some data are not stored. Discard?"),ok:I18n.t("ra_Discard"),cancel:I18n.t("ra_Cancel"),onClose:e=>this.setState({confirmDialog:!1},()=>e&&Router.doNavigate(null))}):null}async scanForInclude(e,M){if(typeof e["#include"]=="string"){const z=await this._getConfigFile(e["#include"],[...M]);return delete e["#include"],z&&(e={...e,...z}),e}const j=Object.keys(e);for(let z=0;z<j.length;z++)e[j[z]]&&typeof e[j[z]]=="object"&&(e[j[z]]=await this.scanForInclude(e[j[z]],M));return e}async getConfigFile(e){return this._getConfigFile(e)}async _getConfigFile(e,M){if(e=e||"jsonConfig.json5",M=M||[],M.includes(e))return window.alert(`[JsonConfig] Circular reference in file: ${e} => ${M.join(" => ")}`),null;M.push(e);try{await this.props.socket.fileExists(`${this.props.adapterName}.admin`,e)||(e="jsonConfig.json");const z=await this.props.socket.readFile(`${this.props.adapterName}.admin`,e);let E="",N="";if(z.file!==void 0&&(N=z.file),typeof N=="string")E=N;else if(N.type==="Buffer"){let R="";const A=new Uint8Array(N.data),_=A.byteLength;for(let O=0;O<_;O++)R+=String.fromCharCode(A[O]);E=R}this.fileSubscribed.includes(e)||(this.fileSubscribed.push(e),await this.props.socket.subscribeFiles(`${this.props.adapterName}.admin`,e,this.onFileChange));try{return await this.scanForInclude(lib$1.parse(E),M)}catch(R){window.alert("[JsonConfig] Cannot parse json5 config!"),console.log(R)}}catch(j){this.state.schema||window.alert(`[JsonConfig] Cannot read file "${e}: ${j}`)}return null}renderSaveConfigDialog(){return this.state.saveConfigDialog?React.createElement(DialogConfirm,{title:I18n.t("ra_Please confirm"),text:I18n.t("Save configuration?"),ok:I18n.t("ra_Save"),cancel:I18n.t("ra_Cancel"),onClose:e=>this.setState({saveConfigDialog:!1},()=>e&&this.onSave(!0))}):null}findAttr(e,M){if(M=M||this.state.schema,M!=null&&M.items){if(e in M.items)return M.items[e];for(const j of Object.values(M.items)){const z=this.findAttr(e,j);if(z)return z}}return null}postProcessing(e,M,j){if(j=j||this.state.schema,!e){console.error(`Data is empty in postProcessing: ${M}, ${JSON.stringify(j)}`);return}const z=e[M];if(j.items)if(j.type==="table"){const E=z;if(!Array.isArray(E))return;for(const N of E)for(const R of j.items)this.postProcessing(N,R.attr,R)}else for(const[E,N]of Object.entries(j.items)){if(N.type==="panel"||N.type==="tabs"||N.type==="accordion")return;this.postProcessing(e,E,N)}else if(M&&typeof z=="string")if(j.type==="text")j.trim!==!1&&(e[M]=z.trim());else if(j.type==="ip")e[M]=z.trim();else if(j.type==="number"){const E=parseFloat(z.toString().replace(",","."));j.min!==void 0&&E<j.min?e[M]=j.min:j.max!==void 0&&E>j.max?e[M]=j.max:e[M]=E}else if(j.type==="port"){const E=parseInt(z.toString(),10);j.min!==void 0&&E<j.min?e[M]=j.min:j.max!==void 0&&E>j.max&&(e[M]=j.max),e[M]!==0&&E<20?e[M]=20:E>65535?e[M]=65535:e[M]=E}else j.type==="checkbox"&&(e[M]=e[M]===!0||e[M]==="true"||e[M]==="on"||e[M]===1||e[M]==="1")}async onSave(e,M){if(e){const j=await this.getInstanceObject();if(!j){console.error("Something went wrong: may be no connection?"),window.alert("Something went wrong: may be no connection?");return}if(!this.state.data||!this.state.schema)return;const z={};for(const N of Object.keys(this.state.data)){const R=this.findAttr(N);(!R||!R.doNotSave||R.type==="state")&&!N.startsWith("_")?ConfigGeneric.setValue(j.native,N,this.state.data[N]):(ConfigGeneric.setValue(j.native,N,null),z[N]=this.state.data[N])}try{const N=JSON.parse(JSON.stringify(j));if(Array.isArray(N.encryptedNative)){await loadScript("../../lib/js/crypto-js/crypto-js.js","crypto-js");for(const R of N.encryptedNative)N.native[R]&&(N.native[R]=encrypt(this.secret,N.native[R]))}await this.props.socket.setObject(N._id,N)}catch(N){window.alert(`[JsonConfig] Cannot set object: ${N}`)}const E={...j.native,...z};console.log(E),this.setState({changed:!1,data:E,updateData:this.state.updateData+1,originalData:E},()=>M&&Router.doNavigate(null))}else this.state.changed?this.setState({confirmDialog:!0}):Router.doNavigate(null)}componentDidUpdate(e,M){M.changed!==this.state.changed&&this.props.configStored(!this.state.changed)}async componentDidMount(){const e=`${window.location.protocol}//${window.location.host}${window.location.pathname}validate_config/${this.props.adapterName}`;console.log(`fetch ${e}`),await fetch(e)}render(){return!this.state.data||!this.state.schema?React.createElement(LinearProgress,null):React.createElement("div",{style:styles$3.root},this.renderDialogConfirm(),this.getExportImportButtons(),this.renderSaveConfigDialog(),React.createElement(JsonConfigComponent,{key:this.state.hash,style:styles$3.scroll,socket:this.props.socket,themeName:this.props.themeName,themeType:this.props.themeType,adapterName:this.props.adapterName,instance:this.props.instance,isFloatComma:this.props.isFloatComma,dateFormat:this.props.dateFormat,schema:this.state.schema,common:this.state.common,expertMode:this.props.expertMode,data:this.state.data,updateData:this.state.updateData,onError:e=>this.setState({error:e}),onChange:(e,M,j)=>{j&&this.state.error&&(window.alert(I18n.t("Cannot save configuration because of error in configuration")),j=!1),j&&!this.state.changed&&!M&&(j=!1),e?this.setState({data:e,changed:M,saveConfigDialog:j}):j!==void 0&&this.setState({saveConfigDialog:j})},DeviceManager:this.props.DeviceManager,theme:this.state.theme}),React.createElement(SaveCloseButtons,{isIFrame:!1,dense:!0,paddingLeft:0,newReact:!0,theme:this.state.theme,noTextOnButtons:this.props.width==="xs"||this.props.width==="sm"||this.props.width==="md",changed:!!(this.state.error||this.state.changed),error:!!this.state.error,onSave:e=>this.onSave(!0,e),onClose:()=>this.onSave(!1)}))}};const schema$1={type:"panel",label:"Connection",items:{_header1:{newLine:!0,type:"header",label:"Address and ID options",xs:12},_showAliasesInfo:{newLine:!0,type:"infoBox",text:"showAliasesExplanation",title:"Using aliases as address",xs:12},showAliases:{newLine:!0,type:"checkbox",label:"Use aliases as address",xs:12},_showDirectAddresses:{newLine:!0,type:"infoBox",text:"directAddressesExplanation",title:"Using direct addresses",xs:12,hidden:"!data.showAliases"},directAddresses:{type:"checkbox",label:"Use direct addresses by aliases",xs:12,hidden:"!data.showAliases"},doNotRoundAddressToWord:{newLine:!0,type:"checkbox",label:"Do not align addresses to word",help:"doNotRoundAddressToWord_help",xs:12},doNotIncludeAdrInId:{type:"checkbox",label:"do not include address in ID",help:"doNotIncludeAdrInId_help",hidden:"!!data.showAliases",xs:12},preserveDotsInId:{type:"checkbox",label:"preserve dots in ID",help:"preserveDotsInId_help",xs:12},removeUnderscorePrefix:{type:"checkbox",label:'Remove leading "_" in ID if address is not included',xs:12,hidden:"!!data.showAliases || !data.doNotIncludeAdrInId"},_header2:{newLine:!0,type:"header",label:"Read/Write settings",xs:12},doNotUseWriteMultipleRegisters:{newLine:!0,type:"checkbox",hidden:'data.slave === "1" || !!data.onlyUseWriteMultipleRegisters',label:'Do not use "Write multiple registers"',help:"Write only with FC5/FC6",xs:12,md:6},onlyUseWriteMultipleRegisters:{type:"checkbox",hidden:'data.slave === "1" || !!data.doNotUseWriteMultipleRegisters',label:'Use only "Write multiple registers"',help:"Write only with FC15/FC16",xs:12,md:6},maxBlock:{newLine:!0,type:"number",label:"Max read request length",unit:"registers",xs:12,hidden:'data.slave === "1"',md:6},maxBoolBlock:{type:"number",label:"Max read request length (booleans)",unit:"registers",xs:12,hidden:'data.slave === "1"',md:6},alwaysUpdate:{newLine:!0,type:"checkbox",label:"Update unchanged states",help:"alwaysUpdate_help",hidden:'data.slave === "1"',xs:12,md:6},round:{type:"number",min:0,max:20,label:"Round Real to",md:6},_headerTimings:{newLine:!0,type:"header",label:"Timings",xs:12,hidden:'data.slave === "1"'},poll:{newLine:!0,type:"number",min:1,label:"Poll delay",unit:"ms",help:"poll_help",xs:12,hidden:'data.slave === "1"'},recon:{type:"number",min:1,label:"Reconnect time",unit:"ms",xs:12,hidden:'data.slave === "1"'},timeout:{type:"number",min:100,label:"Read timeout",unit:"ms",help:"timeout_help",xs:12,hidden:'data.slave === "1"'},pulseTime:{type:"number",label:"Pulse time",unit:"ms",help:"pulsetime_help",xs:12,hidden:'data.slave === "1"'},waitTime:{type:"number",label:"Wait time",unit:"ms",help:"waitTime_help",xs:12,hidden:'data.slave === "1"'},readInterval:{newLine:!0,type:"number",label:"Read interval",unit:"ms",help:"readInterval_help",xs:12,md:6,hidden:'data.slave === "1"'},writeInterval:{type:"number",label:"Write interval",unit:"ms",help:"writeInterval_help",xs:12,md:6,hidden:'data.slave === "1"'},_headerOthers:{newLine:!0,type:"header",label:"Others",xs:12},disableLogging:{type:"checkbox",label:"Disable connection error logging",help:"disableLogging_help"}}};function Settings$b(o){const[t,e]=React.useState(o.native.params.directAddresses),[M,j]=React.useState(o.native.params.showAliases);return jsxRuntimeExports.jsx("div",{style:{width:"calc(100% - 8px)",minHeight:"100%"},children:jsxRuntimeExports.jsx(JsonConfigComponent,{common:o.common,socket:o.socket,themeName:o.themeName,themeType:o.themeType,adapterName:"modbus",instance:o.instance||0,isFloatComma:o.systemConfig.common.isFloatComma,dateFormat:o.systemConfig.common.dateFormat,schema:schema$1,onChange:z=>{const E=JSON.parse(JSON.stringify(o.native));E.params=z,E.params.showAliases!==M&&(j(E.params.showAliases),["disInputs","inputRegs","holdingRegs","coils"].forEach(N=>{E[N].forEach(R=>{E.params.showAliases?(R._address=address2alias$1(N,R._address),E.params.directAddresses&&(R._address=nonDirect2direct(N,R._address))):(E.params.directAddresses&&(R._address=direct2nonDirect(N,R._address)),R._address=alias2address(N,R._address))})})),E.params.directAddresses!==t&&(e(E.params.directAddresses),E.params.showAliases&&["disInputs","coils"].forEach(N=>{E[N].forEach(R=>{E.params.directAddresses?R._address=nonDirect2direct(N,R._address):R._address=direct2nonDirect(N,R._address)})})),o.changeNative(E)},data:o.native.params,onError:()=>{},theme:o.theme,withoutSaveButtons:!0})})}const types=[{value:"",title:""},{value:"uint16be",title:"Unsigned 16 bit (Big Endian)"},{value:"uint16le",title:"Unsigned 16 bit (Little Endian)"},{value:"int16be",title:"Signed 16 bit (Big Endian)"},{value:"int16le",title:"Signed 16 bit (Little Endian)"},{value:"uint32be",title:"Unsigned 32 bit (Big Endian)"},{value:"uint32le",title:"Unsigned 32 bit (Little Endian)"},{value:"uint32sw",title:"Unsigned 32 bit (Big Endian Word Swap)"},{value:"uint32sb",title:"Unsigned 32 bit (Big Endian Byte Swap)"},{value:"int32be",title:"Signed 32 bit (Big Endian)"},{value:"int32le",title:"Signed 32 bit (Little Endian)"},{value:"int32sw",title:"Signed 32 bit (Big Endian Word Swap)"},{value:"int32sb",title:"Signed 32 bit (Big Endian Byte Swap)"},{value:"uint64be",title:"Unsigned 64 bit (Big Endian)"},{value:"uint64le",title:"Unsigned 64 bit (Little Endian)"},{value:"uint8be",title:"Unsigned 8 bit (Big Endian)"},{value:"uint8le",title:"Unsigned 8 bit (Little Endian)"},{value:"int8be",title:"Signed 8 bit (Big Endian)"},{value:"int8le",title:"Signed 8 bit (Little Endian)"},{value:"floatbe",title:"Float (Big Endian)"},{value:"floatle",title:"Float (Little Endian)"},{value:"floatsw",title:"Float (Big Endian Word Swap)"},{value:"floatsb",title:"Float (Big Endian Byte Swap)"},{value:"doublebe",title:"Double (Big Endian)"},{value:"doublele",title:"Double (Little Endian)"},{value:"string",title:"String (Zero-end)"},{value:"stringle",title:"String (Little Endian, Zero-end)"},{value:"string16",title:"String 16 bit (Zero-end)"},{value:"string16le",title:"String 16 bit (Little Endian, Zero-end)"},{value:"rawhex",title:"String with value in hex representation"}],roles=[{value:"",title:""},{value:"value",title:"value"},{value:"level",title:"level"},{value:"state",title:"state"},{value:"switch",title:"switch"},{value:"value.temperature",title:"value.temperature"},{value:"value.humidity",title:"value.humidity"},{value:"value.brightness",title:"value.brightness"},{value:"value.uv",title:"value.uv"},{value:"value.pressure",title:"value.pressure"},{value:"value.battery",title:"value.battery"},{value:"value.valve",title:"value.valve"},{value:"value.time",title:"value.time"},{value:"value.interval",title:"value.interval"},{value:"value.window",title:"value.window"},{value:"button",title:"button"},{value:"indicator",title:"indicator"},{value:"level.dimmer",title:"level.dimmer"},{value:"level.valve",title:"level.valve"},{value:"level.blind",title:"level.blind"},{value:"level.temperature",title:"level.temperature"},{value:"level.interval",title:"level.interval"},{value:"value.power.consumption",title:"value.power.consumption"}];var source={exports:{}},json2tsv={},hasRequiredJson2tsv;function requireJson2tsv(){if(hasRequiredJson2tsv)return json2tsv;hasRequiredJson2tsv=1,Object.defineProperty(json2tsv,"__esModule",{value:!0}),json2tsv.json2tsv=void 0;function o(j){if(!Array.isArray(j))throw new TypeError(`Expected string[][], got ${typeof j}`);for(const z of j){if(!Array.isArray(z))throw new TypeError(`Expected string[][], got ${typeof z}[]`);for(const E of z)if(typeof E!="string")throw new TypeError(`Expected string[][], got ${typeof E}[][]`)}}const t=/[\t\n"]/;function e(j){return t.test(j)}function M(j){return o(j),j.map(z=>z.map(E=>e(E)?`"${E.replace(/"/g,'""')}"`:E).join(" ")).join(`
|
|
2755
2755
|
`)}return json2tsv.json2tsv=M,json2tsv}var tsv2json={},hasRequiredTsv2json;function requireTsv2json(){if(hasRequiredTsv2json)return tsv2json;hasRequiredTsv2json=1,Object.defineProperty(tsv2json,"__esModule",{value:!0}),tsv2json.tsv2json=void 0;function o(e){const M=[];let j=e[0]==='"',z=j?1:0;function E(N){return e.splice(0,z+1),{cell:M.join(""),lineIsOver:N}}for(;z<e.length;){const N=e[z],R=e[z+1];if(j)N==='"'?R==='"'?(M.push('"'),z++):j=!1:M.push(N);else{if(N==="\r"&&R===`
|
|
2756
2756
|
`)return z++,E(!0);if(N===`
|
|
2757
2757
|
`)return E(!0);if(N===" ")return E(!1);M.push(N)}z++}return E(!0)}function t(e){if(typeof e!="string")throw new TypeError(`Expected string, got ${typeof e}`);if(e==="")return[[]];const M=[...e],j=[];let z=[];for(;M.length>0;){const{cell:E,lineIsOver:N}=o(M);z.push(E),N&&(j.push(z),z=[])}return j}return tsv2json.tsv2json=t,tsv2json}var hasRequiredSource;function requireSource(){return hasRequiredSource||(hasRequiredSource=1,(function(o,t){Object.defineProperty(t,"__esModule",{value:!0}),t.tsv2json=t.json2tsv=void 0;const e=requireJson2tsv();var M=requireJson2tsv();Object.defineProperty(t,"json2tsv",{enumerable:!0,get:function(){return M.json2tsv}});const j=requireTsv2json();var z=requireTsv2json();Object.defineProperty(t,"tsv2json",{enumerable:!0,get:function(){return z.tsv2json}}),t.default={json2tsv:e.json2tsv,tsv2json:j.tsv2json},o.exports={json2tsv:e.json2tsv,tsv2json:j.tsv2json},o.exports.default={json2tsv:e.json2tsv,tsv2json:j.tsv2json}})(source,source.exports)),source.exports}var sourceExports=requireSource();const styles$2={tsvEditor:{width:"100%",height:400}};function TsvDialog(o){const[t,e]=reactExports.useState(""),[M,j]=reactExports.useState(null);reactExports.useEffect(()=>{const E=[];E.push(o.fields.map(N=>N.name)),o.data.forEach(N=>E.push(o.fields.map(R=>{var A;return N[R.name]!==void 0&&N[R.name]!==null&&((A=N[R.name])==null?void 0:A.toString())||""}))),e(sourceExports.json2tsv(E))},[]);const z=()=>{const E=sourceExports.tsv2json(t.endsWith(`
|
|
@@ -2926,4 +2926,4 @@ Każdy alias będzie wewnętrznie mapowany na adres, np. 30011 będzie mapowany
|
|
|
2926
2926
|
- 输入寄存器的地址范围是 30001 到 40000
|
|
2927
2927
|
- 保持寄存器的地址范围是 40001 到 60000
|
|
2928
2928
|
|
|
2929
|
-
每个别名都会在内部映射到地址,例如,30011 将映射到输入寄存器 10,依此类推。`,timeout_help="读取请求的超时时间(以毫秒为单位)。如果这段时间内没有收到从站的响应,连接将被终止。",waitTime_help="轮询两个不同设备 ID 之间的等待时间(以毫秒为单位)。",writeInterval_help="两个写入请求之间的延迟(以毫秒为单位)。默认 0。",zhCnLang={"Add DB":"添加数据库","Add line":"添加行",Address,"Address and ID options":"地址和 ID 选项","All entries will be deleted. Are you sure?":"所有条目将被删除。你确定吗?","Are you sure to delete all items?":"您确定要删除所有项目吗?",'Are you sure to delete item with address "%s"?':"您确定要删除地址为“%s”的项目吗?","Are you sure?":"你确定吗?","Baud rate":"波特率","Binary inputs (read-only)":"二进制输入(只读)","Binary inputs and outputs":"二进制输入和输出",CW,Cancel,"Change all":"全部更改",Close,Coils,Connection,"Connection parameters":"连接参数","Copy to clipboard":"复制到剪贴板","Cyclic write":"循环写","Data bits":"数据位",Delete,"Delete address":"删除地址","Delete all":"删除所有","Delete all entries":"删除所有条目","Delete all items":"删除所有项目","Delete item":"删除项目",Description,"Device ID":"设备编号","Disable connection error logging":"禁用连接错误日志记录","Discrete inputs":"离散输入","Do not align addresses to word":"不要将地址按16位对齐",'Do not use "Write multiple registers"':"不要使用“写入多个寄存器”","Don't show this message in 5 minutes":"5 分钟内不要显示此消息","Edit as TSV (Tab separated values)":"编辑为 TSV(制表符分隔值)","Edit data as TSV":"将数据编辑为 TSV","Edit mode":"编辑模式","Enable polling of data point":"启用数据点轮询",Export,"Export to CSV":"导出为CSV",Factor,Formula,General,"Holding Registers":"持有登记册","IP address of the Modbus TCP server":"Modbus TCP 服务器的 IP 地址",Import,"Import DB file":"导入数据库文件","Import from CSV":"从CSV导入","Import symbols file":"导入符号","Input Registers":"输入寄存器","Input registers (8-64 bit values, read-only)":"输入寄存器(8-64 位值,只读)","Input/output registers (8-64 bit values)":"输入/输出寄存器(8-64 位值)",Inputs,Length,"Listen on all IPs":"侦听所有 IP","Load Symbols":"加载符号",Master,"Max read request length":"最大读取请求长度(浮动)","Max read request length (booleans)":"最大读取请求长度(布尔值)","Modbus device ID of the slave or default device ID for master mode":"Modbus 从站设备 ID 或主站模式的默认设备 ID","Multi device IDs":"多设备ID",Name,Nothing,Offset,Others,"PLC Connection":"PLC连接","PLC IP Address":"PLC IP地址","PLC Rack":"PLC机架:","PLC Slot":"PLC插槽",Parity,"Partner IP Address":"同伴IP地址",Poll,"Poll delay":"轮询延迟",Port,"Pulse time":"脉冲时间","RTU over TCP":"TCP上的RTU","RTU over TCP (Master)":"RTU over TCP(仅限主站)",RW,"Read interval":"读取间隔","Read timeout":"读取超时","Read/Write settings":"读/写设置","Reconnect time":"重新连接延时","Reject unauthorized certificates":"拒绝未经授权的证书",'Remove leading "_" in ID if address is not included':"如果未包含地址,请删除 ID 中的前导“_”",Role,Room,"Round Real to":"舍入为",SF,"SSL CA Certificate":"SSL CA 证书","SSL Certificate":"SSL 证书","SSL Private key":"SSL 私钥",'Say "yes" for the next minute':"在下一分钟说“是”","Select port":"选择串口",Serial,Settings,Slave,"Slave ID":"从机 ID","Slave IP address":"从IP地址","Slave address":"从机地址","Start address":"起始地址","Stop bits":"停止位","Store this value as scaling factor":"将此值存储为比例因子",TCP,"TCP with SSL/TLS":"带有 SSL/TLS 的 TCP","TCP with SSL/TLS (Master)":"带有 SSL/TLS 的 TCP(仅限主服务器)","TCP/Serial RTU":"TCP /串行RTU","TSV was copied to clipboard":"TSV 被复制到剪贴板","Text copied to clipboard. Click to close the window":"文本已复制到剪贴板。点击关闭窗口。",Timings,"Toggle RW":"切换RW","Toggle WP":"切换WP","Toggle extended mode":"切换扩展模式","Toggle poll":"切换民意调查",Type,Unit,"Update unchanged states":"更新未更改状态","Use aliases as address":"使用别名","Use direct addresses by aliases":"通过别名使用直接地址",'Use only "Write multiple registers"':"仅使用“写入多个寄存器”","Using aliases as address":"使用别名作为地址","Using direct addresses":"使用直接地址",WP,"Wait time":"等待时间","Write access allowed":"允许写访问","Write interval":"写间隔","Write only with FC15/FC16":"仅使用 FC15/FC16 写入","Write only with FC5/FC6":"仅使用 FC5/FC6 写入","Write pulses (true → false edge)":"写脉冲(真→假边沿)","You can copy, paste and edit data as TSV.":"您可以将数据复制、粘贴和编辑为 TSV。",aliases_help,alwaysUpdate_help,deviceId,directAddressesExplanation,directAddresses_help,disableLogging_help,"do not include address in ID":"在ID中不包含地址",doNotIncludeAdrInId_help,doNotRoundAddressToWord_help,doNotUseWriteMultipleRegisters_help,formula,ms,poll,poll_help,"preserve dots in ID":"保留ID中的点",preserveDotsInId_help,pulsetime_help,readInterval_help,recon_help,registers,showAliasesExplanation,timeout_help,waitTime_help,writeInterval_help},styles={tabContent:{padding:10,height:"calc(100% - 64px - 48px - 20px)",overflow:"auto"},tabContentIFrame:{padding:10,height:"calc(100% - 64px - 48px - 20px - 38px)",overflow:"auto"},selected:o=>({color:o.palette.mode==="dark"?void 0:"#FFF !important"}),indicator:o=>({backgroundColor:o.palette.mode==="dark"?o.palette.secondary.main:"#FFF"})},tabs=[{name:"connection",title:"Connection"},{name:"settings",title:"Settings"},{name:"discrete-inputs",title:"Discrete inputs",icon:jsxRuntimeExports.jsx(AiOutlineFieldBinary,{style:{width:18,height:18,marginRight:4,display:"inline-block"}}),tooltip:"Binary inputs (read-only)"},{name:"coils",title:"Coils",icon:jsxRuntimeExports.jsx(AiOutlineFieldBinary,{style:{width:18,height:18,marginRight:4,display:"inline-block"}}),tooltip:"Binary inputs and outputs"},{name:"input-registers",title:"Input Registers",icon:jsxRuntimeExports.jsx(TiSortNumerically,{style:{width:18,height:18,marginRight:4,display:"inline-block"}}),tooltip:"Input registers (8-64 bit values, read-only)"},{name:"holding-registers",title:"Holding Registers",icon:jsxRuntimeExports.jsx(TiSortNumerically,{style:{width:18,height:18,marginRight:4,display:"inline-block"}}),tooltip:"Input/output registers (8-64 bit values)"}];function sort(o){o.sort((t,e)=>{t.deviceId=parseInt(t.deviceId,10)||1,e.deviceId=parseInt(e.deviceId,10)||1,t._address=parseInt(t._address,10)||0,e._address=parseInt(e._address,10)||0;const M=t.deviceId<<16|t._address,j=e.deviceId<<16|e._address;return M<j?-1:M>j?1:0})}class App extends GenericApp{constructor(e){const M={...e};M.encryptedFields=["pass"],M.translations={en:enLang,de:deLang,ru:ruLang,pt:ptLang,nl:nlLang,fr:frLang,it:itLang,es:esLang,pl:plLang,uk:ukLang,"zh-cn":zhCnLang},M.Connection=AdminConnection,M.sentryDSN=window.sentryDSN;super(e,M);_1(this,"onAliveChanged",(e,M)=>{!!(M!=null&&M.val)!==this.state.alive&&this.setState({alive:!!(M!=null&&M.val)})});this.state={...this.state,moreLoaded:!1,rooms:null,alive:!1,systemConfig:null}}onPrepareSave(e){return e.disInputs&&sort(e.disInputs),e.coils&&sort(e.coils),e.inputRegs&&sort(e.inputRegs),e.holdingRegs&&sort(e.holdingRegs),!0}async onConnectionReady(){super.onConnectionReady();const e=window.localStorage.getItem(`modbus.${this.instance}.selectedTab`)||"connection";this.socket.getEnums("rooms").then(z=>this.setState({moreLoaded:!0,rooms:z}));const M=await this.socket.getSystemConfig(),j=await this.socket.getState(`system.adapter.modbus.${this.instance}.alive`);this.setState({alive:!!(j!=null&&j.val),selectedTab:e,systemConfig:M}),await this.socket.subscribeState(`system.adapter.modbus.${this.instance}.alive`,this.onAliveChanged)}renderConnection(){return this.state.systemConfig?jsxRuntimeExports.jsx(Connection$b,{common:this.common||{},socket:this.socket,native:this.state.native,instance:this.instance,adapterName:this.adapterName,changeNative:e=>this.setState({native:e,changed:this.getIsChanged(e)}),themeType:this.state.themeType,theme:this.state.theme,themeName:this.state.themeName,systemConfig:this.state.systemConfig}):jsxRuntimeExports.jsx("div",{children:I18n.t("Loading...")})}renderSettings(){return this.state.systemConfig?jsxRuntimeExports.jsx(Settings$b,{common:this.common||{},socket:this.socket,native:this.state.native,instance:this.instance,adapterName:this.adapterName,changeNative:e=>this.setState({native:e,changed:this.getIsChanged(e)}),themeType:this.state.themeType,theme:this.state.theme,themeName:this.state.themeName,systemConfig:this.state.systemConfig}):jsxRuntimeExports.jsx("div",{children:I18n.t("Loading...")})}renderDiscreteInputs(){return jsxRuntimeExports.jsx(DiscreteInputs,{alive:this.state.alive,formulaDisabled:this.state.native.params.slave==="1"||this.state.native.params.slave===1,socket:this.socket,native:this.state.native,instance:this.instance,adapterName:this.adapterName,changed:this.state.changed,onChange:(e,M,j)=>this.updateNativeValue(e,M,j),rooms:this.state.rooms||{},themeType:this.state.themeType})}renderCoils(){return jsxRuntimeExports.jsx(Coils$b,{alive:this.state.alive,formulaDisabled:this.state.native.params.slave==="1"||this.state.native.params.slave===1,socket:this.socket,native:this.state.native,instance:this.instance,adapterName:this.adapterName,changed:this.state.changed,onChange:(e,M,j)=>this.updateNativeValue(e,M,j),rooms:this.state.rooms||{},themeType:this.state.themeType})}renderInputRegisters(){return jsxRuntimeExports.jsx(InputRegisters,{alive:this.state.alive,formulaDisabled:this.state.native.params.slave==="1"||this.state.native.params.slave===1,socket:this.socket,native:this.state.native,instance:this.instance,adapterName:this.adapterName,changed:this.state.changed,onChange:(e,M,j)=>this.updateNativeValue(e,M,j),rooms:this.state.rooms||{},themeType:this.state.themeType})}renderHoldingRegisters(){return jsxRuntimeExports.jsx(HoldingRegisters,{alive:this.state.alive,formulaDisabled:this.state.native.params.slave==="1"||this.state.native.params.slave===1,socket:this.socket,native:this.state.native,instance:this.instance,adapterName:this.adapterName,changed:this.state.changed,onChange:(e,M,j)=>this.updateNativeValue(e,M,j),rooms:this.state.rooms||{},themeType:this.state.themeType})}renderTab(){return this.state.selectedTab==="connection"||!this.state.selectedTab?this.renderConnection():this.state.selectedTab==="settings"?this.renderSettings():this.state.selectedTab==="discrete-inputs"?this.renderDiscreteInputs():this.state.selectedTab==="coils"?this.renderCoils():this.state.selectedTab==="input-registers"?this.renderInputRegisters():this.state.selectedTab==="holding-registers"?this.renderHoldingRegisters():jsxRuntimeExports.jsx("div",{children:I18n.t("Unknown tab")})}render(){return!this.state.loaded||!this.state.moreLoaded?jsxRuntimeExports.jsx(StyledEngineProvider,{injectFirst:!0,children:jsxRuntimeExports.jsx(ThemeProvider,{theme:this.state.theme,children:jsxRuntimeExports.jsx(Loader,{themeType:this.state.themeType})})}):jsxRuntimeExports.jsx(StyledEngineProvider,{injectFirst:!0,children:jsxRuntimeExports.jsx(ThemeProvider,{theme:this.state.theme,children:jsxRuntimeExports.jsxs("div",{className:"App",style:{background:this.state.theme.palette.background.default,color:this.state.theme.palette.text.primary},children:[jsxRuntimeExports.jsx(AppBar,{position:"static",children:jsxRuntimeExports.jsx(Tabs,{indicatorColor:"secondary",value:this.state.selectedTab||tabs[0].name,onChange:(e,M)=>{this.setState({selectedTab:M}),window.localStorage.setItem(`modbus.${this.instance}.selectedTab`,M)},variant:"scrollable",scrollButtons:"auto",sx:{"&.Mui-indicator":styles.indicator},children:tabs.map(e=>jsxRuntimeExports.jsx(Tab$1,{value:e.name,sx:{"&.Mui-selected":styles.selected},label:e.icon?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[e.icon,I18n.t(e.title)]}):I18n.t(e.title),"data-name":e.name,title:e.tooltip?I18n.t(e.tooltip):void 0},e.name))})}),jsxRuntimeExports.jsx("div",{style:this.isIFrame?styles.tabContentIFrame:styles.tabContent,children:this.renderTab()}),this.renderError(),this.renderSaveCloseButtons()]})})})}}window.location.hostname==="localhost"||window.location.hostname==="[::1]"||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/);function unregister(){"serviceWorker"in navigator&&navigator.serviceWorker.ready.then(o=>o.unregister())}const version="8.0.1",pkg={version};window.adapterName="modbus";window.sentryDSN="https://19469f9280bd4b18a3e960e79cb01df2@sentry.iobroker.net/196";console.log(`iobroker.${window.adapterName}@${pkg.version}`);const container=document.getElementById("root");container&&clientExports.createRoot(container).render(jsxRuntimeExports.jsx(App,{}));unregister();export{requirePropTypes as a,getDefaultExportFromCjs as g,requireReact as r};
|
|
2929
|
+
每个别名都会在内部映射到地址,例如,30011 将映射到输入寄存器 10,依此类推。`,timeout_help="读取请求的超时时间(以毫秒为单位)。如果这段时间内没有收到从站的响应,连接将被终止。",waitTime_help="轮询两个不同设备 ID 之间的等待时间(以毫秒为单位)。",writeInterval_help="两个写入请求之间的延迟(以毫秒为单位)。默认 0。",zhCnLang={"Add DB":"添加数据库","Add line":"添加行",Address,"Address and ID options":"地址和 ID 选项","All entries will be deleted. Are you sure?":"所有条目将被删除。你确定吗?","Are you sure to delete all items?":"您确定要删除所有项目吗?",'Are you sure to delete item with address "%s"?':"您确定要删除地址为“%s”的项目吗?","Are you sure?":"你确定吗?","Baud rate":"波特率","Binary inputs (read-only)":"二进制输入(只读)","Binary inputs and outputs":"二进制输入和输出",CW,Cancel,"Change all":"全部更改",Close,Coils,Connection,"Connection parameters":"连接参数","Copy to clipboard":"复制到剪贴板","Cyclic write":"循环写","Data bits":"数据位",Delete,"Delete address":"删除地址","Delete all":"删除所有","Delete all entries":"删除所有条目","Delete all items":"删除所有项目","Delete item":"删除项目",Description,"Device ID":"设备编号","Disable connection error logging":"禁用连接错误日志记录","Discrete inputs":"离散输入","Do not align addresses to word":"不要将地址按16位对齐",'Do not use "Write multiple registers"':"不要使用“写入多个寄存器”","Don't show this message in 5 minutes":"5 分钟内不要显示此消息","Edit as TSV (Tab separated values)":"编辑为 TSV(制表符分隔值)","Edit data as TSV":"将数据编辑为 TSV","Edit mode":"编辑模式","Enable polling of data point":"启用数据点轮询",Export,"Export to CSV":"导出为CSV",Factor,Formula,General,"Holding Registers":"持有登记册","IP address of the Modbus TCP server":"Modbus TCP 服务器的 IP 地址",Import,"Import DB file":"导入数据库文件","Import from CSV":"从CSV导入","Import symbols file":"导入符号","Input Registers":"输入寄存器","Input registers (8-64 bit values, read-only)":"输入寄存器(8-64 位值,只读)","Input/output registers (8-64 bit values)":"输入/输出寄存器(8-64 位值)",Inputs,Length,"Listen on all IPs":"侦听所有 IP","Load Symbols":"加载符号",Master,"Max read request length":"最大读取请求长度(浮动)","Max read request length (booleans)":"最大读取请求长度(布尔值)","Modbus device ID of the slave or default device ID for master mode":"Modbus 从站设备 ID 或主站模式的默认设备 ID","Multi device IDs":"多设备ID",Name,Nothing,Offset,Others,"PLC Connection":"PLC连接","PLC IP Address":"PLC IP地址","PLC Rack":"PLC机架:","PLC Slot":"PLC插槽",Parity,"Partner IP Address":"同伴IP地址",Poll,"Poll delay":"轮询延迟",Port,"Pulse time":"脉冲时间","RTU over TCP":"TCP上的RTU","RTU over TCP (Master)":"RTU over TCP(仅限主站)",RW,"Read interval":"读取间隔","Read timeout":"读取超时","Read/Write settings":"读/写设置","Reconnect time":"重新连接延时","Reject unauthorized certificates":"拒绝未经授权的证书",'Remove leading "_" in ID if address is not included':"如果未包含地址,请删除 ID 中的前导“_”",Role,Room,"Round Real to":"舍入为",SF,"SSL CA Certificate":"SSL CA 证书","SSL Certificate":"SSL 证书","SSL Private key":"SSL 私钥",'Say "yes" for the next minute':"在下一分钟说“是”","Select port":"选择串口",Serial,Settings,Slave,"Slave ID":"从机 ID","Slave IP address":"从IP地址","Slave address":"从机地址","Start address":"起始地址","Stop bits":"停止位","Store this value as scaling factor":"将此值存储为比例因子",TCP,"TCP with SSL/TLS":"带有 SSL/TLS 的 TCP","TCP with SSL/TLS (Master)":"带有 SSL/TLS 的 TCP(仅限主服务器)","TCP/Serial RTU":"TCP /串行RTU","TSV was copied to clipboard":"TSV 被复制到剪贴板","Text copied to clipboard. Click to close the window":"文本已复制到剪贴板。点击关闭窗口。",Timings,"Toggle RW":"切换RW","Toggle WP":"切换WP","Toggle extended mode":"切换扩展模式","Toggle poll":"切换民意调查",Type,Unit,"Update unchanged states":"更新未更改状态","Use aliases as address":"使用别名","Use direct addresses by aliases":"通过别名使用直接地址",'Use only "Write multiple registers"':"仅使用“写入多个寄存器”","Using aliases as address":"使用别名作为地址","Using direct addresses":"使用直接地址",WP,"Wait time":"等待时间","Write access allowed":"允许写访问","Write interval":"写间隔","Write only with FC15/FC16":"仅使用 FC15/FC16 写入","Write only with FC5/FC6":"仅使用 FC5/FC6 写入","Write pulses (true → false edge)":"写脉冲(真→假边沿)","You can copy, paste and edit data as TSV.":"您可以将数据复制、粘贴和编辑为 TSV。",aliases_help,alwaysUpdate_help,deviceId,directAddressesExplanation,directAddresses_help,disableLogging_help,"do not include address in ID":"在ID中不包含地址",doNotIncludeAdrInId_help,doNotRoundAddressToWord_help,doNotUseWriteMultipleRegisters_help,formula,ms,poll,poll_help,"preserve dots in ID":"保留ID中的点",preserveDotsInId_help,pulsetime_help,readInterval_help,recon_help,registers,showAliasesExplanation,timeout_help,waitTime_help,writeInterval_help},styles={tabContent:{padding:10,height:"calc(100% - 64px - 48px - 20px)",overflow:"auto"},tabContentIFrame:{padding:10,height:"calc(100% - 64px - 48px - 20px - 38px)",overflow:"auto"},selected:o=>({color:o.palette.mode==="dark"?void 0:"#FFF !important"}),indicator:o=>({backgroundColor:o.palette.mode==="dark"?o.palette.secondary.main:"#FFF"})},tabs=[{name:"connection",title:"Connection"},{name:"settings",title:"Settings"},{name:"discrete-inputs",title:"Discrete inputs",icon:jsxRuntimeExports.jsx(AiOutlineFieldBinary,{style:{width:18,height:18,marginRight:4,display:"inline-block"}}),tooltip:"Binary inputs (read-only)"},{name:"coils",title:"Coils",icon:jsxRuntimeExports.jsx(AiOutlineFieldBinary,{style:{width:18,height:18,marginRight:4,display:"inline-block"}}),tooltip:"Binary inputs and outputs"},{name:"input-registers",title:"Input Registers",icon:jsxRuntimeExports.jsx(TiSortNumerically,{style:{width:18,height:18,marginRight:4,display:"inline-block"}}),tooltip:"Input registers (8-64 bit values, read-only)"},{name:"holding-registers",title:"Holding Registers",icon:jsxRuntimeExports.jsx(TiSortNumerically,{style:{width:18,height:18,marginRight:4,display:"inline-block"}}),tooltip:"Input/output registers (8-64 bit values)"}];function sort(o){o.sort((t,e)=>{t.deviceId=parseInt(t.deviceId,10)||1,e.deviceId=parseInt(e.deviceId,10)||1,t._address=parseInt(t._address,10)||0,e._address=parseInt(e._address,10)||0;const M=t.deviceId<<16|t._address,j=e.deviceId<<16|e._address;return M<j?-1:M>j?1:0})}class App extends GenericApp{constructor(e){const M={...e};M.encryptedFields=["pass"],M.translations={en:enLang,de:deLang,ru:ruLang,pt:ptLang,nl:nlLang,fr:frLang,it:itLang,es:esLang,pl:plLang,uk:ukLang,"zh-cn":zhCnLang},M.Connection=AdminConnection,M.sentryDSN=window.sentryDSN;super(e,M);_1(this,"onAliveChanged",(e,M)=>{!!(M!=null&&M.val)!==this.state.alive&&this.setState({alive:!!(M!=null&&M.val)})});this.state={...this.state,moreLoaded:!1,rooms:null,alive:!1,systemConfig:null}}onPrepareSave(e){return e.disInputs&&sort(e.disInputs),e.coils&&sort(e.coils),e.inputRegs&&sort(e.inputRegs),e.holdingRegs&&sort(e.holdingRegs),!0}async onConnectionReady(){super.onConnectionReady();const e=window.localStorage.getItem(`modbus.${this.instance}.selectedTab`)||"connection";this.socket.getEnums("rooms").then(z=>this.setState({moreLoaded:!0,rooms:z}));const M=await this.socket.getSystemConfig(),j=await this.socket.getState(`system.adapter.modbus.${this.instance}.alive`);this.setState({alive:!!(j!=null&&j.val),selectedTab:e,systemConfig:M}),await this.socket.subscribeState(`system.adapter.modbus.${this.instance}.alive`,this.onAliveChanged)}renderConnection(){return this.state.systemConfig?jsxRuntimeExports.jsx(Connection$b,{common:this.common||{},socket:this.socket,native:this.state.native,instance:this.instance,adapterName:this.adapterName,changeNative:e=>this.setState({native:e,changed:this.getIsChanged(e)}),themeType:this.state.themeType,theme:this.state.theme,themeName:this.state.themeName,systemConfig:this.state.systemConfig}):jsxRuntimeExports.jsx("div",{children:I18n.t("Loading...")})}renderSettings(){return this.state.systemConfig?jsxRuntimeExports.jsx(Settings$b,{common:this.common||{},socket:this.socket,native:this.state.native,instance:this.instance,adapterName:this.adapterName,changeNative:e=>this.setState({native:e,changed:this.getIsChanged(e)}),themeType:this.state.themeType,theme:this.state.theme,themeName:this.state.themeName,systemConfig:this.state.systemConfig}):jsxRuntimeExports.jsx("div",{children:I18n.t("Loading...")})}renderDiscreteInputs(){return jsxRuntimeExports.jsx(DiscreteInputs,{alive:this.state.alive,formulaDisabled:this.state.native.params.slave==="1"||this.state.native.params.slave===1,socket:this.socket,native:this.state.native,instance:this.instance,adapterName:this.adapterName,changed:this.state.changed,onChange:(e,M,j)=>this.updateNativeValue(e,M,j),rooms:this.state.rooms||{},themeType:this.state.themeType})}renderCoils(){return jsxRuntimeExports.jsx(Coils$b,{alive:this.state.alive,formulaDisabled:this.state.native.params.slave==="1"||this.state.native.params.slave===1,socket:this.socket,native:this.state.native,instance:this.instance,adapterName:this.adapterName,changed:this.state.changed,onChange:(e,M,j)=>this.updateNativeValue(e,M,j),rooms:this.state.rooms||{},themeType:this.state.themeType})}renderInputRegisters(){return jsxRuntimeExports.jsx(InputRegisters,{alive:this.state.alive,formulaDisabled:this.state.native.params.slave==="1"||this.state.native.params.slave===1,socket:this.socket,native:this.state.native,instance:this.instance,adapterName:this.adapterName,changed:this.state.changed,onChange:(e,M,j)=>this.updateNativeValue(e,M,j),rooms:this.state.rooms||{},themeType:this.state.themeType})}renderHoldingRegisters(){return jsxRuntimeExports.jsx(HoldingRegisters,{alive:this.state.alive,formulaDisabled:this.state.native.params.slave==="1"||this.state.native.params.slave===1,socket:this.socket,native:this.state.native,instance:this.instance,adapterName:this.adapterName,changed:this.state.changed,onChange:(e,M,j)=>this.updateNativeValue(e,M,j),rooms:this.state.rooms||{},themeType:this.state.themeType})}renderTab(){return this.state.selectedTab==="connection"||!this.state.selectedTab?this.renderConnection():this.state.selectedTab==="settings"?this.renderSettings():this.state.selectedTab==="discrete-inputs"?this.renderDiscreteInputs():this.state.selectedTab==="coils"?this.renderCoils():this.state.selectedTab==="input-registers"?this.renderInputRegisters():this.state.selectedTab==="holding-registers"?this.renderHoldingRegisters():jsxRuntimeExports.jsx("div",{children:I18n.t("Unknown tab")})}render(){return!this.state.loaded||!this.state.moreLoaded?jsxRuntimeExports.jsx(StyledEngineProvider,{injectFirst:!0,children:jsxRuntimeExports.jsx(ThemeProvider,{theme:this.state.theme,children:jsxRuntimeExports.jsx(Loader,{themeType:this.state.themeType})})}):jsxRuntimeExports.jsx(StyledEngineProvider,{injectFirst:!0,children:jsxRuntimeExports.jsx(ThemeProvider,{theme:this.state.theme,children:jsxRuntimeExports.jsxs("div",{className:"App",style:{background:this.state.theme.palette.background.default,color:this.state.theme.palette.text.primary},children:[jsxRuntimeExports.jsx(AppBar,{position:"static",children:jsxRuntimeExports.jsx(Tabs,{indicatorColor:"secondary",value:this.state.selectedTab||tabs[0].name,onChange:(e,M)=>{this.setState({selectedTab:M}),window.localStorage.setItem(`modbus.${this.instance}.selectedTab`,M)},variant:"scrollable",scrollButtons:"auto",sx:{"&.Mui-indicator":styles.indicator},children:tabs.map(e=>jsxRuntimeExports.jsx(Tab$1,{value:e.name,sx:{"&.Mui-selected":styles.selected},label:e.icon?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[e.icon,I18n.t(e.title)]}):I18n.t(e.title),"data-name":e.name,title:e.tooltip?I18n.t(e.tooltip):void 0},e.name))})}),jsxRuntimeExports.jsx("div",{style:this.isIFrame?styles.tabContentIFrame:styles.tabContent,children:this.renderTab()}),this.renderError(),this.renderSaveCloseButtons()]})})})}}window.location.hostname==="localhost"||window.location.hostname==="[::1]"||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/);function unregister(){"serviceWorker"in navigator&&navigator.serviceWorker.ready.then(o=>o.unregister())}const version="8.0.2",pkg={version};window.adapterName="modbus";window.sentryDSN="https://19469f9280bd4b18a3e960e79cb01df2@sentry.iobroker.net/196";console.log(`iobroker.${window.adapterName}@${pkg.version}`);const container=document.getElementById("root");container&&clientExports.createRoot(container).render(jsxRuntimeExports.jsx(App,{}));unregister();export{requirePropTypes as a,getDefaultExportFromCjs as g,requireReact as r};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as V,a as ee,g as se}from"./index-C7pYT6lT.js";function fe(v,f){for(var a=0;a<f.length;a++){const g=f[a];if(typeof g!="string"&&!Array.isArray(g)){for(const l in g)if(l!=="default"&&!(l in v)){const r=Object.getOwnPropertyDescriptor(g,l);r&&Object.defineProperty(v,l,r.get?r:{enumerable:!0,get:()=>g[l]})}}}return Object.freeze(Object.defineProperty(v,Symbol.toStringTag,{value:"Module"}))}var R={},N,G;function te(){return G||(G=1,N={L:1,M:0,Q:3,H:2}),N}var k,K;function re(){return K||(K=1,k={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}),k}var I,U;function le(){if(U)return I;U=1;var v=re();function f(a){this.mode=v.MODE_8BIT_BYTE,this.data=a}return f.prototype={getLength:function(a){return this.data.length},write:function(a){for(var g=0;g<this.data.length;g++)a.put(this.data.charCodeAt(g),8)}},I=f,I}var x,F;function he(){if(F)return x;F=1;var v=te();function f(a,g){this.totalCount=a,this.dataCount=g}return f.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],f.getRSBlocks=function(a,g){var l=f.getRsBlockTable(a,g);if(l==null)throw new Error("bad rs block @ typeNumber:"+a+"/errorCorrectLevel:"+g);for(var r=l.length/3,u=new Array,n=0;n<r;n++)for(var t=l[n*3+0],e=l[n*3+1],o=l[n*3+2],i=0;i<t;i++)u.push(new f(e,o));return u},f.getRsBlockTable=function(a,g){switch(g){case v.L:return f.RS_BLOCK_TABLE[(a-1)*4+0];case v.M:return f.RS_BLOCK_TABLE[(a-1)*4+1];case v.Q:return f.RS_BLOCK_TABLE[(a-1)*4+2];case v.H:return f.RS_BLOCK_TABLE[(a-1)*4+3];default:return}},x=f,x}var S,X;function ve(){if(X)return S;X=1;function v(){this.buffer=new Array,this.length=0}return v.prototype={get:function(f){var a=Math.floor(f/8);return(this.buffer[a]>>>7-f%8&1)==1},put:function(f,a){for(var g=0;g<a;g++)this.putBit((f>>>a-g-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(f){var a=Math.floor(this.length/8);this.buffer.length<=a&&this.buffer.push(0),f&&(this.buffer[a]|=128>>>this.length%8),this.length++}},S=v,S}var Q,$;function ne(){if($)return Q;$=1;for(var v={glog:function(a){if(a<1)throw new Error("glog("+a+")");return v.LOG_TABLE[a]},gexp:function(a){for(;a<0;)a+=255;for(;a>=256;)a-=255;return v.EXP_TABLE[a]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},f=0;f<8;f++)v.EXP_TABLE[f]=1<<f;for(var f=8;f<256;f++)v.EXP_TABLE[f]=v.EXP_TABLE[f-4]^v.EXP_TABLE[f-5]^v.EXP_TABLE[f-6]^v.EXP_TABLE[f-8];for(var f=0;f<255;f++)v.LOG_TABLE[v.EXP_TABLE[f]]=f;return Q=v,Q}var H,Y;function ae(){if(Y)return H;Y=1;var v=ne();function f(a,g){if(a.length==null)throw new Error(a.length+"/"+g);for(var l=0;l<a.length&&a[l]==0;)l++;this.num=new Array(a.length-l+g);for(var r=0;r<a.length-l;r++)this.num[r]=a[r+l]}return f.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var g=new Array(this.getLength()+a.getLength()-1),l=0;l<this.getLength();l++)for(var r=0;r<a.getLength();r++)g[l+r]^=v.gexp(v.glog(this.get(l))+v.glog(a.get(r)));return new f(g,0)},mod:function(a){if(this.getLength()-a.getLength()<0)return this;for(var g=v.glog(this.get(0))-v.glog(a.get(0)),l=new Array(this.getLength()),r=0;r<this.getLength();r++)l[r]=this.get(r);for(var r=0;r<a.getLength();r++)l[r]^=v.gexp(v.glog(a.get(r))+g);return new f(l,0).mod(a)}},H=f,H}var z,J;function ge(){if(J)return z;J=1;var v=re(),f=ae(),a=ne(),g={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},l={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(r){for(var u=r<<10;l.getBCHDigit(u)-l.getBCHDigit(l.G15)>=0;)u^=l.G15<<l.getBCHDigit(u)-l.getBCHDigit(l.G15);return(r<<10|u)^l.G15_MASK},getBCHTypeNumber:function(r){for(var u=r<<12;l.getBCHDigit(u)-l.getBCHDigit(l.G18)>=0;)u^=l.G18<<l.getBCHDigit(u)-l.getBCHDigit(l.G18);return r<<12|u},getBCHDigit:function(r){for(var u=0;r!=0;)u++,r>>>=1;return u},getPatternPosition:function(r){return l.PATTERN_POSITION_TABLE[r-1]},getMask:function(r,u,n){switch(r){case g.PATTERN000:return(u+n)%2==0;case g.PATTERN001:return u%2==0;case g.PATTERN010:return n%3==0;case g.PATTERN011:return(u+n)%3==0;case g.PATTERN100:return(Math.floor(u/2)+Math.floor(n/3))%2==0;case g.PATTERN101:return u*n%2+u*n%3==0;case g.PATTERN110:return(u*n%2+u*n%3)%2==0;case g.PATTERN111:return(u*n%3+(u+n)%2)%2==0;default:throw new Error("bad maskPattern:"+r)}},getErrorCorrectPolynomial:function(r){for(var u=new f([1],0),n=0;n<r;n++)u=u.multiply(new f([1,a.gexp(n)],0));return u},getLengthInBits:function(r,u){if(1<=u&&u<10)switch(r){case v.MODE_NUMBER:return 10;case v.MODE_ALPHA_NUM:return 9;case v.MODE_8BIT_BYTE:return 8;case v.MODE_KANJI:return 8;default:throw new Error("mode:"+r)}else if(u<27)switch(r){case v.MODE_NUMBER:return 12;case v.MODE_ALPHA_NUM:return 11;case v.MODE_8BIT_BYTE:return 16;case v.MODE_KANJI:return 10;default:throw new Error("mode:"+r)}else if(u<41)switch(r){case v.MODE_NUMBER:return 14;case v.MODE_ALPHA_NUM:return 13;case v.MODE_8BIT_BYTE:return 16;case v.MODE_KANJI:return 12;default:throw new Error("mode:"+r)}else throw new Error("type:"+u)},getLostPoint:function(r){for(var u=r.getModuleCount(),n=0,t=0;t<u;t++)for(var e=0;e<u;e++){for(var o=0,i=r.isDark(t,e),s=-1;s<=1;s++)if(!(t+s<0||u<=t+s))for(var d=-1;d<=1;d++)e+d<0||u<=e+d||s==0&&d==0||i==r.isDark(t+s,e+d)&&o++;o>5&&(n+=3+o-5)}for(var t=0;t<u-1;t++)for(var e=0;e<u-1;e++){var h=0;r.isDark(t,e)&&h++,r.isDark(t+1,e)&&h++,r.isDark(t,e+1)&&h++,r.isDark(t+1,e+1)&&h++,(h==0||h==4)&&(n+=3)}for(var t=0;t<u;t++)for(var e=0;e<u-6;e++)r.isDark(t,e)&&!r.isDark(t,e+1)&&r.isDark(t,e+2)&&r.isDark(t,e+3)&&r.isDark(t,e+4)&&!r.isDark(t,e+5)&&r.isDark(t,e+6)&&(n+=40);for(var e=0;e<u;e++)for(var t=0;t<u-6;t++)r.isDark(t,e)&&!r.isDark(t+1,e)&&r.isDark(t+2,e)&&r.isDark(t+3,e)&&r.isDark(t+4,e)&&!r.isDark(t+5,e)&&r.isDark(t+6,e)&&(n+=40);for(var p=0,e=0;e<u;e++)for(var t=0;t<u;t++)r.isDark(t,e)&&p++;var c=Math.abs(100*p/u/u-50)/5;return n+=c*10,n}};return z=l,z}var q,W;function de(){if(W)return q;W=1;var v=le(),f=he(),a=ve(),g=ge(),l=ae();function r(n,t){this.typeNumber=n,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var u=r.prototype;return u.addData=function(n){var t=new v(n);this.dataList.push(t),this.dataCache=null},u.isDark=function(n,t){if(n<0||this.moduleCount<=n||t<0||this.moduleCount<=t)throw new Error(n+","+t);return this.modules[n][t]},u.getModuleCount=function(){return this.moduleCount},u.make=function(){if(this.typeNumber<1){var n=1;for(n=1;n<40;n++){for(var t=f.getRSBlocks(n,this.errorCorrectLevel),e=new a,o=0,i=0;i<t.length;i++)o+=t[i].dataCount;for(var i=0;i<this.dataList.length;i++){var s=this.dataList[i];e.put(s.mode,4),e.put(s.getLength(),g.getLengthInBits(s.mode,n)),s.write(e)}if(e.getLengthInBits()<=o*8)break}this.typeNumber=n}this.makeImpl(!1,this.getBestMaskPattern())},u.makeImpl=function(n,t){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var e=0;e<this.moduleCount;e++){this.modules[e]=new Array(this.moduleCount);for(var o=0;o<this.moduleCount;o++)this.modules[e][o]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(n,t),this.typeNumber>=7&&this.setupTypeNumber(n),this.dataCache==null&&(this.dataCache=r.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,t)},u.setupPositionProbePattern=function(n,t){for(var e=-1;e<=7;e++)if(!(n+e<=-1||this.moduleCount<=n+e))for(var o=-1;o<=7;o++)t+o<=-1||this.moduleCount<=t+o||(0<=e&&e<=6&&(o==0||o==6)||0<=o&&o<=6&&(e==0||e==6)||2<=e&&e<=4&&2<=o&&o<=4?this.modules[n+e][t+o]=!0:this.modules[n+e][t+o]=!1)},u.getBestMaskPattern=function(){for(var n=0,t=0,e=0;e<8;e++){this.makeImpl(!0,e);var o=g.getLostPoint(this);(e==0||n>o)&&(n=o,t=e)}return t},u.createMovieClip=function(n,t,e){var o=n.createEmptyMovieClip(t,e),i=1;this.make();for(var s=0;s<this.modules.length;s++)for(var d=s*i,h=0;h<this.modules[s].length;h++){var p=h*i,c=this.modules[s][h];c&&(o.beginFill(0,100),o.moveTo(p,d),o.lineTo(p+i,d),o.lineTo(p+i,d+i),o.lineTo(p,d+i),o.endFill())}return o},u.setupTimingPattern=function(){for(var n=8;n<this.moduleCount-8;n++)this.modules[n][6]==null&&(this.modules[n][6]=n%2==0);for(var t=8;t<this.moduleCount-8;t++)this.modules[6][t]==null&&(this.modules[6][t]=t%2==0)},u.setupPositionAdjustPattern=function(){for(var n=g.getPatternPosition(this.typeNumber),t=0;t<n.length;t++)for(var e=0;e<n.length;e++){var o=n[t],i=n[e];if(this.modules[o][i]==null)for(var s=-2;s<=2;s++)for(var d=-2;d<=2;d++)s==-2||s==2||d==-2||d==2||s==0&&d==0?this.modules[o+s][i+d]=!0:this.modules[o+s][i+d]=!1}},u.setupTypeNumber=function(n){for(var t=g.getBCHTypeNumber(this.typeNumber),e=0;e<18;e++){var o=!n&&(t>>e&1)==1;this.modules[Math.floor(e/3)][e%3+this.moduleCount-8-3]=o}for(var e=0;e<18;e++){var o=!n&&(t>>e&1)==1;this.modules[e%3+this.moduleCount-8-3][Math.floor(e/3)]=o}},u.setupTypeInfo=function(n,t){for(var e=this.errorCorrectLevel<<3|t,o=g.getBCHTypeInfo(e),i=0;i<15;i++){var s=!n&&(o>>i&1)==1;i<6?this.modules[i][8]=s:i<8?this.modules[i+1][8]=s:this.modules[this.moduleCount-15+i][8]=s}for(var i=0;i<15;i++){var s=!n&&(o>>i&1)==1;i<8?this.modules[8][this.moduleCount-i-1]=s:i<9?this.modules[8][15-i-1+1]=s:this.modules[8][15-i-1]=s}this.modules[this.moduleCount-8][8]=!n},u.mapData=function(n,t){for(var e=-1,o=this.moduleCount-1,i=7,s=0,d=this.moduleCount-1;d>0;d-=2)for(d==6&&d--;;){for(var h=0;h<2;h++)if(this.modules[o][d-h]==null){var p=!1;s<n.length&&(p=(n[s]>>>i&1)==1);var c=g.getMask(t,o,d-h);c&&(p=!p),this.modules[o][d-h]=p,i--,i==-1&&(s++,i=7)}if(o+=e,o<0||this.moduleCount<=o){o-=e,e=-e;break}}},r.PAD0=236,r.PAD1=17,r.createData=function(n,t,e){for(var o=f.getRSBlocks(n,t),i=new a,s=0;s<e.length;s++){var d=e[s];i.put(d.mode,4),i.put(d.getLength(),g.getLengthInBits(d.mode,n)),d.write(i)}for(var h=0,s=0;s<o.length;s++)h+=o[s].dataCount;if(i.getLengthInBits()>h*8)throw new Error("code length overflow. ("+i.getLengthInBits()+">"+h*8+")");for(i.getLengthInBits()+4<=h*8&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=h*8||(i.put(r.PAD0,8),i.getLengthInBits()>=h*8));)i.put(r.PAD1,8);return r.createBytes(i,o)},r.createBytes=function(n,t){for(var e=0,o=0,i=0,s=new Array(t.length),d=new Array(t.length),h=0;h<t.length;h++){var p=t[h].dataCount,c=t[h].totalCount-p;o=Math.max(o,p),i=Math.max(i,c),s[h]=new Array(p);for(var m=0;m<s[h].length;m++)s[h][m]=255&n.buffer[m+e];e+=p;var E=g.getErrorCorrectPolynomial(c),B=new l(s[h],E.getLength()-1),T=B.mod(E);d[h]=new Array(E.getLength()-1);for(var m=0;m<d[h].length;m++){var _=m+T.getLength()-d[h].length;d[h][m]=_>=0?T.get(_):0}}for(var P=0,m=0;m<t.length;m++)P+=t[m].totalCount;for(var C=new Array(P),L=0,m=0;m<o;m++)for(var h=0;h<t.length;h++)m<s[h].length&&(C[L++]=s[h][m]);for(var m=0;m<i;m++)for(var h=0;h<t.length;h++)m<d[h].length&&(C[L++]=d[h][m]);return C},q=r,q}var A={},Z;function pe(){if(Z)return A;Z=1,Object.defineProperty(A,"__esModule",{value:!0});var v=Object.assign||function(e){for(var o=1;o<arguments.length;o++){var i=arguments[o];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},f=ee(),a=r(f),g=V(),l=r(g);function r(e){return e&&e.__esModule?e:{default:e}}function u(e,o){var i={};for(var s in e)o.indexOf(s)>=0||Object.prototype.hasOwnProperty.call(e,s)&&(i[s]=e[s]);return i}var n={bgColor:a.default.oneOfType([a.default.object,a.default.string]).isRequired,bgD:a.default.string.isRequired,fgColor:a.default.oneOfType([a.default.object,a.default.string]).isRequired,fgD:a.default.string.isRequired,size:a.default.number.isRequired,title:a.default.string,viewBoxSize:a.default.number.isRequired,xmlns:a.default.string},t=(0,g.forwardRef)(function(e,o){var i=e.bgColor,s=e.bgD,d=e.fgD,h=e.fgColor,p=e.size,c=e.title,m=e.viewBoxSize,E=e.xmlns,B=E===void 0?"http://www.w3.org/2000/svg":E,T=u(e,["bgColor","bgD","fgD","fgColor","size","title","viewBoxSize","xmlns"]);return l.default.createElement("svg",v({},T,{height:p,ref:o,viewBox:"0 0 "+m+" "+m,width:p,xmlns:B}),c?l.default.createElement("title",null,c):null,l.default.createElement("path",{d:s,fill:i}),l.default.createElement("path",{d,fill:h}))});return t.displayName="QRCodeSvg",t.propTypes=n,A.default=t,A}var j;function me(){if(j)return R;j=1,Object.defineProperty(R,"__esModule",{value:!0}),R.QRCode=void 0;var v=Object.assign||function(p){for(var c=1;c<arguments.length;c++){var m=arguments[c];for(var E in m)Object.prototype.hasOwnProperty.call(m,E)&&(p[E]=m[E])}return p},f=ee(),a=i(f),g=te(),l=i(g),r=de(),u=i(r),n=V(),t=i(n),e=pe(),o=i(e);function i(p){return p&&p.__esModule?p:{default:p}}function s(p,c){var m={};for(var E in p)c.indexOf(E)>=0||Object.prototype.hasOwnProperty.call(p,E)&&(m[E]=p[E]);return m}var d={bgColor:a.default.oneOfType([a.default.object,a.default.string]),fgColor:a.default.oneOfType([a.default.object,a.default.string]),level:a.default.string,size:a.default.number,value:a.default.string.isRequired},h=(0,n.forwardRef)(function(p,c){var m=p.bgColor,E=m===void 0?"#FFFFFF":m,B=p.fgColor,T=B===void 0?"#000000":B,_=p.level,P=_===void 0?"L":_,C=p.size,L=C===void 0?256:C,oe=p.value,ue=s(p,["bgColor","fgColor","level","size","value"]),D=new u.default(-1,l.default[P]);D.addData(oe),D.make();var w=D.modules;return t.default.createElement(o.default,v({},ue,{bgColor:E,bgD:w.map(function(y,b){return y.map(function(M,O){return M?"":"M "+O+" "+b+" l 1 0 0 1 -1 0 Z"}).join(" ")}).join(" "),fgColor:T,fgD:w.map(function(y,b){return y.map(function(M,O){return M?"M "+O+" "+b+" l 1 0 0 1 -1 0 Z":""}).join(" ")}).join(" "),ref:c,size:L,viewBoxSize:w.length}))});return R.QRCode=h,h.displayName="QRCode",h.propTypes=d,R.default=h,R}var ie=me();const ce=se(ie),Be=fe({__proto__:null,default:ce},[ie]);export{Be as i};
|
|
1
|
+
import{r as V,a as ee,g as se}from"./index-DP_oexNc.js";function fe(v,f){for(var a=0;a<f.length;a++){const g=f[a];if(typeof g!="string"&&!Array.isArray(g)){for(const l in g)if(l!=="default"&&!(l in v)){const r=Object.getOwnPropertyDescriptor(g,l);r&&Object.defineProperty(v,l,r.get?r:{enumerable:!0,get:()=>g[l]})}}}return Object.freeze(Object.defineProperty(v,Symbol.toStringTag,{value:"Module"}))}var R={},N,G;function te(){return G||(G=1,N={L:1,M:0,Q:3,H:2}),N}var k,K;function re(){return K||(K=1,k={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}),k}var I,U;function le(){if(U)return I;U=1;var v=re();function f(a){this.mode=v.MODE_8BIT_BYTE,this.data=a}return f.prototype={getLength:function(a){return this.data.length},write:function(a){for(var g=0;g<this.data.length;g++)a.put(this.data.charCodeAt(g),8)}},I=f,I}var x,F;function he(){if(F)return x;F=1;var v=te();function f(a,g){this.totalCount=a,this.dataCount=g}return f.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],f.getRSBlocks=function(a,g){var l=f.getRsBlockTable(a,g);if(l==null)throw new Error("bad rs block @ typeNumber:"+a+"/errorCorrectLevel:"+g);for(var r=l.length/3,u=new Array,n=0;n<r;n++)for(var t=l[n*3+0],e=l[n*3+1],o=l[n*3+2],i=0;i<t;i++)u.push(new f(e,o));return u},f.getRsBlockTable=function(a,g){switch(g){case v.L:return f.RS_BLOCK_TABLE[(a-1)*4+0];case v.M:return f.RS_BLOCK_TABLE[(a-1)*4+1];case v.Q:return f.RS_BLOCK_TABLE[(a-1)*4+2];case v.H:return f.RS_BLOCK_TABLE[(a-1)*4+3];default:return}},x=f,x}var S,X;function ve(){if(X)return S;X=1;function v(){this.buffer=new Array,this.length=0}return v.prototype={get:function(f){var a=Math.floor(f/8);return(this.buffer[a]>>>7-f%8&1)==1},put:function(f,a){for(var g=0;g<a;g++)this.putBit((f>>>a-g-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(f){var a=Math.floor(this.length/8);this.buffer.length<=a&&this.buffer.push(0),f&&(this.buffer[a]|=128>>>this.length%8),this.length++}},S=v,S}var Q,$;function ne(){if($)return Q;$=1;for(var v={glog:function(a){if(a<1)throw new Error("glog("+a+")");return v.LOG_TABLE[a]},gexp:function(a){for(;a<0;)a+=255;for(;a>=256;)a-=255;return v.EXP_TABLE[a]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},f=0;f<8;f++)v.EXP_TABLE[f]=1<<f;for(var f=8;f<256;f++)v.EXP_TABLE[f]=v.EXP_TABLE[f-4]^v.EXP_TABLE[f-5]^v.EXP_TABLE[f-6]^v.EXP_TABLE[f-8];for(var f=0;f<255;f++)v.LOG_TABLE[v.EXP_TABLE[f]]=f;return Q=v,Q}var H,Y;function ae(){if(Y)return H;Y=1;var v=ne();function f(a,g){if(a.length==null)throw new Error(a.length+"/"+g);for(var l=0;l<a.length&&a[l]==0;)l++;this.num=new Array(a.length-l+g);for(var r=0;r<a.length-l;r++)this.num[r]=a[r+l]}return f.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var g=new Array(this.getLength()+a.getLength()-1),l=0;l<this.getLength();l++)for(var r=0;r<a.getLength();r++)g[l+r]^=v.gexp(v.glog(this.get(l))+v.glog(a.get(r)));return new f(g,0)},mod:function(a){if(this.getLength()-a.getLength()<0)return this;for(var g=v.glog(this.get(0))-v.glog(a.get(0)),l=new Array(this.getLength()),r=0;r<this.getLength();r++)l[r]=this.get(r);for(var r=0;r<a.getLength();r++)l[r]^=v.gexp(v.glog(a.get(r))+g);return new f(l,0).mod(a)}},H=f,H}var z,J;function ge(){if(J)return z;J=1;var v=re(),f=ae(),a=ne(),g={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},l={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(r){for(var u=r<<10;l.getBCHDigit(u)-l.getBCHDigit(l.G15)>=0;)u^=l.G15<<l.getBCHDigit(u)-l.getBCHDigit(l.G15);return(r<<10|u)^l.G15_MASK},getBCHTypeNumber:function(r){for(var u=r<<12;l.getBCHDigit(u)-l.getBCHDigit(l.G18)>=0;)u^=l.G18<<l.getBCHDigit(u)-l.getBCHDigit(l.G18);return r<<12|u},getBCHDigit:function(r){for(var u=0;r!=0;)u++,r>>>=1;return u},getPatternPosition:function(r){return l.PATTERN_POSITION_TABLE[r-1]},getMask:function(r,u,n){switch(r){case g.PATTERN000:return(u+n)%2==0;case g.PATTERN001:return u%2==0;case g.PATTERN010:return n%3==0;case g.PATTERN011:return(u+n)%3==0;case g.PATTERN100:return(Math.floor(u/2)+Math.floor(n/3))%2==0;case g.PATTERN101:return u*n%2+u*n%3==0;case g.PATTERN110:return(u*n%2+u*n%3)%2==0;case g.PATTERN111:return(u*n%3+(u+n)%2)%2==0;default:throw new Error("bad maskPattern:"+r)}},getErrorCorrectPolynomial:function(r){for(var u=new f([1],0),n=0;n<r;n++)u=u.multiply(new f([1,a.gexp(n)],0));return u},getLengthInBits:function(r,u){if(1<=u&&u<10)switch(r){case v.MODE_NUMBER:return 10;case v.MODE_ALPHA_NUM:return 9;case v.MODE_8BIT_BYTE:return 8;case v.MODE_KANJI:return 8;default:throw new Error("mode:"+r)}else if(u<27)switch(r){case v.MODE_NUMBER:return 12;case v.MODE_ALPHA_NUM:return 11;case v.MODE_8BIT_BYTE:return 16;case v.MODE_KANJI:return 10;default:throw new Error("mode:"+r)}else if(u<41)switch(r){case v.MODE_NUMBER:return 14;case v.MODE_ALPHA_NUM:return 13;case v.MODE_8BIT_BYTE:return 16;case v.MODE_KANJI:return 12;default:throw new Error("mode:"+r)}else throw new Error("type:"+u)},getLostPoint:function(r){for(var u=r.getModuleCount(),n=0,t=0;t<u;t++)for(var e=0;e<u;e++){for(var o=0,i=r.isDark(t,e),s=-1;s<=1;s++)if(!(t+s<0||u<=t+s))for(var d=-1;d<=1;d++)e+d<0||u<=e+d||s==0&&d==0||i==r.isDark(t+s,e+d)&&o++;o>5&&(n+=3+o-5)}for(var t=0;t<u-1;t++)for(var e=0;e<u-1;e++){var h=0;r.isDark(t,e)&&h++,r.isDark(t+1,e)&&h++,r.isDark(t,e+1)&&h++,r.isDark(t+1,e+1)&&h++,(h==0||h==4)&&(n+=3)}for(var t=0;t<u;t++)for(var e=0;e<u-6;e++)r.isDark(t,e)&&!r.isDark(t,e+1)&&r.isDark(t,e+2)&&r.isDark(t,e+3)&&r.isDark(t,e+4)&&!r.isDark(t,e+5)&&r.isDark(t,e+6)&&(n+=40);for(var e=0;e<u;e++)for(var t=0;t<u-6;t++)r.isDark(t,e)&&!r.isDark(t+1,e)&&r.isDark(t+2,e)&&r.isDark(t+3,e)&&r.isDark(t+4,e)&&!r.isDark(t+5,e)&&r.isDark(t+6,e)&&(n+=40);for(var p=0,e=0;e<u;e++)for(var t=0;t<u;t++)r.isDark(t,e)&&p++;var c=Math.abs(100*p/u/u-50)/5;return n+=c*10,n}};return z=l,z}var q,W;function de(){if(W)return q;W=1;var v=le(),f=he(),a=ve(),g=ge(),l=ae();function r(n,t){this.typeNumber=n,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var u=r.prototype;return u.addData=function(n){var t=new v(n);this.dataList.push(t),this.dataCache=null},u.isDark=function(n,t){if(n<0||this.moduleCount<=n||t<0||this.moduleCount<=t)throw new Error(n+","+t);return this.modules[n][t]},u.getModuleCount=function(){return this.moduleCount},u.make=function(){if(this.typeNumber<1){var n=1;for(n=1;n<40;n++){for(var t=f.getRSBlocks(n,this.errorCorrectLevel),e=new a,o=0,i=0;i<t.length;i++)o+=t[i].dataCount;for(var i=0;i<this.dataList.length;i++){var s=this.dataList[i];e.put(s.mode,4),e.put(s.getLength(),g.getLengthInBits(s.mode,n)),s.write(e)}if(e.getLengthInBits()<=o*8)break}this.typeNumber=n}this.makeImpl(!1,this.getBestMaskPattern())},u.makeImpl=function(n,t){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var e=0;e<this.moduleCount;e++){this.modules[e]=new Array(this.moduleCount);for(var o=0;o<this.moduleCount;o++)this.modules[e][o]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(n,t),this.typeNumber>=7&&this.setupTypeNumber(n),this.dataCache==null&&(this.dataCache=r.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,t)},u.setupPositionProbePattern=function(n,t){for(var e=-1;e<=7;e++)if(!(n+e<=-1||this.moduleCount<=n+e))for(var o=-1;o<=7;o++)t+o<=-1||this.moduleCount<=t+o||(0<=e&&e<=6&&(o==0||o==6)||0<=o&&o<=6&&(e==0||e==6)||2<=e&&e<=4&&2<=o&&o<=4?this.modules[n+e][t+o]=!0:this.modules[n+e][t+o]=!1)},u.getBestMaskPattern=function(){for(var n=0,t=0,e=0;e<8;e++){this.makeImpl(!0,e);var o=g.getLostPoint(this);(e==0||n>o)&&(n=o,t=e)}return t},u.createMovieClip=function(n,t,e){var o=n.createEmptyMovieClip(t,e),i=1;this.make();for(var s=0;s<this.modules.length;s++)for(var d=s*i,h=0;h<this.modules[s].length;h++){var p=h*i,c=this.modules[s][h];c&&(o.beginFill(0,100),o.moveTo(p,d),o.lineTo(p+i,d),o.lineTo(p+i,d+i),o.lineTo(p,d+i),o.endFill())}return o},u.setupTimingPattern=function(){for(var n=8;n<this.moduleCount-8;n++)this.modules[n][6]==null&&(this.modules[n][6]=n%2==0);for(var t=8;t<this.moduleCount-8;t++)this.modules[6][t]==null&&(this.modules[6][t]=t%2==0)},u.setupPositionAdjustPattern=function(){for(var n=g.getPatternPosition(this.typeNumber),t=0;t<n.length;t++)for(var e=0;e<n.length;e++){var o=n[t],i=n[e];if(this.modules[o][i]==null)for(var s=-2;s<=2;s++)for(var d=-2;d<=2;d++)s==-2||s==2||d==-2||d==2||s==0&&d==0?this.modules[o+s][i+d]=!0:this.modules[o+s][i+d]=!1}},u.setupTypeNumber=function(n){for(var t=g.getBCHTypeNumber(this.typeNumber),e=0;e<18;e++){var o=!n&&(t>>e&1)==1;this.modules[Math.floor(e/3)][e%3+this.moduleCount-8-3]=o}for(var e=0;e<18;e++){var o=!n&&(t>>e&1)==1;this.modules[e%3+this.moduleCount-8-3][Math.floor(e/3)]=o}},u.setupTypeInfo=function(n,t){for(var e=this.errorCorrectLevel<<3|t,o=g.getBCHTypeInfo(e),i=0;i<15;i++){var s=!n&&(o>>i&1)==1;i<6?this.modules[i][8]=s:i<8?this.modules[i+1][8]=s:this.modules[this.moduleCount-15+i][8]=s}for(var i=0;i<15;i++){var s=!n&&(o>>i&1)==1;i<8?this.modules[8][this.moduleCount-i-1]=s:i<9?this.modules[8][15-i-1+1]=s:this.modules[8][15-i-1]=s}this.modules[this.moduleCount-8][8]=!n},u.mapData=function(n,t){for(var e=-1,o=this.moduleCount-1,i=7,s=0,d=this.moduleCount-1;d>0;d-=2)for(d==6&&d--;;){for(var h=0;h<2;h++)if(this.modules[o][d-h]==null){var p=!1;s<n.length&&(p=(n[s]>>>i&1)==1);var c=g.getMask(t,o,d-h);c&&(p=!p),this.modules[o][d-h]=p,i--,i==-1&&(s++,i=7)}if(o+=e,o<0||this.moduleCount<=o){o-=e,e=-e;break}}},r.PAD0=236,r.PAD1=17,r.createData=function(n,t,e){for(var o=f.getRSBlocks(n,t),i=new a,s=0;s<e.length;s++){var d=e[s];i.put(d.mode,4),i.put(d.getLength(),g.getLengthInBits(d.mode,n)),d.write(i)}for(var h=0,s=0;s<o.length;s++)h+=o[s].dataCount;if(i.getLengthInBits()>h*8)throw new Error("code length overflow. ("+i.getLengthInBits()+">"+h*8+")");for(i.getLengthInBits()+4<=h*8&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=h*8||(i.put(r.PAD0,8),i.getLengthInBits()>=h*8));)i.put(r.PAD1,8);return r.createBytes(i,o)},r.createBytes=function(n,t){for(var e=0,o=0,i=0,s=new Array(t.length),d=new Array(t.length),h=0;h<t.length;h++){var p=t[h].dataCount,c=t[h].totalCount-p;o=Math.max(o,p),i=Math.max(i,c),s[h]=new Array(p);for(var m=0;m<s[h].length;m++)s[h][m]=255&n.buffer[m+e];e+=p;var E=g.getErrorCorrectPolynomial(c),B=new l(s[h],E.getLength()-1),T=B.mod(E);d[h]=new Array(E.getLength()-1);for(var m=0;m<d[h].length;m++){var _=m+T.getLength()-d[h].length;d[h][m]=_>=0?T.get(_):0}}for(var P=0,m=0;m<t.length;m++)P+=t[m].totalCount;for(var C=new Array(P),L=0,m=0;m<o;m++)for(var h=0;h<t.length;h++)m<s[h].length&&(C[L++]=s[h][m]);for(var m=0;m<i;m++)for(var h=0;h<t.length;h++)m<d[h].length&&(C[L++]=d[h][m]);return C},q=r,q}var A={},Z;function pe(){if(Z)return A;Z=1,Object.defineProperty(A,"__esModule",{value:!0});var v=Object.assign||function(e){for(var o=1;o<arguments.length;o++){var i=arguments[o];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},f=ee(),a=r(f),g=V(),l=r(g);function r(e){return e&&e.__esModule?e:{default:e}}function u(e,o){var i={};for(var s in e)o.indexOf(s)>=0||Object.prototype.hasOwnProperty.call(e,s)&&(i[s]=e[s]);return i}var n={bgColor:a.default.oneOfType([a.default.object,a.default.string]).isRequired,bgD:a.default.string.isRequired,fgColor:a.default.oneOfType([a.default.object,a.default.string]).isRequired,fgD:a.default.string.isRequired,size:a.default.number.isRequired,title:a.default.string,viewBoxSize:a.default.number.isRequired,xmlns:a.default.string},t=(0,g.forwardRef)(function(e,o){var i=e.bgColor,s=e.bgD,d=e.fgD,h=e.fgColor,p=e.size,c=e.title,m=e.viewBoxSize,E=e.xmlns,B=E===void 0?"http://www.w3.org/2000/svg":E,T=u(e,["bgColor","bgD","fgD","fgColor","size","title","viewBoxSize","xmlns"]);return l.default.createElement("svg",v({},T,{height:p,ref:o,viewBox:"0 0 "+m+" "+m,width:p,xmlns:B}),c?l.default.createElement("title",null,c):null,l.default.createElement("path",{d:s,fill:i}),l.default.createElement("path",{d,fill:h}))});return t.displayName="QRCodeSvg",t.propTypes=n,A.default=t,A}var j;function me(){if(j)return R;j=1,Object.defineProperty(R,"__esModule",{value:!0}),R.QRCode=void 0;var v=Object.assign||function(p){for(var c=1;c<arguments.length;c++){var m=arguments[c];for(var E in m)Object.prototype.hasOwnProperty.call(m,E)&&(p[E]=m[E])}return p},f=ee(),a=i(f),g=te(),l=i(g),r=de(),u=i(r),n=V(),t=i(n),e=pe(),o=i(e);function i(p){return p&&p.__esModule?p:{default:p}}function s(p,c){var m={};for(var E in p)c.indexOf(E)>=0||Object.prototype.hasOwnProperty.call(p,E)&&(m[E]=p[E]);return m}var d={bgColor:a.default.oneOfType([a.default.object,a.default.string]),fgColor:a.default.oneOfType([a.default.object,a.default.string]),level:a.default.string,size:a.default.number,value:a.default.string.isRequired},h=(0,n.forwardRef)(function(p,c){var m=p.bgColor,E=m===void 0?"#FFFFFF":m,B=p.fgColor,T=B===void 0?"#000000":B,_=p.level,P=_===void 0?"L":_,C=p.size,L=C===void 0?256:C,oe=p.value,ue=s(p,["bgColor","fgColor","level","size","value"]),D=new u.default(-1,l.default[P]);D.addData(oe),D.make();var w=D.modules;return t.default.createElement(o.default,v({},ue,{bgColor:E,bgD:w.map(function(y,b){return y.map(function(M,O){return M?"":"M "+O+" "+b+" l 1 0 0 1 -1 0 Z"}).join(" ")}).join(" "),fgColor:T,fgD:w.map(function(y,b){return y.map(function(M,O){return M?"M "+O+" "+b+" l 1 0 0 1 -1 0 Z":""}).join(" ")}).join(" "),ref:c,size:L,viewBoxSize:w.length}))});return R.QRCode=h,h.displayName="QRCode",h.propTypes=d,R.default=h,R}var ie=me();const ce=se(ie),Be=fe({__proto__:null,default:ce},[ie]);export{Be as i};
|
package/admin/index_m.html
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
></script>
|
|
25
25
|
<script type="text/javascript" onerror="setTimeout(function(){window.location.reload()}, 5000)" src="./lib/js/socket.io.js"></script>
|
|
26
26
|
<title>Modbus</title>
|
|
27
|
-
<script type="module" crossorigin src="./assets/index-
|
|
27
|
+
<script type="module" crossorigin src="./assets/index-DP_oexNc.js"></script>
|
|
28
28
|
<link rel="stylesheet" crossorigin href="./assets/index-Bk6U_LJW.css">
|
|
29
29
|
</head>
|
|
30
30
|
<body>
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "modbus",
|
|
4
|
-
"version": "8.0.
|
|
4
|
+
"version": "8.0.2",
|
|
5
5
|
"news": {
|
|
6
|
+
"8.0.2": {
|
|
7
|
+
"en": "Set default value of slave to '0' and not to 0",
|
|
8
|
+
"de": "Standardwert von Slave auf '0' festlegen und nicht auf 0",
|
|
9
|
+
"ru": "Установить значение раба по умолчанию до «0», а не до 0",
|
|
10
|
+
"pt": "Definir o valor padrão do escravo para '0' e não para 0",
|
|
11
|
+
"nl": "Stel de standaard waarde van slave in op '0' en niet op 0",
|
|
12
|
+
"fr": "Définir la valeur par défaut de l'esclave à '0' et non à 0",
|
|
13
|
+
"it": "Imposta il valore predefinito di slave a '0' e non a 0",
|
|
14
|
+
"es": "Establecer valor predeterminado de esclavo a '0' y no a 0",
|
|
15
|
+
"pl": "Ustaw domyślną wartość niewolnika na '0' i nie na 0",
|
|
16
|
+
"uk": "Встановити значення за замовчуванням раба до '0' і не до 0",
|
|
17
|
+
"zh-cn": "将奴隶的默认值设定为“ 0 ” 而不是“ 0 ”"
|
|
18
|
+
},
|
|
6
19
|
"8.0.1": {
|
|
7
20
|
"en": "Disable logging of request timeout if `disableLogging` parameter is set to true",
|
|
8
21
|
"de": "Deaktivieren Sie die Registrierung der Anfrage-Timeout, wenn `disable Logging` Parameter wird auf true gesetzt",
|
|
@@ -80,19 +93,6 @@
|
|
|
80
93
|
"pl": "Redagowanie kart konfiguracyjnych\nDodano opcję usunięcia wiodących podkreśleń w nazwach obiektów",
|
|
81
94
|
"uk": "Редизайн вкладок конфігурації\nДодана можливість видалити провідні джгути в назвах об'єкта",
|
|
82
95
|
"zh-cn": "配置标签的重新设计\n添加了删除对象名称中前置下划线的选项"
|
|
83
|
-
},
|
|
84
|
-
"7.0.0": {
|
|
85
|
-
"en": "Improved Modbus error handling and fault tolerance - continue polling working devices even when others fail\nFixes memory leak\nAdded option to disable connection error logging to avoid log spam when devices are unavailable\nShow values directly in configuration\nImplemented TLS connection (master)",
|
|
86
|
-
"de": "Verbesserte Modbus-Fehlerhandling und Fehlertoleranz - auch bei Ausfall anderer Arbeitsgeräte weiter verschmutzen\nBehebt Speicherleck\nOption hinzugefügt, um Verbindungsfehler zu deaktivieren Log Spam zu vermeiden, wenn Geräte nicht verfügbar sind\nWerte direkt in Konfiguration anzeigen\nTLS-Verbindung (Master)",
|
|
87
|
-
"ru": "Улучшенная обработка ошибок Modbus и отказоустойчивость - продолжайте опрос рабочих устройств, даже когда другие терпят неудачу\nИсправление утечки памяти\nДобавлена опция отключения регистрации ошибок подключения, чтобы избежать спама при недоступности устройств\nПоказать значения непосредственно в конфигурации\nРеализованное соединение TLS (master)",
|
|
88
|
-
"pt": "Manuseamento de erros Modbus melhorado e tolerância a falhas - continue pesquisando dispositivos de trabalho mesmo quando outros falham\nCorrige a fuga de memória\nOpção adicionada para desativar o registro de erros de conexão para evitar spam de log quando os dispositivos não estiverem disponíveis\nMostrar os valores directamente na configuração\nConexão TLS implementada (mestre)",
|
|
89
|
-
"nl": "Verbeterde Modbus fout behandeling en fouttolerantie - blijven peilen werkende apparaten, zelfs als anderen falen\nHerstelt geheugenlek\nToegevoegde optie voor het uitschakelen van verbinding fout logging om log spam te voorkomen wanneer apparaten niet beschikbaar zijn\nToon waarden direct in configuratie\nUitvoerde TLS-verbinding (master)",
|
|
90
|
-
"fr": "Amélioration de la gestion des erreurs Modbus et de la tolérance aux défauts - continuer les dispositifs de travail des sondages même lorsque d'autres échouent\nCorrige la fuite de mémoire\nAjout d'une option pour désactiver l'enregistrement des erreurs de connexion pour éviter le log spam lorsque les appareils ne sont pas disponibles\nAfficher les valeurs directement dans la configuration\nConnexion TLS mise en œuvre (maître)",
|
|
91
|
-
"it": "Miglioramento della gestione degli errori Modbus e della tolleranza ai guasti - continuare a inquinare i dispositivi di lavoro anche quando altri falliscono\nRisolve la perdita di memoria\nAggiunta opzione per disabilitare l'errore di connessione registrazione per evitare lo spam di registro quando i dispositivi non sono disponibili\nMostra i valori direttamente nella configurazione\nCollegamento TLS implementato (master)",
|
|
92
|
-
"es": "Mejor manejo de errores Modbus y tolerancia a fallas - continuar encuestando dispositivos de trabajo incluso cuando otros fallan\nFija la fuga de memoria\nOpción adicional para deshabilitar la conexión de registro de errores para evitar el spam de registro cuando los dispositivos no están disponibles\nMostrar valores directamente en la configuración\nImplemented TLS connection (master)",
|
|
93
|
-
"pl": "Ulepszona obsługa błędów i tolerancja błędów w modbusie - kontynuuj sondowanie urządzeń roboczych nawet wtedy, gdy inne zawiodą\nFixes wyciek pamięci\nDodano opcję wyłączenia logowania błędów połączenia, aby uniknąć spamu logowania, gdy urządzenia są niedostępne\nPokaż wartości bezpośrednio w konfiguracji\nWdrożone połączenie TLS (master)",
|
|
94
|
-
"uk": "Удосконалено процес обробки помилок Modbus та толерантності до несправностей - продовжуйте опитування робочих пристроїв навіть коли інші не можуть\nВиправлення витоку пам'яті\nДодана можливість відхилити помилки з'єднання, щоб уникнути спаму в журналі, коли пристрої недоступні\nПоказати значення безпосередньо в конфігурації\nРеалізовано підключення TLS (майстер)",
|
|
95
|
-
"zh-cn": "改进 Modbus 错误处理和容错度 -- -- 即使在其他故障时继续投票工作装置\n修复内存泄漏\n添加了禁用连接错误记录的选项, 以避免设备无法使用时的日志垃圾邮件\n在配置中直接显示值\n已执行 TLS 连接( 主机)"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|
|
@@ -217,7 +217,7 @@
|
|
|
217
217
|
"parity": "none",
|
|
218
218
|
"deviceId": 1,
|
|
219
219
|
"timeout": 5000,
|
|
220
|
-
"slave": 0,
|
|
220
|
+
"slave": "0",
|
|
221
221
|
"poll": 1000,
|
|
222
222
|
"recon": 60000,
|
|
223
223
|
"keepAliveInterval": 0,
|