iobroker.hmip
Version:
ioBroker Adapter to use the Homematic Cloud IP AccessPoint via Hommeatic Cloud Rest API
30 lines (29 loc) • 12.2 kB
JavaScript
import{C as l}from"./ConfigCustomHmipSet__loadShare__react__loadShare__-C2rb-Q_t.js";import{U as Ae,V as De,W as Ve,X as Ke,T as V,i as Oe,Q as Re,s as Ne}from"./createTheme-DeCINnsN.js";import{j as p}from"./jsx-runtime-DG8Pl9r2.js";import{R as Ge,a as He,G as qe}from"./index-i2uYzTGq.js";import{u as Ue}from"./useThemeWithoutDefault-DJ9aUkXM.js";import{D as Fe}from"./DefaultPropsProvider-CM5_Gedy.js";const Ye=(e,t)=>{const o=De(e);return o.sheet=new t({key:o.key,nonce:o.sheet.nonce,container:o.sheet.container,speedy:o.sheet.isSpeedy,prepend:o.sheet.prepend,insertionPoint:o.sheet.insertionPoint}),o};let _;if(typeof document=="object"&&(_=document.querySelector('[name="emotion-insertion-point"]'),!_)){_=document.createElement("meta"),_.setAttribute("name","emotion-insertion-point"),_.setAttribute("content","");const e=document.querySelector("head");e&&e.prepend(_)}function Be(e,t){if(e||t){class o extends Ve{insert(d,r){return this.key&&this.key.endsWith("global")&&(this.before=_),super.insert(d,r)}}const n=Ye({key:"css",insertionPoint:e?_:void 0},o);if(t){const a=n.insert;n.insert=(...d)=>(d[1].styles.startsWith("@layer")||(d[1].styles=`@layer mui {${d[1].styles}}`),a(...d))}return n}}function ft(e){const{injectFirst:t,enableCssLayer:o,children:n}=e,a=l.useMemo(()=>Be(t,o),[t,o]);return a?p.jsx(Ae,{value:a,children:n}):n}const Ee=l.createContext(null);function ee(){return l.useContext(Ee)}const Qe=typeof Symbol=="function"&&Symbol.for,ze=Qe?Symbol.for("mui.nested"):"__THEME_NESTED__";function We(e,t){return typeof t=="function"?t(e):{...e,...t}}function Xe(e){const{children:t,theme:o}=e,n=ee(),a=l.useMemo(()=>{const d=n===null?{...o}:We(n,o);return d!=null&&(d[ze]=n!==null),d},[o,n]);return p.jsx(Ee.Provider,{value:a,children:t})}const be={};function Me(e,t,o,n=!1){return l.useMemo(()=>{const a=e&&t[e]||t;if(typeof o=="function"){const d=o(a),r=e?{...t,[e]:d}:d;return n?()=>r:r}return e?{...t,[e]:o}:{...t,...o}},[e,t,o,n])}function Te(e){const{children:t,theme:o,themeId:n}=e,a=Ue(be),d=ee()||be,r=Me(n,a,o),f=Me(n,d,o,!0),C=(n?r[n]:r).direction==="rtl";return p.jsx(Xe,{theme:f,children:p.jsx(Ke.Provider,{value:r,children:p.jsx(Ge,{value:C,children:p.jsx(Fe,{value:n?r[n].components:r.components,children:t})})})})}const te="mode",oe="color-scheme",Je="data-color-scheme";function Ze(e){const{defaultMode:t="system",defaultLightColorScheme:o="light",defaultDarkColorScheme:n="dark",modeStorageKey:a=te,colorSchemeStorageKey:d=oe,attribute:r=Je,colorSchemeNode:f="document.documentElement",nonce:C}=e||{};let E="",y=r;if(r==="class"&&(y=".%s"),r==="data"&&(y="[data-%s]"),y.startsWith(".")){const h=y.substring(1);E+=`${f}.classList.remove('${h}'.replace('%s', light), '${h}'.replace('%s', dark));
${f}.classList.add('${h}'.replace('%s', colorScheme));`}const w=y.match(/\[([^\]]+)\]/);if(w){const[h,m]=w[1].split("=");m||(E+=`${f}.removeAttribute('${h}'.replace('%s', light));
${f}.removeAttribute('${h}'.replace('%s', dark));`),E+=`
${f}.setAttribute('${h}'.replace('%s', colorScheme), ${m?`${m}.replace('%s', colorScheme)`:'""'});`}else E+=`${f}.setAttribute('${y}', colorScheme);`;return p.jsx("script",{suppressHydrationWarning:!0,nonce:typeof window>"u"?C:"",dangerouslySetInnerHTML:{__html:`(function() {
try {
let colorScheme = '';
const mode = localStorage.getItem('${a}') || '${t}';
const dark = localStorage.getItem('${d}-dark') || '${n}';
const light = localStorage.getItem('${d}-light') || '${o}';
if (mode === 'system') {
// handle system mode
const mql = window.matchMedia('(prefers-color-scheme: dark)');
if (mql.matches) {
colorScheme = dark
} else {
colorScheme = light
}
}
if (mode === 'light') {
colorScheme = light;
}
if (mode === 'dark') {
colorScheme = dark;
}
if (colorScheme) {
${E}
}
} catch(e){}})();`}},"mui-color-scheme-init")}function et(){}const tt=({key:e,storageWindow:t})=>(!t&&typeof window<"u"&&(t=window),{get(o){if(typeof window>"u")return;if(!t)return o;let n;try{n=t.localStorage.getItem(e)}catch{}return n||o},set:o=>{if(t)try{t.localStorage.setItem(e,o)}catch{}},subscribe:o=>{if(!t)return et;const n=a=>{const d=a.newValue;a.key===e&&o(d)};return t.addEventListener("storage",n),()=>{t.removeEventListener("storage",n)}}});function J(){}function ke(e){if(typeof window<"u"&&typeof window.matchMedia=="function"&&e==="system")return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function we(e,t){if(e.mode==="light"||e.mode==="system"&&e.systemMode==="light")return t("light");if(e.mode==="dark"||e.mode==="system"&&e.systemMode==="dark")return t("dark")}function ot(e){return we(e,t=>{if(t==="light")return e.lightColorScheme;if(t==="dark")return e.darkColorScheme})}function nt(e){const{defaultMode:t="light",defaultLightColorScheme:o,defaultDarkColorScheme:n,supportedColorSchemes:a=[],modeStorageKey:d=te,colorSchemeStorageKey:r=oe,storageWindow:f=typeof window>"u"?void 0:window,storageManager:C=tt,noSsr:E=!1}=e,y=a.join(","),w=a.length>1,h=l.useMemo(()=>C==null?void 0:C({key:d,storageWindow:f}),[C,d,f]),m=l.useMemo(()=>C==null?void 0:C({key:`${r}-light`,storageWindow:f}),[C,r,f]),S=l.useMemo(()=>C==null?void 0:C({key:`${r}-dark`,storageWindow:f}),[C,r,f]),[$,I]=l.useState(()=>{const s=(h==null?void 0:h.get(t))||t,c=(m==null?void 0:m.get(o))||o,i=(S==null?void 0:S.get(n))||n;return{mode:s,systemMode:ke(s),lightColorScheme:c,darkColorScheme:i}}),[L,F]=l.useState(E||!w);l.useEffect(()=>{F(!0)},[]);const K=ot($),O=l.useCallback(s=>{I(c=>{if(s===c.mode)return c;const i=s??t;return h==null||h.set(i),{...c,mode:i,systemMode:ke(i)}})},[h,t]),A=l.useCallback(s=>{s?typeof s=="string"?s&&!y.includes(s)?console.error(`\`${s}\` does not exist in \`theme.colorSchemes\`.`):I(c=>{const i={...c};return we(c,u=>{u==="light"&&(m==null||m.set(s),i.lightColorScheme=s),u==="dark"&&(S==null||S.set(s),i.darkColorScheme=s)}),i}):I(c=>{const i={...c},u=s.light===null?o:s.light,P=s.dark===null?n:s.dark;return u&&(y.includes(u)?(i.lightColorScheme=u,m==null||m.set(u)):console.error(`\`${u}\` does not exist in \`theme.colorSchemes\`.`)),P&&(y.includes(P)?(i.darkColorScheme=P,S==null||S.set(P)):console.error(`\`${P}\` does not exist in \`theme.colorSchemes\`.`)),i}):I(c=>(m==null||m.set(o),S==null||S.set(n),{...c,lightColorScheme:o,darkColorScheme:n}))},[y,m,S,o,n]),R=l.useCallback(s=>{$.mode==="system"&&I(c=>{const i=s!=null&&s.matches?"dark":"light";return c.systemMode===i?c:{...c,systemMode:i}})},[$.mode]),q=l.useRef(R);return q.current=R,l.useEffect(()=>{if(typeof window.matchMedia!="function"||!w)return;const s=(...i)=>q.current(...i),c=window.matchMedia("(prefers-color-scheme: dark)");return c.addListener(s),s(c),()=>{c.removeListener(s)}},[w]),l.useEffect(()=>{if(w){const s=(h==null?void 0:h.subscribe(u=>{(!u||["light","dark","system"].includes(u))&&O(u||t)}))||J,c=(m==null?void 0:m.subscribe(u=>{(!u||y.match(u))&&A({light:u})}))||J,i=(S==null?void 0:S.subscribe(u=>{(!u||y.match(u))&&A({dark:u})}))||J;return()=>{s(),c(),i()}}},[A,O,y,t,f,w,h,m,S]),{...$,mode:L?$.mode:void 0,systemMode:L?$.systemMode:void 0,colorScheme:L?K:void 0,setMode:O,setColorScheme:A}}const rt="*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}";function st(e){const{themeId:t,theme:o={},modeStorageKey:n=te,colorSchemeStorageKey:a=oe,disableTransitionOnChange:d=!1,defaultColorScheme:r,resolveTheme:f}=e,C={allColorSchemes:[],colorScheme:void 0,darkColorScheme:void 0,lightColorScheme:void 0,mode:void 0,setColorScheme:()=>{},setMode:()=>{},systemMode:void 0},E=l.createContext(void 0),y=()=>l.useContext(E)||C,w={},h={};function m(L){var Ce,pe,ye,ge;const{children:F,theme:K,modeStorageKey:O=n,colorSchemeStorageKey:A=a,disableTransitionOnChange:R=d,storageManager:q,storageWindow:s=typeof window>"u"?void 0:window,documentNode:c=typeof document>"u"?void 0:document,colorSchemeNode:i=typeof document>"u"?void 0:document.documentElement,disableNestedContext:u=!1,disableStyleSheetGeneration:P=!1,defaultMode:$e="system",noSsr:je}=L,Y=l.useRef(!1),B=ee(),Q=l.useContext(E),z=!!Q&&!u,ne=l.useMemo(()=>K||(typeof o=="function"?o():o),[K]),re=ne[t],k=re||ne,{colorSchemes:j=w,components:se=h,cssVarPrefix:W}=k,ce=Object.keys(j).filter(g=>!!j[g]).join(","),D=l.useMemo(()=>ce.split(","),[ce]),ie=typeof r=="string"?r:r.light,le=typeof r=="string"?r:r.dark,_e=j[ie]&&j[le]?$e:((pe=(Ce=j[k.defaultColorScheme])==null?void 0:Ce.palette)==null?void 0:pe.mode)||((ye=k.palette)==null?void 0:ye.mode),{mode:Le,setMode:de,systemMode:me,lightColorScheme:ae,darkColorScheme:ue,colorScheme:Pe,setColorScheme:he}=nt({supportedColorSchemes:D,defaultLightColorScheme:ie,defaultDarkColorScheme:le,modeStorageKey:O,colorSchemeStorageKey:A,defaultMode:_e,storageManager:q,storageWindow:s,noSsr:je});let X=Le,x=Pe;z&&(X=Q.mode,x=Q.colorScheme);const N=l.useMemo(()=>{var H;const g=x||k.defaultColorScheme,b=((H=k.generateThemeVars)==null?void 0:H.call(k))||k.vars,M={...k,components:se,colorSchemes:j,cssVarPrefix:W,vars:b};if(typeof M.generateSpacing=="function"&&(M.spacing=M.generateSpacing()),g){const T=j[g];T&&typeof T=="object"&&Object.keys(T).forEach(v=>{T[v]&&typeof T[v]=="object"?M[v]={...M[v],...T[v]}:M[v]=T[v]})}return f?f(M):M},[k,x,se,j,W]),G=k.colorSchemeSelector;He(()=>{if(x&&i&&G&&G!=="media"){const g=G;let b=G;if(g==="class"&&(b=".%s"),g==="data"&&(b="[data-%s]"),g!=null&&g.startsWith("data-")&&!g.includes("%s")&&(b=`[${g}="%s"]`),b.startsWith("."))i.classList.remove(...D.map(M=>b.substring(1).replace("%s",M))),i.classList.add(b.substring(1).replace("%s",x));else{const M=b.replace("%s",x).match(/\[([^\]]+)\]/);if(M){const[H,T]=M[1].split("=");T||D.forEach(v=>{i.removeAttribute(H.replace(x,v))}),i.setAttribute(H,T?T.replace(/"|'/g,""):"")}else i.setAttribute(b,x)}}},[x,G,i,D]),l.useEffect(()=>{let g;if(R&&Y.current&&c){const b=c.createElement("style");b.appendChild(c.createTextNode(rt)),c.head.appendChild(b),window.getComputedStyle(c.body),g=setTimeout(()=>{c.head.removeChild(b)},1)}return()=>{clearTimeout(g)}},[x,R,c]),l.useEffect(()=>(Y.current=!0,()=>{Y.current=!1}),[]);const Ie=l.useMemo(()=>({allColorSchemes:D,colorScheme:x,darkColorScheme:ue,lightColorScheme:ae,mode:X,setColorScheme:he,setMode:de,systemMode:me}),[D,x,ue,ae,X,he,de,me,N.colorSchemeSelector]);let fe=!0;(P||k.cssVariables===!1||z&&(B==null?void 0:B.cssVarPrefix)===W)&&(fe=!1);const Se=p.jsxs(l.Fragment,{children:[p.jsx(Te,{themeId:re?t:void 0,theme:N,children:F}),fe&&p.jsx(qe,{styles:((ge=N.generateStyleSheets)==null?void 0:ge.call(N))||[]})]});return z?Se:p.jsx(E.Provider,{value:Ie,children:Se})}const S=typeof r=="string"?r:r.light,$=typeof r=="string"?r:r.dark;return{CssVarsProvider:m,useColorScheme:y,getInitColorSchemeScript:L=>Ze({colorSchemeStorageKey:a,defaultLightColorScheme:S,defaultDarkColorScheme:$,modeStorageKey:n,...L})}}function Z({theme:e,...t}){const o=V in e?e[V]:void 0;return p.jsx(Te,{...t,themeId:o?V:void 0,theme:o||e})}const U={colorSchemeStorageKey:"mui-color-scheme",defaultLightColorScheme:"light",defaultDarkColorScheme:"dark",modeStorageKey:"mui-mode"},{CssVarsProvider:ve,useColorScheme:St,getInitColorSchemeScript:ct}=st({themeId:V,theme:()=>Oe({cssVariables:!0}),colorSchemeStorageKey:U.colorSchemeStorageKey,modeStorageKey:U.modeStorageKey,defaultColorScheme:{light:U.defaultLightColorScheme,dark:U.defaultDarkColorScheme},resolveTheme:e=>{const t={...e,typography:Re(e.palette,e.typography)};return t.unstable_sx=function(n){return Ne({sx:n,theme:this})},t}});function Ct(e){return p.jsx(ve,{...e})}let xe=!1;const pt=e=>(xe||(console.warn(["MUI: The getInitColorSchemeScript function has been deprecated.","","You should use `import InitColorSchemeScript from '@mui/material/InitColorSchemeScript'`","and replace the function call with `<InitColorSchemeScript />` instead."].join(`
`)),xe=!0),ct(e)),it=ve;function yt({theme:e,...t}){if(typeof e=="function")return p.jsx(Z,{theme:e,...t});const o=V in e?e[V]:e;return"colorSchemes"in o?p.jsx(it,{theme:e,...t}):"vars"in o?p.jsx(Z,{theme:e,...t}):p.jsx(Z,{theme:{...e,vars:null},...t})}export{it as C,Ct as E,ft as S,yt as T,pt as g,St as u};