!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],t):t(n.preactHooks={},n.preact)}(this,function(n,t){var u,o,i,r,c=0,f=[],e=t.options.__b,a=t.options.__r,v=t.options.diffed,l=t.options.__c,d=t.options.unmount;function p(n,u){t.options.__h&&t.options.__h(o,n,c||u),c=0;var i=o.__H||(o.__H={__:[],__h:[]});return n>=i.__.length&&i.__.push({}),i.__[n]}function m(n){return c=1,y(T,n)}function y(n,t,i){var r=p(u++,2);return r.t=n,r.__c||(r.__=[i?i(t):T(void 0,t),function(n){var t=r.t(r.__[0],n);r.__[0]!==t&&(r.__=[t,r.__[1]],r.__c.setState({}))}],r.__c=o),r.__}function s(n,i){var r=p(u++,4);!t.options.__s&&F(r.__H,i)&&(r.__=n,r.u=i,o.__h.push(r))}function h(n,t){var o=p(u++,7);return F(o.__H,t)?(o.o=n(),o.u=t,o.__h=n,o.o):o.__}function _(){for(var n;n=f.shift();)if(n.__P)try{n.__H.__h.forEach(x),n.__H.__h.forEach(A),n.__H.__h=[]}catch(u){n.__H.__h=[],t.options.__e(u,n.__v)}}t.options.__b=function(n){o=null,e&&e(n)},t.options.__r=function(n){a&&a(n),u=0;var t=(o=n.__c).__H;t&&(i===o?(t.__h=[],o.__h=[],t.__.forEach(function(n){n.o=n.u=void 0})):(t.__.forEach(function(n){n.u&&(n.__H=n.u),n.o&&(n.__=n.o),n.o=n.u=void 0}),t.__h.forEach(x),t.__h.forEach(A),t.__h=[])),i=o},t.options.diffed=function(n){v&&v(n);var u=n.__c;u&&u.__H&&u.__H.__h.length&&(1!==f.push(u)&&r===t.options.requestAnimationFrame||((r=t.options.requestAnimationFrame)||function(n){var t,u=function(){clearTimeout(o),q&&cancelAnimationFrame(t),setTimeout(n)},o=setTimeout(u,100);q&&(t=requestAnimationFrame(u))})(_)),o=null,i=null},t.options.__c=function(n,u){u.some(function(n){try{n.__H&&n.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.o&&(n.__=n.o),n.o=n.u=void 0}),n.__h.forEach(x),n.__h=n.__h.filter(function(n){return!n.__||A(n)})}catch(o){u.some(function(n){n.__h&&(n.__h=[])}),u=[],t.options.__e(o,n.__v)}}),l&&l(n,u)},t.options.unmount=function(n){d&&d(n);var u,o=n.__c;o&&o.__H&&(o.__H.__.forEach(function(n){try{x(n)}catch(n){u=n}}),u&&t.options.__e(u,o.__v))};var q="function"==typeof requestAnimationFrame;function x(n){var t=o,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),o=t}function A(n){var t=o;n.__c=n.__(),o=t}function F(n,t){return!n||n.length!==t.length||t.some(function(t,u){return t!==n[u]})}function T(n,t){return"function"==typeof t?t(n):t}n.useState=m,n.useReducer=y,n.useEffect=function(n,i){var r=p(u++,3);!t.options.__s&&F(r.__H,i)&&(r.__=n,r.u=i,o.__H.__h.push(r))},n.useLayoutEffect=s,n.useRef=function(n){return c=5,h(function(){return{current:n}},[])},n.useImperativeHandle=function(n,t,u){c=6,s(function(){return"function"==typeof n?(n(t()),function(){return n(null)}):n?(n.current=t(),function(){return n.current=null}):void 0},null==u?u:u.concat(n))},n.useMemo=h,n.useCallback=function(n,t){return c=8,h(function(){return n},t)},n.useContext=function(n){var t=o.context[n.__c],i=p(u++,9);return i.c=n,t?(null==i.__&&(i.__=!0,t.sub(o)),t.props.value):n.__},n.useDebugValue=function(n,u){t.options.useDebugValue&&t.options.useDebugValue(u?u(n):n)},n.useErrorBoundary=function(n){var t=p(u++,10),i=m();return t.__=n,o.componentDidCatch||(o.componentDidCatch=function(n){t.__&&t.__(n),i[1](n)}),[i[0],function(){i[1](void 0)}]}}); //# sourceMappingURL=hooks.umd.js.map