/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
varY=globalThis,G=Y.ShadowRoot&&(Y.ShadyCSS===void0||Y.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"inDocument.prototype&&"replace"inCSSStyleSheet.prototype,nt=Symbol(),_t=newWeakMap,D=class{constructor(t,n,i){if(this._$cssResult$=!0,i!==nt)throwError("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=n}getstyleSheet(){lett=this.o,n=this.t;if(G&&t===void0){leti=n!==void0&&n.length===1;i&&(t=_t.get(n)),t===void0&&((this.o=t=newCSSStyleSheet).replaceSync(this.cssText),i&&_t.set(n,t))}returnt}toString(){returnthis.cssText}},wt=r=>newD(typeofr=="string"?r:r+"",void0,nt),y=(r,...t)=>{letn=r.length===1?r[0]:t.reduce((i,e,o)=>i+(s=>{if(s._$cssResult$===!0)returns.cssText;if(typeofs=="number")returns;throwError("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(e)+r[o+1],r[0]);returnnewD(n,r,nt)},St=(r,t)=>{if(G)r.adoptedStyleSheets=t.map(n=>ninstanceofCSSStyleSheet?n:n.styleSheet);elsefor(letnoft){leti=document.createElement("style"),e=Y.litNonce;e!==void0&&i.setAttribute("nonce",e),i.textContent=n.cssText,r.appendChild(i)}},it=G?r=>r:r=>rinstanceofCSSStyleSheet?(t=>{letn="";for(letioft.cssRules)n+=i.cssText;returnwt(n)})(r):r;var{is:Jt,defineProperty:Xt,getOwnPropertyDescriptor:Yt,getOwnPropertyNames:Gt,getOwnPropertySymbols:Qt,getPrototypeOf:te}=Object,Q=globalThis,At=Q.trustedTypes,ee=At?At.emptyScript:"",ne=Q.reactiveElementPolyfillSupport,V=(r,t)=>r,rt={toAttribute(r,t){switch(t){caseBoolean:r=r?ee:null;break;caseObject:caseArray:r=r==null?r:JSON.stringify(r)}returnr},fromAttribute(r,t){letn=r;switch(t){caseBoolean:n=r!==null;break;caseNumber:n=r===null?null:Number(r);break;caseObject:caseArray:try{n=JSON.parse(r)}catch{n=null}}returnn}},Ht=(r,t)=>!Jt(r,t),Et={attribute:!0,type:String,converter:rt,reflect:!1,useDefault:!1,hasChanged:Ht};Symbol.metadata??=Symbol("metadata"),Q.litPropertyMetadata??=newWeakMap;varw=classextendsHTMLElement{staticaddInitializer(t){this._$Ei(),(this.l??=[]).push(t)}staticgetobservedAttributes(){returnthis.finalize(),this._$Eh&&[...this._$Eh.keys()]}staticcreateProperty(t,n=Et){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(t,n),!n.noAccessor){leti=Symbol(),e=this.getPropertyDescriptor(t,i,n);e!==void0&&Xt(this.prototype,t,e)}}staticgetPropertyDescriptor(t,n,i){let{get:e,set:o}=Yt(this.prototype,t)??{get(){returnthis[n]},set(s){this[n]=s}};return{get:e,set(s){letc=e?.call(this);o?.call(this,s),this.requestUpdate(t,c,i)},configurable:!0,enumerable:!0}}staticgetPropertyOptions(t){returnthis.elementProperties.get(t)??Et}static_$Ei(){if(this.hasOwnProperty(V("elementProperties")))return;lett=te(this);t.finalize(),t.l!==void0&&(this.l=[...t.l]),this.elementProperties=newMap(t.elementProperties)}staticfinalize(){if(this.hasOwnProperty(V("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(V("properties"))){letn=this.properties,i=[...Gt(n),...Qt(n)];for(leteofi)this.createProperty(e,n[e])}lett=this[Symbol.metadata];if(t!==null){letn=litPropertyMetadata.get(t);if(n!==void0)for(let[i,e]ofn)this.elementProperties.set(i,e)}this._$Eh=newMap;for(let[n,i]ofthis.elementProperties){lete=this._$Eu(n,i);e!==void0&&this._$Eh.set(e,n)}this.elementStyles=this.finalizeStyles(this.styles)}staticfinalizeStyles(t){letn=[];if(Array.isArray(t)){leti=newSet(t.flat(1/0).reverse());for(leteofi)n.unshift(it(e))}elset!==void0&&n.push(it(t));returnn}static_$Eu(t,n){leti=n.attribute;returni===!1?void0:typeofi=="string"?i:typeoft=="string"?t.toLowerCase():void0}constructor(){super(),this._$Ep=void0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=newPromise(t=>this.enableUpdating=t),this._$AL=newMap,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=newSet).add(t),this.renderRoot!==void0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){lett=newMap,n=this.constructor.elementProperties;for(letiofn.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),deletethis[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){lett=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);returnSt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,n,i){this._$AK(t,i)}_$ET(t,n){leti=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(e!==void0&&i.reflect===!0){leto=(i.converter?.toAttribute!==void0?i.converter:rt).toAttribute(n,i.type);this._$Em=t,o==null?this.removeAttribute(e):this.setAttriLine truncated
varG=globalThis,Q=G.ShadowRoot&&(G.ShadyCSS===void0||G.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"inDocument.prototype&&"replace"inCSSStyleSheet.prototype,it=Symbol(),wt=newWeakMap,j=class{constructor(t,n,i){if(this._$cssResult$=!0,i!==it)throwError("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=n}getstyleSheet(){lett=this.o,n=this.t;if(Q&&t===void0){leti=n!==void0&&n.length===1;i&&(t=wt.get(n)),t===void0&&((this.o=t=newCSSStyleSheet).replaceSync(this.cssText),i&&wt.set(n,t))}returnt}toString(){returnthis.cssText}},At=r=>newj(typeofr=="string"?r:r+"",void0,it),y=(r,...t)=>{letn=r.length===1?r[0]:t.reduce((i,e,s)=>i+(o=>{if(o._$cssResult$===!0)returno.cssText;if(typeofo=="number")returno;throwError("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(e)+r[s+1],r[0]);returnnewj(n,r,it)},St=(r,t)=>{if(Q)r.adoptedStyleSheets=t.map(n=>ninstanceofCSSStyleSheet?n:n.styleSheet);elsefor(letnoft){leti=document.createElement("style"),e=G.litNonce;e!==void0&&i.setAttribute("nonce",e),i.textContent=n.cssText,r.appendChild(i)}},rt=Q?r=>r:r=>rinstanceofCSSStyleSheet?(t=>{letn="";for(letioft.cssRules)n+=i.cssText;returnAt(n)})(r):r;var{is:Xt,defineProperty:Yt,getOwnPropertyDescriptor:Gt,getOwnPropertyNames:Qt,getOwnPropertySymbols:te,getPrototypeOf:ee}=Object,tt=globalThis,Et=tt.trustedTypes,ne=Et?Et.emptyScript:"",ie=tt.reactiveElementPolyfillSupport,B=(r,t)=>r,st={toAttribute(r,t){switch(t){caseBoolean:r=r?ne:null;break;caseObject:caseArray:r=r==null?r:JSON.stringify(r)}returnr},fromAttribute(r,t){letn=r;switch(t){caseBoolean:n=r!==null;break;caseNumber:n=r===null?null:Number(r);break;caseObject:caseArray:try{n=JSON.parse(r)}catch{n=null}}returnn}},kt=(r,t)=>!Xt(r,t),Ht={attribute:!0,type:String,converter:st,reflect:!1,useDefault:!1,hasChanged:kt};Symbol.metadata??=Symbol("metadata"),tt.litPropertyMetadata??=newWeakMap;varw=classextendsHTMLElement{staticaddInitializer(t){this._$Ei(),(this.l??=[]).push(t)}staticgetobservedAttributes(){returnthis.finalize(),this._$Eh&&[...this._$Eh.keys()]}staticcreateProperty(t,n=Ht){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(t,n),!n.noAccessor){leti=Symbol(),e=this.getPropertyDescriptor(t,i,n);e!==void0&&Yt(this.prototype,t,e)}}staticgetPropertyDescriptor(t,n,i){let{get:e,set:s}=Gt(this.prototype,t)??{get(){returnthis[n]},set(o){this[n]=o}};return{get:e,set(o){letc=e?.call(this);s?.call(this,o),this.requestUpdate(t,c,i)},configurable:!0,enumerable:!0}}staticgetPropertyOptions(t){returnthis.elementProperties.get(t)??Ht}static_$Ei(){if(this.hasOwnProperty(B("elementProperties")))return;lett=ee(this);t.finalize(),t.l!==void0&&(this.l=[...t.l]),this.elementProperties=newMap(t.elementProperties)}staticfinalize(){if(this.hasOwnProperty(B("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(B("properties"))){letn=this.properties,i=[...Qt(n),...te(n)];for(leteofi)this.createProperty(e,n[e])}lett=this[Symbol.metadata];if(t!==null){letn=litPropertyMetadata.get(t);if(n!==void0)for(let[i,e]ofn)this.elementProperties.set(i,e)}this._$Eh=newMap;for(let[n,i]ofthis.elementProperties){lete=this._$Eu(n,i);e!==void0&&this._$Eh.set(e,n)}this.elementStyles=this.finalizeStyles(this.styles)}staticfinalizeStyles(t){letn=[];if(Array.isArray(t)){leti=newSet(t.flat(1/0).reverse());for(leteofi)n.unshift(rt(e))}elset!==void0&&n.push(rt(t));returnn}static_$Eu(t,n){leti=n.attribute;returni===!1?void0:typeofi=="string"?i:typeoft=="string"?t.toLowerCase():void0}constructor(){super(),this._$Ep=void0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=newPromise(t=>this.enableUpdating=t),this._$AL=newMap,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=newSet).add(t),this.renderRoot!==void0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){lett=newMap,n=this.constructor.elementProperties;for(letiofn.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),deletethis[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){lett=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);returnSt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,n,i){this._$AK(t,i)}_$ET(t,n){leti=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(e!==void0&&i.reflect===!0){lets=(i.converter?.toAttribute!==void0?i.converter:st).toAttribute(n,i.type);this._$Em=t,s==null?this.removeAttribute(e):this.setALine truncated
${this.item.type!=="heating_manifold"&&this.item.type!=="freshwater_station"&&!n.length&&!f(t.status)?d`<p class="empty">Noch keine Fühler verknüpft</p>`:a}
</div>`}staticstyles=[gt,Jt,y`.cascade-count{color:var(--nf-muted)}.station-summary{display:grid;grid-template-columns:minmax(0,1fr) auto 18px;align-items:center;gap:6px;width:100%;padding:5px 0;font-size:11px}.station-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0;background:none;border:0;text-align:left}.station-summary>.status-reading{grid-column:1/-1}.station-summary b{white-space:nowrap;font-variant-numeric:tabular-nums}`]},_t=classextendsv{staticproperties={hass:{attribute:!1},item:{attribute:!1},readOnly:{type:Boolean},focusStation:{attribute:!1},pending:{state:!0},error:{state:!0}};constructor(){super(),this.pending=newSet,this.error="",this.readOnly=!1}asyncshow(){awaitthis.updateComplete,this.shadowRoot.querySelector("dialog").showModal(),this.focusStation&&this.shadowRoot.querySelector(`[data-station="${CSS.escape(this.focusStation)}"]`)?.scrollIntoView({block:"start"})}asyncsend(t,n){leti=this.hass.states[t];if(!(this.readOnly||!i?.attributes.symcon_has_action||b(i)===null||this.pending.has(t))){this.pending=newSet([...this.pending,t]),this.error="";try{awaitthis.hass.callService("symcon","set_value",{entity_id:t,value:n})}catch(e){this.error=einstanceofError?e.message:String(e)}finally{this.pending=newSet([...this.pending].filter(e=>e!==t))}}}control(t,n){if(!f(n?.command)&&!f(n?.feedback))returna;leti=f(n?.command)?n.command:null,e=i?this.hass.states[i]:void0,s=e?.attributes,o=b(e),c=!!i&&!!s?.symcon_has_action&&o!==null&&!this.readOnly&&!this.pending.has(i),l=Number(s?.symcon_min??0),h=Number(s?.symcon_max??100),p=Number(s?.symcon_step||(s?.symcon_variable_type===1?1:.1)),u=U(e),g=$=>{let_=$.target;i&&_.value.trim()&&_.checkValidity()&&Number.isFinite(_.valueAsNumber)&&this.send(i,_.valueAsNumber)};returnd`<fieldset data-control=${t}><legend>${t}</legend>${V(this.hass,t,n)}
${!n.length&&this.item.type!=="heating_manifold"&&this.item.type!=="freshwater_station"?d`<p class="empty">Die Fühler lassen sich im Editor über den Objektbaum zuweisen.</p>`:a}
${!n.length&&!f(t.status)&&this.item.type!=="heating_manifold"&&this.item.type!=="freshwater_station"?d`<p class="empty">Die Fühler lassen sich im Editor über den Objektbaum zuweisen.</p>`:a}
foreach($valuesas$v)if(!in_array($v['target'],array_column($options,'value'),true))$options[]=['caption'=>'(Nicht mehr im Plan) '.$v['target'],'value'=>$v['target']];
['type'=>'Button','name'=>'AccountDelete','caption'=>'Benutzer löschen','enabled'=>$id!=='','confirm'=>'Diesen NextFloor-Benutzer einschließlich seiner Zugänge löschen?','onClick'=>'echo NFSC_DeleteAccessUser($id, $AccountSelect);'],
['type'=>'PopupButton','caption'=>'ⓘ Rechte und Passwörter','popup'=>['caption'=>'Zugriffsrechte','items'=>[
['type'=>'Label','caption'=>'Die Auswahl eines Benutzers lädt dessen Einstellungen und alle drei Freigabetabellen. Änderungen werden erst durch Benutzer speichern übernommen; beim Wechsel werden nicht gespeicherte Eingaben verworfen. Das Passwortfeld wird bei jedem Wechsel geleert.'],
['type'=>'Label','caption'=>'Admins dürfen den Editor und alle Geräte verwenden. Die Benutzerverwaltung bleibt ausschließlich in der Symcon-Konfiguration.'],
['type'=>'Label','caption'=>'Alle Zustände ansehen ohne weitere Bedienfreigabe ist ein Zugang nur zum Lesen. Einzelne Raum- und Gerätefreigaben ergänzen diese Grundrechte. Ohne Freigabe bleibt das Gebäude sichtbar, seine Zustände werden nicht übertragen.'],
['type'=>'Label','caption'=>'Eine Raumfreigabe umfasst seine verknüpften Werte, Geräte im Raum und die zugeordneten Bereichskategorien. Gerätefreigaben gelten für deren verknüpfte Datenpunkte. Bei automatischen Gerätezuordnungen die benötigten Symcon-Objekte zusätzlich auswählen oder feste Verknüpfungen im Editor setzen.'],
foreach($valuesas$v)if(!in_array($v['target'],array_column($options,'value'),true))$options[]=['caption'=>'(Nicht mehr im Plan) '.$v['target'],'value'=>$v['target']];
['name'=>'access','caption'=>'Recht','width'=>'190px','add'=>'view','edit'=>['type'=>'Select','options'=>[['caption'=>'Nur ansehen','value'=>'view'],['caption'=>'Ansehen und bedienen','value'=>'control']]]]];
check($ids===[101,102,103,104,105],'Existing room rights keep their stable key and do not grant outdoor/other-location values');
$visible=$method('visibleBuilding');
check($visible['topology']===$b['topology'],'Users retain the complete logical topology, like the building geometry');
check($visible['floors'][1]['furniture'][0]['entity']==='none','Unapproved outdoor status is still filtered server-side');
$as('empty');
check($method('visibleTree',$method('objectTree'))['variables']===[],'Adding topology cannot grant access to an empty account');
echo"OK: persisted five-level topology with location/branch/building outdoors; complete grant choice paths; unchanged room keys; scoped state and native permissions\n";
check(str_starts_with(clickSave($script,$fields),'Benutzer gespeichert.'),'The actual save button serializes every row, including rows that are not selected');
foreach(['AccountRooms','AccountDevices','AccountObjects']as$name)check(json_decode($module->fields[$name]['values'],true)===[],'Switching to an unrestricted reader clears the previous grants');
check($module->fields['AccountName']['value']==='form-empty'&&$module->fields['AccountPassword']['value']==='','User changes load the right name and clear the password field');
check(!in_array('room:old:removed',array_column(json_decode($module->fields['AccountRooms']['columns'],true)[0]['edit']['options'],'value'),true),'Stale target choices do not leak into another user');
$select($scopedID);
foreach(['AccountRooms'=>$rooms,'AccountDevices'=>$devices,'AccountObjects'=>$objects]as$name=>$expected)check(json_decode($module->fields[$name]['values'],true)===$expected,'Each table restores the selected user');
check(in_array('room:old:removed',array_column(json_decode($module->fields['AccountRooms']['columns'],true)[0]['edit']['options'],'value'),true),'Previously linked missing plan targets remain visible when switching users');
check(str_starts_with(clickSave($script,$fields),'Benutzer gespeichert.'),'Saving an existing user permits an empty password');
check(password_verify('form-test-password',$method('accounts')[$scopedID]['password']),'Empty password preserves the previous hash');
check(str_starts_with(clickSave($script,[...$fields,'AccountSelect'=>'','AccountName'=>'no-password']),'Für neue Benutzer'),'New accounts still require a password');
$select('');
foreach(['AccountRooms','AccountDevices','AccountObjects']as$name)check(json_decode($module->fields[$name]['values'],true)===[],'New user selection resets every grant table');
check(!$module->fields['AccountReset']['enabled']&&!$module->fields['AccountDelete']['enabled'],'New user selection disables existing-account operations');
check($module->SaveAccessUser($emptyID,'form-empty','user',true,true,false,'{"target":"room:eg:office2","access":"control"}','[]','[]','')==='Ungültige Freigabeliste.','A selected row cannot be mistaken for the complete grants list');
check($form['actions'][1]['caption']==='Designer im Browser öffnen'&&$form['actions'][1]['link']===true,'The browser link does not promise a native Pro Console tab');
echo"OK: real form save with opaque iterable Lists; empty/multiple grants; user-switch reload/reset and missing-target choices; password position and preservation; honest browser action\n";
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.