queez
Version:
A simple Javascript library to create quizz
1 lines • 29.5 kB
JavaScript
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Queez=t()}}(function(){return function t(e,n,r){function o(u,c){if(!n[u]){if(!e[u]){var a="function"==typeof require&&require;if(!c&&a)return a(u,!0);if(i)return i(u,!0);var s=new Error("Cannot find module '"+u+"'");throw s.code="MODULE_NOT_FOUND",s}var f=n[u]={exports:{}};e[u][0].call(f.exports,function(t){var n=e[u][1][t];return o(n||t)},f,f.exports,t,e,n,r)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(t,e,n){"use strict";e.exports=t("./src/queez").default},{"./src/queez":6}],2:[function(t,e,n){(function(t){function n(t,e){return null==t?void 0:t[e]}function r(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function o(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function i(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function u(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function c(t,e){for(var n=t.length;n--;)if(w(t[n][0],e))return n;return-1}function a(t,e){for(var n=0,r=(e=p(e,t)?[e]:l(e)).length;null!=t&&n<r;)t=t[b(e[n++])];return n&&n==r?t:void 0}function s(t){return!(!k(t)||v(t))&&(m(t)||r(t)?K:$).test(g(t))}function f(t){if("string"==typeof t)return t;if(O(t))return nt?nt.call(t):"";var e=t+"";return"0"==e&&1/t==-C?"-0":e}function l(t){return ot(t)?t:rt(t)}function d(t,e){var n=t.__data__;return y(e)?n["string"==typeof e?"string":"hash"]:n.map}function h(t,e){var r=n(t,e);return s(r)?r:void 0}function p(t,e){if(ot(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!O(t))||(x.test(t)||!Q.test(t)||null!=e&&t in Object(e))}function y(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}function v(t){return!!G&&G in t}function b(t){if("string"==typeof t||O(t))return t;var e=t+"";return"0"==e&&1/t==-C?"-0":e}function g(t){if(null!=t){try{return V.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function _(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError(I);var n=function(){var r=arguments,o=e?e.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var u=t.apply(this,r);return n.cache=i.set(o,u),u};return n.cache=new(_.Cache||u),n}function w(t,e){return t===e||t!==t&&e!==e}function m(t){var e=k(t)?J.call(t):"";return e==R||e==S}function k(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function j(t){return!!t&&"object"==typeof t}function O(t){return"symbol"==typeof t||j(t)&&J.call(t)==E}function A(t){return null==t?"":f(t)}var I="Expected a function",T="__lodash_hash_undefined__",C=1/0,R="[object Function]",S="[object GeneratorFunction]",E="[object Symbol]",Q=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,x=/^\w*$/,P=/^\./,M=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,q=/[\\^$.*+?()[\]{}|]/g,z=/\\(\\)?/g,$=/^\[object .+?Constructor\]$/,U="object"==typeof t&&t&&t.Object===Object&&t,F="object"==typeof self&&self&&self.Object===Object&&self,L=U||F||Function("return this")(),B=Array.prototype,D=Function.prototype,N=Object.prototype,W=L["__core-js_shared__"],G=function(){var t=/[^.]+$/.exec(W&&W.keys&&W.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),V=D.toString,H=N.hasOwnProperty,J=N.toString,K=RegExp("^"+V.call(H).replace(q,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),X=L.Symbol,Y=B.splice,Z=h(L,"Map"),tt=h(Object,"create"),et=X?X.prototype:void 0,nt=et?et.toString:void 0;o.prototype.clear=function(){this.__data__=tt?tt(null):{}},o.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},o.prototype.get=function(t){var e=this.__data__;if(tt){var n=e[t];return n===T?void 0:n}return H.call(e,t)?e[t]:void 0},o.prototype.has=function(t){var e=this.__data__;return tt?void 0!==e[t]:H.call(e,t)},o.prototype.set=function(t,e){return this.__data__[t]=tt&&void 0===e?T:e,this},i.prototype.clear=function(){this.__data__=[]},i.prototype.delete=function(t){var e=this.__data__,n=c(e,t);return!(n<0||(n==e.length-1?e.pop():Y.call(e,n,1),0))},i.prototype.get=function(t){var e=this.__data__,n=c(e,t);return n<0?void 0:e[n][1]},i.prototype.has=function(t){return c(this.__data__,t)>-1},i.prototype.set=function(t,e){var n=this.__data__,r=c(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},u.prototype.clear=function(){this.__data__={hash:new o,map:new(Z||i),string:new o}},u.prototype.delete=function(t){return d(this,t).delete(t)},u.prototype.get=function(t){return d(this,t).get(t)},u.prototype.has=function(t){return d(this,t).has(t)},u.prototype.set=function(t,e){return d(this,t).set(t,e),this};var rt=_(function(t){t=A(t);var e=[];return P.test(t)&&e.push(""),t.replace(M,function(t,n,r,o){e.push(r?o.replace(z,"$1"):n||t)}),e});_.Cache=u;var ot=Array.isArray;e.exports=function(t,e,n){var r=null==t?void 0:a(t,e);return void 0===r?n:r}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],3:[function(t,e,n){(function(t){function r(t,e,n,r){for(var o=-1,i=t?t.length:0;++o<i;){var u=t[o];e(r,u,n(u),t)}return r}function o(t,e){for(var n=-1,r=t?t.length:0;++n<r;)if(e(t[n],n,t))return!0;return!1}function i(t){return function(e){return null==e?void 0:e[t]}}function u(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function c(t,e){return null==t?void 0:t[e]}function a(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function s(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function f(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}function l(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function d(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function h(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function p(t){var e=-1,n=t?t.length:0;for(this.__data__=new h;++e<n;)this.add(t[e])}function y(t){this.__data__=new d(t)}function v(t,e){var n=Re(t)||K(t)?u(t.length,String):[],r=n.length,o=!!r;for(var i in t)!e&&!ne.call(t,i)||o&&("length"==i||U(i,r))||n.push(i);return n}function b(t,e){for(var n=t.length;n--;)if(J(t[n][0],e))return n;return-1}function g(t,e,n,r){return Oe(t,function(t,o,i){e(r,t,n(t),i)}),r}function _(t,e){for(var n=0,r=(e=F(e,t)?[e]:E(e)).length;null!=t&&n<r;)t=t[G(e[n++])];return n&&n==r?t:void 0}function w(t,e){return null!=t&&e in Object(t)}function m(t,e,n,r,o){return t===e||(null==t||null==e||!et(t)&&!nt(e)?t!==t&&e!==e:k(t,e,m,n,r,o))}function k(t,e,n,r,o,i){var u=Re(t),c=Re(e),s=gt,f=gt;u||(s=(s=Ie(t))==bt?It:s),c||(f=(f=Ie(e))==bt?It:f);var l=s==It&&!a(t),d=f==It&&!a(e),h=s==f;if(h&&!l)return i||(i=new y),u||Se(t)?Q(t,e,n,r,o,i):x(t,e,s,n,r,o,i);if(!(o&pt)){var p=l&&ne.call(t,"__wrapped__"),v=d&&ne.call(e,"__wrapped__");if(p||v){var b=p?t.value():t,g=v?e.value():e;return i||(i=new y),n(b,g,r,o,i)}}return!!h&&(i||(i=new y),P(t,e,n,r,o,i))}function j(t,e,n,r){var o=n.length,i=o,u=!r;if(null==t)return!i;for(t=Object(t);o--;){var c=n[o];if(u&&c[2]?c[1]!==t[c[0]]:!(c[0]in t))return!1}for(;++o<i;){var a=(c=n[o])[0],s=t[a],f=c[1];if(u&&c[2]){if(void 0===s&&!(a in t))return!1}else{var l=new y;if(r)var d=r(s,f,a,t,e,l);if(!(void 0===d?m(f,s,r,ht|pt,l):d))return!1}}return!0}function O(t){return!(!et(t)||B(t))&&(Z(t)||a(t)?oe:Ut).test(V(t))}function A(t){return"function"==typeof t?t:null==t?at:"object"==typeof t?Re(t)?C(t[0],t[1]):T(t):st(t)}function I(t){if(!D(t))return se(t);var e=[];for(var n in Object(t))ne.call(t,n)&&"constructor"!=n&&e.push(n);return e}function T(t){var e=q(t);return 1==e.length&&e[0][2]?W(e[0][0],e[0][1]):function(n){return n===t||j(n,t,e)}}function C(t,e){return F(t)&&N(e)?W(G(t),e):function(n){var r=it(n,t);return void 0===r&&r===e?ut(n,t):m(e,r,void 0,ht|pt)}}function R(t){return function(e){return _(e,t)}}function S(t){if("string"==typeof t)return t;if(rt(t))return je?je.call(t):"";var e=t+"";return"0"==e&&1/t==-yt?"-0":e}function E(t){return Re(t)?t:Te(t)}function Q(t,e,n,r,i,u){var c=i&pt,a=t.length,s=e.length;if(a!=s&&!(c&&s>a))return!1;var f=u.get(t);if(f&&u.get(e))return f==e;var l=-1,d=!0,h=i&ht?new p:void 0;for(u.set(t,e),u.set(e,t);++l<a;){var y=t[l],v=e[l];if(r)var b=c?r(v,y,l,e,t,u):r(y,v,l,t,e,u);if(void 0!==b){if(b)continue;d=!1;break}if(h){if(!o(e,function(t,e){if(!h.has(e)&&(y===t||n(y,t,r,i,u)))return h.add(e)})){d=!1;break}}else if(y!==v&&!n(y,v,r,i,u)){d=!1;break}}return u.delete(t),u.delete(e),d}function x(t,e,n,r,o,i,u){switch(n){case Qt:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Et:return!(t.byteLength!=e.byteLength||!r(new ue(t),new ue(e)));case _t:case wt:case At:return J(+t,+e);case mt:return t.name==e.name&&t.message==e.message;case Tt:case Rt:return t==e+"";case Ot:var c=s;case Ct:var a=i&pt;if(c||(c=f),t.size!=e.size&&!a)return!1;var l=u.get(t);if(l)return l==e;i|=ht,u.set(t,e);var d=Q(c(t),c(e),r,o,i,u);return u.delete(t),d;case St:if(ke)return ke.call(t)==ke.call(e)}return!1}function P(t,e,n,r,o,i){var u=o&pt,c=ct(t),a=c.length;if(a!=ct(e).length&&!u)return!1;for(var s=a;s--;){var f=c[s];if(!(u?f in e:ne.call(e,f)))return!1}var l=i.get(t);if(l&&i.get(e))return l==e;var d=!0;i.set(t,e),i.set(e,t);for(var h=u;++s<a;){var p=t[f=c[s]],y=e[f];if(r)var v=u?r(y,p,f,e,t,i):r(p,y,f,t,e,i);if(!(void 0===v?p===y||n(p,y,r,o,i):v)){d=!1;break}h||(h="constructor"==f)}if(d&&!h){var b=t.constructor,g=e.constructor;b!=g&&"constructor"in t&&"constructor"in e&&!("function"==typeof b&&b instanceof b&&"function"==typeof g&&g instanceof g)&&(d=!1)}return i.delete(t),i.delete(e),d}function M(t,e){var n=t.__data__;return L(e)?n["string"==typeof e?"string":"hash"]:n.map}function q(t){for(var e=ct(t),n=e.length;n--;){var r=e[n],o=t[r];e[n]=[r,o,N(o)]}return e}function z(t,e){var n=c(t,e);return O(n)?n:void 0}function $(t,e,n){for(var r,o=-1,i=(e=F(e,t)?[e]:E(e)).length;++o<i;){var u=G(e[o]);if(!(r=null!=t&&n(t,u)))break;t=t[u]}return r||!!(i=t?t.length:0)&&tt(i)&&U(u,i)&&(Re(t)||K(t))}function U(t,e){return!!(e=null==e?vt:e)&&("number"==typeof t||Ft.test(t))&&t>-1&&t%1==0&&t<e}function F(t,e){if(Re(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!rt(t))||(Pt.test(t)||!xt.test(t)||null!=e&&t in Object(e))}function L(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}function B(t){return!!te&&te in t}function D(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Yt)}function N(t){return t===t&&!et(t)}function W(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in Object(n)))}}function G(t){if("string"==typeof t||rt(t))return t;var e=t+"";return"0"==e&&1/t==-yt?"-0":e}function V(t){if(null!=t){try{return ee.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function H(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError(lt);var n=function(){var r=arguments,o=e?e.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var u=t.apply(this,r);return n.cache=i.set(o,u),u};return n.cache=new(H.Cache||h),n}function J(t,e){return t===e||t!==t&&e!==e}function K(t){return Y(t)&&ne.call(t,"callee")&&(!ce.call(t,"callee")||re.call(t)==bt)}function X(t){return null!=t&&tt(t.length)&&!Z(t)}function Y(t){return nt(t)&&X(t)}function Z(t){var e=et(t)?re.call(t):"";return e==kt||e==jt}function tt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=vt}function et(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function nt(t){return!!t&&"object"==typeof t}function rt(t){return"symbol"==typeof t||nt(t)&&re.call(t)==St}function ot(t){return null==t?"":S(t)}function it(t,e,n){var r=null==t?void 0:_(t,e);return void 0===r?n:r}function ut(t,e){return null!=t&&$(t,e,w)}function ct(t){return X(t)?v(t):I(t)}function at(t){return t}function st(t){return F(t)?i(G(t)):R(t)}var ft=200,lt="Expected a function",dt="__lodash_hash_undefined__",ht=1,pt=2,yt=1/0,vt=9007199254740991,bt="[object Arguments]",gt="[object Array]",_t="[object Boolean]",wt="[object Date]",mt="[object Error]",kt="[object Function]",jt="[object GeneratorFunction]",Ot="[object Map]",At="[object Number]",It="[object Object]",Tt="[object RegExp]",Ct="[object Set]",Rt="[object String]",St="[object Symbol]",Et="[object ArrayBuffer]",Qt="[object DataView]",xt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Pt=/^\w*$/,Mt=/^\./,qt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,zt=/[\\^$.*+?()[\]{}|]/g,$t=/\\(\\)?/g,Ut=/^\[object .+?Constructor\]$/,Ft=/^(?:0|[1-9]\d*)$/,Lt={};Lt["[object Float32Array]"]=Lt["[object Float64Array]"]=Lt["[object Int8Array]"]=Lt["[object Int16Array]"]=Lt["[object Int32Array]"]=Lt["[object Uint8Array]"]=Lt["[object Uint8ClampedArray]"]=Lt["[object Uint16Array]"]=Lt["[object Uint32Array]"]=!0,Lt[bt]=Lt[gt]=Lt[Et]=Lt[_t]=Lt[Qt]=Lt[wt]=Lt[mt]=Lt[kt]=Lt[Ot]=Lt[At]=Lt[It]=Lt[Tt]=Lt[Ct]=Lt[Rt]=Lt["[object WeakMap]"]=!1;var Bt="object"==typeof t&&t&&t.Object===Object&&t,Dt="object"==typeof self&&self&&self.Object===Object&&self,Nt=Bt||Dt||Function("return this")(),Wt="object"==typeof n&&n&&!n.nodeType&&n,Gt=Wt&&"object"==typeof e&&e&&!e.nodeType&&e,Vt=Gt&&Gt.exports===Wt&&Bt.process,Ht=function(){try{return Vt&&Vt.binding("util")}catch(t){}}(),Jt=Ht&&Ht.isTypedArray,Kt=Array.prototype,Xt=Function.prototype,Yt=Object.prototype,Zt=Nt["__core-js_shared__"],te=function(){var t=/[^.]+$/.exec(Zt&&Zt.keys&&Zt.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),ee=Xt.toString,ne=Yt.hasOwnProperty,re=Yt.toString,oe=RegExp("^"+ee.call(ne).replace(zt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ie=Nt.Symbol,ue=Nt.Uint8Array,ce=Yt.propertyIsEnumerable,ae=Kt.splice,se=function(t,e){return function(n){return t(e(n))}}(Object.keys,Object),fe=z(Nt,"DataView"),le=z(Nt,"Map"),de=z(Nt,"Promise"),he=z(Nt,"Set"),pe=z(Nt,"WeakMap"),ye=z(Object,"create"),ve=V(fe),be=V(le),ge=V(de),_e=V(he),we=V(pe),me=ie?ie.prototype:void 0,ke=me?me.valueOf:void 0,je=me?me.toString:void 0;l.prototype.clear=function(){this.__data__=ye?ye(null):{}},l.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},l.prototype.get=function(t){var e=this.__data__;if(ye){var n=e[t];return n===dt?void 0:n}return ne.call(e,t)?e[t]:void 0},l.prototype.has=function(t){var e=this.__data__;return ye?void 0!==e[t]:ne.call(e,t)},l.prototype.set=function(t,e){return this.__data__[t]=ye&&void 0===e?dt:e,this},d.prototype.clear=function(){this.__data__=[]},d.prototype.delete=function(t){var e=this.__data__,n=b(e,t);return!(n<0||(n==e.length-1?e.pop():ae.call(e,n,1),0))},d.prototype.get=function(t){var e=this.__data__,n=b(e,t);return n<0?void 0:e[n][1]},d.prototype.has=function(t){return b(this.__data__,t)>-1},d.prototype.set=function(t,e){var n=this.__data__,r=b(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},h.prototype.clear=function(){this.__data__={hash:new l,map:new(le||d),string:new l}},h.prototype.delete=function(t){return M(this,t).delete(t)},h.prototype.get=function(t){return M(this,t).get(t)},h.prototype.has=function(t){return M(this,t).has(t)},h.prototype.set=function(t,e){return M(this,t).set(t,e),this},p.prototype.add=p.prototype.push=function(t){return this.__data__.set(t,dt),this},p.prototype.has=function(t){return this.__data__.has(t)},y.prototype.clear=function(){this.__data__=new d},y.prototype.delete=function(t){return this.__data__.delete(t)},y.prototype.get=function(t){return this.__data__.get(t)},y.prototype.has=function(t){return this.__data__.has(t)},y.prototype.set=function(t,e){var n=this.__data__;if(n instanceof d){var r=n.__data__;if(!le||r.length<ft-1)return r.push([t,e]),this;n=this.__data__=new h(r)}return n.set(t,e),this};var Oe=function(t,e){return function(n,r){if(null==n)return n;if(!X(n))return t(n,r);for(var o=n.length,i=e?o:-1,u=Object(n);(e?i--:++i<o)&&!1!==r(u[i],i,u););return n}}(function(t,e){return t&&Ae(t,e,ct)}),Ae=function(t){return function(e,n,r){for(var o=-1,i=Object(e),u=r(e),c=u.length;c--;){var a=u[t?c:++o];if(!1===n(i[a],a,i))break}return e}}(),Ie=function(t){return re.call(t)};(fe&&Ie(new fe(new ArrayBuffer(1)))!=Qt||le&&Ie(new le)!=Ot||de&&"[object Promise]"!=Ie(de.resolve())||he&&Ie(new he)!=Ct||pe&&"[object WeakMap]"!=Ie(new pe))&&(Ie=function(t){var e=re.call(t),n=e==It?t.constructor:void 0,r=n?V(n):void 0;if(r)switch(r){case ve:return Qt;case be:return Ot;case ge:return"[object Promise]";case _e:return Ct;case we:return"[object WeakMap]"}return e});var Te=H(function(t){t=ot(t);var e=[];return Mt.test(t)&&e.push(""),t.replace(qt,function(t,n,r,o){e.push(r?o.replace($t,"$1"):n||t)}),e}),Ce=function(t,e){return function(n,o){var i=Re(n)?r:g,u=e?e():{};return i(n,t,A(o,2),u)}}(function(t,e,n){ne.call(t,n)?t[n].push(e):t[n]=[e]});H.Cache=h;var Re=Array.isArray,Se=Jt?function(t){return function(e){return t(e)}}(Jt):function(t){return nt(t)&&tt(t.length)&&!!Lt[re.call(t)]};e.exports=Ce}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],4:[function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),i=t("./utils"),u=function(){function t(e){var n=this;r(this,t),this.custom={},Object.keys(e).forEach(function(t){switch(t){case"id":(0,i.checkType)(e.id,["integer","string"])&&(n.id=e.id);break;case"content":(0,i.checkType)(e.content,["integer","string"])&&(n.content=e.content);break;case"value":(0,i.checkType)(e.value,["integer","string"])&&(n.value=e.value);break;case"coefficient":(0,i.checkType)(e.coefficient,["integer"])&&(n.coefficient=e.coefficient);break;default:n.custom[t]=e[t]}}),this.id||(this.id=(0,i.getRandomId)()),this.coefficient||(this.coefficient=1),this.value||(this.value="")}return o(t,[{key:"toPropsLess",value:function(){return{id:this.id,content:this.content,custom:this.custom}}}]),t}();n.default=u},{"./utils":9}],5:[function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=t("./utils");n.default=function t(e){var n=this;if(r(this,t),!e.id)throw"An id is required for each category";this.custom={},Object.keys(e).forEach(function(t){switch(t){case"id":(0,o.checkType)(e.id,["integer","string"])&&(n.id=e.id);break;default:n.custom[t]=e[t]}}),this.id||(this.id=(0,o.getRandomId)())}},{"./utils":9}],6:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=r(t("./question")),s=r(t("./result")),f=r(t("./category")),l=r(t("lodash.get")),d=r(t("lodash.groupby")),h=t("./utils"),p=function(){function t(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,t),this.custom={},this.callbacks={onQuestionRespond:[this.checkIfQuizzIsComplete.bind(this)],onQuestionUnRespond:[],onQuizzComplete:[]},Object.keys(n).forEach(function(t){switch(t){case"questions":if((0,h.checkType)(n.questions,["array"])){var r={onQuestionRespond:e.onQuestionRespond.bind(e),onQuestionUnRespond:e.onQuestionUnRespond.bind(e)};e.questions=n.questions.map(function(t){return new a.default(t,r)})}break;case"results":(0,h.checkType)(n.results,["array"])&&(e.results=n.results.map(function(t){return new s.default(t)}));break;case"categories":(0,h.checkType)(n.categories,["array"])&&(e.categories=n.categories.map(function(t){return new f.default(t)}));break;case"callbacks":(0,h.checkType)(n.callbacks,["object"])&&Object.keys(n.callbacks).map(function(t){e.callbacks[t]=[].concat(o(e.callbacks[t]),o(n.callbacks[t]))});break;default:e.custom[t]=n[t]}}),this.questions||(this.questions=[]),this.results||(this.results=[]),this.categories||(this.categories=[])}return c(t,[{key:"getQuestion",value:function(t){return this.questions.find(function(e){return e.id===t})}},{key:"getQuestionsBy",value:function(t,e){return this.questions.filter(function(n){return(0,l.default)(n,t)===e})}},{key:"getQuestionByAnswer",value:function(t){return this.questions.find(function(e){return e.getAnswer(t)})}},{key:"getResult",value:function(t){return this.results.find(function(e){return e.id===t})}},{key:"getResultsBy",value:function(t,e){return this.results.filter(function(n){return(0,l.default)(n,t)===e})}},{key:"getCategory",value:function(t){return this.categories.find(function(e){return e.id===t})}},{key:"getCategoriesBy",value:function(t,e){return this.categories.filter(function(n){return(0,l.default)(n,t)===e})}},{key:"getMaxCategories",value:function(){var t=this,e=[];this.questions.filter(function(t){return t.isAnswered()}).forEach(function(n){var r=t.getCategory(n.categoryId);r?n.answersIds.map(function(t){return n.getAnswer(t)}).forEach(function(t){var n=e.findIndex(function(e){return e.id===r.id&&e.value===t.value});-1===n?e.push({id:r.id,value:t.value,count:t.coefficient}):e[n].count=e[n].count+1*t.coefficient}):console.error("No category with id '"+n.categoryId+"' has been found")});var n=(0,d.default)(e,"id"),r={};return Object.keys(n).forEach(function(t){var e=(0,h.getMaxs)(n[t],"count");e&&(r[t]=e.map(function(t){return t.value}))}),r}},{key:"isComplete",value:function(){return!this.questions.find(function(t){return!t.isAnswered()})}},{key:"getResponse",value:function(){if(!this.results.length)return this.questions.reduce(function(t,e){return[].concat(o(t),[e.toPropsLess()])},[]);var t=this.getMaxCategories();return this.results.filter(function(e){return y(e.filter,t)})}},{key:"onQuestionRespond",value:function(t,e,n){this.callbacks.onQuestionRespond.map(function(r){"function"==typeof r?r(t,e,n):console.error("onQuestionRespond callback is not a function")})}},{key:"onQuestionUnRespond",value:function(t,e,n){this.callbacks.onQuestionUnRespond.map(function(r){"function"==typeof r?r(t,e,n):console.error("onQuestionUnRespond callback is not a function")})}},{key:"onQuizzComplete",value:function(){var t=this;this.callbacks.onQuizzComplete.map(function(e){"function"==typeof e?e(t):console.error("onQuizzComplete callback is not a function")})}},{key:"checkIfQuizzIsComplete",value:function(){this.isComplete()&&this.onQuizzComplete()}}]),t}(),y=function t(e,n){return!!Object.keys(n).length&&(Array.isArray(e)?v(e,n,t):"object"===(void 0===e?"undefined":u(e))&&b(e,n,g))},v=function(t,e,n){return!!t.length&&t.map(function(t){return n(t,e)}).reduce(function(t,e){return e||t})},b=function(t,e,n){var r=Object.keys(t);return!!r.length&&r.map(function(r){return n(t,r,e)}).reduce(function(t,e){return e&&t})},g=function(t,e,n){var r=t[e],o=n[e];return!!o&&(["string","number"].includes(void 0===r?"undefined":u(r))?o.includes(r):Array.isArray(r)?v(r,n,function(t){return"object"===(void 0===t?"undefined":u(t))?b(t,n,function(t,e){return t[e]?o.includes(e):!o.includes(e)}):!!["string","number"].includes(void 0===t?"undefined":u(t))&&o.includes(t)}):"object"===(void 0===r?"undefined":u(r))&&b(r,n,function(t,e){return t[e]?o.includes(e):!o.includes(e)}))};n.default=p},{"./category":5,"./question":7,"./result":8,"./utils":9,"lodash.get":2,"lodash.groupby":3}],7:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),s=t("./utils"),f=r(t("./answer")),l=r(t("lodash.get")),d=function(){function t(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};u(this,t),this.custom={},this.answersIds=[],Object.keys(n).forEach(function(t){switch(t){case"id":(0,s.checkType)(n.id,["integer","string"])&&(e.id=n.id);break;case"answers":(0,s.checkType)(n.answers,["array"])&&(e.answers=n.answers.map(function(t){return new f.default(t)}));break;case"content":(0,s.checkType)(n.content,["integer","string"])&&(e.content=n.content);break;case"categoryId":(0,s.checkType)(n.categoryId,["integer","string"])&&(e.categoryId=n.categoryId);break;case"multiple":(0,s.checkType)(n.multiple,["boolean"])&&(e.multiple=n.multiple);break;default:e.custom[t]=n[t]}}),this.id||(this.id=(0,s.getRandomId)()),this.answers||(this.answers=[]),this.categoryId||(this.categoryId=""),this.multiple||(this.multiple=!1),this.callbacks=Object.keys(r).reduce(function(t,e){return c({},t,i({},e,r[e]))},{})}return a(t,[{key:"getAnswer",value:function(t){return this.answers.find(function(e){return e.id===t})}},{key:"getAnswersBy",value:function(t,e){return this.answers.filter(function(n){return(0,l.default)(n,t)===e})}},{key:"isAnswered",value:function(){return!!this.answersIds.length}},{key:"respond",value:function(t){var e=null;if(this.answers.find(function(e){return e.id===t}))if(this.multiple){if(this.answersIds.includes(t))return;this.answersIds.push(t)}else this.answersIds=[t];else e="Cannot find answer with id "+t+".",console.error(e);this.callbacks.onQuestionRespond(this,this.getAnswer(t),e)}},{key:"unRespond",value:function(t){var e=null,n=this.answersIds.indexOf(t);-1!==n?this.answersIds=[].concat(o(this.answersIds.slice(0,n)),o(this.answersIds.slice(n+1))):(e="Cannot find the answer with id "+t+" in question's ("+this.id+") answered answers",console.error(e)),this.callbacks.onQuestionUnRespond(this,this.getAnswer(t),e)}},{key:"toPropsLess",value:function(){var t=this;return{id:this.id,content:this.content,custom:this.custom,answers:this.answersIds.map(function(e){return t.getAnswer(e).toPropsLess()})}}}]),t}();n.default=d},{"./answer":4,"./utils":9,"lodash.get":2}],8:[function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=t("./utils");n.default=function t(e){var n=this;r(this,t),this.custom={},Object.keys(e).forEach(function(t){switch(t){case"id":(0,o.checkType)(e.id,["integer","string"])&&(n.id=e.id);break;case"filter":(0,o.checkType)(e.filter,["object","array"])&&(n.filter=e.filter);break;case"content":(0,o.checkType)(e.content,["integer","string"])&&(n.content=e.content);break;default:n.custom[t]=e[t]}}),this.id||(this.id=(0,o.getRandomId)()),this.filter||(this.filter={})}},{"./utils":9}],9:[function(t,e,n){"use strict";function r(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}Object.defineProperty(n,"__esModule",{value:!0}),n.getMaxs=n.checkType=n.getRandomId=void 0;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(t){return t&&t.__esModule?t:{default:t}}(t("lodash.get"));n.getRandomId=function(){return Math.random().toString(36).substr(2,9)},n.checkType=function(t,e){return void 0!==t&&null!==t&&e.reduce(function(e,n){switch(n){case"integer":return e||Number.isInteger(t);case"string":return e||"string"==typeof t;case"array":return e||Array.isArray(t);case"object":return e||"object"===(void 0===t?"undefined":o(t));case"boolean":return e||"boolean"==typeof t;default:return e}},!1)},n.getMaxs=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return t.length?t.slice(1).reduce(function(t,n){var o=e?(0,i.default)(n,e):n,u=e?(0,i.default)(t[0],e):t[0];return o>u?[n]:o===u?[].concat(r(t),[n]):t},[t[0]]):null}},{"lodash.get":2}]},{},[1])(1)});