"use strict";varr=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,e=Object.prototype.propertyIsEnumerable;functionn(r){if(null==r)thrownewTypeError("Object.assign cannot be called with null or undefined");returnObject(r)}functiono(){try{if(!Object.assign)return!1;varr=newString("abc");if(r[5]="de","5"===Object.getOwnPropertyNames(r)[0])return!1;for(vart={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(r){returnt[r]}).join(""))return!1;varn={};return"abcdefghijklmnopqrst".split("").forEach(function(r){n[r]=r}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(o){return!1}}module.exports=o()?Object.assign:function(o,c){for(vara,i,s=n(o),f=1;f<arguments.length;f++){for(varuina=Object(arguments[f]))t.call(a,u)&&(s[u]=a[u]);if(r){i=r(a);for(varb=0;b<i.length;b++)e.call(a,i[b])&&(s[i[b]]=a[i[b]])}}returns};
},{}],"awqi":[function(require,module,exports){
"use strict";vare=require("object-assign"),t="function"==typeofSymbol&&Symbol.for,r=t?Symbol.for("react.element"):60103,n=t?Symbol.for("react.portal"):60106,o=t?Symbol.for("react.fragment"):60107,u=t?Symbol.for("react.strict_mode"):60108,l=t?Symbol.for("react.profiler"):60114,f=t?Symbol.for("react.provider"):60109,c=t?Symbol.for("react.context"):60110,i=t?Symbol.for("react.forward_ref"):60112,a=t?Symbol.for("react.suspense"):60113,s=t?Symbol.for("react.suspense_list"):60120,p=t?Symbol.for("react.memo"):60115,y=t?Symbol.for("react.lazy"):60116;t&&Symbol.for("react.fundamental"),t&&Symbol.for("react.responder");vard="function"==typeofSymbol&&Symbol.iterator;functionm(e){for(vart=e.message,r="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)r+="&args[]="+encodeURIComponent(arguments[n]);returne.message="Minified React error #"+t+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",e}varv={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h={};functionb(e,t,r){this.props=e,this.context=t,this.refs=h,this.updater=r||v}functionS(){}function_(e,t,r){this.props=e,this.context=t,this.refs=h,this.updater=r||v}b.prototype.isReactComponent={},b.prototype.setState=function(e,t){if("object"!=typeofe&&"function"!=typeofe&&null!=e)throwm(Error(85));this.updater.enqueueSetState(this,e,t,"setState")},b.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},S.prototype=b.prototype;varg=_.prototype=newS;g.constructor=_,e(g,b.prototype),g.isPureReactComponent=!0;vark={current:null},$={suspense:null},w={current:null},C=Object.prototype.hasOwnProperty,E={key:!0,ref:!0,__self:!0,__source:!0};functionR(e,t,n){varo=void0,u={},l=null,f=null;if(null!=t)for(oinvoid0!==t.ref&&(f=t.ref),void0!==t.key&&(l=""+t.key),t)C.call(t,o)&&!E.hasOwnProperty(o)&&(u[o]=t[o]);varc=arguments.length-2;if(1===c)u.children=n;elseif(1<c){for(vari=Array(c),a=0;a<c;a++)i[a]=arguments[a+2];u.children=i}if(e&&e.defaultProps)for(oinc=e.defaultProps)void0===u[o]&&(u[o]=c[o]);return{$$typeof:r,type:e,key:l,ref:f,props:u,_owner:w.current}}functionx(e,t){return{$$typeof:r,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}functionP(e){return"object"==typeofe&&null!==e&&e.$$typeof===r}functionj(e){vart={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,function(e){returnt[e]})}varO=/\/+/g,A=[];functionI(e,t,r,n){if(A.length){varo=A.pop();returno.result=e,o.keyPrefix=t,o.func=r,o.context=n,o.count=0,o}return{result:e,keyPrefix:t,func:r,context:n,count:0}}functionU(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>A.length&&A.push(e)}functionq(e,t,o,u){varl=typeofe;"undefined"!==l&&"boolean"!==l||(e=null);varf=!1;if(null===e)f=!0;elseswitch(l){case"string":case"number":f=!0;break;case"object":switch(e.$$typeof){caser:casen:f=!0}}if(f)returno(u,e,""===t?"."+F(e,0):t),1;if(f=0,t=""===t?".":t+":",Array.isArray(e))for(varc=0;c<e.length;c++){vari=t+F(l=e[c],c);f+=q(l,i,o,u)}elseif(null===e||"object"!=typeofe?i=null:i="function"==typeof(i=d&&e[d]||e["@@iterator"])?i:null,"function"==typeofi)for(e=i.call(e),c=0;!(l=e.next()).done;)f+=q(l=l.value,i=t+F(l,c++),o,u);elseif("object"===l)throwo=""+e,m(Error(31),"[object Object]"===o?"object with keys {"+Object.keys(e).join(", ")+"}":o,"");returnf}functionL(e,t,r){returnnull==e?0:q(e,"",t,r)}functionF(e,t){return"object"==typeofe&&null!==e&&null!=e.key?j(e.key):t.toString(36)}functionM(e,t){e.func.call(e.context,t,e.count++)}functionD(e,t,r){varn=e.result,o=e.keyPrefix;e=e.func.call(e.context,t,e.count++),Array.isArray(e)?V(e,n,r,function(e){returne}):null!=e&&(P(e)&&(e=x(e,o+(!e.key||t&&t.key===e.key?"":(""+e.key).replace(O,"$&/")+"/")+r)),n.push(e))}functionV(e,t,r,n,o){varu="";null!=r&&(u=(""+r).replace(O,"$&/")+"/"),L(e,D,t=I(t,u,n,o)),U(t)}functionB(){vare=k.current;if(null===e)throwm(Error(321));returne}varN={Children
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});vare=void0,n=void0,t=void0,r=void0,o=void0;if(exports.unstable_now=void0,exports.unstable_forceFrameRate=void0,"undefined"==typeofwindow||"function"!=typeofMessageChannel){vari=null,l=null,u=function(){if(null!==i)try{vare=exports.unstable_now();i(!0,e),i=null}catch(n){throwsetTimeout(u,0),n}};exports.unstable_now=function(){returnDate.now()},e=function(n){null!==i?setTimeout(e,0,n):(i=n,setTimeout(u,0))},n=function(e,n){l=setTimeout(e,n)},t=function(){clearTimeout(l)},r=function(){return!1},o=exports.unstable_forceFrameRate=function(){}}else{vara=window.performance,s=window.Date,c=window.setTimeout,f=window.clearTimeout,p=window.requestAnimationFrame,x=window.cancelAnimationFrame;"undefined"!=typeofconsole&&("function"!=typeofp&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!=typeofx&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")),exports.unstable_now="object"==typeofa&&"function"==typeofa.now?function(){returna.now()}:function(){returns.now()};varv=!1,b=null,w=-1,m=-1,d=33.33,y=-1,_=-1,h=0,T=!1;r=function(){returnexports.unstable_now()>=h},o=function(){},exports.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing framerates higher than 125 fps is not unsupported"):0<e?(d=Math.floor(1e3/e),T=!0):(d=33.33,T=!1)};vark=function(){if(null!==b){vare=exports.unstable_now(),n=0<h-e;try{b(n,e)||(b=null)}catch(t){throwF.postMessage(null),t}}},g=newMessageChannel,F=g.port2;g.port1.onmessage=k;varP=function(e){if(null===b)_=y=-1,v=!1;else{v=!0,p(function(e){f(w),P(e)});varn=function(){h=exports.unstable_now()+d/2,k(),w=c(n,3*d)};if(w=c(n,3*d),-1!==y&&.1<e-y){vart=e-y;!T&&-1!==_&&t<d&&_<d&&(8.33>(d=t<_?_:t)&&(d=8.33)),_=t}y=e,h=e+d,F.postMessage(null)}};e=function(e){b=e,v||(v=!0,p(function(e){P(e)}))},n=function(e,n){m=c(function(){e(exports.unstable_now())},n)},t=function(){f(m),m=-1}}varM=null,C=null,A=null,L=3,R=!1,j=!1,q=!1;functionD(e,n){vart=e.next;if(t===e)M=null;else{e===M&&(M=t);varr=e.previous;r.next=t,t.previous=r}e.next=e.previous=null,t=e.callback,r=L;varo=A;L=e.priorityLevel,A=e;try{vari=e.expirationTime<=n;switch(L){case1:varl=t(i);break;case2:case3:case4:l=t(i);break;case5:l=t(i)}}catch(u){throwu}finally{L=r,A=o}if("function"==typeofl)if(n=e.expirationTime,e.callback=l,null===M)M=e.next=e.previous=e;else{l=null,i=M;do{if(n<=i.expirationTime){l=i;break}i=i.next}while(i!==M);null===l?l=M:l===M&&(M=e),(n=l.previous).next=l.previous=e,e.next=l,e.previous=n}}functionE(e){if(null!==C&&C.startTime<=e)do{varn=C,t=n.next;if(n===t)C=null;else{C=t;varr=n.previous;r.next=t,t.previous=r}n.next=n.previous=null,O(n,n.expirationTime)}while(null!==C&&C.startTime<=e)}functionI(t){q=!1,E(t),j||(null!==M?(j=!0,e(N)):null!==C&&n(I,C.startTime-t))}functionN(e,o){j=!1,q&&(q=!1,t()),E(o),R=!0;try{if(e){if(null!==M)do{D(M,o),E(o=exports.unstable_now())}while(null!==M&&!r())}elsefor(;null!==M&&M.expirationTime<=o;)D(M,o),E(o=exports.unstable_now());returnnull!==M||(null!==C&&n(I,C.startTime-o),!1)}finally{R=!1}}functionB(e){switch(e){case1:return-1;case2:return250;case5:return1073741823;case4:return1e4;default:return5e3}}functionO(e,n){if(null===M)M=e.next=e.previous=e;else{vart=null,r=M;do{if(n<r.expirationTime){t=r;break}r=r.next}while(r!==M);null===t?t=M:t===M&&(M=e),(n=t.previous).next=t.previous=e,e.next=t,e.previous=n}}varU=o;exports.unstable_ImmediatePriority=1,exports.unstable_UserBlockingPriority=2,exports.unstable_NormalPriority=3,exports.unstable_IdlePriority=5,exports.unstable_LowPriority=4,exports.unstable_runWithPriority=function(e,n){switch(e){case1:case2:case3:case4:case5:break;default:e=3}vart=L;L=e;try{returnn()}finally{L=t}},exports.unstable_next=function(e){switch(L){case1:case2:case3:varn
"use strict";vare=require("react"),t=require("object-assign"),n=require("scheduler");functionr(e){for(vart=e.message,n="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r<arguments.length;r++)n+="&args[]="+encodeURIComponent(arguments[r]);returne.message="Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",e}if(!e)throwr(Error(227));varl=null,i={};functiona(){if(l)for(vareini){vart=i[e],n=l.indexOf(e);if(!(-1<n))throwr(Error(96),e);if(!u[n]){if(!t.extractEvents)throwr(Error(97),e);for(varainu[n]=t,n=t.eventTypes){vars=void0,f=n[a],d=t,p=a;if(c.hasOwnProperty(p))throwr(Error(99),p);c[p]=f;varh=f.phasedRegistrationNames;if(h){for(sinh)h.hasOwnProperty(s)&&o(h[s],d,p);s=!0}elsef.registrationName?(o(f.registrationName,d,p),s=!0):s=!1;if(!s)throwr(Error(98),a,e)}}}}functiono(e,t,n){if(s[e])throwr(Error(100),e);s[e]=t,f[e]=t.eventTypes[n].dependencies}varu=[],c={},s={},f={};functiond(e,t,n,r,l,i,a,o,u){varc=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(s){this.onError(s)}}varp=!1,h=null,m=!1,g=null,v={onError:function(e){p=!0,h=e}};functiony(e,t,n,r,l,i,a,o,u){p=!1,h=null,d.apply(v,arguments)}functionb(e,t,n,l,i,a,o,u,c){if(y.apply(this,arguments),p){if(!p)throwr(Error(198));vars=h;p=!1,h=null,m||(m=!0,g=s)}}varw=null,k=null,E=null;functionx(e,t,n){varr=e.type||"unknown-event";e.currentTarget=E(n),b(r,t,void0,e),e.currentTarget=null}functionT(e,t){if(null==t)throwr(Error(30));returnnull==e?t:Array.isArray(e)?Array.isArray(t)?(e.push.apply(e,t),e):(e.push(t),e):Array.isArray(t)?[e].concat(t):[e,t]}functionC(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)}varS=null;function_(e){if(e){vart=e._dispatchListeners,n=e._dispatchInstances;if(Array.isArray(t))for(varr=0;r<t.length&&!e.isPropagationStopped();r++)x(e,t[r],n[r]);elset&&x(e,t,n);e._dispatchListeners=null,e._dispatchInstances=null,e.isPersistent()||e.constructor.release(e)}}functionP(e){if(null!==e&&(S=T(S,e)),e=S,S=null,e){if(C(e,_),S)throwr(Error(95));if(m)throwe=g,m=!1,g=null,e}}varN={injectEventPluginOrder:function(e){if(l)throwr(Error(101));l=Array.prototype.slice.call(e),a()},injectEventPluginsByName:function(e){vart,n=!1;for(tine)if(e.hasOwnProperty(t)){varl=e[t];if(!i.hasOwnProperty(t)||i[t]!==l){if(i[t])throwr(Error(102),t);i[t]=l,n=!0}}n&&a()}};functionz(e,t){varn=e.stateNode;if(!n)returnnull;varl=w(n);if(!l)returnnull;n=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":(l=!l.disabled)||(l=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!l;breake;default:e=!1}if(e)returnnull;if(n&&"function"!=typeofn)throwr(Error(231),t,typeofn);returnn}varM=Math.random().toString(36).slice(2),U="__reactInternalInstance$"+M,R="__reactEventHandlers$"+M;functionF(e){if(e[U])returne[U];for(;!e[U];){if(!e.parentNode)returnnull;e=e.parentNode}return5===(e=e[U]).tag||6===e.tag?e:null}functionI(e){return!(e=e[U])||5!==e.tag&&6!==e.tag?null:e}functionD(e){if(5===e.tag||6===e.tag)returne.stateNode;throwr(Error(33))}functionO(e){returne[R]||null}functionL(e){do{e=e.return}while(e&&5!==e.tag);returne||null}functionA(e,t,n){(t=z(e,n.dispatchConfig.phasedRegistrationNames[t]))&&(n._dispatchListeners=T(n._dispatchListeners,t),n._dispatchInstances=T(n._dispatchInstances,e))}functionW(e){if(e&&e.dispatchConfig.phasedRegistrationNames){for(vart=e._targetInst,n=[];t;)n.push(t),t=L(t);for(t=n.length;0<t--;)A(n[t],"captured",e);for(t=0;t<n.length;t++)A(n[t],"bubbled",e)}}functionV(e,t,n){e&&n&&n.dispatchConfig.registrationName&&(t=z(e,n.dispatchConfig.registrationName))&&(n._dispatchListeners=T(n._dispatchListeners,t),n._dispatchInstances=T(n._dispatchInstances,e))}functionB(e){e&&e.dispatchConfig.registrationName&&V(e._targetInst,null,e)}functionj(e){C(e,W)}varH=!("undefined"==typeofw
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});conste=require("react");functiont(e){return"Object"===e.constructor.name}exports.HTMLInputExtractor=(e=>e.currentTarget.value),exports.HTMLCheckboxExtractor=(e=>e.currentTarget.checked);constr=e=>`Error in ${e}`;exports.useForm=((s,c={},n={})=>{const[o,a]=e.useState(s),[u,i]=e.useState({}),[g,x]=e.useState(!0);e.useEffect(()=>{x(!Object.values(u).reduce((e,t)=>e||void0!==t,!1))},[u]);constm=async(e,r)=>{consts=t(r)?r.validator:r;return"Function"===s.constructor.name?s(e):"AsyncFunction"===s.constructor.name?awaits(e):"RegExp"===s.constructor.name&&s.test(e)},d=(e,s=n.extractor)=>n=>{constg=s?s(n):exports.HTMLInputExtractor(n);((e,t)=>{a(Object.assign(Object.assign({},o),{[e]:t}))})(e,g),((e,s)=>{constn=c[e];n&&(Array.isArray(n)?Promise.all(n.map(e=>m(s,e))).then(s=>{constc=s.indexOf(!1);i(Object.assign(Object.assign({},u),{[e]:-1===c?void0:t(n[c])&&n[c].message?n[c].message:r(e)}))}):m(s,n).then(s=>{i(Object.assign(Object.assign({},u),{[e]:s?void0:t(n)&&n.message?n.message:r(e)}))}))})(e,g)};return{form:o,update:d,auto:(e,t={})=>({[t.getter||n.getter||"onChange"]:d(e,t.extractor),[t.setter||n.setter||"value"]:o[e]}),errors:u,isValid:g}});
"use strict";vare=this&&this.__importDefault||function(e){returne&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});constt=e(require("react")),a=e(require("react-dom")),r=require("../"),s=()=>{const{auto:e,form:a,errors:s,isValid:l}=r.useForm({username:"",email:"",password:""},{username:e=>e.length>3,email:{validator:/@/,message:"Must contain an @"},password:[{validator:/[A-Z]/,message:"Must contain an uppercase letter"},{validator:/[\d]/,message:"Must contain a digit"}]});returnt.default.createElement("form",{onSubmit:e=>{e.preventDefault(),l&&console.log(a)}},t.default.createElement("h1",null,"Errors & Validation"),t.default.createElement("input",Object.assign({},e("username"),{placeholder:"Username"})),s.username&&"Must be longer than 3",t.default.createElement("input",Object.assign({},e("email"),{placeholder:"EMail"})),s.email,t.default.createElement("input",Object.assign({},e("password"),{placeholder:"Password",type:"password"})),s.password,t.default.createElement("input",{type:"submit"}))};a.default.render(t.default.createElement(s,null),document.getElementById("errors"));