@aws-amplify/datastore 3.7.9-unstable.1 → 3.7.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/aws-amplify-datastore.js +47 -7
- package/dist/aws-amplify-datastore.js.map +1 -1
- package/dist/aws-amplify-datastore.min.js +2 -2
- package/dist/aws-amplify-datastore.min.js.map +1 -1
- package/lib/sync/processors/mutation.d.ts +17 -0
- package/lib/sync/processors/mutation.js +27 -2
- package/lib/sync/processors/mutation.js.map +1 -1
- package/lib-esm/sync/processors/mutation.d.ts +17 -0
- package/lib-esm/sync/processors/mutation.js +28 -3
- package/lib-esm/sync/processors/mutation.js.map +1 -1
- package/package.json +7 -7
- package/src/sync/processors/mutation.ts +58 -27
|
@@ -74,7 +74,7 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
74
74
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
75
75
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
76
76
|
PERFORMANCE OF THIS SOFTWARE.
|
|
77
|
-
***************************************************************************** */():r,e=c,d&&Promise.resolve(i.setItem(d,e)).catch((function(){})),l.label=7;case 7:return[2,(h=ft({client:o,customRoleArn:s,logins:u,identityId:e}))()]}}))}))};return function(){return h().catch((function(e){return Object(l.__awaiter)(t,void 0,void 0,(function(){return Object(l.__generator)(this,(function(t){throw d&&Promise.resolve(i.removeItem(d)).catch((function(){})),e}))}))}))}}var yt=function(e,t){return(yt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function gt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}yt(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var mt=function(){return(mt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function bt(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function wt(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}Object.create;function St(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}Object.create;var _t=n(77),Et=n(75),At=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,Ot)},Ot=function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()};for(var It=function(){function e(e){var t=(void 0===e?{}:e).requestTimeout;this.requestTimeout=t}return e.prototype.destroy=function(){},e.prototype.handle=function(e,t){var n=(void 0===t?{}:t).abortSignal,r=this.requestTimeout;if(null==n?void 0:n.aborted){var i=new Error("Request aborted");return i.name="AbortError",Promise.reject(i)}var o=e.path;if(e.query){var s=function(e){var t,n,r=[];try{for(var i=Object(l.__values)(Object.keys(e).sort()),o=i.next();!o.done;o=i.next()){var s=o.value,a=e[s];if(s=At(s),Array.isArray(a))for(var u=0,c=a.length;u<c;u++)r.push(s+"="+At(a[u]));else{var f=s;(a||"string"==typeof a)&&(f+="="+At(a)),r.push(f)}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r.join("&")}(e.query);s&&(o+="?"+s)}var a=e.port,u=e.method,c=e.protocol+"//"+e.hostname+(a?":"+a:"")+o,f={body:"GET"===u||"HEAD"===u?void 0:e.body,headers:new Headers(e.headers),method:u};"undefined"!=typeof AbortController&&(f.signal=n);var d,h=new Request(c,f),p=[fetch(h).then((function(e){var t,n,r=e.headers,i={};try{for(var o=Object(l.__values)(r.entries()),s=o.next();!s.done;s=o.next()){var a=s.value;i[a[0]]=a[1]}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return void 0!==e.body?{response:new we({headers:i,statusCode:e.status,body:e.body})}:e.blob().then((function(t){return{response:new we({headers:i,statusCode:e.status,body:t})}}))})),(d=r,void 0===d&&(d=0),new Promise((function(e,t){d&&setTimeout((function(){var e=new Error("Request did not complete within "+d+" ms");e.name="TimeoutError",t(e)}),d)})))];return n&&p.push(new Promise((function(e,t){n.onabort=function(){var e=new Error("Request aborted");e.name="AbortError",t(e)}}))),Promise.race(p)},e}(),Tt={},Ct=new Array(64),xt=0,Pt="A".charCodeAt(0),kt="Z".charCodeAt(0);xt+Pt<=kt;xt++){var Nt=String.fromCharCode(xt+Pt);Tt[Nt]=xt,Ct[xt]=Nt}for(xt=0,Pt="a".charCodeAt(0),kt="z".charCodeAt(0);xt+Pt<=kt;xt++){Nt=String.fromCharCode(xt+Pt);var Mt=xt+26;Tt[Nt]=Mt,Ct[Mt]=Nt}for(xt=0;xt<10;xt++){Tt[xt.toString(10)]=xt+52;Nt=xt.toString(10),Mt=xt+52;Tt[Nt]=Mt,Ct[Mt]=Nt}Tt["+"]=62,Ct[62]="+",Tt["/"]=63,Ct[63]="/";function jt(e){var t=e.length/4*3;"=="===e.substr(-2)?t-=2:"="===e.substr(-1)&&t--;for(var n=new ArrayBuffer(t),r=new DataView(n),i=0;i<e.length;i+=4){for(var o=0,s=0,a=i,u=i+3;a<=u;a++)"="!==e[a]?(o|=Tt[e[a]]<<6*(u-a),s+=6):o>>=6;var c=i/4*3;o>>=s%8;for(var l=Math.floor(s/8),f=0;f<l;f++){var d=8*(l-f-1);r.setUint8(c+f,(o&255<<d)>>d)}}return new Uint8Array(n)}function Rt(e){return new Promise((function(t,n){var r=new FileReader;r.onloadend=function(){var e;if(2!==r.readyState)return n(new Error("Reader aborted too early"));var i=null!==(e=r.result)&&void 0!==e?e:"",o=i.indexOf(","),s=o>-1?o+1:i.length;t(i.substring(s))},r.onabort=function(){return n(new Error("Read aborted"))},r.onerror=function(){return n(r.error)},r.readAsDataURL(e)}))}var Dt={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},Ut=function(e){return{applyToStack:function(t){t.add(function(e){return function(t,n){return function(r){return Object(l.__awaiter)(void 0,void 0,void 0,(function(){var i;return Object(l.__generator)(this,(function(o){return(null===(i=null==e?void 0:e.retryStrategy)||void 0===i?void 0:i.mode)&&(n.userAgent=Object(l.__spread)(n.userAgent||[],[["cfg/retry-mode",e.retryStrategy.mode]])),[2,e.retryStrategy.retry(t,r)]}))}))}}}(e),Dt)}}},Ft=["AuthFailure","InvalidSignatureException","RequestExpired","RequestInTheFuture","RequestTimeTooSkewed","SignatureDoesNotMatch"],Lt=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],Bt=["AbortError","TimeoutError","RequestTimeout","RequestTimeoutException"],qt=[500,502,503,504],zt=function(e){var t,n;return 429===(null===(t=e.$metadata)||void 0===t?void 0:t.httpStatusCode)||Lt.includes(e.name)||1==(null===(n=e.$retryable)||void 0===n?void 0:n.throttling)},Kt=n(74),Vt=function(e,t){return Math.floor(Math.min(2e4,Math.random()*Math.pow(2,t)*e))},Ht=function(e){return!!e&&(function(e){return void 0!==e.$retryable}(e)||function(e){return Ft.includes(e.name)}(e)||zt(e)||function(e){var t;return Bt.includes(e.name)||qt.includes((null===(t=e.$metadata)||void 0===t?void 0:t.httpStatusCode)||0)}(e))},Gt=function(){function e(e,t){var n,r,i,o,s,a,u,c;this.maxAttemptsProvider=e,this.mode="standard",this.retryDecider=null!==(n=null==t?void 0:t.retryDecider)&&void 0!==n?n:Ht,this.delayDecider=null!==(r=null==t?void 0:t.delayDecider)&&void 0!==r?r:Vt,this.retryQuota=null!==(i=null==t?void 0:t.retryQuota)&&void 0!==i?i:(s=o=500,a=o,u=function(e){return"TimeoutError"===e.name?10:5},c=function(e){return u(e)<=a},Object.freeze({hasRetryTokens:c,retrieveRetryTokens:function(e){if(!c(e))throw new Error("No retry token available");var t=u(e);return a-=t,t},releaseRetryTokens:function(e){a+=null!=e?e:1,a=Math.min(a,s)}}))}return e.prototype.shouldRetry=function(e,t,n){return t<n&&this.retryDecider(e)&&this.retryQuota.hasRetryTokens(e)},e.prototype.getMaxAttempts=function(){return Object(l.__awaiter)(this,void 0,void 0,(function(){var e;return Object(l.__generator)(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.maxAttemptsProvider()];case 1:return e=t.sent(),[3,3];case 2:return t.sent(),e=3,[3,3];case 3:return[2,e]}}))}))},e.prototype.retry=function(e,t){return Object(l.__awaiter)(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c;return Object(l.__generator)(this,(function(f){switch(f.label){case 0:return r=0,i=0,[4,this.getMaxAttempts()];case 1:o=f.sent(),s=t.request,Se.isInstance(s)&&(s.headers["amz-sdk-invocation-id"]=Object(Kt.v4)()),a=function(){var a,c,f,d,h;return Object(l.__generator)(this,(function(l){switch(l.label){case 0:return l.trys.push([0,2,,5]),Se.isInstance(s)&&(s.headers["amz-sdk-request"]="attempt="+(r+1)+"; max="+o),[4,e(t)];case 1:return a=l.sent(),c=a.response,f=a.output,u.retryQuota.releaseRetryTokens(n),f.$metadata.attempts=r+1,f.$metadata.totalRetryDelay=i,[2,{value:{response:c,output:f}}];case 2:return d=l.sent(),r++,u.shouldRetry(d,r,o)?(n=u.retryQuota.retrieveRetryTokens(d),h=u.delayDecider(zt(d)?500:100,r),i+=h,[4,new Promise((function(e){return setTimeout(e,h)}))]):[3,4];case 3:return l.sent(),[2,"continue"];case 4:throw d.$metadata||(d.$metadata={}),d.$metadata.attempts=r,d.$metadata.totalRetryDelay=i,d;case 5:return[2]}}))},u=this,f.label=2;case 2:return[5,a()];case 3:return"object"==typeof(c=f.sent())?[2,c.value]:[3,2];case 4:return[2]}}))}))},e}(),Wt=function(e){if(void 0===e&&(e=3),"number"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};var Yt=n(76),Jt=n.n(Yt),$t=n(35),Zt="cognito-identity.{region}.amazonaws.com",Qt=new Set(["af-south-1","ap-east-1","ap-northeast-1","ap-northeast-2","ap-south-1","ap-southeast-1","ap-southeast-2","ca-central-1","eu-central-1","eu-north-1","eu-south-1","eu-west-1","eu-west-2","eu-west-3","me-south-1","sa-east-1","us-east-1","us-east-2","us-west-1","us-west-2"]),Xt=new Set(["cn-north-1","cn-northwest-1"]),en=new Set(["us-iso-east-1"]),tn=new Set(["us-isob-east-1"]),nn=new Set(["us-gov-east-1","us-gov-west-1"]);var rn,on,sn,an,un={apiVersion:"2014-06-30",disableHostPrefix:!1,logger:{},regionInfoProvider:function(e,t){var n=void 0;switch(e){case"ap-northeast-1":n={hostname:"cognito-identity.ap-northeast-1.amazonaws.com",partition:"aws"};break;case"ap-northeast-2":n={hostname:"cognito-identity.ap-northeast-2.amazonaws.com",partition:"aws"};break;case"ap-south-1":n={hostname:"cognito-identity.ap-south-1.amazonaws.com",partition:"aws"};break;case"ap-southeast-1":n={hostname:"cognito-identity.ap-southeast-1.amazonaws.com",partition:"aws"};break;case"ap-southeast-2":n={hostname:"cognito-identity.ap-southeast-2.amazonaws.com",partition:"aws"};break;case"ca-central-1":n={hostname:"cognito-identity.ca-central-1.amazonaws.com",partition:"aws"};break;case"cn-north-1":n={hostname:"cognito-identity.cn-north-1.amazonaws.com.cn",partition:"aws-cn"};break;case"eu-central-1":n={hostname:"cognito-identity.eu-central-1.amazonaws.com",partition:"aws"};break;case"eu-north-1":n={hostname:"cognito-identity.eu-north-1.amazonaws.com",partition:"aws"};break;case"eu-west-1":n={hostname:"cognito-identity.eu-west-1.amazonaws.com",partition:"aws"};break;case"eu-west-2":n={hostname:"cognito-identity.eu-west-2.amazonaws.com",partition:"aws"};break;case"eu-west-3":n={hostname:"cognito-identity.eu-west-3.amazonaws.com",partition:"aws"};break;case"fips-us-east-1":n={hostname:"cognito-identity-fips.us-east-1.amazonaws.com",partition:"aws",signingRegion:"us-east-1"};break;case"fips-us-east-2":n={hostname:"cognito-identity-fips.us-east-2.amazonaws.com",partition:"aws",signingRegion:"us-east-2"};break;case"fips-us-gov-west-1":n={hostname:"cognito-identity-fips.us-gov-west-1.amazonaws.com",partition:"aws-us-gov",signingRegion:"us-gov-west-1"};break;case"fips-us-west-2":n={hostname:"cognito-identity-fips.us-west-2.amazonaws.com",partition:"aws",signingRegion:"us-west-2"};break;case"sa-east-1":n={hostname:"cognito-identity.sa-east-1.amazonaws.com",partition:"aws"};break;case"us-east-1":n={hostname:"cognito-identity.us-east-1.amazonaws.com",partition:"aws"};break;case"us-east-2":n={hostname:"cognito-identity.us-east-2.amazonaws.com",partition:"aws"};break;case"us-gov-west-1":n={hostname:"cognito-identity.us-gov-west-1.amazonaws.com",partition:"aws-us-gov"};break;case"us-west-1":n={hostname:"cognito-identity.us-west-1.amazonaws.com",partition:"aws"};break;case"us-west-2":n={hostname:"cognito-identity.us-west-2.amazonaws.com",partition:"aws"};break;default:Qt.has(e)&&(n={hostname:Zt.replace("{region}",e),partition:"aws"}),Xt.has(e)&&(n={hostname:"cognito-identity.{region}.amazonaws.com.cn".replace("{region}",e),partition:"aws-cn"}),en.has(e)&&(n={hostname:"cognito-identity.{region}.c2s.ic.gov".replace("{region}",e),partition:"aws-iso"}),tn.has(e)&&(n={hostname:"cognito-identity.{region}.sc2s.sgov.gov".replace("{region}",e),partition:"aws-iso-b"}),nn.has(e)&&(n={hostname:"cognito-identity.{region}.amazonaws.com".replace("{region}",e),partition:"aws-us-gov"}),void 0===n&&(n={hostname:Zt.replace("{region}",e),partition:"aws"})}return Promise.resolve(mt({signingService:"cognito-identity"},n))},serviceId:"Cognito Identity",urlParser:function(e){var t,n=new URL(e),r=n.hostname,i=n.pathname,o=n.port,s=n.protocol,a=n.search;return a&&(t=function(e){var t,n,r={};if(e=e.replace(/^\?/,""))try{for(var i=Object(l.__values)(e.split("&")),o=i.next();!o.done;o=i.next()){var s=o.value,a=Object(l.__read)(s.split("="),2),u=a[0],c=a[1],f=void 0===c?null:c;u=decodeURIComponent(u),f&&(f=decodeURIComponent(f)),u in r?Array.isArray(r[u])?r[u].push(f):r[u]=[r[u],f]:r[u]=f}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r}(a)),{hostname:r,port:o?parseInt(o):void 0,protocol:s,path:i,query:t}}},cn=mt(mt({},un),{runtime:"browser",base64Decoder:jt,base64Encoder:function(e){for(var t="",n=0;n<e.length;n+=3){for(var r=0,i=0,o=n,s=Math.min(n+3,e.length);o<s;o++)r|=e[o]<<8*(s-o-1),i+=8;var a=Math.ceil(i/6);r<<=6*a-i;for(var u=1;u<=a;u++){var c=6*(a-u);t+=Ct[(r&63<<c)>>c]}t+="==".slice(0,4-a)}return t},bodyLengthChecker:function(e){if("string"==typeof e){for(var t=e.length,n=t-1;n>=0;n--){var r=e.charCodeAt(n);r>127&&r<=2047?t++:r>2047&&r<=65535&&(t+=2)}return t}return"number"==typeof e.byteLength?e.byteLength:"number"==typeof e.size?e.size:void 0},credentialDefaultProvider:function(e){return function(){return Promise.reject(new Error("Credential is missing"))}},defaultUserAgentProvider:(on={serviceId:un.serviceId,clientVersion:_t.version},sn=on.serviceId,an=on.clientVersion,function(){return Object(l.__awaiter)(void 0,void 0,void 0,(function(){var e,t,n,r,i,o,s,a,u;return Object(l.__generator)(this,(function(c){return e=(null===(n=null===window||void 0===window?void 0:window.navigator)||void 0===n?void 0:n.userAgent)?Jt.a.parse(window.navigator.userAgent):void 0,t=[["aws-sdk-js",an],["os/"+((null===(r=null==e?void 0:e.os)||void 0===r?void 0:r.name)||"other"),null===(i=null==e?void 0:e.os)||void 0===i?void 0:i.version],["lang/js"],["md/browser",(null!==(s=null===(o=null==e?void 0:e.browser)||void 0===o?void 0:o.name)&&void 0!==s?s:"unknown")+"_"+(null!==(u=null===(a=null==e?void 0:e.browser)||void 0===a?void 0:a.version)&&void 0!==u?u:"unknown")]],sn&&t.push(["api/"+sn,an]),[2,t]}))}))}),maxAttempts:3,region:(rn="Region is missing",function(){return Promise.reject(rn)}),requestHandler:new It,sha256:Et.Sha256,streamCollector:function(e){return"function"==typeof Blob&&e instanceof Blob?function(e){return Object(l.__awaiter)(this,void 0,void 0,(function(){var t,n;return Object(l.__generator)(this,(function(r){switch(r.label){case 0:return[4,Rt(e)];case 1:return t=r.sent(),n=jt(t),[2,new Uint8Array(n)]}}))}))}(e):function(e){return Object(l.__awaiter)(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return Object(l.__generator)(this,(function(u){switch(u.label){case 0:t=new Uint8Array(0),n=e.getReader(),r=!1,u.label=1;case 1:return r?[3,3]:[4,n.read()];case 2:return i=u.sent(),o=i.done,(s=i.value)&&(a=t,(t=new Uint8Array(a.length+s.length)).set(a),t.set(s,a.length)),r=o,[3,1];case 3:return[2,t]}}))}))}(e)},utf8Decoder:$t.fromUtf8,utf8Encoder:$t.toUtf8}),ln=function(e){var t=e.endpoint,n=e.urlParser;if("string"==typeof t){var r=Promise.resolve(n(t));return function(){return r}}if("object"==typeof t){var i=Promise.resolve(t);return function(){return i}}return t},fn=function(e){return Object(l.__awaiter)(void 0,void 0,void 0,(function(){var t,n,r,i,o;return Object(l.__generator)(this,(function(s){switch(s.label){case 0:return t=e.tls,n=void 0===t||t,[4,e.region()];case 1:if(r=s.sent(),!new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/).test(r))throw new Error("Invalid region in client config");return[4,e.regionInfoProvider(r)];case 2:if(!(i=(null!==(o=s.sent())&&void 0!==o?o:{}).hostname))throw new Error("Cannot resolve hostname from client config");return[2,e.urlParser((n?"https:":"http:")+"//"+i)]}}))}))},dn=function(e){if("string"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};var hn={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},pn=function(e){return{applyToStack:function(t){t.add(function(e){var t=this;return function(n){return function(r){return Object(l.__awaiter)(t,void 0,void 0,(function(){var t,i,o,s,a;return Object(l.__generator)(this,(function(u){return t=r.request,Se.isInstance(t)&&(i=t.body,o=t.headers,i&&-1===Object.keys(o).map((function(e){return e.toLowerCase()})).indexOf("content-length")&&void 0!==(s=e(i))&&(t.headers=Object(l.__assign)(Object(l.__assign)({},t.headers),((a={})["content-length"]=String(s),a)))),[2,n(Object(l.__assign)(Object(l.__assign)({},r),{request:t}))]}))}))}}}(e.bodyLengthChecker),hn)}}};for(var vn={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},yn=function(e){return{applyToStack:function(t){t.add(function(e){return function(t){return function(n){return Object(l.__awaiter)(void 0,void 0,void 0,(function(){var r,i;return Object(l.__generator)(this,(function(o){return Se.isInstance(n.request)?(r=n.request,i=(e.requestHandler.metadata||{}).handlerProtocol,(void 0===i?"":i).indexOf("h2")>=0&&!r.headers[":authority"]?(delete r.headers.host,r.headers[":authority"]=""):r.headers.host||(r.headers.host=r.hostname),[2,t(n)]):[2,t(n)]}))}))}}}(e),vn)}}},gn={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},mn=function(e){return{applyToStack:function(e){e.add((function(e,t){return function(n){return Object(l.__awaiter)(void 0,void 0,void 0,(function(){var r,i,o,s,a,u,c,f,d;return Object(l.__generator)(this,(function(h){switch(h.label){case 0:return r=t.clientName,i=t.commandName,o=t.inputFilterSensitiveLog,s=t.logger,a=t.outputFilterSensitiveLog,[4,e(n)];case 1:return u=h.sent(),s?("function"==typeof s.info&&(c=u.output,f=c.$metadata,d=Object(l.__rest)(c,["$metadata"]),s.info({clientName:r,commandName:i,input:o(n.input),output:a(d),metadata:f})),[2,u]):[2,u]}}))}))}}),gn)}}},bn={},wn={},Sn=0;Sn<256;Sn++){var _n=Sn.toString(16).toLowerCase();1===_n.length&&(_n="0"+_n),bn[Sn]=_n,wn[_n]=Sn}function En(e){for(var t="",n=0;n<e.byteLength;n++)t+=bn[e[n]];return t}var An="X-Amz-Date".toLowerCase(),On=["authorization",An,"date"],In="X-Amz-Signature".toLowerCase(),Tn="X-Amz-Security-Token".toLowerCase(),Cn={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},xn=/^proxy-/,Pn=/^sec-/,kn="AWS4-HMAC-SHA256-PAYLOAD",Nn={},Mn=[];function jn(e,t,n){return e+"/"+t+"/"+n+"/aws4_request"}function Rn(e,t,n){var r=new e(t);return r.update(n),r.digest()}function Dn(e,t,n){var r,i,o=e.headers,s={};try{for(var a=Object(l.__values)(Object.keys(o).sort()),u=a.next();!u.done;u=a.next()){var c=u.value,f=c.toLowerCase();(f in Cn||(null==t?void 0:t.has(f))||xn.test(f)||Pn.test(f))&&(!n||n&&!n.has(f))||(s[f]=o[c].trim().replace(/\s+/g," "))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return s}var Un=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,Fn)},Fn=function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()};function Ln(e,t){var n=e.headers,r=e.body;return Object(l.__awaiter)(this,void 0,void 0,(function(){var e,i,o,s,a,u,c;return Object(l.__generator)(this,(function(f){switch(f.label){case 0:try{for(e=Object(l.__values)(Object.keys(n)),i=e.next();!i.done;i=e.next())if("x-amz-content-sha256"===(o=i.value).toLowerCase())return[2,n[o]]}catch(e){u={error:e}}finally{try{i&&!i.done&&(c=e.return)&&c.call(e)}finally{if(u)throw u.error}}return null!=r?[3,1]:[2,"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"];case 1:return"string"==typeof r||ArrayBuffer.isView(r)||(d=r,"function"==typeof ArrayBuffer&&d instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(d))?((s=new t).update(r),a=En,[4,s.digest()]):[3,3];case 2:return[2,a.apply(void 0,[f.sent()])];case 3:return[2,"UNSIGNED-PAYLOAD"]}var d}))}))}function Bn(e){var t=e.headers,n=e.query,r=Object(l.__rest)(e,["headers","query"]);return Object(l.__assign)(Object(l.__assign)({},r),{headers:Object(l.__assign)({},t),query:n?qn(n):void 0})}function qn(e){return Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object(l.__assign)(Object(l.__assign)({},t),((r={})[n]=Array.isArray(i)?Object(l.__spread)(i):i,r))}),{})}function zn(e){var t,n;e="function"==typeof e.clone?e.clone():Bn(e);try{for(var r=Object(l.__values)(Object.keys(e.headers)),i=r.next();!i.done;i=r.next()){var o=i.value;On.indexOf(o.toLowerCase())>-1&&delete e.headers[o]}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}return e}function Kn(e){return function(e){if("number"==typeof e)return new Date(1e3*e);if("string"==typeof e)return Number(e)?new Date(1e3*Number(e)):new Date(e);return e}(e).toISOString().replace(/\.\d{3}Z$/,"Z")}var Vn=function(){function e(e){var t=e.applyChecksum,n=e.credentials,r=e.region,i=e.service,o=e.sha256,s=e.uriEscapePath,a=void 0===s||s;this.service=i,this.sha256=o,this.uriEscapePath=a,this.applyChecksum="boolean"!=typeof t||t,this.regionProvider=Wn(r),this.credentialProvider=Yn(n)}return e.prototype.presign=function(e,t){return void 0===t&&(t={}),Object(l.__awaiter)(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,f,d,h,p,v,y,g,m,b,w,S,_,E,A,O,I;return Object(l.__generator)(this,(function(T){switch(T.label){case 0:return n=t.signingDate,r=void 0===n?new Date:n,i=t.expiresIn,o=void 0===i?3600:i,s=t.unsignableHeaders,a=t.unhoistableHeaders,u=t.signableHeaders,c=t.signingRegion,f=t.signingService,[4,this.credentialProvider()];case 1:return d=T.sent(),null==c?[3,2]:(p=c,[3,4]);case 2:return[4,this.regionProvider()];case 3:p=T.sent(),T.label=4;case 4:return h=p,v=Hn(r),y=v.longDate,g=v.shortDate,o>604800?[2,Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future")]:(m=jn(g,h,null!=f?f:this.service),b=function(e,t){var n,r,i;void 0===t&&(t={});var o="function"==typeof e.clone?e.clone():Bn(e),s=o.headers,a=o.query,u=void 0===a?{}:a;try{for(var c=Object(l.__values)(Object.keys(s)),f=c.next();!f.done;f=c.next()){var d=f.value,h=d.toLowerCase();"x-amz-"!==h.substr(0,6)||(null===(i=t.unhoistableHeaders)||void 0===i?void 0:i.has(h))||(u[d]=s[d],delete s[d])}}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}return Object(l.__assign)(Object(l.__assign)({},e),{headers:s,query:u})}(zn(e),{unhoistableHeaders:a}),d.sessionToken&&(b.query["X-Amz-Security-Token"]=d.sessionToken),b.query["X-Amz-Algorithm"]="AWS4-HMAC-SHA256",b.query["X-Amz-Credential"]=d.accessKeyId+"/"+m,b.query["X-Amz-Date"]=y,b.query["X-Amz-Expires"]=o.toString(10),w=Dn(b,s,u),b.query["X-Amz-SignedHeaders"]=Gn(w),S=b.query,_="X-Amz-Signature",E=this.getSignature,A=[y,m,this.getSigningKey(d,h,g,f)],O=this.createCanonicalRequest,I=[b,w],[4,Ln(e,this.sha256)]);case 5:return[4,E.apply(this,A.concat([O.apply(this,I.concat([T.sent()]))]))];case 6:return S[_]=T.sent(),[2,b]}}))}))},e.prototype.sign=function(e,t){return Object(l.__awaiter)(this,void 0,void 0,(function(){return Object(l.__generator)(this,(function(n){return"string"==typeof e?[2,this.signString(e,t)]:e.headers&&e.payload?[2,this.signEvent(e,t)]:[2,this.signRequest(e,t)]}))}))},e.prototype.signEvent=function(e,t){var n=e.headers,r=e.payload,i=t.signingDate,o=void 0===i?new Date:i,s=t.priorSignature,a=t.signingRegion,u=t.signingService;return Object(l.__awaiter)(this,void 0,void 0,(function(){var e,t,i,c,f,d,h,p,v,y,g;return Object(l.__generator)(this,(function(l){switch(l.label){case 0:return null==a?[3,1]:(t=a,[3,3]);case 1:return[4,this.regionProvider()];case 2:t=l.sent(),l.label=3;case 3:return e=t,i=Hn(o),c=i.shortDate,f=i.longDate,d=jn(c,e,null!=u?u:this.service),[4,Ln({headers:{},body:r},this.sha256)];case 4:return h=l.sent(),(p=new this.sha256).update(n),y=En,[4,p.digest()];case 5:return v=y.apply(void 0,[l.sent()]),g=[kn,f,d,s,v,h].join("\n"),[2,this.signString(g,{signingDate:o,signingRegion:e,signingService:u})]}}))}))},e.prototype.signString=function(e,t){var n=void 0===t?{}:t,r=n.signingDate,i=void 0===r?new Date:r,o=n.signingRegion,s=n.signingService;return Object(l.__awaiter)(this,void 0,void 0,(function(){var t,n,r,a,u,c,f,d;return Object(l.__generator)(this,(function(l){switch(l.label){case 0:return[4,this.credentialProvider()];case 1:return t=l.sent(),null==o?[3,2]:(r=o,[3,4]);case 2:return[4,this.regionProvider()];case 3:r=l.sent(),l.label=4;case 4:return n=r,a=Hn(i).shortDate,f=(c=this.sha256).bind,[4,this.getSigningKey(t,n,a,s)];case 5:return(u=new(f.apply(c,[void 0,l.sent()]))).update(e),d=En,[4,u.digest()];case 6:return[2,d.apply(void 0,[l.sent()])]}}))}))},e.prototype.signRequest=function(e,t){var n=void 0===t?{}:t,r=n.signingDate,i=void 0===r?new Date:r,o=n.signableHeaders,s=n.unsignableHeaders,a=n.signingRegion,u=n.signingService;return Object(l.__awaiter)(this,void 0,void 0,(function(){var t,n,r,c,f,d,h,p,v,y,g;return Object(l.__generator)(this,(function(m){switch(m.label){case 0:return[4,this.credentialProvider()];case 1:return t=m.sent(),null==a?[3,2]:(r=a,[3,4]);case 2:return[4,this.regionProvider()];case 3:r=m.sent(),m.label=4;case 4:return n=r,c=zn(e),f=Hn(i),d=f.longDate,h=f.shortDate,p=jn(h,n,null!=u?u:this.service),c.headers[An]=d,t.sessionToken&&(c.headers[Tn]=t.sessionToken),[4,Ln(c,this.sha256)];case 5:return v=m.sent(),!function(e,t){var n,r;e=e.toLowerCase();try{for(var i=Object(l.__values)(Object.keys(t)),o=i.next();!o.done;o=i.next()){if(e===o.value.toLowerCase())return!0}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!1}("x-amz-content-sha256",c.headers)&&this.applyChecksum&&(c.headers["x-amz-content-sha256"]=v),y=Dn(c,s,o),[4,this.getSignature(d,p,this.getSigningKey(t,n,h,u),this.createCanonicalRequest(c,y,v))];case 6:return g=m.sent(),c.headers.authorization="AWS4-HMAC-SHA256 Credential="+t.accessKeyId+"/"+p+", SignedHeaders="+Gn(y)+", Signature="+g,[2,c]}}))}))},e.prototype.createCanonicalRequest=function(e,t,n){var r=Object.keys(t).sort();return e.method+"\n"+this.getCanonicalPath(e)+"\n"+function(e){var t,n,r=e.query,i=void 0===r?{}:r,o=[],s={},a=function(e){if(e.toLowerCase()===In)return"continue";o.push(e);var t=i[e];"string"==typeof t?s[e]=Un(e)+"="+Un(t):Array.isArray(t)&&(s[e]=t.slice(0).sort().reduce((function(t,n){return t.concat([Un(e)+"="+Un(n)])}),[]).join("&"))};try{for(var u=Object(l.__values)(Object.keys(i).sort()),c=u.next();!c.done;c=u.next()){a(c.value)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}return o.map((function(e){return s[e]})).filter((function(e){return e})).join("&")}(e)+"\n"+r.map((function(e){return e+":"+t[e]})).join("\n")+"\n\n"+r.join(";")+"\n"+n},e.prototype.createStringToSign=function(e,t,n){return Object(l.__awaiter)(this,void 0,void 0,(function(){var r,i;return Object(l.__generator)(this,(function(o){switch(o.label){case 0:return(r=new this.sha256).update(n),[4,r.digest()];case 1:return i=o.sent(),[2,"AWS4-HMAC-SHA256\n"+e+"\n"+t+"\n"+En(i)]}}))}))},e.prototype.getCanonicalPath=function(e){var t=e.path;return this.uriEscapePath?"/"+encodeURIComponent(t.replace(/^\//,"")).replace(/%2F/g,"/"):t},e.prototype.getSignature=function(e,t,n,r){return Object(l.__awaiter)(this,void 0,void 0,(function(){var i,o,s,a,u;return Object(l.__generator)(this,(function(c){switch(c.label){case 0:return[4,this.createStringToSign(e,t,r)];case 1:return i=c.sent(),a=(s=this.sha256).bind,[4,n];case 2:return(o=new(a.apply(s,[void 0,c.sent()]))).update(i),u=En,[4,o.digest()];case 3:return[2,u.apply(void 0,[c.sent()])]}}))}))},e.prototype.getSigningKey=function(e,t,n,r){return function(e,t,n,r,i){return Object(l.__awaiter)(void 0,void 0,void 0,(function(){var o,s,a,u,c,f,d,h,p;return Object(l.__generator)(this,(function(v){switch(v.label){case 0:return[4,Rn(e,t.secretAccessKey,t.accessKeyId)];case 1:if(o=v.sent(),(s=n+":"+r+":"+i+":"+En(o)+":"+t.sessionToken)in Nn)return[2,Nn[s]];for(Mn.push(s);Mn.length>50;)delete Nn[Mn.shift()];a="AWS4"+t.secretAccessKey,v.label=2;case 2:v.trys.push([2,7,8,9]),u=Object(l.__values)([n,r,i,"aws4_request"]),c=u.next(),v.label=3;case 3:return c.done?[3,6]:(f=c.value,[4,Rn(e,a,f)]);case 4:a=v.sent(),v.label=5;case 5:return c=u.next(),[3,3];case 6:return[3,9];case 7:return d=v.sent(),h={error:d},[3,9];case 8:try{c&&!c.done&&(p=u.return)&&p.call(u)}finally{if(h)throw h.error}return[7];case 9:return[2,Nn[s]=a]}}))}))}(this.sha256,e,n,t,r||this.service)},e}(),Hn=function(e){var t=Kn(e).replace(/[\-:]/g,"");return{longDate:t,shortDate:t.substr(0,8)}},Gn=function(e){return Object.keys(e).sort().join(";")},Wn=function(e){if("string"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e},Yn=function(e){if("object"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};function Jn(e){if("object"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e}var $n,Zn,Qn,Xn,er,tr,nr,rr,ir,or,sr,ar,ur,cr,lr,fr,dr,hr,pr,vr,yr,gr,mr,br,wr,Sr,_r,Er,Ar,Or,Ir,Tr,Cr,xr,Pr,kr,Nr,Mr,jr,Rr,Dr,Ur,Fr,Lr,Br,qr,zr,Kr,Vr,Hr,Gr,Wr,Yr,Jr,$r,Zr,Qr,Xr=/[^\!\#\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,ei=function(e){var t=Object(l.__read)(e,2),n=t[0],r=t[1],i=n.indexOf("/"),o=n.substring(0,i),s=n.substring(i+1);return"api"===o&&(s=s.toLowerCase()),[o,s,r].filter((function(e){return e&&e.length>0})).map((function(e){return null==e?void 0:e.replace(Xr,"_")})).join("/")},ti={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},ni=function(e){return{applyToStack:function(t){var n;t.add((n=e,function(e,t){return function(r){return Object(l.__awaiter)(void 0,void 0,void 0,(function(){var i,o,s,a,u,c,f,d;return Object(l.__generator)(this,(function(h){switch(h.label){case 0:return i=r.request,Se.isInstance(i)?(o=i.headers,s=(null===(f=null==t?void 0:t.userAgent)||void 0===f?void 0:f.map(ei))||[],[4,n.defaultUserAgentProvider()]):[2,e(r)];case 1:return a=h.sent().map(ei),u=(null===(d=null==n?void 0:n.customUserAgent)||void 0===d?void 0:d.map(ei))||[],o["x-amz-user-agent"]=Object(l.__spread)(a,s,u).join(" "),c=Object(l.__spread)(a.filter((function(e){return e.startsWith("aws-sdk-")})),u).join(" "),"browser"!==n.runtime&&c&&(o["user-agent"]=o["user-agent"]?o["user-agent"]+" "+c:c),[2,e(Object(l.__assign)(Object(l.__assign)({},r),{request:i}))]}}))}))}}),ti)}}},ri=function(e){function t(t){var n,r,i=this,o=function(e){var t,n=this,r=Jn(e.credentials||e.credentialDefaultProvider(e)),i=e.signingEscapePath,o=void 0===i||i,s=e.systemClockOffset,a=void 0===s?e.systemClockOffset||0:s,u=e.sha256;return t=e.signer?Jn(e.signer):function(){return Jn(e.region)().then((function(t){return Object(l.__awaiter)(n,void 0,void 0,(function(){return Object(l.__generator)(this,(function(n){switch(n.label){case 0:return[4,e.regionInfoProvider(t)];case 1:return[2,[n.sent()||{},t]]}}))}))})).then((function(t){var n=Object(l.__read)(t,2),i=n[0],s=n[1],a=i.signingRegion,c=i.signingService;return e.signingRegion=e.signingRegion||a||s,e.signingName=e.signingName||c||e.serviceId,new Vn({credentials:r,region:e.signingRegion,service:e.signingName,sha256:u,uriEscapePath:o})}))},Object(l.__assign)(Object(l.__assign)({},e),{systemClockOffset:a,signingEscapePath:o,credentials:r,signer:t})}(function(e){var t;return Object(l.__assign)(Object(l.__assign)({},e),{tls:null===(t=e.tls)||void 0===t||t,endpoint:e.endpoint?ln(e):function(){return fn(e)},isCustomEndpoint:!!e.endpoint})}(function(e){if(!e.region)throw new Error("Region is missing");return Object(l.__assign)(Object(l.__assign)({},e),{region:dn(e.region)})}(mt(mt({},cn),t)))),s=function(e){return Object(l.__assign)(Object(l.__assign)({},e),{customUserAgent:"string"==typeof e.customUserAgent?[[e.customUserAgent]]:e.customUserAgent})}((r=Wt((n=o).maxAttempts),Object(l.__assign)(Object(l.__assign)({},n),{maxAttempts:r,retryStrategy:n.retryStrategy||new Gt(r)})));return(i=e.call(this,s)||this).config=s,i.middlewareStack.use(Ut(i.config)),i.middlewareStack.use(pn(i.config)),i.middlewareStack.use(yn(i.config)),i.middlewareStack.use(mn(i.config)),i.middlewareStack.use(ni(i.config)),i}return gt(t,e),t.prototype.destroy=function(){e.prototype.destroy.call(this)},t}(ot);!function(e){e.AUTHENTICATED_ROLE="AuthenticatedRole",e.DENY="Deny"}($n||($n={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Zn||(Zn={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Qn||(Qn={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Xn||(Xn={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(er||(er={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(tr||(tr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(nr||(nr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(rr||(rr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(ir||(ir={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(or||(or={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(sr||(sr={})),function(e){e.ACCESS_DENIED="AccessDenied",e.INTERNAL_SERVER_ERROR="InternalServerError"}(ar||(ar={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(ur||(ur={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(cr||(cr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(lr||(lr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(fr||(fr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(dr||(dr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(hr||(hr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(pr||(pr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(vr||(vr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(yr||(yr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(gr||(gr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(mr||(mr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(br||(br={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(wr||(wr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Sr||(Sr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(_r||(_r={})),function(e){e.CONTAINS="Contains",e.EQUALS="Equals",e.NOT_EQUAL="NotEqual",e.STARTS_WITH="StartsWith"}(Er||(Er={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Ar||(Ar={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Or||(Or={})),function(e){e.RULES="Rules",e.TOKEN="Token"}(Ir||(Ir={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Tr||(Tr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Cr||(Cr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(xr||(xr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Pr||(Pr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(kr||(kr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Nr||(Nr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Mr||(Mr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(jr||(jr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Rr||(Rr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Dr||(Dr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Ur||(Ur={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Fr||(Fr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Lr||(Lr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Br||(Br={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(qr||(qr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(zr||(zr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Kr||(Kr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Vr||(Vr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Hr||(Hr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Gr||(Gr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Wr||(Wr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Yr||(Yr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Jr||(Jr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}($r||($r={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Zr||(Zr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Qr||(Qr={}));var ii=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return wt(this,(function(g){switch(g.label){case 0:return r=[mt({},e)],y={},[4,Mi(e.body,t)];case 1:switch(n=mt.apply(void 0,r.concat([(y.body=g.sent(),y)])),o="UnknownError",o=ji(e,n.body),o){case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":return[3,2];case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":return[3,4];case"InvalidIdentityPoolConfigurationException":case"com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException":return[3,6];case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":return[3,8];case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":return[3,10];case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":return[3,12];case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":return[3,14];case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":return[3,16]}return[3,18];case 2:return s=[{}],[4,si(n,t)];case 3:return i=mt.apply(void 0,[mt.apply(void 0,s.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 4:return a=[{}],[4,ai(n,t)];case 5:return i=mt.apply(void 0,[mt.apply(void 0,a.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 6:return u=[{}],[4,ui(n,t)];case 7:return i=mt.apply(void 0,[mt.apply(void 0,u.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 8:return c=[{}],[4,ci(n,t)];case 9:return i=mt.apply(void 0,[mt.apply(void 0,c.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 10:return l=[{}],[4,fi(n,t)];case 11:return i=mt.apply(void 0,[mt.apply(void 0,l.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 12:return f=[{}],[4,di(n,t)];case 13:return i=mt.apply(void 0,[mt.apply(void 0,f.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 14:return d=[{}],[4,hi(n,t)];case 15:return i=mt.apply(void 0,[mt.apply(void 0,d.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 16:return h=[{}],[4,pi(n,t)];case 17:return i=mt.apply(void 0,[mt.apply(void 0,h.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 18:p=n.body,o=p.code||p.Code||o,i=mt(mt({},p),{name:""+o,message:p.message||p.Message||o,$fault:"client",$metadata:Pi(e)}),g.label=19;case 19:return v=i.message||i.Message||o,i.message=v,delete i.Message,[2,Promise.reject(Object.assign(new Error(v),i))]}}))}))},oi=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return wt(this,(function(g){switch(g.label){case 0:return r=[mt({},e)],y={},[4,Mi(e.body,t)];case 1:switch(n=mt.apply(void 0,r.concat([(y.body=g.sent(),y)])),o="UnknownError",o=ji(e,n.body),o){case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":return[3,2];case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":return[3,4];case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":return[3,6];case"LimitExceededException":case"com.amazonaws.cognitoidentity#LimitExceededException":return[3,8];case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":return[3,10];case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":return[3,12];case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":return[3,14];case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":return[3,16]}return[3,18];case 2:return s=[{}],[4,si(n,t)];case 3:return i=mt.apply(void 0,[mt.apply(void 0,s.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 4:return a=[{}],[4,ai(n,t)];case 5:return i=mt.apply(void 0,[mt.apply(void 0,a.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 6:return u=[{}],[4,ci(n,t)];case 7:return i=mt.apply(void 0,[mt.apply(void 0,u.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 8:return c=[{}],[4,li(n,t)];case 9:return i=mt.apply(void 0,[mt.apply(void 0,c.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 10:return l=[{}],[4,fi(n,t)];case 11:return i=mt.apply(void 0,[mt.apply(void 0,l.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 12:return f=[{}],[4,di(n,t)];case 13:return i=mt.apply(void 0,[mt.apply(void 0,f.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 14:return d=[{}],[4,hi(n,t)];case 15:return i=mt.apply(void 0,[mt.apply(void 0,d.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 16:return h=[{}],[4,pi(n,t)];case 17:return i=mt.apply(void 0,[mt.apply(void 0,h.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 18:p=n.body,o=p.code||p.Code||o,i=mt(mt({},p),{name:""+o,message:p.message||p.Message||o,$fault:"client",$metadata:Pi(e)}),g.label=19;case 19:return v=i.message||i.Message||o,i.message=v,delete i.Message,[2,Promise.reject(Object.assign(new Error(v),i))]}}))}))},si=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=bi(n,t),[2,mt({name:"ExternalServiceException",$fault:"client",$metadata:Pi(e)},r)]}))}))},ai=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=_i(n,t),[2,mt({name:"InternalErrorException",$fault:"server",$metadata:Pi(e)},r)]}))}))},ui=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=Ei(n,t),[2,mt({name:"InvalidIdentityPoolConfigurationException",$fault:"client",$metadata:Pi(e)},r)]}))}))},ci=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=Ai(n,t),[2,mt({name:"InvalidParameterException",$fault:"client",$metadata:Pi(e)},r)]}))}))},li=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=Oi(n,t),[2,mt({name:"LimitExceededException",$fault:"client",$metadata:Pi(e)},r)]}))}))},fi=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=Ii(n,t),[2,mt({name:"NotAuthorizedException",$fault:"client",$metadata:Pi(e)},r)]}))}))},di=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=Ti(n,t),[2,mt({name:"ResourceConflictException",$fault:"client",$metadata:Pi(e)},r)]}))}))},hi=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=Ci(n,t),[2,mt({name:"ResourceNotFoundException",$fault:"client",$metadata:Pi(e)},r)]}))}))},pi=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=xi(n,t),[2,mt({name:"TooManyRequestsException",$fault:"client",$metadata:Pi(e)},r)]}))}))},vi=function(e,t){return mt(mt(mt({},void 0!==e.CustomRoleArn&&null!==e.CustomRoleArn&&{CustomRoleArn:e.CustomRoleArn}),void 0!==e.IdentityId&&null!==e.IdentityId&&{IdentityId:e.IdentityId}),void 0!==e.Logins&&null!==e.Logins&&{Logins:gi(e.Logins,t)})},yi=function(e,t){return mt(mt(mt({},void 0!==e.AccountId&&null!==e.AccountId&&{AccountId:e.AccountId}),void 0!==e.IdentityPoolId&&null!==e.IdentityPoolId&&{IdentityPoolId:e.IdentityPoolId}),void 0!==e.Logins&&null!==e.Logins&&{Logins:gi(e.Logins,t)})},gi=function(e,t){return Object.entries(e).reduce((function(e,t){var n,r=St(t,2),i=r[0],o=r[1];return null===o?e:mt(mt({},e),((n={})[i]=o,n))}),{})},mi=function(e,t){return{AccessKeyId:void 0!==e.AccessKeyId&&null!==e.AccessKeyId?e.AccessKeyId:void 0,Expiration:void 0!==e.Expiration&&null!==e.Expiration?new Date(Math.round(1e3*e.Expiration)):void 0,SecretKey:void 0!==e.SecretKey&&null!==e.SecretKey?e.SecretKey:void 0,SessionToken:void 0!==e.SessionToken&&null!==e.SessionToken?e.SessionToken:void 0}},bi=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},wi=function(e,t){return{Credentials:void 0!==e.Credentials&&null!==e.Credentials?mi(e.Credentials):void 0,IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},Si=function(e,t){return{IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},_i=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ei=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ai=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Oi=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ii=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ti=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ci=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},xi=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Pi=function(e){var t;return{httpStatusCode:e.statusCode,requestId:null!==(t=e.headers["x-amzn-requestid"])&&void 0!==t?t:e.headers["x-amzn-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}},ki=function(e,t){return void 0===e&&(e=new Uint8Array),e instanceof Uint8Array?Promise.resolve(e):t.streamCollector(e)||Promise.resolve(new Uint8Array)},Ni=function(e,t,n,r,i){return bt(void 0,void 0,void 0,(function(){var o,s,a,u,c,l;return wt(this,(function(f){switch(f.label){case 0:return[4,e.endpoint()];case 1:return o=f.sent(),s=o.hostname,a=o.protocol,u=void 0===a?"https":a,c=o.port,l={protocol:u,hostname:s,port:c,method:"POST",path:n,headers:t},void 0!==r&&(l.hostname=r),void 0!==i&&(l.body=i),[2,new Se(l)]}}))}))},Mi=function(e,t){return function(e,t){return ki(e,t).then((function(e){return t.utf8Encoder(e)}))}(e,t).then((function(e){return e.length?JSON.parse(e):{}}))},ji=function(e,t){var n,r,i=function(e){var t=e;return t.indexOf(":")>=0&&(t=t.split(":")[0]),t.indexOf("#")>=0&&(t=t.split("#")[1]),t},o=(n=e.headers,r="x-amzn-errortype",Object.keys(n).find((function(e){return e.toLowerCase()===r.toLowerCase()})));return void 0!==o?i(e.headers[o]):void 0!==t.code?i(t.code):void 0!==t.__type?i(t.__type):""},Ri=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return gt(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(tt(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetIdCommand",inputFilterSensitiveLog:wr.filterSensitiveLog,outputFilterSensitiveLog:Sr.filterSensitiveLog},o=t.requestHandler;return r.resolve((function(e){return o.handle(e.request,n||{})}),i)},t.prototype.serialize=function(e,t){return function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetId"},r=JSON.stringify(yi(e,t)),[2,Ni(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r,i;return wt(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,oi(e,t)]:[4,Mi(e.body,t)];case 1:return n=o.sent(),{},r=Si(n,t),i=mt({$metadata:Pi(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(st),Di=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return gt(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(tt(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetCredentialsForIdentityCommand",inputFilterSensitiveLog:yr.filterSensitiveLog,outputFilterSensitiveLog:mr.filterSensitiveLog},o=t.requestHandler;return r.resolve((function(e){return o.handle(e.request,n||{})}),i)},t.prototype.serialize=function(e,t){return function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetCredentialsForIdentity"},r=JSON.stringify(vi(e,t)),[2,Ni(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r,i;return wt(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,ii(e,t)]:[4,Mi(e.body,t)];case 1:return n=o.sent(),{},r=wi(n,t),i=mt({$metadata:Pi(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(st),Ui=function(){return(Ui=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},Fi=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},Li=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Bi=new r.a("Credentials"),qi=new(function(){function e(e){this._gettingCredPromise=null,this._refreshHandlers={},this.Auth=void 0,this.configure(e),this._refreshHandlers.google=s.b.refreshGoogleToken,this._refreshHandlers.facebook=s.a.refreshFacebookToken}return e.prototype.getModuleName=function(){return"Credentials"},e.prototype.getCredSource=function(){return this._credentials_source},e.prototype.configure=function(e){if(!e)return this._config||{};this._config=Object.assign({},this._config,e);var t=this._config.refreshHandlers;return t&&(this._refreshHandlers=Ui(Ui({},this._refreshHandlers),t)),this._storage=this._config.storage,this._storage||(this._storage=(new i.a).getStorage()),this._storageSync=Promise.resolve(),"function"==typeof this._storage.sync&&(this._storageSync=this._storage.sync()),this._config},e.prototype.get=function(){return Bi.debug("getting credentials"),this._pickupCredentials()},e.prototype._getCognitoIdentityIdStorageKey=function(e){return"CognitoIdentityId-"+e},e.prototype._pickupCredentials=function(){return Bi.debug("picking up credentials"),this._gettingCredPromise&&this._gettingCredPromise.isPending()?Bi.debug("getting old cred promise"):(Bi.debug("getting new cred promise"),this._gettingCredPromise=Object(o.d)(this._keepAlive())),this._gettingCredPromise},e.prototype._keepAlive=function(){return Fi(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return Li(this,(function(a){switch(a.label){case 0:if(Bi.debug("checking if credentials exists and not expired"),(e=this._credentials)&&!this._isExpired(e)&&!this._isPastTTL())return Bi.debug("credentials not changed and not expired, directly return"),[2,Promise.resolve(e)];if(Bi.debug("need to get a new credential or refresh the existing one"),t=this.Auth,!(n=void 0===t?c.a.Auth:t)||"function"!=typeof n.currentUserCredentials)return[2,Promise.reject("No Auth module registered in Amplify")];if(this._isExpired(e)||!this._isPastTTL())return[3,6];Bi.debug("ttl has passed but token is not yet expired"),a.label=1;case 1:return a.trys.push([1,5,,6]),[4,n.currentUserPoolUser()];case 2:return r=a.sent(),[4,n.currentSession()];case 3:return i=a.sent(),o=i.refreshToken,[4,new Promise((function(e,t){r.refreshSession(o,(function(n,r){return n?t(n):e(r)}))}))];case 4:return a.sent(),[3,6];case 5:return s=a.sent(),Bi.debug("Error attempting to refreshing the session",s),[3,6];case 6:return[2,n.currentUserCredentials()]}}))}))},e.prototype.refreshFederatedToken=function(e){Bi.debug("Getting federated credentials");var t=e.provider,n=e.user,r=e.token,i=e.identity_id,o=e.expires_at;o=1970===new Date(o).getFullYear()?1e3*o:o;return Bi.debug("checking if federated jwt token expired"),o>(new Date).getTime()?(Bi.debug("token not expired"),this._setCredentialsFromFederation({provider:t,token:r,user:n,identity_id:i,expires_at:o})):this._refreshHandlers[t]&&"function"==typeof this._refreshHandlers[t]?(Bi.debug("getting refreshed jwt token from federation provider"),this._providerRefreshWithRetry({refreshHandler:this._refreshHandlers[t],provider:t,user:n})):(Bi.debug("no refresh handler for provider:",t),this.clear(),Promise.reject("no refresh handler for provider"))},e.prototype._providerRefreshWithRetry=function(e){var t=this,n=e.refreshHandler,r=e.provider,i=e.user;return Object(a.b)(n,[],1e4).then((function(e){return Bi.debug("refresh federated token sucessfully",e),t._setCredentialsFromFederation({provider:r,token:e.token,user:i,identity_id:e.identity_id,expires_at:e.expires_at})})).catch((function(e){return"string"==typeof e&&0===e.toLowerCase().lastIndexOf("network error",e.length)||t.clear(),Bi.debug("refresh federated token failed",e),Promise.reject("refreshing federation token failed: "+e)}))},e.prototype._isExpired=function(e){if(!e)return Bi.debug("no credentials for expiration check"),!0;Bi.debug("are these credentials expired?",e);var t=Date.now();return e.expiration.getTime()<=t},e.prototype._isPastTTL=function(){return this._nextCredentialsRefresh<=Date.now()},e.prototype._setCredentialsForGuest=function(){return Fi(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a=this;return Li(this,(function(c){switch(c.label){case 0:return Bi.debug("setting credentials for guest"),e=this._config,t=e.identityPoolId,n=e.region,e.mandatorySignIn?[2,Promise.reject("cannot get guest credentials when mandatory signin enabled")]:t?n?(i=this,[4,this._getGuestIdentityId()]):(Bi.debug("region is not configured for getting the credentials"),[2,Promise.reject("region is not configured for getting the credentials")]):(Bi.debug("No Cognito Identity pool provided for unauthenticated access"),[2,Promise.reject("No Cognito Identity pool provided for unauthenticated access")]);case 1:return r=i._identityId=c.sent(),o=new ri({region:n,customUserAgent:Object(u.b)()}),s=void 0,s=r?ft({identityId:r,client:o})():function(){return Fi(a,void 0,void 0,(function(){var e;return Li(this,(function(n){switch(n.label){case 0:return[4,o.send(new Ri({IdentityPoolId:t}))];case 1:return e=n.sent().IdentityId,this._identityId=e,[2,ft({client:o,identityId:e})()]}}))}))}().catch((function(e){return Fi(a,void 0,void 0,(function(){return Li(this,(function(t){throw e}))}))})),[2,this._loadCredentials(s,"guest",!1,null).then((function(e){return e})).catch((function(e){return Fi(a,void 0,void 0,(function(){var n=this;return Li(this,(function(i){switch(i.label){case 0:return"ResourceNotFoundException"!==e.name||e.message!=="Identity '"+r+"' not found."?[3,2]:(Bi.debug("Failed to load guest credentials"),[4,this._removeGuestIdentityId()]);case 1:return i.sent(),s=function(){return Fi(n,void 0,void 0,(function(){var e;return Li(this,(function(n){switch(n.label){case 0:return[4,o.send(new Ri({IdentityPoolId:t}))];case 1:return e=n.sent().IdentityId,this._identityId=e,[2,ft({client:o,identityId:e})()]}}))}))}().catch((function(e){return Fi(n,void 0,void 0,(function(){return Li(this,(function(t){throw e}))}))})),[2,this._loadCredentials(s,"guest",!1,null)];case 2:return[2,e]}}))}))}))]}}))}))},e.prototype._setCredentialsFromFederation=function(e){var t=e.provider,n=e.token,r=e.identity_id,i={google:"accounts.google.com",facebook:"graph.facebook.com",amazon:"www.amazon.com",developer:"cognito-identity.amazonaws.com"}[t]||t;if(!i)return Promise.reject("You must specify a federated provider");var o={};o[i]=n;var s=this._config,a=s.identityPoolId,c=s.region;if(!a)return Bi.debug("No Cognito Federated Identity pool provided"),Promise.reject("No Cognito Federated Identity pool provided");if(!c)return Bi.debug("region is not configured for getting the credentials"),Promise.reject("region is not configured for getting the credentials");var l=new ri({region:c,customUserAgent:Object(u.b)()}),f=void 0;r?f=ft({identityId:r,logins:o,client:l})():f=vt({logins:o,identityPoolId:a,client:l})();return this._loadCredentials(f,"federated",!0,e)},e.prototype._setCredentialsFromSession=function(e){var t=this;Bi.debug("set credentials from session");var n=e.getIdToken().getJwtToken(),r=this._config,i=r.region,o=r.userPoolId,s=r.identityPoolId;if(!s)return Bi.debug("No Cognito Federated Identity pool provided"),Promise.reject("No Cognito Federated Identity pool provided");if(!i)return Bi.debug("region is not configured for getting the credentials"),Promise.reject("region is not configured for getting the credentials");var a={};a["cognito-idp."+i+".amazonaws.com/"+o]=n;var c=new ri({region:i,customUserAgent:Object(u.b)()}),l=Fi(t,void 0,void 0,(function(){var e,t,n,r,i,o,u,l,f,d;return Li(this,(function(h){switch(h.label){case 0:return[4,this._getGuestIdentityId()];case 1:return(e=h.sent())?[3,3]:[4,c.send(new Ri({IdentityPoolId:s,Logins:a}))];case 2:n=h.sent().IdentityId,t=n,h.label=3;case 3:return[4,c.send(new Di({IdentityId:e||t,Logins:a}))];case 4:return r=h.sent(),i=r.Credentials,o=i.AccessKeyId,u=i.Expiration,l=i.SecretKey,f=i.SessionToken,d=r.IdentityId,this._identityId=d,e?(Bi.debug("The guest identity "+e+" has been successfully linked to the logins"),e===d&&Bi.debug("The guest identity "+e+" has become the primary identity"),[4,this._removeGuestIdentityId()]):[3,6];case 5:h.sent(),h.label=6;case 6:return[2,{accessKeyId:o,secretAccessKey:l,sessionToken:f,expiration:u,identityId:d}]}}))})).catch((function(e){return Fi(t,void 0,void 0,(function(){return Li(this,(function(t){throw e}))}))}));return this._loadCredentials(l,"userPool",!0,null)},e.prototype._loadCredentials=function(e,t,n,r){var i=this,o=this;return new Promise((function(s,a){e.then((function(e){return Fi(i,void 0,void 0,(function(){var i,a,u,c,l;return Li(this,(function(f){switch(f.label){case 0:if(Bi.debug("Load credentials successfully",e),this._identityId&&!e.identityId&&(e.identityId=this._identityId),o._credentials=e,o._credentials.authenticated=n,o._credentials_source=t,o._nextCredentialsRefresh=(new Date).getTime()+3e6,"federated"===t){i=Object.assign({id:this._credentials.identityId},r.user),a=r.provider,u=r.token,c=r.expires_at,l=r.identity_id;try{this._storage.setItem("aws-amplify-federatedInfo",JSON.stringify({provider:a,token:u,user:i,expires_at:c,identity_id:l}))}catch(e){Bi.debug("Failed to put federated info into auth storage",e)}}return"guest"!==t?[3,2]:[4,this._setGuestIdentityId(e.identityId)];case 1:f.sent(),f.label=2;case 2:return s(o._credentials),[2]}}))}))})).catch((function(t){if(t)return Bi.debug("Failed to load credentials",e),Bi.debug("Error loading credentials",t),void a(t)}))}))},e.prototype.set=function(e,t){return"session"===t?this._setCredentialsFromSession(e):"federation"===t?this._setCredentialsFromFederation(e):"guest"===t?this._setCredentialsForGuest():(Bi.debug("no source specified for setting credentials"),Promise.reject("invalid source"))},e.prototype.clear=function(){return Fi(this,void 0,void 0,(function(){return Li(this,(function(e){return this._credentials=null,this._credentials_source=null,Bi.debug("removing aws-amplify-federatedInfo from storage"),this._storage.removeItem("aws-amplify-federatedInfo"),[2]}))}))},e.prototype._getGuestIdentityId=function(){return Fi(this,void 0,void 0,(function(){var e,t;return Li(this,(function(n){switch(n.label){case 0:e=this._config.identityPoolId,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._storageSync];case 2:return n.sent(),[2,this._storage.getItem(this._getCognitoIdentityIdStorageKey(e))];case 3:return t=n.sent(),Bi.debug("Failed to get the cached guest identityId",t),[3,4];case 4:return[2]}}))}))},e.prototype._setGuestIdentityId=function(e){return Fi(this,void 0,void 0,(function(){var t,n;return Li(this,(function(r){switch(r.label){case 0:t=this._config.identityPoolId,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._storageSync];case 2:return r.sent(),this._storage.setItem(this._getCognitoIdentityIdStorageKey(t),e),[3,4];case 3:return n=r.sent(),Bi.debug("Failed to cache guest identityId",n),[3,4];case 4:return[2]}}))}))},e.prototype._removeGuestIdentityId=function(){return Fi(this,void 0,void 0,(function(){var e;return Li(this,(function(t){return e=this._config.identityPoolId,Bi.debug("removing "+this._getCognitoIdentityIdStorageKey(e)+" from storage"),this._storage.removeItem(this._getCognitoIdentityIdStorageKey(e)),[2]}))}))},e.prototype.shear=function(e){return{accessKeyId:e.accessKeyId,sessionToken:e.sessionToken,secretAccessKey:e.secretAccessKey,identityId:e.identityId,authenticated:e.authenticated}},e}())(null);c.a.register(qi)},function(e,t,n){var r;e.exports=(r=n(13),function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,s=t.algo,a=[],u=[];!function(){function t(t){for(var n=e.sqrt(t),r=2;r<=n;r++)if(!(t%r))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var r=2,i=0;i<64;)t(r)&&(i<8&&(a[i]=n(e.pow(r,.5))),u[i]=n(e.pow(r,1/3)),i++),r++}();var c=[],l=s.SHA256=o.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],l=n[5],f=n[6],d=n[7],h=0;h<64;h++){if(h<16)c[h]=0|e[t+h];else{var p=c[h-15],v=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,y=c[h-2],g=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;c[h]=v+c[h-7]+g+c[h-16]}var m=r&i^r&o^i&o,b=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),w=d+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&f)+u[h]+c[h];d=f,f=l,l=a,a=s+w|0,s=o,o=i,i=r,r=w+(b+m)|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+s|0,n[4]=n[4]+a|0,n[5]=n[5]+l|0,n[6]=n[6]+f|0,n[7]=n[7]+d|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),r.SHA256)},function(e,t,n){"use strict";n.d(t,"a",(function(){return z}));var r=n(5),i=n(22),o=n(34),s=n(39),a=n(59),u=n(70),c=n(30),l=n(15);var f,d=n(17),h=n(9),p=n(8),v=function(e){var t=window.open(e,"_self");return t?Promise.resolve(t):Promise.reject()},y=n(78),g=n.n(y),m=n(79),b=n.n(m),w=function(){return(w=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},S=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},_=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},E=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},A="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",O=function(e,t,n){o.a.dispatch("auth",{event:e,data:t,message:n},"Auth",A)},I=new i.a("OAuth"),T=function(){function e(e){var t=e.config,n=e.cognitoClientId,r=e.scopes,i=void 0===r?[]:r;if(this._urlOpener=t.urlOpener||v,this._config=t,this._cognitoClientId=n,!this.isValidScopes(i))throw Error("scopes must be a String Array");this._scopes=i}return e.prototype.isValidScopes=function(e){return Array.isArray(e)&&e.every((function(e){return"string"==typeof e}))},e.prototype.oauthSignIn=function(e,t,n,i,o,s){void 0===e&&(e="code"),void 0===o&&(o=r.b.Cognito);var a=this._generateState(32),u=s?a+"-"+s.split("").map((function(e){return e.charCodeAt(0).toString(16).padStart(2,"0")})).join(""):a;!function(e){window.sessionStorage.setItem("oauth_state",e)}(u);var c,l=this._generateRandom(128);c=l,window.sessionStorage.setItem("ouath_pkce_key",c);var f=this._generateChallenge(l),d=this._scopes.join(" "),h="https://"+t+"/oauth2/authorize?"+Object.entries(w(w({redirect_uri:n,response_type:e,client_id:i,identity_provider:o,scope:d,state:u},"code"===e?{code_challenge:f}:{}),"code"===e?{code_challenge_method:"S256"}:{})).map((function(e){var t=E(e,2),n=t[0],r=t[1];return encodeURIComponent(n)+"="+encodeURIComponent(r)})).join("&");I.debug("Redirecting to "+h),this._urlOpener(h,n)},e.prototype._handleCodeFlow=function(e){return S(this,void 0,void 0,(function(){var t,n,i,o,s,a,u,c,l,f,d,h,v,y;return _(this,(function(g){switch(g.label){case 0:return t=(Object(p.parse)(e).query||"").split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n,r=E(t,2),i=r[0],o=r[1];return w(w({},e),((n={})[i]=o,n))}),{code:void 0}).code,n=Object(p.parse)(e).pathname||"/",i=Object(p.parse)(this._config.redirectSignIn).pathname||"/",t&&n===i?(o="https://"+this._config.domain+"/oauth2/token",O("codeFlow",{},"Retrieving tokens from "+o),s=Object(r.d)(this._config)?this._cognitoClientId:this._config.clientID,a=Object(r.d)(this._config)?this._config.redirectSignIn:this._config.redirectUri,m=window.sessionStorage.getItem("ouath_pkce_key"),window.sessionStorage.removeItem("ouath_pkce_key"),c=w({grant_type:"authorization_code",code:t,client_id:s,redirect_uri:a},(u=m)?{code_verifier:u}:{}),I.debug("Calling token endpoint: "+o+" with",c),l=Object.entries(c).map((function(e){var t=E(e,2),n=t[0],r=t[1];return encodeURIComponent(n)+"="+encodeURIComponent(r)})).join("&"),[4,fetch(o,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:l})]):[2];case 1:return[4,g.sent().json()];case 2:if(f=g.sent(),d=f.access_token,h=f.refresh_token,v=f.id_token,y=f.error)throw new Error(y);return[2,{accessToken:d,refreshToken:h,idToken:v}]}var m}))}))},e.prototype._handleImplicitFlow=function(e){return S(this,void 0,void 0,(function(){var t,n,r;return _(this,(function(i){return t=(Object(p.parse)(e).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n,r=E(t,2),i=r[0],o=r[1];return w(w({},e),((n={})[i]=o,n))}),{id_token:void 0,access_token:void 0}),n=t.id_token,r=t.access_token,O("implicitFlow",{},"Got tokens from "+e),I.debug("Retrieving implicit tokens from "+e+" with"),[2,{accessToken:r,idToken:n,refreshToken:null}]}))}))},e.prototype.handleAuthResponse=function(e){return S(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return _(this,(function(u){switch(u.label){case 0:if(u.trys.push([0,5,,6]),t=e?w(w({},(Object(p.parse)(e).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n=E(t,2),r=n[0],i=n[1];return e[r]=i,e}),{})),(Object(p.parse)(e).query||"").split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n=E(t,2),r=n[0],i=n[1];return e[r]=i,e}),{})):{},n=t.error,r=t.error_description,n)throw new Error(r);return i=this._validateState(t),I.debug("Starting "+this._config.responseType+" flow with "+e),"code"!==this._config.responseType?[3,2]:(o=[{}],[4,this._handleCodeFlow(e)]);case 1:return[2,w.apply(void 0,[w.apply(void 0,o.concat([u.sent()])),{state:i}])];case 2:return s=[{}],[4,this._handleImplicitFlow(e)];case 3:return[2,w.apply(void 0,[w.apply(void 0,s.concat([u.sent()])),{state:i}])];case 4:return[3,6];case 5:throw a=u.sent(),I.error("Error handling auth response.",a),a;case 6:return[2]}}))}))},e.prototype._validateState=function(e){if(e){var t,n=(t=window.sessionStorage.getItem("oauth_state"),window.sessionStorage.removeItem("oauth_state"),t),r=e.state;if(n&&n!==r)throw new Error("Invalid state in OAuth flow");return r}},e.prototype.signOut=function(){return S(this,void 0,void 0,(function(){var e,t,n;return _(this,(function(i){return e="https://"+this._config.domain+"/logout?",t=Object(r.d)(this._config)?this._cognitoClientId:this._config.oauth.clientID,n=Object(r.d)(this._config)?this._config.redirectSignOut:this._config.returnTo,e+=Object.entries({client_id:t,logout_uri:encodeURIComponent(n)}).map((function(e){var t=E(e,2);return t[0]+"="+t[1]})).join("&"),O("oAuthSignOut",{oAuth:"signOut"},"Signing out from "+e),I.debug("Signing out from "+e),[2,this._urlOpener(e,n)]}))}))},e.prototype._generateState=function(e){for(var t="",n=e,r="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";n>0;--n)t+=r[Math.round(Math.random()*(r.length-1))];return t},e.prototype._generateChallenge=function(e){return this._base64URL(g()(e))},e.prototype._base64URL=function(e){return e.toString(b.a).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},e.prototype._generateRandom=function(e){var t=new Uint8Array(e);if("undefined"!=typeof window&&window.crypto)window.crypto.getRandomValues(t);else for(var n=0;n<e;n+=1)t[n]=Math.random()*"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~".length|0;return this._bufferToString(t)},e.prototype._bufferToString=function(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=[],r=0;r<e.byteLength;r+=1){var i=e[r]%t.length;n.push(t[i])}return n.join("")},e}(),C=n(11),x=(f=function(e,t){return(f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}f(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),P=new i.a("AuthError"),k=function(e){function t(n){var r=this,i=M[n],o=i.message,s=i.log;return(r=e.call(this,o)||this).constructor=t,Object.setPrototypeOf(r,t.prototype),r.name="AuthError",r.log=s||o,P.error(r.log),r}return x(t,e),t}(Error),N=function(e){function t(n){var r=e.call(this,n)||this;return r.constructor=t,Object.setPrototypeOf(r,t.prototype),r.name="NoUserPoolError",r}return x(t,e),t}(k),M={noConfig:{message:C.a.DEFAULT_MSG,log:"\n Error: Amplify has not been configured correctly.\n This error is typically caused by one of the following scenarios:\n\n 1. Make sure you're passing the awsconfig object to Amplify.configure() in your app's entry point\n See https://aws-amplify.github.io/docs/js/authentication#configure-your-app for more information\n \n 2. There might be multiple conflicting versions of amplify packages in your node_modules.\n\t\t\t\tRefer to our docs site for help upgrading Amplify packages (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js)\n "},missingAuthConfig:{message:C.a.DEFAULT_MSG,log:"\n Error: Amplify has not been configured correctly. \n The configuration object is missing required auth properties.\n This error is typically caused by one of the following scenarios:\n\n 1. Did you run `amplify push` after adding auth via `amplify add auth`?\n See https://aws-amplify.github.io/docs/js/authentication#amplify-project-setup for more information\n\n 2. This could also be caused by multiple conflicting versions of amplify packages, see (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js) for help upgrading Amplify packages.\n "},emptyUsername:{message:C.a.EMPTY_USERNAME},invalidUsername:{message:C.a.INVALID_USERNAME},emptyPassword:{message:C.a.EMPTY_PASSWORD},emptyCode:{message:C.a.EMPTY_CODE},signUpError:{message:C.a.SIGN_UP_ERROR,log:"The first parameter should either be non-null string or object"},noMFA:{message:C.a.NO_MFA},invalidMFA:{message:C.a.INVALID_MFA},emptyChallengeResponse:{message:C.a.EMPTY_CHALLENGE},noUserSession:{message:C.a.NO_USER_SESSION},deviceConfig:{message:C.a.DEVICE_CONFIG},networkError:{message:C.a.NETWORK_ERROR},default:{message:C.a.DEFAULT_MSG}};function j(e){return(j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var R=function(){return(R=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},D=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},U=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},F=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},L=new i.a("AuthClass"),B="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",q=function(e,t,n){o.a.dispatch("auth",{event:e,data:t,message:n},"Auth",B)},z=new(function(){function e(e){var t=this;this.userPool=null,this.user=null,this.oAuthFlowInProgress=!1,this.Credentials=s.a,this.wrapRefreshSessionCallback=function(e){return function(t,n){return n?q("tokenRefresh",void 0,"New token retrieved"):q("tokenRefresh_failure",t,"Failed to retrieve new token"),e(t,n)}},this.configure(e),this.currentCredentials=this.currentCredentials.bind(this),this.currentUserCredentials=this.currentUserCredentials.bind(this),o.a.listen("auth",(function(e){switch(e.payload.event){case"signIn":t._storage.setItem("amplify-signin-with-hostedUI","false");break;case"signOut":t._storage.removeItem("amplify-signin-with-hostedUI");break;case"cognitoHostedUI":t._storage.setItem("amplify-signin-with-hostedUI","true")}}))}return e.prototype.getModuleName=function(){return"Auth"},e.prototype.configure=function(e){var t=this;if(!e)return this._config||{};L.debug("configure Auth");var n=Object.assign({},this._config,a.a.parseMobilehubConfig(e).Auth,e);this._config=n;var i=this._config,o=i.userPoolId,s=i.userPoolWebClientId,f=i.cookieStorage,d=i.oauth,p=i.region,v=i.identityPoolId,y=i.mandatorySignIn,g=i.refreshHandlers,m=i.identityPoolRegion,b=i.clientMetadata,w=i.endpoint;if(this._config.storage){if(!this._isValidAuthStorage(this._config.storage))throw L.error("The storage in the Auth config is not valid!"),new Error("Empty storage object");this._storage=this._config.storage}else this._storage=f?new h.i(f):e.ssr?new u.a:(new c.a).getStorage();if(this._storageSync=Promise.resolve(),"function"==typeof this._storage.sync&&(this._storageSync=this._storage.sync()),o){var S={UserPoolId:o,ClientId:s,endpoint:w};S.Storage=this._storage,this.userPool=new h.g(S,this.wrapRefreshSessionCallback)}this.Credentials.configure({mandatorySignIn:y,region:m||p,userPoolId:o,identityPoolId:v,refreshHandlers:g,storage:this._storage});var _=d?Object(r.d)(this._config.oauth)?d:d.awsCognito:void 0;if(_){var E=Object.assign({cognitoClientId:s,UserPoolId:o,domain:_.domain,scopes:_.scope,redirectSignIn:_.redirectSignIn,redirectSignOut:_.redirectSignOut,responseType:_.responseType,Storage:this._storage,urlOpener:_.urlOpener,clientMetadata:b},_.options);this._oAuthHandler=new T({scopes:E.scopes,config:E,cognitoClientId:E.cognitoClientId});var A={};!function(e){if(l.a.browserOrNode().isBrowser&&window.location)e({url:window.location.href});else if(!l.a.browserOrNode().isNode)throw new Error("Not supported")}((function(e){var n=e.url;A[n]||(A[n]=!0,t._handleAuthResponse(n))}))}return q("configured",null,"The Auth category has been configured successfully"),this._config},e.prototype.signUp=function(e){for(var t=this,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];if(!this.userPool)return this.rejectNoUserPool();var o,s=null,a=null,u=[],c=null;if(e&&"string"==typeof e){s=e,a=n?n[0]:null;var l=n?n[1]:null,f=n?n[2]:null;l&&u.push(new h.f({Name:"email",Value:l})),f&&u.push(new h.f({Name:"phone_number",Value:f}))}else{if(!e||"object"!==j(e))return this.rejectAuthError(r.a.SignUpError);s=e.username,a=e.password,e&&e.clientMetadata?o=e.clientMetadata:this._config.clientMetadata&&(o=this._config.clientMetadata);var d=e.attributes;d&&Object.keys(d).map((function(e){u.push(new h.f({Name:e,Value:d[e]}))}));var p=e.validationData;p&&(c=[],Object.keys(p).map((function(e){c.push(new h.f({Name:e,Value:p[e]}))})))}return s?a?(L.debug("signUp attrs:",u),L.debug("signUp validation data:",c),new Promise((function(e,n){t.userPool.signUp(s,a,u,c,(function(t,r){t?(q("signUp_failure",t,s+" failed to signup"),n(t)):(q("signUp",r,s+" has signed up successfully"),e(r))}),o)}))):this.rejectAuthError(r.a.EmptyPassword):this.rejectAuthError(r.a.EmptyUsername)},e.prototype.confirmSignUp=function(e,t,n){if(!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(r.a.EmptyUsername);if(!t)return this.rejectAuthError(r.a.EmptyCode);var i,o=this.createCognitoUser(e),s=!n||"boolean"!=typeof n.forceAliasCreation||n.forceAliasCreation;return n&&n.clientMetadata?i=n.clientMetadata:this._config.clientMetadata&&(i=this._config.clientMetadata),new Promise((function(e,n){o.confirmRegistration(t,s,(function(t,r){t?n(t):e(r)}),i)}))},e.prototype.resendSignUp=function(e,t){if(void 0===t&&(t=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(r.a.EmptyUsername);var n=this.createCognitoUser(e);return new Promise((function(e,r){n.resendConfirmationCode((function(t,n){t?r(t):e(n)}),t)}))},e.prototype.signIn=function(e,t,n){if(void 0===n&&(n=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();var i=null,o=null,s={};if("string"==typeof e)i=e,o=t;else{if(!Object(r.g)(e))return this.rejectAuthError(r.a.InvalidUsername);void 0!==t&&L.warn("The password should be defined under the first parameter object!"),i=e.username,o=e.password,s=e.validationData}if(!i)return this.rejectAuthError(r.a.EmptyUsername);var a=new h.a({Username:i,Password:o,ValidationData:s,ClientMetadata:n});return o?this.signInWithPassword(a):this.signInWithoutPassword(a)},e.prototype.authCallbacks=function(e,t,n){var r=this,i=this;return{onSuccess:function(o){return D(r,void 0,void 0,(function(){var r,s,a,u;return U(this,(function(c){switch(c.label){case 0:L.debug(o),delete e.challengeName,delete e.challengeParam,c.label=1;case 1:return c.trys.push([1,4,5,9]),[4,this.Credentials.clear()];case 2:return c.sent(),[4,this.Credentials.set(o,"session")];case 3:return r=c.sent(),L.debug("succeed to get cognito credentials",r),[3,9];case 4:return s=c.sent(),L.debug("cannot get cognito credentials",s),[3,9];case 5:return c.trys.push([5,7,,8]),[4,this.currentUserPoolUser()];case 6:return a=c.sent(),i.user=a,q("signIn",a,"A user "+e.getUsername()+" has been signed in"),t(a),[3,8];case 7:return u=c.sent(),L.error("Failed to get the signed in user",u),n(u),[3,8];case 8:return[7];case 9:return[2]}}))}))},onFailure:function(t){L.debug("signIn failure",t),q("signIn_failure",t,e.getUsername()+" failed to signin"),n(t)},customChallenge:function(n){L.debug("signIn custom challenge answer required"),e.challengeName="CUSTOM_CHALLENGE",e.challengeParam=n,t(e)},mfaRequired:function(n,r){L.debug("signIn MFA required"),e.challengeName=n,e.challengeParam=r,t(e)},mfaSetup:function(n,r){L.debug("signIn mfa setup",n),e.challengeName=n,e.challengeParam=r,t(e)},newPasswordRequired:function(n,r){L.debug("signIn new password"),e.challengeName="NEW_PASSWORD_REQUIRED",e.challengeParam={userAttributes:n,requiredAttributes:r},t(e)},totpRequired:function(n,r){L.debug("signIn totpRequired"),e.challengeName=n,e.challengeParam=r,t(e)},selectMFAType:function(n,r){L.debug("signIn selectMFAType",n),e.challengeName=n,e.challengeParam=r,t(e)}}},e.prototype.signInWithPassword=function(e){var t=this;if(this.pendingSignIn)throw new Error("Pending sign-in attempt already in progress");var n=this.createCognitoUser(e.getUsername());return this.pendingSignIn=new Promise((function(r,i){n.authenticateUser(e,t.authCallbacks(n,(function(e){t.pendingSignIn=null,r(e)}),(function(e){t.pendingSignIn=null,i(e)})))})),this.pendingSignIn},e.prototype.signInWithoutPassword=function(e){var t=this,n=this.createCognitoUser(e.getUsername());return n.setAuthenticationFlowType("CUSTOM_AUTH"),new Promise((function(r,i){n.initiateAuth(e,t.authCallbacks(n,r,i))}))},e.prototype.getMFAOptions=function(e){return new Promise((function(t,n){e.getMFAOptions((function(e,r){if(e)return L.debug("get MFA Options failed",e),void n(e);L.debug("get MFA options success",r),t(r)}))}))},e.prototype.getPreferredMFA=function(e,t){var n=this,r=this;return new Promise((function(i,o){var s=n._config.clientMetadata,a=!!t&&t.bypassCache;e.getUserData((function(t,s){return D(n,void 0,void 0,(function(){var n,a;return U(this,(function(u){switch(u.label){case 0:if(!t)return[3,5];if(L.debug("getting preferred mfa failed",t),!this.isSessionInvalid(t))return[3,4];u.label=1;case 1:return u.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return u.sent(),[3,4];case 3:return n=u.sent(),o(new Error("Session is invalid due to: "+t.message+" and failed to clean up invalid session: "+n.message)),[2];case 4:return o(t),[2];case 5:return(a=r._getMfaTypeFromUserData(s))?(i(a),[2]):(o("invalid MFA Type"),[2])}}))}))}),{bypassCache:a,clientMetadata:s})}))},e.prototype._getMfaTypeFromUserData=function(e){var t=null,n=e.PreferredMfaSetting;if(n)t=n;else{var r=e.UserMFASettingList;if(r)0===r.length?t="NOMFA":L.debug("invalid case for getPreferredMFA",e);else t=e.MFAOptions?"SMS_MFA":"NOMFA"}return t},e.prototype._getUserData=function(e,t){var n=this;return new Promise((function(r,i){e.getUserData((function(t,o){return D(n,void 0,void 0,(function(){var n;return U(this,(function(s){switch(s.label){case 0:if(!t)return[3,5];if(L.debug("getting user data failed",t),!this.isSessionInvalid(t))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return s.sent(),[3,4];case 3:return n=s.sent(),i(new Error("Session is invalid due to: "+t.message+" and failed to clean up invalid session: "+n.message)),[2];case 4:return i(t),[2];case 5:r(o),s.label=6;case 6:return[2]}}))}))}),t)}))},e.prototype.setPreferredMFA=function(e,t){return D(this,void 0,void 0,(function(){var n,i,o,s,a,u,c=this;return U(this,(function(l){switch(l.label){case 0:return n=this._config.clientMetadata,[4,this._getUserData(e,{bypassCache:!0,clientMetadata:n})];case 1:switch(i=l.sent(),o=null,s=null,t){case"TOTP":case"SOFTWARE_TOKEN_MFA":return[3,2];case"SMS":case"SMS_MFA":return[3,3];case"NOMFA":return[3,4]}return[3,6];case 2:return s={PreferredMfa:!0,Enabled:!0},[3,7];case 3:return o={PreferredMfa:!0,Enabled:!0},[3,7];case 4:return a=i.UserMFASettingList,[4,this._getMfaTypeFromUserData(i)];case 5:if("NOMFA"===(u=l.sent()))return[2,Promise.resolve("No change for mfa type")];if("SMS_MFA"===u)o={PreferredMfa:!1,Enabled:!1};else{if("SOFTWARE_TOKEN_MFA"!==u)return[2,this.rejectAuthError(r.a.InvalidMFA)];s={PreferredMfa:!1,Enabled:!1}}return a&&0!==a.length&&a.forEach((function(e){"SMS_MFA"===e?o={PreferredMfa:!1,Enabled:!1}:"SOFTWARE_TOKEN_MFA"===e&&(s={PreferredMfa:!1,Enabled:!1})})),[3,7];case 6:return L.debug("no validmfa method provided"),[2,this.rejectAuthError(r.a.NoMFA)];case 7:return this,[2,new Promise((function(t,r){e.setUserMfaPreference(o,s,(function(i,o){if(i)return L.debug("Set user mfa preference error",i),r(i);L.debug("Set user mfa success",o),L.debug("Caching the latest user data into local"),e.getUserData((function(n,i){return D(c,void 0,void 0,(function(){var i;return U(this,(function(s){switch(s.label){case 0:if(!n)return[3,5];if(L.debug("getting user data failed",n),!this.isSessionInvalid(n))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return s.sent(),[3,4];case 3:return i=s.sent(),r(new Error("Session is invalid due to: "+n.message+" and failed to clean up invalid session: "+i.message)),[2];case 4:return[2,r(n)];case 5:return[2,t(o)]}}))}))}),{bypassCache:!0,clientMetadata:n})}))}))]}}))}))},e.prototype.disableSMS=function(e){return new Promise((function(t,n){e.disableMFA((function(e,r){if(e)return L.debug("disable mfa failed",e),void n(e);L.debug("disable mfa succeed",r),t(r)}))}))},e.prototype.enableSMS=function(e){return new Promise((function(t,n){e.enableMFA((function(e,r){if(e)return L.debug("enable mfa failed",e),void n(e);L.debug("enable mfa succeed",r),t(r)}))}))},e.prototype.setupTOTP=function(e){return new Promise((function(t,n){e.associateSoftwareToken({onFailure:function(e){L.debug("associateSoftwareToken failed",e),n(e)},associateSecretCode:function(e){L.debug("associateSoftwareToken sucess",e),t(e)}})}))},e.prototype.verifyTotpToken=function(e,t){return L.debug("verification totp token",e,t),new Promise((function(n,r){e.verifySoftwareToken(t,"My TOTP device",{onFailure:function(e){L.debug("verifyTotpToken failed",e),r(e)},onSuccess:function(t){q("signIn",e,"A user "+e.getUsername()+" has been signed in"),L.debug("verifyTotpToken success",t),n(t)}})}))},e.prototype.confirmSignIn=function(e,t,n,i){var o=this;if(void 0===i&&(i=this._config.clientMetadata),!t)return this.rejectAuthError(r.a.EmptyCode);var s=this;return new Promise((function(r,a){e.sendMFACode(t,{onSuccess:function(t){return D(o,void 0,void 0,(function(){var n,i;return U(this,(function(o){switch(o.label){case 0:L.debug(t),o.label=1;case 1:return o.trys.push([1,4,5,6]),[4,this.Credentials.clear()];case 2:return o.sent(),[4,this.Credentials.set(t,"session")];case 3:return n=o.sent(),L.debug("succeed to get cognito credentials",n),[3,6];case 4:return i=o.sent(),L.debug("cannot get cognito credentials",i),[3,6];case 5:return s.user=e,q("signIn",e,"A user "+e.getUsername()+" has been signed in"),r(e),[7];case 6:return[2]}}))}))},onFailure:function(e){L.debug("confirm signIn failure",e),a(e)}},n,i)}))},e.prototype.completeNewPassword=function(e,t,n,i){var o=this;if(void 0===n&&(n={}),void 0===i&&(i=this._config.clientMetadata),!t)return this.rejectAuthError(r.a.EmptyPassword);var s=this;return new Promise((function(r,a){e.completeNewPasswordChallenge(t,n,{onSuccess:function(t){return D(o,void 0,void 0,(function(){var n,i;return U(this,(function(o){switch(o.label){case 0:L.debug(t),o.label=1;case 1:return o.trys.push([1,4,5,6]),[4,this.Credentials.clear()];case 2:return o.sent(),[4,this.Credentials.set(t,"session")];case 3:return n=o.sent(),L.debug("succeed to get cognito credentials",n),[3,6];case 4:return i=o.sent(),L.debug("cannot get cognito credentials",i),[3,6];case 5:return s.user=e,q("signIn",e,"A user "+e.getUsername()+" has been signed in"),r(e),[7];case 6:return[2]}}))}))},onFailure:function(e){L.debug("completeNewPassword failure",e),q("completeNewPassword_failure",e,o.user+" failed to complete the new password flow"),a(e)},mfaRequired:function(t,n){L.debug("signIn MFA required"),e.challengeName=t,e.challengeParam=n,r(e)},mfaSetup:function(t,n){L.debug("signIn mfa setup",t),e.challengeName=t,e.challengeParam=n,r(e)},totpRequired:function(t,n){L.debug("signIn mfa setup",t),e.challengeName=t,e.challengeParam=n,r(e)}},i)}))},e.prototype.sendCustomChallengeAnswer=function(e,t,n){var i=this;if(void 0===n&&(n=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!t)return this.rejectAuthError(r.a.EmptyChallengeResponse);return new Promise((function(r,o){e.sendCustomChallengeAnswer(t,i.authCallbacks(e,r,o),n)}))},e.prototype.deleteUserAttributes=function(e,t){var n=this;return new Promise((function(r,i){n.userSession(e).then((function(n){e.deleteAttributes(t,(function(e,t){return e?i(e):r(t)}))}))}))},e.prototype.deleteUser=function(){return D(this,void 0,void 0,(function(){var e,t,n=this;return U(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this._storageSync];case 1:return r.sent(),[3,3];case 2:throw e=r.sent(),L.debug("Failed to sync cache info into memory",e),new Error(e);case 3:return t=this._oAuthHandler&&"true"===this._storage.getItem("amplify-signin-with-hostedUI"),[2,new Promise((function(e,r){return D(n,void 0,void 0,(function(){var n,i=this;return U(this,(function(o){if(this.userPool){if(!(n=this.userPool.getCurrentUser()))return L.debug("Failed to get user from user pool"),[2,r(new Error("No current user."))];n.getSession((function(o,s){return D(i,void 0,void 0,(function(){var i,s=this;return U(this,(function(a){switch(a.label){case 0:if(!o)return[3,5];if(L.debug("Failed to get the user session",o),!this.isSessionInvalid(o))return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(n)];case 2:return a.sent(),[3,4];case 3:return i=a.sent(),r(new Error("Session is invalid due to: "+o.message+" and failed to clean up invalid session: "+i.message)),[2];case 4:return[2,r(o)];case 5:n.deleteUser((function(i,o){if(i)r(i);else{q("userDeleted",o,"The authenticated user has been deleted."),n.signOut(),s.user=null;try{s.cleanCachedItems()}catch(e){L.debug("failed to clear cached items")}t?s.oAuthSignOutRedirect(e,r):(q("signOut",s.user,"A user has been signed out"),e(o))}})),a.label=6;case 6:return[2]}}))}))}))}else L.debug("no Congito User pool"),r(new Error("Cognito User pool does not exist"));return[2]}))}))}))]}}))}))},e.prototype.updateUserAttributes=function(e,t,n){void 0===n&&(n=this._config.clientMetadata);var r=[],i=this;return new Promise((function(o,s){i.userSession(e).then((function(i){for(var a in t)if("sub"!==a&&a.indexOf("_verified")<0){var u={Name:a,Value:t[a]};r.push(u)}e.updateAttributes(r,(function(e,t){return e?s(e):o(t)}),n)}))}))},e.prototype.userAttributes=function(e){var t=this;return new Promise((function(n,r){t.userSession(e).then((function(t){e.getUserAttributes((function(e,t){e?r(e):n(t)}))}))}))},e.prototype.verifiedContact=function(e){var t=this;return this.userAttributes(e).then((function(e){var n=t.attributesToObject(e),r={},i={};return n.email&&(n.email_verified?i.email=n.email:r.email=n.email),n.phone_number&&(n.phone_number_verified?i.phone_number=n.phone_number:r.phone_number=n.phone_number),{verified:i,unverified:r}}))},e.prototype.isErrorWithMessage=function(e){return"object"===j(e)&&Object.prototype.hasOwnProperty.call(e,"message")},e.prototype.isTokenRevokedError=function(e){return this.isErrorWithMessage(e)&&"Access Token has been revoked"===e.message},e.prototype.isRefreshTokenRevokedError=function(e){return this.isErrorWithMessage(e)&&"Refresh Token has been revoked"===e.message},e.prototype.isUserDisabledError=function(e){return this.isErrorWithMessage(e)&&"User is disabled."===e.message},e.prototype.isUserDoesNotExistError=function(e){return this.isErrorWithMessage(e)&&"User does not exist."===e.message},e.prototype.isRefreshTokenExpiredError=function(e){return this.isErrorWithMessage(e)&&"Refresh Token has expired"===e.message},e.prototype.isSignedInHostedUI=function(){return this._oAuthHandler&&"true"===this._storage.getItem("amplify-signin-with-hostedUI")},e.prototype.isSessionInvalid=function(e){return this.isUserDisabledError(e)||this.isUserDoesNotExistError(e)||this.isTokenRevokedError(e)||this.isRefreshTokenRevokedError(e)||this.isRefreshTokenExpiredError(e)},e.prototype.cleanUpInvalidSession=function(e){return D(this,void 0,void 0,(function(){var t=this;return U(this,(function(n){switch(n.label){case 0:e.signOut(),this.user=null,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.cleanCachedItems()];case 2:return n.sent(),[3,4];case 3:return n.sent(),L.debug("failed to clear cached items"),[3,4];case 4:return this.isSignedInHostedUI()?[2,new Promise((function(e,n){t.oAuthSignOutRedirect(e,n)}))]:(q("signOut",this.user,"A user has been signed out"),[2])}}))}))},e.prototype.currentUserPoolUser=function(e){var t=this;return this.userPool?new Promise((function(n,r){t._storageSync.then((function(){return D(t,void 0,void 0,(function(){var t,i,s=this;return U(this,(function(a){switch(a.label){case 0:return this.isOAuthInProgress()?(L.debug("OAuth signIn in progress, waiting for resolution..."),[4,new Promise((function(e){var t=setTimeout((function(){L.debug("OAuth signIn in progress timeout"),o.a.remove("auth",n),e()}),1e4);function n(r){var i=r.payload.event;"cognitoHostedUI"!==i&&"cognitoHostedUI_failure"!==i||(L.debug("OAuth signIn resolved: "+i),clearTimeout(t),o.a.remove("auth",n),e())}o.a.listen("auth",n)}))]):[3,2];case 1:a.sent(),a.label=2;case 2:return(t=this.userPool.getCurrentUser())?(i=this._config.clientMetadata,t.getSession((function(i,o){return D(s,void 0,void 0,(function(){var s,a,u,c,l=this;return U(this,(function(f){switch(f.label){case 0:if(!i)return[3,5];if(L.debug("Failed to get the user session",i),!this.isSessionInvalid(i))return[3,4];f.label=1;case 1:return f.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(t)];case 2:return f.sent(),[3,4];case 3:return s=f.sent(),r(new Error("Session is invalid due to: "+i.message+" and failed to clean up invalid session: "+s.message)),[2];case 4:return r(i),[2];case 5:return(a=!!e&&e.bypassCache)?[4,this.Credentials.clear()]:[3,7];case 6:f.sent(),f.label=7;case 7:return u=this._config.clientMetadata,c=o.getAccessToken().decodePayload().scope,(void 0===c?"":c).split(" ").includes("aws.cognito.signin.user.admin")?(t.getUserData((function(e,i){return D(l,void 0,void 0,(function(){var o,s,a,u,c,l,f;return U(this,(function(d){switch(d.label){case 0:if(!e)return[3,7];if(L.debug("getting user data failed",e),!this.isSessionInvalid(e))return[3,5];d.label=1;case 1:return d.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(t)];case 2:return d.sent(),[3,4];case 3:return o=d.sent(),r(new Error("Session is invalid due to: "+e.message+" and failed to clean up invalid session: "+o.message)),[2];case 4:return r(e),[3,6];case 5:n(t),d.label=6;case 6:return[2];case 7:for(s=i.PreferredMfaSetting||"NOMFA",a=[],u=0;u<i.UserAttributes.length;u++)c={Name:i.UserAttributes[u].Name,Value:i.UserAttributes[u].Value},l=new h.f(c),a.push(l);return f=this.attributesToObject(a),Object.assign(t,{attributes:f,preferredMFA:s}),[2,n(t)]}}))}))}),{bypassCache:a,clientMetadata:u}),[2]):(L.debug("Unable to get the user data because the aws.cognito.signin.user.admin is not in the scopes of the access token"),[2,n(t)])}}))}))}),{clientMetadata:i}),[2]):(L.debug("Failed to get user from user pool"),r("No current user"),[2])}}))}))})).catch((function(e){return L.debug("Failed to sync cache info into memory",e),r(e)}))})):this.rejectNoUserPool()},e.prototype.isOAuthInProgress=function(){return this.oAuthFlowInProgress},e.prototype.currentAuthenticatedUser=function(e){return D(this,void 0,void 0,(function(){var t,n,r,i,o;return U(this,(function(s){switch(s.label){case 0:L.debug("getting current authenticated user"),t=null,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._storageSync];case 2:return s.sent(),[3,4];case 3:throw n=s.sent(),L.debug("Failed to sync cache info into memory",n),n;case 4:try{(r=JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")))&&(t=R(R({},r.user),{token:r.token}))}catch(e){L.debug("cannot load federated user from auth storage")}return t?(this.user=t,L.debug("get current authenticated federated user",this.user),[2,this.user]):[3,5];case 5:L.debug("get current authenticated userpool user"),i=null,s.label=6;case 6:return s.trys.push([6,8,,9]),[4,this.currentUserPoolUser(e)];case 7:return i=s.sent(),[3,9];case 8:return"No userPool"===(o=s.sent())&&L.error("Cannot get the current user because the user pool is missing. Please make sure the Auth module is configured with a valid Cognito User Pool ID"),L.debug("The user is not authenticated by the error",o),[2,Promise.reject("The user is not authenticated")];case 9:return this.user=i,[2,this.user]}}))}))},e.prototype.currentSession=function(){var e=this;return L.debug("Getting current session"),this.userPool?new Promise((function(t,n){e.currentUserPoolUser().then((function(r){e.userSession(r).then((function(e){t(e)})).catch((function(e){L.debug("Failed to get the current session",e),n(e)}))})).catch((function(e){L.debug("Failed to get the current user",e),n(e)}))})):this.rejectNoUserPool()},e.prototype.userSession=function(e){var t=this;if(!e)return L.debug("the user is null"),this.rejectAuthError(r.a.NoUserSession);var n=this._config.clientMetadata;return new Promise((function(r,i){L.debug("Getting the session from this user:",e),e.getSession((function(n,o){return D(t,void 0,void 0,(function(){var t;return U(this,(function(s){switch(s.label){case 0:if(!n)return[3,5];if(L.debug("Failed to get the session from user",e),!this.isSessionInvalid(n))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return s.sent(),[3,4];case 3:return t=s.sent(),i(new Error("Session is invalid due to: "+n.message+" and failed to clean up invalid session: "+t.message)),[2];case 4:return i(n),[2];case 5:return L.debug("Succeed to get the user session",o),r(o),[2]}}))}))}),{clientMetadata:n})}))},e.prototype.currentUserCredentials=function(){return D(this,void 0,void 0,(function(){var e,t,n=this;return U(this,(function(r){switch(r.label){case 0:L.debug("Getting current user credentials"),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._storageSync];case 2:return r.sent(),[3,4];case 3:throw e=r.sent(),L.debug("Failed to sync cache info into memory",e),e;case 4:t=null;try{t=JSON.parse(this._storage.getItem("aws-amplify-federatedInfo"))}catch(e){L.debug("failed to get or parse item aws-amplify-federatedInfo",e)}return t?[2,this.Credentials.refreshFederatedToken(t)]:[2,this.currentSession().then((function(e){return L.debug("getting session success",e),n.Credentials.set(e,"session")})).catch((function(){return L.debug("getting guest credentials"),n.Credentials.set(null,"guest")}))]}}))}))},e.prototype.currentCredentials=function(){return L.debug("getting current credentials"),this.Credentials.get()},e.prototype.verifyUserAttribute=function(e,t,n){return void 0===n&&(n=this._config.clientMetadata),new Promise((function(r,i){e.getAttributeVerificationCode(t,{onSuccess:function(e){return r(e)},onFailure:function(e){return i(e)}},n)}))},e.prototype.verifyUserAttributeSubmit=function(e,t,n){return n?new Promise((function(r,i){e.verifyAttribute(t,n,{onSuccess:function(e){r(e)},onFailure:function(e){i(e)}})})):this.rejectAuthError(r.a.EmptyCode)},e.prototype.verifyCurrentUserAttribute=function(e){var t=this;return t.currentUserPoolUser().then((function(n){return t.verifyUserAttribute(n,e)}))},e.prototype.verifyCurrentUserAttributeSubmit=function(e,t){var n=this;return n.currentUserPoolUser().then((function(r){return n.verifyUserAttributeSubmit(r,e,t)}))},e.prototype.cognitoIdentitySignOut=function(e,t){return D(this,void 0,void 0,(function(){var n,r,i=this;return U(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this._storageSync];case 1:return o.sent(),[3,3];case 2:throw n=o.sent(),L.debug("Failed to sync cache info into memory",n),n;case 3:return r=this._oAuthHandler&&"true"===this._storage.getItem("amplify-signin-with-hostedUI"),[2,new Promise((function(n,o){if(e&&e.global){L.debug("user global sign out",t);var s=i._config.clientMetadata;t.getSession((function(e,s){return D(i,void 0,void 0,(function(){var i,s=this;return U(this,(function(a){switch(a.label){case 0:if(!e)return[3,5];if(L.debug("failed to get the user session",e),!this.isSessionInvalid(e))return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(t)];case 2:return a.sent(),[3,4];case 3:return i=a.sent(),o(new Error("Session is invalid due to: "+e.message+" and failed to clean up invalid session: "+i.message)),[2];case 4:return[2,o(e)];case 5:return t.globalSignOut({onSuccess:function(e){if(L.debug("global sign out success"),!r)return n();s.oAuthSignOutRedirect(n,o)},onFailure:function(e){return L.debug("global sign out failed",e),o(e)}}),[2]}}))}))}),{clientMetadata:s})}else L.debug("user sign out",t),t.signOut((function(){if(!r)return n();i.oAuthSignOutRedirect(n,o)}))}))]}}))}))},e.prototype.oAuthSignOutRedirect=function(e,t){l.a.browserOrNode().isBrowser?this.oAuthSignOutRedirectOrReject(t):this.oAuthSignOutAndResolve(e)},e.prototype.oAuthSignOutAndResolve=function(e){this._oAuthHandler.signOut(),e()},e.prototype.oAuthSignOutRedirectOrReject=function(e){this._oAuthHandler.signOut(),setTimeout((function(){return e(Error("Signout timeout fail"))}),3e3)},e.prototype.signOut=function(e){return D(this,void 0,void 0,(function(){var t;return U(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.cleanCachedItems()];case 1:return n.sent(),[3,3];case 2:return n.sent(),L.debug("failed to clear cached items"),[3,3];case 3:return this.userPool?(t=this.userPool.getCurrentUser())?[4,this.cognitoIdentitySignOut(e,t)]:[3,5]:[3,7];case 4:return n.sent(),[3,6];case 5:L.debug("no current Cognito user"),n.label=6;case 6:return[3,8];case 7:L.debug("no Cognito User pool"),n.label=8;case 8:return q("signOut",this.user,"A user has been signed out"),this.user=null,[2]}}))}))},e.prototype.cleanCachedItems=function(){return D(this,void 0,void 0,(function(){return U(this,(function(e){switch(e.label){case 0:return[4,this.Credentials.clear()];case 1:return e.sent(),[2]}}))}))},e.prototype.changePassword=function(e,t,n,r){var i=this;return void 0===r&&(r=this._config.clientMetadata),new Promise((function(o,s){i.userSession(e).then((function(i){e.changePassword(t,n,(function(e,t){return e?(L.debug("change password failure",e),s(e)):o(t)}),r)}))}))},e.prototype.forgotPassword=function(e,t){if(void 0===t&&(t=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(r.a.EmptyUsername);var n=this.createCognitoUser(e);return new Promise((function(r,i){n.forgotPassword({onSuccess:function(){r()},onFailure:function(t){L.debug("forgot password failure",t),q("forgotPassword_failure",t,e+" forgotPassword failed"),i(t)},inputVerificationCode:function(t){q("forgotPassword",n,e+" has initiated forgot password flow"),r(t)}},t)}))},e.prototype.forgotPasswordSubmit=function(e,t,n,i){if(void 0===i&&(i=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(r.a.EmptyUsername);if(!t)return this.rejectAuthError(r.a.EmptyCode);if(!n)return this.rejectAuthError(r.a.EmptyPassword);var o=this.createCognitoUser(e);return new Promise((function(r,s){o.confirmPassword(t,n,{onSuccess:function(t){q("forgotPasswordSubmit",o,e+" forgotPasswordSubmit successful"),r(t)},onFailure:function(t){q("forgotPasswordSubmit_failure",t,e+" forgotPasswordSubmit failed"),s(t)}},i)}))},e.prototype.currentUserInfo=function(){return D(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return U(this,(function(a){switch(a.label){case 0:return(e=this.Credentials.getCredSource())&&"aws"!==e&&"userPool"!==e?[3,9]:[4,this.currentUserPoolUser().catch((function(e){return L.error(e)}))];case 1:if(!(s=a.sent()))return[2,null];a.label=2;case 2:return a.trys.push([2,8,,9]),[4,this.userAttributes(s)];case 3:t=a.sent(),n=this.attributesToObject(t),r=null,a.label=4;case 4:return a.trys.push([4,6,,7]),[4,this.currentCredentials()];case 5:return r=a.sent(),[3,7];case 6:return i=a.sent(),L.debug("Failed to retrieve credentials while getting current user info",i),[3,7];case 7:return[2,{id:r?r.identityId:void 0,username:s.getUsername(),attributes:n}];case 8:return o=a.sent(),L.error("currentUserInfo error",o),[2,{}];case 9:return"federated"===e?[2,(s=this.user)||{}]:[2]}}))}))},e.prototype.federatedSignIn=function(e,t,n){return D(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p;return U(this,(function(v){switch(v.label){case 0:if(!this._config.identityPoolId&&!this._config.userPoolId)throw new Error("Federation requires either a User Pool or Identity Pool in config");if(void 0===e&&this._config.identityPoolId&&!this._config.userPoolId)throw new Error("Federation with Identity Pools requires tokens passed as arguments");return Object(r.e)(e)||Object(r.f)(e)||Object(r.c)(e)||void 0===e?(i=e||{provider:r.b.Cognito},u=Object(r.e)(i)?i.provider:i.customProvider,Object(r.e)(i),o=i.customState,this._config.userPoolId&&(s=Object(r.d)(this._config.oauth)?this._config.userPoolWebClientId:this._config.oauth.clientID,a=Object(r.d)(this._config.oauth)?this._config.oauth.redirectSignIn:this._config.oauth.redirectUri,this._oAuthHandler.oauthSignIn(this._config.oauth.responseType,this._config.oauth.domain,a,s,u,o)),[3,4]):[3,1];case 1:u=e;try{(c=JSON.stringify(JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")).user))&&L.warn("There is already a signed in user: "+c+" in your app.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tYou should not call Auth.federatedSignIn method again as it may cause unexpected behavior.")}catch(e){}return l=t.token,f=t.identity_id,d=t.expires_at,[4,this.Credentials.set({provider:u,token:l,identity_id:f,user:n,expires_at:d},"federation")];case 2:return h=v.sent(),[4,this.currentAuthenticatedUser()];case 3:return p=v.sent(),q("signIn",p,"A user "+p.username+" has been signed in"),L.debug("federated sign in credentials",h),[2,h];case 4:return[2]}}))}))},e.prototype._handleAuthResponse=function(e){return D(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,f,d,v,y,g;return U(this,(function(m){switch(m.label){case 0:if(this.oAuthFlowInProgress)return L.debug("Skipping URL "+e+" current flow in progress"),[2];m.label=1;case 1:if(m.trys.push([1,,8,9]),this.oAuthFlowInProgress=!0,!this._config.userPoolId)throw new Error("OAuth responses require a User Pool defined in config");if(q("parsingCallbackUrl",{url:e},"The callback url is being parsed"),t=e||(l.a.browserOrNode().isBrowser?window.location.href:""),n=!!(Object(p.parse)(t).query||"").split("&").map((function(e){return e.split("=")})).find((function(e){var t=F(e,1)[0];return"code"===t||"error"===t})),r=!!(Object(p.parse)(t).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).find((function(e){var t=F(e,1)[0];return"access_token"===t||"error"===t})),!n&&!r)return[3,7];this._storage.setItem("amplify-redirected-from-hosted-ui","true"),m.label=2;case 2:return m.trys.push([2,6,,7]),[4,this._oAuthHandler.handleAuthResponse(t)];case 3:return i=m.sent(),o=i.accessToken,s=i.idToken,a=i.refreshToken,u=i.state,c=new h.h({IdToken:new h.c({IdToken:s}),RefreshToken:new h.d({RefreshToken:a}),AccessToken:new h.b({AccessToken:o})}),f=void 0,this._config.identityPoolId?[4,this.Credentials.set(c,"session")]:[3,5];case 4:f=m.sent(),L.debug("AWS credentials",f),m.label=5;case 5:return d=/-/.test(u),(v=this.createCognitoUser(c.getIdToken().decodePayload()["cognito:username"])).setSignInUserSession(c),window&&void 0!==window.history&&window.history.replaceState({},null,this._config.oauth.redirectSignIn),q("signIn",v,"A user "+v.getUsername()+" has been signed in"),q("cognitoHostedUI",v,"A user "+v.getUsername()+" has been signed in via Cognito Hosted UI"),d&&(y=u.split("-").splice(1).join("-"),q("customOAuthState",y.match(/.{2}/g).map((function(e){return String.fromCharCode(parseInt(e,16))})).join(""),"State for user "+v.getUsername())),[2,f];case 6:return g=m.sent(),L.debug("Error in cognito hosted auth response",g),window&&void 0!==window.history&&window.history.replaceState({},null,this._config.oauth.redirectSignIn),q("signIn_failure",g,"The OAuth response flow failed"),q("cognitoHostedUI_failure",g,"A failure occurred when returning to the Cognito Hosted UI"),q("customState_failure",g,"A failure occurred when returning state"),[3,7];case 7:return[3,9];case 8:return this.oAuthFlowInProgress=!1,[7];case 9:return[2]}}))}))},e.prototype.essentialCredentials=function(e){return{accessKeyId:e.accessKeyId,sessionToken:e.sessionToken,secretAccessKey:e.secretAccessKey,identityId:e.identityId,authenticated:e.authenticated}},e.prototype.attributesToObject=function(e){var t=this,n={};return e&&e.map((function(e){"email_verified"===e.Name||"phone_number_verified"===e.Name?n[e.Name]=t.isTruthyString(e.Value)||!0===e.Value:n[e.Name]=e.Value})),n},e.prototype.isTruthyString=function(e){return"function"==typeof e.toLowerCase&&"true"===e.toLowerCase()},e.prototype.createCognitoUser=function(e){var t={Username:e,Pool:this.userPool};t.Storage=this._storage;var n=this._config.authenticationFlowType,r=new h.e(t);return n&&r.setAuthenticationFlowType(n),r},e.prototype._isValidAuthStorage=function(e){return!!e&&"function"==typeof e.getItem&&"function"==typeof e.setItem&&"function"==typeof e.removeItem&&"function"==typeof e.clear},e.prototype.noUserPoolErrorHandler=function(e){return!e||e.userPoolId&&e.identityPoolId?r.a.NoConfig:r.a.MissingAuthConfig},e.prototype.rejectAuthError=function(e){return Promise.reject(new k(e))},e.prototype.rejectNoUserPool=function(){var e=this.noUserPoolErrorHandler(this._config);return Promise.reject(new N(e))},e.prototype.rememberDevice=function(){return D(this,void 0,void 0,(function(){var e,t;return U(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.currentUserPoolUser()];case 1:return e=n.sent(),[3,3];case 2:return t=n.sent(),L.debug("The user is not authenticated by the error",t),[2,Promise.reject("The user is not authenticated")];case 3:return e.getCachedDeviceKeyAndPassword(),[2,new Promise((function(t,n){e.setDeviceStatusRemembered({onSuccess:function(e){t(e)},onFailure:function(e){"InvalidParameterException"===e.code?n(new k(r.a.DeviceConfig)):"NetworkError"===e.code?n(new k(r.a.NetworkError)):n(e)}})}))]}}))}))},e.prototype.forgetDevice=function(){return D(this,void 0,void 0,(function(){var e,t;return U(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.currentUserPoolUser()];case 1:return e=n.sent(),[3,3];case 2:return t=n.sent(),L.debug("The user is not authenticated by the error",t),[2,Promise.reject("The user is not authenticated")];case 3:return e.getCachedDeviceKeyAndPassword(),[2,new Promise((function(t,n){e.forgetDevice({onSuccess:function(e){t(e)},onFailure:function(e){"InvalidParameterException"===e.code?n(new k(r.a.DeviceConfig)):"NetworkError"===e.code?n(new k(r.a.NetworkError)):n(e)}})}))]}}))}))},e.prototype.fetchDevices=function(){return D(this,void 0,void 0,(function(){var e,t;return U(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.currentUserPoolUser()];case 1:return e=n.sent(),[3,3];case 2:throw t=n.sent(),L.debug("The user is not authenticated by the error",t),new Error("The user is not authenticated");case 3:return e.getCachedDeviceKeyAndPassword(),[2,new Promise((function(t,n){var i={onSuccess:function(e){var n=e.Devices.map((function(e){var t=e.DeviceAttributes.find((function(e){return"device_name"===e.Name}))||{};return{id:e.DeviceKey,name:t.Value}}));t(n)},onFailure:function(e){"InvalidParameterException"===e.code?n(new k(r.a.DeviceConfig)):"NetworkError"===e.code?n(new k(r.a.NetworkError)):n(e)}};e.listDevices(60,null,i)}))]}}))}))},e}())(null);d.a.register(z)},function(e,t,n){var r,i,o;e.exports=(o=n(13),i=(r=o).lib.WordArray,r.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp();for(var i=[],o=0;o<n;o+=3)for(var s=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a<n;a++)i.push(r.charAt(s>>>6*(3-a)&63));var u=r.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e){var t=e.length,n=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var o=0;o<n.length;o++)r[n.charCodeAt(o)]=o}var s=n.charAt(64);if(s){var a=e.indexOf(s);-1!==a&&(t=a)}return function(e,t,n){for(var r=[],o=0,s=0;s<t;s++)if(s%4){var a=n[e.charCodeAt(s-1)]<<s%4*2,u=n[e.charCodeAt(s)]>>>6-s%4*2,c=a|u;r[o>>>2]|=c<<24-o%4*8,o++}return i.create(r,o)}(e,t,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},o.enc.Base64)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(0).__exportStar(n(144),t)},function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return _}));var r,i,o=n(12),s=n(21),a=n(18),u=n(23),c=n(22),l=n(34),f=n(16),d=n(10),h=n(3),p=n(4),v=n(2),y=function(){return(y=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},g=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},m=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},b=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},w=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(b(arguments[t]));return e},S=new c.a("DataStore");!function(e){e.CONNECTED="CONNECTED"}(r||(r={})),function(e){e[e.none=0]="none",e[e.unauth=1]="unauth",e[e.auth=2]="auth"}(i||(i={}));var _=function(){function t(e,t,n,r){void 0===n&&(n={}),this.schema=e,this.syncPredicates=t,this.amplifyConfig=n,this.authModeStrategy=r,this.typeQuery=new WeakMap,this.buffer=[]}return t.prototype.buildSubscription=function(e,t,n,r,i,o,s){var a=this.amplifyConfig.aws_appsync_authenticationType,u=this.getAuthorizationInfo(t,r,a,i,o,s)||{},c=u.isOwner,l=u.ownerField,f=u.ownerValue,d=b(Object(h.c)(e,t,n,c,l),3);return{authMode:s,opType:d[0],opName:d[1],query:d[2],isOwner:c,ownerField:l,ownerValue:f}},t.prototype.getAuthorizationInfo=function(e,t,n,r,s,a){void 0===r&&(r={}),void 0===s&&(s={});var u=Object(h.e)(e);if(a===o.a.AWS_IAM&&u.find((function(e){return"private"===e.authStrategy&&"iam"===e.provider}))&&t===i.unauth)return null;var c,l=u.filter((function(e){return"groups"===e.authStrategy&&["userPools","oidc"].includes(e.provider)}));return a!==o.a.AMAZON_COGNITO_USER_POOLS&&a!==o.a.OPENID_CONNECT||!l.find((function(e){var t=Object(h.j)(r,e),n=Object(h.j)(s,e);return w(t,n).find((function(t){return e.groups.find((function(e){return e===t}))}))}))?((a===o.a.AMAZON_COGNITO_USER_POOLS?u.filter((function(e){return"owner"===e.authStrategy&&"userPools"===e.provider})):[]).forEach((function(e){var t=r[e.identityClaim];t&&(c={authMode:o.a.AMAZON_COGNITO_USER_POOLS,isOwner:!e.areSubscriptionsPublic,ownerField:e.ownerField,ownerValue:t})})),c||((a===o.a.OPENID_CONNECT?u.filter((function(e){return"owner"===e.authStrategy&&"oidc"===e.provider})):[]).forEach((function(e){var t=s[e.identityClaim];t&&(c={authMode:o.a.OPENID_CONNECT,isOwner:!e.areSubscriptionsPublic,ownerField:e.ownerField,ownerValue:t})})),c||{authMode:a||n,isOwner:!1})):{authMode:a,isOwner:!1}},t.prototype.hubQueryCompletionListener=function(e,t){t.payload.event===f.CONTROL_MSG.SUBSCRIPTION_ACK&&e()},t.prototype.start=function(){var t=this;return[new d.a((function(n){var o,c,d=[],v={},w=i.none;return g(t,void 0,void 0,(function(){var t,_,E,A,O,I,T,C,x,P,k=this;return m(this,(function(N){switch(N.label){case 0:return N.trys.push([0,2,,3]),[4,a.a.currentCredentials()];case 1:return t=N.sent(),w=t.authenticated?i.auth:i.unauth,[3,3];case 2:return N.sent(),[3,3];case 3:return N.trys.push([3,5,,6]),[4,a.a.currentSession()];case 4:return _=N.sent(),o=_.getIdToken().decodePayload(),[3,6];case 5:return N.sent(),[3,6];case 6:if(N.trys.push([6,11,,12]),E=this.amplifyConfig,A=E.aws_cognito_region,O=E.Auth,!A||O&&!O.region)throw"Auth is not configured";return I=void 0,[4,u.a.getItem("federatedInfo")];case 7:return(T=N.sent())?(I=T.token,[3,10]):[3,8];case 8:return[4,a.a.currentAuthenticatedUser()];case 9:(C=N.sent())&&(I=C.token),N.label=10;case 10:return I&&(x=I.split(".")[1],c=JSON.parse(e.from(x,"base64").toString("utf8"))),[3,12];case 11:return P=N.sent(),S.debug("error getting OIDC JWT",P),[3,12];case 12:return Object.values(this.schema.namespaces).forEach((function(e){Object.values(e.models).filter((function(e){return e.syncable})).forEach((function(t){return g(k,void 0,void 0,(function(){var r,i,a,u,_,E,A,O,I=this;return m(this,(function(T){switch(T.label){case 0:return[4,Object(h.h)({authModeStrategy:this.authModeStrategy,defaultAuthMode:this.amplifyConfig.aws_appsync_authenticationType,modelName:t.name,schema:this.schema})];case 1:return r=T.sent(),i=r.READ,v=y(y({},v),((E={})[t.name]=((A={})[h.a.CREATE]=[],A[h.a.UPDATE]=[],A[h.a.DELETE]=[],A),E)),a=[h.a.CREATE,h.a.UPDATE,h.a.DELETE],(O={})[h.a.CREATE]=0,O[h.a.UPDATE]=0,O[h.a.DELETE]=0,u=O,_=function(r){return g(I,void 0,void 0,(function(){var a,E,A,O,I,T,C,x,P,k,N,M,j=this;return m(this,(function(R){switch(R.label){case 0:return a=this.buildSubscription(e,t,r,w,o,c,i[u[r]]),E=a.opType,A=a.opName,O=a.query,I=a.isOwner,T=a.ownerField,C=a.ownerValue,x=a.authMode,[4,Object(h.i)(x,this.amplifyConfig)];case 1:if(P=R.sent(),k={},I){if(!C)return n.error("Owner field required, sign in is needed in order to perform this operation"),[2];k[T]=C}return S.debug("Attempting "+r+" subscription with authMode: "+i[u[r]]),N=s.a.graphql(y(y({query:O,variables:k},{authMode:x}),{authToken:P})),v[t.name][E].push(N.map((function(e){return e.value})).subscribe({next:function(e){var n=e.data,r=e.errors;if(Array.isArray(r)&&r.length>0){var i=r.map((function(e){return e.message}));return S.warn("Skipping incoming subscription. Messages: "+i.join("\n")),void j.drainBuffer()}var o=p.a.getPredicates(j.syncPredicates.get(t),!1),s=n[A];j.passesPredicateValidation(s,o)&&j.pushToBuffer(E,t,s),j.drainBuffer()},error:function(e){var o=e.error,s=b((void 0===o?{errors:[]}:o).errors,1)[0],a=(void 0===s?{}:s).message,c=void 0===a?"":a;if(c.includes(f.CONTROL_MSG.REALTIME_SUBSCRIPTION_INIT_ERROR)||c.includes(f.CONTROL_MSG.CONNECTION_FAILED))return v[t.name][E].forEach((function(e){return e.unsubscribe()})),v[t.name][E]=[],u[r]++,u[r]>=i.length?(S.debug(r+" subscription failed with authMode: "+i[u[r]-1]),void S.warn("subscriptionError",c)):(S.debug(r+" subscription failed with authMode: "+i[u[r]-1]+". Retrying with authMode: "+i[u[r]]),void _(r));S.warn("subscriptionError",c),"function"==typeof M&&M(),c.includes('"errorType":"Unauthorized"')||c.includes('"errorType":"OperationDisabled"')||n.error(c)}})),d.push(g(j,void 0,void 0,(function(){var e,t=this;return m(this,(function(n){switch(n.label){case 0:return[4,new Promise((function(n){M=n,e=t.hubQueryCompletionListener.bind(t,n),l.a.listen("api",e)}))];case 1:return n.sent(),l.a.remove("api",e),[2]}}))}))),[2]}}))}))},a.forEach((function(e){return _(e)})),[2]}}))}))}))})),Promise.all(d).then((function(){return n.next(r.CONNECTED)})),[2]}}))})),function(){Object.keys(v).forEach((function(e){v[e][h.a.CREATE].forEach((function(e){return e.unsubscribe()})),v[e][h.a.UPDATE].forEach((function(e){return e.unsubscribe()})),v[e][h.a.DELETE].forEach((function(e){return e.unsubscribe()}))}))}})),new d.a((function(e){return t.dataObserver=e,t.drainBuffer(),function(){t.dataObserver=null}}))]},t.prototype.passesPredicateValidation=function(e,t){if(!t)return!0;var n=t.predicates,r=t.type;return Object(v.B)(e,r,n)},t.prototype.pushToBuffer=function(e,t,n){this.buffer.push([e,t,n])},t.prototype.drainBuffer=function(){var e=this;this.dataObserver&&(this.buffer.forEach((function(t){return e.dataObserver.next(t)})),this.buffer=[])},t}()}).call(this,n(6).Buffer)},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var i=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,i=n;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")}},function(e,t,n){var r;e.exports=(r=n(13),function(){if("function"==typeof ArrayBuffer){var e=r.lib.WordArray,t=e.init;(e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var n=e.byteLength,r=[],i=0;i<n;i++)r[i>>>2]|=e[i]<<24-i%4*8;t.call(this,r,n)}else t.apply(this,arguments)}).prototype=e}}(),r.lib.WordArray)},function(e,t,n){"use strict";n.r(t),t.default=function(e,t){return t=t||{},new Promise((function(n,r){var i=new XMLHttpRequest,o=[],s=[],a={},u=function(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:u,headers:{keys:function(){return o},entries:function(){return s},get:function(e){return a[e.toLowerCase()]},has:function(e){return e.toLowerCase()in a}}}};for(var c in i.open(t.method||"get",e,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(e,t,n){o.push(t=t.toLowerCase()),s.push([t,n]),a[t]=a[t]?a[t]+","+n:n})),n(u())},i.onerror=r,i.withCredentials="include"==t.credentials,t.headers)i.setRequestHeader(c,t.headers[c]);i.send(t.body||null)}))}},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var u,c=[],l=!1,f=-1;function d(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&h())}function h(){if(!l){var e=a(d);l=!0;for(var t=c.length;t;){for(u=c,c=[];++f<t;)u&&u[f].run();f=-1,t=c.length}u=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new p(e,t)),1!==c.length||l||a(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r=function(){function e(){}return e.createPredicateBuilder=function(t){var n=t.name,r=new Set(Object.keys(t.fields)),i=new Proxy({},{get:function(t,i,o){var s=i;if(!r.has(s))throw new Error("Invalid field for model. field: "+s+", model: "+n);return function(t){return e.sortPredicateGroupsMap.get(o).push({field:s,sortDirection:t}),o}}});return e.sortPredicateGroupsMap.set(i,[]),i},e.isValidPredicate=function(t){return e.sortPredicateGroupsMap.has(t)},e.getPredicates=function(t,n){if(void 0===n&&(n=!0),n&&!e.isValidPredicate(t))throw new Error("The predicate is not valid");return e.sortPredicateGroupsMap.get(t)},e.createFromExisting=function(t,n){if(n&&t)return n(e.createPredicateBuilder(t))},e.sortPredicateGroupsMap=new WeakMap,e}()},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var i=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,i=n;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(109),i=n(55),o=n(35),s=n(37),a=function(){function e(e){e?(this.operation=function(e){return new Promise((function(t,n){var r=(0,s.locateWindow)().msCrypto.subtle.importKey("raw",u(e),i.SHA_256_HMAC_ALGO,!1,["sign"]);r.oncomplete=function(){r.result&&t(r.result),n(new Error("ImportKey completed without importing key."))},r.onerror=function(){n(new Error("ImportKey failed to import key."))}}))}(e).then((function(e){return(0,s.locateWindow)().msCrypto.subtle.sign(i.SHA_256_HMAC_ALGO,e)})),this.operation.catch((function(){}))):this.operation=Promise.resolve((0,s.locateWindow)().msCrypto.subtle.digest("SHA-256"))}return e.prototype.update=function(e){var t=this;(0,r.isEmptyData)(e)||(this.operation=this.operation.then((function(n){return n.onerror=function(){t.operation=Promise.reject(new Error("Error encountered updating hash"))},n.process(u(e)),n})),this.operation.catch((function(){})))},e.prototype.digest=function(){return this.operation.then((function(e){return new Promise((function(t,n){e.onerror=function(){n(new Error("Error encountered finalizing hash"))},e.oncomplete=function(){e.result&&t(new Uint8Array(e.result)),n(new Error("Error encountered finalizing hash"))},e.finish()}))}))},e}();function u(e){return"string"==typeof e?(0,o.fromUtf8)(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.Sha256=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EMPTY_DATA_SHA_256=t.SHA_256_HMAC_ALGO=t.SHA_256_HASH=void 0,t.SHA_256_HASH={name:"SHA-256"},t.SHA_256_HMAC_ALGO={name:"HMAC",hash:t.SHA_256_HASH},t.EMPTY_DATA_SHA_256=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(57),i=n(55),o=n(37),s=function(){function e(e){this.toHash=new Uint8Array(0),void 0!==e&&(this.key=new Promise((function(t,n){(0,o.locateWindow)().crypto.subtle.importKey("raw",(0,r.convertToBuffer)(e),i.SHA_256_HMAC_ALGO,!1,["sign"]).then(t,n)})),this.key.catch((function(){})))}return e.prototype.update=function(e){if(!(0,r.isEmptyData)(e)){var t=(0,r.convertToBuffer)(e),n=new Uint8Array(this.toHash.byteLength+t.byteLength);n.set(this.toHash,0),n.set(t,this.toHash.byteLength),this.toHash=n}},e.prototype.digest=function(){var e=this;return this.key?this.key.then((function(t){return(0,o.locateWindow)().crypto.subtle.sign(i.SHA_256_HMAC_ALGO,t,e.toHash).then((function(e){return new Uint8Array(e)}))})):(0,r.isEmptyData)(this.toHash)?Promise.resolve(i.EMPTY_DATA_SHA_256):Promise.resolve().then((function(){return(0,o.locateWindow)().crypto.subtle.digest(i.SHA_256_HASH,e.toHash)})).then((function(e){return Promise.resolve(new Uint8Array(e))}))},e}();t.Sha256=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint32ArrayFrom=t.numToUint8=t.isEmptyData=t.convertToBuffer=void 0;var r=n(110);Object.defineProperty(t,"convertToBuffer",{enumerable:!0,get:function(){return r.convertToBuffer}});var i=n(111);Object.defineProperty(t,"isEmptyData",{enumerable:!0,get:function(){return i.isEmptyData}});var o=n(112);Object.defineProperty(t,"numToUint8",{enumerable:!0,get:function(){return o.numToUint8}});var s=n(113);Object.defineProperty(t,"uint32ArrayFrom",{enumerable:!0,get:function(){return s.uint32ArrayFrom}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MAX_HASHABLE_LENGTH=t.INIT=t.KEY=t.DIGEST_LENGTH=t.BLOCK_SIZE=void 0,t.BLOCK_SIZE=64,t.DIGEST_LENGTH=32,t.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),t.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],t.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1},function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(22),i=function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},o=new r.a("Parser"),s=function(e){var t,n={};if(e.aws_mobile_analytics_app_id){var r={AWSPinpoint:{appId:e.aws_mobile_analytics_app_id,region:e.aws_mobile_analytics_app_region}};n.Analytics=r}return(e.aws_cognito_identity_pool_id||e.aws_user_pools_id)&&(n.Auth={userPoolId:e.aws_user_pools_id,userPoolWebClientId:e.aws_user_pools_web_client_id,region:e.aws_cognito_region,identityPoolId:e.aws_cognito_identity_pool_id,identityPoolRegion:e.aws_cognito_region,mandatorySignIn:"enable"===e.aws_mandatory_sign_in}),t=e.aws_user_files_s3_bucket?{AWSS3:{bucket:e.aws_user_files_s3_bucket,region:e.aws_user_files_s3_bucket_region,dangerouslyConnectToHttpEndpointForTesting:e.aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing}}:e?e.Storage||e:{},e.Logging&&(n.Logging=i(i({},e.Logging),{region:e.aws_project_region})),e.geo&&(n.Geo=Object.assign({},e.geo),e.geo.amazon_location_service&&(n.Geo={AmazonLocationService:e.geo.amazon_location_service})),n.Analytics=Object.assign({},n.Analytics,e.Analytics),n.Auth=Object.assign({},n.Auth,e.Auth),n.Storage=Object.assign({},t),n.Logging=Object.assign({},n.Logging,e.Logging),o.debug("parse config",e,"to amplifyconfig",n),n},a=function(){function e(){}return e.parseMobilehubConfig=s,e}()},function(e,t,n){(function(t){var r;e.exports=(r=r||function(e,r){var i;if("undefined"!=typeof window&&window.crypto&&(i=window.crypto),"undefined"!=typeof self&&self.crypto&&(i=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(i=globalThis.crypto),!i&&"undefined"!=typeof window&&window.msCrypto&&(i=window.msCrypto),!i&&void 0!==t&&t.crypto&&(i=t.crypto),!i)try{i=n(125)}catch(e){}var o=function(){if(i){if("function"==typeof i.getRandomValues)try{return i.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof i.randomBytes)try{return i.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),a={},u=a.lib={},c=u.Base={extend:function(e){var t=s(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},l=u.WordArray=c.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||d).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,i=e.sigBytes;if(this.clamp(),r%4)for(var o=0;o<i;o++){var s=n[o>>>2]>>>24-o%4*8&255;t[r+o>>>2]|=s<<24-(r+o)%4*8}else for(var a=0;a<i;a+=4)t[r+a>>>2]=n[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=c.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n<e;n+=4)t.push(o());return new l.init(t,e)}}),f=a.enc={},d=f.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new l.init(n,t/2)}},h=f.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new l.init(n,t)}},p=f.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},v=u.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,r=this._data,i=r.words,o=r.sigBytes,s=this.blockSize,a=o/(4*s),u=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,c=e.min(4*u,o);if(u){for(var f=0;f<u;f+=s)this._doProcessBlock(i,f);n=i.splice(0,u),r.sigBytes-=c}return new l.init(n,c)},clone:function(){var e=c.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),y=(u.Hasher=v.extend({cfg:c.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){v.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new y.HMAC.init(e,n).finalize(t)}}}),a.algo={});return a}(Math),r)}).call(this,n(29))},function(e,t,n){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}},function(e,t,n){"use strict";var r=n(14);function i(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,n){if(!t)return e;var o;if(n)o=n(t);else if(r.isURLSearchParams(t))o=t.toString();else{var s=[];r.forEach(t,(function(e,t){null!=e&&(r.isArray(e)?t+="[]":e=[e],r.forEach(e,(function(e){r.isDate(e)?e=e.toISOString():r.isObject(e)&&(e=JSON.stringify(e)),s.push(i(t)+"="+i(e))})))})),o=s.join("&")}if(o){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}},function(e,t,n){"use strict";e.exports=function(e,t,n,r,i){return e.config=t,n&&(e.code=n),e.request=r,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},function(e,t,n){"use strict";var r=n(14),i=n(132),o=n(133),s=n(62),a=n(134),u=n(137),c=n(138),l=n(65);e.exports=function(e){return new Promise((function(t,n){var f=e.data,d=e.headers,h=e.responseType;r.isFormData(f)&&delete d["Content-Type"];var p=new XMLHttpRequest;if(e.auth){var v=e.auth.username||"",y=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";d.Authorization="Basic "+btoa(v+":"+y)}var g=a(e.baseURL,e.url);function m(){if(p){var r="getAllResponseHeaders"in p?u(p.getAllResponseHeaders()):null,o={data:h&&"text"!==h&&"json"!==h?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:r,config:e,request:p};i(t,n,o),p=null}}if(p.open(e.method.toUpperCase(),s(g,e.params,e.paramsSerializer),!0),p.timeout=e.timeout,"onloadend"in p?p.onloadend=m:p.onreadystatechange=function(){p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))&&setTimeout(m)},p.onabort=function(){p&&(n(l("Request aborted",e,"ECONNABORTED",p)),p=null)},p.onerror=function(){n(l("Network Error",e,null,p)),p=null},p.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(l(t,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",p)),p=null},r.isStandardBrowserEnv()){var b=(e.withCredentials||c(g))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0;b&&(d[e.xsrfHeaderName]=b)}"setRequestHeader"in p&&r.forEach(d,(function(e,t){void 0===f&&"content-type"===t.toLowerCase()?delete d[t]:p.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(p.withCredentials=!!e.withCredentials),h&&"json"!==h&&(p.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&p.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&p.upload&&p.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){p&&(p.abort(),n(e),p=null)})),f||(f=null),p.send(f)}))}},function(e,t,n){"use strict";var r=n(63);e.exports=function(e,t,n,i,o){var s=new Error(e);return r(s,t,n,i,o)}},function(e,t,n){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,n){"use strict";var r=n(14);e.exports=function(e,t){t=t||{};var n={},i=["url","method","data"],o=["headers","auth","proxy","params"],s=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function u(e,t){return r.isPlainObject(e)&&r.isPlainObject(t)?r.merge(e,t):r.isPlainObject(t)?r.merge({},t):r.isArray(t)?t.slice():t}function c(i){r.isUndefined(t[i])?r.isUndefined(e[i])||(n[i]=u(void 0,e[i])):n[i]=u(e[i],t[i])}r.forEach(i,(function(e){r.isUndefined(t[e])||(n[e]=u(void 0,t[e]))})),r.forEach(o,c),r.forEach(s,(function(i){r.isUndefined(t[i])?r.isUndefined(e[i])||(n[i]=u(void 0,e[i])):n[i]=u(void 0,t[i])})),r.forEach(a,(function(r){r in t?n[r]=u(e[r],t[r]):r in e&&(n[r]=u(void 0,e[r]))}));var l=i.concat(o).concat(s).concat(a),f=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===l.indexOf(e)}));return r.forEach(f,c),n}},function(e,t,n){"use strict";function r(e){this.message=e}r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,e.exports=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BLOCK_SIZE=64,t.DIGEST_LENGTH=32,t.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),t.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],t.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1},function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(26);function i(e,t){void 0===t&&(t={});var n=function(e){if(e&&"j"===e[0]&&":"===e[1])return e.substr(2);return e}(e);if(function(e,t){return void 0===t&&(t=!e||"{"!==e[0]&&"["!==e[0]&&'"'!==e[0]),!t}(n,t.doNotParse))try{return JSON.parse(n)}catch(e){}return e}var o=function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},s=function(){function e(e,t){var n=this;this.changeListeners=[],this.HAS_DOCUMENT_COOKIE=!1,this.cookies=function(e,t){return"string"==typeof e?r.parse(e,t):"object"==typeof e&&null!==e?e:{}}(e,t),new Promise((function(){n.HAS_DOCUMENT_COOKIE="object"==typeof document&&"string"==typeof document.cookie})).catch((function(){}))}return e.prototype._updateBrowserValues=function(e){this.HAS_DOCUMENT_COOKIE&&(this.cookies=r.parse(document.cookie,e))},e.prototype._emitChange=function(e){for(var t=0;t<this.changeListeners.length;++t)this.changeListeners[t](e)},e.prototype.get=function(e,t,n){return void 0===t&&(t={}),this._updateBrowserValues(n),i(this.cookies[e],t)},e.prototype.getAll=function(e,t){void 0===e&&(e={}),this._updateBrowserValues(t);var n={};for(var r in this.cookies)n[r]=i(this.cookies[r],e);return n},e.prototype.set=function(e,t,n){var i;"object"==typeof t&&(t=JSON.stringify(t)),this.cookies=o(o({},this.cookies),((i={})[e]=t,i)),this.HAS_DOCUMENT_COOKIE&&(document.cookie=r.serialize(e,t,n)),this._emitChange({name:e,value:t,options:n})},e.prototype.remove=function(e,t){var n=t=o(o({},t),{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=o({},this.cookies),delete this.cookies[e],this.HAS_DOCUMENT_COOKIE&&(document.cookie=r.serialize(e,"",n)),this._emitChange({name:e,value:void 0,options:t})},e.prototype.addChangeListener=function(e){this.changeListeners.push(e)},e.prototype.removeChangeListener=function(e){var t=this.changeListeners.indexOf(e);t>=0&&this.changeListeners.splice(t,1)},e}(),a=n(15),u=Object(a.b)().isBrowser,c=function(){function e(e){void 0===e&&(e={}),this.cookies=new s,this.store=u?window.localStorage:Object.create(null),this.cookies=e.req?new s(e.req.headers.cookie):new s,Object.assign(this.store,this.cookies.getAll())}return Object.defineProperty(e.prototype,"length",{get:function(){return Object.entries(this.store).length},enumerable:!0,configurable:!0}),e.prototype.clear=function(){var e=this;Array.from(new Array(this.length)).map((function(t,n){return e.key(n)})).forEach((function(t){return e.removeItem(t)}))},e.prototype.getItem=function(e){return this.getLocalItem(e)},e.prototype.getLocalItem=function(e){return Object.prototype.hasOwnProperty.call(this.store,e)?this.store[e]:null},e.prototype.getUniversalItem=function(e){return this.cookies.get(e)},e.prototype.key=function(e){return Object.keys(this.store)[e]},e.prototype.removeItem=function(e){this.removeLocalItem(e),this.removeUniversalItem(e)},e.prototype.removeLocalItem=function(e){delete this.store[e]},e.prototype.removeUniversalItem=function(e){this.cookies.remove(e,{path:"/"})},e.prototype.setItem=function(e,t){switch(this.setLocalItem(e,t),e.split(".").pop()){case"LastAuthUser":case"accessToken":case"refreshToken":case"idToken":u?this.setUniversalItem(e,t):this.setLocalItem(e,t)}},e.prototype.setLocalItem=function(e,t){this.store[e]=t},e.prototype.setUniversalItem=function(e,t){this.cookies.set(e,t,{path:"/",sameSite:!0,secure:"localhost"!==window.location.hostname})},e}()},function(e,t,n){"use strict";n.d(t,"a",(function(){return O}));for(var r=n(22),i=n(43),o={},s={},a=0;a<256;a++){var u=a.toString(16).toLowerCase();1===u.length&&(u="0"+u),o[a]=u,s[u]=a}function c(e){for(var t="",n=0;n<e.byteLength;n++)t+=o[e[n]];return t}var l=n(8),f=n(157);function d(e){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var h=function(){return(h=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},p=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},v=new r.a("Signer"),y=function(e,t){var n=new i.Sha256(e);return n.update(t),n.digestSync()},g=function(e){var t=e||"",n=new i.Sha256;return n.update(t),c(n.digestSync())},m=function(e){return Object.keys(e).map((function(e){return e.toLowerCase()})).sort().join(";")},b=function(e){var t,n,r=Object(l.parse)(e.url);return[e.method||"/",encodeURIComponent(r.pathname).replace(/%2F/gi,"/"),(n=r.query,n&&0!==n.length?n.split("&").map((function(e){var t=e.split("=");if(1===t.length)return e;var n=t[1].replace(/[!'()*]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}));return t[0]+"="+n})).sort((function(e,t){var n=e.split("=")[0],r=t.split("=")[0];return n===r?e<t?-1:1:n<r?-1:1})).join("&"):""),(t=e.headers,t&&0!==Object.keys(t).length?Object.keys(t).map((function(e){return{key:e.toLowerCase(),value:t[e]?t[e].trim().replace(/\s+/g," "):""}})).sort((function(e,t){return e.key<t.key?-1:1})).map((function(e){return e.key+":"+e.value})).join("\n")+"\n":""),m(e.headers),g(e.data)].join("\n")},w=function(e){var t=(Object(l.parse)(e.url).host.match(/([^\.]+)\.(?:([^\.]*)\.)?amazonaws\.com$/)||[]).slice(1,3);return"es"===t[1]&&(t=t.reverse()),{service:e.service||t[0],region:e.region||t[1]}},S=function(e,t,n){return[e,t,n,"aws4_request"].join("/")},_=function(e,t,n,r){return[e,n,r,g(t)].join("\n")},E=function(e,t,n){v.debug(n);var r=y("AWS4"+e,t),i=y(r,n.region),o=y(i,n.service);return y(o,"aws4_request")},A=function(e,t){return c(y(e,t))},O=function(){function e(){}return e.sign=function(e,t,n){void 0===n&&(n=null),e.headers=e.headers||{};var r=f.a.getDateWithClockOffset().toISOString().replace(/[:\-]|\.\d{3}/g,""),i=r.substr(0,8),o=Object(l.parse)(e.url);e.headers.host=o.host,e.headers["x-amz-date"]=r,t.session_token&&(e.headers["X-Amz-Security-Token"]=t.session_token);var s=b(e);v.debug(s);var a=n||w(e),u=S(i,a.region,a.service),c=_("AWS4-HMAC-SHA256",s,r,u),d=E(t.secret_key,i,a),h=A(d,c),p=function(e,t,n,r,i){return[e+" Credential="+t+"/"+n,"SignedHeaders="+r,"Signature="+i].join(", ")}("AWS4-HMAC-SHA256",t.access_key,u,m(e.headers),h);return e.headers.Authorization=p,e},e.signUrl=function(e,t,n,r){var i="object"===d(e)?e.url:e,o="object"===d(e)?e.method:"GET",s="object"===d(e)?e.body:void 0,a=f.a.getDateWithClockOffset().toISOString().replace(/[:\-]|\.\d{3}/g,""),u=a.substr(0,8),c=Object(l.parse)(i,!0,!0),v=(c.search,p(c,["search"])),y={host:v.host},g=n||w({url:Object(l.format)(v)}),m=g.region,O=g.service,I=S(u,m,O),T=t.session_token&&"iotdevicegateway"!==O,C=h(h(h({"X-Amz-Algorithm":"AWS4-HMAC-SHA256","X-Amz-Credential":[t.access_key,I].join("/"),"X-Amz-Date":a.substr(0,16)},T?{"X-Amz-Security-Token":""+t.session_token}:{}),r?{"X-Amz-Expires":""+r}:{}),{"X-Amz-SignedHeaders":Object.keys(y).join(",")}),x=b({method:o,url:Object(l.format)(h(h({},v),{query:h(h({},v.query),C)})),headers:y,data:s}),P=_("AWS4-HMAC-SHA256",x,a,I),k=E(t.secret_key,u,{region:m,service:O}),N=A(k,P),M=h({"X-Amz-Signature":N},t.session_token&&{"X-Amz-Security-Token":t.session_token});return Object(l.format)({protocol:v.protocol,slashes:!0,hostname:v.hostname,port:v.port,pathname:v.pathname,query:h(h(h({},v.query),C),M)})},e}()},function(e,t,n){"use strict";(function(e){var r;if(n.d(t,"a",(function(){return i})),"undefined"!=typeof window&&window.crypto&&(r=window.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==e&&e.crypto&&(r=e.crypto),!r)try{r=n(97)}catch(e){}function i(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")}}).call(this,n(29))},function(e,t,n){"use strict";var r,i,o=n(99);function s(e,t,n){if(e._observer)a(e._observer,t,n);else if(e._observers){var r=[];e._observers.forEach((function(e){r.push(e)})),r.forEach((function(e){a(e,t,n)}))}}function a(e,t,n){if(!e.closed)switch(t){case"next":return e.next(n);case"error":return e.error(n);case"complete":return e.complete(n)}}function u(e){return e._observer||e._observers&&e._observers.size>0}function c(e){var t=this;this._observer=null,this._observers=null,this._observable=new o((function(n){return function(e,t){!u(e)&&t&&t.start&&t.start()}(t,e),function(e,t){e._observers?e._observers.add(t):e._observer?(e._observers=new Set,e._observers.add(e._observer),e._observers.add(t),e._observer=null):e._observer=t}(t,n),function(){!function(e,t){e._observers?e._observers.delete(t):e._observer===t&&(e._observer=null)}(t,n),function(e,t){!u(e)&&t&&t.pause&&t.pause()}(t,e)}}))}r=c.prototype,i={get observable(){return this._observable},get observed(){return u(this)},next:function(e){s(this,"next",e)},error:function(e){s(this,"error",e)},complete:function(e){s(this,"complete",e)}},Object.keys(i).forEach((function(e){var t=Object.getOwnPropertyDescriptor(i,e);t.enumerable=!1,Object.defineProperty(r,e,t)})),e.exports=c},function(e,t,n){var r=n(106),i=n(107),o=i;o.v1=r,o.v4=i,e.exports=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WebCryptoSha256=t.Ie11Sha256=void 0,(0,n(0).__exportStar)(n(108),t);var r=n(54);Object.defineProperty(t,"Ie11Sha256",{enumerable:!0,get:function(){return r.Sha256}});var i=n(56);Object.defineProperty(t,"WebCryptoSha256",{enumerable:!0,get:function(){return i.Sha256}})},function(e,t,n){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r=n(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,r){void 0===r&&(r=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(n),s=Math.max(i,o),a=0,u=e.map([t,n],(function(t){var n=s-e.getVersionPrecision(t),r=t+new Array(n+1).join(".0");return e.map(r.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(u[0][s]>u[1][s])return 1;if(u[0][s]===u[1][s]){if(s===a)return 0;s-=1}else if(u[0][s]<u[1][s])return-1}},e.map=function(e,t){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n<e.length;n+=1)r.push(t(e[n]));return r},e.find=function(e,t){var n,r;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(n=0,r=e.length;n<r;n+=1){var i=e[n];if(t(i,n))return i}},e.assign=function(e){for(var t,n,r=e,i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];if(Object.assign)return Object.assign.apply(Object,[e].concat(o));var a=function(){var e=o[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){r[t]=e[t]}))};for(t=0,n=o.length;t<n;t+=1)a();return e},e.getBrowserAlias=function(e){return r.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return r.BROWSER_MAP[e]||""},e}();t.default=i,e.exports=t.default},18:function(e,t,n){"use strict";t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(91))&&r.__esModule?r:{default:r},o=n(18);function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var a=function(){function e(){}var t,n;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new i.default(e,t)},e.parse=function(e){return new i.default(e).getResult()},t=e,(n=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}])&&s(t,n),e}();t.default=a,e.exports=t.default},91:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r=u(n(92)),i=u(n(93)),o=u(n(94)),s=u(n(95)),a=u(n(17));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=a.default.find(r.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=a.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=a.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=a.default.find(s.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return a.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,n={},r=0,i={},o=0;if(Object.keys(e).forEach((function(t){var s=e[t];"string"==typeof s?(i[t]=s,o+=1):"object"==typeof s&&(n[t]=s,r+=1)})),r>0){var s=Object.keys(n),u=a.default.find(s,(function(e){return t.isOS(e)}));if(u){var c=this.satisfies(n[u]);if(void 0!==c)return c}var l=a.default.find(s,(function(e){return t.isPlatform(e)}));if(l){var f=this.satisfies(n[l]);if(void 0!==f)return f}}if(o>0){var d=Object.keys(i),h=a.default.find(d,(function(e){return t.isBrowser(e,!0)}));if(void 0!==h)return this.compareVersion(i[h])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),r=e.toLowerCase(),i=a.default.getBrowserTypeByAlias(r);return t&&i&&(r=i.toLowerCase()),r===n},t.compareVersion=function(e){var t=[0],n=e,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(r=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(r=!0,n=e.substr(1)),t.indexOf(a.default.compareVersions(i,n,r))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=c,e.exports=t.default},92:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=s,e.exports=t.default},93:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(t),r={name:o.OS_MAP.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=i.default.getAndroidVersionName(t),r={name:o.OS_MAP.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:o.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=s,e.exports=t.default},94:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=s,e.exports=t.default},95:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=s,e.exports=t.default}})},function(e){e.exports=JSON.parse('{"name":"@aws-sdk/client-cognito-identity","description":"AWS SDK for JavaScript Cognito Identity Client for Node.js, Browser and React Native","version":"3.6.1","scripts":{"clean":"yarn remove-definitions && yarn remove-dist && yarn remove-documentation","build-documentation":"yarn remove-documentation && typedoc ./","prepublishOnly":"yarn build","pretest":"yarn build:cjs","remove-definitions":"rimraf ./types","remove-dist":"rimraf ./dist","remove-documentation":"rimraf ./docs","test:unit":"mocha **/cjs/**/*.spec.js","test:e2e":"mocha **/cjs/**/*.ispec.js && karma start karma.conf.js","test":"yarn test:unit","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig.es.json","build":"yarn build:cjs && yarn build:es","postbuild":"downlevel-dts types types/ts3.4"},"main":"./dist/cjs/index.js","types":"./types/index.d.ts","module":"./dist/es/index.js","browser":{"./runtimeConfig":"./runtimeConfig.browser"},"react-native":{"./runtimeConfig":"./runtimeConfig.native"},"sideEffects":false,"dependencies":{"@aws-crypto/sha256-browser":"^1.0.0","@aws-crypto/sha256-js":"^1.0.0","@aws-sdk/config-resolver":"3.6.1","@aws-sdk/credential-provider-node":"3.6.1","@aws-sdk/fetch-http-handler":"3.6.1","@aws-sdk/hash-node":"3.6.1","@aws-sdk/invalid-dependency":"3.6.1","@aws-sdk/middleware-content-length":"3.6.1","@aws-sdk/middleware-host-header":"3.6.1","@aws-sdk/middleware-logger":"3.6.1","@aws-sdk/middleware-retry":"3.6.1","@aws-sdk/middleware-serde":"3.6.1","@aws-sdk/middleware-signing":"3.6.1","@aws-sdk/middleware-stack":"3.6.1","@aws-sdk/middleware-user-agent":"3.6.1","@aws-sdk/node-config-provider":"3.6.1","@aws-sdk/node-http-handler":"3.6.1","@aws-sdk/protocol-http":"3.6.1","@aws-sdk/smithy-client":"3.6.1","@aws-sdk/types":"3.6.1","@aws-sdk/url-parser":"3.6.1","@aws-sdk/url-parser-native":"3.6.1","@aws-sdk/util-base64-browser":"3.6.1","@aws-sdk/util-base64-node":"3.6.1","@aws-sdk/util-body-length-browser":"3.6.1","@aws-sdk/util-body-length-node":"3.6.1","@aws-sdk/util-user-agent-browser":"3.6.1","@aws-sdk/util-user-agent-node":"3.6.1","@aws-sdk/util-utf8-browser":"3.6.1","@aws-sdk/util-utf8-node":"3.6.1","tslib":"^2.0.0"},"devDependencies":{"@aws-sdk/client-documentation-generator":"3.6.1","@aws-sdk/client-iam":"3.6.1","@types/chai":"^4.2.11","@types/mocha":"^8.0.4","@types/node":"^12.7.5","downlevel-dts":"0.7.0","jest":"^26.1.0","rimraf":"^3.0.0","typedoc":"^0.19.2","typescript":"~4.1.2"},"engines":{"node":">=10.0.0"},"typesVersions":{"<4.0":{"types/*":["types/ts3.4/*"]}},"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-cognito-identity","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"clients/client-cognito-identity"}}')},function(e,t,n){var r;e.exports=(r=n(60),function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,s=t.algo,a=[],u=[];!function(){function t(t){for(var n=e.sqrt(t),r=2;r<=n;r++)if(!(t%r))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var r=2,i=0;i<64;)t(r)&&(i<8&&(a[i]=n(e.pow(r,.5))),u[i]=n(e.pow(r,1/3)),i++),r++}();var c=[],l=s.SHA256=o.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],l=n[5],f=n[6],d=n[7],h=0;h<64;h++){if(h<16)c[h]=0|e[t+h];else{var p=c[h-15],v=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,y=c[h-2],g=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;c[h]=v+c[h-7]+g+c[h-16]}var m=r&i^r&o^i&o,b=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),w=d+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&f)+u[h]+c[h];d=f,f=l,l=a,a=s+w|0,s=o,o=i,i=r,r=w+(b+m)|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+s|0,n[4]=n[4]+a|0,n[5]=n[5]+l|0,n[6]=n[6]+f|0,n[7]=n[7]+d|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),r.SHA256)},function(e,t,n){var r,i,o;e.exports=(o=n(60),i=(r=o).lib.WordArray,r.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp();for(var i=[],o=0;o<n;o+=3)for(var s=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a<n;a++)i.push(r.charAt(s>>>6*(3-a)&63));var u=r.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e){var t=e.length,n=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var o=0;o<n.length;o++)r[n.charCodeAt(o)]=o}var s=n.charAt(64);if(s){var a=e.indexOf(s);-1!==a&&(t=a)}return function(e,t,n){for(var r=[],o=0,s=0;s<t;s++)if(s%4){var a=n[e.charCodeAt(s-1)]<<s%4*2,u=n[e.charCodeAt(s)]>>>6-s%4*2,c=a|u;r[o>>>2]|=c<<24-o%4*8,o++}return i.create(r,o)}(e,t,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},o.enc.Base64)},function(e,t,n){e.exports=n(146).Observable},,,,,,,,,function(e,t,n){var r,i,o=n(45),s=n(46),a=0,u=0;e.exports=function(e,t,n){var c=t&&n||0,l=t||[],f=(e=e||{}).node||r,d=void 0!==e.clockseq?e.clockseq:i;if(null==f||null==d){var h=o();null==f&&(f=r=[1|h[0],h[1],h[2],h[3],h[4],h[5]]),null==d&&(d=i=16383&(h[6]<<8|h[7]))}var p=void 0!==e.msecs?e.msecs:(new Date).getTime(),v=void 0!==e.nsecs?e.nsecs:u+1,y=p-a+(v-u)/1e4;if(y<0&&void 0===e.clockseq&&(d=d+1&16383),(y<0||p>a)&&void 0===e.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=p,u=v,i=d;var g=(1e4*(268435455&(p+=122192928e5))+v)%4294967296;l[c++]=g>>>24&255,l[c++]=g>>>16&255,l[c++]=g>>>8&255,l[c++]=255&g;var m=p/4294967296*1e4&268435455;l[c++]=m>>>8&255,l[c++]=255&m,l[c++]=m>>>24&15|16,l[c++]=m>>>16&255,l[c++]=d>>>8|128,l[c++]=255&d;for(var b=0;b<6;++b)l[c+b]=f[b];return t||s(l)}},function(e,t,n){var r=n(45),i=n(46);e.exports=function(e,t,n){var o=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[o+a]=s[a];return t||i(s)}},function(e,t,n){"use strict";t.byteLength=function(e){var t=c(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=c(e),s=r[0],a=r[1],u=new o(function(e,t,n){return 3*(t+n)/4-n}(0,s,a)),l=0,f=a>0?s-4:s;for(n=0;n<f;n+=4)t=i[e.charCodeAt(n)]<<18|i[e.charCodeAt(n+1)]<<12|i[e.charCodeAt(n+2)]<<6|i[e.charCodeAt(n+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===a&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===a&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=0,a=n-i;s<a;s+=16383)o.push(l(e,s,s+16383>a?a:s+16383));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a<u;++a)r[a]=s[a],i[s.charCodeAt(a)]=a;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var i,o,s=[],a=t;a<n;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){
|
|
77
|
+
***************************************************************************** */():r,e=c,d&&Promise.resolve(i.setItem(d,e)).catch((function(){})),l.label=7;case 7:return[2,(h=ft({client:o,customRoleArn:s,logins:u,identityId:e}))()]}}))}))};return function(){return h().catch((function(e){return Object(l.__awaiter)(t,void 0,void 0,(function(){return Object(l.__generator)(this,(function(t){throw d&&Promise.resolve(i.removeItem(d)).catch((function(){})),e}))}))}))}}var yt=function(e,t){return(yt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function gt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}yt(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var mt=function(){return(mt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function bt(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function wt(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}Object.create;function St(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}Object.create;var _t=n(77),Et=n(75),At=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,Ot)},Ot=function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()};for(var It=function(){function e(e){var t=(void 0===e?{}:e).requestTimeout;this.requestTimeout=t}return e.prototype.destroy=function(){},e.prototype.handle=function(e,t){var n=(void 0===t?{}:t).abortSignal,r=this.requestTimeout;if(null==n?void 0:n.aborted){var i=new Error("Request aborted");return i.name="AbortError",Promise.reject(i)}var o=e.path;if(e.query){var s=function(e){var t,n,r=[];try{for(var i=Object(l.__values)(Object.keys(e).sort()),o=i.next();!o.done;o=i.next()){var s=o.value,a=e[s];if(s=At(s),Array.isArray(a))for(var u=0,c=a.length;u<c;u++)r.push(s+"="+At(a[u]));else{var f=s;(a||"string"==typeof a)&&(f+="="+At(a)),r.push(f)}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r.join("&")}(e.query);s&&(o+="?"+s)}var a=e.port,u=e.method,c=e.protocol+"//"+e.hostname+(a?":"+a:"")+o,f={body:"GET"===u||"HEAD"===u?void 0:e.body,headers:new Headers(e.headers),method:u};"undefined"!=typeof AbortController&&(f.signal=n);var d,h=new Request(c,f),p=[fetch(h).then((function(e){var t,n,r=e.headers,i={};try{for(var o=Object(l.__values)(r.entries()),s=o.next();!s.done;s=o.next()){var a=s.value;i[a[0]]=a[1]}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return void 0!==e.body?{response:new we({headers:i,statusCode:e.status,body:e.body})}:e.blob().then((function(t){return{response:new we({headers:i,statusCode:e.status,body:t})}}))})),(d=r,void 0===d&&(d=0),new Promise((function(e,t){d&&setTimeout((function(){var e=new Error("Request did not complete within "+d+" ms");e.name="TimeoutError",t(e)}),d)})))];return n&&p.push(new Promise((function(e,t){n.onabort=function(){var e=new Error("Request aborted");e.name="AbortError",t(e)}}))),Promise.race(p)},e}(),Tt={},Ct=new Array(64),xt=0,Pt="A".charCodeAt(0),kt="Z".charCodeAt(0);xt+Pt<=kt;xt++){var Nt=String.fromCharCode(xt+Pt);Tt[Nt]=xt,Ct[xt]=Nt}for(xt=0,Pt="a".charCodeAt(0),kt="z".charCodeAt(0);xt+Pt<=kt;xt++){Nt=String.fromCharCode(xt+Pt);var Mt=xt+26;Tt[Nt]=Mt,Ct[Mt]=Nt}for(xt=0;xt<10;xt++){Tt[xt.toString(10)]=xt+52;Nt=xt.toString(10),Mt=xt+52;Tt[Nt]=Mt,Ct[Mt]=Nt}Tt["+"]=62,Ct[62]="+",Tt["/"]=63,Ct[63]="/";function jt(e){var t=e.length/4*3;"=="===e.substr(-2)?t-=2:"="===e.substr(-1)&&t--;for(var n=new ArrayBuffer(t),r=new DataView(n),i=0;i<e.length;i+=4){for(var o=0,s=0,a=i,u=i+3;a<=u;a++)"="!==e[a]?(o|=Tt[e[a]]<<6*(u-a),s+=6):o>>=6;var c=i/4*3;o>>=s%8;for(var l=Math.floor(s/8),f=0;f<l;f++){var d=8*(l-f-1);r.setUint8(c+f,(o&255<<d)>>d)}}return new Uint8Array(n)}function Rt(e){return new Promise((function(t,n){var r=new FileReader;r.onloadend=function(){var e;if(2!==r.readyState)return n(new Error("Reader aborted too early"));var i=null!==(e=r.result)&&void 0!==e?e:"",o=i.indexOf(","),s=o>-1?o+1:i.length;t(i.substring(s))},r.onabort=function(){return n(new Error("Read aborted"))},r.onerror=function(){return n(r.error)},r.readAsDataURL(e)}))}var Dt={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},Ut=function(e){return{applyToStack:function(t){t.add(function(e){return function(t,n){return function(r){return Object(l.__awaiter)(void 0,void 0,void 0,(function(){var i;return Object(l.__generator)(this,(function(o){return(null===(i=null==e?void 0:e.retryStrategy)||void 0===i?void 0:i.mode)&&(n.userAgent=Object(l.__spread)(n.userAgent||[],[["cfg/retry-mode",e.retryStrategy.mode]])),[2,e.retryStrategy.retry(t,r)]}))}))}}}(e),Dt)}}},Ft=["AuthFailure","InvalidSignatureException","RequestExpired","RequestInTheFuture","RequestTimeTooSkewed","SignatureDoesNotMatch"],Lt=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],Bt=["AbortError","TimeoutError","RequestTimeout","RequestTimeoutException"],qt=[500,502,503,504],zt=function(e){var t,n;return 429===(null===(t=e.$metadata)||void 0===t?void 0:t.httpStatusCode)||Lt.includes(e.name)||1==(null===(n=e.$retryable)||void 0===n?void 0:n.throttling)},Kt=n(74),Vt=function(e,t){return Math.floor(Math.min(2e4,Math.random()*Math.pow(2,t)*e))},Ht=function(e){return!!e&&(function(e){return void 0!==e.$retryable}(e)||function(e){return Ft.includes(e.name)}(e)||zt(e)||function(e){var t;return Bt.includes(e.name)||qt.includes((null===(t=e.$metadata)||void 0===t?void 0:t.httpStatusCode)||0)}(e))},Gt=function(){function e(e,t){var n,r,i,o,s,a,u,c;this.maxAttemptsProvider=e,this.mode="standard",this.retryDecider=null!==(n=null==t?void 0:t.retryDecider)&&void 0!==n?n:Ht,this.delayDecider=null!==(r=null==t?void 0:t.delayDecider)&&void 0!==r?r:Vt,this.retryQuota=null!==(i=null==t?void 0:t.retryQuota)&&void 0!==i?i:(s=o=500,a=o,u=function(e){return"TimeoutError"===e.name?10:5},c=function(e){return u(e)<=a},Object.freeze({hasRetryTokens:c,retrieveRetryTokens:function(e){if(!c(e))throw new Error("No retry token available");var t=u(e);return a-=t,t},releaseRetryTokens:function(e){a+=null!=e?e:1,a=Math.min(a,s)}}))}return e.prototype.shouldRetry=function(e,t,n){return t<n&&this.retryDecider(e)&&this.retryQuota.hasRetryTokens(e)},e.prototype.getMaxAttempts=function(){return Object(l.__awaiter)(this,void 0,void 0,(function(){var e;return Object(l.__generator)(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.maxAttemptsProvider()];case 1:return e=t.sent(),[3,3];case 2:return t.sent(),e=3,[3,3];case 3:return[2,e]}}))}))},e.prototype.retry=function(e,t){return Object(l.__awaiter)(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c;return Object(l.__generator)(this,(function(f){switch(f.label){case 0:return r=0,i=0,[4,this.getMaxAttempts()];case 1:o=f.sent(),s=t.request,Se.isInstance(s)&&(s.headers["amz-sdk-invocation-id"]=Object(Kt.v4)()),a=function(){var a,c,f,d,h;return Object(l.__generator)(this,(function(l){switch(l.label){case 0:return l.trys.push([0,2,,5]),Se.isInstance(s)&&(s.headers["amz-sdk-request"]="attempt="+(r+1)+"; max="+o),[4,e(t)];case 1:return a=l.sent(),c=a.response,f=a.output,u.retryQuota.releaseRetryTokens(n),f.$metadata.attempts=r+1,f.$metadata.totalRetryDelay=i,[2,{value:{response:c,output:f}}];case 2:return d=l.sent(),r++,u.shouldRetry(d,r,o)?(n=u.retryQuota.retrieveRetryTokens(d),h=u.delayDecider(zt(d)?500:100,r),i+=h,[4,new Promise((function(e){return setTimeout(e,h)}))]):[3,4];case 3:return l.sent(),[2,"continue"];case 4:throw d.$metadata||(d.$metadata={}),d.$metadata.attempts=r,d.$metadata.totalRetryDelay=i,d;case 5:return[2]}}))},u=this,f.label=2;case 2:return[5,a()];case 3:return"object"==typeof(c=f.sent())?[2,c.value]:[3,2];case 4:return[2]}}))}))},e}(),Wt=function(e){if(void 0===e&&(e=3),"number"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};var Yt=n(76),Jt=n.n(Yt),$t=n(35),Zt="cognito-identity.{region}.amazonaws.com",Qt=new Set(["af-south-1","ap-east-1","ap-northeast-1","ap-northeast-2","ap-south-1","ap-southeast-1","ap-southeast-2","ca-central-1","eu-central-1","eu-north-1","eu-south-1","eu-west-1","eu-west-2","eu-west-3","me-south-1","sa-east-1","us-east-1","us-east-2","us-west-1","us-west-2"]),Xt=new Set(["cn-north-1","cn-northwest-1"]),en=new Set(["us-iso-east-1"]),tn=new Set(["us-isob-east-1"]),nn=new Set(["us-gov-east-1","us-gov-west-1"]);var rn,on,sn,an,un={apiVersion:"2014-06-30",disableHostPrefix:!1,logger:{},regionInfoProvider:function(e,t){var n=void 0;switch(e){case"ap-northeast-1":n={hostname:"cognito-identity.ap-northeast-1.amazonaws.com",partition:"aws"};break;case"ap-northeast-2":n={hostname:"cognito-identity.ap-northeast-2.amazonaws.com",partition:"aws"};break;case"ap-south-1":n={hostname:"cognito-identity.ap-south-1.amazonaws.com",partition:"aws"};break;case"ap-southeast-1":n={hostname:"cognito-identity.ap-southeast-1.amazonaws.com",partition:"aws"};break;case"ap-southeast-2":n={hostname:"cognito-identity.ap-southeast-2.amazonaws.com",partition:"aws"};break;case"ca-central-1":n={hostname:"cognito-identity.ca-central-1.amazonaws.com",partition:"aws"};break;case"cn-north-1":n={hostname:"cognito-identity.cn-north-1.amazonaws.com.cn",partition:"aws-cn"};break;case"eu-central-1":n={hostname:"cognito-identity.eu-central-1.amazonaws.com",partition:"aws"};break;case"eu-north-1":n={hostname:"cognito-identity.eu-north-1.amazonaws.com",partition:"aws"};break;case"eu-west-1":n={hostname:"cognito-identity.eu-west-1.amazonaws.com",partition:"aws"};break;case"eu-west-2":n={hostname:"cognito-identity.eu-west-2.amazonaws.com",partition:"aws"};break;case"eu-west-3":n={hostname:"cognito-identity.eu-west-3.amazonaws.com",partition:"aws"};break;case"fips-us-east-1":n={hostname:"cognito-identity-fips.us-east-1.amazonaws.com",partition:"aws",signingRegion:"us-east-1"};break;case"fips-us-east-2":n={hostname:"cognito-identity-fips.us-east-2.amazonaws.com",partition:"aws",signingRegion:"us-east-2"};break;case"fips-us-gov-west-1":n={hostname:"cognito-identity-fips.us-gov-west-1.amazonaws.com",partition:"aws-us-gov",signingRegion:"us-gov-west-1"};break;case"fips-us-west-2":n={hostname:"cognito-identity-fips.us-west-2.amazonaws.com",partition:"aws",signingRegion:"us-west-2"};break;case"sa-east-1":n={hostname:"cognito-identity.sa-east-1.amazonaws.com",partition:"aws"};break;case"us-east-1":n={hostname:"cognito-identity.us-east-1.amazonaws.com",partition:"aws"};break;case"us-east-2":n={hostname:"cognito-identity.us-east-2.amazonaws.com",partition:"aws"};break;case"us-gov-west-1":n={hostname:"cognito-identity.us-gov-west-1.amazonaws.com",partition:"aws-us-gov"};break;case"us-west-1":n={hostname:"cognito-identity.us-west-1.amazonaws.com",partition:"aws"};break;case"us-west-2":n={hostname:"cognito-identity.us-west-2.amazonaws.com",partition:"aws"};break;default:Qt.has(e)&&(n={hostname:Zt.replace("{region}",e),partition:"aws"}),Xt.has(e)&&(n={hostname:"cognito-identity.{region}.amazonaws.com.cn".replace("{region}",e),partition:"aws-cn"}),en.has(e)&&(n={hostname:"cognito-identity.{region}.c2s.ic.gov".replace("{region}",e),partition:"aws-iso"}),tn.has(e)&&(n={hostname:"cognito-identity.{region}.sc2s.sgov.gov".replace("{region}",e),partition:"aws-iso-b"}),nn.has(e)&&(n={hostname:"cognito-identity.{region}.amazonaws.com".replace("{region}",e),partition:"aws-us-gov"}),void 0===n&&(n={hostname:Zt.replace("{region}",e),partition:"aws"})}return Promise.resolve(mt({signingService:"cognito-identity"},n))},serviceId:"Cognito Identity",urlParser:function(e){var t,n=new URL(e),r=n.hostname,i=n.pathname,o=n.port,s=n.protocol,a=n.search;return a&&(t=function(e){var t,n,r={};if(e=e.replace(/^\?/,""))try{for(var i=Object(l.__values)(e.split("&")),o=i.next();!o.done;o=i.next()){var s=o.value,a=Object(l.__read)(s.split("="),2),u=a[0],c=a[1],f=void 0===c?null:c;u=decodeURIComponent(u),f&&(f=decodeURIComponent(f)),u in r?Array.isArray(r[u])?r[u].push(f):r[u]=[r[u],f]:r[u]=f}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r}(a)),{hostname:r,port:o?parseInt(o):void 0,protocol:s,path:i,query:t}}},cn=mt(mt({},un),{runtime:"browser",base64Decoder:jt,base64Encoder:function(e){for(var t="",n=0;n<e.length;n+=3){for(var r=0,i=0,o=n,s=Math.min(n+3,e.length);o<s;o++)r|=e[o]<<8*(s-o-1),i+=8;var a=Math.ceil(i/6);r<<=6*a-i;for(var u=1;u<=a;u++){var c=6*(a-u);t+=Ct[(r&63<<c)>>c]}t+="==".slice(0,4-a)}return t},bodyLengthChecker:function(e){if("string"==typeof e){for(var t=e.length,n=t-1;n>=0;n--){var r=e.charCodeAt(n);r>127&&r<=2047?t++:r>2047&&r<=65535&&(t+=2)}return t}return"number"==typeof e.byteLength?e.byteLength:"number"==typeof e.size?e.size:void 0},credentialDefaultProvider:function(e){return function(){return Promise.reject(new Error("Credential is missing"))}},defaultUserAgentProvider:(on={serviceId:un.serviceId,clientVersion:_t.version},sn=on.serviceId,an=on.clientVersion,function(){return Object(l.__awaiter)(void 0,void 0,void 0,(function(){var e,t,n,r,i,o,s,a,u;return Object(l.__generator)(this,(function(c){return e=(null===(n=null===window||void 0===window?void 0:window.navigator)||void 0===n?void 0:n.userAgent)?Jt.a.parse(window.navigator.userAgent):void 0,t=[["aws-sdk-js",an],["os/"+((null===(r=null==e?void 0:e.os)||void 0===r?void 0:r.name)||"other"),null===(i=null==e?void 0:e.os)||void 0===i?void 0:i.version],["lang/js"],["md/browser",(null!==(s=null===(o=null==e?void 0:e.browser)||void 0===o?void 0:o.name)&&void 0!==s?s:"unknown")+"_"+(null!==(u=null===(a=null==e?void 0:e.browser)||void 0===a?void 0:a.version)&&void 0!==u?u:"unknown")]],sn&&t.push(["api/"+sn,an]),[2,t]}))}))}),maxAttempts:3,region:(rn="Region is missing",function(){return Promise.reject(rn)}),requestHandler:new It,sha256:Et.Sha256,streamCollector:function(e){return"function"==typeof Blob&&e instanceof Blob?function(e){return Object(l.__awaiter)(this,void 0,void 0,(function(){var t,n;return Object(l.__generator)(this,(function(r){switch(r.label){case 0:return[4,Rt(e)];case 1:return t=r.sent(),n=jt(t),[2,new Uint8Array(n)]}}))}))}(e):function(e){return Object(l.__awaiter)(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return Object(l.__generator)(this,(function(u){switch(u.label){case 0:t=new Uint8Array(0),n=e.getReader(),r=!1,u.label=1;case 1:return r?[3,3]:[4,n.read()];case 2:return i=u.sent(),o=i.done,(s=i.value)&&(a=t,(t=new Uint8Array(a.length+s.length)).set(a),t.set(s,a.length)),r=o,[3,1];case 3:return[2,t]}}))}))}(e)},utf8Decoder:$t.fromUtf8,utf8Encoder:$t.toUtf8}),ln=function(e){var t=e.endpoint,n=e.urlParser;if("string"==typeof t){var r=Promise.resolve(n(t));return function(){return r}}if("object"==typeof t){var i=Promise.resolve(t);return function(){return i}}return t},fn=function(e){return Object(l.__awaiter)(void 0,void 0,void 0,(function(){var t,n,r,i,o;return Object(l.__generator)(this,(function(s){switch(s.label){case 0:return t=e.tls,n=void 0===t||t,[4,e.region()];case 1:if(r=s.sent(),!new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/).test(r))throw new Error("Invalid region in client config");return[4,e.regionInfoProvider(r)];case 2:if(!(i=(null!==(o=s.sent())&&void 0!==o?o:{}).hostname))throw new Error("Cannot resolve hostname from client config");return[2,e.urlParser((n?"https:":"http:")+"//"+i)]}}))}))},dn=function(e){if("string"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};var hn={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},pn=function(e){return{applyToStack:function(t){t.add(function(e){var t=this;return function(n){return function(r){return Object(l.__awaiter)(t,void 0,void 0,(function(){var t,i,o,s,a;return Object(l.__generator)(this,(function(u){return t=r.request,Se.isInstance(t)&&(i=t.body,o=t.headers,i&&-1===Object.keys(o).map((function(e){return e.toLowerCase()})).indexOf("content-length")&&void 0!==(s=e(i))&&(t.headers=Object(l.__assign)(Object(l.__assign)({},t.headers),((a={})["content-length"]=String(s),a)))),[2,n(Object(l.__assign)(Object(l.__assign)({},r),{request:t}))]}))}))}}}(e.bodyLengthChecker),hn)}}};for(var vn={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},yn=function(e){return{applyToStack:function(t){t.add(function(e){return function(t){return function(n){return Object(l.__awaiter)(void 0,void 0,void 0,(function(){var r,i;return Object(l.__generator)(this,(function(o){return Se.isInstance(n.request)?(r=n.request,i=(e.requestHandler.metadata||{}).handlerProtocol,(void 0===i?"":i).indexOf("h2")>=0&&!r.headers[":authority"]?(delete r.headers.host,r.headers[":authority"]=""):r.headers.host||(r.headers.host=r.hostname),[2,t(n)]):[2,t(n)]}))}))}}}(e),vn)}}},gn={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},mn=function(e){return{applyToStack:function(e){e.add((function(e,t){return function(n){return Object(l.__awaiter)(void 0,void 0,void 0,(function(){var r,i,o,s,a,u,c,f,d;return Object(l.__generator)(this,(function(h){switch(h.label){case 0:return r=t.clientName,i=t.commandName,o=t.inputFilterSensitiveLog,s=t.logger,a=t.outputFilterSensitiveLog,[4,e(n)];case 1:return u=h.sent(),s?("function"==typeof s.info&&(c=u.output,f=c.$metadata,d=Object(l.__rest)(c,["$metadata"]),s.info({clientName:r,commandName:i,input:o(n.input),output:a(d),metadata:f})),[2,u]):[2,u]}}))}))}}),gn)}}},bn={},wn={},Sn=0;Sn<256;Sn++){var _n=Sn.toString(16).toLowerCase();1===_n.length&&(_n="0"+_n),bn[Sn]=_n,wn[_n]=Sn}function En(e){for(var t="",n=0;n<e.byteLength;n++)t+=bn[e[n]];return t}var An="X-Amz-Date".toLowerCase(),On=["authorization",An,"date"],In="X-Amz-Signature".toLowerCase(),Tn="X-Amz-Security-Token".toLowerCase(),Cn={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},xn=/^proxy-/,Pn=/^sec-/,kn="AWS4-HMAC-SHA256-PAYLOAD",Nn={},Mn=[];function jn(e,t,n){return e+"/"+t+"/"+n+"/aws4_request"}function Rn(e,t,n){var r=new e(t);return r.update(n),r.digest()}function Dn(e,t,n){var r,i,o=e.headers,s={};try{for(var a=Object(l.__values)(Object.keys(o).sort()),u=a.next();!u.done;u=a.next()){var c=u.value,f=c.toLowerCase();(f in Cn||(null==t?void 0:t.has(f))||xn.test(f)||Pn.test(f))&&(!n||n&&!n.has(f))||(s[f]=o[c].trim().replace(/\s+/g," "))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return s}var Un=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,Fn)},Fn=function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()};function Ln(e,t){var n=e.headers,r=e.body;return Object(l.__awaiter)(this,void 0,void 0,(function(){var e,i,o,s,a,u,c;return Object(l.__generator)(this,(function(f){switch(f.label){case 0:try{for(e=Object(l.__values)(Object.keys(n)),i=e.next();!i.done;i=e.next())if("x-amz-content-sha256"===(o=i.value).toLowerCase())return[2,n[o]]}catch(e){u={error:e}}finally{try{i&&!i.done&&(c=e.return)&&c.call(e)}finally{if(u)throw u.error}}return null!=r?[3,1]:[2,"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"];case 1:return"string"==typeof r||ArrayBuffer.isView(r)||(d=r,"function"==typeof ArrayBuffer&&d instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(d))?((s=new t).update(r),a=En,[4,s.digest()]):[3,3];case 2:return[2,a.apply(void 0,[f.sent()])];case 3:return[2,"UNSIGNED-PAYLOAD"]}var d}))}))}function Bn(e){var t=e.headers,n=e.query,r=Object(l.__rest)(e,["headers","query"]);return Object(l.__assign)(Object(l.__assign)({},r),{headers:Object(l.__assign)({},t),query:n?qn(n):void 0})}function qn(e){return Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object(l.__assign)(Object(l.__assign)({},t),((r={})[n]=Array.isArray(i)?Object(l.__spread)(i):i,r))}),{})}function zn(e){var t,n;e="function"==typeof e.clone?e.clone():Bn(e);try{for(var r=Object(l.__values)(Object.keys(e.headers)),i=r.next();!i.done;i=r.next()){var o=i.value;On.indexOf(o.toLowerCase())>-1&&delete e.headers[o]}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}return e}function Kn(e){return function(e){if("number"==typeof e)return new Date(1e3*e);if("string"==typeof e)return Number(e)?new Date(1e3*Number(e)):new Date(e);return e}(e).toISOString().replace(/\.\d{3}Z$/,"Z")}var Vn=function(){function e(e){var t=e.applyChecksum,n=e.credentials,r=e.region,i=e.service,o=e.sha256,s=e.uriEscapePath,a=void 0===s||s;this.service=i,this.sha256=o,this.uriEscapePath=a,this.applyChecksum="boolean"!=typeof t||t,this.regionProvider=Wn(r),this.credentialProvider=Yn(n)}return e.prototype.presign=function(e,t){return void 0===t&&(t={}),Object(l.__awaiter)(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,f,d,h,p,v,y,g,m,b,w,S,_,E,A,O,I;return Object(l.__generator)(this,(function(T){switch(T.label){case 0:return n=t.signingDate,r=void 0===n?new Date:n,i=t.expiresIn,o=void 0===i?3600:i,s=t.unsignableHeaders,a=t.unhoistableHeaders,u=t.signableHeaders,c=t.signingRegion,f=t.signingService,[4,this.credentialProvider()];case 1:return d=T.sent(),null==c?[3,2]:(p=c,[3,4]);case 2:return[4,this.regionProvider()];case 3:p=T.sent(),T.label=4;case 4:return h=p,v=Hn(r),y=v.longDate,g=v.shortDate,o>604800?[2,Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future")]:(m=jn(g,h,null!=f?f:this.service),b=function(e,t){var n,r,i;void 0===t&&(t={});var o="function"==typeof e.clone?e.clone():Bn(e),s=o.headers,a=o.query,u=void 0===a?{}:a;try{for(var c=Object(l.__values)(Object.keys(s)),f=c.next();!f.done;f=c.next()){var d=f.value,h=d.toLowerCase();"x-amz-"!==h.substr(0,6)||(null===(i=t.unhoistableHeaders)||void 0===i?void 0:i.has(h))||(u[d]=s[d],delete s[d])}}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}return Object(l.__assign)(Object(l.__assign)({},e),{headers:s,query:u})}(zn(e),{unhoistableHeaders:a}),d.sessionToken&&(b.query["X-Amz-Security-Token"]=d.sessionToken),b.query["X-Amz-Algorithm"]="AWS4-HMAC-SHA256",b.query["X-Amz-Credential"]=d.accessKeyId+"/"+m,b.query["X-Amz-Date"]=y,b.query["X-Amz-Expires"]=o.toString(10),w=Dn(b,s,u),b.query["X-Amz-SignedHeaders"]=Gn(w),S=b.query,_="X-Amz-Signature",E=this.getSignature,A=[y,m,this.getSigningKey(d,h,g,f)],O=this.createCanonicalRequest,I=[b,w],[4,Ln(e,this.sha256)]);case 5:return[4,E.apply(this,A.concat([O.apply(this,I.concat([T.sent()]))]))];case 6:return S[_]=T.sent(),[2,b]}}))}))},e.prototype.sign=function(e,t){return Object(l.__awaiter)(this,void 0,void 0,(function(){return Object(l.__generator)(this,(function(n){return"string"==typeof e?[2,this.signString(e,t)]:e.headers&&e.payload?[2,this.signEvent(e,t)]:[2,this.signRequest(e,t)]}))}))},e.prototype.signEvent=function(e,t){var n=e.headers,r=e.payload,i=t.signingDate,o=void 0===i?new Date:i,s=t.priorSignature,a=t.signingRegion,u=t.signingService;return Object(l.__awaiter)(this,void 0,void 0,(function(){var e,t,i,c,f,d,h,p,v,y,g;return Object(l.__generator)(this,(function(l){switch(l.label){case 0:return null==a?[3,1]:(t=a,[3,3]);case 1:return[4,this.regionProvider()];case 2:t=l.sent(),l.label=3;case 3:return e=t,i=Hn(o),c=i.shortDate,f=i.longDate,d=jn(c,e,null!=u?u:this.service),[4,Ln({headers:{},body:r},this.sha256)];case 4:return h=l.sent(),(p=new this.sha256).update(n),y=En,[4,p.digest()];case 5:return v=y.apply(void 0,[l.sent()]),g=[kn,f,d,s,v,h].join("\n"),[2,this.signString(g,{signingDate:o,signingRegion:e,signingService:u})]}}))}))},e.prototype.signString=function(e,t){var n=void 0===t?{}:t,r=n.signingDate,i=void 0===r?new Date:r,o=n.signingRegion,s=n.signingService;return Object(l.__awaiter)(this,void 0,void 0,(function(){var t,n,r,a,u,c,f,d;return Object(l.__generator)(this,(function(l){switch(l.label){case 0:return[4,this.credentialProvider()];case 1:return t=l.sent(),null==o?[3,2]:(r=o,[3,4]);case 2:return[4,this.regionProvider()];case 3:r=l.sent(),l.label=4;case 4:return n=r,a=Hn(i).shortDate,f=(c=this.sha256).bind,[4,this.getSigningKey(t,n,a,s)];case 5:return(u=new(f.apply(c,[void 0,l.sent()]))).update(e),d=En,[4,u.digest()];case 6:return[2,d.apply(void 0,[l.sent()])]}}))}))},e.prototype.signRequest=function(e,t){var n=void 0===t?{}:t,r=n.signingDate,i=void 0===r?new Date:r,o=n.signableHeaders,s=n.unsignableHeaders,a=n.signingRegion,u=n.signingService;return Object(l.__awaiter)(this,void 0,void 0,(function(){var t,n,r,c,f,d,h,p,v,y,g;return Object(l.__generator)(this,(function(m){switch(m.label){case 0:return[4,this.credentialProvider()];case 1:return t=m.sent(),null==a?[3,2]:(r=a,[3,4]);case 2:return[4,this.regionProvider()];case 3:r=m.sent(),m.label=4;case 4:return n=r,c=zn(e),f=Hn(i),d=f.longDate,h=f.shortDate,p=jn(h,n,null!=u?u:this.service),c.headers[An]=d,t.sessionToken&&(c.headers[Tn]=t.sessionToken),[4,Ln(c,this.sha256)];case 5:return v=m.sent(),!function(e,t){var n,r;e=e.toLowerCase();try{for(var i=Object(l.__values)(Object.keys(t)),o=i.next();!o.done;o=i.next()){if(e===o.value.toLowerCase())return!0}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!1}("x-amz-content-sha256",c.headers)&&this.applyChecksum&&(c.headers["x-amz-content-sha256"]=v),y=Dn(c,s,o),[4,this.getSignature(d,p,this.getSigningKey(t,n,h,u),this.createCanonicalRequest(c,y,v))];case 6:return g=m.sent(),c.headers.authorization="AWS4-HMAC-SHA256 Credential="+t.accessKeyId+"/"+p+", SignedHeaders="+Gn(y)+", Signature="+g,[2,c]}}))}))},e.prototype.createCanonicalRequest=function(e,t,n){var r=Object.keys(t).sort();return e.method+"\n"+this.getCanonicalPath(e)+"\n"+function(e){var t,n,r=e.query,i=void 0===r?{}:r,o=[],s={},a=function(e){if(e.toLowerCase()===In)return"continue";o.push(e);var t=i[e];"string"==typeof t?s[e]=Un(e)+"="+Un(t):Array.isArray(t)&&(s[e]=t.slice(0).sort().reduce((function(t,n){return t.concat([Un(e)+"="+Un(n)])}),[]).join("&"))};try{for(var u=Object(l.__values)(Object.keys(i).sort()),c=u.next();!c.done;c=u.next()){a(c.value)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}return o.map((function(e){return s[e]})).filter((function(e){return e})).join("&")}(e)+"\n"+r.map((function(e){return e+":"+t[e]})).join("\n")+"\n\n"+r.join(";")+"\n"+n},e.prototype.createStringToSign=function(e,t,n){return Object(l.__awaiter)(this,void 0,void 0,(function(){var r,i;return Object(l.__generator)(this,(function(o){switch(o.label){case 0:return(r=new this.sha256).update(n),[4,r.digest()];case 1:return i=o.sent(),[2,"AWS4-HMAC-SHA256\n"+e+"\n"+t+"\n"+En(i)]}}))}))},e.prototype.getCanonicalPath=function(e){var t=e.path;return this.uriEscapePath?"/"+encodeURIComponent(t.replace(/^\//,"")).replace(/%2F/g,"/"):t},e.prototype.getSignature=function(e,t,n,r){return Object(l.__awaiter)(this,void 0,void 0,(function(){var i,o,s,a,u;return Object(l.__generator)(this,(function(c){switch(c.label){case 0:return[4,this.createStringToSign(e,t,r)];case 1:return i=c.sent(),a=(s=this.sha256).bind,[4,n];case 2:return(o=new(a.apply(s,[void 0,c.sent()]))).update(i),u=En,[4,o.digest()];case 3:return[2,u.apply(void 0,[c.sent()])]}}))}))},e.prototype.getSigningKey=function(e,t,n,r){return function(e,t,n,r,i){return Object(l.__awaiter)(void 0,void 0,void 0,(function(){var o,s,a,u,c,f,d,h,p;return Object(l.__generator)(this,(function(v){switch(v.label){case 0:return[4,Rn(e,t.secretAccessKey,t.accessKeyId)];case 1:if(o=v.sent(),(s=n+":"+r+":"+i+":"+En(o)+":"+t.sessionToken)in Nn)return[2,Nn[s]];for(Mn.push(s);Mn.length>50;)delete Nn[Mn.shift()];a="AWS4"+t.secretAccessKey,v.label=2;case 2:v.trys.push([2,7,8,9]),u=Object(l.__values)([n,r,i,"aws4_request"]),c=u.next(),v.label=3;case 3:return c.done?[3,6]:(f=c.value,[4,Rn(e,a,f)]);case 4:a=v.sent(),v.label=5;case 5:return c=u.next(),[3,3];case 6:return[3,9];case 7:return d=v.sent(),h={error:d},[3,9];case 8:try{c&&!c.done&&(p=u.return)&&p.call(u)}finally{if(h)throw h.error}return[7];case 9:return[2,Nn[s]=a]}}))}))}(this.sha256,e,n,t,r||this.service)},e}(),Hn=function(e){var t=Kn(e).replace(/[\-:]/g,"");return{longDate:t,shortDate:t.substr(0,8)}},Gn=function(e){return Object.keys(e).sort().join(";")},Wn=function(e){if("string"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e},Yn=function(e){if("object"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};function Jn(e){if("object"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e}var $n,Zn,Qn,Xn,er,tr,nr,rr,ir,or,sr,ar,ur,cr,lr,fr,dr,hr,pr,vr,yr,gr,mr,br,wr,Sr,_r,Er,Ar,Or,Ir,Tr,Cr,xr,Pr,kr,Nr,Mr,jr,Rr,Dr,Ur,Fr,Lr,Br,qr,zr,Kr,Vr,Hr,Gr,Wr,Yr,Jr,$r,Zr,Qr,Xr=/[^\!\#\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,ei=function(e){var t=Object(l.__read)(e,2),n=t[0],r=t[1],i=n.indexOf("/"),o=n.substring(0,i),s=n.substring(i+1);return"api"===o&&(s=s.toLowerCase()),[o,s,r].filter((function(e){return e&&e.length>0})).map((function(e){return null==e?void 0:e.replace(Xr,"_")})).join("/")},ti={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},ni=function(e){return{applyToStack:function(t){var n;t.add((n=e,function(e,t){return function(r){return Object(l.__awaiter)(void 0,void 0,void 0,(function(){var i,o,s,a,u,c,f,d;return Object(l.__generator)(this,(function(h){switch(h.label){case 0:return i=r.request,Se.isInstance(i)?(o=i.headers,s=(null===(f=null==t?void 0:t.userAgent)||void 0===f?void 0:f.map(ei))||[],[4,n.defaultUserAgentProvider()]):[2,e(r)];case 1:return a=h.sent().map(ei),u=(null===(d=null==n?void 0:n.customUserAgent)||void 0===d?void 0:d.map(ei))||[],o["x-amz-user-agent"]=Object(l.__spread)(a,s,u).join(" "),c=Object(l.__spread)(a.filter((function(e){return e.startsWith("aws-sdk-")})),u).join(" "),"browser"!==n.runtime&&c&&(o["user-agent"]=o["user-agent"]?o["user-agent"]+" "+c:c),[2,e(Object(l.__assign)(Object(l.__assign)({},r),{request:i}))]}}))}))}}),ti)}}},ri=function(e){function t(t){var n,r,i=this,o=function(e){var t,n=this,r=Jn(e.credentials||e.credentialDefaultProvider(e)),i=e.signingEscapePath,o=void 0===i||i,s=e.systemClockOffset,a=void 0===s?e.systemClockOffset||0:s,u=e.sha256;return t=e.signer?Jn(e.signer):function(){return Jn(e.region)().then((function(t){return Object(l.__awaiter)(n,void 0,void 0,(function(){return Object(l.__generator)(this,(function(n){switch(n.label){case 0:return[4,e.regionInfoProvider(t)];case 1:return[2,[n.sent()||{},t]]}}))}))})).then((function(t){var n=Object(l.__read)(t,2),i=n[0],s=n[1],a=i.signingRegion,c=i.signingService;return e.signingRegion=e.signingRegion||a||s,e.signingName=e.signingName||c||e.serviceId,new Vn({credentials:r,region:e.signingRegion,service:e.signingName,sha256:u,uriEscapePath:o})}))},Object(l.__assign)(Object(l.__assign)({},e),{systemClockOffset:a,signingEscapePath:o,credentials:r,signer:t})}(function(e){var t;return Object(l.__assign)(Object(l.__assign)({},e),{tls:null===(t=e.tls)||void 0===t||t,endpoint:e.endpoint?ln(e):function(){return fn(e)},isCustomEndpoint:!!e.endpoint})}(function(e){if(!e.region)throw new Error("Region is missing");return Object(l.__assign)(Object(l.__assign)({},e),{region:dn(e.region)})}(mt(mt({},cn),t)))),s=function(e){return Object(l.__assign)(Object(l.__assign)({},e),{customUserAgent:"string"==typeof e.customUserAgent?[[e.customUserAgent]]:e.customUserAgent})}((r=Wt((n=o).maxAttempts),Object(l.__assign)(Object(l.__assign)({},n),{maxAttempts:r,retryStrategy:n.retryStrategy||new Gt(r)})));return(i=e.call(this,s)||this).config=s,i.middlewareStack.use(Ut(i.config)),i.middlewareStack.use(pn(i.config)),i.middlewareStack.use(yn(i.config)),i.middlewareStack.use(mn(i.config)),i.middlewareStack.use(ni(i.config)),i}return gt(t,e),t.prototype.destroy=function(){e.prototype.destroy.call(this)},t}(ot);!function(e){e.AUTHENTICATED_ROLE="AuthenticatedRole",e.DENY="Deny"}($n||($n={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Zn||(Zn={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Qn||(Qn={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Xn||(Xn={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(er||(er={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(tr||(tr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(nr||(nr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(rr||(rr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(ir||(ir={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(or||(or={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(sr||(sr={})),function(e){e.ACCESS_DENIED="AccessDenied",e.INTERNAL_SERVER_ERROR="InternalServerError"}(ar||(ar={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(ur||(ur={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(cr||(cr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(lr||(lr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(fr||(fr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(dr||(dr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(hr||(hr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(pr||(pr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(vr||(vr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(yr||(yr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(gr||(gr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(mr||(mr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(br||(br={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(wr||(wr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Sr||(Sr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(_r||(_r={})),function(e){e.CONTAINS="Contains",e.EQUALS="Equals",e.NOT_EQUAL="NotEqual",e.STARTS_WITH="StartsWith"}(Er||(Er={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Ar||(Ar={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Or||(Or={})),function(e){e.RULES="Rules",e.TOKEN="Token"}(Ir||(Ir={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Tr||(Tr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Cr||(Cr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(xr||(xr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Pr||(Pr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(kr||(kr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Nr||(Nr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Mr||(Mr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(jr||(jr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Rr||(Rr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Dr||(Dr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Ur||(Ur={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Fr||(Fr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Lr||(Lr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Br||(Br={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(qr||(qr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(zr||(zr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Kr||(Kr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Vr||(Vr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Hr||(Hr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Gr||(Gr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Wr||(Wr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Yr||(Yr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Jr||(Jr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}($r||($r={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Zr||(Zr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Qr||(Qr={}));var ii=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return wt(this,(function(g){switch(g.label){case 0:return r=[mt({},e)],y={},[4,Mi(e.body,t)];case 1:switch(n=mt.apply(void 0,r.concat([(y.body=g.sent(),y)])),o="UnknownError",o=ji(e,n.body),o){case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":return[3,2];case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":return[3,4];case"InvalidIdentityPoolConfigurationException":case"com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException":return[3,6];case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":return[3,8];case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":return[3,10];case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":return[3,12];case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":return[3,14];case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":return[3,16]}return[3,18];case 2:return s=[{}],[4,si(n,t)];case 3:return i=mt.apply(void 0,[mt.apply(void 0,s.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 4:return a=[{}],[4,ai(n,t)];case 5:return i=mt.apply(void 0,[mt.apply(void 0,a.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 6:return u=[{}],[4,ui(n,t)];case 7:return i=mt.apply(void 0,[mt.apply(void 0,u.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 8:return c=[{}],[4,ci(n,t)];case 9:return i=mt.apply(void 0,[mt.apply(void 0,c.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 10:return l=[{}],[4,fi(n,t)];case 11:return i=mt.apply(void 0,[mt.apply(void 0,l.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 12:return f=[{}],[4,di(n,t)];case 13:return i=mt.apply(void 0,[mt.apply(void 0,f.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 14:return d=[{}],[4,hi(n,t)];case 15:return i=mt.apply(void 0,[mt.apply(void 0,d.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 16:return h=[{}],[4,pi(n,t)];case 17:return i=mt.apply(void 0,[mt.apply(void 0,h.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 18:p=n.body,o=p.code||p.Code||o,i=mt(mt({},p),{name:""+o,message:p.message||p.Message||o,$fault:"client",$metadata:Pi(e)}),g.label=19;case 19:return v=i.message||i.Message||o,i.message=v,delete i.Message,[2,Promise.reject(Object.assign(new Error(v),i))]}}))}))},oi=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return wt(this,(function(g){switch(g.label){case 0:return r=[mt({},e)],y={},[4,Mi(e.body,t)];case 1:switch(n=mt.apply(void 0,r.concat([(y.body=g.sent(),y)])),o="UnknownError",o=ji(e,n.body),o){case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":return[3,2];case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":return[3,4];case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":return[3,6];case"LimitExceededException":case"com.amazonaws.cognitoidentity#LimitExceededException":return[3,8];case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":return[3,10];case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":return[3,12];case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":return[3,14];case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":return[3,16]}return[3,18];case 2:return s=[{}],[4,si(n,t)];case 3:return i=mt.apply(void 0,[mt.apply(void 0,s.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 4:return a=[{}],[4,ai(n,t)];case 5:return i=mt.apply(void 0,[mt.apply(void 0,a.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 6:return u=[{}],[4,ci(n,t)];case 7:return i=mt.apply(void 0,[mt.apply(void 0,u.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 8:return c=[{}],[4,li(n,t)];case 9:return i=mt.apply(void 0,[mt.apply(void 0,c.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 10:return l=[{}],[4,fi(n,t)];case 11:return i=mt.apply(void 0,[mt.apply(void 0,l.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 12:return f=[{}],[4,di(n,t)];case 13:return i=mt.apply(void 0,[mt.apply(void 0,f.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 14:return d=[{}],[4,hi(n,t)];case 15:return i=mt.apply(void 0,[mt.apply(void 0,d.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 16:return h=[{}],[4,pi(n,t)];case 17:return i=mt.apply(void 0,[mt.apply(void 0,h.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 18:p=n.body,o=p.code||p.Code||o,i=mt(mt({},p),{name:""+o,message:p.message||p.Message||o,$fault:"client",$metadata:Pi(e)}),g.label=19;case 19:return v=i.message||i.Message||o,i.message=v,delete i.Message,[2,Promise.reject(Object.assign(new Error(v),i))]}}))}))},si=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=bi(n,t),[2,mt({name:"ExternalServiceException",$fault:"client",$metadata:Pi(e)},r)]}))}))},ai=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=_i(n,t),[2,mt({name:"InternalErrorException",$fault:"server",$metadata:Pi(e)},r)]}))}))},ui=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=Ei(n,t),[2,mt({name:"InvalidIdentityPoolConfigurationException",$fault:"client",$metadata:Pi(e)},r)]}))}))},ci=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=Ai(n,t),[2,mt({name:"InvalidParameterException",$fault:"client",$metadata:Pi(e)},r)]}))}))},li=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=Oi(n,t),[2,mt({name:"LimitExceededException",$fault:"client",$metadata:Pi(e)},r)]}))}))},fi=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=Ii(n,t),[2,mt({name:"NotAuthorizedException",$fault:"client",$metadata:Pi(e)},r)]}))}))},di=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=Ti(n,t),[2,mt({name:"ResourceConflictException",$fault:"client",$metadata:Pi(e)},r)]}))}))},hi=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=Ci(n,t),[2,mt({name:"ResourceNotFoundException",$fault:"client",$metadata:Pi(e)},r)]}))}))},pi=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=xi(n,t),[2,mt({name:"TooManyRequestsException",$fault:"client",$metadata:Pi(e)},r)]}))}))},vi=function(e,t){return mt(mt(mt({},void 0!==e.CustomRoleArn&&null!==e.CustomRoleArn&&{CustomRoleArn:e.CustomRoleArn}),void 0!==e.IdentityId&&null!==e.IdentityId&&{IdentityId:e.IdentityId}),void 0!==e.Logins&&null!==e.Logins&&{Logins:gi(e.Logins,t)})},yi=function(e,t){return mt(mt(mt({},void 0!==e.AccountId&&null!==e.AccountId&&{AccountId:e.AccountId}),void 0!==e.IdentityPoolId&&null!==e.IdentityPoolId&&{IdentityPoolId:e.IdentityPoolId}),void 0!==e.Logins&&null!==e.Logins&&{Logins:gi(e.Logins,t)})},gi=function(e,t){return Object.entries(e).reduce((function(e,t){var n,r=St(t,2),i=r[0],o=r[1];return null===o?e:mt(mt({},e),((n={})[i]=o,n))}),{})},mi=function(e,t){return{AccessKeyId:void 0!==e.AccessKeyId&&null!==e.AccessKeyId?e.AccessKeyId:void 0,Expiration:void 0!==e.Expiration&&null!==e.Expiration?new Date(Math.round(1e3*e.Expiration)):void 0,SecretKey:void 0!==e.SecretKey&&null!==e.SecretKey?e.SecretKey:void 0,SessionToken:void 0!==e.SessionToken&&null!==e.SessionToken?e.SessionToken:void 0}},bi=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},wi=function(e,t){return{Credentials:void 0!==e.Credentials&&null!==e.Credentials?mi(e.Credentials):void 0,IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},Si=function(e,t){return{IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},_i=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ei=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ai=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Oi=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ii=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ti=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ci=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},xi=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Pi=function(e){var t;return{httpStatusCode:e.statusCode,requestId:null!==(t=e.headers["x-amzn-requestid"])&&void 0!==t?t:e.headers["x-amzn-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}},ki=function(e,t){return void 0===e&&(e=new Uint8Array),e instanceof Uint8Array?Promise.resolve(e):t.streamCollector(e)||Promise.resolve(new Uint8Array)},Ni=function(e,t,n,r,i){return bt(void 0,void 0,void 0,(function(){var o,s,a,u,c,l;return wt(this,(function(f){switch(f.label){case 0:return[4,e.endpoint()];case 1:return o=f.sent(),s=o.hostname,a=o.protocol,u=void 0===a?"https":a,c=o.port,l={protocol:u,hostname:s,port:c,method:"POST",path:n,headers:t},void 0!==r&&(l.hostname=r),void 0!==i&&(l.body=i),[2,new Se(l)]}}))}))},Mi=function(e,t){return function(e,t){return ki(e,t).then((function(e){return t.utf8Encoder(e)}))}(e,t).then((function(e){return e.length?JSON.parse(e):{}}))},ji=function(e,t){var n,r,i=function(e){var t=e;return t.indexOf(":")>=0&&(t=t.split(":")[0]),t.indexOf("#")>=0&&(t=t.split("#")[1]),t},o=(n=e.headers,r="x-amzn-errortype",Object.keys(n).find((function(e){return e.toLowerCase()===r.toLowerCase()})));return void 0!==o?i(e.headers[o]):void 0!==t.code?i(t.code):void 0!==t.__type?i(t.__type):""},Ri=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return gt(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(tt(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetIdCommand",inputFilterSensitiveLog:wr.filterSensitiveLog,outputFilterSensitiveLog:Sr.filterSensitiveLog},o=t.requestHandler;return r.resolve((function(e){return o.handle(e.request,n||{})}),i)},t.prototype.serialize=function(e,t){return function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetId"},r=JSON.stringify(yi(e,t)),[2,Ni(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r,i;return wt(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,oi(e,t)]:[4,Mi(e.body,t)];case 1:return n=o.sent(),{},r=Si(n,t),i=mt({$metadata:Pi(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(st),Di=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return gt(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(tt(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetCredentialsForIdentityCommand",inputFilterSensitiveLog:yr.filterSensitiveLog,outputFilterSensitiveLog:mr.filterSensitiveLog},o=t.requestHandler;return r.resolve((function(e){return o.handle(e.request,n||{})}),i)},t.prototype.serialize=function(e,t){return function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetCredentialsForIdentity"},r=JSON.stringify(vi(e,t)),[2,Ni(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r,i;return wt(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,ii(e,t)]:[4,Mi(e.body,t)];case 1:return n=o.sent(),{},r=wi(n,t),i=mt({$metadata:Pi(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(st),Ui=function(){return(Ui=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},Fi=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},Li=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Bi=new r.a("Credentials"),qi=new(function(){function e(e){this._gettingCredPromise=null,this._refreshHandlers={},this.Auth=void 0,this.configure(e),this._refreshHandlers.google=s.b.refreshGoogleToken,this._refreshHandlers.facebook=s.a.refreshFacebookToken}return e.prototype.getModuleName=function(){return"Credentials"},e.prototype.getCredSource=function(){return this._credentials_source},e.prototype.configure=function(e){if(!e)return this._config||{};this._config=Object.assign({},this._config,e);var t=this._config.refreshHandlers;return t&&(this._refreshHandlers=Ui(Ui({},this._refreshHandlers),t)),this._storage=this._config.storage,this._storage||(this._storage=(new i.a).getStorage()),this._storageSync=Promise.resolve(),"function"==typeof this._storage.sync&&(this._storageSync=this._storage.sync()),this._config},e.prototype.get=function(){return Bi.debug("getting credentials"),this._pickupCredentials()},e.prototype._getCognitoIdentityIdStorageKey=function(e){return"CognitoIdentityId-"+e},e.prototype._pickupCredentials=function(){return Bi.debug("picking up credentials"),this._gettingCredPromise&&this._gettingCredPromise.isPending()?Bi.debug("getting old cred promise"):(Bi.debug("getting new cred promise"),this._gettingCredPromise=Object(o.d)(this._keepAlive())),this._gettingCredPromise},e.prototype._keepAlive=function(){return Fi(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return Li(this,(function(a){switch(a.label){case 0:if(Bi.debug("checking if credentials exists and not expired"),(e=this._credentials)&&!this._isExpired(e)&&!this._isPastTTL())return Bi.debug("credentials not changed and not expired, directly return"),[2,Promise.resolve(e)];if(Bi.debug("need to get a new credential or refresh the existing one"),t=this.Auth,!(n=void 0===t?c.a.Auth:t)||"function"!=typeof n.currentUserCredentials)return[2,Promise.reject("No Auth module registered in Amplify")];if(this._isExpired(e)||!this._isPastTTL())return[3,6];Bi.debug("ttl has passed but token is not yet expired"),a.label=1;case 1:return a.trys.push([1,5,,6]),[4,n.currentUserPoolUser()];case 2:return r=a.sent(),[4,n.currentSession()];case 3:return i=a.sent(),o=i.refreshToken,[4,new Promise((function(e,t){r.refreshSession(o,(function(n,r){return n?t(n):e(r)}))}))];case 4:return a.sent(),[3,6];case 5:return s=a.sent(),Bi.debug("Error attempting to refreshing the session",s),[3,6];case 6:return[2,n.currentUserCredentials()]}}))}))},e.prototype.refreshFederatedToken=function(e){Bi.debug("Getting federated credentials");var t=e.provider,n=e.user,r=e.token,i=e.identity_id,o=e.expires_at;o=1970===new Date(o).getFullYear()?1e3*o:o;return Bi.debug("checking if federated jwt token expired"),o>(new Date).getTime()?(Bi.debug("token not expired"),this._setCredentialsFromFederation({provider:t,token:r,user:n,identity_id:i,expires_at:o})):this._refreshHandlers[t]&&"function"==typeof this._refreshHandlers[t]?(Bi.debug("getting refreshed jwt token from federation provider"),this._providerRefreshWithRetry({refreshHandler:this._refreshHandlers[t],provider:t,user:n})):(Bi.debug("no refresh handler for provider:",t),this.clear(),Promise.reject("no refresh handler for provider"))},e.prototype._providerRefreshWithRetry=function(e){var t=this,n=e.refreshHandler,r=e.provider,i=e.user;return Object(a.c)(n,[],1e4).then((function(e){return Bi.debug("refresh federated token sucessfully",e),t._setCredentialsFromFederation({provider:r,token:e.token,user:i,identity_id:e.identity_id,expires_at:e.expires_at})})).catch((function(e){return"string"==typeof e&&0===e.toLowerCase().lastIndexOf("network error",e.length)||t.clear(),Bi.debug("refresh federated token failed",e),Promise.reject("refreshing federation token failed: "+e)}))},e.prototype._isExpired=function(e){if(!e)return Bi.debug("no credentials for expiration check"),!0;Bi.debug("are these credentials expired?",e);var t=Date.now();return e.expiration.getTime()<=t},e.prototype._isPastTTL=function(){return this._nextCredentialsRefresh<=Date.now()},e.prototype._setCredentialsForGuest=function(){return Fi(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a=this;return Li(this,(function(c){switch(c.label){case 0:return Bi.debug("setting credentials for guest"),e=this._config,t=e.identityPoolId,n=e.region,e.mandatorySignIn?[2,Promise.reject("cannot get guest credentials when mandatory signin enabled")]:t?n?(i=this,[4,this._getGuestIdentityId()]):(Bi.debug("region is not configured for getting the credentials"),[2,Promise.reject("region is not configured for getting the credentials")]):(Bi.debug("No Cognito Identity pool provided for unauthenticated access"),[2,Promise.reject("No Cognito Identity pool provided for unauthenticated access")]);case 1:return r=i._identityId=c.sent(),o=new ri({region:n,customUserAgent:Object(u.b)()}),s=void 0,s=r?ft({identityId:r,client:o})():function(){return Fi(a,void 0,void 0,(function(){var e;return Li(this,(function(n){switch(n.label){case 0:return[4,o.send(new Ri({IdentityPoolId:t}))];case 1:return e=n.sent().IdentityId,this._identityId=e,[2,ft({client:o,identityId:e})()]}}))}))}().catch((function(e){return Fi(a,void 0,void 0,(function(){return Li(this,(function(t){throw e}))}))})),[2,this._loadCredentials(s,"guest",!1,null).then((function(e){return e})).catch((function(e){return Fi(a,void 0,void 0,(function(){var n=this;return Li(this,(function(i){switch(i.label){case 0:return"ResourceNotFoundException"!==e.name||e.message!=="Identity '"+r+"' not found."?[3,2]:(Bi.debug("Failed to load guest credentials"),[4,this._removeGuestIdentityId()]);case 1:return i.sent(),s=function(){return Fi(n,void 0,void 0,(function(){var e;return Li(this,(function(n){switch(n.label){case 0:return[4,o.send(new Ri({IdentityPoolId:t}))];case 1:return e=n.sent().IdentityId,this._identityId=e,[2,ft({client:o,identityId:e})()]}}))}))}().catch((function(e){return Fi(n,void 0,void 0,(function(){return Li(this,(function(t){throw e}))}))})),[2,this._loadCredentials(s,"guest",!1,null)];case 2:return[2,e]}}))}))}))]}}))}))},e.prototype._setCredentialsFromFederation=function(e){var t=e.provider,n=e.token,r=e.identity_id,i={google:"accounts.google.com",facebook:"graph.facebook.com",amazon:"www.amazon.com",developer:"cognito-identity.amazonaws.com"}[t]||t;if(!i)return Promise.reject("You must specify a federated provider");var o={};o[i]=n;var s=this._config,a=s.identityPoolId,c=s.region;if(!a)return Bi.debug("No Cognito Federated Identity pool provided"),Promise.reject("No Cognito Federated Identity pool provided");if(!c)return Bi.debug("region is not configured for getting the credentials"),Promise.reject("region is not configured for getting the credentials");var l=new ri({region:c,customUserAgent:Object(u.b)()}),f=void 0;r?f=ft({identityId:r,logins:o,client:l})():f=vt({logins:o,identityPoolId:a,client:l})();return this._loadCredentials(f,"federated",!0,e)},e.prototype._setCredentialsFromSession=function(e){var t=this;Bi.debug("set credentials from session");var n=e.getIdToken().getJwtToken(),r=this._config,i=r.region,o=r.userPoolId,s=r.identityPoolId;if(!s)return Bi.debug("No Cognito Federated Identity pool provided"),Promise.reject("No Cognito Federated Identity pool provided");if(!i)return Bi.debug("region is not configured for getting the credentials"),Promise.reject("region is not configured for getting the credentials");var a={};a["cognito-idp."+i+".amazonaws.com/"+o]=n;var c=new ri({region:i,customUserAgent:Object(u.b)()}),l=Fi(t,void 0,void 0,(function(){var e,t,n,r,i,o,u,l,f,d;return Li(this,(function(h){switch(h.label){case 0:return[4,this._getGuestIdentityId()];case 1:return(e=h.sent())?[3,3]:[4,c.send(new Ri({IdentityPoolId:s,Logins:a}))];case 2:n=h.sent().IdentityId,t=n,h.label=3;case 3:return[4,c.send(new Di({IdentityId:e||t,Logins:a}))];case 4:return r=h.sent(),i=r.Credentials,o=i.AccessKeyId,u=i.Expiration,l=i.SecretKey,f=i.SessionToken,d=r.IdentityId,this._identityId=d,e?(Bi.debug("The guest identity "+e+" has been successfully linked to the logins"),e===d&&Bi.debug("The guest identity "+e+" has become the primary identity"),[4,this._removeGuestIdentityId()]):[3,6];case 5:h.sent(),h.label=6;case 6:return[2,{accessKeyId:o,secretAccessKey:l,sessionToken:f,expiration:u,identityId:d}]}}))})).catch((function(e){return Fi(t,void 0,void 0,(function(){return Li(this,(function(t){throw e}))}))}));return this._loadCredentials(l,"userPool",!0,null)},e.prototype._loadCredentials=function(e,t,n,r){var i=this,o=this;return new Promise((function(s,a){e.then((function(e){return Fi(i,void 0,void 0,(function(){var i,a,u,c,l;return Li(this,(function(f){switch(f.label){case 0:if(Bi.debug("Load credentials successfully",e),this._identityId&&!e.identityId&&(e.identityId=this._identityId),o._credentials=e,o._credentials.authenticated=n,o._credentials_source=t,o._nextCredentialsRefresh=(new Date).getTime()+3e6,"federated"===t){i=Object.assign({id:this._credentials.identityId},r.user),a=r.provider,u=r.token,c=r.expires_at,l=r.identity_id;try{this._storage.setItem("aws-amplify-federatedInfo",JSON.stringify({provider:a,token:u,user:i,expires_at:c,identity_id:l}))}catch(e){Bi.debug("Failed to put federated info into auth storage",e)}}return"guest"!==t?[3,2]:[4,this._setGuestIdentityId(e.identityId)];case 1:f.sent(),f.label=2;case 2:return s(o._credentials),[2]}}))}))})).catch((function(t){if(t)return Bi.debug("Failed to load credentials",e),Bi.debug("Error loading credentials",t),void a(t)}))}))},e.prototype.set=function(e,t){return"session"===t?this._setCredentialsFromSession(e):"federation"===t?this._setCredentialsFromFederation(e):"guest"===t?this._setCredentialsForGuest():(Bi.debug("no source specified for setting credentials"),Promise.reject("invalid source"))},e.prototype.clear=function(){return Fi(this,void 0,void 0,(function(){return Li(this,(function(e){return this._credentials=null,this._credentials_source=null,Bi.debug("removing aws-amplify-federatedInfo from storage"),this._storage.removeItem("aws-amplify-federatedInfo"),[2]}))}))},e.prototype._getGuestIdentityId=function(){return Fi(this,void 0,void 0,(function(){var e,t;return Li(this,(function(n){switch(n.label){case 0:e=this._config.identityPoolId,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._storageSync];case 2:return n.sent(),[2,this._storage.getItem(this._getCognitoIdentityIdStorageKey(e))];case 3:return t=n.sent(),Bi.debug("Failed to get the cached guest identityId",t),[3,4];case 4:return[2]}}))}))},e.prototype._setGuestIdentityId=function(e){return Fi(this,void 0,void 0,(function(){var t,n;return Li(this,(function(r){switch(r.label){case 0:t=this._config.identityPoolId,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._storageSync];case 2:return r.sent(),this._storage.setItem(this._getCognitoIdentityIdStorageKey(t),e),[3,4];case 3:return n=r.sent(),Bi.debug("Failed to cache guest identityId",n),[3,4];case 4:return[2]}}))}))},e.prototype._removeGuestIdentityId=function(){return Fi(this,void 0,void 0,(function(){var e;return Li(this,(function(t){return e=this._config.identityPoolId,Bi.debug("removing "+this._getCognitoIdentityIdStorageKey(e)+" from storage"),this._storage.removeItem(this._getCognitoIdentityIdStorageKey(e)),[2]}))}))},e.prototype.shear=function(e){return{accessKeyId:e.accessKeyId,sessionToken:e.sessionToken,secretAccessKey:e.secretAccessKey,identityId:e.identityId,authenticated:e.authenticated}},e}())(null);c.a.register(qi)},function(e,t,n){var r;e.exports=(r=n(13),function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,s=t.algo,a=[],u=[];!function(){function t(t){for(var n=e.sqrt(t),r=2;r<=n;r++)if(!(t%r))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var r=2,i=0;i<64;)t(r)&&(i<8&&(a[i]=n(e.pow(r,.5))),u[i]=n(e.pow(r,1/3)),i++),r++}();var c=[],l=s.SHA256=o.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],l=n[5],f=n[6],d=n[7],h=0;h<64;h++){if(h<16)c[h]=0|e[t+h];else{var p=c[h-15],v=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,y=c[h-2],g=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;c[h]=v+c[h-7]+g+c[h-16]}var m=r&i^r&o^i&o,b=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),w=d+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&f)+u[h]+c[h];d=f,f=l,l=a,a=s+w|0,s=o,o=i,i=r,r=w+(b+m)|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+s|0,n[4]=n[4]+a|0,n[5]=n[5]+l|0,n[6]=n[6]+f|0,n[7]=n[7]+d|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),r.SHA256)},function(e,t,n){"use strict";n.d(t,"a",(function(){return z}));var r=n(5),i=n(22),o=n(34),s=n(39),a=n(59),u=n(70),c=n(30),l=n(15);var f,d=n(17),h=n(9),p=n(8),v=function(e){var t=window.open(e,"_self");return t?Promise.resolve(t):Promise.reject()},y=n(78),g=n.n(y),m=n(79),b=n.n(m),w=function(){return(w=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},S=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},_=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},E=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},A="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",O=function(e,t,n){o.a.dispatch("auth",{event:e,data:t,message:n},"Auth",A)},I=new i.a("OAuth"),T=function(){function e(e){var t=e.config,n=e.cognitoClientId,r=e.scopes,i=void 0===r?[]:r;if(this._urlOpener=t.urlOpener||v,this._config=t,this._cognitoClientId=n,!this.isValidScopes(i))throw Error("scopes must be a String Array");this._scopes=i}return e.prototype.isValidScopes=function(e){return Array.isArray(e)&&e.every((function(e){return"string"==typeof e}))},e.prototype.oauthSignIn=function(e,t,n,i,o,s){void 0===e&&(e="code"),void 0===o&&(o=r.b.Cognito);var a=this._generateState(32),u=s?a+"-"+s.split("").map((function(e){return e.charCodeAt(0).toString(16).padStart(2,"0")})).join(""):a;!function(e){window.sessionStorage.setItem("oauth_state",e)}(u);var c,l=this._generateRandom(128);c=l,window.sessionStorage.setItem("ouath_pkce_key",c);var f=this._generateChallenge(l),d=this._scopes.join(" "),h="https://"+t+"/oauth2/authorize?"+Object.entries(w(w({redirect_uri:n,response_type:e,client_id:i,identity_provider:o,scope:d,state:u},"code"===e?{code_challenge:f}:{}),"code"===e?{code_challenge_method:"S256"}:{})).map((function(e){var t=E(e,2),n=t[0],r=t[1];return encodeURIComponent(n)+"="+encodeURIComponent(r)})).join("&");I.debug("Redirecting to "+h),this._urlOpener(h,n)},e.prototype._handleCodeFlow=function(e){return S(this,void 0,void 0,(function(){var t,n,i,o,s,a,u,c,l,f,d,h,v,y;return _(this,(function(g){switch(g.label){case 0:return t=(Object(p.parse)(e).query||"").split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n,r=E(t,2),i=r[0],o=r[1];return w(w({},e),((n={})[i]=o,n))}),{code:void 0}).code,n=Object(p.parse)(e).pathname||"/",i=Object(p.parse)(this._config.redirectSignIn).pathname||"/",t&&n===i?(o="https://"+this._config.domain+"/oauth2/token",O("codeFlow",{},"Retrieving tokens from "+o),s=Object(r.d)(this._config)?this._cognitoClientId:this._config.clientID,a=Object(r.d)(this._config)?this._config.redirectSignIn:this._config.redirectUri,m=window.sessionStorage.getItem("ouath_pkce_key"),window.sessionStorage.removeItem("ouath_pkce_key"),c=w({grant_type:"authorization_code",code:t,client_id:s,redirect_uri:a},(u=m)?{code_verifier:u}:{}),I.debug("Calling token endpoint: "+o+" with",c),l=Object.entries(c).map((function(e){var t=E(e,2),n=t[0],r=t[1];return encodeURIComponent(n)+"="+encodeURIComponent(r)})).join("&"),[4,fetch(o,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:l})]):[2];case 1:return[4,g.sent().json()];case 2:if(f=g.sent(),d=f.access_token,h=f.refresh_token,v=f.id_token,y=f.error)throw new Error(y);return[2,{accessToken:d,refreshToken:h,idToken:v}]}var m}))}))},e.prototype._handleImplicitFlow=function(e){return S(this,void 0,void 0,(function(){var t,n,r;return _(this,(function(i){return t=(Object(p.parse)(e).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n,r=E(t,2),i=r[0],o=r[1];return w(w({},e),((n={})[i]=o,n))}),{id_token:void 0,access_token:void 0}),n=t.id_token,r=t.access_token,O("implicitFlow",{},"Got tokens from "+e),I.debug("Retrieving implicit tokens from "+e+" with"),[2,{accessToken:r,idToken:n,refreshToken:null}]}))}))},e.prototype.handleAuthResponse=function(e){return S(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return _(this,(function(u){switch(u.label){case 0:if(u.trys.push([0,5,,6]),t=e?w(w({},(Object(p.parse)(e).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n=E(t,2),r=n[0],i=n[1];return e[r]=i,e}),{})),(Object(p.parse)(e).query||"").split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n=E(t,2),r=n[0],i=n[1];return e[r]=i,e}),{})):{},n=t.error,r=t.error_description,n)throw new Error(r);return i=this._validateState(t),I.debug("Starting "+this._config.responseType+" flow with "+e),"code"!==this._config.responseType?[3,2]:(o=[{}],[4,this._handleCodeFlow(e)]);case 1:return[2,w.apply(void 0,[w.apply(void 0,o.concat([u.sent()])),{state:i}])];case 2:return s=[{}],[4,this._handleImplicitFlow(e)];case 3:return[2,w.apply(void 0,[w.apply(void 0,s.concat([u.sent()])),{state:i}])];case 4:return[3,6];case 5:throw a=u.sent(),I.error("Error handling auth response.",a),a;case 6:return[2]}}))}))},e.prototype._validateState=function(e){if(e){var t,n=(t=window.sessionStorage.getItem("oauth_state"),window.sessionStorage.removeItem("oauth_state"),t),r=e.state;if(n&&n!==r)throw new Error("Invalid state in OAuth flow");return r}},e.prototype.signOut=function(){return S(this,void 0,void 0,(function(){var e,t,n;return _(this,(function(i){return e="https://"+this._config.domain+"/logout?",t=Object(r.d)(this._config)?this._cognitoClientId:this._config.oauth.clientID,n=Object(r.d)(this._config)?this._config.redirectSignOut:this._config.returnTo,e+=Object.entries({client_id:t,logout_uri:encodeURIComponent(n)}).map((function(e){var t=E(e,2);return t[0]+"="+t[1]})).join("&"),O("oAuthSignOut",{oAuth:"signOut"},"Signing out from "+e),I.debug("Signing out from "+e),[2,this._urlOpener(e,n)]}))}))},e.prototype._generateState=function(e){for(var t="",n=e,r="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";n>0;--n)t+=r[Math.round(Math.random()*(r.length-1))];return t},e.prototype._generateChallenge=function(e){return this._base64URL(g()(e))},e.prototype._base64URL=function(e){return e.toString(b.a).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},e.prototype._generateRandom=function(e){var t=new Uint8Array(e);if("undefined"!=typeof window&&window.crypto)window.crypto.getRandomValues(t);else for(var n=0;n<e;n+=1)t[n]=Math.random()*"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~".length|0;return this._bufferToString(t)},e.prototype._bufferToString=function(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=[],r=0;r<e.byteLength;r+=1){var i=e[r]%t.length;n.push(t[i])}return n.join("")},e}(),C=n(11),x=(f=function(e,t){return(f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}f(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),P=new i.a("AuthError"),k=function(e){function t(n){var r=this,i=M[n],o=i.message,s=i.log;return(r=e.call(this,o)||this).constructor=t,Object.setPrototypeOf(r,t.prototype),r.name="AuthError",r.log=s||o,P.error(r.log),r}return x(t,e),t}(Error),N=function(e){function t(n){var r=e.call(this,n)||this;return r.constructor=t,Object.setPrototypeOf(r,t.prototype),r.name="NoUserPoolError",r}return x(t,e),t}(k),M={noConfig:{message:C.a.DEFAULT_MSG,log:"\n Error: Amplify has not been configured correctly.\n This error is typically caused by one of the following scenarios:\n\n 1. Make sure you're passing the awsconfig object to Amplify.configure() in your app's entry point\n See https://aws-amplify.github.io/docs/js/authentication#configure-your-app for more information\n \n 2. There might be multiple conflicting versions of amplify packages in your node_modules.\n\t\t\t\tRefer to our docs site for help upgrading Amplify packages (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js)\n "},missingAuthConfig:{message:C.a.DEFAULT_MSG,log:"\n Error: Amplify has not been configured correctly. \n The configuration object is missing required auth properties.\n This error is typically caused by one of the following scenarios:\n\n 1. Did you run `amplify push` after adding auth via `amplify add auth`?\n See https://aws-amplify.github.io/docs/js/authentication#amplify-project-setup for more information\n\n 2. This could also be caused by multiple conflicting versions of amplify packages, see (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js) for help upgrading Amplify packages.\n "},emptyUsername:{message:C.a.EMPTY_USERNAME},invalidUsername:{message:C.a.INVALID_USERNAME},emptyPassword:{message:C.a.EMPTY_PASSWORD},emptyCode:{message:C.a.EMPTY_CODE},signUpError:{message:C.a.SIGN_UP_ERROR,log:"The first parameter should either be non-null string or object"},noMFA:{message:C.a.NO_MFA},invalidMFA:{message:C.a.INVALID_MFA},emptyChallengeResponse:{message:C.a.EMPTY_CHALLENGE},noUserSession:{message:C.a.NO_USER_SESSION},deviceConfig:{message:C.a.DEVICE_CONFIG},networkError:{message:C.a.NETWORK_ERROR},default:{message:C.a.DEFAULT_MSG}};function j(e){return(j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var R=function(){return(R=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},D=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},U=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},F=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},L=new i.a("AuthClass"),B="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",q=function(e,t,n){o.a.dispatch("auth",{event:e,data:t,message:n},"Auth",B)},z=new(function(){function e(e){var t=this;this.userPool=null,this.user=null,this.oAuthFlowInProgress=!1,this.Credentials=s.a,this.wrapRefreshSessionCallback=function(e){return function(t,n){return n?q("tokenRefresh",void 0,"New token retrieved"):q("tokenRefresh_failure",t,"Failed to retrieve new token"),e(t,n)}},this.configure(e),this.currentCredentials=this.currentCredentials.bind(this),this.currentUserCredentials=this.currentUserCredentials.bind(this),o.a.listen("auth",(function(e){switch(e.payload.event){case"signIn":t._storage.setItem("amplify-signin-with-hostedUI","false");break;case"signOut":t._storage.removeItem("amplify-signin-with-hostedUI");break;case"cognitoHostedUI":t._storage.setItem("amplify-signin-with-hostedUI","true")}}))}return e.prototype.getModuleName=function(){return"Auth"},e.prototype.configure=function(e){var t=this;if(!e)return this._config||{};L.debug("configure Auth");var n=Object.assign({},this._config,a.a.parseMobilehubConfig(e).Auth,e);this._config=n;var i=this._config,o=i.userPoolId,s=i.userPoolWebClientId,f=i.cookieStorage,d=i.oauth,p=i.region,v=i.identityPoolId,y=i.mandatorySignIn,g=i.refreshHandlers,m=i.identityPoolRegion,b=i.clientMetadata,w=i.endpoint;if(this._config.storage){if(!this._isValidAuthStorage(this._config.storage))throw L.error("The storage in the Auth config is not valid!"),new Error("Empty storage object");this._storage=this._config.storage}else this._storage=f?new h.i(f):e.ssr?new u.a:(new c.a).getStorage();if(this._storageSync=Promise.resolve(),"function"==typeof this._storage.sync&&(this._storageSync=this._storage.sync()),o){var S={UserPoolId:o,ClientId:s,endpoint:w};S.Storage=this._storage,this.userPool=new h.g(S,this.wrapRefreshSessionCallback)}this.Credentials.configure({mandatorySignIn:y,region:m||p,userPoolId:o,identityPoolId:v,refreshHandlers:g,storage:this._storage});var _=d?Object(r.d)(this._config.oauth)?d:d.awsCognito:void 0;if(_){var E=Object.assign({cognitoClientId:s,UserPoolId:o,domain:_.domain,scopes:_.scope,redirectSignIn:_.redirectSignIn,redirectSignOut:_.redirectSignOut,responseType:_.responseType,Storage:this._storage,urlOpener:_.urlOpener,clientMetadata:b},_.options);this._oAuthHandler=new T({scopes:E.scopes,config:E,cognitoClientId:E.cognitoClientId});var A={};!function(e){if(l.a.browserOrNode().isBrowser&&window.location)e({url:window.location.href});else if(!l.a.browserOrNode().isNode)throw new Error("Not supported")}((function(e){var n=e.url;A[n]||(A[n]=!0,t._handleAuthResponse(n))}))}return q("configured",null,"The Auth category has been configured successfully"),this._config},e.prototype.signUp=function(e){for(var t=this,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];if(!this.userPool)return this.rejectNoUserPool();var o,s=null,a=null,u=[],c=null;if(e&&"string"==typeof e){s=e,a=n?n[0]:null;var l=n?n[1]:null,f=n?n[2]:null;l&&u.push(new h.f({Name:"email",Value:l})),f&&u.push(new h.f({Name:"phone_number",Value:f}))}else{if(!e||"object"!==j(e))return this.rejectAuthError(r.a.SignUpError);s=e.username,a=e.password,e&&e.clientMetadata?o=e.clientMetadata:this._config.clientMetadata&&(o=this._config.clientMetadata);var d=e.attributes;d&&Object.keys(d).map((function(e){u.push(new h.f({Name:e,Value:d[e]}))}));var p=e.validationData;p&&(c=[],Object.keys(p).map((function(e){c.push(new h.f({Name:e,Value:p[e]}))})))}return s?a?(L.debug("signUp attrs:",u),L.debug("signUp validation data:",c),new Promise((function(e,n){t.userPool.signUp(s,a,u,c,(function(t,r){t?(q("signUp_failure",t,s+" failed to signup"),n(t)):(q("signUp",r,s+" has signed up successfully"),e(r))}),o)}))):this.rejectAuthError(r.a.EmptyPassword):this.rejectAuthError(r.a.EmptyUsername)},e.prototype.confirmSignUp=function(e,t,n){if(!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(r.a.EmptyUsername);if(!t)return this.rejectAuthError(r.a.EmptyCode);var i,o=this.createCognitoUser(e),s=!n||"boolean"!=typeof n.forceAliasCreation||n.forceAliasCreation;return n&&n.clientMetadata?i=n.clientMetadata:this._config.clientMetadata&&(i=this._config.clientMetadata),new Promise((function(e,n){o.confirmRegistration(t,s,(function(t,r){t?n(t):e(r)}),i)}))},e.prototype.resendSignUp=function(e,t){if(void 0===t&&(t=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(r.a.EmptyUsername);var n=this.createCognitoUser(e);return new Promise((function(e,r){n.resendConfirmationCode((function(t,n){t?r(t):e(n)}),t)}))},e.prototype.signIn=function(e,t,n){if(void 0===n&&(n=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();var i=null,o=null,s={};if("string"==typeof e)i=e,o=t;else{if(!Object(r.g)(e))return this.rejectAuthError(r.a.InvalidUsername);void 0!==t&&L.warn("The password should be defined under the first parameter object!"),i=e.username,o=e.password,s=e.validationData}if(!i)return this.rejectAuthError(r.a.EmptyUsername);var a=new h.a({Username:i,Password:o,ValidationData:s,ClientMetadata:n});return o?this.signInWithPassword(a):this.signInWithoutPassword(a)},e.prototype.authCallbacks=function(e,t,n){var r=this,i=this;return{onSuccess:function(o){return D(r,void 0,void 0,(function(){var r,s,a,u;return U(this,(function(c){switch(c.label){case 0:L.debug(o),delete e.challengeName,delete e.challengeParam,c.label=1;case 1:return c.trys.push([1,4,5,9]),[4,this.Credentials.clear()];case 2:return c.sent(),[4,this.Credentials.set(o,"session")];case 3:return r=c.sent(),L.debug("succeed to get cognito credentials",r),[3,9];case 4:return s=c.sent(),L.debug("cannot get cognito credentials",s),[3,9];case 5:return c.trys.push([5,7,,8]),[4,this.currentUserPoolUser()];case 6:return a=c.sent(),i.user=a,q("signIn",a,"A user "+e.getUsername()+" has been signed in"),t(a),[3,8];case 7:return u=c.sent(),L.error("Failed to get the signed in user",u),n(u),[3,8];case 8:return[7];case 9:return[2]}}))}))},onFailure:function(t){L.debug("signIn failure",t),q("signIn_failure",t,e.getUsername()+" failed to signin"),n(t)},customChallenge:function(n){L.debug("signIn custom challenge answer required"),e.challengeName="CUSTOM_CHALLENGE",e.challengeParam=n,t(e)},mfaRequired:function(n,r){L.debug("signIn MFA required"),e.challengeName=n,e.challengeParam=r,t(e)},mfaSetup:function(n,r){L.debug("signIn mfa setup",n),e.challengeName=n,e.challengeParam=r,t(e)},newPasswordRequired:function(n,r){L.debug("signIn new password"),e.challengeName="NEW_PASSWORD_REQUIRED",e.challengeParam={userAttributes:n,requiredAttributes:r},t(e)},totpRequired:function(n,r){L.debug("signIn totpRequired"),e.challengeName=n,e.challengeParam=r,t(e)},selectMFAType:function(n,r){L.debug("signIn selectMFAType",n),e.challengeName=n,e.challengeParam=r,t(e)}}},e.prototype.signInWithPassword=function(e){var t=this;if(this.pendingSignIn)throw new Error("Pending sign-in attempt already in progress");var n=this.createCognitoUser(e.getUsername());return this.pendingSignIn=new Promise((function(r,i){n.authenticateUser(e,t.authCallbacks(n,(function(e){t.pendingSignIn=null,r(e)}),(function(e){t.pendingSignIn=null,i(e)})))})),this.pendingSignIn},e.prototype.signInWithoutPassword=function(e){var t=this,n=this.createCognitoUser(e.getUsername());return n.setAuthenticationFlowType("CUSTOM_AUTH"),new Promise((function(r,i){n.initiateAuth(e,t.authCallbacks(n,r,i))}))},e.prototype.getMFAOptions=function(e){return new Promise((function(t,n){e.getMFAOptions((function(e,r){if(e)return L.debug("get MFA Options failed",e),void n(e);L.debug("get MFA options success",r),t(r)}))}))},e.prototype.getPreferredMFA=function(e,t){var n=this,r=this;return new Promise((function(i,o){var s=n._config.clientMetadata,a=!!t&&t.bypassCache;e.getUserData((function(t,s){return D(n,void 0,void 0,(function(){var n,a;return U(this,(function(u){switch(u.label){case 0:if(!t)return[3,5];if(L.debug("getting preferred mfa failed",t),!this.isSessionInvalid(t))return[3,4];u.label=1;case 1:return u.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return u.sent(),[3,4];case 3:return n=u.sent(),o(new Error("Session is invalid due to: "+t.message+" and failed to clean up invalid session: "+n.message)),[2];case 4:return o(t),[2];case 5:return(a=r._getMfaTypeFromUserData(s))?(i(a),[2]):(o("invalid MFA Type"),[2])}}))}))}),{bypassCache:a,clientMetadata:s})}))},e.prototype._getMfaTypeFromUserData=function(e){var t=null,n=e.PreferredMfaSetting;if(n)t=n;else{var r=e.UserMFASettingList;if(r)0===r.length?t="NOMFA":L.debug("invalid case for getPreferredMFA",e);else t=e.MFAOptions?"SMS_MFA":"NOMFA"}return t},e.prototype._getUserData=function(e,t){var n=this;return new Promise((function(r,i){e.getUserData((function(t,o){return D(n,void 0,void 0,(function(){var n;return U(this,(function(s){switch(s.label){case 0:if(!t)return[3,5];if(L.debug("getting user data failed",t),!this.isSessionInvalid(t))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return s.sent(),[3,4];case 3:return n=s.sent(),i(new Error("Session is invalid due to: "+t.message+" and failed to clean up invalid session: "+n.message)),[2];case 4:return i(t),[2];case 5:r(o),s.label=6;case 6:return[2]}}))}))}),t)}))},e.prototype.setPreferredMFA=function(e,t){return D(this,void 0,void 0,(function(){var n,i,o,s,a,u,c=this;return U(this,(function(l){switch(l.label){case 0:return n=this._config.clientMetadata,[4,this._getUserData(e,{bypassCache:!0,clientMetadata:n})];case 1:switch(i=l.sent(),o=null,s=null,t){case"TOTP":case"SOFTWARE_TOKEN_MFA":return[3,2];case"SMS":case"SMS_MFA":return[3,3];case"NOMFA":return[3,4]}return[3,6];case 2:return s={PreferredMfa:!0,Enabled:!0},[3,7];case 3:return o={PreferredMfa:!0,Enabled:!0},[3,7];case 4:return a=i.UserMFASettingList,[4,this._getMfaTypeFromUserData(i)];case 5:if("NOMFA"===(u=l.sent()))return[2,Promise.resolve("No change for mfa type")];if("SMS_MFA"===u)o={PreferredMfa:!1,Enabled:!1};else{if("SOFTWARE_TOKEN_MFA"!==u)return[2,this.rejectAuthError(r.a.InvalidMFA)];s={PreferredMfa:!1,Enabled:!1}}return a&&0!==a.length&&a.forEach((function(e){"SMS_MFA"===e?o={PreferredMfa:!1,Enabled:!1}:"SOFTWARE_TOKEN_MFA"===e&&(s={PreferredMfa:!1,Enabled:!1})})),[3,7];case 6:return L.debug("no validmfa method provided"),[2,this.rejectAuthError(r.a.NoMFA)];case 7:return this,[2,new Promise((function(t,r){e.setUserMfaPreference(o,s,(function(i,o){if(i)return L.debug("Set user mfa preference error",i),r(i);L.debug("Set user mfa success",o),L.debug("Caching the latest user data into local"),e.getUserData((function(n,i){return D(c,void 0,void 0,(function(){var i;return U(this,(function(s){switch(s.label){case 0:if(!n)return[3,5];if(L.debug("getting user data failed",n),!this.isSessionInvalid(n))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return s.sent(),[3,4];case 3:return i=s.sent(),r(new Error("Session is invalid due to: "+n.message+" and failed to clean up invalid session: "+i.message)),[2];case 4:return[2,r(n)];case 5:return[2,t(o)]}}))}))}),{bypassCache:!0,clientMetadata:n})}))}))]}}))}))},e.prototype.disableSMS=function(e){return new Promise((function(t,n){e.disableMFA((function(e,r){if(e)return L.debug("disable mfa failed",e),void n(e);L.debug("disable mfa succeed",r),t(r)}))}))},e.prototype.enableSMS=function(e){return new Promise((function(t,n){e.enableMFA((function(e,r){if(e)return L.debug("enable mfa failed",e),void n(e);L.debug("enable mfa succeed",r),t(r)}))}))},e.prototype.setupTOTP=function(e){return new Promise((function(t,n){e.associateSoftwareToken({onFailure:function(e){L.debug("associateSoftwareToken failed",e),n(e)},associateSecretCode:function(e){L.debug("associateSoftwareToken sucess",e),t(e)}})}))},e.prototype.verifyTotpToken=function(e,t){return L.debug("verification totp token",e,t),new Promise((function(n,r){e.verifySoftwareToken(t,"My TOTP device",{onFailure:function(e){L.debug("verifyTotpToken failed",e),r(e)},onSuccess:function(t){q("signIn",e,"A user "+e.getUsername()+" has been signed in"),L.debug("verifyTotpToken success",t),n(t)}})}))},e.prototype.confirmSignIn=function(e,t,n,i){var o=this;if(void 0===i&&(i=this._config.clientMetadata),!t)return this.rejectAuthError(r.a.EmptyCode);var s=this;return new Promise((function(r,a){e.sendMFACode(t,{onSuccess:function(t){return D(o,void 0,void 0,(function(){var n,i;return U(this,(function(o){switch(o.label){case 0:L.debug(t),o.label=1;case 1:return o.trys.push([1,4,5,6]),[4,this.Credentials.clear()];case 2:return o.sent(),[4,this.Credentials.set(t,"session")];case 3:return n=o.sent(),L.debug("succeed to get cognito credentials",n),[3,6];case 4:return i=o.sent(),L.debug("cannot get cognito credentials",i),[3,6];case 5:return s.user=e,q("signIn",e,"A user "+e.getUsername()+" has been signed in"),r(e),[7];case 6:return[2]}}))}))},onFailure:function(e){L.debug("confirm signIn failure",e),a(e)}},n,i)}))},e.prototype.completeNewPassword=function(e,t,n,i){var o=this;if(void 0===n&&(n={}),void 0===i&&(i=this._config.clientMetadata),!t)return this.rejectAuthError(r.a.EmptyPassword);var s=this;return new Promise((function(r,a){e.completeNewPasswordChallenge(t,n,{onSuccess:function(t){return D(o,void 0,void 0,(function(){var n,i;return U(this,(function(o){switch(o.label){case 0:L.debug(t),o.label=1;case 1:return o.trys.push([1,4,5,6]),[4,this.Credentials.clear()];case 2:return o.sent(),[4,this.Credentials.set(t,"session")];case 3:return n=o.sent(),L.debug("succeed to get cognito credentials",n),[3,6];case 4:return i=o.sent(),L.debug("cannot get cognito credentials",i),[3,6];case 5:return s.user=e,q("signIn",e,"A user "+e.getUsername()+" has been signed in"),r(e),[7];case 6:return[2]}}))}))},onFailure:function(e){L.debug("completeNewPassword failure",e),q("completeNewPassword_failure",e,o.user+" failed to complete the new password flow"),a(e)},mfaRequired:function(t,n){L.debug("signIn MFA required"),e.challengeName=t,e.challengeParam=n,r(e)},mfaSetup:function(t,n){L.debug("signIn mfa setup",t),e.challengeName=t,e.challengeParam=n,r(e)},totpRequired:function(t,n){L.debug("signIn mfa setup",t),e.challengeName=t,e.challengeParam=n,r(e)}},i)}))},e.prototype.sendCustomChallengeAnswer=function(e,t,n){var i=this;if(void 0===n&&(n=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!t)return this.rejectAuthError(r.a.EmptyChallengeResponse);return new Promise((function(r,o){e.sendCustomChallengeAnswer(t,i.authCallbacks(e,r,o),n)}))},e.prototype.deleteUserAttributes=function(e,t){var n=this;return new Promise((function(r,i){n.userSession(e).then((function(n){e.deleteAttributes(t,(function(e,t){return e?i(e):r(t)}))}))}))},e.prototype.deleteUser=function(){return D(this,void 0,void 0,(function(){var e,t,n=this;return U(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this._storageSync];case 1:return r.sent(),[3,3];case 2:throw e=r.sent(),L.debug("Failed to sync cache info into memory",e),new Error(e);case 3:return t=this._oAuthHandler&&"true"===this._storage.getItem("amplify-signin-with-hostedUI"),[2,new Promise((function(e,r){return D(n,void 0,void 0,(function(){var n,i=this;return U(this,(function(o){if(this.userPool){if(!(n=this.userPool.getCurrentUser()))return L.debug("Failed to get user from user pool"),[2,r(new Error("No current user."))];n.getSession((function(o,s){return D(i,void 0,void 0,(function(){var i,s=this;return U(this,(function(a){switch(a.label){case 0:if(!o)return[3,5];if(L.debug("Failed to get the user session",o),!this.isSessionInvalid(o))return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(n)];case 2:return a.sent(),[3,4];case 3:return i=a.sent(),r(new Error("Session is invalid due to: "+o.message+" and failed to clean up invalid session: "+i.message)),[2];case 4:return[2,r(o)];case 5:n.deleteUser((function(i,o){if(i)r(i);else{q("userDeleted",o,"The authenticated user has been deleted."),n.signOut(),s.user=null;try{s.cleanCachedItems()}catch(e){L.debug("failed to clear cached items")}t?s.oAuthSignOutRedirect(e,r):(q("signOut",s.user,"A user has been signed out"),e(o))}})),a.label=6;case 6:return[2]}}))}))}))}else L.debug("no Congito User pool"),r(new Error("Cognito User pool does not exist"));return[2]}))}))}))]}}))}))},e.prototype.updateUserAttributes=function(e,t,n){void 0===n&&(n=this._config.clientMetadata);var r=[],i=this;return new Promise((function(o,s){i.userSession(e).then((function(i){for(var a in t)if("sub"!==a&&a.indexOf("_verified")<0){var u={Name:a,Value:t[a]};r.push(u)}e.updateAttributes(r,(function(e,t){return e?s(e):o(t)}),n)}))}))},e.prototype.userAttributes=function(e){var t=this;return new Promise((function(n,r){t.userSession(e).then((function(t){e.getUserAttributes((function(e,t){e?r(e):n(t)}))}))}))},e.prototype.verifiedContact=function(e){var t=this;return this.userAttributes(e).then((function(e){var n=t.attributesToObject(e),r={},i={};return n.email&&(n.email_verified?i.email=n.email:r.email=n.email),n.phone_number&&(n.phone_number_verified?i.phone_number=n.phone_number:r.phone_number=n.phone_number),{verified:i,unverified:r}}))},e.prototype.isErrorWithMessage=function(e){return"object"===j(e)&&Object.prototype.hasOwnProperty.call(e,"message")},e.prototype.isTokenRevokedError=function(e){return this.isErrorWithMessage(e)&&"Access Token has been revoked"===e.message},e.prototype.isRefreshTokenRevokedError=function(e){return this.isErrorWithMessage(e)&&"Refresh Token has been revoked"===e.message},e.prototype.isUserDisabledError=function(e){return this.isErrorWithMessage(e)&&"User is disabled."===e.message},e.prototype.isUserDoesNotExistError=function(e){return this.isErrorWithMessage(e)&&"User does not exist."===e.message},e.prototype.isRefreshTokenExpiredError=function(e){return this.isErrorWithMessage(e)&&"Refresh Token has expired"===e.message},e.prototype.isSignedInHostedUI=function(){return this._oAuthHandler&&"true"===this._storage.getItem("amplify-signin-with-hostedUI")},e.prototype.isSessionInvalid=function(e){return this.isUserDisabledError(e)||this.isUserDoesNotExistError(e)||this.isTokenRevokedError(e)||this.isRefreshTokenRevokedError(e)||this.isRefreshTokenExpiredError(e)},e.prototype.cleanUpInvalidSession=function(e){return D(this,void 0,void 0,(function(){var t=this;return U(this,(function(n){switch(n.label){case 0:e.signOut(),this.user=null,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.cleanCachedItems()];case 2:return n.sent(),[3,4];case 3:return n.sent(),L.debug("failed to clear cached items"),[3,4];case 4:return this.isSignedInHostedUI()?[2,new Promise((function(e,n){t.oAuthSignOutRedirect(e,n)}))]:(q("signOut",this.user,"A user has been signed out"),[2])}}))}))},e.prototype.currentUserPoolUser=function(e){var t=this;return this.userPool?new Promise((function(n,r){t._storageSync.then((function(){return D(t,void 0,void 0,(function(){var t,i,s=this;return U(this,(function(a){switch(a.label){case 0:return this.isOAuthInProgress()?(L.debug("OAuth signIn in progress, waiting for resolution..."),[4,new Promise((function(e){var t=setTimeout((function(){L.debug("OAuth signIn in progress timeout"),o.a.remove("auth",n),e()}),1e4);function n(r){var i=r.payload.event;"cognitoHostedUI"!==i&&"cognitoHostedUI_failure"!==i||(L.debug("OAuth signIn resolved: "+i),clearTimeout(t),o.a.remove("auth",n),e())}o.a.listen("auth",n)}))]):[3,2];case 1:a.sent(),a.label=2;case 2:return(t=this.userPool.getCurrentUser())?(i=this._config.clientMetadata,t.getSession((function(i,o){return D(s,void 0,void 0,(function(){var s,a,u,c,l=this;return U(this,(function(f){switch(f.label){case 0:if(!i)return[3,5];if(L.debug("Failed to get the user session",i),!this.isSessionInvalid(i))return[3,4];f.label=1;case 1:return f.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(t)];case 2:return f.sent(),[3,4];case 3:return s=f.sent(),r(new Error("Session is invalid due to: "+i.message+" and failed to clean up invalid session: "+s.message)),[2];case 4:return r(i),[2];case 5:return(a=!!e&&e.bypassCache)?[4,this.Credentials.clear()]:[3,7];case 6:f.sent(),f.label=7;case 7:return u=this._config.clientMetadata,c=o.getAccessToken().decodePayload().scope,(void 0===c?"":c).split(" ").includes("aws.cognito.signin.user.admin")?(t.getUserData((function(e,i){return D(l,void 0,void 0,(function(){var o,s,a,u,c,l,f;return U(this,(function(d){switch(d.label){case 0:if(!e)return[3,7];if(L.debug("getting user data failed",e),!this.isSessionInvalid(e))return[3,5];d.label=1;case 1:return d.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(t)];case 2:return d.sent(),[3,4];case 3:return o=d.sent(),r(new Error("Session is invalid due to: "+e.message+" and failed to clean up invalid session: "+o.message)),[2];case 4:return r(e),[3,6];case 5:n(t),d.label=6;case 6:return[2];case 7:for(s=i.PreferredMfaSetting||"NOMFA",a=[],u=0;u<i.UserAttributes.length;u++)c={Name:i.UserAttributes[u].Name,Value:i.UserAttributes[u].Value},l=new h.f(c),a.push(l);return f=this.attributesToObject(a),Object.assign(t,{attributes:f,preferredMFA:s}),[2,n(t)]}}))}))}),{bypassCache:a,clientMetadata:u}),[2]):(L.debug("Unable to get the user data because the aws.cognito.signin.user.admin is not in the scopes of the access token"),[2,n(t)])}}))}))}),{clientMetadata:i}),[2]):(L.debug("Failed to get user from user pool"),r("No current user"),[2])}}))}))})).catch((function(e){return L.debug("Failed to sync cache info into memory",e),r(e)}))})):this.rejectNoUserPool()},e.prototype.isOAuthInProgress=function(){return this.oAuthFlowInProgress},e.prototype.currentAuthenticatedUser=function(e){return D(this,void 0,void 0,(function(){var t,n,r,i,o;return U(this,(function(s){switch(s.label){case 0:L.debug("getting current authenticated user"),t=null,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._storageSync];case 2:return s.sent(),[3,4];case 3:throw n=s.sent(),L.debug("Failed to sync cache info into memory",n),n;case 4:try{(r=JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")))&&(t=R(R({},r.user),{token:r.token}))}catch(e){L.debug("cannot load federated user from auth storage")}return t?(this.user=t,L.debug("get current authenticated federated user",this.user),[2,this.user]):[3,5];case 5:L.debug("get current authenticated userpool user"),i=null,s.label=6;case 6:return s.trys.push([6,8,,9]),[4,this.currentUserPoolUser(e)];case 7:return i=s.sent(),[3,9];case 8:return"No userPool"===(o=s.sent())&&L.error("Cannot get the current user because the user pool is missing. Please make sure the Auth module is configured with a valid Cognito User Pool ID"),L.debug("The user is not authenticated by the error",o),[2,Promise.reject("The user is not authenticated")];case 9:return this.user=i,[2,this.user]}}))}))},e.prototype.currentSession=function(){var e=this;return L.debug("Getting current session"),this.userPool?new Promise((function(t,n){e.currentUserPoolUser().then((function(r){e.userSession(r).then((function(e){t(e)})).catch((function(e){L.debug("Failed to get the current session",e),n(e)}))})).catch((function(e){L.debug("Failed to get the current user",e),n(e)}))})):this.rejectNoUserPool()},e.prototype.userSession=function(e){var t=this;if(!e)return L.debug("the user is null"),this.rejectAuthError(r.a.NoUserSession);var n=this._config.clientMetadata;return new Promise((function(r,i){L.debug("Getting the session from this user:",e),e.getSession((function(n,o){return D(t,void 0,void 0,(function(){var t;return U(this,(function(s){switch(s.label){case 0:if(!n)return[3,5];if(L.debug("Failed to get the session from user",e),!this.isSessionInvalid(n))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return s.sent(),[3,4];case 3:return t=s.sent(),i(new Error("Session is invalid due to: "+n.message+" and failed to clean up invalid session: "+t.message)),[2];case 4:return i(n),[2];case 5:return L.debug("Succeed to get the user session",o),r(o),[2]}}))}))}),{clientMetadata:n})}))},e.prototype.currentUserCredentials=function(){return D(this,void 0,void 0,(function(){var e,t,n=this;return U(this,(function(r){switch(r.label){case 0:L.debug("Getting current user credentials"),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._storageSync];case 2:return r.sent(),[3,4];case 3:throw e=r.sent(),L.debug("Failed to sync cache info into memory",e),e;case 4:t=null;try{t=JSON.parse(this._storage.getItem("aws-amplify-federatedInfo"))}catch(e){L.debug("failed to get or parse item aws-amplify-federatedInfo",e)}return t?[2,this.Credentials.refreshFederatedToken(t)]:[2,this.currentSession().then((function(e){return L.debug("getting session success",e),n.Credentials.set(e,"session")})).catch((function(){return L.debug("getting guest credentials"),n.Credentials.set(null,"guest")}))]}}))}))},e.prototype.currentCredentials=function(){return L.debug("getting current credentials"),this.Credentials.get()},e.prototype.verifyUserAttribute=function(e,t,n){return void 0===n&&(n=this._config.clientMetadata),new Promise((function(r,i){e.getAttributeVerificationCode(t,{onSuccess:function(e){return r(e)},onFailure:function(e){return i(e)}},n)}))},e.prototype.verifyUserAttributeSubmit=function(e,t,n){return n?new Promise((function(r,i){e.verifyAttribute(t,n,{onSuccess:function(e){r(e)},onFailure:function(e){i(e)}})})):this.rejectAuthError(r.a.EmptyCode)},e.prototype.verifyCurrentUserAttribute=function(e){var t=this;return t.currentUserPoolUser().then((function(n){return t.verifyUserAttribute(n,e)}))},e.prototype.verifyCurrentUserAttributeSubmit=function(e,t){var n=this;return n.currentUserPoolUser().then((function(r){return n.verifyUserAttributeSubmit(r,e,t)}))},e.prototype.cognitoIdentitySignOut=function(e,t){return D(this,void 0,void 0,(function(){var n,r,i=this;return U(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this._storageSync];case 1:return o.sent(),[3,3];case 2:throw n=o.sent(),L.debug("Failed to sync cache info into memory",n),n;case 3:return r=this._oAuthHandler&&"true"===this._storage.getItem("amplify-signin-with-hostedUI"),[2,new Promise((function(n,o){if(e&&e.global){L.debug("user global sign out",t);var s=i._config.clientMetadata;t.getSession((function(e,s){return D(i,void 0,void 0,(function(){var i,s=this;return U(this,(function(a){switch(a.label){case 0:if(!e)return[3,5];if(L.debug("failed to get the user session",e),!this.isSessionInvalid(e))return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(t)];case 2:return a.sent(),[3,4];case 3:return i=a.sent(),o(new Error("Session is invalid due to: "+e.message+" and failed to clean up invalid session: "+i.message)),[2];case 4:return[2,o(e)];case 5:return t.globalSignOut({onSuccess:function(e){if(L.debug("global sign out success"),!r)return n();s.oAuthSignOutRedirect(n,o)},onFailure:function(e){return L.debug("global sign out failed",e),o(e)}}),[2]}}))}))}),{clientMetadata:s})}else L.debug("user sign out",t),t.signOut((function(){if(!r)return n();i.oAuthSignOutRedirect(n,o)}))}))]}}))}))},e.prototype.oAuthSignOutRedirect=function(e,t){l.a.browserOrNode().isBrowser?this.oAuthSignOutRedirectOrReject(t):this.oAuthSignOutAndResolve(e)},e.prototype.oAuthSignOutAndResolve=function(e){this._oAuthHandler.signOut(),e()},e.prototype.oAuthSignOutRedirectOrReject=function(e){this._oAuthHandler.signOut(),setTimeout((function(){return e(Error("Signout timeout fail"))}),3e3)},e.prototype.signOut=function(e){return D(this,void 0,void 0,(function(){var t;return U(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.cleanCachedItems()];case 1:return n.sent(),[3,3];case 2:return n.sent(),L.debug("failed to clear cached items"),[3,3];case 3:return this.userPool?(t=this.userPool.getCurrentUser())?[4,this.cognitoIdentitySignOut(e,t)]:[3,5]:[3,7];case 4:return n.sent(),[3,6];case 5:L.debug("no current Cognito user"),n.label=6;case 6:return[3,8];case 7:L.debug("no Cognito User pool"),n.label=8;case 8:return q("signOut",this.user,"A user has been signed out"),this.user=null,[2]}}))}))},e.prototype.cleanCachedItems=function(){return D(this,void 0,void 0,(function(){return U(this,(function(e){switch(e.label){case 0:return[4,this.Credentials.clear()];case 1:return e.sent(),[2]}}))}))},e.prototype.changePassword=function(e,t,n,r){var i=this;return void 0===r&&(r=this._config.clientMetadata),new Promise((function(o,s){i.userSession(e).then((function(i){e.changePassword(t,n,(function(e,t){return e?(L.debug("change password failure",e),s(e)):o(t)}),r)}))}))},e.prototype.forgotPassword=function(e,t){if(void 0===t&&(t=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(r.a.EmptyUsername);var n=this.createCognitoUser(e);return new Promise((function(r,i){n.forgotPassword({onSuccess:function(){r()},onFailure:function(t){L.debug("forgot password failure",t),q("forgotPassword_failure",t,e+" forgotPassword failed"),i(t)},inputVerificationCode:function(t){q("forgotPassword",n,e+" has initiated forgot password flow"),r(t)}},t)}))},e.prototype.forgotPasswordSubmit=function(e,t,n,i){if(void 0===i&&(i=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(r.a.EmptyUsername);if(!t)return this.rejectAuthError(r.a.EmptyCode);if(!n)return this.rejectAuthError(r.a.EmptyPassword);var o=this.createCognitoUser(e);return new Promise((function(r,s){o.confirmPassword(t,n,{onSuccess:function(t){q("forgotPasswordSubmit",o,e+" forgotPasswordSubmit successful"),r(t)},onFailure:function(t){q("forgotPasswordSubmit_failure",t,e+" forgotPasswordSubmit failed"),s(t)}},i)}))},e.prototype.currentUserInfo=function(){return D(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return U(this,(function(a){switch(a.label){case 0:return(e=this.Credentials.getCredSource())&&"aws"!==e&&"userPool"!==e?[3,9]:[4,this.currentUserPoolUser().catch((function(e){return L.error(e)}))];case 1:if(!(s=a.sent()))return[2,null];a.label=2;case 2:return a.trys.push([2,8,,9]),[4,this.userAttributes(s)];case 3:t=a.sent(),n=this.attributesToObject(t),r=null,a.label=4;case 4:return a.trys.push([4,6,,7]),[4,this.currentCredentials()];case 5:return r=a.sent(),[3,7];case 6:return i=a.sent(),L.debug("Failed to retrieve credentials while getting current user info",i),[3,7];case 7:return[2,{id:r?r.identityId:void 0,username:s.getUsername(),attributes:n}];case 8:return o=a.sent(),L.error("currentUserInfo error",o),[2,{}];case 9:return"federated"===e?[2,(s=this.user)||{}]:[2]}}))}))},e.prototype.federatedSignIn=function(e,t,n){return D(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p;return U(this,(function(v){switch(v.label){case 0:if(!this._config.identityPoolId&&!this._config.userPoolId)throw new Error("Federation requires either a User Pool or Identity Pool in config");if(void 0===e&&this._config.identityPoolId&&!this._config.userPoolId)throw new Error("Federation with Identity Pools requires tokens passed as arguments");return Object(r.e)(e)||Object(r.f)(e)||Object(r.c)(e)||void 0===e?(i=e||{provider:r.b.Cognito},u=Object(r.e)(i)?i.provider:i.customProvider,Object(r.e)(i),o=i.customState,this._config.userPoolId&&(s=Object(r.d)(this._config.oauth)?this._config.userPoolWebClientId:this._config.oauth.clientID,a=Object(r.d)(this._config.oauth)?this._config.oauth.redirectSignIn:this._config.oauth.redirectUri,this._oAuthHandler.oauthSignIn(this._config.oauth.responseType,this._config.oauth.domain,a,s,u,o)),[3,4]):[3,1];case 1:u=e;try{(c=JSON.stringify(JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")).user))&&L.warn("There is already a signed in user: "+c+" in your app.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tYou should not call Auth.federatedSignIn method again as it may cause unexpected behavior.")}catch(e){}return l=t.token,f=t.identity_id,d=t.expires_at,[4,this.Credentials.set({provider:u,token:l,identity_id:f,user:n,expires_at:d},"federation")];case 2:return h=v.sent(),[4,this.currentAuthenticatedUser()];case 3:return p=v.sent(),q("signIn",p,"A user "+p.username+" has been signed in"),L.debug("federated sign in credentials",h),[2,h];case 4:return[2]}}))}))},e.prototype._handleAuthResponse=function(e){return D(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,f,d,v,y,g;return U(this,(function(m){switch(m.label){case 0:if(this.oAuthFlowInProgress)return L.debug("Skipping URL "+e+" current flow in progress"),[2];m.label=1;case 1:if(m.trys.push([1,,8,9]),this.oAuthFlowInProgress=!0,!this._config.userPoolId)throw new Error("OAuth responses require a User Pool defined in config");if(q("parsingCallbackUrl",{url:e},"The callback url is being parsed"),t=e||(l.a.browserOrNode().isBrowser?window.location.href:""),n=!!(Object(p.parse)(t).query||"").split("&").map((function(e){return e.split("=")})).find((function(e){var t=F(e,1)[0];return"code"===t||"error"===t})),r=!!(Object(p.parse)(t).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).find((function(e){var t=F(e,1)[0];return"access_token"===t||"error"===t})),!n&&!r)return[3,7];this._storage.setItem("amplify-redirected-from-hosted-ui","true"),m.label=2;case 2:return m.trys.push([2,6,,7]),[4,this._oAuthHandler.handleAuthResponse(t)];case 3:return i=m.sent(),o=i.accessToken,s=i.idToken,a=i.refreshToken,u=i.state,c=new h.h({IdToken:new h.c({IdToken:s}),RefreshToken:new h.d({RefreshToken:a}),AccessToken:new h.b({AccessToken:o})}),f=void 0,this._config.identityPoolId?[4,this.Credentials.set(c,"session")]:[3,5];case 4:f=m.sent(),L.debug("AWS credentials",f),m.label=5;case 5:return d=/-/.test(u),(v=this.createCognitoUser(c.getIdToken().decodePayload()["cognito:username"])).setSignInUserSession(c),window&&void 0!==window.history&&window.history.replaceState({},null,this._config.oauth.redirectSignIn),q("signIn",v,"A user "+v.getUsername()+" has been signed in"),q("cognitoHostedUI",v,"A user "+v.getUsername()+" has been signed in via Cognito Hosted UI"),d&&(y=u.split("-").splice(1).join("-"),q("customOAuthState",y.match(/.{2}/g).map((function(e){return String.fromCharCode(parseInt(e,16))})).join(""),"State for user "+v.getUsername())),[2,f];case 6:return g=m.sent(),L.debug("Error in cognito hosted auth response",g),window&&void 0!==window.history&&window.history.replaceState({},null,this._config.oauth.redirectSignIn),q("signIn_failure",g,"The OAuth response flow failed"),q("cognitoHostedUI_failure",g,"A failure occurred when returning to the Cognito Hosted UI"),q("customState_failure",g,"A failure occurred when returning state"),[3,7];case 7:return[3,9];case 8:return this.oAuthFlowInProgress=!1,[7];case 9:return[2]}}))}))},e.prototype.essentialCredentials=function(e){return{accessKeyId:e.accessKeyId,sessionToken:e.sessionToken,secretAccessKey:e.secretAccessKey,identityId:e.identityId,authenticated:e.authenticated}},e.prototype.attributesToObject=function(e){var t=this,n={};return e&&e.map((function(e){"email_verified"===e.Name||"phone_number_verified"===e.Name?n[e.Name]=t.isTruthyString(e.Value)||!0===e.Value:n[e.Name]=e.Value})),n},e.prototype.isTruthyString=function(e){return"function"==typeof e.toLowerCase&&"true"===e.toLowerCase()},e.prototype.createCognitoUser=function(e){var t={Username:e,Pool:this.userPool};t.Storage=this._storage;var n=this._config.authenticationFlowType,r=new h.e(t);return n&&r.setAuthenticationFlowType(n),r},e.prototype._isValidAuthStorage=function(e){return!!e&&"function"==typeof e.getItem&&"function"==typeof e.setItem&&"function"==typeof e.removeItem&&"function"==typeof e.clear},e.prototype.noUserPoolErrorHandler=function(e){return!e||e.userPoolId&&e.identityPoolId?r.a.NoConfig:r.a.MissingAuthConfig},e.prototype.rejectAuthError=function(e){return Promise.reject(new k(e))},e.prototype.rejectNoUserPool=function(){var e=this.noUserPoolErrorHandler(this._config);return Promise.reject(new N(e))},e.prototype.rememberDevice=function(){return D(this,void 0,void 0,(function(){var e,t;return U(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.currentUserPoolUser()];case 1:return e=n.sent(),[3,3];case 2:return t=n.sent(),L.debug("The user is not authenticated by the error",t),[2,Promise.reject("The user is not authenticated")];case 3:return e.getCachedDeviceKeyAndPassword(),[2,new Promise((function(t,n){e.setDeviceStatusRemembered({onSuccess:function(e){t(e)},onFailure:function(e){"InvalidParameterException"===e.code?n(new k(r.a.DeviceConfig)):"NetworkError"===e.code?n(new k(r.a.NetworkError)):n(e)}})}))]}}))}))},e.prototype.forgetDevice=function(){return D(this,void 0,void 0,(function(){var e,t;return U(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.currentUserPoolUser()];case 1:return e=n.sent(),[3,3];case 2:return t=n.sent(),L.debug("The user is not authenticated by the error",t),[2,Promise.reject("The user is not authenticated")];case 3:return e.getCachedDeviceKeyAndPassword(),[2,new Promise((function(t,n){e.forgetDevice({onSuccess:function(e){t(e)},onFailure:function(e){"InvalidParameterException"===e.code?n(new k(r.a.DeviceConfig)):"NetworkError"===e.code?n(new k(r.a.NetworkError)):n(e)}})}))]}}))}))},e.prototype.fetchDevices=function(){return D(this,void 0,void 0,(function(){var e,t;return U(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.currentUserPoolUser()];case 1:return e=n.sent(),[3,3];case 2:throw t=n.sent(),L.debug("The user is not authenticated by the error",t),new Error("The user is not authenticated");case 3:return e.getCachedDeviceKeyAndPassword(),[2,new Promise((function(t,n){var i={onSuccess:function(e){var n=e.Devices.map((function(e){var t=e.DeviceAttributes.find((function(e){return"device_name"===e.Name}))||{};return{id:e.DeviceKey,name:t.Value}}));t(n)},onFailure:function(e){"InvalidParameterException"===e.code?n(new k(r.a.DeviceConfig)):"NetworkError"===e.code?n(new k(r.a.NetworkError)):n(e)}};e.listDevices(60,null,i)}))]}}))}))},e}())(null);d.a.register(z)},function(e,t,n){var r,i,o;e.exports=(o=n(13),i=(r=o).lib.WordArray,r.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp();for(var i=[],o=0;o<n;o+=3)for(var s=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a<n;a++)i.push(r.charAt(s>>>6*(3-a)&63));var u=r.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e){var t=e.length,n=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var o=0;o<n.length;o++)r[n.charCodeAt(o)]=o}var s=n.charAt(64);if(s){var a=e.indexOf(s);-1!==a&&(t=a)}return function(e,t,n){for(var r=[],o=0,s=0;s<t;s++)if(s%4){var a=n[e.charCodeAt(s-1)]<<s%4*2,u=n[e.charCodeAt(s)]>>>6-s%4*2,c=a|u;r[o>>>2]|=c<<24-o%4*8,o++}return i.create(r,o)}(e,t,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},o.enc.Base64)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(0).__exportStar(n(144),t)},function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return _}));var r,i,o=n(12),s=n(21),a=n(18),u=n(23),c=n(22),l=n(34),f=n(16),d=n(10),h=n(3),p=n(4),v=n(2),y=function(){return(y=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},g=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},m=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},b=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},w=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(b(arguments[t]));return e},S=new c.a("DataStore");!function(e){e.CONNECTED="CONNECTED"}(r||(r={})),function(e){e[e.none=0]="none",e[e.unauth=1]="unauth",e[e.auth=2]="auth"}(i||(i={}));var _=function(){function t(e,t,n,r){void 0===n&&(n={}),this.schema=e,this.syncPredicates=t,this.amplifyConfig=n,this.authModeStrategy=r,this.typeQuery=new WeakMap,this.buffer=[]}return t.prototype.buildSubscription=function(e,t,n,r,i,o,s){var a=this.amplifyConfig.aws_appsync_authenticationType,u=this.getAuthorizationInfo(t,r,a,i,o,s)||{},c=u.isOwner,l=u.ownerField,f=u.ownerValue,d=b(Object(h.c)(e,t,n,c,l),3);return{authMode:s,opType:d[0],opName:d[1],query:d[2],isOwner:c,ownerField:l,ownerValue:f}},t.prototype.getAuthorizationInfo=function(e,t,n,r,s,a){void 0===r&&(r={}),void 0===s&&(s={});var u=Object(h.e)(e);if(a===o.a.AWS_IAM&&u.find((function(e){return"private"===e.authStrategy&&"iam"===e.provider}))&&t===i.unauth)return null;var c,l=u.filter((function(e){return"groups"===e.authStrategy&&["userPools","oidc"].includes(e.provider)}));return a!==o.a.AMAZON_COGNITO_USER_POOLS&&a!==o.a.OPENID_CONNECT||!l.find((function(e){var t=Object(h.j)(r,e),n=Object(h.j)(s,e);return w(t,n).find((function(t){return e.groups.find((function(e){return e===t}))}))}))?((a===o.a.AMAZON_COGNITO_USER_POOLS?u.filter((function(e){return"owner"===e.authStrategy&&"userPools"===e.provider})):[]).forEach((function(e){var t=r[e.identityClaim];t&&(c={authMode:o.a.AMAZON_COGNITO_USER_POOLS,isOwner:!e.areSubscriptionsPublic,ownerField:e.ownerField,ownerValue:t})})),c||((a===o.a.OPENID_CONNECT?u.filter((function(e){return"owner"===e.authStrategy&&"oidc"===e.provider})):[]).forEach((function(e){var t=s[e.identityClaim];t&&(c={authMode:o.a.OPENID_CONNECT,isOwner:!e.areSubscriptionsPublic,ownerField:e.ownerField,ownerValue:t})})),c||{authMode:a||n,isOwner:!1})):{authMode:a,isOwner:!1}},t.prototype.hubQueryCompletionListener=function(e,t){t.payload.event===f.CONTROL_MSG.SUBSCRIPTION_ACK&&e()},t.prototype.start=function(){var t=this;return[new d.a((function(n){var o,c,d=[],v={},w=i.none;return g(t,void 0,void 0,(function(){var t,_,E,A,O,I,T,C,x,P,k=this;return m(this,(function(N){switch(N.label){case 0:return N.trys.push([0,2,,3]),[4,a.a.currentCredentials()];case 1:return t=N.sent(),w=t.authenticated?i.auth:i.unauth,[3,3];case 2:return N.sent(),[3,3];case 3:return N.trys.push([3,5,,6]),[4,a.a.currentSession()];case 4:return _=N.sent(),o=_.getIdToken().decodePayload(),[3,6];case 5:return N.sent(),[3,6];case 6:if(N.trys.push([6,11,,12]),E=this.amplifyConfig,A=E.aws_cognito_region,O=E.Auth,!A||O&&!O.region)throw"Auth is not configured";return I=void 0,[4,u.a.getItem("federatedInfo")];case 7:return(T=N.sent())?(I=T.token,[3,10]):[3,8];case 8:return[4,a.a.currentAuthenticatedUser()];case 9:(C=N.sent())&&(I=C.token),N.label=10;case 10:return I&&(x=I.split(".")[1],c=JSON.parse(e.from(x,"base64").toString("utf8"))),[3,12];case 11:return P=N.sent(),S.debug("error getting OIDC JWT",P),[3,12];case 12:return Object.values(this.schema.namespaces).forEach((function(e){Object.values(e.models).filter((function(e){return e.syncable})).forEach((function(t){return g(k,void 0,void 0,(function(){var r,i,a,u,_,E,A,O,I=this;return m(this,(function(T){switch(T.label){case 0:return[4,Object(h.h)({authModeStrategy:this.authModeStrategy,defaultAuthMode:this.amplifyConfig.aws_appsync_authenticationType,modelName:t.name,schema:this.schema})];case 1:return r=T.sent(),i=r.READ,v=y(y({},v),((E={})[t.name]=((A={})[h.a.CREATE]=[],A[h.a.UPDATE]=[],A[h.a.DELETE]=[],A),E)),a=[h.a.CREATE,h.a.UPDATE,h.a.DELETE],(O={})[h.a.CREATE]=0,O[h.a.UPDATE]=0,O[h.a.DELETE]=0,u=O,_=function(r){return g(I,void 0,void 0,(function(){var a,E,A,O,I,T,C,x,P,k,N,M,j=this;return m(this,(function(R){switch(R.label){case 0:return a=this.buildSubscription(e,t,r,w,o,c,i[u[r]]),E=a.opType,A=a.opName,O=a.query,I=a.isOwner,T=a.ownerField,C=a.ownerValue,x=a.authMode,[4,Object(h.i)(x,this.amplifyConfig)];case 1:if(P=R.sent(),k={},I){if(!C)return n.error("Owner field required, sign in is needed in order to perform this operation"),[2];k[T]=C}return S.debug("Attempting "+r+" subscription with authMode: "+i[u[r]]),N=s.a.graphql(y(y({query:O,variables:k},{authMode:x}),{authToken:P})),v[t.name][E].push(N.map((function(e){return e.value})).subscribe({next:function(e){var n=e.data,r=e.errors;if(Array.isArray(r)&&r.length>0){var i=r.map((function(e){return e.message}));return S.warn("Skipping incoming subscription. Messages: "+i.join("\n")),void j.drainBuffer()}var o=p.a.getPredicates(j.syncPredicates.get(t),!1),s=n[A];j.passesPredicateValidation(s,o)&&j.pushToBuffer(E,t,s),j.drainBuffer()},error:function(e){var o=e.error,s=b((void 0===o?{errors:[]}:o).errors,1)[0],a=(void 0===s?{}:s).message,c=void 0===a?"":a;if(c.includes(f.CONTROL_MSG.REALTIME_SUBSCRIPTION_INIT_ERROR)||c.includes(f.CONTROL_MSG.CONNECTION_FAILED))return v[t.name][E].forEach((function(e){return e.unsubscribe()})),v[t.name][E]=[],u[r]++,u[r]>=i.length?(S.debug(r+" subscription failed with authMode: "+i[u[r]-1]),void S.warn("subscriptionError",c)):(S.debug(r+" subscription failed with authMode: "+i[u[r]-1]+". Retrying with authMode: "+i[u[r]]),void _(r));S.warn("subscriptionError",c),"function"==typeof M&&M(),c.includes('"errorType":"Unauthorized"')||c.includes('"errorType":"OperationDisabled"')||n.error(c)}})),d.push(g(j,void 0,void 0,(function(){var e,t=this;return m(this,(function(n){switch(n.label){case 0:return[4,new Promise((function(n){M=n,e=t.hubQueryCompletionListener.bind(t,n),l.a.listen("api",e)}))];case 1:return n.sent(),l.a.remove("api",e),[2]}}))}))),[2]}}))}))},a.forEach((function(e){return _(e)})),[2]}}))}))}))})),Promise.all(d).then((function(){return n.next(r.CONNECTED)})),[2]}}))})),function(){Object.keys(v).forEach((function(e){v[e][h.a.CREATE].forEach((function(e){return e.unsubscribe()})),v[e][h.a.UPDATE].forEach((function(e){return e.unsubscribe()})),v[e][h.a.DELETE].forEach((function(e){return e.unsubscribe()}))}))}})),new d.a((function(e){return t.dataObserver=e,t.drainBuffer(),function(){t.dataObserver=null}}))]},t.prototype.passesPredicateValidation=function(e,t){if(!t)return!0;var n=t.predicates,r=t.type;return Object(v.B)(e,r,n)},t.prototype.pushToBuffer=function(e,t,n){this.buffer.push([e,t,n])},t.prototype.drainBuffer=function(){var e=this;this.dataObserver&&(this.buffer.forEach((function(t){return e.dataObserver.next(t)})),this.buffer=[])},t}()}).call(this,n(6).Buffer)},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var i=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,i=n;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")}},function(e,t,n){var r;e.exports=(r=n(13),function(){if("function"==typeof ArrayBuffer){var e=r.lib.WordArray,t=e.init;(e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var n=e.byteLength,r=[],i=0;i<n;i++)r[i>>>2]|=e[i]<<24-i%4*8;t.call(this,r,n)}else t.apply(this,arguments)}).prototype=e}}(),r.lib.WordArray)},function(e,t,n){"use strict";n.r(t),t.default=function(e,t){return t=t||{},new Promise((function(n,r){var i=new XMLHttpRequest,o=[],s=[],a={},u=function(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:u,headers:{keys:function(){return o},entries:function(){return s},get:function(e){return a[e.toLowerCase()]},has:function(e){return e.toLowerCase()in a}}}};for(var c in i.open(t.method||"get",e,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(e,t,n){o.push(t=t.toLowerCase()),s.push([t,n]),a[t]=a[t]?a[t]+","+n:n})),n(u())},i.onerror=r,i.withCredentials="include"==t.credentials,t.headers)i.setRequestHeader(c,t.headers[c]);i.send(t.body||null)}))}},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var u,c=[],l=!1,f=-1;function d(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&h())}function h(){if(!l){var e=a(d);l=!0;for(var t=c.length;t;){for(u=c,c=[];++f<t;)u&&u[f].run();f=-1,t=c.length}u=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new p(e,t)),1!==c.length||l||a(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r=function(){function e(){}return e.createPredicateBuilder=function(t){var n=t.name,r=new Set(Object.keys(t.fields)),i=new Proxy({},{get:function(t,i,o){var s=i;if(!r.has(s))throw new Error("Invalid field for model. field: "+s+", model: "+n);return function(t){return e.sortPredicateGroupsMap.get(o).push({field:s,sortDirection:t}),o}}});return e.sortPredicateGroupsMap.set(i,[]),i},e.isValidPredicate=function(t){return e.sortPredicateGroupsMap.has(t)},e.getPredicates=function(t,n){if(void 0===n&&(n=!0),n&&!e.isValidPredicate(t))throw new Error("The predicate is not valid");return e.sortPredicateGroupsMap.get(t)},e.createFromExisting=function(t,n){if(n&&t)return n(e.createPredicateBuilder(t))},e.sortPredicateGroupsMap=new WeakMap,e}()},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var i=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,i=n;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(109),i=n(55),o=n(35),s=n(37),a=function(){function e(e){e?(this.operation=function(e){return new Promise((function(t,n){var r=(0,s.locateWindow)().msCrypto.subtle.importKey("raw",u(e),i.SHA_256_HMAC_ALGO,!1,["sign"]);r.oncomplete=function(){r.result&&t(r.result),n(new Error("ImportKey completed without importing key."))},r.onerror=function(){n(new Error("ImportKey failed to import key."))}}))}(e).then((function(e){return(0,s.locateWindow)().msCrypto.subtle.sign(i.SHA_256_HMAC_ALGO,e)})),this.operation.catch((function(){}))):this.operation=Promise.resolve((0,s.locateWindow)().msCrypto.subtle.digest("SHA-256"))}return e.prototype.update=function(e){var t=this;(0,r.isEmptyData)(e)||(this.operation=this.operation.then((function(n){return n.onerror=function(){t.operation=Promise.reject(new Error("Error encountered updating hash"))},n.process(u(e)),n})),this.operation.catch((function(){})))},e.prototype.digest=function(){return this.operation.then((function(e){return new Promise((function(t,n){e.onerror=function(){n(new Error("Error encountered finalizing hash"))},e.oncomplete=function(){e.result&&t(new Uint8Array(e.result)),n(new Error("Error encountered finalizing hash"))},e.finish()}))}))},e}();function u(e){return"string"==typeof e?(0,o.fromUtf8)(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.Sha256=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EMPTY_DATA_SHA_256=t.SHA_256_HMAC_ALGO=t.SHA_256_HASH=void 0,t.SHA_256_HASH={name:"SHA-256"},t.SHA_256_HMAC_ALGO={name:"HMAC",hash:t.SHA_256_HASH},t.EMPTY_DATA_SHA_256=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(57),i=n(55),o=n(37),s=function(){function e(e){this.toHash=new Uint8Array(0),void 0!==e&&(this.key=new Promise((function(t,n){(0,o.locateWindow)().crypto.subtle.importKey("raw",(0,r.convertToBuffer)(e),i.SHA_256_HMAC_ALGO,!1,["sign"]).then(t,n)})),this.key.catch((function(){})))}return e.prototype.update=function(e){if(!(0,r.isEmptyData)(e)){var t=(0,r.convertToBuffer)(e),n=new Uint8Array(this.toHash.byteLength+t.byteLength);n.set(this.toHash,0),n.set(t,this.toHash.byteLength),this.toHash=n}},e.prototype.digest=function(){var e=this;return this.key?this.key.then((function(t){return(0,o.locateWindow)().crypto.subtle.sign(i.SHA_256_HMAC_ALGO,t,e.toHash).then((function(e){return new Uint8Array(e)}))})):(0,r.isEmptyData)(this.toHash)?Promise.resolve(i.EMPTY_DATA_SHA_256):Promise.resolve().then((function(){return(0,o.locateWindow)().crypto.subtle.digest(i.SHA_256_HASH,e.toHash)})).then((function(e){return Promise.resolve(new Uint8Array(e))}))},e}();t.Sha256=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint32ArrayFrom=t.numToUint8=t.isEmptyData=t.convertToBuffer=void 0;var r=n(110);Object.defineProperty(t,"convertToBuffer",{enumerable:!0,get:function(){return r.convertToBuffer}});var i=n(111);Object.defineProperty(t,"isEmptyData",{enumerable:!0,get:function(){return i.isEmptyData}});var o=n(112);Object.defineProperty(t,"numToUint8",{enumerable:!0,get:function(){return o.numToUint8}});var s=n(113);Object.defineProperty(t,"uint32ArrayFrom",{enumerable:!0,get:function(){return s.uint32ArrayFrom}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MAX_HASHABLE_LENGTH=t.INIT=t.KEY=t.DIGEST_LENGTH=t.BLOCK_SIZE=void 0,t.BLOCK_SIZE=64,t.DIGEST_LENGTH=32,t.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),t.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],t.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1},function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(22),i=function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},o=new r.a("Parser"),s=function(e){var t,n={};if(e.aws_mobile_analytics_app_id){var r={AWSPinpoint:{appId:e.aws_mobile_analytics_app_id,region:e.aws_mobile_analytics_app_region}};n.Analytics=r}return(e.aws_cognito_identity_pool_id||e.aws_user_pools_id)&&(n.Auth={userPoolId:e.aws_user_pools_id,userPoolWebClientId:e.aws_user_pools_web_client_id,region:e.aws_cognito_region,identityPoolId:e.aws_cognito_identity_pool_id,identityPoolRegion:e.aws_cognito_region,mandatorySignIn:"enable"===e.aws_mandatory_sign_in}),t=e.aws_user_files_s3_bucket?{AWSS3:{bucket:e.aws_user_files_s3_bucket,region:e.aws_user_files_s3_bucket_region,dangerouslyConnectToHttpEndpointForTesting:e.aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing}}:e?e.Storage||e:{},e.Logging&&(n.Logging=i(i({},e.Logging),{region:e.aws_project_region})),e.geo&&(n.Geo=Object.assign({},e.geo),e.geo.amazon_location_service&&(n.Geo={AmazonLocationService:e.geo.amazon_location_service})),n.Analytics=Object.assign({},n.Analytics,e.Analytics),n.Auth=Object.assign({},n.Auth,e.Auth),n.Storage=Object.assign({},t),n.Logging=Object.assign({},n.Logging,e.Logging),o.debug("parse config",e,"to amplifyconfig",n),n},a=function(){function e(){}return e.parseMobilehubConfig=s,e}()},function(e,t,n){(function(t){var r;e.exports=(r=r||function(e,r){var i;if("undefined"!=typeof window&&window.crypto&&(i=window.crypto),"undefined"!=typeof self&&self.crypto&&(i=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(i=globalThis.crypto),!i&&"undefined"!=typeof window&&window.msCrypto&&(i=window.msCrypto),!i&&void 0!==t&&t.crypto&&(i=t.crypto),!i)try{i=n(125)}catch(e){}var o=function(){if(i){if("function"==typeof i.getRandomValues)try{return i.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof i.randomBytes)try{return i.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),a={},u=a.lib={},c=u.Base={extend:function(e){var t=s(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},l=u.WordArray=c.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||d).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,i=e.sigBytes;if(this.clamp(),r%4)for(var o=0;o<i;o++){var s=n[o>>>2]>>>24-o%4*8&255;t[r+o>>>2]|=s<<24-(r+o)%4*8}else for(var a=0;a<i;a+=4)t[r+a>>>2]=n[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=c.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n<e;n+=4)t.push(o());return new l.init(t,e)}}),f=a.enc={},d=f.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new l.init(n,t/2)}},h=f.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new l.init(n,t)}},p=f.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},v=u.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,r=this._data,i=r.words,o=r.sigBytes,s=this.blockSize,a=o/(4*s),u=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,c=e.min(4*u,o);if(u){for(var f=0;f<u;f+=s)this._doProcessBlock(i,f);n=i.splice(0,u),r.sigBytes-=c}return new l.init(n,c)},clone:function(){var e=c.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),y=(u.Hasher=v.extend({cfg:c.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){v.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new y.HMAC.init(e,n).finalize(t)}}}),a.algo={});return a}(Math),r)}).call(this,n(29))},function(e,t,n){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}},function(e,t,n){"use strict";var r=n(14);function i(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,n){if(!t)return e;var o;if(n)o=n(t);else if(r.isURLSearchParams(t))o=t.toString();else{var s=[];r.forEach(t,(function(e,t){null!=e&&(r.isArray(e)?t+="[]":e=[e],r.forEach(e,(function(e){r.isDate(e)?e=e.toISOString():r.isObject(e)&&(e=JSON.stringify(e)),s.push(i(t)+"="+i(e))})))})),o=s.join("&")}if(o){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}},function(e,t,n){"use strict";e.exports=function(e,t,n,r,i){return e.config=t,n&&(e.code=n),e.request=r,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},function(e,t,n){"use strict";var r=n(14),i=n(132),o=n(133),s=n(62),a=n(134),u=n(137),c=n(138),l=n(65);e.exports=function(e){return new Promise((function(t,n){var f=e.data,d=e.headers,h=e.responseType;r.isFormData(f)&&delete d["Content-Type"];var p=new XMLHttpRequest;if(e.auth){var v=e.auth.username||"",y=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";d.Authorization="Basic "+btoa(v+":"+y)}var g=a(e.baseURL,e.url);function m(){if(p){var r="getAllResponseHeaders"in p?u(p.getAllResponseHeaders()):null,o={data:h&&"text"!==h&&"json"!==h?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:r,config:e,request:p};i(t,n,o),p=null}}if(p.open(e.method.toUpperCase(),s(g,e.params,e.paramsSerializer),!0),p.timeout=e.timeout,"onloadend"in p?p.onloadend=m:p.onreadystatechange=function(){p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))&&setTimeout(m)},p.onabort=function(){p&&(n(l("Request aborted",e,"ECONNABORTED",p)),p=null)},p.onerror=function(){n(l("Network Error",e,null,p)),p=null},p.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(l(t,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",p)),p=null},r.isStandardBrowserEnv()){var b=(e.withCredentials||c(g))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0;b&&(d[e.xsrfHeaderName]=b)}"setRequestHeader"in p&&r.forEach(d,(function(e,t){void 0===f&&"content-type"===t.toLowerCase()?delete d[t]:p.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(p.withCredentials=!!e.withCredentials),h&&"json"!==h&&(p.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&p.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&p.upload&&p.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){p&&(p.abort(),n(e),p=null)})),f||(f=null),p.send(f)}))}},function(e,t,n){"use strict";var r=n(63);e.exports=function(e,t,n,i,o){var s=new Error(e);return r(s,t,n,i,o)}},function(e,t,n){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,n){"use strict";var r=n(14);e.exports=function(e,t){t=t||{};var n={},i=["url","method","data"],o=["headers","auth","proxy","params"],s=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function u(e,t){return r.isPlainObject(e)&&r.isPlainObject(t)?r.merge(e,t):r.isPlainObject(t)?r.merge({},t):r.isArray(t)?t.slice():t}function c(i){r.isUndefined(t[i])?r.isUndefined(e[i])||(n[i]=u(void 0,e[i])):n[i]=u(e[i],t[i])}r.forEach(i,(function(e){r.isUndefined(t[e])||(n[e]=u(void 0,t[e]))})),r.forEach(o,c),r.forEach(s,(function(i){r.isUndefined(t[i])?r.isUndefined(e[i])||(n[i]=u(void 0,e[i])):n[i]=u(void 0,t[i])})),r.forEach(a,(function(r){r in t?n[r]=u(e[r],t[r]):r in e&&(n[r]=u(void 0,e[r]))}));var l=i.concat(o).concat(s).concat(a),f=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===l.indexOf(e)}));return r.forEach(f,c),n}},function(e,t,n){"use strict";function r(e){this.message=e}r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,e.exports=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BLOCK_SIZE=64,t.DIGEST_LENGTH=32,t.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),t.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],t.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1},function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(26);function i(e,t){void 0===t&&(t={});var n=function(e){if(e&&"j"===e[0]&&":"===e[1])return e.substr(2);return e}(e);if(function(e,t){return void 0===t&&(t=!e||"{"!==e[0]&&"["!==e[0]&&'"'!==e[0]),!t}(n,t.doNotParse))try{return JSON.parse(n)}catch(e){}return e}var o=function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},s=function(){function e(e,t){var n=this;this.changeListeners=[],this.HAS_DOCUMENT_COOKIE=!1,this.cookies=function(e,t){return"string"==typeof e?r.parse(e,t):"object"==typeof e&&null!==e?e:{}}(e,t),new Promise((function(){n.HAS_DOCUMENT_COOKIE="object"==typeof document&&"string"==typeof document.cookie})).catch((function(){}))}return e.prototype._updateBrowserValues=function(e){this.HAS_DOCUMENT_COOKIE&&(this.cookies=r.parse(document.cookie,e))},e.prototype._emitChange=function(e){for(var t=0;t<this.changeListeners.length;++t)this.changeListeners[t](e)},e.prototype.get=function(e,t,n){return void 0===t&&(t={}),this._updateBrowserValues(n),i(this.cookies[e],t)},e.prototype.getAll=function(e,t){void 0===e&&(e={}),this._updateBrowserValues(t);var n={};for(var r in this.cookies)n[r]=i(this.cookies[r],e);return n},e.prototype.set=function(e,t,n){var i;"object"==typeof t&&(t=JSON.stringify(t)),this.cookies=o(o({},this.cookies),((i={})[e]=t,i)),this.HAS_DOCUMENT_COOKIE&&(document.cookie=r.serialize(e,t,n)),this._emitChange({name:e,value:t,options:n})},e.prototype.remove=function(e,t){var n=t=o(o({},t),{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=o({},this.cookies),delete this.cookies[e],this.HAS_DOCUMENT_COOKIE&&(document.cookie=r.serialize(e,"",n)),this._emitChange({name:e,value:void 0,options:t})},e.prototype.addChangeListener=function(e){this.changeListeners.push(e)},e.prototype.removeChangeListener=function(e){var t=this.changeListeners.indexOf(e);t>=0&&this.changeListeners.splice(t,1)},e}(),a=n(15),u=Object(a.b)().isBrowser,c=function(){function e(e){void 0===e&&(e={}),this.cookies=new s,this.store=u?window.localStorage:Object.create(null),this.cookies=e.req?new s(e.req.headers.cookie):new s,Object.assign(this.store,this.cookies.getAll())}return Object.defineProperty(e.prototype,"length",{get:function(){return Object.entries(this.store).length},enumerable:!0,configurable:!0}),e.prototype.clear=function(){var e=this;Array.from(new Array(this.length)).map((function(t,n){return e.key(n)})).forEach((function(t){return e.removeItem(t)}))},e.prototype.getItem=function(e){return this.getLocalItem(e)},e.prototype.getLocalItem=function(e){return Object.prototype.hasOwnProperty.call(this.store,e)?this.store[e]:null},e.prototype.getUniversalItem=function(e){return this.cookies.get(e)},e.prototype.key=function(e){return Object.keys(this.store)[e]},e.prototype.removeItem=function(e){this.removeLocalItem(e),this.removeUniversalItem(e)},e.prototype.removeLocalItem=function(e){delete this.store[e]},e.prototype.removeUniversalItem=function(e){this.cookies.remove(e,{path:"/"})},e.prototype.setItem=function(e,t){switch(this.setLocalItem(e,t),e.split(".").pop()){case"LastAuthUser":case"accessToken":case"refreshToken":case"idToken":u?this.setUniversalItem(e,t):this.setLocalItem(e,t)}},e.prototype.setLocalItem=function(e,t){this.store[e]=t},e.prototype.setUniversalItem=function(e,t){this.cookies.set(e,t,{path:"/",sameSite:!0,secure:"localhost"!==window.location.hostname})},e}()},function(e,t,n){"use strict";n.d(t,"a",(function(){return O}));for(var r=n(22),i=n(43),o={},s={},a=0;a<256;a++){var u=a.toString(16).toLowerCase();1===u.length&&(u="0"+u),o[a]=u,s[u]=a}function c(e){for(var t="",n=0;n<e.byteLength;n++)t+=o[e[n]];return t}var l=n(8),f=n(157);function d(e){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var h=function(){return(h=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},p=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},v=new r.a("Signer"),y=function(e,t){var n=new i.Sha256(e);return n.update(t),n.digestSync()},g=function(e){var t=e||"",n=new i.Sha256;return n.update(t),c(n.digestSync())},m=function(e){return Object.keys(e).map((function(e){return e.toLowerCase()})).sort().join(";")},b=function(e){var t,n,r=Object(l.parse)(e.url);return[e.method||"/",encodeURIComponent(r.pathname).replace(/%2F/gi,"/"),(n=r.query,n&&0!==n.length?n.split("&").map((function(e){var t=e.split("=");if(1===t.length)return e;var n=t[1].replace(/[!'()*]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}));return t[0]+"="+n})).sort((function(e,t){var n=e.split("=")[0],r=t.split("=")[0];return n===r?e<t?-1:1:n<r?-1:1})).join("&"):""),(t=e.headers,t&&0!==Object.keys(t).length?Object.keys(t).map((function(e){return{key:e.toLowerCase(),value:t[e]?t[e].trim().replace(/\s+/g," "):""}})).sort((function(e,t){return e.key<t.key?-1:1})).map((function(e){return e.key+":"+e.value})).join("\n")+"\n":""),m(e.headers),g(e.data)].join("\n")},w=function(e){var t=(Object(l.parse)(e.url).host.match(/([^\.]+)\.(?:([^\.]*)\.)?amazonaws\.com$/)||[]).slice(1,3);return"es"===t[1]&&(t=t.reverse()),{service:e.service||t[0],region:e.region||t[1]}},S=function(e,t,n){return[e,t,n,"aws4_request"].join("/")},_=function(e,t,n,r){return[e,n,r,g(t)].join("\n")},E=function(e,t,n){v.debug(n);var r=y("AWS4"+e,t),i=y(r,n.region),o=y(i,n.service);return y(o,"aws4_request")},A=function(e,t){return c(y(e,t))},O=function(){function e(){}return e.sign=function(e,t,n){void 0===n&&(n=null),e.headers=e.headers||{};var r=f.a.getDateWithClockOffset().toISOString().replace(/[:\-]|\.\d{3}/g,""),i=r.substr(0,8),o=Object(l.parse)(e.url);e.headers.host=o.host,e.headers["x-amz-date"]=r,t.session_token&&(e.headers["X-Amz-Security-Token"]=t.session_token);var s=b(e);v.debug(s);var a=n||w(e),u=S(i,a.region,a.service),c=_("AWS4-HMAC-SHA256",s,r,u),d=E(t.secret_key,i,a),h=A(d,c),p=function(e,t,n,r,i){return[e+" Credential="+t+"/"+n,"SignedHeaders="+r,"Signature="+i].join(", ")}("AWS4-HMAC-SHA256",t.access_key,u,m(e.headers),h);return e.headers.Authorization=p,e},e.signUrl=function(e,t,n,r){var i="object"===d(e)?e.url:e,o="object"===d(e)?e.method:"GET",s="object"===d(e)?e.body:void 0,a=f.a.getDateWithClockOffset().toISOString().replace(/[:\-]|\.\d{3}/g,""),u=a.substr(0,8),c=Object(l.parse)(i,!0,!0),v=(c.search,p(c,["search"])),y={host:v.host},g=n||w({url:Object(l.format)(v)}),m=g.region,O=g.service,I=S(u,m,O),T=t.session_token&&"iotdevicegateway"!==O,C=h(h(h({"X-Amz-Algorithm":"AWS4-HMAC-SHA256","X-Amz-Credential":[t.access_key,I].join("/"),"X-Amz-Date":a.substr(0,16)},T?{"X-Amz-Security-Token":""+t.session_token}:{}),r?{"X-Amz-Expires":""+r}:{}),{"X-Amz-SignedHeaders":Object.keys(y).join(",")}),x=b({method:o,url:Object(l.format)(h(h({},v),{query:h(h({},v.query),C)})),headers:y,data:s}),P=_("AWS4-HMAC-SHA256",x,a,I),k=E(t.secret_key,u,{region:m,service:O}),N=A(k,P),M=h({"X-Amz-Signature":N},t.session_token&&{"X-Amz-Security-Token":t.session_token});return Object(l.format)({protocol:v.protocol,slashes:!0,hostname:v.hostname,port:v.port,pathname:v.pathname,query:h(h(h({},v.query),C),M)})},e}()},function(e,t,n){"use strict";(function(e){var r;if(n.d(t,"a",(function(){return i})),"undefined"!=typeof window&&window.crypto&&(r=window.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==e&&e.crypto&&(r=e.crypto),!r)try{r=n(97)}catch(e){}function i(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")}}).call(this,n(29))},function(e,t,n){"use strict";var r,i,o=n(99);function s(e,t,n){if(e._observer)a(e._observer,t,n);else if(e._observers){var r=[];e._observers.forEach((function(e){r.push(e)})),r.forEach((function(e){a(e,t,n)}))}}function a(e,t,n){if(!e.closed)switch(t){case"next":return e.next(n);case"error":return e.error(n);case"complete":return e.complete(n)}}function u(e){return e._observer||e._observers&&e._observers.size>0}function c(e){var t=this;this._observer=null,this._observers=null,this._observable=new o((function(n){return function(e,t){!u(e)&&t&&t.start&&t.start()}(t,e),function(e,t){e._observers?e._observers.add(t):e._observer?(e._observers=new Set,e._observers.add(e._observer),e._observers.add(t),e._observer=null):e._observer=t}(t,n),function(){!function(e,t){e._observers?e._observers.delete(t):e._observer===t&&(e._observer=null)}(t,n),function(e,t){!u(e)&&t&&t.pause&&t.pause()}(t,e)}}))}r=c.prototype,i={get observable(){return this._observable},get observed(){return u(this)},next:function(e){s(this,"next",e)},error:function(e){s(this,"error",e)},complete:function(e){s(this,"complete",e)}},Object.keys(i).forEach((function(e){var t=Object.getOwnPropertyDescriptor(i,e);t.enumerable=!1,Object.defineProperty(r,e,t)})),e.exports=c},function(e,t,n){var r=n(106),i=n(107),o=i;o.v1=r,o.v4=i,e.exports=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WebCryptoSha256=t.Ie11Sha256=void 0,(0,n(0).__exportStar)(n(108),t);var r=n(54);Object.defineProperty(t,"Ie11Sha256",{enumerable:!0,get:function(){return r.Sha256}});var i=n(56);Object.defineProperty(t,"WebCryptoSha256",{enumerable:!0,get:function(){return i.Sha256}})},function(e,t,n){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r=n(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,r){void 0===r&&(r=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(n),s=Math.max(i,o),a=0,u=e.map([t,n],(function(t){var n=s-e.getVersionPrecision(t),r=t+new Array(n+1).join(".0");return e.map(r.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(u[0][s]>u[1][s])return 1;if(u[0][s]===u[1][s]){if(s===a)return 0;s-=1}else if(u[0][s]<u[1][s])return-1}},e.map=function(e,t){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n<e.length;n+=1)r.push(t(e[n]));return r},e.find=function(e,t){var n,r;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(n=0,r=e.length;n<r;n+=1){var i=e[n];if(t(i,n))return i}},e.assign=function(e){for(var t,n,r=e,i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];if(Object.assign)return Object.assign.apply(Object,[e].concat(o));var a=function(){var e=o[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){r[t]=e[t]}))};for(t=0,n=o.length;t<n;t+=1)a();return e},e.getBrowserAlias=function(e){return r.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return r.BROWSER_MAP[e]||""},e}();t.default=i,e.exports=t.default},18:function(e,t,n){"use strict";t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(91))&&r.__esModule?r:{default:r},o=n(18);function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var a=function(){function e(){}var t,n;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new i.default(e,t)},e.parse=function(e){return new i.default(e).getResult()},t=e,(n=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}])&&s(t,n),e}();t.default=a,e.exports=t.default},91:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r=u(n(92)),i=u(n(93)),o=u(n(94)),s=u(n(95)),a=u(n(17));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=a.default.find(r.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=a.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=a.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=a.default.find(s.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return a.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,n={},r=0,i={},o=0;if(Object.keys(e).forEach((function(t){var s=e[t];"string"==typeof s?(i[t]=s,o+=1):"object"==typeof s&&(n[t]=s,r+=1)})),r>0){var s=Object.keys(n),u=a.default.find(s,(function(e){return t.isOS(e)}));if(u){var c=this.satisfies(n[u]);if(void 0!==c)return c}var l=a.default.find(s,(function(e){return t.isPlatform(e)}));if(l){var f=this.satisfies(n[l]);if(void 0!==f)return f}}if(o>0){var d=Object.keys(i),h=a.default.find(d,(function(e){return t.isBrowser(e,!0)}));if(void 0!==h)return this.compareVersion(i[h])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),r=e.toLowerCase(),i=a.default.getBrowserTypeByAlias(r);return t&&i&&(r=i.toLowerCase()),r===n},t.compareVersion=function(e){var t=[0],n=e,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(r=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(r=!0,n=e.substr(1)),t.indexOf(a.default.compareVersions(i,n,r))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=c,e.exports=t.default},92:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=s,e.exports=t.default},93:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(t),r={name:o.OS_MAP.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=i.default.getAndroidVersionName(t),r={name:o.OS_MAP.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:o.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=s,e.exports=t.default},94:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=s,e.exports=t.default},95:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=s,e.exports=t.default}})},function(e){e.exports=JSON.parse('{"name":"@aws-sdk/client-cognito-identity","description":"AWS SDK for JavaScript Cognito Identity Client for Node.js, Browser and React Native","version":"3.6.1","scripts":{"clean":"yarn remove-definitions && yarn remove-dist && yarn remove-documentation","build-documentation":"yarn remove-documentation && typedoc ./","prepublishOnly":"yarn build","pretest":"yarn build:cjs","remove-definitions":"rimraf ./types","remove-dist":"rimraf ./dist","remove-documentation":"rimraf ./docs","test:unit":"mocha **/cjs/**/*.spec.js","test:e2e":"mocha **/cjs/**/*.ispec.js && karma start karma.conf.js","test":"yarn test:unit","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig.es.json","build":"yarn build:cjs && yarn build:es","postbuild":"downlevel-dts types types/ts3.4"},"main":"./dist/cjs/index.js","types":"./types/index.d.ts","module":"./dist/es/index.js","browser":{"./runtimeConfig":"./runtimeConfig.browser"},"react-native":{"./runtimeConfig":"./runtimeConfig.native"},"sideEffects":false,"dependencies":{"@aws-crypto/sha256-browser":"^1.0.0","@aws-crypto/sha256-js":"^1.0.0","@aws-sdk/config-resolver":"3.6.1","@aws-sdk/credential-provider-node":"3.6.1","@aws-sdk/fetch-http-handler":"3.6.1","@aws-sdk/hash-node":"3.6.1","@aws-sdk/invalid-dependency":"3.6.1","@aws-sdk/middleware-content-length":"3.6.1","@aws-sdk/middleware-host-header":"3.6.1","@aws-sdk/middleware-logger":"3.6.1","@aws-sdk/middleware-retry":"3.6.1","@aws-sdk/middleware-serde":"3.6.1","@aws-sdk/middleware-signing":"3.6.1","@aws-sdk/middleware-stack":"3.6.1","@aws-sdk/middleware-user-agent":"3.6.1","@aws-sdk/node-config-provider":"3.6.1","@aws-sdk/node-http-handler":"3.6.1","@aws-sdk/protocol-http":"3.6.1","@aws-sdk/smithy-client":"3.6.1","@aws-sdk/types":"3.6.1","@aws-sdk/url-parser":"3.6.1","@aws-sdk/url-parser-native":"3.6.1","@aws-sdk/util-base64-browser":"3.6.1","@aws-sdk/util-base64-node":"3.6.1","@aws-sdk/util-body-length-browser":"3.6.1","@aws-sdk/util-body-length-node":"3.6.1","@aws-sdk/util-user-agent-browser":"3.6.1","@aws-sdk/util-user-agent-node":"3.6.1","@aws-sdk/util-utf8-browser":"3.6.1","@aws-sdk/util-utf8-node":"3.6.1","tslib":"^2.0.0"},"devDependencies":{"@aws-sdk/client-documentation-generator":"3.6.1","@aws-sdk/client-iam":"3.6.1","@types/chai":"^4.2.11","@types/mocha":"^8.0.4","@types/node":"^12.7.5","downlevel-dts":"0.7.0","jest":"^26.1.0","rimraf":"^3.0.0","typedoc":"^0.19.2","typescript":"~4.1.2"},"engines":{"node":">=10.0.0"},"typesVersions":{"<4.0":{"types/*":["types/ts3.4/*"]}},"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-cognito-identity","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"clients/client-cognito-identity"}}')},function(e,t,n){var r;e.exports=(r=n(60),function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,s=t.algo,a=[],u=[];!function(){function t(t){for(var n=e.sqrt(t),r=2;r<=n;r++)if(!(t%r))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var r=2,i=0;i<64;)t(r)&&(i<8&&(a[i]=n(e.pow(r,.5))),u[i]=n(e.pow(r,1/3)),i++),r++}();var c=[],l=s.SHA256=o.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],l=n[5],f=n[6],d=n[7],h=0;h<64;h++){if(h<16)c[h]=0|e[t+h];else{var p=c[h-15],v=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,y=c[h-2],g=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;c[h]=v+c[h-7]+g+c[h-16]}var m=r&i^r&o^i&o,b=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),w=d+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&f)+u[h]+c[h];d=f,f=l,l=a,a=s+w|0,s=o,o=i,i=r,r=w+(b+m)|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+s|0,n[4]=n[4]+a|0,n[5]=n[5]+l|0,n[6]=n[6]+f|0,n[7]=n[7]+d|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),r.SHA256)},function(e,t,n){var r,i,o;e.exports=(o=n(60),i=(r=o).lib.WordArray,r.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp();for(var i=[],o=0;o<n;o+=3)for(var s=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a<n;a++)i.push(r.charAt(s>>>6*(3-a)&63));var u=r.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e){var t=e.length,n=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var o=0;o<n.length;o++)r[n.charCodeAt(o)]=o}var s=n.charAt(64);if(s){var a=e.indexOf(s);-1!==a&&(t=a)}return function(e,t,n){for(var r=[],o=0,s=0;s<t;s++)if(s%4){var a=n[e.charCodeAt(s-1)]<<s%4*2,u=n[e.charCodeAt(s)]>>>6-s%4*2,c=a|u;r[o>>>2]|=c<<24-o%4*8,o++}return i.create(r,o)}(e,t,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},o.enc.Base64)},function(e,t,n){e.exports=n(146).Observable},,,,,,,,,function(e,t,n){var r,i,o=n(45),s=n(46),a=0,u=0;e.exports=function(e,t,n){var c=t&&n||0,l=t||[],f=(e=e||{}).node||r,d=void 0!==e.clockseq?e.clockseq:i;if(null==f||null==d){var h=o();null==f&&(f=r=[1|h[0],h[1],h[2],h[3],h[4],h[5]]),null==d&&(d=i=16383&(h[6]<<8|h[7]))}var p=void 0!==e.msecs?e.msecs:(new Date).getTime(),v=void 0!==e.nsecs?e.nsecs:u+1,y=p-a+(v-u)/1e4;if(y<0&&void 0===e.clockseq&&(d=d+1&16383),(y<0||p>a)&&void 0===e.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=p,u=v,i=d;var g=(1e4*(268435455&(p+=122192928e5))+v)%4294967296;l[c++]=g>>>24&255,l[c++]=g>>>16&255,l[c++]=g>>>8&255,l[c++]=255&g;var m=p/4294967296*1e4&268435455;l[c++]=m>>>8&255,l[c++]=255&m,l[c++]=m>>>24&15|16,l[c++]=m>>>16&255,l[c++]=d>>>8|128,l[c++]=255&d;for(var b=0;b<6;++b)l[c+b]=f[b];return t||s(l)}},function(e,t,n){var r=n(45),i=n(46);e.exports=function(e,t,n){var o=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[o+a]=s[a];return t||i(s)}},function(e,t,n){"use strict";t.byteLength=function(e){var t=c(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=c(e),s=r[0],a=r[1],u=new o(function(e,t,n){return 3*(t+n)/4-n}(0,s,a)),l=0,f=a>0?s-4:s;for(n=0;n<f;n+=4)t=i[e.charCodeAt(n)]<<18|i[e.charCodeAt(n+1)]<<12|i[e.charCodeAt(n+2)]<<6|i[e.charCodeAt(n+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===a&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===a&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=0,a=n-i;s<a;s+=16383)o.push(l(e,s,s+16383>a?a:s+16383));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a<u;++a)r[a]=s[a],i[s.charCodeAt(a)]=a;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var i,o,s=[],a=t;a<n;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){
|
|
78
78
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
79
|
-
t.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,c=u>>1,l=-7,f=n?i-1:0,d=n?-1:1,h=e[t+f];for(f+=d,o=h&(1<<-l)-1,h>>=-l,l+=a;l>0;o=256*o+e[t+f],f+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+e[t+f],f+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,r),o-=c}return(h?-1:1)*s*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var s,a,u,c=8*o-i-1,l=(1<<c)-1,f=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,p=r?1:-1,v=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+f>=1?d/u:d*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*u-1)*Math.pow(2,i),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[n+h]=255&a,h+=p,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[n+h]=255&s,h+=p,s/=256,c-=8);e[n+h-p]|=128*v}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t){},function(e,t){},function(e,t,n){var r,i,o,s;e.exports=(r=n(13),o=(i=r).lib.Base,s=i.enc.Utf8,void(i.algo.HMAC=o.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));var n=e.blockSize,r=4*n;t.sigBytes>r&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),o=this._iKey=t.clone(),a=i.words,u=o.words,c=0;c<n;c++)a[c]^=1549556828,u[c]^=909522486;i.sigBytes=o.sigBytes=r,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,n=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(n))}})))},function(e,t){},function(e,t,n){e.exports=self.fetch||(self.fetch=n(48).default||n(48))},function(e,t,n){e.exports=n(100).Observable},function(e,t,n){"use strict";(function(e){!function(e,t){function n(e){return"function"==typeof Symbol&&Boolean(Symbol[e])}function r(e){return n(e)?Symbol[e]:"@@"+e}function i(e){setTimeout((function(){throw e}))}function o(e,t){var n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function s(e){var t=e.constructor;return void 0!==t&&null===(t=t[r("species")])&&(t=void 0),void 0!==t?t:d}function a(e,t){Object.keys(t).forEach((function(n){var r=Object.getOwnPropertyDescriptor(t,n);r.enumerable=!1,Object.defineProperty(e,n,r)}))}function u(e){var t=e._cleanup;if(t){e._cleanup=void 0;try{t()}catch(e){i(e)}}}function c(e){return void 0===e._observer}function l(e,t){if(Object(e)!==e)throw new TypeError("Observer must be an object");this._cleanup=void 0,this._observer=e;try{var n=o(e,"start");n&&n.call(e,this)}catch(e){i(e)}if(!c(this)){e=new f(this);try{var r=t.call(void 0,e);if(null!=r){if("function"==typeof r.unsubscribe)s=r,r=function(){s.unsubscribe()};else if("function"!=typeof r)throw new TypeError(r+" is not a function");this._cleanup=r}}catch(t){return void e.error(t)}var s;c(this)&&u(this)}}function f(e){this._subscription=e}function d(e){if(!(this instanceof d))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}"function"!=typeof Symbol||Symbol.observable||(Symbol.observable=Symbol("observable")),a(l.prototype={},{get closed(){return c(this)},unsubscribe:function(){var e;c(e=this)||(e._observer=void 0,u(e))}}),a(f.prototype={},{get closed(){return c(this._subscription)},next:function(e){var t=this._subscription;if(!c(t)){var n=t._observer;try{var r=o(n,"next");r&&r.call(n,e)}catch(e){i(e)}}},error:function(e){var t=this._subscription;if(c(t))i(e);else{var n=t._observer;t._observer=void 0;try{var r=o(n,"error");if(!r)throw e;r.call(n,e)}catch(e){i(e)}u(t)}},complete:function(){var e=this._subscription;if(!c(e)){var t=e._observer;e._observer=void 0;try{var n=o(t,"complete");n&&n.call(t)}catch(e){i(e)}u(e)}}}),a(d.prototype,{subscribe:function(e){for(var t=[],n=1;n<arguments.length;++n)t.push(arguments[n]);return"function"==typeof e?e={next:e,error:t[0],complete:t[1]}:"object"==typeof e&&null!==e||(e={}),new l(e,this._subscriber)},forEach:function(e){var t=this;return new Promise((function(n,r){if("function"!=typeof e)return Promise.reject(new TypeError(e+" is not a function"));t.subscribe({_subscription:null,start:function(e){if(Object(e)!==e)throw new TypeError(e+" is not an object");this._subscription=e},next:function(t){var n=this._subscription;if(!n.closed)try{e(t)}catch(e){r(e),n.unsubscribe()}},error:r,complete:n})}))},map:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(s(this))((function(n){return t.subscribe({next:function(t){if(!n.closed){try{t=e(t)}catch(e){return n.error(e)}n.next(t)}},error:function(e){n.error(e)},complete:function(){n.complete()}})}))},filter:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(s(this))((function(n){return t.subscribe({next:function(t){if(!n.closed){try{if(!e(t))return}catch(e){return n.error(e)}n.next(t)}},error:function(e){n.error(e)},complete:function(){n.complete()}})}))},reduce:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=s(this),r=arguments.length>1,i=!1,o=arguments[1],a=o;return new n((function(n){return t.subscribe({next:function(t){if(!n.closed){var o=!i;if(i=!0,!o||r)try{a=e(a,t)}catch(e){return n.error(e)}else a=t}},error:function(e){n.error(e)},complete:function(){if(!i&&!r)return n.error(new TypeError("Cannot reduce an empty sequence"));n.next(a),n.complete()}})}))}}),Object.defineProperty(d.prototype,r("observable"),{value:function(){return this},writable:!0,configurable:!0}),a(d,{from:function(e){var t="function"==typeof this?this:d;if(null==e)throw new TypeError(e+" is not an object");var i=o(e,r("observable"));if(i){var s=i.call(e);if(Object(s)!==s)throw new TypeError(s+" is not an object");return s.constructor===t?s:new t((function(e){return s.subscribe(e)}))}if(n("iterator")&&(i=o(e,r("iterator"))))return new t((function(t){for(var n,r=i.call(e)[Symbol.iterator]();!(n=r.next()).done;){var o=n.value;if(t.next(o),t.closed)return}t.complete()}));if(Array.isArray(e))return new t((function(t){for(var n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}));throw new TypeError(e+" is not observable")},of:function(){for(var e=[],t=0;t<arguments.length;++t)e.push(arguments[t]);var n="function"==typeof this?this:d;return new n((function(t){for(var n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}))}}),Object.defineProperty(d,r("species"),{get:function(){return this},configurable:!0}),Object.defineProperty(d,"extensions",{value:{observableSymbol:r("observable"),setHostReportError:function(e){i=e}}}),e.Observable=d}(t)}).call(this,n(50)(e))},function(e,t,n){(function(e,r){var i;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(o){t&&t.nodeType,e&&e.nodeType;var s="object"==typeof r&&r;s.global!==s&&s.window!==s&&s.self;var a,u=2147483647,c=/^xn--/,l=/[^\x20-\x7E]/,f=/[\x2E\u3002\uFF0E\uFF61]/g,d={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},h=Math.floor,p=String.fromCharCode;function v(e){throw new RangeError(d[e])}function y(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function g(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+y((e=e.replace(f,".")).split("."),t).join(".")}function m(e){for(var t,n,r=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(n=e.charCodeAt(i++)))?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),i--):r.push(t);return r}function b(e){return y(e,(function(e){var t="";return e>65535&&(t+=p((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=p(e)})).join("")}function w(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function S(e,t,n){var r=0;for(e=n?h(e/700):e>>1,e+=h(e/t);e>455;r+=36)e=h(e/35);return h(r+36*e/(e+38))}function _(e){var t,n,r,i,o,s,a,c,l,f,d,p=[],y=e.length,g=0,m=128,w=72;for((n=e.lastIndexOf("-"))<0&&(n=0),r=0;r<n;++r)e.charCodeAt(r)>=128&&v("not-basic"),p.push(e.charCodeAt(r));for(i=n>0?n+1:0;i<y;){for(o=g,s=1,a=36;i>=y&&v("invalid-input"),((c=(d=e.charCodeAt(i++))-48<10?d-22:d-65<26?d-65:d-97<26?d-97:36)>=36||c>h((u-g)/s))&&v("overflow"),g+=c*s,!(c<(l=a<=w?1:a>=w+26?26:a-w));a+=36)s>h(u/(f=36-l))&&v("overflow"),s*=f;w=S(g-o,t=p.length+1,0==o),h(g/t)>u-m&&v("overflow"),m+=h(g/t),g%=t,p.splice(g++,0,m)}return b(p)}function E(e){var t,n,r,i,o,s,a,c,l,f,d,y,g,b,_,E=[];for(y=(e=m(e)).length,t=128,n=0,o=72,s=0;s<y;++s)(d=e[s])<128&&E.push(p(d));for(r=i=E.length,i&&E.push("-");r<y;){for(a=u,s=0;s<y;++s)(d=e[s])>=t&&d<a&&(a=d);for(a-t>h((u-n)/(g=r+1))&&v("overflow"),n+=(a-t)*g,t=a,s=0;s<y;++s)if((d=e[s])<t&&++n>u&&v("overflow"),d==t){for(c=n,l=36;!(c<(f=l<=o?1:l>=o+26?26:l-o));l+=36)_=c-f,b=36-f,E.push(p(w(f+_%b,0))),c=h(_/b);E.push(p(w(c,0))),o=S(n,g,r==i),n=0,++r}++n,++t}return E.join("")}a={version:"1.4.1",ucs2:{decode:m,encode:b},decode:_,encode:E,toASCII:function(e){return g(e,(function(e){return l.test(e)?"xn--"+E(e):e}))},toUnicode:function(e){return g(e,(function(e){return c.test(e)?_(e.slice(4).toLowerCase()):e}))}},void 0===(i=function(){return a}.call(t,n,t,e))||(e.exports=i)}()}).call(this,n(50)(e),n(29))},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){"use strict";t.decode=t.parse=n(104),t.encode=t.stringify=n(105)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,o){t=t||"&",n=n||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var l=0;l<c;++l){var f,d,h,p,v=e[l].replace(a,"%20"),y=v.indexOf(n);y>=0?(f=v.substr(0,y),d=v.substr(y+1)):(f=v,d=""),h=decodeURIComponent(f),p=decodeURIComponent(d),r(s,h)?i(s[h])?s[h].push(p):s[h]=[s[h],p]:s[h]=p}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,a){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),(function(s){var a=encodeURIComponent(r(s))+n;return i(e[s])?o(e[s],(function(e){return a+encodeURIComponent(r(e))})).join(t):a+encodeURIComponent(r(e[s]))})).join(t):a?encodeURIComponent(r(a))+n+encodeURIComponent(r(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t(e[r],r));return n}var s=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}},function(e,t,n){var r,i,o=n(52),s=n(53),a=0,u=0;e.exports=function(e,t,n){var c=t&&n||0,l=t||[],f=(e=e||{}).node||r,d=void 0!==e.clockseq?e.clockseq:i;if(null==f||null==d){var h=o();null==f&&(f=r=[1|h[0],h[1],h[2],h[3],h[4],h[5]]),null==d&&(d=i=16383&(h[6]<<8|h[7]))}var p=void 0!==e.msecs?e.msecs:(new Date).getTime(),v=void 0!==e.nsecs?e.nsecs:u+1,y=p-a+(v-u)/1e4;if(y<0&&void 0===e.clockseq&&(d=d+1&16383),(y<0||p>a)&&void 0===e.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=p,u=v,i=d;var g=(1e4*(268435455&(p+=122192928e5))+v)%4294967296;l[c++]=g>>>24&255,l[c++]=g>>>16&255,l[c++]=g>>>8&255,l[c++]=255&g;var m=p/4294967296*1e4&268435455;l[c++]=m>>>8&255,l[c++]=255&m,l[c++]=m>>>24&15|16,l[c++]=m>>>16&255,l[c++]=d>>>8|128,l[c++]=255&d;for(var b=0;b<6;++b)l[c+b]=f[b];return t||s(l)}},function(e,t,n){var r=n(52),i=n(53);e.exports=function(e,t,n){var o=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[o+a]=s[a];return t||i(s)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(54),i=n(56),o=n(114),s=n(117),a=n(119),u=n(37),c=function(){function e(e){(0,s.supportsWebCrypto)((0,u.locateWindow)())?this.hash=new i.Sha256(e):(0,a.isMsWindow)((0,u.locateWindow)())?this.hash=new r.Sha256(e):this.hash=new o.Sha256(e)}return e.prototype.update=function(e,t){this.hash.update(e,t)},e.prototype.digest=function(){return this.hash.digest()},e}();t.Sha256=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyData=void 0,t.isEmptyData=function(e){return"string"==typeof e?0===e.length:0===e.byteLength}},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.convertToBuffer=void 0;var r=n(149),i=void 0!==e&&e.from?function(t){return e.from(t,"utf8")}:r.fromUtf8;t.convertToBuffer=function(e){return e instanceof Uint8Array?e:"string"==typeof e?i(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}}).call(this,n(6).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyData=void 0,t.isEmptyData=function(e){return"string"==typeof e?0===e.length:0===e.byteLength}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.numToUint8=void 0,t.numToUint8=function(e){return new Uint8Array([(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e])}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint32ArrayFrom=void 0,t.uint32ArrayFrom=function(e){if(!Array.from){for(var t=new Uint32Array(e.length);0<e.length;)t[0]=e[0];return t}return Uint32Array.from(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),(0,n(0).__exportStar)(n(115),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(0),i=n(58),o=n(116),s=n(57),a=function(){function e(e){if(this.hash=new o.RawSha256,e){this.outer=new o.RawSha256;var t=function(e){var t=(0,s.convertToBuffer)(e);if(t.byteLength>i.BLOCK_SIZE){var n=new o.RawSha256;n.update(t),t=n.digest()}var r=new Uint8Array(i.BLOCK_SIZE);return r.set(t),r}(e),n=new Uint8Array(i.BLOCK_SIZE);n.set(t);for(var r=0;r<i.BLOCK_SIZE;r++)t[r]^=54,n[r]^=92;this.hash.update(t),this.outer.update(n);for(r=0;r<t.byteLength;r++)t[r]=0}}return e.prototype.update=function(e){if(!(0,s.isEmptyData)(e)&&!this.error)try{this.hash.update((0,s.convertToBuffer)(e))}catch(e){this.error=e}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return(0,r.__awaiter)(this,void 0,void 0,(function(){return(0,r.__generator)(this,(function(e){return[2,this.digestSync()]}))}))},e}();t.Sha256=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RawSha256=void 0;var r=n(58),i=function(){function e(){this.state=Int32Array.from(r.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,n=e.byteLength;if(this.bytesHashed+=n,8*this.bytesHashed>r.MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[t++],n--,this.bufferLength===r.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=8*this.bytesHashed,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(t.setUint8(this.bufferLength++,128),n%r.BLOCK_SIZE>=r.BLOCK_SIZE-8){for(var i=this.bufferLength;i<r.BLOCK_SIZE;i++)t.setUint8(i,0);this.hashBuffer(),this.bufferLength=0}for(i=this.bufferLength;i<r.BLOCK_SIZE-8;i++)t.setUint8(i,0);t.setUint32(r.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),t.setUint32(r.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}var o=new Uint8Array(r.DIGEST_LENGTH);for(i=0;i<8;i++)o[4*i]=this.state[i]>>>24&255,o[4*i+1]=this.state[i]>>>16&255,o[4*i+2]=this.state[i]>>>8&255,o[4*i+3]=this.state[i]>>>0&255;return o},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],u=t[5],c=t[6],l=t[7],f=0;f<r.BLOCK_SIZE;f++){if(f<16)this.temp[f]=(255&e[4*f])<<24|(255&e[4*f+1])<<16|(255&e[4*f+2])<<8|255&e[4*f+3];else{var d=this.temp[f-2],h=(d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,p=((d=this.temp[f-15])>>>7|d<<25)^(d>>>18|d<<14)^d>>>3;this.temp[f]=(h+this.temp[f-7]|0)+(p+this.temp[f-16]|0)}var v=(((a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7))+(a&u^~a&c)|0)+(l+(r.KEY[f]+this.temp[f]|0)|0)|0,y=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&i^n&o^i&o)|0;l=c,c=u,u=a,a=s+v|0,s=o,o=i,i=n,n=v+y|0}t[0]+=n,t[1]+=i,t[2]+=o,t[3]+=s,t[4]+=a,t[5]+=u,t[6]+=c,t[7]+=l},e}();t.RawSha256=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(0).__exportStar(n(118),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.supportsZeroByteGCM=t.supportsSubtleCrypto=t.supportsSecureRandom=t.supportsWebCrypto=void 0;var r=n(0),i=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function o(e){return"object"==typeof e&&"object"==typeof e.crypto&&"function"==typeof e.crypto.getRandomValues}function s(e){return e&&i.every((function(t){return"function"==typeof e[t]}))}t.supportsWebCrypto=function(e){return!(!o(e)||"object"!=typeof e.crypto.subtle)&&s(e.crypto.subtle)},t.supportsSecureRandom=o,t.supportsSubtleCrypto=s,t.supportsZeroByteGCM=function(e){return r.__awaiter(this,void 0,void 0,(function(){var t;return r.__generator(this,(function(n){switch(n.label){case 0:if(!s(e))return[2,!1];n.label=1;case 1:return n.trys.push([1,4,,5]),[4,e.generateKey({name:"AES-GCM",length:128},!1,["encrypt"])];case 2:return t=n.sent(),[4,e.encrypt({name:"AES-GCM",iv:new Uint8Array(Array(12)),additionalData:new Uint8Array(Array(16)),tagLength:128},t,new Uint8Array(0))];case 3:return[2,16===n.sent().byteLength];case 4:return n.sent(),[2,!1];case 5:return[2]}}))}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0);r.__exportStar(n(120),t),r.__exportStar(n(121),t),r.__exportStar(n(122),t),r.__exportStar(n(123),t),r.__exportStar(n(124),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isMsWindow=void 0;var r=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];t.isMsWindow=function(e){if(function(e){return"MSInputMethodContext"in e&&"msCrypto"in e}(e)&&void 0!==e.msCrypto.subtle){var t=e.msCrypto,n=t.getRandomValues,i=t.subtle;return r.map((function(e){return i[e]})).concat(n).every((function(e){return"function"==typeof e}))}return!1}},function(e,t){},function(e,t,n){"use strict";var r=n(14),i=n(61),o=n(127),s=n(67);function a(e){var t=new o(e),n=i(o.prototype.request,t);return r.extend(n,o.prototype,t),r.extend(n,t),n}var u=a(n(38));u.Axios=o,u.create=function(e){return a(s(u.defaults,e))},u.Cancel=n(68),u.CancelToken=n(141),u.isCancel=n(66),u.all=function(e){return Promise.all(e)},u.spread=n(142),u.isAxiosError=n(143),e.exports=u,e.exports.default=u},function(e,t,n){"use strict";var r=n(14),i=n(62),o=n(128),s=n(129),a=n(67),u=n(139),c=u.validators;function l(e){this.defaults=e,this.interceptors={request:new o,response:new o}}l.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&u.assertOptions(t,{silentJSONParsing:c.transitional(c.boolean,"1.0.0"),forcedJSONParsing:c.transitional(c.boolean,"1.0.0"),clarifyTimeoutError:c.transitional(c.boolean,"1.0.0")},!1);var n=[],r=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(r=r&&t.synchronous,n.unshift(t.fulfilled,t.rejected))}));var i,o=[];if(this.interceptors.response.forEach((function(e){o.push(e.fulfilled,e.rejected)})),!r){var l=[s,void 0];for(Array.prototype.unshift.apply(l,n),l=l.concat(o),i=Promise.resolve(e);l.length;)i=i.then(l.shift(),l.shift());return i}for(var f=e;n.length;){var d=n.shift(),h=n.shift();try{f=d(f)}catch(e){h(e);break}}try{i=s(f)}catch(e){return Promise.reject(e)}for(;o.length;)i=i.then(o.shift(),o.shift());return i},l.prototype.getUri=function(e){return e=a(this.defaults,e),i(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],(function(e){l.prototype[e]=function(t,n){return this.request(a(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(e){l.prototype[e]=function(t,n,r){return this.request(a(r||{},{method:e,url:t,data:n}))}})),e.exports=l},function(e,t,n){"use strict";var r=n(14);function i(){this.handlers=[]}i.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(e){r.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=i},function(e,t,n){"use strict";var r=n(14),i=n(130),o=n(66),s=n(38);function a(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return a(e),e.headers=e.headers||{},e.data=i.call(e,e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||s.adapter)(e).then((function(t){return a(e),t.data=i.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(a(e),t&&t.response&&(t.response.data=i.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,n){"use strict";var r=n(14),i=n(38);e.exports=function(e,t,n){var o=this||i;return r.forEach(n,(function(n){e=n.call(o,e,t)})),e}},function(e,t,n){"use strict";var r=n(14);e.exports=function(e,t){r.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))}},function(e,t,n){"use strict";var r=n(65);e.exports=function(e,t,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},function(e,t,n){"use strict";var r=n(14);e.exports=r.isStandardBrowserEnv()?{write:function(e,t,n,i,o,s){var a=[];a.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(i)&&a.push("path="+i),r.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,n){"use strict";var r=n(135),i=n(136);e.exports=function(e,t){return e&&!r(t)?i(e,t):t}},function(e,t,n){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,n){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";var r=n(14),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,o,s={};return e?(r.forEach(e.split("\n"),(function(e){if(o=e.indexOf(":"),t=r.trim(e.substr(0,o)).toLowerCase(),n=r.trim(e.substr(o+1)),t){if(s[t]&&i.indexOf(t)>=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([n]):s[t]?s[t]+", "+n:n}})),s):s}},function(e,t,n){"use strict";var r=n(14);e.exports=r.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=i(window.location.href),function(t){var n=r.isString(t)?i(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},function(e,t,n){"use strict";var r=n(140),i={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){i[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var o={},s=r.version.split(".");function a(e,t){for(var n=t?t.split("."):s,r=e.split("."),i=0;i<3;i++){if(n[i]>r[i])return!0;if(n[i]<r[i])return!1}return!1}i.transitional=function(e,t,n){var i=t&&a(t);function s(e,t){return"[Axios v"+r.version+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,r,a){if(!1===e)throw new Error(s(r," has been removed in "+t));return i&&!o[r]&&(o[r]=!0,console.warn(s(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,a)}},e.exports={isOlderVersion:a,assertOptions:function(e,t,n){if("object"!=typeof e)throw new TypeError("options must be an object");for(var r=Object.keys(e),i=r.length;i-- >0;){var o=r[i],s=t[o];if(s){var a=e[o],u=void 0===a||s(a,o,e);if(!0!==u)throw new TypeError("option "+o+" must be "+u)}else if(!0!==n)throw Error("Unknown option "+o)}},validators:i}},function(e){e.exports=JSON.parse('{"name":"axios","version":"0.21.4","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://axios-http.com","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.14.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]}')},function(e,t,n){"use strict";var r=n(68);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new r(e),t(n.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var e;return{token:new i((function(t){e=t})),cancel:e}},e.exports=i},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,n){"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(69),o=n(145),s=n(148),a=function(){function e(e){if(this.hash=new o.RawSha256,e){this.outer=new o.RawSha256;var t=function(e){var t=u(e);if(t.byteLength>i.BLOCK_SIZE){var n=new o.RawSha256;n.update(t),t=n.digest()}var r=new Uint8Array(i.BLOCK_SIZE);return r.set(t),r}(e),n=new Uint8Array(i.BLOCK_SIZE);n.set(t);for(var r=0;r<i.BLOCK_SIZE;r++)t[r]^=54,n[r]^=92;this.hash.update(t),this.outer.update(n);for(r=0;r<t.byteLength;r++)t[r]=0}}return e.prototype.update=function(e){if(!function(e){if("string"==typeof e)return 0===e.length;return 0===e.byteLength}(e)&&!this.error)try{this.hash.update(u(e))}catch(e){this.error=e}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.digestSync()]}))}))},e}();function u(e){return"string"==typeof e?s.fromUtf8(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.Sha256=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(69),i=function(){function e(){this.state=Int32Array.from(r.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,n=e.byteLength;if(this.bytesHashed+=n,8*this.bytesHashed>r.MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[t++],n--,this.bufferLength===r.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=8*this.bytesHashed,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(t.setUint8(this.bufferLength++,128),n%r.BLOCK_SIZE>=r.BLOCK_SIZE-8){for(var i=this.bufferLength;i<r.BLOCK_SIZE;i++)t.setUint8(i,0);this.hashBuffer(),this.bufferLength=0}for(i=this.bufferLength;i<r.BLOCK_SIZE-8;i++)t.setUint8(i,0);t.setUint32(r.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),t.setUint32(r.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}var o=new Uint8Array(r.DIGEST_LENGTH);for(i=0;i<8;i++)o[4*i]=this.state[i]>>>24&255,o[4*i+1]=this.state[i]>>>16&255,o[4*i+2]=this.state[i]>>>8&255,o[4*i+3]=this.state[i]>>>0&255;return o},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],u=t[5],c=t[6],l=t[7],f=0;f<r.BLOCK_SIZE;f++){if(f<16)this.temp[f]=(255&e[4*f])<<24|(255&e[4*f+1])<<16|(255&e[4*f+2])<<8|255&e[4*f+3];else{var d=this.temp[f-2],h=(d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,p=((d=this.temp[f-15])>>>7|d<<25)^(d>>>18|d<<14)^d>>>3;this.temp[f]=(h+this.temp[f-7]|0)+(p+this.temp[f-16]|0)}var v=(((a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7))+(a&u^~a&c)|0)+(l+(r.KEY[f]+this.temp[f]|0)|0)|0,y=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&i^n&o^i&o)|0;l=c,c=u,u=a,a=s+v|0,s=o,o=i,i=n,n=v+y|0}t[0]+=n,t[1]+=i,t[2]+=o,t[3]+=s,t[4]+=a,t[5]+=u,t[6]+=c,t[7]+=l},e}();t.RawSha256=i},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}Object.defineProperty(t,"__esModule",{value:!0}),t.Observable=void 0;var s=function(){return"function"==typeof Symbol},a=function(e){return s()&&Boolean(Symbol[e])},u=function(e){return a(e)?Symbol[e]:"@@"+e};s()&&!a("observable")&&(Symbol.observable=Symbol("observable"));var c=u("iterator"),l=u("observable"),f=u("species");function d(e,t){var n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function h(e){var t=e.constructor;return void 0!==t&&null===(t=t[f])&&(t=void 0),void 0!==t?t:E}function p(e){return e instanceof E}function v(e){v.log?v.log(e):setTimeout((function(){throw e}))}function y(e){Promise.resolve().then((function(){try{e()}catch(e){v(e)}}))}function g(e){var t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{var n=d(t,"unsubscribe");n&&n.call(t)}}catch(e){v(e)}}function m(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function b(e,t,n){e._state="running";var r=e._observer;try{var i=d(r,t);switch(t){case"next":i&&i.call(r,n);break;case"error":if(m(e),!i)throw n;i.call(r,n);break;case"complete":m(e),i&&i.call(r)}}catch(e){v(e)}"closed"===e._state?g(e):"running"===e._state&&(e._state="ready")}function w(e,t,n){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:n}],void y((function(){return function(e){var t=e._queue;if(t){e._queue=void 0,e._state="ready";for(var n=0;n<t.length&&(b(e,t[n].type,t[n].value),"closed"!==e._state);++n);}}(e)}))):void b(e,t,n);e._queue.push({type:t,value:n})}}var S=function(){function e(t,n){r(this,e),this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var i=new _(this);try{this._cleanup=n.call(void 0,i)}catch(e){i.error(e)}"initializing"===this._state&&(this._state="ready")}return o(e,[{key:"unsubscribe",value:function(){"closed"!==this._state&&(m(this),g(this))}},{key:"closed",get:function(){return"closed"===this._state}}]),e}(),_=function(){function e(t){r(this,e),this._subscription=t}return o(e,[{key:"next",value:function(e){w(this._subscription,"next",e)}},{key:"error",value:function(e){w(this._subscription,"error",e)}},{key:"complete",value:function(){w(this._subscription,"complete")}},{key:"closed",get:function(){return"closed"===this._subscription._state}}]),e}(),E=function(){function e(t){if(r(this,e),!(this instanceof e))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof t)throw new TypeError("Observable initializer must be a function");this._subscriber=t}return o(e,[{key:"subscribe",value:function(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new S(e,this._subscriber)}},{key:"forEach",value:function(e){var t=this;return new Promise((function(n,r){if("function"==typeof e)var i=t.subscribe({next:function(t){try{e(t,o)}catch(e){r(e),i.unsubscribe()}},error:r,complete:n});else r(new TypeError(e+" is not a function"));function o(){i.unsubscribe(),n()}}))}},{key:"map",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(h(this))((function(n){return t.subscribe({next:function(t){try{t=e(t)}catch(e){return n.error(e)}n.next(t)},error:function(e){n.error(e)},complete:function(){n.complete()}})}))}},{key:"filter",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(h(this))((function(n){return t.subscribe({next:function(t){try{if(!e(t))return}catch(e){return n.error(e)}n.next(t)},error:function(e){n.error(e)},complete:function(){n.complete()}})}))}},{key:"reduce",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=h(this),r=arguments.length>1,i=!1,o=arguments[1],s=o;return new n((function(n){return t.subscribe({next:function(t){var o=!i;if(i=!0,!o||r)try{s=e(s,t)}catch(e){return n.error(e)}else s=t},error:function(e){n.error(e)},complete:function(){if(!i&&!r)return n.error(new TypeError("Cannot reduce an empty sequence"));n.next(s),n.complete()}})}))}},{key:"concat",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=h(this);return new i((function(t){var r,o=0;return function e(s){r=s.subscribe({next:function(e){t.next(e)},error:function(e){t.error(e)},complete:function(){o===n.length?(r=void 0,t.complete()):e(i.from(n[o++]))}})}(e),function(){r&&(r.unsubscribe(),r=void 0)}}))}},{key:"flatMap",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=h(this);return new n((function(r){var i=[],o=t.subscribe({next:function(t){if(e)try{t=e(t)}catch(e){return r.error(e)}var o=n.from(t).subscribe({next:function(e){r.next(e)},error:function(e){r.error(e)},complete:function(){var e=i.indexOf(o);e>=0&&i.splice(e,1),s()}});i.push(o)},error:function(e){r.error(e)},complete:function(){s()}});function s(){o.closed&&0===i.length&&r.complete()}return function(){i.forEach((function(e){return e.unsubscribe()})),o.unsubscribe()}}))}},{key:l,value:function(){return this}}],[{key:"from",value:function(t){var n="function"==typeof this?this:e;if(null==t)throw new TypeError(t+" is not an object");var r=d(t,l);if(r){var i=r.call(t);if(Object(i)!==i)throw new TypeError(i+" is not an object");return p(i)&&i.constructor===n?i:new n((function(e){return i.subscribe(e)}))}if(a("iterator")&&(r=d(t,c)))return new n((function(e){y((function(){if(!e.closed){var n=!0,i=!1,o=void 0;try{for(var s,a=r.call(t)[Symbol.iterator]();!(n=(s=a.next()).done);n=!0){var u=s.value;if(e.next(u),e.closed)return}}catch(e){i=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(i)throw o}}e.complete()}}))}));if(Array.isArray(t))return new n((function(e){y((function(){if(!e.closed){for(var n=0;n<t.length;++n)if(e.next(t[n]),e.closed)return;e.complete()}}))}));throw new TypeError(t+" is not observable")}},{key:"of",value:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i="function"==typeof this?this:e;return new i((function(e){y((function(){if(!e.closed){for(var t=0;t<n.length;++t)if(e.next(n[t]),e.closed)return;e.complete()}}))}))}},{key:f,get:function(){return this}}]),e}();t.Observable=E,s()&&Object.defineProperty(E,Symbol("extensions"),{value:{symbol:l,hostReportError:v},configurable:!0})},function(e,t,n){"use strict";n.r(t),n.d(t,"DataStore",(function(){return or})),n.d(t,"DataStoreClass",(function(){return ir})),n.d(t,"initSchema",(function(){return qn})),n.d(t,"Predicates",(function(){return we.b})),n.d(t,"ModelPredicateCreator",(function(){return we.a})),n.d(t,"ModelSortPredicateCreator",(function(){return Se.a})),n.d(t,"utils",(function(){return sr})),n.d(t,"isSchemaModel",(function(){return fe.v})),n.d(t,"isAssociatedWith",(function(){return fe.k})),n.d(t,"isTargetNameAssociation",(function(){return fe.w})),n.d(t,"isModelAttributeAuth",(function(){return fe.n})),n.d(t,"isModelAttributeKey",(function(){return fe.p})),n.d(t,"isModelAttributePrimaryKey",(function(){return fe.q})),n.d(t,"isModelAttributeCompositeKey",(function(){return fe.o})),n.d(t,"ModelAttributeAuthAllow",(function(){return fe.e})),n.d(t,"ModelAttributeAuthProvider",(function(){return fe.f})),n.d(t,"GraphQLScalarType",(function(){return fe.c})),n.d(t,"isGraphQLScalarType",(function(){return fe.m})),n.d(t,"isModelFieldType",(function(){return fe.r})),n.d(t,"isNonModelFieldType",(function(){return fe.s})),n.d(t,"isEnumFieldType",(function(){return fe.l})),n.d(t,"OpType",(function(){return fe.h})),n.d(t,"isPredicateObj",(function(){return fe.u})),n.d(t,"isPredicateGroup",(function(){return fe.t})),n.d(t,"QueryOne",(function(){return fe.i})),n.d(t,"SortDirection",(function(){return fe.j})),n.d(t,"AuthModeStrategyType",(function(){return fe.a})),n.d(t,"ModelOperation",(function(){return fe.g})),n.d(t,"syncExpression",(function(){return fe.x})),n.d(t,"DISCARD",(function(){return fe.b})),n.d(t,"LimitTimerRaceResolvedValues",(function(){return fe.d}));var r=n(22),i=n(15),o=n(34),s=n(17);function a(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function u(e){return!!e&&!!e[Z]}function c(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===Q}(e)||Array.isArray(e)||!!e[$]||!!e.constructor[$]||y(e)||g(e))}function l(e,t,n){void 0===n&&(n=!1),0===f(e)?(n?Object.keys:X)(e).forEach((function(r){n&&"symbol"==typeof r||t(r,e[r],e)})):e.forEach((function(n,r){return t(r,n,e)}))}function f(e){var t=e[Z];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:y(e)?2:g(e)?3:0}function d(e,t){return 2===f(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function h(e,t){return 2===f(e)?e.get(t):e[t]}function p(e,t,n){var r=f(e);2===r?e.set(t,n):3===r?(e.delete(t),e.add(n)):e[t]=n}function v(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function y(e){return G&&e instanceof Map}function g(e){return W&&e instanceof Set}function m(e){return e.o||e.t}function b(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=ee(e);delete t[Z];for(var n=X(t),r=0;r<n.length;r++){var i=n[r],o=t[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(t[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function w(e,t){return void 0===t&&(t=!1),_(e)||u(e)||!c(e)||(f(e)>1&&(e.set=e.add=e.clear=e.delete=S),Object.freeze(e),t&&l(e,(function(e,t){return w(t,!0)}),!0)),e}function S(){a(2)}function _(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function E(e){var t=te[e];return t||a(18,e),t}function A(e,t){te[e]||(te[e]=t)}function O(){return V}function I(e,t){t&&(E("Patches"),e.u=[],e.s=[],e.v=t)}function T(e){C(e),e.p.forEach(P),e.p=null}function C(e){e===V&&(V=e.l)}function x(e){return V={p:[],l:V,h:e,m:!0,_:0}}function P(e){var t=e[Z];0===t.i||1===t.i?t.j():t.O=!0}function k(e,t){t._=t.p.length;var n=t.p[0],r=void 0!==e&&e!==n;return t.h.g||E("ES5").S(t,e,r),r?(n[Z].P&&(T(t),a(4)),c(e)&&(e=N(t,e),t.l||j(t,e)),t.u&&E("Patches").M(n[Z],e,t.u,t.s)):e=N(t,n,[]),T(t),t.u&&t.v(t.u,t.s),e!==J?e:void 0}function N(e,t,n){if(_(t))return t;var r=t[Z];if(!r)return l(t,(function(i,o){return M(e,r,t,i,o,n)}),!0),t;if(r.A!==e)return t;if(!r.P)return j(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=4===r.i||5===r.i?r.o=b(r.k):r.o;l(3===r.i?new Set(i):i,(function(t,o){return M(e,r,i,t,o,n)})),j(e,i,!1),n&&e.u&&E("Patches").R(r,n,e.u,e.s)}return r.o}function M(e,t,n,r,i,o){if(u(i)){var s=N(e,i,o&&t&&3!==t.i&&!d(t.D,r)?o.concat(r):void 0);if(p(n,r,s),!u(s))return;e.m=!1}if(c(i)&&!_(i)){if(!e.h.F&&e._<1)return;N(e,i),t&&t.A.l||j(e,i)}}function j(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&w(t,n)}function R(e,t){var n=e[Z];return(n?m(n):e)[t]}function D(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function U(e){e.P||(e.P=!0,e.l&&U(e.l))}function F(e){e.o||(e.o=b(e.t))}function L(e,t,n){var r=y(t)?E("MapSet").N(t,n):g(t)?E("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),r={i:n?1:0,A:t?t.A:O(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=r,o=ne;n&&(i=[r],o=re);var s=Proxy.revocable(i,o),a=s.revoke,u=s.proxy;return r.k=u,r.j=a,u}(t,n):E("ES5").J(t,n);return(n?n.A:O()).p.push(r),r}function B(e){return u(e)||a(22,e),function e(t){if(!c(t))return t;var n,r=t[Z],i=f(t);if(r){if(!r.P&&(r.i<4||!E("ES5").K(r)))return r.t;r.I=!0,n=q(t,i),r.I=!1}else n=q(t,i);return l(n,(function(t,i){r&&h(r.t,t)===i||p(n,t,e(i))})),3===i?new Set(n):n}(e)}function q(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return b(e)}function z(){function e(t){if(!c(t))return t;if(Array.isArray(t))return t.map(e);if(y(t))return new Map(Array.from(t.entries()).map((function(t){return[t[0],e(t[1])]})));if(g(t))return new Set(Array.from(t).map(e));var n=Object.create(Object.getPrototypeOf(t));for(var r in t)n[r]=e(t[r]);return d(t,$)&&(n[$]=t[$]),n}function t(t){return u(t)?e(t):t}var n="add";A("Patches",{$:function(t,r){return r.forEach((function(r){for(var i=r.path,o=r.op,s=t,u=0;u<i.length-1;u++){var c=f(s),l=""+i[u];0!==c&&1!==c||"__proto__"!==l&&"constructor"!==l||a(24),"function"==typeof s&&"prototype"===l&&a(24),"object"!=typeof(s=h(s,l))&&a(15,i.join("/"))}var d=f(s),p=e(r.value),v=i[i.length-1];switch(o){case"replace":switch(d){case 2:return s.set(v,p);case 3:a(16);default:return s[v]=p}case n:switch(d){case 1:return s.splice(v,0,p);case 2:return s.set(v,p);case 3:return s.add(p);default:return s[v]=p}case"remove":switch(d){case 1:return s.splice(v,1);case 2:return s.delete(v);case 3:return s.delete(r.value);default:return delete s[v]}default:a(17,o)}})),t},R:function(e,r,i,o){switch(e.i){case 0:case 4:case 2:return function(e,r,i,o){var s=e.t,a=e.o;l(e.D,(function(e,u){var c=h(s,e),l=h(a,e),f=u?d(s,e)?"replace":n:"remove";if(c!==l||"replace"!==f){var p=r.concat(e);i.push("remove"===f?{op:f,path:p}:{op:f,path:p,value:l}),o.push(f===n?{op:"remove",path:p}:"remove"===f?{op:n,path:p,value:t(c)}:{op:"replace",path:p,value:t(c)})}}))}(e,r,i,o);case 5:case 1:return function(e,r,i,o){var s=e.t,a=e.D,u=e.o;if(u.length<s.length){var c=[u,s];s=c[0],u=c[1];var l=[o,i];i=l[0],o=l[1]}for(var f=0;f<s.length;f++)if(a[f]&&u[f]!==s[f]){var d=r.concat([f]);i.push({op:"replace",path:d,value:t(u[f])}),o.push({op:"replace",path:d,value:t(s[f])})}for(var h=s.length;h<u.length;h++){var p=r.concat([h]);i.push({op:n,path:p,value:t(u[h])})}s.length<u.length&&o.push({op:"replace",path:r.concat(["length"]),value:s.length})}(e,r,i,o);case 3:return function(e,t,r,i){var o=e.t,s=e.o,a=0;o.forEach((function(e){if(!s.has(e)){var o=t.concat([a]);r.push({op:"remove",path:o,value:e}),i.unshift({op:n,path:o,value:e})}a++})),a=0,s.forEach((function(e){if(!o.has(e)){var s=t.concat([a]);r.push({op:n,path:s,value:e}),i.unshift({op:"remove",path:s,value:e})}a++}))}(e,r,i,o)}},M:function(e,t,n,r){n.push({op:"replace",path:[],value:t===J?void 0:t}),r.push({op:"replace",path:[],value:e.t})}})}var K,V,H="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),G="undefined"!=typeof Map,W="undefined"!=typeof Set,Y="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,J=H?Symbol.for("immer-nothing"):((K={})["immer-nothing"]=!0,K),$=H?Symbol.for("immer-draftable"):"__$immer_draftable",Z=H?Symbol.for("immer-state"):"__$immer_state",Q=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),X="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,ee=Object.getOwnPropertyDescriptors||function(e){var t={};return X(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},te={},ne={get:function(e,t){if(t===Z)return e;var n=m(e);if(!d(n,t))return function(e,t,n){var r,i=D(t,n);return i?"value"in i?i.value:null===(r=i.get)||void 0===r?void 0:r.call(e.k):void 0}(e,n,t);var r=n[t];return e.I||!c(r)?r:r===R(e.t,t)?(F(e),e.o[t]=L(e.A.h,r,e)):r},has:function(e,t){return t in m(e)},ownKeys:function(e){return Reflect.ownKeys(m(e))},set:function(e,t,n){var r=D(m(e),t);if(null==r?void 0:r.set)return r.set.call(e.k,n),!0;if(!e.P){var i=R(m(e),t),o=null==i?void 0:i[Z];if(o&&o.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(v(n,i)&&(void 0!==n||d(e.t,t)))return!0;F(e),U(e)}return e.o[t]===n&&"number"!=typeof n&&(void 0!==n||t in e.o)||(e.o[t]=n,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==R(e.t,t)||t in e.t?(e.D[t]=!1,F(e),U(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=m(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty:function(){a(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){a(12)}},re={};l(ne,(function(e,t){re[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),re.deleteProperty=function(e,t){return ne.deleteProperty.call(this,e[0],t)},re.set=function(e,t,n){return ne.set.call(this,e[0],t,n,e[0])};var ie=new(function(){function e(e){var t=this;this.g=Y,this.F=!0,this.produce=function(e,n,r){if("function"==typeof e&&"function"!=typeof n){var i=n;n=e;var o=t;return function(e){var t=this;void 0===e&&(e=i);for(var r=arguments.length,s=Array(r>1?r-1:0),a=1;a<r;a++)s[a-1]=arguments[a];return o.produce(e,(function(e){var r;return(r=n).call.apply(r,[t,e].concat(s))}))}}var s;if("function"!=typeof n&&a(6),void 0!==r&&"function"!=typeof r&&a(7),c(e)){var u=x(t),l=L(t,e,void 0),f=!0;try{s=n(l),f=!1}finally{f?T(u):C(u)}return"undefined"!=typeof Promise&&s instanceof Promise?s.then((function(e){return I(u,r),k(e,u)}),(function(e){throw T(u),e})):(I(u,r),k(s,u))}if(!e||"object"!=typeof e){if((s=n(e))===J)return;return void 0===s&&(s=e),t.F&&w(s,!0),s}a(21,e)},this.produceWithPatches=function(e,n){return"function"==typeof e?function(n){for(var r=arguments.length,i=Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(i))}))}:[t.produce(e,n,(function(e,t){r=e,i=t})),r,i];var r,i},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){c(e)||a(8),u(e)&&(e=B(e));var t=x(this),n=L(this,e,void 0);return n[Z].C=!0,C(t),n},t.finishDraft=function(e,t){var n=(e&&e[Z]).A;return I(n,t),k(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!Y&&a(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}var i=E("Patches").$;return u(e)?i(e,t):this.produce(e,(function(e){return i(e,t.slice(n+1))}))},e}()),oe=ie.produce,se=(ie.produceWithPatches.bind(ie),ie.setAutoFreeze.bind(ie)),ae=(ie.setUseProxies.bind(ie),ie.applyPatches.bind(ie),ie.createDraft.bind(ie),ie.finishDraft.bind(ie),n(33)),ue=n(10),ce=n(18),le=n(12),fe=n(1),de=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},he=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},pe=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},ve=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(pe(arguments[t]));return e};function ye(e){return"private"!==e.allow||e.provider?"public"!==e.allow||e.provider?e.provider:fe.f.API_KEY:fe.f.USER_POOLS}function ge(e){var t=e.rules,n=e.currentUser,r=new Set;return t.forEach((function(e){switch(e.allow){case fe.e.CUSTOM:e.provider&&e.provider!==fe.f.FUNCTION||r.add(le.a.AWS_LAMBDA);break;case fe.e.GROUPS:case fe.e.OWNER:n&&(e.provider===fe.f.USER_POOLS?r.add(le.a.AMAZON_COGNITO_USER_POOLS):e.provider===fe.f.OIDC&&r.add(le.a.OPENID_CONNECT));break;case fe.e.PRIVATE:n&&(e.provider&&e.provider!==fe.f.USER_POOLS?e.provider===fe.f.IAM&&r.add(le.a.AWS_IAM):r.add(le.a.AMAZON_COGNITO_USER_POOLS));break;case fe.e.PUBLIC:e.provider===fe.f.IAM?r.add(le.a.AWS_IAM):e.provider&&e.provider!==fe.f.API_KEY||r.add(le.a.API_KEY)}})),Array.from(r)}var me=function(e){var t=e.schema,n=e.modelName;return de(void 0,void 0,void 0,(function(){var e,r,i,o;return he(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,ce.a.currentAuthenticatedUser()];case 1:return e=s.sent(),[3,3];case 2:return s.sent(),[3,3];case 3:return(r=t.namespaces.user.models[n].attributes)&&(i=r.find((function(e){return"auth"===e.type}))).properties&&i.properties.rules?(a=i.properties.rules,u=[fe.e.CUSTOM,fe.e.OWNER,fe.e.GROUPS,fe.e.PRIVATE,fe.e.PUBLIC],c=[fe.f.FUNCTION,fe.f.USER_POOLS,fe.f.OIDC,fe.f.IAM,fe.f.API_KEY],o=ve(a).sort((function(e,t){return e.allow===t.allow?c.indexOf(ye(e))-c.indexOf(ye(t)):u.indexOf(e.allow)-u.indexOf(t.allow)})),[2,ge({currentUser:e,rules:o})]):[2,[]]}var a,u,c}))}))},be=function(){return[]},we=n(4),Se=n(51),_e=function(){function e(){this._queue=[],this._pending=!1}return e.prototype.isLocked=function(){return this._pending},e.prototype.acquire=function(){var e=this,t=new Promise((function(t){return e._queue.push(t)}));return this._pending||this._dispatchNext(),t},e.prototype.runExclusive=function(e){return this.acquire().then((function(t){var n;try{n=e()}catch(e){throw t(),e}return Promise.resolve(n).then((function(e){return t(),e}),(function(e){throw t(),e}))}))},e.prototype._dispatchNext=function(){this._queue.length>0?(this._pending=!0,this._queue.shift()(this._dispatchNext.bind(this))):this._pending=!1},e}(),Ee=n(73),Ae=n.n(Ee),Oe=n(2);let Ie,Te;const Ce=new WeakMap,xe=new WeakMap,Pe=new WeakMap,ke=new WeakMap,Ne=new WeakMap;let Me={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return xe.get(e);if("objectStoreNames"===t)return e.objectStoreNames||Pe.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return De(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function je(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(Te||(Te=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(Ue(this),t),De(Ce.get(this))}:function(...t){return De(e.apply(Ue(this),t))}:function(t,...n){const r=e.call(Ue(this),t,...n);return Pe.set(r,t.sort?t.sort():[t]),De(r)}}function Re(e){return"function"==typeof e?je(e):(e instanceof IDBTransaction&&function(e){if(xe.has(e))return;const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",o),e.removeEventListener("abort",o)},i=()=>{t(),r()},o=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",o),e.addEventListener("abort",o)});xe.set(e,t)}(e),t=e,(Ie||(Ie=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>t instanceof e)?new Proxy(e,Me):e);var t}function De(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",o)},i=()=>{t(De(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",o)});return t.then(t=>{t instanceof IDBCursor&&Ce.set(t,e)}).catch(()=>{}),Ne.set(t,e),t}(e);if(ke.has(e))return ke.get(e);const t=Re(e);return t!==e&&(ke.set(e,t),Ne.set(t,e)),t}const Ue=e=>Ne.get(e);function Fe(e,t,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){const s=indexedDB.open(e,t),a=De(s);return r&&s.addEventListener("upgradeneeded",e=>{r(De(s.result),e.oldVersion,e.newVersion,De(s.transaction))}),n&&s.addEventListener("blocked",()=>n()),a.then(e=>{o&&e.addEventListener("close",()=>o()),i&&e.addEventListener("versionchange",()=>i())}).catch(()=>{}),a}function Le(e,{blocked:t}={}){const n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",()=>t()),De(n).then(()=>{})}const Be=["get","getKey","getAll","getAllKeys","count"],qe=["put","add","delete","clear"],ze=new Map;function Ke(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(ze.get(t))return ze.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=qe.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!Be.includes(n))return;const o=async function(e,...t){const o=this.transaction(e,i?"readwrite":"readonly");let s=o.store;r&&(s=s.index(t.shift()));const a=await s[n](...t);return i&&await o.done,a};return ze.set(t,o),o}function Ve(e){return(Ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Me=(e=>({...e,get:(t,n,r)=>Ke(t,n)||e.get(t,n,r),has:(t,n)=>!!Ke(t,n)||e.has(t,n)}))(Me);var He=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},Ge=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},We=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof Ye?Ye(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}},Ye=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Je=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},$e=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Je(arguments[t]));return e},Ze=new r.a("DataStore"),Qe=new(function(){function e(){this.dbName="amplify-datastore"}return e.prototype.checkPrivate=function(){return He(this,void 0,void 0,(function(){return Ge(this,(function(e){switch(e.label){case 0:return[4,Object(Oe.w)().then((function(e){return e}))];case 1:return e.sent()?(Ze.error("IndexedDB not supported in this browser's private mode"),[2,Promise.reject("IndexedDB not supported in this browser's private mode")]):[2,Promise.resolve()]}}))}))},e.prototype.getStorenameForModel=function(e){var t=this.namespaceResolver(e),n=e.name;return this.getStorename(t,n)},e.prototype.getStorename=function(e,t){return e+"_"+t},e.prototype.setUp=function(e,t,n,r,i){return He(this,void 0,void 0,(function(){var o,s,a=this;return Ge(this,(function(u){switch(u.label){case 0:return[4,this.checkPrivate()];case 1:return u.sent(),this.initPromise?[3,2]:(this.initPromise=new Promise((function(e,t){a.resolve=e,a.reject=t})),[3,4]);case 2:return[4,this.initPromise];case 3:u.sent(),u.label=4;case 4:i&&(this.dbName="amplify-datastore-"+i),this.schema=e,this.namespaceResolver=t,this.modelInstanceCreator=n,this.getModelConstructorByModelName=r,u.label=5;case 5:return u.trys.push([5,8,,9]),this.db?[3,7]:(2,o=this,[4,Fe(this.dbName,2,{upgrade:function(t,n,r,i){return He(a,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h,p,v,y,g=this;return Ge(this,(function(m){switch(m.label){case 0:if(0===n)return Object.keys(e.namespaces).forEach((function(n){var r=e.namespaces[n];Object.keys(r.models).forEach((function(e){var r=g.getStorename(n,e),i=t.createObjectStore(r,{autoIncrement:!0});g.schema.namespaces[n].relationships[e].indexes.forEach((function(e){return i.createIndex(e,e)})),i.createIndex("byId","id",{unique:!0})}))})),[2];if(1!==n||2!==r)return[3,16];m.label=1;case 1:m.trys.push([1,14,,15]),m.label=2;case 2:m.trys.push([2,11,12,13]),o=Ye(i.objectStoreNames),s=o.next(),m.label=3;case 3:return s.done?[3,10]:(a=s.value,u=i.objectStore(a),c="tmp_"+a,u.name=c,(l=t.createObjectStore(a,{keyPath:void 0,autoIncrement:!0})).createIndex("byId","id",{unique:!0}),[4,u.openCursor()]);case 4:f=m.sent(),d=0,m.label=5;case 5:return f&&f.value?[4,l.put(f.value)]:[3,8];case 6:return m.sent(),[4,f.continue()];case 7:return f=m.sent(),d++,[3,5];case 8:t.deleteObjectStore(c),Ze.debug(d+" "+a+" records migrated"),m.label=9;case 9:return s=o.next(),[3,3];case 10:return[3,13];case 11:return h=m.sent(),v={error:h},[3,13];case 12:try{s&&!s.done&&(y=o.return)&&y.call(o)}finally{if(v)throw v.error}return[7];case 13:return[3,15];case 14:throw p=m.sent(),Ze.error("Error migrating IndexedDB data",p),i.abort(),p;case 15:case 16:return[2]}}))}))}})]);case 6:o.db=u.sent(),this.resolve(),u.label=7;case 7:return[3,9];case 8:return s=u.sent(),this.reject(s),[3,9];case 9:return[2]}}))}))},e.prototype._get=function(e,t){return He(this,void 0,void 0,(function(){var n,r;return Ge(this,(function(i){switch(i.label){case 0:return"string"==typeof e?(r=e,n=this.db.transaction(r,"readonly").store.index("byId")):n=e.index("byId"),[4,n.get(t)];case 1:return[2,i.sent()]}}))}))},e.prototype.save=function(e,t){var n,r;return He(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p,v,y,g,m,b,w,S,_,E,A,O,I,T,C,x,P=this;return Ge(this,(function(k){switch(k.label){case 0:return[4,this.checkPrivate()];case 1:return k.sent(),i=Object.getPrototypeOf(e).constructor,o=this.getStorenameForModel(i),s=Object(Oe.A)(i.name,e,this.schema.namespaces[this.namespaceResolver(i)],this.modelInstanceCreator,this.getModelConstructorByModelName),a=this.namespaceResolver(i),u=new Set,c=Object.values(s).map((function(e){var t=e.modelName,n=e.item,r=e.instance,i=P.getStorename(a,t);return u.add(i),{storeName:i,item:n,instance:r}})),l=this.db.transaction($e([o],Array.from(u.values())),"readwrite"),f=l.objectStore(o),[4,this._get(f,e.id)];case 2:if(d=k.sent(),t&&d&&(h=we.a.getPredicates(t),p=h.predicates,v=h.type,!Object(Oe.B)(d,v,p)))throw y="Conditional update failed",Ze.error(y,{model:d,condition:p}),new Error(y);g=[],k.label=3;case 3:k.trys.push([3,11,12,17]),m=We(c),k.label=4;case 4:return[4,m.next()];case 5:return(b=k.sent()).done?[3,10]:(w=b.value,S=w.storeName,_=w.item,E=w.instance,A=l.objectStore(S),O=_.id,[4,this._get(A,O)]);case 6:return I=k.sent(),T=void 0===I?fe.h.INSERT:fe.h.UPDATE,O!==e.id&&T!==fe.h.INSERT?[3,9]:[4,A.index("byId").getKey(_.id)];case 7:return C=k.sent(),[4,A.put(_,C)];case 8:k.sent(),g.push([E,T]),k.label=9;case 9:return[3,4];case 10:return[3,17];case 11:return x=k.sent(),n={error:x},[3,17];case 12:return k.trys.push([12,,15,16]),b&&!b.done&&(r=m.return)?[4,r.call(m)]:[3,14];case 13:k.sent(),k.label=14;case 14:return[3,16];case 15:if(n)throw n.error;return[7];case 16:return[7];case 17:return[4,l.done];case 18:return k.sent(),[2,g]}}))}))},e.prototype.load=function(e,t,n){var r,i,o,s,a,u,c,l,f,d;return He(this,void 0,void 0,(function(){var h,p,v,y,g,m,b,w,S,_,E,A,O,I,T,C,x,P,k,N,M=this;return Ge(this,(function(j){switch(j.label){case 0:if(h=this.schema.namespaces[e],p=h.relationships[t].relationTypes,v=p.map((function(t){var n=t.modelName;return M.getStorename(e,n)})),y=this.getModelConstructorByModelName(e,t),0===v.length)return[2,n.map((function(e){return M.modelInstanceCreator(y,e)}))];g=this.db.transaction($e(v),"readonly"),j.label=1;case 1:j.trys.push([1,34,35,40]),m=We(p),j.label=2;case 2:return[4,m.next()];case 3:if((b=j.sent()).done)return[3,33];switch(w=b.value,S=w.fieldName,_=w.modelName,E=w.targetName,A=this.getStorename(e,_),O=g.objectStore(A),I=this.getModelConstructorByModelName(e,_),w.relationType){case"HAS_ONE":return[3,4];case"BELONGS_TO":return[3,17];case"HAS_MANY":return[3,30]}return[3,31];case 4:j.trys.push([4,10,11,16]),r=We(n),j.label=5;case 5:return[4,r.next()];case 6:return(i=j.sent()).done?[3,9]:(x=i.value,T=x[E]?E:S,x[T]?[4,this._get(O,x[T])]:[3,9]);case 7:P=j.sent(),x[S]=P&&this.modelInstanceCreator(I,P),j.label=8;case 8:return[3,5];case 9:return[3,16];case 10:return C=j.sent(),c={error:C},[3,16];case 11:return j.trys.push([11,,14,15]),i&&!i.done&&(l=r.return)?[4,l.call(r)]:[3,13];case 12:j.sent(),j.label=13;case 13:return[3,15];case 14:if(c)throw c.error;return[7];case 15:return[7];case 16:return[3,32];case 17:j.trys.push([17,23,24,29]),o=We(n),j.label=18;case 18:return[4,o.next()];case 19:return(s=j.sent()).done?[3,22]:(x=s.value)[E]?[4,this._get(O,x[E])]:[3,21];case 20:P=j.sent(),x[S]=P&&this.modelInstanceCreator(I,P),delete x[E],j.label=21;case 21:return[3,18];case 22:return[3,29];case 23:return k=j.sent(),f={error:k},[3,29];case 24:return j.trys.push([24,,27,28]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,26];case 25:j.sent(),j.label=26;case 26:return[3,28];case 27:if(f)throw f.error;return[7];case 28:return[7];case 29:case 30:return[3,32];case 31:return Object(Oe.g)(w.relationType),[3,32];case 32:return[3,2];case 33:return[3,40];case 34:return N=j.sent(),a={error:N},[3,40];case 35:return j.trys.push([35,,38,39]),b&&!b.done&&(u=m.return)?[4,u.call(m)]:[3,37];case 36:j.sent(),j.label=37;case 37:return[3,39];case 38:if(a)throw a.error;return[7];case 39:return[7];case 40:return[2,n.map((function(e){return M.modelInstanceCreator(y,e)}))]}}))}))},e.prototype.query=function(e,t,n){return He(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l=this;return Ge(this,(function(f){switch(f.label){case 0:return[4,this.checkPrivate()];case 1:return f.sent(),r=this.getStorenameForModel(e),i=this.namespaceResolver(e),o=t&&we.a.getPredicates(t),s=o&&this.idFromPredicate(o),a=n&&n.sort,u=n&&n.limit,[4,He(l,void 0,void 0,(function(){var e,t,i;return Ge(this,(function(c){switch(c.label){case 0:return s?[4,this.getById(r,s)]:[3,2];case 1:return[2,(e=c.sent())?[e]:[]];case 2:return o?[4,this.filterOnPredicate(r,o)]:[3,4];case 3:return t=c.sent(),[2,this.inMemoryPagination(t,n)];case 4:return a?[4,this.getAll(r)]:[3,6];case 5:return i=c.sent(),[2,this.inMemoryPagination(i,n)];case 6:return u?[2,this.enginePagination(r,n)]:[2,this.getAll(r)]}}))}))];case 2:return c=f.sent(),[4,this.load(i,e.name,c)];case 3:return[2,f.sent()]}}))}))},e.prototype.getById=function(e,t){return He(this,void 0,void 0,(function(){return Ge(this,(function(n){switch(n.label){case 0:return[4,this._get(e,t)];case 1:return[2,n.sent()]}}))}))},e.prototype.getAll=function(e){return He(this,void 0,void 0,(function(){return Ge(this,(function(t){switch(t.label){case 0:return[4,this.db.getAll(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.idFromPredicate=function(e){var t=e.predicates,n=1===t.length&&t.find((function(e){return Object(fe.u)(e)&&"id"===e.field&&"eq"===e.operator}));return n&&n.operand},e.prototype.filterOnPredicate=function(e,t){return He(this,void 0,void 0,(function(){var n,r,i;return Ge(this,(function(o){switch(o.label){case 0:return n=t.predicates,r=t.type,[4,this.getAll(e)];case 1:return i=o.sent(),[2,n?i.filter((function(e){return Object(Oe.B)(e,r,n)})):i]}}))}))},e.prototype.inMemoryPagination=function(e,t){if(t&&e.length>1){if(t.sort){var n=Se.a.getPredicates(t.sort);if(n.length){var r=Object(Oe.z)(n);e.sort(r)}}var i=t.page,o=void 0===i?0:i,s=t.limit,a=void 0===s?0:s,u=Math.max(0,o*a)||0,c=a>0?u+a:e.length;return e.slice(u,c)}return e},e.prototype.enginePagination=function(e,t){return He(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l;return Ge(this,(function(f){switch(f.label){case 0:return t?(r=t.page,i=void 0===r?0:r,o=t.limit,s=void 0===o?0:o,a=Math.max(0,i*s)||0,[4,this.db.transaction(e).objectStore(e).openCursor()]):[3,7];case 1:return(u=f.sent())&&a>0?[4,u.advance(a)]:[3,3];case 2:f.sent(),f.label=3;case 3:c=[],l="number"==typeof s&&s>0,f.label=4;case 4:return u&&u.value?(c.push(u.value),l&&c.length===s?[3,6]:[4,u.continue()]):[3,6];case 5:return u=f.sent(),[3,4];case 6:return n=c,[3,9];case 7:return[4,this.db.getAll(e)];case 8:n=f.sent(),f.label=9;case 9:return[2,n]}}))}))},e.prototype.queryOne=function(e,t){return void 0===t&&(t=fe.i.FIRST),He(this,void 0,void 0,(function(){var n,r,i;return Ge(this,(function(o){switch(o.label){case 0:return[4,this.checkPrivate()];case 1:return o.sent(),n=this.getStorenameForModel(e),[4,this.db.transaction([n],"readonly").objectStore(n).openCursor(void 0,t===fe.i.FIRST?"next":"prev")];case 2:return r=o.sent(),[2,(i=r?r.value:void 0)&&this.modelInstanceCreator(e,i)]}}))}))},e.prototype.delete=function(e,t){return He(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return Ge(this,(function(g){switch(g.label){case 0:return[4,this.checkPrivate()];case 1:return g.sent(),n=[],Object(Oe.t)(e)?(o=e,s=this.namespaceResolver(o),a=this.getStorenameForModel(o),[4,this.query(o,t)]):[3,9];case 2:return r=g.sent(),v=this.schema.namespaces[s].relationships[o.name].relationTypes,void 0===t?[3,5]:[4,this.deleteTraverse(v,r,o.name,s,n)];case 3:return g.sent(),[4,this.deleteItem(n)];case 4:return g.sent(),y=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[r,y]];case 5:return[4,this.deleteTraverse(v,r,o.name,s,n)];case 6:return g.sent(),[4,this.db.transaction([a],"readwrite").objectStore(a).clear()];case 7:return g.sent(),y=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[r,y]];case 8:return[3,17];case 9:return i=e,o=Object.getPrototypeOf(i).constructor,s=this.namespaceResolver(o),a=this.getStorenameForModel(o),t?(u=this.db.transaction([a],"readwrite"),c=u.objectStore(a),[4,this._get(c,i.id)]):[3,13];case 10:if(void 0===(l=g.sent()))return p="Model instance not found in storage",Ze.warn(p,{model:i}),[2,[[i],[]]];if(f=we.a.getPredicates(t),d=f.predicates,h=f.type,!Object(Oe.B)(l,h,d))throw p="Conditional update failed",Ze.error(p,{model:l,condition:d}),new Error(p);return[4,u.done];case 11:return g.sent(),v=this.schema.namespaces[s].relationships[o.name].relationTypes,[4,this.deleteTraverse(v,[i],o.name,s,n)];case 12:return g.sent(),[3,15];case 13:return v=this.schema.namespaces[s].relationships[o.name].relationTypes,[4,this.deleteTraverse(v,[i],o.name,s,n)];case 14:g.sent(),g.label=15;case 15:return[4,this.deleteItem(n)];case 16:return g.sent(),y=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[[i],y]];case 17:return[2]}}))}))},e.prototype.deleteItem=function(e){var t,n,r,i,o,s;return He(this,void 0,void 0,(function(){var a,u,c,l,f,d,h,p,v,y,g,m;return Ge(this,(function(b){switch(b.label){case 0:a=e.map((function(e){return e.storeName})),u=this.db.transaction($e(a),"readwrite"),b.label=1;case 1:b.trys.push([1,22,23,28]),t=We(e),b.label=2;case 2:return[4,t.next()];case 3:if((n=b.sent()).done)return[3,21];c=n.value,l=c.storeName,f=c.items,d=u.objectStore(l),b.label=4;case 4:b.trys.push([4,14,15,20]),h=We(f),b.label=5;case 5:return[4,h.next()];case 6:return(p=b.sent()).done?[3,13]:(v=p.value)?(y=void 0,"object"!==Ve(v)?[3,8]:[4,d.index("byId").getKey(v.id)]):[3,12];case 7:return y=b.sent(),[3,10];case 8:return[4,d.index("byId").getKey(v.toString())];case 9:y=b.sent(),b.label=10;case 10:return void 0===y?[3,12]:[4,d.delete(y)];case 11:b.sent(),b.label=12;case 12:return[3,5];case 13:return[3,20];case 14:return g=b.sent(),o={error:g},[3,20];case 15:return b.trys.push([15,,18,19]),p&&!p.done&&(s=h.return)?[4,s.call(h)]:[3,17];case 16:b.sent(),b.label=17;case 17:return[3,19];case 18:if(o)throw o.error;return[7];case 19:return[7];case 20:return[3,2];case 21:return[3,28];case 22:return m=b.sent(),r={error:m},[3,28];case 23:return b.trys.push([23,,26,27]),n&&!n.done&&(i=t.return)?[4,i.call(t)]:[3,25];case 24:b.sent(),b.label=25;case 25:return[3,27];case 26:if(r)throw r.error;return[7];case 27:return[7];case 28:return[2]}}))}))},e.prototype.deleteTraverse=function(e,t,n,r,i){var o,s,a,u,c,l,f,d,h,p,v,y;return He(this,void 0,void 0,(function(){var g,m,b,w,S,_,E,A,O,I,T,C,x,P,k=this;return Ge(this,(function(N){switch(N.label){case 0:N.trys.push([0,35,36,41]),o=We(e),N.label=1;case 1:return[4,o.next()];case 2:if((s=N.sent()).done)return[3,34];switch(g=s.value,m=g.relationType,g.fieldName,b=g.modelName,w=g.targetName,S=this.getStorename(r,b),_=Object(Oe.h)(this.schema.namespaces[r].relationships[b].relationTypes,n)||Object(Oe.i)(this.schema.namespaces[r].relationships[b].indexes,g.associatedWith),m){case"HAS_ONE":return[3,3];case"HAS_MANY":return[3,17];case"BELONGS_TO":return[3,31]}return[3,32];case 3:N.trys.push([3,10,11,16]),a=We(t),N.label=4;case 4:return[4,a.next()];case 5:return(u=N.sent()).done?[3,9]:(T=u.value,E=_||"byId",(A=w in T?T[w]:T.id)?[4,this.db.transaction(S,"readwrite").objectStore(S).index(E).get(A)]:[3,9]);case 6:return O=N.sent(),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,O?[O]:[],b,r,i)];case 7:N.sent(),N.label=8;case 8:return[3,4];case 9:return[3,16];case 10:return I=N.sent(),h={error:I},[3,16];case 11:return N.trys.push([11,,14,15]),u&&!u.done&&(p=a.return)?[4,p.call(a)]:[3,13];case 12:N.sent(),N.label=13;case 13:return[3,15];case 14:if(h)throw h.error;return[7];case 15:return[7];case 16:return[3,33];case 17:N.trys.push([17,24,25,30]),c=We(t),N.label=18;case 18:return[4,c.next()];case 19:return(l=N.sent()).done?[3,23]:(T=l.value,[4,this.db.transaction(S,"readwrite").objectStore(S).index(_).getAll(T.id)]);case 20:return C=N.sent(),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,C,b,r,i)];case 21:N.sent(),N.label=22;case 22:return[3,18];case 23:return[3,30];case 24:return x=N.sent(),v={error:x},[3,30];case 25:return N.trys.push([25,,28,29]),l&&!l.done&&(y=c.return)?[4,y.call(c)]:[3,27];case 26:N.sent(),N.label=27;case 27:return[3,29];case 28:if(v)throw v.error;return[7];case 29:return[7];case 30:case 31:return[3,33];case 32:return Object(Oe.g)(m),[3,33];case 33:return[3,1];case 34:return[3,41];case 35:return P=N.sent(),f={error:P},[3,41];case 36:return N.trys.push([36,,39,40]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,38];case 37:N.sent(),N.label=38;case 38:return[3,40];case 39:if(f)throw f.error;return[7];case 40:return[7];case 41:return i.push({storeName:this.getStorename(r,n),items:t.map((function(e){return k.modelInstanceCreator(k.getModelConstructorByModelName(r,n),e)}))}),[2]}}))}))},e.prototype.clear=function(){return He(this,void 0,void 0,(function(){return Ge(this,(function(e){switch(e.label){case 0:return[4,this.checkPrivate()];case 1:return e.sent(),this.db.close(),[4,Le(this.dbName)];case 2:return e.sent(),this.db=void 0,this.initPromise=void 0,[2]}}))}))},e.prototype.batchSave=function(e,t){return He(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h;return Ge(this,(function(p){switch(p.label){case 0:return 0===t.length?[2,[]]:[4,this.checkPrivate()];case 1:p.sent(),n=[],r=this.getStorenameForModel(e),i=this.db.transaction(r,"readwrite"),o=i.store,s=function(t){var r,i,s,u,c;return Ge(this,(function(l){switch(l.label){case 0:return r=Object(Oe.A)(e.name,a.modelInstanceCreator(e,t),a.schema.namespaces[a.namespaceResolver(e)],a.modelInstanceCreator,a.getModelConstructorByModelName),i=t.id,s=t._deleted,[4,o.index("byId").getKey(i)];case 1:return u=l.sent(),s?[3,3]:(c=r.find((function(e){return e.instance.id===i})).instance,n.push([c,u?fe.h.UPDATE:fe.h.INSERT]),[4,o.put(c,u)]);case 2:return l.sent(),[3,5];case 3:return n.push([t,fe.h.DELETE]),u?[4,o.delete(u)]:[3,5];case 4:l.sent(),l.label=5;case 5:return[2]}}))},a=this,p.label=2;case 2:p.trys.push([2,7,8,9]),u=Ye(t),c=u.next(),p.label=3;case 3:return c.done?[3,6]:(l=c.value,[5,s(l)]);case 4:p.sent(),p.label=5;case 5:return c=u.next(),[3,3];case 6:return[3,9];case 7:return f=p.sent(),d={error:f},[3,9];case 8:try{c&&!c.done&&(h=u.return)&&h.call(u)}finally{if(d)throw d.error}return[7];case 9:return[4,i.done];case 10:return p.sent(),[2,n]}}))}))},e}()),Xe=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},et=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},tt=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},nt=function(){var e=this;this.db=new Map,this.getAllKeys=function(){return Xe(e,void 0,void 0,(function(){return et(this,(function(e){return[2,Array.from(this.db.keys())]}))}))},this.multiGet=function(t){return Xe(e,void 0,void 0,(function(){var e=this;return et(this,(function(n){return[2,t.reduce((function(t,n){return t.push([n,e.db.get(n)]),t}),[])]}))}))},this.multiRemove=function(t,n){return Xe(e,void 0,void 0,(function(){var e=this;return et(this,(function(r){return t.forEach((function(t){return e.db.delete(t)})),n(),[2]}))}))},this.multiSet=function(t,n){return Xe(e,void 0,void 0,(function(){var e=this;return et(this,(function(r){return t.forEach((function(t){var n=tt(t,2),r=n[0],i=n[1];e.setItem(r,i)})),n(),[2]}))}))},this.setItem=function(t,n){return Xe(e,void 0,void 0,(function(){return et(this,(function(e){return[2,this.db.set(t,n)]}))}))},this.removeItem=function(t){return Xe(e,void 0,void 0,(function(){return et(this,(function(e){return[2,this.db.delete(t)]}))}))},this.getItem=function(t){return Xe(e,void 0,void 0,(function(){return et(this,(function(e){return[2,this.db.get(t)]}))}))}};var rt=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},it=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},ot=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},st=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},at=new Map,ut=function(){function e(){this._collectionInMemoryIndex=new Map,this.storage=new nt}return e.prototype.getCollectionIndex=function(e){return this._collectionInMemoryIndex.has(e)||this._collectionInMemoryIndex.set(e,new Map),this._collectionInMemoryIndex.get(e)},e.prototype.getMonotonicFactory=function(e){return at.has(e)||at.set(e,Object(Oe.x)()),at.get(e)},e.prototype.init=function(){return rt(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a,u,c,l,f,d,h,p,v,y,g,m,b;return it(this,(function(w){switch(w.label){case 0:return this._collectionInMemoryIndex.clear(),[4,this.storage.getAllKeys()];case 1:e=w.sent(),t=[],w.label=2;case 2:w.trys.push([2,12,13,14]),n=ot(e),r=n.next(),w.label=3;case 3:return r.done?[3,11]:(i=r.value,o=st(i.split("::"),5),s=o[0],a=o[1],u=o[2],c=o[3],l=o[4],"@AmplifyDatastore"!==s?[3,10]:"Data"!==u?[3,9]:(f=void 0,void 0!==l?[3,7]:(d=c,h=this.getMonotonicFactory(a)(),p=this.getLegacyKeyForItem(a,d),v=this.getKeyForItem(a,d,h),[4,this.storage.getItem(p)])));case 4:return y=w.sent(),[4,this.storage.setItem(v,y)];case 5:return w.sent(),[4,this.storage.removeItem(p)];case 6:return w.sent(),f=h,[3,8];case 7:f=c,w.label=8;case 8:return this.getCollectionIndex(a).set(l,f),[3,10];case 9:"Collection"===u&&t.push(i),w.label=10;case 10:return r=n.next(),[3,3];case 11:return[3,14];case 12:return g=w.sent(),m={error:g},[3,14];case 13:try{r&&!r.done&&(b=n.return)&&b.call(n)}finally{if(m)throw m.error}return[7];case 14:return t.length>0?[4,this.storage.multiRemove(t)]:[3,16];case 15:w.sent(),w.label=16;case 16:return[2]}}))}))},e.prototype.save=function(e,t){return rt(this,void 0,void 0,(function(){var n,r;return it(this,(function(i){switch(i.label){case 0:return n=this.getCollectionIndex(t).get(e.id)||this.getMonotonicFactory(t)(),r=this.getKeyForItem(t,e.id,n),this.getCollectionIndex(t).set(e.id,n),[4,this.storage.setItem(r,JSON.stringify(e))];case 1:return i.sent(),[2]}}))}))},e.prototype.batchSave=function(e,t){return rt(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y,g,m,b,w,S,_,E=this;return it(this,(function(A){switch(A.label){case 0:if(0===t.length)return[2,[]];n=[],r=this.getCollectionIndex(e),i=new Set,o=new Set,s=[],a={};try{for(u=ot(t),c=u.next();!c.done;c=u.next())l=c.value,f=l.id,d=l._deleted,h=r.get(f)||this.getMonotonicFactory(e)(),m=this.getKeyForItem(e,f,h),s.push(m),a[m]={ulid:h,model:l},d?i.add(m):o.add(m)}catch(e){b={error:e}}finally{try{c&&!c.done&&(w=u.return)&&w.call(u)}finally{if(b)throw b.error}}return[4,this.storage.multiGet(s)];case 1:return p=A.sent(),v=p.filter((function(e){return!!st(e,2)[1]})).reduce((function(e,t){var n=st(t,1)[0];return e.add(n)}),new Set),[4,new Promise((function(e,t){if(0!==i.size){var n=Array.from(i);n.forEach((function(e){return r.delete(a[e].model.id)})),E.storage.multiRemove(n,(function(n){n&&n.length>0?t(n):e()}))}else e()}))];case 2:return A.sent(),[4,new Promise((function(e,t){if(0!==o.size){var n=Array.from(o).map((function(e){return[e,JSON.stringify(a[e].model)]}));o.forEach((function(e){var t=a[e],n=t.model.id,i=t.ulid;r.set(n,i)})),E.storage.multiSet(n,(function(n){n&&n.length>0?t(n):e()}))}else e()}))];case 3:A.sent();try{for(y=ot(s),g=y.next();!g.done;g=y.next())m=g.value,i.has(m)&&v.has(m)?n.push([a[m].model,fe.h.DELETE]):o.has(m)&&n.push([a[m].model,v.has(m)?fe.h.UPDATE:fe.h.INSERT])}catch(e){S={error:e}}finally{try{g&&!g.done&&(_=y.return)&&_.call(y)}finally{if(S)throw S.error}}return[2,n]}}))}))},e.prototype.get=function(e,t){return rt(this,void 0,void 0,(function(){var n,r,i;return it(this,(function(o){switch(o.label){case 0:return n=this.getCollectionIndex(t).get(e),r=this.getKeyForItem(t,e,n),[4,this.storage.getItem(r)];case 1:return i=o.sent(),[2,i&&JSON.parse(i)]}}))}))},e.prototype.getOne=function(e,t){return rt(this,void 0,void 0,(function(){var n,r,i,o,s,a,u;return it(this,(function(c){switch(c.label){case 0:return n=this.getCollectionIndex(t),r=st(e===fe.i.FIRST?function(){var e,t,r,i,o;try{for(var s=ot(n),a=s.next();!a.done;a=s.next()){i=(r=st(a.value,2))[0],o=r[1];break}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}return[i,o]}():function(){var e,t,r,i,o;try{for(var s=ot(n),a=s.next();!a.done;a=s.next())i=(r=st(a.value,2))[0],o=r[1]}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}return[i,o]}(),2),i=r[0],o=r[1],s=this.getKeyForItem(t,i,o),(u=s)?[4,this.storage.getItem(s)]:[3,2];case 1:u=c.sent(),c.label=2;case 2:return[2,(a=u)&&JSON.parse(a)||void 0]}}))}))},e.prototype.getAll=function(e,t){return rt(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y,g,m,b;return it(this,(function(w){switch(w.label){case 0:n=this.getCollectionIndex(e),i=(r=t||{}).page,o=void 0===i?0:i,s=r.limit,a=void 0===s?0:s,u=Math.max(0,o*a)||0,c=a>0?u+a:void 0,l=[],f=0;try{for(d=ot(n),h=d.next();!h.done&&(p=st(h.value,2),v=p[0],y=p[1],++f<=u||(l.push(this.getKeyForItem(e,v,y)),f!==c));h=d.next());}catch(e){m={error:e}}finally{try{h&&!h.done&&(b=d.return)&&b.call(d)}finally{if(m)throw m.error}}return[4,this.storage.multiGet(l)];case 1:return g=w.sent(),[2,g.filter((function(e){return st(e,2)[1]})).map((function(e){var t=st(e,2)[1];return JSON.parse(t)}))]}}))}))},e.prototype.delete=function(e,t){return rt(this,void 0,void 0,(function(){var n,r;return it(this,(function(i){switch(i.label){case 0:return n=this.getCollectionIndex(t).get(e),r=this.getKeyForItem(t,e,n),this.getCollectionIndex(t).delete(e),[4,this.storage.removeItem(r)];case 1:return i.sent(),[2]}}))}))},e.prototype.clear=function(){return rt(this,void 0,void 0,(function(){var e,t;return it(this,(function(n){switch(n.label){case 0:return[4,this.storage.getAllKeys()];case 1:return e=n.sent(),t=e.filter((function(e){return e.startsWith("@AmplifyDatastore")})),[4,this.storage.multiRemove(t)];case 2:return n.sent(),this._collectionInMemoryIndex.clear(),[2]}}))}))},e.prototype.getKeyForItem=function(e,t,n){return this.getKeyPrefixForStoreItems(e)+"::"+n+"::"+t},e.prototype.getLegacyKeyForItem=function(e,t){return this.getKeyPrefixForStoreItems(e)+"::"+t},e.prototype.getKeyPrefixForStoreItems=function(e){return"@AmplifyDatastore::"+e+"::Data"},e}();function ct(e){return(ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var lt,ft=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},dt=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},ht=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof pt?pt(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}},pt=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},vt=new r.a("DataStore"),yt=new(function(){function e(){}return e.prototype.getStorenameForModel=function(e){var t=this.namespaceResolver(e),n=e.name;return this.getStorename(t,n)},e.prototype.getStorename=function(e,t){return e+"_"+t},e.prototype.setUp=function(e,t,n,r){return ft(this,void 0,void 0,(function(){var i,o=this;return dt(this,(function(s){switch(s.label){case 0:return this.initPromise?[3,1]:(this.initPromise=new Promise((function(e,t){o.resolve=e,o.reject=t})),[3,3]);case 1:return[4,this.initPromise];case 2:return s.sent(),[2];case 3:this.schema=e,this.namespaceResolver=t,this.modelInstanceCreator=n,this.getModelConstructorByModelName=r,s.label=4;case 4:return s.trys.push([4,7,,8]),this.db?[3,6]:(this.db=new ut,[4,this.db.init()]);case 5:s.sent(),this.resolve(),s.label=6;case 6:return[3,8];case 7:return i=s.sent(),this.reject(i),[3,8];case 8:return[2]}}))}))},e.prototype.save=function(e,t){var n,r;return ft(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p,v,y,g,m,b,w,S,_,E,A,O,I=this;return dt(this,(function(T){switch(T.label){case 0:return i=Object.getPrototypeOf(e).constructor,o=this.getStorenameForModel(i),s=Object(Oe.A)(i.name,e,this.schema.namespaces[this.namespaceResolver(i)],this.modelInstanceCreator,this.getModelConstructorByModelName),a=this.namespaceResolver(i),u=new Set,c=Object.values(s).map((function(e){var t=e.modelName,n=e.item,r=e.instance,i=I.getStorename(a,t);return u.add(i),{storeName:i,item:n,instance:r}})),[4,this.db.get(e.id,o)];case 1:if(l=T.sent(),t&&l&&(f=we.a.getPredicates(t),d=f.predicates,h=f.type,!Object(Oe.B)(l,h,d)))throw p="Conditional update failed",vt.error(p,{model:l,condition:d}),new Error(p);v=[],T.label=2;case 2:T.trys.push([2,9,10,15]),y=ht(c),T.label=3;case 3:return[4,y.next()];case 4:return(g=T.sent()).done?[3,8]:(m=g.value,b=m.storeName,w=m.item,S=m.instance,_=w.id,[4,this.db.get(_,b)]);case 5:return E=T.sent(),A=E?fe.h.UPDATE:fe.h.INSERT,_!==e.id&&A!==fe.h.INSERT?[3,7]:[4,this.db.save(w,b)];case 6:T.sent(),v.push([S,A]),T.label=7;case 7:return[3,3];case 8:return[3,15];case 9:return O=T.sent(),n={error:O},[3,15];case 10:return T.trys.push([10,,13,14]),g&&!g.done&&(r=y.return)?[4,r.call(y)]:[3,12];case 11:T.sent(),T.label=12;case 12:return[3,14];case 13:if(n)throw n.error;return[7];case 14:return[7];case 15:return[2,v]}}))}))},e.prototype.load=function(e,t,n){var r,i,o,s,a,u,c,l,f,d;return ft(this,void 0,void 0,(function(){var h,p,v,y,g,m,b,w,S,_,E,A,O,I,T,C,x,P,k,N=this;return dt(this,(function(M){switch(M.label){case 0:if(h=this.schema.namespaces[e],p=h.relationships[t].relationTypes,v=p.map((function(t){var n=t.modelName;return N.getStorename(e,n)})),y=this.getModelConstructorByModelName(e,t),0===v.length)return[2,n.map((function(e){return N.modelInstanceCreator(y,e)}))];M.label=1;case 1:M.trys.push([1,34,35,40]),g=ht(p),M.label=2;case 2:return[4,g.next()];case 3:if((m=M.sent()).done)return[3,33];switch(b=m.value,w=b.fieldName,S=b.modelName,_=b.targetName,E=b.relationType,A=this.getStorename(e,S),O=this.getModelConstructorByModelName(e,S),E){case"HAS_ONE":return[3,4];case"BELONGS_TO":return[3,17];case"HAS_MANY":return[3,30]}return[3,31];case 4:M.trys.push([4,10,11,16]),r=ht(n),M.label=5;case 5:return[4,r.next()];case 6:return(i=M.sent()).done?[3,9]:(C=i.value,I=C[_]?_:w,C[I]?[4,this.db.get(C[I],A)]:[3,9]);case 7:x=M.sent(),C[w]=x&&this.modelInstanceCreator(O,x),M.label=8;case 8:return[3,5];case 9:return[3,16];case 10:return T=M.sent(),c={error:T},[3,16];case 11:return M.trys.push([11,,14,15]),i&&!i.done&&(l=r.return)?[4,l.call(r)]:[3,13];case 12:M.sent(),M.label=13;case 13:return[3,15];case 14:if(c)throw c.error;return[7];case 15:return[7];case 16:return[3,32];case 17:M.trys.push([17,23,24,29]),o=ht(n),M.label=18;case 18:return[4,o.next()];case 19:return(s=M.sent()).done?[3,22]:(C=s.value)[_]?[4,this.db.get(C[_],A)]:[3,21];case 20:x=M.sent(),C[w]=x&&this.modelInstanceCreator(O,x),delete C[_],M.label=21;case 21:return[3,18];case 22:return[3,29];case 23:return P=M.sent(),f={error:P},[3,29];case 24:return M.trys.push([24,,27,28]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,26];case 25:M.sent(),M.label=26;case 26:return[3,28];case 27:if(f)throw f.error;return[7];case 28:return[7];case 29:case 30:return[3,32];case 31:return Object(Oe.g)(E),[3,32];case 32:return[3,2];case 33:return[3,40];case 34:return k=M.sent(),a={error:k},[3,40];case 35:return M.trys.push([35,,38,39]),m&&!m.done&&(u=g.return)?[4,u.call(g)]:[3,37];case 36:M.sent(),M.label=37;case 37:return[3,39];case 38:if(a)throw a.error;return[7];case 39:return[7];case 40:return[2,n.map((function(e){return N.modelInstanceCreator(y,e)}))]}}))}))},e.prototype.query=function(e,t,n){return ft(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l=this;return dt(this,(function(f){switch(f.label){case 0:return r=this.getStorenameForModel(e),i=this.namespaceResolver(e),o=t&&we.a.getPredicates(t),s=o&&this.idFromPredicate(o),a=n&&n.sort,u=n&&n.limit,[4,ft(l,void 0,void 0,(function(){var e,t,i;return dt(this,(function(c){switch(c.label){case 0:return s?[4,this.getById(r,s)]:[3,2];case 1:return[2,(e=c.sent())?[e]:[]];case 2:return o?[4,this.filterOnPredicate(r,o)]:[3,4];case 3:return t=c.sent(),[2,this.inMemoryPagination(t,n)];case 4:return a||u?[4,this.getAll(r)]:[3,6];case 5:return i=c.sent(),[2,this.inMemoryPagination(i,n)];case 6:return[2,this.getAll(r)]}}))}))];case 1:return c=f.sent(),[4,this.load(i,e.name,c)];case 2:return[2,f.sent()]}}))}))},e.prototype.getById=function(e,t){return ft(this,void 0,void 0,(function(){return dt(this,(function(n){switch(n.label){case 0:return[4,this.db.get(t,e)];case 1:return[2,n.sent()]}}))}))},e.prototype.getAll=function(e){return ft(this,void 0,void 0,(function(){return dt(this,(function(t){switch(t.label){case 0:return[4,this.db.getAll(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.idFromPredicate=function(e){var t=e.predicates,n=1===t.length&&t.find((function(e){return Object(fe.u)(e)&&"id"===e.field&&"eq"===e.operator}));return n&&n.operand},e.prototype.filterOnPredicate=function(e,t){return ft(this,void 0,void 0,(function(){var n,r,i;return dt(this,(function(o){switch(o.label){case 0:return n=t.predicates,r=t.type,[4,this.getAll(e)];case 1:return i=o.sent(),[2,n?i.filter((function(e){return Object(Oe.B)(e,r,n)})):i]}}))}))},e.prototype.inMemoryPagination=function(e,t){if(t&&e.length>1){if(t.sort){var n=Se.a.getPredicates(t.sort);if(n.length){var r=Object(Oe.z)(n);e.sort(r)}}var i=t.page,o=void 0===i?0:i,s=t.limit,a=void 0===s?0:s,u=Math.max(0,o*a)||0,c=a>0?u+a:e.length;return e.slice(u,c)}return e},e.prototype.queryOne=function(e,t){return void 0===t&&(t=fe.i.FIRST),ft(this,void 0,void 0,(function(){var n,r;return dt(this,(function(i){switch(i.label){case 0:return n=this.getStorenameForModel(e),[4,this.db.getOne(t,n)];case 1:return[2,(r=i.sent())&&this.modelInstanceCreator(e,r)]}}))}))},e.prototype.delete=function(e,t){return ft(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p;return dt(this,(function(v){switch(v.label){case 0:return n=[],Object(Oe.t)(e)?(o=e,s=this.namespaceResolver(o),[4,this.query(o,t)]):[3,8];case 1:return r=v.sent(),h=this.schema.namespaces[s].relationships[o.name].relationTypes,void 0===t?[3,4]:[4,this.deleteTraverse(h,r,o.name,s,n)];case 2:return v.sent(),[4,this.deleteItem(n)];case 3:return v.sent(),p=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[r,p]];case 4:return[4,this.deleteTraverse(h,r,o.name,s,n)];case 5:return v.sent(),[4,this.deleteItem(n)];case 6:return v.sent(),p=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[r,p]];case 7:return[3,15];case 8:return i=e,o=Object.getPrototypeOf(i).constructor,s=this.namespaceResolver(o),a=this.getStorenameForModel(o),t?[4,this.db.get(i.id,a)]:[3,11];case 9:if(void 0===(u=v.sent()))return d="Model instance not found in storage",vt.warn(d,{model:i}),[2,[[i],[]]];if(c=we.a.getPredicates(t),l=c.predicates,f=c.type,!Object(Oe.B)(u,f,l))throw d="Conditional update failed",vt.error(d,{model:u,condition:l}),new Error(d);return h=this.schema.namespaces[s].relationships[o.name].relationTypes,[4,this.deleteTraverse(h,[i],o.name,s,n)];case 10:return v.sent(),[3,13];case 11:return h=this.schema.namespaces[s].relationships[o.name].relationTypes,[4,this.deleteTraverse(h,[i],o.name,s,n)];case 12:v.sent(),v.label=13;case 13:return[4,this.deleteItem(n)];case 14:return v.sent(),p=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[[i],p]];case 15:return[2]}}))}))},e.prototype.deleteItem=function(e){var t,n,r,i,o,s;return ft(this,void 0,void 0,(function(){var a,u,c,l,f,d,h,p,v;return dt(this,(function(y){switch(y.label){case 0:y.trys.push([0,17,18,23]),t=ht(e),y.label=1;case 1:return[4,t.next()];case 2:if((n=y.sent()).done)return[3,16];a=n.value,u=a.storeName,c=a.items,y.label=3;case 3:y.trys.push([3,9,10,15]),l=ht(c),y.label=4;case 4:return[4,l.next()];case 5:return(f=y.sent()).done?[3,8]:(d=f.value)?"object"!==ct(d)?[3,7]:(h=d.id,[4,this.db.delete(h,u)]):[3,7];case 6:y.sent(),y.label=7;case 7:return[3,4];case 8:return[3,15];case 9:return p=y.sent(),o={error:p},[3,15];case 10:return y.trys.push([10,,13,14]),f&&!f.done&&(s=l.return)?[4,s.call(l)]:[3,12];case 11:y.sent(),y.label=12;case 12:return[3,14];case 13:if(o)throw o.error;return[7];case 14:return[7];case 15:return[3,1];case 16:return[3,23];case 17:return v=y.sent(),r={error:v},[3,23];case 18:return y.trys.push([18,,21,22]),n&&!n.done&&(i=t.return)?[4,i.call(t)]:[3,20];case 19:y.sent(),y.label=20;case 20:return[3,22];case 21:if(r)throw r.error;return[7];case 22:return[7];case 23:return[2]}}))}))},e.prototype.deleteTraverse=function(e,t,n,r,i){var o,s,a,u,c,l,f,d,h,p,v,y;return ft(this,void 0,void 0,(function(){var g,m,b,w,S,_,E,A,O,I,T,C,x,P,k,N=this;return dt(this,(function(M){switch(M.label){case 0:M.trys.push([0,35,36,41]),o=ht(e),M.label=1;case 1:return[4,o.next()];case 2:if((s=M.sent()).done)return[3,34];switch(g=s.value,m=g.relationType,b=g.modelName,w=g.targetName,S=this.getStorename(r,b),_=Object(Oe.h)(this.schema.namespaces[r].relationships[b].relationTypes,n)||Object(Oe.i)(this.schema.namespaces[r].relationships[b].indexes,g.associatedWith),m){case"HAS_ONE":return[3,3];case"HAS_MANY":return[3,17];case"BELONGS_TO":return[3,31]}return[3,32];case 3:M.trys.push([3,10,11,16]),a=ht(t),M.label=4;case 4:return[4,a.next()];case 5:return(u=M.sent()).done?[3,9]:(T=u.value,E=_||"byId",(A=w in T?T[w]:T.id)?[4,this.db.getAll(S)]:[3,9]);case 6:return C=M.sent(),O=C.filter((function(e){return e[E]===A})),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,O,b,r,i)];case 7:M.sent(),M.label=8;case 8:return[3,4];case 9:return[3,16];case 10:return I=M.sent(),h={error:I},[3,16];case 11:return M.trys.push([11,,14,15]),u&&!u.done&&(p=a.return)?[4,p.call(a)]:[3,13];case 12:M.sent(),M.label=13;case 13:return[3,15];case 14:if(h)throw h.error;return[7];case 15:return[7];case 16:return[3,33];case 17:M.trys.push([17,24,25,30]),c=ht(t),M.label=18;case 18:return[4,c.next()];case 19:return(l=M.sent()).done?[3,23]:(T=l.value,[4,this.db.getAll(S)]);case 20:return C=M.sent(),x=C.filter((function(e){return e[_]===T.id})),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,x,b,r,i)];case 21:M.sent(),M.label=22;case 22:return[3,18];case 23:return[3,30];case 24:return P=M.sent(),v={error:P},[3,30];case 25:return M.trys.push([25,,28,29]),l&&!l.done&&(y=c.return)?[4,y.call(c)]:[3,27];case 26:M.sent(),M.label=27;case 27:return[3,29];case 28:if(v)throw v.error;return[7];case 29:return[7];case 30:case 31:return[3,33];case 32:return Object(Oe.g)(m),[3,33];case 33:return[3,1];case 34:return[3,41];case 35:return k=M.sent(),f={error:k},[3,41];case 36:return M.trys.push([36,,39,40]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,38];case 37:M.sent(),M.label=38;case 38:return[3,40];case 39:if(f)throw f.error;return[7];case 40:return[7];case 41:return i.push({storeName:this.getStorename(r,n),items:t.map((function(e){return N.modelInstanceCreator(N.getModelConstructorByModelName(r,n),e)}))}),[2]}}))}))},e.prototype.clear=function(){return ft(this,void 0,void 0,(function(){return dt(this,(function(e){switch(e.label){case 0:return[4,this.db.clear()];case 1:return e.sent(),this.db=void 0,this.initPromise=void 0,[2]}}))}))},e.prototype.batchSave=function(e,t){return ft(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d;return dt(this,(function(h){switch(h.label){case 0:n=e.name,r=this.namespaceResolver(e),i=this.getStorename(r,n),o=[],s=function(t){var n=t.id,r=Object(Oe.A)(e.name,a.modelInstanceCreator(e,t),a.schema.namespaces[a.namespaceResolver(e)],a.modelInstanceCreator,a.getModelConstructorByModelName).find((function(e){return e.instance.id===n})).instance;o.push(r)},a=this;try{for(u=pt(t),c=u.next();!c.done;c=u.next())l=c.value,s(l)}catch(e){f={error:e}}finally{try{c&&!c.done&&(d=u.return)&&d.call(u)}finally{if(f)throw f.error}}return[4,this.db.batchSave(i,o)];case 1:return[2,h.sent()]}}))}))},e}()),gt=function(){return Object(i.b)().isBrowser&&window.indexedDB||Object(i.c)()&&self.indexedDB?Qe:yt},mt=function(){return(mt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},bt=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},wt=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},St=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},_t=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},Et=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},At=new r.a("DataStore"),Ot=function(){function e(e,t,n,r,i,o){this.schema=e,this.namespaceResolver=t,this.getModelConstructorByModelName=n,this.modelInstanceCreator=r,this.adapter=i,this.sessionId=o,this.adapter=this.adapter||gt(),this.pushStream=new Ae.a}return e.getNamespace=function(){return{name:Oe.c,relationships:{},enums:{},models:{},nonModels:{}}},e.prototype.init=function(){return bt(this,void 0,void 0,(function(){var e,t;return wt(this,(function(n){switch(n.label){case 0:return void 0===this.initialized?[3,2]:[4,this.initialized];case 1:return n.sent(),[2];case 2:return At.debug("Starting Storage"),this.initialized=new Promise((function(n,r){e=n,t=r})),this.adapter.setUp(this.schema,this.namespaceResolver,this.modelInstanceCreator,this.getModelConstructorByModelName,this.sessionId).then(e,t),[4,this.initialized];case 3:return n.sent(),[2]}}))}))},e.prototype.save=function(e,t,n,r){return bt(this,void 0,void 0,(function(){var i,o=this;return wt(this,(function(s){switch(s.label){case 0:return[4,this.init()];case 1:return s.sent(),[4,this.adapter.save(e,t)];case 2:return(i=s.sent()).forEach((function(s){var a,u=_t(s,2),c=u[0],l=u[1],f=!!n;if(l===fe.h.UPDATE&&!f&&null===(a=o.getUpdateMutationInput(e,c,r)))return i;var d=a||c,h=Object.getPrototypeOf(c).constructor;o.pushStream.next({model:h,opType:l,element:d,mutator:n,condition:we.a.getPredicates(t,!1)})})),[2,i]}}))}))},e.prototype.delete=function(e,t,n){return bt(this,void 0,void 0,(function(){var r,i,o,s,a=this;return wt(this,(function(u){switch(u.label){case 0:return[4,this.init()];case 1:return u.sent(),[4,this.adapter.delete(e,t)];case 2:return s=_t.apply(void 0,[u.sent(),2]),i=s[0],r=s[1],o=new Set(i.map((function(e){return e.id}))),Object(Oe.t)(e)||Array.isArray(r)||(r=[r]),r.forEach((function(r){var i,s=Object.getPrototypeOf(r).constructor;Object(Oe.t)(e)||(i=o.has(r.id)?we.a.getPredicates(t,!1):void 0),a.pushStream.next({model:s,opType:fe.h.DELETE,element:r,mutator:n,condition:i})})),[2,[i,r]]}}))}))},e.prototype.query=function(e,t,n){return bt(this,void 0,void 0,(function(){return wt(this,(function(r){switch(r.label){case 0:return[4,this.init()];case 1:return r.sent(),[4,this.adapter.query(e,t,n)];case 2:return[2,r.sent()]}}))}))},e.prototype.queryOne=function(e,t){return void 0===t&&(t=fe.i.FIRST),bt(this,void 0,void 0,(function(){return wt(this,(function(n){switch(n.label){case 0:return[4,this.init()];case 1:return n.sent(),[4,this.adapter.queryOne(e,t)];case 2:return[2,n.sent()]}}))}))},e.prototype.observe=function(e,t,n){var r=!e,i=we.a.getPredicates(t,!1)||{},o=i.predicates,s=i.type,a=!!o,u=this.pushStream.observable.filter((function(e){var t=e.mutator;return!n||t!==n})).map((function(e){e.mutator;return St(e,["mutator"])}));return r||(u=u.filter((function(t){var n=t.model,r=t.element;return e===n&&(!a||Object(Oe.B)(r,s,o))}))),u},e.prototype.clear=function(e){return void 0===e&&(e=!0),bt(this,void 0,void 0,(function(){return wt(this,(function(t){switch(t.label){case 0:return this.initialized=void 0,[4,this.adapter.clear()];case 1:return t.sent(),e&&this.pushStream.complete(),[2]}}))}))},e.prototype.batchSave=function(e,t,n){return bt(this,void 0,void 0,(function(){var r,i=this;return wt(this,(function(o){switch(o.label){case 0:return[4,this.init()];case 1:return o.sent(),[4,this.adapter.batchSave(e,t)];case 2:return(r=o.sent()).forEach((function(t){var r=_t(t,2),o=r[0],s=r[1];i.pushStream.next({model:e,opType:s,element:o,mutator:n,condition:void 0})})),[2,r]}}))}))},e.prototype.getUpdateMutationInput=function(e,t,n){var r,i;if(!(n&&n.length))return null;var o=_t(n,2),s=o[0],a=o[1],u={},c=s.map((function(e){return e.path&&e.path[0]})),l=Object.getPrototypeOf(e).constructor,f=this.namespaceResolver(l),d=this.schema.namespaces[f].models[l.name].fields,h=this.schema.namespaces[f].keys[l.name],p=h.primaryKey,v=h.compositeKeys,y=void 0===v?[]:v;if(c.forEach((function(e){var n,r,i,o,s,c=Object(fe.w)(null===(s=d[e])||void 0===s?void 0:s.association)||e;if(!Object(Oe.C)(a[c],t[c])){u[c]=void 0===t[c]?null:t[c];try{for(var l=Et(y),f=l.next();!f.done;f=l.next()){var h=f.value;if(h.has(c))try{for(var p=(i=void 0,Et(h)),v=p.next();!v.done;v=p.next()){var g=v.value;u[g]=t[g]}}catch(e){i={error:e}}finally{try{v&&!v.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}}}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}})),p&&p.length)try{for(var g=Et(p),m=g.next();!m.done;m=g.next()){var b=m.value;u[b]=t[b]}}catch(e){r={error:e}}finally{try{m&&!m.done&&(i=g.return)&&i.call(g)}finally{if(r)throw r.error}}if(0===Object.keys(u).length)return null;var w=t.id,S=t._version,_=t._lastChangedAt,E=t._deleted;return mt(mt({},u),{id:w,_version:S,_lastChangedAt:_,_deleted:E})},e}(),It=function(){function e(e,t,n,r,i,o){this.mutex=new _e,this.storage=new Ot(e,t,n,r,i,o)}return e.prototype.runExclusive=function(e){return this.mutex.runExclusive(e.bind(this,this.storage))},e.prototype.save=function(e,t,n,r){return bt(this,void 0,void 0,(function(){return wt(this,(function(i){return[2,this.runExclusive((function(i){return i.save(e,t,n,r)}))]}))}))},e.prototype.delete=function(e,t,n){return bt(this,void 0,void 0,(function(){return wt(this,(function(r){return[2,this.runExclusive((function(r){if(Object(Oe.t)(e)){var i=e;return r.delete(i,t,n)}var o=e;return r.delete(o,t,n)}))]}))}))},e.prototype.query=function(e,t,n){return bt(this,void 0,void 0,(function(){return wt(this,(function(r){return[2,this.runExclusive((function(r){return r.query(e,t,n)}))]}))}))},e.prototype.queryOne=function(e,t){return void 0===t&&(t=fe.i.FIRST),bt(this,void 0,void 0,(function(){return wt(this,(function(n){return[2,this.runExclusive((function(n){return n.queryOne(e,t)}))]}))}))},e.getNamespace=function(){return Ot.getNamespace()},e.prototype.observe=function(e,t,n){return this.storage.observe(e,t,n)},e.prototype.clear=function(){return bt(this,void 0,void 0,(function(){return wt(this,(function(e){switch(e.label){case 0:return[4,this.storage.clear()];case 1:return e.sent(),[2]}}))}))},e.prototype.batchSave=function(e,t){return this.storage.batchSave(e,t)},e.prototype.init=function(){return bt(this,void 0,void 0,(function(){return wt(this,(function(e){return[2,this.storage.init()]}))}))},e}(),Tt=n(16),Ct=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},xt=(new(function(){function e(){}return e.prototype.networkMonitor=function(t){if(Object(i.b)().isNode)return ue.a.from([{online:!0}]);var n=Object(i.c)()?self:window;return new ue.a((function(t){t.next({online:n.navigator.onLine});var r=function(){return t.next({online:!0})},i=function(){return t.next({online:!1})};return n.addEventListener("online",r),n.addEventListener("offline",i),e._observers.push(t),function(){n.removeEventListener("online",r),n.removeEventListener("offline",i),e._observers=e._observers.filter((function(e){return e!==t}))}}))},e._observerOverride=function(t){var n,r,i=function(n){if(n.closed)return e._observers=e._observers.filter((function(e){return e!==n})),"continue";n.next(t)};try{for(var o=Ct(e._observers),s=o.next();!s.done;s=o.next()){i(s.value)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}},e._observers=[],e}())).networkMonitor(),Pt=function(){return(Pt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},kt=(new r.a("DataStore"),function(){function e(){this.connectionStatus={online:!1}}return e.prototype.status=function(){var e=this;if(this.observer)throw new Error("Subscriber already exists");return new ue.a((function(t){return e.observer=t,e.subscription=xt.subscribe((function(n){var r=n.online;e.connectionStatus.online=r;var i=Pt({},e.connectionStatus);t.next(i)})),function(){clearTimeout(e.timeout),e.unsubscribe()}}))},e.prototype.unsubscribe=function(){this.subscription&&(clearTimeout(this.timeout),this.subscription.unsubscribe())},e.prototype.socketDisconnected=function(){var e=this;this.observer&&"function"==typeof this.observer.next&&(this.observer.next({online:!1}),this.timeout=setTimeout((function(){var t=Pt({},e.connectionStatus);e.observer.next(t)}),5e3))},e}()),Nt=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},Mt=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},jt=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},Rt=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Dt=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(jt(arguments[t]));return e},Ut=function(){function e(e,t){this.outbox=e,this.ownSymbol=t}return e.prototype.merge=function(e,t){return Nt(this,void 0,void 0,(function(){var n,r,i,o,s;return Mt(this,(function(a){switch(a.label){case 0:return[4,this.outbox.getForModel(e,t)];case 1:return r=a.sent(),i=t._deleted,0!==r.length?[3,5]:i?(n=fe.h.DELETE,[4,e.delete(t,void 0,this.ownSymbol)]):[3,3];case 2:return a.sent(),[3,5];case 3:return[4,e.save(t,void 0,this.ownSymbol)];case 4:o=jt.apply(void 0,[a.sent(),1]),s=jt(o[0],2),n=s[1],a.label=5;case 5:return[2,n]}}))}))},e.prototype.mergePage=function(e,t,n){return Nt(this,void 0,void 0,(function(){var r,i,o,s,a,u,c;return Mt(this,(function(l){switch(l.label){case 0:r=new Map;try{for(i=Rt(n),o=i.next();!o.done;o=i.next())s=o.value,r.set(s.id,s)}catch(e){u={error:e}}finally{try{o&&!o.done&&(c=i.return)&&c.call(i)}finally{if(u)throw u.error}}return a=Dt(r.values()),[4,e.batchSave(t,a,this.ownSymbol)];case 1:return[2,l.sent()]}}))}))},e}(),Ft=n(3),Lt=function(){return(Lt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},Bt=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},qt=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},zt=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},Kt=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},Vt=function(){function e(e,t,n,r){this.schema=e,this.MutationEvent=t,this.modelInstanceCreator=n,this.ownSymbol=r}return e.prototype.enqueue=function(e,t){return Bt(this,void 0,void 0,(function(){var n=this;return qt(this,(function(r){return e.runExclusive((function(e){return Bt(n,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f=this;return qt(this,(function(d){switch(d.label){case 0:return n=this.schema.namespaces[Oe.d].models.MutationEvent,r=we.a.createFromExisting(n,(function(e){return e.modelId("eq",t.modelId).id("ne",f.inProgressMutationEventId)})),[4,e.query(this.MutationEvent,r)];case 1:return i=Kt.apply(void 0,[d.sent(),1]),void 0!==(o=i[0])?[3,3]:[4,e.save(t,void 0,this.ownSymbol)];case 2:return d.sent(),[2];case 3:return s=t.operation,o.operation!==Ft.a.CREATE?[3,8]:s!==Ft.a.DELETE?[3,5]:[4,e.delete(this.MutationEvent,r)];case 4:return d.sent(),[3,7];case 5:return a=this.mergeUserFields(o,t),[4,e.save(this.MutationEvent.copyOf(o,(function(e){e.data=a.data})),void 0,this.ownSymbol)];case 6:d.sent(),d.label=7;case 7:return[3,12];case 8:return u=t.condition,c=JSON.parse(u),l=void 0,0!==Object.keys(c).length?[3,10]:(l=this.mergeUserFields(o,t),[4,e.delete(this.MutationEvent,r)]);case 9:d.sent(),d.label=10;case 10:return l=l||t,[4,e.save(l,void 0,this.ownSymbol)];case 11:d.sent(),d.label=12;case 12:return[2]}}))}))})),[2]}))}))},e.prototype.dequeue=function(e,t,n){return Bt(this,void 0,void 0,(function(){var r;return qt(this,(function(i){switch(i.label){case 0:return[4,this.peek(e)];case 1:return r=i.sent(),t?[4,this.syncOutboxVersionsOnDequeue(e,t,r,n)]:[3,3];case 2:i.sent(),i.label=3;case 3:return[4,e.delete(r)];case 4:return i.sent(),this.inProgressMutationEventId=void 0,[2,r]}}))}))},e.prototype.peek=function(e){return Bt(this,void 0,void 0,(function(){var t;return qt(this,(function(n){switch(n.label){case 0:return[4,e.queryOne(this.MutationEvent,fe.i.FIRST)];case 1:return t=n.sent(),this.inProgressMutationEventId=t?t.id:void 0,[2,t]}}))}))},e.prototype.getForModel=function(e,t){return Bt(this,void 0,void 0,(function(){var n;return qt(this,(function(r){switch(r.label){case 0:return n=this.schema.namespaces[Oe.d].models.MutationEvent,[4,e.query(this.MutationEvent,we.a.createFromExisting(n,(function(e){return e.modelId("eq",t.id)})))];case 1:return[2,r.sent()]}}))}))},e.prototype.getModelIds=function(e){return Bt(this,void 0,void 0,(function(){var t,n;return qt(this,(function(r){switch(r.label){case 0:return[4,e.query(this.MutationEvent)];case 1:return t=r.sent(),n=new Set,t.forEach((function(e){var t=e.modelId;return n.add(t)})),[2,n]}}))}))},e.prototype.syncOutboxVersionsOnDequeue=function(e,t,n,r){return Bt(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p,v=this;return qt(this,(function(y){switch(y.label){case 0:return n.operation!==r?[2]:(i=t._version,o=t._lastChangedAt,t._deleted,s=zt(t,["_version","_lastChangedAt","_deleted"]),a=this.removeTimestampFields(n.model,s),(u=JSON.parse(n.data))?(u._version,u._lastChangedAt,u._deleted,c=zt(u,["_version","_lastChangedAt","_deleted"]),l=this.removeTimestampFields(n.model,c),Object(Oe.C)(a,l,!0)?(f=this.schema.namespaces[Oe.d].models.MutationEvent,d=we.a.createFromExisting(f,(function(e){return e.modelId("eq",t.id).id("ne",v.inProgressMutationEventId)})),[4,e.query(this.MutationEvent,d)]):[2]):[2]);case 1:return(h=y.sent()).length?(p=h.map((function(e){var t=JSON.parse(e.data),n=Lt(Lt({},t),{_version:i,_lastChangedAt:o});return v.MutationEvent.copyOf(e,(function(e){e.data=JSON.stringify(n)}))})),[4,e.delete(this.MutationEvent,d)]):[2];case 2:return y.sent(),[4,Promise.all(p.map((function(t){return Bt(v,void 0,void 0,(function(){return qt(this,(function(n){switch(n.label){case 0:return[4,e.save(t,void 0,this.ownSymbol)];case 1:return[2,n.sent()]}}))}))})))];case 3:return y.sent(),[2]}}))}))},e.prototype.mergeUserFields=function(e,t){var n=JSON.parse(e.data),r=n._version,i=n.id,o=n._lastChangedAt,s=n._deleted,a=zt(n,["_version","id","_lastChangedAt","_deleted"]),u=JSON.parse(t.data),c=(u.id,u._version,u._lastChangedAt,u._deleted,zt(u,["id","_version","_lastChangedAt","_deleted"])),l=JSON.stringify(Lt(Lt({id:i,_version:r,_lastChangedAt:o,_deleted:s},a),c));return this.modelInstanceCreator(this.MutationEvent,Lt(Lt({},t),{data:l}))},e.prototype.removeTimestampFields=function(e,t){var n,r,i="createdAt",o="updatedAt",s=null===(n=this.schema.namespaces[Oe.e].models[e].attributes)||void 0===n?void 0:n.find((function(e){return"model"===e.type})),a=null===(r=null==s?void 0:s.properties)||void 0===r?void 0:r.timestamps;return a&&(i=a.createdAt,o=a.updatedAt),delete t[i],delete t[o],t},e}(),Ht=n(21),Gt=n(156),Wt=function(){return(Wt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},Yt=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},Jt=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},$t=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},Zt=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},Qt=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Xt=new r.a("DataStore"),en=function(){function e(e,t,n,r,i,o,s,a,u,c){void 0===s&&(s={}),this.schema=e,this.storage=t,this.userClasses=n,this.outbox=r,this.modelInstanceCreator=i,this.MutationEvent=o,this.amplifyConfig=s,this.authModeStrategy=a,this.conflictHandler=u,this.errorHandler=c,this.typeQuery=new WeakMap,this.processing=!1,this.generateQueries()}return e.prototype.generateQueries=function(){var e=this;Object.values(this.schema.namespaces).forEach((function(t){Object.values(t.models).filter((function(e){return e.syncable})).forEach((function(n){var r=Zt(Object(Ft.b)(t,n,"CREATE"),1)[0],i=Zt(Object(Ft.b)(t,n,"UPDATE"),1)[0],o=Zt(Object(Ft.b)(t,n,"DELETE"),1)[0];e.typeQuery.set(n,[r,i,o])}))}))},e.prototype.isReady=function(){return void 0!==this.observer},e.prototype.start=function(){var e=this;return new ue.a((function(t){return e.observer=t,e.resume(),function(){e.pause()}}))},e.prototype.resume=function(){return Yt(this,void 0,void 0,(function(){var e,t,n,r,i,o=this;return Jt(this,(function(s){switch(s.label){case 0:if(this.processing||!this.isReady())return[2];this.processing=!0,t=Oe.e,n=function(){var n,i,s,a,u,c,l,f,d,h,p,v,y,g,m,b;return Jt(this,(function(w){switch(w.label){case 0:n=e.model,i=e.operation,s=e.data,a=e.condition,u=r.userClasses[n],c=void 0,l=void 0,f=void 0,w.label=1;case 1:return w.trys.push([1,4,,5]),[4,Object(Ft.h)({authModeStrategy:r.authModeStrategy,defaultAuthMode:r.amplifyConfig.aws_appsync_authenticationType,modelName:n,schema:r.schema})];case 2:return d=w.sent(),h=d[i.toUpperCase()],p=0,[4,(v=function(){return Yt(o,void 0,void 0,(function(){var r,o;return Jt(this,(function(c){switch(c.label){case 0:return c.trys.push([0,2,,4]),Xt.debug("Attempting mutation with authMode: "+h[p]),[4,this.jitteredRetry(t,n,i,s,a,u,this.MutationEvent,e,h[p])];case 1:return r=c.sent(),Xt.debug("Mutation sent successfully with authMode: "+h[p]),[2,r];case 2:if(o=c.sent(),++p>=h.length)throw Xt.debug("Mutation failed with authMode: "+h[p-1]),o;return Xt.debug("Mutation failed with authMode: "+h[p-1]+". Retrying with authMode: "+h[p]),[4,v()];case 3:return[2,c.sent()];case 4:return[2]}}))}))})()];case 3:return b=Zt.apply(void 0,[w.sent(),3]),c=b[0],l=b[1],f=b[2],[3,5];case 4:return"Offline"===(y=w.sent()).message||"RetryMutation"===y.message?[2,"continue"]:[3,5];case 5:return void 0!==c?[3,7]:(Xt.debug("done retrying"),[4,r.storage.runExclusive((function(e){return Yt(o,void 0,void 0,(function(){return Jt(this,(function(t){switch(t.label){case 0:return[4,this.outbox.dequeue(e)];case 1:return t.sent(),[2]}}))}))}))]);case 6:return w.sent(),[2,"continue"];case 7:return g=c.data[l],m=!1,[4,r.storage.runExclusive((function(e){return Yt(o,void 0,void 0,(function(){return Jt(this,(function(t){switch(t.label){case 0:return[4,this.outbox.dequeue(e,g,i)];case 1:return t.sent(),[4,this.outbox.peek(e)];case 2:return m=void 0!==t.sent(),[2]}}))}))}))];case 8:return w.sent(),r.observer.next({operation:i,modelDefinition:f,model:g,hasMore:m}),[2]}}))},r=this,s.label=1;case 1:return(i=this.processing)?[4,this.outbox.peek(this.storage)]:[3,3];case 2:i=void 0!==(e=s.sent()),s.label=3;case 3:return i?[5,n()]:[3,5];case 4:return s.sent(),[3,1];case 5:return this.pause(),[2]}}))}))},e.prototype.jitteredRetry=function(e,t,n,r,i,o,s,a,u){return Yt(this,void 0,void 0,(function(){var c=this;return Jt(this,(function(l){switch(l.label){case 0:return[4,Object(Gt.b)((function(t,n,r,i,o,s,a){return Yt(c,void 0,void 0,(function(){var c,l,f,d,h,p,v,y,g,m,b,w,S,_,E,A,O,I,T,C,x,P,k,N,M,j,R;return Jt(this,(function(D){switch(D.label){case 0:return c=Zt(this.createQueryVariables(e,t,n,r,i),5),l=c[0],f=c[1],d=c[2],h=c[3],p=c[4],[4,Object(Ft.i)(u,this.amplifyConfig)];case 1:v=D.sent(),y={query:l,variables:f,authMode:u,authToken:v},g=0,m=this.opTypeFromTransformerOperation(n),D.label=2;case 2:return D.trys.push([2,4,,20]),[4,Ht.a.graphql(y)];case 3:return[2,[D.sent(),h,p]];case 4:if(!((b=D.sent()).errors&&b.errors.length>0))return[3,18];if(w=Zt(b.errors,1),S=w[0],_=S.originalError,E=(void 0===_?{}:_).code,A=void 0===E?null:E,"Unauthorized"===S.errorType)throw new Gt.a("Unauthorized");if("Network Error"===S.message||"ECONNABORTED"===A){if(!this.processing)throw new Gt.a("Offline");throw new Error("Network Error")}return"ConflictUnhandled"!==S.errorType?[3,13]:(g++,O=void 0,g>10?(O=fe.b,[3,8]):[3,5]);case 5:return D.trys.push([5,7,,8]),[4,this.conflictHandler({modelConstructor:o,localModel:this.modelInstanceCreator(o,f.input),remoteModel:this.modelInstanceCreator(o,S.data),operation:m,attempts:g})];case 6:return O=D.sent(),[3,8];case 7:return I=D.sent(),Xt.warn("conflict trycatch",I),[3,20];case 8:return O!==fe.b?[3,11]:(T=Zt(Object(Ft.b)(this.schema.namespaces[e],p,"GET"),1),C=Zt(T[0],3),x=C[1],P=C[2],[4,Object(Ft.i)(u,this.amplifyConfig)]);case 9:return k=D.sent(),[4,Ht.a.graphql({query:P,variables:{id:f.input.id},authMode:u,authToken:k})];case 10:return[2,[D.sent(),x,p]];case 11:return N=this.schema.namespaces[e],M=Object(Ft.d)(N.relationships,p,m,o,O,d,s,this.modelInstanceCreator,a.id),[4,this.storage.save(M)];case 12:throw D.sent(),new Gt.a("RetryMutation");case 13:return D.trys.push([13,15,16,17]),[4,this.errorHandler({localModel:this.modelInstanceCreator(o,f.input),message:S.message,operation:n,errorType:S.errorType,errorInfo:S.errorInfo,remoteModel:S.data?this.modelInstanceCreator(o,S.data):null})];case 14:return D.sent(),[3,17];case 15:return j=D.sent(),Xt.warn("failed to execute errorHandler",j),[3,17];case 16:return[2,S.data?[{data:(R={},R[h]=S.data,R)},h,p]:[]];case 17:return[3,19];case 18:throw new Gt.a(b);case 19:return[3,20];case 20:if(y)return[3,2];D.label=21;case 21:return[2]}}))}))}),[t,n,r,i,o,s,a])];case 1:return[2,l.sent()]}}))}))},e.prototype.createQueryVariables=function(e,t,n,r,i){var o,s,a=this.schema.namespaces[e].models[t],u=this.schema.namespaces[e].keys[t].primaryKey,c=this.typeQuery.get(a),l=Zt(c.find((function(e){return Zt(e,1)[0]===n})),3),f=l[1],d=l[2],h=JSON.parse(r),p=h._version,v=$t(h,["_version"]),y={};if(u&&u.length)try{for(var g=Qt(u),m=g.next();!m.done;m=g.next()){var b=m.value;y[b]=v[b]}}catch(e){o={error:e}}finally{try{m&&!m.done&&(s=g.return)&&s.call(g)}finally{if(o)throw o.error}}else y.id=v.id;var w=n===Ft.a.DELETE?y:Object.values(a.fields).filter((function(e){var t=e.name,r=e.type,i=e.association;return Object(fe.r)(r)?!(!Object(fe.w)(i)||"BELONGS_TO"!==i.connectionType):n!==Ft.a.UPDATE||v.hasOwnProperty(t)})).map((function(e){var t=e.name,n=e.type,r=e.association,i=t,o=v[t];return Object(fe.r)(n)&&Object(fe.w)(r)&&(i=r.targetName,o=v[i]),[i,o]})).reduce((function(e,t){var n=Zt(t,2),r=n[0],i=n[1];return e[r]=i,e}),{}),S=Wt(Wt({},w),{_version:p}),_=JSON.parse(i);return[d,Wt({input:S},n===Ft.a.CREATE?{}:{condition:Object.keys(_).length>0?_:null}),_,f,a]},e.prototype.opTypeFromTransformerOperation=function(e){switch(e){case Ft.a.CREATE:return fe.h.INSERT;case Ft.a.DELETE:return fe.h.DELETE;case Ft.a.UPDATE:return fe.h.UPDATE;case Ft.a.GET:break;default:Object(Oe.g)(e)}},e.prototype.pause=function(){this.processing=!1},e}(),tn=n(44),nn=function(){return(nn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},rn=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},on=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},sn=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},an=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},un={items:[],nextToken:null,startedAt:null},cn=new r.a("DataStore"),ln=function(){function e(e,t,n,r){void 0===n&&(n={}),this.schema=e,this.syncPredicates=t,this.amplifyConfig=n,this.authModeStrategy=r,this.typeQuery=new WeakMap,this.generateQueries()}return e.prototype.generateQueries=function(){var e=this;Object.values(this.schema.namespaces).forEach((function(t){Object.values(t.models).filter((function(e){return e.syncable})).forEach((function(n){var r=sn(Object(Ft.b)(t,n,"LIST"),1),i=sn(r[0]).slice(1);e.typeQuery.set(n,i)}))}))},e.prototype.graphqlFilterFromPredicate=function(e){if(!this.syncPredicates)return null;var t=we.a.getPredicates(this.syncPredicates.get(e),!1);return t?Object(Ft.l)(t):null},e.prototype.retrievePage=function(e,t,n,r,i){return void 0===r&&(r=null),rn(this,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h,p,v,y,g,m=this;return on(this,(function(b){switch(b.label){case 0:return o=sn(this.typeQuery.get(e),2),s=o[0],a=o[1],u={limit:r,nextToken:n,lastSync:t,filter:i},[4,Object(Ft.h)({authModeStrategy:this.authModeStrategy,defaultAuthMode:this.amplifyConfig.aws_appsync_authenticationType,modelName:e.name,schema:this.schema})];case 1:return c=b.sent(),l=c.READ,f=0,[4,(d=function(){return rn(m,void 0,void 0,(function(){var t,n,r,i;return on(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,4]),cn.debug("Attempting sync with authMode: "+l[f]),[4,this.jitteredRetry({query:a,variables:u,opName:s,modelDefinition:e,authMode:l[f]})];case 1:return t=o.sent(),cn.debug("Sync successful with authMode: "+l[f]),[2,t];case 2:if(n=o.sent(),++f>=l.length){if(r=l[f-1],cn.debug("Sync failed with authMode: "+r,n),Object(Ft.f)(n)||Object(Ft.g)(n))return cn.warn("User is unauthorized to query "+s+" with auth mode "+r+". No data could be returned."),[2,{data:(i={},i[s]=un,i)}];throw n}return cn.debug("Sync failed with authMode: "+l[f-1]+". Retrying with authMode: "+l[f]),[4,d()];case 3:return[2,o.sent()];case 4:return[2]}}))}))})()];case 2:return h=b.sent().data,p=h[s],v=p.items,y=p.nextToken,g=p.startedAt,[2,{nextToken:y,startedAt:g,items:v}]}}))}))},e.prototype.partialDataFeatureFlagEnabled=function(){try{var e=sessionStorage.getItem("datastorePartialData");return Boolean(e)}catch(e){return!1}},e.prototype.jitteredRetry=function(e){var t=e.query,n=e.variables,r=e.opName,i=e.modelDefinition,s=e.authMode;return rn(this,void 0,void 0,(function(){var e=this;return on(this,(function(a){switch(a.label){case 0:return[4,Object(Gt.b)((function(t,n){return rn(e,void 0,void 0,(function(){var e,a,u,c,l;return on(this,(function(f){switch(f.label){case 0:return f.trys.push([0,3,,4]),[4,Object(Ft.i)(s,this.amplifyConfig)];case 1:return e=f.sent(),[4,Ht.a.graphql({query:t,variables:n,authMode:s,authToken:e})];case 2:return[2,f.sent()];case 3:if(a=f.sent(),u=Object(Ft.f)(a)||Object(Ft.g)(a))throw new Gt.a(u);if(c=Boolean(a&&a.data&&a.data[r]&&a.data[r].items),this.partialDataFeatureFlagEnabled()){if(c)return(l=a).data[r].items=l.data[r].items.filter((function(e){return null!==e})),a.errors&&o.a.dispatch("datastore",{event:"syncQueriesPartialSyncError",data:{errors:a.errors,modelName:i.name}}),[2,l];throw a}if(a&&a.errors&&a.errors.some((function(e){return"Unauthorized"===e.errorType})))return l=a,c?l.data[r].items=l.data[r].items.filter((function(e){return null!==e})):l.data[r]=nn(nn({},un),l.data[r]),cn.warn("queryError","User is unauthorized to query "+r+", some items could not be returned."),[2,l];throw a;case 4:return[2]}}))}))}),[t,n])];case 1:return[2,a.sent()]}}))}))},e.prototype.start=function(e){var t=this,n=!0,r=this.amplifyConfig,i=r.maxRecordsToSync,o=r.syncPageSize,s=new Map;return new ue.a((function(r){var a=Object.values(t.schema.namespaces).reduce((function(t,n){var r,i;try{for(var o=an(Array.from(n.modelTopologicalOrdering.keys())),s=o.next();!s.done;s=o.next()){var a=s.value,u=e.get(n.models[a]);t.set(n.models[a],u)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return t}),new Map),u=Array.from(a.entries()).filter((function(e){return sn(e,1)[0].syncable})).map((function(e){var a=sn(e,2),u=a[0],c=sn(a[1],2),l=c[0],f=c[1];return rn(t,void 0,void 0,(function(){var e,t,a,c,d,h,p,v,y,g=this;return on(this,(function(m){switch(m.label){case 0:return e=!1,t=null,a=null,c=null,d=0,h=this.graphqlFilterFromPredicate(u),p=this.schema.namespaces[l].modelTopologicalOrdering.get(u.name),v=p.map((function(e){return s.get(l+"_"+e)})),y=new Promise((function(s){return rn(g,void 0,void 0,(function(){var p,y;return on(this,(function(g){switch(g.label){case 0:return[4,Promise.all(v)];case 1:g.sent(),g.label=2;case 2:return n?(p=Math.min(i-d,o),[4,this.retrievePage(u,f,t,p,h)]):[2];case 3:y=g.sent(),c=y.items,t=y.nextToken,a=y.startedAt,d+=c.length,e=null===t||d>=i,r.next({namespace:l,modelDefinition:u,items:c,done:e,startedAt:a,isFullSync:!f}),g.label=4;case 4:if(!e)return[3,2];g.label=5;case 5:return s(),[2]}}))}))})),s.set(l+"_"+u.name,y),[4,y];case 1:return m.sent(),[2]}}))}))}));return Promise.all(u).then((function(){r.complete()})),function(){n=!1}}))},e}(),fn=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},dn=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},hn=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},pn=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},vn=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(hn(arguments[t]));return e},yn=Object(i.b)().isNode,gn=new r.a("DataStore"),mn=Symbol("sync");!function(e){e.SYNC_ENGINE_STORAGE_SUBSCRIBED="storageSubscribed",e.SYNC_ENGINE_SUBSCRIPTIONS_ESTABLISHED="subscriptionsEstablished",e.SYNC_ENGINE_SYNC_QUERIES_STARTED="syncQueriesStarted",e.SYNC_ENGINE_SYNC_QUERIES_READY="syncQueriesReady",e.SYNC_ENGINE_MODEL_SYNCED="modelSynced",e.SYNC_ENGINE_OUTBOX_MUTATION_ENQUEUED="outboxMutationEnqueued",e.SYNC_ENGINE_OUTBOX_MUTATION_PROCESSED="outboxMutationProcessed",e.SYNC_ENGINE_OUTBOX_STATUS="outboxStatus",e.SYNC_ENGINE_NETWORK_STATUS="networkStatus",e.SYNC_ENGINE_READY="ready"}(lt||(lt={}));var bn=function(){function e(e,t,n,r,i,o,s,a,u,c,l){void 0===c&&(c={}),this.schema=e,this.namespaceResolver=t,this.modelClasses=n,this.userModelClasses=r,this.storage=i,this.modelInstanceCreator=o,this.syncPredicates=u,this.amplifyConfig=c,this.authModeStrategy=l,this.online=!1,this.modelSyncedStatus=new WeakMap;var f=this.modelClasses.MutationEvent;this.outbox=new Vt(this.schema,f,o,mn),this.modelMerger=new Ut(this.outbox,mn),this.syncQueriesProcessor=new ln(this.schema,this.syncPredicates,this.amplifyConfig,this.authModeStrategy),this.subscriptionsProcessor=new tn.b(this.schema,this.syncPredicates,this.amplifyConfig,this.authModeStrategy),this.mutationsProcessor=new en(this.schema,this.storage,this.userModelClasses,this.outbox,this.modelInstanceCreator,f,this.amplifyConfig,this.authModeStrategy,s,a),this.datastoreConnectivity=new kt}return e.prototype.getModelSyncedStatus=function(e){return this.modelSyncedStatus.get(e)},e.prototype.start=function(e){var t=this;return new ue.a((function(n){gn.log("starting sync engine...");var r=[];return fn(t,void 0,void 0,(function(){var t,i,o,s=this;return dn(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.setupModels(e)];case 1:return a.sent(),[3,3];case 2:return t=a.sent(),n.error(t),[2];case 3:return i=new Promise((function(e){s.datastoreConnectivity.status().subscribe((function(t){var i=t.online;return fn(s,void 0,void 0,(function(){var t,o,s,a,u,c=this;return dn(this,(function(l){switch(l.label){case 0:return!i||this.online?[3,10]:(this.online=i,n.next({type:lt.SYNC_ENGINE_NETWORK_STATUS,data:{active:this.online}}),o=void 0,yn?(gn.warn("Realtime disabled when in a server-side environment"),[3,6]):[3,1]);case 1:u=hn(this.subscriptionsProcessor.start(),2),t=u[0],o=u[1],l.label=2;case 2:return l.trys.push([2,4,,5]),[4,new Promise((function(e,n){var i=t.subscribe({next:function(t){t===tn.a.CONNECTED&&e()},error:function(e){n(e),c.disconnectionHandler()(e)}});r.push(i)}))];case 3:return l.sent(),[3,5];case 4:return s=l.sent(),n.error(s),[2];case 5:gn.log("Realtime ready"),n.next({type:lt.SYNC_ENGINE_SUBSCRIPTIONS_ESTABLISHED}),l.label=6;case 6:return l.trys.push([6,8,,9]),[4,new Promise((function(e,t){var i=c.syncQueriesObservable().subscribe({next:function(t){t.type===lt.SYNC_ENGINE_SYNC_QUERIES_READY&&e(),n.next(t)},complete:function(){e()},error:function(e){t(e)}});i&&r.push(i)}))];case 7:return l.sent(),[3,9];case 8:return a=l.sent(),n.error(a),[2];case 9:return r.push(this.mutationsProcessor.start().subscribe((function(e){var t=e.modelDefinition,r=e.model,i=e.hasMore,o=c.userModelClasses[t.name],s=c.modelInstanceCreator(o,r);c.storage.runExclusive((function(e){return c.modelMerger.merge(e,s)})),n.next({type:lt.SYNC_ENGINE_OUTBOX_MUTATION_PROCESSED,data:{model:o,element:s}}),n.next({type:lt.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:!i}})}))),yn||r.push(o.subscribe((function(e){var t=hn(e,3),n=(t[0],t[1]),r=t[2],i=c.userModelClasses[n.name],o=c.modelInstanceCreator(i,r);c.storage.runExclusive((function(e){return c.modelMerger.merge(e,o)}))}))),[3,11];case 10:i||(this.online=i,n.next({type:lt.SYNC_ENGINE_NETWORK_STATUS,data:{active:this.online}}),r.forEach((function(e){return e.unsubscribe()})),r=[]),l.label=11;case 11:return e(),[2]}}))}))}))})),this.storage.observe(null,null,mn).filter((function(e){var t=e.model;return!0===s.getModelDefinition(t).syncable})).subscribe({next:function(e){var t=e.opType,r=e.model,o=e.element,a=e.condition;return fn(s,void 0,void 0,(function(){var e,s,u,c;return dn(this,(function(l){switch(l.label){case 0:return e=this.schema.namespaces[this.namespaceResolver(r)],s=this.modelClasses.MutationEvent,u=Object(Ft.k)(a),c=Object(Ft.d)(e.relationships,this.getModelDefinition(r),t,r,o,u,s,this.modelInstanceCreator),[4,this.outbox.enqueue(this.storage,c)];case 1:return l.sent(),n.next({type:lt.SYNC_ENGINE_OUTBOX_MUTATION_ENQUEUED,data:{model:r,element:o}}),n.next({type:lt.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:!1}}),[4,i];case 2:return l.sent(),this.online&&this.mutationsProcessor.resume(),[2]}}))}))}}),n.next({type:lt.SYNC_ENGINE_STORAGE_SUBSCRIBED}),[4,this.outbox.peek(this.storage)];case 4:return o=void 0===a.sent(),n.next({type:lt.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:o}}),[4,i];case 5:return a.sent(),n.next({type:lt.SYNC_ENGINE_READY}),[2]}}))})),function(){r.forEach((function(e){return e.unsubscribe()}))}}))},e.prototype.getModelsMetadataWithNextFullSync=function(e){return fn(this,void 0,void 0,(function(){var t,n=this;return dn(this,(function(r){switch(r.label){case 0:return t=Map.bind,[4,this.getModelsMetadata()];case 1:return[2,new(t.apply(Map,[void 0,r.sent().map((function(t){var r=t.namespace,i=t.model,o=t.lastSync,s=t.lastFullSync,a=t.fullSyncInterval,u=(t.lastSyncPredicate,!s||s+a<e?0:o);return[n.schema.namespaces[r].models[i],[r,u]]}))]))]}}))}))},e.prototype.syncQueriesObservable=function(){var e=this;return this.online?new ue.a((function(t){var n,r;return fn(e,void 0,void 0,(function(){var e,i,o=this;return dn(this,(function(s){switch(s.label){case 0:e=function(){var e,s,a,u,c,l,f,d,h;return dn(this,(function(p){switch(p.label){case 0:return e=new WeakMap,[4,i.getModelsMetadataWithNextFullSync(Date.now())];case 1:return s=p.sent(),a=new Set(s.keys()),[4,new Promise((function(r){n=o.syncQueriesProcessor.start(s).subscribe({next:function(i){var s=i.namespace,h=i.modelDefinition,p=i.items,v=i.done,y=i.startedAt,g=i.isFullSync;return fn(o,void 0,void 0,(function(){var i,o,m,b,w,S,_=this;return dn(this,(function(E){switch(E.label){case 0:return i=this.userModelClasses[h.name],e.has(i)||(e.set(i,{new:0,updated:0,deleted:0}),l=Object(Oe.j)(),d=void 0===d?y:Math.max(d,y)),[4,this.storage.runExclusive((function(t){return fn(_,void 0,void 0,(function(){var n,r,o,s,a,u,c,l,f,d,h,v,y,g,m;return dn(this,(function(b){switch(b.label){case 0:return[4,this.outbox.getModelIds(t)];case 1:n=b.sent(),r=[],o=p.filter((function(e){return!n.has(e.id)||(r.push(e),!1)})),s=[],b.label=2;case 2:b.trys.push([2,7,8,9]),a=pn(r),u=a.next(),b.label=3;case 3:return u.done?[3,6]:(c=u.value,[4,this.modelMerger.merge(t,c)]);case 4:void 0!==(l=b.sent())&&s.push([c,l]),b.label=5;case 5:return u=a.next(),[3,3];case 6:return[3,9];case 7:return f=b.sent(),g={error:f},[3,9];case 8:try{u&&!u.done&&(m=a.return)&&m.call(a)}finally{if(g)throw g.error}return[7];case 9:return h=(d=s.push).apply,v=[s],[4,this.modelMerger.mergePage(t,i,o)];case 10:return h.apply(d,v.concat([vn.apply(void 0,[b.sent()])])),y=e.get(i),s.forEach((function(e){var t=hn(e,2)[1];switch(t){case fe.h.INSERT:y.new++;break;case fe.h.UPDATE:y.updated++;break;case fe.h.DELETE:y.deleted++;break;default:Object(Oe.g)(t)}})),[2]}}))}))}))];case 1:return E.sent(),v?(o=h.name,[4,this.getModelMetadata(s,o)]):[3,4];case 2:return m=E.sent(),b=m.lastFullSync,w=m.fullSyncInterval,c=w,u=void 0===u?b:Math.max(u,g?y:b),m=this.modelClasses.ModelMetadata.copyOf(m,(function(e){e.lastSync=y,e.lastFullSync=g?y:m.lastFullSync})),[4,this.storage.save(m,void 0,mn)];case 3:E.sent(),S=e.get(i),this.modelSyncedStatus.set(i,!0),t.next({type:lt.SYNC_ENGINE_MODEL_SYNCED,data:{model:i,isFullSync:g,isDeltaSync:!g,counts:S}}),a.delete(h),0===a.size&&(f=Object(Oe.j)()-l,r(),t.next({type:lt.SYNC_ENGINE_SYNC_QUERIES_READY}),n.unsubscribe()),E.label=4;case 4:return[2]}}))}))},error:function(e){t.error(e)}}),t.next({type:lt.SYNC_ENGINE_SYNC_QUERIES_STARTED,data:{models:Array.from(a).map((function(e){return e.name}))}})}))];case 2:return p.sent(),h=u+c-(d+f),gn.debug("Next fullSync in "+h/1e3+" seconds. ("+new Date(Date.now()+h)+")"),[4,new Promise((function(e){r=setTimeout(e,h)}))];case 3:return p.sent(),[2]}}))},i=this,s.label=1;case 1:return t.closed?[3,3]:[5,e()];case 2:return s.sent(),[3,1];case 3:return[2]}}))})),function(){n&&n.unsubscribe(),r&&clearTimeout(r)}})):ue.a.of()},e.prototype.disconnectionHandler=function(){var e=this;return function(t){Tt.CONTROL_MSG.CONNECTION_CLOSED!==t&&Tt.CONTROL_MSG.TIMEOUT_DISCONNECT!==t||e.datastoreConnectivity.socketDisconnected()}},e.prototype.unsubscribeConnectivity=function(){this.datastoreConnectivity.unsubscribe()},e.prototype.setupModels=function(e){return fn(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,f,d,h,p=this;return dn(this,(function(v){switch(v.label){case 0:t=e.fullSyncInterval,n=this.modelClasses.ModelMetadata,r=[],Object.values(this.schema.namespaces).forEach((function(e){Object.values(e.models).filter((function(e){return e.syncable})).forEach((function(t){if(r.push([e.name,t]),e.name===Oe.e){var n=p.userModelClasses[t.name];p.modelSyncedStatus.set(n,!1)}}))})),o=r.map((function(e){var r=hn(e,2),o=r[0],s=r[1];return fn(p,void 0,void 0,(function(){var e,r,a,u,c,l,f,d,h;return dn(this,(function(p){switch(p.label){case 0:return[4,this.getModelMetadata(o,s.name)];case 1:return e=p.sent(),r=we.a.getPredicates(this.syncPredicates.get(s),!1),a=r?JSON.stringify(r):null,void 0!==e?[3,3]:[4,this.storage.save(this.modelInstanceCreator(n,{model:s.name,namespace:o,lastSync:null,fullSyncInterval:t,lastFullSync:null,lastSyncPredicate:a}),void 0,mn)];case 2:return l=hn.apply(void 0,[p.sent(),1]),f=hn(l[0],1),i=f[0],[3,5];case 3:return u=e.lastSyncPredicate?e.lastSyncPredicate:null,c=u!==a,[4,this.storage.save(this.modelClasses.ModelMetadata.copyOf(e,(function(e){e.fullSyncInterval=t,c&&(e.lastSync=null,e.lastFullSync=null,e.lastSyncPredicate=a)})))];case 4:d=hn.apply(void 0,[p.sent(),1]),h=hn(d[0],1),i=h[0],p.label=5;case 5:return[2,i]}}))}))})),s={},v.label=1;case 1:return v.trys.push([1,6,7,8]),[4,Promise.all(o)];case 2:a=pn.apply(void 0,[v.sent()]),u=a.next(),v.label=3;case 3:if(u.done)return[3,5];c=u.value,l=c.model,s[l]=c,v.label=4;case 4:return u=a.next(),[3,3];case 5:return[3,8];case 6:return f=v.sent(),d={error:f},[3,8];case 7:try{u&&!u.done&&(h=a.return)&&h.call(a)}finally{if(d)throw d.error}return[7];case 8:return[2,s]}}))}))},e.prototype.getModelsMetadata=function(){return fn(this,void 0,void 0,(function(){var e;return dn(this,(function(t){switch(t.label){case 0:return e=this.modelClasses.ModelMetadata,[4,this.storage.query(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.getModelMetadata=function(e,t){return fn(this,void 0,void 0,(function(){var n,r,i;return dn(this,(function(o){switch(o.label){case 0:return n=this.modelClasses.ModelMetadata,r=we.a.createFromExisting(this.schema.namespaces[Oe.d].models[n.name],(function(n){return n.namespace("eq",e).model("eq",t)})),[4,this.storage.query(n,r,{page:0,limit:1})];case 1:return i=hn.apply(void 0,[o.sent(),1]),[2,i[0]]}}))}))},e.prototype.getModelDefinition=function(e){var t=this.namespaceResolver(e);return this.schema.namespaces[t].models[e.name]},e.getNamespace=function(){return{name:Oe.d,relationships:{},enums:{OperationType:{name:"OperationType",values:["CREATE","UPDATE","DELETE"]}},nonModels:{},models:{MutationEvent:{name:"MutationEvent",pluralName:"MutationEvents",syncable:!1,fields:{id:{name:"id",type:"ID",isRequired:!0,isArray:!1},model:{name:"model",type:"String",isRequired:!0,isArray:!1},data:{name:"data",type:"String",isRequired:!0,isArray:!1},modelId:{name:"modelId",type:"String",isRequired:!0,isArray:!1},operation:{name:"operation",type:{enum:"Operationtype"},isArray:!1,isRequired:!0},condition:{name:"condition",type:"String",isArray:!1,isRequired:!0}}},ModelMetadata:{name:"ModelMetadata",pluralName:"ModelsMetadata",syncable:!1,fields:{id:{name:"id",type:"ID",isRequired:!0,isArray:!1},namespace:{name:"namespace",type:"String",isRequired:!0,isArray:!1},model:{name:"model",type:"String",isRequired:!0,isArray:!1},lastSync:{name:"lastSync",type:"Int",isRequired:!1,isArray:!1},lastFullSync:{name:"lastFullSync",type:"Int",isRequired:!1,isArray:!1},fullSyncInterval:{name:"fullSyncInterval",type:"Int",isRequired:!0,isArray:!1},lastSyncPredicate:{name:"lastSyncPredicate",type:"String",isRequired:!1,isArray:!1}}}}}},e}();function wn(e){return(wn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var Sn=function(){return(Sn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},_n=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},En=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},An=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},On=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},In=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Tn=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(On(arguments[t]));return e};se(!0),z();var Cn,xn,Pn,kn,Nn,Mn=new r.a("DataStore"),jn=Object(Oe.x)(Date.now()),Rn=i.a.browserOrNode().isNode,Dn=new WeakMap,Un=new WeakMap,Fn=function(e){var t=Dn.get(e);return Cn.namespaces[t].models[e.name]},Ln=function(e){return Object(Oe.t)(e)&&Dn.has(e)},Bn=function(e){return Dn.get(e)},qn=function(e){var t;if(void 0!==Cn)return console.warn("The schema has already been initialized"),Pn;Mn.log("validating schema",{schema:e});var n=Sn({name:Oe.e},e);Mn.log("DataStore","Init models"),Pn=zn(n),Mn.log("DataStore","Models initialized");var r={name:Oe.a,relationships:{},enums:{},nonModels:{},models:{Setting:{name:"Setting",pluralName:"Settings",syncable:!1,fields:{id:{name:"id",type:"ID",isRequired:!0,isArray:!1},key:{name:"key",type:"String",isRequired:!0,isArray:!1},value:{name:"value",type:"String",isRequired:!0,isArray:!1}}}}},i=It.getNamespace(),o=bn.getNamespace();return kn=zn(r),Nn=zn(i),xn=zn(o),Cn={namespaces:(t={},t[r.name]=r,t[n.name]=n,t[i.name]=i,t[o.name]=o,t),version:e.version},Object.keys(Cn.namespaces).forEach((function(e){var t,n,r=On(Object(Oe.f)(Cn.namespaces[e]),2),i=r[0],o=r[1];Cn.namespaces[e].relationships=i,Cn.namespaces[e].keys=o;var s=new Map;Object.values(Cn.namespaces[e].models).forEach((function(e){var t=[];Object.values(e.fields).filter((function(t){return t.association&&"BELONGS_TO"===t.association.connectionType&&t.type.model!==e.name})).forEach((function(e){return t.push(e.type.model)})),s.set(e.name,t)}));for(var a=new Map,u=1e3;u>0&&0!==s.size;){if(0===--u)throw new Error("Models are not topologically sortable. Please verify your schema.");try{for(var c=(t=void 0,In(Array.from(s.keys()))),l=c.next();!l.done;l=c.next()){var f=l.value,d=s.get(f);d.every((function(e){return a.has(e)}))&&a.set(f,d)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}Array.from(a.keys()).forEach((function(e){return s.delete(e)}))}Cn.namespaces[e].modelTopologicalOrdering=a})),Pn},zn=function(e){var t={};return Object.entries(e.models).forEach((function(n){var r=On(n,2),i=r[0],o=r[1],s=Jn(o);t[i]=s,Dn.set(s,e.name)})),Object.entries(e.nonModels||{}).forEach((function(e){var n=On(e,2),r=n[0],i=n[1],o=Qn(i);t[r]=o})),t},Kn=new WeakSet;function Vn(e,t){return Kn.add(t),new e(t)}var Hn,Gn=function(e){return function(t,n){var r=e.fields[t];if(void 0!==r){var i=r.type,o=r.isRequired,s=r.isArrayNullable,a=r.name,u=r.isArray;if((!u&&o||u&&!s)&&null==n)throw new Error("Field "+a+" is required");if(Object(fe.m)(i)){var c=fe.c.getJSType(i),l=fe.c.getValidationFunction(i);if("AWSJSON"===i){if(wn(n)===c)return;if("string"==typeof n)try{return void JSON.parse(n)}catch(e){throw new Error("Field "+a+" is an invalid JSON object. "+n)}}if(u){var f=c;if(o||(f=c+" | null | undefined"),!Array.isArray(n)&&!s)throw new Error("Field "+a+" should be of type ["+f+"], "+wn(n)+" received. "+n);if(!Object(Oe.v)(n)&&n.some((function(e){return Object(Oe.v)(e)?o:wn(e)!==c}))){var d=n.map((function(e){return null===e?"null":wn(e)})).join(",");throw new Error("All elements in the "+a+" array should be of type "+f+", ["+d+"] received. "+n)}if(l&&!Object(Oe.v)(n))if(!n.map((function(e){return Object(Oe.v)(e)?!(!Object(Oe.v)(e)||o):l(e)})).every((function(e){return e})))throw new Error("All elements in the "+a+" array should be of type "+i+", validation failed for one or more elements. "+n)}else{if(!o&&void 0===n)return;if(wn(n)!==c&&null!==n)throw new Error("Field "+a+" should be of type "+c+", "+wn(n)+" received. "+n);if(!Object(Oe.v)(n)&&l&&!l(n))throw new Error("Field "+a+" should be of type "+i+", validation failed. "+n)}}}}},Wn=function(e,t,n){var r=e.fields[t]||{},i=r.isArray,o=r.type;if("string"==typeof n&&(i||"AWSJSON"===o||Object(fe.s)(o)||Object(fe.r)(o)))try{return JSON.parse(n)}catch(e){}return"number"==typeof n&&"Boolean"===o?Boolean(n):n},Yn=function(e,t,n){var r=Gn(t);Object.entries(e).forEach((function(e){var i=On(e,2),o=i[0],s=i[1],a=Wn(t,o,s);r(o,a),n[o]=a}))},Jn=function(e){var t=function(){function n(t){return oe(this,(function(n){Yn(t,e,n);var r=Kn.has(t)?t:{},i=r.id,o=r._version,s=r._lastChangedAt,a=r._deleted,u=null!=i,c=u?i:e.syncable?Object(ae.v4)():jn();u||$n(n,e),n.id=c,e.syncable&&(n._version=o,n._lastChangedAt=s,n._deleted=a)}))}return n.copyOf=function(t,n){var r,i=Object.getPrototypeOf(t||{}).constructor;if(!Ln(i)){var o="The source object is not a valid model";throw Mn.error(o,{source:t}),new Error(o)}var s=oe(t,(function(r){n(r),r.id=t.id;var i=Gn(e);Object.entries(r).forEach((function(t){var n=On(t,2),r=n[0],o=n[1],s=Wn(e,r,o);i(r,s)}))}),(function(e){return r=e}));return r.length&&(Un.set(s,[r,t]),Zn(r,e)),s},n.fromJSON=function(n){var r=this;if(Array.isArray(n))return n.map((function(e){return r.fromJSON(e)}));var i=Vn(t,n),o=Gn(e);return Object.entries(i).forEach((function(e){var t=On(e,2),n=t[0],r=t[1];o(n,r)})),i},n}();return t[$]=!0,Object.defineProperty(t,"name",{value:e.name}),t},$n=function(e,t){var n=Object.keys(e),r=t.fields;n.forEach((function(e){if(r[e]&&r[e].isReadOnly)throw new Error(e+" is read-only.")}))},Zn=function(e,t){var n=e.map((function(e){return[e.path[0],e.value]})),r=t.fields;n.forEach((function(e){var t=On(e,2),n=t[0];if(t[1]&&r[n]&&r[n].isReadOnly)throw new Error(n+" is read-only.")}))},Qn=function(e){var t=function(t){return oe(this,(function(n){Yn(t,e,n)}))};return t[$]=!0,Object.defineProperty(t,"name",{value:e.name}),Object(Oe.y)(t),t};function Xn(e){return"string"==typeof e}function er(e){var t=e.localModel,n=e.modelConstructor,r=e.remoteModel._version;return Vn(n,Sn(Sn({},t),{_version:r}))}function tr(e){Mn.warn(e)}function nr(e,t){var n;switch(e){case Oe.a:n=kn[t];break;case Oe.e:n=Pn[t];break;case Oe.d:n=xn[t];break;case Oe.c:n=Nn[t];break;default:Object(Oe.g)(e)}if(Ln(n))return n;var r="Model name is not valid for namespace. modelName: "+t+", namespace: "+e;throw Mn.error(r),new Error(r)}function rr(e,t){return _n(this,void 0,void 0,(function(){var n,r,i=this;return En(this,(function(o){switch(o.label){case 0:return n=kn.Setting,r=Cn.namespaces[Oe.a].models.Setting,[4,e.runExclusive((function(e){return _n(i,void 0,void 0,(function(){var i,o;return En(this,(function(s){switch(s.label){case 0:return[4,e.query(n,we.a.createFromExisting(r,(function(e){return e.key("eq","schemaVersion")})),{page:0,limit:1})];case 1:return i=On.apply(void 0,[s.sent(),1]),void 0===(o=i[0])||void 0===o.value?[3,4]:JSON.parse(o.value)===t?[3,3]:[4,e.clear(!1)];case 2:s.sent(),s.label=3;case 3:return[3,6];case 4:return[4,e.save(Vn(n,{key:"schemaVersion",value:JSON.stringify(t)}))];case 5:s.sent(),s.label=6;case 6:return[2]}}))}))}))];case 1:return o.sent(),[2]}}))}))}var ir=function(){function e(){var e=this;this.amplifyConfig={},this.syncPredicates=new WeakMap,this.start=function(){return _n(e,void 0,void 0,(function(){var e,t,n,r=this;return En(this,(function(i){switch(i.label){case 0:return void 0!==this.initialized?[3,1]:(Mn.debug("Starting DataStore"),this.initialized=new Promise((function(e,t){r.initResolve=e,r.initReject=t})),[3,3]);case 1:return[4,this.initialized];case 2:return i.sent(),[2];case 3:return this.storage=new It(Cn,Bn,nr,Vn,this.storageAdapter,this.sessionId),[4,this.storage.init()];case 4:return i.sent(),[4,rr(this.storage,Cn.version)];case 5:return i.sent(),(e=this.amplifyConfig.aws_appsync_graphqlEndpoint)?(Mn.debug("GraphQL endpoint available",e),t=this,[4,this.processSyncExpressions()]):[3,7];case 6:return t.syncPredicates=i.sent(),this.sync=new bn(Cn,Bn,xn,Pn,this.storage,Vn,this.conflictHandler,this.errorHandler,this.syncPredicates,this.amplifyConfig,this.authModeStrategy),n=1e3*this.fullSyncInterval*60,Hn=this.sync.start({fullSyncInterval:n}).subscribe({next:function(e){var t=e.type,n=e.data;t===(Rn?lt.SYNC_ENGINE_SYNC_QUERIES_READY:lt.SYNC_ENGINE_STORAGE_SUBSCRIBED)&&r.initResolve(),o.a.dispatch("datastore",{event:t,data:n})},error:function(e){Mn.warn("Sync error",e),r.initReject()}}),[3,8];case 7:Mn.warn("Data won't be synchronized. No GraphQL endpoint configured. Did you forget `Amplify.configure(awsconfig)`?",{config:this.amplifyConfig}),this.initResolve(),i.label=8;case 8:return[4,this.initialized];case 9:return i.sent(),[2]}}))}))},this.query=function(t,n,r){return _n(e,void 0,void 0,(function(){var e,i,o,s,a;return En(this,(function(u){switch(u.label){case 0:return[4,this.start()];case 1:if(u.sent(),!Ln(t))throw e="Constructor is not for a valid model",Mn.error(e,{modelConstructor:t}),new Error(e);return"string"==typeof n&&void 0!==r&&Mn.warn("Pagination is ignored when querying by id"),i=Fn(t),o=Xn(n)?we.a.createForId(i,n):Object(we.c)(n)?void 0:we.a.createFromExisting(i,n),s=this.processPagination(i,r),Mn.debug("params ready",{modelConstructor:t,predicate:we.a.getPredicates(o,!1),pagination:Sn(Sn({},s),{sort:Se.a.getPredicates(s&&s.sort,!1)})}),[4,this.storage.query(t,o,s)];case 2:return a=u.sent(),[2,Xn(n)?a[0]:a]}}))}))},this.save=function(t,n){return _n(e,void 0,void 0,(function(){var e,r,i,o,s,a,u=this;return En(this,(function(c){switch(c.label){case 0:return[4,this.start()];case 1:if(c.sent(),e=Un.get(t),r=t?t.constructor:void 0,!Ln(r))throw i="Object is not an instance of a valid model",Mn.error(i,{model:t}),new Error(i);return o=Fn(r),s=we.a.createFromExisting(o,n),[4,this.storage.runExclusive((function(n){return _n(u,void 0,void 0,(function(){return En(this,(function(i){switch(i.label){case 0:return[4,n.save(t,s,void 0,e)];case 1:return i.sent(),[2,n.query(r,we.a.createForId(o,t.id))]}}))}))}))];case 2:return a=On.apply(void 0,[c.sent(),1]),[2,a[0]]}}))}))},this.setConflictHandler=function(t){var n=t.DataStore;return n&&n.conflictHandler?n.conflictHandler:e.conflictHandler===er&&t.conflictHandler?t.conflictHandler:e.conflictHandler||er},this.setErrorHandler=function(t){var n=t.DataStore;return n&&n.errorHandler?n.errorHandler:e.errorHandler===tr&&t.errorHandler?t.errorHandler:e.errorHandler||tr},this.delete=function(t,n){return _n(e,void 0,void 0,(function(){var e,r,i,o,s,a,u,c,l;return En(this,(function(f){switch(f.label){case 0:return[4,this.start()];case 1:if(f.sent(),!t)throw u="Model or Model Constructor required",Mn.error(u,{modelOrConstructor:t}),new Error(u);if(!Ln(t))return[3,3];if(o=t,!n)throw u="Id to delete or criteria required. Do you want to delete all? Pass Predicates.ALL",Mn.error(u,{idOrCriteria:n}),new Error(u);if("string"==typeof n)e=we.a.createForId(Fn(o),n);else if(!(e=we.a.createFromExisting(Fn(o),n))||!we.a.isValidPredicate(e))throw u="Criteria required. Do you want to delete all? Pass Predicates.ALL",Mn.error(u,{condition:e}),new Error(u);return[4,this.storage.delete(o,e)];case 2:return r=On.apply(void 0,[f.sent(),1]),[2,r[0]];case 3:if(i=t,o=Object.getPrototypeOf(i||{}).constructor,!Ln(o))throw u="Object is not an instance of a valid model",Mn.error(u,{model:i}),new Error(u);if(s=Fn(o),a=we.a.createForId(s,i.id),n){if("function"!=typeof n)throw u="Invalid criteria",Mn.error(u,{idOrCriteria:n}),new Error(u);e=n(a)}else e=a;return[4,this.storage.delete(i,e)];case 4:return c=On.apply(void 0,[f.sent(),1]),l=On(c[0],1),[2,l[0]]}}))}))},this.observe=function(t,n){var r,i=t&&Ln(t)?t:void 0;if(t&&void 0===i){var o=t,s=o&&Object.getPrototypeOf(o).constructor;if(Ln(s))return n&&Mn.warn("idOrCriteria is ignored when using a model instance",{model:o,idOrCriteria:n}),e.observe(s,o.id);var a="The model is not an instance of a PersistentModelConstructor";throw Mn.error(a,{model:o}),new Error(a)}if(void 0!==n&&void 0===i){a="Cannot provide criteria without a modelConstructor";throw Mn.error(a,n),new Error(a)}if(i&&!Ln(i)){a="Constructor is not for a valid model";throw Mn.error(a,{modelConstructor:i}),new Error(a)}return r="string"==typeof n?we.a.createForId(Fn(i),n):i&&we.a.createFromExisting(Fn(i),n),new ue.a((function(t){var n;return _n(e,void 0,void 0,(function(){return En(this,(function(e){switch(e.label){case 0:return[4,this.start()];case 1:return e.sent(),n=this.storage.observe(i,r).filter((function(e){var t=e.model;return Bn(t)===Oe.e})).subscribe(t),[2]}}))})),function(){n&&n.unsubscribe()}}))},this.observeQuery=function(t,n,r){return new ue.a((function(i){var s,a=new Map,u=new Map,c=[],l=function(){var e=p();v(e)},f=new Oe.b({callback:l,errorHandler:i.error,maxInterval:2e3}),d=(r||{}).sort,h=d?{sort:d}:void 0;_n(e,void 0,void 0,(function(){var e,r=this;return En(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.query(t,n,h)];case 1:return o.sent().forEach((function(e){return a.set(e.id,e)})),s=this.observe(t,n).subscribe((function(e){var t,n,i=e.element,o=e.model;"DELETE"===e.opType?c.push(i.id):u.set(i.id,i);var s=null!==(n=null===(t=r.sync)||void 0===t?void 0:t.getModelSyncedStatus(o))&&void 0!==n&&n;(u.size-c.length>=r.syncPageSize||s)&&f.resolve(),f.start()})),l(),[3,3];case 2:return e=o.sent(),i.error(e),[3,3];case 3:return[2]}}))}));var p=function(){var n,i,o=null!==(i=null===(n=e.sync)||void 0===n?void 0:n.getModelSyncedStatus(t))&&void 0!==i&&i,s=Tn(Array.from(a.values()),Array.from(u.values()));return(null==r?void 0:r.sort)&&y(s),a.clear(),s.forEach((function(e){return a.set(e.id,e)})),c.forEach((function(e){return a.delete(e)})),{items:Array.from(a.values()),isSynced:o}},v=function(e){i.next(e),u.clear(),c=[]},y=function(n){var i=Fn(t),o=e.processPagination(i,r),s=Se.a.getPredicates(o.sort);if(s.length){var a=Object(Oe.z)(s);n.sort(a)}};return o.a.listen("datastore",(function e(n){var r,i=n.payload,s=i.event,a=i.data;s===lt.SYNC_ENGINE_MODEL_SYNCED&&(null===(r=null==a?void 0:a.model)||void 0===r?void 0:r.name)===t.name&&(l(),o.a.remove("api",e))})),function(){s&&s.unsubscribe()}}))},this.configure=function(t){void 0===t&&(t={});var n=t.DataStore,r=t.authModeStrategyType,i=(t.conflictHandler,t.errorHandler,t.maxRecordsToSync),o=t.syncPageSize,s=t.fullSyncInterval,a=t.syncExpressions,u=t.authProviders,c=t.storageAdapter,l=An(t,["DataStore","authModeStrategyType","conflictHandler","errorHandler","maxRecordsToSync","syncPageSize","fullSyncInterval","syncExpressions","authProviders","storageAdapter"]);switch(e.amplifyConfig=Sn(Sn({},l),e.amplifyConfig),e.conflictHandler=e.setConflictHandler(t),e.errorHandler=e.setErrorHandler(t),n&&n.authModeStrategyType||r||fe.a.DEFAULT){case fe.a.MULTI_AUTH:e.authModeStrategy=me;break;case fe.a.DEFAULT:default:e.authModeStrategy=be}e.amplifyConfig.authProviders=n&&n.authProviders||u,e.syncExpressions=n&&n.syncExpressions||a||e.syncExpressions,e.maxRecordsToSync=n&&n.maxRecordsToSync||i||e.maxRecordsToSync||1e4,e.amplifyConfig.maxRecordsToSync=e.maxRecordsToSync,e.syncPageSize=n&&n.syncPageSize||o||e.syncPageSize||1e3,e.amplifyConfig.syncPageSize=e.syncPageSize,e.fullSyncInterval=n&&n.fullSyncInterval||s||e.fullSyncInterval||1440,e.storageAdapter=n&&n.storageAdapter||c||e.storageAdapter||void 0,e.sessionId=e.retrieveSessionId()},this.clear=function(){return _n(this,void 0,void 0,(function(){return En(this,(function(e){switch(e.label){case 0:return void 0===this.storage?[2]:(Hn&&!Hn.closed&&Hn.unsubscribe(),[4,this.storage.clear()]);case 1:return e.sent(),this.sync&&this.sync.unsubscribeConnectivity(),this.initialized=void 0,this.storage=void 0,this.sync=void 0,this.syncPredicates=new WeakMap,[2]}}))}))},this.stop=function(){return _n(this,void 0,void 0,(function(){return En(this,(function(e){switch(e.label){case 0:return void 0===this.initialized?[3,2]:[4,this.start()];case 1:e.sent(),e.label=2;case 2:return Hn&&!Hn.closed&&Hn.unsubscribe(),this.sync&&this.sync.unsubscribeConnectivity(),this.initialized=void 0,this.sync=void 0,[2]}}))}))}}return e.prototype.getModuleName=function(){return"DataStore"},e.prototype.processPagination=function(e,t){var n,r=t||{},i=r.limit,o=r.page,s=r.sort;if(void 0!==i||void 0!==o||void 0!==s){if(void 0!==o&&void 0===i)throw new Error("Limit is required when requesting a page");if(void 0!==o){if("number"!=typeof o)throw new Error("Page should be a number");if(o<0)throw new Error("Page can't be negative")}if(void 0!==i){if("number"!=typeof i)throw new Error("Limit should be a number");if(i<0)throw new Error("Limit can't be negative")}return s&&(n=Se.a.createFromExisting(e,t.sort)),{limit:i,page:o,sort:n}}},e.prototype.processSyncExpressions=function(){return _n(this,void 0,void 0,(function(){var e,t=this;return En(this,(function(n){switch(n.label){case 0:return this.syncExpressions&&this.syncExpressions.length?[4,Promise.all(this.syncExpressions.map((function(e){return _n(t,void 0,void 0,(function(){var t,n,r,i,o,s;return En(this,(function(a){switch(a.label){case 0:return[4,e];case 1:return t=a.sent(),n=t.modelConstructor,r=t.conditionProducer,i=Fn(n),[4,this.unwrapPromise(r)];case 2:return o=a.sent(),Object(we.c)(o)?[2,[i,null]]:(s=this.createFromCondition(i,o),[2,[i,s]])}}))}))})))]:[2,new WeakMap];case 1:return e=n.sent(),[2,this.weakMapFromEntries(e)]}}))}))},e.prototype.createFromCondition=function(e,t){try{return we.a.createFromExisting(e,t)}catch(e){throw Mn.error("Error creating Sync Predicate"),e}},e.prototype.unwrapPromise=function(e){return _n(this,void 0,void 0,(function(){var t;return En(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,e()];case 1:return[2,n.sent()];case 2:if((t=n.sent())instanceof TypeError)return[2,e];throw t;case 3:return[2]}}))}))},e.prototype.weakMapFromEntries=function(e){return e.reduce((function(e,t){var n=On(t,2),r=n[0],i=n[1];if(e.has(r)){var o=r.name;return Mn.warn("You can only utilize one Sync Expression per model.\n Subsequent sync expressions for the "+o+" model will be ignored."),e}return i&&e.set(r,i),e}),new WeakMap)},e.prototype.retrieveSessionId=function(){try{var e=sessionStorage.getItem("datastoreSessionId");if(e){var t=this.amplifyConfig.aws_appsync_graphqlEndpoint.split("/")[2];return e+"-"+On(t.split("."),1)[0]}}catch(e){return}},e}(),or=new ir;s.a.register(or);var sr={USER:Oe.e,traverseModel:Oe.A,validatePredicate:Oe.B,isNonModelConstructor:Oe.u,isModelConstructor:Oe.t}},function(e,t,n){"use strict";n.r(t),n.d(t,"fromUtf8",(function(){return r})),n.d(t,"toUtf8",(function(){return i}));var r=function(e){return"function"==typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e.charCodeAt(n);if(i<128)t.push(i);else if(i<2048)t.push(i>>6|192,63&i|128);else if(n+1<e.length&&55296==(64512&i)&&56320==(64512&e.charCodeAt(n+1))){var o=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n));t.push(o>>18|240,o>>12&63|128,o>>6&63|128,63&o|128)}else t.push(i>>12|224,i>>6&63|128,63&i|128)}return Uint8Array.from(t)}(e)},i=function(e){return"function"==typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):function(e){for(var t="",n=0,r=e.length;n<r;n++){var i=e[n];if(i<128)t+=String.fromCharCode(i);else if(192<=i&&i<224){var o=e[++n];t+=String.fromCharCode((31&i)<<6|63&o)}else if(240<=i&&i<365){var s="%"+[i,e[++n],e[++n],e[++n]].map((function(e){return e.toString(16)})).join("%");t+=decodeURIComponent(s)}else t+=String.fromCharCode((15&i)<<12|(63&e[++n])<<6|63&e[++n])}return t}(e)}},function(e,t,n){"use strict";n.r(t),n.d(t,"fromUtf8",(function(){return r})),n.d(t,"toUtf8",(function(){return i}));var r=function(e){return"function"==typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e.charCodeAt(n);if(i<128)t.push(i);else if(i<2048)t.push(i>>6|192,63&i|128);else if(n+1<e.length&&55296==(64512&i)&&56320==(64512&e.charCodeAt(n+1))){var o=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n));t.push(o>>18|240,o>>12&63|128,o>>6&63|128,63&o|128)}else t.push(i>>12|224,i>>6&63|128,63&i|128)}return Uint8Array.from(t)}(e)},i=function(e){return"function"==typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):function(e){for(var t="",n=0,r=e.length;n<r;n++){var i=e[n];if(i<128)t+=String.fromCharCode(i);else if(192<=i&&i<224){var o=e[++n];t+=String.fromCharCode((31&i)<<6|63&o)}else if(240<=i&&i<365){var s="%"+[i,e[++n],e[++n],e[++n]].map((function(e){return e.toString(16)})).join("%");t+=decodeURIComponent(s)}else t+=String.fromCharCode((15&i)<<12|(63&e[++n])<<6|63&e[++n])}return t}(e)}},,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return f})),n.d(t,"b",(function(){return d}));var r,i=n(22),o=(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},a=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},u=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},c=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(u(arguments[t]));return e},l=new i.a("Util"),f=function(e){function t(t){var n=e.call(this,t)||this;return n.nonRetryable=!0,n}return o(t,e),t}(Error);var d=function(e,t,n){return void 0===n&&(n=3e5),function e(t,n,r,i){return void 0===i&&(i=1),s(this,void 0,void 0,(function(){var o,s;return a(this,(function(a){switch(a.label){case 0:if("function"!=typeof t)throw Error("functionToRetry must be a function");l.debug(t.name+" attempt #"+i+" with this vars: "+JSON.stringify(n)),a.label=1;case 1:return a.trys.push([1,3,,8]),[4,t.apply(void 0,c(n))];case 2:return[2,a.sent()];case 3:if(o=a.sent(),l.debug("error on "+t.name,o),(u=o)&&u.nonRetryable)throw l.debug(t.name+" non retryable error",o),o;return s=r(i,n,o),l.debug(t.name+" retrying in "+s+" ms"),!1===s?[3,6]:[4,new Promise((function(e){return setTimeout(e,s)}))];case 4:return a.sent(),[4,e(t,n,r,i+1)];case 5:return[2,a.sent()];case 6:throw o;case 7:return[3,8];case 8:return[2]}var u}))}))}(e,t,function(e){return function(t){var n=100*Math.pow(2,t)+100*Math.random();return!(n>e)&&n}}(n))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},i={clockOffset:0,getDateWithClockOffset:function(){return i.clockOffset?new Date((new Date).getTime()+i.clockOffset):new Date},getClockOffset:function(){return i.clockOffset},getHeaderStringFromDate:function(e){return void 0===e&&(e=i.getDateWithClockOffset()),e.toISOString().replace(/[:\-]|\.\d{3}/g,"")},getDateFromHeaderString:function(e){var t=r(e.match(/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2}).+/),7),n=t[1],i=t[2],o=t[3],s=t[4],a=t[5],u=t[6];return new Date(Date.UTC(Number(n),Number(i)-1,Number(o),Number(s),Number(a),Number(u)))},isClockSkewed:function(e){return Math.abs(e.getTime()-i.getDateWithClockOffset().getTime())>=3e5},isClockSkewError:function(e){if(!e.response||!e.response.headers)return!1;var t=e.response.headers;return Boolean(["BadRequestException","InvalidSignatureException"].includes(t["x-amzn-errortype"])&&(t.date||t.Date))},setClockOffset:function(e){i.clockOffset=e}}}])}));
|
|
79
|
+
t.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,c=u>>1,l=-7,f=n?i-1:0,d=n?-1:1,h=e[t+f];for(f+=d,o=h&(1<<-l)-1,h>>=-l,l+=a;l>0;o=256*o+e[t+f],f+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+e[t+f],f+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,r),o-=c}return(h?-1:1)*s*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var s,a,u,c=8*o-i-1,l=(1<<c)-1,f=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,p=r?1:-1,v=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+f>=1?d/u:d*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*u-1)*Math.pow(2,i),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[n+h]=255&a,h+=p,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[n+h]=255&s,h+=p,s/=256,c-=8);e[n+h-p]|=128*v}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t){},function(e,t){},function(e,t,n){var r,i,o,s;e.exports=(r=n(13),o=(i=r).lib.Base,s=i.enc.Utf8,void(i.algo.HMAC=o.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));var n=e.blockSize,r=4*n;t.sigBytes>r&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),o=this._iKey=t.clone(),a=i.words,u=o.words,c=0;c<n;c++)a[c]^=1549556828,u[c]^=909522486;i.sigBytes=o.sigBytes=r,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,n=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(n))}})))},function(e,t){},function(e,t,n){e.exports=self.fetch||(self.fetch=n(48).default||n(48))},function(e,t,n){e.exports=n(100).Observable},function(e,t,n){"use strict";(function(e){!function(e,t){function n(e){return"function"==typeof Symbol&&Boolean(Symbol[e])}function r(e){return n(e)?Symbol[e]:"@@"+e}function i(e){setTimeout((function(){throw e}))}function o(e,t){var n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function s(e){var t=e.constructor;return void 0!==t&&null===(t=t[r("species")])&&(t=void 0),void 0!==t?t:d}function a(e,t){Object.keys(t).forEach((function(n){var r=Object.getOwnPropertyDescriptor(t,n);r.enumerable=!1,Object.defineProperty(e,n,r)}))}function u(e){var t=e._cleanup;if(t){e._cleanup=void 0;try{t()}catch(e){i(e)}}}function c(e){return void 0===e._observer}function l(e,t){if(Object(e)!==e)throw new TypeError("Observer must be an object");this._cleanup=void 0,this._observer=e;try{var n=o(e,"start");n&&n.call(e,this)}catch(e){i(e)}if(!c(this)){e=new f(this);try{var r=t.call(void 0,e);if(null!=r){if("function"==typeof r.unsubscribe)s=r,r=function(){s.unsubscribe()};else if("function"!=typeof r)throw new TypeError(r+" is not a function");this._cleanup=r}}catch(t){return void e.error(t)}var s;c(this)&&u(this)}}function f(e){this._subscription=e}function d(e){if(!(this instanceof d))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}"function"!=typeof Symbol||Symbol.observable||(Symbol.observable=Symbol("observable")),a(l.prototype={},{get closed(){return c(this)},unsubscribe:function(){var e;c(e=this)||(e._observer=void 0,u(e))}}),a(f.prototype={},{get closed(){return c(this._subscription)},next:function(e){var t=this._subscription;if(!c(t)){var n=t._observer;try{var r=o(n,"next");r&&r.call(n,e)}catch(e){i(e)}}},error:function(e){var t=this._subscription;if(c(t))i(e);else{var n=t._observer;t._observer=void 0;try{var r=o(n,"error");if(!r)throw e;r.call(n,e)}catch(e){i(e)}u(t)}},complete:function(){var e=this._subscription;if(!c(e)){var t=e._observer;e._observer=void 0;try{var n=o(t,"complete");n&&n.call(t)}catch(e){i(e)}u(e)}}}),a(d.prototype,{subscribe:function(e){for(var t=[],n=1;n<arguments.length;++n)t.push(arguments[n]);return"function"==typeof e?e={next:e,error:t[0],complete:t[1]}:"object"==typeof e&&null!==e||(e={}),new l(e,this._subscriber)},forEach:function(e){var t=this;return new Promise((function(n,r){if("function"!=typeof e)return Promise.reject(new TypeError(e+" is not a function"));t.subscribe({_subscription:null,start:function(e){if(Object(e)!==e)throw new TypeError(e+" is not an object");this._subscription=e},next:function(t){var n=this._subscription;if(!n.closed)try{e(t)}catch(e){r(e),n.unsubscribe()}},error:r,complete:n})}))},map:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(s(this))((function(n){return t.subscribe({next:function(t){if(!n.closed){try{t=e(t)}catch(e){return n.error(e)}n.next(t)}},error:function(e){n.error(e)},complete:function(){n.complete()}})}))},filter:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(s(this))((function(n){return t.subscribe({next:function(t){if(!n.closed){try{if(!e(t))return}catch(e){return n.error(e)}n.next(t)}},error:function(e){n.error(e)},complete:function(){n.complete()}})}))},reduce:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=s(this),r=arguments.length>1,i=!1,o=arguments[1],a=o;return new n((function(n){return t.subscribe({next:function(t){if(!n.closed){var o=!i;if(i=!0,!o||r)try{a=e(a,t)}catch(e){return n.error(e)}else a=t}},error:function(e){n.error(e)},complete:function(){if(!i&&!r)return n.error(new TypeError("Cannot reduce an empty sequence"));n.next(a),n.complete()}})}))}}),Object.defineProperty(d.prototype,r("observable"),{value:function(){return this},writable:!0,configurable:!0}),a(d,{from:function(e){var t="function"==typeof this?this:d;if(null==e)throw new TypeError(e+" is not an object");var i=o(e,r("observable"));if(i){var s=i.call(e);if(Object(s)!==s)throw new TypeError(s+" is not an object");return s.constructor===t?s:new t((function(e){return s.subscribe(e)}))}if(n("iterator")&&(i=o(e,r("iterator"))))return new t((function(t){for(var n,r=i.call(e)[Symbol.iterator]();!(n=r.next()).done;){var o=n.value;if(t.next(o),t.closed)return}t.complete()}));if(Array.isArray(e))return new t((function(t){for(var n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}));throw new TypeError(e+" is not observable")},of:function(){for(var e=[],t=0;t<arguments.length;++t)e.push(arguments[t]);var n="function"==typeof this?this:d;return new n((function(t){for(var n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}))}}),Object.defineProperty(d,r("species"),{get:function(){return this},configurable:!0}),Object.defineProperty(d,"extensions",{value:{observableSymbol:r("observable"),setHostReportError:function(e){i=e}}}),e.Observable=d}(t)}).call(this,n(50)(e))},function(e,t,n){(function(e,r){var i;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(o){t&&t.nodeType,e&&e.nodeType;var s="object"==typeof r&&r;s.global!==s&&s.window!==s&&s.self;var a,u=2147483647,c=/^xn--/,l=/[^\x20-\x7E]/,f=/[\x2E\u3002\uFF0E\uFF61]/g,d={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},h=Math.floor,p=String.fromCharCode;function v(e){throw new RangeError(d[e])}function y(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function g(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+y((e=e.replace(f,".")).split("."),t).join(".")}function m(e){for(var t,n,r=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(n=e.charCodeAt(i++)))?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),i--):r.push(t);return r}function b(e){return y(e,(function(e){var t="";return e>65535&&(t+=p((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=p(e)})).join("")}function w(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function S(e,t,n){var r=0;for(e=n?h(e/700):e>>1,e+=h(e/t);e>455;r+=36)e=h(e/35);return h(r+36*e/(e+38))}function _(e){var t,n,r,i,o,s,a,c,l,f,d,p=[],y=e.length,g=0,m=128,w=72;for((n=e.lastIndexOf("-"))<0&&(n=0),r=0;r<n;++r)e.charCodeAt(r)>=128&&v("not-basic"),p.push(e.charCodeAt(r));for(i=n>0?n+1:0;i<y;){for(o=g,s=1,a=36;i>=y&&v("invalid-input"),((c=(d=e.charCodeAt(i++))-48<10?d-22:d-65<26?d-65:d-97<26?d-97:36)>=36||c>h((u-g)/s))&&v("overflow"),g+=c*s,!(c<(l=a<=w?1:a>=w+26?26:a-w));a+=36)s>h(u/(f=36-l))&&v("overflow"),s*=f;w=S(g-o,t=p.length+1,0==o),h(g/t)>u-m&&v("overflow"),m+=h(g/t),g%=t,p.splice(g++,0,m)}return b(p)}function E(e){var t,n,r,i,o,s,a,c,l,f,d,y,g,b,_,E=[];for(y=(e=m(e)).length,t=128,n=0,o=72,s=0;s<y;++s)(d=e[s])<128&&E.push(p(d));for(r=i=E.length,i&&E.push("-");r<y;){for(a=u,s=0;s<y;++s)(d=e[s])>=t&&d<a&&(a=d);for(a-t>h((u-n)/(g=r+1))&&v("overflow"),n+=(a-t)*g,t=a,s=0;s<y;++s)if((d=e[s])<t&&++n>u&&v("overflow"),d==t){for(c=n,l=36;!(c<(f=l<=o?1:l>=o+26?26:l-o));l+=36)_=c-f,b=36-f,E.push(p(w(f+_%b,0))),c=h(_/b);E.push(p(w(c,0))),o=S(n,g,r==i),n=0,++r}++n,++t}return E.join("")}a={version:"1.4.1",ucs2:{decode:m,encode:b},decode:_,encode:E,toASCII:function(e){return g(e,(function(e){return l.test(e)?"xn--"+E(e):e}))},toUnicode:function(e){return g(e,(function(e){return c.test(e)?_(e.slice(4).toLowerCase()):e}))}},void 0===(i=function(){return a}.call(t,n,t,e))||(e.exports=i)}()}).call(this,n(50)(e),n(29))},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){"use strict";t.decode=t.parse=n(104),t.encode=t.stringify=n(105)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,o){t=t||"&",n=n||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var l=0;l<c;++l){var f,d,h,p,v=e[l].replace(a,"%20"),y=v.indexOf(n);y>=0?(f=v.substr(0,y),d=v.substr(y+1)):(f=v,d=""),h=decodeURIComponent(f),p=decodeURIComponent(d),r(s,h)?i(s[h])?s[h].push(p):s[h]=[s[h],p]:s[h]=p}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,a){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),(function(s){var a=encodeURIComponent(r(s))+n;return i(e[s])?o(e[s],(function(e){return a+encodeURIComponent(r(e))})).join(t):a+encodeURIComponent(r(e[s]))})).join(t):a?encodeURIComponent(r(a))+n+encodeURIComponent(r(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t(e[r],r));return n}var s=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}},function(e,t,n){var r,i,o=n(52),s=n(53),a=0,u=0;e.exports=function(e,t,n){var c=t&&n||0,l=t||[],f=(e=e||{}).node||r,d=void 0!==e.clockseq?e.clockseq:i;if(null==f||null==d){var h=o();null==f&&(f=r=[1|h[0],h[1],h[2],h[3],h[4],h[5]]),null==d&&(d=i=16383&(h[6]<<8|h[7]))}var p=void 0!==e.msecs?e.msecs:(new Date).getTime(),v=void 0!==e.nsecs?e.nsecs:u+1,y=p-a+(v-u)/1e4;if(y<0&&void 0===e.clockseq&&(d=d+1&16383),(y<0||p>a)&&void 0===e.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=p,u=v,i=d;var g=(1e4*(268435455&(p+=122192928e5))+v)%4294967296;l[c++]=g>>>24&255,l[c++]=g>>>16&255,l[c++]=g>>>8&255,l[c++]=255&g;var m=p/4294967296*1e4&268435455;l[c++]=m>>>8&255,l[c++]=255&m,l[c++]=m>>>24&15|16,l[c++]=m>>>16&255,l[c++]=d>>>8|128,l[c++]=255&d;for(var b=0;b<6;++b)l[c+b]=f[b];return t||s(l)}},function(e,t,n){var r=n(52),i=n(53);e.exports=function(e,t,n){var o=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[o+a]=s[a];return t||i(s)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(54),i=n(56),o=n(114),s=n(117),a=n(119),u=n(37),c=function(){function e(e){(0,s.supportsWebCrypto)((0,u.locateWindow)())?this.hash=new i.Sha256(e):(0,a.isMsWindow)((0,u.locateWindow)())?this.hash=new r.Sha256(e):this.hash=new o.Sha256(e)}return e.prototype.update=function(e,t){this.hash.update(e,t)},e.prototype.digest=function(){return this.hash.digest()},e}();t.Sha256=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyData=void 0,t.isEmptyData=function(e){return"string"==typeof e?0===e.length:0===e.byteLength}},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.convertToBuffer=void 0;var r=n(149),i=void 0!==e&&e.from?function(t){return e.from(t,"utf8")}:r.fromUtf8;t.convertToBuffer=function(e){return e instanceof Uint8Array?e:"string"==typeof e?i(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}}).call(this,n(6).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyData=void 0,t.isEmptyData=function(e){return"string"==typeof e?0===e.length:0===e.byteLength}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.numToUint8=void 0,t.numToUint8=function(e){return new Uint8Array([(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e])}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint32ArrayFrom=void 0,t.uint32ArrayFrom=function(e){if(!Array.from){for(var t=new Uint32Array(e.length);0<e.length;)t[0]=e[0];return t}return Uint32Array.from(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),(0,n(0).__exportStar)(n(115),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(0),i=n(58),o=n(116),s=n(57),a=function(){function e(e){if(this.hash=new o.RawSha256,e){this.outer=new o.RawSha256;var t=function(e){var t=(0,s.convertToBuffer)(e);if(t.byteLength>i.BLOCK_SIZE){var n=new o.RawSha256;n.update(t),t=n.digest()}var r=new Uint8Array(i.BLOCK_SIZE);return r.set(t),r}(e),n=new Uint8Array(i.BLOCK_SIZE);n.set(t);for(var r=0;r<i.BLOCK_SIZE;r++)t[r]^=54,n[r]^=92;this.hash.update(t),this.outer.update(n);for(r=0;r<t.byteLength;r++)t[r]=0}}return e.prototype.update=function(e){if(!(0,s.isEmptyData)(e)&&!this.error)try{this.hash.update((0,s.convertToBuffer)(e))}catch(e){this.error=e}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return(0,r.__awaiter)(this,void 0,void 0,(function(){return(0,r.__generator)(this,(function(e){return[2,this.digestSync()]}))}))},e}();t.Sha256=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RawSha256=void 0;var r=n(58),i=function(){function e(){this.state=Int32Array.from(r.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,n=e.byteLength;if(this.bytesHashed+=n,8*this.bytesHashed>r.MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[t++],n--,this.bufferLength===r.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=8*this.bytesHashed,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(t.setUint8(this.bufferLength++,128),n%r.BLOCK_SIZE>=r.BLOCK_SIZE-8){for(var i=this.bufferLength;i<r.BLOCK_SIZE;i++)t.setUint8(i,0);this.hashBuffer(),this.bufferLength=0}for(i=this.bufferLength;i<r.BLOCK_SIZE-8;i++)t.setUint8(i,0);t.setUint32(r.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),t.setUint32(r.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}var o=new Uint8Array(r.DIGEST_LENGTH);for(i=0;i<8;i++)o[4*i]=this.state[i]>>>24&255,o[4*i+1]=this.state[i]>>>16&255,o[4*i+2]=this.state[i]>>>8&255,o[4*i+3]=this.state[i]>>>0&255;return o},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],u=t[5],c=t[6],l=t[7],f=0;f<r.BLOCK_SIZE;f++){if(f<16)this.temp[f]=(255&e[4*f])<<24|(255&e[4*f+1])<<16|(255&e[4*f+2])<<8|255&e[4*f+3];else{var d=this.temp[f-2],h=(d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,p=((d=this.temp[f-15])>>>7|d<<25)^(d>>>18|d<<14)^d>>>3;this.temp[f]=(h+this.temp[f-7]|0)+(p+this.temp[f-16]|0)}var v=(((a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7))+(a&u^~a&c)|0)+(l+(r.KEY[f]+this.temp[f]|0)|0)|0,y=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&i^n&o^i&o)|0;l=c,c=u,u=a,a=s+v|0,s=o,o=i,i=n,n=v+y|0}t[0]+=n,t[1]+=i,t[2]+=o,t[3]+=s,t[4]+=a,t[5]+=u,t[6]+=c,t[7]+=l},e}();t.RawSha256=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(0).__exportStar(n(118),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.supportsZeroByteGCM=t.supportsSubtleCrypto=t.supportsSecureRandom=t.supportsWebCrypto=void 0;var r=n(0),i=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function o(e){return"object"==typeof e&&"object"==typeof e.crypto&&"function"==typeof e.crypto.getRandomValues}function s(e){return e&&i.every((function(t){return"function"==typeof e[t]}))}t.supportsWebCrypto=function(e){return!(!o(e)||"object"!=typeof e.crypto.subtle)&&s(e.crypto.subtle)},t.supportsSecureRandom=o,t.supportsSubtleCrypto=s,t.supportsZeroByteGCM=function(e){return r.__awaiter(this,void 0,void 0,(function(){var t;return r.__generator(this,(function(n){switch(n.label){case 0:if(!s(e))return[2,!1];n.label=1;case 1:return n.trys.push([1,4,,5]),[4,e.generateKey({name:"AES-GCM",length:128},!1,["encrypt"])];case 2:return t=n.sent(),[4,e.encrypt({name:"AES-GCM",iv:new Uint8Array(Array(12)),additionalData:new Uint8Array(Array(16)),tagLength:128},t,new Uint8Array(0))];case 3:return[2,16===n.sent().byteLength];case 4:return n.sent(),[2,!1];case 5:return[2]}}))}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0);r.__exportStar(n(120),t),r.__exportStar(n(121),t),r.__exportStar(n(122),t),r.__exportStar(n(123),t),r.__exportStar(n(124),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isMsWindow=void 0;var r=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];t.isMsWindow=function(e){if(function(e){return"MSInputMethodContext"in e&&"msCrypto"in e}(e)&&void 0!==e.msCrypto.subtle){var t=e.msCrypto,n=t.getRandomValues,i=t.subtle;return r.map((function(e){return i[e]})).concat(n).every((function(e){return"function"==typeof e}))}return!1}},function(e,t){},function(e,t,n){"use strict";var r=n(14),i=n(61),o=n(127),s=n(67);function a(e){var t=new o(e),n=i(o.prototype.request,t);return r.extend(n,o.prototype,t),r.extend(n,t),n}var u=a(n(38));u.Axios=o,u.create=function(e){return a(s(u.defaults,e))},u.Cancel=n(68),u.CancelToken=n(141),u.isCancel=n(66),u.all=function(e){return Promise.all(e)},u.spread=n(142),u.isAxiosError=n(143),e.exports=u,e.exports.default=u},function(e,t,n){"use strict";var r=n(14),i=n(62),o=n(128),s=n(129),a=n(67),u=n(139),c=u.validators;function l(e){this.defaults=e,this.interceptors={request:new o,response:new o}}l.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&u.assertOptions(t,{silentJSONParsing:c.transitional(c.boolean,"1.0.0"),forcedJSONParsing:c.transitional(c.boolean,"1.0.0"),clarifyTimeoutError:c.transitional(c.boolean,"1.0.0")},!1);var n=[],r=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(r=r&&t.synchronous,n.unshift(t.fulfilled,t.rejected))}));var i,o=[];if(this.interceptors.response.forEach((function(e){o.push(e.fulfilled,e.rejected)})),!r){var l=[s,void 0];for(Array.prototype.unshift.apply(l,n),l=l.concat(o),i=Promise.resolve(e);l.length;)i=i.then(l.shift(),l.shift());return i}for(var f=e;n.length;){var d=n.shift(),h=n.shift();try{f=d(f)}catch(e){h(e);break}}try{i=s(f)}catch(e){return Promise.reject(e)}for(;o.length;)i=i.then(o.shift(),o.shift());return i},l.prototype.getUri=function(e){return e=a(this.defaults,e),i(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],(function(e){l.prototype[e]=function(t,n){return this.request(a(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(e){l.prototype[e]=function(t,n,r){return this.request(a(r||{},{method:e,url:t,data:n}))}})),e.exports=l},function(e,t,n){"use strict";var r=n(14);function i(){this.handlers=[]}i.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(e){r.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=i},function(e,t,n){"use strict";var r=n(14),i=n(130),o=n(66),s=n(38);function a(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return a(e),e.headers=e.headers||{},e.data=i.call(e,e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||s.adapter)(e).then((function(t){return a(e),t.data=i.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(a(e),t&&t.response&&(t.response.data=i.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,n){"use strict";var r=n(14),i=n(38);e.exports=function(e,t,n){var o=this||i;return r.forEach(n,(function(n){e=n.call(o,e,t)})),e}},function(e,t,n){"use strict";var r=n(14);e.exports=function(e,t){r.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))}},function(e,t,n){"use strict";var r=n(65);e.exports=function(e,t,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},function(e,t,n){"use strict";var r=n(14);e.exports=r.isStandardBrowserEnv()?{write:function(e,t,n,i,o,s){var a=[];a.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(i)&&a.push("path="+i),r.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,n){"use strict";var r=n(135),i=n(136);e.exports=function(e,t){return e&&!r(t)?i(e,t):t}},function(e,t,n){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,n){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";var r=n(14),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,o,s={};return e?(r.forEach(e.split("\n"),(function(e){if(o=e.indexOf(":"),t=r.trim(e.substr(0,o)).toLowerCase(),n=r.trim(e.substr(o+1)),t){if(s[t]&&i.indexOf(t)>=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([n]):s[t]?s[t]+", "+n:n}})),s):s}},function(e,t,n){"use strict";var r=n(14);e.exports=r.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=i(window.location.href),function(t){var n=r.isString(t)?i(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},function(e,t,n){"use strict";var r=n(140),i={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){i[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var o={},s=r.version.split(".");function a(e,t){for(var n=t?t.split("."):s,r=e.split("."),i=0;i<3;i++){if(n[i]>r[i])return!0;if(n[i]<r[i])return!1}return!1}i.transitional=function(e,t,n){var i=t&&a(t);function s(e,t){return"[Axios v"+r.version+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,r,a){if(!1===e)throw new Error(s(r," has been removed in "+t));return i&&!o[r]&&(o[r]=!0,console.warn(s(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,a)}},e.exports={isOlderVersion:a,assertOptions:function(e,t,n){if("object"!=typeof e)throw new TypeError("options must be an object");for(var r=Object.keys(e),i=r.length;i-- >0;){var o=r[i],s=t[o];if(s){var a=e[o],u=void 0===a||s(a,o,e);if(!0!==u)throw new TypeError("option "+o+" must be "+u)}else if(!0!==n)throw Error("Unknown option "+o)}},validators:i}},function(e){e.exports=JSON.parse('{"name":"axios","version":"0.21.4","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://axios-http.com","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.14.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]}')},function(e,t,n){"use strict";var r=n(68);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new r(e),t(n.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var e;return{token:new i((function(t){e=t})),cancel:e}},e.exports=i},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,n){"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(69),o=n(145),s=n(148),a=function(){function e(e){if(this.hash=new o.RawSha256,e){this.outer=new o.RawSha256;var t=function(e){var t=u(e);if(t.byteLength>i.BLOCK_SIZE){var n=new o.RawSha256;n.update(t),t=n.digest()}var r=new Uint8Array(i.BLOCK_SIZE);return r.set(t),r}(e),n=new Uint8Array(i.BLOCK_SIZE);n.set(t);for(var r=0;r<i.BLOCK_SIZE;r++)t[r]^=54,n[r]^=92;this.hash.update(t),this.outer.update(n);for(r=0;r<t.byteLength;r++)t[r]=0}}return e.prototype.update=function(e){if(!function(e){if("string"==typeof e)return 0===e.length;return 0===e.byteLength}(e)&&!this.error)try{this.hash.update(u(e))}catch(e){this.error=e}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.digestSync()]}))}))},e}();function u(e){return"string"==typeof e?s.fromUtf8(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.Sha256=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(69),i=function(){function e(){this.state=Int32Array.from(r.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,n=e.byteLength;if(this.bytesHashed+=n,8*this.bytesHashed>r.MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[t++],n--,this.bufferLength===r.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=8*this.bytesHashed,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(t.setUint8(this.bufferLength++,128),n%r.BLOCK_SIZE>=r.BLOCK_SIZE-8){for(var i=this.bufferLength;i<r.BLOCK_SIZE;i++)t.setUint8(i,0);this.hashBuffer(),this.bufferLength=0}for(i=this.bufferLength;i<r.BLOCK_SIZE-8;i++)t.setUint8(i,0);t.setUint32(r.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),t.setUint32(r.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}var o=new Uint8Array(r.DIGEST_LENGTH);for(i=0;i<8;i++)o[4*i]=this.state[i]>>>24&255,o[4*i+1]=this.state[i]>>>16&255,o[4*i+2]=this.state[i]>>>8&255,o[4*i+3]=this.state[i]>>>0&255;return o},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],u=t[5],c=t[6],l=t[7],f=0;f<r.BLOCK_SIZE;f++){if(f<16)this.temp[f]=(255&e[4*f])<<24|(255&e[4*f+1])<<16|(255&e[4*f+2])<<8|255&e[4*f+3];else{var d=this.temp[f-2],h=(d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,p=((d=this.temp[f-15])>>>7|d<<25)^(d>>>18|d<<14)^d>>>3;this.temp[f]=(h+this.temp[f-7]|0)+(p+this.temp[f-16]|0)}var v=(((a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7))+(a&u^~a&c)|0)+(l+(r.KEY[f]+this.temp[f]|0)|0)|0,y=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&i^n&o^i&o)|0;l=c,c=u,u=a,a=s+v|0,s=o,o=i,i=n,n=v+y|0}t[0]+=n,t[1]+=i,t[2]+=o,t[3]+=s,t[4]+=a,t[5]+=u,t[6]+=c,t[7]+=l},e}();t.RawSha256=i},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}Object.defineProperty(t,"__esModule",{value:!0}),t.Observable=void 0;var s=function(){return"function"==typeof Symbol},a=function(e){return s()&&Boolean(Symbol[e])},u=function(e){return a(e)?Symbol[e]:"@@"+e};s()&&!a("observable")&&(Symbol.observable=Symbol("observable"));var c=u("iterator"),l=u("observable"),f=u("species");function d(e,t){var n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function h(e){var t=e.constructor;return void 0!==t&&null===(t=t[f])&&(t=void 0),void 0!==t?t:E}function p(e){return e instanceof E}function v(e){v.log?v.log(e):setTimeout((function(){throw e}))}function y(e){Promise.resolve().then((function(){try{e()}catch(e){v(e)}}))}function g(e){var t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{var n=d(t,"unsubscribe");n&&n.call(t)}}catch(e){v(e)}}function m(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function b(e,t,n){e._state="running";var r=e._observer;try{var i=d(r,t);switch(t){case"next":i&&i.call(r,n);break;case"error":if(m(e),!i)throw n;i.call(r,n);break;case"complete":m(e),i&&i.call(r)}}catch(e){v(e)}"closed"===e._state?g(e):"running"===e._state&&(e._state="ready")}function w(e,t,n){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:n}],void y((function(){return function(e){var t=e._queue;if(t){e._queue=void 0,e._state="ready";for(var n=0;n<t.length&&(b(e,t[n].type,t[n].value),"closed"!==e._state);++n);}}(e)}))):void b(e,t,n);e._queue.push({type:t,value:n})}}var S=function(){function e(t,n){r(this,e),this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var i=new _(this);try{this._cleanup=n.call(void 0,i)}catch(e){i.error(e)}"initializing"===this._state&&(this._state="ready")}return o(e,[{key:"unsubscribe",value:function(){"closed"!==this._state&&(m(this),g(this))}},{key:"closed",get:function(){return"closed"===this._state}}]),e}(),_=function(){function e(t){r(this,e),this._subscription=t}return o(e,[{key:"next",value:function(e){w(this._subscription,"next",e)}},{key:"error",value:function(e){w(this._subscription,"error",e)}},{key:"complete",value:function(){w(this._subscription,"complete")}},{key:"closed",get:function(){return"closed"===this._subscription._state}}]),e}(),E=function(){function e(t){if(r(this,e),!(this instanceof e))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof t)throw new TypeError("Observable initializer must be a function");this._subscriber=t}return o(e,[{key:"subscribe",value:function(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new S(e,this._subscriber)}},{key:"forEach",value:function(e){var t=this;return new Promise((function(n,r){if("function"==typeof e)var i=t.subscribe({next:function(t){try{e(t,o)}catch(e){r(e),i.unsubscribe()}},error:r,complete:n});else r(new TypeError(e+" is not a function"));function o(){i.unsubscribe(),n()}}))}},{key:"map",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(h(this))((function(n){return t.subscribe({next:function(t){try{t=e(t)}catch(e){return n.error(e)}n.next(t)},error:function(e){n.error(e)},complete:function(){n.complete()}})}))}},{key:"filter",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(h(this))((function(n){return t.subscribe({next:function(t){try{if(!e(t))return}catch(e){return n.error(e)}n.next(t)},error:function(e){n.error(e)},complete:function(){n.complete()}})}))}},{key:"reduce",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=h(this),r=arguments.length>1,i=!1,o=arguments[1],s=o;return new n((function(n){return t.subscribe({next:function(t){var o=!i;if(i=!0,!o||r)try{s=e(s,t)}catch(e){return n.error(e)}else s=t},error:function(e){n.error(e)},complete:function(){if(!i&&!r)return n.error(new TypeError("Cannot reduce an empty sequence"));n.next(s),n.complete()}})}))}},{key:"concat",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=h(this);return new i((function(t){var r,o=0;return function e(s){r=s.subscribe({next:function(e){t.next(e)},error:function(e){t.error(e)},complete:function(){o===n.length?(r=void 0,t.complete()):e(i.from(n[o++]))}})}(e),function(){r&&(r.unsubscribe(),r=void 0)}}))}},{key:"flatMap",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=h(this);return new n((function(r){var i=[],o=t.subscribe({next:function(t){if(e)try{t=e(t)}catch(e){return r.error(e)}var o=n.from(t).subscribe({next:function(e){r.next(e)},error:function(e){r.error(e)},complete:function(){var e=i.indexOf(o);e>=0&&i.splice(e,1),s()}});i.push(o)},error:function(e){r.error(e)},complete:function(){s()}});function s(){o.closed&&0===i.length&&r.complete()}return function(){i.forEach((function(e){return e.unsubscribe()})),o.unsubscribe()}}))}},{key:l,value:function(){return this}}],[{key:"from",value:function(t){var n="function"==typeof this?this:e;if(null==t)throw new TypeError(t+" is not an object");var r=d(t,l);if(r){var i=r.call(t);if(Object(i)!==i)throw new TypeError(i+" is not an object");return p(i)&&i.constructor===n?i:new n((function(e){return i.subscribe(e)}))}if(a("iterator")&&(r=d(t,c)))return new n((function(e){y((function(){if(!e.closed){var n=!0,i=!1,o=void 0;try{for(var s,a=r.call(t)[Symbol.iterator]();!(n=(s=a.next()).done);n=!0){var u=s.value;if(e.next(u),e.closed)return}}catch(e){i=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(i)throw o}}e.complete()}}))}));if(Array.isArray(t))return new n((function(e){y((function(){if(!e.closed){for(var n=0;n<t.length;++n)if(e.next(t[n]),e.closed)return;e.complete()}}))}));throw new TypeError(t+" is not observable")}},{key:"of",value:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i="function"==typeof this?this:e;return new i((function(e){y((function(){if(!e.closed){for(var t=0;t<n.length;++t)if(e.next(n[t]),e.closed)return;e.complete()}}))}))}},{key:f,get:function(){return this}}]),e}();t.Observable=E,s()&&Object.defineProperty(E,Symbol("extensions"),{value:{symbol:l,hostReportError:v},configurable:!0})},function(e,t,n){"use strict";n.r(t),n.d(t,"DataStore",(function(){return ar})),n.d(t,"DataStoreClass",(function(){return sr})),n.d(t,"initSchema",(function(){return Kn})),n.d(t,"Predicates",(function(){return we.b})),n.d(t,"ModelPredicateCreator",(function(){return we.a})),n.d(t,"ModelSortPredicateCreator",(function(){return Se.a})),n.d(t,"utils",(function(){return ur})),n.d(t,"isSchemaModel",(function(){return fe.v})),n.d(t,"isAssociatedWith",(function(){return fe.k})),n.d(t,"isTargetNameAssociation",(function(){return fe.w})),n.d(t,"isModelAttributeAuth",(function(){return fe.n})),n.d(t,"isModelAttributeKey",(function(){return fe.p})),n.d(t,"isModelAttributePrimaryKey",(function(){return fe.q})),n.d(t,"isModelAttributeCompositeKey",(function(){return fe.o})),n.d(t,"ModelAttributeAuthAllow",(function(){return fe.e})),n.d(t,"ModelAttributeAuthProvider",(function(){return fe.f})),n.d(t,"GraphQLScalarType",(function(){return fe.c})),n.d(t,"isGraphQLScalarType",(function(){return fe.m})),n.d(t,"isModelFieldType",(function(){return fe.r})),n.d(t,"isNonModelFieldType",(function(){return fe.s})),n.d(t,"isEnumFieldType",(function(){return fe.l})),n.d(t,"OpType",(function(){return fe.h})),n.d(t,"isPredicateObj",(function(){return fe.u})),n.d(t,"isPredicateGroup",(function(){return fe.t})),n.d(t,"QueryOne",(function(){return fe.i})),n.d(t,"SortDirection",(function(){return fe.j})),n.d(t,"AuthModeStrategyType",(function(){return fe.a})),n.d(t,"ModelOperation",(function(){return fe.g})),n.d(t,"syncExpression",(function(){return fe.x})),n.d(t,"DISCARD",(function(){return fe.b})),n.d(t,"LimitTimerRaceResolvedValues",(function(){return fe.d}));var r=n(22),i=n(15),o=n(34),s=n(17);function a(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function u(e){return!!e&&!!e[Z]}function c(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===Q}(e)||Array.isArray(e)||!!e[$]||!!e.constructor[$]||y(e)||g(e))}function l(e,t,n){void 0===n&&(n=!1),0===f(e)?(n?Object.keys:X)(e).forEach((function(r){n&&"symbol"==typeof r||t(r,e[r],e)})):e.forEach((function(n,r){return t(r,n,e)}))}function f(e){var t=e[Z];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:y(e)?2:g(e)?3:0}function d(e,t){return 2===f(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function h(e,t){return 2===f(e)?e.get(t):e[t]}function p(e,t,n){var r=f(e);2===r?e.set(t,n):3===r?(e.delete(t),e.add(n)):e[t]=n}function v(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function y(e){return G&&e instanceof Map}function g(e){return W&&e instanceof Set}function m(e){return e.o||e.t}function b(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=ee(e);delete t[Z];for(var n=X(t),r=0;r<n.length;r++){var i=n[r],o=t[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(t[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function w(e,t){return void 0===t&&(t=!1),_(e)||u(e)||!c(e)||(f(e)>1&&(e.set=e.add=e.clear=e.delete=S),Object.freeze(e),t&&l(e,(function(e,t){return w(t,!0)}),!0)),e}function S(){a(2)}function _(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function E(e){var t=te[e];return t||a(18,e),t}function A(e,t){te[e]||(te[e]=t)}function O(){return V}function I(e,t){t&&(E("Patches"),e.u=[],e.s=[],e.v=t)}function T(e){C(e),e.p.forEach(P),e.p=null}function C(e){e===V&&(V=e.l)}function x(e){return V={p:[],l:V,h:e,m:!0,_:0}}function P(e){var t=e[Z];0===t.i||1===t.i?t.j():t.O=!0}function k(e,t){t._=t.p.length;var n=t.p[0],r=void 0!==e&&e!==n;return t.h.g||E("ES5").S(t,e,r),r?(n[Z].P&&(T(t),a(4)),c(e)&&(e=N(t,e),t.l||j(t,e)),t.u&&E("Patches").M(n[Z],e,t.u,t.s)):e=N(t,n,[]),T(t),t.u&&t.v(t.u,t.s),e!==J?e:void 0}function N(e,t,n){if(_(t))return t;var r=t[Z];if(!r)return l(t,(function(i,o){return M(e,r,t,i,o,n)}),!0),t;if(r.A!==e)return t;if(!r.P)return j(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=4===r.i||5===r.i?r.o=b(r.k):r.o;l(3===r.i?new Set(i):i,(function(t,o){return M(e,r,i,t,o,n)})),j(e,i,!1),n&&e.u&&E("Patches").R(r,n,e.u,e.s)}return r.o}function M(e,t,n,r,i,o){if(u(i)){var s=N(e,i,o&&t&&3!==t.i&&!d(t.D,r)?o.concat(r):void 0);if(p(n,r,s),!u(s))return;e.m=!1}if(c(i)&&!_(i)){if(!e.h.F&&e._<1)return;N(e,i),t&&t.A.l||j(e,i)}}function j(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&w(t,n)}function R(e,t){var n=e[Z];return(n?m(n):e)[t]}function D(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function U(e){e.P||(e.P=!0,e.l&&U(e.l))}function F(e){e.o||(e.o=b(e.t))}function L(e,t,n){var r=y(t)?E("MapSet").N(t,n):g(t)?E("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),r={i:n?1:0,A:t?t.A:O(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=r,o=ne;n&&(i=[r],o=re);var s=Proxy.revocable(i,o),a=s.revoke,u=s.proxy;return r.k=u,r.j=a,u}(t,n):E("ES5").J(t,n);return(n?n.A:O()).p.push(r),r}function B(e){return u(e)||a(22,e),function e(t){if(!c(t))return t;var n,r=t[Z],i=f(t);if(r){if(!r.P&&(r.i<4||!E("ES5").K(r)))return r.t;r.I=!0,n=q(t,i),r.I=!1}else n=q(t,i);return l(n,(function(t,i){r&&h(r.t,t)===i||p(n,t,e(i))})),3===i?new Set(n):n}(e)}function q(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return b(e)}function z(){function e(t){if(!c(t))return t;if(Array.isArray(t))return t.map(e);if(y(t))return new Map(Array.from(t.entries()).map((function(t){return[t[0],e(t[1])]})));if(g(t))return new Set(Array.from(t).map(e));var n=Object.create(Object.getPrototypeOf(t));for(var r in t)n[r]=e(t[r]);return d(t,$)&&(n[$]=t[$]),n}function t(t){return u(t)?e(t):t}var n="add";A("Patches",{$:function(t,r){return r.forEach((function(r){for(var i=r.path,o=r.op,s=t,u=0;u<i.length-1;u++){var c=f(s),l=""+i[u];0!==c&&1!==c||"__proto__"!==l&&"constructor"!==l||a(24),"function"==typeof s&&"prototype"===l&&a(24),"object"!=typeof(s=h(s,l))&&a(15,i.join("/"))}var d=f(s),p=e(r.value),v=i[i.length-1];switch(o){case"replace":switch(d){case 2:return s.set(v,p);case 3:a(16);default:return s[v]=p}case n:switch(d){case 1:return s.splice(v,0,p);case 2:return s.set(v,p);case 3:return s.add(p);default:return s[v]=p}case"remove":switch(d){case 1:return s.splice(v,1);case 2:return s.delete(v);case 3:return s.delete(r.value);default:return delete s[v]}default:a(17,o)}})),t},R:function(e,r,i,o){switch(e.i){case 0:case 4:case 2:return function(e,r,i,o){var s=e.t,a=e.o;l(e.D,(function(e,u){var c=h(s,e),l=h(a,e),f=u?d(s,e)?"replace":n:"remove";if(c!==l||"replace"!==f){var p=r.concat(e);i.push("remove"===f?{op:f,path:p}:{op:f,path:p,value:l}),o.push(f===n?{op:"remove",path:p}:"remove"===f?{op:n,path:p,value:t(c)}:{op:"replace",path:p,value:t(c)})}}))}(e,r,i,o);case 5:case 1:return function(e,r,i,o){var s=e.t,a=e.D,u=e.o;if(u.length<s.length){var c=[u,s];s=c[0],u=c[1];var l=[o,i];i=l[0],o=l[1]}for(var f=0;f<s.length;f++)if(a[f]&&u[f]!==s[f]){var d=r.concat([f]);i.push({op:"replace",path:d,value:t(u[f])}),o.push({op:"replace",path:d,value:t(s[f])})}for(var h=s.length;h<u.length;h++){var p=r.concat([h]);i.push({op:n,path:p,value:t(u[h])})}s.length<u.length&&o.push({op:"replace",path:r.concat(["length"]),value:s.length})}(e,r,i,o);case 3:return function(e,t,r,i){var o=e.t,s=e.o,a=0;o.forEach((function(e){if(!s.has(e)){var o=t.concat([a]);r.push({op:"remove",path:o,value:e}),i.unshift({op:n,path:o,value:e})}a++})),a=0,s.forEach((function(e){if(!o.has(e)){var s=t.concat([a]);r.push({op:n,path:s,value:e}),i.unshift({op:"remove",path:s,value:e})}a++}))}(e,r,i,o)}},M:function(e,t,n,r){n.push({op:"replace",path:[],value:t===J?void 0:t}),r.push({op:"replace",path:[],value:e.t})}})}var K,V,H="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),G="undefined"!=typeof Map,W="undefined"!=typeof Set,Y="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,J=H?Symbol.for("immer-nothing"):((K={})["immer-nothing"]=!0,K),$=H?Symbol.for("immer-draftable"):"__$immer_draftable",Z=H?Symbol.for("immer-state"):"__$immer_state",Q=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),X="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,ee=Object.getOwnPropertyDescriptors||function(e){var t={};return X(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},te={},ne={get:function(e,t){if(t===Z)return e;var n=m(e);if(!d(n,t))return function(e,t,n){var r,i=D(t,n);return i?"value"in i?i.value:null===(r=i.get)||void 0===r?void 0:r.call(e.k):void 0}(e,n,t);var r=n[t];return e.I||!c(r)?r:r===R(e.t,t)?(F(e),e.o[t]=L(e.A.h,r,e)):r},has:function(e,t){return t in m(e)},ownKeys:function(e){return Reflect.ownKeys(m(e))},set:function(e,t,n){var r=D(m(e),t);if(null==r?void 0:r.set)return r.set.call(e.k,n),!0;if(!e.P){var i=R(m(e),t),o=null==i?void 0:i[Z];if(o&&o.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(v(n,i)&&(void 0!==n||d(e.t,t)))return!0;F(e),U(e)}return e.o[t]===n&&"number"!=typeof n&&(void 0!==n||t in e.o)||(e.o[t]=n,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==R(e.t,t)||t in e.t?(e.D[t]=!1,F(e),U(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=m(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty:function(){a(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){a(12)}},re={};l(ne,(function(e,t){re[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),re.deleteProperty=function(e,t){return ne.deleteProperty.call(this,e[0],t)},re.set=function(e,t,n){return ne.set.call(this,e[0],t,n,e[0])};var ie=new(function(){function e(e){var t=this;this.g=Y,this.F=!0,this.produce=function(e,n,r){if("function"==typeof e&&"function"!=typeof n){var i=n;n=e;var o=t;return function(e){var t=this;void 0===e&&(e=i);for(var r=arguments.length,s=Array(r>1?r-1:0),a=1;a<r;a++)s[a-1]=arguments[a];return o.produce(e,(function(e){var r;return(r=n).call.apply(r,[t,e].concat(s))}))}}var s;if("function"!=typeof n&&a(6),void 0!==r&&"function"!=typeof r&&a(7),c(e)){var u=x(t),l=L(t,e,void 0),f=!0;try{s=n(l),f=!1}finally{f?T(u):C(u)}return"undefined"!=typeof Promise&&s instanceof Promise?s.then((function(e){return I(u,r),k(e,u)}),(function(e){throw T(u),e})):(I(u,r),k(s,u))}if(!e||"object"!=typeof e){if((s=n(e))===J)return;return void 0===s&&(s=e),t.F&&w(s,!0),s}a(21,e)},this.produceWithPatches=function(e,n){return"function"==typeof e?function(n){for(var r=arguments.length,i=Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(i))}))}:[t.produce(e,n,(function(e,t){r=e,i=t})),r,i];var r,i},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){c(e)||a(8),u(e)&&(e=B(e));var t=x(this),n=L(this,e,void 0);return n[Z].C=!0,C(t),n},t.finishDraft=function(e,t){var n=(e&&e[Z]).A;return I(n,t),k(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!Y&&a(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}var i=E("Patches").$;return u(e)?i(e,t):this.produce(e,(function(e){return i(e,t.slice(n+1))}))},e}()),oe=ie.produce,se=(ie.produceWithPatches.bind(ie),ie.setAutoFreeze.bind(ie)),ae=(ie.setUseProxies.bind(ie),ie.applyPatches.bind(ie),ie.createDraft.bind(ie),ie.finishDraft.bind(ie),n(33)),ue=n(10),ce=n(18),le=n(12),fe=n(1),de=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},he=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},pe=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},ve=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(pe(arguments[t]));return e};function ye(e){return"private"!==e.allow||e.provider?"public"!==e.allow||e.provider?e.provider:fe.f.API_KEY:fe.f.USER_POOLS}function ge(e){var t=e.rules,n=e.currentUser,r=new Set;return t.forEach((function(e){switch(e.allow){case fe.e.CUSTOM:e.provider&&e.provider!==fe.f.FUNCTION||r.add(le.a.AWS_LAMBDA);break;case fe.e.GROUPS:case fe.e.OWNER:n&&(e.provider===fe.f.USER_POOLS?r.add(le.a.AMAZON_COGNITO_USER_POOLS):e.provider===fe.f.OIDC&&r.add(le.a.OPENID_CONNECT));break;case fe.e.PRIVATE:n&&(e.provider&&e.provider!==fe.f.USER_POOLS?e.provider===fe.f.IAM&&r.add(le.a.AWS_IAM):r.add(le.a.AMAZON_COGNITO_USER_POOLS));break;case fe.e.PUBLIC:e.provider===fe.f.IAM?r.add(le.a.AWS_IAM):e.provider&&e.provider!==fe.f.API_KEY||r.add(le.a.API_KEY)}})),Array.from(r)}var me=function(e){var t=e.schema,n=e.modelName;return de(void 0,void 0,void 0,(function(){var e,r,i,o;return he(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,ce.a.currentAuthenticatedUser()];case 1:return e=s.sent(),[3,3];case 2:return s.sent(),[3,3];case 3:return(r=t.namespaces.user.models[n].attributes)&&(i=r.find((function(e){return"auth"===e.type}))).properties&&i.properties.rules?(a=i.properties.rules,u=[fe.e.CUSTOM,fe.e.OWNER,fe.e.GROUPS,fe.e.PRIVATE,fe.e.PUBLIC],c=[fe.f.FUNCTION,fe.f.USER_POOLS,fe.f.OIDC,fe.f.IAM,fe.f.API_KEY],o=ve(a).sort((function(e,t){return e.allow===t.allow?c.indexOf(ye(e))-c.indexOf(ye(t)):u.indexOf(e.allow)-u.indexOf(t.allow)})),[2,ge({currentUser:e,rules:o})]):[2,[]]}var a,u,c}))}))},be=function(){return[]},we=n(4),Se=n(51),_e=function(){function e(){this._queue=[],this._pending=!1}return e.prototype.isLocked=function(){return this._pending},e.prototype.acquire=function(){var e=this,t=new Promise((function(t){return e._queue.push(t)}));return this._pending||this._dispatchNext(),t},e.prototype.runExclusive=function(e){return this.acquire().then((function(t){var n;try{n=e()}catch(e){throw t(),e}return Promise.resolve(n).then((function(e){return t(),e}),(function(e){throw t(),e}))}))},e.prototype._dispatchNext=function(){this._queue.length>0?(this._pending=!0,this._queue.shift()(this._dispatchNext.bind(this))):this._pending=!1},e}(),Ee=n(73),Ae=n.n(Ee),Oe=n(2);let Ie,Te;const Ce=new WeakMap,xe=new WeakMap,Pe=new WeakMap,ke=new WeakMap,Ne=new WeakMap;let Me={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return xe.get(e);if("objectStoreNames"===t)return e.objectStoreNames||Pe.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return De(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function je(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(Te||(Te=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(Ue(this),t),De(Ce.get(this))}:function(...t){return De(e.apply(Ue(this),t))}:function(t,...n){const r=e.call(Ue(this),t,...n);return Pe.set(r,t.sort?t.sort():[t]),De(r)}}function Re(e){return"function"==typeof e?je(e):(e instanceof IDBTransaction&&function(e){if(xe.has(e))return;const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",o),e.removeEventListener("abort",o)},i=()=>{t(),r()},o=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",o),e.addEventListener("abort",o)});xe.set(e,t)}(e),t=e,(Ie||(Ie=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>t instanceof e)?new Proxy(e,Me):e);var t}function De(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",o)},i=()=>{t(De(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",o)});return t.then(t=>{t instanceof IDBCursor&&Ce.set(t,e)}).catch(()=>{}),Ne.set(t,e),t}(e);if(ke.has(e))return ke.get(e);const t=Re(e);return t!==e&&(ke.set(e,t),Ne.set(t,e)),t}const Ue=e=>Ne.get(e);function Fe(e,t,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){const s=indexedDB.open(e,t),a=De(s);return r&&s.addEventListener("upgradeneeded",e=>{r(De(s.result),e.oldVersion,e.newVersion,De(s.transaction))}),n&&s.addEventListener("blocked",()=>n()),a.then(e=>{o&&e.addEventListener("close",()=>o()),i&&e.addEventListener("versionchange",()=>i())}).catch(()=>{}),a}function Le(e,{blocked:t}={}){const n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",()=>t()),De(n).then(()=>{})}const Be=["get","getKey","getAll","getAllKeys","count"],qe=["put","add","delete","clear"],ze=new Map;function Ke(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(ze.get(t))return ze.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=qe.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!Be.includes(n))return;const o=async function(e,...t){const o=this.transaction(e,i?"readwrite":"readonly");let s=o.store;r&&(s=s.index(t.shift()));const a=await s[n](...t);return i&&await o.done,a};return ze.set(t,o),o}function Ve(e){return(Ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Me=(e=>({...e,get:(t,n,r)=>Ke(t,n)||e.get(t,n,r),has:(t,n)=>!!Ke(t,n)||e.has(t,n)}))(Me);var He=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},Ge=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},We=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof Ye?Ye(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}},Ye=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Je=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},$e=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Je(arguments[t]));return e},Ze=new r.a("DataStore"),Qe=new(function(){function e(){this.dbName="amplify-datastore"}return e.prototype.checkPrivate=function(){return He(this,void 0,void 0,(function(){return Ge(this,(function(e){switch(e.label){case 0:return[4,Object(Oe.w)().then((function(e){return e}))];case 1:return e.sent()?(Ze.error("IndexedDB not supported in this browser's private mode"),[2,Promise.reject("IndexedDB not supported in this browser's private mode")]):[2,Promise.resolve()]}}))}))},e.prototype.getStorenameForModel=function(e){var t=this.namespaceResolver(e),n=e.name;return this.getStorename(t,n)},e.prototype.getStorename=function(e,t){return e+"_"+t},e.prototype.setUp=function(e,t,n,r,i){return He(this,void 0,void 0,(function(){var o,s,a=this;return Ge(this,(function(u){switch(u.label){case 0:return[4,this.checkPrivate()];case 1:return u.sent(),this.initPromise?[3,2]:(this.initPromise=new Promise((function(e,t){a.resolve=e,a.reject=t})),[3,4]);case 2:return[4,this.initPromise];case 3:u.sent(),u.label=4;case 4:i&&(this.dbName="amplify-datastore-"+i),this.schema=e,this.namespaceResolver=t,this.modelInstanceCreator=n,this.getModelConstructorByModelName=r,u.label=5;case 5:return u.trys.push([5,8,,9]),this.db?[3,7]:(2,o=this,[4,Fe(this.dbName,2,{upgrade:function(t,n,r,i){return He(a,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h,p,v,y,g=this;return Ge(this,(function(m){switch(m.label){case 0:if(0===n)return Object.keys(e.namespaces).forEach((function(n){var r=e.namespaces[n];Object.keys(r.models).forEach((function(e){var r=g.getStorename(n,e),i=t.createObjectStore(r,{autoIncrement:!0});g.schema.namespaces[n].relationships[e].indexes.forEach((function(e){return i.createIndex(e,e)})),i.createIndex("byId","id",{unique:!0})}))})),[2];if(1!==n||2!==r)return[3,16];m.label=1;case 1:m.trys.push([1,14,,15]),m.label=2;case 2:m.trys.push([2,11,12,13]),o=Ye(i.objectStoreNames),s=o.next(),m.label=3;case 3:return s.done?[3,10]:(a=s.value,u=i.objectStore(a),c="tmp_"+a,u.name=c,(l=t.createObjectStore(a,{keyPath:void 0,autoIncrement:!0})).createIndex("byId","id",{unique:!0}),[4,u.openCursor()]);case 4:f=m.sent(),d=0,m.label=5;case 5:return f&&f.value?[4,l.put(f.value)]:[3,8];case 6:return m.sent(),[4,f.continue()];case 7:return f=m.sent(),d++,[3,5];case 8:t.deleteObjectStore(c),Ze.debug(d+" "+a+" records migrated"),m.label=9;case 9:return s=o.next(),[3,3];case 10:return[3,13];case 11:return h=m.sent(),v={error:h},[3,13];case 12:try{s&&!s.done&&(y=o.return)&&y.call(o)}finally{if(v)throw v.error}return[7];case 13:return[3,15];case 14:throw p=m.sent(),Ze.error("Error migrating IndexedDB data",p),i.abort(),p;case 15:case 16:return[2]}}))}))}})]);case 6:o.db=u.sent(),this.resolve(),u.label=7;case 7:return[3,9];case 8:return s=u.sent(),this.reject(s),[3,9];case 9:return[2]}}))}))},e.prototype._get=function(e,t){return He(this,void 0,void 0,(function(){var n,r;return Ge(this,(function(i){switch(i.label){case 0:return"string"==typeof e?(r=e,n=this.db.transaction(r,"readonly").store.index("byId")):n=e.index("byId"),[4,n.get(t)];case 1:return[2,i.sent()]}}))}))},e.prototype.save=function(e,t){var n,r;return He(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p,v,y,g,m,b,w,S,_,E,A,O,I,T,C,x,P=this;return Ge(this,(function(k){switch(k.label){case 0:return[4,this.checkPrivate()];case 1:return k.sent(),i=Object.getPrototypeOf(e).constructor,o=this.getStorenameForModel(i),s=Object(Oe.A)(i.name,e,this.schema.namespaces[this.namespaceResolver(i)],this.modelInstanceCreator,this.getModelConstructorByModelName),a=this.namespaceResolver(i),u=new Set,c=Object.values(s).map((function(e){var t=e.modelName,n=e.item,r=e.instance,i=P.getStorename(a,t);return u.add(i),{storeName:i,item:n,instance:r}})),l=this.db.transaction($e([o],Array.from(u.values())),"readwrite"),f=l.objectStore(o),[4,this._get(f,e.id)];case 2:if(d=k.sent(),t&&d&&(h=we.a.getPredicates(t),p=h.predicates,v=h.type,!Object(Oe.B)(d,v,p)))throw y="Conditional update failed",Ze.error(y,{model:d,condition:p}),new Error(y);g=[],k.label=3;case 3:k.trys.push([3,11,12,17]),m=We(c),k.label=4;case 4:return[4,m.next()];case 5:return(b=k.sent()).done?[3,10]:(w=b.value,S=w.storeName,_=w.item,E=w.instance,A=l.objectStore(S),O=_.id,[4,this._get(A,O)]);case 6:return I=k.sent(),T=void 0===I?fe.h.INSERT:fe.h.UPDATE,O!==e.id&&T!==fe.h.INSERT?[3,9]:[4,A.index("byId").getKey(_.id)];case 7:return C=k.sent(),[4,A.put(_,C)];case 8:k.sent(),g.push([E,T]),k.label=9;case 9:return[3,4];case 10:return[3,17];case 11:return x=k.sent(),n={error:x},[3,17];case 12:return k.trys.push([12,,15,16]),b&&!b.done&&(r=m.return)?[4,r.call(m)]:[3,14];case 13:k.sent(),k.label=14;case 14:return[3,16];case 15:if(n)throw n.error;return[7];case 16:return[7];case 17:return[4,l.done];case 18:return k.sent(),[2,g]}}))}))},e.prototype.load=function(e,t,n){var r,i,o,s,a,u,c,l,f,d;return He(this,void 0,void 0,(function(){var h,p,v,y,g,m,b,w,S,_,E,A,O,I,T,C,x,P,k,N,M=this;return Ge(this,(function(j){switch(j.label){case 0:if(h=this.schema.namespaces[e],p=h.relationships[t].relationTypes,v=p.map((function(t){var n=t.modelName;return M.getStorename(e,n)})),y=this.getModelConstructorByModelName(e,t),0===v.length)return[2,n.map((function(e){return M.modelInstanceCreator(y,e)}))];g=this.db.transaction($e(v),"readonly"),j.label=1;case 1:j.trys.push([1,34,35,40]),m=We(p),j.label=2;case 2:return[4,m.next()];case 3:if((b=j.sent()).done)return[3,33];switch(w=b.value,S=w.fieldName,_=w.modelName,E=w.targetName,A=this.getStorename(e,_),O=g.objectStore(A),I=this.getModelConstructorByModelName(e,_),w.relationType){case"HAS_ONE":return[3,4];case"BELONGS_TO":return[3,17];case"HAS_MANY":return[3,30]}return[3,31];case 4:j.trys.push([4,10,11,16]),r=We(n),j.label=5;case 5:return[4,r.next()];case 6:return(i=j.sent()).done?[3,9]:(x=i.value,T=x[E]?E:S,x[T]?[4,this._get(O,x[T])]:[3,9]);case 7:P=j.sent(),x[S]=P&&this.modelInstanceCreator(I,P),j.label=8;case 8:return[3,5];case 9:return[3,16];case 10:return C=j.sent(),c={error:C},[3,16];case 11:return j.trys.push([11,,14,15]),i&&!i.done&&(l=r.return)?[4,l.call(r)]:[3,13];case 12:j.sent(),j.label=13;case 13:return[3,15];case 14:if(c)throw c.error;return[7];case 15:return[7];case 16:return[3,32];case 17:j.trys.push([17,23,24,29]),o=We(n),j.label=18;case 18:return[4,o.next()];case 19:return(s=j.sent()).done?[3,22]:(x=s.value)[E]?[4,this._get(O,x[E])]:[3,21];case 20:P=j.sent(),x[S]=P&&this.modelInstanceCreator(I,P),delete x[E],j.label=21;case 21:return[3,18];case 22:return[3,29];case 23:return k=j.sent(),f={error:k},[3,29];case 24:return j.trys.push([24,,27,28]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,26];case 25:j.sent(),j.label=26;case 26:return[3,28];case 27:if(f)throw f.error;return[7];case 28:return[7];case 29:case 30:return[3,32];case 31:return Object(Oe.g)(w.relationType),[3,32];case 32:return[3,2];case 33:return[3,40];case 34:return N=j.sent(),a={error:N},[3,40];case 35:return j.trys.push([35,,38,39]),b&&!b.done&&(u=m.return)?[4,u.call(m)]:[3,37];case 36:j.sent(),j.label=37;case 37:return[3,39];case 38:if(a)throw a.error;return[7];case 39:return[7];case 40:return[2,n.map((function(e){return M.modelInstanceCreator(y,e)}))]}}))}))},e.prototype.query=function(e,t,n){return He(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l=this;return Ge(this,(function(f){switch(f.label){case 0:return[4,this.checkPrivate()];case 1:return f.sent(),r=this.getStorenameForModel(e),i=this.namespaceResolver(e),o=t&&we.a.getPredicates(t),s=o&&this.idFromPredicate(o),a=n&&n.sort,u=n&&n.limit,[4,He(l,void 0,void 0,(function(){var e,t,i;return Ge(this,(function(c){switch(c.label){case 0:return s?[4,this.getById(r,s)]:[3,2];case 1:return[2,(e=c.sent())?[e]:[]];case 2:return o?[4,this.filterOnPredicate(r,o)]:[3,4];case 3:return t=c.sent(),[2,this.inMemoryPagination(t,n)];case 4:return a?[4,this.getAll(r)]:[3,6];case 5:return i=c.sent(),[2,this.inMemoryPagination(i,n)];case 6:return u?[2,this.enginePagination(r,n)]:[2,this.getAll(r)]}}))}))];case 2:return c=f.sent(),[4,this.load(i,e.name,c)];case 3:return[2,f.sent()]}}))}))},e.prototype.getById=function(e,t){return He(this,void 0,void 0,(function(){return Ge(this,(function(n){switch(n.label){case 0:return[4,this._get(e,t)];case 1:return[2,n.sent()]}}))}))},e.prototype.getAll=function(e){return He(this,void 0,void 0,(function(){return Ge(this,(function(t){switch(t.label){case 0:return[4,this.db.getAll(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.idFromPredicate=function(e){var t=e.predicates,n=1===t.length&&t.find((function(e){return Object(fe.u)(e)&&"id"===e.field&&"eq"===e.operator}));return n&&n.operand},e.prototype.filterOnPredicate=function(e,t){return He(this,void 0,void 0,(function(){var n,r,i;return Ge(this,(function(o){switch(o.label){case 0:return n=t.predicates,r=t.type,[4,this.getAll(e)];case 1:return i=o.sent(),[2,n?i.filter((function(e){return Object(Oe.B)(e,r,n)})):i]}}))}))},e.prototype.inMemoryPagination=function(e,t){if(t&&e.length>1){if(t.sort){var n=Se.a.getPredicates(t.sort);if(n.length){var r=Object(Oe.z)(n);e.sort(r)}}var i=t.page,o=void 0===i?0:i,s=t.limit,a=void 0===s?0:s,u=Math.max(0,o*a)||0,c=a>0?u+a:e.length;return e.slice(u,c)}return e},e.prototype.enginePagination=function(e,t){return He(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l;return Ge(this,(function(f){switch(f.label){case 0:return t?(r=t.page,i=void 0===r?0:r,o=t.limit,s=void 0===o?0:o,a=Math.max(0,i*s)||0,[4,this.db.transaction(e).objectStore(e).openCursor()]):[3,7];case 1:return(u=f.sent())&&a>0?[4,u.advance(a)]:[3,3];case 2:f.sent(),f.label=3;case 3:c=[],l="number"==typeof s&&s>0,f.label=4;case 4:return u&&u.value?(c.push(u.value),l&&c.length===s?[3,6]:[4,u.continue()]):[3,6];case 5:return u=f.sent(),[3,4];case 6:return n=c,[3,9];case 7:return[4,this.db.getAll(e)];case 8:n=f.sent(),f.label=9;case 9:return[2,n]}}))}))},e.prototype.queryOne=function(e,t){return void 0===t&&(t=fe.i.FIRST),He(this,void 0,void 0,(function(){var n,r,i;return Ge(this,(function(o){switch(o.label){case 0:return[4,this.checkPrivate()];case 1:return o.sent(),n=this.getStorenameForModel(e),[4,this.db.transaction([n],"readonly").objectStore(n).openCursor(void 0,t===fe.i.FIRST?"next":"prev")];case 2:return r=o.sent(),[2,(i=r?r.value:void 0)&&this.modelInstanceCreator(e,i)]}}))}))},e.prototype.delete=function(e,t){return He(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return Ge(this,(function(g){switch(g.label){case 0:return[4,this.checkPrivate()];case 1:return g.sent(),n=[],Object(Oe.t)(e)?(o=e,s=this.namespaceResolver(o),a=this.getStorenameForModel(o),[4,this.query(o,t)]):[3,9];case 2:return r=g.sent(),v=this.schema.namespaces[s].relationships[o.name].relationTypes,void 0===t?[3,5]:[4,this.deleteTraverse(v,r,o.name,s,n)];case 3:return g.sent(),[4,this.deleteItem(n)];case 4:return g.sent(),y=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[r,y]];case 5:return[4,this.deleteTraverse(v,r,o.name,s,n)];case 6:return g.sent(),[4,this.db.transaction([a],"readwrite").objectStore(a).clear()];case 7:return g.sent(),y=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[r,y]];case 8:return[3,17];case 9:return i=e,o=Object.getPrototypeOf(i).constructor,s=this.namespaceResolver(o),a=this.getStorenameForModel(o),t?(u=this.db.transaction([a],"readwrite"),c=u.objectStore(a),[4,this._get(c,i.id)]):[3,13];case 10:if(void 0===(l=g.sent()))return p="Model instance not found in storage",Ze.warn(p,{model:i}),[2,[[i],[]]];if(f=we.a.getPredicates(t),d=f.predicates,h=f.type,!Object(Oe.B)(l,h,d))throw p="Conditional update failed",Ze.error(p,{model:l,condition:d}),new Error(p);return[4,u.done];case 11:return g.sent(),v=this.schema.namespaces[s].relationships[o.name].relationTypes,[4,this.deleteTraverse(v,[i],o.name,s,n)];case 12:return g.sent(),[3,15];case 13:return v=this.schema.namespaces[s].relationships[o.name].relationTypes,[4,this.deleteTraverse(v,[i],o.name,s,n)];case 14:g.sent(),g.label=15;case 15:return[4,this.deleteItem(n)];case 16:return g.sent(),y=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[[i],y]];case 17:return[2]}}))}))},e.prototype.deleteItem=function(e){var t,n,r,i,o,s;return He(this,void 0,void 0,(function(){var a,u,c,l,f,d,h,p,v,y,g,m;return Ge(this,(function(b){switch(b.label){case 0:a=e.map((function(e){return e.storeName})),u=this.db.transaction($e(a),"readwrite"),b.label=1;case 1:b.trys.push([1,22,23,28]),t=We(e),b.label=2;case 2:return[4,t.next()];case 3:if((n=b.sent()).done)return[3,21];c=n.value,l=c.storeName,f=c.items,d=u.objectStore(l),b.label=4;case 4:b.trys.push([4,14,15,20]),h=We(f),b.label=5;case 5:return[4,h.next()];case 6:return(p=b.sent()).done?[3,13]:(v=p.value)?(y=void 0,"object"!==Ve(v)?[3,8]:[4,d.index("byId").getKey(v.id)]):[3,12];case 7:return y=b.sent(),[3,10];case 8:return[4,d.index("byId").getKey(v.toString())];case 9:y=b.sent(),b.label=10;case 10:return void 0===y?[3,12]:[4,d.delete(y)];case 11:b.sent(),b.label=12;case 12:return[3,5];case 13:return[3,20];case 14:return g=b.sent(),o={error:g},[3,20];case 15:return b.trys.push([15,,18,19]),p&&!p.done&&(s=h.return)?[4,s.call(h)]:[3,17];case 16:b.sent(),b.label=17;case 17:return[3,19];case 18:if(o)throw o.error;return[7];case 19:return[7];case 20:return[3,2];case 21:return[3,28];case 22:return m=b.sent(),r={error:m},[3,28];case 23:return b.trys.push([23,,26,27]),n&&!n.done&&(i=t.return)?[4,i.call(t)]:[3,25];case 24:b.sent(),b.label=25;case 25:return[3,27];case 26:if(r)throw r.error;return[7];case 27:return[7];case 28:return[2]}}))}))},e.prototype.deleteTraverse=function(e,t,n,r,i){var o,s,a,u,c,l,f,d,h,p,v,y;return He(this,void 0,void 0,(function(){var g,m,b,w,S,_,E,A,O,I,T,C,x,P,k=this;return Ge(this,(function(N){switch(N.label){case 0:N.trys.push([0,35,36,41]),o=We(e),N.label=1;case 1:return[4,o.next()];case 2:if((s=N.sent()).done)return[3,34];switch(g=s.value,m=g.relationType,g.fieldName,b=g.modelName,w=g.targetName,S=this.getStorename(r,b),_=Object(Oe.h)(this.schema.namespaces[r].relationships[b].relationTypes,n)||Object(Oe.i)(this.schema.namespaces[r].relationships[b].indexes,g.associatedWith),m){case"HAS_ONE":return[3,3];case"HAS_MANY":return[3,17];case"BELONGS_TO":return[3,31]}return[3,32];case 3:N.trys.push([3,10,11,16]),a=We(t),N.label=4;case 4:return[4,a.next()];case 5:return(u=N.sent()).done?[3,9]:(T=u.value,E=_||"byId",(A=w in T?T[w]:T.id)?[4,this.db.transaction(S,"readwrite").objectStore(S).index(E).get(A)]:[3,9]);case 6:return O=N.sent(),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,O?[O]:[],b,r,i)];case 7:N.sent(),N.label=8;case 8:return[3,4];case 9:return[3,16];case 10:return I=N.sent(),h={error:I},[3,16];case 11:return N.trys.push([11,,14,15]),u&&!u.done&&(p=a.return)?[4,p.call(a)]:[3,13];case 12:N.sent(),N.label=13;case 13:return[3,15];case 14:if(h)throw h.error;return[7];case 15:return[7];case 16:return[3,33];case 17:N.trys.push([17,24,25,30]),c=We(t),N.label=18;case 18:return[4,c.next()];case 19:return(l=N.sent()).done?[3,23]:(T=l.value,[4,this.db.transaction(S,"readwrite").objectStore(S).index(_).getAll(T.id)]);case 20:return C=N.sent(),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,C,b,r,i)];case 21:N.sent(),N.label=22;case 22:return[3,18];case 23:return[3,30];case 24:return x=N.sent(),v={error:x},[3,30];case 25:return N.trys.push([25,,28,29]),l&&!l.done&&(y=c.return)?[4,y.call(c)]:[3,27];case 26:N.sent(),N.label=27;case 27:return[3,29];case 28:if(v)throw v.error;return[7];case 29:return[7];case 30:case 31:return[3,33];case 32:return Object(Oe.g)(m),[3,33];case 33:return[3,1];case 34:return[3,41];case 35:return P=N.sent(),f={error:P},[3,41];case 36:return N.trys.push([36,,39,40]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,38];case 37:N.sent(),N.label=38;case 38:return[3,40];case 39:if(f)throw f.error;return[7];case 40:return[7];case 41:return i.push({storeName:this.getStorename(r,n),items:t.map((function(e){return k.modelInstanceCreator(k.getModelConstructorByModelName(r,n),e)}))}),[2]}}))}))},e.prototype.clear=function(){return He(this,void 0,void 0,(function(){return Ge(this,(function(e){switch(e.label){case 0:return[4,this.checkPrivate()];case 1:return e.sent(),this.db.close(),[4,Le(this.dbName)];case 2:return e.sent(),this.db=void 0,this.initPromise=void 0,[2]}}))}))},e.prototype.batchSave=function(e,t){return He(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h;return Ge(this,(function(p){switch(p.label){case 0:return 0===t.length?[2,[]]:[4,this.checkPrivate()];case 1:p.sent(),n=[],r=this.getStorenameForModel(e),i=this.db.transaction(r,"readwrite"),o=i.store,s=function(t){var r,i,s,u,c;return Ge(this,(function(l){switch(l.label){case 0:return r=Object(Oe.A)(e.name,a.modelInstanceCreator(e,t),a.schema.namespaces[a.namespaceResolver(e)],a.modelInstanceCreator,a.getModelConstructorByModelName),i=t.id,s=t._deleted,[4,o.index("byId").getKey(i)];case 1:return u=l.sent(),s?[3,3]:(c=r.find((function(e){return e.instance.id===i})).instance,n.push([c,u?fe.h.UPDATE:fe.h.INSERT]),[4,o.put(c,u)]);case 2:return l.sent(),[3,5];case 3:return n.push([t,fe.h.DELETE]),u?[4,o.delete(u)]:[3,5];case 4:l.sent(),l.label=5;case 5:return[2]}}))},a=this,p.label=2;case 2:p.trys.push([2,7,8,9]),u=Ye(t),c=u.next(),p.label=3;case 3:return c.done?[3,6]:(l=c.value,[5,s(l)]);case 4:p.sent(),p.label=5;case 5:return c=u.next(),[3,3];case 6:return[3,9];case 7:return f=p.sent(),d={error:f},[3,9];case 8:try{c&&!c.done&&(h=u.return)&&h.call(u)}finally{if(d)throw d.error}return[7];case 9:return[4,i.done];case 10:return p.sent(),[2,n]}}))}))},e}()),Xe=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},et=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},tt=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},nt=function(){var e=this;this.db=new Map,this.getAllKeys=function(){return Xe(e,void 0,void 0,(function(){return et(this,(function(e){return[2,Array.from(this.db.keys())]}))}))},this.multiGet=function(t){return Xe(e,void 0,void 0,(function(){var e=this;return et(this,(function(n){return[2,t.reduce((function(t,n){return t.push([n,e.db.get(n)]),t}),[])]}))}))},this.multiRemove=function(t,n){return Xe(e,void 0,void 0,(function(){var e=this;return et(this,(function(r){return t.forEach((function(t){return e.db.delete(t)})),n(),[2]}))}))},this.multiSet=function(t,n){return Xe(e,void 0,void 0,(function(){var e=this;return et(this,(function(r){return t.forEach((function(t){var n=tt(t,2),r=n[0],i=n[1];e.setItem(r,i)})),n(),[2]}))}))},this.setItem=function(t,n){return Xe(e,void 0,void 0,(function(){return et(this,(function(e){return[2,this.db.set(t,n)]}))}))},this.removeItem=function(t){return Xe(e,void 0,void 0,(function(){return et(this,(function(e){return[2,this.db.delete(t)]}))}))},this.getItem=function(t){return Xe(e,void 0,void 0,(function(){return et(this,(function(e){return[2,this.db.get(t)]}))}))}};var rt=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},it=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},ot=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},st=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},at=new Map,ut=function(){function e(){this._collectionInMemoryIndex=new Map,this.storage=new nt}return e.prototype.getCollectionIndex=function(e){return this._collectionInMemoryIndex.has(e)||this._collectionInMemoryIndex.set(e,new Map),this._collectionInMemoryIndex.get(e)},e.prototype.getMonotonicFactory=function(e){return at.has(e)||at.set(e,Object(Oe.x)()),at.get(e)},e.prototype.init=function(){return rt(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a,u,c,l,f,d,h,p,v,y,g,m,b;return it(this,(function(w){switch(w.label){case 0:return this._collectionInMemoryIndex.clear(),[4,this.storage.getAllKeys()];case 1:e=w.sent(),t=[],w.label=2;case 2:w.trys.push([2,12,13,14]),n=ot(e),r=n.next(),w.label=3;case 3:return r.done?[3,11]:(i=r.value,o=st(i.split("::"),5),s=o[0],a=o[1],u=o[2],c=o[3],l=o[4],"@AmplifyDatastore"!==s?[3,10]:"Data"!==u?[3,9]:(f=void 0,void 0!==l?[3,7]:(d=c,h=this.getMonotonicFactory(a)(),p=this.getLegacyKeyForItem(a,d),v=this.getKeyForItem(a,d,h),[4,this.storage.getItem(p)])));case 4:return y=w.sent(),[4,this.storage.setItem(v,y)];case 5:return w.sent(),[4,this.storage.removeItem(p)];case 6:return w.sent(),f=h,[3,8];case 7:f=c,w.label=8;case 8:return this.getCollectionIndex(a).set(l,f),[3,10];case 9:"Collection"===u&&t.push(i),w.label=10;case 10:return r=n.next(),[3,3];case 11:return[3,14];case 12:return g=w.sent(),m={error:g},[3,14];case 13:try{r&&!r.done&&(b=n.return)&&b.call(n)}finally{if(m)throw m.error}return[7];case 14:return t.length>0?[4,this.storage.multiRemove(t)]:[3,16];case 15:w.sent(),w.label=16;case 16:return[2]}}))}))},e.prototype.save=function(e,t){return rt(this,void 0,void 0,(function(){var n,r;return it(this,(function(i){switch(i.label){case 0:return n=this.getCollectionIndex(t).get(e.id)||this.getMonotonicFactory(t)(),r=this.getKeyForItem(t,e.id,n),this.getCollectionIndex(t).set(e.id,n),[4,this.storage.setItem(r,JSON.stringify(e))];case 1:return i.sent(),[2]}}))}))},e.prototype.batchSave=function(e,t){return rt(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y,g,m,b,w,S,_,E=this;return it(this,(function(A){switch(A.label){case 0:if(0===t.length)return[2,[]];n=[],r=this.getCollectionIndex(e),i=new Set,o=new Set,s=[],a={};try{for(u=ot(t),c=u.next();!c.done;c=u.next())l=c.value,f=l.id,d=l._deleted,h=r.get(f)||this.getMonotonicFactory(e)(),m=this.getKeyForItem(e,f,h),s.push(m),a[m]={ulid:h,model:l},d?i.add(m):o.add(m)}catch(e){b={error:e}}finally{try{c&&!c.done&&(w=u.return)&&w.call(u)}finally{if(b)throw b.error}}return[4,this.storage.multiGet(s)];case 1:return p=A.sent(),v=p.filter((function(e){return!!st(e,2)[1]})).reduce((function(e,t){var n=st(t,1)[0];return e.add(n)}),new Set),[4,new Promise((function(e,t){if(0!==i.size){var n=Array.from(i);n.forEach((function(e){return r.delete(a[e].model.id)})),E.storage.multiRemove(n,(function(n){n&&n.length>0?t(n):e()}))}else e()}))];case 2:return A.sent(),[4,new Promise((function(e,t){if(0!==o.size){var n=Array.from(o).map((function(e){return[e,JSON.stringify(a[e].model)]}));o.forEach((function(e){var t=a[e],n=t.model.id,i=t.ulid;r.set(n,i)})),E.storage.multiSet(n,(function(n){n&&n.length>0?t(n):e()}))}else e()}))];case 3:A.sent();try{for(y=ot(s),g=y.next();!g.done;g=y.next())m=g.value,i.has(m)&&v.has(m)?n.push([a[m].model,fe.h.DELETE]):o.has(m)&&n.push([a[m].model,v.has(m)?fe.h.UPDATE:fe.h.INSERT])}catch(e){S={error:e}}finally{try{g&&!g.done&&(_=y.return)&&_.call(y)}finally{if(S)throw S.error}}return[2,n]}}))}))},e.prototype.get=function(e,t){return rt(this,void 0,void 0,(function(){var n,r,i;return it(this,(function(o){switch(o.label){case 0:return n=this.getCollectionIndex(t).get(e),r=this.getKeyForItem(t,e,n),[4,this.storage.getItem(r)];case 1:return i=o.sent(),[2,i&&JSON.parse(i)]}}))}))},e.prototype.getOne=function(e,t){return rt(this,void 0,void 0,(function(){var n,r,i,o,s,a,u;return it(this,(function(c){switch(c.label){case 0:return n=this.getCollectionIndex(t),r=st(e===fe.i.FIRST?function(){var e,t,r,i,o;try{for(var s=ot(n),a=s.next();!a.done;a=s.next()){i=(r=st(a.value,2))[0],o=r[1];break}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}return[i,o]}():function(){var e,t,r,i,o;try{for(var s=ot(n),a=s.next();!a.done;a=s.next())i=(r=st(a.value,2))[0],o=r[1]}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}return[i,o]}(),2),i=r[0],o=r[1],s=this.getKeyForItem(t,i,o),(u=s)?[4,this.storage.getItem(s)]:[3,2];case 1:u=c.sent(),c.label=2;case 2:return[2,(a=u)&&JSON.parse(a)||void 0]}}))}))},e.prototype.getAll=function(e,t){return rt(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y,g,m,b;return it(this,(function(w){switch(w.label){case 0:n=this.getCollectionIndex(e),i=(r=t||{}).page,o=void 0===i?0:i,s=r.limit,a=void 0===s?0:s,u=Math.max(0,o*a)||0,c=a>0?u+a:void 0,l=[],f=0;try{for(d=ot(n),h=d.next();!h.done&&(p=st(h.value,2),v=p[0],y=p[1],++f<=u||(l.push(this.getKeyForItem(e,v,y)),f!==c));h=d.next());}catch(e){m={error:e}}finally{try{h&&!h.done&&(b=d.return)&&b.call(d)}finally{if(m)throw m.error}}return[4,this.storage.multiGet(l)];case 1:return g=w.sent(),[2,g.filter((function(e){return st(e,2)[1]})).map((function(e){var t=st(e,2)[1];return JSON.parse(t)}))]}}))}))},e.prototype.delete=function(e,t){return rt(this,void 0,void 0,(function(){var n,r;return it(this,(function(i){switch(i.label){case 0:return n=this.getCollectionIndex(t).get(e),r=this.getKeyForItem(t,e,n),this.getCollectionIndex(t).delete(e),[4,this.storage.removeItem(r)];case 1:return i.sent(),[2]}}))}))},e.prototype.clear=function(){return rt(this,void 0,void 0,(function(){var e,t;return it(this,(function(n){switch(n.label){case 0:return[4,this.storage.getAllKeys()];case 1:return e=n.sent(),t=e.filter((function(e){return e.startsWith("@AmplifyDatastore")})),[4,this.storage.multiRemove(t)];case 2:return n.sent(),this._collectionInMemoryIndex.clear(),[2]}}))}))},e.prototype.getKeyForItem=function(e,t,n){return this.getKeyPrefixForStoreItems(e)+"::"+n+"::"+t},e.prototype.getLegacyKeyForItem=function(e,t){return this.getKeyPrefixForStoreItems(e)+"::"+t},e.prototype.getKeyPrefixForStoreItems=function(e){return"@AmplifyDatastore::"+e+"::Data"},e}();function ct(e){return(ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var lt,ft=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},dt=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},ht=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof pt?pt(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}},pt=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},vt=new r.a("DataStore"),yt=new(function(){function e(){}return e.prototype.getStorenameForModel=function(e){var t=this.namespaceResolver(e),n=e.name;return this.getStorename(t,n)},e.prototype.getStorename=function(e,t){return e+"_"+t},e.prototype.setUp=function(e,t,n,r){return ft(this,void 0,void 0,(function(){var i,o=this;return dt(this,(function(s){switch(s.label){case 0:return this.initPromise?[3,1]:(this.initPromise=new Promise((function(e,t){o.resolve=e,o.reject=t})),[3,3]);case 1:return[4,this.initPromise];case 2:return s.sent(),[2];case 3:this.schema=e,this.namespaceResolver=t,this.modelInstanceCreator=n,this.getModelConstructorByModelName=r,s.label=4;case 4:return s.trys.push([4,7,,8]),this.db?[3,6]:(this.db=new ut,[4,this.db.init()]);case 5:s.sent(),this.resolve(),s.label=6;case 6:return[3,8];case 7:return i=s.sent(),this.reject(i),[3,8];case 8:return[2]}}))}))},e.prototype.save=function(e,t){var n,r;return ft(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p,v,y,g,m,b,w,S,_,E,A,O,I=this;return dt(this,(function(T){switch(T.label){case 0:return i=Object.getPrototypeOf(e).constructor,o=this.getStorenameForModel(i),s=Object(Oe.A)(i.name,e,this.schema.namespaces[this.namespaceResolver(i)],this.modelInstanceCreator,this.getModelConstructorByModelName),a=this.namespaceResolver(i),u=new Set,c=Object.values(s).map((function(e){var t=e.modelName,n=e.item,r=e.instance,i=I.getStorename(a,t);return u.add(i),{storeName:i,item:n,instance:r}})),[4,this.db.get(e.id,o)];case 1:if(l=T.sent(),t&&l&&(f=we.a.getPredicates(t),d=f.predicates,h=f.type,!Object(Oe.B)(l,h,d)))throw p="Conditional update failed",vt.error(p,{model:l,condition:d}),new Error(p);v=[],T.label=2;case 2:T.trys.push([2,9,10,15]),y=ht(c),T.label=3;case 3:return[4,y.next()];case 4:return(g=T.sent()).done?[3,8]:(m=g.value,b=m.storeName,w=m.item,S=m.instance,_=w.id,[4,this.db.get(_,b)]);case 5:return E=T.sent(),A=E?fe.h.UPDATE:fe.h.INSERT,_!==e.id&&A!==fe.h.INSERT?[3,7]:[4,this.db.save(w,b)];case 6:T.sent(),v.push([S,A]),T.label=7;case 7:return[3,3];case 8:return[3,15];case 9:return O=T.sent(),n={error:O},[3,15];case 10:return T.trys.push([10,,13,14]),g&&!g.done&&(r=y.return)?[4,r.call(y)]:[3,12];case 11:T.sent(),T.label=12;case 12:return[3,14];case 13:if(n)throw n.error;return[7];case 14:return[7];case 15:return[2,v]}}))}))},e.prototype.load=function(e,t,n){var r,i,o,s,a,u,c,l,f,d;return ft(this,void 0,void 0,(function(){var h,p,v,y,g,m,b,w,S,_,E,A,O,I,T,C,x,P,k,N=this;return dt(this,(function(M){switch(M.label){case 0:if(h=this.schema.namespaces[e],p=h.relationships[t].relationTypes,v=p.map((function(t){var n=t.modelName;return N.getStorename(e,n)})),y=this.getModelConstructorByModelName(e,t),0===v.length)return[2,n.map((function(e){return N.modelInstanceCreator(y,e)}))];M.label=1;case 1:M.trys.push([1,34,35,40]),g=ht(p),M.label=2;case 2:return[4,g.next()];case 3:if((m=M.sent()).done)return[3,33];switch(b=m.value,w=b.fieldName,S=b.modelName,_=b.targetName,E=b.relationType,A=this.getStorename(e,S),O=this.getModelConstructorByModelName(e,S),E){case"HAS_ONE":return[3,4];case"BELONGS_TO":return[3,17];case"HAS_MANY":return[3,30]}return[3,31];case 4:M.trys.push([4,10,11,16]),r=ht(n),M.label=5;case 5:return[4,r.next()];case 6:return(i=M.sent()).done?[3,9]:(C=i.value,I=C[_]?_:w,C[I]?[4,this.db.get(C[I],A)]:[3,9]);case 7:x=M.sent(),C[w]=x&&this.modelInstanceCreator(O,x),M.label=8;case 8:return[3,5];case 9:return[3,16];case 10:return T=M.sent(),c={error:T},[3,16];case 11:return M.trys.push([11,,14,15]),i&&!i.done&&(l=r.return)?[4,l.call(r)]:[3,13];case 12:M.sent(),M.label=13;case 13:return[3,15];case 14:if(c)throw c.error;return[7];case 15:return[7];case 16:return[3,32];case 17:M.trys.push([17,23,24,29]),o=ht(n),M.label=18;case 18:return[4,o.next()];case 19:return(s=M.sent()).done?[3,22]:(C=s.value)[_]?[4,this.db.get(C[_],A)]:[3,21];case 20:x=M.sent(),C[w]=x&&this.modelInstanceCreator(O,x),delete C[_],M.label=21;case 21:return[3,18];case 22:return[3,29];case 23:return P=M.sent(),f={error:P},[3,29];case 24:return M.trys.push([24,,27,28]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,26];case 25:M.sent(),M.label=26;case 26:return[3,28];case 27:if(f)throw f.error;return[7];case 28:return[7];case 29:case 30:return[3,32];case 31:return Object(Oe.g)(E),[3,32];case 32:return[3,2];case 33:return[3,40];case 34:return k=M.sent(),a={error:k},[3,40];case 35:return M.trys.push([35,,38,39]),m&&!m.done&&(u=g.return)?[4,u.call(g)]:[3,37];case 36:M.sent(),M.label=37;case 37:return[3,39];case 38:if(a)throw a.error;return[7];case 39:return[7];case 40:return[2,n.map((function(e){return N.modelInstanceCreator(y,e)}))]}}))}))},e.prototype.query=function(e,t,n){return ft(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l=this;return dt(this,(function(f){switch(f.label){case 0:return r=this.getStorenameForModel(e),i=this.namespaceResolver(e),o=t&&we.a.getPredicates(t),s=o&&this.idFromPredicate(o),a=n&&n.sort,u=n&&n.limit,[4,ft(l,void 0,void 0,(function(){var e,t,i;return dt(this,(function(c){switch(c.label){case 0:return s?[4,this.getById(r,s)]:[3,2];case 1:return[2,(e=c.sent())?[e]:[]];case 2:return o?[4,this.filterOnPredicate(r,o)]:[3,4];case 3:return t=c.sent(),[2,this.inMemoryPagination(t,n)];case 4:return a||u?[4,this.getAll(r)]:[3,6];case 5:return i=c.sent(),[2,this.inMemoryPagination(i,n)];case 6:return[2,this.getAll(r)]}}))}))];case 1:return c=f.sent(),[4,this.load(i,e.name,c)];case 2:return[2,f.sent()]}}))}))},e.prototype.getById=function(e,t){return ft(this,void 0,void 0,(function(){return dt(this,(function(n){switch(n.label){case 0:return[4,this.db.get(t,e)];case 1:return[2,n.sent()]}}))}))},e.prototype.getAll=function(e){return ft(this,void 0,void 0,(function(){return dt(this,(function(t){switch(t.label){case 0:return[4,this.db.getAll(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.idFromPredicate=function(e){var t=e.predicates,n=1===t.length&&t.find((function(e){return Object(fe.u)(e)&&"id"===e.field&&"eq"===e.operator}));return n&&n.operand},e.prototype.filterOnPredicate=function(e,t){return ft(this,void 0,void 0,(function(){var n,r,i;return dt(this,(function(o){switch(o.label){case 0:return n=t.predicates,r=t.type,[4,this.getAll(e)];case 1:return i=o.sent(),[2,n?i.filter((function(e){return Object(Oe.B)(e,r,n)})):i]}}))}))},e.prototype.inMemoryPagination=function(e,t){if(t&&e.length>1){if(t.sort){var n=Se.a.getPredicates(t.sort);if(n.length){var r=Object(Oe.z)(n);e.sort(r)}}var i=t.page,o=void 0===i?0:i,s=t.limit,a=void 0===s?0:s,u=Math.max(0,o*a)||0,c=a>0?u+a:e.length;return e.slice(u,c)}return e},e.prototype.queryOne=function(e,t){return void 0===t&&(t=fe.i.FIRST),ft(this,void 0,void 0,(function(){var n,r;return dt(this,(function(i){switch(i.label){case 0:return n=this.getStorenameForModel(e),[4,this.db.getOne(t,n)];case 1:return[2,(r=i.sent())&&this.modelInstanceCreator(e,r)]}}))}))},e.prototype.delete=function(e,t){return ft(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p;return dt(this,(function(v){switch(v.label){case 0:return n=[],Object(Oe.t)(e)?(o=e,s=this.namespaceResolver(o),[4,this.query(o,t)]):[3,8];case 1:return r=v.sent(),h=this.schema.namespaces[s].relationships[o.name].relationTypes,void 0===t?[3,4]:[4,this.deleteTraverse(h,r,o.name,s,n)];case 2:return v.sent(),[4,this.deleteItem(n)];case 3:return v.sent(),p=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[r,p]];case 4:return[4,this.deleteTraverse(h,r,o.name,s,n)];case 5:return v.sent(),[4,this.deleteItem(n)];case 6:return v.sent(),p=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[r,p]];case 7:return[3,15];case 8:return i=e,o=Object.getPrototypeOf(i).constructor,s=this.namespaceResolver(o),a=this.getStorenameForModel(o),t?[4,this.db.get(i.id,a)]:[3,11];case 9:if(void 0===(u=v.sent()))return d="Model instance not found in storage",vt.warn(d,{model:i}),[2,[[i],[]]];if(c=we.a.getPredicates(t),l=c.predicates,f=c.type,!Object(Oe.B)(u,f,l))throw d="Conditional update failed",vt.error(d,{model:u,condition:l}),new Error(d);return h=this.schema.namespaces[s].relationships[o.name].relationTypes,[4,this.deleteTraverse(h,[i],o.name,s,n)];case 10:return v.sent(),[3,13];case 11:return h=this.schema.namespaces[s].relationships[o.name].relationTypes,[4,this.deleteTraverse(h,[i],o.name,s,n)];case 12:v.sent(),v.label=13;case 13:return[4,this.deleteItem(n)];case 14:return v.sent(),p=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[[i],p]];case 15:return[2]}}))}))},e.prototype.deleteItem=function(e){var t,n,r,i,o,s;return ft(this,void 0,void 0,(function(){var a,u,c,l,f,d,h,p,v;return dt(this,(function(y){switch(y.label){case 0:y.trys.push([0,17,18,23]),t=ht(e),y.label=1;case 1:return[4,t.next()];case 2:if((n=y.sent()).done)return[3,16];a=n.value,u=a.storeName,c=a.items,y.label=3;case 3:y.trys.push([3,9,10,15]),l=ht(c),y.label=4;case 4:return[4,l.next()];case 5:return(f=y.sent()).done?[3,8]:(d=f.value)?"object"!==ct(d)?[3,7]:(h=d.id,[4,this.db.delete(h,u)]):[3,7];case 6:y.sent(),y.label=7;case 7:return[3,4];case 8:return[3,15];case 9:return p=y.sent(),o={error:p},[3,15];case 10:return y.trys.push([10,,13,14]),f&&!f.done&&(s=l.return)?[4,s.call(l)]:[3,12];case 11:y.sent(),y.label=12;case 12:return[3,14];case 13:if(o)throw o.error;return[7];case 14:return[7];case 15:return[3,1];case 16:return[3,23];case 17:return v=y.sent(),r={error:v},[3,23];case 18:return y.trys.push([18,,21,22]),n&&!n.done&&(i=t.return)?[4,i.call(t)]:[3,20];case 19:y.sent(),y.label=20;case 20:return[3,22];case 21:if(r)throw r.error;return[7];case 22:return[7];case 23:return[2]}}))}))},e.prototype.deleteTraverse=function(e,t,n,r,i){var o,s,a,u,c,l,f,d,h,p,v,y;return ft(this,void 0,void 0,(function(){var g,m,b,w,S,_,E,A,O,I,T,C,x,P,k,N=this;return dt(this,(function(M){switch(M.label){case 0:M.trys.push([0,35,36,41]),o=ht(e),M.label=1;case 1:return[4,o.next()];case 2:if((s=M.sent()).done)return[3,34];switch(g=s.value,m=g.relationType,b=g.modelName,w=g.targetName,S=this.getStorename(r,b),_=Object(Oe.h)(this.schema.namespaces[r].relationships[b].relationTypes,n)||Object(Oe.i)(this.schema.namespaces[r].relationships[b].indexes,g.associatedWith),m){case"HAS_ONE":return[3,3];case"HAS_MANY":return[3,17];case"BELONGS_TO":return[3,31]}return[3,32];case 3:M.trys.push([3,10,11,16]),a=ht(t),M.label=4;case 4:return[4,a.next()];case 5:return(u=M.sent()).done?[3,9]:(T=u.value,E=_||"byId",(A=w in T?T[w]:T.id)?[4,this.db.getAll(S)]:[3,9]);case 6:return C=M.sent(),O=C.filter((function(e){return e[E]===A})),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,O,b,r,i)];case 7:M.sent(),M.label=8;case 8:return[3,4];case 9:return[3,16];case 10:return I=M.sent(),h={error:I},[3,16];case 11:return M.trys.push([11,,14,15]),u&&!u.done&&(p=a.return)?[4,p.call(a)]:[3,13];case 12:M.sent(),M.label=13;case 13:return[3,15];case 14:if(h)throw h.error;return[7];case 15:return[7];case 16:return[3,33];case 17:M.trys.push([17,24,25,30]),c=ht(t),M.label=18;case 18:return[4,c.next()];case 19:return(l=M.sent()).done?[3,23]:(T=l.value,[4,this.db.getAll(S)]);case 20:return C=M.sent(),x=C.filter((function(e){return e[_]===T.id})),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,x,b,r,i)];case 21:M.sent(),M.label=22;case 22:return[3,18];case 23:return[3,30];case 24:return P=M.sent(),v={error:P},[3,30];case 25:return M.trys.push([25,,28,29]),l&&!l.done&&(y=c.return)?[4,y.call(c)]:[3,27];case 26:M.sent(),M.label=27;case 27:return[3,29];case 28:if(v)throw v.error;return[7];case 29:return[7];case 30:case 31:return[3,33];case 32:return Object(Oe.g)(m),[3,33];case 33:return[3,1];case 34:return[3,41];case 35:return k=M.sent(),f={error:k},[3,41];case 36:return M.trys.push([36,,39,40]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,38];case 37:M.sent(),M.label=38;case 38:return[3,40];case 39:if(f)throw f.error;return[7];case 40:return[7];case 41:return i.push({storeName:this.getStorename(r,n),items:t.map((function(e){return N.modelInstanceCreator(N.getModelConstructorByModelName(r,n),e)}))}),[2]}}))}))},e.prototype.clear=function(){return ft(this,void 0,void 0,(function(){return dt(this,(function(e){switch(e.label){case 0:return[4,this.db.clear()];case 1:return e.sent(),this.db=void 0,this.initPromise=void 0,[2]}}))}))},e.prototype.batchSave=function(e,t){return ft(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d;return dt(this,(function(h){switch(h.label){case 0:n=e.name,r=this.namespaceResolver(e),i=this.getStorename(r,n),o=[],s=function(t){var n=t.id,r=Object(Oe.A)(e.name,a.modelInstanceCreator(e,t),a.schema.namespaces[a.namespaceResolver(e)],a.modelInstanceCreator,a.getModelConstructorByModelName).find((function(e){return e.instance.id===n})).instance;o.push(r)},a=this;try{for(u=pt(t),c=u.next();!c.done;c=u.next())l=c.value,s(l)}catch(e){f={error:e}}finally{try{c&&!c.done&&(d=u.return)&&d.call(u)}finally{if(f)throw f.error}}return[4,this.db.batchSave(i,o)];case 1:return[2,h.sent()]}}))}))},e}()),gt=function(){return Object(i.b)().isBrowser&&window.indexedDB||Object(i.c)()&&self.indexedDB?Qe:yt},mt=function(){return(mt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},bt=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},wt=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},St=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},_t=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},Et=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},At=new r.a("DataStore"),Ot=function(){function e(e,t,n,r,i,o){this.schema=e,this.namespaceResolver=t,this.getModelConstructorByModelName=n,this.modelInstanceCreator=r,this.adapter=i,this.sessionId=o,this.adapter=this.adapter||gt(),this.pushStream=new Ae.a}return e.getNamespace=function(){return{name:Oe.c,relationships:{},enums:{},models:{},nonModels:{}}},e.prototype.init=function(){return bt(this,void 0,void 0,(function(){var e,t;return wt(this,(function(n){switch(n.label){case 0:return void 0===this.initialized?[3,2]:[4,this.initialized];case 1:return n.sent(),[2];case 2:return At.debug("Starting Storage"),this.initialized=new Promise((function(n,r){e=n,t=r})),this.adapter.setUp(this.schema,this.namespaceResolver,this.modelInstanceCreator,this.getModelConstructorByModelName,this.sessionId).then(e,t),[4,this.initialized];case 3:return n.sent(),[2]}}))}))},e.prototype.save=function(e,t,n,r){return bt(this,void 0,void 0,(function(){var i,o=this;return wt(this,(function(s){switch(s.label){case 0:return[4,this.init()];case 1:return s.sent(),[4,this.adapter.save(e,t)];case 2:return(i=s.sent()).forEach((function(s){var a,u=_t(s,2),c=u[0],l=u[1],f=!!n;if(l===fe.h.UPDATE&&!f&&null===(a=o.getUpdateMutationInput(e,c,r)))return i;var d=a||c,h=Object.getPrototypeOf(c).constructor;o.pushStream.next({model:h,opType:l,element:d,mutator:n,condition:we.a.getPredicates(t,!1)})})),[2,i]}}))}))},e.prototype.delete=function(e,t,n){return bt(this,void 0,void 0,(function(){var r,i,o,s,a=this;return wt(this,(function(u){switch(u.label){case 0:return[4,this.init()];case 1:return u.sent(),[4,this.adapter.delete(e,t)];case 2:return s=_t.apply(void 0,[u.sent(),2]),i=s[0],r=s[1],o=new Set(i.map((function(e){return e.id}))),Object(Oe.t)(e)||Array.isArray(r)||(r=[r]),r.forEach((function(r){var i,s=Object.getPrototypeOf(r).constructor;Object(Oe.t)(e)||(i=o.has(r.id)?we.a.getPredicates(t,!1):void 0),a.pushStream.next({model:s,opType:fe.h.DELETE,element:r,mutator:n,condition:i})})),[2,[i,r]]}}))}))},e.prototype.query=function(e,t,n){return bt(this,void 0,void 0,(function(){return wt(this,(function(r){switch(r.label){case 0:return[4,this.init()];case 1:return r.sent(),[4,this.adapter.query(e,t,n)];case 2:return[2,r.sent()]}}))}))},e.prototype.queryOne=function(e,t){return void 0===t&&(t=fe.i.FIRST),bt(this,void 0,void 0,(function(){return wt(this,(function(n){switch(n.label){case 0:return[4,this.init()];case 1:return n.sent(),[4,this.adapter.queryOne(e,t)];case 2:return[2,n.sent()]}}))}))},e.prototype.observe=function(e,t,n){var r=!e,i=we.a.getPredicates(t,!1)||{},o=i.predicates,s=i.type,a=!!o,u=this.pushStream.observable.filter((function(e){var t=e.mutator;return!n||t!==n})).map((function(e){e.mutator;return St(e,["mutator"])}));return r||(u=u.filter((function(t){var n=t.model,r=t.element;return e===n&&(!a||Object(Oe.B)(r,s,o))}))),u},e.prototype.clear=function(e){return void 0===e&&(e=!0),bt(this,void 0,void 0,(function(){return wt(this,(function(t){switch(t.label){case 0:return this.initialized=void 0,[4,this.adapter.clear()];case 1:return t.sent(),e&&this.pushStream.complete(),[2]}}))}))},e.prototype.batchSave=function(e,t,n){return bt(this,void 0,void 0,(function(){var r,i=this;return wt(this,(function(o){switch(o.label){case 0:return[4,this.init()];case 1:return o.sent(),[4,this.adapter.batchSave(e,t)];case 2:return(r=o.sent()).forEach((function(t){var r=_t(t,2),o=r[0],s=r[1];i.pushStream.next({model:e,opType:s,element:o,mutator:n,condition:void 0})})),[2,r]}}))}))},e.prototype.getUpdateMutationInput=function(e,t,n){var r,i;if(!(n&&n.length))return null;var o=_t(n,2),s=o[0],a=o[1],u={},c=s.map((function(e){return e.path&&e.path[0]})),l=Object.getPrototypeOf(e).constructor,f=this.namespaceResolver(l),d=this.schema.namespaces[f].models[l.name].fields,h=this.schema.namespaces[f].keys[l.name],p=h.primaryKey,v=h.compositeKeys,y=void 0===v?[]:v;if(c.forEach((function(e){var n,r,i,o,s,c=Object(fe.w)(null===(s=d[e])||void 0===s?void 0:s.association)||e;if(!Object(Oe.C)(a[c],t[c])){u[c]=void 0===t[c]?null:t[c];try{for(var l=Et(y),f=l.next();!f.done;f=l.next()){var h=f.value;if(h.has(c))try{for(var p=(i=void 0,Et(h)),v=p.next();!v.done;v=p.next()){var g=v.value;u[g]=t[g]}}catch(e){i={error:e}}finally{try{v&&!v.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}}}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}})),p&&p.length)try{for(var g=Et(p),m=g.next();!m.done;m=g.next()){var b=m.value;u[b]=t[b]}}catch(e){r={error:e}}finally{try{m&&!m.done&&(i=g.return)&&i.call(g)}finally{if(r)throw r.error}}if(0===Object.keys(u).length)return null;var w=t.id,S=t._version,_=t._lastChangedAt,E=t._deleted;return mt(mt({},u),{id:w,_version:S,_lastChangedAt:_,_deleted:E})},e}(),It=function(){function e(e,t,n,r,i,o){this.mutex=new _e,this.storage=new Ot(e,t,n,r,i,o)}return e.prototype.runExclusive=function(e){return this.mutex.runExclusive(e.bind(this,this.storage))},e.prototype.save=function(e,t,n,r){return bt(this,void 0,void 0,(function(){return wt(this,(function(i){return[2,this.runExclusive((function(i){return i.save(e,t,n,r)}))]}))}))},e.prototype.delete=function(e,t,n){return bt(this,void 0,void 0,(function(){return wt(this,(function(r){return[2,this.runExclusive((function(r){if(Object(Oe.t)(e)){var i=e;return r.delete(i,t,n)}var o=e;return r.delete(o,t,n)}))]}))}))},e.prototype.query=function(e,t,n){return bt(this,void 0,void 0,(function(){return wt(this,(function(r){return[2,this.runExclusive((function(r){return r.query(e,t,n)}))]}))}))},e.prototype.queryOne=function(e,t){return void 0===t&&(t=fe.i.FIRST),bt(this,void 0,void 0,(function(){return wt(this,(function(n){return[2,this.runExclusive((function(n){return n.queryOne(e,t)}))]}))}))},e.getNamespace=function(){return Ot.getNamespace()},e.prototype.observe=function(e,t,n){return this.storage.observe(e,t,n)},e.prototype.clear=function(){return bt(this,void 0,void 0,(function(){return wt(this,(function(e){switch(e.label){case 0:return[4,this.storage.clear()];case 1:return e.sent(),[2]}}))}))},e.prototype.batchSave=function(e,t){return this.storage.batchSave(e,t)},e.prototype.init=function(){return bt(this,void 0,void 0,(function(){return wt(this,(function(e){return[2,this.storage.init()]}))}))},e}(),Tt=n(16),Ct=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},xt=(new(function(){function e(){}return e.prototype.networkMonitor=function(t){if(Object(i.b)().isNode)return ue.a.from([{online:!0}]);var n=Object(i.c)()?self:window;return new ue.a((function(t){t.next({online:n.navigator.onLine});var r=function(){return t.next({online:!0})},i=function(){return t.next({online:!1})};return n.addEventListener("online",r),n.addEventListener("offline",i),e._observers.push(t),function(){n.removeEventListener("online",r),n.removeEventListener("offline",i),e._observers=e._observers.filter((function(e){return e!==t}))}}))},e._observerOverride=function(t){var n,r,i=function(n){if(n.closed)return e._observers=e._observers.filter((function(e){return e!==n})),"continue";n.next(t)};try{for(var o=Ct(e._observers),s=o.next();!s.done;s=o.next()){i(s.value)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}},e._observers=[],e}())).networkMonitor(),Pt=function(){return(Pt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},kt=(new r.a("DataStore"),function(){function e(){this.connectionStatus={online:!1}}return e.prototype.status=function(){var e=this;if(this.observer)throw new Error("Subscriber already exists");return new ue.a((function(t){return e.observer=t,e.subscription=xt.subscribe((function(n){var r=n.online;e.connectionStatus.online=r;var i=Pt({},e.connectionStatus);t.next(i)})),function(){clearTimeout(e.timeout),e.unsubscribe()}}))},e.prototype.unsubscribe=function(){this.subscription&&(clearTimeout(this.timeout),this.subscription.unsubscribe())},e.prototype.socketDisconnected=function(){var e=this;this.observer&&"function"==typeof this.observer.next&&(this.observer.next({online:!1}),this.timeout=setTimeout((function(){var t=Pt({},e.connectionStatus);e.observer.next(t)}),5e3))},e}()),Nt=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},Mt=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},jt=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},Rt=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Dt=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(jt(arguments[t]));return e},Ut=function(){function e(e,t){this.outbox=e,this.ownSymbol=t}return e.prototype.merge=function(e,t){return Nt(this,void 0,void 0,(function(){var n,r,i,o,s;return Mt(this,(function(a){switch(a.label){case 0:return[4,this.outbox.getForModel(e,t)];case 1:return r=a.sent(),i=t._deleted,0!==r.length?[3,5]:i?(n=fe.h.DELETE,[4,e.delete(t,void 0,this.ownSymbol)]):[3,3];case 2:return a.sent(),[3,5];case 3:return[4,e.save(t,void 0,this.ownSymbol)];case 4:o=jt.apply(void 0,[a.sent(),1]),s=jt(o[0],2),n=s[1],a.label=5;case 5:return[2,n]}}))}))},e.prototype.mergePage=function(e,t,n){return Nt(this,void 0,void 0,(function(){var r,i,o,s,a,u,c;return Mt(this,(function(l){switch(l.label){case 0:r=new Map;try{for(i=Rt(n),o=i.next();!o.done;o=i.next())s=o.value,r.set(s.id,s)}catch(e){u={error:e}}finally{try{o&&!o.done&&(c=i.return)&&c.call(i)}finally{if(u)throw u.error}}return a=Dt(r.values()),[4,e.batchSave(t,a,this.ownSymbol)];case 1:return[2,l.sent()]}}))}))},e}(),Ft=n(3),Lt=function(){return(Lt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},Bt=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},qt=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},zt=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},Kt=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},Vt=function(){function e(e,t,n,r){this.schema=e,this.MutationEvent=t,this.modelInstanceCreator=n,this.ownSymbol=r}return e.prototype.enqueue=function(e,t){return Bt(this,void 0,void 0,(function(){var n=this;return qt(this,(function(r){return e.runExclusive((function(e){return Bt(n,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f=this;return qt(this,(function(d){switch(d.label){case 0:return n=this.schema.namespaces[Oe.d].models.MutationEvent,r=we.a.createFromExisting(n,(function(e){return e.modelId("eq",t.modelId).id("ne",f.inProgressMutationEventId)})),[4,e.query(this.MutationEvent,r)];case 1:return i=Kt.apply(void 0,[d.sent(),1]),void 0!==(o=i[0])?[3,3]:[4,e.save(t,void 0,this.ownSymbol)];case 2:return d.sent(),[2];case 3:return s=t.operation,o.operation!==Ft.a.CREATE?[3,8]:s!==Ft.a.DELETE?[3,5]:[4,e.delete(this.MutationEvent,r)];case 4:return d.sent(),[3,7];case 5:return a=this.mergeUserFields(o,t),[4,e.save(this.MutationEvent.copyOf(o,(function(e){e.data=a.data})),void 0,this.ownSymbol)];case 6:d.sent(),d.label=7;case 7:return[3,12];case 8:return u=t.condition,c=JSON.parse(u),l=void 0,0!==Object.keys(c).length?[3,10]:(l=this.mergeUserFields(o,t),[4,e.delete(this.MutationEvent,r)]);case 9:d.sent(),d.label=10;case 10:return l=l||t,[4,e.save(l,void 0,this.ownSymbol)];case 11:d.sent(),d.label=12;case 12:return[2]}}))}))})),[2]}))}))},e.prototype.dequeue=function(e,t,n){return Bt(this,void 0,void 0,(function(){var r;return qt(this,(function(i){switch(i.label){case 0:return[4,this.peek(e)];case 1:return r=i.sent(),t?[4,this.syncOutboxVersionsOnDequeue(e,t,r,n)]:[3,3];case 2:i.sent(),i.label=3;case 3:return[4,e.delete(r)];case 4:return i.sent(),this.inProgressMutationEventId=void 0,[2,r]}}))}))},e.prototype.peek=function(e){return Bt(this,void 0,void 0,(function(){var t;return qt(this,(function(n){switch(n.label){case 0:return[4,e.queryOne(this.MutationEvent,fe.i.FIRST)];case 1:return t=n.sent(),this.inProgressMutationEventId=t?t.id:void 0,[2,t]}}))}))},e.prototype.getForModel=function(e,t){return Bt(this,void 0,void 0,(function(){var n;return qt(this,(function(r){switch(r.label){case 0:return n=this.schema.namespaces[Oe.d].models.MutationEvent,[4,e.query(this.MutationEvent,we.a.createFromExisting(n,(function(e){return e.modelId("eq",t.id)})))];case 1:return[2,r.sent()]}}))}))},e.prototype.getModelIds=function(e){return Bt(this,void 0,void 0,(function(){var t,n;return qt(this,(function(r){switch(r.label){case 0:return[4,e.query(this.MutationEvent)];case 1:return t=r.sent(),n=new Set,t.forEach((function(e){var t=e.modelId;return n.add(t)})),[2,n]}}))}))},e.prototype.syncOutboxVersionsOnDequeue=function(e,t,n,r){return Bt(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p,v=this;return qt(this,(function(y){switch(y.label){case 0:return n.operation!==r?[2]:(i=t._version,o=t._lastChangedAt,t._deleted,s=zt(t,["_version","_lastChangedAt","_deleted"]),a=this.removeTimestampFields(n.model,s),(u=JSON.parse(n.data))?(u._version,u._lastChangedAt,u._deleted,c=zt(u,["_version","_lastChangedAt","_deleted"]),l=this.removeTimestampFields(n.model,c),Object(Oe.C)(a,l,!0)?(f=this.schema.namespaces[Oe.d].models.MutationEvent,d=we.a.createFromExisting(f,(function(e){return e.modelId("eq",t.id).id("ne",v.inProgressMutationEventId)})),[4,e.query(this.MutationEvent,d)]):[2]):[2]);case 1:return(h=y.sent()).length?(p=h.map((function(e){var t=JSON.parse(e.data),n=Lt(Lt({},t),{_version:i,_lastChangedAt:o});return v.MutationEvent.copyOf(e,(function(e){e.data=JSON.stringify(n)}))})),[4,e.delete(this.MutationEvent,d)]):[2];case 2:return y.sent(),[4,Promise.all(p.map((function(t){return Bt(v,void 0,void 0,(function(){return qt(this,(function(n){switch(n.label){case 0:return[4,e.save(t,void 0,this.ownSymbol)];case 1:return[2,n.sent()]}}))}))})))];case 3:return y.sent(),[2]}}))}))},e.prototype.mergeUserFields=function(e,t){var n=JSON.parse(e.data),r=n._version,i=n.id,o=n._lastChangedAt,s=n._deleted,a=zt(n,["_version","id","_lastChangedAt","_deleted"]),u=JSON.parse(t.data),c=(u.id,u._version,u._lastChangedAt,u._deleted,zt(u,["id","_version","_lastChangedAt","_deleted"])),l=JSON.stringify(Lt(Lt({id:i,_version:r,_lastChangedAt:o,_deleted:s},a),c));return this.modelInstanceCreator(this.MutationEvent,Lt(Lt({},t),{data:l}))},e.prototype.removeTimestampFields=function(e,t){var n,r,i="createdAt",o="updatedAt",s=null===(n=this.schema.namespaces[Oe.e].models[e].attributes)||void 0===n?void 0:n.find((function(e){return"model"===e.type})),a=null===(r=null==s?void 0:s.properties)||void 0===r?void 0:r.timestamps;return a&&(i=a.createdAt,o=a.updatedAt),delete t[i],delete t[o],t},e}(),Ht=n(21),Gt=n(156),Wt=function(){return(Wt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},Yt=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},Jt=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},$t=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},Zt=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},Qt=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Xt=new r.a("DataStore"),en=function(){function e(e,t,n,r,i,o,s,a,u,c){void 0===s&&(s={}),this.schema=e,this.storage=t,this.userClasses=n,this.outbox=r,this.modelInstanceCreator=i,this.MutationEvent=o,this.amplifyConfig=s,this.authModeStrategy=a,this.conflictHandler=u,this.errorHandler=c,this.typeQuery=new WeakMap,this.processing=!1,this.generateQueries()}return e.prototype.generateQueries=function(){var e=this;Object.values(this.schema.namespaces).forEach((function(t){Object.values(t.models).filter((function(e){return e.syncable})).forEach((function(n){var r=Zt(Object(Ft.b)(t,n,"CREATE"),1)[0],i=Zt(Object(Ft.b)(t,n,"UPDATE"),1)[0],o=Zt(Object(Ft.b)(t,n,"DELETE"),1)[0];e.typeQuery.set(n,[r,i,o])}))}))},e.prototype.isReady=function(){return void 0!==this.observer},e.prototype.start=function(){var e=this;return new ue.a((function(t){return e.observer=t,e.resume(),function(){e.pause()}}))},e.prototype.resume=function(){return Yt(this,void 0,void 0,(function(){var e,t,n,r,i,o=this;return Jt(this,(function(s){switch(s.label){case 0:if(this.processing||!this.isReady())return[2];this.processing=!0,t=Oe.e,n=function(){var n,i,s,a,u,c,l,f,d,h,p,v,y,g,m,b;return Jt(this,(function(w){switch(w.label){case 0:n=e.model,i=e.operation,s=e.data,a=e.condition,u=r.userClasses[n],c=void 0,l=void 0,f=void 0,w.label=1;case 1:return w.trys.push([1,4,,5]),[4,Object(Ft.h)({authModeStrategy:r.authModeStrategy,defaultAuthMode:r.amplifyConfig.aws_appsync_authenticationType,modelName:n,schema:r.schema})];case 2:return d=w.sent(),h=d[i.toUpperCase()],p=0,[4,(v=function(){return Yt(o,void 0,void 0,(function(){var r,o;return Jt(this,(function(c){switch(c.label){case 0:return c.trys.push([0,2,,4]),Xt.debug("Attempting mutation with authMode: "+h[p]),[4,this.jitteredRetry(t,n,i,s,a,u,this.MutationEvent,e,h[p])];case 1:return r=c.sent(),Xt.debug("Mutation sent successfully with authMode: "+h[p]),[2,r];case 2:if(o=c.sent(),++p>=h.length)throw Xt.debug("Mutation failed with authMode: "+h[p-1]),o;return Xt.debug("Mutation failed with authMode: "+h[p-1]+". Retrying with authMode: "+h[p]),[4,v()];case 3:return[2,c.sent()];case 4:return[2]}}))}))})()];case 3:return b=Zt.apply(void 0,[w.sent(),3]),c=b[0],l=b[1],f=b[2],[3,5];case 4:return"Offline"===(y=w.sent()).message||"RetryMutation"===y.message?[2,"continue"]:[3,5];case 5:return void 0!==c?[3,7]:(Xt.debug("done retrying"),[4,r.storage.runExclusive((function(e){return Yt(o,void 0,void 0,(function(){return Jt(this,(function(t){switch(t.label){case 0:return[4,this.outbox.dequeue(e)];case 1:return t.sent(),[2]}}))}))}))]);case 6:return w.sent(),[2,"continue"];case 7:return g=c.data[l],m=!1,[4,r.storage.runExclusive((function(e){return Yt(o,void 0,void 0,(function(){return Jt(this,(function(t){switch(t.label){case 0:return[4,this.outbox.dequeue(e,g,i)];case 1:return t.sent(),[4,this.outbox.peek(e)];case 2:return m=void 0!==t.sent(),[2]}}))}))}))];case 8:return w.sent(),r.observer.next({operation:i,modelDefinition:f,model:g,hasMore:m}),[2]}}))},r=this,s.label=1;case 1:return(i=this.processing)?[4,this.outbox.peek(this.storage)]:[3,3];case 2:i=void 0!==(e=s.sent()),s.label=3;case 3:return i?[5,n()]:[3,5];case 4:return s.sent(),[3,1];case 5:return this.pause(),[2]}}))}))},e.prototype.jitteredRetry=function(e,t,n,r,i,o,s,a,u){return Yt(this,void 0,void 0,(function(){var c=this;return Jt(this,(function(l){switch(l.label){case 0:return[4,Object(Gt.d)((function(t,n,r,i,o,s,a){return Yt(c,void 0,void 0,(function(){var c,l,f,d,h,p,v,y,g,m,b,w,S,_,E,A,O,I,T,C,x,P,k,N,M,j,R;return Jt(this,(function(D){switch(D.label){case 0:return c=Zt(this.createQueryVariables(e,t,n,r,i),5),l=c[0],f=c[1],d=c[2],h=c[3],p=c[4],[4,Object(Ft.i)(u,this.amplifyConfig)];case 1:v=D.sent(),y={query:l,variables:f,authMode:u,authToken:v},g=0,m=this.opTypeFromTransformerOperation(n),D.label=2;case 2:return D.trys.push([2,4,,20]),[4,Ht.a.graphql(y)];case 3:return[2,[D.sent(),h,p]];case 4:if(!((b=D.sent()).errors&&b.errors.length>0))return[3,18];if(w=Zt(b.errors,1),S=w[0],_=S.originalError,E=(void 0===_?{}:_).code,A=void 0===E?null:E,"Unauthorized"===S.errorType)throw new Gt.a("Unauthorized");if("Network Error"===S.message||"ECONNABORTED"===A){if(!this.processing)throw new Gt.a("Offline");throw new Error("Network Error")}return"ConflictUnhandled"!==S.errorType?[3,13]:(g++,O=void 0,g>10?(O=fe.b,[3,8]):[3,5]);case 5:return D.trys.push([5,7,,8]),[4,this.conflictHandler({modelConstructor:o,localModel:this.modelInstanceCreator(o,f.input),remoteModel:this.modelInstanceCreator(o,S.data),operation:m,attempts:g})];case 6:return O=D.sent(),[3,8];case 7:return I=D.sent(),Xt.warn("conflict trycatch",I),[3,20];case 8:return O!==fe.b?[3,11]:(T=Zt(Object(Ft.b)(this.schema.namespaces[e],p,"GET"),1),C=Zt(T[0],3),x=C[1],P=C[2],[4,Object(Ft.i)(u,this.amplifyConfig)]);case 9:return k=D.sent(),[4,Ht.a.graphql({query:P,variables:{id:f.input.id},authMode:u,authToken:k})];case 10:return[2,[D.sent(),x,p]];case 11:return N=this.schema.namespaces[e],M=Object(Ft.d)(N.relationships,p,m,o,O,d,s,this.modelInstanceCreator,a.id),[4,this.storage.save(M)];case 12:throw D.sent(),new Gt.a("RetryMutation");case 13:return D.trys.push([13,15,16,17]),[4,this.errorHandler({localModel:this.modelInstanceCreator(o,f.input),message:S.message,operation:n,errorType:S.errorType,errorInfo:S.errorInfo,remoteModel:S.data?this.modelInstanceCreator(o,S.data):null})];case 14:return D.sent(),[3,17];case 15:return j=D.sent(),Xt.warn("failed to execute errorHandler",j),[3,17];case 16:return[2,S.data?[{data:(R={},R[h]=S.data,R)},h,p]:[]];case 17:return[3,19];case 18:throw new Gt.a(b);case 19:return[3,20];case 20:if(y)return[3,2];D.label=21;case 21:return[2]}}))}))}),[t,n,r,i,o,s,a],nn)];case 1:return[2,l.sent()]}}))}))},e.prototype.createQueryVariables=function(e,t,n,r,i){var o,s,a=this.schema.namespaces[e].models[t],u=this.schema.namespaces[e].keys[t].primaryKey,c=this.typeQuery.get(a),l=Zt(c.find((function(e){return Zt(e,1)[0]===n})),3),f=l[1],d=l[2],h=JSON.parse(r),p=h._version,v=$t(h,["_version"]),y={};if(u&&u.length)try{for(var g=Qt(u),m=g.next();!m.done;m=g.next()){var b=m.value;y[b]=v[b]}}catch(e){o={error:e}}finally{try{m&&!m.done&&(s=g.return)&&s.call(g)}finally{if(o)throw o.error}}else y.id=v.id;var w=n===Ft.a.DELETE?y:Object.values(a.fields).filter((function(e){var t=e.name,r=e.type,i=e.association;return Object(fe.r)(r)?!(!Object(fe.w)(i)||"BELONGS_TO"!==i.connectionType):n!==Ft.a.UPDATE||v.hasOwnProperty(t)})).map((function(e){var t=e.name,n=e.type,r=e.association,i=t,o=v[t];return Object(fe.r)(n)&&Object(fe.w)(r)&&(i=r.targetName,o=v[i]),[i,o]})).reduce((function(e,t){var n=Zt(t,2),r=n[0],i=n[1];return e[r]=i,e}),{}),S=Wt(Wt({},w),{_version:p}),_=JSON.parse(i);return[d,Wt({input:S},n===Ft.a.CREATE?{}:{condition:Object.keys(_).length>0?_:null}),_,f,a]},e.prototype.opTypeFromTransformerOperation=function(e){switch(e){case Ft.a.CREATE:return fe.h.INSERT;case Ft.a.DELETE:return fe.h.DELETE;case Ft.a.UPDATE:return fe.h.UPDATE;case Ft.a.GET:break;default:Object(Oe.g)(e)}},e.prototype.pause=function(){this.processing=!1},e}(),tn=Object(Gt.b)(3e5),nn=function(e,t,n){var r=tn(e);return!1===r&&"Network Error"===(null==n?void 0:n.message)?3e5:r},rn=n(44),on=function(){return(on=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},sn=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},an=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},un=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},cn=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ln={items:[],nextToken:null,startedAt:null},fn=new r.a("DataStore"),dn=function(){function e(e,t,n,r){void 0===n&&(n={}),this.schema=e,this.syncPredicates=t,this.amplifyConfig=n,this.authModeStrategy=r,this.typeQuery=new WeakMap,this.generateQueries()}return e.prototype.generateQueries=function(){var e=this;Object.values(this.schema.namespaces).forEach((function(t){Object.values(t.models).filter((function(e){return e.syncable})).forEach((function(n){var r=un(Object(Ft.b)(t,n,"LIST"),1),i=un(r[0]).slice(1);e.typeQuery.set(n,i)}))}))},e.prototype.graphqlFilterFromPredicate=function(e){if(!this.syncPredicates)return null;var t=we.a.getPredicates(this.syncPredicates.get(e),!1);return t?Object(Ft.l)(t):null},e.prototype.retrievePage=function(e,t,n,r,i){return void 0===r&&(r=null),sn(this,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h,p,v,y,g,m=this;return an(this,(function(b){switch(b.label){case 0:return o=un(this.typeQuery.get(e),2),s=o[0],a=o[1],u={limit:r,nextToken:n,lastSync:t,filter:i},[4,Object(Ft.h)({authModeStrategy:this.authModeStrategy,defaultAuthMode:this.amplifyConfig.aws_appsync_authenticationType,modelName:e.name,schema:this.schema})];case 1:return c=b.sent(),l=c.READ,f=0,[4,(d=function(){return sn(m,void 0,void 0,(function(){var t,n,r,i;return an(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,4]),fn.debug("Attempting sync with authMode: "+l[f]),[4,this.jitteredRetry({query:a,variables:u,opName:s,modelDefinition:e,authMode:l[f]})];case 1:return t=o.sent(),fn.debug("Sync successful with authMode: "+l[f]),[2,t];case 2:if(n=o.sent(),++f>=l.length){if(r=l[f-1],fn.debug("Sync failed with authMode: "+r,n),Object(Ft.f)(n)||Object(Ft.g)(n))return fn.warn("User is unauthorized to query "+s+" with auth mode "+r+". No data could be returned."),[2,{data:(i={},i[s]=ln,i)}];throw n}return fn.debug("Sync failed with authMode: "+l[f-1]+". Retrying with authMode: "+l[f]),[4,d()];case 3:return[2,o.sent()];case 4:return[2]}}))}))})()];case 2:return h=b.sent().data,p=h[s],v=p.items,y=p.nextToken,g=p.startedAt,[2,{nextToken:y,startedAt:g,items:v}]}}))}))},e.prototype.partialDataFeatureFlagEnabled=function(){try{var e=sessionStorage.getItem("datastorePartialData");return Boolean(e)}catch(e){return!1}},e.prototype.jitteredRetry=function(e){var t=e.query,n=e.variables,r=e.opName,i=e.modelDefinition,s=e.authMode;return sn(this,void 0,void 0,(function(){var e=this;return an(this,(function(a){switch(a.label){case 0:return[4,Object(Gt.c)((function(t,n){return sn(e,void 0,void 0,(function(){var e,a,u,c,l;return an(this,(function(f){switch(f.label){case 0:return f.trys.push([0,3,,4]),[4,Object(Ft.i)(s,this.amplifyConfig)];case 1:return e=f.sent(),[4,Ht.a.graphql({query:t,variables:n,authMode:s,authToken:e})];case 2:return[2,f.sent()];case 3:if(a=f.sent(),u=Object(Ft.f)(a)||Object(Ft.g)(a))throw new Gt.a(u);if(c=Boolean(a&&a.data&&a.data[r]&&a.data[r].items),this.partialDataFeatureFlagEnabled()){if(c)return(l=a).data[r].items=l.data[r].items.filter((function(e){return null!==e})),a.errors&&o.a.dispatch("datastore",{event:"syncQueriesPartialSyncError",data:{errors:a.errors,modelName:i.name}}),[2,l];throw a}if(a&&a.errors&&a.errors.some((function(e){return"Unauthorized"===e.errorType})))return l=a,c?l.data[r].items=l.data[r].items.filter((function(e){return null!==e})):l.data[r]=on(on({},ln),l.data[r]),fn.warn("queryError","User is unauthorized to query "+r+", some items could not be returned."),[2,l];throw a;case 4:return[2]}}))}))}),[t,n])];case 1:return[2,a.sent()]}}))}))},e.prototype.start=function(e){var t=this,n=!0,r=this.amplifyConfig,i=r.maxRecordsToSync,o=r.syncPageSize,s=new Map;return new ue.a((function(r){var a=Object.values(t.schema.namespaces).reduce((function(t,n){var r,i;try{for(var o=cn(Array.from(n.modelTopologicalOrdering.keys())),s=o.next();!s.done;s=o.next()){var a=s.value,u=e.get(n.models[a]);t.set(n.models[a],u)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return t}),new Map),u=Array.from(a.entries()).filter((function(e){return un(e,1)[0].syncable})).map((function(e){var a=un(e,2),u=a[0],c=un(a[1],2),l=c[0],f=c[1];return sn(t,void 0,void 0,(function(){var e,t,a,c,d,h,p,v,y,g=this;return an(this,(function(m){switch(m.label){case 0:return e=!1,t=null,a=null,c=null,d=0,h=this.graphqlFilterFromPredicate(u),p=this.schema.namespaces[l].modelTopologicalOrdering.get(u.name),v=p.map((function(e){return s.get(l+"_"+e)})),y=new Promise((function(s){return sn(g,void 0,void 0,(function(){var p,y;return an(this,(function(g){switch(g.label){case 0:return[4,Promise.all(v)];case 1:g.sent(),g.label=2;case 2:return n?(p=Math.min(i-d,o),[4,this.retrievePage(u,f,t,p,h)]):[2];case 3:y=g.sent(),c=y.items,t=y.nextToken,a=y.startedAt,d+=c.length,e=null===t||d>=i,r.next({namespace:l,modelDefinition:u,items:c,done:e,startedAt:a,isFullSync:!f}),g.label=4;case 4:if(!e)return[3,2];g.label=5;case 5:return s(),[2]}}))}))})),s.set(l+"_"+u.name,y),[4,y];case 1:return m.sent(),[2]}}))}))}));return Promise.all(u).then((function(){r.complete()})),function(){n=!1}}))},e}(),hn=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},pn=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},vn=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},yn=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},gn=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(vn(arguments[t]));return e},mn=Object(i.b)().isNode,bn=new r.a("DataStore"),wn=Symbol("sync");!function(e){e.SYNC_ENGINE_STORAGE_SUBSCRIBED="storageSubscribed",e.SYNC_ENGINE_SUBSCRIPTIONS_ESTABLISHED="subscriptionsEstablished",e.SYNC_ENGINE_SYNC_QUERIES_STARTED="syncQueriesStarted",e.SYNC_ENGINE_SYNC_QUERIES_READY="syncQueriesReady",e.SYNC_ENGINE_MODEL_SYNCED="modelSynced",e.SYNC_ENGINE_OUTBOX_MUTATION_ENQUEUED="outboxMutationEnqueued",e.SYNC_ENGINE_OUTBOX_MUTATION_PROCESSED="outboxMutationProcessed",e.SYNC_ENGINE_OUTBOX_STATUS="outboxStatus",e.SYNC_ENGINE_NETWORK_STATUS="networkStatus",e.SYNC_ENGINE_READY="ready"}(lt||(lt={}));var Sn=function(){function e(e,t,n,r,i,o,s,a,u,c,l){void 0===c&&(c={}),this.schema=e,this.namespaceResolver=t,this.modelClasses=n,this.userModelClasses=r,this.storage=i,this.modelInstanceCreator=o,this.syncPredicates=u,this.amplifyConfig=c,this.authModeStrategy=l,this.online=!1,this.modelSyncedStatus=new WeakMap;var f=this.modelClasses.MutationEvent;this.outbox=new Vt(this.schema,f,o,wn),this.modelMerger=new Ut(this.outbox,wn),this.syncQueriesProcessor=new dn(this.schema,this.syncPredicates,this.amplifyConfig,this.authModeStrategy),this.subscriptionsProcessor=new rn.b(this.schema,this.syncPredicates,this.amplifyConfig,this.authModeStrategy),this.mutationsProcessor=new en(this.schema,this.storage,this.userModelClasses,this.outbox,this.modelInstanceCreator,f,this.amplifyConfig,this.authModeStrategy,s,a),this.datastoreConnectivity=new kt}return e.prototype.getModelSyncedStatus=function(e){return this.modelSyncedStatus.get(e)},e.prototype.start=function(e){var t=this;return new ue.a((function(n){bn.log("starting sync engine...");var r=[];return hn(t,void 0,void 0,(function(){var t,i,o,s=this;return pn(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.setupModels(e)];case 1:return a.sent(),[3,3];case 2:return t=a.sent(),n.error(t),[2];case 3:return i=new Promise((function(e){s.datastoreConnectivity.status().subscribe((function(t){var i=t.online;return hn(s,void 0,void 0,(function(){var t,o,s,a,u,c=this;return pn(this,(function(l){switch(l.label){case 0:return!i||this.online?[3,10]:(this.online=i,n.next({type:lt.SYNC_ENGINE_NETWORK_STATUS,data:{active:this.online}}),o=void 0,mn?(bn.warn("Realtime disabled when in a server-side environment"),[3,6]):[3,1]);case 1:u=vn(this.subscriptionsProcessor.start(),2),t=u[0],o=u[1],l.label=2;case 2:return l.trys.push([2,4,,5]),[4,new Promise((function(e,n){var i=t.subscribe({next:function(t){t===rn.a.CONNECTED&&e()},error:function(e){n(e),c.disconnectionHandler()(e)}});r.push(i)}))];case 3:return l.sent(),[3,5];case 4:return s=l.sent(),n.error(s),[2];case 5:bn.log("Realtime ready"),n.next({type:lt.SYNC_ENGINE_SUBSCRIPTIONS_ESTABLISHED}),l.label=6;case 6:return l.trys.push([6,8,,9]),[4,new Promise((function(e,t){var i=c.syncQueriesObservable().subscribe({next:function(t){t.type===lt.SYNC_ENGINE_SYNC_QUERIES_READY&&e(),n.next(t)},complete:function(){e()},error:function(e){t(e)}});i&&r.push(i)}))];case 7:return l.sent(),[3,9];case 8:return a=l.sent(),n.error(a),[2];case 9:return r.push(this.mutationsProcessor.start().subscribe((function(e){var t=e.modelDefinition,r=e.model,i=e.hasMore,o=c.userModelClasses[t.name],s=c.modelInstanceCreator(o,r);c.storage.runExclusive((function(e){return c.modelMerger.merge(e,s)})),n.next({type:lt.SYNC_ENGINE_OUTBOX_MUTATION_PROCESSED,data:{model:o,element:s}}),n.next({type:lt.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:!i}})}))),mn||r.push(o.subscribe((function(e){var t=vn(e,3),n=(t[0],t[1]),r=t[2],i=c.userModelClasses[n.name],o=c.modelInstanceCreator(i,r);c.storage.runExclusive((function(e){return c.modelMerger.merge(e,o)}))}))),[3,11];case 10:i||(this.online=i,n.next({type:lt.SYNC_ENGINE_NETWORK_STATUS,data:{active:this.online}}),r.forEach((function(e){return e.unsubscribe()})),r=[]),l.label=11;case 11:return e(),[2]}}))}))}))})),this.storage.observe(null,null,wn).filter((function(e){var t=e.model;return!0===s.getModelDefinition(t).syncable})).subscribe({next:function(e){var t=e.opType,r=e.model,o=e.element,a=e.condition;return hn(s,void 0,void 0,(function(){var e,s,u,c;return pn(this,(function(l){switch(l.label){case 0:return e=this.schema.namespaces[this.namespaceResolver(r)],s=this.modelClasses.MutationEvent,u=Object(Ft.k)(a),c=Object(Ft.d)(e.relationships,this.getModelDefinition(r),t,r,o,u,s,this.modelInstanceCreator),[4,this.outbox.enqueue(this.storage,c)];case 1:return l.sent(),n.next({type:lt.SYNC_ENGINE_OUTBOX_MUTATION_ENQUEUED,data:{model:r,element:o}}),n.next({type:lt.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:!1}}),[4,i];case 2:return l.sent(),this.online&&this.mutationsProcessor.resume(),[2]}}))}))}}),n.next({type:lt.SYNC_ENGINE_STORAGE_SUBSCRIBED}),[4,this.outbox.peek(this.storage)];case 4:return o=void 0===a.sent(),n.next({type:lt.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:o}}),[4,i];case 5:return a.sent(),n.next({type:lt.SYNC_ENGINE_READY}),[2]}}))})),function(){r.forEach((function(e){return e.unsubscribe()}))}}))},e.prototype.getModelsMetadataWithNextFullSync=function(e){return hn(this,void 0,void 0,(function(){var t,n=this;return pn(this,(function(r){switch(r.label){case 0:return t=Map.bind,[4,this.getModelsMetadata()];case 1:return[2,new(t.apply(Map,[void 0,r.sent().map((function(t){var r=t.namespace,i=t.model,o=t.lastSync,s=t.lastFullSync,a=t.fullSyncInterval,u=(t.lastSyncPredicate,!s||s+a<e?0:o);return[n.schema.namespaces[r].models[i],[r,u]]}))]))]}}))}))},e.prototype.syncQueriesObservable=function(){var e=this;return this.online?new ue.a((function(t){var n,r;return hn(e,void 0,void 0,(function(){var e,i,o=this;return pn(this,(function(s){switch(s.label){case 0:e=function(){var e,s,a,u,c,l,f,d,h;return pn(this,(function(p){switch(p.label){case 0:return e=new WeakMap,[4,i.getModelsMetadataWithNextFullSync(Date.now())];case 1:return s=p.sent(),a=new Set(s.keys()),[4,new Promise((function(r){n=o.syncQueriesProcessor.start(s).subscribe({next:function(i){var s=i.namespace,h=i.modelDefinition,p=i.items,v=i.done,y=i.startedAt,g=i.isFullSync;return hn(o,void 0,void 0,(function(){var i,o,m,b,w,S,_=this;return pn(this,(function(E){switch(E.label){case 0:return i=this.userModelClasses[h.name],e.has(i)||(e.set(i,{new:0,updated:0,deleted:0}),l=Object(Oe.j)(),d=void 0===d?y:Math.max(d,y)),[4,this.storage.runExclusive((function(t){return hn(_,void 0,void 0,(function(){var n,r,o,s,a,u,c,l,f,d,h,v,y,g,m;return pn(this,(function(b){switch(b.label){case 0:return[4,this.outbox.getModelIds(t)];case 1:n=b.sent(),r=[],o=p.filter((function(e){return!n.has(e.id)||(r.push(e),!1)})),s=[],b.label=2;case 2:b.trys.push([2,7,8,9]),a=yn(r),u=a.next(),b.label=3;case 3:return u.done?[3,6]:(c=u.value,[4,this.modelMerger.merge(t,c)]);case 4:void 0!==(l=b.sent())&&s.push([c,l]),b.label=5;case 5:return u=a.next(),[3,3];case 6:return[3,9];case 7:return f=b.sent(),g={error:f},[3,9];case 8:try{u&&!u.done&&(m=a.return)&&m.call(a)}finally{if(g)throw g.error}return[7];case 9:return h=(d=s.push).apply,v=[s],[4,this.modelMerger.mergePage(t,i,o)];case 10:return h.apply(d,v.concat([gn.apply(void 0,[b.sent()])])),y=e.get(i),s.forEach((function(e){var t=vn(e,2)[1];switch(t){case fe.h.INSERT:y.new++;break;case fe.h.UPDATE:y.updated++;break;case fe.h.DELETE:y.deleted++;break;default:Object(Oe.g)(t)}})),[2]}}))}))}))];case 1:return E.sent(),v?(o=h.name,[4,this.getModelMetadata(s,o)]):[3,4];case 2:return m=E.sent(),b=m.lastFullSync,w=m.fullSyncInterval,c=w,u=void 0===u?b:Math.max(u,g?y:b),m=this.modelClasses.ModelMetadata.copyOf(m,(function(e){e.lastSync=y,e.lastFullSync=g?y:m.lastFullSync})),[4,this.storage.save(m,void 0,wn)];case 3:E.sent(),S=e.get(i),this.modelSyncedStatus.set(i,!0),t.next({type:lt.SYNC_ENGINE_MODEL_SYNCED,data:{model:i,isFullSync:g,isDeltaSync:!g,counts:S}}),a.delete(h),0===a.size&&(f=Object(Oe.j)()-l,r(),t.next({type:lt.SYNC_ENGINE_SYNC_QUERIES_READY}),n.unsubscribe()),E.label=4;case 4:return[2]}}))}))},error:function(e){t.error(e)}}),t.next({type:lt.SYNC_ENGINE_SYNC_QUERIES_STARTED,data:{models:Array.from(a).map((function(e){return e.name}))}})}))];case 2:return p.sent(),h=u+c-(d+f),bn.debug("Next fullSync in "+h/1e3+" seconds. ("+new Date(Date.now()+h)+")"),[4,new Promise((function(e){r=setTimeout(e,h)}))];case 3:return p.sent(),[2]}}))},i=this,s.label=1;case 1:return t.closed?[3,3]:[5,e()];case 2:return s.sent(),[3,1];case 3:return[2]}}))})),function(){n&&n.unsubscribe(),r&&clearTimeout(r)}})):ue.a.of()},e.prototype.disconnectionHandler=function(){var e=this;return function(t){Tt.CONTROL_MSG.CONNECTION_CLOSED!==t&&Tt.CONTROL_MSG.TIMEOUT_DISCONNECT!==t||e.datastoreConnectivity.socketDisconnected()}},e.prototype.unsubscribeConnectivity=function(){this.datastoreConnectivity.unsubscribe()},e.prototype.setupModels=function(e){return hn(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,f,d,h,p=this;return pn(this,(function(v){switch(v.label){case 0:t=e.fullSyncInterval,n=this.modelClasses.ModelMetadata,r=[],Object.values(this.schema.namespaces).forEach((function(e){Object.values(e.models).filter((function(e){return e.syncable})).forEach((function(t){if(r.push([e.name,t]),e.name===Oe.e){var n=p.userModelClasses[t.name];p.modelSyncedStatus.set(n,!1)}}))})),o=r.map((function(e){var r=vn(e,2),o=r[0],s=r[1];return hn(p,void 0,void 0,(function(){var e,r,a,u,c,l,f,d,h;return pn(this,(function(p){switch(p.label){case 0:return[4,this.getModelMetadata(o,s.name)];case 1:return e=p.sent(),r=we.a.getPredicates(this.syncPredicates.get(s),!1),a=r?JSON.stringify(r):null,void 0!==e?[3,3]:[4,this.storage.save(this.modelInstanceCreator(n,{model:s.name,namespace:o,lastSync:null,fullSyncInterval:t,lastFullSync:null,lastSyncPredicate:a}),void 0,wn)];case 2:return l=vn.apply(void 0,[p.sent(),1]),f=vn(l[0],1),i=f[0],[3,5];case 3:return u=e.lastSyncPredicate?e.lastSyncPredicate:null,c=u!==a,[4,this.storage.save(this.modelClasses.ModelMetadata.copyOf(e,(function(e){e.fullSyncInterval=t,c&&(e.lastSync=null,e.lastFullSync=null,e.lastSyncPredicate=a)})))];case 4:d=vn.apply(void 0,[p.sent(),1]),h=vn(d[0],1),i=h[0],p.label=5;case 5:return[2,i]}}))}))})),s={},v.label=1;case 1:return v.trys.push([1,6,7,8]),[4,Promise.all(o)];case 2:a=yn.apply(void 0,[v.sent()]),u=a.next(),v.label=3;case 3:if(u.done)return[3,5];c=u.value,l=c.model,s[l]=c,v.label=4;case 4:return u=a.next(),[3,3];case 5:return[3,8];case 6:return f=v.sent(),d={error:f},[3,8];case 7:try{u&&!u.done&&(h=a.return)&&h.call(a)}finally{if(d)throw d.error}return[7];case 8:return[2,s]}}))}))},e.prototype.getModelsMetadata=function(){return hn(this,void 0,void 0,(function(){var e;return pn(this,(function(t){switch(t.label){case 0:return e=this.modelClasses.ModelMetadata,[4,this.storage.query(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.getModelMetadata=function(e,t){return hn(this,void 0,void 0,(function(){var n,r,i;return pn(this,(function(o){switch(o.label){case 0:return n=this.modelClasses.ModelMetadata,r=we.a.createFromExisting(this.schema.namespaces[Oe.d].models[n.name],(function(n){return n.namespace("eq",e).model("eq",t)})),[4,this.storage.query(n,r,{page:0,limit:1})];case 1:return i=vn.apply(void 0,[o.sent(),1]),[2,i[0]]}}))}))},e.prototype.getModelDefinition=function(e){var t=this.namespaceResolver(e);return this.schema.namespaces[t].models[e.name]},e.getNamespace=function(){return{name:Oe.d,relationships:{},enums:{OperationType:{name:"OperationType",values:["CREATE","UPDATE","DELETE"]}},nonModels:{},models:{MutationEvent:{name:"MutationEvent",pluralName:"MutationEvents",syncable:!1,fields:{id:{name:"id",type:"ID",isRequired:!0,isArray:!1},model:{name:"model",type:"String",isRequired:!0,isArray:!1},data:{name:"data",type:"String",isRequired:!0,isArray:!1},modelId:{name:"modelId",type:"String",isRequired:!0,isArray:!1},operation:{name:"operation",type:{enum:"Operationtype"},isArray:!1,isRequired:!0},condition:{name:"condition",type:"String",isArray:!1,isRequired:!0}}},ModelMetadata:{name:"ModelMetadata",pluralName:"ModelsMetadata",syncable:!1,fields:{id:{name:"id",type:"ID",isRequired:!0,isArray:!1},namespace:{name:"namespace",type:"String",isRequired:!0,isArray:!1},model:{name:"model",type:"String",isRequired:!0,isArray:!1},lastSync:{name:"lastSync",type:"Int",isRequired:!1,isArray:!1},lastFullSync:{name:"lastFullSync",type:"Int",isRequired:!1,isArray:!1},fullSyncInterval:{name:"fullSyncInterval",type:"Int",isRequired:!0,isArray:!1},lastSyncPredicate:{name:"lastSyncPredicate",type:"String",isRequired:!1,isArray:!1}}}}}},e}();function _n(e){return(_n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var En=function(){return(En=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},An=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},On=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},In=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},Tn=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},Cn=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},xn=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Tn(arguments[t]));return e};se(!0),z();var Pn,kn,Nn,Mn,jn,Rn=new r.a("DataStore"),Dn=Object(Oe.x)(Date.now()),Un=i.a.browserOrNode().isNode,Fn=new WeakMap,Ln=new WeakMap,Bn=function(e){var t=Fn.get(e);return Pn.namespaces[t].models[e.name]},qn=function(e){return Object(Oe.t)(e)&&Fn.has(e)},zn=function(e){return Fn.get(e)},Kn=function(e){var t;if(void 0!==Pn)return console.warn("The schema has already been initialized"),Nn;Rn.log("validating schema",{schema:e});var n=En({name:Oe.e},e);Rn.log("DataStore","Init models"),Nn=Vn(n),Rn.log("DataStore","Models initialized");var r={name:Oe.a,relationships:{},enums:{},nonModels:{},models:{Setting:{name:"Setting",pluralName:"Settings",syncable:!1,fields:{id:{name:"id",type:"ID",isRequired:!0,isArray:!1},key:{name:"key",type:"String",isRequired:!0,isArray:!1},value:{name:"value",type:"String",isRequired:!0,isArray:!1}}}}},i=It.getNamespace(),o=Sn.getNamespace();return Mn=Vn(r),jn=Vn(i),kn=Vn(o),Pn={namespaces:(t={},t[r.name]=r,t[n.name]=n,t[i.name]=i,t[o.name]=o,t),version:e.version},Object.keys(Pn.namespaces).forEach((function(e){var t,n,r=Tn(Object(Oe.f)(Pn.namespaces[e]),2),i=r[0],o=r[1];Pn.namespaces[e].relationships=i,Pn.namespaces[e].keys=o;var s=new Map;Object.values(Pn.namespaces[e].models).forEach((function(e){var t=[];Object.values(e.fields).filter((function(t){return t.association&&"BELONGS_TO"===t.association.connectionType&&t.type.model!==e.name})).forEach((function(e){return t.push(e.type.model)})),s.set(e.name,t)}));for(var a=new Map,u=1e3;u>0&&0!==s.size;){if(0===--u)throw new Error("Models are not topologically sortable. Please verify your schema.");try{for(var c=(t=void 0,Cn(Array.from(s.keys()))),l=c.next();!l.done;l=c.next()){var f=l.value,d=s.get(f);d.every((function(e){return a.has(e)}))&&a.set(f,d)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}Array.from(a.keys()).forEach((function(e){return s.delete(e)}))}Pn.namespaces[e].modelTopologicalOrdering=a})),Nn},Vn=function(e){var t={};return Object.entries(e.models).forEach((function(n){var r=Tn(n,2),i=r[0],o=r[1],s=Zn(o);t[i]=s,Fn.set(s,e.name)})),Object.entries(e.nonModels||{}).forEach((function(e){var n=Tn(e,2),r=n[0],i=n[1],o=er(i);t[r]=o})),t},Hn=new WeakSet;function Gn(e,t){return Hn.add(t),new e(t)}var Wn,Yn=function(e){return function(t,n){var r=e.fields[t];if(void 0!==r){var i=r.type,o=r.isRequired,s=r.isArrayNullable,a=r.name,u=r.isArray;if((!u&&o||u&&!s)&&null==n)throw new Error("Field "+a+" is required");if(Object(fe.m)(i)){var c=fe.c.getJSType(i),l=fe.c.getValidationFunction(i);if("AWSJSON"===i){if(_n(n)===c)return;if("string"==typeof n)try{return void JSON.parse(n)}catch(e){throw new Error("Field "+a+" is an invalid JSON object. "+n)}}if(u){var f=c;if(o||(f=c+" | null | undefined"),!Array.isArray(n)&&!s)throw new Error("Field "+a+" should be of type ["+f+"], "+_n(n)+" received. "+n);if(!Object(Oe.v)(n)&&n.some((function(e){return Object(Oe.v)(e)?o:_n(e)!==c}))){var d=n.map((function(e){return null===e?"null":_n(e)})).join(",");throw new Error("All elements in the "+a+" array should be of type "+f+", ["+d+"] received. "+n)}if(l&&!Object(Oe.v)(n))if(!n.map((function(e){return Object(Oe.v)(e)?!(!Object(Oe.v)(e)||o):l(e)})).every((function(e){return e})))throw new Error("All elements in the "+a+" array should be of type "+i+", validation failed for one or more elements. "+n)}else{if(!o&&void 0===n)return;if(_n(n)!==c&&null!==n)throw new Error("Field "+a+" should be of type "+c+", "+_n(n)+" received. "+n);if(!Object(Oe.v)(n)&&l&&!l(n))throw new Error("Field "+a+" should be of type "+i+", validation failed. "+n)}}}}},Jn=function(e,t,n){var r=e.fields[t]||{},i=r.isArray,o=r.type;if("string"==typeof n&&(i||"AWSJSON"===o||Object(fe.s)(o)||Object(fe.r)(o)))try{return JSON.parse(n)}catch(e){}return"number"==typeof n&&"Boolean"===o?Boolean(n):n},$n=function(e,t,n){var r=Yn(t);Object.entries(e).forEach((function(e){var i=Tn(e,2),o=i[0],s=i[1],a=Jn(t,o,s);r(o,a),n[o]=a}))},Zn=function(e){var t=function(){function n(t){return oe(this,(function(n){$n(t,e,n);var r=Hn.has(t)?t:{},i=r.id,o=r._version,s=r._lastChangedAt,a=r._deleted,u=null!=i,c=u?i:e.syncable?Object(ae.v4)():Dn();u||Qn(n,e),n.id=c,e.syncable&&(n._version=o,n._lastChangedAt=s,n._deleted=a)}))}return n.copyOf=function(t,n){var r,i=Object.getPrototypeOf(t||{}).constructor;if(!qn(i)){var o="The source object is not a valid model";throw Rn.error(o,{source:t}),new Error(o)}var s=oe(t,(function(r){n(r),r.id=t.id;var i=Yn(e);Object.entries(r).forEach((function(t){var n=Tn(t,2),r=n[0],o=n[1],s=Jn(e,r,o);i(r,s)}))}),(function(e){return r=e}));return r.length&&(Ln.set(s,[r,t]),Xn(r,e)),s},n.fromJSON=function(n){var r=this;if(Array.isArray(n))return n.map((function(e){return r.fromJSON(e)}));var i=Gn(t,n),o=Yn(e);return Object.entries(i).forEach((function(e){var t=Tn(e,2),n=t[0],r=t[1];o(n,r)})),i},n}();return t[$]=!0,Object.defineProperty(t,"name",{value:e.name}),t},Qn=function(e,t){var n=Object.keys(e),r=t.fields;n.forEach((function(e){if(r[e]&&r[e].isReadOnly)throw new Error(e+" is read-only.")}))},Xn=function(e,t){var n=e.map((function(e){return[e.path[0],e.value]})),r=t.fields;n.forEach((function(e){var t=Tn(e,2),n=t[0];if(t[1]&&r[n]&&r[n].isReadOnly)throw new Error(n+" is read-only.")}))},er=function(e){var t=function(t){return oe(this,(function(n){$n(t,e,n)}))};return t[$]=!0,Object.defineProperty(t,"name",{value:e.name}),Object(Oe.y)(t),t};function tr(e){return"string"==typeof e}function nr(e){var t=e.localModel,n=e.modelConstructor,r=e.remoteModel._version;return Gn(n,En(En({},t),{_version:r}))}function rr(e){Rn.warn(e)}function ir(e,t){var n;switch(e){case Oe.a:n=Mn[t];break;case Oe.e:n=Nn[t];break;case Oe.d:n=kn[t];break;case Oe.c:n=jn[t];break;default:Object(Oe.g)(e)}if(qn(n))return n;var r="Model name is not valid for namespace. modelName: "+t+", namespace: "+e;throw Rn.error(r),new Error(r)}function or(e,t){return An(this,void 0,void 0,(function(){var n,r,i=this;return On(this,(function(o){switch(o.label){case 0:return n=Mn.Setting,r=Pn.namespaces[Oe.a].models.Setting,[4,e.runExclusive((function(e){return An(i,void 0,void 0,(function(){var i,o;return On(this,(function(s){switch(s.label){case 0:return[4,e.query(n,we.a.createFromExisting(r,(function(e){return e.key("eq","schemaVersion")})),{page:0,limit:1})];case 1:return i=Tn.apply(void 0,[s.sent(),1]),void 0===(o=i[0])||void 0===o.value?[3,4]:JSON.parse(o.value)===t?[3,3]:[4,e.clear(!1)];case 2:s.sent(),s.label=3;case 3:return[3,6];case 4:return[4,e.save(Gn(n,{key:"schemaVersion",value:JSON.stringify(t)}))];case 5:s.sent(),s.label=6;case 6:return[2]}}))}))}))];case 1:return o.sent(),[2]}}))}))}var sr=function(){function e(){var e=this;this.amplifyConfig={},this.syncPredicates=new WeakMap,this.start=function(){return An(e,void 0,void 0,(function(){var e,t,n,r=this;return On(this,(function(i){switch(i.label){case 0:return void 0!==this.initialized?[3,1]:(Rn.debug("Starting DataStore"),this.initialized=new Promise((function(e,t){r.initResolve=e,r.initReject=t})),[3,3]);case 1:return[4,this.initialized];case 2:return i.sent(),[2];case 3:return this.storage=new It(Pn,zn,ir,Gn,this.storageAdapter,this.sessionId),[4,this.storage.init()];case 4:return i.sent(),[4,or(this.storage,Pn.version)];case 5:return i.sent(),(e=this.amplifyConfig.aws_appsync_graphqlEndpoint)?(Rn.debug("GraphQL endpoint available",e),t=this,[4,this.processSyncExpressions()]):[3,7];case 6:return t.syncPredicates=i.sent(),this.sync=new Sn(Pn,zn,kn,Nn,this.storage,Gn,this.conflictHandler,this.errorHandler,this.syncPredicates,this.amplifyConfig,this.authModeStrategy),n=1e3*this.fullSyncInterval*60,Wn=this.sync.start({fullSyncInterval:n}).subscribe({next:function(e){var t=e.type,n=e.data;t===(Un?lt.SYNC_ENGINE_SYNC_QUERIES_READY:lt.SYNC_ENGINE_STORAGE_SUBSCRIBED)&&r.initResolve(),o.a.dispatch("datastore",{event:t,data:n})},error:function(e){Rn.warn("Sync error",e),r.initReject()}}),[3,8];case 7:Rn.warn("Data won't be synchronized. No GraphQL endpoint configured. Did you forget `Amplify.configure(awsconfig)`?",{config:this.amplifyConfig}),this.initResolve(),i.label=8;case 8:return[4,this.initialized];case 9:return i.sent(),[2]}}))}))},this.query=function(t,n,r){return An(e,void 0,void 0,(function(){var e,i,o,s,a;return On(this,(function(u){switch(u.label){case 0:return[4,this.start()];case 1:if(u.sent(),!qn(t))throw e="Constructor is not for a valid model",Rn.error(e,{modelConstructor:t}),new Error(e);return"string"==typeof n&&void 0!==r&&Rn.warn("Pagination is ignored when querying by id"),i=Bn(t),o=tr(n)?we.a.createForId(i,n):Object(we.c)(n)?void 0:we.a.createFromExisting(i,n),s=this.processPagination(i,r),Rn.debug("params ready",{modelConstructor:t,predicate:we.a.getPredicates(o,!1),pagination:En(En({},s),{sort:Se.a.getPredicates(s&&s.sort,!1)})}),[4,this.storage.query(t,o,s)];case 2:return a=u.sent(),[2,tr(n)?a[0]:a]}}))}))},this.save=function(t,n){return An(e,void 0,void 0,(function(){var e,r,i,o,s,a,u=this;return On(this,(function(c){switch(c.label){case 0:return[4,this.start()];case 1:if(c.sent(),e=Ln.get(t),r=t?t.constructor:void 0,!qn(r))throw i="Object is not an instance of a valid model",Rn.error(i,{model:t}),new Error(i);return o=Bn(r),s=we.a.createFromExisting(o,n),[4,this.storage.runExclusive((function(n){return An(u,void 0,void 0,(function(){return On(this,(function(i){switch(i.label){case 0:return[4,n.save(t,s,void 0,e)];case 1:return i.sent(),[2,n.query(r,we.a.createForId(o,t.id))]}}))}))}))];case 2:return a=Tn.apply(void 0,[c.sent(),1]),[2,a[0]]}}))}))},this.setConflictHandler=function(t){var n=t.DataStore;return n&&n.conflictHandler?n.conflictHandler:e.conflictHandler===nr&&t.conflictHandler?t.conflictHandler:e.conflictHandler||nr},this.setErrorHandler=function(t){var n=t.DataStore;return n&&n.errorHandler?n.errorHandler:e.errorHandler===rr&&t.errorHandler?t.errorHandler:e.errorHandler||rr},this.delete=function(t,n){return An(e,void 0,void 0,(function(){var e,r,i,o,s,a,u,c,l;return On(this,(function(f){switch(f.label){case 0:return[4,this.start()];case 1:if(f.sent(),!t)throw u="Model or Model Constructor required",Rn.error(u,{modelOrConstructor:t}),new Error(u);if(!qn(t))return[3,3];if(o=t,!n)throw u="Id to delete or criteria required. Do you want to delete all? Pass Predicates.ALL",Rn.error(u,{idOrCriteria:n}),new Error(u);if("string"==typeof n)e=we.a.createForId(Bn(o),n);else if(!(e=we.a.createFromExisting(Bn(o),n))||!we.a.isValidPredicate(e))throw u="Criteria required. Do you want to delete all? Pass Predicates.ALL",Rn.error(u,{condition:e}),new Error(u);return[4,this.storage.delete(o,e)];case 2:return r=Tn.apply(void 0,[f.sent(),1]),[2,r[0]];case 3:if(i=t,o=Object.getPrototypeOf(i||{}).constructor,!qn(o))throw u="Object is not an instance of a valid model",Rn.error(u,{model:i}),new Error(u);if(s=Bn(o),a=we.a.createForId(s,i.id),n){if("function"!=typeof n)throw u="Invalid criteria",Rn.error(u,{idOrCriteria:n}),new Error(u);e=n(a)}else e=a;return[4,this.storage.delete(i,e)];case 4:return c=Tn.apply(void 0,[f.sent(),1]),l=Tn(c[0],1),[2,l[0]]}}))}))},this.observe=function(t,n){var r,i=t&&qn(t)?t:void 0;if(t&&void 0===i){var o=t,s=o&&Object.getPrototypeOf(o).constructor;if(qn(s))return n&&Rn.warn("idOrCriteria is ignored when using a model instance",{model:o,idOrCriteria:n}),e.observe(s,o.id);var a="The model is not an instance of a PersistentModelConstructor";throw Rn.error(a,{model:o}),new Error(a)}if(void 0!==n&&void 0===i){a="Cannot provide criteria without a modelConstructor";throw Rn.error(a,n),new Error(a)}if(i&&!qn(i)){a="Constructor is not for a valid model";throw Rn.error(a,{modelConstructor:i}),new Error(a)}return r="string"==typeof n?we.a.createForId(Bn(i),n):i&&we.a.createFromExisting(Bn(i),n),new ue.a((function(t){var n;return An(e,void 0,void 0,(function(){return On(this,(function(e){switch(e.label){case 0:return[4,this.start()];case 1:return e.sent(),n=this.storage.observe(i,r).filter((function(e){var t=e.model;return zn(t)===Oe.e})).subscribe(t),[2]}}))})),function(){n&&n.unsubscribe()}}))},this.observeQuery=function(t,n,r){return new ue.a((function(i){var s,a=new Map,u=new Map,c=[],l=function(){var e=p();v(e)},f=new Oe.b({callback:l,errorHandler:i.error,maxInterval:2e3}),d=(r||{}).sort,h=d?{sort:d}:void 0;An(e,void 0,void 0,(function(){var e,r=this;return On(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.query(t,n,h)];case 1:return o.sent().forEach((function(e){return a.set(e.id,e)})),s=this.observe(t,n).subscribe((function(e){var t,n,i=e.element,o=e.model;"DELETE"===e.opType?c.push(i.id):u.set(i.id,i);var s=null!==(n=null===(t=r.sync)||void 0===t?void 0:t.getModelSyncedStatus(o))&&void 0!==n&&n;(u.size-c.length>=r.syncPageSize||s)&&f.resolve(),f.start()})),l(),[3,3];case 2:return e=o.sent(),i.error(e),[3,3];case 3:return[2]}}))}));var p=function(){var n,i,o=null!==(i=null===(n=e.sync)||void 0===n?void 0:n.getModelSyncedStatus(t))&&void 0!==i&&i,s=xn(Array.from(a.values()),Array.from(u.values()));return(null==r?void 0:r.sort)&&y(s),a.clear(),s.forEach((function(e){return a.set(e.id,e)})),c.forEach((function(e){return a.delete(e)})),{items:Array.from(a.values()),isSynced:o}},v=function(e){i.next(e),u.clear(),c=[]},y=function(n){var i=Bn(t),o=e.processPagination(i,r),s=Se.a.getPredicates(o.sort);if(s.length){var a=Object(Oe.z)(s);n.sort(a)}};return o.a.listen("datastore",(function e(n){var r,i=n.payload,s=i.event,a=i.data;s===lt.SYNC_ENGINE_MODEL_SYNCED&&(null===(r=null==a?void 0:a.model)||void 0===r?void 0:r.name)===t.name&&(l(),o.a.remove("api",e))})),function(){s&&s.unsubscribe()}}))},this.configure=function(t){void 0===t&&(t={});var n=t.DataStore,r=t.authModeStrategyType,i=(t.conflictHandler,t.errorHandler,t.maxRecordsToSync),o=t.syncPageSize,s=t.fullSyncInterval,a=t.syncExpressions,u=t.authProviders,c=t.storageAdapter,l=In(t,["DataStore","authModeStrategyType","conflictHandler","errorHandler","maxRecordsToSync","syncPageSize","fullSyncInterval","syncExpressions","authProviders","storageAdapter"]);switch(e.amplifyConfig=En(En({},l),e.amplifyConfig),e.conflictHandler=e.setConflictHandler(t),e.errorHandler=e.setErrorHandler(t),n&&n.authModeStrategyType||r||fe.a.DEFAULT){case fe.a.MULTI_AUTH:e.authModeStrategy=me;break;case fe.a.DEFAULT:default:e.authModeStrategy=be}e.amplifyConfig.authProviders=n&&n.authProviders||u,e.syncExpressions=n&&n.syncExpressions||a||e.syncExpressions,e.maxRecordsToSync=n&&n.maxRecordsToSync||i||e.maxRecordsToSync||1e4,e.amplifyConfig.maxRecordsToSync=e.maxRecordsToSync,e.syncPageSize=n&&n.syncPageSize||o||e.syncPageSize||1e3,e.amplifyConfig.syncPageSize=e.syncPageSize,e.fullSyncInterval=n&&n.fullSyncInterval||s||e.fullSyncInterval||1440,e.storageAdapter=n&&n.storageAdapter||c||e.storageAdapter||void 0,e.sessionId=e.retrieveSessionId()},this.clear=function(){return An(this,void 0,void 0,(function(){return On(this,(function(e){switch(e.label){case 0:return void 0===this.storage?[2]:(Wn&&!Wn.closed&&Wn.unsubscribe(),[4,this.storage.clear()]);case 1:return e.sent(),this.sync&&this.sync.unsubscribeConnectivity(),this.initialized=void 0,this.storage=void 0,this.sync=void 0,this.syncPredicates=new WeakMap,[2]}}))}))},this.stop=function(){return An(this,void 0,void 0,(function(){return On(this,(function(e){switch(e.label){case 0:return void 0===this.initialized?[3,2]:[4,this.start()];case 1:e.sent(),e.label=2;case 2:return Wn&&!Wn.closed&&Wn.unsubscribe(),this.sync&&this.sync.unsubscribeConnectivity(),this.initialized=void 0,this.sync=void 0,[2]}}))}))}}return e.prototype.getModuleName=function(){return"DataStore"},e.prototype.processPagination=function(e,t){var n,r=t||{},i=r.limit,o=r.page,s=r.sort;if(void 0!==i||void 0!==o||void 0!==s){if(void 0!==o&&void 0===i)throw new Error("Limit is required when requesting a page");if(void 0!==o){if("number"!=typeof o)throw new Error("Page should be a number");if(o<0)throw new Error("Page can't be negative")}if(void 0!==i){if("number"!=typeof i)throw new Error("Limit should be a number");if(i<0)throw new Error("Limit can't be negative")}return s&&(n=Se.a.createFromExisting(e,t.sort)),{limit:i,page:o,sort:n}}},e.prototype.processSyncExpressions=function(){return An(this,void 0,void 0,(function(){var e,t=this;return On(this,(function(n){switch(n.label){case 0:return this.syncExpressions&&this.syncExpressions.length?[4,Promise.all(this.syncExpressions.map((function(e){return An(t,void 0,void 0,(function(){var t,n,r,i,o,s;return On(this,(function(a){switch(a.label){case 0:return[4,e];case 1:return t=a.sent(),n=t.modelConstructor,r=t.conditionProducer,i=Bn(n),[4,this.unwrapPromise(r)];case 2:return o=a.sent(),Object(we.c)(o)?[2,[i,null]]:(s=this.createFromCondition(i,o),[2,[i,s]])}}))}))})))]:[2,new WeakMap];case 1:return e=n.sent(),[2,this.weakMapFromEntries(e)]}}))}))},e.prototype.createFromCondition=function(e,t){try{return we.a.createFromExisting(e,t)}catch(e){throw Rn.error("Error creating Sync Predicate"),e}},e.prototype.unwrapPromise=function(e){return An(this,void 0,void 0,(function(){var t;return On(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,e()];case 1:return[2,n.sent()];case 2:if((t=n.sent())instanceof TypeError)return[2,e];throw t;case 3:return[2]}}))}))},e.prototype.weakMapFromEntries=function(e){return e.reduce((function(e,t){var n=Tn(t,2),r=n[0],i=n[1];if(e.has(r)){var o=r.name;return Rn.warn("You can only utilize one Sync Expression per model.\n Subsequent sync expressions for the "+o+" model will be ignored."),e}return i&&e.set(r,i),e}),new WeakMap)},e.prototype.retrieveSessionId=function(){try{var e=sessionStorage.getItem("datastoreSessionId");if(e){var t=this.amplifyConfig.aws_appsync_graphqlEndpoint.split("/")[2];return e+"-"+Tn(t.split("."),1)[0]}}catch(e){return}},e}(),ar=new sr;s.a.register(ar);var ur={USER:Oe.e,traverseModel:Oe.A,validatePredicate:Oe.B,isNonModelConstructor:Oe.u,isModelConstructor:Oe.t}},function(e,t,n){"use strict";n.r(t),n.d(t,"fromUtf8",(function(){return r})),n.d(t,"toUtf8",(function(){return i}));var r=function(e){return"function"==typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e.charCodeAt(n);if(i<128)t.push(i);else if(i<2048)t.push(i>>6|192,63&i|128);else if(n+1<e.length&&55296==(64512&i)&&56320==(64512&e.charCodeAt(n+1))){var o=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n));t.push(o>>18|240,o>>12&63|128,o>>6&63|128,63&o|128)}else t.push(i>>12|224,i>>6&63|128,63&i|128)}return Uint8Array.from(t)}(e)},i=function(e){return"function"==typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):function(e){for(var t="",n=0,r=e.length;n<r;n++){var i=e[n];if(i<128)t+=String.fromCharCode(i);else if(192<=i&&i<224){var o=e[++n];t+=String.fromCharCode((31&i)<<6|63&o)}else if(240<=i&&i<365){var s="%"+[i,e[++n],e[++n],e[++n]].map((function(e){return e.toString(16)})).join("%");t+=decodeURIComponent(s)}else t+=String.fromCharCode((15&i)<<12|(63&e[++n])<<6|63&e[++n])}return t}(e)}},function(e,t,n){"use strict";n.r(t),n.d(t,"fromUtf8",(function(){return r})),n.d(t,"toUtf8",(function(){return i}));var r=function(e){return"function"==typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e.charCodeAt(n);if(i<128)t.push(i);else if(i<2048)t.push(i>>6|192,63&i|128);else if(n+1<e.length&&55296==(64512&i)&&56320==(64512&e.charCodeAt(n+1))){var o=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n));t.push(o>>18|240,o>>12&63|128,o>>6&63|128,63&o|128)}else t.push(i>>12|224,i>>6&63|128,63&i|128)}return Uint8Array.from(t)}(e)},i=function(e){return"function"==typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):function(e){for(var t="",n=0,r=e.length;n<r;n++){var i=e[n];if(i<128)t+=String.fromCharCode(i);else if(192<=i&&i<224){var o=e[++n];t+=String.fromCharCode((31&i)<<6|63&o)}else if(240<=i&&i<365){var s="%"+[i,e[++n],e[++n],e[++n]].map((function(e){return e.toString(16)})).join("%");t+=decodeURIComponent(s)}else t+=String.fromCharCode((15&i)<<12|(63&e[++n])<<6|63&e[++n])}return t}(e)}},,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return f})),n.d(t,"d",(function(){return d})),n.d(t,"b",(function(){return h})),n.d(t,"c",(function(){return p}));var r,i=n(22),o=(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},a=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},u=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},c=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(u(arguments[t]));return e},l=new i.a("Util"),f=function(e){function t(t){var n=e.call(this,t)||this;return n.nonRetryable=!0,n}return o(t,e),t}(Error);function d(e,t,n,r){return void 0===r&&(r=1),s(this,void 0,void 0,(function(){var i,o;return a(this,(function(s){switch(s.label){case 0:if("function"!=typeof e)throw Error("functionToRetry must be a function");l.debug(e.name+" attempt #"+r+" with this vars: "+JSON.stringify(t)),s.label=1;case 1:return s.trys.push([1,3,,8]),[4,e.apply(void 0,c(t))];case 2:return[2,s.sent()];case 3:if(i=s.sent(),l.debug("error on "+e.name,i),(a=i)&&a.nonRetryable)throw l.debug(e.name+" non retryable error",i),i;return o=n(r,t,i),l.debug(e.name+" retrying in "+o+" ms"),!1===o?[3,6]:[4,new Promise((function(e){return setTimeout(e,o)}))];case 4:return s.sent(),[4,d(e,t,n,r+1)];case 5:return[2,s.sent()];case 6:throw i;case 7:return[3,8];case 8:return[2]}var a}))}))}function h(e){void 0===e&&(e=3e5);return function(t){var n=100*Math.pow(2,t)+100*Math.random();return!(n>e)&&n}}var p=function(e,t,n){return void 0===n&&(n=3e5),d(e,t,h(n))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},i={clockOffset:0,getDateWithClockOffset:function(){return i.clockOffset?new Date((new Date).getTime()+i.clockOffset):new Date},getClockOffset:function(){return i.clockOffset},getHeaderStringFromDate:function(e){return void 0===e&&(e=i.getDateWithClockOffset()),e.toISOString().replace(/[:\-]|\.\d{3}/g,"")},getDateFromHeaderString:function(e){var t=r(e.match(/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2}).+/),7),n=t[1],i=t[2],o=t[3],s=t[4],a=t[5],u=t[6];return new Date(Date.UTC(Number(n),Number(i)-1,Number(o),Number(s),Number(a),Number(u)))},isClockSkewed:function(e){return Math.abs(e.getTime()-i.getDateWithClockOffset().getTime())>=3e5},isClockSkewError:function(e){if(!e.response||!e.response.headers)return!1;var t=e.response.headers;return Boolean(["BadRequestException","InvalidSignatureException"].includes(t["x-amzn-errortype"])&&(t.date||t.Date))},setClockOffset:function(e){i.clockOffset=e}}}])}));
|
|
80
80
|
//# sourceMappingURL=aws-amplify-datastore.min.js.map
|