//******************************************************************************* // // Copyright 2014 Microsoft // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //******************************************************************************* var msrCryptoVersion="1.2",msrCrypto=msrCrypto||function(){"use strict";function dt(){function f(n){var t,i=null;if(arguments.length&&typeof arguments[0]!="number"){if(typeof arguments[0]=="object")for(i=new Array(n.length),t=0;t=t;)o[0]=o[0]*t,c=c.concat("0");for(f=0;f=0;){for(t=0;t<8;){var e=1<>>1,u=t;u-->0;){if((n&i)===i)break;i=i>>>1}return u}function at(n){for(var r=0,t=0,i,u;r=0&&t===0;)u=1<=t)throw"w must be less than "+t.toString();for(o=0;ont&&(c-=d),c<0&&(e=u[0]+1,u[0]=e&i,e=e>>t,e!==0))for(s=1;s>t,e===0)break;for(;v>0;v--)f[h]=0,h++;for(f[h]=c,h++,s=0;s0)i[r+u]=n[t+u]}function l(n){for(var t=0;t=0;--u)t=t+y[f++]*(n[u]&255),y[f]===r&&(f=0,i[e++]=t,t=0);return t!==0&&(i[e]=t),i}function wt(n,t,i){var u,f,e,r=[0];for(typeof t=="undefined"&&(t=!0),u=0;ui&&r[0]===0)r.shift();return r}function a(n,i){var f,u;for(typeof i=="undefined"&&(n<=1?i=1:(f=Math.log(n)/Math.LN2,i=Math.ceil(f/t))),u=[];n>0;)u.push(n%r),n=Math.floor(n/r);while(u.length=0;t--)if(n[t]!==undefined&&n[t]!==0)return t;return n[0]===0?-1:0}function o(n,t){var i=0,r=c(n)+1,u=c(t)+1;if(r>u)i=1;else if(u>r)i=-1;else while(r-->0&&i===0)i=n[r]-t[r];return i}function u(n,t,i){var r=c(n);if(n.length=t||r+1,i)while(++r=t||u<0)throw new Error("Invalid bit count for shiftRight");for(f===undefined&&(f=n.length),o=f-1,s=t-u,e=0;e>>u)&i;r[o]=n[o]>>>u}function nt(n,r,u,f){var o,e;if(u===undefined)u=1;else if(u>=t||u<0)throw new Error("bit count must be smaller than DIGIT_BITS and positive in shiftLeft");for(f===undefined&&(f=n.length),o=t-u,r[f]=n[f-1]>>>t-u||r[f],e=f-1;e>0;e--)r[e]=(n[e]<>>o)&i;r[0]=n[0]<>t;for(e=h;e>t;return u.length=o.length,f!==0&&(u[e]=f&i),f}function ut(n,r,u){var o=r.length,e,f;if(n.length>t;while(e>t;return f}function v(n,t,u){for(var s=typeof t=="number"?[t]:t,h=Math.max(n.length,s.length),e,o,f=0;f=0;--v)it=k*r+n[v],o[v]=it/w&i,k=it-o[v]*w&i;o.length=b;u(o);s[0]=k;s.length=1;return}for(ut=t-1-rt(f[a-1]),d=h||[],d.length=a,nt(f,d,ut,a),y=l||[],y.length=b,nt(n,y,ut,b),y[b]=y[b]||0,o.length=b-a+1,s.length=a,v=b-a;v>=0;--v){for(g=Math.floor((y[v+a]*r+y[v+a-1])/d[a-1]),k=y[v+a]*r+y[v+a-1]-g*d[a-1];;)if(!(g>=r)&&!(g*d[a-2]>k*r+y[v+a-2])||(g=g-1,k=k+d[a-1],!(k>t;y[v+a]=y[v+a]+tt&i}}for(p=0;p>>ut|y[p+1]<0&&(r=t,f=n),et(r,f,undefined,undefined,i),u(i)}function dt(n,t,i){var r=new Array(t.length),s=new Array(t.length),f=new Array(t.length),h=et(n,t,s,r,f);return i=i||[],o(f,w)!==0?(i[0]=NaN,i.length=1):((h&1)==1?ut(t,r,i):(e(r,0,i,0,r.length),i.length=r.length),u(i)),i}function gt(n,t,i,r){if(r=r||[],o(t,k)===0)r[0]=1;else if(o(t,w)===0)e(n,0,r,0,n.length),r.length=n.length;else{var f=new tt(i);u(n,f.s,!0);f.modExp(n,t,r);r.length=i.length}return r}function tt(n){function et(n){for(var f=1,r=2,u=3,e=u&n,o=2;o<=t;o+=1)r>t),b[o]=l&i;if(l=(c&i)+(l>>t),l=(c>>>t)+(l>>t),l>>t!=-1){for(o=0;o>>t-s,c,l,y,d,o=r.length-1;o>0&&r[o]===0;--o);for(c=o*t+rt(r[o])+1,c=c+(s-c%s),l=c%t-s,l<0&&(l+=t),y=b<0;)this.montgomeryMultiply(p,p,w),this.montgomeryMultiply(w,w,k),d=(r[Math.floor((c-1)/t)]&y)>>>l,this.montgomeryMultiply(k,h[d],p),c=c-s,l=l-s,y=y>>>s,y===0&&(y=b<=0)throw new Error("The number provided is not an element of this group");return u(i,this.m_digitWidth,!0),s(i,this)}function b(n){var t=a(n,this.m_digitWidth);return s(t,this)}function k(t){return n.normalizeDigitArray(t,this.m_digitWidth,!0),s(t,this)}function g(n){return o(this.m_modulus,n.m_modulus)===0}function nt(r,u,f){var e,c=this.m_digitWidth,h=f.m_digits,l,s;for(n.add(r.m_digits,u.m_digits,h),l=o(h,this.m_modulus)>=0?i:0,s=0,e=0;e>t;h.length=c}function it(r,u,f){var e,h=this.m_digitWidth,s=f.m_digits,o=n.subtract(r.m_digits,u.m_digits,f.m_digits);if(o===-1)for(o=0,e=0;e>t}function rt(t,i){n.modInv(t.m_digits,this.m_modulus,i.m_digits)}function ut(t,i,r){return n.modMul(t.m_digits,i.m_digits,this.m_modulus,r.m_digits,v,y)}function ft(n,t,i){if(i=i||s([],this),o(t,c)===0)i.m_digits=a(1,this.m_digitWidth);else if(o(t,l)===0){for(var r=0;r>>n.DIGIT_BITS;r=r<= 4");if(!t.isInMontgomeryForm)throw new Error("Generator point must be in montgomery form");if(!t.isAffine)throw new Error("Generator point must be in affine form");return st?bt(n,t):wt(n,t)}function wt(n,i){var b=u.p.length,ft=1<=0;v--){for(g=v+1,e(f,k[v],s),y=0;y=0;v--){for(g=v+1,e(f,k[v],s),y=0;y=0)throw new Error("The scalar k must be in the range 1 <= k < order.");var e,l=y<=8?5:6,h=i.getVector(t.length*n.DIGIT_BITS+1),a=n.computeNAF(t,l,s,h),c=lt(l,r);for(f.isInfinity=!0,o=a-1;o>=0;o--)h[o]===0?this.double(f,f):h[o]<0?(e=-h[o]>>1,this.negate(c[e],c[e]),this.mixedDoubleAdd(f,c[e],f),this.negate(c[e],c[e])):h[o]>0&&(e=h[o]>>1,this.mixedDoubleAdd(f,c[e],f));return},negate:function(t,i){t!==i&&t.copy(i);n.subtract(t.curve.p,t.y,i.y)},convertToMontgomeryForm:function(n){if(n.isInMontgomeryForm)throw new Error("The given point is already in montgomery form.");n.isInfinity||(p.convertToMontgomeryForm(n.x),p.convertToMontgomeryForm(n.y),n.z!==null&&p.convertToMontgomeryForm(n.z));n.isInMontgomeryForm=!0},convertToStandardForm:function(n){if(!n.isInMontgomeryForm)throw new Error("The given point is not in montgomery form.");n.isInfinity||(p.convertToStandardForm(n.x),p.convertToStandardForm(n.y),n.z!==null&&p.convertToStandardForm(n.z));n.isInMontgomeryForm=!1},convertToAffineForm:function(t){var r,i;if(t.isInfinity){t.z=null;nt||(t.isAffine=!0);return}for(n.modInv(t.z,u.p,tt),t.isInMontgomeryForm&&(e(tt,p.rCubedModm,d),r=tt,tt=d,d=r),l(tt,et),e(t.x,et,d),i=0;i=0;t-=1)if(n[t]+=1,n[t]>=256&&(n[t]=0),n[t])break}function h(){r=i.getVector(32);t=i.getVector(16);e=32;n=48;u=1}function c(t,r){var f,e;if(r=r||[0],r.length>n)throw new Error("Incorrect entropy or additionalEntropy length");for(r=r.concat(i.getVector(n-r.length)),t=t.concat(i.getVector((n-t.length%n)%n)),f=0;f=65536)throw new Error("too much random requested");if(u>a)throw new Error("Reseeding is required");if(e&&e.length>0){while(e.length=c&&f.stopCollectors()}var e=48,n=[],c=128,l=0,t=new ct,r=!1,u=!1,o=["Cookie","RedirectUri","ETag","x-ms-client-antiforgery-id","x-ms-client-request-id","x-ms-client-session-id","SubscriptionPool"],f=function(){return{startCollectors:function(){if(!this.collectorsRegistered){if(window.addEventListener)window.addEventListener("mousemove",this.MouseEventCallBack,!0),window.addEventListener("load",this.LoadTimeCallBack,!0);else if(document.attachEvent)document.attachEvent("onmousemove",this.MouseEventCallBack),document.attachEvent("onload",this.LoadTimeCallBack);else throw new Error("Can't attach events for entropy collection");this.collectorsRegistered=1}},stopCollectors:function(){this.collectorsRegistered&&(window.removeEventListener?(window.removeEventListener("mousemove",this.MouseEventCallBack,1),window.removeEventListener("load",this.LoadTimeCallBack,1)):window.detachEvent&&(window.detachEvent("onmousemove",this.MouseEventCallBack),window.detachEvent("onload",this.LoadTimeCallBack)),this.collectorsRegistered=0)},MouseEventCallBack:function(n){var t=(new Date).valueOf(),i=n.x||n.clientX||n.offsetX||0,r=n.y||n.clientY||n.offsetY||0,u=[t&255,t>>8&255,t>>16&255,t>>24&255,i&255,i>>8&255,r&255,r>>8&255];h(u)},LoadTimeCallBack:function(){var n=(new Date).valueOf(),t=[n&255,n>>8&255,n>>16&255,n>>24&255];h(t)}}}();return{init:function(){if(s(),!u&&!l)try{f.startCollectors()}catch(n){}},reseed:function(n){t.reseed(n)},read:function(n){if(!r)throw new Error("Entropy pool is not initialized.");var i=t.getBytes(n);return s(),i}}}var t={},l,n,b,d,a,v,f,g,st,p,e,y,o,s,w,r,it,rt,h,ut,u,pt,lt,ht,ft,wt;t.register=function(n,i,r){t[n]||(t[n]={});var u=t[n];u[i]||(u[i]=r)};t.exists=function(n,i){return t[n]?t[n][i]?!0:!1:!1};var at=function(){if(typeof document!="undefined")try{throw new Error;}catch(t){if(t.stack){var n=/\w+:\/\/(.+?\/)*.+\.js/.exec(t.stack);return n&&n.length>0?n[0]:null}}else if(typeof self!="undefined")return self.location.href;return null}(),bt=!1,vt=typeof Worker!="undefined",ot=typeof importScripts!="undefined",kt=typeof Uint8Array!="undefined",nt=function(){try{return Object.defineProperty({},"oncomplete",{}),!0}catch(n){return!1}}(),tt=vt,k=function(n,t,i,r,u){if(!nt){n[t]=i;return}var f={};r&&(f.get=r);u&&(f.set=u);Object.defineProperty(n,t,f)},c={},i=function(){function f(t,r){var f="",h,e,o,l,a,c,s,u;if(r||(r=!1),(t.pop||t.subarray)&&(t=String.fromCharCode.apply(null,t)),i)f=btoa(t);else for(u=0;u>2,a=(h&3)<<4|e>>4,c=(e&15)<<2|o>>6,s=o&63,isNaN(e)?c=s=64:isNaN(o)&&(s=64),f=f+n.charAt(l)+n.charAt(a)+n.charAt(c)+n.charAt(s);return r?f.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,""):f}function e(n){if(i){for(n=n.replace(/-/g,"+").replace(/_/g,"/");n.length%4!=0;)n+="=";return atob(n)}return String.fromCharCode.apply(null,t(n))}function t(t){for(t=t.replace(/-/g,"+").replace(/_/g,"/");t.length%4!=0;)t+="=";var r=[],o,s,h,c,f,u,e,i;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,""),i=0;i>4,s=(f&15)<<4|u>>2,h=(u&3)<<6|e,r.push(o),u!==64&&r.push(s),e!==64&&r.push(h);return r}function r(n){return Object.prototype.toString.call(n).slice(8,-1)}function o(n,t){var r="",i,u;for(typeof t=="undefined"&&(t=!1),i=0;i=2;)t.push(parseInt(n.substring(0,2),16)),n=n.substring(2,n.length);return t}function c(n){var i={};for(var t in n)n.hasOwnProperty(t)&&(i[t]=n[t]);return i}function l(n,i,r){var e=t(n),f=[],u;if(isNaN(i))return e;for(u=0;u>>24&255,n>>>16&255,n>>>8&255,n&255]}function a(n){for(var t=[],i=0;i255)return!1;return!0}var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i=typeof btoa!="undefined";return{toBase64:f,base64ToString:e,base64ToBytes:t,getObjectType:r,bytesToHexString:o,stringToBytes:s,unpackData:l,hexToBytesArray:h,int32ToBytes:u,int32ArrayToBytes:a,toArray:p,arraysEqual:k,clone:c,xorVectors:v,padEnd:w,padFront:b,getVector:y,verifyByteArray:d}}(),yt=function(){function n(n){return ot&&self.postMessage(n),n}return{jsCryptoRunner:function(i){var e=i.data.operationType,u,f,r;if(!t.exists(e,i.data.algorithm.name))throw new Error("unregistered algorithm.");return f=t[e][i.data.algorithm.name],r=i.data,r.operationSubType==="process"?(f(r),u=n({type:"process"})):u=n(f(r)),u}}}();ot&&(self.onmessage=function(n){if(n.data.prngSeed){var t=n.data.prngSeed;s.init(t);return}yt.jsCryptoRunner(n)});l=function(){function t(n){for(var t=[],i=0;i>>31;for(o=f[0],i=f[1],c=f[2],l=f[3],a=f[4],t=0;t<20;t++)u=(o<<5|o>>>27)&4294967295,u+=i&c^~i&l,u=u+a+r[t]+e[t]&4294967295,a=l,l=c,c=(i<<30|i>>>2)&4294967295,i=o,o=u;for(t=20;t<40;t++)u=(o<<5|o>>>27)&4294967295,u+=i^c^l,u=u+a+r[t]+e[t]&4294967295,a=l,l=c,c=(i<<30|i>>>2)&4294967295,i=o,o=u;for(t=40;t<60;t++)u=(o<<5|o>>>27)&4294967295,u+=i&c^i&l^c&l,u=u+a+r[t]+e[t]&4294967295,a=l,l=c,c=(i<<30|i>>>2)&4294967295,i=o,o=u;for(t=60;t<80;t++)u=(o<<5|o>>>27)&4294967295,u+=i^c^l,u=u+a+r[t]+e[t]&4294967295,a=l,l=c,c=(i<<30|i>>>2)&4294967295,i=o,o=u;f[0]+=o&4294967295;f[1]+=i&4294967295;f[2]+=c&4294967295;f[3]+=l&4294967295;f[4]+=a&4294967295}return h+=w,n.slice(w*s)}function v(){for(var t=new Array(256),n=0,i=0;n<8;n+=1,i+=4)t[i]=f[n]>>>24,t[i+1]=f[n]>>>16&255,t[i+2]=f[n]>>>8&255,t[i+3]=f[n]&255;return t.slice(0,u/8)}function y(n){var r=s-n.length,t,u,i;for(r<=8&&(r+=s),t=n.slice(),t.push(128),u=1;u>>24&255),t.push(i>>>16&255),t.push(i>>>8&255),t.push(i&255),t}function l(n){return n.pop?n:n.length===1?[n[0]]:Array.apply(null,n)}function p(n){return o=c(l(n)),a()}function w(n){o=o.concat(l(n));o.length>=64&&(o=c(o));return}function a(){if(c(y(o)).length!==0)throw new Error("buffer.length !== 0");var n=v();return o=[],f=i.slice(),h=0,n}var s=64,f=i.slice(),e=new Array(s),o=[],h=0;return{name:n,computeHash:p,process:w,finish:a,der:t,hashLen:u,maxMessageSize:4294967295}},t,r,u,n=i.unpackData;return r=n("Z0UjAe/Nq4mYutz+EDJUdsPS4fA=",4,1),t=n("WoJ5mVqCeZlagnmZWoJ5mVqCeZlagnmZWoJ5mVqCeZlagnmZWoJ5mVqCeZlagnmZWoJ5mVqCeZlagnmZWoJ5mVqCeZlagnmZWoJ5mVqCeZlu2euhbtnroW7Z66Fu2euhbtnroW7Z66Fu2euhbtnroW7Z66Fu2euhbtnroW7Z66Fu2euhbtnroW7Z66Fu2euhbtnroW7Z66Fu2euhbtnroY8bvNyPG7zcjxu83I8bvNyPG7zcjxu83I8bvNyPG7zcjxu83I8bvNyPG7zcjxu83I8bvNyPG7zcjxu83I8bvNyPG7zcjxu83I8bvNyPG7zcymLB1spiwdbKYsHWymLB1spiwdbKYsHWymLB1spiwdbKYsHWymLB1spiwdbKYsHWymLB1spiwdbKYsHWymLB1spiwdbKYsHWymLB1spiwdY",4,1),u=n("MCEwCQYFKw4DAhoFAAQU"),{sha1:f("SHA-1",u,r,t,160)}}();typeof t!="undefined"&&(d.hash=function(n){if(n.operationSubType==="process"){d.sha1.process(n.buffer);return}return n.operationSubType==="finish"?d.sha1.finish():d.sha1.computeHash(n.buffer)},t.register("digest","sha-1",d.hash));c["sha-1"]=d.sha1;a=function(){var r=function(n,t,i,r,u){function c(n){for(var nt=Math.floor(n.length/s),i,c,l,y,t,p,w,k,u,o,g,a,v,b,d=0;d>>17|a<<15)^(a>>>19|a<<13)^a>>>10,e[u]+=e[u-7],e[u]+=(v>>>7|v<<25)^(v>>>18|v<<14)^v>>>3,e[u]+=e[u-16];for(i=f[0],c=f[1],l=f[2],y=f[3],t=f[4],p=f[5],w=f[6],k=f[7],o=0;o<64;o++)g=k+((t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7))+(t&p^~t&w)+r[o]+e[o],y+=g,g+=((i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10))+(i&(c^l)^c&l),k=w,w=p,p=t,t=y,y=l,l=c,c=i,i=g;f[0]+=i&4294967295;f[1]+=c&4294967295;f[2]+=l&4294967295;f[3]+=y&4294967295;f[4]+=t&4294967295;f[5]+=p&4294967295;f[6]+=w&4294967295;f[7]+=k&4294967295}return h+=nt,n.slice(nt*s)}function v(){for(var t=new Array(256),n=0,i=0;n<8;n+=1,i+=4)t[i]=f[n]>>>24,t[i+1]=f[n]>>>16&255,t[i+2]=f[n]>>>8&255,t[i+3]=f[n]&255;return t.slice(0,u/8)}function y(n){var r=s-n.length,t,u,i;for(r<=8&&(r+=s),t=n.slice(),t.push(128),u=1;u>>24&255),t.push(i>>>16&255),t.push(i>>>8&255),t.push(i&255),t}function l(n){return n.pop?n:n.length===1?[n[0]]:Array.apply(null,n)}function p(n){return o=c(l(n)),a()}function w(n){o=o.concat(l(n));o.length>=64&&(o=c(o));return}function a(){if(c(y(o)).length!==0)throw new Error("buffer.length !== 0");var n=v();return o=[],f=i.slice(),h=0,n}var s=64,f=i.slice(),e=new Array(s),o=[],h=0;return{name:n,computeHash:p,process:w,finish:a,der:t,hashLen:u,maxMessageSize:4294967295}},t,u,f,e,o,n=i.unpackData;return u=n("wQWe2DZ81QcwcN0X9w5ZOf/ACzFoWBURZPmPp776T6Q",4,1),f=n("agnmZ7tnroU8bvNypU/1OlEOUn+bBWiMH4PZq1vgzRk",4,1),t=n("QoovmHE3RJG1wPvP6bXbpTlWwltZ8RHxkj+CpKscXtXYB6qYEoNbASQxhb5VDH3Dcr5ddIDesf6b3AanwZvxdOSbacHvvkeGD8GdxiQMocwt6SxvSnSEqlywqdx2+YjamD5RUqgxxm2wAyfIv1l/x8bgC/PVp5FHBspjURQpKWcntwqFLhshOE0sbfxTOA0TZQpzVHZqCruBwskuknIshaK/6KGoGmZLwkuLcMdsUaPRkugZ1pkGJPQONYUQaqBwGaTBFh43bAgnSHdMNLC8tTkcDLNO2KpKW5zKT2gub/N0j4LueKVjb4TIeBSMxwIIkL7/+qRQbOu++aP3xnF48g",4,1),e=n("MC0wDQYJYIZIAWUDBAIEBQAEHA"),o=n("MDEwDQYJYIZIAWUDBAIBBQAEIA"),{sha224:r("SHA-224",e,u,t,224),sha256:r("SHA-256",o,f,t,256)}}();typeof t!="undefined"&&(a.hash256=function(n){if(n.operationSubType==="process"){a.sha256.process(n.buffer);return}return n.operationSubType==="finish"?a.sha256.finish():a.sha256.computeHash(n.buffer)},a.hash224=function(n){if(n.operationSubType==="process"){a.sha224.process(n.buffer);return}return n.operationSubType==="finish"?a.sha224.finish():a.sha224.computeHash(n.buffer)},t.register("digest","sha-224",a.hash224),t.register("digest","sha-256",a.hash256));c["sha-224"]=a.sha224;c["sha-256"]=a.sha256;v=function(){function n(n,t,i,r,u){var f=t+r|0,e=f>>>0>>0;u[0]=n+i+e|0;u[1]=f;return}var u=function(t,i,r,u,f){function l(t){for(var lt=Math.floor(t.length/h),r,k,v,y,d,g,f,s,i=[],at=[],b=[],vt,et=0;et>>1|s<<31)^(f>>>8|s<<24)^f>>>7,y=(s>>>1|f<<31)^(s>>>8|f<<24)^(s>>>7|f<<25),f=o[r-4],s=o[r-3],d=(f>>>19|s<<13)^(s>>>29|f<<3)^f>>>6,g=(s>>>19|f<<13)^(f>>>29|s<<3)^(s>>>6|f<<26),n(d,g,o[r-14],o[r-13],i),n(v,y,i[0],i[1],i),n(o[r-32],o[r-31],i[0],i[1],i),o[r]=i[0],o[r+1]=i[1];var p=e[0],w=e[1],nt=e[2],tt=e[3],it=e[4],rt=e[5],ut=e[6],ft=e[7],l=e[8],a=e[9],ot=e[10],st=e[11],ht=e[12],ct=e[13],yt=e[14],pt=e[15];for(k=0;k<160;k+=2)v=(l>>>14|a<<18)^(l>>>18|a<<14)^(a>>>9|l<<23),y=(a>>>14|l<<18)^(a>>>18|l<<14)^(l>>>9|a<<23),d=l&ot^ht&~l,g=a&st^ct&~a,n(yt,pt,v,y,i),n(d,g,u[k],u[k+1],at),n(i[0],i[1],o[k],o[k+1],b),n(at[0],at[1],b[0],b[1],b),n(b[0],b[1],ut,ft,i),ut=i[0],ft=i[1],y=(w>>>28|p<<4)^(p>>>2|w<<30)^(p>>>7|w<<25),v=(p>>>28|w<<4)^(w>>>2|p<<30)^(w>>>7|p<<25),g=w&(tt^rt)^tt&rt,d=p&(nt^it)^nt&it,n(b[0],b[1],v,y,i),v=i[0],y=i[1],n(d,g,v,y,i),v=i[0],y=i[1],yt=ht,pt=ct,ht=ot,ct=st,ot=l,st=a,l=ut,a=ft,ut=it,ft=rt,it=nt,rt=tt,nt=p,tt=w,p=v,w=y;n(e[0],e[1],p,w,i);e[0]=i[0];e[1]=i[1];n(e[2],e[3],nt,tt,i);e[2]=i[0];e[3]=i[1];n(e[4],e[5],it,rt,i);e[4]=i[0];e[5]=i[1];n(e[6],e[7],ut,ft,i);e[6]=i[0];e[7]=i[1];n(e[8],e[9],l,a,i);e[8]=i[0];e[9]=i[1];n(e[10],e[11],ot,st,i);e[10]=i[0];e[11]=i[1];n(e[12],e[13],ht,ct,i);e[12]=i[0];e[13]=i[1];n(e[14],e[15],yt,pt,i);e[14]=i[0];e[15]=i[1]}return c+=lt,t.slice(lt*h)}function p(){for(var t=[],n=0;n<16;n++)t=t.concat([e[n]>>>24,e[n]>>>16&255,e[n]>>>8&255,e[n]&255]);return t.slice(0,f/8)}function w(n){var r=h-n.length,t,u,i;for(r<=16&&(r+=h),t=n.slice(),t.push(128),u=1;u>>24&255),t.push(i>>>16&255),t.push(i>>>8&255),t.push(i&255),t}function a(n){return n.slice?n:n.length===1?[n[0]]:Array.apply(null,n)}function v(){for(var n=0;n=64&&(s=l(s));return}function y(){if(s=l(w(s)),s.length!==0)throw new Error("buffer.length !== 0");var n=p();return s=[],v(),c=0,n}var h=128,e=[],o=[],s=[],c=0;return v(),{name:t,computeHash:b,process:k,finish:y,der:i,hashLen:f,maxMessageSize:4294967295}},e,f,r,o,s,h,c,t=i.unpackData;return e=t("y7udXcEFnthimikqNnzVB5FZAVowcN0XFS/s2PcOWTlnMyZn/8ALMY60SodoWBUR2wwuDWT5j6dHtUgdvvpPpA==",4),f=t("agnmZ/O8yQi7Z66FhMqnOzxu83L+lPgrpU/1Ol8dNvFRDlJ/reaC0ZsFaIwrPmwfH4PZq/tBvWtb4M0ZE34heQ",4),r=t("QoovmNcoriJxN0SRI+9lzbXA+8/sTTsv6bXbpYGJ27w5VsJb80i1OFnxEfG2BdAZkj+CpK8ZT5urHF7V2m2BGNgHqpijAwJCEoNbAUVwb74kMYW+TuSyjFUMfcPV/7Ticr5ddPJ7iW+A3rH+OxaWsZvcBqclxxI1wZvxdM9pJpTkm2nBnvFK0u++R4Y4TyXjD8GdxouM1bUkDKHMd6ycZS3pLG9ZKwJ1SnSEqm6m5INcsKncvUH71Hb5iNqDEVO1mD5RUu5m36uoMcZtLbQyELADJ8iY+yE/v1l/x77vDuTG4AvzPaiPwtWnkUeTCqclBspjUeADgm8UKSlnCg5ucCe3CoVG0i/8LhshOFwmySZNLG38WsQq7VM4DROdlbPfZQpzVIuvY952agq7PHeyqIHCyS5H7a7mknIshRSCNTuiv+ihTPEDZKgaZku8QjABwkuLcND4l5HHbFGjBlS+MNGS6BnW71IY1pkGJFVlqRD0DjWFV3EgKhBqoHAyu9G4GaTBFrjS0MgeN2wIUUGrUydId0zfjuuZNLC8teGbSKg5HAyzxclaY07YqkrjQYrLW5zKT3dj43NoLm/z1rK4o3SPgu5d77L8eKVjb0MXL2CEyHgUofCrcozHAggaZDnskL7/+iNjHiikUGzr3oK96b75o/eyxnkVxnF48uNyUyvKJz7O6iZhnNGGuMchwMIH6tp91s3g6x71fU9/7m7ReAbwZ6pyF2+6CmN9xaLImKYRP5gEvvkNrhtxCzUTHEcbKNt39SMEfYQyyqt7QMckkzyevgoVyb68Qx1nxJwQDUxMxdS+yz5Ctll/KZz8ZX4qX8tvqzrW+uxsRBmMSkdYFw==",4,1),o=t("MEEwDQYJYIZIAWUDBAICBQAEMA"),s=t("MFEwDQYJYIZIAWUDBAIDBQAEQA"),h=t("MC0wDQYJYIZIAWUDBAIFBQAEHA"),c=t("MDEwDQYJYIZIAWUDBAIGBQAEIA"),{sha384:u("SHA-384",o,e,r,384),sha512:u("SHA-512",s,f,r,512),sha512_224:u("SHA-512.224",h,f,r,224),sha512_256:u("SHA-512.256",c,f,r,256)}}();typeof t!="undefined"&&(v.hash384=function(n){if(n.operationSubType==="process"){v.sha384.process(n.buffer);return}return n.operationSubType==="finish"?v.sha384.finish():v.sha384.computeHash(n.buffer)},v.hash512=function(n){if(n.operationSubType==="process"){v.sha512.process(n.buffer);return}return n.operationSubType==="finish"?v.sha512.finish():v.sha512.computeHash(n.buffer)},t.register("digest","sha-384",v.hash384),t.register("digest","sha-512",v.hash512));c["sha-384"]=v.sha384;c["sha-512"]=v.sha512;f=function(){function l(n,t){for(var r=new Array(n),i=0;it?y(n.computeHash(i),t):y(i,t)}function h(i){var f,e,u;if(r)n.process(i);else{for(o=new Array(t),s=new Array(t),u=0;u6&&t%a==4&&k(i),e=tt(rt(r,t-a),i),ot(r,e,t,0),t+=1;return r};return y=st(l),{encrypt:function(n){var t=n,i;for(w(t,y,0),i=1;i<=v-1;i+=1)k(t),g(t),ut(t),w(t,y,4*i*p);return k(t),g(t),w(t,y,4*v*p),t},decrypt:function(n){var t=n,i;for(w(t,y,4*v*p),i=v-1;i>=1;i-=1)nt(t),it(t),w(t,y,4*i*p),ft(t);return nt(t),it(t),w(t,y,0),t},clear:function(){},keyLength:b,blockSize:d}}}}();st=st||{};st.pkcsv7=function(n){function t(t){var o=t.length-1>=0?t.length-1:0,i=t[o],f=i.length,s=f===n,r,u,e;if(s){for(r=[],u=0;u0;t--)n[t]=(n[t-1]&1)<<7|n[t]>>>1;return n[0]=n[0]>>>1,n}function it(n,t){var i=Math.floor(t/8);return n[i]>>7-t%8&1}function nt(n){for(var i=256,t=1;t<=4;t++)i=(i>>>8)+n[n.length-t],n[n.length-t]=i&255;return n}function o(t,i){var h=Math.ceil(i.length/16),o,e=[],u,s;for(f!==t&&(f=t.slice()),u=0;u>>24&255,n>>>16&255,n>>>8&255,n&255]}function rt(n){var t=16*Math.ceil(v.length/16)-v.length;return n.concat(r.getVector(t))}function b(){e=0;t=[];u=[];p=r.getVector(16);k=[];f=s=v=null}function ut(n,t,i){if(v=t||[],h=isNaN(i)?128:i,h%8!=0)throw new Error("DataError");if(s=n,s.length===12)c=s.concat([0,0,0,1]);else{var u=16*Math.ceil(s.length/16)-s.length;c=a(l,s.concat(r.getVector(u+8)).concat(d(s.length*8)));p=r.getVector(16)}y=nt(c.slice());a(l,rt(v))}function ft(n){var t,i,r;return e=n.length,t=o(y,n),a(l,t),i=w(),r=o(c,i).slice(0,h/8),b(),t.slice().concat(r)}function et(n,t){var i,u,f;return e=n.length,i=o(y,n),a(l,n),u=w(),f=o(c,u).slice(0,h/8),b(),r.arraysEqual(f,t)?i:null}function ot(n){var i,r;t=t.concat(n);i=t.slice(0,Math.floor(t.length/16)*16);e+=i.length;t=t.slice(i.length);r=o(f||y,i);u=u.concat(r);a(l,r)}function st(n){var i,r;t=t.concat(n);i=t.slice(0,Math.floor((t.length-h/8)/16)*16);e+=i.length;t=t.slice(i.length);r=o(f||y,i);u=u.concat(r);a(l,i)}function ht(){var n=o(f,t);u=u.concat(n);e+=t.length;var i=w(),r=o(c,i).slice(0,h/8),s=u.slice().concat(r);return b(),s}function ct(){var n=Math.floor(h/8),s=t.slice(-n),i;t=t.slice(0,t.length-n);i=o(f,t);u=u.concat(i);e+=t.length;var l=w(),a=o(c,l).slice(0,h/8),v=u.slice();if(b(),r.arraysEqual(a,s))return v;throw new Error("OperationError");}var r=i,t=[],s,v,h,c,y,l=n.encrypt(r.getVector(16)),p=r.getVector(16),k=[],u=[],f,e=0;return{init:ut,encrypt:ft,decrypt:et,processEncrypt:ot,processDecrypt:st,finishEncrypt:ht,finishDecrypt:ct}};typeof t!="undefined"&&(y.encrypt=function(n){var t;if(o||(o=y(g.aes(n.keyData)),o.init(n.algorithm.iv,n.algorithm.additionalData,n.algorithm.tagLength)),n.operationSubType==="process"){o.processEncrypt(n.buffer);return}return n.operationSubType==="finish"?(t=o.finishEncrypt(),o=null,t):(t=o.encrypt(n.buffer),o=null,t)},y.decrypt=function(n){var t;if(o||(o=y(g.aes(n.keyData)),o.init(n.algorithm.iv,n.algorithm.additionalData,n.algorithm.tagLength)),n.operationSubType==="process"){o.processDecrypt(n.buffer);return}if(n.operationSubType==="finish")return t=o.finishDecrypt(),o=null,t;var i=Math.floor(n.algorithm.tagLength/8),r=n.buffer.slice(0,n.buffer.length-i),u=n.buffer.slice(-i);return t=o.decrypt(r,u),o=null,t},y.generateKey=function(n){if(n.algorithm.length%8!=0)throw new Error;return{type:"keyGeneration",keyData:s.getBytes(Math.floor(n.algorithm.length/8)),keyHandle:{algorithm:n.algorithm,extractable:n.extractable,keyUsage:null||n.keyUsage,type:"secret"}}},y.importKey=function(n){var t=l.jwkToKey(n.keyData,n.algorithm,["k"]);return{type:"keyImport",keyData:t.k,keyHandle:{algorithm:n.algorithm,extractable:n.extractable||t.extractable,keyUsage:null||n.keyUsage,type:"secret"}}},y.exportKey=function(n){var t=l.keyToJwk(n.keyHandle,n.keyData);return{type:"keyExport",keyHandle:t}},t.register("importKey","aes-gcm",y.importKey),t.register("exportKey","aes-gcm",y.exportKey),t.register("generateKey","aes-gcm",y.generateKey),t.register("encrypt","aes-gcm",y.encrypt),t.register("decrypt","aes-gcm",y.decrypt));s=new ct;var ti=function(t){function r(t){var i=n.digitsToBytes(t);return f.padFront(i,0,s),i}function u(t,i,r){var f=n.bytesToDigits(i),u=n.IntegerGroup(r),e=u.createElementFromBytes(t),o=u.modexp(e,f);return o.m_digits}function h(n){var i=u(n,t.d,t.n);return r(i)}function c(i){var l=t.p,a=t.q,v=t.dp,y=t.dq,p=t.qi,f=n.bytesToDigits(l),o=n.bytesToDigits(a),u=new Array(f.length+o.length),s=new Array(f.length+1),h=new Array(o.length+1),e=n.bytesToDigits(i),c;return n.reduce(e,f,u),n.modExp(u,n.bytesToDigits(v),f,s),n.reduce(e,o,u),n.modExp(u,n.bytesToDigits(y),o,h),c=n.subtract(s,h,u),c!==0&&n.subtract(h,s,u),n.modMul(u,n.bytesToDigits(p),f,e),c!==0&&n.subtract(f,e,e),n.multiply(e,o,u),n.add(h,u,s),r(s)}var f=i,e=t.hasOwnProperty("n")&&t.hasOwnProperty("d"),o=t.hasOwnProperty("p")&&t.hasOwnProperty("q"),s=t.n.length;return{encrypt:function(n){return r(u(n,t.e,t.n))},decrypt:function(n){if(o)return c(n);if(e)return h(n);throw new Error("missing private key");}}},et={mgf1:function(n,t,i){for(var u=[],f,e,o=i.hashLen/8,r=0;r<=Math.floor(t/o);r+=1)f=[r>>>24&255,r>>>16&255,r>>>8&255,r&255],e=i.computeHash(n.concat(f)),u=u.concat(e);return u.slice(0,t)},checkMessageVsMaxHash:function(n,t){if(n.length>(t.maxMessageSize||4294967295))throw new Error("message too long");return}},w=w||{};return w.oaep=function(n,t){function e(n,i){var e,c,l,a,o,v,s,y,p,h;if(n.length>u-t.hashLen/4-2)throw new Error("Message too long.");return i||(i=[]),e=t.computeHash(i),c=u-n.length-2*e.length-2,l=r.getVector(c),a=e.concat(l,[1],n),o=f.getBytes(e.length),v=et.mgf1(o,u-e.length-1,t),s=r.xorVectors(a,v),y=et.mgf1(s,e.length,t),p=r.xorVectors(o,y),h=[0].concat(p).concat(s),n=h.slice(),h}function o(n,i){var f,s,o,h,c,l,e,a,v;if(i||(i=[]),f=t.computeHash(i),n[0]!==0)throw new Error("Encryption Error");if(s=n.slice(1,f.length+1),o=n.slice(f.length+1),h=et.mgf1(o,f.length,t),c=r.xorVectors(s,h),l=et.mgf1(c,u-f.length-1,t),e=r.xorVectors(o,l),a=e.slice(0,f.length),!r.arraysEqual(f,a))throw new Error("Encryption Error");return e=e.slice(f.length),v=e.indexOf(1),e.slice(v+1)}var r=i,f=s,u=n.n.length;if(t===null)throw new Error("must supply hashFunction");return{pad:function(n,t){return e(n,t)},unpad:function(n,t){return o(n,t)}}},w=w||{},w.pkcs1Encrypt=function(n){function r(n){var r;if(n.length>t-11)throw new Error("message too long");return r=i.getNonZeroBytes(t-n.length-3),[0,2].concat(r,[0],n)}function u(n){for(var t=1;t>>8-(8*o-l),h=0;hu&&(i.length=u);var f=r(i);return n.reduce(f,t.order,f),f}function l(i,e,s){if(!s)do s=o();while(n.isZero(s.publicKey.x)||n.compareDigits(t.order,s.publicKey.x)===0);if(!s.publicKey)throw new Error("ephemeralKey.publicKey missing");if(!s.privateKey)throw new Error("ephemeralKey.privateKey missing");var l=s.publicKey.x,v=s.privateKey,y=r(i.d),p=h(e.slice()),c=[],a=[];return n.modMul(l,y,t.order,c),n.add(c,p,c),n.reduce(c,t.order,c),n.modInv(v,t.order,a),n.modMul(c,a,t.order,c),f(l,!0,u).concat(f(c,!0,u))}function a(u,f,e){var l=Math.floor(f.length/2),a=r(f.slice(0,l)),c=r(f.slice(l)),w=h(e.slice()),v=[],y=[],p=new b.EllipticCurvePointFp(t,!1,r(u.x),r(u.y),null,!1),o,s;return(n.modInv(c,t.order,c),n.modMul(w,c,t.order,v),n.modMul(a,c,t.order,y),o=t.allocatePointStorage(),i.convertToJacobianForm(o),i.convertToMontgomeryForm(o),t.generator.isInMontgomeryForm||i.convertToMontgomeryForm(t.generator),t.generator.isAffine||i.convertToStandardForm(t.generator),i.scalarMultiply(v,t.generator,o),s=t.allocatePointStorage(),i.convertToJacobianForm(s),i.convertToMontgomeryForm(s),i.convertToMontgomeryForm(p),i.scalarMultiply(y,p,s),i.convertToAffineForm(s),i.mixedAdd(o,s,o),i.convertToAffineForm(o),i.convertToStandardForm(o),o.isInfinity)?!1:n.compareDigits(o.x,a)===0?!0:!1}var r=n.bytesToDigits,f=n.digitsToBytes,i=new b.EllipticCurveOperatorFp(t),u=f(t.order).length;return{createKey:c,generateKey:o,sign:l,verify:a}},typeof t!="undefined"&&(u.curves={"p-256":b.createP256,"p-384":b.createP384},u.sign=function(n){var t=n.algorithm.hash.name,i=u.curves[n.algorithm.namedCurve](),r=c[t.toLowerCase()],f=r.computeHash(n.buffer),e=u(i);return e.sign(n.keyData,f)},u.verify=function(n){var t=n.algorithm.hash.name,i=u.curves[n.algorithm.namedCurve](),r=c[t.toLowerCase()],f=r.computeHash(n.buffer),e=u(i);return e.verify(n.keyData,n.signature,f)},u.generateKey=function(t){function e(n){return i.padFront(n,0,Math.ceil(n.length/8)*8)}var h=u.curves[t.algorithm.namedCurve](),c=u(h),r=c.generateKey(),f=n.digitsToBytes,o=e(f(r.publicKey.x)),s=e(f(r.publicKey.y)),l=e(f(r.privateKey));return{type:"keyPairGeneration",keyPair:{publicKey:{keyData:{x:o,y:s},keyHandle:{algorithm:t.algorithm,extractable:t.extractable,keyUsage:null||t.keyUsage,type:"public"}},privateKey:{keyData:{x:o,y:s,d:l},keyHandle:{algorithm:t.algorithm,extractable:t.extractable,keyUsage:null||t.keyUsage,type:"private"}}}}},u.importKey=function(n){var t=l.jwkToKey(n.keyData,n.algorithm,["x","y","d","crv"]);if(t.d&&(!t.x||!t.y)){var r=u.curves[n.algorithm.namedCurve](),f=u(r),i=f.computePublicKey(t.d);t.x=i.x;t.y=i.y}return{type:"keyImport",keyData:t,keyHandle:{algorithm:n.algorithm,extractable:n.extractable||t.extractable,keyUsage:null||n.keyUsage,type:t.d?"private":"public"}}},u.exportKey=function(n){var t=l.keyToJwk(n.keyHandle,n.keyData);return{type:"keyExport",keyHandle:t}},t.register("sign","ecdsa",u.sign),t.register("verify","ecdsa",u.verify),t.register("generateKey","ecdsa",u.generateKey),t.register("importKey","ecdsa",u.importKey),t.register("exportKey","ecdsa",u.exportKey)),ot||(pt=function(){function h(){function t(t){try{if(n=yt.jsCryptoRunner({data:t}),!t.operationSubType||t.operationSubType!=="process")this.onmessage({data:n})}catch(i){this.onerror({data:i.description,type:"error"})}}var n;return{postMessage:t,onmessage:null,onerror:null,terminate:function(){}}}function c(n){function u(){}function f(){}function e(n){i=n;this.result&&i({target:this})}function o(n){r=n}function s(){return i}function h(){return r}function c(t){if(t.type==="error"){if(this.onerror)this.onerror(t);return}if(t.type!=="process"){if(this.result=n(t.data),this.oncomplete)this.oncomplete({target:this});return}}var i=null,r=null,t;return t={dispatchEvent:c,addEventListener:u,removeEventListener:f,result:null},k(t,"oncomplete",null,s,e),k(t,"onerror",null,h,o),t}function p(){function t(t){switch(t.type){case"keyGeneration":case"keyImport":case"keyDerive":return n.add(t.keyHandle,t.keyData),t.keyHandle;case"keyExport":return l(t.keyHandle);case"keyPairGeneration":return n.add(t.keyPair.publicKey.keyHandle,t.keyPair.publicKey.keyData),n.add(t.keyPair.privateKey.keyHandle,t.keyPair.privateKey.keyData),{publicKey:t.keyPair.publicKey.keyHandle,privateKey:t.keyPair.privateKey.keyHandle};default:throw new Error("Unknown key operation");}return}return c(t)}function w(n){function i(n){return l(n)}var t=c(i);return t.process=function(t){n.operationSubType="process";n.buffer=u.toArray(t);f.continueJob(this,u.clone(n))},t.finish=function(){n.operationSubType="finish";n.buffer=[];f.continueJob(this,u.clone(n))},t.abort=function(){f.abortJob(this)},t.onabort=null,t.onprogress=null,t.algorithm=n.algorithm||null,t.key=n.keyHandle||null,t}function l(n){return kt&&n.pop?new Uint8Array(n).buffer:n}function b(n){if(n.oncomplete)n.oncomplete({target:n});else setTimeout(function(){b(n)},y)}function d(n,i){if(!t.exists(n,i))throw new Error("unsupported algorithm");}function e(t){var i=n.lookup(t);if(!i)throw new Error("key not found");return i}function g(n,t){for(var f,r,e={operationType:n},s=v[n],o=0;o=0;i-=1)n[i].isWebWorker===t&&(n[i].terminate(),n.splice(i,1))}function b(){for(var i=0,t=0;t0){var i=t.shift();l(i.operation,i.data)}else b()>v&&r(n)}function d(n){var r;if(tt)try{r=new Worker(at);r.postMessage({prngSeed:s.getBytes(48)});r.isWebWorker=!0}catch(u){tt=!1;o.forceSync=!0;r=h();r.isWebWorker=!1}else r=h(),r.isWebWorker=!1;return r.operation=n,r.busy=!1,r.onmessage=function(n){for(var o,f=r.operation,u=0;u=a){f(t,r);return}if(u===null&&(u=d(t)),u===null){f(t,r);throw new Error("could not create new worker");}u.operation=t;u.busy=!0;i(u,r)}function l(n,t){var r=u(n);if(r){i(r,t);return}c(n,t)}function i(n,t){tt?(n.data=t,n.postMessage(t)):setTimeout(function(){n.postMessage(t)},0)}var a=15,v=4,n=[],t=[],y=0;return{runJob:c,continueJob:l,abortJob:g}}(),u=i,a=[{name:"algorithm",type:"Object",required:!0},{name:"keyHandle",type:"Object",required:!0},{name:"buffer",type:"Array",required:!1},{name:"signature",type:"Array",required:!0},{name:"format",type:"String",required:!0},{name:"keyData",type:"Array",required:!0},{name:"extractable",type:"Boolean",required:!1},{name:"keyUsages",type:"Array",required:!1},{name:"derivedKeyType",type:"Object",required:!0},{name:"length",type:"Number",required:!1}],v={encrypt:[0,1,2],decrypt:[0,1,2],sign:[0,1,2],verify:[0,1,3,2],digest:[0,2],generateKey:[0,6,7],importKey:[4,5,0,6,7],exportKey:[0,4,1,6,7],deriveKey:[0,1,8,6,7],deriveBits:[0,1,9],wrapKey:[1,1,0],unwrapKey:[2,0,1,6,7]},o={encrypt:function(){return r("encrypt",arguments,0)},decrypt:function(){return r("decrypt",arguments,0)},sign:function(){return r("sign",arguments,0)},verify:function(){return r("verify",arguments,0)},digest:function(){return r("digest",arguments,0)},generateKey:function(){return r("generateKey",arguments,1)},deriveKey:function(){return r("deriveKey",arguments,1)},deriveBits:function(){return r("deriveBits",arguments,0)},importKey:function(){return r("importKey",arguments,1)},exportKey:function(n,t){return r("exportKey",[t.algorithm,n,t],1)},wrapKey:function(){return r("wrapKey",arguments,0)},unwrapKey:function(){return r("unwrapKey",arguments,1)}}}()),lt=function(){function t(t){var w=r(t.keyData1,t.keyHandle1.algorithm.name,c["sha-1"]),u=128,b=l.keyToJwk(t.keyHandle,t.keyData),k={alg:t.keyHandle1.algorithm.name.toUpperCase(),enc:"A128GCM"},f=n.toBase64(JSON.stringify(k),!0),e=s.getBytes(32),d=w.encrypt(e),o=n.toBase64(d,!0),h=s.getBytes(12),a=n.toBase64(h,!0),nt=f.concat(".",o,".",a),v=y(g.aes(e));v.init(h,n.stringToBytes(nt),u);var i=v.encrypt(b),p=i.slice(-(u/8)),tt=n.toBase64(p,!0),it=n.toBase64(i.slice(0,i.length-p.length),!0),rt={recipients:[{header:f,encrypted_key:o,integrity_value:tt}],initialization_vector:a,ciphertext:it};return n.stringToBytes(JSON.stringify(rt))}function u(t){var u=n.base64ToBytes,i=JSON.parse(String.fromCharCode.apply(null,t.buffer)),d=n.base64ToString(i.recipients[0].header),s=u(i.recipients[0].encrypted_key),h=u(i.recipients[0].integrity_value),a=u(i.initialization_vector),v=u(i.ciphertext),p=c["sha-1"],w=r(t.keyData,t.keyHandle.algorithm.name,p),b=w.decrypt(s),k=i.recipients[0].header.concat(".",i.recipients[0].encrypted_key,".",i.initialization_vector),e=y(g.aes(b)),o,f;return e.init(a,n.stringToBytes(k),128),o=e.decrypt(v,h),f=l.jwkToKey(o,t.algorithm,["k"]),{type:"keyImport",keyData:f.k,keyHandle:{algorithm:{name:t.algorithm.name},extractable:t.extractable||f.extractable,keyUsage:null||t.keyUsages,type:"secret"}}}var n=i;return{wrapKey:t,unwrapKey:u}}(),typeof t!="undefined"&&(t.register("wrapKey","aes-gcm",lt.wrapKey),t.register("unwrapKey","aes-cbc",lt.unwrapKey)),ht={subtle:pt,getRandomValues:function(n){for(var i=s.getBytes(n.length),t=0;t