2020-10-20 05:04:18 +00:00

2 lines
12 KiB
JavaScript

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.htmPreact={})}(this,function(e){var n,t,_,o,r,u,l,i={},c=[],s=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord/i;function f(e,n){for(var t in n)e[t]=n[t];return e}function a(e){var n=e.parentNode;n&&n.removeChild(e)}function p(e,n,t){var _,o=arguments,r={};for(_ in n)"key"!==_&&"ref"!==_&&(r[_]=n[_]);if(arguments.length>3)for(t=[t],_=3;_<arguments.length;_++)t.push(o[_]);if(null!=t&&(r.children=t),"function"==typeof e&&null!=e.defaultProps)for(_ in e.defaultProps)void 0===r[_]&&(r[_]=e.defaultProps[_]);return h(e,r,n&&n.key,n&&n.ref,null)}function h(e,t,_,o,r){var u={type:e,props:t,key:_,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:r};return null==r&&(u.__v=u),n.vnode&&n.vnode(u),u}function d(e){return e.children}function v(e,n){this.props=e,this.context=n}function m(e,n){if(null==n)return e.__?m(e.__,e.__.__k.indexOf(e)+1):null;for(var t;n<e.__k.length;n++)if(null!=(t=e.__k[n])&&null!=t.__e)return t.__e;return"function"==typeof e.type?m(e):null}function y(e){var n,t;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,n=0;n<e.__k.length;n++)if(null!=(t=e.__k[n])&&null!=t.__e){e.__e=e.__c.base=t.__e;break}return y(e)}}function g(e){(!e.__d&&(e.__d=!0)&&t.push(e)&&!_++||r!==n.debounceRendering)&&((r=n.debounceRendering)||o)(k)}function k(){for(var e;_=t.length;)e=t.sort(function(e,n){return e.__v.__b-n.__v.__b}),t=[],e.some(function(e){var n,t,_,o,r,u,l;e.__d&&(u=(r=(n=e).__v).__e,(l=n.__P)&&(t=[],(_=f({},r)).__v=_,o=S(l,r,_,n.__n,void 0!==l.ownerSVGElement,null,t,null==u?m(r):u),E(t,r),o!=u&&y(r)))})}function b(e,n,t,_,o,r,u,l,s){var f,p,h,d,v,y,g,k=t&&t.__k||c,b=k.length;if(l==i&&(l=null!=r?r[0]:b?m(t,0):null),f=0,n.__k=x(n.__k,function(t){if(null!=t){if(t.__=n,t.__b=n.__b+1,null===(h=k[f])||h&&t.key==h.key&&t.type===h.type)k[f]=void 0;else for(p=0;p<b;p++){if((h=k[p])&&t.key==h.key&&t.type===h.type){k[p]=void 0;break}h=null}if(d=S(e,t,h=h||i,_,o,r,u,l,s),(p=t.ref)&&h.ref!=p&&(g||(g=[]),h.ref&&g.push(h.ref,null,t),g.push(p,t.__c||d,t)),null!=d){var c;if(null==y&&(y=d),void 0!==t.__d)c=t.__d,t.__d=void 0;else if(r==h||d!=l||null==d.parentNode){e:if(null==l||l.parentNode!==e)e.appendChild(d),c=null;else{for(v=l,p=0;(v=v.nextSibling)&&p<b;p+=2)if(v==d)break e;e.insertBefore(d,l),c=l}"option"==n.type&&(e.value="")}l=void 0!==c?c:d.nextSibling,"function"==typeof n.type&&(n.__d=l)}else l&&h.__e==l&&l.parentNode!=e&&(l=m(h))}return f++,t}),n.__e=y,null!=r&&"function"!=typeof n.type)for(f=r.length;f--;)null!=r[f]&&a(r[f]);for(f=b;f--;)null!=k[f]&&N(k[f],k[f]);if(g)for(f=0;f<g.length;f++)D(g[f],g[++f],g[++f])}function x(e,n,t){if(null==t&&(t=[]),null==e||"boolean"==typeof e)n&&t.push(n(null));else if(Array.isArray(e))for(var _=0;_<e.length;_++)x(e[_],n,t);else t.push(n?n("string"==typeof e||"number"==typeof e?h(null,e,null,null,e):null!=e.__e||null!=e.__c?h(e.type,e.props,e.key,null,e.__v):e):e);return t}function w(e,n,t){"-"===n[0]?e.setProperty(n,t):e[n]="number"==typeof t&&!1===s.test(n)?t+"px":null==t?"":t}function C(e,n,t,_,o){var r,u,l,i,c;if(o?"className"===n&&(n="class"):"class"===n&&(n="className"),"style"===n)if(r=e.style,"string"==typeof t)r.cssText=t;else{if("string"==typeof _&&(r.cssText="",_=null),_)for(i in _)t&&i in t||w(r,i,"");if(t)for(c in t)_&&t[c]===_[c]||w(r,c,t[c])}else"o"===n[0]&&"n"===n[1]?(u=n!==(n=n.replace(/Capture$/,"")),l=n.toLowerCase(),n=(l in e?l:n).slice(2),t?(_||e.addEventListener(n,H,u),(e.l||(e.l={}))[n]=t):e.removeEventListener(n,H,u)):"list"!==n&&"tagName"!==n&&"form"!==n&&"type"!==n&&"size"!==n&&!o&&n in e?e[n]=null==t?"":t:"function"!=typeof t&&"dangerouslySetInnerHTML"!==n&&(n!==(n=n.replace(/^xlink:?/,""))?null==t||!1===t?e.removeAttributeNS("http://www.w3.org/1999/xlink",n.toLowerCase()):e.setAttributeNS("http://www.w3.org/1999/xlink",n.toLowerCase(),t):null==t||!1===t&&!/^ar/.test(n)?e.removeAttribute(n):e.setAttribute(n,t))}function H(e){this.l[e.type](n.event?n.event(e):e)}function S(e,t,_,o,r,u,l,i,c){var s,a,p,h,m,y,g,k,x,w,C=t.type;if(void 0!==t.constructor)return null;(s=n.__b)&&s(t);try{e:if("function"==typeof C){if(k=t.props,x=(s=C.contextType)&&o[s.__c],w=s?x?x.props.value:s.__:o,_.__c?g=(a=t.__c=_.__c).__=a.__E:("prototype"in C&&C.prototype.render?t.__c=a=new C(k,w):(t.__c=a=new v(k,w),a.constructor=C,a.render=T),x&&x.sub(a),a.props=k,a.state||(a.state={}),a.context=w,a.__n=o,p=a.__d=!0,a.__h=[]),null==a.__s&&(a.__s=a.state),null!=C.getDerivedStateFromProps&&(a.__s==a.state&&(a.__s=f({},a.__s)),f(a.__s,C.getDerivedStateFromProps(k,a.__s))),h=a.props,m=a.state,p)null==C.getDerivedStateFromProps&&null!=a.componentWillMount&&a.componentWillMount(),null!=a.componentDidMount&&a.__h.push(a.componentDidMount);else{if(null==C.getDerivedStateFromProps&&k!==h&&null!=a.componentWillReceiveProps&&a.componentWillReceiveProps(k,w),!a.__e&&null!=a.shouldComponentUpdate&&!1===a.shouldComponentUpdate(k,a.__s,w)||t.__v===_.__v&&!a.__){for(a.props=k,a.state=a.__s,t.__v!==_.__v&&(a.__d=!1),a.__v=t,t.__e=_.__e,t.__k=_.__k,a.__h.length&&l.push(a),s=0;s<t.__k.length;s++)t.__k[s]&&(t.__k[s].__=t);break e}null!=a.componentWillUpdate&&a.componentWillUpdate(k,a.__s,w),null!=a.componentDidUpdate&&a.__h.push(function(){a.componentDidUpdate(h,m,y)})}a.context=w,a.props=k,a.state=a.__s,(s=n.__r)&&s(t),a.__d=!1,a.__v=t,a.__P=e,s=a.render(a.props,a.state,a.context),t.__k=null!=s&&s.type==d&&null==s.key?s.props.children:Array.isArray(s)?s:[s],null!=a.getChildContext&&(o=f(f({},o),a.getChildContext())),p||null==a.getSnapshotBeforeUpdate||(y=a.getSnapshotBeforeUpdate(h,m)),b(e,t,_,o,r,u,l,i,c),a.base=t.__e,a.__h.length&&l.push(a),g&&(a.__E=a.__=null),a.__e=!1}else null==u&&t.__v===_.__v?(t.__k=_.__k,t.__e=_.__e):t.__e=P(_.__e,t,_,o,r,u,l,c);(s=n.diffed)&&s(t)}catch(e){t.__v=null,n.__e(e,t,_)}return t.__e}function E(e,t){n.__c&&n.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){n.__e(e,t.__v)}})}function P(e,n,t,_,o,r,u,l){var s,f,a,p,h,d=t.props,v=n.props;if(o="svg"===n.type||o,null!=r)for(s=0;s<r.length;s++)if(null!=(f=r[s])&&((null===n.type?3===f.nodeType:f.localName===n.type)||e==f)){e=f,r[s]=null;break}if(null==e){if(null===n.type)return document.createTextNode(v);e=o?document.createElementNS("http://www.w3.org/2000/svg",n.type):document.createElement(n.type,v.is&&{is:v.is}),r=null,l=!1}if(null===n.type)d!==v&&e.data!=v&&(e.data=v);else{if(null!=r&&(r=c.slice.call(e.childNodes)),a=(d=t.props||i).dangerouslySetInnerHTML,p=v.dangerouslySetInnerHTML,!l){if(d===i)for(d={},h=0;h<e.attributes.length;h++)d[e.attributes[h].name]=e.attributes[h].value;(p||a)&&(p&&a&&p.__html==a.__html||(e.innerHTML=p&&p.__html||""))}(function(e,n,t,_,o){var r;for(r in t)"children"===r||"key"===r||r in n||C(e,r,null,t[r],_);for(r in n)o&&"function"!=typeof n[r]||"children"===r||"key"===r||"value"===r||"checked"===r||t[r]===n[r]||C(e,r,n[r],t[r],_)})(e,v,d,o,l),n.__k=n.props.children,p||b(e,n,t,_,"foreignObject"!==n.type&&o,r,u,i,l),l||("value"in v&&void 0!==v.value&&v.value!==e.value&&(e.value=null==v.value?"":v.value),"checked"in v&&void 0!==v.checked&&v.checked!==e.checked&&(e.checked=v.checked))}return e}function D(e,t,_){try{"function"==typeof e?e(t):e.current=t}catch(e){n.__e(e,_)}}function N(e,t,_){var o,r,u;if(n.unmount&&n.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||D(o,null,t)),_||"function"==typeof e.type||(_=null!=(r=e.__e)),e.__e=e.__d=void 0,null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){n.__e(e,t)}o.base=o.__P=null}if(o=e.__k)for(u=0;u<o.length;u++)o[u]&&N(o[u],t,_);null!=r&&a(r)}function T(e,n,t){return this.constructor(e,t)}n={__e:function(e,n){for(var t,_;n=n.__;)if((t=n.__c)&&!t.__)try{if(t.constructor&&null!=t.constructor.getDerivedStateFromError&&(_=!0,t.setState(t.constructor.getDerivedStateFromError(e))),null!=t.componentDidCatch&&(_=!0,t.componentDidCatch(e)),_)return g(t.__E=t)}catch(n){e=n}throw e}},v.prototype.setState=function(e,n){var t;t=this.__s!==this.state?this.__s:this.__s=f({},this.state),"function"==typeof e&&(e=e(t,this.props)),e&&f(t,e),null!=e&&this.__v&&(n&&this.__h.push(n),g(this))},v.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),g(this))},v.prototype.render=d,t=[],_=0,o="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,u=i,l=0;var U,A,M,F=[],L=n.__r,W=n.diffed,R=n.__c,V=n.unmount;function I(e){n.__h&&n.__h(A);var t=A.__H||(A.__H={__:[],__h:[]});return e>=t.__.length&&t.__.push({}),t.__[e]}function O(e,n,t){var _=I(U++);return _.__c||(_.__c=A,_.__=[t?t(n):J(void 0,n),function(n){var t=e(_.__[0],n);_.__[0]!==t&&(_.__[0]=t,_.__c.setState({}))}]),_.__}function j(e,n){var t=I(U++);G(t.__H,n)&&(t.__=e,t.__H=n,A.__h.push(t))}function q(e,n){var t=I(U++);return G(t.__H,n)?(t.__H=n,t.__h=e,t.__=e()):t.__}function B(){F.some(function(e){if(e.__P)try{e.__H.__h.forEach($),e.__H.__h.forEach(z),e.__H.__h=[]}catch(t){return e.__H.__h=[],n.__e(t,e.__v),!0}}),F=[]}function $(e){e.t&&e.t()}function z(e){var n=e.__();"function"==typeof n&&(e.t=n)}function G(e,n){return!e||n.some(function(n,t){return n!==e[t]})}function J(e,n){return"function"==typeof n?n(e):n}n.__r=function(e){L&&L(e),U=0,(A=e.__c).__H&&(A.__H.__h.forEach($),A.__H.__h.forEach(z),A.__H.__h=[])},n.diffed=function(e){W&&W(e);var t=e.__c;if(t){var _=t.__H;_&&_.__h.length&&(1!==F.push(t)&&M===n.requestAnimationFrame||((M=n.requestAnimationFrame)||function(e){var n,t=function(){clearTimeout(_),cancelAnimationFrame(n),setTimeout(e)},_=setTimeout(t,100);"undefined"!=typeof window&&(n=requestAnimationFrame(t))})(B))}},n.__c=function(e,t){t.some(function(e){try{e.__h.forEach($),e.__h=e.__h.filter(function(e){return!e.__||z(e)})}catch(_){t.some(function(e){e.__h&&(e.__h=[])}),t=[],n.__e(_,e.__v)}}),R&&R(e,t)},n.unmount=function(e){V&&V(e);var t=e.__c;if(t){var _=t.__H;if(_)try{_.__.forEach(function(e){return e.t&&e.t()})}catch(e){n.__e(e,t.__v)}}};var K=function(e,n,t,_){var o;n[0]=0;for(var r=1;r<n.length;r++){var u=n[r++],l=n[r]?(n[0]|=u?1:2,t[n[r++]]):n[++r];3===u?_[0]=l:4===u?_[1]=Object.assign(_[1]||{},l):5===u?(_[1]=_[1]||{})[n[++r]]=l:6===u?_[1][n[++r]]+=l+"":u?(o=e.apply(l,K(e,l,t,["",null])),_.push(o),l[0]?n[0]|=2:(n[r-2]=0,n[r]=o)):_.push(l)}return _},Q=new Map,X=function(e){var n=Q.get(this);return n||(n=new Map,Q.set(this,n)),(n=K(this,n.get(e)||(n.set(e,n=function(e){for(var n,t,_=1,o="",r="",u=[0],l=function(e){1===_&&(e||(o=o.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?u.push(0,e,o):3===_&&(e||o)?(u.push(3,e,o),_=2):2===_&&"..."===o&&e?u.push(4,e,0):2===_&&o&&!e?u.push(5,0,!0,o):_>=5&&((o||!e&&5===_)&&(u.push(_,0,o,t),_=6),e&&(u.push(_,e,0,t),_=6)),o=""},i=0;i<e.length;i++){i&&(1===_&&l(),l(i));for(var c=0;c<e[i].length;c++)n=e[i][c],1===_?"<"===n?(l(),u=[u],_=3):o+=n:4===_?"--"===o&&">"===n?(_=1,o=""):o=n+o[0]:r?n===r?r="":o+=n:'"'===n||"'"===n?r=n:">"===n?(l(),_=1):_&&("="===n?(_=5,t=o,o=""):"/"===n&&(_<5||">"===e[i][c+1])?(l(),3===_&&(u=u[0]),_=u,(u=u[0]).push(2,0,_),_=0):" "===n||"\t"===n||"\n"===n||"\r"===n?(l(),_=2):o+=n),3===_&&"!--"===o&&(_=4,u=u[0])}return l(),u}(e)),n),arguments,[])).length>1?n:n[0]}.bind(p);e.h=p,e.html=X,e.render=function(e,t,_){var o,r,l;n.__&&n.__(e,t),r=(o=_===u)?null:_&&_.__k||t.__k,e=p(d,null,[e]),l=[],S(t,(o?t:_||t).__k=e,r||i,i,void 0!==t.ownerSVGElement,_&&!o?[_]:r?null:c.slice.call(t.childNodes),l,_||i,o),E(l,e)},e.Component=v,e.createContext=function(e){var n={},t={__c:"__cC"+l++,__:e,Consumer:function(e,n){return e.children(n)},Provider:function(e){var _,o=this;return this.getChildContext||(_=[],this.getChildContext=function(){return n[t.__c]=o,n},this.shouldComponentUpdate=function(e){o.props.value!==e.value&&_.some(function(n){n.context=e.value,g(n)})},this.sub=function(e){_.push(e);var n=e.componentWillUnmount;e.componentWillUnmount=function(){_.splice(_.indexOf(e),1),n&&n.call(e)}}),e.children}};return t.Consumer.contextType=t,t},e.useState=function(e){return O(J,e)},e.useReducer=O,e.useEffect=function(e,n){var t=I(U++);G(t.__H,n)&&(t.__=e,t.__H=n,A.__H.__h.push(t))},e.useLayoutEffect=j,e.useRef=function(e){return q(function(){return{current:e}},[])},e.useImperativeHandle=function(e,n,t){j(function(){"function"==typeof e?e(n()):e&&(e.current=n())},null==t?t:t.concat(e))},e.useMemo=q,e.useCallback=function(e,n){return q(function(){return e},n)},e.useContext=function(e){var n=A.context[e.__c];if(!n)return e.__;var t=I(U++);return null==t.__&&(t.__=!0,n.sub(A)),n.props.value},e.useDebugValue=function(e,t){n.useDebugValue&&n.useDebugValue(t?t(e):e)}});