preact.min.js 11 KB

12
  1. !function(){var n,l,t,u,r,e,i,o,f,c,s,a,h,p,y="http://www.w3.org/2000/svg",v="http://www.w3.org/1999/xhtml",d=void 0,_={},w=[],m=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,g=Array.isArray;function b(n,l){for(var t in l)n[t]=l[t];return n}function k(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function C(l,t,u){var r,e,i,o={};for(i in t)"key"==i?r=t[i]:"ref"==i?e=t[i]:o[i]=t[i];if(arguments.length>2&&(o.children=arguments.length>3?n.call(arguments,2):u),"function"==typeof l&&null!=l.defaultProps)for(i in l.defaultProps)o[i]===d&&(o[i]=l.defaultProps[i]);return x(l,o,r,e,null)}function x(n,u,r,e,i){var o={type:n,props:u,key:r,ref:e,__k:null,__:null,__b:0,__e:null,__c:null,constructor:d,__v:null==i?++t:i,__i:-1,__u:0};return null==i&&null!=l.vnode&&l.vnode(o),o}function S(n){return n.children}function M(n,l){this.props=n,this.context=l}function P(n,l){if(null==l)return n.__?P(n.__,n.__i+1):null;for(var t;l<n.__k.length;l++)if(null!=(t=n.__k[l])&&null!=t.__e)return t.__e;return"function"==typeof n.type?P(n):null}function $(n){var l,t;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(t=n.__k[l])&&null!=t.__e){n.__e=n.__c.base=t.__e;break}return $(n)}}function A(n){(!n.__d&&(n.__d=!0)&&r.push(n)&&!I.__r++||e!==l.debounceRendering)&&((e=l.debounceRendering)||i)(I)}function I(){var n,t,u,e,i,f,c,s;for(r.sort(o);n=r.shift();)n.__d&&(t=r.length,e=void 0,f=(i=(u=n).__v).__e,c=[],s=[],u.__P&&((e=b({},i)).__v=i.__v+1,l.vnode&&l.vnode(e),j(u.__P,e,i,u.__n,u.__P.namespaceURI,32&i.__u?[f]:null,c,null==f?P(i):f,!!(32&i.__u),s),e.__v=i.__v,e.__.__k[e.__i]=e,z(c,e,s),e.__e!=f&&$(e)),r.length>t&&r.sort(o));I.__r=0}function E(n,l,t,u,r,e,i,o,f,c,s){var a,h,p,y,v,m,g=u&&u.__k||w,b=l.length;for(f=F(t,l,g,f,b),a=0;a<b;a++)null!=(p=t.__k[a])&&(h=-1===p.__i?_:g[p.__i]||_,p.__i=a,m=j(n,p,h,r,e,i,o,f,c,s),y=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&R(h.ref,null,p),s.push(p.ref,p.__c||y,p)),null==v&&null!=y&&(v=y),4&p.__u||h.__k===p.__k?f=H(p,f,n):"function"==typeof p.type&&m!==d?f=m:y&&(f=y.nextSibling),p.__u&=-7);return t.__e=v,f}function F(n,l,t,u,r){var e,i,o,f,c,s=t.length,a=s,h=0;for(n.__k=new Array(r),e=0;e<r;e++)null!=(i=l[e])&&"boolean"!=typeof i&&"function"!=typeof i?(f=e+h,(i=n.__k[e]="string"==typeof i||"number"==typeof i||"bigint"==typeof i||i.constructor==String?x(null,i,null,null,null):g(i)?x(S,{children:i},null,null,null):i.constructor===d&&i.__b>0?x(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i).__=n,i.__b=n.__b+1,o=null,-1!==(c=i.__i=L(i,t,f,a))&&(a--,(o=t[c])&&(o.__u|=2)),null==o||null===o.__v?(-1==c&&h--,"function"!=typeof i.type&&(i.__u|=4)):c!=f&&(c==f-1?h--:c==f+1?h++:(c>f?h--:h++,i.__u|=4))):n.__k[e]=null;if(a)for(e=0;e<s;e++)null!=(o=t[e])&&0==(2&o.__u)&&(o.__e==u&&(u=P(o)),q(o,o));return u}function H(n,l,t){var u,r;if("function"==typeof n.type){for(u=n.__k,r=0;u&&r<u.length;r++)u[r]&&(u[r].__=n,l=H(u[r],l,t));return l}n.__e!=l&&(l&&n.type&&!t.contains(l)&&(l=P(n)),t.insertBefore(n.__e,l||null),l=n.__e);do{l=l&&l.nextSibling}while(null!=l&&8==l.nodeType);return l}function L(n,l,t,u){var r,e,i=n.key,o=n.type,f=l[t];if(null===f||f&&i==f.key&&o===f.type&&0==(2&f.__u))return t;if(u>(null!=f&&0==(2&f.__u)?1:0))for(r=t-1,e=t+1;r>=0||e<l.length;){if(r>=0){if((f=l[r])&&0==(2&f.__u)&&i==f.key&&o===f.type)return r;r--}if(e<l.length){if((f=l[e])&&0==(2&f.__u)&&i==f.key&&o===f.type)return e;e++}}return-1}function T(n,l,t){"-"==l[0]?n.setProperty(l,null==t?"":t):n[l]=null==t?"":"number"!=typeof t||m.test(l)?t:t+"px"}function O(n,l,t,u,r){var e;n:if("style"==l)if("string"==typeof t)n.style.cssText=t;else{if("string"==typeof u&&(n.style.cssText=u=""),u)for(l in u)t&&l in t||T(n.style,l,"");if(t)for(l in t)u&&t[l]===u[l]||T(n.style,l,t[l])}else if("o"==l[0]&&"n"==l[1])e=l!=(l=l.replace(f,"$1")),l=l.toLowerCase()in n||"onFocusOut"==l||"onFocusIn"==l?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+e]=t,t?u?t.t=u.t:(t.t=c,n.addEventListener(l,e?a:s,e)):n.removeEventListener(l,e?a:s,e);else{if(r==y)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=l&&"height"!=l&&"href"!=l&&"list"!=l&&"form"!=l&&"tabIndex"!=l&&"download"!=l&&"rowSpan"!=l&&"colSpan"!=l&&"role"!=l&&"popover"!=l&&l in n)try{n[l]=null==t?"":t;break n}catch(n){}"function"==typeof t||(null==t||!1===t&&"-"!=l[4]?n.removeAttribute(l):n.setAttribute(l,"popover"==l&&1==t?"":t))}}function V(n){return function(t){if(this.l){var u=this.l[t.type+n];if(null==t.u)t.u=c++;else if(t.u<u.t)return;return u(l.event?l.event(t):t)}}}function j(n,t,u,r,e,i,o,f,c,s){var a,h,p,y,v,_,w,m,C,x,P,$,A,I,F,H,L,T=t.type;if(t.constructor!==d)return null;128&u.__u&&(c=!!(32&u.__u),i=[f=t.__e=u.__e]),(a=l.__b)&&a(t);n:if("function"==typeof T)try{if(m=t.props,C="prototype"in T&&T.prototype.render,x=(a=T.contextType)&&r[a.__c],P=a?x?x.props.value:a.__:r,u.__c?w=(h=t.__c=u.__c).__=h.__E:(C?t.__c=h=new T(m,P):(t.__c=h=new M(m,P),h.constructor=T,h.render=B),x&&x.sub(h),h.props=m,h.state||(h.state={}),h.context=P,h.__n=r,p=h.__d=!0,h.__h=[],h._sb=[]),C&&null==h.__s&&(h.__s=h.state),C&&null!=T.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=b({},h.__s)),b(h.__s,T.getDerivedStateFromProps(m,h.__s))),y=h.props,v=h.state,h.__v=t,p)C&&null==T.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),C&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(C&&null==T.getDerivedStateFromProps&&m!==y&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(m,P),!h.__e&&(null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(m,h.__s,P)||t.__v==u.__v)){for(t.__v!=u.__v&&(h.props=m,h.state=h.__s,h.__d=!1),t.__e=u.__e,t.__k=u.__k,t.__k.some(function(n){n&&(n.__=t)}),$=0;$<h._sb.length;$++)h.__h.push(h._sb[$]);h._sb=[],h.__h.length&&o.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(m,h.__s,P),C&&null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(y,v,_)})}if(h.context=P,h.props=m,h.__P=n,h.__e=!1,A=l.__r,I=0,C){for(h.state=h.__s,h.__d=!1,A&&A(t),a=h.render(h.props,h.state,h.context),F=0;F<h._sb.length;F++)h.__h.push(h._sb[F]);h._sb=[]}else do{h.__d=!1,A&&A(t),a=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&++I<25);h.state=h.__s,null!=h.getChildContext&&(r=b(b({},r),h.getChildContext())),C&&!p&&null!=h.getSnapshotBeforeUpdate&&(_=h.getSnapshotBeforeUpdate(y,v)),f=E(n,g(H=null!=a&&a.type===S&&null==a.key?a.props.children:a)?H:[H],t,u,r,e,i,o,f,c,s),h.base=t.__e,t.__u&=-161,h.__h.length&&o.push(h),w&&(h.__E=h.__=null)}catch(n){if(t.__v=null,c||null!=i)if(n.then){for(t.__u|=c?160:128;f&&8==f.nodeType&&f.nextSibling;)f=f.nextSibling;i[i.indexOf(f)]=null,t.__e=f}else for(L=i.length;L--;)k(i[L]);else t.__e=u.__e,t.__k=u.__k;l.__e(n,t,u)}else null==i&&t.__v==u.__v?(t.__k=u.__k,t.__e=u.__e):f=t.__e=N(u.__e,t,u,r,e,i,o,c,s);return(a=l.diffed)&&a(t),128&t.__u?void 0:f}function z(n,t,u){for(var r=0;r<u.length;r++)R(u[r],u[++r],u[++r]);l.__c&&l.__c(t,n),n.some(function(t){try{n=t.__h,t.__h=[],n.some(function(n){n.call(t)})}catch(n){l.__e(n,t.__v)}})}function N(t,u,r,e,i,o,f,c,s){var a,h,p,w,m,b,C,x=r.props,S=u.props,M=u.type;if("svg"==M?i=y:"math"==M?i="http://www.w3.org/1998/Math/MathML":i||(i=v),null!=o)for(a=0;a<o.length;a++)if((m=o[a])&&"setAttribute"in m==!!M&&(M?m.localName==M:3==m.nodeType)){t=m,o[a]=null;break}if(null==t){if(null==M)return document.createTextNode(S);t=document.createElementNS(i,M,S.is&&S),c&&(l.__m&&l.__m(u,o),c=!1),o=null}if(null===M)x===S||c&&t.data===S||(t.data=S);else{if(o=o&&n.call(t.childNodes),x=r.props||_,!c&&null!=o)for(x={},a=0;a<t.attributes.length;a++)x[(m=t.attributes[a]).name]=m.value;for(a in x)if(m=x[a],"children"==a);else if("dangerouslySetInnerHTML"==a)p=m;else if(!(a in S)){if("value"==a&&"defaultValue"in S||"checked"==a&&"defaultChecked"in S)continue;O(t,a,null,m,i)}for(a in S)m=S[a],"children"==a?w=m:"dangerouslySetInnerHTML"==a?h=m:"value"==a?b=m:"checked"==a?C=m:c&&"function"!=typeof m||x[a]===m||O(t,a,m,x[a],i);if(h)c||p&&(h.__html===p.__html||h.__html===t.innerHTML)||(t.innerHTML=h.__html),u.__k=[];else if(p&&(t.innerHTML=""),E(t,g(w)?w:[w],u,r,e,"foreignObject"==M?v:i,o,f,o?o[0]:r.__k&&P(r,0),c,s),null!=o)for(a=o.length;a--;)k(o[a]);c||(a="value","progress"==M&&null==b?t.removeAttribute("value"):b!==d&&(b!==t[a]||"progress"==M&&!b||"option"==M&&b!==x[a])&&O(t,a,b,x[a],i),a="checked",C!==d&&C!==t[a]&&O(t,a,C,x[a],i))}return t}function R(n,t,u){try{if("function"==typeof n){var r="function"==typeof n.__u;r&&n.__u(),r&&null==t||(n.__u=n(t))}else n.current=t}catch(n){l.__e(n,u)}}function q(n,t,u){var r,e;if(l.unmount&&l.unmount(n),(r=n.ref)&&(r.current&&r.current!==n.__e||R(r,null,t)),null!=(r=n.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(n){l.__e(n,t)}r.base=r.__P=null}if(r=n.__k)for(e=0;e<r.length;e++)r[e]&&q(r[e],t,u||"function"!=typeof n.type);u||k(n.__e),n.__c=n.__=n.__e=d}function B(n,l,t){return this.constructor(n,t)}function D(t,u,r){var e,i,o,f;u==document&&(u=document.documentElement),l.__&&l.__(t,u),i=(e="function"==typeof r)?null:r&&r.__k||u.__k,o=[],f=[],j(u,t=(!e&&r||u).__k=C(S,null,[t]),i||_,_,u.namespaceURI,!e&&r?[r]:i?null:u.firstChild?n.call(u.childNodes):null,o,!e&&r?r:i?i.__e:u.firstChild,e,f),z(o,t,f)}n=w.slice,l={__e:function(n,l,t,u){for(var r,e,i;l=l.__;)if((r=l.__c)&&!r.__)try{if((e=r.constructor)&&null!=e.getDerivedStateFromError&&(r.setState(e.getDerivedStateFromError(n)),i=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(n,u||{}),i=r.__d),i)return r.__E=r}catch(l){n=l}throw n}},t=0,u=function(n){return null!=n&&n.constructor==d},M.prototype.setState=function(n,l){var t;t=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=b({},this.state),"function"==typeof n&&(n=n(b({},t),this.props)),n&&b(t,n),null!=n&&this.__v&&(l&&this._sb.push(l),A(this))},M.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),A(this))},M.prototype.render=S,r=[],i="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,o=function(n,l){return n.__v.__b-l.__v.__b},I.__r=0,f=/(PointerCapture)$|Capture$/i,c=0,s=V(!1),a=V(!0),h=0,p={__proto__:null,render:D,hydrate:function n(l,t){D(l,t,n)},createElement:C,h:C,Fragment:S,createRef:function(){return{current:null}},isValidElement:u,Component:M,cloneElement:function(l,t,u){var r,e,i,o,f=b({},l.props);for(i in l.type&&l.type.defaultProps&&(o=l.type.defaultProps),t)"key"==i?r=t[i]:"ref"==i?e=t[i]:f[i]=t[i]===d&&o!==d?o[i]:t[i];return arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):u),x(l.type,f,r||l.key,e||l.ref,null)},createContext:function(n,l){var t={__c:l="__cC"+h++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var t,u;return this.getChildContext||(t=new Set,(u={})[l]=this,this.getChildContext=function(){return u},this.componentWillUnmount=function(){t=null},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&t.forEach(function(n){n.__e=!0,A(n)})},this.sub=function(n){t.add(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){t&&t.delete(n),l&&l.call(n)}}),n.children}};return t.Provider.__=t.Consumer.contextType=t},toChildArray:function n(l,t){return t=t||[],null==l||"boolean"==typeof l||(g(l)?l.some(function(l){n(l,t)}):t.push(l)),t},options:l},typeof module<"u"?module.exports=p:self.preact=p}();
  2. //# sourceMappingURL=preact.min.js.map