Files
dawnline/package/luci-app-dawnline/htdocs/luci-static/resources/dawnline/app.js
T
Aemeath 7a6370aa9e
Build packages / CI (push) Blocked by required conditions
Build packages / Version (push) Waiting to run
CI / Web (format, types, tests, bundles) (push) Blocked by required conditions
CI / ShellCheck (push) Blocked by required conditions
CI / ucode static checks (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 24.10) (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 25.12) (push) Blocked by required conditions
Dawnline 0.8.1
- Fixed: the Overview's map stayed empty after leaving the page and coming
  back (the map freed on leaving was never made again); a map still loading
  when freed no longer draws into a dropped element
- A new connection's city shows within seconds: the agent looks its address
  up the moment the device connects or roams, in a child process so the
  watcher never waits, and open pages refresh once the place is known; the
  connection's entry in the activity log gets its place too. Since 0.7.0 the
  lookup waited for the minute tick and the pages for their 30-second poll
- Device window: each place has a strip of when the device was there (from
  the log's connections) and its share of the time; ▶ replays the period on
  the map: the place it leaves goes gray, a blue shimmer runs along a dotted
  arc to the next one, which lights up. A click or a drag on a strip goes to
  that moment; short visits are folded only past 24 moves. The fixed trail
  line is gone, and place names are no longer cut off at the map's edges
- Overview: the disguise tile's icon is gray when the disguise is Off
- People: "Add device" is a dashed chip with its label; "Send invite" is gone
  from the card (the invite card stays in its ⋯ menu)
2026-10-19 00:48:09 +03:00

30 lines
389 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Generated from dawnline/web — do not edit by hand.
'use strict';
'require baseclass';
'require dom';
'require poll';
'require rpc';
'require ui';
var bi=Object.create;var Po=Object.defineProperty;var xi=Object.getOwnPropertyDescriptor;var wi=Object.getOwnPropertyNames;var yi=Object.getPrototypeOf,ki=Object.prototype.hasOwnProperty;var $i=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var Ci=(n,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of wi(e))!ki.call(n,a)&&a!==r&&Po(n,a,{get:()=>e[a],enumerable:!(o=xi(e,a))||o.enumerable});return n};var Ei=(n,e,r)=>(r=n!=null?bi(yi(n)):{},Ci(e||!n||!n.__esModule?Po(r,"default",{value:n,enumerable:!0}):r,n));var rr=$i((nr,or)=>{"use strict";var tr=(function(){var n=function(w,v){var y=236,E=17,k=w,z=r[v],f=null,g=0,S=null,T=[],N={},W=function(P,D){g=k*4+17,f=(function(_){for(var I=new Array(_),M=0;M<_;M+=1){I[M]=new Array(_);for(var j=0;j<_;j+=1)I[M][j]=null}return I})(g),q(0,0),q(g-7,0),q(0,g-7),K(),R(),de(P,D),k>=7&&Z(P),S==null&&(S=ge(k,z,T)),Q(S,D)},q=function(P,D){for(var _=-1;_<=7;_+=1)if(!(P+_<=-1||g<=P+_))for(var I=-1;I<=7;I+=1)D+I<=-1||g<=D+I||(0<=_&&_<=6&&(I==0||I==6)||0<=I&&I<=6&&(_==0||_==6)||2<=_&&_<=4&&2<=I&&I<=4?f[P+_][D+I]=!0:f[P+_][D+I]=!1)},Y=function(){for(var P=0,D=0,_=0;_<8;_+=1){W(!0,_);var I=a.getLostPoint(N);(_==0||P>I)&&(P=I,D=_)}return D},R=function(){for(var P=8;P<g-8;P+=1)f[P][6]==null&&(f[P][6]=P%2==0);for(var D=8;D<g-8;D+=1)f[6][D]==null&&(f[6][D]=D%2==0)},K=function(){for(var P=a.getPatternPosition(k),D=0;D<P.length;D+=1)for(var _=0;_<P.length;_+=1){var I=P[D],M=P[_];if(f[I][M]==null)for(var j=-2;j<=2;j+=1)for(var J=-2;J<=2;J+=1)j==-2||j==2||J==-2||J==2||j==0&&J==0?f[I+j][M+J]=!0:f[I+j][M+J]=!1}},Z=function(P){for(var D=a.getBCHTypeNumber(k),_=0;_<18;_+=1){var I=!P&&(D>>_&1)==1;f[Math.floor(_/3)][_%3+g-8-3]=I}for(var _=0;_<18;_+=1){var I=!P&&(D>>_&1)==1;f[_%3+g-8-3][Math.floor(_/3)]=I}},de=function(P,D){for(var _=z<<3|D,I=a.getBCHTypeInfo(_),M=0;M<15;M+=1){var j=!P&&(I>>M&1)==1;M<6?f[M][8]=j:M<8?f[M+1][8]=j:f[g-15+M][8]=j}for(var M=0;M<15;M+=1){var j=!P&&(I>>M&1)==1;M<8?f[8][g-M-1]=j:M<9?f[8][15-M-1+1]=j:f[8][15-M-1]=j}f[g-8][8]=!P},Q=function(P,D){for(var _=-1,I=g-1,M=7,j=0,J=a.getMaskFunction(D),V=g-1;V>0;V-=2)for(V==6&&(V-=1);;){for(var pe=0;pe<2;pe+=1)if(f[I][V-pe]==null){var xe=!1;j<P.length&&(xe=(P[j]>>>M&1)==1);var ne=J(I,V-pe);ne&&(xe=!xe),f[I][V-pe]=xe,M-=1,M==-1&&(j+=1,M=7)}if(I+=_,I<0||g<=I){I-=_,_=-_;break}}},te=function(P,D){for(var _=0,I=0,M=0,j=new Array(D.length),J=new Array(D.length),V=0;V<D.length;V+=1){var pe=D[V].dataCount,xe=D[V].totalCount-pe;I=Math.max(I,pe),M=Math.max(M,xe),j[V]=new Array(pe);for(var ne=0;ne<j[V].length;ne+=1)j[V][ne]=255&P.getBuffer()[ne+_];_+=pe;var De=a.getErrorCorrectPolynomial(xe),Ae=s(j[V],De.getLength()-1),So=Ae.mod(De);J[V]=new Array(De.getLength()-1);for(var ne=0;ne<J[V].length;ne+=1){var To=ne+So.getLength()-J[V].length;J[V][ne]=To>=0?So.getAt(To):0}}for(var _o=0,ne=0;ne<D.length;ne+=1)_o+=D[ne].totalCount;for(var Un=new Array(_o),Xt=0,ne=0;ne<I;ne+=1)for(var V=0;V<D.length;V+=1)ne<j[V].length&&(Un[Xt]=j[V][ne],Xt+=1);for(var ne=0;ne<M;ne+=1)for(var V=0;V<D.length;V+=1)ne<J[V].length&&(Un[Xt]=J[V][ne],Xt+=1);return Un},ge=function(P,D,_){for(var I=l.getRSBlocks(P,D),M=d(),j=0;j<_.length;j+=1){var J=_[j];M.put(J.getMode(),4),M.put(J.getLength(),a.getLengthInBits(J.getMode(),P)),J.write(M)}for(var V=0,j=0;j<I.length;j+=1)V+=I[j].dataCount;if(M.getLengthInBits()>V*8)throw"code length overflow. ("+M.getLengthInBits()+">"+V*8+")";for(M.getLengthInBits()+4<=V*8&&M.put(0,4);M.getLengthInBits()%8!=0;)M.putBit(!1);for(;!(M.getLengthInBits()>=V*8||(M.put(y,8),M.getLengthInBits()>=V*8));)M.put(E,8);return te(M,I)};N.addData=function(P,D){D=D||"Byte";var _=null;switch(D){case"Numeric":_=c(P);break;case"Alphanumeric":_=p(P);break;case"Byte":_=u(P);break;case"Kanji":_=x(P);break;default:throw"mode:"+D}T.push(_),S=null},N.isDark=function(P,D){if(P<0||g<=P||D<0||g<=D)throw P+","+D;return f[P][D]},N.getModuleCount=function(){return g},N.make=function(){if(k<1){for(var P=1;P<40;P++){for(var D=l.getRSBlocks(P,z),_=d(),I=0;I<T.length;I++){var M=T[I];_.put(M.getMode(),4),_.put(M.getLength(),a.getLengthInBits(M.getMode(),P)),M.write(_)}for(var j=0,I=0;I<D.length;I++)j+=D[I].dataCount;if(_.getLengthInBits()<=j*8)break}k=P}W(!1,Y())},N.createTableTag=function(P,D){P=P||2,D=typeof D>"u"?P*4:D;var _="";_+='<table style="',_+=" border-width: 0px; border-style: none;",_+=" border-collapse: collapse;",_+=" padding: 0px; margin: "+D+"px;",_+='">',_+="<tbody>";for(var I=0;I<N.getModuleCount();I+=1){_+="<tr>";for(var M=0;M<N.getModuleCount();M+=1)_+='<td style="',_+=" border-width: 0px; border-style: none;",_+=" border-collapse: collapse;",_+=" padding: 0px; margin: 0px;",_+=" width: "+P+"px;",_+=" height: "+P+"px;",_+=" background-color: ",_+=N.isDark(I,M)?"#000000":"#ffffff",_+=";",_+='"/>';_+="</tr>"}return _+="</tbody>",_+="</table>",_},N.createSvgTag=function(P,D,_,I){var M={};typeof arguments[0]=="object"&&(M=arguments[0],P=M.cellSize,D=M.margin,_=M.alt,I=M.title),P=P||2,D=typeof D>"u"?P*4:D,_=typeof _=="string"?{text:_}:_||{},_.text=_.text||null,_.id=_.text?_.id||"qrcode-description":null,I=typeof I=="string"?{text:I}:I||{},I.text=I.text||null,I.id=I.text?I.id||"qrcode-title":null;var j=N.getModuleCount()*P+D*2,J,V,pe,xe,ne="",De;for(De="l"+P+",0 0,"+P+" -"+P+",0 0,-"+P+"z ",ne+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',ne+=M.scalable?"":' width="'+j+'px" height="'+j+'px"',ne+=' viewBox="0 0 '+j+" "+j+'" ',ne+=' preserveAspectRatio="xMinYMin meet"',ne+=I.text||_.text?' role="img" aria-labelledby="'+O([I.id,_.id].join(" ").trim())+'"':"",ne+=">",ne+=I.text?'<title id="'+O(I.id)+'">'+O(I.text)+"</title>":"",ne+=_.text?'<description id="'+O(_.id)+'">'+O(_.text)+"</description>":"",ne+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',ne+='<path d="',pe=0;pe<N.getModuleCount();pe+=1)for(xe=pe*P+D,J=0;J<N.getModuleCount();J+=1)N.isDark(pe,J)&&(V=J*P+D,ne+="M"+V+","+xe+De);return ne+='" stroke="transparent" fill="black"/>',ne+="</svg>",ne},N.createDataURL=function(P,D){P=P||2,D=typeof D>"u"?P*4:D;var _=N.getModuleCount()*P+D*2,I=D,M=_-D;return B(_,_,function(j,J){if(I<=j&&j<M&&I<=J&&J<M){var V=Math.floor((j-I)/P),pe=Math.floor((J-I)/P);return N.isDark(pe,V)?0:1}else return 1})},N.createImgTag=function(P,D,_){P=P||2,D=typeof D>"u"?P*4:D;var I=N.getModuleCount()*P+D*2,M="";return M+="<img",M+=' src="',M+=N.createDataURL(P,D),M+='"',M+=' width="',M+=I,M+='"',M+=' height="',M+=I,M+='"',_&&(M+=' alt="',M+=O(_),M+='"'),M+="/>",M};var O=function(P){for(var D="",_=0;_<P.length;_+=1){var I=P.charAt(_);switch(I){case"<":D+="&lt;";break;case">":D+="&gt;";break;case"&":D+="&amp;";break;case'"':D+="&quot;";break;default:D+=I;break}}return D},X=function(P){var D=1;P=typeof P>"u"?D*2:P;var _=N.getModuleCount()*D+P*2,I=P,M=_-P,j,J,V,pe,xe,ne={"██":"█","█ ":"▀"," █":"▄"," ":" "},De={"██":"▀","█ ":"▀"," █":" "," ":" "},Ae="";for(j=0;j<_;j+=2){for(V=Math.floor((j-I)/D),pe=Math.floor((j+1-I)/D),J=0;J<_;J+=1)xe="█",I<=J&&J<M&&I<=j&&j<M&&N.isDark(V,Math.floor((J-I)/D))&&(xe=" "),I<=J&&J<M&&I<=j+1&&j+1<M&&N.isDark(pe,Math.floor((J-I)/D))?xe+=" ":xe+="█",Ae+=P<1&&j+1>=M?De[xe]:ne[xe];Ae+=`
`}return _%2&&P>0?Ae.substring(0,Ae.length-_-1)+Array(_+1).join("▀"):Ae.substring(0,Ae.length-1)};return N.createASCII=function(P,D){if(P=P||1,P<2)return X(D);P-=1,D=typeof D>"u"?P*2:D;var _=N.getModuleCount()*P+D*2,I=D,M=_-D,j,J,V,pe,xe=Array(P+1).join("██"),ne=Array(P+1).join(" "),De="",Ae="";for(j=0;j<_;j+=1){for(V=Math.floor((j-I)/P),Ae="",J=0;J<_;J+=1)pe=1,I<=J&&J<M&&I<=j&&j<M&&N.isDark(V,Math.floor((J-I)/P))&&(pe=0),Ae+=pe?xe:ne;for(V=0;V<P;V+=1)De+=Ae+`
`}return De.substring(0,De.length-1)},N.renderTo2dContext=function(P,D){D=D||2;for(var _=N.getModuleCount(),I=0;I<_;I++)for(var M=0;M<_;M++)P.fillStyle=N.isDark(I,M)?"black":"white",P.fillRect(I*D,M*D,D,D)},N};n.stringToBytesFuncs={default:function(w){for(var v=[],y=0;y<w.length;y+=1){var E=w.charCodeAt(y);v.push(E&255)}return v}},n.stringToBytes=n.stringToBytesFuncs.default,n.createStringToBytes=function(w,v){var y=(function(){for(var k=m(w),z=function(){var R=k.read();if(R==-1)throw"eof";return R},f=0,g={};;){var S=k.read();if(S==-1)break;var T=z(),N=z(),W=z(),q=String.fromCharCode(S<<8|T),Y=N<<8|W;g[q]=Y,f+=1}if(f!=v)throw f+" != "+v;return g})(),E=63;return function(k){for(var z=[],f=0;f<k.length;f+=1){var g=k.charCodeAt(f);if(g<128)z.push(g);else{var S=y[k.charAt(f)];typeof S=="number"?(S&255)==S?z.push(S):(z.push(S>>>8),z.push(S&255)):z.push(E)}}return z}};var e={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},r={L:1,M:0,Q:3,H:2},o={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},a=(function(){var w=[[],[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]],v=1335,y=7973,E=21522,k={},z=function(f){for(var g=0;f!=0;)g+=1,f>>>=1;return g};return k.getBCHTypeInfo=function(f){for(var g=f<<10;z(g)-z(v)>=0;)g^=v<<z(g)-z(v);return(f<<10|g)^E},k.getBCHTypeNumber=function(f){for(var g=f<<12;z(g)-z(y)>=0;)g^=y<<z(g)-z(y);return f<<12|g},k.getPatternPosition=function(f){return w[f-1]},k.getMaskFunction=function(f){switch(f){case o.PATTERN000:return function(g,S){return(g+S)%2==0};case o.PATTERN001:return function(g,S){return g%2==0};case o.PATTERN010:return function(g,S){return S%3==0};case o.PATTERN011:return function(g,S){return(g+S)%3==0};case o.PATTERN100:return function(g,S){return(Math.floor(g/2)+Math.floor(S/3))%2==0};case o.PATTERN101:return function(g,S){return g*S%2+g*S%3==0};case o.PATTERN110:return function(g,S){return(g*S%2+g*S%3)%2==0};case o.PATTERN111:return function(g,S){return(g*S%3+(g+S)%2)%2==0};default:throw"bad maskPattern:"+f}},k.getErrorCorrectPolynomial=function(f){for(var g=s([1],0),S=0;S<f;S+=1)g=g.multiply(s([1,i.gexp(S)],0));return g},k.getLengthInBits=function(f,g){if(1<=g&&g<10)switch(f){case e.MODE_NUMBER:return 10;case e.MODE_ALPHA_NUM:return 9;case e.MODE_8BIT_BYTE:return 8;case e.MODE_KANJI:return 8;default:throw"mode:"+f}else if(g<27)switch(f){case e.MODE_NUMBER:return 12;case e.MODE_ALPHA_NUM:return 11;case e.MODE_8BIT_BYTE:return 16;case e.MODE_KANJI:return 10;default:throw"mode:"+f}else if(g<41)switch(f){case e.MODE_NUMBER:return 14;case e.MODE_ALPHA_NUM:return 13;case e.MODE_8BIT_BYTE:return 16;case e.MODE_KANJI:return 12;default:throw"mode:"+f}else throw"type:"+g},k.getLostPoint=function(f){for(var g=f.getModuleCount(),S=0,T=0;T<g;T+=1)for(var N=0;N<g;N+=1){for(var W=0,q=f.isDark(T,N),Y=-1;Y<=1;Y+=1)if(!(T+Y<0||g<=T+Y))for(var R=-1;R<=1;R+=1)N+R<0||g<=N+R||Y==0&&R==0||q==f.isDark(T+Y,N+R)&&(W+=1);W>5&&(S+=3+W-5)}for(var T=0;T<g-1;T+=1)for(var N=0;N<g-1;N+=1){var K=0;f.isDark(T,N)&&(K+=1),f.isDark(T+1,N)&&(K+=1),f.isDark(T,N+1)&&(K+=1),f.isDark(T+1,N+1)&&(K+=1),(K==0||K==4)&&(S+=3)}for(var T=0;T<g;T+=1)for(var N=0;N<g-6;N+=1)f.isDark(T,N)&&!f.isDark(T,N+1)&&f.isDark(T,N+2)&&f.isDark(T,N+3)&&f.isDark(T,N+4)&&!f.isDark(T,N+5)&&f.isDark(T,N+6)&&(S+=40);for(var N=0;N<g;N+=1)for(var T=0;T<g-6;T+=1)f.isDark(T,N)&&!f.isDark(T+1,N)&&f.isDark(T+2,N)&&f.isDark(T+3,N)&&f.isDark(T+4,N)&&!f.isDark(T+5,N)&&f.isDark(T+6,N)&&(S+=40);for(var Z=0,N=0;N<g;N+=1)for(var T=0;T<g;T+=1)f.isDark(T,N)&&(Z+=1);var de=Math.abs(100*Z/g/g-50)/5;return S+=de*10,S},k})(),i=(function(){for(var w=new Array(256),v=new Array(256),y=0;y<8;y+=1)w[y]=1<<y;for(var y=8;y<256;y+=1)w[y]=w[y-4]^w[y-5]^w[y-6]^w[y-8];for(var y=0;y<255;y+=1)v[w[y]]=y;var E={};return E.glog=function(k){if(k<1)throw"glog("+k+")";return v[k]},E.gexp=function(k){for(;k<0;)k+=255;for(;k>=256;)k-=255;return w[k]},E})();function s(w,v){if(typeof w.length>"u")throw w.length+"/"+v;var y=(function(){for(var k=0;k<w.length&&w[k]==0;)k+=1;for(var z=new Array(w.length-k+v),f=0;f<w.length-k;f+=1)z[f]=w[f+k];return z})(),E={};return E.getAt=function(k){return y[k]},E.getLength=function(){return y.length},E.multiply=function(k){for(var z=new Array(E.getLength()+k.getLength()-1),f=0;f<E.getLength();f+=1)for(var g=0;g<k.getLength();g+=1)z[f+g]^=i.gexp(i.glog(E.getAt(f))+i.glog(k.getAt(g)));return s(z,0)},E.mod=function(k){if(E.getLength()-k.getLength()<0)return E;for(var z=i.glog(E.getAt(0))-i.glog(k.getAt(0)),f=new Array(E.getLength()),g=0;g<E.getLength();g+=1)f[g]=E.getAt(g);for(var g=0;g<k.getLength();g+=1)f[g]^=i.gexp(i.glog(k.getAt(g))+z);return s(f,0).mod(k)},E}var l=(function(){var w=[[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,7,37,13],[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]],v=function(k,z){var f={};return f.totalCount=k,f.dataCount=z,f},y={},E=function(k,z){switch(z){case r.L:return w[(k-1)*4+0];case r.M:return w[(k-1)*4+1];case r.Q:return w[(k-1)*4+2];case r.H:return w[(k-1)*4+3];default:return}};return y.getRSBlocks=function(k,z){var f=E(k,z);if(typeof f>"u")throw"bad rs block @ typeNumber:"+k+"/errorCorrectionLevel:"+z;for(var g=f.length/3,S=[],T=0;T<g;T+=1)for(var N=f[T*3+0],W=f[T*3+1],q=f[T*3+2],Y=0;Y<N;Y+=1)S.push(v(W,q));return S},y})(),d=function(){var w=[],v=0,y={};return y.getBuffer=function(){return w},y.getAt=function(E){var k=Math.floor(E/8);return(w[k]>>>7-E%8&1)==1},y.put=function(E,k){for(var z=0;z<k;z+=1)y.putBit((E>>>k-z-1&1)==1)},y.getLengthInBits=function(){return v},y.putBit=function(E){var k=Math.floor(v/8);w.length<=k&&w.push(0),E&&(w[k]|=128>>>v%8),v+=1},y},c=function(w){var v=e.MODE_NUMBER,y=w,E={};E.getMode=function(){return v},E.getLength=function(f){return y.length},E.write=function(f){for(var g=y,S=0;S+2<g.length;)f.put(k(g.substring(S,S+3)),10),S+=3;S<g.length&&(g.length-S==1?f.put(k(g.substring(S,S+1)),4):g.length-S==2&&f.put(k(g.substring(S,S+2)),7))};var k=function(f){for(var g=0,S=0;S<f.length;S+=1)g=g*10+z(f.charAt(S));return g},z=function(f){if("0"<=f&&f<="9")return f.charCodeAt(0)-48;throw"illegal char :"+f};return E},p=function(w){var v=e.MODE_ALPHA_NUM,y=w,E={};E.getMode=function(){return v},E.getLength=function(z){return y.length},E.write=function(z){for(var f=y,g=0;g+1<f.length;)z.put(k(f.charAt(g))*45+k(f.charAt(g+1)),11),g+=2;g<f.length&&z.put(k(f.charAt(g)),6)};var k=function(z){if("0"<=z&&z<="9")return z.charCodeAt(0)-48;if("A"<=z&&z<="Z")return z.charCodeAt(0)-65+10;switch(z){case" ":return 36;case"$":return 37;case"%":return 38;case"*":return 39;case"+":return 40;case"-":return 41;case".":return 42;case"/":return 43;case":":return 44;default:throw"illegal char :"+z}};return E},u=function(w){var v=e.MODE_8BIT_BYTE,y=w,E=n.stringToBytes(w),k={};return k.getMode=function(){return v},k.getLength=function(z){return E.length},k.write=function(z){for(var f=0;f<E.length;f+=1)z.put(E[f],8)},k},x=function(w){var v=e.MODE_KANJI,y=w,E=n.stringToBytesFuncs.SJIS;if(!E)throw"sjis not supported.";(function(f,g){var S=E(f);if(S.length!=2||(S[0]<<8|S[1])!=g)throw"sjis not supported."})("友",38726);var k=E(w),z={};return z.getMode=function(){return v},z.getLength=function(f){return~~(k.length/2)},z.write=function(f){for(var g=k,S=0;S+1<g.length;){var T=(255&g[S])<<8|255&g[S+1];if(33088<=T&&T<=40956)T-=33088;else if(57408<=T&&T<=60351)T-=49472;else throw"illegal char at "+(S+1)+"/"+T;T=(T>>>8&255)*192+(T&255),f.put(T,13),S+=2}if(S<g.length)throw"illegal char at "+(S+1)},z},$=function(){var w=[],v={};return v.writeByte=function(y){w.push(y&255)},v.writeShort=function(y){v.writeByte(y),v.writeByte(y>>>8)},v.writeBytes=function(y,E,k){E=E||0,k=k||y.length;for(var z=0;z<k;z+=1)v.writeByte(y[z+E])},v.writeString=function(y){for(var E=0;E<y.length;E+=1)v.writeByte(y.charCodeAt(E))},v.toByteArray=function(){return w},v.toString=function(){var y="";y+="[";for(var E=0;E<w.length;E+=1)E>0&&(y+=","),y+=w[E];return y+="]",y},v},h=function(){var w=0,v=0,y=0,E="",k={},z=function(g){E+=String.fromCharCode(f(g&63))},f=function(g){if(!(g<0)){if(g<26)return 65+g;if(g<52)return 97+(g-26);if(g<62)return 48+(g-52);if(g==62)return 43;if(g==63)return 47}throw"n:"+g};return k.writeByte=function(g){for(w=w<<8|g&255,v+=8,y+=1;v>=6;)z(w>>>v-6),v-=6},k.flush=function(){if(v>0&&(z(w<<6-v),w=0,v=0),y%3!=0)for(var g=3-y%3,S=0;S<g;S+=1)E+="="},k.toString=function(){return E},k},m=function(w){var v=w,y=0,E=0,k=0,z={};z.read=function(){for(;k<8;){if(y>=v.length){if(k==0)return-1;throw"unexpected end of file./"+k}var g=v.charAt(y);if(y+=1,g=="=")return k=0,-1;if(g.match(/^\s$/))continue;E=E<<6|f(g.charCodeAt(0)),k+=6}var S=E>>>k-8&255;return k-=8,S};var f=function(g){if(65<=g&&g<=90)return g-65;if(97<=g&&g<=122)return g-97+26;if(48<=g&&g<=57)return g-48+52;if(g==43)return 62;if(g==47)return 63;throw"c:"+g};return z},C=function(w,v){var y=w,E=v,k=new Array(w*v),z={};z.setPixel=function(T,N,W){k[N*y+T]=W},z.write=function(T){T.writeString("GIF87a"),T.writeShort(y),T.writeShort(E),T.writeByte(128),T.writeByte(0),T.writeByte(0),T.writeByte(0),T.writeByte(0),T.writeByte(0),T.writeByte(255),T.writeByte(255),T.writeByte(255),T.writeString(","),T.writeShort(0),T.writeShort(0),T.writeShort(y),T.writeShort(E),T.writeByte(0);var N=2,W=g(N);T.writeByte(N);for(var q=0;W.length-q>255;)T.writeByte(255),T.writeBytes(W,q,255),q+=255;T.writeByte(W.length-q),T.writeBytes(W,q,W.length-q),T.writeByte(0),T.writeString(";")};var f=function(T){var N=T,W=0,q=0,Y={};return Y.write=function(R,K){if(R>>>K)throw"length over";for(;W+K>=8;)N.writeByte(255&(R<<W|q)),K-=8-W,R>>>=8-W,q=0,W=0;q=R<<W|q,W=W+K},Y.flush=function(){W>0&&N.writeByte(q)},Y},g=function(T){for(var N=1<<T,W=(1<<T)+1,q=T+1,Y=S(),R=0;R<N;R+=1)Y.add(String.fromCharCode(R));Y.add(String.fromCharCode(N)),Y.add(String.fromCharCode(W));var K=$(),Z=f(K);Z.write(N,q);var de=0,Q=String.fromCharCode(k[de]);for(de+=1;de<k.length;){var te=String.fromCharCode(k[de]);de+=1,Y.contains(Q+te)?Q=Q+te:(Z.write(Y.indexOf(Q),q),Y.size()<4095&&(Y.size()==1<<q&&(q+=1),Y.add(Q+te)),Q=te)}return Z.write(Y.indexOf(Q),q),Z.write(W,q),Z.flush(),K.toByteArray()},S=function(){var T={},N=0,W={};return W.add=function(q){if(W.contains(q))throw"dup key:"+q;T[q]=N,N+=1},W.size=function(){return N},W.indexOf=function(q){return T[q]},W.contains=function(q){return typeof T[q]<"u"},W};return z},B=function(w,v,y){for(var E=C(w,v),k=0;k<v;k+=1)for(var z=0;z<w;z+=1)E.setPixel(z,k,y(z,k));var f=$();E.write(f);for(var g=h(),S=f.toByteArray(),T=0;T<S.length;T+=1)g.writeByte(S[T]);return g.flush(),"data:image/gif;base64,"+g};return n})();(function(){tr.stringToBytesFuncs["UTF-8"]=function(n){function e(r){for(var o=[],a=0;a<r.length;a++){var i=r.charCodeAt(a);i<128?o.push(i):i<2048?o.push(192|i>>6,128|i&63):i<55296||i>=57344?o.push(224|i>>12,128|i>>6&63,128|i&63):(a++,i=65536+((i&1023)<<10|r.charCodeAt(a)&1023),o.push(240|i>>18,128|i>>12&63,128|i>>6&63,128|i&63))}return o}return e(n)}})();(function(n){typeof define=="function"&&define.amd?define([],n):typeof nr=="object"&&(or.exports=n())})(function(){return tr})});function Gn(n,e){return n==null||n===!1||n===""||(Array.isArray(n)?n.forEach(r=>Gn(r,e)):e.push(n instanceof Node?n:String(n))),e}function t(n,e,r){let o=window.E,a=e!=null&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Node);return!a&&r===void 0?o(n,{},Gn(e,[])):o(n,a?e:{},Gn(r,[]))}var Do={phone:'<rect x="7" y="2.5" width="10" height="19" rx="2.2"/><path d="M11 18.5h2"/>',computer:'<rect x="3" y="4.5" width="18" height="12" rx="1.8"/><path d="M2 19.5h20"/>',tablet:'<rect x="4.5" y="2.5" width="15" height="19" rx="2.2"/><path d="M11 18.5h2"/>',router:'<rect x="3" y="13" width="18" height="7" rx="1.8"/><path d="M7 16.5h.01M10.5 16.5h.01M8 13l-2-6M16 13l2-6"/>',server:'<rect x="3" y="4" width="18" height="7" rx="1.8"/><rect x="3" y="13" width="18" height="7" rx="1.8"/><path d="M7 7.5h.01M7 16.5h.01M11 7.5h6M11 16.5h6"/>',other:'<path d="M12 3 20 7.5v9L12 21l-8-4.5v-9L12 3Z"/><path d="M4 7.5 12 12l8-4.5M12 12v9"/>',ethernet:'<rect x="9" y="3" width="6" height="5" rx="1"/><rect x="3" y="16" width="6" height="5" rx="1"/><rect x="15" y="16" width="6" height="5" rx="1"/><path d="M12 8v4M6 16v-4h12v4"/>',bridge:'<circle cx="6" cy="6" r="2.2"/><circle cx="18" cy="18" r="2.2"/><path d="M6 8.2v4.3a4 4 0 0 0 4 4h5.8"/>',wifi:'<path d="M4.5 9.5a11 11 0 0 1 15 0M7.5 12.8a6.5 6.5 0 0 1 9 0M10.6 16a2 2 0 0 1 2.8 0"/><circle cx="12" cy="19" r=".6"/>',tunnel:'<path d="M9.5 14.5 14.5 9.5"/><path d="M11 6.5l1.5-1.5a4.2 4.2 0 0 1 6 6L17 12.5M13 17.5 11.5 19a4.2 4.2 0 0 1-6-6L7 11.5"/>',plus:'<path d="M12 5v14M5 12h14"/>',chart:'<path d="M4 20V10M10 20V4M16 20v-7M22 20H2"/>',reset:'<path d="M4 12a8 8 0 1 0 2.4-5.7L4 8.5"/><path d="M4 4v4.5h4.5"/>',package:'<path d="M12 3 20 7.5v9L12 21l-8-4.5v-9L12 3Z"/><path d="M4 7.5 12 12l8-4.5M12 12v9M8 5.3l8 4.5"/>',code:'<path d="m8 8-4 4 4 4M16 8l4 4-4 4M13.5 5l-3 14"/>',plug:'<path d="M9 3v5M15 3v5M6 8h12v3a6 6 0 0 1-12 0V8ZM12 17v4"/>',sunrise:'<path d="M4 16a8 8 0 0 1 16 0z"/><path d="M2 19.5h20"/>',refresh:'<path d="M20 12a8 8 0 1 1-2.4-5.7L20 8.5"/><path d="M20 4v4.5h-4.5"/>',archive:'<rect x="3" y="4" width="18" height="5" rx="1.2"/><path d="M5 9v10h14V9M10 13h4"/>',qr:'<rect x="4" y="4" width="6" height="6" rx="1"/><rect x="14" y="4" width="6" height="6" rx="1"/><rect x="4" y="14" width="6" height="6" rx="1"/><path d="M14 14h2v2h-2zM18 18h2v2h-2zM14 18h2M18 14h2"/>',copy:'<rect x="8" y="8" width="12" height="12" rx="2"/><path d="M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2"/>',download:'<path d="M12 4v11M7 10l5 5 5-5M5 20h14"/>',link:'<path d="M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1"/><path d="M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1"/>',amnezia:'<g fill="currentColor" stroke="none" transform="scale(.046875)"><path d="M511.8 185.5c.3.3.3.6 0 .6-2.2 1-4.5 2.2-6.7 3.2-17.3 7.7-33.6 16.6-47.7 29.4-4.8 4.5-9.3 9.3-13.1 14.4-3.8 4.8-5.1 10.9-5.1 17v.3c0 2.6 2.6 4.5 5.1 4.5h13.1c2.9 0 5.1 2.2 4.8 5.1-1 6.1-3.5 11.5-7.4 16.3-6.1 7.4-8.6 16-11.5 24.6-4.2 12.8-4.5 25.9-3.5 38.7 1 13.4-3.8 24.3-12.2 34.2-6.4 8-12.5 16-18.9 24s-9 17.3-8.3 27.5c1 13.1 4.2 25.9 7 39 2.2 10.6 3.2 21.4 4.5 32 .3 1.9-2.2 3.2-3.8 2.6s-3.2-1.3-4.8-2.2c-8-5.8-13.1-14.1-17-22.7-1.9-3.8-3.5-7.7-5.1-11.5-.6-1.3-1.6-2.2-2.9-2.6-3.5-1.6-5.4-2.9-6.7-5.1-1-1.9-2.9-3.2-4.8-3.2-7.7 0-15.7 1-23 3.5-14.7 5.1-29.1 9.9-43.5 15.7-16 6.1-32.6 7.4-49.3 5.4-16-1.9-31.7-5.4-47.7-8-5.4-1-10.6-1.3-16-2.2-1.3-.3-2.6-.6-3.8-1.3-9.6-4.8-19.2-9.6-28.8-14.1-10.6-4.8-18.6-1.3-22.4 9.3-1.6 4.5-2.6 9-4.2 13.4-2.2 6.7-4.8 13.4-7.7 20.2-1.6 3.5-3.8 5.8-7.4 7-2.9 1-5.4-1.6-5.1-4.8s.6-6.1 1-9c1.6-8.6 3.8-17 4.8-25.6s.3-17.6.3-26.2c0-1.3-1.3-2.9-2.2-3.8-7-7.4-14.4-14.4-21.4-21.4-7.7-7.4-15.4-15-20.5-24.6-4.8-8.6-12.2-9.9-20.2-8.3-13.1 2.6-25.9 5.8-39 9-3.2.6-6.4 1.6-9.6 2.6-.3 0-1 0-1-.3-.3-.3 0-.6 0-1 1.6-1.6 2.9-3.2 4.8-4.5 9.9-8.3 19.8-16 29.4-24.3 5.8-5.1 11.2-10.2 16.6-15.7 1-1 1.6-3.2 1.6-4.8-2.4-38.7 6.5-75.2 22.5-110.4 6.4-14.1 13.1-28.2 20.2-42.6 1-1.9 2.9-2.9 4.8-3.5 4.2-1.6 5.1-6.7 7.4-10.6 1.3-2.2 2.2-4.8 3.2-7.4 1-2.2 3.8-2.9 5.4-1.3 1.3 1.3 3.5 1.3 4.8 0 1.6-1.6 3.2-2.9 4.5-4.8 6.1-8.6 11.8-17.3 17.6-26.2 2.6-4.2 5.4-6.7 10.2-8 16-4.5 32-9.6 48-14.4.6-.3 1.3-.6 1.6-1.3 1.3-9.6 1.9-10.2 11.5-11.8 10.2-1.6 16.6-7 18.6-17.6 1.6-10.2 2.2-21.1 3.2-31.4 1-9 1.6-17.6 2.6-26.6.3-3.8 1.3-6.4 3.2-8 1.9-1.9 5.1-1 6.7 1.6 1.3 2.6 2.6 5.1 3.5 8 3.5 10.6 6.1 21.1 9.3 31.7 2.9 9 5.8 17.9 9.3 26.9 4.5 11.8 13.8 16.6 26.2 17 4.8 0 9.6.3 14.1 0 5.8-.3 11.2 1 15.7 4.5 12.5 9 25.3 17.9 37.1 27.5 8.6 6.7 16.6 14.7 25 22.4 1.3 1.3 3.2 1.6 4.8 1.6 2.9 0 5.8 1.3 8.3 2.9 2.2 1.3 2.9 4.2 1.6 6.4-.3.6-.6 1.6-1.3 2.2-1.3 2.6 0 5.8 2.6 7.4 7.4 4.2 13.1 10.6 19.5 16 2.6 2.2 5.1 4.2 7.7 6.1 5.1 3.8 10.6 4.5 16.6 3.2 11.8-2.9 23.4-6.1 35.2-8.6 9.8-3.5 18.5-4.4 28.1-3.2M264.1 440.2h28.8c2.6 0 5.4-.3 7.7-1.6 12.2-6.1 24-12.2 35.8-18.9 11.8-7 13.1-10.6 9.6-24-3.2-12.2-9.3-23.4-15.4-33.9-7.4-12.8-13.1-25.9-13.4-41-.3-8-2.6-15.7-6.4-22.7-3.2-6.4-8.6-9.3-15.7-9.3-19.2-.3-38.4 1.9-56.6 8.3-47.7 16-76.5 55.4-77.4 104-.3 11.8 4.8 19.8 15.4 24.3 7 3.2 14.7 6.1 22.1 8.3 21.4 6.8 43.4 7.5 65.5 6.5M94.5 314.5c1.9-.3 3.2-.3 4.8-.3 17-2.9 32.6-9 48-16.6 4.8-2.2 9.3-5.4 13.8-8.6 1.6-1.3 3.2-3.2 3.8-5.4 12.8-39.7 25.3-79.4 38.1-119 .6-1.9-.6-3.8-2.6-3.8-4.2 0-7.7 1.3-11.2 3.5-14.7 8.6-28.5 18.9-41 30.7-18.2 17.3-33.9 36.5-42.9 60.2-7.9 18.6-10.8 38.5-10.8 59.3m309.4-65c-1.3 0-2.6-.3-3.8 0-6.1 1-12.2 1.9-17.9 3.5-12.8 3.2-25 7.7-36.5 14.4-6.4 3.5-7.7 6.1-6.4 13.1.3 2.6 1 5.1 1.6 7.7 5.1 15.7 9.9 31.4 15.7 46.4 5.1 13.4 11.2 26.2 17.3 39 .3.3.3 1 .6 1.3 1.9 2.9 6.7 2.2 8.3-1 5.4-10.6 9.6-20.8 12.5-31.7 7.7-30.1 8.6-60.5 8.6-91.2.4-.2 0-.8 0-1.5m-197.7 18.9c1 0 1.6.3 2.2.3 13.4 0 26.9-1 40-4.5 9-2.2 17.3-5.8 25-10.9 6.1-4.2 8.6-9.6 7.7-16.6-.6-4.8-1.6-9.3-2.9-13.8-7.4-21.8-19.2-41.3-30.7-60.8-1.6-2.9-4.8-2.9-6.7 0-1 1.6-1.6 3.2-2.2 4.8-2.9 8-5.8 16-8.3 24-8 25-15.7 49.9-23.7 74.9-.1 1-.1 1.6-.4 2.6M290 154.8l-1 1s-.3.3 0 .6c5.8 17.9 11.2 35.8 17.6 53.4 2.2 6.7 5.8 12.8 9.3 18.9 3.2 5.8 8 7.7 14.7 7 16-1.3 28.8-9.6 42.2-16.3 1.6-.6 2.6-2.2 2.6-3.8 0-5.1-1.6-9.6-4.5-13.4-2.2-2.9-4.8-6.1-7.4-8.3-18.2-16.3-39-28.8-62.4-36.8-3.7-1.3-7.6-1.6-11.1-2.3M123 390.9c1.3-.3 2.2-1.6 2.6-2.9 3.5-12.5 7-24.6 10.6-36.8 0-.6.3-1.3.3-1.6.6-3.2-2.2-5.8-5.4-5.4-9.6 1-18.2 3.5-25.6 9.6-3.2 2.6-5.8 6.4-5.1 10.6 1.9 10.6 6.4 19.5 15.7 25.6 2.1.9 4.7 1.6 6.9.9"/></g>',amneziawg:'<g fill="currentColor" stroke="none" fill-rule="evenodd" transform="scale(.0467)"><path d="M195.7 492.3C196.5 490.2 198.3 483.3 199.6 477.0C205.9 447.1 210.2 441.9 228.7 441.9C234.0 441.9 241.9 442.5 246.2 443.1C254.7 444.3 265.4 444.0 284.6 441.9C301.1 440.2 303.8 440.9 307.4 448.5C310.3 454.6 314.0 467.5 314.0 471.4C314.0 476.0 319.2 488.2 322.7 491.6C329.7 498.7 335.1 493.9 341.0 475.5C341.7 473.3 343.3 469.9 344.5 468.0C345.7 466.1 348.3 461.1 350.2 456.9C360.1 435.6 392.7 402.2 425.2 380.2C431.2 376.1 441.1 365.0 444.5 358.6C446.0 355.8 449.9 349.4 453.2 344.4C460.0 333.9 464.1 323.2 467.4 307.0C470.0 294.9 471.5 289.8 474.8 283.4C481.7 269.8 484.0 246.8 479.6 236.2C474.6 224.1 471.8 193.1 474.1 175.0C475.9 161.2 476.7 149.7 476.0 147.0C475.3 144.1 468.2 140.2 463.6 140.1C455.1 139.9 448.8 133.7 442.5 119.1C440.2 113.8 437.1 107.2 435.7 104.3C432.5 98.0 432.4 95.7 435.0 84.8C439.6 65.1 442.1 18.0 438.5 18.0C436.5 18.0 431.4 26.1 424.2 40.7C408.7 72.1 404.8 76.3 395.0 72.4C390.1 70.4 387.6 66.6 384.0 55.2C382.4 50.5 380.4 46.0 379.3 45.2C376.5 43.1 368.4 44.3 361.3 47.9C353.7 51.8 351.8 51.8 339.5 47.6C317.5 40.2 314.1 39.1 305.0 37.1C276.2 30.5 218.2 30.4 198.0 37.0C188.6 40.1 163.2 52.8 151.2 60.4C142.6 65.9 140.2 67.0 136.6 67.0C132.5 67.0 132.0 67.3 128.0 72.5C123.5 78.3 112.5 89.0 111.0 89.0C109.9 89.0 109.3 86.9 108.4 80.5C107.5 73.4 100.4 52.6 96.6 45.5C90.3 34.0 86.5 28.1 85.5 28.4C81.5 29.5 77.7 67.2 80.1 81.8C80.6 84.9 81.0 94.3 80.9 102.6C80.8 121.3 80.0 123.3 66.7 139.0C63.0 143.3 53.3 163.1 49.5 174.0C43.4 191.5 42.3 196.1 41.1 209.0C40.4 215.9 39.0 228.7 38.0 237.5C34.9 263.0 35.1 270.8 39.0 283.5C40.1 286.8 41.6 292.4 42.5 296.0C46.4 311.3 62.6 345.6 72.4 359.0C90.2 383.5 120.7 409.9 135.1 413.3C139.2 414.3 152.5 423.4 155.3 427.1C157.6 430.2 169.4 454.7 175.0 468.0C186.7 495.8 191.7 501.7 195.7 492.3ZM243.5 407.9C241.3 407.5 237.4 407.1 234.7 407.1C230.6 407.0 229.4 406.5 225.5 402.9C220.2 398.0 220.1 397.6 224.0 389.5C225.6 386.1 227.7 380.3 228.5 376.6C229.4 372.9 230.7 368.2 231.5 366.2C234.2 359.2 237.8 345.5 240.5 332.5C244.8 311.7 249.0 296.7 254.2 284.0C256.1 279.3 258.0 274.3 258.4 272.8C260.1 265.8 264.5 274.9 269.1 294.5C269.7 297.2 271.3 303.1 272.6 307.5C273.9 311.9 275.4 318.2 275.9 321.5C277.1 329.3 285.1 358.9 288.0 366.6C291.3 375.3 291.8 386.5 289.2 391.5C282.5 404.7 262.4 411.9 243.5 407.9ZM184.8 381.8C180.9 377.6 176.4 366.0 173.9 353.6C173.3 350.8 170.3 339.5 167.3 328.5C160.2 302.8 156.8 289.4 151.9 269.0C149.7 259.9 147.0 248.9 145.9 244.5C143.9 236.3 141.8 227.4 137.5 209.0C136.1 203.2 134.2 193.0 133.1 186.2C132.0 179.5 130.8 173.5 130.5 173.0C130.2 172.5 129.5 168.4 128.9 163.8C128.4 159.2 126.8 151.0 125.5 145.5C124.1 140.0 123.0 133.9 123.0 131.9C123.0 130.0 122.5 127.9 121.9 127.3C119.1 124.5 126.3 115.6 137.7 107.7C152.0 97.7 178.7 87.0 203.0 81.5C233.5 74.6 230.5 74.9 262.0 74.8C296.3 74.7 303.8 76.3 327.4 88.2C337.4 93.2 344.8 96.0 348.6 96.0C350.5 96.0 372.4 109.2 379.6 114.7C384.3 118.2 385.6 122.0 384.2 128.2C383.5 130.9 383.0 134.8 383.0 136.8C383.0 138.9 382.5 142.1 382.0 144.0C380.3 149.7 378.2 165.7 377.5 177.0C377.0 186.5 376.4 190.9 373.0 210.5C372.5 213.8 371.7 219.2 371.4 222.5C371.1 225.8 370.2 231.0 369.4 234.0C368.6 237.0 368.0 240.3 368.0 241.5C368.0 242.6 367.2 246.2 366.1 249.5C362.8 259.8 359.8 271.2 358.5 278.5C357.8 282.4 356.3 289.3 355.1 294.0C354.0 298.7 352.4 307.4 351.5 313.5C347.4 343.1 339.0 369.4 330.6 379.5C328.2 382.3 328.1 382.4 326.1 380.6C323.5 378.3 318.4 364.4 311.6 341.5C309.2 333.5 305.8 324.8 300.0 312.4C295.9 303.5 293.0 292.7 293.0 286.3C293.0 282.8 291.5 276.7 288.5 267.6C286.0 260.1 284.0 252.8 284.0 251.4C284.0 249.0 282.9 241.8 279.9 224.6C279.3 221.4 277.5 214.6 275.9 209.6C270.0 191.3 268.1 185.3 265.5 176.8C264.1 171.9 262.6 168.0 262.2 168.0C261.3 168.0 253.1 188.4 249.5 199.5C247.1 207.1 245.0 215.9 241.5 233.5C240.6 237.9 239.3 244.2 238.5 247.5C234.6 264.6 232.9 272.2 231.4 279.5C230.5 283.9 228.0 291.8 225.8 297.0C222.3 305.3 214.6 326.6 199.6 369.8C193.4 387.3 191.4 389.0 184.8 381.8ZM370.4 368.5C370.0 367.6 371.1 362.7 372.9 357.7C378.0 343.2 379.9 335.4 381.5 323.0C383.2 310.2 383.9 306.6 386.8 296.5C391.2 280.9 396.2 258.4 397.1 249.7C397.6 244.7 398.5 239.2 399.0 237.5C399.5 235.8 400.6 230.2 401.5 225.0C402.3 219.8 403.5 213.2 404.0 210.5C404.5 207.8 405.2 203.0 405.6 200.0C405.9 197.0 407.0 191.8 408.0 188.5C409.0 185.2 410.1 179.9 410.5 176.8C411.3 169.8 412.1 169.7 417.4 175.4C424.5 182.9 427.3 189.6 430.0 205.7C435.9 240.1 430.9 279.3 417.1 306.7C415.0 311.0 412.1 317.8 410.6 321.8C407.1 331.5 405.8 333.9 397.9 345.1C384.7 363.8 372.5 374.1 370.4 368.5ZM116.2 361.0C108.1 357.3 94.1 343.1 89.3 333.6C88.5 331.9 85.3 326.7 82.4 322.0C76.7 312.9 65.8 287.4 63.5 277.5C60.9 266.7 63.1 223.5 66.9 210.4C70.4 198.3 86.0 170.5 88.0 172.7C92.4 177.1 99.3 193.3 106.5 216.0C109.0 224.0 112.1 232.3 113.4 234.5C116.9 240.6 120.6 252.8 124.5 271.5C126.4 280.9 129.1 293.9 130.5 300.5C134.9 321.0 134.7 353.9 130.3 360.7C128.3 363.7 122.3 363.8 116.2 361.0Z"/></g>',wireguard:'<g fill="currentColor" stroke="none" transform="scale(.046875)"><path d="M511.6 248.4S523.4 0 250.4 0C8.9 0 1.4 238.3 1.4 238.3S-34.1 512 255.9 512c278.3 0 255.7-263.6 255.7-263.6M174 161.6c51.2-31.3 116.7-12.2 141.2 34.9 4.6 8.9 5.2 22.7 2.3 32-10.2 32.4-34.2 50.5-67.1 58.2 9.7-8.3 17.4-17.7 19.9-30.8 2.6-12.5-.2-25.5-7.8-35.8-12-16.5-33.4-23-52.6-16-20.3 7.7-31.4 26.2-29.4 49 1.9 21.1 17.9 34.8 47.9 40-4.5 2.4-7.9 4.1-11.3 6-13.7 7.5-25.7 17.9-35.1 30.5-3 4.1-5.1 4.4-9.8 1.6-60.2-36.7-64.1-129.3 1.8-169.6m-45.2 227.9c-9.7 2.5-19.1 6.1-29 9.3 4.8-32.7 43.1-62.8 75.5-59.4-9.4 12.9-14.8 28.3-15.8 44.2-10.7 2.1-20.8 3.4-30.7 5.9M335 70.4c9.6.4 19.2.2 28.8.4 2.4.2 4.8.5 7.1 1-2.1 3.3-4.6 6.4-7.2 9.3-3.4 3.2-7.3 6.3-12.2 1.5-1.2-1.2-4-.9-6.1-.9-9.5-.1-19.1-.4-28.6-.1-8.3.3-16.5 1.1-24.6 2.5-1.5.3-3.8 5.3-3.1 7.2 1.6 4.4 4.1 9.3 7.6 12.1 13.2 10.4 27.3 19.8 40.5 30.1 12.9 10.1 24.9 21.1 32.2 36.3 9.5 19.8 9.8 40.5 5.7 61.4-6.9 34.8-24.5 63.6-53 84.5-11.5 8.4-25.7 13.2-38.8 19.3-11.6 5.3-23.5 9.9-35.1 15.2-20.9 9.5-32.7 32.2-29.2 55.8 3.2 21.6 22.2 39.7 43.9 43.4 26.1 4.5 53-12.5 59.4-39 7.2-29.8-9-56.5-39.4-64.5-1.3-.4-2.7-.7-5.5-1.4 8.1-3.6 15.1-6.2 21.6-9.8 11.3-6.2 22.4-12.8 33.2-19.7 3.2-2 4.9-2 7.7.3 20.9 18 33.3 40.5 36.8 68 5.8 45.5-15.8 87.4-56.4 108.8-62.9 33.2-139.9-4.6-153.8-74.3-11.9-59.7 30.3-113.9 81-124.4 21.8-4.5 41.8-13.6 57.3-30.4 10-10.8 14.9-20.1 16.5-24.4 3.1-7.9 4.7-16.2 4.6-24.7-.3-7.3-2-14.5-5.1-21.2-5.3-12.1-25.6-31.3-30.6-35.3L242.6 120c-1.7-1.4-3.6-1.3-7.7-1-4.9.3-17.4 1-22.8-.4 4.4-3.3 16.2-8.1 21.3-12-15.5-10.5-33.2-6.7-49.4-9.8 3.7-7 22.3-17.7 32.9-18.9-.6-5.9-1.6-11.8-2.9-17.6-.6-2.4-3.3-4.7-5.6-6-5.6-3.3-11.6-6-18-9.3 5.8-3.7 12.5-5.8 19.3-6 6.5-.2 13 .4 19.4 1.9 11.5 2.6 20.7.9 29.8-6.9-7.2-2.9-14.4-5.6-21.4-8.7q-10.35-4.65-20.1-10.5c18.1 2.5 35.7 9.3 54.2 6.8l.5-2.5-42.9-10c25.7-2.4 49.6-2.7 72.2 8.3 6.4 3.1 13 5.7 19.1 9.2 3 1.7 5 5.1 7.4 7.8 1.9 2.1 3.5 4.9 5.9 6.2 9 4.8 19 5 29.2 4.8l.2-3.4c10.2 3.2 21.7 15 21.7 23.6-16.5 0-33.1-.1-49.6.1-1.8 0-3.5 1.3-5.3 2 1.6.9 3.3 2.6 5 2.7m-21.3-24.5c-1.2.7-1.5 2.3-.8 3.5.1.2.3.4.5.6 1 1.8 3.4 2.5 5.2 1.4 1.6-.8 3.2-1.7 5.1-2.7-1.6-1.3-2.8-2.4-4.1-3.5-2.3-1.8-4.1-.7-5.9.7"/></g>',appstore:'<g fill="currentColor" stroke="none" transform="scale(.046875)"><path d="M401 0H111C49.7 0 0 49.7 0 111v290c0 61.3 49.7 111 111 111h290c61.3 0 111-49.7 111-111V111C512 49.7 462.3 0 401 0M147.8 400.9c-1.3 2.2-2.6 4.5-4 6.6-1.3 2-2.7 3.8-4.4 5.5-3.5 3.5-8.1 5.7-13 6.3s-9.9-.4-14.2-2.8c-4.3-2.5-7.6-6.3-9.6-10.9-1.9-4.6-2.2-9.6-1-14.4.6-2.3 1.5-4.4 2.5-6.5 1.2-2.3 2.5-4.5 3.8-6.8l12.5-21.6c30.5-7.9 44 11.1 45.4 13.3zM306.2 341c-.6 2.1-1.3 3.5-1.5 4H102.4c-2.1 0-4.3 0-6.4-.1-2.3-.1-4.6-.4-6.9-1.1-4.8-1.3-8.9-4.2-12-8.2-3-4-4.6-8.8-4.6-13.8s1.6-9.8 4.6-13.8 7.2-6.8 12-8.2c2.3-.6 4.5-.9 6.9-1.1 2.6-.1 5.1-.1 7.7-.1h51.1L229.4 168l-19.2-33.6c-1.3-2.2-2.6-4.5-3.7-6.8-1-2.1-1.9-4.2-2.5-6.6-1.2-4.8-.9-9.9 1-14.5s5.2-8.5 9.5-11 9.2-3.5 14.1-2.9 9.4 2.9 13 6.4c1.7 1.7 3.1 3.5 4.3 5.5 1.4 2.2 2.7 4.4 4 6.7l5.9 10.4 5.9-10.4c1.3-2.2 2.6-4.5 4-6.7 1.3-2 2.7-3.8 4.3-5.5 3.5-3.5 8-5.7 13-6.4 4.9-.6 9.9.4 14.1 2.9 4.3 2.5 7.6 6.3 9.5 11 1.9 4.6 2.2 9.7 1 14.5-.6 2.3-1.5 4.4-2.5 6.6-1.2 2.3-2.5 4.6-3.7 6.8l-93.8 164.3H275c21.8 0 37.6 21.2 31.2 42.3m128.7-5.5c-3 4-7.2 6.8-12 8.2-2.3.6-4.6.9-6.9 1.1-2.2.1-4.3.1-6.5.1h-25.9l18.8 32.7c1.3 2.3 2.6 4.5 3.8 6.8 1.1 2.1 2 4.3 2.5 6.6 1.2 4.9.9 9.9-1 14.6-1.9 4.6-5.3 8.5-9.6 11s-9.3 3.5-14.2 2.9c-5-.6-9.5-2.9-13-6.4-1.7-1.7-3.1-3.5-4.4-5.5-1.4-2.2-2.7-4.4-4-6.7l-81.4-141.8c-7.9-13.7-11-29.7-8.4-45.3 1.8-10.8 6.4-22.6 16.6-33.2l67.7 118h51.3c2.6 0 5.2 0 7.8.1 2.3.1 4.6.4 6.9 1.1 4.8 1.3 9 4.2 12 8.2s4.6 8.8 4.6 13.8-1.7 9.7-4.7 13.7"/></g>',googleplay:'<g fill="currentColor" stroke="none" transform="scale(.046875)"><path d="M241.9 246.7 27.5 35C35.1 14.2 55.1 0 77.4 0h.1c9.6 0 19.1 2.6 27.4 7.5L345 145zM24.6 52.1v409l37.6-37.2L232.3 256l-2.7-2.7-205-202.4zm26.9 453.1c12.4 6.9 26.7 8.6 40.4 4.8 4.3-1.2 8.4-2.9 12.2-5.2l240.4-136.9-102.7-102.4L27.5 477c4.4 12 12.8 21.9 24 28.2M357 151.9 251.3 256.1l81.3 81.1 23.9 23.9 103.2-58.7c25.2-13.2 35-44.5 21.8-69.7-4.9-9.4-11.4-14.6-21.8-21.8"/></g>',github:'<g fill="currentColor" stroke="none" transform="scale(.046875)"><path d="M256 6.3C114.6 6.3 0 120.9 0 262.3c0 113.3 73.3 209 175 242.9 12.8 2.2 17.6-5.4 17.6-12.2 0-6.1-.3-26.2-.3-47.7-64.3 11.8-81-15.7-86.1-30.1-2.9-7.4-15.4-30.1-26.2-36.2-9-4.8-21.8-16.6-.3-17 20.2-.3 34.6 18.6 39.4 26.2 23 38.7 59.8 27.8 74.6 21.1 2.2-16.6 9-27.8 16.3-34.2-57-6.4-116.5-28.5-116.5-126.4 0-27.8 9.9-50.9 26.2-68.8-2.6-6.4-11.5-32.6 2.6-67.8 0 0 21.4-6.7 70.4 26.2 20.5-5.8 42.2-8.6 64-8.6s43.5 2.9 64 8.6c49-33.3 70.4-26.2 70.4-26.2 14.1 35.2 5.1 61.4 2.6 67.8 16.3 17.9 26.2 40.6 26.2 68.8 0 98.2-59.8 120-116.8 126.4 9.3 8 17.3 23.4 17.3 47.4 0 34.2-.3 61.8-.3 70.4 0 6.7 4.8 14.7 17.6 12.2C438.7 471.3 512 375.3 512 262.3c0-141.4-114.6-256-256-256"/></g>',openwrt:'<g fill="currentColor" stroke="none" transform="scale(.046875)"><path d="M255.9 267.3c-19.2-.3-35 14.9-35.3 34.1s14.9 35 34.1 35.3h1.3c19.2-.3 34.5-16.2 34.1-35.3-.4-18.7-15.5-33.8-34.2-34.1M42.6 88.7l36.2 36.2c47-47.1 110.7-73.4 177.2-73.3 66.5-.1 130.3 26.4 177.2 73.3l36.2-36.2C414.8 34 339.3 0 256 0 172.6 0 97.1 34 42.6 88.7m65.2 65.2 36.2 36.2c29.7-29.7 70-46.4 112-46.4s82.3 16.6 112 46.4l36.2-36.2C366.3 116 313.8 92.2 256 92.2S145.7 116 107.8 153.9m64.8 64.9 36.2 36.2c26-26 68.3-26 94.3 0l36.2-36.2c-22-22.1-52.1-34.5-83.3-34.3-32.3-.1-61.8 13-83.4 34.3m211.6-9.9c19.8 27 30.5 59.7 30.5 93.2 0 87.6-71.3 158.8-158.8 158.8-87.6 0-158.8-71.3-158.8-158.8 0-34.8 11.3-67 30.5-93.2l-36.5-36.5C61.8 209.3 45.9 255 46 302.1 46 417.7 140.3 512 255.9 512s209.9-94.3 209.9-209.9c0-48.9-17.1-94-45-129.7z"/></g>',apple:'<g fill="currentColor" stroke="none" transform="scale(.046875)"><path d="M451.1 174.6c-3 2.3-55.4 31.8-55.4 97.5 0 76 66.7 102.9 68.7 103.5-.3 1.6-10.6 36.8-35.2 72.7-21.9 31.5-44.8 63-79.6 63s-43.8-20.2-84-20.2c-39.2 0-53.1 20.9-84.9 20.9s-54.1-29.2-79.6-65c-29.6-42.1-53.5-107.5-53.5-169.5 0-99.5 64.7-152.3 128.4-152.3 33.8 0 62.1 22.2 83.3 22.2 20.2 0 51.8-23.6 90.3-23.6 14.6 0 67 1.3 101.5 50.8m-119.8-93c15.9-18.9 27.2-45.1 27.2-71.3 0-3.6-.3-7.3-1-10.3-25.9 1-56.7 17.3-75.3 38.8-14.6 16.6-28.2 42.8-28.2 69.4 0 4 .7 8 1 9.3 1.6.3 4.3.7 7 .7 23.2-.1 52.4-15.6 69.3-36.6"/></g>',windows:'<g fill="currentColor" stroke="none"><path d="M3 3h8.5v8.5H3zM12.5 3H21v8.5h-8.5zM3 12.5h8.5V21H3zM12.5 12.5H21V21h-8.5z"/></g>',linux:'<path d="M4 17V7a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v10"/><path d="M2 17h20v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2z"/><path d="m8 9 2 2-2 2M12 13h3"/>',eye:'<path d="M2 12s3.5-6 10-6 10 6 10 6-3.5 6-10 6-10-6-10-6z"/><circle cx="12" cy="12" r="3"/>',share:'<path d="M12 3v12M8 7l4-4 4 4M5 14v5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5"/>',arrow:'<path d="M5 12h14M13 6l6 6-6 6"/>',trash:'<path d="M4 7h16M10 11v6M14 11v6M6 7l1 13h10l1-13M9 7V4h6v3"/>',edit:'<path d="M4 20h4L19 9l-4-4L4 16z"/>',pause:'<path d="M9 5v14M15 5v14"/>',play:'<path d="M7 4l13 8-13 8z"/>',key:'<circle cx="8" cy="15" r="4"/><path d="M11 12l8-8M16 7l2 2"/>',out:'<path d="M14 4h6v16h-6M10 8l-4 4 4 4M6 12h10"/>',admin:'<path d="M6 21v-2a4 4 0 0 1 4-4h2"/><path d="M22 16c0 4-2.5 6-3.5 6s-3.5-2-3.5-6c1 0 2.5-.5 3.5-1.5 1 1 2.5 1.5 3.5 1.5z"/><circle cx="10" cy="7" r="4"/>',shield:'<path d="M12 3l8 3v6c0 5-3.5 8-8 9-4.5-1-8-4-8-9V6z"/>',shieldplus:'<path d="M12 3l8 3v6c0 5-3.5 8-8 9-4.5-1-8-4-8-9V6z"/><path d="M12 9v6M9 12h6"/>',lock:'<rect x="5" y="10.5" width="14" height="10" rx="2"/><path d="M8 10.5V8a4 4 0 0 1 8 0v2.5"/><path d="M12 14.5v2"/>',zap:'<path d="M13 3 5 13.5h6L10 21l8-10.5h-6L13 3z"/>',check:'<path d="M5 12.5l4.5 4.5L19 7.5"/>',alert:'<path d="M12 3l9.5 17h-19z"/><path d="M12 10v4M12 17h.01"/>',x:'<path d="M6 6l12 12M18 6L6 18"/>',globe:'<circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3c3 3.5 3 14.5 0 18M12 3c-3 3.5-3 14.5 0 18"/>',home:'<path d="M3 11l9-7 9 7"/><path d="M5 10v10h14V10"/>',open:'<path d="M14 4h6v6M20 4l-9 9M18 14v6H4V6h6"/>',file:'<path d="M6 3h8l4 4v14H6z"/><path d="M14 3v4h4"/>',network:'<circle cx="12" cy="12" r="2.5"/><circle cx="5" cy="5" r="1.8"/><circle cx="19" cy="5" r="1.8"/><circle cx="5" cy="19" r="1.8"/><circle cx="19" cy="19" r="1.8"/><path d="m6.4 6.4 3.8 3.8M17.6 6.4l-3.8 3.8M6.4 17.6l3.8-3.8M17.6 17.6l-3.8-3.8"/>',moon:'<path d="M20 14.5A8 8 0 1 1 9.5 4a6.5 6.5 0 0 0 10.5 10.5z"/>',chevron:'<path d="m9 6 6 6-6 6"/>',clock:'<circle cx="12" cy="12" r="8.5"/><path d="M12 7.5V12l3 2"/>',calendar:'<rect x="4" y="5" width="16" height="16" rx="2"/><path d="M8 3v4M16 3v4M4 10h16"/>',minus:'<path d="M5 12h14"/>',more:'<circle cx="5" cy="12" r="1.2"/><circle cx="12" cy="12" r="1.2"/><circle cx="19" cy="12" r="1.2"/>',pin:'<path d="M12 21s7-6.2 7-11.5A7 7 0 0 0 5 9.5C5 14.8 12 21 12 21z"/><circle cx="12" cy="9.5" r="2.5"/>',activity:'<path d="M3 12h4l3-8 4 16 3-8h4"/>'};function ft(n,e="dl-icon"){let r=Do[n]??Do.phone;return`<svg class="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${r}</svg>`}function b(n,e="dl-icon"){let r=document.createElement("span");return r.className="dl-icon-wrap",r.innerHTML=ft(n,e),r}function U(n,e="info",r=0){let o=document.querySelector(".dl-toasts");o||(o=t("div",{class:"dl-toasts dl-root",role:"status","aria-live":"polite"}),document.body.appendChild(o));let a=e==="error"?"x":e==="warning"?"alert":e==="success"?"check":null,i=()=>{s.classList.remove("show"),setTimeout(()=>s.remove(),200)},s=t("div",{class:`dl-toast ${e}`},[a?b(a):"",t("span",{},n),e==="error"?t("button",{type:"button","aria-label":"Close",click:i},b("x")):""]);o.appendChild(s),requestAnimationFrame(()=>s.classList.add("show")),setTimeout(i,r||(e==="error"?8e3:e==="warning"?5e3:2600))}function be(n){return n instanceof Error?n.message:String(n)}async function G(n,e){try{let r=await n();return e&&U(e,"success",3500),r}catch(r){U(be(r),"error",1e4);return}}function Ao(n){try{let e=n();e&&typeof e.then=="function"&&e.catch(r=>U(be(r),"error"))}catch(e){U(be(e),"error")}}function Ho(n){if(n&&typeof n=="object"){if(typeof n.error=="string")throw new Error(n.error);typeof n.warning=="string"&&n.warning&&U(n.warning,"warning",12e3)}return n}function F(n,e=[]){let r=rpc.declare({object:"luci.dawnline",method:n,params:e});return async(...o)=>Ho(await r(...o))}var Li=F("logs_clear",["person","device","category","older_days"]),Mi=(n={})=>Li(n.person??"",n.device??"",n.category??"",n.older_days??""),Si=rpc.declare({object:"luci.dawnline",method:"person_update",params:["id","name","access","device_limit","expires","expire_action","expire_warn","quota_gb","quota_period","bonus_gb","hours","note","dns_mode","paused","services","circle","home_nets","server"]});async function Ti(n,e){let o=[n,...["name","access","device_limit","expires","expire_action","expire_warn","quota_gb","quota_period","bonus_gb","hours","note","dns_mode"].map(a=>e[a]),e.paused,e.services,e.circle,e.home_nets,e.server];return Ho(await Si(...o))}var _i=F("status",["days"]),A={rev:F("rev"),personUpdate:Ti,settingsGet:F("settings_get"),portalInfo:F("portal_info"),settingsUpdate:F("settings_update",["values"]),serviceSet:F("service_set",["id","name","address","ports"]),serviceDelete:F("service_delete",["id"]),geoClear:F("geo_clear"),events:F("events",["limit","person","since"]),logsClear:Mi,interfaces:F("interfaces",["id"]),serverInterfaces:F("server_interfaces",["id","auto_wan","wan_device","auto_lan","lan_devices","lan_like","device_mesh","mesh"]),circleSet:F("circle_set",["id","server","name","color","members"]),circleDelete:F("circle_delete",["id"]),accessCheck:F("access_check",["from","to"]),homeHosts:F("home_hosts",["id"]),usageClear:F("usage_clear",["scope","id"]),uninstall:F("uninstall",["confirm"]),status:_i,setupDefaults:F("setup_defaults"),serverCreate:F("server_create",["id","name","ifname","port","subnet","endpoint","mtu","preset","lan_zone","wan_zone","lan_like","portal_enabled","portal_port"]),serverObfuscation:F("server_obfuscation",["id","preset"]),serverUpdate:F("server_update",["id","values"]),serverPorts:F("server_ports",["id"]),endpointProbe:F("endpoint_probe",["host","id","port"]),serverDelete:F("server_delete",["id"]),personLinks:F("person_links",["id"]),personCreate:F("person_create",["name","slug","server","access","device_limit","expires","quota_gb","quota_period"]),personPause:F("person_pause",["id","paused"]),personRegen:F("person_regen",["id","remove"]),personDelete:F("person_delete",["id"]),personUsage:F("person_usage",["id","days"]),deviceCreate:F("device_create",["person","name","kind"]),deviceConfig:F("device_config",["id"]),deviceUpdate:F("device_update",["id","name","disabled"]),deviceDelete:F("device_delete",["id"]),deviceRotate:F("device_rotate",["id"]),apply:F("apply"),health:F("health"),healthFix:F("health_fix",["id"]),serviceLog:F("service_log"),serviceLogClear:F("service_log_clear",["older_days"]),backupList:F("backup_list"),backupCreate:F("backup_create"),backupRestore:F("backup_restore",["name"]),backupDelete:F("backup_delete",["name"]),backupRead:F("backup_read",["name"]),backupUpload:F("backup_upload",["data"]),exportJson:F("export"),importJson:F("import",["data"]),updatesStatus:F("updates_status"),updatesRun:F("updates_run",["what"]),updatesReleases:F("updates_releases",["page"]),updatesNotes:F("updates_notes",["component","tag","build"]),updatesChanges:F("updates_changes",["from","to"])};function H(n,e,r="neutral",o={}){let{disabled:a,...i}=o,s=t("button",{class:`cbi-button cbi-button-${r}`,type:"button",...i,click:async l=>{if(l.preventDefault(),l.stopPropagation(),!s.disabled){s.disabled=!0,s.classList.add("spinning");try{await e(l)}catch(d){U(be(d),"error")}finally{s.disabled=!1,s.classList.remove("spinning")}}}},n);return s.disabled=!!a,s}function Le(n,e,r,o="neutral",a=""){return H([b(n),t("span",{class:"dl-btn-label"},e)],r,o,{title:e,class:`cbi-button cbi-button-${o} dl-icon-btn ${a}`.trim()})}function $e(n){return document.addEventListener("luci-navigate",n),()=>document.removeEventListener("luci-navigate",n)}var gt=null;function Wn(n=!1){let e=gt;gt=null,e?.(n)}function oe(n,e,r,o=""){Wn();let a=t("div",{class:`dl-modal ${o}`},e),i=t("div",{class:"button-row"},r);a.addEventListener("keydown",s=>{if(s.key==="Escape"){s.preventDefault(),s.stopPropagation(),ae();return}if(s.key!=="Enter"||s.shiftKey||s.ctrlKey||s.metaKey||s.altKey)return;let l=s.target;if(!l||["TEXTAREA","BUTTON","SELECT","A"].includes(l.tagName))return;let d=i.querySelector(".cbi-button-positive");!d||d.disabled||(s.preventDefault(),d.click())}),ui.showModal(n,[a,i])}function ae(){Wn(),ui.hideModal()}function ie(n="Cancel",e=!1){return t("button",{class:`cbi-button ${e?"cbi-button-negative":"cbi-button-neutral"}`,type:"button",click:ae},n)}function le(n,e,r="Confirm",o=!1){return new Promise(a=>{oe(n,e,[ie()," ",t("button",{class:`cbi-button ${o?"cbi-button-negative":"cbi-button-positive"}`,type:"button",click:()=>{let i=gt;gt=null,ui.hideModal(),i?.(!0)}},r)]),gt=a})}$e(()=>{gt&&(Wn(),ui.hideModal())});async function ue(n,e="Copied to clipboard",r=!1){try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(n);else{let o=t("textarea",{style:"position:fixed;opacity:0"},n);document.body.appendChild(o),o.select();let a=document.execCommand("copy");if(o.remove(),!a)throw new Error("Copying is blocked here. Select the text and copy it by hand.")}return U(e,"success",2500),!0}catch(o){return r||U(be(o),"error"),!1}}function Te(n,e,r="text/plain"){let o=globalThis,a=typeof e=="string"?new o.Blob([e],{type:r}):e,i=URL.createObjectURL(a),s=t("a",{href:i,download:n,style:"display:none"});document.body.appendChild(s),s.click(),setTimeout(()=>{URL.revokeObjectURL(i),s.remove()},1e3)}function Fn(n,e){return new Promise(r=>{let o=t("input",{type:"file",accept:n,style:"display:none"});o.addEventListener("cancel",()=>{o.remove(),r(null)}),o.addEventListener("change",()=>{let a=o.files?.[0];if(o.remove(),!a)return r(null);let i=new FileReader;i.onload=()=>{let s=String(i.result??"");r({name:a.name,data:e==="base64"?s.replace(/^data:[^,]*,/,""):s})},i.onerror=()=>r(null),e==="base64"?i.readAsDataURL(a):i.readAsText(a)}),document.body.appendChild(o),o.click()})}function Ce(n,e){let r=document.querySelector(".dl-dd");if(r&&(r.dlClose?r.dlClose():r.remove(),r.dlAnchor===n))return;let o=t("div",{class:"dl-dd dl-root",role:"menu"},e.map(u=>u?t("button",{type:"button",role:"menuitem",class:u.danger?"danger":u.warn?"warn":"",click:()=>{p(),Ao(u.run)}},[u.icon??"",t("span",{},u.label)]):t("hr")));document.body.appendChild(o);let a=n.getBoundingClientRect(),i=o.offsetWidth,s=o.offsetHeight;o.style.top=`${a.bottom+6+s>window.innerHeight-8&&a.top-6-s>8?a.top-6-s:a.bottom+6}px`,o.style.left=`${Math.max(8,Math.min(a.right-i,window.innerWidth-i-8))}px`;let l=u=>{!o.contains(u.target)&&!n.contains(u.target)&&p()},d=u=>{if(u.key==="Escape"||u.key==="Tab")return p();let x=[...o.querySelectorAll("button:not([disabled])")];if(!x.length||!["ArrowDown","ArrowUp","Home","End"].includes(u.key))return;u.preventDefault();let $=x.indexOf(document.activeElement),h=u.key==="Home"?0:u.key==="End"?x.length-1:u.key==="ArrowDown"?($+1)%x.length:($-1+x.length)%x.length;x[h].focus({preventScroll:!0})},c=$e(p);o.dlAnchor=n,o.dlClose=p;function p(){o.remove(),c(),document.removeEventListener("mousedown",l,!0),document.removeEventListener("keydown",d,!0),window.removeEventListener("scroll",p,!0)}setTimeout(()=>{document.addEventListener("mousedown",l,!0),document.addEventListener("keydown",d,!0),window.addEventListener("scroll",p,!0)}),o.querySelector("button")?.focus({preventScroll:!0})}var dt=null,Je=null,qn=0;function vt(){dt&&(dt.style.display="none"),Je=null,clearInterval(qn),qn=0}function me(n,e){let r=o=>{dt??(dt=document.body.appendChild(t("div",{class:"dl-tip dl-tip-float dl-root"}))),dt.replaceChildren(...e().map(a=>typeof a=="string"?document.createTextNode(a):a)),dt.style.display="",dt.style.left=`${o.clientX}px`,dt.style.top=`${o.clientY-10}px`,Je=n,qn||(qn=window.setInterval(()=>{(!Je?.isConnected||!Je.getClientRects().length)&&vt()},400))};n.addEventListener("mouseenter",r),n.addEventListener("mousemove",r),n.addEventListener("mouseleave",vt),n.addEventListener("pointerup",o=>{o.pointerType!=="mouse"&&(Je===n?vt():r(o))})}$e(vt);window.addEventListener("scroll",()=>Je&&vt(),{capture:!0,passive:!0});document.addEventListener("pointerdown",n=>{Je&&!Je.contains(n.target)&&vt()},!0);function ee(n){if(!n||n<0)return"0 B";let e=["B","KB","MB","GB","TB"],r=0,o=n;for(;o>=1024&&r<e.length-1;)o/=1024,r++;return`${o>=100||r===0?Math.round(o):o.toFixed(1)} ${e[r]}`}function Oe(n){let e=n*8;return e<1e3?`${Math.round(e)} bit/s`:e<1e6?`${(e/1e3).toFixed(e<1e4?1:0)} kbit/s`:e<1e9?`${(e/1e6).toFixed(e<1e7?1:0)} Mbit/s`:`${(e/1e9).toFixed(1)} Gbit/s`}function re(n,e=Date.now()/1e3){if(!n)return"never";let r=Math.max(0,Math.round(e-n));return r<60?"just now":r<3600?`${Math.floor(r/60)} min ago`:r<86400?`${Math.floor(r/3600)} h ago`:r<86400*30?`${Math.floor(r/86400)} d ago`:new Date(n*1e3).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function xt(n){if(!n||n<0)return"—";let e=Math.floor(n/86400),r=Math.floor(n%86400/3600),o=Math.floor(n%3600/60);return e?`${e}d ${r}h`:r?`${r}h ${o}m`:`${o}m`}function zt(n){let e=new Date(n*1e3),r=new Date,o=e.toDateString()===r.toDateString(),a=e.toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"});return o?a:`${e.toLocaleDateString("en-GB",{day:"numeric",month:"short"})} ${a}`}function je(n){return`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,"0")}-${String(n.getDate()).padStart(2,"0")}`}function wt(n){let[e,r,o]=n.split("-").map(Number);return new Date(e,(r||1)-1,o||1,12)}function Ue(n){return(typeof n=="string"?/^\d{4}-\d{2}-\d{2}$/.test(n)?wt(n):new Date(n):n).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function Me(n){return n?Ue(n):""}function Kn(n,e){let r=o=>{let[a,i,s]=o.split("-").map(Number);return Date.UTC(a,i-1,s)};return Math.round((r(n)-r(e))/864e5)}function Ht(n,e){let r=wt(n);return r.setDate(r.getDate()+e),je(r)}function bt(n,e){let[r,o,a]=n.split("-").map(Number),i=new Date(r,o-1+e,1,12),s=new Date(i.getFullYear(),i.getMonth()+1,0).getDate();return i.setDate(Math.min(a,s)),je(i)}function Ie(n){return n?.length?n[n.length-1].day:je(new Date)}function zo(n,e,r,o,a=30){let i=n||o;return e==="day"?Ht(i,r):e==="week"?Ht(i,7*r):e==="month"?bt(i,r):e==="year"?bt(i,12*r):Ht(i,a*r)}function Ye(n,e=Date.now()){if(!n)return null;let r=typeof e=="number"?je(new Date(e)):e,o=Kn(n,r);return o>=0?o+1:o}function Ze(n,e){return e!=null&&e>0&&n.expire_warn>0&&e<=n.expire_warn}function en(n){return n<=1?"ends today":n===2?"ends tomorrow":`ends in ${n} days`}function tn(n,e,r=`${e}s`){return`${n.toLocaleString("en-GB")} ${n===1?e:r}`}function Nt(n){return n<1024?`${n} B`:n<1048576?`${(n/1024).toFixed(n<10240?1:0)} KB`:`${(n/1048576).toFixed(1)} MB`}var ct={lan:"Home network",internet:"Internet",both:"Home network + Internet"};var No=["computer","phone","tablet","router","other"],Qe={computer:"PC",phone:"Phone",tablet:"Tablet",router:"Router",other:"Other"},Ro={active:"Active",paused:"Paused",expired:"Expired",quota:"Data limit reached",hours:"Outside allowed hours",no_server:"No server",server_off:"Server is turned off"};function He(n){let e=n.trim().split(/\s+/).filter(Boolean);if(!e.length)return"?";let r=e[0][0]??"",o=e.length>1?e[e.length-1][0]??"":e[0][1]??"";return(r+o).toUpperCase()}function nn(n){let e=r=>r.disabled?3:r.online?0:r.handshake?1:2;return n.map((r,o)=>[r,o]).sort((r,o)=>e(r[0])-e(o[0])||r[1]-o[1]).map(([r])=>r)}function Ee(n,e,r){return t("span",{class:`dl-pill ${n}`,title:r??null},e)}function Pi(n){return n.state==="active"?"ok":n.state==="quota"||n.state==="expired"?"bad":"warn"}function Di(n){return n.state==="server_off"&&n.paused?"paused":n.state}function Io(n){let e=Di(n);return e==="active"||e==="server_off"?"":Ee(Pi({...n,state:e}),Ro[e])}function Bo(n){let e=n.access==="both"?["lan","inet"]:n.access==="lan"?["lan"]:["inet"],r=t("span",{class:"dl-access","aria-label":ct[n.access]},e.map(o=>t("span",{class:`dl-ibadge ${o}`},b(o==="lan"?"home":"globe"))));return me(r,()=>[t("div",{class:"dl-tip-title"},ct[n.access]),n.access==="lan"&&n.services?.length?t("div",{class:"dl-muted"},`${n.services.length} home service${n.services.length===1?"":"s"} only`):""]),r}var Ai={paused:"Paused",expired:"Access ended",quota:"Data limit",hours:"Outside hours",server_off:"Server off",no_server:"No server"};function on(n,e,r="Not set up yet",o){let a=n.handshake?`Last seen ${re(n.handshake,e)} · ${new Date(n.handshake*1e3).toLocaleString()}`:"";if(n.disabled)return t("span",{class:"dl-dstat",title:a},"Disabled");if(n.online)return t("span",{class:"dl-dstat ok"},"Connected");let i=o&&Ai[o.state];return i?t("span",{class:"dl-dstat warn",title:a||"Not connected yet"},i):n.handshake?t("span",{class:"dl-dstat",title:new Date(n.handshake*1e3).toLocaleString()},`Last seen ${re(n.handshake,e)}`):t("span",{class:"dl-dstat warn",title:"Waiting for the first connection"},r)}var rn=null;function Oo(n,e,r,o){rn?.close();let a=t("aside",{class:"dl-drawer",role:"dialog","aria-modal":"true"},[t("div",{class:"dl-drawer-head"},[n,t("button",{type:"button",class:"dl-drawer-x","aria-label":"Close",click:()=>c()},b("x"))]),t("div",{class:"dl-drawer-body"},e),r?t("div",{class:"dl-drawer-foot"},r):""]),i=t("div",{class:"dl-drawer-overlay dl-root",click:u=>{u.target===i&&c()}},a),s=u=>{u.key==="Escape"&&!document.body.classList.contains("modal-overlay-active")&&c()},l=!1,d=$e(()=>c());function c(){l||(l=!0,d(),document.removeEventListener("keydown",s),i.classList.remove("open"),setTimeout(()=>i.remove(),220),rn===p&&(rn=null),o())}let p={close:c,panel:a};return document.addEventListener("keydown",s),document.body.appendChild(i),requestAnimationFrame(()=>i.classList.add("open")),rn=p,p}function ce(n,e,r){return t("div",{class:"dl-setrow"},[t("div",{class:"dl-stack"},[t("span",{class:"dl-setrow-label"},n),r?t("span",{class:"dl-sub"},r):""]),t("div",{class:"dl-setrow-ctl"},e)])}function he(n,e,r,o=e){let a=ce(n,o," "),i=a.querySelector(".dl-sub"),s=()=>{let l=r();i.textContent=l.text,i.classList.toggle("bad",l.bad),e.classList.toggle("cbi-input-invalid",l.bad)};return e.addEventListener("input",s),a.refresh=s,a.help=r,s(),a}function ye(n,e,r,o=e){let a=t("div",{class:"dl-sub"}),i=t("div",{class:"cbi-value dl-live"},[t("div",{class:"cbi-value-title"},[t("label",{},n),a]),t("div",{class:"cbi-value-field"},o)]),s=()=>{let l=r();a.textContent=l.text,a.classList.toggle("bad",l.bad),e.classList.toggle("cbi-input-invalid",l.bad)};return e.addEventListener("input",s),e.addEventListener("change",s),i.refresh=s,i.help=r,s(),i}function ze(n,e=[]){for(let r of n){let o=r.help?.();if(o?.bad)return o.text}for(let r of e){let o=r();if(o.bad)return o.text}return null}function Rt(n,e,r,o=""){return t("section",{class:`dl-setsec ${o}`},[t("div",{class:"dl-setsec-body"},[n?t("h3",{},n):"",...e]),r.length?t("div",{class:"dl-setsec-foot"},r):""])}function fe(n,e,r,o){return t("div",{class:"dl-group"},[t("div",{class:"dl-group-head"},[t("span",{class:"dl-group-ic"},b(n)),t("span",{class:"dl-stack"},[t("b",{},e),r?t("span",{class:"dl-sub"},r):""])]),t("div",{class:"dl-group-body"},o.filter(a=>a!==""))])}function Xe(n,e,r,o,a){return t("div",{class:`dl-row dl-need-row ${e}`},[e?t("span",{class:"dl-need-ic"},b(n)):b(n),t("span",{class:"dl-row-main dl-stack"},[t("b",{},r),t("span",{class:"dl-sub"},o)]),a])}function pt(n,e){let r={ok:"success",warn:"warning",error:"error",info:"notice"}[n];return t("div",{class:`alert-message ${r}`},e)}function et(n,e=""){let r=t("div",{class:e});return r.innerHTML=n,r}function Vn(n){let e=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\/(\d{1,2})$/.exec(n.trim());if(!e)return null;let[r,o,a,i]=e.slice(1,5).map(Number),s=Number(e[5]);if([r,o,a,i].some(c=>c>255)||s<8||s>30)return null;let l=r*2**24+o*2**16+a*2**8+i,d=2**(32-s);return{net:l-l%d,size:d}}var Hi=(n,e)=>n.net<e.net+e.size&&e.net<n.net+n.size,zi=["10.0.0.0/8","172.16.0.0/12","192.168.0.0/16"].map(n=>Vn(n));function $t(n){return n.split("/")[0].split(".").slice(0,3).join(".")}function an(n){return`${n.trim()}.0/24`}function Yn(n,e,r){let o=n.trim(),a=/^\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(o)?Vn(an(o)):null;if(!a)return{text:"Three numbers, like 10.77.0.",bad:!0};if(!zi.some(s=>a.net>=s.net&&a.net+a.size<=s.net+s.size))return{text:"Use a private range: 10.x.x, 172.16–31.x or 192.168.x.",bad:!0};let i=e.find(s=>{let l=Vn(s.cidr);return l!=null&&Hi(a,l)});if(i){let s=i.cidr.endsWith("/24")?`${$t(i.cidr)}.x`:i.cidr,l=r&&r!==o?` Try ${r}.`:"";return{text:`${i.name} already uses ${s}.${l}`,bad:!0}}return{text:`Devices get ${o}.2 – ${o}.254, the router ${o}.1.`,bad:!1}}var Uo=(n,e)=>e.find(r=>r.from<=n&&n<=r.to)?.who??null,Ni=n=>Number.isInteger(n)&&n>=1&&n<=65535;function It(n,e,r){if(!Ni(n))return{text:"Use a port from 1 to 65535.",bad:!0};let o=Uo(n,e);return o?{text:`Used by ${o}. Choose another port.`,bad:!0}:{text:r,bad:!1}}function sn(n,e,r){let o=r?`HTTPS here, plain HTTP for links on IP addresses on ${n+1}.`:"HTTPS on this port, opened on WAN.",a=It(n,e,o);if(a.bad||!r)return a;if(n===65535)return{text:"Links on IP addresses also need the next port: choose a lower one.",bad:!0};let i=Uo(n+1,e);return i?{text:`Links on IP addresses also need ${n+1}, used by ${i}. Choose another port.`,bad:!0}:a}var yt=n=>Array.from(n).length,jo=48,Ri=/[<>"\\\u0000-\u001f\u007f]/;function _e(n,e=[],r=""){let o=n.trim();return o?yt(n)>jo?{text:`Up to ${jo} characters (${yt(n)} now).`,bad:!0}:Ri.test(n)?{text:'Names can’t contain < > " or \\.',bad:!0}:e.some(a=>a.toLowerCase()===o.toLowerCase())?{text:`“${o}” already exists — pick another name.`,bad:!0}:{text:r,bad:!1}:{text:"Enter a name.",bad:!0}}function Go(n,e=[]){return yt(n)>32?{text:`Up to 32 characters (${yt(n)} now).`,bad:!0}:_e(n,e,"Shown on the person cards.")}var Ii=/^[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/,Bi=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function Ct(n){let e=Bi.exec(n);return!!e&&e.slice(1).every(r=>Number(r)<=255)}function Jn(n){return/^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$/.test(n)&&!/:::/.test(n)}function kt(n,e,r=null){let o=n.trim();if(!o)return r!=null?{text:r,bad:!1}:{text:"Enter a hostname or IP address.",bad:!0};if(/^[a-z]+:\/\//i.test(o))return{text:"Leave out https:// — just the name.",bad:!0};if(/\/.*/.test(o))return{text:"Just the name, without a path.",bad:!0};if(/^[^:\[]+:\d+$/.test(o))return{text:"Just the name, without a port (the port is on AmneziaWG).",bad:!0};if(/\s/.test(o))return{text:"A hostname has no spaces.",bad:!0};if(o.length>253||!(Ii.test(o)||Ct(o)||Jn(o)))return{text:"Use a hostname or an IP address.",bad:!0};let a=Jn(o)?`[${o}]`:o;return{text:e?`Devices connect to ${a}:${e}.`:`Links use ${a}.`,bad:!1}}function Wo(n,e){let r=n.split(/[ ,]+/).filter(Boolean);if(!r.length)return{text:`This router (${e}): queries go where your home network sends them, and home names work.`,bad:!1};let o=r.find(a=>!Ct(a)&&!Jn(a));return o?{text:`“${o}” is not an IP address. Separate several with commas.`,bad:!0}:{text:`Devices use ${r.join(" and ")} — home names and your LAN’s DNS filters no longer apply to them.`,bad:!1}}function Fo(n,e){let r=n.trim();if(!r)return{text:`Automatic by device type and disguise: ${e.computer} for computers and routers, ${e.phone} for phones and tablets.`,bad:!1};if(!/^\d{1,4}$/.test(r)||Number(r)<1280||Number(r)>1500)return{text:"MTU must be 1280–1500, or empty for automatic.",bad:!0};let o=Number(r);return{text:`Computers and routers get ${o}, phones and tablets ${Math.min(o,1280)}.`,bad:!1}}function qo(n){let e=n.trim();return e?!/^\d{1,3}$/.test(e)||Number(e)>600?{text:"Use 0–600 seconds.",bad:!0}:Number(e)===0?{text:"Off: NAT may close the tunnel when idle, and “Connected” lags.",bad:!1}:{text:`Devices send a packet every ${e} s to keep NAT open (a little battery on phones).`,bad:!1}:{text:"Default: a packet every 25 s keeps NAT open and “Connected” accurate.",bad:!1}}function ln(n,e=0){let r=n.trim();if(!/^\d{1,2}$/.test(r)||Number(r)<1||Number(r)>32)return{text:"Use 1–32.",bad:!0};let o=Number(r);return e>o?{text:`Already has ${e} devices: remove ${e-o===1?"one":`${e-o}`} first, or allow more.`,bad:!0}:{text:`They can add ${o} device${o===1?"":"s"} themselves.`,bad:!1}}function dn(n,e=!0){let r=n.trim();if(!r)return{text:"Optional. No data limit.",bad:!1};let o=Number(r);return!/^\d+(\.\d+)?$/.test(r)||o<0||o>1e5?{text:"A number of GB, up to 100000.",bad:!0}:o===0?{text:"Optional. No data limit.",bad:!1}:{text:e?`Paused after ${r} GB this month, resumed on the 1st.`:`Paused after ${r} GB in total.`,bad:!1}}function Ko(n,e,r,o){let a=n.trim();if(!a)return{text:"Optional. No end date.",bad:!1};let i=r(a,e);return i==null?{text:"Use a date.",bad:!0}:i<0?{text:"That date has passed: access would end at once.",bad:!0}:{text:i===1?`Access ends today (${o(a)}).`:`Access ends in ${i} days (${o(a)}).`,bad:!1}}function Vo(n,e=null){let r=n.trim();return r?Ct(r)?e&&!e(r)?{text:`${r} is not in any home network of this server: nobody would reach it.`,bad:!1}:{text:"",bad:!1}:{text:"Use an IPv4 address, like 192.168.1.10.",bad:!0}:{text:"The device’s address at home.",bad:!0}}function Jo(n){let e=n.split(/[ ,]+/).filter(Boolean);if(!e.length)return{text:"All ports.",bad:!1};let r=e.find(o=>!/^\d{1,5}$/.test(o)||Number(o)<1||Number(o)>65535);return r?{text:`“${r}” is not a port (1–65535).`,bad:!0}:{text:`Port${e.length===1?"":"s"} ${e.join(", ")}.`,bad:!1}}function Yo(n){let e=n.trim();return e?/^https?:\/\//i.test(e)?e.length>300||!/^https?:\/\/[A-Za-z0-9.-]+(:[0-9]+)?(\/[^\s"'<>]*)?$/.test(e)?{text:"Not a usable address (no spaces or quotes).",bad:!0}:{text:"Wrong links are sent there instead of a “Not found”.",bad:!1}:{text:"Must start with http:// or https://.",bad:!0}:{text:"Wrong links get a bare “Not found”.",bad:!1}}function Zo(n){return yt(n)>64?{text:`Up to 64 characters (${yt(n)} now).`,bad:!0}:/[\u0000-\u001f\u007f]/.test(n)?{text:"One line, please.",bad:!0}:{text:"Shown in the browser tab and at the top of the portal.",bad:!1}}function Qo(n,e="phone.myata"){let r=n.trim();return r?/^[a-z0-9-]{1,32}(\.[a-z0-9-]{1,32})*$/.test(r)?{text:`Devices get names like ${e}.${r}.`,bad:!1}:{text:/[A-Z]/.test(r)?"Lowercase only.":"Lowercase letters, digits, dashes and dots.",bad:!0}:{text:`The default, lan: devices get names like ${e}.lan.`,bad:!1}}function Xo(n){let e=n.trim();return e?Ct(e)?{text:`${e} takes over when the tunnel is down.`,bad:!1}:{text:"Use an IPv4 address, or leave it empty.",bad:!0}:{text:"None: without the tunnel those devices have no DNS.",bad:!1}}function er(n){let e=n.trim();return/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/.test(e)?{text:`Runs within an hour after ${e} (router time).`,bad:!1}:{text:"Use HH:MM, 00:00–23:59.",bad:!0}}function Zn(n,e,r,o={}){let a=0,i="",s=null;return{help:()=>{let{host:c,port:p}=n(),u=kt(c,p,o.empty??null);if(u.bad||!c.trim())return u;if(s&&s.host===c.trim())return{text:s.text,bad:s.bad};let x=o.idle?.();return{text:x?`${x} Checking where it points…`:`${u.text} Checking where it points…`,bad:!1}},schedule:()=>{let{host:c}=n(),p=kt(c,n().port,o.empty??null);p.bad||!c.trim()||c.trim()===s?.host||(clearTimeout(a),a=window.setTimeout(async()=>{let u=c.trim();i=u;try{let{id:x,port:$}=n(),h=await e(u,x,$);if(i!==u)return;s={host:u,text:h.text,bad:h.status==="error"}}catch{if(i!==u)return;s={host:u,text:p.text,bad:!1}}r()},700))}}}var ir=Ei(rr(),1),Oi=n=>`<path d="M14 38a18 18 0 0 1 36 0z" fill="${n}"/><rect x="12" y="43" width="40" height="4" rx="2" fill="${n}" opacity=".5"/>`,ar="#0a0a0a",Qn="#f2f2f2",ji=n=>n.length>300,Et=n=>+n.toFixed(2);function Xn(n,e,r,o,a){return`M${Et(n+a)} ${Et(e)}h${Et(r-2*a)}a${a} ${a} 0 0 1 ${a} ${a}v${Et(o-2*a)}a${a} ${a} 0 0 1 -${a} ${a}h-${Et(r-2*a)}a${a} ${a} 0 0 1 -${a} -${a}v-${Et(o-2*a)}a${a} ${a} 0 0 1 ${a} -${a}z`}function Lt(n,e=3,r=!0,o="plain"){let a=ji(n),i=o==="night",s=(0,ir.default)(0,a?"L":"H");s.addData(n,"Byte"),s.make();let l=s.getModuleCount(),d=l+e*2,c=r&&!a?Math.round(l*.22):0;c&&(l-c)%2&&c++;let p=(l-c)/2,u=p+c,x=(w,v)=>c>0&&w>=p&&w<u&&v>=p&&v<u,$=(w,v)=>i&&(v<7&&w<7||v<7&&w>=l-7||v>=l-7&&w<7),h="";if(i){let w=a?.48:.42;for(let v=0;v<l;v++)for(let y=0;y<l;y++)s.isDark(v,y)&&!x(y,v)&&!$(y,v)&&(h+=`M${y+e+.5-w} ${v+e+.5}a${w} ${w} 0 1 0 ${2*w} 0a${w} ${w} 0 1 0 -${2*w} 0z`)}else for(let w=0;w<l;w++){let v=0;for(;v<l;){if(!s.isDark(w,v)||x(v,w)){v++;continue}let y=1;for(;v+y<l&&s.isDark(w,v+y)&&!x(v+y,w);)y++;h+=`M${v+e} ${w+e}h${y}v1h-${y}z`,v+=y}}let m="";if(i)for(let[w,v]of[[e,e],[e+l-7,e],[e,e+l-7]])m+=Xn(w,v,7,7,2.6)+Xn(w+1,v+1,5,5,1.8)+Xn(w+2,v+2,3,3,1.5);let C="";if(c){let v=c-1.2,y=p+e+.6;C=`<rect x="${y}" y="${y}" width="${v}" height="${v}" rx="${v*(i?.28:.25)}" fill="${i?Qn:"#0a0a0a"}"/><g transform="translate(${y} ${y}) scale(${v/64})">${Oi(i?ar:"#fff")}</g>`}let B=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${d} ${d}" role="img" aria-label="QR code">`;return i?`${B}<rect width="${d}" height="${d}" fill="${ar}"/><path d="${h}" fill="${Qn}"/><path d="${m}" fill="${Qn}" fill-rule="evenodd"/>${C}</svg>`:`${B}<rect width="${d}" height="${d}" fill="#fff"/><path d="${h}" fill="#000" shape-rendering="crispEdges"/>${C}</svg>`}var Ui={connect:"connections",disconnect:"connections",roam:"connections",device_added:"people",device_removed:"people",devices_removed:"people",device_changed:"people",device_keys:"people",link_changed:"people",person_added:"people",person_removed:"people",person_changed:"people",paused:"people",resumed:"people",expiring:"people",expired_kept:"people",portal_blocked:"problems"},Mt=["connections","people","problems"],ut={connections:"Connections",people:"People",problems:"Problems"},sr={connections:"Connects, disconnects and IP changes",people:"People and their devices added, changed, paused, removed",problems:"Blocked portal sign-ins (tunnels and services are in the service log)"},Bt=n=>Ui[n]??"problems",Ot={awg:"AmneziaWG",dawnline:"Dawnline",portal:"Portal"},Gi=["person_added","person_removed","person_changed"];function Ne(n){return n.by?n.by:Gi.includes(n.type)||n.detail==="by admin"||n.detail?.endsWith(" (admin)")?"admin":n.detail?.endsWith(" (portal)")?"portal":null}function lr(n){return(n.detail??"").replace(/ \((admin|portal)\)$/,"").replace(/^by admin$/,"")}var cn=n=>n.sys?["error","repair","down"].includes(n.sys.level):Bt(n.ev.type)==="problems";function pn(n){let e=n.keep_days>0?`${n.keep_days} day${n.keep_days===1?"":"s"}`:"no age limit",r=n.persist==="off"?"kept in memory only (lost on reboot)":`saved to flash ${n.persist==="10min"?"every 10 minutes":"hourly"}`;return`Kept for ${e}, up to ${n.max.toLocaleString("en-GB")} events, ${r}.`}function dr(n,e=120,r=26,o=je(new Date)){let a=Math.max(1,...n),i=t("div",{class:"dl-spark"});return i.style.width=`${e}px`,i.style.height=`${r}px`,n.forEach((s,l)=>{let d=t("i");d.style.height=`${Math.max(6,s/a*100)}%`,s||d.classList.add("zero");let c=n.length-1-l;me(d,()=>[t("div",{class:"dl-tip-title"},c===0?"Today":c===1?"Yesterday":wt(Ht(o,-c)).toLocaleDateString("en-GB",{weekday:"short",day:"numeric",month:"short"})),t("div",{class:"dl-muted"},ee(s))]),i.appendChild(d)}),i}function Wi(n){let e=n==null?"":String(n);return/^[=+\-@\t\r]/.test(e)&&(e=`'${e}`),/[",\r\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e}function cr(n,e){return[n.join(","),...e.map(r=>n.map(o=>Wi(r[o])).join(","))].join(`
`)}function Fi(n){let e=new Map(n.people.map(o=>[o.id,o.name])),r=new Map(n.people.flatMap(o=>o.devices.map(a=>[a.id,a.name])));return{people:e,devices:r}}function Fe(n,e,r,o="",a=[]){let i=Fi(n),s=[...e.map(p=>({ts:p.ts,category:Bt(p.type),type:p.type,person:p.person?i.people.get(p.person)??p.pname??p.person:"",device:p.device?i.devices.get(p.device)??p.dname??p.device:"",detail:p.detail??"",where:p.where??"",by:Ne(p)??""})),...a.map(p=>({ts:p.ts,category:"system",type:`${p.src}.${p.level}`,person:"",device:"",detail:`${p.who?`${p.who} `:""}${p.msg}${p.detail?`
${p.detail}`:""}`,where:Ot[p.src]??p.src,by:""}))].sort((p,u)=>p.ts-u.ts).map(({ts:p,...u})=>({time:new Date(p*1e3).toISOString(),...u})),l=new Date().toISOString().slice(0,10),d=`dawnline-activity${o?`-${o}`:""}-${l}.${r}`;if(r==="json"){Te(d,JSON.stringify(s,null,2),"application/json");return}Te(d,cr(["time","category","type","person","device","detail","where","by"],s),"text/csv")}var qi=[["","Everything"],["7","Older than 7 days"],["30","Older than 30 days"],["90","Older than 90 days"]],pr=n=>n?`${n} event${n===1?"":"s"} removed`:"Nothing matched";function tt(n,e,r,o,a,i=!1){let s=t("select",{class:"cbi-input-select"},[t("option",{value:""},"All categories"),...Mt.map(d=>t("option",{value:d,selected:d===a?"selected":null},ut[d])),i?t("option",{value:"system",selected:a==="system"?"selected":null},"System"):""]),l=t("select",{class:"cbi-input-select"},qi.map(([d,c])=>t("option",{value:d},c)));oe(n,[t("p",{class:"dl-muted"},`${e} This cannot be undone; export first if you want a copy.`),t("label",{class:"dl-fld"},[t("span",{class:"dl-fld-label"},"Category"),s]),t("label",{class:"dl-fld"},[t("span",{class:"dl-fld-label"},"Which events"),l])],[ie()," ",H("Clear",async()=>{let d=0;if(s.value!=="system")try{d+=(await A.logsClear({...r,category:s.value,older_days:l.value})).removed}catch(c){U(be(c),"error",1e4);return}if(i&&(s.value==="system"||s.value===""))try{d+=(await A.serviceLogClear(l.value)).removed}catch(c){ae(),U(`${s.value==="system"?"":`Activity: ${pr(d).toLowerCase()}. `}The service log was not cleared: ${be(c)}`,"error",1e4),o();return}ae(),U(pr(d),"success",3e3),o()},"negative")])}function St(n,e,r,o){let a=n==="device"?`Clears ${r}'s daily and monthly traffic history. Their person's totals and data limit are not changed.`:n==="person"?`Clears ${r}'s traffic history and that of their devices. Their data limit starts again from zero.`:"Clears traffic history for everyone. Data limits start again from zero.";oe(n==="all"?"Reset all traffic history?":`Reset traffic history for ${r}?`,[t("p",{class:"dl-muted"},a)],[ie()," ",H("Reset",async()=>{await G(()=>A.usageClear(n,e),"Traffic history reset")&&(ae(),o())},"negative")])}function ve(n,e,r){let o=t("button",{type:"button",role:"switch",class:`dl-switch${n?" on":""}`,"aria-checked":n?"true":"false","aria-label":e,click:()=>{let a=!o.classList.contains("on");eo(o,a),r?.(a)}},t("i"));return o}function eo(n,e){n.classList.toggle("on",e),n.setAttribute("aria-checked",e?"true":"false")}var Pe=n=>n.classList.contains("on");function we(n,e,r={}){n.some(([i])=>i===e)||(n=[...n,[e,e]]);let o=t("div",{class:`dl-seg${r.cls?` ${r.cls}`:""}`,role:"radiogroup","aria-label":r.label??null,"data-value":e}),a=()=>o.querySelectorAll(":scope > button").forEach(i=>{let s=i.dataset.v===o.dataset.value;i.classList.toggle("on",s),i.setAttribute("aria-checked",s?"true":"false")});for(let[i,s]of n)o.appendChild(t("button",{type:"button",role:"radio","data-v":i,click:()=>{i!==o.dataset.value&&(r.optimistic!==!1&&(o.dataset.value=i,a()),r.onChange?.(i))}},s));return a(),o}function qe(n,e,r,o={}){return t("button",{type:"button",...o,class:`dl-chipbtn${e?" on":""}${o.class?` ${o.class}`:""}`,"aria-pressed":e?"true":"false",click:r},n)}function un(n,e){n.classList.toggle("on",e),n.setAttribute("aria-pressed",e?"true":"false")}function se(n,e={}){return t("input",{type:"text",class:"cbi-input-text",value:n,...e})}var Ki={jc:"0",jmin:"0",jmax:"0",s1:"0",s2:"0",s3:"0",s4:"0",h1:"1",h2:"2",h3:"3",h4:"4",i1:"",i2:"",i3:"",i4:"",i5:""},Vi={header_protection_key:"HeaderProtectionKey",content_padding_addition:"ContentPaddingAddition",rekey_after_time:"RekeyAfterTime",rekey_timeout:"RekeyTimeout",reject_after_time:"RejectAfterTime",keepalive_timeout:"KeepaliveTimeout",max_handshake_attempts:"MaxHandshakeAttempts",random_trailers:"RandomTrailers",disable_cookies:"DisableCookies"};function Ji(n){let e={};for(let[r,o]of Object.entries(Vi))n[r]!=null&&n[r]!==""&&(e[o]=String(n[r]));return e}function Yi(n,e){let r=n.amnezia,o=r.obfuscation??{},a=d=>o[d]!=null&&o[d]!==""?String(o[d]):Ki[d],i=r.host.replace(/^\[(.*)\]$/,"$1"),s={H1:a("h1"),H2:a("h2"),H3:a("h3"),H4:a("h4"),I1:a("i1"),I2:a("i2"),I3:a("i3"),I4:a("i4"),I5:a("i5"),Jc:a("jc"),Jmin:a("jmin"),Jmax:a("jmax"),S1:a("s1"),S2:a("s2"),S3:a("s3"),S4:a("s4"),...Ji(o),allowed_ips:r.allowed_ips,client_ip:r.client_ip,client_priv_key:r.client_priv_key,client_pub_key:r.client_pub_key,config:n.conf.replace(/\r?\n/g,`\r
`),hostName:i,mtu:r.mtu,persistent_keep_alive:r.persistent_keep_alive,port:Number(r.port),psk_key:r.psk_key,server_pub_key:r.server_pub_key},l={containers:[{container:"amnezia-awg",awg:{isThirdPartyConfig:!0,last_config:JSON.stringify(s),port:String(r.port),protocol_version:o.header_protection_key?"3.1":"2",transport_proto:"udp"}}],defaultContainer:"amnezia-awg",description:e,hostName:i};return r.dns[0]&&(l.dns1=r.dns[0]),r.dns[1]&&(l.dns2=r.dns[1]),l}function Zi(n){let e="";for(let r=0;r<n.length;r+=32768)e+=String.fromCharCode(...n.subarray(r,r+32768));return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Qi(n){let e=globalThis;if(typeof e.CompressionStream>"u")return null;try{let r=new e.Blob([n]).stream().pipeThrough(new e.CompressionStream("deflate")),o=new Uint8Array(await new e.Response(r).arrayBuffer()),a=new Uint8Array(4+o.length);return new DataView(a.buffer).setUint32(0,n.length,!1),a.set(o,4),a}catch{return null}}async function to(n,e,r=!0){let o=new TextEncoder().encode(JSON.stringify(Yi(n,e))),a=r?await Qi(o):null;return`vpn://${Zi(a??o)}`}var mr=[{id:"off",title:"Off",ic:"zap",stealth:0,speed:4,text:"Plain WireGuard-compatible traffic. Fastest, but easy to recognise and block.",apps:"Any WireGuard app",short:"Any WireGuard app"},{id:"balanced",title:"Balanced",ic:"shield",stealth:3,speed:4,needs:"v2",text:"AmneziaWG 2.0: junk packets, padded packets and a first packet that looks like DNS. For networks that learned to spot 1.0-style junk.",apps:"AmneziaVPN 4.8.12 or newer, AmneziaWG 2.0+ apps",short:"AmneziaWG 2.0+ apps"},{id:"max",title:"Maximum",ic:"lock",stealth:4,speed:3,needs:"v3",text:"AmneziaWG 3.1: encrypted packet headers, random tails and sizes, jittered timing, and a first packet that looks like DNS.",apps:"Apps with AmneziaWG 3.1 (current AmneziaVPN)",short:"AmneziaWG 3.1 apps"}],jt=n=>mr.find(e=>e.id===n),mn=n=>n.v3?"max":n.v2?"balanced":"off",Ut=n=>n==="standard"?"Standard (old)":n==="strong"?"Strong (old)":null,Xi={v2:"Needs AmneziaWG 2.0 or newer on the router (kmod-amneziawg and amneziawg-tools from July 2025 on).",v3:"Needs AmneziaWG 3.1 on the router (kmod-amneziawg and amneziawg-tools 3.1)."},es={v2:"Needs AmneziaWG on the router.",v3:"Needs AmneziaWG 3.1 on the router: install it first."};function ur(n,e){return t("span",{class:"dl-dots",title:`${e}: ${n} of 4`},[t("span",{class:"dl-dots-label"},e),t("span",{class:"dl-dots-row"},[0,1,2,3].map(r=>t("i",{class:r<n?"on":""})))])}function hn(n,e,r,o,a=!0){let i=t("div",{class:"dl-methods",role:"radiogroup","aria-label":"Disguise method"}),s=()=>dom.content(i,mr.map(l=>{let d=!l.needs||n[l.needs],c=l.id===e;return t("button",{type:"button",role:"radio","aria-checked":c?"true":"false","aria-disabled":d?null:"true",class:`dl-method${c?" on":""}${d?"":" off"}`,click:()=>{!d||c||(e=l.id,s(),r(l.id))}},[t("div",{class:"dl-method-head"},[t("span",{class:"dl-method-ic"},b(l.ic)),t("b",{},l.title),l.id===o?t("span",{class:"dl-pill ok"},"Current"):""]),t("p",{},l.text),t("div",{class:"dl-method-meters"},[ur(l.stealth,"Stealth"),ur(l.speed,"Speed")]),t("div",{class:"dl-method-foot"},d?[b(l.id==="off"?"wireguard":"amneziawg"),t("span",{},l.apps)]:[b("alert"),t("span",{},(a?Xi:es)[l.needs])])])}));return s(),i}function hr(n,e){return t("div",{class:"dl-corehead"},[t("h3",{},n),e?t("span",{class:"dl-sub"},e):""])}var fr=[["jc","Jc"],["jmin","Jmin"],["jmax","Jmax"],["s1","S1"],["s2","S2"],["s3","S3"],["s4","S4"],["h1","H1"],["h2","H2"],["h3","H3"],["h4","H4"],["i1","I1"],["i2","I2"],["i3","I3"],["i4","I4"],["i5","I5"],["header_protection_key","HeaderProtectionKey"],["content_padding_addition","ContentPaddingAddition"],["rekey_after_time","RekeyAfterTime"],["rekey_timeout","RekeyTimeout"],["reject_after_time","RejectAfterTime"],["keepalive_timeout","KeepaliveTimeout"],["max_handshake_attempts","MaxHandshakeAttempts"],["random_trailers","RandomTrailers"],["disable_cookies","DisableCookies"]];function ts(n){let e=c=>n[c]!=null&&n[c]!=="",r=fr.filter(([c])=>e(c));if(!r.length)return null;let o=(c,p)=>t("span",{class:"dl-pv"},[t("i",{},p),t("b",{},c==="header_protection_key"?`${n[c].slice(0,6)}••••`:n[c])]),a=(c,p,u,x)=>{let $=fr.filter(([h])=>x.includes(h)&&e(h));return $.length?t("div",{class:"dl-pgroup"},[t("div",{class:"dl-pgroup-head"},[b(p),t("b",{},c)]),t("p",{},u),t("div",{class:"dl-pvals"},$.map(([h,m])=>o(h,m)))]):""},i=Number(n.jc||0),s=(n.i1??"").includes("0x8580")?"A first packet shaped like a DNS answer.":"Extra packets sent before the handshake.",l=r.map(([c,p])=>`${p} = ${n[c]}`).join(`
`),d=t("div",{class:"dl-pgrid"},[a("Junk packets","zap",i?`${i} random packet${i===1?"":"s"} of ${n.jmin}–${n.jmax} bytes before each handshake.`:"No junk packets.",["jc","jmin","jmax"]),a("Padding","archive","Random bytes in front of handshake, cookie and data packets, so their sizes do not match WireGuard.",["s1","s2","s3","s4"]),a("Packet types","key","The values that replace WireGuard’s recognisable message types.",["h1","h2","h3","h4"]),a("Signatures","globe",s,["i1","i2","i3","i4","i5"]),a("Protection","lock","AmneziaWG 3.1: encrypted headers, random tails and extra padding on data packets.",["header_protection_key","content_padding_addition","random_trailers","disable_cookies"]),a("Timing","clock","Handshake and key timers vary within these ranges instead of WireGuard’s fixed values.",["rekey_after_time","rekey_timeout","reject_after_time","keepalive_timeout","max_handshake_attempts"])]);return t("details",{class:"dl-params"},[t("summary",{},[b("chevron"),t("span",{},"Current parameters"),t("span",{class:"dl-pcount"},String(r.length)),t("span",{class:"dl-spacer"}),t("button",{type:"button",class:"dl-linkbtn",click:c=>{c.preventDefault(),ue(l,"Parameters copied")}},"Copy as config")]),d])}function gr(n,e){if(/^\s*\[.+\]\s*$/.test(n))return t("span",{class:"dl-conf-sec"},n);let r=/^(\s*[A-Za-z0-9]+\s*=)\s*(.*)$/.exec(n);if(!r)return document.createTextNode(n);let o=/^(\s*)(PrivateKey|PresharedKey)\b/.test(n);return t("span",{},[t("span",{class:"dl-conf-k"},r[1])," ",o&&!e?t("span",{class:"dl-conf-mask"},"••••••••••••••••"):r[2]])}function ns(n){let e=!1,r=t("pre",{class:"dl-conf"}),o=()=>dom.content(r,n.conf.split(`
`).flatMap((s,l)=>l?[`
`,gr(s,e)]:[gr(s,e)])),a=t("button",{type:"button",class:"dl-chipbtn",click:s=>{s.preventDefault(),e=!e,dom.content(a,[b(e?"x":"key"),e?"Hide key":"Show key"]),o()}},[b("key"),"Show key"]);o();let i=new Blob([n.conf]).size;return t("div",{class:"dl-stack gap8"},[t("div",{class:"dl-filecard"},[t("span",{class:"dl-filecard-ic"},".conf"),t("span",{class:"dl-stack"},[t("span",{class:"dl-mono dl-ellipsis"},n.filename),t("span",{class:"dl-sub"},`AmneziaWG · ${i} bytes · import it in the app`)]),H([b("download")," Download"],()=>Te(n.filename,n.conf,"application/octet-stream"),"positive")]),t("details",{class:"dl-params"},[t("summary",{},[b("chevron"),t("span",{},"Configuration"),t("span",{class:"dl-spacer"}),a,t("button",{type:"button",class:"dl-chipbtn",click:s=>{s.preventDefault(),ue(n.conf,"Configuration copied")}},[b("copy"),"Copy"])]),r])])}function no(n){let e=n.amnezia.obfuscation??{},r={h1:"1",h2:"2",h3:"3",h4:"4"};return Object.entries(e).every(([o,a])=>a==null||a===""||a===(r[o]??"0"))}async function os(n,e="file"){if(!n.has_private_key)return t("div",{class:"dl-hint"},"This device generated its own keys in the browser, so its full configuration only exists on that device.");let r=await to(n,`${n.server} · ${n.person} · ${n.name}`),o={qr:()=>t("div",{class:"dl-qr-pane"},[et(Lt(n.conf),"dl-qr"),t("span",{class:"dl-sub"},no(n)?"Scan with AmneziaVPN or any WireGuard app on the device.":"Scan with AmneziaVPN or AmneziaWG on the device.")]),key:()=>t("div",{class:"dl-stack gap8"},[t("div",{class:"dl-linkbox"},[t("span",{class:"dl-mono"},r),H("Copy",()=>ue(r,"Key copied"))]),t("span",{class:"dl-sub"},"AmneziaVPN → Add server → Insert key. Keep it private.")]),file:()=>ns(n)},a=t("div",{class:"dl-connect-body"}),i=t("div",{class:"dl-seg"}),s=l=>{i.querySelectorAll("button").forEach(d=>d.classList.toggle("on",d.dataset.id===l)),dom.content(a,o[l]())};for(let[l,d]of[["file","File"],["key","Key"],["qr","QR code"]])i.appendChild(t("button",{type:"button","data-id":l,click:()=>s(l)},d));return s(e),t("div",{class:"dl-stack gap12"},[i,a])}async function rs(n,e,r,o){let a=jt(r),s=n.st.people.filter(d=>d.server===e.id).reduce((d,c)=>d+c.devices.length,0);await le(o?"Generate new disguise values?":`Switch to ${a.title}?`,`${s} AmneziaWG device${s===1?" stops":"s stop"} connecting until ${s===1?"it imports its":"they import their"} configuration again (from their personal link or from you).${r==="max"?" They need an app with AmneziaWG 3.1.":r==="balanced"?" They need an app with AmneziaWG 2.0 or newer.":""}${n.st.servers.length===1&&s?" To keep the old disguise for some people, add a second server and move them there.":""}`,o?"Generate and apply":"Switch and apply",!0)&&await G(()=>A.serverObfuscation(e.id,r),o?"New values applied":`${a.title} applied`)&&(U("Devices are marked “Update config” until they import again.","info",6e3),await n.refresh())}function as(n,e){let r=n.st,o=se(String(e.port),{inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),a=se(e.mtu?String(e.mtu):"",{placeholder:"Auto",inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),i=se(String(e.keepalive??""),{placeholder:"25",inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),s=jt(e.preset)?e.preset:void 0,l=s??mn(r.awg),d=H("",()=>rs(n,e,l,l===s),"neutral"),c=()=>dom.content(d,l===s?[b("reset")," Generate new values"]:[`Switch to ${jt(l).title}`]);c();let p=r.awg_state?.tools!==!1,u=[],x=he("UDP port",o,()=>It(Number(o.value),u,`Opened on the WAN firewall automatically.${Number(o.value)===4500?" 4500 is IPsec’s port: most networks let it through.":""}`));A.serverPorts(e.id).then(m=>{u=m.udp_taken??[],x.refresh()}).catch(()=>{});let $=he("MTU",a,()=>Fo(a.value,e.mtus)),h=he("Keep-alive",i,()=>qo(i.value));return Rt("",[hr("AmneziaWG",e.ifname),fe("globe","Listening","Where devices reach this core from the internet",[x]),fe("file","In every device configuration","Changing these marks devices “Update config” until they import again",[$,h]),fe("shield","Disguise","So networks that block VPNs do not recognise the tunnel. Off = plain WireGuard",[Ut(e.preset)?pt("warn",[t("b",{},Ut(e.preset))," is AmneziaWG 1.0 junk only, which networks learned to spot; it is not offered any more. Switch to ",t("b",{},"Balanced")," or ",t("b",{},"Maximum"),": devices import their configuration again."]):"",hn(r.awg,l,m=>{l=m,c()},s,p),p&&!r.awg.v3?pt("info",["This router runs an older AmneziaWG. ",t("b",{},"Maximum")," becomes available with kmod-amneziawg and amneziawg-tools 3.1."]):"",ts(e.obf??{})??"",t("div",{class:"dl-row-end"},[t("span",{class:"dl-sub"},"Applies at once: every AmneziaWG device imports its configuration again."),d])]),t("details",{class:"dl-params"},[t("summary",{},[b("chevron"),t("span",{},"Tunnel"),t("span",{class:"dl-pcount"},"3")]),t("div",{class:"dl-params-body"},[ce("Interface",t("span",{class:"dl-mono"},`${e.ifname} · router ${e.address}`)),ce("Tunnel subnet",t("span",{class:"dl-mono"},e.subnet),"Device addresses come from it."),ce("Server public key",t("span",{class:"dl-keyrow"},[t("code",{class:"dl-mono"},e.public_key),H([b("copy")],()=>ue(e.public_key,"Public key copied"),"neutral",{title:"Copy",class:"cbi-button cbi-button-neutral dl-icon-only sm"})]))])])],[t("span",{class:"dl-sub"},"Port, MTU and keep-alive apply at once."),H("Save",()=>{let m=ze([x,$,h]);if(m){U(m,"warning");return}return n.save({port:o.value,mtu:a.value,keepalive:i.value},"AmneziaWG saved")},"positive")])}function is(n){let e=jt(n.preset),r=n.obf??{},o=(s,l)=>t("span",{class:`dl-segs ${l}`},[0,1,2,3].map(d=>t("i",{class:d<s?"on":""}))),a=[];+r.jc&&a.push(`${r.jc} junk · ${r.jmin}–${r.jmax} B`);let i=["s1","s2","s3","s4"].filter(s=>+r[s]).map(s=>`${s.toUpperCase()} ${r[s]}`);return i.length&&a.push(i.slice(0,2).join(" · ")+(i.length>2?` +${i.length-2}`:"")),["h1","h2","h3","h4"].some(s=>r[s]&&r[s]!==String(["h1","h2","h3","h4"].indexOf(s)+1))&&a.push("H1–H4 random"),r.i1&&a.push(/0x(8580|0100)0001/.test(r.i1)?"DNS-like first packets":"Signature packets"),r.header_protection_key&&a.push("Encrypted headers"),a.length||a.push(e?.id==="off"?"Plain WireGuard":"No values yet"),t("div",{class:"dl-bento-tile dl-disg"},[t("div",{class:"dl-bento-head"},[t("span",{class:"dl-metric-label"},"Disguise"),t("a",{href:`${L.url("admin/network/dawnline/server")}?server=${encodeURIComponent(n.id)}&section=awg`},"Change")]),t("div",{class:"dl-disg-id"},[t("span",{class:`dl-disg-ic${e?.id==="off"?" off":""}`},b(e?.ic??"shield")),t("span",{class:"dl-stack"},[t("b",{},e?e.title:Ut(n.preset)??"Custom"),t("span",{class:"dl-sub"},e?e.short:Ut(n.preset)?"Switch to Balanced or Maximum":"Set by hand")])]),e?t("div",{class:"dl-disg-meters"},[t("span",{},"Stealth"),o(e.stealth,"acc"),t("span",{},"Speed"),o(e.speed,"ok")]):"",t("div",{class:"dl-disg-chips"},a.map(s=>t("span",{},s)))])}var oo={id:"awg",label:"AmneziaWG",settingsCard:as,overviewTile:is,connectBlock:os,qrText:n=>n.conf,appKey:{label:"Copy AmneziaVPN key",make:n=>to(n,`${n.server} · ${n.person} · ${n.name}`)},file:{label:"Download .conf",make:n=>({name:n.filename,text:n.conf})}};var ss={awg:oo};function Be(n){return ss[n?.core||"awg"]??oo}function Tt(n,e){return Be(n.find(r=>r.id===e))}var ls=2,Gt=new Set,ro=null,fn=null;async function vr(){if(document.visibilityState!=="visible"||!Gt.size)return;let n=await A.rev().catch(()=>null);if(!n)return;let e=ro!=null&&n.rev!==ro;ro=n.rev,n.version&&(fn&&n.version!==fn?(U(`Dawnline was updated to ${n.version}: reload the page.`,"warning",15e3),fn=null):fn??(fn=n.version)),e&&Gt.forEach(r=>r())}function gn(n){return Gt.add(n),poll.add(vr,ls),()=>{Gt.delete(n),Gt.size||poll.remove(vr)}}function wr(n,e,r,o,a=0){let i=[],s=null,l=p=>{s&&p>s.from&&i.push({...s,to:p}),s=null},d=n.filter(p=>p.device===e).sort((p,u)=>p.ts-u.ts);for(let p of d)if(p.type==="connect")l(p.ts),p.detail&&(s={ip:p.detail,from:p.ts,to:p.ts,live:!1});else if(p.type==="roam"){let u=p.detail?.split("→")[1]?.trim();l(p.ts),u&&(s={ip:u,from:p.ts,to:p.ts,live:!1})}else p.type==="disconnect"&&l(p.ts);let c=s;return c&&o?i.push({...c,to:Math.max(r,c.from),live:!0}):l(Math.min(r,a)),i}function Ke(n){return`${n.city||`${n.lat.toFixed(1)},${n.lon.toFixed(1)}`}|${n.cc}`}function yr(n,e,r,o){let a=new Map;for(let s of e)(s.device===r||!a.has(s.ip))&&a.set(s.ip,s);let i=[];for(let s of n){let l=a.get(s.ip);!l||s.to<=o||i.push({key:Ke(l),point:l,from:Math.max(s.from,o),to:s.to,live:s.live})}return i}function kr(n){let e=new Map,r=0;for(let o of n)e.set(o.key,(e.get(o.key)??0)+(o.to-o.from)),r+=o.to-o.from;return new Map([...e].map(([o,a])=>[o,r?a/r:0]))}function br(n,e=2700){let r=[];for(let o of n){let a=r[r.length-1];if(a&&o.key!==a.key&&!o.live&&o.to-o.from<e){a.short++,a.to=o.to;continue}if(a&&a.key===o.key){a.to=o.to,a.live=o.live;continue}r.push({key:o.key,point:o.point,from:o.from,to:o.to,live:o.live,short:0})}return r}function $r(n,e=24){for(let r of[0,300,900,2700,2*3600,6*3600]){let o=br(n,r);if(o.length-1<=e)return o}return br(n,24*3600)}var io=1600,xr=.12,ao=1.3,Cr=.32;function Er(n,e=io){let r=[],o=0;return n.forEach((a,i)=>{i&&(r.push({kind:"move",k:i,start:o,ms:e}),o+=e);let s=Math.min(1100,Math.max(350,(a.to-a.from)/3600*45));r.push({kind:"stay",k:i,start:o,ms:s}),o+=s}),{steps:r,total:o}}function Lr(n,e,r){let o=e.findIndex(l=>r>=l.start&&r<l.start+l.ms);o<0&&(o=e.length-1);let a=e[o],i=Math.min(1,Math.max(0,(r-a.start)/a.ms)),s=n[a.k];return{i:o,step:a,q:i,t:a.kind==="move"?s.from:s.from+(s.to-s.from)*i}}function Mr(n,e,r){let o=n.findIndex(s=>r>=s.from&&r<s.to);o<0&&(o=r<(n[0]?.from??0)?0:n.length-1);let a=e.find(s=>s.kind==="stay"&&s.k===o),i=n[o];return a.start+a.ms*Math.min(.999,Math.max(0,(r-i.from)/Math.max(1,i.to-i.from)))}var ds=n=>n<=0?0:n>=1?1:n<.5?2*n*n:1-(-2*n+2)**2/2;function Sr(n){return-ao/2+(1+ao)*ds((n-xr)/(1-xr))}var Tr=n=>n+Cr>=1;function _r(n){return["interpolate",["linear"],["abs",["-",["get","pos"],n]],0,1,Cr,1,ao/2,0]}function Pr(n,e){let r=n==="24h"?86400:n==="7d"?604800:2592e3,o=e-r,a=[],i=(l,d)=>{let c=(l-o)/r;c>.02&&c<.98&&a.push([c,d])},s=new Date(o*1e3);if(n==="24h")for(s.setMinutes(0,0,0);s.getTime()/1e3<=e;)s.getHours()%6===0&&i(s.getTime()/1e3,`${String(s.getHours()).padStart(2,"0")}:00`),s.setHours(s.getHours()+1);else if(n==="7d")for(s.setHours(12,0,0,0);s.getTime()/1e3<=e;s.setDate(s.getDate()+1))i(s.getTime()/1e3,s.toLocaleDateString("en-GB",{weekday:"short"}));else{let l=new Date(e*1e3);l.setHours(0,0,0,0);for(let d=0;d<5;d++){let c=new Date(l);c.setDate(l.getDate()-7*d),i(c.getTime()/1e3,c.toLocaleDateString("en-GB",{day:"numeric",month:"short"}))}a.reverse()}return a}var vn=n=>new Date(n*1e3).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"});function Dr(n,e){let r=o=>new Date(o*1e3).toDateString();return r(n)===r(e)?"Today":r(n)===r(e-86400)?"Yesterday":new Date(n*1e3).toLocaleDateString("en-GB",{weekday:"short",day:"numeric",month:"short"})}var so="https://unpkg.com/maplibre-gl@6.14.0/dist",Ar={module:"sha384-q26X6R1yFeg0QR9SHHn6U3Nb0ddRRTtwxsahubv5R89/v5nijKpk9KviUp9ZLySk",css:"sha384-1TZtfVz7qtwR5vD7cMwjGT+9uiK4lqE3pbUOPwYO6OCpb+TYP0S9vLIhG02JCU04"},Hr="https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json",zr="https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",cs={online:0,"24h":86400,"7d":7*86400,"30d":30*86400},Wt=null;function ps(n){if(n.appendChild(t("link",{rel:"stylesheet",href:`${so}/maplibre-gl.css`,integrity:Ar.css,crossorigin:"anonymous"})),Wt)return Wt;let e=`${so}/maplibre-gl.mjs`;return Wt=new Promise((o,a)=>{let i=t("link",{rel:"modulepreload",href:e,integrity:Ar.module,crossorigin:"anonymous"});i.addEventListener("load",()=>o()),i.addEventListener("error",()=>a(new Error("integrity"))),document.head.appendChild(i)}).then(()=>import(e)).then(o=>(o.getWorkerUrl()||o.setWorkerUrl(`${so}/maplibre-gl-worker.mjs`),o),o=>{throw Wt=null,new Error(o?.message==="integrity"?"The map library from the CDN is not the expected file: not loading it.":"Could not load the map library (no internet access from this browser?)")}),Wt}function bn(){let n=document.documentElement.getAttribute("data-darkmode");return n!=null?n==="true":window.matchMedia?.("(prefers-color-scheme: dark)").matches??!1}var us=10,Nr=30,ms=62,hs=4,Rr=4.5,fs=7,xn="#3b82f6",lo="#8a8a8a";function Ir(n,e,r=.2,o=64){let[a,i]=n,[s,l]=e,d=s-a,c=d>180?s-360:d<-180?s+360:s,p=c-a,u=l-i,x=Math.hypot(p,u);if(x===0||r===0)return[n,[c,l]];let $=-u/x,h=p/x,m=x*r,C=(a+c)/2+$*m,B=(i+l)/2+h*m,w=[],v=Math.max(2,Math.floor(o));for(let y=0;y<=v;y+=1){let E=y/v,k=1-E;w.push([k*k*a+2*k*E*C+E*E*c,k*k*i+2*k*E*B+E*E*l])}return w}function co(n,e){let r=new Map;for(let o of n.geo.points){if(n.person&&o.person!==n.person||n.device&&o.device!==n.device||(e==="online"?!o.online:n.now-o.ts>cs[e]))continue;let a=n.device?Ke(o):n.person?`${o.device}|${o.city}|${o.cc}`:o.device,i=r.get(a);(!i||o.online&&!i.online||o.online===i.online&&o.ts>i.ts)&&r.set(a,o)}return[...r.values()]}function po(n,e){let r=0;return co(n,e).sort((o,a)=>Number(a.online)-Number(o.online)||a.ts-o.ts).map(o=>({...o,n:o.online?0:++r}))}var nt=class{constructor(e,r="online",o=380){this.cb=e;this.map=null;this.gl=null;this.markers=[];this.popup=null;this.theme=null;this.resize=null;this.fitBlind=!1;this.data=null;this.fitted=!1;this.fitKey=null;this.people=[];this.slots=[];this.merged=[];this.piles=new Map;this.dock=null;this.dockKey="";this.dockQuiet=!1;this.piledKeys=new Set;this.foldedKeys=new Set;this.targetZoom=null;this.before=null;this.hiddenKey="";this.focused=null;this.dead=!1;this.places=new Map;this.replaying=null;this.bandDots=[];this.range=r,this.status=t("div",{class:"dl-map-status"}),this.card=t("div",{class:"dl-map-card","aria-live":"polite"}),this.el=t("div",{class:"dl-geomap",style:`height:${o}px`},[this.status,this.card])}async mount(e){this.data=e;try{this.gl=await ps(this.el)}catch(o){this.status.textContent=o.message;return}if(this.dead)return;this.map=new this.gl.Map({container:this.el,style:bn()?Hr:zr,center:[e.geo.home?.lon??20,e.geo.home?.lat??50],zoom:1,renderWorldCopies:!1,attributionControl:{compact:!0},minZoom:1}),this.map.on("style.load",()=>this.layers()),this.map.on("move",()=>this.declutter()),this.map.once("idle",()=>{let o=this.el.querySelector(".maplibregl-ctrl-attrib");o?.classList.remove("maplibregl-compact-show"),o?.removeAttribute("open")}),this.resize=new ResizeObserver(()=>{!this.map||!this.el.clientWidth||!this.el.clientHeight||(this.map.resize(),this.fitBlind&&(this.fitKey=null,this.draw()))}),this.resize.observe(this.el);let r=bn();this.theme=new MutationObserver(()=>{!this.map||bn()===r||(r=bn(),this.map.setStyle(r?Hr:zr))}),this.theme.observe(document.documentElement,{attributes:!0,attributeFilter:["data-darkmode"]})}layers(){if(this.map){this.hiddenKey="",this.map.setProjection({type:"globe"}),this.map.addSource("dl-areas",{type:"geojson",data:{type:"FeatureCollection",features:[]}}),this.map.addLayer({id:"dl-area",type:"circle",source:"dl-areas",paint:{"circle-radius":["interpolate",["exponential",2],["zoom"],2,6,6,26,9,140,12,900],"circle-color":["case",["get","online"],xn,lo],"circle-opacity":["case",["get","online"],.12,.06],"circle-stroke-width":1,"circle-stroke-color":["case",["get","online"],xn,lo],"circle-stroke-opacity":["case",["get","online"],.35,.15]}}),this.map.addSource("dl-band",{type:"geojson",data:{type:"FeatureCollection",features:this.bandDots}}),this.map.addLayer({id:"dl-band",type:"circle",source:"dl-band",paint:{"circle-radius":1.4,"circle-color":xn,"circle-opacity":0}}),this.map.addSource("dl-arcs",{type:"geojson",data:{type:"FeatureCollection",features:[]}});for(let e of[!1,!0])this.map.addLayer({id:e?"dl-arc-live":"dl-arc-recent",type:"line",source:"dl-arcs",filter:["==",["get","online"],e],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":e?xn:lo,"line-width":2,"line-opacity":.85,"line-dasharray":[2,2]}});this.draw()}}setRange(e){this.range=e,this.fitKey=null,this.draw()}update(e){this.data=e,this.draw()}destroy(){this.dead=!0,this.dropCard();for(let e of this.piles.values())e.marker.remove();this.piles.clear(),this.theme?.disconnect(),this.resize?.disconnect(),this.map?.remove(),this.map=null}groups(e){let r=new Map;for(let o of e){let a=`${o.person}|${Ke(o)}`,i=r.get(a);i||(i={key:a,person:o.person,lat:o.lat,lon:o.lon,city:o.city,country:o.country,cc:o.cc,asn:o.asn,org:o.org,online:!1,ts:0,points:[]},r.set(a,i)),i.points.push(o),i.online||(i.online=o.online),i.ts=Math.max(i.ts,o.ts)}return[...r.values()]}draw(){if(!this.map||!this.data||!this.map.getSource("dl-arcs"))return;let e=this.data,r=this.groups(co(e,this.range)),o=e.person||e.device?null:e.geo.home;for(let d of this.markers)d.remove();this.markers=[];let a=e.person||e.device?null:vs(r,o),i=r.map(d=>({g:d,at:a?.get(d.key)??[d.lon,d.lat]}));if(this.slots=[],this.map.getSource("dl-areas").setData({type:"FeatureCollection",features:i.map(({g:d})=>({type:"Feature",properties:{online:d.online,key:d.key},geometry:{type:"Point",coordinates:[d.lon,d.lat]}}))}),this.map.getSource("dl-arcs").setData({type:"FeatureCollection",features:o?i.map(({g:d,at:c})=>({type:"Feature",properties:{online:d.online,person:d.person,key:d.key},geometry:{type:"LineString",coordinates:Ir([o.lon,o.lat],c)}})):[]}),o){let d=t("span",{class:"dl-mk-host"});d.innerHTML=`<span class="dl-mk-host-tile">${ft("server","dl-mk-host-ic")}</span>`,this.dock=d.appendChild(t("span",{class:"dl-mk-dock"})),this.dockQuiet=this.dockKey!=="",this.dockKey="";let c=t("div",{class:"dl-mk-hub",title:`Home router${o.city?` · ${o.city}`:""}${o.org?` · ${o.org}`:""}`},[d,t("span",{class:"dl-mk-label chip"},o.city||"Home")]);c.addEventListener("mouseenter",()=>this.showMerged(o.city||"the server")),c.addEventListener("mouseleave",()=>this.focus(this.focused)),c.addEventListener("click",()=>this.zoomToMerged()),this.add(c,[o.lon,o.lat],!0)}let s=new Map(e.device?po(e,this.range).map(d=>[Ke(d),d.n]):[]);this.people=[],this.places.clear();for(let{g:d,at:c}of i){let p=d.points.length,u=e.people.find(m=>m.id===d.person);if(e.person){let m=e.device?this.deviceMarker(d,c,u,s.get(Ke(d))??0):this.placeMarker(d,c,u);this.add(m,c);continue}let x=d.points.map(m=>u?.devices.find(C=>C.id===m.device)?.kind??"other"),$=t("span",{class:"dl-mk-badge"});$.innerHTML=p<=2?x.map(m=>ft(m,"dl-mk-badge-ic")).join(""):String(p);let h=t("button",{type:"button",class:`dl-mk${d.online?" online":""}`,"aria-label":`${u?.name??"Someone"}: ${p} device${p===1?"":"s"} in ${d.city||"an unknown city"}`},[t("span",{class:"dl-mk-av"},[He(u?.name??"?"),$]),t("span",{class:"dl-mk-label below"},d.city||d.cc||"?")]);h.addEventListener("mouseenter",()=>this.focus(d.person)),h.addEventListener("mouseleave",()=>this.focus(null)),this.people.push({el:h,person:d.person}),h.addEventListener("click",m=>{m.stopPropagation(),this.openPopup(d,c,h)}),this.add(h,c,!1,u?.name??"Someone",`${d.city||d.cc||"?"} · ${d.online?"now":re(d.ts,e.now)}`,d.key,d)}this.declutter();let l=i.map(d=>d.g.key).sort().join(";");if(l!==this.fitKey&&!this.popup){let d=this.fitted&&!this.fitBlind;if(this.fitBlind=!this.el.clientWidth||!this.el.clientHeight,this.fitKey=l,this.fitted=!0,o&&!i.length){let c={center:[o.lon,o.lat],zoom:12};d?this.glide(12,()=>this.map.flyTo({...c,duration:1200})):this.map.jumpTo(c)}else{let c=i.map(p=>p.at);o&&(c.length===0||this.range!=="online"||i.some(p=>p.g.online))&&c.push([o.lon,o.lat]),this.fit(c,d)}}this.status.textContent=i.length||o?"":"No locations yet",this.status.style.display=this.status.textContent?"":"none",this.focus(this.focused&&this.people.some(d=>d.person===this.focused)?this.focused:null)}add(e,r,o=!1,a,i,s,l){s&&this.foldedKeys.has(s)&&e.classList.add("merged"),s&&this.piledKeys.has(s)&&e.classList.add("piled"),e.dataset.key=s??"",e.classList.add("dl-mk-new"),requestAnimationFrame(()=>requestAnimationFrame(()=>e.classList.remove("dl-mk-new")));let d=new this.gl.Marker({element:e}).setLngLat(r).addTo(this.map);this.markers.push(d),this.slots.push({marker:d,el:e,at:r,fixed:o,who:a,where:i,g:l})}declutter(){if(!this.map)return;let e=this.map.getZoom();this.el.classList.toggle("dl-lod-far",e<Rr),this.el.classList.toggle("dl-lod-mid",e>=Rr&&e<fs);let r=this.slots.map(s=>{let l=this.map.project(s.at),d=s.el.querySelector(":scope > .dl-mk-host, :scope > .dl-mk-av, :scope > .dl-mk-tile");return{x:l.x,y:l.y,r:(d?.offsetWidth||24)/2+3,fixed:s.fixed}}),o=r.filter(s=>s.fixed);this.merged=[],this.foldedKeys.clear();let a=this.targetZoom==null?1:Math.min(1,2**(this.targetZoom-this.map.getZoom()));r.forEach((s,l)=>{if(s.fixed)return;let d=this.slots[l],c=d.el.classList.contains("merged")?12:6,p=o.find(u=>Math.hypot(u.x-s.x,u.y-s.y)*a<u.r+s.r+c);d.el.classList.toggle("merged",!!p),p&&(d.el.dataset.key&&this.foldedKeys.add(d.el.dataset.key),this.merged.push(Br(d)),Object.assign(s,{r:0,fixed:!0}))}),this.pileUp(r);let i=[...this.foldedKeys].sort().join("|");if(i!==this.hiddenKey){this.hiddenKey=i;let s=["!",["in",["get","key"],["literal",[...this.foldedKeys]]]];this.map.getLayer("dl-area")&&this.map.setFilter("dl-area",s);for(let l of[!1,!0]){let d=l?"dl-arc-live":"dl-arc-recent";this.map.getLayer(d)&&this.map.setFilter(d,["all",["==",["get","online"],l],s])}}this.paintDock(),this.focused&&!this.el.querySelector(".dl-mk:hover, .dl-mk-face:hover")&&this.focus(null),gs(r).forEach(([s,l],d)=>{let c=this.slots[d];!c||c.fixed||(r[d].fixed&&([s,l]=[0,0]),c.marker.setOffset([s,l]),xs(c.el,s,l))})}closePopup(e=!1){let r=this.popup;if(!r||r.card.classList.contains("leaving"))return;r.card.classList.add("leaving"),setTimeout(()=>{this.popup===r&&this.dropCard()},140);let o=this.before;if(this.before=null,!o)return;let a=()=>this.map?.flyTo({...o,duration:800});if(!e)return a();let i=!1,s=()=>{i||(i=!0,window.removeEventListener("pointerup",s,!0),window.removeEventListener("pointercancel",s,!0),setTimeout(a,0))};window.addEventListener("pointerup",s,!0),window.addEventListener("pointercancel",s,!0),setTimeout(s,1500)}dropCard(){this.popup?.off(),this.popup?.card.remove(),this.popup=null}showMerged(e){this.merged.length&&(dom.content(this.card,[t("div",{class:"dl-map-card-head"},[t("b",{},`Near ${e}`)," · click to zoom in"]),...this.merged.map(r=>t("div",{class:"dl-map-card-row"},[t("span",{},r.who),t("span",{class:"dl-faint"},r.where)]))]),this.card.classList.add("on"))}paintDock(){let e=this.dock;if(!e)return;let r=this.merged.map(a=>`${a.key}:${a.online?1:0}`).join("|");if(r===this.dockKey)return;this.dockKey=r,e.parentElement?.classList.toggle("docked",this.merged.length>0);let o=this.slots.find(a=>a.fixed).at;this.merged.length&&Or(e,this.merged,this.faceActions(()=>[o]),this.dockQuiet),this.dockQuiet=!1}faceActions(e){return{click:(r,o)=>this.openFace(r,o,e()),hover:r=>this.focus(r?.g?.person??null)}}pileUp(e){let r=new Set;if(!this.data?.person&&!this.data?.device){let o=e.flatMap((l,d)=>!l.fixed&&this.slots[d].el.querySelector(":scope > .dl-mk-av")?[d]:[]),a=new Map(o.map(l=>[l,l])),i=l=>a.get(l)===l?l:i(a.get(l));for(let l of o)for(let d of o){if(d<=l)continue;let c=this.slots[l].el.classList.contains("piled")&&this.slots[d].el.classList.contains("piled");Math.hypot(e[l].x-e[d].x,e[l].y-e[d].y)<e[l].r+e[d].r+(c?12:6)&&a.set(i(d),i(l))}let s=new Map;for(let l of o)s.set(i(l),[...s.get(i(l))??[],l]);for(let l of s.values()){if(l.length<2)continue;let d=l.map(m=>this.slots[m]),c=d.map(Br),p=c.map(m=>m.key).sort().join(",");r.add(p);let u=[d.reduce((m,C)=>m+C.at[0],0)/d.length,d.reduce((m,C)=>m+C.at[1],0)/d.length],x=this.piles.get(p);if(!x){let m=t("span",{class:"dl-mk-pile-box"}),C=[...new Set(d.map(v=>v.g?.city||v.g?.cc||"?"))],B=t("div",{class:"dl-mk-pile"},[m,t("span",{class:"dl-mk-label below"},C.length===1?C[0]:`${d.length} people`)]);x={marker:new this.gl.Marker({element:B}).setLngLat(u).addTo(this.map),el:B,box:m,faces:c},B.addEventListener("mouseleave",()=>this.focus(this.focused));let w=x;B.addEventListener("click",v=>{v.stopPropagation(),this.zoomInTo(w.faces.map(y=>y.at),!1)}),this.piles.set(p,x)}x.faces=c;let $=x;Or(x.box,c,this.faceActions(()=>$.faces.map(m=>m.at)));for(let m of l)this.slots[m].el.classList.add("piled"),Object.assign(e[m],{r:0,fixed:!0});let h=this.map.project(u);e.push({x:h.x,y:h.y,r:(x.el.offsetWidth||60)/2+3,fixed:!0})}}this.piledKeys=new Set(this.slots.filter(o=>o.el.classList.contains("piled")).map(o=>o.el.dataset.key??"")),this.slots.forEach((o,a)=>{(!e[a].fixed||o.fixed||o.el.classList.contains("merged"))&&o.el.classList.remove("piled")});for(let[o,a]of this.piles)r.has(o)||(this.piles.delete(o),a.el.classList.add("out"),setTimeout(()=>a.marker.remove(),200))}zoomToMerged(){!this.map||!this.merged.length||this.zoomInTo([this.slots.find(e=>e.fixed).at,...this.merged.map(e=>e.at)],!1)}openFace(e,r,o){if(!e.g)return;if(o.every(i=>wn(i,e.at)<1))return this.openPopup(e.g,e.at,r);let a=()=>{let i=this.slots.find(s=>s.el.dataset.key===e.key);i?.g&&!i.el.classList.contains("merged")&&!i.el.classList.contains("piled")&&this.openPopup(i.g,i.at,i.el)};this.zoomInTo(this.nearby(e.at),!0)?this.map.once("moveend",a):a()}nearby(e){return[e,...this.slots.filter(r=>!r.fixed&&r.at!==e&&wn(r.at,e)<=Nr).map(r=>r.at)]}zoomInTo(e,r){let o=new this.gl.LngLatBounds;for(let p of e)o.extend(p);let a=e.some(p=>e.some(u=>wn(p,u)>Nr)),i=this.map.cameraForBounds(o,{padding:50,maxZoom:a?12:us}),s=this.map.getZoom(),l=e.map(p=>this.map.project(p)),d=0;l.forEach((p,u)=>l.slice(u+1).forEach(x=>{let $=Math.hypot(p.x-x.x,p.y-x.y),h=s+Math.log2(ms/Math.max($,1e-6));h<=12&&(d=Math.max(d,h))}));let c=Math.min(12,Math.max(i?.zoom??0,d));return c<=s+.05?!1:(r&&!this.before&&(this.before={center:this.map.getCenter().toArray(),zoom:s}),this.map.flyTo({center:i?.center??o.getCenter(),zoom:c,duration:800}),!0)}placeMarker(e,r,o){let a=this.data.now,i=[...e.points].sort((u,x)=>Number(x.online)-Number(u.online)||x.ts-u.ts)[0],s=o?.devices.find(u=>u.id===i.device)?.kind??"other",l=e.points.length,d=t("span",{class:"dl-mk-tile"});d.innerHTML=ft(s,"dl-mk-tile-ic")+(l>1?`<span class="dl-mk-tile-n">${l}</span>`:"");let c=e.online?"now":re(e.ts,a),p=t("button",{type:"button",class:`dl-mk place${e.online?" online":""}`,style:e.online?null:`--dl-mk-fade:${Math.max(.4,1-.6*(a-e.ts)/(30*86400)).toFixed(2)}`,"aria-label":`${l} device${l===1?"":"s"} in ${e.city||"an unknown city"}, ${c}`},[d,t("span",{class:"dl-mk-label below"},[e.city||e.cc||"?",t("span",{class:"dl-mk-when"},c)])]);return p.addEventListener("click",u=>{u.stopPropagation(),this.openPopup(e,r,p)}),p}deviceMarker(e,r,o,a){let i=o?.devices.find(p=>p.id===e.points[0].device)?.kind??"other",s=t("span",{class:"dl-mk-tile"}),l=t("span",{class:"dl-mk-label below"}),d=t("button",{type:"button",class:"dl-mk place step"},[s,l]);d.addEventListener("click",p=>{p.stopPropagation(),this.openPopup(e,r,d)});let c=Ke(e);return this.places.set(c,{el:d,tile:s,label:l,when:null,g:e,n:a,kind:i}),this.paintPlace(c,!1),d}paintPlace(e,r){let o=this.places.get(e);if(!o)return;let a=this.replaying,i=a?a.active===e:o.g.online,s=o.el.classList.contains("online"),l=o.g.city||o.g.cc||"?";o.el.classList.toggle("online",i),o.el.classList.toggle("faded",!!a&&!i),o.tile.classList.toggle("sm",!i),i||!o.n?o.tile.innerHTML=ft(o.kind,"dl-mk-tile-ic"):o.tile.textContent=String(o.n),o.when=null,i?(o.when=t("span",{class:`dl-mk-when${a?" inline":""}`},a?a.when:"now"),o.label.replaceChildren(l,a?" · ":"",o.when)):o.label.replaceChildren(`${l} · ${o.g.online?"now":re(o.g.ts,this.data.now)}`);let d=i?a?a.when:"now":o.g.online?"now":re(o.g.ts,this.data.now);o.el.setAttribute("aria-label",`${o.n?`${o.n}: `:""}${o.g.city||"an unknown city"}, ${d}`),r&&i&&!s&&(o.el.classList.remove("arrive"),o.el.offsetWidth,o.el.classList.add("arrive"),setTimeout(()=>o.el.classList.remove("arrive"),500))}replay(e,r=!0){let o=this.replaying;if(this.replaying=e,o&&e&&o.active===e.active){let a=e.active?this.places.get(e.active):null;a?.when&&(a.when.textContent=e.when);return}for(let a of this.places.keys())a!==e?.active&&this.paintPlace(a,r);e?.active&&this.paintPlace(e.active,r),this.declutter(),setTimeout(()=>this.declutter(),320)}hoverPlace(e){for(let[r,o]of this.places)o.el.classList.toggle("hl",r===e)}band(e,r){if(this.bandDots=[],this.map&&e&&r){let o=Ir(e,r),a=o.map(c=>this.map.project(c)),i=[0];for(let c=1;c<a.length;c++)i.push(i[c-1]+Math.hypot(a[c].x-a[c-1].x,a[c].y-a[c-1].y));let s=i[i.length-1],l=Math.max(2,Math.round(s/hs)),d=0;for(let c=0;c<=l;c++){let p=s*c/l;for(;d<i.length-2&&i[d+1]<p;)d++;let u=i[d+1]>i[d]?(p-i[d])/(i[d+1]-i[d]):0,x=[o[d][0]+(o[d+1][0]-o[d][0])*u,o[d][1]+(o[d+1][1]-o[d][1])*u];this.bandDots.push({type:"Feature",properties:{pos:c/l},geometry:{type:"Point",coordinates:x}})}}this.map?.getLayer("dl-band")&&(this.map.setPaintProperty("dl-band","circle-opacity",0),this.map.getSource("dl-band").setData({type:"FeatureCollection",features:this.bandDots}))}bandAt(e){this.map?.getLayer("dl-band")&&this.map.setPaintProperty("dl-band","circle-opacity",_r(e))}focus(e){this.focused=e;for(let s of this.people)s.el.classList.toggle("dim",!!e&&s.person!==e),s.el.classList.toggle("hl",s.person===e);let r=e?["case",["==",["get","person"],e],.85,.15]:.85;for(let s of["dl-arc-live","dl-arc-recent"])this.map?.getLayer(s)&&this.map.setPaintProperty(s,"line-opacity",r);if(this.card.classList.toggle("on",!!e),!e||!this.data)return;let o=this.data,a=o.people.find(s=>s.id===e),i=co(o,this.range).filter(s=>s.person===e).sort((s,l)=>Number(l.online)-Number(s.online)||l.ts-s.ts);dom.content(this.card,[t("div",{class:"dl-map-card-head"},[t("b",{},a?.name??e),` · ${i.length} device${i.length===1?"":"s"}`]),...i.map(s=>t("div",{class:"dl-map-card-row"},[t("span",{},a?.devices.find(l=>l.id===s.device)?.name??"Device"),t("span",{class:"dl-faint"},`${s.city||s.cc||"?"} · ${s.online?"now":re(s.ts,o.now)}`)]))])}fit(e,r=!1){if(!e.length)return;let o=(p,u)=>{let x=Math.PI/180,$=(u[1]-p[1])*x,h=(u[0]-p[0])*x,m=Math.sin($/2)**2+Math.cos(p[1]*x)*Math.cos(u[1]*x)*Math.sin(h/2)**2;return 12742*Math.asin(Math.sqrt(m))},a=[e.reduce((p,u)=>p+u[0],0)/e.length,e.reduce((p,u)=>p+u[1],0)/e.length],i=e;if(e.length>=5){let p=[...e].sort((u,x)=>o(a,u)-o(a,x));i=p.slice(0,Math.ceil(p.length*.9))}let s=new this.gl.LngLatBounds(i[0],i[0]);i.forEach(p=>s.extend(p));let l=this.el.clientHeight||380,d=!!this.data?.person,c={padding:{top:this.data?.device?Math.min(56,l/4):Math.min(60,l/5),bottom:d?Math.min(52,l/4):Math.min(40,l/8),left:48,right:48},maxZoom:this.data?.person?11:12};r?this.glide(this.map.cameraForBounds(s,c)?.zoom??null,()=>this.map.fitBounds(s,{...c,duration:1200})):this.map.fitBounds(s,{...c,duration:0})}glide(e,r){this.targetZoom=e,this.declutter(),this.map.once("moveend",()=>{this.targetZoom=null,this.declutter()}),r()}openPopup(e,r,o){let a=this.data,i=[e.city,e.cc||e.country].filter(Boolean).join(", "),s=[...new Set(e.points.map(v=>v.person))],l=e.points.sort((v,y)=>Number(y.online)-Number(v.online)||y.ts-v.ts).map(v=>{let y=a.people.find(k=>k.id===v.person),E=y?.devices.find(k=>k.id===v.device);return t("button",{type:"button",class:"dl-pop-row",click:()=>this.cb.openDevice(v.person,v.device)},[t("span",{class:`dl-pop-dot${v.online?" on":""}`}),t("span",{class:"dl-pop-name"},[t("b",{},y?.name??v.person),` · ${E?.name??"device"}`]),t("span",{class:"dl-faint dl-nowrap"},v.online?"now":re(v.ts,a.now))])}),d=t("div",{class:"dl-pop"},[t("div",{class:"dl-pop-head"},[t("span",{class:"dl-pop-net"},b("globe")),t("div",{class:"dl-stack"},[t("strong",{},e.org||"Unknown network"),t("span",{class:"dl-faint"},[e.asn?`AS${e.asn} · `:"",i?`${i} · approximate`:"approximate location"])])]),t("div",{class:"dl-pop-list"},l),s.length===1?t("div",{class:"dl-pop-actions"},[t("button",{type:"button",class:"cbi-button cbi-button-positive important",click:()=>this.cb.openPerson(s[0])},`Open ${a.people.find(v=>v.id===s[0])?.name??"person"}`)]):""]);this.zoomInTo(this.nearby(r),!0),this.dropCard();let c=t("div",{class:"dl-root dl-popcard",role:"dialog"},[t("span",{class:"dl-popcard-tip"}),d]);document.body.appendChild(c);let p=this.el,u=o?.querySelector(".dl-mk-av, .dl-mk-tile")??o??null,x=()=>{if(!u)return;let v=u.getBoundingClientRect(),y=p.getBoundingClientRect(),E=v.left+v.width/2,k=v.top+v.height/2;c.classList.toggle("away",E<y.left||E>y.right||k<y.top||k>y.bottom);let z=c.offsetWidth,f=c.offsetHeight,g=v.top-f-12>=8||v.top>window.innerHeight-v.bottom,S=Math.min(Math.max(8,E-z/2),window.innerWidth-z-8);c.classList.toggle("above",g),c.classList.toggle("below",!g),c.style.left=`${S}px`,c.style.top=`${g?v.top-f-12:v.bottom+12}px`,c.style.setProperty("--tip-x",`${E-S}px`)},$=v=>{v.target?.closest(".dl-popcard, .maplibregl-marker")||this.closePopup(!0)},h=v=>{v.key==="Escape"&&this.closePopup()},m=v=>{v.target instanceof Element&&v.target.closest(".dl-popcard")||this.closePopup()},C=()=>this.closePopup();this.map.on("move",x),window.addEventListener("scroll",m,{capture:!0,passive:!0}),window.addEventListener("resize",x),document.addEventListener("pointerdown",$,!0),document.addEventListener("keydown",h);let B=$e(C);window.addEventListener("pagehide",C),this.popup={card:c,off:()=>{this.map?.off("move",x),window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",x),document.removeEventListener("pointerdown",$,!0),document.removeEventListener("keydown",h),B(),window.removeEventListener("pagehide",C)}};let w=window.setInterval(()=>{if(this.popup?.card!==c)return clearInterval(w);(!p.isConnected||!p.getClientRects().length)&&this.dropCard()},400);x()}};function gs(n,e=6){let r=n.map(o=>({x:o.x,y:o.y}));for(let o=0;o<16;o++){let a=!1;for(let i=0;i<n.length;i++)for(let s=i+1;s<n.length;s++){let l=n[i],d=n[s];if(l.fixed&&d.fixed)continue;let c=r[s].x-r[i].x,p=r[s].y-r[i].y,u=Math.hypot(c,p),x=l.r+d.r+e-u;if(x<=0)continue;if(u<.01){let m=(i+1)*2.399+s;[c,p,u]=[Math.cos(m),Math.sin(m),1]}let $=l.fixed?0:d.fixed?1:.5,h=1-$;r[i].x-=c/u*x*$,r[i].y-=p/u*x*$,r[s].x+=c/u*x*h,r[s].y+=p/u*x*h,a=!0}if(!a)break}return r.map((o,a)=>[o.x-n[a].x,o.y-n[a].y])}function vs(n,e){let r=new Map,o=e?[[e.lon,e.lat]]:[],a=i=>o.some(s=>wn(i,s)<1.3);for(let i of[...n].sort((s,l)=>s.key<l.key?-1:1)){let s=bs(i.key),l=1.5+3.5*((s>>>12)/1048575),d=(s&4095)/4096*2*Math.PI,c=[i.lon,i.lat];for(let p=0;p<24;p++){let u=d+p*2.39996,x=Math.min(8,l+p*.25);if(c=[i.lon+x*Math.sin(u)/(111.32*Math.cos(i.lat*Math.PI/180)),i.lat+x*Math.cos(u)/111.32],!a(c))break}o.push(c),r.set(i.key,c)}return r}function bs(n){let e=2166136261;for(let r=0;r<n.length;r++)e=Math.imul(e^n.charCodeAt(r),16777619);return e>>>0}function Br(n){return{key:n.el.dataset.key??"",who:n.who??"Someone",where:n.where??"",online:!!n.g?.online,at:n.at,badge:n.el.querySelector(".dl-mk-badge")?.innerHTML??"",g:n.g}}function Or(n,e,r,o=!1){let a=e.length>3,i=()=>[...n.children].filter(h=>!h.classList.contains("out")),s=new Map(i().map(h=>[h,h.getBoundingClientRect().left])),l=n.getBoundingClientRect().width,d=new Map;n.querySelectorAll(".dl-mk-face:not(.out)").forEach(h=>d.set(h.dataset.key??"",h));let c=n.querySelector(".dl-mk-more:not(.out)"),p=h=>{Object.assign(h.style,{position:"absolute",left:`${h.offsetLeft}px`,top:`${h.offsetTop}px`,transform:""}),h.classList.add("out"),setTimeout(()=>h.remove(),200)},u=[];for(let h of e.slice(0,a?2:3)){let m=d.get(h.key);if(d.delete(h.key),!m){let w=t("button",{type:"button",class:`dl-mk-face${o?"":" in"}`,"data-key":h.key},[t("span",{class:"dl-mk-av"},He(h.who)),t("span",{class:"dl-mk-badge"})]);w.addEventListener("animationend",()=>w.classList.remove("in"),{once:!0}),m=w}let C=m,B=C.querySelector(".dl-mk-badge");B.innerHTML!==h.badge&&(B.innerHTML=h.badge),C.title=`${h.who} · ${h.where}`,C.setAttribute("aria-label",`${h.who}, ${h.where}`),C.classList.toggle("on",h.online),C.onclick=w=>{w.stopPropagation(),r.click(h,C)},C.onmouseenter=()=>r.hover(h),C.onmouseleave=()=>r.hover(null),u.push(C)}for(let h of d.values())p(h);if(a){if(!c){c=t("span",{class:`dl-mk-more${o?"":" in"}`});let h=c;h.addEventListener("animationend",()=>h.classList.remove("in"),{once:!0})}c.textContent=`+${e.length-2}`,u.push(c)}else c&&p(c);let x=null;for(let h of u)(x?x.nextElementSibling:n.firstElementChild)!==h&&(x?x.after(h):n.prepend(h)),x=h;for(let h of u){let m=s.get(h);if(m==null)continue;let C=m-h.getBoundingClientRect().left;Math.abs(C)<.5||(h.style.transition="none",h.style.transform=`translateX(${C}px)`,h.offsetWidth,h.style.transition="",h.style.transform="")}n.style.width="";let $=n.getBoundingClientRect().width;if(l&&Math.abs($-l)>.5){n.style.width=`${l}px`,n.offsetWidth,n.style.width=`${$}px`;let h=()=>{n.style.width="",n.removeEventListener("transitionend",h)};n.addEventListener("transitionend",h),setTimeout(h,400)}}function wn(n,e){let r=Math.PI/180,o=Math.sin((e[1]-n[1])*r/2)**2+Math.cos(n[1]*r)*Math.cos(e[1]*r)*Math.sin((e[0]-n[0])*r/2)**2;return 12742*Math.asin(Math.min(1,Math.sqrt(o)))}function xs(n,e,r){let o=n.querySelector(":scope > .dl-mk-ptr"),a=Math.hypot(e,r);if(a<1){o?.remove();return}o||(o=t("span",{class:"dl-mk-ptr"},[t("i",{class:"line"}),t("i",{class:"spot"})]),n.prepend(o));let i=o.firstElementChild,s=o.lastElementChild;i.style.width=`${a}px`,i.style.transform=`rotate(${Math.atan2(-r,-e)}rad)`,s.style.transform=`translate(${-e}px, ${-r}px)`}function _t(n,e,r=!0){let o=[["online","Online now"],["24h","24h"],["7d","7 days"],["30d","30 days"]],a=t("div",{class:"dl-seg",role:"tablist"});for(let[i,s]of o)i==="online"&&!r||a.appendChild(t("button",{type:"button",role:"tab",class:i===n?"on":"","data-v":i,click:()=>{a.querySelectorAll("button").forEach(l=>l.classList.toggle("on",l.dataset.v===i)),e(i)}},s));return a}var jr={"24h":86400,"7d":7*86400,"30d":30*86400},uo=(n,e)=>`${(n/e*100).toFixed(3)}%`,yn=class{constructor(e,r,o){this.map=e;this.range=r;this.el=t("div",{class:"dl-dplaces"});this.controls=t("div",{class:"dl-map-replay"});this.pending=null;this.rows=new Map;this.st=[];this.steps=[];this.total=0;this.ms=0;this.stepI=-1;this.on=!1;this.playing=!1;this.raf=0;this.last=0;this.endTimer=0;this.play=t("button",{type:"button",class:"dl-map-btn"});this.chip=t("span",{class:"dl-map-chip"});this.stop=t("button",{type:"button",class:"dl-map-btn",title:"Back to now","aria-label":"Back to now"},b("x"));this.reduced=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1;this.data=o,this.play.addEventListener("click",()=>this.toggle()),this.stop.addEventListener("click",()=>this.end()),this.paint()}mapData(){let e=this.data;return{geo:e.geo,people:[e.person],now:e.now,person:e.person.id,device:e.device.id}}update(e){let r={...this.pending??this.data,...e};if(this.on){this.pending=r;return}this.data=r,this.map.update(this.mapData()),this.paint()}setRange(e){this.end(),this.range=e,this.map.setRange(e),this.paint()}destroy(){cancelAnimationFrame(this.raf),clearTimeout(this.endTimer)}paint(){let e=this.data,r=jr[this.range],o=e.now-r,a=yr(wr(e.events??[],e.device.id,e.now,e.device.online,e.device.handshake),e.geo.points,e.device.id,o),i=kr(a);this.st=$r(a);let s=po(this.mapData(),this.range),l=a.length>0;this.el.classList.toggle("strips",l),this.el.classList.toggle("can-replay",this.st.length>1),this.rows.clear(),dom.content(this.el,s.length?[...s.map(d=>{let c=Ke(d),p=i.get(c),u=l?t("div",{class:`dl-dplace-strip${d.online?" live":""}`},a.filter($=>$.key===c).map($=>t("i",{style:`left:${uo($.from-o,r)};width:${uo($.to-$.from,r)}`}))):"",x=t("div",{class:"dl-dplace-row"},[t("span",{class:`dl-dplace-n${d.online?" live":""}`},d.online?b(e.device.kind):String(d.n)),t("span",{class:"dl-row-main dl-stack"},[t("span",{},[d.city||d.cc||"Unknown city",d.org?t("span",{class:"dl-muted"},` · ${d.org}`):""]),t("span",{class:"dl-faint"},[t("span",{class:"dl-mono"},d.ip),p!=null?` · ${p>0&&p<.005?"<1":Math.round(p*100)}% of the time`:""])]),t("span",{class:d.online?"dl-dplace-now":"dl-faint dl-nowrap"},d.online?"now":re(d.ts,e.now)),u]);if(x.addEventListener("mouseenter",()=>this.map.hoverPlace(c)),x.addEventListener("mouseleave",()=>this.map.hoverPlace(null)),u){let $=h=>{let m=u.getBoundingClientRect();this.seek(o+r*Math.min(1,Math.max(0,(h.clientX-m.left)/m.width)))};u.addEventListener("pointerdown",h=>{u.setPointerCapture(h.pointerId),$(h)}),u.addEventListener("pointermove",h=>h.buttons&&$(h))}return this.rows.set(c,x),x}),l?t("div",{class:"dl-dplace-axis"},Pr(this.range,e.now).map(([d,c])=>t("span",{style:`left:${(d*100).toFixed(2)}%`},c))):""]:t("div",{class:"dl-sub"},"No locations in this period.")),this.paintControls()}paintControls(){dom.content(this.play,b(this.playing?"pause":"play")),this.play.title=this.playing?"Pause":"Replay this period",this.play.setAttribute("aria-label",this.play.title),dom.content(this.controls,this.on?[this.play,this.chip,this.stop]:this.st.length>1?[this.play]:[])}begin(){this.on=!0,{steps:this.steps,total:this.total}=Er(this.st,this.reduced?400:io),this.ms=0,this.stepI=-1,this.map.replay({active:null,when:""},!0)}toggle(){if(this.playing){this.playing=!1,cancelAnimationFrame(this.raf),this.paintControls();return}clearTimeout(this.endTimer),(!this.on||this.ms>=this.total)&&this.begin(),this.playing=!0,this.last=performance.now(),this.paintControls(),this.raf=requestAnimationFrame(e=>this.frame(e))}frame(e){if(this.playing){if(this.ms=Math.min(this.total,this.ms+(e-this.last)),this.last=e,this.show(!0),this.ms<this.total){this.raf=requestAnimationFrame(r=>this.frame(r));return}this.playing=!1,this.paintControls(),this.endTimer=window.setTimeout(()=>this.end(),1500)}}seek(e){this.st.length<2||(clearTimeout(this.endTimer),this.on||this.begin(),this.ms=Mr(this.st,this.steps,e),this.stepI=-1,this.show(!1),this.paintControls())}show(e){let r=Lr(this.st,this.steps,this.ms),o=this.st[r.step.k];if(r.step.kind==="move"){let s=this.st[r.step.k-1];r.i!==this.stepI&&(this.map.replay({active:null,when:""},e),this.map.band([s.point.lon,s.point.lat],[o.point.lon,o.point.lat]));let l=Sr(r.q);this.reduced||this.map.bandAt(l),(this.reduced?r.q>=.5:Tr(l))&&this.map.replay({active:o.key,when:vn(r.t)},e)}else r.i!==this.stepI&&this.map.band(),this.map.replay({active:o.key,when:vn(r.t)},e);this.stepI=r.i;let a=this.data,i=a.now-jr[this.range];this.el.classList.add("replay"),this.el.style.setProperty("--at",uo(r.t-i,a.now-i));for(let[s,l]of this.rows)l.classList.toggle("cur",s===o.key);this.chip.textContent=`${Dr(r.t,a.now)}, ${vn(r.t)} · ${o.point.city||o.point.cc||"?"}`}end(){if(cancelAnimationFrame(this.raf),clearTimeout(this.endTimer),!!this.on){this.on=!1,this.playing=!1,this.ms=0,this.stepI=-1,this.map.band(),this.map.replay(null,!1),this.el.classList.remove("replay");for(let e of this.rows.values())e.classList.remove("cur");this.pending?(this.data=this.pending,this.pending=null,this.map.update(this.mapData()),this.paint()):this.paintControls()}}};function Pt(n){return`${L.url("admin/network/dawnline/server")}?${n?`server=${encodeURIComponent(n)}&`:""}section=people`}function ke(n,e){return`${L.url("admin/network/dawnline/person")}?id=${encodeURIComponent(n)}${e?`&device=${encodeURIComponent(e)}`:""}`}function ws(n){return n?new Date(n*1e3).toLocaleString("en-GB",{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}function mo(n,e,r=!1){return t("div",{class:"dl-kvrow"},[t("span",{class:"dl-kvrow-k"},n),t("button",{type:"button",class:`dl-kvrow-v copy${r?" dl-mono":""}`,title:"Copy",click:()=>ue(e,`${n} copied`)},[t("span",{},e),b("copy")])])}function kn(n,e){return t("div",{class:"dl-kvrow"},[t("span",{class:"dl-kvrow-k"},n),t("span",{class:"dl-kvrow-v"},e)])}var Ur={connect:["ok","Connected","plug"],disconnect:["","Went offline","plug"],roam:["","Changed network","network"],device_added:["ok","Added","plus"],device_removed:["","Removed","trash"],device_keys:["","New keys","reset"]};function ys(n,e,r){let o=n.filter(a=>a.device===e&&Ur[a.type]).reverse().slice(0,12);return o.length?t("div",{class:"dl-dev-log"},o.map(a=>{let[i,s,l]=Ur[a.type],d=a.type==="connect"?[a.detail?t("span",{class:"dl-muted"},` from ${a.detail}`):"",a.where?t("span",{class:"dl-muted"},` · ${a.where}`):""]:a.type==="roam"?[t("span",{class:"dl-muted"},` · ${a.detail??""}`)]:a.type==="device_added"||a.type==="device_removed"||a.type==="device_keys"?[t("span",{class:"dl-muted"},Ne(a)==="portal"?" on the portal":Ne(a)==="admin"?" by you":"")]:[],c=new Date(a.ts*1e3);return t("div",{class:`dl-dev-log-row${Ne(a)==="admin"?" dl-ev-by-admin":""}`},[Ne(a)==="admin"?t("span",{class:"dl-ev-tile",title:"Done by you in LuCI"},b("admin")):t("span",{class:`dl-ev-tile ev ${i}`},b(l)),t("span",{class:"dl-row-main"},[t("span",{},s),...d]),t("span",{class:"dl-faint dl-nowrap",title:c.toLocaleString()},re(a.ts,r))])})):t("div",{class:"dl-sub"},"No activity yet.")}async function Gr(n,e,r){let o=await A.status(1).catch(()=>null),a=o?.people.find(s=>s.id===n),i=a?.devices.find(s=>s.id===e);o&&a&&i&&Ge(a,i,{...r,geo:o.geo,now:o.now,today:Ie(o.series),core:Tt(o.servers,a.server)})}async function Ge(n,e,r){let o=await G(()=>A.deviceConfig(e.id));if(!o)return;let a=r.core??Be(null),i=e,s=n,l=r.geo,d=r.now,c=r.today??je(new Date),p=await a.connectBlock(o,e.kind==="phone"||e.kind==="tablet"?"qr":"file"),u=t("div",{class:"dl-drawer-title"}),x=t("div",{}),$=t("div",{}),h=t("div",{},t("div",{class:"dl-sub"},"Loading…")),m=[],C=Q=>{m=Q.filter(te=>te.device===i.id),dom.content(h,ys(Q,i.id,d)),y?.update({events:Q})},B=async(Q=!1)=>{let te=r.events?.();if(te&&!Q)return C(te);let ge=await A.events(2e3,n.id).catch(()=>null);ge&&C(ge.events)},w="30d",v=null,y=null,E=()=>{dom.content(u,[t("span",{class:`dl-dcard-ic${i.online?" on":""}`},b(i.kind)),t("div",{class:"dl-stack"},[t("div",{class:"dl-title-row"},[t("h3",{},i.name),H([b("edit")],()=>f(),"neutral",{title:"Rename",class:"cbi-button cbi-button-neutral dl-icon-only sm"})]),t("span",{class:"dl-sub"},`${s.name} · ${Qe[i.kind]}`)])]);let Q=i.spark.reduce((te,ge)=>te+ge,0);dom.content(x,t("div",{class:"dl-dstats"},[t("div",{class:"dl-dstats-cell wide"},[t("span",{class:"dl-metric-label"},"Status"),on(i,d,"Waiting for the first connection",s)]),t("div",{class:"dl-dstats-cell"},[t("span",{class:"dl-metric-label"},"This month"),t("b",{},ee(i.month[0]+i.month[1])),t("span",{class:"dl-sub dl-mono"},`↓ ${ee(i.month[1])} ↑ ${ee(i.month[0])}`)]),t("div",{class:"dl-dstats-cell"},[t("span",{class:"dl-metric-label"},"Last 7 days"),t("b",{},ee(Q)),dr(i.spark,120,22,c)])])),dom.content($,t("div",{class:"dl-kv2"},[mo("Tunnel address",i.address),i.hostname&&s.access!=="internet"?mo("Local address",i.hostname):"",i.endpoint&&!l?.points.some(te=>te.device===i.id&&te.ip===i.endpoint)?kn("Client IP",i.endpoint):"",kn("Total",t("span",{class:"dl-kv-act"},[`↓ ${ee(i.total[1])} · ↑ ${ee(i.total[0])}`,t("button",{type:"button",class:"dl-linkbtn danger",click:()=>St("device",i.id,i.name,()=>setTimeout(z,300))},"Reset")])),kn("Added",`${ws(i.created)} · ${i.created_by==="portal"?"from the portal":"by you"}`),o.amnezia.client_pub_key?mo("Public key",o.amnezia.client_pub_key):kn("Public key","—")])),dom.content(g,[H([b(i.disabled?"play":"pause"),i.disabled?" Enable":" Disable"],async()=>{await G(()=>A.deviceUpdate(i.id,void 0,!i.disabled),i.disabled?"Device enabled":"Device disabled")&&await z()},"neutral",i.disabled?{}:{class:"cbi-button cbi-button-neutral dl-btn-warn"}),H([b("key")," New keys"],async()=>{if(!await le("Generate new keys?","The current configuration on this device stops working until it is imported again.","Generate",!0))return;await G(()=>A.deviceRotate(i.id),"New keys generated")&&(r.refresh(),de.close(),await Gr(s.id,i.id,r))}),t("span",{class:"dl-spacer"}),H([b("trash")," Remove"],async()=>{await le(`Remove ${i.name}?`,"The device is disconnected immediately and its configuration stops working.","Remove",!0)&&await G(()=>A.deviceDelete(i.id),"Device removed")&&(de.close(),r.refresh())},"negative")])},k=async()=>{let Q=await A.status(1).catch(()=>null),te=Q?.people.find(O=>O.id===s.id),ge=te?.devices.find(O=>O.id===i.id);!Q||!te||!ge||(s=te,i=ge,l=Q.geo,d=Q.now,c=Ie(Q.series),E(),y?.update({geo:Q.geo,now:Q.now,person:s,device:i}))},z=async()=>{await k(),r.refresh()},f=()=>{let Q=t("input",{type:"text",class:"cbi-input-text",value:i.name,maxlength:48}),te=s.devices.filter(O=>O.id!==i.id).map(O=>O.name),ge=ye("Name",Q,()=>_e(Q.value,te,"Shown in the portal and in the app."));oe(`Rename ${i.name}`,[ge],[ie()," ",H("Save",async()=>{let O=ge.help();if(O.bad){U(O.text,"warning");return}await G(()=>A.deviceUpdate(i.id,Q.value,void 0),"Renamed")&&(ae(),await z())},"positive")]),setTimeout(()=>Q.select(),50)},g=t("div",{class:"dl-drawer-actions"}),S=t("section",{class:"dl-dsec"},[t("div",{class:"dl-dsec-head"},[t("h4",{},"Connect")]),i.config_stale?t("div",{class:"dl-note warn"},[b("alert"),t("span",{},"This device has an older configuration: networks or DNS changed since it was set up. Import it again with the QR code, key or file below.")]):"",p]),T=t("section",{class:"dl-dsec"},[t("div",{class:"dl-dsec-head"},[t("h4",{},"Activity"),t("div",{class:"dl-dsec-actions"},[t("button",{type:"button",class:"dl-linkbtn",click:()=>Fe({people:[s]},m,"csv",i.id)},"Export"),t("button",{type:"button",class:"dl-linkbtn danger",click:()=>tt(`Clear ${i.name}'s activity`,`Removes events about ${i.name}.`,{device:i.id},()=>{B(!0),r.refresh()})},"Clear"),t("a",{href:`${L.url("admin/network/dawnline/diagnostics")}?tab=log`},"All activity")])]),h]),N=t("section",{class:"dl-dsec"},[t("div",{class:"dl-dsec-head"},t("h4",{},"Details")),$]),W="";if(l?.enabled){v=new nt({openPerson:te=>location.href=ke(te),openDevice:(te,ge)=>location.href=ke(te,ge)},w,220);let Q=y=new yn(v,w,{geo:l,now:d??Date.now()/1e3,person:s,device:i,events:r.events?.()??null});W=t("section",{class:"dl-dsec"},[t("div",{class:"dl-dsec-head"},[t("h4",{},"Locations"),_t(w,te=>{w=te,Q.setRange(te)},!1)]),t("div",{class:"dl-dmap"},[v.el,Q.controls]),Q.el])}let q=!i.handshake||i.config_stale,Y=t("div",{class:"dl-stack gap16"},q?[x,S,N,W,T]:[x,N,W,T,S]);B();let R=()=>{k(),B()},K=gn(R),Z=window.setInterval(R,3e4),de=Oo(u,Y,g,()=>{clearInterval(Z),K(),y?.destroy(),v?.destroy()});E(),v&&y&&requestAnimationFrame(()=>y&&v?.mount(y.mapData()))}function Wr(n,e,r,o){let a=o.core??Be(null),i=()=>G(()=>A.deviceConfig(r.id)),s=[{label:"Show QR code",icon:b("qr"),run:async()=>{let l=await i();l&&oe(`${r.name} · QR code`,t("div",{class:"dl-qr-pane"},[et(Lt(a.qrText(l)),"dl-qr"),t("span",{class:"dl-sub"},no(l)?"Scan with AmneziaVPN or any WireGuard app on the device.":"Scan with AmneziaVPN or AmneziaWG on the device.")]),ie("Close"))}},{label:a.file.label,icon:b("download"),run:async()=>{let l=await i();if(!l)return;let d=a.file.make(l);Te(d.name,d.text,"application/octet-stream")}},a.appKey?{label:a.appKey.label,icon:b("copy"),run:async()=>{let l=await i();l&&ue(await a.appKey.make(l),"Key copied")}}:null,null,{label:"Rename",icon:b("edit"),run:()=>Ge(e,r,o)},{label:"New keys",icon:b("key"),run:async()=>{await le("Generate new keys?","The current configuration on this device stops working until it is imported again.","Generate",!0)&&await G(()=>A.deviceRotate(r.id),"New keys generated")&&o.refresh()}},{label:r.disabled?"Enable":"Disable",icon:b(r.disabled?"play":"pause"),warn:!r.disabled,run:async()=>{await G(()=>A.deviceUpdate(r.id,void 0,!r.disabled),r.disabled?"Device enabled":"Device disabled")&&o.refresh()}},{label:"Delete",icon:b("trash"),danger:!0,run:async()=>{await le(`Remove ${r.name}?`,"The device is disconnected immediately and its configuration stops working.","Remove",!0)&&await G(()=>A.deviceDelete(r.id),"Device removed")&&o.refresh()}}];Ce(n,s)}function ot(n,e){let r=n.devices.map(c=>c.name),o=c=>{let p=Qe[c],u=1,x=p;for(;r.some($=>$.toLowerCase()===x.toLowerCase());)x=`${p} ${++u}`;return x},a="phone",i=t("input",{type:"text",class:"cbi-input-text",placeholder:o(a),maxlength:48}),s=ye("Name",i,()=>i.value.trim()?_e(i.value,r,"Shown in the portal and in the app."):{text:`Named after its type: ${o(a)}.`,bad:!1}),l=t("div",{class:"dl-kinds",role:"radiogroup","aria-label":"Type"},No.map(c=>t("button",{type:"button",role:"radio",class:c===a?"on":"","aria-checked":c===a?"true":"false","data-kind":c,click:()=>{a=c,l.querySelectorAll("button").forEach(p=>{let u=p.dataset.kind===c;p.classList.toggle("on",u),p.setAttribute("aria-checked",u?"true":"false")}),i.placeholder=o(c),s.refresh()}},[b(c),t("span",{},Qe[c])]))),d=n.devices.length>=n.device_limit;oe(`Add a device for ${n.name}`,[d?t("p",{class:"dl-hint"},`${n.name} already has ${n.devices.length} of ${n.device_limit} devices. As admin you can still add one.`):"",t("div",{class:"dl-fld"},[t("span",{class:"dl-fld-label"},"Type"),l]),s],[ie()," ",H("Add device",async()=>{let c=s.help();if(c.bad){U(c.text,"warning");return}let p=i.value.trim()||o(a),u=await G(()=>A.deviceCreate(n.id,p,a));u&&(ae(),U(`${p} added`,"success",3e3),e.refresh(),await Gr(n.id,u.id,e))},"positive")]),setTimeout(()=>i.focus(),50)}var Ve=1080,qt=1512,We=96,ks="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",$s="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",Ft=n=>n.replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[e]);function Cs(n,e,r){let o=new URL(r),a=o.pathname.slice(1),i=Math.min(92,Math.floor((Ve-2*We)/(.58*(4+n.name.length)))),s=Ve-2*We,l=392,d=40,c=Lt(r,2).replace("<svg ",`<svg x="${We+d}" y="${l+d}" width="${s-2*d}" height="${s-2*d}" `),p=(u,x,$,h,m,C="")=>`<text x="${u}" y="${x}" font-size="${$}" fill="${h}" font-family="${ks}" ${C}>${m}</text>`;return`<svg xmlns="http://www.w3.org/2000/svg" width="${Ve}" height="${qt}" viewBox="0 0 ${Ve} ${qt}"><rect width="${Ve}" height="${qt}" rx="72" fill="#0b0b0b"/><g transform="translate(${We} ${We})"><rect width="60" height="60" rx="15" fill="#fff"/><g transform="scale(.9375)"><path d="M14 38a18 18 0 0 1 36 0z" fill="#0b0b0b"/><rect x="12" y="43" width="40" height="4" rx="2" fill="#0b0b0b" opacity=".5"/></g></g>`+p(We+82,We+42,36,"#a3a3a3",Ft(e))+p(We,276,i,"#ffffff",`Hi, ${Ft(n.name)}`,'font-weight="600"')+p(We,340,40,"#8a8a8a",`Scan to connect to ${Ft(e)}`)+`<rect x="${We}" y="${l}" width="${s}" height="${s}" rx="52" fill="#ffffff"/>`+c+`<text x="${Ve/2}" y="${l+s+100}" font-size="58" fill="#ffffff" font-family="${$s}" text-anchor="middle">${Ft(a)}</text>`+p(Ve/2,l+s+156,34,"#737373",Ft(o.host),'text-anchor="middle"')+"</svg>"}async function Es(n){let e=new Image;e.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`,await e.decode();let r=document.createElement("canvas");return r.width=Ve,r.height=qt,r.getContext("2d").drawImage(e,0,0,Ve,qt),new Promise((o,a)=>r.toBlob(i=>i?o(i):a(new Error("Could not draw the card")),"image/png"))}async function Fr(n){let e=await G(()=>A.personLinks(n));return e?e.link?{link:e.link,links:e.links??[]}:(U("The personal portal is off. Turn it on in Settings.","warning"),null):null}async function $n(n){let e=await Fr(n);e&&await ue(e.link,"Personal link copied")}async function Kt(n,e,r={}){let o=n.link,a=n.links;if(o===void 0){let m=await Fr(n.id);if(!m)return;o=m.link,a=m.links}if(!o){U("The personal portal is off. Turn it on in Settings.","warning");return}let i=o,s=await G(()=>Es(Cs(n,e,i)));if(!s)return;let l=new File([s],`${n.id}-invite.png`,{type:"image/png"}),d=URL.createObjectURL(s),c=navigator,p=!!c.canShare?.({files:[l]}),u=!p&&typeof c.share=="function"&&(c.canShare?.({url:i})??!0),x=()=>{URL.revokeObjectURL(d),ae()},$=async m=>{try{await c.share(m)}catch{}},h=p?H([b("link")," Share card"],()=>$({files:[l],title:`Invite ${n.name}`}),"positive"):u?H([b("link")," Share link"],()=>$({url:i,title:`Invite ${n.name}`,text:"Your personal VPN link"}),"positive"):H([b("download")," Download card"],()=>Te(l.name,s),"positive");oe(r.title??`Invite ${n.name}`,t("div",{class:"dl-invite"},[t("img",{src:d,alt:`Invite card for ${n.name}`}),t("div",{class:"dl-invite-side"},[t("p",{class:"dl-muted"},r.lead??`Send ${n.name} the card or the link. They open it, add their devices and connect — no account needed.`),t("button",{type:"button",class:"dl-invite-link",title:"Copy link",click:()=>ue(i,"Personal link copied")},[t("span",{},i.replace(/^https:\/\//,"")),b("copy")]),...(a??[]).filter(m=>m!==i).map(m=>t("button",{type:"button",class:"dl-invite-link alt",title:"Copy this link",click:()=>ue(m,"Link copied")},[t("span",{},m.replace(/^https?:\/\//,"")),t("span",{class:`dl-pill ${m.startsWith("http:")?"warn":""}`},m.startsWith("http:")?"HTTP":"Also"),b("copy")])),t("ol",{class:"dl-invite-steps"},[t("li",{},["Install ",t("b",{},"AmneziaVPN")," on the device"]),t("li",{},"Open the link or scan the code"),t("li",{},"Add the device and connect")]),t("div",{class:"dl-invite-actions"},[h,H([b("copy")," Copy link"],()=>ue(i,"Personal link copied"))])])]),[t("button",{class:"cbi-button cbi-button-neutral",click:x},"Done")],"wide")}function Vt(n,e){let r=n.servers.find(d=>d.id===e)??n.servers[0],o=n.people.filter(d=>d.server===r.id),a=new Set(o.map(d=>d.id)),i=o.flatMap(d=>d.devices),s=d=>o.reduce((c,p)=>{let u=d(p);return[c[0]+u[0],c[1]+u[1]]},[0,0]),l=r.series?.[r.series.length-1];return{...n,servers:[r],people:o,series:r.series??n.series,events:n.events.filter(d=>d.person?a.has(d.person):!0),geo:{...n.geo,points:n.geo.points.filter(d=>a.has(d.person))},totals:{people:o.length,devices:i.length,online:i.filter(d=>d.online).length,active:o.filter(d=>d.state==="active").length,today:l?[l.rx,l.tx]:[0,0],month:s(d=>d.month)}}}var qr=3,ho=class{constructor(){this.n=0;this.shown=0}next(){return++this.n}take(e){return e<this.shown?!1:(this.shown=e,!0)}claim(){this.shown=++this.n}};function rt(n){let e=new ho,r=0,o=async(p,u)=>{let x=e.next(),$=null;try{$=await n.fetch(u),r>=qr&&U("The router answers again.","success",3e3),r=0}catch{return++r===qr&&U("The router is not answering: what you see may be out of date.","warning",8e3),null}return $==null||!e.take(x)?null:(n.apply($,p),$)},a=(p=!1)=>o(p,!1),i=()=>document.visibilityState==="visible",s=()=>i()&&(n.active?.()??!0)?o(!0,!1):Promise.resolve(null);poll.add(s,n.every);let l=n.live?gn(()=>void(i()&&(n.active?.()??!0)&&o(!0,!0))):null,d=()=>{poll.remove(s),l?.(),c()},c=$e(d);return{refresh:a,claim:()=>e.claim(),stop:d}}function Dt(n){let e=document.activeElement;return!!n&&!!e&&e!==document.body&&n.contains(e)}function Se(n,e,r=!1){return r&&Dt(n)?!1:(dom.content(n,e),!0)}function Kr(n,e){let r=n,a=t("div",{class:"dl-choices"},[{v:"internet",ic:"globe",text:"Browse the internet through your router. No access to devices at home."},{v:"lan",ic:"home",text:"Reach devices at home (NAS, printer, cameras). Internet stays on their own connection."},{v:"both",ic:"shield",text:"Home devices and the internet, all through your router."}].map(i=>t("button",{type:"button",class:`dl-choice${i.v===r?" selected":""}`,"data-v":i.v,click:()=>{r=i.v,a.querySelectorAll(".dl-choice").forEach(s=>s.classList.toggle("selected",s.dataset.v===i.v)),e?.(i.v)}},[t("span",{class:"dl-choice-title"},[b(i.ic),ct[i.v]]),t("span",{class:"dl-choice-text"},i.text)])));return{el:a,get:()=>r}}function fo(n){try{return localStorage.getItem(n)}catch{return null}}function go(n,e){try{localStorage.setItem(n,e)}catch{}}function Ls(n){let e=n.devices.length,r=Math.max(1,n.device_limit,e),o=Math.min(160,r*22+(r-1)*3);return t("div",{class:"dl-slotbar",title:`${e} of ${n.device_limit} devices`},[t("span",{class:"dl-slotbar-segs",style:`width: ${o}px`},Array.from({length:r},(a,i)=>t("i",{class:i>=n.device_limit?"over":i<e?"used":""}))),t("span",{class:"dl-slotbar-text"},`${e} of ${n.device_limit}`)])}var Vr=n=>n.state==="server_off"?n.paused:!["active","quota","expired"].includes(n.state),vo=n=>n.state==="server_off"?n.paused:n.state!=="active",Jr=n=>vo(n)?n.state==="server_off"?"paused":n.state:null;function Ms(n,e){let r=Ye(n.expires,e);return n.state==="quota"||n.state==="expired"||Ze(n,r)||!!n.quota_limit&&n.quota_used>=n.quota_limit*.9}function Yr(n,e){return bt(n&&Kn(n,e)>=0?n:e,1)}var Zr=n=>n.people.map(e=>e.id).sort().join(" "),Qr=!1,mt=class{constructor(){this.list=t("div",{class:"dl-plist",role:"list"});this.filter=["all","online","attention","paused"].find(e=>e===(new URLSearchParams(location.search).get("filter")??fo("dl.people.filter")))??"all";this.sort=["seen","name","usage"].find(e=>e===fo("dl.people.sort"))??"seen";this.query="";this.noFooter=!0;this.serverId=null;this.el=null}async load(){return A.status(30)}scope(e){return this.serverId?Vt(e,this.serverId):e}embed(e,r){return this.serverId=r,this.render(e)}person(e){return this.st.people.find(r=>r.id===e)}get today(){return Ie(this.st.series)}deviceOpts(e){return{refresh:()=>this.refresh(),geo:this.st.geo,now:this.st.now,today:this.today,core:Tt(this.st.servers,e.server)}}take(e,r){let o=this.scope(e),a=Zr(o)!==Zr(this.st);this.st=o,a?this.rebuild():(this.paintCards(r),this.decorate(r))}async update(){await this.poller?.refresh()}async refresh(){this.poller?.claim();let e=await A.status(30).catch(()=>null);e&&(this.st=this.scope(e),this.rebuild())}rebuild(){let e=new Map;for(let o of Array.from(this.list.children))o.dataset.sid&&e.set(o.dataset.sid,o);let r=this.st.people.map(o=>{let a=e.get(o.id)??t("div",{class:"dl-card",role:"listitem","data-sid":o.id});return this.renderCard(a,o.id)});dom.content(this.list,r.length?r:t("div",{class:"dl-plist-none"},this.st.servers.length?"No people yet. Add someone and send them their personal link.":"Set up the server first, then add people.")),this.decorate()}paintCards(e=!1){for(let r of this.st.people){let o=this.card(r.id);o&&!(e&&Dt(o))&&this.renderCard(o,r.id)}}card(e){return this.list.querySelector(`[data-sid="${CSS.escape(e)}"]`)}render(e){let r=this.scope(e);this.st=r;let o=this,a=t("select",{class:"dl-select","aria-label":"Sort",change:d=>{o.sort=d.target.value,go("dl.people.sort",o.sort),o.decorate()}},[t("option",{value:"seen",selected:o.sort==="seen"?"selected":null},"Last seen"),t("option",{value:"name",selected:o.sort==="name"?"selected":null},"Name"),t("option",{value:"usage",selected:o.sort==="usage"?"selected":null},"Usage")]),i=t("input",{type:"search",class:"cbi-input-text dl-people-find",placeholder:"Find…","aria-label":"Find a person or device",hidden:r.people.length>8?null:"hidden",input:d=>{o.query=d.target.value.trim().toLowerCase(),o.decorate()}}),s=d=>{let c=d.target;d.key==="/"&&!i.hidden&&!["INPUT","TEXTAREA","SELECT"].includes(c?.tagName)&&!c?.isContentEditable&&(d.preventDefault(),i.focus())};document.addEventListener("keydown",s),$e(()=>document.removeEventListener("keydown",s));let l=t("div",{class:"dl-root"},[o.serverId?"":t("div",{class:"dl-pagehead"},[t("div",{class:"dl-stack"},[t("h2",{class:"dl-h1"},"People"),t("span",{class:"dl-muted dl-people-count"},this.countText())]),r.servers.length?H([b("plus")," Add person"],()=>o.openCreate(),"add"):""]),r.servers.length?"":t("div",{class:"alert-message warning"},["No server yet. ",t("a",{href:L.url("admin/network/dawnline/server")},"Run the setup wizard")," before adding people."]),t("div",{class:"dl-toolbar"},[t("div",{class:"dl-seg dl-people-tabs",role:"tablist"}),t("div",{class:"dl-toolbar-end"},[i,a,o.serverId?H([b("plus")," Add person"],()=>o.openCreate(),"add"):""])]),this.list]);return this.el=l,this.rebuild(),this.poller??(this.poller=rt({fetch:()=>A.status(30),every:30,live:!0,active:()=>!!o.el?.isConnected,apply:(d,c)=>o.take(d,c)})),!Qr&&new URLSearchParams(location.search).get("add")&&(Qr=!0,setTimeout(()=>o.openCreate(),100)),Promise.resolve(l)}countText(){let e=this.st.totals;return`${e.people} ${e.people===1?"person":"people"} · ${e.devices} device${e.devices===1?"":"s"} · ${e.online} online`}decorate(e=!1){let r=this.el?.querySelector(".dl-people-count");r&&(r.textContent=this.countText());let o=this.st.people,a=this.today,i=m=>Ms(m,a),s={all:o.length,online:o.filter(m=>m.online>0).length,attention:o.filter(i).length,paused:o.filter(m=>Vr(m)).length},l=this.el?.querySelector(".dl-people-tabs");if(l&&!(e&&Dt(l))){let m={all:"All",online:"Online",attention:"Needs attention",paused:"Paused"};dom.content(l,Object.keys(m).map(C=>t("button",{type:"button",role:"tab",class:C===this.filter?"on":"",click:()=>{this.filter=C,go("dl.people.filter",C),this.decorate()}},[m[C],t("b",{class:C==="attention"&&s[C]?"warn":""},String(s[C]))])))}let d=this.query,c=m=>[m.name,m.note??"",...m.devices.flatMap(C=>[C.name,C.address,C.hostname,C.endpoint])].join(" ").toLowerCase(),p=m=>!(this.filter==="online"&&!m.online||this.filter==="attention"&&!i(m)||this.filter==="paused"&&!Vr(m)||d&&!c(m).includes(d)),u=m=>Jr(m)==="paused"?2:vo(m)?1:0,x=[...o].sort((m,C)=>u(m)-u(C)||(this.sort==="name"?m.name.localeCompare(C.name):this.sort==="usage"?C.month[0]+C.month[1]-(m.month[0]+m.month[1]):C.online-m.online||C.last_seen-m.last_seen)),$=0;for(let m of x){let C=this.card(m.id);if(!C)continue;this.list.appendChild(C),C.classList.toggle("dl-off",vo(m));let B=p(m);C.classList.toggle("dl-filtered",!B),B&&$++}let h=this.el?.querySelector(".dl-people-none")??null;o.length&&!$?(h??(h=t("div",{class:"dl-empty dl-people-none"},t("p",{},"No one here right now."))),h.previousElementSibling!==this.list&&this.list.after(h)):h?.remove()}async quick(e,r,o){await G(()=>A.personUpdate(e.id,r),o)&&await this.update()}renderCard(e,r){let o=this.person(r);if(!o)return dom.content(e,t("em",{},"This person was just removed.")),e;let a=this.today,i=Ye(o.expires,a),s=Math.max(0,o.device_limit-o.devices.length),l=o.has_link??this.st.settings.portal_enabled,d=[],c=Jr(o);if(o.expires&&c!=="expired"){let h=Ze(o,i),m=i!=null&&i<0;d.push(t("span",{class:`dl-pill-ic${m?" bad":h?" warn":""}`,title:`Access ends ${Me(o.expires)}`},[b("calendar"),m?`ended ${Me(o.expires)}`:h?en(i):`until ${Me(o.expires)}`]))}o.hours&&c!=="hours"&&d.push(t("span",{class:"dl-pill-ic",title:"Allowed hours"},[b("clock"),o.hours.replace("-","–")]));let p=nn(o.devices).map(h=>t("button",{type:"button",class:`dl-chip${h.disabled?" disabled":""}${h.online?" live":""}`,title:`${Qe[h.kind]} · ${h.address}${h.online?` · online from ${h.endpoint}`:h.handshake?` · seen ${re(h.handshake,this.st.now)}`:""}`,click:m=>{m.preventDefault(),Ge(o,h,this.deviceOpts(o))}},[b(h.kind),t("span",{class:"dl-chip-name"},h.name),!h.handshake&&!h.disabled?t("span",{class:"dl-chip-tag"},"not set up"):""]));p.push(t("button",{type:"button",class:"dl-chip add",title:s>0?"Add device":"Over the limit: admins can still add",click:h=>{h.preventDefault(),ot(o,this.deviceOpts(o))}},[b("plus"),"Add device"]));let u=[];o.expires&&Ze(o,i)&&c!=="expired"&&u.push(t("button",{type:"button",class:"dl-fix",click:()=>this.quick(o,{expires:Yr(o.expires,a)},"Extended by 1 month")},"Extend 1 month"));let x=Le("more","More",h=>Ce(h.currentTarget,[{label:"Open",icon:b("open"),run:()=>{location.href=ke(o.id)}},l?{label:"Invite card",icon:b("qr"),run:()=>Kt(o,this.st.servers.find(m=>m.id===o.server)?.name??"Home")}:null,s>0?{label:"Add device",icon:b("plus"),run:()=>ot(o,this.deviceOpts(o))}:null,null,{label:o.paused?"Resume":"Pause",icon:b(o.paused?"play":"pause"),warn:!o.paused,run:()=>this.togglePause(o)},{label:"Delete",icon:b("trash"),danger:!0,run:()=>this.remove(o.id)}].filter((m,C,B)=>m||C>0&&B[C-1])),"neutral","dl-icon-only"),$=t("div",{class:"dl-pcard-actions"},[l?Le("link","Copy link",()=>$n(o.id),"neutral","dl-icon-only"):"",x]);return dom.content(e,t("div",{class:"dl-pcard"},[t("div",{class:"dl-pcard-main"},[t("div",{class:"dl-pcard-top"},[t("span",{class:`dl-avatar${o.online?" online":""}`},He(o.name)),t("div",{class:"dl-pcard-who"},[t("div",{class:"dl-card-head"},[t("a",{class:"dl-card-name",href:ke(o.id)},o.name),Bo(o),...d]),Ls(o)])]),t("div",{class:"dl-chips"},p),u.length?t("div",{class:"dl-fixes"},u):""]),this.usageSide(o,$),c?this.stopStrip(o,c):""])),e}stopStrip(e,r){let o=this.today,a=bt(`${o.slice(0,8)}01`,1),i=()=>this.quick(e,{bonus_gb:String((e.bonus_gb||0)+10)},"+10 GB this month"),s={paused:["pause","warn","Paused","Devices can’t connect until you resume",["play","Resume",()=>this.togglePause(e)]],quota:e.quota_period==="month"?["chart","bad","Data limit reached",`Paused until it resets on ${Me(a)}`,["plus","+10 GB this month",i]]:["chart","bad","Data limit reached","Paused until the limit is raised",["edit","Change limit",()=>location.href=ke(e.id)]],expired:["calendar","bad",`Access ended ${Me(e.expires)}`,"Devices can’t connect",["calendar","Extend 1 month",()=>this.quick(e,{expires:Yr(e.expires,o)},"Extended by 1 month")]],hours:["clock","warn","Outside allowed hours",`Access ${e.hours.replace("-","–")} (router time)`,null],no_server:["alert","warn","No server","Choose a server on their page",null]},[l,d,c,p,u]=s[r];return t("div",{class:`dl-pstrip ${d}`},[t("span",{class:`dl-need-ic ${d}`},b(l)),t("span",{class:"dl-pstrip-text"},[t("b",{},c),t("span",{class:"dl-faint"},p)]),u?H([b(u[0]),` ${u[1]}`],u[2]):""])}usageSide(e,r){let o=e.quota_used||e.month[0]+e.month[1],a=e.quota_limit?Math.min(100,e.quota_used/e.quota_limit*100):0,i=e.devices.reduce((p,u)=>p+(u.spark[u.spark.length-1]??0),0),s=e.rate?.[e.rate.length-1],l=e.online&&s&&this.st.now-s[0]<180,d=t("div",{class:`dl-usebar${a>=100?" bad":a>=90?" warn":""}`});if(e.quota_limit){let p=t("i",{class:"fill"});p.style.width=`${a}%`,d.appendChild(p),me(d,()=>[t("div",{class:"dl-tip-title"},`${a.toFixed(1)}% used`),t("div",{class:"dl-muted"},`${ee(e.quota_used)} of ${ee(e.quota_limit)} · ${ee(Math.max(0,e.quota_limit-e.quota_used))} left`),t("div",{class:"dl-faint"},e.quota_period==="total"?"In total":`This month${e.bonus_gb?` · includes +${e.bonus_gb} GB extra`:""}`)])}else{let p=e.devices.map(u=>({d:u,v:u.month[0]+u.month[1]})).filter(u=>u.v>0).sort((u,x)=>x.v-u.v);p.forEach((u,x)=>{let $=t("i",{class:`c${Math.min(x,4)}`});$.style.flexGrow=String(u.v),d.appendChild($)}),p.length&&me(d,()=>[t("div",{class:"dl-tip-title"},"This month by device"),...p.map((u,x)=>t("div",{class:"dl-tip-row"},[t("span",{class:`dl-swatch c${Math.min(x,4)}`}),t("span",{},u.d.name),t("b",{},ee(u.v))]))])}let c=e.quota_limit?`${ee(Math.max(0,e.quota_limit-e.quota_used))} left`:"no limit";return t("div",{class:"dl-pside"},[t("div",{class:"dl-pside-top"},[l?t("span",{class:"dl-pside-state live"},"Online"):t("span",{class:"dl-pside-state"},e.online?"Online":e.last_seen?"Offline":"Never connected"),r]),t("div",{class:"dl-use-num"},[t("b",{class:o?"":"dl-faint"},ee(o)),t("span",{class:"dl-faint"},e.quota_limit?`of ${ee(e.quota_limit)}`:e.quota_period==="total"&&e.quota_gb?"in total":"this month")]),d,l?t("div",{class:"dl-use-live",title:"Right now"},[`↓ ${Oe(s[2])}`,t("span",{class:"dl-faint"},`↑ ${Oe(s[1])}`)]):t("div",{class:"dl-faint dl-pside-foot"},i?`today ${ee(i)} · ${c}`:c)])}async togglePause(e){await G(()=>A.personPause(e.id,!e.paused),e.paused?`${e.name} resumed`:`${e.name} paused`)&&await this.refresh()}async remove(e){let r=this.person(e);await le(`Remove ${r?.name??e}?`,`All ${r?.devices.length??0} devices are disconnected immediately and the personal link stops working. Usage history is kept in backups.`,"Remove",!0)&&await G(()=>A.personDelete(e),"Person removed")&&await this.refresh()}openCreate(){let e=this.st;if(!e.servers.length){U("Set up the server first.","warning");return}let r=t("input",{type:"text",class:"cbi-input-text",placeholder:"e.g. Myata",maxlength:48}),o=(()=>{try{return JSON.parse(fo("dl.person.last")??"{}")}catch{return{}}})(),a=Kr(o.access??"internet"),i=t("input",{type:"number",class:"cbi-input-text",min:1,max:32,value:e.settings.default_device_limit}),s=t("input",{type:"date",class:"cbi-input-text"}),l=t("input",{type:"number",class:"cbi-input-text",min:0,step:"any",placeholder:"Unlimited",value:o.quota??""}),d=(w,v)=>t("button",{type:"button",class:"cbi-button cbi-button-neutral",click:()=>{s.value=v?bt(Ie(e.series),v):"",s.dispatchEvent(new Event("change"))}},w),c=e.servers[0],p=!this.serverId&&e.servers.length>1?t("select",{class:"cbi-input-select"},e.servers.map(w=>t("option",{value:w.id},w.name))):null,u=(w,v,y)=>t("div",{class:"cbi-value"},[t("label",{class:"cbi-value-title"},w),t("div",{class:"cbi-value-field"},[v,y?t("div",{class:"cbi-value-description"},y):""])]),x=Ie(e.series),$=ye("Name",r,()=>_e(r.value,[],"Shown in their portal and apps.")),h=ye("Devices",i,()=>ln(i.value)),m=ye("End date",s,()=>Ko(s.value,x,Ye,Me),t("div",{class:"dl-actions"},[s,d("1 month",1),d("3 months",3),d("1 year",12),d("None",0)])),C=ye("Monthly data (GB)",l,()=>dn(l.value));s.addEventListener("change",()=>m.refresh());let B=e.settings.portal_enabled;oe("Add person",[$,p?u("Server",p):"",t("div",{class:"cbi-value dl-block"},[t("label",{class:"cbi-value-title"},"Access"),t("div",{class:"cbi-value-field"},a.el)]),h,m,C],[ie()," ",H(B?"Create and copy link":"Create",async()=>{let w=ze([$,h,m,C]);if(w){U(w,"warning");return}let v=await G(()=>A.personCreate(r.value.trim(),"",p?.value??c.id,a.get(),i.value.trim(),s.value,l.value.trim(),"month"));v&&(go("dl.person.last",JSON.stringify({access:a.get(),quota:l.value.trim()})),v.link&&await ue(v.link,"Personal link copied",!0),this.showCreated(v.id,r.value.trim(),v.link,e.servers.find(y=>y.id===(p?.value??c.id))?.name??c.name),await this.refresh())},"positive")]),setTimeout(()=>r.focus(),50)}showCreated(e,r,o,a){if(o){Kt({id:e,name:r,link:o},a,{title:`${r} is ready`,lead:`Send ${r} the card or the link. They open it, add their devices and connect — no account needed.`});return}let i=this.person(e);oe(`${r} is ready`,[t("p",{},"Created. Turn on the personal portal in Settings to get a link, or add devices for them here.")],[t("button",{class:"cbi-button cbi-button-neutral",click:ae},"Done")," ",t("a",{class:"cbi-button cbi-button-neutral",href:`${L.url("admin/network/dawnline/settings")}?section=portal`},"Open Settings")," ",i?H("Add device",()=>{ae(),ot(i,this.deviceOpts(i))},"positive"):""])}};var Cn=["#3a83f7","#a78bfa","#f472b6","#f59e0b","#10b981","#22d3ee","#ef4444","#84cc16"],bo=n=>t("i",{class:"dl-circle-dot",style:`background:${Cn[n?.color??0]??Cn[0]}`}),at=n=>n.access==="both"||n.access==="lan"&&!n.services?.length;function Xr(n,e,r){let o=se(n?.name??e.name??"",{placeholder:"NAS"}),a=se(n?.address??e.address??"",{placeholder:"192.168.1.10",class:"cbi-input-text dl-mono"}),i=se((n?.ports??e.ports??[]).join(", "),{placeholder:"All ports, or e.g. 445, 5000",class:"cbi-input-text dl-mono"}),s=ye("Name",o,()=>_e(o.value,[],"Shown to people who may reach it.")),l=ye("Address",a,()=>Vo(a.value)),d=ye("Ports",i,()=>Jo(i.value));oe(n?`Edit ${n.name}`:"Add service",[s,l,d],[ie()," ",H("Save",async()=>{let c=ze([s,l,d]);if(c){U(c,"warning");return}let p=i.value.split(/[ ,]+/).filter(Boolean);await G(()=>A.serviceSet(n?.id??"",o.value,a.value,p),"Saved")&&(ae(),r())},"positive")])}var Ss={_smb:"SMB",_afpovertcp:"AFP",_http:"Web",_https:"Web",_ssh:"SSH",_sftp:"SFTP","_sftp-ssh":"SFTP",_ipp:"Printer",_ipps:"Printer",_printer:"Printer","_pdl-datastream":"Printer",_airplay:"AirPlay",_raop:"AirPlay",_rfb:"Screen sharing",_googlecast:"Cast",_hap:"HomeKit",_rdp:"Remote desktop",_ftp:"FTP"},Ts=[["Web",["80","443"]],["SMB",["445"]],["SSH",["22"]]];function _s(n){let e=new Map;for(let r of n.services){let o=Ss[r.type.split(".")[0]];!o||!r.port||(e.get(o)??e.set(o,new Set).get(o)).add(String(r.port))}return e.size?[...e].map(([r,o])=>[r,[...o].sort((a,i)=>+a-+i)]):Ts}function ea(n,e,r){let o=n,a=null,i=!1,s=null,l=new Set,d=t("div",{class:"dl-list"}),c=t("div",{class:"dl-stack gap8"},t("span",{class:"dl-sub"},"Looking for devices at home…")),p=()=>{let m=o.services;dom.content(d,m.length?m.map(C=>t("div",{class:"dl-row"},[b("home"),t("span",{class:"dl-row-main dl-stack"},[t("b",{},C.name),t("span",{class:"dl-mono dl-faint"},`${C.address}${C.ports.length?` · ports ${C.ports.join(", ")}`:" · all ports"}`)]),H("Edit",()=>Xr(C,{},r)),H([b("trash")],async()=>{await le(`Remove ${C.name}?`,"People limited to this service lose access to it.","Remove",!0)&&await G(()=>A.serviceDelete(C.id),"Removed")&&await r()},"neutral",{title:"Remove","aria-label":`Remove ${C.name}`})])):[t("div",{class:"dl-row dl-muted"},"No services yet: pick ports of a device below.")])};async function u(m,C){if(!l.has(m.address)){l.add(m.address),$();try{let B=o.services.find(v=>v.address===m.address);(C===null?B&&await G(()=>A.serviceDelete(B.id),`${B.name} removed`):await G(()=>A.serviceSet(B?.id??"",B?.name??(m.name||m.address),m.address,C),B?`${B.name} updated`:`${m.name||m.address} added`))&&await r()}finally{l.delete(m.address),$()}}}function x(m){let C=o.services.find(E=>E.address===m.address),B=!!C&&!C.ports.length,w=new Set(C?.ports??[]),v=l.has(m.address),y=(E,k,z)=>qe(E,k,z,{disabled:v?"disabled":null,"aria-busy":v?"true":null});return t("div",{class:"dl-row"},[b(m.services.some(E=>E.type.startsWith("_ipp")||E.type.startsWith("_printer"))?"file":"computer"),t("span",{class:"dl-row-main dl-stack"},[t("b",{},m.name||m.address),t("span",{class:"dl-mono dl-faint"},m.address)]),t("div",{class:"dl-chips-row dl-host-ports"},[y("All ports",B,()=>u(m,B?null:[])),..._s(m).map(([E,k])=>{let z=!B&&k.every(f=>w.has(f));return y(`${E} ${k.join(", ")}`,z,()=>{let f=new Set(B?[]:w);for(let g of k)z?f.delete(g):f.add(g);u(m,f.size?[...f]:null)})})])])}function $(){if(i)return dom.content(c,t("span",{class:"dl-sub"},"Couldn't read the devices at home."));if(!a)return;let m=a;if(!m.hosts.length)return dom.content(c,t("span",{class:"dl-sub"},"No devices found in the home network right now."));let C=t("details",{class:"dl-params",open:s??!o.services.length?"":null},[t("summary",{},[b("chevron"),t("span",{},"Add from devices at home"),t("span",{class:"dl-pcount"},String(m.hosts.length))]),t("div",{class:"dl-params-body"},[t("span",{class:"dl-sub"},m.mdns?"Ports they announce over Bonjour. Pick what to open, or all ports.":"Devices that got an address from this router. Pick the ports to open, or all ports."),t("div",{class:"dl-list"},m.hosts.map(x))])]);C.addEventListener("toggle",()=>s=C.open),dom.content(c,C)}return A.homeHosts(e).then(m=>{a=m,$()}).catch(()=>{i=!0,$()}),p(),{el:t("div",{class:"dl-stack gap8"},[t("div",{class:"dl-iflead"},[t("div",{class:"dl-iflead-row"},[t("b",{},"Home services"),H([b("plus")," Add service"],()=>Xr(null,{},r))]),t("span",{class:"dl-sub"},"Home-only people can be limited to these instead of whole networks (chosen on their page). Shared by all servers.")]),d,c]),update(m){o=m,p(),$()}}}function En(n,e,r,o){let a=new Set(n.circles.filter(m=>m.server===e).map(m=>m.color)),i=r?.color??Cn.findIndex((m,C)=>!a.has(C));i<0&&(i=0);let s=se(r?.name??"",{placeholder:"Family"}),l=n.people.filter(m=>m.server===e).sort((m,C)=>m.name.localeCompare(C.name)),d=new Set(l.filter(m=>r&&m.circle===r.id).map(m=>m.id)),c=t("div",{class:"dl-swatches",role:"radiogroup","aria-label":"Colour"}),p=()=>dom.content(c,Cn.map((m,C)=>t("button",{type:"button",role:"radio",class:`dl-swatch${C===i?" on":""}`,style:`--sw:${m}`,"aria-checked":C===i?"true":"false","aria-label":`Colour ${C+1}`,click:()=>{i=C,p()}})));p();let u=t("div",{class:"dl-chips-row"},l.map(m=>{let C=m.circle&&m.circle!==r?.id?n.circles.find(B=>B.id===m.circle):void 0;return t("button",{type:"button",class:`dl-chipbtn${d.has(m.id)?" on":""}`,title:at(m)?C?`Now in ${C.name}`:"":`${m.name} has no home access: their devices aren't reachable anyway`,click:B=>{d.delete(m.id)||d.add(m.id),B.currentTarget.classList.toggle("on",d.has(m.id))}},[m.name,at(m)?C?t("b",{},C.name):"":t("b",{},"internet")])})),x=(m,C)=>t("div",{class:"cbi-value"},[t("label",{class:"cbi-value-title"},m),t("div",{class:"cbi-value-field"},C)]),$=n.circles.filter(m=>m.server===e&&m.id!==r?.id).map(m=>m.name),h=ye("Name",s,()=>Go(s.value,$));oe(r?`Edit ${r.name}`:"New circle",[h,x("Colour",c),x("People",u),t("p",{class:"dl-sub"},"Devices of people in one circle reach each other. A person is in one circle at a time.")],[r?H("Delete",async()=>{await G(()=>A.circleDelete(r.id),`${r.name} deleted`)&&(ae(),o())},"negative"):"",t("span",{class:"dl-spacer"}),ie()," ",H("Save",async()=>{let m=h.help();if(m.bad){U(m.text,"warning");return}await G(()=>A.circleSet(r?.id??"",e,s.value,i,[...d]),"Saved")&&(ae(),o())},"positive")],"dl-circle-modal")}function ta(n,e,r){let o=n.circles.filter(a=>a.server===e);return t("div",{class:"dl-chips-row dl-circles"},[...o.map(a=>{let i=n.people.filter(s=>s.circle===a.id).map(s=>s.name);return t("button",{type:"button",class:"dl-chip",title:`Edit ${a.name}`,click:()=>En(n,e,a,r)},[bo(a),t("b",{},a.name),t("span",{class:"dl-faint"},i.length?i.join(", "):"nobody yet")])}),t("button",{type:"button",class:"dl-chip add",title:"New circle","aria-label":"New circle",click:()=>En(n,e,null,r)},b("plus"))])}function xo(n,e){let r=n.people.filter(p=>p.server===e.id),o=(p="")=>t("span",{class:"dl-yes"},[b("check"),p]),a=()=>t("span",{class:"dl-faint"},"—"),i=p=>{let u=new Set(p.map(x=>x.access==="lan"&&x.services?.length?"services":x.home_nets?.length?"some":"all"));return u.size||u.add("all"),o([...u].map(x=>({all:"all networks",some:"their networks",services:"services"})[x]).join(" / "))},s=()=>e.mesh==="off"?a():e.mesh==="circles"?o("circle"):o(),l=e.lan_like?"like home":"direct",d=(p,u,x)=>t("tr",{},[t("td",{},[t("b",{},p),t("div",{class:"dl-sub"},`${u.length} ${u.length===1?"person":"people"}`)]),...x.map($=>t("td",{},$))]),c=p=>r.filter(u=>u.access===p);return t("section",{class:"dl-setsec"},[t("div",{class:"dl-setsec-body"},[t("div",{class:"dl-panel-head"},[t("h3",{},"Who reaches what"),t("span",{class:"dl-spacer"}),t("span",{class:"dl-sub"},"From the rules on this server")]),t("div",{class:"dl-reach-wrap"},t("table",{class:"dl-table dl-reach"},[t("tr",{},["","Internet","Home","This router","Each other"].map(p=>t("th",{},p))),d("Internet",c("internet"),[o(l),a(),t("span",{class:"dl-faint"},"DNS"),a()]),d("Home",c("lan"),[t("span",{class:"dl-faint"},"their own"),i(c("lan")),o(),s()]),d("Both",c("both"),[o(l),i(c("both")),o(),s()])])),t("p",{class:"dl-sub"},"Home devices reach the devices of people with home access, on the networks those people reach. Paused, ended and over-the-limit people reach nothing.")])])}function na(n,e){let r=n.people.filter(c=>c.server===e.id).flatMap(c=>c.devices.map(p=>({id:p.id,label:`${c.name} · ${p.name}`}))).sort((c,p)=>c.label.localeCompare(p.label)),o="@addr",a=(c,p)=>{let u=t("select",{class:"cbi-input-select","aria-label":c},[...r.map(m=>t("option",{value:m.id,selected:m.id===p?"selected":null},m.label)),t("option",{value:o,selected:p===o?"selected":null},"Address")]),x=se("",{placeholder:c,class:"cbi-input-text dl-mono"}),$=t("div",{class:"dl-check-end"},[u,x]),h=()=>x.hidden=u.value!==o;return u.addEventListener("change",h),h(),{el:$,value:()=>u.value===o?x.value.trim():u.value}},i=a("10.0.1.11",r[0]?.id??o),s=a("10.0.1.20:445",o),l=t("div",{class:"dl-stack gap8"}),d=async()=>{let c=await G(()=>A.accessCheck(i.value(),s.value()));if(!c)return;let p=c.steps.findIndex(u=>!u.ok);dom.content(l,[t("div",{class:`dl-verdict ${c.ok?"ok":"bad"}`},[t("b",{},c.ok?"Allowed":"Blocked"),t("span",{class:"dl-sub"},c.ok?"Every step lets it through":`Stops at step ${p+1} of ${c.steps.length}`)]),t("ul",{class:"dl-checks"},c.steps.map(u=>t("li",{},[t("span",{class:`dl-check-icon ${u.ok?"ok":"error"}`},b(u.ok?"check":"x")),t("div",{class:"dl-check-body"},[t("div",{class:"dl-check-title"},u.title),u.detail?t("div",{class:"dl-check-detail"},u.detail):""])])))])};return t("section",{class:"dl-setsec"},[t("div",{class:"dl-setsec-body"},[t("div",{class:"dl-panel-head"},[t("h3",{},"Check access"),t("span",{class:"dl-spacer"}),t("span",{class:"dl-sub"},"Why something does or does not connect")]),t("div",{class:"dl-check-form"},[i.el,t("span",{class:"dl-faint"},"→"),s.el,H("Check",d)]),l])])}var Ln={app:"Dawnline",amneziawg:"AmneziaWG",packages:"System packages",pkgs:"System packages"};function it(n){return(n.startsWith("check")?n.slice(6)||"all":n).split(/[:@ ]/)[0]}function Mn(n){return it(n.action==="check"?`check:${n.component??""}`:n.component??"")}function oa(n){return n=Math.max(0,Math.floor(n)),`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function ra(n,e){return!n?.from&&!n?.to?e:n.from&&n.to&&n.from!==n.to?`${n.from} → ${n.to}`:n.to??n.from??e}function aa(n,e){let r=n.check?.components??{},o=e==="all"?["app","amneziawg","packages"]:[e],a=[],i;for(let l of o){let d=r[l];if(d){if(d.error)return{tone:"warn",text:d.error};l==="packages"&&d.updates?a.push(`${d.updates} system package${d.updates===1?"":"s"}`):l!=="packages"&&d.update&&d.installed&&d.latest&&(a.push(`${Ln[l]} ${d.latest}`),e!=="all"&&(i=d.latest))}}if(a.length)return{tone:"acc",text:`Update available: ${a.join(", ")}`,update:i};let s=o.length===1?r[o[0]]:null;return s?.status==="dev"?{tone:"acc",text:`Installed version is newer than the release (${s.latest})`}:s?.note?{tone:"warn",text:s.note}:{tone:"ok",text:o.length>1?"Everything is up to date":"Latest version is installed"}}function ia(n,e,r,o){return e?n.id===e:r&&n.id===r?!1:n.state==="running"||o>0&&n.started>=o}var sa=n=>new Promise(e=>setTimeout(e,n));async function Jt(n,e,r){let o=r?Mn(r):it(n),a=r?r.action==="check":n.startsWith("check"),i=Date.now(),s=t("b",{},Ln[o]??(o==="all"?"All components":"Dawnline")),l=t("span",{class:"dl-pill dl-mono"},e.version??""),d=t("span",{class:"dl-pill info",hidden:!0}),c=t("span",{},"0:00"),p=t("pre",{class:"dl-log"},"Operation started. Waiting for log output…"),u=t("div",{}),x=t("div",{class:"dl-op-actions"}),$=[],h=f=>dom.content(x,f),m=(f=!1)=>ie("Close",f);oe(e.title,t("div",{class:"dl-op"},[t("div",{class:"dl-op-head"},[s,e.version?l:"",d,t("span",{class:"dl-spacer"}),t("span",{class:"dl-faint dl-op-timer"},[b("clock"),c])]),t("div",{class:"dl-op-loghead"},[t("b",{},"Operation log"),Le("copy","Copy log",()=>ue($.join(`
`),"Log copied"))]),p,u]),[x],"wide"),h([t("button",{class:"cbi-button cbi-button-neutral spinning",type:"button",disabled:"disabled"},a?"Checking…":"Working…")]);let C=r??null,B=r?.id,w,v=0,y=f=>{B!==f.id&&(B=f.id,e.onJob?.(f))};if(r)e.onJob?.(r);else try{let f=await A.updatesStatus().catch(()=>null);w=f?.job?.id,v=f?.now??0;let g=await A.updatesRun(n);g.job&&g.job.state==="running"&&g.job.id!==w&&(C=g.job,y(g.job))}catch(f){return $=[be(f)],p.textContent=$[0],dom.content(u,t("div",{class:"dl-comp-status warn"},[b("alert"),t("span",{},be(f))])),h([m(!0)]),U(be(f),"error"),null}let E=null,k=0;for(;;){if(await sa(1e3),E=await A.updatesStatus().catch(()=>null),!E){if(++k>60)break;continue}k=0;let f=E.job;if(!f||!ia(f,B,w,v)){if(Date.now()-i>15e3)break;continue}if(y(f),C=f,f.log.length){$=f.log;let g=p.scrollTop+p.clientHeight>=p.scrollHeight-8;p.textContent=$.join(`
`),g&&(p.scrollTop=p.scrollHeight)}if(l.textContent=ra(f,e.version??""),!l.isConnected&&l.textContent&&s.after(l),c.textContent=oa((f.finished??E.now)-f.started),f.state==="running"){d.hidden=!f.phase,d.textContent=f.phase;continue}break}if(p.scrollTop=p.scrollHeight,d.hidden=!1,!C||C.state==="running")return d.className="dl-pill warn",d.textContent="No answer",dom.content(u,t("div",{class:"dl-comp-status warn"},[b("alert"),t("span",{},"The router stopped answering. The job may still finish: reopen Components in a minute.")])),h([m()]),e.onDone?.(E),C;if(C.state==="failed")return d.className="dl-pill bad",d.textContent="Failed",dom.content(u,t("div",{class:"dl-comp-status bad"},[b("x"),t("span",{},[t("b",{},C.error??"Operation failed"),a?"":". Nothing else was changed."])])),h([H("Copy log",()=>ue($.join(`
`),"Log copied")),m(!0)]),U(`${Ln[o]??"Update"}: ${C.error??"failed"}`,"error"),e.onDone?.(E),C;if(d.className="dl-pill ok",d.textContent="Finished",a&&E){let f=aa(E,o);if(dom.content(u,t("div",{class:`dl-comp-status ${f.tone}`},[b(f.tone==="ok"?"check":f.tone==="warn"?"alert":"download"),t("span",{},f.text)])),U(f.text,f.tone==="warn"?"warning":"success"),e.onDone?.(E),f.update&&e.onUpdate){let g=E;h([m(),H(`Update to ${f.update}`,()=>e.onUpdate(g),"positive")])}else h([m()]),f.tone==="ok"&&setTimeout(()=>u.isConnected&&ae(),1200);return C}if(o==="app"&&C.to){let f=C.to,g=t("span",{},"Waiting for the router to restart its services…");dom.content(u,t("div",{class:"dl-comp-status ok"},[b("check"),t("span",{},[t("b",{},`Dawnline ${f} is installed. `),g])]));let S=()=>{ui.menu?.flushCache(),location.reload()};h([m(),H("Reload now",S,"positive")]),U(`Dawnline updated to ${f}`,"success",6e3);for(let T=1;T<=30;T++)if(g.textContent=`Waiting for the router to restart its services (${T} of 30)…`,await sa(1500),(await A.updatesStatus().catch(()=>null))?.version===f)return g.textContent="Services are back. Reloading…",setTimeout(S,800),C;return g.textContent="Services restarted. Reload the page to use the new version.",C}let z=o==="pkgs"?`Updated ${[...C.result?.pkgs?.updated??[],...C.result?.pkgs?.installed??[]].join(", ")||"system packages"}`:o==="amneziawg"?`AmneziaWG${C.to?` ${C.to}`:""} is installed`:"Operation completed";return dom.content(u,t("div",{class:"dl-comp-status ok"},[b("check"),t("span",{},z)])),h([m()]),U(z,"success"),e.onDone?.(E),C}var Ps={https:"HTTPS for the portal",acme:"ACME certificates",home:"the home-like link",awg:"AmneziaWG"};async function la(n,e,r,o){return!await le(`Install ${e}?`,r,"Install")||(await Jt(n,{title:`Installing ${e}`}))?.state!=="done"?!1:(setTimeout(()=>o?.(),4e3),!0)}function Sn(n){return la("amneziawg:auto","AmneziaWG","Dawnline installs the AmneziaWG build made for this firmware and loads it. If the network service has to restart to learn it, connections drop for a few seconds.",n)}async function Yt(n,e,r){return n==="awg"?Sn(r):e.length?la(`pkgs:${e.join(",")}`,Ps[n],`${e.join(", ")} from the OpenWrt feeds. Dawnline sets the rest up when they arrive.`,r):!0}async function da(n,e){if(n==="awg")return Sn(e);let r=await G(()=>A.updatesStatus());return r?Yt(n,r.needs?.[n]??[],e):!1}var Ds=[["wan","WAN"],["ethernet","Ethernet"],["wifi","Wi-Fi"],["vpn","VPN & tunnels"],["other","Other"]],As={wan:"globe",ethernet:"ethernet",bridge:"bridge",wifi:"wifi",vpn:"tunnel",other:"link"};function ca(n,e,r){let o=n.id,a=e,i=t("div",{class:"dl-stack gap16"},t("section",{class:"dl-setsec"},t("div",{class:"dl-setsec-body"},t("p",{class:"dl-muted"},"Loading interfaces…")))),s,l=!0,d="",c=!0,p=!0,u="all",x=!1,$=ea(a,o,r),h=new Set,m="",C=()=>JSON.stringify([p,l,l?"":d,c,[...h].sort()]),B=()=>s.detected.lan||s.saved.lan||"",w=()=>(l?s.detected.wan||s.saved.wan:d)||"",v=()=>new Map(s.devices.map(R=>[R.name,R])),y=()=>{let R=v();return[...c&&B()?[B()]:[],...[...h].filter(Z=>Z!==B())].filter(Z=>Z!==w()).map(Z=>R.get(Z)??{name:Z,nets:[],missing:!0})},E=(R,K)=>{s=R,K&&(l=R.config.auto_wan,d=R.config.wan_device||R.detected.wan||R.saved.wan||"",c=R.config.auto_lan,p=R.config.lan_like,u=R.config.mesh??(R.config.device_mesh?"all":"off"),h=new Set(R.config.lan_devices),m=C()),q()},k=async R=>{let K=await A.interfaces(o).catch(Z=>(U(Z.message,"error"),null));K&&E(K,R)};function z(R){let K=c&&R.name===B(),Z=!!R.own||!!R.master||R.name===w()||K;return K||h.has(R.name)||!Z&&(R.nets.length>0||!!R.missing)}function f(R){let K=c&&R.name===B(),Z=R.name===w(),de=!K&&h.has(R.name),te=!(!!R.own||!!R.master||Z||K)&&(R.nets.length>0||de||!!R.missing),ge=(de||K)&&!R.zone&&!R.missing,O=R.missing?"Not present right now":R.own?"This server":R.master?`Port of ${R.master}`:Z?`Internet${R.zone?` · zone ${R.zone}`:""}`:R.nets.length?R.nets.join(", "):"No IPv4 network",X=t("button",{type:"button",class:`dl-if${de?" sel":""}${K?" auto":""}${!te&&!de&&!K?" off":""}${ge?" warn":""}`,"aria-pressed":de||K?"true":"false","aria-disabled":te?null:"true",click:()=>{te&&(h.has(R.name)?h.delete(R.name):h.add(R.name),q())}},[t("span",{class:"dl-if-ic"},b(As[R.kind]??"link")),t("span",{class:"dl-if-main"},[t("span",{class:"dl-if-name"},R.name),t("span",{class:"dl-if-sub"},O)]),K?t("span",{class:"dl-if-badge ok"},"Auto"):de?t("span",{class:"dl-if-check"},b("check")):""]);return me(X,()=>[t("div",{class:"dl-tip-title"},R.name),t("div",{class:"dl-muted"},[R.logical?`Interface ${R.logical}`:"No netifd interface",R.zone?` · zone ${R.zone}`:" · no firewall zone"]),R.members.length?t("div",{class:"dl-muted"},`Ports: ${R.members.join(", ")}`):"",R.nets.length?t("div",{class:"dl-mono"},R.nets.join(", ")):"",ge?t("div",{class:"dl-warn"},"Not in a firewall zone: the firewall rejects this traffic."):"",R.master?t("div",{class:"dl-muted"},`Choose ${R.master} to include it.`):""]),X}function g(){let R=s.like_home;return!p||!s.config.lan_like||!n.enabled?"":!s.needs?.length&&R.active&&R.bridged?"ok":"warn"}function S(){let R=s.like_home;return p?s.needs?.length?[t("span",{class:"dl-warn"},`Needs ${s.needs.join(" and ")}.`)," Until they are installed, internet traffic goes straight to the WAN."]:s.config.lan_like?n.enabled?R.active&&R.bridged?["Internet traffic enters ",t("span",{class:"dl-mono"},R.dev??"")," as ",t("span",{class:"dl-mono"},R.address??""),", so whatever handles home traffic (proxies, filters, DNS) handles it too."]:[t("span",{class:"dl-warn"},`Not working: ${R.error??"the link is down"}`)," Internet traffic goes straight to the WAN for now."]:["Internet traffic enters the router from your LAN, so whatever handles home traffic (proxies, filters, DNS) handles it too."]:["Internet traffic will enter the router from your LAN, so it is handled like any home device. Save to turn on."]:["Off: internet traffic goes straight to the WAN, past whatever handles home traffic on this router."]}let T={off:"Devices of different people never reach each other; a person's own devices don't either.",all:"Devices of people with home access reach each other, like home devices do. Internet-only people never.",circles:"Within a circle: family sees family, guests see guests. Everyone reaches their own devices. Internet-only people never."};function N(R,K,Z,de,Q="",te){return t("div",{class:te?"dl-setrow head":"dl-setrow"},[t("div",{class:"dl-lh-main"},[t("span",{class:`dl-need-ic ${Q}`},b(R)),t("div",{class:"dl-stack"},[t("span",{class:"dl-setrow-label"},K),t("span",{class:"dl-sub"},Z),te??""])]),t("div",{class:"dl-setrow-ctl"},de)])}let W=(R,K)=>{let Z=de=>t("span",{class:"dl-mono"},de);return R?t("span",{},[" Now: ",Z(R),...K&&K!==R?[", was ",Z(K)]:[],"."]):t("span",{},K?[" Not found now: using ",Z(K),"."]:[" Not found."])};function q(){let R=t("select",{class:"cbi-input-select","aria-label":"Internet interface",change:M=>{d=M.target.value,q()}},s.devices.filter(M=>!M.own&&!M.master&&M.zone&&!M.missing).map(M=>t("option",{value:M.name,selected:M.name===d?"selected":null},`${M.name} · zone ${M.zone}`))),Z=y().flatMap(M=>M.nets.map(j=>[j,M.name])),de=JSON.parse(C()),Q=JSON.parse(m),te=(...M)=>M.some(j=>JSON.stringify(de[j])!==JSON.stringify(Q[j])),ge=te(0,1,2),O=te(3,4),X=M=>H("Save",async()=>{let j=await G(()=>A.serverInterfaces(o,l,l?"":d,c,[...h],p,u!=="off",u),"Access saved");j&&(E(j,!0),j.nets_changed&&j.lan_only&&U(`${j.lan_only} ${j.lan_only===1?"person has":"people have"} Home-only access: their devices need the configuration again to reach the new networks.`,"warning",1e4))},"positive",{disabled:!M}),P=t("section",{class:"dl-setsec dl-ifcard"},[t("div",{class:"dl-setsec-body"},[t("div",{class:"dl-panel-head"},[t("h3",{},"Internet"),t("span",{class:"dl-spacer"}),t("span",{class:"dl-sub"},"People with Internet or Both")]),N("home","Internet like a home device",S(),[p&&s.needs?.length?H("Install",()=>Yt("home",s.needs,()=>k(!1)),"positive"):"",ve(p,"Internet like a home device",M=>{p=M,q()})],g()),N("globe","Auto-detect WAN",["The interface with the default route: the server port opens there and Internet access leaves through it.",W(s.detected.wan,s.saved.wan)],[l?"":R,ve(l,"Auto-detect WAN",M=>{l=M,q()})])]),t("div",{class:"dl-setsec-foot"},[t("span",{class:"dl-sub"},p?["Internet like a home device",w()?[" · leaves through ",t("span",{class:"dl-mono"},w())]:""]:w()?["Internet straight to ",t("span",{class:"dl-mono"},w())]:"No WAN found"),X(ge)])]),D=we([["off","Off"],["all","Everyone"],["circles","Circles"]],u,{label:"Devices reach each other",cls:"sm",optimistic:!1,onChange:async M=>{let j={off:"Off",all:"Everyone",circles:"Circles"}[M];await G(()=>A.serverUpdate(o,{mesh:M}),`Devices reach each other: ${j}`)&&(u=M,s.config.mesh=M,q(),await r())}}),_=t("section",{class:"dl-setsec dl-ifcard"},[t("div",{class:"dl-setsec-body"},[t("div",{class:"dl-panel-head"},[t("h3",{},"Home network"),t("span",{class:"dl-spacer"}),t("span",{class:"dl-sub"},"People with Home or Both"),H([b("reset")," Rescan"],()=>k(!1),"neutral",{title:"Read the interfaces again"})]),N("network","Networks","Everyone with home access reaches these, unless their page leaves one out; their devices can be reached from here too. Click one to add or remove it.","","",Y()),N("link","Devices reach each other",T[u],D,"",u==="circles"?ta(a,o,r):void 0),$.el]),t("div",{class:"dl-setsec-foot"},[t("span",{class:"dl-sub dl-if-summary"},Z.length?["Home access reaches ",...Z.flatMap(([M,j],J)=>[J?", ":"",t("span",{class:"dl-mono"},M),` (${j})`])]:"No home network: Home access reaches nothing but this router."),X(O)])]),I=window.scrollY;i.style.minHeight=`${i.offsetHeight}px`,dom.content(i,[P,_]),i.style.minHeight="",window.scrollTo({top:I})}function Y(){let R=s.devices.filter(z),K=s.devices.filter(Z=>!z(Z));return t("div",{class:"dl-stack gap8 dl-netpick"},[R.length?t("div",{class:"dl-ifgrid"},R.map(f)):t("span",{class:"dl-warn"},"No home network: Home access reaches nothing but this router."),t("label",{class:"dl-boxrow"},[t("span",{class:"dl-stack"},[t("span",{},"Auto-detect LAN"),t("span",{class:"dl-sub"},["Adds the LAN this router uses.",W(s.detected.lan,s.saved.lan)])]),ve(c,"Auto-detect LAN",Z=>{c=Z,q()})]),K.length?t("details",{class:"dl-params",open:x?"":null,toggle:Z=>x=Z.currentTarget.open},[t("summary",{},[b("chevron"),t("span",{},"Other interfaces"),t("span",{class:"dl-pcount"},String(K.length))]),t("div",{class:"dl-params-body"},[t("span",{class:"dl-sub"},"The WAN, this server, ports and Wi-Fi of a bridge (they come with it) and interfaces without an IPv4 network."),...Ds.map(([Z,de])=>{let Q=K.filter(te=>te.category===Z);return Q.length?t("div",{class:"dl-ifgroup"},[t("h4",{},de),t("div",{class:"dl-ifgrid"},Q.map(f))]):""})])]):""])}return k(!0),{el:i,update(R){a=R,$.update(R),s&&q()}}}var Hs={connect:"ok",disconnect:"",roam:"",device_added:"ok",device_removed:"",person_added:"",person_removed:"",paused:"warn",resumed:"ok",expiring:"warn",expired_kept:"",portal_blocked:"bad",person_changed:"",devices_removed:"warn"},zs={devices_removed:"trash",link_changed:"link",person_added:"plus",person_removed:"trash",person_changed:"edit",paused:"pause",resumed:"play",expiring:"calendar",expired_kept:"calendar"};function Ns(n,e){return e.device?n.people.flatMap(o=>o.devices).find(o=>o.id===e.device)?.kind??e.dkind??"other":zs[e.type]??"activity"}function wo(n,e){let r=n.people.find(h=>h.id===e.person),o=r?.name??e.pname??e.person??"",a=r?.devices.find(h=>h.id===e.device)?.name??e.dname??"",i=h=>t("b",{},h),s=h=>t("span",{class:"dl-muted"},h),l=h=>t("span",{class:"dl-mono"},h),d=h=>e.hosts?.[h]?[t("span",{class:"dl-ev-host"},[t("b",{},e.hosts[h]),t("span",{class:"dl-faint"},` (${h})`)])]:[l(h)],c=h=>t("span",{class:"dl-ev-kind"},`${h} `),p=a?`${o} · ${a}`:o,u=lr(e),x=u||a||"a device",$=h=>[t("span",{class:"dl-you"},"You"),s(` ${h} `)];if(Ne(e)==="admin")switch(e.type){case"device_added":return[...$("added"),c("device"),i(x),s(" for "),i(o)];case"device_removed":return[...$("removed"),c("device"),i(x),s(" from "),i(o)];case"paused":return[...$("paused"),c("person"),i(o)];case"resumed":return[...$("resumed"),c("person"),i(o)];case"device_changed":{let h=u.startsWith("renamed from ");return[...$(h?"renamed":u),c("device"),i(a||"a device"),s(" of "),i(o),...h?[s(` · was ${u.slice(13)}`)]:[]]}case"device_keys":return[...$("issued new keys for"),c("device"),i(x),s(" of "),i(o),s(" · it needs its new configuration")];case"link_changed":return[...$("issued a new link for"),c("person"),i(o),s(" · the old link stopped working")]}switch(e.type){case"connect":return[c("Device"),i(p),s(" connected"),...e.detail?[s(" from "),...d(e.detail)]:[],...e.where?[s(` · ${e.where}`)]:[]];case"disconnect":return[c("Device"),i(p),s(" went offline")];case"roam":return[c("Device"),i(p),s(" changed network "),...(e.detail??"").split(" → ").flatMap((h,m)=>m?[s(" → "),...d(h)]:d(h))];case"device_added":return[c("Person"),i(o),s(" added "),c("device"),i(x),...Ne(e)==="portal"?[s(" on their portal")]:[]];case"device_removed":return[c("Person"),i(o),s(" removed "),c("device"),i(x),...Ne(e)==="portal"?[s(" on their portal")]:[]];case"device_keys":return[c("Person"),i(o),s(" issued new keys for "),c("device"),i(x),s(" on their portal")];case"person_added":return[...$("added"),c("person"),i(e.detail??o)];case"person_removed":return[...$("removed"),c("person"),i(e.detail??o)];case"person_changed":return[...$("changed"),c("person"),i(o),...u?[s(` · ${u.replace(/_/g," ")}`)]:[]];case"expiring":return[c("Person"),i(o),s(`’s access ends in ${e.detail??"a few days"}`)];case"expired_kept":return[c("Person"),i(o),s(`’s end date passed (${e.detail??""}) · access kept`)];case"paused":return[c("Person"),i(o),s(` paused — ${e.detail??""}`)];case"resumed":return[c("Person"),i(o),s(" resumed"),...e.detail&&e.detail!=="active"?[s(` — ${e.detail}`)]:[]];case"portal_blocked":return[t("b",{class:"dl-sys-src"},"Personal portal"),s(" blocked "),l(e.detail??""),s(" for 15 min after too many wrong codes")];case"devices_removed":return[c("Person"),i(o),s(" — all devices removed, end date reached")];default:return[s(`${e.type}${e.detail?`: ${e.detail}`:""}`)]}}var Rs={portal_blocked:["globe","bad"]};function Is(n,e){if(n.servers.length<2||!e.person)return"";let r=n.people.find(a=>a.id===e.person),o=r&&n.servers.find(a=>a.id===r.server);return o?t("span",{class:"dl-ev-srv",title:"Server"},o.name):""}function st(n,e,r={}){let o=Rs[e.type],a=Ne(e);return t("div",{class:`dl-row${a==="admin"?" dl-ev-by-admin":o?` dl-ev-by-system ${o[1]}`:""}`},[a==="admin"?t("span",{class:"dl-ev-tile",title:"Done by you in LuCI"},b("admin")):o?t("span",{class:"dl-ev-tile sys"},b(o[0])):t("span",{class:`dl-ev-tile ev ${Hs[e.type]??""}`},b(Ns(n,e))),t("span",{class:"dl-row-main"},wo(n,e)),r.server===!1?"":Is(n,e),t("span",{class:"dl-faint dl-nowrap",title:new Date(e.ts*1e3).toLocaleString()},r.time??re(e.ts,n.now))])}var Bs={info:"",up:"ok",down:"warn",repair:"warn",error:"bad"},Os={awg:"tunnel",dawnline:"sunrise",portal:"globe"};function Tn(n,e,r,o){let a=n.by==="admin",i=t("div",{class:`dl-row dl-slog-row ${a?"dl-ev-by-admin":`dl-ev-by-system ${Bs[n.level]??""}`}${n.detail?" has-detail":""}`},[a?t("span",{class:"dl-ev-tile",title:"Done by you in LuCI"},b("admin")):t("span",{class:"dl-ev-tile sys",title:n.level},b(Os[n.src]??"zap")),t("span",{class:"dl-row-main"},a?[t("span",{class:"dl-you"},"You"),t("span",{class:"dl-muted"},` ${n.msg} `),n.kind?t("span",{class:"dl-ev-kind"},`${n.kind} `):"",n.who?t("b",{},n.who):"",n.note?t("span",{class:"dl-muted"},` · ${n.note}`):"",n.detail?t("span",{class:`dl-slog-more${e?" open":""}`},b("chevron")):"",n.detail&&e?t("pre",{class:"dl-slog-detail"},n.detail):""]:[n.src==="awg"&&n.who&&n.who!=="AmneziaWG"?t("span",{class:"dl-ev-kind"},"Server "):"",t("b",{class:"dl-sys-src",title:Ot[n.src]??n.src},n.who??Ot[n.src]??n.src)," ",t("span",{class:"dl-muted"},n.msg),n.detail?t("span",{class:`dl-slog-more${e?" open":""}`},b("chevron")):"",n.detail&&e?t("pre",{class:"dl-slog-detail"},n.detail):""]),t("span",{class:"dl-faint dl-nowrap",title:new Date(n.ts*1e3).toLocaleString()},o)]);return n.detail&&i.addEventListener("click",s=>{s.target.closest("pre")||r()}),i}function pa(n){let e=new Date(n*1e3),r=new Date,o=new Date;return o.setDate(r.getDate()-1),e.toDateString()===r.toDateString()?"Today":e.toDateString()===o.toDateString()?"Yesterday":e.toLocaleDateString("en-GB",{weekday:"long",day:"numeric",month:"long"})}var At=n=>wt(n).toLocaleDateString("en-GB",{day:"numeric",month:"short"});function _n(n,e,r,o=!1){let a=n.slice(-15),i=a[a.length-1],s=i&&e-i[0]<180,l=s?i[2]:0,d=s?i[1]:0,[c,p]=r,u=200,x=40,$=Math.max(1,...a.map(v=>Math.max(v[1],v[2]))),h=v=>a.map((y,E)=>`${a.length>1?E/(a.length-1)*u:u},${x-2-y[v]/$*(x-6)}`),m=h(2),C=h(1),B=a.length>1&&!o?et(`<svg viewBox="0 0 ${u} ${x}" preserveAspectRatio="none" class="dl-speed-chart" aria-hidden="true"><path d="M${m.join(" L")} L${u},${x} L0,${x}Z" class="area"/><path d="M${m.join(" L")}" class="line"/><path d="M${C.join(" L")}" class="line up"/></svg>`):t("div",{class:"dl-speed-wait"},[t("i"),o?"":t("span",{},"Collecting… 1 point a minute")]),w=(v,y,E,k)=>t("div",{class:"dl-speed-col"},[t("span",{class:"dl-sub"},[t("span",{class:E},y),` ${v}`]),o?t("span",{class:"dl-speed-val off"},"—"):t("span",{class:"dl-speed-val"},Oe(k))]);return a.length>1&&!o&&me(B,()=>{let v=a[a.length-1];return[t("div",{class:"dl-tip-title"},new Date(v[0]*1e3).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"})),t("div",{},`↓ ${Oe(v[2])} · ↑ ${Oe(v[1])}`)]}),t("div",{class:"dl-bento-tile"},[t("div",{class:"dl-bento-head"},[t("span",{class:"dl-metric-label"},"Speed now"),o?"":t("span",{class:"dl-sub"},"last 15 min")]),t("div",{class:"dl-speed-cols"},[w("Download","↓","dl-dn",l),w("Upload","↑","dl-up",d)]),B,t("div",{class:"dl-speed-today"},[t("span",{},["Today ",t("b",{},ee(c+p))]),t("span",{},[t("span",{class:"dl-dn"},"↓"),` ${ee(p)} `,t("span",{class:"dl-up"},"↑"),` ${ee(c)}`])])])}function Pn(n,e){let r=n.slice(-30),o=r.map(d=>d.rx+d.tx),a=Math.max(1,...o),i=o.reduce((d,c)=>d+c,0),s=o.reduce((d,c,p)=>c>o[d]?p:d,0),l=t("div",{class:"dl-bento-bars"},r.map((d,c)=>{let p=o[c],u=t("i",{class:c===r.length-1?"hi":"",style:`height:${Math.max(4,p/a*100)}%`});return me(u,()=>[t("div",{class:"dl-tip-title"},c===r.length-1?`Today · ${At(d.day)}`:At(d.day)),t("div",{},ee(p)),t("div",{class:"dl-muted dl-mono"},`↓ ${ee(d.tx)} ↑ ${ee(d.rx)}`)]),u}));return t("div",{class:"dl-bento-tile month"},[t("div",{class:"dl-bento-head"},[t("span",{},[t("span",{class:"dl-metric-label"},"Last 30 days"),t("b",{class:"dl-bento-total"},ee(i))]),o[s]>0?t("span",{class:"dl-sub"},`peak ${ee(o[s])} · ${At(r[s].day)}`):""]),r.length?l:t("p",{class:"dl-muted"},"No traffic yet."),t("div",{class:"dl-bento-head"},[t("span",{class:"dl-sub"},r.length?At(r[0].day):""),t("span",{class:"dl-sub"},e),t("span",{class:"dl-sub"},"today")])])}function ua(n){let e=n.slice(-30),r=e.map(a=>a.rx+a.tx),o=Math.max(1,...r);return t("div",{class:"dl-dbars"},e.map((a,i)=>{let s=t("i",{class:`${r[i]?"":"zero"}${i===e.length-1?" hi":""}`});return s.style.height=`${Math.max(8,r[i]/o*100)}%`,me(s,()=>[t("div",{class:"dl-tip-title"},i===e.length-1?`Today · ${At(a.day)}`:At(a.day)),t("div",{},ee(r[i]))]),s}))}var ma={apply:"Repair",sync:"Reload devices",restart:"Restart service",netrestart:"Restart network",updates:"Open Components"};async function Dn(n){return n==="netrestart"&&!await le("Restart the network?","Every interface restarts. Connections drop for a few seconds.","Restart network")?null:await G(()=>A.healthFix(n),"Done")??null}function yo(n,e,r,o="action"){let a=n.fix;return a?a.startsWith("install:")?H("Install",()=>da(a.slice(8),r),o):a==="updates"?t("a",{class:`cbi-button cbi-button-${o}`,href:L.url("admin/network/dawnline/updates")},ma.updates):H(ma[a]??"Fix",()=>e(a),o):""}function js(n){return/^(awg|up_|peers_|fw_|reply_|port_|subnet_)/.test(n)?"shield":/^(portal|cert)/.test(n)?"link":/^(ep_|home_|resolver)/.test(n)?"globe":n==="clock"?"clock":n==="agent"?"activity":n==="flash"?"download":n==="nft"?"lock":n==="data"?"users":"alert"}function ha(n,e,r,o=3){let a=n.filter(s=>s.status==="error"||s.status==="warn").sort((s,l)=>s.status===l.status?0:s.status==="error"?-1:1);if(!a.length)return"";let i=a.length-o;return t("div",{class:"dl-list dl-notices"},[...a.slice(0,o).map(s=>Xe(js(s.id),s.status==="error"?"bad":"warn",s.problem??s.title,s.detail,yo(s,e,r,s.status==="error"?"positive":"neutral"))),i>0?t("a",{class:"dl-row dl-notices-more",href:L.url("admin/network/dawnline/diagnostics")},[`${i} more in Diagnostics`,t("span",{class:"dl-spacer"}),"→"]):""])}function Us(n){let e=[],r=(s,l)=>t("a",{href:s},l),o=Ie(n.series),a=!!n.awg_state&&!n.awg_state.ok;for(let s of n.servers)s.enabled&&s.blocked?e.push({tone:"bad",text:[`${s.name} ${s.blocked}. `,r(L.url("admin/network/dawnline/diagnostics"),"Open Diagnostics")]}):s.enabled&&!s.up&&!a&&e.push({tone:"bad",text:[`Tunnel ${s.ifname} is down. `,r(L.url("admin/network/dawnline/diagnostics"),"Open Diagnostics")]});for(let s of n.people)if(s.state==="quota")e.push({tone:"warn",text:[r(ke(s.id),s.name)," reached the data limit."]});else if(s.state==="expired")e.push({tone:"warn",text:[r(ke(s.id),s.name),"’s access has ended."]});else{let l=Ye(s.expires,o);Ze(s,l)?e.push({tone:"",text:[r(ke(s.id),s.name),`’s access ${en(l)}.`]}):l!=null&&l<0&&s.expire_action==="notify"&&e.push({tone:"",text:[r(ke(s.id),s.name),`’s end date passed (${Me(s.expires)}) · access kept.`]}),s.quota_limit&&s.quota_used>=s.quota_limit*.9&&e.push({tone:"",text:[r(ke(s.id),s.name)," has used 90% of the data limit."]})}let i=n.people.flatMap(s=>s.devices.filter(l=>l.config_stale).map(l=>[s,l]));i.length&&e.push({tone:"warn",text:i.length===1?[r(ke(i[0][0].id,i[0][1].id),`${i[0][0].name} · ${i[0][1].name}`)," needs its configuration again."]:[`${i.length} devices need their configuration again (networks or DNS changed).`]});for(let s of n.servers)n.wan&&Ct(s.endpoint)&&s.endpoint!==n.wan&&e.push({tone:"warn",text:[`Public address changed: ${s.name} still gives devices ${s.endpoint}, the router is ${n.wan} now. `,t("button",{type:"button",class:"dl-fix",click:async l=>{let d=l.currentTarget;d.disabled=!0,await G(()=>A.serverUpdate(s.id,{endpoint:n.wan}),`${s.name} uses ${n.wan} now — devices need their configuration again`),d.disabled=!1}},"Use the new address")," A DDNS name would follow it by itself."]});return n.servers.some(s=>s.lan_like)&&n.like_home.error&&e.push({tone:"warn",text:[`Internet through the LAN is off: ${n.like_home.error} `,r(L.url("admin/network/dawnline/diagnostics"),"Details")]}),!n.settings.portal_enabled&&!n.people.length&&e.push({tone:"",text:["The personal portal is off. ",r(L.url("admin/network/dawnline/settings"),"Turn on")]}),e}var An=class{constructor(e,r){this.srvId=e;this.go=r;this.el=t("div",{class:"dl-srvov"});this.map=null;this.mapOn=null;this.range="online";this.parts={};this.healthAt=0}mount(e){this.st=Vt(e,this.srvId);for(let r of["health","bento","map","side","activity"])this.parts[r]=t("div",{});return dom.content(this.el,[this.parts.health,this.parts.bento,this.parts.map,t("div",{class:"dl-grid2"},[this.parts.activity,this.parts.side])]),this.paint(),this.loadHealth(),this.el}update(e,r=!1){this.st=Vt(e,this.srvId),this.paint(r),Date.now()-this.healthAt>6e4&&this.loadHealth()}async loadHealth(){this.healthAt=Date.now();let e=await A.health().catch(()=>null);if(!e)return;let r=()=>void this.loadHealth(),o=async a=>{await Dn(a)&&(r(),a==="netrestart"&&setTimeout(r,5e3))};Se(this.parts.health,ha(e.checks,a=>void o(a),r),!0)}mapData(){return{geo:this.st.geo,people:this.st.people,now:this.st.now}}paintMap(){let e=this.st.geo.enabled;if(e===this.mapOn&&(!e||this.map)){this.map?.update(this.mapData());return}this.mapOn=e,dom.content(this.parts.map,this.mapCard())}mapCard(){let e=this.st,r=t("div",{class:"dl-panel-head pad"},[t("div",{class:"dl-stack"},[t("h3",{},"Where people connect from"),t("span",{class:"dl-sub"},"City-level, from the client IP · locations cached on the router")]),t("span",{class:"dl-spacer"}),_t(this.range,l=>{this.range=l,this.map?.setRange(l)})]);if(this.map?.destroy(),this.map=null,!e.geo.enabled)return t("div",{class:"dl-panel flush"},[r,t("div",{class:"dl-map-off"},["Locations are off. ",t("a",{href:L.url("admin/network/dawnline/settings")},"Turn them on in Settings"),"."])]);let o=this.map=new nt({openPerson:l=>location.href=ke(l),openDevice:(l,d)=>location.href=ke(l,d)},this.range),a=$e(()=>{a(),o.destroy(),this.map===o&&(this.map=null)}),i=t("div",{class:"dl-map-legend"},[t("span",{},[t("i",{class:"line live"}),"Live tunnel"]),t("span",{},[t("i",{class:"line"}),"Seen recently"])]),s=t("div",{class:"dl-map-wrap"},[o.el,i]);return requestAnimationFrame(()=>o.mount(this.mapData())),t("div",{class:"dl-panel flush"},[r,s])}paint(e=!1){let r=this.st,o=r.servers[0];this.paintMap(),Se(this.parts.bento,t("div",{class:"dl-bento"},[this.onlineTile(),this.speedTile(),Be(o).overviewTile(o),this.monthTile()]),e);let a=Us(r);Se(this.parts.side,t("div",{class:"dl-panel flush"},[t("div",{class:"dl-panel-head pad"},[t("h3",{},"Needs attention"),t("span",{class:"dl-spacer"}),t("a",{href:L.url("admin/network/dawnline/diagnostics")},"Health")]),a.length?a.slice(0,8).map(s=>t("div",{class:"dl-attn-item dl-row"},[t("span",{class:`dl-ev-dot ${s.tone}`}),t("span",{},s.text),s.action??""])):t("div",{class:"dl-row dl-muted"},[b("check"),"All good. Nothing needs you right now."])]),e);let i=[...r.events].reverse().slice(0,8);Se(this.parts.activity,t("div",{class:"dl-panel flush"},[t("div",{class:"dl-panel-head pad"},[t("h3",{},"Activity"),t("span",{class:"dl-spacer"}),t("a",{href:`${L.url("admin/network/dawnline/diagnostics")}?tab=log`},"View all")]),i.length?i.map(s=>st(r,s)):t("div",{class:"dl-row dl-muted"},"Nothing yet. Connections, new devices and pauses appear here.")]),e)}onlineTile(){let e=this.st,r=e.servers[0]?!e.servers[0].enabled:!1,o=12,a=B=>B.spark[B.spark.length-1]??0,i=B=>e.geo.points.find(w=>w.device===B.id&&w.city)?.city,s=B=>/^(10\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.)/.test(B.endpoint??""),l=(B,w=!1)=>s(B)?w&&B.endpoint?`LAN · ${B.endpoint}`:"LAN":i(B)??"",d=B=>[...e.events].reverse().find(w=>w.type==="connect"&&w.device===B.id)?.ts??0,c=e.people.map(B=>({p:B,devs:B.devices.filter(w=>w.online).sort((w,v)=>a(v)-a(w))})).filter(B=>B.devs.length).sort((B,w)=>w.devs.reduce((v,y)=>v+a(y),0)-B.devs.reduce((v,y)=>v+a(y),0)),p=c.length<=2,u=({p:B,devs:w})=>{let v=w.map(d).filter(Boolean),y=v.length?Math.min(...v):0,E=(B.rate??[]).slice(-15),k=E[E.length-1],z=k&&e.now-k[0]<180?k:null,f=200,g=30,S=Math.max(1,...E.map(Y=>Math.max(Y[1],Y[2]))),T=Y=>E.map((R,K)=>`${E.length>1?K/(E.length-1)*f:f},${g-2-R[Y]/S*(g-6)}`),N=E.length>1?et(`<svg viewBox="0 0 ${f} ${g}" preserveAspectRatio="none" class="dl-hc-chart" aria-hidden="true"><path d="M${T(2).join(" L")} L${f},${g} L0,${g}Z" class="area"/><path d="M${T(2).join(" L")}" class="dn"/><path d="M${T(1).join(" L")}" class="up"/></svg>`):"",W=!z||z[1]<64&&z[2]<64,q=B.access==="both"?["home","globe"]:B.access==="lan"?["home"]:["globe"];return[t("div",{class:"dl-hc"},[t("div",{class:"dl-hc-head"},[t("span",{class:"dl-onl-av sm"},He(B.name)),t("span",{class:"dl-stack"},[t("b",{},B.name),t("span",{class:"dl-hc-since"},y?`online for ${re(y,e.now).replace(" ago","")}`:"online")]),t("span",{class:"dl-hc-reach"},q.map(Y=>t("span",{class:`dl-ibadge ${Y==="home"?"lan":"inet"}`},b(Y))))]),t("div",{class:"dl-hc-speed"},[t("div",{class:"dl-hc-speed-row"},W?[t("span",{class:"dl-faint"},"Idle right now")]:[t("span",{},[t("span",{class:"dl-dn"},"↓"),` ${Oe(z[2])}`]),t("span",{},[t("span",{class:"dl-up"},"↑"),` ${Oe(z[1])}`]),t("span",{class:"dl-spacer"}),t("span",{class:"dl-faint"},"15 min")]),N]),t("div",{class:"dl-hc-devs"},w.map(Y=>t("span",{class:"dl-hc-dev"},[b(Y.kind),Y.name,l(Y)?[" · ",l(Y,!0)]:""]))),t("div",{class:"dl-hc-foot"},[t("span",{class:"dl-faint"},`${ee(w.reduce((Y,R)=>Y+a(R),0))} today · ${ee(B.month[0]+B.month[1])} this month`)])])]},x=B=>{let{p:w,devs:v}=B,y=t("span",{class:"dl-onl-dev"},v.length>1?String(v.length):b(v[0].kind)),E=t("a",{class:`dl-onl-p${p?"":" sm"}`,href:ke(w.id),"aria-label":`${w.name}, online`},[t("span",{class:"dl-onl-av"},[He(w.name),y]),p?t("span",{class:"dl-onl-name"},w.name):"",p?t("span",{class:"dl-onl-meta"},[...v.slice(0,3).map(k=>b(k.kind)),v.length>3?`+${v.length-3}`:"",l(v[0])?t("span",{},[" · ",l(v[0])]):""]):""]);return me(E,()=>u(B)),E},$=t("b",{class:`dl-onl-count${c.length?"":" none"}`},String(c.length)),h=c.reduce((B,w)=>B+w.devs.length,0);c.length&&me($,()=>[`${c.length} ${c.length===1?"person":"people"} · ${h} device${h===1?"":"s"}`]);let m=c.length>o?c.slice(0,o-1):c,C=e.people.flatMap(B=>B.devices.map(w=>({p:B,d:w}))).filter(B=>B.d.handshake).sort((B,w)=>w.d.handshake-B.d.handshake)[0];return t("div",{class:"dl-bento-tile online"},[t("div",{class:"dl-bento-head"},[t("span",{class:"dl-metric-label"},"Online"),$]),c.length?t("div",{class:`dl-onl-row${p?"":" grid"}`},[...m.map(x),c.length>o?t("a",{class:"dl-onl-p sm more",href:`${L.url("admin/network/dawnline/server")}?server=${encodeURIComponent(this.srvId)}&section=people&filter=online`,title:"Everyone online",click:B=>{this.go&&(B.preventDefault(),this.go("people","online"))}},[t("span",{class:"dl-onl-av"},`+${c.length-m.length}`)]):""]):t("div",{class:"dl-onl-empty"},[t("span",{},r?"The server is turned off":"Nobody is connected"),C?t("span",{class:"dl-sub"},`Last: ${C.p.name}, ${re(C.d.handshake,e.now)}`):t("span",{class:"dl-sub"},r?"Devices connect once it is on":"No device has connected yet")])])}speedTile(){let e=this.st.servers[0];return _n(e?.rate??[],this.st.now,this.st.totals.today,e?!e.enabled:!1)}monthTile(){let e=[...this.st.people].map(r=>[r,r.month[0]+r.month[1]]).filter(([,r])=>r>0).sort((r,o)=>o[1]-r[1]).slice(0,2);return Pn(this.st.series,e.length?`Most: ${e.map(([r,o])=>`${r.name} ${ee(o)}`).join(" · ")}`:"")}};var fa=[["overview","Overview"],["people","People"],["connection","Connection"],["access","Access"],["awg",""]],Gs={general:"connection",network:"connection",interfaces:"access",advanced:"awg",disguise:"awg",tunnel:"awg",core:"awg"},ko=(n,e)=>{let r=new URLSearchParams;n&&r.set("server",n),e&&e!=="overview"&&r.set("section",e);let o=r.toString();return`${L.url("admin/network/dawnline/server")}${o?`?${o}`:""}`},Zt=class{constructor(){this.noFooter=!0;this.root=t("div",{class:"dl-root"});this.section="overview";this.srvId="";this.ov={};this.pp={};this.tabsEl=t("div",{});this.headEl=t("div",{});this.secEl=t("div",{});this.bodyEl=t("div",{class:"dl-srvbody"})}async load(){let e=await A.status(31),r=e.servers.length?null:await A.setupDefaults();return[e,r]}render([e,r]){if(this.st=e,!e.servers.length&&r)return this.wizard(r);let o=new URLSearchParams(location.search),a=o.get("section")??"",i=Gs[a]??a;return fa.some(([s])=>s===i)&&(this.section=i),this.srvId=(e.servers.find(s=>s.id===o.get("server"))??e.servers[0]).id,dom.content(this.root,[this.tabsEl,this.headEl,this.secEl,this.bodyEl]),this.paint(),this.poller?.stop(),this.poller=rt({fetch:()=>A.status(31),every:30,live:!0,active:()=>this.section==="overview"&&this.root.isConnected,apply:(s,l)=>{s.servers.length&&(this.st=s,this.paintHead(l),this.ov[this.current().id]?.update(s,l))}}),this.root}paintHead(e=!1){Se(this.headEl,this.head(this.current()),e),(!e||!Dt(this.tabsEl))&&this.paintTabs()}async refreshStatus(){let e=await A.status(31).catch(()=>null);return e?.servers.length?(this.st=e,this.paintHead(),e):null}current(){return this.st.servers.find(e=>e.id===this.srvId)??this.st.servers[0]}async refresh(){let e=await A.status(31).catch(()=>null);e&&(this.st=e,e.servers.length?this.paint():location.href=ko())}paint(){this.paintTabs(),dom.content(this.headEl,this.head(this.current())),this.paintSections(),this.showSection(this.section)}paintTabs(){let e=this.current();dom.content(this.tabsEl,t("div",{class:"dl-srvtabs",role:"tablist","aria-label":"Servers"},[...this.st.servers.map(r=>t("button",{type:"button",role:"tab",class:`dl-srvtab${r.id===e.id?" on":""}`,"aria-selected":r.id===e.id?"true":"false",click:()=>{r.id!==this.srvId&&(this.srvId=r.id,this.paint())}},[t("i",{class:`dot ${r.enabled?r.up?"ok":"bad":"warn"}`}),t("b",{},r.name)])),t("button",{type:"button",class:"dl-srvtab add",click:()=>this.addServer()},[b("plus"),"Add server"])]))}paintSections(){let e=Be(this.current());dom.content(this.secEl,t("div",{class:"dl-seg dl-srvsections",role:"tablist","aria-label":"Server"},fa.map(([r,o])=>t("button",{type:"button",role:"tab","data-section":r,class:r===this.section?"on":"","aria-selected":r===this.section?"true":"false",click:()=>this.showSection(r)},r==="awg"?e.label:o))))}go(e,r){let o=this.pp[this.current().id];if(r&&o)o.filter=r,o.el&&o.decorate();else if(r){let a=this.pp[this.current().id]=new mt;a.filter=r}this.showSection(e),window.scrollTo({top:0,behavior:"smooth"})}detachKept(){let e=[...Object.values(this.ov).map(r=>r.el),...Object.values(this.pp).map(r=>r.el)];for(let r of e)r&&this.bodyEl.contains(r)&&r.remove()}showSection(e){this.section=e,this.secEl.querySelectorAll("[data-section]").forEach(s=>{let l=s.dataset.section===e;s.classList.toggle("on",l),s.setAttribute("aria-selected",l?"true":"false")});let r=this.st,o=this.current(),i={overview:()=>{let s=this.ov[o.id];return s?(s.update(r),s.el):(this.ov[o.id]=new An(o.id,(l,d)=>this.go(l,d))).mount(r)},people:()=>{var c,p;let s=this.pp[o.id];if(s?.el)return s.update(),s.el;let l=t("div",{},t("p",{class:"dl-muted"},"Loading people…"));return((c=this.pp)[p=o.id]??(c[p]=new mt)).embed(r,o.id).then(u=>{l.isConnected?dom.content(l,u):l.replaceChildren(u)}).catch(u=>{delete this.pp[o.id],dom.content(l,t("p",{class:"dl-muted"},`Couldn't show people: ${be(u)}`))}),l},connection:()=>this.connection(o),access:()=>this.access(o),awg:()=>this.awg(o)}[e]();this.detachKept(),dom.content(this.bodyEl,i)}head(e){let r=(i,s)=>t("span",{class:"dl-addrbar-seg"},[b(i),...s]),o=e.endpoint||"—",a=t("div",{class:"dl-actions"},[e.enabled?"":H([b("play")," Turn on"],()=>this.save(e,{enabled:"1"},"Server turned on"),"add")]);return t("div",{class:"dl-srvpagehead"},[t("div",{class:"dl-title-row"},[t("h2",{class:"dl-h1"},e.name),t("span",{class:`dl-pill ${e.enabled?e.up?"ok":"bad":"warn"}`},e.enabled?e.up?"Running":e.blocked?"Can’t start":"Not running":"Turned off"),t("span",{class:"dl-spacer"}),a]),t("div",{class:"dl-addrbar"},[t("button",{type:"button",class:"dl-addrbar-seg main",title:"Copy address",click:()=>ue(o,"Address copied")},[b("globe"),t("span",{class:"dl-mono"},o),b("copy")]),r(Be(e).id==="awg"?"amneziawg":"tunnel",[t("span",{class:"dl-mono"},`${Be(e).label} :${e.port}`)]),e.up?r("clock",[`up ${xt(e.uptime)}`]):""]),e.blocked?t("div",{class:"dl-note warn"},[b("alert"),t("span",{},`${e.name} ${e.blocked}.`)]):""])}async save(e,r,o="Saved"){await G(()=>A.serverUpdate(e.id,r),o)&&await this.refresh()}connection(e){let r=se(e.name,{placeholder:"Home"}),o=se(e.endpoint,{placeholder:"vpn.example.com",class:"cbi-input-text dl-mono"}),a=se(e.dns.join(", "),{placeholder:"This router (recommended)",class:"cbi-input-text dl-mono"}),i=this.st.people.filter($=>$.server===e.id).length,s=H([b(e.enabled?"pause":"play"),e.enabled?" Turn off":" Turn on"],async()=>{e.enabled&&!await le(`Turn off ${e.name}?`,`The tunnel stops and ${i} ${i===1?"person is":"people are"} disconnected until you turn it back on. Nothing is deleted.`,"Turn off",!0)||await this.save(e,{enabled:e.enabled?"0":"1"},e.enabled?"Server turned off":"Server turned on")},e.enabled?"negative":"positive"),l=this.st.settings.portal_host,d=he("Name",r,()=>_e(r.value,[],"Shown to people in their portal and apps.")),c=Zn(()=>({host:o.value,port:e.port,id:e.id}),($,h,m)=>A.endpointProbe($,h,m),()=>p.refresh(),{empty:l?`Empty = the portal’s address (${l}).`:"Empty = the portal’s address."}),p=he("Public address",o,c.help);o.addEventListener("input",c.schedule),c.schedule();let u=e.reached?`Reached from the internet ${re(e.reached,this.st.now)}.`:"Never reached from the internet yet — test with a phone on mobile data.",x=he("DNS for devices",a,()=>Wo(a.value,e.address));return t("div",{class:"dl-stack gap16"},[Rt("Connection",[t("p",{class:"dl-muted"},"The name people see, where devices find the router, and DNS. The port is on AmneziaWG."),fe("router","Server","What people see",[d]),fe("globe","Devices connect to","A DDNS name keeps links working when your IP changes; not through Cloudflare (use a DNS-only name or an IP)",[p,t("div",{class:`dl-sub ${e.reached?"ok":"warn"}`},u)]),fe("file","For every device","Changing it marks devices “Update config” until they import again",[x])],[t("span"),H("Save",()=>{let $=ze([d,p,x]);if($){U($,"warning");return}return this.save(e,{name:r.value,endpoint:o.value,dns:a.value})},"positive")]),Rt("Danger zone",[t("div",{class:"dl-setrow"},[t("div",{class:"dl-stack"},[t("span",{class:"dl-setrow-label"},e.enabled?"Turn off this server":"This server is off"),t("span",{class:"dl-sub"},e.enabled?"Stops the tunnel and disconnects everyone on it. Settings and people are kept.":"Nobody can connect. Turn it on to bring the tunnel back.")]),t("div",{class:"dl-setrow-ctl"},s)]),t("div",{class:"dl-setrow"},[t("div",{class:"dl-stack"},[t("span",{class:"dl-setrow-label"},"Change the tunnel network"),t("span",{class:"dl-sub"},`Devices have ${$t(e.subnet)}.x addresses now. A new range when it clashes with a network you connect to; every device then needs its configuration again.`)]),t("div",{class:"dl-setrow-ctl"},H([b("edit")," Change"],()=>this.changeSubnet(e),"negative"))]),t("div",{class:"dl-setrow"},[t("div",{class:"dl-stack"},[t("span",{class:"dl-setrow-label"},"Remove server"),t("span",{class:"dl-sub"},`Removes the tunnel, its firewall rules and ${i} ${i===1?"person":"people"} with all their devices. A backup is made first.`)]),t("div",{class:"dl-setrow-ctl"},H([b("trash")," Remove"],()=>this.remove(e),"negative"))])],[],"danger")])}access(e){let r=xo(this.st,e),o=ca(e,this.st,async()=>{let a=await this.refreshStatus();if(!a)return;let i=a.servers.find(l=>l.id===e.id)??e;o.update(a);let s=xo(a,i);r.replaceWith(s),r=s});return t("div",{class:"dl-stack gap16"},[o.el,t("div",{class:"dl-health-cols"},[r,na(this.st,e)])])}awg(e){let r={st:this.st,save:(o,a)=>this.save(e,o,a),refresh:()=>this.refresh()};return t("div",{class:"dl-stack gap16"},[Be(e).settingsCard(r,e)])}async addServer(){let e=await G(()=>A.setupDefaults());e&&dom.content(this.root,this.wizard(e,!0,()=>{dom.content(this.root,[this.tabsEl,this.headEl,this.secEl,this.bodyEl]),this.paint()}))}async changeSubnet(e){let r=await G(()=>A.serverPorts(e.id));if(!r)return;let o=r.networks??[],a=this.st.people.filter(l=>l.server===e.id).reduce((l,d)=>l+d.devices.length,0),i=se($t(e.subnet),{class:"cbi-input-text dl-mono dl-w-range"}),s=he("Address range",i,()=>Yn(i.value,o,""));oe("Change the tunnel network",[s,t("p",{class:"dl-muted"},a?`${a} device${a===1?" gets a new address and stops":"s get new addresses and stop"} connecting until ${a===1?"it imports its":"they import their"} configuration again (from their personal link or from you).`:"No devices on this server yet: nothing else changes.")],[ie()," ",H("Change",async()=>{let l=s.help();if(l.bad){U(l.text,"warning");return}let d=an(i.value);if(d===e.subnet){ae();return}await G(()=>A.serverUpdate(e.id,{subnet:d}),"Tunnel network changed")&&(ae(),a&&U("Devices are marked “Update config” until they import again.","info",6e3),await this.refresh())},"negative")]),setTimeout(()=>i.select(),50)}async remove(e){let r=this.st.people.filter(o=>o.server===e.id);oe(`Remove ${e.name}?`,[t("p",{},`This removes the tunnel, its firewall rules and ${r.length} ${r.length===1?"person":"people"} with all their devices. A backup is made first.`)],[ie()," ",H("Remove",async()=>{ae(),await G(()=>A.serverDelete(e.id),"Server removed")&&setTimeout(()=>{location.href=ko()},800)},"negative")])}wizard(e,r=!1,o){let a={id:e.id,name:e.name,endpoint:e.endpoint,port:e.port,range:$t(e.subnet),preset:mn(e.awg),portal:!1,portal_port:e.portal_port||8443,lan_like:!0,lan_zone:e.lan_zone,wan_zone:e.wan_zone},i=0,s=!r&&a.portal_port===a.port,l=()=>/^\d{1,3}(\.\d{1,3}){3}$/.test(a.endpoint),d=()=>It(a.port,e.udp_taken??[],`Opened on the WAN firewall automatically.${a.port===4500?" 4500 is IPsec’s port: most networks let it through.":""}`),c={ddns:"From your DDNS name.",cert:"From your Let’s Encrypt certificate.",wan:"Your WAN address now — it may change; a DDNS name is better.",portal:"The portal’s address."},p=Zn(()=>({host:a.endpoint,port:a.port}),(S,T,N)=>A.endpointProbe(S,"",N),()=>u?.refresh(),{idle:()=>a.endpoint===e.endpoint&&e.endpoint_from?c[e.endpoint_from]??"":""}),u=null,x=e.wan_kind==="cgnat"||e.wan_kind==="private"?Xe("alert","warn",e.wan_kind==="cgnat"?"Your router has no public address (CGNAT)":`Your router is behind another router (WAN ${e.wan_ip})`,e.wan_kind==="cgnat"?"The ISP shares one address: devices can only connect if the ISP gives you a public address or IPv6. Ask them, or use a DDNS name that points at an IPv6 address.":"Forward the UDP port on the upstream router to this one and use a DDNS name or that router’s public address here.",""):"",$=e.awg_state?.tools&&e.awg_state.handler===!1?t("div",{class:"dl-note warn"},[b("alert"),t("span",{},"Creating the server restarts the network for a few seconds: AmneziaWG was installed after the network started.")]):"",h=()=>Yn(a.range,e.networks??[],$t(e.subnet)),m=()=>sn(a.portal_port,e.tcp_taken??[],l()),C=t("div",{class:"dl-wizard"}),B=(S,T={})=>{let N=se(String(a[S]),T);return N.addEventListener("input",()=>{S==="port"||S==="portal_port"?a[S]=N.value.trim()===""?0:Number(N.value):a[S]=N.value.trim(),S==="port"&&s&&(a.portal_port=a.port),S==="portal_port"&&(s=a.portal_port===a.port)}),N},w={id:"server",title:"Server",render:()=>t("div",{class:"dl-wizard-groups"},[t("p",{class:"dl-muted"},r?"One more server: another port or disguise for networks where the first does not get through, or its own home access rules. People are moved between servers from their page.":"Where devices connect to. A hostname that always points at your router (DDNS) keeps links working when your IP changes."),fe("router","Server","What people see",[he("Name",B("name"),()=>_e(a.name,[],"Shown to people in their portal and apps."))]),fe("globe","Devices connect to","A hostname or IP address of your router on the internet; not through Cloudflare (use a DNS-only name or an IP). IPv6 works too, and is the way out of CGNAT",[(()=>{let S=B("endpoint",{placeholder:"vpn.example.com",class:"cbi-input-text dl-mono"});return u=he("Public address",S,p.help),S.addEventListener("input",p.schedule),p.schedule(),u})()]),x,$]),check:()=>{let S=_e(a.name);if(S.bad)return`Name: ${S.text}`;let T=kt(a.endpoint,a.port);return T.bad?`Public address: ${T.text}`:null}},v={id:"awg",title:"AmneziaWG",render:()=>t("div",{class:"dl-wizard-groups"},[fe("globe","Listening","Where devices reach AmneziaWG from the internet",[he("UDP port",B("port",{inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),d)]),fe("network","Tunnel network","Addresses devices get inside the tunnel",[(()=>{let S=B("range",{class:"cbi-input-text dl-w-range dl-mono","aria-label":"First three numbers of the device addresses"});return he("Device addresses",S,h,t("span",{class:"dl-suffixed"},[S,t("span",{class:"dl-mono"},".x")]))})()]),fe("shield","Disguise","So networks that block VPNs do not recognise the tunnel. Off = plain WireGuard",[hn(e.awg,a.preset,S=>a.preset=S,void 0,e.awg_state?.tools!==!1)])]),check:()=>{let S=d();if(S.bad)return`UDP port: ${S.text}`;let T=h();return T.bad?`Device addresses: ${T.text}`:null}},y={id:"portal",title:"Portal",render:()=>{let S=B("portal_port",{inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),T=he("Listening port",S,m);T.hidden=!a.portal;let N=we([["off","Off"],["on","On"]],a.portal?"on":"off",{label:"Personal portal",onChange:W=>{a.portal=W==="on",T.hidden=!a.portal}});return t("div",{class:"dl-wizard-groups"},[fe("home","Internet like a home device","How devices reach the internet",[ce("Through the home network",ve(a.lan_like,"Internet like a home device",W=>a.lan_like=W),"Whatever handles home traffic on this router (proxies, filters, DNS) handles theirs too. Change it later under Servers → Access.")]),fe("link","Personal portal","A page where each person adds their own devices with their personal link",[ce("Portal",N,"Off: only you add devices, from LuCI. On: people manage their devices within the limits you set."),T])])},check:()=>{if(!a.portal)return null;let S=m();return S.bad?`Portal port: ${S.text}`:null}},E=()=>[w,v,r?null:y].filter(S=>S!=null),k=e.awg_state,z=k?.missing??[],f=z.length?t("div",{class:"dl-list dl-notices"},[Xe("shield","bad","AmneziaWG isn’t installed",`The tunnel needs ${z.join(" and ")}. Install the build made for this firmware, then create the server.`,H("Install",()=>Sn(()=>location.reload()),"positive"))]):k&&!k.loaded?t("div",{class:"dl-list dl-notices"},[Xe("shield","warn","AmneziaWG’s kernel module doesn’t load on this firmware","Try another build in Components, or update OpenWrt. The server can’t start until it loads.",t("a",{class:"cbi-button cbi-button-neutral",href:L.url("admin/network/dawnline/updates")},"Open Components"))]):"",g=()=>{let S=E();i>=S.length&&(i=S.length-1),dom.content(C,[t("h2",{},r?"Add a server":"Set up Dawnline"),f,t("div",{class:"dl-steps"},S.map((T,N)=>t("span",{class:`dl-step${N===i?" current":N<i?" done":""}`},[t("b",{},N<i?"✓":String(N+1)),T.title]))),t("div",{class:"dl-panel"},S[i].render()),t("div",{class:"dl-actions"},[i>0?H("Back",()=>{i--,g()}):o?H("Cancel",o):"",t("span",{class:"dl-spacer"}),i<S.length-1?H("Next",()=>{let T=S[i].check?.();if(T){U(T,"warning");return}i++,g()},"positive"):H("Create server",async()=>{for(let N of S){let W=N.check?.();if(W){U(W,"warning");return}}let T=await G(()=>A.serverCreate(a.id,a.name,e.ifname,a.port,an(a.range),a.endpoint,e.mtu,a.preset,a.lan_zone,a.wan_zone,a.lan_like,r?void 0:a.portal,r?void 0:a.portal_port),"Server created");T&&(T.network_restart&&U("Restarting the network so it knows AmneziaWG: back in a few seconds"),setTimeout(()=>{location.href=ko(T.id)},T.network_restart?1e4:1500))},"positive",{disabled:z.length>0,title:z.length?"Install AmneziaWG first":null})])])};return g(),C}};function lt(n){let e={el:n(),refresh(){let r=n();e.el.replaceWith(r),e.el=r}};return e}function Re(n,e,r,o,a="",i=[]){return t("section",{class:`dl-setsec ${a}`,id:`dl-set-${n}`},[t("div",{class:"dl-setsec-body"},[i.length?t("div",{class:"dl-setsec-head"},[t("h3",{},e),t("span",{class:"dl-spacer"}),...i]):t("h3",{},e),...r]),o.length?t("div",{class:"dl-setsec-foot"},o):""])}function ga(n){let e=n.filter(a=>a.status!=="skip"),r=e.filter(a=>a.status==="error"||a.status==="warn"),o=e.some(a=>a.status==="error")?"error":r.length?"warn":"ok";return{bad:r,worst:o}}function va(n){let e=n.d.settings,r=n.d.effective,o=n.d.cert,a=ve(r.portal_enabled,"Enable portal"),i=se(e.portal_port,{placeholder:"8443",inputmode:"numeric",class:"cbi-input-text dl-w-port"}),s=se(e.portal_title,{placeholder:"Dawnline"}),l=se(e.portal_redirect,{placeholder:"Show “Not found”",class:"cbi-input-text dl-mono"}),d=se("",{placeholder:"vpn.example.com or an IP","aria-label":"Other address"}),c=O=>/^\d{1,3}(\.\d{1,3}){3}$/.test(O),p=[r.portal_host,...r.portal_alt??[]].filter((O,X,P)=>O&&P.indexOf(O)===X),u=!!n.portal,x=[],$=O=>{O&&!x.some(X=>X.host===O)&&x.push({host:O,kind:c(O)?"ip":"name",ips:[],here:!1,cloudflare:!1,cert:!1})},h=O=>{x=[...O,...x.filter(X=>!O.some(P=>P.host===X.host))],!p.length&&O[0]&&(p=[O[0].host])};n.portal&&h(n.portal.candidates),p.forEach($);let m=O=>O.kind==="ip"?t("span",{class:"dl-addr-warn"},[b("alert"),"Plain HTTP: the link and VPN keys travel unencrypted"]):t("span",{class:"dl-sub"},O.cloudflare?"Behind Cloudflare · often stalls in Russia":O.ips.length?O.here?`Points at this router${O.cert?" · Let’s Encrypt certificate":" · no certificate yet"}`:`Points at ${O.ips.join(", ")}, not this router`:u?"Your address":"Checking where it points…"),C=t("div",{class:"dl-addr-opts",role:"group","aria-label":"Portal addresses"}),B=O=>{p.includes(O)?p.length>1&&(p=p.filter(X=>X!==O)):p=[...p,O],w(),E()},w=()=>dom.content(C,[...x.map(O=>{let X=p.includes(O.host),P=p[0]===O.host;return t("div",{class:`dl-addr-opt${X?" on":""}`,role:"checkbox","aria-checked":X?"true":"false",tabindex:"0",click:()=>B(O.host),keydown:D=>{(D.key===" "||D.key==="Enter")&&(D.preventDefault(),B(O.host))}},[t("i",{class:"dl-addr-check"},X?b("check"):""),t("span",{class:"dl-stack"},[t("span",{class:"dl-mono"},O.host),m(O)]),P?t("span",{class:"dl-pill info"},"Main"):X?t("button",{type:"button",class:"dl-linkbtn",click:D=>{D.stopPropagation(),p=[O.host,...p.filter(_=>_!==O.host)],w(),E()}},"Make main"):O.cloudflare?t("span",{class:"dl-pill warn"},"Cloudflare"):O.kind==="ip"?t("span",{class:"dl-pill"},"IP"):O.here&&O.cert?t("span",{class:"dl-pill ok"},"Recommended"):""])}),t("div",{class:"dl-addr-opt other"},[t("i",{class:"dl-addr-check"},b("plus")),d,H("Add",()=>{let O=d.value.trim().toLowerCase();if(!O)return;let X=kt(O);if(X.bad){U(X.text,"warning");return}$(O),p.includes(O)||(p=[...p,O]),d.value="",w(),E()})])]);d.addEventListener("keydown",O=>{O.key==="Enter"&&(O.preventDefault(),d.nextElementSibling?.click())});let v=t("div",{class:"dl-links"}),y=()=>{},E=()=>{y();let O=Number(i.value)||r.portal_port;dom.content(v,p.map((X,P)=>{let D=c(X),_=D?O+1:O,I=`${D?"http":"https"}://${X}${_===(D?80:443)?"":`:${_}`}/`;return t("div",{class:"dl-link-row"},[t("span",{class:`dl-link-ic ${D?"warn":"ok"}`},b(D?"alert":"lock")),t("span",{class:"dl-mono dl-link-url"},[I,t("b",{},"kamiro-telosu-bavine")]),P===0?t("span",{class:"dl-pill info"},"Main"):D?t("span",{class:"dl-pill warn"},"HTTP"):""])}))};w(),E(),i.addEventListener("input",()=>E());let k={portal:"Portal running",portal_dns:"Points here",portal_reply:"Answers reach visitors",portal_http:"Plain HTTP",cert:"Certificate"},z=n.d.needs??{https:[],acme:[],home:[]},f=O=>{if(!r.portal_enabled)return t("div",{hidden:!0});if(!O)return fe("check","Ready to share","The portal’s checks from Health",[t("p",{class:"dl-muted dl-loading"},"Running checks…")]);let X=O.filter(M=>M.status!=="skip");if(!X.length)return t("div",{hidden:!0});let{bad:P,worst:D}=ga(O),_=t("div",{class:"dl-ready-details",hidden:!0},X.map(M=>t("div",{class:`dl-ready-item ${M.status}`},[b(M.status==="ok"?"check":"alert"),t("span",{class:"dl-stack"},[t("span",{},M.title),t("span",{class:"dl-sub"},M.detail)])]))),I=t("div",{class:"dl-stack gap8"},[t("div",{class:`dl-ready-sum ${D}`},[b(D==="ok"?"check":"alert"),t("span",{class:"dl-stack"},[t("b",{},D==="ok"?`All ${X.length} checks passed`:`${X.length-P.length} of ${X.length} checks passed`),P.length?t("span",{class:"dl-sub"},P.map(M=>M.detail).join(" ")):t("span",{class:"dl-sub"},"Links will open for the people you send them to.")]),t("button",{type:"button",class:"dl-linkbtn",click:M=>{_.hidden=!_.hidden,M.currentTarget.textContent=_.hidden?"Details":"Hide"}},"Details")]),t("div",{class:"dl-chips-row"},X.map(M=>t("span",{class:`dl-check-chip ${M.status}`,title:M.detail},[b(M.status==="ok"?"check":"alert"),k[M.id]??M.title]))),_]);return fe("check","Ready to share","The portal’s checks from Health",[I])},g=O=>{if(!r.portal_enabled||!O&&!z.https.length)return t("span",{hidden:!0});if(z.https.length)return t("span",{class:"dl-pill bad"},"Can’t start");let{worst:X}=ga(O);return t("span",{class:`dl-pill ${X==="ok"?"ok":X==="error"?"bad":"warn"}`},X==="error"?"Needs attention":"Ready")},S=f(n.portal?.checks??null),T=g(n.portal?.checks??null);n.portalFill=O=>{u=!0,h(O.candidates),w(),E();let X=f(O.checks);S.replaceWith(X),S=X;let P=g(O.checks);T.replaceWith(P),T=P};let N=o&&!o.self_signed&&o.expires?Ue(o.expires):"",W=he("Listening port",i,()=>sn(i.value.trim()===""?r.portal_port:Number(i.value),n.d.tcp_taken??[],p.some(c)));y=W.refresh;let q=he("Title",s,()=>Zo(s.value)),Y=he("Unknown links",l,()=>Yo(l.value)),R=!!(e.portal_cert&&e.portal_key),K=o?R?"Your files":o.self_signed?"Self-signed":"Let’s Encrypt":"Portal is off",Z=()=>{let O=se(e.portal_cert,{placeholder:"/etc/ssl/…/fullchain.crt"}),X=se(e.portal_key,{placeholder:"/etc/ssl/…/key"});oe("Use your own certificate",[t("p",{class:"dl-muted"},"Paths on the router. Leave both empty to pick a certificate automatically."),ce("Certificate file",O),ce("Key file",X)],[ie()," ",H("Save",()=>{ae(),n.save({portal_cert:O.value.trim(),portal_key:X.value.trim()},"Certificate saved","portal")},"positive")])},de=(O,X,P,D,_,I)=>Xe(O,X,P,D,H(I,()=>Yt(_,z[_],()=>n.reload("portal")),"positive")),Q=z.https.length?de("lock","bad","HTTPS isn’t available on this router",`The portal needs ${z.https.join(" and ")}. It can’t start without them.`,"https","Install"):"",te=z.acme.length&&(!o||o.self_signed)?de("lock","","Free certificate from Let’s Encrypt",`ACME isn’t installed. With it the router gets a certificate${e.portal_host?` for ${e.portal_host}`:""} and browsers stop warning.`,"acme","Install ACME"):"",ge=[t("div",{class:"dl-row"},[b("lock"),t("span",{class:"dl-row-main dl-stack"},[t("b",{},[K,N?t("span",{class:"dl-faint"},` · until ${N}`):""]),t("span",{class:"dl-sub dl-ellipsis",title:o?.path??""},o?o.self_signed?"Made by the router: browsers warn until a certificate covers the address.":`${R?"Your files":"Found automatically"} · ${o.path}`:"Turn the portal on to see its certificate.")])]),t("div",{class:"dl-row"},[b("file"),t("span",{class:"dl-row-main dl-stack"},[t("b",{},"Your own files"),t("span",{class:"dl-sub"},R?`${e.portal_cert} · ${e.portal_key}`:"Not set: the certificate is picked automatically.")]),R?H("Reset",()=>n.save({portal_cert:"",portal_key:""},"Automatic certificate","portal"),"negative"):"",H(R?"Change":"Use files",Z)]),te];return Re("portal","Personal portal",[t("span",{class:"dl-muted"},"A page where each person adds and manages their devices with their personal link."),Q?t("div",{class:"dl-list"},[Q]):"",fe("network","Port","How the portal listens (80 and 443 stay free)",[W]),fe("edit","Appearance","What people see",[q,Y]),fe("link","Addresses","Pick one or more; the first is the main link",[C,t("div",{class:"dl-stack gap8"},[v,t("span",{class:"dl-sub"},"Example code; each person gets their own three words.")])]),fe("lock","Certificate","Used for HTTPS links",ge),S],[t("span"),H("Save",()=>{let O=ze([W,q,Y]);if(O){U(O,"warning");return}return n.save({portal_enabled:Pe(a)?"1":"0",portal_host:p[0]??"",portal_alt:p.slice(1),portal_port:i.value,portal_title:s.value,portal_redirect:l.value.trim()},"Saved","portal")},"positive")],"",[T,a])}function ba(n){let e=n.d.settings,r=n.d.effective,o=se(e.default_device_limit,{placeholder:"3",inputmode:"numeric",class:"cbi-input-text dl-w-port"}),a=ve(r.hostnames,"Device hostnames"),i=se(e.domain,{placeholder:"lan",class:"cbi-input-text dl-w-port"}),s=se(e.home_dns_fallback==="none"?"":e.home_dns_fallback||r.home_dns_fallback||"",{placeholder:"None",inputmode:"decimal",class:"cbi-input-text dl-w-ip dl-mono"}),l=he("Devices per person",o,()=>{if(!o.value.trim())return{text:"The default, 3. Pre-filled when you add someone.",bad:!1};let p=ln(o.value);return p.bad?p:{text:"Pre-filled when you add someone.",bad:!1}}),d=he("Device hostnames",i,()=>Qo(i.value),t("div",{class:"dl-hostport"},[a,t("span",{class:"dl-faint dl-mono"},"phone.myata."),i])),c=he("Fallback DNS",s,()=>{let p=Xo(s.value);return p.bad?p:{text:`For Home-only devices using home names: ${p.text}`,bad:!1}});return Re("defaults","New people",[l,d,c],[t("span"),H("Save",()=>{let p=ze([l,d,c]);if(p){U(p,"warning");return}return n.save({default_device_limit:o.value,hostnames:Pe(a)?"1":"0",domain:i.value,home_dns_fallback:s.value},"Saved","defaults")},"positive")])}function xa(n){let e=n.d.effective,r=ve(e.geo_enabled,"Locations"),o=t("select",{class:"cbi-input-select"},[t("option",{value:"ipwho.is",selected:e.geo_provider!=="ipapi.co"?"selected":null},"ipwho.is (fallback: ipapi.co)"),t("option",{value:"ipapi.co",selected:e.geo_provider==="ipapi.co"?"selected":null},"ipapi.co (fallback: ipwho.is)")]);return Re("map","Map & locations",[t("div",{class:"dl-setrow head"},[t("span",{class:"dl-muted"},"Show where people connect from on the Overview and person pages, at city level."),r]),ce("Provider",o)],[t("span",{class:"dl-sub"},"The router sends each new client IP to the provider once and caches the city. Map tiles load in your browser from CARTO; people never see the map."),H("Save",()=>n.save({geo_enabled:Pe(r)?"1":"0",geo_provider:o.value},"Saved","map"),"positive")])}var Ws=[["app","Dawnline"],["amneziawg","AmneziaWG"],["packages","System packages"]];function wa(n){let e=n.d.effective.updates,r=ve(e.check,"Check automatically",h=>$(h,Pe(a))),o=we([["6h","Every 6 h"],["12h","Every 12 h"],["1d","Daily"],["7d","Weekly"]],e.interval,{label:"How often",cls:"sm"}),a=ve(e.auto,"Install automatically",h=>$(Pe(r),h)),i=se(e.time,{placeholder:"04:00",inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono","aria-label":"Time"}),s=we([["scheduled","At a set time"],["immediate","As soon as found"]],e.mode,{label:"When",cls:"sm",onChange:h=>i.hidden=h!=="scheduled"});i.hidden=e.mode!=="scheduled";let l=new Set(e.targets),d=t("div",{class:"dl-chips-row"},Ws.map(([h,m])=>{let C=qe(m,l.has(h),()=>{l.delete(h)||l.add(h),un(C,l.has(h))});return C})),c=ve(e.keep,"Keep the previous version"),p=ve(e.mirrors,"GitHub mirrors"),u=ce("How often",o),x=[ce("When",t("div",{class:"dl-hostport"},[s,i]),"A set time keeps tunnel restarts out of the evening; the run happens within an hour of it."),ce("Components",d,"AmneziaWG is off by default: a new kernel module restarts every tunnel.")],$=(h,m)=>{u.hidden=!h;for(let C of x)C.hidden=!m};return $(e.check,e.auto),Re("updates","Updates",[t("span",{class:"dl-muted"},"How Dawnline keeps its components current. Every Dawnline update makes a backup of the settings first."),ce("Check automatically",r,"Looks for new versions in the background; Components shows what it found and the service log names it."),u,ce("Install automatically",a,"Downloads and installs new versions of the components below."),...x,ce("Keep the previous version",c,"Saves the replaced Dawnline or AmneziaWG package on flash, so Roll back works without internet. Under 1 MB."),ce("GitHub mirrors",p,"When GitHub is unreachable, download through mirrors. Checksums are still verified.")],[t("span",{class:"dl-sub"},"Run a check or an update by hand in Components."),H("Save",()=>{if(s.dataset.value==="scheduled"){let h=er(i.value);if(h.bad){U(`Time: ${h.text}`,"warning");return}}return n.save({update_check:Pe(r)?"1":"0",update_interval:o.dataset.value,update_auto:Pe(a)?"1":"0",update_mode:s.dataset.value,update_time:i.value.trim(),update_targets:[...l],update_keep:Pe(c)?"1":"0",update_mirrors:Pe(p)?"1":"0"},"Saved","updates")},"positive")])}function ya(n){let e=n.d.logs,r=e.policy,o=we([["7","7 days"],["30","30 days"],["90","90 days"],["365","1 year"],["0","No limit"]],String(r.keep_days),{label:"Keep activity",cls:"sm"}),a=we([["500","500"],["2000","2,000"],["5000","5,000"],["20000","20,000"]],String(r.max),{label:"Maximum events",cls:"sm"}),i=we([["10min","Every 10 min"],["hourly","Hourly"],["off","Memory only"]],r.persist,{label:"Save to flash",cls:"sm"}),s=we([["31","1 month"],["62","2 months"],["180","6 months"],["365","1 year"],["730","2 years"]],String(r.usage_days),{label:"Daily traffic",cls:"sm"}),l=we([["12","1 year"],["24","2 years"],["60","5 years"],["120","10 years"]],String(r.usage_months),{label:"Monthly traffic",cls:"sm"}),d=new Set(r.categories),c=t("div",{class:"dl-chips-row"},Mt.map($=>{let h=qe([ut[$],t("b",{},String(e.by_category[$]??0))],d.has($),()=>{d.delete($)||d.add($),un(h,d.has($))},{title:sr[$]});return h})),p=e.oldest?Ue(new Date(e.oldest*1e3)):"",u=($,h,m,C)=>t("div",{class:"dl-row"},[b($),t("span",{class:"dl-row-main dl-stack"},[t("b",{},h),t("span",{class:"dl-sub"},m)]),...C]),x=$=>H($.toUpperCase(),async()=>{let[h,m]=await Promise.all([A.status(1),A.events(2e4)]);Fe(h,m.events,$)},"neutral",{title:`Download the log as ${$.toUpperCase()}`});return Re("logs","Logs & history",[t("p",{class:"dl-muted"},pn(r)),ce("Keep activity",o,"Older events are removed automatically."),ce("Maximum size",a,"Newest events are kept when the log is full."),ce("Record",c,"Switched-off categories are not logged from now on."),ce("Save to flash",i,"The log lives in memory and is copied to flash. Memory only saves flash writes but is lost on reboot."),ce("Daily traffic",s,"Per-day history behind the charts."),ce("Monthly traffic",l,"Per-month totals; data limits use the current month."),t("h4",{class:"dl-setsub"},"Stored data"),t("div",{class:"dl-list"},[u("activity","Activity log",e.events?`${tn(e.events,"event")} since ${p} · ${Nt(e.log_ram)} in memory${r.persist==="off"?"":`, ${Nt(e.log_flash)} on flash`}`:"Empty",[x("csv"),x("json"),H("Clear",()=>tt("Clear activity","Removes events from the log on the router.",{},()=>n.reload("logs")),"negative")]),u("chart","Traffic history",e.usage_days?`${tn(e.usage_days,"day")} since ${Ue(e.usage_since)} · ${Nt(e.usage_flash)} on flash`:"Empty",[H("Reset",()=>St("all","","",()=>setTimeout(()=>n.reload("logs"),300)),"negative")]),u("pin","Location cache",`${tn(n.d.geo_cached,"address","addresses")} · ${Nt(e.geo_flash)} on flash`,[H("Clear",async()=>{await G(()=>A.geoClear(),"Location cache cleared")&&await n.reload("logs")},"negative")])])],[t("span",{class:"dl-sub"},"Clear one person or device from their own page."),H("Save",()=>n.save({log_keep_days:o.dataset.value,log_max:a.dataset.value,log_persist:i.dataset.value,usage_keep_days:s.dataset.value,usage_keep_months:l.dataset.value,log_category:[...d]},"Saved","logs"),"positive")])}var Fs={manual:"Manual",auto:"Nightly","pre-restore":"Before restore","pre-import":"Before import","pre-delete":"Before removing a server","pre-update":"Before update"},ka=3;function $o(n){let e=new Date(n*1e3),r=e.toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"}),o=Math.round((new Date(new Date().toDateString()).getTime()-new Date(e.toDateString()).getTime())/864e5);return`${o===0?"Today":o===1?"Yesterday":e.toLocaleDateString("en-GB",{day:"numeric",month:"short"})}, ${r}`}async function qs(n){let e=await G(()=>A.backupRead(n.name));if(!e)return;let r=atob(e.data),o=new Uint8Array(r.length);for(let i=0;i<r.length;i++)o[i]=r.charCodeAt(i);let a=globalThis;Te(n.name,new a.Blob([o],{type:"application/gzip"}))}function $a(n,e){return t("div",{class:"dl-row dl-bk-row"},[t("span",{class:"dl-group-ic"},b("archive")),t("span",{class:"dl-row-main dl-stack"},[t("b",{},$o(n.created)),t("span",{class:"dl-sub"},`${Fs[n.reason]??n.reason} · ${ee(n.size)}`)]),t("span",{class:"dl-pcard-actions"},[Le("download","Download",()=>qs(n),"neutral","dl-icon-only"),Le("more","More",r=>Ce(r.currentTarget,[{label:"Restore",icon:b("reset"),run:async()=>{await le("Restore this backup?",`Everything returns to ${$o(n.created)}. The current state is backed up first.`,"Restore",!0)&&await G(()=>A.backupRestore(n.name),"Restored")&&e(!0)}},{label:"Delete",icon:b("trash"),danger:!0,run:async()=>{await le("Delete this backup?",`The backup from ${$o(n.created)} is removed from the router.`,"Delete",!0)&&await G(()=>A.backupDelete(n.name),"Backup deleted")&&e()}}]),"neutral","dl-icon-only")])])}function Ca(n,e){let r=n.slice(0,ka).map(d=>$a(d,e)),o=n.slice(ka),a=n.length?t("div",{class:"dl-list"},[...r,o.length?t("details",{class:"dl-bk-older"},[t("summary",{},[b("chevron"),`${o.length} older backup${o.length===1?"":"s"}`]),...o.map(d=>$a(d,e))]):""]):t("div",{class:"dl-list"},[t("div",{class:"dl-row dl-muted"},"No backups yet.")]),i=H("Restore from file",async()=>{let d=await Fn(".tar.gz,.tgz,application/gzip","base64");if(!d)return;await le("Restore from file?",`Replace the current Dawnline configuration with ${d.name}? The current state is backed up first.`,"Restore",!0)&&await G(()=>A.backupUpload(d.data),"Restored")&&e(!0)}),s=H("Export JSON",async()=>{let d=await G(()=>A.exportJson());d&&Te(`dawnline-export-${new Date().toISOString().slice(0,10)}.json`,JSON.stringify(d,null,2),"application/json")}),l=H("Import JSON",async()=>{let d=await Fn(".json,application/json","text");if(!d)return;let c;try{c=JSON.parse(d.data)}catch{U("Not a JSON file.","error");return}await le("Import?","This replaces the whole Dawnline configuration on this router. The current state is backed up first.","Import",!0)&&await G(()=>A.importJson(c),"Imported")&&e(!0)});return t("section",{class:"dl-setsec",id:"dl-set-backups"},[t("div",{class:"dl-setsec-body"},[t("div",{class:"dl-setsec-head"},[t("div",{class:"dl-stack"},[t("h3",{},"Backups"),t("span",{class:"dl-sub"},"Nightly when something changed, and before every restore, import or update. The last 10 are kept.")]),t("span",{class:"dl-spacer"}),H([b("plus")," Back up now"],async()=>{await G(()=>A.backupCreate(),"Backup created")&&e()},"positive")]),a]),t("div",{class:"dl-setsec-foot"},[t("span",{class:"dl-sub"},"Backups contain private keys: keep downloads safe. JSON moves everything except usage history to another router."),t("span",{class:"dl-row-actions dl-bk-actions"},[i,s,l])])])}function Ks(){let n=se("",{placeholder:"remove"}),e=H("Remove Dawnline",async()=>{await G(()=>A.uninstall(n.value.trim()),"Dawnline removed")&&(ae(),setTimeout(()=>location.reload(),800))},"negative",{disabled:!0});n.addEventListener("input",()=>{e.disabled=n.value.trim()!=="remove"}),oe("Remove Dawnline?",[t("p",{},"Everyone is disconnected and the tunnel, firewall rules and portal are removed. A backup is made first. Type “remove” to confirm."),n],[ie()," ",e])}function Ea(){return Re("danger","Remove Dawnline from this router",[t("p",{class:"dl-muted"},"Deletes the tunnel, firewall rules, access table and hostnames Dawnline created, and stops the service. People and keys are kept in a backup.")],[t("span"),H("Remove",()=>Ks(),"negative")],"danger")}var Hn=class{constructor(){this.root=t("div",{class:"dl-settings-main"});this.backups=[];this.portal=null;this.portalSeq=0;this.cards={}}load(){return A.settingsGet()}render(e){this.d=e,this.cards={portal:lt(()=>va(this)),defaults:lt(()=>ba(this)),map:lt(()=>xa(this)),updates:lt(()=>wa(this)),logs:lt(()=>ya(this)),backups:lt(()=>Ca(this.backups,a=>this.loadBackups(a))),danger:lt(()=>Ea())};let r=["portal","defaults","map","updates","logs","backups","danger"];dom.content(this.root,r.map(a=>this.cards[a].el)),this.loadBackups().then(()=>{new URLSearchParams(location.search).get("section")==="backups"&&document.getElementById("dl-set-backups")?.scrollIntoView({block:"start"})}),this.loadPortal();let o=new URLSearchParams(location.search).get("section");return o&&o!=="backups"&&requestAnimationFrame(()=>document.getElementById(`dl-set-${o}`)?.scrollIntoView({block:"start"})),t("div",{},[t("div",{class:"dl-pagehead"},[t("h2",{class:"dl-h1"},"Settings")]),this.root])}async save(e,r,o){let a=await G(()=>A.settingsUpdate(e),r);a&&(this.d=a,this.cards[o].refresh(),o==="portal"&&this.loadPortal())}async loadPortal(){let e=++this.portalSeq,r=await A.portalInfo().catch(()=>null);e===this.portalSeq&&(this.portal=r??this.portal??{candidates:[],checks:[]},this.portalFill?.(this.portal))}async loadBackups(e=!1){e&&await this.reload();let r=await A.backupList().catch(()=>null);r&&(this.backups=r.backups,this.cards.backups?.refresh())}async reload(e){let r=await A.settingsGet().catch(()=>null);if(r){if(this.d=r,e)this.cards[e].refresh();else for(let o of Object.values(this.cards))o.refresh();(!e||e==="portal")&&this.loadPortal()}}};function La(n,e=!1){return n&&(e?/^https?:\/\//i:/^https:\/\//i).test(n)?n:null}function Ma(n){let e=[],r=l=>{let d=[],c=/(`[^`]+`)|(\*\*[^*]+\*\*)|(\[[^\]]+\]\((https?:\/\/[^)\s]+)\))|(https?:\/\/[^\s<>()]+[^\s<>().,;:!?])/g,p=0;for(let u;u=c.exec(l);)u.index>p&&d.push(l.slice(p,u.index)),u[1]?d.push(t("code",{},u[1].slice(1,-1))):u[2]?d.push(t("b",{},u[2].slice(2,-2))):u[3]?d.push(t("a",{href:u[4],target:"_blank",rel:"noopener"},u[3].replace(/^\[|\]\(.*$/g,""))):u[5]&&d.push(t("a",{href:u[5],target:"_blank",rel:"noopener"},u[5].replace(/^https?:\/\/(github\.com\/)?/,""))),p=u.index+u[0].length;return p<l.length&&d.push(l.slice(p)),d},o=null,a=[],i=null,s=()=>{a.length&&e.push(t("p",{},r(a.join(" ")))),a=[],o=null};for(let l of n.replace(/\r/g,"").split(`
`)){let d=l.trimEnd();if(i){/^```/.test(d.trim())?(e.push(t("pre",{},i.join(`
`))),i=null):i.push(l);continue}if(/^```/.test(d.trim())){s(),i=[];continue}let c=/^(#{1,6})\s+(.*)$/.exec(d),p=/^\s*[-*+]\s+(.*)$/.exec(d)??/^\s*\d+[.)]\s+(.*)$/.exec(d);c?(s(),e.push(t("h5",{},r(c[2])))):p?(a.length&&s(),o||(o=t("ul",{}),e.push(o)),o.appendChild(t("li",{},r(p[1])))):d.trim()?(o&&(o=null),a.push(d.trim())):s()}return i&&e.push(t("pre",{},i.join(`
`))),s(),e}function Sa(n){let e=[],r=!1;for(let o of n.replace(/\r/g,"").split(`
`)){let a=/^#{1,6}\s+(.*)$/.exec(o);if(a){if(r=/^install\b/i.test(a[1].trim()),/^what.s new$/i.test(a[1].trim()))continue}else/^\*\*Full Changelog\*\*/.test(o)&&(r=!1);r||e.push(o)}return e.join(`
`).replace(/\n{3,}/g,`
`).trim()}async function Qt(n,e,r,o){let a=t("div",{class:"dl-notes"},t("p",{class:"dl-muted dl-loading"},"Loading release notes…")),i=t("div",{class:"dl-op-head"}),s="";oe(r,[i,a],[H([b("copy")," Copy"],()=>ue(s,"Release notes copied"))," ",ie("Close")],"wide");try{let l=await A.updatesNotes(n,e,o??"");s=Sa(l.body||"");let d=La(l.url);dom.content(i,[l.published?t("span",{class:"dl-pill"},Ue(l.published)):"",l.prerelease?t("span",{class:"dl-pill warn"},"Pre-release"):"",t("span",{class:"dl-spacer"}),d?t("a",{href:d,target:"_blank",rel:"noopener",class:"dl-linkbtn"},["On GitHub ",b("open")]):""]),dom.content(a,s.trim()?Ma(s):t("p",{class:"dl-muted"},"This release has no notes."))}catch(l){dom.content(a,t("p",{class:"dl-muted"},be(l)))}}var Ta={"6h":"every 6 h","12h":"every 12 h","1d":"daily","7d":"weekly"},Co=n=>n?Ue(n):"";function Vs(n){let e=/^(.{20,}?)(?:;\s|:\s)/.exec(n)?.[1];return e||(n.length<=90?n:`${n.slice(0,90).replace(/[\s,;:]+\S*$/,"")}…`)}function Pa(n,e){let r=n.st,o=r.policy,a=r.kept?.app,i=e?.update&&e.tag?e.tag:r.version,s=x=>()=>Qt("app",x,`What’s new in Dawnline ${x.replace(/^v/,"")}`),l=e?.tag&&(e.update||e.status==="latest")?Js(n,e.tag,e.update?r.version:""):null,d=e?.tag??i,c=o.check&&r.auto?.check?r.auto.check+({"6h":6,"12h":12,"1d":24,"7d":168}[o.interval]??24)*3600:0,p=(x,$)=>t("div",{class:"dl-stack gap4"},[t("span",{class:"dl-metric-label"},x),t("span",{class:"dl-comp-side-v"},$)]),u=[{label:"What’s new",ic:"file",run:s(i)},{label:"Open on GitHub",ic:"globe",run:()=>window.open(`https://github.com/${r.repo}`,"_blank","noopener")},null,{label:`Reinstall ${r.version}`,ic:"reset",warn:!0,run:()=>n.op("app:reinstall","Reinstalling Dawnline",r.version)},a?{label:`Roll back to ${a.version}`,ic:"archive",warn:!0,run:async()=>{await le(`Roll back to Dawnline ${a.version}?`,`The copy kept on the router replaces ${r.version}. A backup of the settings is made first.`,"Roll back")&&n.op("app:rollback","Rolling back Dawnline",r.version)}}:null];return t("section",{class:"dl-panel flush dl-comp-hero"},[t("div",{class:"dl-comp-hero-main"},[t("div",{class:"dl-comp-hero-head"},[t("span",{class:"dl-group-ic"},b("sunrise")),t("b",{class:"dl-comp-name"},"Dawnline"),n.state("app",e,e?.latest??""),t("span",{class:"dl-spacer"}),n.round(()=>n.op("check:app","Checking Dawnline",r.version),u,!0)]),t("div",{class:"dl-comp-verrow"},[t("div",{class:"dl-stack"},[t("div",{class:"dl-comp-big"},[r.version,e?.update?t("small",{},`→ ${e.latest}`):e?.status==="dev"&&e.latest?t("small",{class:"dl-faint"},`release ${e.latest}`):""]),t("span",{class:"dl-faint dl-comp-meta"},e?.error?"":e?.update?e.published?`released ${Co(e.published)}`:"":e?.status==="dev"?"ahead of the latest release":e?`latest release${e.published?` · released ${Co(e.published)}`:""}`:"not checked yet")])]),l?.items.length?t("div",{class:"dl-stack gap4"},[t("ul",{class:"dl-comp-bullets"},l.items.map(x=>t("li",{},x))),l.total>l.items.length?t("button",{type:"button",class:"dl-linkbtn dl-comp-more",click:s(d)},`+${l.total-l.items.length} more in What’s new`):""]):"",e?.error?t("p",{class:"dl-sub dl-comp-lead dl-upd-bad"},e.error):"",e?.update?t("div",{class:"dl-comp-btns"},[H("Update now",()=>n.op("app","Updating Dawnline",r.version),"positive",{disabled:n.busy}),H("What’s new",s(i))]):"",Ys(n)]),t("div",{class:"dl-comp-hero-side"},[p("Source",[b("globe"),t("a",{href:`https://github.com/${r.repo}`,target:"_blank",rel:"noopener"},r.repo)]),p("Auto-update",[o.auto?Ee("ok","On"):Ee("","Off"),t("span",{class:"dl-muted"},o.auto?o.mode==="immediate"?"as soon as found":`${Ta[o.interval]==="weekly"?"weekly":"daily"} at ${o.time}`:o.check?`checks ${Ta[o.interval]}`:"checks off")]),p("Last check",r.check?[re(r.check.time,r.now),c>r.now?t("span",{class:"dl-faint"},`· next in ${xt(c-r.now)}`):""]:["Never"]),p("Rollback",a?[t("span",{class:"dl-mono"},a.version),t("span",{class:"dl-faint"},"kept on flash")]:[t("span",{class:"dl-muted"},o.keep?"Kept after the next update":"Off")])])])}function Js(n,e,r){if(n.notes.has(e))return n.notes.get(e)??null;n.notes.set(e,null);let o=a=>a.replace(/\*\*|`|\[([^\]]+)\]\([^)]*\)/g,(i,s)=>s??"").trim();return(async()=>{let i=((await A.updatesNotes("app",e,"").catch(()=>null))?.body??"").split(`
`).map(l=>/^\s*[-*+]\s+(.*)$/.exec(l)?.[1]).filter(l=>!!l);i.length||(i=(await A.updatesChanges(r,e).catch(()=>null))?.items??[]);let s={items:i.slice(0,3).map(l=>Vs(o(l))),total:i.length};n.notes.set(e,s),s.items.length&&n.root.isConnected&&n.paint()})(),null}function Ys(n){let e=t("div",{class:"dl-params-body"}),r=t("details",{class:"dl-params dl-comp-vers",open:n.versOpen?"open":null},[t("summary",{},[b("chevron"),t("span",{},"Versions"),t("span",{class:"dl-sub"},"install any release")]),e]);return r.addEventListener("toggle",()=>{n.versOpen=r.open,n.versOpen&&zn(n,e)}),n.versOpen&&zn(n,e),r}async function zn(n,e){let r=se("",{placeholder:"Tag, e.g. 0.3.1",class:"cbi-input-text dl-mono","aria-label":"Release tag"}),o=p=>{if(p=p.trim(),!/^v?[0-9][0-9A-Za-z.+~-]{0,40}$/.test(p))return U("Enter a release tag like 0.3.1","warning");_a(n,p)};r.addEventListener("keydown",p=>{p.key==="Enter"&&(p.preventDefault(),o(r.value))});let a=t("div",{class:"dl-comp-tag"},[r,H("Install",()=>o(r.value),"neutral",{disabled:n.busy})]),i=n.versPage,s=p=>{n.versPage=Math.max(1,n.versPage+p),zn(n,e)},l=p=>t("div",{class:"dl-comp-pager"},[t("button",{type:"button",class:"dl-linkbtn",disabled:i<=1?"disabled":null,click:()=>s(-1)},"← Newer"),t("span",{class:"dl-faint"},`Page ${i}`),t("button",{type:"button",class:"dl-linkbtn",disabled:p?null:"disabled",click:()=>s(1)},"Older →")]),d=n.versCache.get(i);if(!d){dom.content(e,[a,t("p",{class:"dl-muted dl-loading"},"Loading versions…")]);try{d=(await A.updatesReleases(i)).releases}catch(p){if(i!==n.versPage||!e.isConnected)return;dom.content(e,[a,t("div",{class:"dl-row-actions"},[t("span",{class:"dl-muted"},`Failed to load versions: ${be(p)}`),H("Try again",()=>zn(n,e))]),l(!1)]);return}if(n.versCache.set(i,d),i!==n.versPage||!e.isConnected)return}if(!d.length)return dom.content(e,[a,t("p",{class:"dl-muted"},i>1?"No more versions.":"No versions found."),l(!1)]);let c=n.st.version;dom.content(e,[a,...d.map(p=>{let u=p.tag.replace(/^v/,"");return t("div",{class:"dl-comp-ver"},[t("span",{class:"dl-mono"},u),t("span",{class:"dl-sub"},Co(p.published)),p.prerelease?Ee("warn","Pre-release"):"",t("span",{class:"dl-comp-ic"},Le("file","What’s new",()=>Qt("app",p.tag,`What’s new in Dawnline ${u}`))),u===c?Ee("ok","Installed"):H("Install",()=>_a(n,p.tag),"neutral",{disabled:n.busy})])}),l(d.length>=5)])}async function _a(n,e){let r=e.replace(/^v/,"");r.localeCompare(n.st.version,void 0,{numeric:!0})<0&&!await le(`Install Dawnline ${r}?`,`It is older than ${n.st.version}. A backup of the settings is made first; restore it from Settings if something looks wrong.`,"Install")||n.op(`app@${e}`,`Installing Dawnline ${r}`,n.st.version)}function Da(n,e){let r=n.st,o=r.kept?.amneziawg,a=e?.sources??{},i=Object.keys(a),s=e?.current??null,l=s?a[s]:void 0,d=!!e?.ru,c=r.needs?.awg??[],p=c.length?null:e?.installed??null,u=[];s&&p&&u.push({label:"Reinstall this build",warn:!0,ic:"reset",run:()=>n.op(`amneziawg:${s}${d?":ru":""}`,"Reinstalling AmneziaWG",p)}),o&&u.push({label:`Roll back to ${o.version}`,ic:"archive",warn:!0,run:async()=>{await le(`Roll back AmneziaWG to ${o.version}?`,"The build kept on the router is installed again. Every AmneziaWG tunnel restarts for a few seconds.","Roll back")&&n.op("amneziawg:rollback","Rolling back AmneziaWG",p??void 0)}});let x=[e?.release?{label:"What’s new",ic:"file",run:()=>Qt("amneziawg",e.release,`What’s new in the ${l?.label??"AmneziaWG"} build`,s??"slava")}:null,{label:"Open on GitHub",ic:"globe",run:()=>window.open(`https://github.com/${l?.repo??"Slava-Shchipunov/awg-openwrt"}`,"_blank","noopener")},...u.length?[null,...u]:[]].filter((f,g,S)=>f!==null||g>0&&S[g-1]!==null),$=r.tunnels??[],h=$.length?`Switching restarts ${$.length===1?"the tunnel":`${$.length} tunnels`} for a few seconds: ${$.join(", ")}. Devices keep their configurations.`:"Switching takes a few seconds. Devices keep their configurations.",m=$.length>1?`${$.slice(0,-1).join(", ")} and ${$[$.length-1]}`:$[0],C=$.length?`Switching restarts ${m} for a few seconds.`:"Switching takes a few seconds.",B=async f=>{let g=a[f];await le(p?`Switch to AmneziaWG ${g.gen}?`:`Install AmneziaWG ${g.gen}?`,`The ${g.label} build, ${g.version}. ${h}${g.gen==="3.1"?" Devices need AmneziaVPN 3.1 or newer.":""}`,p?"Switch":"Install")&&n.op(`amneziawg:${f}${d?":ru":""}`,p?`Switching to AmneziaWG ${g.gen}`:"Installing AmneziaWG",p??void 0)},w=f=>{let g=a[f],S=s===f&&!!p;return t("div",{class:"dl-row"},[t("span",{class:"dl-row-main dl-stack"},[t("b",{},g.gen?`AmneziaWG ${g.gen}`:"AmneziaWG"),t("span",{class:"dl-sub"},`${g.label} · ${g.gen==="3.1"?"AmneziaVPN 3.1+":"every app"}`)]),t("span",{class:"dl-mono dl-faint dl-comp-bver"},g.version??"none yet"),t("span",{class:"dl-comp-bact"},S?Ee("ok","Active"):g.version?H(p?"Switch":"Install",()=>B(f),p?"neutral":"positive",{disabled:n.busy}):Ee("","No build"))])},v=i.map(f=>a[f]?.newer?`${a[f].label} moves to ${a[f].newer.gen} with OpenWrt ${a[f].newer.tag.replace(/^v/,"")}.`:"").filter(Boolean),y=ve(d,"Russian translation",f=>{s&&n.op(`amneziawg:${s}${f?":ru":""}`,f?"Adding the Russian translation":"Removing the Russian translation",p??void 0)});y.disabled=!s||!p||n.busy;let E=n.awgOpen??!p,k=t("details",{class:"dl-params dl-comp-fold",open:E?"open":null},[t("summary",{},[b("chevron"),t("span",{},"Build and translation")]),t("div",{class:"dl-params-body"},[t("div",{class:"dl-list"},[...i.length?i.map(w):[t("div",{class:"dl-row"},t("span",{class:"dl-sub"},"Check for updates to see the builds for this router."))],t("div",{class:"dl-row"},[t("span",{class:"dl-row-main dl-stack"},[t("b",{},"Russian translation"),t("span",{class:"dl-sub"},"LuCI pages for AmneziaWG")]),t("span",{class:"dl-comp-bact"},y)])]),p&&i.length||v.length?t("div",{class:`dl-comp-status ${p&&i.length?"warn":"acc"}`},[b(p&&i.length?"alert":"download"),t("span",{},[p&&i.length?t("b",{},C):"",...v.map(f=>` ${f}`)])]):""])]);k.addEventListener("toggle",()=>n.awgOpen=k.open);let z=[];return e?.update&&p&&s?z.push(H(`Update to ${e.latest}`,()=>n.op(`amneziawg:${s}${d?":ru":""}`,"Updating AmneziaWG",p),"neutral",{disabled:n.busy})):z.push((e||c.length)&&!p?Ee("warn","Not installed"):n.state("amneziawg",e,e?.latest??"")),z.push(n.round(()=>n.op("check:amneziawg","Checking AmneziaWG",p??void 0),x)),[n.row("shield","AmneziaWG",[p?`${p}${e?.release?` · ${e.release} build`:""}`:c.length?`missing ${c.join(", ")}`:e?"not installed":"version not checked"],z),t("div",{class:"dl-comp-foldwrap"},k)]}var Zs=[{title:"Home-like link",sub:"Policy routing and the veth pair",pkgs:["ip-full","kmod-veth"],feature:"home"},{title:"HTTPS for the portal",sub:"OpenSSL for uhttpd",pkgs:["libustream-openssl","openssl-util"],feature:"https"},{title:"Certificates (ACME)",sub:"Let’s Encrypt certificate for the portal",pkgs:["acme","acme-acmesh-dnsapi"],feature:"acme",optional:!0}],Eo={home:"network",https:"lock",acme:"file"};function Aa(n,e){let r=n.st,o=e?.pkgs??{},a=Zs.filter(c=>c.feature==="home"?r.home:r.portal),i=async(c,p,u=c)=>{await le(`Update ${p}?`,`${u.join(", ")} from the OpenWrt feeds. Services that use them restart for a moment.`,"Update")&&n.op(`pkgs:${c.join(",")}`,`Updating ${p}`)},s=[{label:"Check system packages",ic:"refresh",run:()=>n.op("check:packages","Checking system packages")},{label:"Open the OpenWrt package list",ic:"globe",run:()=>window.open("https://openwrt.org/packages/start","_blank","noopener")}],l=0;return{rows:a.map(c=>{let p=c.pkgs.filter(m=>o[m]?.installed),u=[...new Set(p.flatMap(m=>[...o[m]?.latest?[m]:[],...o[m]?.with??[]]))],x=r.needs?.[c.feature]??c.pkgs.filter(m=>!o[m]?.installed),$=p.find(m=>o[m]?.latest),h=p.map(m=>`${m} ${o[m]?.installed??""}`).join(", ");return x.length?n.row(Eo[c.feature],c.title,[`${c.optional?"not installed":`missing ${x.join(", ")}`}`],[H("Install",()=>n.op(`pkgs:${x.join(",")}`,`Installing ${c.title}`),c.optional?"neutral":"positive",{disabled:n.busy}),t("span",{class:"dl-comp-ic"},n.more(s))]):e&&u.length?(l++,n.row(Eo[c.feature],c.title,$?[`${o[$].installed} → ${o[$].latest}`,u.length>1?` · +${u.length-1}`:""]:[u.join(", ")],[H("Update",()=>i(p.filter(m=>o[m]?.latest||o[m]?.with?.length),c.title,u),"neutral",{disabled:n.busy}),t("span",{class:"dl-comp-ic"},n.more(s))])):n.row(Eo[c.feature],c.title,[h||c.sub],[n.state("pkgs",e,""),t("span",{class:"dl-comp-ic"},n.more(s))])}),updates:l,total:a.length}}var Qs={app:"Dawnline",amneziawg:"AmneziaWG",pkgs:"System packages",all:"Components"};function Ha(n){let e=n.st,r=a=>{let i=it(a.component??"app"),s=Qs[i]??"Components",l=a.auto?"automatically":"by you",d="ok",c="check",p;if(a.kind==="found")d="accent",c="download",p=[t("b",{},(a.items??[]).join(", ")),` found by ${a.auto?"the automatic check":"a check"}`];else if(a.state==="failed")d="bad",c="x",p=[t("b",{},s),` ${a.kind==="install"?"update":"check"} failed${a.error?` · ${a.error}`:""}`];else{let u=a.from&&a.to&&a.from!==a.to?` ${a.from} → ${a.to}`:a.to?` ${a.to}`:"";p=[t("b",{},s),`${u} ${u?"":"updated "}${l}${a.took?` · ${xt(a.took)}`:""}`.replace(/\s+/g," ")]}return t("div",{class:"dl-row"},[t("span",{class:`dl-ev-tile ev ${d}`},b(c)),t("span",{class:"dl-row-main"},p),t("span",{class:"dl-faint dl-nowrap",title:new Date(a.ts*1e3).toLocaleString()},re(a.ts,e.now))])},o=e.history??[];return t("section",{class:"dl-panel flush"},[t("div",{class:"dl-panel-head pad"},[t("h3",{},"Activity"),t("span",{class:"dl-spacer"}),t("a",{href:`${L.url("admin/network/dawnline/diagnostics")}?tab=log`},"All in Log →")]),o.length?t("div",{},o.slice(0,8).map(r)):t("p",{class:"dl-sub dl-comp-empty"},"Updates, and checks that found something, show up here.")])}var Nn=class{constructor(){this.root=t("div",{class:"dl-upd"});this.following=null;this.versOpen=!1;this.versPage=1;this.versCache=new Map;this.notes=new Map;this.awgOpen=null}load(){return A.updatesStatus()}render(e){return this.st=e,this.paint(),e.job?.state==="running"&&this.follow(e.job),poll.add(async()=>{if(!this.root.isConnected)return;let r=await A.updatesStatus().catch(()=>null);if(!r)return;let o=this.st;this.st=r,r.job?.state==="running"&&this.following!=="starting"&&r.job.id!==this.following&&this.follow(r.job),(r.job?.id!==o.job?.id||r.job?.state!==o.job?.state||r.job?.phase!==o.job?.phase||r.check?.time!==o.check?.time)&&this.paint()},5),this.root}get busy(){return this.st.job?.state==="running"}async refresh(e){this.st=e??await A.updatesStatus().catch(()=>null)??this.st,this.paint()}async op(e,r,o){if(this.busy||this.following==="starting"){U("Another component action is already running","warning");return}this.following="starting",this.paint();let a=it(e),i=await Jt(e,{title:r,version:o,onJob:s=>this.following=s.id,onDone:s=>this.refresh(s),onUpdate:s=>{let l=s.check?.components??{};a==="amneziawg"&&l.amneziawg?.current?this.op(`amneziawg:${l.amneziawg.current}${l.amneziawg.ru?":ru":""}`,"Updating AmneziaWG",l.amneziawg.installed??void 0):this.op("app","Updating Dawnline",this.st.version)}});this.following==="starting"&&(this.following=i?.id??null),this.refresh()}async follow(e){this.following=e.id;let r=Mn(e),o={app:"Dawnline",amneziawg:"AmneziaWG",pkgs:"system packages",all:"components"}[r]??"components";await Jt(null,{title:`${e.action==="check"?"Checking":e.auto?"Automatic update:":"Updating"} ${o}`,onDone:a=>this.refresh(a)},e)}paint(){let e=this.st,r=e.check?.components??{},o=e.firmware,a=Aa(this,r.packages),i=(e.needs?.awg??[]).length>0,l=(!i&&r.amneziawg?.update&&r.amneziawg.installed?1:0)+a.updates;dom.content(this.root,[t("div",{class:"dl-pagehead"},[t("div",{class:"dl-stack"},[t("h2",{class:"dl-h1"},"Components"),t("span",{class:"dl-faint"},[o?.version?`OpenWrt ${o.version} · ${o.target}`:"",e.check?`checked ${re(e.check.time,e.now)}`:"not checked yet"].filter(Boolean).join(" · "))]),t("div",{class:"dl-row-actions"},[t("a",{class:"cbi-button cbi-button-neutral dl-icon-btn",href:`${L.url("admin/network/dawnline/settings")}?section=updates`},[b("edit")," Settings"]),H([b("refresh")," Check all"],()=>this.op("check","Checking all components"),"neutral",{disabled:this.busy})])]),Pa(this,r.app),t("div",{class:"dl-comp-cols"},[t("section",{class:"dl-panel flush"},[t("div",{class:"dl-panel-head pad"},[t("h3",{},"Components"),t("span",{class:"dl-spacer"}),t("span",{class:"dl-faint dl-comp-count"},i?l?`AmneziaWG not installed · ${l} update${l===1?"":"s"}`:"AmneziaWG not installed":!r.amneziawg&&!r.packages?"":l?`${l} of ${1+a.total} need${l===1?"s":""} an update`:"Everything is up to date")]),t("div",{},[...Da(this,r.amneziawg),...a.rows])]),Ha(this)])])}state(e,r,o){let a=this.st.job;if(a?.state==="running"){let i=l=>l==="packages"?"pkgs":l,s=a.action==="check"?[i(a.component||"all")]:(a.component??"").split(" ").map(l=>i(it(l)));if(s.includes(e)||s.includes("all"))return t("button",{type:"button",class:"dl-pill info dl-comp-run",title:"Show progress",click:()=>this.follow(a)},[a.action==="check"?"Checking":"Updating","…"])}return r?r.error?Ee("warn","Check failed",r.error):r.update?Ee("info","Update available"):r.status==="dev"?Ee("info","Newer than release",`The latest release is ${o}`):Ee("ok","Up to date"):Ee("","Not checked")}more(e){let r=H([b("more")],()=>Ce(r,e.filter((o,a,i)=>o!==null||a>0&&a<i.length-1&&i[a-1]!==null&&i.slice(a+1).some(Boolean)).map(o=>o?{label:o.label,icon:b(o.ic),warn:o.warn,run:o.run}:null)),"neutral",{title:"More","aria-label":"More"});return r}round(e,r,o=!1){let a=this.busy?" is-busy":"",i;return o?i=H([b("refresh")," Check"],e,"neutral",{class:`cbi-button cbi-button-neutral dl-comp-check${a}`,"aria-label":"Check for updates"}):(i=Le("refresh","Check for updates",e,"neutral",a.trim()),i.removeAttribute("title"),i.setAttribute("aria-label","Check for updates"),me(i,()=>["Check for updates"])),t("span",{class:"dl-comp-ic"},[i,this.more(r)])}row(e,r,o,a){return t("div",{class:"dl-row"},[t("span",{class:"dl-group-ic"},b(e)),t("span",{class:"dl-row-main dl-stack"},[t("b",{},r),t("span",{class:"dl-mono dl-faint dl-comp-sub"},o)]),...a])}};var za=(n,e)=>t("div",{class:"cbi-value"},[t("label",{class:"cbi-value-title"},n),t("div",{class:"cbi-value-field"},e)]);function Na(n){let e=n.st.servers.find(r=>r.id===n.p.server)?.name??"Home";Kt(n.p,e)}async function Ra(n){let e=n.p,r=e.code_set??0,o=e.devices.filter(l=>l.created_by==="portal"&&l.created>=r),a=o.map(l=>t("input",{type:"checkbox",id:`dl-rm-${l.id}`,checked:"checked","data-id":l.id})),i=[t("p",{},"The old link stops working right away.")];o.length&&i.push(t("p",{},"Devices added through the old link keep working until they are removed. Remove them too:"),t("div",{class:"dl-checklist"},o.map((l,d)=>t("label",{for:`dl-rm-${l.id}`},[a[d],` ${l.name}`]))));let s=async()=>{let l=a.filter(c=>c.checked).map(c=>c.dataset.id),d=await G(()=>A.personRegen(e.id,l),l.length?`New link created, ${l.length} device${l.length===1?"":"s"} removed`:"New link created");d&&(ae(),l.length&&await n.refresh(),d.link&&await ue(d.link,"New link copied"))};oe("Create a new link?",i,[ie()," ",H("Create new link",s,"negative")])}function Lo(n){let e=t("textarea",{class:"cbi-input-textarea dl-note-input",rows:3,maxlength:500,placeholder:"Only you see this"},n.p.note??"");oe("Note",[e],[ie()," ",H("Save",async()=>{ae(),await n.patch({note:e.value.trim()},e.value.trim()?"Note saved":"Note removed")},"positive")]),setTimeout(()=>e.focus(),50)}function Ia(n){let e=n.p,r=t("select",{class:"cbi-input-select"},[t("option",{value:"pause",selected:e.expire_action==="pause"?"selected":null},"Pause access"),t("option",{value:"notify",selected:e.expire_action==="notify"?"selected":null},"Keep access"),t("option",{value:"remove",selected:e.expire_action==="remove"?"selected":null},"Remove their devices")]),o=t("select",{class:"cbi-input-select"},[0,1,3,7,14].map(a=>t("option",{value:a,selected:e.expire_warn===a?"selected":null},a?`${a} day${a===1?"":"s"} before`:"Don’t warn")));oe("When access ends",[za("Then",r),t("div",{class:"cbi-value"},[t("label",{class:"cbi-value-title"},"Warn"),t("div",{class:"cbi-value-field"},[o,t("div",{class:"cbi-value-description"},"Shown in their portal and on the Overview.")])])],[ie()," ",H("Save",async()=>{ae(),await n.patch({expire_action:r.value,expire_warn:o.value},"Saved")},"positive")])}function Ba(n){let e=t("input",{type:"text",class:"cbi-input-text",value:n.p.name,maxlength:48}),r=ye("Name",e,()=>_e(e.value,[],"Shown in their portal and apps."));oe("Rename",[r],[ie()," ",H("Save",async()=>{let o=r.help();if(o.bad){U(o.text,"warning");return}await n.patch({name:e.value.trim()},"Renamed")&&ae()},"positive")]),setTimeout(()=>e.select(),50)}function Oa(n){let e=n.p,r=n.st.servers.filter(i=>i.id!==e.server),o=t("select",{class:"cbi-input-select"},r.map(i=>t("option",{value:i.id},`${i.name} · ${i.endpoint||"no address"}:${i.port}`))),a=e.devices.length;oe(`Move ${e.name} to another server`,[za("Server",o),t("p",{class:"dl-muted"},a?`${a} device${a===1?" gets a new address and stops":"s get new addresses and stop"} connecting until ${a===1?"it imports its":"they import their"} configuration again (from the personal link or from you). Circles and home networks of the old server are left behind.`:"They have no devices yet: nothing else changes.")],[ie()," ",H("Move",async()=>{await n.patch({server:o.value},`Moved to ${r.find(i=>i.id===o.value)?.name??"the server"}`)&&(ae(),a&&U("Devices are marked “Update config” until they import again.","info",6e3))},"positive")])}async function ja(n){let e=n.p;await le(`Delete ${e.name}?`,`All ${e.devices.length} devices are disconnected immediately and the personal link stops working.`,"Delete",!0)&&await G(()=>A.personDelete(e.id),"Deleted")&&(location.href=Pt(e.server))}function Ua(n){let e=n.p,r=n.st,o=e.online?"online now":e.last_seen?`last seen ${re(e.last_seen,r.now)}`:"never connected",a=e.created?`Added ${Me(je(new Date(e.created*1e3)))}`:"",i=e.has_link??r.settings.portal_enabled,s=[{label:"Rename",icon:b("edit"),run:()=>Ba(n)},{label:e.note?"Edit note":"Add note",icon:b("file"),run:()=>Lo(n)},...r.servers.length>1?[{label:"Move to server…",icon:b("server"),run:()=>Oa(n)}]:[],...i?[null,{label:"Invite card",icon:b("qr"),run:()=>Na(n)},{label:"New link",icon:b("key"),run:()=>Ra(n)}]:[],null,...e.paused?[]:[{label:"Pause",icon:b("pause"),warn:!0,run:()=>n.patch({paused:!0},"Paused")}],{label:"Delete",icon:b("trash"),danger:!0,run:()=>ja(n)}];return t("div",{class:"dl-person-head"},[t("div",{class:"dl-pagehead"},[t("div",{class:"dl-person-id"},[t("span",{class:`dl-avatar lg${e.online?" online":""}`},He(e.name)),t("div",{class:"dl-stack"},[t("div",{class:"dl-title-row"},[t("h2",{class:"dl-h1"},e.name),Io(e)]),t("span",{class:"dl-faint",title:a},`${e.devices.length} of ${e.device_limit} devices · ${o}`)])]),t("div",{class:"dl-pcard-actions"},[e.paused?H([b("play")," Resume"],()=>n.patch({paused:!1},"Resumed"),"add"):"",i?Le("link","Copy link",()=>$n(e.id),"neutral","dl-icon-only"):"",Le("more","More",l=>Ce(l.currentTarget,s),"neutral","dl-icon-only")])]),e.note?t("button",{type:"button",class:"dl-pnote",title:"Edit note",click:()=>Lo(n)},[b("file"),t("span",{},e.note)]):""])}function Ga(n){let e=n.p,r=n.series[n.series.length-1];return t("div",{class:`dl-person-live${e.online?"":" solo"}`},[e.online?_n(e.rate??[],n.st.now,r?[r.rx,r.tx]:[0,0]):"",Pn(n.series,`${ee(e.month[0]+e.month[1])} this month`)])}async function Xs(n,e){let r=await G(()=>A.deviceConfig(e.id));r&&oe(`Set up ${e.name}`,[await n.core.connectBlock(r,"qr")],[ie("Close")])}async function el(n,e){let r=await G(()=>A.deviceConfig(e.id));if(!r)return;if(!r.has_private_key){U("This device made its own keys in the browser; its configuration only exists there.","warning");return}let o=n.core.file.make(r);Te(o.name,o.text,"application/octet-stream")}function Wa(n){let e=n.p,r=n.st.now,o=d=>Ge(e,d,n.deviceOpts()),a=d=>c=>{c.target.closest("button:not(.dl-dcard-title), a")||o(d)},i=d=>H([b("more")],c=>Wr(c.currentTarget,e,d,n.deviceOpts()),"neutral",{title:"QR, file, key, rename, new keys, remove",class:"cbi-button cbi-button-neutral dl-icon-only"}),s=nn(e.devices).map(d=>{let c=t("div",{class:"dl-dcard-head"},[t("span",{class:"dl-dcard-ic"},b(d.kind)),t("button",{type:"button",class:"dl-dcard-title",click:()=>o(d)},[t("b",{},d.name),on(d,r,void 0,e),d.config_stale?t("span",{class:"dl-pill warn dl-stale"},"Update config"):""]),i(d)]),p=t("div",{class:"dl-dcard-trend"},[t("div",{class:"dl-stack"},[t("b",{},ee(d.month[0]+d.month[1])),t("span",{class:"dl-sub"},"this month")]),ua(n.devSeries[d.id]??[])]);return t("article",{class:`dl-dcard clickable${d.online?" online":""}${d.disabled?" off":""}`,click:a(d)},[c,d.handshake?p:d.disabled?t("div",{class:"dl-sub"},`${Qe[d.kind]} · created ${re(d.created,r)} ${d.created_by==="portal"?"in the portal":"by you"}.`):t("div",{class:"dl-chips-row"},[t("button",{type:"button",class:"dl-chipbtn",click:()=>Xs(n,d)},[b("qr"),"Show QR"]),t("button",{type:"button",class:"dl-chipbtn",click:()=>el(n,d)},[b("download"),"Config"])])])}),l=e.devices.length>=e.device_limit;return s.push(t("button",{type:"button",class:"dl-dslot add",click:()=>ot(e,n.deviceOpts())},[t("span",{class:"dl-dslot-ic"},b("plus")),t("span",{class:"dl-stack"},[t("b",{},"Add device"),t("span",{class:"dl-sub"},l?`Over the limit · ${e.devices.length} of ${e.device_limit}`:`${e.devices.length} of ${e.device_limit}`)])])),t("section",{class:"dl-devsec"},[t("div",{class:"dl-panel-head"},[t("h3",{},"Devices"),t("span",{class:"dl-sub"},`${e.online} online`)]),t("div",{class:"dl-dgrid"},s)])}function Fa(n){let e=n.p,r=we([["device","Device’s own DNS"],["home","Home names"]],e.dns_mode,{label:"DNS",cls:"sm",optimistic:!1,onChange:a=>n.patch({dns_mode:a},a==="home"?"Home names on — devices need their configuration again":"Device DNS — devices need their configuration again")}),o=n.st.settings.home_dns_fallback;return t("div",{class:"dl-stack gap4 dl-dnspick"},[t("div",{class:"dl-row-actions"},[t("span",{class:"dl-sub"},"DNS"),r]),t("span",{class:"dl-sub"},e.dns_mode==="home"?["Names like ",t("span",{class:"dl-mono"},`nas.${n.st.settings.domain}`)," work. Internet names are resolved at home, so they depend on the tunnel",o?[" (",t("span",{class:"dl-mono"},o)," takes over when it is down)."]:" — with no fallback set, they stop when it is down."]:"Internet keeps working exactly as without the VPN. Reach home devices by IP address.")])}function qa(n){let e=n.p,o=n.st.servers.find(i=>i.id===e.server)?.home??[];if(o.length<2)return"";let a=new Set(e.home_nets?.length?e.home_nets:o.map(i=>i.dev));return t("div",{class:"dl-stack gap4"},[t("div",{class:"dl-chips-row"},o.map(i=>qe(i.dev,a.has(i.dev),()=>{let s=new Set(a);if(s.delete(i.dev)||s.add(i.dev),!s.size)return U("Keep at least one network, or choose Internet only.","warning",5e3);let l=s.size===o.length?[]:[...s];n.patch({home_nets:l},l.length?`${e.name} reaches ${l.join(", ")}`:`${e.name} reaches every home network`)},{title:i.nets.join(", ")}))),t("span",{class:"dl-sub"},e.home_nets?.length?`Home networks ${e.name} reaches. Networks added to the server later stay out.`:`Home networks ${e.name} reaches: all of them. Untick one to keep ${e.name} out of it.`)])}function Ka(n){let e=new Set(n.p.services??[]);return t("div",{class:"dl-stack gap4"},[t("div",{class:"dl-chips-row"},n.st.services.map(r=>qe(r.name,e.has(r.id),()=>{let o=new Set(e);o.delete(r.id)||o.add(r.id),n.patch({services:[...o]},o.size?"Home services updated":"Whole home network")},{title:`${r.address}${r.ports.length?` · ${r.ports.join(", ")}`:""}`}))),t("span",{class:"dl-sub"},e.size?"Only the selected services at home.":"Whole home network. Pick services to narrow it down.")])}function Va(n){let e=n.p,r=n.st;if(r.servers.find(c=>c.id===e.server)?.mesh!=="circles"||!at(e))return"";let a=r.circles.filter(c=>c.server===e.server),i=a.find(c=>c.id===e.circle),s=i?r.people.filter(c=>c.id!==e.id&&c.circle===i.id&&at(c)).map(c=>c.name):[],l=t("button",{type:"button",class:"dl-chipbtn",click:()=>Ce(l,[...a.map(c=>({label:c.name,icon:bo(c),run:()=>c.id!==e.circle&&n.patch({circle:c.id},`${e.name} is in ${c.name}`)})),e.circle?{label:"No circle",icon:b("x"),run:()=>n.patch({circle:""},`${e.name} is in no circle`)}:null,{label:"New circle",icon:b("plus"),run:()=>En(r,e.server,null,()=>n.refresh())}])},"Change"),d=i?r.people.filter(c=>c.circle===i.id&&at(c)):[e];return t("div",{class:"dl-tile2"},[t("div",{class:"dl-tile2-label"},[t("span",{},"Devices see each other"),l]),t("div",{class:"dl-tile2-row"},[t("span",{class:"dl-tile2-value"},i?i.name:"No circle"),t("span",{class:"dl-avstack",title:d.map(c=>c.name).join(", ")},d.slice(0,5).map(c=>t("span",{class:"dl-avatar sm"},He(c.name))))]),t("span",{class:"dl-sub"},i?s.length?[e.name,...s].join(", "):`Nobody else in ${i.name} yet`:`Only ${e.name}'s own devices`)])}function Ja(n){let e=n.p,r=n.st.now,o=t("div",{class:"dl-slots"});for(let s=0;s<Math.max(e.device_limit,e.devices.length);s++){let l=e.devices[s],d=s>=e.device_limit,c=t("i",{class:d?"over":l?"used":""});me(c,()=>[t("div",{class:"dl-tip-title"},l?`${l.name}${d?" · over the limit":""}`:"Free slot"),t("div",{class:"dl-muted"},l?l.online?"Connected":l.handshake?`Last seen ${re(l.handshake,r)}`:"Not set up yet":"They can add a device here")]),o.appendChild(c)}let a=Math.max(1,e.devices.length),i=t("button",{type:"button","aria-label":"Allow fewer devices",disabled:e.device_limit<=a?"disabled":null,click:()=>n.patch({device_limit:String(e.device_limit-1)})},"−");return e.device_limit<=a&&e.devices.length>1&&me(i,()=>[t("div",{class:"dl-tip-title"},`${e.devices.length} devices in use`),t("div",{class:"dl-muted"},"Remove a device first to lower the limit")]),t("div",{class:"dl-tile2"},[t("div",{class:"dl-tile2-label"},"Devices"),t("div",{class:"dl-tile2-row"},[t("span",{class:"dl-tile2-value"},[String(e.devices.length),t("span",{class:"dl-faint"},` / ${e.device_limit}`)]),t("div",{class:"dl-stepper"},[i,t("button",{type:"button","aria-label":"Allow more devices",disabled:e.device_limit>=32?"disabled":null,click:()=>n.patch({device_limit:String(e.device_limit+1)})},"+")])]),o])}var tl={internet:"Browse the internet through your router. No access to devices at home, and home cannot reach theirs.",lan:"Reach devices at home, and home reaches theirs. Internet stays on their own connection.",both:"Home devices and the internet, all through your router. Home reaches their devices too."},Ya=/^([01]\d|2[0-3]):[0-5]\d$/;function nl(n){let e=n.p,r=n.today,o=Ye(e.expires,r),a=t("input",{type:"date",class:"dl-date-hidden",value:e.expires,tabindex:"-1","aria-hidden":"true"});a.addEventListener("change",()=>a.value&&n.patch({expires:a.value},`Access until ${Me(a.value)}`));let i=(c,p)=>{let u=zo(e.expires&&(o??-1)>=0?e.expires:"",c,p,r);n.patch({expires:u},`Access until ${Me(u)}`)},s=[["week",1,"+1 week"],["month",1,"+1 month"],["month",3,"+3 months"],["year",1,"+1 year"]].map(([c,p,u])=>t("button",{type:"button",class:"dl-chipbtn",click:()=>i(c,p)},u)),l=t("span",{class:"dl-datechip"},[t("button",{type:"button",class:"dl-chipbtn",click:()=>{a.focus({preventScroll:!0});try{a.showPicker()}catch{}}},[b("calendar"),e.expires?Me(e.expires):"Date"]),a]),d={pause:"pause access",notify:"keep access",remove:"remove their devices"}[e.expire_action];return t("div",{class:"dl-tile2"},[t("div",{class:"dl-tile2-label"},[t("span",{},"Access ends"),e.expires?t("span",{class:o!=null&&o<0?"dl-bad":Ze(e,o)?"dl-warn":"dl-ok"},o!=null&&o<0?"ended":`${o} day${o===1?"":"s"} left`):t("span",{class:"dl-faint"},"no end date")]),t("div",{class:"dl-chips-row"},[...s,l,e.expires?t("button",{type:"button",class:"dl-chipbtn",click:()=>n.patch({expires:""},"No end date")},"No end"):""]),t("div",{class:"dl-tile2-foot"},[t("span",{class:"dl-muted"},`When it ends: ${d}${e.expire_warn?`, warn ${e.expire_warn} day${e.expire_warn===1?"":"s"} before`:""}`),t("a",{href:"#",click:c=>{c.preventDefault(),Ia(n)}},"Change")])])}function ol(n){let e=n.p,r=e.quota_used||e.month[0]+e.month[1],o=e.quota_limit?Math.min(100,e.quota_used/e.quota_limit*100):0,a=t("div",{class:`dl-meter${o>=100?" bad":o>=90?" warn":""}`},[t("i"),e.quota_limit?t("span",{class:"mark",title:"Alert at 90%"}):""]);a.firstChild.style.width=`${o}%`,e.quota_limit&&me(a,()=>[t("div",{class:"dl-tip-title"},`${o.toFixed(1)}% used`),t("div",{class:"dl-muted"},`${ee(e.quota_used)} of ${ee(e.quota_limit)} · ${ee(Math.max(0,e.quota_limit-e.quota_used))} left`),t("div",{class:"dl-faint"},"Alert at 90%")]);let i=we([["month","Monthly"],["total","Total"]],e.quota_period,{label:"Data limit period",cls:"sm",optimistic:!1,onChange:l=>n.patch({quota_period:l})}),s=[10,50,100].map(l=>t("button",{type:"button",class:`dl-chipbtn${e.quota_gb===l?" on":""}`,click:()=>n.patch({quota_gb:String(l)},`Data limit ${l} GB`)},`${l} GB`));return s.push(t("button",{type:"button",class:`dl-chipbtn${e.quota_gb?"":" on"}`,click:()=>n.patch({quota_gb:""},"No data limit")},"Unlimited")),s.push(t("button",{type:"button",class:"dl-chipbtn",click:()=>{let l=t("input",{type:"number",class:"cbi-input-text dl-w-port",min:0,step:"any",value:e.quota_gb?String(e.quota_gb):""}),d=ye("Data limit (GB)",l,()=>dn(l.value,e.quota_period==="month"));oe("Data limit",[d],[ie()," ",H("Save",async()=>{let c=d.help();if(c.bad){U(c.text,"warning");return}let p=l.value.trim();await n.patch({quota_gb:p},p&&Number(p)>0?`Data limit ${p} GB`:"No data limit")&&ae()},"positive")]),setTimeout(()=>l.select(),50)}},"Custom")),t("div",{class:"dl-tile2"},[t("div",{class:"dl-tile2-label"},[t("span",{},"Data"),i]),t("div",{class:"dl-tile2-row"},[t("span",{class:"dl-tile2-value"},[ee(r),e.quota_limit?t("span",{class:"dl-faint"},` of ${ee(e.quota_limit)}`):t("span",{class:"dl-faint"}," · no limit")]),e.quota_period==="month"?t("span",{class:"dl-sub"},"resets on the 1st"):""]),e.quota_limit?a:"",t("div",{class:"dl-chips-row"},s),e.quota_gb&&e.quota_period==="month"?t("div",{class:"dl-tile2-foot"},[t("span",{class:"dl-muted"},e.bonus_gb?`Includes +${e.bonus_gb} GB extra this month`:"Need a little more this month?"),t("a",{href:"#",click:l=>{l.preventDefault(),n.patch({bonus_gb:String((e.bonus_gb||0)+10)},"+10 GB this month")}},"+10 GB this month")]):"",t("div",{class:"dl-tile2-foot"},[t("span",{class:"dl-muted"},`${ee(e.total[0]+e.total[1])} in total`),t("button",{type:"button",class:"dl-linkbtn danger",click:()=>St("person",e.id,e.name,()=>setTimeout(()=>n.refresh(),300))},"Reset usage")])])}function rl(n){let e=n.p,r=!!e.hours,[o,a]=(e.hours||"07:00-23:00").split("-"),i=t("input",{type:"time",class:"cbi-input-text",value:o,"aria-label":"From"}),s=t("input",{type:"time",class:"cbi-input-text",value:a,"aria-label":"To"}),l=t("div",{class:"dl-tile2-row"},[i,t("span",{class:"dl-faint"},"to"),s]),d=()=>{let x=`${i.value}-${s.value}`;if(x!==e.hours){if(!Ya.test(i.value)||!Ya.test(s.value))return U("Enter both times, like 07:00 and 23:00.","warning");if(i.value===s.value)return U("The start and the end must differ.","warning");n.patch({hours:x},`Allowed ${i.value}–${s.value}`)}};l.addEventListener("focusout",x=>{l.contains(x.relatedTarget)||d()});for(let x of[i,s])x.addEventListener("keydown",$=>{$.key==="Enter"&&($.preventDefault(),d())});let c=t("button",{type:"button",role:"switch","aria-checked":r?"true":"false",class:`dl-switch${r?" on":""}`,"aria-label":"Limit hours",click:()=>{if(r)return n.patch({hours:""},"Any time");c.classList.add("on"),c.setAttribute("aria-checked","true"),p.textContent="Set the hours, then press Enter",u.appendChild(l),i.focus()}},t("i")),p=t("span",{},r?`${o} – ${a} (router time)`:"Any time"),u=t("div",{class:"dl-tile2"},[t("div",{class:"dl-tile2-row"},[t("div",{class:"dl-stack"},[t("span",{class:"dl-tile2-label"},"Allowed hours"),p]),c]),r?l:""]);return u}function Za(n){let e=n.p,r=we(["internet","lan","both"].map(o=>[o,[b(o==="internet"?"globe":o==="lan"?"home":"shield"),o==="internet"?"Internet":o==="lan"?"Home":"Both"]]),e.access,{label:"Access",cls:"wide",optimistic:!1,onChange:o=>n.patch({access:o},`Access: ${ct[o]}`)});return t("section",{class:"dl-devsec","aria-label":"Access and limits"},[t("div",{class:"dl-panel-head"},[t("h3",{},"Access & limits")]),t("div",{class:"dl-panel"},[t("div",{class:"dl-stack gap8"},[t("span",{class:"dl-tile2-label"},"Can reach"),r,t("span",{class:"dl-sub"},tl[e.access]),e.access==="lan"&&n.st.services.length?Ka(n):"",at(e)?qa(n):"",e.access==="lan"?Fa(n):""]),t("div",{class:"dl-tiles2"},[Ja(n),Va(n),nl(n),ol(n),rl(n)])])])}function al(n){let e=n.st,r=t("div",{class:"dl-panel-head pad"},[t("h3",{},"Locations"),t("span",{class:"dl-spacer"}),e.geo.enabled?_t("30d",a=>n.map?.setRange(a),!1):"",H("Hide",()=>{n.mapOpen=!1,n.map?.destroy(),n.map=null,n.paintPlaces()},"neutral")]);if(!e.geo.enabled)return t("div",{class:"dl-panel flush"},[r,t("div",{class:"dl-map-off"},["Locations are off. ",t("a",{href:L.url("admin/network/dawnline/settings")},"Turn them on in Settings"),"."])]);let o=new nt({openPerson:()=>{},openDevice:(a,i)=>{let s=n.p.devices.find(l=>l.id===i);s&&Ge(n.p,s,n.deviceOpts())}},"30d",280);return n.map=o,requestAnimationFrame(()=>o.mount(n.mapData())),t("div",{class:"dl-panel flush"},[r,o.el])}function Qa(n){let e=n.st;if(!e.geo.enabled)return t("div",{class:"dl-places"},[b("pin"),t("div",{class:"dl-stack"},[t("span",{},"Locations are off"),t("span",{class:"dl-sub"},"City-level, from the client IP")]),t("span",{class:"dl-spacer"}),t("a",{class:"cbi-button cbi-button-neutral",href:L.url("admin/network/dawnline/settings")},"Turn on")]);if(n.mapOpen)return n.map&&n.parts.places.contains(n.map.el)?null:al(n);let r=e.now-30*86400,o=e.geo.points.filter(s=>s.person===n.p.id&&s.ts>=r).sort((s,l)=>l.ts-s.ts),a=[...new Set(o.map(s=>s.city||s.country).filter(Boolean))],i=o[0];return t("div",{class:"dl-places"},[b("pin"),t("div",{class:"dl-stack"},[t("span",{},i?i.city||i.country:"No locations yet"),t("span",{class:"dl-sub"},i?`${a.length} place${a.length===1?"":"s"} in 30 days${i.org?` · ${i.org}`:""}`:"Shown after a device connects")]),t("span",{class:"dl-spacer"}),o.length?H("Show map",()=>{n.mapOpen=!0,n.paintPlaces()},"neutral"):""])}function Xa(n){let e=n.p,r=n.st,o=n.events.filter(l=>l.person===e.id),a=[],i=[...o].reverse();for(let l=0;l<i.length&&a.length<10;l++){let d=i[l],c=1;for(;d.type==="roam"&&i[l+c]?.type==="roam"&&i[l+c].device===d.device;)c++;let p=st(r,d,{server:!1});if(c>1){let u=p.querySelector(".dl-row-main");dom.content(u,[...wo(r,d).slice(0,3),t("span",{class:"dl-muted"},`${c} times`)]),u.title=i.slice(l,l+c).map(x=>x.detail??"").join(`
`)}a.push(p),l+=c-1}let s=H([b("more")],()=>Ce(s,[{label:"Export CSV",icon:b("download"),run:()=>Fe(r,o,"csv",e.id)},{label:"Export JSON",icon:b("download"),run:()=>Fe(r,o,"json",e.id)},null,{label:`Clear ${e.name}'s activity`,icon:b("trash"),danger:!0,run:()=>tt(`Clear ${e.name}'s activity`,`Removes events about ${e.name} and their devices.`,{person:e.id},()=>n.refresh())}]),"neutral",{title:"Export or clear",class:"cbi-button cbi-button-neutral dl-icon-only"});return t("div",{class:"dl-panel flush"},[t("div",{class:"dl-panel-head pad"},[t("h3",{},"Activity"),t("span",{class:"dl-sub"},o.length>10?`latest 10 of ${o.length}`:""),t("span",{class:"dl-spacer"}),s]),a.length?a:t("div",{class:"dl-row dl-muted"},"Nothing yet.")])}var Rn=class{constructor(){this.id="";this.events=[];this.mapOpen=!1;this.map=null;this.parts={};this.series=[];this.devSeries={};this.ticks=0;this.fullNext=!1}async fetch(e){let[r,o,a]=await Promise.all([A.status(30),e?A.events(2e3,this.id).catch(()=>null):Promise.resolve(null),e?A.personUsage(this.id,30).catch(()=>null):Promise.resolve(null)]);return{st:r,ev:o?.events??null,use:a}}async load(){return this.id=new URLSearchParams(location.search).get("id")??"",this.fetch(!0)}render(e){this.take(e);let r=this.st.people.find(s=>s.id===this.id);if(!r)return t("div",{class:"dl-empty"},[t("h3",{},"Person not found"),t("p",{},"They may have been removed."),t("a",{class:"cbi-button",href:L.url("admin/network/dawnline/server")},"Back to Servers")]);this.p=r;for(let s of["crumbs","head","devices","traffic","places","activity","limits"])this.parts[s]=t("div",{});this.parts.devices.className="dl-person-devices";let o=t("div",{},[this.parts.crumbs,this.parts.head,t("div",{class:"dl-grid-person"},[t("div",{class:"dl-col"},[this.parts.devices,this.parts.traffic,this.parts.places,this.parts.activity]),t("div",{class:"dl-col"},[this.parts.limits])])]);this.paint();let a=new URLSearchParams(location.search),i=a.get("device")&&r.devices.find(s=>s.id===a.get("device"));return i?setTimeout(()=>Ge(this.p,i,this.deviceOpts()),50):a.get("add")&&setTimeout(()=>ot(this.p,this.deviceOpts()),50),this.poller=rt({fetch:s=>{let l=s||this.fullNext||++this.ticks%4===0;return this.fullNext=!1,this.fetch(l)},every:15,live:!0,active:()=>o.isConnected,apply:(s,l)=>this.apply(s,l)}),o}take(e){this.st=e.st,e.ev&&(this.events=e.ev),e.use&&(this.series=e.use.person,this.devSeries=e.use.devices)}apply(e,r){this.take(e);let o=this.st.people.find(a=>a.id===this.id);if(!o){r||(location.href=Pt(this.p?.server));return}this.p=o,this.paint(r),this.map?.update(this.mapData())}async refresh(){this.fullNext=!0,await this.poller?.refresh()}async patch(e,r){var i;this.poller?.claim();let o=await G(()=>A.personUpdate(this.p.id,e),r);if(!o)return!1;this.poller?.claim();let a=this.st.people.findIndex(s=>s.id===this.p.id);return(i=o.person).rate??(i.rate=this.p.rate),a>=0&&(this.st.people[a]=o.person),this.p=o.person,this.paint(),!0}get today(){return Ie(this.series.length?this.series:this.st.series)}get core(){return Tt(this.st.servers,this.p.server)}deviceOpts(){return{refresh:()=>this.refresh(),geo:this.st.geo,now:this.st.now,today:this.today,core:this.core,events:()=>this.events}}mapData(){return{geo:this.st.geo,people:this.st.people,now:this.st.now,person:this.p.id}}crumbs(){let e=this.p;return t("nav",{class:"dl-crumbs","aria-label":"Breadcrumb"},[t("a",{href:Pt(e.server)},this.st.servers.find(r=>r.id===e.server)?.name??"Servers"),t("span",{},"/"),t("a",{href:Pt(e.server)},"People"),t("span",{},"/"),t("span",{},e.name)])}paint(e=!1){Se(this.parts.crumbs,this.crumbs(),e),Se(this.parts.head,Ua(this),e),Se(this.parts.traffic,Ga(this),e),Se(this.parts.devices,Wa(this),e),Se(this.parts.limits,Za(this),e),this.paintPlaces(e),Se(this.parts.activity,Xa(this),e)}paintPlaces(e=!1){let r=Qa(this);r&&Se(this.parts.places,r,e&&!this.mapOpen)}};var il={ok:"check",warn:"alert",error:"x",skip:"pause"},In=class{constructor(e,r,o,a){this.el=t("div",{});this.wdEl=t("div",{});this.checksEl=t("div",{class:"dl-panel"});this.recentEl=t("div",{class:"dl-panel flush dl-recent"});this.checks=null;this.summary=t("div",{});this.open=new Set;this.st=e,this.sl=r,this.events=o,this.toLog=a,dom.content(this.el,[this.summary,this.wdEl,t("div",{class:"dl-health-cols"},[this.checksEl,this.recentEl])]),this.paintChecks(),this.paintLive(r,o)}async run(e){let r=e?await Dn(e):await A.health().catch(()=>null);r&&(this.take(r),e==="netrestart"&&setTimeout(()=>this.el.isConnected&&void this.run(),5e3))}take(e){this.checks=e.checks,this.paintChecks(),this.paintLive(e,this.events)}paintChecks(){let e=this.checks;if(!e){dom.content(this.summary,""),dom.content(this.checksEl,[t("div",{class:"dl-panel-head"},[t("h3",{},"Checks")]),t("p",{class:"dl-muted dl-loading"},"Running checks…")]);return}let r=e.filter(s=>s.status==="error").length,o=e.filter(s=>s.status==="warn").length;dom.content(this.summary,r?pt("error",`${r} problem${r>1?"s":""} need attention.`):o?pt("warn",`${o} warning${o>1?"s":""}.`):pt("ok","All checks passed."));let a=new Map;for(let s of this.sl.watchdog.repairs)a.set(s.id,Math.max(a.get(s.id)??0,s.ts));let i=()=>this.run();dom.content(this.checksEl,[t("div",{class:"dl-panel-head"},[t("h3",{},"Checks"),t("span",{class:"dl-spacer"}),H("Run again",i)]),t("ul",{class:"dl-checks"},e.map(s=>t("li",{},[t("span",{class:`dl-check-icon ${s.status}`},b(il[s.status])),t("div",{class:"dl-check-body"},[t("div",{class:"dl-check-title"},s.title),t("div",{class:"dl-check-detail"},s.detail),a.has(s.id)?t("div",{class:"dl-check-repaired"},`Repaired by the watchdog at ${zt(a.get(s.id))}`):""]),yo(s,l=>void this.run(l),i)])))])}paintLive(e,r){this.sl=e,this.events=r;let o=e.watchdog,a=o.beat!=null&&o.now-o.beat>180,i=o.repairs.filter(d=>o.now-d.ts<86400),s=i[i.length-1],l=ve(o.enabled,"Watchdog repairs",async d=>{await G(()=>A.settingsUpdate({watchdog:d?"1":"0"}),d?"Watchdog on":"Watchdog off")||eo(l,!d);let p=await A.serviceLog().catch(()=>null);p&&this.paintLive(p,this.events)});dom.content(this.wdEl,t("div",{class:"dl-panel dl-wd"},[t("div",{class:"dl-wd-head"},[t("span",{class:`dl-wd-tile${o.enabled?"":" off"}`},b("shield")),t("div",{class:"dl-stack"},[t("span",{class:"dl-wd-title"},"Watchdog"),t("span",{class:"dl-sub"},o.enabled?"Every minute it checks the tunnels and services and repairs what it can on its own.":"Off: problems are only written to the log. Nothing is repaired on its own.")]),t("span",{class:"dl-spacer"}),l]),t("div",{class:"dl-wd-foot"},[t("div",{class:"dl-wd-chips"},o.targets.map(d=>t("span",{class:`dl-check-chip${d.ok?"":" error"}`,title:d.ok?"OK":`Not working${d.tries?` · ${d.tries} repair${d.tries>1?"s":""}`:""}`},[b(d.ok?"check":"x"),d.name]))),t("span",{class:`dl-sub${a?" dl-warn-text":""}`},a?`The agent has not checked in for ${Math.round((o.now-o.beat)/60)} min; cron restarts it after 5.`:[o.last?`Looked ${re(o.last,o.now)}`:"Starts within a minute"," · ",i.length?`${i.length} repair${i.length>1?"s":""} today, last ${s.name} at ${zt(s.ts)}`:"no repairs today"])])])),this.paintRecent()}paintRecent(){let e=(this.sl.watchdog.now||Date.now()/1e3)-604800,r=[...this.events.map(a=>({ts:a.ts,ev:a})),...this.sl.log.map(a=>({ts:a.ts,sys:a}))].filter(a=>a.ts>=e&&cn(a)).sort((a,i)=>i.ts-a.ts),o=t("div",{class:"dl-panel-head pad"},[t("h3",{},"Recent problems"),t("span",{class:"dl-spacer"}),r.length?t("a",{href:"#",click:a=>(a.preventDefault(),this.toLog())},"All in Log →"):""]);if(!r.length){dom.content(this.recentEl,[o,t("div",{class:"dl-recent-empty"},[t("span",{class:"dl-check-icon ok"},b("check")),"No problems in the last 7 days."])]);return}dom.content(this.recentEl,[o,...r.slice(0,8).map(a=>{if(a.sys){let i=a.sys,s=`${i.ts}|${i.msg}`;return Tn(i,this.open.has(s),()=>{this.open.delete(s)||this.open.add(s),this.paintRecent()},zt(i.ts))}return st(this.st,a.ev,{time:zt(a.ts)})})])}};var Bn=300,sl=["all","connections","people","system","problems"],On=class{constructor(e,r,o){this.events=[];this.system=[];this.kind="all";this.shown=Bn;this.open=new Set;this.list=t("div",{});this.sub="";this.tabs=t("div",{class:"dl-seg",role:"tablist"});this.st=e,this.take(r),this.system=o,this.el=t("div",{},[t("div",{class:"dl-toolbar"},[this.tabs]),this.list]),this.paint()}actions(){let e=()=>this.kind==="all"?"":this.kind,r=i=>()=>{let s=this.filtered().reverse();Fe(this.st,s.filter(l=>l.ev).map(l=>l.ev),i,e(),s.filter(l=>l.sys).map(l=>l.sys))},o=H([b("download")," Export"],()=>Ce(o,[{label:"CSV (spreadsheet)",icon:b("download"),run:r("csv")},{label:"JSON",icon:b("download"),run:r("json")}])),a=H([b("trash")," Clear"],()=>tt("Clear the log","Removes events from the log on the router.",{},()=>this.reload(),this.kind==="all"?void 0:this.kind,!0));return[o,a]}take(e){this.events=e.events,this.policy=e.policy;let r=Mt.filter(o=>!e.policy.categories.includes(o));this.sub=`${pn(e.policy)}${r.length?` Not recorded: ${r.map(o=>ut[o].toLowerCase()).join(", ")}.`:""}`}async reload(){let[e,r]=await Promise.all([A.events(2e4).catch(()=>null),A.serviceLog().catch(()=>null)]);e&&this.take(e),r&&(this.system=r.log),this.paint()}items(){return[...this.events.map(e=>({ts:e.ts,ev:e})),...this.system.map(e=>({ts:e.ts,sys:e}))].sort((e,r)=>r.ts-e.ts)}matches(e,r){return r==="all"?!0:r==="problems"?cn(e):r==="system"?!!e.sys:!!e.ev&&Bt(e.ev.type)===r}filtered(){return this.items().filter(e=>this.matches(e,this.kind))}paintTabs(e){dom.content(this.tabs,sl.map(r=>t("button",{type:"button",role:"tab",class:r===this.kind?"on":"","aria-selected":r===this.kind?"true":"false",click:()=>this.show(r)},[r==="all"?"All":r==="system"?"System":ut[r],t("b",{},String(e.filter(o=>this.matches(o,r)).length))])))}show(e){this.kind=e,this.shown=Bn,this.paint()}paint(){this.paintTabs(this.items());let e=this.filtered();if(!e.length){dom.content(this.list,t("div",{class:"dl-empty"},[t("p",{},this.events.length||this.system.length?"No events match.":"The log is empty.")]));return}let r=[],o="",a=null;for(let i of e.slice(0,this.shown)){let s=pa(i.ts);s!==o&&(o=s,a=t("div",{class:"dl-panel flush"},t("div",{class:"dl-panel-head pad"},t("h3",{},s))),r.push(a));let l=new Date(i.ts*1e3).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"});if(i.sys){let d=`${i.sys.ts}|${i.sys.msg}`;a.appendChild(Tn(i.sys,this.open.has(d),()=>{this.open.delete(d)||this.open.add(d),this.paint()},l))}else a.appendChild(st(this.st,i.ev,{time:l}))}e.length>this.shown&&r.push(t("div",{class:"dl-more-row"},H(`Show ${Math.min(Bn,e.length-this.shown)} more of ${e.length-this.shown}`,()=>{this.shown+=Bn,this.paint()}))),dom.content(this.list,r)}};var ll=[["health","Health"],["log","Log"]],Mo=2e4,jn=class{constructor(){this.tab=new URLSearchParams(location.search).get("tab")==="log"?"log":"health";this.segEl=t("div",{class:"dl-seg dl-srvsections dl-diag-tabs",role:"tablist","aria-label":"Diagnostics"});this.subEl=t("span",{class:"dl-muted"});this.actionsEl=t("div",{class:"dl-row-actions"});this.bodyEl=t("div",{});this.eventsAt=0}load(){return this.eventsAt=Date.now(),Promise.all([A.status(1),A.events(Mo),A.serviceLog()])}render([e,r,o]){return this.log=new On(e,r,o.log),this.health=new In(e,o,r.events,()=>{this.show("log"),this.log.show("problems")}),this.show(this.tab),rt({fetch:async()=>{let a=this.tab==="log",[i,s]=await Promise.all([A.serviceLog().catch(()=>null),a?A.events(Mo).catch(()=>null):Promise.resolve(null)]);return i||s?{n:i,e:s}:null},every:10,active:()=>this.bodyEl.isConnected,apply:({n:a,e:i})=>this.take(a,i)}),t("div",{},[t("div",{class:"dl-pagehead"},[t("div",{class:"dl-stack"},[t("h2",{class:"dl-h1"},"Diagnostics"),this.subEl]),this.actionsEl]),this.segEl,this.bodyEl])}take(e,r){r&&(this.log.take(r),this.eventsAt=Date.now()),e&&(this.log.system=e.log),e&&this.health.paintLive(e,r?.events??this.health.events),this.tab==="log"&&this.log.paint()}show(e){this.tab=e,dom.content(this.segEl,ll.map(([r,o])=>t("button",{type:"button",role:"tab",class:r===e?"on":"","aria-selected":r===e?"true":"false",click:()=>r!==this.tab&&this.show(r)},o))),this.bodyEl.replaceChildren(e==="log"?this.log.el:this.health.el),this.subEl.textContent=e==="log"?this.log.sub:"Everything Dawnline depends on, checked live. The watchdog repairs what it can on its own.",dom.content(this.actionsEl,e==="log"?this.log.actions():""),e==="log"?(this.log.paint(),Date.now()-this.eventsAt>1e4&&A.events(Mo).then(r=>this.take(null,r)).catch(()=>null)):this.health.checks||this.health.run()}};var ei=":root{--dl-card: var(--panel-bg, var(--background-color-high, transparent));--dl-elevated: var(--elevated, var(--background-color-high, Canvas));--dl-line: var(--border, var(--border-color-medium, color-mix(in srgb, currentColor 14%, transparent)));--dl-soft: var(--muted, color-mix(in srgb, currentColor 5%, transparent));--dl-soft-hover: var(--soft-hover, color-mix(in srgb, currentColor 10%, transparent));--dl-fg: var(--foreground, var(--text-color-highest, inherit));--dl-fg-muted: var(--muted-foreground, color-mix(in srgb, currentColor 65%, transparent));--dl-fg-faint: var(--text-tertiary, color-mix(in srgb, currentColor 50%, transparent));--dl-accent: var(--accent, #3a83f7);--dl-ok: var(--success, #00a240);--dl-warn: var(--warning, #e25507);--dl-bad: var(--danger, #e02e2a);--dl-ok-wash: var(--success-a15, color-mix(in srgb, #00a240 15%, transparent));--dl-warn-wash: var(--warning-a15, color-mix(in srgb, #e25507 15%, transparent));--dl-bad-wash: var(--destructive-a15, color-mix(in srgb, #e02e2a 15%, transparent));--dl-info-wash: var(--info-a15, color-mix(in srgb, #3a83f7 15%, transparent));--dl-info: var(--info, #2c67c5);--dl-track: var(--foreground-a10, color-mix(in srgb, currentColor 10%, transparent));--dl-chart-1: var(--chart-blue, #3a83f7);--dl-chart-2: var(--chart-green, #00a240);--dl-ring: var(--ring, #3a83f7);--dl-primary: var(--primary, #0d0d0d);--dl-primary-fg: var(--primary-foreground, #fff);--dl-mono: var(--font-mono, ui-monospace, Menlo, Consolas, monospace);--dl-shadow: var(--shadow-sm, none);--dl-radius: 16px}.dl-root,.dl-modal{cursor:default}:is(.dl-root,.dl-modal) :is(input:not([type=checkbox],[type=radio],[type=range],[type=button],[type=submit]),textarea,[contenteditable=true]){cursor:text}.dl-icon-wrap{display:inline-flex;align-items:center;justify-content:center;line-height:0}.dl-icon{width:16px;height:16px}.dl-icon-btn{display:inline-flex!important;align-items:center;gap:6px}.dl-muted{color:var(--dl-fg-muted)}.dl-faint,.dl-sep{color:var(--dl-fg-faint)}.dl-nowrap{white-space:nowrap}.dl-mono{font-family:var(--dl-mono);font-size:13px}.dl-spacer{flex:1}.dl-pill{display:inline-flex;align-items:center;gap:4px;height:20px;padding:0 8px;border-radius:999px;font-size:12px;line-height:20px;font-weight:500;white-space:nowrap;background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-pill.ok{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-pill.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-pill.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-pill.accent{background:var(--dl-info-wash);color:var(--dl-info)}.dl-pill.off{opacity:.75}.dl-panel{background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);padding:16px;margin:0 0 16px;min-width:0;box-shadow:var(--dl-shadow)}.dl-panel-head{display:flex;align-items:center;flex-wrap:wrap;gap:8px 12px;margin:0 0 12px}.dl-panel-head h3{margin:0!important;padding:0;font-size:16px;line-height:24px;font-weight:500;border:0;background:none}.dl-tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px;margin:0 0 16px}.dl-tile{background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);padding:14px 16px;min-width:0;box-shadow:var(--dl-shadow)}.dl-tile-label{font-size:12px;line-height:16px;font-weight:500;color:var(--dl-fg-faint)}.dl-tile-value{font-size:24px;line-height:32px;font-weight:500;margin-top:4px;font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;letter-spacing:-.01em}.dl-tile-sub{font-size:12px;line-height:16px;color:var(--dl-fg-muted);margin-top:2px;font-variant-numeric:tabular-nums}.dl-grid2{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(0,1fr);gap:0 16px}@media(max-width:960px){.dl-grid2{grid-template-columns:minmax(0,1fr)}}.dl-chart{display:block;width:100%;height:120px}.dl-bar-down{fill:var(--dl-chart-1)}.dl-bar-up{fill:var(--dl-chart-2);opacity:.8}.dl-legend{display:flex;gap:16px;font-size:12px;color:var(--dl-fg-muted);margin-top:8px}.dl-legend i{display:inline-block;width:8px;height:8px;border-radius:999px;margin-right:6px;vertical-align:0}.dl-legend .down{background:var(--dl-chart-1)}.dl-legend .up{background:var(--dl-chart-2)}.dl-events{list-style:none;margin:0;padding:0}.dl-events li{display:flex;gap:12px;align-items:baseline;padding:8px 0;border-top:1px solid var(--dl-line);font-size:14px;line-height:20px;min-width:0}.dl-events li:first-child{border-top:0;padding-top:0}.dl-ev-time{flex:0 0 88px;color:var(--dl-fg-faint);font-variant-numeric:tabular-nums;white-space:nowrap;font-size:13px}.dl-ev-dot{flex:0 0 auto;width:6px;height:6px;border-radius:50%;background:var(--dl-fg-faint);transform:translateY(-2px)}.dl-ev-dot.ok{background:var(--dl-ok)}.dl-ev-dot.warn{background:var(--dl-warn)}.dl-ev-dot.bad{background:var(--dl-bad)}.dl-ev-dot.accent{background:var(--dl-accent)}.dl-row>.dl-ev-dot,.dl-dev-log-row>.dl-ev-dot{margin:0 4px}.dl-ev-tile{flex:none;display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;margin:-2px -4px;border-radius:7px;background:color-mix(in srgb,var(--dl-accent) 16%,transparent);color:var(--dl-accent);align-self:center}.dl-ev-tile .dl-icon-wrap{display:inline-flex}.dl-ev-tile .dl-icon{width:14px;height:14px}.dl-row.dl-ev-by-admin{background:color-mix(in srgb,var(--dl-accent) 6%,transparent)}.dl-you{color:var(--dl-accent);font-weight:500}.dl-ev-kind{color:var(--dl-fg-faint)}.dl-slotbar{display:flex;align-items:center;gap:8px;margin:8px 0 0 44px}.dl-slotbar-segs{display:flex;gap:3px;flex:none;max-width:100%}.dl-slotbar-segs i{flex:1;min-width:2px;display:block;height:4px;border-radius:2px;background:var(--dl-soft-hover)}.dl-slotbar-segs i.used{background:var(--dl-fg-muted)}.dl-slotbar-text{font-size:12px;color:var(--dl-fg-faint);font-variant-numeric:tabular-nums}.dl-slotbar-segs i.over{background:color-mix(in srgb,var(--dl-warn) 80%,transparent)}.dl-ev-srv{flex:none;font-size:11px;line-height:18px;padding:0 8px;border-radius:999px;background:var(--dl-soft);color:var(--dl-fg-muted);white-space:nowrap}.dl-ev-by-system{--sys: var(--dl-fg-muted)}.dl-ev-by-system.ok{--sys: var(--dl-ok)}.dl-ev-by-system.warn{--sys: var(--dl-warn)}.dl-ev-by-system.bad{--sys: var(--dl-bad)}.dl-ev-tile.ev{background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-ev-tile.ev.ok{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-ev-tile.ev.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-ev-tile.ev.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-ev-tile.ev.accent{background:color-mix(in srgb,var(--dl-accent) 16%,transparent);color:var(--dl-accent)}.dl-ev-tile.sys{background:color-mix(in srgb,var(--sys) 16%,transparent);color:var(--sys)}.dl-row.dl-ev-by-system{background:color-mix(in srgb,var(--sys) 6%,transparent)}.dl-sys-src{color:var(--sys)}.dl-ev-by-system:not(.ok):not(.warn):not(.bad) .dl-sys-src{color:var(--dl-fg)}.dl-ev-text{min-width:0;overflow-wrap:anywhere}.dl-server{display:flex;flex-wrap:wrap;align-items:center;gap:8px 10px}.dl-server-name{font-size:16px;line-height:24px;font-weight:500}.dl-kv{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:6px 24px;margin:12px 0 0;font-size:14px;line-height:20px}.dl-kv dt{color:var(--dl-fg-muted);font-weight:400;margin:0}.dl-kv dd{margin:0;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}";var ti='.dl-plist{display:block}.dl-plist>.dl-card{display:block;margin:0 0 12px;padding:16px;min-width:0;background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);box-shadow:var(--dl-shadow)}.dl-plist>.dl-card.dl-filtered{display:none}.dl-plist>.dl-card.dl-off :is(.dl-card-name,.dl-avatar,.dl-access,.dl-slotbar,.dl-chips,.dl-pill-ic,.dl-use-num,.dl-pside-foot,.dl-pside-state){opacity:.45}.dl-plist>.dl-card.dl-off .dl-usebar i{background:var(--dl-fg-faint)}.dl-plist>.dl-card.dl-off .dl-chip-tag{background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-pcard:has(>.dl-pstrip){row-gap:14px}.dl-pstrip{grid-column:1 / -1;display:flex;align-items:center;flex-wrap:wrap;gap:8px 12px;margin:0 -16px -16px;padding:10px 16px;border-top:1px solid var(--dl-line);border-radius:0 0 var(--dl-radius) var(--dl-radius);font-size:14px;line-height:20px}.dl-pstrip.warn{background:color-mix(in srgb,var(--dl-warn) 7%,transparent)}.dl-pstrip.bad{background:color-mix(in srgb,var(--dl-bad) 7%,transparent)}.dl-pstrip-text{flex:1;min-width:0;display:flex;flex-wrap:wrap;align-items:baseline;gap:0 8px}.dl-pstrip-text b{font-weight:500}.dl-pstrip>.cbi-button{flex:none;height:32px!important}.dl-plist-none{color:var(--dl-fg-muted);text-align:center;padding:28px 16px;background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius)}.dl-card-head{display:flex;align-items:center;flex-wrap:wrap;gap:6px 8px}.dl-avatar{flex:0 0 auto;width:32px;height:32px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;font-size:12px;font-weight:600;color:var(--dl-fg);background:var(--dl-soft);position:relative;margin-right:4px;letter-spacing:.02em}.dl-avatar.online:after{content:"";position:absolute;right:-1px;bottom:-1px;width:9px;height:9px;border-radius:50%;background:var(--dl-ok);box-shadow:0 0 0 2px var(--dl-card)}.dl-card-name{font-size:16px;line-height:24px;font-weight:500}.dl-card-slug{font-size:13px;color:var(--dl-fg-faint);font-family:var(--dl-mono)}.dl-quota{margin:8px 0 0 44px;max-width:320px;height:6px;border-radius:999px;background:var(--dl-track);overflow:hidden}.dl-quota>i{display:block;height:100%;background:var(--dl-accent);border-radius:999px}.dl-quota.warn>i{background:var(--dl-warn)}.dl-quota.bad>i{background:var(--dl-bad)}.dl-chips{display:flex;flex-wrap:wrap;gap:6px;margin:12px 0 0 44px}.dl-chip{all:unset;box-sizing:border-box;cursor:pointer;display:inline-flex;align-items:center;gap:6px;max-width:240px;height:28px;padding:0 12px 0 10px;border-radius:999px;font-size:13px;background:var(--dl-soft);color:var(--dl-fg);transition:background .15s}.dl-chip:hover{background:var(--dl-soft-hover)}.dl-chip:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-chip .dl-icon{width:14px;height:14px;color:var(--dl-fg-muted)}.dl-chip.add{background:transparent;border:1px dashed color-mix(in srgb,var(--dl-fg) 28%,transparent);color:var(--dl-fg-muted)}.dl-chip.add:hover{background:var(--dl-soft);color:var(--dl-fg);border-color:color-mix(in srgb,var(--dl-fg) 45%,transparent)}.dl-chip.add:hover .dl-icon{color:var(--dl-fg)}.dl-chip.disabled .dl-chip-name{text-decoration:line-through;color:var(--dl-fg-faint)}.dl-chip-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-dot{flex:0 0 auto;width:6px;height:6px;border-radius:50%;background:var(--dl-fg-faint);opacity:.6}.dl-dot.online{background:var(--dl-ok);opacity:1;box-shadow:0 0 0 3px var(--dl-ok-wash)}.dl-empty{text-align:center;padding:40px 16px;background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius)}.dl-empty .dl-icon-wrap{width:40px;height:40px;border-radius:12px;background:var(--dl-soft);margin-bottom:12px}.dl-empty .dl-icon{width:20px;height:20px}.dl-empty h3{margin:0 0 4px!important;font-size:16px;font-weight:500}.dl-empty p{margin:0 0 16px;color:var(--dl-fg-muted);font-size:14px}.dl-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;margin:0 0 16px}.dl-toolbar .dl-muted{font-size:13px}@media(max-width:640px){.dl-slotbar,.dl-chips,.dl-quota{margin-left:0}.dl-btn-label{display:none}}.cbi-value.dl-block{display:block!important}.cbi-value.dl-block>.cbi-value-title{display:block;width:auto;float:none;text-align:left;padding:0 0 8px}.cbi-value.dl-block>.cbi-value-field{display:block;width:100%;margin:0}.dl-people-find{width:160px;min-width:0}.dl-people-find[hidden]{display:none}';var ni="#modal_overlay{z-index:1100!important}.dl-dd{position:fixed;z-index:1200;min-width:200px;padding:4px;border-radius:12px;background:var(--dl-elevated);border:1px solid var(--dl-line);box-shadow:0 12px 32px #0000004d;display:flex;flex-direction:column}.dl-dd button{all:unset;cursor:pointer;display:flex;align-items:center;gap:10px;padding:7px 10px;border-radius:8px;font-size:13px;color:var(--dl-fg)}.dl-dd button .dl-icon{width:15px;height:15px;color:var(--dl-fg-muted)}.dl-dd button:hover,.dl-dd button:focus-visible{background:var(--dl-soft)}.dl-dd button.danger,.dl-dd button.danger .dl-icon{color:var(--dl-bad, #e5484d)}.dl-dd button.warn,.dl-dd button.warn .dl-icon{color:var(--dl-warn)}.dl-dd hr{border:0;border-top:1px solid var(--dl-line);margin:4px 0}.dl-chipbtn b{font-weight:500;font-size:11px;margin-left:6px;opacity:.6}.dl-setsub{margin:20px 0 8px!important;font-size:13px;font-weight:500;color:var(--dl-fg)}.dl-row-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}.dl-more-row{display:flex;justify-content:center;padding:8px 0 16px}.dl-dsec-actions{display:flex;align-items:center;gap:12px}.dl-kv-act{display:inline-flex;align-items:center;gap:12px;flex-wrap:wrap}.dl-linkbtn,.dl-bento-head a,.dl-bento-foot a,.dl-panel-head a,.dl-dsec-head a,.dl-tile2-foot a{all:unset;box-sizing:border-box;cursor:pointer;display:inline-flex;align-items:center;gap:4px;height:26px;padding:0 9px;margin:-4px -6px;border-radius:8px;font-size:12px;font-weight:500;color:var(--dl-fg-muted);text-decoration:none!important;white-space:nowrap;transition:background .12s,color .12s}.dl-bento-head a,.dl-bento-foot a,.dl-panel-head a,.dl-dsec-head a,.dl-tile2-foot a{color:var(--dl-accent)}.dl-linkbtn:hover,.dl-bento-head a:hover,.dl-bento-foot a:hover,.dl-panel-head a:hover,.dl-dsec-head a:hover,.dl-tile2-foot a:hover{background:var(--dl-soft);color:var(--dl-fg);text-decoration:none!important}.dl-bento-head a:hover,.dl-bento-foot a:hover,.dl-panel-head a:hover,.dl-dsec-head a:hover,.dl-tile2-foot a:hover{background:color-mix(in srgb,var(--dl-accent) 12%,transparent);color:var(--dl-accent)}.dl-linkbtn:focus-visible,.dl-bento-head a:focus-visible,.dl-bento-foot a:focus-visible,.dl-panel-head a:focus-visible{outline:2px solid var(--dl-ring);outline-offset:1px}.dl-linkbtn.danger:hover{color:var(--dl-bad);background:var(--dl-bad-wash)}.dl-ifcards{display:flex;flex-direction:column;gap:20px;margin:24px 0}.dl-ifcard .dl-setsec-body{gap:14px}.dl-iflead{display:flex;flex-direction:column;gap:2px;padding-top:14px;border-top:1px solid var(--dl-line)}.dl-iflead b{font-size:14px;font-weight:500}.dl-ifgroup h4{margin:0 0 8px!important;padding:0!important;font-size:11px!important;font-weight:500!important;letter-spacing:.06em;text-transform:uppercase;color:var(--dl-fg-muted);border:0!important;background:none!important}.dl-ifgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:8px}.dl-if{all:unset;box-sizing:border-box;cursor:pointer;display:flex;align-items:center;gap:10px;min-height:52px;padding:8px 12px 8px 10px;min-width:0;border:1px solid var(--dl-line);border-radius:10px;background:var(--dl-card);transition:background .15s,border-color .15s}.dl-if:hover{background:var(--dl-soft)}.dl-if:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-if-ic{width:30px;height:30px;border-radius:8px;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;color:var(--dl-fg-muted)}.dl-if-ic .dl-icon{width:16px;height:16px}.dl-if-main{display:flex;flex-direction:column;min-width:0;flex:1}.dl-if-name{font-size:13.5px;font-weight:500;color:var(--dl-fg);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-if-sub{font:11px/16px var(--dl-mono);color:var(--dl-fg-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-if.sel{border-color:var(--dl-accent);background:color-mix(in srgb,var(--dl-accent) 9%,transparent)}.dl-if.sel .dl-if-ic{background:color-mix(in srgb,var(--dl-accent) 18%,transparent);color:var(--dl-accent)}.dl-if-check{color:var(--dl-accent);display:inline-flex}.dl-if-check .dl-icon{width:16px;height:16px}.dl-if.auto{border-color:color-mix(in srgb,var(--dl-ok) 55%,transparent);background:var(--dl-ok-wash);cursor:default}.dl-if.auto .dl-if-ic{background:color-mix(in srgb,var(--dl-ok) 18%,transparent);color:var(--dl-ok)}.dl-if-badge{display:inline-flex;align-items:center;gap:5px;font-size:10.5px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;flex:0 0 auto}.dl-if-badge.ok{color:var(--dl-ok)}.dl-if.off{cursor:default;opacity:.5}.dl-if.off:hover{background:var(--dl-card)}.dl-if.warn{border-color:color-mix(in srgb,var(--dl-warn) 60%,transparent)}.dl-if-wanctl{gap:10px;align-items:center}.dl-if-wanctl select{max-width:240px}.dl-if-summary{min-width:0;line-height:18px}.dl-warn{color:var(--dl-warn)}.dl-w-ip{width:160px}.dl-dnspick{padding-top:8px;border-top:1px solid var(--dl-line)}.dl-dnspick .dl-row-actions{gap:10px}.dl-note{display:flex;gap:8px;align-items:flex-start;padding:10px 12px;border-radius:10px;font-size:12.5px;line-height:18px;margin:0 0 10px;background:var(--dl-soft)}.dl-note.warn{background:var(--dl-warn-wash, color-mix(in srgb, var(--dl-warn) 14%, transparent))}.dl-note .dl-icon{width:15px;height:15px;flex:0 0 auto;margin-top:1px;color:var(--dl-warn)}.dl-stale{align-self:flex-start;margin-top:4px;font-size:10.5px}.dl-root .cbi-button.dl-btn-warn,.dl-btn-warn.cbi-button{background:var(--dl-warn-wash)!important;color:var(--dl-warn)!important;border-color:color-mix(in srgb,var(--dl-warn) 35%,transparent)!important}.dl-root .cbi-button.dl-btn-warn:hover,.dl-btn-warn.cbi-button:hover{background:color-mix(in srgb,var(--dl-warn) 24%,transparent)!important}.dl-btn-warn .dl-icon{color:var(--dl-warn)}.dl-srvtabs{display:flex;flex-wrap:wrap;gap:6px;padding:4px;margin:0 0 20px;border-radius:12px;background:var(--dl-soft);width:fit-content;max-width:100%}.dl-srvtab{all:unset;box-sizing:border-box;cursor:pointer;display:inline-flex;align-items:center;gap:8px;height:34px;padding:0 14px;border-radius:9px;font-size:13px;color:var(--dl-fg-muted);text-decoration:none!important;white-space:nowrap}.dl-srvtab b{font-weight:500}.dl-srvtab i.dot{width:7px;height:7px;border-radius:50%;background:var(--dl-fg-faint);flex:0 0 auto}.dl-srvtab i.dot.ok{background:var(--dl-ok);animation:dl-srv-pulse 2s ease-out infinite}.dl-srvtab i.dot.bad{background:var(--dl-bad)}.dl-srvtab i.dot.warn{background:var(--dl-warn)}@keyframes dl-srv-pulse{0%{box-shadow:0 0 color-mix(in srgb,var(--dl-ok) 55%,transparent)}70%,to{box-shadow:0 0 0 6px transparent}}@media(prefers-reduced-motion:reduce){.dl-srvtab i.dot.ok{animation:none}}.dl-srvtab:hover{color:var(--dl-fg);background:var(--dl-soft-hover)}.dl-srvtab.on{background:var(--dl-card);color:var(--dl-fg);box-shadow:0 1px 2px #0000002e,inset 0 0 0 1px var(--dl-line)}.dl-srvtab:focus-visible{outline:2px solid var(--dl-ring);outline-offset:1px}.dl-srvtab.add{color:var(--dl-fg-muted)}.dl-srvtab.add .dl-icon{width:14px;height:14px}.dl-srvhead{display:flex;flex-direction:column;gap:14px;margin:0 0 20px}.dl-srvhead .dl-title-row{display:flex;align-items:center;gap:10px}.dl-srvhead .dl-h1{margin:0!important}.dl-metrics.compact .dl-metric{padding:14px 18px}.dl-metrics.compact .dl-metric-value{display:flex;align-items:center;gap:6px;font-size:18px;line-height:26px;min-width:0}.dl-metrics.compact .dl-metric-value>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.dl-metrics.compact .dl-metric-value .dl-mono{font-size:15px}.dl-metrics.compact .cbi-button{flex:0 0 auto}.dl-srvsections{margin:0 0 16px}.dl-srvbody>.dl-setsec,.dl-srvbody>.dl-ifcards{margin:0}.dl-srvbody .dl-ifcards{margin:0}.dl-metric-ic{display:inline-flex;align-items:center;gap:8px;font-size:16px}.dl-metric-ic .dl-icon{width:18px;height:18px;color:var(--dl-accent)}.dl-keyrow{display:inline-flex;align-items:center;gap:8px;min-width:0}.dl-keyrow code{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;background:none;padding:0}.dl-params{border:1px solid var(--dl-line);border-radius:12px;background:var(--dl-card)}.dl-params>summary{list-style:none;cursor:pointer;display:flex;align-items:center;gap:8px;padding:10px 14px;font-size:13px;color:var(--dl-fg);user-select:none}.dl-params>summary::-webkit-details-marker{display:none}.dl-params>summary>.dl-icon-wrap{display:inline-flex;color:var(--dl-fg-muted);transition:transform .15s}.dl-params>summary>.dl-icon-wrap .dl-icon{width:15px;height:15px}.dl-params[open]>summary>.dl-icon-wrap{transform:rotate(90deg)}.dl-params>summary:focus{outline:none}.dl-params>summary:focus-visible{outline:2px solid var(--dl-ring);outline-offset:-2px;border-radius:12px}.dl-params>summary:hover{background:var(--dl-soft);border-radius:12px}.dl-pcount{font-size:11px;padding:0 6px;border-radius:999px;background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-pgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:10px;padding:4px 14px 14px}.dl-pgroup{display:flex;flex-direction:column;gap:6px;padding:12px;border-radius:10px;background:var(--dl-soft);min-width:0}.dl-pgroup-head{display:flex;align-items:center;gap:8px;font-size:13px}.dl-pgroup-head b{font-weight:500}.dl-pgroup-head .dl-icon{width:14px;height:14px;color:var(--dl-fg-muted)}.dl-pgroup p{margin:0!important;font-size:12px;line-height:17px;color:var(--dl-fg-muted)}.dl-pvals{display:flex;flex-wrap:wrap;gap:4px;margin-top:2px}.dl-pv{display:inline-flex;align-items:stretch;max-width:100%;border-radius:6px;overflow:hidden;font:500 11.5px/22px var(--dl-mono);box-shadow:inset 0 0 0 1px var(--dl-line)}.dl-pv i{font-style:normal;padding:0 6px;background:var(--dl-card);color:var(--dl-fg-faint)}.dl-pv b{font-weight:500;padding:0 7px;color:var(--dl-fg);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}";var oi=".dl-methods{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:10px}.dl-method{all:unset;box-sizing:border-box;cursor:pointer;display:flex;flex-direction:column;gap:10px;padding:14px;border-radius:12px;border:1px solid var(--dl-line);background:var(--dl-card);transition:border-color .15s,background .15s;min-width:0}.dl-method:hover{background:var(--dl-soft)}.dl-method:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-method.on{border-color:var(--dl-accent);background:color-mix(in srgb,var(--dl-accent) 8%,transparent);box-shadow:inset 0 0 0 1px var(--dl-accent)}.dl-method.off{cursor:not-allowed;opacity:.55}.dl-method.off:hover{background:var(--dl-card)}.dl-method-head{display:flex;flex-wrap:wrap;align-items:center;gap:8px 10px}.dl-method-head .dl-pill{flex:none}.dl-method-head b{font-weight:500;font-size:14.5px;flex:1}.dl-method-ic{width:32px;height:32px;border-radius:9px;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;color:var(--dl-fg-muted);flex:0 0 auto}.dl-method-ic .dl-icon{width:17px;height:17px}.dl-method.on .dl-method-ic{background:color-mix(in srgb,var(--dl-accent) 18%,transparent);color:var(--dl-accent)}.dl-method p{margin:0!important;font-size:12.5px;line-height:18px;color:var(--dl-fg-muted);flex:1}.dl-method-meters{display:flex;gap:16px}.dl-dots{display:inline-flex;align-items:center;gap:6px;font-size:11px;color:var(--dl-fg-faint)}.dl-dots-row{display:inline-flex;gap:3px}.dl-dots-row i{width:6px;height:6px;border-radius:50%;background:var(--dl-line)}.dl-dots-row i.on{background:var(--dl-fg-muted)}.dl-method.on .dl-dots-row i.on{background:var(--dl-accent)}.dl-method-foot{display:flex;align-items:center;gap:6px;font-size:11.5px;color:var(--dl-fg-faint);padding-top:8px;border-top:1px solid var(--dl-line)}.dl-method-foot .dl-icon{width:13px;height:13px;flex:0 0 auto}.dl-method.off .dl-method-foot{color:var(--dl-warn)}.dl-ibadge{display:inline-flex;align-items:center;gap:3px;height:22px;padding:0 6px;border-radius:999px;background:var(--dl-soft);color:var(--dl-fg-muted);flex:0 0 auto}.dl-ibadge .dl-icon{width:13px;height:13px}.dl-ibadge.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-ibadge.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-access{display:inline-flex;gap:4px;flex:0 0 auto}.dl-ibadge.lan{background:color-mix(in srgb,var(--dl-accent) 16%,transparent);color:var(--dl-accent)}.dl-ibadge.inet{background:var(--dl-ok-wash);color:var(--dl-ok)}";var ri=".dl-addrbar{display:inline-flex;align-items:stretch;flex-wrap:nowrap;max-width:100%;margin-top:4px;border:1px solid var(--dl-line);border-radius:10px;background:var(--dl-card);overflow:hidden}.dl-addrbar-seg{all:unset;box-sizing:border-box;display:inline-flex;align-items:center;gap:7px;padding:6px 12px;font-size:13px;color:var(--dl-fg-muted);border-left:1px solid var(--dl-line);white-space:nowrap;min-width:0}.dl-addrbar-seg:first-child{border-left:0}.dl-addrbar-seg .dl-icon{width:14px;height:14px;color:var(--dl-fg-faint);flex:0 0 auto}.dl-addrbar-seg .dl-mono{font-size:12.5px}.dl-addrbar-seg.main{cursor:pointer;color:var(--dl-fg)}.dl-addrbar-seg.main:hover{background:var(--dl-soft)}.dl-addrbar-seg.main:focus-visible{outline:2px solid var(--dl-ring);outline-offset:-2px}.dl-addrbar-seg.main>.dl-icon-wrap:last-child .dl-icon{opacity:.7}.dl-bento{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:auto auto;gap:10px;margin:0 0 20px}.dl-person-devices{margin-bottom:16px}.dl-person-head{display:flex;flex-direction:column;margin:0 0 20px}.dl-person-head>.dl-pagehead{margin-bottom:0;align-items:flex-start}.dl-pnote{all:unset;box-sizing:border-box;cursor:pointer;align-self:flex-start;display:inline-flex;align-items:flex-start;gap:6px;margin:10px 0 0 62px;max-width:60ch;padding:6px 12px 6px 10px;border-radius:10px;font-size:13px;line-height:18px;white-space:pre-line;background:var(--dl-soft);color:var(--dl-fg);box-shadow:inset 0 0 0 1px var(--dl-line)}.dl-pnote:hover{background:var(--dl-soft-hover)}.dl-pnote .dl-icon{width:14px;height:14px;flex:none;margin-top:2px;color:var(--dl-fg-muted)}.dl-note-input{width:100%;box-sizing:border-box;min-height:80px;resize:vertical}.dl-dcard-trend{display:flex;align-items:flex-end;gap:12px;min-width:0}.dl-dcard-trend>.dl-stack{flex:none}.dl-dcard-trend b{font-size:16px;font-weight:500;font-variant-numeric:tabular-nums}.dl-dbars{flex:1;min-width:0;height:32px;display:flex;align-items:flex-end;gap:2px}.dl-dbars i{flex:1;min-width:0;border-radius:2px;background:var(--dl-chart-1);opacity:.55}.dl-dbars i.zero{background:var(--dl-track);opacity:1}.dl-dbars i.hi{opacity:1}.dl-dbars i:hover{opacity:1;filter:brightness(1.2)}.dl-datechip{position:relative;display:inline-flex}.dl-date-hidden{position:absolute!important;left:0;bottom:0;width:1px!important;min-width:0!important;height:1px!important;opacity:0;pointer-events:none;border:0!important;padding:0!important;margin:0!important}.dl-chipbtn .dl-icon{width:13px;height:13px}.dl-chipbtn:has(.dl-icon){display:inline-flex;align-items:center;gap:5px}.dl-places{display:flex;align-items:center;gap:12px;padding:12px 16px;border:1px solid var(--dl-line);border-radius:var(--dl-radius);background:var(--dl-card);font-size:14px}.dl-places>.dl-icon{width:18px;height:18px;color:var(--dl-fg-muted);flex:none}.dl-person-live{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px}.dl-person-live .dl-bento-head{flex-wrap:nowrap;white-space:nowrap;min-width:0}.dl-person-live .dl-bento-head>*{min-width:0;overflow:hidden;text-overflow:ellipsis}.dl-person-live .dl-bento-head>:first-child{flex:none}.dl-person-live.solo{grid-template-columns:minmax(0,1fr)}.dl-person-live:not(.solo) .dl-bento-tile.month>.dl-bento-head:first-child{flex-wrap:wrap;row-gap:2px}.dl-person-live:not(.solo) .dl-bento-tile.month>.dl-bento-head:first-child>.dl-sub{flex-basis:100%}.dl-person-live>.dl-bento-tile,.dl-person-live>.dl-bento-tile.month{grid-column:auto;grid-row:auto}@media(max-width:760px){.dl-person-live{grid-template-columns:minmax(0,1fr)}}.dl-bento-tile{background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);padding:14px 16px;display:flex;flex-direction:column;gap:10px;min-width:0;box-shadow:var(--dl-shadow)}.dl-bento-tile.month{grid-column:1 / -1}.dl-onl-count{font-size:13px;line-height:22px;min-width:22px;padding:0 8px;border-radius:999px;background:var(--dl-soft);text-align:center;font-weight:500;font-variant-numeric:tabular-nums}.dl-onl-count.none{color:var(--dl-fg-faint)}.dl-onl-row{flex:1;display:flex;align-items:center;justify-content:center;gap:12px;min-width:0}.dl-onl-p{display:flex;flex-direction:column;align-items:center;gap:5px;width:104px;min-width:0;padding:6px 2px;border-radius:12px;color:var(--dl-fg)!important;text-decoration:none!important}.dl-onl-p:hover{background:var(--dl-soft)}.dl-onl-av{position:relative;width:42px;height:42px;border-radius:50%;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;font-size:13px;font-weight:500;box-shadow:0 0 0 2px var(--dl-ok)}.dl-onl-p.more .dl-onl-av{box-shadow:0 0 0 1px var(--dl-line);color:var(--dl-fg-muted)}.dl-onl-dev{position:absolute;right:-6.5px;bottom:-6.5px;width:20px;height:20px;border-radius:8.5px;border:1.5px solid transparent;background:var(--dl-card);display:inline-flex;align-items:center;justify-content:center;font-size:10px;color:var(--dl-fg-muted)}.dl-onl-dev .dl-icon-wrap{display:inline-flex}.dl-onl-dev .dl-icon{width:12px;height:12px}.dl-onl-name{font-size:12.5px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-onl-p .dl-sub{font-size:11px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-onl-row.grid{flex-wrap:wrap;align-content:center;gap:10px 8px;max-height:108px;overflow:hidden}.dl-onl-p.sm{width:auto;padding:4px}.dl-onl-p:hover .dl-onl-dev{background:linear-gradient(var(--dl-soft),var(--dl-soft)),var(--dl-card)}.dl-onl-p.sm:hover{background:none}.dl-onl-p.sm:hover .dl-onl-dev{background:var(--dl-card)}.dl-onl-p.sm .dl-onl-av{transition:box-shadow .15s ease}.dl-onl-p.sm:hover .dl-onl-av{box-shadow:0 0 0 2px var(--dl-ok),0 0 0 6px var(--dl-soft)}.dl-onl-p.sm.more:hover .dl-onl-av{box-shadow:0 0 0 1px var(--dl-line),0 0 0 6px var(--dl-soft)}.dl-onl-p.sm .dl-onl-av{width:36px;height:36px;font-size:11.5px}.dl-onl-meta{display:inline-flex;align-items:center;gap:3px;font-size:11px;color:var(--dl-fg-faint);max-width:100%;white-space:nowrap;overflow:hidden}.dl-onl-meta .dl-icon-wrap{display:inline-flex}.dl-onl-meta .dl-icon{width:12px;height:12px}.dl-onl-av.sm{width:34px;height:34px;font-size:11.5px}.dl-tip-float:has(.dl-hc){padding:0;white-space:normal;border-radius:16px}.dl-hc{width:280px;padding:14px;display:flex;flex-direction:column;gap:10px}.dl-hc-head{display:flex;align-items:center;gap:10px}.dl-hc-head .dl-stack{flex:1;min-width:0}.dl-hc-head b{font-size:14px;font-weight:500}.dl-hc-since{font-size:11.5px;color:var(--dl-ok)}.dl-hc-reach{display:inline-flex;gap:4px}.dl-hc-speed{border-radius:12px;background:var(--dl-soft);padding:10px 12px;display:flex;flex-direction:column;gap:6px}.dl-hc-speed-row{display:flex;align-items:baseline;gap:12px;font-size:13px;font-variant-numeric:tabular-nums}.dl-hc-chart{display:block;width:100%;height:30px}.dl-hc-chart .area{fill:color-mix(in srgb,var(--dl-chart-1) 16%,transparent)}.dl-hc-chart .dn{fill:none;stroke:var(--dl-chart-1);stroke-width:1.5;vector-effect:non-scaling-stroke}.dl-hc-chart .up{fill:none;stroke:var(--dl-ok);stroke-width:1.2;vector-effect:non-scaling-stroke}.dl-hc-devs{display:flex;flex-wrap:wrap;gap:6px}.dl-hc-dev{display:inline-flex;align-items:center;gap:5px;height:24px;padding:0 9px;border-radius:999px;background:var(--dl-soft);font-size:11.5px}.dl-hc-dev .dl-icon-wrap{display:inline-flex}.dl-hc-dev .dl-icon{width:12px;height:12px;color:var(--dl-fg-muted)}.dl-hc-foot{display:flex;align-items:center;gap:8px;font-size:11.5px}.dl-disg-id{display:flex;align-items:center;gap:10px}.dl-disg-id b{font-size:16px;font-weight:500}.dl-disg-ic{width:36px;height:36px;border-radius:11px;background:color-mix(in srgb,var(--dl-accent) 14%,transparent);color:var(--dl-accent);display:inline-flex;align-items:center;justify-content:center;flex:none}.dl-disg-ic .dl-icon-wrap{display:inline-flex}.dl-disg-ic .dl-icon{width:18px;height:18px}.dl-disg-ic.off{background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-disg-meters{display:grid;grid-template-columns:auto 1fr;gap:6px 10px;align-items:center;font-size:12px;color:var(--dl-fg-muted)}.dl-segs{display:inline-flex;gap:3px}.dl-segs i{width:18px;height:5px;border-radius:3px;background:var(--dl-track)}.dl-segs.acc i.on{background:var(--dl-accent)}.dl-segs.ok i.on{background:var(--dl-ok)}.dl-disg-chips{margin-top:auto;display:flex;flex-wrap:wrap;gap:5px}.dl-disg-chips span{font:11px/20px var(--dl-mono);padding:0 8px;border-radius:999px;background:var(--dl-soft);color:var(--dl-fg-muted);white-space:nowrap}.dl-onl-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;font-size:13px;text-align:center}.dl-bento-head{display:flex;align-items:center;justify-content:space-between;gap:10px;min-width:0}.dl-bento-head.start{justify-content:flex-start}.dl-bento-big{font-family:inherit;font-size:28px;line-height:34px;font-weight:500;letter-spacing:-.01em;font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-bento-big small{font-size:13px;font-weight:400;color:var(--dl-fg-faint);letter-spacing:0}.dl-avstack{display:inline-flex}.dl-avstack .dl-avatar{margin-left:-7px;box-shadow:0 0 0 2px var(--dl-card)}.dl-avstack .dl-avatar:first-child{margin-left:0}.dl-avatar.more{background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-bento-list{display:flex;flex-direction:column;gap:2px}.dl-bento-row{display:flex;align-items:center;gap:10px;padding:8px;margin:0 -8px;border-radius:10px;color:var(--dl-fg)!important;text-decoration:none!important;min-width:0;transition:background .12s}.dl-bento-row:hover{background:var(--dl-soft)}.dl-bento-row:hover b{text-decoration:none}.dl-bento-row:focus-visible{outline:2px solid var(--dl-ring);outline-offset:-2px}.dl-bento-row-main{display:flex;flex-direction:column;gap:1px;flex:1;min-width:0}.dl-bento-row-main b{font-weight:500;font-size:13.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-bento-row-main .dl-sub{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-bento-row.off b{color:var(--dl-fg-muted);font-weight:400}.dl-bento-row-val{display:flex;flex-direction:column;align-items:flex-end;font-size:13px;font-variant-numeric:tabular-nums;white-space:nowrap}.dl-bento-row-val small{font-size:11px;color:var(--dl-fg-faint)}.dl-bento-sep{font-size:11px;color:var(--dl-fg-faint);padding:12px 0 4px}.dl-bento-devs{display:inline-flex;gap:3px;color:var(--dl-fg-faint)}.dl-bento-devs .dl-icon{width:13px;height:13px}.dl-bento-devs .on{color:var(--dl-ok)}.dl-bento-foot{display:flex;align-items:center;gap:10px;margin-top:auto;padding-top:10px;border-top:1px solid var(--dl-line);color:var(--dl-fg)!important;text-decoration:none!important}.dl-bento-foot.split,.dl-bento-foot.end{justify-content:space-between}.dl-bento-foot.end>a:only-child{margin-left:auto}.dl-bento-empty{display:flex;align-items:center;gap:10px;padding:14px 0;font-size:13.5px;color:var(--dl-fg-muted)}.dl-bento-empty .dl-icon{width:18px;height:18px}.dl-split{display:flex;height:6px;border-radius:3px;overflow:hidden;background:var(--dl-soft)}.dl-split i{display:block;height:100%}.dl-split i.dn{background:var(--dl-accent)}.dl-split i.up{background:var(--dl-ok)}.dl-dn{color:var(--dl-accent)}.dl-up{color:var(--dl-ok)}.dl-bento-method{display:flex;align-items:center;gap:8px;font-size:18px;font-weight:500}.dl-bento-method .dl-icon{width:20px;height:20px;color:var(--dl-accent)}.dl-meter{display:inline-flex;gap:3px}.dl-meter i{width:16px;height:4px;border-radius:2px;background:var(--dl-line)}.dl-meter i.on{background:var(--dl-accent)}.dl-bento-total{font-size:16px;font-weight:500;margin-left:8px}.dl-bento-bars{display:flex;align-items:flex-end;gap:3px;height:54px}.dl-bento-bars i{flex:1;min-width:0;border-radius:3px 3px 0 0;background:var(--dl-soft-hover);transition:background .15s}.dl-bento-bars i.future{height:4px;background:var(--dl-soft)}.dl-bento-bars i:hover{background:var(--dl-fg-faint)}.dl-bento-bars i.hi{background:var(--dl-accent)}@media(max-width:700px){.dl-addrbar{flex-wrap:wrap}}@media(max-width:900px){.dl-bento{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.dl-bento-tile.online{grid-column:span 2}}@media(max-width:560px){.dl-bento{grid-template-columns:minmax(0,1fr)}.dl-bento-tile.online,.dl-bento-tile.month{grid-column:auto}}.dl-srvpagehead{display:flex;flex-direction:column;align-items:flex-start;gap:10px;margin:0 0 20px}.dl-srvpagehead>.dl-title-row{display:flex;align-items:center;gap:10px;width:100%;flex-wrap:wrap}.dl-srvpagehead .dl-actions{margin:0;flex-wrap:wrap}.dl-toolbar-end{display:flex;align-items:center;gap:8px;margin-left:auto;flex-wrap:nowrap;min-width:0}@media(max-width:640px){.dl-toolbar-end{flex-wrap:wrap;width:100%}}.dl-notices{margin:0 0 16px}.dl-notices .dl-need-row .dl-sub{overflow-wrap:anywhere}.dl-notices-more{font-size:13px;color:var(--dl-fg-muted);text-decoration:none}.dl-notices-more:hover{background:var(--dl-soft);color:var(--dl-fg)}.dl-speed-cols{display:grid;grid-template-columns:1fr 1fr;gap:12px}.dl-speed-col{display:flex;flex-direction:column;gap:2px;min-width:0}.dl-speed-val{font-size:20px;line-height:26px;font-weight:500;font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-speed-today{display:flex;justify-content:space-between;gap:10px;font-size:12px;color:var(--dl-fg-muted);white-space:nowrap;font-variant-numeric:tabular-nums}.dl-speed-today b{font-weight:500;color:var(--dl-fg)}.dl-speed-chart{display:block;width:100%;height:44px}.dl-speed-chart .area{fill:color-mix(in srgb,var(--dl-accent) 16%,transparent)}.dl-speed-chart .line{fill:none;stroke:var(--dl-accent);stroke-width:1.5;vector-effect:non-scaling-stroke}.dl-speed-chart .line.up{stroke:var(--dl-ok);stroke-width:1.2;opacity:.85}.dl-speed-wait{height:44px;display:flex;flex-direction:column;justify-content:flex-end;gap:6px;font-size:11px;color:var(--dl-fg-faint)}.dl-speed-wait i{display:block;height:1px;background:var(--dl-line);order:2}.dl-speed-val.off{color:var(--dl-fg-faint)}.dl-fld{display:flex;flex-direction:column;gap:8px;margin:0 0 16px}.dl-fld-label{font-size:13px;font-weight:500;color:var(--dl-fg)}.dl-fld .cbi-input-text{width:100%;box-sizing:border-box}.dl-kinds{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px}.dl-kinds button{all:unset;box-sizing:border-box;cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;height:68px;border-radius:10px;border:1px solid var(--dl-line);color:var(--dl-fg-muted);font-size:12px;font-weight:500;text-align:center;min-width:0}.dl-kinds button .dl-icon{width:20px;height:20px}.dl-kinds button:hover{background:var(--dl-soft);color:var(--dl-fg)}.dl-kinds button:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-kinds button.on{border-color:var(--dl-accent);color:var(--dl-fg);background:color-mix(in srgb,var(--dl-accent) 10%,transparent);box-shadow:inset 0 0 0 1px var(--dl-accent)}.dl-kinds button.on .dl-icon{color:var(--dl-accent)}.dl-choices{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:8px}.dl-choice{all:unset;box-sizing:border-box;cursor:pointer;display:flex;flex-direction:column;gap:4px;padding:12px 14px;border-radius:12px;background:var(--dl-card);box-shadow:inset 0 0 0 1px var(--dl-line);transition:background .15s,box-shadow .15s}.dl-choice:hover{background:var(--dl-soft)}.dl-choice:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-choice.selected{box-shadow:inset 0 0 0 2px var(--dl-accent);background:var(--accent-a10, color-mix(in srgb, var(--dl-accent) 8%, transparent))}.dl-choice-title{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:500;color:var(--dl-fg)}.dl-choice-text{font-size:12px;line-height:16px;color:var(--dl-fg-muted)}.dl-attn-item>.cbi-button{margin-left:auto;flex:none;align-self:center}";var ai='.dl-steps{display:flex;align-items:center;gap:8px;margin:0 0 16px;flex-wrap:wrap}.dl-step{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:500;color:var(--dl-fg-faint)}.dl-step b{display:inline-flex;width:24px;height:24px;align-items:center;justify-content:center;border-radius:50%;background:var(--dl-soft);font-size:12px;font-weight:600}.dl-step.current{color:var(--dl-fg)}.dl-step.current b{background:var(--dl-primary);color:var(--dl-primary-fg)}.dl-step.done{color:var(--dl-fg-muted)}.dl-step.done b{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-step+.dl-step:before{content:"";width:24px;height:1px;background:var(--dl-line)}.dl-wizard .dl-panel>div{display:flex;flex-direction:column;gap:16px}.dl-wizard .dl-panel>div>p{margin:0!important;color:var(--dl-fg-muted)}.dl-wizard .dl-panel>div>.cbi-value{margin:0}.dl-wizard h4{font-size:14px;font-weight:500;margin:8px 0 -6px!important}.dl-wizard h4:first-child{margin-top:0!important}.dl-modal .cbi-tabmenu{margin-bottom:16px}.dl-modal .cbi-value.dl-live>.cbi-value-title{display:flex;flex-direction:column;gap:2px;text-align:left}.dl-modal .cbi-value.dl-live>.cbi-value-title>.dl-sub{white-space:normal}.dl-checklist{display:flex;flex-direction:column;gap:6px;margin:4px 0 8px}.dl-checklist label{display:flex;align-items:center;gap:8px;font-size:14px;cursor:pointer}.dl-checklist input{margin:0}.dl-invite{display:grid;grid-template-columns:250px minmax(0,1fr);gap:22px;align-items:start}.dl-invite img{display:block;width:100%;border-radius:18px;box-shadow:0 0 0 1px var(--dl-line)}.dl-invite-side{display:flex;flex-direction:column;gap:14px;min-width:0}.dl-invite-side>p{margin:0!important}.dl-invite-link{all:unset;box-sizing:border-box;cursor:pointer;display:flex;align-items:center;gap:10px;min-width:0;padding:11px 14px;border-radius:12px;background:var(--dl-soft);font:13px/18px var(--dl-mono);color:var(--dl-fg)}.dl-invite-link>span:first-child{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-invite-link>.dl-icon-wrap{flex:none;display:inline-flex}.dl-invite-link .dl-icon{width:15px;height:15px;color:var(--dl-fg-muted);flex:none}.dl-invite-link:hover{background:var(--dl-soft-hover)}.dl-invite-link.alt{padding:8px 14px;font-size:12px;color:var(--dl-fg-muted)}.dl-invite-link>.dl-pill{flex:none}.dl-invite-steps{margin:0;padding-left:20px;list-style:decimal!important;font-size:13px;line-height:24px;color:var(--dl-fg-muted)}.dl-invite-steps b{color:var(--dl-fg);font-weight:500}.dl-invite-steps li{display:list-item!important;list-style:inherit!important;padding-left:4px}.dl-invite-actions{display:flex;gap:8px;flex-wrap:wrap}.modal:has(.dl-modal.wide){max-width:min(760px,94vw)!important;width:100%!important}@media(max-width:640px){.dl-invite{grid-template-columns:minmax(0,1fr)}.dl-invite img{max-width:260px;margin:0 auto}}.dl-toasts{position:fixed;left:50%;bottom:max(24px,env(safe-area-inset-bottom));transform:translate(-50%);z-index:100000;display:flex;flex-direction:column;align-items:center;gap:8px;pointer-events:none}.dl-toast{pointer-events:auto;display:inline-flex;align-items:center;gap:8px;max-width:min(520px,92vw);padding:10px 16px;border-radius:999px;background:var(--dl-fg);color:var(--dl-card);font-size:13px;line-height:18px;box-shadow:0 10px 30px #0000004d;opacity:0;transform:translateY(12px);transition:opacity .18s,transform .18s}.dl-toast.show{opacity:1;transform:none}.dl-toast .dl-icon-wrap{display:inline-flex}.dl-toast .dl-icon{width:15px;height:15px}.dl-toast.success .dl-icon{color:var(--dl-ok)}.dl-toast.error{background:var(--dl-bad);color:#fff}.dl-toast.error .dl-icon{color:#fff}.dl-toast.warning{background:var(--dl-warn);color:#111}.dl-toast.warning .dl-icon{color:#111}.dl-toast button{all:unset;cursor:pointer;display:inline-flex;margin-left:4px;opacity:.8}.dl-toast button:hover{opacity:1}';var ii=".dl-setblock{display:flex;flex-direction:column;gap:8px;margin:0}.dl-addr-opts{display:flex;flex-direction:column;gap:6px}.dl-addr-opt{all:unset;box-sizing:border-box;cursor:pointer;display:grid;grid-template-columns:16px minmax(0,1fr) auto;gap:12px;align-items:center;padding:10px 14px;border-radius:12px;box-shadow:inset 0 0 0 1px var(--dl-line);min-width:0}.dl-addr-opt:hover{background:var(--dl-soft)}.dl-addr-opt.on{box-shadow:inset 0 0 0 1.5px var(--dl-accent);background:color-mix(in srgb,var(--dl-accent) 7%,transparent)}.dl-addr-opt .dl-mono{font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-addr-opt .dl-stack{min-width:0}.dl-addr-opt input{width:100%}.dl-addr-opt.other{cursor:default}.dl-addr-opt.other:hover{background:none}.dl-addr-opt.other input{width:100%}.dl-addr-check{width:16px;height:16px;border-radius:5px;box-shadow:inset 0 0 0 1.5px var(--dl-fg-faint);display:inline-flex;align-items:center;justify-content:center}.dl-addr-check .dl-icon-wrap{display:inline-flex}.dl-addr-check .dl-icon{width:12px;height:12px}.dl-addr-opt.on .dl-addr-check{background:var(--dl-accent);box-shadow:none;color:#fff}.dl-addr-opt.other .dl-addr-check{box-shadow:none;color:var(--dl-fg-muted)}.dl-addr-warn{display:inline-flex;align-items:center;gap:5px;font-size:12px;line-height:17px;color:var(--dl-warn)}.dl-addr-warn .dl-icon-wrap{display:inline-flex}.dl-addr-warn .dl-icon{width:13px;height:13px}.dl-pill.info{background:color-mix(in srgb,var(--dl-accent) 14%,transparent);color:var(--dl-accent)}.dl-links{border-radius:12px;background:var(--dl-soft);overflow:hidden}.dl-link-row{display:grid;grid-template-columns:18px minmax(0,1fr) auto;gap:10px;align-items:center;padding:11px 14px}.dl-link-row+.dl-link-row{border-top:1px solid var(--dl-line)}.dl-link-ic{display:inline-flex}.dl-link-ic .dl-icon{width:15px;height:15px}.dl-link-ic.ok .dl-icon{color:var(--dl-ok)}.dl-link-ic.warn .dl-icon{color:var(--dl-warn)}.dl-link-url{font-size:13px;color:var(--dl-fg-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-link-url b{font-weight:500;color:var(--dl-accent)}@media(max-width:640px){.dl-link-url,.dl-addr-opt .dl-mono,.dl-filecard .dl-ellipsis,.dl-invite-link>span:first-child{white-space:normal;overflow-wrap:anywhere}}.dl-ready-sum{display:flex;align-items:center;gap:12px;padding:12px 14px;border-radius:12px}.dl-ready-sum>.dl-icon-wrap{display:inline-flex}.dl-ready-sum>.dl-icon-wrap .dl-icon{width:18px;height:18px}.dl-ready-sum .dl-stack{flex:1;min-width:0}.dl-ready-sum b{font-weight:500;font-size:13px}.dl-ready-sum.ok{background:var(--dl-ok-wash)}.dl-ready-sum.ok b,.dl-ready-sum.ok .dl-icon{color:var(--dl-ok)}.dl-ready-sum.warn{background:var(--dl-warn-wash)}.dl-ready-sum.warn b,.dl-ready-sum.warn .dl-icon{color:var(--dl-warn)}.dl-ready-sum.error{background:var(--dl-bad-wash)}.dl-ready-sum.error b,.dl-ready-sum.error .dl-icon{color:var(--dl-bad)}.dl-check-chip{display:inline-flex;align-items:center;gap:5px;height:26px;padding:0 10px;border-radius:999px;background:var(--dl-soft);font-size:12px;color:var(--dl-fg-muted)}.dl-check-chip .dl-icon-wrap{display:inline-flex}.dl-check-chip .dl-icon{width:13px;height:13px;color:var(--dl-ok)}.dl-check-chip.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-check-chip.warn .dl-icon{color:var(--dl-warn)}.dl-check-chip.error{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-check-chip.error .dl-icon{color:var(--dl-bad)}.dl-ready-details{display:flex;flex-direction:column;gap:8px;padding:4px 2px}.dl-ready-details[hidden]{display:none}.dl-ready-item{display:flex;align-items:flex-start;gap:8px;font-size:13px;line-height:18px;min-width:0}.dl-ready-item .dl-icon-wrap{display:inline-flex;margin-top:1px}.dl-ready-item .dl-icon{width:15px;height:15px}.dl-ready-item.ok .dl-icon{color:var(--dl-ok)}.dl-ready-item.warn .dl-icon{color:var(--dl-warn)}.dl-ready-item.error .dl-icon{color:var(--dl-bad)}.dl-params-body{display:flex;flex-direction:column;gap:14px;padding:6px 14px 14px}.dl-params-body>.dl-setrow{margin:0;padding:0}.dl-pgrid.flush{padding:0;grid-template-columns:repeat(2,minmax(0,1fr))}@media(max-width:640px){.dl-pgrid.flush{grid-template-columns:minmax(0,1fr)}}.dl-qr-pane{display:flex;flex-direction:column;align-items:center;gap:8px;text-align:center}.dl-qr{width:min(280px,72vw);aspect-ratio:1;background:#fff;padding:8px;border-radius:12px;box-shadow:inset 0 0 0 1px var(--dl-line)}.dl-qr svg{display:block;width:100%;height:100%}.dl-filecard{display:flex;align-items:center;gap:12px;padding:12px;border-radius:14px;background:var(--dl-soft);min-width:0}.dl-filecard>.dl-stack{flex:1;min-width:0}.dl-filecard-ic{width:40px;height:46px;border-radius:8px;flex:none;display:inline-flex;align-items:center;justify-content:center;font:10px var(--dl-mono);color:var(--dl-fg-muted);background:var(--dl-card);box-shadow:inset 0 0 0 1px var(--dl-line)}.dl-params>.dl-conf{margin:0;border-top:1px solid var(--dl-line);border-radius:0 0 12px 12px;background:none}.dl-conf-sec{color:var(--dl-accent)}.dl-conf-k{color:var(--dl-fg-faint)}.dl-conf-mask{padding:0 6px;border-radius:4px;background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-params>summary .dl-chipbtn{height:26px;font-size:12px}.dl-conf{white-space:pre-wrap;word-break:break-all;max-height:22em;overflow:auto;font-family:var(--dl-mono);font-size:12px;line-height:18px;margin:0;padding:12px;border-radius:12px;background:var(--dl-soft)}.dl-key{width:100%;box-sizing:border-box;font-family:var(--dl-mono);font-size:12px;word-break:break-all;min-height:7em}.dl-actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin:12px 0 0}.dl-link-box{display:flex;gap:6px;align-items:center;flex-wrap:wrap}.dl-link-box input{flex:1 1 18em;min-width:0;font-family:var(--dl-mono);font-size:12px}.dl-hint{font-size:12px;line-height:16px;color:var(--dl-fg-muted);margin:8px 0}.dl-divider{border:0;border-top:1px solid var(--dl-line);margin:16px 0}";var si=".dl-checks{list-style:none;margin:0;padding:0}.dl-checks li{display:flex;align-items:center;gap:12px;padding:12px 0;border-top:1px solid var(--dl-line)}.dl-checks li:first-child{border-top:0;padding-top:0}.dl-checks li:last-child{padding-bottom:0}.dl-check-icon{flex:0 0 auto;width:28px;height:28px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center}.dl-check-icon .dl-icon{width:14px;height:14px}.dl-check-icon.ok{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-check-icon.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-check-icon.error{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-check-icon.skip{background:var(--dl-soft);color:var(--dl-fg-faint)}.dl-check-body{flex:1;min-width:0}.dl-check-title{font-size:14px;line-height:20px;font-weight:500}.dl-check-detail{font-size:12px;line-height:16px;color:var(--dl-fg-muted);overflow-wrap:anywhere}.dl-check-repaired{margin-top:2px;font-size:12px;line-height:16px;color:var(--dl-warn)}.dl-wd{margin:0 0 16px;display:flex;flex-direction:column;gap:14px}.dl-wd-head{display:flex;align-items:center;gap:12px;min-width:0}.dl-wd-head>.dl-stack{min-width:0}.dl-wd-title{font-size:16px;line-height:24px;font-weight:500}.dl-wd-tile{flex:none;width:36px;height:36px;border-radius:10px;display:inline-flex;align-items:center;justify-content:center;background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-wd-tile.off{background:var(--dl-soft);color:var(--dl-fg-faint)}.dl-wd-tile .dl-icon{width:18px;height:18px}.dl-wd-foot{display:flex;align-items:center;flex-wrap:wrap;gap:8px 16px;padding-top:14px;border-top:1px solid var(--dl-line)}.dl-wd-chips{display:flex;flex-wrap:wrap;gap:6px;flex:1 1 auto;min-width:0}.dl-wd-chips .dl-check-chip.error .dl-icon{color:var(--dl-bad)}.dl-warn-text{color:var(--dl-warn)!important}.dl-health-cols{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(440px,100%),1fr));gap:16px;align-items:start}.dl-health-cols>.dl-panel{margin:0;min-width:0}.dl-recent{display:flex;flex-direction:column}.dl-recent .dl-panel-head a{font-size:13px}.dl-recent-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:32px 16px;color:var(--dl-fg-muted);font-size:13px;border-top:1px solid var(--dl-line)}.dl-loading{margin:0;font-size:13px}.dl-diag-tabs{margin:0 0 16px}.dl-row.dl-slog-row{align-items:baseline}.dl-slog-row .dl-ev-tile{align-self:flex-start;margin-top:-1px}.dl-slog-row.has-detail{cursor:pointer}.dl-row.dl-slog-row.has-detail:hover{background:color-mix(in srgb,var(--sys) 11%,transparent)}.dl-slog-more{display:inline-flex;vertical-align:-2px;margin-left:6px;color:var(--dl-fg-faint);transform:rotate(90deg);transition:transform .15s}.dl-slog-more .dl-icon{width:14px;height:14px}.dl-slog-more.open{transform:rotate(-90deg)}.dl-slog-detail{margin:8px 0 2px;padding:8px 10px;border-radius:8px;background:var(--dl-soft);font-family:var(--dl-mono);font-size:12px;line-height:17px;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--dl-fg-muted);cursor:text}.dl-table{width:100%;border-collapse:collapse;font-size:14px;line-height:20px}.dl-table th{text-align:left;font-weight:500;color:var(--dl-fg-faint);padding:0 8px 8px;border-bottom:1px solid var(--dl-line)}.dl-table td{padding:10px 8px;border-bottom:1px solid var(--dl-line);vertical-align:middle}.dl-table th:first-child,.dl-table td:first-child{padding-left:0}.dl-table th:last-child,.dl-table td:last-child{padding-right:0}.dl-table tr:last-child td{border-bottom:0}.dl-table .dl-right{text-align:right;white-space:nowrap}.dl-log{max-height:18em;overflow:auto;font-family:var(--dl-mono);font-size:12px;line-height:18px;margin:8px 0 0;padding:12px;white-space:pre-wrap;border-radius:12px;background:var(--dl-soft)}";var li=".dl-pagehead{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;flex-wrap:wrap;margin:0 0 20px}.dl-h1{margin:0!important;padding:0!important;font-size:24px!important;line-height:32px!important;font-weight:500!important;border:0!important}.dl-title-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.dl-stack{display:flex;flex-direction:column;gap:2px;min-width:0}.dl-stack.gap4{gap:4px}.dl-stack.gap8{gap:8px}.dl-sub{font-size:12px;line-height:16px;color:var(--dl-fg-muted)}.dl-ok{color:var(--dl-ok)}.dl-warn{color:var(--dl-warn)}.dl-bad{color:var(--dl-bad)}.dl-icon-only{width:auto!important;min-width:0!important;aspect-ratio:1 / 1;padding:0!important;justify-content:center;display:inline-flex!important;align-items:center;border-radius:999px!important}.dl-panel.flush{padding:0;overflow:hidden}.dl-panel-head.pad{padding:16px 16px 12px;margin:0}.dl-col{display:flex;flex-direction:column;gap:16px;min-width:0}.dl-col>.dl-panel,.dl-col>section.dl-panel{margin:0}.dl-crumbs{display:flex;gap:8px;align-items:center;font-size:14px;margin:0 0 16px;color:var(--dl-fg-faint)}.dl-crumbs a{color:var(--dl-fg-faint)}.dl-crumbs a:hover{color:var(--dl-fg)}.dl-crumbs span:last-child{color:var(--dl-fg)}.dl-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);margin:0 0 16px;box-shadow:var(--dl-shadow)}.dl-metric{display:flex;flex-direction:column;gap:4px;padding:16px 20px;min-width:0}.dl-metric+.dl-metric{border-left:1px solid var(--dl-line)}.dl-metric-label{font-size:12px;font-weight:500;color:var(--dl-fg-faint)}.dl-metric-value{font-size:28px;line-height:36px;font-weight:500;letter-spacing:-.01em;font-variant-numeric:tabular-nums;white-space:nowrap}.dl-metric-value .dl-faint{font-size:16px}.dl-metric-sub{font-size:12px;color:var(--dl-fg-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@media(max-width:900px){.dl-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.dl-metric:nth-child(3){border-left:0}.dl-metric:nth-child(n+3){border-top:1px solid var(--dl-line)}}.dl-seg{display:inline-flex;gap:2px;padding:3px;border-radius:999px;background:var(--dl-soft);flex-wrap:wrap}.dl-seg button{all:unset;cursor:pointer;display:inline-flex;align-items:center;gap:6px;padding:4px 12px;border-radius:999px;font-size:13px;font-weight:500;color:var(--dl-fg-muted);white-space:nowrap}.dl-seg button:hover{color:var(--dl-fg)}.dl-seg button.on{background:var(--dl-soft-hover);color:var(--dl-fg)}.dl-seg.dl-srvsections{flex-wrap:nowrap;max-width:100%;overflow-x:auto;scrollbar-width:none}.dl-seg.dl-srvsections::-webkit-scrollbar{display:none}.dl-seg.dl-srvsections button{flex:none;white-space:nowrap}.dl-seg button:focus-visible{outline:2px solid var(--dl-ring)}.dl-seg button b{font-weight:500;font-size:11px;padding:0 6px;border-radius:999px;background:var(--dl-soft)}.dl-seg button b.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-seg.sm button{padding:2px 9px;font-size:11px}.dl-seg.wide{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));border-radius:12px;padding:4px}.dl-seg.wide button{flex-direction:column;justify-content:center;padding:8px 6px;border-radius:9px;gap:3px}.dl-seg.wide button.on{background:var(--dl-primary);color:var(--dl-primary-fg)}";var di=`.dl-geomap{position:relative;border-top:1px solid var(--dl-line);background:transparent}.dl-map-status{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;color:var(--dl-fg-muted);font-size:13px;z-index:1;pointer-events:none}.dl-map-wrap{position:relative}.dl-map-legend{position:absolute;left:12px;bottom:12px;display:flex;gap:12px;align-items:center;padding:6px 12px;border-radius:999px;font-size:12px;background:color-mix(in srgb,var(--dl-card) 88%,transparent);border:1px solid var(--dl-line);backdrop-filter:blur(6px);z-index:2}.dl-map-legend span{display:inline-flex;align-items:center;gap:6px;color:var(--dl-fg-muted)}.dl-map-legend i.line{width:14px;height:0;border-top:2px dashed #8a8a8a}.dl-map-legend i.line.live{border-top-color:#3b82f6}.dl-map-off{padding:32px 16px;text-align:center;color:var(--dl-fg-muted);border-top:1px solid var(--dl-line)}.dl-mk{all:unset;cursor:pointer;position:relative;display:flex;align-items:center;justify-content:center;transition:opacity .2s}.dl-mk-hub{position:relative;display:flex;align-items:center;justify-content:center}.dl-mk-host{box-sizing:border-box;width:40px;height:40px;border-radius:11px;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--dl-elevated) 60%,transparent);border:1px solid var(--dl-line);backdrop-filter:blur(6px);box-shadow:0 6px 16px #00000059}.dl-mk-host-tile{width:26px;height:26px;border-radius:7px;display:flex;align-items:center;justify-content:center;background:var(--dl-fg);color:var(--background, var(--dl-elevated))}.dl-mk-host-ic{width:14px;height:14px}.dl-mk-av{position:relative;box-sizing:border-box;width:28px;height:28px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:500;line-height:1;border:2px solid #8a8a8a;background:var(--dl-elevated);color:var(--dl-fg-muted);transition:box-shadow .2s}.dl-mk.online .dl-mk-av{border-color:#3b82f6;background:color-mix(in srgb,#3b82f6 22%,var(--dl-elevated));color:var(--dl-fg)}.dl-mk-badge{position:absolute;left:16px;bottom:-6px;height:16px;min-width:16px;padding:0 3px;border-radius:8px;border:2px solid var(--dl-elevated);background:#6b6b6b;color:#fff;display:flex;align-items:center;justify-content:center;gap:1px;font-size:9px;font-weight:600;white-space:nowrap;box-sizing:content-box}.dl-mk.online .dl-mk-badge{background:#3b82f6}.dl-mk-badge-ic{width:10px;height:10px;stroke-width:2.2}.dl-mk-badge:has(>svg:only-child){width:16px;min-width:0;padding:0}.dl-mk-tile{position:relative;width:26px;height:26px;border-radius:7px;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--dl-fg) 18%,var(--dl-elevated));color:var(--dl-fg)}.dl-mk.place.online .dl-mk-tile{background:#3b82f6;color:#fff;box-shadow:0 2px 8px #3b82f659}.dl-mk-tile-ic{width:14px;height:14px}.dl-mk-tile-n{position:absolute;right:-5px;top:-5px;min-width:14px;height:14px;padding:0 3px;box-sizing:border-box;border-radius:7px;background:var(--dl-fg);color:var(--dl-elevated);font-size:9px;font-weight:600;line-height:14px;text-align:center}.dl-mk-when{display:block;text-align:center;color:var(--dl-fg-faint);font-weight:400}.dl-mk.place.online .dl-mk-when{color:#3b82f6}.dl-mk-tile.sm{width:18px;height:18px;border-radius:5px;font-size:9px;font-weight:600}.dl-dmap{border:1px solid var(--dl-line);border-radius:12px;overflow:hidden}.dl-dmap .dl-geomap{border-top:0}.dl-dplaces{display:flex;flex-direction:column;margin-top:4px}.dl-dplace-row{display:flex;align-items:center;gap:10px;padding:9px 2px;border-top:1px solid var(--dl-line);font-size:13px}.dl-dplace-row:first-child{border-top:0}.dl-dplace-n{flex:0 0 auto;width:20px;height:20px;border-radius:5px;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:600;background:color-mix(in srgb,var(--dl-fg) 18%,var(--dl-elevated));color:var(--dl-fg)}.dl-dplace-n.live{background:#3b82f6;color:#fff}.dl-dplace-n .dl-icon{width:12px;height:12px}.dl-dplace-now{color:#3b82f6}.dl-dplaces.strips .dl-dplace-row{position:relative;display:grid;grid-template-columns:20px minmax(0,1fr) auto;column-gap:10px;row-gap:9px;margin:0 -10px;padding:11px 10px;border-top:0;border-radius:10px;transition:background .15s}.dl-dplaces.strips .dl-dplace-row+.dl-dplace-row:before{content:"";position:absolute;left:10px;right:10px;top:0;height:1px;background:var(--dl-line)}.dl-dplaces.strips .dl-dplace-row:is(:hover,.cur){background:var(--dl-soft)}.dl-dplaces.strips .dl-dplace-row:is(:hover,.cur):before,.dl-dplaces.strips .dl-dplace-row:is(:hover,.cur)+.dl-dplace-row:before{opacity:0}.dl-dplace-strip{grid-column:2 / 4;position:relative;height:6px;border-radius:3px;background:var(--dl-track)}.dl-dplaces.can-replay .dl-dplace-strip{cursor:ew-resize;touch-action:none}.dl-dplace-strip i{position:absolute;top:0;bottom:0;min-width:2px;border-radius:2px;background:#8a8a8a}.dl-dplace-strip.live i{background:#3b82f6}.dl-dplaces.replay .dl-dplace-strip:after{content:"";position:absolute;left:var(--at);top:-4px;bottom:-4px;width:2px;margin-left:-1px;border-radius:1px;background:var(--dl-fg);box-shadow:0 0 0 2px var(--dialog-bg, var(--dl-elevated));pointer-events:none}.dl-dplace-axis{position:relative;height:16px;margin:4px 0 0 30px;font-size:11px;line-height:16px;color:var(--dl-fg-faint)}.dl-dplace-axis span{position:absolute;top:0;transform:translate(-50%);white-space:nowrap}.dl-dmap{position:relative}.dl-map-replay{position:absolute;left:10px;top:10px;z-index:3;display:flex;align-items:center;gap:6px}.dl-map-btn{all:unset;box-sizing:border-box;cursor:pointer;width:28px;height:28px;border-radius:8px;display:inline-flex;align-items:center;justify-content:center;background:var(--dl-elevated);border:1px solid var(--dl-line);color:var(--dl-fg)}.dl-map-btn:hover{background:color-mix(in srgb,var(--dl-fg) 8%,var(--dl-elevated))}.dl-map-btn:focus-visible{outline:2px solid var(--dl-ring)}.dl-map-btn .dl-icon{width:13px;height:13px}.dl-map-chip{display:inline-flex;align-items:center;height:28px;box-sizing:border-box;padding:0 10px;border-radius:8px;font-size:11.5px;white-space:nowrap;background:var(--dl-elevated);border:1px solid var(--dl-line);color:var(--dl-fg);font-variant-numeric:tabular-nums}.dl-mk.step .dl-mk-tile{transition:width .3s cubic-bezier(.2,.8,.2,1),height .3s cubic-bezier(.2,.8,.2,1),border-radius .3s,background-color .3s,color .3s,box-shadow .3s,transform .24s}.dl-mk.step .dl-mk-tile.sm .dl-mk-tile-ic{width:11px;height:11px}.dl-mk.step.faded>*{opacity:.5}.dl-mk.step:is(.online,.hl){z-index:2}.dl-mk.step.hl .dl-mk-tile{box-shadow:0 0 0 3px color-mix(in srgb,#3b82f6 55%,transparent)}.dl-mk.step.arrive .dl-mk-tile{animation:dl-mk-arrive .45s cubic-bezier(.2,.8,.2,1)}@keyframes dl-mk-arrive{0%{transform:scale(.8)}55%{transform:scale(1.12)}to{transform:scale(1)}}.dl-mk-when.inline{display:inline}.dl-mk>*{transition:opacity .15s;opacity:var(--dl-mk-fade, 1)}.dl-mk.merged,.dl-mk.piled{pointer-events:none}.dl-mk.dl-mk-new>*{transition:none}.dl-mk.merged>*,.dl-mk.piled>*{opacity:0}.dl-mk-hub{cursor:default}.dl-mk-host{position:relative}.dl-mk-host{transition:border-radius .22s ease,border-right-color .22s ease}.dl-mk-host.docked{border-top-right-radius:0;border-bottom-right-radius:0;border-right-color:transparent}.dl-mk-dock{position:absolute;left:100%;top:-1px;height:40px;box-sizing:border-box;display:flex;align-items:center;gap:6px;padding:0 10px 0 2px;border:1px solid var(--dl-line);border-left:0;border-radius:0 11px 11px 0;background:color-mix(in srgb,var(--dl-elevated) 60%,transparent);backdrop-filter:blur(6px);box-shadow:0 6px 16px #00000059;pointer-events:none;opacity:0;clip-path:inset(-24px 100% -24px 0);transition:clip-path .28s cubic-bezier(.2,.8,.2,1),opacity .2s ease}.dl-mk-host.docked .dl-mk-dock{pointer-events:auto;opacity:1;clip-path:inset(-24px -24px -24px 0)}.dl-mk-new .dl-mk-host,.dl-mk-new .dl-mk-dock{transition:none}.dl-mk-pile{position:relative;display:flex;justify-content:center}.dl-mk-pile-box{box-sizing:border-box;height:40px;display:flex;align-items:center;gap:6px;padding:0 10px 0 6px;border-radius:20px;cursor:zoom-in;background:color-mix(in srgb,var(--dl-elevated) 60%,transparent);border:1px solid var(--dl-line);backdrop-filter:blur(6px);box-shadow:0 6px 16px #00000059;animation:dl-plate-in .26s cubic-bezier(.2,.8,.2,1) both;transition:opacity .18s ease,transform .18s ease}.dl-mk-pile.out{pointer-events:none}.dl-mk-pile.out>*{opacity:0;transform:scale(.85);transition:opacity .18s ease,transform .18s ease}@keyframes dl-plate-in{0%{opacity:0;transform:scale(.85)}}.dl-mk-face{all:unset;position:relative;display:flex;cursor:pointer;transition:transform .18s ease,opacity .18s ease}.dl-mk-face>.dl-mk-badge{position:relative;left:auto;bottom:-8px;margin-left:-12px;align-self:center}.dl-mk-face.on .dl-mk-av{border-color:#3b82f6;background:color-mix(in srgb,#3b82f6 22%,var(--dl-elevated));color:var(--dl-fg)}.dl-mk-face.on .dl-mk-badge{background:#3b82f6}.dl-mk-face:hover .dl-mk-av{box-shadow:0 0 0 4px #3b82f640}.dl-mk-face.in{animation:dl-dock-in .24s cubic-bezier(.2,.8,.2,1) both}.dl-mk-face.out{transform:scale(.4);opacity:0;pointer-events:none}@keyframes dl-dock-in{0%{transform:scale(.4);opacity:0}}.dl-mk-more{font-size:11px;font-weight:600;color:var(--dl-fg-muted)}.dl-mk-av,.dl-mk-tile{transition:box-shadow .2s,transform .24s cubic-bezier(.2,.8,.2,1)}.dl-mk.merged .dl-mk-av,.dl-mk.merged .dl-mk-tile,.dl-mk.piled .dl-mk-av{transform:scale(.5)}.dl-mk-host,.dl-mk-dock,.dl-mk-pile-box{transition-property:border-radius,border-right-color,clip-path,opacity,height,width,padding,gap}.dl-mk-dock,.dl-mk-pile-box{transition-duration:.22s;transition-timing-function:cubic-bezier(.2,.8,.2,1)}.dl-mk-pile-box{position:relative}.dl-mk-more{transition:transform .22s cubic-bezier(.2,.8,.2,1),opacity .18s ease}.dl-mk-more.in{animation:dl-dock-in .24s ease both}.dl-mk-more.out{transform:scale(.4);opacity:0}.dl-mk-face .dl-mk-av{transition:box-shadow .2s,transform .24s cubic-bezier(.2,.8,.2,1),width .2s ease,height .2s ease,font-size .2s ease}.dl-mk-face{transition:transform .22s cubic-bezier(.2,.8,.2,1),opacity .18s ease,margin .2s ease}.dl-mk-face>.dl-mk-badge{max-width:48px;overflow:hidden;transition:opacity .2s ease,transform .2s ease,max-width .22s ease,margin .22s ease,padding .22s ease,border-width .22s ease,height .22s ease,min-width .22s ease,width .22s ease,bottom .22s ease}.dl-lod-far .dl-mk-host{width:32px;height:32px;border-radius:9px}.dl-lod-far .dl-mk-host.docked{border-radius:9px 0 0 9px}.dl-lod-far .dl-mk-host-tile{width:20px;height:20px;border-radius:6px}.dl-lod-far .dl-mk-host-ic{width:11px;height:11px}.dl-lod-far .dl-mk-dock{height:32px;gap:0;padding:0 4px 0 0;border-radius:0 9px 9px 0}.dl-lod-far .dl-mk-pile-box{height:32px;gap:0;padding:0 4px;border-radius:16px}.dl-lod-far .dl-mk-face+.dl-mk-face{margin-left:-6px}.dl-lod-far .dl-mk-face .dl-mk-av{width:22px;height:22px;font-size:8px;box-shadow:0 0 0 2px var(--dl-elevated)}.dl-lod-far .dl-mk-face>.dl-mk-badge{max-width:0;min-width:0;padding:0;margin-left:0;border-width:0;opacity:0;transform:scale(.5);pointer-events:none}.dl-lod-far .dl-mk-more{margin-left:4px;font-size:10px}.dl-mk-label{transition:opacity .2s ease}.dl-lod-far .dl-mk:not(.step) .dl-mk-label{opacity:0}.dl-lod-mid .dl-mk-host{width:36px;height:36px}.dl-lod-mid .dl-mk-dock,.dl-lod-mid .dl-mk-pile-box{height:36px}.dl-lod-mid .dl-mk-face .dl-mk-av{width:24px;height:24px;font-size:9px}.dl-lod-mid .dl-mk-face>.dl-mk-badge{height:12px;min-width:12px;margin-left:-10px;bottom:-7px}.dl-lod-mid .dl-mk-face>.dl-mk-badge:has(>svg:only-child){width:12px}.dl-lod-mid .dl-mk-face>.dl-mk-badge .dl-mk-badge-ic{width:8px;height:8px}@media(prefers-reduced-motion:reduce){.dl-mk-dock,.dl-mk-pile-box,.dl-mk-face,.dl-mk-av,.dl-mk-tile,.dl-mk.step .dl-mk-tile,.dl-mk-host,.dl-mk-face>.dl-mk-badge{transition:none;animation:none}}.dl-mk-hub:has(.dl-mk-host.docked) .dl-mk-host{cursor:zoom-in}.dl-mk-ptr{position:absolute;left:50%;top:50%;width:0;height:0;z-index:-1;pointer-events:none}.dl-mk-ptr .line{position:absolute;left:0;top:-.5px;height:1px;background:var(--dl-fg-faint);transform-origin:0 50%}.dl-mk-ptr .spot{position:absolute;left:-3.5px;top:-3.5px;width:7px;height:7px;border-radius:50%;box-sizing:border-box;border:1.5px solid #fff;background:#8a8a8a}.dl-mk.online .dl-mk-ptr .spot,.dl-mk.place.online .dl-mk-ptr .spot{background:#3b82f6}.dl-mk.dim>*{opacity:.18}.dl-mk.hl .dl-mk-av{box-shadow:0 0 0 4px #3b82f640}.dl-mk-label{position:absolute;left:50%;bottom:100%;margin-bottom:4px;transform:translate(-50%);white-space:nowrap;pointer-events:none;font-size:10px;line-height:14px;font-weight:500;color:var(--dl-fg)}.dl-mk-label.below{bottom:auto;top:100%;margin:4px 0 0}.dl-mk-label.chip{padding:2px 6px;border-radius:4px;font-size:11px;line-height:16px;font-weight:600;background:color-mix(in srgb,var(--background, var(--dl-card)) 80%,transparent);backdrop-filter:blur(8px)}.dl-geomap .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib.maplibregl-compact{margin:0 10px 10px 0;min-height:28px;padding:0;border-radius:8px;background:var(--dl-elevated);border:1px solid var(--dl-line);color:var(--dl-fg-muted);box-shadow:none;font-size:11px;line-height:26px}.dl-geomap .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib.maplibregl-compact:not(.maplibregl-compact-show){width:28px;height:28px;box-sizing:border-box}.dl-geomap .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib.maplibregl-compact.maplibregl-compact-show{padding:0 32px 0 10px}.dl-geomap .maplibregl-ctrl-attrib a{color:var(--dl-fg-muted)}.dl-geomap .maplibregl-ctrl-attrib-button{top:0;right:0;width:26px;height:26px;margin:0;border-radius:8px;background:none}.dl-geomap .maplibregl-ctrl-attrib-button:after{content:"";position:absolute;inset:5px;background:var(--dl-fg);-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20Zm-1.2 8.2h2.4V17h-2.4v-6.8ZM12 6a1.4 1.4 0 1 0 0 2.8A1.4 1.4 0 0 0 12 6Z'/%3E%3C/svg%3E") center / contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20Zm-1.2 8.2h2.4V17h-2.4v-6.8ZM12 6a1.4 1.4 0 1 0 0 2.8A1.4 1.4 0 0 0 12 6Z'/%3E%3C/svg%3E") center / contain no-repeat}.dl-geomap .maplibregl-ctrl-attrib-button:focus{outline:none;box-shadow:none}.dl-geomap .maplibregl-ctrl-attrib-button:focus-visible{outline:2px solid var(--dl-ring)}.dl-map-card{position:absolute;right:12px;top:12px;z-index:3;min-width:200px;max-width:260px;padding:10px 12px;border-radius:10px;font-size:12px;line-height:20px;background:var(--dl-elevated);color:var(--dl-fg);border:1px solid var(--dl-line);box-shadow:var(--shadow-xl, 0 8px 16px -4px rgba(0,0,0,.4));opacity:0;transition:opacity .2s;pointer-events:none}.dl-map-card.on{opacity:1}.dl-map-card-head b{font-weight:500}.dl-map-card-row{display:flex;justify-content:space-between;gap:12px;white-space:nowrap}.dl-popcard{position:fixed;z-index:2100;width:max-content;max-width:300px;padding:12px;border-radius:12px;box-sizing:border-box;background:var(--dl-elevated);color:var(--dl-fg);border:1px solid var(--dl-line);box-shadow:var(--shadow-xl, 0 8px 16px -4px rgba(0,0,0,.4))}.dl-popcard.away{visibility:hidden}.dl-popcard.leaving{pointer-events:none}.dl-popcard-tip{position:absolute;left:var(--tip-x, 50%);width:10px;height:10px;margin-left:-6px;box-sizing:border-box;background:var(--dl-elevated);border:solid var(--dl-line);transform:rotate(45deg)}.dl-popcard.above .dl-popcard-tip{bottom:-6px;border-width:0 1px 1px 0}.dl-popcard.below .dl-popcard-tip{top:-6px;border-width:1px 0 0 1px}.dl-popcard.above{transform-origin:var(--tip-x, 50%) 100%}.dl-popcard.below{transform-origin:var(--tip-x, 50%) 0}@media(prefers-reduced-motion:no-preference){.dl-popcard{animation:dl-pop-in .16s ease-out}.dl-popcard.leaving{animation:dl-pop-out .14s ease-in forwards}}@keyframes dl-pop-in{0%{opacity:0;transform:scale(.94)}to{opacity:1;transform:none}}@keyframes dl-pop-out{0%{opacity:1;transform:none}to{opacity:0;transform:scale(.94)}}.dl-pop{display:flex;flex-direction:column;gap:4px;font-size:12px;line-height:18px;min-width:210px}.dl-pop-head{display:flex;align-items:center;gap:8px;font-size:13px;margin-bottom:2px}.dl-pop-net{width:30px;height:30px;border-radius:9px;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;color:var(--dl-fg-muted)}.dl-pop-list{display:flex;flex-direction:column;margin:6px 0 0;max-height:116px;overflow-y:auto}.dl-pop-row{all:unset;cursor:pointer;display:flex;align-items:center;gap:8px;padding:6px 8px;border-radius:8px}.dl-pop-row:hover{background:var(--dl-soft)}.dl-pop-row:focus{outline:none}.dl-pop-row:focus-visible{outline:2px solid var(--dl-ring)}.dl-pop-name{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-pop-name b{font-weight:500}.dl-pop-dot{width:6px;height:6px;border-radius:50%;background:var(--dl-fg-faint);flex:0 0 auto}.dl-pop-dot.on{background:var(--dl-ok);box-shadow:0 0 0 3px var(--dl-ok-wash)}.dl-pop-actions{display:flex;gap:6px;margin-top:8px;padding-top:8px;border-top:1px solid var(--dl-line)}.dl-pop-actions .cbi-button{flex:1;height:28px!important;font-size:12px!important;justify-content:center}.dl-chartbox{position:relative}.dl-bars{display:flex;align-items:flex-end;gap:4px;border-bottom:1px solid var(--dl-line)}.dl-bar{flex:1;height:100%;display:flex;flex-direction:column-reverse;gap:1px;cursor:default;min-width:3px}.dl-bar i{display:block;border-radius:3px 3px 0 0}.dl-bar i.down{background:var(--dl-chart-1)}.dl-bar i.up{background:var(--dl-chart-2);opacity:.75;border-radius:3px 3px 0 0}.dl-bar:hover i{filter:brightness(1.25)}.dl-bar.empty{background:linear-gradient(to top,var(--dl-line) 2px,transparent 2px)}.dl-tip{position:absolute;top:-8px;transform:translate(-50%,-100%);padding:8px 10px;border-radius:10px;font-size:12px;line-height:18px;white-space:nowrap;background:var(--dl-elevated);border:1px solid var(--dl-line);box-shadow:var(--shadow-xl, 0 8px 16px -4px rgba(0,0,0,.4));pointer-events:none;z-index:3}.dl-tip-title{font-weight:500}.dl-tip-float{position:fixed;z-index:2000;color:var(--dl-fg)}.dl-spark i:hover{opacity:1;filter:brightness(1.25)}.dl-meter,.dl-slots{cursor:default}.dl-axis{display:flex;justify-content:space-between;font-size:12px;color:var(--dl-fg-faint);margin-top:6px}.dl-legend i.down{background:var(--dl-chart-1)}.dl-legend i.up{background:var(--dl-chart-2)}.dl-spark{display:flex;align-items:flex-end;gap:2px;flex:0 0 auto}.dl-spark i{flex:1;display:block;border-radius:2px 2px 0 0;background:var(--dl-chart-1);opacity:.85}.dl-spark i.zero{opacity:.22}`;var ci=`.dl-row{display:flex;align-items:center;gap:12px;padding:12px 16px;border-top:1px solid var(--dl-line);font-size:14px;line-height:20px;min-width:0}.dl-row.link{color:inherit;text-decoration:none}.dl-row.link:hover{background:var(--dl-soft)}.dl-row-main{flex:1;min-width:0;overflow-wrap:anywhere}.dl-row-main b{font-weight:500}.dl-attn{display:flex;flex-direction:column;gap:10px;padding:16px;border-top:1px solid var(--dl-line)}.dl-attn-item{display:flex;gap:10px;align-items:baseline;font-size:13px;color:var(--dl-fg-muted)}.dl-avatar.sm{width:26px;height:26px;font-size:10px;margin:0}.dl-avatar.lg{width:48px;height:48px;font-size:15px;margin:0}.dl-avatar.lg.online:after{width:12px;height:12px}.dl-list{border:1px solid var(--dl-line);border-radius:12px;overflow:hidden}.dl-list>.dl-row:first-child{border-top:0}.dl-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.dl-row-main.dl-stack{min-width:0}.dl-person-id{display:flex;align-items:center;gap:14px;min-width:0}.dl-grid-person{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(0,1fr);gap:16px;align-items:start}@media(max-width:1000px){.dl-grid-person{grid-template-columns:minmax(0,1fr)}}.dl-devsec{display:flex;flex-direction:column;gap:12px}.dl-devsec .dl-panel-head{margin:0}.dl-dgrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.dl-dcard>.dl-dcard-head+*{margin-top:auto}@media(max-width:700px){.dl-dgrid{grid-template-columns:minmax(0,1fr)}}.dl-dgrid>.dl-dslot.add:only-child{grid-column:1 / -1}.dl-dcard{background:var(--dl-card);border:1px solid var(--dl-line);border-radius:14px;padding:14px;display:flex;flex-direction:column;gap:12px;min-width:0;box-shadow:var(--dl-shadow)}.dl-dcard.online{border-color:color-mix(in srgb,var(--dl-ok) 35%,transparent)}.dl-dcard.off{opacity:.7}.dl-dcard-head{display:flex;align-items:center;gap:12px}.dl-dcard-ic{width:40px;height:40px;border-radius:12px;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;color:var(--dl-fg-muted)}.dl-dcard-ic .dl-icon{width:20px;height:20px}.dl-dcard.online .dl-dcard-ic{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-dcard-title{all:unset;cursor:pointer;flex:1;min-width:0;display:flex;flex-direction:column}.dl-dcard-title b{font-weight:500;font-size:15px}.dl-dstat{display:inline-flex;align-items:center;gap:6px;font-size:12px;color:var(--dl-fg-muted);white-space:nowrap;min-width:0}.dl-dstat i.dot{flex:none}.dl-dstat.ok{color:var(--dl-ok)}.dl-dstat.warn{color:var(--dl-warn)}.dl-dstat i.dot,.dl-savebar i.dot{width:6px;height:6px;border-radius:50%;background:var(--dl-fg-faint)}.dl-dstat i.dot.ok{background:var(--dl-ok);box-shadow:0 0 0 3px var(--dl-ok-wash)}.dl-dstat i.dot.warn{background:var(--dl-warn)}.dl-dcard-use{display:flex;align-items:flex-end;justify-content:space-between;gap:12px}.dl-dcard-foot{padding-top:10px;border-top:1px solid var(--dl-line);font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-dslot.add{all:unset;box-sizing:border-box;cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:14px;min-height:0;border:1px dashed color-mix(in srgb,currentColor 18%,transparent);border-radius:14px;text-align:center;color:var(--dl-fg-muted);transition:background .15s,border-color .15s,color .15s}.dl-dslot.add .dl-stack{align-items:center}.dl-dslot.add:hover{border-color:color-mix(in srgb,currentColor 35%,transparent);color:var(--dl-fg)}.dl-dslot.add:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-dslot.add b{font-weight:500}.dl-dslot.add:hover{background:var(--dl-soft)}.dl-dslot-ic{width:36px;height:36px;border-radius:999px;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;color:var(--dl-fg-muted)}.dl-dslot.add:hover .dl-dslot-ic{background:var(--dl-primary);color:var(--dl-primary-fg)}.dl-tiles2{display:grid;gap:10px;margin-top:16px}.dl-tile2{border:1px solid var(--dl-line);border-radius:14px;padding:14px;display:flex;flex-direction:column;gap:10px;min-width:0}.dl-tile2-label{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;font-weight:500;color:var(--dl-fg-faint)}.dl-tile2-row{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}.dl-tile2-value{font-size:20px;line-height:28px;font-weight:500;letter-spacing:-.01em;font-variant-numeric:tabular-nums}.dl-tile2-value .dl-faint{font-size:14px;font-weight:400}.dl-tile2-foot{display:flex;align-items:center;justify-content:space-between;gap:12px;padding-top:10px;border-top:1px solid var(--dl-line);font-size:12px}.dl-stepper{display:inline-flex;align-items:stretch;height:32px;border:1px solid var(--input, var(--dl-line));border-radius:8px;overflow:hidden}.dl-stepper button{all:unset;cursor:pointer;width:32px;display:inline-flex;align-items:center;justify-content:center;font-size:16px;color:var(--dl-fg)}.dl-stepper button:hover{background:var(--dl-soft)}.dl-stepper button[disabled]{opacity:.35;cursor:not-allowed}.dl-stepper+.dl-stepper{margin-left:4px}.dl-step-select{border:0!important;border-left:1px solid var(--input, var(--dl-line))!important;border-right:1px solid var(--input, var(--dl-line))!important;border-radius:0!important;background:transparent!important;color:inherit;font:500 13px inherit;padding:0 10px!important;height:100%!important;min-width:0!important}.dl-slots{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:3px}.dl-slots i{height:4px;border-radius:999px;background:var(--dl-track);display:block}.dl-slots i.used{background:var(--dl-fg)}.dl-slots i.over{background:color-mix(in srgb,var(--dl-warn) 80%,transparent)}.dl-date{display:flex;align-items:center;gap:8px;flex:1 1 150px;min-width:0;box-sizing:border-box;height:34px;padding:0 10px;border:1px solid var(--input, var(--dl-line));border-radius:8px;color:var(--dl-fg-faint)}.dl-date input{border:0!important;background:transparent!important;box-shadow:none!important;padding:0!important;height:32px!important;color:var(--dl-fg);flex:1;min-width:0!important;width:100%!important}.dl-meter{position:relative;height:6px;border-radius:999px;background:var(--dl-track)}.dl-meter>i{display:block;height:100%;border-radius:999px;background:var(--dl-accent)}.dl-meter.warn>i{background:var(--dl-warn)}.dl-meter.bad>i{background:var(--dl-bad)}.dl-meter .mark{position:absolute;left:90%;top:-3px;width:1px;height:12px;background:var(--dl-warn)}.dl-meter.sm{height:4px}.dl-chips-row{display:flex;flex-wrap:wrap;gap:4px}.dl-chipbtn{all:unset;cursor:pointer;height:26px;padding:0 10px;border-radius:999px;background:var(--dl-soft);font-size:12px;font-weight:500;display:inline-flex;align-items:center}.dl-chipbtn:hover{background:var(--dl-soft-hover)}.dl-chipbtn.on{background:var(--dl-primary);color:var(--dl-primary-fg)}.dl-switch{all:unset;cursor:pointer;position:relative;width:32px;height:20px;border-radius:999px;background:var(--switch-off, var(--dl-track));flex:0 0 auto;transition:background .15s}.dl-switch i{position:absolute;left:2px;top:2px;width:16px;height:16px;border-radius:50%;background:#fff;transition:left .15s;box-shadow:0 1px 2px #0000004d}.dl-switch.on{background:var(--dl-accent)}.dl-switch.on i{left:14px}.dl-switch:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-linkbox{display:flex;align-items:center;gap:8px;height:36px;padding:0 4px 0 12px;border:1px solid var(--input, var(--dl-line));border-radius:8px;background:var(--input-bg, transparent)}.dl-linkbox .dl-mono{flex:1;min-width:0;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--dl-fg-muted)}.dl-linkbox .cbi-button{height:28px!important}.dl-pcard{display:grid;grid-template-columns:minmax(0,1fr) 260px;gap:20px;align-items:stretch;min-width:0}.dl-pcard-main{min-width:0}.dl-pcard-top{display:flex;align-items:center;gap:12px;min-width:0}.dl-pcard-top .dl-avatar{margin-right:0}.dl-pcard-who{flex:1;min-width:0}.dl-pcard-who .dl-slotbar{margin:3px 0 0}.dl-pside{display:flex;flex-direction:column;justify-content:space-between;gap:8px;padding-left:20px;border-left:1px solid var(--dl-line);min-width:0}.dl-pside-top{display:flex;align-items:center;justify-content:space-between;gap:8px}.dl-pside-state{display:inline-flex;align-items:center;gap:6px;font-size:13px;color:var(--dl-fg-muted)}.dl-pside-state.live{color:var(--dl-ok)}.dl-pside-foot{font-size:12px}.dl-pside .dl-use-num b{font-size:20px}.dl-none{display:none!important}.dl-pcard-actions{display:flex;gap:6px;flex:0 0 auto}.dl-pcard-actions .cbi-button{height:32px!important}.dl-icon-only .dl-btn-label{display:none}.dl-pill-ic{display:inline-flex;align-items:center;gap:4px;height:22px;padding:0 8px;border-radius:999px;font-size:12px;white-space:nowrap;background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-pill-ic .dl-icon{width:12px;height:12px}.dl-pill-ic.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-pill-ic.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-use-num{display:flex;align-items:baseline;gap:6px;white-space:nowrap}.dl-use-num b{font-size:15px;font-weight:500}.dl-use-live{display:flex;align-items:center;gap:8px;font-size:12px;font-variant-numeric:tabular-nums}.dl-usebar{display:flex;gap:2px;height:6px;border-radius:999px;overflow:hidden;background:var(--dl-track)}.dl-usebar i{display:block;height:100%;min-width:3px;flex:0 1 0}.dl-usebar i.fill{flex:none;min-width:0;border-radius:999px;background:var(--dl-accent)}.dl-usebar.warn i.fill{background:var(--dl-warn)}.dl-usebar.bad i.fill{background:var(--dl-bad)}.dl-usebar .c0,.dl-swatch.c0{background:var(--dl-chart-1)}.dl-usebar .c1,.dl-swatch.c1{background:#8b7cf6}.dl-usebar .c2,.dl-swatch.c2{background:#2fb889}.dl-usebar .c3,.dl-swatch.c3{background:#d9a03f}.dl-usebar .c4,.dl-swatch.c4{background:var(--dl-fg-faint)}.dl-tip-row{display:flex;align-items:center;gap:8px;min-width:160px}.dl-tip-row b{margin-left:auto;font-weight:500}.dl-swatch{width:8px;height:8px;border-radius:2px;flex:none}.dl-card-name{color:var(--dl-fg)!important;text-decoration:none}.dl-card-name:hover{text-decoration:underline}.dl-chip-tag{font-size:11px;line-height:18px;padding:0 6px;border-radius:999px;background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-chip.live{background:var(--dl-ok-wash);color:color-mix(in srgb,var(--dl-ok) 35%,var(--dl-fg))}.dl-chip.live:hover{background:color-mix(in srgb,var(--dl-ok) 22%,transparent)}.dl-chip.live .dl-icon{color:var(--dl-ok)}.dl-fixes{display:flex;gap:6px;flex-wrap:wrap;margin:10px 0 0 44px}.dl-fix{all:unset;cursor:pointer;height:26px;padding:0 10px;border-radius:999px;background:var(--dl-info-wash);color:var(--dl-info);font-size:12px;font-weight:500;display:inline-flex;align-items:center}.dl-fix:hover{filter:brightness(1.15)}@media(max-width:760px){.dl-pcard{grid-template-columns:1fr}.dl-pside{padding:12px 0 0;border-left:0;border-top:1px solid var(--dl-line)}.dl-fixes{margin-left:0}}.dl-select{height:34px!important;border-radius:999px!important;min-width:136px!important;width:auto!important;padding:0 34px 0 14px!important;appearance:none!important;-webkit-appearance:none!important;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b8f98' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")!important;background-repeat:no-repeat!important;background-position:right 12px center!important;background-size:14px!important}.dl-savebar{position:fixed;left:50%;bottom:24px;transform:translate(-50%,160%);opacity:0;transition:transform .25s cubic-bezier(.2,.8,.2,1),opacity .2s;display:flex;align-items:center;gap:10px;padding:8px 8px 8px 18px;border-radius:999px;background:var(--dl-elevated);border:1px solid var(--dl-line);box-shadow:var(--shadow-2xl, 0 16px 32px -8px rgba(0,0,0,.5));z-index:60;pointer-events:none}.dl-savebar.show{transform:translate(-50%);opacity:1;pointer-events:auto}.dl-savebar-text{display:inline-flex;align-items:center;gap:8px;font-size:13px;font-weight:500}`;var pi=".dl-toast strong{display:block;font-weight:500}.dl-toast div{opacity:.8;font-size:13px}.dl-drawer-overlay{position:fixed;inset:0;z-index:900;display:flex;justify-content:flex-end;background:transparent;transition:background .2s}.dl-drawer-overlay.open{background:var(--scrim, rgba(0,0,0,.45))}.dl-drawer{width:min(520px,100%);height:100%;display:flex;flex-direction:column;background:var(--dialog-bg, var(--dl-elevated));color:var(--dl-fg);border-left:1px solid var(--dl-line);box-shadow:var(--shadow-2xl, -16px 0 32px -8px rgba(0,0,0,.5));transform:translate(100%);transition:transform .22s cubic-bezier(.2,.8,.2,1)}.dl-drawer-overlay.open .dl-drawer{transform:none}.dl-drawer-head{display:flex;align-items:center;gap:12px;padding:16px 20px;border-bottom:1px solid var(--dl-line)}.dl-drawer-title{flex:1;min-width:0;display:flex;align-items:center;gap:12px}.dl-drawer-title h3{margin:0!important;padding:0!important;border:0!important;font-size:18px!important;line-height:26px;font-weight:500!important}.dl-drawer-x{all:unset;cursor:pointer;width:32px;height:32px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;color:var(--dl-fg-muted)}.dl-drawer-x:hover{background:var(--dl-soft);color:var(--dl-fg)}.dl-drawer-body{flex:1;overflow:auto;padding:20px}.dl-drawer-foot{padding:12px 20px;border-top:1px solid var(--dl-line)}.dl-drawer-actions{display:flex;align-items:center;gap:8px}.dl-dcard-ic.on{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-icon-only.sm{width:28px;height:28px!important}.dl-stack.gap12{gap:12px}.dl-stack.gap16{gap:16px}.dl-dstats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));border:1px solid var(--dl-line);border-radius:14px;overflow:hidden}.dl-dstats-cell{display:flex;flex-direction:column;gap:4px;padding:12px 14px;min-width:0}.dl-dstats-cell.wide{grid-column:span 2;border-bottom:1px solid var(--dl-line)}.dl-dstats-cell+.dl-dstats-cell:not(.wide):last-child{border-left:1px solid var(--dl-line)}.dl-dstats-cell b{font-size:16px;font-weight:500;font-variant-numeric:tabular-nums}.dl-dstats-cell .dl-dstat{font-size:14px}.dl-dsec{border:1px solid var(--dl-line);border-radius:14px;padding:16px;display:flex;flex-direction:column;gap:12px}.dl-dsec-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.dl-dsec-head h4{margin:0!important;padding:0!important;font-size:14px!important;font-weight:500!important;border:0!important}.dl-dstat i.dot{width:6px;height:6px;border-radius:50%;background:var(--dl-fg-faint);display:inline-block}.dl-connect-body{min-height:60px}.dl-connect-body .dl-qr{width:min(240px,70vw)}.dl-kv2{display:flex;flex-direction:column}.dl-kvrow{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:9px 0;border-top:1px solid var(--dl-line);font-size:13px;min-width:0}.dl-kvrow:first-child{border-top:0;padding-top:0}.dl-kvrow-k{color:var(--dl-fg-muted);flex:0 0 auto}.dl-kvrow-v{min-width:0;text-align:right;overflow-wrap:anywhere}.dl-kvrow-v.copy{all:unset;cursor:pointer;display:inline-flex;align-items:center;gap:6px;min-width:0;color:var(--dl-fg)}.dl-kvrow-v.copy span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-kvrow-v.copy .dl-icon{width:13px;height:13px;color:var(--dl-fg-faint)}.dl-kvrow-v.copy:hover .dl-icon{color:var(--dl-fg)}@media(max-width:560px){.dl-drawer{width:100%}.dl-dstats{grid-template-columns:minmax(0,1fr)}.dl-dstats-cell.wide{grid-column:auto}.dl-dstats-cell+.dl-dstats-cell:not(.wide):last-child{border-left:0;border-top:1px solid var(--dl-line)}}.dl-dev-log{display:flex;flex-direction:column}.dl-dev-log-row{display:flex;align-items:center;gap:10px;padding:8px 0;border-top:1px solid var(--dl-line);font-size:13px;line-height:20px;min-width:0}.dl-dev-log-row:first-child{border-top:0;padding-top:0}.dl-dev-log-row .dl-row-main{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}";var mi=".dl-settings-main{min-width:0;display:flex;flex-direction:column;gap:20px}.dl-setsec{background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);overflow:hidden;scroll-margin-top:88px;box-shadow:var(--dl-shadow)}.dl-setsec-body{padding:20px;display:flex;flex-direction:column;gap:14px}.dl-setsec-body h3{margin:0!important;padding:0!important;font-size:18px!important;line-height:26px;font-weight:500!important;border:0!important}.dl-setsec-body p{margin:0}.dl-setsec-head{display:flex;align-items:center;gap:10px}.dl-group{border:1px solid var(--dl-line);border-radius:14px;padding:2px 16px}.dl-group-head{display:flex;align-items:center;gap:12px;padding:14px 0 10px}.dl-group-head b{font-size:15px;font-weight:500}.dl-group-ic{width:32px;height:32px;border-radius:10px;background:var(--dl-soft);color:var(--dl-fg-muted);display:inline-flex;align-items:center;justify-content:center;flex:none}.dl-group-ic .dl-icon-wrap{display:inline-flex}.dl-group-ic .dl-icon{width:16px;height:16px}.dl-group-body>*{padding:12px 0;margin:0!important}.dl-group-body>*+*:not(.alert-message):not(.dl-params){border-top:1px solid var(--dl-line)}.dl-group-body>.alert-message,.dl-group-body>.dl-params{margin:12px 0!important}.dl-group-body>.alert-message{padding:10px 14px}.dl-group-body>.dl-params{padding:0}.dl-group-body>.alert-message+*,.dl-group-body>.dl-params+*{border-top:0}.dl-group-body>.dl-row{border-left:0;border-right:0;border-bottom:0;padding-left:0;padding-right:0;background:none}.dl-group-body>.dl-row:first-child{border-top:0}.dl-setsec-foot{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px 16px;padding:12px 20px;border-top:1px solid var(--dl-line);background:var(--dl-soft)}.dl-setsec.danger{border-color:color-mix(in srgb,var(--dl-bad) 40%,transparent)}.dl-setsec.danger .dl-setsec-foot{background:color-mix(in srgb,var(--dl-bad) 6%,transparent)}.dl-setrow{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,420px);align-items:center;gap:8px 24px}.dl-setrow.head{display:flex;justify-content:space-between;gap:16px}.dl-setrow-label{font-size:14px;font-weight:500}.dl-setrow-ctl{display:flex;justify-content:flex-end;min-width:0}.dl-setrow-ctl .dl-chips-row{justify-content:flex-end}.dl-setrow-ctl>input{width:100%}.dl-hostport{display:flex;align-items:center;gap:8px;flex:1;min-width:0;justify-content:flex-end}.dl-hostport input{flex:1;min-width:0}.dl-root input.dl-w-port,.dl-hostport input.dl-w-port{flex:0 0 90px;width:90px}.dl-root input.dl-w-range{flex:0 0 130px;width:130px}.dl-setrow .dl-sub.bad{color:var(--dl-bad)}.dl-suffixed{display:inline-flex;align-items:center;gap:6px}.dl-suffixed>span{color:var(--dl-fg-muted)}.dl-more summary{cursor:pointer;color:var(--dl-fg-muted);font-size:13px;margin-bottom:10px}.dl-more .dl-setrow+.dl-setrow{margin-top:10px}@media(max-width:760px){.dl-setrow:not(.head){grid-template-columns:minmax(0,1fr)}.dl-setrow-ctl,.dl-setrow-ctl .dl-chips-row{justify-content:flex-start}}.dl-need-ic{width:30px;height:30px;border-radius:9px;background:var(--dl-soft);color:var(--dl-fg-muted);display:inline-flex;align-items:center;justify-content:center;flex:none}.dl-need-ic .dl-icon-wrap{display:inline-flex}.dl-need-ic .dl-icon{width:15px;height:15px}.dl-need-row.bad .dl-need-ic,.dl-need-ic.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-need-row.warn .dl-need-ic,.dl-need-ic.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-need-ic.ok{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-lh-main{display:flex;align-items:flex-start;gap:12px;min-width:0}.dl-lh-main>.dl-need-ic{margin-top:1px}.dl-sub .dl-mono{font-size:.92em}.dl-need-row>.cbi-button{flex:none}.dl-bk-row .dl-group-ic{width:30px;height:30px}.dl-bk-older>summary{list-style:none;cursor:pointer;display:flex;align-items:center;gap:8px;padding:11px 16px;border-top:1px solid var(--dl-line);font-size:13px;color:var(--dl-fg-muted);user-select:none}.dl-bk-older>summary::-webkit-details-marker{display:none}.dl-bk-older>summary:hover{background:var(--dl-soft);color:var(--dl-fg)}.dl-bk-older>summary .dl-icon-wrap{display:inline-flex;transition:transform .15s}.dl-bk-older>summary .dl-icon{width:14px;height:14px}.dl-bk-older[open]>summary .dl-icon-wrap{transform:rotate(90deg)}#dl-set-backups .dl-setsec-head h3+.dl-sub{margin-top:2px}#dl-set-backups .dl-setsec-foot>.dl-sub{flex:1 1 260px}.dl-bk-actions{flex:0 1 auto;justify-content:flex-end}@media(max-width:640px){#dl-set-backups .dl-setsec-foot>.dl-sub{flex-basis:100%}.dl-bk-actions{justify-content:flex-start}}.dl-upd{display:flex;flex-direction:column;gap:16px}.dl-upd>.dl-pagehead{margin:0 0 4px}.dl-upd-bad{color:var(--dl-bad)}";var hi=".dl-comp-hero{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(0,1fr)}.dl-comp-hero-main{padding:20px;display:flex;flex-direction:column;gap:12px;min-width:0}.dl-comp-hero-side{padding:20px;border-left:1px solid var(--dl-line);display:flex;flex-direction:column;gap:14px;min-width:0}.dl-comp-name{font-size:16px;font-weight:500}.dl-comp-hero-head{display:flex;align-items:center;gap:10px;flex-wrap:wrap;min-width:0}.dl-comp-hero-head .dl-spacer{flex:1}.dl-comp-big{font-family:var(--dl-mono);font-size:26px;line-height:34px;letter-spacing:-.02em;display:flex;align-items:baseline;gap:10px}.dl-comp-big small{font-size:14px;color:var(--dl-accent)}.dl-comp-big small.dl-faint{color:var(--dl-fg-faint)}.dl-comp-verrow{display:flex;align-items:center;gap:4px 12px;flex-wrap:wrap;min-width:0}.dl-comp-verrow .dl-spacer{flex:1}.dl-comp-meta{font-size:13px}.dl-comp-bullets{margin:0;padding-left:18px;display:flex;flex-direction:column;gap:4px;color:var(--dl-fg-muted);font-size:13px}.dl-comp-bullets li{list-style:disc}.dl-comp-lead{margin:0}.dl-comp-more{align-self:flex-start;font-size:12px;color:var(--dl-fg-faint);margin-left:18px;padding:0!important}.dl-comp-more:hover{color:var(--dl-accent);background:none!important;text-decoration:underline;text-underline-offset:2px}.dl-comp-hero-main>.dl-comp-vers{margin-top:auto}.dl-comp-btns{display:flex;gap:8px;flex-wrap:nowrap;align-items:center;flex:none}.dl-comp-side-v{display:flex;align-items:center;gap:8px;font-size:14px;min-width:0;flex-wrap:wrap}.dl-comp-side-v .dl-icon{width:15px;height:15px;color:var(--dl-fg-muted)}.dl-comp-side-v a{color:inherit;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-comp-side-v a:hover{color:var(--dl-accent)}.dl-comp-cols{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(0,1fr);gap:16px;align-items:start}.dl-comp-cols>.dl-panel>div>.dl-row:first-child{border-top:1px solid var(--dl-line)}.dl-comp-count{font-size:13px}.dl-comp-sub{font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-comp-ic{display:inline-flex;gap:4px;flex:none}.dl-comp-ic .cbi-button{width:30px;height:30px;padding:0!important;justify-content:center;border-radius:999px!important}.dl-comp-ic .dl-btn-label{display:none}.dl-comp-ic .dl-icon{width:14px;height:14px}.dl-comp-ic .is-busy{pointer-events:none;opacity:.5}.dl-comp-ic .cbi-button.dl-comp-check{width:auto;padding:0 12px 0 10px!important;gap:6px;display:inline-flex;align-items:center;font-size:13px}.dl-row>.dl-pill,.dl-row>.cbi-button,.dl-row>.dl-comp-ic{flex:none}button.dl-pill.dl-comp-run{all:unset;display:inline-flex;align-items:center;height:20px;padding:0 8px;border-radius:999px;font-size:12px;cursor:pointer;background:color-mix(in srgb,var(--dl-accent) 14%,transparent);color:var(--dl-accent)}.dl-comp-foldwrap{padding:0 16px 14px 60px}.dl-comp-fold .dl-params-body{gap:12px}.dl-comp-fold .dl-list>.dl-row{padding:10px 14px}.dl-comp-bver{font-size:12px;width:130px;text-align:right;flex:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-comp-bact{width:84px;flex:none;display:flex;justify-content:flex-end}.dl-comp-warn{display:flex;align-items:flex-start;gap:8px;font-size:12px;line-height:18px;color:var(--dl-fg-muted)}.dl-comp-warn .dl-icon-wrap{display:inline-flex;flex:none;margin-top:2px}.dl-comp-warn .dl-icon{width:14px;height:14px;color:var(--dl-warn)}.dl-comp-empty{margin:0;padding:4px 16px 16px}@media(max-width:760px){.dl-comp-hero,.dl-comp-cols{grid-template-columns:minmax(0,1fr)}.dl-comp-hero-side{border-left:0;border-top:1px solid var(--dl-line)}.dl-comp-foldwrap{padding-left:16px}.dl-comp-bver{display:none}}.dl-comp-status{display:flex;align-items:center;gap:8px;font-size:13px;padding:9px 12px;border-radius:10px;background:var(--dl-soft);min-width:0}.dl-comp-status>.dl-icon-wrap{display:inline-flex;flex:none}.dl-comp-status .dl-icon{width:15px;height:15px}.dl-comp-status.ok{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-comp-status.acc{background:color-mix(in srgb,var(--dl-accent) 12%,transparent);color:var(--dl-accent)}.dl-comp-status.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-comp-status.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-comp-status b{font-weight:600}.dl-comp-vers .dl-params-body{gap:0;padding:4px 14px 12px}.dl-comp-tag{display:flex;gap:6px;padding:6px 0 10px}.dl-comp-tag input{flex:1;min-width:0}.dl-comp-ver{display:flex;align-items:center;gap:8px;padding:7px 0;border-top:1px solid var(--dl-line);font-size:13px}.dl-comp-ver .dl-mono{min-width:52px}.dl-comp-ver .dl-sub{flex:1}.dl-comp-ver .cbi-button:not(.dl-icon-btn){height:26px!important;font-size:12px!important}.dl-comp-pager{display:flex;align-items:center;justify-content:space-between;padding-top:10px;border-top:1px solid var(--dl-line);font-size:12px}.dl-comp-pager .dl-linkbtn[disabled]{opacity:.4;cursor:default}.dl-comp-vers .dl-loading,.dl-comp-vers .dl-params-body>p{padding:6px 0 10px}.dl-op-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:14px}.dl-op-head .dl-spacer{flex:1}.dl-op-timer{display:inline-flex;align-items:center;gap:5px;font-variant-numeric:tabular-nums}.dl-op-timer .dl-icon,.dl-op-head .dl-linkbtn .dl-icon{width:14px;height:14px}.dl-op-loghead{display:flex;align-items:center;justify-content:space-between}.dl-op-loghead b{font-weight:500;font-size:13px}.dl-op .dl-log{max-height:16em;min-height:12em;margin-top:8px}.dl-op .dl-comp-status{margin:14px 0 0}.dl-op-actions{display:flex;gap:8px;justify-content:flex-end;flex-wrap:wrap;width:100%}.dl-notes{max-height:55vh;overflow:auto;border-radius:12px;background:var(--dl-soft);padding:14px 16px;font-size:13px;line-height:20px;overflow-wrap:anywhere}.dl-notes h5{margin:10px 0 6px;font-size:14px;font-weight:500}.dl-notes h5:first-child{margin-top:0}.dl-notes p{margin:0 0 8px}.dl-notes ul{margin:0 0 10px;padding-left:18px}.dl-notes li{list-style:disc}.dl-notes code{font-family:var(--dl-mono);font-size:12px;padding:1px 5px;border-radius:6px;background:var(--dl-soft-hover)}.dl-notes pre{font-family:var(--dl-mono);font-size:12px;padding:10px;border-radius:8px;background:var(--dl-soft-hover);white-space:pre-wrap;margin:0 0 10px}.dl-notes a{color:var(--dl-accent)}";var fi=".dl-chip.static{cursor:default}.dl-chip.static:hover{background:var(--dl-soft)}.dl-chip.static .dl-chip-name{font-weight:500}.dl-setrow.head .dl-chips-row{margin-top:8px}.dl-setrow.head>.dl-lh-main,.dl-setrow.head>.dl-lh-main>.dl-stack{flex:1 1 auto;min-width:0}.dl-setrow.head>.dl-setrow-ctl:empty{display:none}.dl-setrow.head:has(>.dl-lh-main){align-items:flex-start}.dl-setrow.head>.dl-setrow-ctl{align-items:center;min-height:30px}.dl-netpick{margin-top:10px}.dl-boxrow{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:0;padding:10px 14px;border:1px solid var(--dl-line);border-radius:12px;font-size:13px;cursor:pointer}.dl-boxrow>.dl-switch{flex:none}.dl-ifpick{display:flex;flex-direction:column;gap:12px;padding:14px;border:1px solid var(--dl-line);border-radius:14px}.dl-iflead-row{display:flex;align-items:center;justify-content:space-between;gap:12px}.dl-host-ports{justify-content:flex-end}@media(max-width:760px){.dl-host-ports{justify-content:flex-start}}.dl-circle-dot{display:inline-block;width:8px;height:8px;border-radius:50%;flex:none}.dl-circles .dl-chip b{font-weight:500}.dl-circle-name{display:inline-flex;align-items:center;gap:8px;font-size:14px;font-weight:500}.dl-w400{font-weight:400}.dl-swatches{display:flex;flex-wrap:wrap;gap:8px}.dl-swatch{all:unset;cursor:pointer;width:22px;height:22px;border-radius:50%;background:var(--sw);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--dl-fg) 12%,transparent)}.dl-swatch.on{box-shadow:0 0 0 2px var(--dl-card),0 0 0 4px var(--sw)}.dl-swatch:focus-visible{outline:2px solid var(--dl-ring);outline-offset:3px}.dl-circle-modal .dl-chipbtn b{margin-left:6px;font-weight:500;font-size:11px;opacity:.6}.dl-reach td:first-child b{font-weight:500}.dl-ev-host{white-space:nowrap}.dl-ev-host b{font-weight:500;color:var(--dl-fg)}.dl-reach{font-size:13px}.dl-reach th,.dl-reach td{white-space:nowrap;padding-left:6px;padding-right:6px}.dl-reach-wrap{overflow-x:auto}.dl-yes{display:inline-flex;align-items:center;gap:4px;color:var(--dl-ok)}.dl-yes .dl-icon-wrap{display:inline-flex}.dl-yes .dl-icon{width:14px;height:14px}.dl-check-form{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr) auto;align-items:start;gap:8px}.dl-check-form>.dl-faint{line-height:36px}.dl-check-end{display:flex;flex-direction:column;gap:6px;min-width:0}.dl-check-end>*{width:100%!important;min-width:0}@media(max-width:560px){.dl-check-form{grid-template-columns:minmax(0,1fr)}.dl-check-form>.dl-faint{display:none}}.dl-verdict{display:flex;align-items:baseline;gap:10px;padding:10px 12px;border-radius:12px}.dl-verdict b{font-weight:500}.dl-verdict.ok{background:var(--dl-ok-wash)}.dl-verdict.ok b{color:var(--dl-ok)}.dl-verdict.bad{background:var(--dl-bad-wash)}.dl-verdict.bad b{color:var(--dl-bad)}.dl-corehead{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:0 0 4px}.dl-corehead h3{margin:0!important}.dl-row-end{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.dl-dcard.clickable{cursor:pointer}.dl-dcard.clickable:hover{border-color:color-mix(in srgb,var(--dl-fg) 22%,transparent)}";var Cl=[ei,ti,ni,oi,ri,ai,ii,si,li,di,ci,pi,mi,hi,fi].join(`
`);function gi(){let n=document.createElement("style");return n.dataset.dawnline="1",n.textContent=Cl,n}function ht(n){return()=>{let e=new n;return Object.assign({load:()=>e.load(),render:async o=>{let a=await e.render(o),i=document.createElement("div");return i.className="dl-root",i.append(gi(),a),i},addFooter(){return e.noFooter?document.createElement("div"):this.super("addFooter",[])}},{handleSave:null,handleSaveApply:null,handleReset:null})}}var v1=ht(Zt),b1=ht(mt),x1=ht(Zt),w1=ht(Hn),y1=ht(Rn),k1=ht(jn),$1=ht(Nn);function vi(n){return()=>({load:()=>(ui.menu?.flushCache(),location.replace(`${L.url("admin/network/dawnline/diagnostics")}${n?`?tab=${n}`:""}`),new Promise(()=>{})),render:()=>document.createElement("div"),handleSave:null,handleSaveApply:null,handleReset:null})}var C1=vi(""),E1=vi("log");return baseclass.extend({ activity: E1, diagnostics: k1, health: C1, overview: v1, people: b1, person: y1, server: x1, settings: w1, updates: $1 });