@jsenv/server 17.3.0 → 17.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1187,30 +1187,30 @@ label .filter_text {
1187
1187
  });
1188
1188
  </script>
1189
1189
  <script type="module">/* esm.sh - preact@10.23.1 */
1190
- var M$2,h$1,X,ie,x$2,J$1,Y,R,j,$,O,T$1={},ee=[],le=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,I=Array.isArray;function b$3(_,e){for(var t in e)_[t]=e[t];return _}function _e(_){var e=_.parentNode;e&&e.removeChild(_);}function se(_,e,t){var i,n,r,l={};for(r in e)r=="key"?i=e[r]:r=="ref"?n=e[r]:l[r]=e[r];if(arguments.length>2&&(l.children=arguments.length>3?M$2.call(arguments,2):t),typeof _=="function"&&_.defaultProps!=null)for(r in _.defaultProps)l[r]===void 0&&(l[r]=_.defaultProps[r]);return U(_,l,i,n,null)}function U(_,e,t,i,n){var r={type:_,props:e,key:t,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:n??++X,__i:-1,__u:0};return n==null&&h$1.vnode!=null&&h$1.vnode(r),r}function N(_){return _.children}function F$1(_,e){this.props=_,this.context=e;}function C$3(_,e){if(e==null)return _.__?C$3(_.__,_.__i+1):null;for(var t;e<_.__k.length;e++)if((t=_.__k[e])!=null&&t.__e!=null)return t.__e;return typeof _.type=="function"?C$3(_):null}function te(_){var e,t;if((_=_.__)!=null&&_.__c!=null){for(_.__e=_.__c.base=null,e=0;e<_.__k.length;e++)if((t=_.__k[e])!=null&&t.__e!=null){_.__e=_.__c.base=t.__e;break}return te(_)}}function B(_){(!_.__d&&(_.__d=true)&&x$2.push(_)&&!H$1.__r++||J$1!==h$1.debounceRendering)&&((J$1=h$1.debounceRendering)||Y)(H$1);}function H$1(){var _,e,t,i,n,r,l,s;for(x$2.sort(R);_=x$2.shift();)_.__d&&(e=x$2.length,i=void 0,r=(n=(t=_).__v).__e,l=[],s=[],t.__P&&((i=b$3({},n)).__v=n.__v+1,h$1.vnode&&h$1.vnode(i),z$1(t.__P,i,n,t.__n,t.__P.namespaceURI,32&n.__u?[r]:null,l,r??C$3(n),!!(32&n.__u),s),i.__v=n.__v,i.__.__k[i.__i]=i,re(l,i,s),i.__e!=r&&te(i)),x$2.length>e&&x$2.sort(R));H$1.__r=0;}function ne(_,e,t,i,n,r,l,s,c,u,p){var o,m,f,v,g,y=i&&i.__k||ee,a=e.length;for(t.__d=c,ue(t,e,y),c=t.__d,o=0;o<a;o++)(f=t.__k[o])!=null&&typeof f!="boolean"&&typeof f!="function"&&(m=f.__i===-1?T$1:y[f.__i]||T$1,f.__i=o,z$1(_,f,m,n,r,l,s,c,u,p),v=f.__e,f.ref&&m.ref!=f.ref&&(m.ref&&q$1(m.ref,null,f),p.push(f.ref,f.__c||v,f)),g==null&&v!=null&&(g=v),65536&f.__u||m.__k===f.__k?c=oe(f,c,_):typeof f.type=="function"&&f.__d!==void 0?c=f.__d:v&&(c=v.nextSibling),f.__d=void 0,f.__u&=-196609);t.__d=c,t.__e=g;}function ue(_,e,t){var i,n,r,l,s,c=e.length,u=t.length,p=u,o=0;for(_.__k=[],i=0;i<c;i++)l=i+o,(n=_.__k[i]=(n=e[i])==null||typeof n=="boolean"||typeof n=="function"?null:typeof n=="string"||typeof n=="number"||typeof n=="bigint"||n.constructor==String?U(null,n,null,null,null):I(n)?U(N,{children:n},null,null,null):n.constructor===void 0&&n.__b>0?U(n.type,n.props,n.key,n.ref?n.ref:null,n.__v):n)!=null?(n.__=_,n.__b=_.__b+1,s=ce(n,t,l,p),n.__i=s,r=null,s!==-1&&(p--,(r=t[s])&&(r.__u|=131072)),r==null||r.__v===null?(s==-1&&o--,typeof n.type!="function"&&(n.__u|=65536)):s!==l&&(s==l-1?o=s-l:s==l+1?o++:s>l?p>c-l?o+=s-l:o--:s<l&&o++,s!==i+o&&(n.__u|=65536))):(r=t[l])&&r.key==null&&r.__e&&(131072&r.__u)==0&&(r.__e==_.__d&&(_.__d=C$3(r)),V(r,r,false),t[l]=null,p--);if(p)for(i=0;i<u;i++)(r=t[i])!=null&&(131072&r.__u)==0&&(r.__e==_.__d&&(_.__d=C$3(r)),V(r,r));}function oe(_,e,t){var i,n;if(typeof _.type=="function"){for(i=_.__k,n=0;i&&n<i.length;n++)i[n]&&(i[n].__=_,e=oe(i[n],e,t));return e}_.__e!=e&&(e&&_.type&&!t.contains(e)&&(e=C$3(_)),t.insertBefore(_.__e,e||null),e=_.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType===8);return e}function ce(_,e,t,i){var n=_.key,r=_.type,l=t-1,s=t+1,c=e[t];if(c===null||c&&n==c.key&&r===c.type&&(131072&c.__u)==0)return t;if(i>(c!=null&&(131072&c.__u)==0?1:0))for(;l>=0||s<e.length;){if(l>=0){if((c=e[l])&&(131072&c.__u)==0&&n==c.key&&r===c.type)return l;l--;}if(s<e.length){if((c=e[s])&&(131072&c.__u)==0&&n==c.key&&r===c.type)return s;s++;}}return -1}function K(_,e,t){e[0]==="-"?_.setProperty(e,t??""):_[e]=t==null?"":typeof t!="number"||le.test(e)?t:t+"px";}function W$2(_,e,t,i,n){var r;e:if(e==="style")if(typeof t=="string")_.style.cssText=t;else {if(typeof i=="string"&&(_.style.cssText=i=""),i)for(e in i)t&&e in t||K(_.style,e,"");if(t)for(e in t)i&&t[e]===i[e]||K(_.style,e,t[e]);}else if(e[0]==="o"&&e[1]==="n")r=e!==(e=e.replace(/(PointerCapture)$|Capture$/i,"$1")),e=e.toLowerCase()in _||e==="onFocusOut"||e==="onFocusIn"?e.toLowerCase().slice(2):e.slice(2),_.l||(_.l={}),_.l[e+r]=t,t?i?t.u=i.u:(t.u=j,_.addEventListener(e,r?O:$,r)):_.removeEventListener(e,r?O:$,r);else {if(n=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in _)try{_[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===false&&e[4]!=="-"?_.removeAttribute(e):_.setAttribute(e,e=="popover"&&t==1?"":t));}}function Q(_){return function(e){if(this.l){var t=this.l[e.type+_];if(e.t==null)e.t=j++;else if(e.t<t.u)return;return t(h$1.event?h$1.event(e):e)}}}function z$1(_,e,t,i,n,r,l,s,c,u){var p,o,m,f,v,g,y,a,d,P,w,D,S,G,E,A,k=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(c=!!(32&t.__u),r=[s=e.__e=t.__e]),(p=h$1.__b)&&p(e);e:if(typeof k=="function")try{if(a=e.props,d="prototype"in k&&k.prototype.render,P=(p=k.contextType)&&i[p.__c],w=p?P?P.props.value:p.__:i,t.__c?y=(o=e.__c=t.__c).__=o.__E:(d?e.__c=o=new k(a,w):(e.__c=o=new F$1(a,w),o.constructor=k,o.render=ae),P&&P.sub(o),o.props=a,o.state||(o.state={}),o.context=w,o.__n=i,m=o.__d=!0,o.__h=[],o._sb=[]),d&&o.__s==null&&(o.__s=o.state),d&&k.getDerivedStateFromProps!=null&&(o.__s==o.state&&(o.__s=b$3({},o.__s)),b$3(o.__s,k.getDerivedStateFromProps(a,o.__s))),f=o.props,v=o.state,o.__v=e,m)d&&k.getDerivedStateFromProps==null&&o.componentWillMount!=null&&o.componentWillMount(),d&&o.componentDidMount!=null&&o.__h.push(o.componentDidMount);else {if(d&&k.getDerivedStateFromProps==null&&a!==f&&o.componentWillReceiveProps!=null&&o.componentWillReceiveProps(a,w),!o.__e&&(o.shouldComponentUpdate!=null&&o.shouldComponentUpdate(a,o.__s,w)===!1||e.__v===t.__v)){for(e.__v!==t.__v&&(o.props=a,o.state=o.__s,o.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.forEach(function(L){L&&(L.__=e);}),D=0;D<o._sb.length;D++)o.__h.push(o._sb[D]);o._sb=[],o.__h.length&&l.push(o);break e}o.componentWillUpdate!=null&&o.componentWillUpdate(a,o.__s,w),d&&o.componentDidUpdate!=null&&o.__h.push(function(){o.componentDidUpdate(f,v,g);});}if(o.context=w,o.props=a,o.__P=_,o.__e=!1,S=h$1.__r,G=0,d){for(o.state=o.__s,o.__d=!1,S&&S(e),p=o.render(o.props,o.state,o.context),E=0;E<o._sb.length;E++)o.__h.push(o._sb[E]);o._sb=[];}else do o.__d=!1,S&&S(e),p=o.render(o.props,o.state,o.context),o.state=o.__s;while(o.__d&&++G<25);o.state=o.__s,o.getChildContext!=null&&(i=b$3(b$3({},i),o.getChildContext())),d&&!m&&o.getSnapshotBeforeUpdate!=null&&(g=o.getSnapshotBeforeUpdate(f,v)),ne(_,I(A=p!=null&&p.type===N&&p.key==null?p.props.children:p)?A:[A],e,t,i,n,r,l,s,c,u),o.base=e.__e,e.__u&=-161,o.__h.length&&l.push(o),y&&(o.__E=o.__=null);}catch(L){if(e.__v=null,c||r!=null){for(e.__u|=c?160:32;s&&s.nodeType===8&&s.nextSibling;)s=s.nextSibling;r[r.indexOf(s)]=null,e.__e=s;}else e.__e=t.__e,e.__k=t.__k;h$1.__e(L,e,t);}else r==null&&e.__v===t.__v?(e.__k=t.__k,e.__e=t.__e):e.__e=pe(t.__e,e,t,i,n,r,l,c,u);(p=h$1.diffed)&&p(e);}function re(_,e,t){e.__d=void 0;for(var i=0;i<t.length;i++)q$1(t[i],t[++i],t[++i]);h$1.__c&&h$1.__c(e,_),_.some(function(n){try{_=n.__h,n.__h=[],_.some(function(r){r.call(n);});}catch(r){h$1.__e(r,n.__v);}});}function pe(_,e,t,i,n,r,l,s,c){var u,p,o,m,f,v,g,y=t.props,a=e.props,d=e.type;if(d==="svg"?n="http://www.w3.org/2000/svg":d==="math"?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),r!=null){for(u=0;u<r.length;u++)if((f=r[u])&&"setAttribute"in f==!!d&&(d?f.localName===d:f.nodeType===3)){_=f,r[u]=null;break}}if(_==null){if(d===null)return document.createTextNode(a);_=document.createElementNS(n,d,a.is&&a),r=null,s=false;}if(d===null)y===a||s&&_.data===a||(_.data=a);else {if(r=r&&M$2.call(_.childNodes),y=t.props||T$1,!s&&r!=null)for(y={},u=0;u<_.attributes.length;u++)y[(f=_.attributes[u]).name]=f.value;for(u in y)if(f=y[u],u!="children"){if(u=="dangerouslySetInnerHTML")o=f;else if(u!=="key"&&!(u in a)){if(u=="value"&&"defaultValue"in a||u=="checked"&&"defaultChecked"in a)continue;W$2(_,u,null,f,n);}}for(u in a)f=a[u],u=="children"?m=f:u=="dangerouslySetInnerHTML"?p=f:u=="value"?v=f:u=="checked"?g=f:u==="key"||s&&typeof f!="function"||y[u]===f||W$2(_,u,f,y[u],n);if(p)s||o&&(p.__html===o.__html||p.__html===_.innerHTML)||(_.innerHTML=p.__html),e.__k=[];else if(o&&(_.innerHTML=""),ne(_,I(m)?m:[m],e,t,i,d==="foreignObject"?"http://www.w3.org/1999/xhtml":n,r,l,r?r[0]:t.__k&&C$3(t,0),s,c),r!=null)for(u=r.length;u--;)r[u]!=null&&_e(r[u]);s||(u="value",v!==void 0&&(v!==_[u]||d==="progress"&&!v||d==="option"&&v!==y[u])&&W$2(_,u,v,y[u],n),u="checked",g!==void 0&&g!==_[u]&&W$2(_,u,g,y[u],n));}return _}function q$1(_,e,t){try{if(typeof _=="function"){var i=typeof _.__u=="function";i&&_.__u(),i&&e==null||(_.__u=_(e));}else _.current=e;}catch(n){h$1.__e(n,t);}}function V(_,e,t){var i,n;if(h$1.unmount&&h$1.unmount(_),(i=_.ref)&&(i.current&&i.current!==_.__e||q$1(i,null,e)),(i=_.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount();}catch(r){h$1.__e(r,e);}i.base=i.__P=null;}if(i=_.__k)for(n=0;n<i.length;n++)i[n]&&V(i[n],e,t||typeof _.type!="function");t||_.__e==null||_e(_.__e),_.__c=_.__=_.__e=_.__d=void 0;}function ae(_,e,t){return this.constructor(_,t)}function de(_,e,t){var i,n,r,l;h$1.__&&h$1.__(_,e),n=(i="undefined"=="function")?null:e.__k,r=[],l=[],z$1(e,_=(e).__k=se(N,null,[_]),n||T$1,T$1,e.namespaceURI,n?null:e.firstChild?M$2.call(e.childNodes):null,r,n?n.__e:e.firstChild,i,l),re(r,_,l);}M$2=ee.slice,h$1={__e:function(_,e,t,i){for(var n,r,l;e=e.__;)if((n=e.__c)&&!n.__)try{if((r=n.constructor)&&r.getDerivedStateFromError!=null&&(n.setState(r.getDerivedStateFromError(_)),l=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(_,i||{}),l=n.__d),l)return n.__E=n}catch(s){_=s;}throw _}},X=0,ie=function(_){return _!=null&&_.constructor==null},F$1.prototype.setState=function(_,e){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=b$3({},this.state),typeof _=="function"&&(_=_(b$3({},t),this.props)),_&&b$3(t,_),_!=null&&this.__v&&(e&&this._sb.push(e),B(this));},F$1.prototype.forceUpdate=function(_){this.__v&&(this.__e=true,_&&this.__h.push(_),B(this));},F$1.prototype.render=N,x$2=[],Y=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,R=function(_,e){return _.__v.__b-e.__v.__b},H$1.__r=0,j=0,$=Q(false),O=Q(true);
1190
+ var M$3,h$1,X,ie,x$2,J,Y,R,j$1,$,O$1,T$2={},ee=[],le=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,I=Array.isArray;function b$3(_,e){for(var t in e)_[t]=e[t];return _}function _e(_){var e=_.parentNode;e&&e.removeChild(_);}function se(_,e,t){var i,n,r,l={};for(r in e)r=="key"?i=e[r]:r=="ref"?n=e[r]:l[r]=e[r];if(arguments.length>2&&(l.children=arguments.length>3?M$3.call(arguments,2):t),typeof _=="function"&&_.defaultProps!=null)for(r in _.defaultProps)l[r]===void 0&&(l[r]=_.defaultProps[r]);return U$1(_,l,i,n,null)}function U$1(_,e,t,i,n){var r={type:_,props:e,key:t,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:n??++X,__i:-1,__u:0};return n==null&&h$1.vnode!=null&&h$1.vnode(r),r}function N(_){return _.children}function F$1(_,e){this.props=_,this.context=e;}function C$2(_,e){if(e==null)return _.__?C$2(_.__,_.__i+1):null;for(var t;e<_.__k.length;e++)if((t=_.__k[e])!=null&&t.__e!=null)return t.__e;return typeof _.type=="function"?C$2(_):null}function te(_){var e,t;if((_=_.__)!=null&&_.__c!=null){for(_.__e=_.__c.base=null,e=0;e<_.__k.length;e++)if((t=_.__k[e])!=null&&t.__e!=null){_.__e=_.__c.base=t.__e;break}return te(_)}}function B(_){(!_.__d&&(_.__d=true)&&x$2.push(_)&&!H$1.__r++||J!==h$1.debounceRendering)&&((J=h$1.debounceRendering)||Y)(H$1);}function H$1(){var _,e,t,i,n,r,l,s;for(x$2.sort(R);_=x$2.shift();)_.__d&&(e=x$2.length,i=void 0,r=(n=(t=_).__v).__e,l=[],s=[],t.__P&&((i=b$3({},n)).__v=n.__v+1,h$1.vnode&&h$1.vnode(i),z$1(t.__P,i,n,t.__n,t.__P.namespaceURI,32&n.__u?[r]:null,l,r??C$2(n),!!(32&n.__u),s),i.__v=n.__v,i.__.__k[i.__i]=i,re(l,i,s),i.__e!=r&&te(i)),x$2.length>e&&x$2.sort(R));H$1.__r=0;}function ne(_,e,t,i,n,r,l,s,c,u,p){var o,m,f,v,g,y=i&&i.__k||ee,a=e.length;for(t.__d=c,ue(t,e,y),c=t.__d,o=0;o<a;o++)(f=t.__k[o])!=null&&typeof f!="boolean"&&typeof f!="function"&&(m=f.__i===-1?T$2:y[f.__i]||T$2,f.__i=o,z$1(_,f,m,n,r,l,s,c,u,p),v=f.__e,f.ref&&m.ref!=f.ref&&(m.ref&&q$1(m.ref,null,f),p.push(f.ref,f.__c||v,f)),g==null&&v!=null&&(g=v),65536&f.__u||m.__k===f.__k?c=oe(f,c,_):typeof f.type=="function"&&f.__d!==void 0?c=f.__d:v&&(c=v.nextSibling),f.__d=void 0,f.__u&=-196609);t.__d=c,t.__e=g;}function ue(_,e,t){var i,n,r,l,s,c=e.length,u=t.length,p=u,o=0;for(_.__k=[],i=0;i<c;i++)l=i+o,(n=_.__k[i]=(n=e[i])==null||typeof n=="boolean"||typeof n=="function"?null:typeof n=="string"||typeof n=="number"||typeof n=="bigint"||n.constructor==String?U$1(null,n,null,null,null):I(n)?U$1(N,{children:n},null,null,null):n.constructor===void 0&&n.__b>0?U$1(n.type,n.props,n.key,n.ref?n.ref:null,n.__v):n)!=null?(n.__=_,n.__b=_.__b+1,s=ce(n,t,l,p),n.__i=s,r=null,s!==-1&&(p--,(r=t[s])&&(r.__u|=131072)),r==null||r.__v===null?(s==-1&&o--,typeof n.type!="function"&&(n.__u|=65536)):s!==l&&(s==l-1?o=s-l:s==l+1?o++:s>l?p>c-l?o+=s-l:o--:s<l&&o++,s!==i+o&&(n.__u|=65536))):(r=t[l])&&r.key==null&&r.__e&&(131072&r.__u)==0&&(r.__e==_.__d&&(_.__d=C$2(r)),V(r,r,false),t[l]=null,p--);if(p)for(i=0;i<u;i++)(r=t[i])!=null&&(131072&r.__u)==0&&(r.__e==_.__d&&(_.__d=C$2(r)),V(r,r));}function oe(_,e,t){var i,n;if(typeof _.type=="function"){for(i=_.__k,n=0;i&&n<i.length;n++)i[n]&&(i[n].__=_,e=oe(i[n],e,t));return e}_.__e!=e&&(e&&_.type&&!t.contains(e)&&(e=C$2(_)),t.insertBefore(_.__e,e||null),e=_.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType===8);return e}function ce(_,e,t,i){var n=_.key,r=_.type,l=t-1,s=t+1,c=e[t];if(c===null||c&&n==c.key&&r===c.type&&(131072&c.__u)==0)return t;if(i>(c!=null&&(131072&c.__u)==0?1:0))for(;l>=0||s<e.length;){if(l>=0){if((c=e[l])&&(131072&c.__u)==0&&n==c.key&&r===c.type)return l;l--;}if(s<e.length){if((c=e[s])&&(131072&c.__u)==0&&n==c.key&&r===c.type)return s;s++;}}return -1}function K(_,e,t){e[0]==="-"?_.setProperty(e,t??""):_[e]=t==null?"":typeof t!="number"||le.test(e)?t:t+"px";}function W$2(_,e,t,i,n){var r;e:if(e==="style")if(typeof t=="string")_.style.cssText=t;else {if(typeof i=="string"&&(_.style.cssText=i=""),i)for(e in i)t&&e in t||K(_.style,e,"");if(t)for(e in t)i&&t[e]===i[e]||K(_.style,e,t[e]);}else if(e[0]==="o"&&e[1]==="n")r=e!==(e=e.replace(/(PointerCapture)$|Capture$/i,"$1")),e=e.toLowerCase()in _||e==="onFocusOut"||e==="onFocusIn"?e.toLowerCase().slice(2):e.slice(2),_.l||(_.l={}),_.l[e+r]=t,t?i?t.u=i.u:(t.u=j$1,_.addEventListener(e,r?O$1:$,r)):_.removeEventListener(e,r?O$1:$,r);else {if(n=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in _)try{_[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===false&&e[4]!=="-"?_.removeAttribute(e):_.setAttribute(e,e=="popover"&&t==1?"":t));}}function Q(_){return function(e){if(this.l){var t=this.l[e.type+_];if(e.t==null)e.t=j$1++;else if(e.t<t.u)return;return t(h$1.event?h$1.event(e):e)}}}function z$1(_,e,t,i,n,r,l,s,c,u){var p,o,m,f,v,g,y,a,d,P,w,D,S,G,E,A,k=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(c=!!(32&t.__u),r=[s=e.__e=t.__e]),(p=h$1.__b)&&p(e);e:if(typeof k=="function")try{if(a=e.props,d="prototype"in k&&k.prototype.render,P=(p=k.contextType)&&i[p.__c],w=p?P?P.props.value:p.__:i,t.__c?y=(o=e.__c=t.__c).__=o.__E:(d?e.__c=o=new k(a,w):(e.__c=o=new F$1(a,w),o.constructor=k,o.render=ae),P&&P.sub(o),o.props=a,o.state||(o.state={}),o.context=w,o.__n=i,m=o.__d=!0,o.__h=[],o._sb=[]),d&&o.__s==null&&(o.__s=o.state),d&&k.getDerivedStateFromProps!=null&&(o.__s==o.state&&(o.__s=b$3({},o.__s)),b$3(o.__s,k.getDerivedStateFromProps(a,o.__s))),f=o.props,v=o.state,o.__v=e,m)d&&k.getDerivedStateFromProps==null&&o.componentWillMount!=null&&o.componentWillMount(),d&&o.componentDidMount!=null&&o.__h.push(o.componentDidMount);else {if(d&&k.getDerivedStateFromProps==null&&a!==f&&o.componentWillReceiveProps!=null&&o.componentWillReceiveProps(a,w),!o.__e&&(o.shouldComponentUpdate!=null&&o.shouldComponentUpdate(a,o.__s,w)===!1||e.__v===t.__v)){for(e.__v!==t.__v&&(o.props=a,o.state=o.__s,o.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.forEach(function(L){L&&(L.__=e);}),D=0;D<o._sb.length;D++)o.__h.push(o._sb[D]);o._sb=[],o.__h.length&&l.push(o);break e}o.componentWillUpdate!=null&&o.componentWillUpdate(a,o.__s,w),d&&o.componentDidUpdate!=null&&o.__h.push(function(){o.componentDidUpdate(f,v,g);});}if(o.context=w,o.props=a,o.__P=_,o.__e=!1,S=h$1.__r,G=0,d){for(o.state=o.__s,o.__d=!1,S&&S(e),p=o.render(o.props,o.state,o.context),E=0;E<o._sb.length;E++)o.__h.push(o._sb[E]);o._sb=[];}else do o.__d=!1,S&&S(e),p=o.render(o.props,o.state,o.context),o.state=o.__s;while(o.__d&&++G<25);o.state=o.__s,o.getChildContext!=null&&(i=b$3(b$3({},i),o.getChildContext())),d&&!m&&o.getSnapshotBeforeUpdate!=null&&(g=o.getSnapshotBeforeUpdate(f,v)),ne(_,I(A=p!=null&&p.type===N&&p.key==null?p.props.children:p)?A:[A],e,t,i,n,r,l,s,c,u),o.base=e.__e,e.__u&=-161,o.__h.length&&l.push(o),y&&(o.__E=o.__=null);}catch(L){if(e.__v=null,c||r!=null){for(e.__u|=c?160:32;s&&s.nodeType===8&&s.nextSibling;)s=s.nextSibling;r[r.indexOf(s)]=null,e.__e=s;}else e.__e=t.__e,e.__k=t.__k;h$1.__e(L,e,t);}else r==null&&e.__v===t.__v?(e.__k=t.__k,e.__e=t.__e):e.__e=pe(t.__e,e,t,i,n,r,l,c,u);(p=h$1.diffed)&&p(e);}function re(_,e,t){e.__d=void 0;for(var i=0;i<t.length;i++)q$1(t[i],t[++i],t[++i]);h$1.__c&&h$1.__c(e,_),_.some(function(n){try{_=n.__h,n.__h=[],_.some(function(r){r.call(n);});}catch(r){h$1.__e(r,n.__v);}});}function pe(_,e,t,i,n,r,l,s,c){var u,p,o,m,f,v,g,y=t.props,a=e.props,d=e.type;if(d==="svg"?n="http://www.w3.org/2000/svg":d==="math"?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),r!=null){for(u=0;u<r.length;u++)if((f=r[u])&&"setAttribute"in f==!!d&&(d?f.localName===d:f.nodeType===3)){_=f,r[u]=null;break}}if(_==null){if(d===null)return document.createTextNode(a);_=document.createElementNS(n,d,a.is&&a),r=null,s=false;}if(d===null)y===a||s&&_.data===a||(_.data=a);else {if(r=r&&M$3.call(_.childNodes),y=t.props||T$2,!s&&r!=null)for(y={},u=0;u<_.attributes.length;u++)y[(f=_.attributes[u]).name]=f.value;for(u in y)if(f=y[u],u!="children"){if(u=="dangerouslySetInnerHTML")o=f;else if(u!=="key"&&!(u in a)){if(u=="value"&&"defaultValue"in a||u=="checked"&&"defaultChecked"in a)continue;W$2(_,u,null,f,n);}}for(u in a)f=a[u],u=="children"?m=f:u=="dangerouslySetInnerHTML"?p=f:u=="value"?v=f:u=="checked"?g=f:u==="key"||s&&typeof f!="function"||y[u]===f||W$2(_,u,f,y[u],n);if(p)s||o&&(p.__html===o.__html||p.__html===_.innerHTML)||(_.innerHTML=p.__html),e.__k=[];else if(o&&(_.innerHTML=""),ne(_,I(m)?m:[m],e,t,i,d==="foreignObject"?"http://www.w3.org/1999/xhtml":n,r,l,r?r[0]:t.__k&&C$2(t,0),s,c),r!=null)for(u=r.length;u--;)r[u]!=null&&_e(r[u]);s||(u="value",v!==void 0&&(v!==_[u]||d==="progress"&&!v||d==="option"&&v!==y[u])&&W$2(_,u,v,y[u],n),u="checked",g!==void 0&&g!==_[u]&&W$2(_,u,g,y[u],n));}return _}function q$1(_,e,t){try{if(typeof _=="function"){var i=typeof _.__u=="function";i&&_.__u(),i&&e==null||(_.__u=_(e));}else _.current=e;}catch(n){h$1.__e(n,t);}}function V(_,e,t){var i,n;if(h$1.unmount&&h$1.unmount(_),(i=_.ref)&&(i.current&&i.current!==_.__e||q$1(i,null,e)),(i=_.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount();}catch(r){h$1.__e(r,e);}i.base=i.__P=null;}if(i=_.__k)for(n=0;n<i.length;n++)i[n]&&V(i[n],e,t||typeof _.type!="function");t||_.__e==null||_e(_.__e),_.__c=_.__=_.__e=_.__d=void 0;}function ae(_,e,t){return this.constructor(_,t)}function de(_,e,t){var i,n,r,l;h$1.__&&h$1.__(_,e),n=(i="undefined"=="function")?null:e.__k,r=[],l=[],z$1(e,_=(e).__k=se(N,null,[_]),n||T$2,T$2,e.namespaceURI,n?null:e.firstChild?M$3.call(e.childNodes):null,r,n?n.__e:e.firstChild,i,l),re(r,_,l);}M$3=ee.slice,h$1={__e:function(_,e,t,i){for(var n,r,l;e=e.__;)if((n=e.__c)&&!n.__)try{if((r=n.constructor)&&r.getDerivedStateFromError!=null&&(n.setState(r.getDerivedStateFromError(_)),l=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(_,i||{}),l=n.__d),l)return n.__E=n}catch(s){_=s;}throw _}},X=0,ie=function(_){return _!=null&&_.constructor==null},F$1.prototype.setState=function(_,e){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=b$3({},this.state),typeof _=="function"&&(_=_(b$3({},t),this.props)),_&&b$3(t,_),_!=null&&this.__v&&(e&&this._sb.push(e),B(this));},F$1.prototype.forceUpdate=function(_){this.__v&&(this.__e=true,_&&this.__h.push(_),B(this));},F$1.prototype.render=N,x$2=[],Y=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,R=function(_,e){return _.__v.__b-e.__v.__b},H$1.__r=0,j$1=0,$=Q(false),O$1=Q(true);
1191
1191
 
1192
1192
  /* esm.sh - htm@3.1.1 */
1193
- var a$2=function(p,f,c,n){var l;f[0]=0;for(var u=1;u<f.length;u++){var g=f[u++],o=f[u]?(f[0]|=g?1:2,c[f[u++]]):f[++u];g===3?n[0]=o:g===4?n[1]=Object.assign(n[1]||{},o):g===5?(n[1]=n[1]||{})[f[++u]]=o:g===6?n[1][f[++u]]+=o+"":g?(l=p.apply(o,a$2(p,o,c,["",null])),n.push(l),o[0]?f[0]|=2:(f[u-2]=0,f[u]=l)):n.push(o);}return n},M$1=new Map;function b$2(p){var f=M$1.get(this);return f||(f=new Map,M$1.set(this,f)),(f=a$2(this,f.get(p)||(f.set(p,f=(function(c){for(var n,l,u=1,g="",o="",i=[0],s=function(v){u===1&&(v||(g=g.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?i.push(0,v,g):u===3&&(v||g)?(i.push(3,v,g),u=2):u===2&&g==="..."&&v?i.push(4,v,0):u===2&&g&&!v?i.push(5,0,true,g):u>=5&&((g||!v&&u===5)&&(i.push(u,0,g,l),u=6),v&&(i.push(u,v,0,l),u=6)),g="";},t=0;t<c.length;t++){t&&(u===1&&s(),s(t));for(var w=0;w<c[t].length;w++)n=c[t][w],u===1?n==="<"?(s(),i=[i],u=3):g+=n:u===4?g==="--"&&n===">"?(u=1,g=""):g=n+g[0]:o?n===o?o="":g+=n:n==='"'||n==="'"?o=n:n===">"?(s(),u=1):u&&(n==="="?(u=5,l=g,g=""):n==="/"&&(u<5||c[t][w+1]===">")?(s(),u===3&&(i=i[0]),u=i,(i=i[0]).push(2,0,u),u=0):n===" "||n===" "||n===`
1193
+ var a$1=function(p,f,c,n){var l;f[0]=0;for(var u=1;u<f.length;u++){var g=f[u++],o=f[u]?(f[0]|=g?1:2,c[f[u++]]):f[++u];g===3?n[0]=o:g===4?n[1]=Object.assign(n[1]||{},o):g===5?(n[1]=n[1]||{})[f[++u]]=o:g===6?n[1][f[++u]]+=o+"":g?(l=p.apply(o,a$1(p,o,c,["",null])),n.push(l),o[0]?f[0]|=2:(f[u-2]=0,f[u]=l)):n.push(o);}return n},M$2=new Map;function b$2(p){var f=M$2.get(this);return f||(f=new Map,M$2.set(this,f)),(f=a$1(this,f.get(p)||(f.set(p,f=(function(c){for(var n,l,u=1,g="",o="",i=[0],s=function(v){u===1&&(v||(g=g.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?i.push(0,v,g):u===3&&(v||g)?(i.push(3,v,g),u=2):u===2&&g==="..."&&v?i.push(4,v,0):u===2&&g&&!v?i.push(5,0,true,g):u>=5&&((g||!v&&u===5)&&(i.push(u,0,g,l),u=6),v&&(i.push(u,v,0,l),u=6)),g="";},t=0;t<c.length;t++){t&&(u===1&&s(),s(t));for(var w=0;w<c[t].length;w++)n=c[t][w],u===1?n==="<"?(s(),i=[i],u=3):g+=n:u===4?g==="--"&&n===">"?(u=1,g=""):g=n+g[0]:o?n===o?o="":g+=n:n==='"'||n==="'"?o=n:n===">"?(s(),u=1):u&&(n==="="?(u=5,l=g,g=""):n==="/"&&(u<5||c[t][w+1]===">")?(s(),u===3&&(i=i[0]),u=i,(i=i[0]).push(2,0,u),u=0):n===" "||n===" "||n===`
1194
1194
  `||n==="\r"?(s(),u=2):g+=n),u===3&&g==="!--"&&(u=4,i=i[0]);}return s(),i})(p)),f),arguments,[])).length>1?f:f[0]}
1195
1195
 
1196
1196
  /* esm.sh - htm@3.1.1/preact */
1197
1197
  var p$3=b$2.bind(se);
1198
1198
 
1199
- /* esm.sh - @preact/signals-core@1.14.1 */
1200
- var C$2=Symbol.for("preact-signals");function p$2(){if(h>1)h--;else {var t,i=false;for((function(){var f=d$1;for(d$1=void 0;f!==void 0;)f.S.v===f.v&&(f.S.i=f.i),f=f.o;})();a$1!==void 0;){var o=a$1;for(a$1=void 0,c$2++;o!==void 0;){var r=o.u;if(o.u=void 0,o.f&=-3,!(8&o.f)&&b$1(o))try{o.c();}catch(f){i||(t=f,i=true);}o=r;}}if(c$2=0,h--,i)throw t}}var n=void 0;function S$2(t){var i=n;n=void 0;try{return t()}finally{n=i;}}var a$1=void 0,h=0,c$2=0,y=0,d$1=void 0,l$1=0;function m(t){if(n!==void 0){var i=t.n;if(i===void 0||i.t!==n)return i={i:0,S:t,p:n.s,n:void 0,t:n,e:void 0,x:void 0,r:i},n.s!==void 0&&(n.s.n=i),n.s=i,t.n=i,32&n.f&&t.S(i),i;if(i.i===-1)return i.i=0,i.n!==void 0&&(i.n.p=i.p,i.p!==void 0&&(i.p.n=i.n),i.p=n.s,i.n=void 0,n.s.n=i,n.s=i),i}}function s(t,i){this.v=t,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=i?.watched,this.Z=i?.unwatched,this.name=i?.name;}s.prototype.brand=C$2;s.prototype.h=function(){return true};s.prototype.S=function(t){var i=this,o=this.t;o!==t&&t.e===void 0&&(t.x=o,this.t=t,o!==void 0?o.e=t:S$2(function(){var r;(r=i.W)==null||r.call(i);}));};s.prototype.U=function(t){var i=this;if(this.t!==void 0){var o=t.e,r=t.x;o!==void 0&&(o.x=r,t.e=void 0),r!==void 0&&(r.e=o,t.x=void 0),t===this.t&&(this.t=r,r===void 0&&S$2(function(){var f;(f=i.Z)==null||f.call(i);}));}};s.prototype.subscribe=function(t){var i=this;return W$1(function(){var o=i.value,r=n;n=void 0;try{t(o);}finally{n=r;}},{name:"sub"})};s.prototype.valueOf=function(){return this.value};s.prototype.toString=function(){return this.value+""};s.prototype.toJSON=function(){return this.value};s.prototype.peek=function(){var t=n;n=void 0;try{return this.value}finally{n=t;}};Object.defineProperty(s.prototype,"value",{get:function(){var t=m(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(c$2>100)throw new Error("Cycle detected");((function(o){h!==0&&c$2===0&&o.l!==y&&(o.l=y,d$1={S:o,v:o.v,i:o.i,o:d$1});}))(this),this.v=t,this.i++,l$1++,h++;try{for(var i=this.t;i!==void 0;i=i.x)i.t.N();}finally{p$2();}}}});function P(t,i){return new s(t,i)}function b$1(t){for(var i=t.s;i!==void 0;i=i.n)if(i.S.i!==i.i||!i.S.h()||i.S.i!==i.i)return true;return false}function x$1(t){for(var i=t.s;i!==void 0;i=i.n){var o=i.S.n;if(o!==void 0&&(i.r=o),i.S.n=i,i.i=-1,i.n===void 0){t.s=i;break}}}function g$1(t){for(var i=t.s,o=void 0;i!==void 0;){var r=i.p;i.i===-1?(i.S.U(i),r!==void 0&&(r.n=i.n),i.n!==void 0&&(i.n.p=r)):o=i,i.S.n=i.r,i.r!==void 0&&(i.r=void 0),i=r;}t.s=o;}function v$1(t,i){s.call(this,void 0),this.x=t,this.s=void 0,this.g=l$1-1,this.f=4,this.W=i?.watched,this.Z=i?.unwatched,this.name=i?.name;}v$1.prototype=new s;v$1.prototype.h=function(){if(this.f&=-3,1&this.f)return false;if((36&this.f)==32||(this.f&=-5,this.g===l$1))return true;if(this.g=l$1,this.f|=1,this.i>0&&!b$1(this))return this.f&=-2,true;var t=n;try{x$1(this),n=this;var i=this.x();(16&this.f||this.v!==i||this.i===0)&&(this.v=i,this.f&=-17,this.i++);}catch(o){this.v=o,this.f|=16,this.i++;}return n=t,g$1(this),this.f&=-2,true};v$1.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var i=this.s;i!==void 0;i=i.n)i.S.S(i);}s.prototype.S.call(this,t);};v$1.prototype.U=function(t){if(this.t!==void 0&&(s.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var i=this.s;i!==void 0;i=i.n)i.S.U(i);}};v$1.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N();}};Object.defineProperty(v$1.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=m(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function J(t,i){return new v$1(t,i)}function E$1(t){var i=t.m;if(t.m=void 0,typeof i=="function"){h++;var o=n;n=void 0;try{i();}catch(r){throw t.f&=-2,t.f|=8,w$1(t),r}finally{n=o,p$2();}}}function w$1(t){for(var i=t.s;i!==void 0;i=i.n)i.S.U(i);t.x=void 0,t.s=void 0,E$1(t);}function k$1(t){if(n!==this)throw new Error("Out-of-order effect");g$1(this),n=t,this.f&=-2,8&this.f&&w$1(this),p$2();}function u(t,i){this.x=t,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=i?.name;}u.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var i=this.x();typeof i=="function"&&(this.m=i);}finally{t();}};u.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,E$1(this),x$1(this),h++;var t=n;return n=this,k$1.bind(this,t)};u.prototype.N=function(){2&this.f||(this.f|=2,this.u=a$1,a$1=this);};u.prototype.d=function(){this.f|=8,1&this.f||w$1(this);};u.prototype.dispose=function(){this.d();};function W$1(t,i){var o=new u(t,i);try{o.c();}catch(f){throw o.d(),f}var r=o.d.bind(o);return r[Symbol.dispose]=r,r}
1199
+ /* esm.sh - @preact/signals-core@1.14.4 */
1200
+ var j=Symbol.for("preact-signals");function S$2(){if(v$1>1)v$1--;else {var t,i=false;for((function(){var f=p$2;for(p$2=void 0;f!==void 0;){var w=f.S;if(w.v===f.v)for(var a=w.t;a!==void 0;a=a.x)a.i===f.i&&(a.i=w.i);f=f.o;}})();c$2!==void 0;){var o=c$2;for(c$2=void 0,l$1++;o!==void 0;){var r=o.u;if(o.u=void 0,o.f&=-3,!(8&o.f)&&g$1(o))try{o.c();}catch(f){i||(t=f,i=true);}o=r;}}if(l$1=0,v$1--,i)throw t}}var e,n=void 0;function d$1(t){var i=n,o=e;n=void 0,e=void 0;try{return t()}finally{n=i,e=o;}}var c$2=void 0,v$1=0,l$1=0,m=0,p$2=void 0,y=0;function x$1(t){if(n!==void 0){var i=t.n;if(i===void 0||i.t!==n)return i={i:0,S:t,p:n.s,n:void 0,t:n,e:void 0,x:void 0,r:i},n.s!==void 0&&(n.s.n=i),n.s=i,t.n=i,32&n.f&&t.S(i),i;if(i.i===-1)return i.i=0,i.n!==void 0&&(i.n.p=i.p,i.p!==void 0&&(i.p.n=i.n),i.p=n.s,i.n=void 0,n.s.n=i,n.s=i),i}}function s(t,i){this.v=t,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=i?.watched,this.Z=i?.unwatched,this.name=i?.name;}s.prototype.brand=j;s.prototype.h=function(){return true};s.prototype.S=function(t){var i=this,o=this.t;o!==t&&t.e===void 0&&(t.x=o,this.t=t,o!==void 0?o.e=t:d$1(function(){var r;(r=i.W)==null||r.call(i);}));};s.prototype.U=function(t){var i=this;if(this.t!==void 0){var o=t.e,r=t.x;o!==void 0&&(o.x=r,t.e=void 0),r!==void 0&&(r.e=o,t.x=void 0),t===this.t&&(this.t=r,r===void 0&&d$1(function(){var f;(f=i.Z)==null||f.call(i);}));}};s.prototype.subscribe=function(t){var i=this;return Z(function(){var o=i.value;d$1(function(){return t(o)});},{name:"sub"})};s.prototype.valueOf=function(){return this.value};s.prototype.toString=function(){return this.value+""};s.prototype.toJSON=function(){return this.value};s.prototype.peek=function(){var t=this;return d$1(function(){return t.value})};Object.defineProperty(s.prototype,"value",{get:function(){var t=x$1(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(l$1>100)throw new Error("Cycle detected");((function(o){v$1!==0&&l$1===0&&o.l!==m&&(o.l=m,p$2={S:o,v:o.v,i:o.i,o:p$2});}))(this),this.v=t,this.i++,y++,v$1++;try{for(var i=this.t;i!==void 0;i=i.x)i.t.N();}finally{S$2();}}}});function M$1(t,i){return new s(t,i)}function g$1(t){for(var i=t.s;i!==void 0;i=i.n)if(i.S.i!==i.i||!i.S.h()||i.S.i!==i.i)return true;return false}function E$1(t){for(var i=t.s;i!==void 0;i=i.n){var o=i.S.n;if(o!==void 0&&(i.r=o),i.S.n=i,i.i=-1,i.n===void 0){t.s=i;break}}}function O(t){for(var i=t.s,o=void 0;i!==void 0;){var r=i.p;i.i===-1?(i.S.U(i),r!==void 0&&(r.n=i.n),i.n!==void 0&&(i.n.p=r)):o=i,i.S.n=i.r,i.r!==void 0&&(i.r=void 0),i=r;}t.s=o;}function h(t,i){s.call(this,void 0,i),this.x=t,this.s=void 0,this.g=y-1,this.f=4;}h.prototype=new s;h.prototype.h=function(){if(this.f&=-3,1&this.f)return false;if((36&this.f)==32||(this.f&=-5,this.g===y))return true;if(this.g=y,this.f|=1,this.i>0&&!g$1(this))return this.f&=-2,true;var t=n;try{E$1(this),n=this;var i=this.x();(16&this.f||this.v!==i||this.i===0)&&(this.v=i,this.f&=-17,this.i++);}catch(o){this.v=o,this.f|=16,this.i++;}return n=t,O(this),this.f&=-2,true};h.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var i=this.s;i!==void 0;i=i.n)i.S.S(i);}s.prototype.S.call(this,t);};h.prototype.U=function(t){if(this.t!==void 0&&(s.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var i=this.s;i!==void 0;i=i.n)i.S.U(i);}};h.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N();}};Object.defineProperty(h.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=x$1(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function T$1(t,i){return new h(t,i)}function U(t){var i=t.m;if(t.m=void 0,typeof i=="function"){v$1++;var o=n;n=void 0;try{i();}catch(r){throw t.f&=-2,t.f|=8,b$1(t),r}finally{n=o,S$2();}}}function b$1(t){for(var i=t.s;i!==void 0;i=i.n)i.S.U(i);t.x=void 0,t.s=void 0,U(t);}function W$1(t){if(n!==this)throw new Error("Out-of-order effect");O(this),n=t,this.f&=-2,8&this.f&&b$1(this),S$2();}function u(t,i){this.x=t,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=i?.name,e&&e.push(this);}u.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var i=this.x();typeof i=="function"&&(this.m=i);}finally{t();}};u.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,U(this),E$1(this),v$1++;var t=n;return n=this,W$1.bind(this,t)};u.prototype.N=function(){2&this.f||(this.f|=2,this.u=c$2,c$2=this);};u.prototype.d=function(){this.f|=8,1&this.f||b$1(this);};u.prototype.dispose=function(){this.d();};function Z(t,i){var o=new u(t,i);try{o.c();}catch(f){throw o.d(),f}var r=o.d.bind(o);return r[Symbol.dispose]=r,r}
1201
1201
 
1202
1202
  /* esm.sh - preact@10.23.1/hooks */
1203
1203
  var c$1,r,d,b,v=0,x=[],o=h$1,g=o.__b,C$1=o.__r,A=o.diffed,D=o.__c,F=o.unmount,k=o.__;function l(t,_){o.__h&&o.__h(r,t,v||_),v=0;var u=r.__H||(r.__H={__:[],__h:[]});return t>=u.__.length&&u.__.push({}),u.__[t]}function z(t){return v=5,T(function(){return {current:t}},[])}function T(t,_){var u=l(c$1++,7);return E(u.__H,_)&&(u.__=t(),u.__H=_,u.__h=t),u.__}function M(t,_){return v=8,T(function(){return t},_)}function S$1(){for(var t;t=x.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(p$1),t.__H.__h.forEach(H),t.__H.__h=[];}catch(_){t.__H.__h=[],o.__e(_,t.__v);}}o.__b=function(t){r=null,g&&g(t);},o.__=function(t,_){t&&_.__k&&_.__k.__m&&(t.__m=_.__k.__m),k&&k(t,_);},o.__r=function(t){C$1&&C$1(t),c$1=0;var _=(r=t.__c).__H;_&&(d===r?(_.__h=[],r.__h=[],_.__.forEach(function(u){u.__N&&(u.__=u.__N),u.i=u.__N=void 0;})):(_.__h.forEach(p$1),_.__h.forEach(H),_.__h=[],c$1=0)),d=r;},o.diffed=function(t){A&&A(t);var _=t.__c;_&&_.__H&&(_.__H.__h.length&&(x.push(_)!==1&&b===o.requestAnimationFrame||((b=o.requestAnimationFrame)||W)(S$1)),_.__H.__.forEach(function(u){u.i&&(u.__H=u.i),u.i=void 0;})),d=r=null;},o.__c=function(t,_){_.some(function(u){try{u.__h.forEach(p$1),u.__h=u.__h.filter(function(n){return !n.__||H(n)});}catch(n){_.some(function(i){i.__h&&(i.__h=[]);}),_=[],o.__e(n,u.__v);}}),D&&D(t,_);},o.unmount=function(t){F&&F(t);var _,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{p$1(n);}catch(i){_=i;}}),u.__H=void 0,_&&o.__e(_,u.__v));};var q=typeof requestAnimationFrame=="function";function W(t){var _,u=function(){clearTimeout(n),q&&cancelAnimationFrame(_),setTimeout(t);},n=setTimeout(u,100);q&&(_=requestAnimationFrame(u));}function p$1(t){var _=r,u=t.__c;typeof u=="function"&&(t.__c=void 0,u()),r=_;}function H(t){var _=r;t.__c=t.__(),r=_;}function E(t,_){return !t||t.length!==_.length||_.some(function(u,n){return u!==t[n]})}
1204
1204
 
1205
1205
  /* esm.sh - @preact/signals@1.3.0 */
1206
- var p;function a(e,n){h$1[e]=n.bind(null,h$1[e]||function(){});}function c(e){p&&p(),p=e&&e.S();}function S(e){var n=this,t=e.data,i=w(t);i.value=t;var u=T(function(){for(var r=n.__v;r=r.__;)if(r.__c){r.__c.__$f|=4;break}return n.__$u.c=function(){var f;!ie(u.peek())&&((f=n.base)==null?void 0:f.nodeType)===3?n.base.data=u.peek():(n.__$f|=1,n.setState({}));},J(function(){var f=i.value.value;return f===0?0:f===true?"":f||""})},[]);return u.value}S.displayName="_st";Object.defineProperties(s.prototype,{constructor:{configurable:true,value:void 0},type:{configurable:true,value:S},props:{configurable:true,get:function(){return {data:this}}},__b:{configurable:true,value:1}});a("__b",function(e,n){if(typeof n.type=="string"){var t,i=n.props;for(var u in i)if(u!=="children"){var r=i[u];r instanceof s&&(t||(n.__np=t={}),t[u]=r,i[u]=r.peek());}}e(n);});a("__r",function(e,n){c();var t,i=n.__c;i&&(i.__$f&=-2,(t=i.__$u)===void 0&&(i.__$u=t=(function(u){var r;return W$1(function(){r=this;}),r.c=function(){i.__$f|=1,i.setState({});},r})())),c(t),e(n);});a("__e",function(e,n,t,i){c(),e(n,t,i);});a("diffed",function(e,n){c();var t;if(typeof n.type=="string"&&(t=n.__e)){var i=n.__np,u=n.props;if(i){var r=t.U;if(r)for(var f in r){var o=r[f];o!==void 0&&!(f in i)&&(o.d(),r[f]=void 0);}else t.U=r={};for(var _ in i){var v=r[_],m=i[_];v===void 0?(v=C(t,_,m,u),r[_]=v):v.o(m,u);}}}e(n);});function C(e,n,t,i){var u=n in e&&e.ownerSVGElement===void 0,r=P(t);return {o:function(f,o){r.value=f,i=o;},d:W$1(function(){var f=r.value.value;i[n]!==f&&(i[n]=f,u?e[n]=f:f?e.setAttribute(n,f):e.removeAttribute(n));})}}a("unmount",function(e,n){if(typeof n.type=="string"){var t=n.__e;if(t){var i=t.U;if(i){t.U=void 0;for(var u in i){var r=i[u];r&&r.d();}}}}else {var f=n.__c;if(f){var o=f.__$u;o&&(f.__$u=void 0,o.d());}}e(n);});a("__h",function(e,n,t,i){(i<3||i===9)&&(n.__$f|=2),e(n,t,i);});F$1.prototype.shouldComponentUpdate=function(e,n){var t=this.__$u;if(!(t&&t.s!==void 0||4&this.__$f)||3&this.__$f)return true;for(var i in n)return true;for(var u in e)if(u!=="__source"&&e[u]!==this.props[u])return true;for(var r in this.props)if(!(r in e))return true;return false};function w(e){return T(function(){return P(e)},[])}
1206
+ var p;function a(e,n){h$1[e]=n.bind(null,h$1[e]||function(){});}function c(e){p&&p(),p=e&&e.S();}function S(e){var n=this,t=e.data,i=w(t);i.value=t;var u=T(function(){for(var r=n.__v;r=r.__;)if(r.__c){r.__c.__$f|=4;break}return n.__$u.c=function(){var f;!ie(u.peek())&&((f=n.base)==null?void 0:f.nodeType)===3?n.base.data=u.peek():(n.__$f|=1,n.setState({}));},T$1(function(){var f=i.value.value;return f===0?0:f===true?"":f||""})},[]);return u.value}S.displayName="_st";Object.defineProperties(s.prototype,{constructor:{configurable:true,value:void 0},type:{configurable:true,value:S},props:{configurable:true,get:function(){return {data:this}}},__b:{configurable:true,value:1}});a("__b",function(e,n){if(typeof n.type=="string"){var t,i=n.props;for(var u in i)if(u!=="children"){var r=i[u];r instanceof s&&(t||(n.__np=t={}),t[u]=r,i[u]=r.peek());}}e(n);});a("__r",function(e,n){c();var t,i=n.__c;i&&(i.__$f&=-2,(t=i.__$u)===void 0&&(i.__$u=t=(function(u){var r;return Z(function(){r=this;}),r.c=function(){i.__$f|=1,i.setState({});},r})())),c(t),e(n);});a("__e",function(e,n,t,i){c(),e(n,t,i);});a("diffed",function(e,n){c();var t;if(typeof n.type=="string"&&(t=n.__e)){var i=n.__np,u=n.props;if(i){var r=t.U;if(r)for(var f in r){var o=r[f];o!==void 0&&!(f in i)&&(o.d(),r[f]=void 0);}else t.U=r={};for(var _ in i){var v=r[_],m=i[_];v===void 0?(v=C(t,_,m,u),r[_]=v):v.o(m,u);}}}e(n);});function C(e,n,t,i){var u=n in e&&e.ownerSVGElement===void 0,r=M$1(t);return {o:function(f,o){r.value=f,i=o;},d:Z(function(){var f=r.value.value;i[n]!==f&&(i[n]=f,u?e[n]=f:f?e.setAttribute(n,f):e.removeAttribute(n));})}}a("unmount",function(e,n){if(typeof n.type=="string"){var t=n.__e;if(t){var i=t.U;if(i){t.U=void 0;for(var u in i){var r=i[u];r&&r.d();}}}}else {var f=n.__c;if(f){var o=f.__$u;o&&(f.__$u=void 0,o.d());}}e(n);});a("__h",function(e,n,t,i){(i<3||i===9)&&(n.__$f|=2),e(n,t,i);});F$1.prototype.shouldComponentUpdate=function(e,n){var t=this.__$u;if(!(t&&t.s!==void 0||4&this.__$f)||3&this.__$f)return true;for(var i in n)return true;for(var u in e)if(u!=="__source"&&e[u]!==this.props[u])return true;for(var r in this.props)if(!(r in e))return true;return false};function w(e){return T(function(){return M$1(e)},[])}
1207
1207
 
1208
- const routesLoadingSignal = P(false);
1209
- const routeLoadingErrorSignal = P(null);
1210
- const routesSignal = P([]);
1208
+ const routesLoadingSignal = M$1(false);
1209
+ const routeLoadingErrorSignal = M$1(null);
1210
+ const routesSignal = M$1([]);
1211
1211
  const NO_PACKAGE_NAME = "unknown";
1212
1212
 
1213
- const repartitionsSignal = J(() => {
1213
+ const repartitionsSignal = T$1(() => {
1214
1214
  const routes = routesSignal.value;
1215
1215
  const methodRepartition = {};
1216
1216
  const packageRepartition = {};
@@ -1232,16 +1232,16 @@ const routesLoadingSignal = P(false);
1232
1232
  packageRepartition,
1233
1233
  };
1234
1234
  });
1235
- const methodRepartitionSignal = J(() => {
1235
+ const methodRepartitionSignal = T$1(() => {
1236
1236
  return repartitionsSignal.value.methodRepartition;
1237
1237
  });
1238
- const packageRepartitionSignal = J(() => {
1238
+ const packageRepartitionSignal = T$1(() => {
1239
1239
  return repartitionsSignal.value.packageRepartition;
1240
1240
  });
1241
- const availableMethodNamesSignal = J(() => {
1241
+ const availableMethodNamesSignal = T$1(() => {
1242
1242
  return Object.keys(methodRepartitionSignal.value);
1243
1243
  });
1244
- const availablePackageNamesSignal = J(() => {
1244
+ const availablePackageNamesSignal = T$1(() => {
1245
1245
  return Object.keys(packageRepartitionSignal.value);
1246
1246
  });
1247
1247
 
@@ -1390,7 +1390,7 @@ const routesLoadingSignal = P(false);
1390
1390
  </div>`;
1391
1391
  };
1392
1392
 
1393
- const documentUrlSignal = P(window.location.href);
1393
+ const documentUrlSignal = M$1(window.location.href);
1394
1394
  window.addEventListener("popstate", async (popstateEvent) => {
1395
1395
  documentUrlSignal.value = popstateEvent.target.location.href;
1396
1396
  });
@@ -1456,7 +1456,7 @@ const routesLoadingSignal = P(false);
1456
1456
  if (existingSignal) {
1457
1457
  return existingSignal;
1458
1458
  }
1459
- const signalForFirstCall = J(() => {
1459
+ const signalForFirstCall = T$1(() => {
1460
1460
  const url = documentUrlSignal.value;
1461
1461
  const valueInUrl = getter(url);
1462
1462
  return valueInUrl;
@@ -297,41 +297,41 @@ var hasRequiredUtils;
297
297
  function requireUtils () {
298
298
  if (hasRequiredUtils) return utils;
299
299
  hasRequiredUtils = 1;
300
- (function (exports$1) {
300
+ (function (exports) {
301
301
  /**
302
302
  * Utilities for hex, bytes, CSPRNG.
303
303
  * @module
304
304
  */
305
305
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
306
- Object.defineProperty(exports$1, "__esModule", { value: true });
307
- exports$1.wrapXOFConstructorWithOpts = exports$1.wrapConstructorWithOpts = exports$1.wrapConstructor = exports$1.Hash = exports$1.nextTick = exports$1.swap32IfBE = exports$1.byteSwapIfBE = exports$1.swap8IfBE = exports$1.isLE = void 0;
308
- exports$1.isBytes = isBytes;
309
- exports$1.anumber = anumber;
310
- exports$1.abytes = abytes;
311
- exports$1.ahash = ahash;
312
- exports$1.aexists = aexists;
313
- exports$1.aoutput = aoutput;
314
- exports$1.u8 = u8;
315
- exports$1.u32 = u32;
316
- exports$1.clean = clean;
317
- exports$1.createView = createView;
318
- exports$1.rotr = rotr;
319
- exports$1.rotl = rotl;
320
- exports$1.byteSwap = byteSwap;
321
- exports$1.byteSwap32 = byteSwap32;
322
- exports$1.bytesToHex = bytesToHex;
323
- exports$1.hexToBytes = hexToBytes;
324
- exports$1.asyncLoop = asyncLoop;
325
- exports$1.utf8ToBytes = utf8ToBytes;
326
- exports$1.bytesToUtf8 = bytesToUtf8;
327
- exports$1.toBytes = toBytes;
328
- exports$1.kdfInputToBytes = kdfInputToBytes;
329
- exports$1.concatBytes = concatBytes;
330
- exports$1.checkOpts = checkOpts;
331
- exports$1.createHasher = createHasher;
332
- exports$1.createOptHasher = createOptHasher;
333
- exports$1.createXOFer = createXOFer;
334
- exports$1.randomBytes = randomBytes;
306
+ Object.defineProperty(exports, "__esModule", { value: true });
307
+ exports.wrapXOFConstructorWithOpts = exports.wrapConstructorWithOpts = exports.wrapConstructor = exports.Hash = exports.nextTick = exports.swap32IfBE = exports.byteSwapIfBE = exports.swap8IfBE = exports.isLE = void 0;
308
+ exports.isBytes = isBytes;
309
+ exports.anumber = anumber;
310
+ exports.abytes = abytes;
311
+ exports.ahash = ahash;
312
+ exports.aexists = aexists;
313
+ exports.aoutput = aoutput;
314
+ exports.u8 = u8;
315
+ exports.u32 = u32;
316
+ exports.clean = clean;
317
+ exports.createView = createView;
318
+ exports.rotr = rotr;
319
+ exports.rotl = rotl;
320
+ exports.byteSwap = byteSwap;
321
+ exports.byteSwap32 = byteSwap32;
322
+ exports.bytesToHex = bytesToHex;
323
+ exports.hexToBytes = hexToBytes;
324
+ exports.asyncLoop = asyncLoop;
325
+ exports.utf8ToBytes = utf8ToBytes;
326
+ exports.bytesToUtf8 = bytesToUtf8;
327
+ exports.toBytes = toBytes;
328
+ exports.kdfInputToBytes = kdfInputToBytes;
329
+ exports.concatBytes = concatBytes;
330
+ exports.checkOpts = checkOpts;
331
+ exports.createHasher = createHasher;
332
+ exports.createOptHasher = createOptHasher;
333
+ exports.createXOFer = createXOFer;
334
+ exports.randomBytes = randomBytes;
335
335
  // We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.
336
336
  // node.js versions earlier than v19 don't declare it in global scope.
337
337
  // For node.js, package.json#exports field mapping rewrites import
@@ -404,7 +404,7 @@ function requireUtils () {
404
404
  return (word << shift) | ((word >>> (32 - shift)) >>> 0);
405
405
  }
406
406
  /** Is current platform little-endian? Most are. Big-Endian platform: IBM */
407
- exports$1.isLE = (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();
407
+ exports.isLE = (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();
408
408
  /** The byte swap operation for uint32 */
409
409
  function byteSwap(word) {
410
410
  return (((word << 24) & 0xff000000) |
@@ -413,11 +413,11 @@ function requireUtils () {
413
413
  ((word >>> 24) & 0xff));
414
414
  }
415
415
  /** Conditionally byte swap if on a big-endian platform */
416
- exports$1.swap8IfBE = exports$1.isLE
416
+ exports.swap8IfBE = exports.isLE
417
417
  ? (n) => n
418
418
  : (n) => byteSwap(n);
419
419
  /** @deprecated */
420
- exports$1.byteSwapIfBE = exports$1.swap8IfBE;
420
+ exports.byteSwapIfBE = exports.swap8IfBE;
421
421
  /** In place byte swap for Uint32Array */
422
422
  function byteSwap32(arr) {
423
423
  for (let i = 0; i < arr.length; i++) {
@@ -425,7 +425,7 @@ function requireUtils () {
425
425
  }
426
426
  return arr;
427
427
  }
428
- exports$1.swap32IfBE = exports$1.isLE
428
+ exports.swap32IfBE = exports.isLE
429
429
  ? (u) => u
430
430
  : byteSwap32;
431
431
  // Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex
@@ -493,7 +493,7 @@ function requireUtils () {
493
493
  * next scheduler queue processing step and this is exactly what we need.
494
494
  */
495
495
  const nextTick = async () => { };
496
- exports$1.nextTick = nextTick;
496
+ exports.nextTick = nextTick;
497
497
  /** Returns control to thread each 'tick' ms to avoid blocking. */
498
498
  async function asyncLoop(iters, tick, cb) {
499
499
  let ts = Date.now();
@@ -503,7 +503,7 @@ function requireUtils () {
503
503
  const diff = Date.now() - ts;
504
504
  if (diff >= 0 && diff < tick)
505
505
  continue;
506
- await (0, exports$1.nextTick)();
506
+ await (0, exports.nextTick)();
507
507
  ts += diff;
508
508
  }
509
509
  }
@@ -569,7 +569,7 @@ function requireUtils () {
569
569
  /** For runtime check if class implements interface */
570
570
  class Hash {
571
571
  }
572
- exports$1.Hash = Hash;
572
+ exports.Hash = Hash;
573
573
  /** Wraps hash function, creating an interface on top of it */
574
574
  function createHasher(hashCons) {
575
575
  const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
@@ -595,9 +595,9 @@ function requireUtils () {
595
595
  hashC.create = (opts) => hashCons(opts);
596
596
  return hashC;
597
597
  }
598
- exports$1.wrapConstructor = createHasher;
599
- exports$1.wrapConstructorWithOpts = createOptHasher;
600
- exports$1.wrapXOFConstructorWithOpts = createXOFer;
598
+ exports.wrapConstructor = createHasher;
599
+ exports.wrapConstructorWithOpts = createOptHasher;
600
+ exports.wrapXOFConstructorWithOpts = createXOFer;
601
601
  /** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */
602
602
  function randomBytes(bytesLength = 32) {
603
603
  if (crypto_1.crypto && typeof crypto_1.crypto.getRandomValues === 'function') {
@@ -2907,6 +2907,30 @@ const trackHttp1ServerPendingRequests = (nodeServer) => {
2907
2907
  * But we don't really need a class so we are just returning a regular object under the hood
2908
2908
  */
2909
2909
 
2910
+ /**
2911
+ * Return this from a route `fetch` to accept a websocket upgrade on that
2912
+ * endpoint.
2913
+ *
2914
+ * @param {(websocket: import("ws").WebSocket) => void | (() => void)} webSocketHandler
2915
+ * Called with the raw `ws` socket once the upgrade completes. Use
2916
+ * `websocket.on("message", …)` / `websocket.send(…)`. If it returns a
2917
+ * function, that function runs as cleanup when the socket closes.
2918
+ * @param {object} [init]
2919
+ * @param {number} [init.status=101]
2920
+ * @param {string} [init.statusText]
2921
+ * @param {object} [init.headers]
2922
+ *
2923
+ * @example
2924
+ * {
2925
+ * endpoint: "GET /chat.websocket",
2926
+ * fetch: () => new WebSocketResponse((websocket) => {
2927
+ * websocket.on("message", (data) => websocket.send(data));
2928
+ * return () => {
2929
+ * // socket closed
2930
+ * };
2931
+ * }),
2932
+ * }
2933
+ */
2910
2934
  class WebSocketResponse {
2911
2935
  constructor(
2912
2936
  webSocketHandler,
@@ -2986,7 +3010,7 @@ const getWebSocketHandler = (responseProperties) => {
2986
3010
  * // Use in server route
2987
3011
  * {
2988
3012
  * endpoint: "GET /events",
2989
- * response: (request) => serverEvents.fetch(request)
3013
+ * fetch: (request) => serverEvents.fetch(request)
2990
3014
  * }
2991
3015
  */
2992
3016
  class ServerEvents {
@@ -3044,7 +3068,7 @@ class ServerEvents {
3044
3068
  * // Use in server route
3045
3069
  * {
3046
3070
  * endpoint: "GET /events",
3047
- * response: (request) => events.fetch(request)
3071
+ * fetch: (request) => events.fetch(request)
3048
3072
  * }
3049
3073
  */
3050
3074
  class LazyServerEvents {
@@ -3930,6 +3954,24 @@ const pathnameToParentPathname = (pathname) => {
3930
3954
  return pathname.slice(0, slashLastIndex + 1);
3931
3955
  };
3932
3956
 
3957
+ const urlIsOrIsInsideOf = (url, otherUrl) => {
3958
+ const urlObject = new URL(url);
3959
+ const otherUrlObject = new URL(otherUrl);
3960
+
3961
+ if (urlObject.origin !== otherUrlObject.origin) {
3962
+ return false;
3963
+ }
3964
+
3965
+ const urlPathname = urlObject.pathname;
3966
+ const otherUrlPathname = otherUrlObject.pathname;
3967
+ if (urlPathname === otherUrlPathname) {
3968
+ return true;
3969
+ }
3970
+
3971
+ const isInside = urlPathname.startsWith(otherUrlPathname);
3972
+ return isInside;
3973
+ };
3974
+
3933
3975
  const urlToFileSystemPath = (url) => {
3934
3976
  const urlObject = new URL(url);
3935
3977
  let { origin, pathname, hash } = urlObject;
@@ -8734,8 +8776,14 @@ const fetchFileSystem = async (
8734
8776
  } else {
8735
8777
  resource = request.resource.slice(1);
8736
8778
  }
8737
- const filesystemUrl = new URL(resource, directoryUrl);
8779
+ const filesystemUrl = new URL(resource, directoryUrlString);
8738
8780
  const urlString = asUrlString(filesystemUrl);
8781
+ if (!urlIsOrIsInsideOf(urlString, directoryUrlString)) {
8782
+ return {
8783
+ status: 403,
8784
+ statusText: "not allowed to read outside root directory",
8785
+ };
8786
+ }
8739
8787
 
8740
8788
  if (cacheControl === undefined) {
8741
8789
  cacheControl = isVersioned(request)
package/dist/ws/ws.js CHANGED
@@ -9,6 +9,8 @@ import require$$7 from "node:url";
9
9
  import require$$0 from "node:zlib";
10
10
  import require$$0$1 from "node:buffer";
11
11
 
12
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
13
+
12
14
  function getDefaultExportFromCjs (x) {
13
15
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
14
16
  }
@@ -987,6 +989,10 @@ function requireReceiver () {
987
989
  * extensions
988
990
  * @param {Boolean} [options.isServer=false] Specifies whether to operate in
989
991
  * client or server mode
992
+ * @param {Number} [options.maxBufferedChunks=0] The maximum number of
993
+ * buffered data chunks
994
+ * @param {Number} [options.maxFragments=0] The maximum number of message
995
+ * fragments
990
996
  * @param {Number} [options.maxPayload=0] The maximum allowed message length
991
997
  * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
992
998
  * not to skip UTF-8 validation for text and close messages
@@ -1001,6 +1007,8 @@ function requireReceiver () {
1001
1007
  this._binaryType = options.binaryType || BINARY_TYPES[0];
1002
1008
  this._extensions = options.extensions || {};
1003
1009
  this._isServer = !!options.isServer;
1010
+ this._maxBufferedChunks = options.maxBufferedChunks | 0;
1011
+ this._maxFragments = options.maxFragments | 0;
1004
1012
  this._maxPayload = options.maxPayload | 0;
1005
1013
  this._skipUTF8Validation = !!options.skipUTF8Validation;
1006
1014
  this[kWebSocket] = undefined;
@@ -1018,6 +1026,7 @@ function requireReceiver () {
1018
1026
 
1019
1027
  this._totalPayloadLength = 0;
1020
1028
  this._messageLength = 0;
1029
+ this._numFragments = 0;
1021
1030
  this._fragments = [];
1022
1031
 
1023
1032
  this._errored = false;
@@ -1036,6 +1045,22 @@ function requireReceiver () {
1036
1045
  _write(chunk, encoding, cb) {
1037
1046
  if (this._opcode === 0x08 && this._state == GET_INFO) return cb();
1038
1047
 
1048
+ if (
1049
+ this._maxBufferedChunks > 0 &&
1050
+ this._buffers.length >= this._maxBufferedChunks
1051
+ ) {
1052
+ cb(
1053
+ this.createError(
1054
+ RangeError,
1055
+ 'Too many buffered chunks',
1056
+ false,
1057
+ 1008,
1058
+ 'WS_ERR_TOO_MANY_BUFFERED_PARTS'
1059
+ )
1060
+ );
1061
+ return;
1062
+ }
1063
+
1039
1064
  this._bufferedBytes += chunk.length;
1040
1065
  this._buffers.push(chunk);
1041
1066
  this.startLoop(cb);
@@ -1425,6 +1450,19 @@ function requireReceiver () {
1425
1450
  return;
1426
1451
  }
1427
1452
 
1453
+ if (this._maxFragments > 0 && ++this._numFragments > this._maxFragments) {
1454
+ const error = this.createError(
1455
+ RangeError,
1456
+ 'Too many message fragments',
1457
+ false,
1458
+ 1008,
1459
+ 'WS_ERR_TOO_MANY_BUFFERED_PARTS'
1460
+ );
1461
+
1462
+ cb(error);
1463
+ return;
1464
+ }
1465
+
1428
1466
  if (this._compressed) {
1429
1467
  this._state = INFLATING;
1430
1468
  this.decompress(data, cb);
@@ -1497,6 +1535,7 @@ function requireReceiver () {
1497
1535
  this._totalPayloadLength = 0;
1498
1536
  this._messageLength = 0;
1499
1537
  this._fragmented = 0;
1538
+ this._numFragments = 0;
1500
1539
  this._fragments = [];
1501
1540
 
1502
1541
  if (this._opcode === 2) {
@@ -1654,6 +1693,664 @@ function requireReceiver () {
1654
1693
  return receiver$1;
1655
1694
  }
1656
1695
 
1696
+ var util = {};
1697
+
1698
+ var isBuffer;
1699
+ var hasRequiredIsBuffer;
1700
+
1701
+ function requireIsBuffer () {
1702
+ if (hasRequiredIsBuffer) return isBuffer;
1703
+ hasRequiredIsBuffer = 1;
1704
+ isBuffer = function isBuffer(arg) {
1705
+ return arg instanceof Buffer;
1706
+ };
1707
+ return isBuffer;
1708
+ }
1709
+
1710
+ var inherits = {exports: {}};
1711
+
1712
+ var inherits_browser = {exports: {}};
1713
+
1714
+ var hasRequiredInherits_browser;
1715
+
1716
+ function requireInherits_browser () {
1717
+ if (hasRequiredInherits_browser) return inherits_browser.exports;
1718
+ hasRequiredInherits_browser = 1;
1719
+ if (typeof Object.create === 'function') {
1720
+ // implementation from standard node.js 'util' module
1721
+ inherits_browser.exports = function inherits(ctor, superCtor) {
1722
+ ctor.super_ = superCtor;
1723
+ ctor.prototype = Object.create(superCtor.prototype, {
1724
+ constructor: {
1725
+ value: ctor,
1726
+ enumerable: false,
1727
+ writable: true,
1728
+ configurable: true
1729
+ }
1730
+ });
1731
+ };
1732
+ } else {
1733
+ // old school shim for old browsers
1734
+ inherits_browser.exports = function inherits(ctor, superCtor) {
1735
+ ctor.super_ = superCtor;
1736
+ var TempCtor = function () {};
1737
+ TempCtor.prototype = superCtor.prototype;
1738
+ ctor.prototype = new TempCtor();
1739
+ ctor.prototype.constructor = ctor;
1740
+ };
1741
+ }
1742
+ return inherits_browser.exports;
1743
+ }
1744
+
1745
+ var hasRequiredInherits;
1746
+
1747
+ function requireInherits () {
1748
+ if (hasRequiredInherits) return inherits.exports;
1749
+ hasRequiredInherits = 1;
1750
+ try {
1751
+ var util = requireUtil();
1752
+ if (typeof util.inherits !== 'function') throw '';
1753
+ inherits.exports = util.inherits;
1754
+ } catch (e) {
1755
+ inherits.exports = requireInherits_browser();
1756
+ }
1757
+ return inherits.exports;
1758
+ }
1759
+
1760
+ var hasRequiredUtil;
1761
+
1762
+ function requireUtil () {
1763
+ if (hasRequiredUtil) return util;
1764
+ hasRequiredUtil = 1;
1765
+ (function (exports) {
1766
+ // Copyright Joyent, Inc. and other Node contributors.
1767
+ //
1768
+ // Permission is hereby granted, free of charge, to any person obtaining a
1769
+ // copy of this software and associated documentation files (the
1770
+ // "Software"), to deal in the Software without restriction, including
1771
+ // without limitation the rights to use, copy, modify, merge, publish,
1772
+ // distribute, sublicense, and/or sell copies of the Software, and to permit
1773
+ // persons to whom the Software is furnished to do so, subject to the
1774
+ // following conditions:
1775
+ //
1776
+ // The above copyright notice and this permission notice shall be included
1777
+ // in all copies or substantial portions of the Software.
1778
+ //
1779
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1780
+ // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1781
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
1782
+ // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
1783
+ // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
1784
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
1785
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
1786
+
1787
+ var formatRegExp = /%[sdj%]/g;
1788
+ exports.format = function(f) {
1789
+ if (!isString(f)) {
1790
+ var objects = [];
1791
+ for (var i = 0; i < arguments.length; i++) {
1792
+ objects.push(inspect(arguments[i]));
1793
+ }
1794
+ return objects.join(' ');
1795
+ }
1796
+
1797
+ var i = 1;
1798
+ var args = arguments;
1799
+ var len = args.length;
1800
+ var str = String(f).replace(formatRegExp, function(x) {
1801
+ if (x === '%%') return '%';
1802
+ if (i >= len) return x;
1803
+ switch (x) {
1804
+ case '%s': return String(args[i++]);
1805
+ case '%d': return Number(args[i++]);
1806
+ case '%j':
1807
+ try {
1808
+ return JSON.stringify(args[i++]);
1809
+ } catch (_) {
1810
+ return '[Circular]';
1811
+ }
1812
+ default:
1813
+ return x;
1814
+ }
1815
+ });
1816
+ for (var x = args[i]; i < len; x = args[++i]) {
1817
+ if (isNull(x) || !isObject(x)) {
1818
+ str += ' ' + x;
1819
+ } else {
1820
+ str += ' ' + inspect(x);
1821
+ }
1822
+ }
1823
+ return str;
1824
+ };
1825
+
1826
+
1827
+ // Mark that a method should not be used.
1828
+ // Returns a modified function which warns once by default.
1829
+ // If --no-deprecation is set, then it is a no-op.
1830
+ exports.deprecate = function(fn, msg) {
1831
+ // Allow for deprecating things in the process of starting up.
1832
+ if (isUndefined(commonjsGlobal.process)) {
1833
+ return function() {
1834
+ return exports.deprecate(fn, msg).apply(this, arguments);
1835
+ };
1836
+ }
1837
+
1838
+ if (process.noDeprecation === true) {
1839
+ return fn;
1840
+ }
1841
+
1842
+ var warned = false;
1843
+ function deprecated() {
1844
+ if (!warned) {
1845
+ if (process.throwDeprecation) {
1846
+ throw new Error(msg);
1847
+ } else if (process.traceDeprecation) {
1848
+ console.trace(msg);
1849
+ } else {
1850
+ console.error(msg);
1851
+ }
1852
+ warned = true;
1853
+ }
1854
+ return fn.apply(this, arguments);
1855
+ }
1856
+
1857
+ return deprecated;
1858
+ };
1859
+
1860
+
1861
+ var debugs = {};
1862
+ var debugEnviron;
1863
+ exports.debuglog = function(set) {
1864
+ if (isUndefined(debugEnviron))
1865
+ debugEnviron = process.env.NODE_DEBUG || '';
1866
+ set = set.toUpperCase();
1867
+ if (!debugs[set]) {
1868
+ if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
1869
+ var pid = process.pid;
1870
+ debugs[set] = function() {
1871
+ var msg = exports.format.apply(exports, arguments);
1872
+ console.error('%s %d: %s', set, pid, msg);
1873
+ };
1874
+ } else {
1875
+ debugs[set] = function() {};
1876
+ }
1877
+ }
1878
+ return debugs[set];
1879
+ };
1880
+
1881
+
1882
+ /**
1883
+ * Echos the value of a value. Trys to print the value out
1884
+ * in the best way possible given the different types.
1885
+ *
1886
+ * @param {Object} obj The object to print out.
1887
+ * @param {Object} opts Optional options object that alters the output.
1888
+ */
1889
+ /* legacy: obj, showHidden, depth, colors*/
1890
+ function inspect(obj, opts) {
1891
+ // default options
1892
+ var ctx = {
1893
+ seen: [],
1894
+ stylize: stylizeNoColor
1895
+ };
1896
+ // legacy...
1897
+ if (arguments.length >= 3) ctx.depth = arguments[2];
1898
+ if (arguments.length >= 4) ctx.colors = arguments[3];
1899
+ if (isBoolean(opts)) {
1900
+ // legacy...
1901
+ ctx.showHidden = opts;
1902
+ } else if (opts) {
1903
+ // got an "options" object
1904
+ exports._extend(ctx, opts);
1905
+ }
1906
+ // set default options
1907
+ if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
1908
+ if (isUndefined(ctx.depth)) ctx.depth = 2;
1909
+ if (isUndefined(ctx.colors)) ctx.colors = false;
1910
+ if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
1911
+ if (ctx.colors) ctx.stylize = stylizeWithColor;
1912
+ return formatValue(ctx, obj, ctx.depth);
1913
+ }
1914
+ exports.inspect = inspect;
1915
+
1916
+
1917
+ // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
1918
+ inspect.colors = {
1919
+ 'bold' : [1, 22],
1920
+ 'italic' : [3, 23],
1921
+ 'underline' : [4, 24],
1922
+ 'inverse' : [7, 27],
1923
+ 'white' : [37, 39],
1924
+ 'grey' : [90, 39],
1925
+ 'black' : [30, 39],
1926
+ 'blue' : [34, 39],
1927
+ 'cyan' : [36, 39],
1928
+ 'green' : [32, 39],
1929
+ 'magenta' : [35, 39],
1930
+ 'red' : [31, 39],
1931
+ 'yellow' : [33, 39]
1932
+ };
1933
+
1934
+ // Don't use 'blue' not visible on cmd.exe
1935
+ inspect.styles = {
1936
+ 'special': 'cyan',
1937
+ 'number': 'yellow',
1938
+ 'boolean': 'yellow',
1939
+ 'undefined': 'grey',
1940
+ 'null': 'bold',
1941
+ 'string': 'green',
1942
+ 'date': 'magenta',
1943
+ // "name": intentionally not styling
1944
+ 'regexp': 'red'
1945
+ };
1946
+
1947
+
1948
+ function stylizeWithColor(str, styleType) {
1949
+ var style = inspect.styles[styleType];
1950
+
1951
+ if (style) {
1952
+ return '\u001b[' + inspect.colors[style][0] + 'm' + str +
1953
+ '\u001b[' + inspect.colors[style][1] + 'm';
1954
+ } else {
1955
+ return str;
1956
+ }
1957
+ }
1958
+
1959
+
1960
+ function stylizeNoColor(str, styleType) {
1961
+ return str;
1962
+ }
1963
+
1964
+
1965
+ function arrayToHash(array) {
1966
+ var hash = {};
1967
+
1968
+ array.forEach(function(val, idx) {
1969
+ hash[val] = true;
1970
+ });
1971
+
1972
+ return hash;
1973
+ }
1974
+
1975
+
1976
+ function formatValue(ctx, value, recurseTimes) {
1977
+ // Provide a hook for user-specified inspect functions.
1978
+ // Check that value is an object with an inspect function on it
1979
+ if (ctx.customInspect &&
1980
+ value &&
1981
+ isFunction(value.inspect) &&
1982
+ // Filter out the util module, it's inspect function is special
1983
+ value.inspect !== exports.inspect &&
1984
+ // Also filter out any prototype objects using the circular check.
1985
+ !(value.constructor && value.constructor.prototype === value)) {
1986
+ var ret = value.inspect(recurseTimes, ctx);
1987
+ if (!isString(ret)) {
1988
+ ret = formatValue(ctx, ret, recurseTimes);
1989
+ }
1990
+ return ret;
1991
+ }
1992
+
1993
+ // Primitive types cannot have properties
1994
+ var primitive = formatPrimitive(ctx, value);
1995
+ if (primitive) {
1996
+ return primitive;
1997
+ }
1998
+
1999
+ // Look up the keys of the object.
2000
+ var keys = Object.keys(value);
2001
+ var visibleKeys = arrayToHash(keys);
2002
+
2003
+ if (ctx.showHidden) {
2004
+ keys = Object.getOwnPropertyNames(value);
2005
+ }
2006
+
2007
+ // IE doesn't make error fields non-enumerable
2008
+ // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
2009
+ if (isError(value)
2010
+ && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
2011
+ return formatError(value);
2012
+ }
2013
+
2014
+ // Some type of object without properties can be shortcutted.
2015
+ if (keys.length === 0) {
2016
+ if (isFunction(value)) {
2017
+ var name = value.name ? ': ' + value.name : '';
2018
+ return ctx.stylize('[Function' + name + ']', 'special');
2019
+ }
2020
+ if (isRegExp(value)) {
2021
+ return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
2022
+ }
2023
+ if (isDate(value)) {
2024
+ return ctx.stylize(Date.prototype.toString.call(value), 'date');
2025
+ }
2026
+ if (isError(value)) {
2027
+ return formatError(value);
2028
+ }
2029
+ }
2030
+
2031
+ var base = '', array = false, braces = ['{', '}'];
2032
+
2033
+ // Make Array say that they are Array
2034
+ if (isArray(value)) {
2035
+ array = true;
2036
+ braces = ['[', ']'];
2037
+ }
2038
+
2039
+ // Make functions say that they are functions
2040
+ if (isFunction(value)) {
2041
+ var n = value.name ? ': ' + value.name : '';
2042
+ base = ' [Function' + n + ']';
2043
+ }
2044
+
2045
+ // Make RegExps say that they are RegExps
2046
+ if (isRegExp(value)) {
2047
+ base = ' ' + RegExp.prototype.toString.call(value);
2048
+ }
2049
+
2050
+ // Make dates with properties first say the date
2051
+ if (isDate(value)) {
2052
+ base = ' ' + Date.prototype.toUTCString.call(value);
2053
+ }
2054
+
2055
+ // Make error with message first say the error
2056
+ if (isError(value)) {
2057
+ base = ' ' + formatError(value);
2058
+ }
2059
+
2060
+ if (keys.length === 0 && (!array || value.length == 0)) {
2061
+ return braces[0] + base + braces[1];
2062
+ }
2063
+
2064
+ if (recurseTimes < 0) {
2065
+ if (isRegExp(value)) {
2066
+ return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
2067
+ } else {
2068
+ return ctx.stylize('[Object]', 'special');
2069
+ }
2070
+ }
2071
+
2072
+ ctx.seen.push(value);
2073
+
2074
+ var output;
2075
+ if (array) {
2076
+ output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
2077
+ } else {
2078
+ output = keys.map(function(key) {
2079
+ return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
2080
+ });
2081
+ }
2082
+
2083
+ ctx.seen.pop();
2084
+
2085
+ return reduceToSingleString(output, base, braces);
2086
+ }
2087
+
2088
+
2089
+ function formatPrimitive(ctx, value) {
2090
+ if (isUndefined(value))
2091
+ return ctx.stylize('undefined', 'undefined');
2092
+ if (isString(value)) {
2093
+ var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
2094
+ .replace(/'/g, "\\'")
2095
+ .replace(/\\"/g, '"') + '\'';
2096
+ return ctx.stylize(simple, 'string');
2097
+ }
2098
+ if (isNumber(value))
2099
+ return ctx.stylize('' + value, 'number');
2100
+ if (isBoolean(value))
2101
+ return ctx.stylize('' + value, 'boolean');
2102
+ // For some reason typeof null is "object", so special case here.
2103
+ if (isNull(value))
2104
+ return ctx.stylize('null', 'null');
2105
+ }
2106
+
2107
+
2108
+ function formatError(value) {
2109
+ return '[' + Error.prototype.toString.call(value) + ']';
2110
+ }
2111
+
2112
+
2113
+ function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
2114
+ var output = [];
2115
+ for (var i = 0, l = value.length; i < l; ++i) {
2116
+ if (hasOwnProperty(value, String(i))) {
2117
+ output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
2118
+ String(i), true));
2119
+ } else {
2120
+ output.push('');
2121
+ }
2122
+ }
2123
+ keys.forEach(function(key) {
2124
+ if (!key.match(/^\d+$/)) {
2125
+ output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
2126
+ key, true));
2127
+ }
2128
+ });
2129
+ return output;
2130
+ }
2131
+
2132
+
2133
+ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
2134
+ var name, str, desc;
2135
+ desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
2136
+ if (desc.get) {
2137
+ if (desc.set) {
2138
+ str = ctx.stylize('[Getter/Setter]', 'special');
2139
+ } else {
2140
+ str = ctx.stylize('[Getter]', 'special');
2141
+ }
2142
+ } else {
2143
+ if (desc.set) {
2144
+ str = ctx.stylize('[Setter]', 'special');
2145
+ }
2146
+ }
2147
+ if (!hasOwnProperty(visibleKeys, key)) {
2148
+ name = '[' + key + ']';
2149
+ }
2150
+ if (!str) {
2151
+ if (ctx.seen.indexOf(desc.value) < 0) {
2152
+ if (isNull(recurseTimes)) {
2153
+ str = formatValue(ctx, desc.value, null);
2154
+ } else {
2155
+ str = formatValue(ctx, desc.value, recurseTimes - 1);
2156
+ }
2157
+ if (str.indexOf('\n') > -1) {
2158
+ if (array) {
2159
+ str = str.split('\n').map(function(line) {
2160
+ return ' ' + line;
2161
+ }).join('\n').substr(2);
2162
+ } else {
2163
+ str = '\n' + str.split('\n').map(function(line) {
2164
+ return ' ' + line;
2165
+ }).join('\n');
2166
+ }
2167
+ }
2168
+ } else {
2169
+ str = ctx.stylize('[Circular]', 'special');
2170
+ }
2171
+ }
2172
+ if (isUndefined(name)) {
2173
+ if (array && key.match(/^\d+$/)) {
2174
+ return str;
2175
+ }
2176
+ name = JSON.stringify('' + key);
2177
+ if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
2178
+ name = name.substr(1, name.length - 2);
2179
+ name = ctx.stylize(name, 'name');
2180
+ } else {
2181
+ name = name.replace(/'/g, "\\'")
2182
+ .replace(/\\"/g, '"')
2183
+ .replace(/(^"|"$)/g, "'");
2184
+ name = ctx.stylize(name, 'string');
2185
+ }
2186
+ }
2187
+
2188
+ return name + ': ' + str;
2189
+ }
2190
+
2191
+
2192
+ function reduceToSingleString(output, base, braces) {
2193
+ var length = output.reduce(function(prev, cur) {
2194
+ if (cur.indexOf('\n') >= 0) ;
2195
+ return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
2196
+ }, 0);
2197
+
2198
+ if (length > 60) {
2199
+ return braces[0] +
2200
+ (base === '' ? '' : base + '\n ') +
2201
+ ' ' +
2202
+ output.join(',\n ') +
2203
+ ' ' +
2204
+ braces[1];
2205
+ }
2206
+
2207
+ return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
2208
+ }
2209
+
2210
+
2211
+ // NOTE: These type checking functions intentionally don't use `instanceof`
2212
+ // because it is fragile and can be easily faked with `Object.create()`.
2213
+ function isArray(ar) {
2214
+ return Array.isArray(ar);
2215
+ }
2216
+ exports.isArray = isArray;
2217
+
2218
+ function isBoolean(arg) {
2219
+ return typeof arg === 'boolean';
2220
+ }
2221
+ exports.isBoolean = isBoolean;
2222
+
2223
+ function isNull(arg) {
2224
+ return arg === null;
2225
+ }
2226
+ exports.isNull = isNull;
2227
+
2228
+ function isNullOrUndefined(arg) {
2229
+ return arg == null;
2230
+ }
2231
+ exports.isNullOrUndefined = isNullOrUndefined;
2232
+
2233
+ function isNumber(arg) {
2234
+ return typeof arg === 'number';
2235
+ }
2236
+ exports.isNumber = isNumber;
2237
+
2238
+ function isString(arg) {
2239
+ return typeof arg === 'string';
2240
+ }
2241
+ exports.isString = isString;
2242
+
2243
+ function isSymbol(arg) {
2244
+ return typeof arg === 'symbol';
2245
+ }
2246
+ exports.isSymbol = isSymbol;
2247
+
2248
+ function isUndefined(arg) {
2249
+ return arg === void 0;
2250
+ }
2251
+ exports.isUndefined = isUndefined;
2252
+
2253
+ function isRegExp(re) {
2254
+ return isObject(re) && objectToString(re) === '[object RegExp]';
2255
+ }
2256
+ exports.isRegExp = isRegExp;
2257
+
2258
+ function isObject(arg) {
2259
+ return typeof arg === 'object' && arg !== null;
2260
+ }
2261
+ exports.isObject = isObject;
2262
+
2263
+ function isDate(d) {
2264
+ return isObject(d) && objectToString(d) === '[object Date]';
2265
+ }
2266
+ exports.isDate = isDate;
2267
+
2268
+ function isError(e) {
2269
+ return isObject(e) &&
2270
+ (objectToString(e) === '[object Error]' || e instanceof Error);
2271
+ }
2272
+ exports.isError = isError;
2273
+
2274
+ function isFunction(arg) {
2275
+ return typeof arg === 'function';
2276
+ }
2277
+ exports.isFunction = isFunction;
2278
+
2279
+ function isPrimitive(arg) {
2280
+ return arg === null ||
2281
+ typeof arg === 'boolean' ||
2282
+ typeof arg === 'number' ||
2283
+ typeof arg === 'string' ||
2284
+ typeof arg === 'symbol' || // ES6 symbol
2285
+ typeof arg === 'undefined';
2286
+ }
2287
+ exports.isPrimitive = isPrimitive;
2288
+
2289
+ exports.isBuffer = requireIsBuffer();
2290
+
2291
+ function objectToString(o) {
2292
+ return Object.prototype.toString.call(o);
2293
+ }
2294
+
2295
+
2296
+ function pad(n) {
2297
+ return n < 10 ? '0' + n.toString(10) : n.toString(10);
2298
+ }
2299
+
2300
+
2301
+ var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
2302
+ 'Oct', 'Nov', 'Dec'];
2303
+
2304
+ // 26 Feb 16:19:34
2305
+ function timestamp() {
2306
+ var d = new Date();
2307
+ var time = [pad(d.getHours()),
2308
+ pad(d.getMinutes()),
2309
+ pad(d.getSeconds())].join(':');
2310
+ return [d.getDate(), months[d.getMonth()], time].join(' ');
2311
+ }
2312
+
2313
+
2314
+ // log is just a thin wrapper to console.log that prepends a timestamp
2315
+ exports.log = function() {
2316
+ console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
2317
+ };
2318
+
2319
+
2320
+ /**
2321
+ * Inherit the prototype methods from one constructor into another.
2322
+ *
2323
+ * The Function.prototype.inherits from lang.js rewritten as a standalone
2324
+ * function (not on Function.prototype). NOTE: If this file is to be loaded
2325
+ * during bootstrapping this function needs to be rewritten using some native
2326
+ * functions as prototype setup using normal JavaScript does not work as
2327
+ * expected during bootstrapping (see mirror.js in r114903).
2328
+ *
2329
+ * @param {function} ctor Constructor function which needs to inherit the
2330
+ * prototype.
2331
+ * @param {function} superCtor Constructor function to inherit prototype from.
2332
+ */
2333
+ exports.inherits = requireInherits();
2334
+
2335
+ exports._extend = function(origin, add) {
2336
+ // Don't do anything if add isn't an object
2337
+ if (!add || !isObject(add)) return origin;
2338
+
2339
+ var keys = Object.keys(add);
2340
+ var i = keys.length;
2341
+ while (i--) {
2342
+ origin[keys[i]] = add[keys[i]];
2343
+ }
2344
+ return origin;
2345
+ };
2346
+
2347
+ function hasOwnProperty(obj, prop) {
2348
+ return Object.prototype.hasOwnProperty.call(obj, prop);
2349
+ }
2350
+ } (util));
2351
+ return util;
2352
+ }
2353
+
1657
2354
  /* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex" }] */
1658
2355
 
1659
2356
  var sender$1;
@@ -1665,6 +2362,9 @@ function requireSender () {
1665
2362
 
1666
2363
  const { Duplex } = require$$0$2;
1667
2364
  const { randomFillSync } = require$$1;
2365
+ const {
2366
+ types: { isUint8Array }
2367
+ } = requireUtil();
1668
2368
 
1669
2369
  const PerMessageDeflate = requirePermessageDeflate();
1670
2370
  const { EMPTY_BUFFER, kWebSocket, NOOP } = requireConstants();
@@ -1861,8 +2561,10 @@ function requireSender () {
1861
2561
 
1862
2562
  if (typeof data === 'string') {
1863
2563
  buf.write(data, 2);
1864
- } else {
2564
+ } else if (isUint8Array(data)) {
1865
2565
  buf.set(data, 2);
2566
+ } else {
2567
+ throw new TypeError('Second argument must be a string or a Uint8Array');
1866
2568
  }
1867
2569
  }
1868
2570
 
@@ -2983,6 +3685,10 @@ function requireWebsocket () {
2983
3685
  * multiple times in the same tick
2984
3686
  * @param {Function} [options.generateMask] The function used to generate the
2985
3687
  * masking key
3688
+ * @param {Number} [options.maxBufferedChunks=0] The maximum number of
3689
+ * buffered data chunks
3690
+ * @param {Number} [options.maxFragments=0] The maximum number of message
3691
+ * fragments
2986
3692
  * @param {Number} [options.maxPayload=0] The maximum allowed message size
2987
3693
  * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
2988
3694
  * not to skip UTF-8 validation for text and close messages
@@ -2994,6 +3700,8 @@ function requireWebsocket () {
2994
3700
  binaryType: this.binaryType,
2995
3701
  extensions: this._extensions,
2996
3702
  isServer: this._isServer,
3703
+ maxBufferedChunks: options.maxBufferedChunks,
3704
+ maxFragments: options.maxFragments,
2997
3705
  maxPayload: options.maxPayload,
2998
3706
  skipUTF8Validation: options.skipUTF8Validation
2999
3707
  });
@@ -3422,6 +4130,10 @@ function requireWebsocket () {
3422
4130
  * masking key
3423
4131
  * @param {Number} [options.handshakeTimeout] Timeout in milliseconds for the
3424
4132
  * handshake request
4133
+ * @param {Number} [options.maxBufferedChunks=262144] The maximum number of
4134
+ * buffered data chunks
4135
+ * @param {Number} [options.maxFragments=16384] The maximum number of message
4136
+ * fragments
3425
4137
  * @param {Number} [options.maxPayload=104857600] The maximum allowed message
3426
4138
  * size
3427
4139
  * @param {Number} [options.maxRedirects=10] The maximum number of redirects
@@ -3442,6 +4154,8 @@ function requireWebsocket () {
3442
4154
  autoPong: true,
3443
4155
  closeTimeout: CLOSE_TIMEOUT,
3444
4156
  protocolVersion: protocolVersions[1],
4157
+ maxBufferedChunks: 256 * 1024,
4158
+ maxFragments: 16 * 1024,
3445
4159
  maxPayload: 100 * 1024 * 1024,
3446
4160
  skipUTF8Validation: false,
3447
4161
  perMessageDeflate: true,
@@ -3799,6 +4513,8 @@ function requireWebsocket () {
3799
4513
  websocket.setSocket(socket, head, {
3800
4514
  allowSynchronousEvents: opts.allowSynchronousEvents,
3801
4515
  generateMask: opts.generateMask,
4516
+ maxBufferedChunks: opts.maxBufferedChunks,
4517
+ maxFragments: opts.maxFragments,
3802
4518
  maxPayload: opts.maxPayload,
3803
4519
  skipUTF8Validation: opts.skipUTF8Validation
3804
4520
  });
@@ -4480,6 +5196,10 @@ function requireWebsocketServer () {
4480
5196
  * called
4481
5197
  * @param {Function} [options.handleProtocols] A hook to handle protocols
4482
5198
  * @param {String} [options.host] The hostname where to bind the server
5199
+ * @param {Number} [options.maxBufferedChunks=262144] The maximum number of
5200
+ * buffered data chunks
5201
+ * @param {Number} [options.maxFragments=16384] The maximum number of message
5202
+ * fragments
4483
5203
  * @param {Number} [options.maxPayload=104857600] The maximum allowed message
4484
5204
  * size
4485
5205
  * @param {Boolean} [options.noServer=false] Enable no server mode
@@ -4502,6 +5222,8 @@ function requireWebsocketServer () {
4502
5222
  options = {
4503
5223
  allowSynchronousEvents: true,
4504
5224
  autoPong: true,
5225
+ maxBufferedChunks: 256 * 1024,
5226
+ maxFragments: 16 * 1024,
4505
5227
  maxPayload: 100 * 1024 * 1024,
4506
5228
  skipUTF8Validation: false,
4507
5229
  perMessageDeflate: false,
@@ -4861,6 +5583,8 @@ function requireWebsocketServer () {
4861
5583
 
4862
5584
  ws.setSocket(socket, head, {
4863
5585
  allowSynchronousEvents: this.options.allowSynchronousEvents,
5586
+ maxBufferedChunks: this.options.maxBufferedChunks,
5587
+ maxFragments: this.options.maxFragments,
4864
5588
  maxPayload: this.options.maxPayload,
4865
5589
  skipUTF8Validation: this.options.skipUTF8Validation
4866
5590
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/server",
3
- "version": "17.3.0",
3
+ "version": "17.4.0",
4
4
  "type": "module",
5
5
  "description": "A modern Node.js HTTP server with declarative routing, content negotiation, and WebSocket support",
6
6
  "repository": {
@@ -36,7 +36,7 @@
36
36
  "prepublishOnly": "npm run build"
37
37
  },
38
38
  "dependencies": {
39
- "launch-editor": "2.13.2"
39
+ "launch-editor": "2.14.1"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@jsenv/abort": "../../tooling/abort",
@@ -56,9 +56,9 @@
56
56
  "@jsenv/utils": "../../tooling/utils",
57
57
  "eventsource": "4.1.0",
58
58
  "formidable": "3.5.4",
59
- "playwright": "1.58.1",
60
- "undici": "7.24.2",
61
- "ws": "8.20.0"
59
+ "playwright": "1.61.1",
60
+ "undici": "8.8.0",
61
+ "ws": "8.21.1"
62
62
  },
63
63
  "publishConfig": {
64
64
  "access": "public"
@@ -4,7 +4,11 @@
4
4
  * It is meant to be used inside "requestToResponse"
5
5
  */
6
6
 
7
- import { urlToExtension, urlToPathname } from "@jsenv/urls";
7
+ import {
8
+ urlIsOrIsInsideOf,
9
+ urlToExtension,
10
+ urlToPathname,
11
+ } from "@jsenv/urls";
8
12
  import { CONTENT_TYPE } from "@jsenv/utils/src/content_type/content_type.js";
9
13
  import { createReadStream, readFile, statSync } from "node:fs";
10
14
 
@@ -62,8 +66,14 @@ export const fetchFileSystem = async (
62
66
  } else {
63
67
  resource = request.resource.slice(1);
64
68
  }
65
- const filesystemUrl = new URL(resource, directoryUrl);
69
+ const filesystemUrl = new URL(resource, directoryUrlString);
66
70
  const urlString = asUrlString(filesystemUrl);
71
+ if (!urlIsOrIsInsideOf(urlString, directoryUrlString)) {
72
+ return {
73
+ status: 403,
74
+ statusText: "not allowed to read outside root directory",
75
+ };
76
+ }
67
77
 
68
78
  if (cacheControl === undefined) {
69
79
  cacheControl = isVersioned(request)
@@ -49,7 +49,7 @@ import { WebSocketResponse } from "./web_socket_response.js";
49
49
  * // Use in server route
50
50
  * {
51
51
  * endpoint: "GET /events",
52
- * response: (request) => serverEvents.fetch(request)
52
+ * fetch: (request) => serverEvents.fetch(request)
53
53
  * }
54
54
  */
55
55
  export class ServerEvents {
@@ -107,7 +107,7 @@ export class ServerEvents {
107
107
  * // Use in server route
108
108
  * {
109
109
  * endpoint: "GET /events",
110
- * response: (request) => events.fetch(request)
110
+ * fetch: (request) => events.fetch(request)
111
111
  * }
112
112
  */
113
113
  export class LazyServerEvents {
@@ -14,6 +14,30 @@
14
14
  * But we don't really need a class so we are just returning a regular object under the hood
15
15
  */
16
16
 
17
+ /**
18
+ * Return this from a route `fetch` to accept a websocket upgrade on that
19
+ * endpoint.
20
+ *
21
+ * @param {(websocket: import("ws").WebSocket) => void | (() => void)} webSocketHandler
22
+ * Called with the raw `ws` socket once the upgrade completes. Use
23
+ * `websocket.on("message", …)` / `websocket.send(…)`. If it returns a
24
+ * function, that function runs as cleanup when the socket closes.
25
+ * @param {object} [init]
26
+ * @param {number} [init.status=101]
27
+ * @param {string} [init.statusText]
28
+ * @param {object} [init.headers]
29
+ *
30
+ * @example
31
+ * {
32
+ * endpoint: "GET /chat.websocket",
33
+ * fetch: () => new WebSocketResponse((websocket) => {
34
+ * websocket.on("message", (data) => websocket.send(data));
35
+ * return () => {
36
+ * // socket closed
37
+ * };
38
+ * }),
39
+ * }
40
+ */
17
41
  export class WebSocketResponse {
18
42
  constructor(
19
43
  webSocketHandler,