graphdb-workbench 1.10.1 → 1.10.2
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/dist/113.2c059fa7d06fd04149eb.bundle.js +1 -1
- package/dist/113.2c059fa7d06fd04149eb.bundle.js.map +1 -1
- package/dist/12.825d3fc787254f6fa055.bundle.js +2 -0
- package/dist/12.825d3fc787254f6fa055.bundle.js.map +1 -0
- package/dist/14.c7175f400470b470e034.bundle.js +1 -1
- package/dist/14.c7175f400470b470e034.bundle.js.map +1 -1
- package/dist/140.8beec5f2af539affa918.bundle.js +2 -0
- package/dist/140.8beec5f2af539affa918.bundle.js.map +1 -0
- package/dist/22.93d86caa997992a46006.bundle.js +1 -1
- package/dist/22.93d86caa997992a46006.bundle.js.map +1 -1
- package/dist/28.bbe49746541a2419b9a7.bundle.js +1 -1
- package/dist/28.bbe49746541a2419b9a7.bundle.js.map +1 -1
- package/dist/30.5ed60b4ae0a67956c66b.bundle.js +1 -1
- package/dist/30.5ed60b4ae0a67956c66b.bundle.js.map +1 -1
- package/dist/37.571a0ab8fb0508c3f1fe.bundle.js +1 -1
- package/dist/37.571a0ab8fb0508c3f1fe.bundle.js.map +1 -1
- package/dist/38.c611acd72558ca546c47.bundle.js +1 -1
- package/dist/38.c611acd72558ca546c47.bundle.js.map +1 -1
- package/dist/{bundle.e7b22d8ef84fbe277d35.bundle.js → bundle.638b1335212351205f4e.bundle.js} +4 -4
- package/dist/bundle.638b1335212351205f4e.bundle.js.map +1 -0
- package/dist/index.html +3 -3
- package/dist/js/angular/core/directives/rdfresourcesearch/templates/rdfResourceSearchTemplate.html +1 -1
- package/dist/js/angular/security/templates/users.html +3 -3
- package/dist/pages/autocomplete.html +1 -1
- package/dist/pages/choose-repository-type.html +1 -1
- package/dist/pages/clusterInfo.html +1 -1
- package/dist/pages/create-index.html +4 -4
- package/dist/pages/dependencies.html +1 -1
- package/dist/pages/domainRangeInfo.html +2 -2
- package/dist/pages/edit.html +1 -1
- package/dist/pages/explore.html +1 -1
- package/dist/pages/export.html +1 -1
- package/dist/pages/find.html +1 -1
- package/dist/pages/graph-config/saveGraphConfig.html +11 -11
- package/dist/pages/graphs-visualizations.html +7 -7
- package/dist/pages/import.html +1 -1
- package/dist/pages/jdbc-create.html +5 -5
- package/dist/pages/monitor/queries.html +1 -1
- package/dist/pages/monitor/resources.html +2 -2
- package/dist/pages/namespaces.html +2 -2
- package/dist/pages/rdfClassHierarchyInfo.html +7 -7
- package/dist/pages/rdfrank.html +2 -2
- package/dist/pages/repositories.html +2 -2
- package/dist/pages/repository.html +2 -2
- package/dist/pages/similarity-indexes.html +1 -1
- package/dist/pages/sparql-template-create.html +5 -5
- package/dist/pages/sparql.html +3 -3
- package/dist/pages/webapi.html +2 -2
- package/dist/res/swagger/index.html +25 -25
- package/package.json +1 -1
- package/dist/12.449fb5148a68a44ba324.bundle.js +0 -2
- package/dist/12.449fb5148a68a44ba324.bundle.js.map +0 -1
- package/dist/140.e19b5decfc57c4172f5d.bundle.js +0 -2
- package/dist/140.e19b5decfc57c4172f5d.bundle.js.map +0 -1
- package/dist/bundle.e7b22d8ef84fbe277d35.bundle.js.map +0 -1
package/dist/{bundle.e7b22d8ef84fbe277d35.bundle.js → bundle.638b1335212351205f4e.bundle.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(e){function t(t){for(var n,i,a=t[0],s=t[1],o=0,c=[];o<a.length;o++)i=a[o],Object.prototype.hasOwnProperty.call(r,i)&&r[i]&&c.push(r[i][0]),r[i]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(u&&u(t);c.length;)c.shift()()}var n={},r={106:0};function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.e=function(e){var t=[],n=r[e];if(0!==n)if(n)t.push(n[2]);else{var a=new Promise((function(t,i){n=r[e]=[t,i]}));t.push(n[2]=a);var s,o=document.createElement("script");o.charset="utf-8",o.timeout=120,i.nc&&o.setAttribute("nonce",i.nc),o.src=function(e){return i.p+""+({}[e]||e)+"."+{0:"9ba1de4d990baba93605",1:"5496436c5f8290ac07e7",2:"4a987ec892c6a0f76b0c",3:"3cf9b5c1c547c8be4d37",4:"0dd72b138dbffb6709f3",5:"ff72fb5966daca374950",6:"b453b1aceb4af8c3db92",7:"a4a2cbe99f4433279558",8:"40e2c91636ed46607383",9:"e7b41c51737de1ed3500",10:"a1beb5a39f13b1df6fab",11:"bdd794940dcfd5daa9a1",12:"449fb5148a68a44ba324",13:"97843f0315c24b5ce0ed",14:"c7175f400470b470e034",15:"42e5580cb96eefbb1f0b",16:"01bd96cfd64f6b616999",17:"0ad414a89dc4a2e03f02",18:"e045a7a0f1de6ae60c0b",19:"021263fa2b5c9ab91047",20:"5678adc34fb429524c27",21:"cd126c65c689b9fb2aab",22:"93d86caa997992a46006",23:"b8ce7fa7e965f576cc2c",24:"fedf63f1417e5349cfd8",25:"ae6f65a1036782f00bbf",26:"34bd7614fd5d46aa6d89",27:"5089831daf42bf903e6c",28:"bbe49746541a2419b9a7",29:"4aae384969652ace4c1f",30:"5ed60b4ae0a67956c66b",31:"55ec940532c5c198ee2a",32:"10757435cdfbc4aa8e8e",33:"7298917c0dd83f281644",34:"af70302b47e62d49d058",35:"8b3e5f2143c615155e8d",36:"466f06017a4f9d2277fb",37:"571a0ab8fb0508c3f1fe",38:"c611acd72558ca546c47",39:"1ecebcb5049b9908769f",40:"74c838eab6b84d9eceea",41:"8b4536044b927b64f0e2",42:"50c17515a1f5bea88455",43:"899bf21ce1de203ace21",44:"b0270aceb448405dff68",45:"6589137ecb8004e9944b",46:"974bec8dd37ecb842b28",47:"a968becd7ca41f2145a2",48:"14a8f14de3765cbe330c",49:"6c583711d67ac71bdec0",50:"f04df347228d27d1932f",51:"6c0b1667b5381b9fe0f5",52:"8a36d31ec27cf0b88f4f",53:"32563dae25f2d27c197c",54:"586c9b153054bcf128a1",55:"6a8ef50711916ef2e727",56:"194eaaa09196858f4ca4",57:"10c0975367e2a775b3e2",58:"1a264d2b5c0ad1801ee6",59:"08e50a4b6f251c1e43d9",60:"c3200b1ef3d26df6b14c",61:"9f7be361e23f7f634008",62:"e4dd5f806d1620e2512a",63:"461087cd0c06c5568f8b",64:"25897d73dd32b8cc7683",65:"e00b1d77705933bce4fe",66:"5e305cb9247d73f61e0d",67:"52ac46dca12b50c71e0b",68:"05bddc936e473bd1b642",69:"c5f94574bbee556c2ac4",70:"7e4d2ce58040de78a2b8",71:"3449e2f8f9f313ff8bdb",72:"9d3134c0cfb3d3354b91",73:"ac2934089e176ef00ae4",74:"c39de62f31df3ba42893",75:"a24e6ff0de052c1e4a8f",76:"58c38d54b557d1c7c5ce",77:"4c05920f90b1b46873ef",78:"608f8074bef29a89d68b",79:"70210df3d9701e7f64a1",80:"3df585c15af4344b294a",81:"a000fc69ddf1fded8354",82:"6abe3232d6c0352fa7ab",83:"67a88e1ac21fc2b142e6",84:"a899e72dc1422d322238",85:"86d8a2577257374b9275",86:"0c37822643f79dfcaa43",87:"27e343cd04a808d56135",88:"cd3c25abce6b6ca16ef5",89:"d2c1838fce5a458b5bf7",90:"aa5ea8b430a1404b2dbf",91:"d13fc0367803e8d0aab5",92:"6c992c256c1e9d0c7b86",93:"aa8e06b91b16991b676b",94:"3ceb831488f2ef7bca02",95:"f656f898341607f58e4a",96:"5e92f88002f7573b4398",97:"b5b739e60f35a2ff98e3",98:"3dec7d4e1af745b8121a",99:"6386e3e86dfefb10cf64",100:"6e6d69149935cd37d5a7",101:"ba451ee3d60f1cc52311",102:"08aa6ece37223e1ad62e",103:"8a6432cf3ba1a6d4b89c",104:"9f15d853ef941c4a039e",105:"0e4e1933716da484d772",109:"be2a8aaef9da9b820795",110:"68135bd0a550d10dc23b",111:"b136aca89a5c4d49c088",112:"50fd62c66c6594e055a3",113:"2c059fa7d06fd04149eb",114:"edebb3161ce52d4ca2e1",115:"4faef890ae1fc7b7f3e6",116:"48cacb40e8aa0fbf3ab0",117:"921c3300b6991f3a296b",118:"42db4961414208f5f105",119:"796a476c020ef85290c4",120:"60f40cfd2ae42a40ce11",121:"12919c6548e5edc02fc4",122:"fb1a3838704c37cbafdd",123:"4c5f733da9c144659722",124:"cb3b63e859dd2cda2989",125:"b24b4f0fc356fa69fc5c",126:"5e3dd09fd27e79aac0bc",127:"fe104a6d998fb167d62f",128:"31993040b285641fd5f2",129:"df67e3620112bb28cdc3",130:"0ec9ac635809dd6d917d",131:"1bf5e42dab5336449520",132:"84b8d006546395ab5398",133:"c444252fcfb21fb2ddc7",134:"9bf67df47ce489a46991",135:"8b87733926641cfc393b",136:"17fc7bed30481c0cc1e1",137:"d222c61b964fdfa86077",138:"385fb32902804dc3bcba",139:"a0a24bb2e1f32476825a",140:"e19b5decfc57c4172f5d",141:"d1994512ab888cf0b84e",142:"45abebb5dd348ac66141",143:"aa16e6f2be0e646468c2",144:"17f1377ed33c3793e3f3",145:"b0de1a3a530c3d9d42ab",146:"00b3a06a2985b3b0ce32",147:"df90cfe3f4615de24dc9",148:"1f75fd86713f6a7535f4",149:"bd5737d31307cb47c127",150:"674e98d98fcb08e2fc5d",151:"7c3520c62d14eeb4432c"}[e]+".bundle.js"}(e);var u=new Error;s=function(t){o.onerror=o.onload=null,clearTimeout(c);var n=r[e];if(0!==n){if(n){var i=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;u.message="Loading chunk "+e+" failed.\n("+i+": "+a+")",u.name="ChunkLoadError",u.type=i,u.request=a,n[1](u)}r[e]=void 0}};var c=setTimeout((function(){s({type:"timeout",target:o})}),12e4);o.onerror=o.onload=s,document.head.appendChild(o)}return Promise.all(t)},i.m=e,i.c=n,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i.oe=function(e){throw console.error(e),e};var a=window.webpackJsonp=window.webpackJsonp||[],s=a.push.bind(a);a.push=t,a=a.slice();for(var o=0;o<a.length;o++)t(a[o]);var u=s;i(i.s=143)}([function(e,t,n){"use strict";n.r(t),n.d(t,"UserType",(function(){return i})),n.d(t,"UserRole",(function(){return r})),n.d(t,"UserUtils",(function(){return a}));const r=Object.freeze({ROLE_ADMIN:"ROLE_ADMIN",ROLE_USER:"ROLE_USER",ROLE_REPO_MANAGER:"ROLE_REPO_MANAGER"}),i=Object.freeze({ADMIN:"admin",USER:"user",REPO_MANAGER:"repoManager"}),a={getUserRoleName:function(e){switch(e){case i.USER:return"User";case i.REPO_MANAGER:return"Repository manager";case i.ADMIN:return"Administrator";default:return"Unknown"}}}},function(e,t,n){(function(e){var n,r,i,a,s,o,u,c,l,h,f,d={userAgent:!1},p={},g=g||(n=Math,i=(r={}).lib={},a=i.Base=function(){function e(){}return{extend:function(t){e.prototype=this;var n=new e;return t&&n.mixIn(t),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},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)}}}(),s=i.WordArray=a.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||u).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 a=0;a<i;a++){var s=n[a>>>2]>>>24-a%4*8&255;t[r+a>>>2]|=s<<24-(r+a)%4*8}else for(a=0;a<i;a+=4)t[r+a>>>2]=n[a>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,t=this.sigBytes;e[t>>>2]&=4294967295<<32-t%4*8,e.length=n.ceil(t/4)},clone:function(){var e=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(4294967296*n.random()|0);return new s.init(t,e)}}),o=r.enc={},u=o.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var a=t[i>>>2]>>>24-i%4*8&255;r.push((a>>>4).toString(16)),r.push((15&a).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 s.init(n,t/2)}},c=o.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var a=t[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(a))}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 s.init(n,t)}},l=o.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},h=i.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(e){var t=this._data,r=t.words,i=t.sigBytes,a=this.blockSize,o=i/(4*a),u=(o=e?n.ceil(o):n.max((0|o)-this._minBufferSize,0))*a,c=n.min(4*u,i);if(u){for(var l=0;l<u;l+=a)this._doProcessBlock(r,l);var h=r.splice(0,u);t.sigBytes-=c}return new s.init(h,c)},clone:function(){var e=a.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),i.Hasher=h.extend({cfg:a.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){h.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 f.HMAC.init(e,n).finalize(t)}}}),f=r.algo={},r);!function(e){var t,n=(t=g).lib,r=n.Base,i=n.WordArray;(t=t.x64={}).Word=r.extend({init:function(e,t){this.high=e,this.low=t}}),t.WordArray=r.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:8*e.length},toX32:function(){for(var e=this.words,t=e.length,n=[],r=0;r<t;r++){var a=e[r];n.push(a.high),n.push(a.low)}return i.create(n,this.sigBytes)},clone:function(){for(var e=r.clone.call(this),t=e.words=this.words.slice(0),n=t.length,i=0;i<n;i++)t[i]=t[i].clone();return e}})}(),g.lib.Cipher||function(e){var t=(d=g).lib,n=t.Base,r=t.WordArray,i=t.BufferedBlockAlgorithm,a=d.enc.Base64,s=d.algo.EvpKDF,o=t.Cipher=i.extend({cfg:n.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,n){this.cfg=this.cfg.extend(n),this._xformMode=e,this._key=t,this.reset()},reset:function(){i.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(e){return{encrypt:function(t,n,r){return("string"==typeof n?p:f).encrypt(e,t,n,r)},decrypt:function(t,n,r){return("string"==typeof n?p:f).decrypt(e,t,n,r)}}}});t.StreamCipher=o.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var u=d.mode={},c=function(e,t,n){var r=this._iv;r?this._iv=void 0:r=this._prevBlock;for(var i=0;i<n;i++)e[t+i]^=r[i]},l=(t.BlockCipherMode=n.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}})).extend();l.Encryptor=l.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize;c.call(this,e,t,r),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+r)}}),l.Decryptor=l.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize,i=e.slice(t,t+r);n.decryptBlock(e,t),c.call(this,e,t,r),this._prevBlock=i}}),u=u.CBC=l,l=(d.pad={}).Pkcs7={pad:function(e,t){for(var n,i=(n=(n=4*t)-e.sigBytes%n)<<24|n<<16|n<<8|n,a=[],s=0;s<n;s+=4)a.push(i);n=r.create(a,n),e.concat(n)},unpad:function(e){e.sigBytes-=255&e.words[e.sigBytes-1>>>2]}},t.BlockCipher=o.extend({cfg:o.cfg.extend({mode:u,padding:l}),reset:function(){o.reset.call(this);var e=(t=this.cfg).iv,t=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=t.createEncryptor;else n=t.createDecryptor,this._minBufferSize=1;this._mode=n.call(t,this,e&&e.words)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4});var h=t.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),f=(u=(d.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return((e=e.salt)?r.create([1398893684,1701076831]).concat(e).concat(t):t).toString(a)},parse:function(e){var t=(e=a.parse(e)).words;if(1398893684==t[0]&&1701076831==t[1]){var n=r.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return h.create({ciphertext:e,salt:n})}},t.SerializableCipher=n.extend({cfg:n.extend({format:u}),encrypt:function(e,t,n,r){r=this.cfg.extend(r);var i=e.createEncryptor(n,r);return t=i.finalize(t),i=i.cfg,h.create({ciphertext:t,key:n,iv:i.iv,algorithm:e,mode:i.mode,padding:i.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),e.createDecryptor(n,r).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}})),d=(d.kdf={}).OpenSSL={execute:function(e,t,n,i){return i||(i=r.random(8)),e=s.create({keySize:t+n}).compute(e,i),n=r.create(e.words.slice(t),4*n),e.sigBytes=4*t,h.create({key:e,iv:n,salt:i})}},p=t.PasswordBasedCipher=f.extend({cfg:f.cfg.extend({kdf:d}),encrypt:function(e,t,n,r){return n=(r=this.cfg.extend(r)).kdf.execute(n,e.keySize,e.ivSize),r.iv=n.iv,(e=f.encrypt.call(this,e,t,n.key,r)).mixIn(n),e},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),n=r.kdf.execute(n,e.keySize,e.ivSize,t.salt),r.iv=n.iv,f.decrypt.call(this,e,t,n.key,r)}})}(),function(){for(var e=g,t=e.lib.BlockCipher,n=e.algo,r=[],i=[],a=[],s=[],o=[],u=[],c=[],l=[],h=[],f=[],d=[],p=0;256>p;p++)d[p]=128>p?p<<1:p<<1^283;var m=0,v=0;for(p=0;256>p;p++){var y=(y=v^v<<1^v<<2^v<<3^v<<4)>>>8^255&y^99;r[m]=y,i[y]=m;var b=d[m],w=d[b],x=d[w],S=257*d[y]^16843008*y;a[m]=S<<24|S>>>8,s[m]=S<<16|S>>>16,o[m]=S<<8|S>>>24,u[m]=S,S=16843009*x^65537*w^257*b^16843008*m,c[y]=S<<24|S>>>8,l[y]=S<<16|S>>>16,h[y]=S<<8|S>>>24,f[y]=S,m?(m=b^d[d[d[x^b]]],v^=d[d[v]]):m=v=1}var E=[0,1,2,4,8,16,32,64,128,27,54];n=n.AES=t.extend({_doReset:function(){for(var e=(n=this._key).words,t=n.sigBytes/4,n=4*((this._nRounds=t+6)+1),i=this._keySchedule=[],a=0;a<n;a++)if(a<t)i[a]=e[a];else{var s=i[a-1];a%t?6<t&&4==a%t&&(s=r[s>>>24]<<24|r[s>>>16&255]<<16|r[s>>>8&255]<<8|r[255&s]):(s=r[(s=s<<8|s>>>24)>>>24]<<24|r[s>>>16&255]<<16|r[s>>>8&255]<<8|r[255&s],s^=E[a/t|0]<<24),i[a]=i[a-t]^s}for(e=this._invKeySchedule=[],t=0;t<n;t++)a=n-t,s=t%4?i[a]:i[a-4],e[t]=4>t||4>=a?s:c[r[s>>>24]]^l[r[s>>>16&255]]^h[r[s>>>8&255]]^f[r[255&s]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,s,o,u,r)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,c,l,h,f,i),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,i,a,s,o){for(var u=this._nRounds,c=e[t]^n[0],l=e[t+1]^n[1],h=e[t+2]^n[2],f=e[t+3]^n[3],d=4,p=1;p<u;p++){var g=r[c>>>24]^i[l>>>16&255]^a[h>>>8&255]^s[255&f]^n[d++],m=r[l>>>24]^i[h>>>16&255]^a[f>>>8&255]^s[255&c]^n[d++],v=r[h>>>24]^i[f>>>16&255]^a[c>>>8&255]^s[255&l]^n[d++];f=r[f>>>24]^i[c>>>16&255]^a[l>>>8&255]^s[255&h]^n[d++],c=g,l=m,h=v}g=(o[c>>>24]<<24|o[l>>>16&255]<<16|o[h>>>8&255]<<8|o[255&f])^n[d++],m=(o[l>>>24]<<24|o[h>>>16&255]<<16|o[f>>>8&255]<<8|o[255&c])^n[d++],v=(o[h>>>24]<<24|o[f>>>16&255]<<16|o[c>>>8&255]<<8|o[255&l])^n[d++],f=(o[f>>>24]<<24|o[c>>>16&255]<<16|o[l>>>8&255]<<8|o[255&h])^n[d++],e[t]=g,e[t+1]=m,e[t+2]=v,e[t+3]=f},keySize:8});e.AES=t._createHelper(n)}(),function(){function e(e,t){var n=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=n,this._lBlock^=n<<e}function t(e,t){var n=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=n,this._rBlock^=n<<e}var n=g,r=(i=n.lib).WordArray,i=i.BlockCipher,a=n.algo,s=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],l=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],h=a.DES=i.extend({_doReset:function(){for(var e=this._key.words,t=[],n=0;56>n;n++){var r=s[n]-1;t[n]=e[r>>>5]>>>31-r%32&1}for(e=this._subKeys=[],r=0;16>r;r++){var i=e[r]=[],a=u[r];for(n=0;24>n;n++)i[n/6|0]|=t[(o[n]-1+a)%28]<<31-n%6,i[4+(n/6|0)]|=t[28+(o[n+24]-1+a)%28]<<31-n%6;for(i[0]=i[0]<<1|i[0]>>>31,n=1;7>n;n++)i[n]>>>=4*(n-1)+3;i[7]=i[7]<<5|i[7]>>>27}for(t=this._invSubKeys=[],n=0;16>n;n++)t[n]=e[15-n]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(n,r,i){this._lBlock=n[r],this._rBlock=n[r+1],e.call(this,4,252645135),e.call(this,16,65535),t.call(this,2,858993459),t.call(this,8,16711935),e.call(this,1,1431655765);for(var a=0;16>a;a++){for(var s=i[a],o=this._lBlock,u=this._rBlock,h=0,f=0;8>f;f++)h|=c[f][((u^s[f])&l[f])>>>0];this._lBlock=u,this._rBlock=o^h}i=this._lBlock,this._lBlock=this._rBlock,this._rBlock=i,e.call(this,1,1431655765),t.call(this,8,16711935),t.call(this,2,858993459),e.call(this,16,65535),e.call(this,4,252645135),n[r]=this._lBlock,n[r+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});n.DES=i._createHelper(h),a=a.TripleDES=i.extend({_doReset:function(){var e=this._key.words;this._des1=h.createEncryptor(r.create(e.slice(0,2))),this._des2=h.createEncryptor(r.create(e.slice(2,4))),this._des3=h.createEncryptor(r.create(e.slice(4,6)))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2}),n.TripleDES=i._createHelper(a)}(),function(){var e=g,t=e.lib.WordArray;e.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp(),e=[];for(var i=0;i<n;i+=3)for(var a=(t[i>>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,s=0;4>s&&i+.75*s<n;s++)e.push(r.charAt(a>>>6*(3-s)&63));if(t=r.charAt(64))for(;e.length%4;)e.push(t);return e.join("")},parse:function(e){var n=e.length,r=this._map;(i=r.charAt(64))&&(-1!=(i=e.indexOf(i))&&(n=i));for(var i=[],a=0,s=0;s<n;s++)if(s%4){var o=r.indexOf(e.charAt(s-1))<<s%4*2,u=r.indexOf(e.charAt(s))>>>6-s%4*2;i[a>>>2]|=(o|u)<<24-a%4*8,a++}return t.create(i,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(e){function t(e,t,n,r,i,a,s){return((e=e+(t&n|~t&r)+i+s)<<a|e>>>32-a)+t}function n(e,t,n,r,i,a,s){return((e=e+(t&r|n&~r)+i+s)<<a|e>>>32-a)+t}function r(e,t,n,r,i,a,s){return((e=e+(t^n^r)+i+s)<<a|e>>>32-a)+t}function i(e,t,n,r,i,a,s){return((e=e+(n^(t|~r))+i+s)<<a|e>>>32-a)+t}for(var a=g,s=(u=a.lib).WordArray,o=u.Hasher,u=a.algo,c=[],l=0;64>l;l++)c[l]=4294967296*e.abs(e.sin(l+1))|0;u=u.MD5=o.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,a){for(var s=0;16>s;s++){var o=e[u=a+s];e[u]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}s=this._hash.words;var u=e[a+0],l=(o=e[a+1],e[a+2]),h=e[a+3],f=e[a+4],d=e[a+5],p=e[a+6],g=e[a+7],m=e[a+8],v=e[a+9],y=e[a+10],b=e[a+11],w=e[a+12],x=e[a+13],S=e[a+14],E=e[a+15],A=t(A=s[0],D=s[1],C=s[2],F=s[3],u,7,c[0]),F=t(F,A,D,C,o,12,c[1]),C=t(C,F,A,D,l,17,c[2]),D=t(D,C,F,A,h,22,c[3]);A=t(A,D,C,F,f,7,c[4]),F=t(F,A,D,C,d,12,c[5]),C=t(C,F,A,D,p,17,c[6]),D=t(D,C,F,A,g,22,c[7]),A=t(A,D,C,F,m,7,c[8]),F=t(F,A,D,C,v,12,c[9]),C=t(C,F,A,D,y,17,c[10]),D=t(D,C,F,A,b,22,c[11]),A=t(A,D,C,F,w,7,c[12]),F=t(F,A,D,C,x,12,c[13]),C=t(C,F,A,D,S,17,c[14]),A=n(A,D=t(D,C,F,A,E,22,c[15]),C,F,o,5,c[16]),F=n(F,A,D,C,p,9,c[17]),C=n(C,F,A,D,b,14,c[18]),D=n(D,C,F,A,u,20,c[19]),A=n(A,D,C,F,d,5,c[20]),F=n(F,A,D,C,y,9,c[21]),C=n(C,F,A,D,E,14,c[22]),D=n(D,C,F,A,f,20,c[23]),A=n(A,D,C,F,v,5,c[24]),F=n(F,A,D,C,S,9,c[25]),C=n(C,F,A,D,h,14,c[26]),D=n(D,C,F,A,m,20,c[27]),A=n(A,D,C,F,x,5,c[28]),F=n(F,A,D,C,l,9,c[29]),C=n(C,F,A,D,g,14,c[30]),A=r(A,D=n(D,C,F,A,w,20,c[31]),C,F,d,4,c[32]),F=r(F,A,D,C,m,11,c[33]),C=r(C,F,A,D,b,16,c[34]),D=r(D,C,F,A,S,23,c[35]),A=r(A,D,C,F,o,4,c[36]),F=r(F,A,D,C,f,11,c[37]),C=r(C,F,A,D,g,16,c[38]),D=r(D,C,F,A,y,23,c[39]),A=r(A,D,C,F,x,4,c[40]),F=r(F,A,D,C,u,11,c[41]),C=r(C,F,A,D,h,16,c[42]),D=r(D,C,F,A,p,23,c[43]),A=r(A,D,C,F,v,4,c[44]),F=r(F,A,D,C,w,11,c[45]),C=r(C,F,A,D,E,16,c[46]),A=i(A,D=r(D,C,F,A,l,23,c[47]),C,F,u,6,c[48]),F=i(F,A,D,C,g,10,c[49]),C=i(C,F,A,D,S,15,c[50]),D=i(D,C,F,A,d,21,c[51]),A=i(A,D,C,F,w,6,c[52]),F=i(F,A,D,C,h,10,c[53]),C=i(C,F,A,D,y,15,c[54]),D=i(D,C,F,A,o,21,c[55]),A=i(A,D,C,F,m,6,c[56]),F=i(F,A,D,C,E,10,c[57]),C=i(C,F,A,D,p,15,c[58]),D=i(D,C,F,A,x,21,c[59]),A=i(A,D,C,F,f,6,c[60]),F=i(F,A,D,C,b,10,c[61]),C=i(C,F,A,D,l,15,c[62]),D=i(D,C,F,A,v,21,c[63]);s[0]=s[0]+A|0,s[1]=s[1]+D|0,s[2]=s[2]+C|0,s[3]=s[3]+F|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;n[i>>>5]|=128<<24-i%32;var a=e.floor(r/4294967296);for(n[15+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),n[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(n.length+1),this._process(),n=(t=this._hash).words,r=0;4>r;r++)i=n[r],n[r]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8);return t},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),a.MD5=o._createHelper(u),a.HmacMD5=o._createHmacHelper(u)}(Math),function(){var e=g,t=(i=e.lib).WordArray,n=i.Hasher,r=[],i=e.algo.SHA1=n.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=this._hash.words,i=n[0],a=n[1],s=n[2],o=n[3],u=n[4],c=0;80>c;c++){if(16>c)r[c]=0|e[t+c];else{var l=r[c-3]^r[c-8]^r[c-14]^r[c-16];r[c]=l<<1|l>>>31}l=(i<<5|i>>>27)+u+r[c],l=20>c?l+(1518500249+(a&s|~a&o)):40>c?l+(1859775393+(a^s^o)):60>c?l+((a&s|a&o|s&o)-1894007588):l+((a^s^o)-899497514),u=o,o=s,s=a<<30|a>>>2,a=i,i=l}n[0]=n[0]+i|0,n[1]=n[1]+a|0,n[2]=n[2]+s|0,n[3]=n[3]+o|0,n[4]=n[4]+u|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(r+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA1=n._createHelper(i),e.HmacSHA1=n._createHmacHelper(i)}(),function(e){for(var t=g,n=(i=t.lib).WordArray,r=i.Hasher,i=t.algo,a=[],s=[],o=function(e){return 4294967296*(e-(0|e))|0},u=2,c=0;64>c;){var l;e:{l=u;for(var h=e.sqrt(l),f=2;f<=h;f++)if(!(l%f)){l=!1;break e}l=!0}l&&(8>c&&(a[c]=o(e.pow(u,.5))),s[c]=o(e.pow(u,1/3)),c++),u++}var d=[];i=i.SHA256=r.extend({_doReset:function(){this._hash=new n.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],a=n[2],o=n[3],u=n[4],c=n[5],l=n[6],h=n[7],f=0;64>f;f++){if(16>f)d[f]=0|e[t+f];else{var p=d[f-15],g=d[f-2];d[f]=((p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+d[f-7]+((g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10)+d[f-16]}p=h+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&c^~u&l)+s[f]+d[f],g=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&i^r&a^i&a),h=l,l=c,c=u,u=o+p|0,o=a,a=i,i=r,r=p+g|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+a|0,n[3]=n[3]+o|0,n[4]=n[4]+u|0,n[5]=n[5]+c|0,n[6]=n[6]+l|0,n[7]=n[7]+h|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=r.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=r._createHelper(i),t.HmacSHA256=r._createHmacHelper(i)}(Math),function(){var e=g,t=e.lib.WordArray,n=(r=e.algo).SHA256,r=r.SHA224=n.extend({_doReset:function(){this._hash=new t.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=n._doFinalize.call(this);return e.sigBytes-=4,e}});e.SHA224=n._createHelper(r),e.HmacSHA224=n._createHmacHelper(r)}(),function(){function e(){return r.create.apply(r,arguments)}for(var t=g,n=t.lib.Hasher,r=(a=t.x64).Word,i=a.WordArray,a=t.algo,s=[e(1116352408,3609767458),e(1899447441,602891725),e(3049323471,3964484399),e(3921009573,2173295548),e(961987163,4081628472),e(1508970993,3053834265),e(2453635748,2937671579),e(2870763221,3664609560),e(3624381080,2734883394),e(310598401,1164996542),e(607225278,1323610764),e(1426881987,3590304994),e(1925078388,4068182383),e(2162078206,991336113),e(2614888103,633803317),e(3248222580,3479774868),e(3835390401,2666613458),e(4022224774,944711139),e(264347078,2341262773),e(604807628,2007800933),e(770255983,1495990901),e(1249150122,1856431235),e(1555081692,3175218132),e(1996064986,2198950837),e(2554220882,3999719339),e(2821834349,766784016),e(2952996808,2566594879),e(3210313671,3203337956),e(3336571891,1034457026),e(3584528711,2466948901),e(113926993,3758326383),e(338241895,168717936),e(666307205,1188179964),e(773529912,1546045734),e(1294757372,1522805485),e(1396182291,2643833823),e(1695183700,2343527390),e(1986661051,1014477480),e(2177026350,1206759142),e(2456956037,344077627),e(2730485921,1290863460),e(2820302411,3158454273),e(3259730800,3505952657),e(3345764771,106217008),e(3516065817,3606008344),e(3600352804,1432725776),e(4094571909,1467031594),e(275423344,851169720),e(430227734,3100823752),e(506948616,1363258195),e(659060556,3750685593),e(883997877,3785050280),e(958139571,3318307427),e(1322822218,3812723403),e(1537002063,2003034995),e(1747873779,3602036899),e(1955562222,1575990012),e(2024104815,1125592928),e(2227730452,2716904306),e(2361852424,442776044),e(2428436474,593698344),e(2756734187,3733110249),e(3204031479,2999351573),e(3329325298,3815920427),e(3391569614,3928383900),e(3515267271,566280711),e(3940187606,3454069534),e(4118630271,4000239992),e(116418474,1914138554),e(174292421,2731055270),e(289380356,3203993006),e(460393269,320620315),e(685471733,587496836),e(852142971,1086792851),e(1017036298,365543100),e(1126000580,2618297676),e(1288033470,3409855158),e(1501505948,4234509866),e(1607167915,987167468),e(1816402316,1246189591)],o=[],u=0;80>u;u++)o[u]=e();a=a.SHA512=n.extend({_doReset:function(){this._hash=new i.init([new r.init(1779033703,4089235720),new r.init(3144134277,2227873595),new r.init(1013904242,4271175723),new r.init(2773480762,1595750129),new r.init(1359893119,2917565137),new r.init(2600822924,725511199),new r.init(528734635,4215389547),new r.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var n=(h=this._hash.words)[0],r=h[1],i=h[2],a=h[3],u=h[4],c=h[5],l=h[6],h=h[7],f=n.high,d=n.low,p=r.high,g=r.low,m=i.high,v=i.low,y=a.high,b=a.low,w=u.high,x=u.low,S=c.high,E=c.low,A=l.high,F=l.low,C=h.high,D=h.low,R=f,I=d,T=p,$=g,P=m,_=v,k=y,O=b,B=w,j=x,H=S,N=E,L=A,M=F,U=C,V=D,q=0;80>q;q++){var K=o[q];if(16>q)var z=K.high=0|e[t+2*q],G=K.low=0|e[t+2*q+1];else{z=((G=(z=o[q-15]).high)>>>1|(W=z.low)<<31)^(G>>>8|W<<24)^G>>>7;var W=(W>>>1|G<<31)^(W>>>8|G<<24)^(W>>>7|G<<25),Y=((G=(Y=o[q-2]).high)>>>19|(X=Y.low)<<13)^(G<<3|X>>>29)^G>>>6,X=(X>>>19|G<<13)^(X<<3|G>>>29)^(X>>>6|G<<26),J=(G=o[q-7]).high,Q=(Z=o[q-16]).high,Z=Z.low;z=(z=(z=z+J+((G=W+G.low)>>>0<W>>>0?1:0))+Y+((G=G+X)>>>0<X>>>0?1:0))+Q+((G=G+Z)>>>0<Z>>>0?1:0);K.high=z,K.low=G}J=B&H^~B&L,Z=j&N^~j&M,K=R&T^R&P^T&P;var ee=I&$^I&_^$&_,te=(W=(R>>>28|I<<4)^(R<<30|I>>>2)^(R<<25|I>>>7),Y=(I>>>28|R<<4)^(I<<30|R>>>2)^(I<<25|R>>>7),(X=s[q]).high),ne=X.low;Q=U+((B>>>14|j<<18)^(B>>>18|j<<14)^(B<<23|j>>>9))+((X=V+((j>>>14|B<<18)^(j>>>18|B<<14)^(j<<23|B>>>9)))>>>0<V>>>0?1:0),U=L,V=M,L=H,M=N,H=B,N=j,B=k+(Q=(Q=(Q=Q+J+((X=X+Z)>>>0<Z>>>0?1:0))+te+((X=X+ne)>>>0<ne>>>0?1:0))+z+((X=X+G)>>>0<G>>>0?1:0))+((j=O+X|0)>>>0<O>>>0?1:0)|0,k=P,O=_,P=T,_=$,T=R,$=I,R=Q+(K=W+K+((G=Y+ee)>>>0<Y>>>0?1:0))+((I=X+G|0)>>>0<X>>>0?1:0)|0}d=n.low=d+I,n.high=f+R+(d>>>0<I>>>0?1:0),g=r.low=g+$,r.high=p+T+(g>>>0<$>>>0?1:0),v=i.low=v+_,i.high=m+P+(v>>>0<_>>>0?1:0),b=a.low=b+O,a.high=y+k+(b>>>0<O>>>0?1:0),x=u.low=x+j,u.high=w+B+(x>>>0<j>>>0?1:0),E=c.low=E+N,c.high=S+H+(E>>>0<N>>>0?1:0),F=l.low=F+M,l.high=A+L+(F>>>0<M>>>0?1:0),D=h.low=D+V,h.high=C+U+(D>>>0<V>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[30+(r+128>>>10<<5)]=Math.floor(n/4294967296),t[31+(r+128>>>10<<5)]=n,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32}),t.SHA512=n._createHelper(a),t.HmacSHA512=n._createHmacHelper(a)}(),function(){var e=g,t=(i=e.x64).Word,n=i.WordArray,r=(i=e.algo).SHA512,i=i.SHA384=r.extend({_doReset:function(){this._hash=new n.init([new t.init(3418070365,3238371032),new t.init(1654270250,914150663),new t.init(2438529370,812702999),new t.init(355462360,4144912697),new t.init(1731405415,4290775857),new t.init(2394180231,1750603025),new t.init(3675008525,1694076839),new t.init(1203062813,3204075428)])},_doFinalize:function(){var e=r._doFinalize.call(this);return e.sigBytes-=16,e}});e.SHA384=r._createHelper(i),e.HmacSHA384=r._createHmacHelper(i)}(),function(){var e=g,t=(r=e.lib).WordArray,n=r.Hasher,r=e.algo,i=t.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),a=t.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),s=t.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),o=t.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=t.create([0,1518500249,1859775393,2400959708,2840853838]),c=t.create([1352829926,1548603684,1836072691,2053994217,0]);r=r.RIPEMD160=n.extend({_doReset:function(){this._hash=t.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=0;16>n;n++){var r=e[w=t+n];e[w]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var l,h,f,d,p,g,m,v,y,b,w=this._hash.words,x=(r=u.words,c.words),S=i.words,E=a.words,A=s.words,F=o.words;g=l=w[0],m=h=w[1],v=f=w[2],y=d=w[3],b=p=w[4];var C;for(n=0;80>n;n+=1)C=l+e[t+S[n]]|0,C=16>n?C+((h^f^d)+r[0]):32>n?C+((h&f|~h&d)+r[1]):48>n?C+(((h|~f)^d)+r[2]):64>n?C+((h&d|f&~d)+r[3]):C+((h^(f|~d))+r[4]),C=(C=(C|=0)<<A[n]|C>>>32-A[n])+p|0,l=p,p=d,d=f<<10|f>>>22,f=h,h=C,C=g+e[t+E[n]]|0,C=16>n?C+((m^(v|~y))+x[0]):32>n?C+((m&y|v&~y)+x[1]):48>n?C+(((m|~v)^y)+x[2]):64>n?C+((m&v|~m&y)+x[3]):C+((m^v^y)+x[4]),C=(C=(C|=0)<<F[n]|C>>>32-F[n])+b|0,g=b,b=y,y=v<<10|v>>>22,v=m,m=C;C=w[1]+f+y|0,w[1]=w[2]+d+b|0,w[2]=w[3]+p+g|0,w[3]=w[4]+l+m|0,w[4]=w[0]+h+v|0,w[0]=C},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;for(t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(t.length+1),this._process(),t=(e=this._hash).words,n=0;5>n;n++)r=t[n],t[n]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8);return e},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});e.RIPEMD160=n._createHelper(r),e.HmacRIPEMD160=n._createHmacHelper(r)}(Math),function(){var e=g,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(e,n){e=this._hasher=new e.init,"string"==typeof n&&(n=t.parse(n));var r=e.blockSize,i=4*r;n.sigBytes>i&&(n=e.finalize(n)),n.clamp();for(var a=this._oKey=n.clone(),s=this._iKey=n.clone(),o=a.words,u=s.words,c=0;c<r;c++)o[c]^=1549556828,u[c]^=909522486;a.sigBytes=s.sigBytes=i,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;return e=t.finalize(e),t.reset(),t.finalize(this._oKey.clone().concat(e))}})}(),function(){var e,t=g,n=(e=t.lib).Base,r=e.WordArray,i=(e=t.algo).HMAC,a=e.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:e.SHA1,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){var n=this.cfg,a=i.create(n.hasher,e),s=r.create(),o=r.create([1]),u=s.words,c=o.words,l=n.keySize;for(n=n.iterations;u.length<l;){var h=a.update(t).finalize(o);a.reset();for(var f=h.words,d=f.length,p=h,g=1;g<n;g++){p=a.finalize(p),a.reset();for(var m=p.words,v=0;v<d;v++)f[v]^=m[v]}s.concat(h),c[0]++}return s.sigBytes=4*l,s}});t.PBKDF2=function(e,t,n){return a.create(n).compute(e,t)}}();
|
|
1
|
+
!function(e){function t(t){for(var n,i,a=t[0],s=t[1],o=0,c=[];o<a.length;o++)i=a[o],Object.prototype.hasOwnProperty.call(r,i)&&r[i]&&c.push(r[i][0]),r[i]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(u&&u(t);c.length;)c.shift()()}var n={},r={106:0};function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.e=function(e){var t=[],n=r[e];if(0!==n)if(n)t.push(n[2]);else{var a=new Promise((function(t,i){n=r[e]=[t,i]}));t.push(n[2]=a);var s,o=document.createElement("script");o.charset="utf-8",o.timeout=120,i.nc&&o.setAttribute("nonce",i.nc),o.src=function(e){return i.p+""+({}[e]||e)+"."+{0:"9ba1de4d990baba93605",1:"5496436c5f8290ac07e7",2:"4a987ec892c6a0f76b0c",3:"3cf9b5c1c547c8be4d37",4:"0dd72b138dbffb6709f3",5:"ff72fb5966daca374950",6:"b453b1aceb4af8c3db92",7:"a4a2cbe99f4433279558",8:"40e2c91636ed46607383",9:"e7b41c51737de1ed3500",10:"a1beb5a39f13b1df6fab",11:"bdd794940dcfd5daa9a1",12:"825d3fc787254f6fa055",13:"97843f0315c24b5ce0ed",14:"c7175f400470b470e034",15:"42e5580cb96eefbb1f0b",16:"01bd96cfd64f6b616999",17:"0ad414a89dc4a2e03f02",18:"e045a7a0f1de6ae60c0b",19:"021263fa2b5c9ab91047",20:"5678adc34fb429524c27",21:"cd126c65c689b9fb2aab",22:"93d86caa997992a46006",23:"b8ce7fa7e965f576cc2c",24:"fedf63f1417e5349cfd8",25:"ae6f65a1036782f00bbf",26:"34bd7614fd5d46aa6d89",27:"5089831daf42bf903e6c",28:"bbe49746541a2419b9a7",29:"4aae384969652ace4c1f",30:"5ed60b4ae0a67956c66b",31:"55ec940532c5c198ee2a",32:"10757435cdfbc4aa8e8e",33:"7298917c0dd83f281644",34:"af70302b47e62d49d058",35:"8b3e5f2143c615155e8d",36:"466f06017a4f9d2277fb",37:"571a0ab8fb0508c3f1fe",38:"c611acd72558ca546c47",39:"1ecebcb5049b9908769f",40:"74c838eab6b84d9eceea",41:"8b4536044b927b64f0e2",42:"50c17515a1f5bea88455",43:"899bf21ce1de203ace21",44:"b0270aceb448405dff68",45:"6589137ecb8004e9944b",46:"974bec8dd37ecb842b28",47:"a968becd7ca41f2145a2",48:"14a8f14de3765cbe330c",49:"6c583711d67ac71bdec0",50:"f04df347228d27d1932f",51:"6c0b1667b5381b9fe0f5",52:"8a36d31ec27cf0b88f4f",53:"32563dae25f2d27c197c",54:"586c9b153054bcf128a1",55:"6a8ef50711916ef2e727",56:"194eaaa09196858f4ca4",57:"10c0975367e2a775b3e2",58:"1a264d2b5c0ad1801ee6",59:"08e50a4b6f251c1e43d9",60:"c3200b1ef3d26df6b14c",61:"9f7be361e23f7f634008",62:"e4dd5f806d1620e2512a",63:"461087cd0c06c5568f8b",64:"25897d73dd32b8cc7683",65:"e00b1d77705933bce4fe",66:"5e305cb9247d73f61e0d",67:"52ac46dca12b50c71e0b",68:"05bddc936e473bd1b642",69:"c5f94574bbee556c2ac4",70:"7e4d2ce58040de78a2b8",71:"3449e2f8f9f313ff8bdb",72:"9d3134c0cfb3d3354b91",73:"ac2934089e176ef00ae4",74:"c39de62f31df3ba42893",75:"a24e6ff0de052c1e4a8f",76:"58c38d54b557d1c7c5ce",77:"4c05920f90b1b46873ef",78:"608f8074bef29a89d68b",79:"70210df3d9701e7f64a1",80:"3df585c15af4344b294a",81:"a000fc69ddf1fded8354",82:"6abe3232d6c0352fa7ab",83:"67a88e1ac21fc2b142e6",84:"a899e72dc1422d322238",85:"86d8a2577257374b9275",86:"0c37822643f79dfcaa43",87:"27e343cd04a808d56135",88:"cd3c25abce6b6ca16ef5",89:"d2c1838fce5a458b5bf7",90:"aa5ea8b430a1404b2dbf",91:"d13fc0367803e8d0aab5",92:"6c992c256c1e9d0c7b86",93:"aa8e06b91b16991b676b",94:"3ceb831488f2ef7bca02",95:"f656f898341607f58e4a",96:"5e92f88002f7573b4398",97:"b5b739e60f35a2ff98e3",98:"3dec7d4e1af745b8121a",99:"6386e3e86dfefb10cf64",100:"6e6d69149935cd37d5a7",101:"ba451ee3d60f1cc52311",102:"08aa6ece37223e1ad62e",103:"8a6432cf3ba1a6d4b89c",104:"9f15d853ef941c4a039e",105:"0e4e1933716da484d772",109:"be2a8aaef9da9b820795",110:"68135bd0a550d10dc23b",111:"b136aca89a5c4d49c088",112:"50fd62c66c6594e055a3",113:"2c059fa7d06fd04149eb",114:"edebb3161ce52d4ca2e1",115:"4faef890ae1fc7b7f3e6",116:"48cacb40e8aa0fbf3ab0",117:"921c3300b6991f3a296b",118:"42db4961414208f5f105",119:"796a476c020ef85290c4",120:"60f40cfd2ae42a40ce11",121:"12919c6548e5edc02fc4",122:"fb1a3838704c37cbafdd",123:"4c5f733da9c144659722",124:"cb3b63e859dd2cda2989",125:"b24b4f0fc356fa69fc5c",126:"5e3dd09fd27e79aac0bc",127:"fe104a6d998fb167d62f",128:"31993040b285641fd5f2",129:"df67e3620112bb28cdc3",130:"0ec9ac635809dd6d917d",131:"1bf5e42dab5336449520",132:"84b8d006546395ab5398",133:"c444252fcfb21fb2ddc7",134:"9bf67df47ce489a46991",135:"8b87733926641cfc393b",136:"17fc7bed30481c0cc1e1",137:"d222c61b964fdfa86077",138:"385fb32902804dc3bcba",139:"a0a24bb2e1f32476825a",140:"8beec5f2af539affa918",141:"d1994512ab888cf0b84e",142:"45abebb5dd348ac66141",143:"aa16e6f2be0e646468c2",144:"17f1377ed33c3793e3f3",145:"b0de1a3a530c3d9d42ab",146:"00b3a06a2985b3b0ce32",147:"df90cfe3f4615de24dc9",148:"1f75fd86713f6a7535f4",149:"bd5737d31307cb47c127",150:"674e98d98fcb08e2fc5d",151:"7c3520c62d14eeb4432c"}[e]+".bundle.js"}(e);var u=new Error;s=function(t){o.onerror=o.onload=null,clearTimeout(c);var n=r[e];if(0!==n){if(n){var i=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;u.message="Loading chunk "+e+" failed.\n("+i+": "+a+")",u.name="ChunkLoadError",u.type=i,u.request=a,n[1](u)}r[e]=void 0}};var c=setTimeout((function(){s({type:"timeout",target:o})}),12e4);o.onerror=o.onload=s,document.head.appendChild(o)}return Promise.all(t)},i.m=e,i.c=n,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i.oe=function(e){throw console.error(e),e};var a=window.webpackJsonp=window.webpackJsonp||[],s=a.push.bind(a);a.push=t,a=a.slice();for(var o=0;o<a.length;o++)t(a[o]);var u=s;i(i.s=143)}([function(e,t,n){"use strict";n.r(t),n.d(t,"UserType",(function(){return i})),n.d(t,"UserRole",(function(){return r})),n.d(t,"UserUtils",(function(){return a}));const r=Object.freeze({ROLE_ADMIN:"ROLE_ADMIN",ROLE_USER:"ROLE_USER",ROLE_REPO_MANAGER:"ROLE_REPO_MANAGER"}),i=Object.freeze({ADMIN:"admin",USER:"user",REPO_MANAGER:"repoManager"}),a={getUserRoleName:function(e){switch(e){case i.USER:return"User";case i.REPO_MANAGER:return"Repository manager";case i.ADMIN:return"Administrator";default:return"Unknown"}}}},function(e,t,n){(function(e){var n,r,i,a,s,o,u,c,l,h,f,d={userAgent:!1},p={},g=g||(n=Math,i=(r={}).lib={},a=i.Base=function(){function e(){}return{extend:function(t){e.prototype=this;var n=new e;return t&&n.mixIn(t),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},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)}}}(),s=i.WordArray=a.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||u).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 a=0;a<i;a++){var s=n[a>>>2]>>>24-a%4*8&255;t[r+a>>>2]|=s<<24-(r+a)%4*8}else for(a=0;a<i;a+=4)t[r+a>>>2]=n[a>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,t=this.sigBytes;e[t>>>2]&=4294967295<<32-t%4*8,e.length=n.ceil(t/4)},clone:function(){var e=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(4294967296*n.random()|0);return new s.init(t,e)}}),o=r.enc={},u=o.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var a=t[i>>>2]>>>24-i%4*8&255;r.push((a>>>4).toString(16)),r.push((15&a).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 s.init(n,t/2)}},c=o.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var a=t[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(a))}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 s.init(n,t)}},l=o.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},h=i.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(e){var t=this._data,r=t.words,i=t.sigBytes,a=this.blockSize,o=i/(4*a),u=(o=e?n.ceil(o):n.max((0|o)-this._minBufferSize,0))*a,c=n.min(4*u,i);if(u){for(var l=0;l<u;l+=a)this._doProcessBlock(r,l);var h=r.splice(0,u);t.sigBytes-=c}return new s.init(h,c)},clone:function(){var e=a.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),i.Hasher=h.extend({cfg:a.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){h.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 f.HMAC.init(e,n).finalize(t)}}}),f=r.algo={},r);!function(e){var t,n=(t=g).lib,r=n.Base,i=n.WordArray;(t=t.x64={}).Word=r.extend({init:function(e,t){this.high=e,this.low=t}}),t.WordArray=r.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:8*e.length},toX32:function(){for(var e=this.words,t=e.length,n=[],r=0;r<t;r++){var a=e[r];n.push(a.high),n.push(a.low)}return i.create(n,this.sigBytes)},clone:function(){for(var e=r.clone.call(this),t=e.words=this.words.slice(0),n=t.length,i=0;i<n;i++)t[i]=t[i].clone();return e}})}(),g.lib.Cipher||function(e){var t=(d=g).lib,n=t.Base,r=t.WordArray,i=t.BufferedBlockAlgorithm,a=d.enc.Base64,s=d.algo.EvpKDF,o=t.Cipher=i.extend({cfg:n.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,n){this.cfg=this.cfg.extend(n),this._xformMode=e,this._key=t,this.reset()},reset:function(){i.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(e){return{encrypt:function(t,n,r){return("string"==typeof n?p:f).encrypt(e,t,n,r)},decrypt:function(t,n,r){return("string"==typeof n?p:f).decrypt(e,t,n,r)}}}});t.StreamCipher=o.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var u=d.mode={},c=function(e,t,n){var r=this._iv;r?this._iv=void 0:r=this._prevBlock;for(var i=0;i<n;i++)e[t+i]^=r[i]},l=(t.BlockCipherMode=n.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}})).extend();l.Encryptor=l.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize;c.call(this,e,t,r),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+r)}}),l.Decryptor=l.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize,i=e.slice(t,t+r);n.decryptBlock(e,t),c.call(this,e,t,r),this._prevBlock=i}}),u=u.CBC=l,l=(d.pad={}).Pkcs7={pad:function(e,t){for(var n,i=(n=(n=4*t)-e.sigBytes%n)<<24|n<<16|n<<8|n,a=[],s=0;s<n;s+=4)a.push(i);n=r.create(a,n),e.concat(n)},unpad:function(e){e.sigBytes-=255&e.words[e.sigBytes-1>>>2]}},t.BlockCipher=o.extend({cfg:o.cfg.extend({mode:u,padding:l}),reset:function(){o.reset.call(this);var e=(t=this.cfg).iv,t=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=t.createEncryptor;else n=t.createDecryptor,this._minBufferSize=1;this._mode=n.call(t,this,e&&e.words)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4});var h=t.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),f=(u=(d.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return((e=e.salt)?r.create([1398893684,1701076831]).concat(e).concat(t):t).toString(a)},parse:function(e){var t=(e=a.parse(e)).words;if(1398893684==t[0]&&1701076831==t[1]){var n=r.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return h.create({ciphertext:e,salt:n})}},t.SerializableCipher=n.extend({cfg:n.extend({format:u}),encrypt:function(e,t,n,r){r=this.cfg.extend(r);var i=e.createEncryptor(n,r);return t=i.finalize(t),i=i.cfg,h.create({ciphertext:t,key:n,iv:i.iv,algorithm:e,mode:i.mode,padding:i.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),e.createDecryptor(n,r).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}})),d=(d.kdf={}).OpenSSL={execute:function(e,t,n,i){return i||(i=r.random(8)),e=s.create({keySize:t+n}).compute(e,i),n=r.create(e.words.slice(t),4*n),e.sigBytes=4*t,h.create({key:e,iv:n,salt:i})}},p=t.PasswordBasedCipher=f.extend({cfg:f.cfg.extend({kdf:d}),encrypt:function(e,t,n,r){return n=(r=this.cfg.extend(r)).kdf.execute(n,e.keySize,e.ivSize),r.iv=n.iv,(e=f.encrypt.call(this,e,t,n.key,r)).mixIn(n),e},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),n=r.kdf.execute(n,e.keySize,e.ivSize,t.salt),r.iv=n.iv,f.decrypt.call(this,e,t,n.key,r)}})}(),function(){for(var e=g,t=e.lib.BlockCipher,n=e.algo,r=[],i=[],a=[],s=[],o=[],u=[],c=[],l=[],h=[],f=[],d=[],p=0;256>p;p++)d[p]=128>p?p<<1:p<<1^283;var m=0,v=0;for(p=0;256>p;p++){var y=(y=v^v<<1^v<<2^v<<3^v<<4)>>>8^255&y^99;r[m]=y,i[y]=m;var b=d[m],w=d[b],x=d[w],S=257*d[y]^16843008*y;a[m]=S<<24|S>>>8,s[m]=S<<16|S>>>16,o[m]=S<<8|S>>>24,u[m]=S,S=16843009*x^65537*w^257*b^16843008*m,c[y]=S<<24|S>>>8,l[y]=S<<16|S>>>16,h[y]=S<<8|S>>>24,f[y]=S,m?(m=b^d[d[d[x^b]]],v^=d[d[v]]):m=v=1}var E=[0,1,2,4,8,16,32,64,128,27,54];n=n.AES=t.extend({_doReset:function(){for(var e=(n=this._key).words,t=n.sigBytes/4,n=4*((this._nRounds=t+6)+1),i=this._keySchedule=[],a=0;a<n;a++)if(a<t)i[a]=e[a];else{var s=i[a-1];a%t?6<t&&4==a%t&&(s=r[s>>>24]<<24|r[s>>>16&255]<<16|r[s>>>8&255]<<8|r[255&s]):(s=r[(s=s<<8|s>>>24)>>>24]<<24|r[s>>>16&255]<<16|r[s>>>8&255]<<8|r[255&s],s^=E[a/t|0]<<24),i[a]=i[a-t]^s}for(e=this._invKeySchedule=[],t=0;t<n;t++)a=n-t,s=t%4?i[a]:i[a-4],e[t]=4>t||4>=a?s:c[r[s>>>24]]^l[r[s>>>16&255]]^h[r[s>>>8&255]]^f[r[255&s]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,s,o,u,r)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,c,l,h,f,i),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,i,a,s,o){for(var u=this._nRounds,c=e[t]^n[0],l=e[t+1]^n[1],h=e[t+2]^n[2],f=e[t+3]^n[3],d=4,p=1;p<u;p++){var g=r[c>>>24]^i[l>>>16&255]^a[h>>>8&255]^s[255&f]^n[d++],m=r[l>>>24]^i[h>>>16&255]^a[f>>>8&255]^s[255&c]^n[d++],v=r[h>>>24]^i[f>>>16&255]^a[c>>>8&255]^s[255&l]^n[d++];f=r[f>>>24]^i[c>>>16&255]^a[l>>>8&255]^s[255&h]^n[d++],c=g,l=m,h=v}g=(o[c>>>24]<<24|o[l>>>16&255]<<16|o[h>>>8&255]<<8|o[255&f])^n[d++],m=(o[l>>>24]<<24|o[h>>>16&255]<<16|o[f>>>8&255]<<8|o[255&c])^n[d++],v=(o[h>>>24]<<24|o[f>>>16&255]<<16|o[c>>>8&255]<<8|o[255&l])^n[d++],f=(o[f>>>24]<<24|o[c>>>16&255]<<16|o[l>>>8&255]<<8|o[255&h])^n[d++],e[t]=g,e[t+1]=m,e[t+2]=v,e[t+3]=f},keySize:8});e.AES=t._createHelper(n)}(),function(){function e(e,t){var n=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=n,this._lBlock^=n<<e}function t(e,t){var n=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=n,this._rBlock^=n<<e}var n=g,r=(i=n.lib).WordArray,i=i.BlockCipher,a=n.algo,s=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],l=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],h=a.DES=i.extend({_doReset:function(){for(var e=this._key.words,t=[],n=0;56>n;n++){var r=s[n]-1;t[n]=e[r>>>5]>>>31-r%32&1}for(e=this._subKeys=[],r=0;16>r;r++){var i=e[r]=[],a=u[r];for(n=0;24>n;n++)i[n/6|0]|=t[(o[n]-1+a)%28]<<31-n%6,i[4+(n/6|0)]|=t[28+(o[n+24]-1+a)%28]<<31-n%6;for(i[0]=i[0]<<1|i[0]>>>31,n=1;7>n;n++)i[n]>>>=4*(n-1)+3;i[7]=i[7]<<5|i[7]>>>27}for(t=this._invSubKeys=[],n=0;16>n;n++)t[n]=e[15-n]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(n,r,i){this._lBlock=n[r],this._rBlock=n[r+1],e.call(this,4,252645135),e.call(this,16,65535),t.call(this,2,858993459),t.call(this,8,16711935),e.call(this,1,1431655765);for(var a=0;16>a;a++){for(var s=i[a],o=this._lBlock,u=this._rBlock,h=0,f=0;8>f;f++)h|=c[f][((u^s[f])&l[f])>>>0];this._lBlock=u,this._rBlock=o^h}i=this._lBlock,this._lBlock=this._rBlock,this._rBlock=i,e.call(this,1,1431655765),t.call(this,8,16711935),t.call(this,2,858993459),e.call(this,16,65535),e.call(this,4,252645135),n[r]=this._lBlock,n[r+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});n.DES=i._createHelper(h),a=a.TripleDES=i.extend({_doReset:function(){var e=this._key.words;this._des1=h.createEncryptor(r.create(e.slice(0,2))),this._des2=h.createEncryptor(r.create(e.slice(2,4))),this._des3=h.createEncryptor(r.create(e.slice(4,6)))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2}),n.TripleDES=i._createHelper(a)}(),function(){var e=g,t=e.lib.WordArray;e.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp(),e=[];for(var i=0;i<n;i+=3)for(var a=(t[i>>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,s=0;4>s&&i+.75*s<n;s++)e.push(r.charAt(a>>>6*(3-s)&63));if(t=r.charAt(64))for(;e.length%4;)e.push(t);return e.join("")},parse:function(e){var n=e.length,r=this._map;(i=r.charAt(64))&&(-1!=(i=e.indexOf(i))&&(n=i));for(var i=[],a=0,s=0;s<n;s++)if(s%4){var o=r.indexOf(e.charAt(s-1))<<s%4*2,u=r.indexOf(e.charAt(s))>>>6-s%4*2;i[a>>>2]|=(o|u)<<24-a%4*8,a++}return t.create(i,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(e){function t(e,t,n,r,i,a,s){return((e=e+(t&n|~t&r)+i+s)<<a|e>>>32-a)+t}function n(e,t,n,r,i,a,s){return((e=e+(t&r|n&~r)+i+s)<<a|e>>>32-a)+t}function r(e,t,n,r,i,a,s){return((e=e+(t^n^r)+i+s)<<a|e>>>32-a)+t}function i(e,t,n,r,i,a,s){return((e=e+(n^(t|~r))+i+s)<<a|e>>>32-a)+t}for(var a=g,s=(u=a.lib).WordArray,o=u.Hasher,u=a.algo,c=[],l=0;64>l;l++)c[l]=4294967296*e.abs(e.sin(l+1))|0;u=u.MD5=o.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,a){for(var s=0;16>s;s++){var o=e[u=a+s];e[u]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}s=this._hash.words;var u=e[a+0],l=(o=e[a+1],e[a+2]),h=e[a+3],f=e[a+4],d=e[a+5],p=e[a+6],g=e[a+7],m=e[a+8],v=e[a+9],y=e[a+10],b=e[a+11],w=e[a+12],x=e[a+13],S=e[a+14],E=e[a+15],A=t(A=s[0],D=s[1],C=s[2],F=s[3],u,7,c[0]),F=t(F,A,D,C,o,12,c[1]),C=t(C,F,A,D,l,17,c[2]),D=t(D,C,F,A,h,22,c[3]);A=t(A,D,C,F,f,7,c[4]),F=t(F,A,D,C,d,12,c[5]),C=t(C,F,A,D,p,17,c[6]),D=t(D,C,F,A,g,22,c[7]),A=t(A,D,C,F,m,7,c[8]),F=t(F,A,D,C,v,12,c[9]),C=t(C,F,A,D,y,17,c[10]),D=t(D,C,F,A,b,22,c[11]),A=t(A,D,C,F,w,7,c[12]),F=t(F,A,D,C,x,12,c[13]),C=t(C,F,A,D,S,17,c[14]),A=n(A,D=t(D,C,F,A,E,22,c[15]),C,F,o,5,c[16]),F=n(F,A,D,C,p,9,c[17]),C=n(C,F,A,D,b,14,c[18]),D=n(D,C,F,A,u,20,c[19]),A=n(A,D,C,F,d,5,c[20]),F=n(F,A,D,C,y,9,c[21]),C=n(C,F,A,D,E,14,c[22]),D=n(D,C,F,A,f,20,c[23]),A=n(A,D,C,F,v,5,c[24]),F=n(F,A,D,C,S,9,c[25]),C=n(C,F,A,D,h,14,c[26]),D=n(D,C,F,A,m,20,c[27]),A=n(A,D,C,F,x,5,c[28]),F=n(F,A,D,C,l,9,c[29]),C=n(C,F,A,D,g,14,c[30]),A=r(A,D=n(D,C,F,A,w,20,c[31]),C,F,d,4,c[32]),F=r(F,A,D,C,m,11,c[33]),C=r(C,F,A,D,b,16,c[34]),D=r(D,C,F,A,S,23,c[35]),A=r(A,D,C,F,o,4,c[36]),F=r(F,A,D,C,f,11,c[37]),C=r(C,F,A,D,g,16,c[38]),D=r(D,C,F,A,y,23,c[39]),A=r(A,D,C,F,x,4,c[40]),F=r(F,A,D,C,u,11,c[41]),C=r(C,F,A,D,h,16,c[42]),D=r(D,C,F,A,p,23,c[43]),A=r(A,D,C,F,v,4,c[44]),F=r(F,A,D,C,w,11,c[45]),C=r(C,F,A,D,E,16,c[46]),A=i(A,D=r(D,C,F,A,l,23,c[47]),C,F,u,6,c[48]),F=i(F,A,D,C,g,10,c[49]),C=i(C,F,A,D,S,15,c[50]),D=i(D,C,F,A,d,21,c[51]),A=i(A,D,C,F,w,6,c[52]),F=i(F,A,D,C,h,10,c[53]),C=i(C,F,A,D,y,15,c[54]),D=i(D,C,F,A,o,21,c[55]),A=i(A,D,C,F,m,6,c[56]),F=i(F,A,D,C,E,10,c[57]),C=i(C,F,A,D,p,15,c[58]),D=i(D,C,F,A,x,21,c[59]),A=i(A,D,C,F,f,6,c[60]),F=i(F,A,D,C,b,10,c[61]),C=i(C,F,A,D,l,15,c[62]),D=i(D,C,F,A,v,21,c[63]);s[0]=s[0]+A|0,s[1]=s[1]+D|0,s[2]=s[2]+C|0,s[3]=s[3]+F|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;n[i>>>5]|=128<<24-i%32;var a=e.floor(r/4294967296);for(n[15+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),n[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(n.length+1),this._process(),n=(t=this._hash).words,r=0;4>r;r++)i=n[r],n[r]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8);return t},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),a.MD5=o._createHelper(u),a.HmacMD5=o._createHmacHelper(u)}(Math),function(){var e=g,t=(i=e.lib).WordArray,n=i.Hasher,r=[],i=e.algo.SHA1=n.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=this._hash.words,i=n[0],a=n[1],s=n[2],o=n[3],u=n[4],c=0;80>c;c++){if(16>c)r[c]=0|e[t+c];else{var l=r[c-3]^r[c-8]^r[c-14]^r[c-16];r[c]=l<<1|l>>>31}l=(i<<5|i>>>27)+u+r[c],l=20>c?l+(1518500249+(a&s|~a&o)):40>c?l+(1859775393+(a^s^o)):60>c?l+((a&s|a&o|s&o)-1894007588):l+((a^s^o)-899497514),u=o,o=s,s=a<<30|a>>>2,a=i,i=l}n[0]=n[0]+i|0,n[1]=n[1]+a|0,n[2]=n[2]+s|0,n[3]=n[3]+o|0,n[4]=n[4]+u|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(r+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA1=n._createHelper(i),e.HmacSHA1=n._createHmacHelper(i)}(),function(e){for(var t=g,n=(i=t.lib).WordArray,r=i.Hasher,i=t.algo,a=[],s=[],o=function(e){return 4294967296*(e-(0|e))|0},u=2,c=0;64>c;){var l;e:{l=u;for(var h=e.sqrt(l),f=2;f<=h;f++)if(!(l%f)){l=!1;break e}l=!0}l&&(8>c&&(a[c]=o(e.pow(u,.5))),s[c]=o(e.pow(u,1/3)),c++),u++}var d=[];i=i.SHA256=r.extend({_doReset:function(){this._hash=new n.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],a=n[2],o=n[3],u=n[4],c=n[5],l=n[6],h=n[7],f=0;64>f;f++){if(16>f)d[f]=0|e[t+f];else{var p=d[f-15],g=d[f-2];d[f]=((p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+d[f-7]+((g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10)+d[f-16]}p=h+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&c^~u&l)+s[f]+d[f],g=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&i^r&a^i&a),h=l,l=c,c=u,u=o+p|0,o=a,a=i,i=r,r=p+g|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+a|0,n[3]=n[3]+o|0,n[4]=n[4]+u|0,n[5]=n[5]+c|0,n[6]=n[6]+l|0,n[7]=n[7]+h|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=r.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=r._createHelper(i),t.HmacSHA256=r._createHmacHelper(i)}(Math),function(){var e=g,t=e.lib.WordArray,n=(r=e.algo).SHA256,r=r.SHA224=n.extend({_doReset:function(){this._hash=new t.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=n._doFinalize.call(this);return e.sigBytes-=4,e}});e.SHA224=n._createHelper(r),e.HmacSHA224=n._createHmacHelper(r)}(),function(){function e(){return r.create.apply(r,arguments)}for(var t=g,n=t.lib.Hasher,r=(a=t.x64).Word,i=a.WordArray,a=t.algo,s=[e(1116352408,3609767458),e(1899447441,602891725),e(3049323471,3964484399),e(3921009573,2173295548),e(961987163,4081628472),e(1508970993,3053834265),e(2453635748,2937671579),e(2870763221,3664609560),e(3624381080,2734883394),e(310598401,1164996542),e(607225278,1323610764),e(1426881987,3590304994),e(1925078388,4068182383),e(2162078206,991336113),e(2614888103,633803317),e(3248222580,3479774868),e(3835390401,2666613458),e(4022224774,944711139),e(264347078,2341262773),e(604807628,2007800933),e(770255983,1495990901),e(1249150122,1856431235),e(1555081692,3175218132),e(1996064986,2198950837),e(2554220882,3999719339),e(2821834349,766784016),e(2952996808,2566594879),e(3210313671,3203337956),e(3336571891,1034457026),e(3584528711,2466948901),e(113926993,3758326383),e(338241895,168717936),e(666307205,1188179964),e(773529912,1546045734),e(1294757372,1522805485),e(1396182291,2643833823),e(1695183700,2343527390),e(1986661051,1014477480),e(2177026350,1206759142),e(2456956037,344077627),e(2730485921,1290863460),e(2820302411,3158454273),e(3259730800,3505952657),e(3345764771,106217008),e(3516065817,3606008344),e(3600352804,1432725776),e(4094571909,1467031594),e(275423344,851169720),e(430227734,3100823752),e(506948616,1363258195),e(659060556,3750685593),e(883997877,3785050280),e(958139571,3318307427),e(1322822218,3812723403),e(1537002063,2003034995),e(1747873779,3602036899),e(1955562222,1575990012),e(2024104815,1125592928),e(2227730452,2716904306),e(2361852424,442776044),e(2428436474,593698344),e(2756734187,3733110249),e(3204031479,2999351573),e(3329325298,3815920427),e(3391569614,3928383900),e(3515267271,566280711),e(3940187606,3454069534),e(4118630271,4000239992),e(116418474,1914138554),e(174292421,2731055270),e(289380356,3203993006),e(460393269,320620315),e(685471733,587496836),e(852142971,1086792851),e(1017036298,365543100),e(1126000580,2618297676),e(1288033470,3409855158),e(1501505948,4234509866),e(1607167915,987167468),e(1816402316,1246189591)],o=[],u=0;80>u;u++)o[u]=e();a=a.SHA512=n.extend({_doReset:function(){this._hash=new i.init([new r.init(1779033703,4089235720),new r.init(3144134277,2227873595),new r.init(1013904242,4271175723),new r.init(2773480762,1595750129),new r.init(1359893119,2917565137),new r.init(2600822924,725511199),new r.init(528734635,4215389547),new r.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var n=(h=this._hash.words)[0],r=h[1],i=h[2],a=h[3],u=h[4],c=h[5],l=h[6],h=h[7],f=n.high,d=n.low,p=r.high,g=r.low,m=i.high,v=i.low,y=a.high,b=a.low,w=u.high,x=u.low,S=c.high,E=c.low,A=l.high,F=l.low,C=h.high,D=h.low,R=f,I=d,T=p,$=g,P=m,_=v,k=y,O=b,B=w,j=x,H=S,N=E,L=A,M=F,U=C,V=D,q=0;80>q;q++){var K=o[q];if(16>q)var z=K.high=0|e[t+2*q],G=K.low=0|e[t+2*q+1];else{z=((G=(z=o[q-15]).high)>>>1|(W=z.low)<<31)^(G>>>8|W<<24)^G>>>7;var W=(W>>>1|G<<31)^(W>>>8|G<<24)^(W>>>7|G<<25),Y=((G=(Y=o[q-2]).high)>>>19|(X=Y.low)<<13)^(G<<3|X>>>29)^G>>>6,X=(X>>>19|G<<13)^(X<<3|G>>>29)^(X>>>6|G<<26),J=(G=o[q-7]).high,Q=(Z=o[q-16]).high,Z=Z.low;z=(z=(z=z+J+((G=W+G.low)>>>0<W>>>0?1:0))+Y+((G=G+X)>>>0<X>>>0?1:0))+Q+((G=G+Z)>>>0<Z>>>0?1:0);K.high=z,K.low=G}J=B&H^~B&L,Z=j&N^~j&M,K=R&T^R&P^T&P;var ee=I&$^I&_^$&_,te=(W=(R>>>28|I<<4)^(R<<30|I>>>2)^(R<<25|I>>>7),Y=(I>>>28|R<<4)^(I<<30|R>>>2)^(I<<25|R>>>7),(X=s[q]).high),ne=X.low;Q=U+((B>>>14|j<<18)^(B>>>18|j<<14)^(B<<23|j>>>9))+((X=V+((j>>>14|B<<18)^(j>>>18|B<<14)^(j<<23|B>>>9)))>>>0<V>>>0?1:0),U=L,V=M,L=H,M=N,H=B,N=j,B=k+(Q=(Q=(Q=Q+J+((X=X+Z)>>>0<Z>>>0?1:0))+te+((X=X+ne)>>>0<ne>>>0?1:0))+z+((X=X+G)>>>0<G>>>0?1:0))+((j=O+X|0)>>>0<O>>>0?1:0)|0,k=P,O=_,P=T,_=$,T=R,$=I,R=Q+(K=W+K+((G=Y+ee)>>>0<Y>>>0?1:0))+((I=X+G|0)>>>0<X>>>0?1:0)|0}d=n.low=d+I,n.high=f+R+(d>>>0<I>>>0?1:0),g=r.low=g+$,r.high=p+T+(g>>>0<$>>>0?1:0),v=i.low=v+_,i.high=m+P+(v>>>0<_>>>0?1:0),b=a.low=b+O,a.high=y+k+(b>>>0<O>>>0?1:0),x=u.low=x+j,u.high=w+B+(x>>>0<j>>>0?1:0),E=c.low=E+N,c.high=S+H+(E>>>0<N>>>0?1:0),F=l.low=F+M,l.high=A+L+(F>>>0<M>>>0?1:0),D=h.low=D+V,h.high=C+U+(D>>>0<V>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[30+(r+128>>>10<<5)]=Math.floor(n/4294967296),t[31+(r+128>>>10<<5)]=n,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32}),t.SHA512=n._createHelper(a),t.HmacSHA512=n._createHmacHelper(a)}(),function(){var e=g,t=(i=e.x64).Word,n=i.WordArray,r=(i=e.algo).SHA512,i=i.SHA384=r.extend({_doReset:function(){this._hash=new n.init([new t.init(3418070365,3238371032),new t.init(1654270250,914150663),new t.init(2438529370,812702999),new t.init(355462360,4144912697),new t.init(1731405415,4290775857),new t.init(2394180231,1750603025),new t.init(3675008525,1694076839),new t.init(1203062813,3204075428)])},_doFinalize:function(){var e=r._doFinalize.call(this);return e.sigBytes-=16,e}});e.SHA384=r._createHelper(i),e.HmacSHA384=r._createHmacHelper(i)}(),function(){var e=g,t=(r=e.lib).WordArray,n=r.Hasher,r=e.algo,i=t.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),a=t.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),s=t.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),o=t.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=t.create([0,1518500249,1859775393,2400959708,2840853838]),c=t.create([1352829926,1548603684,1836072691,2053994217,0]);r=r.RIPEMD160=n.extend({_doReset:function(){this._hash=t.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=0;16>n;n++){var r=e[w=t+n];e[w]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var l,h,f,d,p,g,m,v,y,b,w=this._hash.words,x=(r=u.words,c.words),S=i.words,E=a.words,A=s.words,F=o.words;g=l=w[0],m=h=w[1],v=f=w[2],y=d=w[3],b=p=w[4];var C;for(n=0;80>n;n+=1)C=l+e[t+S[n]]|0,C=16>n?C+((h^f^d)+r[0]):32>n?C+((h&f|~h&d)+r[1]):48>n?C+(((h|~f)^d)+r[2]):64>n?C+((h&d|f&~d)+r[3]):C+((h^(f|~d))+r[4]),C=(C=(C|=0)<<A[n]|C>>>32-A[n])+p|0,l=p,p=d,d=f<<10|f>>>22,f=h,h=C,C=g+e[t+E[n]]|0,C=16>n?C+((m^(v|~y))+x[0]):32>n?C+((m&y|v&~y)+x[1]):48>n?C+(((m|~v)^y)+x[2]):64>n?C+((m&v|~m&y)+x[3]):C+((m^v^y)+x[4]),C=(C=(C|=0)<<F[n]|C>>>32-F[n])+b|0,g=b,b=y,y=v<<10|v>>>22,v=m,m=C;C=w[1]+f+y|0,w[1]=w[2]+d+b|0,w[2]=w[3]+p+g|0,w[3]=w[4]+l+m|0,w[4]=w[0]+h+v|0,w[0]=C},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;for(t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(t.length+1),this._process(),t=(e=this._hash).words,n=0;5>n;n++)r=t[n],t[n]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8);return e},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});e.RIPEMD160=n._createHelper(r),e.HmacRIPEMD160=n._createHmacHelper(r)}(Math),function(){var e=g,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(e,n){e=this._hasher=new e.init,"string"==typeof n&&(n=t.parse(n));var r=e.blockSize,i=4*r;n.sigBytes>i&&(n=e.finalize(n)),n.clamp();for(var a=this._oKey=n.clone(),s=this._iKey=n.clone(),o=a.words,u=s.words,c=0;c<r;c++)o[c]^=1549556828,u[c]^=909522486;a.sigBytes=s.sigBytes=i,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;return e=t.finalize(e),t.reset(),t.finalize(this._oKey.clone().concat(e))}})}(),function(){var e,t=g,n=(e=t.lib).Base,r=e.WordArray,i=(e=t.algo).HMAC,a=e.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:e.SHA1,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){var n=this.cfg,a=i.create(n.hasher,e),s=r.create(),o=r.create([1]),u=s.words,c=o.words,l=n.keySize;for(n=n.iterations;u.length<l;){var h=a.update(t).finalize(o);a.reset();for(var f=h.words,d=f.length,p=h,g=1;g<n;g++){p=a.finalize(p),a.reset();for(var m=p.words,v=0;v<d;v++)f[v]^=m[v]}s.concat(h),c[0]++}return s.sigBytes=4*l,s}});t.PBKDF2=function(e,t,n){return a.create(n).compute(e,t)}}();
|
|
2
2
|
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
|
|
3
3
|
*/
|
|
4
4
|
var m,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y="=";function b(e){var t,n,r="";for(t=0;t+3<=e.length;t+=3)n=parseInt(e.substring(t,t+3),16),r+=v.charAt(n>>6)+v.charAt(63&n);if(t+1==e.length?(n=parseInt(e.substring(t,t+1),16),r+=v.charAt(n<<2)):t+2==e.length&&(n=parseInt(e.substring(t,t+2),16),r+=v.charAt(n>>2)+v.charAt((3&n)<<4)),y)for(;(3&r.length)>0;)r+=y;return r}function w(e){var t,n,r,i="",a=0;for(t=0;t<e.length&&e.charAt(t)!=y;++t)(r=v.indexOf(e.charAt(t)))<0||(0==a?(i+=R(r>>2),n=3&r,a=1):1==a?(i+=R(n<<2|r>>4),n=15&r,a=2):2==a?(i+=R(n),i+=R(r>>2),n=3&r,a=3):(i+=R(n<<2|r>>4),i+=R(15&r),a=0));return 1==a&&(i+=R(n<<2)),i}function x(e){var t,n=w(e),r=new Array;for(t=0;2*t<n.length;++t)r[t]=parseInt(n.substring(2*t,2*t+2),16);return r}function S(e,t,n){null!=e&&("number"==typeof e?this.fromNumber(e,t,n):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function E(){return new S(null)}"Microsoft Internet Explorer"==d.appName?(S.prototype.am=function(e,t,n,r,i,a){for(var s=32767&t,o=t>>15;--a>=0;){var u=32767&this[e],c=this[e++]>>15,l=o*u+c*s;i=((u=s*u+((32767&l)<<15)+n[r]+(1073741823&i))>>>30)+(l>>>15)+o*c+(i>>>30),n[r++]=1073741823&u}return i},m=30):"Netscape"!=d.appName?(S.prototype.am=function(e,t,n,r,i,a){for(;--a>=0;){var s=t*this[e++]+n[r]+i;i=Math.floor(s/67108864),n[r++]=67108863&s}return i},m=26):(S.prototype.am=function(e,t,n,r,i,a){for(var s=16383&t,o=t>>14;--a>=0;){var u=16383&this[e],c=this[e++]>>14,l=o*u+c*s;i=((u=s*u+((16383&l)<<14)+n[r]+i)>>28)+(l>>14)+o*c,n[r++]=268435455&u}return i},m=28),S.prototype.DB=m,S.prototype.DM=(1<<m)-1,S.prototype.DV=1<<m;S.prototype.FV=Math.pow(2,52),S.prototype.F1=52-m,S.prototype.F2=2*m-52;var A,F,C="0123456789abcdefghijklmnopqrstuvwxyz",D=new Array;for(A="0".charCodeAt(0),F=0;F<=9;++F)D[A++]=F;for(A="a".charCodeAt(0),F=10;F<36;++F)D[A++]=F;for(A="A".charCodeAt(0),F=10;F<36;++F)D[A++]=F;function R(e){return C.charAt(e)}function I(e,t){var n=D[e.charCodeAt(t)];return null==n?-1:n}function T(e){var t=E();return t.fromInt(e),t}function $(e){var t,n=1;return 0!=(t=e>>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}function P(e){this.m=e}function _(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function k(e,t){return e&t}function O(e,t){return e|t}function B(e,t){return e^t}function j(e,t){return e&~t}function H(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function N(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function L(){}function M(e){return e}function U(e){this.r2=E(),this.q3=E(),S.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}P.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},P.prototype.revert=function(e){return e},P.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},P.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},P.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},_.prototype.convert=function(e){var t=E();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(S.ZERO)>0&&this.m.subTo(t,t),t},_.prototype.revert=function(e){var t=E();return e.copyTo(t),this.reduce(t),t},_.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var n=32767&e[t],r=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[n=t+this.m.t]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},_.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},_.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},S.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},S.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},S.prototype.fromString=function(e,t){var n;if(16==t)n=4;else if(8==t)n=3;else if(256==t)n=8;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)return void this.fromRadix(e,t);n=2}this.t=0,this.s=0;for(var r=e.length,i=!1,a=0;--r>=0;){var s=8==n?255&e[r]:I(e,r);s<0?"-"==e.charAt(r)&&(i=!0):(i=!1,0==a?this[this.t++]=s:a+n>this.DB?(this[this.t-1]|=(s&(1<<this.DB-a)-1)<<a,this[this.t++]=s>>this.DB-a):this[this.t-1]|=s<<a,(a+=n)>=this.DB&&(a-=this.DB))}8==n&&0!=(128&e[0])&&(this.s=-1,a>0&&(this[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),i&&S.ZERO.subTo(this,this)},S.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},S.prototype.dlShiftTo=function(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s},S.prototype.drShiftTo=function(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s},S.prototype.lShiftTo=function(e,t){var n,r=e%this.DB,i=this.DB-r,a=(1<<i)-1,s=Math.floor(e/this.DB),o=this.s<<r&this.DM;for(n=this.t-1;n>=0;--n)t[n+s+1]=this[n]>>i|o,o=(this[n]&a)<<r;for(n=s-1;n>=0;--n)t[n]=0;t[s]=o,t.t=this.t+s+1,t.s=this.s,t.clamp()},S.prototype.rShiftTo=function(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var r=e%this.DB,i=this.DB-r,a=(1<<r)-1;t[0]=this[n]>>r;for(var s=n+1;s<this.t;++s)t[s-n-1]|=(this[s]&a)<<i,t[s-n]=this[s]>>r;r>0&&(t[this.t-n-1]|=(this.s&a)<<i),t.t=this.t-n,t.clamp()}},S.prototype.subTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]-e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r-=e[n],t[n++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()},S.prototype.multiplyTo=function(e,t){var n=this.abs(),r=e.abs(),i=n.t;for(t.t=i+r.t;--i>=0;)t[i]=0;for(i=0;i<r.t;++i)t[i+n.t]=n.am(0,r[i],t,i,0,n.t);t.s=0,t.clamp(),this.s!=e.s&&S.ZERO.subTo(t,t)},S.prototype.squareTo=function(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var r=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,r,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()},S.prototype.divRemTo=function(e,t,n){var r=e.abs();if(!(r.t<=0)){var i=this.abs();if(i.t<r.t)return null!=t&&t.fromInt(0),void(null!=n&&this.copyTo(n));null==n&&(n=E());var a=E(),s=this.s,o=e.s,u=this.DB-$(r[r.t-1]);u>0?(r.lShiftTo(u,a),i.lShiftTo(u,n)):(r.copyTo(a),i.copyTo(n));var c=a.t,l=a[c-1];if(0!=l){var h=l*(1<<this.F1)+(c>1?a[c-2]>>this.F2:0),f=this.FV/h,d=(1<<this.F1)/h,p=1<<this.F2,g=n.t,m=g-c,v=null==t?E():t;for(a.dlShiftTo(m,v),n.compareTo(v)>=0&&(n[n.t++]=1,n.subTo(v,n)),S.ONE.dlShiftTo(c,v),v.subTo(a,a);a.t<c;)a[a.t++]=0;for(;--m>=0;){var y=n[--g]==l?this.DM:Math.floor(n[g]*f+(n[g-1]+p)*d);if((n[g]+=a.am(0,y,n,m,0,c))<y)for(a.dlShiftTo(m,v),n.subTo(v,n);n[g]<--y;)n.subTo(v,n)}null!=t&&(n.drShiftTo(c,t),s!=o&&S.ZERO.subTo(t,t)),n.t=c,n.clamp(),u>0&&n.rShiftTo(u,n),s<0&&S.ZERO.subTo(n,n)}}},S.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},S.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},S.prototype.exp=function(e,t){if(e>4294967295||e<1)return S.ONE;var n=E(),r=E(),i=t.convert(this),a=$(e)-1;for(i.copyTo(n);--a>=0;)if(t.sqrTo(n,r),(e&1<<a)>0)t.mulTo(r,i,n);else{var s=n;n=r,r=s}return t.revert(n)},S.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n,r=(1<<t)-1,i=!1,a="",s=this.t,o=this.DB-s*this.DB%t;if(s-- >0)for(o<this.DB&&(n=this[s]>>o)>0&&(i=!0,a=R(n));s>=0;)o<t?(n=(this[s]&(1<<o)-1)<<t-o,n|=this[--s]>>(o+=this.DB-t)):(n=this[s]>>(o-=t)&r,o<=0&&(o+=this.DB,--s)),n>0&&(i=!0),i&&(a+=R(n));return i?a:"0"},S.prototype.negate=function(){var e=E();return S.ZERO.subTo(this,e),e},S.prototype.abs=function(){return this.s<0?this.negate():this},S.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(0!=(t=n-e.t))return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0},S.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+$(this[this.t-1]^this.s&this.DM)},S.prototype.mod=function(e){var t=E();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(S.ZERO)>0&&e.subTo(t,t),t},S.prototype.modPowInt=function(e,t){var n;return n=e<256||t.isEven()?new P(t):new _(t),this.exp(e,n)},S.ZERO=T(0),S.ONE=T(1),L.prototype.convert=M,L.prototype.revert=M,L.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n)},L.prototype.sqrTo=function(e,t){e.squareTo(t)},U.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=E();return e.copyTo(t),this.reduce(t),t},U.prototype.revert=function(e){return e},U.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},U.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},U.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var V=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],q=(1<<26)/V[V.length-1];
|
|
@@ -24,7 +24,7 @@ function(e,t){for(var n=e.toByteArray(),r=0;r<n.length&&0==n[r];)++r;if(n.length
|
|
|
24
24
|
oe.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)},ue.prototype.getEncoded=function(e){var t=function(e,t){var n=e.toByteArrayUnsigned();if(t<n.length)n=n.slice(n.length-t);else for(;t>n.length;)n.unshift(0);return n},n=this.getX().toBigInteger(),r=this.getY().toBigInteger(),i=t(n,32);return e?r.isEven()?i.unshift(2):i.unshift(3):(i.unshift(4),i=i.concat(t(r,32))),i},ue.decodeFrom=function(e,t){t[0];var n=t.length-1,r=t.slice(1,1+n/2),i=t.slice(1+n/2,1+n);r.unshift(0),i.unshift(0);var a=new S(r),s=new S(i);return new ue(e,e.fromBigInteger(a),e.fromBigInteger(s))},ue.decodeFromHex=function(e,t){t.substr(0,2);var n=t.length-2,r=t.substr(2,n/2),i=t.substr(2+n/2,n/2),a=new S(r,16),s=new S(i,16);return new ue(e,e.fromBigInteger(a),e.fromBigInteger(s))},ue.prototype.add2D=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;if(this.x.equals(e.x))return this.y.equals(e.y)?this.twice():this.curve.getInfinity();var t=e.x.subtract(this.x),n=e.y.subtract(this.y).divide(t),r=n.square().subtract(this.x).subtract(e.x),i=n.multiply(this.x.subtract(r)).subtract(this.y);return new ue(this.curve,r,i)},ue.prototype.twice2D=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var e=this.curve.fromBigInteger(S.valueOf(2)),t=this.curve.fromBigInteger(S.valueOf(3)),n=this.x.square().multiply(t).add(this.curve.a).divide(this.y.multiply(e)),r=n.square().subtract(this.x.multiply(e)),i=n.multiply(this.x.subtract(r)).subtract(this.y);return new ue(this.curve,r,i)},ue.prototype.multiply2D=function(e){if(this.isInfinity())return this;if(0==e.signum())return this.curve.getInfinity();var t,n=e,r=n.multiply(new S("3")),i=this.negate(),a=this;for(t=r.bitLength()-2;t>0;--t){a=a.twice();var s=r.testBit(t);s!=n.testBit(t)&&(a=a.add2D(s?this:i))}return a},ue.prototype.isOnCurve=function(){var e=this.getX().toBigInteger(),t=this.getY().toBigInteger(),n=this.curve.getA().toBigInteger(),r=this.curve.getB().toBigInteger(),i=this.curve.getQ(),a=t.multiply(t).mod(i),s=e.multiply(e).multiply(e).add(n.multiply(e)).add(r).mod(i);return a.equals(s)},ue.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"},ue.prototype.validate=function(){var e=this.curve.getQ();if(this.isInfinity())throw new Error("Point is at infinity.");var t=this.getX().toBigInteger(),n=this.getY().toBigInteger();if(t.compareTo(S.ONE)<0||t.compareTo(e.subtract(S.ONE))>0)throw new Error("x coordinate out of bounds");if(n.compareTo(S.ONE)<0||n.compareTo(e.subtract(S.ONE))>0)throw new Error("y coordinate out of bounds");if(!this.isOnCurve())throw new Error("Point is not on the curve.");if(this.multiply(e).isInfinity())throw new Error("Point is not a scalar multiple of G.");return!0};
|
|
25
25
|
/*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval
|
|
26
26
|
*/
|
|
27
|
-
var le=function(){var e=new RegExp('(?:false|true|null|[\\{\\}\\[\\]]|(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)|(?:"(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))*"))',"g"),t=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),n={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function r(e,t,r){return t?n[t]:String.fromCharCode(parseInt(r,16))}var i=new String(""),a=Object.hasOwnProperty;return function(n,s){var o,u,c=n.match(e),l=c[0],h=!1;"{"===l?o={}:"["===l?o=[]:(o=[],h=!0);for(var f=[o],d=1-h,p=c.length;d<p;++d){var g;switch((l=c[d]).charCodeAt(0)){default:(g=f[0])[u||g.length]=+l,u=void 0;break;case 34:if(-1!==(l=l.substring(1,l.length-1)).indexOf("\\")&&(l=l.replace(t,r)),g=f[0],!u){if(!(g instanceof Array)){u=l||i;break}u=g.length}g[u]=l,u=void 0;break;case 91:g=f[0],f.unshift(g[u||g.length]=[]),u=void 0;break;case 93:f.shift();break;case 102:(g=f[0])[u||g.length]=!1,u=void 0;break;case 110:(g=f[0])[u||g.length]=null,u=void 0;break;case 116:(g=f[0])[u||g.length]=!0,u=void 0;break;case 123:g=f[0],f.unshift(g[u||g.length]={}),u=void 0;break;case 125:f.shift()}}if(h){if(1!==f.length)throw new Error;o=o[0]}else if(f.length)throw new Error;if(s){var m=function(e,t){var n=e[t];if(n&&"object"==typeof n){var r=null;for(var i in n)if(a.call(n,i)&&n!==e){var o=m(n,i);void 0!==o?n[i]=o:(r||(r=[]),r.push(i))}if(r)for(var u=r.length;--u>=0;)delete n[r[u]]}return s.call(e,t,n)};o=m({"":o},"")}return o}}();void 0!==he&&he||(he={}),void 0!==he.asn1&&he.asn1||(he.asn1={}),he.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(e){var t=e.toString(16);if("-"!=t.substr(0,1))t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t);else{var n=t.substr(1).length;n%2==1?n+=1:t.match(/^[0-7]/)||(n+=2);for(var r="",i=0;i<n;i++)r+="f";t=new S(r,16).xor(e).add(S.ONE).toString(16).replace(/^-/,"")}return t},this.getPEMStringFromHex=function(e,t){return Te(e,t)},this.newObject=function(e){var t=he.asn1,n=t.ASN1Object,r=t.DERBoolean,i=t.DERInteger,a=t.DERBitString,s=t.DEROctetString,o=t.DERNull,u=t.DERObjectIdentifier,c=t.DEREnumerated,l=t.DERUTF8String,h=t.DERNumericString,f=t.DERPrintableString,d=t.DERTeletexString,p=t.DERIA5String,g=t.DERUTCTime,m=t.DERGeneralizedTime,v=t.DERVisibleString,y=t.DERBMPString,b=t.DERSequence,w=t.DERSet,x=t.DERTaggedObject,S=t.ASN1Util.newObject;if(e instanceof t.ASN1Object)return e;var E=Object.keys(e);if(1!=E.length)throw new Error("key of param shall be only one.");var A=E[0];if(-1==":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+A+":"))throw new Error("undefined key: "+A);if("bool"==A)return new r(e[A]);if("int"==A)return new i(e[A]);if("bitstr"==A)return new a(e[A]);if("octstr"==A)return new s(e[A]);if("null"==A)return new o(e[A]);if("oid"==A)return new u(e[A]);if("enum"==A)return new c(e[A]);if("utf8str"==A)return new l(e[A]);if("numstr"==A)return new h(e[A]);if("prnstr"==A)return new f(e[A]);if("telstr"==A)return new d(e[A]);if("ia5str"==A)return new p(e[A]);if("utctime"==A)return new g(e[A]);if("gentime"==A)return new m(e[A]);if("visstr"==A)return new v(e[A]);if("bmpstr"==A)return new y(e[A]);if("asn1"==A)return new n(e[A]);if("seq"==A){for(var F=e[A],C=[],D=0;D<F.length;D++){var R=S(F[D]);C.push(R)}return new b({array:C})}if("set"==A){for(F=e[A],C=[],D=0;D<F.length;D++){R=S(F[D]);C.push(R)}return new w({array:C})}if("tag"==A){var I=e[A];if("[object Array]"===Object.prototype.toString.call(I)&&3==I.length){var T=S(I[2]);return new x({tag:I[0],explicit:I[1],obj:T})}return new x(I)}},this.jsonToASN1HEX=function(e){return this.newObject(e).getEncodedHex()}},he.asn1.ASN1Util.oidHexToInt=function(e){for(var t="",n=parseInt(e.substr(0,2),16),r=(t=Math.floor(n/40)+"."+n%40,""),i=2;i<e.length;i+=2){var a=("00000000"+parseInt(e.substr(i,2),16).toString(2)).slice(-8);if(r+=a.substr(1,7),"0"==a.substr(0,1))t=t+"."+new S(r,2).toString(10),r=""}return t},he.asn1.ASN1Util.oidIntToHex=function(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},n=function(e){var n="",r=new S(e,10).toString(2),i=7-r.length%7;7==i&&(i=0);for(var a="",s=0;s<i;s++)a+="0";r=a+r;for(s=0;s<r.length-1;s+=7){var o=r.substr(s,7);s!=r.length-7&&(o="1"+o),n+=t(parseInt(o,2))}return n};if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var r="",i=e.split("."),a=40*parseInt(i[0])+parseInt(i[1]);r+=t(a),i.splice(0,2);for(var s=0;s<i.length;s++)r+=n(i[s]);return r},he.asn1.ASN1Object=function(e){this.params=null,this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw new Error("this.hV is null or undefined");if(this.hV.length%2==1)throw new Error("value hex must be even length: n="+"".length+",v="+this.hV);var e=this.hV.length/2,t=e.toString(16);if(t.length%2==1&&(t="0"+t),e<128)return t;var n=t.length/2;if(n>15)throw"ASN.1 length too long to represent by 8x: n = "+e.toString(16);return(128+n).toString(16)+t},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""},this.setByParam=function(e){this.params=e},null!=e&&null!=e.tlv&&(this.hTLV=e.tlv,this.isModified=!1)},he.asn1.DERAbstractString=function(e){he.asn1.DERAbstractString.superclass.constructor.call(this);this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=Ee(this.s).toLowerCase()},this.setStringHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e?this.setString(e):void 0!==e.str?this.setString(e.str):void 0!==e.hex&&this.setStringHex(e.hex))},We(he.asn1.DERAbstractString,he.asn1.ASN1Object),he.asn1.DERAbstractTime=function(e){he.asn1.DERAbstractTime.superclass.constructor.call(this);this.localDateToUTC=function(e){var t=e.getTime()+6e4*e.getTimezoneOffset();return new Date(t)},this.formatDate=function(e,t,n){var r=this.zeroPadding,i=this.localDateToUTC(e),a=String(i.getFullYear());"utc"==t&&(a=a.substr(2,2));var s=a+r(String(i.getMonth()+1),2)+r(String(i.getDate()),2)+r(String(i.getHours()),2)+r(String(i.getMinutes()),2)+r(String(i.getSeconds()),2);if(!0===n){var o=i.getMilliseconds();if(0!=o){var u=r(String(o),3);s=s+"."+(u=u.replace(/[0]+$/,""))}}return s+"Z"},this.zeroPadding=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=ye(e)},this.setByDateValue=function(e,t,n,r,i,a){var s=new Date(Date.UTC(e,t-1,n,r,i,a,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}},We(he.asn1.DERAbstractTime,he.asn1.ASN1Object),he.asn1.DERAbstractStructured=function(e){he.asn1.DERAbstractString.superclass.constructor.call(this);this.setByASN1ObjectArray=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array=e},this.appendASN1Object=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array.push(e)},this.asn1Array=new Array,void 0!==e&&void 0!==e.array&&(this.asn1Array=e.array)},We(he.asn1.DERAbstractStructured,he.asn1.ASN1Object),he.asn1.DERBoolean=function(e){he.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV=0==e?"010100":"0101ff"},We(he.asn1.DERBoolean,he.asn1.ASN1Object),he.asn1.DERInteger=function(e){he.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=he.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new S(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.bigint?this.setByBigInteger(e.bigint):void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},We(he.asn1.DERInteger,he.asn1.ASN1Object),he.asn1.DERBitString=function(e){if(void 0!==e&&void 0!==e.obj){var t=he.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.getEncodedHex()}he.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7<e)throw"unused bits shall be from 0 to 7: u = "+e;var n="0"+e;this.hTLV=null,this.isModified=!0,this.hV=n+t},this.setByBinaryString=function(e){var t=8-(e=e.replace(/0+$/,"")).length%8;8==t&&(t=0);for(var n=0;n<=t;n++)e+="0";var r="";for(n=0;n<e.length-1;n+=8){var i=e.substr(n,8),a=parseInt(i,2).toString(16);1==a.length&&(a="0"+a),r+=a}this.hTLV=null,this.isModified=!0,this.hV="0"+t+r},this.setByBooleanArray=function(e){for(var t="",n=0;n<e.length;n++)1==e[n]?t+="1":t+="0";this.setByBinaryString(t)},this.newFalseArray=function(e){for(var t=new Array(e),n=0;n<e;n++)t[n]=!1;return t},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e&&e.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(e):void 0!==e.hex?this.setHexValueIncludingUnusedBits(e.hex):void 0!==e.bin?this.setByBinaryString(e.bin):void 0!==e.array&&this.setByBooleanArray(e.array))},We(he.asn1.DERBitString,he.asn1.ASN1Object),he.asn1.DEROctetString=function(e){if(void 0!==e&&void 0!==e.obj){var t=he.asn1.ASN1Util.newObject(e.obj);e.hex=t.getEncodedHex()}he.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT="04"},We(he.asn1.DEROctetString,he.asn1.DERAbstractString),he.asn1.DERNull=function(){he.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},We(he.asn1.DERNull,he.asn1.ASN1Object),he.asn1.DERObjectIdentifier=function(e){he.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueOidString=function(e){var t=qe(e);if(null==t)throw new Error("malformed oid string: "+e);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueName=function(e){var t=he.asn1.x509.OID.name2oid(e);if(""===t)throw new Error("DERObjectIdentifier oidName undefined: "+e);this.setValueOidString(t)},this.setValueNameOrOid=function(e){e.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(e):this.setValueName(e)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(e){"string"==typeof e?this.setValueNameOrOid(e):void 0!==e.oid?this.setValueNameOrOid(e.oid):void 0!==e.name?this.setValueNameOrOid(e.name):void 0!==e.hex&&this.setValueHex(e.hex)},void 0!==e&&this.setByParam(e)},We(he.asn1.DERObjectIdentifier,he.asn1.ASN1Object),he.asn1.DEREnumerated=function(e){he.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=he.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new S(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},We(he.asn1.DEREnumerated,he.asn1.ASN1Object),he.asn1.DERUTF8String=function(e){he.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT="0c"},We(he.asn1.DERUTF8String,he.asn1.DERAbstractString),he.asn1.DERNumericString=function(e){he.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT="12"},We(he.asn1.DERNumericString,he.asn1.DERAbstractString),he.asn1.DERPrintableString=function(e){he.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT="13"},We(he.asn1.DERPrintableString,he.asn1.DERAbstractString),he.asn1.DERTeletexString=function(e){he.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT="14"},We(he.asn1.DERTeletexString,he.asn1.DERAbstractString),he.asn1.DERIA5String=function(e){he.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="16"},We(he.asn1.DERIA5String,he.asn1.DERAbstractString),he.asn1.DERVisibleString=function(e){he.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="1a"},We(he.asn1.DERVisibleString,he.asn1.DERAbstractString),he.asn1.DERBMPString=function(e){he.asn1.DERBMPString.superclass.constructor.call(this,e),this.hT="1e"},We(he.asn1.DERBMPString,he.asn1.DERAbstractString),he.asn1.DERUTCTime=function(e){he.asn1.DERUTCTime.superclass.constructor.call(this,e),this.hT="17",this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"utc"),this.hV=ye(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=ye(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{12}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date))},We(he.asn1.DERUTCTime,he.asn1.DERAbstractTime),he.asn1.DERGeneralizedTime=function(e){he.asn1.DERGeneralizedTime.superclass.constructor.call(this,e),this.hT="18",this.withMillis=!1,this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=ye(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=ye(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{14}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date),!0===e.millis&&(this.withMillis=!0))},We(he.asn1.DERGeneralizedTime,he.asn1.DERAbstractTime),he.asn1.DERSequence=function(e){he.asn1.DERSequence.superclass.constructor.call(this,e),this.hT="30",this.getFreshValueHex=function(){for(var e="",t=0;t<this.asn1Array.length;t++){e+=this.asn1Array[t].getEncodedHex()}return this.hV=e,this.hV}},We(he.asn1.DERSequence,he.asn1.DERAbstractStructured),he.asn1.DERSet=function(e){he.asn1.DERSet.superclass.constructor.call(this,e),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var e=new Array,t=0;t<this.asn1Array.length;t++){var n=this.asn1Array[t];e.push(n.getEncodedHex())}return 1==this.sortFlag&&e.sort(),this.hV=e.join(""),this.hV},void 0!==e&&void 0!==e.sortflag&&0==e.sortflag&&(this.sortFlag=!1)},We(he.asn1.DERSet,he.asn1.DERAbstractStructured),he.asn1.DERTaggedObject=function(e){he.asn1.DERTaggedObject.superclass.constructor.call(this);var t=he.asn1;this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(e,t,n){this.hT=t,this.isExplicit=e,this.asn1Object=n,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=n.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,t),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(e){null!=e.tag&&(this.hT=e.tag),null!=e.explicit&&(this.isExplicit=e.explicit),null!=e.tage&&(this.hT=e.tage,this.isExplicit=!0),null!=e.tagi&&(this.hT=e.tagi,this.isExplicit=!1),null!=e.obj&&(e.obj instanceof t.ASN1Object?(this.asn1Object=e.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)):"object"==typeof e.obj&&(this.asn1Object=t.ASN1Util.newObject(e.obj),this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},null!=e&&this.setByParam(e)},We(he.asn1.DERTaggedObject,he.asn1.ASN1Object);var he,fe,de,pe=new function(){};function ge(e){for(var t=new Array,n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function me(e){for(var t="",n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}function ve(e){for(var t="",n=0;n<e.length;n++){var r=e[n].toString(16);1==r.length&&(r="0"+r),t+=r}return t}function ye(e){return ve(ge(e))}function be(e){return e=(e=(e=e.replace(/\=/g,"")).replace(/\+/g,"-")).replace(/\//g,"_")}function we(e){return e.length%4==2?e+="==":e.length%4==3&&(e+="="),e=(e=e.replace(/-/g,"+")).replace(/_/g,"/")}function xe(e){return e.length%2==1&&(e="0"+e),be(b(e))}function Se(e){return w(we(e))}function Ee(e){return ke(Le(e))}function Ae(e){return decodeURIComponent(Oe(e))}function Fe(e){for(var t="",n=0;n<e.length-1;n+=2)t+=String.fromCharCode(parseInt(e.substr(n,2),16));return t}function Ce(e){for(var t="",n=0;n<e.length;n++)t+=("0"+e.charCodeAt(n).toString(16)).slice(-2);return t}function De(e){return b(e)}function Re(e){var t=De(e).replace(/(.{64})/g,"$1\r\n");return t=t.replace(/\r\n$/,"")}function Ie(e){return w(e.replace(/[^0-9A-Za-z\/+=]*/g,""))}function Te(e,t){return"-----BEGIN "+t+"-----\r\n"+Re(e)+"\r\n-----END "+t+"-----\r\n"}function $e(e,t){if(-1==e.indexOf("-----BEGIN "))throw"can't find PEM header: "+t;return Ie(e=void 0!==t?(e=e.replace(new RegExp("^[^]*-----BEGIN "+t+"-----"),"")).replace(new RegExp("-----END "+t+"-----[^]*$"),""):(e=e.replace(/^[^]*-----BEGIN [^-]+-----/,"")).replace(/-----END [^-]+-----[^]*$/,""))}function Pe(e){var t,n,r,i,a,s,o,u,c,l,h;if(h=e.match(/^(\d{2}|\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(|\.\d+)Z$/))return u=h[1],t=parseInt(u),2===u.length&&(50<=t&&t<100?t=1900+t:0<=t&&t<50&&(t=2e3+t)),n=parseInt(h[2])-1,r=parseInt(h[3]),i=parseInt(h[4]),a=parseInt(h[5]),s=parseInt(h[6]),o=0,""!==(c=h[7])&&(l=(c.substr(1)+"00").substr(0,3),o=parseInt(l)),Date.UTC(t,n,r,i,a,s,o);throw"unsupported zulu format: "+e}function _e(e){return~~(Pe(e)/1e3)}function ke(e){return e.replace(/%/g,"")}function Oe(e){return e.replace(/(..)/g,"%$1")}function Be(e){var t="malformed IPv6 address";if(!e.match(/^[0-9A-Fa-f:]+$/))throw t;var n=(e=e.toLowerCase()).split(":").length-1;if(n<2)throw t;var r=":".repeat(7-n+2),i=(e=e.replace("::",r)).split(":");if(8!=i.length)throw t;for(var a=0;a<8;a++)i[a]=("0000"+i[a]).slice(-4);return i.join("")}function je(e){if(!e.match(/^[0-9A-Fa-f]{32}$/))throw"malformed IPv6 address octet";for(var t=(e=e.toLowerCase()).match(/.{1,4}/g),n=0;n<8;n++)t[n]=t[n].replace(/^0+/,""),""==t[n]&&(t[n]="0");var r=(e=":"+t.join(":")+":").match(/:(0:){2,}/g);if(null===r)return e.slice(1,-1);var i="";for(n=0;n<r.length;n++)r[n].length>i.length&&(i=r[n]);return(e=e.replace(i,"::")).slice(1,-1)}function He(e){var t="malformed hex value";if(!e.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw t;if(8!=e.length)return 32==e.length?je(e):e;try{return parseInt(e.substr(0,2),16)+"."+parseInt(e.substr(2,2),16)+"."+parseInt(e.substr(4,2),16)+"."+parseInt(e.substr(6,2),16)}catch(e){throw t}}function Ne(e){return e.match(/.{4}/g).map((function(e){var t=parseInt(e.substr(0,2),16),n=parseInt(e.substr(2),16);if(0==t&n<128)return String.fromCharCode(n);if(t<8){var r=128|63&n;return Ae((192|(7&t)<<3|(192&n)>>6).toString(16)+r.toString(16))}r=128|(15&t)<<2|(192&n)>>6;var i=128|63&n;return Ae((224|(240&t)>>4).toString(16)+r.toString(16)+i.toString(16))})).join("")}function Le(e){for(var t=encodeURIComponent(e),n="",r=0;r<t.length;r++)"%"==t[r]?(n+=t.substr(r,3),r+=2):n=n+"%"+ye(t[r]);return n}function Me(e){return!(e.length%2!=0||!e.match(/^[0-9a-f]+$/)&&!e.match(/^[0-9A-F]+$/))}function Ue(e){return e.length%2==1?"0"+e:e.substr(0,1)>"7"?"00"+e:e}function Ve(e){e=(e=(e=e.replace(/^\s*\[\s*/,"")).replace(/\s*\]\s*$/,"")).replace(/\s*/g,"");try{return e.split(/,/).map((function(e,t,n){var r=parseInt(e);if(r<0||255<r)throw"integer not in range 0-255";return("00"+r.toString(16)).slice(-2)})).join("")}catch(e){throw"malformed integer array string: "+e}}pe.getLblen=function(e,t){if("8"!=e.substr(t+2,1))return 1;var n=parseInt(e.substr(t+3,1));return 0==n?-1:0<n&&n<10?n+1:-2},pe.getL=function(e,t){var n=pe.getLblen(e,t);return n<1?"":e.substr(t+2,2*n)},pe.getVblen=function(e,t){var n;return""==(n=pe.getL(e,t))?-1:("8"===n.substr(0,1)?new S(n.substr(2),16):new S(n,16)).intValue()},pe.getVidx=function(e,t){var n=pe.getLblen(e,t);return n<0?n:t+2*(n+1)},pe.getV=function(e,t){var n=pe.getVidx(e,t),r=pe.getVblen(e,t);return e.substr(n,2*r)},pe.getTLV=function(e,t){return e.substr(t,2)+pe.getL(e,t)+pe.getV(e,t)},pe.getTLVblen=function(e,t){return 2+2*pe.getLblen(e,t)+2*pe.getVblen(e,t)},pe.getNextSiblingIdx=function(e,t){return pe.getVidx(e,t)+2*pe.getVblen(e,t)},pe.getChildIdx=function(e,t){var n,r,i,a=pe,s=[];n=a.getVidx(e,t),r=2*a.getVblen(e,t),"03"==e.substr(t,2)&&(n+=2,r-=2),i=0;for(var o=n;i<=r;){var u=a.getTLVblen(e,o);if((i+=u)<=r&&s.push(o),o+=u,i>=r)break}return s},pe.getNthChildIdx=function(e,t,n){return pe.getChildIdx(e,t)[n]},pe.getIdxbyList=function(e,t,n,r){var i,a,s=pe;return 0==n.length?void 0!==r&&e.substr(t,2)!==r?-1:t:(i=n.shift())>=(a=s.getChildIdx(e,t)).length?-1:s.getIdxbyList(e,a[i],n,r)},pe.getIdxbyListEx=function(e,t,n,r){var i,a,s=pe;if(0==n.length)return void 0!==r&&e.substr(t,2)!==r?-1:t;i=n.shift(),a=s.getChildIdx(e,t);for(var o=0,u=0;u<a.length;u++){var c=e.substr(a[u],2);if("number"==typeof i&&!s.isContextTag(c)&&o==i||"string"==typeof i&&s.isContextTag(c,i))return s.getIdxbyListEx(e,a[u],n,r);s.isContextTag(c)||o++}return-1},pe.getTLVbyList=function(e,t,n,r){var i=pe,a=i.getIdxbyList(e,t,n,r);return-1==a?null:a>=e.length?null:i.getTLV(e,a)},pe.getTLVbyListEx=function(e,t,n,r){var i=pe,a=i.getIdxbyListEx(e,t,n,r);return-1==a?null:i.getTLV(e,a)},pe.getVbyList=function(e,t,n,r,i){var a,s,o=pe;return-1==(a=o.getIdxbyList(e,t,n,r))?null:a>=e.length?null:(s=o.getV(e,a),!0===i&&(s=s.substr(2)),s)},pe.getVbyListEx=function(e,t,n,r,i){var a,s,o=pe;return-1==(a=o.getIdxbyListEx(e,t,n,r))?null:(s=o.getV(e,a),"03"==e.substr(a,2)&&!1!==i&&(s=s.substr(2)),s)},pe.getInt=function(e,t,n){null==n&&(n=-1);try{var r=e.substr(t,2);if("02"!=r&&"03"!=r)return n;var i=pe.getV(e,t);return"02"==r?parseInt(i,16):Ge(i)}catch(e){return n}},pe.getOID=function(e,t,n){null==n&&(n=null);try{return"06"!=e.substr(t,2)?n:Ke(pe.getV(e,t))}catch(e){return n}},pe.getOIDName=function(e,t,n){null==n&&(n=null);try{var r=pe.getOID(e,t,n);if(r==n)return n;var i=he.asn1.x509.OID.oid2name(r);return""==i?r:i}catch(e){return n}},pe.getString=function(e,t,n){null==n&&(n=null);try{return Fe(pe.getV(e,t))}catch(e){return n}},pe.hextooidstr=function(e){var t=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},n=[],r=e.substr(0,2),i=parseInt(r,16);n[0]=new String(Math.floor(i/40)),n[1]=new String(i%40);for(var a=e.substr(2),s=[],o=0;o<a.length/2;o++)s.push(parseInt(a.substr(2*o,2),16));var u=[],c="";for(o=0;o<s.length;o++)128&s[o]?c+=t((127&s[o]).toString(2),7):(c+=t((127&s[o]).toString(2),7),u.push(new String(parseInt(c,2))),c="");var l=n.join(".");return u.length>0&&(l=l+"."+u.join(".")),l},pe.dump=function(e,t,n,r){var i=pe,a=i.getV,s=i.dump,o=i.getChildIdx,u=e;e instanceof he.asn1.ASN1Object&&(u=e.getEncodedHex());var c=function(e,t){return e.length<=2*t?e:e.substr(0,t)+"..(total "+e.length/2+"bytes).."+e.substr(e.length-t,t)};void 0===t&&(t={ommit_long_octet:32}),void 0===n&&(n=0),void 0===r&&(r="");var l,h=t.ommit_long_octet;if("01"==(l=u.substr(n,2)))return"00"==(f=a(u,n))?r+"BOOLEAN FALSE\n":r+"BOOLEAN TRUE\n";if("02"==l)return r+"INTEGER "+c(f=a(u,n),h)+"\n";if("03"==l){var f=a(u,n);if(i.isASN1HEX(f.substr(2))){var d=r+"BITSTRING, encapsulates\n";return d+=s(f.substr(2),t,0,r+" ")}return r+"BITSTRING "+c(f,h)+"\n"}if("04"==l){f=a(u,n);if(i.isASN1HEX(f)){d=r+"OCTETSTRING, encapsulates\n";return d+=s(f,t,0,r+" ")}return r+"OCTETSTRING "+c(f,h)+"\n"}if("05"==l)return r+"NULL\n";if("06"==l){var p=a(u,n),g=he.asn1.ASN1Util.oidHexToInt(p),m=he.asn1.x509.OID.oid2name(g),v=g.replace(/\./g," ");return""!=m?r+"ObjectIdentifier "+m+" ("+v+")\n":r+"ObjectIdentifier ("+v+")\n"}if("0a"==l)return r+"ENUMERATED "+parseInt(a(u,n))+"\n";if("0c"==l)return r+"UTF8String '"+Ae(a(u,n))+"'\n";if("13"==l)return r+"PrintableString '"+Ae(a(u,n))+"'\n";if("14"==l)return r+"TeletexString '"+Ae(a(u,n))+"'\n";if("16"==l)return r+"IA5String '"+Ae(a(u,n))+"'\n";if("17"==l)return r+"UTCTime "+Ae(a(u,n))+"\n";if("18"==l)return r+"GeneralizedTime "+Ae(a(u,n))+"\n";if("1a"==l)return r+"VisualString '"+Ae(a(u,n))+"'\n";if("1e"==l)return r+"BMPString '"+Ne(a(u,n))+"'\n";if("30"==l){if("3000"==u.substr(n,4))return r+"SEQUENCE {}\n";d=r+"SEQUENCE\n";var y=t;if((2==(x=o(u,n)).length||3==x.length)&&"06"==u.substr(x[0],2)&&"04"==u.substr(x[x.length-1],2)){m=i.oidname(a(u,x[0]));var b=JSON.parse(JSON.stringify(t));b.x509ExtName=m,y=b}for(var w=0;w<x.length;w++)d+=s(u,y,x[w],r+" ");return d}if("31"==l){d=r+"SET\n";var x=o(u,n);for(w=0;w<x.length;w++)d+=s(u,t,x[w],r+" ");return d}if(0!=(128&(l=parseInt(l,16)))){var S=31&l;if(0!=(32&l)){for(d=r+"["+S+"]\n",x=o(u,n),w=0;w<x.length;w++)d+=s(u,t,x[w],r+" ");return d}f=a(u,n);if(pe.isASN1HEX(f)){var d=r+"["+S+"]\n";return d+=s(f,t,0,r+" ")}return"68747470"==f.substr(0,8)?f=Ae(f):"subjectAltName"===t.x509ExtName&&2==S&&(f=Ae(f)),d=r+"["+S+"] "+f+"\n"}return r+"UNKNOWN("+l+") "+a(u,n)+"\n"},pe.isContextTag=function(e,t){var n,r;e=e.toLowerCase();try{n=parseInt(e,16)}catch(e){return-1}if(void 0===t)return 128==(192&n);try{return null!=t.match(/^\[[0-9]+\]$/)&&(!((r=parseInt(t.substr(1,t.length-1),10))>31)&&(128==(192&n)&&(31&n)==r))}catch(e){return!1}},pe.isASN1HEX=function(e){var t=pe;if(e.length%2==1)return!1;var n=t.getVblen(e,0),r=e.substr(0,2),i=t.getL(e,0);return e.length-r.length-i.length==2*n},pe.checkStrictDER=function(e,t,n,r,i){var a=pe;if(void 0===n){if("string"!=typeof e)throw new Error("not hex string");if(e=e.toLowerCase(),!he.lang.String.isHex(e))throw new Error("not hex string");n=e.length,i=(r=e.length/2)<128?1:Math.ceil(r.toString(16))+1}if(a.getL(e,t).length>2*i)throw new Error("L of TLV too long: idx="+t);var s=a.getVblen(e,t);if(s>r)throw new Error("value of L too long than hex: idx="+t);var o=a.getTLV(e,t),u=o.length-2-a.getL(e,t).length;if(u!==2*s)throw new Error("V string length and L's value not the same:"+u+"/"+2*s);if(0===t&&e.length!=o.length)throw new Error("total length and TLV length unmatch:"+e.length+"!="+o.length);var c=e.substr(t,2);if("02"===c){var l=a.getVidx(e,t);if("00"==e.substr(l,2)&&e.charCodeAt(l+2)<56)throw new Error("not least zeros for DER INTEGER")}if(32&parseInt(c,16)){for(var h=a.getVblen(e,t),f=0,d=a.getChildIdx(e,t),p=0;p<d.length;p++){f+=a.getTLV(e,d[p]).length,a.checkStrictDER(e,d[p],n,r,i)}if(2*h!=f)throw new Error("sum of children's TLV length and L unmatch: "+2*h+"!="+f)}},pe.oidname=function(e){var t=he.asn1;he.lang.String.isHex(e)&&(e=t.ASN1Util.oidHexToInt(e));var n=t.x509.OID.oid2name(e);return""===n&&(n=e),n},void 0!==he&&he||(he={}),void 0!==he.asn1&&he.asn1||(he.asn1={}),void 0!==he.asn1.x509&&he.asn1.x509||(he.asn1.x509={}),he.asn1.x509.Certificate=function(e){he.asn1.x509.Certificate.superclass.constructor.call(this);var t=he.asn1,n=t.DERBitString,r=t.DERSequence,i=t.x509,a=i.TBSCertificate,s=i.AlgorithmIdentifier;this.params=void 0,this.setByParam=function(e){this.params=e},this.sign=function(){var e=this.params,t=e.sigalg;null!=e.sigalg.name&&(t=e.sigalg.name);var n=e.tbsobj.getEncodedHex(),r=new he.crypto.Signature({alg:t});r.init(e.cakey),r.updateHex(n),e.sighex=r.sign()},this.getPEM=function(){return Te(this.getEncodedHex(),"CERTIFICATE")},this.getEncodedHex=function(){var e=this.params;if(null!=e.tbsobj&&null!=e.tbsobj||(e.tbsobj=new a(e)),null==e.sighex&&null!=e.cakey&&this.sign(),null==e.sighex)throw new Error("sighex or cakey parameter not defined");var t=[];return t.push(e.tbsobj),t.push(new s({name:e.sigalg})),t.push(new n({hex:"00"+e.sighex})),new r({array:t}).getEncodedHex()},null!=e&&(this.params=e)},We(he.asn1.x509.Certificate,he.asn1.ASN1Object),he.asn1.x509.TBSCertificate=function(e){he.asn1.x509.TBSCertificate.superclass.constructor.call(this);var t=he.asn1,n=t.x509,r=t.DERTaggedObject,i=t.DERInteger,a=t.DERSequence,s=n.AlgorithmIdentifier,o=n.Time,u=n.X500Name,c=n.Extensions,l=n.SubjectPublicKeyInfo;this.params=null,this.setByParam=function(e){this.params=e},this.getEncodedHex=function(){var e=[],t=this.params;if(null!=t.version||1!=t.version){var n=2;null!=t.version&&(n=t.version-1);var h=new r({obj:new i({int:n})});e.push(h)}return e.push(new i(t.serial)),e.push(new s({name:t.sigalg})),e.push(new u(t.issuer)),e.push(new a({array:[new o(t.notbefore),new o(t.notafter)]})),e.push(new u(t.subject)),e.push(new l(Ye.getKey(t.sbjpubkey))),void 0!==t.ext&&t.ext.length>0&&e.push(new r({tag:"a3",obj:new c(t.ext)})),new he.asn1.DERSequence({array:e}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.x509.TBSCertificate,he.asn1.ASN1Object),he.asn1.x509.Extensions=function(e){he.asn1.x509.Extensions.superclass.constructor.call(this);var t=he.asn1,n=t.DERSequence,r=t.x509;this.aParam=[],this.setByParam=function(e){this.aParam=e},this.getEncodedHex=function(){for(var e=[],t=0;t<this.aParam.length;t++){var i=this.aParam[t],a=i.extname,s=null;if(null!=i.extn)s=new r.PrivateExtension(i);else if("subjectKeyIdentifier"==a)s=new r.SubjectKeyIdentifier(i);else if("keyUsage"==a)s=new r.KeyUsage(i);else if("subjectAltName"==a)s=new r.SubjectAltName(i);else if("issuerAltName"==a)s=new r.IssuerAltName(i);else if("basicConstraints"==a)s=new r.BasicConstraints(i);else if("cRLDistributionPoints"==a)s=new r.CRLDistributionPoints(i);else if("certificatePolicies"==a)s=new r.CertificatePolicies(i);else if("authorityKeyIdentifier"==a)s=new r.AuthorityKeyIdentifier(i);else if("extKeyUsage"==a)s=new r.ExtKeyUsage(i);else if("authorityInfoAccess"==a)s=new r.AuthorityInfoAccess(i);else if("cRLNumber"==a)s=new r.CRLNumber(i);else if("cRLReason"==a)s=new r.CRLReason(i);else if("ocspNonce"==a)s=new r.OCSPNonce(i);else if("ocspNoCheck"==a)s=new r.OCSPNoCheck(i);else if("adobeTimeStamp"==a)s=new r.AdobeTimeStamp(i);else{if("subjectDirectoryAttributes"!=a)throw new Error("extension not supported:"+JSON.stringify(i));s=new r.SubjectDirectoryAttributes(i)}null!=s&&e.push(s)}return new n({array:e}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.x509.Extensions,he.asn1.ASN1Object),he.asn1.x509.Extension=function(e){he.asn1.x509.Extension.superclass.constructor.call(this);var t=he.asn1,n=t.DERObjectIdentifier,r=t.DEROctetString,i=(t.DERBitString,t.DERBoolean),a=t.DERSequence;this.getEncodedHex=function(){var e=new n({oid:this.oid}),t=new r({hex:this.getExtnValueHex()}),s=new Array;return s.push(e),this.critical&&s.push(new i),s.push(t),new a({array:s}).getEncodedHex()},this.critical=!1,void 0!==e&&void 0!==e.critical&&(this.critical=e.critical)},We(he.asn1.x509.Extension,he.asn1.ASN1Object),he.asn1.x509.KeyUsage=function(e){he.asn1.x509.KeyUsage.superclass.constructor.call(this,e);var t=Ze.KEYUSAGE_NAME;if(this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.15",void 0!==e&&(void 0!==e.bin&&(this.asn1ExtnValue=new he.asn1.DERBitString(e)),void 0!==e.names&&void 0!==e.names.length)){for(var n=e.names,r="000000000",i=0;i<n.length;i++)for(var a=0;a<t.length;a++)n[i]===t[a]&&(r=r.substring(0,a)+"1"+r.substring(a+1,r.length));this.asn1ExtnValue=new he.asn1.DERBitString({bin:r})}},We(he.asn1.x509.KeyUsage,he.asn1.x509.Extension),he.asn1.x509.BasicConstraints=function(e){he.asn1.x509.BasicConstraints.superclass.constructor.call(this,e);var t=he.asn1,n=t.DERBoolean,r=t.DERInteger,i=t.DERSequence;this.getExtnValueHex=function(){var e=new Array;this.cA&&e.push(new n),this.pathLen>-1&&e.push(new r({int:this.pathLen}));var t=new i({array:e});return this.asn1ExtnValue=t,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.19",this.cA=!1,this.pathLen=-1,void 0!==e&&(void 0!==e.cA&&(this.cA=e.cA),void 0!==e.pathLen&&(this.pathLen=e.pathLen))},We(he.asn1.x509.BasicConstraints,he.asn1.x509.Extension),he.asn1.x509.CRLDistributionPoints=function(e){he.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,e);var t=he.asn1,n=t.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.setByDPArray=function(e){for(var r=[],i=0;i<e.length;i++)if(e[i]instanceof he.asn1.ASN1Object)r.push(e[i]);else{var a=new n.DistributionPoint(e[i]);r.push(a)}this.asn1ExtnValue=new t.DERSequence({array:r})},this.setByOneURI=function(e){var t=new n.DistributionPoint({fulluri:e});this.setByDPArray([t])},this.oid="2.5.29.31",void 0!==e&&(void 0!==e.array?this.setByDPArray(e.array):void 0!==e.uri&&this.setByOneURI(e.uri))},We(he.asn1.x509.CRLDistributionPoints,he.asn1.x509.Extension),he.asn1.x509.DistributionPoint=function(e){he.asn1.x509.DistributionPoint.superclass.constructor.call(this);var t=he.asn1,n=t.x509.DistributionPointName;this.getEncodedHex=function(){var e=new t.DERSequence;if(null!=this.asn1DP){var n=new t.DERTaggedObject({explicit:!0,tag:"a0",obj:this.asn1DP});e.appendASN1Object(n)}return this.hTLV=e.getEncodedHex(),this.hTLV},void 0!==e&&(void 0!==e.dpobj?this.asn1DP=e.dpobj:void 0!==e.dpname?this.asn1DP=new n(e.dpname):void 0!==e.fulluri&&(this.asn1DP=new n({full:[{uri:e.fulluri}]})))},We(he.asn1.x509.DistributionPoint,he.asn1.ASN1Object),he.asn1.x509.DistributionPointName=function(e){he.asn1.x509.DistributionPointName.superclass.constructor.call(this);var t=he.asn1,n=t.DERTaggedObject;if(this.getEncodedHex=function(){if("full"!=this.type)throw new Error("currently type shall be 'full': "+this.type);return this.asn1Obj=new n({explicit:!1,tag:this.tag,obj:this.asn1V}),this.hTLV=this.asn1Obj.getEncodedHex(),this.hTLV},void 0!==e)if(t.x509.GeneralNames.prototype.isPrototypeOf(e))this.type="full",this.tag="a0",this.asn1V=e;else{if(void 0===e.full)throw new Error("This class supports GeneralNames only as argument");this.type="full",this.tag="a0",this.asn1V=new t.x509.GeneralNames(e.full)}},We(he.asn1.x509.DistributionPointName,he.asn1.ASN1Object),he.asn1.x509.CertificatePolicies=function(e){he.asn1.x509.CertificatePolicies.superclass.constructor.call(this,e);var t=he.asn1,n=t.x509,r=t.DERSequence,i=n.PolicyInformation;this.params=null,this.getExtnValueHex=function(){for(var e=[],t=0;t<this.params.array.length;t++)e.push(new i(this.params.array[t]));var n=new r({array:e});return this.asn1ExtnValue=n,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.32",void 0!==e&&(this.params=e)},We(he.asn1.x509.CertificatePolicies,he.asn1.x509.Extension),he.asn1.x509.PolicyInformation=function(e){he.asn1.x509.PolicyInformation.superclass.constructor.call(this,e);var t=he.asn1,n=t.DERSequence,r=t.DERObjectIdentifier,i=t.x509.PolicyQualifierInfo;this.params=null,this.getEncodedHex=function(){if(void 0===this.params.policyoid&&void 0===this.params.array)throw new Error("parameter oid and array missing");var e=[new r(this.params.policyoid)];if(void 0!==this.params.array){for(var t=[],a=0;a<this.params.array.length;a++)t.push(new i(this.params.array[a]));t.length>0&&e.push(new n({array:t}))}return new n({array:e}).getEncodedHex()},void 0!==e&&(this.params=e)},We(he.asn1.x509.PolicyInformation,he.asn1.ASN1Object),he.asn1.x509.PolicyQualifierInfo=function(e){he.asn1.x509.PolicyQualifierInfo.superclass.constructor.call(this,e);var t=he.asn1,n=t.DERSequence,r=t.DERIA5String,i=t.DERObjectIdentifier,a=t.x509.UserNotice;this.params=null,this.getEncodedHex=function(){return void 0!==this.params.cps?new n({array:[new i({oid:"1.3.6.1.5.5.7.2.1"}),new r({str:this.params.cps})]}).getEncodedHex():null!=this.params.unotice?new n({array:[new i({oid:"1.3.6.1.5.5.7.2.2"}),new a(this.params.unotice)]}).getEncodedHex():void 0},void 0!==e&&(this.params=e)},We(he.asn1.x509.PolicyQualifierInfo,he.asn1.ASN1Object),he.asn1.x509.UserNotice=function(e){he.asn1.x509.UserNotice.superclass.constructor.call(this,e);var t=he.asn1.DERSequence,n=(he.asn1.DERInteger,he.asn1.x509.DisplayText),r=he.asn1.x509.NoticeReference;this.params=null,this.getEncodedHex=function(){var e=[];return void 0!==this.params.noticeref&&e.push(new r(this.params.noticeref)),void 0!==this.params.exptext&&e.push(new n(this.params.exptext)),new t({array:e}).getEncodedHex()},void 0!==e&&(this.params=e)},We(he.asn1.x509.UserNotice,he.asn1.ASN1Object),he.asn1.x509.NoticeReference=function(e){he.asn1.x509.NoticeReference.superclass.constructor.call(this,e);var t=he.asn1.DERSequence,n=he.asn1.DERInteger,r=he.asn1.x509.DisplayText;this.params=null,this.getEncodedHex=function(){var e=[];if(void 0!==this.params.org&&e.push(new r(this.params.org)),void 0!==this.params.noticenum){for(var i=[],a=this.params.noticenum,s=0;s<a.length;s++)i.push(new n(a[s]));e.push(new t({array:i}))}if(0==e.length)throw new Error("parameter is empty");return new t({array:e}).getEncodedHex()},void 0!==e&&(this.params=e)},We(he.asn1.x509.NoticeReference,he.asn1.ASN1Object),he.asn1.x509.DisplayText=function(e){he.asn1.x509.DisplayText.superclass.constructor.call(this,e),this.hT="0c",void 0!==e&&("ia5"===e.type?this.hT="16":"vis"===e.type?this.hT="1a":"bmp"===e.type&&(this.hT="1e"))},We(he.asn1.x509.DisplayText,he.asn1.DERAbstractString),he.asn1.x509.ExtKeyUsage=function(e){he.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,e);var t=he.asn1;this.setPurposeArray=function(e){this.asn1ExtnValue=new t.DERSequence;for(var n=0;n<e.length;n++){var r=new t.DERObjectIdentifier(e[n]);this.asn1ExtnValue.appendASN1Object(r)}},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.37",void 0!==e&&void 0!==e.array&&this.setPurposeArray(e.array)},We(he.asn1.x509.ExtKeyUsage,he.asn1.x509.Extension),he.asn1.x509.AuthorityKeyIdentifier=function(e){he.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this,e);var t=he,n=t.asn1,r=n.DERTaggedObject,i=n.x509.GeneralNames;t.crypto.Util.isKey;this.asn1KID=null,this.asn1CertIssuer=null,this.asn1CertSN=null,this.getExtnValueHex=function(){var e=new Array;this.asn1KID&&e.push(new r({explicit:!1,tag:"80",obj:this.asn1KID})),this.asn1CertIssuer&&e.push(new r({explicit:!1,tag:"a1",obj:new i([{dn:this.asn1CertIssuer}])})),this.asn1CertSN&&e.push(new r({explicit:!1,tag:"82",obj:this.asn1CertSN}));var t=new n.DERSequence({array:e});return this.asn1ExtnValue=t,this.asn1ExtnValue.getEncodedHex()},this.setKIDByParam=function(e){if(void 0!==e.str||void 0!==e.hex)this.asn1KID=new he.asn1.DEROctetString(e);else if("object"==typeof e&&he.crypto.Util.isKey(e)||"string"==typeof e&&-1!=e.indexOf("BEGIN ")){var t=e;"string"==typeof e&&(t=Ye.getKey(e));var n=Ye.getKeyID(t);this.asn1KID=new he.asn1.DEROctetString({hex:n})}},this.setCertIssuerByParam=function(e){void 0!==e.str||void 0!==e.ldapstr||void 0!==e.hex||void 0!==e.certsubject||void 0!==e.certissuer?this.asn1CertIssuer=new he.asn1.x509.X500Name(e):"string"==typeof e&&-1!=e.indexOf("BEGIN ")&&-1!=e.indexOf("CERTIFICATE")&&(this.asn1CertIssuer=new he.asn1.x509.X500Name({certissuer:e}))},this.setCertSNByParam=function(e){if(void 0!==e.str||void 0!==e.bigint||void 0!==e.hex)this.asn1CertSN=new he.asn1.DERInteger(e);else if("string"==typeof e&&-1!=e.indexOf("BEGIN ")&&e.indexOf("CERTIFICATE")){var t=new Ze;t.readCertPEM(e);var n=t.getSerialNumberHex();this.asn1CertSN=new he.asn1.DERInteger({hex:n})}},this.oid="2.5.29.35",void 0!==e&&(void 0!==e.kid&&this.setKIDByParam(e.kid),void 0!==e.issuer&&this.setCertIssuerByParam(e.issuer),void 0!==e.sn&&this.setCertSNByParam(e.sn),void 0!==e.issuersn&&"string"==typeof e.issuersn&&-1!=e.issuersn.indexOf("BEGIN ")&&e.issuersn.indexOf("CERTIFICATE")&&(this.setCertSNByParam(e.issuersn),this.setCertIssuerByParam(e.issuersn)))},We(he.asn1.x509.AuthorityKeyIdentifier,he.asn1.x509.Extension),he.asn1.x509.SubjectKeyIdentifier=function(e){he.asn1.x509.SubjectKeyIdentifier.superclass.constructor.call(this,e);var t=he.asn1.DEROctetString;this.asn1KID=null,this.getExtnValueHex=function(){return this.asn1ExtnValue=this.asn1KID,this.asn1ExtnValue.getEncodedHex()},this.setKIDByParam=function(e){if(void 0!==e.str||void 0!==e.hex)this.asn1KID=new t(e);else if("object"==typeof e&&he.crypto.Util.isKey(e)||"string"==typeof e&&-1!=e.indexOf("BEGIN")){var n=e;"string"==typeof e&&(n=Ye.getKey(e));var r=Ye.getKeyID(n);this.asn1KID=new he.asn1.DEROctetString({hex:r})}},this.oid="2.5.29.14",void 0!==e&&void 0!==e.kid&&this.setKIDByParam(e.kid)},We(he.asn1.x509.SubjectKeyIdentifier,he.asn1.x509.Extension),he.asn1.x509.AuthorityInfoAccess=function(e){he.asn1.x509.AuthorityInfoAccess.superclass.constructor.call(this,e),this.setAccessDescriptionArray=function(e){for(var t=new Array,n=he.asn1,r=n.DERSequence,i=n.DERObjectIdentifier,a=n.x509.GeneralName,s=0;s<e.length;s++){var o,u=e[s];if(void 0!==u.ocsp)o=new r({array:[new i({oid:"1.3.6.1.5.5.7.48.1"}),new a({uri:u.ocsp})]});else{if(void 0===u.caissuer)throw new Error("unknown AccessMethod parameter: "+JSON.stringify(u));o=new r({array:[new i({oid:"1.3.6.1.5.5.7.48.2"}),new a({uri:u.caissuer})]})}t.push(o)}this.asn1ExtnValue=new r({array:t})},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.1.1",void 0!==e&&void 0!==e.array&&this.setAccessDescriptionArray(e.array)},We(he.asn1.x509.AuthorityInfoAccess,he.asn1.x509.Extension),he.asn1.x509.SubjectAltName=function(e){he.asn1.x509.SubjectAltName.superclass.constructor.call(this,e),this.setNameArray=function(e){this.asn1ExtnValue=new he.asn1.x509.GeneralNames(e)},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.17",void 0!==e&&void 0!==e.array&&this.setNameArray(e.array)},We(he.asn1.x509.SubjectAltName,he.asn1.x509.Extension),he.asn1.x509.IssuerAltName=function(e){he.asn1.x509.IssuerAltName.superclass.constructor.call(this,e),this.setNameArray=function(e){this.asn1ExtnValue=new he.asn1.x509.GeneralNames(e)},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.18",void 0!==e&&void 0!==e.array&&this.setNameArray(e.array)},We(he.asn1.x509.IssuerAltName,he.asn1.x509.Extension),he.asn1.x509.SubjectDirectoryAttributes=function(e){he.asn1.x509.SubjectDirectoryAttributes.superclass.constructor.call(this,e);var t=he.asn1,n=t.DERSequence,r=t.ASN1Util.newObject,i=t.x509.OID.name2oid;this.params=null,this.getExtnValueHex=function(){for(var e=[],t=0;t<this.params.array.length;t++){var a=this.params.array[t],s={seq:[{oid:"1.2.3.4"},{set:[{utf8str:"DE"}]}]};if("dateOfBirth"==a.attr)s.seq[0].oid=i(a.attr),s.seq[1].set[0]={gentime:a.str};else if("placeOfBirth"==a.attr)s.seq[0].oid=i(a.attr),s.seq[1].set[0]={utf8str:a.str};else if("gender"==a.attr)s.seq[0].oid=i(a.attr),s.seq[1].set[0]={prnstr:a.str};else if("countryOfCitizenship"==a.attr)s.seq[0].oid=i(a.attr),s.seq[1].set[0]={prnstr:a.str};else{if("countryOfResidence"!=a.attr)throw new Error("unsupported attribute: "+a.attr);s.seq[0].oid=i(a.attr),s.seq[1].set[0]={prnstr:a.str}}e.push(new r(s))}var o=new n({array:e});return this.asn1ExtnValue=o,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.9",void 0!==e&&(this.params=e)},We(he.asn1.x509.SubjectDirectoryAttributes,he.asn1.x509.Extension),he.asn1.x509.PrivateExtension=function(e){he.asn1.x509.PrivateExtension.superclass.constructor.call(this,e);var t=he,n=t.lang.String.isHex,r=t.asn1,i=r.x509.OID.name2oid,a=r.ASN1Util.newObject;this.params=null,this.setByParam=function(e){this.oid=i(e.extname),this.params=e},this.getExtnValueHex=function(){if(null==this.params.extname||null==this.params.extn)throw new Error("extname or extnhex not specified");var e=this.params.extn;if("string"==typeof e&&n(e))return e;if("object"==typeof e)try{return a(e).getEncodedHex()}catch(e){}throw new Error("unsupported extn value")},null!=e&&this.setByParam(e)},We(he.asn1.x509.PrivateExtension,he.asn1.x509.Extension),he.asn1.x509.CRL=function(e){he.asn1.x509.CRL.superclass.constructor.call(this);var t=he.asn1,n=t.DERSequence,r=t.DERBitString,i=t.x509,a=i.AlgorithmIdentifier,s=i.TBSCertList;this.params=void 0,this.setByParam=function(e){this.params=e},this.sign=function(){var e=new s(this.params).getEncodedHex(),t=new he.crypto.Signature({alg:this.params.sigalg});t.init(this.params.cakey),t.updateHex(e);var n=t.sign();this.params.sighex=n},this.getPEM=function(){return Te(this.getEncodedHex(),"X509 CRL")},this.getEncodedHex=function(){var e=this.params;if(null==e.tbsobj&&(e.tbsobj=new s(e)),null==e.sighex&&null!=e.cakey&&this.sign(),null==e.sighex)throw new Error("sighex or cakey parameter not defined");var t=[];return t.push(e.tbsobj),t.push(new a({name:e.sigalg})),t.push(new r({hex:"00"+e.sighex})),new n({array:t}).getEncodedHex()},null!=e&&(this.params=e)},We(he.asn1.x509.CRL,he.asn1.ASN1Object),he.asn1.x509.TBSCertList=function(e){he.asn1.x509.TBSCertList.superclass.constructor.call(this);var t=he.asn1,n=t.DERInteger,r=t.DERSequence,i=t.DERTaggedObject,a=(t.DERObjectIdentifier,t.x509),s=a.AlgorithmIdentifier,o=a.Time,u=a.Extensions,c=a.X500Name;this.params=null,this.setByParam=function(e){this.params=e},this.getRevCertSequence=function(){for(var e=[],t=this.params.revcert,i=0;i<t.length;i++){var a=[new n(t[i].sn),new o(t[i].date)];null!=t[i].ext&&a.push(new u(t[i].ext)),e.push(new r({array:a}))}return new r({array:e})},this.getEncodedHex=function(){var e=[],t=this.params;if(null!=t.version){var a=t.version-1,l=new n({int:a});e.push(l)}if(e.push(new s({name:t.sigalg})),e.push(new c(t.issuer)),e.push(new o(t.thisupdate)),null!=t.nextupdate&&e.push(new o(t.nextupdate)),null!=t.revcert&&e.push(this.getRevCertSequence()),null!=t.ext){var h=new u(t.ext);e.push(new i({tag:"a0",explicit:!0,obj:h}))}return new r({array:e}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.x509.TBSCertList,he.asn1.ASN1Object),he.asn1.x509.CRLEntry=function(e){he.asn1.x509.CRLEntry.superclass.constructor.call(this);var t=he.asn1;this.setCertSerial=function(e){this.sn=new t.DERInteger(e)},this.setRevocationDate=function(e){this.time=new t.x509.Time(e)},this.getEncodedHex=function(){var e=new t.DERSequence({array:[this.sn,this.time]});return this.TLV=e.getEncodedHex(),this.TLV},void 0!==e&&(void 0!==e.time&&this.setRevocationDate(e.time),void 0!==e.sn&&this.setCertSerial(e.sn))},We(he.asn1.x509.CRLEntry,he.asn1.ASN1Object),he.asn1.x509.CRLNumber=function(e){he.asn1.x509.CRLNumber.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new he.asn1.DERInteger(this.params.num),this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.20",null!=e&&(this.params=e)},We(he.asn1.x509.CRLNumber,he.asn1.x509.Extension),he.asn1.x509.CRLReason=function(e){he.asn1.x509.CRLReason.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new he.asn1.DEREnumerated(this.params.code),this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.21",null!=e&&(this.params=e)},We(he.asn1.x509.CRLReason,he.asn1.x509.Extension),he.asn1.x509.OCSPNonce=function(e){he.asn1.x509.OCSPNonce.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new he.asn1.DEROctetString(this.params),this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.48.1.2",null!=e&&(this.params=e)},We(he.asn1.x509.OCSPNonce,he.asn1.x509.Extension),he.asn1.x509.OCSPNoCheck=function(e){he.asn1.x509.OCSPNoCheck.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new he.asn1.DERNull,this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.48.1.5",null!=e&&(this.params=e)},We(he.asn1.x509.OCSPNoCheck,he.asn1.x509.Extension),he.asn1.x509.AdobeTimeStamp=function(e){he.asn1.x509.AdobeTimeStamp.superclass.constructor.call(this,e);var t=he.asn1,n=t.DERInteger,r=t.DERBoolean,i=t.DERSequence,a=t.x509.GeneralName;this.params=null,this.getExtnValueHex=function(){var e=this.params,t=[new n(1)];return t.push(new a({uri:e.uri})),null!=e.reqauth&&t.push(new r(e.reqauth)),this.asn1ExtnValue=new i({array:t}),this.asn1ExtnValue.getEncodedHex()},this.oid="1.2.840.113583.1.1.9.1",void 0!==e&&this.setByParam(e)},We(he.asn1.x509.AdobeTimeStamp,he.asn1.x509.Extension),he.asn1.x509.X500Name=function(e){he.asn1.x509.X500Name.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=he.asn1,n=t.x509,r=n.RDN;this.setByString=function(e,t){void 0!==t&&(this.sRule=t);var n=e.split("/");n.shift();for(var i=[],a=0;a<n.length;a++)if(n[a].match(/^[^=]+=.+$/))i.push(n[a]);else{var s=i.length-1;i[s]=i[s]+"/"+n[a]}for(a=0;a<i.length;a++)this.asn1Array.push(new r({str:i[a],rule:this.sRule}))},this.setByLdapString=function(e,t){void 0!==t&&(this.sRule=t);var r=n.X500Name.ldapToCompat(e);this.setByString(r,t)},this.setByObject=function(e,t){for(var n in void 0!==t&&(this.sRule=t),e)if(e.hasOwnProperty(n)){var i=new r({str:n+"="+e[n],rule:this.sRule});this.asn1Array?this.asn1Array.push(i):this.asn1Array=[i]}},this.setByParam=function(e){var t;(void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.array)?this.paramArray=e.array:void 0!==e.str?this.setByString(e.str):void 0!==e.ldapstr?this.setByLdapString(e.ldapstr):void 0!==e.hex?this.hTLV=e.hex:void 0!==e.certissuer?((t=new Ze).readCertPEM(e.certissuer),this.hTLV=t.getIssuerHex()):void 0!==e.certsubject?((t=new Ze).readCertPEM(e.certsubject),this.hTLV=t.getSubjectHex()):"object"==typeof e&&void 0===e.certsubject&&void 0===e.certissuer&&this.setByObject(e)},this.getEncodedHex=function(){if("string"==typeof this.hTLV)return this.hTLV;if(0==this.asn1Array.length&&this.paramArray.length>0)for(var e=0;e<this.paramArray.length;e++){var n={array:this.paramArray[e]};"utf8"!=this.sRule&&(n.rule=this.sRule);var i=new r(n);this.asn1Array.push(i)}var a=new t.DERSequence({array:this.asn1Array});return this.hTLV=a.getEncodedHex(),this.hTLV},void 0!==e&&this.setByParam(e)},We(he.asn1.x509.X500Name,he.asn1.ASN1Object),he.asn1.x509.X500Name.compatToLDAP=function(e){if("/"!==e.substr(0,1))throw"malformed input";var t=(e=e.substr(1)).split("/");return t.reverse(),(t=t.map((function(e){return e.replace(/,/,"\\,")}))).join(",")},he.asn1.x509.X500Name.onelineToLDAP=function(e){return he.asn1.x509.X500Name.compatToLDAP(e)},he.asn1.x509.X500Name.ldapToCompat=function(e){for(var t=e.split(","),n=!1,r=[],i=0;t.length>0;i++){var a=t.shift();if(!0===n){var s=(r.pop()+","+a).replace(/\\,/g,",");r.push(s),n=!1}else r.push(a);"\\"===a.substr(-1,1)&&(n=!0)}return(r=r.map((function(e){return e.replace("/","\\/")}))).reverse(),"/"+r.join("/")},he.asn1.x509.X500Name.ldapToOneline=function(e){return he.asn1.x509.X500Name.ldapToCompat(e)},he.asn1.x509.RDN=function(e){he.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=he.asn1.x509.AttributeTypeAndValue;this.setByParam=function(e){void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.str&&this.addByMultiValuedString(e.str),void 0!==e.array&&(this.paramArray=e.array)},this.addByString=function(e){this.asn1Array.push(new he.asn1.x509.AttributeTypeAndValue({str:e,rule:this.sRule}))},this.addByMultiValuedString=function(e){for(var t=he.asn1.x509.RDN.parseString(e),n=0;n<t.length;n++)this.addByString(t[n])},this.getEncodedHex=function(){if(0==this.asn1Array.length&&this.paramArray.length>0)for(var e=0;e<this.paramArray.length;e++){var n=this.paramArray[e];void 0!==n.rule&&"utf8"!=this.sRule&&(n.rule=this.sRule);var r=new t(n);this.asn1Array.push(r)}var i=new he.asn1.DERSet({array:this.asn1Array});return this.TLV=i.getEncodedHex(),this.TLV},void 0!==e&&this.setByParam(e)},We(he.asn1.x509.RDN,he.asn1.ASN1Object),he.asn1.x509.RDN.parseString=function(e){for(var t=e.split(/\+/),n=!1,r=[],i=0;t.length>0;i++){var a=t.shift();if(!0===n){var s=(r.pop()+"+"+a).replace(/\\\+/g,"+");r.push(s),n=!1}else r.push(a);"\\"===a.substr(-1,1)&&(n=!0)}var o=!1,u=[];for(i=0;r.length>0;i++){a=r.shift();if(!0===o){var c=u.pop();if(a.match(/"$/)){s=(c+"+"+a).replace(/^([^=]+)="(.*)"$/,"$1=$2");u.push(s),o=!1}else u.push(c+"+"+a)}else u.push(a);a.match(/^[^=]+="/)&&(o=!0)}return u},he.asn1.x509.AttributeTypeAndValue=function(e){he.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this),this.sRule="utf8",this.sType=null,this.sValue=null,this.dsType=null;var t=he,n=t.asn1,r=n.DERSequence,i=n.DERUTF8String,a=n.DERPrintableString,s=n.DERTeletexString,o=n.DERIA5String,u=n.DERVisibleString,c=n.DERBMPString,l=t.lang.String.isMail,h=t.lang.String.isPrintable;this.setByParam=function(e){if(void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.ds&&(this.dsType=e.ds),void 0===e.value&&void 0!==e.str){var t=e.str.match(/^([^=]+)=(.+)$/);if(!t)throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr);this.sType=t[1],this.sValue=t[2]}else this.sType=e.type,this.sValue=e.value},this.setByString=function(e,t){void 0!==t&&(this.sRule=t);var n=e.match(/^([^=]+)=(.+)$/);if(!n)throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr);this.setByAttrTypeAndValueStr(n[1],n[2])},this._getDsType=function(){var e=this.sType,t=this.sValue,n=this.sRule;return"prn"===n?"CN"==e&&l(t)?"ia5":h(t)?"prn":"utf8":"utf8"===n?"CN"==e&&l(t)?"ia5":"C"==e?"prn":"utf8":"utf8"},this.setByAttrTypeAndValueStr=function(e,t,n){void 0!==n&&(this.sRule=n),this.sType=e,this.sValue=t},this.getValueObj=function(e,t){if("utf8"==e)return new i({str:t});if("prn"==e)return new a({str:t});if("tel"==e)return new s({str:t});if("ia5"==e)return new o({str:t});if("vis"==e)return new u({str:t});if("bmp"==e)return new c({str:t});throw new Error("unsupported directory string type: type="+e+" value="+t)},this.getEncodedHex=function(){null==this.dsType&&(this.dsType=this._getDsType());var e=he.asn1.x509.OID.atype2obj(this.sType),t=this.getValueObj(this.dsType,this.sValue),n=new r({array:[e,t]});return this.TLV=n.getEncodedHex(),this.TLV},void 0!==e&&this.setByParam(e)},We(he.asn1.x509.AttributeTypeAndValue,he.asn1.ASN1Object),he.asn1.x509.SubjectPublicKeyInfo=function(e){he.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var t=he,n=t.asn1,r=n.DERInteger,i=n.DERBitString,a=n.DERObjectIdentifier,s=n.DERSequence,o=n.ASN1Util.newObject,u=n.x509.AlgorithmIdentifier,c=t.crypto;c.ECDSA,c.DSA;this.getASN1Object=function(){if(null==this.asn1AlgId||null==this.asn1SubjPKey)throw"algId and/or subjPubKey not set";return new s({array:[this.asn1AlgId,this.asn1SubjPKey]})},this.getEncodedHex=function(){var e=this.getASN1Object();return this.hTLV=e.getEncodedHex(),this.hTLV},this.setPubKey=function(e){try{if(e instanceof ae){var t=o({seq:[{int:{bigint:e.n}},{int:{int:e.e}}]}).getEncodedHex();this.asn1AlgId=new u({name:"rsaEncryption"}),this.asn1SubjPKey=new i({hex:"00"+t})}}catch(e){}try{if(e instanceof he.crypto.ECDSA){var n=new a({name:e.curveName});this.asn1AlgId=new u({name:"ecPublicKey",asn1params:n}),this.asn1SubjPKey=new i({hex:"00"+e.pubKeyHex})}}catch(e){}try{if(e instanceof he.crypto.DSA){n=new o({seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]});this.asn1AlgId=new u({name:"dsa",asn1params:n});var s=new r({bigint:e.y});this.asn1SubjPKey=new i({hex:"00"+s.getEncodedHex()})}}catch(e){}},void 0!==e&&this.setPubKey(e)},We(he.asn1.x509.SubjectPublicKeyInfo,he.asn1.ASN1Object),he.asn1.x509.Time=function(e){he.asn1.x509.Time.superclass.constructor.call(this);var t=he.asn1,n=t.DERUTCTime,r=t.DERGeneralizedTime;this.setTimeParams=function(e){this.timeParams=e},this.getEncodedHex=function(){var e=null;return e=null!=this.timeParams?"utc"==this.type?new n(this.timeParams):new r(this.timeParams):"utc"==this.type?new n:new r,this.TLV=e.getEncodedHex(),this.TLV},this.type="utc",void 0!==e&&(void 0!==e.type?this.type=e.type:void 0!==e.str&&(e.str.match(/^[0-9]{12}Z$/)&&(this.type="utc"),e.str.match(/^[0-9]{14}Z$/)&&(this.type="gen")),this.timeParams=e)},We(he.asn1.x509.Time,he.asn1.ASN1Object),he.asn1.x509.AlgorithmIdentifier=function(e){he.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var t=he.asn1,n=t.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV;if(this.getEncodedHex=function(){if(null===this.nameAlg&&null===this.asn1Alg)throw new Error("algorithm not specified");if(null!==this.nameAlg){var e=null;for(var r in n)r===this.nameAlg&&(e=n[r]);if(null!==e)return this.hTLV=e,this.hTLV}null!==this.nameAlg&&null===this.asn1Alg&&(this.asn1Alg=t.x509.OID.name2obj(this.nameAlg));var i=[this.asn1Alg];null!==this.asn1Params&&i.push(this.asn1Params);var a=new t.DERSequence({array:i});return this.hTLV=a.getEncodedHex(),this.hTLV},void 0!==e&&(void 0!==e.name&&(this.nameAlg=e.name),void 0!==e.asn1params&&(this.asn1Params=e.asn1params),void 0!==e.paramempty&&(this.paramEmpty=e.paramempty)),null===this.asn1Params&&!1===this.paramEmpty&&null!==this.nameAlg){void 0!==this.nameAlg.name&&(this.nameAlg=this.nameAlg.name);var r=this.nameAlg.toLowerCase();"withdsa"!==r.substr(-7,7)&&"withecdsa"!==r.substr(-9,9)&&(this.asn1Params=new t.DERNull)}},We(he.asn1.x509.AlgorithmIdentifier,he.asn1.ASN1Object),he.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"},he.asn1.x509.GeneralName=function(e){he.asn1.x509.GeneralName.superclass.constructor.call(this);var t={rfc822:"81",dns:"82",dn:"a4",uri:"86",ip:"87"},n=he.asn1,r=(n.DERSequence,n.DEROctetString),i=n.DERIA5String,a=n.DERTaggedObject,s=n.ASN1Object,o=n.x509.X500Name,u=$e;this.explicit=!1,this.setByParam=function(e){var n=null;if(void 0!==e){if(void 0!==e.rfc822&&(this.type="rfc822",n=new i({str:e[this.type]})),void 0!==e.dns&&(this.type="dns",n=new i({str:e[this.type]})),void 0!==e.uri&&(this.type="uri",n=new i({str:e[this.type]})),void 0!==e.dn&&(this.type="dn",this.explicit=!0,n="string"==typeof e.dn?new o({str:e.dn}):e.dn instanceof he.asn1.x509.X500Name?e.dn:new o(e.dn)),void 0!==e.ldapdn&&(this.type="dn",this.explicit=!0,n=new o({ldapstr:e.ldapdn})),void 0!==e.certissuer){this.type="dn",this.explicit=!0;var c=null;if((h=e.certissuer).match(/^[0-9A-Fa-f]+$/),-1!=h.indexOf("-----BEGIN ")&&(c=u(h)),null==c)throw"certissuer param not cert";(f=new Ze).hex=c;var l=f.getIssuerHex();(n=new s).hTLV=l}if(void 0!==e.certsubj){this.type="dn",this.explicit=!0;var h,f;c=null;if((h=e.certsubj).match(/^[0-9A-Fa-f]+$/),-1!=h.indexOf("-----BEGIN ")&&(c=u(h)),null==c)throw"certsubj param not cert";(f=new Ze).hex=c;l=f.getSubjectHex();(n=new s).hTLV=l}if(void 0!==e.ip){this.type="ip",this.explicit=!1;var d,p=e.ip,g="malformed IP address";if(p.match(/^[0-9.]+[.][0-9.]+$/)){if(8!==(d=Ve("["+p.split(".").join(",")+"]")).length)throw g}else if(p.match(/^[0-9A-Fa-f:]+:[0-9A-Fa-f:]+$/))d=Be(p);else{if(!p.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw g;d=p}n=new r({hex:d})}if(null==this.type)throw"unsupported type in params="+e;this.asn1Obj=new a({explicit:this.explicit,tag:t[this.type],obj:n})}},this.getEncodedHex=function(){return this.asn1Obj.getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.x509.GeneralName,he.asn1.ASN1Object),he.asn1.x509.GeneralNames=function(e){he.asn1.x509.GeneralNames.superclass.constructor.call(this);var t=he.asn1;this.setByParamArray=function(e){for(var n=0;n<e.length;n++){var r=new t.x509.GeneralName(e[n]);this.asn1Array.push(r)}},this.getEncodedHex=function(){return new t.DERSequence({array:this.asn1Array}).getEncodedHex()},this.asn1Array=new Array,void 0!==e&&this.setByParamArray(e)},We(he.asn1.x509.GeneralNames,he.asn1.ASN1Object),he.asn1.x509.OID=new function(e){this.atype2oidList={CN:"2.5.4.3",L:"2.5.4.7",ST:"2.5.4.8",O:"2.5.4.10",OU:"2.5.4.11",C:"2.5.4.6",STREET:"2.5.4.9",DC:"0.9.2342.19200300.100.1.25",UID:"0.9.2342.19200300.100.1.1",SN:"2.5.4.4",T:"2.5.4.12",DN:"2.5.4.49",E:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3"},this.name2oidList={sha1:"1.3.14.3.2.26",sha256:"2.16.840.1.101.3.4.2.1",sha384:"2.16.840.1.101.3.4.2.2",sha512:"2.16.840.1.101.3.4.2.3",sha224:"2.16.840.1.101.3.4.2.4",md5:"1.2.840.113549.2.5",md2:"1.3.14.7.2.2.1",ripemd160:"1.3.36.3.2.1",MD2withRSA:"1.2.840.113549.1.1.2",MD4withRSA:"1.2.840.113549.1.1.3",MD5withRSA:"1.2.840.113549.1.1.4",SHA1withRSA:"1.2.840.113549.1.1.5","pkcs1-MGF":"1.2.840.113549.1.1.8",rsaPSS:"1.2.840.113549.1.1.10",SHA224withRSA:"1.2.840.113549.1.1.14",SHA256withRSA:"1.2.840.113549.1.1.11",SHA384withRSA:"1.2.840.113549.1.1.12",SHA512withRSA:"1.2.840.113549.1.1.13",SHA1withECDSA:"1.2.840.10045.4.1",SHA224withECDSA:"1.2.840.10045.4.3.1",SHA256withECDSA:"1.2.840.10045.4.3.2",SHA384withECDSA:"1.2.840.10045.4.3.3",SHA512withECDSA:"1.2.840.10045.4.3.4",dsa:"1.2.840.10040.4.1",SHA1withDSA:"1.2.840.10040.4.3",SHA224withDSA:"2.16.840.1.101.3.4.3.1",SHA256withDSA:"2.16.840.1.101.3.4.3.2",rsaEncryption:"1.2.840.113549.1.1.1",commonName:"2.5.4.3",countryName:"2.5.4.6",localityName:"2.5.4.7",stateOrProvinceName:"2.5.4.8",streetAddress:"2.5.4.9",organizationName:"2.5.4.10",organizationalUnitName:"2.5.4.11",domainComponent:"0.9.2342.19200300.100.1.25",userId:"0.9.2342.19200300.100.1.1",surname:"2.5.4.4",givenName:"2.5.4.42",title:"2.5.4.12",distinguishedName:"2.5.4.49",emailAddress:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3",subjectDirectoryAttributes:"2.5.29.9",subjectKeyIdentifier:"2.5.29.14",keyUsage:"2.5.29.15",subjectAltName:"2.5.29.17",issuerAltName:"2.5.29.18",basicConstraints:"2.5.29.19",cRLNumber:"2.5.29.20",cRLReason:"2.5.29.21",nameConstraints:"2.5.29.30",cRLDistributionPoints:"2.5.29.31",certificatePolicies:"2.5.29.32",anyPolicy:"2.5.29.32.0",authorityKeyIdentifier:"2.5.29.35",policyConstraints:"2.5.29.36",extKeyUsage:"2.5.29.37",authorityInfoAccess:"1.3.6.1.5.5.7.1.1",ocsp:"1.3.6.1.5.5.7.48.1",ocspBasic:"1.3.6.1.5.5.7.48.1.1",ocspNonce:"1.3.6.1.5.5.7.48.1.2",ocspNoCheck:"1.3.6.1.5.5.7.48.1.5",caIssuers:"1.3.6.1.5.5.7.48.2",anyExtendedKeyUsage:"2.5.29.37.0",serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",emailProtection:"1.3.6.1.5.5.7.3.4",timeStamping:"1.3.6.1.5.5.7.3.8",ocspSigning:"1.3.6.1.5.5.7.3.9",dateOfBirth:"1.3.6.1.5.5.7.9.1",placeOfBirth:"1.3.6.1.5.5.7.9.2",gender:"1.3.6.1.5.5.7.9.3",countryOfCitizenship:"1.3.6.1.5.5.7.9.4",countryOfResidence:"1.3.6.1.5.5.7.9.5",ecPublicKey:"1.2.840.10045.2.1","P-256":"1.2.840.10045.3.1.7",secp256r1:"1.2.840.10045.3.1.7",secp256k1:"1.3.132.0.10",secp384r1:"1.3.132.0.34",pkcs5PBES2:"1.2.840.113549.1.5.13",pkcs5PBKDF2:"1.2.840.113549.1.5.12","des-EDE3-CBC":"1.2.840.113549.3.7",data:"1.2.840.113549.1.7.1","signed-data":"1.2.840.113549.1.7.2","enveloped-data":"1.2.840.113549.1.7.3","digested-data":"1.2.840.113549.1.7.5","encrypted-data":"1.2.840.113549.1.7.6","authenticated-data":"1.2.840.113549.1.9.16.1.2",tstinfo:"1.2.840.113549.1.9.16.1.4",signingCertificate:"1.2.840.113549.1.9.16.2.12",timeStampToken:"1.2.840.113549.1.9.16.2.14",signaturePolicyIdentifier:"1.2.840.113549.1.9.16.2.15",etsArchiveTimeStamp:"1.2.840.113549.1.9.16.2.27",signingCertificateV2:"1.2.840.113549.1.9.16.2.47",etsArchiveTimeStampV2:"1.2.840.113549.1.9.16.2.48",extensionRequest:"1.2.840.113549.1.9.14",contentType:"1.2.840.113549.1.9.3",messageDigest:"1.2.840.113549.1.9.4",signingTime:"1.2.840.113549.1.9.5",counterSignature:"1.2.840.113549.1.9.6",archiveTimeStampV3:"0.4.0.1733.2.4",pdfRevocationInfoArchival:"1.2.840.113583.1.1.8",adobeTimeStamp:"1.2.840.113583.1.1.9.1"},this.objCache={},this.name2obj=function(e){if(void 0!==this.objCache[e])return this.objCache[e];if(void 0===this.name2oidList[e])throw"Name of ObjectIdentifier not defined: "+e;var t=this.name2oidList[e],n=new he.asn1.DERObjectIdentifier({oid:t});return this.objCache[e]=n,n},this.atype2obj=function(e){if(void 0!==this.objCache[e])return this.objCache[e];var t;if(e.match(/^\d+\.\d+\.[0-9.]+$/))t=e;else if(void 0!==this.atype2oidList[e])t=this.atype2oidList[e];else{if(void 0===this.name2oidList[e])throw"AttributeType name undefined: "+e;t=this.name2oidList[e]}var n=new he.asn1.DERObjectIdentifier({oid:t});return this.objCache[e]=n,n}},he.asn1.x509.OID.oid2name=function(e){var t=he.asn1.x509.OID.name2oidList;for(var n in t)if(t[n]==e)return n;return""},he.asn1.x509.OID.oid2atype=function(e){var t=he.asn1.x509.OID.atype2oidList;for(var n in t)if(t[n]==e)return n;return e},he.asn1.x509.OID.name2oid=function(e){if(e.match(/^[0-9.]+$/))return e;var t=he.asn1.x509.OID.name2oidList;return void 0===t[e]?"":t[e]},he.asn1.x509.X509Util={},he.asn1.x509.X509Util.newCertPEM=function(e){var t=he.asn1.x509;t.TBSCertificate;return new(0,t.Certificate)(e).getPEM()},void 0!==he&&he||(he={}),void 0!==he.asn1&&he.asn1||(he.asn1={}),void 0!==he.asn1.cms&&he.asn1.cms||(he.asn1.cms={}),he.asn1.cms.Attribute=function(e){var t=Error,n=he.asn1,r=n.DERSequence,i=n.DERSet,a=n.DERObjectIdentifier;this.params=null,this.typeOid=null,this.setByParam=function(e){this.params=e},this.getValueArray=function(){throw new t("not yet implemented abstract")},this.getEncodedHex=function(){var e=new a({oid:this.typeOid}),t=new i({array:this.getValueArray()});return new r({array:[e,t]}).getEncodedHex()}},We(he.asn1.cms.Attribute,he.asn1.ASN1Object),he.asn1.cms.ContentType=function(e){var t=he.asn1;t.cms.ContentType.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.3",this.getValueArray=function(){return[new t.DERObjectIdentifier(this.params.type)]},null!=e&&this.setByParam(e)},We(he.asn1.cms.ContentType,he.asn1.cms.Attribute),he.asn1.cms.MessageDigest=function(e){var t=he.asn1,n=t.DEROctetString;t.cms.MessageDigest.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.4",this.getValueArray=function(){return[new n(this.params)]},null!=e&&this.setByParam(e)},We(he.asn1.cms.MessageDigest,he.asn1.cms.Attribute),he.asn1.cms.SigningTime=function(e){var t=he.asn1;t.cms.SigningTime.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.5",this.getValueArray=function(){return[new t.x509.Time(this.params)]},null!=e&&this.setByParam(e)},We(he.asn1.cms.SigningTime,he.asn1.cms.Attribute),he.asn1.cms.SigningCertificate=function(e){var t=Error,n=he,r=n.asn1,i=r.DERSequence,a=r.cms,s=a.ESSCertID;n.crypto;a.SigningCertificate.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.12",this.getValueArray=function(){if(null==this.params||null==this.params||null==this.params.array)throw new t("parameter 'array' not specified");for(var n=this.params.array,r=[],a=0;a<n.length;a++){var o=n[a];0!=e.hasis||"string"!=typeof o||-1==o.indexOf("-----BEGIN")&&!pe.isASN1HEX(o)||(o={cert:o}),0!=o.hasis&&0==e.hasis&&(o.hasis=!1),r.push(new s(o))}var u=new i({array:r});return[new i({array:[u]})]},null!=e&&this.setByParam(e)},We(he.asn1.cms.SigningCertificate,he.asn1.cms.Attribute),he.asn1.cms.ESSCertID=function(e){he.asn1.cms.ESSCertID.superclass.constructor.call(this);var t=Error,n=he,r=n.asn1,i=r.DEROctetString,a=r.DERSequence,s=r.cms.IssuerSerial;this.params=null,this.getCertHash=function(e,r){if(null!=e.hash)return e.hash;if("string"==typeof e&&-1==e.indexOf("-----BEGIN")&&!pe.isASN1HEX(e))return e;var i,a,s;if("string"==typeof e)i=e;else{if(null==e.cert)throw new t("hash nor cert unspecified");i=e.cert}if(a=-1!=i.indexOf("-----BEGIN")?$e(i):i,"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?a=$e(e):pe.isASN1HEX(e)&&(a=e)),null!=e.alg)s=e.alg;else{if(null==r)throw new t("hash alg unspecified");s=r}return n.crypto.Util.hashHex(a,s)},this.getEncodedHex=function(){var e=this.params,t=this.getCertHash(e,"sha1"),n=[];return n.push(new i({hex:t})),("string"==typeof e&&-1!=e.indexOf("-----BEGIN")||null!=e.cert&&0!=e.hasis||null!=e.issuer&&null!=e.serial)&&n.push(new s(e)),new a({array:n}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.ESSCertID,he.asn1.ASN1Object),he.asn1.cms.SigningCertificateV2=function(e){var t=Error,n=he,r=n.asn1,i=r.DERSequence,a=(r.x509,r.cms),s=a.ESSCertIDv2;n.crypto;a.SigningCertificateV2.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.47",this.getValueArray=function(){if(null==this.params||null==this.params||null==this.params.array)throw new t("parameter 'array' not specified");for(var n=this.params.array,r=[],a=0;a<n.length;a++){var o=n[a];null==e.alg&&0!=e.hasis||"string"!=typeof o||-1==o.indexOf("-----BEGIN")&&!pe.isASN1HEX(o)||(o={cert:o}),null==o.alg&&null!=e.alg&&(o.alg=e.alg),0!=o.hasis&&0==e.hasis&&(o.hasis=!1),r.push(new s(o))}var u=new i({array:r});return[new i({array:[u]})]},null!=e&&this.setByParam(e)},We(he.asn1.cms.SigningCertificateV2,he.asn1.cms.Attribute),he.asn1.cms.ESSCertIDv2=function(e){he.asn1.cms.ESSCertIDv2.superclass.constructor.call(this);Error;var t=he.asn1,n=t.DEROctetString,r=t.DERSequence,i=t.cms.IssuerSerial,a=t.x509.AlgorithmIdentifier;this.params=null,this.getEncodedHex=function(){var e=this.params,t=this.getCertHash(e,"sha256"),s=[];return null!=e.alg&&"sha256"!=e.alg&&s.push(new a({name:e.alg})),s.push(new n({hex:t})),("string"==typeof e&&-1!=e.indexOf("-----BEGIN")||null!=e.cert&&0!=e.hasis||null!=e.issuer&&null!=e.serial)&&s.push(new i(e)),new r({array:s}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.ESSCertIDv2,he.asn1.cms.ESSCertID),he.asn1.cms.IssuerSerial=function(e){var t=Error,n=he.asn1,r=n.DERInteger,i=n.DERSequence,a=n.cms,s=n.x509.GeneralNames,o=Ze;a.IssuerSerial.superclass.constructor.call(this),this.setByParam=function(e){this.params=e},this.getEncodedHex=function(){var e,n,a=this.params;if("string"==typeof a&&-1!=a.indexOf("-----BEGIN")||null!=a.cert){var u;u=null!=a.cert?a.cert:a;var c=new o;c.readCertPEM(u),e=c.getIssuer(),n={hex:c.getSerialNumberHex()}}else{if(null==a.issuer||!a.serial)throw new t("cert or issuer and serial parameter not specified");e=a.issuer,n=a.serial}var l=new s([{dn:e}]),h=new r(n);return new i({array:[l,h]}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.IssuerSerial,he.asn1.ASN1Object),he.asn1.cms.SignerIdentifier=function(e){var t=he.asn1,n=(t.DERInteger,t.DERSequence,t.cms),r=n.IssuerAndSerialNumber,i=n.SubjectKeyIdentifier;t.x509.X500Name,Error;n.SignerIdentifier.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;if("isssn"==e.type)return new r(e).getEncodedHex();if("skid"==e.type)return new i(e).getEncodedHex();throw new Error("wrong property for isssn or skid")},null!=e&&this.setByParam(e)},We(he.asn1.cms.SignerIdentifier,he.asn1.ASN1Object),he.asn1.cms.IssuerAndSerialNumber=function(e){var t=he.asn1,n=t.DERInteger,r=t.DERSequence,i=t.cms,a=t.x509.X500Name,s=Ze,o=Error;i.IssuerAndSerialNumber.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e,t,i=this.params;if("string"==typeof i&&-1!=i.indexOf("-----BEGIN")||null!=i.cert){var u;u=null!=i.cert?i.cert:i;var c=new s;c.readCertPEM(u),e=c.getIssuer(),t={hex:c.getSerialNumberHex()}}else{if(null==i.issuer||!i.serial)throw new o("cert or issuer and serial parameter not specified");e=i.issuer,t=i.serial}var l=new a(e),h=new n(t);return new r({array:[l,h]}).getEncodedHex()},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},We(he.asn1.cms.IssuerAndSerialNumber,he.asn1.ASN1Object),he.asn1.cms.SubjectKeyIdentifier=function(e){var t=he.asn1,n=(t.DERInteger,t.DERSequence,t.ASN1Util.newObject),r=t.cms,i=(r.IssuerAndSerialName,r.SubjectKeyIdentifier,t.x509.X500Name,Ze),a=Error;r.SubjectKeyIdentifier.superclass.constructor.call(this),this.getEncodedHex=function(){var e,t=this.params;if(null==t.cert&&null==t.skid)throw new a("property cert nor skid undefined");null!=t.cert?e=new i(t.cert).getExtSubjectKeyIdentifier().kid.hex:null!=t.skid&&(e=t.skid);return n({tag:{tage:"a0",obj:{octstr:{hex:e}}}}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.SubjectKeyIdentifier,he.asn1.ASN1Object),he.asn1.cms.AttributeList=function(e){var t=Error,n=he.asn1,r=n.DERSet,i=n.cms;i.AttributeList.superclass.constructor.call(this),this.params=null,this.hTLV=null,this.setByParam=function(e){this.params=e},this.getEncodedHex=function(){var e=this.params;if(null!=this.hTLV)return this.hTLV;var n=!0;null!=e.sortflag&&(n=e.sortflag);for(var a=e.array,s=[],o=0;o<a.length;o++){var u=a[o],c=u.attr;if("contentType"==c)s.push(new i.ContentType(u));else if("messageDigest"==c)s.push(new i.MessageDigest(u));else if("signingTime"==c)s.push(new i.SigningTime(u));else if("signingCertificate"==c)s.push(new i.SigningCertificate(u));else if("signingCertificateV2"==c)s.push(new i.SigningCertificateV2(u));else if("signaturePolicyIdentifier"==c)s.push(new he.asn1.cades.SignaturePolicyIdentifier(u));else{if("signatureTimeStamp"!=c&&"timeStampToken"!=c)throw new t("unknown attr: "+c);s.push(new he.asn1.cades.SignatureTimeStamp(u))}}var l=new r({array:s,sortflag:n});return this.hTLV=l.getEncodedHex(),this.hTLV},null!=e&&this.setByParam(e)},We(he.asn1.cms.AttributeList,he.asn1.ASN1Object),he.asn1.cms.SignerInfo=function(e){var t=Error,n=he,r=n.asn1,i=r.DERInteger,a=r.DEROctetString,s=r.DERSequence,o=r.DERTaggedObject,u=r.cms,c=u.SignerIdentifier,l=u.AttributeList,h=(u.ContentType,u.EncapsulatedContentInfo,u.MessageDigest,u.SignedData,r.x509.AlgorithmIdentifier),f=n.crypto,d=Ye;u.SignerInfo.superclass.constructor.call(this),this.params=null,this.sign=function(){var e=this.params,t=e.sigalg,n=new l(e.sattrs).getEncodedHex(),r=d.getKey(e.signkey),i=new f.Signature({alg:t});i.init(r),i.updateHex(n);var a=i.sign();e.sighex=a},this.getEncodedHex=function(){var e=this.params,n=[];if(n.push(new i({int:e.version})),n.push(new c(e.id)),n.push(new h({name:e.hashalg})),null!=e.sattrs){var r=new l(e.sattrs);try{n.push(new o({tag:"a0",explicit:!1,obj:r}))}catch(e){throw new t("si sattr error: "+e)}}if(null!=e.sigalgfield?n.push(new h({name:e.sigalgfield})):n.push(new h({name:e.sigalg})),null==e.sighex&&null!=e.signkey&&this.sign(),n.push(new a({hex:e.sighex})),null!=e.uattrs){r=new l(e.uattrs);try{n.push(new o({tag:"a1",explicit:!1,obj:r}))}catch(e){throw new t("si uattr error: "+e)}}return new s({array:n}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.SignerInfo,he.asn1.ASN1Object),he.asn1.cms.EncapsulatedContentInfo=function(e){var t=he.asn1,n=t.DERTaggedObject,r=t.DERSequence,i=t.DERObjectIdentifier,a=t.DEROctetString;t.cms.EncapsulatedContentInfo.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,t=[];if(t.push(new i(e.type)),null!=e.content&&(null!=e.content.hex||null!=e.content.str)&&1!=e.isDetached){var s=new a(e.content),o=new n({tag:"a0",explicit:!0,obj:s});t.push(o)}return new r({array:t}).getEncodedHex()},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},We(he.asn1.cms.EncapsulatedContentInfo,he.asn1.ASN1Object),he.asn1.cms.ContentInfo=function(e){var t=he.asn1,n=t.DERTaggedObject,r=t.DERSequence,i=t.DERObjectIdentifier;t.x509.OID.name2obj;he.asn1.cms.ContentInfo.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,t=[];t.push(new i(e.type));var a=new n({tag:"a0",explicit:!0,obj:e.obj});return t.push(a),new r({array:t}).getEncodedHex()},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},We(he.asn1.cms.ContentInfo,he.asn1.ASN1Object),he.asn1.cms.SignedData=function(e){Error;var t=he.asn1,n=(t.ASN1Object,t.DERInteger),r=t.DERSet,i=t.DERSequence,a=(t.DERTaggedObject,t.cms),s=a.EncapsulatedContentInfo,o=a.SignerInfo,u=a.ContentInfo,c=a.CertificateSet,l=a.RevocationInfoChoices,h=t.x509.AlgorithmIdentifier;he.asn1.cms.SignedData.superclass.constructor.call(this),this.params=null,this.checkAndFixParam=function(){var e=this.params;this._setDigestAlgs(e),this._setContentTypeByEContent(e),this._setMessageDigestByEContent(e),this._setSignerInfoVersion(e),this._setSignedDataVersion(e)},this._setDigestAlgs=function(e){for(var t={},n=e.sinfos,r=0;r<n.length;r++){t[n[r].hashalg]=1}e.hashalgs=Object.keys(t).sort()},this._setContentTypeByEContent=function(e){for(var t=e.econtent.type,n=e.sinfos,r=0;r<n.length;r++){var i=n[r];this._getAttrParamByName(i,"contentType").type=t}},this._setMessageDigestByEContent=function(e){var t=e.econtent,n=(e.econtent.type,t.content.hex);null==n&&"data"==t.type&&null!=t.content.str&&(n=Ce(t.content.str));for(var r=e.sinfos,i=0;i<r.length;i++){var a=r[i],s=a.hashalg,o=this._getAttrParamByName(a,"messageDigest"),u=he.crypto.Util.hashHex(n,s);o.hex=u}},this._getAttrParamByName=function(e,t){for(var n=e.sattrs.array,r=0;r<n.length;r++)if(n[r].attr==t)return n[r]},this._setSignerInfoVersion=function(e){for(var t=e.sinfos,n=0;n<t.length;n++){var r=t[n],i=1;"skid"==r.id.type&&(i=3),r.version=i}},this._setSignedDataVersion=function(e){var t=this._getSignedDataVersion(e);e.version=t},this._getSignedDataVersion=function(e){if(null!=e.revinfos)for(var t=e.revinfos,n=0;n<t.length;n++){if(null!=t[n].ocsp)return 5}var r=e.sinfos;for(n=0;n<r.length;n++){if(3==e.sinfos[n].version)return 3}return"data"!=e.econtent.type?3:1},this.getEncodedHex=function(){var e=this.params;null!=this.getEncodedHexPrepare&&this.getEncodedHexPrepare(),1!=e.fixed&&this.checkAndFixParam();var t=[];t.push(new n({int:e.version}));for(var a=[],u=0;u<e.hashalgs.length;u++){var f=e.hashalgs[u];a.push(new h({name:f}))}t.push(new r({array:a})),t.push(new s(e.econtent)),null!=e.certs&&t.push(new c(e.certs)),null!=e.revinfos&&t.push(new l(e.revinfos));var d=[];for(u=0;u<e.sinfos.length;u++){var p=e.sinfos[u];d.push(new o(p))}return t.push(new r({array:d})),new i({array:t}).getEncodedHex()},this.getContentInfo=function(){return new u({type:"signed-data",obj:this})},this.getContentInfoEncodedHex=function(){return this.getContentInfo().getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.SignedData,he.asn1.ASN1Object),he.asn1.cms.CertificateSet=function(e){he.asn1.cms.CertificateSet.superclass.constructor.call(this);var t=Error,n=he.asn1,r=n.DERTaggedObject,i=n.DERSet,a=n.ASN1Object;this.params=null,this.getEncodedHex=function(){var e,n=this.params,s=[];if(n instanceof Array)e=n;else{if(null==n.array)throw new t("cert array not specified");e=n.array}for(var o=0;o<e.length;o++){var u=$e(e[o]),c=new a;c.hTLV=u,s.push(c)}var l={array:s};0==n.sortflag&&(l.sortflag=!1);var h=new i(l);return new r({tag:"a0",explicit:!1,obj:h}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.CertificateSet,he.asn1.ASN1Object),he.asn1.cms.RevocationInfoChoices=function(e){he.asn1.cms.RevocationInfoChoices.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;if(!e instanceof Array)throw new Error("params is not array");for(var t=[],n=0;n<e.length;n++)t.push(new he.asn1.cms.RevocationInfoChoice(e[n]));return he.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:{set:t}}}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.RevocationInfoChoices,he.asn1.ASN1Object),he.asn1.cms.RevocationInfoChoice=function(e){he.asn1.cms.RevocationInfoChoice.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;if(null!=e.crl&&"string"==typeof e.crl){var t=e.crl;return-1!=e.crl.indexOf("-----BEGIN")&&(t=$e(e.crl)),t}if(null!=e.ocsp)return he.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:new he.asn1.cms.OtherRevocationFormat(e)}}).getEncodedHex();throw new Error("property crl or ocsp undefined")},null!=e&&this.setByParam(e)},We(he.asn1.cms.RevocationInfoChoice,he.asn1.ASN1Object),he.asn1.cms.OtherRevocationFormat=function(e){he.asn1.cms.OtherRevocationFormat.superclass.constructor.call(this);var t=Error,n=he,r=n.asn1.ASN1Util.newObject,i=n.lang.String.isHex;this.params=null,this.getEncodedHex=function(){var e=this.params;if(null==e.ocsp)throw new t("property ocsp not specified");if(!i(e.ocsp)||!pe.isASN1HEX(e.ocsp))throw new t("ocsp value not ASN.1 hex string");return r({seq:[{oid:"1.3.6.1.5.5.7.16.2"},{asn1:{tlv:e.ocsp}}]}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.OtherRevocationFormat,he.asn1.ASN1Object),he.asn1.cms.CMSUtil=new function(){},he.asn1.cms.CMSUtil.newSignedData=function(e){return new he.asn1.cms.SignedData(e)},he.asn1.cms.CMSUtil.verifySignedData=function(e){var t=he,n=t.asn1,r=n.cms,i=(r.SignerInfo,r.SignedData,r.SigningTime,r.SigningCertificate,r.SigningCertificateV2,n.cades.SignaturePolicyIdentifier,t.lang.String.isHex),a=pe,s=a.getVbyList,o=a.getTLVbyList,u=a.getIdxbyList,c=a.getChildIdx,l=a.getTLV,h=a.oidname,f=t.crypto.Util.hashHex;void 0===e.cms&&i(e.cms);var d=e.cms,p=function(e,t){var n=t.idx;t.signerid_issuer1=o(e,n,[1,0],"30"),t.signerid_serial1=s(e,n,[1,1],"02"),t.hashalg=h(s(e,n,[2,0],"06"));var r=u(e,n,[3],"a0");t.idxSignedAttrs=r,g(e,t,r);var i=c(e,n).length;if(i<6)throw"malformed SignerInfo";t.sigalg=h(s(e,n,[i-2,0],"06")),t.sigval=s(e,n,[i-1],"04")},g=function(e,t,n){var r=c(e,n);t.signedAttrIdxList=r;for(var i=0;i<r.length;i++){var a,o=r[i],u=s(e,o,[0],"06");"2a864886f70d010905"===u?(a=Ae(s(e,o,[1,0])),t.saSigningTime=a):"2a864886f70d010904"===u&&(a=s(e,o,[1,0],"04"),t.saMessageDigest=a)}},m=function(e,t,n,r){n.verifyDetail={};var i=n.verifyDetail,a=t.parse.econtent,s=n.hashalg,o=n.saMessageDigest;i.validMessageDigest=!1,f(a,s)===o&&(i.validMessageDigest=!0),function(e,t,n,r){var i,a=t.parse.certsIdx;if(void 0===t.certs){i=[],t.certkeys=[];for(var s=c(e,a),o=0;o<s.length;o++){var u=l(e,s[o]),h=new Ze;h.readCertHex(u),i[o]=h,t.certkeys[o]=h.getPublicKey()}t.certs=i}else i=t.certs;t.cccc=i.length,t.cccci=s.length;for(o=0;o<i.length;o++){var f=h.getIssuerHex(),d=h.getSerialNumberHex();n.signerid_issuer1===f&&n.signerid_serial1===d&&(n.certkey_idx=o)}}(e,t,n),i.validSignatureValue=!1;var u=n.sigalg,h="31"+l(e,n.idxSignedAttrs).substr(2);n.signedattrshex=h;var d=t.certs[n.certkey_idx].getPublicKey(),p=new he.crypto.Signature({alg:u});p.init(d),p.updateHex(h);var g=p.verify(n.sigval);i.validSignatureValue_isValid=g,!0===g&&(i.validSignatureValue=!0),n.isValid=!1,i.validMessageDigest&&i.validSignatureValue&&(n.isValid=!0)},v={isValid:!1,parse:{}};return function(e,t){if("2a864886f70d010702"!==s(e,0,[0],"06"))return t;t.cmsType="signedData",t.econtent=s(e,0,[1,0,2,1,0]),function(e,t){for(var n,r=3;r<6;r++)if(void 0!==(n=u(e,0,[1,0,r]))){var i=e.substr(n,2);"a0"===i&&(t.certsIdx=n),"a1"===i&&(t.revinfosIdx=n),"31"===i&&(t.signerinfosIdx=n)}}(e,t),t.signerInfos=[],function(e,t){var n=t.signerinfosIdx;if(void 0!==n){var r=c(e,n);t.signerInfoIdxList=r;for(var i=0;i<r.length;i++){var a={idx:r[i]};p(e,a),t.signerInfos.push(a)}}}(e,t)}(d,v.parse),function(e,t){for(var n=t.parse.signerInfos,r=n.length,i=!0,a=0;a<r;a++){var s=n[a];m(e,t,s,a),s.isValid||(i=!1)}t.isValid=i}(d,v),v},he.asn1.cms.CMSParser=function(){var e=Error,t=Ze,n=new t,r=pe,i=r.getV,a=r.getTLV,s=(r.getIdxbyList,r.getTLVbyList),o=r.getTLVbyListEx,u=r.getVbyList,c=r.getVbyListEx,l=r.getChildIdx;this.getCMSSignedData=function(e){var t=s(e,0,[1,0]);return this.getSignedData(t)},this.getSignedData=function(e){var t=l(e,0),n={},r=i(e,t[0]),s=parseInt(r,16);n.version=s;var u=a(e,t[1]);n.hashalgs=this.getHashAlgArray(u);var c=a(e,t[2]);n.econtent=this.getEContent(c);var h=o(e,0,["[0]"]);null!=h&&(n.certs=this.getCertificateSet(h));o(e,0,["[1]"]);var f=o(e,0,[3]);return n.sinfos=this.getSignerInfos(f),n},this.getHashAlgArray=function(e){for(var n=l(e,0),r=new t,i=[],s=0;s<n.length;s++){var o=a(e,n[s]),u=r.getAlgorithmIdentifierName(o);i.push(u)}return i},this.getEContent=function(e){var t={},n=u(e,0,[0]),r=u(e,0,[1,0]);return t.type=he.asn1.x509.OID.oid2name(pe.hextooidstr(n)),t.content={hex:r},t},this.getSignerInfos=function(e){for(var t=[],n=l(e,0),r=0;r<n.length;r++){var i=a(e,n[r]),s=this.getSignerInfo(i);t.push(s)}return t},this.getSignerInfo=function(e){var t={},i=l(e,0),s=r.getInt(e,i[0],-1);-1!=s&&(t.version=s);var u=a(e,i[1]),h=this.getIssuerAndSerialNumber(u);t.id=h;var f=a(e,i[2]),d=n.getAlgorithmIdentifierName(f);t.hashalg=d;var p=o(e,0,["[0]"]);if(null!=p){var g=this.getAttributeList(p);t.sattrs=g}var m=o(e,0,[3]),v=n.getAlgorithmIdentifierName(m);t.sigalg=v;var y=c(e,0,[4]);t.sighex=y;var b=o(e,0,["[1]"]);if(null!=b){var w=this.getAttributeList(b);t.uattrs=w}return t},this.getSignerIdentifier=function(e){if("30"==e.substr(0,2))return this.getIssuerAndSerialNumber(e);throw new Error("SKID of signerIdentifier not supported")},this.getIssuerAndSerialNumber=function(e){var t={type:"isssn"},r=l(e,0),s=a(e,r[0]);t.issuer=n.getX500Name(s);var o=i(e,r[1]);return t.serial={hex:o},t},this.getAttributeList=function(e){for(var t=[],n=l(e,0),r=0;r<n.length;r++){var i=a(e,n[r]),s=this.getAttribute(i);t.push(s)}return{array:t}},this.getAttribute=function(e){var t={},n=l(e,0),i=r.getOID(e,n[0]),s=he.asn1.x509.OID.oid2name(i);t.attr=s;var o=a(e,n[1]),u=l(o,0);if(1==u.length)t.valhex=a(o,u[0]);else{for(var c=[],h=0;h<u.length;h++)c.push(a(o,u[h]));t.valhex=c}return"contentType"==s?this.setContentType(t):"messageDigest"==s?this.setMessageDigest(t):"signingTime"==s?this.setSigningTime(t):"signingCertificate"==s?this.setSigningCertificate(t):"signingCertificateV2"==s?this.setSigningCertificateV2(t):"signaturePolicyIdentifier"==s&&this.setSignaturePolicyIdentifier(t),t},this.setContentType=function(e){var t=r.getOIDName(e.valhex,0,null);null!=t&&(e.type=t,delete e.valhex)},this.setSigningTime=function(e){var t=Ae(i(e.valhex,0));e.str=t,delete e.valhex},this.setMessageDigest=function(e){var t=i(e.valhex,0);e.hex=t,delete e.valhex},this.setSigningCertificate=function(e){var t=l(e.valhex,0);if(t.length>0){for(var n=a(e.valhex,t[0]),r=l(n,0),i=[],s=0;s<r.length;s++){var o=a(n,r[s]),u=this.getESSCertID(o);i.push(u)}e.array=i}if(t.length>1){var c=a(e.valhex,t[1]);e.polhex=c}delete e.valhex},this.setSignaturePolicyIdentifier=function(e){var n=l(e.valhex,0);if(n.length>0){var s=r.getOID(e.valhex,n[0]);e.oid=s}if(n.length>1){var o=new t,u=l(e.valhex,n[1]),c=a(e.valhex,u[0]),h=o.getAlgorithmIdentifierName(c);e.alg=h;var f=i(e.valhex,u[1]);e.hash=f}delete e.valhex},this.setSigningCertificateV2=function(e){var t=l(e.valhex,0);if(t.length>0){for(var n=a(e.valhex,t[0]),r=l(n,0),i=[],s=0;s<r.length;s++){var o=a(n,r[s]),u=this.getESSCertIDv2(o);i.push(u)}e.array=i}if(t.length>1){var c=a(e.valhex,t[1]);e.polhex=c}delete e.valhex},this.getESSCertID=function(e){var t={},n=l(e,0);if(n.length>0){var r=i(e,n[0]);t.hash=r}if(n.length>1){var s=a(e,n[1]),o=this.getIssuerSerial(s);null!=o.serial&&(t.serial=o.serial),null!=o.issuer&&(t.issuer=o.issuer)}return t},this.getESSCertIDv2=function(t){var r={},s=l(t,0);if(s.length<1||3<s.length)throw new e("wrong number of elements");var o=0;if("30"==t.substr(s[0],2)){var u=a(t,s[0]);r.alg=n.getAlgorithmIdentifierName(u),o++}else r.alg="sha256";var c=i(t,s[o]);if(r.hash=c,s.length>o+1){var h=a(t,s[o+1]),f=this.getIssuerSerial(h);r.issuer=f.issuer,r.serial=f.serial}return r},this.getIssuerSerial=function(e){var t={},r=l(e,0),s=a(e,r[0]),o=n.getGeneralNames(s)[0].dn;t.issuer=o;var u=i(e,r[1]);return t.serial={hex:u},t},this.getCertificateSet=function(e){for(var t=l(e,0),n=[],r=0;r<t.length;r++){var i=a(e,t[r]);if("30"==i.substr(0,2)){var s=Te(i,"CERTIFICATE");n.push(s)}}return{array:n,sortflag:!1}}},void 0!==he&&he||(he={}),void 0!==he.asn1&&he.asn1||(he.asn1={}),void 0!==he.asn1.tsp&&he.asn1.tsp||(he.asn1.tsp={}),he.asn1.tsp.TimeStampToken=function(e){var t=he.asn1.tsp;t.TimeStampToken.superclass.constructor.call(this),this.params=null,this.getEncodedHexPrepare=function(){var e=new t.TSTInfo(this.params.econtent.content);this.params.econtent.content.hex=e.getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.TimeStampToken,he.asn1.cms.SignedData),he.asn1.tsp.TSTInfo=function(e){Error;var t=he.asn1,n=t.DERSequence,r=t.DERInteger,i=t.DERBoolean,a=t.DERGeneralizedTime,s=t.DERObjectIdentifier,o=t.DERTaggedObject,u=t.tsp,c=u.MessageImprint,l=u.Accuracy,h=(t.x509.X500Name,t.x509.GeneralName);if(u.TSTInfo.superclass.constructor.call(this),this.dVersion=new r({int:1}),this.dPolicy=null,this.dMessageImprint=null,this.dSerial=null,this.dGenTime=null,this.dAccuracy=null,this.dOrdering=null,this.dNonce=null,this.dTsa=null,this.getEncodedHex=function(){var e=[this.dVersion];if(null==this.dPolicy)throw new Error("policy shall be specified.");if(e.push(this.dPolicy),null==this.dMessageImprint)throw new Error("messageImprint shall be specified.");if(e.push(this.dMessageImprint),null==this.dSerial)throw new Error("serialNumber shall be specified.");if(e.push(this.dSerial),null==this.dGenTime)throw new Error("genTime shall be specified.");e.push(this.dGenTime),null!=this.dAccuracy&&e.push(this.dAccuracy),null!=this.dOrdering&&e.push(this.dOrdering),null!=this.dNonce&&e.push(this.dNonce),null!=this.dTsa&&e.push(this.dTsa);var t=new n({array:e});return this.hTLV=t.getEncodedHex(),this.hTLV},void 0!==e){if("string"==typeof e.policy){if(!e.policy.match(/^[0-9.]+$/))throw"policy shall be oid like 0.1.4.134";this.dPolicy=new s({oid:e.policy})}void 0!==e.messageImprint&&(this.dMessageImprint=new c(e.messageImprint)),void 0!==e.serial&&(this.dSerial=new r(e.serial)),void 0!==e.genTime&&(this.dGenTime=new a(e.genTime)),void 0!==e.accuracy&&(this.dAccuracy=new l(e.accuracy)),void 0!==e.ordering&&1==e.ordering&&(this.dOrdering=new i),void 0!==e.nonce&&(this.dNonce=new r(e.nonce)),void 0!==e.tsa&&(this.dTsa=new o({tag:"a0",explicit:!0,obj:new h({dn:e.tsa})}))}},We(he.asn1.tsp.TSTInfo,he.asn1.ASN1Object),he.asn1.tsp.Accuracy=function(e){var t=he.asn1,n=t.ASN1Util.newObject;t.tsp.Accuracy.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,t=[];return null!=e.seconds&&"number"==typeof e.seconds&&t.push({int:e.seconds}),null!=e.millis&&"number"==typeof e.millis&&t.push({tag:{tagi:"80",obj:{int:e.millis}}}),null!=e.micros&&"number"==typeof e.micros&&t.push({tag:{tagi:"81",obj:{int:e.micros}}}),n({seq:t}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.Accuracy,he.asn1.ASN1Object),he.asn1.tsp.MessageImprint=function(e){var t=he.asn1,n=t.DERSequence,r=t.DEROctetString,i=t.x509.AlgorithmIdentifier;t.tsp.MessageImprint.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,t=new i({name:e.alg}),a=new r({hex:e.hash});return new n({array:[t,a]}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.tsp.MessageImprint,he.asn1.ASN1Object),he.asn1.tsp.TimeStampReq=function(e){var t=he.asn1,n=t.DERSequence,r=t.DERInteger,i=t.DERBoolean,a=(t.ASN1Object,t.DERObjectIdentifier),s=t.tsp,o=s.MessageImprint;s.TimeStampReq.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,t=[];return t.push(new r({int:1})),e.messageImprint instanceof he.asn1.ASN1Object?t.push(e.messageImprint):t.push(new o(e.messageImprint)),null!=e.policy&&t.push(new a(e.policy)),null!=e.nonce&&t.push(new r(e.nonce)),1==e.certreq&&t.push(new i),new n({array:t}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.TimeStampReq,he.asn1.ASN1Object),he.asn1.tsp.TimeStampResp=function(e){var t=he.asn1,n=t.DERSequence,r=(t.ASN1Object,t.tsp),i=r.PKIStatusInfo;r.TimeStampResp.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,a=[new i(e.statusinfo)];return null!=e.econtent&&a.push(new r.TimeStampToken(e).getContentInfo()),null!=e.tst&&e.tst instanceof t.ASN1Object&&a.push(e.tst),new n({array:a}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.TimeStampResp,he.asn1.ASN1Object),he.asn1.tsp.PKIStatusInfo=function(e){var t=Error,n=he.asn1,r=n.DERSequence,i=n.tsp,a=i.PKIStatus,s=i.PKIFreeText,o=i.PKIFailureInfo;i.PKIStatusInfo.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,n=[];if("string"==typeof e)n.push(new a(e));else{if(null==e.status)throw new t("property 'status' unspecified");n.push(new a(e.status)),null!=e.statusstr&&n.push(new s(e.statusstr)),null!=e.failinfo&&n.push(new o(e.failinfo))}return new r({array:n}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.PKIStatusInfo,he.asn1.ASN1Object),he.asn1.tsp.PKIStatus=function(e){var t=Error,n=he.asn1,r=n.DERInteger;n.tsp.PKIStatus.superclass.constructor.call(this);var i={granted:0,grantedWithMods:1,rejection:2,waiting:3,revocationWarning:4,revocationNotification:5};this.params=null,this.getEncodedHex=function(){var e,n=this.params;if("string"==typeof n)try{e=i[n]}catch(e){throw new t("undefined name: "+n)}else{if("number"!=typeof n)throw new t("unsupported params");e=n}return new r({int:e}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.PKIStatus,he.asn1.ASN1Object),he.asn1.tsp.PKIFreeText=function(e){var t=Error,n=he.asn1,r=n.DERSequence,i=n.DERUTF8String;n.tsp.PKIFreeText.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;if(!e instanceof Array)throw new t("wrong params: not array");for(var n=[],a=0;a<e.length;a++)n.push(new i({str:e[a]}));return new r({array:n}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.PKIFreeText,he.asn1.ASN1Object),he.asn1.tsp.PKIFailureInfo=function(e){var t=Error,n=he.asn1,r=n.DERBitString,i=n.tsp.PKIFailureInfo,a={badAlg:0,badRequest:2,badDataFormat:5,timeNotAvailable:14,unacceptedPolicy:15,unacceptedExtension:16,addInfoNotAvailable:17,systemFailure:25};i.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e,n=this.params;if("string"==typeof n)try{e=a[n]}catch(e){throw new t("undefined name: "+n)}else{if("number"!=typeof n)throw new t("wrong params");e=n}return new r({bin:e.toString(2)}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.PKIFailureInfo,he.asn1.ASN1Object),he.asn1.tsp.AbstractTSAAdapter=function(e){this.getTSTHex=function(e,t){throw"not implemented yet"}},he.asn1.tsp.SimpleTSAAdapter=function(e){var t=he,n=t.asn1.tsp,r=t.crypto.Util.hashHex;n.SimpleTSAAdapter.superclass.constructor.call(this),this.params=null,this.serial=0,this.getTSTHex=function(e,t){var i=r(e,t);this.params.econtent.content.messageImprint={alg:t,hash:i},this.params.econtent.content.serial={int:this.serial++};var a=Math.floor(1e9*Math.random());return this.params.econtent.content.nonce={int:a},new n.TimeStampToken(this.params).getContentInfoEncodedHex()},void 0!==e&&(this.params=e)},We(he.asn1.tsp.SimpleTSAAdapter,he.asn1.tsp.AbstractTSAAdapter),he.asn1.tsp.FixedTSAAdapter=function(e){var t=he,n=t.asn1.tsp,r=t.crypto.Util.hashHex;n.FixedTSAAdapter.superclass.constructor.call(this),this.params=null,this.getTSTHex=function(e,t){var i=r(e,t);return this.params.econtent.content.messageImprint={alg:t,hash:i},new n.TimeStampToken(this.params).getContentInfoEncodedHex()},void 0!==e&&(this.params=e)},We(he.asn1.tsp.FixedTSAAdapter,he.asn1.tsp.AbstractTSAAdapter),he.asn1.tsp.TSPUtil=new function(){},he.asn1.tsp.TSPUtil.newTimeStampToken=function(e){return new he.asn1.tsp.TimeStampToken(e)},he.asn1.tsp.TSPUtil.parseTimeStampReq=function(e){var t=pe,n=t.getChildIdx,r=t.getV,i=t.getTLV,a={certreq:!1},s=n(e,0);if(s.length<2)throw"TimeStampReq must have at least 2 items";var o=i(e,s[1]);a.messageImprint=he.asn1.tsp.TSPUtil.parseMessageImprint(o);for(var u=2;u<s.length;u++){var c=s[u],l=e.substr(c,2);if("06"==l){var h=r(e,c);a.policy=t.hextooidstr(h)}"02"==l&&(a.nonce=r(e,c)),"01"==l&&(a.certreq=!0)}return a},he.asn1.tsp.TSPUtil.parseMessageImprint=function(e){var t=pe,n=t.getChildIdx,r=t.getV,i=t.getIdxbyList,a={};if("30"!=e.substr(0,2))throw"head of messageImprint hex shall be '30'";n(e,0);var s=r(e,i(e,0,[0,0])),o=t.hextooidstr(s),u=he.asn1.x509.OID.oid2name(o);if(""==u)throw"hashAlg name undefined: "+o;var c=u,l=i(e,0,[1]);return a.alg=c,a.hash=r(e,l),a},he.asn1.tsp.TSPParser=function(){Error;var e=new Ze,t=pe,n=t.getV,r=t.getTLV,i=t.getIdxbyList,a=(t.getTLVbyListEx,t.getChildIdx),s=["granted","grantedWithMods","rejection","waiting","revocationWarning","revocationNotification"],o={0:"badAlg",2:"badRequest",5:"badDataFormat",14:"timeNotAvailable",15:"unacceptedPolicy",16:"unacceptedExtension",17:"addInfoNotAvailable",25:"systemFailure"};this.getResponse=function(e){var t=a(e,0);if(1==t.length)return this.getPKIStatusInfo(r(e,t[0]));if(t.length>1){var n=this.getPKIStatusInfo(r(e,t[0])),i=r(e,t[1]),s=this.getToken(i);return s.statusinfo=n,s}},this.getToken=function(e){var t=(new he.asn1.cms.CMSParser).getCMSSignedData(e);return this.setTSTInfo(t),t},this.setTSTInfo=function(e){var t=e.econtent;if("tstinfo"==t.type){var n=t.content.hex,r=this.getTSTInfo(n);t.content=r}},this.getTSTInfo=function(t){var i={},s=a(t,0),o=n(t,s[1]);i.policy=Ke(o);var u=r(t,s[2]);i.messageImprint=this.getMessageImprint(u);var c=n(t,s[3]);i.serial={hex:c};var l=n(t,s[4]);i.genTime={str:Ae(l)};var h=0;if(s.length>5&&"30"==t.substr(s[5],2)){var f=r(t,s[5]);i.accuracy=this.getAccuracy(f),h++}s.length>5+h&&"01"==t.substr(s[5+h],2)&&("ff"==n(t,s[5+h])&&(i.ordering=!0),h++);if(s.length>5+h&&"02"==t.substr(s[5+h],2)){var d=n(t,s[5+h]);i.nonce={hex:d},h++}if(s.length>5+h&&"a0"==t.substr(s[5+h],2)){var p=r(t,s[5+h]);p="30"+p.substr(2),pGeneralNames=e.getGeneralNames(p);var g=pGeneralNames[0].dn;i.tsa=g,h++}if(s.length>5+h&&"a1"==t.substr(s[5+h],2)){var m=r(t,s[5+h]);m="30"+m.substr(2);var v=e.getExtParamArray(m);i.ext=v,h++}return i},this.getAccuracy=function(e){for(var t={},r=a(e,0),i=0;i<r.length;i++){var s=e.substr(r[i],2),o=n(e,r[i]),u=parseInt(o,16);"02"==s?t.seconds=u:"80"==s?t.millis=u:"81"==s&&(t.micros=u)}return t},this.getMessageImprint=function(e){if("30"!=e.substr(0,2))throw new Error("head of messageImprint hex shall be x30");var r={},s=(a(e,0),i(e,0,[0,0])),o=n(e,s),u=t.hextooidstr(o),c=he.asn1.x509.OID.oid2name(u);if(""==c)throw new Error("hashAlg name undefined: "+u);var l=c,h=i(e,0,[1]);return r.alg=l,r.hash=n(e,h),r},this.getPKIStatusInfo=function(e){var t={},i=a(e,0),o=0;try{var u=n(e,i[0]),c=parseInt(u,16);t.status=s[c]}catch(e){}if(i.length>1&&"30"==e.substr(i[1],2)){var l=r(e,i[1]);t.statusstr=this.getPKIFreeText(l),o++}if(i.length>o&&"03"==e.substr(i[1+o],2)){var h=r(e,i[1+o]);t.failinfo=this.getPKIFailureInfo(h)}return t},this.getPKIFreeText=function(e){for(var n=[],r=a(e,0),i=0;i<r.length;i++)n.push(t.getString(e,r[i]));return n},this.getPKIFailureInfo=function(e){var n=t.getInt(e,0);return null!=o[n]?o[n]:n}},void 0!==he&&he||(he={}),void 0!==he.asn1&&he.asn1||(he.asn1={}),void 0!==he.asn1.cades&&he.asn1.cades||(he.asn1.cades={}),he.asn1.cades.SignaturePolicyIdentifier=function(e){var t=he.asn1.cades,n=t.SignaturePolicyId;t.SignaturePolicyIdentifier.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.15",this.params=null,this.getValueArray=function(){return[new n(this.params)]},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},We(he.asn1.cades.SignaturePolicyIdentifier,he.asn1.cms.Attribute),he.asn1.cades.SignaturePolicyId=function(e){var t=he.asn1,n=t.DERSequence,r=t.DERObjectIdentifier,i=(t.x509.AlgorithmIdentifier,t.cades),a=i.SignaturePolicyId,s=i.OtherHashAlgAndValue;a.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,t=[];return t.push(new r(e.oid)),t.push(new s(e)),new n({array:t}).getEncodedHex()},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},We(he.asn1.cades.SignaturePolicyId,he.asn1.ASN1Object),he.asn1.cades.OtherHashAlgAndValue=function(e){var t=Error,n=he.asn1,r=n.DERSequence,i=n.DEROctetString,a=n.x509.AlgorithmIdentifier;n.cades.OtherHashAlgAndValue.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;if(null==e.alg)throw new t("property 'alg' not specified");if(null==e.hash&&null==e.cert)throw new t("property 'hash' nor 'cert' not specified");var n=null;if(null!=e.hash)n=e.hash;else if(null!=e.cert){if("string"!=typeof e.cert)throw new t("cert not string");var s=e.cert;-1!=e.cert.indexOf("-----BEGIN")&&(s=$e(e.cert)),n=he.crypto.Util.hashHex(s,e.alg)}var o=[];return o.push(new a({name:e.alg})),o.push(new i({hex:n})),new r({array:o}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cades.OtherHashAlgAndValue,he.asn1.ASN1Object),he.asn1.cades.OtherHashValue=function(e){he.asn1.cades.OtherHashValue.superclass.constructor.call(this);var t=Error,n=he,r=(n.lang.String.isHex,n.asn1.DEROctetString);n.crypto.Util.hashHex;this.params=null,this.getEncodedHex=function(){var e=this.params;if(null==e.hash&&null==e.cert)throw new t("hash or cert not specified");var n=null;if(null!=e.hash)n=e.hash;else if(null!=e.cert){if("string"!=typeof e.cert)throw new t("cert not string");var i=e.cert;-1!=e.cert.indexOf("-----BEGIN")&&(i=$e(e.cert)),n=he.crypto.Util.hashHex(i,"sha1")}return new r({hex:n}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cades.OtherHashValue,he.asn1.ASN1Object),he.asn1.cades.SignatureTimeStamp=function(e){var t=Error,n=he,r=n.lang.String.isHex,i=n.asn1,a=i.ASN1Object;i.x509;i.cades.SignatureTimeStamp.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.14",this.params=null,this.getValueArray=function(){var e=this.params;if(null!=e.tst){if(r(e.tst))return(i=new a).hTLV=e.tst,[i];if(e.tst instanceof a)return[e.tst];throw new t("params.tst has wrong value")}if(null!=e.res){var n=e.res;if(n instanceof a&&(n=n.getEncodedHex()),"string"!=typeof n||!r(n))throw new t("params.res has wrong value");var i;pe.getTLVbyList(n,0,[1]);return(i=new a).hTLV=e.tst,[i]}},null!=e&&this.setByParam(e)},We(he.asn1.cades.SignatureTimeStamp,he.asn1.cms.Attribute),he.asn1.cades.CompleteCertificateRefs=function(e){var t=Error,n=he,r=n.asn1,i=r.DERSequence,a=r.cades,s=a.OtherCertID,o=n.lang.String.isHex;a.CompleteCertificateRefs.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.21",this.params=null,this.getValueArray=function(){for(var e=this.params,n=[],r=0;r<e.array.length;r++){var a=e.array[r];if("string"==typeof a)if(-1!=a.indexOf("-----BEGIN"))a={cert:a};else{if(!o(a))throw new t("unsupported value: "+a);a={hash:a}}null!=e.alg&&null==a.alg&&(a.alg=e.alg),null!=e.hasis&&null==a.hasis&&(a.hasis=e.hasis);var u=new s(a);n.push(u)}return[new i({array:n})]},null!=e&&this.setByParam(e)},We(he.asn1.cades.CompleteCertificateRefs,he.asn1.cms.Attribute),he.asn1.cades.OtherCertID=function(e){var t=he.asn1,n=t.DERSequence,r=t.cms.IssuerSerial,i=t.cades,a=i.OtherHashValue,s=i.OtherHashAlgAndValue;i.OtherCertID.superclass.constructor.call(this),this.params=e,this.getEncodedHex=function(){var e=this.params;"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?e={cert:e}:_isHex(e)&&(e={hash:e}));var t=[],i=null;if(i=null!=e.alg?new s(e):new a(e),t.push(i),null!=e.cert&&1==e.hasis||null!=e.issuer&&null!=e.serial){var o=new r(e);t.push(o)}return new n({array:t}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cades.OtherCertID,he.asn1.ASN1Object),he.asn1.cades.OtherHash=function(e){Error;var t=he,n=t.asn1,r=(n.cms,n.cades),i=r.OtherHashAlgAndValue,a=r.OtherHashValue,s=(t.crypto.Util.hashHex,t.lang.String.isHex);r.OtherHash.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?e={cert:e}:s(e)&&(e={hash:e}));return(null!=e.alg?new i(e):new a(e)).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cades.OtherHash,he.asn1.ASN1Object),he.asn1.cades.CAdESUtil=new function(){},he.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned=function(e){return(new he.asn1.cms.CMSParser).getCMSSignedData(e)},he.asn1.cades.CAdESUtil.parseSignerInfoForAddingUnsigned=function(e,t,n){var r=pe,i=r.getChildIdx,a=r.getTLV,s=r.getV,o=he.asn1,u=o.ASN1Object,c=o.cms,l=c.AttributeList,h=c.SignerInfo,f={},d=i(e,t);if(6!=d.length)throw"not supported items for SignerInfo (!=6)";var p=d.shift();f.version=a(e,p);var g=d.shift();f.si=a(e,g);var m=d.shift();f.digalg=a(e,m);var v=d.shift();f.sattrs=a(e,v);var y=d.shift();f.sigalg=a(e,y);var b=d.shift();f.sig=a(e,b),f.sigval=s(e,b);var w=null;return f.obj=new h,(w=new u).hTLV=f.version,f.obj.dCMSVersion=w,(w=new u).hTLV=f.si,f.obj.dSignerIdentifier=w,(w=new u).hTLV=f.digalg,f.obj.dDigestAlgorithm=w,(w=new u).hTLV=f.sattrs,f.obj.dSignedAttrs=w,(w=new u).hTLV=f.sigalg,f.obj.dSigAlg=w,(w=new u).hTLV=f.sig,f.obj.dSig=w,f.obj.dUnsignedAttrs=new l,f},void 0!==he.asn1.csr&&he.asn1.csr||(he.asn1.csr={}),he.asn1.csr.CertificationRequest=function(e){var t=he.asn1,n=t.DERBitString,r=t.DERSequence,i=t.csr,a=(t.x509,i.CertificationRequestInfo);i.CertificationRequest.superclass.constructor.call(this),this.setByParam=function(e){this.params=e},this.sign=function(){var e=new a(this.params).getEncodedHex(),t=new he.crypto.Signature({alg:this.params.sigalg});t.init(this.params.sbjprvkey),t.updateHex(e);var n=t.sign();this.params.sighex=n},this.getPEM=function(){return Te(this.getEncodedHex(),"CERTIFICATE REQUEST")},this.getEncodedHex=function(){var e=this.params,t=new he.asn1.csr.CertificationRequestInfo(this.params),i=new he.asn1.x509.AlgorithmIdentifier({name:e.sigalg});if(null==e.sighex&&null!=e.sbjprvkey&&this.sign(),null==e.sighex)throw new Error("sighex or sbjprvkey parameter not defined");var a=new n({hex:"00"+e.sighex});return new r({array:[t,i,a]}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.csr.CertificationRequest,he.asn1.ASN1Object),he.asn1.csr.CertificationRequestInfo=function(e){var t=he.asn1,n=(t.DERBitString,t.DERSequence),r=t.DERInteger,i=t.DERUTF8String,a=t.DERTaggedObject,s=t.ASN1Util.newObject,o=t.csr,u=t.x509,c=u.X500Name,l=u.Extensions,h=u.SubjectPublicKeyInfo;o.CertificationRequestInfo.superclass.constructor.call(this),this.params=null,this.setByParam=function(e){null!=e&&(this.params=e)},this.getEncodedHex=function(){var e=this.params,t=[];if(t.push(new r({int:0})),t.push(new c(e.subject)),t.push(new h(Ye.getKey(e.sbjpubkey))),null!=e.extreq){var o=new l(e.extreq),u=s({tag:{tag:"a0",explict:!0,obj:{seq:[{oid:"1.2.840.113549.1.9.14"},{set:[o]}]}}});t.push(u)}else t.push(new a({tag:"a0",explicit:!1,obj:new i({str:""})}));return new n({array:t}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.csr.CertificationRequestInfo,he.asn1.ASN1Object),he.asn1.csr.CSRUtil=new function(){},he.asn1.csr.CSRUtil.newCSRPEM=function(e){return new he.asn1.csr.CertificationRequest(e).getPEM()},he.asn1.csr.CSRUtil.getParam=function(e){var t=pe,n=t.getV;_getIdxbyList=t.getIdxbyList,_getTLVbyList=t.getTLVbyList,_getTLVbyListEx=t.getTLVbyListEx,_getVbyListEx=t.getVbyListEx;var r={};if(-1==e.indexOf("-----BEGIN CERTIFICATE REQUEST"))throw new Error("argument is not PEM file");var i=$e(e,"CERTIFICATE REQUEST");try{var a=_getTLVbyListEx(i,0,[0,1]);if("3000"==a)r.subject={};else{var s=new Ze;r.subject=s.getX500Name(a)}}catch(e){}var o=_getTLVbyListEx(i,0,[0,2]),u=Ye.getKey(o,null,"pkcs8pub");r.sbjpubkey=Ye.getPEM(u,"PKCS8PUB");var c,l,h=(c=i,l=_getIdxbyList(c,0,[0,3,0,0],"06"),"2a864886f70d01090e"!=n(c,l)?null:_getTLVbyList(c,0,[0,3,0,1,0],"30"));s=new Ze;null!=h&&(r.extreq=s.getExtParamArray(h));try{var f=_getTLVbyListEx(i,0,[1],"30");s=new Ze;r.sigalg=s.getAlgorithmIdentifierName(f)}catch(e){}try{var d=_getVbyListEx(i,0,[2]);r.sighex=d}catch(e){}return r},void 0!==he&&he||(he={}),void 0!==he.asn1&&he.asn1||(he.asn1={}),void 0!==he.asn1.ocsp&&he.asn1.ocsp||(he.asn1.ocsp={}),he.asn1.ocsp.DEFAULT_HASH="sha1",he.asn1.ocsp.OCSPResponse=function(e){he.asn1.ocsp.OCSPResponse.superclass.constructor.call(this);he.asn1.DEREnumerated;var t=he.asn1.ASN1Util.newObject,n=he.asn1.ocsp.ResponseBytes,r=["successful","malformedRequest","internalError","tryLater","_not_used_","sigRequired","unauthorized"];this.params=null,this._getStatusCode=function(){var e=this.params.resstatus;return"number"==typeof e?e:"string"!=typeof e?-1:r.indexOf(e)},this.setByParam=function(e){this.params=e},this.getEncodedHex=function(){var e=this.params,r=this._getStatusCode();if(-1==r)throw new Error("responseStatus not supported: "+e.resstatus);if(0!=r)return t({seq:[{enum:{int:r}}]}).getEncodedHex();var i=new n(e);return t({seq:[{enum:{int:0}},{tag:{tag:"a0",explicit:!0,obj:i}}]}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.OCSPResponse,he.asn1.ASN1Object),he.asn1.ocsp.ResponseBytes=function(e){he.asn1.ocsp.ResponseBytes.superclass.constructor.call(this);var t=he.asn1,n=t.DERSequence,r=t.DERObjectIdentifier,i=t.DEROctetString,a=t.ocsp.BasicOCSPResponse;this.params=null,this.setByParam=function(e){this.params=e},this.getEncodedHex=function(){var e=this.params;if("ocspBasic"!=e.restype)throw new Error("not supported responseType: "+e.restype);var t=new a(e),s=[];return s.push(new r({name:"ocspBasic"})),s.push(new i({hex:t.getEncodedHex()})),new n({array:s}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.ResponseBytes,he.asn1.ASN1Object),he.asn1.ocsp.BasicOCSPResponse=function(e){he.asn1.ocsp.BasicOCSPResponse.superclass.constructor.call(this);var t=Error,n=he.asn1,r=n.ASN1Object,i=n.DERSequence,a=(n.DERGeneralizedTime,n.DERTaggedObject),s=n.DERBitString,o=(n.x509.Extensions,n.x509.AlgorithmIdentifier),u=n.ocsp;u.ResponderID;_SingleResponseList=u.SingleResponseList,_ResponseData=u.ResponseData,this.params=null,this.setByParam=function(e){this.params=e},this.sign=function(){var e=this.params,t=e.tbsresp.getEncodedHex(),n=new he.crypto.Signature({alg:e.sigalg});n.init(e.reskey),n.updateHex(t),e.sighex=n.sign()},this.getEncodedHex=function(){var e=this.params;null==e.tbsresp&&(e.tbsresp=new _ResponseData(e)),null==e.sighex&&null!=e.reskey&&this.sign();var n=[];if(n.push(e.tbsresp),n.push(new o({name:e.sigalg})),n.push(new s({hex:"00"+e.sighex})),null!=e.certs&&null!=e.certs.length){for(var u=[],c=0;c<e.certs.length;c++){var l=e.certs[c],h=null;if(pe.isASN1HEX(l))h=l;else{if(!l.match(/-----BEGIN/))throw new t("certs["+c+"] not hex or PEM");h=$e(l)}u.push(new r({tlv:h}))}var f=new i({array:u});n.push(new a({tag:"a0",explicit:!0,obj:f}))}return new i({array:n}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.BasicOCSPResponse,he.asn1.ASN1Object),he.asn1.ocsp.ResponseData=function(e){he.asn1.ocsp.ResponseData.superclass.constructor.call(this);var t=Error,n=he.asn1,r=n.DERSequence,i=n.DERGeneralizedTime,a=n.DERTaggedObject,s=n.x509.Extensions,o=n.ocsp,u=o.ResponderID;_SingleResponseList=o.SingleResponseList,this.params=null,this.getEncodedHex=function(){var e=this.params;null!=e.respid&&new t("respid not specified"),null!=e.prodat&&new t("prodat not specified"),null!=e.array&&new t("array not specified");var n=[];if(n.push(new u(e.respid)),n.push(new i(e.prodat)),n.push(new _SingleResponseList(e.array)),null!=e.ext){var o=new s(e.ext);n.push(new a({tag:"a1",explicit:!0,obj:o}))}return new r({array:n}).getEncodedHex()},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.ResponseData,he.asn1.ASN1Object),he.asn1.ocsp.ResponderID=function(e){he.asn1.ocsp.ResponderID.superclass.constructor.call(this);var t=he.asn1,n=t.ASN1Util.newObject,r=t.x509.X500Name;this.params=null,this.getEncodedHex=function(){var e=this.params;if(null!=e.key)return n({tag:{tag:"a2",explicit:!0,obj:{octstr:{hex:e.key}}}}).getEncodedHex();if(null!=e.name)return n({tag:{tag:"a1",explicit:!0,obj:new r(e.name)}}).getEncodedHex();throw new Error("key or name not specified")},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.ResponderID,he.asn1.ASN1Object),he.asn1.ocsp.SingleResponseList=function(e){he.asn1.ocsp.SingleResponseList.superclass.constructor.call(this);var t=he.asn1,n=t.DERSequence,r=t.ocsp.SingleResponse;this.params=null,this.getEncodedHex=function(){var e=this.params;if("object"!=typeof e||null==e.length)throw new Error("params not specified properly");for(var t=[],i=0;i<e.length;i++)t.push(new r(e[i]));return new n({array:t}).getEncodedHex()},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.SingleResponseList,he.asn1.ASN1Object),he.asn1.ocsp.SingleResponse=function(e){var t=Error,n=he.asn1,r=n.DERSequence,i=n.DERGeneralizedTime,a=n.DERTaggedObject,s=n.ocsp,o=s.CertID,u=s.CertStatus,c=n.x509.Extensions;s.SingleResponse.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,n=[];if(null==e.certid)throw new t("certid unspecified");if(null==e.status)throw new t("status unspecified");if(null==e.thisupdate)throw new t("thisupdate unspecified");if(n.push(new o(e.certid)),n.push(new u(e.status)),n.push(new i(e.thisupdate)),null!=e.nextupdate){var s=new i(e.nextupdate);n.push(new a({tag:"a0",explicit:!0,obj:s}))}if(null!=e.ext){var l=new c(e.ext);n.push(new a({tag:"a1",explicit:!0,obj:l}))}return new r({array:n}).getEncodedHex()},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.SingleResponse,he.asn1.ASN1Object),he.asn1.ocsp.CertID=function(e){var t=he,n=t.asn1,r=n.DEROctetString,i=n.DERInteger,a=n.DERSequence,s=n.x509.AlgorithmIdentifier,o=n.ocsp,u=o.DEFAULT_HASH,c=t.crypto.Util.hashHex,l=Ze,h=pe;if(o.CertID.superclass.constructor.call(this),this.dHashAlg=null,this.dIssuerNameHash=null,this.dIssuerKeyHash=null,this.dSerialNumber=null,this.setByValue=function(e,t,n,a){void 0===a&&(a=u),this.dHashAlg=new s({name:a}),this.dIssuerNameHash=new r({hex:e}),this.dIssuerKeyHash=new r({hex:t}),this.dSerialNumber=new i({hex:n})},this.setByCert=function(e,t,n){void 0===n&&(n=u);var r=new l;r.readCertPEM(t);var i=new l;i.readCertPEM(e);var a=i.getPublicKeyHex(),s=h.getTLVbyList(a,0,[1,0],"30"),o=r.getSerialNumberHex(),f=c(i.getSubjectHex(),n),d=c(s,n);this.setByValue(f,d,o,n),this.hoge=r.getSerialNumberHex()},this.getEncodedHex=function(){if(null===this.dHashAlg&&null===this.dIssuerNameHash&&null===this.dIssuerKeyHash&&null===this.dSerialNumber)throw"not yet set values";var e=[this.dHashAlg,this.dIssuerNameHash,this.dIssuerKeyHash,this.dSerialNumber],t=new a({array:e});return this.hTLV=t.getEncodedHex(),this.hTLV},void 0!==e){var f=e;if(void 0!==f.issuerCert&&void 0!==f.subjectCert){var d=u;void 0===f.alg&&(d=void 0),this.setByCert(f.issuerCert,f.subjectCert,d)}else{if(void 0===f.issname||void 0===f.isskey||void 0===f.sbjsn)throw new Error("invalid constructor arguments");d=u;void 0===f.alg&&(d=void 0),this.setByValue(f.issname,f.isskey,f.sbjsn,d)}}},We(he.asn1.ocsp.CertID,he.asn1.ASN1Object),he.asn1.ocsp.CertStatus=function(e){he.asn1.ocsp.CertStatus.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;if("good"==e.status)return"8000";if("unknown"==e.status)return"8200";if("revoked"==e.status){var t=[{gentime:{str:e.time}}];null!=e.reason&&t.push({tag:{tag:"a0",explicit:!0,obj:{enum:{int:e.reason}}}});var n={tag:"a1",explicit:!1,obj:{seq:t}};return he.asn1.ASN1Util.newObject({tag:n}).getEncodedHex()}throw new Error("bad status")},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.CertStatus,he.asn1.ASN1Object),he.asn1.ocsp.Request=function(e){var t=he.asn1,n=t.DERSequence,r=t.ocsp;if(r.Request.superclass.constructor.call(this),this.dReqCert=null,this.dExt=null,this.getEncodedHex=function(){var e=[];if(null===this.dReqCert)throw"reqCert not set";e.push(this.dReqCert);var t=new n({array:e});return this.hTLV=t.getEncodedHex(),this.hTLV},void 0!==e){var i=new r.CertID(e);this.dReqCert=i}},We(he.asn1.ocsp.Request,he.asn1.ASN1Object),he.asn1.ocsp.TBSRequest=function(e){var t=he.asn1,n=t.DERSequence,r=t.ocsp;r.TBSRequest.superclass.constructor.call(this),this.version=0,this.dRequestorName=null,this.dRequestList=[],this.dRequestExt=null,this.setRequestListByParam=function(e){for(var t=[],n=0;n<e.length;n++){var i=new r.Request(e[0]);t.push(i)}this.dRequestList=t},this.getEncodedHex=function(){var e=[];if(0!==this.version)throw"not supported version: "+this.version;if(null!==this.dRequestorName)throw"requestorName not supported";var t=new n({array:this.dRequestList});if(e.push(t),null!==this.dRequestExt)throw"requestExtensions not supported";var r=new n({array:e});return this.hTLV=r.getEncodedHex(),this.hTLV},void 0!==e&&void 0!==e.reqList&&this.setRequestListByParam(e.reqList)},We(he.asn1.ocsp.TBSRequest,he.asn1.ASN1Object),he.asn1.ocsp.OCSPRequest=function(e){var t=he.asn1,n=t.DERSequence,r=t.ocsp;if(r.OCSPRequest.superclass.constructor.call(this),this.dTbsRequest=null,this.dOptionalSignature=null,this.getEncodedHex=function(){var e=[];if(null===this.dTbsRequest)throw"tbsRequest not set";if(e.push(this.dTbsRequest),null!==this.dOptionalSignature)throw"optionalSignature not supported";var t=new n({array:e});return this.hTLV=t.getEncodedHex(),this.hTLV},void 0!==e&&void 0!==e.reqList){var i=new r.TBSRequest(e);this.dTbsRequest=i}},We(he.asn1.ocsp.OCSPRequest,he.asn1.ASN1Object),he.asn1.ocsp.OCSPUtil={},he.asn1.ocsp.OCSPUtil.getRequestHex=function(e,t,n){var r=he.asn1.ocsp;void 0===n&&(n=r.DEFAULT_HASH);var i={alg:n,issuerCert:e,subjectCert:t};return new r.OCSPRequest({reqList:[i]}).getEncodedHex()},he.asn1.ocsp.OCSPUtil.getOCSPResponseInfo=function(e){var t=pe,n=t.getVbyList,r=t.getVbyListEx,i=t.getIdxbyList,a=(t.getIdxbyListEx,t.getV),s={};try{var o=r(e,0,[0],"0a");s.responseStatus=parseInt(o,16)}catch(e){}if(0!==s.responseStatus)return s;try{var u=i(e,0,[1,0,1,0,0,2,0,1]);"80"===e.substr(u,2)?s.certStatus="good":"a1"===e.substr(u,2)?(s.certStatus="revoked",s.revocationTime=Ae(n(e,u,[0]))):"82"===e.substr(u,2)&&(s.certStatus="unknown")}catch(e){}try{var c=i(e,0,[1,0,1,0,0,2,0,2]);s.thisUpdate=Ae(a(e,c))}catch(e){}try{var l=i(e,0,[1,0,1,0,0,2,0,3]);"a0"===e.substr(l,2)&&(s.nextUpdate=Ae(n(e,l,[0])))}catch(e){}return s},he.asn1.ocsp.OCSPParser=function(){var e=Error,t=Ze,n=new t,r=pe,i=r.getV,a=r.getTLV,s=r.getIdxbyList,o=r.getTLVbyListEx,u=r.getChildIdx;this.getOCSPRequest=function(t){var n=u(t,0);if(1!=n.length&&2!=n.length)throw new e("wrong number elements: "+n.length);return this.getTBSRequest(a(t,n[0]))},this.getTBSRequest=function(e){var t={},r=o(e,0,[0],"30");t.array=this.getRequestList(r);var i=o(e,0,["[2]",0],"30");return null!=i&&(t.ext=n.getExtParamArray(i)),t},this.getRequestList=function(e){for(var t=[],n=u(e,0),r=0;r<n.length;r++){e=a(e,n[r]);t.push(this.getRequest(e))}return t},this.getRequest=function(t){var r=u(t,0);if(1!=r.length&&2!=r.length)throw new e("wrong number elements: "+r.length);var i=this.getCertID(a(t,r[0]));if(2==r.length){var o=s(t,0,[1,0]);i.ext=n.getExtParamArray(a(t,o))}return i},this.getCertID=function(n){var r=u(n,0);if(4!=r.length)throw new e("wrong number elements: "+r.length);var s=new t,o={};return o.alg=s.getAlgorithmIdentifierName(a(n,r[0])),o.issname=i(n,r[1]),o.isskey=i(n,r[2]),o.sbjsn=i(n,r[3]),o}},void 0!==he&&he||(he={}),void 0!==he.lang&&he.lang||(he.lang={}),he.lang.String=function(){},"function"==typeof e?(fe=function(t){return be(e.from(t,"utf8").toString("base64"))},de=function(t){return e.from(we(t),"base64").toString("utf8")}):(fe=function(e){return xe(ke(Le(e)))},de=function(e){return decodeURIComponent(Oe(Se(e)))}),he.lang.String.isInteger=function(e){return!!e.match(/^[0-9]+$/)||!!e.match(/^-[0-9]+$/)},he.lang.String.isHex=function(e){return Me(e)},he.lang.String.isBase64=function(e){return!(!(e=e.replace(/\s+/g,"")).match(/^[0-9A-Za-z+\/]+={0,3}$/)||e.length%4!=0)},he.lang.String.isBase64URL=function(e){return!e.match(/[+/=]/)&&(e=we(e),he.lang.String.isBase64(e))},he.lang.String.isIntegerArray=function(e){return!!(e=e.replace(/\s+/g,"")).match(/^\[[0-9,]+\]$/)},he.lang.String.isPrintable=function(e){return null!==e.match(/^[0-9A-Za-z '()+,-./:=?]*$/)},he.lang.String.isIA5=function(e){return null!==e.match(/^[\x20-\x21\x23-\x7f]*$/)},he.lang.String.isMail=function(e){return null!==e.match(/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\.[A-Za-z0-9]{1,}$/)};function qe(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},n=function(e){var n="",r=parseInt(e,10).toString(2),i=7-r.length%7;7==i&&(i=0);for(var a="",s=0;s<i;s++)a+="0";r=a+r;for(s=0;s<r.length-1;s+=7){var o=r.substr(s,7);s!=r.length-7&&(o="1"+o),n+=t(parseInt(o,2))}return n};try{if(!e.match(/^[0-9.]+$/))return null;var r="",i=e.split("."),a=40*parseInt(i[0],10)+parseInt(i[1],10);r+=t(a),i.splice(0,2);for(var s=0;s<i.length;s++)r+=n(i[s]);return r}catch(e){return null}}function Ke(e){if(!Me(e))return null;try{var t=[],n=e.substr(0,2),r=parseInt(n,16);t[0]=new String(Math.floor(r/40)),t[1]=new String(r%40);for(var i=e.substr(2),a=[],s=0;s<i.length/2;s++)a.push(parseInt(i.substr(2*s,2),16));var o=[],u="";for(s=0;s<a.length;s++)128&a[s]?u+=ze((127&a[s]).toString(2),7):(u+=ze((127&a[s]).toString(2),7),o.push(new String(parseInt(u,2))),u="");var c=t.join(".");return o.length>0&&(c=c+"."+o.join(".")),c}catch(e){return null}}var ze=function(e,t,n){return null==n&&(n="0"),e.length>=t?e:new Array(t-e.length+1).join(n)+e};function Ge(e){try{var t=e.substr(0,2);if("00"==t)return parseInt(e.substr(2),16);var n=parseInt(t,16),r=e.substr(2),i=parseInt(r,16).toString(2);return"0"==i&&(i="00000000"),i=i.slice(0,0-n),parseInt(i,2)}catch(e){return-1}}function We(e,t){var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t)}void 0!==he&&he||(he={}),void 0!==he.crypto&&he.crypto||(he.crypto={}),he.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:g.algo.MD5,sha1:g.algo.SHA1,sha224:g.algo.SHA224,sha256:g.algo.SHA256,sha384:g.algo.SHA384,sha512:g.algo.SHA512,ripemd160:g.algo.RIPEMD160},this.getDigestInfoHex=function(e,t){if(void 0===this.DIGESTINFOHEAD[t])throw"alg not supported in Util.DIGESTINFOHEAD: "+t;return this.DIGESTINFOHEAD[t]+e},this.getPaddedDigestInfoHex=function(e,t,n){var r=this.getDigestInfoHex(e,t),i=n/4;if(r.length+22>i)throw"key is too short for SigAlg: keylen="+n+","+t;for(var a="0001",s="00"+r,o="",u=i-a.length-s.length,c=0;c<u;c+=2)o+="ff";return a+o+s},this.hashString=function(e,t){return new he.crypto.MessageDigest({alg:t}).digestString(e)},this.hashHex=function(e,t){return new he.crypto.MessageDigest({alg:t}).digestHex(e)},this.sha1=function(e){return this.hashString(e,"sha1")},this.sha256=function(e){return this.hashString(e,"sha256")},this.sha256Hex=function(e){return this.hashHex(e,"sha256")},this.sha512=function(e){return this.hashString(e,"sha512")},this.sha512Hex=function(e){return this.hashHex(e,"sha512")},this.isKey=function(e){return e instanceof ae||e instanceof he.crypto.DSA||e instanceof he.crypto.ECDSA}},he.crypto.Util.md5=function(e){return new he.crypto.MessageDigest({alg:"md5",prov:"cryptojs"}).digestString(e)},he.crypto.Util.ripemd160=function(e){return new he.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"}).digestString(e)},he.crypto.Util.SECURERANDOMGEN=new ne,he.crypto.Util.getRandomHexOfNbytes=function(e){var t=new Array(e);return he.crypto.Util.SECURERANDOMGEN.nextBytes(t),ve(t)},he.crypto.Util.getRandomBigIntegerOfNbytes=function(e){return new S(he.crypto.Util.getRandomHexOfNbytes(e),16)},he.crypto.Util.getRandomHexOfNbits=function(e){var t=e%8,n=new Array((e-t)/8+1);return he.crypto.Util.SECURERANDOMGEN.nextBytes(n),n[0]=(255<<t&255^255)&n[0],ve(n)},he.crypto.Util.getRandomBigIntegerOfNbits=function(e){return new S(he.crypto.Util.getRandomHexOfNbits(e),16)},he.crypto.Util.getRandomBigIntegerZeroToMax=function(e){for(var t=e.bitLength();;){var n=he.crypto.Util.getRandomBigIntegerOfNbits(t);if(-1!=e.compareTo(n))return n}},he.crypto.Util.getRandomBigIntegerMinToMax=function(e,t){var n=e.compareTo(t);if(1==n)throw"biMin is greater than biMax";if(0==n)return e;var r=t.subtract(e);return he.crypto.Util.getRandomBigIntegerZeroToMax(r).add(e)},he.crypto.MessageDigest=function(e){this.setAlgAndProvider=function(e,t){if(null!==(e=he.crypto.MessageDigest.getCanonicalAlgName(e))&&void 0===t&&(t=he.crypto.Util.DEFAULTPROVIDER[e]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(e)&&"cryptojs"==t){try{this.md=he.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[e].create()}catch(t){throw"setAlgAndProvider hash alg set fail alg="+e+"/"+t}this.updateString=function(e){this.md.update(e)},this.updateHex=function(e){var t=g.enc.Hex.parse(e);this.md.update(t)},this.digest=function(){return this.md.finalize().toString(g.enc.Hex)},this.digestString=function(e){return this.updateString(e),this.digest()},this.digestHex=function(e){return this.updateHex(e),this.digest()}}if(-1!=":sha256:".indexOf(e)&&"sjcl"==t){try{this.md=new sjcl.hash.sha256}catch(t){throw"setAlgAndProvider hash alg set fail alg="+e+"/"+t}this.updateString=function(e){this.md.update(e)},this.updateHex=function(e){var t=sjcl.codec.hex.toBits(e);this.md.update(t)},this.digest=function(){var e=this.md.finalize();return sjcl.codec.hex.fromBits(e)},this.digestString=function(e){return this.updateString(e),this.digest()},this.digestHex=function(e){return this.updateHex(e),this.digest()}}},this.updateString=function(e){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(e){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestString=function(e){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(e){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},void 0!==e&&void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov&&(this.provName=he.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},he.crypto.MessageDigest.getCanonicalAlgName=function(e){return"string"==typeof e&&(e=(e=e.toLowerCase()).replace(/-/,"")),e},he.crypto.MessageDigest.getHashLength=function(e){var t=he.crypto.MessageDigest,n=t.getCanonicalAlgName(e);if(void 0===t.HASHLENGTH[n])throw"not supported algorithm: "+e;return t.HASHLENGTH[n]},he.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20},he.crypto.Mac=function(e){this.setAlgAndProvider=function(e,t){if(null==(e=e.toLowerCase())&&(e="hmacsha1"),"hmac"!=(e=e.toLowerCase()).substr(0,4))throw"setAlgAndProvider unsupported HMAC alg: "+e;void 0===t&&(t=he.crypto.Util.DEFAULTPROVIDER[e]),this.algProv=e+"/"+t;var n=e.substr(4);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(n)&&"cryptojs"==t){try{var r=he.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[n];this.mac=g.algo.HMAC.create(r,this.pass)}catch(e){throw"setAlgAndProvider hash alg set fail hashAlg="+n+"/"+e}this.updateString=function(e){this.mac.update(e)},this.updateHex=function(e){var t=g.enc.Hex.parse(e);this.mac.update(t)},this.doFinal=function(){return this.mac.finalize().toString(g.enc.Hex)},this.doFinalString=function(e){return this.updateString(e),this.doFinal()},this.doFinalHex=function(e){return this.updateHex(e),this.doFinal()}}},this.updateString=function(e){throw"updateString(str) not supported for this alg/prov: "+this.algProv},this.updateHex=function(e){throw"updateHex(hex) not supported for this alg/prov: "+this.algProv},this.doFinal=function(){throw"digest() not supported for this alg/prov: "+this.algProv},this.doFinalString=function(e){throw"digestString(str) not supported for this alg/prov: "+this.algProv},this.doFinalHex=function(e){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv},this.setPassword=function(e){if("string"==typeof e){var t=e;return e.length%2!=1&&e.match(/^[0-9A-Fa-f]+$/)||(t=Ce(e)),void(this.pass=g.enc.Hex.parse(t))}if("object"!=typeof e)throw"KJUR.crypto.Mac unsupported password type: "+e;t=null;if(void 0!==e.hex){if(e.hex.length%2!=0||!e.hex.match(/^[0-9A-Fa-f]+$/))throw"Mac: wrong hex password: "+e.hex;t=e.hex}if(void 0!==e.utf8&&(t=Ee(e.utf8)),void 0!==e.rstr&&(t=Ce(e.rstr)),void 0!==e.b64&&(t=w(e.b64)),void 0!==e.b64u&&(t=Se(e.b64u)),null==t)throw"KJUR.crypto.Mac unsupported password type: "+e;this.pass=g.enc.Hex.parse(t)},void 0!==e&&(void 0!==e.pass&&this.setPassword(e.pass),void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov&&(this.provName=he.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))},he.crypto.Signature=function(e){var t=null;if(this._setAlgNames=function(){var e=this.algName.match(/^(.+)with(.+)$/);e&&(this.mdAlgName=e[1].toLowerCase(),this.pubkeyAlgName=e[2].toLowerCase(),"rsaandmgf1"==this.pubkeyAlgName&&"sha"==this.mdAlgName&&(this.mdAlgName="sha1"))},this._zeroPaddingOfSignature=function(e,t){for(var n="",r=t/4-e.length,i=0;i<r;i++)n+="0";return n+e},this.setAlgAndProvider=function(e,t){if(this._setAlgNames(),"cryptojs/jsrsa"!=t)throw new Error("provider not supported: "+t);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)){try{this.md=new he.crypto.MessageDigest({alg:this.mdAlgName})}catch(e){throw new Error("setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+e)}this.init=function(e,t){var n=null;try{n=void 0===t?Ye.getKey(e):Ye.getKey(e,t)}catch(e){throw"init failed:"+e}if(!0===n.isPrivate)this.prvKey=n,this.state="SIGN";else{if(!0!==n.isPublic)throw"init failed.:"+n;this.pubKey=n,this.state="VERIFY"}},this.updateString=function(e){this.md.updateString(e)},this.updateHex=function(e){this.md.updateHex(e)},this.sign=function(){if(this.sHashHex=this.md.digest(),void 0===this.prvKey&&void 0!==this.ecprvhex&&void 0!==this.eccurvename&&void 0!==he.crypto.ECDSA&&(this.prvKey=new he.crypto.ECDSA({curve:this.eccurvename,prv:this.ecprvhex})),this.prvKey instanceof ae&&"rsaandmgf1"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof ae&&"rsa"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof he.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else{if(!(this.prvKey instanceof he.crypto.DSA))throw"Signature: unsupported private key alg: "+this.pubkeyAlgName;this.hSign=this.prvKey.signWithMessageHash(this.sHashHex)}return this.hSign},this.signString=function(e){return this.updateString(e),this.sign()},this.signHex=function(e){return this.updateHex(e),this.sign()},this.verify=function(e){if(this.sHashHex=this.md.digest(),void 0===this.pubKey&&void 0!==this.ecpubhex&&void 0!==this.eccurvename&&void 0!==he.crypto.ECDSA&&(this.pubKey=new he.crypto.ECDSA({curve:this.eccurvename,pub:this.ecpubhex})),this.pubKey instanceof ae&&"rsaandmgf1"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,e,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof ae&&"rsa"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);if(void 0!==he.crypto.ECDSA&&this.pubKey instanceof he.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);if(void 0!==he.crypto.DSA&&this.pubKey instanceof he.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(e,t){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.updateString=function(e){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(e){throw"updateHex(hex) not supported for this alg:prov="+this.algProvName},this.sign=function(){throw"sign() not supported for this alg:prov="+this.algProvName},this.signString=function(e){throw"digestString(str) not supported for this alg:prov="+this.algProvName},this.signHex=function(e){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(e){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=e,void 0!==e&&(void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov?this.provName=he.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=e.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),void 0!==e.psssaltlen&&(this.pssSaltLen=e.psssaltlen),void 0!==e.prvkeypem)){if(void 0!==e.prvkeypas)throw"both prvkeypem and prvkeypas parameters not supported";try{t=Ye.getKey(e.prvkeypem);this.init(t)}catch(e){throw"fatal error to load pem private key: "+e}}},he.crypto.Cipher=function(e){},he.crypto.Cipher.encrypt=function(e,t,n){if(t instanceof ae&&t.isPublic){var r=he.crypto.Cipher.getAlgByKeyAndName(t,n);if("RSA"===r)return t.encrypt(e);if("RSAOAEP"===r)return t.encryptOAEP(e,"sha1");var i=r.match(/^RSAOAEP(\d+)$/);if(null!==i)return t.encryptOAEP(e,"sha"+i[1]);throw"Cipher.encrypt: unsupported algorithm for RSAKey: "+n}throw"Cipher.encrypt: unsupported key or algorithm"},he.crypto.Cipher.decrypt=function(e,t,n){if(t instanceof ae&&t.isPrivate){var r=he.crypto.Cipher.getAlgByKeyAndName(t,n);if("RSA"===r)return t.decrypt(e);if("RSAOAEP"===r)return t.decryptOAEP(e,"sha1");var i=r.match(/^RSAOAEP(\d+)$/);if(null!==i)return t.decryptOAEP(e,"sha"+i[1]);throw"Cipher.decrypt: unsupported algorithm for RSAKey: "+n}throw"Cipher.decrypt: unsupported key or algorithm"},he.crypto.Cipher.getAlgByKeyAndName=function(e,t){if(e instanceof ae){if(-1!=":RSA:RSAOAEP:RSAOAEP224:RSAOAEP256:RSAOAEP384:RSAOAEP512:".indexOf(t))return t;if(null==t)return"RSA";throw"getAlgByKeyAndName: not supported algorithm name for RSAKey: "+t}throw"getAlgByKeyAndName: not supported algorithm name: "+t},he.crypto.OID=new function(){this.oidhex2name={"2a864886f70d010101":"rsaEncryption","2a8648ce3d0201":"ecPublicKey","2a8648ce380401":"dsa","2a8648ce3d030107":"secp256r1","2b8104001f":"secp192k1","2b81040021":"secp224r1","2b8104000a":"secp256k1","2b81040023":"secp521r1","2b81040022":"secp384r1","2a8648ce380403":"SHA1withDSA","608648016503040301":"SHA224withDSA","608648016503040302":"SHA256withDSA"}},void 0!==he&&he||(he={}),void 0!==he.crypto&&he.crypto||(he.crypto={}),he.crypto.ECDSA=function(e){var t=Error,n=S,r=ue,i=he.crypto.ECDSA,a=he.crypto.ECParameterDB,s=i.getName,o=pe,u=o.getVbyListEx,c=o.isASN1HEX,l=new ne;this.type="EC",this.isPrivate=!1,this.isPublic=!1,this.getBigRandom=function(e){return new n(e.bitLength(),l).mod(e.subtract(n.ONE)).add(n.ONE)},this.setNamedCurve=function(e){this.ecparams=a.getByName(e),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=e},this.setPrivateKeyHex=function(e){this.isPrivate=!0,this.prvKeyHex=e},this.setPublicKeyHex=function(e){this.isPublic=!0,this.pubKeyHex=e},this.getPublicKeyXYHex=function(){var e=this.pubKeyHex;if("04"!==e.substr(0,2))throw"this method supports uncompressed format(04) only";var t=this.ecparams.keylen/4;if(e.length!==2+2*t)throw"malformed public key hex length";var n={};return n.x=e.substr(2,t),n.y=e.substr(2+t),n},this.getShortNISTPCurveName=function(){var e=this.curveName;return"secp256r1"===e||"NIST P-256"===e||"P-256"===e||"prime256v1"===e?"P-256":"secp384r1"===e||"NIST P-384"===e||"P-384"===e?"P-384":null},this.generateKeyPairHex=function(){var e=this.ecparams.n,t=this.getBigRandom(e),n=this.ecparams.G.multiply(t),r=n.getX().toBigInteger(),i=n.getY().toBigInteger(),a=this.ecparams.keylen/4,s=("0000000000"+t.toString(16)).slice(-a),o="04"+("0000000000"+r.toString(16)).slice(-a)+("0000000000"+i.toString(16)).slice(-a);return this.setPrivateKeyHex(s),this.setPublicKeyHex(o),{ecprvhex:s,ecpubhex:o}},this.signWithMessageHash=function(e){return this.signHex(e,this.prvKeyHex)},this.signHex=function(e,t){var r=new n(t,16),a=this.ecparams.n,s=new n(e.substring(0,this.ecparams.keylen/4),16);do{var o=this.getBigRandom(a),u=this.ecparams.G.multiply(o).getX().toBigInteger().mod(a)}while(u.compareTo(n.ZERO)<=0);var c=o.modInverse(a).multiply(s.add(r.multiply(u))).mod(a);return i.biRSSigToASN1Sig(u,c)},this.sign=function(e,t){var r=t,i=this.ecparams.n,a=n.fromByteArrayUnsigned(e);do{var s=this.getBigRandom(i),o=this.ecparams.G.multiply(s).getX().toBigInteger().mod(i)}while(o.compareTo(S.ZERO)<=0);var u=s.modInverse(i).multiply(a.add(r.multiply(o))).mod(i);return this.serializeSig(o,u)},this.verifyWithMessageHash=function(e,t){return this.verifyHex(e,t,this.pubKeyHex)},this.verifyHex=function(e,t,a){try{var s,o,u=i.parseSigHex(t);s=u.r,o=u.s;var c=r.decodeFromHex(this.ecparams.curve,a),l=new n(e.substring(0,this.ecparams.keylen/4),16);return this.verifyRaw(l,s,o,c)}catch(e){return!1}},this.verify=function(e,t,i){var a,s,o;if(Bitcoin.Util.isArray(t)){var u=this.parseSig(t);a=u.r,s=u.s}else{if("object"!=typeof t||!t.r||!t.s)throw"Invalid value for signature";a=t.r,s=t.s}if(i instanceof ue)o=i;else{if(!Bitcoin.Util.isArray(i))throw"Invalid format for pubkey value, must be byte array or ECPointFp";o=r.decodeFrom(this.ecparams.curve,i)}var c=n.fromByteArrayUnsigned(e);return this.verifyRaw(c,a,s,o)},this.verifyRaw=function(e,t,r,i){var a=this.ecparams.n,s=this.ecparams.G;if(t.compareTo(n.ONE)<0||t.compareTo(a)>=0)return!1;if(r.compareTo(n.ONE)<0||r.compareTo(a)>=0)return!1;var o=r.modInverse(a),u=e.multiply(o).mod(a),c=t.multiply(o).mod(a);return s.multiply(u).add(i.multiply(c)).getX().toBigInteger().mod(a).equals(t)},this.serializeSig=function(e,t){var n=e.toByteArraySigned(),r=t.toByteArraySigned(),i=[];return i.push(2),i.push(n.length),(i=i.concat(n)).push(2),i.push(r.length),(i=i.concat(r)).unshift(i.length),i.unshift(48),i},this.parseSig=function(e){var t;if(48!=e[0])throw new Error("Signature not a valid DERSequence");if(2!=e[t=2])throw new Error("First element in signature must be a DERInteger");var r=e.slice(t+2,t+2+e[t+1]);if(2!=e[t+=2+e[t+1]])throw new Error("Second element in signature must be a DERInteger");var i=e.slice(t+2,t+2+e[t+1]);return t+=2+e[t+1],{r:n.fromByteArrayUnsigned(r),s:n.fromByteArrayUnsigned(i)}},this.parseSigCompact=function(e){if(65!==e.length)throw"Signature has the wrong length";var t=e[0]-27;if(t<0||t>7)throw"Invalid signature type";var r=this.ecparams.n;return{r:n.fromByteArrayUnsigned(e.slice(1,33)).mod(r),s:n.fromByteArrayUnsigned(e.slice(33,65)).mod(r),i:t}},this.readPKCS5PrvKeyHex=function(e){if(!1===c(e))throw new Error("not ASN.1 hex string");var t,n,r;try{t=u(e,0,["[0]",0],"06"),n=u(e,0,[1],"04");try{r=u(e,0,["[1]",0],"03")}catch(e){}}catch(e){throw new Error("malformed PKCS#1/5 plain ECC private key")}if(this.curveName=s(t),void 0===this.curveName)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(r),this.setPrivateKeyHex(n),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(e){if(!1===c(e))throw new t("not ASN.1 hex string");var n,r,i;try{u(e,0,[1,0],"06"),n=u(e,0,[1,1],"06"),r=u(e,0,[2,0,1],"04");try{i=u(e,0,[2,0,"[1]",0],"03")}catch(e){}}catch(e){throw new t("malformed PKCS#8 plain ECC private key")}if(this.curveName=s(n),void 0===this.curveName)throw new t("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i),this.setPrivateKeyHex(r),this.isPublic=!1},this.readPKCS8PubKeyHex=function(e){if(!1===c(e))throw new t("not ASN.1 hex string");var n,r;try{u(e,0,[0,0],"06"),n=u(e,0,[0,1],"06"),r=u(e,0,[1],"03")}catch(e){throw new t("malformed PKCS#8 ECC public key")}if(this.curveName=s(n),null===this.curveName)throw new t("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(r)},this.readCertPubKeyHex=function(e,n){if(!1===c(e))throw new t("not ASN.1 hex string");var r,i;try{r=u(e,0,[0,5,0,1],"06"),i=u(e,0,[0,5,1],"03")}catch(e){throw new t("malformed X.509 certificate ECC public key")}if(this.curveName=s(r),null===this.curveName)throw new t("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i)},void 0!==e&&void 0!==e.curve&&(this.curveName=e.curve),void 0===this.curveName&&(this.curveName="secp256r1"),this.setNamedCurve(this.curveName),void 0!==e&&(void 0!==e.prv&&this.setPrivateKeyHex(e.prv),void 0!==e.pub&&this.setPublicKeyHex(e.pub))},he.crypto.ECDSA.parseSigHex=function(e){var t=he.crypto.ECDSA.parseSigHexInHexRS(e);return{r:new S(t.r,16),s:new S(t.s,16)}},he.crypto.ECDSA.parseSigHexInHexRS=function(e){var t=pe,n=t.getChildIdx,r=t.getV;if(t.checkStrictDER(e,0),"30"!=e.substr(0,2))throw new Error("signature is not a ASN.1 sequence");var i=n(e,0);if(2!=i.length)throw new Error("signature shall have two elements");var a=i[0],s=i[1];if("02"!=e.substr(a,2))throw new Error("1st item not ASN.1 integer");if("02"!=e.substr(s,2))throw new Error("2nd item not ASN.1 integer");return{r:r(e,a),s:r(e,s)}},he.crypto.ECDSA.asn1SigToConcatSig=function(e){var t=he.crypto.ECDSA.parseSigHexInHexRS(e),n=t.r,r=t.s;if("00"==n.substr(0,2)&&n.length%32==2&&(n=n.substr(2)),"00"==r.substr(0,2)&&r.length%32==2&&(r=r.substr(2)),n.length%32==30&&(n="00"+n),r.length%32==30&&(r="00"+r),n.length%32!=0)throw"unknown ECDSA sig r length error";if(r.length%32!=0)throw"unknown ECDSA sig s length error";return n+r},he.crypto.ECDSA.concatSigToASN1Sig=function(e){if(e.length/2*8%128!=0)throw"unknown ECDSA concatinated r-s sig length error";var t=e.substr(0,e.length/2),n=e.substr(e.length/2);return he.crypto.ECDSA.hexRSSigToASN1Sig(t,n)},he.crypto.ECDSA.hexRSSigToASN1Sig=function(e,t){var n=new S(e,16),r=new S(t,16);return he.crypto.ECDSA.biRSSigToASN1Sig(n,r)},he.crypto.ECDSA.biRSSigToASN1Sig=function(e,t){var n=he.asn1,r=new n.DERInteger({bigint:e}),i=new n.DERInteger({bigint:t});return new n.DERSequence({array:[r,i]}).getEncodedHex()},he.crypto.ECDSA.getName=function(e){return"2b8104001f"===e?"secp192k1":"2a8648ce3d030107"===e?"secp256r1":"2b8104000a"===e?"secp256k1":"2b81040021"===e?"secp224r1":"2b81040022"===e?"secp384r1":-1!=="|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(e)?"secp256r1":-1!=="|secp256k1|".indexOf(e)?"secp256k1":-1!=="|secp224r1|NIST P-224|P-224|".indexOf(e)?"secp224r1":-1!=="|secp384r1|NIST P-384|P-384|".indexOf(e)?"secp384r1":null},void 0!==he&&he||(he={}),void 0!==he.crypto&&he.crypto||(he.crypto={}),he.crypto.ECParameterDB=new function(){var e={},t={};function n(e){return new S(e,16)}this.getByName=function(n){var r=n;if(void 0!==t[r]&&(r=t[n]),void 0!==e[r])return e[r];throw"unregistered EC curve name: "+r},this.regist=function(r,i,a,s,o,u,c,l,h,f,d,p){e[r]={};var g=n(a),m=n(s),v=n(o),y=n(u),b=n(c),w=new ce(g,m,v),x=w.decodePointHex("04"+l+h);e[r].name=r,e[r].keylen=i,e[r].curve=w,e[r].G=x,e[r].n=y,e[r].h=b,e[r].oid=d,e[r].info=p;for(var S=0;S<f.length;S++)t[f[S]]=r}},he.crypto.ECParameterDB.regist("secp128r1",128,"FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC","E87579C11079F43DD824993C2CEE5ED3","FFFFFFFE0000000075A30D1B9038A115","1","161FF7528B899B2D0C28607CA52C5B86","CF5AC8395BAFEB13C02DA292DDED7A83",[],"","secp128r1 : SECG curve over a 128 bit prime field"),he.crypto.ECParameterDB.regist("secp160k1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73","0","7","0100000000000000000001B8FA16DFAB9ACA16B6B3","1","3B4C382CE37AA192A4019E763036F4F5DD4D7EBB","938CF935318FDCED6BC28286531733C3F03C4FEE",[],"","secp160k1 : SECG curve over a 160 bit prime field"),he.crypto.ECParameterDB.regist("secp160r1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC","1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45","0100000000000000000001F4C8F927AED3CA752257","1","4A96B5688EF573284664698968C38BB913CBFC82","23A628553168947D59DCC912042351377AC5FB32",[],"","secp160r1 : SECG curve over a 160 bit prime field"),he.crypto.ECParameterDB.regist("secp192k1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37","0","3","FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D","1","DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D","9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D",[]),he.crypto.ECParameterDB.regist("secp192r1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC","64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1","FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831","1","188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012","07192B95FFC8DA78631011ED6B24CDD573F977A11E794811",[]),he.crypto.ECParameterDB.regist("secp224r1",224,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE","B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4","FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D","1","B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21","BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34",[]),he.crypto.ECParameterDB.regist("secp256k1",256,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","0","7","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","1","79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8",[]),he.crypto.ECParameterDB.regist("secp256r1",256,"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC","5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B","FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551","1","6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296","4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5",["NIST P-256","P-256","prime256v1"]),he.crypto.ECParameterDB.regist("secp384r1",384,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC","B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973","1","AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7","3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f",["NIST P-384","P-384"]),he.crypto.ECParameterDB.regist("secp521r1",521,"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC","051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409","1","C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66","011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650",["NIST P-521","P-521"]),void 0!==he&&he||(he={}),void 0!==he.crypto&&he.crypto||(he.crypto={}),he.crypto.DSA=function(){var e=pe,t=(e.getVbyList,e.getVbyListEx),n=e.isASN1HEX,r=S;this.p=null,this.q=null,this.g=null,this.y=null,this.x=null,this.type="DSA",this.isPrivate=!1,this.isPublic=!1,this.setPrivate=function(e,t,n,r,i){this.isPrivate=!0,this.p=e,this.q=t,this.g=n,this.y=r,this.x=i},this.setPrivateHex=function(e,t,n,r,i){var a,s,o,u,c;a=new S(e,16),s=new S(t,16),o=new S(n,16),u="string"==typeof r&&r.length>1?new S(r,16):null,c=new S(i,16),this.setPrivate(a,s,o,u,c)},this.setPublic=function(e,t,n,r){this.isPublic=!0,this.p=e,this.q=t,this.g=n,this.y=r,this.x=null},this.setPublicHex=function(e,t,n,r){var i,a,s,o;i=new S(e,16),a=new S(t,16),s=new S(n,16),o=new S(r,16),this.setPublic(i,a,s,o)},this.signWithMessageHash=function(e){var t=this.p,n=this.q,r=this.g,i=(this.y,this.x),a=he.crypto.Util.getRandomBigIntegerMinToMax(S.ONE.add(S.ONE),n.subtract(S.ONE)),s=new S(e.substr(0,n.bitLength()/4),16),o=r.modPow(a,t).mod(n),u=a.modInverse(n).multiply(s.add(i.multiply(o))).mod(n);return he.asn1.ASN1Util.jsonToASN1HEX({seq:[{int:{bigint:o}},{int:{bigint:u}}]})},this.verifyWithMessageHash=function(e,t){var n=this.p,r=this.q,i=this.g,a=this.y,s=this.parseASN1Signature(t),o=s[0],u=s[1],c=new S(e.substr(0,r.bitLength()/4),16);if(S.ZERO.compareTo(o)>0||o.compareTo(r)>0)throw"invalid DSA signature";if(S.ZERO.compareTo(u)>=0||u.compareTo(r)>0)throw"invalid DSA signature";var l=u.modInverse(r),h=c.multiply(l).mod(r),f=o.multiply(l).mod(r);return 0==i.modPow(h,n).multiply(a.modPow(f,n)).mod(n).mod(r).compareTo(o)},this.parseASN1Signature=function(e){try{return[new r(t(e,0,[0],"02"),16),new r(t(e,0,[1],"02"),16)]}catch(e){throw new Error("malformed ASN.1 DSA signature")}},this.readPKCS5PrvKeyHex=function(e){var r,i,a,s,o;if(!1===n(e))throw new Error("not ASN.1 hex string");try{r=t(e,0,[1],"02"),i=t(e,0,[2],"02"),a=t(e,0,[3],"02"),s=t(e,0,[4],"02"),o=t(e,0,[5],"02")}catch(e){throw new Error("malformed PKCS#1/5 plain DSA private key")}this.setPrivateHex(r,i,a,s,o)},this.readPKCS8PrvKeyHex=function(e){var r,i,a,s;if(!1===n(e))throw new Error("not ASN.1 hex string");try{r=t(e,0,[1,1,0],"02"),i=t(e,0,[1,1,1],"02"),a=t(e,0,[1,1,2],"02"),s=t(e,0,[2,0],"02")}catch(e){throw new Error("malformed PKCS#8 plain DSA private key")}this.setPrivateHex(r,i,a,null,s)},this.readPKCS8PubKeyHex=function(e){var r,i,a,s;if(!1===n(e))throw new Error("not ASN.1 hex string");try{r=t(e,0,[0,1,0],"02"),i=t(e,0,[0,1,1],"02"),a=t(e,0,[0,1,2],"02"),s=t(e,0,[1,0],"02")}catch(e){throw new Error("malformed PKCS#8 DSA public key")}this.setPublicHex(r,i,a,s)},this.readCertPubKeyHex=function(e,r){var i,a,s,o;if(!1===n(e))throw new Error("not ASN.1 hex string");try{i=t(e,0,[0,5,0,1,0],"02"),a=t(e,0,[0,5,0,1,1],"02"),s=t(e,0,[0,5,0,1,2],"02"),o=t(e,0,[0,5,1,0],"02")}catch(e){throw new Error("malformed X.509 certificate DSA public key")}this.setPublicHex(i,a,s,o)}};var Ye=function(){var e=function(e,n,r){return t(g.AES,e,n,r)},t=function(e,t,n,r){var i=g.enc.Hex.parse(t),a=g.enc.Hex.parse(n),s=g.enc.Hex.parse(r),o={};o.key=a,o.iv=s,o.ciphertext=i;var u=e.decrypt(o,a,{iv:s});return g.enc.Hex.stringify(u)},n=function(e,t,n){return r(g.AES,e,t,n)},r=function(e,t,n,r){var i=g.enc.Hex.parse(t),a=g.enc.Hex.parse(n),s=g.enc.Hex.parse(r),o=e.encrypt(i,a,{iv:s}),u=g.enc.Hex.parse(o.toString());return g.enc.Base64.stringify(u)},i={"AES-256-CBC":{proc:e,eproc:n,keylen:32,ivlen:16},"AES-192-CBC":{proc:e,eproc:n,keylen:24,ivlen:16},"AES-128-CBC":{proc:e,eproc:n,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:function(e,n,r){return t(g.TripleDES,e,n,r)},eproc:function(e,t,n){return r(g.TripleDES,e,t,n)},keylen:24,ivlen:8},"DES-CBC":{proc:function(e,n,r){return t(g.DES,e,n,r)},eproc:function(e,t,n){return r(g.DES,e,t,n)},keylen:8,ivlen:8}},a=function(e){var t={},n=e.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));n&&(t.cipher=n[1],t.ivsalt=n[2]);var r=e.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));r&&(t.type=r[1]);var i=-1,a=0;-1!=e.indexOf("\r\n\r\n")&&(i=e.indexOf("\r\n\r\n"),a=2),-1!=e.indexOf("\n\n")&&(i=e.indexOf("\n\n"),a=1);var s=e.indexOf("-----END");if(-1!=i&&-1!=s){var o=e.substring(i+2*a,s-a);o=o.replace(/\s+/g,""),t.data=o}return t},s=function(e,t,n){for(var r=n.substring(0,16),a=g.enc.Hex.parse(r),s=g.enc.Utf8.parse(t),o=i[e].keylen+i[e].ivlen,u="",c=null;;){var l=g.algo.MD5.create();if(null!=c&&l.update(c),l.update(s),l.update(a),c=l.finalize(),(u+=g.enc.Hex.stringify(c)).length>=2*o)break}var h={};return h.keyhex=u.substr(0,2*i[e].keylen),h.ivhex=u.substr(2*i[e].keylen,2*i[e].ivlen),h},o=function(e,t,n,r){var a=g.enc.Base64.parse(e),s=g.enc.Hex.stringify(a);return(0,i[t].proc)(s,n,r)};return{version:"1.0.0",parsePKCS5PEM:function(e){return a(e)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(e,t,n){return s(e,t,n)},decryptKeyB64:function(e,t,n,r){return o(e,t,n,r)},getDecryptedKeyHex:function(e,t){var n=a(e),r=(n.type,n.cipher),i=n.ivsalt,u=n.data,c=s(r,t,i).keyhex;return o(u,r,c,i)},getEncryptedPKCS5PEMFromPrvKeyHex:function(e,t,n,r,a){var o="";if(void 0!==r&&null!=r||(r="AES-256-CBC"),void 0===i[r])throw new Error("KEYUTIL unsupported algorithm: "+r);void 0!==a&&null!=a||(a=function(e){var t=g.lib.WordArray.random(e);return g.enc.Hex.stringify(t)}(i[r].ivlen).toUpperCase());var u=function(e,t,n,r){return(0,i[t].eproc)(e,n,r)}(t,r,s(r,n,a).keyhex,a);o="-----BEGIN "+e+" PRIVATE KEY-----\r\n";return o+="Proc-Type: 4,ENCRYPTED\r\n",o+="DEK-Info: "+r+","+a+"\r\n",o+="\r\n",o+=u.replace(/(.{64})/g,"$1\r\n"),o+="\r\n-----END "+e+" PRIVATE KEY-----\r\n"},parseHexOfEncryptedPKCS8:function(e){var t=pe,n=t.getChildIdx,r=t.getV,i={},a=n(e,0);if(2!=a.length)throw new Error("malformed format: SEQUENCE(0).items != 2: "+a.length);i.ciphertext=r(e,a[1]);var s=n(e,a[0]);if(2!=s.length)throw new Error("malformed format: SEQUENCE(0.0).items != 2: "+s.length);if("2a864886f70d01050d"!=r(e,s[0]))throw new Error("this only supports pkcs5PBES2");var o=n(e,s[1]);if(2!=s.length)throw new Error("malformed format: SEQUENCE(0.0.1).items != 2: "+o.length);var u=n(e,o[1]);if(2!=u.length)throw new Error("malformed format: SEQUENCE(0.0.1.1).items != 2: "+u.length);if("2a864886f70d0307"!=r(e,u[0]))throw"this only supports TripleDES";i.encryptionSchemeAlg="TripleDES",i.encryptionSchemeIV=r(e,u[1]);var c=n(e,o[0]);if(2!=c.length)throw new Error("malformed format: SEQUENCE(0.0.1.0).items != 2: "+c.length);if("2a864886f70d01050c"!=r(e,c[0]))throw new Error("this only supports pkcs5PBKDF2");var l=n(e,c[1]);if(l.length<2)throw new Error("malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+l.length);i.pbkdf2Salt=r(e,l[0]);var h=r(e,l[1]);try{i.pbkdf2Iter=parseInt(h,16)}catch(e){throw new Error("malformed format pbkdf2Iter: "+h)}return i},getPBKDF2KeyHexFromParam:function(e,t){var n=g.enc.Hex.parse(e.pbkdf2Salt),r=e.pbkdf2Iter,i=g.PBKDF2(t,n,{keySize:6,iterations:r});return g.enc.Hex.stringify(i)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(e,t){var n=$e(e,"ENCRYPTED PRIVATE KEY"),r=this.parseHexOfEncryptedPKCS8(n),i=Ye.getPBKDF2KeyHexFromParam(r,t),a={};a.ciphertext=g.enc.Hex.parse(r.ciphertext);var s=g.enc.Hex.parse(i),o=g.enc.Hex.parse(r.encryptionSchemeIV),u=g.TripleDES.decrypt(a,s,{iv:o});return g.enc.Hex.stringify(u)},getKeyFromEncryptedPKCS8PEM:function(e,t){var n=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(e,t);return this.getKeyFromPlainPrivatePKCS8Hex(n)},parsePlainPrivatePKCS8Hex:function(e){var t=pe,n=t.getChildIdx,r=t.getV,i={algparam:null};if("30"!=e.substr(0,2))throw new Error("malformed plain PKCS8 private key(code:001)");var a=n(e,0);if(a.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if("30"!=e.substr(a[1],2))throw new Error("malformed PKCS8 private key(code:003)");var s=n(e,a[1]);if(2!=s.length)throw new Error("malformed PKCS8 private key(code:004)");if("06"!=e.substr(s[0],2))throw new Error("malformed PKCS8 private key(code:005)");if(i.algoid=r(e,s[0]),"06"==e.substr(s[1],2)&&(i.algparam=r(e,s[1])),"04"!=e.substr(a[2],2))throw new Error("malformed PKCS8 private key(code:006)");return i.keyidx=t.getVidx(e,a[2]),i},getKeyFromPlainPrivatePKCS8PEM:function(e){var t=$e(e,"PRIVATE KEY");return this.getKeyFromPlainPrivatePKCS8Hex(t)},getKeyFromPlainPrivatePKCS8Hex:function(e){var t,n=this.parsePlainPrivatePKCS8Hex(e);if("2a864886f70d010101"==n.algoid)t=new ae;else if("2a8648ce380401"==n.algoid)t=new he.crypto.DSA;else{if("2a8648ce3d0201"!=n.algoid)throw new Error("unsupported private key algorithm");t=new he.crypto.ECDSA}return t.readPKCS8PrvKeyHex(e),t},_getKeyFromPublicPKCS8Hex:function(e){var t,n=pe.getVbyList(e,0,[0,0],"06");if("2a864886f70d010101"===n)t=new ae;else if("2a8648ce380401"===n)t=new he.crypto.DSA;else{if("2a8648ce3d0201"!==n)throw new Error("unsupported PKCS#8 public key hex");t=new he.crypto.ECDSA}return t.readPKCS8PubKeyHex(e),t},parsePublicRawRSAKeyHex:function(e){var t=pe,n=t.getChildIdx,r=t.getV,i={};if("30"!=e.substr(0,2))throw new Error("malformed RSA key(code:001)");var a=n(e,0);if(2!=a.length)throw new Error("malformed RSA key(code:002)");if("02"!=e.substr(a[0],2))throw new Error("malformed RSA key(code:003)");if(i.n=r(e,a[0]),"02"!=e.substr(a[1],2))throw new Error("malformed RSA key(code:004)");return i.e=r(e,a[1]),i},parsePublicPKCS8Hex:function(e){var t=pe,n=t.getChildIdx,r=t.getV,i={algparam:null},a=n(e,0);if(2!=a.length)throw new Error("outer DERSequence shall have 2 elements: "+a.length);var s=a[0];if("30"!=e.substr(s,2))throw new Error("malformed PKCS8 public key(code:001)");var o=n(e,s);if(2!=o.length)throw new Error("malformed PKCS8 public key(code:002)");if("06"!=e.substr(o[0],2))throw new Error("malformed PKCS8 public key(code:003)");if(i.algoid=r(e,o[0]),"06"==e.substr(o[1],2)?i.algparam=r(e,o[1]):"30"==e.substr(o[1],2)&&(i.algparam={},i.algparam.p=t.getVbyList(e,o[1],[0],"02"),i.algparam.q=t.getVbyList(e,o[1],[1],"02"),i.algparam.g=t.getVbyList(e,o[1],[2],"02")),"03"!=e.substr(a[1],2))throw new Error("malformed PKCS8 public key(code:004)");return i.key=r(e,a[1]).substr(2),i}}}();Ye.getKey=function(e,t,n){var r=(m=pe).getChildIdx,i=(m.getV,m.getVbyList),a=he.crypto,s=a.ECDSA,o=a.DSA,u=ae,c=$e,l=Ye;if(void 0!==u&&e instanceof u)return e;if(void 0!==s&&e instanceof s)return e;if(void 0!==o&&e instanceof o)return e;if(void 0!==e.curve&&void 0!==e.xy&&void 0===e.d)return new s({pub:e.xy,curve:e.curve});if(void 0!==e.curve&&void 0!==e.d)return new s({prv:e.d,curve:e.curve});if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0===e.d)return(R=new u).setPublic(e.n,e.e),R;if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0!==e.p&&void 0!==e.q&&void 0!==e.dp&&void 0!==e.dq&&void 0!==e.co&&void 0===e.qi)return(R=new u).setPrivateEx(e.n,e.e,e.d,e.p,e.q,e.dp,e.dq,e.co),R;if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0===e.p)return(R=new u).setPrivate(e.n,e.e,e.d),R;if(void 0!==e.p&&void 0!==e.q&&void 0!==e.g&&void 0!==e.y&&void 0===e.x)return(R=new o).setPublic(e.p,e.q,e.g,e.y),R;if(void 0!==e.p&&void 0!==e.q&&void 0!==e.g&&void 0!==e.y&&void 0!==e.x)return(R=new o).setPrivate(e.p,e.q,e.g,e.y,e.x),R;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0===e.d)return(R=new u).setPublic(Se(e.n),Se(e.e)),R;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0!==e.p&&void 0!==e.q&&void 0!==e.dp&&void 0!==e.dq&&void 0!==e.qi)return(R=new u).setPrivateEx(Se(e.n),Se(e.e),Se(e.d),Se(e.p),Se(e.q),Se(e.dp),Se(e.dq),Se(e.qi)),R;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d)return(R=new u).setPrivate(Se(e.n),Se(e.e),Se(e.d)),R;if("EC"===e.kty&&void 0!==e.crv&&void 0!==e.x&&void 0!==e.y&&void 0===e.d){var h=(D=new s({curve:e.crv})).ecparams.keylen/4,f="04"+("0000000000"+Se(e.x)).slice(-h)+("0000000000"+Se(e.y)).slice(-h);return D.setPublicKeyHex(f),D}if("EC"===e.kty&&void 0!==e.crv&&void 0!==e.x&&void 0!==e.y&&void 0!==e.d){h=(D=new s({curve:e.crv})).ecparams.keylen/4,f="04"+("0000000000"+Se(e.x)).slice(-h)+("0000000000"+Se(e.y)).slice(-h);var d=("0000000000"+Se(e.d)).slice(-h);return D.setPublicKeyHex(f),D.setPrivateKeyHex(d),D}if("pkcs5prv"===n){var p,g=e,m=pe;if(9===(p=r(g,0)).length)(R=new u).readPKCS5PrvKeyHex(g);else if(6===p.length)(R=new o).readPKCS5PrvKeyHex(g);else{if(!(p.length>2&&"04"===g.substr(p[1],2)))throw new Error("unsupported PKCS#1/5 hexadecimal key");(R=new s).readPKCS5PrvKeyHex(g)}return R}if("pkcs8prv"===n)return R=l.getKeyFromPlainPrivatePKCS8Hex(e);if("pkcs8pub"===n)return l._getKeyFromPublicPKCS8Hex(e);if("x509pub"===n)return Ze.getPublicKeyFromCertHex(e);if(-1!=e.indexOf("-END CERTIFICATE-",0)||-1!=e.indexOf("-END X509 CERTIFICATE-",0)||-1!=e.indexOf("-END TRUSTED CERTIFICATE-",0))return Ze.getPublicKeyFromCertPEM(e);if(-1!=e.indexOf("-END PUBLIC KEY-")){var v=$e(e,"PUBLIC KEY");return l._getKeyFromPublicPKCS8Hex(v)}if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var y=c(e,"RSA PRIVATE KEY");return l.getKey(y,null,"pkcs5prv")}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var b=i($=c(e,"DSA PRIVATE KEY"),0,[1],"02"),w=i($,0,[2],"02"),x=i($,0,[3],"02"),E=i($,0,[4],"02"),A=i($,0,[5],"02");return(R=new o).setPrivate(new S(b,16),new S(w,16),new S(x,16),new S(E,16),new S(A,16)),R}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){y=c(e,"EC PRIVATE KEY");return l.getKey(y,null,"pkcs5prv")}if(-1!=e.indexOf("-END PRIVATE KEY-"))return l.getKeyFromPlainPrivatePKCS8PEM(e);if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var F=l.getDecryptedKeyHex(e,t),C=new ae;return C.readPKCS5PrvKeyHex(F),C}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var D,R=i($=l.getDecryptedKeyHex(e,t),0,[1],"04"),I=i($,0,[2,0],"06"),T=i($,0,[3,0],"03").substr(2);if(void 0===he.crypto.OID.oidhex2name[I])throw new Error("undefined OID(hex) in KJUR.crypto.OID: "+I);return(D=new s({curve:he.crypto.OID.oidhex2name[I]})).setPublicKeyHex(T),D.setPrivateKeyHex(R),D.isPublic=!1,D}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var $;b=i($=l.getDecryptedKeyHex(e,t),0,[1],"02"),w=i($,0,[2],"02"),x=i($,0,[3],"02"),E=i($,0,[4],"02"),A=i($,0,[5],"02");return(R=new o).setPrivate(new S(b,16),new S(w,16),new S(x,16),new S(E,16),new S(A,16)),R}if(-1!=e.indexOf("-END ENCRYPTED PRIVATE KEY-"))return l.getKeyFromEncryptedPKCS8PEM(e,t);throw new Error("not supported argument")},Ye.generateKeypair=function(e,t){if("RSA"==e){var n=t;(s=new ae).generate(n,"10001"),s.isPrivate=!0,s.isPublic=!0;var r=new ae,i=s.n.toString(16),a=s.e.toString(16);return r.setPublic(i,a),r.isPrivate=!1,r.isPublic=!0,(o={}).prvKeyObj=s,o.pubKeyObj=r,o}if("EC"==e){var s,o,u=t,c=new he.crypto.ECDSA({curve:u}).generateKeyPairHex();return(s=new he.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),s.setPrivateKeyHex(c.ecprvhex),s.isPrivate=!0,s.isPublic=!1,(r=new he.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),r.isPrivate=!1,r.isPublic=!0,(o={}).prvKeyObj=s,o.pubKeyObj=r,o}throw new Error("unknown algorithm: "+e)},Ye.getPEM=function(e,t,n,r,i,a){var s=he,o=s.asn1,u=o.DERObjectIdentifier,c=o.DERInteger,l=o.ASN1Util.newObject,h=o.x509.SubjectPublicKeyInfo,f=s.crypto,d=f.DSA,p=f.ECDSA,m=ae;function v(e){return l({seq:[{int:0},{int:{bigint:e.n}},{int:e.e},{int:{bigint:e.d}},{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.dmp1}},{int:{bigint:e.dmq1}},{int:{bigint:e.coeff}}]})}function y(e){return l({seq:[{int:1},{octstr:{hex:e.prvKeyHex}},{tag:["a0",!0,{oid:{name:e.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]}]})}function b(e){return l({seq:[{int:0},{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}},{int:{bigint:e.y}},{int:{bigint:e.x}}]})}if((void 0!==m&&e instanceof m||void 0!==d&&e instanceof d||void 0!==p&&e instanceof p)&&1==e.isPublic&&(void 0===t||"PKCS8PUB"==t))return Te(E=new h(e).getEncodedHex(),"PUBLIC KEY");if("PKCS1PRV"==t&&void 0!==m&&e instanceof m&&(void 0===n||null==n)&&1==e.isPrivate)return Te(E=v(e).getEncodedHex(),"RSA PRIVATE KEY");if("PKCS1PRV"==t&&void 0!==p&&e instanceof p&&(void 0===n||null==n)&&1==e.isPrivate){var w=new u({name:e.curveName}).getEncodedHex(),x=y(e).getEncodedHex(),S="";return S+=Te(w,"EC PARAMETERS"),S+=Te(x,"EC PRIVATE KEY")}if("PKCS1PRV"==t&&void 0!==d&&e instanceof d&&(void 0===n||null==n)&&1==e.isPrivate)return Te(E=b(e).getEncodedHex(),"DSA PRIVATE KEY");if("PKCS5PRV"==t&&void 0!==m&&e instanceof m&&void 0!==n&&null!=n&&1==e.isPrivate){var E=v(e).getEncodedHex();return void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",E,n,r,a)}if("PKCS5PRV"==t&&void 0!==p&&e instanceof p&&void 0!==n&&null!=n&&1==e.isPrivate){E=y(e).getEncodedHex();return void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",E,n,r,a)}if("PKCS5PRV"==t&&void 0!==d&&e instanceof d&&void 0!==n&&null!=n&&1==e.isPrivate){E=b(e).getEncodedHex();return void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",E,n,r,a)}var A=function(e,t){var n=F(e,t);return new l({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:n.pbkdf2Salt}},{int:n.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:n.encryptionSchemeIV}}]}]}]},{octstr:{hex:n.ciphertext}}]}).getEncodedHex()},F=function(e,t){var n=g.lib.WordArray.random(8),r=g.lib.WordArray.random(8),i=g.PBKDF2(t,n,{keySize:6,iterations:100}),a=g.enc.Hex.parse(e),s=g.TripleDES.encrypt(a,i,{iv:r})+"",o={};return o.ciphertext=s,o.pbkdf2Salt=g.enc.Hex.stringify(n),o.pbkdf2Iter=100,o.encryptionSchemeAlg="DES-EDE3-CBC",o.encryptionSchemeIV=g.enc.Hex.stringify(r),o};if("PKCS8PRV"==t&&null!=m&&e instanceof m&&1==e.isPrivate){var C=v(e).getEncodedHex();E=l({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:C}}]}).getEncodedHex();return void 0===n||null==n?Te(E,"PRIVATE KEY"):Te(x=A(E,n),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==t&&void 0!==p&&e instanceof p&&1==e.isPrivate){C=new l({seq:[{int:1},{octstr:{hex:e.prvKeyHex}},{tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]}]}).getEncodedHex(),E=l({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:e.curveName}}]},{octstr:{hex:C}}]}).getEncodedHex();return void 0===n||null==n?Te(E,"PRIVATE KEY"):Te(x=A(E,n),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==t&&void 0!==d&&e instanceof d&&1==e.isPrivate){C=new c({bigint:e.x}).getEncodedHex(),E=l({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]}]},{octstr:{hex:C}}]}).getEncodedHex();return void 0===n||null==n?Te(E,"PRIVATE KEY"):Te(x=A(E,n),"ENCRYPTED PRIVATE KEY")}throw new Error("unsupported object nor format")},Ye.getKeyFromCSRPEM=function(e){var t=$e(e,"CERTIFICATE REQUEST");return Ye.getKeyFromCSRHex(t)},Ye.getKeyFromCSRHex=function(e){var t=Ye.parseCSRHex(e);return Ye.getKey(t.p8pubkeyhex,null,"pkcs8pub")},Ye.parseCSRHex=function(e){var t=pe,n=t.getChildIdx,r=t.getTLV,i={},a=e;if("30"!=a.substr(0,2))throw new Error("malformed CSR(code:001)");var s=n(a,0);if(s.length<1)throw new Error("malformed CSR(code:002)");if("30"!=a.substr(s[0],2))throw new Error("malformed CSR(code:003)");var o=n(a,s[0]);if(o.length<3)throw new Error("malformed CSR(code:004)");return i.p8pubkeyhex=r(a,o[2]),i},Ye.getKeyID=function(e){var t=Ye,n=pe;"string"==typeof e&&-1!=e.indexOf("BEGIN ")&&(e=t.getKey(e));var r=$e(t.getPEM(e)),i=n.getIdxbyList(r,0,[1]),a=n.getV(r,i).substring(2);return he.crypto.Util.hashHex(a,"sha1")},Ye.getJWKFromKey=function(e){var t={};if(e instanceof ae&&e.isPrivate)return t.kty="RSA",t.n=xe(e.n.toString(16)),t.e=xe(e.e.toString(16)),t.d=xe(e.d.toString(16)),t.p=xe(e.p.toString(16)),t.q=xe(e.q.toString(16)),t.dp=xe(e.dmp1.toString(16)),t.dq=xe(e.dmq1.toString(16)),t.qi=xe(e.coeff.toString(16)),t;if(e instanceof ae&&e.isPublic)return t.kty="RSA",t.n=xe(e.n.toString(16)),t.e=xe(e.e.toString(16)),t;if(e instanceof he.crypto.ECDSA&&e.isPrivate){if("P-256"!==(r=e.getShortNISTPCurveName())&&"P-384"!==r)throw new Error("unsupported curve name for JWT: "+r);var n=e.getPublicKeyXYHex();return t.kty="EC",t.crv=r,t.x=xe(n.x),t.y=xe(n.y),t.d=xe(e.prvKeyHex),t}if(e instanceof he.crypto.ECDSA&&e.isPublic){var r;if("P-256"!==(r=e.getShortNISTPCurveName())&&"P-384"!==r)throw new Error("unsupported curve name for JWT: "+r);n=e.getPublicKeyXYHex();return t.kty="EC",t.crv=r,t.x=xe(n.x),t.y=xe(n.y),t}throw new Error("not supported key object")},ae.getPosArrayOfChildrenFromHex=function(e){return pe.getChildIdx(e,0)},ae.getHexValueArrayOfChildrenFromHex=function(e){var t,n=pe.getV,r=n(e,(t=ae.getPosArrayOfChildrenFromHex(e))[0]),i=n(e,t[1]),a=n(e,t[2]),s=n(e,t[3]),o=n(e,t[4]),u=n(e,t[5]),c=n(e,t[6]),l=n(e,t[7]),h=n(e,t[8]);return(t=new Array).push(r,i,a,s,o,u,c,l,h),t},ae.prototype.readPrivateKeyFromPEMString=function(e){var t=$e(e),n=ae.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8])},ae.prototype.readPKCS5PrvKeyHex=function(e){var t=ae.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},ae.prototype.readPKCS8PrvKeyHex=function(e){var t,n,r,i,a,s,o,u,c=pe,l=c.getVbyListEx;if(!1===c.isASN1HEX(e))throw new Error("not ASN.1 hex string");try{t=l(e,0,[2,0,1],"02"),n=l(e,0,[2,0,2],"02"),r=l(e,0,[2,0,3],"02"),i=l(e,0,[2,0,4],"02"),a=l(e,0,[2,0,5],"02"),s=l(e,0,[2,0,6],"02"),o=l(e,0,[2,0,7],"02"),u=l(e,0,[2,0,8],"02")}catch(e){throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(t,n,r,i,a,s,o,u)},ae.prototype.readPKCS5PubKeyHex=function(e){var t=pe,n=t.getV;if(!1===t.isASN1HEX(e))throw new Error("keyHex is not ASN.1 hex string");var r=t.getChildIdx(e,0);if(2!==r.length||"02"!==e.substr(r[0],2)||"02"!==e.substr(r[1],2))throw new Error("wrong hex for PKCS#5 public key");var i=n(e,r[0]),a=n(e,r[1]);this.setPublic(i,a)},ae.prototype.readPKCS8PubKeyHex=function(e){var t=pe;if(!1===t.isASN1HEX(e))throw new Error("not ASN.1 hex string");if("06092a864886f70d010101"!==t.getTLVbyListEx(e,0,[0,0]))throw new Error("not PKCS8 RSA public key");var n=t.getTLVbyListEx(e,0,[1,0]);this.readPKCS5PubKeyHex(n)},ae.prototype.readCertPubKeyHex=function(e,t){var n,r;(n=new Ze).readCertHex(e),r=n.getPublicKeyHex(),this.readPKCS8PubKeyHex(r)};new RegExp("[^0-9a-f]","gi");function Xe(e,t){for(var n="",r=t/4-e.length,i=0;i<r;i++)n+="0";return n+e}function Je(e,t,n){for(var r="",i=0;r.length<t;)r+=Fe(n(Ce(e+String.fromCharCode.apply(String,[(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i])))),i+=1;return r}function Qe(e){for(var t in he.crypto.Util.DIGESTINFOHEAD){var n=he.crypto.Util.DIGESTINFOHEAD[t],r=n.length;if(e.substring(0,r)==n)return[t,e.substring(r)]}return[]}function Ze(e){var t,n=pe,r=n.getChildIdx,i=n.getV,a=n.getTLV,s=n.getVbyList,o=n.getVbyListEx,u=n.getTLVbyList,c=n.getTLVbyListEx,l=n.getIdxbyList,h=n.getIdxbyListEx,f=n.getVidx,d=n.getInt,p=n.oidname,g=n.hextooidstr,m=$e;try{t=he.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(e){}this.HEX2STAG={"0c":"utf8",13:"prn",16:"ia5","1a":"vis","1e":"bmp"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){if(null===this.hex||0!==this.version)return this.version;var e=u(this.hex,0,[0,0]);if("a0"==e.substr(0,2)){var t=u(e,0,[0]),n=d(t,0);if(n<0||2<n)throw new Error("malformed version field");return this.version=n+1,this.version}return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return o(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var e=c(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(e)},this.getAlgorithmIdentifierName=function(e){for(var n in t)if(e===t[n])return n;return p(o(e,0,[0],"06"))},this.getIssuer=function(){return this.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return u(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){return this.getIssuer().str},this.getSubject=function(){return this.getX500Name(this.getSubjectHex())},this.getSubjectHex=function(){return u(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){return this.getSubject().str},this.getNotBefore=function(){var e=s(this.hex,0,[0,4+this.foffset,0]);return e=e.replace(/(..)/g,"%$1"),e=decodeURIComponent(e)},this.getNotAfter=function(){var e=s(this.hex,0,[0,4+this.foffset,1]);return e=e.replace(/(..)/g,"%$1"),e=decodeURIComponent(e)},this.getPublicKeyHex=function(){return n.getTLVbyList(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyIdx=function(){return l(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var e=this.getPublicKeyIdx();return l(this.hex,e,[1,0],"30")},this.getPublicKey=function(){return Ye.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var e=u(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(e)},this.getSignatureValueHex=function(){return s(this.hex,0,[2],"03",!0)},this.verifySignature=function(e){var t=this.getSignatureAlgorithmField(),n=this.getSignatureValueHex(),r=u(this.hex,0,[0],"30"),i=new he.crypto.Signature({alg:t});return i.init(e),i.updateHex(r),i.verify(n)},this.parseExt=function(e){var t,a,o;if(void 0===e){if(o=this.hex,3!==this.version)return-1;t=l(o,0,[0,7,0],"30"),a=r(o,t)}else{o=$e(e);var u=l(o,0,[0,3,0,0],"06");if("2a864886f70d01090e"!=i(o,u))return void(this.aExtInfo=new Array);t=l(o,0,[0,3,0,1,0],"30"),a=r(o,t),this.hex=o}this.aExtInfo=new Array;for(var c=0;c<a.length;c++){var h={critical:!1},d=0;3===r(o,a[c]).length&&(h.critical=!0,d=1),h.oid=n.hextooidstr(s(o,a[c],[0],"06"));var p=l(o,a[c],[1+d]);h.vidx=f(o,p),this.aExtInfo.push(h)}},this.getExtInfo=function(e){var t=this.aExtInfo,n=e;if(e.match(/^[0-9.]+$/)||(n=he.asn1.x509.OID.name2oid(e)),""!==n)for(var r=0;r<t.length;r++)if(t[r].oid===n)return t[r]},this.getExtBasicConstraints=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("basicConstraints");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var r={extname:"basicConstraints"};if(t&&(r.critical=!0),"3000"===e)return r;if("30030101ff"===e)return r.cA=!0,r;if("30060101ff02"===e.substr(0,12)){var s=i(e,10),o=parseInt(s,16);return r.cA=!0,r.pathLen=o,r}throw new Error("hExtV parse error: "+e)},this.getExtKeyUsage=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("keyUsage");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var r={extname:"keyUsage"};return t&&(r.critical=!0),r.names=this.getExtKeyUsageString(e).split(","),r},this.getExtKeyUsageBin=function(e){if(void 0===e){var t=this.getExtInfo("keyUsage");if(void 0===t)return"";e=a(this.hex,t.vidx)}if(8!=e.length&&10!=e.length)throw new Error("malformed key usage value: "+e);var n="000000000000000"+parseInt(e.substr(6),16).toString(2);return 8==e.length&&(n=n.slice(-8)),10==e.length&&(n=n.slice(-16)),""==(n=n.replace(/0+$/,""))&&(n="0"),n},this.getExtKeyUsageString=function(e){for(var t=this.getExtKeyUsageBin(e),n=new Array,r=0;r<t.length;r++)"1"==t.substr(r,1)&&n.push(Ze.KEYUSAGE_NAME[r]);return n.join(",")},this.getExtSubjectKeyIdentifier=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("subjectKeyIdentifier");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var r={extname:"subjectKeyIdentifier"};t&&(r.critical=!0);var s=i(e,0);return r.kid={hex:s},r},this.getExtAuthorityKeyIdentifier=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("authorityKeyIdentifier");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var s={extname:"authorityKeyIdentifier"};t&&(s.critical=!0);for(var o=r(e,0),u=0;u<o.length;u++){var c=e.substr(o[u],2);if("80"===c&&(s.kid={hex:i(e,o[u])}),"a1"===c){var l=a(e,o[u]),h=this.getGeneralNames(l);s.issuer=h[0].dn}"82"===c&&(s.sn={hex:i(e,o[u])})}return s},this.getExtExtKeyUsage=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("extKeyUsage");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var s={extname:"extKeyUsage",array:[]};t&&(s.critical=!0);for(var o=r(e,0),u=0;u<o.length;u++)s.array.push(p(i(e,o[u])));return s},this.getExtExtKeyUsageName=function(){var e=this.getExtInfo("extKeyUsage");if(void 0===e)return e;var t=new Array,n=a(this.hex,e.vidx);if(""===n)return t;for(var s=r(n,0),o=0;o<s.length;o++)t.push(p(i(n,s[o])));return t},this.getExtSubjectAltName=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("subjectAltName");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var r={extname:"subjectAltName",array:[]};return t&&(r.critical=!0),r.array=this.getGeneralNames(e),r},this.getExtIssuerAltName=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("issuerAltName");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var r={extname:"issuerAltName",array:[]};return t&&(r.critical=!0),r.array=this.getGeneralNames(e),r},this.getGeneralNames=function(e){for(var t=r(e,0),n=[],i=0;i<t.length;i++){var s=this.getGeneralName(a(e,t[i]));void 0!==s&&n.push(s)}return n},this.getGeneralName=function(e){var t=e.substr(0,2),n=i(e,0),r=Fe(n);return"81"==t?{rfc822:r}:"82"==t?{dns:r}:"86"==t?{uri:r}:"87"==t?{ip:He(n)}:"a4"==t?{dn:this.getX500Name(n)}:void 0},this.getExtSubjectAltName2=function(){var e,t,n,s=this.getExtInfo("subjectAltName");if(void 0===s)return s;for(var o=new Array,u=a(this.hex,s.vidx),c=r(u,0),l=0;l<c.length;l++)n=u.substr(c[l],2),e=i(u,c[l]),"81"===n&&(t=Ae(e),o.push(["MAIL",t])),"82"===n&&(t=Ae(e),o.push(["DNS",t])),"84"===n&&(t=Ze.hex2dn(e,0),o.push(["DN",t])),"86"===n&&(t=Ae(e),o.push(["URI",t])),"87"===n&&(t=He(e),o.push(["IP",t]));return o},this.getExtCRLDistributionPoints=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("cRLDistributionPoints");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var i={extname:"cRLDistributionPoints",array:[]};t&&(i.critical=!0);for(var s=r(e,0),o=0;o<s.length;o++){var u=a(e,s[o]);i.array.push(this.getDistributionPoint(u))}return i},this.getDistributionPoint=function(e){for(var t={},n=r(e,0),i=0;i<n.length;i++){var s=e.substr(n[i],2),o=a(e,n[i]);"a0"==s&&(t.dpname=this.getDistributionPointName(o))}return t},this.getDistributionPointName=function(e){for(var t={},n=r(e,0),i=0;i<n.length;i++){var s=e.substr(n[i],2),o=a(e,n[i]);"a0"==s&&(t.full=this.getGeneralNames(o))}return t},this.getExtCRLDistributionPointsURI=function(){var e=this.getExtInfo("cRLDistributionPoints");if(void 0===e)return e;for(var t=new Array,n=r(this.hex,e.vidx),i=0;i<n.length;i++)try{var a=Ae(s(this.hex,n[i],[0,0,0],"86"));t.push(a)}catch(e){}return t},this.getExtAIAInfo=function(){var e=this.getExtInfo("authorityInfoAccess");if(void 0===e)return e;for(var t={ocsp:[],caissuer:[]},n=r(this.hex,e.vidx),i=0;i<n.length;i++){var a=s(this.hex,n[i],[0],"06"),o=s(this.hex,n[i],[1],"86");"2b06010505073001"===a&&t.ocsp.push(Ae(o)),"2b06010505073002"===a&&t.caissuer.push(Ae(o))}return t},this.getExtAuthorityInfoAccess=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("authorityInfoAccess");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var i={extname:"authorityInfoAccess",array:[]};t&&(i.critical=!0);for(var u=r(e,0),c=0;c<u.length;c++){var l=o(e,u[c],[0],"06"),h=Ae(s(e,u[c],[1],"86"));if("2b06010505073001"==l)i.array.push({ocsp:h});else{if("2b06010505073002"!=l)throw new Error("unknown method: "+l);i.array.push({caissuer:h})}}return i},this.getExtCertificatePolicies=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("certificatePolicies");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var i={extname:"certificatePolicies",array:[]};t&&(i.critical=!0);for(var s=r(e,0),o=0;o<s.length;o++){var u=a(e,s[o]),c=this.getPolicyInformation(u);i.array.push(c)}return i},this.getPolicyInformation=function(e){var t={},n=s(e,0,[0],"06");t.policyoid=p(n);var i=h(e,0,[1],"30");if(-1!=i){t.array=[];for(var o=r(e,i),u=0;u<o.length;u++){var c=a(e,o[u]),l=this.getPolicyQualifierInfo(c);t.array.push(l)}}return t},this.getPolicyQualifierInfo=function(e){var t={},n=s(e,0,[0],"06");if("2b06010505070201"===n){var r=o(e,0,[1],"16");t.cps=Fe(r)}else if("2b06010505070202"===n){var i=u(e,0,[1],"30");t.unotice=this.getUserNotice(i)}return t},this.getUserNotice=function(e){for(var t={},n=r(e,0),i=0;i<n.length;i++){var s=a(e,n[i]);"30"!=s.substr(0,2)&&(t.exptext=this.getDisplayText(s))}return t},this.getDisplayText=function(e){var t={};return t.type={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"}[e.substr(0,2)],t.str=Fe(i(e,0)),t},this.getExtCRLNumber=function(e,t){var n={extname:"cRLNumber"};if(t&&(n.critical=!0),"02"==e.substr(0,2))return n.num={hex:i(e,0)},n;throw new Error("hExtV parse error: "+e)},this.getExtCRLReason=function(e,t){var n={extname:"cRLReason"};if(t&&(n.critical=!0),"0a"==e.substr(0,2))return n.code=parseInt(i(e,0),16),n;throw new Error("hExtV parse error: "+e)},this.getExtOcspNonce=function(e,t){var n={extname:"ocspNonce"};t&&(n.critical=!0);var r=i(e,0);return n.hex=r,n},this.getExtOcspNoCheck=function(e,t){var n={extname:"ocspNoCheck"};return t&&(n.critical=!0),n},this.getExtAdobeTimeStamp=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("adobeTimeStamp");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var i={extname:"adobeTimeStamp"};t&&(i.critical=!0);var s=r(e,0);if(s.length>1){var o=a(e,s[1]),u=this.getGeneralName(o);null!=u.uri&&(i.uri=u.uri)}if(s.length>2){var c=a(e,s[2]);"0101ff"==c&&(i.reqauth=!0),"010100"==c&&(i.reqauth=!1)}return i},this.getX500NameRule=function(e){for(var t=null,n=[],r=0;r<e.length;r++)for(var i=e[r],a=0;a<i.length;a++)n.push(i[a]);for(r=0;r<n.length;r++){var s=n[r],o=s.ds,u=s.value,c=s.type;if(":"+o,"prn"!=o&&"utf8"!=o&&"ia5"!=o)return"mixed";if("ia5"==o){if("CN"!=c)return"mixed";if(he.lang.String.isMail(u))continue;return"mixed"}if("C"==c){if("prn"==o)continue;return"mixed"}if(":"+o,null==t)t=o;else if(t!==o)return"mixed"}return null==t?"prn":t},this.getX500Name=function(e){var t=this.getX500NameArray(e);return{array:t,str:this.dnarraytostr(t)}},this.getX500NameArray=function(e){for(var t=[],n=r(e,0),i=0;i<n.length;i++)t.push(this.getRDN(a(e,n[i])));return t},this.getRDN=function(e){for(var t=[],n=r(e,0),i=0;i<n.length;i++)t.push(this.getAttrTypeAndValue(a(e,n[i])));return t},this.getAttrTypeAndValue=function(e){var t={type:null,value:null,ds:null},n=r(e,0),i=s(e,n[0],[],"06"),a=s(e,n[1],[]),o=he.asn1.ASN1Util.oidHexToInt(i);return t.type=he.asn1.x509.OID.oid2atype(o),t.ds=this.HEX2STAG[e.substr(n[1],2)],"bmp"!=t.ds?t.value=Ae(a):t.value=Ne(a),t},this.readCertPEM=function(e){this.readCertHex(m(e))},this.readCertHex=function(e){this.hex=e,this.getVersion();try{l(this.hex,0,[0,7],"a3"),this.parseExt()}catch(e){}},this.getParam=function(){var e={};return e.version=this.getVersion(),e.serial={hex:this.getSerialNumberHex()},e.sigalg=this.getSignatureAlgorithmField(),e.issuer=this.getIssuer(),e.notbefore=this.getNotBefore(),e.notafter=this.getNotAfter(),e.subject=this.getSubject(),e.sbjpubkey=Te(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo.length>0&&(e.ext=this.getExtParamArray()),e.sighex=this.getSignatureValueHex(),e},this.getExtParamArray=function(e){null==e&&(-1!=h(this.hex,0,[0,"[3]"])&&(e=c(this.hex,0,[0,"[3]",0],"30")));for(var t=[],n=r(e,0),i=0;i<n.length;i++){var s=a(e,n[i]),o=this.getExtParam(s);null!=o&&t.push(o)}return t},this.getExtParam=function(e){var t=r(e,0).length;if(2!=t&&3!=t)throw new Error("wrong number elements in Extension: "+t+" "+e);var n=g(s(e,0,[0],"06")),i=!1;3==t&&"0101ff"==u(e,0,[1])&&(i=!0);var a=u(e,0,[t-1,0]),o=void 0;if("2.5.29.14"==n?o=this.getExtSubjectKeyIdentifier(a,i):"2.5.29.15"==n?o=this.getExtKeyUsage(a,i):"2.5.29.17"==n?o=this.getExtSubjectAltName(a,i):"2.5.29.18"==n?o=this.getExtIssuerAltName(a,i):"2.5.29.19"==n?o=this.getExtBasicConstraints(a,i):"2.5.29.31"==n?o=this.getExtCRLDistributionPoints(a,i):"2.5.29.32"==n?o=this.getExtCertificatePolicies(a,i):"2.5.29.35"==n?o=this.getExtAuthorityKeyIdentifier(a,i):"2.5.29.37"==n?o=this.getExtExtKeyUsage(a,i):"1.3.6.1.5.5.7.1.1"==n?o=this.getExtAuthorityInfoAccess(a,i):"2.5.29.20"==n?o=this.getExtCRLNumber(a,i):"2.5.29.21"==n?o=this.getExtCRLReason(a,i):"1.3.6.1.5.5.7.48.1.2"==n?o=this.getExtOcspNonce(a,i):"1.3.6.1.5.5.7.48.1.5"==n?o=this.getExtOcspNoCheck(a,i):"1.2.840.113583.1.1.9.1"==n&&(o=this.getExtAdobeTimeStamp(a,i)),null!=o)return o;var c={extname:n,extn:a};return i&&(c.critical=!0),c},this.findExt=function(e,t){for(var n=0;n<e.length;n++)if(e[n].extname==t)return e[n];return null},this.updateExtCDPFullURI=function(e,t){var n=this.findExt(e,"cRLDistributionPoints");if(null!=n&&null!=n.array)for(var r=n.array,i=0;i<r.length;i++)if(null!=r[i].dpname&&null!=r[i].dpname.full)for(var a=r[i].dpname.full,s=0;s<a.length;s++){var o=a[i];null!=o.uri&&(o.uri=t)}},this.updateExtAIAOCSP=function(e,t){var n=this.findExt(e,"authorityInfoAccess");if(null!=n&&null!=n.array)for(var r=n.array,i=0;i<r.length;i++)null!=r[i].ocsp&&(r[i].ocsp=t)},this.updateExtAIACAIssuer=function(e,t){var n=this.findExt(e,"authorityInfoAccess");if(null!=n&&null!=n.array)for(var r=n.array,i=0;i<r.length;i++)null!=r[i].caissuer&&(r[i].caissuer=t)},this.dnarraytostr=function(e){return"/"+e.map((function(e){return function(e){return e.map((function(e){return function(e){return e.type+"="+e.value}(e).replace(/\+/,"\\+")})).join("+")}(e).replace(/\//,"\\/")})).join("/")},this.getInfo=function(){var e,t,n,r,i=function(e){for(var t="",n=e.array,r=0;r<n.length;r++){var i=n[r];if(t+=" policy oid: "+i.policyoid+"\n",void 0!==i.array)for(var a=0;a<i.array.length;a++){var s=i.array[a];void 0!==s.cps&&(t+=" cps: "+s.cps+"\n")}}return t},a=function(e){for(var t="",n=e.array,r=0;r<n.length;r++){var i=n[r];try{void 0!==i.dpname.full[0].uri&&(t+=" "+i.dpname.full[0].uri+"\n")}catch(e){}try{void 0!==i.dname.full[0].dn.hex&&(t+=" "+Ze.hex2dn(i.dpname.full[0].dn.hex)+"\n")}catch(e){}}return t},s=function(e){for(var t="",n=e.array,r=0;r<n.length;r++){var i=n[r];void 0!==i.caissuer&&(t+=" caissuer: "+i.caissuer+"\n"),void 0!==i.ocsp&&(t+=" ocsp: "+i.ocsp+"\n")}return t};if(e="Basic Fields\n",e+=" serial number: "+this.getSerialNumberHex()+"\n",e+=" signature algorithm: "+this.getSignatureAlgorithmField()+"\n",e+=" issuer: "+this.getIssuerString()+"\n",e+=" notBefore: "+this.getNotBefore()+"\n",e+=" notAfter: "+this.getNotAfter()+"\n",e+=" subject: "+this.getSubjectString()+"\n",e+=" subject public key info: \n",e+=" key algorithm: "+(t=this.getPublicKey()).type+"\n","RSA"===t.type&&(e+=" n="+Ue(t.n.toString(16)).substr(0,16)+"...\n",e+=" e="+Ue(t.e.toString(16))+"\n"),null!=(n=this.aExtInfo)){e+="X509v3 Extensions:\n";for(var o=0;o<n.length;o++){var u=n[o],c=he.asn1.x509.OID.oid2name(u.oid);""===c&&(c=u.oid);var l="";if(!0===u.critical&&(l="CRITICAL"),e+=" "+c+" "+l+":\n","basicConstraints"===c){var h=this.getExtBasicConstraints();void 0===h.cA?e+=" {}\n":(e+=" cA=true",void 0!==h.pathLen&&(e+=", pathLen="+h.pathLen),e+="\n")}else if("keyUsage"===c)e+=" "+this.getExtKeyUsageString()+"\n";else if("subjectKeyIdentifier"===c)e+=" "+this.getExtSubjectKeyIdentifier().kid.hex+"\n";else if("authorityKeyIdentifier"===c){var f=this.getExtAuthorityKeyIdentifier();void 0!==f.kid&&(e+=" kid="+f.kid.hex+"\n")}else{if("extKeyUsage"===c)e+=" "+this.getExtExtKeyUsage().array.join(", ")+"\n";else if("subjectAltName"===c)e+=" "+(r=this.getExtSubjectAltName(),JSON.stringify(r.array).replace(/[\[\]\{\}\"]/g,""))+"\n";else if("cRLDistributionPoints"===c)e+=a(this.getExtCRLDistributionPoints());else if("authorityInfoAccess"===c)e+=s(this.getExtAuthorityInfoAccess());else"certificatePolicies"===c&&(e+=i(this.getExtCertificatePolicies()))}}}return e+="signature algorithm: "+this.getSignatureAlgorithmName()+"\n",e+="signature: "+this.getSignatureValueHex().substr(0,16)+"...\n"},"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?this.readCertPEM(e):he.lang.String.isHex(e)&&this.readCertHex(e))}ae.prototype.sign=function(e,t){var n=function(e){return he.crypto.Util.hashString(e,t)}(e);return this.signWithMessageHash(n,t)},ae.prototype.signWithMessageHash=function(e,t){var n=re(he.crypto.Util.getPaddedDigestInfoHex(e,t,this.n.bitLength()),16);return Xe(this.doPrivate(n).toString(16),this.n.bitLength())},ae.prototype.signPSS=function(e,t,n){var r,i=(r=Ce(e),he.crypto.Util.hashHex(r,t));return void 0===n&&(n=-1),this.signWithMessageHashPSS(i,t,n)},ae.prototype.signWithMessageHashPSS=function(e,t,n){var r,i=Fe(e),a=i.length,s=this.n.bitLength()-1,o=Math.ceil(s/8),u=function(e){return he.crypto.Util.hashHex(e,t)};if(-1===n||void 0===n)n=a;else if(-2===n)n=o-a-2;else if(n<-2)throw new Error("invalid salt length");if(o<a+n+2)throw new Error("data too long");var c="";n>0&&(c=new Array(n),(new ne).nextBytes(c),c=String.fromCharCode.apply(String,c));var l=Fe(u(Ce("\0\0\0\0\0\0\0\0"+i+c))),h=[];for(r=0;r<o-n-a-2;r+=1)h[r]=0;var f=String.fromCharCode.apply(String,h)+""+c,d=Je(l,f.length,u),p=[];for(r=0;r<f.length;r+=1)p[r]=f.charCodeAt(r)^d.charCodeAt(r);var g=65280>>8*o-s&255;for(p[0]&=~g,r=0;r<a;r++)p.push(l.charCodeAt(r));return p.push(188),Xe(this.doPrivate(new S(p)).toString(16),this.n.bitLength())},ae.prototype.verify=function(e,t){if(null==(t=t.toLowerCase()).match(/^[0-9a-f]+$/))return!1;var n=re(t,16),r=this.n.bitLength();if(n.bitLength()>r)return!1;var i=this.doPublic(n).toString(16);if(i.length+3!=r/4)return!1;var a=Qe(i.replace(/^1f+00/,""));if(0==a.length)return!1;var s=a[0];return a[1]==function(e){return he.crypto.Util.hashString(e,s)}(e)},ae.prototype.verifyWithMessageHash=function(e,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var n=re(t,16);if(n.bitLength()>this.n.bitLength())return 0;var r=Qe(this.doPublic(n).toString(16).replace(/^1f+00/,""));if(0==r.length)return!1;r[0];return r[1]==e},ae.prototype.verifyPSS=function(e,t,n,r){var i,a=(i=Ce(e),he.crypto.Util.hashHex(i,n));return void 0===r&&(r=-1),this.verifyWithMessageHashPSS(a,t,n,r)},ae.prototype.verifyWithMessageHashPSS=function(e,t,n,r){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var i,a=new S(t,16),s=function(e){return he.crypto.Util.hashHex(e,n)},o=Fe(e),u=o.length,c=this.n.bitLength()-1,l=Math.ceil(c/8);if(-1===r||void 0===r)r=u;else if(-2===r)r=l-u-2;else if(r<-2)throw new Error("invalid salt length");if(l<u+r+2)throw new Error("data too long");var h=this.doPublic(a).toByteArray();for(i=0;i<h.length;i+=1)h[i]&=255;for(;h.length<l;)h.unshift(0);if(188!==h[l-1])throw new Error("encoded message does not end in 0xbc");var f=(h=String.fromCharCode.apply(String,h)).substr(0,l-u-1),d=h.substr(f.length,u),p=65280>>8*l-c&255;if(0!=(f.charCodeAt(0)&p))throw new Error("bits beyond keysize not zero");var g=Je(d,f.length,s),m=[];for(i=0;i<f.length;i+=1)m[i]=f.charCodeAt(i)^g.charCodeAt(i);m[0]&=~p;var v=l-u-r-2;for(i=0;i<v;i+=1)if(0!==m[i])throw new Error("leftmost octets not zero");if(1!==m[v])throw new Error("0x01 marker not found");return d===Fe(s(Ce("\0\0\0\0\0\0\0\0"+o+String.fromCharCode.apply(String,m.slice(-r)))))},ae.SALT_LEN_HLEN=-1,ae.SALT_LEN_MAX=-2,ae.SALT_LEN_RECOVER=-2,Ze.hex2dn=function(e,t){void 0===t&&(t=0);var n=new Ze;pe.getTLV(e,t);return n.getX500Name(e).str},Ze.hex2rdn=function(e,t){if(void 0===t&&(t=0),"31"!==e.substr(t,2))throw new Error("malformed RDN");for(var n=new Array,r=pe.getChildIdx(e,t),i=0;i<r.length;i++)n.push(Ze.hex2attrTypeValue(e,r[i]));return(n=n.map((function(e){return e.replace("+","\\+")}))).join("+")},Ze.hex2attrTypeValue=function(e,t){var n=pe,r=n.getV;if(void 0===t&&(t=0),"30"!==e.substr(t,2))throw new Error("malformed attribute type and value");var i=n.getChildIdx(e,t);2!==i.length||e.substr(i[0],2);var a=r(e,i[0]),s=he.asn1.ASN1Util.oidHexToInt(a);return he.asn1.x509.OID.oid2atype(s)+"="+Fe(r(e,i[1]))},Ze.getPublicKeyFromCertHex=function(e){var t=new Ze;return t.readCertHex(e),t.getPublicKey()},Ze.getPublicKeyFromCertPEM=function(e){var t=new Ze;return t.readCertPEM(e),t.getPublicKey()},Ze.getPublicKeyInfoPropOfCertPEM=function(e){var t,n,r=pe.getVbyList,i={};return i.algparam=null,(t=new Ze).readCertPEM(e),n=t.getPublicKeyHex(),i.keyhex=r(n,0,[1],"03").substr(2),i.algoid=r(n,0,[0,0],"06"),"2a8648ce3d0201"===i.algoid&&(i.algparam=r(n,0,[0,1],"06")),i},Ze.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"];void 0!==he&&he||(he={}),void 0!==he.jws&&he.jws||(he.jws={}),he.jws.JWS=function(){var e=he.jws.JWS.isSafeJSONString;this.parseJWS=function(t,n){if(void 0===this.parsedJWS||!n&&void 0===this.parsedJWS.sigvalH){var r=t.match(/^([^.]+)\.([^.]+)\.([^.]+)$/);if(null==r)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";var i=r[1],a=r[2],s=r[3],o=i+"."+a;if(this.parsedJWS={},this.parsedJWS.headB64U=i,this.parsedJWS.payloadB64U=a,this.parsedJWS.sigvalB64U=s,this.parsedJWS.si=o,!n){var u=Se(s),c=re(u,16);this.parsedJWS.sigvalH=u,this.parsedJWS.sigvalBI=c}var l=de(i),h=de(a);if(this.parsedJWS.headS=l,this.parsedJWS.payloadS=h,!e(l,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+l}}},he.jws.JWS.sign=function(e,t,n,r,i){var a,s,o,u=he,c=u.jws.JWS,l=c.readSafeJSONString,h=c.isSafeJSONString,f=u.crypto,d=(f.ECDSA,f.Mac),p=f.Signature,g=JSON;if("string"!=typeof t&&"object"!=typeof t)throw"spHeader must be JSON string or object: "+t;if("object"==typeof t&&(s=t,a=g.stringify(s)),"string"==typeof t){if(!h(a=t))throw"JWS Head is not safe JSON string: "+a;s=l(a)}if(o=n,"object"==typeof n&&(o=g.stringify(n)),""!=e&&null!=e||void 0===s.alg||(e=s.alg),""!=e&&null!=e&&void 0===s.alg&&(s.alg=e,a=g.stringify(s)),e!==s.alg)throw"alg and sHeader.alg doesn't match: "+e+"!="+s.alg;var m=null;if(void 0===c.jwsalg2sigalg[e])throw"unsupported alg name: "+e;m=c.jwsalg2sigalg[e];var v=fe(a)+"."+fe(o),y="";if("Hmac"==m.substr(0,4)){if(void 0===r)throw"mac key shall be specified for HS* alg";var b=new d({alg:m,prov:"cryptojs",pass:r});b.updateString(v),y=b.doFinal()}else if(-1!=m.indexOf("withECDSA")){(x=new p({alg:m})).init(r,i),x.updateString(v);var w=x.sign();y=he.crypto.ECDSA.asn1SigToConcatSig(w)}else{var x;if("none"!=m)(x=new p({alg:m})).init(r,i),x.updateString(v),y=x.sign()}return v+"."+xe(y)},he.jws.JWS.verify=function(e,t,n){var r,i=he,a=i.jws.JWS,s=a.readSafeJSONString,o=i.crypto,u=o.ECDSA,c=o.Mac,l=o.Signature;r=ae;var h=e.split(".");if(3!==h.length)return!1;var f=h[0]+"."+h[1],d=Se(h[2]),p=s(de(h[0])),g=null,m=null;if(void 0===p.alg)throw"algorithm not specified in header";if((m=(g=p.alg).substr(0,2),null!=n&&"[object Array]"===Object.prototype.toString.call(n)&&n.length>0)&&-1==(":"+n.join(":")+":").indexOf(":"+g+":"))throw"algorithm '"+g+"' not accepted in the list";if("none"!=g&&null===t)throw"key shall be specified to verify.";if("string"==typeof t&&-1!=t.indexOf("-----BEGIN ")&&(t=Ye.getKey(t)),!("RS"!=m&&"PS"!=m||t instanceof r))throw"key shall be a RSAKey obj for RS* and PS* algs";if("ES"==m&&!(t instanceof u))throw"key shall be a ECDSA obj for ES* algs";var v=null;if(void 0===a.jwsalg2sigalg[p.alg])throw"unsupported alg name: "+g;if("none"==(v=a.jwsalg2sigalg[g]))throw"not supported";if("Hmac"==v.substr(0,4)){if(void 0===t)throw"hexadecimal key shall be specified for HMAC";var y=new c({alg:v,pass:t});return y.updateString(f),d==y.doFinal()}if(-1!=v.indexOf("withECDSA")){var b,w=null;try{w=u.concatSigToASN1Sig(d)}catch(e){return!1}return(b=new l({alg:v})).init(t),b.updateString(f),b.verify(w)}return(b=new l({alg:v})).init(t),b.updateString(f),b.verify(d)},he.jws.JWS.parse=function(e){var t,n,r,i=e.split("."),a={};if(2!=i.length&&3!=i.length)throw"malformed sJWS: wrong number of '.' splitted elements";return t=i[0],n=i[1],3==i.length&&(r=i[2]),a.headerObj=he.jws.JWS.readSafeJSONString(de(t)),a.payloadObj=he.jws.JWS.readSafeJSONString(de(n)),a.headerPP=JSON.stringify(a.headerObj,null," "),null==a.payloadObj?a.payloadPP=de(n):a.payloadPP=JSON.stringify(a.payloadObj,null," "),void 0!==r&&(a.sigHex=Se(r)),a},he.jws.JWS.verifyJWT=function(e,t,n){var r=he.jws,i=r.JWS,a=i.readSafeJSONString,s=i.inArray,o=i.includedArray,u=e.split("."),c=u[0],l=u[1],h=(Se(u[2]),a(de(c))),f=a(de(l));if(void 0===h.alg)return!1;if(void 0===n.alg)throw"acceptField.alg shall be specified";if(!s(h.alg,n.alg))return!1;if(void 0!==f.iss&&"object"==typeof n.iss&&!s(f.iss,n.iss))return!1;if(void 0!==f.sub&&"object"==typeof n.sub&&!s(f.sub,n.sub))return!1;if(void 0!==f.aud&&"object"==typeof n.aud)if("string"==typeof f.aud){if(!s(f.aud,n.aud))return!1}else if("object"==typeof f.aud&&!o(f.aud,n.aud))return!1;var d=r.IntDate.getNow();return void 0!==n.verifyAt&&"number"==typeof n.verifyAt&&(d=n.verifyAt),void 0!==n.gracePeriod&&"number"==typeof n.gracePeriod||(n.gracePeriod=0),!(void 0!==f.exp&&"number"==typeof f.exp&&f.exp+n.gracePeriod<d)&&(!(void 0!==f.nbf&&"number"==typeof f.nbf&&d<f.nbf-n.gracePeriod)&&(!(void 0!==f.iat&&"number"==typeof f.iat&&d<f.iat-n.gracePeriod)&&((void 0===f.jti||void 0===n.jti||f.jti===n.jti)&&!!i.verify(e,t,n.alg))))},he.jws.JWS.includedArray=function(e,t){var n=he.jws.JWS.inArray;if(null===e)return!1;if("object"!=typeof e)return!1;if("number"!=typeof e.length)return!1;for(var r=0;r<e.length;r++)if(!n(e[r],t))return!1;return!0},he.jws.JWS.inArray=function(e,t){if(null===t)return!1;if("object"!=typeof t)return!1;if("number"!=typeof t.length)return!1;for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1},he.jws.JWS.jwsalg2sigalg={HS256:"HmacSHA256",HS384:"HmacSHA384",HS512:"HmacSHA512",RS256:"SHA256withRSA",RS384:"SHA384withRSA",RS512:"SHA512withRSA",ES256:"SHA256withECDSA",ES384:"SHA384withECDSA",PS256:"SHA256withRSAandMGF1",PS384:"SHA384withRSAandMGF1",PS512:"SHA512withRSAandMGF1",none:"none"},he.jws.JWS.isSafeJSONString=function(e,t,n){var r=null;try{return"object"!=typeof(r=le(e))?0:r.constructor===Array?0:(t&&(t[n]=r),1)}catch(e){return 0}},he.jws.JWS.readSafeJSONString=function(e){var t=null;try{return"object"!=typeof(t=le(e))?null:t.constructor===Array?null:t}catch(e){return null}},he.jws.JWS.getEncodedSignatureValueFromJWS=function(e){var t=e.match(/^[^.]+\.[^.]+\.([^.]+)$/);if(null==t)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";return t[1]},he.jws.JWS.getJWKthumbprint=function(e){if("RSA"!==e.kty&&"EC"!==e.kty&&"oct"!==e.kty)throw"unsupported algorithm for JWK Thumprint";var t="{";if("RSA"===e.kty){if("string"!=typeof e.n||"string"!=typeof e.e)throw"wrong n and e value for RSA key";t+='"e":"'+e.e+'",',t+='"kty":"'+e.kty+'",',t+='"n":"'+e.n+'"}'}else if("EC"===e.kty){if("string"!=typeof e.crv||"string"!=typeof e.x||"string"!=typeof e.y)throw"wrong crv, x and y value for EC key";t+='"crv":"'+e.crv+'",',t+='"kty":"'+e.kty+'",',t+='"x":"'+e.x+'",',t+='"y":"'+e.y+'"}'}else if("oct"===e.kty){if("string"!=typeof e.k)throw"wrong k value for oct(symmetric) key";t+='"kty":"'+e.kty+'",',t+='"k":"'+e.k+'"}'}var n=Ce(t);return xe(he.crypto.Util.hashHex(n,"sha256"))},he.jws.IntDate={},he.jws.IntDate.get=function(e){var t=he.jws.IntDate,n=t.getNow,r=t.getZulu;if("now"==e)return n();if("now + 1hour"==e)return n()+3600;if("now + 1day"==e)return n()+86400;if("now + 1month"==e)return n()+2592e3;if("now + 1year"==e)return n()+31536e3;if(e.match(/Z$/))return r(e);if(e.match(/^[0-9]+$/))return parseInt(e);throw"unsupported format: "+e},he.jws.IntDate.getZulu=function(e){return _e(e)},he.jws.IntDate.getNow=function(){return~~(new Date/1e3)},he.jws.IntDate.intDate2UTCString=function(e){return new Date(1e3*e).toUTCString()},he.jws.IntDate.intDate2Zulu=function(e){var t=new Date(1e3*e);return("0000"+t.getUTCFullYear()).slice(-4)+("00"+(t.getUTCMonth()+1)).slice(-2)+("00"+t.getUTCDate()).slice(-2)+("00"+t.getUTCHours()).slice(-2)+("00"+t.getUTCMinutes()).slice(-2)+("00"+t.getUTCSeconds()).slice(-2)+"Z"},void 0!==he&&he||(he={}),void 0!==he.jws&&he.jws||(he.jws={}),he.jws.JWSJS=function(){var e=he.jws.JWS,t=e.readSafeJSONString;this.aHeader=[],this.sPayload="",this.aSignature=[],this.init=function(){this.aHeader=[],this.sPayload=void 0,this.aSignature=[]},this.initWithJWS=function(e){this.init();var t=e.split(".");if(3!=t.length)throw"malformed input JWS";this.aHeader.push(t[0]),this.sPayload=t[1],this.aSignature.push(t[2])},this.addSignature=function(e,t,n,r){if(void 0===this.sPayload||null===this.sPayload)throw"there's no JSON-JS signature to add.";var i=this.aHeader.length;if(this.aHeader.length!=this.aSignature.length)throw"aHeader.length != aSignature.length";try{var a=he.jws.JWS.sign(e,t,this.sPayload,n,r).split(".");a[0],a[2];this.aHeader.push(a[0]),this.aSignature.push(a[2])}catch(e){throw this.aHeader.length>i&&this.aHeader.pop(),this.aSignature.length>i&&this.aSignature.pop(),"addSignature failed: "+e}},this.verifyAll=function(e){if(this.aHeader.length!==e.length||this.aSignature.length!==e.length)return!1;for(var t=0;t<e.length;t++){var n=e[t];if(2!==n.length)return!1;if(!1===this.verifyNth(t,n[0],n[1]))return!1}return!0},this.verifyNth=function(t,n,r){if(this.aHeader.length<=t||this.aSignature.length<=t)return!1;var i=this.aHeader[t],a=this.aSignature[t],s=i+"."+this.sPayload+"."+a,o=!1;try{o=e.verify(s,n,r)}catch(e){return!1}return o},this.readJWSJS=function(e){if("string"==typeof e){var n=t(e);if(null==n)throw"argument is not safe JSON object string";this.aHeader=n.headers,this.sPayload=n.payload,this.aSignature=n.signatures}else try{if(!(e.headers.length>0))throw"malformed header";if(this.aHeader=e.headers,"string"!=typeof e.payload)throw"malformed signatures";if(this.sPayload=e.payload,!(e.signatures.length>0))throw"malformed signatures";this.aSignature=e.signatures}catch(e){throw"malformed JWS-JS JSON object: "+e}},this.getJSON=function(){return{headers:this.aHeader,payload:this.sPayload,signatures:this.aSignature}},this.isEmpty=function(){return 0==this.aHeader.length?1:0}},t.SecureRandom=ne,t.rng_seed_time=X,t.BigInteger=S,t.RSAKey=ae,t.ECDSA=he.crypto.ECDSA,t.DSA=he.crypto.DSA,t.Signature=he.crypto.Signature,t.MessageDigest=he.crypto.MessageDigest,t.Mac=he.crypto.Mac,t.Cipher=he.crypto.Cipher,t.KEYUTIL=Ye,t.ASN1HEX=pe,t.X509=Ze,t.X509CRL=function(e){var t=he.lang.String.isHex,n=pe,r=n.getV,i=n.getTLV,a=n.getVbyList,s=n.getTLVbyList,o=n.getTLVbyListEx,u=n.getIdxbyList,c=n.getIdxbyListEx,l=n.getChildIdx,h=new Ze;this.hex=null,this.posSigAlg=null,this.posRevCert=null,this._setPos=function(){var e=u(this.hex,0,[0,0]),t=this.hex.substr(e,2);if("02"==t)this.posSigAlg=1;else{if("30"!=t)throw new Error("malformed 1st item of TBSCertList: "+t);this.posSigAlg=0}var n,r=u(this.hex,0,[0,this.posSigAlg+3]),i=this.hex.substr(r,2);if("17"==i||"18"==i)n=u(this.hex,0,[0,this.posSigAlg+4]),this.posRevCert=null,-1!=n&&"30"==this.hex.substr(n,2)&&(this.posRevCert=this.posSigAlg+4);else if("30"==i)this.posRevCert=this.posSigAlg+3;else{if("a0"!=i)throw new Error("malformed nextUpdate or revCert tag: "+i);this.posRevCert=null}},this.getVersion=function(){return 0==this.posSigAlg?null:parseInt(a(this.hex,0,[0,0],"02"),16)+1},this.getSignatureAlgorithmField=function(){var e=s(this.hex,0,[0,this.posSigAlg],"30");return h.getAlgorithmIdentifierName(e)},this.getIssuer=function(){var e=s(this.hex,0,[0,this.posSigAlg+1],"30");return h.getX500Name(e)},this.getThisUpdate=function(){var e=a(this.hex,0,[0,this.posSigAlg+2]);return result=Fe(e)},this.getNextUpdate=function(){var e=u(this.hex,0,[0,this.posSigAlg+3]),t=this.hex.substr(e,2);return"17"!=t&&"18"!=t?null:Fe(r(this.hex,e))},this.getRevCertArray=function(){if(null==this.posRevCert)return null;for(var e=[],t=u(this.hex,0,[0,this.posRevCert]),n=l(this.hex,t),r=0;r<n.length;r++){var a=i(this.hex,n[r]);e.push(this.getRevCert(a))}return e},this.getRevCert=function(e){var t={},n=l(e,0);return t.sn={hex:a(e,0,[0],"02")},t.date=Fe(a(e,0,[1])),3==n.length&&(t.ext=h.getExtParamArray(s(e,0,[2]))),t},this.getSignatureValueHex=function(){return a(this.hex,0,[2],"03",!0)},this.verifySignature=function(e){var t=this.getSignatureAlgorithmField(),n=this.getSignatureValueHex(),r=s(this.hex,0,[0],"30"),i=new he.crypto.Signature({alg:t});return i.init(e),i.updateHex(r),i.verify(n)},this.getParam=function(){var e={},t=this.getVersion();null!=t&&(e.version=t),e.sigalg=this.getSignatureAlgorithmField(),e.issuer=this.getIssuer(),e.thisupdate=this.getThisUpdate();var n=this.getNextUpdate();null!=n&&(e.nextupdate=n);var r=this.getRevCertArray();if(null!=r&&(e.revcert=r),-1!=c(this.hex,0,[0,"[0]"])){var i=o(this.hex,0,[0,"[0]",0]);e.ext=h.getExtParamArray(i)}return e.sighex=this.getSignatureValueHex(),e},"string"==typeof e&&(t(e)?this.hex=e:e.match(/-----BEGIN X509 CRL/)&&(this.hex=$e(e)),this._setPos())},t.CryptoJS=g,t.b64tohex=w,t.b64toBA=x,t.ECFieldElementFp=oe,t.ECPointFp=ue,t.ECCurveFp=ce,t.stoBA=ge,t.BAtos=me,t.BAtohex=ve,t.stohex=ye,t.stob64=function(e){return b(ye(e))},t.stob64u=function(e){return be(b(ye(e)))},t.b64utos=function(e){return me(x(we(e)))},t.b64tob64u=be,t.b64utob64=we,t.hex2b64=b,t.hextob64u=xe,t.b64utohex=Se,t.utf8tob64u=fe,t.b64utoutf8=de,t.utf8tob64=function(e){return b(ke(Le(e)))},t.b64toutf8=function(e){return decodeURIComponent(Oe(w(e)))},t.utf8tohex=Ee,t.hextoutf8=Ae,t.hextorstr=Fe,t.rstrtohex=Ce,t.hextob64=De,t.hextob64nl=Re,t.b64nltohex=Ie,t.hextopem=Te,t.pemtohex=$e,t.hextoArrayBuffer=function(e){if(e.length%2!=0)throw"input is not even length";if(null==e.match(/^[0-9A-Fa-f]+$/))throw"input is not hexadecimal";for(var t=new ArrayBuffer(e.length/2),n=new DataView(t),r=0;r<e.length/2;r++)n.setUint8(r,parseInt(e.substr(2*r,2),16));return t},t.ArrayBuffertohex=function(e){for(var t="",n=new DataView(e),r=0;r<e.byteLength;r++)t+=("00"+n.getUint8(r).toString(16)).slice(-2);return t},t.zulutomsec=Pe,t.zulutosec=_e,t.zulutodate=function(e){return new Date(Pe(e))},t.datetozulu=function(e,t,n){var r,i=e.getUTCFullYear();if(t){if(i<1950||2049<i)throw"not proper year for UTCTime: "+i;r=(""+i).slice(-2)}else r=("000"+i).slice(-4);if(r+=("0"+(e.getUTCMonth()+1)).slice(-2),r+=("0"+e.getUTCDate()).slice(-2),r+=("0"+e.getUTCHours()).slice(-2),r+=("0"+e.getUTCMinutes()).slice(-2),r+=("0"+e.getUTCSeconds()).slice(-2),n){var a=e.getUTCMilliseconds();0!==a&&(r+="."+(a=(a=("00"+a).slice(-3)).replace(/0+$/g,"")))}return r+="Z"},t.uricmptohex=ke,t.hextouricmp=Oe,t.ipv6tohex=Be,t.hextoipv6=je,t.hextoip=He,t.iptohex=function(e){var t="malformed IP address";if(!(e=e.toLowerCase(e)).match(/^[0-9.]+$/)){if(e.match(/^[0-9a-f:]+$/)&&-1!==e.indexOf(":"))return Be(e);throw t}var n=e.split(".");if(4!==n.length)throw t;var r="";try{for(var i=0;i<4;i++){r+=("0"+parseInt(n[i]).toString(16)).slice(-2)}return r}catch(e){throw t}},t.ucs2hextoutf8=Ne,t.encodeURIComponentAll=Le,t.newline_toUnix=function(e){return e=e.replace(/\r\n/gm,"\n")},t.newline_toDos=function(e){return e=(e=e.replace(/\r\n/gm,"\n")).replace(/\n/gm,"\r\n")},t.hextoposhex=Ue,t.intarystrtohex=Ve,t.strdiffidx=function(e,t){var n=e.length;e.length>t.length&&(n=t.length);for(var r=0;r<n;r++)if(e.charCodeAt(r)!=t.charCodeAt(r))return r;return e.length!=t.length?n:-1},t.oidtohex=qe,t.hextooid=Ke,t.strpad=ze,t.bitstrtoint=Ge,t.inttobitstr=function(e){var t=Number(e).toString(2),n=8-t.length%8;8==n&&(n=0),t+=ze("",n,"0");var r=parseInt(t,2).toString(16);return r.length%2==1&&(r="0"+r),"0"+n+r},t.KJUR=he,t.crypto=he.crypto,t.asn1=he.asn1,t.jws=he.jws,t.lang=he.lang}).call(this,n(156).Buffer)},function(e,t,n){"use strict";n.r(t);n(144),n(145),n(146),n(147),n(148),n(149),n(151),n(153),n(154),n(19),n(155),n(7),n(13);function r(e,t,n){return{openSimpleModal:function(t){return e.open({templateUrl:t.warning?"js/angular/core/templates/modal/modal-warning.html":"js/angular/core/templates/modal/modal-simple.html",controller:"SimpleModalCtrl",size:t.size,resolve:{title:function(){return t.title},message:function(){return n.trustAsHtml(t.message)}}})},openCopyToClipboardModal:function(n){const r=e.open({templateUrl:"js/angular/core/templates/modal/copy-to-clipboard-modal.html",controller:"CopyToClipboardModalCtrl",resolve:{uri:function(){return n}}});return r.opened.then((function(){t((function(){$("#clipboardURI")[0].select()}),100)})),r}}}function i(e){return{getDetails:function(t){return e.get("rest/explore/details",{params:{uri:t},headers:{Accept:"application/json"}})},getGraph:function(t){const n=encodeURIComponent(t);return e.get("rest/explore/graph?uri="+n+"&role=subject",{headers:{Accept:"application/rdf+json"}})},getNamespaceUriForPrefix:function(e,t){let n="";for(let r=0;r<e.length;r++)if(e[r].prefix===t){n=e[r].uri;break}return n},getNamespacePrefixForUri:function(e,t){let n="";for(let r=0;r<e.length;r++)if(e[r].uri===t){n=e[r].prefix;break}return n},getLocalName:function(e){if(angular.isUndefined(e))return e;{let t;const n=e.length-1;let r=e.toString().lastIndexOf("/");r===n&&(t=e.substr(0,n),r=t.lastIndexOf("/"));let i=e.toString().lastIndexOf("#");return i===n&&(t=e.substr(0,n),i=t.lastIndexOf("/")),e.toString().substring(Math.max(i,r)+1)}}}}angular.module("graphdb.framework.core",["ui.bootstrap","jlareau.bowser","LocalStorageModule","graphdb.framework.core.controllers"]).provider("$menuItems",(function(){const e=function(t,n){for(let r=0;r<t.length;r++){const i=t[r];if(i.label===n)return i;const a=e(i.children,n);if(!angular.isUndefined(a))return a}},t=function(e,t){for(let n=0;n<e.length;n++){if(e[n].label===t)return!0}return!1},n=function(e,t){return e.order<t.order?-1:e.order>t.order?1:0},r=function(e,t){return{label:e.label,href:e.href,hrefFun:e.hrefFun,order:e.order,role:e.role,icon:e.icon,children:t}};let i;const a=[];this.addItem=function(n){if(angular.isUndefined(n.parent))t(a,n.label)||a.push(r(n,[]));else{const i=e(a,n.parent);angular.isUndefined(i)||t(i.children,n.label)||i.children.push(r(n,n.children?n.children:[]))}},this.$get=function(){a.sort(n);for(let e=0;e<a.length;e++){a[e].children.sort(n)}return a},this.setProductInfo=function(e){i=e},this.getProductInfo=function(){return i}})).factory("ModalService",r).factory("ClassInstanceDetailsService",i),r.$inject=["$modal","$timeout","$sce"],i.$inject=["$http"]},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){function n(e,t){return{get:function(t){return e.get(t)},set:function(t,n){e.set(t,n)},keys:n,remove:r,clearAll:function(){e.clearAll()},clearClassHieararchyState:function(){n().forEach((function(e){0!==e.indexOf("classHierarchy-")||e===t.CLASS_HIERARCHY_HIDE_PREFIXES||e.startsWith("classHierarchy-selectedGraph-")||r(e)}))}};function n(){return e.keys()}function r(t){e.remove(t)}}angular.module("graphdb.framework.utils.localstorageadapter",[]).factory("LocalStorageAdapter",n).value("LSKeys",{TABS_STATE:"tabs-state",TABS_STATE_CURRENT_ID:"tabs-state-currentid",TABS_STATE_MAXID:"tabs-state-maxid",VIEW_MODE:"viewMode",CLASS_HIERARCHY_HIDE_PREFIXES:"classHierarchy-hidePrefixes",CLASS_HIERARCHY_CURRENT_SLIDER_VALUE:"classHierarchy-currentSliderValue",CLASS_HIERARCHY_SWITCH_PREFIXES:"classHierarchy-switchPrefixes",CLASS_HIERARCHY_LAST_SELECTED_CLASS:"classHierarchy-lastSelectedClass",DOMAIN_RANGE_WENT_BACK:"domainRange-wentBack",DOMAIN_RANGE_COLLAPSE_EDGES:"domainRange-collapseEdges",HIDE_SIMILARITY_HELP:"hide-similarity-help",TUTORIAL_STATE:"tutorial-state",MENU_STATE:"menu-state",HIDE_GRAPH_CONFIG_HELP:"hide-graph-config-help",GRAPHS_VIZ:"graphs-viz",AUTOCOMPLETE_ENABLED:"autocomplete.enabled",RDF_SEARCH_TYPE:"rdf-search.search-type",RDF_SEARCH_INPUT:"rdf-search.search-input",RDF_SEARCH_EXPANDED_URI:"rdf-search.search-expanded-uri",RDF_RESOURCE_DESCRIPTION:"rdf-search.resource-description"}),n.$inject=["localStorageService","LSKeys"]},function(e,t){angular.module("graphdb.framework.rest.license.service",["ngFileUpload"]).factory("LicenseRestService",i),i.$inject=["$http","Upload"];const n="rest/graphdb-settings/license",r="rest/info/license/";function i(e,t){return{getLicenseInfo:function(){return e.get(n)},getHardcodedLicense:function(){return e.get(`${n}/hardcoded`)},sendLicenseToValidate:function(t){return e.post(`${r}validate`,t,{headers:{Accept:"application/json","Content-Type":"text/plain"}})},extractFromLicenseFile:function(e){return t.upload({url:`${r}toBase64`,file:e,headers:{Accept:"text/plain"}})},checkLicenseHardcoded:function(){return e.get(`${n}/hardcoded`)},registerLicense:function(t){const r=new Uint8Array(t.length);for(let e=0;e<r.length;e++)r[e]=t.charCodeAt(e);return e({method:"POST",url:n,headers:{"Content-Type":"application/octet-stream"},data:r,transformRequest:[]})},getInfo:function(){return e.get("rest/info/properties")},getVersion:function(){return e.get("rest/info/version")},getStatistics:function(){return e.get("rest/graphdb-settings/statistics")},toggleStatistics:function(t){return e({method:"POST",url:"rest/graphdb-settings/statistics",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:`enabled=${t}`})}}}},function(e,t){angular.module("graphdb.framework.rest.repositories.service",[]).factory("RepositoriesRestService",r),r.$inject=["$http"];const n="rest/repositories";function r(e){return{getRepositories:function(){return e.get(n)},getRepository:function(t){return e.get(`${n}/${t}`)},deleteRepository:function(t){return e.delete(`${n}/${t}`)},createRepository:function(t){return e.post(n,t)},editRepository:function(t,r){return e.put(`${n}/${t}`,r)},getRepositoryConfiguration:function(t){return e.get(`${n}/defaultConfig/${t}`)},getSize:function(t){return e.get(`${n}/${t}/size`)},getPrefix:function(t,r){return e.post(`${n}/${t}/prefix`,null,{params:r})},getCluster:function(){return e.get(`${n}/cluster`)},getRepositoryFileContent:function(t){return e.get(`${n}/getFileContent`,{params:{fileLocation:t}})},updateRepositoryFileContent:function(t,r){return e.post(`${n}/updateFile`,JSON.stringify(r),{params:{fileLocation:t}})},validateOntopPropertiesConnection:function(t){return e.post(`${n}/ontop/test-connection`,t)},restartRepository:function(t){return e.post(`${n}/${t}/restart`)},getSupportedDriversData:function(){return e.get(`${n}/ontop/drivers`)},updatePropertiesFile:function(t,r){return e.post(`${n}/ontop/jdbc-properties`,JSON.stringify(r),{params:{fileLocation:t}})},loadPropertiesFile:function(t){return e.get(`${n}/ontop/jdbc-properties`,{params:{fileLocation:t}})},getRepositoriesFromKnownLocation:function(t){return e.get(`${n}?location=${t}`)}}}},function(e,t,n){"use strict";n.r(t);n(4);function r(){return{template:function(e,t){return'<object width="'+t.size+'" height="'+t.size+'" data="js/angular/templates/loader/ot-loader.svg?v=1.10.1">Loading...</object>'}}}function i(){return{template:function(e,t){return'<object width="'+t.size+'" height="'+t.size+'" data="js/angular/templates/loader/ot-loader.svg?v=1.10.1"></object><div>Loading...<div>'}}}function a(e){const t=function(e,n){n.timer=void 0,n.currentMessage=n.getMessage();const r=n.timeout[n.index%n.timeout.length];r&&(n.timer=e((function(){(n.index+1<n.message.length||0===n.message.length)&&(n.index++,t(e,n))}),1e3*r))};return{restrict:"EA",scope:{size:"@",trigger:"@",messageAttr:"=*message",timeoutAttr:"=*timeout",ngShow:"=",ngHide:"="},link:function(n){n.message=n.messageAttr,n.getMessage=function(){return n.message[n.index]},void 0===n.message?n.message=[""]:"function"==typeof n.message?(n.getMessage=n.message,n.message=[]):"object"!=typeof n.message&&(n.message=[n.message]),n.timeout=n.timeoutAttr,void 0===n.timeout?n.timeout=[0]:"object"!=typeof n.timeout&&(n.timeout=[n.timeout]),n.index=0,t(e,n);const r=function(r){n.timer&&e.cancel(n.timer),r&&(n.index=0,t(e,n))};n.$watch("ngShow",(function(e){r(e)})),n.$watch("ngHide",(function(e){r(!e)})),n.$on("$destroy",(function(){n.timer&&e.cancel(n.timer)}))},template:'<div class="ot-loader-new-content"><img width="{{size}}" height="{{size}}" src="js/angular/templates/loader/ot-loader.svg?v=1.10.1"/><div style="font-size: {{size/4}}px">{{currentMessage}}<div></div>'}}function s(e){return{restrict:"EA",transclude:!0,templateUrl:"js/angular/core/templates/core-errors.html",link:function(t,n,r){let i;t.setAttrs(r),t.setRestricted(),t.getAccessibleRepositories=function(){return t.isRestricted?t.getWritableRepositories():t.getReadableRepositories()},t.showPopoverForRepo=function(n,r){t.hidePopoverForRepo(),t.setPopoverRepo(r),e((function(){const e=$(n.toElement).find(".popover-anchor")[0];i=e,e&&!t.getActiveRepository()&&e.dispatchEvent(new Event("show"))})),n.stopPropagation()},t.hidePopoverForRepo=function(t){if(t){let e=t.relatedTarget;for(;e;){if(0===e.className.indexOf("popover"))return;e=e.parentElement}}i&&e((function(){i&&(i.dispatchEvent(new Event("hide")),i=null)})),t&&t.stopPropagation()}}}}function o(){return function(e,t){$(t).click((function(e){e.preventDefault(),e.stopPropagation()}))}}function u(){return{restrict:"A",require:"ngModel",link:function(e,t,n,r){e.multiRequired||(e.multiRequired=[]);const i=n.multiRequireElement,a=function(t){i&&i%1==0&&(e.multiRequired[i-1]=t)},s=function(){let t=!1,n=!1;for(let r=0;r<e.multiRequired.length;r++)e.multiRequired[r]?t=!0:n=!0;r.$setValidity("multiRequire",!(t&&n))};r.$parsers.unshift((function(e){return a(e),s(),e})),r.$formatters.unshift((function(e){return a(e),s(),e})),$("[multi-required]").on("blur keyup change focusout",(function(){s()}))}}}angular.module("graphdb.framework.core.directives",["graphdb.framework.core.services.repositories","graphdb.framework.utils.localstorageadapter"]).directive("ontoLoader",r).directive("ontoLoaderFancy",i).directive("ontoLoaderNew",a).directive("coreErrors",s).directive("eatClick",o).directive("multiRequired",u).directive("searchResourceInput",l).directive("keyboardShortcuts",h),r.$inject=[],i.$inject=[],a.$inject=["$timeout"],s.$inject=["$timeout"],o.$inject=[],u.$inject=[];const c={table:"table",visual:"visual"};function l(e,t,n,r,i,a,s,o,u,l){return{restrict:"EA",scope:{namespacespromise:"=",autocompletepromisestatus:"=",textButton:"@",visualButton:"@",textCallback:"&",visualCallback:"&",placeholder:"@",uriValidation:"@",preserveInput:"@",empty:"=",clear:"=?clear",openInNewTab:"@",preserveSearch:"@",radioButtons:"@",clearInputIcon:"@"},templateUrl:"js/angular/core/templates/search-resource-input.html",link:function(i,h,f){h.autoCompleteStatus=void 0,h.autoCompleteWarning=!1,i.empty=!1,i.clear=!1,i.searchDisplayType=c;const d="true"===i.preserveSearch,p=h.find(".view-res-input");let g,m;i.textButtonLabel=i.textButton||"Table",i.visualButtonLabel=i.visualButton||"Visual",i.showClearInputIcon=!1,i.searchType=o.get(u.RDF_SEARCH_TYPE)||c.table,i.searchInput="",i.changeSearchType=function(e){i.searchType=e,o.set(u.RDF_SEARCH_TYPE,i.searchType)},i.clearInput=function(){i.searchInput="",i.selectedElementIndex=-1,i.autoCompleteUriResults=[],i.showClearInputIcon=!1,o.remove(u.RDF_SEARCH_INPUT),o.remove(u.RDF_SEARCH_EXPANDED_URI),o.remove(u.RDF_RESOURCE_DESCRIPTION)},i.$watch("namespacespromise",(function(){angular.isDefined(i.namespacespromise)&&i.namespacespromise.success((function(e){h.namespaces=e.results.bindings.map((function(e){return{prefix:e.prefix.value,uri:e.namespace.value}}))})).error((function(e){const n=getError(e);t.error(n,"Error getting namespaces for repository.")}))})),i.$watch("autocompletepromisestatus",(function(){!l.isActiveRepoFedXType()&&angular.isDefined(i.autocompletepromisestatus)&&i.autocompletepromisestatus.success((function(e){h.autoCompleteStatus=!!e,""!==i.searchInput&&i.onChange()})).error((function(){t.error("Error attempting to check autocomplete capability!")}))})),i.$watch("empty",(function(){d||(i.searchInput="",i.empty=!1)})),i.$watch("clear",(function(){i.clear&&(i.clearInput(),i.clear=!1)}));const v=function(t){const n=t.type||"uri";"true"===i.openInNewTab?b(!1,t):e.path("resource").search(n,t.uri)},y=function(t){const n=t.type||"uri";"true"===i.openInNewTab?b(!0,t):e.path("graphs-visualizations").search(n,t.uri)},b=function(e,t){const n=e?"graphs-visualizations":"resource";window.open(`${n}?uri=${encodeURIComponent(t.uri)}`)};angular.isUndefined(f.$attr.textCallback)&&(i.textCallback=v),angular.isUndefined(f.$attr.visualCallback)&&(i.visualCallback=y),f.$attr.textButton&&!i.textButton?i.textCallback=i.visualCallback:f.$attr.visualButton&&!i.visualButton&&(i.visualCallback=i.textCallback),f.$attr.placeholder?i.placeholder=f.$attr.placeholder:i.placeholder="Search RDF resources...",angular.isDefined(f.$attr.uriValidation)?i.uriValidation=f.$attr.uriValidation:i.uriValidation="true",angular.isDefined(f.$attr.preserveInput)&&(i.preserveInput=f.$attr.preserveInput),i.getResultItemHtml=function(e){return s.trustAsHtml(e.description)},i.searchRdfResource=function(e,t){if("prefix"===e.type)i.searchInput=E(e.value+":"),p.focus(),i.onChange();else{let n;n=angular.isUndefined(e)?i.searchInput:"object"==typeof e?e.value:e;let r="";if(e.description){const t=e.description.indexOf("<"+n+">");t>0&&(r=e.description.substring(0,t).replace(/<\/?b>/g,""))}t({uri:n,description:e.description,label:r,type:e.type}),d?(i.selectedElementIndex=i.activeSearchElm,o.set(u.RDF_SEARCH_EXPANDED_URI,g),o.set(u.RDF_SEARCH_INPUT,i.searchInput),o.set(u.RDF_RESOURCE_DESCRIPTION,e.description)):"true"===i.preserveInput?(i.searchInput=n,i.autoCompleteUriResults=[]):(i.searchInput="",i.autoCompleteUriResults=[])}},i.searchRdfResourceByEvent=function(e,t){i.searchType===c.visual||t.ctrlKey||t.metaKey?i.searchRdfResource(e,i.visualCallback):i.searchRdfResource(e,i.textCallback)};const w=function(e){const n=i.searchInput;""!==n?"false"!==i.uriValidation?h.autoCompleteStatus&&i.autoCompleteUriResults&&i.autoCompleteUriResults.length>0?"prefix"===i.autoCompleteUriResults[i.activeSearchElm].type?(i.searchInput=E(i.autoCompleteUriResults[i.activeSearchElm].value+":"),i.autoCompleteUriResults=[]):i.searchRdfResource(i.autoCompleteUriResults[i.activeSearchElm],e):S(n)?i.searchRdfResource(n,e):t.error("Invalid URI"):i.searchRdfResource(n,e):t.error("Please fill input field!")};function x(){let e=-1;const n=o.get(u.RDF_RESOURCE_DESCRIPTION);n&&i.autoCompleteUriResults&&(e=i.autoCompleteUriResults.findIndex(e=>e.description===n),i.selectedElementIndex=e,new Promise(e=>{const t=document.getElementById("auto-complete-results-wrapper").getBoundingClientRect();setTimeout(()=>{e(t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth))})}).then((function(){!function(){const e=$("#auto-complete-results-wrapper"),t=$("#auto_"+i.selectedElementIndex);e.animate({scrollTop:t.offset().top-e.offset().top+e.scrollTop()})}()})).catch((function(e){t.error(getError(e),"Could not find previous search element in menu!")}))),i.activeSearchElm=-1===e?0:e}function S(e){const t=e.indexOf("<")>=0&&e.indexOf(">")>=0,n=-1===e.indexOf("<")&&-1===e.lastIndexOf(">"),r=/^<?(http|urn).*>?/.test(e)&&(t||n);let i=!1;if(r)if(e.indexOf("http")>=0){const t=e.indexOf("//");i=t>4&&e.substring(t+2).length>0}else e.indexOf("urn")>=0&&(i=e.substring(4).length>0);return r&&i}function E(e){if(!/^<?(http|urn).*>?/.test(e)){const t=e.split(":"),r=t[0],i=t[1];if(!angular.isUndefined(i)){const e=n.getNamespaceUriForPrefix(h.namespaces,r);if(g=e!==g?e:g,g)return p.val(g),g+i}}return e}i.checkIfValidAndSearchText=function(){w(i.textCallback)},i.checkIfValidAndSearchVisual=function(){w(i.visualCallback)},i.checkIfValidAndSearchEvent=function(e){i.searchType===c.visual||e.ctrlKey||e.metaKey?w(i.visualCallback):w(i.textCallback)},i.onChange=function(){return i.showClearInputIcon=i.clearInputIcon,d&&o.set(u.RDF_SEARCH_INPUT,i.searchInput),"false"!==i.uriValidation&&(i.searchInput=E(i.searchInput),h.autoCompleteStatus)?function(e){let t=e.replace(g,g+";");if(h.autoCompleteStatus)return";"===t.charAt(0)&&(t=t.slice(1)),t=function(e){let t=e;if(-1===t.indexOf(";")&&S(t)){t=t.replace(/<|>/g,"");const e=/[^/^#]*$/.exec(t)[0];return t.split(e)[0]+";"+e}return t}(t),m&&m.resolve(),m=a.defer(),r.getAutocompleteSuggestions(t,m.promise).then((function(e){m=null,i.autoCompleteUriResults=e.data.suggestions,i.activeSearchElm=0}));return Promise.resolve()}(i.searchInput):Promise.resolve()},i.onKeyDown=function(e){if(13===e.keyCode?(e.preventDefault(),"false"!==i.uriValidation?h.autoCompleteStatus?i.checkIfValidAndSearchEvent(e):S(e.target.value)?i.searchRdfResourceByEvent(e.target.value,e):t.error("Invalid URI"):i.searchRdfResourceByEvent(e.target.value,e)):i.searchInput.length>0&&!h.autoCompleteWarning&&!h.autoCompleteStatus&&(h.autoCompleteWarning=!0,t.warning("",'<div class="autocomplete-toast"><a href="autocomplete">Autocomplete is OFF<br>Go to Setup -> Autocomplete</a></div>',{allowHtml:!0})),h.autoCompleteStatus&&!angular.isUndefined(i.autoCompleteUriResults)){if(40===e.keyCode&&i.activeSearchElm<i.autoCompleteUriResults.length-1&&(i.activeSearchElm++,i.searchInput=i.autoCompleteUriResults[i.activeSearchElm].value,function(){const e=$("#auto-complete-results-wrapper"),t=e.children("div"),n=e.children("div.active");void 0!==n[0]&&n[0].offsetTop-t.height()-6-e.scrollTop()>170&&e.scrollTop(n[0].offsetTop-t.height()-6-170)}()),38===e.keyCode&&i.activeSearchElm>0&&(e.preventDefault(),i.activeSearchElm--,i.searchInput=i.autoCompleteUriResults[i.activeSearchElm].value,function(){const e=$("#auto-complete-results-wrapper"),t=e.children("div"),n=e.children("div.active");void 0!==n[0]&&n[0].offsetTop-t.height()-40<=e.scrollTop()&&e.scrollTop(e.scrollTop()-34)}()),27===e.keyCode){if(d)return;i.searchInput="",i.autoCompleteUriResults=[]}i.searchInput||i.clearInput()}},i.$on("rdfResourceSearchExpanded",(function(){(d?(i.preserveInput="true",i.searchInput=o.get(u.RDF_SEARCH_INPUT)||"",g=o.get(u.RDF_SEARCH_EXPANDED_URI),i.onChange()):Promise.resolve()).then((function(){x()}))})),i.setActiveClassOnMouseMove=function(e){h.autoCompleteStatus&&(i.activeSearchElm=e)}}}}function h(e){return{restrict:"AE",link:function(t,n,r){function i(e){27===e.keyCode&&(t.toggleCheatSheet(),t.$apply())}t.getTemplateUrl=function(){return r.templateUrl},t.shortcutsVisible=!1,t.toggleCheatSheet=function(){t.shortcutsVisible=!t.shortcutsVisible,t.shortcutsVisible?e.on("keydown",i):e.off("keydown",i)}},template:'<ng-include src="getTemplateUrl()" />'}}l.$inject=["$location","toastr","ClassInstanceDetailsService","AutocompleteRestService","$rootScope","$q","$sce","LocalStorageAdapter","LSKeys","$repositories"],h.$inject=["$document"]},function(e,t,n){"use strict";n.r(t);n(2),n(6),n(21),n(5),n(25),n(26);angular.module("graphdb.framework.core.services.repositories",["ngCookies","graphdb.framework.rest.repositories.service","graphdb.framework.rest.locations.service","graphdb.framework.rest.license.service","toastr"]).service("$repositories",["$http","toastr","$rootScope","$timeout","$location","productInfo","$jwtAuth","RepositoriesRestService","LocationsRestService","LicenseRestService",function(e,t,n,r,i,a,s,o,u,c){this.repositoryStorageName="com.ontotext.graphdb.repository",this.location="",this.locationError="",this.loading=!0,this.repository=localStorage.getItem(this.repositoryStorageName),this.locations=[],this.repositories=[],this.locationsShouldReload=!1,this.degradedReason="";const l=this,h=function(e,n){l.loading=!1,e&&(l.location="",l.locationError=n,l.repositories=[],l.setRepository(""),e.statusText?t.error(e.statusText,"Error loading location"):t.error("Error loading location"))};this.resetActiveRepository=function(){let e=!1;for(let t=0;t<this.repositories.length;t++){if(this.repositories[t].id===this.repository){e=!0;break}}e?s.canReadRepo(this.location,this.repository)?n.$broadcast("repositoryIsSet",{newRepo:!1}):this.setRepository(""):this.setRepository(this.location.defaultRepository?this.location.defaultRepository:"")},this.checkActiveLocationDegraded=function(){if(this.degradedReason="",this.location.local)return;const e=this;c.getVersion().success((function(t){"object"==typeof t?t.productVersion!==a.productVersion?e.degradedReason="The remote location is running a different GraphDB version.":t.productType!==a.productType&&(e.degradedReason="The remote location is running a different GraphDB edition."):e.degradedReason="The remote location is running a different GraphDB version."})).error((function(){e.degradedReason="The remote location is running a different GraphDB version."}))},this.getDegradedReason=function(){return this.degradedReason},this.initQuick=function(){this.hasActiveLocation()&&this.init(null,null,!0)},this.init=function(e,t,r){r||(this.locationsShouldReload=!0),this.loading=!0,u.getActiveLocation().then((function(i){if(i.data){const r=i.data;r.active&&o.getRepositories().then((function(t){l.location=r,l.repositories=t.data,l.resetActiveRepository(),h(),l.checkActiveLocationDegraded(),n.globalLocation=l.location,n.globalRepositories=l.repositories,e&&e()}),(function(e){h(e,r.errorMsg),t&&t()}))}else h(),r&&(l.locationsShouldReload=!0),l.location="",l.locationError="",l.repositories=[],l.setRepository("");n.globalLocation=l.location,n.globalRepositories=l.repositories}),(function(e){h(e),t&&t()}))},this.getLocations=function(){if(this.locationsShouldReload){this.locationsShouldReload=!1,this.locations=[this.location];const e=this;u.getLocations().success((function(t){e.locations=t})).error((function(){r((function(){e.locationsShouldReload=!0}),2e3)}))}return this.locations},this.getActiveLocation=function(){return this.location},this.hasActiveLocation=function(){return!_.isEmpty(this.location)},this.getLocationError=function(){return this.locationError?this.locationError:"There is no active location"},this.isLoadingLocation=function(){return this.loading},this.getRepositories=function(){return this.repositories},this.getReadableRepositories=function(){const e=this;return _.filter(this.getRepositories(),(function(t){return s.canReadRepo(e.location,t.id)}))},this.getWritableRepositories=function(){const e=this;return _.filter(this.getRepositories(),(function(t){return s.canWriteRepo(e.location,t.id)&&!e.isActiveRepoOntopType(t.id)}))},this.getActiveRepository=function(){return this.repository},this.isSystemRepository=function(){return"SYSTEM"===this.repository},this.isActiveRepoOntopType=function(e){const t=this;e||(e=t.getActiveRepository());let n=t.repositories.find(t=>t.id===e);return n?"graphdb:OntopRepository"===n.sesameType:void 0===n},this.isActiveRepoFedXType=function(){const e=this;let t=e.repositories.find(t=>t.id===e.getActiveRepository());return t?"graphdb:FedXRepository"===t.sesameType:void 0===t},this.setRepositoryHeaders=function(){const t=this.repository?this.repository:void 0;e.defaults.headers.common["X-GraphDB-Repository"]=t,$.ajaxSetup().headers=$.ajaxSetup().headers||{},$.ajaxSetup().headers["X-GraphDB-Repository"]=t},this.setRepositoryHeaders(),this.setRepository=function(e){this.repository=e,e?localStorage.setItem(this.repositoryStorageName,this.repository):localStorage.removeItem(this.repositoryStorageName),this.setRepositoryHeaders(e),n.$broadcast("repositoryIsSet",{newRepo:!0}),e&&!s.canReadRepo(this.location,e)&&this.setRepository(""),n.deniedPermissions={}},this.getDefaultRepository=function(){return this.hasActiveLocation()?this.location.defaultRepository:""},this.setDefaultRepository=function(e){if(!this.hasActiveLocation())return void t.error("No active location","Error");const n=this;u.setDefaultRepository(e).success((function(){n.location.defaultRepository=e})).error((function(e){const n=getError(e);t.error(n,"Error")}))},this.deleteLocation=function(e){u.deleteLocation(encodeURIComponent(e)).success((function(){l.getActiveLocation().uri===e&&(l.location="",l.locationError="",l.setRepository("")),l.init()})).error((function(e){const n=getError(e);t.error(n,"Error")}))},this.deleteRepository=function(e){o.deleteRepository(e).success((function(){l.init()})).error((function(e){const n=getError(e);t.error(n,"Error")})),l.getActiveRepository()===e&&l.setRepository("")},this.restartRepository=function(e){o.restartRepository(e).success((function(){t.success(`Restarting repository ${e}`),l.initQuick()})).error((function(e){const n=getError(e);t.error(n,"Error")}))},this.getRepositoryTurtleConfig=function(t){return e.get("rest/repositories/"+t.id,{headers:{Accept:"text/turtle"}})},n.$on("securityInit",(function(e,t,n,r){(!t||n||r)&&l.init()}))}])},function(e,t,n){"use strict";n.r(t);n(2),n(17),n(18);var r=n(0);angular.module("graphdb.framework.core.services.jwtauth",["toastr","graphdb.framework.rest.security.service","graphdb.framework.core.services.openIDService"]).service("$jwtAuth",["$http","toastr","$location","$rootScope","SecurityRestService","$openIDAuth",function(e,t,n,i,a,s){const o=this;i.deniedPermissions={},i.setPermissionDenied=function(e){return!("/"===e||"/login"===e||!o.isAuthenticated())&&(i.deniedPermissions[e]=!0,!0)},i.hasPermission=function(){const e=n.path();return!i.deniedPermissions[e]},i.redirectToLogin=function(e,t){return o.authTokenIsType("Bearer")&&(e=!0),o.clearAuthenticationInternal(),0!==n.url().indexOf("/login")&&(i.returnToUrl=n.url()),n.path("/login"),t?n.search("noaccess"):e&&n.search("expired"),new Promise(e=>{setTimeout(()=>{e(!0)},100)})},i.hasExternalAuthUser=function(){return o.hasExternalAuthUser()},this.authStorageName="com.ontotext.graphdb.auth",this.securityEnabled=!0,this.freeAccess=!1,this.hasOverrideAuth=!1,this.externalAuthUser=!1,this.securityInitialized=!1;const u=this;this.clearStorage=function(){localStorage.removeItem(u.authStorageName)},this.getAuthenticatedUserFromBackend=function(e,t){a.getAuthenticatedUser().success((function(e,t,n){u.auth&&u.auth.startsWith("GDB")?(u.externalAuthUser=!1,u.principal=e,i.$broadcast("securityInit",u.securityEnabled,!0,u.freeAccess)):u.openIDEnabled&&u.auth&&u.auth.startsWith("Bearer")?u.authenticate(e,u.auth):(u.externalAuthUser=!0,u.authenticate(e,""))})).error((function(){e||!u.freeAccess?i.redirectToLogin(!1,t):(u.securityInitialized=!0,u.hasExplicitAuthentication()||u.clearAuthentication())}))},this.initSecurity=function(){this.securityInitialized=!1,this.auth=localStorage.getItem(this.authStorageName),a.getSecurityConfig().then((function(e){if(u.securityEnabled=e.data.enabled,u.externalAuth=e.data.hasExternalAuth,u.authImplementation=e.data.authImplementation,u.openIDEnabled=e.data.openIdEnabled,u.passwordLoginEnabled=e.data.passwordLoginEnabled,u.securityEnabled){const t=e.data.freeAccess;u.freeAccess=t.enabled,u.freeAccess&&(u.freeAccessPrincipal={authorities:t.authorities,appSettings:t.appSettings}),u.openIDEnabled?(u.openIDConfig=e.data.methodSettings.openid,u.gdbUrl=n.absUrl().replace(n.url().substr(1),""),s.initOpenId(u.openIDConfig,u.gdbUrl,(function(e){u.auth=s.authHeaderGraphDB(),o.setAuthHeaders(),console.log("oidc: set id/access token as GraphDB auth"),u.getAuthenticatedUserFromBackend(!0,e)}),(function(){console.log("oidc: not logged or login error"),u.authTokenIsType("Bearer")?setTimeout(()=>{i.redirectToLogin(!0)},0):u.getAuthenticatedUserFromBackend()}))):u.getAuthenticatedUserFromBackend()}else{u.clearStorage();const t=e.data.overrideAuth;u.hasOverrideAuth=t.enabled,u.hasOverrideAuth?(u.principal={username:"overrideauth",authorities:t.authorities,appSettings:t.appSettings},i.$broadcast("securityInit",u.securityEnabled,!0,u.hasOverrideAuth)):a.getAdminUser().then((function(e){u.principal={username:"admin",appSettings:e.data.appSettings,authorities:e.data.grantedAuthorities},i.$broadcast("securityInit",u.securityEnabled,!0,u.hasOverrideAuth)}))}}))},this.initSecurity(),this.isSecurityEnabled=function(){return this.securityEnabled},this.hasExternalAuth=function(){return this.externalAuth},this.getAuthImplementation=function(){return this.authImplementation},this.isFreeAccessEnabled=function(){return this.freeAccess},this.isDefaultAuthEnabled=function(){return this.hasOverrideAuth&&this.principal&&"overrideauth"===this.principal.username},this.getAuthToken=function(){return this.auth},this.authTokenIsType=function(e){return this.auth&&this.auth.startsWith(e)},this.loginOpenID=function(){s.login(this.openIDConfig,this.gdbUrl)},this.toggleSecurity=function(e){e!==this.securityEnabled&&(this.securityEnabled=e,a.toggleSecurity(e).then((function(){t.success("Security has been "+(e?"enabled.":"disabled.")),u.clearStorage(),u.initSecurity()}),(function(e){t.error(e.data.error.message,"Error")})))},this.toggleFreeAccess=function(e,n,r,s){(e!==this.freeAccess||s)&&(this.freeAccess=e,this.freeAccessPrincipal=e?{authorities:n,appSettings:r}:void 0,a.setFreeAccess({enabled:e?"true":"false",authorities:n,appSettings:r}).then((function(){s?t.success("Free access settings have been updated."):t.success("Free access has been "+(e?"enabled.":"disabled."))}),(function(e){t.error(e.data.error.message,"Error")})),i.$broadcast("securityInit",this.securityEnabled,this.hasExplicitAuthentication(),this.freeAccess))},this.setAuthHeaders=function(){const t=this.auth?this.auth:void 0;e.defaults.headers.common.Authorization=t,e.defaults.headers.common["X-Requested-With"]="XMLHttpRequest",$.ajaxSetup().headers=$.ajaxSetup().headers||{},$.ajaxSetup().headers.Authorization=t,$.ajaxSetup().headers["X-Requested-With"]="XMLHttpRequest"},this.setAuthHeaders(),this.authenticate=function(e,t){this.clearStorage(),t&&(this.auth=t,localStorage.setItem(this.authStorageName,this.auth),this.externalAuthUser=!1),this.principal=e,this.setAuthHeaders(),i.deniedPermissions={},this.securityInitialized=!0,i.$broadcast("securityInit",this.securityEnabled,this.hasExplicitAuthentication(),this.freeAccess)},this.authenticateOpenID=function(e){this.clearStorage(),e&&(this.auth=e,localStorage.setItem(this.authStorageName,this.auth),this.externalAuthUser=!1)},this.hasExternalAuthUser=function(){return this.externalAuthUser},this.hasExplicitAuthentication=function(){return null!=this.auth||this.externalAuthUser},this.getPrincipal=function(){return this.principal},this.clearAuthenticationInternal=function(){s.softLogout(),this.auth=null,this.principal=this.freeAccessPrincipal,this.clearStorage(),this.setAuthHeaders()},this.clearAuthentication=function(){this.clearAuthenticationInternal(),i.$broadcast("securityInit",this.securityEnabled,!1,this.freeAccess)},this.isAuthenticated=function(){return!this.securityEnabled||this.hasExplicitAuthentication()},this.hasPermission=function(){},this.hasRole=function(e){if(void 0!==e&&(this.securityEnabled||this.hasOverrideAuth)){"string"==typeof e&&(e=[e]);const t=!_.isEmpty(this.principal);return!!t&&("IS_AUTHENTICATED_FULLY"===e[0]?t:_.intersection(e,this.principal.authorities).length>0)}return!0},this.isAdmin=function(){return this.hasRole(r.UserRole.ROLE_ADMIN)},this.checkForWrite=function(e,t,n){return"WRITE_REPO"===e?this.canWriteRepo(t,n):this.hasRole(e)},this.hasAdminRole=function(){return this.isAdmin()||this.hasRole(r.UserRole.ROLE_REPO_MANAGER)},this.canWriteRepo=function(e,t){return!_.isEmpty(e)&&!_.isEmpty(t)&&(!this.securityEnabled&&!this.hasOverrideAuth||!_.isEmpty(this.principal)&&(!!this.hasAdminRole()||this.checkRights(e,t,"WRITE")))},this.canReadRepo=function(e,t){return!_.isEmpty(e)&&!_.isEmpty(t)&&(!this.securityEnabled||!_.isEmpty(this.principal)&&(!!this.hasAdminRole()||this.checkRights(e,t,"READ")))},this.checkRights=function(e,t,n){for(let e=0;e<this.principal.authorities.length;e++){const r=this.principal.authorities[e],i=r.split("_",2),a=r.slice(i[0].length+i[1].length+2);if(i[0]===n&&(a===t||"SYSTEM"!==t&&"*"===a))return!0}return!1}}])},function(e,t){angular.module("graphdb.framework.rest.rdf4j.repositories.service",[]).factory("RDF4JRepositoriesRestService",a),a.$inject=["$http","$repositories"];const n="INSERT DATA { <u:a> <http://www.ontotext.com/owlim/system#startplugin> 'similarity' .}",r="select ?o where {\n?s <http://www.ontotext.com/owlim/system#listplugins> ?o .\nfilter(str(?s) = 'similarity')\n} ",i="repositories";function a(e,t){return{getNamespaces:function(t){return e.get(`${i}/${t}/namespaces`)},getRepositoryNamespaces:function(){return e.get(`${i}/${t.getActiveRepository()}/namespaces`)},updateNamespacePrefix:function(t,n,r){return e({url:`${i}/${t}/namespaces/${r}`,method:"PUT",data:n})},deleteNamespacePrefix:function(t,n){return e({url:`${i}/${t}/namespaces/${n}`,method:"DELETE"})},addStatements:function(t,n){return e({url:`${i}/${t}/statements`,method:"POST",data:n,headers:{"Content-Type":"application/x-www-form-urlencoded"}})},enableSimilarityPlugin:function(){return $.ajax({method:"POST",url:`${i}/${t.getActiveRepository()}/statements`,data:{update:n}})},checkSimilarityPluginEnabled:function(){return $.ajax({method:"GET",url:`${i}/${t.getActiveRepository()}`,data:{query:r}})},getRepositorySize:function(){return e.get(`${i}/${t.getActiveRepository()}/size`)},getGraphs:a,resolveGraphs:function(){const e=t.getActiveRepository();let n=[];if(e)return a(e).success((function(e){e.results.bindings.unshift({contextID:{type:"default",value:"The default graph"}}),Object.keys(e.results.bindings).forEach((function(t){const n=e.results.bindings[t];"bnode"===n.contextID.type?n.contextID.value=`_:${n.contextID.value}`:"default"===n.contextID.type?n.contextID.uri="http://www.openrdf.org/schema/sesame#nil":n.contextID.uri=n.contextID.value})),e.results.bindings.unshift(allGraphs),n=e.results.bindings}));return n}};function a(t){return e.get(`${i}/${t}/contexts`)}}},function(e,t){angular.module("graphdb.framework.rest.monitoring.service",[]).factory("MonitoringRestService",i),i.$inject=["$http"];const n="rest/monitor",r=`${n}/query`;function i(e){return{monitorResources:function(){return e.get(`${n}/resource`)},monitorGC:function(){return e.post(`${n}/resource/gc`)},monitorQuery:function(){return e.get(r)},abortQueryByAlias:function(t){return e.delete(`${r}?queryAlias=${encodeURIComponent(t)}`)},deleteQuery:function(t){return e.delete(`${r}?queryId=${encodeURIComponent(t)}`)},getQueryCount:function(){return e({url:`${r}/count`,method:"GET",timeout:1e4})},checkAutocompleteStatus:function(){return e.get("rest/autocomplete/enabled")}}}},function(e,t){angular.module("graphdb.framework.rest.sparql.service",[]).factory("SparqlRestService",i),i.$inject=["$http"];const n="rest/sparql",r=`${n}/saved-queries`;function i(e){return{getSavedQueries:function(){return e.get(r)},getSavedQuery:function(t,n){let i="";null!=n&&(i=`&owner=${encodeURIComponent(n)}`);return e.get(`${r}?name=${encodeURIComponent(t)}${i}`)},addKnownPrefixes:function(t){return e.post(`${n}/addKnownPrefixes`,t)},editSavedQuery:function(t){return e.put(r,t)},deleteSavedQuery:function(t){return e.delete(`${r}?name=${encodeURIComponent(t)}`)},addNewSavedQuery:function(t){return e.post(r,t)}}}},function(e,t){function n(e,t,n,r){e.title=n,e.message=r,e.ok=function(){t.close()},e.cancel=function(){t.dismiss("cancel")}}function r(e,t,n,r){e.clipboardURI=n,e.ok=function(){try{document.getElementById("clipboardURI").select(),document.execCommand("copy"),r.success("URL copied successfully to clipboard.")}catch(e){r.error('Your browser doesn\'t support "copy" operation.\nPress Ctrl-C / Cmd-C to copy URL manually.')}t.close()},e.cancel=function(){t.dismiss("cancel")}}function i(e,t,n,r){e.query=n,e.cancel=function(){t.dismiss("cancel")},e.selectQuery=function(){e.selectElement($("#create-query"))},e.copyQueryToClipboard=function(){try{e.selectQuery(),document.execCommand("copy"),t.close(),r.success("Query copied successfully to clipboard.")}catch(e){r.error('Your browser doesn\'t support "copy" operation.\nPress Ctrl-C / Cmd-C to copy query to clipboard manually.')}},e.selectElement=function(e){if(e.length>0)if(window.getSelection){const t=window.getSelection();t.removeAllRanges();const n=document.createRange();n.selectNodeContents(e[0].firstChild),t.addRange(n)}else if(document.selection){const t=document.body.createTextRange();t.moveToElementText(e[0]),t.select()}}}angular.module("graphdb.framework.core.controllers",[]).controller("CopyToClipboardModalCtrl",r).controller("SimpleModalCtrl",n).controller("ViewQueryCtrl",i),n.$inject=["$scope","$modalInstance","title","message"],r.$inject=["$scope","$modalInstance","uri","toastr"],i.$inject=["$scope","$modalInstance","query","toastr"]},function(e,t){angular.module("graphdb.framework.rest.autocomplete.service",[]).factory("AutocompleteRestService",s);const n="rest/autocomplete/",r=`${n}labels`,i=`${n}enabled`,a=`${n}iris`;function s(e){return{checkAutocompleteStatus:function(){return e.get(i)},refreshIndexStatus:function(){return e.get(`${n}status`)},refreshLabelConfig:function(){return e.get(r)},addLabelConfig:function(t){return e.put(r,t)},removeLabelConfig:function(t){return e.delete(r,{data:t,headers:{"Content-Type":"application/json;charset=utf-8"}})},toggleAutocomplete:function(t){return e.post(`${i}?enabled=${t}`)},refreshIndexIRIs:function(){return e.get(a)},toggleIndexIRIs:function(t){return e.post(`${a}?enabled=${t}`)},buildIndex:function(){return e.post(`${n}reIndex`)},interruptIndexing:function(){return e.post(`${n}interrupt`)},checkForPlugin:function(){return e.get(`${n}pluginFound`)},getAutocompleteSuggestions:function(t,r){return e.get(`${n}query`,{params:{q:t},timeout:r})}}}s.$inject=["$http"]},function(e,t,n){"use strict";n.r(t);n(2);angular.module("graphdb.framework.core.interceptors.unauthorized",["ngCookies"]).factory("$unauthorizedInterceptor",["$q","$location","$rootScope",function(e,t,n){return{responseError:function(r){let i=!1,a=!1;return 401===r.status?r.config.url.indexOf("rest/security/authenticatedUser")<0&&!n.hasExternalAuthUser()&&(i=!0):403===r.status?n.setPermissionDenied(t.path())?console.log("Permission to page denied. Some errors in the console are normal."):i=!0:409===r.status&&(i=!0,a=!0),i?Promise.resolve(n.redirectToLogin(a)).then(()=>e.reject(r)):e.reject(r)}}}])},,function(e,t,n){"use strict";n.r(t);var r=n(1);const i={headers:{"X-GraphDB-Repository":void 0,"X-Requested-With":void 0,Authorization:void 0}};angular.module("graphdb.framework.core.services.openIDService",["toastr"]).service("$openIDAuth",["$http","$location","$window","toastr",function(e,t,n,a){const s="com.ontotext.graphdb.openid.",o=this;function u(e){const t=[];for(let n in e)e.hasOwnProperty(n)&&t.push(`${n}=${encodeURIComponent(e[n])}`);return t.join("&")}this.login=function(e,t){const r=o.generateRandomString(),i=e.authFlow;if("code"===i){o.setStorageItem("pkce_state",r);const i=o.generateRandomString();o.setStorageItem("pkce_code_verifier",i);const a=o.pkceChallengeFromVerifier(i);n.location.href=o.getLoginUrl(r,a,t,e)}else"code_no_pkce"===i?(o.removeStorageItem("pkce_code_verifier"),n.location.href=o.getLoginUrl(r,"",t,e)):"implicit"===i?(o.setStorageItem("nonce",r),n.location.href=o.getLoginUrl(r,"",t,e)):(console.log("oidc: unknown auth flow: "+i),a.error("Unknown auth flow: "+i))},this.getLoginUrl=function(e,t,n,r){const i=[];let a="";switch(r.authFlow){case"code":a="code",i.push("state="+encodeURIComponent(e)),i.push("code_challenge="+encodeURIComponent(t)),i.push("code_challenge_method=S256");break;case"code_no_pkce":a="code";break;case"implicit":a="token id_token",i.push("nonce="+encodeURIComponent(e));break;default:throw new Error("Unknown authentication flow: "+r.authFlow)}return i.unshift(`response_type=${encodeURIComponent(a)}`,`scope=${encodeURIComponent(o.getScope(r.extraScopes))}`,`client_id=${encodeURIComponent(r.clientId)}`,`redirect_uri=${encodeURIComponent(n)}`),r.oracleDomain&&i.push(`domain=${encodeURIComponent(r.oracleDomain)}`),r.authorizeParameters&&i.push(r.authorizeParameters),`${r.oidcAuthorizationEndpoint}?${i.join("&")}`},this.withOpenIdKeys=function(t,n){e.get(t,i).success((function(e){o.openIdKeys={},e.keys.forEach((function(e){o.openIdKeys[e.kid]=e})),n()}))},this.initOpenId=function(e,t,r,s){o.clientId=e.clientId,o.tokenType=e.tokenType,o.idTokenAudience=e.clientId,o.idTokenIssuer=e.issuer,o.accessTokenAudience=e.tokenAudience,o.accessTokenIssuer=e.tokenIssuer,o.openIdTokenUrl=e.oidcTokenEndpoint;let u=e.oidcJwksUri;e.proxyOidc&&(u="rest/openid/jwks",o.openIdTokenUrl="rest/openid/token"),o.openIdEndSessionUrl=e.oidcEndSessionEndpoint,o.supportsOfflineAccess=e.oidcScopesSupported.includes("offline_access"),e.oracleDomain&&(i.headers["X-OAuth-Identity-Domain-Name"]=e.oracleDomain),o.withOpenIdKeys(u,(function(){if(o.isLoggedIn=o.hasValidIdToken(),o.isLoggedIn)o.setupTokensRefresh(!1,r,s);else if(o.hasValidRefreshToken())o.refreshTokens(r,s);else{const i=r;r=function(){o.isLoggedIn=!0,i(!0)},o.softLogout();const u=o.parseQueryString(n.location.search.substring(1));if(u.code)"code"===e.authFlow?o.getStorageItem("pkce_state")!==u.state?(a.error("Invalid pkce_state"),console.log("oidc: PKCE state mismatch "+o.getStorageItem("pkce_state")+" != "+u.state),s()):o.retrieveTokensByCode(u.code,t,r,s):"code_no_pkce"===e.authFlow&&o.retrieveTokensByCode(u.code,t,r,s);else{const e=o.parseQueryString(n.location.pathname.substring(1));e.id_token?o.saveTokens(e,!0,!1,r):s()}}}))},this.authHeaderGraphDB=function(){return"id"===o.getStorageItem("token_type")?"Bearer "+o.getToken("id"):"Bearer "+o.getToken("access")},this.softLogout=function(){o.isLoggedIn=!1,o.setToken("id",null),o.setToken("access",null),o.setToken("refresh",null)},this.hardLogout=function(e){o.softLogout(),o.openIdEndSessionUrl&&(n.location.href=`${o.openIdEndSessionUrl}?client_id=${encodeURIComponent(o.clientId)}&post_logout_redirect_uri=${encodeURIComponent(e)}`)},this.getToken=function(e){return o.getStorageItem(e+"_token")},this.setToken=function(e,t){t?o.setStorageItem(e+"_token",t):o.removeStorageItem(e+"_token")},this.tokenHeader=function(e){const t=o.getToken(e);if(t){try{const e=r.KJUR.jws.JWS.readSafeJSONString(Object(r.b64utoutf8)(t.split(".")[0]));if(e)return e}catch(e){}return{error:"not a JWT token: "+t}}return{}},this.verifyToken=function(e){const t=o.getToken(e),n=o.tokenHeader(e);if(!n.kid)return"id"!==e?n.error?(console.log(`oidc: token ${e} is not a JWT token (token considered valid)`),!0):(console.log(`oidc: invalid token ${e} (token is empty)`),!1):(console.log("oidc: invalid token id (not a JWT token)"),!1);const i=o.openIdKeys[n.kid];if(!i)return console.log("oidc: no key to verify JWT token (token considered invalid)"),!1;const a=r.KEYUTIL.getKey(i),s={alg:[n.alg],iss:[o.idTokenIssuer]};return"id"===e?(s.aud=[o.idTokenAudience,o.idTokenIssuer],s.nonce=[o.getStorageItem("nonce")]):"access"===e&&(s.aud=[o.accessTokenAudience],s.iss=[o.accessTokenIssuer]),r.KJUR.jws.JWS.verifyJWT(t,a,s)},this.hasValidIdToken=function(){return o.getToken("id")?o.verifyToken("id")?(console.log("oidc: valid id token found"),!0):(console.log("oidc: stale id token"),!1):(console.log("oidc: no id token"),!1)},this.tokenPayload=function(e){const t=o.getToken(e);if(t){try{const e=r.KJUR.jws.JWS.readSafeJSONString(Object(r.b64utoutf8)(t.split(".")[1]));if(e)return e}catch(e){}return{error:"not a JWT token: "+t}}return{}},this.saveTokens=function(e,n,r,i){(n||e.refresh_token)&&o.setToken("refresh",e.refresh_token),o.setToken("access",e.access_token),o.setToken("id",e.id_token),o.setStorageItem("token_type",o.tokenType),console.log("oidc: saved tokens"),o.setupTokensRefresh(n||r,i),o.removeStorageItem("pkce_state"),o.removeStorageItem("pkce_code_verifier"),n&&t.url("/")},this.retrieveTokensByCode=function(t,n,r,s){const c={grant_type:"authorization_code",client_id:o.clientId,redirect_uri:n,code:t},l=o.getStorageItem("pkce_code_verifier");l&&(c.code_verifier=l);const h={...i.headers,"Content-type":"application/x-www-form-urlencoded; charset=utf-8"};e({method:"POST",url:o.openIdTokenUrl,headers:h,transformRequest:u,data:c}).success((function(e){o.saveTokens(e,!0,!1,r)})).error((function(e){a.error("Cannot retrieve token after login; "+getError(e)),s()}))},this.refreshTokens=function(t,n){if(o.hasValidRefreshToken()){const r={grant_type:"refresh_token",client_id:o.clientId,refresh_token:o.getToken("refresh")},s={...i.headers,"Content-type":"application/x-www-form-urlencoded; charset=utf-8"};e({method:"POST",url:o.openIdTokenUrl,headers:s,transformRequest:u,data:r}).success((function(e){console.log("oidc: refreshed tokens"),o.saveTokens(e,!1,!0,t),o.isLoggedIn=!0})).error((function(e){console.log("oidc: could not refresh tokens"),a.error("Could not refresh OpenID token; "+getError(e)),n&&n()}))}else console.log("oidc: refresh requested without a valid refresh token")},this.hasValidRefreshToken=function(){const e=o.tokenPayload("refresh");return!(e.nbf&&1e3*e.nbf-Date.now()>5e3)&&(!(e.exp&&Date.now()-1e3*e.exp>5e3)&&!(!e.iat&&!e.error))},this.setupTokensRefresh=function(e,t,n){if(o.hasValidRefreshToken()){clearTimeout(o.previousTimer);const r=o.tokenPayload("id");if(r.exp>0){const i=1e3*r.exp-Date.now()-6e4;if(!(e||i>1e3))return o.previousTimer=null,console.log("oidc: tokens will refresh now, "+i+"; "+e),void o.refreshTokens(t,n);o.previousTimer=setTimeout((function(){o.refreshTokens(t)}),i),console.log("oidc: tokens will refresh in "+i/1e3+" seconds at "+new Date(Date.now()+i))}}else console.log("oidc: no valid refresh token");t()},this.parseQueryString=function(e){const t={access_token:null,code:null,id_token:null,state:null};return""===e?t:(e.split("&").map((function(e){return e.split("=")})).forEach((function(e){t[e[0]]=decodeURIComponent(e[1])})),t)},this.generateRandomString=function(){const e=new Uint32Array(28);return window.crypto.getRandomValues(e),Array.from(e,(function(e){return("0"+e.toString(16)).substr(-2)})).join("")},this.pkceChallengeFromVerifier=function(e){const t=new r.KJUR.crypto.MessageDigest({alg:"sha256",prov:"cryptojs"});return Object(r.hextob64u)(t.digestString(e))},this.getScope=function(e){let t="openid"+(o.supportsOfflineAccess?" offline_access":"");return e&&(t+=" "+e),console.log(`oidc: requesting scopes '${t}'`),t},this.setStorageItem=function(e,t){localStorage.setItem(s+e,t)},this.getStorageItem=function(e){return localStorage.getItem(s+e)},this.removeStorageItem=function(e){localStorage.removeItem(s+e)}}])},function(e,t){angular.module("graphdb.framework.rest.security.service",[]).factory("SecurityRestService",o),o.$inject=["$http"];const n="rest/security",r=`${n}/user`,i=`${n}/authenticatedUser`,a=`${n}/freeaccess`,s="rest/roles";function o(e){return{getUser:function(t){return e.get(`${r}/${encodeURIComponent(t)}`)},getAdminUser:function(){return e.get(`${r}/admin`)},getUsers:function(){return e.get(r)},createUser:function(t){return e({method:"POST",url:`${r}/${encodeURIComponent(t.username)}`,headers:{"X-GraphDB-Password":t.pass},data:{appSettings:t.appSettings,grantedAuthorities:t.grantedAuthorities}})},updateUser:function(t){return e({method:"PUT",url:`${r}/${encodeURIComponent(t.username)}`,headers:{"X-GraphDB-Password":t.pass},data:{appSettings:t.appSettings,grantedAuthorities:t.grantedAuthorities}})},updateUserData:function(t){return e({method:"PATCH",url:`${r}/${encodeURIComponent(t.username)}`,headers:{"X-GraphDB-Password":t.pass},data:{appSettings:t.appSettings}})},deleteUser:function(t){return e.delete(`${r}/${encodeURIComponent(t)}`)},getFreeAccess:function(){return e.get(a)},setFreeAccess:function(t){return e.post(a,t)},getSecurityConfig:function(){return e.get(`${n}/all`)},toggleSecurity:function(t){return e.post(n,t?"true":"false")},getRoles:function(){return e.get(s)},getRolesMapping:function(t){return e.get(`${s}/mapping`,{params:t})},getAuthenticatedUser:function(){return e.get(`${i}`)}}}},function(e,t){!function(e){e.getError=function(e,t,n){if(angular.isObject(e)&&e.status&&e.data)return getError(e.data,t,n);if(t&&403===t)return"Access is restricted";if(e){let r="Generic error";if(angular.isString(e))-1===e.indexOf("<html>")&&(r=e,r=r.replace(/^(([a-z0-9_]+\.)+[a-zA-Z0-9_]+: )+/,""));else if(angular.isObject(e)){if("message"in e&&(r=e.message),"error"in e&&(r=e.error.message),"responseJSON"in e&&"message"in e.responseJSON)return getError(e.responseJSON,t,n);"responseText"in e&&(r=e.responseText)}return n>0&&r.length>n&&(r=r.substr(0,n)+"..."),r}return"There is an error"}}(window)},function(e,t,n){"use strict";n.r(t);n(2),n(12),n(14),n(11),n(5),n(6),n(10),n(25),n(26),n(9),n(8);var r=n(0);n(4),n(22);function i(e,t,n,r,i,a,s,o,u){function c(){e.getActiveRepository()&&(e.getNamespacesPromise=u.getNamespaces(e.getActiveRepository()).success((function(){l()})))}function l(){e.getAutocompletePromise=a.checkAutocompleteStatus().success((function(){e.getActiveRepositorySize()}))}e.doClear=!1,e.getActiveRepositorySize=function(){const t=r.getActiveRepository();t&&(e.activeRepositorySizeError=void 0,o.getSize(t).then((function(t){e.activeRepositorySize=t.data})).catch((function(t){e.activeRepositorySizeError=t.data.message})))},e.$on("autocompleteStatus",(function(){l()})),e.$on("repositoryIsSet",c),e.$on("$routeChangeSuccess",(function(e,n,r){r&&(i.isAuthenticated()||i.isFreeAccessEnabled()?c():t.redirectToLogin())})),e.onKeyDown=function(t){27===t.keyCode&&(e.doClear=!0)}}function a(e,t,n,i,a,s,o,u,c,l,h,f,d,p,g,m,v,y,b,w){e.mainTitle="GraphDB",e.descr="An application for searching, exploring and managing GraphDB semantic repositories.",e.productTypeHuman="",e.documentation="",e.menu=t,e.tutorialState=1!==b.get(w.TUTORIAL_STATE),e.showLicense=!1,e.userLoggedIn=!1,e.embedded=s.search().embedded,e.productInfo=c;function x(){$(window).width()<=720?($(".container-fluid.main-container").addClass("expanded"),$(".main-menu").addClass("collapsed"),$(".main-menu .icon-caret-left").toggleClass("icon-caret-left").toggleClass("icon-caret-right"),$(".toggle-menu").hide()):$(window).width()>720&&"collapsedMenu"===b.get(w.MENU_STATE)?($(".container-fluid.main-container").addClass("expanded"),$(".main-menu").addClass("collapsed"),$(".toggle-menu").show(),$(".main-menu .icon-caret-left").toggleClass("icon-caret-left").toggleClass("icon-caret-right")):($(".container-fluid.main-container").removeClass("expanded"),$(".main-menu").removeClass("collapsed"),$(".toggle-menu").show(),$(".main-menu .icon-caret-right").toggleClass("icon-caret-right").toggleClass("icon-caret-left"))}!function(){const t=new Date;e.currentYear=t.getFullYear(),e.previousYear=2002}(),e.$on("$routeChangeSuccess",(function(t,n,r){e.clicked=!1,$(".menu-element-root").removeClass("active"),l((function(){$(".menu-element.open a.menu-element-root").addClass("active"),$(".main-menu.collapsed .menu-element.open .menu-element-root").addClass("active")}),400),r&&e.checkLicenseStatus()})),e.checkMenu=function(){return $(".main-menu").hasClass("collapsed")},e.copyToClipboard=function(e){h.openCopyToClipboardModal(e)},e.goToAddRepo=function(){s.path("/repository/create").search({previous:"home"})},e.goToEditRepo=function(e){s.path("repository/edit/"+e).search({previous:"home"})},e.$on("$locationChangeSuccess",(function(){e.showFooter="/"===s.url()})),e.$on("repositoryIsSet",(function(){e.setRestricted(),b.clearClassHieararchyState()})),e.graphdbVersion=e.engineVersion=c.productVersion,e.workbenchVersion=c.Workbench,e.connectorsVersion=c.connectors,e.sesameVersion=c.sesame,e.productType=c.productType,"standard"===e.productType?(e.productTypeHuman="Standard",e.documentation="standard/"):"enterprise"===e.productType?(e.productTypeHuman="Enterprise",e.documentation="enterprise/"):"free"===e.productType&&(e.productTypeHuman="Free",e.documentation="free/"),e.mainTitle=e.productTypeHuman,e.select=function(t,n,r){$(".main-menu").hasClass("collapsed")?$(n.target).parents(".menu-element").children(".menu-element-root").hasClass("active")?(e.selected=t,e.clicked=!r):(!$(n.target).parents(".menu-element").hasClass("open")&&r?e.clicked=!0:e.clicked=!r,e.selected===t?e.selected=-1:e.selected=t):(!$(n.target).parents(".menu-element").hasClass("open")&&r?e.clicked=!0:e.clicked=!r,0!==$(n.target).parent(".menu-element").find(".sub-menu").length?($(n.target).parents(".menu-element").children(".menu-element-root").hasClass("active")?$(".sub-menu li.active").parents(".menu-element").children(".menu-element-root").removeClass("active"):$(".sub-menu li.active").parents(".menu-element").children(".menu-element-root").addClass("active"),e.selected===t?e.selected=-1:e.selected=t):(l((function(){$(n.target).parents(".menu-element").children(".menu-element-root").addClass("active")}),50),e.selected=t))},$("body").bind("click",(function(t){!$(t.target).parents(".main-menu").length&&$(".main-menu").hasClass("collapsed")&&(e.clicked=!1,e.selected=-1)})),e.isCurrentPath=function(e){return s.path()==="/"+e},e.isCurrentSubmenuChildPath=function(t){return 0!==t.children.length&&t.children.some((function(t){return e.isCurrentPath(t.href)}))},"/"===s.path()?e.selected=-1:(l((function(){const t=s.path().replace("/",""),n=$('a[href^="'+t+'"]');e.selected=n.closest(".menu-element").index()-1}),200),e.isCurrentPath(s.path())),e.popoverTemplate="js/angular/templates/repositorySize.html",e.securityEnabled=!0,e.isSecurityEnabled=function(){return n.isSecurityEnabled()},e.isFreeAccessEnabled=function(){return n.isFreeAccessEnabled()},e.hasExternalAuthUser=function(){return n.hasExternalAuthUser()},e.isDefaultAuthEnabled=function(){return n.isDefaultAuthEnabled()},e.isS4=function(){return e.license&&"S4"===e.license.version},e.isUserLoggedIn=function(){return e.userLoggedIn},e.getLocations=function(){return o.getLocations()},e.hasActiveLocation=function(){return o.hasActiveLocation()},e.getActiveLocation=function(){return o.getActiveLocation()},e.isLoadingLocation=function(){return o.isLoadingLocation()},e.getRepositories=function(){return o.getRepositories()},e.getReadableRepositories=function(){return o.getReadableRepositories()},e.getWritableRepositories=function(){return o.getWritableRepositories()},e.getActiveRepository=function(){return o.getActiveRepository()},e.canWriteRepoInActiveLocation=function(e){return n.canWriteRepo(o.getActiveLocation(),e)},e.canWriteActiveRepo=function(e){const t=o.getActiveRepository();return n.canWriteRepo(o.getActiveLocation(),t)&&("SYSTEM"!==t||!e)},e.getActiveRepositoryObject=function(){return _.find(e.getRepositories(),(function(t){return t.id===e.getActiveRepository()}))},e.isActiveRepoOntopType=function(){return o.isActiveRepoOntopType()},e.isActiveRepoFedXType=function(){return o.isActiveRepoFedXType()},e.setAttrs=function(t){e.attrs=t},e.setRestricted=function(){e.attrs&&(e.isRestricted=e.attrs.hasOwnProperty("write")&&e.isSecurityEnabled()&&!e.canWriteActiveRepo()||e.attrs.hasOwnProperty("ontop")&&e.isActiveRepoOntopType()||e.attrs.hasOwnProperty("fedx")&&e.isActiveRepoFedXType())},e.toHumanReadableType=function(e){switch(e){case"worker":return"EE Worker";case"master":return"EE Master";case"se":return"Standard";case"free":return"Free";case"system":return"System";case"ontop":return"Ontop";case"fedx":return"FedX";default:return"Unknown"}},e.setRepository=function(e){o.setRepository(e)},e.principal=function(){return n.getPrincipal()},e.isIgnoreSharedQueries=function(){return n.getPrincipal()&&n.getPrincipal().appSettings.IGNORE_SHARED_QUERIES},e.logout=function(){n.clearAuthentication(),a.success("Signed out"),n.freeAccess?o.resetActiveRepository():n.isSecurityEnabled()&&u.redirectToLogin()},e.isAdmin=function(){return e.hasRole(r.UserRole.ROLE_ADMIN)},e.isUser=function(){return e.hasRole(r.UserRole.ROLE_USER)},e.hasRole=function(e){return!!angular.isUndefined(e)||n.hasRole(e)},e.hasPermission=function(){return u.hasPermission()},e.canReadRepo=function(e,t){return n.canReadRepo(e,t)},e.checkForWrite=function(e,t,r){return n.checkForWrite(e,t,r)},e.setPopoverRepo=function(t){e.popoverRepo=t},e.getRepositorySize=function(){e.repositorySize={},e.popoverRepo&&(e.repositorySize.loading=!0,g.getSize(e.popoverRepo.id).then((function(t){e.repositorySize=t.data})))},e.getDegradedReason=function(){return o.getDegradedReason()},e.canManageRepositories=function(){return n.hasRole(r.UserRole.ROLE_REPO_MANAGER)&&!o.getDegradedReason()},e.getSavedQueries=function(){v.getSavedQueries().success((function(t){e.sampleQueries=t})).error((function(e){const t=getError(e);a.error(t,"Error! Could not get saved queries")}))},e.goToSparqlEditor=function(e){s.path("/sparql").search({savedQueryName:e.name,owner:e.owner,execute:!0})},e.declineTutorial=function(){$(".tutorial-container").slideUp("slow",(function(){b.set(w.TUTORIAL_STATE,1),e.tutorialState=!1}))},e.initTutorial=function(){if(!e.tutorialState&&"/"!==s.path())return;e.tutorialInfo=[{title:"Welcome to GraphDB",info:"GraphDB is a graph database compliant with RDF and SPARQL specifications. It supports open APIs based on RDF4J (ex-Sesame) project and enables fast publishing of linked data on the web. The Workbench is used for searching, exploring and managing GraphDB semantic repositories. This quick tutorial will guide you through the basics: <br><ul><li>(1) Create a repository</li><li>(2) Load a sample dataset</li><li>(3) Run a SPARQL query</li></ul>You can always come back to this tutorial by pressing the GraphDB icon in the top left corner."},{title:"Create a repository",info:'Now let’s create your first repository. Go to Setup > Repositories and press Create new repository button. Fill the field Repository ID and press enter. The default repository parameters are optimized for datasets up to 100 million RDF statements. If you plan to load more check for more information: <a href="https://graphdb.ontotext.com/documentation/'+e.productType+'/configuring-a-repository.html" target="_blank">Configuring a repository</a>'},{title:"Load a sample dataset",info:"GraphDB includes a sample dataset in the distribution under the directory examples/data/news. The dataset represents new articles semantically enriched with structured information from Wikipedia. To load the data go to Import > RDF and select the local files. "},{title:"Run a SPARQL query",info:"You can find a list of sample SPARQL queries under examples/data/news/queries.txt demonstrating how to find interesting searches of news articles and the mentioned entities like: <br><ul><li>(1) Give me articles about persons born in New York</li><li>(2) Show me all occupations of every person in the news</li><li>(3) List me the members of a specific political party</li></ul>"},{title:"REST API",info:"GraphDB allows you to perform every operation also via a REST API or by using language specific RDF4J client application. To see the full list of supported functionality go to Help > REST API or check the sample code under examples/developer-getting-started/\nHave fun!"}],e.activePage=0,$(".pages-wrapper .page-slide").css("opacity",100);const t=$(".main-container")[0].offsetWidth+200;l((function(){const n=$(".pages-wrapper .page-slide");n.css("left",t+"px"),$(n[e.activePage]).css("left","0px"),$($(".btn-toolbar.pull-right .btn-group .btn")[0]).focus()}),50)},e.getTutorialPageHtml=function(e){return y.trustAsHtml(e.info)},e.checkSubMenuPosition=function(e){0===e?$(".main-menu.collapsed .sub-menu").removeClass("align-bottom"):$(window).height()<735?$(".main-menu.collapsed .sub-menu").addClass("align-bottom"):$(".main-menu.collapsed .sub-menu").removeClass("align-bottom")},x(),$(window).resize((function(){angular.isDefined(e.menuState)?$(window).width()<=720?($(".container-fluid.main-container").addClass("expanded"),$(".main-menu").addClass("collapsed"),$(".toggle-menu").hide(),$(".main-menu .icon-caret-left").toggleClass("icon-caret-left").toggleClass("icon-caret-right")):$(window).width()>720&&e.menuState?$(".toggle-menu").show():($(".container-fluid.main-container").removeClass("expanded"),$(".main-menu").removeClass("collapsed"),$(".toggle-menu").show(),$(".main-menu .icon-caret-right").toggleClass("icon-caret-right").toggleClass("icon-caret-left")):x(),e.tutorialState&&"/"===s.path()&&e.initTutorial(),$(window).height()<735?($(".sub-menu").addClass("align-bottom"),$(".main-menu.collapsed li:nth-child(2) .sub-menu").removeClass("align-bottom")):$(".sub-menu").removeClass("align-bottom")})),e.slideToPage=function(t){const n=$(".main-container")[0].offsetWidth,r=$(".pages-wrapper .page-slide");r.css("opacity","0").delay(200).css("left",n+"px"),e.activePage=t,$(r[e.activePage]).css("opacity","100").css("left","0px")},e.slideNext=function(){let t=++e.activePage;t>=e.tutorialInfo.length&&(t=0),e.slideToPage(t),$($(".btn-toolbar.pull-right .btn-group .btn")[e.activePage]).focus()},e.toggleNavigation=function(){const t=$(".main-menu"),n=$(".sub-menu li.active");if(t.hasClass("collapsed"))n.parents(".menu-element").hasClass("open")?n.parents(".menu-element").children(".menu-element-root").removeClass("active"):n.parents(".menu-element").children(".menu-element-root").addClass("active"),$(".container-fluid.main-container").removeClass("expanded"),t.removeClass("collapsed"),$(".main-menu .icon-caret-right").toggleClass("icon-caret-right").toggleClass("icon-caret-left"),u.$broadcast("onToggleNavWidth",!1);else{n.parents(".menu-element").children(".menu-element-root").addClass("active");const r=$(".menu-element");r.hasClass("open")&&(r.removeClass("open"),e.clicked=!1,e.selected=-1),$(".container-fluid.main-container").addClass("expanded"),t.addClass("collapsed"),$(".main-menu .icon-caret-left").toggleClass("icon-caret-left").toggleClass("icon-caret-right"),$(".main-menu.collapsed .menu-element.clicked").removeClass("clicked"),u.$broadcast("onToggleNavWidth",!0)}},e.$on("onToggleNavWidth",(function(t,n){if(e.menuState=n,n?b.set(w.MENU_STATE,"collapsedMenu"):b.set(w.MENU_STATE,"expandedMenu"),e.tutorialState&&"/"===s.path()){const t=$(".pages-wrapper")[0].offsetWidth+200;l((function(){const n=$(".pages-wrapper .page-slide");n.css("left",t+"px"),$(n[e.activePage]).css("left","0px")}),50)}})),e.numberOfActiveImports=0,e.getNumberOfActiveImportsRunning=!1,e.getNumberOfActiveImports=function(){e.getNumberOfActiveImportsRunning||e.canWriteActiveRepo()&&"SYSTEM"!==e.getActiveRepository()&&(e.getNumberOfActiveImportsRunning=!0,i({method:"GET",url:"rest/data/import/active/"+e.getActiveRepository(),timeout:1e4}).success((function(t){e.numberOfActiveImports=t})).finally((function(){e.getNumberOfActiveImportsRunning=!1})))},e.getQueriesRunning=!1,e.skipGetQueriesTimes=0;const S=function(){let e=0,t=1;return{next:function(){const n=t;return t=e+t,e=n,n},reset:function(){e=0,t=1}}}();e.getQueries=function(){e.getQueriesRunning||(e.skipGetQueriesTimes>0?e.skipGetQueriesTimes--:o.getActiveRepository()&&"SYSTEM"!==o.getActiveRepository()&&!o.isActiveRepoOntopType()&&e.hasRole(r.UserRole.ROLE_USER)?(e.getQueriesRunning=!0,m.getQueryCount().success((function(t){e.queryCount=t,S.reset()})).error((function(){e.queryCount=0,e.skipGetQueriesTimes=S.next()})).finally((function(){e.getQueriesRunning=!1}))):e.queryCount=0)};const E=f((function(){e.getDegradedReason()||(e.getQueries(),e.getNumberOfActiveImports())}),2e3);e.$on("$destroy",(function(){f.cancel(E)})),n.securityInitialized&&e.getSavedQueries(),e.$on("securityInit",(function(t,n,r,i){e.securityEnabled=n,e.userLoggedIn=r,!n||r||i?(e.checkLicenseStatus(),e.getSavedQueries()):"/login"!==s.path()&&u.redirectToLogin()})),e.checkLicenseStatus=function(){p.getHardcodedLicense().success((function(t){e.isLicenseHardcoded="true"===t})).error((function(){e.isLicenseHardcoded=!0})).then((function(){p.getLicenseInfo().then((function(t){e.license=t.data,e.showLicense=!0}),(function(){e.license={message:"No license was set.",valid:!1},e.showLicense=!0}))}))},e.getHumanReadableSeconds=function(e,t){const n=Math.floor(e/86400),r=Math.floor(e%86400/3600),i=Math.floor(e%3600/60);let a;a=t&&e<10?e<1?_.ceil(e%60,1):_.round(e%60,1):_.round(e%60,0);let s="";return n&&(s+=n+"d "),(n||r)&&(s+=r+"h "),(n||r||i)&&(s+=i+"m "),s+=a+"s",s.replace(/( 0[a-z])+$/,"")},e.getHumanReadableTimestamp=function(e){const t=Date.now(),n=(t-e)/1e3;if(n<60)return"moments ago";if(n<600)return"minutes ago";{const r=new Date(t),i=new Date(e);if(r.getYear()===i.getYear()&&r.getMonth()===i.getMonth()&&r.getDate()===i.getDate())return d("date")(e,"'today at' HH:mm");if(n<86400)return d("date")(e,"'yesterday at' HH:mm")}return d("date")(e,"'on' yyyy-MM-dd 'at' HH:mm")}}function s(e,t,n){e.getRepositorySize=function(t){n.getSize(t).then((function(t){e.size=t.data}))}}angular.module("graphdb.workbench.se.controllers",["graphdb.framework.core.services.jwtauth","graphdb.framework.core.services.repositories","ngCookies","ngFileUpload","graphdb.framework.core","graphdb.framework.core.controllers","graphdb.framework.core.directives","graphdb.framework.rest.license.service","graphdb.framework.rest.autocomplete.service","graphdb.framework.rest.repositories.service","graphdb.framework.rest.sparql.service","graphdb.framework.rest.autocomplete.service","graphdb.framework.rest.monitoring.service","graphdb.framework.rest.rdf4j.repositories.service","graphdb.framework.utils.localstorageadapter","graphdb.framework.core.services.autocompleteStatus"]).controller("mainCtrl",a).controller("homeCtrl",i).controller("repositorySizeCtrl",s),i.$inject=["$scope","$rootScope","$http","$repositories","$jwtAuth","AutocompleteRestService","LicenseRestService","RepositoriesRestService","RDF4JRepositoriesRestService"],a.$inject=["$scope","$menuItems","$jwtAuth","$http","toastr","$location","$repositories","$rootScope","productInfo","$timeout","ModalService","$interval","$filter","LicenseRestService","RepositoriesRestService","MonitoringRestService","SparqlRestService","$sce","LocalStorageAdapter","LSKeys"],s.$inject=["$scope","$http","RepositoriesRestService"]},function(e,t){angular.module("graphdb.framework.rest.locations.service",[]).factory("LocationsRestService",i),i.$inject=["$http"];const n="rest/locations",r=`${n}/active`;function i(e){return{getLocations:function(){return e.get(n)},addLocation:function(t){return e.post(n,t)},editLocation:function(t){return e.put(n,t)},deleteLocation:function(t){return e.delete(`${n}?uri=${t}`)},enableLocation:function(t){return e.post(`${n}/activate`,t)},getActiveLocation:function(){return e({method:"GET",url:`${r}`,noCancelOnRouteChange:!0})},setDefaultRepository:function(t){return e({url:`${r}/default-repository`,method:"POST",data:{defaultRepository:t}})}}}},function(e,t){angular.module("graphdb.framework.core.services.autocompleteStatus",[]).service("$autocompleteStatus",["$rootScope","AutocompleteRestService","LocalStorageAdapter","LSKeys",function(e,t,n,r){const i=this;this.setAutocompleteStatus=function(t){n.set(r.AUTOCOMPLETE_ENABLED,t),e.$broadcast("autocompleteStatus",t)},e.$watch((function(){return n.get(r.AUTOCOMPLETE_ENABLED)}),(function(e){i.setAutocompleteStatus(e)}),!0),e.$on("repositoryIsSet",(function(){t.checkAutocompleteStatus().success((function(e){i.setAutocompleteStatus(e)}))}))}])},function(e,t){
|
|
27
|
+
var le=function(){var e=new RegExp('(?:false|true|null|[\\{\\}\\[\\]]|(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)|(?:"(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))*"))',"g"),t=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),n={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function r(e,t,r){return t?n[t]:String.fromCharCode(parseInt(r,16))}var i=new String(""),a=Object.hasOwnProperty;return function(n,s){var o,u,c=n.match(e),l=c[0],h=!1;"{"===l?o={}:"["===l?o=[]:(o=[],h=!0);for(var f=[o],d=1-h,p=c.length;d<p;++d){var g;switch((l=c[d]).charCodeAt(0)){default:(g=f[0])[u||g.length]=+l,u=void 0;break;case 34:if(-1!==(l=l.substring(1,l.length-1)).indexOf("\\")&&(l=l.replace(t,r)),g=f[0],!u){if(!(g instanceof Array)){u=l||i;break}u=g.length}g[u]=l,u=void 0;break;case 91:g=f[0],f.unshift(g[u||g.length]=[]),u=void 0;break;case 93:f.shift();break;case 102:(g=f[0])[u||g.length]=!1,u=void 0;break;case 110:(g=f[0])[u||g.length]=null,u=void 0;break;case 116:(g=f[0])[u||g.length]=!0,u=void 0;break;case 123:g=f[0],f.unshift(g[u||g.length]={}),u=void 0;break;case 125:f.shift()}}if(h){if(1!==f.length)throw new Error;o=o[0]}else if(f.length)throw new Error;if(s){var m=function(e,t){var n=e[t];if(n&&"object"==typeof n){var r=null;for(var i in n)if(a.call(n,i)&&n!==e){var o=m(n,i);void 0!==o?n[i]=o:(r||(r=[]),r.push(i))}if(r)for(var u=r.length;--u>=0;)delete n[r[u]]}return s.call(e,t,n)};o=m({"":o},"")}return o}}();void 0!==he&&he||(he={}),void 0!==he.asn1&&he.asn1||(he.asn1={}),he.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(e){var t=e.toString(16);if("-"!=t.substr(0,1))t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t);else{var n=t.substr(1).length;n%2==1?n+=1:t.match(/^[0-7]/)||(n+=2);for(var r="",i=0;i<n;i++)r+="f";t=new S(r,16).xor(e).add(S.ONE).toString(16).replace(/^-/,"")}return t},this.getPEMStringFromHex=function(e,t){return Te(e,t)},this.newObject=function(e){var t=he.asn1,n=t.ASN1Object,r=t.DERBoolean,i=t.DERInteger,a=t.DERBitString,s=t.DEROctetString,o=t.DERNull,u=t.DERObjectIdentifier,c=t.DEREnumerated,l=t.DERUTF8String,h=t.DERNumericString,f=t.DERPrintableString,d=t.DERTeletexString,p=t.DERIA5String,g=t.DERUTCTime,m=t.DERGeneralizedTime,v=t.DERVisibleString,y=t.DERBMPString,b=t.DERSequence,w=t.DERSet,x=t.DERTaggedObject,S=t.ASN1Util.newObject;if(e instanceof t.ASN1Object)return e;var E=Object.keys(e);if(1!=E.length)throw new Error("key of param shall be only one.");var A=E[0];if(-1==":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+A+":"))throw new Error("undefined key: "+A);if("bool"==A)return new r(e[A]);if("int"==A)return new i(e[A]);if("bitstr"==A)return new a(e[A]);if("octstr"==A)return new s(e[A]);if("null"==A)return new o(e[A]);if("oid"==A)return new u(e[A]);if("enum"==A)return new c(e[A]);if("utf8str"==A)return new l(e[A]);if("numstr"==A)return new h(e[A]);if("prnstr"==A)return new f(e[A]);if("telstr"==A)return new d(e[A]);if("ia5str"==A)return new p(e[A]);if("utctime"==A)return new g(e[A]);if("gentime"==A)return new m(e[A]);if("visstr"==A)return new v(e[A]);if("bmpstr"==A)return new y(e[A]);if("asn1"==A)return new n(e[A]);if("seq"==A){for(var F=e[A],C=[],D=0;D<F.length;D++){var R=S(F[D]);C.push(R)}return new b({array:C})}if("set"==A){for(F=e[A],C=[],D=0;D<F.length;D++){R=S(F[D]);C.push(R)}return new w({array:C})}if("tag"==A){var I=e[A];if("[object Array]"===Object.prototype.toString.call(I)&&3==I.length){var T=S(I[2]);return new x({tag:I[0],explicit:I[1],obj:T})}return new x(I)}},this.jsonToASN1HEX=function(e){return this.newObject(e).getEncodedHex()}},he.asn1.ASN1Util.oidHexToInt=function(e){for(var t="",n=parseInt(e.substr(0,2),16),r=(t=Math.floor(n/40)+"."+n%40,""),i=2;i<e.length;i+=2){var a=("00000000"+parseInt(e.substr(i,2),16).toString(2)).slice(-8);if(r+=a.substr(1,7),"0"==a.substr(0,1))t=t+"."+new S(r,2).toString(10),r=""}return t},he.asn1.ASN1Util.oidIntToHex=function(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},n=function(e){var n="",r=new S(e,10).toString(2),i=7-r.length%7;7==i&&(i=0);for(var a="",s=0;s<i;s++)a+="0";r=a+r;for(s=0;s<r.length-1;s+=7){var o=r.substr(s,7);s!=r.length-7&&(o="1"+o),n+=t(parseInt(o,2))}return n};if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var r="",i=e.split("."),a=40*parseInt(i[0])+parseInt(i[1]);r+=t(a),i.splice(0,2);for(var s=0;s<i.length;s++)r+=n(i[s]);return r},he.asn1.ASN1Object=function(e){this.params=null,this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw new Error("this.hV is null or undefined");if(this.hV.length%2==1)throw new Error("value hex must be even length: n="+"".length+",v="+this.hV);var e=this.hV.length/2,t=e.toString(16);if(t.length%2==1&&(t="0"+t),e<128)return t;var n=t.length/2;if(n>15)throw"ASN.1 length too long to represent by 8x: n = "+e.toString(16);return(128+n).toString(16)+t},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""},this.setByParam=function(e){this.params=e},null!=e&&null!=e.tlv&&(this.hTLV=e.tlv,this.isModified=!1)},he.asn1.DERAbstractString=function(e){he.asn1.DERAbstractString.superclass.constructor.call(this);this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=Ee(this.s).toLowerCase()},this.setStringHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e?this.setString(e):void 0!==e.str?this.setString(e.str):void 0!==e.hex&&this.setStringHex(e.hex))},We(he.asn1.DERAbstractString,he.asn1.ASN1Object),he.asn1.DERAbstractTime=function(e){he.asn1.DERAbstractTime.superclass.constructor.call(this);this.localDateToUTC=function(e){var t=e.getTime()+6e4*e.getTimezoneOffset();return new Date(t)},this.formatDate=function(e,t,n){var r=this.zeroPadding,i=this.localDateToUTC(e),a=String(i.getFullYear());"utc"==t&&(a=a.substr(2,2));var s=a+r(String(i.getMonth()+1),2)+r(String(i.getDate()),2)+r(String(i.getHours()),2)+r(String(i.getMinutes()),2)+r(String(i.getSeconds()),2);if(!0===n){var o=i.getMilliseconds();if(0!=o){var u=r(String(o),3);s=s+"."+(u=u.replace(/[0]+$/,""))}}return s+"Z"},this.zeroPadding=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=ye(e)},this.setByDateValue=function(e,t,n,r,i,a){var s=new Date(Date.UTC(e,t-1,n,r,i,a,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}},We(he.asn1.DERAbstractTime,he.asn1.ASN1Object),he.asn1.DERAbstractStructured=function(e){he.asn1.DERAbstractString.superclass.constructor.call(this);this.setByASN1ObjectArray=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array=e},this.appendASN1Object=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array.push(e)},this.asn1Array=new Array,void 0!==e&&void 0!==e.array&&(this.asn1Array=e.array)},We(he.asn1.DERAbstractStructured,he.asn1.ASN1Object),he.asn1.DERBoolean=function(e){he.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV=0==e?"010100":"0101ff"},We(he.asn1.DERBoolean,he.asn1.ASN1Object),he.asn1.DERInteger=function(e){he.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=he.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new S(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.bigint?this.setByBigInteger(e.bigint):void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},We(he.asn1.DERInteger,he.asn1.ASN1Object),he.asn1.DERBitString=function(e){if(void 0!==e&&void 0!==e.obj){var t=he.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.getEncodedHex()}he.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7<e)throw"unused bits shall be from 0 to 7: u = "+e;var n="0"+e;this.hTLV=null,this.isModified=!0,this.hV=n+t},this.setByBinaryString=function(e){var t=8-(e=e.replace(/0+$/,"")).length%8;8==t&&(t=0);for(var n=0;n<=t;n++)e+="0";var r="";for(n=0;n<e.length-1;n+=8){var i=e.substr(n,8),a=parseInt(i,2).toString(16);1==a.length&&(a="0"+a),r+=a}this.hTLV=null,this.isModified=!0,this.hV="0"+t+r},this.setByBooleanArray=function(e){for(var t="",n=0;n<e.length;n++)1==e[n]?t+="1":t+="0";this.setByBinaryString(t)},this.newFalseArray=function(e){for(var t=new Array(e),n=0;n<e;n++)t[n]=!1;return t},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e&&e.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(e):void 0!==e.hex?this.setHexValueIncludingUnusedBits(e.hex):void 0!==e.bin?this.setByBinaryString(e.bin):void 0!==e.array&&this.setByBooleanArray(e.array))},We(he.asn1.DERBitString,he.asn1.ASN1Object),he.asn1.DEROctetString=function(e){if(void 0!==e&&void 0!==e.obj){var t=he.asn1.ASN1Util.newObject(e.obj);e.hex=t.getEncodedHex()}he.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT="04"},We(he.asn1.DEROctetString,he.asn1.DERAbstractString),he.asn1.DERNull=function(){he.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},We(he.asn1.DERNull,he.asn1.ASN1Object),he.asn1.DERObjectIdentifier=function(e){he.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueOidString=function(e){var t=qe(e);if(null==t)throw new Error("malformed oid string: "+e);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueName=function(e){var t=he.asn1.x509.OID.name2oid(e);if(""===t)throw new Error("DERObjectIdentifier oidName undefined: "+e);this.setValueOidString(t)},this.setValueNameOrOid=function(e){e.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(e):this.setValueName(e)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(e){"string"==typeof e?this.setValueNameOrOid(e):void 0!==e.oid?this.setValueNameOrOid(e.oid):void 0!==e.name?this.setValueNameOrOid(e.name):void 0!==e.hex&&this.setValueHex(e.hex)},void 0!==e&&this.setByParam(e)},We(he.asn1.DERObjectIdentifier,he.asn1.ASN1Object),he.asn1.DEREnumerated=function(e){he.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=he.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new S(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},We(he.asn1.DEREnumerated,he.asn1.ASN1Object),he.asn1.DERUTF8String=function(e){he.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT="0c"},We(he.asn1.DERUTF8String,he.asn1.DERAbstractString),he.asn1.DERNumericString=function(e){he.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT="12"},We(he.asn1.DERNumericString,he.asn1.DERAbstractString),he.asn1.DERPrintableString=function(e){he.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT="13"},We(he.asn1.DERPrintableString,he.asn1.DERAbstractString),he.asn1.DERTeletexString=function(e){he.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT="14"},We(he.asn1.DERTeletexString,he.asn1.DERAbstractString),he.asn1.DERIA5String=function(e){he.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="16"},We(he.asn1.DERIA5String,he.asn1.DERAbstractString),he.asn1.DERVisibleString=function(e){he.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="1a"},We(he.asn1.DERVisibleString,he.asn1.DERAbstractString),he.asn1.DERBMPString=function(e){he.asn1.DERBMPString.superclass.constructor.call(this,e),this.hT="1e"},We(he.asn1.DERBMPString,he.asn1.DERAbstractString),he.asn1.DERUTCTime=function(e){he.asn1.DERUTCTime.superclass.constructor.call(this,e),this.hT="17",this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"utc"),this.hV=ye(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=ye(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{12}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date))},We(he.asn1.DERUTCTime,he.asn1.DERAbstractTime),he.asn1.DERGeneralizedTime=function(e){he.asn1.DERGeneralizedTime.superclass.constructor.call(this,e),this.hT="18",this.withMillis=!1,this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=ye(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=ye(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{14}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date),!0===e.millis&&(this.withMillis=!0))},We(he.asn1.DERGeneralizedTime,he.asn1.DERAbstractTime),he.asn1.DERSequence=function(e){he.asn1.DERSequence.superclass.constructor.call(this,e),this.hT="30",this.getFreshValueHex=function(){for(var e="",t=0;t<this.asn1Array.length;t++){e+=this.asn1Array[t].getEncodedHex()}return this.hV=e,this.hV}},We(he.asn1.DERSequence,he.asn1.DERAbstractStructured),he.asn1.DERSet=function(e){he.asn1.DERSet.superclass.constructor.call(this,e),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var e=new Array,t=0;t<this.asn1Array.length;t++){var n=this.asn1Array[t];e.push(n.getEncodedHex())}return 1==this.sortFlag&&e.sort(),this.hV=e.join(""),this.hV},void 0!==e&&void 0!==e.sortflag&&0==e.sortflag&&(this.sortFlag=!1)},We(he.asn1.DERSet,he.asn1.DERAbstractStructured),he.asn1.DERTaggedObject=function(e){he.asn1.DERTaggedObject.superclass.constructor.call(this);var t=he.asn1;this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(e,t,n){this.hT=t,this.isExplicit=e,this.asn1Object=n,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=n.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,t),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(e){null!=e.tag&&(this.hT=e.tag),null!=e.explicit&&(this.isExplicit=e.explicit),null!=e.tage&&(this.hT=e.tage,this.isExplicit=!0),null!=e.tagi&&(this.hT=e.tagi,this.isExplicit=!1),null!=e.obj&&(e.obj instanceof t.ASN1Object?(this.asn1Object=e.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)):"object"==typeof e.obj&&(this.asn1Object=t.ASN1Util.newObject(e.obj),this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},null!=e&&this.setByParam(e)},We(he.asn1.DERTaggedObject,he.asn1.ASN1Object);var he,fe,de,pe=new function(){};function ge(e){for(var t=new Array,n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function me(e){for(var t="",n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}function ve(e){for(var t="",n=0;n<e.length;n++){var r=e[n].toString(16);1==r.length&&(r="0"+r),t+=r}return t}function ye(e){return ve(ge(e))}function be(e){return e=(e=(e=e.replace(/\=/g,"")).replace(/\+/g,"-")).replace(/\//g,"_")}function we(e){return e.length%4==2?e+="==":e.length%4==3&&(e+="="),e=(e=e.replace(/-/g,"+")).replace(/_/g,"/")}function xe(e){return e.length%2==1&&(e="0"+e),be(b(e))}function Se(e){return w(we(e))}function Ee(e){return ke(Le(e))}function Ae(e){return decodeURIComponent(Oe(e))}function Fe(e){for(var t="",n=0;n<e.length-1;n+=2)t+=String.fromCharCode(parseInt(e.substr(n,2),16));return t}function Ce(e){for(var t="",n=0;n<e.length;n++)t+=("0"+e.charCodeAt(n).toString(16)).slice(-2);return t}function De(e){return b(e)}function Re(e){var t=De(e).replace(/(.{64})/g,"$1\r\n");return t=t.replace(/\r\n$/,"")}function Ie(e){return w(e.replace(/[^0-9A-Za-z\/+=]*/g,""))}function Te(e,t){return"-----BEGIN "+t+"-----\r\n"+Re(e)+"\r\n-----END "+t+"-----\r\n"}function $e(e,t){if(-1==e.indexOf("-----BEGIN "))throw"can't find PEM header: "+t;return Ie(e=void 0!==t?(e=e.replace(new RegExp("^[^]*-----BEGIN "+t+"-----"),"")).replace(new RegExp("-----END "+t+"-----[^]*$"),""):(e=e.replace(/^[^]*-----BEGIN [^-]+-----/,"")).replace(/-----END [^-]+-----[^]*$/,""))}function Pe(e){var t,n,r,i,a,s,o,u,c,l,h;if(h=e.match(/^(\d{2}|\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(|\.\d+)Z$/))return u=h[1],t=parseInt(u),2===u.length&&(50<=t&&t<100?t=1900+t:0<=t&&t<50&&(t=2e3+t)),n=parseInt(h[2])-1,r=parseInt(h[3]),i=parseInt(h[4]),a=parseInt(h[5]),s=parseInt(h[6]),o=0,""!==(c=h[7])&&(l=(c.substr(1)+"00").substr(0,3),o=parseInt(l)),Date.UTC(t,n,r,i,a,s,o);throw"unsupported zulu format: "+e}function _e(e){return~~(Pe(e)/1e3)}function ke(e){return e.replace(/%/g,"")}function Oe(e){return e.replace(/(..)/g,"%$1")}function Be(e){var t="malformed IPv6 address";if(!e.match(/^[0-9A-Fa-f:]+$/))throw t;var n=(e=e.toLowerCase()).split(":").length-1;if(n<2)throw t;var r=":".repeat(7-n+2),i=(e=e.replace("::",r)).split(":");if(8!=i.length)throw t;for(var a=0;a<8;a++)i[a]=("0000"+i[a]).slice(-4);return i.join("")}function je(e){if(!e.match(/^[0-9A-Fa-f]{32}$/))throw"malformed IPv6 address octet";for(var t=(e=e.toLowerCase()).match(/.{1,4}/g),n=0;n<8;n++)t[n]=t[n].replace(/^0+/,""),""==t[n]&&(t[n]="0");var r=(e=":"+t.join(":")+":").match(/:(0:){2,}/g);if(null===r)return e.slice(1,-1);var i="";for(n=0;n<r.length;n++)r[n].length>i.length&&(i=r[n]);return(e=e.replace(i,"::")).slice(1,-1)}function He(e){var t="malformed hex value";if(!e.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw t;if(8!=e.length)return 32==e.length?je(e):e;try{return parseInt(e.substr(0,2),16)+"."+parseInt(e.substr(2,2),16)+"."+parseInt(e.substr(4,2),16)+"."+parseInt(e.substr(6,2),16)}catch(e){throw t}}function Ne(e){return e.match(/.{4}/g).map((function(e){var t=parseInt(e.substr(0,2),16),n=parseInt(e.substr(2),16);if(0==t&n<128)return String.fromCharCode(n);if(t<8){var r=128|63&n;return Ae((192|(7&t)<<3|(192&n)>>6).toString(16)+r.toString(16))}r=128|(15&t)<<2|(192&n)>>6;var i=128|63&n;return Ae((224|(240&t)>>4).toString(16)+r.toString(16)+i.toString(16))})).join("")}function Le(e){for(var t=encodeURIComponent(e),n="",r=0;r<t.length;r++)"%"==t[r]?(n+=t.substr(r,3),r+=2):n=n+"%"+ye(t[r]);return n}function Me(e){return!(e.length%2!=0||!e.match(/^[0-9a-f]+$/)&&!e.match(/^[0-9A-F]+$/))}function Ue(e){return e.length%2==1?"0"+e:e.substr(0,1)>"7"?"00"+e:e}function Ve(e){e=(e=(e=e.replace(/^\s*\[\s*/,"")).replace(/\s*\]\s*$/,"")).replace(/\s*/g,"");try{return e.split(/,/).map((function(e,t,n){var r=parseInt(e);if(r<0||255<r)throw"integer not in range 0-255";return("00"+r.toString(16)).slice(-2)})).join("")}catch(e){throw"malformed integer array string: "+e}}pe.getLblen=function(e,t){if("8"!=e.substr(t+2,1))return 1;var n=parseInt(e.substr(t+3,1));return 0==n?-1:0<n&&n<10?n+1:-2},pe.getL=function(e,t){var n=pe.getLblen(e,t);return n<1?"":e.substr(t+2,2*n)},pe.getVblen=function(e,t){var n;return""==(n=pe.getL(e,t))?-1:("8"===n.substr(0,1)?new S(n.substr(2),16):new S(n,16)).intValue()},pe.getVidx=function(e,t){var n=pe.getLblen(e,t);return n<0?n:t+2*(n+1)},pe.getV=function(e,t){var n=pe.getVidx(e,t),r=pe.getVblen(e,t);return e.substr(n,2*r)},pe.getTLV=function(e,t){return e.substr(t,2)+pe.getL(e,t)+pe.getV(e,t)},pe.getTLVblen=function(e,t){return 2+2*pe.getLblen(e,t)+2*pe.getVblen(e,t)},pe.getNextSiblingIdx=function(e,t){return pe.getVidx(e,t)+2*pe.getVblen(e,t)},pe.getChildIdx=function(e,t){var n,r,i,a=pe,s=[];n=a.getVidx(e,t),r=2*a.getVblen(e,t),"03"==e.substr(t,2)&&(n+=2,r-=2),i=0;for(var o=n;i<=r;){var u=a.getTLVblen(e,o);if((i+=u)<=r&&s.push(o),o+=u,i>=r)break}return s},pe.getNthChildIdx=function(e,t,n){return pe.getChildIdx(e,t)[n]},pe.getIdxbyList=function(e,t,n,r){var i,a,s=pe;return 0==n.length?void 0!==r&&e.substr(t,2)!==r?-1:t:(i=n.shift())>=(a=s.getChildIdx(e,t)).length?-1:s.getIdxbyList(e,a[i],n,r)},pe.getIdxbyListEx=function(e,t,n,r){var i,a,s=pe;if(0==n.length)return void 0!==r&&e.substr(t,2)!==r?-1:t;i=n.shift(),a=s.getChildIdx(e,t);for(var o=0,u=0;u<a.length;u++){var c=e.substr(a[u],2);if("number"==typeof i&&!s.isContextTag(c)&&o==i||"string"==typeof i&&s.isContextTag(c,i))return s.getIdxbyListEx(e,a[u],n,r);s.isContextTag(c)||o++}return-1},pe.getTLVbyList=function(e,t,n,r){var i=pe,a=i.getIdxbyList(e,t,n,r);return-1==a?null:a>=e.length?null:i.getTLV(e,a)},pe.getTLVbyListEx=function(e,t,n,r){var i=pe,a=i.getIdxbyListEx(e,t,n,r);return-1==a?null:i.getTLV(e,a)},pe.getVbyList=function(e,t,n,r,i){var a,s,o=pe;return-1==(a=o.getIdxbyList(e,t,n,r))?null:a>=e.length?null:(s=o.getV(e,a),!0===i&&(s=s.substr(2)),s)},pe.getVbyListEx=function(e,t,n,r,i){var a,s,o=pe;return-1==(a=o.getIdxbyListEx(e,t,n,r))?null:(s=o.getV(e,a),"03"==e.substr(a,2)&&!1!==i&&(s=s.substr(2)),s)},pe.getInt=function(e,t,n){null==n&&(n=-1);try{var r=e.substr(t,2);if("02"!=r&&"03"!=r)return n;var i=pe.getV(e,t);return"02"==r?parseInt(i,16):Ge(i)}catch(e){return n}},pe.getOID=function(e,t,n){null==n&&(n=null);try{return"06"!=e.substr(t,2)?n:Ke(pe.getV(e,t))}catch(e){return n}},pe.getOIDName=function(e,t,n){null==n&&(n=null);try{var r=pe.getOID(e,t,n);if(r==n)return n;var i=he.asn1.x509.OID.oid2name(r);return""==i?r:i}catch(e){return n}},pe.getString=function(e,t,n){null==n&&(n=null);try{return Fe(pe.getV(e,t))}catch(e){return n}},pe.hextooidstr=function(e){var t=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},n=[],r=e.substr(0,2),i=parseInt(r,16);n[0]=new String(Math.floor(i/40)),n[1]=new String(i%40);for(var a=e.substr(2),s=[],o=0;o<a.length/2;o++)s.push(parseInt(a.substr(2*o,2),16));var u=[],c="";for(o=0;o<s.length;o++)128&s[o]?c+=t((127&s[o]).toString(2),7):(c+=t((127&s[o]).toString(2),7),u.push(new String(parseInt(c,2))),c="");var l=n.join(".");return u.length>0&&(l=l+"."+u.join(".")),l},pe.dump=function(e,t,n,r){var i=pe,a=i.getV,s=i.dump,o=i.getChildIdx,u=e;e instanceof he.asn1.ASN1Object&&(u=e.getEncodedHex());var c=function(e,t){return e.length<=2*t?e:e.substr(0,t)+"..(total "+e.length/2+"bytes).."+e.substr(e.length-t,t)};void 0===t&&(t={ommit_long_octet:32}),void 0===n&&(n=0),void 0===r&&(r="");var l,h=t.ommit_long_octet;if("01"==(l=u.substr(n,2)))return"00"==(f=a(u,n))?r+"BOOLEAN FALSE\n":r+"BOOLEAN TRUE\n";if("02"==l)return r+"INTEGER "+c(f=a(u,n),h)+"\n";if("03"==l){var f=a(u,n);if(i.isASN1HEX(f.substr(2))){var d=r+"BITSTRING, encapsulates\n";return d+=s(f.substr(2),t,0,r+" ")}return r+"BITSTRING "+c(f,h)+"\n"}if("04"==l){f=a(u,n);if(i.isASN1HEX(f)){d=r+"OCTETSTRING, encapsulates\n";return d+=s(f,t,0,r+" ")}return r+"OCTETSTRING "+c(f,h)+"\n"}if("05"==l)return r+"NULL\n";if("06"==l){var p=a(u,n),g=he.asn1.ASN1Util.oidHexToInt(p),m=he.asn1.x509.OID.oid2name(g),v=g.replace(/\./g," ");return""!=m?r+"ObjectIdentifier "+m+" ("+v+")\n":r+"ObjectIdentifier ("+v+")\n"}if("0a"==l)return r+"ENUMERATED "+parseInt(a(u,n))+"\n";if("0c"==l)return r+"UTF8String '"+Ae(a(u,n))+"'\n";if("13"==l)return r+"PrintableString '"+Ae(a(u,n))+"'\n";if("14"==l)return r+"TeletexString '"+Ae(a(u,n))+"'\n";if("16"==l)return r+"IA5String '"+Ae(a(u,n))+"'\n";if("17"==l)return r+"UTCTime "+Ae(a(u,n))+"\n";if("18"==l)return r+"GeneralizedTime "+Ae(a(u,n))+"\n";if("1a"==l)return r+"VisualString '"+Ae(a(u,n))+"'\n";if("1e"==l)return r+"BMPString '"+Ne(a(u,n))+"'\n";if("30"==l){if("3000"==u.substr(n,4))return r+"SEQUENCE {}\n";d=r+"SEQUENCE\n";var y=t;if((2==(x=o(u,n)).length||3==x.length)&&"06"==u.substr(x[0],2)&&"04"==u.substr(x[x.length-1],2)){m=i.oidname(a(u,x[0]));var b=JSON.parse(JSON.stringify(t));b.x509ExtName=m,y=b}for(var w=0;w<x.length;w++)d+=s(u,y,x[w],r+" ");return d}if("31"==l){d=r+"SET\n";var x=o(u,n);for(w=0;w<x.length;w++)d+=s(u,t,x[w],r+" ");return d}if(0!=(128&(l=parseInt(l,16)))){var S=31&l;if(0!=(32&l)){for(d=r+"["+S+"]\n",x=o(u,n),w=0;w<x.length;w++)d+=s(u,t,x[w],r+" ");return d}f=a(u,n);if(pe.isASN1HEX(f)){var d=r+"["+S+"]\n";return d+=s(f,t,0,r+" ")}return"68747470"==f.substr(0,8)?f=Ae(f):"subjectAltName"===t.x509ExtName&&2==S&&(f=Ae(f)),d=r+"["+S+"] "+f+"\n"}return r+"UNKNOWN("+l+") "+a(u,n)+"\n"},pe.isContextTag=function(e,t){var n,r;e=e.toLowerCase();try{n=parseInt(e,16)}catch(e){return-1}if(void 0===t)return 128==(192&n);try{return null!=t.match(/^\[[0-9]+\]$/)&&(!((r=parseInt(t.substr(1,t.length-1),10))>31)&&(128==(192&n)&&(31&n)==r))}catch(e){return!1}},pe.isASN1HEX=function(e){var t=pe;if(e.length%2==1)return!1;var n=t.getVblen(e,0),r=e.substr(0,2),i=t.getL(e,0);return e.length-r.length-i.length==2*n},pe.checkStrictDER=function(e,t,n,r,i){var a=pe;if(void 0===n){if("string"!=typeof e)throw new Error("not hex string");if(e=e.toLowerCase(),!he.lang.String.isHex(e))throw new Error("not hex string");n=e.length,i=(r=e.length/2)<128?1:Math.ceil(r.toString(16))+1}if(a.getL(e,t).length>2*i)throw new Error("L of TLV too long: idx="+t);var s=a.getVblen(e,t);if(s>r)throw new Error("value of L too long than hex: idx="+t);var o=a.getTLV(e,t),u=o.length-2-a.getL(e,t).length;if(u!==2*s)throw new Error("V string length and L's value not the same:"+u+"/"+2*s);if(0===t&&e.length!=o.length)throw new Error("total length and TLV length unmatch:"+e.length+"!="+o.length);var c=e.substr(t,2);if("02"===c){var l=a.getVidx(e,t);if("00"==e.substr(l,2)&&e.charCodeAt(l+2)<56)throw new Error("not least zeros for DER INTEGER")}if(32&parseInt(c,16)){for(var h=a.getVblen(e,t),f=0,d=a.getChildIdx(e,t),p=0;p<d.length;p++){f+=a.getTLV(e,d[p]).length,a.checkStrictDER(e,d[p],n,r,i)}if(2*h!=f)throw new Error("sum of children's TLV length and L unmatch: "+2*h+"!="+f)}},pe.oidname=function(e){var t=he.asn1;he.lang.String.isHex(e)&&(e=t.ASN1Util.oidHexToInt(e));var n=t.x509.OID.oid2name(e);return""===n&&(n=e),n},void 0!==he&&he||(he={}),void 0!==he.asn1&&he.asn1||(he.asn1={}),void 0!==he.asn1.x509&&he.asn1.x509||(he.asn1.x509={}),he.asn1.x509.Certificate=function(e){he.asn1.x509.Certificate.superclass.constructor.call(this);var t=he.asn1,n=t.DERBitString,r=t.DERSequence,i=t.x509,a=i.TBSCertificate,s=i.AlgorithmIdentifier;this.params=void 0,this.setByParam=function(e){this.params=e},this.sign=function(){var e=this.params,t=e.sigalg;null!=e.sigalg.name&&(t=e.sigalg.name);var n=e.tbsobj.getEncodedHex(),r=new he.crypto.Signature({alg:t});r.init(e.cakey),r.updateHex(n),e.sighex=r.sign()},this.getPEM=function(){return Te(this.getEncodedHex(),"CERTIFICATE")},this.getEncodedHex=function(){var e=this.params;if(null!=e.tbsobj&&null!=e.tbsobj||(e.tbsobj=new a(e)),null==e.sighex&&null!=e.cakey&&this.sign(),null==e.sighex)throw new Error("sighex or cakey parameter not defined");var t=[];return t.push(e.tbsobj),t.push(new s({name:e.sigalg})),t.push(new n({hex:"00"+e.sighex})),new r({array:t}).getEncodedHex()},null!=e&&(this.params=e)},We(he.asn1.x509.Certificate,he.asn1.ASN1Object),he.asn1.x509.TBSCertificate=function(e){he.asn1.x509.TBSCertificate.superclass.constructor.call(this);var t=he.asn1,n=t.x509,r=t.DERTaggedObject,i=t.DERInteger,a=t.DERSequence,s=n.AlgorithmIdentifier,o=n.Time,u=n.X500Name,c=n.Extensions,l=n.SubjectPublicKeyInfo;this.params=null,this.setByParam=function(e){this.params=e},this.getEncodedHex=function(){var e=[],t=this.params;if(null!=t.version||1!=t.version){var n=2;null!=t.version&&(n=t.version-1);var h=new r({obj:new i({int:n})});e.push(h)}return e.push(new i(t.serial)),e.push(new s({name:t.sigalg})),e.push(new u(t.issuer)),e.push(new a({array:[new o(t.notbefore),new o(t.notafter)]})),e.push(new u(t.subject)),e.push(new l(Ye.getKey(t.sbjpubkey))),void 0!==t.ext&&t.ext.length>0&&e.push(new r({tag:"a3",obj:new c(t.ext)})),new he.asn1.DERSequence({array:e}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.x509.TBSCertificate,he.asn1.ASN1Object),he.asn1.x509.Extensions=function(e){he.asn1.x509.Extensions.superclass.constructor.call(this);var t=he.asn1,n=t.DERSequence,r=t.x509;this.aParam=[],this.setByParam=function(e){this.aParam=e},this.getEncodedHex=function(){for(var e=[],t=0;t<this.aParam.length;t++){var i=this.aParam[t],a=i.extname,s=null;if(null!=i.extn)s=new r.PrivateExtension(i);else if("subjectKeyIdentifier"==a)s=new r.SubjectKeyIdentifier(i);else if("keyUsage"==a)s=new r.KeyUsage(i);else if("subjectAltName"==a)s=new r.SubjectAltName(i);else if("issuerAltName"==a)s=new r.IssuerAltName(i);else if("basicConstraints"==a)s=new r.BasicConstraints(i);else if("cRLDistributionPoints"==a)s=new r.CRLDistributionPoints(i);else if("certificatePolicies"==a)s=new r.CertificatePolicies(i);else if("authorityKeyIdentifier"==a)s=new r.AuthorityKeyIdentifier(i);else if("extKeyUsage"==a)s=new r.ExtKeyUsage(i);else if("authorityInfoAccess"==a)s=new r.AuthorityInfoAccess(i);else if("cRLNumber"==a)s=new r.CRLNumber(i);else if("cRLReason"==a)s=new r.CRLReason(i);else if("ocspNonce"==a)s=new r.OCSPNonce(i);else if("ocspNoCheck"==a)s=new r.OCSPNoCheck(i);else if("adobeTimeStamp"==a)s=new r.AdobeTimeStamp(i);else{if("subjectDirectoryAttributes"!=a)throw new Error("extension not supported:"+JSON.stringify(i));s=new r.SubjectDirectoryAttributes(i)}null!=s&&e.push(s)}return new n({array:e}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.x509.Extensions,he.asn1.ASN1Object),he.asn1.x509.Extension=function(e){he.asn1.x509.Extension.superclass.constructor.call(this);var t=he.asn1,n=t.DERObjectIdentifier,r=t.DEROctetString,i=(t.DERBitString,t.DERBoolean),a=t.DERSequence;this.getEncodedHex=function(){var e=new n({oid:this.oid}),t=new r({hex:this.getExtnValueHex()}),s=new Array;return s.push(e),this.critical&&s.push(new i),s.push(t),new a({array:s}).getEncodedHex()},this.critical=!1,void 0!==e&&void 0!==e.critical&&(this.critical=e.critical)},We(he.asn1.x509.Extension,he.asn1.ASN1Object),he.asn1.x509.KeyUsage=function(e){he.asn1.x509.KeyUsage.superclass.constructor.call(this,e);var t=Ze.KEYUSAGE_NAME;if(this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.15",void 0!==e&&(void 0!==e.bin&&(this.asn1ExtnValue=new he.asn1.DERBitString(e)),void 0!==e.names&&void 0!==e.names.length)){for(var n=e.names,r="000000000",i=0;i<n.length;i++)for(var a=0;a<t.length;a++)n[i]===t[a]&&(r=r.substring(0,a)+"1"+r.substring(a+1,r.length));this.asn1ExtnValue=new he.asn1.DERBitString({bin:r})}},We(he.asn1.x509.KeyUsage,he.asn1.x509.Extension),he.asn1.x509.BasicConstraints=function(e){he.asn1.x509.BasicConstraints.superclass.constructor.call(this,e);var t=he.asn1,n=t.DERBoolean,r=t.DERInteger,i=t.DERSequence;this.getExtnValueHex=function(){var e=new Array;this.cA&&e.push(new n),this.pathLen>-1&&e.push(new r({int:this.pathLen}));var t=new i({array:e});return this.asn1ExtnValue=t,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.19",this.cA=!1,this.pathLen=-1,void 0!==e&&(void 0!==e.cA&&(this.cA=e.cA),void 0!==e.pathLen&&(this.pathLen=e.pathLen))},We(he.asn1.x509.BasicConstraints,he.asn1.x509.Extension),he.asn1.x509.CRLDistributionPoints=function(e){he.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,e);var t=he.asn1,n=t.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.setByDPArray=function(e){for(var r=[],i=0;i<e.length;i++)if(e[i]instanceof he.asn1.ASN1Object)r.push(e[i]);else{var a=new n.DistributionPoint(e[i]);r.push(a)}this.asn1ExtnValue=new t.DERSequence({array:r})},this.setByOneURI=function(e){var t=new n.DistributionPoint({fulluri:e});this.setByDPArray([t])},this.oid="2.5.29.31",void 0!==e&&(void 0!==e.array?this.setByDPArray(e.array):void 0!==e.uri&&this.setByOneURI(e.uri))},We(he.asn1.x509.CRLDistributionPoints,he.asn1.x509.Extension),he.asn1.x509.DistributionPoint=function(e){he.asn1.x509.DistributionPoint.superclass.constructor.call(this);var t=he.asn1,n=t.x509.DistributionPointName;this.getEncodedHex=function(){var e=new t.DERSequence;if(null!=this.asn1DP){var n=new t.DERTaggedObject({explicit:!0,tag:"a0",obj:this.asn1DP});e.appendASN1Object(n)}return this.hTLV=e.getEncodedHex(),this.hTLV},void 0!==e&&(void 0!==e.dpobj?this.asn1DP=e.dpobj:void 0!==e.dpname?this.asn1DP=new n(e.dpname):void 0!==e.fulluri&&(this.asn1DP=new n({full:[{uri:e.fulluri}]})))},We(he.asn1.x509.DistributionPoint,he.asn1.ASN1Object),he.asn1.x509.DistributionPointName=function(e){he.asn1.x509.DistributionPointName.superclass.constructor.call(this);var t=he.asn1,n=t.DERTaggedObject;if(this.getEncodedHex=function(){if("full"!=this.type)throw new Error("currently type shall be 'full': "+this.type);return this.asn1Obj=new n({explicit:!1,tag:this.tag,obj:this.asn1V}),this.hTLV=this.asn1Obj.getEncodedHex(),this.hTLV},void 0!==e)if(t.x509.GeneralNames.prototype.isPrototypeOf(e))this.type="full",this.tag="a0",this.asn1V=e;else{if(void 0===e.full)throw new Error("This class supports GeneralNames only as argument");this.type="full",this.tag="a0",this.asn1V=new t.x509.GeneralNames(e.full)}},We(he.asn1.x509.DistributionPointName,he.asn1.ASN1Object),he.asn1.x509.CertificatePolicies=function(e){he.asn1.x509.CertificatePolicies.superclass.constructor.call(this,e);var t=he.asn1,n=t.x509,r=t.DERSequence,i=n.PolicyInformation;this.params=null,this.getExtnValueHex=function(){for(var e=[],t=0;t<this.params.array.length;t++)e.push(new i(this.params.array[t]));var n=new r({array:e});return this.asn1ExtnValue=n,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.32",void 0!==e&&(this.params=e)},We(he.asn1.x509.CertificatePolicies,he.asn1.x509.Extension),he.asn1.x509.PolicyInformation=function(e){he.asn1.x509.PolicyInformation.superclass.constructor.call(this,e);var t=he.asn1,n=t.DERSequence,r=t.DERObjectIdentifier,i=t.x509.PolicyQualifierInfo;this.params=null,this.getEncodedHex=function(){if(void 0===this.params.policyoid&&void 0===this.params.array)throw new Error("parameter oid and array missing");var e=[new r(this.params.policyoid)];if(void 0!==this.params.array){for(var t=[],a=0;a<this.params.array.length;a++)t.push(new i(this.params.array[a]));t.length>0&&e.push(new n({array:t}))}return new n({array:e}).getEncodedHex()},void 0!==e&&(this.params=e)},We(he.asn1.x509.PolicyInformation,he.asn1.ASN1Object),he.asn1.x509.PolicyQualifierInfo=function(e){he.asn1.x509.PolicyQualifierInfo.superclass.constructor.call(this,e);var t=he.asn1,n=t.DERSequence,r=t.DERIA5String,i=t.DERObjectIdentifier,a=t.x509.UserNotice;this.params=null,this.getEncodedHex=function(){return void 0!==this.params.cps?new n({array:[new i({oid:"1.3.6.1.5.5.7.2.1"}),new r({str:this.params.cps})]}).getEncodedHex():null!=this.params.unotice?new n({array:[new i({oid:"1.3.6.1.5.5.7.2.2"}),new a(this.params.unotice)]}).getEncodedHex():void 0},void 0!==e&&(this.params=e)},We(he.asn1.x509.PolicyQualifierInfo,he.asn1.ASN1Object),he.asn1.x509.UserNotice=function(e){he.asn1.x509.UserNotice.superclass.constructor.call(this,e);var t=he.asn1.DERSequence,n=(he.asn1.DERInteger,he.asn1.x509.DisplayText),r=he.asn1.x509.NoticeReference;this.params=null,this.getEncodedHex=function(){var e=[];return void 0!==this.params.noticeref&&e.push(new r(this.params.noticeref)),void 0!==this.params.exptext&&e.push(new n(this.params.exptext)),new t({array:e}).getEncodedHex()},void 0!==e&&(this.params=e)},We(he.asn1.x509.UserNotice,he.asn1.ASN1Object),he.asn1.x509.NoticeReference=function(e){he.asn1.x509.NoticeReference.superclass.constructor.call(this,e);var t=he.asn1.DERSequence,n=he.asn1.DERInteger,r=he.asn1.x509.DisplayText;this.params=null,this.getEncodedHex=function(){var e=[];if(void 0!==this.params.org&&e.push(new r(this.params.org)),void 0!==this.params.noticenum){for(var i=[],a=this.params.noticenum,s=0;s<a.length;s++)i.push(new n(a[s]));e.push(new t({array:i}))}if(0==e.length)throw new Error("parameter is empty");return new t({array:e}).getEncodedHex()},void 0!==e&&(this.params=e)},We(he.asn1.x509.NoticeReference,he.asn1.ASN1Object),he.asn1.x509.DisplayText=function(e){he.asn1.x509.DisplayText.superclass.constructor.call(this,e),this.hT="0c",void 0!==e&&("ia5"===e.type?this.hT="16":"vis"===e.type?this.hT="1a":"bmp"===e.type&&(this.hT="1e"))},We(he.asn1.x509.DisplayText,he.asn1.DERAbstractString),he.asn1.x509.ExtKeyUsage=function(e){he.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,e);var t=he.asn1;this.setPurposeArray=function(e){this.asn1ExtnValue=new t.DERSequence;for(var n=0;n<e.length;n++){var r=new t.DERObjectIdentifier(e[n]);this.asn1ExtnValue.appendASN1Object(r)}},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.37",void 0!==e&&void 0!==e.array&&this.setPurposeArray(e.array)},We(he.asn1.x509.ExtKeyUsage,he.asn1.x509.Extension),he.asn1.x509.AuthorityKeyIdentifier=function(e){he.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this,e);var t=he,n=t.asn1,r=n.DERTaggedObject,i=n.x509.GeneralNames;t.crypto.Util.isKey;this.asn1KID=null,this.asn1CertIssuer=null,this.asn1CertSN=null,this.getExtnValueHex=function(){var e=new Array;this.asn1KID&&e.push(new r({explicit:!1,tag:"80",obj:this.asn1KID})),this.asn1CertIssuer&&e.push(new r({explicit:!1,tag:"a1",obj:new i([{dn:this.asn1CertIssuer}])})),this.asn1CertSN&&e.push(new r({explicit:!1,tag:"82",obj:this.asn1CertSN}));var t=new n.DERSequence({array:e});return this.asn1ExtnValue=t,this.asn1ExtnValue.getEncodedHex()},this.setKIDByParam=function(e){if(void 0!==e.str||void 0!==e.hex)this.asn1KID=new he.asn1.DEROctetString(e);else if("object"==typeof e&&he.crypto.Util.isKey(e)||"string"==typeof e&&-1!=e.indexOf("BEGIN ")){var t=e;"string"==typeof e&&(t=Ye.getKey(e));var n=Ye.getKeyID(t);this.asn1KID=new he.asn1.DEROctetString({hex:n})}},this.setCertIssuerByParam=function(e){void 0!==e.str||void 0!==e.ldapstr||void 0!==e.hex||void 0!==e.certsubject||void 0!==e.certissuer?this.asn1CertIssuer=new he.asn1.x509.X500Name(e):"string"==typeof e&&-1!=e.indexOf("BEGIN ")&&-1!=e.indexOf("CERTIFICATE")&&(this.asn1CertIssuer=new he.asn1.x509.X500Name({certissuer:e}))},this.setCertSNByParam=function(e){if(void 0!==e.str||void 0!==e.bigint||void 0!==e.hex)this.asn1CertSN=new he.asn1.DERInteger(e);else if("string"==typeof e&&-1!=e.indexOf("BEGIN ")&&e.indexOf("CERTIFICATE")){var t=new Ze;t.readCertPEM(e);var n=t.getSerialNumberHex();this.asn1CertSN=new he.asn1.DERInteger({hex:n})}},this.oid="2.5.29.35",void 0!==e&&(void 0!==e.kid&&this.setKIDByParam(e.kid),void 0!==e.issuer&&this.setCertIssuerByParam(e.issuer),void 0!==e.sn&&this.setCertSNByParam(e.sn),void 0!==e.issuersn&&"string"==typeof e.issuersn&&-1!=e.issuersn.indexOf("BEGIN ")&&e.issuersn.indexOf("CERTIFICATE")&&(this.setCertSNByParam(e.issuersn),this.setCertIssuerByParam(e.issuersn)))},We(he.asn1.x509.AuthorityKeyIdentifier,he.asn1.x509.Extension),he.asn1.x509.SubjectKeyIdentifier=function(e){he.asn1.x509.SubjectKeyIdentifier.superclass.constructor.call(this,e);var t=he.asn1.DEROctetString;this.asn1KID=null,this.getExtnValueHex=function(){return this.asn1ExtnValue=this.asn1KID,this.asn1ExtnValue.getEncodedHex()},this.setKIDByParam=function(e){if(void 0!==e.str||void 0!==e.hex)this.asn1KID=new t(e);else if("object"==typeof e&&he.crypto.Util.isKey(e)||"string"==typeof e&&-1!=e.indexOf("BEGIN")){var n=e;"string"==typeof e&&(n=Ye.getKey(e));var r=Ye.getKeyID(n);this.asn1KID=new he.asn1.DEROctetString({hex:r})}},this.oid="2.5.29.14",void 0!==e&&void 0!==e.kid&&this.setKIDByParam(e.kid)},We(he.asn1.x509.SubjectKeyIdentifier,he.asn1.x509.Extension),he.asn1.x509.AuthorityInfoAccess=function(e){he.asn1.x509.AuthorityInfoAccess.superclass.constructor.call(this,e),this.setAccessDescriptionArray=function(e){for(var t=new Array,n=he.asn1,r=n.DERSequence,i=n.DERObjectIdentifier,a=n.x509.GeneralName,s=0;s<e.length;s++){var o,u=e[s];if(void 0!==u.ocsp)o=new r({array:[new i({oid:"1.3.6.1.5.5.7.48.1"}),new a({uri:u.ocsp})]});else{if(void 0===u.caissuer)throw new Error("unknown AccessMethod parameter: "+JSON.stringify(u));o=new r({array:[new i({oid:"1.3.6.1.5.5.7.48.2"}),new a({uri:u.caissuer})]})}t.push(o)}this.asn1ExtnValue=new r({array:t})},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.1.1",void 0!==e&&void 0!==e.array&&this.setAccessDescriptionArray(e.array)},We(he.asn1.x509.AuthorityInfoAccess,he.asn1.x509.Extension),he.asn1.x509.SubjectAltName=function(e){he.asn1.x509.SubjectAltName.superclass.constructor.call(this,e),this.setNameArray=function(e){this.asn1ExtnValue=new he.asn1.x509.GeneralNames(e)},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.17",void 0!==e&&void 0!==e.array&&this.setNameArray(e.array)},We(he.asn1.x509.SubjectAltName,he.asn1.x509.Extension),he.asn1.x509.IssuerAltName=function(e){he.asn1.x509.IssuerAltName.superclass.constructor.call(this,e),this.setNameArray=function(e){this.asn1ExtnValue=new he.asn1.x509.GeneralNames(e)},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.18",void 0!==e&&void 0!==e.array&&this.setNameArray(e.array)},We(he.asn1.x509.IssuerAltName,he.asn1.x509.Extension),he.asn1.x509.SubjectDirectoryAttributes=function(e){he.asn1.x509.SubjectDirectoryAttributes.superclass.constructor.call(this,e);var t=he.asn1,n=t.DERSequence,r=t.ASN1Util.newObject,i=t.x509.OID.name2oid;this.params=null,this.getExtnValueHex=function(){for(var e=[],t=0;t<this.params.array.length;t++){var a=this.params.array[t],s={seq:[{oid:"1.2.3.4"},{set:[{utf8str:"DE"}]}]};if("dateOfBirth"==a.attr)s.seq[0].oid=i(a.attr),s.seq[1].set[0]={gentime:a.str};else if("placeOfBirth"==a.attr)s.seq[0].oid=i(a.attr),s.seq[1].set[0]={utf8str:a.str};else if("gender"==a.attr)s.seq[0].oid=i(a.attr),s.seq[1].set[0]={prnstr:a.str};else if("countryOfCitizenship"==a.attr)s.seq[0].oid=i(a.attr),s.seq[1].set[0]={prnstr:a.str};else{if("countryOfResidence"!=a.attr)throw new Error("unsupported attribute: "+a.attr);s.seq[0].oid=i(a.attr),s.seq[1].set[0]={prnstr:a.str}}e.push(new r(s))}var o=new n({array:e});return this.asn1ExtnValue=o,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.9",void 0!==e&&(this.params=e)},We(he.asn1.x509.SubjectDirectoryAttributes,he.asn1.x509.Extension),he.asn1.x509.PrivateExtension=function(e){he.asn1.x509.PrivateExtension.superclass.constructor.call(this,e);var t=he,n=t.lang.String.isHex,r=t.asn1,i=r.x509.OID.name2oid,a=r.ASN1Util.newObject;this.params=null,this.setByParam=function(e){this.oid=i(e.extname),this.params=e},this.getExtnValueHex=function(){if(null==this.params.extname||null==this.params.extn)throw new Error("extname or extnhex not specified");var e=this.params.extn;if("string"==typeof e&&n(e))return e;if("object"==typeof e)try{return a(e).getEncodedHex()}catch(e){}throw new Error("unsupported extn value")},null!=e&&this.setByParam(e)},We(he.asn1.x509.PrivateExtension,he.asn1.x509.Extension),he.asn1.x509.CRL=function(e){he.asn1.x509.CRL.superclass.constructor.call(this);var t=he.asn1,n=t.DERSequence,r=t.DERBitString,i=t.x509,a=i.AlgorithmIdentifier,s=i.TBSCertList;this.params=void 0,this.setByParam=function(e){this.params=e},this.sign=function(){var e=new s(this.params).getEncodedHex(),t=new he.crypto.Signature({alg:this.params.sigalg});t.init(this.params.cakey),t.updateHex(e);var n=t.sign();this.params.sighex=n},this.getPEM=function(){return Te(this.getEncodedHex(),"X509 CRL")},this.getEncodedHex=function(){var e=this.params;if(null==e.tbsobj&&(e.tbsobj=new s(e)),null==e.sighex&&null!=e.cakey&&this.sign(),null==e.sighex)throw new Error("sighex or cakey parameter not defined");var t=[];return t.push(e.tbsobj),t.push(new a({name:e.sigalg})),t.push(new r({hex:"00"+e.sighex})),new n({array:t}).getEncodedHex()},null!=e&&(this.params=e)},We(he.asn1.x509.CRL,he.asn1.ASN1Object),he.asn1.x509.TBSCertList=function(e){he.asn1.x509.TBSCertList.superclass.constructor.call(this);var t=he.asn1,n=t.DERInteger,r=t.DERSequence,i=t.DERTaggedObject,a=(t.DERObjectIdentifier,t.x509),s=a.AlgorithmIdentifier,o=a.Time,u=a.Extensions,c=a.X500Name;this.params=null,this.setByParam=function(e){this.params=e},this.getRevCertSequence=function(){for(var e=[],t=this.params.revcert,i=0;i<t.length;i++){var a=[new n(t[i].sn),new o(t[i].date)];null!=t[i].ext&&a.push(new u(t[i].ext)),e.push(new r({array:a}))}return new r({array:e})},this.getEncodedHex=function(){var e=[],t=this.params;if(null!=t.version){var a=t.version-1,l=new n({int:a});e.push(l)}if(e.push(new s({name:t.sigalg})),e.push(new c(t.issuer)),e.push(new o(t.thisupdate)),null!=t.nextupdate&&e.push(new o(t.nextupdate)),null!=t.revcert&&e.push(this.getRevCertSequence()),null!=t.ext){var h=new u(t.ext);e.push(new i({tag:"a0",explicit:!0,obj:h}))}return new r({array:e}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.x509.TBSCertList,he.asn1.ASN1Object),he.asn1.x509.CRLEntry=function(e){he.asn1.x509.CRLEntry.superclass.constructor.call(this);var t=he.asn1;this.setCertSerial=function(e){this.sn=new t.DERInteger(e)},this.setRevocationDate=function(e){this.time=new t.x509.Time(e)},this.getEncodedHex=function(){var e=new t.DERSequence({array:[this.sn,this.time]});return this.TLV=e.getEncodedHex(),this.TLV},void 0!==e&&(void 0!==e.time&&this.setRevocationDate(e.time),void 0!==e.sn&&this.setCertSerial(e.sn))},We(he.asn1.x509.CRLEntry,he.asn1.ASN1Object),he.asn1.x509.CRLNumber=function(e){he.asn1.x509.CRLNumber.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new he.asn1.DERInteger(this.params.num),this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.20",null!=e&&(this.params=e)},We(he.asn1.x509.CRLNumber,he.asn1.x509.Extension),he.asn1.x509.CRLReason=function(e){he.asn1.x509.CRLReason.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new he.asn1.DEREnumerated(this.params.code),this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.21",null!=e&&(this.params=e)},We(he.asn1.x509.CRLReason,he.asn1.x509.Extension),he.asn1.x509.OCSPNonce=function(e){he.asn1.x509.OCSPNonce.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new he.asn1.DEROctetString(this.params),this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.48.1.2",null!=e&&(this.params=e)},We(he.asn1.x509.OCSPNonce,he.asn1.x509.Extension),he.asn1.x509.OCSPNoCheck=function(e){he.asn1.x509.OCSPNoCheck.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new he.asn1.DERNull,this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.48.1.5",null!=e&&(this.params=e)},We(he.asn1.x509.OCSPNoCheck,he.asn1.x509.Extension),he.asn1.x509.AdobeTimeStamp=function(e){he.asn1.x509.AdobeTimeStamp.superclass.constructor.call(this,e);var t=he.asn1,n=t.DERInteger,r=t.DERBoolean,i=t.DERSequence,a=t.x509.GeneralName;this.params=null,this.getExtnValueHex=function(){var e=this.params,t=[new n(1)];return t.push(new a({uri:e.uri})),null!=e.reqauth&&t.push(new r(e.reqauth)),this.asn1ExtnValue=new i({array:t}),this.asn1ExtnValue.getEncodedHex()},this.oid="1.2.840.113583.1.1.9.1",void 0!==e&&this.setByParam(e)},We(he.asn1.x509.AdobeTimeStamp,he.asn1.x509.Extension),he.asn1.x509.X500Name=function(e){he.asn1.x509.X500Name.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=he.asn1,n=t.x509,r=n.RDN;this.setByString=function(e,t){void 0!==t&&(this.sRule=t);var n=e.split("/");n.shift();for(var i=[],a=0;a<n.length;a++)if(n[a].match(/^[^=]+=.+$/))i.push(n[a]);else{var s=i.length-1;i[s]=i[s]+"/"+n[a]}for(a=0;a<i.length;a++)this.asn1Array.push(new r({str:i[a],rule:this.sRule}))},this.setByLdapString=function(e,t){void 0!==t&&(this.sRule=t);var r=n.X500Name.ldapToCompat(e);this.setByString(r,t)},this.setByObject=function(e,t){for(var n in void 0!==t&&(this.sRule=t),e)if(e.hasOwnProperty(n)){var i=new r({str:n+"="+e[n],rule:this.sRule});this.asn1Array?this.asn1Array.push(i):this.asn1Array=[i]}},this.setByParam=function(e){var t;(void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.array)?this.paramArray=e.array:void 0!==e.str?this.setByString(e.str):void 0!==e.ldapstr?this.setByLdapString(e.ldapstr):void 0!==e.hex?this.hTLV=e.hex:void 0!==e.certissuer?((t=new Ze).readCertPEM(e.certissuer),this.hTLV=t.getIssuerHex()):void 0!==e.certsubject?((t=new Ze).readCertPEM(e.certsubject),this.hTLV=t.getSubjectHex()):"object"==typeof e&&void 0===e.certsubject&&void 0===e.certissuer&&this.setByObject(e)},this.getEncodedHex=function(){if("string"==typeof this.hTLV)return this.hTLV;if(0==this.asn1Array.length&&this.paramArray.length>0)for(var e=0;e<this.paramArray.length;e++){var n={array:this.paramArray[e]};"utf8"!=this.sRule&&(n.rule=this.sRule);var i=new r(n);this.asn1Array.push(i)}var a=new t.DERSequence({array:this.asn1Array});return this.hTLV=a.getEncodedHex(),this.hTLV},void 0!==e&&this.setByParam(e)},We(he.asn1.x509.X500Name,he.asn1.ASN1Object),he.asn1.x509.X500Name.compatToLDAP=function(e){if("/"!==e.substr(0,1))throw"malformed input";var t=(e=e.substr(1)).split("/");return t.reverse(),(t=t.map((function(e){return e.replace(/,/,"\\,")}))).join(",")},he.asn1.x509.X500Name.onelineToLDAP=function(e){return he.asn1.x509.X500Name.compatToLDAP(e)},he.asn1.x509.X500Name.ldapToCompat=function(e){for(var t=e.split(","),n=!1,r=[],i=0;t.length>0;i++){var a=t.shift();if(!0===n){var s=(r.pop()+","+a).replace(/\\,/g,",");r.push(s),n=!1}else r.push(a);"\\"===a.substr(-1,1)&&(n=!0)}return(r=r.map((function(e){return e.replace("/","\\/")}))).reverse(),"/"+r.join("/")},he.asn1.x509.X500Name.ldapToOneline=function(e){return he.asn1.x509.X500Name.ldapToCompat(e)},he.asn1.x509.RDN=function(e){he.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=he.asn1.x509.AttributeTypeAndValue;this.setByParam=function(e){void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.str&&this.addByMultiValuedString(e.str),void 0!==e.array&&(this.paramArray=e.array)},this.addByString=function(e){this.asn1Array.push(new he.asn1.x509.AttributeTypeAndValue({str:e,rule:this.sRule}))},this.addByMultiValuedString=function(e){for(var t=he.asn1.x509.RDN.parseString(e),n=0;n<t.length;n++)this.addByString(t[n])},this.getEncodedHex=function(){if(0==this.asn1Array.length&&this.paramArray.length>0)for(var e=0;e<this.paramArray.length;e++){var n=this.paramArray[e];void 0!==n.rule&&"utf8"!=this.sRule&&(n.rule=this.sRule);var r=new t(n);this.asn1Array.push(r)}var i=new he.asn1.DERSet({array:this.asn1Array});return this.TLV=i.getEncodedHex(),this.TLV},void 0!==e&&this.setByParam(e)},We(he.asn1.x509.RDN,he.asn1.ASN1Object),he.asn1.x509.RDN.parseString=function(e){for(var t=e.split(/\+/),n=!1,r=[],i=0;t.length>0;i++){var a=t.shift();if(!0===n){var s=(r.pop()+"+"+a).replace(/\\\+/g,"+");r.push(s),n=!1}else r.push(a);"\\"===a.substr(-1,1)&&(n=!0)}var o=!1,u=[];for(i=0;r.length>0;i++){a=r.shift();if(!0===o){var c=u.pop();if(a.match(/"$/)){s=(c+"+"+a).replace(/^([^=]+)="(.*)"$/,"$1=$2");u.push(s),o=!1}else u.push(c+"+"+a)}else u.push(a);a.match(/^[^=]+="/)&&(o=!0)}return u},he.asn1.x509.AttributeTypeAndValue=function(e){he.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this),this.sRule="utf8",this.sType=null,this.sValue=null,this.dsType=null;var t=he,n=t.asn1,r=n.DERSequence,i=n.DERUTF8String,a=n.DERPrintableString,s=n.DERTeletexString,o=n.DERIA5String,u=n.DERVisibleString,c=n.DERBMPString,l=t.lang.String.isMail,h=t.lang.String.isPrintable;this.setByParam=function(e){if(void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.ds&&(this.dsType=e.ds),void 0===e.value&&void 0!==e.str){var t=e.str.match(/^([^=]+)=(.+)$/);if(!t)throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr);this.sType=t[1],this.sValue=t[2]}else this.sType=e.type,this.sValue=e.value},this.setByString=function(e,t){void 0!==t&&(this.sRule=t);var n=e.match(/^([^=]+)=(.+)$/);if(!n)throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr);this.setByAttrTypeAndValueStr(n[1],n[2])},this._getDsType=function(){var e=this.sType,t=this.sValue,n=this.sRule;return"prn"===n?"CN"==e&&l(t)?"ia5":h(t)?"prn":"utf8":"utf8"===n?"CN"==e&&l(t)?"ia5":"C"==e?"prn":"utf8":"utf8"},this.setByAttrTypeAndValueStr=function(e,t,n){void 0!==n&&(this.sRule=n),this.sType=e,this.sValue=t},this.getValueObj=function(e,t){if("utf8"==e)return new i({str:t});if("prn"==e)return new a({str:t});if("tel"==e)return new s({str:t});if("ia5"==e)return new o({str:t});if("vis"==e)return new u({str:t});if("bmp"==e)return new c({str:t});throw new Error("unsupported directory string type: type="+e+" value="+t)},this.getEncodedHex=function(){null==this.dsType&&(this.dsType=this._getDsType());var e=he.asn1.x509.OID.atype2obj(this.sType),t=this.getValueObj(this.dsType,this.sValue),n=new r({array:[e,t]});return this.TLV=n.getEncodedHex(),this.TLV},void 0!==e&&this.setByParam(e)},We(he.asn1.x509.AttributeTypeAndValue,he.asn1.ASN1Object),he.asn1.x509.SubjectPublicKeyInfo=function(e){he.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var t=he,n=t.asn1,r=n.DERInteger,i=n.DERBitString,a=n.DERObjectIdentifier,s=n.DERSequence,o=n.ASN1Util.newObject,u=n.x509.AlgorithmIdentifier,c=t.crypto;c.ECDSA,c.DSA;this.getASN1Object=function(){if(null==this.asn1AlgId||null==this.asn1SubjPKey)throw"algId and/or subjPubKey not set";return new s({array:[this.asn1AlgId,this.asn1SubjPKey]})},this.getEncodedHex=function(){var e=this.getASN1Object();return this.hTLV=e.getEncodedHex(),this.hTLV},this.setPubKey=function(e){try{if(e instanceof ae){var t=o({seq:[{int:{bigint:e.n}},{int:{int:e.e}}]}).getEncodedHex();this.asn1AlgId=new u({name:"rsaEncryption"}),this.asn1SubjPKey=new i({hex:"00"+t})}}catch(e){}try{if(e instanceof he.crypto.ECDSA){var n=new a({name:e.curveName});this.asn1AlgId=new u({name:"ecPublicKey",asn1params:n}),this.asn1SubjPKey=new i({hex:"00"+e.pubKeyHex})}}catch(e){}try{if(e instanceof he.crypto.DSA){n=new o({seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]});this.asn1AlgId=new u({name:"dsa",asn1params:n});var s=new r({bigint:e.y});this.asn1SubjPKey=new i({hex:"00"+s.getEncodedHex()})}}catch(e){}},void 0!==e&&this.setPubKey(e)},We(he.asn1.x509.SubjectPublicKeyInfo,he.asn1.ASN1Object),he.asn1.x509.Time=function(e){he.asn1.x509.Time.superclass.constructor.call(this);var t=he.asn1,n=t.DERUTCTime,r=t.DERGeneralizedTime;this.setTimeParams=function(e){this.timeParams=e},this.getEncodedHex=function(){var e=null;return e=null!=this.timeParams?"utc"==this.type?new n(this.timeParams):new r(this.timeParams):"utc"==this.type?new n:new r,this.TLV=e.getEncodedHex(),this.TLV},this.type="utc",void 0!==e&&(void 0!==e.type?this.type=e.type:void 0!==e.str&&(e.str.match(/^[0-9]{12}Z$/)&&(this.type="utc"),e.str.match(/^[0-9]{14}Z$/)&&(this.type="gen")),this.timeParams=e)},We(he.asn1.x509.Time,he.asn1.ASN1Object),he.asn1.x509.AlgorithmIdentifier=function(e){he.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var t=he.asn1,n=t.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV;if(this.getEncodedHex=function(){if(null===this.nameAlg&&null===this.asn1Alg)throw new Error("algorithm not specified");if(null!==this.nameAlg){var e=null;for(var r in n)r===this.nameAlg&&(e=n[r]);if(null!==e)return this.hTLV=e,this.hTLV}null!==this.nameAlg&&null===this.asn1Alg&&(this.asn1Alg=t.x509.OID.name2obj(this.nameAlg));var i=[this.asn1Alg];null!==this.asn1Params&&i.push(this.asn1Params);var a=new t.DERSequence({array:i});return this.hTLV=a.getEncodedHex(),this.hTLV},void 0!==e&&(void 0!==e.name&&(this.nameAlg=e.name),void 0!==e.asn1params&&(this.asn1Params=e.asn1params),void 0!==e.paramempty&&(this.paramEmpty=e.paramempty)),null===this.asn1Params&&!1===this.paramEmpty&&null!==this.nameAlg){void 0!==this.nameAlg.name&&(this.nameAlg=this.nameAlg.name);var r=this.nameAlg.toLowerCase();"withdsa"!==r.substr(-7,7)&&"withecdsa"!==r.substr(-9,9)&&(this.asn1Params=new t.DERNull)}},We(he.asn1.x509.AlgorithmIdentifier,he.asn1.ASN1Object),he.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"},he.asn1.x509.GeneralName=function(e){he.asn1.x509.GeneralName.superclass.constructor.call(this);var t={rfc822:"81",dns:"82",dn:"a4",uri:"86",ip:"87"},n=he.asn1,r=(n.DERSequence,n.DEROctetString),i=n.DERIA5String,a=n.DERTaggedObject,s=n.ASN1Object,o=n.x509.X500Name,u=$e;this.explicit=!1,this.setByParam=function(e){var n=null;if(void 0!==e){if(void 0!==e.rfc822&&(this.type="rfc822",n=new i({str:e[this.type]})),void 0!==e.dns&&(this.type="dns",n=new i({str:e[this.type]})),void 0!==e.uri&&(this.type="uri",n=new i({str:e[this.type]})),void 0!==e.dn&&(this.type="dn",this.explicit=!0,n="string"==typeof e.dn?new o({str:e.dn}):e.dn instanceof he.asn1.x509.X500Name?e.dn:new o(e.dn)),void 0!==e.ldapdn&&(this.type="dn",this.explicit=!0,n=new o({ldapstr:e.ldapdn})),void 0!==e.certissuer){this.type="dn",this.explicit=!0;var c=null;if((h=e.certissuer).match(/^[0-9A-Fa-f]+$/),-1!=h.indexOf("-----BEGIN ")&&(c=u(h)),null==c)throw"certissuer param not cert";(f=new Ze).hex=c;var l=f.getIssuerHex();(n=new s).hTLV=l}if(void 0!==e.certsubj){this.type="dn",this.explicit=!0;var h,f;c=null;if((h=e.certsubj).match(/^[0-9A-Fa-f]+$/),-1!=h.indexOf("-----BEGIN ")&&(c=u(h)),null==c)throw"certsubj param not cert";(f=new Ze).hex=c;l=f.getSubjectHex();(n=new s).hTLV=l}if(void 0!==e.ip){this.type="ip",this.explicit=!1;var d,p=e.ip,g="malformed IP address";if(p.match(/^[0-9.]+[.][0-9.]+$/)){if(8!==(d=Ve("["+p.split(".").join(",")+"]")).length)throw g}else if(p.match(/^[0-9A-Fa-f:]+:[0-9A-Fa-f:]+$/))d=Be(p);else{if(!p.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw g;d=p}n=new r({hex:d})}if(null==this.type)throw"unsupported type in params="+e;this.asn1Obj=new a({explicit:this.explicit,tag:t[this.type],obj:n})}},this.getEncodedHex=function(){return this.asn1Obj.getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.x509.GeneralName,he.asn1.ASN1Object),he.asn1.x509.GeneralNames=function(e){he.asn1.x509.GeneralNames.superclass.constructor.call(this);var t=he.asn1;this.setByParamArray=function(e){for(var n=0;n<e.length;n++){var r=new t.x509.GeneralName(e[n]);this.asn1Array.push(r)}},this.getEncodedHex=function(){return new t.DERSequence({array:this.asn1Array}).getEncodedHex()},this.asn1Array=new Array,void 0!==e&&this.setByParamArray(e)},We(he.asn1.x509.GeneralNames,he.asn1.ASN1Object),he.asn1.x509.OID=new function(e){this.atype2oidList={CN:"2.5.4.3",L:"2.5.4.7",ST:"2.5.4.8",O:"2.5.4.10",OU:"2.5.4.11",C:"2.5.4.6",STREET:"2.5.4.9",DC:"0.9.2342.19200300.100.1.25",UID:"0.9.2342.19200300.100.1.1",SN:"2.5.4.4",T:"2.5.4.12",DN:"2.5.4.49",E:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3"},this.name2oidList={sha1:"1.3.14.3.2.26",sha256:"2.16.840.1.101.3.4.2.1",sha384:"2.16.840.1.101.3.4.2.2",sha512:"2.16.840.1.101.3.4.2.3",sha224:"2.16.840.1.101.3.4.2.4",md5:"1.2.840.113549.2.5",md2:"1.3.14.7.2.2.1",ripemd160:"1.3.36.3.2.1",MD2withRSA:"1.2.840.113549.1.1.2",MD4withRSA:"1.2.840.113549.1.1.3",MD5withRSA:"1.2.840.113549.1.1.4",SHA1withRSA:"1.2.840.113549.1.1.5","pkcs1-MGF":"1.2.840.113549.1.1.8",rsaPSS:"1.2.840.113549.1.1.10",SHA224withRSA:"1.2.840.113549.1.1.14",SHA256withRSA:"1.2.840.113549.1.1.11",SHA384withRSA:"1.2.840.113549.1.1.12",SHA512withRSA:"1.2.840.113549.1.1.13",SHA1withECDSA:"1.2.840.10045.4.1",SHA224withECDSA:"1.2.840.10045.4.3.1",SHA256withECDSA:"1.2.840.10045.4.3.2",SHA384withECDSA:"1.2.840.10045.4.3.3",SHA512withECDSA:"1.2.840.10045.4.3.4",dsa:"1.2.840.10040.4.1",SHA1withDSA:"1.2.840.10040.4.3",SHA224withDSA:"2.16.840.1.101.3.4.3.1",SHA256withDSA:"2.16.840.1.101.3.4.3.2",rsaEncryption:"1.2.840.113549.1.1.1",commonName:"2.5.4.3",countryName:"2.5.4.6",localityName:"2.5.4.7",stateOrProvinceName:"2.5.4.8",streetAddress:"2.5.4.9",organizationName:"2.5.4.10",organizationalUnitName:"2.5.4.11",domainComponent:"0.9.2342.19200300.100.1.25",userId:"0.9.2342.19200300.100.1.1",surname:"2.5.4.4",givenName:"2.5.4.42",title:"2.5.4.12",distinguishedName:"2.5.4.49",emailAddress:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3",subjectDirectoryAttributes:"2.5.29.9",subjectKeyIdentifier:"2.5.29.14",keyUsage:"2.5.29.15",subjectAltName:"2.5.29.17",issuerAltName:"2.5.29.18",basicConstraints:"2.5.29.19",cRLNumber:"2.5.29.20",cRLReason:"2.5.29.21",nameConstraints:"2.5.29.30",cRLDistributionPoints:"2.5.29.31",certificatePolicies:"2.5.29.32",anyPolicy:"2.5.29.32.0",authorityKeyIdentifier:"2.5.29.35",policyConstraints:"2.5.29.36",extKeyUsage:"2.5.29.37",authorityInfoAccess:"1.3.6.1.5.5.7.1.1",ocsp:"1.3.6.1.5.5.7.48.1",ocspBasic:"1.3.6.1.5.5.7.48.1.1",ocspNonce:"1.3.6.1.5.5.7.48.1.2",ocspNoCheck:"1.3.6.1.5.5.7.48.1.5",caIssuers:"1.3.6.1.5.5.7.48.2",anyExtendedKeyUsage:"2.5.29.37.0",serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",emailProtection:"1.3.6.1.5.5.7.3.4",timeStamping:"1.3.6.1.5.5.7.3.8",ocspSigning:"1.3.6.1.5.5.7.3.9",dateOfBirth:"1.3.6.1.5.5.7.9.1",placeOfBirth:"1.3.6.1.5.5.7.9.2",gender:"1.3.6.1.5.5.7.9.3",countryOfCitizenship:"1.3.6.1.5.5.7.9.4",countryOfResidence:"1.3.6.1.5.5.7.9.5",ecPublicKey:"1.2.840.10045.2.1","P-256":"1.2.840.10045.3.1.7",secp256r1:"1.2.840.10045.3.1.7",secp256k1:"1.3.132.0.10",secp384r1:"1.3.132.0.34",pkcs5PBES2:"1.2.840.113549.1.5.13",pkcs5PBKDF2:"1.2.840.113549.1.5.12","des-EDE3-CBC":"1.2.840.113549.3.7",data:"1.2.840.113549.1.7.1","signed-data":"1.2.840.113549.1.7.2","enveloped-data":"1.2.840.113549.1.7.3","digested-data":"1.2.840.113549.1.7.5","encrypted-data":"1.2.840.113549.1.7.6","authenticated-data":"1.2.840.113549.1.9.16.1.2",tstinfo:"1.2.840.113549.1.9.16.1.4",signingCertificate:"1.2.840.113549.1.9.16.2.12",timeStampToken:"1.2.840.113549.1.9.16.2.14",signaturePolicyIdentifier:"1.2.840.113549.1.9.16.2.15",etsArchiveTimeStamp:"1.2.840.113549.1.9.16.2.27",signingCertificateV2:"1.2.840.113549.1.9.16.2.47",etsArchiveTimeStampV2:"1.2.840.113549.1.9.16.2.48",extensionRequest:"1.2.840.113549.1.9.14",contentType:"1.2.840.113549.1.9.3",messageDigest:"1.2.840.113549.1.9.4",signingTime:"1.2.840.113549.1.9.5",counterSignature:"1.2.840.113549.1.9.6",archiveTimeStampV3:"0.4.0.1733.2.4",pdfRevocationInfoArchival:"1.2.840.113583.1.1.8",adobeTimeStamp:"1.2.840.113583.1.1.9.1"},this.objCache={},this.name2obj=function(e){if(void 0!==this.objCache[e])return this.objCache[e];if(void 0===this.name2oidList[e])throw"Name of ObjectIdentifier not defined: "+e;var t=this.name2oidList[e],n=new he.asn1.DERObjectIdentifier({oid:t});return this.objCache[e]=n,n},this.atype2obj=function(e){if(void 0!==this.objCache[e])return this.objCache[e];var t;if(e.match(/^\d+\.\d+\.[0-9.]+$/))t=e;else if(void 0!==this.atype2oidList[e])t=this.atype2oidList[e];else{if(void 0===this.name2oidList[e])throw"AttributeType name undefined: "+e;t=this.name2oidList[e]}var n=new he.asn1.DERObjectIdentifier({oid:t});return this.objCache[e]=n,n}},he.asn1.x509.OID.oid2name=function(e){var t=he.asn1.x509.OID.name2oidList;for(var n in t)if(t[n]==e)return n;return""},he.asn1.x509.OID.oid2atype=function(e){var t=he.asn1.x509.OID.atype2oidList;for(var n in t)if(t[n]==e)return n;return e},he.asn1.x509.OID.name2oid=function(e){if(e.match(/^[0-9.]+$/))return e;var t=he.asn1.x509.OID.name2oidList;return void 0===t[e]?"":t[e]},he.asn1.x509.X509Util={},he.asn1.x509.X509Util.newCertPEM=function(e){var t=he.asn1.x509;t.TBSCertificate;return new(0,t.Certificate)(e).getPEM()},void 0!==he&&he||(he={}),void 0!==he.asn1&&he.asn1||(he.asn1={}),void 0!==he.asn1.cms&&he.asn1.cms||(he.asn1.cms={}),he.asn1.cms.Attribute=function(e){var t=Error,n=he.asn1,r=n.DERSequence,i=n.DERSet,a=n.DERObjectIdentifier;this.params=null,this.typeOid=null,this.setByParam=function(e){this.params=e},this.getValueArray=function(){throw new t("not yet implemented abstract")},this.getEncodedHex=function(){var e=new a({oid:this.typeOid}),t=new i({array:this.getValueArray()});return new r({array:[e,t]}).getEncodedHex()}},We(he.asn1.cms.Attribute,he.asn1.ASN1Object),he.asn1.cms.ContentType=function(e){var t=he.asn1;t.cms.ContentType.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.3",this.getValueArray=function(){return[new t.DERObjectIdentifier(this.params.type)]},null!=e&&this.setByParam(e)},We(he.asn1.cms.ContentType,he.asn1.cms.Attribute),he.asn1.cms.MessageDigest=function(e){var t=he.asn1,n=t.DEROctetString;t.cms.MessageDigest.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.4",this.getValueArray=function(){return[new n(this.params)]},null!=e&&this.setByParam(e)},We(he.asn1.cms.MessageDigest,he.asn1.cms.Attribute),he.asn1.cms.SigningTime=function(e){var t=he.asn1;t.cms.SigningTime.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.5",this.getValueArray=function(){return[new t.x509.Time(this.params)]},null!=e&&this.setByParam(e)},We(he.asn1.cms.SigningTime,he.asn1.cms.Attribute),he.asn1.cms.SigningCertificate=function(e){var t=Error,n=he,r=n.asn1,i=r.DERSequence,a=r.cms,s=a.ESSCertID;n.crypto;a.SigningCertificate.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.12",this.getValueArray=function(){if(null==this.params||null==this.params||null==this.params.array)throw new t("parameter 'array' not specified");for(var n=this.params.array,r=[],a=0;a<n.length;a++){var o=n[a];0!=e.hasis||"string"!=typeof o||-1==o.indexOf("-----BEGIN")&&!pe.isASN1HEX(o)||(o={cert:o}),0!=o.hasis&&0==e.hasis&&(o.hasis=!1),r.push(new s(o))}var u=new i({array:r});return[new i({array:[u]})]},null!=e&&this.setByParam(e)},We(he.asn1.cms.SigningCertificate,he.asn1.cms.Attribute),he.asn1.cms.ESSCertID=function(e){he.asn1.cms.ESSCertID.superclass.constructor.call(this);var t=Error,n=he,r=n.asn1,i=r.DEROctetString,a=r.DERSequence,s=r.cms.IssuerSerial;this.params=null,this.getCertHash=function(e,r){if(null!=e.hash)return e.hash;if("string"==typeof e&&-1==e.indexOf("-----BEGIN")&&!pe.isASN1HEX(e))return e;var i,a,s;if("string"==typeof e)i=e;else{if(null==e.cert)throw new t("hash nor cert unspecified");i=e.cert}if(a=-1!=i.indexOf("-----BEGIN")?$e(i):i,"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?a=$e(e):pe.isASN1HEX(e)&&(a=e)),null!=e.alg)s=e.alg;else{if(null==r)throw new t("hash alg unspecified");s=r}return n.crypto.Util.hashHex(a,s)},this.getEncodedHex=function(){var e=this.params,t=this.getCertHash(e,"sha1"),n=[];return n.push(new i({hex:t})),("string"==typeof e&&-1!=e.indexOf("-----BEGIN")||null!=e.cert&&0!=e.hasis||null!=e.issuer&&null!=e.serial)&&n.push(new s(e)),new a({array:n}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.ESSCertID,he.asn1.ASN1Object),he.asn1.cms.SigningCertificateV2=function(e){var t=Error,n=he,r=n.asn1,i=r.DERSequence,a=(r.x509,r.cms),s=a.ESSCertIDv2;n.crypto;a.SigningCertificateV2.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.47",this.getValueArray=function(){if(null==this.params||null==this.params||null==this.params.array)throw new t("parameter 'array' not specified");for(var n=this.params.array,r=[],a=0;a<n.length;a++){var o=n[a];null==e.alg&&0!=e.hasis||"string"!=typeof o||-1==o.indexOf("-----BEGIN")&&!pe.isASN1HEX(o)||(o={cert:o}),null==o.alg&&null!=e.alg&&(o.alg=e.alg),0!=o.hasis&&0==e.hasis&&(o.hasis=!1),r.push(new s(o))}var u=new i({array:r});return[new i({array:[u]})]},null!=e&&this.setByParam(e)},We(he.asn1.cms.SigningCertificateV2,he.asn1.cms.Attribute),he.asn1.cms.ESSCertIDv2=function(e){he.asn1.cms.ESSCertIDv2.superclass.constructor.call(this);Error;var t=he.asn1,n=t.DEROctetString,r=t.DERSequence,i=t.cms.IssuerSerial,a=t.x509.AlgorithmIdentifier;this.params=null,this.getEncodedHex=function(){var e=this.params,t=this.getCertHash(e,"sha256"),s=[];return null!=e.alg&&"sha256"!=e.alg&&s.push(new a({name:e.alg})),s.push(new n({hex:t})),("string"==typeof e&&-1!=e.indexOf("-----BEGIN")||null!=e.cert&&0!=e.hasis||null!=e.issuer&&null!=e.serial)&&s.push(new i(e)),new r({array:s}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.ESSCertIDv2,he.asn1.cms.ESSCertID),he.asn1.cms.IssuerSerial=function(e){var t=Error,n=he.asn1,r=n.DERInteger,i=n.DERSequence,a=n.cms,s=n.x509.GeneralNames,o=Ze;a.IssuerSerial.superclass.constructor.call(this),this.setByParam=function(e){this.params=e},this.getEncodedHex=function(){var e,n,a=this.params;if("string"==typeof a&&-1!=a.indexOf("-----BEGIN")||null!=a.cert){var u;u=null!=a.cert?a.cert:a;var c=new o;c.readCertPEM(u),e=c.getIssuer(),n={hex:c.getSerialNumberHex()}}else{if(null==a.issuer||!a.serial)throw new t("cert or issuer and serial parameter not specified");e=a.issuer,n=a.serial}var l=new s([{dn:e}]),h=new r(n);return new i({array:[l,h]}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.IssuerSerial,he.asn1.ASN1Object),he.asn1.cms.SignerIdentifier=function(e){var t=he.asn1,n=(t.DERInteger,t.DERSequence,t.cms),r=n.IssuerAndSerialNumber,i=n.SubjectKeyIdentifier;t.x509.X500Name,Error;n.SignerIdentifier.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;if("isssn"==e.type)return new r(e).getEncodedHex();if("skid"==e.type)return new i(e).getEncodedHex();throw new Error("wrong property for isssn or skid")},null!=e&&this.setByParam(e)},We(he.asn1.cms.SignerIdentifier,he.asn1.ASN1Object),he.asn1.cms.IssuerAndSerialNumber=function(e){var t=he.asn1,n=t.DERInteger,r=t.DERSequence,i=t.cms,a=t.x509.X500Name,s=Ze,o=Error;i.IssuerAndSerialNumber.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e,t,i=this.params;if("string"==typeof i&&-1!=i.indexOf("-----BEGIN")||null!=i.cert){var u;u=null!=i.cert?i.cert:i;var c=new s;c.readCertPEM(u),e=c.getIssuer(),t={hex:c.getSerialNumberHex()}}else{if(null==i.issuer||!i.serial)throw new o("cert or issuer and serial parameter not specified");e=i.issuer,t=i.serial}var l=new a(e),h=new n(t);return new r({array:[l,h]}).getEncodedHex()},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},We(he.asn1.cms.IssuerAndSerialNumber,he.asn1.ASN1Object),he.asn1.cms.SubjectKeyIdentifier=function(e){var t=he.asn1,n=(t.DERInteger,t.DERSequence,t.ASN1Util.newObject),r=t.cms,i=(r.IssuerAndSerialName,r.SubjectKeyIdentifier,t.x509.X500Name,Ze),a=Error;r.SubjectKeyIdentifier.superclass.constructor.call(this),this.getEncodedHex=function(){var e,t=this.params;if(null==t.cert&&null==t.skid)throw new a("property cert nor skid undefined");null!=t.cert?e=new i(t.cert).getExtSubjectKeyIdentifier().kid.hex:null!=t.skid&&(e=t.skid);return n({tag:{tage:"a0",obj:{octstr:{hex:e}}}}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.SubjectKeyIdentifier,he.asn1.ASN1Object),he.asn1.cms.AttributeList=function(e){var t=Error,n=he.asn1,r=n.DERSet,i=n.cms;i.AttributeList.superclass.constructor.call(this),this.params=null,this.hTLV=null,this.setByParam=function(e){this.params=e},this.getEncodedHex=function(){var e=this.params;if(null!=this.hTLV)return this.hTLV;var n=!0;null!=e.sortflag&&(n=e.sortflag);for(var a=e.array,s=[],o=0;o<a.length;o++){var u=a[o],c=u.attr;if("contentType"==c)s.push(new i.ContentType(u));else if("messageDigest"==c)s.push(new i.MessageDigest(u));else if("signingTime"==c)s.push(new i.SigningTime(u));else if("signingCertificate"==c)s.push(new i.SigningCertificate(u));else if("signingCertificateV2"==c)s.push(new i.SigningCertificateV2(u));else if("signaturePolicyIdentifier"==c)s.push(new he.asn1.cades.SignaturePolicyIdentifier(u));else{if("signatureTimeStamp"!=c&&"timeStampToken"!=c)throw new t("unknown attr: "+c);s.push(new he.asn1.cades.SignatureTimeStamp(u))}}var l=new r({array:s,sortflag:n});return this.hTLV=l.getEncodedHex(),this.hTLV},null!=e&&this.setByParam(e)},We(he.asn1.cms.AttributeList,he.asn1.ASN1Object),he.asn1.cms.SignerInfo=function(e){var t=Error,n=he,r=n.asn1,i=r.DERInteger,a=r.DEROctetString,s=r.DERSequence,o=r.DERTaggedObject,u=r.cms,c=u.SignerIdentifier,l=u.AttributeList,h=(u.ContentType,u.EncapsulatedContentInfo,u.MessageDigest,u.SignedData,r.x509.AlgorithmIdentifier),f=n.crypto,d=Ye;u.SignerInfo.superclass.constructor.call(this),this.params=null,this.sign=function(){var e=this.params,t=e.sigalg,n=new l(e.sattrs).getEncodedHex(),r=d.getKey(e.signkey),i=new f.Signature({alg:t});i.init(r),i.updateHex(n);var a=i.sign();e.sighex=a},this.getEncodedHex=function(){var e=this.params,n=[];if(n.push(new i({int:e.version})),n.push(new c(e.id)),n.push(new h({name:e.hashalg})),null!=e.sattrs){var r=new l(e.sattrs);try{n.push(new o({tag:"a0",explicit:!1,obj:r}))}catch(e){throw new t("si sattr error: "+e)}}if(null!=e.sigalgfield?n.push(new h({name:e.sigalgfield})):n.push(new h({name:e.sigalg})),null==e.sighex&&null!=e.signkey&&this.sign(),n.push(new a({hex:e.sighex})),null!=e.uattrs){r=new l(e.uattrs);try{n.push(new o({tag:"a1",explicit:!1,obj:r}))}catch(e){throw new t("si uattr error: "+e)}}return new s({array:n}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.SignerInfo,he.asn1.ASN1Object),he.asn1.cms.EncapsulatedContentInfo=function(e){var t=he.asn1,n=t.DERTaggedObject,r=t.DERSequence,i=t.DERObjectIdentifier,a=t.DEROctetString;t.cms.EncapsulatedContentInfo.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,t=[];if(t.push(new i(e.type)),null!=e.content&&(null!=e.content.hex||null!=e.content.str)&&1!=e.isDetached){var s=new a(e.content),o=new n({tag:"a0",explicit:!0,obj:s});t.push(o)}return new r({array:t}).getEncodedHex()},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},We(he.asn1.cms.EncapsulatedContentInfo,he.asn1.ASN1Object),he.asn1.cms.ContentInfo=function(e){var t=he.asn1,n=t.DERTaggedObject,r=t.DERSequence,i=t.DERObjectIdentifier;t.x509.OID.name2obj;he.asn1.cms.ContentInfo.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,t=[];t.push(new i(e.type));var a=new n({tag:"a0",explicit:!0,obj:e.obj});return t.push(a),new r({array:t}).getEncodedHex()},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},We(he.asn1.cms.ContentInfo,he.asn1.ASN1Object),he.asn1.cms.SignedData=function(e){Error;var t=he.asn1,n=(t.ASN1Object,t.DERInteger),r=t.DERSet,i=t.DERSequence,a=(t.DERTaggedObject,t.cms),s=a.EncapsulatedContentInfo,o=a.SignerInfo,u=a.ContentInfo,c=a.CertificateSet,l=a.RevocationInfoChoices,h=t.x509.AlgorithmIdentifier;he.asn1.cms.SignedData.superclass.constructor.call(this),this.params=null,this.checkAndFixParam=function(){var e=this.params;this._setDigestAlgs(e),this._setContentTypeByEContent(e),this._setMessageDigestByEContent(e),this._setSignerInfoVersion(e),this._setSignedDataVersion(e)},this._setDigestAlgs=function(e){for(var t={},n=e.sinfos,r=0;r<n.length;r++){t[n[r].hashalg]=1}e.hashalgs=Object.keys(t).sort()},this._setContentTypeByEContent=function(e){for(var t=e.econtent.type,n=e.sinfos,r=0;r<n.length;r++){var i=n[r];this._getAttrParamByName(i,"contentType").type=t}},this._setMessageDigestByEContent=function(e){var t=e.econtent,n=(e.econtent.type,t.content.hex);null==n&&"data"==t.type&&null!=t.content.str&&(n=Ce(t.content.str));for(var r=e.sinfos,i=0;i<r.length;i++){var a=r[i],s=a.hashalg,o=this._getAttrParamByName(a,"messageDigest"),u=he.crypto.Util.hashHex(n,s);o.hex=u}},this._getAttrParamByName=function(e,t){for(var n=e.sattrs.array,r=0;r<n.length;r++)if(n[r].attr==t)return n[r]},this._setSignerInfoVersion=function(e){for(var t=e.sinfos,n=0;n<t.length;n++){var r=t[n],i=1;"skid"==r.id.type&&(i=3),r.version=i}},this._setSignedDataVersion=function(e){var t=this._getSignedDataVersion(e);e.version=t},this._getSignedDataVersion=function(e){if(null!=e.revinfos)for(var t=e.revinfos,n=0;n<t.length;n++){if(null!=t[n].ocsp)return 5}var r=e.sinfos;for(n=0;n<r.length;n++){if(3==e.sinfos[n].version)return 3}return"data"!=e.econtent.type?3:1},this.getEncodedHex=function(){var e=this.params;null!=this.getEncodedHexPrepare&&this.getEncodedHexPrepare(),1!=e.fixed&&this.checkAndFixParam();var t=[];t.push(new n({int:e.version}));for(var a=[],u=0;u<e.hashalgs.length;u++){var f=e.hashalgs[u];a.push(new h({name:f}))}t.push(new r({array:a})),t.push(new s(e.econtent)),null!=e.certs&&t.push(new c(e.certs)),null!=e.revinfos&&t.push(new l(e.revinfos));var d=[];for(u=0;u<e.sinfos.length;u++){var p=e.sinfos[u];d.push(new o(p))}return t.push(new r({array:d})),new i({array:t}).getEncodedHex()},this.getContentInfo=function(){return new u({type:"signed-data",obj:this})},this.getContentInfoEncodedHex=function(){return this.getContentInfo().getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.SignedData,he.asn1.ASN1Object),he.asn1.cms.CertificateSet=function(e){he.asn1.cms.CertificateSet.superclass.constructor.call(this);var t=Error,n=he.asn1,r=n.DERTaggedObject,i=n.DERSet,a=n.ASN1Object;this.params=null,this.getEncodedHex=function(){var e,n=this.params,s=[];if(n instanceof Array)e=n;else{if(null==n.array)throw new t("cert array not specified");e=n.array}for(var o=0;o<e.length;o++){var u=$e(e[o]),c=new a;c.hTLV=u,s.push(c)}var l={array:s};0==n.sortflag&&(l.sortflag=!1);var h=new i(l);return new r({tag:"a0",explicit:!1,obj:h}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.CertificateSet,he.asn1.ASN1Object),he.asn1.cms.RevocationInfoChoices=function(e){he.asn1.cms.RevocationInfoChoices.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;if(!e instanceof Array)throw new Error("params is not array");for(var t=[],n=0;n<e.length;n++)t.push(new he.asn1.cms.RevocationInfoChoice(e[n]));return he.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:{set:t}}}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.RevocationInfoChoices,he.asn1.ASN1Object),he.asn1.cms.RevocationInfoChoice=function(e){he.asn1.cms.RevocationInfoChoice.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;if(null!=e.crl&&"string"==typeof e.crl){var t=e.crl;return-1!=e.crl.indexOf("-----BEGIN")&&(t=$e(e.crl)),t}if(null!=e.ocsp)return he.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:new he.asn1.cms.OtherRevocationFormat(e)}}).getEncodedHex();throw new Error("property crl or ocsp undefined")},null!=e&&this.setByParam(e)},We(he.asn1.cms.RevocationInfoChoice,he.asn1.ASN1Object),he.asn1.cms.OtherRevocationFormat=function(e){he.asn1.cms.OtherRevocationFormat.superclass.constructor.call(this);var t=Error,n=he,r=n.asn1.ASN1Util.newObject,i=n.lang.String.isHex;this.params=null,this.getEncodedHex=function(){var e=this.params;if(null==e.ocsp)throw new t("property ocsp not specified");if(!i(e.ocsp)||!pe.isASN1HEX(e.ocsp))throw new t("ocsp value not ASN.1 hex string");return r({seq:[{oid:"1.3.6.1.5.5.7.16.2"},{asn1:{tlv:e.ocsp}}]}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.OtherRevocationFormat,he.asn1.ASN1Object),he.asn1.cms.CMSUtil=new function(){},he.asn1.cms.CMSUtil.newSignedData=function(e){return new he.asn1.cms.SignedData(e)},he.asn1.cms.CMSUtil.verifySignedData=function(e){var t=he,n=t.asn1,r=n.cms,i=(r.SignerInfo,r.SignedData,r.SigningTime,r.SigningCertificate,r.SigningCertificateV2,n.cades.SignaturePolicyIdentifier,t.lang.String.isHex),a=pe,s=a.getVbyList,o=a.getTLVbyList,u=a.getIdxbyList,c=a.getChildIdx,l=a.getTLV,h=a.oidname,f=t.crypto.Util.hashHex;void 0===e.cms&&i(e.cms);var d=e.cms,p=function(e,t){var n=t.idx;t.signerid_issuer1=o(e,n,[1,0],"30"),t.signerid_serial1=s(e,n,[1,1],"02"),t.hashalg=h(s(e,n,[2,0],"06"));var r=u(e,n,[3],"a0");t.idxSignedAttrs=r,g(e,t,r);var i=c(e,n).length;if(i<6)throw"malformed SignerInfo";t.sigalg=h(s(e,n,[i-2,0],"06")),t.sigval=s(e,n,[i-1],"04")},g=function(e,t,n){var r=c(e,n);t.signedAttrIdxList=r;for(var i=0;i<r.length;i++){var a,o=r[i],u=s(e,o,[0],"06");"2a864886f70d010905"===u?(a=Ae(s(e,o,[1,0])),t.saSigningTime=a):"2a864886f70d010904"===u&&(a=s(e,o,[1,0],"04"),t.saMessageDigest=a)}},m=function(e,t,n,r){n.verifyDetail={};var i=n.verifyDetail,a=t.parse.econtent,s=n.hashalg,o=n.saMessageDigest;i.validMessageDigest=!1,f(a,s)===o&&(i.validMessageDigest=!0),function(e,t,n,r){var i,a=t.parse.certsIdx;if(void 0===t.certs){i=[],t.certkeys=[];for(var s=c(e,a),o=0;o<s.length;o++){var u=l(e,s[o]),h=new Ze;h.readCertHex(u),i[o]=h,t.certkeys[o]=h.getPublicKey()}t.certs=i}else i=t.certs;t.cccc=i.length,t.cccci=s.length;for(o=0;o<i.length;o++){var f=h.getIssuerHex(),d=h.getSerialNumberHex();n.signerid_issuer1===f&&n.signerid_serial1===d&&(n.certkey_idx=o)}}(e,t,n),i.validSignatureValue=!1;var u=n.sigalg,h="31"+l(e,n.idxSignedAttrs).substr(2);n.signedattrshex=h;var d=t.certs[n.certkey_idx].getPublicKey(),p=new he.crypto.Signature({alg:u});p.init(d),p.updateHex(h);var g=p.verify(n.sigval);i.validSignatureValue_isValid=g,!0===g&&(i.validSignatureValue=!0),n.isValid=!1,i.validMessageDigest&&i.validSignatureValue&&(n.isValid=!0)},v={isValid:!1,parse:{}};return function(e,t){if("2a864886f70d010702"!==s(e,0,[0],"06"))return t;t.cmsType="signedData",t.econtent=s(e,0,[1,0,2,1,0]),function(e,t){for(var n,r=3;r<6;r++)if(void 0!==(n=u(e,0,[1,0,r]))){var i=e.substr(n,2);"a0"===i&&(t.certsIdx=n),"a1"===i&&(t.revinfosIdx=n),"31"===i&&(t.signerinfosIdx=n)}}(e,t),t.signerInfos=[],function(e,t){var n=t.signerinfosIdx;if(void 0!==n){var r=c(e,n);t.signerInfoIdxList=r;for(var i=0;i<r.length;i++){var a={idx:r[i]};p(e,a),t.signerInfos.push(a)}}}(e,t)}(d,v.parse),function(e,t){for(var n=t.parse.signerInfos,r=n.length,i=!0,a=0;a<r;a++){var s=n[a];m(e,t,s,a),s.isValid||(i=!1)}t.isValid=i}(d,v),v},he.asn1.cms.CMSParser=function(){var e=Error,t=Ze,n=new t,r=pe,i=r.getV,a=r.getTLV,s=(r.getIdxbyList,r.getTLVbyList),o=r.getTLVbyListEx,u=r.getVbyList,c=r.getVbyListEx,l=r.getChildIdx;this.getCMSSignedData=function(e){var t=s(e,0,[1,0]);return this.getSignedData(t)},this.getSignedData=function(e){var t=l(e,0),n={},r=i(e,t[0]),s=parseInt(r,16);n.version=s;var u=a(e,t[1]);n.hashalgs=this.getHashAlgArray(u);var c=a(e,t[2]);n.econtent=this.getEContent(c);var h=o(e,0,["[0]"]);null!=h&&(n.certs=this.getCertificateSet(h));o(e,0,["[1]"]);var f=o(e,0,[3]);return n.sinfos=this.getSignerInfos(f),n},this.getHashAlgArray=function(e){for(var n=l(e,0),r=new t,i=[],s=0;s<n.length;s++){var o=a(e,n[s]),u=r.getAlgorithmIdentifierName(o);i.push(u)}return i},this.getEContent=function(e){var t={},n=u(e,0,[0]),r=u(e,0,[1,0]);return t.type=he.asn1.x509.OID.oid2name(pe.hextooidstr(n)),t.content={hex:r},t},this.getSignerInfos=function(e){for(var t=[],n=l(e,0),r=0;r<n.length;r++){var i=a(e,n[r]),s=this.getSignerInfo(i);t.push(s)}return t},this.getSignerInfo=function(e){var t={},i=l(e,0),s=r.getInt(e,i[0],-1);-1!=s&&(t.version=s);var u=a(e,i[1]),h=this.getIssuerAndSerialNumber(u);t.id=h;var f=a(e,i[2]),d=n.getAlgorithmIdentifierName(f);t.hashalg=d;var p=o(e,0,["[0]"]);if(null!=p){var g=this.getAttributeList(p);t.sattrs=g}var m=o(e,0,[3]),v=n.getAlgorithmIdentifierName(m);t.sigalg=v;var y=c(e,0,[4]);t.sighex=y;var b=o(e,0,["[1]"]);if(null!=b){var w=this.getAttributeList(b);t.uattrs=w}return t},this.getSignerIdentifier=function(e){if("30"==e.substr(0,2))return this.getIssuerAndSerialNumber(e);throw new Error("SKID of signerIdentifier not supported")},this.getIssuerAndSerialNumber=function(e){var t={type:"isssn"},r=l(e,0),s=a(e,r[0]);t.issuer=n.getX500Name(s);var o=i(e,r[1]);return t.serial={hex:o},t},this.getAttributeList=function(e){for(var t=[],n=l(e,0),r=0;r<n.length;r++){var i=a(e,n[r]),s=this.getAttribute(i);t.push(s)}return{array:t}},this.getAttribute=function(e){var t={},n=l(e,0),i=r.getOID(e,n[0]),s=he.asn1.x509.OID.oid2name(i);t.attr=s;var o=a(e,n[1]),u=l(o,0);if(1==u.length)t.valhex=a(o,u[0]);else{for(var c=[],h=0;h<u.length;h++)c.push(a(o,u[h]));t.valhex=c}return"contentType"==s?this.setContentType(t):"messageDigest"==s?this.setMessageDigest(t):"signingTime"==s?this.setSigningTime(t):"signingCertificate"==s?this.setSigningCertificate(t):"signingCertificateV2"==s?this.setSigningCertificateV2(t):"signaturePolicyIdentifier"==s&&this.setSignaturePolicyIdentifier(t),t},this.setContentType=function(e){var t=r.getOIDName(e.valhex,0,null);null!=t&&(e.type=t,delete e.valhex)},this.setSigningTime=function(e){var t=Ae(i(e.valhex,0));e.str=t,delete e.valhex},this.setMessageDigest=function(e){var t=i(e.valhex,0);e.hex=t,delete e.valhex},this.setSigningCertificate=function(e){var t=l(e.valhex,0);if(t.length>0){for(var n=a(e.valhex,t[0]),r=l(n,0),i=[],s=0;s<r.length;s++){var o=a(n,r[s]),u=this.getESSCertID(o);i.push(u)}e.array=i}if(t.length>1){var c=a(e.valhex,t[1]);e.polhex=c}delete e.valhex},this.setSignaturePolicyIdentifier=function(e){var n=l(e.valhex,0);if(n.length>0){var s=r.getOID(e.valhex,n[0]);e.oid=s}if(n.length>1){var o=new t,u=l(e.valhex,n[1]),c=a(e.valhex,u[0]),h=o.getAlgorithmIdentifierName(c);e.alg=h;var f=i(e.valhex,u[1]);e.hash=f}delete e.valhex},this.setSigningCertificateV2=function(e){var t=l(e.valhex,0);if(t.length>0){for(var n=a(e.valhex,t[0]),r=l(n,0),i=[],s=0;s<r.length;s++){var o=a(n,r[s]),u=this.getESSCertIDv2(o);i.push(u)}e.array=i}if(t.length>1){var c=a(e.valhex,t[1]);e.polhex=c}delete e.valhex},this.getESSCertID=function(e){var t={},n=l(e,0);if(n.length>0){var r=i(e,n[0]);t.hash=r}if(n.length>1){var s=a(e,n[1]),o=this.getIssuerSerial(s);null!=o.serial&&(t.serial=o.serial),null!=o.issuer&&(t.issuer=o.issuer)}return t},this.getESSCertIDv2=function(t){var r={},s=l(t,0);if(s.length<1||3<s.length)throw new e("wrong number of elements");var o=0;if("30"==t.substr(s[0],2)){var u=a(t,s[0]);r.alg=n.getAlgorithmIdentifierName(u),o++}else r.alg="sha256";var c=i(t,s[o]);if(r.hash=c,s.length>o+1){var h=a(t,s[o+1]),f=this.getIssuerSerial(h);r.issuer=f.issuer,r.serial=f.serial}return r},this.getIssuerSerial=function(e){var t={},r=l(e,0),s=a(e,r[0]),o=n.getGeneralNames(s)[0].dn;t.issuer=o;var u=i(e,r[1]);return t.serial={hex:u},t},this.getCertificateSet=function(e){for(var t=l(e,0),n=[],r=0;r<t.length;r++){var i=a(e,t[r]);if("30"==i.substr(0,2)){var s=Te(i,"CERTIFICATE");n.push(s)}}return{array:n,sortflag:!1}}},void 0!==he&&he||(he={}),void 0!==he.asn1&&he.asn1||(he.asn1={}),void 0!==he.asn1.tsp&&he.asn1.tsp||(he.asn1.tsp={}),he.asn1.tsp.TimeStampToken=function(e){var t=he.asn1.tsp;t.TimeStampToken.superclass.constructor.call(this),this.params=null,this.getEncodedHexPrepare=function(){var e=new t.TSTInfo(this.params.econtent.content);this.params.econtent.content.hex=e.getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.TimeStampToken,he.asn1.cms.SignedData),he.asn1.tsp.TSTInfo=function(e){Error;var t=he.asn1,n=t.DERSequence,r=t.DERInteger,i=t.DERBoolean,a=t.DERGeneralizedTime,s=t.DERObjectIdentifier,o=t.DERTaggedObject,u=t.tsp,c=u.MessageImprint,l=u.Accuracy,h=(t.x509.X500Name,t.x509.GeneralName);if(u.TSTInfo.superclass.constructor.call(this),this.dVersion=new r({int:1}),this.dPolicy=null,this.dMessageImprint=null,this.dSerial=null,this.dGenTime=null,this.dAccuracy=null,this.dOrdering=null,this.dNonce=null,this.dTsa=null,this.getEncodedHex=function(){var e=[this.dVersion];if(null==this.dPolicy)throw new Error("policy shall be specified.");if(e.push(this.dPolicy),null==this.dMessageImprint)throw new Error("messageImprint shall be specified.");if(e.push(this.dMessageImprint),null==this.dSerial)throw new Error("serialNumber shall be specified.");if(e.push(this.dSerial),null==this.dGenTime)throw new Error("genTime shall be specified.");e.push(this.dGenTime),null!=this.dAccuracy&&e.push(this.dAccuracy),null!=this.dOrdering&&e.push(this.dOrdering),null!=this.dNonce&&e.push(this.dNonce),null!=this.dTsa&&e.push(this.dTsa);var t=new n({array:e});return this.hTLV=t.getEncodedHex(),this.hTLV},void 0!==e){if("string"==typeof e.policy){if(!e.policy.match(/^[0-9.]+$/))throw"policy shall be oid like 0.1.4.134";this.dPolicy=new s({oid:e.policy})}void 0!==e.messageImprint&&(this.dMessageImprint=new c(e.messageImprint)),void 0!==e.serial&&(this.dSerial=new r(e.serial)),void 0!==e.genTime&&(this.dGenTime=new a(e.genTime)),void 0!==e.accuracy&&(this.dAccuracy=new l(e.accuracy)),void 0!==e.ordering&&1==e.ordering&&(this.dOrdering=new i),void 0!==e.nonce&&(this.dNonce=new r(e.nonce)),void 0!==e.tsa&&(this.dTsa=new o({tag:"a0",explicit:!0,obj:new h({dn:e.tsa})}))}},We(he.asn1.tsp.TSTInfo,he.asn1.ASN1Object),he.asn1.tsp.Accuracy=function(e){var t=he.asn1,n=t.ASN1Util.newObject;t.tsp.Accuracy.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,t=[];return null!=e.seconds&&"number"==typeof e.seconds&&t.push({int:e.seconds}),null!=e.millis&&"number"==typeof e.millis&&t.push({tag:{tagi:"80",obj:{int:e.millis}}}),null!=e.micros&&"number"==typeof e.micros&&t.push({tag:{tagi:"81",obj:{int:e.micros}}}),n({seq:t}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.Accuracy,he.asn1.ASN1Object),he.asn1.tsp.MessageImprint=function(e){var t=he.asn1,n=t.DERSequence,r=t.DEROctetString,i=t.x509.AlgorithmIdentifier;t.tsp.MessageImprint.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,t=new i({name:e.alg}),a=new r({hex:e.hash});return new n({array:[t,a]}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.tsp.MessageImprint,he.asn1.ASN1Object),he.asn1.tsp.TimeStampReq=function(e){var t=he.asn1,n=t.DERSequence,r=t.DERInteger,i=t.DERBoolean,a=(t.ASN1Object,t.DERObjectIdentifier),s=t.tsp,o=s.MessageImprint;s.TimeStampReq.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,t=[];return t.push(new r({int:1})),e.messageImprint instanceof he.asn1.ASN1Object?t.push(e.messageImprint):t.push(new o(e.messageImprint)),null!=e.policy&&t.push(new a(e.policy)),null!=e.nonce&&t.push(new r(e.nonce)),1==e.certreq&&t.push(new i),new n({array:t}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.TimeStampReq,he.asn1.ASN1Object),he.asn1.tsp.TimeStampResp=function(e){var t=he.asn1,n=t.DERSequence,r=(t.ASN1Object,t.tsp),i=r.PKIStatusInfo;r.TimeStampResp.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,a=[new i(e.statusinfo)];return null!=e.econtent&&a.push(new r.TimeStampToken(e).getContentInfo()),null!=e.tst&&e.tst instanceof t.ASN1Object&&a.push(e.tst),new n({array:a}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.TimeStampResp,he.asn1.ASN1Object),he.asn1.tsp.PKIStatusInfo=function(e){var t=Error,n=he.asn1,r=n.DERSequence,i=n.tsp,a=i.PKIStatus,s=i.PKIFreeText,o=i.PKIFailureInfo;i.PKIStatusInfo.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,n=[];if("string"==typeof e)n.push(new a(e));else{if(null==e.status)throw new t("property 'status' unspecified");n.push(new a(e.status)),null!=e.statusstr&&n.push(new s(e.statusstr)),null!=e.failinfo&&n.push(new o(e.failinfo))}return new r({array:n}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.PKIStatusInfo,he.asn1.ASN1Object),he.asn1.tsp.PKIStatus=function(e){var t=Error,n=he.asn1,r=n.DERInteger;n.tsp.PKIStatus.superclass.constructor.call(this);var i={granted:0,grantedWithMods:1,rejection:2,waiting:3,revocationWarning:4,revocationNotification:5};this.params=null,this.getEncodedHex=function(){var e,n=this.params;if("string"==typeof n)try{e=i[n]}catch(e){throw new t("undefined name: "+n)}else{if("number"!=typeof n)throw new t("unsupported params");e=n}return new r({int:e}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.PKIStatus,he.asn1.ASN1Object),he.asn1.tsp.PKIFreeText=function(e){var t=Error,n=he.asn1,r=n.DERSequence,i=n.DERUTF8String;n.tsp.PKIFreeText.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;if(!e instanceof Array)throw new t("wrong params: not array");for(var n=[],a=0;a<e.length;a++)n.push(new i({str:e[a]}));return new r({array:n}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.PKIFreeText,he.asn1.ASN1Object),he.asn1.tsp.PKIFailureInfo=function(e){var t=Error,n=he.asn1,r=n.DERBitString,i=n.tsp.PKIFailureInfo,a={badAlg:0,badRequest:2,badDataFormat:5,timeNotAvailable:14,unacceptedPolicy:15,unacceptedExtension:16,addInfoNotAvailable:17,systemFailure:25};i.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e,n=this.params;if("string"==typeof n)try{e=a[n]}catch(e){throw new t("undefined name: "+n)}else{if("number"!=typeof n)throw new t("wrong params");e=n}return new r({bin:e.toString(2)}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.PKIFailureInfo,he.asn1.ASN1Object),he.asn1.tsp.AbstractTSAAdapter=function(e){this.getTSTHex=function(e,t){throw"not implemented yet"}},he.asn1.tsp.SimpleTSAAdapter=function(e){var t=he,n=t.asn1.tsp,r=t.crypto.Util.hashHex;n.SimpleTSAAdapter.superclass.constructor.call(this),this.params=null,this.serial=0,this.getTSTHex=function(e,t){var i=r(e,t);this.params.econtent.content.messageImprint={alg:t,hash:i},this.params.econtent.content.serial={int:this.serial++};var a=Math.floor(1e9*Math.random());return this.params.econtent.content.nonce={int:a},new n.TimeStampToken(this.params).getContentInfoEncodedHex()},void 0!==e&&(this.params=e)},We(he.asn1.tsp.SimpleTSAAdapter,he.asn1.tsp.AbstractTSAAdapter),he.asn1.tsp.FixedTSAAdapter=function(e){var t=he,n=t.asn1.tsp,r=t.crypto.Util.hashHex;n.FixedTSAAdapter.superclass.constructor.call(this),this.params=null,this.getTSTHex=function(e,t){var i=r(e,t);return this.params.econtent.content.messageImprint={alg:t,hash:i},new n.TimeStampToken(this.params).getContentInfoEncodedHex()},void 0!==e&&(this.params=e)},We(he.asn1.tsp.FixedTSAAdapter,he.asn1.tsp.AbstractTSAAdapter),he.asn1.tsp.TSPUtil=new function(){},he.asn1.tsp.TSPUtil.newTimeStampToken=function(e){return new he.asn1.tsp.TimeStampToken(e)},he.asn1.tsp.TSPUtil.parseTimeStampReq=function(e){var t=pe,n=t.getChildIdx,r=t.getV,i=t.getTLV,a={certreq:!1},s=n(e,0);if(s.length<2)throw"TimeStampReq must have at least 2 items";var o=i(e,s[1]);a.messageImprint=he.asn1.tsp.TSPUtil.parseMessageImprint(o);for(var u=2;u<s.length;u++){var c=s[u],l=e.substr(c,2);if("06"==l){var h=r(e,c);a.policy=t.hextooidstr(h)}"02"==l&&(a.nonce=r(e,c)),"01"==l&&(a.certreq=!0)}return a},he.asn1.tsp.TSPUtil.parseMessageImprint=function(e){var t=pe,n=t.getChildIdx,r=t.getV,i=t.getIdxbyList,a={};if("30"!=e.substr(0,2))throw"head of messageImprint hex shall be '30'";n(e,0);var s=r(e,i(e,0,[0,0])),o=t.hextooidstr(s),u=he.asn1.x509.OID.oid2name(o);if(""==u)throw"hashAlg name undefined: "+o;var c=u,l=i(e,0,[1]);return a.alg=c,a.hash=r(e,l),a},he.asn1.tsp.TSPParser=function(){Error;var e=new Ze,t=pe,n=t.getV,r=t.getTLV,i=t.getIdxbyList,a=(t.getTLVbyListEx,t.getChildIdx),s=["granted","grantedWithMods","rejection","waiting","revocationWarning","revocationNotification"],o={0:"badAlg",2:"badRequest",5:"badDataFormat",14:"timeNotAvailable",15:"unacceptedPolicy",16:"unacceptedExtension",17:"addInfoNotAvailable",25:"systemFailure"};this.getResponse=function(e){var t=a(e,0);if(1==t.length)return this.getPKIStatusInfo(r(e,t[0]));if(t.length>1){var n=this.getPKIStatusInfo(r(e,t[0])),i=r(e,t[1]),s=this.getToken(i);return s.statusinfo=n,s}},this.getToken=function(e){var t=(new he.asn1.cms.CMSParser).getCMSSignedData(e);return this.setTSTInfo(t),t},this.setTSTInfo=function(e){var t=e.econtent;if("tstinfo"==t.type){var n=t.content.hex,r=this.getTSTInfo(n);t.content=r}},this.getTSTInfo=function(t){var i={},s=a(t,0),o=n(t,s[1]);i.policy=Ke(o);var u=r(t,s[2]);i.messageImprint=this.getMessageImprint(u);var c=n(t,s[3]);i.serial={hex:c};var l=n(t,s[4]);i.genTime={str:Ae(l)};var h=0;if(s.length>5&&"30"==t.substr(s[5],2)){var f=r(t,s[5]);i.accuracy=this.getAccuracy(f),h++}s.length>5+h&&"01"==t.substr(s[5+h],2)&&("ff"==n(t,s[5+h])&&(i.ordering=!0),h++);if(s.length>5+h&&"02"==t.substr(s[5+h],2)){var d=n(t,s[5+h]);i.nonce={hex:d},h++}if(s.length>5+h&&"a0"==t.substr(s[5+h],2)){var p=r(t,s[5+h]);p="30"+p.substr(2),pGeneralNames=e.getGeneralNames(p);var g=pGeneralNames[0].dn;i.tsa=g,h++}if(s.length>5+h&&"a1"==t.substr(s[5+h],2)){var m=r(t,s[5+h]);m="30"+m.substr(2);var v=e.getExtParamArray(m);i.ext=v,h++}return i},this.getAccuracy=function(e){for(var t={},r=a(e,0),i=0;i<r.length;i++){var s=e.substr(r[i],2),o=n(e,r[i]),u=parseInt(o,16);"02"==s?t.seconds=u:"80"==s?t.millis=u:"81"==s&&(t.micros=u)}return t},this.getMessageImprint=function(e){if("30"!=e.substr(0,2))throw new Error("head of messageImprint hex shall be x30");var r={},s=(a(e,0),i(e,0,[0,0])),o=n(e,s),u=t.hextooidstr(o),c=he.asn1.x509.OID.oid2name(u);if(""==c)throw new Error("hashAlg name undefined: "+u);var l=c,h=i(e,0,[1]);return r.alg=l,r.hash=n(e,h),r},this.getPKIStatusInfo=function(e){var t={},i=a(e,0),o=0;try{var u=n(e,i[0]),c=parseInt(u,16);t.status=s[c]}catch(e){}if(i.length>1&&"30"==e.substr(i[1],2)){var l=r(e,i[1]);t.statusstr=this.getPKIFreeText(l),o++}if(i.length>o&&"03"==e.substr(i[1+o],2)){var h=r(e,i[1+o]);t.failinfo=this.getPKIFailureInfo(h)}return t},this.getPKIFreeText=function(e){for(var n=[],r=a(e,0),i=0;i<r.length;i++)n.push(t.getString(e,r[i]));return n},this.getPKIFailureInfo=function(e){var n=t.getInt(e,0);return null!=o[n]?o[n]:n}},void 0!==he&&he||(he={}),void 0!==he.asn1&&he.asn1||(he.asn1={}),void 0!==he.asn1.cades&&he.asn1.cades||(he.asn1.cades={}),he.asn1.cades.SignaturePolicyIdentifier=function(e){var t=he.asn1.cades,n=t.SignaturePolicyId;t.SignaturePolicyIdentifier.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.15",this.params=null,this.getValueArray=function(){return[new n(this.params)]},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},We(he.asn1.cades.SignaturePolicyIdentifier,he.asn1.cms.Attribute),he.asn1.cades.SignaturePolicyId=function(e){var t=he.asn1,n=t.DERSequence,r=t.DERObjectIdentifier,i=(t.x509.AlgorithmIdentifier,t.cades),a=i.SignaturePolicyId,s=i.OtherHashAlgAndValue;a.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,t=[];return t.push(new r(e.oid)),t.push(new s(e)),new n({array:t}).getEncodedHex()},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},We(he.asn1.cades.SignaturePolicyId,he.asn1.ASN1Object),he.asn1.cades.OtherHashAlgAndValue=function(e){var t=Error,n=he.asn1,r=n.DERSequence,i=n.DEROctetString,a=n.x509.AlgorithmIdentifier;n.cades.OtherHashAlgAndValue.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;if(null==e.alg)throw new t("property 'alg' not specified");if(null==e.hash&&null==e.cert)throw new t("property 'hash' nor 'cert' not specified");var n=null;if(null!=e.hash)n=e.hash;else if(null!=e.cert){if("string"!=typeof e.cert)throw new t("cert not string");var s=e.cert;-1!=e.cert.indexOf("-----BEGIN")&&(s=$e(e.cert)),n=he.crypto.Util.hashHex(s,e.alg)}var o=[];return o.push(new a({name:e.alg})),o.push(new i({hex:n})),new r({array:o}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cades.OtherHashAlgAndValue,he.asn1.ASN1Object),he.asn1.cades.OtherHashValue=function(e){he.asn1.cades.OtherHashValue.superclass.constructor.call(this);var t=Error,n=he,r=(n.lang.String.isHex,n.asn1.DEROctetString);n.crypto.Util.hashHex;this.params=null,this.getEncodedHex=function(){var e=this.params;if(null==e.hash&&null==e.cert)throw new t("hash or cert not specified");var n=null;if(null!=e.hash)n=e.hash;else if(null!=e.cert){if("string"!=typeof e.cert)throw new t("cert not string");var i=e.cert;-1!=e.cert.indexOf("-----BEGIN")&&(i=$e(e.cert)),n=he.crypto.Util.hashHex(i,"sha1")}return new r({hex:n}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cades.OtherHashValue,he.asn1.ASN1Object),he.asn1.cades.SignatureTimeStamp=function(e){var t=Error,n=he,r=n.lang.String.isHex,i=n.asn1,a=i.ASN1Object;i.x509;i.cades.SignatureTimeStamp.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.14",this.params=null,this.getValueArray=function(){var e=this.params;if(null!=e.tst){if(r(e.tst))return(i=new a).hTLV=e.tst,[i];if(e.tst instanceof a)return[e.tst];throw new t("params.tst has wrong value")}if(null!=e.res){var n=e.res;if(n instanceof a&&(n=n.getEncodedHex()),"string"!=typeof n||!r(n))throw new t("params.res has wrong value");var i;pe.getTLVbyList(n,0,[1]);return(i=new a).hTLV=e.tst,[i]}},null!=e&&this.setByParam(e)},We(he.asn1.cades.SignatureTimeStamp,he.asn1.cms.Attribute),he.asn1.cades.CompleteCertificateRefs=function(e){var t=Error,n=he,r=n.asn1,i=r.DERSequence,a=r.cades,s=a.OtherCertID,o=n.lang.String.isHex;a.CompleteCertificateRefs.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.21",this.params=null,this.getValueArray=function(){for(var e=this.params,n=[],r=0;r<e.array.length;r++){var a=e.array[r];if("string"==typeof a)if(-1!=a.indexOf("-----BEGIN"))a={cert:a};else{if(!o(a))throw new t("unsupported value: "+a);a={hash:a}}null!=e.alg&&null==a.alg&&(a.alg=e.alg),null!=e.hasis&&null==a.hasis&&(a.hasis=e.hasis);var u=new s(a);n.push(u)}return[new i({array:n})]},null!=e&&this.setByParam(e)},We(he.asn1.cades.CompleteCertificateRefs,he.asn1.cms.Attribute),he.asn1.cades.OtherCertID=function(e){var t=he.asn1,n=t.DERSequence,r=t.cms.IssuerSerial,i=t.cades,a=i.OtherHashValue,s=i.OtherHashAlgAndValue;i.OtherCertID.superclass.constructor.call(this),this.params=e,this.getEncodedHex=function(){var e=this.params;"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?e={cert:e}:_isHex(e)&&(e={hash:e}));var t=[],i=null;if(i=null!=e.alg?new s(e):new a(e),t.push(i),null!=e.cert&&1==e.hasis||null!=e.issuer&&null!=e.serial){var o=new r(e);t.push(o)}return new n({array:t}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cades.OtherCertID,he.asn1.ASN1Object),he.asn1.cades.OtherHash=function(e){Error;var t=he,n=t.asn1,r=(n.cms,n.cades),i=r.OtherHashAlgAndValue,a=r.OtherHashValue,s=(t.crypto.Util.hashHex,t.lang.String.isHex);r.OtherHash.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?e={cert:e}:s(e)&&(e={hash:e}));return(null!=e.alg?new i(e):new a(e)).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cades.OtherHash,he.asn1.ASN1Object),he.asn1.cades.CAdESUtil=new function(){},he.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned=function(e){return(new he.asn1.cms.CMSParser).getCMSSignedData(e)},he.asn1.cades.CAdESUtil.parseSignerInfoForAddingUnsigned=function(e,t,n){var r=pe,i=r.getChildIdx,a=r.getTLV,s=r.getV,o=he.asn1,u=o.ASN1Object,c=o.cms,l=c.AttributeList,h=c.SignerInfo,f={},d=i(e,t);if(6!=d.length)throw"not supported items for SignerInfo (!=6)";var p=d.shift();f.version=a(e,p);var g=d.shift();f.si=a(e,g);var m=d.shift();f.digalg=a(e,m);var v=d.shift();f.sattrs=a(e,v);var y=d.shift();f.sigalg=a(e,y);var b=d.shift();f.sig=a(e,b),f.sigval=s(e,b);var w=null;return f.obj=new h,(w=new u).hTLV=f.version,f.obj.dCMSVersion=w,(w=new u).hTLV=f.si,f.obj.dSignerIdentifier=w,(w=new u).hTLV=f.digalg,f.obj.dDigestAlgorithm=w,(w=new u).hTLV=f.sattrs,f.obj.dSignedAttrs=w,(w=new u).hTLV=f.sigalg,f.obj.dSigAlg=w,(w=new u).hTLV=f.sig,f.obj.dSig=w,f.obj.dUnsignedAttrs=new l,f},void 0!==he.asn1.csr&&he.asn1.csr||(he.asn1.csr={}),he.asn1.csr.CertificationRequest=function(e){var t=he.asn1,n=t.DERBitString,r=t.DERSequence,i=t.csr,a=(t.x509,i.CertificationRequestInfo);i.CertificationRequest.superclass.constructor.call(this),this.setByParam=function(e){this.params=e},this.sign=function(){var e=new a(this.params).getEncodedHex(),t=new he.crypto.Signature({alg:this.params.sigalg});t.init(this.params.sbjprvkey),t.updateHex(e);var n=t.sign();this.params.sighex=n},this.getPEM=function(){return Te(this.getEncodedHex(),"CERTIFICATE REQUEST")},this.getEncodedHex=function(){var e=this.params,t=new he.asn1.csr.CertificationRequestInfo(this.params),i=new he.asn1.x509.AlgorithmIdentifier({name:e.sigalg});if(null==e.sighex&&null!=e.sbjprvkey&&this.sign(),null==e.sighex)throw new Error("sighex or sbjprvkey parameter not defined");var a=new n({hex:"00"+e.sighex});return new r({array:[t,i,a]}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.csr.CertificationRequest,he.asn1.ASN1Object),he.asn1.csr.CertificationRequestInfo=function(e){var t=he.asn1,n=(t.DERBitString,t.DERSequence),r=t.DERInteger,i=t.DERUTF8String,a=t.DERTaggedObject,s=t.ASN1Util.newObject,o=t.csr,u=t.x509,c=u.X500Name,l=u.Extensions,h=u.SubjectPublicKeyInfo;o.CertificationRequestInfo.superclass.constructor.call(this),this.params=null,this.setByParam=function(e){null!=e&&(this.params=e)},this.getEncodedHex=function(){var e=this.params,t=[];if(t.push(new r({int:0})),t.push(new c(e.subject)),t.push(new h(Ye.getKey(e.sbjpubkey))),null!=e.extreq){var o=new l(e.extreq),u=s({tag:{tag:"a0",explict:!0,obj:{seq:[{oid:"1.2.840.113549.1.9.14"},{set:[o]}]}}});t.push(u)}else t.push(new a({tag:"a0",explicit:!1,obj:new i({str:""})}));return new n({array:t}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.csr.CertificationRequestInfo,he.asn1.ASN1Object),he.asn1.csr.CSRUtil=new function(){},he.asn1.csr.CSRUtil.newCSRPEM=function(e){return new he.asn1.csr.CertificationRequest(e).getPEM()},he.asn1.csr.CSRUtil.getParam=function(e){var t=pe,n=t.getV;_getIdxbyList=t.getIdxbyList,_getTLVbyList=t.getTLVbyList,_getTLVbyListEx=t.getTLVbyListEx,_getVbyListEx=t.getVbyListEx;var r={};if(-1==e.indexOf("-----BEGIN CERTIFICATE REQUEST"))throw new Error("argument is not PEM file");var i=$e(e,"CERTIFICATE REQUEST");try{var a=_getTLVbyListEx(i,0,[0,1]);if("3000"==a)r.subject={};else{var s=new Ze;r.subject=s.getX500Name(a)}}catch(e){}var o=_getTLVbyListEx(i,0,[0,2]),u=Ye.getKey(o,null,"pkcs8pub");r.sbjpubkey=Ye.getPEM(u,"PKCS8PUB");var c,l,h=(c=i,l=_getIdxbyList(c,0,[0,3,0,0],"06"),"2a864886f70d01090e"!=n(c,l)?null:_getTLVbyList(c,0,[0,3,0,1,0],"30"));s=new Ze;null!=h&&(r.extreq=s.getExtParamArray(h));try{var f=_getTLVbyListEx(i,0,[1],"30");s=new Ze;r.sigalg=s.getAlgorithmIdentifierName(f)}catch(e){}try{var d=_getVbyListEx(i,0,[2]);r.sighex=d}catch(e){}return r},void 0!==he&&he||(he={}),void 0!==he.asn1&&he.asn1||(he.asn1={}),void 0!==he.asn1.ocsp&&he.asn1.ocsp||(he.asn1.ocsp={}),he.asn1.ocsp.DEFAULT_HASH="sha1",he.asn1.ocsp.OCSPResponse=function(e){he.asn1.ocsp.OCSPResponse.superclass.constructor.call(this);he.asn1.DEREnumerated;var t=he.asn1.ASN1Util.newObject,n=he.asn1.ocsp.ResponseBytes,r=["successful","malformedRequest","internalError","tryLater","_not_used_","sigRequired","unauthorized"];this.params=null,this._getStatusCode=function(){var e=this.params.resstatus;return"number"==typeof e?e:"string"!=typeof e?-1:r.indexOf(e)},this.setByParam=function(e){this.params=e},this.getEncodedHex=function(){var e=this.params,r=this._getStatusCode();if(-1==r)throw new Error("responseStatus not supported: "+e.resstatus);if(0!=r)return t({seq:[{enum:{int:r}}]}).getEncodedHex();var i=new n(e);return t({seq:[{enum:{int:0}},{tag:{tag:"a0",explicit:!0,obj:i}}]}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.OCSPResponse,he.asn1.ASN1Object),he.asn1.ocsp.ResponseBytes=function(e){he.asn1.ocsp.ResponseBytes.superclass.constructor.call(this);var t=he.asn1,n=t.DERSequence,r=t.DERObjectIdentifier,i=t.DEROctetString,a=t.ocsp.BasicOCSPResponse;this.params=null,this.setByParam=function(e){this.params=e},this.getEncodedHex=function(){var e=this.params;if("ocspBasic"!=e.restype)throw new Error("not supported responseType: "+e.restype);var t=new a(e),s=[];return s.push(new r({name:"ocspBasic"})),s.push(new i({hex:t.getEncodedHex()})),new n({array:s}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.ResponseBytes,he.asn1.ASN1Object),he.asn1.ocsp.BasicOCSPResponse=function(e){he.asn1.ocsp.BasicOCSPResponse.superclass.constructor.call(this);var t=Error,n=he.asn1,r=n.ASN1Object,i=n.DERSequence,a=(n.DERGeneralizedTime,n.DERTaggedObject),s=n.DERBitString,o=(n.x509.Extensions,n.x509.AlgorithmIdentifier),u=n.ocsp;u.ResponderID;_SingleResponseList=u.SingleResponseList,_ResponseData=u.ResponseData,this.params=null,this.setByParam=function(e){this.params=e},this.sign=function(){var e=this.params,t=e.tbsresp.getEncodedHex(),n=new he.crypto.Signature({alg:e.sigalg});n.init(e.reskey),n.updateHex(t),e.sighex=n.sign()},this.getEncodedHex=function(){var e=this.params;null==e.tbsresp&&(e.tbsresp=new _ResponseData(e)),null==e.sighex&&null!=e.reskey&&this.sign();var n=[];if(n.push(e.tbsresp),n.push(new o({name:e.sigalg})),n.push(new s({hex:"00"+e.sighex})),null!=e.certs&&null!=e.certs.length){for(var u=[],c=0;c<e.certs.length;c++){var l=e.certs[c],h=null;if(pe.isASN1HEX(l))h=l;else{if(!l.match(/-----BEGIN/))throw new t("certs["+c+"] not hex or PEM");h=$e(l)}u.push(new r({tlv:h}))}var f=new i({array:u});n.push(new a({tag:"a0",explicit:!0,obj:f}))}return new i({array:n}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.BasicOCSPResponse,he.asn1.ASN1Object),he.asn1.ocsp.ResponseData=function(e){he.asn1.ocsp.ResponseData.superclass.constructor.call(this);var t=Error,n=he.asn1,r=n.DERSequence,i=n.DERGeneralizedTime,a=n.DERTaggedObject,s=n.x509.Extensions,o=n.ocsp,u=o.ResponderID;_SingleResponseList=o.SingleResponseList,this.params=null,this.getEncodedHex=function(){var e=this.params;null!=e.respid&&new t("respid not specified"),null!=e.prodat&&new t("prodat not specified"),null!=e.array&&new t("array not specified");var n=[];if(n.push(new u(e.respid)),n.push(new i(e.prodat)),n.push(new _SingleResponseList(e.array)),null!=e.ext){var o=new s(e.ext);n.push(new a({tag:"a1",explicit:!0,obj:o}))}return new r({array:n}).getEncodedHex()},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.ResponseData,he.asn1.ASN1Object),he.asn1.ocsp.ResponderID=function(e){he.asn1.ocsp.ResponderID.superclass.constructor.call(this);var t=he.asn1,n=t.ASN1Util.newObject,r=t.x509.X500Name;this.params=null,this.getEncodedHex=function(){var e=this.params;if(null!=e.key)return n({tag:{tag:"a2",explicit:!0,obj:{octstr:{hex:e.key}}}}).getEncodedHex();if(null!=e.name)return n({tag:{tag:"a1",explicit:!0,obj:new r(e.name)}}).getEncodedHex();throw new Error("key or name not specified")},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.ResponderID,he.asn1.ASN1Object),he.asn1.ocsp.SingleResponseList=function(e){he.asn1.ocsp.SingleResponseList.superclass.constructor.call(this);var t=he.asn1,n=t.DERSequence,r=t.ocsp.SingleResponse;this.params=null,this.getEncodedHex=function(){var e=this.params;if("object"!=typeof e||null==e.length)throw new Error("params not specified properly");for(var t=[],i=0;i<e.length;i++)t.push(new r(e[i]));return new n({array:t}).getEncodedHex()},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.SingleResponseList,he.asn1.ASN1Object),he.asn1.ocsp.SingleResponse=function(e){var t=Error,n=he.asn1,r=n.DERSequence,i=n.DERGeneralizedTime,a=n.DERTaggedObject,s=n.ocsp,o=s.CertID,u=s.CertStatus,c=n.x509.Extensions;s.SingleResponse.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,n=[];if(null==e.certid)throw new t("certid unspecified");if(null==e.status)throw new t("status unspecified");if(null==e.thisupdate)throw new t("thisupdate unspecified");if(n.push(new o(e.certid)),n.push(new u(e.status)),n.push(new i(e.thisupdate)),null!=e.nextupdate){var s=new i(e.nextupdate);n.push(new a({tag:"a0",explicit:!0,obj:s}))}if(null!=e.ext){var l=new c(e.ext);n.push(new a({tag:"a1",explicit:!0,obj:l}))}return new r({array:n}).getEncodedHex()},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.SingleResponse,he.asn1.ASN1Object),he.asn1.ocsp.CertID=function(e){var t=he,n=t.asn1,r=n.DEROctetString,i=n.DERInteger,a=n.DERSequence,s=n.x509.AlgorithmIdentifier,o=n.ocsp,u=o.DEFAULT_HASH,c=t.crypto.Util.hashHex,l=Ze,h=pe;if(o.CertID.superclass.constructor.call(this),this.dHashAlg=null,this.dIssuerNameHash=null,this.dIssuerKeyHash=null,this.dSerialNumber=null,this.setByValue=function(e,t,n,a){void 0===a&&(a=u),this.dHashAlg=new s({name:a}),this.dIssuerNameHash=new r({hex:e}),this.dIssuerKeyHash=new r({hex:t}),this.dSerialNumber=new i({hex:n})},this.setByCert=function(e,t,n){void 0===n&&(n=u);var r=new l;r.readCertPEM(t);var i=new l;i.readCertPEM(e);var a=i.getPublicKeyHex(),s=h.getTLVbyList(a,0,[1,0],"30"),o=r.getSerialNumberHex(),f=c(i.getSubjectHex(),n),d=c(s,n);this.setByValue(f,d,o,n),this.hoge=r.getSerialNumberHex()},this.getEncodedHex=function(){if(null===this.dHashAlg&&null===this.dIssuerNameHash&&null===this.dIssuerKeyHash&&null===this.dSerialNumber)throw"not yet set values";var e=[this.dHashAlg,this.dIssuerNameHash,this.dIssuerKeyHash,this.dSerialNumber],t=new a({array:e});return this.hTLV=t.getEncodedHex(),this.hTLV},void 0!==e){var f=e;if(void 0!==f.issuerCert&&void 0!==f.subjectCert){var d=u;void 0===f.alg&&(d=void 0),this.setByCert(f.issuerCert,f.subjectCert,d)}else{if(void 0===f.issname||void 0===f.isskey||void 0===f.sbjsn)throw new Error("invalid constructor arguments");d=u;void 0===f.alg&&(d=void 0),this.setByValue(f.issname,f.isskey,f.sbjsn,d)}}},We(he.asn1.ocsp.CertID,he.asn1.ASN1Object),he.asn1.ocsp.CertStatus=function(e){he.asn1.ocsp.CertStatus.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;if("good"==e.status)return"8000";if("unknown"==e.status)return"8200";if("revoked"==e.status){var t=[{gentime:{str:e.time}}];null!=e.reason&&t.push({tag:{tag:"a0",explicit:!0,obj:{enum:{int:e.reason}}}});var n={tag:"a1",explicit:!1,obj:{seq:t}};return he.asn1.ASN1Util.newObject({tag:n}).getEncodedHex()}throw new Error("bad status")},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.CertStatus,he.asn1.ASN1Object),he.asn1.ocsp.Request=function(e){var t=he.asn1,n=t.DERSequence,r=t.ocsp;if(r.Request.superclass.constructor.call(this),this.dReqCert=null,this.dExt=null,this.getEncodedHex=function(){var e=[];if(null===this.dReqCert)throw"reqCert not set";e.push(this.dReqCert);var t=new n({array:e});return this.hTLV=t.getEncodedHex(),this.hTLV},void 0!==e){var i=new r.CertID(e);this.dReqCert=i}},We(he.asn1.ocsp.Request,he.asn1.ASN1Object),he.asn1.ocsp.TBSRequest=function(e){var t=he.asn1,n=t.DERSequence,r=t.ocsp;r.TBSRequest.superclass.constructor.call(this),this.version=0,this.dRequestorName=null,this.dRequestList=[],this.dRequestExt=null,this.setRequestListByParam=function(e){for(var t=[],n=0;n<e.length;n++){var i=new r.Request(e[0]);t.push(i)}this.dRequestList=t},this.getEncodedHex=function(){var e=[];if(0!==this.version)throw"not supported version: "+this.version;if(null!==this.dRequestorName)throw"requestorName not supported";var t=new n({array:this.dRequestList});if(e.push(t),null!==this.dRequestExt)throw"requestExtensions not supported";var r=new n({array:e});return this.hTLV=r.getEncodedHex(),this.hTLV},void 0!==e&&void 0!==e.reqList&&this.setRequestListByParam(e.reqList)},We(he.asn1.ocsp.TBSRequest,he.asn1.ASN1Object),he.asn1.ocsp.OCSPRequest=function(e){var t=he.asn1,n=t.DERSequence,r=t.ocsp;if(r.OCSPRequest.superclass.constructor.call(this),this.dTbsRequest=null,this.dOptionalSignature=null,this.getEncodedHex=function(){var e=[];if(null===this.dTbsRequest)throw"tbsRequest not set";if(e.push(this.dTbsRequest),null!==this.dOptionalSignature)throw"optionalSignature not supported";var t=new n({array:e});return this.hTLV=t.getEncodedHex(),this.hTLV},void 0!==e&&void 0!==e.reqList){var i=new r.TBSRequest(e);this.dTbsRequest=i}},We(he.asn1.ocsp.OCSPRequest,he.asn1.ASN1Object),he.asn1.ocsp.OCSPUtil={},he.asn1.ocsp.OCSPUtil.getRequestHex=function(e,t,n){var r=he.asn1.ocsp;void 0===n&&(n=r.DEFAULT_HASH);var i={alg:n,issuerCert:e,subjectCert:t};return new r.OCSPRequest({reqList:[i]}).getEncodedHex()},he.asn1.ocsp.OCSPUtil.getOCSPResponseInfo=function(e){var t=pe,n=t.getVbyList,r=t.getVbyListEx,i=t.getIdxbyList,a=(t.getIdxbyListEx,t.getV),s={};try{var o=r(e,0,[0],"0a");s.responseStatus=parseInt(o,16)}catch(e){}if(0!==s.responseStatus)return s;try{var u=i(e,0,[1,0,1,0,0,2,0,1]);"80"===e.substr(u,2)?s.certStatus="good":"a1"===e.substr(u,2)?(s.certStatus="revoked",s.revocationTime=Ae(n(e,u,[0]))):"82"===e.substr(u,2)&&(s.certStatus="unknown")}catch(e){}try{var c=i(e,0,[1,0,1,0,0,2,0,2]);s.thisUpdate=Ae(a(e,c))}catch(e){}try{var l=i(e,0,[1,0,1,0,0,2,0,3]);"a0"===e.substr(l,2)&&(s.nextUpdate=Ae(n(e,l,[0])))}catch(e){}return s},he.asn1.ocsp.OCSPParser=function(){var e=Error,t=Ze,n=new t,r=pe,i=r.getV,a=r.getTLV,s=r.getIdxbyList,o=r.getTLVbyListEx,u=r.getChildIdx;this.getOCSPRequest=function(t){var n=u(t,0);if(1!=n.length&&2!=n.length)throw new e("wrong number elements: "+n.length);return this.getTBSRequest(a(t,n[0]))},this.getTBSRequest=function(e){var t={},r=o(e,0,[0],"30");t.array=this.getRequestList(r);var i=o(e,0,["[2]",0],"30");return null!=i&&(t.ext=n.getExtParamArray(i)),t},this.getRequestList=function(e){for(var t=[],n=u(e,0),r=0;r<n.length;r++){e=a(e,n[r]);t.push(this.getRequest(e))}return t},this.getRequest=function(t){var r=u(t,0);if(1!=r.length&&2!=r.length)throw new e("wrong number elements: "+r.length);var i=this.getCertID(a(t,r[0]));if(2==r.length){var o=s(t,0,[1,0]);i.ext=n.getExtParamArray(a(t,o))}return i},this.getCertID=function(n){var r=u(n,0);if(4!=r.length)throw new e("wrong number elements: "+r.length);var s=new t,o={};return o.alg=s.getAlgorithmIdentifierName(a(n,r[0])),o.issname=i(n,r[1]),o.isskey=i(n,r[2]),o.sbjsn=i(n,r[3]),o}},void 0!==he&&he||(he={}),void 0!==he.lang&&he.lang||(he.lang={}),he.lang.String=function(){},"function"==typeof e?(fe=function(t){return be(e.from(t,"utf8").toString("base64"))},de=function(t){return e.from(we(t),"base64").toString("utf8")}):(fe=function(e){return xe(ke(Le(e)))},de=function(e){return decodeURIComponent(Oe(Se(e)))}),he.lang.String.isInteger=function(e){return!!e.match(/^[0-9]+$/)||!!e.match(/^-[0-9]+$/)},he.lang.String.isHex=function(e){return Me(e)},he.lang.String.isBase64=function(e){return!(!(e=e.replace(/\s+/g,"")).match(/^[0-9A-Za-z+\/]+={0,3}$/)||e.length%4!=0)},he.lang.String.isBase64URL=function(e){return!e.match(/[+/=]/)&&(e=we(e),he.lang.String.isBase64(e))},he.lang.String.isIntegerArray=function(e){return!!(e=e.replace(/\s+/g,"")).match(/^\[[0-9,]+\]$/)},he.lang.String.isPrintable=function(e){return null!==e.match(/^[0-9A-Za-z '()+,-./:=?]*$/)},he.lang.String.isIA5=function(e){return null!==e.match(/^[\x20-\x21\x23-\x7f]*$/)},he.lang.String.isMail=function(e){return null!==e.match(/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\.[A-Za-z0-9]{1,}$/)};function qe(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},n=function(e){var n="",r=parseInt(e,10).toString(2),i=7-r.length%7;7==i&&(i=0);for(var a="",s=0;s<i;s++)a+="0";r=a+r;for(s=0;s<r.length-1;s+=7){var o=r.substr(s,7);s!=r.length-7&&(o="1"+o),n+=t(parseInt(o,2))}return n};try{if(!e.match(/^[0-9.]+$/))return null;var r="",i=e.split("."),a=40*parseInt(i[0],10)+parseInt(i[1],10);r+=t(a),i.splice(0,2);for(var s=0;s<i.length;s++)r+=n(i[s]);return r}catch(e){return null}}function Ke(e){if(!Me(e))return null;try{var t=[],n=e.substr(0,2),r=parseInt(n,16);t[0]=new String(Math.floor(r/40)),t[1]=new String(r%40);for(var i=e.substr(2),a=[],s=0;s<i.length/2;s++)a.push(parseInt(i.substr(2*s,2),16));var o=[],u="";for(s=0;s<a.length;s++)128&a[s]?u+=ze((127&a[s]).toString(2),7):(u+=ze((127&a[s]).toString(2),7),o.push(new String(parseInt(u,2))),u="");var c=t.join(".");return o.length>0&&(c=c+"."+o.join(".")),c}catch(e){return null}}var ze=function(e,t,n){return null==n&&(n="0"),e.length>=t?e:new Array(t-e.length+1).join(n)+e};function Ge(e){try{var t=e.substr(0,2);if("00"==t)return parseInt(e.substr(2),16);var n=parseInt(t,16),r=e.substr(2),i=parseInt(r,16).toString(2);return"0"==i&&(i="00000000"),i=i.slice(0,0-n),parseInt(i,2)}catch(e){return-1}}function We(e,t){var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t)}void 0!==he&&he||(he={}),void 0!==he.crypto&&he.crypto||(he.crypto={}),he.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:g.algo.MD5,sha1:g.algo.SHA1,sha224:g.algo.SHA224,sha256:g.algo.SHA256,sha384:g.algo.SHA384,sha512:g.algo.SHA512,ripemd160:g.algo.RIPEMD160},this.getDigestInfoHex=function(e,t){if(void 0===this.DIGESTINFOHEAD[t])throw"alg not supported in Util.DIGESTINFOHEAD: "+t;return this.DIGESTINFOHEAD[t]+e},this.getPaddedDigestInfoHex=function(e,t,n){var r=this.getDigestInfoHex(e,t),i=n/4;if(r.length+22>i)throw"key is too short for SigAlg: keylen="+n+","+t;for(var a="0001",s="00"+r,o="",u=i-a.length-s.length,c=0;c<u;c+=2)o+="ff";return a+o+s},this.hashString=function(e,t){return new he.crypto.MessageDigest({alg:t}).digestString(e)},this.hashHex=function(e,t){return new he.crypto.MessageDigest({alg:t}).digestHex(e)},this.sha1=function(e){return this.hashString(e,"sha1")},this.sha256=function(e){return this.hashString(e,"sha256")},this.sha256Hex=function(e){return this.hashHex(e,"sha256")},this.sha512=function(e){return this.hashString(e,"sha512")},this.sha512Hex=function(e){return this.hashHex(e,"sha512")},this.isKey=function(e){return e instanceof ae||e instanceof he.crypto.DSA||e instanceof he.crypto.ECDSA}},he.crypto.Util.md5=function(e){return new he.crypto.MessageDigest({alg:"md5",prov:"cryptojs"}).digestString(e)},he.crypto.Util.ripemd160=function(e){return new he.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"}).digestString(e)},he.crypto.Util.SECURERANDOMGEN=new ne,he.crypto.Util.getRandomHexOfNbytes=function(e){var t=new Array(e);return he.crypto.Util.SECURERANDOMGEN.nextBytes(t),ve(t)},he.crypto.Util.getRandomBigIntegerOfNbytes=function(e){return new S(he.crypto.Util.getRandomHexOfNbytes(e),16)},he.crypto.Util.getRandomHexOfNbits=function(e){var t=e%8,n=new Array((e-t)/8+1);return he.crypto.Util.SECURERANDOMGEN.nextBytes(n),n[0]=(255<<t&255^255)&n[0],ve(n)},he.crypto.Util.getRandomBigIntegerOfNbits=function(e){return new S(he.crypto.Util.getRandomHexOfNbits(e),16)},he.crypto.Util.getRandomBigIntegerZeroToMax=function(e){for(var t=e.bitLength();;){var n=he.crypto.Util.getRandomBigIntegerOfNbits(t);if(-1!=e.compareTo(n))return n}},he.crypto.Util.getRandomBigIntegerMinToMax=function(e,t){var n=e.compareTo(t);if(1==n)throw"biMin is greater than biMax";if(0==n)return e;var r=t.subtract(e);return he.crypto.Util.getRandomBigIntegerZeroToMax(r).add(e)},he.crypto.MessageDigest=function(e){this.setAlgAndProvider=function(e,t){if(null!==(e=he.crypto.MessageDigest.getCanonicalAlgName(e))&&void 0===t&&(t=he.crypto.Util.DEFAULTPROVIDER[e]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(e)&&"cryptojs"==t){try{this.md=he.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[e].create()}catch(t){throw"setAlgAndProvider hash alg set fail alg="+e+"/"+t}this.updateString=function(e){this.md.update(e)},this.updateHex=function(e){var t=g.enc.Hex.parse(e);this.md.update(t)},this.digest=function(){return this.md.finalize().toString(g.enc.Hex)},this.digestString=function(e){return this.updateString(e),this.digest()},this.digestHex=function(e){return this.updateHex(e),this.digest()}}if(-1!=":sha256:".indexOf(e)&&"sjcl"==t){try{this.md=new sjcl.hash.sha256}catch(t){throw"setAlgAndProvider hash alg set fail alg="+e+"/"+t}this.updateString=function(e){this.md.update(e)},this.updateHex=function(e){var t=sjcl.codec.hex.toBits(e);this.md.update(t)},this.digest=function(){var e=this.md.finalize();return sjcl.codec.hex.fromBits(e)},this.digestString=function(e){return this.updateString(e),this.digest()},this.digestHex=function(e){return this.updateHex(e),this.digest()}}},this.updateString=function(e){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(e){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestString=function(e){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(e){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},void 0!==e&&void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov&&(this.provName=he.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},he.crypto.MessageDigest.getCanonicalAlgName=function(e){return"string"==typeof e&&(e=(e=e.toLowerCase()).replace(/-/,"")),e},he.crypto.MessageDigest.getHashLength=function(e){var t=he.crypto.MessageDigest,n=t.getCanonicalAlgName(e);if(void 0===t.HASHLENGTH[n])throw"not supported algorithm: "+e;return t.HASHLENGTH[n]},he.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20},he.crypto.Mac=function(e){this.setAlgAndProvider=function(e,t){if(null==(e=e.toLowerCase())&&(e="hmacsha1"),"hmac"!=(e=e.toLowerCase()).substr(0,4))throw"setAlgAndProvider unsupported HMAC alg: "+e;void 0===t&&(t=he.crypto.Util.DEFAULTPROVIDER[e]),this.algProv=e+"/"+t;var n=e.substr(4);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(n)&&"cryptojs"==t){try{var r=he.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[n];this.mac=g.algo.HMAC.create(r,this.pass)}catch(e){throw"setAlgAndProvider hash alg set fail hashAlg="+n+"/"+e}this.updateString=function(e){this.mac.update(e)},this.updateHex=function(e){var t=g.enc.Hex.parse(e);this.mac.update(t)},this.doFinal=function(){return this.mac.finalize().toString(g.enc.Hex)},this.doFinalString=function(e){return this.updateString(e),this.doFinal()},this.doFinalHex=function(e){return this.updateHex(e),this.doFinal()}}},this.updateString=function(e){throw"updateString(str) not supported for this alg/prov: "+this.algProv},this.updateHex=function(e){throw"updateHex(hex) not supported for this alg/prov: "+this.algProv},this.doFinal=function(){throw"digest() not supported for this alg/prov: "+this.algProv},this.doFinalString=function(e){throw"digestString(str) not supported for this alg/prov: "+this.algProv},this.doFinalHex=function(e){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv},this.setPassword=function(e){if("string"==typeof e){var t=e;return e.length%2!=1&&e.match(/^[0-9A-Fa-f]+$/)||(t=Ce(e)),void(this.pass=g.enc.Hex.parse(t))}if("object"!=typeof e)throw"KJUR.crypto.Mac unsupported password type: "+e;t=null;if(void 0!==e.hex){if(e.hex.length%2!=0||!e.hex.match(/^[0-9A-Fa-f]+$/))throw"Mac: wrong hex password: "+e.hex;t=e.hex}if(void 0!==e.utf8&&(t=Ee(e.utf8)),void 0!==e.rstr&&(t=Ce(e.rstr)),void 0!==e.b64&&(t=w(e.b64)),void 0!==e.b64u&&(t=Se(e.b64u)),null==t)throw"KJUR.crypto.Mac unsupported password type: "+e;this.pass=g.enc.Hex.parse(t)},void 0!==e&&(void 0!==e.pass&&this.setPassword(e.pass),void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov&&(this.provName=he.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))},he.crypto.Signature=function(e){var t=null;if(this._setAlgNames=function(){var e=this.algName.match(/^(.+)with(.+)$/);e&&(this.mdAlgName=e[1].toLowerCase(),this.pubkeyAlgName=e[2].toLowerCase(),"rsaandmgf1"==this.pubkeyAlgName&&"sha"==this.mdAlgName&&(this.mdAlgName="sha1"))},this._zeroPaddingOfSignature=function(e,t){for(var n="",r=t/4-e.length,i=0;i<r;i++)n+="0";return n+e},this.setAlgAndProvider=function(e,t){if(this._setAlgNames(),"cryptojs/jsrsa"!=t)throw new Error("provider not supported: "+t);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)){try{this.md=new he.crypto.MessageDigest({alg:this.mdAlgName})}catch(e){throw new Error("setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+e)}this.init=function(e,t){var n=null;try{n=void 0===t?Ye.getKey(e):Ye.getKey(e,t)}catch(e){throw"init failed:"+e}if(!0===n.isPrivate)this.prvKey=n,this.state="SIGN";else{if(!0!==n.isPublic)throw"init failed.:"+n;this.pubKey=n,this.state="VERIFY"}},this.updateString=function(e){this.md.updateString(e)},this.updateHex=function(e){this.md.updateHex(e)},this.sign=function(){if(this.sHashHex=this.md.digest(),void 0===this.prvKey&&void 0!==this.ecprvhex&&void 0!==this.eccurvename&&void 0!==he.crypto.ECDSA&&(this.prvKey=new he.crypto.ECDSA({curve:this.eccurvename,prv:this.ecprvhex})),this.prvKey instanceof ae&&"rsaandmgf1"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof ae&&"rsa"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof he.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else{if(!(this.prvKey instanceof he.crypto.DSA))throw"Signature: unsupported private key alg: "+this.pubkeyAlgName;this.hSign=this.prvKey.signWithMessageHash(this.sHashHex)}return this.hSign},this.signString=function(e){return this.updateString(e),this.sign()},this.signHex=function(e){return this.updateHex(e),this.sign()},this.verify=function(e){if(this.sHashHex=this.md.digest(),void 0===this.pubKey&&void 0!==this.ecpubhex&&void 0!==this.eccurvename&&void 0!==he.crypto.ECDSA&&(this.pubKey=new he.crypto.ECDSA({curve:this.eccurvename,pub:this.ecpubhex})),this.pubKey instanceof ae&&"rsaandmgf1"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,e,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof ae&&"rsa"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);if(void 0!==he.crypto.ECDSA&&this.pubKey instanceof he.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);if(void 0!==he.crypto.DSA&&this.pubKey instanceof he.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(e,t){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.updateString=function(e){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(e){throw"updateHex(hex) not supported for this alg:prov="+this.algProvName},this.sign=function(){throw"sign() not supported for this alg:prov="+this.algProvName},this.signString=function(e){throw"digestString(str) not supported for this alg:prov="+this.algProvName},this.signHex=function(e){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(e){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=e,void 0!==e&&(void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov?this.provName=he.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=e.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),void 0!==e.psssaltlen&&(this.pssSaltLen=e.psssaltlen),void 0!==e.prvkeypem)){if(void 0!==e.prvkeypas)throw"both prvkeypem and prvkeypas parameters not supported";try{t=Ye.getKey(e.prvkeypem);this.init(t)}catch(e){throw"fatal error to load pem private key: "+e}}},he.crypto.Cipher=function(e){},he.crypto.Cipher.encrypt=function(e,t,n){if(t instanceof ae&&t.isPublic){var r=he.crypto.Cipher.getAlgByKeyAndName(t,n);if("RSA"===r)return t.encrypt(e);if("RSAOAEP"===r)return t.encryptOAEP(e,"sha1");var i=r.match(/^RSAOAEP(\d+)$/);if(null!==i)return t.encryptOAEP(e,"sha"+i[1]);throw"Cipher.encrypt: unsupported algorithm for RSAKey: "+n}throw"Cipher.encrypt: unsupported key or algorithm"},he.crypto.Cipher.decrypt=function(e,t,n){if(t instanceof ae&&t.isPrivate){var r=he.crypto.Cipher.getAlgByKeyAndName(t,n);if("RSA"===r)return t.decrypt(e);if("RSAOAEP"===r)return t.decryptOAEP(e,"sha1");var i=r.match(/^RSAOAEP(\d+)$/);if(null!==i)return t.decryptOAEP(e,"sha"+i[1]);throw"Cipher.decrypt: unsupported algorithm for RSAKey: "+n}throw"Cipher.decrypt: unsupported key or algorithm"},he.crypto.Cipher.getAlgByKeyAndName=function(e,t){if(e instanceof ae){if(-1!=":RSA:RSAOAEP:RSAOAEP224:RSAOAEP256:RSAOAEP384:RSAOAEP512:".indexOf(t))return t;if(null==t)return"RSA";throw"getAlgByKeyAndName: not supported algorithm name for RSAKey: "+t}throw"getAlgByKeyAndName: not supported algorithm name: "+t},he.crypto.OID=new function(){this.oidhex2name={"2a864886f70d010101":"rsaEncryption","2a8648ce3d0201":"ecPublicKey","2a8648ce380401":"dsa","2a8648ce3d030107":"secp256r1","2b8104001f":"secp192k1","2b81040021":"secp224r1","2b8104000a":"secp256k1","2b81040023":"secp521r1","2b81040022":"secp384r1","2a8648ce380403":"SHA1withDSA","608648016503040301":"SHA224withDSA","608648016503040302":"SHA256withDSA"}},void 0!==he&&he||(he={}),void 0!==he.crypto&&he.crypto||(he.crypto={}),he.crypto.ECDSA=function(e){var t=Error,n=S,r=ue,i=he.crypto.ECDSA,a=he.crypto.ECParameterDB,s=i.getName,o=pe,u=o.getVbyListEx,c=o.isASN1HEX,l=new ne;this.type="EC",this.isPrivate=!1,this.isPublic=!1,this.getBigRandom=function(e){return new n(e.bitLength(),l).mod(e.subtract(n.ONE)).add(n.ONE)},this.setNamedCurve=function(e){this.ecparams=a.getByName(e),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=e},this.setPrivateKeyHex=function(e){this.isPrivate=!0,this.prvKeyHex=e},this.setPublicKeyHex=function(e){this.isPublic=!0,this.pubKeyHex=e},this.getPublicKeyXYHex=function(){var e=this.pubKeyHex;if("04"!==e.substr(0,2))throw"this method supports uncompressed format(04) only";var t=this.ecparams.keylen/4;if(e.length!==2+2*t)throw"malformed public key hex length";var n={};return n.x=e.substr(2,t),n.y=e.substr(2+t),n},this.getShortNISTPCurveName=function(){var e=this.curveName;return"secp256r1"===e||"NIST P-256"===e||"P-256"===e||"prime256v1"===e?"P-256":"secp384r1"===e||"NIST P-384"===e||"P-384"===e?"P-384":null},this.generateKeyPairHex=function(){var e=this.ecparams.n,t=this.getBigRandom(e),n=this.ecparams.G.multiply(t),r=n.getX().toBigInteger(),i=n.getY().toBigInteger(),a=this.ecparams.keylen/4,s=("0000000000"+t.toString(16)).slice(-a),o="04"+("0000000000"+r.toString(16)).slice(-a)+("0000000000"+i.toString(16)).slice(-a);return this.setPrivateKeyHex(s),this.setPublicKeyHex(o),{ecprvhex:s,ecpubhex:o}},this.signWithMessageHash=function(e){return this.signHex(e,this.prvKeyHex)},this.signHex=function(e,t){var r=new n(t,16),a=this.ecparams.n,s=new n(e.substring(0,this.ecparams.keylen/4),16);do{var o=this.getBigRandom(a),u=this.ecparams.G.multiply(o).getX().toBigInteger().mod(a)}while(u.compareTo(n.ZERO)<=0);var c=o.modInverse(a).multiply(s.add(r.multiply(u))).mod(a);return i.biRSSigToASN1Sig(u,c)},this.sign=function(e,t){var r=t,i=this.ecparams.n,a=n.fromByteArrayUnsigned(e);do{var s=this.getBigRandom(i),o=this.ecparams.G.multiply(s).getX().toBigInteger().mod(i)}while(o.compareTo(S.ZERO)<=0);var u=s.modInverse(i).multiply(a.add(r.multiply(o))).mod(i);return this.serializeSig(o,u)},this.verifyWithMessageHash=function(e,t){return this.verifyHex(e,t,this.pubKeyHex)},this.verifyHex=function(e,t,a){try{var s,o,u=i.parseSigHex(t);s=u.r,o=u.s;var c=r.decodeFromHex(this.ecparams.curve,a),l=new n(e.substring(0,this.ecparams.keylen/4),16);return this.verifyRaw(l,s,o,c)}catch(e){return!1}},this.verify=function(e,t,i){var a,s,o;if(Bitcoin.Util.isArray(t)){var u=this.parseSig(t);a=u.r,s=u.s}else{if("object"!=typeof t||!t.r||!t.s)throw"Invalid value for signature";a=t.r,s=t.s}if(i instanceof ue)o=i;else{if(!Bitcoin.Util.isArray(i))throw"Invalid format for pubkey value, must be byte array or ECPointFp";o=r.decodeFrom(this.ecparams.curve,i)}var c=n.fromByteArrayUnsigned(e);return this.verifyRaw(c,a,s,o)},this.verifyRaw=function(e,t,r,i){var a=this.ecparams.n,s=this.ecparams.G;if(t.compareTo(n.ONE)<0||t.compareTo(a)>=0)return!1;if(r.compareTo(n.ONE)<0||r.compareTo(a)>=0)return!1;var o=r.modInverse(a),u=e.multiply(o).mod(a),c=t.multiply(o).mod(a);return s.multiply(u).add(i.multiply(c)).getX().toBigInteger().mod(a).equals(t)},this.serializeSig=function(e,t){var n=e.toByteArraySigned(),r=t.toByteArraySigned(),i=[];return i.push(2),i.push(n.length),(i=i.concat(n)).push(2),i.push(r.length),(i=i.concat(r)).unshift(i.length),i.unshift(48),i},this.parseSig=function(e){var t;if(48!=e[0])throw new Error("Signature not a valid DERSequence");if(2!=e[t=2])throw new Error("First element in signature must be a DERInteger");var r=e.slice(t+2,t+2+e[t+1]);if(2!=e[t+=2+e[t+1]])throw new Error("Second element in signature must be a DERInteger");var i=e.slice(t+2,t+2+e[t+1]);return t+=2+e[t+1],{r:n.fromByteArrayUnsigned(r),s:n.fromByteArrayUnsigned(i)}},this.parseSigCompact=function(e){if(65!==e.length)throw"Signature has the wrong length";var t=e[0]-27;if(t<0||t>7)throw"Invalid signature type";var r=this.ecparams.n;return{r:n.fromByteArrayUnsigned(e.slice(1,33)).mod(r),s:n.fromByteArrayUnsigned(e.slice(33,65)).mod(r),i:t}},this.readPKCS5PrvKeyHex=function(e){if(!1===c(e))throw new Error("not ASN.1 hex string");var t,n,r;try{t=u(e,0,["[0]",0],"06"),n=u(e,0,[1],"04");try{r=u(e,0,["[1]",0],"03")}catch(e){}}catch(e){throw new Error("malformed PKCS#1/5 plain ECC private key")}if(this.curveName=s(t),void 0===this.curveName)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(r),this.setPrivateKeyHex(n),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(e){if(!1===c(e))throw new t("not ASN.1 hex string");var n,r,i;try{u(e,0,[1,0],"06"),n=u(e,0,[1,1],"06"),r=u(e,0,[2,0,1],"04");try{i=u(e,0,[2,0,"[1]",0],"03")}catch(e){}}catch(e){throw new t("malformed PKCS#8 plain ECC private key")}if(this.curveName=s(n),void 0===this.curveName)throw new t("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i),this.setPrivateKeyHex(r),this.isPublic=!1},this.readPKCS8PubKeyHex=function(e){if(!1===c(e))throw new t("not ASN.1 hex string");var n,r;try{u(e,0,[0,0],"06"),n=u(e,0,[0,1],"06"),r=u(e,0,[1],"03")}catch(e){throw new t("malformed PKCS#8 ECC public key")}if(this.curveName=s(n),null===this.curveName)throw new t("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(r)},this.readCertPubKeyHex=function(e,n){if(!1===c(e))throw new t("not ASN.1 hex string");var r,i;try{r=u(e,0,[0,5,0,1],"06"),i=u(e,0,[0,5,1],"03")}catch(e){throw new t("malformed X.509 certificate ECC public key")}if(this.curveName=s(r),null===this.curveName)throw new t("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i)},void 0!==e&&void 0!==e.curve&&(this.curveName=e.curve),void 0===this.curveName&&(this.curveName="secp256r1"),this.setNamedCurve(this.curveName),void 0!==e&&(void 0!==e.prv&&this.setPrivateKeyHex(e.prv),void 0!==e.pub&&this.setPublicKeyHex(e.pub))},he.crypto.ECDSA.parseSigHex=function(e){var t=he.crypto.ECDSA.parseSigHexInHexRS(e);return{r:new S(t.r,16),s:new S(t.s,16)}},he.crypto.ECDSA.parseSigHexInHexRS=function(e){var t=pe,n=t.getChildIdx,r=t.getV;if(t.checkStrictDER(e,0),"30"!=e.substr(0,2))throw new Error("signature is not a ASN.1 sequence");var i=n(e,0);if(2!=i.length)throw new Error("signature shall have two elements");var a=i[0],s=i[1];if("02"!=e.substr(a,2))throw new Error("1st item not ASN.1 integer");if("02"!=e.substr(s,2))throw new Error("2nd item not ASN.1 integer");return{r:r(e,a),s:r(e,s)}},he.crypto.ECDSA.asn1SigToConcatSig=function(e){var t=he.crypto.ECDSA.parseSigHexInHexRS(e),n=t.r,r=t.s;if("00"==n.substr(0,2)&&n.length%32==2&&(n=n.substr(2)),"00"==r.substr(0,2)&&r.length%32==2&&(r=r.substr(2)),n.length%32==30&&(n="00"+n),r.length%32==30&&(r="00"+r),n.length%32!=0)throw"unknown ECDSA sig r length error";if(r.length%32!=0)throw"unknown ECDSA sig s length error";return n+r},he.crypto.ECDSA.concatSigToASN1Sig=function(e){if(e.length/2*8%128!=0)throw"unknown ECDSA concatinated r-s sig length error";var t=e.substr(0,e.length/2),n=e.substr(e.length/2);return he.crypto.ECDSA.hexRSSigToASN1Sig(t,n)},he.crypto.ECDSA.hexRSSigToASN1Sig=function(e,t){var n=new S(e,16),r=new S(t,16);return he.crypto.ECDSA.biRSSigToASN1Sig(n,r)},he.crypto.ECDSA.biRSSigToASN1Sig=function(e,t){var n=he.asn1,r=new n.DERInteger({bigint:e}),i=new n.DERInteger({bigint:t});return new n.DERSequence({array:[r,i]}).getEncodedHex()},he.crypto.ECDSA.getName=function(e){return"2b8104001f"===e?"secp192k1":"2a8648ce3d030107"===e?"secp256r1":"2b8104000a"===e?"secp256k1":"2b81040021"===e?"secp224r1":"2b81040022"===e?"secp384r1":-1!=="|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(e)?"secp256r1":-1!=="|secp256k1|".indexOf(e)?"secp256k1":-1!=="|secp224r1|NIST P-224|P-224|".indexOf(e)?"secp224r1":-1!=="|secp384r1|NIST P-384|P-384|".indexOf(e)?"secp384r1":null},void 0!==he&&he||(he={}),void 0!==he.crypto&&he.crypto||(he.crypto={}),he.crypto.ECParameterDB=new function(){var e={},t={};function n(e){return new S(e,16)}this.getByName=function(n){var r=n;if(void 0!==t[r]&&(r=t[n]),void 0!==e[r])return e[r];throw"unregistered EC curve name: "+r},this.regist=function(r,i,a,s,o,u,c,l,h,f,d,p){e[r]={};var g=n(a),m=n(s),v=n(o),y=n(u),b=n(c),w=new ce(g,m,v),x=w.decodePointHex("04"+l+h);e[r].name=r,e[r].keylen=i,e[r].curve=w,e[r].G=x,e[r].n=y,e[r].h=b,e[r].oid=d,e[r].info=p;for(var S=0;S<f.length;S++)t[f[S]]=r}},he.crypto.ECParameterDB.regist("secp128r1",128,"FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC","E87579C11079F43DD824993C2CEE5ED3","FFFFFFFE0000000075A30D1B9038A115","1","161FF7528B899B2D0C28607CA52C5B86","CF5AC8395BAFEB13C02DA292DDED7A83",[],"","secp128r1 : SECG curve over a 128 bit prime field"),he.crypto.ECParameterDB.regist("secp160k1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73","0","7","0100000000000000000001B8FA16DFAB9ACA16B6B3","1","3B4C382CE37AA192A4019E763036F4F5DD4D7EBB","938CF935318FDCED6BC28286531733C3F03C4FEE",[],"","secp160k1 : SECG curve over a 160 bit prime field"),he.crypto.ECParameterDB.regist("secp160r1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC","1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45","0100000000000000000001F4C8F927AED3CA752257","1","4A96B5688EF573284664698968C38BB913CBFC82","23A628553168947D59DCC912042351377AC5FB32",[],"","secp160r1 : SECG curve over a 160 bit prime field"),he.crypto.ECParameterDB.regist("secp192k1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37","0","3","FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D","1","DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D","9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D",[]),he.crypto.ECParameterDB.regist("secp192r1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC","64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1","FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831","1","188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012","07192B95FFC8DA78631011ED6B24CDD573F977A11E794811",[]),he.crypto.ECParameterDB.regist("secp224r1",224,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE","B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4","FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D","1","B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21","BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34",[]),he.crypto.ECParameterDB.regist("secp256k1",256,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","0","7","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","1","79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8",[]),he.crypto.ECParameterDB.regist("secp256r1",256,"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC","5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B","FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551","1","6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296","4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5",["NIST P-256","P-256","prime256v1"]),he.crypto.ECParameterDB.regist("secp384r1",384,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC","B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973","1","AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7","3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f",["NIST P-384","P-384"]),he.crypto.ECParameterDB.regist("secp521r1",521,"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC","051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409","1","C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66","011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650",["NIST P-521","P-521"]),void 0!==he&&he||(he={}),void 0!==he.crypto&&he.crypto||(he.crypto={}),he.crypto.DSA=function(){var e=pe,t=(e.getVbyList,e.getVbyListEx),n=e.isASN1HEX,r=S;this.p=null,this.q=null,this.g=null,this.y=null,this.x=null,this.type="DSA",this.isPrivate=!1,this.isPublic=!1,this.setPrivate=function(e,t,n,r,i){this.isPrivate=!0,this.p=e,this.q=t,this.g=n,this.y=r,this.x=i},this.setPrivateHex=function(e,t,n,r,i){var a,s,o,u,c;a=new S(e,16),s=new S(t,16),o=new S(n,16),u="string"==typeof r&&r.length>1?new S(r,16):null,c=new S(i,16),this.setPrivate(a,s,o,u,c)},this.setPublic=function(e,t,n,r){this.isPublic=!0,this.p=e,this.q=t,this.g=n,this.y=r,this.x=null},this.setPublicHex=function(e,t,n,r){var i,a,s,o;i=new S(e,16),a=new S(t,16),s=new S(n,16),o=new S(r,16),this.setPublic(i,a,s,o)},this.signWithMessageHash=function(e){var t=this.p,n=this.q,r=this.g,i=(this.y,this.x),a=he.crypto.Util.getRandomBigIntegerMinToMax(S.ONE.add(S.ONE),n.subtract(S.ONE)),s=new S(e.substr(0,n.bitLength()/4),16),o=r.modPow(a,t).mod(n),u=a.modInverse(n).multiply(s.add(i.multiply(o))).mod(n);return he.asn1.ASN1Util.jsonToASN1HEX({seq:[{int:{bigint:o}},{int:{bigint:u}}]})},this.verifyWithMessageHash=function(e,t){var n=this.p,r=this.q,i=this.g,a=this.y,s=this.parseASN1Signature(t),o=s[0],u=s[1],c=new S(e.substr(0,r.bitLength()/4),16);if(S.ZERO.compareTo(o)>0||o.compareTo(r)>0)throw"invalid DSA signature";if(S.ZERO.compareTo(u)>=0||u.compareTo(r)>0)throw"invalid DSA signature";var l=u.modInverse(r),h=c.multiply(l).mod(r),f=o.multiply(l).mod(r);return 0==i.modPow(h,n).multiply(a.modPow(f,n)).mod(n).mod(r).compareTo(o)},this.parseASN1Signature=function(e){try{return[new r(t(e,0,[0],"02"),16),new r(t(e,0,[1],"02"),16)]}catch(e){throw new Error("malformed ASN.1 DSA signature")}},this.readPKCS5PrvKeyHex=function(e){var r,i,a,s,o;if(!1===n(e))throw new Error("not ASN.1 hex string");try{r=t(e,0,[1],"02"),i=t(e,0,[2],"02"),a=t(e,0,[3],"02"),s=t(e,0,[4],"02"),o=t(e,0,[5],"02")}catch(e){throw new Error("malformed PKCS#1/5 plain DSA private key")}this.setPrivateHex(r,i,a,s,o)},this.readPKCS8PrvKeyHex=function(e){var r,i,a,s;if(!1===n(e))throw new Error("not ASN.1 hex string");try{r=t(e,0,[1,1,0],"02"),i=t(e,0,[1,1,1],"02"),a=t(e,0,[1,1,2],"02"),s=t(e,0,[2,0],"02")}catch(e){throw new Error("malformed PKCS#8 plain DSA private key")}this.setPrivateHex(r,i,a,null,s)},this.readPKCS8PubKeyHex=function(e){var r,i,a,s;if(!1===n(e))throw new Error("not ASN.1 hex string");try{r=t(e,0,[0,1,0],"02"),i=t(e,0,[0,1,1],"02"),a=t(e,0,[0,1,2],"02"),s=t(e,0,[1,0],"02")}catch(e){throw new Error("malformed PKCS#8 DSA public key")}this.setPublicHex(r,i,a,s)},this.readCertPubKeyHex=function(e,r){var i,a,s,o;if(!1===n(e))throw new Error("not ASN.1 hex string");try{i=t(e,0,[0,5,0,1,0],"02"),a=t(e,0,[0,5,0,1,1],"02"),s=t(e,0,[0,5,0,1,2],"02"),o=t(e,0,[0,5,1,0],"02")}catch(e){throw new Error("malformed X.509 certificate DSA public key")}this.setPublicHex(i,a,s,o)}};var Ye=function(){var e=function(e,n,r){return t(g.AES,e,n,r)},t=function(e,t,n,r){var i=g.enc.Hex.parse(t),a=g.enc.Hex.parse(n),s=g.enc.Hex.parse(r),o={};o.key=a,o.iv=s,o.ciphertext=i;var u=e.decrypt(o,a,{iv:s});return g.enc.Hex.stringify(u)},n=function(e,t,n){return r(g.AES,e,t,n)},r=function(e,t,n,r){var i=g.enc.Hex.parse(t),a=g.enc.Hex.parse(n),s=g.enc.Hex.parse(r),o=e.encrypt(i,a,{iv:s}),u=g.enc.Hex.parse(o.toString());return g.enc.Base64.stringify(u)},i={"AES-256-CBC":{proc:e,eproc:n,keylen:32,ivlen:16},"AES-192-CBC":{proc:e,eproc:n,keylen:24,ivlen:16},"AES-128-CBC":{proc:e,eproc:n,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:function(e,n,r){return t(g.TripleDES,e,n,r)},eproc:function(e,t,n){return r(g.TripleDES,e,t,n)},keylen:24,ivlen:8},"DES-CBC":{proc:function(e,n,r){return t(g.DES,e,n,r)},eproc:function(e,t,n){return r(g.DES,e,t,n)},keylen:8,ivlen:8}},a=function(e){var t={},n=e.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));n&&(t.cipher=n[1],t.ivsalt=n[2]);var r=e.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));r&&(t.type=r[1]);var i=-1,a=0;-1!=e.indexOf("\r\n\r\n")&&(i=e.indexOf("\r\n\r\n"),a=2),-1!=e.indexOf("\n\n")&&(i=e.indexOf("\n\n"),a=1);var s=e.indexOf("-----END");if(-1!=i&&-1!=s){var o=e.substring(i+2*a,s-a);o=o.replace(/\s+/g,""),t.data=o}return t},s=function(e,t,n){for(var r=n.substring(0,16),a=g.enc.Hex.parse(r),s=g.enc.Utf8.parse(t),o=i[e].keylen+i[e].ivlen,u="",c=null;;){var l=g.algo.MD5.create();if(null!=c&&l.update(c),l.update(s),l.update(a),c=l.finalize(),(u+=g.enc.Hex.stringify(c)).length>=2*o)break}var h={};return h.keyhex=u.substr(0,2*i[e].keylen),h.ivhex=u.substr(2*i[e].keylen,2*i[e].ivlen),h},o=function(e,t,n,r){var a=g.enc.Base64.parse(e),s=g.enc.Hex.stringify(a);return(0,i[t].proc)(s,n,r)};return{version:"1.0.0",parsePKCS5PEM:function(e){return a(e)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(e,t,n){return s(e,t,n)},decryptKeyB64:function(e,t,n,r){return o(e,t,n,r)},getDecryptedKeyHex:function(e,t){var n=a(e),r=(n.type,n.cipher),i=n.ivsalt,u=n.data,c=s(r,t,i).keyhex;return o(u,r,c,i)},getEncryptedPKCS5PEMFromPrvKeyHex:function(e,t,n,r,a){var o="";if(void 0!==r&&null!=r||(r="AES-256-CBC"),void 0===i[r])throw new Error("KEYUTIL unsupported algorithm: "+r);void 0!==a&&null!=a||(a=function(e){var t=g.lib.WordArray.random(e);return g.enc.Hex.stringify(t)}(i[r].ivlen).toUpperCase());var u=function(e,t,n,r){return(0,i[t].eproc)(e,n,r)}(t,r,s(r,n,a).keyhex,a);o="-----BEGIN "+e+" PRIVATE KEY-----\r\n";return o+="Proc-Type: 4,ENCRYPTED\r\n",o+="DEK-Info: "+r+","+a+"\r\n",o+="\r\n",o+=u.replace(/(.{64})/g,"$1\r\n"),o+="\r\n-----END "+e+" PRIVATE KEY-----\r\n"},parseHexOfEncryptedPKCS8:function(e){var t=pe,n=t.getChildIdx,r=t.getV,i={},a=n(e,0);if(2!=a.length)throw new Error("malformed format: SEQUENCE(0).items != 2: "+a.length);i.ciphertext=r(e,a[1]);var s=n(e,a[0]);if(2!=s.length)throw new Error("malformed format: SEQUENCE(0.0).items != 2: "+s.length);if("2a864886f70d01050d"!=r(e,s[0]))throw new Error("this only supports pkcs5PBES2");var o=n(e,s[1]);if(2!=s.length)throw new Error("malformed format: SEQUENCE(0.0.1).items != 2: "+o.length);var u=n(e,o[1]);if(2!=u.length)throw new Error("malformed format: SEQUENCE(0.0.1.1).items != 2: "+u.length);if("2a864886f70d0307"!=r(e,u[0]))throw"this only supports TripleDES";i.encryptionSchemeAlg="TripleDES",i.encryptionSchemeIV=r(e,u[1]);var c=n(e,o[0]);if(2!=c.length)throw new Error("malformed format: SEQUENCE(0.0.1.0).items != 2: "+c.length);if("2a864886f70d01050c"!=r(e,c[0]))throw new Error("this only supports pkcs5PBKDF2");var l=n(e,c[1]);if(l.length<2)throw new Error("malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+l.length);i.pbkdf2Salt=r(e,l[0]);var h=r(e,l[1]);try{i.pbkdf2Iter=parseInt(h,16)}catch(e){throw new Error("malformed format pbkdf2Iter: "+h)}return i},getPBKDF2KeyHexFromParam:function(e,t){var n=g.enc.Hex.parse(e.pbkdf2Salt),r=e.pbkdf2Iter,i=g.PBKDF2(t,n,{keySize:6,iterations:r});return g.enc.Hex.stringify(i)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(e,t){var n=$e(e,"ENCRYPTED PRIVATE KEY"),r=this.parseHexOfEncryptedPKCS8(n),i=Ye.getPBKDF2KeyHexFromParam(r,t),a={};a.ciphertext=g.enc.Hex.parse(r.ciphertext);var s=g.enc.Hex.parse(i),o=g.enc.Hex.parse(r.encryptionSchemeIV),u=g.TripleDES.decrypt(a,s,{iv:o});return g.enc.Hex.stringify(u)},getKeyFromEncryptedPKCS8PEM:function(e,t){var n=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(e,t);return this.getKeyFromPlainPrivatePKCS8Hex(n)},parsePlainPrivatePKCS8Hex:function(e){var t=pe,n=t.getChildIdx,r=t.getV,i={algparam:null};if("30"!=e.substr(0,2))throw new Error("malformed plain PKCS8 private key(code:001)");var a=n(e,0);if(a.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if("30"!=e.substr(a[1],2))throw new Error("malformed PKCS8 private key(code:003)");var s=n(e,a[1]);if(2!=s.length)throw new Error("malformed PKCS8 private key(code:004)");if("06"!=e.substr(s[0],2))throw new Error("malformed PKCS8 private key(code:005)");if(i.algoid=r(e,s[0]),"06"==e.substr(s[1],2)&&(i.algparam=r(e,s[1])),"04"!=e.substr(a[2],2))throw new Error("malformed PKCS8 private key(code:006)");return i.keyidx=t.getVidx(e,a[2]),i},getKeyFromPlainPrivatePKCS8PEM:function(e){var t=$e(e,"PRIVATE KEY");return this.getKeyFromPlainPrivatePKCS8Hex(t)},getKeyFromPlainPrivatePKCS8Hex:function(e){var t,n=this.parsePlainPrivatePKCS8Hex(e);if("2a864886f70d010101"==n.algoid)t=new ae;else if("2a8648ce380401"==n.algoid)t=new he.crypto.DSA;else{if("2a8648ce3d0201"!=n.algoid)throw new Error("unsupported private key algorithm");t=new he.crypto.ECDSA}return t.readPKCS8PrvKeyHex(e),t},_getKeyFromPublicPKCS8Hex:function(e){var t,n=pe.getVbyList(e,0,[0,0],"06");if("2a864886f70d010101"===n)t=new ae;else if("2a8648ce380401"===n)t=new he.crypto.DSA;else{if("2a8648ce3d0201"!==n)throw new Error("unsupported PKCS#8 public key hex");t=new he.crypto.ECDSA}return t.readPKCS8PubKeyHex(e),t},parsePublicRawRSAKeyHex:function(e){var t=pe,n=t.getChildIdx,r=t.getV,i={};if("30"!=e.substr(0,2))throw new Error("malformed RSA key(code:001)");var a=n(e,0);if(2!=a.length)throw new Error("malformed RSA key(code:002)");if("02"!=e.substr(a[0],2))throw new Error("malformed RSA key(code:003)");if(i.n=r(e,a[0]),"02"!=e.substr(a[1],2))throw new Error("malformed RSA key(code:004)");return i.e=r(e,a[1]),i},parsePublicPKCS8Hex:function(e){var t=pe,n=t.getChildIdx,r=t.getV,i={algparam:null},a=n(e,0);if(2!=a.length)throw new Error("outer DERSequence shall have 2 elements: "+a.length);var s=a[0];if("30"!=e.substr(s,2))throw new Error("malformed PKCS8 public key(code:001)");var o=n(e,s);if(2!=o.length)throw new Error("malformed PKCS8 public key(code:002)");if("06"!=e.substr(o[0],2))throw new Error("malformed PKCS8 public key(code:003)");if(i.algoid=r(e,o[0]),"06"==e.substr(o[1],2)?i.algparam=r(e,o[1]):"30"==e.substr(o[1],2)&&(i.algparam={},i.algparam.p=t.getVbyList(e,o[1],[0],"02"),i.algparam.q=t.getVbyList(e,o[1],[1],"02"),i.algparam.g=t.getVbyList(e,o[1],[2],"02")),"03"!=e.substr(a[1],2))throw new Error("malformed PKCS8 public key(code:004)");return i.key=r(e,a[1]).substr(2),i}}}();Ye.getKey=function(e,t,n){var r=(m=pe).getChildIdx,i=(m.getV,m.getVbyList),a=he.crypto,s=a.ECDSA,o=a.DSA,u=ae,c=$e,l=Ye;if(void 0!==u&&e instanceof u)return e;if(void 0!==s&&e instanceof s)return e;if(void 0!==o&&e instanceof o)return e;if(void 0!==e.curve&&void 0!==e.xy&&void 0===e.d)return new s({pub:e.xy,curve:e.curve});if(void 0!==e.curve&&void 0!==e.d)return new s({prv:e.d,curve:e.curve});if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0===e.d)return(R=new u).setPublic(e.n,e.e),R;if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0!==e.p&&void 0!==e.q&&void 0!==e.dp&&void 0!==e.dq&&void 0!==e.co&&void 0===e.qi)return(R=new u).setPrivateEx(e.n,e.e,e.d,e.p,e.q,e.dp,e.dq,e.co),R;if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0===e.p)return(R=new u).setPrivate(e.n,e.e,e.d),R;if(void 0!==e.p&&void 0!==e.q&&void 0!==e.g&&void 0!==e.y&&void 0===e.x)return(R=new o).setPublic(e.p,e.q,e.g,e.y),R;if(void 0!==e.p&&void 0!==e.q&&void 0!==e.g&&void 0!==e.y&&void 0!==e.x)return(R=new o).setPrivate(e.p,e.q,e.g,e.y,e.x),R;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0===e.d)return(R=new u).setPublic(Se(e.n),Se(e.e)),R;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0!==e.p&&void 0!==e.q&&void 0!==e.dp&&void 0!==e.dq&&void 0!==e.qi)return(R=new u).setPrivateEx(Se(e.n),Se(e.e),Se(e.d),Se(e.p),Se(e.q),Se(e.dp),Se(e.dq),Se(e.qi)),R;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d)return(R=new u).setPrivate(Se(e.n),Se(e.e),Se(e.d)),R;if("EC"===e.kty&&void 0!==e.crv&&void 0!==e.x&&void 0!==e.y&&void 0===e.d){var h=(D=new s({curve:e.crv})).ecparams.keylen/4,f="04"+("0000000000"+Se(e.x)).slice(-h)+("0000000000"+Se(e.y)).slice(-h);return D.setPublicKeyHex(f),D}if("EC"===e.kty&&void 0!==e.crv&&void 0!==e.x&&void 0!==e.y&&void 0!==e.d){h=(D=new s({curve:e.crv})).ecparams.keylen/4,f="04"+("0000000000"+Se(e.x)).slice(-h)+("0000000000"+Se(e.y)).slice(-h);var d=("0000000000"+Se(e.d)).slice(-h);return D.setPublicKeyHex(f),D.setPrivateKeyHex(d),D}if("pkcs5prv"===n){var p,g=e,m=pe;if(9===(p=r(g,0)).length)(R=new u).readPKCS5PrvKeyHex(g);else if(6===p.length)(R=new o).readPKCS5PrvKeyHex(g);else{if(!(p.length>2&&"04"===g.substr(p[1],2)))throw new Error("unsupported PKCS#1/5 hexadecimal key");(R=new s).readPKCS5PrvKeyHex(g)}return R}if("pkcs8prv"===n)return R=l.getKeyFromPlainPrivatePKCS8Hex(e);if("pkcs8pub"===n)return l._getKeyFromPublicPKCS8Hex(e);if("x509pub"===n)return Ze.getPublicKeyFromCertHex(e);if(-1!=e.indexOf("-END CERTIFICATE-",0)||-1!=e.indexOf("-END X509 CERTIFICATE-",0)||-1!=e.indexOf("-END TRUSTED CERTIFICATE-",0))return Ze.getPublicKeyFromCertPEM(e);if(-1!=e.indexOf("-END PUBLIC KEY-")){var v=$e(e,"PUBLIC KEY");return l._getKeyFromPublicPKCS8Hex(v)}if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var y=c(e,"RSA PRIVATE KEY");return l.getKey(y,null,"pkcs5prv")}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var b=i($=c(e,"DSA PRIVATE KEY"),0,[1],"02"),w=i($,0,[2],"02"),x=i($,0,[3],"02"),E=i($,0,[4],"02"),A=i($,0,[5],"02");return(R=new o).setPrivate(new S(b,16),new S(w,16),new S(x,16),new S(E,16),new S(A,16)),R}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){y=c(e,"EC PRIVATE KEY");return l.getKey(y,null,"pkcs5prv")}if(-1!=e.indexOf("-END PRIVATE KEY-"))return l.getKeyFromPlainPrivatePKCS8PEM(e);if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var F=l.getDecryptedKeyHex(e,t),C=new ae;return C.readPKCS5PrvKeyHex(F),C}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var D,R=i($=l.getDecryptedKeyHex(e,t),0,[1],"04"),I=i($,0,[2,0],"06"),T=i($,0,[3,0],"03").substr(2);if(void 0===he.crypto.OID.oidhex2name[I])throw new Error("undefined OID(hex) in KJUR.crypto.OID: "+I);return(D=new s({curve:he.crypto.OID.oidhex2name[I]})).setPublicKeyHex(T),D.setPrivateKeyHex(R),D.isPublic=!1,D}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var $;b=i($=l.getDecryptedKeyHex(e,t),0,[1],"02"),w=i($,0,[2],"02"),x=i($,0,[3],"02"),E=i($,0,[4],"02"),A=i($,0,[5],"02");return(R=new o).setPrivate(new S(b,16),new S(w,16),new S(x,16),new S(E,16),new S(A,16)),R}if(-1!=e.indexOf("-END ENCRYPTED PRIVATE KEY-"))return l.getKeyFromEncryptedPKCS8PEM(e,t);throw new Error("not supported argument")},Ye.generateKeypair=function(e,t){if("RSA"==e){var n=t;(s=new ae).generate(n,"10001"),s.isPrivate=!0,s.isPublic=!0;var r=new ae,i=s.n.toString(16),a=s.e.toString(16);return r.setPublic(i,a),r.isPrivate=!1,r.isPublic=!0,(o={}).prvKeyObj=s,o.pubKeyObj=r,o}if("EC"==e){var s,o,u=t,c=new he.crypto.ECDSA({curve:u}).generateKeyPairHex();return(s=new he.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),s.setPrivateKeyHex(c.ecprvhex),s.isPrivate=!0,s.isPublic=!1,(r=new he.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),r.isPrivate=!1,r.isPublic=!0,(o={}).prvKeyObj=s,o.pubKeyObj=r,o}throw new Error("unknown algorithm: "+e)},Ye.getPEM=function(e,t,n,r,i,a){var s=he,o=s.asn1,u=o.DERObjectIdentifier,c=o.DERInteger,l=o.ASN1Util.newObject,h=o.x509.SubjectPublicKeyInfo,f=s.crypto,d=f.DSA,p=f.ECDSA,m=ae;function v(e){return l({seq:[{int:0},{int:{bigint:e.n}},{int:e.e},{int:{bigint:e.d}},{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.dmp1}},{int:{bigint:e.dmq1}},{int:{bigint:e.coeff}}]})}function y(e){return l({seq:[{int:1},{octstr:{hex:e.prvKeyHex}},{tag:["a0",!0,{oid:{name:e.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]}]})}function b(e){return l({seq:[{int:0},{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}},{int:{bigint:e.y}},{int:{bigint:e.x}}]})}if((void 0!==m&&e instanceof m||void 0!==d&&e instanceof d||void 0!==p&&e instanceof p)&&1==e.isPublic&&(void 0===t||"PKCS8PUB"==t))return Te(E=new h(e).getEncodedHex(),"PUBLIC KEY");if("PKCS1PRV"==t&&void 0!==m&&e instanceof m&&(void 0===n||null==n)&&1==e.isPrivate)return Te(E=v(e).getEncodedHex(),"RSA PRIVATE KEY");if("PKCS1PRV"==t&&void 0!==p&&e instanceof p&&(void 0===n||null==n)&&1==e.isPrivate){var w=new u({name:e.curveName}).getEncodedHex(),x=y(e).getEncodedHex(),S="";return S+=Te(w,"EC PARAMETERS"),S+=Te(x,"EC PRIVATE KEY")}if("PKCS1PRV"==t&&void 0!==d&&e instanceof d&&(void 0===n||null==n)&&1==e.isPrivate)return Te(E=b(e).getEncodedHex(),"DSA PRIVATE KEY");if("PKCS5PRV"==t&&void 0!==m&&e instanceof m&&void 0!==n&&null!=n&&1==e.isPrivate){var E=v(e).getEncodedHex();return void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",E,n,r,a)}if("PKCS5PRV"==t&&void 0!==p&&e instanceof p&&void 0!==n&&null!=n&&1==e.isPrivate){E=y(e).getEncodedHex();return void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",E,n,r,a)}if("PKCS5PRV"==t&&void 0!==d&&e instanceof d&&void 0!==n&&null!=n&&1==e.isPrivate){E=b(e).getEncodedHex();return void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",E,n,r,a)}var A=function(e,t){var n=F(e,t);return new l({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:n.pbkdf2Salt}},{int:n.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:n.encryptionSchemeIV}}]}]}]},{octstr:{hex:n.ciphertext}}]}).getEncodedHex()},F=function(e,t){var n=g.lib.WordArray.random(8),r=g.lib.WordArray.random(8),i=g.PBKDF2(t,n,{keySize:6,iterations:100}),a=g.enc.Hex.parse(e),s=g.TripleDES.encrypt(a,i,{iv:r})+"",o={};return o.ciphertext=s,o.pbkdf2Salt=g.enc.Hex.stringify(n),o.pbkdf2Iter=100,o.encryptionSchemeAlg="DES-EDE3-CBC",o.encryptionSchemeIV=g.enc.Hex.stringify(r),o};if("PKCS8PRV"==t&&null!=m&&e instanceof m&&1==e.isPrivate){var C=v(e).getEncodedHex();E=l({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:C}}]}).getEncodedHex();return void 0===n||null==n?Te(E,"PRIVATE KEY"):Te(x=A(E,n),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==t&&void 0!==p&&e instanceof p&&1==e.isPrivate){C=new l({seq:[{int:1},{octstr:{hex:e.prvKeyHex}},{tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]}]}).getEncodedHex(),E=l({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:e.curveName}}]},{octstr:{hex:C}}]}).getEncodedHex();return void 0===n||null==n?Te(E,"PRIVATE KEY"):Te(x=A(E,n),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==t&&void 0!==d&&e instanceof d&&1==e.isPrivate){C=new c({bigint:e.x}).getEncodedHex(),E=l({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]}]},{octstr:{hex:C}}]}).getEncodedHex();return void 0===n||null==n?Te(E,"PRIVATE KEY"):Te(x=A(E,n),"ENCRYPTED PRIVATE KEY")}throw new Error("unsupported object nor format")},Ye.getKeyFromCSRPEM=function(e){var t=$e(e,"CERTIFICATE REQUEST");return Ye.getKeyFromCSRHex(t)},Ye.getKeyFromCSRHex=function(e){var t=Ye.parseCSRHex(e);return Ye.getKey(t.p8pubkeyhex,null,"pkcs8pub")},Ye.parseCSRHex=function(e){var t=pe,n=t.getChildIdx,r=t.getTLV,i={},a=e;if("30"!=a.substr(0,2))throw new Error("malformed CSR(code:001)");var s=n(a,0);if(s.length<1)throw new Error("malformed CSR(code:002)");if("30"!=a.substr(s[0],2))throw new Error("malformed CSR(code:003)");var o=n(a,s[0]);if(o.length<3)throw new Error("malformed CSR(code:004)");return i.p8pubkeyhex=r(a,o[2]),i},Ye.getKeyID=function(e){var t=Ye,n=pe;"string"==typeof e&&-1!=e.indexOf("BEGIN ")&&(e=t.getKey(e));var r=$e(t.getPEM(e)),i=n.getIdxbyList(r,0,[1]),a=n.getV(r,i).substring(2);return he.crypto.Util.hashHex(a,"sha1")},Ye.getJWKFromKey=function(e){var t={};if(e instanceof ae&&e.isPrivate)return t.kty="RSA",t.n=xe(e.n.toString(16)),t.e=xe(e.e.toString(16)),t.d=xe(e.d.toString(16)),t.p=xe(e.p.toString(16)),t.q=xe(e.q.toString(16)),t.dp=xe(e.dmp1.toString(16)),t.dq=xe(e.dmq1.toString(16)),t.qi=xe(e.coeff.toString(16)),t;if(e instanceof ae&&e.isPublic)return t.kty="RSA",t.n=xe(e.n.toString(16)),t.e=xe(e.e.toString(16)),t;if(e instanceof he.crypto.ECDSA&&e.isPrivate){if("P-256"!==(r=e.getShortNISTPCurveName())&&"P-384"!==r)throw new Error("unsupported curve name for JWT: "+r);var n=e.getPublicKeyXYHex();return t.kty="EC",t.crv=r,t.x=xe(n.x),t.y=xe(n.y),t.d=xe(e.prvKeyHex),t}if(e instanceof he.crypto.ECDSA&&e.isPublic){var r;if("P-256"!==(r=e.getShortNISTPCurveName())&&"P-384"!==r)throw new Error("unsupported curve name for JWT: "+r);n=e.getPublicKeyXYHex();return t.kty="EC",t.crv=r,t.x=xe(n.x),t.y=xe(n.y),t}throw new Error("not supported key object")},ae.getPosArrayOfChildrenFromHex=function(e){return pe.getChildIdx(e,0)},ae.getHexValueArrayOfChildrenFromHex=function(e){var t,n=pe.getV,r=n(e,(t=ae.getPosArrayOfChildrenFromHex(e))[0]),i=n(e,t[1]),a=n(e,t[2]),s=n(e,t[3]),o=n(e,t[4]),u=n(e,t[5]),c=n(e,t[6]),l=n(e,t[7]),h=n(e,t[8]);return(t=new Array).push(r,i,a,s,o,u,c,l,h),t},ae.prototype.readPrivateKeyFromPEMString=function(e){var t=$e(e),n=ae.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8])},ae.prototype.readPKCS5PrvKeyHex=function(e){var t=ae.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},ae.prototype.readPKCS8PrvKeyHex=function(e){var t,n,r,i,a,s,o,u,c=pe,l=c.getVbyListEx;if(!1===c.isASN1HEX(e))throw new Error("not ASN.1 hex string");try{t=l(e,0,[2,0,1],"02"),n=l(e,0,[2,0,2],"02"),r=l(e,0,[2,0,3],"02"),i=l(e,0,[2,0,4],"02"),a=l(e,0,[2,0,5],"02"),s=l(e,0,[2,0,6],"02"),o=l(e,0,[2,0,7],"02"),u=l(e,0,[2,0,8],"02")}catch(e){throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(t,n,r,i,a,s,o,u)},ae.prototype.readPKCS5PubKeyHex=function(e){var t=pe,n=t.getV;if(!1===t.isASN1HEX(e))throw new Error("keyHex is not ASN.1 hex string");var r=t.getChildIdx(e,0);if(2!==r.length||"02"!==e.substr(r[0],2)||"02"!==e.substr(r[1],2))throw new Error("wrong hex for PKCS#5 public key");var i=n(e,r[0]),a=n(e,r[1]);this.setPublic(i,a)},ae.prototype.readPKCS8PubKeyHex=function(e){var t=pe;if(!1===t.isASN1HEX(e))throw new Error("not ASN.1 hex string");if("06092a864886f70d010101"!==t.getTLVbyListEx(e,0,[0,0]))throw new Error("not PKCS8 RSA public key");var n=t.getTLVbyListEx(e,0,[1,0]);this.readPKCS5PubKeyHex(n)},ae.prototype.readCertPubKeyHex=function(e,t){var n,r;(n=new Ze).readCertHex(e),r=n.getPublicKeyHex(),this.readPKCS8PubKeyHex(r)};new RegExp("[^0-9a-f]","gi");function Xe(e,t){for(var n="",r=t/4-e.length,i=0;i<r;i++)n+="0";return n+e}function Je(e,t,n){for(var r="",i=0;r.length<t;)r+=Fe(n(Ce(e+String.fromCharCode.apply(String,[(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i])))),i+=1;return r}function Qe(e){for(var t in he.crypto.Util.DIGESTINFOHEAD){var n=he.crypto.Util.DIGESTINFOHEAD[t],r=n.length;if(e.substring(0,r)==n)return[t,e.substring(r)]}return[]}function Ze(e){var t,n=pe,r=n.getChildIdx,i=n.getV,a=n.getTLV,s=n.getVbyList,o=n.getVbyListEx,u=n.getTLVbyList,c=n.getTLVbyListEx,l=n.getIdxbyList,h=n.getIdxbyListEx,f=n.getVidx,d=n.getInt,p=n.oidname,g=n.hextooidstr,m=$e;try{t=he.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(e){}this.HEX2STAG={"0c":"utf8",13:"prn",16:"ia5","1a":"vis","1e":"bmp"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){if(null===this.hex||0!==this.version)return this.version;var e=u(this.hex,0,[0,0]);if("a0"==e.substr(0,2)){var t=u(e,0,[0]),n=d(t,0);if(n<0||2<n)throw new Error("malformed version field");return this.version=n+1,this.version}return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return o(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var e=c(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(e)},this.getAlgorithmIdentifierName=function(e){for(var n in t)if(e===t[n])return n;return p(o(e,0,[0],"06"))},this.getIssuer=function(){return this.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return u(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){return this.getIssuer().str},this.getSubject=function(){return this.getX500Name(this.getSubjectHex())},this.getSubjectHex=function(){return u(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){return this.getSubject().str},this.getNotBefore=function(){var e=s(this.hex,0,[0,4+this.foffset,0]);return e=e.replace(/(..)/g,"%$1"),e=decodeURIComponent(e)},this.getNotAfter=function(){var e=s(this.hex,0,[0,4+this.foffset,1]);return e=e.replace(/(..)/g,"%$1"),e=decodeURIComponent(e)},this.getPublicKeyHex=function(){return n.getTLVbyList(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyIdx=function(){return l(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var e=this.getPublicKeyIdx();return l(this.hex,e,[1,0],"30")},this.getPublicKey=function(){return Ye.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var e=u(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(e)},this.getSignatureValueHex=function(){return s(this.hex,0,[2],"03",!0)},this.verifySignature=function(e){var t=this.getSignatureAlgorithmField(),n=this.getSignatureValueHex(),r=u(this.hex,0,[0],"30"),i=new he.crypto.Signature({alg:t});return i.init(e),i.updateHex(r),i.verify(n)},this.parseExt=function(e){var t,a,o;if(void 0===e){if(o=this.hex,3!==this.version)return-1;t=l(o,0,[0,7,0],"30"),a=r(o,t)}else{o=$e(e);var u=l(o,0,[0,3,0,0],"06");if("2a864886f70d01090e"!=i(o,u))return void(this.aExtInfo=new Array);t=l(o,0,[0,3,0,1,0],"30"),a=r(o,t),this.hex=o}this.aExtInfo=new Array;for(var c=0;c<a.length;c++){var h={critical:!1},d=0;3===r(o,a[c]).length&&(h.critical=!0,d=1),h.oid=n.hextooidstr(s(o,a[c],[0],"06"));var p=l(o,a[c],[1+d]);h.vidx=f(o,p),this.aExtInfo.push(h)}},this.getExtInfo=function(e){var t=this.aExtInfo,n=e;if(e.match(/^[0-9.]+$/)||(n=he.asn1.x509.OID.name2oid(e)),""!==n)for(var r=0;r<t.length;r++)if(t[r].oid===n)return t[r]},this.getExtBasicConstraints=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("basicConstraints");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var r={extname:"basicConstraints"};if(t&&(r.critical=!0),"3000"===e)return r;if("30030101ff"===e)return r.cA=!0,r;if("30060101ff02"===e.substr(0,12)){var s=i(e,10),o=parseInt(s,16);return r.cA=!0,r.pathLen=o,r}throw new Error("hExtV parse error: "+e)},this.getExtKeyUsage=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("keyUsage");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var r={extname:"keyUsage"};return t&&(r.critical=!0),r.names=this.getExtKeyUsageString(e).split(","),r},this.getExtKeyUsageBin=function(e){if(void 0===e){var t=this.getExtInfo("keyUsage");if(void 0===t)return"";e=a(this.hex,t.vidx)}if(8!=e.length&&10!=e.length)throw new Error("malformed key usage value: "+e);var n="000000000000000"+parseInt(e.substr(6),16).toString(2);return 8==e.length&&(n=n.slice(-8)),10==e.length&&(n=n.slice(-16)),""==(n=n.replace(/0+$/,""))&&(n="0"),n},this.getExtKeyUsageString=function(e){for(var t=this.getExtKeyUsageBin(e),n=new Array,r=0;r<t.length;r++)"1"==t.substr(r,1)&&n.push(Ze.KEYUSAGE_NAME[r]);return n.join(",")},this.getExtSubjectKeyIdentifier=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("subjectKeyIdentifier");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var r={extname:"subjectKeyIdentifier"};t&&(r.critical=!0);var s=i(e,0);return r.kid={hex:s},r},this.getExtAuthorityKeyIdentifier=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("authorityKeyIdentifier");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var s={extname:"authorityKeyIdentifier"};t&&(s.critical=!0);for(var o=r(e,0),u=0;u<o.length;u++){var c=e.substr(o[u],2);if("80"===c&&(s.kid={hex:i(e,o[u])}),"a1"===c){var l=a(e,o[u]),h=this.getGeneralNames(l);s.issuer=h[0].dn}"82"===c&&(s.sn={hex:i(e,o[u])})}return s},this.getExtExtKeyUsage=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("extKeyUsage");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var s={extname:"extKeyUsage",array:[]};t&&(s.critical=!0);for(var o=r(e,0),u=0;u<o.length;u++)s.array.push(p(i(e,o[u])));return s},this.getExtExtKeyUsageName=function(){var e=this.getExtInfo("extKeyUsage");if(void 0===e)return e;var t=new Array,n=a(this.hex,e.vidx);if(""===n)return t;for(var s=r(n,0),o=0;o<s.length;o++)t.push(p(i(n,s[o])));return t},this.getExtSubjectAltName=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("subjectAltName");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var r={extname:"subjectAltName",array:[]};return t&&(r.critical=!0),r.array=this.getGeneralNames(e),r},this.getExtIssuerAltName=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("issuerAltName");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var r={extname:"issuerAltName",array:[]};return t&&(r.critical=!0),r.array=this.getGeneralNames(e),r},this.getGeneralNames=function(e){for(var t=r(e,0),n=[],i=0;i<t.length;i++){var s=this.getGeneralName(a(e,t[i]));void 0!==s&&n.push(s)}return n},this.getGeneralName=function(e){var t=e.substr(0,2),n=i(e,0),r=Fe(n);return"81"==t?{rfc822:r}:"82"==t?{dns:r}:"86"==t?{uri:r}:"87"==t?{ip:He(n)}:"a4"==t?{dn:this.getX500Name(n)}:void 0},this.getExtSubjectAltName2=function(){var e,t,n,s=this.getExtInfo("subjectAltName");if(void 0===s)return s;for(var o=new Array,u=a(this.hex,s.vidx),c=r(u,0),l=0;l<c.length;l++)n=u.substr(c[l],2),e=i(u,c[l]),"81"===n&&(t=Ae(e),o.push(["MAIL",t])),"82"===n&&(t=Ae(e),o.push(["DNS",t])),"84"===n&&(t=Ze.hex2dn(e,0),o.push(["DN",t])),"86"===n&&(t=Ae(e),o.push(["URI",t])),"87"===n&&(t=He(e),o.push(["IP",t]));return o},this.getExtCRLDistributionPoints=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("cRLDistributionPoints");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var i={extname:"cRLDistributionPoints",array:[]};t&&(i.critical=!0);for(var s=r(e,0),o=0;o<s.length;o++){var u=a(e,s[o]);i.array.push(this.getDistributionPoint(u))}return i},this.getDistributionPoint=function(e){for(var t={},n=r(e,0),i=0;i<n.length;i++){var s=e.substr(n[i],2),o=a(e,n[i]);"a0"==s&&(t.dpname=this.getDistributionPointName(o))}return t},this.getDistributionPointName=function(e){for(var t={},n=r(e,0),i=0;i<n.length;i++){var s=e.substr(n[i],2),o=a(e,n[i]);"a0"==s&&(t.full=this.getGeneralNames(o))}return t},this.getExtCRLDistributionPointsURI=function(){var e=this.getExtInfo("cRLDistributionPoints");if(void 0===e)return e;for(var t=new Array,n=r(this.hex,e.vidx),i=0;i<n.length;i++)try{var a=Ae(s(this.hex,n[i],[0,0,0],"86"));t.push(a)}catch(e){}return t},this.getExtAIAInfo=function(){var e=this.getExtInfo("authorityInfoAccess");if(void 0===e)return e;for(var t={ocsp:[],caissuer:[]},n=r(this.hex,e.vidx),i=0;i<n.length;i++){var a=s(this.hex,n[i],[0],"06"),o=s(this.hex,n[i],[1],"86");"2b06010505073001"===a&&t.ocsp.push(Ae(o)),"2b06010505073002"===a&&t.caissuer.push(Ae(o))}return t},this.getExtAuthorityInfoAccess=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("authorityInfoAccess");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var i={extname:"authorityInfoAccess",array:[]};t&&(i.critical=!0);for(var u=r(e,0),c=0;c<u.length;c++){var l=o(e,u[c],[0],"06"),h=Ae(s(e,u[c],[1],"86"));if("2b06010505073001"==l)i.array.push({ocsp:h});else{if("2b06010505073002"!=l)throw new Error("unknown method: "+l);i.array.push({caissuer:h})}}return i},this.getExtCertificatePolicies=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("certificatePolicies");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var i={extname:"certificatePolicies",array:[]};t&&(i.critical=!0);for(var s=r(e,0),o=0;o<s.length;o++){var u=a(e,s[o]),c=this.getPolicyInformation(u);i.array.push(c)}return i},this.getPolicyInformation=function(e){var t={},n=s(e,0,[0],"06");t.policyoid=p(n);var i=h(e,0,[1],"30");if(-1!=i){t.array=[];for(var o=r(e,i),u=0;u<o.length;u++){var c=a(e,o[u]),l=this.getPolicyQualifierInfo(c);t.array.push(l)}}return t},this.getPolicyQualifierInfo=function(e){var t={},n=s(e,0,[0],"06");if("2b06010505070201"===n){var r=o(e,0,[1],"16");t.cps=Fe(r)}else if("2b06010505070202"===n){var i=u(e,0,[1],"30");t.unotice=this.getUserNotice(i)}return t},this.getUserNotice=function(e){for(var t={},n=r(e,0),i=0;i<n.length;i++){var s=a(e,n[i]);"30"!=s.substr(0,2)&&(t.exptext=this.getDisplayText(s))}return t},this.getDisplayText=function(e){var t={};return t.type={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"}[e.substr(0,2)],t.str=Fe(i(e,0)),t},this.getExtCRLNumber=function(e,t){var n={extname:"cRLNumber"};if(t&&(n.critical=!0),"02"==e.substr(0,2))return n.num={hex:i(e,0)},n;throw new Error("hExtV parse error: "+e)},this.getExtCRLReason=function(e,t){var n={extname:"cRLReason"};if(t&&(n.critical=!0),"0a"==e.substr(0,2))return n.code=parseInt(i(e,0),16),n;throw new Error("hExtV parse error: "+e)},this.getExtOcspNonce=function(e,t){var n={extname:"ocspNonce"};t&&(n.critical=!0);var r=i(e,0);return n.hex=r,n},this.getExtOcspNoCheck=function(e,t){var n={extname:"ocspNoCheck"};return t&&(n.critical=!0),n},this.getExtAdobeTimeStamp=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("adobeTimeStamp");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var i={extname:"adobeTimeStamp"};t&&(i.critical=!0);var s=r(e,0);if(s.length>1){var o=a(e,s[1]),u=this.getGeneralName(o);null!=u.uri&&(i.uri=u.uri)}if(s.length>2){var c=a(e,s[2]);"0101ff"==c&&(i.reqauth=!0),"010100"==c&&(i.reqauth=!1)}return i},this.getX500NameRule=function(e){for(var t=null,n=[],r=0;r<e.length;r++)for(var i=e[r],a=0;a<i.length;a++)n.push(i[a]);for(r=0;r<n.length;r++){var s=n[r],o=s.ds,u=s.value,c=s.type;if(":"+o,"prn"!=o&&"utf8"!=o&&"ia5"!=o)return"mixed";if("ia5"==o){if("CN"!=c)return"mixed";if(he.lang.String.isMail(u))continue;return"mixed"}if("C"==c){if("prn"==o)continue;return"mixed"}if(":"+o,null==t)t=o;else if(t!==o)return"mixed"}return null==t?"prn":t},this.getX500Name=function(e){var t=this.getX500NameArray(e);return{array:t,str:this.dnarraytostr(t)}},this.getX500NameArray=function(e){for(var t=[],n=r(e,0),i=0;i<n.length;i++)t.push(this.getRDN(a(e,n[i])));return t},this.getRDN=function(e){for(var t=[],n=r(e,0),i=0;i<n.length;i++)t.push(this.getAttrTypeAndValue(a(e,n[i])));return t},this.getAttrTypeAndValue=function(e){var t={type:null,value:null,ds:null},n=r(e,0),i=s(e,n[0],[],"06"),a=s(e,n[1],[]),o=he.asn1.ASN1Util.oidHexToInt(i);return t.type=he.asn1.x509.OID.oid2atype(o),t.ds=this.HEX2STAG[e.substr(n[1],2)],"bmp"!=t.ds?t.value=Ae(a):t.value=Ne(a),t},this.readCertPEM=function(e){this.readCertHex(m(e))},this.readCertHex=function(e){this.hex=e,this.getVersion();try{l(this.hex,0,[0,7],"a3"),this.parseExt()}catch(e){}},this.getParam=function(){var e={};return e.version=this.getVersion(),e.serial={hex:this.getSerialNumberHex()},e.sigalg=this.getSignatureAlgorithmField(),e.issuer=this.getIssuer(),e.notbefore=this.getNotBefore(),e.notafter=this.getNotAfter(),e.subject=this.getSubject(),e.sbjpubkey=Te(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo.length>0&&(e.ext=this.getExtParamArray()),e.sighex=this.getSignatureValueHex(),e},this.getExtParamArray=function(e){null==e&&(-1!=h(this.hex,0,[0,"[3]"])&&(e=c(this.hex,0,[0,"[3]",0],"30")));for(var t=[],n=r(e,0),i=0;i<n.length;i++){var s=a(e,n[i]),o=this.getExtParam(s);null!=o&&t.push(o)}return t},this.getExtParam=function(e){var t=r(e,0).length;if(2!=t&&3!=t)throw new Error("wrong number elements in Extension: "+t+" "+e);var n=g(s(e,0,[0],"06")),i=!1;3==t&&"0101ff"==u(e,0,[1])&&(i=!0);var a=u(e,0,[t-1,0]),o=void 0;if("2.5.29.14"==n?o=this.getExtSubjectKeyIdentifier(a,i):"2.5.29.15"==n?o=this.getExtKeyUsage(a,i):"2.5.29.17"==n?o=this.getExtSubjectAltName(a,i):"2.5.29.18"==n?o=this.getExtIssuerAltName(a,i):"2.5.29.19"==n?o=this.getExtBasicConstraints(a,i):"2.5.29.31"==n?o=this.getExtCRLDistributionPoints(a,i):"2.5.29.32"==n?o=this.getExtCertificatePolicies(a,i):"2.5.29.35"==n?o=this.getExtAuthorityKeyIdentifier(a,i):"2.5.29.37"==n?o=this.getExtExtKeyUsage(a,i):"1.3.6.1.5.5.7.1.1"==n?o=this.getExtAuthorityInfoAccess(a,i):"2.5.29.20"==n?o=this.getExtCRLNumber(a,i):"2.5.29.21"==n?o=this.getExtCRLReason(a,i):"1.3.6.1.5.5.7.48.1.2"==n?o=this.getExtOcspNonce(a,i):"1.3.6.1.5.5.7.48.1.5"==n?o=this.getExtOcspNoCheck(a,i):"1.2.840.113583.1.1.9.1"==n&&(o=this.getExtAdobeTimeStamp(a,i)),null!=o)return o;var c={extname:n,extn:a};return i&&(c.critical=!0),c},this.findExt=function(e,t){for(var n=0;n<e.length;n++)if(e[n].extname==t)return e[n];return null},this.updateExtCDPFullURI=function(e,t){var n=this.findExt(e,"cRLDistributionPoints");if(null!=n&&null!=n.array)for(var r=n.array,i=0;i<r.length;i++)if(null!=r[i].dpname&&null!=r[i].dpname.full)for(var a=r[i].dpname.full,s=0;s<a.length;s++){var o=a[i];null!=o.uri&&(o.uri=t)}},this.updateExtAIAOCSP=function(e,t){var n=this.findExt(e,"authorityInfoAccess");if(null!=n&&null!=n.array)for(var r=n.array,i=0;i<r.length;i++)null!=r[i].ocsp&&(r[i].ocsp=t)},this.updateExtAIACAIssuer=function(e,t){var n=this.findExt(e,"authorityInfoAccess");if(null!=n&&null!=n.array)for(var r=n.array,i=0;i<r.length;i++)null!=r[i].caissuer&&(r[i].caissuer=t)},this.dnarraytostr=function(e){return"/"+e.map((function(e){return function(e){return e.map((function(e){return function(e){return e.type+"="+e.value}(e).replace(/\+/,"\\+")})).join("+")}(e).replace(/\//,"\\/")})).join("/")},this.getInfo=function(){var e,t,n,r,i=function(e){for(var t="",n=e.array,r=0;r<n.length;r++){var i=n[r];if(t+=" policy oid: "+i.policyoid+"\n",void 0!==i.array)for(var a=0;a<i.array.length;a++){var s=i.array[a];void 0!==s.cps&&(t+=" cps: "+s.cps+"\n")}}return t},a=function(e){for(var t="",n=e.array,r=0;r<n.length;r++){var i=n[r];try{void 0!==i.dpname.full[0].uri&&(t+=" "+i.dpname.full[0].uri+"\n")}catch(e){}try{void 0!==i.dname.full[0].dn.hex&&(t+=" "+Ze.hex2dn(i.dpname.full[0].dn.hex)+"\n")}catch(e){}}return t},s=function(e){for(var t="",n=e.array,r=0;r<n.length;r++){var i=n[r];void 0!==i.caissuer&&(t+=" caissuer: "+i.caissuer+"\n"),void 0!==i.ocsp&&(t+=" ocsp: "+i.ocsp+"\n")}return t};if(e="Basic Fields\n",e+=" serial number: "+this.getSerialNumberHex()+"\n",e+=" signature algorithm: "+this.getSignatureAlgorithmField()+"\n",e+=" issuer: "+this.getIssuerString()+"\n",e+=" notBefore: "+this.getNotBefore()+"\n",e+=" notAfter: "+this.getNotAfter()+"\n",e+=" subject: "+this.getSubjectString()+"\n",e+=" subject public key info: \n",e+=" key algorithm: "+(t=this.getPublicKey()).type+"\n","RSA"===t.type&&(e+=" n="+Ue(t.n.toString(16)).substr(0,16)+"...\n",e+=" e="+Ue(t.e.toString(16))+"\n"),null!=(n=this.aExtInfo)){e+="X509v3 Extensions:\n";for(var o=0;o<n.length;o++){var u=n[o],c=he.asn1.x509.OID.oid2name(u.oid);""===c&&(c=u.oid);var l="";if(!0===u.critical&&(l="CRITICAL"),e+=" "+c+" "+l+":\n","basicConstraints"===c){var h=this.getExtBasicConstraints();void 0===h.cA?e+=" {}\n":(e+=" cA=true",void 0!==h.pathLen&&(e+=", pathLen="+h.pathLen),e+="\n")}else if("keyUsage"===c)e+=" "+this.getExtKeyUsageString()+"\n";else if("subjectKeyIdentifier"===c)e+=" "+this.getExtSubjectKeyIdentifier().kid.hex+"\n";else if("authorityKeyIdentifier"===c){var f=this.getExtAuthorityKeyIdentifier();void 0!==f.kid&&(e+=" kid="+f.kid.hex+"\n")}else{if("extKeyUsage"===c)e+=" "+this.getExtExtKeyUsage().array.join(", ")+"\n";else if("subjectAltName"===c)e+=" "+(r=this.getExtSubjectAltName(),JSON.stringify(r.array).replace(/[\[\]\{\}\"]/g,""))+"\n";else if("cRLDistributionPoints"===c)e+=a(this.getExtCRLDistributionPoints());else if("authorityInfoAccess"===c)e+=s(this.getExtAuthorityInfoAccess());else"certificatePolicies"===c&&(e+=i(this.getExtCertificatePolicies()))}}}return e+="signature algorithm: "+this.getSignatureAlgorithmName()+"\n",e+="signature: "+this.getSignatureValueHex().substr(0,16)+"...\n"},"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?this.readCertPEM(e):he.lang.String.isHex(e)&&this.readCertHex(e))}ae.prototype.sign=function(e,t){var n=function(e){return he.crypto.Util.hashString(e,t)}(e);return this.signWithMessageHash(n,t)},ae.prototype.signWithMessageHash=function(e,t){var n=re(he.crypto.Util.getPaddedDigestInfoHex(e,t,this.n.bitLength()),16);return Xe(this.doPrivate(n).toString(16),this.n.bitLength())},ae.prototype.signPSS=function(e,t,n){var r,i=(r=Ce(e),he.crypto.Util.hashHex(r,t));return void 0===n&&(n=-1),this.signWithMessageHashPSS(i,t,n)},ae.prototype.signWithMessageHashPSS=function(e,t,n){var r,i=Fe(e),a=i.length,s=this.n.bitLength()-1,o=Math.ceil(s/8),u=function(e){return he.crypto.Util.hashHex(e,t)};if(-1===n||void 0===n)n=a;else if(-2===n)n=o-a-2;else if(n<-2)throw new Error("invalid salt length");if(o<a+n+2)throw new Error("data too long");var c="";n>0&&(c=new Array(n),(new ne).nextBytes(c),c=String.fromCharCode.apply(String,c));var l=Fe(u(Ce("\0\0\0\0\0\0\0\0"+i+c))),h=[];for(r=0;r<o-n-a-2;r+=1)h[r]=0;var f=String.fromCharCode.apply(String,h)+""+c,d=Je(l,f.length,u),p=[];for(r=0;r<f.length;r+=1)p[r]=f.charCodeAt(r)^d.charCodeAt(r);var g=65280>>8*o-s&255;for(p[0]&=~g,r=0;r<a;r++)p.push(l.charCodeAt(r));return p.push(188),Xe(this.doPrivate(new S(p)).toString(16),this.n.bitLength())},ae.prototype.verify=function(e,t){if(null==(t=t.toLowerCase()).match(/^[0-9a-f]+$/))return!1;var n=re(t,16),r=this.n.bitLength();if(n.bitLength()>r)return!1;var i=this.doPublic(n).toString(16);if(i.length+3!=r/4)return!1;var a=Qe(i.replace(/^1f+00/,""));if(0==a.length)return!1;var s=a[0];return a[1]==function(e){return he.crypto.Util.hashString(e,s)}(e)},ae.prototype.verifyWithMessageHash=function(e,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var n=re(t,16);if(n.bitLength()>this.n.bitLength())return 0;var r=Qe(this.doPublic(n).toString(16).replace(/^1f+00/,""));if(0==r.length)return!1;r[0];return r[1]==e},ae.prototype.verifyPSS=function(e,t,n,r){var i,a=(i=Ce(e),he.crypto.Util.hashHex(i,n));return void 0===r&&(r=-1),this.verifyWithMessageHashPSS(a,t,n,r)},ae.prototype.verifyWithMessageHashPSS=function(e,t,n,r){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var i,a=new S(t,16),s=function(e){return he.crypto.Util.hashHex(e,n)},o=Fe(e),u=o.length,c=this.n.bitLength()-1,l=Math.ceil(c/8);if(-1===r||void 0===r)r=u;else if(-2===r)r=l-u-2;else if(r<-2)throw new Error("invalid salt length");if(l<u+r+2)throw new Error("data too long");var h=this.doPublic(a).toByteArray();for(i=0;i<h.length;i+=1)h[i]&=255;for(;h.length<l;)h.unshift(0);if(188!==h[l-1])throw new Error("encoded message does not end in 0xbc");var f=(h=String.fromCharCode.apply(String,h)).substr(0,l-u-1),d=h.substr(f.length,u),p=65280>>8*l-c&255;if(0!=(f.charCodeAt(0)&p))throw new Error("bits beyond keysize not zero");var g=Je(d,f.length,s),m=[];for(i=0;i<f.length;i+=1)m[i]=f.charCodeAt(i)^g.charCodeAt(i);m[0]&=~p;var v=l-u-r-2;for(i=0;i<v;i+=1)if(0!==m[i])throw new Error("leftmost octets not zero");if(1!==m[v])throw new Error("0x01 marker not found");return d===Fe(s(Ce("\0\0\0\0\0\0\0\0"+o+String.fromCharCode.apply(String,m.slice(-r)))))},ae.SALT_LEN_HLEN=-1,ae.SALT_LEN_MAX=-2,ae.SALT_LEN_RECOVER=-2,Ze.hex2dn=function(e,t){void 0===t&&(t=0);var n=new Ze;pe.getTLV(e,t);return n.getX500Name(e).str},Ze.hex2rdn=function(e,t){if(void 0===t&&(t=0),"31"!==e.substr(t,2))throw new Error("malformed RDN");for(var n=new Array,r=pe.getChildIdx(e,t),i=0;i<r.length;i++)n.push(Ze.hex2attrTypeValue(e,r[i]));return(n=n.map((function(e){return e.replace("+","\\+")}))).join("+")},Ze.hex2attrTypeValue=function(e,t){var n=pe,r=n.getV;if(void 0===t&&(t=0),"30"!==e.substr(t,2))throw new Error("malformed attribute type and value");var i=n.getChildIdx(e,t);2!==i.length||e.substr(i[0],2);var a=r(e,i[0]),s=he.asn1.ASN1Util.oidHexToInt(a);return he.asn1.x509.OID.oid2atype(s)+"="+Fe(r(e,i[1]))},Ze.getPublicKeyFromCertHex=function(e){var t=new Ze;return t.readCertHex(e),t.getPublicKey()},Ze.getPublicKeyFromCertPEM=function(e){var t=new Ze;return t.readCertPEM(e),t.getPublicKey()},Ze.getPublicKeyInfoPropOfCertPEM=function(e){var t,n,r=pe.getVbyList,i={};return i.algparam=null,(t=new Ze).readCertPEM(e),n=t.getPublicKeyHex(),i.keyhex=r(n,0,[1],"03").substr(2),i.algoid=r(n,0,[0,0],"06"),"2a8648ce3d0201"===i.algoid&&(i.algparam=r(n,0,[0,1],"06")),i},Ze.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"];void 0!==he&&he||(he={}),void 0!==he.jws&&he.jws||(he.jws={}),he.jws.JWS=function(){var e=he.jws.JWS.isSafeJSONString;this.parseJWS=function(t,n){if(void 0===this.parsedJWS||!n&&void 0===this.parsedJWS.sigvalH){var r=t.match(/^([^.]+)\.([^.]+)\.([^.]+)$/);if(null==r)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";var i=r[1],a=r[2],s=r[3],o=i+"."+a;if(this.parsedJWS={},this.parsedJWS.headB64U=i,this.parsedJWS.payloadB64U=a,this.parsedJWS.sigvalB64U=s,this.parsedJWS.si=o,!n){var u=Se(s),c=re(u,16);this.parsedJWS.sigvalH=u,this.parsedJWS.sigvalBI=c}var l=de(i),h=de(a);if(this.parsedJWS.headS=l,this.parsedJWS.payloadS=h,!e(l,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+l}}},he.jws.JWS.sign=function(e,t,n,r,i){var a,s,o,u=he,c=u.jws.JWS,l=c.readSafeJSONString,h=c.isSafeJSONString,f=u.crypto,d=(f.ECDSA,f.Mac),p=f.Signature,g=JSON;if("string"!=typeof t&&"object"!=typeof t)throw"spHeader must be JSON string or object: "+t;if("object"==typeof t&&(s=t,a=g.stringify(s)),"string"==typeof t){if(!h(a=t))throw"JWS Head is not safe JSON string: "+a;s=l(a)}if(o=n,"object"==typeof n&&(o=g.stringify(n)),""!=e&&null!=e||void 0===s.alg||(e=s.alg),""!=e&&null!=e&&void 0===s.alg&&(s.alg=e,a=g.stringify(s)),e!==s.alg)throw"alg and sHeader.alg doesn't match: "+e+"!="+s.alg;var m=null;if(void 0===c.jwsalg2sigalg[e])throw"unsupported alg name: "+e;m=c.jwsalg2sigalg[e];var v=fe(a)+"."+fe(o),y="";if("Hmac"==m.substr(0,4)){if(void 0===r)throw"mac key shall be specified for HS* alg";var b=new d({alg:m,prov:"cryptojs",pass:r});b.updateString(v),y=b.doFinal()}else if(-1!=m.indexOf("withECDSA")){(x=new p({alg:m})).init(r,i),x.updateString(v);var w=x.sign();y=he.crypto.ECDSA.asn1SigToConcatSig(w)}else{var x;if("none"!=m)(x=new p({alg:m})).init(r,i),x.updateString(v),y=x.sign()}return v+"."+xe(y)},he.jws.JWS.verify=function(e,t,n){var r,i=he,a=i.jws.JWS,s=a.readSafeJSONString,o=i.crypto,u=o.ECDSA,c=o.Mac,l=o.Signature;r=ae;var h=e.split(".");if(3!==h.length)return!1;var f=h[0]+"."+h[1],d=Se(h[2]),p=s(de(h[0])),g=null,m=null;if(void 0===p.alg)throw"algorithm not specified in header";if((m=(g=p.alg).substr(0,2),null!=n&&"[object Array]"===Object.prototype.toString.call(n)&&n.length>0)&&-1==(":"+n.join(":")+":").indexOf(":"+g+":"))throw"algorithm '"+g+"' not accepted in the list";if("none"!=g&&null===t)throw"key shall be specified to verify.";if("string"==typeof t&&-1!=t.indexOf("-----BEGIN ")&&(t=Ye.getKey(t)),!("RS"!=m&&"PS"!=m||t instanceof r))throw"key shall be a RSAKey obj for RS* and PS* algs";if("ES"==m&&!(t instanceof u))throw"key shall be a ECDSA obj for ES* algs";var v=null;if(void 0===a.jwsalg2sigalg[p.alg])throw"unsupported alg name: "+g;if("none"==(v=a.jwsalg2sigalg[g]))throw"not supported";if("Hmac"==v.substr(0,4)){if(void 0===t)throw"hexadecimal key shall be specified for HMAC";var y=new c({alg:v,pass:t});return y.updateString(f),d==y.doFinal()}if(-1!=v.indexOf("withECDSA")){var b,w=null;try{w=u.concatSigToASN1Sig(d)}catch(e){return!1}return(b=new l({alg:v})).init(t),b.updateString(f),b.verify(w)}return(b=new l({alg:v})).init(t),b.updateString(f),b.verify(d)},he.jws.JWS.parse=function(e){var t,n,r,i=e.split("."),a={};if(2!=i.length&&3!=i.length)throw"malformed sJWS: wrong number of '.' splitted elements";return t=i[0],n=i[1],3==i.length&&(r=i[2]),a.headerObj=he.jws.JWS.readSafeJSONString(de(t)),a.payloadObj=he.jws.JWS.readSafeJSONString(de(n)),a.headerPP=JSON.stringify(a.headerObj,null," "),null==a.payloadObj?a.payloadPP=de(n):a.payloadPP=JSON.stringify(a.payloadObj,null," "),void 0!==r&&(a.sigHex=Se(r)),a},he.jws.JWS.verifyJWT=function(e,t,n){var r=he.jws,i=r.JWS,a=i.readSafeJSONString,s=i.inArray,o=i.includedArray,u=e.split("."),c=u[0],l=u[1],h=(Se(u[2]),a(de(c))),f=a(de(l));if(void 0===h.alg)return!1;if(void 0===n.alg)throw"acceptField.alg shall be specified";if(!s(h.alg,n.alg))return!1;if(void 0!==f.iss&&"object"==typeof n.iss&&!s(f.iss,n.iss))return!1;if(void 0!==f.sub&&"object"==typeof n.sub&&!s(f.sub,n.sub))return!1;if(void 0!==f.aud&&"object"==typeof n.aud)if("string"==typeof f.aud){if(!s(f.aud,n.aud))return!1}else if("object"==typeof f.aud&&!o(f.aud,n.aud))return!1;var d=r.IntDate.getNow();return void 0!==n.verifyAt&&"number"==typeof n.verifyAt&&(d=n.verifyAt),void 0!==n.gracePeriod&&"number"==typeof n.gracePeriod||(n.gracePeriod=0),!(void 0!==f.exp&&"number"==typeof f.exp&&f.exp+n.gracePeriod<d)&&(!(void 0!==f.nbf&&"number"==typeof f.nbf&&d<f.nbf-n.gracePeriod)&&(!(void 0!==f.iat&&"number"==typeof f.iat&&d<f.iat-n.gracePeriod)&&((void 0===f.jti||void 0===n.jti||f.jti===n.jti)&&!!i.verify(e,t,n.alg))))},he.jws.JWS.includedArray=function(e,t){var n=he.jws.JWS.inArray;if(null===e)return!1;if("object"!=typeof e)return!1;if("number"!=typeof e.length)return!1;for(var r=0;r<e.length;r++)if(!n(e[r],t))return!1;return!0},he.jws.JWS.inArray=function(e,t){if(null===t)return!1;if("object"!=typeof t)return!1;if("number"!=typeof t.length)return!1;for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1},he.jws.JWS.jwsalg2sigalg={HS256:"HmacSHA256",HS384:"HmacSHA384",HS512:"HmacSHA512",RS256:"SHA256withRSA",RS384:"SHA384withRSA",RS512:"SHA512withRSA",ES256:"SHA256withECDSA",ES384:"SHA384withECDSA",PS256:"SHA256withRSAandMGF1",PS384:"SHA384withRSAandMGF1",PS512:"SHA512withRSAandMGF1",none:"none"},he.jws.JWS.isSafeJSONString=function(e,t,n){var r=null;try{return"object"!=typeof(r=le(e))?0:r.constructor===Array?0:(t&&(t[n]=r),1)}catch(e){return 0}},he.jws.JWS.readSafeJSONString=function(e){var t=null;try{return"object"!=typeof(t=le(e))?null:t.constructor===Array?null:t}catch(e){return null}},he.jws.JWS.getEncodedSignatureValueFromJWS=function(e){var t=e.match(/^[^.]+\.[^.]+\.([^.]+)$/);if(null==t)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";return t[1]},he.jws.JWS.getJWKthumbprint=function(e){if("RSA"!==e.kty&&"EC"!==e.kty&&"oct"!==e.kty)throw"unsupported algorithm for JWK Thumprint";var t="{";if("RSA"===e.kty){if("string"!=typeof e.n||"string"!=typeof e.e)throw"wrong n and e value for RSA key";t+='"e":"'+e.e+'",',t+='"kty":"'+e.kty+'",',t+='"n":"'+e.n+'"}'}else if("EC"===e.kty){if("string"!=typeof e.crv||"string"!=typeof e.x||"string"!=typeof e.y)throw"wrong crv, x and y value for EC key";t+='"crv":"'+e.crv+'",',t+='"kty":"'+e.kty+'",',t+='"x":"'+e.x+'",',t+='"y":"'+e.y+'"}'}else if("oct"===e.kty){if("string"!=typeof e.k)throw"wrong k value for oct(symmetric) key";t+='"kty":"'+e.kty+'",',t+='"k":"'+e.k+'"}'}var n=Ce(t);return xe(he.crypto.Util.hashHex(n,"sha256"))},he.jws.IntDate={},he.jws.IntDate.get=function(e){var t=he.jws.IntDate,n=t.getNow,r=t.getZulu;if("now"==e)return n();if("now + 1hour"==e)return n()+3600;if("now + 1day"==e)return n()+86400;if("now + 1month"==e)return n()+2592e3;if("now + 1year"==e)return n()+31536e3;if(e.match(/Z$/))return r(e);if(e.match(/^[0-9]+$/))return parseInt(e);throw"unsupported format: "+e},he.jws.IntDate.getZulu=function(e){return _e(e)},he.jws.IntDate.getNow=function(){return~~(new Date/1e3)},he.jws.IntDate.intDate2UTCString=function(e){return new Date(1e3*e).toUTCString()},he.jws.IntDate.intDate2Zulu=function(e){var t=new Date(1e3*e);return("0000"+t.getUTCFullYear()).slice(-4)+("00"+(t.getUTCMonth()+1)).slice(-2)+("00"+t.getUTCDate()).slice(-2)+("00"+t.getUTCHours()).slice(-2)+("00"+t.getUTCMinutes()).slice(-2)+("00"+t.getUTCSeconds()).slice(-2)+"Z"},void 0!==he&&he||(he={}),void 0!==he.jws&&he.jws||(he.jws={}),he.jws.JWSJS=function(){var e=he.jws.JWS,t=e.readSafeJSONString;this.aHeader=[],this.sPayload="",this.aSignature=[],this.init=function(){this.aHeader=[],this.sPayload=void 0,this.aSignature=[]},this.initWithJWS=function(e){this.init();var t=e.split(".");if(3!=t.length)throw"malformed input JWS";this.aHeader.push(t[0]),this.sPayload=t[1],this.aSignature.push(t[2])},this.addSignature=function(e,t,n,r){if(void 0===this.sPayload||null===this.sPayload)throw"there's no JSON-JS signature to add.";var i=this.aHeader.length;if(this.aHeader.length!=this.aSignature.length)throw"aHeader.length != aSignature.length";try{var a=he.jws.JWS.sign(e,t,this.sPayload,n,r).split(".");a[0],a[2];this.aHeader.push(a[0]),this.aSignature.push(a[2])}catch(e){throw this.aHeader.length>i&&this.aHeader.pop(),this.aSignature.length>i&&this.aSignature.pop(),"addSignature failed: "+e}},this.verifyAll=function(e){if(this.aHeader.length!==e.length||this.aSignature.length!==e.length)return!1;for(var t=0;t<e.length;t++){var n=e[t];if(2!==n.length)return!1;if(!1===this.verifyNth(t,n[0],n[1]))return!1}return!0},this.verifyNth=function(t,n,r){if(this.aHeader.length<=t||this.aSignature.length<=t)return!1;var i=this.aHeader[t],a=this.aSignature[t],s=i+"."+this.sPayload+"."+a,o=!1;try{o=e.verify(s,n,r)}catch(e){return!1}return o},this.readJWSJS=function(e){if("string"==typeof e){var n=t(e);if(null==n)throw"argument is not safe JSON object string";this.aHeader=n.headers,this.sPayload=n.payload,this.aSignature=n.signatures}else try{if(!(e.headers.length>0))throw"malformed header";if(this.aHeader=e.headers,"string"!=typeof e.payload)throw"malformed signatures";if(this.sPayload=e.payload,!(e.signatures.length>0))throw"malformed signatures";this.aSignature=e.signatures}catch(e){throw"malformed JWS-JS JSON object: "+e}},this.getJSON=function(){return{headers:this.aHeader,payload:this.sPayload,signatures:this.aSignature}},this.isEmpty=function(){return 0==this.aHeader.length?1:0}},t.SecureRandom=ne,t.rng_seed_time=X,t.BigInteger=S,t.RSAKey=ae,t.ECDSA=he.crypto.ECDSA,t.DSA=he.crypto.DSA,t.Signature=he.crypto.Signature,t.MessageDigest=he.crypto.MessageDigest,t.Mac=he.crypto.Mac,t.Cipher=he.crypto.Cipher,t.KEYUTIL=Ye,t.ASN1HEX=pe,t.X509=Ze,t.X509CRL=function(e){var t=he.lang.String.isHex,n=pe,r=n.getV,i=n.getTLV,a=n.getVbyList,s=n.getTLVbyList,o=n.getTLVbyListEx,u=n.getIdxbyList,c=n.getIdxbyListEx,l=n.getChildIdx,h=new Ze;this.hex=null,this.posSigAlg=null,this.posRevCert=null,this._setPos=function(){var e=u(this.hex,0,[0,0]),t=this.hex.substr(e,2);if("02"==t)this.posSigAlg=1;else{if("30"!=t)throw new Error("malformed 1st item of TBSCertList: "+t);this.posSigAlg=0}var n,r=u(this.hex,0,[0,this.posSigAlg+3]),i=this.hex.substr(r,2);if("17"==i||"18"==i)n=u(this.hex,0,[0,this.posSigAlg+4]),this.posRevCert=null,-1!=n&&"30"==this.hex.substr(n,2)&&(this.posRevCert=this.posSigAlg+4);else if("30"==i)this.posRevCert=this.posSigAlg+3;else{if("a0"!=i)throw new Error("malformed nextUpdate or revCert tag: "+i);this.posRevCert=null}},this.getVersion=function(){return 0==this.posSigAlg?null:parseInt(a(this.hex,0,[0,0],"02"),16)+1},this.getSignatureAlgorithmField=function(){var e=s(this.hex,0,[0,this.posSigAlg],"30");return h.getAlgorithmIdentifierName(e)},this.getIssuer=function(){var e=s(this.hex,0,[0,this.posSigAlg+1],"30");return h.getX500Name(e)},this.getThisUpdate=function(){var e=a(this.hex,0,[0,this.posSigAlg+2]);return result=Fe(e)},this.getNextUpdate=function(){var e=u(this.hex,0,[0,this.posSigAlg+3]),t=this.hex.substr(e,2);return"17"!=t&&"18"!=t?null:Fe(r(this.hex,e))},this.getRevCertArray=function(){if(null==this.posRevCert)return null;for(var e=[],t=u(this.hex,0,[0,this.posRevCert]),n=l(this.hex,t),r=0;r<n.length;r++){var a=i(this.hex,n[r]);e.push(this.getRevCert(a))}return e},this.getRevCert=function(e){var t={},n=l(e,0);return t.sn={hex:a(e,0,[0],"02")},t.date=Fe(a(e,0,[1])),3==n.length&&(t.ext=h.getExtParamArray(s(e,0,[2]))),t},this.getSignatureValueHex=function(){return a(this.hex,0,[2],"03",!0)},this.verifySignature=function(e){var t=this.getSignatureAlgorithmField(),n=this.getSignatureValueHex(),r=s(this.hex,0,[0],"30"),i=new he.crypto.Signature({alg:t});return i.init(e),i.updateHex(r),i.verify(n)},this.getParam=function(){var e={},t=this.getVersion();null!=t&&(e.version=t),e.sigalg=this.getSignatureAlgorithmField(),e.issuer=this.getIssuer(),e.thisupdate=this.getThisUpdate();var n=this.getNextUpdate();null!=n&&(e.nextupdate=n);var r=this.getRevCertArray();if(null!=r&&(e.revcert=r),-1!=c(this.hex,0,[0,"[0]"])){var i=o(this.hex,0,[0,"[0]",0]);e.ext=h.getExtParamArray(i)}return e.sighex=this.getSignatureValueHex(),e},"string"==typeof e&&(t(e)?this.hex=e:e.match(/-----BEGIN X509 CRL/)&&(this.hex=$e(e)),this._setPos())},t.CryptoJS=g,t.b64tohex=w,t.b64toBA=x,t.ECFieldElementFp=oe,t.ECPointFp=ue,t.ECCurveFp=ce,t.stoBA=ge,t.BAtos=me,t.BAtohex=ve,t.stohex=ye,t.stob64=function(e){return b(ye(e))},t.stob64u=function(e){return be(b(ye(e)))},t.b64utos=function(e){return me(x(we(e)))},t.b64tob64u=be,t.b64utob64=we,t.hex2b64=b,t.hextob64u=xe,t.b64utohex=Se,t.utf8tob64u=fe,t.b64utoutf8=de,t.utf8tob64=function(e){return b(ke(Le(e)))},t.b64toutf8=function(e){return decodeURIComponent(Oe(w(e)))},t.utf8tohex=Ee,t.hextoutf8=Ae,t.hextorstr=Fe,t.rstrtohex=Ce,t.hextob64=De,t.hextob64nl=Re,t.b64nltohex=Ie,t.hextopem=Te,t.pemtohex=$e,t.hextoArrayBuffer=function(e){if(e.length%2!=0)throw"input is not even length";if(null==e.match(/^[0-9A-Fa-f]+$/))throw"input is not hexadecimal";for(var t=new ArrayBuffer(e.length/2),n=new DataView(t),r=0;r<e.length/2;r++)n.setUint8(r,parseInt(e.substr(2*r,2),16));return t},t.ArrayBuffertohex=function(e){for(var t="",n=new DataView(e),r=0;r<e.byteLength;r++)t+=("00"+n.getUint8(r).toString(16)).slice(-2);return t},t.zulutomsec=Pe,t.zulutosec=_e,t.zulutodate=function(e){return new Date(Pe(e))},t.datetozulu=function(e,t,n){var r,i=e.getUTCFullYear();if(t){if(i<1950||2049<i)throw"not proper year for UTCTime: "+i;r=(""+i).slice(-2)}else r=("000"+i).slice(-4);if(r+=("0"+(e.getUTCMonth()+1)).slice(-2),r+=("0"+e.getUTCDate()).slice(-2),r+=("0"+e.getUTCHours()).slice(-2),r+=("0"+e.getUTCMinutes()).slice(-2),r+=("0"+e.getUTCSeconds()).slice(-2),n){var a=e.getUTCMilliseconds();0!==a&&(r+="."+(a=(a=("00"+a).slice(-3)).replace(/0+$/g,"")))}return r+="Z"},t.uricmptohex=ke,t.hextouricmp=Oe,t.ipv6tohex=Be,t.hextoipv6=je,t.hextoip=He,t.iptohex=function(e){var t="malformed IP address";if(!(e=e.toLowerCase(e)).match(/^[0-9.]+$/)){if(e.match(/^[0-9a-f:]+$/)&&-1!==e.indexOf(":"))return Be(e);throw t}var n=e.split(".");if(4!==n.length)throw t;var r="";try{for(var i=0;i<4;i++){r+=("0"+parseInt(n[i]).toString(16)).slice(-2)}return r}catch(e){throw t}},t.ucs2hextoutf8=Ne,t.encodeURIComponentAll=Le,t.newline_toUnix=function(e){return e=e.replace(/\r\n/gm,"\n")},t.newline_toDos=function(e){return e=(e=e.replace(/\r\n/gm,"\n")).replace(/\n/gm,"\r\n")},t.hextoposhex=Ue,t.intarystrtohex=Ve,t.strdiffidx=function(e,t){var n=e.length;e.length>t.length&&(n=t.length);for(var r=0;r<n;r++)if(e.charCodeAt(r)!=t.charCodeAt(r))return r;return e.length!=t.length?n:-1},t.oidtohex=qe,t.hextooid=Ke,t.strpad=ze,t.bitstrtoint=Ge,t.inttobitstr=function(e){var t=Number(e).toString(2),n=8-t.length%8;8==n&&(n=0),t+=ze("",n,"0");var r=parseInt(t,2).toString(16);return r.length%2==1&&(r="0"+r),"0"+n+r},t.KJUR=he,t.crypto=he.crypto,t.asn1=he.asn1,t.jws=he.jws,t.lang=he.lang}).call(this,n(156).Buffer)},function(e,t,n){"use strict";n.r(t);n(144),n(145),n(146),n(147),n(148),n(149),n(151),n(153),n(154),n(19),n(155),n(7),n(13);function r(e,t,n){return{openSimpleModal:function(t){return e.open({templateUrl:t.warning?"js/angular/core/templates/modal/modal-warning.html":"js/angular/core/templates/modal/modal-simple.html",controller:"SimpleModalCtrl",size:t.size,resolve:{title:function(){return t.title},message:function(){return n.trustAsHtml(t.message)}}})},openCopyToClipboardModal:function(n){const r=e.open({templateUrl:"js/angular/core/templates/modal/copy-to-clipboard-modal.html",controller:"CopyToClipboardModalCtrl",resolve:{uri:function(){return n}}});return r.opened.then((function(){t((function(){$("#clipboardURI")[0].select()}),100)})),r}}}function i(e){return{getDetails:function(t){return e.get("rest/explore/details",{params:{uri:t},headers:{Accept:"application/json"}})},getGraph:function(t){const n=encodeURIComponent(t);return e.get("rest/explore/graph?uri="+n+"&role=subject",{headers:{Accept:"application/rdf+json"}})},getNamespaceUriForPrefix:function(e,t){let n="";for(let r=0;r<e.length;r++)if(e[r].prefix===t){n=e[r].uri;break}return n},getNamespacePrefixForUri:function(e,t){let n="";for(let r=0;r<e.length;r++)if(e[r].uri===t){n=e[r].prefix;break}return n},getLocalName:function(e){if(angular.isUndefined(e))return e;{let t;const n=e.length-1;let r=e.toString().lastIndexOf("/");r===n&&(t=e.substr(0,n),r=t.lastIndexOf("/"));let i=e.toString().lastIndexOf("#");return i===n&&(t=e.substr(0,n),i=t.lastIndexOf("/")),e.toString().substring(Math.max(i,r)+1)}}}}angular.module("graphdb.framework.core",["ui.bootstrap","jlareau.bowser","LocalStorageModule","graphdb.framework.core.controllers"]).provider("$menuItems",(function(){const e=function(t,n){for(let r=0;r<t.length;r++){const i=t[r];if(i.label===n)return i;const a=e(i.children,n);if(!angular.isUndefined(a))return a}},t=function(e,t){for(let n=0;n<e.length;n++){if(e[n].label===t)return!0}return!1},n=function(e,t){return e.order<t.order?-1:e.order>t.order?1:0},r=function(e,t){return{label:e.label,href:e.href,hrefFun:e.hrefFun,order:e.order,role:e.role,icon:e.icon,children:t}};let i;const a=[];this.addItem=function(n){if(angular.isUndefined(n.parent))t(a,n.label)||a.push(r(n,[]));else{const i=e(a,n.parent);angular.isUndefined(i)||t(i.children,n.label)||i.children.push(r(n,n.children?n.children:[]))}},this.$get=function(){a.sort(n);for(let e=0;e<a.length;e++){a[e].children.sort(n)}return a},this.setProductInfo=function(e){i=e},this.getProductInfo=function(){return i}})).factory("ModalService",r).factory("ClassInstanceDetailsService",i),r.$inject=["$modal","$timeout","$sce"],i.$inject=["$http"]},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){function n(e,t){return{get:function(t){return e.get(t)},set:function(t,n){e.set(t,n)},keys:n,remove:r,clearAll:function(){e.clearAll()},clearClassHieararchyState:function(){n().forEach((function(e){0!==e.indexOf("classHierarchy-")||e===t.CLASS_HIERARCHY_HIDE_PREFIXES||e.startsWith("classHierarchy-selectedGraph-")||r(e)}))}};function n(){return e.keys()}function r(t){e.remove(t)}}angular.module("graphdb.framework.utils.localstorageadapter",[]).factory("LocalStorageAdapter",n).value("LSKeys",{TABS_STATE:"tabs-state",TABS_STATE_CURRENT_ID:"tabs-state-currentid",TABS_STATE_MAXID:"tabs-state-maxid",VIEW_MODE:"viewMode",CLASS_HIERARCHY_HIDE_PREFIXES:"classHierarchy-hidePrefixes",CLASS_HIERARCHY_CURRENT_SLIDER_VALUE:"classHierarchy-currentSliderValue",CLASS_HIERARCHY_SWITCH_PREFIXES:"classHierarchy-switchPrefixes",CLASS_HIERARCHY_LAST_SELECTED_CLASS:"classHierarchy-lastSelectedClass",DOMAIN_RANGE_WENT_BACK:"domainRange-wentBack",DOMAIN_RANGE_COLLAPSE_EDGES:"domainRange-collapseEdges",HIDE_SIMILARITY_HELP:"hide-similarity-help",TUTORIAL_STATE:"tutorial-state",MENU_STATE:"menu-state",HIDE_GRAPH_CONFIG_HELP:"hide-graph-config-help",GRAPHS_VIZ:"graphs-viz",AUTOCOMPLETE_ENABLED:"autocomplete.enabled",RDF_SEARCH_TYPE:"rdf-search.search-type",RDF_SEARCH_INPUT:"rdf-search.search-input",RDF_SEARCH_EXPANDED_URI:"rdf-search.search-expanded-uri",RDF_RESOURCE_DESCRIPTION:"rdf-search.resource-description"}),n.$inject=["localStorageService","LSKeys"]},function(e,t){angular.module("graphdb.framework.rest.license.service",["ngFileUpload"]).factory("LicenseRestService",i),i.$inject=["$http","Upload"];const n="rest/graphdb-settings/license",r="rest/info/license/";function i(e,t){return{getLicenseInfo:function(){return e.get(n)},getHardcodedLicense:function(){return e.get(`${n}/hardcoded`)},sendLicenseToValidate:function(t){return e.post(`${r}validate`,t,{headers:{Accept:"application/json","Content-Type":"text/plain"}})},extractFromLicenseFile:function(e){return t.upload({url:`${r}toBase64`,file:e,headers:{Accept:"text/plain"}})},checkLicenseHardcoded:function(){return e.get(`${n}/hardcoded`)},registerLicense:function(t){const r=new Uint8Array(t.length);for(let e=0;e<r.length;e++)r[e]=t.charCodeAt(e);return e({method:"POST",url:n,headers:{"Content-Type":"application/octet-stream"},data:r,transformRequest:[]})},getInfo:function(){return e.get("rest/info/properties")},getVersion:function(){return e.get("rest/info/version")},getStatistics:function(){return e.get("rest/graphdb-settings/statistics")},toggleStatistics:function(t){return e({method:"POST",url:"rest/graphdb-settings/statistics",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:`enabled=${t}`})}}}},function(e,t){angular.module("graphdb.framework.rest.repositories.service",[]).factory("RepositoriesRestService",r),r.$inject=["$http"];const n="rest/repositories";function r(e){return{getRepositories:function(){return e.get(n)},getRepository:function(t){return e.get(`${n}/${t}`)},deleteRepository:function(t){return e.delete(`${n}/${t}`)},createRepository:function(t){return e.post(n,t)},editRepository:function(t,r){return e.put(`${n}/${t}`,r)},getRepositoryConfiguration:function(t){return e.get(`${n}/defaultConfig/${t}`)},getSize:function(t){return e.get(`${n}/${t}/size`)},getPrefix:function(t,r){return e.post(`${n}/${t}/prefix`,null,{params:r})},getCluster:function(){return e.get(`${n}/cluster`)},getRepositoryFileContent:function(t){return e.get(`${n}/getFileContent`,{params:{fileLocation:t}})},updateRepositoryFileContent:function(t,r){return e.post(`${n}/updateFile`,JSON.stringify(r),{params:{fileLocation:t}})},validateOntopPropertiesConnection:function(t){return e.post(`${n}/ontop/test-connection`,t)},restartRepository:function(t){return e.post(`${n}/${t}/restart`)},getSupportedDriversData:function(){return e.get(`${n}/ontop/drivers`)},updatePropertiesFile:function(t,r){return e.post(`${n}/ontop/jdbc-properties`,JSON.stringify(r),{params:{fileLocation:t}})},loadPropertiesFile:function(t){return e.get(`${n}/ontop/jdbc-properties`,{params:{fileLocation:t}})},getRepositoriesFromKnownLocation:function(t){return e.get(`${n}?location=${t}`)}}}},function(e,t,n){"use strict";n.r(t);n(4);function r(){return{template:function(e,t){return'<object width="'+t.size+'" height="'+t.size+'" data="js/angular/templates/loader/ot-loader.svg?v=1.10.2">Loading...</object>'}}}function i(){return{template:function(e,t){return'<object width="'+t.size+'" height="'+t.size+'" data="js/angular/templates/loader/ot-loader.svg?v=1.10.2"></object><div>Loading...<div>'}}}function a(e){const t=function(e,n){n.timer=void 0,n.currentMessage=n.getMessage();const r=n.timeout[n.index%n.timeout.length];r&&(n.timer=e((function(){(n.index+1<n.message.length||0===n.message.length)&&(n.index++,t(e,n))}),1e3*r))};return{restrict:"EA",scope:{size:"@",trigger:"@",messageAttr:"=*message",timeoutAttr:"=*timeout",ngShow:"=",ngHide:"="},link:function(n){n.message=n.messageAttr,n.getMessage=function(){return n.message[n.index]},void 0===n.message?n.message=[""]:"function"==typeof n.message?(n.getMessage=n.message,n.message=[]):"object"!=typeof n.message&&(n.message=[n.message]),n.timeout=n.timeoutAttr,void 0===n.timeout?n.timeout=[0]:"object"!=typeof n.timeout&&(n.timeout=[n.timeout]),n.index=0,t(e,n);const r=function(r){n.timer&&e.cancel(n.timer),r&&(n.index=0,t(e,n))};n.$watch("ngShow",(function(e){r(e)})),n.$watch("ngHide",(function(e){r(!e)})),n.$on("$destroy",(function(){n.timer&&e.cancel(n.timer)}))},template:'<div class="ot-loader-new-content"><img width="{{size}}" height="{{size}}" src="js/angular/templates/loader/ot-loader.svg?v=1.10.2"/><div style="font-size: {{size/4}}px">{{currentMessage}}<div></div>'}}function s(e){return{restrict:"EA",transclude:!0,templateUrl:"js/angular/core/templates/core-errors.html",link:function(t,n,r){let i;t.setAttrs(r),t.setRestricted(),t.getAccessibleRepositories=function(){return t.isRestricted?t.getWritableRepositories():t.getReadableRepositories()},t.showPopoverForRepo=function(n,r){t.hidePopoverForRepo(),t.setPopoverRepo(r),e((function(){const e=$(n.toElement).find(".popover-anchor")[0];i=e,e&&!t.getActiveRepository()&&e.dispatchEvent(new Event("show"))})),n.stopPropagation()},t.hidePopoverForRepo=function(t){if(t){let e=t.relatedTarget;for(;e;){if(0===e.className.indexOf("popover"))return;e=e.parentElement}}i&&e((function(){i&&(i.dispatchEvent(new Event("hide")),i=null)})),t&&t.stopPropagation()}}}}function o(){return function(e,t){$(t).click((function(e){e.preventDefault(),e.stopPropagation()}))}}function u(){return{restrict:"A",require:"ngModel",link:function(e,t,n,r){e.multiRequired||(e.multiRequired=[]);const i=n.multiRequireElement,a=function(t){i&&i%1==0&&(e.multiRequired[i-1]=t)},s=function(){let t=!1,n=!1;for(let r=0;r<e.multiRequired.length;r++)e.multiRequired[r]?t=!0:n=!0;r.$setValidity("multiRequire",!(t&&n))};r.$parsers.unshift((function(e){return a(e),s(),e})),r.$formatters.unshift((function(e){return a(e),s(),e})),$("[multi-required]").on("blur keyup change focusout",(function(){s()}))}}}angular.module("graphdb.framework.core.directives",["graphdb.framework.core.services.repositories","graphdb.framework.utils.localstorageadapter"]).directive("ontoLoader",r).directive("ontoLoaderFancy",i).directive("ontoLoaderNew",a).directive("coreErrors",s).directive("eatClick",o).directive("multiRequired",u).directive("searchResourceInput",l).directive("keyboardShortcuts",h),r.$inject=[],i.$inject=[],a.$inject=["$timeout"],s.$inject=["$timeout"],o.$inject=[],u.$inject=[];const c={table:"table",visual:"visual"};function l(e,t,n,r,i,a,s,o,u,l){return{restrict:"EA",scope:{namespacespromise:"=",autocompletepromisestatus:"=",textButton:"@",visualButton:"@",textCallback:"&",visualCallback:"&",placeholder:"@",uriValidation:"@",preserveInput:"@",empty:"=",clear:"=?clear",openInNewTab:"@",preserveSearch:"@",radioButtons:"@",clearInputIcon:"@"},templateUrl:"js/angular/core/templates/search-resource-input.html",link:function(i,h,f){h.autoCompleteStatus=void 0,h.autoCompleteWarning=!1,i.empty=!1,i.clear=!1,i.searchDisplayType=c;const d="true"===i.preserveSearch,p=h.find(".view-res-input");let g,m;i.textButtonLabel=i.textButton||"Table",i.visualButtonLabel=i.visualButton||"Visual",i.showClearInputIcon=!1,i.searchType=o.get(u.RDF_SEARCH_TYPE)||c.table,i.searchInput="",i.changeSearchType=function(e){i.searchType=e,o.set(u.RDF_SEARCH_TYPE,i.searchType)},i.clearInput=function(){i.searchInput="",i.selectedElementIndex=-1,i.autoCompleteUriResults=[],i.showClearInputIcon=!1,o.remove(u.RDF_SEARCH_INPUT),o.remove(u.RDF_SEARCH_EXPANDED_URI),o.remove(u.RDF_RESOURCE_DESCRIPTION)},i.$watch("namespacespromise",(function(){angular.isDefined(i.namespacespromise)&&i.namespacespromise.success((function(e){h.namespaces=e.results.bindings.map((function(e){return{prefix:e.prefix.value,uri:e.namespace.value}}))})).error((function(e){const n=getError(e);t.error(n,"Error getting namespaces for repository.")}))})),i.$watch("autocompletepromisestatus",(function(){!l.isActiveRepoFedXType()&&angular.isDefined(i.autocompletepromisestatus)&&i.autocompletepromisestatus.success((function(e){h.autoCompleteStatus=!!e,""!==i.searchInput&&i.onChange()})).error((function(){t.error("Error attempting to check autocomplete capability!")}))})),i.$watch("empty",(function(){d||(i.searchInput="",i.empty=!1)})),i.$watch("clear",(function(){i.clear&&(i.clearInput(),i.clear=!1)}));const v=function(t){const n=t.type||"uri";"true"===i.openInNewTab?b(!1,t):e.path("resource").search(n,t.uri)},y=function(t){const n=t.type||"uri";"true"===i.openInNewTab?b(!0,t):e.path("graphs-visualizations").search(n,t.uri)},b=function(e,t){const n=e?"graphs-visualizations":"resource";window.open(`${n}?uri=${encodeURIComponent(t.uri)}`)};angular.isUndefined(f.$attr.textCallback)&&(i.textCallback=v),angular.isUndefined(f.$attr.visualCallback)&&(i.visualCallback=y),f.$attr.textButton&&!i.textButton?i.textCallback=i.visualCallback:f.$attr.visualButton&&!i.visualButton&&(i.visualCallback=i.textCallback),f.$attr.placeholder?i.placeholder=f.$attr.placeholder:i.placeholder="Search RDF resources...",angular.isDefined(f.$attr.uriValidation)?i.uriValidation=f.$attr.uriValidation:i.uriValidation="true",angular.isDefined(f.$attr.preserveInput)&&(i.preserveInput=f.$attr.preserveInput),i.getResultItemHtml=function(e){return s.trustAsHtml(e.description)},i.searchRdfResource=function(e,t){if("prefix"===e.type)i.searchInput=E(e.value+":"),p.focus(),i.onChange();else{let n;n=angular.isUndefined(e)?i.searchInput:"object"==typeof e?e.value:e;let r="";if(e.description){const t=e.description.indexOf("<"+n+">");t>0&&(r=e.description.substring(0,t).replace(/<\/?b>/g,""))}t({uri:n,description:e.description,label:r,type:e.type}),d?(i.selectedElementIndex=i.activeSearchElm,o.set(u.RDF_SEARCH_EXPANDED_URI,g),o.set(u.RDF_SEARCH_INPUT,i.searchInput),o.set(u.RDF_RESOURCE_DESCRIPTION,e.description)):"true"===i.preserveInput?(i.searchInput=n,i.autoCompleteUriResults=[]):(i.searchInput="",i.autoCompleteUriResults=[])}},i.searchRdfResourceByEvent=function(e,t){i.searchType===c.visual||t.ctrlKey||t.metaKey?i.searchRdfResource(e,i.visualCallback):i.searchRdfResource(e,i.textCallback)};const w=function(e){const n=i.searchInput;""!==n?"false"!==i.uriValidation?h.autoCompleteStatus&&i.autoCompleteUriResults&&i.autoCompleteUriResults.length>0?"prefix"===i.autoCompleteUriResults[i.activeSearchElm].type?(i.searchInput=E(i.autoCompleteUriResults[i.activeSearchElm].value+":"),i.autoCompleteUriResults=[]):i.searchRdfResource(i.autoCompleteUriResults[i.activeSearchElm],e):S(n)?i.searchRdfResource(n,e):t.error("Invalid URI"):i.searchRdfResource(n,e):t.error("Please fill input field!")};function x(){let e=-1;const n=o.get(u.RDF_RESOURCE_DESCRIPTION);n&&i.autoCompleteUriResults&&(e=i.autoCompleteUriResults.findIndex(e=>e.description===n),i.selectedElementIndex=e,new Promise(e=>{const t=document.getElementById("auto-complete-results-wrapper").getBoundingClientRect();setTimeout(()=>{e(t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth))})}).then((function(){!function(){const e=$("#auto-complete-results-wrapper"),t=$("#auto_"+i.selectedElementIndex);e.animate({scrollTop:t.offset().top-e.offset().top+e.scrollTop()})}()})).catch((function(e){t.error(getError(e),"Could not find previous search element in menu!")}))),i.activeSearchElm=-1===e?0:e}function S(e){const t=e.indexOf("<")>=0&&e.indexOf(">")>=0,n=-1===e.indexOf("<")&&-1===e.lastIndexOf(">"),r=/^<?(http|urn).*>?/.test(e)&&(t||n);let i=!1;if(r)if(e.indexOf("http")>=0){const t=e.indexOf("//");i=t>4&&e.substring(t+2).length>0}else e.indexOf("urn")>=0&&(i=e.substring(4).length>0);return r&&i}function E(e){if(!/^<?(http|urn).*>?/.test(e)){const t=e.split(":"),r=t[0],i=t[1];if(!angular.isUndefined(i)){const e=n.getNamespaceUriForPrefix(h.namespaces,r);if(g=e!==g?e:g,g)return p.val(g),g+i}}return e}i.checkIfValidAndSearchText=function(){w(i.textCallback)},i.checkIfValidAndSearchVisual=function(){w(i.visualCallback)},i.checkIfValidAndSearchEvent=function(e){i.searchType===c.visual||e.ctrlKey||e.metaKey?w(i.visualCallback):w(i.textCallback)},i.onChange=function(){return i.showClearInputIcon=i.clearInputIcon,d&&o.set(u.RDF_SEARCH_INPUT,i.searchInput),"false"!==i.uriValidation&&(i.searchInput=E(i.searchInput),h.autoCompleteStatus)?function(e){let t=e.replace(g,g+";");if(h.autoCompleteStatus)return";"===t.charAt(0)&&(t=t.slice(1)),t=function(e){let t=e;if(-1===t.indexOf(";")&&S(t)){t=t.replace(/<|>/g,"");const e=/[^/^#]*$/.exec(t)[0];return t.split(e)[0]+";"+e}return t}(t),m&&m.resolve(),m=a.defer(),r.getAutocompleteSuggestions(t,m.promise).then((function(e){m=null,i.autoCompleteUriResults=e.data.suggestions,i.activeSearchElm=0}));return Promise.resolve()}(i.searchInput):Promise.resolve()},i.onKeyDown=function(e){if(13===e.keyCode?(e.preventDefault(),"false"!==i.uriValidation?h.autoCompleteStatus?i.checkIfValidAndSearchEvent(e):S(e.target.value)?i.searchRdfResourceByEvent(e.target.value,e):t.error("Invalid URI"):i.searchRdfResourceByEvent(e.target.value,e)):i.searchInput.length>0&&!h.autoCompleteWarning&&!h.autoCompleteStatus&&(h.autoCompleteWarning=!0,t.warning("",'<div class="autocomplete-toast"><a href="autocomplete">Autocomplete is OFF<br>Go to Setup -> Autocomplete</a></div>',{allowHtml:!0})),h.autoCompleteStatus&&!angular.isUndefined(i.autoCompleteUriResults)){if(40===e.keyCode&&i.activeSearchElm<i.autoCompleteUriResults.length-1&&(i.activeSearchElm++,i.searchInput=i.autoCompleteUriResults[i.activeSearchElm].value,function(){const e=$("#auto-complete-results-wrapper"),t=e.children("div"),n=e.children("div.active");void 0!==n[0]&&n[0].offsetTop-t.height()-6-e.scrollTop()>170&&e.scrollTop(n[0].offsetTop-t.height()-6-170)}()),38===e.keyCode&&i.activeSearchElm>0&&(e.preventDefault(),i.activeSearchElm--,i.searchInput=i.autoCompleteUriResults[i.activeSearchElm].value,function(){const e=$("#auto-complete-results-wrapper"),t=e.children("div"),n=e.children("div.active");void 0!==n[0]&&n[0].offsetTop-t.height()-40<=e.scrollTop()&&e.scrollTop(e.scrollTop()-34)}()),27===e.keyCode){if(d)return;i.searchInput="",i.autoCompleteUriResults=[]}i.searchInput||i.clearInput()}},i.$on("rdfResourceSearchExpanded",(function(){(d?(i.preserveInput="true",i.searchInput=o.get(u.RDF_SEARCH_INPUT)||"",g=o.get(u.RDF_SEARCH_EXPANDED_URI),i.onChange()):Promise.resolve()).then((function(){x()}))})),i.setActiveClassOnMouseMove=function(e){h.autoCompleteStatus&&(i.activeSearchElm=e)}}}}function h(e){return{restrict:"AE",link:function(t,n,r){function i(e){27===e.keyCode&&(t.toggleCheatSheet(),t.$apply())}t.getTemplateUrl=function(){return r.templateUrl},t.shortcutsVisible=!1,t.toggleCheatSheet=function(){t.shortcutsVisible=!t.shortcutsVisible,t.shortcutsVisible?e.on("keydown",i):e.off("keydown",i)}},template:'<ng-include src="getTemplateUrl()" />'}}l.$inject=["$location","toastr","ClassInstanceDetailsService","AutocompleteRestService","$rootScope","$q","$sce","LocalStorageAdapter","LSKeys","$repositories"],h.$inject=["$document"]},function(e,t,n){"use strict";n.r(t);n(2),n(6),n(21),n(5),n(25),n(26);angular.module("graphdb.framework.core.services.repositories",["ngCookies","graphdb.framework.rest.repositories.service","graphdb.framework.rest.locations.service","graphdb.framework.rest.license.service","toastr"]).service("$repositories",["$http","toastr","$rootScope","$timeout","$location","productInfo","$jwtAuth","RepositoriesRestService","LocationsRestService","LicenseRestService",function(e,t,n,r,i,a,s,o,u,c){this.repositoryStorageName="com.ontotext.graphdb.repository",this.location="",this.locationError="",this.loading=!0,this.repository=localStorage.getItem(this.repositoryStorageName),this.locations=[],this.repositories=[],this.locationsShouldReload=!1,this.degradedReason="";const l=this,h=function(e,n){l.loading=!1,e&&(l.location="",l.locationError=n,l.repositories=[],l.setRepository(""),e.statusText?t.error(e.statusText,"Error loading location"):t.error("Error loading location"))};this.resetActiveRepository=function(){let e=!1;for(let t=0;t<this.repositories.length;t++){if(this.repositories[t].id===this.repository){e=!0;break}}e?s.canReadRepo(this.location,this.repository)?n.$broadcast("repositoryIsSet",{newRepo:!1}):this.setRepository(""):this.setRepository(this.location.defaultRepository?this.location.defaultRepository:"")},this.checkActiveLocationDegraded=function(){if(this.degradedReason="",this.location.local)return;const e=this;c.getVersion().success((function(t){"object"==typeof t?t.productVersion!==a.productVersion?e.degradedReason="The remote location is running a different GraphDB version.":t.productType!==a.productType&&(e.degradedReason="The remote location is running a different GraphDB edition."):e.degradedReason="The remote location is running a different GraphDB version."})).error((function(){e.degradedReason="The remote location is running a different GraphDB version."}))},this.getDegradedReason=function(){return this.degradedReason},this.initQuick=function(){this.hasActiveLocation()&&this.init(null,null,!0)},this.init=function(e,t,r){r||(this.locationsShouldReload=!0),this.loading=!0,u.getActiveLocation().then((function(i){if(i.data){const r=i.data;r.active&&o.getRepositories().then((function(t){l.location=r,l.repositories=t.data,l.resetActiveRepository(),h(),l.checkActiveLocationDegraded(),n.globalLocation=l.location,n.globalRepositories=l.repositories,e&&e()}),(function(e){h(e,r.errorMsg),t&&t()}))}else h(),r&&(l.locationsShouldReload=!0),l.location="",l.locationError="",l.repositories=[],l.setRepository("");n.globalLocation=l.location,n.globalRepositories=l.repositories}),(function(e){h(e),t&&t()}))},this.getLocations=function(){if(this.locationsShouldReload){this.locationsShouldReload=!1,this.locations=[this.location];const e=this;u.getLocations().success((function(t){e.locations=t})).error((function(){r((function(){e.locationsShouldReload=!0}),2e3)}))}return this.locations},this.getActiveLocation=function(){return this.location},this.hasActiveLocation=function(){return!_.isEmpty(this.location)},this.getLocationError=function(){return this.locationError?this.locationError:"There is no active location"},this.isLoadingLocation=function(){return this.loading},this.getRepositories=function(){return this.repositories},this.getReadableRepositories=function(){const e=this;return _.filter(this.getRepositories(),(function(t){return s.canReadRepo(e.location,t.id)}))},this.getWritableRepositories=function(){const e=this;return _.filter(this.getRepositories(),(function(t){return s.canWriteRepo(e.location,t.id)&&!e.isActiveRepoOntopType(t.id)}))},this.getActiveRepository=function(){return this.repository},this.isSystemRepository=function(){return"SYSTEM"===this.repository},this.isActiveRepoOntopType=function(e){const t=this;e||(e=t.getActiveRepository());let n=t.repositories.find(t=>t.id===e);return n?"graphdb:OntopRepository"===n.sesameType:void 0===n},this.isActiveRepoFedXType=function(){const e=this;let t=e.repositories.find(t=>t.id===e.getActiveRepository());return t?"graphdb:FedXRepository"===t.sesameType:void 0===t},this.setRepositoryHeaders=function(){const t=this.repository?this.repository:void 0;e.defaults.headers.common["X-GraphDB-Repository"]=t,$.ajaxSetup().headers=$.ajaxSetup().headers||{},$.ajaxSetup().headers["X-GraphDB-Repository"]=t},this.setRepositoryHeaders(),this.setRepository=function(e){this.repository=e,e?localStorage.setItem(this.repositoryStorageName,this.repository):localStorage.removeItem(this.repositoryStorageName),this.setRepositoryHeaders(e),n.$broadcast("repositoryIsSet",{newRepo:!0}),e&&!s.canReadRepo(this.location,e)&&this.setRepository(""),n.deniedPermissions={}},this.getDefaultRepository=function(){return this.hasActiveLocation()?this.location.defaultRepository:""},this.setDefaultRepository=function(e){if(!this.hasActiveLocation())return void t.error("No active location","Error");const n=this;u.setDefaultRepository(e).success((function(){n.location.defaultRepository=e})).error((function(e){const n=getError(e);t.error(n,"Error")}))},this.deleteLocation=function(e){u.deleteLocation(encodeURIComponent(e)).success((function(){l.getActiveLocation().uri===e&&(l.location="",l.locationError="",l.setRepository("")),l.init()})).error((function(e){const n=getError(e);t.error(n,"Error")}))},this.deleteRepository=function(e){o.deleteRepository(e).success((function(){l.init()})).error((function(e){const n=getError(e);t.error(n,"Error")})),l.getActiveRepository()===e&&l.setRepository("")},this.restartRepository=function(e){o.restartRepository(e).success((function(){t.success(`Restarting repository ${e}`),l.initQuick()})).error((function(e){const n=getError(e);t.error(n,"Error")}))},this.getRepositoryTurtleConfig=function(t){return e.get("rest/repositories/"+t.id,{headers:{Accept:"text/turtle"}})},n.$on("securityInit",(function(e,t,n,r){(!t||n||r)&&l.init()}))}])},function(e,t,n){"use strict";n.r(t);n(2),n(17),n(18);var r=n(0);angular.module("graphdb.framework.core.services.jwtauth",["toastr","graphdb.framework.rest.security.service","graphdb.framework.core.services.openIDService"]).service("$jwtAuth",["$http","toastr","$location","$rootScope","SecurityRestService","$openIDAuth",function(e,t,n,i,a,s){const o=this;i.deniedPermissions={},i.setPermissionDenied=function(e){return!("/"===e||"/login"===e||!o.isAuthenticated())&&(i.deniedPermissions[e]=!0,!0)},i.hasPermission=function(){const e=n.path();return!i.deniedPermissions[e]},i.redirectToLogin=function(e,t){return o.authTokenIsType("Bearer")&&(e=!0),o.clearAuthenticationInternal(),0!==n.url().indexOf("/login")&&(i.returnToUrl=n.url()),n.path("/login"),t?n.search("noaccess"):e&&n.search("expired"),new Promise(e=>{setTimeout(()=>{e(!0)},100)})},i.hasExternalAuthUser=function(){return o.hasExternalAuthUser()},this.authStorageName="com.ontotext.graphdb.auth",this.securityEnabled=!0,this.freeAccess=!1,this.hasOverrideAuth=!1,this.externalAuthUser=!1,this.securityInitialized=!1;const u=this;this.clearStorage=function(){localStorage.removeItem(u.authStorageName)},this.getAuthenticatedUserFromBackend=function(e,t){a.getAuthenticatedUser().success((function(e,t,n){u.auth&&u.auth.startsWith("GDB")?(u.externalAuthUser=!1,u.principal=e,i.$broadcast("securityInit",u.securityEnabled,!0,u.freeAccess)):u.openIDEnabled&&u.auth&&u.auth.startsWith("Bearer")?u.authenticate(e,u.auth):(u.externalAuthUser=!0,u.authenticate(e,""))})).error((function(){e||!u.freeAccess?i.redirectToLogin(!1,t):(u.securityInitialized=!0,u.hasExplicitAuthentication()||u.clearAuthentication())}))},this.initSecurity=function(){this.securityInitialized=!1,this.auth=localStorage.getItem(this.authStorageName),a.getSecurityConfig().then((function(e){if(u.securityEnabled=e.data.enabled,u.externalAuth=e.data.hasExternalAuth,u.authImplementation=e.data.authImplementation,u.openIDEnabled=e.data.openIdEnabled,u.passwordLoginEnabled=e.data.passwordLoginEnabled,u.securityEnabled){const t=e.data.freeAccess;u.freeAccess=t.enabled,u.freeAccess&&(u.freeAccessPrincipal={authorities:t.authorities,appSettings:t.appSettings}),u.openIDEnabled?(u.openIDConfig=e.data.methodSettings.openid,u.gdbUrl=n.absUrl().replace(n.url().substr(1),""),s.initOpenId(u.openIDConfig,u.gdbUrl,(function(e){u.auth=s.authHeaderGraphDB(),o.setAuthHeaders(),console.log("oidc: set id/access token as GraphDB auth"),u.getAuthenticatedUserFromBackend(!0,e)}),(function(){console.log("oidc: not logged or login error"),u.authTokenIsType("Bearer")?setTimeout(()=>{i.redirectToLogin(!0)},0):u.getAuthenticatedUserFromBackend()}))):u.getAuthenticatedUserFromBackend()}else{u.clearStorage();const t=e.data.overrideAuth;u.hasOverrideAuth=t.enabled,u.hasOverrideAuth?(u.principal={username:"overrideauth",authorities:t.authorities,appSettings:t.appSettings},i.$broadcast("securityInit",u.securityEnabled,!0,u.hasOverrideAuth)):a.getAdminUser().then((function(e){u.principal={username:"admin",appSettings:e.data.appSettings,authorities:e.data.grantedAuthorities},i.$broadcast("securityInit",u.securityEnabled,!0,u.hasOverrideAuth)}))}}))},this.initSecurity(),this.isSecurityEnabled=function(){return this.securityEnabled},this.hasExternalAuth=function(){return this.externalAuth},this.getAuthImplementation=function(){return this.authImplementation},this.isFreeAccessEnabled=function(){return this.freeAccess},this.isDefaultAuthEnabled=function(){return this.hasOverrideAuth&&this.principal&&"overrideauth"===this.principal.username},this.getAuthToken=function(){return this.auth},this.authTokenIsType=function(e){return this.auth&&this.auth.startsWith(e)},this.loginOpenID=function(){s.login(this.openIDConfig,this.gdbUrl)},this.toggleSecurity=function(e){e!==this.securityEnabled&&(this.securityEnabled=e,a.toggleSecurity(e).then((function(){t.success("Security has been "+(e?"enabled.":"disabled.")),u.clearStorage(),u.initSecurity()}),(function(e){t.error(e.data.error.message,"Error")})))},this.toggleFreeAccess=function(e,n,r,s){(e!==this.freeAccess||s)&&(this.freeAccess=e,this.freeAccessPrincipal=e?{authorities:n,appSettings:r}:void 0,a.setFreeAccess({enabled:e?"true":"false",authorities:n,appSettings:r}).then((function(){s?t.success("Free access settings have been updated."):t.success("Free access has been "+(e?"enabled.":"disabled."))}),(function(e){t.error(e.data.error.message,"Error")})),i.$broadcast("securityInit",this.securityEnabled,this.hasExplicitAuthentication(),this.freeAccess))},this.setAuthHeaders=function(){return new Promise(t=>{const n=this.auth?this.auth:void 0;e.defaults.headers.common.Authorization=n,e.defaults.headers.common["X-Requested-With"]="XMLHttpRequest",$.ajaxSetup().headers=$.ajaxSetup().headers||{},$.ajaxSetup().headers.Authorization=n,$.ajaxSetup().headers["X-Requested-With"]="XMLHttpRequest",setTimeout(()=>{t(!0)})})},this.setAuthHeaders(),this.authenticate=function(e,t){return new Promise(n=>{u.clearStorage(),t&&(this.auth=t,localStorage.setItem(u.authStorageName,this.auth),this.externalAuthUser=!1),this.principal=e,i.deniedPermissions={},this.securityInitialized=!0,u.setAuthHeaders().then(()=>{i.$broadcast("securityInit",this.securityEnabled,u.hasExplicitAuthentication(),this.freeAccess)}),setTimeout(()=>{n(!0)})})},this.authenticateOpenID=function(e){this.clearStorage(),e&&(this.auth=e,localStorage.setItem(this.authStorageName,this.auth),this.externalAuthUser=!1)},this.hasExternalAuthUser=function(){return this.externalAuthUser},this.hasExplicitAuthentication=function(){return null!=this.auth||this.externalAuthUser},this.getPrincipal=function(){return this.principal},this.clearAuthenticationInternal=function(){s.softLogout(),this.auth=null,this.principal=this.freeAccessPrincipal,this.clearStorage(),this.setAuthHeaders()},this.clearAuthentication=function(){this.clearAuthenticationInternal(),i.$broadcast("securityInit",this.securityEnabled,!1,this.freeAccess)},this.isAuthenticated=function(){return!this.securityEnabled||this.hasExplicitAuthentication()},this.hasPermission=function(){},this.hasRole=function(e){if(void 0!==e&&(this.securityEnabled||this.hasOverrideAuth)){"string"==typeof e&&(e=[e]);const t=!_.isEmpty(this.principal);return!!t&&("IS_AUTHENTICATED_FULLY"===e[0]?t:_.intersection(e,this.principal.authorities).length>0)}return!0},this.isAdmin=function(){return this.hasRole(r.UserRole.ROLE_ADMIN)},this.checkForWrite=function(e,t,n){return"WRITE_REPO"===e?this.canWriteRepo(t,n):this.hasRole(e)},this.hasAdminRole=function(){return this.isAdmin()||this.hasRole(r.UserRole.ROLE_REPO_MANAGER)},this.canWriteRepo=function(e,t){return!_.isEmpty(e)&&!_.isEmpty(t)&&(!this.securityEnabled&&!this.hasOverrideAuth||!_.isEmpty(this.principal)&&(!!this.hasAdminRole()||this.checkRights(e,t,"WRITE")))},this.canReadRepo=function(e,t){return!_.isEmpty(e)&&!_.isEmpty(t)&&(!this.securityEnabled||!_.isEmpty(this.principal)&&(!!this.hasAdminRole()||this.checkRights(e,t,"READ")))},this.checkRights=function(e,t,n){for(let e=0;e<this.principal.authorities.length;e++){const r=this.principal.authorities[e],i=r.split("_",2),a=r.slice(i[0].length+i[1].length+2);if(i[0]===n&&(a===t||"SYSTEM"!==t&&"*"===a))return!0}return!1}}])},function(e,t){angular.module("graphdb.framework.rest.rdf4j.repositories.service",[]).factory("RDF4JRepositoriesRestService",a),a.$inject=["$http","$repositories"];const n="INSERT DATA { <u:a> <http://www.ontotext.com/owlim/system#startplugin> 'similarity' .}",r="select ?o where {\n?s <http://www.ontotext.com/owlim/system#listplugins> ?o .\nfilter(str(?s) = 'similarity')\n} ",i="repositories";function a(e,t){return{getNamespaces:function(t){return e.get(`${i}/${t}/namespaces`)},getRepositoryNamespaces:function(){return e.get(`${i}/${t.getActiveRepository()}/namespaces`)},updateNamespacePrefix:function(t,n,r){return e({url:`${i}/${t}/namespaces/${r}`,method:"PUT",data:n})},deleteNamespacePrefix:function(t,n){return e({url:`${i}/${t}/namespaces/${n}`,method:"DELETE"})},addStatements:function(t,n){return e({url:`${i}/${t}/statements`,method:"POST",data:n,headers:{"Content-Type":"application/x-www-form-urlencoded"}})},enableSimilarityPlugin:function(){return $.ajax({method:"POST",url:`${i}/${t.getActiveRepository()}/statements`,data:{update:n}})},checkSimilarityPluginEnabled:function(){return $.ajax({method:"GET",url:`${i}/${t.getActiveRepository()}`,data:{query:r}})},getRepositorySize:function(){return e.get(`${i}/${t.getActiveRepository()}/size`)},getGraphs:a,resolveGraphs:function(){const e=t.getActiveRepository();let n=[];if(e)return a(e).success((function(e){e.results.bindings.unshift({contextID:{type:"default",value:"The default graph"}}),Object.keys(e.results.bindings).forEach((function(t){const n=e.results.bindings[t];"bnode"===n.contextID.type?n.contextID.value=`_:${n.contextID.value}`:"default"===n.contextID.type?n.contextID.uri="http://www.openrdf.org/schema/sesame#nil":n.contextID.uri=n.contextID.value})),e.results.bindings.unshift(allGraphs),n=e.results.bindings}));return n}};function a(t){return e.get(`${i}/${t}/contexts`)}}},function(e,t){angular.module("graphdb.framework.rest.monitoring.service",[]).factory("MonitoringRestService",i),i.$inject=["$http"];const n="rest/monitor",r=`${n}/query`;function i(e){return{monitorResources:function(){return e.get(`${n}/resource`)},monitorGC:function(){return e.post(`${n}/resource/gc`)},monitorQuery:function(){return e.get(r)},abortQueryByAlias:function(t){return e.delete(`${r}?queryAlias=${encodeURIComponent(t)}`)},deleteQuery:function(t){return e.delete(`${r}?queryId=${encodeURIComponent(t)}`)},getQueryCount:function(){return e({url:`${r}/count`,method:"GET",timeout:1e4})},checkAutocompleteStatus:function(){return e.get("rest/autocomplete/enabled")}}}},function(e,t){angular.module("graphdb.framework.rest.sparql.service",[]).factory("SparqlRestService",i),i.$inject=["$http"];const n="rest/sparql",r=`${n}/saved-queries`;function i(e){return{getSavedQueries:function(){return e.get(r)},getSavedQuery:function(t,n){let i="";null!=n&&(i=`&owner=${encodeURIComponent(n)}`);return e.get(`${r}?name=${encodeURIComponent(t)}${i}`)},addKnownPrefixes:function(t){return e.post(`${n}/addKnownPrefixes`,t)},editSavedQuery:function(t){return e.put(r,t)},deleteSavedQuery:function(t){return e.delete(`${r}?name=${encodeURIComponent(t)}`)},addNewSavedQuery:function(t){return e.post(r,t)}}}},function(e,t){function n(e,t,n,r){e.title=n,e.message=r,e.ok=function(){t.close()},e.cancel=function(){t.dismiss("cancel")}}function r(e,t,n,r){e.clipboardURI=n,e.ok=function(){try{document.getElementById("clipboardURI").select(),document.execCommand("copy"),r.success("URL copied successfully to clipboard.")}catch(e){r.error('Your browser doesn\'t support "copy" operation.\nPress Ctrl-C / Cmd-C to copy URL manually.')}t.close()},e.cancel=function(){t.dismiss("cancel")}}function i(e,t,n,r){e.query=n,e.cancel=function(){t.dismiss("cancel")},e.selectQuery=function(){e.selectElement($("#create-query"))},e.copyQueryToClipboard=function(){try{e.selectQuery(),document.execCommand("copy"),t.close(),r.success("Query copied successfully to clipboard.")}catch(e){r.error('Your browser doesn\'t support "copy" operation.\nPress Ctrl-C / Cmd-C to copy query to clipboard manually.')}},e.selectElement=function(e){if(e.length>0)if(window.getSelection){const t=window.getSelection();t.removeAllRanges();const n=document.createRange();n.selectNodeContents(e[0].firstChild),t.addRange(n)}else if(document.selection){const t=document.body.createTextRange();t.moveToElementText(e[0]),t.select()}}}angular.module("graphdb.framework.core.controllers",[]).controller("CopyToClipboardModalCtrl",r).controller("SimpleModalCtrl",n).controller("ViewQueryCtrl",i),n.$inject=["$scope","$modalInstance","title","message"],r.$inject=["$scope","$modalInstance","uri","toastr"],i.$inject=["$scope","$modalInstance","query","toastr"]},function(e,t){angular.module("graphdb.framework.rest.autocomplete.service",[]).factory("AutocompleteRestService",s);const n="rest/autocomplete/",r=`${n}labels`,i=`${n}enabled`,a=`${n}iris`;function s(e){return{checkAutocompleteStatus:function(){return e.get(i)},refreshIndexStatus:function(){return e.get(`${n}status`)},refreshLabelConfig:function(){return e.get(r)},addLabelConfig:function(t){return e.put(r,t)},removeLabelConfig:function(t){return e.delete(r,{data:t,headers:{"Content-Type":"application/json;charset=utf-8"}})},toggleAutocomplete:function(t){return e.post(`${i}?enabled=${t}`)},refreshIndexIRIs:function(){return e.get(a)},toggleIndexIRIs:function(t){return e.post(`${a}?enabled=${t}`)},buildIndex:function(){return e.post(`${n}reIndex`)},interruptIndexing:function(){return e.post(`${n}interrupt`)},checkForPlugin:function(){return e.get(`${n}pluginFound`)},getAutocompleteSuggestions:function(t,r){return e.get(`${n}query`,{params:{q:t},timeout:r})}}}s.$inject=["$http"]},function(e,t,n){"use strict";n.r(t);n(2);angular.module("graphdb.framework.core.interceptors.unauthorized",["ngCookies"]).factory("$unauthorizedInterceptor",["$q","$location","$rootScope",function(e,t,n){return{responseError:function(r){let i=!1,a=!1;return 401===r.status?r.config.url.indexOf("rest/security/authenticatedUser")<0&&!n.hasExternalAuthUser()&&(i=!0):403===r.status?n.setPermissionDenied(t.path())?console.log("Permission to page denied. Some errors in the console are normal."):i=!0:409===r.status&&(i=!0,a=!0),i?Promise.resolve(n.redirectToLogin(a)).then(()=>e.reject(r)):e.reject(r)}}}])},,function(e,t,n){"use strict";n.r(t);var r=n(1);const i={headers:{"X-GraphDB-Repository":void 0,"X-Requested-With":void 0,Authorization:void 0}};angular.module("graphdb.framework.core.services.openIDService",["toastr"]).service("$openIDAuth",["$http","$location","$window","toastr",function(e,t,n,a){const s="com.ontotext.graphdb.openid.",o=this;function u(e){const t=[];for(let n in e)e.hasOwnProperty(n)&&t.push(`${n}=${encodeURIComponent(e[n])}`);return t.join("&")}this.login=function(e,t){const r=o.generateRandomString(),i=e.authFlow;if("code"===i){o.setStorageItem("pkce_state",r);const i=o.generateRandomString();o.setStorageItem("pkce_code_verifier",i);const a=o.pkceChallengeFromVerifier(i);n.location.href=o.getLoginUrl(r,a,t,e)}else"code_no_pkce"===i?(o.removeStorageItem("pkce_code_verifier"),n.location.href=o.getLoginUrl(r,"",t,e)):"implicit"===i?(o.setStorageItem("nonce",r),n.location.href=o.getLoginUrl(r,"",t,e)):(console.log("oidc: unknown auth flow: "+i),a.error("Unknown auth flow: "+i))},this.getLoginUrl=function(e,t,n,r){const i=[];let a="";switch(r.authFlow){case"code":a="code",i.push("state="+encodeURIComponent(e)),i.push("code_challenge="+encodeURIComponent(t)),i.push("code_challenge_method=S256");break;case"code_no_pkce":a="code";break;case"implicit":a="token id_token",i.push("nonce="+encodeURIComponent(e));break;default:throw new Error("Unknown authentication flow: "+r.authFlow)}return i.unshift(`response_type=${encodeURIComponent(a)}`,`scope=${encodeURIComponent(o.getScope(r.extraScopes))}`,`client_id=${encodeURIComponent(r.clientId)}`,`redirect_uri=${encodeURIComponent(n)}`),r.oracleDomain&&i.push(`domain=${encodeURIComponent(r.oracleDomain)}`),r.authorizeParameters&&i.push(r.authorizeParameters),`${r.oidcAuthorizationEndpoint}?${i.join("&")}`},this.withOpenIdKeys=function(t,n){e.get(t,i).success((function(e){o.openIdKeys={},e.keys.forEach((function(e){o.openIdKeys[e.kid]=e})),n()}))},this.initOpenId=function(e,t,r,s){o.clientId=e.clientId,o.tokenType=e.tokenType,o.idTokenAudience=e.clientId,o.idTokenIssuer=e.issuer,o.accessTokenAudience=e.tokenAudience,o.accessTokenIssuer=e.tokenIssuer,o.openIdTokenUrl=e.oidcTokenEndpoint;let u=e.oidcJwksUri;e.proxyOidc&&(u="rest/openid/jwks",o.openIdTokenUrl="rest/openid/token"),o.openIdEndSessionUrl=e.oidcEndSessionEndpoint,o.supportsOfflineAccess=e.oidcScopesSupported.includes("offline_access"),e.oracleDomain&&(i.headers["X-OAuth-Identity-Domain-Name"]=e.oracleDomain),o.withOpenIdKeys(u,(function(){if(o.isLoggedIn=o.hasValidIdToken(),o.isLoggedIn)o.setupTokensRefresh(!1,r,s);else if(o.hasValidRefreshToken())o.refreshTokens(r,s);else{const i=r;r=function(){o.isLoggedIn=!0,i(!0)},o.softLogout();const u=o.parseQueryString(n.location.search.substring(1));if(u.code)"code"===e.authFlow?o.getStorageItem("pkce_state")!==u.state?(a.error("Invalid pkce_state"),console.log("oidc: PKCE state mismatch "+o.getStorageItem("pkce_state")+" != "+u.state),s()):o.retrieveTokensByCode(u.code,t,r,s):"code_no_pkce"===e.authFlow&&o.retrieveTokensByCode(u.code,t,r,s);else{const e=o.parseQueryString(n.location.pathname.substring(1));e.id_token?o.saveTokens(e,!0,!1,r):s()}}}))},this.authHeaderGraphDB=function(){return"id"===o.getStorageItem("token_type")?"Bearer "+o.getToken("id"):"Bearer "+o.getToken("access")},this.softLogout=function(){o.isLoggedIn=!1,o.setToken("id",null),o.setToken("access",null),o.setToken("refresh",null)},this.hardLogout=function(e){o.softLogout(),o.openIdEndSessionUrl&&(n.location.href=`${o.openIdEndSessionUrl}?client_id=${encodeURIComponent(o.clientId)}&post_logout_redirect_uri=${encodeURIComponent(e)}`)},this.getToken=function(e){return o.getStorageItem(e+"_token")},this.setToken=function(e,t){t?o.setStorageItem(e+"_token",t):o.removeStorageItem(e+"_token")},this.tokenHeader=function(e){const t=o.getToken(e);if(t){try{const e=r.KJUR.jws.JWS.readSafeJSONString(Object(r.b64utoutf8)(t.split(".")[0]));if(e)return e}catch(e){}return{error:"not a JWT token: "+t}}return{}},this.verifyToken=function(e){const t=o.getToken(e),n=o.tokenHeader(e);if(!n.kid)return"id"!==e?n.error?(console.log(`oidc: token ${e} is not a JWT token (token considered valid)`),!0):(console.log(`oidc: invalid token ${e} (token is empty)`),!1):(console.log("oidc: invalid token id (not a JWT token)"),!1);const i=o.openIdKeys[n.kid];if(!i)return console.log("oidc: no key to verify JWT token (token considered invalid)"),!1;const a=r.KEYUTIL.getKey(i),s={alg:[n.alg],iss:[o.idTokenIssuer]};return"id"===e?(s.aud=[o.idTokenAudience,o.idTokenIssuer],s.nonce=[o.getStorageItem("nonce")]):"access"===e&&(s.aud=[o.accessTokenAudience],s.iss=[o.accessTokenIssuer]),r.KJUR.jws.JWS.verifyJWT(t,a,s)},this.hasValidIdToken=function(){return o.getToken("id")?o.verifyToken("id")?(console.log("oidc: valid id token found"),!0):(console.log("oidc: stale id token"),!1):(console.log("oidc: no id token"),!1)},this.tokenPayload=function(e){const t=o.getToken(e);if(t){try{const e=r.KJUR.jws.JWS.readSafeJSONString(Object(r.b64utoutf8)(t.split(".")[1]));if(e)return e}catch(e){}return{error:"not a JWT token: "+t}}return{}},this.saveTokens=function(e,n,r,i){(n||e.refresh_token)&&o.setToken("refresh",e.refresh_token),o.setToken("access",e.access_token),o.setToken("id",e.id_token),o.setStorageItem("token_type",o.tokenType),console.log("oidc: saved tokens"),o.setupTokensRefresh(n||r,i),o.removeStorageItem("pkce_state"),o.removeStorageItem("pkce_code_verifier"),n&&t.url("/")},this.retrieveTokensByCode=function(t,n,r,s){const c={grant_type:"authorization_code",client_id:o.clientId,redirect_uri:n,code:t},l=o.getStorageItem("pkce_code_verifier");l&&(c.code_verifier=l);const h={...i.headers,"Content-type":"application/x-www-form-urlencoded; charset=utf-8"};e({method:"POST",url:o.openIdTokenUrl,headers:h,transformRequest:u,data:c}).success((function(e){o.saveTokens(e,!0,!1,r)})).error((function(e){a.error("Cannot retrieve token after login; "+getError(e)),s()}))},this.refreshTokens=function(t,n){if(o.hasValidRefreshToken()){const r={grant_type:"refresh_token",client_id:o.clientId,refresh_token:o.getToken("refresh")},s={...i.headers,"Content-type":"application/x-www-form-urlencoded; charset=utf-8"};e({method:"POST",url:o.openIdTokenUrl,headers:s,transformRequest:u,data:r}).success((function(e){console.log("oidc: refreshed tokens"),o.saveTokens(e,!1,!0,t),o.isLoggedIn=!0})).error((function(e){console.log("oidc: could not refresh tokens"),a.error("Could not refresh OpenID token; "+getError(e)),n&&n()}))}else console.log("oidc: refresh requested without a valid refresh token")},this.hasValidRefreshToken=function(){const e=o.tokenPayload("refresh");return!(e.nbf&&1e3*e.nbf-Date.now()>5e3)&&(!(e.exp&&Date.now()-1e3*e.exp>5e3)&&!(!e.iat&&!e.error))},this.setupTokensRefresh=function(e,t,n){if(o.hasValidRefreshToken()){clearTimeout(o.previousTimer);const r=o.tokenPayload("id");if(r.exp>0){const i=1e3*r.exp-Date.now()-6e4;if(!(e||i>1e3))return o.previousTimer=null,console.log("oidc: tokens will refresh now, "+i+"; "+e),void o.refreshTokens(t,n);o.previousTimer=setTimeout((function(){o.refreshTokens(t)}),i),console.log("oidc: tokens will refresh in "+i/1e3+" seconds at "+new Date(Date.now()+i))}}else console.log("oidc: no valid refresh token");t()},this.parseQueryString=function(e){const t={access_token:null,code:null,id_token:null,state:null};return""===e?t:(e.split("&").map((function(e){return e.split("=")})).forEach((function(e){t[e[0]]=decodeURIComponent(e[1])})),t)},this.generateRandomString=function(){const e=new Uint32Array(28);return window.crypto.getRandomValues(e),Array.from(e,(function(e){return("0"+e.toString(16)).substr(-2)})).join("")},this.pkceChallengeFromVerifier=function(e){const t=new r.KJUR.crypto.MessageDigest({alg:"sha256",prov:"cryptojs"});return Object(r.hextob64u)(t.digestString(e))},this.getScope=function(e){let t="openid"+(o.supportsOfflineAccess?" offline_access":"");return e&&(t+=" "+e),console.log(`oidc: requesting scopes '${t}'`),t},this.setStorageItem=function(e,t){localStorage.setItem(s+e,t)},this.getStorageItem=function(e){return localStorage.getItem(s+e)},this.removeStorageItem=function(e){localStorage.removeItem(s+e)}}])},function(e,t){angular.module("graphdb.framework.rest.security.service",[]).factory("SecurityRestService",o),o.$inject=["$http"];const n="rest/security",r=`${n}/user`,i=`${n}/authenticatedUser`,a=`${n}/freeaccess`,s="rest/roles";function o(e){return{getUser:function(t){return e.get(`${r}/${encodeURIComponent(t)}`)},getAdminUser:function(){return e.get(`${r}/admin`)},getUsers:function(){return e.get(r)},createUser:function(t){return e({method:"POST",url:`${r}/${encodeURIComponent(t.username)}`,headers:{"X-GraphDB-Password":t.pass},data:{appSettings:t.appSettings,grantedAuthorities:t.grantedAuthorities}})},updateUser:function(t){return e({method:"PUT",url:`${r}/${encodeURIComponent(t.username)}`,headers:{"X-GraphDB-Password":t.pass},data:{appSettings:t.appSettings,grantedAuthorities:t.grantedAuthorities}})},updateUserData:function(t){return e({method:"PATCH",url:`${r}/${encodeURIComponent(t.username)}`,headers:{"X-GraphDB-Password":t.pass},data:{appSettings:t.appSettings}})},deleteUser:function(t){return e.delete(`${r}/${encodeURIComponent(t)}`)},getFreeAccess:function(){return e.get(a)},setFreeAccess:function(t){return e.post(a,t)},getSecurityConfig:function(){return e.get(`${n}/all`)},toggleSecurity:function(t){return e.post(n,t?"true":"false")},getRoles:function(){return e.get(s)},getRolesMapping:function(t){return e.get(`${s}/mapping`,{params:t})},getAuthenticatedUser:function(){return e.get(`${i}`)}}}},function(e,t){!function(e){e.getError=function(e,t,n){if(angular.isObject(e)&&e.status&&e.data)return getError(e.data,t,n);if(t&&403===t)return"Access is restricted";if(e){let r="Generic error";if(angular.isString(e))-1===e.indexOf("<html>")&&(r=e,r=r.replace(/^(([a-z0-9_]+\.)+[a-zA-Z0-9_]+: )+/,""));else if(angular.isObject(e)){if("message"in e&&(r=e.message),"error"in e&&(r=e.error.message),"responseJSON"in e&&"message"in e.responseJSON)return getError(e.responseJSON,t,n);"responseText"in e&&(r=e.responseText)}return n>0&&r.length>n&&(r=r.substr(0,n)+"..."),r}return"There is an error"}}(window)},function(e,t,n){"use strict";n.r(t);n(2),n(12),n(14),n(11),n(5),n(6),n(10),n(25),n(26),n(9),n(8);var r=n(0);n(4),n(22);function i(e,t,n,r,i,a,s,o,u){function c(){e.getActiveRepository()&&(e.getNamespacesPromise=u.getNamespaces(e.getActiveRepository()).success((function(){l()})))}function l(){e.getAutocompletePromise=a.checkAutocompleteStatus().success((function(){e.getActiveRepositorySize()}))}e.doClear=!1,e.getActiveRepositorySize=function(){const t=r.getActiveRepository();t&&(e.activeRepositorySizeError=void 0,o.getSize(t).then((function(t){e.activeRepositorySize=t.data})).catch((function(t){e.activeRepositorySizeError=t.data.message})))},e.$on("autocompleteStatus",(function(){l()})),e.$on("repositoryIsSet",c),e.$on("$routeChangeSuccess",(function(e,n,r){r&&(i.isAuthenticated()||i.isFreeAccessEnabled()?c():t.redirectToLogin())})),e.onKeyDown=function(t){27===t.keyCode&&(e.doClear=!0)}}function a(e,t,n,i,a,s,o,u,c,l,h,f,d,p,g,m,v,y,b,w){e.mainTitle="GraphDB",e.descr="An application for searching, exploring and managing GraphDB semantic repositories.",e.productTypeHuman="",e.documentation="",e.menu=t,e.tutorialState=1!==b.get(w.TUTORIAL_STATE),e.showLicense=!1,e.userLoggedIn=!1,e.embedded=s.search().embedded,e.productInfo=c;function x(){$(window).width()<=720?($(".container-fluid.main-container").addClass("expanded"),$(".main-menu").addClass("collapsed"),$(".main-menu .icon-caret-left").toggleClass("icon-caret-left").toggleClass("icon-caret-right"),$(".toggle-menu").hide()):$(window).width()>720&&"collapsedMenu"===b.get(w.MENU_STATE)?($(".container-fluid.main-container").addClass("expanded"),$(".main-menu").addClass("collapsed"),$(".toggle-menu").show(),$(".main-menu .icon-caret-left").toggleClass("icon-caret-left").toggleClass("icon-caret-right")):($(".container-fluid.main-container").removeClass("expanded"),$(".main-menu").removeClass("collapsed"),$(".toggle-menu").show(),$(".main-menu .icon-caret-right").toggleClass("icon-caret-right").toggleClass("icon-caret-left"))}!function(){const t=new Date;e.currentYear=t.getFullYear(),e.previousYear=2002}(),e.$on("$routeChangeSuccess",(function(t,n,r){e.clicked=!1,$(".menu-element-root").removeClass("active"),l((function(){$(".menu-element.open a.menu-element-root").addClass("active"),$(".main-menu.collapsed .menu-element.open .menu-element-root").addClass("active")}),400),r&&e.checkLicenseStatus()})),e.checkMenu=function(){return $(".main-menu").hasClass("collapsed")},e.copyToClipboard=function(e){h.openCopyToClipboardModal(e)},e.goToAddRepo=function(){s.path("/repository/create").search({previous:"home"})},e.goToEditRepo=function(e){s.path("repository/edit/"+e).search({previous:"home"})},e.$on("$locationChangeSuccess",(function(){e.showFooter="/"===s.url()})),e.$on("repositoryIsSet",(function(){e.setRestricted(),b.clearClassHieararchyState()})),e.graphdbVersion=e.engineVersion=c.productVersion,e.workbenchVersion=c.Workbench,e.connectorsVersion=c.connectors,e.sesameVersion=c.sesame,e.productType=c.productType,"standard"===e.productType?(e.productTypeHuman="Standard",e.documentation="standard/"):"enterprise"===e.productType?(e.productTypeHuman="Enterprise",e.documentation="enterprise/"):"free"===e.productType&&(e.productTypeHuman="Free",e.documentation="free/"),e.mainTitle=e.productTypeHuman,e.select=function(t,n,r){$(".main-menu").hasClass("collapsed")?$(n.target).parents(".menu-element").children(".menu-element-root").hasClass("active")?(e.selected=t,e.clicked=!r):(!$(n.target).parents(".menu-element").hasClass("open")&&r?e.clicked=!0:e.clicked=!r,e.selected===t?e.selected=-1:e.selected=t):(!$(n.target).parents(".menu-element").hasClass("open")&&r?e.clicked=!0:e.clicked=!r,0!==$(n.target).parent(".menu-element").find(".sub-menu").length?($(n.target).parents(".menu-element").children(".menu-element-root").hasClass("active")?$(".sub-menu li.active").parents(".menu-element").children(".menu-element-root").removeClass("active"):$(".sub-menu li.active").parents(".menu-element").children(".menu-element-root").addClass("active"),e.selected===t?e.selected=-1:e.selected=t):(l((function(){$(n.target).parents(".menu-element").children(".menu-element-root").addClass("active")}),50),e.selected=t))},$("body").bind("click",(function(t){!$(t.target).parents(".main-menu").length&&$(".main-menu").hasClass("collapsed")&&(e.clicked=!1,e.selected=-1)})),e.isCurrentPath=function(e){return s.path()==="/"+e},e.isCurrentSubmenuChildPath=function(t){return 0!==t.children.length&&t.children.some((function(t){return e.isCurrentPath(t.href)}))},"/"===s.path()?e.selected=-1:(l((function(){const t=s.path().replace("/",""),n=$('a[href^="'+t+'"]');e.selected=n.closest(".menu-element").index()-1}),200),e.isCurrentPath(s.path())),e.popoverTemplate="js/angular/templates/repositorySize.html",e.securityEnabled=!0,e.isSecurityEnabled=function(){return n.isSecurityEnabled()},e.isFreeAccessEnabled=function(){return n.isFreeAccessEnabled()},e.hasExternalAuthUser=function(){return n.hasExternalAuthUser()},e.isDefaultAuthEnabled=function(){return n.isDefaultAuthEnabled()},e.isS4=function(){return e.license&&"S4"===e.license.version},e.isUserLoggedIn=function(){return e.userLoggedIn},e.getLocations=function(){return o.getLocations()},e.hasActiveLocation=function(){return o.hasActiveLocation()},e.getActiveLocation=function(){return o.getActiveLocation()},e.isLoadingLocation=function(){return o.isLoadingLocation()},e.getRepositories=function(){return o.getRepositories()},e.getReadableRepositories=function(){return o.getReadableRepositories()},e.getWritableRepositories=function(){return o.getWritableRepositories()},e.getActiveRepository=function(){return o.getActiveRepository()},e.canWriteRepoInActiveLocation=function(e){return n.canWriteRepo(o.getActiveLocation(),e)},e.canWriteActiveRepo=function(e){const t=o.getActiveRepository();return n.canWriteRepo(o.getActiveLocation(),t)&&("SYSTEM"!==t||!e)},e.getActiveRepositoryObject=function(){return _.find(e.getRepositories(),(function(t){return t.id===e.getActiveRepository()}))},e.isActiveRepoOntopType=function(){return o.isActiveRepoOntopType()},e.isActiveRepoFedXType=function(){return o.isActiveRepoFedXType()},e.setAttrs=function(t){e.attrs=t},e.setRestricted=function(){e.attrs&&(e.isRestricted=e.attrs.hasOwnProperty("write")&&e.isSecurityEnabled()&&!e.canWriteActiveRepo()||e.attrs.hasOwnProperty("ontop")&&e.isActiveRepoOntopType()||e.attrs.hasOwnProperty("fedx")&&e.isActiveRepoFedXType())},e.toHumanReadableType=function(e){switch(e){case"worker":return"EE Worker";case"master":return"EE Master";case"se":return"Standard";case"free":return"Free";case"system":return"System";case"ontop":return"Ontop";case"fedx":return"FedX";default:return"Unknown"}},e.setRepository=function(e){o.setRepository(e)},e.principal=function(){return n.getPrincipal()},e.isIgnoreSharedQueries=function(){return n.getPrincipal()&&n.getPrincipal().appSettings.IGNORE_SHARED_QUERIES},e.logout=function(){n.clearAuthentication(),a.success("Signed out"),n.freeAccess?o.resetActiveRepository():n.isSecurityEnabled()&&u.redirectToLogin()},e.isAdmin=function(){return e.hasRole(r.UserRole.ROLE_ADMIN)},e.isUser=function(){return e.hasRole(r.UserRole.ROLE_USER)},e.hasRole=function(e){return!!angular.isUndefined(e)||n.hasRole(e)},e.hasPermission=function(){return u.hasPermission()},e.canReadRepo=function(e,t){return n.canReadRepo(e,t)},e.checkForWrite=function(e,t,r){return n.checkForWrite(e,t,r)},e.setPopoverRepo=function(t){e.popoverRepo=t},e.getRepositorySize=function(){e.repositorySize={},e.popoverRepo&&(e.repositorySize.loading=!0,g.getSize(e.popoverRepo.id).then((function(t){e.repositorySize=t.data})))},e.getDegradedReason=function(){return o.getDegradedReason()},e.canManageRepositories=function(){return n.hasRole(r.UserRole.ROLE_REPO_MANAGER)&&!o.getDegradedReason()},e.getSavedQueries=function(){v.getSavedQueries().success((function(t){e.sampleQueries=t})).error((function(e){const t=getError(e);a.error(t,"Error! Could not get saved queries")}))},e.goToSparqlEditor=function(e){s.path("/sparql").search({savedQueryName:e.name,owner:e.owner,execute:!0})},e.declineTutorial=function(){$(".tutorial-container").slideUp("slow",(function(){b.set(w.TUTORIAL_STATE,1),e.tutorialState=!1}))},e.initTutorial=function(){if(!e.tutorialState&&"/"!==s.path())return;e.tutorialInfo=[{title:"Welcome to GraphDB",info:"GraphDB is a graph database compliant with RDF and SPARQL specifications. It supports open APIs based on RDF4J (ex-Sesame) project and enables fast publishing of linked data on the web. The Workbench is used for searching, exploring and managing GraphDB semantic repositories. This quick tutorial will guide you through the basics: <br><ul><li>(1) Create a repository</li><li>(2) Load a sample dataset</li><li>(3) Run a SPARQL query</li></ul>You can always come back to this tutorial by pressing the GraphDB icon in the top left corner."},{title:"Create a repository",info:'Now let’s create your first repository. Go to Setup > Repositories and press Create new repository button. Fill the field Repository ID and press enter. The default repository parameters are optimized for datasets up to 100 million RDF statements. If you plan to load more check for more information: <a href="https://graphdb.ontotext.com/documentation/'+e.productType+'/configuring-a-repository.html" target="_blank">Configuring a repository</a>'},{title:"Load a sample dataset",info:"GraphDB includes a sample dataset in the distribution under the directory examples/data/news. The dataset represents new articles semantically enriched with structured information from Wikipedia. To load the data go to Import > RDF and select the local files. "},{title:"Run a SPARQL query",info:"You can find a list of sample SPARQL queries under examples/data/news/queries.txt demonstrating how to find interesting searches of news articles and the mentioned entities like: <br><ul><li>(1) Give me articles about persons born in New York</li><li>(2) Show me all occupations of every person in the news</li><li>(3) List me the members of a specific political party</li></ul>"},{title:"REST API",info:"GraphDB allows you to perform every operation also via a REST API or by using language specific RDF4J client application. To see the full list of supported functionality go to Help > REST API or check the sample code under examples/developer-getting-started/\nHave fun!"}],e.activePage=0,$(".pages-wrapper .page-slide").css("opacity",100);const t=$(".main-container")[0].offsetWidth+200;l((function(){const n=$(".pages-wrapper .page-slide");n.css("left",t+"px"),$(n[e.activePage]).css("left","0px"),$($(".btn-toolbar.pull-right .btn-group .btn")[0]).focus()}),50)},e.getTutorialPageHtml=function(e){return y.trustAsHtml(e.info)},e.checkSubMenuPosition=function(e){0===e?$(".main-menu.collapsed .sub-menu").removeClass("align-bottom"):$(window).height()<735?$(".main-menu.collapsed .sub-menu").addClass("align-bottom"):$(".main-menu.collapsed .sub-menu").removeClass("align-bottom")},x(),$(window).resize((function(){angular.isDefined(e.menuState)?$(window).width()<=720?($(".container-fluid.main-container").addClass("expanded"),$(".main-menu").addClass("collapsed"),$(".toggle-menu").hide(),$(".main-menu .icon-caret-left").toggleClass("icon-caret-left").toggleClass("icon-caret-right")):$(window).width()>720&&e.menuState?$(".toggle-menu").show():($(".container-fluid.main-container").removeClass("expanded"),$(".main-menu").removeClass("collapsed"),$(".toggle-menu").show(),$(".main-menu .icon-caret-right").toggleClass("icon-caret-right").toggleClass("icon-caret-left")):x(),e.tutorialState&&"/"===s.path()&&e.initTutorial(),$(window).height()<735?($(".sub-menu").addClass("align-bottom"),$(".main-menu.collapsed li:nth-child(2) .sub-menu").removeClass("align-bottom")):$(".sub-menu").removeClass("align-bottom")})),e.slideToPage=function(t){const n=$(".main-container")[0].offsetWidth,r=$(".pages-wrapper .page-slide");r.css("opacity","0").delay(200).css("left",n+"px"),e.activePage=t,$(r[e.activePage]).css("opacity","100").css("left","0px")},e.slideNext=function(){let t=++e.activePage;t>=e.tutorialInfo.length&&(t=0),e.slideToPage(t),$($(".btn-toolbar.pull-right .btn-group .btn")[e.activePage]).focus()},e.toggleNavigation=function(){const t=$(".main-menu"),n=$(".sub-menu li.active");if(t.hasClass("collapsed"))n.parents(".menu-element").hasClass("open")?n.parents(".menu-element").children(".menu-element-root").removeClass("active"):n.parents(".menu-element").children(".menu-element-root").addClass("active"),$(".container-fluid.main-container").removeClass("expanded"),t.removeClass("collapsed"),$(".main-menu .icon-caret-right").toggleClass("icon-caret-right").toggleClass("icon-caret-left"),u.$broadcast("onToggleNavWidth",!1);else{n.parents(".menu-element").children(".menu-element-root").addClass("active");const r=$(".menu-element");r.hasClass("open")&&(r.removeClass("open"),e.clicked=!1,e.selected=-1),$(".container-fluid.main-container").addClass("expanded"),t.addClass("collapsed"),$(".main-menu .icon-caret-left").toggleClass("icon-caret-left").toggleClass("icon-caret-right"),$(".main-menu.collapsed .menu-element.clicked").removeClass("clicked"),u.$broadcast("onToggleNavWidth",!0)}},e.$on("onToggleNavWidth",(function(t,n){if(e.menuState=n,n?b.set(w.MENU_STATE,"collapsedMenu"):b.set(w.MENU_STATE,"expandedMenu"),e.tutorialState&&"/"===s.path()){const t=$(".pages-wrapper")[0].offsetWidth+200;l((function(){const n=$(".pages-wrapper .page-slide");n.css("left",t+"px"),$(n[e.activePage]).css("left","0px")}),50)}})),e.numberOfActiveImports=0,e.getNumberOfActiveImportsRunning=!1,e.getNumberOfActiveImports=function(){e.getNumberOfActiveImportsRunning||e.canWriteActiveRepo()&&"SYSTEM"!==e.getActiveRepository()&&(e.getNumberOfActiveImportsRunning=!0,i({method:"GET",url:"rest/data/import/active/"+e.getActiveRepository(),timeout:1e4}).success((function(t){e.numberOfActiveImports=t})).finally((function(){e.getNumberOfActiveImportsRunning=!1})))},e.getQueriesRunning=!1,e.skipGetQueriesTimes=0;const S=function(){let e=0,t=1;return{next:function(){const n=t;return t=e+t,e=n,n},reset:function(){e=0,t=1}}}();e.getQueries=function(){e.getQueriesRunning||(e.skipGetQueriesTimes>0?e.skipGetQueriesTimes--:o.getActiveRepository()&&"SYSTEM"!==o.getActiveRepository()&&!o.isActiveRepoOntopType()&&e.hasRole(r.UserRole.ROLE_USER)?(e.getQueriesRunning=!0,m.getQueryCount().success((function(t){e.queryCount=t,S.reset()})).error((function(){e.queryCount=0,e.skipGetQueriesTimes=S.next()})).finally((function(){e.getQueriesRunning=!1}))):e.queryCount=0)};const E=f((function(){e.getDegradedReason()||(e.getQueries(),e.getNumberOfActiveImports())}),2e3);e.$on("$destroy",(function(){f.cancel(E)})),n.securityInitialized&&e.getSavedQueries(),e.$on("securityInit",(function(t,n,r,i){e.securityEnabled=n,e.userLoggedIn=r,!n||r||i?(e.checkLicenseStatus(),e.getSavedQueries()):"/login"!==s.path()&&u.redirectToLogin()})),e.checkLicenseStatus=function(){p.getHardcodedLicense().success((function(t){e.isLicenseHardcoded="true"===t})).error((function(){e.isLicenseHardcoded=!0})).then((function(){p.getLicenseInfo().then((function(t){e.license=t.data,e.showLicense=!0}),(function(){e.license={message:"No license was set.",valid:!1},e.showLicense=!0}))}))},e.getHumanReadableSeconds=function(e,t){const n=Math.floor(e/86400),r=Math.floor(e%86400/3600),i=Math.floor(e%3600/60);let a;a=t&&e<10?e<1?_.ceil(e%60,1):_.round(e%60,1):_.round(e%60,0);let s="";return n&&(s+=n+"d "),(n||r)&&(s+=r+"h "),(n||r||i)&&(s+=i+"m "),s+=a+"s",s.replace(/( 0[a-z])+$/,"")},e.getHumanReadableTimestamp=function(e){const t=Date.now(),n=(t-e)/1e3;if(n<60)return"moments ago";if(n<600)return"minutes ago";{const r=new Date(t),i=new Date(e);if(r.getYear()===i.getYear()&&r.getMonth()===i.getMonth()&&r.getDate()===i.getDate())return d("date")(e,"'today at' HH:mm");if(n<86400)return d("date")(e,"'yesterday at' HH:mm")}return d("date")(e,"'on' yyyy-MM-dd 'at' HH:mm")}}function s(e,t,n){e.getRepositorySize=function(t){n.getSize(t).then((function(t){e.size=t.data}))}}angular.module("graphdb.workbench.se.controllers",["graphdb.framework.core.services.jwtauth","graphdb.framework.core.services.repositories","ngCookies","ngFileUpload","graphdb.framework.core","graphdb.framework.core.controllers","graphdb.framework.core.directives","graphdb.framework.rest.license.service","graphdb.framework.rest.autocomplete.service","graphdb.framework.rest.repositories.service","graphdb.framework.rest.sparql.service","graphdb.framework.rest.autocomplete.service","graphdb.framework.rest.monitoring.service","graphdb.framework.rest.rdf4j.repositories.service","graphdb.framework.utils.localstorageadapter","graphdb.framework.core.services.autocompleteStatus"]).controller("mainCtrl",a).controller("homeCtrl",i).controller("repositorySizeCtrl",s),i.$inject=["$scope","$rootScope","$http","$repositories","$jwtAuth","AutocompleteRestService","LicenseRestService","RepositoriesRestService","RDF4JRepositoriesRestService"],a.$inject=["$scope","$menuItems","$jwtAuth","$http","toastr","$location","$repositories","$rootScope","productInfo","$timeout","ModalService","$interval","$filter","LicenseRestService","RepositoriesRestService","MonitoringRestService","SparqlRestService","$sce","LocalStorageAdapter","LSKeys"],s.$inject=["$scope","$http","RepositoriesRestService"]},function(e,t){angular.module("graphdb.framework.rest.locations.service",[]).factory("LocationsRestService",i),i.$inject=["$http"];const n="rest/locations",r=`${n}/active`;function i(e){return{getLocations:function(){return e.get(n)},addLocation:function(t){return e.post(n,t)},editLocation:function(t){return e.put(n,t)},deleteLocation:function(t){return e.delete(`${n}?uri=${t}`)},enableLocation:function(t){return e.post(`${n}/activate`,t)},getActiveLocation:function(){return e({method:"GET",url:`${r}`,noCancelOnRouteChange:!0})},setDefaultRepository:function(t){return e({url:`${r}/default-repository`,method:"POST",data:{defaultRepository:t}})}}}},function(e,t){angular.module("graphdb.framework.core.services.autocompleteStatus",[]).service("$autocompleteStatus",["$rootScope","AutocompleteRestService","LocalStorageAdapter","LSKeys",function(e,t,n,r){const i=this;this.setAutocompleteStatus=function(t){n.set(r.AUTOCOMPLETE_ENABLED,t),e.$broadcast("autocompleteStatus",t)},e.$watch((function(){return n.get(r.AUTOCOMPLETE_ENABLED)}),(function(e){i.setAutocompleteStatus(e)}),!0),e.$on("repositoryIsSet",(function(){t.checkAutocompleteStatus().success((function(e){i.setAutocompleteStatus(e)}))}))}])},function(e,t){
|
|
28
28
|
/**
|
|
29
29
|
* angular-cancel-on-navigate - AngularJS module that cancels HTTP requests on location change (navigation)
|
|
30
30
|
* @version v0.1.0
|
|
@@ -38,7 +38,7 @@ angular.module("angularCancelOnNavigateModule",[]).config(["$httpProvider",funct
|
|
|
38
38
|
/*! 12.2.13 */
|
|
39
39
|
!window.XMLHttpRequest||window.FileAPI&&FileAPI.shouldLoad||(window.XMLHttpRequest.prototype.setRequestHeader=(n=window.XMLHttpRequest.prototype.setRequestHeader,function(e,t){if("__setXHR_"===e){var r=t(this);r instanceof Function&&r(this)}else n.apply(this,arguments)}));var r=angular.module("ngFileUpload",[]);r.version="12.2.13",r.service("UploadBase",["$http","$q","$timeout",function(e,t,n){function i(r){function i(e){c.notify&&c.notify(e),l.progressFunc&&n((function(){l.progressFunc(e)}))}function a(e){return null!=r._start&&o?{loaded:e.loaded+r._start,total:r._file&&r._file.size||e.total,type:e.type,config:r,lengthComputable:!0,target:e.target}:e}function u(){e(r).then((function(e){if(o&&r._chunkSize&&!r._finished&&r._file){var t=r._file&&r._file.size||0;i({loaded:Math.min(r._end,t),total:t,config:r,type:"progress"}),s.upload(r,!0)}else r._finished&&delete r._finished,c.resolve(e)}),(function(e){c.reject(e)}),(function(e){c.notify(e)}))}r.method=r.method||"POST",r.headers=r.headers||{};var c=r._deferred=r._deferred||t.defer(),l=c.promise;return r.disableProgress||(r.headers.__setXHR_=function(){return function(e){e&&e.upload&&e.upload.addEventListener&&(r.__XHR=e,r.xhrFn&&r.xhrFn(e),e.upload.addEventListener("progress",(function(e){e.config=r,i(a(e))}),!1),e.upload.addEventListener("load",(function(e){e.lengthComputable&&(e.config=r,i(a(e)))}),!1))}}),o?r._chunkSize&&r._end&&!r._finished?(r._start=r._end,r._end+=r._chunkSize,u()):r.resumeSizeUrl?e.get(r.resumeSizeUrl).then((function(e){r._start=r.resumeSizeResponseReader?r.resumeSizeResponseReader(e.data):parseInt((null==e.data.size?e.data:e.data.size).toString()),r._chunkSize&&(r._end=r._start+r._chunkSize),u()}),(function(e){throw e})):r.resumeSize?r.resumeSize().then((function(e){r._start=e,r._chunkSize&&(r._end=r._start+r._chunkSize),u()}),(function(e){throw e})):(r._chunkSize&&(r._start=0,r._end=r._start+r._chunkSize),u()):u(),l.success=function(e){return l.then((function(t){e(t.data,t.status,t.headers,r)})),l},l.error=function(e){return l.then(null,(function(t){e(t.data,t.status,t.headers,r)})),l},l.progress=function(e){return l.progressFunc=e,l.then(null,null,(function(t){e(t)})),l},l.abort=l.pause=function(){return r.__XHR&&n((function(){r.__XHR.abort()})),l},l.xhr=function(e){return r.xhrFn=function(t){return function(){t&&t.apply(l,arguments),e.apply(l,arguments)}}(r.xhrFn),l},s.promisesCount++,l.finally&&l.finally instanceof Function&&l.finally((function(){s.promisesCount--})),l}function a(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}var s=this;s.promisesCount=0,this.isResumeSupported=function(){return window.Blob&&window.Blob.prototype.slice};var o=this.isResumeSupported();this.isUploadInProgress=function(){return s.promisesCount>0},this.rename=function(e,t){return e.ngfName=t,e},this.jsonBlob=function(e){null==e||angular.isString(e)||(e=JSON.stringify(e));var t=new window.Blob([e],{type:"application/json"});return t._ngfBlob=!0,t},this.json=function(e){return angular.toJson(e)},this.isFile=function(e){return null!=e&&(e instanceof window.Blob||e.flashId&&e.name&&e.size)},this.upload=function(e,t){function n(t,n){if(t._ngfBlob)return t;if(e._file=e._file||t,null!=e._start&&o){e._end&&e._end>=t.size&&(e._finished=!0,e._end=t.size);var r=t.slice(e._start,e._end||t.size);return r.name=t.name,r.ngfName=t.ngfName,e._chunkSize&&(n.append("_chunkSize",e._chunkSize),n.append("_currentChunkSize",e._end-e._start),n.append("_chunkNumber",Math.floor(e._start/e._chunkSize)),n.append("_totalSize",e._file.size)),r}return t}function r(t,i,a){if(void 0!==i)if(angular.isDate(i)&&(i=i.toISOString()),angular.isString(i))t.append(a,i);else if(s.isFile(i)){var o=n(i,t),u=a.split(",");u[1]&&(o.ngfName=u[1].replace(/^\s+|\s+$/g,""),a=u[0]),e._fileKey=e._fileKey||a,t.append(a,o,o.ngfName||o.name)}else if(angular.isObject(i)){if(i.$$ngfCircularDetection)throw"ngFileUpload: Circular reference in config.data. Make sure specified data for Upload.upload() has no circular reference: "+a;i.$$ngfCircularDetection=!0;try{for(var c in i)if(i.hasOwnProperty(c)&&"$$ngfCircularDetection"!==c){var l=null==e.objectKey?"[i]":e.objectKey;i.length&&parseInt(c)>-1&&(l=null==e.arrayKey?l:e.arrayKey),r(t,i[c],a+l.replace(/[ik]/g,c))}}finally{delete i.$$ngfCircularDetection}}else t.append(a,i)}return t||(e=a(e)),e._isDigested||(e._isDigested=!0,e._chunkSize=s.translateScalars(e.resumeChunkSize),e._chunkSize=e._chunkSize?parseInt(e._chunkSize.toString()):null,e.headers=e.headers||{},e.headers["Content-Type"]=void 0,e.transformRequest=e.transformRequest?angular.isArray(e.transformRequest)?e.transformRequest:[e.transformRequest]:[],e.transformRequest.push((function(t){var n,i=new window.FormData;for(n in t=t||e.fields||{},e.file&&(t.file=e.file),t)if(t.hasOwnProperty(n)){var a=t[n];e.formDataAppender?e.formDataAppender(i,n,a):r(i,a,n)}return i}))),i(e)},this.http=function(t){return(t=a(t)).transformRequest=t.transformRequest||function(t){return window.ArrayBuffer&&t instanceof window.ArrayBuffer||t instanceof window.Blob?t:e.defaults.transformRequest[0].apply(this,arguments)},t._chunkSize=s.translateScalars(t.resumeChunkSize),t._chunkSize=t._chunkSize?parseInt(t._chunkSize.toString()):null,i(t)},this.translateScalars=function(e){if(angular.isString(e)){if(e.search(/kb/i)===e.length-2)return parseFloat(1024*e.substring(0,e.length-2));if(e.search(/mb/i)===e.length-2)return parseFloat(1048576*e.substring(0,e.length-2));if(e.search(/gb/i)===e.length-2)return parseFloat(1073741824*e.substring(0,e.length-2));if(e.search(/b/i)===e.length-1)return parseFloat(e.substring(0,e.length-1));if(e.search(/s/i)===e.length-1)return parseFloat(e.substring(0,e.length-1));if(e.search(/m/i)===e.length-1)return parseFloat(60*e.substring(0,e.length-1));if(e.search(/h/i)===e.length-1)return parseFloat(3600*e.substring(0,e.length-1))}return e},this.urlToBlob=function(n){var r=t.defer();return e({url:n,method:"get",responseType:"arraybuffer"}).then((function(e){var t=new Uint8Array(e.data),i=e.headers("content-type")||"image/WebP",a=new window.Blob([t],{type:i}),s=n.match(/.*\/(.+?)(\?.*)?$/);s.length>1&&(a.name=s[1]),r.resolve(a)}),(function(e){r.reject(e)})),r.promise},this.setDefaults=function(e){this.defaults=e||{}},this.defaults={},this.version=r.version}]),r.service("Upload",["$parse","$timeout","$compile","$q","UploadExif",function(e,t,n,r,i){function a(e,t,n){var i=[u.emptyPromise()];return angular.forEach(e,(function(r,a){0===r.type.indexOf("image/jpeg")&&u.attrGetter("ngfFixOrientation",t,n,{$file:r})&&i.push(u.happyPromise(u.applyExifRotation(r),r).then((function(t){e.splice(a,1,t)})))})),r.all(i)}function s(e,t,n,i){var a=u.attrGetter("ngfResize",t,n);if(!a||!u.isResizeSupported()||!e.length)return u.emptyPromise();if(a instanceof Function){var s=r.defer();return a(e).then((function(r){o(r,e,t,n,i).then((function(e){s.resolve(e)}),(function(e){s.reject(e)}))}),(function(e){s.reject(e)}))}return o(a,e,t,n,i)}function o(e,t,n,i,a){function s(r,s){if(0===r.type.indexOf("image")){if(e.pattern&&!u.validatePattern(r,e.pattern))return;e.resizeIf=function(e,t){return u.attrGetter("ngfResizeIf",n,i,{$width:e,$height:t,$file:r})};var c=u.resize(r,e);o.push(c),c.then((function(e){t.splice(s,1,e)}),(function(e){r.$error="resize",(r.$errorMessages=r.$errorMessages||{}).resize=!0,r.$errorParam=(e?(e.message?e.message:e)+": ":"")+(r&&r.name),a.$ngfValidations.push({name:"resize",valid:!1}),u.applyModelValidation(a,t)}))}}for(var o=[u.emptyPromise()],c=0;c<t.length;c++)s(t[c],c);return r.all(o)}var u=i;return u.getAttrWithDefaults=function(e,t){if(null!=e[t])return e[t];var n=u.defaults[t];return null==n?n:angular.isString(n)?n:JSON.stringify(n)},u.attrGetter=function(t,n,r,i){var a=this.getAttrWithDefaults(n,t);if(!r)return a;try{return i?e(a)(r,i):e(a)(r)}catch(e){if(t.search(/min|max|pattern/i))return a;throw e}},u.shouldUpdateOn=function(e,t,n){var r=u.attrGetter("ngfModelOptions",t,n);return!r||!r.updateOn||r.updateOn.split(" ").indexOf(e)>-1},u.emptyPromise=function(){var e=r.defer(),n=arguments;return t((function(){e.resolve.apply(e,n)})),e.promise},u.rejectPromise=function(){var e=r.defer(),n=arguments;return t((function(){e.reject.apply(e,n)})),e.promise},u.happyPromise=function(e,n){var i=r.defer();return e.then((function(e){i.resolve(e)}),(function(e){t((function(){throw e})),i.resolve(n)})),i.promise},u.updateModel=function(n,r,i,o,c,l,h){function f(a,s,c,h,f){r.$$ngfPrevValidFiles=a,r.$$ngfPrevInvalidFiles=s;var d=a&&a.length?a[0]:null,p=s&&s.length?s[0]:null;n&&(u.applyModelValidation(n,a),n.$setViewValue(f?d:a)),o&&e(o)(i,{$files:a,$file:d,$newFiles:c,$duplicateFiles:h,$invalidFiles:s,$invalidFile:p,$event:l});var g=u.attrGetter("ngfModelInvalid",r);g&&t((function(){e(g).assign(i,f?p:s)})),t((function(){}))}function d(){function e(){t((function(){f(w?g.concat(b):b,w?m.concat(y):y,c,v,x)}),E&&E.debounce?E.debounce.change||E.debounce:0)}var a=S?p:b;s(a,r,i,n).then((function(){S?u.validate(p,w?g.length:0,n,r,i).then((function(t){b=t.validsFiles,y=t.invalidsFiles,e()})):e()}),(function(){for(var t=0;t<a.length;t++){var n=a[t];if("resize"===n.$error){var r=b.indexOf(n);r>-1&&(b.splice(r,1),y.push(n)),e()}}}))}var p,g,m,v=[],y=[],b=[];g=r.$$ngfPrevValidFiles||[],m=r.$$ngfPrevInvalidFiles||[],n&&n.$modelValue&&(g=function(e){return angular.isArray(e)?e:[e]}(n.$modelValue));var w=u.attrGetter("ngfKeep",r,i);p=(c||[]).slice(0),("distinct"===w||!0===u.attrGetter("ngfKeepDistinct",r,i))&&function(){function e(e,t){return e.name===t.name&&(e.$ngfOrigSize||e.size)===(t.$ngfOrigSize||t.size)&&e.type===t.type}function t(t){var n;for(n=0;n<g.length;n++)if(e(t,g[n]))return!0;for(n=0;n<m.length;n++)if(e(t,m[n]))return!0;return!1}if(c){p=[],v=[];for(var n=0;n<c.length;n++)t(c[n])?v.push(c[n]):p.push(c[n])}}();var x=!w&&!u.attrGetter("ngfMultiple",r,i)&&!u.attrGetter("multiple",r);if(!w||p.length){u.attrGetter("ngfBeforeModelChange",r,i,{$files:c,$file:c&&c.length?c[0]:null,$newFiles:p,$duplicateFiles:v,$event:l});var S=u.attrGetter("ngfValidateAfterResize",r,i),E=u.attrGetter("ngfModelOptions",r,i);u.validate(p,w?g.length:0,n,r,i).then((function(e){h?f(p,[],c,v,x):(E&&E.allowInvalid||S?b=p:(b=e.validFiles,y=e.invalidFiles),u.attrGetter("ngfFixOrientation",r,i)&&u.isExifSupported()?a(b,r,i).then((function(){d()})):d())}))}},u}]),r.directive("ngfSelect",["$parse","$timeout","$compile","Upload",function(e,t,n,r){function i(e){var t=e.match(/Android[^\d]*(\d+)\.(\d+)/);if(t&&t.length>2){var n=r.defaults.androidFixMinorVersion||4;return parseInt(t[1])<4||parseInt(t[1])===n&&parseInt(t[2])<n}return-1===e.indexOf("Chrome")&&/.*Windows.*Safari.*/.test(e)}function a(e,t,n,r,a,o,u,c){function l(){return"input"===t[0].tagName.toLowerCase()&&n.type&&"file"===n.type.toLowerCase()}function h(){return g("ngfChange")||g("ngfSelect")}function f(t){if(c.shouldUpdateOn("change",n,e)){var i=t.__files_||t.target&&t.target.files,a=[];if(!i)return;for(var s=0;s<i.length;s++)a.push(i[s]);c.updateModel(r,n,e,h(),a.length?a:null,t)}}function d(e,r){function i(t){e.attr("id","ngf-"+t),r.attr("id","ngf-label-"+t)}for(var a=0;a<t[0].attributes.length;a++){var s=t[0].attributes[a];"type"!==s.name&&"class"!==s.name&&"style"!==s.name&&("id"===s.name?(i(s.value),m.push(n.$observe("id",i))):e.attr(s.name,s.value||"required"!==s.name&&"multiple"!==s.name?s.value:s.name))}}function p(t){c.shouldUpdateOn("click",n,e)&&b.val()&&(b.val(null),c.updateModel(r,n,e,h(),null,t,!0))}var g=function(e,t){return c.attrGetter(e,n,t)};c.registerModelChangeValidator(r,n,e);var m=[];g("ngfMultiple")&&m.push(e.$watch(g("ngfMultiple"),(function(){b.attr("multiple",g("ngfMultiple",e))}))),g("ngfCapture")&&m.push(e.$watch(g("ngfCapture"),(function(){b.attr("capture",g("ngfCapture",e))}))),g("ngfAccept")&&m.push(e.$watch(g("ngfAccept"),(function(){b.attr("accept",g("ngfAccept",e))}))),m.push(n.$observe("accept",(function(){b.attr("accept",g("accept"))})));var v=0,y=0,b=t;l()||(b=function(){if(l())return t;var e=angular.element('<input type="file">'),n=angular.element("<label>upload</label>");return n.css("visibility","hidden").css("position","absolute").css("overflow","hidden").css("width","0px").css("height","0px").css("border","none").css("margin","0px").css("padding","0px").attr("tabindex","-1"),d(e,n),s.push({el:t,ref:n}),document.body.appendChild(n.append(e)[0]),e}()),b.bind("change",f),l()?t.bind("click",p):t.bind("click touchstart touchend",(function(n){if(t.attr("disabled"))return!1;if(!g("ngfSelectDisabled",e)){var r=function(e){var t=e.changedTouches||e.originalEvent&&e.originalEvent.changedTouches;if(t){if("touchstart"===e.type)return y=t[0].clientX,v=t[0].clientY,!0;if("touchend"===e.type){var n=t[0].clientX,r=t[0].clientY;if(Math.abs(n-y)>20||Math.abs(r-v)>20)return e.stopPropagation(),e.preventDefault(),!1}return!0}}(n);if(null!=r)return r;p(n);try{l()||document.body.contains(b[0])||(s.push({el:t,ref:b.parent()}),document.body.appendChild(b.parent()[0]),b.bind("change",f))}catch(e){}return i(navigator.userAgent)?setTimeout((function(){b[0].click()}),0):b[0].click(),!1}})),-1!==navigator.appVersion.indexOf("MSIE 10")&&b.bind("click",(function e(t){if(b&&!b.attr("__ngf_ie10_Fix_")){if(!b[0].parentNode)return void(b=null);t.preventDefault(),t.stopPropagation(),b.unbind("click");var n=b.clone();return b.replaceWith(n),(b=n).attr("__ngf_ie10_Fix_","true"),b.bind("change",f),b.bind("click",e),b[0].click(),!1}b.removeAttr("__ngf_ie10_Fix_")})),r&&r.$formatters.push((function(e){return(null==e||0===e.length)&&b.val()&&b.val(null),e})),e.$on("$destroy",(function(){l()||b.parent().remove(),angular.forEach(m,(function(e){e()}))})),o((function(){for(var e=0;e<s.length;e++){var t=s[e];document.body.contains(t.el[0])||(s.splice(e,1),t.ref.remove())}})),window.FileAPI&&window.FileAPI.ngfFixIE&&window.FileAPI.ngfFixIE(t,b,f)}var s=[];return{restrict:"AEC",require:"?ngModel",link:function(e,n,i,s){a(e,n,i,s,0,t,0,r)}}}]),function(){function e(e,t,n,r,i,a,s,o){function u(a){var s=e.attrGetter("ngfNoObjectUrl",i,n);e.dataUrl(a,s).finally((function(){t((function(){var e=(s?a.$ngfDataUrl:a.$ngfBlobUrl)||a.$ngfDataUrl;o?r.css("background-image","url('"+(e||"")+"')"):r.attr("src",e),e?r.removeClass("ng-hide"):r.addClass("ng-hide")}))}))}t((function(){var t=n.$watch(i[a],(function(t){var c=s;if("ngfThumbnail"===a&&(c||(c={width:r[0].naturalWidth||r[0].clientWidth,height:r[0].naturalHeight||r[0].clientHeight}),0===c.width&&window.getComputedStyle)){var l=getComputedStyle(r[0]);l.width&&l.width.indexOf("px")>-1&&l.height&&l.height.indexOf("px")>-1&&(c={width:parseInt(l.width.slice(0,-2)),height:parseInt(l.height.slice(0,-2))})}return angular.isString(t)?(r.removeClass("ng-hide"),o?r.css("background-image","url('"+t+"')"):r.attr("src",t)):void(!t||!t.type||0!==t.type.search(function(e){return"img"===e.tagName.toLowerCase()?"image":"audio"===e.tagName.toLowerCase()?"audio":"video"===e.tagName.toLowerCase()?"video":/./}(r[0]))||o&&0!==t.type.indexOf("image")?r.addClass("ng-hide"):c&&e.isResizeSupported()?(c.resizeIf=function(r,a){return e.attrGetter("ngfResizeIf",i,n,{$width:r,$height:a,$file:t})},e.resize(t,c).then((function(e){u(e)}),(function(e){throw e}))):u(t))}));n.$on("$destroy",(function(){t()}))}))}r.service("UploadDataUrl",["UploadBase","$timeout","$q",function(e,t,n){var r=e;return r.base64DataUrl=function(e){if(angular.isArray(e)){var t=n.defer(),i=0;return angular.forEach(e,(function(n){r.dataUrl(n,!0).finally((function(){if(++i===e.length){var n=[];angular.forEach(e,(function(e){n.push(e.$ngfDataUrl)})),t.resolve(n,e)}}))})),t.promise}return r.dataUrl(e,!0)},r.dataUrl=function(e,i){if(!e)return r.emptyPromise(e,e);if(i&&null!=e.$ngfDataUrl||!i&&null!=e.$ngfBlobUrl)return r.emptyPromise(i?e.$ngfDataUrl:e.$ngfBlobUrl,e);var a=i?e.$$ngfDataUrlPromise:e.$$ngfBlobUrlPromise;if(a)return a;var s=n.defer();return t((function(){if(window.FileReader&&e&&(!window.FileAPI||-1===navigator.userAgent.indexOf("MSIE 8")||e.size<2e4)&&(!window.FileAPI||-1===navigator.userAgent.indexOf("MSIE 9")||e.size<4e6)){var n=window.URL||window.webkitURL;if(n&&n.createObjectURL&&!i){var a;try{a=n.createObjectURL(e)}catch(n){return void t((function(){e.$ngfBlobUrl="",s.reject()}))}t((function(){if(e.$ngfBlobUrl=a,a){s.resolve(a,e),r.blobUrls=r.blobUrls||[],r.blobUrlsTotalSize=r.blobUrlsTotalSize||0,r.blobUrls.push({url:a,size:e.size}),r.blobUrlsTotalSize+=e.size||0;for(var t=r.defaults.blobUrlsMaxMemory||268435456,i=r.defaults.blobUrlsMaxQueueSize||200;(r.blobUrlsTotalSize>t||r.blobUrls.length>i)&&r.blobUrls.length>1;){var o=r.blobUrls.splice(0,1)[0];n.revokeObjectURL(o.url),r.blobUrlsTotalSize-=o.size}}}))}else{var o=new FileReader;o.onload=function(n){t((function(){e.$ngfDataUrl=n.target.result,s.resolve(n.target.result,e),t((function(){delete e.$ngfDataUrl}),1e3)}))},o.onerror=function(){t((function(){e.$ngfDataUrl="",s.reject()}))},o.readAsDataURL(e)}}else t((function(){e[i?"$ngfDataUrl":"$ngfBlobUrl"]="",s.reject()}))})),(a=i?e.$$ngfDataUrlPromise=s.promise:e.$$ngfBlobUrlPromise=s.promise).finally((function(){delete e[i?"$$ngfDataUrlPromise":"$$ngfBlobUrlPromise"]})),a},r}]),r.directive("ngfSrc",["Upload","$timeout",function(t,n){return{restrict:"AE",link:function(r,i,a){e(t,n,r,i,a,"ngfSrc",t.attrGetter("ngfResize",a,r),!1)}}}]),r.directive("ngfBackground",["Upload","$timeout",function(t,n){return{restrict:"AE",link:function(r,i,a){e(t,n,r,i,a,"ngfBackground",t.attrGetter("ngfResize",a,r),!0)}}}]),r.directive("ngfThumbnail",["Upload","$timeout",function(t,n){return{restrict:"AE",link:function(r,i,a){var s=t.attrGetter("ngfSize",a,r);e(t,n,r,i,a,"ngfThumbnail",s,t.attrGetter("ngfAsBackground",a,r))}}}]),r.config(["$compileProvider",function(e){e.imgSrcSanitizationWhitelist&&e.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|webcal|local|file|data|blob):/),e.aHrefSanitizationWhitelist&&e.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|webcal|local|file|data|blob):/)}]),r.filter("ngfDataUrl",["UploadDataUrl","$sce",function(e,t){return function(n,r,i){if(angular.isString(n))return t.trustAsResourceUrl(n);var a=n&&((r?n.$ngfDataUrl:n.$ngfBlobUrl)||n.$ngfDataUrl);return n&&!a?(!n.$ngfDataUrlFilterInProgress&&angular.isObject(n)&&(n.$ngfDataUrlFilterInProgress=!0,e.dataUrl(n,r)),""):(n&&delete n.$ngfDataUrlFilterInProgress,(n&&a?i?t.trustAsResourceUrl(a):a:n)||"")}}])}(),r.service("UploadValidate",["UploadDataUrl","$q","$timeout",function(e,t,n){var r=e;return r.validatePattern=function(e,t){if(!t)return!0;var n=function e(t){var n="",r=[];if(t.length>2&&"/"===t[0]&&"/"===t[t.length-1])n=t.substring(1,t.length-1);else{var i=t.split(",");if(i.length>1)for(var a=0;a<i.length;a++){var s=e(i[a]);s.regexp?(n+="("+s.regexp+")",a<i.length-1&&(n+="|")):r=r.concat(s.excludes)}else 0===t.indexOf("!")?r.push("^((?!"+e(t.substring(1)).regexp+").)*$"):(0===t.indexOf(".")&&(t="*"+t),n=(n="^"+t.replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]","g"),"\\$&")+"$").replace(/\\\*/g,".*").replace(/\\\?/g,"."))}return{regexp:n,excludes:r}}(t),r=!0;if(n.regexp&&n.regexp.length){var i=new RegExp(n.regexp,"i");r=null!=e.type&&i.test(e.type)||null!=e.name&&i.test(e.name)}for(var a=n.excludes.length;a--;){var s=new RegExp(n.excludes[a],"i");r=r&&(null==e.type||s.test(e.type))&&(null==e.name||s.test(e.name))}return r},r.ratioToFloat=function(e){var t=e.toString(),n=t.search(/[x:]/i);return n>-1?parseFloat(t.substring(0,n))/parseFloat(t.substring(n+1)):parseFloat(t)},r.registerModelChangeValidator=function(e,t,n){e&&e.$formatters.push((function(i){if(e.$dirty){var a=i;i&&!angular.isArray(i)&&(a=[i]),r.validate(a,0,e,t,n).then((function(){r.applyModelValidation(e,a)}))}return i}))},r.applyModelValidation=function(e,t){(function(e,t){null==t||e.$dirty||(e.$setDirty?e.$setDirty():e.$dirty=!0)})(e,t),angular.forEach(e.$ngfValidations,(function(t){e.$setValidity(t.name,t.valid)}))},r.getValidationAttr=function(e,t,n,i,a){var s="ngf"+n[0].toUpperCase()+n.substr(1),o=r.attrGetter(s,e,t,{$file:a});if(null==o&&(o=r.attrGetter("ngfValidate",e,t,{$file:a}))){var u=(i||n).split(".");o=o[u[0]],u.length>1&&(o=o&&o[u[1]])}return o},r.validate=function(e,n,i,a,s){function o(t,n,o){if(e){for(var u=e.length,c=null;u--;){var d=e[u];if(d){var p=r.getValidationAttr(a,s,t,n,d);null!=p&&(o(d,p,u)||(-1===l.indexOf(t)?(d.$error=t,(d.$errorMessages=d.$errorMessages||{})[t]=!0,d.$errorParam=p,-1===f.indexOf(d)&&f.push(d),h||e.splice(u,1),c=!1):e.splice(u,1)))}}null!==c&&i.$ngfValidations.push({name:t,valid:c})}}function u(n,o,u,d,p){function g(t,r,i){function a(a){if(a())if(-1===l.indexOf(n)){if(r.$error=n,(r.$errorMessages=r.$errorMessages||{})[n]=!0,r.$errorParam=i,-1===f.indexOf(r)&&f.push(r),!h){var s=e.indexOf(r);s>-1&&e.splice(s,1)}t.resolve(!1)}else{var o=e.indexOf(r);o>-1&&e.splice(o,1),t.resolve(!0)}else t.resolve(!0)}null!=i?d(r,i).then((function(e){a((function(){return!p(e,i)}))}),(function(){a((function(){return c("ngfValidateForce",{$file:r})}))})):t.resolve(!0)}var m=[r.emptyPromise(!0)];e&&(e=void 0===e.length?[e]:e,angular.forEach(e,(function(e){var i=t.defer();return m.push(i.promise),!u||null!=e.type&&0===e.type.search(u)?void("dimensions"===n&&null!=r.attrGetter("ngfDimensions",a)?r.imageDimensions(e).then((function(t){g(i,e,c("ngfDimensions",{$file:e,$width:t.width,$height:t.height}))}),(function(){i.resolve(!1)})):"duration"===n&&null!=r.attrGetter("ngfDuration",a)?r.mediaDuration(e).then((function(t){g(i,e,c("ngfDuration",{$file:e,$duration:t}))}),(function(){i.resolve(!1)})):g(i,e,r.getValidationAttr(a,s,n,o,e))):void i.resolve(!0)})));var v=t.defer();return t.all(m).then((function(e){for(var t=!0,r=0;r<e.length;r++)if(!e[r]){t=!1;break}i.$ngfValidations.push({name:n,valid:t}),v.resolve(t)})),v.promise}(i=i||{}).$ngfValidations=i.$ngfValidations||[],angular.forEach(i.$ngfValidations,(function(e){e.valid=!0}));var c=function(e,t){return r.attrGetter(e,a,s,t)},l=(r.attrGetter("ngfIgnoreInvalid",a,s)||"").split(" "),h=r.attrGetter("ngfRunAllValidations",a,s);if(null==e||0===e.length)return r.emptyPromise({validFiles:e,invalidFiles:[]});e=void 0===e.length?[e]:e.slice(0);var f=[];o("pattern",null,r.validatePattern),o("minSize","size.min",(function(e,t){return e.size+.1>=r.translateScalars(t)})),o("maxSize","size.max",(function(e,t){return e.size-.1<=r.translateScalars(t)}));var d=0;if(o("maxTotalSize",null,(function(t,n){return!((d+=t.size)>r.translateScalars(n))||(e.splice(0,e.length),!1)})),o("validateFn",null,(function(e,t){return!0===t||null===t||""===t})),!e.length)return r.emptyPromise({validFiles:[],invalidFiles:f});var p=t.defer(),g=[];return g.push(u("maxHeight","height.max",/image/,this.imageDimensions,(function(e,t){return e.height<=t}))),g.push(u("minHeight","height.min",/image/,this.imageDimensions,(function(e,t){return e.height>=t}))),g.push(u("maxWidth","width.max",/image/,this.imageDimensions,(function(e,t){return e.width<=t}))),g.push(u("minWidth","width.min",/image/,this.imageDimensions,(function(e,t){return e.width>=t}))),g.push(u("dimensions",null,/image/,(function(e,t){return r.emptyPromise(t)}),(function(e){return e}))),g.push(u("ratio",null,/image/,this.imageDimensions,(function(e,t){for(var n=t.toString().split(","),i=!1,a=0;a<n.length;a++)Math.abs(e.width/e.height-r.ratioToFloat(n[a]))<.01&&(i=!0);return i}))),g.push(u("maxRatio","ratio.max",/image/,this.imageDimensions,(function(e,t){return e.width/e.height-r.ratioToFloat(t)<1e-4}))),g.push(u("minRatio","ratio.min",/image/,this.imageDimensions,(function(e,t){return e.width/e.height-r.ratioToFloat(t)>-1e-4}))),g.push(u("maxDuration","duration.max",/audio|video/,this.mediaDuration,(function(e,t){return e<=r.translateScalars(t)}))),g.push(u("minDuration","duration.min",/audio|video/,this.mediaDuration,(function(e,t){return e>=r.translateScalars(t)}))),g.push(u("duration",null,/audio|video/,(function(e,t){return r.emptyPromise(t)}),(function(e){return e}))),g.push(u("validateAsyncFn",null,null,(function(e,t){return t}),(function(e){return!0===e||null===e||""===e}))),t.all(g).then((function(){if(h)for(var t=0;t<e.length;t++){e[t].$error&&e.splice(t--,1)}h=!1,o("maxFiles",null,(function(e,t,r){return t>n+r})),p.resolve({validFiles:e,invalidFiles:f})})),p.promise},r.imageDimensions=function(e){if(e.$ngfWidth&&e.$ngfHeight){var i=t.defer();return n((function(){i.resolve({width:e.$ngfWidth,height:e.$ngfHeight})})),i.promise}if(e.$ngfDimensionPromise)return e.$ngfDimensionPromise;var a=t.defer();return n((function(){return 0!==e.type.indexOf("image")?void a.reject("not image"):void r.dataUrl(e).then((function(t){function r(){var t=s[0].naturalWidth||s[0].clientWidth,n=s[0].naturalHeight||s[0].clientHeight;s.remove(),e.$ngfWidth=t,e.$ngfHeight=n,a.resolve({width:t,height:n})}function i(){s.remove(),a.reject("load error")}var s=angular.element("<img>").attr("src",t).css("visibility","hidden").css("position","fixed").css("max-width","none !important").css("max-height","none !important");s.on("load",r),s.on("error",i);var o=0;(function e(){n((function(){s[0].parentNode&&(s[0].clientWidth?r():o++>10?i():e())}),1e3)})(),angular.element(document.getElementsByTagName("body")[0]).append(s)}),(function(){a.reject("load error")}))})),e.$ngfDimensionPromise=a.promise,e.$ngfDimensionPromise.finally((function(){delete e.$ngfDimensionPromise})),e.$ngfDimensionPromise},r.mediaDuration=function(e){if(e.$ngfDuration){var i=t.defer();return n((function(){i.resolve(e.$ngfDuration)})),i.promise}if(e.$ngfDurationPromise)return e.$ngfDurationPromise;var a=t.defer();return n((function(){return 0!==e.type.indexOf("audio")&&0!==e.type.indexOf("video")?void a.reject("not media"):void r.dataUrl(e).then((function(t){function r(){var t=s[0].duration;e.$ngfDuration=t,s.remove(),a.resolve(t)}function i(){s.remove(),a.reject("load error")}var s=angular.element(0===e.type.indexOf("audio")?"<audio>":"<video>").attr("src",t).css("visibility","none").css("position","fixed");s.on("loadedmetadata",r),s.on("error",i);var o=0;(function e(){n((function(){s[0].parentNode&&(s[0].duration?r():o>10?i():e())}),1e3)})(),angular.element(document.body).append(s)}),(function(){a.reject("load error")}))})),e.$ngfDurationPromise=a.promise,e.$ngfDurationPromise.finally((function(){delete e.$ngfDurationPromise})),e.$ngfDurationPromise},r}]),r.service("UploadResize",["UploadValidate","$q",function(e,t){var n=e,r=function(e,r,i,a,s,o,u,c){var l=t.defer(),h=document.createElement("canvas"),f=document.createElement("img");return f.setAttribute("style","visibility:hidden;position:fixed;z-index:-100000"),document.body.appendChild(f),f.onload=function(){var e=f.width,t=f.height;if(f.parentNode.removeChild(f),null==c||!1!==c(e,t))try{if(o){var d=n.ratioToFloat(o);d>e/t?i=(r=e)/d:r=(i=t)*d}r||(r=e),i||(i=t);var p=function(e,t,n,r,i){var a=i?Math.max(n/e,r/t):Math.min(n/e,r/t);return{width:e*a,height:t*a,marginX:e*a-n,marginY:t*a-r}}(e,t,r,i,u);h.width=Math.min(p.width,r),h.height=Math.min(p.height,i),h.getContext("2d").drawImage(f,Math.min(0,-p.marginX/2),Math.min(0,-p.marginY/2),p.width,p.height),l.resolve(h.toDataURL(s||"image/WebP",a||.934))}catch(e){l.reject(e)}else l.reject("resizeIf")},f.onerror=function(){f.parentNode.removeChild(f),l.reject()},f.src=e,l.promise};return n.dataUrltoBlob=function(e,t,n){for(var r=e.split(","),i=r[0].match(/:(.*?);/)[1],a=atob(r[1]),s=a.length,o=new Uint8Array(s);s--;)o[s]=a.charCodeAt(s);var u=new window.Blob([o],{type:i});return u.name=t,u.$ngfOrigSize=n,u},n.isResizeSupported=function(){var e=document.createElement("canvas");return window.atob&&e.getContext&&e.getContext("2d")&&window.Blob},n.isResizeSupported()&&Object.defineProperty(window.Blob.prototype,"name",{get:function(){return this.$ngfName},set:function(e){this.$ngfName=e},configurable:!0}),n.resize=function(e,i){if(0!==e.type.indexOf("image"))return n.emptyPromise(e);var a=t.defer();return n.dataUrl(e,!0).then((function(t){r(t,i.width,i.height,i.quality,i.type||e.type,i.ratio,i.centerCrop,i.resizeIf).then((function(r){if("image/jpeg"===e.type&&!1!==i.restoreExif)try{r=n.restoreExif(t,r)}catch(e){setTimeout((function(){throw e}),1)}try{var s=n.dataUrltoBlob(r,e.name,e.size);a.resolve(s)}catch(e){a.reject(e)}}),(function(t){"resizeIf"===t&&a.resolve(e),a.reject(t)}))}),(function(e){a.reject(e)})),a.promise},n}]),function(){function e(e,n,r,i,a,s,o,u,c,l){function h(){return n.attr("disabled")||v("ngfDropDisabled",e)}function f(t,n,r){if(t){var i;try{i=t&&t.getData&&t.getData("text/html")}catch(e){}g(t.items,t.files,!1!==v("ngfAllowDir",e),v("multiple")||v("ngfMultiple",e)).then((function(e){e.length?d(e,n):p(r,i).then((function(e){d(e,n)}))}))}}function d(t,n){u.updateModel(i,r,e,v("ngfChange")||v("ngfDrop"),t,n)}function p(t,n){if(!u.shouldUpdateOn(t,r,e)||"string"!=typeof n)return u.rejectPromise([]);var i=[];n.replace(/<(img src|img [^>]* src) *=\"([^\"]*)\"/gi,(function(e,t,n){i.push(n)}));var a=[],s=[];if(i.length){angular.forEach(i,(function(e){a.push(u.urlToBlob(e).then((function(e){s.push(e)})))}));var o=l.defer();return l.all(a).then((function(){o.resolve(s)}),(function(e){o.reject(e)})),o.promise}return u.emptyPromise()}function g(t,n,i,a){function s(e,t){var n=l.defer();if(null!=e)if(e.isDirectory){var r=[u.emptyPromise()];if(f){var i={type:"directory"};i.name=i.path=(t||"")+e.name,d.push(i)}var a=e.createReader(),o=[],g=function(){a.readEntries((function(i){try{i.length?(o=o.concat(Array.prototype.slice.call(i||[],0)),g()):(angular.forEach(o.slice(0),(function(n){d.length<=c&&h>=p&&r.push(s(n,(t||"")+e.name+"/"))})),l.all(r).then((function(){n.resolve()}),(function(e){n.reject(e)})))}catch(e){n.reject(e)}}),(function(e){n.reject(e)}))};g()}else e.file((function(e){try{e.path=(t||"")+e.name,f&&(e=u.rename(e,e.path)),d.push(e),p+=e.size,n.resolve()}catch(e){n.reject(e)}}),(function(e){n.reject(e)}));return n.promise}var c=u.getValidationAttr(r,e,"maxFiles");null==c&&(c=Number.MAX_VALUE);var h=u.getValidationAttr(r,e,"maxTotalSize");null==h&&(h=Number.MAX_VALUE);var f=v("ngfIncludeDir",e),d=[],p=0,g=[u.emptyPromise()];if(t&&t.length>0&&"file:"!==o.location.protocol)for(var m=0;m<t.length;m++){if(t[m].webkitGetAsEntry&&t[m].webkitGetAsEntry()&&t[m].webkitGetAsEntry().isDirectory){var y=t[m].webkitGetAsEntry();if(y.isDirectory&&!i)continue;null!=y&&g.push(s(y))}else{var b=t[m].getAsFile();null!=b&&(d.push(b),p+=b.size)}if(d.length>c||p>h||!a&&d.length>0)break}else if(null!=n)for(var w=0;w<n.length;w++){var x=n.item(w);if((x.type||x.size>0)&&(d.push(x),p+=x.size),d.length>c||p>h||!a&&d.length>0)break}var S=l.defer();return l.all(g).then((function(){if(a||f||!d.length)S.resolve(d);else{for(var e=0;d[e]&&"directory"===d[e].type;)e++;S.resolve([d[e]])}}),(function(e){S.reject(e)})),S.promise}var m=t(),v=function(e,t,n){return u.attrGetter(e,r,t,n)};if(v("dropAvailable")&&s((function(){e[v("dropAvailable")]?e[v("dropAvailable")].value=m:e[v("dropAvailable")]=m})),m){null==v("ngfSelect")&&u.registerModelChangeValidator(i,r,e);var y,b=null,w=a(v("ngfStopPropagation")),x=1;n[0].addEventListener("dragover",(function(t){if(!h()&&u.shouldUpdateOn("drop",r,e)){if(t.preventDefault(),w(e)&&t.stopPropagation(),navigator.userAgent.indexOf("Chrome")>-1){var i=t.dataTransfer.effectAllowed;t.dataTransfer.dropEffect="move"===i||"linkMove"===i?"move":"copy"}s.cancel(b),y||(y="C",function(e,t,n,r){var i=v("ngfDragOverClass",e,{$event:n}),a="dragover";if(angular.isString(i))a=i;else if(i&&(i.delay&&(x=i.delay),i.accept||i.reject)){var s=n.dataTransfer.items;if(null!=s&&s.length)for(var o=i.pattern||v("ngfPattern",e,{$event:n}),c=s.length;c--;){if(!u.validatePattern(s[c],o)){a=i.reject;break}a=i.accept}else a=i.accept}r(a)}(e,0,t,(function(r){y=r,n.addClass(y),v("ngfDrag",e,{$isDragging:!0,$class:y,$event:t})})))}}),!1),n[0].addEventListener("dragenter",(function(t){!h()&&u.shouldUpdateOn("drop",r,e)&&(t.preventDefault(),w(e)&&t.stopPropagation())}),!1),n[0].addEventListener("dragleave",(function(t){!h()&&u.shouldUpdateOn("drop",r,e)&&(t.preventDefault(),w(e)&&t.stopPropagation(),b=s((function(){y&&n.removeClass(y),y=null,v("ngfDrag",e,{$isDragging:!1,$event:t})}),x||100))}),!1),n[0].addEventListener("drop",(function(t){!h()&&u.shouldUpdateOn("drop",r,e)&&(t.preventDefault(),w(e)&&t.stopPropagation(),y&&n.removeClass(y),y=null,f(t.dataTransfer,t,"dropUrl"))}),!1),n[0].addEventListener("paste",(function(t){navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&v("ngfEnableFirefoxPaste",e)&&t.preventDefault(),!h()&&u.shouldUpdateOn("paste",r,e)&&f(t.clipboardData||t.originalEvent.clipboardData,t,"pasteUrl")}),!1),navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&v("ngfEnableFirefoxPaste",e)&&(n.attr("contenteditable",!0),n.on("keypress",(function(e){e.metaKey||e.ctrlKey||e.preventDefault()})))}else!0===v("ngfHideOnDropNotAvailable",e)&&n.css("display","none")}function t(){var e=document.createElement("div");return"draggable"in e&&"ondrop"in e&&!/Edge\/12./i.test(navigator.userAgent)}r.directive("ngfDrop",["$parse","$timeout","$window","Upload","$http","$q",function(t,n,r,i,a,s){return{restrict:"AEC",require:"?ngModel",link:function(a,o,u,c){e(a,o,u,c,t,n,r,i,0,s)}}}]),r.directive("ngfNoFileDrop",(function(){return function(e,n){t()&&n.css("display","none")}})),r.directive("ngfDropAvailable",["$parse","$timeout","Upload",function(e,n,r){return function(i,a,s){if(t()){var o=e(r.attrGetter("ngfDropAvailable",s));n((function(){o(i),o.assign&&o.assign(i,!0)}))}}}])}(),r.service("UploadExif",["UploadResize","$q",function(e,t){var n=e;return n.isExifSupported=function(){return window.FileReader&&(new FileReader).readAsArrayBuffer&&n.isResizeSupported()},n.readOrientation=function(e){var n=t.defer(),r=new FileReader,i=e.slice?e.slice(0,65536):e;return r.readAsArrayBuffer(i),r.onerror=function(e){return n.reject(e)},r.onload=function(e){var t={orientation:1},r=new DataView(this.result);if(65496!==r.getUint16(0,!1))return n.resolve(t);for(var i=r.byteLength,a=2;i>a;){var s=r.getUint16(a,!1);if(a+=2,65505===s){if(1165519206!==r.getUint32(a+=2,!1))return n.resolve(t);var o=18761===r.getUint16(a+=6,!1);a+=r.getUint32(a+4,o);var u=r.getUint16(a,o);a+=2;for(var c=0;u>c;c++)if(274===r.getUint16(a+12*c,o)){var l=r.getUint16(a+12*c+8,o);return l>=2&&8>=l&&(r.setUint16(a+12*c+8,1,o),t.fixedArrayBuffer=e.target.result),t.orientation=l,n.resolve(t)}}else{if(65280!=(65280&s))break;a+=r.getUint16(a,!1)}}return n.resolve(t)},n.promise},n.applyExifRotation=function(e){if(0!==e.type.indexOf("image/jpeg"))return n.emptyPromise(e);var r=t.defer();return n.readOrientation(e).then((function(t){return t.orientation<2||t.orientation>8?r.resolve(e):void n.dataUrl(e,!0).then((function(i){var a=document.createElement("canvas"),s=document.createElement("img");s.onload=function(){try{a.width=t.orientation>4?s.height:s.width,a.height=t.orientation>4?s.width:s.height;var i=a.getContext("2d");(function(e,t,n,r){switch(t){case 2:return e.transform(-1,0,0,1,n,0);case 3:return e.transform(-1,0,0,-1,n,r);case 4:return e.transform(1,0,0,-1,0,r);case 5:return e.transform(0,1,1,0,0,0);case 6:return e.transform(0,1,-1,0,r,0);case 7:return e.transform(0,-1,-1,0,r,n);case 8:e.transform(0,-1,1,0,0,n)}})(i,t.orientation,s.width,s.height),i.drawImage(s,0,0);var o=a.toDataURL(e.type||"image/WebP",.934);o=n.restoreExif(function(e){for(var t="",n=new Uint8Array(e),r=n.byteLength,i=0;r>i;i++)t+=String.fromCharCode(n[i]);return window.btoa(t)}(t.fixedArrayBuffer),o);var u=n.dataUrltoBlob(o,e.name);r.resolve(u)}catch(e){return r.reject(e)}},s.onerror=function(){r.reject()},s.src=i}),(function(e){r.reject(e)}))}),(function(e){r.reject(e)})),r.promise},n.restoreExif=function(e,t){var n={KEY_STR:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode64:function(e){var t,n,r,i,a,s="",o="",u="",c=0;do{r=(t=e[c++])>>2,i=(3&t)<<4|(n=e[c++])>>4,a=(15&n)<<2|(o=e[c++])>>6,u=63&o,isNaN(n)?a=u=64:isNaN(o)&&(u=64),s=s+this.KEY_STR.charAt(r)+this.KEY_STR.charAt(i)+this.KEY_STR.charAt(a)+this.KEY_STR.charAt(u),t=n=o="",r=i=a=u=""}while(c<e.length);return s},restore:function(e,t){e.match("data:image/jpeg;base64,")&&(e=e.replace("data:image/jpeg;base64,",""));var n=this.decode64(e),r=this.slice2Segments(n),i=this.exifManipulation(t,r);return"data:image/jpeg;base64,"+this.encode64(i)},exifManipulation:function(e,t){var n=this.getExifArray(t),r=this.insertExif(e,n);return new Uint8Array(r)},getExifArray:function(e){for(var t,n=0;n<e.length;n++)if(255===(t=e[n])[0]&225===t[1])return t;return[]},insertExif:function(e,t){var n=e.replace("data:image/jpeg;base64,",""),r=this.decode64(n),i=r.indexOf(255,3),a=r.slice(0,i),s=r.slice(i),o=a;return(o=o.concat(t)).concat(s)},slice2Segments:function(e){for(var t=0,n=[];!(255===e[t]&218===e[t+1]);){if(255===e[t]&216===e[t+1])t+=2;else{var r=t+(256*e[t+2]+e[t+3])+2,i=e.slice(t,r);n.push(i),t=r}if(t>e.length)break}return n},decode64:function(e){var t,n,r,i,a="",s="",o=0,u=[];/[^A-Za-z0-9\+\/\=]/g.exec(e)&&console.log("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, NaNExpect errors in decoding."),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{t=this.KEY_STR.indexOf(e.charAt(o++))<<2|(r=this.KEY_STR.indexOf(e.charAt(o++)))>>4,n=(15&r)<<4|(i=this.KEY_STR.indexOf(e.charAt(o++)))>>2,a=(3&i)<<6|(s=this.KEY_STR.indexOf(e.charAt(o++))),u.push(t),64!==i&&u.push(n),64!==s&&u.push(a),t=n=a="",r=i=s=""}while(o<e.length);return u}};return n.restore(e,t)},n}])},function(e,t){
|
|
40
40
|
/*! 12.2.13 */
|
|
41
|
-
!function(){function e(e,t){window.XMLHttpRequest.prototype[e]=t(window.XMLHttpRequest.prototype[e])}function t(e,t,n){try{Object.defineProperty(e,t,{get:n})}catch(e){}}if(window.FileAPI||(window.FileAPI={}),!window.XMLHttpRequest)throw"AJAX is not supported. XMLHttpRequest is not defined.";if(FileAPI.shouldLoad=!window.FormData||FileAPI.forceLoad,FileAPI.shouldLoad){var n=function(e){if(!e.__listeners){e.upload||(e.upload={}),e.__listeners=[];var t=e.upload.addEventListener;e.upload.addEventListener=function(n,r){e.__listeners[n]=r,t&&t.apply(this,arguments)}}};e("open",(function(e){return function(t,r,i){n(this),this.__url=r;try{e.apply(this,[t,r,i])}catch(n){n.message.indexOf("Access is denied")>-1&&(this.__origError=n,e.apply(this,[t,"_fix_for_ie_crossdomain__",i]))}}})),e("getResponseHeader",(function(e){return function(t){return this.__fileApiXHR&&this.__fileApiXHR.getResponseHeader?this.__fileApiXHR.getResponseHeader(t):null==e?null:e.apply(this,[t])}})),e("getAllResponseHeaders",(function(e){return function(){return this.__fileApiXHR&&this.__fileApiXHR.getAllResponseHeaders?this.__fileApiXHR.getAllResponseHeaders():null==e?null:e.apply(this)}})),e("abort",(function(e){return function(){return this.__fileApiXHR&&this.__fileApiXHR.abort?this.__fileApiXHR.abort():null==e?null:e.apply(this)}})),e("setRequestHeader",(function(e){return function(t,r){if("__setXHR_"===t){n(this);var i=r(this);i instanceof Function&&i(this)}else this.__requestHeaders=this.__requestHeaders||{},this.__requestHeaders[t]=r,e.apply(this,arguments)}})),e("send",(function(e){return function(){var n=this;if(arguments[0]&&arguments[0].__isFileAPIShim){for(var r=arguments[0],i={url:n.__url,jsonp:!1,cache:!0,complete:function(e,r){e&&angular.isString(e)&&-1!==e.indexOf("#2174")&&(e=null),n.__completed=!0,!e&&n.__listeners.load&&n.__listeners.load({type:"load",loaded:n.__loaded,total:n.__total,target:n,lengthComputable:!0}),!e&&n.__listeners.loadend&&n.__listeners.loadend({type:"loadend",loaded:n.__loaded,total:n.__total,target:n,lengthComputable:!0}),"abort"===e&&n.__listeners.abort&&n.__listeners.abort({type:"abort",loaded:n.__loaded,total:n.__total,target:n,lengthComputable:!0}),void 0!==r.status&&t(n,"status",(function(){return 0===r.status&&e&&"abort"!==e?500:r.status})),void 0!==r.statusText&&t(n,"statusText",(function(){return r.statusText})),t(n,"readyState",(function(){return 4})),void 0!==r.response&&t(n,"response",(function(){return r.response}));var i=r.responseText||(e&&0===r.status&&"abort"!==e?e:void 0);t(n,"responseText",(function(){return i})),t(n,"response",(function(){return i})),e&&t(n,"err",(function(){return e})),n.__fileApiXHR=r,n.onreadystatechange&&n.onreadystatechange(),n.onload&&n.onload()},progress:function(e){if(e.target=n,n.__listeners.progress&&n.__listeners.progress(e),n.__total=e.total,n.__loaded=e.loaded,e.total===e.loaded){var t=this;setTimeout((function(){n.__completed||(n.getAllResponseHeaders=function(){},t.complete(null,{status:204,statusText:"No Content"}))}),FileAPI.noContentTimeout||1e4)}},headers:n.__requestHeaders,data:{},files:{}},a=0;a<r.data.length;a++){var s=r.data[a];null!=s.val&&null!=s.val.name&&null!=s.val.size&&null!=s.val.type?i.files[s.key]=s.val:i.data[s.key]=s.val}setTimeout((function(){if(!FileAPI.hasFlash)throw'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';n.__fileApiXHR=FileAPI.upload(i)}),1)}else{if(this.__origError)throw this.__origError;e.apply(n,arguments)}}})),window.XMLHttpRequest.__isFileAPIShim=!0,window.FormData=FormData=function(){return{append:function(e,t,n){t.__isFileAPIBlobShim&&(t=t.data[0]),this.data.push({key:e,val:t,name:n})},data:[],__isFileAPIShim:!0}},window.Blob=Blob=function(e){return{data:e,__isFileAPIBlobShim:!0}}}}(),function(){function e(){try{if(new ActiveXObject("ShockwaveFlash.ShockwaveFlash"))return!0}catch(e){if(void 0!==navigator.mimeTypes["application/x-shockwave-flash"])return!0}return!1}function t(e){var t=0,n=0;if(window.jQuery)return jQuery(e).offset();if(e.offsetParent)do{t+=e.offsetLeft-e.scrollLeft,n+=e.offsetTop-e.scrollTop,e=e.offsetParent}while(e);return{left:t,top:n}}if(FileAPI.shouldLoad){if(FileAPI.hasFlash=e(),FileAPI.forceLoad&&(FileAPI.html5=!1),!FileAPI.upload){var n,r,i,a,s,o=document.createElement("script"),u=document.getElementsByTagName("script");if(window.FileAPI.jsUrl)n=window.FileAPI.jsUrl;else if(window.FileAPI.jsPath)r=window.FileAPI.jsPath;else for(i=0;i<u.length;i++)if((a=(s=u[i].src).search(/\/ng\-file\-upload[\-a-zA-z0-9\.]*\.js/))>-1){r=s.substring(0,a+1);break}null==FileAPI.staticPath&&(FileAPI.staticPath=r),o.setAttribute("src",n||r+"FileAPI.min.js"),document.getElementsByTagName("head")[0].appendChild(o)}FileAPI.ngfFixIE=function(n,r,i){if(!e())throw'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';n.bind("mouseenter",(function(){var e=r.parent();n.attr("disabled")?e&&e.removeClass("js-fileapi-wrapper"):(r.attr("__ngf_flash_")||(r.unbind("change"),r.unbind("click"),r.bind("change",(function(e){a.apply(this,[e]),i.apply(this,[e])})),r.attr("__ngf_flash_","true")),e.addClass("js-fileapi-wrapper"),function(e){return"input"===e[0].tagName.toLowerCase()&&e.attr("type")&&"file"===e.attr("type").toLowerCase()}(n)||(e.css("position","absolute").css("top",t(n[0]).top+"px").css("left",t(n[0]).left+"px").css("width",n[0].offsetWidth+"px").css("height",n[0].offsetHeight+"px").css("filter","alpha(opacity=0)").css("display",n.css("display")).css("overflow","hidden").css("z-index","900000").css("visibility","visible"),r.css("width",n[0].offsetWidth+"px").css("height",n[0].offsetHeight+"px").css("position","absolute").css("top","0px").css("left","0px")))}));var a=function(e){for(var t=FileAPI.getFiles(e),n=0;n<t.length;n++)void 0===t[n].size&&(t[n].size=0),void 0===t[n].name&&(t[n].name="file"),void 0===t[n].type&&(t[n].type="undefined");e.target||(e.target={}),e.target.files=t,e.target.files!==t&&(e.__files_=t),(e.__files_||e.target.files).item=function(t){return(e.__files_||e.target.files)[t]||null}}},FileAPI.disableFileInput=function(e,t){t?e.removeClass("js-fileapi-wrapper"):e.addClass("js-fileapi-wrapper")}}}(),window.FileReader||(window.FileReader=function(){var e=this,t=!1;this.listeners={},this.addEventListener=function(t,n){e.listeners[t]=e.listeners[t]||[],e.listeners[t].push(n)},this.removeEventListener=function(t,n){e.listeners[t]&&e.listeners[t].splice(e.listeners[t].indexOf(n),1)},this.dispatchEvent=function(t){var n=e.listeners[t.type];if(n)for(var r=0;r<n.length;r++)n[r].call(e,t)},this.onabort=this.onerror=this.onload=this.onloadstart=this.onloadend=this.onprogress=null;var n=function(t,n){var r={type:t,target:e,loaded:n.loaded,total:n.total,error:n.error};return null!=n.result&&(r.target.result=n.result),r},r=function(r){var i;t||(t=!0,e.onloadstart&&e.onloadstart(n("loadstart",r))),"load"===r.type?(e.onloadend&&e.onloadend(n("loadend",r)),i=n("load",r),e.onload&&e.onload(i),e.dispatchEvent(i)):"progress"===r.type?(i=n("progress",r),e.onprogress&&e.onprogress(i),e.dispatchEvent(i)):(i=n("error",r),e.onerror&&e.onerror(i),e.dispatchEvent(i))};this.readAsDataURL=function(e){FileAPI.readAsDataURL(e,r)},this.readAsText=function(e){FileAPI.readAsText(e,r)}})},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t);n(2),n(20),n(23),n(160),n(15),n(24);const r=["ngRoute","graphdb.workbench.se.controllers","graphdb.framework.core","angularCancelOnNavigateModule","oc.lazyLoad","graphdb.framework.core.interceptors.unauthorized","graphdb.framework.core.directives.rdfresourcesearch.rdfresourcesearch"],i=function(e){const t=angular.module("graphdb.workbench",r);t.config(["$routeProvider","$locationProvider","$menuItemsProvider","toastrConfig","localStorageServiceProvider","$tooltipProvider","$httpProvider","$templateRequestProvider",function(t,r,i,a,s,o,u,c){angular.extend(a,{timeOut:5e3,positionClass:"toast-bottom-right"}),s.setStorageType("localStorage").setNotify(!0,!0);var l=t.$get[t.$get.length-1]({$on:function(){}});t.when("_openid_implicit_",{controller:function(){},template:"<div></div>"}),l.routes._openid_implicit_.regexp=/[&/](?:id_token=.*&access_token=|access_token=.*&id_token=)/,PluginRegistry.get("route").forEach((function(e){t.when(e.url,{controller:e.controller,templateUrl:e.templateUrl,title:e.title,helpInfo:e.helpInfo,reloadOnSearch:void 0===e.reloadOnSearch||e.reloadOnSearch,resolve:{preload:["$ocLazyLoad","$q",function(t,r){return e.path?n(161)(`./${e.path}`).then(n=>{t.inject(e.module)}):r.defer().resolve()}]}})})),t.otherwise({templateUrl:"pages/not_found.html"}),r.html5Mode(!0),o.setTriggers({show:"hide"}),o.options({appendToBody:!0}),i.setProductInfo(e),PluginRegistry.get("main.menu").forEach((function(e){e.items.forEach((function(e){i.addItem(e)}))})),u.interceptors.push("$unauthorizedInterceptor");const h=c.$get[3];"function"==typeof h&&(c.$get[3]=function(e,t,n){const r=h(e,t,n);return function(t,n){return e.get(t)||(t+="?v=1.10.1"),r(t,n)}})}]),t.constant("isEnterprise","enterprise"===e.productType),t.constant("isFreeEdition","free"===e.productType),t.constant("productInfo",e),t.run(["$rootScope","$route","toastr","$sce",function(e,t,n,r){e.$on("$routeChangeSuccess",(function(){t.current.title?document.title=t.current.title+" | GraphDB Workbench":document.title="GraphDB Workbench",e.helpInfo=r.trustAsHtml(t.current.helpInfo),e.title=t.current.title,n.clear()}))}]),angular.bootstrap(document,["graphdb.workbench"])};$.get("rest/info/version?local=1",(function(e){const t=e.productVersion.match(/^(\d+\.\d+)/);t.length?e.productShortVersion=t[1]:e.productShortVersion=e.productVersion,"enterprise"===e.productType?(r.push("graphdb.framework.clustermanagement"),Promise.all([n.e(4),n.e(2),n.e(7),n.e(8),n.e(13)]).then((function(){var t=[n(27)];(function(){i(e)}).apply(null,t)})).catch(n.oe)):i(e)}))},function(e,t){!function(e,t,n){"use strict";t.module("ngAnimate",["ng"]).directive("ngAnimateChildren",(function(){return function(e,n,r){r=r.ngAnimateChildren,t.isString(r)&&0===r.length?n.data("$$ngAnimateChildren",!0):e.$watch(r,(function(e){n.data("$$ngAnimateChildren",!!e)}))}})).factory("$$animateReflow",["$$rAF","$document",function(e,t){return function(t){return e((function(){t()}))}}]).config(["$provide","$animateProvider",function(r,i){function a(e){for(var t=0;t<e.length;t++){var n=e[t];if(1==n.nodeType)return n}}function s(e,t){return a(e)==a(t)}var o,u=t.noop,c=t.forEach,l=i.$$selectors,h=t.isArray,f=t.isString,d=t.isObject,p={running:!0};r.decorator("$animate",["$delegate","$$q","$injector","$sniffer","$rootElement","$$asyncCallback","$rootScope","$document","$templateRequest","$$jqLite",function(e,n,r,g,m,v,y,b,w,x){function S(e,t){var n=e.data("$$ngAnimateState")||{};return t&&(n.running=!0,n.structural=!0,e.data("$$ngAnimateState",n)),n.disabled||n.running&&n.structural}function E(e){var t,r=n.defer();return r.promise.$$cancelFn=function(){t&&t()},y.$$postDigest((function(){t=e((function(){r.resolve()}))})),r.promise}function A(e){if(d(e))return e.tempClasses&&f(e.tempClasses)&&(e.tempClasses=e.tempClasses.split(/\s+/)),e}function F(e,n,i,a){function s(e,t){var n=e[t],r=e["before"+t.charAt(0).toUpperCase()+t.substr(1)];if(n||r)return"leave"==t&&(r=n,n=null),A.push({event:t,fn:n}),x.push({event:t,fn:r}),!0}function o(t,n,r){var s=[];c(t,(function(e){e.fn&&s.push(e)}));var o=0;c(s,(function(t,c){var l=function(){e:{if(n){if((n[c]||u)(),++o<s.length)break e;n=null}r()}};switch(t.event){case"setClass":n.push(t.fn(e,d,p,l,a));break;case"animate":n.push(t.fn(e,i,a.from,a.to,l));break;case"addClass":n.push(t.fn(e,d||i,l,a));break;case"removeClass":n.push(t.fn(e,p||i,l,a));break;default:n.push(t.fn(e,l,a))}})),n&&0===n.length&&r()}var f=e[0];if(f){var d,p;a&&(a.to=a.to||{},a.from=a.from||{}),h(i)&&(d=i[0],p=i[1],d?p?i=d+" "+p:(i=d,n="addClass"):(i=p,n="removeClass"));var m="setClass"==n,v=m||"addClass"==n||"removeClass"==n||"animate"==n,y=e.attr("class")+" "+i;if(P(y)){var b=u,w=[],x=[],S=u,E=[],A=[];y=(" "+y).replace(/\s+/g,".");return c(function(e){if(e){var t=[],n={};e=e.substr(1).split("."),(g.transitions||g.animations)&&t.push(r.get(l[""]));for(var i=0;i<e.length;i++){var a=e[i],s=l[a];s&&!n[a]&&(t.push(r.get(s)),n[a]=!0)}return t}}(y),(function(e){!s(e,n)&&m&&(s(e,"addClass"),s(e,"removeClass"))})),{node:f,event:n,className:i,isClassBased:v,isSetClassOperation:m,applyStyles:function(){a&&e.css(t.extend(a.from||{},a.to||{}))},before:function(e){b=e,o(x,w,(function(){b=u,e()}))},after:function(e){S=e,o(A,E,(function(){S=u,e()}))},cancel:function(){w&&(c(w,(function(e){(e||u)(!0)})),b(!0)),E&&(c(E,(function(e){(e||u)(!0)})),S(!0))}}}}}function C(e,n,r,i,a,l,h,f){function d(t){var i="$animate:"+t;S&&S[i]&&0<S[i].length&&v((function(){r.triggerHandler(i,{event:e,className:n})}))}function g(){d("before")}function y(){d("after")}function b(){b.hasBeenRun||(b.hasBeenRun=!0,l())}function w(){if(!w.hasBeenRun){x&&x.applyStyles(),w.hasBeenRun=!0,h&&h.tempClasses&&c(h.tempClasses,(function(e){o.removeClass(r,e)}));var e=r.data("$$ngAnimateState");e&&(x&&x.isClassBased?R(r,n):(v((function(){var e=r.data("$$ngAnimateState")||{};I==e.index&&R(r,n)})),r.data("$$ngAnimateState",e))),d("close"),f()}}var x=F(r,e,n,h);if(!x)return b(),g(),y(),w(),u;e=x.event,n=x.className;var S=(S=t.element._data(x.node))&&S.events;if(i||(i=a?a.parent():r.parent()),function(e,n){if(p.disabled)return!0;if(s(e,m))return p.running;var r,i,a;do{if(0===n.length)break;var o=s(n,m),u=o?p:n.data("$$ngAnimateState")||{};if(u.disabled)return!0;o&&(a=!0),!1!==r&&(o=n.data("$$ngAnimateChildren"),t.isDefined(o)&&(r=o)),i=i||u.running||u.last&&!u.last.isClassBased}while(n=n.parent());return!a||!r&&i}(r,i))return b(),g(),y(),w(),u;var E=(i=r.data("$$ngAnimateState")||{}).active||{},A=i.totalActive||0,C=i.last;if(a=!1,0<A){if(A=[],x.isClassBased)"setClass"==C.event?(A.push(C),R(r,n)):E[n]&&((D=E[n]).event==e?a=!0:(A.push(D),R(r,n)));else if("leave"==e&&E["ng-leave"])a=!0;else{for(var D in E)A.push(E[D]);i={},R(r,!0)}0<A.length&&c(A,(function(e){e.cancel()}))}if(!x.isClassBased||x.isSetClassOperation||"animate"==e||a||(a="addClass"==e==r.hasClass(n)),a)return b(),g(),y(),d("close"),f(),u;E=i.active||{},A=i.totalActive||0,"leave"==e&&r.one("$destroy",(function(e){var n=(e=t.element(this)).data("$$ngAnimateState");n&&(n=n.active["ng-leave"])&&(n.cancel(),R(e,"ng-leave"))})),o.addClass(r,"ng-animate"),h&&h.tempClasses&&c(h.tempClasses,(function(e){o.addClass(r,e)}));var I=T++;return A++,E[n]=x,r.data("$$ngAnimateState",{last:x,active:E,index:I,totalActive:A}),g(),x.before((function(t){var i=r.data("$$ngAnimateState");t=t||!i||!i.active[n]||x.isClassBased&&i.active[n].event!=e,b(),!0===t?w():(y(),x.after(w))})),x.cancel}function D(e){(e=a(e))&&(e=t.isFunction(e.getElementsByClassName)?e.getElementsByClassName("ng-animate"):e.querySelectorAll(".ng-animate"),c(e,(function(e){(e=(e=t.element(e)).data("$$ngAnimateState"))&&e.active&&c(e.active,(function(e){e.cancel()}))})))}function R(e,t){if(s(e,m))p.disabled||(p.running=!1,p.structural=!1);else if(t){var n=e.data("$$ngAnimateState")||{},r=!0===t;!r&&n.active&&n.active[t]&&(n.totalActive--,delete n.active[t]),!r&&n.totalActive||(o.removeClass(e,"ng-animate"),e.removeData("$$ngAnimateState"))}}o=x,m.data("$$ngAnimateState",p);var I=y.$watch((function(){return w.totalPendingRequests}),(function(e,t){0===e&&(I(),y.$$postDigest((function(){y.$$postDigest((function(){p.running=!1}))})))})),T=0,$=i.classNameFilter(),P=$?function(e){return $.test(e)}:function(){return!0};return{animate:function(e,n,r,i,s){return i=i||"ng-inline-animate",(s=A(s)||{}).from=r?n:null,s.to=r||n,E((function(n){return C("animate",i,t.element(a(e)),null,null,u,s,n)}))},enter:function(n,r,i,s){return s=A(s),n=t.element(n),r=r&&t.element(r),i=i&&t.element(i),S(n,!0),e.enter(n,r,i),E((function(e){return C("enter","ng-enter",t.element(a(n)),r,i,u,s,e)}))},leave:function(n,r){return r=A(r),D(n=t.element(n)),S(n,!0),E((function(i){return C("leave","ng-leave",t.element(a(n)),null,null,(function(){e.leave(n)}),r,i)}))},move:function(n,r,i,s){return s=A(s),n=t.element(n),r=r&&t.element(r),i=i&&t.element(i),D(n),S(n,!0),e.move(n,r,i),E((function(e){return C("move","ng-move",t.element(a(n)),r,i,u,s,e)}))},addClass:function(e,t,n){return this.setClass(e,t,[],n)},removeClass:function(e,t,n){return this.setClass(e,[],t,n)},setClass:function(n,r,i,s){if(s=A(s),n=t.element(n),S(n=t.element(a(n))))return e.$$setClassImmediately(n,r,i,s);var o,u=n.data("$$animateClasses"),l=!!u;return u||(u={classes:{}}),o=u.classes,r=h(r)?r:r.split(" "),c(r,(function(e){e&&e.length&&(o[e]=!0)})),i=h(i)?i:i.split(" "),c(i,(function(e){e&&e.length&&(o[e]=!1)})),l?(s&&u.options&&(u.options=t.extend(u.options||{},s)),u.promise):(n.data("$$animateClasses",u={classes:o,options:s}),u.promise=E((function(t){var r=n.parent(),i=a(n);if((s=i.parentNode)&&!s.$$NG_REMOVED&&!i.$$NG_REMOVED){i=n.data("$$animateClasses"),n.removeData("$$animateClasses");var s=n.data("$$ngAnimateState")||{},o=function(e,t,n){var r={};c(n=n||{},(function(e,t){c(t.split(" "),(function(t){r[t]=e}))}));var i=Object.create(null);c((e.attr("class")||"").split(/\s+/),(function(e){i[e]=!0}));var a=[],s=[];return c(t&&t.classes||[],(function(e,t){var n=i[t],o=r[t]||{};!1===e?(n||"addClass"==o.event)&&s.push(t):!0===e&&(n&&"removeClass"!=o.event||a.push(t))})),0<a.length+s.length&&[a.join(" "),s.join(" ")]}(n,i,s.active);return o?C("setClass",o,n,r,null,(function(){o[0]&&e.$$addClassImmediately(n,o[0]),o[1]&&e.$$removeClassImmediately(n,o[1])}),i.options,t):t()}t()})))},cancel:function(e){e.$$cancelFn()},enabled:function(e,t){switch(arguments.length){case 2:if(e)R(t);else{var n=t.data("$$ngAnimateState")||{};n.disabled=!0,t.data("$$ngAnimateState",n)}break;case 1:p.disabled=!e;break;default:e=!p.disabled}return!!e}}}]),i.register("",["$window","$sniffer","$timeout","$$animateReflow",function(r,i,s,l){function d(){T||(T=l((function(){_=[],T=null,$={}})))}function p(e,t){T&&T(),_.push(t),T=l((function(){c(_,(function(e){e()})),_=[],T=null,$={}}))}function g(e,n){var r=a(e);e=t.element(r),B.push(e),(r=Date.now()+n)<=O||(s.cancel(k),O=r,k=s((function(){!function(e){c(e,(function(e){(e=e.data("$$ngAnimateCSS3Data"))&&c(e.closeAnimationFns,(function(e){e()}))}))}(B),B=[]}),n,!1))}function m(e,t){var n=t?$[t]:null;if(!n){var i=0,a=0,s=0,o=0;c(e,(function(e){if(1==e.nodeType){e=r.getComputedStyle(e)||{},i=Math.max(v(e[F+"Duration"]),i),a=Math.max(v(e[F+"Delay"]),a),o=Math.max(v(e[D+"Delay"]),o);var t=v(e[D+"Duration"]);0<t&&(t*=parseInt(e[D+"IterationCount"],10)||1),s=Math.max(t,s)}})),n={total:0,transitionDelay:a,transitionDuration:i,animationDelay:o,animationDuration:s},t&&($[t]=n)}return n}function v(e){var t=0;return e=f(e)?e.split(/\s*,\s*/):[],c(e,(function(e){t=Math.max(parseFloat(e)||0,t)})),t}function y(e,t,n,r){var i;e=0<=["ng-enter","ng-leave","ng-move"].indexOf(n),(u=(s=t.parent()).data("$$ngAnimateKey"))||(s.data("$$ngAnimateKey",++P),u=P),i=u+"-"+a(t).getAttribute("class");var s,u,c={};0<(u=$[s=i+" "+n]?++$[s].total:0)&&((i=!$[c=i+" "+(l=n+"-stagger")])&&o.addClass(t,l),c=m(t,c),i&&o.removeClass(t,l));o.addClass(t,n);var l=t.data("$$ngAnimateCSS3Data")||{},h=m(t,s);return i=h.transitionDuration,h=h.animationDuration,e&&0===i&&0===h?(o.removeClass(t,n),!1):(n=r||e&&0<i,e=0<h&&0<c.animationDelay&&0===c.animationDuration,t.data("$$ngAnimateCSS3Data",{stagger:c,cacheKey:s,running:l.running||0,itemIndex:u,blockTransition:n,closeAnimationFns:l.closeAnimationFns||[]}),s=a(t),n&&(b(s,!0),r&&t.css(r)),e&&(s.style[D+"PlayState"]="paused"),!0)}function b(e,t){e.style[F+"Property"]=t?"none":""}function w(e,t,n,r){if(y(e,t,n,r))return function(e){e&&E(t,n)}}function x(e,t,n,r,i){if(t.data("$$ngAnimateCSS3Data"))return function(e,t,n,r,i){function u(){t.off(P,l),o.removeClass(t,f),o.removeClass(t,d),T&&s.cancel(T),E(t,n);var e,r=a(t);for(e in p)r.style.removeProperty(p[e])}function l(e){e.stopPropagation();var t=e.originalEvent||e;e=t.$manualTimeStamp||t.timeStamp||Date.now(),t=parseFloat(t.elapsedTime.toFixed(3)),Math.max(e-$,0)>=F&&t>=A&&r()}var h=a(t);if(e=t.data("$$ngAnimateCSS3Data"),-1!=h.getAttribute("class").indexOf(n)&&e){var f="",d="";c(n.split(" "),(function(e,t){var n=(0<t?" ":"")+e;f+=n+"-active",d+=n+"-pending"}));var p=[],v=e.itemIndex,y=e.stagger,w=0;if(0<v){w=0,0<y.transitionDelay&&0===y.transitionDuration&&(w=y.transitionDelay*v);var x=0;0<y.animationDelay&&0===y.animationDuration&&(x=y.animationDelay*v,p.push(I+"animation-play-state")),w=Math.round(100*Math.max(w,x))/100}w||(o.addClass(t,f),e.blockTransition&&b(h,!1));var S=m(t,e.cacheKey+" "+f),A=Math.max(S.transitionDuration,S.animationDuration);if(0!==A){!w&&i&&(S.transitionDuration||(t.css("transition",S.animationDuration+"s linear all"),p.push("transition")),t.css(i));var F=1e3*(v=Math.max(S.transitionDelay,S.animationDelay));0<p.length&&(";"!==(y=h.getAttribute("style")||"").charAt(y.length-1)&&(y+=";"),h.setAttribute("style",y+" "));var T,$=Date.now(),P=R+" "+C;v=1e3*(w+1.5*(v+A));return 0<w&&(o.addClass(t,d),T=s((function(){T=null,0<S.transitionDuration&&b(h,!1),0<S.animationDuration&&(h.style[D+"PlayState"]=""),o.addClass(t,f),o.removeClass(t,d),i&&(0===S.transitionDuration&&t.css("transition",S.animationDuration+"s linear all"),t.css(i),p.push("transition"))}),1e3*w,!1)),t.on(P,l),e.closeAnimationFns.push((function(){u(),r()})),e.running++,g(t,v),u}o.removeClass(t,f),E(t,n),r()}else r()}(e,t,n,r,i);E(t,n),r()}function S(e,t,n,r,i){var a=w(e,t,n,i.from);if(a){var s=a;return p(0,(function(){s=x(e,t,n,r,i.to)})),function(e){(s||u)(e)}}d(),r()}function E(e,t){o.removeClass(e,t);var n=e.data("$$ngAnimateCSS3Data");n&&(n.running&&n.running--,n.running&&0!==n.running||e.removeData("$$ngAnimateCSS3Data"))}function A(e,t){var n="";return e=h(e)?e:e.split(/\s+/),c(e,(function(e,r){e&&0<e.length&&(n+=(0<r?" ":"")+e+t)})),n}var F,C,D,R,I="";e.ontransitionend===n&&e.onwebkittransitionend!==n?(I="-webkit-",F="WebkitTransition",C="webkitTransitionEnd transitionend"):(F="transition",C="transitionend"),e.onanimationend===n&&e.onwebkitanimationend!==n?(I="-webkit-",D="WebkitAnimation",R="webkitAnimationEnd animationend"):(D="animation",R="animationend");var T,$={},P=0,_=[],k=null,O=0,B=[];return{animate:function(e,t,n,r,i,a){return(a=a||{}).from=n,a.to=r,S("animate",e,t,i,a)},enter:function(e,t,n){return S("enter",e,"ng-enter",t,n=n||{})},leave:function(e,t,n){return S("leave",e,"ng-leave",t,n=n||{})},move:function(e,t,n){return S("move",e,"ng-move",t,n=n||{})},beforeSetClass:function(e,t,n,r,i){if(i=i||{},i=w("setClass",e,t=A(n,"-remove")+" "+A(t,"-add"),i.from))return p(0,r),i;d(),r()},beforeAddClass:function(e,t,n,r){if(r=r||{},t=w("addClass",e,A(t,"-add"),r.from))return p(0,n),t;d(),n()},beforeRemoveClass:function(e,t,n,r){if(r=r||{},t=w("removeClass",e,A(t,"-remove"),r.from))return p(0,n),t;d(),n()},setClass:function(e,t,n,r,i){return i=i||{},x("setClass",e,(n=A(n,"-remove"))+" "+(t=A(t,"-add")),r,i.to)},addClass:function(e,t,n,r){return r=r||{},x("addClass",e,A(t,"-add"),n,r.to)},removeClass:function(e,t,n,r){return r=r||{},x("removeClass",e,A(t,"-remove"),n,r.to)}}}])}])}(window,window.angular)},function(e,t){!function(e,t,n){"use strict";t.module("ngCookies",["ng"]).factory("$cookies",["$rootScope","$browser",function(e,n){var r,i={},a={},s=!1,o=t.copy,u=t.isUndefined;return n.addPollFn((function(){var t=n.cookies();r!=t&&(r=t,o(t,a),o(t,i),s&&e.$apply())}))(),s=!0,e.$watch((function(){var e,r,s;for(e in a)u(i[e])&&n.cookies(e,void 0);for(e in i)r=i[e],t.isString(r)||(r=""+r,i[e]=r),r!==a[e]&&(n.cookies(e,r),s=!0);if(s)for(e in r=n.cookies(),i)i[e]!==r[e]&&(u(r[e])?delete i[e]:i[e]=r[e])})),i}]).factory("$cookieStore",["$cookies",function(e){return{get:function(n){return(n=e[n])?t.fromJson(n):n},put:function(n,r){e[n]=t.toJson(r)},remove:function(t){delete e[t]}}}])}(window,window.angular)},function(e,t){!function(e,t,n){"use strict";function r(e,n,r){return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",link:function(i,a,s,o,u){function c(){d&&(r.cancel(d),d=null),h&&(h.$destroy(),h=null),f&&((d=r.leave(f)).then((function(){d=null})),f=null)}function l(){var s=e.current&&e.current.locals;if(t.isDefined(s&&s.$template)){s=i.$new();var o=e.current;f=u(s,(function(e){r.enter(e,null,f||a).then((function(){!t.isDefined(p)||p&&!i.$eval(p)||n()})),c()})),(h=o.scope=s).$emit("$viewContentLoaded"),h.$eval(g)}else c()}var h,f,d,p=s.autoscroll,g=s.onload||"";i.$on("$routeChangeSuccess",l),l()}}}function i(e,t,n){return{restrict:"ECA",priority:-400,link:function(r,i){var a=n.current,s=a.locals;i.html(s.$template);var o=e(i.contents());a.controller&&(s.$scope=r,s=t(a.controller,s),a.controllerAs&&(r[a.controllerAs]=s),i.data("$ngControllerController",s),i.children().data("$ngControllerController",s)),o(r)}}}e=t.module("ngRoute",["ng"]).provider("$route",(function(){function e(e,n){return t.extend(Object.create(e),n)}function n(e,t){var n=t.caseInsensitiveMatch,r={originalPath:e,regexp:e},i=r.keys=[];return e=e.replace(/([().])/g,"\\$1").replace(/(\/)?:(\w+)([\?\*])?/g,(function(e,t,n,r){return e="?"===r?r:null,r="*"===r?r:null,i.push({name:n,optional:!!e}),t=t||"",(e?"":t)+"(?:"+(e?t:"")+(r?"(.+?)":"([^/]+)")+(e||"")+")"+(e||"")})).replace(/([\/$\*])/g,"\\$1"),r.regexp=new RegExp("^"+e+"$",n?"i":""),r}var r={};this.when=function(e,i){var a=t.copy(i);if(t.isUndefined(a.reloadOnSearch)&&(a.reloadOnSearch=!0),t.isUndefined(a.caseInsensitiveMatch)&&(a.caseInsensitiveMatch=this.caseInsensitiveMatch),r[e]=t.extend(a,e&&n(e,a)),e){var s="/"==e[e.length-1]?e.substr(0,e.length-1):e+"/";r[s]=t.extend({redirectTo:e},n(s,a))}return this},this.caseInsensitiveMatch=!1,this.otherwise=function(e){return"string"==typeof e&&(e={redirectTo:e}),this.when(null,e),this},this.$get=["$rootScope","$location","$routeParams","$q","$injector","$templateRequest","$sce",function(n,i,s,o,u,c,l){function h(a){var s=v.current;(g=(p=function(){var n,a;return t.forEach(r,(function(r,s){var o;if(o=!a){var u=i.path();o=r.keys;var c={};if(r.regexp)if(u=r.regexp.exec(u)){for(var l=1,h=u.length;l<h;++l){var f=o[l-1],d=u[l];f&&d&&(c[f.name]=d)}o=c}else o=null;else o=null;o=n=o}o&&((a=e(r,{params:t.extend({},i.search(),n),pathParams:n})).$$route=r)})),a||r.null&&e(r.null,{params:{},pathParams:{}})}())&&s&&p.$$route===s.$$route&&t.equals(p.pathParams,s.pathParams)&&!p.reloadOnSearch&&!m)||!s&&!p||n.$broadcast("$routeChangeStart",p,s).defaultPrevented&&a&&a.preventDefault()}function f(){var e=v.current,r=p;g?(e.params=r.params,t.copy(e.params,s),n.$broadcast("$routeUpdate",e)):(r||e)&&(m=!1,(v.current=r)&&r.redirectTo&&(t.isString(r.redirectTo)?i.path(d(r.redirectTo,r.params)).search(r.params).replace():i.url(r.redirectTo(r.pathParams,i.path(),i.search())).replace()),o.when(r).then((function(){if(r){var e,n,i=t.extend({},r.resolve);return t.forEach(i,(function(e,n){i[n]=t.isString(e)?u.get(e):u.invoke(e,null,null,n)})),t.isDefined(e=r.template)?t.isFunction(e)&&(e=e(r.params)):t.isDefined(n=r.templateUrl)&&(t.isFunction(n)&&(n=n(r.params)),n=l.getTrustedResourceUrl(n),t.isDefined(n)&&(r.loadedTemplateUrl=n,e=c(n))),t.isDefined(e)&&(i.$template=e),o.all(i)}})).then((function(i){r==v.current&&(r&&(r.locals=i,t.copy(r.params,s)),n.$broadcast("$routeChangeSuccess",r,e))}),(function(t){r==v.current&&n.$broadcast("$routeChangeError",r,e,t)})))}function d(e,n){var r=[];return t.forEach((e||"").split(":"),(function(e,t){if(0===t)r.push(e);else{var i=e.match(/(\w+)(?:[?*])?(.*)/),a=i[1];r.push(n[a]),r.push(i[2]||""),delete n[a]}})),r.join("")}var p,g,m=!1,v={routes:r,reload:function(){m=!0,n.$evalAsync((function(){h(),f()}))},updateParams:function(e){if(!this.current||!this.current.$$route)throw a("norout");var n={},r=this;t.forEach(Object.keys(e),(function(t){r.current.pathParams[t]||(n[t]=e[t])})),e=t.extend({},this.current.params,e),i.path(d(this.current.$$route.originalPath,e)),i.search(t.extend({},i.search(),n))}};return n.$on("$locationChangeStart",h),n.$on("$locationChangeSuccess",f),v}]}));var a=t.$$minErr("ngRoute");e.provider("$routeParams",(function(){this.$get=function(){return{}}})),e.directive("ngView",r),e.directive("ngView",i),r.$inject=["$route","$anchorScroll","$animate"],i.$inject=["$compile","$controller","$route"]}(window,window.angular)},function(e,t){
|
|
41
|
+
!function(){function e(e,t){window.XMLHttpRequest.prototype[e]=t(window.XMLHttpRequest.prototype[e])}function t(e,t,n){try{Object.defineProperty(e,t,{get:n})}catch(e){}}if(window.FileAPI||(window.FileAPI={}),!window.XMLHttpRequest)throw"AJAX is not supported. XMLHttpRequest is not defined.";if(FileAPI.shouldLoad=!window.FormData||FileAPI.forceLoad,FileAPI.shouldLoad){var n=function(e){if(!e.__listeners){e.upload||(e.upload={}),e.__listeners=[];var t=e.upload.addEventListener;e.upload.addEventListener=function(n,r){e.__listeners[n]=r,t&&t.apply(this,arguments)}}};e("open",(function(e){return function(t,r,i){n(this),this.__url=r;try{e.apply(this,[t,r,i])}catch(n){n.message.indexOf("Access is denied")>-1&&(this.__origError=n,e.apply(this,[t,"_fix_for_ie_crossdomain__",i]))}}})),e("getResponseHeader",(function(e){return function(t){return this.__fileApiXHR&&this.__fileApiXHR.getResponseHeader?this.__fileApiXHR.getResponseHeader(t):null==e?null:e.apply(this,[t])}})),e("getAllResponseHeaders",(function(e){return function(){return this.__fileApiXHR&&this.__fileApiXHR.getAllResponseHeaders?this.__fileApiXHR.getAllResponseHeaders():null==e?null:e.apply(this)}})),e("abort",(function(e){return function(){return this.__fileApiXHR&&this.__fileApiXHR.abort?this.__fileApiXHR.abort():null==e?null:e.apply(this)}})),e("setRequestHeader",(function(e){return function(t,r){if("__setXHR_"===t){n(this);var i=r(this);i instanceof Function&&i(this)}else this.__requestHeaders=this.__requestHeaders||{},this.__requestHeaders[t]=r,e.apply(this,arguments)}})),e("send",(function(e){return function(){var n=this;if(arguments[0]&&arguments[0].__isFileAPIShim){for(var r=arguments[0],i={url:n.__url,jsonp:!1,cache:!0,complete:function(e,r){e&&angular.isString(e)&&-1!==e.indexOf("#2174")&&(e=null),n.__completed=!0,!e&&n.__listeners.load&&n.__listeners.load({type:"load",loaded:n.__loaded,total:n.__total,target:n,lengthComputable:!0}),!e&&n.__listeners.loadend&&n.__listeners.loadend({type:"loadend",loaded:n.__loaded,total:n.__total,target:n,lengthComputable:!0}),"abort"===e&&n.__listeners.abort&&n.__listeners.abort({type:"abort",loaded:n.__loaded,total:n.__total,target:n,lengthComputable:!0}),void 0!==r.status&&t(n,"status",(function(){return 0===r.status&&e&&"abort"!==e?500:r.status})),void 0!==r.statusText&&t(n,"statusText",(function(){return r.statusText})),t(n,"readyState",(function(){return 4})),void 0!==r.response&&t(n,"response",(function(){return r.response}));var i=r.responseText||(e&&0===r.status&&"abort"!==e?e:void 0);t(n,"responseText",(function(){return i})),t(n,"response",(function(){return i})),e&&t(n,"err",(function(){return e})),n.__fileApiXHR=r,n.onreadystatechange&&n.onreadystatechange(),n.onload&&n.onload()},progress:function(e){if(e.target=n,n.__listeners.progress&&n.__listeners.progress(e),n.__total=e.total,n.__loaded=e.loaded,e.total===e.loaded){var t=this;setTimeout((function(){n.__completed||(n.getAllResponseHeaders=function(){},t.complete(null,{status:204,statusText:"No Content"}))}),FileAPI.noContentTimeout||1e4)}},headers:n.__requestHeaders,data:{},files:{}},a=0;a<r.data.length;a++){var s=r.data[a];null!=s.val&&null!=s.val.name&&null!=s.val.size&&null!=s.val.type?i.files[s.key]=s.val:i.data[s.key]=s.val}setTimeout((function(){if(!FileAPI.hasFlash)throw'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';n.__fileApiXHR=FileAPI.upload(i)}),1)}else{if(this.__origError)throw this.__origError;e.apply(n,arguments)}}})),window.XMLHttpRequest.__isFileAPIShim=!0,window.FormData=FormData=function(){return{append:function(e,t,n){t.__isFileAPIBlobShim&&(t=t.data[0]),this.data.push({key:e,val:t,name:n})},data:[],__isFileAPIShim:!0}},window.Blob=Blob=function(e){return{data:e,__isFileAPIBlobShim:!0}}}}(),function(){function e(){try{if(new ActiveXObject("ShockwaveFlash.ShockwaveFlash"))return!0}catch(e){if(void 0!==navigator.mimeTypes["application/x-shockwave-flash"])return!0}return!1}function t(e){var t=0,n=0;if(window.jQuery)return jQuery(e).offset();if(e.offsetParent)do{t+=e.offsetLeft-e.scrollLeft,n+=e.offsetTop-e.scrollTop,e=e.offsetParent}while(e);return{left:t,top:n}}if(FileAPI.shouldLoad){if(FileAPI.hasFlash=e(),FileAPI.forceLoad&&(FileAPI.html5=!1),!FileAPI.upload){var n,r,i,a,s,o=document.createElement("script"),u=document.getElementsByTagName("script");if(window.FileAPI.jsUrl)n=window.FileAPI.jsUrl;else if(window.FileAPI.jsPath)r=window.FileAPI.jsPath;else for(i=0;i<u.length;i++)if((a=(s=u[i].src).search(/\/ng\-file\-upload[\-a-zA-z0-9\.]*\.js/))>-1){r=s.substring(0,a+1);break}null==FileAPI.staticPath&&(FileAPI.staticPath=r),o.setAttribute("src",n||r+"FileAPI.min.js"),document.getElementsByTagName("head")[0].appendChild(o)}FileAPI.ngfFixIE=function(n,r,i){if(!e())throw'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';n.bind("mouseenter",(function(){var e=r.parent();n.attr("disabled")?e&&e.removeClass("js-fileapi-wrapper"):(r.attr("__ngf_flash_")||(r.unbind("change"),r.unbind("click"),r.bind("change",(function(e){a.apply(this,[e]),i.apply(this,[e])})),r.attr("__ngf_flash_","true")),e.addClass("js-fileapi-wrapper"),function(e){return"input"===e[0].tagName.toLowerCase()&&e.attr("type")&&"file"===e.attr("type").toLowerCase()}(n)||(e.css("position","absolute").css("top",t(n[0]).top+"px").css("left",t(n[0]).left+"px").css("width",n[0].offsetWidth+"px").css("height",n[0].offsetHeight+"px").css("filter","alpha(opacity=0)").css("display",n.css("display")).css("overflow","hidden").css("z-index","900000").css("visibility","visible"),r.css("width",n[0].offsetWidth+"px").css("height",n[0].offsetHeight+"px").css("position","absolute").css("top","0px").css("left","0px")))}));var a=function(e){for(var t=FileAPI.getFiles(e),n=0;n<t.length;n++)void 0===t[n].size&&(t[n].size=0),void 0===t[n].name&&(t[n].name="file"),void 0===t[n].type&&(t[n].type="undefined");e.target||(e.target={}),e.target.files=t,e.target.files!==t&&(e.__files_=t),(e.__files_||e.target.files).item=function(t){return(e.__files_||e.target.files)[t]||null}}},FileAPI.disableFileInput=function(e,t){t?e.removeClass("js-fileapi-wrapper"):e.addClass("js-fileapi-wrapper")}}}(),window.FileReader||(window.FileReader=function(){var e=this,t=!1;this.listeners={},this.addEventListener=function(t,n){e.listeners[t]=e.listeners[t]||[],e.listeners[t].push(n)},this.removeEventListener=function(t,n){e.listeners[t]&&e.listeners[t].splice(e.listeners[t].indexOf(n),1)},this.dispatchEvent=function(t){var n=e.listeners[t.type];if(n)for(var r=0;r<n.length;r++)n[r].call(e,t)},this.onabort=this.onerror=this.onload=this.onloadstart=this.onloadend=this.onprogress=null;var n=function(t,n){var r={type:t,target:e,loaded:n.loaded,total:n.total,error:n.error};return null!=n.result&&(r.target.result=n.result),r},r=function(r){var i;t||(t=!0,e.onloadstart&&e.onloadstart(n("loadstart",r))),"load"===r.type?(e.onloadend&&e.onloadend(n("loadend",r)),i=n("load",r),e.onload&&e.onload(i),e.dispatchEvent(i)):"progress"===r.type?(i=n("progress",r),e.onprogress&&e.onprogress(i),e.dispatchEvent(i)):(i=n("error",r),e.onerror&&e.onerror(i),e.dispatchEvent(i))};this.readAsDataURL=function(e){FileAPI.readAsDataURL(e,r)},this.readAsText=function(e){FileAPI.readAsText(e,r)}})},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t);n(2),n(20),n(23),n(160),n(15),n(24);const r=["ngRoute","graphdb.workbench.se.controllers","graphdb.framework.core","angularCancelOnNavigateModule","oc.lazyLoad","graphdb.framework.core.interceptors.unauthorized","graphdb.framework.core.directives.rdfresourcesearch.rdfresourcesearch"],i=function(e){const t=angular.module("graphdb.workbench",r);t.config(["$routeProvider","$locationProvider","$menuItemsProvider","toastrConfig","localStorageServiceProvider","$tooltipProvider","$httpProvider","$templateRequestProvider",function(t,r,i,a,s,o,u,c){angular.extend(a,{timeOut:5e3,positionClass:"toast-bottom-right"}),s.setStorageType("localStorage").setNotify(!0,!0);var l=t.$get[t.$get.length-1]({$on:function(){}});t.when("_openid_implicit_",{controller:function(){},template:"<div></div>"}),l.routes._openid_implicit_.regexp=/[&/](?:id_token=.*&access_token=|access_token=.*&id_token=)/,PluginRegistry.get("route").forEach((function(e){t.when(e.url,{controller:e.controller,templateUrl:e.templateUrl,title:e.title,helpInfo:e.helpInfo,reloadOnSearch:void 0===e.reloadOnSearch||e.reloadOnSearch,resolve:{preload:["$ocLazyLoad","$q",function(t,r){return e.path?n(161)(`./${e.path}`).then(n=>{t.inject(e.module)}):r.defer().resolve()}]}})})),t.otherwise({templateUrl:"pages/not_found.html"}),r.html5Mode(!0),o.setTriggers({show:"hide"}),o.options({appendToBody:!0}),i.setProductInfo(e),PluginRegistry.get("main.menu").forEach((function(e){e.items.forEach((function(e){i.addItem(e)}))})),u.interceptors.push("$unauthorizedInterceptor");const h=c.$get[3];"function"==typeof h&&(c.$get[3]=function(e,t,n){const r=h(e,t,n);return function(t,n){return e.get(t)||(t+="?v=1.10.2"),r(t,n)}})}]),t.constant("isEnterprise","enterprise"===e.productType),t.constant("isFreeEdition","free"===e.productType),t.constant("productInfo",e),t.run(["$rootScope","$route","toastr","$sce",function(e,t,n,r){e.$on("$routeChangeSuccess",(function(){t.current.title?document.title=t.current.title+" | GraphDB Workbench":document.title="GraphDB Workbench",e.helpInfo=r.trustAsHtml(t.current.helpInfo),e.title=t.current.title,n.clear()}))}]),angular.bootstrap(document,["graphdb.workbench"])};$.get("rest/info/version?local=1",(function(e){const t=e.productVersion.match(/^(\d+\.\d+)/);t.length?e.productShortVersion=t[1]:e.productShortVersion=e.productVersion,"enterprise"===e.productType?(r.push("graphdb.framework.clustermanagement"),Promise.all([n.e(4),n.e(2),n.e(7),n.e(8),n.e(13)]).then((function(){var t=[n(27)];(function(){i(e)}).apply(null,t)})).catch(n.oe)):i(e)}))},function(e,t){!function(e,t,n){"use strict";t.module("ngAnimate",["ng"]).directive("ngAnimateChildren",(function(){return function(e,n,r){r=r.ngAnimateChildren,t.isString(r)&&0===r.length?n.data("$$ngAnimateChildren",!0):e.$watch(r,(function(e){n.data("$$ngAnimateChildren",!!e)}))}})).factory("$$animateReflow",["$$rAF","$document",function(e,t){return function(t){return e((function(){t()}))}}]).config(["$provide","$animateProvider",function(r,i){function a(e){for(var t=0;t<e.length;t++){var n=e[t];if(1==n.nodeType)return n}}function s(e,t){return a(e)==a(t)}var o,u=t.noop,c=t.forEach,l=i.$$selectors,h=t.isArray,f=t.isString,d=t.isObject,p={running:!0};r.decorator("$animate",["$delegate","$$q","$injector","$sniffer","$rootElement","$$asyncCallback","$rootScope","$document","$templateRequest","$$jqLite",function(e,n,r,g,m,v,y,b,w,x){function S(e,t){var n=e.data("$$ngAnimateState")||{};return t&&(n.running=!0,n.structural=!0,e.data("$$ngAnimateState",n)),n.disabled||n.running&&n.structural}function E(e){var t,r=n.defer();return r.promise.$$cancelFn=function(){t&&t()},y.$$postDigest((function(){t=e((function(){r.resolve()}))})),r.promise}function A(e){if(d(e))return e.tempClasses&&f(e.tempClasses)&&(e.tempClasses=e.tempClasses.split(/\s+/)),e}function F(e,n,i,a){function s(e,t){var n=e[t],r=e["before"+t.charAt(0).toUpperCase()+t.substr(1)];if(n||r)return"leave"==t&&(r=n,n=null),A.push({event:t,fn:n}),x.push({event:t,fn:r}),!0}function o(t,n,r){var s=[];c(t,(function(e){e.fn&&s.push(e)}));var o=0;c(s,(function(t,c){var l=function(){e:{if(n){if((n[c]||u)(),++o<s.length)break e;n=null}r()}};switch(t.event){case"setClass":n.push(t.fn(e,d,p,l,a));break;case"animate":n.push(t.fn(e,i,a.from,a.to,l));break;case"addClass":n.push(t.fn(e,d||i,l,a));break;case"removeClass":n.push(t.fn(e,p||i,l,a));break;default:n.push(t.fn(e,l,a))}})),n&&0===n.length&&r()}var f=e[0];if(f){var d,p;a&&(a.to=a.to||{},a.from=a.from||{}),h(i)&&(d=i[0],p=i[1],d?p?i=d+" "+p:(i=d,n="addClass"):(i=p,n="removeClass"));var m="setClass"==n,v=m||"addClass"==n||"removeClass"==n||"animate"==n,y=e.attr("class")+" "+i;if(P(y)){var b=u,w=[],x=[],S=u,E=[],A=[];y=(" "+y).replace(/\s+/g,".");return c(function(e){if(e){var t=[],n={};e=e.substr(1).split("."),(g.transitions||g.animations)&&t.push(r.get(l[""]));for(var i=0;i<e.length;i++){var a=e[i],s=l[a];s&&!n[a]&&(t.push(r.get(s)),n[a]=!0)}return t}}(y),(function(e){!s(e,n)&&m&&(s(e,"addClass"),s(e,"removeClass"))})),{node:f,event:n,className:i,isClassBased:v,isSetClassOperation:m,applyStyles:function(){a&&e.css(t.extend(a.from||{},a.to||{}))},before:function(e){b=e,o(x,w,(function(){b=u,e()}))},after:function(e){S=e,o(A,E,(function(){S=u,e()}))},cancel:function(){w&&(c(w,(function(e){(e||u)(!0)})),b(!0)),E&&(c(E,(function(e){(e||u)(!0)})),S(!0))}}}}}function C(e,n,r,i,a,l,h,f){function d(t){var i="$animate:"+t;S&&S[i]&&0<S[i].length&&v((function(){r.triggerHandler(i,{event:e,className:n})}))}function g(){d("before")}function y(){d("after")}function b(){b.hasBeenRun||(b.hasBeenRun=!0,l())}function w(){if(!w.hasBeenRun){x&&x.applyStyles(),w.hasBeenRun=!0,h&&h.tempClasses&&c(h.tempClasses,(function(e){o.removeClass(r,e)}));var e=r.data("$$ngAnimateState");e&&(x&&x.isClassBased?R(r,n):(v((function(){var e=r.data("$$ngAnimateState")||{};I==e.index&&R(r,n)})),r.data("$$ngAnimateState",e))),d("close"),f()}}var x=F(r,e,n,h);if(!x)return b(),g(),y(),w(),u;e=x.event,n=x.className;var S=(S=t.element._data(x.node))&&S.events;if(i||(i=a?a.parent():r.parent()),function(e,n){if(p.disabled)return!0;if(s(e,m))return p.running;var r,i,a;do{if(0===n.length)break;var o=s(n,m),u=o?p:n.data("$$ngAnimateState")||{};if(u.disabled)return!0;o&&(a=!0),!1!==r&&(o=n.data("$$ngAnimateChildren"),t.isDefined(o)&&(r=o)),i=i||u.running||u.last&&!u.last.isClassBased}while(n=n.parent());return!a||!r&&i}(r,i))return b(),g(),y(),w(),u;var E=(i=r.data("$$ngAnimateState")||{}).active||{},A=i.totalActive||0,C=i.last;if(a=!1,0<A){if(A=[],x.isClassBased)"setClass"==C.event?(A.push(C),R(r,n)):E[n]&&((D=E[n]).event==e?a=!0:(A.push(D),R(r,n)));else if("leave"==e&&E["ng-leave"])a=!0;else{for(var D in E)A.push(E[D]);i={},R(r,!0)}0<A.length&&c(A,(function(e){e.cancel()}))}if(!x.isClassBased||x.isSetClassOperation||"animate"==e||a||(a="addClass"==e==r.hasClass(n)),a)return b(),g(),y(),d("close"),f(),u;E=i.active||{},A=i.totalActive||0,"leave"==e&&r.one("$destroy",(function(e){var n=(e=t.element(this)).data("$$ngAnimateState");n&&(n=n.active["ng-leave"])&&(n.cancel(),R(e,"ng-leave"))})),o.addClass(r,"ng-animate"),h&&h.tempClasses&&c(h.tempClasses,(function(e){o.addClass(r,e)}));var I=T++;return A++,E[n]=x,r.data("$$ngAnimateState",{last:x,active:E,index:I,totalActive:A}),g(),x.before((function(t){var i=r.data("$$ngAnimateState");t=t||!i||!i.active[n]||x.isClassBased&&i.active[n].event!=e,b(),!0===t?w():(y(),x.after(w))})),x.cancel}function D(e){(e=a(e))&&(e=t.isFunction(e.getElementsByClassName)?e.getElementsByClassName("ng-animate"):e.querySelectorAll(".ng-animate"),c(e,(function(e){(e=(e=t.element(e)).data("$$ngAnimateState"))&&e.active&&c(e.active,(function(e){e.cancel()}))})))}function R(e,t){if(s(e,m))p.disabled||(p.running=!1,p.structural=!1);else if(t){var n=e.data("$$ngAnimateState")||{},r=!0===t;!r&&n.active&&n.active[t]&&(n.totalActive--,delete n.active[t]),!r&&n.totalActive||(o.removeClass(e,"ng-animate"),e.removeData("$$ngAnimateState"))}}o=x,m.data("$$ngAnimateState",p);var I=y.$watch((function(){return w.totalPendingRequests}),(function(e,t){0===e&&(I(),y.$$postDigest((function(){y.$$postDigest((function(){p.running=!1}))})))})),T=0,$=i.classNameFilter(),P=$?function(e){return $.test(e)}:function(){return!0};return{animate:function(e,n,r,i,s){return i=i||"ng-inline-animate",(s=A(s)||{}).from=r?n:null,s.to=r||n,E((function(n){return C("animate",i,t.element(a(e)),null,null,u,s,n)}))},enter:function(n,r,i,s){return s=A(s),n=t.element(n),r=r&&t.element(r),i=i&&t.element(i),S(n,!0),e.enter(n,r,i),E((function(e){return C("enter","ng-enter",t.element(a(n)),r,i,u,s,e)}))},leave:function(n,r){return r=A(r),D(n=t.element(n)),S(n,!0),E((function(i){return C("leave","ng-leave",t.element(a(n)),null,null,(function(){e.leave(n)}),r,i)}))},move:function(n,r,i,s){return s=A(s),n=t.element(n),r=r&&t.element(r),i=i&&t.element(i),D(n),S(n,!0),e.move(n,r,i),E((function(e){return C("move","ng-move",t.element(a(n)),r,i,u,s,e)}))},addClass:function(e,t,n){return this.setClass(e,t,[],n)},removeClass:function(e,t,n){return this.setClass(e,[],t,n)},setClass:function(n,r,i,s){if(s=A(s),n=t.element(n),S(n=t.element(a(n))))return e.$$setClassImmediately(n,r,i,s);var o,u=n.data("$$animateClasses"),l=!!u;return u||(u={classes:{}}),o=u.classes,r=h(r)?r:r.split(" "),c(r,(function(e){e&&e.length&&(o[e]=!0)})),i=h(i)?i:i.split(" "),c(i,(function(e){e&&e.length&&(o[e]=!1)})),l?(s&&u.options&&(u.options=t.extend(u.options||{},s)),u.promise):(n.data("$$animateClasses",u={classes:o,options:s}),u.promise=E((function(t){var r=n.parent(),i=a(n);if((s=i.parentNode)&&!s.$$NG_REMOVED&&!i.$$NG_REMOVED){i=n.data("$$animateClasses"),n.removeData("$$animateClasses");var s=n.data("$$ngAnimateState")||{},o=function(e,t,n){var r={};c(n=n||{},(function(e,t){c(t.split(" "),(function(t){r[t]=e}))}));var i=Object.create(null);c((e.attr("class")||"").split(/\s+/),(function(e){i[e]=!0}));var a=[],s=[];return c(t&&t.classes||[],(function(e,t){var n=i[t],o=r[t]||{};!1===e?(n||"addClass"==o.event)&&s.push(t):!0===e&&(n&&"removeClass"!=o.event||a.push(t))})),0<a.length+s.length&&[a.join(" "),s.join(" ")]}(n,i,s.active);return o?C("setClass",o,n,r,null,(function(){o[0]&&e.$$addClassImmediately(n,o[0]),o[1]&&e.$$removeClassImmediately(n,o[1])}),i.options,t):t()}t()})))},cancel:function(e){e.$$cancelFn()},enabled:function(e,t){switch(arguments.length){case 2:if(e)R(t);else{var n=t.data("$$ngAnimateState")||{};n.disabled=!0,t.data("$$ngAnimateState",n)}break;case 1:p.disabled=!e;break;default:e=!p.disabled}return!!e}}}]),i.register("",["$window","$sniffer","$timeout","$$animateReflow",function(r,i,s,l){function d(){T||(T=l((function(){_=[],T=null,$={}})))}function p(e,t){T&&T(),_.push(t),T=l((function(){c(_,(function(e){e()})),_=[],T=null,$={}}))}function g(e,n){var r=a(e);e=t.element(r),B.push(e),(r=Date.now()+n)<=O||(s.cancel(k),O=r,k=s((function(){!function(e){c(e,(function(e){(e=e.data("$$ngAnimateCSS3Data"))&&c(e.closeAnimationFns,(function(e){e()}))}))}(B),B=[]}),n,!1))}function m(e,t){var n=t?$[t]:null;if(!n){var i=0,a=0,s=0,o=0;c(e,(function(e){if(1==e.nodeType){e=r.getComputedStyle(e)||{},i=Math.max(v(e[F+"Duration"]),i),a=Math.max(v(e[F+"Delay"]),a),o=Math.max(v(e[D+"Delay"]),o);var t=v(e[D+"Duration"]);0<t&&(t*=parseInt(e[D+"IterationCount"],10)||1),s=Math.max(t,s)}})),n={total:0,transitionDelay:a,transitionDuration:i,animationDelay:o,animationDuration:s},t&&($[t]=n)}return n}function v(e){var t=0;return e=f(e)?e.split(/\s*,\s*/):[],c(e,(function(e){t=Math.max(parseFloat(e)||0,t)})),t}function y(e,t,n,r){var i;e=0<=["ng-enter","ng-leave","ng-move"].indexOf(n),(u=(s=t.parent()).data("$$ngAnimateKey"))||(s.data("$$ngAnimateKey",++P),u=P),i=u+"-"+a(t).getAttribute("class");var s,u,c={};0<(u=$[s=i+" "+n]?++$[s].total:0)&&((i=!$[c=i+" "+(l=n+"-stagger")])&&o.addClass(t,l),c=m(t,c),i&&o.removeClass(t,l));o.addClass(t,n);var l=t.data("$$ngAnimateCSS3Data")||{},h=m(t,s);return i=h.transitionDuration,h=h.animationDuration,e&&0===i&&0===h?(o.removeClass(t,n),!1):(n=r||e&&0<i,e=0<h&&0<c.animationDelay&&0===c.animationDuration,t.data("$$ngAnimateCSS3Data",{stagger:c,cacheKey:s,running:l.running||0,itemIndex:u,blockTransition:n,closeAnimationFns:l.closeAnimationFns||[]}),s=a(t),n&&(b(s,!0),r&&t.css(r)),e&&(s.style[D+"PlayState"]="paused"),!0)}function b(e,t){e.style[F+"Property"]=t?"none":""}function w(e,t,n,r){if(y(e,t,n,r))return function(e){e&&E(t,n)}}function x(e,t,n,r,i){if(t.data("$$ngAnimateCSS3Data"))return function(e,t,n,r,i){function u(){t.off(P,l),o.removeClass(t,f),o.removeClass(t,d),T&&s.cancel(T),E(t,n);var e,r=a(t);for(e in p)r.style.removeProperty(p[e])}function l(e){e.stopPropagation();var t=e.originalEvent||e;e=t.$manualTimeStamp||t.timeStamp||Date.now(),t=parseFloat(t.elapsedTime.toFixed(3)),Math.max(e-$,0)>=F&&t>=A&&r()}var h=a(t);if(e=t.data("$$ngAnimateCSS3Data"),-1!=h.getAttribute("class").indexOf(n)&&e){var f="",d="";c(n.split(" "),(function(e,t){var n=(0<t?" ":"")+e;f+=n+"-active",d+=n+"-pending"}));var p=[],v=e.itemIndex,y=e.stagger,w=0;if(0<v){w=0,0<y.transitionDelay&&0===y.transitionDuration&&(w=y.transitionDelay*v);var x=0;0<y.animationDelay&&0===y.animationDuration&&(x=y.animationDelay*v,p.push(I+"animation-play-state")),w=Math.round(100*Math.max(w,x))/100}w||(o.addClass(t,f),e.blockTransition&&b(h,!1));var S=m(t,e.cacheKey+" "+f),A=Math.max(S.transitionDuration,S.animationDuration);if(0!==A){!w&&i&&(S.transitionDuration||(t.css("transition",S.animationDuration+"s linear all"),p.push("transition")),t.css(i));var F=1e3*(v=Math.max(S.transitionDelay,S.animationDelay));0<p.length&&(";"!==(y=h.getAttribute("style")||"").charAt(y.length-1)&&(y+=";"),h.setAttribute("style",y+" "));var T,$=Date.now(),P=R+" "+C;v=1e3*(w+1.5*(v+A));return 0<w&&(o.addClass(t,d),T=s((function(){T=null,0<S.transitionDuration&&b(h,!1),0<S.animationDuration&&(h.style[D+"PlayState"]=""),o.addClass(t,f),o.removeClass(t,d),i&&(0===S.transitionDuration&&t.css("transition",S.animationDuration+"s linear all"),t.css(i),p.push("transition"))}),1e3*w,!1)),t.on(P,l),e.closeAnimationFns.push((function(){u(),r()})),e.running++,g(t,v),u}o.removeClass(t,f),E(t,n),r()}else r()}(e,t,n,r,i);E(t,n),r()}function S(e,t,n,r,i){var a=w(e,t,n,i.from);if(a){var s=a;return p(0,(function(){s=x(e,t,n,r,i.to)})),function(e){(s||u)(e)}}d(),r()}function E(e,t){o.removeClass(e,t);var n=e.data("$$ngAnimateCSS3Data");n&&(n.running&&n.running--,n.running&&0!==n.running||e.removeData("$$ngAnimateCSS3Data"))}function A(e,t){var n="";return e=h(e)?e:e.split(/\s+/),c(e,(function(e,r){e&&0<e.length&&(n+=(0<r?" ":"")+e+t)})),n}var F,C,D,R,I="";e.ontransitionend===n&&e.onwebkittransitionend!==n?(I="-webkit-",F="WebkitTransition",C="webkitTransitionEnd transitionend"):(F="transition",C="transitionend"),e.onanimationend===n&&e.onwebkitanimationend!==n?(I="-webkit-",D="WebkitAnimation",R="webkitAnimationEnd animationend"):(D="animation",R="animationend");var T,$={},P=0,_=[],k=null,O=0,B=[];return{animate:function(e,t,n,r,i,a){return(a=a||{}).from=n,a.to=r,S("animate",e,t,i,a)},enter:function(e,t,n){return S("enter",e,"ng-enter",t,n=n||{})},leave:function(e,t,n){return S("leave",e,"ng-leave",t,n=n||{})},move:function(e,t,n){return S("move",e,"ng-move",t,n=n||{})},beforeSetClass:function(e,t,n,r,i){if(i=i||{},i=w("setClass",e,t=A(n,"-remove")+" "+A(t,"-add"),i.from))return p(0,r),i;d(),r()},beforeAddClass:function(e,t,n,r){if(r=r||{},t=w("addClass",e,A(t,"-add"),r.from))return p(0,n),t;d(),n()},beforeRemoveClass:function(e,t,n,r){if(r=r||{},t=w("removeClass",e,A(t,"-remove"),r.from))return p(0,n),t;d(),n()},setClass:function(e,t,n,r,i){return i=i||{},x("setClass",e,(n=A(n,"-remove"))+" "+(t=A(t,"-add")),r,i.to)},addClass:function(e,t,n,r){return r=r||{},x("addClass",e,A(t,"-add"),n,r.to)},removeClass:function(e,t,n,r){return r=r||{},x("removeClass",e,A(t,"-remove"),n,r.to)}}}])}])}(window,window.angular)},function(e,t){!function(e,t,n){"use strict";t.module("ngCookies",["ng"]).factory("$cookies",["$rootScope","$browser",function(e,n){var r,i={},a={},s=!1,o=t.copy,u=t.isUndefined;return n.addPollFn((function(){var t=n.cookies();r!=t&&(r=t,o(t,a),o(t,i),s&&e.$apply())}))(),s=!0,e.$watch((function(){var e,r,s;for(e in a)u(i[e])&&n.cookies(e,void 0);for(e in i)r=i[e],t.isString(r)||(r=""+r,i[e]=r),r!==a[e]&&(n.cookies(e,r),s=!0);if(s)for(e in r=n.cookies(),i)i[e]!==r[e]&&(u(r[e])?delete i[e]:i[e]=r[e])})),i}]).factory("$cookieStore",["$cookies",function(e){return{get:function(n){return(n=e[n])?t.fromJson(n):n},put:function(n,r){e[n]=t.toJson(r)},remove:function(t){delete e[t]}}}])}(window,window.angular)},function(e,t){!function(e,t,n){"use strict";function r(e,n,r){return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",link:function(i,a,s,o,u){function c(){d&&(r.cancel(d),d=null),h&&(h.$destroy(),h=null),f&&((d=r.leave(f)).then((function(){d=null})),f=null)}function l(){var s=e.current&&e.current.locals;if(t.isDefined(s&&s.$template)){s=i.$new();var o=e.current;f=u(s,(function(e){r.enter(e,null,f||a).then((function(){!t.isDefined(p)||p&&!i.$eval(p)||n()})),c()})),(h=o.scope=s).$emit("$viewContentLoaded"),h.$eval(g)}else c()}var h,f,d,p=s.autoscroll,g=s.onload||"";i.$on("$routeChangeSuccess",l),l()}}}function i(e,t,n){return{restrict:"ECA",priority:-400,link:function(r,i){var a=n.current,s=a.locals;i.html(s.$template);var o=e(i.contents());a.controller&&(s.$scope=r,s=t(a.controller,s),a.controllerAs&&(r[a.controllerAs]=s),i.data("$ngControllerController",s),i.children().data("$ngControllerController",s)),o(r)}}}e=t.module("ngRoute",["ng"]).provider("$route",(function(){function e(e,n){return t.extend(Object.create(e),n)}function n(e,t){var n=t.caseInsensitiveMatch,r={originalPath:e,regexp:e},i=r.keys=[];return e=e.replace(/([().])/g,"\\$1").replace(/(\/)?:(\w+)([\?\*])?/g,(function(e,t,n,r){return e="?"===r?r:null,r="*"===r?r:null,i.push({name:n,optional:!!e}),t=t||"",(e?"":t)+"(?:"+(e?t:"")+(r?"(.+?)":"([^/]+)")+(e||"")+")"+(e||"")})).replace(/([\/$\*])/g,"\\$1"),r.regexp=new RegExp("^"+e+"$",n?"i":""),r}var r={};this.when=function(e,i){var a=t.copy(i);if(t.isUndefined(a.reloadOnSearch)&&(a.reloadOnSearch=!0),t.isUndefined(a.caseInsensitiveMatch)&&(a.caseInsensitiveMatch=this.caseInsensitiveMatch),r[e]=t.extend(a,e&&n(e,a)),e){var s="/"==e[e.length-1]?e.substr(0,e.length-1):e+"/";r[s]=t.extend({redirectTo:e},n(s,a))}return this},this.caseInsensitiveMatch=!1,this.otherwise=function(e){return"string"==typeof e&&(e={redirectTo:e}),this.when(null,e),this},this.$get=["$rootScope","$location","$routeParams","$q","$injector","$templateRequest","$sce",function(n,i,s,o,u,c,l){function h(a){var s=v.current;(g=(p=function(){var n,a;return t.forEach(r,(function(r,s){var o;if(o=!a){var u=i.path();o=r.keys;var c={};if(r.regexp)if(u=r.regexp.exec(u)){for(var l=1,h=u.length;l<h;++l){var f=o[l-1],d=u[l];f&&d&&(c[f.name]=d)}o=c}else o=null;else o=null;o=n=o}o&&((a=e(r,{params:t.extend({},i.search(),n),pathParams:n})).$$route=r)})),a||r.null&&e(r.null,{params:{},pathParams:{}})}())&&s&&p.$$route===s.$$route&&t.equals(p.pathParams,s.pathParams)&&!p.reloadOnSearch&&!m)||!s&&!p||n.$broadcast("$routeChangeStart",p,s).defaultPrevented&&a&&a.preventDefault()}function f(){var e=v.current,r=p;g?(e.params=r.params,t.copy(e.params,s),n.$broadcast("$routeUpdate",e)):(r||e)&&(m=!1,(v.current=r)&&r.redirectTo&&(t.isString(r.redirectTo)?i.path(d(r.redirectTo,r.params)).search(r.params).replace():i.url(r.redirectTo(r.pathParams,i.path(),i.search())).replace()),o.when(r).then((function(){if(r){var e,n,i=t.extend({},r.resolve);return t.forEach(i,(function(e,n){i[n]=t.isString(e)?u.get(e):u.invoke(e,null,null,n)})),t.isDefined(e=r.template)?t.isFunction(e)&&(e=e(r.params)):t.isDefined(n=r.templateUrl)&&(t.isFunction(n)&&(n=n(r.params)),n=l.getTrustedResourceUrl(n),t.isDefined(n)&&(r.loadedTemplateUrl=n,e=c(n))),t.isDefined(e)&&(i.$template=e),o.all(i)}})).then((function(i){r==v.current&&(r&&(r.locals=i,t.copy(r.params,s)),n.$broadcast("$routeChangeSuccess",r,e))}),(function(t){r==v.current&&n.$broadcast("$routeChangeError",r,e,t)})))}function d(e,n){var r=[];return t.forEach((e||"").split(":"),(function(e,t){if(0===t)r.push(e);else{var i=e.match(/(\w+)(?:[?*])?(.*)/),a=i[1];r.push(n[a]),r.push(i[2]||""),delete n[a]}})),r.join("")}var p,g,m=!1,v={routes:r,reload:function(){m=!0,n.$evalAsync((function(){h(),f()}))},updateParams:function(e){if(!this.current||!this.current.$$route)throw a("norout");var n={},r=this;t.forEach(Object.keys(e),(function(t){r.current.pathParams[t]||(n[t]=e[t])})),e=t.extend({},this.current.params,e),i.path(d(this.current.$$route.originalPath,e)),i.search(t.extend({},i.search(),n))}};return n.$on("$locationChangeStart",h),n.$on("$locationChangeSuccess",f),v}]}));var a=t.$$minErr("ngRoute");e.provider("$routeParams",(function(){this.$get=function(){return{}}})),e.directive("ngView",r),e.directive("ngView",i),r.$inject=["$route","$anchorScroll","$animate"],i.$inject=["$compile","$controller","$route"]}(window,window.angular)},function(e,t){
|
|
42
42
|
/**
|
|
43
43
|
* An Angular module that gives you access to the browsers local storage
|
|
44
44
|
* @version v0.1.5 - 2014-11-04
|
|
@@ -76,4 +76,4 @@ var r=n(157),i=n(158),a=n(159);function s(){return u.TYPED_ARRAY_SUPPORT?2147483
|
|
|
76
76
|
* @author Olivier Combe <olivier.combe@gmail.com>
|
|
77
77
|
*/
|
|
78
78
|
!function(n,r){"use strict";var i=["ng","oc.lazyLoad"],a={},s=[],o=[],u=[],c=[],l=n.noop,h={},f=[];n.module("oc.lazyLoad",["ng"]).provider("$ocLazyLoad",["$controllerProvider","$provide","$compileProvider","$filterProvider","$injector","$animateProvider",function(e,t,d,m,v,y){var b={},w={$controllerProvider:e,$compileProvider:d,$filterProvider:m,$provide:t,$injector:v,$animateProvider:y},x=!1,S=!1,E=[],A={};E.push=function(e){-1===this.indexOf(e)&&Array.prototype.push.apply(this,arguments)},this.config=function(e){n.isDefined(e.modules)&&(n.isArray(e.modules)?n.forEach(e.modules,(function(e){b[e.name]=e})):b[e.modules.name]=e.modules),n.isDefined(e.debug)&&(x=e.debug),n.isDefined(e.events)&&(S=e.events)},this._init=function(e){if(0===o.length){var t=[e],a=["ng:app","ng-app","x-ng-app","data-ng-app"],s=/\sng[:\-]app(:\s*([\w\d_]+);?)?\s/,u=function(e){return e&&t.push(e)};n.forEach(a,(function(t){a[t]=!0,u(document.getElementById(t)),t=t.replace(":","\\:"),void 0!==e[0]&&e[0].querySelectorAll&&(n.forEach(e[0].querySelectorAll("."+t),u),n.forEach(e[0].querySelectorAll("."+t+"\\:"),u),n.forEach(e[0].querySelectorAll("["+t+"]"),u))})),n.forEach(t,(function(t){if(0===o.length){var r=" "+e.className+" ",i=s.exec(r);i?o.push((i[2]||"").replace(/\s+/g,",")):n.forEach(t.attributes,(function(e){0===o.length&&a[e.name]&&o.push(e.value)}))}}))}0!==o.length||(r.jasmine||r.mocha)&&n.isDefined(n.mock)||console.error("No module found during bootstrap, unable to init ocLazyLoad. You should always use the ng-app directive or angular.boostrap when you use ocLazyLoad.");n.forEach(o,(function(e){!function e(t){if(-1===i.indexOf(t)){i.push(t);var r=n.module(t);I(null,r._invokeQueue,t),I(null,r._configBlocks,t),n.forEach(r.requires,e)}}(e)})),o=[],c.pop()};var F=function(e){try{return JSON.stringify(e)}catch(r){var t=[];return JSON.stringify(e,(function(e,r){if(n.isObject(r)&&null!==r){if(-1!==t.indexOf(r))return;t.push(r)}return r}))}},C=function(e){var t,n,r=0;if(0==e.length)return r;for(t=0,n=e.length;t<n;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return r};function D(e,t,r){if(t){var a,s,o,c=[];for(a=t.length-1;a>=0;a--)if(s=t[a],n.isString(s)||(s=T(s)),s&&-1===f.indexOf(s)&&(!b[s]||-1!==u.indexOf(s))){var d=-1===i.indexOf(s);if(o=g(s),d&&(i.push(s),D(e,o.requires,r)),o._runBlocks.length>0)for(h[s]=[];o._runBlocks.length>0;)h[s].push(o._runBlocks.shift());n.isDefined(h[s])&&(d||r.rerun)&&(c=c.concat(h[s])),I(e,o._invokeQueue,s,r.reconfig),I(e,o._configBlocks,s,r.reconfig),l(d?"ocLazyLoad.moduleLoaded":"ocLazyLoad.moduleReloaded",s),t.pop(),f.push(s)}var p=e.getInstanceInjector();n.forEach(c,(function(e){p.invoke(e)}))}}function R(e,t){var r=e[2][0],i=e[1],s=!1;n.isUndefined(a[t])&&(a[t]={}),n.isUndefined(a[t][i])&&(a[t][i]={});var o=function(e,r){a[t][i].hasOwnProperty(e)||(a[t][i][e]=[]),function(e,t){var r,i=!0;t.length&&(r=u(e),n.forEach(t,(function(e){i=i&&u(e)!==r})));return i}(r,a[t][i][e])&&(s=!0,a[t][i][e].push(r),l("ocLazyLoad.componentLoaded",[t,i,e]))};function u(e){return n.isArray(e)?C(e.toString()):n.isObject(e)?C(F(e)):n.isDefined(e)&&null!==e?C(e.toString()):e}if(n.isString(r))o(r,e[2][1]);else{if(!n.isObject(r))return!1;n.forEach(r,(function(e,t){n.isString(e)?o(e,r[1]):o(t,e)}))}return s}function I(e,t,r,i){var a,o,u,c;if(t)for(a=0,o=t.length;a<o;a++)if(u=t[a],n.isArray(u)){if(null!==e){if(!e.hasOwnProperty(u[0]))throw new Error("unsupported provider "+u[0]);c=e[u[0]]}var l=R(u,r);if("invoke"!==u[1])l&&n.isDefined(c)&&c[u[1]].apply(c,u[2]);else{var h=function(e){var t=s.indexOf(r+"-"+e);(-1===t||i)&&(-1===t&&s.push(r+"-"+e),n.isDefined(c)&&c[u[1]].apply(c,u[2]))};if(n.isFunction(u[2][0]))h(u[2][0]);else if(n.isArray(u[2][0]))for(var f=0,d=u[2][0].length;f<d;f++)n.isFunction(u[2][0][f])&&h(u[2][0][f])}}}function T(e){var t=null;return n.isString(e)?t=e:n.isObject(e)&&e.hasOwnProperty("name")&&n.isString(e.name)&&(t=e.name),t}function $(e){if(!n.isString(e))return!1;try{return g(e)}catch(e){if(/No module/.test(e)||e.message.indexOf("$injector:nomod")>-1)return!1}}this.$get=["$log","$rootElement","$rootScope","$cacheFactory","$q",function(e,t,r,s,u){var h,d=s("ocLazyLoad");function m(t){var n=u.defer();return e.error(t.message),n.reject(t),n.promise}return x||((e={}).error=n.noop,e.warn=n.noop,e.info=n.noop),w.getInstanceInjector=function(){return h||(h=t.data("$injector")||n.injector())},{_broadcast:l=function(t,n){S&&r.$broadcast(t,n),x&&e.info(t,n)},_$log:e,_getFilesCache:function(){return d},toggleWatch:function(e){e?c.push(!0):c.pop()},getModuleConfig:function(e){if(!n.isString(e))throw new Error("You need to give the name of the module to get");return b[e]?n.copy(b[e]):null},setModuleConfig:function(e){if(!n.isObject(e))throw new Error("You need to give the module config object to set");return b[e.name]=e,e},getModules:function(){return i},isLoaded:function(e){var t=function(e){var t=i.indexOf(e)>-1;return t||(t=!!$(e)),t};if(n.isString(e)&&(e=[e]),n.isArray(e)){var r,a;for(r=0,a=e.length;r<a;r++)if(!t(e[r]))return!1;return!0}throw new Error("You need to define the module(s) name(s)")},_getModuleName:T,_getModule:function(e){try{return g(e)}catch(t){throw(/No module/.test(t)||t.message.indexOf("$injector:nomod")>-1)&&(t.message='The module "'+F(e)+'" that you are trying to load does not exist. '+t.message),t}},moduleExists:$,_loadDependencies:function(e,t){var r,i,a,s=[],o=this;if(null===(e=o._getModuleName(e)))return u.when();try{r=o._getModule(e)}catch(e){return m(e)}return i=o.getRequires(r),n.forEach(i,(function(r){if(n.isString(r)){var i=o.getModuleConfig(r);if(null===i)return void E.push(r);r=i,i.name=void 0}if(o.moduleExists(r.name))return 0!==(a=r.files.filter((function(e){return o.getModuleConfig(r.name).files.indexOf(e)<0}))).length&&o._$log.warn('Module "',e,'" attempted to redefine configuration for dependency. "',r.name,'"\n Additional Files Loaded:',a),n.isDefined(o.filesLoader)?void s.push(o.filesLoader(r,t).then((function(){return o._loadDependencies(r)}))):m(new Error("Error: New dependencies need to be loaded from external files ("+r.files+"), but no loader has been defined."));if(n.isArray(r)){var u=[];n.forEach(r,(function(e){var t=o.getModuleConfig(e);null===t?u.push(e):t.files&&(u=u.concat(t.files))})),u.length>0&&(r={files:u})}else n.isObject(r)&&r.hasOwnProperty("name")&&r.name&&(o.setModuleConfig(r),E.push(r.name));if(n.isDefined(r.files)&&0!==r.files.length){if(!n.isDefined(o.filesLoader))return m(new Error('Error: the module "'+r.name+'" is defined in external files ('+r.files+"), but no loader has been defined."));s.push(o.filesLoader(r,t).then((function(){return o._loadDependencies(r)})))}})),u.all(s)},inject:function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=!(arguments.length<=2||void 0===arguments[2])&&arguments[2],i=this,a=u.defer();if(n.isDefined(e)&&null!==e){if(n.isArray(e)){var s=[];return n.forEach(e,(function(e){s.push(i.inject(e,t,r))})),u.all(s)}i._addToLoadList(i._getModuleName(e),!0,r)}if(o.length>0){var c=o.slice(),l=function e(n){E.push(n),A[n]=a.promise,i._loadDependencies(n,t).then((function(){try{f=[],D(w,E,t)}catch(e){return i._$log.error(e.message),void a.reject(e)}o.length>0?e(o.shift()):a.resolve(c)}),(function(e){a.reject(e)}))};l(o.shift())}else{if(t&&t.name&&A[t.name])return A[t.name];a.resolve()}return a.promise},getRequires:function(e){var t=[];return n.forEach(e.requires,(function(e){-1===i.indexOf(e)&&t.push(e)})),t},_invokeQueue:I,_registerInvokeList:R,_register:D,_addToLoadList:p,_unregister:function(e){n.isDefined(e)&&n.isArray(e)&&n.forEach(e,(function(e){a[e]=void 0}))}}}],this._init(n.element(r.document))}]);var d=n.bootstrap;n.bootstrap=function(e,t,r){return i=["ng","oc.lazyLoad"],a={},s=[],o=[],u=[],c=[],l=n.noop,h={},f=[],n.forEach(t.slice(),(function(e){p(e,!0,!0)})),d(e,t,r)};var p=function(e,t,r){(c.length>0||t)&&n.isString(e)&&-1===o.indexOf(e)&&(o.push(e),r&&u.push(e))},g=n.module;n.module=function(e,t,n){return p(e,!1,!0),g(e,t,n)},e.exports===t&&(e.exports="oc.lazyLoad")}(angular,window),function(e){"use strict";e.module("oc.lazyLoad").directive("ocLazyLoad",["$ocLazyLoad","$compile","$animate","$parse","$timeout",function(t,n,r,i,a){return{restrict:"A",terminal:!0,priority:1e3,compile:function(a,s){var o=a[0].innerHTML;return a.html(""),function(a,s,u){var c=i(u.ocLazyLoad);a.$watch((function(){return c(a)||u.ocLazyLoad}),(function(i){e.isDefined(i)&&t.load(i).then((function(){r.enter(o,s),n(s.contents())(a)}))}),!0)}}}}])}(angular),function(e){"use strict";e.module("oc.lazyLoad").config(["$provide",function(t){t.decorator("$ocLazyLoad",["$delegate","$q","$window","$interval",function(t,n,r,i){var a=!1,s=r.document.getElementsByTagName("head")[0]||r.document.getElementsByTagName("body")[0];return t.buildElement=function(o,u,c){var l,h,f=n.defer(),d=t._getFilesCache(),p=function(e){var t=(new Date).getTime();return e.indexOf("?")>=0?"&"===e.substring(0,e.length-1)?e+"_dc="+t:e+"&_dc="+t:e+"?_dc="+t};switch(e.isUndefined(d.get(u))&&d.put(u,f.promise),o){case"css":(l=r.document.createElement("link")).type="text/css",l.rel="stylesheet",l.href=!1===c.cache?p(u):u;break;case"js":(l=r.document.createElement("script")).src=!1===c.cache?p(u):u;break;default:d.remove(u),f.reject(new Error('Requested type "'+o+'" is not known. Could not inject "'+u+'"'))}l.onload=l.onreadystatechange=function(e){l.readyState&&!/^c|loade/.test(l.readyState)||h||(l.onload=l.onreadystatechange=null,h=1,t._broadcast("ocLazyLoad.fileLoaded",u),f.resolve(l))},l.onerror=function(){d.remove(u),f.reject(new Error("Unable to load "+u))},l.async=c.serie?0:1;var g=s.lastChild;if(c.insertBefore){var m=e.element(e.isDefined(window.jQuery)?c.insertBefore:document.querySelector(c.insertBefore));m&&m.length>0&&(g=m[0])}if(g.parentNode.insertBefore(l,g),"css"==o){var v=r.navigator.userAgent.toLowerCase();if(v.indexOf("phantomjs/1.9")>-1)a=!0;else if(/iP(hone|od|ad)/.test(r.navigator.platform)){var y=r.navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),b=parseFloat([parseInt(y[1],10),parseInt(y[2],10),parseInt(y[3]||0,10)].join("."));a=b<6}else if(v.indexOf("android")>-1){var w=parseFloat(v.slice(v.indexOf("android")+8));a=w<4.4}else if(v.indexOf("safari")>-1){var x=v.match(/version\/([\.\d]+)/i);a=x&&x[1]&&parseFloat(x[1])<6}if(a)var S=1e3,E=i((function(){try{l.sheet.cssRules,i.cancel(E),l.onload()}catch(e){--S<=0&&l.onerror()}}),20)}return f.promise},t}])}])}(angular),function(e){"use strict";e.module("oc.lazyLoad").config(["$provide",function(t){t.decorator("$ocLazyLoad",["$delegate","$q",function(t,n){return t.filesLoader=function(r){var i=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],a=[],s=[],o=[],u=[],c=null,l=t._getFilesCache();t.toggleWatch(!0),e.extend(i,r);var h=function(n){var r,h=null;if(e.isObject(n)&&(h=n.type,n=n.path),c=l.get(n),e.isUndefined(c)||!1===i.cache){if(null!==(r=/^(css|less|html|htm|js)?(?=!)/.exec(n))&&(h=r[1],n=n.substr(r[1].length+1,n.length)),!h)if(null!==(r=/[.](css|less|html|htm|js)?((\?|#).*)?$/.exec(n)))h=r[1];else{if(t.jsLoader.hasOwnProperty("ocLazyLoadLoader")||!t.jsLoader.hasOwnProperty("requirejs"))return void t._$log.error("File type could not be determined. "+n);h="js"}"css"!==h&&"less"!==h||-1!==a.indexOf(n)?"html"!==h&&"htm"!==h||-1!==s.indexOf(n)?"js"===h||-1===o.indexOf(n)?o.push(n):t._$log.error("File type is not valid. "+n):s.push(n):a.push(n)}else c&&u.push(c)};if(i.serie?h(i.files.shift()):e.forEach(i.files,(function(e){h(e)})),a.length>0){var f=n.defer();t.cssLoader(a,(function(n){e.isDefined(n)&&t.cssLoader.hasOwnProperty("ocLazyLoadLoader")?(t._$log.error(n),f.reject(n)):f.resolve()}),i),u.push(f.promise)}if(s.length>0){var d=n.defer();t.templatesLoader(s,(function(n){e.isDefined(n)&&t.templatesLoader.hasOwnProperty("ocLazyLoadLoader")?(t._$log.error(n),d.reject(n)):d.resolve()}),i),u.push(d.promise)}if(o.length>0){var p=n.defer();t.jsLoader(o,(function(n){e.isDefined(n)&&(t.jsLoader.hasOwnProperty("ocLazyLoadLoader")||t.jsLoader.hasOwnProperty("requirejs"))?(t._$log.error(n),p.reject(n)):p.resolve()}),i),u.push(p.promise)}if(0===u.length){var g=n.defer(),m="Error: no file to load has been found, if you're trying to load an existing module you should use the 'inject' method instead of 'load'.";return t._$log.error(m),g.reject(m),g.promise}return i.serie&&i.files.length>0?n.all(u).then((function(){return t.filesLoader(r,i)})):n.all(u).finally((function(e){return t.toggleWatch(!1),e}))},t.load=function(r){var i,a=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],s=this,o=null,u=[],c=n.defer(),l=e.copy(r),h=e.copy(a);if(e.isArray(l))return e.forEach(l,(function(e){u.push(s.load(e,h))})),n.all(u).then((function(e){c.resolve(e)}),(function(e){c.reject(e)})),c.promise;if(e.isString(l)?(o=s.getModuleConfig(l))||(o={files:[l]}):e.isObject(l)&&(o=e.isDefined(l.path)&&e.isDefined(l.type)?{files:[l]}:s.setModuleConfig(l)),null===o){var f=s._getModuleName(l);return i='Module "'+(f||"unknown")+'" is not configured, cannot load.',t._$log.error(i),c.reject(new Error(i)),c.promise}e.isDefined(o.template)&&(e.isUndefined(o.files)&&(o.files=[]),e.isString(o.template)?o.files.push(o.template):e.isArray(o.template)&&o.files.concat(o.template));var d=e.extend({},h,o);return e.isUndefined(o.files)&&e.isDefined(o.name)&&t.moduleExists(o.name)?t.inject(o.name,d,!0):(t.filesLoader(o,d).then((function(){t.inject(null,d).then((function(e){c.resolve(e)}),(function(e){c.reject(e)}))}),(function(e){c.reject(e)})),c.promise)},t}])}])}(angular),function(e){"use strict";e.module("oc.lazyLoad").config(["$provide",function(t){t.decorator("$ocLazyLoad",["$delegate","$q",function(t,n){return t.cssLoader=function(r,i,a){var s=[];e.forEach(r,(function(e){s.push(t.buildElement("css",e,a))})),n.all(s).then((function(){i()}),(function(e){i(e)}))},t.cssLoader.ocLazyLoadLoader=!0,t}])}])}(angular),function(e){"use strict";e.module("oc.lazyLoad").config(["$provide",function(t){t.decorator("$ocLazyLoad",["$delegate","$q",function(t,n){return t.jsLoader=function(r,i,a){var s=[];e.forEach(r,(function(e){s.push(t.buildElement("js",e,a))})),n.all(s).then((function(){i()}),(function(e){i(e)}))},t.jsLoader.ocLazyLoadLoader=!0,t}])}])}(angular),function(e){"use strict";e.module("oc.lazyLoad").config(["$provide",function(t){t.decorator("$ocLazyLoad",["$delegate","$templateCache","$q","$http",function(t,n,r,i){return t.templatesLoader=function(a,s,o){var u=[],c=t._getFilesCache();return e.forEach(a,(function(t){var a=r.defer();u.push(a.promise),i.get(t,o).then((function(r){var i=r.data;e.isString(i)&&i.length>0&&e.forEach(e.element(i),(function(e){"SCRIPT"===e.nodeName&&"text/ng-template"===e.type&&n.put(e.id,e.innerHTML)})),e.isUndefined(c.get(t))&&c.put(t,!0),a.resolve()})).catch((function(e){a.reject(new Error('Unable to load template file "'+t+'": '+e.data))}))})),r.all(u).then((function(){s()}),(function(e){s(e)}))},t.templatesLoader.ocLazyLoadLoader=!0,t}])}])}(angular),Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t){var n;if(null==this)throw new TypeError('"this" is null or not defined');var r=Object(this),i=r.length>>>0;if(0===i)return-1;var a=+t||0;if(Math.abs(a)===1/0&&(a=0),a>=i)return-1;for(n=Math.max(a>=0?a:i-Math.abs(a),0);n<i;){if(n in r&&r[n]===e)return n;n++}return-1})},function(e,t,n){var r={"./autocomplete/app":[86,9,32],"./autocomplete/app.js":[86,9,32],"./autocomplete/controllers":[43,9,44],"./autocomplete/controllers.js":[43,9,44],"./autocomplete/plugin":[87,7,45],"./autocomplete/plugin.js":[87,7,45],"./autocomplete/templates/modal/add-label.html":[162,7,109],"./clustermanagement/app":[27,9,4,2,7,8,13],"./clustermanagement/app.js":[27,9,4,2,7,8,13],"./clustermanagement/controllers":[81,9,7],"./clustermanagement/controllers.js":[81,9,7],"./clustermanagement/directives":[82,9,8],"./clustermanagement/directives.js":[82,9,8],"./clustermanagement/templates/modal/clone-modal.html":[163,7,110],"./controllers":[20,9],"./controllers.js":[20,9],"./core/angularCancelOnNavigateModule":[23,7],"./core/angularCancelOnNavigateModule.js":[23,7],"./core/controllers":[13,7],"./core/controllers.js":[13,7],"./core/directives":[7,9],"./core/directives.js":[7,9],"./core/directives/fit-text.directive":[44,7,46],"./core/directives/fit-text.directive.js":[44,7,46],"./core/directives/paginations":[38,7,47],"./core/directives/paginations.js":[38,7,47],"./core/directives/queryeditor/query-editor.controller":[33,9,48],"./core/directives/queryeditor/query-editor.controller.js":[33,9,48],"./core/directives/queryeditor/query-editor.directive":[34,9,0,1,27],"./core/directives/queryeditor/query-editor.directive.js":[34,9,0,1,27],"./core/directives/queryeditor/sparql-tab.directive":[35,9,49],"./core/directives/queryeditor/sparql-tab.directive.js":[35,9,49],"./core/directives/queryeditor/templates/query-editor.html":[164,7,111],"./core/directives/queryeditor/templates/query-sample.html":[165,7,112],"./core/directives/rdfresourcesearch/rdf-resource-search.directive":[24,7],"./core/directives/rdfresourcesearch/rdf-resource-search.directive.js":[24,7],"./core/directives/rdfresourcesearch/templates/rdfResourceSearchTemplate.html":[166,7,113],"./core/interceptors/unauthorized.interceptor":[15,9],"./core/interceptors/unauthorized.interceptor.js":[15,9],"./core/loading-hint":[16,7,50],"./core/loading-hint.js":[16,7,50],"./core/services":[2,9],"./core/services.js":[2,9],"./core/services/autocomplete-status.service":[22,7],"./core/services/autocomplete-status.service.js":[22,7],"./core/services/jwt-auth.service":[9,9],"./core/services/jwt-auth.service.js":[9,9],"./core/services/openid-auth.service":[17,9],"./core/services/openid-auth.service.js":[17,9],"./core/services/repositories.service":[8,9],"./core/services/repositories.service.js":[8,9],"./core/templates/core-errors.html":[167,7,114],"./core/templates/modal/copy-to-clipboard-modal.html":[168,7,115],"./core/templates/modal/modal-simple.html":[169,7,116],"./core/templates/modal/modal-warning.html":[170,7,117],"./core/templates/search-resource-input.html":[171,7,118],"./explore/app":[88,9,6,0,9,19],"./explore/app.js":[88,9,6,0,9,19],"./explore/controllers":[83,9,0,9],"./explore/controllers.js":[83,9,0,9],"./explore/directives":[46,9,33],"./explore/directives.js":[46,9,33],"./explore/plugin":[89,7,51],"./explore/plugin.js":[89,7,51],"./explore/statements.service":[45,7,52],"./explore/statements.service.js":[45,7,52],"./explore/templates/viewTrig.html":[172,7,119],"./export/app":[90,9,18],"./export/app.js":[90,9,18],"./export/controllers":[47,9,34],"./export/controllers.js":[47,9,34],"./export/plugin":[91,7,53],"./export/plugin.js":[91,7,53],"./externalsync/app":[92,9,26],"./externalsync/app.js":[92,9,26],"./externalsync/controllers":[32,9,35],"./externalsync/controllers.js":[32,9,35],"./externalsync/directives":[48,9,54],"./externalsync/directives.js":[48,9,54],"./externalsync/plugin":[93,7,55],"./externalsync/plugin.js":[93,7,55],"./externalsync/templates/deleteConnector.html":[173,7,120],"./graphexplore/app":[94,9,4,17,0,1,14],"./graphexplore/app.js":[94,9,4,17,0,1,14],"./graphexplore/controllers/dependencies-chord.controller":[55,7,56],"./graphexplore/controllers/dependencies-chord.controller.js":[55,7,56],"./graphexplore/controllers/domain-range-graph.controller":[54,9,57],"./graphexplore/controllers/domain-range-graph.controller.js":[54,9,57],"./graphexplore/controllers/graphs-config.controller":[57,9,36],"./graphexplore/controllers/graphs-config.controller.js":[57,9,36],"./graphexplore/controllers/graphs-visualizations.controller":[56,9,28],"./graphexplore/controllers/graphs-visualizations.controller.js":[56,9,28],"./graphexplore/controllers/rdf-class-hierarchy.controller":[53,9,58],"./graphexplore/controllers/rdf-class-hierarchy.controller.js":[53,9,58],"./graphexplore/directives/dependencies-chord.directive":[62,9,29],"./graphexplore/directives/dependencies-chord.directive.js":[62,9,29],"./graphexplore/directives/domain-range-graph.directive":[59,9,30],"./graphexplore/directives/domain-range-graph.directive.js":[59,9,30],"./graphexplore/directives/list-items-search-filter.directive":[63,7,59],"./graphexplore/directives/list-items-search-filter.directive.js":[63,7,59],"./graphexplore/directives/rdf-class-hierarchy.directive":[58,9,22],"./graphexplore/directives/rdf-class-hierarchy.directive.js":[58,9,22],"./graphexplore/directives/rdfs-comment-label.directive":[61,7,60],"./graphexplore/directives/rdfs-comment-label.directive.js":[61,7,60],"./graphexplore/directives/search-icon-input.directive":[64,7,61],"./graphexplore/directives/search-icon-input.directive.js":[64,7,61],"./graphexplore/directives/system-repo-warning.directive":[60,7,62],"./graphexplore/directives/system-repo-warning.directive.js":[60,7,62],"./graphexplore/plugin":[95,7,63],"./graphexplore/plugin.js":[95,7,63],"./graphexplore/services/rdfs-label-comment.service":[50,7,64],"./graphexplore/services/rdfs-label-comment.service.js":[50,7,64],"./graphexplore/services/ui-scroll.service":[49,7,65],"./graphexplore/services/ui-scroll.service.js":[49,7,65],"./graphexplore/templates/listItemsSearchFilterTemplate.html":[174,7,121],"./graphexplore/templates/modal/save-graph.html":[175,7,122],"./graphexplore/templates/rdfClassHierarchyClassCountSliderHelpTemplate.html":[176,7,123],"./graphexplore/templates/rdfsCommentLabelTemplate.html":[177,7,124],"./graphexplore/templates/searchIconInputTemplate.html":[178,7,125],"./graphexplore/templates/systemRepoWarningTemplate.html":[179,7,126],"./import/app":[96,9,11,37],"./import/app.js":[96,9,11,37],"./import/controllers":[84,9,11],"./import/controllers.js":[84,9,11],"./import/directives":[65,9,38],"./import/directives.js":[65,9,38],"./import/plugin":[97,7,66],"./import/plugin.js":[97,7,66],"./import/templates/commonInfo.html":[180,7,127],"./import/templates/filesTable.html":[181,7,128],"./import/templates/importInfo.html":[182,7,129],"./import/templates/settingsModal.html":[183,7,130],"./import/templates/textSnippet.html":[184,7,131],"./import/templates/uploadInfo.html":[185,7,132],"./import/templates/urlImport.html":[186,7,133],"./jdbc/app":[98,9,0,1,2,3,16],"./jdbc/app.js":[98,9,0,1,2,3,16],"./jdbc/controllers":[66,9,39],"./jdbc/controllers.js":[66,9,39],"./jdbc/plugin":[99,7,67],"./jdbc/plugin.js":[99,7,67],"./namespaces/app":[100,9,6,25],"./namespaces/app.js":[100,9,6,25],"./namespaces/controllers":[68,9,68],"./namespaces/controllers.js":[68,9,68],"./namespaces/directives":[69,7,69],"./namespaces/directives.js":[69,7,69],"./namespaces/plugin":[101,7,70],"./namespaces/plugin.js":[101,7,70],"./ontorefine/app":[102,9,0,1,71],"./ontorefine/app.js":[102,9,0,1,71],"./ontorefine/plugin":[103,7,72],"./ontorefine/plugin.js":[103,7,72],"./plugin":[105,7,74],"./plugin-registry":[104,7,73],"./plugin-registry.js":[104,7,73],"./plugin.js":[105,7,74],"./queries/app":[106,9,40],"./queries/app.js":[106,9,40],"./queries/controllers":[70,9,75],"./queries/controllers.js":[70,9,75],"./queries/plugin":[107,7,76],"./queries/plugin.js":[107,7,76],"./rdfrank/app":[108,9,24],"./rdfrank/app.js":[108,9,24],"./rdfrank/plugin":[109,7,77],"./rdfrank/plugin.js":[109,7,77],"./rdfrank/templates/filter-list.html":[187,7,134],"./repositories/app":[110,9,5,23],"./repositories/app.js":[110,9,5,23],"./repositories/controllers":[41,9,5],"./repositories/controllers.js":[41,9,5],"./repositories/fedx-repo.directive":[74,7,78],"./repositories/fedx-repo.directive.js":[74,7,78],"./repositories/ontop-repo.directive":[73,9,5,79],"./repositories/ontop-repo.directive.js":[73,9,5,79],"./repositories/plugin":[111,7,80],"./repositories/plugin.js":[111,7,80],"./repositories/repository.constants":[72,9,81],"./repositories/repository.constants.js":[72,9,81],"./repositories/templates/fedx-repo.html":[188,7,135],"./repositories/templates/ontop-repo.html":[189,7,136],"./resources/app":[112,9,4,2,3,41],"./resources/app.js":[112,9,4,2,3,41],"./resources/controllers":[40,9,2,3],"./resources/controllers.js":[40,9,2,3],"./resources/plugin":[113,7,82],"./resources/plugin.js":[113,7,82],"./rest/autocomplete.rest.service":[14,7],"./rest/autocomplete.rest.service.js":[14,7],"./rest/cluster.rest.service":[42,7,83],"./rest/cluster.rest.service.js":[42,7,83],"./rest/connectors.rest.service":[29,7,84],"./rest/connectors.rest.service.js":[29,7,84],"./rest/graph-config.rest.service":[52,7,85],"./rest/graph-config.rest.service.js":[52,7,85],"./rest/graph-data.rest.service":[37,7,86],"./rest/graph-data.rest.service.js":[37,7,86],"./rest/jdbc.rest.service":[67,7,87],"./rest/jdbc.rest.service.js":[67,7,87],"./rest/license.rest.service":[5,7],"./rest/license.rest.service.js":[5,7],"./rest/locations.rest.service":[21,7],"./rest/locations.rest.service.js":[21,7],"./rest/monitoring.rest.service":[11,7],"./rest/monitoring.rest.service.js":[11,7],"./rest/rdf4j.repositories.rest.service":[10,7],"./rest/rdf4j.repositories.rest.service.js":[10,7],"./rest/rdfrank.rest.service":[71,7,88],"./rest/rdfrank.rest.service.js":[71,7,88],"./rest/repositories.rest.service":[6,7],"./rest/repositories.rest.service.js":[6,7],"./rest/saved-graphs.rest.service":[51,7,89],"./rest/saved-graphs.rest.service.js":[51,7,89],"./rest/security.rest.service":[18,7],"./rest/security.rest.service.js":[18,7],"./rest/similarity.rest.service":[76,7,90],"./rest/similarity.rest.service.js":[76,7,90],"./rest/sparql-templates.rest.service":[77,7,91],"./rest/sparql-templates.rest.service.js":[77,7,91],"./rest/sparql.rest.service":[12,7],"./rest/sparql.rest.service.js":[12,7],"./security/app":[114,9,12,92],"./security/app.js":[114,9,12,92],"./security/controllers":[85,9,12],"./security/controllers.js":[85,9,12],"./security/plugin":[115,7,93],"./security/plugin.js":[115,7,93],"./security/templates/modal/default-authorities.html":[190,7,137],"./security/templates/roles.html":[191,7,138],"./security/templates/user.html":[192,7,139],"./security/templates/users.html":[193,7,140],"./settings/app":[75,9,42],"./settings/app.js":[75,9,42],"./settings/controllers":[39,9,94],"./settings/controllers.js":[39,9,94],"./settings/modal/location-settings.html":[194,7,141],"./settings/modal/validate-license.html":[195,7,142],"./settings/plugin":[116,7,95],"./settings/plugin.js":[116,7,95],"./similarity/app":[117,9,0,1,10,20],"./similarity/app.js":[117,9,0,1,10,20],"./similarity/controllers/create-index.controller":[79,9,43],"./similarity/controllers/create-index.controller.js":[79,9,43],"./similarity/controllers/similarity-list.controller":[78,9,0,96],"./similarity/controllers/similarity-list.controller.js":[78,9,0,96],"./similarity/plugin":[118,7,97],"./similarity/plugin.js":[118,7,97],"./sparql-template/app":[121,9,0,1,2,3,15],"./sparql-template/app.js":[121,9,0,1,2,3,15],"./sparql-template/controllers":[80,9,31],"./sparql-template/controllers.js":[80,9,31],"./sparql-template/plugin":[122,7,98],"./sparql-template/plugin.js":[122,7,98],"./sparql/app":[119,9,6,0,1,10,21],"./sparql/app.js":[119,9,6,0,1,10,21],"./sparql/plugin":[120,7,99],"./sparql/plugin.js":[120,7,99],"./stats/app":[123,9,100],"./stats/app.js":[123,9,100],"./stats/plugin":[124,7,101],"./stats/plugin.js":[124,7,101],"./templates/graphdb-small.svg":[196,7,150],"./templates/loader/ot-loader.svg":[197,7,151],"./templates/modal/add-fedx-remote-repo.html":[198,7,143],"./templates/modal/add-location.html":[199,7,144],"./templates/modal/edit-location.html":[200,7,145],"./templates/modal/editRepoFile.html":[201,7,146],"./templates/modal/upload-repository-config.html":[202,7,147],"./templates/repositorySize.html":[203,7,148],"./templates/titlePopoverTemplate.html":[204,7,149],"./treeview/ng-tree":[125,7,102],"./treeview/ng-tree.js":[125,7,102],"./utils/error-utils":[19,7],"./utils/error-utils.js":[19,7],"./utils/file-types":[36,7,103],"./utils/file-types.js":[36,7,103],"./utils/local-storage-adapter":[4,7],"./utils/local-storage-adapter.js":[4,7],"./utils/notifications":[31,7,104],"./utils/notifications.js":[31,7,104],"./utils/uri-utils":[30,7,105],"./utils/uri-utils.js":[30,7,105],"./utils/user-utils":[0,9],"./utils/user-utils.js":[0,9]};function i(e){if(!n.o(r,e))return Promise.resolve().then((function(){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=r[e],i=t[0];return Promise.all(t.slice(2).map(n.e)).then((function(){return n.t(i,t[1])}))}i.keys=function(){return Object.keys(r)},i.id=161,e.exports=i}]);
|
|
79
|
-
//# sourceMappingURL=bundle.
|
|
79
|
+
//# sourceMappingURL=bundle.638b1335212351205f4e.bundle.js.map
|