Compare commits

2 Commits
Author SHA1 Message Date
Aemeath db9657c01c Dawnline 0.12.1
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
- Device cards on a computer keep "↓ 3.2 GB ↑ 557 MB" on one line, clear of
  the week's bars (0.12.0 let them run together in the two columns). A
  narrow card gets slightly smaller numbers and thinner bars, with the bars
  in the middle of the row; resizing the window, the card glides between
  its two shapes
- A device whose settings changed shows one big Reconnect button, the same
  as Connect on a device not set up yet, in place of its week and the
  orange Update pill. It opens the same question as Reconnect in the ⋯ menu
2026-10-20 21:54:42 +03:00
Aemeath fb73ac3a9f Dawnline 0.12.0
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
- The portal's traffic charts show what came down and what went up apart.
  A device's last 7 days and "Data this month" draw each day both ways:
  downloads rise above a thin line, uploads hang below it, on one scale.
  Beside them "↓ 3.2 GB ↑ 557 MB" instead of one total; hover a day for
  its own, its date where "left" stands
- Charts answer the pointer between their bars too, in the portal and in
  the admin's daily charts (a device's week, a device card's 30 days, the
  last 30 days): the figures no longer blink back to the total
- The calendar under "Access until" plays its days in only when the row is
  opened, not again each time the page refreshes with it open
- On a phone the page comes in from the top down: "Your access" first,
  then the devices
- "Show key" on a router's set-up morphs to "Hide key" with its icon, and
  brings the keys themselves into focus (it blurred the field names)
2026-10-20 20:58:36 +03:00
33 changed files with 516 additions and 275 deletions

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-dawnline PKG_NAME:=luci-app-dawnline
PKG_VERSION:=0.11.0 PKG_VERSION:=0.12.1
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_LICENSE:=MIT PKG_LICENSE:=MIT
# po/<lang>/dawnline.po becomes luci-i18n-dawnline-<lang> (luci.mk), released # po/<lang>/dawnline.po becomes luci-i18n-dawnline-<lang> (luci.mk), released
@@ -5,27 +5,27 @@
'require poll'; 'require poll';
'require rpc'; 'require rpc';
'require ui'; 'require ui';
var Ha=Object.create;var Go=Object.defineProperty;var za=Object.getOwnPropertyDescriptor;var Ra=Object.getOwnPropertyNames;var Ia=Object.getPrototypeOf,Ba=Object.prototype.hasOwnProperty;var Oa=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var ja=(n,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ra(e))!Ba.call(n,r)&&r!==o&&Go(n,r,{get:()=>e[r],enumerable:!(s=za(e,r))||s.enumerable});return n};var Ua=(n,e,o)=>(o=n!=null?Ha(Ia(n)):{},ja(e||!n||!n.__esModule?Go(o,"default",{value:n,enumerable:!0}):o,n));var os=Oa((ts,ns)=>{"use strict";var es=(function(){var n=function(S,$){var b=236,C=17,w=S,z=o[$],y=null,f=0,x=null,T=[],I={},Y=function(R,O){f=w*4+17,y=(function(P){for(var U=new Array(P),D=0;D<P;D+=1){U[D]=new Array(P);for(var G=0;G<P;G+=1)U[D][G]=null}return U})(f),J(0,0),J(f-7,0),J(0,f-7),Q(),B(),fe(R,O),w>=7&&ne(R),x==null&&(x=V(w,z,T)),se(x,O)},J=function(R,O){for(var P=-1;P<=7;P+=1)if(!(R+P<=-1||f<=R+P))for(var U=-1;U<=7;U+=1)O+U<=-1||f<=O+U||(0<=P&&P<=6&&(U==0||U==6)||0<=U&&U<=6&&(P==0||P==6)||2<=P&&P<=4&&2<=U&&U<=4?y[R+P][O+U]=!0:y[R+P][O+U]=!1)},te=function(){for(var R=0,O=0,P=0;P<8;P+=1){Y(!0,P);var U=r.getLostPoint(I);(P==0||R>U)&&(R=U,O=P)}return O},B=function(){for(var R=8;R<f-8;R+=1)y[R][6]==null&&(y[R][6]=R%2==0);for(var O=8;O<f-8;O+=1)y[6][O]==null&&(y[6][O]=O%2==0)},Q=function(){for(var R=r.getPatternPosition(w),O=0;O<R.length;O+=1)for(var P=0;P<R.length;P+=1){var U=R[O],D=R[P];if(y[U][D]==null)for(var G=-2;G<=2;G+=1)for(var ee=-2;ee<=2;ee+=1)G==-2||G==2||ee==-2||ee==2||G==0&&ee==0?y[U+G][D+ee]=!0:y[U+G][D+ee]=!1}},ne=function(R){for(var O=r.getBCHTypeNumber(w),P=0;P<18;P+=1){var U=!R&&(O>>P&1)==1;y[Math.floor(P/3)][P%3+f-8-3]=U}for(var P=0;P<18;P+=1){var U=!R&&(O>>P&1)==1;y[P%3+f-8-3][Math.floor(P/3)]=U}},fe=function(R,O){for(var P=z<<3|O,U=r.getBCHTypeInfo(P),D=0;D<15;D+=1){var G=!R&&(U>>D&1)==1;D<6?y[D][8]=G:D<8?y[D+1][8]=G:y[f-15+D][8]=G}for(var D=0;D<15;D+=1){var G=!R&&(U>>D&1)==1;D<8?y[8][f-D-1]=G:D<9?y[8][15-D-1+1]=G:y[8][15-D-1]=G}y[f-8][8]=!R},se=function(R,O){for(var P=-1,U=f-1,D=7,G=0,ee=r.getMaskFunction(O),X=f-1;X>0;X-=2)for(X==6&&(X-=1);;){for(var be=0;be<2;be+=1)if(y[U][X-be]==null){var Le=!1;G<R.length&&(Le=(R[G]>>>D&1)==1);var re=ee(U,X-be);re&&(Le=!Le),y[U][X-be]=Le,D-=1,D==-1&&(G+=1,D=7)}if(U+=P,U<0||f<=U){U-=P,P=-P;break}}},j=function(R,O){for(var P=0,U=0,D=0,G=new Array(O.length),ee=new Array(O.length),X=0;X<O.length;X+=1){var be=O[X].dataCount,Le=O[X].totalCount-be;U=Math.max(U,be),D=Math.max(D,Le),G[X]=new Array(be);for(var re=0;re<G[X].length;re+=1)G[X][re]=255&R.getBuffer()[re+P];P+=be;var Ie=r.getErrorCorrectPolynomial(Le),Be=i(G[X],Ie.getLength()-1),jo=Be.mod(Ie);ee[X]=new Array(Ie.getLength()-1);for(var re=0;re<ee[X].length;re+=1){var Uo=re+jo.getLength()-ee[X].length;ee[X][re]=Uo>=0?jo.getAt(Uo):0}}for(var Wo=0,re=0;re<O.length;re+=1)Wo+=O[re].totalCount;for(var Vn=new Array(Wo),rn=0,re=0;re<U;re+=1)for(var X=0;X<O.length;X+=1)re<G[X].length&&(Vn[rn]=G[X][re],rn+=1);for(var re=0;re<D;re+=1)for(var X=0;X<O.length;X+=1)re<ee[X].length&&(Vn[rn]=ee[X][re],rn+=1);return Vn},V=function(R,O,P){for(var U=l.getRSBlocks(R,O),D=d(),G=0;G<P.length;G+=1){var ee=P[G];D.put(ee.getMode(),4),D.put(ee.getLength(),r.getLengthInBits(ee.getMode(),R)),ee.write(D)}for(var X=0,G=0;G<U.length;G+=1)X+=U[G].dataCount;if(D.getLengthInBits()>X*8)throw"code length overflow. ("+D.getLengthInBits()+">"+X*8+")";for(D.getLengthInBits()+4<=X*8&&D.put(0,4);D.getLengthInBits()%8!=0;)D.putBit(!1);for(;!(D.getLengthInBits()>=X*8||(D.put(b,8),D.getLengthInBits()>=X*8));)D.put(C,8);return j(D,U)};I.addData=function(R,O){O=O||"Byte";var P=null;switch(O){case"Numeric":P=c(R);break;case"Alphanumeric":P=p(R);break;case"Byte":P=u(R);break;case"Kanji":P=k(R);break;default:throw"mode:"+O}T.push(P),x=null},I.isDark=function(R,O){if(R<0||f<=R||O<0||f<=O)throw R+","+O;return y[R][O]},I.getModuleCount=function(){return f},I.make=function(){if(w<1){for(var R=1;R<40;R++){for(var O=l.getRSBlocks(R,z),P=d(),U=0;U<T.length;U++){var D=T[U];P.put(D.getMode(),4),P.put(D.getLength(),r.getLengthInBits(D.getMode(),R)),D.write(P)}for(var G=0,U=0;U<O.length;U++)G+=O[U].dataCount;if(P.getLengthInBits()<=G*8)break}w=R}Y(!1,te())},I.createTableTag=function(R,O){R=R||2,O=typeof O>"u"?R*4:O;var P="";P+='<table style="',P+=" border-width: 0px; border-style: none;",P+=" border-collapse: collapse;",P+=" padding: 0px; margin: "+O+"px;",P+='">',P+="<tbody>";for(var U=0;U<I.getModuleCount();U+=1){P+="<tr>";for(var D=0;D<I.getModuleCount();D+=1)P+='<td style="',P+=" border-width: 0px; border-style: none;",P+=" border-collapse: collapse;",P+=" padding: 0px; margin: 0px;",P+=" width: "+R+"px;",P+=" height: "+R+"px;",P+=" background-color: ",P+=I.isDark(U,D)?"#000000":"#ffffff",P+=";",P+='"/>';P+="</tr>"}return P+="</tbody>",P+="</table>",P},I.createSvgTag=function(R,O,P,U){var D={};typeof arguments[0]=="object"&&(D=arguments[0],R=D.cellSize,O=D.margin,P=D.alt,U=D.title),R=R||2,O=typeof O>"u"?R*4:O,P=typeof P==Line truncated var Ha=Object.create;var Go=Object.defineProperty;var za=Object.getOwnPropertyDescriptor;var Ra=Object.getOwnPropertyNames;var Ia=Object.getPrototypeOf,Ba=Object.prototype.hasOwnProperty;var Oa=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var ja=(n,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ra(e))!Ba.call(n,r)&&r!==o&&Go(n,r,{get:()=>e[r],enumerable:!(s=za(e,r))||s.enumerable});return n};var Ua=(n,e,o)=>(o=n!=null?Ha(Ia(n)):{},ja(e||!n||!n.__esModule?Go(o,"default",{value:n,enumerable:!0}):o,n));var os=Oa((ts,ns)=>{"use strict";var es=(function(){var n=function(S,$){var b=236,C=17,y=S,z=o[$],k=null,f=0,x=null,T=[],I={},V=function(R,O){f=y*4+17,k=(function(P){for(var U=new Array(P),D=0;D<P;D+=1){U[D]=new Array(P);for(var G=0;G<P;G+=1)U[D][G]=null}return U})(f),J(0,0),J(f-7,0),J(0,f-7),Q(),B(),fe(R,O),y>=7&&ne(R),x==null&&(x=Y(y,z,T)),oe(x,O)},J=function(R,O){for(var P=-1;P<=7;P+=1)if(!(R+P<=-1||f<=R+P))for(var U=-1;U<=7;U+=1)O+U<=-1||f<=O+U||(0<=P&&P<=6&&(U==0||U==6)||0<=U&&U<=6&&(P==0||P==6)||2<=P&&P<=4&&2<=U&&U<=4?k[R+P][O+U]=!0:k[R+P][O+U]=!1)},te=function(){for(var R=0,O=0,P=0;P<8;P+=1){V(!0,P);var U=r.getLostPoint(I);(P==0||R>U)&&(R=U,O=P)}return O},B=function(){for(var R=8;R<f-8;R+=1)k[R][6]==null&&(k[R][6]=R%2==0);for(var O=8;O<f-8;O+=1)k[6][O]==null&&(k[6][O]=O%2==0)},Q=function(){for(var R=r.getPatternPosition(y),O=0;O<R.length;O+=1)for(var P=0;P<R.length;P+=1){var U=R[O],D=R[P];if(k[U][D]==null)for(var G=-2;G<=2;G+=1)for(var ee=-2;ee<=2;ee+=1)G==-2||G==2||ee==-2||ee==2||G==0&&ee==0?k[U+G][D+ee]=!0:k[U+G][D+ee]=!1}},ne=function(R){for(var O=r.getBCHTypeNumber(y),P=0;P<18;P+=1){var U=!R&&(O>>P&1)==1;k[Math.floor(P/3)][P%3+f-8-3]=U}for(var P=0;P<18;P+=1){var U=!R&&(O>>P&1)==1;k[P%3+f-8-3][Math.floor(P/3)]=U}},fe=function(R,O){for(var P=z<<3|O,U=r.getBCHTypeInfo(P),D=0;D<15;D+=1){var G=!R&&(U>>D&1)==1;D<6?k[D][8]=G:D<8?k[D+1][8]=G:k[f-15+D][8]=G}for(var D=0;D<15;D+=1){var G=!R&&(U>>D&1)==1;D<8?k[8][f-D-1]=G:D<9?k[8][15-D-1+1]=G:k[8][15-D-1]=G}k[f-8][8]=!R},oe=function(R,O){for(var P=-1,U=f-1,D=7,G=0,ee=r.getMaskFunction(O),X=f-1;X>0;X-=2)for(X==6&&(X-=1);;){for(var be=0;be<2;be+=1)if(k[U][X-be]==null){var Le=!1;G<R.length&&(Le=(R[G]>>>D&1)==1);var re=ee(U,X-be);re&&(Le=!Le),k[U][X-be]=Le,D-=1,D==-1&&(G+=1,D=7)}if(U+=P,U<0||f<=U){U-=P,P=-P;break}}},j=function(R,O){for(var P=0,U=0,D=0,G=new Array(O.length),ee=new Array(O.length),X=0;X<O.length;X+=1){var be=O[X].dataCount,Le=O[X].totalCount-be;U=Math.max(U,be),D=Math.max(D,Le),G[X]=new Array(be);for(var re=0;re<G[X].length;re+=1)G[X][re]=255&R.getBuffer()[re+P];P+=be;var Ie=r.getErrorCorrectPolynomial(Le),Be=i(G[X],Ie.getLength()-1),jo=Be.mod(Ie);ee[X]=new Array(Ie.getLength()-1);for(var re=0;re<ee[X].length;re+=1){var Uo=re+jo.getLength()-ee[X].length;ee[X][re]=Uo>=0?jo.getAt(Uo):0}}for(var Wo=0,re=0;re<O.length;re+=1)Wo+=O[re].totalCount;for(var Vn=new Array(Wo),rn=0,re=0;re<U;re+=1)for(var X=0;X<O.length;X+=1)re<G[X].length&&(Vn[rn]=G[X][re],rn+=1);for(var re=0;re<D;re+=1)for(var X=0;X<O.length;X+=1)re<ee[X].length&&(Vn[rn]=ee[X][re],rn+=1);return Vn},Y=function(R,O,P){for(var U=l.getRSBlocks(R,O),D=d(),G=0;G<P.length;G+=1){var ee=P[G];D.put(ee.getMode(),4),D.put(ee.getLength(),r.getLengthInBits(ee.getMode(),R)),ee.write(D)}for(var X=0,G=0;G<U.length;G+=1)X+=U[G].dataCount;if(D.getLengthInBits()>X*8)throw"code length overflow. ("+D.getLengthInBits()+">"+X*8+")";for(D.getLengthInBits()+4<=X*8&&D.put(0,4);D.getLengthInBits()%8!=0;)D.putBit(!1);for(;!(D.getLengthInBits()>=X*8||(D.put(b,8),D.getLengthInBits()>=X*8));)D.put(C,8);return j(D,U)};I.addData=function(R,O){O=O||"Byte";var P=null;switch(O){case"Numeric":P=c(R);break;case"Alphanumeric":P=p(R);break;case"Byte":P=u(R);break;case"Kanji":P=w(R);break;default:throw"mode:"+O}T.push(P),x=null},I.isDark=function(R,O){if(R<0||f<=R||O<0||f<=O)throw R+","+O;return k[R][O]},I.getModuleCount=function(){return f},I.make=function(){if(y<1){for(var R=1;R<40;R++){for(var O=l.getRSBlocks(R,z),P=d(),U=0;U<T.length;U++){var D=T[U];P.put(D.getMode(),4),P.put(D.getLength(),r.getLengthInBits(D.getMode(),R)),D.write(P)}for(var G=0,U=0;U<O.length;U++)G+=O[U].dataCount;if(P.getLengthInBits()<=G*8)break}y=R}V(!1,te())},I.createTableTag=function(R,O){R=R||2,O=typeof O>"u"?R*4:O;var P="";P+='<table style="',P+=" border-width: 0px; border-style: none;",P+=" border-collapse: collapse;",P+=" padding: 0px; margin: "+O+"px;",P+='">',P+="<tbody>";for(var U=0;U<I.getModuleCount();U+=1){P+="<tr>";for(var D=0;D<I.getModuleCount();D+=1)P+='<td style="',P+=" border-width: 0px; border-style: none;",P+=" border-collapse: collapse;",P+=" padding: 0px; margin: 0px;",P+=" width: "+R+"px;",P+=" height: "+R+"px;",P+=" background-color: ",P+=I.isDark(U,D)?"#000000":"#ffffff",P+=";",P+='"/>';P+="</tr>"}return P+="</tbody>",P+="</table>",P},I.createSvgTag=function(R,O,P,U){var D={};typeof arguments[0]=="object"&&(D=arguments[0],R=D.cellSize,O=D.margin,P=D.alt,U=D.title),R=R||2,O=typeof O>"u"?R*4:O,P=typeof P==Line truncated
`}return P%2&&R>0?Be.substring(0,Be.length-P-1)+Array(P+1).join("▀"):Be.substring(0,Be.length-1)};return I.createASCII=function(R,O){if(R=R||1,R<2)return ve(O);R-=1,O=typeof O>"u"?R*2:O;var P=I.getModuleCount()*R+O*2,U=O,D=P-O,G,ee,X,be,Le=Array(R+1).join("██"),re=Array(R+1).join(" "),Ie="",Be="";for(G=0;G<P;G+=1){for(X=Math.floor((G-U)/R),Be="",ee=0;ee<P;ee+=1)be=1,U<=ee&&ee<D&&U<=G&&G<D&&I.isDark(X,Math.floor((ee-U)/R))&&(be=0),Be+=be?Le:re;for(X=0;X<R;X+=1)Ie+=Be+` `}return P%2&&R>0?Be.substring(0,Be.length-P-1)+Array(P+1).join("▀"):Be.substring(0,Be.length-1)};return I.createASCII=function(R,O){if(R=R||1,R<2)return ve(O);R-=1,O=typeof O>"u"?R*2:O;var P=I.getModuleCount()*R+O*2,U=O,D=P-O,G,ee,X,be,Le=Array(R+1).join("██"),re=Array(R+1).join(" "),Ie="",Be="";for(G=0;G<P;G+=1){for(X=Math.floor((G-U)/R),Be="",ee=0;ee<P;ee+=1)be=1,U<=ee&&ee<D&&U<=G&&G<D&&I.isDark(X,Math.floor((ee-U)/R))&&(be=0),Be+=be?Le:re;for(X=0;X<R;X+=1)Ie+=Be+`
`}return Ie.substring(0,Ie.length-1)},I.renderTo2dContext=function(R,O){O=O||2;for(var P=I.getModuleCount(),U=0;U<P;U++)for(var D=0;D<P;D++)R.fillStyle=I.isDark(U,D)?"black":"white",R.fillRect(U*O,D*O,O,O)},I};n.stringToBytesFuncs={default:function(S){for(var $=[],b=0;b<S.length;b+=1){var C=S.charCodeAt(b);$.push(C&255)}return $}},n.stringToBytes=n.stringToBytesFuncs.default,n.createStringToBytes=function(S,$){var b=(function(){for(var w=h(S),z=function(){var B=w.read();if(B==-1)throw"eof";return B},y=0,f={};;){var x=w.read();if(x==-1)break;var T=z(),I=z(),Y=z(),J=String.fromCharCode(x<<8|T),te=I<<8|Y;f[J]=te,y+=1}if(y!=$)throw y+" != "+$;return f})(),C=63;return function(w){for(var z=[],y=0;y<w.length;y+=1){var f=w.charCodeAt(y);if(f<128)z.push(f);else{var x=b[w.charAt(y)];typeof x=="number"?(x&255)==x?z.push(x):(z.push(x>>>8),z.push(x&255)):z.push(C)}}return z}};var e={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},o={L:1,M:0,Q:3,H:2},s={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},r=(function(){var S=[[],[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]],$=1335,b=7973,C=21522,w={},z=function(y){for(var f=0;y!=0;)f+=1,y>>>=1;return f};return w.getBCHTypeInfo=function(y){for(var f=y<<10;z(f)-z($)>=0;)f^=$<<z(f)-z($);return(y<<10|f)^C},w.getBCHTypeNumber=function(y){for(var f=y<<12;z(f)-z(b)>=0;)f^=b<<z(f)-z(b);return y<<12|f},w.getPatternPosition=function(y){return S[y-1]},w.getMaskFunction=function(y){switch(y){case s.PATTERN000:return function(f,x){return(f+x)%2==0};case s.PATTERN001:return function(f,x){return f%2==0};case s.PATTERN010:return function(f,x){return x%3==0};case s.PATTERN011:return function(f,x){return(f+x)%3==0};case s.PATTERN100:return function(f,x){return(Math.floor(f/2)+Math.floor(x/3))%2==0};case s.PATTERN101:return function(f,x){return f*x%2+f*x%3==0};case s.PATTERN110:return function(f,x){return(f*x%2+f*x%3)%2==0};case s.PATTERN111:return function(f,x){return(f*x%3+(f+x)%2)%2==0};default:throw"bad maskPattern:"+y}},w.getErrorCorrectPolynomial=function(y){for(var f=i([1],0),x=0;x<y;x+=1)f=f.multiply(i([1,a.gexp(x)],0));return f},w.getLengthInBits=function(y,f){if(1<=f&&f<10)switch(y){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:"+y}else if(f<27)switch(y){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:"+y}else if(f<41)switch(y){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:"+y}else throw"type:"+f},w.getLostPoint=function(y){for(var f=y.getModuleCount(),x=0,T=0;T<f;T+=1)for(var I=0;I<f;I+=1){for(var Y=0,J=y.isDark(T,I),te=-1;te<=1;te+=1)if(!(T+te<0||f<=T+te))for(var B=-1;B<=1;B+=1)I+B<0||f<=I+B||te==0&&B==0||J==y.isDark(T+te,I+B)&&(Y+=1);Y>5&&(x+=3+Y-5)}for(var T=0;T<f-1;T+=1)for(var I=0;I<f-1;I+=1){var Q=0;y.isDark(T,I)&&(Q+=1),y.isDark(T+1,I)&&(Q+=1),y.isDark(T,I+1)&&(Q+=1),y.isDark(T+1,I+1)&&(Q+=1),(Q==0||Q==4)&&(x+=3)}for(var T=0;T<f;T+=1)for(var I=0;I<f-6;I+=1)y.isDark(T,I)&&!y.isDark(T,I+1)&&y.isDark(T,I+2)&&y.isDark(T,I+3)&&y.isDark(T,I+4)&&!y.isDark(T,I+5)&&y.isDark(T,I+6)&&(x+=40);for(var I=0;I<f;I+=1)for(var T=0;T<f-6;T+=1)y.isDark(T,I)&&!y.isDark(T+1,I)&&y.isDark(T+2,I)&&y.isDark(T+3,I)&&y.isDark(T+4,I)&&!y.isDark(T+5,I)&&y.isDark(T+6,I)&&(x+=40);for(var ne=0,I=0;I<f;I+=1)for(var T=0;T<f;T+=1)y.isDark(T,I)&&(ne+=1);var fe=Math.abs(100*ne/f/f-50)/5;return x+=fe*10,x},w})(),a=(function(){for(var S=new Array(256),$=new Array(256),b=0;b<8;b+=1)S[b]=1<<b;for(var b=8;b<256;b+=1)S[b]=S[b-4]^S[b-5]^S[b-6]^S[b-8];for(var b=0;b<255;b+=1)$[S[b]]=b;var C={};return C.glog=function(w){if(w<1)throw"glog("+w+")";return $[w]},C.gexp=function(w){for(;w<0;)w+=255;for(;w>=256;)w-=255;return S[w]},C})();function i(S,$){if(typeof S.length>"u")throw S.length+"/"+$;var b=(function(){for(var w=0;w<S.length&&S[w]==0;)w+=1;for(var z=new Array(S.length-w+$),y=0;y<S.length-w;y+=1)z[y]=S[y+w];return z})(),C={};return C.getAt=function(w){return b[w]},C.getLength=function(){return b.length},C.multiply=function(w){for(var z=new Array(C.getLength()+w.getLength()-1),y=0;y<C.getLength();y+=1)for(var f=0;f<w.getLength();f+=1)z[y+f]^=a.gexp(a.glog(C.getAt(y))+a.glog(w.getAt(f)));return i(z,0)},C.mod=function(w){if(C Line truncated `}return Ie.substring(0,Ie.length-1)},I.renderTo2dContext=function(R,O){O=O||2;for(var P=I.getModuleCount(),U=0;U<P;U++)for(var D=0;D<P;D++)R.fillStyle=I.isDark(U,D)?"black":"white",R.fillRect(U*O,D*O,O,O)},I};n.stringToBytesFuncs={default:function(S){for(var $=[],b=0;b<S.length;b+=1){var C=S.charCodeAt(b);$.push(C&255)}return $}},n.stringToBytes=n.stringToBytesFuncs.default,n.createStringToBytes=function(S,$){var b=(function(){for(var y=h(S),z=function(){var B=y.read();if(B==-1)throw"eof";return B},k=0,f={};;){var x=y.read();if(x==-1)break;var T=z(),I=z(),V=z(),J=String.fromCharCode(x<<8|T),te=I<<8|V;f[J]=te,k+=1}if(k!=$)throw k+" != "+$;return f})(),C=63;return function(y){for(var z=[],k=0;k<y.length;k+=1){var f=y.charCodeAt(k);if(f<128)z.push(f);else{var x=b[y.charAt(k)];typeof x=="number"?(x&255)==x?z.push(x):(z.push(x>>>8),z.push(x&255)):z.push(C)}}return z}};var e={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},o={L:1,M:0,Q:3,H:2},s={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},r=(function(){var S=[[],[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]],$=1335,b=7973,C=21522,y={},z=function(k){for(var f=0;k!=0;)f+=1,k>>>=1;return f};return y.getBCHTypeInfo=function(k){for(var f=k<<10;z(f)-z($)>=0;)f^=$<<z(f)-z($);return(k<<10|f)^C},y.getBCHTypeNumber=function(k){for(var f=k<<12;z(f)-z(b)>=0;)f^=b<<z(f)-z(b);return k<<12|f},y.getPatternPosition=function(k){return S[k-1]},y.getMaskFunction=function(k){switch(k){case s.PATTERN000:return function(f,x){return(f+x)%2==0};case s.PATTERN001:return function(f,x){return f%2==0};case s.PATTERN010:return function(f,x){return x%3==0};case s.PATTERN011:return function(f,x){return(f+x)%3==0};case s.PATTERN100:return function(f,x){return(Math.floor(f/2)+Math.floor(x/3))%2==0};case s.PATTERN101:return function(f,x){return f*x%2+f*x%3==0};case s.PATTERN110:return function(f,x){return(f*x%2+f*x%3)%2==0};case s.PATTERN111:return function(f,x){return(f*x%3+(f+x)%2)%2==0};default:throw"bad maskPattern:"+k}},y.getErrorCorrectPolynomial=function(k){for(var f=i([1],0),x=0;x<k;x+=1)f=f.multiply(i([1,a.gexp(x)],0));return f},y.getLengthInBits=function(k,f){if(1<=f&&f<10)switch(k){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:"+k}else if(f<27)switch(k){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:"+k}else if(f<41)switch(k){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:"+k}else throw"type:"+f},y.getLostPoint=function(k){for(var f=k.getModuleCount(),x=0,T=0;T<f;T+=1)for(var I=0;I<f;I+=1){for(var V=0,J=k.isDark(T,I),te=-1;te<=1;te+=1)if(!(T+te<0||f<=T+te))for(var B=-1;B<=1;B+=1)I+B<0||f<=I+B||te==0&&B==0||J==k.isDark(T+te,I+B)&&(V+=1);V>5&&(x+=3+V-5)}for(var T=0;T<f-1;T+=1)for(var I=0;I<f-1;I+=1){var Q=0;k.isDark(T,I)&&(Q+=1),k.isDark(T+1,I)&&(Q+=1),k.isDark(T,I+1)&&(Q+=1),k.isDark(T+1,I+1)&&(Q+=1),(Q==0||Q==4)&&(x+=3)}for(var T=0;T<f;T+=1)for(var I=0;I<f-6;I+=1)k.isDark(T,I)&&!k.isDark(T,I+1)&&k.isDark(T,I+2)&&k.isDark(T,I+3)&&k.isDark(T,I+4)&&!k.isDark(T,I+5)&&k.isDark(T,I+6)&&(x+=40);for(var I=0;I<f;I+=1)for(var T=0;T<f-6;T+=1)k.isDark(T,I)&&!k.isDark(T+1,I)&&k.isDark(T+2,I)&&k.isDark(T+3,I)&&k.isDark(T+4,I)&&!k.isDark(T+5,I)&&k.isDark(T+6,I)&&(x+=40);for(var ne=0,I=0;I<f;I+=1)for(var T=0;T<f;T+=1)k.isDark(T,I)&&(ne+=1);var fe=Math.abs(100*ne/f/f-50)/5;return x+=fe*10,x},y})(),a=(function(){for(var S=new Array(256),$=new Array(256),b=0;b<8;b+=1)S[b]=1<<b;for(var b=8;b<256;b+=1)S[b]=S[b-4]^S[b-5]^S[b-6]^S[b-8];for(var b=0;b<255;b+=1)$[S[b]]=b;var C={};return C.glog=function(y){if(y<1)throw"glog("+y+")";return $[y]},C.gexp=function(y){for(;y<0;)y+=255;for(;y>=256;)y-=255;return S[y]},C})();function i(S,$){if(typeof S.length>"u")throw S.length+"/"+$;var b=(function(){for(var y=0;y<S.length&&S[y]==0;)y+=1;for(var z=new Array(S.length-y+$),k=0;k<S.length-y;k+=1)z[k]=S[k+y];return z})(),C={};return C.getAt=function(y){return b[y]},C.getLength=function(){return b.length},C.multiply=function(y){for(var z=new Array(C.getLength()+y.getLength()-1),k=0;k<C.getLength();k+=1)for(var f=0;f<y.getLength();f+=1)z[k+f]^=a.gexp(a.glog(C.getAt(k))+a.glog(y.getAt(f)));return i(z,0)},C.mod=function(y){if(C Line truncated
`)}function hi(n){let e=new Map(n.people.map(s=>[s.id,s.name])),o=new Map(n.people.flatMap(s=>s.devices.map(r=>[r.id,r.name])));return{people:e,devices:o}}function Qe(n,e,o,s="",r=[]){let a=hi(n),i=[...e.map(u=>({ts:u.ts,category:qt(u.type),type:u.type,person:u.person?a.people.get(u.person)??u.pname??u.person:"",device:u.device?a.devices.get(u.device)??u.dname??u.device:"",detail:u.detail??"",where:u.where??"",by:Ve(u)??""})),...r.map(u=>({ts:u.ts,category:"system",type:`${u.src}.${u.level}`,person:"",device:"",detail:`${u.who?`${u.who} `:""}${u.msg}${u.detail?` `)}function hi(n){let e=new Map(n.people.map(s=>[s.id,s.name])),o=new Map(n.people.flatMap(s=>s.devices.map(r=>[r.id,r.name])));return{people:e,devices:o}}function Qe(n,e,o,s="",r=[]){let a=hi(n),i=[...e.map(u=>({ts:u.ts,category:qt(u.type),type:u.type,person:u.person?a.people.get(u.person)??u.pname??u.person:"",device:u.device?a.devices.get(u.device)??u.dname??u.device:"",detail:u.detail??"",where:u.where??"",by:Ve(u)??""})),...r.map(u=>({ts:u.ts,category:"system",type:`${u.src}.${u.level}`,person:"",device:"",detail:`${u.who?`${u.who} `:""}${u.msg}${u.detail?`
${u.detail}`:""}`,where:Ft(u.src),by:""}))].sort((u,k)=>u.ts-k.ts).map(({ts:u,...k})=>({time:new Date(u*1e3).toISOString(),...k})),l=new Date().toISOString().slice(0,10),d=`dawnline-activity${s?`-${s}`:""}-${l}.${o}`;if(o==="json"){Ne(d,JSON.stringify(i,null,2),"application/json");return}let c=["time","category","type","person","device","detail","where","by"],p={time:_("Time"),category:_("Category"),type:_("Type"),person:_("Person"),device:_("Device"),detail:_("Detail"),where:_("Where"),by:_("By")};Ne(d,Ss(c,i,p),"text/csv")}var fi=["","7","30","90"],gi=n=>n?W(Number(n),"Older than %s day","Older than %s days"):_("Everything"),Ps=n=>n?W(n,"%s event removed","%s events removed"):_("Nothing matched");function lt(n,e,o,s,r,a=!1){let i=t("select",{class:"cbi-input-select"},[t("option",{value:""},_("All categories")),...Nt.map(d=>t("option",{value:d,selected:d===r?"selected":null},Ye(d))),a?t("option",{value:"system",selected:r==="system"?"selected":null},_("System")):""]),l=t("select",{class:"cbi-input-select"},fi.map(d=>t("option",{value:d},gi(d))));de(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")),i]),t("label",{class:"dl-fld"},[t("span",{class:"dl-fld-label"},_("Which events")),l])],[ue()," ",A(_("Clear"),async()=>{let d=0;if(i.value!=="system")try{d+=(await N.logsClear({...o,category:i.value,older_days:l.value})).removed}catch(c){q(Ce(c),"error",1e4);return}if(a&&(i.value==="system"||i.value===""))try{d+=(await N.serviceLogClear(l.value)).removed}catch(c){ce();let p=m(_("The service log was not cleared: %s"),Ce(c));q(i.value==="system"?p:`${m(_("Activity: %s."),Ps(d).toLowerCase())} ${p}`,"error",1e4),s();return}ce(),q(Ps(d),"success",3e3),s()},"negative")])}function Ht(n,e,o,s){let r=n==="device"?m(_("Clears %s's daily and monthly traffic history. Their person's totals and data limit are not changed."),o):n==="person"?m(_("Clears %s's traffic history and that of their devices. Their data limit starts again from zero."),o):_("Clears traffic history for everyone. Data limits start again from zero.");de(n==="all"?_("Reset all traffic history?"):m(_("Reset traffic history for %s?"),o),[t("p",{class:"dl-muted"},r)],[ue()," ",A(_("Reset"),async()=>{await F(()=>N.usageClear(n,e),_("Traffic history reset"))&&(ce(),s())},"negative")])}function ye(n,e,o){let s=t("button",{type:"button",role:"switch",class:`dl-switch${n?" on":""}`,"aria-checked":n?"true":"false","aria-label":e,click:()=>{let r=!s.classList.contains("on");uo(s,r),o?.(r)}},t("i"));return s}function uo(n,e){n.classList.toggle("on",e),n.setAttribute("aria-checked",e?"true":"false")}var ze=n=>n.classList.contains("on");function Me(n,e,o={}){n.some(([a])=>a===e)||(n=[...n,[e,e]]);let s=t("div",{class:`dl-seg${o.cls?` ${o.cls}`:""}`,role:"radiogroup","aria-label":o.label??null,"data-value":e}),r=()=>s.querySelectorAll(":scope > button").forEach(a=>{let i=a.dataset.v===s.dataset.value;a.classList.toggle("on",i),a.setAttribute("aria-checked",i?"true":"false")});for(let[a,i]of n)s.appendChild(t("button",{type:"button",role:"radio","data-v":a,click:()=>{a!==s.dataset.value&&(o.optimistic!==!1&&(s.dataset.value=a,r()),o.onChange?.(a))}},i));return r(),s}function Xe(n,e,o,s={}){return t("button",{type:"button",...s,class:`dl-chipbtn${e?" on":""}${s.class?` ${s.class}`:""}`,"aria-pressed":e?"true":"false",click:o},n)}function xn(n,e){n.classList.toggle("on",e),n.setAttribute("aria-pressed",e?"true":"false")}function he(n,e={}){return t("input",{type:"text",class:"cbi-input-text",value:n,...e})}var vi={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:""},bi={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 xi(n){let e={};for(let[o,s]of Object.entries(bi))n[o]!=null&&n[o]!==""&&(e[s]=String(n[o]));return e}function wi(n,e){let o=n.amnezia,s=o.obfuscation??{},r=d=>s[d]!=null&&s[d]!==""?String(s[d]):vi[d],a=o.host.replace(/^\[(.*)\]$/,"$1"),i={H1:r("h1"),H2:r("h2"),H3:r("h3"),H4:r("h4"),I1:r("i1"),I2:r("i2"),I3:r("i3"),I4:r("i4"),I5:r("i5"),Jc:r("jc"),Jmin:r("jmin"),Jmax:r("jmax"),S1:r("s1"),S2:r("s2"),S3:r("s3"),S4:r("s4"),...xi(s),allowed_ips:o.allowed_ips,client_ip:o.client_ip,client_priv_key:o.client_priv_key,client_pub_key:o.client_pub_key,config:n.conf.replace(/\r?\n/g,`\r ${u.detail}`:""}`,where:Ft(u.src),by:""}))].sort((u,w)=>u.ts-w.ts).map(({ts:u,...w})=>({time:new Date(u*1e3).toISOString(),...w})),l=new Date().toISOString().slice(0,10),d=`dawnline-activity${s?`-${s}`:""}-${l}.${o}`;if(o==="json"){Ne(d,JSON.stringify(i,null,2),"application/json");return}let c=["time","category","type","person","device","detail","where","by"],p={time:_("Time"),category:_("Category"),type:_("Type"),person:_("Person"),device:_("Device"),detail:_("Detail"),where:_("Where"),by:_("By")};Ne(d,Ss(c,i,p),"text/csv")}var fi=["","7","30","90"],gi=n=>n?W(Number(n),"Older than %s day","Older than %s days"):_("Everything"),Ps=n=>n?W(n,"%s event removed","%s events removed"):_("Nothing matched");function lt(n,e,o,s,r,a=!1){let i=t("select",{class:"cbi-input-select"},[t("option",{value:""},_("All categories")),...Nt.map(d=>t("option",{value:d,selected:d===r?"selected":null},Ye(d))),a?t("option",{value:"system",selected:r==="system"?"selected":null},_("System")):""]),l=t("select",{class:"cbi-input-select"},fi.map(d=>t("option",{value:d},gi(d))));de(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")),i]),t("label",{class:"dl-fld"},[t("span",{class:"dl-fld-label"},_("Which events")),l])],[ue()," ",A(_("Clear"),async()=>{let d=0;if(i.value!=="system")try{d+=(await N.logsClear({...o,category:i.value,older_days:l.value})).removed}catch(c){q(Ce(c),"error",1e4);return}if(a&&(i.value==="system"||i.value===""))try{d+=(await N.serviceLogClear(l.value)).removed}catch(c){ce();let p=m(_("The service log was not cleared: %s"),Ce(c));q(i.value==="system"?p:`${m(_("Activity: %s."),Ps(d).toLowerCase())} ${p}`,"error",1e4),s();return}ce(),q(Ps(d),"success",3e3),s()},"negative")])}function Ht(n,e,o,s){let r=n==="device"?m(_("Clears %s's daily and monthly traffic history. Their person's totals and data limit are not changed."),o):n==="person"?m(_("Clears %s's traffic history and that of their devices. Their data limit starts again from zero."),o):_("Clears traffic history for everyone. Data limits start again from zero.");de(n==="all"?_("Reset all traffic history?"):m(_("Reset traffic history for %s?"),o),[t("p",{class:"dl-muted"},r)],[ue()," ",A(_("Reset"),async()=>{await F(()=>N.usageClear(n,e),_("Traffic history reset"))&&(ce(),s())},"negative")])}function ye(n,e,o){let s=t("button",{type:"button",role:"switch",class:`dl-switch${n?" on":""}`,"aria-checked":n?"true":"false","aria-label":e,click:()=>{let r=!s.classList.contains("on");uo(s,r),o?.(r)}},t("i"));return s}function uo(n,e){n.classList.toggle("on",e),n.setAttribute("aria-checked",e?"true":"false")}var ze=n=>n.classList.contains("on");function Me(n,e,o={}){n.some(([a])=>a===e)||(n=[...n,[e,e]]);let s=t("div",{class:`dl-seg${o.cls?` ${o.cls}`:""}`,role:"radiogroup","aria-label":o.label??null,"data-value":e}),r=()=>s.querySelectorAll(":scope > button").forEach(a=>{let i=a.dataset.v===s.dataset.value;a.classList.toggle("on",i),a.setAttribute("aria-checked",i?"true":"false")});for(let[a,i]of n)s.appendChild(t("button",{type:"button",role:"radio","data-v":a,click:()=>{a!==s.dataset.value&&(o.optimistic!==!1&&(s.dataset.value=a,r()),o.onChange?.(a))}},i));return r(),s}function Xe(n,e,o,s={}){return t("button",{type:"button",...s,class:`dl-chipbtn${e?" on":""}${s.class?` ${s.class}`:""}`,"aria-pressed":e?"true":"false",click:o},n)}function xn(n,e){n.classList.toggle("on",e),n.setAttribute("aria-pressed",e?"true":"false")}function he(n,e={}){return t("input",{type:"text",class:"cbi-input-text",value:n,...e})}var vi={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:""},bi={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 xi(n){let e={};for(let[o,s]of Object.entries(bi))n[o]!=null&&n[o]!==""&&(e[s]=String(n[o]));return e}function wi(n,e){let o=n.amnezia,s=o.obfuscation??{},r=d=>s[d]!=null&&s[d]!==""?String(s[d]):vi[d],a=o.host.replace(/^\[(.*)\]$/,"$1"),i={H1:r("h1"),H2:r("h2"),H3:r("h3"),H4:r("h4"),I1:r("i1"),I2:r("i2"),I3:r("i3"),I4:r("i4"),I5:r("i5"),Jc:r("jc"),Jmin:r("jmin"),Jmax:r("jmax"),S1:r("s1"),S2:r("s2"),S3:r("s3"),S4:r("s4"),...xi(s),allowed_ips:o.allowed_ips,client_ip:o.client_ip,client_priv_key:o.client_priv_key,client_pub_key:o.client_pub_key,config:n.conf.replace(/\r?\n/g,`\r
`),hostName:a,mtu:o.mtu,persistent_keep_alive:o.persistent_keep_alive,port:Number(o.port),psk_key:o.psk_key,server_pub_key:o.server_pub_key},l={containers:[{container:"amnezia-awg",awg:{isThirdPartyConfig:!0,last_config:JSON.stringify(i),port:String(o.port),protocol_version:s.header_protection_key?"3.1":"2",transport_proto:"udp"}}],defaultContainer:"amnezia-awg",description:e,hostName:a};return o.dns[0]&&(l.dns1=o.dns[0]),o.dns[1]&&(l.dns2=o.dns[1]),l}function yi(n){let e="";for(let o=0;o<n.length;o+=32768)e+=String.fromCharCode(...n.subarray(o,o+32768));return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function ki(n){let e=globalThis;if(typeof e.CompressionStream>"u")return null;try{let o=new e.Blob([n]).stream().pipeThrough(new e.CompressionStream("deflate")),s=new Uint8Array(await new e.Response(o).arrayBuffer()),r=new Uint8Array(4+s.length);return new DataView(r.buffer).setUint32(0,n.length,!1),r.set(s,4),r}catch{return null}}async function mo(n,e,o=!0){let s=new TextEncoder().encode(JSON.stringify(wi(n,e))),r=o?await ki(s):null;return`vpn://${yi(r??s)}`}function Ds(){return[{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")}]}var Kt=n=>Ds().find(e=>e.id===n),wn=n=>n.v3?"max":n.v2?"balanced":"off",Yt=n=>n==="standard"?_("Standard (old)"):n==="strong"?_("Strong (old)"):null;function _i(n,e){return e?n==="v2"?_("Needs AmneziaWG 2.0 or newer on the router (kmod-amneziawg and amneziawg-tools from July 2025 on)."):_("Needs AmneziaWG 3.1 on the router (kmod-amneziawg and amneziawg-tools 3.1)."):n==="v2"?_("Needs AmneziaWG on the router."):_("Needs AmneziaWG 3.1 on the router: install it first.")}function $s(n,e){return t("span",{class:"dl-dots",title:m(_("%s: %s of 4"),e,n)},[t("span",{class:"dl-dots-label"},e),t("span",{class:"dl-dots-row"},[0,1,2,3].map(o=>t("i",{class:o<n?"on":""})))])}function yn(n,e,o,s,r=!0){let a=t("div",{class:"dl-methods",role:"radiogroup","aria-label":_("Disguise method")}),i=()=>dom.content(a,Ds().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,i(),o(l.id))}},[t("div",{class:"dl-method-head"},[t("span",{class:"dl-method-ic"},v(l.ic)),t("b",{},l.title),l.id===s?t("span",{class:"dl-pill ok"},_("Current")):""]),t("p",{},l.text),t("div",{class:"dl-method-meters"},[$s(l.stealth,_("Stealth")),$s(l.speed,_("Speed"))]),t("div",{class:"dl-method-foot"},d?[v(l.id==="off"?"wireguard":"amneziawg"),t("span",{},l.apps)]:[v("alert"),t("span",{},_i(l.needs,r))])])}));return i(),a}function As(n,e){return t("div",{class:"dl-corehead"},[t("h3",{},n),e?t("span",{class:"dl-sub"},e):""])}var Ns=[["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 Ci(n){let e=c=>n[c]!=null&&n[c]!=="",o=Ns.filter(([c])=>e(c));if(!o.length)return null;let s=(c,p)=>t("span",{class:"dl-pv"},[t("i",{},p),t("b",{},c==="header_protection_key"?`${n[c].slice(0,6)}••••`:n[c])]),r=(c,p,u,k)=>{let M=Ns.filter(([g])=>k.includes(g)&&e(g));return M.length?t("div",{class:"dl-pgroup"},[t("div",{class:"dl-pgroup-head"},[v(p),t("b",{},c)]),t("p",{},u),t("div",{class:"dl-pvals"},M.map(([g,h])=>s(g,h)))]):""},a=Number(n.jc||0),i=(n.i1??"").includes("0x8580")?_("A first packet shaped like a DNS answer."):_("Extra packets sent before the handshake."),l=o.map(([c,p])=>`${p} = ${n[c]}`).join(` `),hostName:a,mtu:o.mtu,persistent_keep_alive:o.persistent_keep_alive,port:Number(o.port),psk_key:o.psk_key,server_pub_key:o.server_pub_key},l={containers:[{container:"amnezia-awg",awg:{isThirdPartyConfig:!0,last_config:JSON.stringify(i),port:String(o.port),protocol_version:s.header_protection_key?"3.1":"2",transport_proto:"udp"}}],defaultContainer:"amnezia-awg",description:e,hostName:a};return o.dns[0]&&(l.dns1=o.dns[0]),o.dns[1]&&(l.dns2=o.dns[1]),l}function yi(n){let e="";for(let o=0;o<n.length;o+=32768)e+=String.fromCharCode(...n.subarray(o,o+32768));return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function ki(n){let e=globalThis;if(typeof e.CompressionStream>"u")return null;try{let o=new e.Blob([n]).stream().pipeThrough(new e.CompressionStream("deflate")),s=new Uint8Array(await new e.Response(o).arrayBuffer()),r=new Uint8Array(4+s.length);return new DataView(r.buffer).setUint32(0,n.length,!1),r.set(s,4),r}catch{return null}}async function mo(n,e,o=!0){let s=new TextEncoder().encode(JSON.stringify(wi(n,e))),r=o?await ki(s):null;return`vpn://${yi(r??s)}`}function Ds(){return[{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")}]}var Kt=n=>Ds().find(e=>e.id===n),wn=n=>n.v3?"max":n.v2?"balanced":"off",Yt=n=>n==="standard"?_("Standard (old)"):n==="strong"?_("Strong (old)"):null;function _i(n,e){return e?n==="v2"?_("Needs AmneziaWG 2.0 or newer on the router (kmod-amneziawg and amneziawg-tools from July 2025 on)."):_("Needs AmneziaWG 3.1 on the router (kmod-amneziawg and amneziawg-tools 3.1)."):n==="v2"?_("Needs AmneziaWG on the router."):_("Needs AmneziaWG 3.1 on the router: install it first.")}function $s(n,e){return t("span",{class:"dl-dots",title:m(_("%s: %s of 4"),e,n)},[t("span",{class:"dl-dots-label"},e),t("span",{class:"dl-dots-row"},[0,1,2,3].map(o=>t("i",{class:o<n?"on":""})))])}function yn(n,e,o,s,r=!0){let a=t("div",{class:"dl-methods",role:"radiogroup","aria-label":_("Disguise method")}),i=()=>dom.content(a,Ds().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,i(),o(l.id))}},[t("div",{class:"dl-method-head"},[t("span",{class:"dl-method-ic"},v(l.ic)),t("b",{},l.title),l.id===s?t("span",{class:"dl-pill ok"},_("Current")):""]),t("p",{},l.text),t("div",{class:"dl-method-meters"},[$s(l.stealth,_("Stealth")),$s(l.speed,_("Speed"))]),t("div",{class:"dl-method-foot"},d?[v(l.id==="off"?"wireguard":"amneziawg"),t("span",{},l.apps)]:[v("alert"),t("span",{},_i(l.needs,r))])])}));return i(),a}function As(n,e){return t("div",{class:"dl-corehead"},[t("h3",{},n),e?t("span",{class:"dl-sub"},e):""])}var Ns=[["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 Ci(n){let e=c=>n[c]!=null&&n[c]!=="",o=Ns.filter(([c])=>e(c));if(!o.length)return null;let s=(c,p)=>t("span",{class:"dl-pv"},[t("i",{},p),t("b",{},c==="header_protection_key"?`${n[c].slice(0,6)}••••`:n[c])]),r=(c,p,u,w)=>{let M=Ns.filter(([g])=>w.includes(g)&&e(g));return M.length?t("div",{class:"dl-pgroup"},[t("div",{class:"dl-pgroup-head"},[v(p),t("b",{},c)]),t("p",{},u),t("div",{class:"dl-pvals"},M.map(([g,h])=>s(g,h)))]):""},a=Number(n.jc||0),i=(n.i1??"").includes("0x8580")?_("A first packet shaped like a DNS answer."):_("Extra packets sent before the handshake."),l=o.map(([c,p])=>`${p} = ${n[c]}`).join(`
`),d=t("div",{class:"dl-pgrid"},[r(_("Junk packets"),"zap",a?m(N_(a,"%s random packet of %s–%s bytes before each handshake.","%s random packets of %s–%s bytes before each handshake."),K(a),n.jmin,n.jmax):_("No junk packets."),["jc","jmin","jmax"]),r(_("Padding"),"archive",_("Random bytes in front of handshake, cookie and data packets, so their sizes do not match WireGuard."),["s1","s2","s3","s4"]),r(_("Packet types"),"key",_("The values that replace WireGuard’s recognisable message types."),["h1","h2","h3","h4"]),r(_("Signatures"),"globe",i,["i1","i2","i3","i4","i5"]),r(_("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"]),r(_("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",{},[v("chevron"),t("span",{},_("Current parameters")),t("span",{class:"dl-pcount"},String(o.length)),t("span",{class:"dl-spacer"}),t("button",{type:"button",class:"dl-linkbtn",click:c=>{c.preventDefault(),xe(l,_("Parameters copied"))}},_("Copy as config"))]),d])}function Hs(n,e){if(/^\s*\[.+\]\s*$/.test(n))return t("span",{class:"dl-conf-sec"},n);let o=/^(\s*[A-Za-z0-9]+\s*=)\s*(.*)$/.exec(n);if(!o)return document.createTextNode(n);let s=/^(\s*)(PrivateKey|PresharedKey)\b/.test(n);return t("span",{},[t("span",{class:"dl-conf-k"},o[1])," ",s&&!e?t("span",{class:"dl-conf-mask"},"••••••••••••••••"):o[2]])}function Li(n){let e=!1,o=t("pre",{class:"dl-conf"}),s=()=>dom.content(o,n.conf.split(` `),d=t("div",{class:"dl-pgrid"},[r(_("Junk packets"),"zap",a?m(N_(a,"%s random packet of %s–%s bytes before each handshake.","%s random packets of %s–%s bytes before each handshake."),K(a),n.jmin,n.jmax):_("No junk packets."),["jc","jmin","jmax"]),r(_("Padding"),"archive",_("Random bytes in front of handshake, cookie and data packets, so their sizes do not match WireGuard."),["s1","s2","s3","s4"]),r(_("Packet types"),"key",_("The values that replace WireGuard’s recognisable message types."),["h1","h2","h3","h4"]),r(_("Signatures"),"globe",i,["i1","i2","i3","i4","i5"]),r(_("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"]),r(_("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",{},[v("chevron"),t("span",{},_("Current parameters")),t("span",{class:"dl-pcount"},String(o.length)),t("span",{class:"dl-spacer"}),t("button",{type:"button",class:"dl-linkbtn",click:c=>{c.preventDefault(),xe(l,_("Parameters copied"))}},_("Copy as config"))]),d])}function Hs(n,e){if(/^\s*\[.+\]\s*$/.test(n))return t("span",{class:"dl-conf-sec"},n);let o=/^(\s*[A-Za-z0-9]+\s*=)\s*(.*)$/.exec(n);if(!o)return document.createTextNode(n);let s=/^(\s*)(PrivateKey|PresharedKey)\b/.test(n);return t("span",{},[t("span",{class:"dl-conf-k"},o[1])," ",s&&!e?t("span",{class:"dl-conf-mask"},"••••••••••••••••"):o[2]])}function Li(n){let e=!1,o=t("pre",{class:"dl-conf"}),s=()=>dom.content(o,n.conf.split(`
`).flatMap((i,l)=>l?[` `).flatMap((i,l)=>l?[`
`,Hs(i,e)]:[Hs(i,e)])),r=t("button",{type:"button",class:"dl-chipbtn",click:i=>{i.preventDefault(),e=!e,dom.content(r,[v(e?"x":"key"),e?_("Hide key"):_("Show key")]),s()}},[v("key"),_("Show key")]);s();let a=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 · ${W(a,"%s byte","%s bytes")}`)]),A([v("download")," ",_("Download")],()=>Ne(n.filename,n.conf,"application/octet-stream"),"positive")]),t("details",{class:"dl-params"},[t("summary",{},[v("chevron"),t("span",{},_("Configuration")),t("span",{class:"dl-spacer"}),r,t("button",{type:"button",class:"dl-chipbtn",click:i=>{i.preventDefault(),xe(n.conf,_("Configuration copied"))}},[v("copy"),_("Copy")])]),o])])}function ho(n){let e=n.amnezia.obfuscation??{},o={h1:"1",h2:"2",h3:"3",h4:"4"};return Object.entries(e).every(([s,r])=>r==null||r===""||r===(o[s]??"0"))}async function Mi(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 o=await mo(n,n.server),s={qr:()=>t("div",{class:"dl-qr-pane"},[un(n.conf),t("span",{class:"dl-sub"},ho(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"},o),A(_("Copy"),()=>xe(o,_("Key copied")))]),t("span",{class:"dl-sub"},m(_("AmneziaVPN → %s. Keep it private."),["+",_("Insert","AmneziaVPN app"),_("Continue","AmneziaVPN app")].join(" → ")))]),file:()=>Li(n)},r=t("div",{class:"dl-connect-body"}),a=t("div",{class:"dl-seg"}),i=l=>{a.querySelectorAll("button").forEach(d=>d.classList.toggle("on",d.dataset.id===l)),dom.content(r,s[l]())};for(let[l,d]of[["file",_("File")],["key",_("Key")],["qr",_("QR code")]])a.appendChild(t("button",{type:"button","data-id":l,click:()=>i(l)},d));return i(e),t("div",{class:"dl-stack gap12"},[a,r])}async function Ei(n,e,o,s){let r=Kt(o),i=n.st.people.filter(d=>d.server===e.id).reduce((d,c)=>d+c.devices.length,0);await me(s?_("Generate new disguise values?"):m(_("Switch to %s?"),r.title),[W(i,"%s AmneziaWG device stops connecting until it imports its configuration again (from their personal link or from you).","%s AmneziaWG devices stop connecting until they import their configuration again (from their personal link or from you)."),o==="max"?_("They need an app with AmneziaWG 3.1."):o==="balanced"?_("They need an app with AmneziaWG 2.0 or newer."):"",n.st.servers.length===1&&i?_("To keep the old disguise for some people, add a second server and move them there."):""].filter(Boolean).join(" "),s?_("Generate and apply"):_("Switch and apply"),!0)&&await F(()=>N.serverObfuscation(e.id,o),s?_("New values applied"):m(_("%s applied"),r.title))&&(q(_("Devices are marked “Update config” until they import again."),"info",6e3),await n.refresh())}function Ti(n,e){let o=n.st,s=he(String(e.port),{inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),r=he(e.mtu?String(e.mtu):"",{placeholder:_("Auto"),inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),a=he(String(e.keepalive??""),{placeholder:"25",inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),i=Kt(e.preset)?e.preset:void 0,l=i??wn(o.awg),d=A("",()=>Ei(n,e,l,l===i),"neutral"),c=()=>dom.content(d,l===i?[v("reset")," ",_("Generate new values")]:[m(_("Switch to %s"),Kt(l).title)]);c();let p=o.awg_state?.tools!==!1,u=[],k=_e(_("UDP port"),s,()=>Gt(Number(s.value),u,[_("Opened on the WAN firewall automatically."),Number(s.value)===4500?_("4500 is IPsec’s port: most networks let it through."):""].filter(Boolean).join(" ")));N.serverPorts(e.id).then(h=>{u=h.udp_taken??[],k.refresh()}).catch(()=>{});let M=_e("MTU",r,()=>ps(r.value,e.mtus)),g=_e(_("Keep-alive"),a,()=>us(a.value));return Wt("",[As("AmneziaWG",e.ifname),ke("globe",_("Listening"),_("Where devices reach this core from the internet"),[k]),ke("file",_("In every device configuration"),_("Changing these marks devices “Update config” until they import again"),[M,g]),ke("shield",_("Disguise"),_("So networks that block VPNs do not recognise the tunnel. Off = plain WireGuard"),[Yt(e.preset)?bt("warn",ae(_("%s is AmneziaWG 1.0 junk only, which networks learned to spot; it is not offered any more. Switch to %s or %s: devices import their configuration again."),t("b",{},Yt(e.preset)),t("b",{},_("Balanced")),t("b",{},_("Maximum")))):"",yn(o.awg,l,h=>{l=h,c()},i,p),p&&!o.awg.v3?bt("info",ae(_("This router runs an older AmneziaWG. %s becomes available with kmod-amneziawg and amneziawg-tools 3.1."),t("b",{},_("Maximum")))):"",Ci(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("deta Line truncated `,Hs(i,e)]:[Hs(i,e)])),r=t("button",{type:"button",class:"dl-chipbtn",click:i=>{i.preventDefault(),e=!e,dom.content(r,[v(e?"x":"key"),e?_("Hide key"):_("Show key")]),s()}},[v("key"),_("Show key")]);s();let a=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 · ${W(a,"%s byte","%s bytes")}`)]),A([v("download")," ",_("Download")],()=>Ne(n.filename,n.conf,"application/octet-stream"),"positive")]),t("details",{class:"dl-params"},[t("summary",{},[v("chevron"),t("span",{},_("Configuration")),t("span",{class:"dl-spacer"}),r,t("button",{type:"button",class:"dl-chipbtn",click:i=>{i.preventDefault(),xe(n.conf,_("Configuration copied"))}},[v("copy"),_("Copy")])]),o])])}function ho(n){let e=n.amnezia.obfuscation??{},o={h1:"1",h2:"2",h3:"3",h4:"4"};return Object.entries(e).every(([s,r])=>r==null||r===""||r===(o[s]??"0"))}async function Mi(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 o=await mo(n,n.server),s={qr:()=>t("div",{class:"dl-qr-pane"},[un(n.conf),t("span",{class:"dl-sub"},ho(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"},o),A(_("Copy"),()=>xe(o,_("Key copied")))]),t("span",{class:"dl-sub"},m(_("AmneziaVPN → %s. Keep it private."),["+",_("Insert","AmneziaVPN app"),_("Continue","AmneziaVPN app")].join(" → ")))]),file:()=>Li(n)},r=t("div",{class:"dl-connect-body"}),a=t("div",{class:"dl-seg"}),i=l=>{a.querySelectorAll("button").forEach(d=>d.classList.toggle("on",d.dataset.id===l)),dom.content(r,s[l]())};for(let[l,d]of[["file",_("File")],["key",_("Key")],["qr",_("QR code")]])a.appendChild(t("button",{type:"button","data-id":l,click:()=>i(l)},d));return i(e),t("div",{class:"dl-stack gap12"},[a,r])}async function Ei(n,e,o,s){let r=Kt(o),i=n.st.people.filter(d=>d.server===e.id).reduce((d,c)=>d+c.devices.length,0);await me(s?_("Generate new disguise values?"):m(_("Switch to %s?"),r.title),[W(i,"%s AmneziaWG device stops connecting until it imports its configuration again (from their personal link or from you).","%s AmneziaWG devices stop connecting until they import their configuration again (from their personal link or from you)."),o==="max"?_("They need an app with AmneziaWG 3.1."):o==="balanced"?_("They need an app with AmneziaWG 2.0 or newer."):"",n.st.servers.length===1&&i?_("To keep the old disguise for some people, add a second server and move them there."):""].filter(Boolean).join(" "),s?_("Generate and apply"):_("Switch and apply"),!0)&&await F(()=>N.serverObfuscation(e.id,o),s?_("New values applied"):m(_("%s applied"),r.title))&&(q(_("Devices are marked “Update config” until they import again."),"info",6e3),await n.refresh())}function Ti(n,e){let o=n.st,s=he(String(e.port),{inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),r=he(e.mtu?String(e.mtu):"",{placeholder:_("Auto"),inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),a=he(String(e.keepalive??""),{placeholder:"25",inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),i=Kt(e.preset)?e.preset:void 0,l=i??wn(o.awg),d=A("",()=>Ei(n,e,l,l===i),"neutral"),c=()=>dom.content(d,l===i?[v("reset")," ",_("Generate new values")]:[m(_("Switch to %s"),Kt(l).title)]);c();let p=o.awg_state?.tools!==!1,u=[],w=_e(_("UDP port"),s,()=>Gt(Number(s.value),u,[_("Opened on the WAN firewall automatically."),Number(s.value)===4500?_("4500 is IPsec’s port: most networks let it through."):""].filter(Boolean).join(" ")));N.serverPorts(e.id).then(h=>{u=h.udp_taken??[],w.refresh()}).catch(()=>{});let M=_e("MTU",r,()=>ps(r.value,e.mtus)),g=_e(_("Keep-alive"),a,()=>us(a.value));return Wt("",[As("AmneziaWG",e.ifname),ke("globe",_("Listening"),_("Where devices reach this core from the internet"),[w]),ke("file",_("In every device configuration"),_("Changing these marks devices “Update config” until they import again"),[M,g]),ke("shield",_("Disguise"),_("So networks that block VPNs do not recognise the tunnel. Off = plain WireGuard"),[Yt(e.preset)?bt("warn",ae(_("%s is AmneziaWG 1.0 junk only, which networks learned to spot; it is not offered any more. Switch to %s or %s: devices import their configuration again."),t("b",{},Yt(e.preset)),t("b",{},_("Balanced")),t("b",{},_("Maximum")))):"",yn(o.awg,l,h=>{l=h,c()},i,p),p&&!o.awg.v3?bt("info",ae(_("This router runs an older AmneziaWG. %s becomes available with kmod-amneziawg and amneziawg-tools 3.1."),t("b",{},_("Maximum")))):"",Ci(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("deta Line truncated
`),_("Log copied")))]),p,u]),[k],"wide"),g([t("button",{class:"cbi-button cbi-button-neutral spinning",type:"button",disabled:"disabled"},r?_("Checking…"):_("Working…"))]);let E=o??null,H=o?.id,S,$=0,b=x=>{H!==x.id&&(H=x.id,e.onJob?.(x))};if(o)e.onJob?.(o);else try{let x=await N.updatesStatus().catch(()=>null);S=x?.job?.id,$=x?.now??0;let T=await N.updatesRun(n);T.job&&T.job.state==="running"&&T.job.id!==S&&(E=T.job,b(T.job))}catch(x){return M=[Ce(x)],p.textContent=M[0],dom.content(u,t("div",{class:"dl-comp-status warn"},[v("alert"),t("span",{},Ce(x))])),g([h(!0)]),q(Ce(x),"error"),null}let C=null,w=0;for(;;){if(await $o(1e3),C=await N.updatesStatus().catch(()=>null),!C){if(++w>60)break;continue}w=0;let x=C.job;if(!x||!Lr(x,H,S,$)){if(Date.now()-a>15e3)break;continue}if(b(x),E=x,x.log.length){M=x.log;let T=p.scrollTop+p.clientHeight>=p.scrollHeight-8;p.textContent=M.join(` `),_("Log copied")))]),p,u]),[w],"wide"),g([t("button",{class:"cbi-button cbi-button-neutral spinning",type:"button",disabled:"disabled"},r?_("Checking…"):_("Working…"))]);let E=o??null,H=o?.id,S,$=0,b=x=>{H!==x.id&&(H=x.id,e.onJob?.(x))};if(o)e.onJob?.(o);else try{let x=await N.updatesStatus().catch(()=>null);S=x?.job?.id,$=x?.now??0;let T=await N.updatesRun(n);T.job&&T.job.state==="running"&&T.job.id!==S&&(E=T.job,b(T.job))}catch(x){return M=[Ce(x)],p.textContent=M[0],dom.content(u,t("div",{class:"dl-comp-status warn"},[v("alert"),t("span",{},Ce(x))])),g([h(!0)]),q(Ce(x),"error"),null}let C=null,y=0;for(;;){if(await $o(1e3),C=await N.updatesStatus().catch(()=>null),!C){if(++y>60)break;continue}y=0;let x=C.job;if(!x||!Lr(x,H,S,$)){if(Date.now()-a>15e3)break;continue}if(b(x),E=x,x.log.length){M=x.log;let T=p.scrollTop+p.clientHeight>=p.scrollHeight-8;p.textContent=M.join(`
`),T&&(p.scrollTop=p.scrollHeight)}if(l.textContent=_r(x,e.version??""),!l.isConnected&&l.textContent&&i.after(l),c.textContent=kr((x.finished??C.now)-x.started),x.state==="running"){d.hidden=!x.phase,d.textContent=x.phase;continue}break}if(p.scrollTop=p.scrollHeight,d.hidden=!1,!E||E.state==="running")return d.className="dl-pill warn",d.textContent=_("No answer"),dom.content(u,t("div",{class:"dl-comp-status warn"},[v("alert"),t("span",{},_("The router stopped answering. The job may still finish: reopen Components in a minute."))])),g([h()]),e.onDone?.(C),E;if(E.state==="failed")return d.className="dl-pill bad",d.textContent=_("Failed"),dom.content(u,t("div",{class:"dl-comp-status bad"},[v("x"),t("span",{},[t("b",{},(E.error??_("Operation failed")).replace(/\.$/,"")),r?"":`. ${_("Nothing else was changed.")}`])])),g([A(_("Copy log"),()=>xe(M.join(` `),T&&(p.scrollTop=p.scrollHeight)}if(l.textContent=_r(x,e.version??""),!l.isConnected&&l.textContent&&i.after(l),c.textContent=kr((x.finished??C.now)-x.started),x.state==="running"){d.hidden=!x.phase,d.textContent=x.phase;continue}break}if(p.scrollTop=p.scrollHeight,d.hidden=!1,!E||E.state==="running")return d.className="dl-pill warn",d.textContent=_("No answer"),dom.content(u,t("div",{class:"dl-comp-status warn"},[v("alert"),t("span",{},_("The router stopped answering. The job may still finish: reopen Components in a minute."))])),g([h()]),e.onDone?.(C),E;if(E.state==="failed")return d.className="dl-pill bad",d.textContent=_("Failed"),dom.content(u,t("div",{class:"dl-comp-status bad"},[v("x"),t("span",{},[t("b",{},(E.error??_("Operation failed")).replace(/\.$/,"")),r?"":`. ${_("Nothing else was changed.")}`])])),g([A(_("Copy log"),()=>xe(M.join(`
`),_("Log copied"))),h(!0)]),q(`${Dn(s)??_("Update","noun")}: ${E.error??_("failed")}`,"error"),e.onDone?.(C),E;if(d.className="dl-pill ok",d.textContent=_("Finished"),r&&C){let x=Cr(C,s);if(dom.content(u,t("div",{class:`dl-comp-status ${x.tone}`},[v(x.tone==="ok"?"check":x.tone==="warn"?"alert":"download"),t("span",{},x.text)])),q(x.text,x.tone==="warn"?"warning":"success"),e.onDone?.(C),x.update&&e.onUpdate){let T=C;g([h(),A(m(_("Update to %s"),x.update),()=>e.onUpdate(T),"positive")])}else g([h()]),x.tone==="ok"&&setTimeout(()=>u.isConnected&&ce(),1200);return E}let z=/^app:(lang:|nolang$)/.exec(E.component??"");if(z){let x=()=>{ui.menu?.flushCache(),location.reload()};return dom.content(u,t("div",{class:"dl-comp-status ok"},[v("check"),t("span",{},[t("b",{},z[1]==="nolang"?_("The translation is removed."):_("The translation is installed."))," ",_("Reloading the page…")])])),g([h(),A(_("Reload now"),x,"positive")]),await $o(4e3),u.isConnected&&x(),E}if(s==="app"&&E.to){let x=E.to,T=t("span",{},_("Waiting for the router to restart its services…"));dom.content(u,t("div",{class:"dl-comp-status ok"},[v("check"),t("span",{},[t("b",{},m(_("Dawnline %s is installed."),x))," ",T])]));let I=()=>{ui.menu?.flushCache(),location.reload()};g([h(),A(_("Reload now"),I,"positive")]),q(m(_("Dawnline updated to %s"),x),"success",6e3);for(let Y=1;Y<=30;Y++)if(T.textContent=m(_("Waiting for the router to restart its services (%s of 30)…"),Y),await $o(1500),(await N.updatesStatus().catch(()=>null))?.version===x)return T.textContent=_("Services are back. Reloading…"),setTimeout(I,800),E;return T.textContent=_("Services restarted. Reload the page to use the new version."),E}let y=[...E.result?.pkgs?.updated??[],...E.result?.pkgs?.installed??[]],f=s==="pkgs"?y.length?m(_("Updated %s"),y.join(", ")):_("Updated system packages"):s==="amneziawg"?E.to?m(_("AmneziaWG %s is installed"),E.to):_("AmneziaWG is installed"):_("Operation completed");return dom.content(u,t("div",{class:"dl-comp-status ok"},[v("check"),t("span",{},f)])),g([h()]),q(f,"success"),e.onDone?.(C),E}function el(n){return{https:[_("Install HTTPS for the portal?"),_("Installing HTTPS for the portal")],acme:[_("Install ACME certificates?"),_("Installing ACME certificates")],home:[_("Install the home-like link?"),_("Installing the home-like link")],awg:[_("Install AmneziaWG?"),_("Installing AmneziaWG")]}[n]}async function Mr(n,e,o,s){let[r,a]=el(e);return!await me(r,o,_("Install"))||(await tn(n,{title:a}))?.state!=="done"?!1:(setTimeout(()=>s?.(),4e3),!0)}function Nn(n){return Mr("amneziawg:auto","awg",_("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 nn(n,e,o){return n==="awg"?Nn(o):e.length?Mr(`pkgs:${e.join(",")}`,n,m(_("%s from the OpenWrt feeds. Dawnline sets the rest up when they arrive."),e.join(", ")),o):!0}async function Er(n,e){if(n==="awg")return Nn(e);let o=await F(()=>N.updatesStatus());return o?nn(n,o.needs?.[n]??[],e):!1}var tl=()=>[["wan","WAN"],["ethernet","Ethernet"],["wifi","Wi-Fi"],["vpn",_("VPN & tunnels")],["other",_("Other")]],nl={wan:"globe",ethernet:"ethernet",bridge:"bridge",wifi:"wifi",vpn:"tunnel",other:"link"};function Tr(n,e,o){let s=n.id,r=e,a=t("div",{class:"dl-stack gap16"},t("section",{class:"dl-setsec"},t("div",{class:"dl-setsec-body"},t("p",{class:"dl-muted"},_("Loading interfaces…"))))),i,l=!0,d="",c=!0,p=!0,u="all",k=!1,M=xr(r,s,o),g=new Set,h="",E=()=>JSON.stringify([p,l,l?"":d,c,[...g].sort()]),H=()=>i.detected.lan||i.saved.lan||"",S=()=>(l?i.detected.wan||i.saved.wan:d)||"",$=()=>new Map(i.devices.map(B=>[B.name,B])),b=()=>{let B=$();return[...c&&H()?[H()]:[],...[...g].filter(ne=>ne!==H())].filter(ne=>ne!==S()).map(ne=>B.get(ne)??{name:ne,nets:[],missing:!0})},C=(B,Q)=>{i=B,Q&&(l=B.config.auto_wan,d=B.config.wan_device||B.detected.wan||B.saved.wan||"",c=B.config.auto_lan,p=B.config.lan_like,u=B.config.mesh??(B.config.device_mesh?"all":"off"),g=new Set(B.config.lan_devices),h=E()),J()},w=async B=>{let Q=await N.interfaces(s).catch(ne=>(q(ne.message,"error"),null));Q&&C(Q,B)};function z(B){let Q=c&&B.name===H(),ne=!!B.own||!!B.master||B.name===S()||Q;return Q||g.has(B.name)||!ne&&(B.nets.length>0||!!B.missing)}function y(B){let Q=c&&B.name===H(),ne=B.name===S(),fe=!Q&&g.has(B.name),j=!(!!B.own||!!B.master||ne||Q)&&(B.nets.length>0||fe||!!B.missing),V=(fe||Q)&&!B.zone&&!B.missing,le=B.missing?_("Not present right now"):B.own?_("This server"):B.master?m(_("Port of %s"),B.master):ne?`${_("Internet")}${B.zone?` · ${m(_("zone %s"),B.zone)}`:""}`:B.nets.length?B.nets.join(", "):_("No IPv4 network"),ve=t("button",{type:"button",class:`dl-if${fe?" sel":""}${Q?" auto":""}${!j&&!fe&&!Q?" off":""}${V?" warn":""}`,"aria-pressed":fe||Q?"true":"false","aria-disabled":j?null:"true",click:()=>{j&&(g.has(B.name)?g.delete(B.name):g.add(B.name),J())}},[t("span",{class:"dl-if-ic"},v(nl[B.kind]??"link")),t( Line truncated `),_("Log copied"))),h(!0)]),q(`${Dn(s)??_("Update","noun")}: ${E.error??_("failed")}`,"error"),e.onDone?.(C),E;if(d.className="dl-pill ok",d.textContent=_("Finished"),r&&C){let x=Cr(C,s);if(dom.content(u,t("div",{class:`dl-comp-status ${x.tone}`},[v(x.tone==="ok"?"check":x.tone==="warn"?"alert":"download"),t("span",{},x.text)])),q(x.text,x.tone==="warn"?"warning":"success"),e.onDone?.(C),x.update&&e.onUpdate){let T=C;g([h(),A(m(_("Update to %s"),x.update),()=>e.onUpdate(T),"positive")])}else g([h()]),x.tone==="ok"&&setTimeout(()=>u.isConnected&&ce(),1200);return E}let z=/^app:(lang:|nolang$)/.exec(E.component??"");if(z){let x=()=>{ui.menu?.flushCache(),location.reload()};return dom.content(u,t("div",{class:"dl-comp-status ok"},[v("check"),t("span",{},[t("b",{},z[1]==="nolang"?_("The translation is removed."):_("The translation is installed."))," ",_("Reloading the page…")])])),g([h(),A(_("Reload now"),x,"positive")]),await $o(4e3),u.isConnected&&x(),E}if(s==="app"&&E.to){let x=E.to,T=t("span",{},_("Waiting for the router to restart its services…"));dom.content(u,t("div",{class:"dl-comp-status ok"},[v("check"),t("span",{},[t("b",{},m(_("Dawnline %s is installed."),x))," ",T])]));let I=()=>{ui.menu?.flushCache(),location.reload()};g([h(),A(_("Reload now"),I,"positive")]),q(m(_("Dawnline updated to %s"),x),"success",6e3);for(let V=1;V<=30;V++)if(T.textContent=m(_("Waiting for the router to restart its services (%s of 30)…"),V),await $o(1500),(await N.updatesStatus().catch(()=>null))?.version===x)return T.textContent=_("Services are back. Reloading…"),setTimeout(I,800),E;return T.textContent=_("Services restarted. Reload the page to use the new version."),E}let k=[...E.result?.pkgs?.updated??[],...E.result?.pkgs?.installed??[]],f=s==="pkgs"?k.length?m(_("Updated %s"),k.join(", ")):_("Updated system packages"):s==="amneziawg"?E.to?m(_("AmneziaWG %s is installed"),E.to):_("AmneziaWG is installed"):_("Operation completed");return dom.content(u,t("div",{class:"dl-comp-status ok"},[v("check"),t("span",{},f)])),g([h()]),q(f,"success"),e.onDone?.(C),E}function el(n){return{https:[_("Install HTTPS for the portal?"),_("Installing HTTPS for the portal")],acme:[_("Install ACME certificates?"),_("Installing ACME certificates")],home:[_("Install the home-like link?"),_("Installing the home-like link")],awg:[_("Install AmneziaWG?"),_("Installing AmneziaWG")]}[n]}async function Mr(n,e,o,s){let[r,a]=el(e);return!await me(r,o,_("Install"))||(await tn(n,{title:a}))?.state!=="done"?!1:(setTimeout(()=>s?.(),4e3),!0)}function Nn(n){return Mr("amneziawg:auto","awg",_("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 nn(n,e,o){return n==="awg"?Nn(o):e.length?Mr(`pkgs:${e.join(",")}`,n,m(_("%s from the OpenWrt feeds. Dawnline sets the rest up when they arrive."),e.join(", ")),o):!0}async function Er(n,e){if(n==="awg")return Nn(e);let o=await F(()=>N.updatesStatus());return o?nn(n,o.needs?.[n]??[],e):!1}var tl=()=>[["wan","WAN"],["ethernet","Ethernet"],["wifi","Wi-Fi"],["vpn",_("VPN & tunnels")],["other",_("Other")]],nl={wan:"globe",ethernet:"ethernet",bridge:"bridge",wifi:"wifi",vpn:"tunnel",other:"link"};function Tr(n,e,o){let s=n.id,r=e,a=t("div",{class:"dl-stack gap16"},t("section",{class:"dl-setsec"},t("div",{class:"dl-setsec-body"},t("p",{class:"dl-muted"},_("Loading interfaces…"))))),i,l=!0,d="",c=!0,p=!0,u="all",w=!1,M=xr(r,s,o),g=new Set,h="",E=()=>JSON.stringify([p,l,l?"":d,c,[...g].sort()]),H=()=>i.detected.lan||i.saved.lan||"",S=()=>(l?i.detected.wan||i.saved.wan:d)||"",$=()=>new Map(i.devices.map(B=>[B.name,B])),b=()=>{let B=$();return[...c&&H()?[H()]:[],...[...g].filter(ne=>ne!==H())].filter(ne=>ne!==S()).map(ne=>B.get(ne)??{name:ne,nets:[],missing:!0})},C=(B,Q)=>{i=B,Q&&(l=B.config.auto_wan,d=B.config.wan_device||B.detected.wan||B.saved.wan||"",c=B.config.auto_lan,p=B.config.lan_like,u=B.config.mesh??(B.config.device_mesh?"all":"off"),g=new Set(B.config.lan_devices),h=E()),J()},y=async B=>{let Q=await N.interfaces(s).catch(ne=>(q(ne.message,"error"),null));Q&&C(Q,B)};function z(B){let Q=c&&B.name===H(),ne=!!B.own||!!B.master||B.name===S()||Q;return Q||g.has(B.name)||!ne&&(B.nets.length>0||!!B.missing)}function k(B){let Q=c&&B.name===H(),ne=B.name===S(),fe=!Q&&g.has(B.name),j=!(!!B.own||!!B.master||ne||Q)&&(B.nets.length>0||fe||!!B.missing),Y=(fe||Q)&&!B.zone&&!B.missing,ie=B.missing?_("Not present right now"):B.own?_("This server"):B.master?m(_("Port of %s"),B.master):ne?`${_("Internet")}${B.zone?` · ${m(_("zone %s"),B.zone)}`:""}`:B.nets.length?B.nets.join(", "):_("No IPv4 network"),ve=t("button",{type:"button",class:`dl-if${fe?" sel":""}${Q?" auto":""}${!j&&!fe&&!Q?" off":""}${Y?" warn":""}`,"aria-pressed":fe||Q?"true":"false","aria-disabled":j?null:"true",click:()=>{j&&(g.has(B.name)?g.delete(B.name):g.add(B.name),J())}},[t("span",{class:"dl-if-ic"},v(nl[B.kind]??"link")),t( Line truncated
`).map(e=>At(e)).join(` `).map(e=>At(e)).join(`
`);function Hn(n,e,o,s){let r=n.by==="admin",a=At(n.msg),i=t("div",{class:`dl-row dl-slog-row ${r?"dl-ev-by-admin":`dl-ev-by-system ${dl[n.level]??""}`}${n.detail?" has-detail":""}`},[r?t("span",{class:"dl-ev-tile",title:_("Done by you in LuCI")},v("admin")):t("span",{class:"dl-ev-tile sys",title:pl(n.level)},v(cl[n.src]??"zap")),t("span",{class:"dl-row-main"},r?[...ul(n),n.note?t("span",{class:"dl-muted"},` · ${Ms(n.note)}`):"",n.detail?t("span",{class:`dl-slog-more${e?" open":""}`},v("chevron")):"",n.detail&&e?t("pre",{class:"dl-slog-detail"},Sr(n.detail)):""]:[n.src==="awg"&&n.who&&n.who!=="AmneziaWG"?t("span",{class:"dl-ev-kind"},`${_("Server")} `):"",t("b",{class:"dl-sys-src",title:Ft(n.src)},n.who?n.src==="awg"?n.who:At(n.who):Ft(n.src)),/^[:,]/.test(a)?"":" ",t("span",{class:"dl-muted"},a),n.detail?t("span",{class:`dl-slog-more${e?" open":""}`},v("chevron")):"",n.detail&&e?t("pre",{class:"dl-slog-detail"},Sr(n.detail)):""]),t("span",{class:"dl-faint dl-nowrap",title:new Date(n.ts*1e3).toLocaleString(ie())},s)]);return n.detail&&i.addEventListener("click",l=>{l.target.closest("pre")||o()}),i}function Pr(n){let e=new Date(n*1e3),o=new Date,s=new Date;if(s.setDate(o.getDate()-1),e.toDateString()===o.toDateString())return _("Today");if(e.toDateString()===s.toDateString())return _("Yesterday");let r=e.toLocaleDateString(ie(),{weekday:"long",day:"numeric",month:"long"});return r.charAt(0).toLocaleUpperCase(ie())+r.slice(1)}var Ot=n=>Mt(n).toLocaleDateString(ie(),{day:"numeric",month:"short"});function zn(n,e,o,s=!1){let r=n.slice(-15),a=r[r.length-1],i=a&&e-a[0]<180,l=i?a[2]:0,d=i?a[1]:0,[c,p]=o,u=200,k=40,M=Math.max(1,...r.map($=>Math.max($[1],$[2]))),g=$=>r.map((b,C)=>`${r.length>1?C/(r.length-1)*u:u},${k-2-b[$]/M*(k-6)}`),h=g(2),E=g(1),H=r.length>1&&!s?Tt(`<svg viewBox="0 0 ${u} ${k}" preserveAspectRatio="none" class="dl-speed-chart" aria-hidden="true"><path d="M${h.join(" L")} L${u},${k} L0,${k}Z" class="area"/><path d="M${h.join(" L")}" class="line"/><path d="M${E.join(" L")}" class="line up"/></svg>`):t("div",{class:"dl-speed-wait"},[t("i"),s?"":t("span",{},_("Collecting… 1 point a minute"))]),S=($,b,C,w)=>t("div",{class:"dl-speed-col"},[t("span",{class:"dl-sub"},[t("span",{class:C},b),` ${$}`]),s?t("span",{class:"dl-speed-val off"},"—"):t("span",{class:"dl-speed-val"},Fe(w))]);return r.length>1&&!s&&we(H,()=>{let $=r[r.length-1];return[t("div",{class:"dl-tip-title"},new Date($[0]*1e3).toLocaleTimeString(ie(),{hour:"2-digit",minute:"2-digit"})),t("div",{},`↓ ${Fe($[2])} · ↑ ${Fe($[1])}`)]}),t("div",{class:"dl-bento-tile"},[t("div",{class:"dl-bento-head"},[t("span",{class:"dl-metric-label"},_("Speed now")),s?"":t("span",{class:"dl-sub"},_("last 15 min"))]),t("div",{class:"dl-speed-cols"},[S(_("Download","speed"),"↓","dl-dn",l),S(_("Upload","speed"),"↑","dl-up",d)]),H,t("div",{class:"dl-speed-today"},[t("span",{},ae(_("Today %s"),t("b",{},oe(c+p)))),t("span",{},[t("span",{class:"dl-dn"},"↓"),` ${oe(p)} `,t("span",{class:"dl-up"},"↑"),` ${oe(c)}`])])])}function Rn(n,e){let o=n.slice(-30),s=o.map(d=>d.rx+d.tx),r=Math.max(1,...s),a=s.reduce((d,c)=>d+c,0),i=s.reduce((d,c,p)=>c>s[d]?p:d,0),l=t("div",{class:"dl-bento-bars"},o.map((d,c)=>{let p=s[c],u=t("i",{class:c===o.length-1?"hi":"",style:`height:${Math.max(4,p/r*100)}%`});return we(u,()=>[t("div",{class:"dl-tip-title"},c===o.length-1?`${_("Today")} · ${Ot(d.day)}`:Ot(d.day)),t("div",{},oe(p)),t("div",{class:"dl-muted dl-mono"},`↓ ${oe(d.tx)} ↑ ${oe(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"},oe(a))]),s[i]>0?t("span",{class:"dl-sub"},`${m(_("peak %s"),oe(s[i]))} · ${Ot(o[i].day)}`):""]),o.length?l:t("p",{class:"dl-muted"},_("No traffic yet.")),t("div",{class:"dl-bento-head"},[t("span",{class:"dl-sub"},o.length?Ot(o[0].day):""),t("span",{class:"dl-sub"},e),t("span",{class:"dl-sub"},_("today"))])])}function $r(n){let e=n.slice(-30),o=e.map(r=>r.rx+r.tx),s=Math.max(1,...o);return t("div",{class:"dl-dbars"},e.map((r,a)=>{let i=t("i",{class:`${o[a]?"":"zero"}${a===e.length-1?" hi":""}`});return i.style.height=`${Math.max(8,o[a]/s*100)}%`,we(i,()=>[t("div",{class:"dl-tip-title"},a===e.length-1?`${_("Today")} · ${Ot(r.day)}`:Ot(r.day)),t("div",{},oe(o[a]))]),i}))}function Dr(n){return{apply:_("Repair"),sync:_("Reload devices"),restart:_("Restart service"),netrestart:_("Restart network"),updates:_("Open Components")}[n]??_("Fix")}async function In(n){return n==="netrestart"&&!await me(_("Restart the network?"),_("Every interface restarts. Connections drop for a few seconds."),_("Restart network"))?null:await F(()=>N.healthFix(n),_("Done"))??null}function Ao(n,e,o,s="action"){let r=n.fix;return r?r.startsWith("install:")?A(_("Install"),()=>Er(r.slice(8),o),s):r==="updates"?t("a",{class:`cbi-button cbi-button-${s}`,href:L.url("admin/network/dawnline/updates")},Dr(r)):A(Dr(r),()=>e(r),s):""}fuLine truncated `);function Hn(n,e,o,s){let r=n.by==="admin",a=At(n.msg),i=t("div",{class:`dl-row dl-slog-row ${r?"dl-ev-by-admin":`dl-ev-by-system ${dl[n.level]??""}`}${n.detail?" has-detail":""}`},[r?t("span",{class:"dl-ev-tile",title:_("Done by you in LuCI")},v("admin")):t("span",{class:"dl-ev-tile sys",title:pl(n.level)},v(cl[n.src]??"zap")),t("span",{class:"dl-row-main"},r?[...ul(n),n.note?t("span",{class:"dl-muted"},` · ${Ms(n.note)}`):"",n.detail?t("span",{class:`dl-slog-more${e?" open":""}`},v("chevron")):"",n.detail&&e?t("pre",{class:"dl-slog-detail"},Sr(n.detail)):""]:[n.src==="awg"&&n.who&&n.who!=="AmneziaWG"?t("span",{class:"dl-ev-kind"},`${_("Server")} `):"",t("b",{class:"dl-sys-src",title:Ft(n.src)},n.who?n.src==="awg"?n.who:At(n.who):Ft(n.src)),/^[:,]/.test(a)?"":" ",t("span",{class:"dl-muted"},a),n.detail?t("span",{class:`dl-slog-more${e?" open":""}`},v("chevron")):"",n.detail&&e?t("pre",{class:"dl-slog-detail"},Sr(n.detail)):""]),t("span",{class:"dl-faint dl-nowrap",title:new Date(n.ts*1e3).toLocaleString(le())},s)]);return n.detail&&i.addEventListener("click",l=>{l.target.closest("pre")||o()}),i}function Pr(n){let e=new Date(n*1e3),o=new Date,s=new Date;if(s.setDate(o.getDate()-1),e.toDateString()===o.toDateString())return _("Today");if(e.toDateString()===s.toDateString())return _("Yesterday");let r=e.toLocaleDateString(le(),{weekday:"long",day:"numeric",month:"long"});return r.charAt(0).toLocaleUpperCase(le())+r.slice(1)}var Ot=n=>Mt(n).toLocaleDateString(le(),{day:"numeric",month:"short"});function zn(n,e,o,s=!1){let r=n.slice(-15),a=r[r.length-1],i=a&&e-a[0]<180,l=i?a[2]:0,d=i?a[1]:0,[c,p]=o,u=200,w=40,M=Math.max(1,...r.map($=>Math.max($[1],$[2]))),g=$=>r.map((b,C)=>`${r.length>1?C/(r.length-1)*u:u},${w-2-b[$]/M*(w-6)}`),h=g(2),E=g(1),H=r.length>1&&!s?Tt(`<svg viewBox="0 0 ${u} ${w}" preserveAspectRatio="none" class="dl-speed-chart" aria-hidden="true"><path d="M${h.join(" L")} L${u},${w} L0,${w}Z" class="area"/><path d="M${h.join(" L")}" class="line"/><path d="M${E.join(" L")}" class="line up"/></svg>`):t("div",{class:"dl-speed-wait"},[t("i"),s?"":t("span",{},_("Collecting… 1 point a minute"))]),S=($,b,C,y)=>t("div",{class:"dl-speed-col"},[t("span",{class:"dl-sub"},[t("span",{class:C},b),` ${$}`]),s?t("span",{class:"dl-speed-val off"},"—"):t("span",{class:"dl-speed-val"},Fe(y))]);return r.length>1&&!s&&we(H,()=>{let $=r[r.length-1];return[t("div",{class:"dl-tip-title"},new Date($[0]*1e3).toLocaleTimeString(le(),{hour:"2-digit",minute:"2-digit"})),t("div",{},`↓ ${Fe($[2])} · ↑ ${Fe($[1])}`)]}),t("div",{class:"dl-bento-tile"},[t("div",{class:"dl-bento-head"},[t("span",{class:"dl-metric-label"},_("Speed now")),s?"":t("span",{class:"dl-sub"},_("last 15 min"))]),t("div",{class:"dl-speed-cols"},[S(_("Download","speed"),"↓","dl-dn",l),S(_("Upload","speed"),"↑","dl-up",d)]),H,t("div",{class:"dl-speed-today"},[t("span",{},ae(_("Today %s"),t("b",{},se(c+p)))),t("span",{},[t("span",{class:"dl-dn"},"↓"),` ${se(p)} `,t("span",{class:"dl-up"},"↑"),` ${se(c)}`])])])}function Rn(n,e){let o=n.slice(-30),s=o.map(d=>d.rx+d.tx),r=Math.max(1,...s),a=s.reduce((d,c)=>d+c,0),i=s.reduce((d,c,p)=>c>s[d]?p:d,0),l=t("div",{class:"dl-bento-bars"},o.map((d,c)=>{let p=s[c],u=t("i",{class:c===o.length-1?"hi":"",style:`height:${Math.max(4,p/r*100)}%`}),w=t("span",{},[u]);return we(w,()=>[t("div",{class:"dl-tip-title"},c===o.length-1?`${_("Today")} · ${Ot(d.day)}`:Ot(d.day)),t("div",{},se(p)),t("div",{class:"dl-muted dl-mono"},`↓ ${se(d.tx)} ↑ ${se(d.rx)}`)]),w}));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"},se(a))]),s[i]>0?t("span",{class:"dl-sub"},`${m(_("peak %s"),se(s[i]))} · ${Ot(o[i].day)}`):""]),o.length?l:t("p",{class:"dl-muted"},_("No traffic yet.")),t("div",{class:"dl-bento-head"},[t("span",{class:"dl-sub"},o.length?Ot(o[0].day):""),t("span",{class:"dl-sub"},e),t("span",{class:"dl-sub"},_("today"))])])}function $r(n){let e=n.slice(-30),o=e.map(r=>r.rx+r.tx),s=Math.max(1,...o);return t("div",{class:"dl-dbars"},e.map((r,a)=>{let i=t("i",{class:`${o[a]?"":"zero"}${a===e.length-1?" hi":""}`});i.style.height=`${Math.max(8,o[a]/s*100)}%`;let l=t("span",{},[i]);return we(l,()=>[t("div",{class:"dl-tip-title"},a===e.length-1?`${_("Today")} · ${Ot(r.day)}`:Ot(r.day)),t("div",{},se(o[a]))]),l}))}function Dr(n){return{apply:_("Repair"),sync:_("Reload devices"),restart:_("Restart service"),netrestart:_("Restart network"),updates:_("Open Components")}[n]??_("Fix")}async function In(n){return n==="netrestart"&&!await me(_("Restart the network?"),_("Every interface restarts. Connections drop for a few seconds."),_("Restart network"))?null:await F(()=>N.healthFix(n),_("Done"))??null}function Ao(n,e,o,s="action"){let r=n.fix;return r?r.startsWith("install:")?A(_("Install"),()=>Er(r.slice(8),o),s):r==="updates"?t("a",{class:`cbi-button cbi-button-${s}`,href:L.url("admin/network/dawnline/uLine truncated
`)){let d=l.trimEnd();if(a){/^```/.test(d.trim())?(e.push(t("pre",{},a.join(` `)){let d=l.trimEnd();if(a){/^```/.test(d.trim())?(e.push(t("pre",{},a.join(`
`))),a=null):a.push(l);continue}if(/^```/.test(d.trim())){i(),a=[];continue}let c=/^(#{1,6})\s+(.*)$/.exec(d),p=/^\s*[-*+]\s+(.*)$/.exec(d)??/^\s*\d+[.)]\s+(.*)$/.exec(d);c?(i(),e.push(t("h5",{},o(c[2])))):p?(r.length&&i(),s||(s=t("ul",{}),e.push(s)),s.appendChild(t("li",{},o(p[1])))):d.trim()?(s&&(s=null),r.push(d.trim())):i()}return a&&e.push(t("pre",{},a.join(` `))),a=null):a.push(l);continue}if(/^```/.test(d.trim())){i(),a=[];continue}let c=/^(#{1,6})\s+(.*)$/.exec(d),p=/^\s*[-*+]\s+(.*)$/.exec(d)??/^\s*\d+[.)]\s+(.*)$/.exec(d);c?(i(),e.push(t("h5",{},o(c[2])))):p?(r.length&&i(),s||(s=t("ul",{}),e.push(s)),s.appendChild(t("li",{},o(p[1])))):d.trim()?(s&&(s=null),r.push(d.trim())):i()}return a&&e.push(t("pre",{},a.join(`
`))),i(),e}function Kr(n){let e=[],o=!1;for(let s of n.replace(/\r/g,"").split(` `))),i(),e}function Kr(n){let e=[],o=!1;for(let s of n.replace(/\r/g,"").split(`
`)){let r=/^#{1,6}\s+(.*)$/.exec(s);if(r){if(o=/^install\b/i.test(r[1].trim()),/^what.s new$/i.test(r[1].trim()))continue}else/^\*\*Full Changelog\*\*/.test(s)&&(o=!1);o||e.push(s)}return e.join(` `)){let r=/^#{1,6}\s+(.*)$/.exec(s);if(r){if(o=/^install\b/i.test(r[1].trim()),/^what.s new$/i.test(r[1].trim()))continue}else/^\*\*Full Changelog\*\*/.test(s)&&(o=!1);o||e.push(s)}return e.join(`
`).replace(/\n{3,}/g,` `).replace(/\n{3,}/g,`
`).trim()}async function sn(n,e,o,s){let r=t("div",{class:"dl-notes"},t("p",{class:"dl-muted dl-loading"},_("Loading release notes…"))),a=t("div",{class:"dl-op-head"}),i="";de(o,[a,r],[A([v("copy")," ",_("Copy")],()=>xe(i,_("Release notes copied")))," ",ue(_("Close"))],"wide");try{let l=await N.updatesNotes(n,e,s??"");i=Kr(l.body||"");let d=qr(l.url);dom.content(a,[l.published?t("span",{class:"dl-pill"},Oe(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")," ",v("open")]):""]),dom.content(r,i.trim()?Fr(i):t("p",{class:"dl-muted"},_("This release has no notes.")))}catch(l){dom.content(r,t("p",{class:"dl-muted"},Ce(l)))}}function yl(n){let e={"6h":_("checks every 6 h"),"12h":_("checks every 12 h"),"1d":_("checks daily"),"7d":_("checks weekly")};return e[n]??e["1d"]}var Ro=n=>n?Oe(n):"";function kl(n){let e=/^(.{20,}?)(?:;\s|:\s)/.exec(n)?.[1];return e||(n.length<=90?n:`${n.slice(0,90).replace(/[\s,;:]+\S*$/,"")}…`)}function Vr(n,e){let o=n.st,s=o.policy,r=o.kept?.app,a=e?.update&&e.tag?e.tag:o.version,i=k=>()=>sn("app",k,m(_("What’s new in Dawnline %s"),k.replace(/^v/,""))),l=e?.tag&&(e.update||e.status==="latest")?_l(n,e.tag,e.update?o.version:""):null,d=e?.tag??a,c=s.check&&o.auto?.check?o.auto.check+({"6h":6,"12h":12,"1d":24,"7d":168}[s.interval]??24)*3600:0,p=(k,M)=>t("div",{class:"dl-stack gap4"},[t("span",{class:"dl-metric-label"},k),t("span",{class:"dl-comp-side-v"},M)]),u=[{label:_("What’s new"),ic:"file",run:i(a)},{label:_("Open on GitHub"),ic:"globe",run:()=>window.open(`https://github.com/${o.repo}`,"_blank","noopener")},null,{label:m(_("Reinstall %s"),o.version),ic:"reset",warn:!0,run:()=>n.op("app:reinstall",_("Reinstalling Dawnline"),o.version)},r?{label:m(_("Roll back to %s"),r.version),ic:"archive",warn:!0,run:async()=>{await me(m(_("Roll back to Dawnline %s?"),r.version),m(_("The copy kept on the router replaces %s. A backup of the settings is made first."),o.version),_("Roll back"))&&n.op("app:rollback",_("Rolling back Dawnline"),o.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"},v("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"),o.version),u,!0)]),t("div",{class:"dl-comp-verrow"},[t("div",{class:"dl-stack"},[t("div",{class:"dl-comp-big"},[o.version,e?.update?t("small",{},`→ ${e.latest}`):e?.status==="dev"&&e.latest?t("small",{class:"dl-faint"},m(_("release %s"),e.latest)):""]),t("span",{class:"dl-faint dl-comp-meta"},e?.error?"":e?.update?e.published?m(_("released %s"),Ro(e.published)):"":e?.status==="dev"?_("ahead of the latest release"):e?[_("latest release"),e.published?m(_("released %s"),Ro(e.published)):""].filter(Boolean).join(" · "):_("not checked yet"))])]),l?.items.length?t("div",{class:"dl-stack gap4"},[t("ul",{class:"dl-comp-bullets"},l.items.map(k=>t("li",{},k))),l.total>l.items.length?t("button",{type:"button",class:"dl-linkbtn dl-comp-more",click:i(d)},W(l.total-l.items.length,"+%s more in What’s new","+%s 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"},[A(_("Update now"),()=>n.op("app",_("Updating Dawnline"),o.version),"positive",{disabled:n.busy}),A(_("What’s new"),i(a))]):"",Ll(n),Cl(n)]),t("div",{class:"dl-comp-hero-side"},[p(_("Source"),[v("globe"),t("a",{href:`https://github.com/${o.repo}`,target:"_blank",rel:"noopener"},o.repo)]),p(_("Auto-update"),[s.auto?Pe("ok",_("On")):Pe("",_("Off")),t("span",{class:"dl-muted"},s.auto?s.mode==="immediate"?_("as soon as found"):m(s.interval==="7d"?_("weekly at %s"):_("daily at %s"),s.time):s.check?yl(s.interval):_("checks off"))]),p(_("Last check"),o.check?[pe(o.check.time,o.now),c>o.now?t("span",{class:"dl-faint"},`· ${m(_("next in %s"),ot(c-o.now))}`):""]:[_("Never")]),p(_("Rollback"),r?[t("span",{class:"dl-mono"},r.version),t("span",{class:"dl-faint"},_("kept on flash"))]:[t("span",{class:"dl-muted"},s.keep?_("Kept after the next update"):_("Off"))])])])}function _l(n,e,o){if(n.notes.has(e))return n.notes.get(e)??null;n.notes.set(e,null);let s=r=>r.replace(/\*\*|`|\[([^\]]+)\]\([^)]*\)/g,(a,i)=>i??"").trim();return(async()=>{let a=((await N.updatesNotes("app",e,"").catch(()=>null))?.body??"").split(` `).trim()}async function sn(n,e,o,s){let r=t("div",{class:"dl-notes"},t("p",{class:"dl-muted dl-loading"},_("Loading release notes…"))),a=t("div",{class:"dl-op-head"}),i="";de(o,[a,r],[A([v("copy")," ",_("Copy")],()=>xe(i,_("Release notes copied")))," ",ue(_("Close"))],"wide");try{let l=await N.updatesNotes(n,e,s??"");i=Kr(l.body||"");let d=qr(l.url);dom.content(a,[l.published?t("span",{class:"dl-pill"},Oe(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")," ",v("open")]):""]),dom.content(r,i.trim()?Fr(i):t("p",{class:"dl-muted"},_("This release has no notes.")))}catch(l){dom.content(r,t("p",{class:"dl-muted"},Ce(l)))}}function yl(n){let e={"6h":_("checks every 6 h"),"12h":_("checks every 12 h"),"1d":_("checks daily"),"7d":_("checks weekly")};return e[n]??e["1d"]}var Ro=n=>n?Oe(n):"";function kl(n){let e=/^(.{20,}?)(?:;\s|:\s)/.exec(n)?.[1];return e||(n.length<=90?n:`${n.slice(0,90).replace(/[\s,;:]+\S*$/,"")}…`)}function Vr(n,e){let o=n.st,s=o.policy,r=o.kept?.app,a=e?.update&&e.tag?e.tag:o.version,i=w=>()=>sn("app",w,m(_("What’s new in Dawnline %s"),w.replace(/^v/,""))),l=e?.tag&&(e.update||e.status==="latest")?_l(n,e.tag,e.update?o.version:""):null,d=e?.tag??a,c=s.check&&o.auto?.check?o.auto.check+({"6h":6,"12h":12,"1d":24,"7d":168}[s.interval]??24)*3600:0,p=(w,M)=>t("div",{class:"dl-stack gap4"},[t("span",{class:"dl-metric-label"},w),t("span",{class:"dl-comp-side-v"},M)]),u=[{label:_("What’s new"),ic:"file",run:i(a)},{label:_("Open on GitHub"),ic:"globe",run:()=>window.open(`https://github.com/${o.repo}`,"_blank","noopener")},null,{label:m(_("Reinstall %s"),o.version),ic:"reset",warn:!0,run:()=>n.op("app:reinstall",_("Reinstalling Dawnline"),o.version)},r?{label:m(_("Roll back to %s"),r.version),ic:"archive",warn:!0,run:async()=>{await me(m(_("Roll back to Dawnline %s?"),r.version),m(_("The copy kept on the router replaces %s. A backup of the settings is made first."),o.version),_("Roll back"))&&n.op("app:rollback",_("Rolling back Dawnline"),o.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"},v("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"),o.version),u,!0)]),t("div",{class:"dl-comp-verrow"},[t("div",{class:"dl-stack"},[t("div",{class:"dl-comp-big"},[o.version,e?.update?t("small",{},`→ ${e.latest}`):e?.status==="dev"&&e.latest?t("small",{class:"dl-faint"},m(_("release %s"),e.latest)):""]),t("span",{class:"dl-faint dl-comp-meta"},e?.error?"":e?.update?e.published?m(_("released %s"),Ro(e.published)):"":e?.status==="dev"?_("ahead of the latest release"):e?[_("latest release"),e.published?m(_("released %s"),Ro(e.published)):""].filter(Boolean).join(" · "):_("not checked yet"))])]),l?.items.length?t("div",{class:"dl-stack gap4"},[t("ul",{class:"dl-comp-bullets"},l.items.map(w=>t("li",{},w))),l.total>l.items.length?t("button",{type:"button",class:"dl-linkbtn dl-comp-more",click:i(d)},W(l.total-l.items.length,"+%s more in What’s new","+%s 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"},[A(_("Update now"),()=>n.op("app",_("Updating Dawnline"),o.version),"positive",{disabled:n.busy}),A(_("What’s new"),i(a))]):"",Ll(n),Cl(n)]),t("div",{class:"dl-comp-hero-side"},[p(_("Source"),[v("globe"),t("a",{href:`https://github.com/${o.repo}`,target:"_blank",rel:"noopener"},o.repo)]),p(_("Auto-update"),[s.auto?Pe("ok",_("On")):Pe("",_("Off")),t("span",{class:"dl-muted"},s.auto?s.mode==="immediate"?_("as soon as found"):m(s.interval==="7d"?_("weekly at %s"):_("daily at %s"),s.time):s.check?yl(s.interval):_("checks off"))]),p(_("Last check"),o.check?[pe(o.check.time,o.now),c>o.now?t("span",{class:"dl-faint"},`· ${m(_("next in %s"),ot(c-o.now))}`):""]:[_("Never")]),p(_("Rollback"),r?[t("span",{class:"dl-mono"},r.version),t("span",{class:"dl-faint"},_("kept on flash"))]:[t("span",{class:"dl-muted"},s.keep?_("Kept after the next update"):_("Off"))])])])}function _l(n,e,o){if(n.notes.has(e))return n.notes.get(e)??null;n.notes.set(e,null);let s=r=>r.replace(/\*\*|`|\[([^\]]+)\]\([^)]*\)/g,(a,i)=>i??"").trim();return(async()=>{let a=((await N.updatesNotes("app",e,"").catch(()=>null))?.body??"").split(`
`).map(l=>/^\s*[-*+]\s+(.*)$/.exec(l)?.[1]).filter(l=>!!l);a.length||(a=(await N.updatesChanges(o,e).catch(()=>null))?.items??[]);let i={items:a.slice(0,3).map(l=>kl(s(l))),total:a.length};n.notes.set(e,i),i.items.length&&n.root.isConnected&&n.paint()})(),null}function jn(n){return n==="ru"?_("Russian translation"):n}function Cl(n){let e=(n.st.translations??[]).includes("ru"),o=ye(e,jn("ru"),r=>{n.op(r?"app:lang:ru":"app:nolang",r?_("Adding the Russian translation"):_("Removing the Russian translation"),n.st.version)});o.disabled=n.busy;let s=t("details",{class:"dl-params dl-comp-fold",open:n.langOpen?"open":null},[t("summary",{},[v("chevron"),t("span",{},_("Translation")),t("span",{class:"dl-sub"},e?_("Russian"):_("English only"))]),t("div",{class:"dl-params-body"},[t("div",{class:"dl-list"},[t("div",{class:"dl-row"},[t("span",{class:"dl-row-main dl-stack"},[t("b",{},jn("ru")),t("span",{class:"dl-sub"},_("LuCI pages for Dawnline"))]),t("span",{class:"dl-comp-bact"},o)])])])]);return s.addEventListener("toggle",()=>n.langOpen=s.open),s}function Ll(n){let e=t("div",{class:"dl-params-body"}),o=t("details",{class:"dl-params dl-comp-vers",open:n.versOpen?"open":null},[t("summary",{},[v("chevron"),t("span",{},_("Versions")),t("span",{class:"dl-sub"},_("install any release"))]),e]);return o.addEventListener("toggle",()=>{n.versOpen=o.open,n.versOpen&&Un(n,e)}),n.versOpen&&Un(n,e),o}async function Un(n,e){let o=he("",{placeholder:_("Tag, e.g. 0.3.1"),class:"cbi-input-text dl-mono","aria-label":_("Release tag")}),s=p=>{if(p=p.trim(),!/^v?[0-9][0-9A-Za-z.+~-]{0,40}$/.test(p))return q(_("Enter a release tag like 0.3.1"),"warning");Yr(n,p)};o.addEventListener("keydown",p=>{p.key==="Enter"&&(p.preventDefault(),s(o.value))});let r=t("div",{class:"dl-comp-tag"},[o,A(_("Install"),()=>s(o.value),"neutral",{disabled:n.busy})]),a=n.versPage,i=p=>{n.versPage=Math.max(1,n.versPage+p),Un(n,e)},l=p=>t("div",{class:"dl-comp-pager"},[t("button",{type:"button",class:"dl-linkbtn",disabled:a<=1?"disabled":null,click:()=>i(-1)},_("← Newer")),t("span",{class:"dl-faint"},m(_("Page %s"),a)),t("button",{type:"button",class:"dl-linkbtn",disabled:p?null:"disabled",click:()=>i(1)},_("Older →"))]),d=n.versCache.get(a);if(!d){dom.content(e,[r,t("p",{class:"dl-muted dl-loading"},_("Loading versions…"))]);try{d=(await N.updatesReleases(a)).releases}catch(p){if(a!==n.versPage||!e.isConnected)return;dom.content(e,[r,t("div",{class:"dl-row-actions"},[t("span",{class:"dl-muted"},m(_("Failed to load versions: %s"),Ce(p))),A(_("Try again"),()=>Un(n,e))]),l(!1)]);return}if(n.versCache.set(a,d),a!==n.versPage||!e.isConnected)return}if(!d.length)return dom.content(e,[r,t("p",{class:"dl-muted"},a>1?_("No more versions."):_("No versions found.")),l(!1)]);let c=n.st.version;dom.content(e,[r,...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"},Ro(p.published)),p.prerelease?Pe("warn",_("Pre-release")):"",t("span",{class:"dl-comp-ic"},$e("file",_("What’s new"),()=>sn("app",p.tag,m(_("What’s new in Dawnline %s"),u)))),u===c?Pe("ok",_("Installed")):A(_("Install"),()=>Yr(n,p.tag),"neutral",{disabled:n.busy})])}),l(d.length>=5)])}async function Yr(n,e){let o=e.replace(/^v/,"");o.localeCompare(n.st.version,void 0,{numeric:!0})<0&&!await me(m(_("Install Dawnline %s?"),o),m(_("It is older than %s. A backup of the settings is made first; restore it from Settings if something looks wrong."),n.st.version),_("Install"))||n.op(`app@${e}`,m(_("Installing Dawnline %s"),o),n.st.version)}function Jr(n,e){let o=n.st,s=o.kept?.amneziawg,r=e?.sources??{},a=Object.keys(r),i=e?.current??null,l=i?r[i]:void 0,d=!!e?.ru,c=o.needs?.awg??[],p=c.length?null:e?.installed??null,u=[];i&&p&&u.push({label:_("Reinstall this build"),warn:!0,ic:"reset",run:()=>n.op(`amneziawg:${i}${d?":ru":""}`,_("Reinstalling AmneziaWG"),p)}),s&&u.push({label:m(_("Roll back to %s"),s.version),ic:"archive",warn:!0,run:async()=>{await me(m(_("Roll back AmneziaWG to %s?"),s.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 k=[e?.release?{label:_("What’s new"),ic:"file",run:()=>sn("amneziawg",e.release,m(_("What’s new in the %s build"),l?.label??"AmneziaWG"),i??"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((y,f,x)=>y!==null||f>0&&x[f-1]!==null),M=o.tunnels??[],g=M.length?M.length===1?m(_("Switching restarts the tunnel for a few seconds: %s. Devices keep their configurations."),M[0]):m(N_(M.length,"Switching restarts %s tunnel for a few seconds: %s. Devices keep their configurations.","Switching restarts %s tunnels for a few seconds: %s. Devices keep their configurations."),K(M.length),M.join(", ")):_("Switching takes a few Line truncated `).map(l=>/^\s*[-*+]\s+(.*)$/.exec(l)?.[1]).filter(l=>!!l);a.length||(a=(await N.updatesChanges(o,e).catch(()=>null))?.items??[]);let i={items:a.slice(0,3).map(l=>kl(s(l))),total:a.length};n.notes.set(e,i),i.items.length&&n.root.isConnected&&n.paint()})(),null}function jn(n){return n==="ru"?_("Russian translation"):n}function Cl(n){let e=(n.st.translations??[]).includes("ru"),o=ye(e,jn("ru"),r=>{n.op(r?"app:lang:ru":"app:nolang",r?_("Adding the Russian translation"):_("Removing the Russian translation"),n.st.version)});o.disabled=n.busy;let s=t("details",{class:"dl-params dl-comp-fold",open:n.langOpen?"open":null},[t("summary",{},[v("chevron"),t("span",{},_("Translation")),t("span",{class:"dl-sub"},e?_("Russian"):_("English only"))]),t("div",{class:"dl-params-body"},[t("div",{class:"dl-list"},[t("div",{class:"dl-row"},[t("span",{class:"dl-row-main dl-stack"},[t("b",{},jn("ru")),t("span",{class:"dl-sub"},_("LuCI pages for Dawnline"))]),t("span",{class:"dl-comp-bact"},o)])])])]);return s.addEventListener("toggle",()=>n.langOpen=s.open),s}function Ll(n){let e=t("div",{class:"dl-params-body"}),o=t("details",{class:"dl-params dl-comp-vers",open:n.versOpen?"open":null},[t("summary",{},[v("chevron"),t("span",{},_("Versions")),t("span",{class:"dl-sub"},_("install any release"))]),e]);return o.addEventListener("toggle",()=>{n.versOpen=o.open,n.versOpen&&Un(n,e)}),n.versOpen&&Un(n,e),o}async function Un(n,e){let o=he("",{placeholder:_("Tag, e.g. 0.3.1"),class:"cbi-input-text dl-mono","aria-label":_("Release tag")}),s=p=>{if(p=p.trim(),!/^v?[0-9][0-9A-Za-z.+~-]{0,40}$/.test(p))return q(_("Enter a release tag like 0.3.1"),"warning");Yr(n,p)};o.addEventListener("keydown",p=>{p.key==="Enter"&&(p.preventDefault(),s(o.value))});let r=t("div",{class:"dl-comp-tag"},[o,A(_("Install"),()=>s(o.value),"neutral",{disabled:n.busy})]),a=n.versPage,i=p=>{n.versPage=Math.max(1,n.versPage+p),Un(n,e)},l=p=>t("div",{class:"dl-comp-pager"},[t("button",{type:"button",class:"dl-linkbtn",disabled:a<=1?"disabled":null,click:()=>i(-1)},_("← Newer")),t("span",{class:"dl-faint"},m(_("Page %s"),a)),t("button",{type:"button",class:"dl-linkbtn",disabled:p?null:"disabled",click:()=>i(1)},_("Older →"))]),d=n.versCache.get(a);if(!d){dom.content(e,[r,t("p",{class:"dl-muted dl-loading"},_("Loading versions…"))]);try{d=(await N.updatesReleases(a)).releases}catch(p){if(a!==n.versPage||!e.isConnected)return;dom.content(e,[r,t("div",{class:"dl-row-actions"},[t("span",{class:"dl-muted"},m(_("Failed to load versions: %s"),Ce(p))),A(_("Try again"),()=>Un(n,e))]),l(!1)]);return}if(n.versCache.set(a,d),a!==n.versPage||!e.isConnected)return}if(!d.length)return dom.content(e,[r,t("p",{class:"dl-muted"},a>1?_("No more versions."):_("No versions found.")),l(!1)]);let c=n.st.version;dom.content(e,[r,...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"},Ro(p.published)),p.prerelease?Pe("warn",_("Pre-release")):"",t("span",{class:"dl-comp-ic"},$e("file",_("What’s new"),()=>sn("app",p.tag,m(_("What’s new in Dawnline %s"),u)))),u===c?Pe("ok",_("Installed")):A(_("Install"),()=>Yr(n,p.tag),"neutral",{disabled:n.busy})])}),l(d.length>=5)])}async function Yr(n,e){let o=e.replace(/^v/,"");o.localeCompare(n.st.version,void 0,{numeric:!0})<0&&!await me(m(_("Install Dawnline %s?"),o),m(_("It is older than %s. A backup of the settings is made first; restore it from Settings if something looks wrong."),n.st.version),_("Install"))||n.op(`app@${e}`,m(_("Installing Dawnline %s"),o),n.st.version)}function Jr(n,e){let o=n.st,s=o.kept?.amneziawg,r=e?.sources??{},a=Object.keys(r),i=e?.current??null,l=i?r[i]:void 0,d=!!e?.ru,c=o.needs?.awg??[],p=c.length?null:e?.installed??null,u=[];i&&p&&u.push({label:_("Reinstall this build"),warn:!0,ic:"reset",run:()=>n.op(`amneziawg:${i}${d?":ru":""}`,_("Reinstalling AmneziaWG"),p)}),s&&u.push({label:m(_("Roll back to %s"),s.version),ic:"archive",warn:!0,run:async()=>{await me(m(_("Roll back AmneziaWG to %s?"),s.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 w=[e?.release?{label:_("What’s new"),ic:"file",run:()=>sn("amneziawg",e.release,m(_("What’s new in the %s build"),l?.label??"AmneziaWG"),i??"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((k,f,x)=>k!==null||f>0&&x[f-1]!==null),M=o.tunnels??[],g=M.length?M.length===1?m(_("Switching restarts the tunnel for a few seconds: %s. Devices keep their configurations."),M[0]):m(N_(M.length,"Switching restarts %s tunnel for a few seconds: %s. Devices keep their configurations.","Switching restarts %s tunnels for a few seconds: %s. Devices keep their configurations."),K(M.length),M.join(", ")):_("Switching takes a few Line truncated
`)}r.push(p),l+=c-1}let i=A([v("more")],()=>Se(i,[{label:_("Export CSV"),icon:v("download"),run:()=>Qe(o,s,"csv",e.id)},{label:_("Export JSON"),icon:v("download"),run:()=>Qe(o,s,"json",e.id)},null,{label:m(_("Clear %s's activity"),e.name),icon:v("trash"),danger:!0,run:()=>lt(m(_("Clear %s's activity"),e.name),m(_("Removes events about %s and their devices."),e.name),{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"},s.length>10?m(_("latest 10 of %s"),K(s.length)):""),t("span",{class:"dl-spacer"}),i]),r.length?r:t("div",{class:"dl-row dl-muted"},_("Nothing yet."))])}var Gn=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[o,s,r]=await Promise.all([N.status(30),e?N.events(2e3,this.id).catch(()=>null):Promise.resolve(null),e?N.personUsage(this.id,30).catch(()=>null):Promise.resolve(null)]);return{st:o,ev:s?.events??null,use:r}}async load(){return this.id=new URLSearchParams(location.search).get("id")??"",this.fetch(!0)}render(e){this.take(e);let o=this.st.people.find(i=>i.id===this.id);if(!o)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=o;for(let i of["crumbs","head","devices","traffic","places","activity","limits"])this.parts[i]=t("div",{});this.parts.devices.className="dl-person-devices";let s=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 r=new URLSearchParams(location.search),a=r.get("device")&&o.devices.find(i=>i.id===r.get("device"));return a?setTimeout(()=>Je(this.p,a,this.deviceOpts()),50):r.get("add")&&setTimeout(()=>ct(this.p,this.deviceOpts()),50),this.poller=pt({fetch:i=>{let l=i||this.fullNext||++this.ticks%4===0;return this.fullNext=!1,this.fetch(l)},every:15,live:!0,active:()=>s.isConnected,apply:(i,l)=>this.apply(i,l)}),s}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,o){this.take(e);let s=this.st.people.find(r=>r.id===this.id);if(!s){o||(location.href=It(this.p?.server));return}this.p=s,this.paint(o),this.map?.update(this.mapData())}async refresh(){this.fullNext=!0,await this.poller?.refresh()}async patch(e,o){var a;this.poller?.claim();let s=await F(()=>N.personUpdate(this.p.id,e),o);if(!s)return!1;this.poller?.claim();let r=this.st.people.findIndex(i=>i.id===this.p.id);return(a=s.person).rate??(a.rate=this.p.rate),r>=0&&(this.st.people[r]=s.person),this.p=s.person,this.paint(),!0}get today(){return Ge(this.series.length?this.series:this.st.series)}get core(){return zt(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:It(e.server)},this.st.servers.find(o=>o.id===e.server)?.name??_("Servers")),t("span",{},"/"),t("a",{href:It(e.server)},_("People")),t("span",{},"/"),t("span",{},e.name)])}paint(e=!1){Ae(this.parts.crumbs,this.crumbs(),e),Ae(this.parts.head,aa(this),e),Ae(this.parts.traffic,ia(this),e),Ae(this.parts.devices,la(this),e),Ae(this.parts.limits,fa(this),e),this.paintPlaces(e),Ae(this.parts.activity,va(this),e)}paintPlaces(e=!1){let o=ga(this);o&&Ae(this.parts.places,o,e&&!this.mapOpen)}};var zl={ok:"check",warn:"alert",error:"x",skip:"pause"},qn=class{constructor(e,o,s,r){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=o,this.events=s,this.toLog=r,dom.content(this.el,[this.summary,this.wdEl,t("div",{class:"dl-health-cols"},[this.checksEl,this.recentEl])]),this.paintChecks(),this.paintLive(o,s)}async run(e){let o=e?await In(e):await N.health().catch(()=>null);o&&(this.take(o),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 o=e.filter(i=>i.status==="error").length,s=e.filter(i=>i.status==="warn").length;dom.content(this.summary,o?bt("error",W Line truncated `)}r.push(p),l+=c-1}let i=A([v("more")],()=>Se(i,[{label:_("Export CSV"),icon:v("download"),run:()=>Qe(o,s,"csv",e.id)},{label:_("Export JSON"),icon:v("download"),run:()=>Qe(o,s,"json",e.id)},null,{label:m(_("Clear %s's activity"),e.name),icon:v("trash"),danger:!0,run:()=>lt(m(_("Clear %s's activity"),e.name),m(_("Removes events about %s and their devices."),e.name),{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"},s.length>10?m(_("latest 10 of %s"),K(s.length)):""),t("span",{class:"dl-spacer"}),i]),r.length?r:t("div",{class:"dl-row dl-muted"},_("Nothing yet."))])}var Gn=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[o,s,r]=await Promise.all([N.status(30),e?N.events(2e3,this.id).catch(()=>null):Promise.resolve(null),e?N.personUsage(this.id,30).catch(()=>null):Promise.resolve(null)]);return{st:o,ev:s?.events??null,use:r}}async load(){return this.id=new URLSearchParams(location.search).get("id")??"",this.fetch(!0)}render(e){this.take(e);let o=this.st.people.find(i=>i.id===this.id);if(!o)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=o;for(let i of["crumbs","head","devices","traffic","places","activity","limits"])this.parts[i]=t("div",{});this.parts.devices.className="dl-person-devices";let s=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 r=new URLSearchParams(location.search),a=r.get("device")&&o.devices.find(i=>i.id===r.get("device"));return a?setTimeout(()=>Je(this.p,a,this.deviceOpts()),50):r.get("add")&&setTimeout(()=>ct(this.p,this.deviceOpts()),50),this.poller=pt({fetch:i=>{let l=i||this.fullNext||++this.ticks%4===0;return this.fullNext=!1,this.fetch(l)},every:15,live:!0,active:()=>s.isConnected,apply:(i,l)=>this.apply(i,l)}),s}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,o){this.take(e);let s=this.st.people.find(r=>r.id===this.id);if(!s){o||(location.href=It(this.p?.server));return}this.p=s,this.paint(o),this.map?.update(this.mapData())}async refresh(){this.fullNext=!0,await this.poller?.refresh()}async patch(e,o){var a;this.poller?.claim();let s=await F(()=>N.personUpdate(this.p.id,e),o);if(!s)return!1;this.poller?.claim();let r=this.st.people.findIndex(i=>i.id===this.p.id);return(a=s.person).rate??(a.rate=this.p.rate),r>=0&&(this.st.people[r]=s.person),this.p=s.person,this.paint(),!0}get today(){return Ge(this.series.length?this.series:this.st.series)}get core(){return zt(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:It(e.server)},this.st.servers.find(o=>o.id===e.server)?.name??_("Servers")),t("span",{},"/"),t("a",{href:It(e.server)},_("People")),t("span",{},"/"),t("span",{},e.name)])}paint(e=!1){Ae(this.parts.crumbs,this.crumbs(),e),Ae(this.parts.head,aa(this),e),Ae(this.parts.traffic,ia(this),e),Ae(this.parts.devices,la(this),e),Ae(this.parts.limits,fa(this),e),this.paintPlaces(e),Ae(this.parts.activity,va(this),e)}paintPlaces(e=!1){let o=ga(this);o&&Ae(this.parts.places,o,e&&!this.mapOpen)}};var zl={ok:"check",warn:"alert",error:"x",skip:"pause"},qn=class{constructor(e,o,s,r){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=o,this.events=s,this.toLog=r,dom.content(this.el,[this.summary,this.wdEl,t("div",{class:"dl-health-cols"},[this.checksEl,this.recentEl])]),this.paintChecks(),this.paintLive(o,s)}async run(e){let o=e?await In(e):await N.health().catch(()=>null);o&&(this.take(o),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 o=e.filter(i=>i.status==="error").length,s=e.filter(i=>i.status==="warn").length;dom.content(this.summary,o?bt("error",W Line truncated
`);function Aa(){let n=document.createElement("style");return n.dataset.dawnline="1",n.textContent=td,n}function yt(n){return()=>{let e=new n;return Object.assign({load:()=>e.load(),render:async s=>{let r=await e.render(s),a=document.createElement("div");return a.className="dl-root",a.append(Aa(),r),a},addFooter(){return e.noFooter?document.createElement("div"):this.super("addFooter",[])}},{handleSave:null,handleSaveApply:null,handleReset:null})}}var Jb=yt(on),Zb=yt(wt),Qb=yt(on),Xb=yt(On),e0=yt(Gn),t0=yt(Yn),n0=yt(Wn);function Na(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 o0=Na(""),s0=Na("log");return baseclass.extend({ activity: s0, diagnostics: t0, health: o0, overview: Jb, people: Zb, person: e0, server: Qb, settings: Xb, updates: n0 }); `);function Aa(){let n=document.createElement("style");return n.dataset.dawnline="1",n.textContent=td,n}function yt(n){return()=>{let e=new n;return Object.assign({load:()=>e.load(),render:async s=>{let r=await e.render(s),a=document.createElement("div");return a.className="dl-root",a.append(Aa(),r),a},addFooter(){return e.noFooter?document.createElement("div"):this.super("addFooter",[])}},{handleSave:null,handleSaveApply:null,handleReset:null})}}var Jb=yt(on),Zb=yt(wt),Qb=yt(on),Xb=yt(On),e0=yt(Gn),t0=yt(Yn),n0=yt(Wn);function Na(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 o0=Na(""),s0=Na("log");return baseclass.extend({ activity: s0, diagnostics: t0, health: o0, overview: Jb, people: Zb, person: e0, server: Qb, settings: Xb, updates: n0 });
@@ -1 +1 @@
@font-face{font-family:Geist;src:url(geist-latin-wght-normal.woff2) format("woff2");font-weight:100 900;font-display:swap;unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2190-21FF,U+2212,U+2215}@font-face{font-family:Geist;src:url(geist-cyrillic-wght-normal.woff2) format("woff2");font-weight:100 900;font-display:swap;unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:Geist Mono;src:url(geist-mono-latin-wght-normal.woff2) format("woff2");font-weight:100 900;font-display:swap}:root{color-scheme:dark;--bg: #080808;--raised: #121212;--field: #161616;--knob: #232323;--seg: rgba(237, 237, 237, .05);--seg-shadow: none;--line: rgba(255, 255, 255, .06);--text: #ededed;--text-2: #8c8c8a;--text-3: #4f4f4e;--accent: #4eafff;--accent-ink: #ffffff;--accent-soft: rgba(78, 175, 255, .13);--ok: #57d64b;--ok-soft: rgba(87, 214, 75, .14);--warn: #ff8a3d;--bad: #ff5c5c;--bad-soft: rgba(255, 92, 92, .13);--sel-bg: rgba(131, 209, 255, .25);--sel-fg: #64c6ff;--scrim: rgba(8, 8, 8, .8);--line-glass: rgba(255, 255, 255, .07);--pop-shadow: 0 18px 48px -14px rgba(0, 0, 0, .75);--sheet-shadow: 0 24px 64px -16px rgba(0, 0, 0, .6);--bar: rgba(237, 237, 237, .13);--toast: #232323;--toast-fg: #ededed;--qr-bg: #0a0a0a;--gi-a: rgba(255, 255, 255, .58);--gi-b: rgba(255, 255, 255, .14);--gi-rim: rgba(255, 255, 255, .5);--gi-edge: rgba(0, 0, 0, 0);--gi-detail: #ffffff;--t-grey-a: #cfcfcd;--t-grey-b: #5a5a59;--t-blue-a: #a6d9ff;--t-blue-b: #1d84e6;--t-green-a: #a8f29c;--t-green-b: #3aa32c;--t-red-a: #ffadad;--t-red-b: #dc3a3a;--t-orange-a: #ffc08f;--t-orange-b: #ec6a12;--font: Geist, -apple-system, system-ui, "Segoe UI", sans-serif;--mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;--r-sheet: 36px;--r-card: 28px;--r-row: 20px;--r-field: 16px;--r-tile: 12px;--ease-out: cubic-bezier(.23, 1, .32, 1);--gutter-l: max(16px, env(safe-area-inset-left, 0px));--gutter-r: max(16px, env(safe-area-inset-right, 0px))}@media(prefers-color-scheme:light){:root{color-scheme:light;--bg: #f2f2f1;--raised: #ffffff;--field: #f3f3f2;--knob: #e8e8e7;--seg: #ffffff;--seg-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 .5px rgba(0, 0, 0, .05);--line: rgba(0, 0, 0, .07);--text: #0b0b0b;--text-2: #6d6d6b;--text-3: #a6a6a4;--accent: #2b9dff;--accent-soft: rgba(43, 157, 255, .12);--ok: #33a328;--ok-soft: rgba(51, 163, 40, .12);--warn: #ee6a12;--bad: #e5484d;--bad-soft: rgba(229, 72, 77, .1);--sel-bg: rgba(78, 175, 255, .22);--sel-fg: #0a76cf;--scrim: rgba(236, 236, 235, .62);--line-glass: rgba(0, 0, 0, .07);--pop-shadow: 0 18px 44px -14px rgba(0, 0, 0, .2);--sheet-shadow: 0 24px 64px -18px rgba(0, 0, 0, .22);--bar: rgba(11, 11, 11, .11);--toast: #0b0b0b;--toast-fg: #f2f2f1;--qr-bg: #ffffff;--gi-a: rgba(250, 250, 249, .72);--gi-b: rgba(206, 206, 204, .5);--gi-rim: rgba(255, 255, 255, .9);--gi-edge: rgba(0, 0, 0, .11);--gi-detail: rgba(28, 28, 28, .72);--t-grey-a: #a9a9a7;--t-grey-b: #3d3d3c;--t-blue-a: #7cc4ff;--t-blue-b: #0a6fd6;--t-green-a: #82e070;--t-green-b: #2e8a22;--t-red-a: #ff9090;--t-red-b: #c92a2a}}*{box-sizing:border-box}html{-webkit-text-size-adjust:100%;scrollbar-gutter:stable}body{margin:0;background:var(--bg);color:var(--text);font:400 15px/22px var(--font);letter-spacing:-.011em;-webkit-font-smoothing:antialiased;min-height:100vh;min-height:100dvh;cursor:default}body.locked{overflow:hidden}input,textarea,.linkrow .mono,.conf{cursor:text}::selection{background:var(--sel-bg);color:var(--sel-fg)}button{font:inherit;color:inherit;letter-spacing:inherit;background:none;border:0;padding:0;margin:0;cursor:pointer;-webkit-tap-highlight-color:transparent}button:disabled{cursor:default}a{color:inherit;text-decoration:none}:focus{outline:none}:focus-visible{outline:2px solid color-mix(in srgb,var(--accent) 65%,transparent);outline-offset:2px}[hidden]{display:none!important}.offscreen{position:fixed;left:-9999px;top:0;opacity:0}.mono{font-family:var(--mono);letter-spacing:0}.num{font-variant-numeric:tabular-nums}.ok-t{color:var(--ok)}.warn-t{color:var(--warn)}.bad-t{color:var(--bad)}.here-t{color:var(--accent)}.i{width:18px;height:18px;flex:none}.gi{width:24px;height:24px;flex:none;overflow:visible;--ta: var(--t-grey-a);--tb: var(--t-grey-b)}.gi.t-blue{--ta: var(--t-blue-a);--tb: var(--t-blue-b)}.gi.t-green{--ta: var(--t-green-a);--tb: var(--t-green-b)}.gi.t-red{--ta: var(--t-red-a);--tb: var(--t-red-b)}.gi.t-orange{--ta: var(--t-orange-a);--tb: var(--t-orange-b)}.gi .ta{stop-color:var(--ta)}.gi .tb{stop-color:var(--tb)}.gi .fa{stop-color:var(--gi-a)}.gi .fb{stop-color:var(--gi-b)}.gi .fc{stop-color:var(--ta);stop-opacity:.28}.gi .ge{stroke:var(--gi-edge)}.gi .gr{stroke:var(--gi-rim)}.gi .gd{stroke:var(--gi-detail)}.gi .gdf{color:var(--gi-detail)}.knob{width:32px;height:32px;border-radius:50%;background:var(--knob);color:var(--text);display:grid;place-items:center;flex:none;transition:transform .15s var(--ease-out),background-color .15s}.knob:hover{background:color-miLine truncated @font-face{font-family:Geist;src:url(geist-latin-wght-normal.woff2) format("woff2");font-weight:100 900;font-display:swap;unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2190-21FF,U+2212,U+2215}@font-face{font-family:Geist;src:url(geist-cyrillic-wght-normal.woff2) format("woff2");font-weight:100 900;font-display:swap;unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:Geist Mono;src:url(geist-mono-latin-wght-normal.woff2) format("woff2");font-weight:100 900;font-display:swap}:root{color-scheme:dark;--bg: #080808;--raised: #121212;--field: #161616;--knob: #232323;--seg: rgba(237, 237, 237, .05);--seg-shadow: none;--line: rgba(255, 255, 255, .06);--text: #ededed;--text-2: #8c8c8a;--text-3: #4f4f4e;--accent: #4eafff;--accent-ink: #ffffff;--accent-soft: rgba(78, 175, 255, .13);--ok: #57d64b;--ok-soft: rgba(87, 214, 75, .14);--warn: #ff8a3d;--bad: #ff5c5c;--bad-soft: rgba(255, 92, 92, .13);--sel-bg: rgba(131, 209, 255, .25);--sel-fg: #64c6ff;--scrim: rgba(8, 8, 8, .8);--line-glass: rgba(255, 255, 255, .07);--pop-shadow: 0 18px 48px -14px rgba(0, 0, 0, .75);--sheet-shadow: 0 24px 64px -16px rgba(0, 0, 0, .6);--bar: rgba(237, 237, 237, .13);--toast: #232323;--toast-fg: #ededed;--qr-bg: #0a0a0a;--gi-a: rgba(255, 255, 255, .58);--gi-b: rgba(255, 255, 255, .14);--gi-rim: rgba(255, 255, 255, .5);--gi-edge: rgba(0, 0, 0, 0);--gi-detail: #ffffff;--t-grey-a: #cfcfcd;--t-grey-b: #5a5a59;--t-blue-a: #a6d9ff;--t-blue-b: #1d84e6;--t-green-a: #a8f29c;--t-green-b: #3aa32c;--t-red-a: #ffadad;--t-red-b: #dc3a3a;--t-orange-a: #ffc08f;--t-orange-b: #ec6a12;--font: Geist, -apple-system, system-ui, "Segoe UI", sans-serif;--mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;--r-sheet: 36px;--r-card: 28px;--r-row: 20px;--r-field: 16px;--r-tile: 12px;--ease-out: cubic-bezier(.23, 1, .32, 1);--gutter-l: max(16px, env(safe-area-inset-left, 0px));--gutter-r: max(16px, env(safe-area-inset-right, 0px))}@media(prefers-color-scheme:light){:root{color-scheme:light;--bg: #f2f2f1;--raised: #ffffff;--field: #f3f3f2;--knob: #e8e8e7;--seg: #ffffff;--seg-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 .5px rgba(0, 0, 0, .05);--line: rgba(0, 0, 0, .07);--text: #0b0b0b;--text-2: #6d6d6b;--text-3: #a6a6a4;--accent: #2b9dff;--accent-soft: rgba(43, 157, 255, .12);--ok: #33a328;--ok-soft: rgba(51, 163, 40, .12);--warn: #ee6a12;--bad: #e5484d;--bad-soft: rgba(229, 72, 77, .1);--sel-bg: rgba(78, 175, 255, .22);--sel-fg: #0a76cf;--scrim: rgba(236, 236, 235, .62);--line-glass: rgba(0, 0, 0, .07);--pop-shadow: 0 18px 44px -14px rgba(0, 0, 0, .2);--sheet-shadow: 0 24px 64px -18px rgba(0, 0, 0, .22);--bar: rgba(11, 11, 11, .11);--toast: #0b0b0b;--toast-fg: #f2f2f1;--qr-bg: #ffffff;--gi-a: rgba(250, 250, 249, .72);--gi-b: rgba(206, 206, 204, .5);--gi-rim: rgba(255, 255, 255, .9);--gi-edge: rgba(0, 0, 0, .11);--gi-detail: rgba(28, 28, 28, .72);--t-grey-a: #a9a9a7;--t-grey-b: #3d3d3c;--t-blue-a: #7cc4ff;--t-blue-b: #0a6fd6;--t-green-a: #82e070;--t-green-b: #2e8a22;--t-red-a: #ff9090;--t-red-b: #c92a2a}}*{box-sizing:border-box}html{-webkit-text-size-adjust:100%;scrollbar-gutter:stable}body{margin:0;background:var(--bg);color:var(--text);font:400 15px/22px var(--font);letter-spacing:-.011em;-webkit-font-smoothing:antialiased;min-height:100vh;min-height:100dvh;cursor:default}body.locked{overflow:hidden}input,textarea,.linkrow .mono,.conf{cursor:text}::selection{background:var(--sel-bg);color:var(--sel-fg)}button{font:inherit;color:inherit;letter-spacing:inherit;background:none;border:0;padding:0;margin:0;cursor:pointer;-webkit-tap-highlight-color:transparent}button:disabled{cursor:default}a{color:inherit;text-decoration:none}:focus{outline:none}:focus-visible{outline:2px solid color-mix(in srgb,var(--accent) 65%,transparent);outline-offset:2px}[hidden]{display:none!important}.offscreen{position:fixed;left:-9999px;top:0;opacity:0}.mono{font-family:var(--mono);letter-spacing:0}.num{font-variant-numeric:tabular-nums}.ok-t{color:var(--ok)}.warn-t{color:var(--warn)}.bad-t{color:var(--bad)}.here-t{color:var(--accent)}.i{width:18px;height:18px;flex:none}.gi{width:24px;height:24px;flex:none;overflow:visible;--ta: var(--t-grey-a);--tb: var(--t-grey-b)}.gi.t-blue{--ta: var(--t-blue-a);--tb: var(--t-blue-b)}.gi.t-green{--ta: var(--t-green-a);--tb: var(--t-green-b)}.gi.t-red{--ta: var(--t-red-a);--tb: var(--t-red-b)}.gi.t-orange{--ta: var(--t-orange-a);--tb: var(--t-orange-b)}.gi .ta{stop-color:var(--ta)}.gi .tb{stop-color:var(--tb)}.gi .fa{stop-color:var(--gi-a)}.gi .fb{stop-color:var(--gi-b)}.gi .fc{stop-color:var(--ta);stop-opacity:.28}.gi .ge{stroke:var(--gi-edge)}.gi .gr{stroke:var(--gi-rim)}.gi .gd{stroke:var(--gi-detail)}.gi .gdf{color:var(--gi-detail)}.knob{width:32px;height:32px;border-radius:50%;background:var(--knob);color:var(--text);display:grid;place-items:center;flex:none;transition:transform .15s var(--ease-out),background-color .15s}.knob:hover{background:color-miLine truncated
@@ -1,6 +1,6 @@
"use strict";(()=>{var li=Object.create;var tr=Object.defineProperty;var ci=Object.getOwnPropertyDescriptor;var di=Object.getOwnPropertyNames;var ui=Object.getPrototypeOf,pi=Object.prototype.hasOwnProperty;var fi=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var hi=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of di(t))!pi.call(e,o)&&o!==n&&tr(e,o,{get:()=>t[o],enumerable:!(r=ci(t,o))||r.enumerable});return e};var mi=(e,t,n)=>(n=e!=null?li(ui(e)):{},hi(t||!e||!e.__esModule?tr(n,"default",{value:e,enumerable:!0}):n,e));var Ur=fi((zr,Kr)=>{"use strict";var Wr=(function(){var e=function(d,v){var a=236,h=17,p=d,A=n[v],u=null,l=0,E=null,x=[],C={},I=function(w,k){l=p*4+17,u=(function(y){for(var L=new Array(y),S=0;S<y;S+=1){L[S]=new Array(y);for(var H=0;H<y;H+=1)L[S][H]=null}return L})(l),G(0,0),G(l-7,0),G(0,l-7),re(),J(),ue(w,k),p>=7&&le(w),E==null&&(E=ie(p,A,x)),Y(E,k)},G=function(w,k){for(var y=-1;y<=7;y+=1)if(!(w+y<=-1||l<=w+y))for(var L=-1;L<=7;L+=1)k+L<=-1||l<=k+L||(0<=y&&y<=6&&(L==0||L==6)||0<=L&&L<=6&&(y==0||y==6)||2<=y&&y<=4&&2<=L&&L<=4?u[w+y][k+L]=!0:u[w+y][k+L]=!1)},V=function(){for(var w=0,k=0,y=0;y<8;y+=1){I(!0,y);var L=o.getLostPoint(C);(y==0||w>L)&&(w=L,k=y)}return k},J=function(){for(var w=8;w<l-8;w+=1)u[w][6]==null&&(u[w][6]=w%2==0);for(var k=8;k<l-8;k+=1)u[6][k]==null&&(u[6][k]=k%2==0)},re=function(){for(var w=o.getPatternPosition(p),k=0;k<w.length;k+=1)for(var y=0;y<w.length;y+=1){var L=w[k],S=w[y];if(u[L][S]==null)for(var H=-2;H<=2;H+=1)for(var K=-2;K<=2;K+=1)H==-2||H==2||K==-2||K==2||H==0&&K==0?u[L+H][S+K]=!0:u[L+H][S+K]=!1}},le=function(w){for(var k=o.getBCHTypeNumber(p),y=0;y<18;y+=1){var L=!w&&(k>>y&1)==1;u[Math.floor(y/3)][y%3+l-8-3]=L}for(var y=0;y<18;y+=1){var L=!w&&(k>>y&1)==1;u[y%3+l-8-3][Math.floor(y/3)]=L}},ue=function(w,k){for(var y=A<<3|k,L=o.getBCHTypeInfo(y),S=0;S<15;S+=1){var H=!w&&(L>>S&1)==1;S<6?u[S][8]=H:S<8?u[S+1][8]=H:u[l-15+S][8]=H}for(var S=0;S<15;S+=1){var H=!w&&(L>>S&1)==1;S<8?u[8][l-S-1]=H:S<9?u[8][15-S-1+1]=H:u[8][15-S-1]=H}u[l-8][8]=!w},Y=function(w,k){for(var y=-1,L=l-1,S=7,H=0,K=o.getMaskFunction(k),W=l-1;W>0;W-=2)for(W==6&&(W-=1);;){for(var X=0;X<2;X+=1)if(u[L][W-X]==null){var se=!1;H<w.length&&(se=(w[H]>>>S&1)==1);var U=K(L,W-X);U&&(se=!se),u[L][W-X]=se,S-=1,S==-1&&(H+=1,S=7)}if(L+=y,L<0||l<=L){L-=y,y=-y;break}}},ee=function(w,k){for(var y=0,L=0,S=0,H=new Array(k.length),K=new Array(k.length),W=0;W<k.length;W+=1){var X=k[W].dataCount,se=k[W].totalCount-X;L=Math.max(L,X),S=Math.max(S,se),H[W]=new Array(X);for(var U=0;U<H[W].length;U+=1)H[W][U]=255&w.getBuffer()[U+y];y+=X;var ye=o.getErrorCorrectPolynomial(se),be=c(H[W],ye.getLength()-1),Xn=be.mod(ye);K[W]=new Array(ye.getLength()-1);for(var U=0;U<K[W].length;U+=1){var Zn=U+Xn.getLength()-K[W].length;K[W][U]=Zn>=0?Xn.getAt(Zn):0}}for(var er=0,U=0;U<k.length;U+=1)er+=k[U].totalCount;for(var bn=new Array(er),Nt=0,U=0;U<L;U+=1)for(var W=0;W<k.length;W+=1)U<H[W].length&&(bn[Nt]=H[W][U],Nt+=1);for(var U=0;U<S;U+=1)for(var W=0;W<k.length;W+=1)U<K[W].length&&(bn[Nt]=K[W][U],Nt+=1);return bn},ie=function(w,k,y){for(var L=m.getRSBlocks(w,k),S=g(),H=0;H<y.length;H+=1){var K=y[H];S.put(K.getMode(),4),S.put(K.getLength(),o.getLengthInBits(K.getMode(),w)),K.write(S)}for(var W=0,H=0;H<L.length;H+=1)W+=L[H].dataCount;if(S.getLengthInBits()>W*8)throw"code length overflow. ("+S.getLengthInBits()+">"+W*8+")";for(S.getLengthInBits()+4<=W*8&&S.put(0,4);S.getLengthInBits()%8!=0;)S.putBit(!1);for(;!(S.getLengthInBits()>=W*8||(S.put(a,8),S.getLengthInBits()>=W*8));)S.put(h,8);return ee(S,L)};C.addData=function(w,k){k=k||"Byte";var y=null;switch(k){case"Numeric":y=f(w);break;case"Alphanumeric":y=T(w);break;case"Byte":y=M(w);break;case"Kanji":y=b(w);break;default:throw"mode:"+k}x.push(y),E=null},C.isDark=function(w,k){if(w<0||l<=w||k<0||l<=k)throw w+","+k;return u[w][k]},C.getModuleCount=function(){return l},C.make=function(){if(p<1){for(var w=1;w<40;w++){for(var k=m.getRSBlocks(w,A),y=g(),L=0;L<x.length;L++){var S=x[L];y.put(S.getMode(),4),y.put(S.getLength(),o.getLengthInBits(S.getMode(),w)),S.write(y)}for(var H=0,L=0;L<k.length;L++)H+=k[L].dataCount;if(y.getLengthInBits()<=H*8)break}p=w}I(!1,V())},C.createTableTag=function(w,k){w=w||2,k=typeof k=="undefined"?w*4:k;var y="";y+='<table style="',y+=" border-width: 0px; border-style: none;",y+=" border-collapse: collapse;",y+=" padding: 0px; margin: "+k+"px;",y+='">',y+="<tbody>";for(var L=0;L<C.getModuleCount();L+=1){y+="<tr>";for(var S=0;S<C.getModuleCount();S+=1)y+='<td style="',y+=" border-width: 0px; border-style: none;",y+=" border-collapse: collapse;",y+=" padding: 0px; margin: 0px;",y+=" width: "+w+"px;",y+=" height: "+w+"px;",y+=" background-color: ",y+=C.isDark(L,S)?"#000000":"#ffffff",y+=";",y+='"/>';y+="</tr>"}return y+="</tbody>",y+="</table>",y},C.createSvgTag=function(w,k,y,L){var S={};typeof arguments[0]=="object"&&(S=arguments[0],w=S.cellSize,k=S.margin,y=S.alt,L=S.title),w=w||2,k=typeof k=="undefined"?w*4:k,y=typeof y=="string"?{text:y}:y|Line truncated "use strict";(()=>{var fs=Object.create;var or=Object.defineProperty;var hs=Object.getOwnPropertyDescriptor;var ms=Object.getOwnPropertyNames;var gs=Object.getPrototypeOf,vs=Object.prototype.hasOwnProperty;var ys=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var bs=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ms(t))!vs.call(e,o)&&o!==n&&or(e,o,{get:()=>t[o],enumerable:!(r=hs(t,o))||r.enumerable});return e};var xs=(e,t,n)=>(n=e!=null?fs(gs(e)):{},bs(t||!e||!e.__esModule?or(n,"default",{value:e,enumerable:!0}):n,e));var Vr=ys((Ur,Fr)=>{"use strict";var Kr=(function(){var e=function(d,v){var a=236,h=17,p=d,A=n[v],u=null,c=0,T=null,w=[],C={},I=function(M,k){c=p*4+17,u=(function(y){for(var L=new Array(y),S=0;S<y;S+=1){L[S]=new Array(y);for(var R=0;R<y;R+=1)L[S][R]=null}return L})(c),G(0,0),G(c-7,0),G(0,c-7),re(),J(),ue(M,k),p>=7&&le(M),T==null&&(T=se(p,A,w)),Y(T,k)},G=function(M,k){for(var y=-1;y<=7;y+=1)if(!(M+y<=-1||c<=M+y))for(var L=-1;L<=7;L+=1)k+L<=-1||c<=k+L||(0<=y&&y<=6&&(L==0||L==6)||0<=L&&L<=6&&(y==0||y==6)||2<=y&&y<=4&&2<=L&&L<=4?u[M+y][k+L]=!0:u[M+y][k+L]=!1)},V=function(){for(var M=0,k=0,y=0;y<8;y+=1){I(!0,y);var L=o.getLostPoint(C);(y==0||M>L)&&(M=L,k=y)}return k},J=function(){for(var M=8;M<c-8;M+=1)u[M][6]==null&&(u[M][6]=M%2==0);for(var k=8;k<c-8;k+=1)u[6][k]==null&&(u[6][k]=k%2==0)},re=function(){for(var M=o.getPatternPosition(p),k=0;k<M.length;k+=1)for(var y=0;y<M.length;y+=1){var L=M[k],S=M[y];if(u[L][S]==null)for(var R=-2;R<=2;R+=1)for(var q=-2;q<=2;q+=1)R==-2||R==2||q==-2||q==2||R==0&&q==0?u[L+R][S+q]=!0:u[L+R][S+q]=!1}},le=function(M){for(var k=o.getBCHTypeNumber(p),y=0;y<18;y+=1){var L=!M&&(k>>y&1)==1;u[Math.floor(y/3)][y%3+c-8-3]=L}for(var y=0;y<18;y+=1){var L=!M&&(k>>y&1)==1;u[y%3+c-8-3][Math.floor(y/3)]=L}},ue=function(M,k){for(var y=A<<3|k,L=o.getBCHTypeInfo(y),S=0;S<15;S+=1){var R=!M&&(L>>S&1)==1;S<6?u[S][8]=R:S<8?u[S+1][8]=R:u[c-15+S][8]=R}for(var S=0;S<15;S+=1){var R=!M&&(L>>S&1)==1;S<8?u[8][c-S-1]=R:S<9?u[8][15-S-1+1]=R:u[8][15-S-1]=R}u[c-8][8]=!M},Y=function(M,k){for(var y=-1,L=c-1,S=7,R=0,q=o.getMaskFunction(k),z=c-1;z>0;z-=2)for(z==6&&(z-=1);;){for(var X=0;X<2;X+=1)if(u[L][z-X]==null){var ie=!1;R<M.length&&(ie=(M[R]>>>S&1)==1);var K=q(L,z-X);K&&(ie=!ie),u[L][z-X]=ie,S-=1,S==-1&&(R+=1,S=7)}if(L+=y,L<0||c<=L){L-=y,y=-y;break}}},te=function(M,k){for(var y=0,L=0,S=0,R=new Array(k.length),q=new Array(k.length),z=0;z<k.length;z+=1){var X=k[z].dataCount,ie=k[z].totalCount-X;L=Math.max(L,X),S=Math.max(S,ie),R[z]=new Array(X);for(var K=0;K<R[z].length;K+=1)R[z][K]=255&M.getBuffer()[K+y];y+=X;var ye=o.getErrorCorrectPolynomial(ie),be=l(R[z],ye.getLength()-1),tr=be.mod(ye);q[z]=new Array(ye.getLength()-1);for(var K=0;K<q[z].length;K+=1){var nr=K+tr.getLength()-q[z].length;q[z][K]=nr>=0?tr.getAt(nr):0}}for(var rr=0,K=0;K<k.length;K+=1)rr+=k[K].totalCount;for(var wn=new Array(rr),Nt=0,K=0;K<L;K+=1)for(var z=0;z<k.length;z+=1)K<R[z].length&&(wn[Nt]=R[z][K],Nt+=1);for(var K=0;K<S;K+=1)for(var z=0;z<k.length;z+=1)K<q[z].length&&(wn[Nt]=q[z][K],Nt+=1);return wn},se=function(M,k,y){for(var L=m.getRSBlocks(M,k),S=g(),R=0;R<y.length;R+=1){var q=y[R];S.put(q.getMode(),4),S.put(q.getLength(),o.getLengthInBits(q.getMode(),M)),q.write(S)}for(var z=0,R=0;R<L.length;R+=1)z+=L[R].dataCount;if(S.getLengthInBits()>z*8)throw"code length overflow. ("+S.getLengthInBits()+">"+z*8+")";for(S.getLengthInBits()+4<=z*8&&S.put(0,4);S.getLengthInBits()%8!=0;)S.putBit(!1);for(;!(S.getLengthInBits()>=z*8||(S.put(a,8),S.getLengthInBits()>=z*8));)S.put(h,8);return te(S,L)};C.addData=function(M,k){k=k||"Byte";var y=null;switch(k){case"Numeric":y=f(M);break;case"Alphanumeric":y=E(M);break;case"Byte":y=x(M);break;case"Kanji":y=b(M);break;default:throw"mode:"+k}w.push(y),T=null},C.isDark=function(M,k){if(M<0||c<=M||k<0||c<=k)throw M+","+k;return u[M][k]},C.getModuleCount=function(){return c},C.make=function(){if(p<1){for(var M=1;M<40;M++){for(var k=m.getRSBlocks(M,A),y=g(),L=0;L<w.length;L++){var S=w[L];y.put(S.getMode(),4),y.put(S.getLength(),o.getLengthInBits(S.getMode(),M)),S.write(y)}for(var R=0,L=0;L<k.length;L++)R+=k[L].dataCount;if(y.getLengthInBits()<=R*8)break}p=M}I(!1,V())},C.createTableTag=function(M,k){M=M||2,k=typeof k=="undefined"?M*4:k;var y="";y+='<table style="',y+=" border-width: 0px; border-style: none;",y+=" border-collapse: collapse;",y+=" padding: 0px; margin: "+k+"px;",y+='">',y+="<tbody>";for(var L=0;L<C.getModuleCount();L+=1){y+="<tr>";for(var S=0;S<C.getModuleCount();S+=1)y+='<td style="',y+=" border-width: 0px; border-style: none;",y+=" border-collapse: collapse;",y+=" padding: 0px; margin: 0px;",y+=" width: "+M+"px;",y+=" height: "+M+"px;",y+=" background-color: ",y+=C.isDark(L,S)?"#000000":"#ffffff",y+=";",y+='"/>';y+="</tr>"}return y+="</tbody>",y+="</table>",y},C.createSvgTag=function(M,k,y,L){var S={};typeof arguments[0]=="object"&&(S=arguments[0],M=S.cellSize,k=S.margin,y=S.alt,L=S.title),M=M||2,k=typeof k=="undefined"?M*4:k,y=typeof y=="string"?{text:y}:y|Line truncated
`}return y%2&&w>0?be.substring(0,be.length-y-1)+Array(y+1).join("▀"):be.substring(0,be.length-1)};return C.createASCII=function(w,k){if(w=w||1,w<2)return Bt(k);w-=1,k=typeof k=="undefined"?w*2:k;var y=C.getModuleCount()*w+k*2,L=k,S=y-k,H,K,W,X,se=Array(w+1).join("██"),U=Array(w+1).join(" "),ye="",be="";for(H=0;H<y;H+=1){for(W=Math.floor((H-L)/w),be="",K=0;K<y;K+=1)X=1,L<=K&&K<S&&L<=H&&H<S&&C.isDark(W,Math.floor((K-L)/w))&&(X=0),be+=X?se:U;for(W=0;W<w;W+=1)ye+=be+` `}return y%2&&M>0?be.substring(0,be.length-y-1)+Array(y+1).join("▀"):be.substring(0,be.length-1)};return C.createASCII=function(M,k){if(M=M||1,M<2)return Bt(k);M-=1,k=typeof k=="undefined"?M*2:k;var y=C.getModuleCount()*M+k*2,L=k,S=y-k,R,q,z,X,ie=Array(M+1).join("██"),K=Array(M+1).join(" "),ye="",be="";for(R=0;R<y;R+=1){for(z=Math.floor((R-L)/M),be="",q=0;q<y;q+=1)X=1,L<=q&&q<S&&L<=R&&R<S&&C.isDark(z,Math.floor((q-L)/M))&&(X=0),be+=X?ie:K;for(z=0;z<M;z+=1)ye+=be+`
`}return ye.substring(0,ye.length-1)},C.renderTo2dContext=function(w,k){k=k||2;for(var y=C.getModuleCount(),L=0;L<y;L++)for(var S=0;S<y;S++)w.fillStyle=C.isDark(L,S)?"black":"white",w.fillRect(L*k,S*k,k,k)},C};e.stringToBytesFuncs={default:function(d){for(var v=[],a=0;a<d.length;a+=1){var h=d.charCodeAt(a);v.push(h&255)}return v}},e.stringToBytes=e.stringToBytesFuncs.default,e.createStringToBytes=function(d,v){var a=(function(){for(var p=D(d),A=function(){var J=p.read();if(J==-1)throw"eof";return J},u=0,l={};;){var E=p.read();if(E==-1)break;var x=A(),C=A(),I=A(),G=String.fromCharCode(E<<8|x),V=C<<8|I;l[G]=V,u+=1}if(u!=v)throw u+" != "+v;return l})(),h=63;return function(p){for(var A=[],u=0;u<p.length;u+=1){var l=p.charCodeAt(u);if(l<128)A.push(l);else{var E=a[p.charAt(u)];typeof E=="number"?(E&255)==E?A.push(E):(A.push(E>>>8),A.push(E&255)):A.push(h)}}return A}};var t={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},n={L:1,M:0,Q:3,H:2},r={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},o=(function(){var d=[[],[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,a=7973,h=21522,p={},A=function(u){for(var l=0;u!=0;)l+=1,u>>>=1;return l};return p.getBCHTypeInfo=function(u){for(var l=u<<10;A(l)-A(v)>=0;)l^=v<<A(l)-A(v);return(u<<10|l)^h},p.getBCHTypeNumber=function(u){for(var l=u<<12;A(l)-A(a)>=0;)l^=a<<A(l)-A(a);return u<<12|l},p.getPatternPosition=function(u){return d[u-1]},p.getMaskFunction=function(u){switch(u){case r.PATTERN000:return function(l,E){return(l+E)%2==0};case r.PATTERN001:return function(l,E){return l%2==0};case r.PATTERN010:return function(l,E){return E%3==0};case r.PATTERN011:return function(l,E){return(l+E)%3==0};case r.PATTERN100:return function(l,E){return(Math.floor(l/2)+Math.floor(E/3))%2==0};case r.PATTERN101:return function(l,E){return l*E%2+l*E%3==0};case r.PATTERN110:return function(l,E){return(l*E%2+l*E%3)%2==0};case r.PATTERN111:return function(l,E){return(l*E%3+(l+E)%2)%2==0};default:throw"bad maskPattern:"+u}},p.getErrorCorrectPolynomial=function(u){for(var l=c([1],0),E=0;E<u;E+=1)l=l.multiply(c([1,s.gexp(E)],0));return l},p.getLengthInBits=function(u,l){if(1<=l&&l<10)switch(u){case t.MODE_NUMBER:return 10;case t.MODE_ALPHA_NUM:return 9;case t.MODE_8BIT_BYTE:return 8;case t.MODE_KANJI:return 8;default:throw"mode:"+u}else if(l<27)switch(u){case t.MODE_NUMBER:return 12;case t.MODE_ALPHA_NUM:return 11;case t.MODE_8BIT_BYTE:return 16;case t.MODE_KANJI:return 10;default:throw"mode:"+u}else if(l<41)switch(u){case t.MODE_NUMBER:return 14;case t.MODE_ALPHA_NUM:return 13;case t.MODE_8BIT_BYTE:return 16;case t.MODE_KANJI:return 12;default:throw"mode:"+u}else throw"type:"+l},p.getLostPoint=function(u){for(var l=u.getModuleCount(),E=0,x=0;x<l;x+=1)for(var C=0;C<l;C+=1){for(var I=0,G=u.isDark(x,C),V=-1;V<=1;V+=1)if(!(x+V<0||l<=x+V))for(var J=-1;J<=1;J+=1)C+J<0||l<=C+J||V==0&&J==0||G==u.isDark(x+V,C+J)&&(I+=1);I>5&&(E+=3+I-5)}for(var x=0;x<l-1;x+=1)for(var C=0;C<l-1;C+=1){var re=0;u.isDark(x,C)&&(re+=1),u.isDark(x+1,C)&&(re+=1),u.isDark(x,C+1)&&(re+=1),u.isDark(x+1,C+1)&&(re+=1),(re==0||re==4)&&(E+=3)}for(var x=0;x<l;x+=1)for(var C=0;C<l-6;C+=1)u.isDark(x,C)&&!u.isDark(x,C+1)&&u.isDark(x,C+2)&&u.isDark(x,C+3)&&u.isDark(x,C+4)&&!u.isDark(x,C+5)&&u.isDark(x,C+6)&&(E+=40);for(var C=0;C<l;C+=1)for(var x=0;x<l-6;x+=1)u.isDark(x,C)&&!u.isDark(x+1,C)&&u.isDark(x+2,C)&&u.isDark(x+3,C)&&u.isDark(x+4,C)&&!u.isDark(x+5,C)&&u.isDark(x+6,C)&&(E+=40);for(var le=0,C=0;C<l;C+=1)for(var x=0;x<l;x+=1)u.isDark(x,C)&&(le+=1);var ue=Math.abs(100*le/l/l-50)/5;return E+=ue*10,E},p})(),s=(function(){for(var d=new Array(256),v=new Array(256),a=0;a<8;a+=1)d[a]=1<<a;for(var a=8;a<256;a+=1)d[a]=d[a-4]^d[a-5]^d[a-6]^d[a-8];for(var a=0;a<255;a+=1)v[d[a]]=a;var h={};return h.glog=function(p){if(p<1)throw"glog("+p+")";return v[p]},h.gexp=function(p){for(;p<0;)p+=255;for(;p>=256;)p-=255;return d[p]},h})();function c(d,v){if(typeof d.length=="undefined")throw d.length+"/"+v;var a=(function(){for(var p=0;p<d.length&&d[p]==0;)p+=1;for(var A=new Array(d.length-p+v),u=0;u<d.length-p;u+=1)A[u]=d[u+p];return A})(),h={};return h.getAt=function(p){return a[p]},h.getLength=function(){return a.length},h.multiply=function(p){for(var A=new Array(h.getLength()+p.getLength()-1),u=0;u<h.getLength();u+=1)for(var l=0;l<p.getLength();l+=1)A[u+l]^=s.gexp(s.glog(h.getAt(u))+s.glog(p.getAt(l)));return c(A,0)},h.mod=function( Line truncated `}return ye.substring(0,ye.length-1)},C.renderTo2dContext=function(M,k){k=k||2;for(var y=C.getModuleCount(),L=0;L<y;L++)for(var S=0;S<y;S++)M.fillStyle=C.isDark(L,S)?"black":"white",M.fillRect(L*k,S*k,k,k)},C};e.stringToBytesFuncs={default:function(d){for(var v=[],a=0;a<d.length;a+=1){var h=d.charCodeAt(a);v.push(h&255)}return v}},e.stringToBytes=e.stringToBytesFuncs.default,e.createStringToBytes=function(d,v){var a=(function(){for(var p=P(d),A=function(){var J=p.read();if(J==-1)throw"eof";return J},u=0,c={};;){var T=p.read();if(T==-1)break;var w=A(),C=A(),I=A(),G=String.fromCharCode(T<<8|w),V=C<<8|I;c[G]=V,u+=1}if(u!=v)throw u+" != "+v;return c})(),h=63;return function(p){for(var A=[],u=0;u<p.length;u+=1){var c=p.charCodeAt(u);if(c<128)A.push(c);else{var T=a[p.charAt(u)];typeof T=="number"?(T&255)==T?A.push(T):(A.push(T>>>8),A.push(T&255)):A.push(h)}}return A}};var t={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},n={L:1,M:0,Q:3,H:2},r={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},o=(function(){var d=[[],[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,a=7973,h=21522,p={},A=function(u){for(var c=0;u!=0;)c+=1,u>>>=1;return c};return p.getBCHTypeInfo=function(u){for(var c=u<<10;A(c)-A(v)>=0;)c^=v<<A(c)-A(v);return(u<<10|c)^h},p.getBCHTypeNumber=function(u){for(var c=u<<12;A(c)-A(a)>=0;)c^=a<<A(c)-A(a);return u<<12|c},p.getPatternPosition=function(u){return d[u-1]},p.getMaskFunction=function(u){switch(u){case r.PATTERN000:return function(c,T){return(c+T)%2==0};case r.PATTERN001:return function(c,T){return c%2==0};case r.PATTERN010:return function(c,T){return T%3==0};case r.PATTERN011:return function(c,T){return(c+T)%3==0};case r.PATTERN100:return function(c,T){return(Math.floor(c/2)+Math.floor(T/3))%2==0};case r.PATTERN101:return function(c,T){return c*T%2+c*T%3==0};case r.PATTERN110:return function(c,T){return(c*T%2+c*T%3)%2==0};case r.PATTERN111:return function(c,T){return(c*T%3+(c+T)%2)%2==0};default:throw"bad maskPattern:"+u}},p.getErrorCorrectPolynomial=function(u){for(var c=l([1],0),T=0;T<u;T+=1)c=c.multiply(l([1,i.gexp(T)],0));return c},p.getLengthInBits=function(u,c){if(1<=c&&c<10)switch(u){case t.MODE_NUMBER:return 10;case t.MODE_ALPHA_NUM:return 9;case t.MODE_8BIT_BYTE:return 8;case t.MODE_KANJI:return 8;default:throw"mode:"+u}else if(c<27)switch(u){case t.MODE_NUMBER:return 12;case t.MODE_ALPHA_NUM:return 11;case t.MODE_8BIT_BYTE:return 16;case t.MODE_KANJI:return 10;default:throw"mode:"+u}else if(c<41)switch(u){case t.MODE_NUMBER:return 14;case t.MODE_ALPHA_NUM:return 13;case t.MODE_8BIT_BYTE:return 16;case t.MODE_KANJI:return 12;default:throw"mode:"+u}else throw"type:"+c},p.getLostPoint=function(u){for(var c=u.getModuleCount(),T=0,w=0;w<c;w+=1)for(var C=0;C<c;C+=1){for(var I=0,G=u.isDark(w,C),V=-1;V<=1;V+=1)if(!(w+V<0||c<=w+V))for(var J=-1;J<=1;J+=1)C+J<0||c<=C+J||V==0&&J==0||G==u.isDark(w+V,C+J)&&(I+=1);I>5&&(T+=3+I-5)}for(var w=0;w<c-1;w+=1)for(var C=0;C<c-1;C+=1){var re=0;u.isDark(w,C)&&(re+=1),u.isDark(w+1,C)&&(re+=1),u.isDark(w,C+1)&&(re+=1),u.isDark(w+1,C+1)&&(re+=1),(re==0||re==4)&&(T+=3)}for(var w=0;w<c;w+=1)for(var C=0;C<c-6;C+=1)u.isDark(w,C)&&!u.isDark(w,C+1)&&u.isDark(w,C+2)&&u.isDark(w,C+3)&&u.isDark(w,C+4)&&!u.isDark(w,C+5)&&u.isDark(w,C+6)&&(T+=40);for(var C=0;C<c;C+=1)for(var w=0;w<c-6;w+=1)u.isDark(w,C)&&!u.isDark(w+1,C)&&u.isDark(w+2,C)&&u.isDark(w+3,C)&&u.isDark(w+4,C)&&!u.isDark(w+5,C)&&u.isDark(w+6,C)&&(T+=40);for(var le=0,C=0;C<c;C+=1)for(var w=0;w<c;w+=1)u.isDark(w,C)&&(le+=1);var ue=Math.abs(100*le/c/c-50)/5;return T+=ue*10,T},p})(),i=(function(){for(var d=new Array(256),v=new Array(256),a=0;a<8;a+=1)d[a]=1<<a;for(var a=8;a<256;a+=1)d[a]=d[a-4]^d[a-5]^d[a-6]^d[a-8];for(var a=0;a<255;a+=1)v[d[a]]=a;var h={};return h.glog=function(p){if(p<1)throw"glog("+p+")";return v[p]},h.gexp=function(p){for(;p<0;)p+=255;for(;p>=256;)p-=255;return d[p]},h})();function l(d,v){if(typeof d.length=="undefined")throw d.length+"/"+v;var a=(function(){for(var p=0;p<d.length&&d[p]==0;)p+=1;for(var A=new Array(d.length-p+v),u=0;u<d.length-p;u+=1)A[u]=d[u+p];return A})(),h={};return h.getAt=function(p){return a[p]},h.getLength=function(){return a.length},h.multiply=function(p){for(var A=new Array(h.getLength()+p.getLength()-1),u=0;u<h.getLength();u+=1)for(var c=0;c<p.getLength();c+=1)A[u+c]^=i.gexp(i.glog(h.getAt(u))+i.glog(p.getAt(c)));return l(A,0)},h.mod=function( Line truncated
`),hostName:s,mtu:n.mtu,persistent_keep_alive:n.persistent_keep_alive,port:Number(n.port),psk_key:n.psk_key,server_pub_key:n.server_pub_key},m={containers:[{container:"amnezia-awg",awg:{isThirdPartyConfig:!0,last_config:JSON.stringify(c),port:String(n.port),protocol_version:r.header_protection_key?"3.1":"2",transport_proto:"udp"}}],defaultContainer:"amnezia-awg",description:t,hostName:s};return n.dns[0]&&(m.dns1=n.dns[0]),n.dns[1]&&(m.dns2=n.dns[1]),m}function Zi(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function es(e){let t=globalThis;if(typeof t.CompressionStream=="undefined")return null;try{let n=new t.Blob([e]).stream().pipeThrough(new t.CompressionStream("deflate")),r=new Uint8Array(await new t.Response(n).arrayBuffer()),o=new Uint8Array(4+r.length);return new DataView(o.buffer).setUint32(0,e.length,!1),o.set(r,4),o}catch{return null}}async function Kn(e,t,n=!0){let r=new TextEncoder().encode(JSON.stringify(Xi(e,t))),o=n?await es(r):null;return`vpn://${Zi(o!=null?o:r)}`}var Eo=e=>e.replace(/^vpn:\/\//,"");var To=["height","marginTop","marginBottom","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"];function je(e,t={}){let n=i("div",{class:`acc${t.inset?" inset":""}`}),r=e.map((f,T)=>{var P;let M=f.body.filter(d=>!!d),b=!M.length,O=[f.icon,i("span",{class:"acc-title"},i("span",{class:"t"},f.title),(P=f.tag)!=null?P:null),f.val?i("span",{class:`acc-val${f.valHide?" hide-open":""}`},f.val):null],B=T===t.open&&!b,D=b?i("div",{class:"acc-head"},...O):i("button",{type:"button",class:"acc-head","aria-expanded":String(B),onclick:()=>g(R)},...O,z("chevron","i acc-chev")),R=i("div",{class:`acc-row${b?" still":""}${B?" open":""}`},D,i("div",{class:"acc-body"},...M));return n.appendChild(R),R}),o=f=>f.querySelector(".acc-body"),s=()=>r.forEach((f,T)=>{let M=f.classList.contains("open");f.classList.toggle("rt",T===0||M||r[T-1].classList.contains("open")),f.classList.toggle("rb",T===r.length-1||M||r[T+1].classList.contains("open"))}),c=f=>{let T=getComputedStyle(f),M={};for(let b of To)M[b]=b==="height"?`${f.getBoundingClientRect().height}px`:T[b];return M},m=()=>r.forEach(f=>{var T;return(T=f.querySelector("button.acc-head"))==null?void 0:T.setAttribute("aria-expanded",String(f.classList.contains("open")))});function g(f){var B;let T=r.map(c);r.forEach(D=>D.getAnimations().forEach(R=>R.cancel())),r.forEach(D=>o(D).getAnimations().forEach(R=>R.cancel()));let M=!f.classList.contains("open"),b=r.filter(D=>D.classList.contains("open")&&(D===f||M));r.forEach(D=>{D.classList.remove("closing"),D!==f&&D.classList.remove("open")}),f.classList.toggle("open",M),s();let O=yt();r.forEach((D,R)=>{let P=c(D);To.some(d=>T[R][d]!==P[d])&&(b.includes(D)&&D.classList.add("closing"),$(D,[T[R],P],{duration:Ae.duration,easing:Ae.easing}).onfinish=()=>D.classList.remove("closing"))}),b.forEach(D=>$(o(D),[{opacity:1},{opacity:0,filter:"blur(2px)"}],{duration:160,easing:Z,fill:"forwards"})),M&&$(o(f),[{opacity:0,filter:"blur(2px)"},{opacity:1,filter:"blur(0px)"}],{duration:300,easing:"cubic-bezier(0,0,.58,1)"}),bt(O),m(),(B=t.onToggle)==null||B.call(t,r.indexOf(f),M,!1)}return s(),{el:n,openIndex:()=>r.findIndex(f=>f.classList.contains("open")),setOpen(f){r.forEach((T,M)=>T.classList.toggle("open",M===f&&!T.classList.contains("still"))),s(),m(),r.forEach((T,M)=>{var b;return(b=t.onToggle)==null?void 0:b.call(t,M,T.classList.contains("open"),!0)})}}}function Lo(e,t,n){let r=i("span",{class:"seg-pill"}),o=i("div",{class:"seg appseg",role:"tablist"},r),s=e.map(b=>{let O=i("button",{type:"button",class:"seg-b",role:"tab","aria-label":b.label,title:b.label,onclick:()=>M(b.value)},z(b.icon),i("span",{class:"seg-l"},b.label));return O.dataset.v=b.value,o.appendChild(O),O}),c=b=>b.querySelector(".seg-l"),m=()=>s.forEach(b=>{let O=b.dataset.v===t;b.classList.toggle("on",O),b.setAttribute("aria-selected",String(O))}),g=()=>{let b=s.find(O=>O.dataset.v===t);return b&&b.offsetWidth?[b.offsetLeft,o.clientWidth-b.offsetLeft-b.offsetWidth]:null},f=()=>{let b=g();b&&(r.style.left=`${b[0]}px`,r.style.right=`${b[1]}px`)},T=0;function M(b){if(b===t)return;let O=s.findIndex(C=>C.dataset.v===t),B=s.findIndex(C=>C.dataset.v===b),D=getComputedStyle(r),R=parseFloat(D.left)||0,P=parseFloat(D.right)||0,d=s.map(C=>parseFloat(getComputedStyle(C).flexGrow)||0),v=c(s[O]),a=v.getBoundingClientRect().width;[...s,...s.map(c)].forEach(C=>C.getAnimations().forEach(I=>I.cancel())),t=b,m(),s.forEach((C,I)=>{let G=I===B?1:0;d[I]!==G&&$(C,[{flexGrow:d[I]},{flexGrow:G}],{duration:q.duration,easing:q.easing})}),$(v,[{opacity:1,maxWidth:`${a}px`,marginLeft:"0px"},{opacity:0,maxWidth:"0px",marginLeft:"-8px"}],{duration:220,easing:"ease-out"}),$(c(s[B]),[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"none"}],{duration:280,delay:70,easing:j,fill:"backwards"});let h=B>O,p=Se()?q:hr,A=performance.now(),u=Math.m Line truncated `),hostName:i,mtu:n.mtu,persistent_keep_alive:n.persistent_keep_alive,port:Number(n.port),psk_key:n.psk_key,server_pub_key:n.server_pub_key},m={containers:[{container:"amnezia-awg",awg:{isThirdPartyConfig:!0,last_config:JSON.stringify(l),port:String(n.port),protocol_version:r.header_protection_key?"3.1":"2",transport_proto:"udp"}}],defaultContainer:"amnezia-awg",description:t,hostName:i};return n.dns[0]&&(m.dns1=n.dns[0]),n.dns[1]&&(m.dns2=n.dns[1]),m}function si(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function ii(e){let t=globalThis;if(typeof t.CompressionStream=="undefined")return null;try{let n=new t.Blob([e]).stream().pipeThrough(new t.CompressionStream("deflate")),r=new Uint8Array(await new t.Response(n).arrayBuffer()),o=new Uint8Array(4+r.length);return new DataView(o.buffer).setUint32(0,e.length,!1),o.set(r,4),o}catch{return null}}async function Fn(e,t,n=!0){let r=new TextEncoder().encode(JSON.stringify(oi(e,t))),o=n?await ii(r):null;return`vpn://${si(o!=null?o:r)}`}var Po=e=>e.replace(/^vpn:\/\//,"");var Do=["height","marginTop","marginBottom","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"];function Ye(e,t={}){let n=s("div",{class:`acc${t.inset?" inset":""}`}),r=e.map((f,E)=>{var D;let x=f.body.filter(d=>!!d),b=!x.length,O=[f.icon,s("span",{class:"acc-title"},s("span",{class:"t"},f.title),(D=f.tag)!=null?D:null),f.val?s("span",{class:`acc-val${f.valHide?" hide-open":""}`},f.val):null],H=E===t.open&&!b,P=b?s("div",{class:"acc-head"},...O):s("button",{type:"button",class:"acc-head","aria-expanded":String(H),onclick:()=>g(B)},...O,W("chevron","i acc-chev")),B=s("div",{class:`acc-row${b?" still":""}${H?" open":""}`},P,s("div",{class:"acc-body"},...x));return n.appendChild(B),B}),o=f=>f.querySelector(".acc-body"),i=()=>r.forEach((f,E)=>{let x=f.classList.contains("open");f.classList.toggle("rt",E===0||x||r[E-1].classList.contains("open")),f.classList.toggle("rb",E===r.length-1||x||r[E+1].classList.contains("open"))}),l=f=>{let E=getComputedStyle(f),x={};for(let b of Do)x[b]=b==="height"?`${f.getBoundingClientRect().height}px`:E[b];return x},m=()=>r.forEach(f=>{var E;return(E=f.querySelector("button.acc-head"))==null?void 0:E.setAttribute("aria-expanded",String(f.classList.contains("open")))});function g(f){var H;let E=r.map(l);r.forEach(P=>P.getAnimations().forEach(B=>B.cancel())),r.forEach(P=>o(P).getAnimations().forEach(B=>B.cancel()));let x=!f.classList.contains("open"),b=r.filter(P=>P.classList.contains("open")&&(P===f||x));r.forEach(P=>{P.classList.remove("closing"),P!==f&&P.classList.remove("open","opened")}),f.classList.toggle("open",x),f.classList.toggle("opened",x),i();let O=yt();r.forEach((P,B)=>{let D=l(P);Do.some(d=>E[B][d]!==D[d])&&(b.includes(P)&&P.classList.add("closing"),$(P,[E[B],D],{duration:Le.duration,easing:Le.easing}).onfinish=()=>P.classList.remove("closing"))}),b.forEach(P=>$(o(P),[{opacity:1},{opacity:0,filter:"blur(2px)"}],{duration:160,easing:Z,fill:"forwards"})),x&&$(o(f),[{opacity:0,filter:"blur(2px)"},{opacity:1,filter:"blur(0px)"}],{duration:300,easing:"cubic-bezier(0,0,.58,1)"}),bt(O),m(),(H=t.onToggle)==null||H.call(t,r.indexOf(f),x,!1)}return i(),{el:n,openIndex:()=>r.findIndex(f=>f.classList.contains("open")),setOpen(f){r.forEach((E,x)=>E.classList.toggle("open",x===f&&!E.classList.contains("still"))),i(),m(),r.forEach((E,x)=>{var b;return(b=t.onToggle)==null?void 0:b.call(t,x,E.classList.contains("open"),!0)})}}}function $o(e,t,n){let r=s("span",{class:"seg-pill"}),o=s("div",{class:"seg appseg",role:"tablist"},r),i=e.map(b=>{let O=s("button",{type:"button",class:"seg-b",role:"tab","aria-label":b.label,title:b.label,onclick:()=>x(b.value)},W(b.icon),s("span",{class:"seg-l"},b.label));return O.dataset.v=b.value,o.appendChild(O),O}),l=b=>b.querySelector(".seg-l"),m=()=>i.forEach(b=>{let O=b.dataset.v===t;b.classList.toggle("on",O),b.setAttribute("aria-selected",String(O))}),g=()=>{let b=i.find(O=>O.dataset.v===t);return b&&b.offsetWidth?[b.offsetLeft,o.clientWidth-b.offsetLeft-b.offsetWidth]:null},f=()=>{let b=g();b&&(r.style.left=`${b[0]}px`,r.style.right=`${b[1]}px`)},E=0;function x(b){if(b===t)return;let O=i.findIndex(C=>C.dataset.v===t),H=i.findIndex(C=>C.dataset.v===b),P=getComputedStyle(r),B=parseFloat(P.left)||0,D=parseFloat(P.right)||0,d=i.map(C=>parseFloat(getComputedStyle(C).flexGrow)||0),v=l(i[O]),a=v.getBoundingClientRect().width;[...i,...i.map(l)].forEach(C=>C.getAnimations().forEach(I=>I.cancel())),t=b,m(),i.forEach((C,I)=>{let G=I===H?1:0;d[I]!==G&&$(C,[{flexGrow:d[I]},{flexGrow:G}],{duration:U.duration,easing:U.easing})}),$(v,[{opacity:1,maxWidth:`${a}px`,marginLeft:"0px"},{opacity:0,maxWidth:"0px",marginLeft:"-8px"}],{duration:220,easing:"ease-out"}),$(l(i[H]),[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"none"}],{duration:280,delay:70,easing:j,fill:"backwards"});let h=H>O, Line truncated
`).flatMap((f,T)=>T?[` `).flatMap((x,b)=>b?[`
`,So(f,t)]:[So(f,t)]));r();let o=!!Ze(e.filename,e.conf),s=i("button",{type:"button",class:"btn soft sm",onclick:()=>{t=!t,s.replaceChildren(z(t?"x":"key"),i("span",{},t?_("Hide key"):_("Show key"))),r(),n.querySelectorAll(".mask, .k").forEach(f=>$(f,[{filter:"blur(4px)",opacity:.4},{filter:"none",opacity:1}],{duration:320,easing:j}))}},z("key"),i("span",{},_("Show key"))),c=i("button",{type:"button",class:"btn soft sm",onclick:f=>he(e.conf,_("Configuration copied"),f.currentTarget)},z("copy"),i("span",{class:"lbl"},_("Copy"))),m=i("div",{class:"filecard"},i("div",{class:"fc-row"},i("span",{class:"filecard-ic"},".conf"),i("span",{class:"t"},i("span",{class:"mono"},e.filename),i("span",{},_("For computers and routers")))),i("button",{type:"button",class:"btn accent sm block",onclick:()=>Tt(e.filename,e.conf)},z(o?"open":"download"),i("span",{},o?_("Share file"):_("Download")))),g=je([{icon:Q("file"),title:_("Configuration"),body:[i("div",{class:"confbar"},s,c),n]}],{inset:!0});return i("div",{class:"step-box"},m,g.el)}function Io(e){let t=i("span",{class:"osm-p"},ce[e]),n=ao(Ct(e,"ios"),Ct(e,"android"));return{el:i("span",{class:"scanline"},i("span",{},...Ke(_("In %s:"),t)),n.el),set(r){te(t,ce[r],void 0,{whole:!0}),n.set(Ct(r,"ios"),Ct(r,"android"))}}}function Go(e){let t=i("span",{class:"tt"}),n=i("span",{class:"tt-m"}),r=i("span",{class:"hp-tip","aria-hidden":"true"},t,n),o=i("button",{type:"button",class:"hp-b",onclick:()=>Tt(e().file,e().text)},z("download")),s=i("button",{type:"button",class:"hp-b"},z("copy")),c=i("div",{class:"hpill",role:"group","aria-label":_("The connection"),"data-key":"conn"},o,s,r),m=null,g=0,f=0,T=a=>{var h;return a===s&&s.classList.contains("done")?_("Copied"):(h=a.getAttribute("aria-label"))!=null?h:""},M=(a,h)=>{n.textContent=h;let p=n.offsetWidth+20;return Math.min(a.offsetLeft+a.offsetWidth/2,c.offsetWidth+46-p/2)},b=a=>`translateX(${a}px) translateX(-50%)`,O=a=>{let h=getComputedStyle(r).transform;r.getAnimations().forEach(p=>p.cancel()),r.style.transform=b(a),$(r,[{transform:h},{transform:b(a)}],{duration:q.duration,easing:q.easing})},B=a=>te(t,a),D=a=>{if(clearTimeout(g),m===a&&r.classList.contains("on"))return;if(m=a,r.classList.contains("on")){let p=T(a);return O(M(a,p)),B(p)}let h=()=>{let p=T(a);Ne(t,p);let A=M(a,p);r.getAnimations().forEach(u=>u.cancel()),r.style.transform=b(A),r.classList.add("on"),$(r,[{opacity:0,transform:`${b(A)} translateY(-3px) scale(.96)`,filter:"blur(3px)"},{opacity:1,transform:b(A),filter:"blur(0px)"}],{duration:220,easing:j})};performance.now()<f?h():g=window.setTimeout(h,420)},R=()=>{clearTimeout(g),m=null,r.classList.contains("on")&&(f=performance.now()+500,r.classList.remove("on"),$(r,[{opacity:1},{opacity:0}],{duration:120,easing:"ease-out"}))};for(let a of[o,s])a.addEventListener("pointerenter",h=>{h.pointerType==="mouse"&&D(a)}),a.addEventListener("focus",()=>{a.matches(":focus-visible")&&D(a)}),a.addEventListener("blur",R);c.addEventListener("pointerleave",R);let P=a=>{let h=z(a);s.querySelector("svg").replaceWith(h),$(h,[{opacity:0,transform:"scale(.6)",filter:"blur(3px)"},{opacity:1,transform:"none",filter:"none"}],{duration:xe.duration,easing:xe.easing})},d=()=>{if(m!==s||!r.classList.contains("on"))return;let a=T(s);O(M(s,a)),B(a)},v=0;return s.addEventListener("click",()=>{let a=e();he(a.text,a.msg),clearTimeout(v),s.classList.contains("done")||(s.classList.add("done"),P("check"),d()),v=window.setTimeout(()=>{s.classList.remove("done"),P("copy"),d()},1600)}),{el:c,sync(){let a=e().app;o.setAttribute("aria-label",N(_("Download %s config"),a)),s.setAttribute("aria-label",N(_("Copy %s config"),a))}}}function zo(e){let t=i("b",{},_("Waiting for the connection")),n=i("span",{class:"ws",hidden:!0}),r=i("div",{class:"way",role:"status","aria-live":"polite"},i("div",{class:"way-row"},i("span",{class:"way-end"},z(e.kind)),i("span",{class:"way-track"},i("span",{class:"way-glow"},i("i")),i("span",{class:"way-fill"})),i("span",{class:"way-end home"},z("server"))),i("div",{class:"way-text"},i("span",{class:"t"},t,n)));return{el:r,connected(){r.classList.add("done"),te(t,N(_("%s connected"),e.name))},gaveUp(){r.classList.add("stopped"),te(t,_("No connection yet")),n.textContent=_("Close this and open it again to keep checking."),n.hidden=!1,$(t.parentElement,[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"none"}],{duration:280,easing:j})}}}function Ko(e,t=4){window.setTimeout(async()=>{var n;try{let r=await fe("state");ke(r),At()||Ee(),!((n=r.person.devices.find(o=>o.id===e))!=null&&n.online)&&t>1&&Ko(e,t-1)}catch{}},1500)}function Uo(e,t,n){let r=ct(),o=0,s=0,c=!1,m=Date.now(),g=async()=>{if(o=0,!c){if(Date.now()-m>6e5){c=!0,n();return}if(document.hidden)return f();try{let M=await fe("state");ke(M);let b=M.person.devices.find(O=>O.id===e.id);if(b&&b.handshake>r){c=!0,t(),b.online||Ko(e.id);return}}catch(M){if(jt(M)){c=!0;return}}s++,f()}},f=()=>{!c&&!o&&(o=window.setTimeout(g,s<6?5e3:s<12?15e3:3e4))},T=()=>{!document.hidden&&!c&&!o&&g( Line truncated `,Oo(x,t)]:[Oo(x,t)]));r();let o=!!Xe(e.filename,e.conf),i=W("key"),l=s("span",{},_("Show key")),m=s("button",{type:"button",class:"btn soft sm",onclick:()=>{t=!t,i=$n(i,t?"x":"key"),ee(l,t?_("Hide key"):_("Show key")),r(),n.querySelectorAll(".mask, .secret").forEach(x=>$(x,[{filter:"blur(4px)",opacity:.4},{filter:"none",opacity:1}],{duration:320,easing:j}))}},i,l),g=s("button",{type:"button",class:"btn soft sm",onclick:x=>he(e.conf,_("Configuration copied"),x.currentTarget)},W("copy"),s("span",{class:"lbl"},_("Copy"))),f=s("div",{class:"filecard"},s("div",{class:"fc-row"},s("span",{class:"filecard-ic"},".conf"),s("span",{class:"t"},s("span",{class:"mono"},e.filename),s("span",{},_("For computers and routers")))),s("button",{type:"button",class:"btn accent sm block",onclick:()=>Tt(e.filename,e.conf)},W(o?"open":"download"),s("span",{},o?_("Share file"):_("Download")))),E=Ye([{icon:Q("file"),title:_("Configuration"),body:[s("div",{class:"confbar"},m,g),n]}],{inset:!0});return s("div",{class:"step-box"},f,E.el)}function Ko(e){let t=s("span",{class:"osm-p"},ce[e]),n=uo(Ct(e,"ios"),Ct(e,"android"));return{el:s("span",{class:"scanline"},s("span",{},...st(_("In %s:"),t)),n.el),set(r){ee(t,ce[r],void 0,{whole:!0}),n.set(Ct(r,"ios"),Ct(r,"android"))}}}function Uo(e){let t=s("span",{class:"tt"}),n=s("span",{class:"tt-m"}),r=s("span",{class:"hp-tip","aria-hidden":"true"},t,n),o=s("button",{type:"button",class:"hp-b",onclick:()=>Tt(e().file,e().text)},W("download")),i=s("button",{type:"button",class:"hp-b"},W("copy")),l=s("div",{class:"hpill",role:"group","aria-label":_("The connection"),"data-key":"conn"},o,i,r),m=null,g=0,f=0,E=a=>{var h;return a===i&&i.classList.contains("done")?_("Copied"):(h=a.getAttribute("aria-label"))!=null?h:""},x=(a,h)=>{n.textContent=h;let p=n.offsetWidth+20;return Math.min(a.offsetLeft+a.offsetWidth/2,l.offsetWidth+46-p/2)},b=a=>`translateX(${a}px) translateX(-50%)`,O=a=>{let h=getComputedStyle(r).transform;r.getAnimations().forEach(p=>p.cancel()),r.style.transform=b(a),$(r,[{transform:h},{transform:b(a)}],{duration:U.duration,easing:U.easing})},H=a=>ee(t,a),P=a=>{if(clearTimeout(g),m===a&&r.classList.contains("on"))return;if(m=a,r.classList.contains("on")){let p=E(a);return O(x(a,p)),H(p)}let h=()=>{let p=E(a);Pe(t,p);let A=x(a,p);r.getAnimations().forEach(u=>u.cancel()),r.style.transform=b(A),r.classList.add("on"),$(r,[{opacity:0,transform:`${b(A)} translateY(-3px) scale(.96)`,filter:"blur(3px)"},{opacity:1,transform:b(A),filter:"blur(0px)"}],{duration:220,easing:j})};performance.now()<f?h():g=window.setTimeout(h,420)},B=()=>{clearTimeout(g),m=null,r.classList.contains("on")&&(f=performance.now()+500,r.classList.remove("on"),$(r,[{opacity:1},{opacity:0}],{duration:120,easing:"ease-out"}))};for(let a of[o,i])a.addEventListener("pointerenter",h=>{h.pointerType==="mouse"&&P(a)}),a.addEventListener("focus",()=>{a.matches(":focus-visible")&&P(a)}),a.addEventListener("blur",B);l.addEventListener("pointerleave",B);let D=a=>{let h=W(a);i.querySelector("svg").replaceWith(h),$(h,[{opacity:0,transform:"scale(.6)",filter:"blur(3px)"},{opacity:1,transform:"none",filter:"none"}],{duration:xe.duration,easing:xe.easing})},d=()=>{if(m!==i||!r.classList.contains("on"))return;let a=E(i);O(x(i,a)),H(a)},v=0;return i.addEventListener("click",()=>{let a=e();he(a.text,a.msg),clearTimeout(v),i.classList.contains("done")||(i.classList.add("done"),D("check"),d()),v=window.setTimeout(()=>{i.classList.remove("done"),D("copy"),d()},1600)}),{el:l,sync(){let a=e().app;o.setAttribute("aria-label",N(_("Download %s config"),a)),i.setAttribute("aria-label",N(_("Copy %s config"),a))}}}function Vo(e){let t=s("b",{},_("Waiting for the connection")),n=s("span",{class:"ws",hidden:!0}),r=s("div",{class:"way",role:"status","aria-live":"polite"},s("div",{class:"way-row"},s("span",{class:"way-end"},W(e.kind)),s("span",{class:"way-track"},s("span",{class:"way-glow"},s("i")),s("span",{class:"way-fill"})),s("span",{class:"way-end home"},W("server"))),s("div",{class:"way-text"},s("span",{class:"t"},t,n)));return{el:r,connected(){r.classList.add("done"),ee(t,N(_("%s connected"),e.name))},gaveUp(){r.classList.add("stopped"),ee(t,_("No connection yet")),n.textContent=_("Close this and open it again to keep checking."),n.hidden=!1,$(t.parentElement,[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"none"}],{duration:280,easing:j})}}}function Yo(e,t=4){window.setTimeout(async()=>{var n;try{let r=await fe("state");Me(r),At()||_e(),!((n=r.person.devices.find(o=>o.id===e))!=null&&n.online)&&t>1&&Yo(e,t-1)}catch{}},1500)}function jo(e,t,n){let r=ct(),o=0,i=0,l=!1,m=Date.now(),g=async()=>{if(o=0,!l){if(Date.now()-m>6e5){l=!0,n();return}if(document.hidden)return f();try{let x=await fe("state");Me(x);let b=x.person.devices.find(O=>O.id===e.id);if(b&&b.handshake>r){l=!0,t(),b.online||Yo(e.id);return}}catch(x){if(jt(x)){l=!0;return}}i++,f()}},f=()=>{!l&&!o&&(o=window.setTimeout(g,i<6?5e3:i<12?15e3:3e4))},E=()=>{!document.hidden&&!l&&!o&&g()};retur Line truncated
@@ -5,7 +5,7 @@
import { open, readfile, writefile, rename, mkdir, stat, unlink, popen, lsdir } from 'fs'; import { open, readfile, writefile, rename, mkdir, stat, unlink, popen, lsdir } from 'fs';
import { _ } from 'dawnline.i18n'; import { _ } from 'dawnline.i18n';
export const VERSION = '0.11.0'; export const VERSION = '0.12.1';
/** GitHub repository with Dawnline releases (updates and the installer). */ /** GitHub repository with Dawnline releases (updates and the installer). */
export const REPO = 'tickcount/luci-app-dawnline'; export const REPO = 'tickcount/luci-app-dawnline';
export const RUN_DIR = '/var/run/dawnline'; export const RUN_DIR = '/var/run/dawnline';
@@ -6,17 +6,17 @@ import * as live from 'dawnline.live';
import * as awg from 'dawnline.awg'; import * as awg from 'dawnline.awg';
import { day_key_ago, month_key } from 'dawnline.util'; import { day_key_ago, month_key } from 'dawnline.util';
/** Daily totals (rx+tx) for the last `n` days, oldest first. */ /** Each day's [rx, tx] for the last `n` days, oldest first: the charts draw what came and what went apart. */
export function spark(rec, n) { export function spark(rec, n) {
let out = []; let out = [];
for (let i = n - 1; i >= 0; i--) { for (let i = n - 1; i >= 0; i--) {
let v = rec?.days?.[day_key_ago(i)]; let v = rec?.days?.[day_key_ago(i)];
push(out, v ? v[0] + v[1] : 0); push(out, v ? [ v[0], v[1] ] : [ 0, 0 ]);
} }
return out; return out;
}; };
/** Daily totals (rx+tx) from the 1st of this month to today, oldest first (the portal's month chart). */ /** Each day's [rx, tx] from the 1st of this month to today, oldest first (the portal's month chart). */
export function month_days(rec) { export function month_days(rec) {
return spark(rec, +substr(day_key_ago(0), 8, 2)); return spark(rec, +substr(day_key_ago(0), 8, 2));
}; };
+4 -3
View File
@@ -31,8 +31,9 @@ test('month_days', () => {
days[day_key_ago(n)] = [ 100, 100 ]; days[day_key_ago(n)] = [ 100, 100 ];
let s = view.month_days({ days }); let s = view.month_days({ days });
eq(length(s), n, 'one bar a day, from the 1st to today'); eq(length(s), n, 'one bar a day, from the 1st to today');
eq(s[n - 1], 12, 'today last, received and sent together'); eq(s[n - 1], [ 5, 7 ], 'today last, received and sent apart');
eq(s[0], n > 1 ? 3 : 12, 'the 1st first'); eq(s[0], n > 1 ? [ 1, 2 ] : [ 5, 7 ], 'the 1st first');
eq(length(view.month_days(null)), n, 'no usage yet: zeros'); eq(length(view.month_days(null)), n, 'no usage yet: zeros');
eq(view.month_days(null)[0], 0, 'a day without traffic is zero'); eq(view.month_days(null)[0], [ 0, 0 ], 'a day without traffic is zero both ways');
eq(view.spark({ days }, 1), [ [ 5, 7 ] ], 'the week the same way, today last');
}); });
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "dawnline-web", "name": "dawnline-web",
"version": "0.11.0", "version": "0.12.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "dawnline-web", "name": "dawnline-web",
"version": "0.11.0", "version": "0.12.1",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"qrcode-generator": "1.4.4" "qrcode-generator": "1.4.4"
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "dawnline-web", "name": "dawnline-web",
"version": "0.11.0", "version": "0.12.1",
"private": true, "private": true,
"license": "MIT", "license": "MIT",
"type": "module", "type": "module",
+3 -2
View File
@@ -177,7 +177,8 @@ export async function openDevice(person: Person, dev: Device, o: DeviceOpts) {
E('span', { class: 'dl-sub' }, `${p.name} · ${kindLabel(d.kind)}`), E('span', { class: 'dl-sub' }, `${p.name} · ${kindLabel(d.kind)}`),
]), ]),
]); ]);
const week = d.spark.reduce((a, b) => a + b, 0); const days = d.spark.map(([rx, tx]) => rx + tx);
const week = days.reduce((a, b) => a + b, 0);
dom.content( dom.content(
stats, stats,
E('div', { class: 'dl-dstats' }, [ E('div', { class: 'dl-dstats' }, [
@@ -193,7 +194,7 @@ export async function openDevice(person: Person, dev: Device, o: DeviceOpts) {
E('div', { class: 'dl-dstats-cell' }, [ E('div', { class: 'dl-dstats-cell' }, [
E('span', { class: 'dl-metric-label' }, _('Last 7 days')), E('span', { class: 'dl-metric-label' }, _('Last 7 days')),
E('b', {}, bytes(week)), E('b', {}, bytes(week)),
spark(d.spark, 120, 22, today), spark(days, 120, 22, today),
]), ]),
]), ]),
); );
+4 -1
View File
@@ -306,7 +306,10 @@ export class ServerOverview {
const st = this.st; const st = this.st;
const off = st.servers[0] ? !st.servers[0].enabled : false; const off = st.servers[0] ? !st.servers[0].enabled : false;
const CAP = 12; const CAP = 12;
const today = (d: Device) => d.spark[d.spark.length - 1] ?? 0; const today = (d: Device) => {
const [rx, tx] = d.spark[d.spark.length - 1] ?? [0, 0];
return rx + tx;
};
const cityOf = (d: Device) => st.geo.points.find((g) => g.device === d.id && g.city)?.city; const cityOf = (d: Device) => st.geo.points.find((g) => g.device === d.id && g.city)?.city;
const home = (d: Device) => /^(10\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.)/.test(d.endpoint ?? ''); const home = (d: Device) => /^(10\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.)/.test(d.endpoint ?? '');
// Where a device is: its city, or "LAN" when it connects from the home network (the hover // Where a device is: its city, or "LAN" when it connects from the home network (the hover
+1 -1
View File
@@ -600,7 +600,7 @@ export class PeoplePage {
usageSide(p: Person, actions: HTMLElement): HTMLElement { usageSide(p: Person, actions: HTMLElement): HTMLElement {
const used = p.quota_used || p.month[0] + p.month[1]; const used = p.quota_used || p.month[0] + p.month[1];
const pct = p.quota_limit ? Math.min(100, (p.quota_used / p.quota_limit) * 100) : 0; const pct = p.quota_limit ? Math.min(100, (p.quota_used / p.quota_limit) * 100) : 0;
const today = p.devices.reduce((a, d) => a + (d.spark[d.spark.length - 1] ?? 0), 0); const today = p.devices.reduce((a, d) => a + (d.spark[d.spark.length - 1] ?? [0, 0]).reduce((x, y) => x + y), 0);
const r = p.rate?.[p.rate.length - 1]; const r = p.rate?.[p.rate.length - 1];
const live = p.online && r && this.st.now - r[0] < 180; const live = p.online && r && this.st.now - r[0] < 180;
+8 -2
View File
@@ -243,10 +243,16 @@
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; } 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-title { font-weight: 500; }
.dl-tip-float { position: fixed; z-index: 2000; color: var(--dl-fg); } .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-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-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-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 { display: flex; align-items: flex-end; flex: 0 0 auto; --dl-gap: 2px; }
.dl-spark i { flex: 1; display: block; border-radius: 2px 2px 0 0; background: var(--dl-chart-1); opacity: .85; } .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; } .dl-spark i.zero { opacity: .22; }
.dl-spark > span:hover i:not(.zero) { opacity: 1; filter: brightness(1.25); }
/* A day's column in the daily charts (spark, a device card's bars, the last 30 days): the chart's full height and
half the gap on either side, so its tooltip answers above a short bar and between two bars. The outer columns
keep no outer half, so the bars stand where a plain gap would put them. */
.dl-spark > span, .dl-dbars > span, .dl-bento-bars > span { flex: 1; min-width: 0; height: 100%; display: flex; align-items: flex-end; padding: 0 calc(var(--dl-gap) / 2); }
.dl-spark > span:first-child, .dl-dbars > span:first-child, .dl-bento-bars > span:first-child { padding-left: 0; }
.dl-spark > span:last-child, .dl-dbars > span:last-child, .dl-bento-bars > span:last-child { padding-right: 0; }
+4 -4
View File
@@ -25,11 +25,11 @@
.dl-dcard-trend { display: flex; align-items: flex-end; gap: 12px; min-width: 0; } .dl-dcard-trend { display: flex; align-items: flex-end; gap: 12px; min-width: 0; }
.dl-dcard-trend > .dl-stack { flex: none; } .dl-dcard-trend > .dl-stack { flex: none; }
.dl-dcard-trend b { font-size: 16px; font-weight: 500; font-variant-numeric: tabular-nums; } .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 { flex: 1; min-width: 0; height: 32px; display: flex; align-items: flex-end; --dl-gap: 2px; }
.dl-dbars i { flex: 1; min-width: 0; border-radius: 2px; background: var(--dl-chart-1); opacity: .55; } .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.zero { background: var(--dl-track); opacity: 1; }
.dl-dbars i.hi { opacity: 1; } .dl-dbars i.hi { opacity: 1; }
.dl-dbars i:hover { opacity: 1; filter: brightness(1.2); } .dl-dbars > span:hover i { opacity: 1; filter: brightness(1.2); }
.dl-datechip { position: relative; display: inline-flex; } .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-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 .dl-icon { width: 13px; height: 13px; }
@@ -147,10 +147,10 @@
.dl-meter i { width: 16px; height: 4px; border-radius: 2px; background: var(--dl-line); } .dl-meter i { width: 16px; height: 4px; border-radius: 2px; background: var(--dl-line); }
.dl-meter i.on { background: var(--dl-accent); } .dl-meter i.on { background: var(--dl-accent); }
.dl-bento-total { font-size: 16px; font-weight: 500; margin-left: 8px; } .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 { display: flex; align-items: flex-end; height: 54px; --dl-gap: 3px; }
.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 { 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.future { height: 4px; background: var(--dl-soft); }
.dl-bento-bars i:hover { background: var(--dl-fg-faint); } .dl-bento-bars > span:hover i:not(.hi) { background: var(--dl-fg-faint); }
.dl-bento-bars i.hi { background: var(--dl-accent); } .dl-bento-bars i.hi { background: var(--dl-accent); }
@media (max-width: 700px) { .dl-addrbar { flex-wrap: wrap; } } @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: 900px) { .dl-bento { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .dl-bento-tile.online { grid-column: span 2; } }
+4 -2
View File
@@ -15,8 +15,10 @@ export function spark(values: number[], width = 120, height = 26, today = isoDay
const b = E('i'); const b = E('i');
b.style.height = `${Math.max(6, (v / max) * 100)}%`; b.style.height = `${Math.max(6, (v / max) * 100)}%`;
if (!v) b.classList.add('zero'); if (!v) b.classList.add('zero');
// The day's column carries the tooltip: it answers above a short bar and between two bars.
const col = E('span', {}, [b]);
const back = values.length - 1 - i; const back = values.length - 1 - i;
attachTip(b, () => [ attachTip(col, () => [
E( E(
'div', 'div',
{ class: 'dl-tip-title' }, { class: 'dl-tip-title' },
@@ -28,7 +30,7 @@ export function spark(values: number[], width = 120, height = 26, today = isoDay
), ),
E('div', { class: 'dl-muted' }, bytes(v)), E('div', { class: 'dl-muted' }, bytes(v)),
]); ]);
el.appendChild(b); el.appendChild(col);
}); });
return el; return el;
} }
+7 -4
View File
@@ -75,12 +75,14 @@ export function daysTile(series: DayUsage[], note: string): HTMLElement {
days.map((d, i) => { days.map((d, i) => {
const v = vals[i]; const v = vals[i];
const bar = E('i', { class: i === days.length - 1 ? 'hi' : '', style: `height:${Math.max(4, (v / max) * 100)}%` }); const bar = E('i', { class: i === days.length - 1 ? 'hi' : '', style: `height:${Math.max(4, (v / max) * 100)}%` });
attachTip(bar, () => [ // The day's column carries the tooltip: it answers above a short bar and between two bars.
const col = E('span', {}, [bar]);
attachTip(col, () => [
E('div', { class: 'dl-tip-title' }, i === days.length - 1 ? `${_('Today')} · ${dayLabel(d.day)}` : dayLabel(d.day)), E('div', { class: 'dl-tip-title' }, i === days.length - 1 ? `${_('Today')} · ${dayLabel(d.day)}` : dayLabel(d.day)),
E('div', {}, bytes(v)), E('div', {}, bytes(v)),
E('div', { class: 'dl-muted dl-mono' }, `↓ ${bytes(d.tx)} ↑ ${bytes(d.rx)}`), E('div', { class: 'dl-muted dl-mono' }, `↓ ${bytes(d.tx)} ↑ ${bytes(d.rx)}`),
]); ]);
return bar; return col;
}), }),
); );
return E('div', { class: 'dl-bento-tile month' }, [ return E('div', { class: 'dl-bento-tile month' }, [
@@ -108,11 +110,12 @@ export function dayBars(series: DayUsage[]): HTMLElement {
days.map((x, i) => { days.map((x, i) => {
const bar = E('i', { class: `${vals[i] ? '' : 'zero'}${i === days.length - 1 ? ' hi' : ''}` }); const bar = E('i', { class: `${vals[i] ? '' : 'zero'}${i === days.length - 1 ? ' hi' : ''}` });
bar.style.height = `${Math.max(8, (vals[i] / max) * 100)}%`; bar.style.height = `${Math.max(8, (vals[i] / max) * 100)}%`;
attachTip(bar, () => [ const col = E('span', {}, [bar]);
attachTip(col, () => [
E('div', { class: 'dl-tip-title' }, i === days.length - 1 ? `${_('Today')} · ${dayLabel(x.day)}` : dayLabel(x.day)), E('div', { class: 'dl-tip-title' }, i === days.length - 1 ? `${_('Today')} · ${dayLabel(x.day)}` : dayLabel(x.day)),
E('div', {}, bytes(vals[i])), E('div', {}, bytes(vals[i])),
]); ]);
return bar; return col;
}), }),
); );
} }
+10 -5
View File
@@ -4,7 +4,7 @@
// scenario picker is picker.ts). // scenario picker is picker.ts).
import type { State } from '../state'; import type { State } from '../state';
import type { Device, Kind, Person } from '../../shared/types'; import type { Device, Kind, Pair, Person } from '../../shared/types';
export const GB = 2 ** 30; export const GB = 2 ** 30;
const HOUR = 3600; const HOUR = 3600;
@@ -109,8 +109,11 @@ const label = (s: string) =>
/** How busy each day of the week is, Monday first. */ /** How busy each day of the week is, Monday first. */
const WEEK = [0.9, 1.15, 0.8, 1.05, 1.3, 0.75, 1.1]; const WEEK = [0.9, 1.15, 0.8, 1.05, 1.3, 0.75, 1.1];
/** The month so far, day by day, adding up to `total` bytes (today only partly gone). */ /** A day split into what the devices sent and received: about a tenth sent, more on a day something backed up. */
export function monthDays(total: number, t: number): number[] { const split = (v: number, sent: number): Pair => [Math.round(v * sent), v - Math.round(v * sent)];
/** The month so far, day by day as [rx, tx], adding up to `total` bytes (today only partly gone). */
export function monthDays(total: number, t: number): Pair[] {
const d = new Date(t * 1000); const d = new Date(t * 1000);
const days = d.getDate(); const days = d.getDate();
const w = Array.from({ length: days }, (_, i) => { const w = Array.from({ length: days }, (_, i) => {
@@ -118,7 +121,7 @@ export function monthDays(total: number, t: number): number[] {
return WEEK[wd] * (i === days - 1 ? 0.45 : 1) * (0.85 + ((i * 37) % 11) / 30); return WEEK[wd] * (i === days - 1 ? 0.45 : 1) * (0.85 + ((i * 37) % 11) / 30);
}); });
const sum = w.reduce((a, b) => a + b, 0); const sum = w.reduce((a, b) => a + b, 0);
return w.map((x) => Math.round((x / sum) * total)); return w.map((x, i) => split(Math.round((x / sum) * total), i % 11 === 4 ? 0.4 : 0.08 + ((i * 17) % 9) / 100));
} }
/** A window of the day that leaves `t` out (the visitor's hours): the hours scenario is outside it. */ /** A window of the day that leaves `t` out (the visitor's hours): the hours scenario is outside it. */
@@ -149,7 +152,9 @@ function device(d: DemoDevice, t: number, st: Person['state']): Device {
active: true, active: true,
month: [Math.round(month / 8), Math.round((month * 7) / 8)], month: [Math.round(month / 8), Math.round((month * 7) / 8)],
total: [Math.round(month / 4), Math.round((month * 7) / 4)], total: [Math.round(month / 4), Math.round((month * 7) / 4)],
spark: [0.8, 1.3, 0.6, 1.1, 1.6, 0.9, 1].map((f) => (hs ? Math.round(((month / 4) * f) / 7) : 0)), spark: [0.8, 1.3, 0.6, 1.1, 1.6, 0.9, 1].map((f, i) =>
split(hs ? Math.round(((month / 4) * f) / 7) : 0, [0.1, 0.14, 0.08, 0.35, 0.11, 0.09, 0.12][i]),
),
hostname: `${label(d.name)}.user.lan`, hostname: `${label(d.name)}.user.lan`,
browser_key: false, browser_key: false,
config_stale: d.stale, config_stale: d.stale,
+10 -6
View File
@@ -24,7 +24,7 @@ import {
type Store, type Store,
} from '../setup'; } from '../setup';
import { accordion } from '../ui/accordion'; import { accordion } from '../ui/accordion';
import { copy, download, sendFile, shareFile } from '../ui/feedback'; import { copy, download, sendFile, shareFile, swapIcon } from '../ui/feedback';
import { glass } from '../ui/glass'; import { glass } from '../ui/glass';
import { menuLine, morphText, setText } from '../ui/morph'; import { menuLine, morphText, setText } from '../ui/morph';
import { hint } from '../ui/sheet'; import { hint } from '../ui/sheet';
@@ -206,7 +206,8 @@ function confLine(line: string, reveal: boolean): Node {
const m = /^(\s*[A-Za-z0-9]+\s*=)\s*(.*)$/.exec(line); const m = /^(\s*[A-Za-z0-9]+\s*=)\s*(.*)$/.exec(line);
if (!m) return document.createTextNode(line); if (!m) return document.createTextNode(line);
const secret = /^(\s*)(PrivateKey|PresharedKey)\b/.test(line); const secret = /^(\s*)(PrivateKey|PresharedKey)\b/.test(line);
return h('span', {}, h('span', { class: 'k' }, m[1]), ' ', secret && !reveal ? h('span', { class: 'mask' }, '••••••••••••••••') : m[2]); const value = !secret ? m[2] : reveal ? h('span', { class: 'secret' }, m[2]) : h('span', { class: 'mask' }, '••••••••••••••••');
return h('span', {}, h('span', { class: 'k' }, m[1]), ' ', value);
} }
/** The .conf for a router: a file card to download (or share), and the configuration folded, its keys hidden. */ /** The .conf for a router: a file card to download (or share), and the configuration folded, its keys hidden. */
@@ -217,6 +218,8 @@ export function filePane(cfg: ClientConfig): HTMLElement {
pre.replaceChildren(...cfg.conf.split('\n').flatMap((l, i) => (i ? ['\n', confLine(l, reveal)] : [confLine(l, reveal)]))); pre.replaceChildren(...cfg.conf.split('\n').flatMap((l, i) => (i ? ['\n', confLine(l, reveal)] : [confLine(l, reveal)])));
paint(); paint();
const share = !!shareFile(cfg.filename, cfg.conf); const share = !!shareFile(cfg.filename, cfg.conf);
let icon = ic('key');
const label = h('span', {}, _('Show key'));
const eye = h( const eye = h(
'button', 'button',
{ {
@@ -224,10 +227,11 @@ export function filePane(cfg: ClientConfig): HTMLElement {
class: 'btn soft sm', class: 'btn soft sm',
onclick: () => { onclick: () => {
reveal = !reveal; reveal = !reveal;
eye.replaceChildren(ic(reveal ? 'x' : 'key'), h('span', {}, reveal ? _('Hide key') : _('Show key'))); icon = swapIcon(icon, reveal ? 'x' : 'key');
morphText(label, reveal ? _('Hide key') : _('Show key'));
paint(); paint();
// A key shown comes into focus out of a blur; hidden again, the mask fades back. // A key shown comes into focus out of a blur; hidden again, the mask fades back.
pre.querySelectorAll('.mask, .k').forEach((x) => pre.querySelectorAll('.mask, .secret').forEach((x) =>
play( play(
x, x,
[ [
@@ -239,8 +243,8 @@ export function filePane(cfg: ClientConfig): HTMLElement {
); );
}, },
}, },
ic('key'), icon,
h('span', {}, _('Show key')), label,
); );
const cp = h( const cp = h(
'button', 'button',
+10 -18
View File
@@ -109,10 +109,6 @@ msgid_plural "%s of %s slots free"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
#: web/src/portal/page/access.ts
msgid "%s on %s"
msgstr ""
#: web/src/portal/page/devices.ts #: web/src/portal/page/devices.ts
msgid "%s options" msgid "%s options"
msgstr "" msgstr ""
@@ -121,10 +117,6 @@ msgstr ""
msgid "%s this month" msgid "%s this month"
msgstr "" msgstr ""
#: web/src/portal/page/access.ts
msgid "%s used"
msgstr ""
#: web/src/portal/page/notices.ts #: web/src/portal/page/notices.ts
msgid "%s your time" msgid "%s your time"
msgstr "" msgstr ""
@@ -494,6 +486,10 @@ msgstr ""
msgid "Download the key" msgid "Download the key"
msgstr "" msgstr ""
#: web/src/portal/ui/bars.ts
msgid "Downloaded"
msgstr ""
#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc #: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc
msgid "End date must be YYYY-MM-DD." msgid "End date must be YYYY-MM-DD."
msgstr "" msgstr ""
@@ -644,10 +640,6 @@ msgstr ""
msgid "Its connection stops working at once. You can add it again later." msgid "Its connection stops working at once. You can add it again later."
msgstr "" msgstr ""
#: web/src/portal/page/devices.ts
msgid "Its settings changed: update the connection"
msgstr ""
#: web/src/shared/format.ts #: web/src/shared/format.ts
msgid "KB" msgid "KB"
msgstr "" msgstr ""
@@ -943,6 +935,10 @@ msgstr ""
msgid "Reconnect" msgid "Reconnect"
msgstr "" msgstr ""
#: web/src/portal/page/devices.ts
msgid "Reconnect %s"
msgstr ""
#: web/src/portal/flows/device-actions.ts #: web/src/portal/flows/device-actions.ts
msgid "Reconnect %s?" msgid "Reconnect %s?"
msgstr "" msgstr ""
@@ -1200,12 +1196,8 @@ msgstr ""
msgid "Unknown service %s." msgid "Unknown service %s."
msgstr "" msgstr ""
#: web/src/portal/page/devices.ts #: web/src/portal/ui/bars.ts
msgid "Update" msgid "Uploaded"
msgstr ""
#: web/src/portal/page/devices.ts
msgid "Update the connection"
msgstr "" msgstr ""
#: web/src/portal/flows/wait.ts #: web/src/portal/flows/wait.ts
+11 -19
View File
@@ -114,10 +114,6 @@ msgstr[0] "Свободно %s из %s места"
msgstr[1] "Свободно %s из %s мест" msgstr[1] "Свободно %s из %s мест"
msgstr[2] "Свободно %s из %s мест" msgstr[2] "Свободно %s из %s мест"
#: web/src/portal/page/access.ts
msgid "%s on %s"
msgstr "%s за %s"
#: web/src/portal/page/devices.ts #: web/src/portal/page/devices.ts
msgid "%s options" msgid "%s options"
msgstr "Действия с устройством %s" msgstr "Действия с устройством %s"
@@ -126,10 +122,6 @@ msgstr "Действия с устройством %s"
msgid "%s this month" msgid "%s this month"
msgstr "%s в этом месяце" msgstr "%s в этом месяце"
#: web/src/portal/page/access.ts
msgid "%s used"
msgstr "%s использовано"
#: web/src/portal/page/notices.ts #: web/src/portal/page/notices.ts
msgid "%s your time" msgid "%s your time"
msgstr "%s по вашему времени" msgstr "%s по вашему времени"
@@ -499,6 +491,10 @@ msgstr "Скачать файл"
msgid "Download the key" msgid "Download the key"
msgstr "Скачать ключ" msgstr "Скачать ключ"
#: web/src/portal/ui/bars.ts
msgid "Downloaded"
msgstr "Получено"
#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc #: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc
msgid "End date must be YYYY-MM-DD." msgid "End date must be YYYY-MM-DD."
msgstr "Дата окончания должна быть в формате ГГГГ-ММ-ДД." msgstr "Дата окончания должна быть в формате ГГГГ-ММ-ДД."
@@ -649,10 +645,6 @@ msgstr "Устройство получит новые ключи. Сейчас
msgid "Its connection stops working at once. You can add it again later." msgid "Its connection stops working at once. You can add it again later."
msgstr "Подключение сразу перестанет работать. Устройство можно будет добавить снова." msgstr "Подключение сразу перестанет работать. Устройство можно будет добавить снова."
#: web/src/portal/page/devices.ts
msgid "Its settings changed: update the connection"
msgstr "Настройки изменились: обновите подключение"
#: web/src/shared/format.ts #: web/src/shared/format.ts
msgid "KB" msgid "KB"
msgstr "КБ" msgstr "КБ"
@@ -948,6 +940,10 @@ msgstr "QR-код"
msgid "Reconnect" msgid "Reconnect"
msgstr "Переподключить" msgstr "Переподключить"
#: web/src/portal/page/devices.ts
msgid "Reconnect %s"
msgstr "Переподключить %s"
#: web/src/portal/flows/device-actions.ts #: web/src/portal/flows/device-actions.ts
msgid "Reconnect %s?" msgid "Reconnect %s?"
msgstr "Переподключить «%s»?" msgstr "Переподключить «%s»?"
@@ -1205,13 +1201,9 @@ msgstr "Неизвестный сервер."
msgid "Unknown service %s." msgid "Unknown service %s."
msgstr "Неизвестный сервис %s." msgstr "Неизвестный сервис %s."
#: web/src/portal/page/devices.ts #: web/src/portal/ui/bars.ts
msgid "Update" msgid "Uploaded"
msgstr "Обновить" msgstr "Отправлено"
#: web/src/portal/page/devices.ts
msgid "Update the connection"
msgstr "Обновить подключение"
#: web/src/portal/flows/wait.ts #: web/src/portal/flows/wait.ts
msgid "Waiting for the connection" msgid "Waiting for the connection"
+5 -1
View File
@@ -33,7 +33,11 @@ let redraw: () => void = () => {};
/** The first paint comes in: the blocks rise one after the other, the sun rises behind its line. */ /** The first paint comes in: the blocks rise one after the other, the sun rises behind its line. */
function intro() { function intro() {
const els = [...app.querySelectorAll('.crumbs, .notice, .sec-head, .dgrid > *, .note-s:not([hidden]), .acc-slot .acc-row, .gone')]; // In the order they stand on screen, top to bottom and then left to right: on a phone "Your access" comes before the devices.
const els = [...app.querySelectorAll('.crumbs, .notice, .sec-head, .dgrid > *, .note-s:not([hidden]), .acc-slot .acc-row, .gone')]
.map((el) => ({ el, at: el.getBoundingClientRect() }))
.sort((a, b) => Math.round(a.at.top) - Math.round(b.at.top) || a.at.left - b.at.left)
.map((x) => x.el);
// Each block rises to its own opacity: a card the admin disabled is dimmed all the way, not at the end. // Each block rises to its own opacity: a card the admin disabled is dimmed all the way, not at the end.
const own = els.map((el) => getComputedStyle(el).opacity); const own = els.map((el) => getComputedStyle(el).opacity);
els.forEach((el, i) => els.forEach((el, i) =>
+20 -42
View File
@@ -4,13 +4,14 @@
// the month day by day inside; and until when, as the days left over a // the month day by day inside; and until when, as the days left over a
// calendar of the weeks, with the admin's hours as a bar of the day. // calendar of the weeks, with the admin's hours as a bar of the day.
import type { Person } from '../../shared/types'; import type { Pair, Person } from '../../shared/types';
import { accessLabel, byDeviceState, bytes, date, daysLeft, endsSoon, parseDay } from '../../shared/format'; import { accessLabel, byDeviceState, bytes, date, daysLeft, endsSoon, parseDay } from '../../shared/format';
import { fill, fmt, locale, num, plural } from '../../shared/i18n'; import { fill, fmt, locale, num, plural } from '../../shared/i18n';
import { h, ic, markup } from '../dom'; import { h, ic, markup } from '../dom';
import { calendar, clockOf, hoursFor, minuteAt, monthOf, stretches } from '../days'; import { calendar, clockOf, hoursFor, minuteAt, monthOf, stretches } from '../days';
import { now, today, type State } from '../state'; import { now, today, type State } from '../state';
import { accordion, type Accordion } from '../ui/accordion'; import { accordion, type Accordion } from '../ui/accordion';
import { bars, upDown } from '../ui/bars';
import { copy } from '../ui/feedback'; import { copy } from '../ui/feedback';
import { glass } from '../ui/glass'; import { glass } from '../ui/glass';
import { morphChanged, setText, textsOf } from '../ui/morph'; import { morphChanged, setText, textsOf } from '../ui/morph';
@@ -93,34 +94,27 @@ function meter(pct: number): HTMLElement {
return h('div', { class: 'meter' }, i); return h('div', { class: 'meter' }, i);
} }
/** The month as one bar a day (today in blue, days to come faint), and the total under it. */ /** The month a day at a time, down and up (today in blue, days to come flat), what came and went under it. */
function month(p: Person, used: number, pct: number): HTMLElement { function month(p: Person, used: number, pct: number): HTMLElement {
const { days, day } = monthOf(today()); const { days, day } = monthOf(today());
const series = p.month_days ?? []; const series = Array.from({ length: day }, (_x, i): Pair => p.month_days?.[i] ?? [0, 0]);
const max = Math.max(1, ...series);
const short = (d: number) => dayMonth(`${today().slice(0, 8)}${String(d).padStart(2, '0')}`); const short = (d: number) => dayMonth(`${today().slice(0, 8)}${String(d).padStart(2, '0')}`);
// The total, and a bar under the pointer in its place, at once: no morph while the pointer moves. // The month's down and up; a day under the pointer puts its own in their place and its date where "left" stands,
const total = h('b', { class: 'num', 'data-t': 'm-used' }, bytes(used)); // at once: no morph while the pointer moves.
const read = h('span', { class: 'mread' }); const read = upDown('m');
/** The month's total, or (`d`) one day's: the number in its sentence. */ const left = p.quota_limit ? fmt(_('%s left'), bytes(Math.max(0, p.quota_limit - used))) : _('No limit');
const say = (v: number, d?: number) => { const side = h('span', { class: 'num', 'data-t': 'm-left' }, left);
setText(total, bytes(v)); const say = (v: Pair, d?: number) => {
read.replaceChildren(...(d ? fill<Node | string>(_('%s on %s'), total, short(d)) : fill(_('%s used'), total))); read.set(v);
setText(side, d ? short(d) : left);
side.classList.toggle('bad-t', !d && p.state === 'quota');
}; };
say(used); say(p.month);
const bars = h('div', { class: 'mbars' }); const chart = bars(series, 'bars-month', 64, days - day);
for (let i = 0; i < days; i++) { chart.cols.forEach((col, i) => {
if (i >= day) { col.addEventListener('pointerenter', () => say(series[i], i + 1));
bars.appendChild(h('i', { class: 'future' })); col.addEventListener('pointerleave', () => say(p.month));
continue; });
}
const v = series[i] ?? 0;
const b = h('i', { class: i === day - 1 ? 'today' : '' });
b.style.height = `${Math.max(3, Math.round((v / max) * 64))}px`;
b.addEventListener('pointerenter', () => say(v, i + 1));
b.addEventListener('pointerleave', () => say(used));
bars.appendChild(b);
}
// "Today" under its bar; the month's ends step aside when it comes close. // "Today" under its bar; the month's ends step aside when it comes close.
const td = h('span', { class: 'td' }, _('Today')); const td = h('span', { class: 'td' }, _('Today'));
td.style.left = pc(day - 0.5, days); td.style.left = pc(day - 0.5, days);
@@ -131,23 +125,7 @@ function month(p: Person, used: number, pct: number): HTMLElement {
td, td,
h('span', { class: day >= days - 3 ? 'hide' : '' }, short(days)), h('span', { class: day >= days - 3 ? 'hide' : '' }, short(days)),
); );
return h( return h('div', { class: 'month' }, chart.el, axis, h('div', { class: 'month-read' }, read.el, side), p.quota_limit ? meter(pct) : null);
'div',
{ class: 'month' },
bars,
axis,
h(
'div',
{ class: 'month-read' },
read,
h(
'span',
{ class: `num${p.state === 'quota' ? ' bad-t' : ''}`, 'data-t': 'm-left' },
p.quota_limit ? fmt(_('%s left'), bytes(Math.max(0, p.quota_limit - used))) : _('No limit'),
),
),
p.quota_limit ? meter(pct) : null,
);
} }
/** The days left as a number over a calendar of the weeks to the end (the last day ringed). */ /** The days left as a number over a calendar of the weeks to the end (the last day ringed). */
+57 -42
View File
@@ -5,11 +5,12 @@
// flows/. // flows/.
import type { Device, Person } from '../../shared/types'; import type { Device, Person } from '../../shared/types';
import { addDays, ago, byDeviceState, bytes, parseDay } from '../../shared/format'; import { addDays, ago, byDeviceState, parseDay } from '../../shared/format';
import { fmt, locale, num, plural } from '../../shared/i18n'; import { fmt, locale, num, plural } from '../../shared/i18n';
import { h, ic } from '../dom'; import { h, ic } from '../dom';
import { BOUNCY, EASE_IN, EASE_OUT, SMOOTH, play } from '../motion'; import { BOUNCY, EASE_IN, EASE_OUT, SMOOTH, play } from '../motion';
import { now, today, type RepaintOpts, type State } from '../state'; import { now, today, type RepaintOpts, type State } from '../state';
import { bars, sumDays, upDown } from '../ui/bars';
import { copy } from '../ui/feedback'; import { copy } from '../ui/feedback';
import { glass } from '../ui/glass'; import { glass } from '../ui/glass';
import { openMenu, type MenuItem } from '../ui/menu'; import { openMenu, type MenuItem } from '../ui/menu';
@@ -24,7 +25,7 @@ export const reachableFromHome = (p: Person, d: Device) => p.access !== 'interne
/** The status line: its class and words (short, on one line; the full wording shows on hover). */ /** The status line: its class and words (short, on one line; the full wording shows on hover). */
function statusOf(d: Device, p: Person): [string, string] { function statusOf(d: Device, p: Person): [string, string] {
if (d.disabled) return ['', _('Disabled')]; if (d.disabled) return ['', _('Disabled')];
// The Update pill beside it says what to do. // The Reconnect button under it says what to do.
if (d.config_stale && d.handshake) return ['warn-t', _('Settings changed')]; if (d.config_stale && d.handshake) return ['warn-t', _('Settings changed')];
// Over the data limit or outside the hours the tunnel stays up but passes nothing: the app says // Over the data limit or outside the hours the tunnel stays up but passes nothing: the app says
// "connected", so say here why nothing works. // "connected", so say here why nothing works.
@@ -63,45 +64,26 @@ function dayName(back: number): string {
return parseDay(addDays(today(), -back)).toLocaleDateString(locale(), { weekday: 'short', day: 'numeric', month: 'short' }); return parseDay(addDays(today(), -back)).toLocaleDateString(locale(), { weekday: 'short', day: 'numeric', month: 'short' });
} }
/** Last 7 days as a number and bars; a bar under the pointer puts its own day in the number's place. */ /** Last 7 days down and up over their bars; a day under the pointer puts its own numbers in their place. */
function usage(d: Device, stale: boolean): HTMLElement { function usage(d: Device): HTMLElement {
const week = d.spark.reduce((a, b) => a + b, 0); const week = sumDays(d.spark);
const lbl = h('span', { class: 'use-lbl' }, _('Last 7 days')); const lbl = h('span', { class: 'use-lbl' }, _('Last 7 days'));
const val = h('span', { class: 'use-val num', 'data-t': `${d.id}:use` }, bytes(week)); const val = upDown(d.id);
let side: HTMLElement; val.set(week);
if (stale) const chart = bars(d.spark, 'bars-week', 34);
side = h( chart.cols.forEach((col, i) => {
'button', const back = d.spark.length - 1 - i;
{ // What the pointer reads off the bars changes at once: no morph while it moves.
type: 'button', col.addEventListener('pointerenter', () => {
class: 'upd-pill', setText(lbl, dayName(back));
'aria-label': _('Update the connection'), val.set(d.spark[i]);
title: _('Its settings changed: update the connection'),
onclick: () => reconnect(d),
},
ic('refresh'),
h('span', {}, _('Update')),
);
else {
const max = Math.max(1, ...d.spark);
side = h('div', { class: 'spark' });
d.spark.forEach((v, i) => {
const back = d.spark.length - 1 - i;
const b = h('i', { class: back === 0 ? 'today' : '' });
b.style.height = `${Math.max(3, Math.round((v / max) * 34))}px`;
// What the pointer reads off the bars changes at once: no morph while it moves.
b.addEventListener('pointerenter', () => {
setText(lbl, dayName(back));
setText(val, bytes(v));
});
b.addEventListener('pointerleave', () => {
setText(lbl, _('Last 7 days'));
setText(val, bytes(week));
});
side.appendChild(b);
}); });
} col.addEventListener('pointerleave', () => {
return h('div', { class: 'dev-use' }, h('div', { class: 'use-txt' }, lbl, val), side); setText(lbl, _('Last 7 days'));
val.set(week);
});
});
return h('div', { class: 'dev-use' }, h('div', { class: 'use-txt' }, lbl, h('span', { class: 'use-val' }, val.el)), chart.el);
} }
function card(d: Device, st: State): HTMLElement { function card(d: Device, st: State): HTMLElement {
@@ -150,7 +132,8 @@ function card(d: Device, st: State): HTMLElement {
), ),
more, more,
), ),
// Stopped by the admin: a device never set up has nothing to show. // Stopped by the admin: a device never set up has nothing to show. Its settings changed: Reconnect in
// place of its week (new keys, then set it up again), as a device not set up yet shows Connect.
setUp && locked setUp && locked
? null ? null
: setUp : setUp
@@ -165,7 +148,19 @@ function card(d: Device, st: State): HTMLElement {
ic('qr'), ic('qr'),
h('span', {}, _('Connect')), h('span', {}, _('Connect')),
) )
: usage(d, stale), : stale
? h(
'button',
{
type: 'button',
class: 'btn tint block setup-btn',
'aria-label': fmt(_('Reconnect %s'), d.name),
onclick: () => reconnect(d),
},
ic('refresh'),
h('span', {}, _('Reconnect')),
)
: usage(d),
); );
} }
@@ -190,15 +185,35 @@ const addCard = () =>
/** The section, built once; `fill` puts the cards in. */ /** The section, built once; `fill` puts the cards in. */
export function devicesSection(): HTMLElement { export function devicesSection(): HTMLElement {
const grid = h('div', { class: 'dgrid' });
snapOnJump(grid);
return h( return h(
'section', 'section',
{ class: 'devices', id: 'devices', 'aria-label': _('Your devices') }, { class: 'devices', id: 'devices', 'aria-label': _('Your devices') },
h('div', { class: 'sec-head' }, h('h2', {}, _('Your devices')), h('span', { class: 'aside num' })), h('div', { class: 'sec-head' }, h('h2', {}, _('Your devices')), h('span', { class: 'aside num' })),
h('div', { class: 'dgrid' }), grid,
h('p', { class: 'note-s limit', hidden: true }), h('p', { class: 'note-s limit', hidden: true }),
); );
} }
/**
* A card whose width jumps (the grid changed its columns: a window across 560 or 960 px, a phone turned)
* takes its new shape with the layout, at once: gliding there from the old one, its numbers would not fit
* for a moment and wrap. A threshold crossed while the window is resized a little at a time still glides
* (devices.css). The class goes on before the frame is painted, so the glide that began never shows.
*/
function snapOnJump(grid: HTMLElement) {
let was = 0;
new ResizeObserver(() => {
const w = grid.querySelector('.dev')?.getBoundingClientRect().width ?? 0;
if (Math.abs(w - was) > 16) {
grid.classList.add('snap');
requestAnimationFrame(() => requestAnimationFrame(() => grid.classList.remove('snap')));
}
was = w;
}).observe(grid);
}
/** The cards for this state, moving from where they were. */ /** The cards for this state, moving from where they were. */
export function fillDevices(section: HTMLElement, st: State, o: RepaintOpts = {}) { export function fillDevices(section: HTMLElement, st: State, o: RepaintOpts = {}) {
const p = st.person; const p = st.person;
+7 -25
View File
@@ -125,28 +125,6 @@
flex-direction: column; flex-direction: column;
gap: 8px; gap: 8px;
} }
.mbars {
display: flex;
align-items: flex-end;
gap: 3px;
height: 64px;
}
.mbars i {
flex: 1;
border-radius: 2.5px;
background: var(--bar);
min-height: 3px;
transition: background-color 120ms;
}
.mbars i.future {
background: color-mix(in srgb, var(--bar) 45%, transparent);
}
.mbars i.today {
background: var(--accent);
}
.mbars i:not(.future):hover {
background: var(--text-2);
}
.month-axis { .month-axis {
position: relative; position: relative;
display: flex; display: flex;
@@ -171,7 +149,10 @@
font-size: 13px; font-size: 13px;
color: var(--text-2); color: var(--text-2);
} }
.month-read b { .month-read > * {
white-space: nowrap;
}
.month-read .ud {
color: var(--text); color: var(--text);
font-weight: 500; font-weight: 500;
font-size: 15px; font-size: 15px;
@@ -273,7 +254,8 @@
.until.soon .cal-g i.end { .until.soon .cal-g i.end {
box-shadow: inset 0 0 0 1.5px var(--warn); box-shadow: inset 0 0 0 1.5px var(--warn);
} }
.acc-row.open .cal-g i { /* The days come in when the person opens the row, not when a repaint rebuilds it open. */
.acc-row.opened .cal-g i {
animation: cal-in 360ms var(--ease-out) backwards; animation: cal-in 360ms var(--ease-out) backwards;
animation-delay: calc(var(--i) * 7ms); animation-delay: calc(var(--i) * 7ms);
} }
@@ -339,7 +321,7 @@
} }
@media (prefers-reduced-motion: reduce) { @media (prefers-reduced-motion: reduce) {
.acc-row.open .cal-g i { .acc-row.opened .cal-g i {
animation: none; animation: none;
} }
} }
+131
View File
@@ -0,0 +1,131 @@
/* Traffic by day, both ways (ui/bars.ts): downloads rise above a hairline, uploads hang below it,
today in accent; a device card's week and the month in "Your access". Beside them, "↓ 3.9 GB ↑ 819 MB".
The columns meet: each takes half the gap on either side, so the pointer reads a day in the gaps too, and
the row gives the outer halves back so the bars stand where a plain gap would put them. */
.bars {
--gap: 3px;
position: relative;
display: flex;
flex: none;
margin-inline: calc(var(--gap) / -2);
}
.bars-week {
--gap: 4px;
transition: margin var(--fit);
}
.bars .col {
display: flex;
flex-direction: column;
padding-inline: calc(var(--gap) / 2);
}
.bars-month .col {
flex: 1;
min-width: 0;
}
.bars .half {
display: flex;
flex-direction: column;
}
.bars .half.top {
justify-content: flex-end;
margin-bottom: 3px;
}
.bars i {
display: block;
border-radius: 2.5px;
transition: background-color 120ms;
}
.bars-week i {
width: 6px;
border-radius: 3px;
transition:
background-color 150ms,
width var(--fit),
border-radius var(--fit);
}
/* A card turning compact (devices.css) thins the week's bars and their gaps: they glide there. */
.bars-week .col {
transition: padding var(--fit);
}
.bars-week .axis {
transition:
left var(--fit),
right var(--fit);
}
.bars .dn {
background: color-mix(in srgb, var(--text) 24%, transparent);
}
.bars .up {
background: color-mix(in srgb, var(--text) 11%, transparent);
}
.bars .today .dn {
background: var(--accent);
}
.bars .today .up {
background: color-mix(in srgb, var(--accent) 45%, transparent);
}
.bars .col:not(.future):hover .dn {
background: var(--text-2);
}
.bars .col:not(.future):hover .up {
background: color-mix(in srgb, var(--text-2) 50%, transparent);
}
.bars .today:hover .dn {
background: color-mix(in srgb, var(--accent) 75%, var(--text));
}
.bars .future i {
height: 3px;
background: color-mix(in srgb, var(--bar) 45%, transparent);
}
.bars .axis {
position: absolute;
left: calc(var(--gap) / 2);
right: calc(var(--gap) / 2);
height: 1px;
background: var(--line);
pointer-events: none;
}
/* ↓ down ↑ up: the arrows are the line icon turned; the upload one step quieter. */
.ud {
display: inline-flex;
flex-wrap: wrap;
align-items: center;
column-gap: 10px;
transition: column-gap var(--fit);
}
.ud > span {
display: inline-flex;
align-items: center;
gap: 2px;
white-space: nowrap;
}
.ud .i {
width: 0.8em;
height: 0.8em;
stroke-width: 2.2;
color: var(--text-2);
}
.ud-dn .i {
transform: rotate(90deg);
}
.ud-up {
color: var(--text-2);
}
.ud-up .i {
transform: rotate(-90deg);
color: var(--text-3);
}
@media (prefers-reduced-motion: reduce) {
.bars-week,
.bars-week .col,
.bars-week .axis,
.ud {
transition: none;
}
.bars-week i {
transition: background-color 150ms;
}
}
+45 -49
View File
@@ -1,5 +1,5 @@
/* "Your devices": the grid, a card per device (its glass icon, name and one-line status, ⋯; the week /* "Your devices": the grid, a card per device (its glass icon, name and one-line status, ⋯; the week
as a number and bars, the Update pill, or Connect), the card that adds one, the first device. */ as down and up over bars, or Connect or Reconnect), the card that adds one, the first device. */
.dgrid { .dgrid {
display: grid; display: grid;
@@ -19,6 +19,9 @@
flex-direction: column; flex-direction: column;
gap: 8px; gap: 8px;
min-width: 0; min-width: 0;
container: card / inline-size;
/* How a card glides between its full and compact shapes (a window resized across 330 or 270 px). */
--fit: var(--spring-smooth-dur, 524ms) var(--spring-smooth, ease);
} }
.dev.is-here { .dev.is-here {
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 32%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 32%, transparent);
@@ -75,14 +78,16 @@
border-radius: var(--r-row); border-radius: var(--r-row);
padding: 12px 14px 12px 16px; padding: 12px 14px 12px 16px;
display: flex; display: flex;
align-items: flex-end; align-items: center;
justify-content: space-between; justify-content: space-between;
gap: 12px; gap: 16px;
min-height: 66px; min-height: 66px;
} }
/* The words take what the bars leave, never more. */
.use-txt { .use-txt {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
flex: 1;
min-width: 0; min-width: 0;
} }
.use-lbl { .use-lbl {
@@ -96,57 +101,37 @@
line-height: 24px; line-height: 24px;
font-weight: 500; font-weight: 500;
letter-spacing: -0.02em; letter-spacing: -0.02em;
} transition:
.spark { font-size var(--fit),
display: flex; line-height var(--fit);
align-items: flex-end;
gap: 4px;
height: 34px;
}
.spark i {
width: 6px;
border-radius: 3px;
background: var(--bar);
transition: background-color 150ms;
}
.spark i.today {
background: var(--accent);
}
.spark i:hover {
background: var(--text-2);
}
.spark i.today:hover {
background: color-mix(in srgb, var(--accent) 75%, var(--text));
} }
.dev .setup-btn { .dev .setup-btn {
margin-top: auto; margin-top: auto;
} }
.upd-pill { /* A card under 330 px (a computer's two columns; the query reads inside its 8 px padding) keeps down and up on
display: inline-flex; one line by being compact: smaller numbers, thinner bars. A phone's card stays as it is. */
align-items: center; @container card (max-width: 313px) {
align-self: center; .use-val {
gap: 6px; font-size: 15px;
height: 32px; line-height: 22px;
padding: 0 12px 0 10px; }
border-radius: 999px; .bars-week {
flex: none; --gap: 3px;
background: color-mix(in srgb, var(--warn) 14%, transparent); }
color: var(--warn); .bars-week i {
font-size: 13px; width: 4px;
font-weight: 600; border-radius: 2px;
transition: }
background-color 150ms,
transform 150ms var(--ease-out);
} }
.upd-pill:hover { /* The narrowest (under 270 px): a step smaller again, so a day under the pointer fits as well as the week. */
background: color-mix(in srgb, var(--warn) 22%, transparent); @container card (max-width: 253px) {
} .use-val {
.upd-pill:active { font-size: 14px;
transform: scale(0.94); line-height: 22px;
} }
.upd-pill .i { .use-val .ud {
width: 14px; column-gap: 8px;
height: 14px; }
} }
.dev.add { .dev.add {
align-items: center; align-items: center;
@@ -199,3 +184,14 @@
.dev.first .btn { .dev.first .btn {
max-width: 320px; max-width: 320px;
} }
/* A jump of the cards' width: the new shape at once, with the layout (page/devices.ts). */
.dgrid.snap .dev * {
transition: none;
}
@media (prefers-reduced-motion: reduce) {
.use-val {
transition: none;
}
}
+1
View File
@@ -4,6 +4,7 @@
@import './base.css'; @import './base.css';
@import './controls.css'; @import './controls.css';
@import './morph.css'; @import './morph.css';
@import './bars.css';
@import './accordion.css'; @import './accordion.css';
@import './page.css'; @import './page.css';
@import './devices.css'; @import './devices.css';
+5 -2
View File
@@ -2,7 +2,9 @@
// closed and share their rounded ends; an open row lifts out with 10 px gaps // closed and share their rounded ends; an open row lifts out with 10 px gaps
// and its own corners. One row open at a time. A row with nothing to open is a // and its own corners. One row open at a time. A row with nothing to open is a
// plain head: no chevron, no click. Inside the sheet it tells the sheet first, // plain head: no chevron, no click. Inside the sheet it tells the sheet first,
// so a code that comes into view gets its width. // so a code that comes into view gets its width. A row the person opens is
// `.opened` until it closes: what enters inside it (the calendar's days) keys on
// that, so a repaint that rebuilds the row open doesn't play it again.
import { h, ic } from '../dom'; import { h, ic } from '../dom';
import { EASE_IN, SOFT, play } from '../motion'; import { EASE_IN, SOFT, play } from '../motion';
@@ -98,9 +100,10 @@ export function accordion(
const closing = rows.filter((x) => x.classList.contains('open') && (x === r || willOpen)); const closing = rows.filter((x) => x.classList.contains('open') && (x === r || willOpen));
rows.forEach((x) => { rows.forEach((x) => {
x.classList.remove('closing'); x.classList.remove('closing');
if (x !== r) x.classList.remove('open'); if (x !== r) x.classList.remove('open', 'opened');
}); });
r.classList.toggle('open', willOpen); r.classList.toggle('open', willOpen);
r.classList.toggle('opened', willOpen);
corners(); corners();
const plan = planWidth(); const plan = planWidth();
rows.forEach((x, i) => { rows.forEach((x, i) => {
+79
View File
@@ -0,0 +1,79 @@
// Traffic by day, both ways: what a device received rises above a hairline and
// what it sent hangs below, on one scale, so a day of uploads shows as itself
// rather than as a cap on the downloads. The hairline sits where the two
// directions' peaks share the height. Beside the bars, "↓ 3.9 GB ↑ 819 MB".
// A day is the router's [rx, tx]: rx came from the device (its upload), tx went
// to it (its download).
import type { Pair } from '../../shared/types';
import { bytes } from '../../shared/format';
import { h, ic } from '../dom';
import { setText } from './morph';
/** Between the halves, the hairline in the middle of it. */
const GAP = 3;
/** Days added up: what came and what went over all of them. */
export const sumDays = (days: Pair[]): Pair => days.reduce<Pair>((a, [rx, tx]) => [a[0] + rx, a[1] + tx], [0, 0]);
/**
* Where the hairline sits and how many px a byte is: each direction's peak gets
* its share of the height, the downloads keeping 55–80% of it, so a quiet
* upload still shows and a busy one does not flatten the rest.
*/
export function mirror(days: Pair[], height: number): { top: number; bottom: number; scale: number } {
const down = Math.max(1, ...days.map((d) => d[1]));
const up = Math.max(1, ...days.map((d) => d[0]));
const top = Math.round((height - GAP) * Math.min(0.8, Math.max(0.55, down / (down + up))));
const bottom = height - GAP - top;
return { top, bottom, scale: Math.min(top / down, bottom / up) };
}
export interface Bars {
el: HTMLElement;
/** A column a day, for what the pointer reads off them. */
cols: HTMLElement[];
}
/** A column a day, today last (in accent); `future`: the days still to come, flat on the hairline. */
export function bars(days: Pair[], cls: string, height: number, future = 0): Bars {
const { top, bottom, scale } = mirror(days, height);
const half = (side: string, px: number, v: number, what: string) => {
const bar = h('i', { class: what });
bar.style.height = `${Math.max(2, Math.round(v * scale))}px`;
const el = h('div', { class: `half ${side}` }, bar);
el.style.height = `${px}px`;
return el;
};
const el = h('div', { class: `bars ${cls}`, 'aria-hidden': 'true' });
el.style.height = `${height}px`;
const cols = days.map(([rx, tx], i) =>
el.appendChild(
h('div', { class: `col${i === days.length - 1 ? ' today' : ''}` }, half('top', top, tx, 'dn'), half('bottom', bottom, rx, 'up')),
),
);
for (let i = 0; i < future; i++) el.appendChild(h('div', { class: 'col future' }, h('i'))).style.paddingTop = `${top - 2}px`;
el.appendChild(h('span', { class: 'axis' })).style.top = `${top + 1}px`;
return { el, cols };
}
export interface UpDown {
el: HTMLElement;
/** Show these, at once (a repaint morphs them by their keys). */
set(day: Pair): void;
}
/** "↓ 3.9 GB ↑ 819 MB"; `key` names the two numbers for the repaint's morph. */
export function upDown(key: string): UpDown {
const side = (cls: string, name: string, num: HTMLElement) =>
h('span', { class: cls, title: name }, ic('arrow'), h('span', { class: 'offscreen' }, name), num);
const dn = h('span', { class: 'num', 'data-t': `${key}:dn` });
const up = h('span', { class: 'num', 'data-t': `${key}:up` });
return {
el: h('span', { class: 'ud' }, side('ud-dn', _('Downloaded'), dn), side('ud-up', _('Uploaded'), up)),
set([rx, tx]) {
setText(dn, bytes(tx));
setText(up, bytes(rx));
},
};
}
+19 -16
View File
@@ -41,6 +41,24 @@ export function toast(msg: string, bad = false) {
}, 2400); }, 2400);
} }
/** An icon that changes in place: the new one pops in where the old one stood. */
export function swapIcon(icon: Element, name: string): Element {
const next = ic(name, icon.getAttribute('class') ?? 'i');
icon.replaceWith(next);
play(
next,
[
{ opacity: 0, transform: 'scale(.6)', filter: 'blur(3px)' },
{ opacity: 1, transform: 'none', filter: 'none' },
],
{
duration: POP.duration,
easing: POP.easing,
},
);
return next;
}
/** /**
* The control that copied says so for a moment: its icon turns into a check * The control that copied says so for a moment: its icon turns into a check
* and its "Copy…" label (`.lbl`, a badge's main line) into "Copied". Every * and its "Copy…" label (`.lbl`, a badge's main line) into "Copied". Every
@@ -53,22 +71,7 @@ function copied(from: Element) {
const label = from.querySelector<HTMLElement>('.lbl, .b-main'); const label = from.querySelector<HTMLElement>('.lbl, .b-main');
const was = label ? textOf(label) : ''; const was = label ? textOf(label) : '';
from.classList.add('copied'); from.classList.add('copied');
let check: Element | null = null; const check = icon ? swapIcon(icon, 'check') : null;
if (icon) {
check = ic('check', icon.getAttribute('class') ?? 'i');
icon.replaceWith(check);
play(
check,
[
{ opacity: 0, transform: 'scale(.6)', filter: 'blur(3px)' },
{ opacity: 1, transform: 'none', filter: 'none' },
],
{
duration: POP.duration,
easing: POP.easing,
},
);
}
if (label) morphText(label, _('Copied')); if (label) morphText(label, _('Copied'));
setTimeout(() => { setTimeout(() => {
if (check && icon) check.replaceWith(icon); if (check && icon) check.replaceWith(icon);
+4 -4
View File
@@ -19,8 +19,8 @@ export interface Device {
active: boolean; active: boolean;
month: Pair; month: Pair;
total: Pair; total: Pair;
/** Daily totals (rx+tx) for the last 7 days, oldest first. */ /** Each day's [rx, tx] for the last 7 days, oldest first. */
spark: number[]; spark: Pair[];
hostname: string; hostname: string;
browser_key: boolean; browser_key: boolean;
/** Its configuration changed (networks, DNS, keys...) since it was last shown or downloaded. */ /** Its configuration changed (networks, DNS, keys...) since it was last shown or downloaded. */
@@ -52,8 +52,8 @@ export interface Person {
online: number; online: number;
last_seen: number; last_seen: number;
devices: Device[]; devices: Device[];
/** Daily totals (rx+tx) from the 1st of this month to today, oldest first; portal only. */ /** Each day's [rx, tx] from the 1st of this month to today, oldest first; portal only. */
month_days?: number[]; month_days?: Pair[];
/** Throughput, one point a minute (last 15): [ts, rx, tx] in bytes/s (rx = from devices); admin only. */ /** Throughput, one point a minute (last 15): [ts, rx, tx] in bytes/s (rx = from devices); admin only. */
rate?: [number, number, number][]; rate?: [number, number, number][];
// admin only (the personal link itself comes from person_links, not the status) // admin only (the personal link itself comes from person_links, not the status)
+40
View File
@@ -0,0 +1,40 @@
import { describe, expect, it } from 'vitest';
import type { Pair } from '../src/shared/types';
import { mirror, sumDays } from '../src/portal/ui/bars';
/** [rx, tx]: what the device sent, what it received. */
const days: Pair[] = [
[10, 90],
[40, 60],
[5, 120],
];
describe('mirrored bars', () => {
it('splits the height between the two directions around the hairline', () => {
const m = mirror(days, 64);
expect(m.top + m.bottom + 3).toBe(64);
});
it('fits both peaks on one scale, the tighter one filling its half', () => {
const m = mirror(days, 64);
expect(120 * m.scale).toBeLessThanOrEqual(m.top);
expect(40 * m.scale).toBeLessThanOrEqual(m.bottom);
expect(Math.max(120 * m.scale - m.top, 40 * m.scale - m.bottom)).toBeCloseTo(0);
});
it('keeps 55–80% of the height for downloads, however lopsided the days', () => {
expect(mirror([[0, 100]], 64).top).toBe(Math.round(61 * 0.8));
expect(mirror([[100, 1]], 64).top).toBe(Math.round(61 * 0.55));
});
it('draws a month without traffic', () => {
const m = mirror([[0, 0]], 34);
expect(Number.isFinite(m.scale)).toBe(true);
expect(m.top).toBeGreaterThan(m.bottom);
});
it('adds the days up both ways', () => {
expect(sumDays(days)).toEqual([55, 270]);
expect(sumDays([])).toEqual([0, 0]);
});
});
+1 -1
View File
@@ -102,7 +102,7 @@ describe('demo data', () => {
const t = new Date(2026, 9, 19, 12).getTime() / 1000; const t = new Date(2026, 9, 19, 12).getTime() / 1000;
const days = monthDays(1000, t); const days = monthDays(1000, t);
expect(days).toHaveLength(19); expect(days).toHaveLength(19);
expect(Math.abs(days.reduce((a, b) => a + b, 0) - 1000)).toBeLessThanOrEqual(19); expect(Math.abs(days.reduce((a, [rx, tx]) => a + rx + tx, 0) - 1000)).toBeLessThanOrEqual(19);
}); });
it('keeps the hours scenario outside its window', () => { it('keeps the hours scenario outside its window', () => {