@pod-os/elements 0.8.0 → 0.9.0
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/cjs/BrokenFile-b01d72da.js +226 -0
- package/dist/cjs/ResourceAware-f1aac952.js +7 -0
- package/dist/cjs/elements.cjs.js +1 -1
- package/dist/{esm/ion-app_48.entry.js → cjs/index-74c56a41.js} +8 -4122
- package/dist/cjs/ion-app_25.cjs.entry.js +3043 -0
- package/dist/cjs/ion-badge_7.cjs.entry.js +258 -0
- package/dist/cjs/ion-item-divider_3.cjs.entry.js +109 -0
- package/dist/cjs/ion-item_3.cjs.entry.js +367 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pos-app-document-viewer.cjs.entry.js +28 -0
- package/dist/cjs/pos-app-generic.cjs.entry.js +16 -0
- package/dist/cjs/pos-app-image-viewer.cjs.entry.js +29 -0
- package/dist/cjs/pos-app-rdf-document.cjs.entry.js +16 -0
- package/dist/cjs/pos-description_2.cjs.entry.js +40 -0
- package/dist/cjs/pos-document.cjs.entry.js +67 -0
- package/dist/cjs/pos-relations_2.cjs.entry.js +45 -0
- package/dist/cjs/pos-subjects.cjs.entry.js +28 -0
- package/dist/collection/apps/{pos-app-pdf-viewer/pos-app-pdf-viewer.js → pos-app-document-viewer/pos-app-document-viewer.js} +3 -3
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/{pos-pdf/pos-pdf.css → pos-document/pos-document.css} +0 -0
- package/dist/collection/components/{pos-pdf/pos-pdf.js → pos-document/pos-document.js} +4 -4
- package/dist/collection/components/pos-type-router/pos-type-router.js +3 -12
- package/dist/collection/components/pos-type-router/selectAppForTypes.js +24 -0
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +2 -2
- package/dist/components/pos-app-browser.js +46 -184
- package/dist/components/pos-app-document-viewer.d.ts +11 -0
- package/dist/components/{pos-app-pdf-viewer2.js → pos-app-document-viewer.js} +50 -47
- package/dist/components/pos-app-generic.js +192 -1
- package/dist/components/pos-app-image-viewer.js +160 -1
- package/dist/components/pos-app-rdf-document.js +168 -1
- package/dist/components/{pos-pdf.d.ts → pos-document.d.ts} +4 -4
- package/dist/components/pos-document.js +6 -0
- package/dist/components/{pos-pdf2.js → pos-document2.js} +8 -8
- package/dist/components/pos-router2.js +18 -180
- package/dist/components/pos-type-router2.js +28 -217
- package/dist/elements/elements.esm.js +1 -1
- package/dist/elements/{p-145ab600.entry.js → p-0ed0e3ba.entry.js} +1 -1
- package/dist/elements/{p-5808c505.js → p-12407693.js} +1 -1
- package/dist/elements/p-1688668c.entry.js +1 -0
- package/dist/elements/{p-85d6f579.entry.js → p-16afe2d7.entry.js} +1 -1
- package/dist/elements/{p-f4b358b2.entry.js → p-1a9cdd0b.entry.js} +1 -1
- package/dist/elements/{p-8ed61030.entry.js → p-21a6c0d5.entry.js} +1 -1
- package/dist/elements/{p-1e3bbab1.entry.js → p-24fffcb6.entry.js} +1 -1
- package/dist/elements/p-2ca5f7f2.entry.js +5 -0
- package/dist/elements/{p-7fc32e8d.entry.js → p-2eced374.entry.js} +1 -1
- package/dist/elements/p-301096a8.entry.js +1 -0
- package/dist/elements/{p-2a9a9bb1.entry.js → p-35faa0fa.entry.js} +1 -1
- package/dist/elements/{p-f851b91a.js → p-37c43290.js} +2 -2
- package/dist/elements/p-3f0dec28.entry.js +1 -0
- package/dist/elements/p-410c567f.entry.js +1 -0
- package/dist/elements/p-417ecc9e.js +1 -0
- package/dist/elements/p-43717c61.js +1 -0
- package/dist/elements/{p-b57b6dfe.entry.js → p-573e7d6e.entry.js} +1 -1
- package/dist/elements/{p-ec8c13e0.entry.js → p-59680588.entry.js} +1 -1
- package/dist/elements/p-5fe41c08.entry.js +1 -0
- package/dist/elements/p-68110709.entry.js +1 -0
- package/dist/elements/{p-29c0f03f.js → p-6ed079a5.js} +2 -2
- package/dist/elements/p-709fd743.entry.js +1 -0
- package/dist/elements/p-73648481.entry.js +1 -0
- package/dist/elements/p-784b06b3.entry.js +1 -0
- package/dist/elements/p-84cc1417.entry.js +1 -0
- package/dist/elements/p-8596ddbc.js +4 -0
- package/dist/elements/{p-b0d8c4f0.entry.js → p-8c0124df.entry.js} +1 -1
- package/dist/elements/{p-020dee35.entry.js → p-a48e16ba.entry.js} +1 -1
- package/dist/elements/p-ab11bb11.js +4 -0
- package/dist/elements/{p-8a24508e.entry.js → p-ae87571c.entry.js} +1 -1
- package/dist/elements/p-b2acbe46.entry.js +1 -0
- package/dist/elements/p-babdb154.entry.js +9 -0
- package/dist/elements/{p-9c719139.js → p-bb128f00.js} +1 -1
- package/dist/elements/{p-fe753f07.entry.js → p-c442a411.entry.js} +1 -1
- package/dist/elements/{p-b36873af.entry.js → p-c4d119d2.entry.js} +1 -1
- package/dist/elements/p-eea7ce93.js +116 -0
- package/dist/elements/p-f72edc68.entry.js +1 -0
- package/dist/elements/{p-6987a85b.entry.js → p-ffb33569.entry.js} +1 -1
- package/dist/esm/BrokenFile-e1e68cb6.js +223 -0
- package/dist/esm/ResourceAware-845001bb.js +5 -0
- package/dist/esm/{data-62c81c24.js → data-2c0eab05.js} +1 -1
- package/dist/esm/elements.js +1 -1
- package/dist/esm/{index-ebf7f059.js → index-38d8370e.js} +1 -1
- package/dist/esm/{index-1f3d8582.js → index-47f5cd9a.js} +1 -1
- package/dist/{cjs/ion-app_48.cjs.entry.js → esm/index-5c6f4d9d.js} +6 -4174
- package/dist/esm/{index-65ecd543.js → index-753825bf.js} +1 -1
- package/dist/esm/{input-shims-8a389148.js → input-shims-167ef062.js} +2 -2
- package/dist/esm/ion-accordion.entry.js +1 -1
- package/dist/esm/ion-app_25.entry.js +3015 -0
- package/dist/esm/ion-back-button.entry.js +1 -1
- package/dist/esm/ion-badge_7.entry.js +248 -0
- package/dist/esm/ion-breadcrumb.entry.js +1 -1
- package/dist/esm/ion-datetime-button.entry.js +2 -2
- package/dist/esm/ion-datetime.entry.js +3 -3
- package/dist/esm/ion-fab-button.entry.js +1 -1
- package/dist/esm/ion-infinite-scroll.entry.js +2 -2
- package/dist/esm/ion-input.entry.js +1 -1
- package/dist/esm/ion-item-divider_3.entry.js +103 -0
- package/dist/esm/ion-item-sliding.entry.js +2 -2
- package/dist/esm/ion-item_3.entry.js +361 -0
- package/dist/esm/ion-menu-button.entry.js +1 -1
- package/dist/esm/ion-modal.entry.js +2 -2
- package/dist/esm/ion-range.entry.js +2 -2
- package/dist/esm/ion-refresher-content.entry.js +1 -1
- package/dist/esm/ion-refresher.entry.js +2 -2
- package/dist/esm/ion-reorder-group.entry.js +2 -2
- package/dist/esm/ion-reorder.entry.js +1 -1
- package/dist/esm/ion-toggle.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pos-app-document-viewer.entry.js +24 -0
- package/dist/esm/pos-app-generic.entry.js +12 -0
- package/dist/esm/pos-app-image-viewer.entry.js +25 -0
- package/dist/esm/pos-app-rdf-document.entry.js +12 -0
- package/dist/esm/pos-description_2.entry.js +35 -0
- package/dist/esm/pos-document.entry.js +63 -0
- package/dist/esm/pos-relations_2.entry.js +40 -0
- package/dist/esm/pos-subjects.entry.js +24 -0
- package/dist/esm/{status-tap-33623c88.js → status-tap-ce25f9e5.js} +2 -2
- package/dist/types/apps/{pos-app-pdf-viewer/pos-app-pdf-viewer.d.ts → pos-app-document-viewer/pos-app-document-viewer.d.ts} +1 -1
- package/dist/types/components/{pos-pdf/pos-pdf.d.ts → pos-document/pos-document.d.ts} +1 -1
- package/dist/types/components/pos-type-router/selectAppForTypes.d.ts +8 -0
- package/dist/types/components.d.ts +40 -40
- package/package.json +1 -1
- package/dist/components/pos-app-generic2.js +0 -194
- package/dist/components/pos-app-image-viewer2.js +0 -162
- package/dist/components/pos-app-pdf-viewer.d.ts +0 -11
- package/dist/components/pos-app-pdf-viewer.js +0 -6
- package/dist/components/pos-app-rdf-document2.js +0 -170
- package/dist/components/pos-pdf.js +0 -6
- package/dist/elements/p-10cae467.js +0 -4
- package/dist/elements/p-19e4a688.js +0 -4
- package/dist/elements/p-5f811ad7.entry.js +0 -1
- package/dist/elements/p-7a79a3cd.entry.js +0 -128
- package/dist/elements/p-b9a87655.entry.js +0 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
var t,e,n,r,i,o,s=Object.create,a=Object.defineProperty,u=Object.defineProperties,c=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyDescriptors,f=Object.getOwnPropertyNames,l=Object.getOwnPropertySymbols,d=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable,w=(t,e,n)=>e in t?a(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,y=(t,e)=>{for(var n in e||={})v.call(e,n)&&w(t,n,e[n]);if(l)for(var n of l(e))p.call(e,n)&&w(t,n,e[n]);return t},m=(t,e)=>u(t,h(e)),g=(t,e)=>function(){return t&&(e=(0,t[f(t)[0]])(t=0)),e},b=(t,e)=>function(){return e||(0,t[f(t)[0]])((e={exports:{}}).exports,e),e.exports},E=(t,e)=>{for(var n in e)a(t,n,{get:e[n],enumerable:!0})},S=(t,e,n,r)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let i of f(e))v.call(t,i)||i===n||a(t,i,{get:()=>e[i],enumerable:!(r=c(e,i))||r.enumerable});return t},F=(t,e,n)=>(n=null!=t?s(d(t)):{},S(!e&&t&&t.__esModule?n:a(n,"default",{value:t,enumerable:!0}),t)),k=(t,e,n)=>new Promise(((r,i)=>{var o=t=>{try{a(n.next(t))}catch(t){i(t)}},s=t=>{try{a(n.throw(t))}catch(t){i(t)}},a=t=>t.done?r(t.value):Promise.resolve(t.value).then(o,s);a((n=n.apply(t,e)).next())})),x=b({"../node_modules/events/events.js"(t,e){var n,r="object"==typeof Reflect?Reflect:null,i=r&&"function"==typeof r.apply?r.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};n=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(t,e){return new Promise((function(n,r){function i(n){t.removeListener(e,o),r(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),n([].slice.call(arguments))}w(t,e,o,{once:!0}),"error"!==e&&function(t,e){"function"==typeof t.on&&w(t,"error",e,{once:!0})}(t,i)}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var a=10;function u(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function c(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function h(t,e,n,r){var i,o,s;if(u(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),s=o[e]),void 0===s)s=o[e]=n,++t._eventsCount;else if("function"==typeof s?s=o[e]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(i=c(t))>0&&s.length>i&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=s.length,console&&console.warn&&console.warn(a)}return t}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}function d(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(i):p(i,i.length)}function v(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function p(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function w(t,e,n,r){if("function"==typeof t.on)r.once?t.once(e,n):t.on(e,n);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function i(o){r.once&&t.removeEventListener(e,i),n(o)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");a=t}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},s.prototype.getMaxListeners=function(){return c(this)},s.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r="error"===t,o=this._events;if(void 0!==o)r=r&&void 0===o.error;else if(!r)return!1;if(r){var s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=o[t];if(void 0===u)return!1;if("function"==typeof u)i(u,this,e);else{var c=u.length,h=p(u,c);for(n=0;n<c;++n)i(h[n],this,e)}return!0},s.prototype.on=s.prototype.addListener=function(t,e){return h(this,t,e,!1)},s.prototype.prependListener=function(t,e){return h(this,t,e,!0)},s.prototype.once=function(t,e){return u(e),this.on(t,l(this,t,e)),this},s.prototype.prependOnceListener=function(t,e){return u(e),this.prependListener(t,l(this,t,e)),this},s.prototype.off=s.prototype.removeListener=function(t,e){var n,r,i,o,s;if(u(e),void 0===(r=this._events))return this;if(void 0===(n=r[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===e||n[o].listener===e){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,i),1===n.length&&(r[t]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",t,s||e)}return this},s.prototype.removeAllListeners=function(t){var e,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},s.prototype.listeners=function(t){return d(this,t,!0)},s.prototype.rawListeners=function(t){return d(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):v.call(t,e)},s.prototype.listenerCount=v,s.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}}}),_=b({"../node_modules/cross-fetch/dist/browser-ponyfill.js"(t,e){var n,r="undefined"!=typeof self?self:t,i=function(){function t(){this.fetch=!1,this.DOMException=r.DOMException}return t.prototype=r,new t}();n=i,function(t){var e="URLSearchParams"in n,r="Symbol"in n&&"iterator"in Symbol,i="FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in n,s="ArrayBuffer"in n;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function h(t){return"string"!=typeof t&&(t=String(t)),t}function f(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return r&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function d(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function v(t){return new Promise((function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}}))}function p(t){var e=new FileReader,n=v(e);return e.readAsArrayBuffer(t),n}function w(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(t){var n;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:e&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&i&&(n=t)&&DataView.prototype.isPrototypeOf(n)?(this._bodyArrayBuffer=w(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=w(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=d(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(p)}),this.text=function(){var t,e,n,r=d(this);if(r)return r;if(this._bodyBlob)return t=this._bodyBlob,n=v(e=new FileReader),e.readAsText(t),n;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;r<e.length;r++)n[r]=String.fromCharCode(e[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(t,e){t=c(t),e=h(e);var n=this.map[t];this.map[t]=n?n+", "+e:e},l.prototype.delete=function(t){delete this.map[c(t)]},l.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},l.prototype.set=function(t,e){this.map[c(t)]=h(e)},l.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},l.prototype.keys=function(){var t=[];return this.forEach((function(e,n){t.push(n)})),f(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),f(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,n){t.push([n,e])})),f(t)},r&&(l.prototype[Symbol.iterator]=l.prototype.entries);var m=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function g(t,e){var n,r,i=(e=e||{}).body;if(t instanceof g){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=(r=(n=e.method||this.method||"GET").toUpperCase(),m.indexOf(r)>-1?r:n),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function b(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var n=t.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(i))}})),e}function E(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}g.prototype.clone=function(){return new g(this,{body:this._bodyInit})},y.call(g.prototype),y.call(E.prototype),E.prototype.clone=function(){return new E(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},E.error=function(){var t=new E(null,{status:0,statusText:""});return t.type="error",t};var S=[301,302,303,307,308];E.redirect=function(t,e){if(-1===S.indexOf(e))throw new RangeError("Invalid status code");return new E(null,{status:e,headers:{location:t}})},t.DOMException=n.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function F(e,n){return new Promise((function(r,o){var s=new g(e,n);if(s.signal&&s.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var t,e,n={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var n=t.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();e.append(r,i)}})),e)};n.url="responseURL"in a?a.responseURL:n.headers.get("X-Request-URL"),r(new E("response"in a?a.response:a.responseText,n))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new t.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",u)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}F.polyfill=!0,n.fetch||(n.fetch=F,n.Headers=l,n.Request=g,n.Response=E),t.Headers=l,t.Request=g,t.Response=E,t.fetch=F,Object.defineProperty(t,"__esModule",{value:!0})}({}),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var o=i;(t=o.fetch).default=o.fetch,t.fetch=o.fetch,t.Headers=o.Headers,t.Request=o.Request,t.Response=o.Response,e.exports=t}}),A=g({"../node_modules/jose/dist/browser/runtime/webcrypto.js"(){t=crypto,e=t=>t instanceof CryptoKey}}),j=g({"../node_modules/jose/dist/browser/runtime/digest.js"(){A(),n=async(e,n)=>{const r=`SHA-${e.slice(-3)}`;return new Uint8Array(await t.subtle.digest(r,n))}}});function C(...t){const e=t.reduce(((t,{length:e})=>t+e),0),n=new Uint8Array(e);let r=0;return t.forEach((t=>{n.set(t,r),r+=t.length})),n}function R(t,e,n){if(e<0||e>=o)throw new RangeError(`value must be >= 0 and <= ${o-1}. Received ${e}`);t.set([e>>>24,e>>>16,e>>>8,255&e],n)}function T(t){const e=Math.floor(t/o),n=t%o,r=new Uint8Array(8);return R(r,e,0),R(r,n,4),r}function I(t){const e=new Uint8Array(4);return R(e,t),e}function O(t){return C(I(t.length),t)}var N,P,D,M,U,L,B,J,K,H,$,W,q,V,G,z,X,Y,Q,Z=g({"../node_modules/jose/dist/browser/lib/buffer_utils.js"(){j(),r=new TextEncoder,i=new TextDecoder,o=2**32}}),tt=g({"../node_modules/jose/dist/browser/runtime/base64url.js"(){Z(),N=t=>{let e=t;"string"==typeof e&&(e=r.encode(e));const n=[];for(let t=0;t<e.length;t+=32768)n.push(String.fromCharCode.apply(null,e.subarray(t,t+32768)));return btoa(n.join(""))},P=t=>N(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),D=t=>{const e=atob(t),n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return n},M=t=>{let e=t;e instanceof Uint8Array&&(e=i.decode(e)),e=e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return D(e)}catch(t){throw new TypeError("The input to be decoded is not correctly encoded.")}}}}),et={};E(et,{JOSEAlgNotAllowed:()=>J,JOSEError:()=>U,JOSENotSupported:()=>K,JWEDecryptionFailed:()=>H,JWEInvalid:()=>$,JWKInvalid:()=>V,JWKSInvalid:()=>G,JWKSMultipleMatchingKeys:()=>X,JWKSNoMatchingKey:()=>z,JWKSTimeout:()=>Y,JWSInvalid:()=>W,JWSSignatureVerificationFailed:()=>Q,JWTClaimValidationFailed:()=>L,JWTExpired:()=>B,JWTInvalid:()=>q});var nt,rt,it=g({"../node_modules/jose/dist/browser/util/errors.js"(){U=class extends Error{static get code(){return"ERR_JOSE_GENERIC"}constructor(t){var e;super(t),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,null===(e=Error.captureStackTrace)||void 0===e||e.call(Error,this,this.constructor)}},L=class extends U{static get code(){return"ERR_JWT_CLAIM_VALIDATION_FAILED"}constructor(t,e="unspecified",n="unspecified"){super(t),this.code="ERR_JWT_CLAIM_VALIDATION_FAILED",this.claim=e,this.reason=n}},B=class extends U{static get code(){return"ERR_JWT_EXPIRED"}constructor(t,e="unspecified",n="unspecified"){super(t),this.code="ERR_JWT_EXPIRED",this.claim=e,this.reason=n}},J=class extends U{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}static get code(){return"ERR_JOSE_ALG_NOT_ALLOWED"}},K=class extends U{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}static get code(){return"ERR_JOSE_NOT_SUPPORTED"}},H=class extends U{constructor(){super(...arguments),this.code="ERR_JWE_DECRYPTION_FAILED",this.message="decryption operation failed"}static get code(){return"ERR_JWE_DECRYPTION_FAILED"}},$=class extends U{constructor(){super(...arguments),this.code="ERR_JWE_INVALID"}static get code(){return"ERR_JWE_INVALID"}},W=class extends U{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}static get code(){return"ERR_JWS_INVALID"}},q=class extends U{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}static get code(){return"ERR_JWT_INVALID"}},V=class extends U{constructor(){super(...arguments),this.code="ERR_JWK_INVALID"}static get code(){return"ERR_JWK_INVALID"}},G=class extends U{constructor(){super(...arguments),this.code="ERR_JWKS_INVALID"}static get code(){return"ERR_JWKS_INVALID"}},z=class extends U{constructor(){super(...arguments),this.code="ERR_JWKS_NO_MATCHING_KEY",this.message="no applicable key found in the JSON Web Key Set"}static get code(){return"ERR_JWKS_NO_MATCHING_KEY"}},X=class extends U{constructor(){super(...arguments),this.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS",this.message="multiple matching keys found in the JSON Web Key Set"}static get code(){return"ERR_JWKS_MULTIPLE_MATCHING_KEYS"}},Y=class extends U{constructor(){super(...arguments),this.code="ERR_JWKS_TIMEOUT",this.message="request timed out"}static get code(){return"ERR_JWKS_TIMEOUT"}},Q=class extends U{constructor(){super(...arguments),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED",this.message="signature verification failed"}static get code(){return"ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}}}}),ot=g({"../node_modules/jose/dist/browser/runtime/random.js"(){A(),nt=t.getRandomValues.bind(t)}});function st(t){switch(t){case"A128GCM":case"A128GCMKW":case"A192GCM":case"A192GCMKW":case"A256GCM":case"A256GCMKW":return 96;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return 128;default:throw new K(`Unsupported JWE Algorithm: ${t}`)}}var at,ut,ct,ht=g({"../node_modules/jose/dist/browser/lib/iv.js"(){it(),ot(),rt=t=>nt(new Uint8Array(st(t)>>3))}}),ft=g({"../node_modules/jose/dist/browser/lib/check_iv_length.js"(){it(),ht(),at=(t,e)=>{if(e.length<<3!==st(t))throw new $("Invalid Initialization Vector length")}}}),lt=g({"../node_modules/jose/dist/browser/runtime/check_cek_length.js"(){it(),ut=(t,e)=>{const n=t.byteLength<<3;if(n!==e)throw new $(`Invalid Content Encryption Key length. Expected ${e} bits, got ${n} bits`)}}}),dt=g({"../node_modules/jose/dist/browser/runtime/timing_safe_equal.js"(){ct=(t,e)=>{if(!(t instanceof Uint8Array))throw new TypeError("First argument must be a buffer");if(!(e instanceof Uint8Array))throw new TypeError("Second argument must be a buffer");if(t.length!==e.length)throw new TypeError("Input buffers must have the same length");const n=t.length;let r=0,i=-1;for(;++i<n;)r|=t[i]^e[i];return 0===r}}});function vt(){return"undefined"!=typeof WebSocketPair||"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||"undefined"!=typeof EdgeRuntime&&"vercel"===EdgeRuntime}var pt=g({"../node_modules/jose/dist/browser/runtime/env.js"(){}});function wt(t,e="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${e} must be ${t}`)}function yt(t,e){return t.name===e}function mt(t){return parseInt(t.name.slice(4),10)}function gt(t,e){if(e.length&&!e.some((e=>t.usages.includes(e)))){let t="CryptoKey does not support this operation, its usages must include ";if(e.length>2){const n=e.pop();t+=`one of ${e.join(", ")}, or ${n}.`}else t+=2===e.length?`one of ${e[0]} or ${e[1]}.`:`${e[0]}.`;throw new TypeError(t)}}function bt(t,e,...n){switch(e){case"A128GCM":case"A192GCM":case"A256GCM":{if(!yt(t.algorithm,"AES-GCM"))throw wt("AES-GCM");const n=parseInt(e.slice(1,4),10);if(t.algorithm.length!==n)throw wt(n,"algorithm.length");break}case"A128KW":case"A192KW":case"A256KW":{if(!yt(t.algorithm,"AES-KW"))throw wt("AES-KW");const n=parseInt(e.slice(1,4),10);if(t.algorithm.length!==n)throw wt(n,"algorithm.length");break}case"ECDH":switch(t.algorithm.name){case"ECDH":case"X25519":case"X448":break;default:throw wt("ECDH, X25519, or X448")}break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if(!yt(t.algorithm,"PBKDF2"))throw wt("PBKDF2");break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{if(!yt(t.algorithm,"RSA-OAEP"))throw wt("RSA-OAEP");const n=parseInt(e.slice(9),10)||1;if(mt(t.algorithm.hash)!==n)throw wt(`SHA-${n}`,"algorithm.hash");break}default:throw new TypeError("CryptoKey does not support this operation")}gt(t,n)}var Et,St=g({"../node_modules/jose/dist/browser/lib/crypto_key.js"(){pt()}});function Ft(t,e,...n){if(n.length>2){const e=n.pop();t+=`one of type ${n.join(", ")}, or ${e}.`}else t+=2===n.length?`one of type ${n[0]} or ${n[1]}.`:`of type ${n[0]}.`;return null==e?t+=` Received ${e}`:"function"==typeof e&&e.name?t+=` Received function ${e.name}`:"object"==typeof e&&null!=e&&e.constructor&&e.constructor.name&&(t+=` Received an instance of ${e.constructor.name}`),t}function kt(t,e,...n){return Ft(`Key for the ${t} algorithm must be `,e,...n)}var xt,_t,At,jt,Ct,Rt,Tt=g({"../node_modules/jose/dist/browser/lib/invalid_key_input.js"(){Et=(t,...e)=>Ft("Key must be ",t,...e)}}),It=g({"../node_modules/jose/dist/browser/runtime/is_key_like.js"(){A(),xt=t=>e(t),_t=["CryptoKey"]}}),Ot=g({"../node_modules/jose/dist/browser/runtime/decrypt.js"(){Z(),ft(),lt(),dt(),it(),A(),St(),Tt(),It(),At=async(n,r,i,o,s,a)=>{if(!(e(r)||r instanceof Uint8Array))throw new TypeError(Et(r,..._t,"Uint8Array"));switch(at(n,o),n){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return r instanceof Uint8Array&&ut(r,parseInt(n.slice(-3),10)),async function(e,n,r,i,o,s){if(!(n instanceof Uint8Array))throw new TypeError(Et(n,"Uint8Array"));const a=parseInt(e.slice(1,4),10),u=await t.subtle.importKey("raw",n.subarray(a>>3),"AES-CBC",!1,["decrypt"]),c=await t.subtle.importKey("raw",n.subarray(0,a>>3),{hash:"SHA-"+(a<<1),name:"HMAC"},!1,["sign"]),h=C(s,i,r,T(s.length<<3)),f=new Uint8Array((await t.subtle.sign("HMAC",c,h)).slice(0,a>>3));let l,d;try{l=ct(o,f)}catch(t){}if(!l)throw new H;try{d=new Uint8Array(await t.subtle.decrypt({iv:i,name:"AES-CBC"},u,r))}catch(t){}if(!d)throw new H;return d}(n,r,i,o,s,a);case"A128GCM":case"A192GCM":case"A256GCM":return r instanceof Uint8Array&&ut(r,parseInt(n.slice(1,4),10)),async function(e,n,r,i,o,s){let a;n instanceof Uint8Array?a=await t.subtle.importKey("raw",n,"AES-GCM",!1,["decrypt"]):(bt(n,e,"decrypt"),a=n);try{return new Uint8Array(await t.subtle.decrypt({additionalData:s,iv:i,name:"AES-GCM",tagLength:128},a,C(r,o)))}catch(t){throw new H}}(n,r,i,o,s,a);default:throw new K("Unsupported JWE Content Encryption Algorithm")}}}}),Nt=g({"../node_modules/jose/dist/browser/runtime/zlib.js"(){it(),jt=async()=>{throw new K('JWE "zip" (Compression Algorithm) Header Parameter is not supported by your javascript runtime. You need to use the `inflateRaw` decrypt option to provide Inflate Raw implementation.')},Ct=async()=>{throw new K('JWE "zip" (Compression Algorithm) Header Parameter is not supported by your javascript runtime. You need to use the `deflateRaw` encrypt option to provide Deflate Raw implementation.')}}}),Pt=g({"../node_modules/jose/dist/browser/lib/is_disjoint.js"(){Rt=(...t)=>{const e=t.filter(Boolean);if(0===e.length||1===e.length)return!0;let n;for(const t of e){const e=Object.keys(t);if(n&&0!==n.size)for(const t of e){if(n.has(t))return!1;n.add(t)}else n=new Set(e)}return!0}}});function Dt(t){if("object"!=typeof(e=t)||null===e||"[object Object]"!==Object.prototype.toString.call(t))return!1;var e;if(null===Object.getPrototypeOf(t))return!0;let n=t;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(t)===n}var Mt,Ut,Lt,Bt=g({"../node_modules/jose/dist/browser/lib/is_object.js"(){}}),Jt=g({"../node_modules/jose/dist/browser/runtime/bogus.js"(){Mt=[{hash:"SHA-256",name:"HMAC"},!0,["sign"]]}});function Kt(t,e){if(t.algorithm.length!==parseInt(e.slice(1,4),10))throw new TypeError(`Invalid key size for alg: ${e}`)}function Ht(n,r,i){if(e(n))return bt(n,r,i),n;if(n instanceof Uint8Array)return t.subtle.importKey("raw",n,"AES-KW",!0,[i]);throw new TypeError(Et(n,..._t,"Uint8Array"))}var $t=g({"../node_modules/jose/dist/browser/runtime/aeskw.js"(){Jt(),A(),St(),Tt(),It(),Ut=async(e,n,r)=>{const i=await Ht(n,e,"wrapKey");Kt(i,e);const o=await t.subtle.importKey("raw",r,...Mt);return new Uint8Array(await t.subtle.wrapKey("raw",o,i,"AES-KW"))},Lt=async(e,n,r)=>{const i=await Ht(n,e,"unwrapKey");Kt(i,e);const o=await t.subtle.unwrapKey("raw",r,i,"AES-KW",...Mt);return new Uint8Array(await t.subtle.exportKey("raw",o))}}});async function Wt(i,o,s,a,u=new Uint8Array(0),c=new Uint8Array(0)){if(!e(i))throw new TypeError(Et(i,..._t));if(bt(i,"ECDH"),!e(o))throw new TypeError(Et(o,..._t));bt(o,"ECDH","deriveBits");const h=C(O(r.encode(s)),O(u),O(c),I(a));let f;return f="X25519"===i.algorithm.name?256:"X448"===i.algorithm.name?448:Math.ceil(parseInt(i.algorithm.namedCurve.substr(-3),10)/8)<<3,async function(t,e,r){const i=Math.ceil((e>>3)/32),o=new Uint8Array(32*i);for(let e=0;e<i;e++){const i=new Uint8Array(4+t.length+r.length);i.set(I(e+1)),i.set(t,4),i.set(r,4+t.length),o.set(await n("sha256",i),32*e)}return o.slice(0,e>>3)}(new Uint8Array(await t.subtle.deriveBits({name:i.algorithm.name,public:i},o,f)),a,h)}function qt(t){if(!e(t))throw new TypeError(Et(t,..._t));return["P-256","P-384","P-521"].includes(t.algorithm.namedCurve)||"X25519"===t.algorithm.name||"X448"===t.algorithm.name}var Vt,Gt,zt=g({"../node_modules/jose/dist/browser/runtime/ecdhes.js"(){Z(),A(),St(),Tt(),It()}}),Xt=g({"../node_modules/jose/dist/browser/lib/check_p2s.js"(){it()}});async function Yt(n,i,o,s){!function(t){if(!(t instanceof Uint8Array)||t.length<8)throw new $("PBES2 Salt Input must be 8 or more octets")}(n);const a=function(t,e){return C(r.encode(t),new Uint8Array([0]),e)}(i,n),u=parseInt(i.slice(13,16),10),c={hash:`SHA-${i.slice(8,11)}`,iterations:o,name:"PBKDF2",salt:a},h={length:u,name:"AES-KW"},f=await function(n,r){if(n instanceof Uint8Array)return t.subtle.importKey("raw",n,"PBKDF2",!1,["deriveBits"]);if(e(n))return bt(n,r,"deriveBits","deriveKey"),n;throw new TypeError(Et(n,..._t,"Uint8Array"))}(s,i);if(f.usages.includes("deriveBits"))return new Uint8Array(await t.subtle.deriveBits(c,f,u));if(f.usages.includes("deriveKey"))return t.subtle.deriveKey(c,f,h,!1,["wrapKey","unwrapKey"]);throw new TypeError('PBKDF2 key "usages" must include "deriveBits" or "deriveKey"')}var Qt=g({"../node_modules/jose/dist/browser/runtime/pbes2kw.js"(){ot(),Z(),tt(),$t(),Xt(),A(),St(),Tt(),It(),Vt=async(t,e,n,r=2048,i=nt(new Uint8Array(16)))=>{const o=await Yt(i,t,r,e);return{encryptedKey:await Ut(t.slice(-6),o,n),p2c:r,p2s:P(i)}},Gt=async(t,e,n,r,i)=>{const o=await Yt(i,t,r,e);return Lt(t.slice(-6),o,n)}}});function Zt(t){switch(t){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return"RSA-OAEP";default:throw new K(`alg ${t} is not supported either by JOSE or your javascript runtime`)}}var te,ee,ne,re,ie=g({"../node_modules/jose/dist/browser/runtime/subtle_rsaes.js"(){it()}}),oe=g({"../node_modules/jose/dist/browser/runtime/check_key_length.js"(){te=(t,e)=>{if(t.startsWith("RS")||t.startsWith("PS")){const{modulusLength:n}=e.algorithm;if("number"!=typeof n||n<2048)throw new TypeError(`${t} requires key modulusLength to be 2048 bits or larger`)}}}}),se=g({"../node_modules/jose/dist/browser/runtime/rsaes.js"(){ie(),Jt(),A(),St(),oe(),Tt(),It(),ee=async(n,r,i)=>{if(!e(r))throw new TypeError(Et(r,..._t));if(bt(r,n,"encrypt","wrapKey"),te(n,r),r.usages.includes("encrypt"))return new Uint8Array(await t.subtle.encrypt(Zt(n),r,i));if(r.usages.includes("wrapKey")){const e=await t.subtle.importKey("raw",i,...Mt);return new Uint8Array(await t.subtle.wrapKey("raw",e,r,Zt(n)))}throw new TypeError('RSA-OAEP key "usages" must include "encrypt" or "wrapKey" for this operation')},ne=async(n,r,i)=>{if(!e(r))throw new TypeError(Et(r,..._t));if(bt(r,n,"decrypt","unwrapKey"),te(n,r),r.usages.includes("decrypt"))return new Uint8Array(await t.subtle.decrypt(Zt(n),r,i));if(r.usages.includes("unwrapKey")){const e=await t.subtle.unwrapKey("raw",i,r,Zt(n),...Mt);return new Uint8Array(await t.subtle.exportKey("raw",e))}throw new TypeError('RSA-OAEP key "usages" must include "decrypt" or "unwrapKey" for this operation')}}});function ae(t){switch(t){case"A128GCM":return 128;case"A192GCM":return 192;case"A256GCM":case"A128CBC-HS256":return 256;case"A192CBC-HS384":return 384;case"A256CBC-HS512":return 512;default:throw new K(`Unsupported JWE Algorithm: ${t}`)}}var ue,ce,he,fe,le,de,ve,pe,we,ye,me=g({"../node_modules/jose/dist/browser/lib/cek.js"(){it(),ot(),re=t=>nt(new Uint8Array(ae(t)>>3))}}),ge=g({"../node_modules/jose/dist/browser/lib/format_pem.js"(){ue=(t,e)=>`-----BEGIN ${e}-----\n${(t.match(/.{1,64}/g)||[]).join("\n")}\n-----END ${e}-----`}}),be=g({"../node_modules/jose/dist/browser/runtime/asn1.js"(){pt(),A(),Tt(),tt(),ge(),it(),It(),ce=async(n,r,i)=>{if(!e(i))throw new TypeError(Et(i,..._t));if(!i.extractable)throw new TypeError("CryptoKey is not extractable");if(i.type!==n)throw new TypeError(`key is not a ${n} key`);return ue(N(new Uint8Array(await t.subtle.exportKey(r,i))),`${n.toUpperCase()} KEY`)},he=t=>ce("public","spki",t),fe=t=>ce("private","pkcs8",t),le=(t,e,n=0)=>{0===n&&(e.unshift(e.length),e.unshift(6));let r=t.indexOf(e[0],n);if(-1===r)return!1;const i=t.subarray(r,r+e.length);return i.length===e.length&&(i.every(((t,n)=>t===e[n]))||le(t,e,r+1))},de=t=>{switch(!0){case le(t,[42,134,72,206,61,3,1,7]):return"P-256";case le(t,[43,129,4,0,34]):return"P-384";case le(t,[43,129,4,0,35]):return"P-521";case le(t,[43,101,110]):return"X25519";case le(t,[43,101,111]):return"X448";case le(t,[43,101,112]):return"Ed25519";case le(t,[43,101,113]):return"Ed448";default:throw new K("Invalid or unsupported EC Key Curve or OKP Key Sub Type")}},ve=async(e,n,r,i,o)=>{var s;let a,u;const c=new Uint8Array(atob(r.replace(e,"")).split("").map((t=>t.charCodeAt(0)))),h="spki"===n;switch(i){case"PS256":case"PS384":case"PS512":a={name:"RSA-PSS",hash:`SHA-${i.slice(-3)}`},u=h?["verify"]:["sign"];break;case"RS256":case"RS384":case"RS512":a={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${i.slice(-3)}`},u=h?["verify"]:["sign"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":a={name:"RSA-OAEP",hash:`SHA-${parseInt(i.slice(-3),10)||1}`},u=h?["encrypt","wrapKey"]:["decrypt","unwrapKey"];break;case"ES256":a={name:"ECDSA",namedCurve:"P-256"},u=h?["verify"]:["sign"];break;case"ES384":a={name:"ECDSA",namedCurve:"P-384"},u=h?["verify"]:["sign"];break;case"ES512":a={name:"ECDSA",namedCurve:"P-521"},u=h?["verify"]:["sign"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{const t=de(c);a=t.startsWith("P-")?{name:"ECDH",namedCurve:t}:{name:t},u=h?[]:["deriveBits"];break}case vt()&&"EdDSA":{const t=de(c).toUpperCase();a={name:`NODE-${t}`,namedCurve:`NODE-${t}`},u=h?["verify"]:["sign"];break}case"EdDSA":a={name:de(c)},u=h?["verify"]:["sign"];break;default:throw new K('Invalid or unsupported "alg" (Algorithm) value')}return t.subtle.importKey(n,c,a,null!==(s=null==o?void 0:o.extractable)&&void 0!==s&&s,u)},pe=(t,e,n)=>ve(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,"pkcs8",t,e,n),we=(t,e,n)=>ve(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g,"spki",t,e,n)}}),Ee=g({"../node_modules/jose/dist/browser/runtime/jwk_to_key.js"(){pt(),A(),it(),tt(),ye=async e=>{var n,r;const{algorithm:i,keyUsages:o}=function(t){let e,n;switch(t.kty){case"oct":switch(t.alg){case"HS256":case"HS384":case"HS512":e={name:"HMAC",hash:`SHA-${t.alg.slice(-3)}`},n=["sign","verify"];break;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":throw new K(`${t.alg} keys cannot be imported as CryptoKey instances`);case"A128GCM":case"A192GCM":case"A256GCM":case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":e={name:"AES-GCM"},n=["encrypt","decrypt"];break;case"A128KW":case"A192KW":case"A256KW":e={name:"AES-KW"},n=["wrapKey","unwrapKey"];break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":e={name:"PBKDF2"},n=["deriveBits"];break;default:throw new K('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"RSA":switch(t.alg){case"PS256":case"PS384":case"PS512":e={name:"RSA-PSS",hash:`SHA-${t.alg.slice(-3)}`},n=t.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":e={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${t.alg.slice(-3)}`},n=t.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":e={name:"RSA-OAEP",hash:`SHA-${parseInt(t.alg.slice(-3),10)||1}`},n=t.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new K('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"EC":switch(t.alg){case"ES256":e={name:"ECDSA",namedCurve:"P-256"},n=t.d?["sign"]:["verify"];break;case"ES384":e={name:"ECDSA",namedCurve:"P-384"},n=t.d?["sign"]:["verify"];break;case"ES512":e={name:"ECDSA",namedCurve:"P-521"},n=t.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":e={name:"ECDH",namedCurve:t.crv},n=t.d?["deriveBits"]:[];break;default:throw new K('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case vt()&&"OKP":if("EdDSA"!==t.alg)throw new K('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');if("Ed25519"!==t.crv)throw new K('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');e={name:"NODE-ED25519",namedCurve:"NODE-ED25519"},n=t.d?["sign"]:["verify"];break;case"OKP":switch(t.alg){case"EdDSA":e={name:t.crv},n=t.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":e={name:t.crv},n=t.d?["deriveBits"]:[];break;default:throw new K('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;default:throw new K('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:e,keyUsages:n}}(e),s=[i,null!==(n=e.ext)&&void 0!==n&&n,null!==(r=e.key_ops)&&void 0!==r?r:o];if("PBKDF2"===i.name)return t.subtle.importKey("raw",M(e.k),...s);const a={...e};return delete a.alg,delete a.use,t.subtle.importKey("jwk",a,...s)}}});function Se(t){let e=[],n=0;for(;n<t.length;){let r=Fe(t.subarray(n));e.push(r),n+=r.byteLength}return e}function Fe(t){let e=0,n=31&t[0];if(e++,31===n){for(n=0;t[e]>=128;)n=128*n+t[e]-128,e++;n=128*n+t[e]-128,e++}let r=0;if(t[e]<128)r=t[e],e++;else{if(128===r){for(r=0;0!==t[e+r]||0!==t[e+r+1];){if(r>t.byteLength)throw new TypeError("invalid indefinite form length");r++}const n=e+r+2;return{byteLength:n,contents:t.subarray(e,e+r),raw:t.subarray(0,n)}}{let n=127&t[e];e++,r=0;for(let i=0;i<n;i++)r=256*r+t[e],e++}}const i=e+r;return{byteLength:i,contents:t.subarray(e,i),raw:t.subarray(0,i)}}async function ke(t,e,n){if("string"!=typeof t||0!==t.indexOf("-----BEGIN PUBLIC KEY-----"))throw new TypeError('"spki" must be SPKI formatted string');return we(t,e,n)}async function xe(t,e,n){if("string"!=typeof t||0!==t.indexOf("-----BEGIN CERTIFICATE-----"))throw new TypeError('"x509" must be X.509 formatted string');let r;try{r=function(t){const e=t.replace(/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g,""),n=D(e);return ue(function(t){const e=Se(Se(Fe(t).contents)[0].contents);return N(e[160===e[0].raw[0]?6:5].raw)}(n),"PUBLIC KEY")}(t)}catch(t){throw new TypeError("failed to parse the X.509 certificate",{cause:t})}return we(r,e,n)}async function _e(t,e,n){if("string"!=typeof t||0!==t.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return pe(t,e,n)}async function Ae(t,e,n){var r;if(!Dt(t))throw new TypeError("JWK must be an object");if(e||(e=t.alg),"string"!=typeof e||!e)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');switch(t.kty){case"oct":if("string"!=typeof t.k||!t.k)throw new TypeError('missing "k" (Key Value) Parameter value');return null!=n||(n=!0!==t.ext),n?ye({...t,alg:e,ext:null!==(r=t.ext)&&void 0!==r&&r}):M(t.k);case"RSA":if(void 0!==t.oth)throw new K('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');case"EC":case"OKP":return ye({...t,alg:e});default:throw new K('Unsupported "kty" (Key Type) Parameter value')}}var je,Ce,Re,Te,Ie,Oe=g({"../node_modules/jose/dist/browser/key/import.js"(){tt(),be(),be(),Ee(),it(),ge(),Bt()}}),Ne=g({"../node_modules/jose/dist/browser/lib/check_key_type.js"(){Tt(),It(),je=(t,e)=>{if(!(e instanceof Uint8Array)){if(!xt(e))throw new TypeError(kt(t,e,..._t,"Uint8Array"));if("secret"!==e.type)throw new TypeError(`${_t.join(" or ")} instances for symmetric algorithms must be of type "secret"`)}},Ce=(t,e,n)=>{if(!xt(e))throw new TypeError(kt(t,e,..._t));if("secret"===e.type)throw new TypeError(`${_t.join(" or ")} instances for asymmetric algorithms must not be of type "secret"`);if("sign"===n&&"public"===e.type)throw new TypeError(`${_t.join(" or ")} instances for asymmetric algorithm signing must be of type "private"`);if("decrypt"===n&&"public"===e.type)throw new TypeError(`${_t.join(" or ")} instances for asymmetric algorithm decryption must be of type "private"`);if(e.algorithm&&"verify"===n&&"private"===e.type)throw new TypeError(`${_t.join(" or ")} instances for asymmetric algorithm verifying must be of type "public"`);if(e.algorithm&&"encrypt"===n&&"private"===e.type)throw new TypeError(`${_t.join(" or ")} instances for asymmetric algorithm encryption must be of type "public"`)},Re=(t,e,n)=>{t.startsWith("HS")||"dir"===t||t.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(t)?je(t,e):Ce(t,e,n)}}}),Pe=g({"../node_modules/jose/dist/browser/runtime/encrypt.js"(){Z(),ft(),lt(),A(),St(),Tt(),it(),It(),Te=async(n,r,i,o,s)=>{if(!(e(i)||i instanceof Uint8Array))throw new TypeError(Et(i,..._t,"Uint8Array"));switch(at(n,o),n){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return i instanceof Uint8Array&&ut(i,parseInt(n.slice(-3),10)),async function(e,n,r,i,o){if(!(r instanceof Uint8Array))throw new TypeError(Et(r,"Uint8Array"));const s=parseInt(e.slice(1,4),10),a=await t.subtle.importKey("raw",r.subarray(s>>3),"AES-CBC",!1,["encrypt"]),u=await t.subtle.importKey("raw",r.subarray(0,s>>3),{hash:"SHA-"+(s<<1),name:"HMAC"},!1,["sign"]),c=new Uint8Array(await t.subtle.encrypt({iv:i,name:"AES-CBC"},a,n)),h=C(o,i,c,T(o.length<<3));return{ciphertext:c,tag:new Uint8Array((await t.subtle.sign("HMAC",u,h)).slice(0,s>>3))}}(n,r,i,o,s);case"A128GCM":case"A192GCM":case"A256GCM":return i instanceof Uint8Array&&ut(i,parseInt(n.slice(1,4),10)),async function(e,n,r,i,o){let s;r instanceof Uint8Array?s=await t.subtle.importKey("raw",r,"AES-GCM",!1,["encrypt"]):(bt(r,e,"encrypt"),s=r);const a=new Uint8Array(await t.subtle.encrypt({additionalData:o,iv:i,name:"AES-GCM",tagLength:128},s,n)),u=a.slice(-16);return{ciphertext:a.slice(0,-16),tag:u}}(n,r,i,o,s);default:throw new K("Unsupported JWE Content Encryption Algorithm")}}}}),De=g({"../node_modules/jose/dist/browser/lib/aesgcmkw.js"(){Pe(),Ot(),ht(),tt()}});async function Me(t,e,n,r,i){switch(Re(t,e,"decrypt"),t){case"dir":if(void 0!==n)throw new $("Encountered unexpected JWE Encrypted Key");return e;case"ECDH-ES":if(void 0!==n)throw new $("Encountered unexpected JWE Encrypted Key");case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!Dt(r.epk))throw new $('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');if(!qt(e))throw new K("ECDH with the provided key is not allowed or not supported by your javascript runtime");const i=await Ae(r.epk,t);let o,s;if(void 0!==r.apu){if("string"!=typeof r.apu)throw new $('JOSE Header "apu" (Agreement PartyUInfo) invalid');o=M(r.apu)}if(void 0!==r.apv){if("string"!=typeof r.apv)throw new $('JOSE Header "apv" (Agreement PartyVInfo) invalid');s=M(r.apv)}const a=await Wt(i,e,"ECDH-ES"===t?r.enc:t,"ECDH-ES"===t?ae(r.enc):parseInt(t.slice(-5,-2),10),o,s);if("ECDH-ES"===t)return a;if(void 0===n)throw new $("JWE Encrypted Key missing");return Lt(t.slice(-6),a,n)}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":if(void 0===n)throw new $("JWE Encrypted Key missing");return ne(t,e,n);case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if(void 0===n)throw new $("JWE Encrypted Key missing");if("number"!=typeof r.p2c)throw new $('JOSE Header "p2c" (PBES2 Count) missing or invalid');if(r.p2c>((null==i?void 0:i.maxPBES2Count)||1e4))throw new $('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if("string"!=typeof r.p2s)throw new $('JOSE Header "p2s" (PBES2 Salt) missing or invalid');return Gt(t,e,n,r.p2c,M(r.p2s));case"A128KW":case"A192KW":case"A256KW":if(void 0===n)throw new $("JWE Encrypted Key missing");return Lt(t,e,n);case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":if(void 0===n)throw new $("JWE Encrypted Key missing");if("string"!=typeof r.iv)throw new $('JOSE Header "iv" (Initialization Vector) missing or invalid');if("string"!=typeof r.tag)throw new $('JOSE Header "tag" (Authentication Tag) missing or invalid');return async function(t,e,n,r,i){const o=t.slice(0,7);return At(o,e,n,r,i,new Uint8Array(0))}(t,e,n,M(r.iv),M(r.tag));default:throw new K('Invalid or unsupported "alg" (JWE Algorithm) header value')}}var Ue,Le=g({"../node_modules/jose/dist/browser/lib/decrypt_key_management.js"(){$t(),zt(),Qt(),se(),tt(),it(),me(),Oe(),Ne(),Bt(),De(),Ie=Me}});function Be(t,e,n,r,i){if(void 0!==i.crit&&void 0===r.crit)throw new t('"crit" (Critical) Header Parameter MUST be integrity protected');if(!r||void 0===r.crit)return new Set;if(!Array.isArray(r.crit)||0===r.crit.length||r.crit.some((t=>"string"!=typeof t||0===t.length)))throw new t('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let o;o=void 0!==n?new Map([...Object.entries(n),...e.entries()]):e;for(const e of r.crit){if(!o.has(e))throw new K(`Extension Header Parameter "${e}" is not recognized`);if(void 0===i[e])throw new t(`Extension Header Parameter "${e}" is missing`);if(o.get(e)&&void 0===r[e])throw new t(`Extension Header Parameter "${e}" MUST be integrity protected`)}return new Set(r.crit)}var Je,Ke=g({"../node_modules/jose/dist/browser/lib/validate_crit.js"(){it(),Ue=Be}}),He=g({"../node_modules/jose/dist/browser/lib/validate_algorithms.js"(){Je=(t,e)=>{if(void 0!==e&&(!Array.isArray(e)||e.some((t=>"string"!=typeof t))))throw new TypeError(`"${t}" option must be an array of strings`);if(e)return new Set(e)}}});async function $e(t,e,n){var o;if(!Dt(t))throw new $("Flattened JWE must be an object");if(void 0===t.protected&&void 0===t.header&&void 0===t.unprotected)throw new $("JOSE Header missing");if("string"!=typeof t.iv)throw new $("JWE Initialization Vector missing or incorrect type");if("string"!=typeof t.ciphertext)throw new $("JWE Ciphertext missing or incorrect type");if("string"!=typeof t.tag)throw new $("JWE Authentication Tag missing or incorrect type");if(void 0!==t.protected&&"string"!=typeof t.protected)throw new $("JWE Protected Header incorrect type");if(void 0!==t.encrypted_key&&"string"!=typeof t.encrypted_key)throw new $("JWE Encrypted Key incorrect type");if(void 0!==t.aad&&"string"!=typeof t.aad)throw new $("JWE AAD incorrect type");if(void 0!==t.header&&!Dt(t.header))throw new $("JWE Shared Unprotected Header incorrect type");if(void 0!==t.unprotected&&!Dt(t.unprotected))throw new $("JWE Per-Recipient Unprotected Header incorrect type");let s;if(t.protected)try{const e=M(t.protected);s=JSON.parse(i.decode(e))}catch(t){throw new $("JWE Protected Header is invalid")}if(!Rt(s,t.header,t.unprotected))throw new $("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");const a={...s,...t.header,...t.unprotected};if(Ue($,new Map,null==n?void 0:n.crit,s,a),void 0!==a.zip){if(!s||!s.zip)throw new $('JWE "zip" (Compression Algorithm) Header MUST be integrity protected');if("DEF"!==a.zip)throw new K('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value')}const{alg:u,enc:c}=a;if("string"!=typeof u||!u)throw new $("missing JWE Algorithm (alg) in JWE Header");if("string"!=typeof c||!c)throw new $("missing JWE Encryption Algorithm (enc) in JWE Header");const h=n&&Je("keyManagementAlgorithms",n.keyManagementAlgorithms),f=n&&Je("contentEncryptionAlgorithms",n.contentEncryptionAlgorithms);if(h&&!h.has(u))throw new J('"alg" (Algorithm) Header Parameter not allowed');if(f&&!f.has(c))throw new J('"enc" (Encryption Algorithm) Header Parameter not allowed');let l;void 0!==t.encrypted_key&&(l=M(t.encrypted_key));let d,v=!1;"function"==typeof e&&(e=await e(s,t),v=!0);try{d=await Ie(u,e,l,a,n)}catch(t){if(t instanceof TypeError||t instanceof $||t instanceof K)throw t;d=re(c)}const p=M(t.iv),w=M(t.tag),y=r.encode(null!==(o=t.protected)&&void 0!==o?o:"");let m;m=void 0!==t.aad?C(y,r.encode("."),r.encode(t.aad)):y;let g=await At(c,d,M(t.ciphertext),p,w,m);"DEF"===a.zip&&(g=await((null==n?void 0:n.inflateRaw)||jt)(g));const b={plaintext:g};return void 0!==t.protected&&(b.protectedHeader=s),void 0!==t.aad&&(b.additionalAuthenticatedData=M(t.aad)),void 0!==t.unprotected&&(b.sharedUnprotectedHeader=t.unprotected),void 0!==t.header&&(b.unprotectedHeader=t.header),v?{...b,key:e}:b}var We=g({"../node_modules/jose/dist/browser/jwe/flattened/decrypt.js"(){tt(),Ot(),Nt(),it(),Pt(),Bt(),Le(),Z(),me(),Ke(),He()}});async function qe(t,e,n){if(t instanceof Uint8Array&&(t=i.decode(t)),"string"!=typeof t)throw new $("Compact JWE must be a string or Uint8Array");const{0:r,1:o,2:s,3:a,4:u,length:c}=t.split(".");if(5!==c)throw new $("Invalid Compact JWE");const h=await $e({ciphertext:a,iv:s||void 0,protected:r||void 0,tag:u||void 0,encrypted_key:o||void 0},e,n),f={plaintext:h.plaintext,protectedHeader:h.protectedHeader};return"function"==typeof e?{...f,key:h.key}:f}var Ve=g({"../node_modules/jose/dist/browser/jwe/compact/decrypt.js"(){We(),it(),Z()}});async function Ge(t,e,n){if(!Dt(t))throw new $("General JWE must be an object");if(!Array.isArray(t.recipients)||!t.recipients.every(Dt))throw new $("JWE Recipients missing or incorrect type");if(!t.recipients.length)throw new $("JWE Recipients has no members");for(const r of t.recipients)try{return await $e({aad:t.aad,ciphertext:t.ciphertext,encrypted_key:r.encrypted_key,header:r.header,iv:t.iv,protected:t.protected,tag:t.tag,unprotected:t.unprotected},e,n)}catch(t){}throw new H}var ze,Xe=g({"../node_modules/jose/dist/browser/jwe/general/decrypt.js"(){We(),it(),Bt()}}),Ye=g({"../node_modules/jose/dist/browser/runtime/key_to_jwk.js"(){A(),Tt(),tt(),It(),ze=async n=>{if(n instanceof Uint8Array)return{kty:"oct",k:P(n)};if(!e(n))throw new TypeError(Et(n,..._t,"Uint8Array"));if(!n.extractable)throw new TypeError("non-extractable CryptoKey cannot be exported as a JWK");const{ext:r,key_ops:i,alg:o,use:s,...a}=await t.subtle.exportKey("jwk",n);return a}}});async function Qe(t){return he(t)}async function Ze(t){return fe(t)}async function tn(t){return ze(t)}var en,nn=g({"../node_modules/jose/dist/browser/key/export.js"(){be(),be(),Ye()}});async function rn(n,r,i,o,s={}){let a,u,c;switch(Re(n,i,"encrypt"),n){case"dir":c=i;break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!qt(i))throw new K("ECDH with the provided key is not allowed or not supported by your javascript runtime");const{apu:h,apv:f}=s;let{epk:l}=s;l||(l=(await async function(n){if(!e(n))throw new TypeError(Et(n,..._t));return t.subtle.generateKey(n.algorithm,!0,["deriveBits"])}(i)).privateKey);const{x:d,y:v,crv:p,kty:w}=await tn(l),y=await Wt(i,l,"ECDH-ES"===n?r:n,"ECDH-ES"===n?ae(r):parseInt(n.slice(-5,-2),10),h,f);if(u={epk:{x:d,crv:p,kty:w}},"EC"===w&&(u.epk.y=v),h&&(u.apu=P(h)),f&&(u.apv=P(f)),"ECDH-ES"===n){c=y;break}c=o||re(r);const m=n.slice(-6);a=await Ut(m,y,c);break}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":c=o||re(r),a=await ee(n,i,c);break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{c=o||re(r);const{p2c:t,p2s:e}=s;({encryptedKey:a,...u}=await Vt(n,i,c,t,e));break}case"A128KW":case"A192KW":case"A256KW":c=o||re(r),a=await Ut(n,i,c);break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{c=o||re(r);const{iv:t}=s;({encryptedKey:a,...u}=await async function(t,e,n,r){const i=t.slice(0,7);r||(r=rt(i));const{ciphertext:o,tag:s}=await Te(i,n,e,r,new Uint8Array(0));return{encryptedKey:o,iv:P(r),tag:P(s)}}(n,i,c,t));break}default:throw new K('Invalid or unsupported "alg" (JWE Algorithm) header value')}return{cek:c,encryptedKey:a,parameters:u}}var on,sn,an,un,cn=g({"../node_modules/jose/dist/browser/lib/encrypt_key_management.js"(){$t(),zt(),Qt(),se(),tt(),me(),it(),nn(),Ne(),De(),en=rn}}),hn=g({"../node_modules/jose/dist/browser/jwe/flattened/encrypt.js"(){tt(),Pe(),Nt(),ht(),cn(),it(),Pt(),Z(),Ke(),on=Symbol(),sn=class{constructor(t){if(!(t instanceof Uint8Array))throw new TypeError("plaintext must be an instance of Uint8Array");this._plaintext=t}setKeyManagementParameters(t){if(this._keyManagementParameters)throw new TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=t,this}setProtectedHeader(t){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=t,this}setSharedUnprotectedHeader(t){if(this._sharedUnprotectedHeader)throw new TypeError("setSharedUnprotectedHeader can only be called once");return this._sharedUnprotectedHeader=t,this}setUnprotectedHeader(t){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=t,this}setAdditionalAuthenticatedData(t){return this._aad=t,this}setContentEncryptionKey(t){if(this._cek)throw new TypeError("setContentEncryptionKey can only be called once");return this._cek=t,this}setInitializationVector(t){if(this._iv)throw new TypeError("setInitializationVector can only be called once");return this._iv=t,this}async encrypt(t,e){if(!this._protectedHeader&&!this._unprotectedHeader&&!this._sharedUnprotectedHeader)throw new $("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!Rt(this._protectedHeader,this._unprotectedHeader,this._sharedUnprotectedHeader))throw new $("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");const n={...this._protectedHeader,...this._unprotectedHeader,...this._sharedUnprotectedHeader};if(Ue($,new Map,null==e?void 0:e.crit,this._protectedHeader,n),void 0!==n.zip){if(!this._protectedHeader||!this._protectedHeader.zip)throw new $('JWE "zip" (Compression Algorithm) Header MUST be integrity protected');if("DEF"!==n.zip)throw new K('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value')}const{alg:o,enc:s}=n;if("string"!=typeof o||!o)throw new $('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("string"!=typeof s||!s)throw new $('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');let a,u,c,h,f,l,d;if("dir"===o){if(this._cek)throw new TypeError("setContentEncryptionKey cannot be called when using Direct Encryption")}else if("ECDH-ES"===o&&this._cek)throw new TypeError("setContentEncryptionKey cannot be called when using Direct Key Agreement");{let n;({cek:u,encryptedKey:a,parameters:n}=await en(o,s,t,this._cek,this._keyManagementParameters)),n&&(e&&on in e?this._unprotectedHeader?this._unprotectedHeader={...this._unprotectedHeader,...n}:this.setUnprotectedHeader(n):this._protectedHeader?this._protectedHeader={...this._protectedHeader,...n}:this.setProtectedHeader(n))}if(this._iv||(this._iv=rt(s)),h=r.encode(this._protectedHeader?P(JSON.stringify(this._protectedHeader)):""),this._aad?(f=P(this._aad),c=C(h,r.encode("."),r.encode(f))):c=h,"DEF"===n.zip){const t=await((null==e?void 0:e.deflateRaw)||Ct)(this._plaintext);({ciphertext:l,tag:d}=await Te(s,t,u,this._iv,c))}else({ciphertext:l,tag:d}=await Te(s,this._plaintext,u,this._iv,c));const v={ciphertext:P(l),iv:P(this._iv),tag:P(d)};return a&&(v.encrypted_key=P(a)),f&&(v.aad=f),this._protectedHeader&&(v.protected=i.decode(h)),this._sharedUnprotectedHeader&&(v.unprotected=this._sharedUnprotectedHeader),this._unprotectedHeader&&(v.header=this._unprotectedHeader),v}}}}),fn=g({"../node_modules/jose/dist/browser/jwe/general/encrypt.js"(){hn(),it(),me(),Pt(),cn(),tt(),Ke(),an=class{constructor(t,e,n){this.parent=t,this.key=e,this.options=n}setUnprotectedHeader(t){if(this.unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this.unprotectedHeader=t,this}addRecipient(...t){return this.parent.addRecipient(...t)}encrypt(...t){return this.parent.encrypt(...t)}done(){return this.parent}},un=class{constructor(t){this._recipients=[],this._plaintext=t}addRecipient(t,e){const n=new an(this,t,{crit:null==e?void 0:e.crit});return this._recipients.push(n),n}setProtectedHeader(t){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=t,this}setSharedUnprotectedHeader(t){if(this._unprotectedHeader)throw new TypeError("setSharedUnprotectedHeader can only be called once");return this._unprotectedHeader=t,this}setAdditionalAuthenticatedData(t){return this._aad=t,this}async encrypt(t){var e,n,r;if(!this._recipients.length)throw new $("at least one recipient must be added");if(t={deflateRaw:null==t?void 0:t.deflateRaw},1===this._recipients.length){const[e]=this._recipients,n=await new sn(this._plaintext).setAdditionalAuthenticatedData(this._aad).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(e.unprotectedHeader).encrypt(e.key,{...e.options,...t});let r={ciphertext:n.ciphertext,iv:n.iv,recipients:[{}],tag:n.tag};return n.aad&&(r.aad=n.aad),n.protected&&(r.protected=n.protected),n.unprotected&&(r.unprotected=n.unprotected),n.encrypted_key&&(r.recipients[0].encrypted_key=n.encrypted_key),n.header&&(r.recipients[0].header=n.header),r}let i;for(let t=0;t<this._recipients.length;t++){const e=this._recipients[t];if(!Rt(this._protectedHeader,this._unprotectedHeader,e.unprotectedHeader))throw new $("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");const n={...this._protectedHeader,...this._unprotectedHeader,...e.unprotectedHeader},{alg:r}=n;if("string"!=typeof r||!r)throw new $('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("dir"===r||"ECDH-ES"===r)throw new $('"dir" and "ECDH-ES" alg may only be used with a single recipient');if("string"!=typeof n.enc||!n.enc)throw new $('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');if(i){if(i!==n.enc)throw new $('JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients')}else i=n.enc;if(Ue($,new Map,e.options.crit,this._protectedHeader,n),!(void 0===n.zip||this._protectedHeader&&this._protectedHeader.zip))throw new $('JWE "zip" (Compression Algorithm) Header MUST be integrity protected')}const o=re(i);let s={ciphertext:"",iv:"",recipients:[],tag:""};for(let a=0;a<this._recipients.length;a++){const u=this._recipients[a],c={};s.recipients.push(c);const h={...this._protectedHeader,...this._unprotectedHeader,...u.unprotectedHeader}.alg.startsWith("PBES2")?2048+a:void 0;if(0===a){const e=await new sn(this._plaintext).setAdditionalAuthenticatedData(this._aad).setContentEncryptionKey(o).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(u.unprotectedHeader).setKeyManagementParameters({p2c:h}).encrypt(u.key,{...u.options,...t,[on]:!0});s.ciphertext=e.ciphertext,s.iv=e.iv,s.tag=e.tag,e.aad&&(s.aad=e.aad),e.protected&&(s.protected=e.protected),e.unprotected&&(s.unprotected=e.unprotected),c.encrypted_key=e.encrypted_key,e.header&&(c.header=e.header);continue}const{encryptedKey:f,parameters:l}=await en((null===(e=u.unprotectedHeader)||void 0===e?void 0:e.alg)||(null===(n=this._protectedHeader)||void 0===n?void 0:n.alg)||(null===(r=this._unprotectedHeader)||void 0===r?void 0:r.alg),i,u.key,o,{p2c:h});c.encrypted_key=P(f),(u.unprotectedHeader||l)&&(c.header={...u.unprotectedHeader,...l})}return s}}}});function ln(t,e){const n=`SHA-${t.slice(-3)}`;switch(t){case"HS256":case"HS384":case"HS512":return{hash:n,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:n,name:"RSA-PSS",saltLength:t.slice(-3)>>3};case"RS256":case"RS384":case"RS512":return{hash:n,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:n,name:"ECDSA",namedCurve:e.namedCurve};case vt()&&"EdDSA":const{namedCurve:r}=e;return{name:r,namedCurve:r};case"EdDSA":return{name:e.name};default:throw new K(`alg ${t} is not supported either by JOSE or your javascript runtime`)}}var dn=g({"../node_modules/jose/dist/browser/runtime/subtle_dsa.js"(){pt(),it()}});function vn(n,r,i){if(e(r))return function(t,e,...n){switch(e){case"HS256":case"HS384":case"HS512":{if(!yt(t.algorithm,"HMAC"))throw wt("HMAC");const n=parseInt(e.slice(2),10);if(mt(t.algorithm.hash)!==n)throw wt(`SHA-${n}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!yt(t.algorithm,"RSASSA-PKCS1-v1_5"))throw wt("RSASSA-PKCS1-v1_5");const n=parseInt(e.slice(2),10);if(mt(t.algorithm.hash)!==n)throw wt(`SHA-${n}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!yt(t.algorithm,"RSA-PSS"))throw wt("RSA-PSS");const n=parseInt(e.slice(2),10);if(mt(t.algorithm.hash)!==n)throw wt(`SHA-${n}`,"algorithm.hash");break}case vt()&&"EdDSA":if(!yt(t.algorithm,"NODE-ED25519"))throw wt("NODE-ED25519");break;case"EdDSA":if("Ed25519"!==t.algorithm.name&&"Ed448"!==t.algorithm.name)throw wt("Ed25519 or Ed448");break;case"ES256":case"ES384":case"ES512":{if(!yt(t.algorithm,"ECDSA"))throw wt("ECDSA");const n=function(t){switch(t){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}(e);if(t.algorithm.namedCurve!==n)throw wt(n,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}gt(t,n)}(r,n,i),r;if(r instanceof Uint8Array){if(!n.startsWith("HS"))throw new TypeError(Et(r,..._t));return t.subtle.importKey("raw",r,{hash:`SHA-${n.slice(-3)}`,name:"HMAC"},!1,[i])}throw new TypeError(Et(r,..._t,"Uint8Array"))}var pn,wn=g({"../node_modules/jose/dist/browser/runtime/get_sign_verify_key.js"(){A(),St(),Tt(),It()}}),yn=g({"../node_modules/jose/dist/browser/runtime/verify.js"(){dn(),A(),oe(),wn(),pn=async(e,n,r,i)=>{const o=await vn(e,n,"verify");te(e,o);const s=ln(e,o.algorithm);try{return await t.subtle.verify(s,o,r,i)}catch(t){return!1}}}});async function mn(t,e,n){var o;if(!Dt(t))throw new W("Flattened JWS must be an object");if(void 0===t.protected&&void 0===t.header)throw new W('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==t.protected&&"string"!=typeof t.protected)throw new W("JWS Protected Header incorrect type");if(void 0===t.payload)throw new W("JWS Payload missing");if("string"!=typeof t.signature)throw new W("JWS Signature missing or incorrect type");if(void 0!==t.header&&!Dt(t.header))throw new W("JWS Unprotected Header incorrect type");let s={};if(t.protected)try{const e=M(t.protected);s=JSON.parse(i.decode(e))}catch(t){throw new W("JWS Protected Header is invalid")}if(!Rt(s,t.header))throw new W("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const a={...s,...t.header};let u=!0;if(Ue(W,new Map([["b64",!0]]),null==n?void 0:n.crit,s,a).has("b64")&&(u=s.b64,"boolean"!=typeof u))throw new W('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:c}=a;if("string"!=typeof c||!c)throw new W('JWS "alg" (Algorithm) Header Parameter missing or invalid');const h=n&&Je("algorithms",n.algorithms);if(h&&!h.has(c))throw new J('"alg" (Algorithm) Header Parameter not allowed');if(u){if("string"!=typeof t.payload)throw new W("JWS Payload must be a string")}else if("string"!=typeof t.payload&&!(t.payload instanceof Uint8Array))throw new W("JWS Payload must be a string or an Uint8Array instance");let f=!1;"function"==typeof e&&(e=await e(s,t),f=!0),Re(c,e,"verify");const l=C(r.encode(null!==(o=t.protected)&&void 0!==o?o:""),r.encode("."),"string"==typeof t.payload?r.encode(t.payload):t.payload),d=M(t.signature);if(!await pn(c,e,d,l))throw new Q;let v;v=u?M(t.payload):"string"==typeof t.payload?r.encode(t.payload):t.payload;const p={payload:v};return void 0!==t.protected&&(p.protectedHeader=s),void 0!==t.header&&(p.unprotectedHeader=t.header),f?{...p,key:e}:p}var gn=g({"../node_modules/jose/dist/browser/jws/flattened/verify.js"(){tt(),yn(),it(),Z(),Pt(),Bt(),Ne(),Ke(),He()}});async function bn(t,e,n){if(t instanceof Uint8Array&&(t=i.decode(t)),"string"!=typeof t)throw new W("Compact JWS must be a string or Uint8Array");const{0:r,1:o,2:s,length:a}=t.split(".");if(3!==a)throw new W("Invalid Compact JWS");const u=await mn({payload:o,protected:r,signature:s},e,n),c={payload:u.payload,protectedHeader:u.protectedHeader};return"function"==typeof e?{...c,key:u.key}:c}var En=g({"../node_modules/jose/dist/browser/jws/compact/verify.js"(){gn(),it(),Z()}});async function Sn(t,e,n){if(!Dt(t))throw new W("General JWS must be an object");if(!Array.isArray(t.signatures)||!t.signatures.every(Dt))throw new W("JWS Signatures missing or incorrect type");for(const r of t.signatures)try{return await mn({header:r.header,payload:t.payload,protected:r.protected,signature:r.signature},e,n)}catch(t){}throw new Q}var Fn,kn,xn,_n,An,jn,Cn=g({"../node_modules/jose/dist/browser/jws/general/verify.js"(){gn(),it(),Bt()}}),Rn=g({"../node_modules/jose/dist/browser/lib/epoch.js"(){Fn=t=>Math.floor(t.getTime()/1e3)}}),Tn=g({"../node_modules/jose/dist/browser/lib/secs.js"(){86400,kn=/^(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)$/i,xn=t=>{const e=kn.exec(t);if(!e)throw new TypeError("Invalid time period format");const n=parseFloat(e[1]);switch(e[2].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":return Math.round(n);case"minute":case"minutes":case"min":case"mins":case"m":return Math.round(60*n);case"hour":case"hours":case"hr":case"hrs":case"h":return Math.round(3600*n);case"day":case"days":case"d":return Math.round(86400*n);case"week":case"weeks":case"w":return Math.round(604800*n);default:return Math.round(31557600*n)}}}}),In=g({"../node_modules/jose/dist/browser/lib/jwt_claims_set.js"(){it(),Z(),Rn(),Tn(),Bt(),_n=t=>t.toLowerCase().replace(/^application\//,""),An=(t,e)=>"string"==typeof t?e.includes(t):!!Array.isArray(t)&&e.some(Set.prototype.has.bind(new Set(t))),jn=(t,e,n={})=>{const{typ:r}=n;if(r&&("string"!=typeof t.typ||_n(t.typ)!==_n(r)))throw new L('unexpected "typ" JWT header value',"typ","check_failed");let o;try{o=JSON.parse(i.decode(e))}catch(t){}if(!Dt(o))throw new q("JWT Claims Set must be a top-level JSON object");const{issuer:s}=n;if(s&&!(Array.isArray(s)?s:[s]).includes(o.iss))throw new L('unexpected "iss" claim value',"iss","check_failed");const{subject:a}=n;if(a&&o.sub!==a)throw new L('unexpected "sub" claim value',"sub","check_failed");const{audience:u}=n;if(u&&!An(o.aud,"string"==typeof u?[u]:u))throw new L('unexpected "aud" claim value',"aud","check_failed");let c;switch(typeof n.clockTolerance){case"string":c=xn(n.clockTolerance);break;case"number":c=n.clockTolerance;break;case"undefined":c=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:h}=n,f=Fn(h||new Date);if((void 0!==o.iat||n.maxTokenAge)&&"number"!=typeof o.iat)throw new L('"iat" claim must be a number',"iat","invalid");if(void 0!==o.nbf){if("number"!=typeof o.nbf)throw new L('"nbf" claim must be a number',"nbf","invalid");if(o.nbf>f+c)throw new L('"nbf" claim timestamp check failed',"nbf","check_failed")}if(void 0!==o.exp){if("number"!=typeof o.exp)throw new L('"exp" claim must be a number',"exp","invalid");if(o.exp<=f-c)throw new B('"exp" claim timestamp check failed',"exp","check_failed")}if(n.maxTokenAge){const t=f-o.iat;if(t-c>("number"==typeof n.maxTokenAge?n.maxTokenAge:xn(n.maxTokenAge)))throw new B('"iat" claim timestamp check failed (too far in the past)',"iat","check_failed");if(t<0-c)throw new L('"iat" claim timestamp check failed (it should be in the past)',"iat","check_failed")}return o}}});async function On(t,e,n){var r;const i=await bn(t,e,n);if((null===(r=i.protectedHeader.crit)||void 0===r?void 0:r.includes("b64"))&&!1===i.protectedHeader.b64)throw new q("JWTs MUST NOT use unencoded payload");const o={payload:jn(i.protectedHeader,i.payload,n),protectedHeader:i.protectedHeader};return"function"==typeof e?{...o,key:i.key}:o}var Nn=g({"../node_modules/jose/dist/browser/jwt/verify.js"(){En(),In(),it()}});async function Pn(t,e,n){const r=await qe(t,e,n),i=jn(r.protectedHeader,r.plaintext,n),{protectedHeader:o}=r;if(void 0!==o.iss&&o.iss!==i.iss)throw new L('replicated "iss" claim header parameter mismatch',"iss","mismatch");if(void 0!==o.sub&&o.sub!==i.sub)throw new L('replicated "sub" claim header parameter mismatch',"sub","mismatch");if(void 0!==o.aud&&JSON.stringify(o.aud)!==JSON.stringify(i.aud))throw new L('replicated "aud" claim header parameter mismatch',"aud","mismatch");const s={payload:i,protectedHeader:o};return"function"==typeof e?{...s,key:r.key}:s}var Dn,Mn,Un,Ln,Bn,Jn,Kn,Hn,$n,Wn,qn=g({"../node_modules/jose/dist/browser/jwt/decrypt.js"(){Ve(),In(),it()}}),Vn=g({"../node_modules/jose/dist/browser/jwe/compact/encrypt.js"(){hn(),Dn=class{constructor(t){this._flattened=new sn(t)}setContentEncryptionKey(t){return this._flattened.setContentEncryptionKey(t),this}setInitializationVector(t){return this._flattened.setInitializationVector(t),this}setProtectedHeader(t){return this._flattened.setProtectedHeader(t),this}setKeyManagementParameters(t){return this._flattened.setKeyManagementParameters(t),this}async encrypt(t,e){const n=await this._flattened.encrypt(t,e);return[n.protected,n.encrypted_key,n.iv,n.ciphertext,n.tag].join(".")}}}}),Gn=g({"../node_modules/jose/dist/browser/runtime/sign.js"(){dn(),A(),oe(),wn(),Mn=async(e,n,r)=>{const i=await vn(e,n,"sign");te(e,i);const o=await t.subtle.sign(ln(e,i.algorithm),i,r);return new Uint8Array(o)}}}),zn=g({"../node_modules/jose/dist/browser/jws/flattened/sign.js"(){tt(),Gn(),Pt(),it(),Z(),Ne(),Ke(),Un=class{constructor(t){if(!(t instanceof Uint8Array))throw new TypeError("payload must be an instance of Uint8Array");this._payload=t}setProtectedHeader(t){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=t,this}setUnprotectedHeader(t){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=t,this}async sign(t,e){if(!this._protectedHeader&&!this._unprotectedHeader)throw new W("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!Rt(this._protectedHeader,this._unprotectedHeader))throw new W("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const n={...this._protectedHeader,...this._unprotectedHeader};let o=!0;if(Ue(W,new Map([["b64",!0]]),null==e?void 0:e.crit,this._protectedHeader,n).has("b64")&&(o=this._protectedHeader.b64,"boolean"!=typeof o))throw new W('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:s}=n;if("string"!=typeof s||!s)throw new W('JWS "alg" (Algorithm) Header Parameter missing or invalid');Re(s,t,"sign");let a,u=this._payload;o&&(u=r.encode(P(u))),a=r.encode(this._protectedHeader?P(JSON.stringify(this._protectedHeader)):"");const c=C(a,r.encode("."),u),h=await Mn(s,t,c),f={signature:P(h),payload:""};return o&&(f.payload=i.decode(u)),this._unprotectedHeader&&(f.header=this._unprotectedHeader),this._protectedHeader&&(f.protected=i.decode(a)),f}}}}),Xn=g({"../node_modules/jose/dist/browser/jws/compact/sign.js"(){zn(),Ln=class{constructor(t){this._flattened=new Un(t)}setProtectedHeader(t){return this._flattened.setProtectedHeader(t),this}async sign(t,e){const n=await this._flattened.sign(t,e);if(void 0===n.payload)throw new TypeError("use the flattened module for creating JWS with b64: false");return`${n.protected}.${n.payload}.${n.signature}`}}}}),Yn=g({"../node_modules/jose/dist/browser/jws/general/sign.js"(){zn(),it(),Bn=class{constructor(t,e,n){this.parent=t,this.key=e,this.options=n}setProtectedHeader(t){if(this.protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this.protectedHeader=t,this}setUnprotectedHeader(t){if(this.unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this.unprotectedHeader=t,this}addSignature(...t){return this.parent.addSignature(...t)}sign(...t){return this.parent.sign(...t)}done(){return this.parent}},Jn=class{constructor(t){this._signatures=[],this._payload=t}addSignature(t,e){const n=new Bn(this,t,e);return this._signatures.push(n),n}async sign(){if(!this._signatures.length)throw new W("at least one signature must be added");const t={signatures:[],payload:""};for(let e=0;e<this._signatures.length;e++){const n=this._signatures[e],r=new Un(this._payload);r.setProtectedHeader(n.protectedHeader),r.setUnprotectedHeader(n.unprotectedHeader);const{payload:i,...o}=await r.sign(n.key,n.options);if(0===e)t.payload=i;else if(t.payload!==i)throw new W("inconsistent use of JWS Unencoded Payload Option (RFC7797)");t.signatures.push(o)}return t}}}}),Qn=g({"../node_modules/jose/dist/browser/jwt/produce.js"(){Rn(),Bt(),Tn(),Kn=class{constructor(t){if(!Dt(t))throw new TypeError("JWT Claims Set MUST be an object");this._payload=t}setIssuer(t){return this._payload={...this._payload,iss:t},this}setSubject(t){return this._payload={...this._payload,sub:t},this}setAudience(t){return this._payload={...this._payload,aud:t},this}setJti(t){return this._payload={...this._payload,jti:t},this}setNotBefore(t){return this._payload="number"==typeof t?{...this._payload,nbf:t}:{...this._payload,nbf:Fn(new Date)+xn(t)},this}setExpirationTime(t){return this._payload="number"==typeof t?{...this._payload,exp:t}:{...this._payload,exp:Fn(new Date)+xn(t)},this}setIssuedAt(t){return this._payload=void 0===t?{...this._payload,iat:Fn(new Date)}:{...this._payload,iat:t},this}}}}),Zn=g({"../node_modules/jose/dist/browser/jwt/sign.js"(){Xn(),it(),Z(),Qn(),Hn=class extends Kn{setProtectedHeader(t){return this._protectedHeader=t,this}async sign(t,e){var n;const i=new Ln(r.encode(JSON.stringify(this._payload)));if(i.setProtectedHeader(this._protectedHeader),Array.isArray(null===(n=this._protectedHeader)||void 0===n?void 0:n.crit)&&this._protectedHeader.crit.includes("b64")&&!1===this._protectedHeader.b64)throw new q("JWTs MUST NOT use unencoded payload");return i.sign(t,e)}}}}),tr=g({"../node_modules/jose/dist/browser/jwt/encrypt.js"(){Vn(),Z(),Qn(),$n=class extends Kn{setProtectedHeader(t){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=t,this}setKeyManagementParameters(t){if(this._keyManagementParameters)throw new TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=t,this}setContentEncryptionKey(t){if(this._cek)throw new TypeError("setContentEncryptionKey can only be called once");return this._cek=t,this}setInitializationVector(t){if(this._iv)throw new TypeError("setInitializationVector can only be called once");return this._iv=t,this}replicateIssuerAsHeader(){return this._replicateIssuerAsHeader=!0,this}replicateSubjectAsHeader(){return this._replicateSubjectAsHeader=!0,this}replicateAudienceAsHeader(){return this._replicateAudienceAsHeader=!0,this}async encrypt(t,e){const n=new Dn(r.encode(JSON.stringify(this._payload)));return this._replicateIssuerAsHeader&&(this._protectedHeader={...this._protectedHeader,iss:this._payload.iss}),this._replicateSubjectAsHeader&&(this._protectedHeader={...this._protectedHeader,sub:this._payload.sub}),this._replicateAudienceAsHeader&&(this._protectedHeader={...this._protectedHeader,aud:this._payload.aud}),n.setProtectedHeader(this._protectedHeader),this._iv&&n.setInitializationVector(this._iv),this._cek&&n.setContentEncryptionKey(this._cek),this._keyManagementParameters&&n.setKeyManagementParameters(this._keyManagementParameters),n.encrypt(t,e)}}}});async function er(t,e){if(!Dt(t))throw new TypeError("JWK must be an object");if(null!=e||(e="sha256"),"sha256"!==e&&"sha384"!==e&&"sha512"!==e)throw new TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');let i;switch(t.kty){case"EC":Wn(t.crv,'"crv" (Curve) Parameter'),Wn(t.x,'"x" (X Coordinate) Parameter'),Wn(t.y,'"y" (Y Coordinate) Parameter'),i={crv:t.crv,kty:t.kty,x:t.x,y:t.y};break;case"OKP":Wn(t.crv,'"crv" (Subtype of Key Pair) Parameter'),Wn(t.x,'"x" (Public Key) Parameter'),i={crv:t.crv,kty:t.kty,x:t.x};break;case"RSA":Wn(t.e,'"e" (Exponent) Parameter'),Wn(t.n,'"n" (Modulus) Parameter'),i={e:t.e,kty:t.kty,n:t.n};break;case"oct":Wn(t.k,'"k" (Key Value) Parameter'),i={k:t.k,kty:t.kty};break;default:throw new K('"kty" (Key Type) Parameter missing or unsupported')}const o=r.encode(JSON.stringify(i));return P(await n(e,o))}async function nr(t,e){null!=e||(e="sha256");const n=await er(t,e);return`urn:ietf:params:oauth:jwk-thumbprint:sha-${e.slice(-3)}:${n}`}var rr=g({"../node_modules/jose/dist/browser/jwk/thumbprint.js"(){j(),tt(),it(),Z(),Bt(),Wn=(t,e)=>{if("string"!=typeof t||!t)throw new V(`${e} missing or invalid`)}}});async function ir(t,e){const n={...t,...e.header};if(!Dt(n.jwk))throw new W('"jwk" (JSON Web Key) Header Parameter must be a JSON object');const r=await Ae({...n.jwk,ext:!0},n.alg,!0);if(r instanceof Uint8Array||"public"!==r.type)throw new W('"jwk" (JSON Web Key) Header Parameter must be a public key');return r}var or,sr=g({"../node_modules/jose/dist/browser/jwk/embedded.js"(){Oe(),Bt(),it()}});function ar(t){return t&&"object"==typeof t&&Array.isArray(t.keys)&&t.keys.every(ur)}function ur(t){return Dt(t)}function cr(t){return or.prototype.getKey.bind(new or(t))}var hr,fr,lr=g({"../node_modules/jose/dist/browser/jwks/local.js"(){Oe(),it(),Bt(),or=class{constructor(t){if(this._cached=new WeakMap,!ar(t))throw new G("JSON Web Key Set malformed");var e;this._jwks=(e=t,"function"==typeof structuredClone?structuredClone(e):JSON.parse(JSON.stringify(e)))}async getKey(t,e){const{alg:n,kid:r}={...t,...e.header},i=function(t){switch("string"==typeof t&&t.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";default:throw new K('Unsupported "alg" value for a JSON Web Key Set')}}(n),o=this._jwks.keys.filter((t=>{let e=i===t.kty;if(e&&"string"==typeof r&&(e=r===t.kid),e&&"string"==typeof t.alg&&(e=n===t.alg),e&&"string"==typeof t.use&&(e="sig"===t.use),e&&Array.isArray(t.key_ops)&&(e=t.key_ops.includes("verify")),e&&"EdDSA"===n&&(e="Ed25519"===t.crv||"Ed448"===t.crv),e)switch(n){case"ES256":e="P-256"===t.crv;break;case"ES256K":e="secp256k1"===t.crv;break;case"ES384":e="P-384"===t.crv;break;case"ES512":e="P-521"===t.crv}return e})),{0:s,length:a}=o;if(0===a)throw new z;if(1!==a)throw new X;const u=this._cached.get(s)||this._cached.set(s,{}).get(s);if(void 0===u[n]){const t=await Ae({...s,ext:!0},n);if(t instanceof Uint8Array||"public"!==t.type)throw new G("JSON Web Key Set members must be public keys");u[n]=t}return u[n]}}}}),dr=g({"../node_modules/jose/dist/browser/runtime/fetch_jwks.js"(){it(),hr=async(t,e,n)=>{let r,i,o=!1;"function"==typeof AbortController&&(r=new AbortController,i=setTimeout((()=>{o=!0,r.abort()}),e));const s=await fetch(t.href,{signal:r?r.signal:void 0,redirect:"manual",headers:n.headers}).catch((t=>{if(o)throw new Y;throw t}));if(void 0!==i&&clearTimeout(i),200!==s.status)throw new U("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await s.json()}catch(t){throw new U("Failed to parse the JSON Web Key Set HTTP response as JSON")}}}});function vr(t,e){return fr.prototype.getKey.bind(new fr(t,e))}var pr,wr,yr,mr=g({"../node_modules/jose/dist/browser/jwks/remote.js"(){dr(),pt(),it(),lr(),fr=class extends or{constructor(t,e){if(super({keys:[]}),this._jwks=void 0,!(t instanceof URL))throw new TypeError("url must be an instance of URL");this._url=new URL(t.href),this._options={agent:null==e?void 0:e.agent,headers:null==e?void 0:e.headers},this._timeoutDuration="number"==typeof(null==e?void 0:e.timeoutDuration)?null==e?void 0:e.timeoutDuration:5e3,this._cooldownDuration="number"==typeof(null==e?void 0:e.cooldownDuration)?null==e?void 0:e.cooldownDuration:3e4,this._cacheMaxAge="number"==typeof(null==e?void 0:e.cacheMaxAge)?null==e?void 0:e.cacheMaxAge:6e5}coolingDown(){return"number"==typeof this._jwksTimestamp&&Date.now()<this._jwksTimestamp+this._cooldownDuration}fresh(){return"number"==typeof this._jwksTimestamp&&Date.now()<this._jwksTimestamp+this._cacheMaxAge}async getKey(t,e){this._jwks&&this.fresh()||await this.reload();try{return await super.getKey(t,e)}catch(n){if(n instanceof z&&!1===this.coolingDown())return await this.reload(),super.getKey(t,e);throw n}}async reload(){if(this._pendingFetch&&vt())return new Promise((t=>{const e=()=>{void 0===this._pendingFetch?t():setTimeout(e,5)};e()}));this._pendingFetch||(this._pendingFetch=hr(this._url,this._timeoutDuration,this._options).then((t=>{if(!ar(t))throw new G("JSON Web Key Set malformed");this._jwks={keys:t.keys},this._jwksTimestamp=Date.now(),this._pendingFetch=void 0})).catch((t=>{throw this._pendingFetch=void 0,t}))),await this._pendingFetch}}}}),gr=g({"../node_modules/jose/dist/browser/jwt/unsecured.js"(){tt(),Z(),it(),In(),Qn(),pr=class extends Kn{encode(){return`${P(JSON.stringify({alg:"none"}))}.${P(JSON.stringify(this._payload))}.`}static decode(t,e){if("string"!=typeof t)throw new q("Unsecured JWT must be a string");const{0:n,1:r,2:o,length:s}=t.split(".");if(3!==s||""!==o)throw new q("Invalid Unsecured JWT");let a;try{if(a=JSON.parse(i.decode(M(n))),"none"!==a.alg)throw new Error}catch(t){throw new q("Invalid Unsecured JWT")}return{payload:jn(a,M(r),e),header:a}}}}}),br={};E(br,{decode:()=>yr,encode:()=>wr});var Er=g({"../node_modules/jose/dist/browser/util/base64url.js"(){tt(),wr=P,yr=M}});function Sr(t){let e;if("string"==typeof t){const n=t.split(".");3!==n.length&&5!==n.length||([e]=n)}else if("object"==typeof t&&t){if(!("protected"in t))throw new TypeError("Token does not contain a Protected Header");e=t.protected}try{if("string"!=typeof e||!e)throw new Error;const t=JSON.parse(i.decode(yr(e)));if(!Dt(t))throw new Error;return t}catch(t){throw new TypeError("Invalid Token or Protected Header formatting")}}var Fr=g({"../node_modules/jose/dist/browser/util/decode_protected_header.js"(){Er(),Z(),Bt()}});function kr(t){if("string"!=typeof t)throw new q("JWTs must use Compact JWS serialization, JWT must be a string");const{1:e,length:n}=t.split(".");if(5===n)throw new q("Only JWTs using Compact JWS serialization can be decoded");if(3!==n)throw new q("Invalid JWT");if(!e)throw new q("JWTs must contain a payload");let r,o;try{r=yr(e)}catch(t){throw new q("Failed to parse the base64url encoded payload")}try{o=JSON.parse(i.decode(r))}catch(t){throw new q("Failed to parse the decoded payload as JSON")}if(!Dt(o))throw new q("Invalid JWT Claims Set");return o}var xr=g({"../node_modules/jose/dist/browser/util/decode_jwt.js"(){Er(),Z(),Bt(),it()}});function _r(t){var e;const n=null!==(e=null==t?void 0:t.modulusLength)&&void 0!==e?e:2048;if("number"!=typeof n||n<2048)throw new K("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");return n}var Ar=g({"../node_modules/jose/dist/browser/runtime/generate.js"(){pt(),A(),it(),ot()}});async function jr(e,n){return async function(e,n){var r,i,o;let s,a;switch(e){case"PS256":case"PS384":case"PS512":s={name:"RSA-PSS",hash:`SHA-${e.slice(-3)}`,publicExponent:new Uint8Array([1,0,1]),modulusLength:_r(n)},a=["sign","verify"];break;case"RS256":case"RS384":case"RS512":s={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.slice(-3)}`,publicExponent:new Uint8Array([1,0,1]),modulusLength:_r(n)},a=["sign","verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":s={name:"RSA-OAEP",hash:`SHA-${parseInt(e.slice(-3),10)||1}`,publicExponent:new Uint8Array([1,0,1]),modulusLength:_r(n)},a=["decrypt","unwrapKey","encrypt","wrapKey"];break;case"ES256":s={name:"ECDSA",namedCurve:"P-256"},a=["sign","verify"];break;case"ES384":s={name:"ECDSA",namedCurve:"P-384"},a=["sign","verify"];break;case"ES512":s={name:"ECDSA",namedCurve:"P-521"},a=["sign","verify"];break;case vt()&&"EdDSA":switch(null==n?void 0:n.crv){case void 0:case"Ed25519":s={name:"NODE-ED25519",namedCurve:"NODE-ED25519"},a=["sign","verify"];break;default:throw new K("Invalid or unsupported crv option provided")}break;case"EdDSA":a=["sign","verify"];const t=null!==(r=null==n?void 0:n.crv)&&void 0!==r?r:"Ed25519";switch(t){case"Ed25519":case"Ed448":s={name:t};break;default:throw new K("Invalid or unsupported crv option provided")}break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{a=["deriveKey","deriveBits"];const t=null!==(i=null==n?void 0:n.crv)&&void 0!==i?i:"P-256";switch(t){case"P-256":case"P-384":case"P-521":s={name:"ECDH",namedCurve:t};break;case"X25519":case"X448":s={name:t};break;default:throw new K("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448")}break}default:throw new K('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}return t.subtle.generateKey(s,null!==(o=null==n?void 0:n.extractable)&&void 0!==o&&o,a)}(e,n)}var Cr=g({"../node_modules/jose/dist/browser/key/generate_key_pair.js"(){Ar()}});async function Rr(e,n){return async function(e,n){var r;let i,o,s;switch(e){case"HS256":case"HS384":case"HS512":i=parseInt(e.slice(-3),10),o={name:"HMAC",hash:`SHA-${i}`,length:i},s=["sign","verify"];break;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return i=parseInt(e.slice(-3),10),nt(new Uint8Array(i>>3));case"A128KW":case"A192KW":case"A256KW":i=parseInt(e.slice(1,4),10),o={name:"AES-KW",length:i},s=["wrapKey","unwrapKey"];break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":case"A128GCM":case"A192GCM":case"A256GCM":i=parseInt(e.slice(1,4),10),o={name:"AES-GCM",length:i},s=["encrypt","decrypt"];break;default:throw new K('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}return t.subtle.generateKey(o,null!==(r=null==n?void 0:n.extractable)&&void 0!==r&&r,s)}(e,n)}var Tr=g({"../node_modules/jose/dist/browser/key/generate_secret.js"(){Ar()}}),Ir={};E(Ir,{CompactEncrypt:()=>Dn,CompactSign:()=>Ln,EmbeddedJWK:()=>ir,EncryptJWT:()=>$n,FlattenedEncrypt:()=>sn,FlattenedSign:()=>Un,GeneralEncrypt:()=>un,GeneralSign:()=>Jn,SignJWT:()=>Hn,UnsecuredJWT:()=>pr,base64url:()=>br,calculateJwkThumbprint:()=>er,calculateJwkThumbprintUri:()=>nr,compactDecrypt:()=>qe,compactVerify:()=>bn,createLocalJWKSet:()=>cr,createRemoteJWKSet:()=>vr,decodeJwt:()=>kr,decodeProtectedHeader:()=>Sr,errors:()=>et,exportJWK:()=>tn,exportPKCS8:()=>Ze,exportSPKI:()=>Qe,flattenedDecrypt:()=>$e,flattenedVerify:()=>mn,generalDecrypt:()=>Ge,generalVerify:()=>Sn,generateKeyPair:()=>jr,generateSecret:()=>Rr,importJWK:()=>Ae,importPKCS8:()=>_e,importSPKI:()=>ke,importX509:()=>xe,jwtDecrypt:()=>Pn,jwtVerify:()=>On});var Or=g({"../node_modules/jose/dist/browser/index.js"(){Ve(),We(),Xe(),fn(),En(),gn(),Cn(),Nn(),qn(),Vn(),hn(),Xn(),zn(),Yn(),Zn(),tr(),rr(),sr(),lr(),mr(),gr(),nn(),Oe(),Fr(),xr(),it(),Cr(),Tr(),Er()}}),Nr=b({"../node_modules/uuid/dist/commonjs-browser/rng.js"(t){var e;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){if(!e&&!(e="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return e(n)};var n=new Uint8Array(16)}}),Pr=b({"../node_modules/uuid/dist/commonjs-browser/regex.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i}}),Dr=b({"../node_modules/uuid/dist/commonjs-browser/validate.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var e,n=(e=Pr())&&e.__esModule?e:{default:e};t.default=function(t){return"string"==typeof t&&n.default.test(t)}}}),Mr=b({"../node_modules/uuid/dist/commonjs-browser/stringify.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.unsafeStringify=i;var e,n=(e=Dr())&&e.__esModule?e:{default:e},r=[];for(let t=0;t<256;++t)r.push((t+256).toString(16).slice(1));function i(t,e=0){return(r[t[e+0]]+r[t[e+1]]+r[t[e+2]]+r[t[e+3]]+"-"+r[t[e+4]]+r[t[e+5]]+"-"+r[t[e+6]]+r[t[e+7]]+"-"+r[t[e+8]]+r[t[e+9]]+"-"+r[t[e+10]]+r[t[e+11]]+r[t[e+12]]+r[t[e+13]]+r[t[e+14]]+r[t[e+15]]).toLowerCase()}t.default=function(t,e=0){const r=i(t,e);if(!(0,n.default)(r))throw TypeError("Stringified UUID is invalid");return r}}}),Ur=b({"../node_modules/uuid/dist/commonjs-browser/v1.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var e,n,r,i=(e=Nr())&&e.__esModule?e:{default:e},o=Mr(),s=0,a=0;t.default=function(t,e,u){let c=e&&u||0;const h=e||new Array(16);let f=(t=t||{}).node||n,l=void 0!==t.clockseq?t.clockseq:r;if(null==f||null==l){const e=t.random||(t.rng||i.default)();null==f&&(f=n=[1|e[0],e[1],e[2],e[3],e[4],e[5]]),null==l&&(l=r=16383&(e[6]<<8|e[7]))}let d=void 0!==t.msecs?t.msecs:Date.now(),v=void 0!==t.nsecs?t.nsecs:a+1;const p=d-s+(v-a)/1e4;if(p<0&&void 0===t.clockseq&&(l=l+1&16383),(p<0||d>s)&&void 0===t.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");s=d,a=v,r=l,d+=122192928e5;const w=(1e4*(268435455&d)+v)%4294967296;h[c++]=w>>>24&255,h[c++]=w>>>16&255,h[c++]=w>>>8&255,h[c++]=255&w;const y=d/4294967296*1e4&268435455;h[c++]=y>>>8&255,h[c++]=255&y,h[c++]=y>>>24&15|16,h[c++]=y>>>16&255,h[c++]=l>>>8|128,h[c++]=255&l;for(let t=0;t<6;++t)h[c+t]=f[t];return e||(0,o.unsafeStringify)(h)}}}),Lr=b({"../node_modules/uuid/dist/commonjs-browser/parse.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var e,n=(e=Dr())&&e.__esModule?e:{default:e};t.default=function(t){if(!(0,n.default)(t))throw TypeError("Invalid UUID");let e;const r=new Uint8Array(16);return r[0]=(e=parseInt(t.slice(0,8),16))>>>24,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r[4]=(e=parseInt(t.slice(9,13),16))>>>8,r[5]=255&e,r[6]=(e=parseInt(t.slice(14,18),16))>>>8,r[7]=255&e,r[8]=(e=parseInt(t.slice(19,23),16))>>>8,r[9]=255&e,r[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,r[11]=e/4294967296&255,r[12]=e>>>24&255,r[13]=e>>>16&255,r[14]=e>>>8&255,r[15]=255&e,r}}}),Br=b({"../node_modules/uuid/dist/commonjs-browser/v35.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.URL=t.DNS=void 0,t.default=function(t,e,s){function a(t,i,o,a){var u;if("string"==typeof t&&(t=function(t){t=unescape(encodeURIComponent(t));const e=[];for(let n=0;n<t.length;++n)e.push(t.charCodeAt(n));return e}(t)),"string"==typeof i&&(i=(0,r.default)(i)),16!==(null===(u=i)||void 0===u?void 0:u.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+t.length);if(c.set(i),c.set(t,i.length),c=s(c),c[6]=15&c[6]|e,c[8]=63&c[8]|128,o){a=a||0;for(let t=0;t<16;++t)o[a+t]=c[t];return o}return(0,n.unsafeStringify)(c)}try{a.name=t}catch(t){}return a.DNS=i,a.URL=o,a};var e,n=Mr(),r=(e=Lr())&&e.__esModule?e:{default:e},i="6ba7b810-9dad-11d1-80b4-00c04fd430c8";t.DNS=i;var o="6ba7b811-9dad-11d1-80b4-00c04fd430c8";t.URL=o}}),Jr=b({"../node_modules/uuid/dist/commonjs-browser/md5.js"(t){function e(t){return 14+(t+64>>>9<<4)+1}function n(t,e){const n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function r(t,e,r,i,o,s){return n((a=n(n(e,t),n(i,s)))<<(u=o)|a>>>32-u,r);var a,u}function i(t,e,n,i,o,s,a){return r(e&n|~e&i,t,e,o,s,a)}function o(t,e,n,i,o,s,a){return r(e&i|n&~i,t,e,o,s,a)}function s(t,e,n,i,o,s,a){return r(e^n^i,t,e,o,s,a)}function a(t,e,n,i,o,s,a){return r(n^(e|~i),t,e,o,s,a)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=function(t){if("string"==typeof t){const e=unescape(encodeURIComponent(t));t=new Uint8Array(e.length);for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n)}return function(t){const e=[],n=32*t.length,r="0123456789abcdef";for(let i=0;i<n;i+=8){const n=t[i>>5]>>>i%32&255,o=parseInt(r.charAt(n>>>4&15)+r.charAt(15&n),16);e.push(o)}return e}(function(t,r){t[r>>5]|=128<<r%32,t[e(r)-1]=r;let u=1732584193,c=-271733879,h=-1732584194,f=271733878;for(let e=0;e<t.length;e+=16){const r=u,l=c,d=h,v=f;u=i(u,c,h,f,t[e],7,-680876936),f=i(f,u,c,h,t[e+1],12,-389564586),h=i(h,f,u,c,t[e+2],17,606105819),c=i(c,h,f,u,t[e+3],22,-1044525330),u=i(u,c,h,f,t[e+4],7,-176418897),f=i(f,u,c,h,t[e+5],12,1200080426),h=i(h,f,u,c,t[e+6],17,-1473231341),c=i(c,h,f,u,t[e+7],22,-45705983),u=i(u,c,h,f,t[e+8],7,1770035416),f=i(f,u,c,h,t[e+9],12,-1958414417),h=i(h,f,u,c,t[e+10],17,-42063),c=i(c,h,f,u,t[e+11],22,-1990404162),u=i(u,c,h,f,t[e+12],7,1804603682),f=i(f,u,c,h,t[e+13],12,-40341101),h=i(h,f,u,c,t[e+14],17,-1502002290),c=i(c,h,f,u,t[e+15],22,1236535329),u=o(u,c,h,f,t[e+1],5,-165796510),f=o(f,u,c,h,t[e+6],9,-1069501632),h=o(h,f,u,c,t[e+11],14,643717713),c=o(c,h,f,u,t[e],20,-373897302),u=o(u,c,h,f,t[e+5],5,-701558691),f=o(f,u,c,h,t[e+10],9,38016083),h=o(h,f,u,c,t[e+15],14,-660478335),c=o(c,h,f,u,t[e+4],20,-405537848),u=o(u,c,h,f,t[e+9],5,568446438),f=o(f,u,c,h,t[e+14],9,-1019803690),h=o(h,f,u,c,t[e+3],14,-187363961),c=o(c,h,f,u,t[e+8],20,1163531501),u=o(u,c,h,f,t[e+13],5,-1444681467),f=o(f,u,c,h,t[e+2],9,-51403784),h=o(h,f,u,c,t[e+7],14,1735328473),c=o(c,h,f,u,t[e+12],20,-1926607734),u=s(u,c,h,f,t[e+5],4,-378558),f=s(f,u,c,h,t[e+8],11,-2022574463),h=s(h,f,u,c,t[e+11],16,1839030562),c=s(c,h,f,u,t[e+14],23,-35309556),u=s(u,c,h,f,t[e+1],4,-1530992060),f=s(f,u,c,h,t[e+4],11,1272893353),h=s(h,f,u,c,t[e+7],16,-155497632),c=s(c,h,f,u,t[e+10],23,-1094730640),u=s(u,c,h,f,t[e+13],4,681279174),f=s(f,u,c,h,t[e],11,-358537222),h=s(h,f,u,c,t[e+3],16,-722521979),c=s(c,h,f,u,t[e+6],23,76029189),u=s(u,c,h,f,t[e+9],4,-640364487),f=s(f,u,c,h,t[e+12],11,-421815835),h=s(h,f,u,c,t[e+15],16,530742520),c=s(c,h,f,u,t[e+2],23,-995338651),u=a(u,c,h,f,t[e],6,-198630844),f=a(f,u,c,h,t[e+7],10,1126891415),h=a(h,f,u,c,t[e+14],15,-1416354905),c=a(c,h,f,u,t[e+5],21,-57434055),u=a(u,c,h,f,t[e+12],6,1700485571),f=a(f,u,c,h,t[e+3],10,-1894986606),h=a(h,f,u,c,t[e+10],15,-1051523),c=a(c,h,f,u,t[e+1],21,-2054922799),u=a(u,c,h,f,t[e+8],6,1873313359),f=a(f,u,c,h,t[e+15],10,-30611744),h=a(h,f,u,c,t[e+6],15,-1560198380),c=a(c,h,f,u,t[e+13],21,1309151649),u=a(u,c,h,f,t[e+4],6,-145523070),f=a(f,u,c,h,t[e+11],10,-1120210379),h=a(h,f,u,c,t[e+2],15,718787259),c=a(c,h,f,u,t[e+9],21,-343485551),u=n(u,r),c=n(c,l),h=n(h,d),f=n(f,v)}return[u,c,h,f]}(function(t){if(0===t.length)return[];const n=8*t.length,r=new Uint32Array(e(n));for(let e=0;e<n;e+=8)r[e>>5]|=(255&t[e/8])<<e%32;return r}(t),8*t.length))}}}),Kr=b({"../node_modules/uuid/dist/commonjs-browser/v3.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var e=r(Br()),n=r(Jr());function r(t){return t&&t.__esModule?t:{default:t}}var i=(0,e.default)("v3",48,n.default);t.default=i}}),Hr=b({"../node_modules/uuid/dist/commonjs-browser/native.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var e="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);t.default={randomUUID:e}}}),$r=b({"../node_modules/uuid/dist/commonjs-browser/v4.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var e=i(Hr()),n=i(Nr()),r=Mr();function i(t){return t&&t.__esModule?t:{default:t}}t.default=function(t,i,o){if(e.default.randomUUID&&!i&&!t)return e.default.randomUUID();const s=(t=t||{}).random||(t.rng||n.default)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,i){o=o||0;for(let t=0;t<16;++t)i[o+t]=s[t];return i}return(0,r.unsafeStringify)(s)}}}),Wr=b({"../node_modules/uuid/dist/commonjs-browser/sha1.js"(t){function e(t,e,n,r){switch(t){case 0:return e&n^~e&r;case 1:case 3:return e^n^r;case 2:return e&n^e&r^n&r}}function n(t,e){return t<<e|t>>>32-e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=function(t){const r=[1518500249,1859775393,2400959708,3395469782],i=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof t){const e=unescape(encodeURIComponent(t));t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);const o=Math.ceil((t.length/4+2)/16),s=new Array(o);for(let e=0;e<o;++e){const n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=t[64*e+4*r]<<24|t[64*e+4*r+1]<<16|t[64*e+4*r+2]<<8|t[64*e+4*r+3];s[e]=n}s[o-1][14]=8*(t.length-1)/Math.pow(2,32),s[o-1][14]=Math.floor(s[o-1][14]),s[o-1][15]=8*(t.length-1)&4294967295;for(let t=0;t<o;++t){const o=new Uint32Array(80);for(let e=0;e<16;++e)o[e]=s[t][e];for(let t=16;t<80;++t)o[t]=n(o[t-3]^o[t-8]^o[t-14]^o[t-16],1);let a=i[0],u=i[1],c=i[2],h=i[3],f=i[4];for(let t=0;t<80;++t){const i=Math.floor(t/20),s=n(a,5)+e(i,u,c,h)+f+r[i]+o[t]>>>0;f=h,h=c,c=n(u,30)>>>0,u=a,a=s}i[0]=i[0]+a>>>0,i[1]=i[1]+u>>>0,i[2]=i[2]+c>>>0,i[3]=i[3]+h>>>0,i[4]=i[4]+f>>>0}return[i[0]>>24&255,i[0]>>16&255,i[0]>>8&255,255&i[0],i[1]>>24&255,i[1]>>16&255,i[1]>>8&255,255&i[1],i[2]>>24&255,i[2]>>16&255,i[2]>>8&255,255&i[2],i[3]>>24&255,i[3]>>16&255,i[3]>>8&255,255&i[3],i[4]>>24&255,i[4]>>16&255,i[4]>>8&255,255&i[4]]}}}),qr=b({"../node_modules/uuid/dist/commonjs-browser/v5.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var e=r(Br()),n=r(Wr());function r(t){return t&&t.__esModule?t:{default:t}}var i=(0,e.default)("v5",80,n.default);t.default=i}}),Vr=b({"../node_modules/uuid/dist/commonjs-browser/nil.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default="00000000-0000-0000-0000-000000000000"}}),Gr=b({"../node_modules/uuid/dist/commonjs-browser/version.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var e,n=(e=Dr())&&e.__esModule?e:{default:e};t.default=function(t){if(!(0,n.default)(t))throw TypeError("Invalid UUID");return parseInt(t.slice(14,15),16)}}}),zr=b({"../node_modules/uuid/dist/commonjs-browser/index.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"NIL",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(t,"parse",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(t,"v1",{enumerable:!0,get:function(){return e.default}}),Object.defineProperty(t,"v3",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(t,"v4",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(t,"v5",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"validate",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(t,"version",{enumerable:!0,get:function(){return s.default}});var e=h(Ur()),n=h(Kr()),r=h($r()),i=h(qr()),o=h(Vr()),s=h(Gr()),a=h(Dr()),u=h(Mr()),c=h(Lr());function h(t){return t&&t.__esModule?t:{default:t}}}}),Xr=b({"../node_modules/@inrupt/solid-client-authn-core/dist/index.js"(t){var e,n=_(),r=(Or(),e=Ir,S(a({},"__esModule",{value:!0}),e)),i=zr(),o=["ES256","RS256"],s={ERROR:"error",LOGIN:"login",LOGOUT:"logout",NEW_REFRESH_TOKEN:"newRefreshToken",SESSION_EXPIRED:"sessionExpired",SESSION_EXTENDED:"sessionExtended",SESSION_RESTORED:"sessionRestore",TIMEOUT_SET:"timeoutSet"},u=["openid","offline_access","webid"].join(" ");async function c(t,e){const r=await n.fetch(t);if(200!==r.status)throw new Error(`Could not fetch JWKS for [${e}] at [${t}]: ${r.status} ${r.statusText}`);let i;try{i=(await r.json()).keys[0]}catch(n){throw new Error(`Malformed JWKS for [${e}] at [${t}]: ${n.message}`)}return i}function h(t){try{return new URL(t),!0}catch(t){return!1}}var f=class{constructor(t,e){this.secureStorage=t,this.insecureStorage=e}getKey(t){return`solidClientAuthenticationUser:${t}`}async getUserData(t,e){const n=await(e?this.secureStorage:this.insecureStorage).get(this.getKey(t));if(void 0===n)return{};try{return JSON.parse(n)}catch(r){throw new Error(`Data for user [${t}] in [${e?"secure":"unsecure"}] storage is corrupted - expected valid JSON, but got: ${n}`)}}async setUserData(t,e,n){await(n?this.secureStorage:this.insecureStorage).set(this.getKey(t),JSON.stringify(e))}async get(t,e){const n=await((null==e?void 0:e.secure)?this.secureStorage:this.insecureStorage).get(t);if(void 0===n&&(null==e?void 0:e.errorIfNull))throw new Error(`[${t}] is not stored`);return n}async set(t,e,n){return((null==n?void 0:n.secure)?this.secureStorage:this.insecureStorage).set(t,e)}async delete(t,e){return((null==e?void 0:e.secure)?this.secureStorage:this.insecureStorage).delete(t)}async getForUser(t,e,n){const r=await this.getUserData(t,null==n?void 0:n.secure);let i;if(r&&r[e]||(i=void 0),i=r[e],void 0===i&&(null==n?void 0:n.errorIfNull))throw new Error(`Field [${e}] for user [${t}] is not stored`);return i||void 0}async setForUser(t,e,n){let r;try{r=await this.getUserData(t,null==n?void 0:n.secure)}catch(t){r={}}await this.setUserData(t,{...r,...e},null==n?void 0:n.secure)}async deleteForUser(t,e,n){const r=await this.getUserData(t,null==n?void 0:n.secure);delete r[e],await this.setUserData(t,r,null==n?void 0:n.secure)}async deleteAllUserData(t,e){await((null==e?void 0:e.secure)?this.secureStorage:this.insecureStorage).delete(this.getKey(t))}},l=class extends Error{constructor(t){super(t)}},d=class extends Error{constructor(t){super(`[${t}] is not implemented`)}},v=class extends Error{constructor(t){super(`Invalid response from OIDC provider: missing fields ${t}`),this.missingFields=t}},p=class extends Error{constructor(t,e,n){super(t),this.error=e,this.errorDescription=n}};function w(t){const e=new URL(t);return new URL(e.pathname,e.origin).toString()}async function y(t,e,n){return new r.SignJWT({htu:w(t),htm:e.toUpperCase(),jti:i.v4()}).setProtectedHeader({alg:o[0],jwk:n.publicKey,typ:"dpop+jwt"}).setIssuedAt().sign(n.privateKey,{})}async function m(t,e,r,i,o){return t(r,await async function(t,e,r,i){if(void 0!==r)return async function(t,e,r,i){var o;const s=new n.Headers(null==i?void 0:i.headers);return s.set("Authorization",`DPoP ${e}`),s.set("DPoP",await y(t,null!==(o=null==i?void 0:i.method)&&void 0!==o?o:"get",r)),{...i,headers:s}}(t,e,r,i);const o=new n.Headers(null==i?void 0:i.headers);return o.set("Authorization",`Bearer ${e}`),{...i,headers:o}}(r.toString(),e,o,i))}var g=t=>void 0!==t?t-5>0?t-5:t:600,b="getResponse",E={get:async()=>b,set:async()=>{},delete:async()=>{},getForUser:async()=>b,setForUser:async()=>{},deleteForUser:async()=>{},deleteAllUserData:async()=>{}},F=t=>{const e=t;return{get:async t=>{if(void 0!==e[t])return"string"==typeof e[t]?e[t]:JSON.stringify(e[t])},set:async(t,n)=>{e[t]=n},delete:async t=>{delete e[t]}}};t.AggregateHandler=class{constructor(t){this.handleables=t}async getProperHandler(t){const e=await Promise.all(this.handleables.map((e=>e.canHandle(...t))));for(let t=0;t<e.length;t+=1)if(e[t])return this.handleables[t];return null}async canHandle(...t){return null!==await this.getProperHandler(t)}async handle(...t){const e=await this.getProperHandler(t);if(e)return e.handle(...t);throw new Error(`[${this.constructor.name}] cannot find a suitable handler for: ${t.map((t=>{try{return JSON.stringify(t)}catch(e){return t.toString()}})).join(", ")}`)}},t.ConfigurationError=l,t.DEFAULT_SCOPES=u,t.EVENTS=s,t.InMemoryStorage=class{constructor(){this.map={}}async get(t){return this.map[t]||void 0}async set(t,e){this.map[t]=e}async delete(t){delete this.map[t]}},t.InvalidResponseError=v,t.NotImplementedError=d,t.OidcProviderError=p,t.PREFERRED_SIGNING_ALG=o,t.REFRESH_BEFORE_EXPIRATION_SECONDS=5,t.SOLID_CLIENT_AUTHN_KEY_PREFIX="solidClientAuthn:",t.StorageUtility=f,t.StorageUtilityGetResponse=b,t.StorageUtilityMock=E,t.USER_SESSION_PREFIX="solidClientAuthenticationUser",t.buildAuthenticatedFetch=async function(t,e,n){var r;let i,o=e;const a=null==n?void 0:n.refreshOptions;if(void 0!==a){const t=async()=>{var e,r,u,c;try{const{accessToken:r,refreshToken:u,expiresIn:c}=await async function(t,e,n){var r;const i=await t.tokenRefresher.refresh(t.sessionId,t.refreshToken,e);return null==n||n.emit(s.SESSION_EXTENDED,null!==(r=i.expiresIn)&&void 0!==r?r:600),"string"==typeof i.refreshToken&&(null==n||n.emit(s.NEW_REFRESH_TOKEN,i.refreshToken)),{accessToken:i.accessToken,refreshToken:i.refreshToken,expiresIn:i.expiresIn}}(a,n.dpopKey,n.eventEmitter);o=r,void 0!==u&&(a.refreshToken=u),clearTimeout(i),i=setTimeout(t,1e3*g(c)),null===(e=n.eventEmitter)||void 0===e||e.emit(s.TIMEOUT_SET,i)}catch(t){t instanceof p&&(null===(r=null==n?void 0:n.eventEmitter)||void 0===r||r.emit(s.ERROR,t.error,t.errorDescription),null===(u=null==n?void 0:n.eventEmitter)||void 0===u||u.emit(s.SESSION_EXPIRED)),t instanceof v&&t.missingFields.includes("access_token")&&(null===(c=null==n?void 0:n.eventEmitter)||void 0===c||c.emit(s.SESSION_EXPIRED))}};i=setTimeout(t,1e3*g(n.expiresIn)),null===(r=n.eventEmitter)||void 0===r||r.emit(s.TIMEOUT_SET,i)}else if(void 0!==n&&void 0!==n.eventEmitter){const t=setTimeout((()=>{n.eventEmitter.emit(s.SESSION_EXPIRED)}),1e3*g(n.expiresIn));n.eventEmitter.emit(s.TIMEOUT_SET,t)}return async(e,r)=>{let i=await m(t,o,e,r,null==n?void 0:n.dpopKey);const s=!i.ok&&![401,403].includes(i.status);return i.ok||s||i.url!==e&&void 0!==(null==n?void 0:n.dpopKey)&&(i=await m(t,o,i.url,r,n.dpopKey)),i}},t.createDpopHeader=y,t.determineSigningAlg=function(t,e){var n;return null!==(n=e.find((e=>t.includes(e))))&&void 0!==n?n:null},t.fetchJwks=c,t.generateDpopKeyPair=async function(){const{privateKey:t,publicKey:e}=await r.generateKeyPair(o[0]),n={privateKey:t,publicKey:await r.exportJWK(e)};return[n.publicKey.alg]=o,n},t.getSessionIdFromOauthState=async function(t,e){return t.getForUser(e,"sessionId")},t.getWebidFromTokenPayload=async function(t,e,n,i){const o=await c(e,n);let s;try{const{payload:e}=await r.jwtVerify(t,await r.importJWK(o),{issuer:n,audience:i});s=e}catch(t){throw new Error(`Token verification failed: ${t.stack}`)}if("string"==typeof s.webid)return s.webid;if("string"!=typeof s.sub)throw new Error(`The token ${JSON.stringify(s)} is invalid: it has no 'webid' claim and no 'sub' claim.`);try{return new URL(s.sub),s.sub}catch(t){throw new Error(`The token has no 'webid' claim, and its 'sub' claim of [${s.sub}] is invalid as a URL - error [${t}].`)}},t.handleRegistration=async function(t,e,n,r){const i=function(t,e){return void 0===t.clientId||h(t.clientId)?e.scopesSupported.includes("webid")&&void 0!==t.clientId&&h(t.clientId)?"solid-oidc":"dynamic":"static"}(t,e);return"dynamic"===i?r.getClient({sessionId:t.sessionId,clientName:t.clientName,redirectUrl:t.redirectUrl},e):(await n.setForUser(t.sessionId,{clientId:t.clientId}),t.clientSecret&&await n.setForUser(t.sessionId,{clientSecret:t.clientSecret}),t.clientName&&await n.setForUser(t.sessionId,{clientName:t.clientName}),{clientId:t.clientId,clientSecret:t.clientSecret,clientName:t.clientName,clientType:i})},t.isSupportedTokenType=function(t){return"string"==typeof t&&["DPoP","Bearer"].includes(t)},t.loadOidcContextFromStorage=async function(t,e,n){try{const[r,i,o,s]=await Promise.all([e.getForUser(t,"issuer",{errorIfNull:!0}),e.getForUser(t,"codeVerifier"),e.getForUser(t,"redirectUrl"),e.getForUser(t,"dpop",{errorIfNull:!0})]);return await e.deleteForUser(t,"codeVerifier"),{codeVerifier:i,redirectUrl:o,issuerConfig:await n.fetchConfig(r),dpop:"true"===s}}catch(e){throw new Error(`Failed to retrieve OIDC context from storage associated with session [${t}]: ${e}`)}},t.mockStorage=F,t.mockStorageUtility=(t,e=!1)=>e?new f(F(t),F({})):new f(F({}),F(t)),t.saveSessionInfoToStorage=async function(t,e,n,i,o,s,a){void 0!==o&&await t.setForUser(e,{refreshToken:o},{secure:s}),void 0!==n&&await t.setForUser(e,{webId:n},{secure:s}),void 0!==i&&await t.setForUser(e,{isLoggedIn:i},{secure:s}),void 0!==a&&await t.setForUser(e,{publicKey:JSON.stringify(a.publicKey),privateKey:JSON.stringify(await r.exportJWK(a.privateKey))},{secure:s})}}}),Yr=b({"../node_modules/@inrupt/solid-client-authn-browser/dist/storage/StorageUtility.js"(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Xr();t.default=class extends e.StorageUtility{constructor(t,e){super(t,e)}}}}),Qr=b({"../node_modules/@inrupt/oidc-client/lib/oidc-client.min.js"(t,e){!function(n,r){if("object"==typeof t&&"object"==typeof e)e.exports=r();else if("function"==typeof define&&define.amd)define([],r);else{var i=r();for(var o in i)("object"==typeof t?t:n)[o]=i[o]}}(t,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=22)}([function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),r={debug:function(){},info:function(){},warn:function(){},error:function(){}},i=void 0,o=void 0;(e.Log=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.reset=function(){o=3,i=r},t.debug=function(){if(o>=4){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];i.debug.apply(i,Array.from(e))}},t.info=function(){if(o>=3){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];i.info.apply(i,Array.from(e))}},t.warn=function(){if(o>=2){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];i.warn.apply(i,Array.from(e))}},t.error=function(){if(o>=1){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];i.error.apply(i,Array.from(e))}},n(t,null,[{key:"NONE",get:function(){return 0}},{key:"ERROR",get:function(){return 1}},{key:"WARN",get:function(){return 2}},{key:"INFO",get:function(){return 3}},{key:"DEBUG",get:function(){return 4}},{key:"level",get:function(){return o},set:function(t){if(!(0<=t&&t<=4))throw new Error("Invalid log level");o=t}},{key:"logger",get:function(){return i},set:function(t){if(!t.debug&&t.info&&(t.debug=t.info),!(t.debug&&t.info&&t.warn&&t.error))throw new Error("Invalid logger");i=t}}]),t}()).reset()},function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),r={setInterval:function(t){function e(e,n){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t,e){return setInterval(t,e)})),clearInterval:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){return clearInterval(t)}))},i=!1,o=null;e.Global=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t._testing=function(){i=!0},t.setXMLHttpRequest=function(t){o=t},n(t,null,[{key:"location",get:function(){if(!i)return location}},{key:"localStorage",get:function(){if(!i&&"undefined"!=typeof window)return localStorage}},{key:"sessionStorage",get:function(){if(!i&&"undefined"!=typeof window)return sessionStorage}},{key:"XMLHttpRequest",get:function(){if(!i&&"undefined"!=typeof window)return o||XMLHttpRequest}},{key:"timer",get:function(){if(!i)return r}}]),t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.MetadataService=void 0;var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),i=n(0),o=n(7);function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=".well-known/openid-configuration";e.MetadataService=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.JsonService;if(s(this,t),!e)throw i.Log.error("MetadataService: No settings passed to MetadataService"),new Error("settings");this._settings=e,this._jsonService=new n(["application/jwk-set+json"])}return t.prototype.resetSigningKeys=function(){this._settings=this._settings||{},this._settings.signingKeys=void 0},t.prototype.getMetadata=function(){var t=this;return this._settings.metadata?(i.Log.debug("MetadataService.getMetadata: Returning metadata from settings"),Promise.resolve(this._settings.metadata)):this.metadataUrl?(i.Log.debug("MetadataService.getMetadata: getting metadata from",this.metadataUrl),this._jsonService.getJson(this.metadataUrl).then((function(e){return i.Log.debug("MetadataService.getMetadata: json received"),t._settings.metadata=Object.assign({},t._settings.metadataSeed||{},e),t._settings.metadata}))):(i.Log.error("MetadataService.getMetadata: No authority or metadataUrl configured on settings"),Promise.reject(new Error("No authority or metadataUrl configured on settings")))},t.prototype.getIssuer=function(){return this._getMetadataProperty("issuer")},t.prototype.getAuthorizationEndpoint=function(){return this._getMetadataProperty("authorization_endpoint")},t.prototype.getUserInfoEndpoint=function(){return this._getMetadataProperty("userinfo_endpoint")},t.prototype.getTokenEndpoint=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._getMetadataProperty("token_endpoint",t)},t.prototype.getCheckSessionIframe=function(){return this._getMetadataProperty("check_session_iframe",!0)},t.prototype.getEndSessionEndpoint=function(){return this._getMetadataProperty("end_session_endpoint",!0)},t.prototype.getRevocationEndpoint=function(){return this._getMetadataProperty("revocation_endpoint",!0)},t.prototype.getKeysEndpoint=function(){return this._getMetadataProperty("jwks_uri",!0)},t.prototype._getMetadataProperty=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return i.Log.debug("MetadataService.getMetadataProperty for: "+t),this.getMetadata().then((function(n){if(i.Log.debug("MetadataService.getMetadataProperty: metadata recieved"),void 0===n[t]){if(!0===e)return void i.Log.warn("MetadataService.getMetadataProperty: Metadata does not contain optional property "+t);throw i.Log.error("MetadataService.getMetadataProperty: Metadata does not contain property "+t),new Error("Metadata does not contain property "+t)}return n[t]}))},t.prototype.getSigningKeys=function(){var t=this;return this._settings.signingKeys?(i.Log.debug("MetadataService.getSigningKeys: Returning signingKeys from settings"),Promise.resolve(this._settings.signingKeys)):this._getMetadataProperty("jwks_uri").then((function(e){return i.Log.debug("MetadataService.getSigningKeys: jwks_uri received",e),t._jsonService.getJson(e).then((function(e){if(i.Log.debug("MetadataService.getSigningKeys: key set received",e),!e.keys)throw i.Log.error("MetadataService.getSigningKeys: Missing keys on keyset"),new Error("Missing keys on keyset");return t._settings.signingKeys=e.keys,t._settings.signingKeys}))}))},r(t,[{key:"metadataUrl",get:function(){return this._metadataUrl||(this._settings.metadataUrl?this._metadataUrl=this._settings.metadataUrl:(this._metadataUrl=this._settings.authority,this._metadataUrl&&this._metadataUrl.indexOf(a)<0&&("/"!==this._metadataUrl[this._metadataUrl.length-1]&&(this._metadataUrl+="/"),this._metadataUrl+=a))),this._metadataUrl}}]),t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.UrlUtility=void 0;var r=n(0),i=n(1);e.UrlUtility=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.addQueryParam=function(t,e,n){return t.indexOf("?")<0&&(t+="?"),"?"!==t[t.length-1]&&(t+="&"),t+=encodeURIComponent(e),(t+="=")+encodeURIComponent(n)},t.parseUrlFragment=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.Global;"string"!=typeof t&&(t=n.location.href);var o=t.lastIndexOf(e);o>=0&&(t=t.substr(o+1)),"?"===e&&(o=t.indexOf("#"))>=0&&(t=t.substr(0,o));for(var s,a={},u=/([^&=]+)=([^&]*)/g,c=0;s=u.exec(t);)if(a[decodeURIComponent(s[1])]=decodeURIComponent(s[2].replace(/\+/g," ")),c++>50)return r.Log.error("UrlUtility.parseUrlFragment: response exceeded expected number of parameters",t),{error:"Response exceeded expected number of parameters"};for(var h in a)return a;return{}},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.JoseUtil=void 0;var r,i=n(26),o=(r=n(33))&&r.__esModule?r:{default:r};e.JoseUtil=(0,o.default)({jws:i.jws,KeyUtil:i.KeyUtil,X509:i.X509,crypto:i.crypto,hextob64u:i.hextob64u,b64tohex:i.b64tohex,AllowedSigningAlgs:i.AllowedSigningAlgs})},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.OidcClientSettings=void 0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=n(0),s=n(23),a=n(6),u=n(24),c=n(2);function h(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var f=".well-known/openid-configuration",l="id_token",d="openid",v="client_secret_post";e.OidcClientSettings=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.authority,i=e.metadataUrl,o=e.metadata,f=e.signingKeys,p=e.metadataSeed,w=e.client_id,y=e.client_secret,m=e.response_type,g=void 0===m?l:m,b=e.scope,E=void 0===b?d:b,S=e.redirect_uri,F=e.post_logout_redirect_uri,k=e.client_authentication,x=void 0===k?v:k,_=e.prompt,A=e.display,j=e.max_age,C=e.ui_locales,R=e.acr_values,T=e.resource,I=e.response_mode,O=e.filterProtocolClaims,N=void 0===O||O,P=e.loadUserInfo,D=void 0===P||P,M=e.staleStateAge,U=void 0===M?900:M,L=e.clockSkew,B=void 0===L?300:L,J=e.clockService,K=void 0===J?new s.ClockService:J,H=e.userInfoJwtIssuer,$=void 0===H?"OP":H,W=e.mergeClaims,q=void 0!==W&&W,V=e.stateStore,G=void 0===V?new a.WebStorageStateStore:V,z=e.ResponseValidatorCtor,X=void 0===z?u.ResponseValidator:z,Y=e.MetadataServiceCtor,Q=void 0===Y?c.MetadataService:Y,Z=e.extraQueryParams,tt=void 0===Z?{}:Z,et=e.extraTokenParams,nt=void 0===et?{}:et;h(this,t),this._authority=n,this._metadataUrl=i,this._metadata=o,this._metadataSeed=p,this._signingKeys=f,this._client_id=w,this._client_secret=y,this._response_type=g,this._scope=E,this._redirect_uri=S,this._post_logout_redirect_uri=F,this._client_authentication=x,this._prompt=_,this._display=A,this._max_age=j,this._ui_locales=C,this._acr_values=R,this._resource=T,this._response_mode=I,this._filterProtocolClaims=!!N,this._loadUserInfo=!!D,this._staleStateAge=U,this._clockSkew=B,this._clockService=K,this._userInfoJwtIssuer=$,this._mergeClaims=!!q,this._stateStore=G,this._validator=new X(this),this._metadataService=new Q(this),this._extraQueryParams="object"===(void 0===tt?"undefined":r(tt))?tt:{},this._extraTokenParams="object"===(void 0===nt?"undefined":r(nt))?nt:{}}return t.prototype.getEpochTime=function(){return this._clockService.getEpochTime()},i(t,[{key:"client_id",get:function(){return this._client_id},set:function(t){if(this._client_id)throw o.Log.error("OidcClientSettings.set_client_id: client_id has already been assigned."),new Error("client_id has already been assigned.");this._client_id=t}},{key:"client_secret",get:function(){return this._client_secret}},{key:"response_type",get:function(){return this._response_type}},{key:"scope",get:function(){return this._scope}},{key:"redirect_uri",get:function(){return this._redirect_uri}},{key:"post_logout_redirect_uri",get:function(){return this._post_logout_redirect_uri}},{key:"client_authentication",get:function(){return this._client_authentication}},{key:"prompt",get:function(){return this._prompt}},{key:"display",get:function(){return this._display}},{key:"max_age",get:function(){return this._max_age}},{key:"ui_locales",get:function(){return this._ui_locales}},{key:"acr_values",get:function(){return this._acr_values}},{key:"resource",get:function(){return this._resource}},{key:"response_mode",get:function(){return this._response_mode}},{key:"authority",get:function(){return this._authority},set:function(t){if(this._authority)throw o.Log.error("OidcClientSettings.set_authority: authority has already been assigned."),new Error("authority has already been assigned.");this._authority=t}},{key:"metadataUrl",get:function(){return this._metadataUrl||(this._metadataUrl=this.authority,this._metadataUrl&&this._metadataUrl.indexOf(f)<0&&("/"!==this._metadataUrl[this._metadataUrl.length-1]&&(this._metadataUrl+="/"),this._metadataUrl+=f)),this._metadataUrl}},{key:"metadata",get:function(){return this._metadata},set:function(t){this._metadata=t}},{key:"metadataSeed",get:function(){return this._metadataSeed},set:function(t){this._metadataSeed=t}},{key:"signingKeys",get:function(){return this._signingKeys},set:function(t){this._signingKeys=t}},{key:"filterProtocolClaims",get:function(){return this._filterProtocolClaims}},{key:"loadUserInfo",get:function(){return this._loadUserInfo}},{key:"staleStateAge",get:function(){return this._staleStateAge}},{key:"clockSkew",get:function(){return this._clockSkew}},{key:"userInfoJwtIssuer",get:function(){return this._userInfoJwtIssuer}},{key:"mergeClaims",get:function(){return this._mergeClaims}},{key:"stateStore",get:function(){return this._stateStore}},{key:"validator",get:function(){return this._validator}},{key:"metadataService",get:function(){return this._metadataService}},{key:"extraQueryParams",get:function(){return this._extraQueryParams},set:function(t){this._extraQueryParams="object"===(void 0===t?"undefined":r(t))?t:{}}},{key:"extraTokenParams",get:function(){return this._extraTokenParams},set:function(t){this._extraTokenParams="object"===(void 0===t?"undefined":r(t))?t:{}}}]),t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.WebStorageStateStore=void 0;var r=n(0),i=n(1);function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.WebStorageStateStore=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.prefix,r=void 0===n?"oidc.":n,s=e.store,a=void 0===s?i.Global.localStorage:s;o(this,t),this._store=a,this._prefix=r}return t.prototype.set=function(t,e){return r.Log.debug("WebStorageStateStore.set",t),this._store.setItem(t=this._prefix+t,e),Promise.resolve()},t.prototype.get=function(t){r.Log.debug("WebStorageStateStore.get",t);var e=this._store.getItem(t=this._prefix+t);return Promise.resolve(e)},t.prototype.remove=function(t){r.Log.debug("WebStorageStateStore.remove",t);var e=this._store.getItem(t=this._prefix+t);return this._store.removeItem(t),Promise.resolve(e)},t.prototype.getAllKeys=function(){r.Log.debug("WebStorageStateStore.getAllKeys");for(var t=[],e=0;e<this._store.length;e++){var n=this._store.key(e);0===n.indexOf(this._prefix)&&t.push(n.substr(this._prefix.length))}return Promise.resolve(t)},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.JsonService=void 0;var r=n(0),i=n(1);function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.JsonService=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i.Global.XMLHttpRequest,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;o(this,t),this._contentTypes=e&&Array.isArray(e)?e.slice():[],this._contentTypes.push("application/json"),r&&this._contentTypes.push("application/jwt"),this._XMLHttpRequest=n,this._jwtHandler=r}return t.prototype.getJson=function(t,e){var n=this;if(!t)throw r.Log.error("JsonService.getJson: No url passed"),new Error("url");return r.Log.debug("JsonService.getJson, url: ",t),new Promise((function(i,o){var s=new n._XMLHttpRequest;s.open("GET",t);var a=n._contentTypes,u=n._jwtHandler;s.onload=function(){if(r.Log.debug("JsonService.getJson: HTTP response received, status",s.status),200===s.status){var e=s.getResponseHeader("Content-Type");if(e){var n=a.find((function(t){if(e.startsWith(t))return!0}));if("application/jwt"==n)return void u(s).then(i,o);if(n)try{return void i(JSON.parse(s.responseText))}catch(t){return r.Log.error("JsonService.getJson: Error parsing JSON response",t.message),void o(t)}}o(Error("Invalid response Content-Type: "+e+", from URL: "+t))}else o(Error(s.statusText+" ("+s.status+")"))},s.onerror=function(){r.Log.error("JsonService.getJson: network error"),o(Error("Network Error"))},e&&(r.Log.debug("JsonService.getJson: token passed, setting Authorization header"),s.setRequestHeader("Authorization","Bearer "+e)),s.send()}))},t.prototype.postForm=function(t,e,n){var i=this;if(!t)throw r.Log.error("JsonService.postForm: No url passed"),new Error("url");return r.Log.debug("JsonService.postForm, url: ",t),new Promise((function(o,s){var a=new i._XMLHttpRequest;a.open("POST",t);var u=i._contentTypes;a.onload=function(){if(r.Log.debug("JsonService.postForm: HTTP response received, status",a.status),200!==a.status){if(400===a.status&&(n=a.getResponseHeader("Content-Type"))&&u.find((function(t){if(n.startsWith(t))return!0})))try{var e=JSON.parse(a.responseText);if(e&&e.error)return r.Log.error("JsonService.postForm: Error from server: ",e.error),void s(new Error(e.error))}catch(t){return r.Log.error("JsonService.postForm: Error parsing JSON response",t.message),void s(t)}s(Error(a.statusText+" ("+a.status+")"))}else{var n;if((n=a.getResponseHeader("Content-Type"))&&u.find((function(t){if(n.startsWith(t))return!0})))try{return void o(JSON.parse(a.responseText))}catch(t){return r.Log.error("JsonService.postForm: Error parsing JSON response",t.message),void s(t)}s(Error("Invalid response Content-Type: "+n+", from URL: "+t))}},a.onerror=function(){r.Log.error("JsonService.postForm: network error"),s(Error("Network Error"))};var c="";for(var h in e){var f=e[h];f&&(c.length>0&&(c+="&"),c+=encodeURIComponent(h),c+="=",c+=encodeURIComponent(f))}a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),void 0!==n&&a.setRequestHeader("Authorization","Basic "+btoa(n)),a.send(c)}))},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.SigninRequest=void 0;var r=n(0),i=n(3),o=n(13);e.SigninRequest=function(){function t(e){var n=e.url,s=e.client_id,a=e.redirect_uri,u=e.response_type,c=e.scope,h=e.authority,f=e.data,l=e.prompt,d=e.display,v=e.max_age,p=e.ui_locales,w=e.id_token_hint,y=e.login_hint,m=e.acr_values,g=e.resource,b=e.response_mode,E=e.request,S=e.request_uri,F=e.extraQueryParams,k=e.request_type,x=e.client_secret,_=e.extraTokenParams,A=e.skipUserInfo;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!n)throw r.Log.error("SigninRequest.ctor: No url passed"),new Error("url");if(!s)throw r.Log.error("SigninRequest.ctor: No client_id passed"),new Error("client_id");if(!a)throw r.Log.error("SigninRequest.ctor: No redirect_uri passed"),new Error("redirect_uri");if(!u)throw r.Log.error("SigninRequest.ctor: No response_type passed"),new Error("response_type");if(!c)throw r.Log.error("SigninRequest.ctor: No scope passed"),new Error("scope");if(!h)throw r.Log.error("SigninRequest.ctor: No authority passed"),new Error("authority");var j=t.isOidc(u),C=t.isCode(u);b||(b=t.isCode(u)?"query":null),this.state=new o.SigninState({nonce:j,data:f,client_id:s,authority:h,redirect_uri:a,code_verifier:C,request_type:k,response_mode:b,client_secret:x,scope:c,extraTokenParams:_,skipUserInfo:A}),n=i.UrlUtility.addQueryParam(n,"client_id",s),n=i.UrlUtility.addQueryParam(n,"redirect_uri",a),n=i.UrlUtility.addQueryParam(n,"response_type",u),n=i.UrlUtility.addQueryParam(n,"scope",c),n=i.UrlUtility.addQueryParam(n,"state",this.state.id),j&&(n=i.UrlUtility.addQueryParam(n,"nonce",this.state.nonce)),C&&(n=i.UrlUtility.addQueryParam(n,"code_challenge",this.state.code_challenge),n=i.UrlUtility.addQueryParam(n,"code_challenge_method","S256"));var R={prompt:l,display:d,max_age:v,ui_locales:p,id_token_hint:w,login_hint:y,acr_values:m,resource:g,request:E,request_uri:S,response_mode:b};for(var T in R)R[T]&&(n=i.UrlUtility.addQueryParam(n,T,R[T]));for(var I in F)n=i.UrlUtility.addQueryParam(n,I,F[I]);this.url=n}return t.isOidc=function(t){return!!t.split(/\s+/g).filter((function(t){return"id_token"===t}))[0]},t.isOAuth=function(t){return!!t.split(/\s+/g).filter((function(t){return"token"===t}))[0]},t.isCode=function(t){return!!t.split(/\s+/g).filter((function(t){return"code"===t}))[0]},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.State=void 0;var r,i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=n(0),s=(r=n(14))&&r.__esModule?r:{default:r};function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.State=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.id,r=e.data,i=e.created,o=e.request_type;a(this,t),this._id=n||(0,s.default)(),this._data=r,this._created="number"==typeof i&&i>0?i:parseInt(Date.now()/1e3),this._request_type=o}return t.prototype.toStorageString=function(){return o.Log.debug("State.toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type})},t.fromStorageString=function(e){return o.Log.debug("State.fromStorageString"),new t(JSON.parse(e))},t.clearStaleState=function(e,n){var r=Date.now()/1e3-n;return e.getAllKeys().then((function(n){o.Log.debug("State.clearStaleState: got keys",n);for(var i=[],s=function(s){var a=n[s];u=e.get(a).then((function(n){var i=!1;if(n)try{var s=t.fromStorageString(n);o.Log.debug("State.clearStaleState: got item from key: ",a,s.created),s.created<=r&&(i=!0)}catch(t){o.Log.error("State.clearStaleState: Error parsing state for key",a,t.message),i=!0}else o.Log.debug("State.clearStaleState: no item in storage for key: ",a),i=!0;if(i)return o.Log.debug("State.clearStaleState: removed item for key: ",a),e.remove(a)})),i.push(u)},a=0;a<n.length;a++){var u;s(a)}return o.Log.debug("State.clearStaleState: waiting on promise count:",i.length),Promise.all(i)}))},i(t,[{key:"id",get:function(){return this._id}},{key:"data",get:function(){return this._data}},{key:"created",get:function(){return this._created}},{key:"request_type",get:function(){return this._request_type}}]),t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.OidcClient=void 0;var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),i=n(0),o=n(5),s=n(12),a=n(8),u=n(34),c=n(35),h=n(36),f=n(13),l=n(9);function d(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.OidcClient=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};d(this,t),this._settings=e instanceof o.OidcClientSettings?e:new o.OidcClientSettings(e)}return t.prototype.createSigninRequest=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.response_type,r=e.scope,o=e.redirect_uri,s=e.data,u=e.state,c=e.prompt,h=e.display,f=e.max_age,l=e.ui_locales,d=e.id_token_hint,v=e.login_hint,p=e.acr_values,w=e.resource,y=e.request,m=e.request_uri,g=e.response_mode,b=e.extraQueryParams,E=e.extraTokenParams,S=e.request_type,F=e.skipUserInfo,k=arguments[1];i.Log.debug("OidcClient.createSigninRequest");var x=this._settings.client_id;r=r||this._settings.scope,o=o||this._settings.redirect_uri,c=c||this._settings.prompt,h=h||this._settings.display,f=f||this._settings.max_age,l=l||this._settings.ui_locales,p=p||this._settings.acr_values,w=w||this._settings.resource,g=g||this._settings.response_mode,b=b||this._settings.extraQueryParams,E=E||this._settings.extraTokenParams;var _=this._settings.authority;return a.SigninRequest.isCode(n=n||this._settings.response_type)&&"code"!==n?Promise.reject(new Error("OpenID Connect hybrid flow is not supported")):this._metadataService.getAuthorizationEndpoint().then((function(e){i.Log.debug("OidcClient.createSigninRequest: Received authorization endpoint",e);var A=new a.SigninRequest({url:e,client_id:x,redirect_uri:o,response_type:n,scope:r,data:s||u,authority:_,prompt:c,display:h,max_age:f,ui_locales:l,id_token_hint:d,login_hint:v,acr_values:p,resource:w,request:y,request_uri:m,extraQueryParams:b,extraTokenParams:E,request_type:S,response_mode:g,client_secret:t._settings.client_secret,skipUserInfo:F}),j=A.state;return(k=k||t._stateStore).set(j.id,j.toStorageString()).then((function(){return A}))}))},t.prototype.readSigninResponseState=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];i.Log.debug("OidcClient.readSigninResponseState");var r="query"===this._settings.response_mode||!this._settings.response_mode&&a.SigninRequest.isCode(this._settings.response_type),o=r?"?":"#",s=new u.SigninResponse(t,o);if(!s.state)return i.Log.error("OidcClient.readSigninResponseState: No state in response"),Promise.reject(new Error("No state in response"));e=e||this._stateStore;var c=n?e.remove.bind(e):e.get.bind(e);return c(s.state).then((function(t){if(!t)throw i.Log.error("OidcClient.readSigninResponseState: No matching state found in storage"),new Error("No matching state found in storage");return{state:f.SigninState.fromStorageString(t),response:s}}))},t.prototype.processSigninResponse=function(t,e){var n=this;return i.Log.debug("OidcClient.processSigninResponse"),this.readSigninResponseState(t,e,!0).then((function(t){var e=t.state,r=t.response;return i.Log.debug("OidcClient.processSigninResponse: Received state from storage; validating response"),n._validator.validateSigninResponse(e,r)}))},t.prototype.createSignoutRequest=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.id_token_hint,r=e.data,o=e.state,s=e.post_logout_redirect_uri,a=e.extraQueryParams,u=e.request_type,h=arguments[1];return i.Log.debug("OidcClient.createSignoutRequest"),s=s||this._settings.post_logout_redirect_uri,a=a||this._settings.extraQueryParams,this._metadataService.getEndSessionEndpoint().then((function(e){if(!e)throw i.Log.error("OidcClient.createSignoutRequest: No end session endpoint url returned"),new Error("no end session endpoint");i.Log.debug("OidcClient.createSignoutRequest: Received end session endpoint",e);var f=new c.SignoutRequest({url:e,id_token_hint:n,post_logout_redirect_uri:s,data:r||o,extraQueryParams:a,request_type:u}),l=f.state;return l&&(i.Log.debug("OidcClient.createSignoutRequest: Signout request has state to persist"),(h=h||t._stateStore).set(l.id,l.toStorageString())),f}))},t.prototype.readSignoutResponseState=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];i.Log.debug("OidcClient.readSignoutResponseState");var r=new h.SignoutResponse(t);if(!r.state)return i.Log.debug("OidcClient.readSignoutResponseState: No state in response"),r.error?(i.Log.warn("OidcClient.readSignoutResponseState: Response was error: ",r.error),Promise.reject(new s.ErrorResponse(r))):Promise.resolve({state:void 0,response:r});var o=r.state;e=e||this._stateStore;var a=n?e.remove.bind(e):e.get.bind(e);return a(o).then((function(t){if(!t)throw i.Log.error("OidcClient.readSignoutResponseState: No matching state found in storage"),new Error("No matching state found in storage");return{state:l.State.fromStorageString(t),response:r}}))},t.prototype.processSignoutResponse=function(t,e){var n=this;return i.Log.debug("OidcClient.processSignoutResponse"),this.readSignoutResponseState(t,e,!0).then((function(t){var e=t.state,r=t.response;return e?(i.Log.debug("OidcClient.processSignoutResponse: Received state from storage; validating response"),n._validator.validateSignoutResponse(e,r)):(i.Log.debug("OidcClient.processSignoutResponse: No state from storage; skipping validating response"),r)}))},t.prototype.clearStaleState=function(t){return i.Log.debug("OidcClient.clearStaleState"),l.State.clearStaleState(t=t||this._stateStore,this.settings.staleStateAge)},r(t,[{key:"_stateStore",get:function(){return this.settings.stateStore}},{key:"_validator",get:function(){return this.settings.validator}},{key:"_metadataService",get:function(){return this.settings.metadataService}},{key:"settings",get:function(){return this._settings}},{key:"metadataService",get:function(){return this._metadataService}}]),t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.TokenClient=void 0;var r=n(7),i=n(2),o=n(0);function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.TokenClient=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.JsonService,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.MetadataService;if(s(this,t),!e)throw o.Log.error("TokenClient.ctor: No settings passed"),new Error("settings");this._settings=e,this._jsonService=new n,this._metadataService=new a(this._settings)}return t.prototype.exchangeCode=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=Object.assign({},e)).grant_type=e.grant_type||"authorization_code",e.client_id=e.client_id||this._settings.client_id,e.client_secret=e.client_secret||this._settings.client_secret,e.redirect_uri=e.redirect_uri||this._settings.redirect_uri;var n=void 0,r=e._client_authentication||this._settings._client_authentication;return delete e._client_authentication,e.code?e.redirect_uri?e.code_verifier?e.client_id?e.client_secret||"client_secret_basic"!=r?("client_secret_basic"==r&&(n=e.client_id+":"+e.client_secret,delete e.client_id,delete e.client_secret),this._metadataService.getTokenEndpoint(!1).then((function(r){return o.Log.debug("TokenClient.exchangeCode: Received token endpoint"),t._jsonService.postForm(r,e,n).then((function(t){return o.Log.debug("TokenClient.exchangeCode: response received"),t}))}))):(o.Log.error("TokenClient.exchangeCode: No client_secret passed"),Promise.reject(new Error("A client_secret is required"))):(o.Log.error("TokenClient.exchangeCode: No client_id passed"),Promise.reject(new Error("A client_id is required"))):(o.Log.error("TokenClient.exchangeCode: No code_verifier passed"),Promise.reject(new Error("A code_verifier is required"))):(o.Log.error("TokenClient.exchangeCode: No redirect_uri passed"),Promise.reject(new Error("A redirect_uri is required"))):(o.Log.error("TokenClient.exchangeCode: No code passed"),Promise.reject(new Error("A code is required")))},t.prototype.exchangeRefreshToken=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=Object.assign({},e)).grant_type=e.grant_type||"refresh_token",e.client_id=e.client_id||this._settings.client_id,e.client_secret=e.client_secret||this._settings.client_secret;var n=void 0,r=e._client_authentication||this._settings._client_authentication;return delete e._client_authentication,e.refresh_token?e.client_id?("client_secret_basic"==r&&(n=e.client_id+":"+e.client_secret,delete e.client_id,delete e.client_secret),this._metadataService.getTokenEndpoint(!1).then((function(r){return o.Log.debug("TokenClient.exchangeRefreshToken: Received token endpoint"),t._jsonService.postForm(r,e,n).then((function(t){return o.Log.debug("TokenClient.exchangeRefreshToken: response received"),t}))}))):(o.Log.error("TokenClient.exchangeRefreshToken: No client_id passed"),Promise.reject(new Error("A client_id is required"))):(o.Log.error("TokenClient.exchangeRefreshToken: No refresh_token passed"),Promise.reject(new Error("A refresh_token is required")))},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.ErrorResponse=void 0;var r=n(0);function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}e.ErrorResponse=function(t){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=n.error,a=n.error_description,u=n.error_uri,c=n.state,h=n.session_state;if(i(this,e),!s)throw r.Log.error("No error passed to ErrorResponse"),new Error("error");var f=o(this,t.call(this,a||s));return f.name="ErrorResponse",f.error=s,f.error_description=a,f.error_uri=u,f.state=c,f.session_state=h,f}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e}(Error)},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.SigninState=void 0;var r,i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=n(0),s=n(9),a=n(4),u=(r=n(14))&&r.__esModule?r:{default:r};function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}e.SigninState=function(t){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.nonce,i=n.authority,o=n.client_id,s=n.redirect_uri,f=n.code_verifier,l=n.response_mode,d=n.client_secret,v=n.scope,p=n.extraTokenParams,w=n.skipUserInfo;c(this,e);var y=h(this,t.call(this,arguments[0]));if(!0===r?y._nonce=(0,u.default)():r&&(y._nonce=r),!0===f?y._code_verifier=(0,u.default)()+(0,u.default)()+(0,u.default)():f&&(y._code_verifier=f),y.code_verifier){var m=a.JoseUtil.hashString(y.code_verifier,"SHA256");y._code_challenge=a.JoseUtil.hexToBase64Url(m)}return y._redirect_uri=s,y._authority=i,y._client_id=o,y._response_mode=l,y._client_secret=d,y._scope=v,y._extraTokenParams=p,y._skipUserInfo=w,y}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.toStorageString=function(){return o.Log.debug("SigninState.toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,nonce:this.nonce,code_verifier:this.code_verifier,redirect_uri:this.redirect_uri,authority:this.authority,client_id:this.client_id,response_mode:this.response_mode,client_secret:this.client_secret,scope:this.scope,extraTokenParams:this.extraTokenParams,skipUserInfo:this.skipUserInfo})},e.fromStorageString=function(t){return o.Log.debug("SigninState.fromStorageString"),new e(JSON.parse(t))},i(e,[{key:"nonce",get:function(){return this._nonce}},{key:"authority",get:function(){return this._authority}},{key:"client_id",get:function(){return this._client_id}},{key:"redirect_uri",get:function(){return this._redirect_uri}},{key:"code_verifier",get:function(){return this._code_verifier}},{key:"code_challenge",get:function(){return this._code_challenge}},{key:"response_mode",get:function(){return this._response_mode}},{key:"client_secret",get:function(){return this._client_secret}},{key:"scope",get:function(){return this._scope}},{key:"extraTokenParams",get:function(){return this._extraTokenParams}},{key:"skipUserInfo",get:function(){return this._skipUserInfo}}]),e}(s.State)},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){return("undefined"!=n&&null!==n&&void 0!==n.getRandomValues?r:i)().replace(/-/g,"")};var n="undefined"!=typeof window?window.crypto||window.msCrypto:null;function r(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(t){return(t^n.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)}))}function i(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(t){return(t^16*Math.random()>>t/4).toString(16)}))}t.exports=e.default},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.User=void 0;var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),i=n(0);e.User=function(){function t(e){var n=e.id_token,r=e.session_state,i=e.access_token,o=e.refresh_token,s=e.token_type,a=e.scope,u=e.profile,c=e.expires_at,h=e.state;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.id_token=n,this.session_state=r,this.access_token=i,this.refresh_token=o,this.token_type=s,this.scope=a,this.profile=u,this.expires_at=c,this.state=h}return t.prototype.toStorageString=function(){return i.Log.debug("User.toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})},t.fromStorageString=function(e){return i.Log.debug("User.fromStorageString"),new t(JSON.parse(e))},r(t,[{key:"expires_in",get:function(){if(this.expires_at){var t=parseInt(Date.now()/1e3);return this.expires_at-t}},set:function(t){var e=parseInt(t);if("number"==typeof e&&e>0){var n=parseInt(Date.now()/1e3);this.expires_at=n+e}}},{key:"expired",get:function(){var t=this.expires_in;if(void 0!==t)return t<=0}},{key:"scopes",get:function(){return(this.scope||"").split(" ")}}]),t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.AccessTokenEvents=void 0;var r=n(0),i=n(46);function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.AccessTokenEvents=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.accessTokenExpiringNotificationTime,r=void 0===n?60:n,s=e.accessTokenExpiringTimer,a=void 0===s?new i.Timer("Access token expiring"):s,u=e.accessTokenExpiredTimer,c=void 0===u?new i.Timer("Access token expired"):u;o(this,t),this._accessTokenExpiringNotificationTime=r,this._accessTokenExpiring=a,this._accessTokenExpired=c}return t.prototype.load=function(t){if(t.access_token&&void 0!==t.expires_in){var e=t.expires_in;if(r.Log.debug("AccessTokenEvents.load: access token present, remaining duration:",e),e>0){var n=e-this._accessTokenExpiringNotificationTime;n<=0&&(n=1),r.Log.debug("AccessTokenEvents.load: registering expiring timer in:",n),this._accessTokenExpiring.init(n)}else r.Log.debug("AccessTokenEvents.load: canceling existing expiring timer becase we're past expiration."),this._accessTokenExpiring.cancel();var i=e+1;r.Log.debug("AccessTokenEvents.load: registering expired timer in:",i),this._accessTokenExpired.init(i)}else this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},t.prototype.unload=function(){r.Log.debug("AccessTokenEvents.unload: canceling existing access token timers"),this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},t.prototype.addAccessTokenExpiring=function(t){this._accessTokenExpiring.addHandler(t)},t.prototype.removeAccessTokenExpiring=function(t){this._accessTokenExpiring.removeHandler(t)},t.prototype.addAccessTokenExpired=function(t){this._accessTokenExpired.addHandler(t)},t.prototype.removeAccessTokenExpired=function(t){this._accessTokenExpired.removeHandler(t)},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.Event=void 0;var r=n(0);e.Event=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._name=e,this._callbacks=[]}return t.prototype.addHandler=function(t){this._callbacks.push(t)},t.prototype.removeHandler=function(t){var e=this._callbacks.findIndex((function(e){return e===t}));e>=0&&this._callbacks.splice(e,1)},t.prototype.raise=function(){r.Log.debug("Event: Raising event: "+this._name);for(var t=0;t<this._callbacks.length;t++){var e;(e=this._callbacks)[t].apply(e,arguments)}},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.SessionMonitor=void 0;var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),i=n(0),o=n(19),s=n(1);function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.SessionMonitor=function(){function t(e){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.CheckSessionIFrame,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.Global.timer;if(a(this,t),!e)throw i.Log.error("SessionMonitor.ctor: No user manager passed to SessionMonitor"),new Error("userManager");this._userManager=e,this._CheckSessionIFrameCtor=r,this._timer=u,this._userManager.events.addUserLoaded(this._start.bind(this)),this._userManager.events.addUserUnloaded(this._stop.bind(this)),Promise.resolve(this._userManager.getUser().then((function(t){t?n._start(t):n._settings.monitorAnonymousSession&&n._userManager.querySessionStatus().then((function(t){var e={session_state:t.session_state};t.sub&&t.sid&&(e.profile={sub:t.sub,sid:t.sid}),n._start(e)})).catch((function(t){i.Log.error("SessionMonitor ctor: error from querySessionStatus:",t.message)}))})).catch((function(t){i.Log.error("SessionMonitor ctor: error from getUser:",t.message)})))}return t.prototype._start=function(t){var e=this,n=t.session_state;n&&(t.profile?(this._sub=t.profile.sub,this._sid=t.profile.sid,i.Log.debug("SessionMonitor._start: session_state:",n,", sub:",this._sub)):(this._sub=void 0,this._sid=void 0,i.Log.debug("SessionMonitor._start: session_state:",n,", anonymous user")),this._checkSessionIFrame?this._checkSessionIFrame.start(n):this._metadataService.getCheckSessionIframe().then((function(t){if(t){i.Log.debug("SessionMonitor._start: Initializing check session iframe");var r=e._client_id,o=e._checkSessionInterval,s=e._stopCheckSessionOnError;e._checkSessionIFrame=new e._CheckSessionIFrameCtor(e._callback.bind(e),r,t,o,s),e._checkSessionIFrame.load().then((function(){e._checkSessionIFrame.start(n)}))}else i.Log.warn("SessionMonitor._start: No check session iframe found in the metadata")})).catch((function(t){i.Log.error("SessionMonitor._start: Error from getCheckSessionIframe:",t.message)})))},t.prototype._stop=function(){var t=this;if(this._sub=void 0,this._sid=void 0,this._checkSessionIFrame&&(i.Log.debug("SessionMonitor._stop"),this._checkSessionIFrame.stop()),this._settings.monitorAnonymousSession)var e=this._timer.setInterval((function(){t._timer.clearInterval(e),t._userManager.querySessionStatus().then((function(e){var n={session_state:e.session_state};e.sub&&e.sid&&(n.profile={sub:e.sub,sid:e.sid}),t._start(n)})).catch((function(t){i.Log.error("SessionMonitor: error from querySessionStatus:",t.message)}))}),1e3)},t.prototype._callback=function(){var t=this;this._userManager.querySessionStatus().then((function(e){var n=!0;e?e.sub===t._sub?(n=!1,t._checkSessionIFrame.start(e.session_state),e.sid===t._sid?i.Log.debug("SessionMonitor._callback: Same sub still logged in at OP, restarting check session iframe; session_state:",e.session_state):(i.Log.debug("SessionMonitor._callback: Same sub still logged in at OP, session state has changed, restarting check session iframe; session_state:",e.session_state),t._userManager.events._raiseUserSessionChanged())):i.Log.debug("SessionMonitor._callback: Different subject signed into OP:",e.sub):i.Log.debug("SessionMonitor._callback: Subject no longer signed into OP"),n&&(t._sub?(i.Log.debug("SessionMonitor._callback: SessionMonitor._callback; raising signed out event"),t._userManager.events._raiseUserSignedOut()):(i.Log.debug("SessionMonitor._callback: SessionMonitor._callback; raising signed in event"),t._userManager.events._raiseUserSignedIn()))})).catch((function(e){t._sub&&(i.Log.debug("SessionMonitor._callback: Error calling queryCurrentSigninSession; raising signed out event",e.message),t._userManager.events._raiseUserSignedOut())}))},r(t,[{key:"_settings",get:function(){return this._userManager.settings}},{key:"_metadataService",get:function(){return this._userManager.metadataService}},{key:"_client_id",get:function(){return this._settings.client_id}},{key:"_checkSessionInterval",get:function(){return this._settings.checkSessionInterval}},{key:"_stopCheckSessionOnError",get:function(){return this._settings.stopCheckSessionOnError}}]),t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.CheckSessionIFrame=void 0;var r=n(0);function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.CheckSessionIFrame=function(){function t(e,n,r,o){var s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];i(this,t),this._callback=e,this._client_id=n,this._url=r,this._interval=o||2e3,this._stopOnError=s;var a=r.indexOf("/",r.indexOf("//")+2);this._frame_origin=r.substr(0,a),this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="absolute",this._frame.style.display="none",this._frame.width=0,this._frame.height=0,this._frame.src=r}return t.prototype.load=function(){var t=this;return new Promise((function(e){t._frame.onload=function(){e()},window.document.body.appendChild(t._frame),t._boundMessageEvent=t._message.bind(t),window.addEventListener("message",t._boundMessageEvent,!1)}))},t.prototype._message=function(t){t.origin===this._frame_origin&&t.source===this._frame.contentWindow&&("error"===t.data?(r.Log.error("CheckSessionIFrame: error message from check session op iframe"),this._stopOnError&&this.stop()):"changed"===t.data?(r.Log.debug("CheckSessionIFrame: changed message from check session op iframe"),this.stop(),this._callback()):r.Log.debug("CheckSessionIFrame: "+t.data+" message from check session op iframe"))},t.prototype.start=function(t){var e=this;if(this._session_state!==t){r.Log.debug("CheckSessionIFrame.start"),this.stop(),this._session_state=t;var n=function(){e._frame.contentWindow.postMessage(e._client_id+" "+e._session_state,e._frame_origin)};n(),this._timer=window.setInterval(n,this._interval)}},t.prototype.stop=function(){this._session_state=null,this._timer&&(r.Log.debug("CheckSessionIFrame.stop"),window.clearInterval(this._timer),this._timer=null)},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.TokenRevocationClient=void 0;var r=n(0),i=n(2),o=n(1);function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a="access_token",u="refresh_token";e.TokenRevocationClient=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.Global.XMLHttpRequest,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.MetadataService;if(s(this,t),!e)throw r.Log.error("TokenRevocationClient.ctor: No settings provided"),new Error("No settings provided.");this._settings=e,this._XMLHttpRequestCtor=n,this._metadataService=new a(this._settings)}return t.prototype.revoke=function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"access_token";if(!t)throw r.Log.error("TokenRevocationClient.revoke: No token provided"),new Error("No token provided.");if(i!==a&&i!=u)throw r.Log.error("TokenRevocationClient.revoke: Invalid token type"),new Error("Invalid token type.");return this._metadataService.getRevocationEndpoint().then((function(o){if(o)return r.Log.debug("TokenRevocationClient.revoke: Revoking "+i),n._revoke(o,n._settings.client_id,n._settings.client_secret,t,i);if(e)throw r.Log.error("TokenRevocationClient.revoke: Revocation not supported"),new Error("Revocation not supported")}))},t.prototype._revoke=function(t,e,n,i,o){var s=this;return new Promise((function(a,u){var c=new s._XMLHttpRequestCtor;c.open("POST",t),c.onload=function(){r.Log.debug("TokenRevocationClient.revoke: HTTP response received, status",c.status),200===c.status?a():u(Error(c.statusText+" ("+c.status+")"))},c.onerror=function(){r.Log.debug("TokenRevocationClient.revoke: Network Error."),u("Network Error")};var h="client_id="+encodeURIComponent(e);n&&(h+="&client_secret="+encodeURIComponent(n)),h+="&token_type_hint="+encodeURIComponent(o),h+="&token="+encodeURIComponent(i),c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send(h)}))},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.CordovaPopupWindow=void 0;var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),i=n(0);e.CordovaPopupWindow=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._promise=new Promise((function(t,e){n._resolve=t,n._reject=e})),this.features=e.popupWindowFeatures||"location=no,toolbar=no,zoom=no",this.target=e.popupWindowTarget||"_blank",this.redirect_uri=e.startUrl,i.Log.debug("CordovaPopupWindow.ctor: redirect_uri: "+this.redirect_uri)}return t.prototype._isInAppBrowserInstalled=function(t){return["cordova-plugin-inappbrowser","cordova-plugin-inappbrowser.inappbrowser","org.apache.cordova.inappbrowser"].some((function(e){return t.hasOwnProperty(e)}))},t.prototype.navigate=function(t){if(t&&t.url){if(!window.cordova)return this._error("cordova is undefined");var e=window.cordova.require("cordova/plugin_list").metadata;if(!1===this._isInAppBrowserInstalled(e))return this._error("InAppBrowser plugin not found");this._popup=cordova.InAppBrowser.open(t.url,this.target,this.features),this._popup?(i.Log.debug("CordovaPopupWindow.navigate: popup successfully created"),this._exitCallbackEvent=this._exitCallback.bind(this),this._loadStartCallbackEvent=this._loadStartCallback.bind(this),this._popup.addEventListener("exit",this._exitCallbackEvent,!1),this._popup.addEventListener("loadstart",this._loadStartCallbackEvent,!1)):this._error("Error opening popup window")}else this._error("No url provided");return this.promise},t.prototype._loadStartCallback=function(t){0===t.url.indexOf(this.redirect_uri)&&this._success({url:t.url})},t.prototype._exitCallback=function(t){this._error(t)},t.prototype._success=function(t){this._cleanup(),i.Log.debug("CordovaPopupWindow: Successful response from cordova popup window"),this._resolve(t)},t.prototype._error=function(t){this._cleanup(),i.Log.error(t),this._reject(new Error(t))},t.prototype.close=function(){this._cleanup()},t.prototype._cleanup=function(){this._popup&&(i.Log.debug("CordovaPopupWindow: cleaning up popup"),this._popup.removeEventListener("exit",this._exitCallbackEvent,!1),this._popup.removeEventListener("loadstart",this._loadStartCallbackEvent,!1),this._popup.close()),this._popup=null},r(t,[{key:"promise",get:function(){return this._promise}}]),t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),i=n(10),o=n(5),s=n(6),a=n(37),u=n(38),c=n(16),h=n(2),f=n(48),l=n(49),d=n(19),v=n(20),p=n(18),w=n(1),y=n(15),m=n(50);e.default={Version:m.Version,Log:r.Log,OidcClient:i.OidcClient,OidcClientSettings:o.OidcClientSettings,WebStorageStateStore:s.WebStorageStateStore,InMemoryWebStorage:a.InMemoryWebStorage,UserManager:u.UserManager,AccessTokenEvents:c.AccessTokenEvents,MetadataService:h.MetadataService,CordovaPopupNavigator:f.CordovaPopupNavigator,CordovaIFrameNavigator:l.CordovaIFrameNavigator,CheckSessionIFrame:d.CheckSessionIFrame,TokenRevocationClient:v.TokenRevocationClient,SessionMonitor:p.SessionMonitor,Global:w.Global,User:y.User},t.exports=e.default},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ClockService=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.prototype.getEpochTime=function(){return Promise.resolve(Date.now()/1e3|0)},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.ResponseValidator=void 0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=n(0),o=n(2),s=n(25),a=n(11),u=n(12),c=n(4);function h(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var f=["nonce","at_hash","iat","nbf","exp","aud","iss","c_hash"];e.ResponseValidator=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.MetadataService,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.UserInfoService,u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:c.JoseUtil,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:a.TokenClient;if(h(this,t),!e)throw i.Log.error("ResponseValidator.ctor: No settings passed to ResponseValidator"),new Error("settings");this._settings=e,this._metadataService=new n(this._settings),this._userInfoService=new r(this._settings),this._joseUtil=u,this._tokenClient=new f(this._settings)}return t.prototype.validateSigninResponse=function(t,e){var n=this;return i.Log.debug("ResponseValidator.validateSigninResponse"),this._processSigninParams(t,e).then((function(e){return i.Log.debug("ResponseValidator.validateSigninResponse: state processed"),n._validateTokens(t,e).then((function(e){return i.Log.debug("ResponseValidator.validateSigninResponse: tokens validated"),n._processClaims(t,e).then((function(t){return i.Log.debug("ResponseValidator.validateSigninResponse: claims processed"),t}))}))}))},t.prototype.validateSignoutResponse=function(t,e){return t.id!==e.state?(i.Log.error("ResponseValidator.validateSignoutResponse: State does not match"),Promise.reject(new Error("State does not match"))):(i.Log.debug("ResponseValidator.validateSignoutResponse: state validated"),e.state=t.data,e.error?(i.Log.warn("ResponseValidator.validateSignoutResponse: Response was error",e.error),Promise.reject(new u.ErrorResponse(e))):Promise.resolve(e))},t.prototype._processSigninParams=function(t,e){if(t.id!==e.state)return i.Log.error("ResponseValidator._processSigninParams: State does not match"),Promise.reject(new Error("State does not match"));if(!t.client_id)return i.Log.error("ResponseValidator._processSigninParams: No client_id on state"),Promise.reject(new Error("No client_id on state"));if(!t.authority)return i.Log.error("ResponseValidator._processSigninParams: No authority on state"),Promise.reject(new Error("No authority on state"));if(this._settings.authority){if(this._settings.authority&&this._settings.authority!==t.authority)return i.Log.error("ResponseValidator._processSigninParams: authority mismatch on settings vs. signin state"),Promise.reject(new Error("authority mismatch on settings vs. signin state"))}else this._settings.authority=t.authority;if(this._settings.client_id){if(this._settings.client_id&&this._settings.client_id!==t.client_id)return i.Log.error("ResponseValidator._processSigninParams: client_id mismatch on settings vs. signin state"),Promise.reject(new Error("client_id mismatch on settings vs. signin state"))}else this._settings.client_id=t.client_id;return i.Log.debug("ResponseValidator._processSigninParams: state validated"),e.state=t.data,e.error?(i.Log.warn("ResponseValidator._processSigninParams: Response was error",e.error),Promise.reject(new u.ErrorResponse(e))):t.nonce&&!e.id_token?(i.Log.error("ResponseValidator._processSigninParams: Expecting id_token in response"),Promise.reject(new Error("No id_token in response"))):!t.nonce&&e.id_token?(i.Log.error("ResponseValidator._processSigninParams: Not expecting id_token in response"),Promise.reject(new Error("Unexpected id_token in response"))):t.code_verifier&&!e.code?(i.Log.error("ResponseValidator._processSigninParams: Expecting code in response"),Promise.reject(new Error("No code in response"))):!t.code_verifier&&e.code?(i.Log.error("ResponseValidator._processSigninParams: Not expecting code in response"),Promise.reject(new Error("Unexpected code in response"))):(e.scope||(e.scope=t.scope),Promise.resolve(e))},t.prototype._processClaims=function(t,e){var n=this;if(e.isOpenIdConnect){if(i.Log.debug("ResponseValidator._processClaims: response is OIDC, processing claims"),e.profile=this._filterProtocolClaims(e.profile),!0!==t.skipUserInfo&&this._settings.loadUserInfo&&e.access_token)return i.Log.debug("ResponseValidator._processClaims: loading user info"),this._userInfoService.getClaims(e.access_token).then((function(t){return i.Log.debug("ResponseValidator._processClaims: user info claims received from user info endpoint"),t.sub!==e.profile.sub?(i.Log.error("ResponseValidator._processClaims: sub from user info endpoint does not match sub in id_token"),Promise.reject(new Error("sub from user info endpoint does not match sub in id_token"))):(e.profile=n._mergeClaims(e.profile,t),i.Log.debug("ResponseValidator._processClaims: user info claims received, updated profile:",e.profile),e)}));i.Log.debug("ResponseValidator._processClaims: not loading user info")}else i.Log.debug("ResponseValidator._processClaims: response is not OIDC, not processing claims");return Promise.resolve(e)},t.prototype._mergeClaims=function(t,e){var n=Object.assign({},t);for(var i in e){var o=e[i];Array.isArray(o)||(o=[o]);for(var s=0;s<o.length;s++){var a=o[s];n[i]?Array.isArray(n[i])?n[i].indexOf(a)<0&&n[i].push(a):n[i]!==a&&(n[i]="object"===(void 0===a?"undefined":r(a))&&this._settings.mergeClaims?this._mergeClaims(n[i],a):[n[i],a]):n[i]=a}}return n},t.prototype._filterProtocolClaims=function(t){i.Log.debug("ResponseValidator._filterProtocolClaims, incoming claims:",t);var e=Object.assign({},t);return this._settings._filterProtocolClaims?(f.forEach((function(t){delete e[t]})),i.Log.debug("ResponseValidator._filterProtocolClaims: protocol claims filtered",e)):i.Log.debug("ResponseValidator._filterProtocolClaims: protocol claims not filtered"),e},t.prototype._validateTokens=function(t,e){return e.code?(i.Log.debug("ResponseValidator._validateTokens: Validating code"),this._processCode(t,e)):e.id_token?e.access_token?(i.Log.debug("ResponseValidator._validateTokens: Validating id_token and access_token"),this._validateIdTokenAndAccessToken(t,e)):(i.Log.debug("ResponseValidator._validateTokens: Validating id_token"),this._validateIdToken(t,e)):(i.Log.debug("ResponseValidator._validateTokens: No code to process or id_token to validate"),Promise.resolve(e))},t.prototype._processCode=function(t,e){var n=this,o={client_id:t.client_id,client_secret:t.client_secret,code:e.code,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier};return t.extraTokenParams&&"object"===r(t.extraTokenParams)&&Object.assign(o,t.extraTokenParams),this._tokenClient.exchangeCode(o).then((function(r){for(var o in r)e[o]=r[o];return e.id_token?(i.Log.debug("ResponseValidator._processCode: token response successful, processing id_token"),n._validateIdTokenAttributes(t,e)):(i.Log.debug("ResponseValidator._processCode: token response successful, returning response"),e)}))},t.prototype._validateIdTokenAttributes=function(t,e){var n=this;return this._metadataService.getIssuer().then((function(r){var o=t.client_id,s=n._settings.clockSkew;return i.Log.debug("ResponseValidator._validateIdTokenAttributes: Validaing JWT attributes; using clock skew (in seconds) of: ",s),n._settings.getEpochTime().then((function(a){return n._joseUtil.validateJwtAttributes(e.id_token,r,o,s,a).then((function(n){return t.nonce&&t.nonce!==n.nonce?(i.Log.error("ResponseValidator._validateIdTokenAttributes: Invalid nonce in id_token"),Promise.reject(new Error("Invalid nonce in id_token"))):n.sub?(e.profile=n,e):(i.Log.error("ResponseValidator._validateIdTokenAttributes: No sub present in id_token"),Promise.reject(new Error("No sub present in id_token")))}))}))}))},t.prototype._validateIdTokenAndAccessToken=function(t,e){var n=this;return this._validateIdToken(t,e).then((function(t){return n._validateAccessToken(t)}))},t.prototype._getSigningKeyForJwt=function(t){var e=this;return this._metadataService.getSigningKeys().then((function(n){var r=t.header.kid;if(!n)return i.Log.error("ResponseValidator._validateIdToken: No signing keys from metadata"),Promise.reject(new Error("No signing keys from metadata"));i.Log.debug("ResponseValidator._validateIdToken: Received signing keys");var o=void 0;if(r)o=n.filter((function(t){return t.kid===r}))[0];else{if((n=e._filterByAlg(n,t.header.alg)).length>1)return i.Log.error("ResponseValidator._validateIdToken: No kid found in id_token and more than one key found in metadata"),Promise.reject(new Error("No kid found in id_token and more than one key found in metadata"));o=n[0]}return Promise.resolve(o)}))},t.prototype._getSigningKeyForJwtWithSingleRetry=function(t){var e=this;return this._getSigningKeyForJwt(t).then((function(n){return n?Promise.resolve(n):(e._metadataService.resetSigningKeys(),e._getSigningKeyForJwt(t))}))},t.prototype._validateIdToken=function(t,e){var n=this;if(!t.nonce)return i.Log.error("ResponseValidator._validateIdToken: No nonce on state"),Promise.reject(new Error("No nonce on state"));var r=this._joseUtil.parseJwt(e.id_token);return r&&r.header&&r.payload?t.nonce!==r.payload.nonce?(i.Log.error("ResponseValidator._validateIdToken: Invalid nonce in id_token"),Promise.reject(new Error("Invalid nonce in id_token"))):this._metadataService.getIssuer().then((function(o){return i.Log.debug("ResponseValidator._validateIdToken: Received issuer"),n._getSigningKeyForJwtWithSingleRetry(r).then((function(s){if(!s)return i.Log.error("ResponseValidator._validateIdToken: No key matching kid or alg found in signing keys"),Promise.reject(new Error("No key matching kid or alg found in signing keys"));var a=t.client_id,u=n._settings.clockSkew;return i.Log.debug("ResponseValidator._validateIdToken: Validaing JWT; using clock skew (in seconds) of: ",u),n._joseUtil.validateJwt(e.id_token,s,o,a,u).then((function(){return i.Log.debug("ResponseValidator._validateIdToken: JWT validation successful"),r.payload.sub?(e.profile=r.payload,e):(i.Log.error("ResponseValidator._validateIdToken: No sub present in id_token"),Promise.reject(new Error("No sub present in id_token")))}))}))})):(i.Log.error("ResponseValidator._validateIdToken: Failed to parse id_token",r),Promise.reject(new Error("Failed to parse id_token")))},t.prototype._filterByAlg=function(t,e){var n=null;if(e.startsWith("RS"))n="RSA";else if(e.startsWith("PS"))n="PS";else{if(!e.startsWith("ES"))return i.Log.debug("ResponseValidator._filterByAlg: alg not supported: ",e),[];n="EC"}return i.Log.debug("ResponseValidator._filterByAlg: Looking for keys that match kty: ",n),t=t.filter((function(t){return t.kty===n})),i.Log.debug("ResponseValidator._filterByAlg: Number of keys that match kty: ",n,t.length),t},t.prototype._validateAccessToken=function(t){if(!t.profile)return i.Log.error("ResponseValidator._validateAccessToken: No profile loaded from id_token"),Promise.reject(new Error("No profile loaded from id_token"));if(!t.profile.at_hash)return i.Log.error("ResponseValidator._validateAccessToken: No at_hash in id_token"),Promise.reject(new Error("No at_hash in id_token"));if(!t.id_token)return i.Log.error("ResponseValidator._validateAccessToken: No id_token"),Promise.reject(new Error("No id_token"));var e=this._joseUtil.parseJwt(t.id_token);if(!e||!e.header)return i.Log.error("ResponseValidator._validateAccessToken: Failed to parse id_token",e),Promise.reject(new Error("Failed to parse id_token"));var n=e.header.alg;if(!n||5!==n.length)return i.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",n),Promise.reject(new Error("Unsupported alg: "+n));var r=n.substr(2,3);if(!r)return i.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",n,r),Promise.reject(new Error("Unsupported alg: "+n));if(256!==(r=parseInt(r))&&384!==r&&512!==r)return i.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",n,r),Promise.reject(new Error("Unsupported alg: "+n));var o="sha"+r,s=this._joseUtil.hashString(t.access_token,o);if(!s)return i.Log.error("ResponseValidator._validateAccessToken: access_token hash failed:",o),Promise.reject(new Error("Failed to validate at_hash"));var a=s.substr(0,s.length/2),u=this._joseUtil.hexToBase64Url(a);return u!==t.profile.at_hash?(i.Log.error("ResponseValidator._validateAccessToken: Failed to validate at_hash",u,t.profile.at_hash),Promise.reject(new Error("Failed to validate at_hash"))):(i.Log.debug("ResponseValidator._validateAccessToken: success"),Promise.resolve(t))},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.UserInfoService=void 0;var r=n(7),i=n(2),o=n(0),s=n(4);function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.UserInfoService=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.JsonService,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.MetadataService,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s.JoseUtil;if(a(this,t),!e)throw o.Log.error("UserInfoService.ctor: No settings passed"),new Error("settings");this._settings=e,this._jsonService=new n(void 0,void 0,this._getClaimsFromJwt.bind(this)),this._metadataService=new u(this._settings),this._joseUtil=c}return t.prototype.getClaims=function(t){var e=this;return t?this._metadataService.getUserInfoEndpoint().then((function(n){return o.Log.debug("UserInfoService.getClaims: received userinfo url",n),e._jsonService.getJson(n,t).then((function(t){return o.Log.debug("UserInfoService.getClaims: claims received",t),t}))})):(o.Log.error("UserInfoService.getClaims: No token passed"),Promise.reject(new Error("A token is required")))},t.prototype._getClaimsFromJwt=function(t){var e=this;try{var n=this._joseUtil.parseJwt(t.responseText);if(!n||!n.header||!n.payload)return o.Log.error("UserInfoService._getClaimsFromJwt: Failed to parse JWT",n),Promise.reject(new Error("Failed to parse id_token"));var r=n.header.kid,i=void 0;switch(this._settings.userInfoJwtIssuer){case"OP":i=this._metadataService.getIssuer();break;case"ANY":i=Promise.resolve(n.payload.iss);break;default:i=Promise.resolve(this._settings.userInfoJwtIssuer)}return i.then((function(i){return o.Log.debug("UserInfoService._getClaimsFromJwt: Received issuer:"+i),e._metadataService.getSigningKeys().then((function(s){if(!s)return o.Log.error("UserInfoService._getClaimsFromJwt: No signing keys from metadata"),Promise.reject(new Error("No signing keys from metadata"));o.Log.debug("UserInfoService._getClaimsFromJwt: Received signing keys");var a=void 0;if(r)a=s.filter((function(t){return t.kid===r}))[0];else{if((s=e._filterByAlg(s,n.header.alg)).length>1)return o.Log.error("UserInfoService._getClaimsFromJwt: No kid found in id_token and more than one key found in metadata"),Promise.reject(new Error("No kid found in id_token and more than one key found in metadata"));a=s[0]}if(!a)return o.Log.error("UserInfoService._getClaimsFromJwt: No key matching kid or alg found in signing keys"),Promise.reject(new Error("No key matching kid or alg found in signing keys"));var u=e._settings.client_id,c=e._settings.clockSkew;return o.Log.debug("UserInfoService._getClaimsFromJwt: Validaing JWT; using clock skew (in seconds) of: ",c),e._joseUtil.validateJwt(t.responseText,a,i,u,c,void 0,!0).then((function(){return o.Log.debug("UserInfoService._getClaimsFromJwt: JWT validation successful"),n.payload}))}))}))}catch(t){return o.Log.error("UserInfoService._getClaimsFromJwt: Error parsing JWT response",t.message),void reject(t)}},t.prototype._filterByAlg=function(t,e){var n=null;if(e.startsWith("RS"))n="RSA";else if(e.startsWith("PS"))n="PS";else{if(!e.startsWith("ES"))return o.Log.debug("UserInfoService._filterByAlg: alg not supported: ",e),[];n="EC"}return o.Log.debug("UserInfoService._filterByAlg: Looking for keys that match kty: ",n),t=t.filter((function(t){return t.kty===n})),o.Log.debug("UserInfoService._filterByAlg: Number of keys that match kty: ",n,t.length),t},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.AllowedSigningAlgs=e.b64tohex=e.hextob64u=e.crypto=e.X509=e.KeyUtil=e.jws=void 0;var r=n(27);e.jws=r.jws,e.KeyUtil=r.KEYUTIL,e.X509=r.X509,e.crypto=r.crypto,e.hextob64u=r.hextob64u,e.b64tohex=r.b64tohex,e.AllowedSigningAlgs=["RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"]},function(t,e,n){(function(t){Object.defineProperty(e,"__esModule",{value:!0});var n,r,i,o,s,a,u,c,h,f,l,d,v,p,w,y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},m={},g=g||(n=Math,i=(r={}).lib={},o=i.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var n=new t;return e&&n.mixIn(e),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),s=i.WordArray=o.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||u).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,i=t.sigBytes;if(this.clamp(),r%4)for(var o=0;o<i;o++)e[r+o>>>2]|=(n[o>>>2]>>>24-o%4*8&255)<<24-(r+o)%4*8;else for(o=0;o<i;o+=4)e[r+o>>>2]=n[o>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,e=this.sigBytes;t[e>>>2]&=4294967295<<32-e%4*8,t.length=n.ceil(e/4)},clone:function(){var t=o.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],r=0;r<t;r+=4)e.push(4294967296*n.random()|0);return new s.init(e,t)}}),a=r.enc={},u=a.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;i<n;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new s.init(n,e/2)}},c=a.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;i<n;i++)r.push(String.fromCharCode(e[i>>>2]>>>24-i%4*8&255));return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new s.init(n,e)}},h=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(c.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return c.parse(unescape(encodeURIComponent(t)))}},f=i.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=h.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(t){var e=this._data,r=e.words,i=e.sigBytes,o=this.blockSize,a=i/(4*o),u=(a=t?n.ceil(a):n.max((0|a)-this._minBufferSize,0))*o,c=n.min(4*u,i);if(u){for(var h=0;h<u;h+=o)this._doProcessBlock(r,h);var f=r.splice(0,u);e.sigBytes-=c}return new s.init(f,c)},clone:function(){var t=o.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),i.Hasher=f.extend({cfg:o.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new l.HMAC.init(t,n).finalize(e)}}}),l=r.algo={},r);v=(d=g).lib,p=v.Base,w=v.WordArray,(d=d.x64={}).Word=p.extend({init:function(t,e){this.high=t,this.low=e}}),d.WordArray=p.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:8*t.length},toX32:function(){for(var t=this.words,e=t.length,n=[],r=0;r<e;r++){var i=t[r];n.push(i.high),n.push(i.low)}return w.create(n,this.sigBytes)},clone:function(){for(var t=p.clone.call(this),e=t.words=this.words.slice(0),n=e.length,r=0;r<n;r++)e[r]=e[r].clone();return t}}),function(){var t=g.lib.WordArray;g.enc.Base64={stringify:function(t){var e=t.words,n=t.sigBytes,r=this._map;t.clamp(),t=[];for(var i=0;i<n;i+=3)for(var o=(e[i>>>2]>>>24-i%4*8&255)<<16|(e[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|e[i+2>>>2]>>>24-(i+2)%4*8&255,s=0;4>s&&i+.75*s<n;s++)t.push(r.charAt(o>>>6*(3-s)&63));if(e=r.charAt(64))for(;t.length%4;)t.push(e);return t.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=[],o=0,s=0;s<n;s++)if(s%4){var a=r.indexOf(e.charAt(s-1))<<s%4*2,u=r.indexOf(e.charAt(s))>>>6-s%4*2;i[o>>>2]|=(a|u)<<24-o%4*8,o++}return t.create(i,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(t){for(var e=g,n=(i=e.lib).WordArray,r=i.Hasher,i=e.algo,o=[],s=[],a=function(t){return 4294967296*(t-(0|t))|0},u=2,c=0;64>c;){var h;t:{for(var f=t.sqrt(h=u),l=2;l<=f;l++)if(!(h%l)){h=!1;break t}h=!0}h&&(8>c&&(o[c]=a(t.pow(u,.5))),s[c]=a(t.pow(u,1/3)),c++),u++}var d=[];i=i.SHA256=r.extend({_doReset:function(){this._hash=new n.init(o.slice(0))},_doProcessBlock:function(t,e){for(var n=this._hash.words,r=n[0],i=n[1],o=n[2],a=n[3],u=n[4],c=n[5],h=n[6],f=n[7],l=0;64>l;l++){if(16>l)d[l]=0|t[e+l];else{var v=d[l-15],p=d[l-2];d[l]=((v<<25|v>>>7)^(v<<14|v>>>18)^v>>>3)+d[l-7]+((p<<15|p>>>17)^(p<<13|p>>>19)^p>>>10)+d[l-16]}v=f+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&c^~u&h)+s[l]+d[l],p=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&i^r&o^i&o),f=h,h=c,c=u,u=a+v|0,a=o,o=i,i=r,r=v+p|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+a|0,n[4]=n[4]+u|0,n[5]=n[5]+c|0,n[6]=n[6]+h|0,n[7]=n[7]+f|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=t.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,e.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}}),e.SHA256=r._createHelper(i),e.HmacSHA256=r._createHmacHelper(i)}(Math),function(){function t(){return r.create.apply(r,arguments)}for(var e=g,n=e.lib.Hasher,r=(o=e.x64).Word,i=o.WordArray,o=e.algo,s=[t(1116352408,3609767458),t(1899447441,602891725),t(3049323471,3964484399),t(3921009573,2173295548),t(961987163,4081628472),t(1508970993,3053834265),t(2453635748,2937671579),t(2870763221,3664609560),t(3624381080,2734883394),t(310598401,1164996542),t(607225278,1323610764),t(1426881987,3590304994),t(1925078388,4068182383),t(2162078206,991336113),t(2614888103,633803317),t(3248222580,3479774868),t(3835390401,2666613458),t(4022224774,944711139),t(264347078,2341262773),t(604807628,2007800933),t(770255983,1495990901),t(1249150122,1856431235),t(1555081692,3175218132),t(1996064986,2198950837),t(2554220882,3999719339),t(2821834349,766784016),t(2952996808,2566594879),t(3210313671,3203337956),t(3336571891,1034457026),t(3584528711,2466948901),t(113926993,3758326383),t(338241895,168717936),t(666307205,1188179964),t(773529912,1546045734),t(1294757372,1522805485),t(1396182291,2643833823),t(1695183700,2343527390),t(1986661051,1014477480),t(2177026350,1206759142),t(2456956037,344077627),t(2730485921,1290863460),t(2820302411,3158454273),t(3259730800,3505952657),t(3345764771,106217008),t(3516065817,3606008344),t(3600352804,1432725776),t(4094571909,1467031594),t(275423344,851169720),t(430227734,3100823752),t(506948616,1363258195),t(659060556,3750685593),t(883997877,3785050280),t(958139571,3318307427),t(1322822218,3812723403),t(1537002063,2003034995),t(1747873779,3602036899),t(1955562222,1575990012),t(2024104815,1125592928),t(2227730452,2716904306),t(2361852424,442776044),t(2428436474,593698344),t(2756734187,3733110249),t(3204031479,2999351573),t(3329325298,3815920427),t(3391569614,3928383900),t(3515267271,566280711),t(3940187606,3454069534),t(4118630271,4000239992),t(116418474,1914138554),t(174292421,2731055270),t(289380356,3203993006),t(460393269,320620315),t(685471733,587496836),t(852142971,1086792851),t(1017036298,365543100),t(1126000580,2618297676),t(1288033470,3409855158),t(1501505948,4234509866),t(1607167915,987167468),t(1816402316,1246189591)],a=[],u=0;80>u;u++)a[u]=t();o=o.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(t,e){for(var n=(f=this._hash.words)[0],r=f[1],i=f[2],o=f[3],u=f[4],c=f[5],h=f[6],f=f[7],l=n.high,d=n.low,v=r.high,p=r.low,w=i.high,y=i.low,m=o.high,g=o.low,b=u.high,E=u.low,S=c.high,F=c.low,k=h.high,x=h.low,_=f.high,A=f.low,j=l,C=d,R=v,T=p,I=w,O=y,N=m,P=g,D=b,M=E,U=S,L=F,B=k,J=x,K=_,H=A,$=0;80>$;$++){var W=a[$];if(16>$)var q=W.high=0|t[e+2*$],V=W.low=0|t[e+2*$+1];else{q=((V=(q=a[$-15]).high)>>>1|(G=q.low)<<31)^(V>>>8|G<<24)^V>>>7;var G=(G>>>1|V<<31)^(G>>>8|V<<24)^(G>>>7|V<<25),z=((V=(z=a[$-2]).high)>>>19|(X=z.low)<<13)^(V<<3|X>>>29)^V>>>6,X=(X>>>19|V<<13)^(X<<3|V>>>29)^(X>>>6|V<<26),Y=(V=a[$-7]).high,Q=(Z=a[$-16]).high,Z=Z.low;q=(q=(q=q+Y+((V=G+V.low)>>>0<G>>>0?1:0))+z+((V+=X)>>>0<X>>>0?1:0))+Q+((V+=Z)>>>0<Z>>>0?1:0),W.high=q,W.low=V}Y=D&U^~D&B,Z=M&L^~M&J,W=j&R^j&I^R&I;var tt=C&T^C&O^T&O,et=(G=(j>>>28|C<<4)^(j<<30|C>>>2)^(j<<25|C>>>7),z=(C>>>28|j<<4)^(C<<30|j>>>2)^(C<<25|j>>>7),(X=s[$]).high),nt=X.low;Q=K+((D>>>14|M<<18)^(D>>>18|M<<14)^(D<<23|M>>>9))+((X=H+((M>>>14|D<<18)^(M>>>18|D<<14)^(M<<23|D>>>9)))>>>0<H>>>0?1:0),K=B,H=J,B=U,J=L,U=D,L=M,D=N+(Q=(Q=(Q=Q+Y+((X+=Z)>>>0<Z>>>0?1:0))+et+((X+=nt)>>>0<nt>>>0?1:0))+q+((X+=V)>>>0<V>>>0?1:0))+((M=P+X|0)>>>0<P>>>0?1:0)|0,N=I,P=O,I=R,O=T,R=j,T=C,j=Q+(W=G+W+((V=z+tt)>>>0<z>>>0?1:0))+((C=X+V|0)>>>0<X>>>0?1:0)|0}d=n.low=d+C,n.high=l+j+(d>>>0<C>>>0?1:0),p=r.low=p+T,r.high=v+R+(p>>>0<T>>>0?1:0),y=i.low=y+O,i.high=w+I+(y>>>0<O>>>0?1:0),g=o.low=g+P,o.high=m+N+(g>>>0<P>>>0?1:0),E=u.low=E+M,u.high=b+D+(E>>>0<M>>>0?1:0),F=c.low=F+L,c.high=S+U+(F>>>0<L>>>0?1:0),x=h.low=x+J,h.high=k+B+(x>>>0<J>>>0?1:0),A=f.low=A+H,f.high=_+K+(A>>>0<H>>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;return e[r>>>5]|=128<<24-r%32,e[30+(r+128>>>10<<5)]=Math.floor(n/4294967296),e[31+(r+128>>>10<<5)]=n,t.sigBytes=4*e.length,this._process(),this._hash.toX32()},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32}),e.SHA512=n._createHelper(o),e.HmacSHA512=n._createHmacHelper(o)}(),function(){var t=g,e=(i=t.x64).Word,n=i.WordArray,r=(i=t.algo).SHA512,i=i.SHA384=r.extend({_doReset:function(){this._hash=new n.init([new e.init(3418070365,3238371032),new e.init(1654270250,914150663),new e.init(2438529370,812702999),new e.init(355462360,4144912697),new e.init(1731405415,4290775857),new e.init(2394180231,1750603025),new e.init(3675008525,1694076839),new e.init(1203062813,3204075428)])},_doFinalize:function(){var t=r._doFinalize.call(this);return t.sigBytes-=16,t}});t.SHA384=r._createHelper(i),t.HmacSHA384=r._createHmacHelper(i)}();var b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function E(t){var e,n,r="";for(e=0;e+3<=t.length;e+=3)n=parseInt(t.substring(e,e+3),16),r+=b.charAt(n>>6)+b.charAt(63&n);for(e+1==t.length?(n=parseInt(t.substring(e,e+1),16),r+=b.charAt(n<<2)):e+2==t.length&&(n=parseInt(t.substring(e,e+2),16),r+=b.charAt(n>>2)+b.charAt((3&n)<<4));(3&r.length)>0;)r+="=";return r}function S(t){var e,n,r,i="",o=0;for(e=0;e<t.length&&"="!=t.charAt(e);++e)(r=b.indexOf(t.charAt(e)))<0||(0==o?(i+=C(r>>2),n=3&r,o=1):1==o?(i+=C(n<<2|r>>4),n=15&r,o=2):2==o?(i+=C(n),i+=C(r>>2),n=3&r,o=3):(i+=C(n<<2|r>>4),i+=C(15&r),o=0));return 1==o&&(i+=C(n<<2)),i}function F(t){var e,n=S(t),r=new Array;for(e=0;2*e<n.length;++e)r[e]=parseInt(n.substring(2*e,2*e+2),16);return r}function k(t,e,n){null!=t&&("number"==typeof t?this.fromNumber(t,e,n):this.fromString(t,null==e&&"string"!=typeof t?256:e))}function x(){return new k(null)}k.prototype.am=function(t,e,n,r,i,o){for(;--o>=0;){var s=e*this[t++]+n[r]+i;i=Math.floor(s/67108864),n[r++]=67108863&s}return i},k.prototype.DB=26,k.prototype.DM=67108863,k.prototype.DV=1<<26,k.prototype.FV=Math.pow(2,52),k.prototype.F1=26,k.prototype.F2=0;var _,A,j=new Array;for(_="0".charCodeAt(0),A=0;A<=9;++A)j[_++]=A;for(_="a".charCodeAt(0),A=10;A<36;++A)j[_++]=A;for(_="A".charCodeAt(0),A=10;A<36;++A)j[_++]=A;function C(t){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t)}function R(t,e){var n=j[t.charCodeAt(e)];return null==n?-1:n}function T(t){var e=x();return e.fromInt(t),e}function I(t){var e,n=1;return 0!=(e=t>>>16)&&(t=e,n+=16),0!=(e=t>>8)&&(t=e,n+=8),0!=(e=t>>4)&&(t=e,n+=4),0!=(e=t>>2)&&(t=e,n+=2),0!=(e=t>>1)&&(t=e,n+=1),n}function O(t){this.m=t}function N(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function P(t,e){return t&e}function D(t,e){return t|e}function M(t,e){return t^e}function U(t,e){return t&~e}function L(t){if(0==t)return-1;var e=0;return 0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function B(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function J(){}function K(t){return t}function H(t){this.r2=x(),this.q3=x(),k.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}O.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},O.prototype.revert=function(t){return t},O.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},O.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},O.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},N.prototype.convert=function(t){var e=x();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(k.ZERO)>0&&this.m.subTo(e,e),e},N.prototype.revert=function(t){var e=x();return t.copyTo(e),this.reduce(e),e},N.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var n=32767&t[e],r=n*this.mpl+((n*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[n=e+this.m.t]+=this.m.am(0,r,t,e,0,this.m.t);t[n]>=t.DV;)t[n]-=t.DV,t[++n]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},N.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},N.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},k.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},k.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},k.prototype.fromString=function(t,e){var n;if(16==e)n=4;else if(8==e)n=3;else if(256==e)n=8;else if(2==e)n=1;else if(32==e)n=5;else{if(4!=e)return void this.fromRadix(t,e);n=2}this.t=0,this.s=0;for(var r=t.length,i=!1,o=0;--r>=0;){var s=8==n?255&t[r]:R(t,r);s<0?"-"==t.charAt(r)&&(i=!0):(i=!1,0==o?this[this.t++]=s:o+n>this.DB?(this[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this[this.t++]=s>>this.DB-o):this[this.t-1]|=s<<o,(o+=n)>=this.DB&&(o-=this.DB))}8==n&&0!=(128&t[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),i&&k.ZERO.subTo(this,this)},k.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},k.prototype.dlShiftTo=function(t,e){var n;for(n=this.t-1;n>=0;--n)e[n+t]=this[n];for(n=t-1;n>=0;--n)e[n]=0;e.t=this.t+t,e.s=this.s},k.prototype.drShiftTo=function(t,e){for(var n=t;n<this.t;++n)e[n-t]=this[n];e.t=Math.max(this.t-t,0),e.s=this.s},k.prototype.lShiftTo=function(t,e){var n,r=t%this.DB,i=this.DB-r,o=(1<<i)-1,s=Math.floor(t/this.DB),a=this.s<<r&this.DM;for(n=this.t-1;n>=0;--n)e[n+s+1]=this[n]>>i|a,a=(this[n]&o)<<r;for(n=s-1;n>=0;--n)e[n]=0;e[s]=a,e.t=this.t+s+1,e.s=this.s,e.clamp()},k.prototype.rShiftTo=function(t,e){e.s=this.s;var n=Math.floor(t/this.DB);if(n>=this.t)e.t=0;else{var r=t%this.DB,i=this.DB-r,o=(1<<r)-1;e[0]=this[n]>>r;for(var s=n+1;s<this.t;++s)e[s-n-1]|=(this[s]&o)<<i,e[s-n]=this[s]>>r;r>0&&(e[this.t-n-1]|=(this.s&o)<<i),e.t=this.t-n,e.clamp()}},k.prototype.subTo=function(t,e){for(var n=0,r=0,i=Math.min(t.t,this.t);n<i;)r+=this[n]-t[n],e[n++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r-=t.s;n<this.t;)r+=this[n],e[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<t.t;)r-=t[n],e[n++]=r&this.DM,r>>=this.DB;r-=t.s}e.s=r<0?-1:0,r<-1?e[n++]=this.DV+r:r>0&&(e[n++]=r),e.t=n,e.clamp()},k.prototype.multiplyTo=function(t,e){var n=this.abs(),r=t.abs(),i=n.t;for(e.t=i+r.t;--i>=0;)e[i]=0;for(i=0;i<r.t;++i)e[i+n.t]=n.am(0,r[i],e,i,0,n.t);e.s=0,e.clamp(),this.s!=t.s&&k.ZERO.subTo(e,e)},k.prototype.squareTo=function(t){for(var e=this.abs(),n=t.t=2*e.t;--n>=0;)t[n]=0;for(n=0;n<e.t-1;++n){var r=e.am(n,e[n],t,2*n,0,1);(t[n+e.t]+=e.am(n+1,2*e[n],t,2*n+1,r,e.t-n-1))>=e.DV&&(t[n+e.t]-=e.DV,t[n+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(n,e[n],t,2*n,0,1)),t.s=0,t.clamp()},k.prototype.divRemTo=function(t,e,n){var r=t.abs();if(!(r.t<=0)){var i=this.abs();if(i.t<r.t)return null!=e&&e.fromInt(0),void(null!=n&&this.copyTo(n));null==n&&(n=x());var o=x(),s=this.s,a=t.s,u=this.DB-I(r[r.t-1]);u>0?(r.lShiftTo(u,o),i.lShiftTo(u,n)):(r.copyTo(o),i.copyTo(n));var c=o.t,h=o[c-1];if(0!=h){var f=h*(1<<this.F1)+(c>1?o[c-2]>>this.F2:0),l=this.FV/f,d=(1<<this.F1)/f,v=1<<this.F2,p=n.t,w=p-c,y=null==e?x():e;for(o.dlShiftTo(w,y),n.compareTo(y)>=0&&(n[n.t++]=1,n.subTo(y,n)),k.ONE.dlShiftTo(c,y),y.subTo(o,o);o.t<c;)o[o.t++]=0;for(;--w>=0;){var m=n[--p]==h?this.DM:Math.floor(n[p]*l+(n[p-1]+v)*d);if((n[p]+=o.am(0,m,n,w,0,c))<m)for(o.dlShiftTo(w,y),n.subTo(y,n);n[p]<--m;)n.subTo(y,n)}null!=e&&(n.drShiftTo(c,e),s!=a&&k.ZERO.subTo(e,e)),n.t=c,n.clamp(),u>0&&n.rShiftTo(u,n),s<0&&k.ZERO.subTo(n,n)}}},k.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},k.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},k.prototype.exp=function(t,e){if(t>4294967295||t<1)return k.ONE;var n=x(),r=x(),i=e.convert(this),o=I(t)-1;for(i.copyTo(n);--o>=0;)if(e.sqrTo(n,r),(t&1<<o)>0)e.mulTo(r,i,n);else{var s=n;n=r,r=s}return e.revert(n)},k.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var n,r=(1<<e)-1,i=!1,o="",s=this.t,a=this.DB-s*this.DB%e;if(s-- >0)for(a<this.DB&&(n=this[s]>>a)>0&&(i=!0,o=C(n));s>=0;)a<e?(n=(this[s]&(1<<a)-1)<<e-a,n|=this[--s]>>(a+=this.DB-e)):(n=this[s]>>(a-=e)&r,a<=0&&(a+=this.DB,--s)),n>0&&(i=!0),i&&(o+=C(n));return i?o:"0"},k.prototype.negate=function(){var t=x();return k.ZERO.subTo(this,t),t},k.prototype.abs=function(){return this.s<0?this.negate():this},k.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var n=this.t;if(0!=(e=n-t.t))return this.s<0?-e:e;for(;--n>=0;)if(0!=(e=this[n]-t[n]))return e;return 0},k.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+I(this[this.t-1]^this.s&this.DM)},k.prototype.mod=function(t){var e=x();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(k.ZERO)>0&&t.subTo(e,e),e},k.prototype.modPowInt=function(t,e){var n;return n=t<256||e.isEven()?new O(e):new N(e),this.exp(t,n)},k.ZERO=T(0),k.ONE=T(1),J.prototype.convert=K,J.prototype.revert=K,J.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n)},J.prototype.sqrTo=function(t,e){t.squareTo(e)},H.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=x();return t.copyTo(e),this.reduce(e),e},H.prototype.revert=function(t){return t},H.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},H.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},H.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var $,W,q,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],G=(1<<26)/V[V.length-1];function z(){this.i=0,this.j=0,this.S=new Array}function X(){!function(t){W[q++]^=255&t,W[q++]^=t>>8&255,W[q++]^=t>>16&255,W[q++]^=t>>24&255,q>=256&&(q-=256)}((new Date).getTime())}if(k.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},k.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),n=Math.pow(t,e),r=T(n),i=x(),o=x(),s="";for(this.divRemTo(r,i,o);i.signum()>0;)s=(n+o.intValue()).toString(t).substr(1)+s,i.divRemTo(r,i,o);return o.intValue().toString(t)+s},k.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var n=this.chunkSize(e),r=Math.pow(e,n),i=!1,o=0,s=0,a=0;a<t.length;++a){var u=R(t,a);u<0?"-"==t.charAt(a)&&0==this.signum()&&(i=!0):(s=e*s+u,++o>=n&&(this.dMultiply(r),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(s,0)),i&&k.ZERO.subTo(this,this)},k.prototype.fromNumber=function(t,e,n){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,n),this.testBit(t-1)||this.bitwiseTo(k.ONE.shiftLeft(t-1),D,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(k.ONE.shiftLeft(t-1),this);else{var r=new Array,i=7&t;r.length=1+(t>>3),e.nextBytes(r),i>0?r[0]&=(1<<i)-1:r[0]=0,this.fromString(r,256)}},k.prototype.bitwiseTo=function(t,e,n){var r,i,o=Math.min(t.t,this.t);for(r=0;r<o;++r)n[r]=e(this[r],t[r]);if(t.t<this.t){for(i=t.s&this.DM,r=o;r<this.t;++r)n[r]=e(this[r],i);n.t=this.t}else{for(i=this.s&this.DM,r=o;r<t.t;++r)n[r]=e(i,t[r]);n.t=t.t}n.s=e(this.s,t.s),n.clamp()},k.prototype.changeBit=function(t,e){var n=k.ONE.shiftLeft(t);return this.bitwiseTo(n,e,n),n},k.prototype.addTo=function(t,e){for(var n=0,r=0,i=Math.min(t.t,this.t);n<i;)r+=this[n]+t[n],e[n++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r+=t.s;n<this.t;)r+=this[n],e[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<t.t;)r+=t[n],e[n++]=r&this.DM,r>>=this.DB;r+=t.s}e.s=r<0?-1:0,r>0?e[n++]=r:r<-1&&(e[n++]=this.DV+r),e.t=n,e.clamp()},k.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},k.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},k.prototype.multiplyLowerTo=function(t,e,n){var r,i=Math.min(this.t+t.t,e);for(n.s=0,n.t=i;i>0;)n[--i]=0;for(r=n.t-this.t;i<r;++i)n[i+this.t]=this.am(0,t[i],n,i,0,this.t);for(r=Math.min(t.t,e);i<r;++i)this.am(0,t[i],n,i,0,e-i);n.clamp()},k.prototype.multiplyUpperTo=function(t,e,n){--e;var r=n.t=this.t+t.t-e;for(n.s=0;--r>=0;)n[r]=0;for(r=Math.max(e-this.t,0);r<t.t;++r)n[this.t+r-e]=this.am(e-r,t[r],n,0,0,this.t+r-e);n.clamp(),n.drShiftTo(1,n)},k.prototype.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,n=this.s<0?t-1:0;if(this.t>0)if(0==e)n=this[0]%t;else for(var r=this.t-1;r>=0;--r)n=(e*n+this[r])%t;return n},k.prototype.millerRabin=function(t){var e=this.subtract(k.ONE),n=e.getLowestSetBit();if(n<=0)return!1;var r=e.shiftRight(n);(t=t+1>>1)>V.length&&(t=V.length);for(var i=x(),o=0;o<t;++o){i.fromInt(V[Math.floor(Math.random()*V.length)]);var s=i.modPow(r,this);if(0!=s.compareTo(k.ONE)&&0!=s.compareTo(e)){for(var a=1;a++<n&&0!=s.compareTo(e);)if(0==(s=s.modPowInt(2,this)).compareTo(k.ONE))return!1;if(0!=s.compareTo(e))return!1}}return!0},k.prototype.clone=
|
|
2
|
+
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
|
|
3
|
+
*/
|
|
4
|
+
function(){var t=x();return this.copyTo(t),t},k.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},k.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},k.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},k.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},k.prototype.toByteArray=function(){var t=this.t,e=new Array;e[0]=this.s;var n,r=this.DB-t*this.DB%8,i=0;if(t-- >0)for(r<this.DB&&(n=this[t]>>r)!=(this.s&this.DM)>>r&&(e[i++]=n|this.s<<this.DB-r);t>=0;)r<8?(n=(this[t]&(1<<r)-1)<<8-r,n|=this[--t]>>(r+=this.DB-8)):(n=this[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),0!=(128&n)&&(n|=-256),0==i&&(128&this.s)!=(128&n)&&++i,(i>0||n!=this.s)&&(e[i++]=n);return e},k.prototype.equals=function(t){return 0==this.compareTo(t)},k.prototype.min=function(t){return this.compareTo(t)<0?this:t},k.prototype.max=function(t){return this.compareTo(t)>0?this:t},k.prototype.and=function(t){var e=x();return this.bitwiseTo(t,P,e),e},k.prototype.or=function(t){var e=x();return this.bitwiseTo(t,D,e),e},k.prototype.xor=function(t){var e=x();return this.bitwiseTo(t,M,e),e},k.prototype.andNot=function(t){var e=x();return this.bitwiseTo(t,U,e),e},k.prototype.not=function(){for(var t=x(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},k.prototype.shiftLeft=function(t){var e=x();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},k.prototype.shiftRight=function(t){var e=x();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},k.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+L(this[t]);return this.s<0?this.t*this.DB:-1},k.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,n=0;n<this.t;++n)t+=B(this[n]^e);return t},k.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:0!=(this[e]&1<<t%this.DB)},k.prototype.setBit=function(t){return this.changeBit(t,D)},k.prototype.clearBit=function(t){return this.changeBit(t,U)},k.prototype.flipBit=function(t){return this.changeBit(t,M)},k.prototype.add=function(t){var e=x();return this.addTo(t,e),e},k.prototype.subtract=function(t){var e=x();return this.subTo(t,e),e},k.prototype.multiply=function(t){var e=x();return this.multiplyTo(t,e),e},k.prototype.divide=function(t){var e=x();return this.divRemTo(t,e,null),e},k.prototype.remainder=function(t){var e=x();return this.divRemTo(t,null,e),e},k.prototype.divideAndRemainder=function(t){var e=x(),n=x();return this.divRemTo(t,e,n),new Array(e,n)},k.prototype.modPow=function(t,e){var n,r,i=t.bitLength(),o=T(1);if(i<=0)return o;n=i<18?1:i<48?3:i<144?4:i<768?5:6,r=i<8?new O(e):e.isEven()?new H(e):new N(e);var s=new Array,a=3,u=n-1,c=(1<<n)-1;if(s[1]=r.convert(this),n>1){var h=x();for(r.sqrTo(s[1],h);a<=c;)s[a]=x(),r.mulTo(h,s[a-2],s[a]),a+=2}var f,l,d=t.t-1,v=!0,p=x();for(i=I(t[d])-1;d>=0;){for(i>=u?f=t[d]>>i-u&c:(f=(t[d]&(1<<i+1)-1)<<u-i,d>0&&(f|=t[d-1]>>this.DB+i-u)),a=n;0==(1&f);)f>>=1,--a;if((i-=a)<0&&(i+=this.DB,--d),v)s[f].copyTo(o),v=!1;else{for(;a>1;)r.sqrTo(o,p),r.sqrTo(p,o),a-=2;a>0?r.sqrTo(o,p):(l=o,o=p,p=l),r.mulTo(p,s[f],o)}for(;d>=0&&0==(t[d]&1<<i);)r.sqrTo(o,p),l=o,o=p,p=l,--i<0&&(i=this.DB-1,--d)}return r.revert(o)},k.prototype.modInverse=function(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return k.ZERO;for(var n=t.clone(),r=this.clone(),i=T(1),o=T(0),s=T(0),a=T(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),e?(i.isEven()&&o.isEven()||(i.addTo(this,i),o.subTo(t,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;r.isEven();)r.rShiftTo(1,r),e?(s.isEven()&&a.isEven()||(s.addTo(this,s),a.subTo(t,a)),s.rShiftTo(1,s)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);n.compareTo(r)>=0?(n.subTo(r,n),e&&i.subTo(s,i),o.subTo(a,o)):(r.subTo(n,r),e&&s.subTo(i,s),a.subTo(o,a))}return 0!=r.compareTo(k.ONE)?k.ZERO:a.compareTo(t)>=0?a.subtract(t):a.signum()<0?(a.addTo(t,a),a.signum()<0?a.add(t):a):a},k.prototype.pow=function(t){return this.exp(t,new J)},k.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),n=t.s<0?t.negate():t.clone();if(e.compareTo(n)<0){var r=e;e=n,n=r}var i=e.getLowestSetBit(),o=n.getLowestSetBit();if(o<0)return e;for(i<o&&(o=i),o>0&&(e.rShiftTo(o,e),n.rShiftTo(o,n));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),e.compareTo(n)>=0?(e.subTo(n,e),e.rShiftTo(1,e)):(n.subTo(e,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n},k.prototype.isProbablePrime=function(t){var e,n=this.abs();if(1==n.t&&n[0]<=V[V.length-1]){for(e=0;e<V.length;++e)if(n[0]==V[e])return!0;return!1}if(n.isEven())return!1;for(e=1;e<V.length;){for(var r=V[e],i=e+1;i<V.length&&r<G;)r*=V[i++];for(r=n.modInt(r);e<i;)if(r%V[e++]==0)return!1}return n.millerRabin(t)},k.prototype.square=function(){var t=x();return this.squareTo(t),t},z.prototype.init=function(t){var e,n,r;for(e=0;e<256;++e)this.S[e]=e;for(n=0,e=0;e<256;++e)r=this.S[e],this.S[e]=this.S[n=n+this.S[e]+t[e%t.length]&255],this.S[n]=r;this.i=0,this.j=0},z.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]},null==W){var Y;if(W=new Array,q=0,void 0!==m&&void 0!==m.msCrypto){var Q=m.msCrypto;if(Q.getRandomValues){var Z=new Uint8Array(32);for(Q.getRandomValues(Z),Y=0;Y<32;++Y)W[q++]=Z[Y]}}for(;q<256;)Y=Math.floor(65536*Math.random()),W[q++]=Y>>>8,W[q++]=255&Y;q=0,X()}function tt(){if(null==$){for(X(),($=new z).init(W),q=0;q<W.length;++q)W[q]=0;q=0}return $.next()}function et(){}function nt(t,e){return new k(t,e)}function rt(t,e,n){for(var r="",i=0;r.length<e;)r+=n(String.fromCharCode.apply(String,t.concat([(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i]))),i+=1;return r}function it(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function ot(t,e){this.x=e,this.q=t}function st(t,e,n,r){this.curve=t,this.x=e,this.y=n,this.z=null==r?k.ONE:r,this.zinv=null}function at(t,e,n){this.q=t,this.a=this.fromBigInteger(e),this.b=this.fromBigInteger(n),this.infinity=new st(this,null,null)}et.prototype.nextBytes=function(t){var e;for(e=0;e<t.length;++e)t[e]=tt()},it.prototype.doPublic=function(t){return t.modPowInt(this.e,this.n)},it.prototype.setPublic=function(t,e){if(this.isPublic=!0,this.isPrivate=!1,"string"!=typeof t)this.n=t,this.e=e;else{if(!(null!=t&&null!=e&&t.length>0&&e.length>0))throw"Invalid RSA public key";this.n=nt(t,16),this.e=parseInt(e,16)}},it.prototype.encrypt=function(t){var e=function(t,e){if(e<t.length+11)throw"Message too long for RSA";for(var n=new Array,r=t.length-1;r>=0&&e>0;){var i=t.charCodeAt(r--);i<128?n[--e]=i:i>127&&i<2048?(n[--e]=63&i|128,n[--e]=i>>6|192):(n[--e]=63&i|128,n[--e]=i>>6&63|128,n[--e]=i>>12|224)}n[--e]=0;for(var o=new et,s=new Array;e>2;){for(s[0]=0;0==s[0];)o.nextBytes(s);n[--e]=s[0]}return n[--e]=2,n[--e]=0,new k(n)}(t,this.n.bitLength()+7>>3);if(null==e)return null;var n=this.doPublic(e);if(null==n)return null;var r=n.toString(16);return 0==(1&r.length)?r:"0"+r},it.prototype.encryptOAEP=function(t,e,n){var r=function(t,e,n,r){var i=ct.crypto.MessageDigest,o=ct.crypto.Util,s=null;if(n||(n="sha1"),"string"==typeof n&&(s=i.getCanonicalAlgName(n),r=i.getHashLength(s),n=function(t){return Ft(o.hashHex(kt(t),s))}),t.length+2*r+2>e)throw"Message too long for RSA";var a,u="";for(a=0;a<e-t.length-2*r-2;a+=1)u+="\0";var c=n("")+u+""+t,h=new Array(r);(new et).nextBytes(h);var f=rt(h,c.length,n),l=[];for(a=0;a<c.length;a+=1)l[a]=c.charCodeAt(a)^f.charCodeAt(a);var d=rt(l,h.length,n),v=[0];for(a=0;a<h.length;a+=1)v[a+1]=h[a]^d.charCodeAt(a);return new k(v.concat(l))}(t,this.n.bitLength()+7>>3,e,n);if(null==r)return null;var i=this.doPublic(r);if(null==i)return null;var o=i.toString(16);return 0==(1&o.length)?o:"0"+o},it.prototype.type="RSA",ot.prototype.equals=function(t){return t==this||this.q.equals(t.q)&&this.x.equals(t.x)},ot.prototype.toBigInteger=function(){return this.x},ot.prototype.negate=function(){return new ot(this.q,this.x.negate().mod(this.q))},ot.prototype.add=function(t){return new ot(this.q,this.x.add(t.toBigInteger()).mod(this.q))},ot.prototype.subtract=function(t){return new ot(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))},ot.prototype.multiply=function(t){return new ot(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))},ot.prototype.square=function(){return new ot(this.q,this.x.square().mod(this.q))},ot.prototype.divide=function(t){return new ot(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))},st.prototype.getX=function(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))},st.prototype.getY=function(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))},st.prototype.equals=function(t){return t==this||(this.isInfinity()?t.isInfinity():t.isInfinity()?this.isInfinity():!!t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(k.ZERO)&&t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(k.ZERO))},st.prototype.isInfinity=function(){return null==this.x&&null==this.y||this.z.equals(k.ZERO)&&!this.y.toBigInteger().equals(k.ZERO)},st.prototype.negate=function(){return new st(this.curve,this.x,this.y.negate(),this.z)},st.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q),n=t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q);if(k.ZERO.equals(n))return k.ZERO.equals(e)?this.twice():this.curve.getInfinity();var r=new k("3"),i=this.x.toBigInteger(),o=this.y.toBigInteger(),s=(t.x.toBigInteger(),t.y.toBigInteger(),n.square()),a=s.multiply(n),u=i.multiply(s),c=e.square().multiply(this.z),h=c.subtract(u.shiftLeft(1)).multiply(t.z).subtract(a).multiply(n).mod(this.curve.q),f=u.multiply(r).multiply(e).subtract(o.multiply(a)).subtract(c.multiply(e)).multiply(t.z).add(e.multiply(a)).mod(this.curve.q),l=a.multiply(this.z).multiply(t.z).mod(this.curve.q);return new st(this.curve,this.curve.fromBigInteger(h),this.curve.fromBigInteger(f),l)},st.prototype.twice=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=new k("3"),e=this.x.toBigInteger(),n=this.y.toBigInteger(),r=n.multiply(this.z),i=r.multiply(n).mod(this.curve.q),o=this.curve.a.toBigInteger(),s=e.square().multiply(t);k.ZERO.equals(o)||(s=s.add(this.z.square().multiply(o)));var a=(s=s.mod(this.curve.q)).square().subtract(e.shiftLeft(3).multiply(i)).shiftLeft(1).multiply(r).mod(this.curve.q),u=s.multiply(t).multiply(e).subtract(i.shiftLeft(1)).shiftLeft(2).multiply(i).subtract(s.square().multiply(s)).mod(this.curve.q),c=r.square().multiply(r).shiftLeft(3).mod(this.curve.q);return new st(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(u),c)},st.prototype.multiply=function(t){if(this.isInfinity())return this;if(0==t.signum())return this.curve.getInfinity();var e,n=t,r=n.multiply(new k("3")),i=this.negate(),o=this,s=this.curve.q.subtract(t),a=s.multiply(new k("3")),u=new st(this.curve,this.x,this.y),c=u.negate();for(e=r.bitLength()-2;e>0;--e){o=o.twice();var h=r.testBit(e);h!=n.testBit(e)&&(o=o.add(h?this:i))}for(e=a.bitLength()-2;e>0;--e){u=u.twice();var f=a.testBit(e);f!=s.testBit(e)&&(u=u.add(f?u:c))}return o},st.prototype.multiplyTwo=function(t,e,n){var r;r=t.bitLength()>n.bitLength()?t.bitLength()-1:n.bitLength()-1;for(var i=this.curve.getInfinity(),o=this.add(e);r>=0;)i=i.twice(),t.testBit(r)?i=n.testBit(r)?i.add(o):i.add(this):n.testBit(r)&&(i=i.add(e)),--r;return i},at.prototype.getQ=function(){return this.q},at.prototype.getA=function(){return this.a},at.prototype.getB=function(){return this.b},at.prototype.equals=function(t){return t==this||this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)},at.prototype.getInfinity=function(){return this.infinity},at.prototype.fromBigInteger=function(t){return new ot(this.q,t)},at.prototype.decodePointHex=function(t){switch(parseInt(t.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:default:return null;case 4:case 6:case 7:var e=(t.length-2)/2,n=t.substr(2,e),r=t.substr(e+2,e);return new st(this,this.fromBigInteger(new k(n,16)),this.fromBigInteger(new k(r,16)))}},
|
|
5
|
+
/*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib
|
|
6
|
+
*/
|
|
7
|
+
ot.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)},st.prototype.getEncoded=function(t){var e=function(t,e){var n=t.toByteArrayUnsigned();if(e<n.length)n=n.slice(n.length-e);else for(;e>n.length;)n.unshift(0);return n},n=this.getX().toBigInteger(),r=this.getY().toBigInteger(),i=e(n,32);return t?r.isEven()?i.unshift(2):i.unshift(3):(i.unshift(4),i=i.concat(e(r,32))),i},st.decodeFrom=function(t,e){var n=e.length-1,r=e.slice(1,1+n/2),i=e.slice(1+n/2,1+n);r.unshift(0),i.unshift(0);var o=new k(r),s=new k(i);return new st(t,t.fromBigInteger(o),t.fromBigInteger(s))},st.decodeFromHex=function(t,e){e.substr(0,2);var n=e.length-2,r=e.substr(2,n/2),i=e.substr(2+n/2,n/2),o=new k(r,16),s=new k(i,16);return new st(t,t.fromBigInteger(o),t.fromBigInteger(s))},st.prototype.add2D=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;if(this.x.equals(t.x))return this.y.equals(t.y)?this.twice():this.curve.getInfinity();var e=t.x.subtract(this.x),n=t.y.subtract(this.y).divide(e),r=n.square().subtract(this.x).subtract(t.x),i=n.multiply(this.x.subtract(r)).subtract(this.y);return new st(this.curve,r,i)},st.prototype.twice2D=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=this.curve.fromBigInteger(k.valueOf(2)),e=this.curve.fromBigInteger(k.valueOf(3)),n=this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(t)),r=n.square().subtract(this.x.multiply(t)),i=n.multiply(this.x.subtract(r)).subtract(this.y);return new st(this.curve,r,i)},st.prototype.multiply2D=function(t){if(this.isInfinity())return this;if(0==t.signum())return this.curve.getInfinity();var e,n=t,r=n.multiply(new k("3")),i=this.negate(),o=this;for(e=r.bitLength()-2;e>0;--e){o=o.twice();var s=r.testBit(e);s!=n.testBit(e)&&(o=o.add2D(s?this:i))}return o},st.prototype.isOnCurve=function(){var t=this.getX().toBigInteger(),e=this.getY().toBigInteger(),n=this.curve.getA().toBigInteger(),r=this.curve.getB().toBigInteger(),i=this.curve.getQ(),o=e.multiply(e).mod(i),s=t.multiply(t).multiply(t).add(n.multiply(t)).add(r).mod(i);return o.equals(s)},st.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"},st.prototype.validate=function(){var t=this.curve.getQ();if(this.isInfinity())throw new Error("Point is at infinity.");var e=this.getX().toBigInteger(),n=this.getY().toBigInteger();if(e.compareTo(k.ONE)<0||e.compareTo(t.subtract(k.ONE))>0)throw new Error("x coordinate out of bounds");if(n.compareTo(k.ONE)<0||n.compareTo(t.subtract(k.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(t).isInfinity())throw new Error("Point is not a scalar multiple of G.");return!0};var ut=function(){var t=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"),e=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),n={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function r(t,e,r){return e?n[e]:String.fromCharCode(parseInt(r,16))}var i=new String(""),o=Object.hasOwnProperty;return function(n,s){var a,u,c=n.match(t),h=c[0],f=!1;"{"===h?a={}:"["===h?a=[]:(a=[],f=!0);for(var l=[a],d=1-f,v=c.length;d<v;++d){var p;switch((h=c[d]).charCodeAt(0)){default:(p=l[0])[u||p.length]=+h,u=void 0;break;case 34:if(-1!==(h=h.substring(1,h.length-1)).indexOf("\\")&&(h=h.replace(e,r)),p=l[0],!u){if(!(p instanceof Array)){u=h||i;break}u=p.length}p[u]=h,u=void 0;break;case 91:l.unshift((p=l[0])[u||p.length]=[]),u=void 0;break;case 93:case 125:l.shift();break;case 102:(p=l[0])[u||p.length]=!1,u=void 0;break;case 110:(p=l[0])[u||p.length]=null,u=void 0;break;case 116:(p=l[0])[u||p.length]=!0,u=void 0;break;case 123:l.unshift((p=l[0])[u||p.length]={}),u=void 0}}if(f){if(1!==l.length)throw new Error;a=a[0]}else if(l.length)throw new Error;return s&&(a=function t(e,n){var r=e[n];if(r&&"object"===(void 0===r?"undefined":y(r))){var i=null;for(var a in r)if(o.call(r,a)&&r!==e){var u=t(r,a);void 0!==u?r[a]=u:(i||(i=[]),i.push(a))}if(i)for(var c=i.length;--c>=0;)delete r[i[c]]}return s.call(e,n,r)}({"":a},"")),a}}();void 0!==ct&&ct||(e.KJUR=ct={}),void 0!==ct.asn1&&ct.asn1||(ct.asn1={}),ct.asn1.ASN1Util=new function(){this.integerToByteHex=function(t){var e=t.toString(16);return e.length%2==1&&(e="0"+e),e},this.bigIntToMinTwosComplementsHex=function(t){var e=t.toString(16);if("-"!=e.substr(0,1))e.length%2==1?e="0"+e:e.match(/^[0-7]/)||(e="00"+e);else{var n=e.substr(1).length;n%2==1?n+=1:e.match(/^[0-7]/)||(n+=2);for(var r="",i=0;i<n;i++)r+="f";e=new k(r,16).xor(t).add(k.ONE).toString(16).replace(/^-/,"")}return e},this.getPEMStringFromHex=function(t,e){return jt(t,e)},this.newObject=function(t){var e=ct.asn1,n=e.ASN1Object,r=e.DERBoolean,i=e.DERInteger,o=e.DERBitString,s=e.DEROctetString,a=e.DERNull,u=e.DERObjectIdentifier,c=e.DEREnumerated,h=e.DERUTF8String,f=e.DERNumericString,l=e.DERPrintableString,d=e.DERTeletexString,v=e.DERIA5String,p=e.DERUTCTime,w=e.DERGeneralizedTime,y=e.DERVisibleString,m=e.DERBMPString,g=e.DERSequence,b=e.DERSet,E=e.DERTaggedObject,S=e.ASN1Util.newObject;if(t instanceof e.ASN1Object)return t;var F=Object.keys(t);if(1!=F.length)throw new Error("key of param shall be only one.");var k=F[0];if(-1==":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+k+":"))throw new Error("undefined key: "+k);if("bool"==k)return new r(t[k]);if("int"==k)return new i(t[k]);if("bitstr"==k)return new o(t[k]);if("octstr"==k)return new s(t[k]);if("null"==k)return new a(t[k]);if("oid"==k)return new u(t[k]);if("enum"==k)return new c(t[k]);if("utf8str"==k)return new h(t[k]);if("numstr"==k)return new f(t[k]);if("prnstr"==k)return new l(t[k]);if("telstr"==k)return new d(t[k]);if("ia5str"==k)return new v(t[k]);if("utctime"==k)return new p(t[k]);if("gentime"==k)return new w(t[k]);if("visstr"==k)return new y(t[k]);if("bmpstr"==k)return new m(t[k]);if("asn1"==k)return new n(t[k]);if("seq"==k){for(var x=t[k],_=[],A=0;A<x.length;A++){var j=S(x[A]);_.push(j)}return new g({array:_})}if("set"==k){for(x=t[k],_=[],A=0;A<x.length;A++)j=S(x[A]),_.push(j);return new b({array:_})}if("tag"==k){var C=t[k];if("[object Array]"===Object.prototype.toString.call(C)&&3==C.length){var R=S(C[2]);return new E({tag:C[0],explicit:C[1],obj:R})}return new E(C)}},this.jsonToASN1HEX=function(t){return this.newObject(t).getEncodedHex()}},ct.asn1.ASN1Util.oidHexToInt=function(t){for(var e="",n=parseInt(t.substr(0,2),16),r=(e=Math.floor(n/40)+"."+n%40,""),i=2;i<t.length;i+=2){var o=("00000000"+parseInt(t.substr(i,2),16).toString(2)).slice(-8);r+=o.substr(1,7),"0"==o.substr(0,1)&&(e=e+"."+new k(r,2).toString(10),r="")}return e},ct.asn1.ASN1Util.oidIntToHex=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},n=function(t){var n="",r=new k(t,10).toString(2),i=7-r.length%7;7==i&&(i=0);for(var o="",s=0;s<i;s++)o+="0";for(r=o+r,s=0;s<r.length-1;s+=7){var a=r.substr(s,7);s!=r.length-7&&(a="1"+a),n+=e(parseInt(a,2))}return n};if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var r="",i=t.split("."),o=40*parseInt(i[0])+parseInt(i[1]);r+=e(o),i.splice(0,2);for(var s=0;s<i.length;s++)r+=n(i[s]);return r},ct.asn1.ASN1Object=function(t){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 t=this.hV.length/2,e=t.toString(16);if(e.length%2==1&&(e="0"+e),t<128)return e;var n=e.length/2;if(n>15)throw"ASN.1 length too long to represent by 8x: n = "+t.toString(16);return(128+n).toString(16)+e},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(t){this.params=t},null!=t&&null!=t.tlv&&(this.hTLV=t.tlv,this.isModified=!1)},ct.asn1.DERAbstractString=function(t){ct.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=Et(this.s).toLowerCase()},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?this.setString(t):void 0!==t.str?this.setString(t.str):void 0!==t.hex&&this.setStringHex(t.hex))},Kt(ct.asn1.DERAbstractString,ct.asn1.ASN1Object),ct.asn1.DERAbstractTime=function(){ct.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(t){var e=t.getTime()+6e4*t.getTimezoneOffset();return new Date(e)},this.formatDate=function(t,e,n){var r=this.zeroPadding,i=this.localDateToUTC(t),o=String(i.getFullYear());"utc"==e&&(o=o.substr(2,2));var s=o+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 a=i.getMilliseconds();if(0!=a){var u=r(String(a),3);s=s+"."+(u=u.replace(/[0]+$/,""))}}return s+"Z"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=wt(t)},this.setByDateValue=function(t,e,n,r,i,o){var s=new Date(Date.UTC(t,e-1,n,r,i,o,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}},Kt(ct.asn1.DERAbstractTime,ct.asn1.ASN1Object),ct.asn1.DERAbstractStructured=function(t){ct.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,void 0!==t&&void 0!==t.array&&(this.asn1Array=t.array)},Kt(ct.asn1.DERAbstractStructured,ct.asn1.ASN1Object),ct.asn1.DERBoolean=function(t){ct.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV=0==t?"010100":"0101ff"},Kt(ct.asn1.DERBoolean,ct.asn1.ASN1Object),ct.asn1.DERInteger=function(t){ct.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=ct.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new k(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.bigint?this.setByBigInteger(t.bigint):void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},Kt(ct.asn1.DERInteger,ct.asn1.ASN1Object),ct.asn1.DERBitString=function(t){if(void 0!==t&&void 0!==t.obj){var e=ct.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.getEncodedHex()}ct.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7<t)throw"unused bits shall be from 0 to 7: u = "+t;var n="0"+t;this.hTLV=null,this.isModified=!0,this.hV=n+e},this.setByBinaryString=function(t){var e=8-(t=t.replace(/0+$/,"")).length%8;8==e&&(e=0);for(var n=0;n<=e;n++)t+="0";var r="";for(n=0;n<t.length-1;n+=8){var i=t.substr(n,8),o=parseInt(i,2).toString(16);1==o.length&&(o="0"+o),r+=o}this.hTLV=null,this.isModified=!0,this.hV="0"+e+r},this.setByBooleanArray=function(t){for(var e="",n=0;n<t.length;n++)e+=1==t[n]?"1":"0";this.setByBinaryString(e)},this.newFalseArray=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=!1;return e},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t&&t.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(t):void 0!==t.hex?this.setHexValueIncludingUnusedBits(t.hex):void 0!==t.bin?this.setByBinaryString(t.bin):void 0!==t.array&&this.setByBooleanArray(t.array))},Kt(ct.asn1.DERBitString,ct.asn1.ASN1Object),ct.asn1.DEROctetString=function(t){if(void 0!==t&&void 0!==t.obj){var e=ct.asn1.ASN1Util.newObject(t.obj);t.hex=e.getEncodedHex()}ct.asn1.DEROctetString.superclass.constructor.call(this,t),this.hT="04"},Kt(ct.asn1.DEROctetString,ct.asn1.DERAbstractString),ct.asn1.DERNull=function(){ct.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},Kt(ct.asn1.DERNull,ct.asn1.ASN1Object),ct.asn1.DERObjectIdentifier=function(t){ct.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){var e=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},n=function(t){var n="",r=parseInt(t,10).toString(2),i=7-r.length%7;7==i&&(i=0);for(var o="",s=0;s<i;s++)o+="0";for(r=o+r,s=0;s<r.length-1;s+=7){var a=r.substr(s,7);s!=r.length-7&&(a="1"+a),n+=e(parseInt(a,2))}return n};try{if(!t.match(/^[0-9.]+$/))return null;var r="",i=t.split("."),o=40*parseInt(i[0],10)+parseInt(i[1],10);r+=e(o),i.splice(0,2);for(var s=0;s<i.length;s++)r+=n(i[s]);return r}catch(t){return null}}(t);if(null==e)throw new Error("malformed oid string: "+t);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueName=function(t){var e=ct.asn1.x509.OID.name2oid(t);if(""===e)throw new Error("DERObjectIdentifier oidName undefined: "+t);this.setValueOidString(e)},this.setValueNameOrOid=function(t){t.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(t):this.setValueName(t)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(t){"string"==typeof t?this.setValueNameOrOid(t):void 0!==t.oid?this.setValueNameOrOid(t.oid):void 0!==t.name?this.setValueNameOrOid(t.name):void 0!==t.hex&&this.setValueHex(t.hex)},void 0!==t&&this.setByParam(t)},Kt(ct.asn1.DERObjectIdentifier,ct.asn1.ASN1Object),ct.asn1.DEREnumerated=function(t){ct.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=ct.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new k(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},Kt(ct.asn1.DEREnumerated,ct.asn1.ASN1Object),ct.asn1.DERUTF8String=function(t){ct.asn1.DERUTF8String.superclass.constructor.call(this,t),this.hT="0c"},Kt(ct.asn1.DERUTF8String,ct.asn1.DERAbstractString),ct.asn1.DERNumericString=function(t){ct.asn1.DERNumericString.superclass.constructor.call(this,t),this.hT="12"},Kt(ct.asn1.DERNumericString,ct.asn1.DERAbstractString),ct.asn1.DERPrintableString=function(t){ct.asn1.DERPrintableString.superclass.constructor.call(this,t),this.hT="13"},Kt(ct.asn1.DERPrintableString,ct.asn1.DERAbstractString),ct.asn1.DERTeletexString=function(t){ct.asn1.DERTeletexString.superclass.constructor.call(this,t),this.hT="14"},Kt(ct.asn1.DERTeletexString,ct.asn1.DERAbstractString),ct.asn1.DERIA5String=function(t){ct.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="16"},Kt(ct.asn1.DERIA5String,ct.asn1.DERAbstractString),ct.asn1.DERVisibleString=function(t){ct.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="1a"},Kt(ct.asn1.DERVisibleString,ct.asn1.DERAbstractString),ct.asn1.DERBMPString=function(t){ct.asn1.DERBMPString.superclass.constructor.call(this,t),this.hT="1e"},Kt(ct.asn1.DERBMPString,ct.asn1.DERAbstractString),ct.asn1.DERUTCTime=function(t){ct.asn1.DERUTCTime.superclass.constructor.call(this,t),this.hT="17",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"utc"),this.hV=wt(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=wt(this.s)),this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{12}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date))},Kt(ct.asn1.DERUTCTime,ct.asn1.DERAbstractTime),ct.asn1.DERGeneralizedTime=function(t){ct.asn1.DERGeneralizedTime.superclass.constructor.call(this,t),this.hT="18",this.withMillis=!1,this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=wt(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=wt(this.s)),this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{14}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date),!0===t.millis&&(this.withMillis=!0))},Kt(ct.asn1.DERGeneralizedTime,ct.asn1.DERAbstractTime),ct.asn1.DERSequence=function(t){ct.asn1.DERSequence.superclass.constructor.call(this,t),this.hT="30",this.getFreshValueHex=function(){for(var t="",e=0;e<this.asn1Array.length;e++)t+=this.asn1Array[e].getEncodedHex();return this.hV=t,this.hV}},Kt(ct.asn1.DERSequence,ct.asn1.DERAbstractStructured),ct.asn1.DERSet=function(t){ct.asn1.DERSet.superclass.constructor.call(this,t),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var t=new Array,e=0;e<this.asn1Array.length;e++)t.push(this.asn1Array[e].getEncodedHex());return 1==this.sortFlag&&t.sort(),this.hV=t.join(""),this.hV},void 0!==t&&void 0!==t.sortflag&&0==t.sortflag&&(this.sortFlag=!1)},Kt(ct.asn1.DERSet,ct.asn1.DERAbstractStructured),ct.asn1.DERTaggedObject=function(t){ct.asn1.DERTaggedObject.superclass.constructor.call(this);var e=ct.asn1;this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(t,e,n){this.hT=e,this.isExplicit=t,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(/^../,e),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(t){null!=t.tag&&(this.hT=t.tag),null!=t.explicit&&(this.isExplicit=t.explicit),null!=t.tage&&(this.hT=t.tage,this.isExplicit=!0),null!=t.tagi&&(this.hT=t.tagi,this.isExplicit=!1),null!=t.obj&&(t.obj instanceof e.ASN1Object?(this.asn1Object=t.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)):"object"==y(t.obj)&&(this.asn1Object=e.ASN1Util.newObject(t.obj),this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},null!=t&&this.setByParam(t)},Kt(ct.asn1.DERTaggedObject,ct.asn1.ASN1Object);var ct,ht,ft,lt=new function(){};function dt(t){for(var e=new Array,n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}function vt(t){for(var e="",n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return e}function pt(t){for(var e="",n=0;n<t.length;n++){var r=t[n].toString(16);1==r.length&&(r="0"+r),e+=r}return e}function wt(t){return pt(dt(t))}function yt(t){return(t=(t=t.replace(/\=/g,"")).replace(/\+/g,"-")).replace(/\//g,"_")}function mt(t){return t.length%4==2?t+="==":t.length%4==3&&(t+="="),(t=t.replace(/-/g,"+")).replace(/_/g,"/")}function gt(t){return t.length%2==1&&(t="0"+t),yt(E(t))}function bt(t){return S(mt(t))}function Et(t){return It(Ut(t))}function St(t){return decodeURIComponent(Ot(t))}function Ft(t){for(var e="",n=0;n<t.length-1;n+=2)e+=String.fromCharCode(parseInt(t.substr(n,2),16));return e}function kt(t){for(var e="",n=0;n<t.length;n++)e+=("0"+t.charCodeAt(n).toString(16)).slice(-2);return e}function xt(t){return E(t)}function _t(t){return xt(t).replace(/(.{64})/g,"$1\r\n").replace(/\r\n$/,"")}function At(t){return S(t.replace(/[^0-9A-Za-z\/+=]*/g,""))}function jt(t,e){return"-----BEGIN "+e+"-----\r\n"+_t(t)+"\r\n-----END "+e+"-----\r\n"}function Ct(t,e){if(-1==t.indexOf("-----BEGIN "))throw"can't find PEM header: "+e;return At(t=void 0!==e?(t=t.replace(new RegExp("^[^]*-----BEGIN "+e+"-----"),"")).replace(new RegExp("-----END "+e+"-----[^]*$"),""):(t=t.replace(/^[^]*-----BEGIN [^-]+-----/,"")).replace(/-----END [^-]+-----[^]*$/,""))}function Rt(t){var e,n,r,i,o,s,a,u,c,h,f;if(f=t.match(/^(\d{2}|\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(|\.\d+)Z$/))return u=f[1],e=parseInt(u),2===u.length&&(50<=e&&e<100?e=1900+e:0<=e&&e<50&&(e=2e3+e)),n=parseInt(f[2])-1,r=parseInt(f[3]),i=parseInt(f[4]),o=parseInt(f[5]),s=parseInt(f[6]),a=0,""!==(c=f[7])&&(h=(c.substr(1)+"00").substr(0,3),a=parseInt(h)),Date.UTC(e,n,r,i,o,s,a);throw"unsupported zulu format: "+t}function Tt(t){return~~(Rt(t)/1e3)}function It(t){return t.replace(/%/g,"")}function Ot(t){return t.replace(/(..)/g,"%$1")}function Nt(t){var e="malformed IPv6 address";if(!t.match(/^[0-9A-Fa-f:]+$/))throw e;var n=(t=t.toLowerCase()).split(":").length-1;if(n<2)throw e;var r=":".repeat(7-n+2),i=(t=t.replace("::",r)).split(":");if(8!=i.length)throw e;for(var o=0;o<8;o++)i[o]=("0000"+i[o]).slice(-4);return i.join("")}function Pt(t){if(!t.match(/^[0-9A-Fa-f]{32}$/))throw"malformed IPv6 address octet";for(var e=(t=t.toLowerCase()).match(/.{1,4}/g),n=0;n<8;n++)e[n]=e[n].replace(/^0+/,""),""==e[n]&&(e[n]="0");var r=(t=":"+e.join(":")+":").match(/:(0:){2,}/g);if(null===r)return t.slice(1,-1);var i="";for(n=0;n<r.length;n++)r[n].length>i.length&&(i=r[n]);return(t=t.replace(i,"::")).slice(1,-1)}function Dt(t){var e="malformed hex value";if(!t.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw e;if(8!=t.length)return 32==t.length?Pt(t):t;try{return parseInt(t.substr(0,2),16)+"."+parseInt(t.substr(2,2),16)+"."+parseInt(t.substr(4,2),16)+"."+parseInt(t.substr(6,2),16)}catch(t){throw e}}function Mt(t){return t.match(/.{4}/g).map((function(t){var e=parseInt(t.substr(0,2),16),n=parseInt(t.substr(2),16);if(0==e&n<128)return String.fromCharCode(n);if(e<8){var r=128|63&n;return St((192|(7&e)<<3|(192&n)>>6).toString(16)+r.toString(16))}r=128|(15&e)<<2|(192&n)>>6;var i=128|63&n;return St((224|(240&e)>>4).toString(16)+r.toString(16)+i.toString(16))})).join("")}function Ut(t){for(var e=encodeURIComponent(t),n="",r=0;r<e.length;r++)"%"==e[r]?(n+=e.substr(r,3),r+=2):n=n+"%"+wt(e[r]);return n}function Lt(t){return!(t.length%2!=0||!t.match(/^[0-9a-f]+$/)&&!t.match(/^[0-9A-F]+$/))}function Bt(t){return t.length%2==1?"0"+t:t.substr(0,1)>"7"?"00"+t:t}lt.getLblen=function(t,e){if("8"!=t.substr(e+2,1))return 1;var n=parseInt(t.substr(e+3,1));return 0==n?-1:0<n&&n<10?n+1:-2},lt.getL=function(t,e){var n=lt.getLblen(t,e);return n<1?"":t.substr(e+2,2*n)},lt.getVblen=function(t,e){var n;return""==(n=lt.getL(t,e))?-1:("8"===n.substr(0,1)?new k(n.substr(2),16):new k(n,16)).intValue()},lt.getVidx=function(t,e){var n=lt.getLblen(t,e);return n<0?n:e+2*(n+1)},lt.getV=function(t,e){var n=lt.getVidx(t,e),r=lt.getVblen(t,e);return t.substr(n,2*r)},lt.getTLV=function(t,e){return t.substr(e,2)+lt.getL(t,e)+lt.getV(t,e)},lt.getTLVblen=function(t,e){return 2+2*lt.getLblen(t,e)+2*lt.getVblen(t,e)},lt.getNextSiblingIdx=function(t,e){return lt.getVidx(t,e)+2*lt.getVblen(t,e)},lt.getChildIdx=function(t,e){var n,r,i,o=lt,s=[];n=o.getVidx(t,e),r=2*o.getVblen(t,e),"03"==t.substr(e,2)&&(n+=2,r-=2),i=0;for(var a=n;i<=r;){var u=o.getTLVblen(t,a);if((i+=u)<=r&&s.push(a),a+=u,i>=r)break}return s},lt.getNthChildIdx=function(t,e,n){return lt.getChildIdx(t,e)[n]},lt.getIdxbyList=function(t,e,n,r){var i,o,s=lt;return 0==n.length?void 0!==r&&t.substr(e,2)!==r?-1:e:(i=n.shift())>=(o=s.getChildIdx(t,e)).length?-1:s.getIdxbyList(t,o[i],n,r)},lt.getIdxbyListEx=function(t,e,n,r){var i,o,s=lt;if(0==n.length)return void 0!==r&&t.substr(e,2)!==r?-1:e;i=n.shift(),o=s.getChildIdx(t,e);for(var a=0,u=0;u<o.length;u++){var c=t.substr(o[u],2);if("number"==typeof i&&!s.isContextTag(c)&&a==i||"string"==typeof i&&s.isContextTag(c,i))return s.getIdxbyListEx(t,o[u],n,r);s.isContextTag(c)||a++}return-1},lt.getTLVbyList=function(t,e,n,r){var i=lt,o=i.getIdxbyList(t,e,n,r);return-1==o||o>=t.length?null:i.getTLV(t,o)},lt.getTLVbyListEx=function(t,e,n,r){var i=lt,o=i.getIdxbyListEx(t,e,n,r);return-1==o?null:i.getTLV(t,o)},lt.getVbyList=function(t,e,n,r,i){var o,s,a=lt;return-1==(o=a.getIdxbyList(t,e,n,r))||o>=t.length?null:(s=a.getV(t,o),!0===i&&(s=s.substr(2)),s)},lt.getVbyListEx=function(t,e,n,r,i){var o,s,a=lt;return-1==(o=a.getIdxbyListEx(t,e,n,r))?null:(s=a.getV(t,o),"03"==t.substr(o,2)&&!1!==i&&(s=s.substr(2)),s)},lt.getInt=function(t,e,n){null==n&&(n=-1);try{var r=t.substr(e,2);if("02"!=r&&"03"!=r)return n;var i=lt.getV(t,e);return"02"==r?parseInt(i,16):function(t){try{var e=t.substr(0,2);if("00"==e)return parseInt(t.substr(2),16);var n=parseInt(e,16),r=t.substr(2),i=parseInt(r,16).toString(2);return"0"==i&&(i="00000000"),i=i.slice(0,0-n),parseInt(i,2)}catch(t){return-1}}(i)}catch(t){return n}},lt.getOID=function(t,e,n){null==n&&(n=null);try{return"06"!=t.substr(e,2)?n:function(t){if(!Lt(t))return null;try{var e=[],n=t.substr(0,2),r=parseInt(n,16);e[0]=new String(Math.floor(r/40)),e[1]=new String(r%40);for(var i=t.substr(2),o=[],s=0;s<i.length/2;s++)o.push(parseInt(i.substr(2*s,2),16));var a=[],u="";for(s=0;s<o.length;s++)128&o[s]?u+=Jt((127&o[s]).toString(2),7):(u+=Jt((127&o[s]).toString(2),7),a.push(new String(parseInt(u,2))),u="");var c=e.join(".");return a.length>0&&(c=c+"."+a.join(".")),c}catch(t){return null}}(lt.getV(t,e))}catch(t){return n}},lt.getOIDName=function(t,e,n){null==n&&(n=null);try{var r=lt.getOID(t,e,n);if(r==n)return n;var i=ct.asn1.x509.OID.oid2name(r);return""==i?r:i}catch(t){return n}},lt.getString=function(t,e,n){null==n&&(n=null);try{return Ft(lt.getV(t,e))}catch(t){return n}},lt.hextooidstr=function(t){var e=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},n=[],r=t.substr(0,2),i=parseInt(r,16);n[0]=new String(Math.floor(i/40)),n[1]=new String(i%40);for(var o=t.substr(2),s=[],a=0;a<o.length/2;a++)s.push(parseInt(o.substr(2*a,2),16));var u=[],c="";for(a=0;a<s.length;a++)128&s[a]?c+=e((127&s[a]).toString(2),7):(c+=e((127&s[a]).toString(2),7),u.push(new String(parseInt(c,2))),c="");var h=n.join(".");return u.length>0&&(h=h+"."+u.join(".")),h},lt.dump=function(t,e,n,r){var i=lt,o=i.getV,s=i.dump,a=i.getChildIdx,u=t;t instanceof ct.asn1.ASN1Object&&(u=t.getEncodedHex());var c=function(t,e){return t.length<=2*e?t:t.substr(0,e)+"..(total "+t.length/2+"bytes).."+t.substr(t.length-e,e)};void 0===e&&(e={ommit_long_octet:32}),void 0===n&&(n=0),void 0===r&&(r="");var h,f=e.ommit_long_octet;if("01"==(h=u.substr(n,2)))return"00"==(l=o(u,n))?r+"BOOLEAN FALSE\n":r+"BOOLEAN TRUE\n";if("02"==h)return r+"INTEGER "+c(l=o(u,n),f)+"\n";if("03"==h){var l=o(u,n);return i.isASN1HEX(l.substr(2))?(E=r+"BITSTRING, encapsulates\n")+s(l.substr(2),e,0,r+" "):r+"BITSTRING "+c(l,f)+"\n"}if("04"==h)return l=o(u,n),i.isASN1HEX(l)?(E=r+"OCTETSTRING, encapsulates\n")+s(l,e,0,r+" "):r+"OCTETSTRING "+c(l,f)+"\n";if("05"==h)return r+"NULL\n";if("06"==h){var d=o(u,n),v=ct.asn1.ASN1Util.oidHexToInt(d),p=ct.asn1.x509.OID.oid2name(v),w=v.replace(/\./g," ");return""!=p?r+"ObjectIdentifier "+p+" ("+w+")\n":r+"ObjectIdentifier ("+w+")\n"}if("0a"==h)return r+"ENUMERATED "+parseInt(o(u,n))+"\n";if("0c"==h)return r+"UTF8String '"+St(o(u,n))+"'\n";if("13"==h)return r+"PrintableString '"+St(o(u,n))+"'\n";if("14"==h)return r+"TeletexString '"+St(o(u,n))+"'\n";if("16"==h)return r+"IA5String '"+St(o(u,n))+"'\n";if("17"==h)return r+"UTCTime "+St(o(u,n))+"\n";if("18"==h)return r+"GeneralizedTime "+St(o(u,n))+"\n";if("1a"==h)return r+"VisualString '"+St(o(u,n))+"'\n";if("1e"==h)return r+"BMPString '"+Mt(o(u,n))+"'\n";if("30"==h){if("3000"==u.substr(n,4))return r+"SEQUENCE {}\n";E=r+"SEQUENCE\n";var y=e;if((2==(b=a(u,n)).length||3==b.length)&&"06"==u.substr(b[0],2)&&"04"==u.substr(b[b.length-1],2)){p=i.oidname(o(u,b[0]));var m=JSON.parse(JSON.stringify(e));m.x509ExtName=p,y=m}for(var g=0;g<b.length;g++)E+=s(u,y,b[g],r+" ");return E}if("31"==h){E=r+"SET\n";var b=a(u,n);for(g=0;g<b.length;g++)E+=s(u,e,b[g],r+" ");return E}if(0!=(128&(h=parseInt(h,16)))){var E,S=31&h;if(0!=(32&h)){for(E=r+"["+S+"]\n",b=a(u,n),g=0;g<b.length;g++)E+=s(u,e,b[g],r+" ");return E}return l=o(u,n),lt.isASN1HEX(l)?(E=r+"["+S+"]\n")+s(l,e,0,r+" "):(("68747470"==l.substr(0,8)||"subjectAltName"===e.x509ExtName&&2==S)&&(l=St(l)),r+"["+S+"] "+l+"\n")}return r+"UNKNOWN("+h+") "+o(u,n)+"\n"},lt.isContextTag=function(t,e){var n,r;t=t.toLowerCase();try{n=parseInt(t,16)}catch(t){return-1}if(void 0===e)return 128==(192&n);try{return null!=e.match(/^\[[0-9]+\]$/)&&!((r=parseInt(e.substr(1,e.length-1),10))>31)&&128==(192&n)&&(31&n)==r}catch(t){return!1}},lt.isASN1HEX=function(t){var e=lt;if(t.length%2==1)return!1;var n=e.getVblen(t,0),r=t.substr(0,2),i=e.getL(t,0);return t.length-r.length-i.length==2*n},lt.checkStrictDER=function(t,e,n,r,i){var o=lt;if(void 0===n){if("string"!=typeof t)throw new Error("not hex string");if(t=t.toLowerCase(),!ct.lang.String.isHex(t))throw new Error("not hex string");n=t.length,i=(r=t.length/2)<128?1:Math.ceil(r.toString(16))+1}if(o.getL(t,e).length>2*i)throw new Error("L of TLV too long: idx="+e);var s=o.getVblen(t,e);if(s>r)throw new Error("value of L too long than hex: idx="+e);var a=o.getTLV(t,e),u=a.length-2-o.getL(t,e).length;if(u!==2*s)throw new Error("V string length and L's value not the same:"+u+"/"+2*s);if(0===e&&t.length!=a.length)throw new Error("total length and TLV length unmatch:"+t.length+"!="+a.length);var c=t.substr(e,2);if("02"===c){var h=o.getVidx(t,e);if("00"==t.substr(h,2)&&t.charCodeAt(h+2)<56)throw new Error("not least zeros for DER INTEGER")}if(32&parseInt(c,16)){for(var f=o.getVblen(t,e),l=0,d=o.getChildIdx(t,e),v=0;v<d.length;v++)l+=o.getTLV(t,d[v]).length,o.checkStrictDER(t,d[v],n,r,i);if(2*f!=l)throw new Error("sum of children's TLV length and L unmatch: "+2*f+"!="+l)}},lt.oidname=function(t){var e=ct.asn1;ct.lang.String.isHex(t)&&(t=e.ASN1Util.oidHexToInt(t));var n=e.x509.OID.oid2name(t);return""===n&&(n=t),n},void 0!==ct&&ct||(e.KJUR=ct={}),void 0!==ct.lang&&ct.lang||(ct.lang={}),ct.lang.String=function(){},"function"==typeof t?(e.utf8tob64u=ht=function(e){return yt(t.from(e,"utf8").toString("base64"))},e.b64utoutf8=ft=function(e){return t.from(mt(e),"base64").toString("utf8")}):(e.utf8tob64u=ht=function(t){return gt(It(Ut(t)))},e.b64utoutf8=ft=function(t){return decodeURIComponent(Ot(bt(t)))}),ct.lang.String.isInteger=function(t){return!!t.match(/^[0-9]+$/)||!!t.match(/^-[0-9]+$/)},ct.lang.String.isHex=function(t){return Lt(t)},ct.lang.String.isBase64=function(t){return!(!(t=t.replace(/\s+/g,"")).match(/^[0-9A-Za-z+\/]+={0,3}$/)||t.length%4!=0)},ct.lang.String.isBase64URL=function(t){return!t.match(/[+/=]/)&&(t=mt(t),ct.lang.String.isBase64(t))},ct.lang.String.isIntegerArray=function(t){return!!(t=t.replace(/\s+/g,"")).match(/^\[[0-9,]+\]$/)},ct.lang.String.isPrintable=function(t){return null!==t.match(/^[0-9A-Za-z '()+,-./:=?]*$/)},ct.lang.String.isIA5=function(t){return null!==t.match(/^[\x20-\x21\x23-\x7f]*$/)},ct.lang.String.isMail=function(t){return null!==t.match(/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\.[A-Za-z0-9]{1,}$/)};var Jt=function(t,e,n){return null==n&&(n="0"),t.length>=e?t:new Array(e-t.length+1).join(n)+t};function Kt(t,e){var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor==Object.prototype.constructor&&(e.prototype.constructor=e)}void 0!==ct&&ct||(e.KJUR=ct={}),void 0!==ct.crypto&&ct.crypto||(ct.crypto={}),ct.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(t,e){if(void 0===this.DIGESTINFOHEAD[e])throw"alg not supported in Util.DIGESTINFOHEAD: "+e;return this.DIGESTINFOHEAD[e]+t},this.getPaddedDigestInfoHex=function(t,e,n){var r=this.getDigestInfoHex(t,e),i=n/4;if(r.length+22>i)throw"key is too short for SigAlg: keylen="+n+","+e;for(var o="0001",s="00"+r,a="",u=i-o.length-s.length,c=0;c<u;c+=2)a+="ff";return o+a+s},this.hashString=function(t,e){return new ct.crypto.MessageDigest({alg:e}).digestString(t)},this.hashHex=function(t,e){return new ct.crypto.MessageDigest({alg:e}).digestHex(t)},this.sha1=function(t){return this.hashString(t,"sha1")},this.sha256=function(t){return this.hashString(t,"sha256")},this.sha256Hex=function(t){return this.hashHex(t,"sha256")},this.sha512=function(t){return this.hashString(t,"sha512")},this.sha512Hex=function(t){return this.hashHex(t,"sha512")},this.isKey=function(t){return t instanceof it||t instanceof ct.crypto.DSA||t instanceof ct.crypto.ECDSA}},ct.crypto.Util.md5=function(t){return new ct.crypto.MessageDigest({alg:"md5",prov:"cryptojs"}).digestString(t)},ct.crypto.Util.ripemd160=function(t){return new ct.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"}).digestString(t)},ct.crypto.Util.SECURERANDOMGEN=new et,ct.crypto.Util.getRandomHexOfNbytes=function(t){var e=new Array(t);return ct.crypto.Util.SECURERANDOMGEN.nextBytes(e),pt(e)},ct.crypto.Util.getRandomBigIntegerOfNbytes=function(t){return new k(ct.crypto.Util.getRandomHexOfNbytes(t),16)},ct.crypto.Util.getRandomHexOfNbits=function(t){var e=t%8,n=new Array((t-e)/8+1);return ct.crypto.Util.SECURERANDOMGEN.nextBytes(n),n[0]=(255<<e&255^255)&n[0],pt(n)},ct.crypto.Util.getRandomBigIntegerOfNbits=function(t){return new k(ct.crypto.Util.getRandomHexOfNbits(t),16)},ct.crypto.Util.getRandomBigIntegerZeroToMax=function(t){for(var e=t.bitLength();;){var n=ct.crypto.Util.getRandomBigIntegerOfNbits(e);if(-1!=t.compareTo(n))return n}},ct.crypto.Util.getRandomBigIntegerMinToMax=function(t,e){var n=t.compareTo(e);if(1==n)throw"biMin is greater than biMax";if(0==n)return t;var r=e.subtract(t);return ct.crypto.Util.getRandomBigIntegerZeroToMax(r).add(t)},ct.crypto.MessageDigest=function(t){this.setAlgAndProvider=function(t,e){if(null!==(t=ct.crypto.MessageDigest.getCanonicalAlgName(t))&&void 0===e&&(e=ct.crypto.Util.DEFAULTPROVIDER[t]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(t)&&"cryptojs"==e){try{this.md=ct.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[t].create()}catch(e){throw"setAlgAndProvider hash alg set fail alg="+t+"/"+e}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=g.enc.Hex.parse(t);this.md.update(e)},this.digest=function(){return this.md.finalize().toString(g.enc.Hex)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}if(-1!=":sha256:".indexOf(t)&&"sjcl"==e){try{this.md=new sjcl.hash.sha256}catch(e){throw"setAlgAndProvider hash alg set fail alg="+t+"/"+e}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=sjcl.codec.hex.toBits(t);this.md.update(e)},this.digest=function(){var t=this.md.finalize();return sjcl.codec.hex.fromBits(t)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}},this.updateString=function(){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(){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(){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},void 0!==t&&void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov&&(this.provName=ct.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},ct.crypto.MessageDigest.getCanonicalAlgName=function(t){return"string"==typeof t&&(t=(t=t.toLowerCase()).replace(/-/,"")),t},ct.crypto.MessageDigest.getHashLength=function(t){var e=ct.crypto.MessageDigest,n=e.getCanonicalAlgName(t);if(void 0===e.HASHLENGTH[n])throw"not supported algorithm: "+t;return e.HASHLENGTH[n]},ct.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20},ct.crypto.Mac=function(t){this.setAlgAndProvider=function(t,e){if(null==(t=t.toLowerCase())&&(t="hmacsha1"),"hmac"!=(t=t.toLowerCase()).substr(0,4))throw"setAlgAndProvider unsupported HMAC alg: "+t;void 0===e&&(e=ct.crypto.Util.DEFAULTPROVIDER[t]),this.algProv=t+"/"+e;var n=t.substr(4);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(n)&&"cryptojs"==e){try{this.mac=g.algo.HMAC.create(ct.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[n],this.pass)}catch(t){throw"setAlgAndProvider hash alg set fail hashAlg="+n+"/"+t}this.updateString=function(t){this.mac.update(t)},this.updateHex=function(t){var e=g.enc.Hex.parse(t);this.mac.update(e)},this.doFinal=function(){return this.mac.finalize().toString(g.enc.Hex)},this.doFinalString=function(t){return this.updateString(t),this.doFinal()},this.doFinalHex=function(t){return this.updateHex(t),this.doFinal()}}},this.updateString=function(){throw"updateString(str) not supported for this alg/prov: "+this.algProv},this.updateHex=function(){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(){throw"digestString(str) not supported for this alg/prov: "+this.algProv},this.doFinalHex=function(){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv},this.setPassword=function(t){if("string"==typeof t){var e=t;return t.length%2!=1&&t.match(/^[0-9A-Fa-f]+$/)||(e=kt(t)),void(this.pass=g.enc.Hex.parse(e))}if("object"!=(void 0===t?"undefined":y(t)))throw"KJUR.crypto.Mac unsupported password type: "+t;if(e=null,void 0!==t.hex){if(t.hex.length%2!=0||!t.hex.match(/^[0-9A-Fa-f]+$/))throw"Mac: wrong hex password: "+t.hex;e=t.hex}if(void 0!==t.utf8&&(e=Et(t.utf8)),void 0!==t.rstr&&(e=kt(t.rstr)),void 0!==t.b64&&(e=S(t.b64)),void 0!==t.b64u&&(e=bt(t.b64u)),null==e)throw"KJUR.crypto.Mac unsupported password type: "+t;this.pass=g.enc.Hex.parse(e)},void 0!==t&&(void 0!==t.pass&&this.setPassword(t.pass),void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov&&(this.provName=ct.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))},ct.crypto.Signature=function(t){var e=null;if(this._setAlgNames=function(){var t=this.algName.match(/^(.+)with(.+)$/);t&&(this.mdAlgName=t[1].toLowerCase(),this.pubkeyAlgName=t[2].toLowerCase(),"rsaandmgf1"==this.pubkeyAlgName&&"sha"==this.mdAlgName&&(this.mdAlgName="sha1"))},this._zeroPaddingOfSignature=function(t,e){for(var n="",r=e/4-t.length,i=0;i<r;i++)n+="0";return n+t},this.setAlgAndProvider=function(t,e){if(this._setAlgNames(),"cryptojs/jsrsa"!=e)throw new Error("provider not supported: "+e);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)){try{this.md=new ct.crypto.MessageDigest({alg:this.mdAlgName})}catch(t){throw new Error("setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+t)}this.init=function(t,e){var n=null;try{n=void 0===e?Ht.getKey(t):Ht.getKey(t,e)}catch(t){throw"init failed:"+t}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(t){this.md.updateString(t)},this.updateHex=function(t){this.md.updateHex(t)},this.sign=function(){if(this.sHashHex=this.md.digest(),void 0===this.prvKey&&void 0!==this.ecprvhex&&void 0!==this.eccurvename&&void 0!==ct.crypto.ECDSA&&(this.prvKey=new ct.crypto.ECDSA({curve:this.eccurvename,prv:this.ecprvhex})),this.prvKey instanceof it&&"rsaandmgf1"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof it&&"rsa"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof ct.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else{if(!(this.prvKey instanceof ct.crypto.DSA))throw"Signature: unsupported private key alg: "+this.pubkeyAlgName;this.hSign=this.prvKey.signWithMessageHash(this.sHashHex)}return this.hSign},this.signString=function(t){return this.updateString(t),this.sign()},this.signHex=function(t){return this.updateHex(t),this.sign()},this.verify=function(t){if(this.sHashHex=this.md.digest(),void 0===this.pubKey&&void 0!==this.ecpubhex&&void 0!==this.eccurvename&&void 0!==ct.crypto.ECDSA&&(this.pubKey=new ct.crypto.ECDSA({curve:this.eccurvename,pub:this.ecpubhex})),this.pubKey instanceof it&&"rsaandmgf1"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,t,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof it&&"rsa"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);if(void 0!==ct.crypto.ECDSA&&this.pubKey instanceof ct.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);if(void 0!==ct.crypto.DSA&&this.pubKey instanceof ct.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.updateString=function(){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(){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(){throw"digestString(str) not supported for this alg:prov="+this.algProvName},this.signHex=function(){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=t,void 0!==t&&(void 0!==t.alg&&(this.algName=t.alg,this.provName=void 0===t.prov?ct.crypto.Util.DEFAULTPROVIDER[this.algName]:t.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),void 0!==t.psssaltlen&&(this.pssSaltLen=t.psssaltlen),void 0!==t.prvkeypem)){if(void 0!==t.prvkeypas)throw"both prvkeypem and prvkeypas parameters not supported";try{e=Ht.getKey(t.prvkeypem),this.init(e)}catch(t){throw"fatal error to load pem private key: "+t}}},ct.crypto.Cipher=function(){},ct.crypto.Cipher.encrypt=function(t,e,n){if(e instanceof it&&e.isPublic){var r=ct.crypto.Cipher.getAlgByKeyAndName(e,n);if("RSA"===r)return e.encrypt(t);if("RSAOAEP"===r)return e.encryptOAEP(t,"sha1");var i=r.match(/^RSAOAEP(\d+)$/);if(null!==i)return e.encryptOAEP(t,"sha"+i[1]);throw"Cipher.encrypt: unsupported algorithm for RSAKey: "+n}throw"Cipher.encrypt: unsupported key or algorithm"},ct.crypto.Cipher.decrypt=function(t,e,n){if(e instanceof it&&e.isPrivate){var r=ct.crypto.Cipher.getAlgByKeyAndName(e,n);if("RSA"===r)return e.decrypt(t);if("RSAOAEP"===r)return e.decryptOAEP(t,"sha1");var i=r.match(/^RSAOAEP(\d+)$/);if(null!==i)return e.decryptOAEP(t,"sha"+i[1]);throw"Cipher.decrypt: unsupported algorithm for RSAKey: "+n}throw"Cipher.decrypt: unsupported key or algorithm"},ct.crypto.Cipher.getAlgByKeyAndName=function(t,e){if(t instanceof it){if(-1!=":RSA:RSAOAEP:RSAOAEP224:RSAOAEP256:RSAOAEP384:RSAOAEP512:".indexOf(e))return e;if(null==e)return"RSA";throw"getAlgByKeyAndName: not supported algorithm name for RSAKey: "+e}throw"getAlgByKeyAndName: not supported algorithm name: "+e},ct.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!==ct&&ct||(e.KJUR=ct={}),void 0!==ct.crypto&&ct.crypto||(ct.crypto={}),ct.crypto.ECDSA=function(t){var e=Error,n=k,r=st,i=ct.crypto.ECDSA,o=ct.crypto.ECParameterDB,s=i.getName,a=lt.getVbyListEx,u=lt.isASN1HEX,c=new et;this.type="EC",this.isPrivate=!1,this.isPublic=!1,this.getBigRandom=function(t){return new n(t.bitLength(),c).mod(t.subtract(n.ONE)).add(n.ONE)},this.setNamedCurve=function(t){this.ecparams=o.getByName(t),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=t},this.setPrivateKeyHex=function(t){this.isPrivate=!0,this.prvKeyHex=t},this.setPublicKeyHex=function(t){this.isPublic=!0,this.pubKeyHex=t},this.getPublicKeyXYHex=function(){var t=this.pubKeyHex;if("04"!==t.substr(0,2))throw"this method supports uncompressed format(04) only";var e=this.ecparams.keylen/4;if(t.length!==2+2*e)throw"malformed public key hex length";var n={};return n.x=t.substr(2,e),n.y=t.substr(2+e),n},this.getShortNISTPCurveName=function(){var t=this.curveName;return"secp256r1"===t||"NIST P-256"===t||"P-256"===t||"prime256v1"===t?"P-256":"secp384r1"===t||"NIST P-384"===t||"P-384"===t?"P-384":null},this.generateKeyPairHex=function(){var t=this.getBigRandom(this.ecparams.n),e=this.ecparams.G.multiply(t),n=e.getX().toBigInteger(),r=e.getY().toBigInteger(),i=this.ecparams.keylen/4,o=("0000000000"+t.toString(16)).slice(-i),s="04"+("0000000000"+n.toString(16)).slice(-i)+("0000000000"+r.toString(16)).slice(-i);return this.setPrivateKeyHex(o),this.setPublicKeyHex(s),{ecprvhex:o,ecpubhex:s}},this.signWithMessageHash=function(t){return this.signHex(t,this.prvKeyHex)},this.signHex=function(t,e){var r=new n(e,16),o=this.ecparams.n,s=new n(t.substring(0,this.ecparams.keylen/4),16);do{var a=this.getBigRandom(o),u=this.ecparams.G.multiply(a).getX().toBigInteger().mod(o)}while(u.compareTo(n.ZERO)<=0);var c=a.modInverse(o).multiply(s.add(r.multiply(u))).mod(o);return i.biRSSigToASN1Sig(u,c)},this.sign=function(t,e){var r=e,i=this.ecparams.n,o=n.fromByteArrayUnsigned(t);do{var s=this.getBigRandom(i),a=this.ecparams.G.multiply(s).getX().toBigInteger().mod(i)}while(a.compareTo(k.ZERO)<=0);var u=s.modInverse(i).multiply(o.add(r.multiply(a))).mod(i);return this.serializeSig(a,u)},this.verifyWithMessageHash=function(t,e){return this.verifyHex(t,e,this.pubKeyHex)},this.verifyHex=function(t,e,o){try{var s,a,u=i.parseSigHex(e);s=u.r,a=u.s;var c=r.decodeFromHex(this.ecparams.curve,o),h=new n(t.substring(0,this.ecparams.keylen/4),16);return this.verifyRaw(h,s,a,c)}catch(t){return!1}},this.verify=function(t,e,i){var o,s,a;if(Bitcoin.Util.isArray(e)){var u=this.parseSig(e);o=u.r,s=u.s}else{if("object"!==(void 0===e?"undefined":y(e))||!e.r||!e.s)throw"Invalid value for signature";o=e.r,s=e.s}if(i instanceof st)a=i;else{if(!Bitcoin.Util.isArray(i))throw"Invalid format for pubkey value, must be byte array or ECPointFp";a=r.decodeFrom(this.ecparams.curve,i)}var c=n.fromByteArrayUnsigned(t);return this.verifyRaw(c,o,s,a)},this.verifyRaw=function(t,e,r,i){var o=this.ecparams.n,s=this.ecparams.G;if(e.compareTo(n.ONE)<0||e.compareTo(o)>=0)return!1;if(r.compareTo(n.ONE)<0||r.compareTo(o)>=0)return!1;var a=r.modInverse(o),u=t.multiply(a).mod(o),c=e.multiply(a).mod(o);return s.multiply(u).add(i.multiply(c)).getX().toBigInteger().mod(o).equals(e)},this.serializeSig=function(t,e){var n=t.toByteArraySigned(),r=e.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(t){var e;if(48!=t[0])throw new Error("Signature not a valid DERSequence");if(2!=t[e=2])throw new Error("First element in signature must be a DERInteger");var r=t.slice(e+2,e+2+t[e+1]);if(2!=t[e+=2+t[e+1]])throw new Error("Second element in signature must be a DERInteger");var i=t.slice(e+2,e+2+t[e+1]);return e+=2+t[e+1],{r:n.fromByteArrayUnsigned(r),s:n.fromByteArrayUnsigned(i)}},this.parseSigCompact=function(t){if(65!==t.length)throw"Signature has the wrong length";var e=t[0]-27;if(e<0||e>7)throw"Invalid signature type";var r=this.ecparams.n;return{r:n.fromByteArrayUnsigned(t.slice(1,33)).mod(r),s:n.fromByteArrayUnsigned(t.slice(33,65)).mod(r),i:e}},this.readPKCS5PrvKeyHex=function(t){if(!1===u(t))throw new Error("not ASN.1 hex string");var e,n,r;try{e=a(t,0,["[0]",0],"06"),n=a(t,0,[1],"04");try{r=a(t,0,["[1]",0],"03")}catch(t){}}catch(t){throw new Error("malformed PKCS#1/5 plain ECC private key")}if(this.curveName=s(e),void 0===this.curveName)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(r),this.setPrivateKeyHex(n),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(t){if(!1===u(t))throw new e("not ASN.1 hex string");var n,r,i;try{a(t,0,[1,0],"06"),n=a(t,0,[1,1],"06"),r=a(t,0,[2,0,1],"04");try{i=a(t,0,[2,0,"[1]",0],"03")}catch(t){}}catch(t){throw new e("malformed PKCS#8 plain ECC private key")}if(this.curveName=s(n),void 0===this.curveName)throw new e("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i),this.setPrivateKeyHex(r),this.isPublic=!1},this.readPKCS8PubKeyHex=function(t){if(!1===u(t))throw new e("not ASN.1 hex string");var n,r;try{a(t,0,[0,0],"06"),n=a(t,0,[0,1],"06"),r=a(t,0,[1],"03")}catch(t){throw new e("malformed PKCS#8 ECC public key")}if(this.curveName=s(n),null===this.curveName)throw new e("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(r)},this.readCertPubKeyHex=function(t){if(!1===u(t))throw new e("not ASN.1 hex string");var n,r;try{n=a(t,0,[0,5,0,1],"06"),r=a(t,0,[0,5,1],"03")}catch(t){throw new e("malformed X.509 certificate ECC public key")}if(this.curveName=s(n),null===this.curveName)throw new e("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(r)},void 0!==t&&void 0!==t.curve&&(this.curveName=t.curve),void 0===this.curveName&&(this.curveName="secp256r1"),this.setNamedCurve(this.curveName),void 0!==t&&(void 0!==t.prv&&this.setPrivateKeyHex(t.prv),void 0!==t.pub&&this.setPublicKeyHex(t.pub))},ct.crypto.ECDSA.parseSigHex=function(t){var e=ct.crypto.ECDSA.parseSigHexInHexRS(t);return{r:new k(e.r,16),s:new k(e.s,16)}},ct.crypto.ECDSA.parseSigHexInHexRS=function(t){var e=lt.getChildIdx,n=lt.getV;if(lt.checkStrictDER(t,0),"30"!=t.substr(0,2))throw new Error("signature is not a ASN.1 sequence");var r=e(t,0);if(2!=r.length)throw new Error("signature shall have two elements");var i=r[0],o=r[1];if("02"!=t.substr(i,2))throw new Error("1st item not ASN.1 integer");if("02"!=t.substr(o,2))throw new Error("2nd item not ASN.1 integer");return{r:n(t,i),s:n(t,o)}},ct.crypto.ECDSA.asn1SigToConcatSig=function(t){var e=ct.crypto.ECDSA.parseSigHexInHexRS(t),n=e.r,r=e.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},ct.crypto.ECDSA.concatSigToASN1Sig=function(t){if(t.length/2*8%128!=0)throw"unknown ECDSA concatinated r-s sig length error";var e=t.substr(0,t.length/2),n=t.substr(t.length/2);return ct.crypto.ECDSA.hexRSSigToASN1Sig(e,n)},ct.crypto.ECDSA.hexRSSigToASN1Sig=function(t,e){var n=new k(t,16),r=new k(e,16);return ct.crypto.ECDSA.biRSSigToASN1Sig(n,r)},ct.crypto.ECDSA.biRSSigToASN1Sig=function(t,e){var n=ct.asn1,r=new n.DERInteger({bigint:t}),i=new n.DERInteger({bigint:e});return new n.DERSequence({array:[r,i]}).getEncodedHex()},ct.crypto.ECDSA.getName=function(t){return"2b8104001f"===t?"secp192k1":"2a8648ce3d030107"===t?"secp256r1":"2b8104000a"===t?"secp256k1":"2b81040021"===t?"secp224r1":"2b81040022"===t?"secp384r1":-1!=="|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(t)?"secp256r1":-1!=="|secp256k1|".indexOf(t)?"secp256k1":-1!=="|secp224r1|NIST P-224|P-224|".indexOf(t)?"secp224r1":-1!=="|secp384r1|NIST P-384|P-384|".indexOf(t)?"secp384r1":null},void 0!==ct&&ct||(e.KJUR=ct={}),void 0!==ct.crypto&&ct.crypto||(ct.crypto={}),ct.crypto.ECParameterDB=new function(){var t={},e={};function n(t){return new k(t,16)}this.getByName=function(n){var r=n;if(void 0!==e[r]&&(r=e[n]),void 0!==t[r])return t[r];throw"unregistered EC curve name: "+r},this.regist=function(r,i,o,s,a,u,c,h,f,l,d,v){t[r]={};var p=n(o),w=n(s),y=n(a),m=n(u),g=n(c),b=new at(p,w,y),E=b.decodePointHex("04"+h+f);t[r].name=r,t[r].keylen=i,t[r].curve=b,t[r].G=E,t[r].n=m,t[r].h=g,t[r].oid=d,t[r].info=v;for(var S=0;S<l.length;S++)e[l[S]]=r}},ct.crypto.ECParameterDB.regist("secp128r1",128,"FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC","E87579C11079F43DD824993C2CEE5ED3","FFFFFFFE0000000075A30D1B9038A115","1","161FF7528B899B2D0C28607CA52C5B86","CF5AC8395BAFEB13C02DA292DDED7A83",[],"","secp128r1 : SECG curve over a 128 bit prime field"),ct.crypto.ECParameterDB.regist("secp160k1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73","0","7","0100000000000000000001B8FA16DFAB9ACA16B6B3","1","3B4C382CE37AA192A4019E763036F4F5DD4D7EBB","938CF935318FDCED6BC28286531733C3F03C4FEE",[],"","secp160k1 : SECG curve over a 160 bit prime field"),ct.crypto.ECParameterDB.regist("secp160r1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC","1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45","0100000000000000000001F4C8F927AED3CA752257","1","4A96B5688EF573284664698968C38BB913CBFC82","23A628553168947D59DCC912042351377AC5FB32",[],"","secp160r1 : SECG curve over a 160 bit prime field"),ct.crypto.ECParameterDB.regist("secp192k1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37","0","3","FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D","1","DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D","9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D",[]),ct.crypto.ECParameterDB.regist("secp192r1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC","64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1","FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831","1","188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012","07192B95FFC8DA78631011ED6B24CDD573F977A11E794811",[]),ct.crypto.ECParameterDB.regist("secp224r1",224,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE","B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4","FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D","1","B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21","BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34",[]),ct.crypto.ECParameterDB.regist("secp256k1",256,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","0","7","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","1","79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8",[]),ct.crypto.ECParameterDB.regist("secp256r1",256,"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC","5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B","FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551","1","6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296","4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5",["NIST P-256","P-256","prime256v1"]),ct.crypto.ECParameterDB.regist("secp384r1",384,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC","B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973","1","AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7","3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f",["NIST P-384","P-384"]),ct.crypto.ECParameterDB.regist("secp521r1",521,"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC","051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409","1","C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66","011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650",["NIST P-521","P-521"]);var Ht=function(){var t=function(t,n,r){return e(g.AES,t,n,r)},e=function(t,e,n,r){var i=g.enc.Hex.parse(e),o=g.enc.Hex.parse(n),s=g.enc.Hex.parse(r),a={};a.key=o,a.iv=s,a.ciphertext=i;var u=t.decrypt(a,o,{iv:s});return g.enc.Hex.stringify(u)},n=function(t,e,n){return r(g.AES,t,e,n)},r=function(t,e,n,r){var i=g.enc.Hex.parse(e),o=g.enc.Hex.parse(n),s=g.enc.Hex.parse(r),a=t.encrypt(i,o,{iv:s}),u=g.enc.Hex.parse(a.toString());return g.enc.Base64.stringify(u)},i={"AES-256-CBC":{proc:t,eproc:n,keylen:32,ivlen:16},"AES-192-CBC":{proc:t,eproc:n,keylen:24,ivlen:16},"AES-128-CBC":{proc:t,eproc:n,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:function(t,n,r){return e(g.TripleDES,t,n,r)},eproc:function(t,e,n){return r(g.TripleDES,t,e,n)},keylen:24,ivlen:8},"DES-CBC":{proc:function(t,n,r){return e(g.DES,t,n,r)},eproc:function(t,e,n){return r(g.DES,t,e,n)},keylen:8,ivlen:8}},o=function(t){var e={},n=t.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));n&&(e.cipher=n[1],e.ivsalt=n[2]);var r=t.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));r&&(e.type=r[1]);var i=-1,o=0;-1!=t.indexOf("\r\n\r\n")&&(i=t.indexOf("\r\n\r\n"),o=2),-1!=t.indexOf("\n\n")&&(i=t.indexOf("\n\n"),o=1);var s=t.indexOf("-----END");if(-1!=i&&-1!=s){var a=t.substring(i+2*o,s-o);a=a.replace(/\s+/g,""),e.data=a}return e},s=function(t,e,n){for(var r=n.substring(0,16),o=g.enc.Hex.parse(r),s=g.enc.Utf8.parse(e),a=i[t].keylen+i[t].ivlen,u="",c=null;;){var h=g.algo.MD5.create();if(null!=c&&h.update(c),h.update(s),h.update(o),c=h.finalize(),(u+=g.enc.Hex.stringify(c)).length>=2*a)break}var f={};return f.keyhex=u.substr(0,2*i[t].keylen),f.ivhex=u.substr(2*i[t].keylen,2*i[t].ivlen),f},a=function(t,e,n,r){var o=g.enc.Base64.parse(t),s=g.enc.Hex.stringify(o);return(0,i[e].proc)(s,n,r)};return{version:"1.0.0",parsePKCS5PEM:function(t){return o(t)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(t,e,n){return s(t,e,n)},decryptKeyB64:function(t,e,n,r){return a(t,e,n,r)},getDecryptedKeyHex:function(t,e){var n=o(t),r=n.cipher,i=n.ivsalt,u=n.data,c=s(r,e,i).keyhex;return a(u,r,c,i)},getEncryptedPKCS5PEMFromPrvKeyHex:function(t,e,n,r,o){var a,u,c="";if(void 0!==r&&null!=r||(r="AES-256-CBC"),void 0===i[r])throw new Error("KEYUTIL unsupported algorithm: "+r);void 0!==o&&null!=o||(o=(a=i[r].ivlen,u=g.lib.WordArray.random(a),g.enc.Hex.stringify(u)).toUpperCase());var h=function(t,e,n,r){return(0,i[e].eproc)(t,n,r)}(e,r,s(r,n,o).keyhex,o);return c="-----BEGIN "+t+" PRIVATE KEY-----\r\n",c+="Proc-Type: 4,ENCRYPTED\r\n",c+="DEK-Info: "+r+","+o+"\r\n",c+="\r\n",(c+=h.replace(/(.{64})/g,"$1\r\n"))+"\r\n-----END "+t+" PRIVATE KEY-----\r\n"},parseHexOfEncryptedPKCS8:function(t){var e=lt.getChildIdx,n=lt.getV,r={},i=e(t,0);if(2!=i.length)throw new Error("malformed format: SEQUENCE(0).items != 2: "+i.length);r.ciphertext=n(t,i[1]);var o=e(t,i[0]);if(2!=o.length)throw new Error("malformed format: SEQUENCE(0.0).items != 2: "+o.length);if("2a864886f70d01050d"!=n(t,o[0]))throw new Error("this only supports pkcs5PBES2");var s=e(t,o[1]);if(2!=o.length)throw new Error("malformed format: SEQUENCE(0.0.1).items != 2: "+s.length);var a=e(t,s[1]);if(2!=a.length)throw new Error("malformed format: SEQUENCE(0.0.1.1).items != 2: "+a.length);if("2a864886f70d0307"!=n(t,a[0]))throw"this only supports TripleDES";r.encryptionSchemeAlg="TripleDES",r.encryptionSchemeIV=n(t,a[1]);var u=e(t,s[0]);if(2!=u.length)throw new Error("malformed format: SEQUENCE(0.0.1.0).items != 2: "+u.length);if("2a864886f70d01050c"!=n(t,u[0]))throw new Error("this only supports pkcs5PBKDF2");var c=e(t,u[1]);if(c.length<2)throw new Error("malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+c.length);r.pbkdf2Salt=n(t,c[0]);var h=n(t,c[1]);try{r.pbkdf2Iter=parseInt(h,16)}catch(t){throw new Error("malformed format pbkdf2Iter: "+h)}return r},getPBKDF2KeyHexFromParam:function(t,e){var n=g.enc.Hex.parse(t.pbkdf2Salt),r=g.PBKDF2(e,n,{keySize:6,iterations:t.pbkdf2Iter});return g.enc.Hex.stringify(r)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(t,e){var n=Ct(t,"ENCRYPTED PRIVATE KEY"),r=this.parseHexOfEncryptedPKCS8(n),i=Ht.getPBKDF2KeyHexFromParam(r,e),o={};o.ciphertext=g.enc.Hex.parse(r.ciphertext);var s=g.enc.Hex.parse(i),a=g.enc.Hex.parse(r.encryptionSchemeIV),u=g.TripleDES.decrypt(o,s,{iv:a});return g.enc.Hex.stringify(u)},getKeyFromEncryptedPKCS8PEM:function(t,e){var n=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(t,e);return this.getKeyFromPlainPrivatePKCS8Hex(n)},parsePlainPrivatePKCS8Hex:function(t){var e=lt,n=e.getChildIdx,r=e.getV,i={algparam:null};if("30"!=t.substr(0,2))throw new Error("malformed plain PKCS8 private key(code:001)");var o=n(t,0);if(o.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if("30"!=t.substr(o[1],2))throw new Error("malformed PKCS8 private key(code:003)");var s=n(t,o[1]);if(2!=s.length)throw new Error("malformed PKCS8 private key(code:004)");if("06"!=t.substr(s[0],2))throw new Error("malformed PKCS8 private key(code:005)");if(i.algoid=r(t,s[0]),"06"==t.substr(s[1],2)&&(i.algparam=r(t,s[1])),"04"!=t.substr(o[2],2))throw new Error("malformed PKCS8 private key(code:006)");return i.keyidx=e.getVidx(t,o[2]),i},getKeyFromPlainPrivatePKCS8PEM:function(t){var e=Ct(t,"PRIVATE KEY");return this.getKeyFromPlainPrivatePKCS8Hex(e)},getKeyFromPlainPrivatePKCS8Hex:function(t){var e,n=this.parsePlainPrivatePKCS8Hex(t);if("2a864886f70d010101"==n.algoid)e=new it;else if("2a8648ce380401"==n.algoid)e=new ct.crypto.DSA;else{if("2a8648ce3d0201"!=n.algoid)throw new Error("unsupported private key algorithm");e=new ct.crypto.ECDSA}return e.readPKCS8PrvKeyHex(t),e},_getKeyFromPublicPKCS8Hex:function(t){var e,n=lt.getVbyList(t,0,[0,0],"06");if("2a864886f70d010101"===n)e=new it;else if("2a8648ce380401"===n)e=new ct.crypto.DSA;else{if("2a8648ce3d0201"!==n)throw new Error("unsupported PKCS#8 public key hex");e=new ct.crypto.ECDSA}return e.readPKCS8PubKeyHex(t),e},parsePublicRawRSAKeyHex:function(t){var e=lt.getChildIdx,n=lt.getV,r={};if("30"!=t.substr(0,2))throw new Error("malformed RSA key(code:001)");var i=e(t,0);if(2!=i.length)throw new Error("malformed RSA key(code:002)");if("02"!=t.substr(i[0],2))throw new Error("malformed RSA key(code:003)");if(r.n=n(t,i[0]),"02"!=t.substr(i[1],2))throw new Error("malformed RSA key(code:004)");return r.e=n(t,i[1]),r},parsePublicPKCS8Hex:function(t){var e=lt,n=e.getChildIdx,r=e.getV,i={algparam:null},o=n(t,0);if(2!=o.length)throw new Error("outer DERSequence shall have 2 elements: "+o.length);var s=o[0];if("30"!=t.substr(s,2))throw new Error("malformed PKCS8 public key(code:001)");var a=n(t,s);if(2!=a.length)throw new Error("malformed PKCS8 public key(code:002)");if("06"!=t.substr(a[0],2))throw new Error("malformed PKCS8 public key(code:003)");if(i.algoid=r(t,a[0]),"06"==t.substr(a[1],2)?i.algparam=r(t,a[1]):"30"==t.substr(a[1],2)&&(i.algparam={},i.algparam.p=e.getVbyList(t,a[1],[0],"02"),i.algparam.q=e.getVbyList(t,a[1],[1],"02"),i.algparam.g=e.getVbyList(t,a[1],[2],"02")),"03"!=t.substr(o[1],2))throw new Error("malformed PKCS8 public key(code:004)");return i.key=r(t,o[1]).substr(2),i}}}();function $t(t,e){for(var n="",r=e/4-t.length,i=0;i<r;i++)n+="0";return n+t}function Wt(t,e,n){for(var r="",i=0;r.length<e;)r+=Ft(n(kt(t+String.fromCharCode.apply(String,[(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i])))),i+=1;return r}function qt(t){for(var e in ct.crypto.Util.DIGESTINFOHEAD){var n=ct.crypto.Util.DIGESTINFOHEAD[e],r=n.length;if(t.substring(0,r)==n)return[e,t.substring(r)]}return[]}function Vt(t){var e,n=lt,r=n.getChildIdx,i=n.getV,o=n.getTLV,s=n.getVbyList,a=n.getVbyListEx,u=n.getTLVbyList,c=n.getTLVbyListEx,h=n.getIdxbyList,f=n.getIdxbyListEx,l=n.getVidx,d=n.getInt,v=n.oidname,p=n.hextooidstr,w=Ct;try{e=ct.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(t){}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 t=u(this.hex,0,[0,0]);if("a0"==t.substr(0,2)){var e=u(t,0,[0]),n=d(e,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 a(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var t=c(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(t)},this.getAlgorithmIdentifierName=function(t){for(var n in e)if(t===e[n])return n;return v(a(t,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 t=s(this.hex,0,[0,4+this.foffset,0]);return t=t.replace(/(..)/g,"%$1"),decodeURIComponent(t)},this.getNotAfter=function(){var t=s(this.hex,0,[0,4+this.foffset,1]);return t=t.replace(/(..)/g,"%$1"),decodeURIComponent(t)},this.getPublicKeyHex=function(){return n.getTLVbyList(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyIdx=function(){return h(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var t=this.getPublicKeyIdx();return h(this.hex,t,[1,0],"30")},this.getPublicKey=function(){return Ht.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var t=u(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(t)},this.getSignatureValueHex=function(){return s(this.hex,0,[2],"03",!0)},this.verifySignature=function(t){var e=this.getSignatureAlgorithmField(),n=this.getSignatureValueHex(),r=u(this.hex,0,[0],"30"),i=new ct.crypto.Signature({alg:e});return i.init(t),i.updateHex(r),i.verify(n)},this.parseExt=function(t){var e,o,a;if(void 0===t){if(3!==this.version)return-1;e=h(a=this.hex,0,[0,7,0],"30"),o=r(a,e)}else{a=Ct(t);var u=h(a,0,[0,3,0,0],"06");if("2a864886f70d01090e"!=i(a,u))return void(this.aExtInfo=new Array);e=h(a,0,[0,3,0,1,0],"30"),o=r(a,e),this.hex=a}this.aExtInfo=new Array;for(var c=0;c<o.length;c++){var f={critical:!1},d=0;3===r(a,o[c]).length&&(f.critical=!0,d=1),f.oid=n.hextooidstr(s(a,o[c],[0],"06"));var v=h(a,o[c],[1+d]);f.vidx=l(a,v),this.aExtInfo.push(f)}},this.getExtInfo=function(t){var e=this.aExtInfo,n=t;if(t.match(/^[0-9.]+$/)||(n=ct.asn1.x509.OID.name2oid(t)),""!==n)for(var r=0;r<e.length;r++)if(e[r].oid===n)return e[r]},this.getExtBasicConstraints=function(t,e){if(void 0===t&&void 0===e){var n=this.getExtInfo("basicConstraints");if(void 0===n)return;t=o(this.hex,n.vidx),e=n.critical}var r={extname:"basicConstraints"};if(e&&(r.critical=!0),"3000"===t)return r;if("30030101ff"===t)return r.cA=!0,r;if("30060101ff02"===t.substr(0,12)){var s=i(t,10),a=parseInt(s,16);return r.cA=!0,r.pathLen=a,r}throw new Error("hExtV parse error: "+t)},this.getExtKeyUsage=function(t,e){if(void 0===t&&void 0===e){var n=this.getExtInfo("keyUsage");if(void 0===n)return;t=o(this.hex,n.vidx),e=n.critical}var r={extname:"keyUsage"};return e&&(r.critical=!0),r.names=this.getExtKeyUsageString(t).split(","),r},this.getExtKeyUsageBin=function(t){if(void 0===t){var e=this.getExtInfo("keyUsage");if(void 0===e)return"";t=o(this.hex,e.vidx)}if(8!=t.length&&10!=t.length)throw new Error("malformed key usage value: "+t);var n="000000000000000"+parseInt(t.substr(6),16).toString(2);return 8==t.length&&(n=n.slice(-8)),10==t.length&&(n=n.slice(-16)),""==(n=n.replace(/0+$/,""))&&(n="0"),n},this.getExtKeyUsageString=function(t){for(var e=this.getExtKeyUsageBin(t),n=new Array,r=0;r<e.length;r++)"1"==e.substr(r,1)&&n.push(Vt.KEYUSAGE_NAME[r]);return n.join(",")},this.getExtSubjectKeyIdentifier=function(t,e){if(void 0===t&&void 0===e){var n=this.getExtInfo("subjectKeyIdentifier");if(void 0===n)return;t=o(this.hex,n.vidx),e=n.critical}var r={extname:"subjectKeyIdentifier"};e&&(r.critical=!0);var s=i(t,0);return r.kid={hex:s},r},this.getExtAuthorityKeyIdentifier=function(t,e){if(void 0===t&&void 0===e){var n=this.getExtInfo("authorityKeyIdentifier");if(void 0===n)return;t=o(this.hex,n.vidx),e=n.critical}var s={extname:"authorityKeyIdentifier"};e&&(s.critical=!0);for(var a=r(t,0),u=0;u<a.length;u++){var c=t.substr(a[u],2);if("80"===c&&(s.kid={hex:i(t,a[u])}),"a1"===c){var h=o(t,a[u]),f=this.getGeneralNames(h);s.issuer=f[0].dn}"82"===c&&(s.sn={hex:i(t,a[u])})}return s},this.getExtExtKeyUsage=function(t,e){if(void 0===t&&void 0===e){var n=this.getExtInfo("extKeyUsage");if(void 0===n)return;t=o(this.hex,n.vidx),e=n.critical}var s={extname:"extKeyUsage",array:[]};e&&(s.critical=!0);for(var a=r(t,0),u=0;u<a.length;u++)s.array.push(v(i(t,a[u])));return s},this.getExtExtKeyUsageName=function(){var t=this.getExtInfo("extKeyUsage");if(void 0===t)return t;var e=new Array,n=o(this.hex,t.vidx);if(""===n)return e;for(var s=r(n,0),a=0;a<s.length;a++)e.push(v(i(n,s[a])));return e},this.getExtSubjectAltName=function(t,e){if(void 0===t&&void 0===e){var n=this.getExtInfo("subjectAltName");if(void 0===n)return;t=o(this.hex,n.vidx),e=n.critical}var r={extname:"subjectAltName",array:[]};return e&&(r.critical=!0),r.array=this.getGeneralNames(t),r},this.getExtIssuerAltName=function(t,e){if(void 0===t&&void 0===e){var n=this.getExtInfo("issuerAltName");if(void 0===n)return;t=o(this.hex,n.vidx),e=n.critical}var r={extname:"issuerAltName",array:[]};return e&&(r.critical=!0),r.array=this.getGeneralNames(t),r},this.getGeneralNames=function(t){for(var e=r(t,0),n=[],i=0;i<e.length;i++){var s=this.getGeneralName(o(t,e[i]));void 0!==s&&n.push(s)}return n},this.getGeneralName=function(t){var e=t.substr(0,2),n=i(t,0),r=Ft(n);return"81"==e?{rfc822:r}:"82"==e?{dns:r}:"86"==e?{uri:r}:"87"==e?{ip:Dt(n)}:"a4"==e?{dn:this.getX500Name(n)}:void 0},this.getExtSubjectAltName2=function(){var t,e,n,s=this.getExtInfo("subjectAltName");if(void 0===s)return s;for(var a=new Array,u=o(this.hex,s.vidx),c=r(u,0),h=0;h<c.length;h++)n=u.substr(c[h],2),t=i(u,c[h]),"81"===n&&(e=St(t),a.push(["MAIL",e])),"82"===n&&(e=St(t),a.push(["DNS",e])),"84"===n&&(e=Vt.hex2dn(t,0),a.push(["DN",e])),"86"===n&&(e=St(t),a.push(["URI",e])),"87"===n&&(e=Dt(t),a.push(["IP",e]));return a},this.getExtCRLDistributionPoints=function(t,e){if(void 0===t&&void 0===e){var n=this.getExtInfo("cRLDistributionPoints");if(void 0===n)return;t=o(this.hex,n.vidx),e=n.critical}var i={extname:"cRLDistributionPoints",array:[]};e&&(i.critical=!0);for(var s=r(t,0),a=0;a<s.length;a++){var u=o(t,s[a]);i.array.push(this.getDistributionPoint(u))}return i},this.getDistributionPoint=function(t){for(var e={},n=r(t,0),i=0;i<n.length;i++){var s=t.substr(n[i],2),a=o(t,n[i]);"a0"==s&&(e.dpname=this.getDistributionPointName(a))}return e},this.getDistributionPointName=function(t){for(var e={},n=r(t,0),i=0;i<n.length;i++){var s=t.substr(n[i],2),a=o(t,n[i]);"a0"==s&&(e.full=this.getGeneralNames(a))}return e},this.getExtCRLDistributionPointsURI=function(){var t=this.getExtInfo("cRLDistributionPoints");if(void 0===t)return t;for(var e=new Array,n=r(this.hex,t.vidx),i=0;i<n.length;i++)try{var o=St(s(this.hex,n[i],[0,0,0],"86"));e.push(o)}catch(t){}return e},this.getExtAIAInfo=function(){var t=this.getExtInfo("authorityInfoAccess");if(void 0===t)return t;for(var e={ocsp:[],caissuer:[]},n=r(this.hex,t.vidx),i=0;i<n.length;i++){var o=s(this.hex,n[i],[0],"06"),a=s(this.hex,n[i],[1],"86");"2b06010505073001"===o&&e.ocsp.push(St(a)),"2b06010505073002"===o&&e.caissuer.push(St(a))}return e},this.getExtAuthorityInfoAccess=function(t,e){if(void 0===t&&void 0===e){var n=this.getExtInfo("authorityInfoAccess");if(void 0===n)return;t=o(this.hex,n.vidx),e=n.critical}var i={extname:"authorityInfoAccess",array:[]};e&&(i.critical=!0);for(var u=r(t,0),c=0;c<u.length;c++){var h=a(t,u[c],[0],"06"),f=St(s(t,u[c],[1],"86"));if("2b06010505073001"==h)i.array.push({ocsp:f});else{if("2b06010505073002"!=h)throw new Error("unknown method: "+h);i.array.push({caissuer:f})}}return i},this.getExtCertificatePolicies=function(t,e){if(void 0===t&&void 0===e){var n=this.getExtInfo("certificatePolicies");if(void 0===n)return;t=o(this.hex,n.vidx),e=n.critical}var i={extname:"certificatePolicies",array:[]};e&&(i.critical=!0);for(var s=r(t,0),a=0;a<s.length;a++){var u=o(t,s[a]),c=this.getPolicyInformation(u);i.array.push(c)}return i},this.getPolicyInformation=function(t){var e={},n=s(t,0,[0],"06");e.policyoid=v(n);var i=f(t,0,[1],"30");if(-1!=i){e.array=[];for(var a=r(t,i),u=0;u<a.length;u++){var c=o(t,a[u]),h=this.getPolicyQualifierInfo(c);e.array.push(h)}}return e},this.getPolicyQualifierInfo=function(t){var e={},n=s(t,0,[0],"06");if("2b06010505070201"===n){var r=a(t,0,[1],"16");e.cps=Ft(r)}else if("2b06010505070202"===n){var i=u(t,0,[1],"30");e.unotice=this.getUserNotice(i)}return e},this.getUserNotice=function(t){for(var e={},n=r(t,0),i=0;i<n.length;i++){var s=o(t,n[i]);"30"!=s.substr(0,2)&&(e.exptext=this.getDisplayText(s))}return e},this.getDisplayText=function(t){var e={};return e.type={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"}[t.substr(0,2)],e.str=Ft(i(t,0)),e},this.getExtCRLNumber=function(t,e){var n={extname:"cRLNumber"};if(e&&(n.critical=!0),"02"==t.substr(0,2))return n.num={hex:i(t,0)},n;throw new Error("hExtV parse error: "+t)},this.getExtCRLReason=function(t,e){var n={extname:"cRLReason"};if(e&&(n.critical=!0),"0a"==t.substr(0,2))return n.code=parseInt(i(t,0),16),n;throw new Error("hExtV parse error: "+t)},this.getExtOcspNonce=function(t,e){var n={extname:"ocspNonce"};e&&(n.critical=!0);var r=i(t,0);return n.hex=r,n},this.getExtOcspNoCheck=function(t,e){var n={extname:"ocspNoCheck"};return e&&(n.critical=!0),n},this.getExtAdobeTimeStamp=function(t,e){if(void 0===t&&void 0===e){var n=this.getExtInfo("adobeTimeStamp");if(void 0===n)return;t=o(this.hex,n.vidx),e=n.critical}var i={extname:"adobeTimeStamp"};e&&(i.critical=!0);var s=r(t,0);if(s.length>1){var a=o(t,s[1]),u=this.getGeneralName(a);null!=u.uri&&(i.uri=u.uri)}if(s.length>2){var c=o(t,s[2]);"0101ff"==c&&(i.reqauth=!0),"010100"==c&&(i.reqauth=!1)}return i},this.getX500NameRule=function(t){for(var e=null,n=[],r=0;r<t.length;r++)for(var i=t[r],o=0;o<i.length;o++)n.push(i[o]);for(r=0;r<n.length;r++){var s=n[r],a=s.ds,u=s.type;if("prn"!=a&&"utf8"!=a&&"ia5"!=a)return"mixed";if("ia5"==a){if("CN"!=u)return"mixed";if(ct.lang.String.isMail(s.value))continue;return"mixed"}if("C"==u){if("prn"==a)continue;return"mixed"}if(null==e)e=a;else if(e!==a)return"mixed"}return null==e?"prn":e},this.getX500Name=function(t){var e=this.getX500NameArray(t);return{array:e,str:this.dnarraytostr(e)}},this.getX500NameArray=function(t){for(var e=[],n=r(t,0),i=0;i<n.length;i++)e.push(this.getRDN(o(t,n[i])));return e},this.getRDN=function(t){for(var e=[],n=r(t,0),i=0;i<n.length;i++)e.push(this.getAttrTypeAndValue(o(t,n[i])));return e},this.getAttrTypeAndValue=function(t){var e={type:null,value:null,ds:null},n=r(t,0),i=s(t,n[0],[],"06"),o=s(t,n[1],[]),a=ct.asn1.ASN1Util.oidHexToInt(i);return e.type=ct.asn1.x509.OID.oid2atype(a),e.ds=this.HEX2STAG[t.substr(n[1],2)],e.value="bmp"!=e.ds?St(o):Mt(o),e},this.readCertPEM=function(t){this.readCertHex(w(t))},this.readCertHex=function(t){this.hex=t,this.getVersion();try{h(this.hex,0,[0,7],"a3"),this.parseExt()}catch(t){}},this.getParam=function(){var t={};return t.version=this.getVersion(),t.serial={hex:this.getSerialNumberHex()},t.sigalg=this.getSignatureAlgorithmField(),t.issuer=this.getIssuer(),t.notbefore=this.getNotBefore(),t.notafter=this.getNotAfter(),t.subject=this.getSubject(),t.sbjpubkey=jt(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo.length>0&&(t.ext=this.getExtParamArray()),t.sighex=this.getSignatureValueHex(),t},this.getExtParamArray=function(t){null==t&&-1!=f(this.hex,0,[0,"[3]"])&&(t=c(this.hex,0,[0,"[3]",0],"30"));for(var e=[],n=r(t,0),i=0;i<n.length;i++){var s=o(t,n[i]),a=this.getExtParam(s);null!=a&&e.push(a)}return e},this.getExtParam=function(t){var e=r(t,0).length;if(2!=e&&3!=e)throw new Error("wrong number elements in Extension: "+e+" "+t);var n=p(s(t,0,[0],"06")),i=!1;3==e&&"0101ff"==u(t,0,[1])&&(i=!0);var o=u(t,0,[e-1,0]),a=void 0;if("2.5.29.14"==n?a=this.getExtSubjectKeyIdentifier(o,i):"2.5.29.15"==n?a=this.getExtKeyUsage(o,i):"2.5.29.17"==n?a=this.getExtSubjectAltName(o,i):"2.5.29.18"==n?a=this.getExtIssuerAltName(o,i):"2.5.29.19"==n?a=this.getExtBasicConstraints(o,i):"2.5.29.31"==n?a=this.getExtCRLDistributionPoints(o,i):"2.5.29.32"==n?a=this.getExtCertificatePolicies(o,i):"2.5.29.35"==n?a=this.getExtAuthorityKeyIdentifier(o,i):"2.5.29.37"==n?a=this.getExtExtKeyUsage(o,i):"1.3.6.1.5.5.7.1.1"==n?a=this.getExtAuthorityInfoAccess(o,i):"2.5.29.20"==n?a=this.getExtCRLNumber(o,i):"2.5.29.21"==n?a=this.getExtCRLReason(o,i):"1.3.6.1.5.5.7.48.1.2"==n?a=this.getExtOcspNonce(o,i):"1.3.6.1.5.5.7.48.1.5"==n?a=this.getExtOcspNoCheck(o,i):"1.2.840.113583.1.1.9.1"==n&&(a=this.getExtAdobeTimeStamp(o,i)),null!=a)return a;var c={extname:n,extn:o};return i&&(c.critical=!0),c},this.findExt=function(t,e){for(var n=0;n<t.length;n++)if(t[n].extname==e)return t[n];return null},this.updateExtCDPFullURI=function(t,e){var n=this.findExt(t,"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 o=r[i].dpname.full,s=0;s<o.length;s++){var a=o[i];null!=a.uri&&(a.uri=e)}},this.updateExtAIAOCSP=function(t,e){var n=this.findExt(t,"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=e)},this.updateExtAIACAIssuer=function(t,e){var n=this.findExt(t,"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=e)},this.dnarraytostr=function(t){return"/"+t.map((function(t){return(e=t,e.map((function(t){return(e=t,e.type+"="+e.value).replace(/\+/,"\\+");var e})).join("+")).replace(/\//,"\\/");var e})).join("/")},this.getInfo=function(){var t,e,n,r,i=function(t){for(var e="",n=t.array,r=0;r<n.length;r++){var i=n[r];if(e+=" policy oid: "+i.policyoid+"\n",void 0!==i.array)for(var o=0;o<i.array.length;o++){var s=i.array[o];void 0!==s.cps&&(e+=" cps: "+s.cps+"\n")}}return e},o=function(t){for(var e="",n=t.array,r=0;r<n.length;r++){var i=n[r];try{void 0!==i.dpname.full[0].uri&&(e+=" "+i.dpname.full[0].uri+"\n")}catch(t){}try{void 0!==i.dname.full[0].dn.hex&&(e+=" "+Vt.hex2dn(i.dpname.full[0].dn.hex)+"\n")}catch(t){}}return e},s=function(t){for(var e="",n=t.array,r=0;r<n.length;r++){var i=n[r];void 0!==i.caissuer&&(e+=" caissuer: "+i.caissuer+"\n"),void 0!==i.ocsp&&(e+=" ocsp: "+i.ocsp+"\n")}return e};if(t="Basic Fields\n",t+=" serial number: "+this.getSerialNumberHex()+"\n",t+=" signature algorithm: "+this.getSignatureAlgorithmField()+"\n",t+=" issuer: "+this.getIssuerString()+"\n",t+=" notBefore: "+this.getNotBefore()+"\n",t+=" notAfter: "+this.getNotAfter()+"\n",t+=" subject: "+this.getSubjectString()+"\n",t+=" subject public key info: \n",t+=" key algorithm: "+(e=this.getPublicKey()).type+"\n","RSA"===e.type&&(t+=" n="+Bt(e.n.toString(16)).substr(0,16)+"...\n",t+=" e="+Bt(e.e.toString(16))+"\n"),null!=(n=this.aExtInfo)){t+="X509v3 Extensions:\n";for(var a=0;a<n.length;a++){var u=n[a],c=ct.asn1.x509.OID.oid2name(u.oid);""===c&&(c=u.oid);var h="";if(!0===u.critical&&(h="CRITICAL"),t+=" "+c+" "+h+":\n","basicConstraints"===c){var f=this.getExtBasicConstraints();void 0===f.cA?t+=" {}\n":(t+=" cA=true",void 0!==f.pathLen&&(t+=", pathLen="+f.pathLen),t+="\n")}else if("keyUsage"===c)t+=" "+this.getExtKeyUsageString()+"\n";else if("subjectKeyIdentifier"===c)t+=" "+this.getExtSubjectKeyIdentifier().kid.hex+"\n";else if("authorityKeyIdentifier"===c){var l=this.getExtAuthorityKeyIdentifier();void 0!==l.kid&&(t+=" kid="+l.kid.hex+"\n")}else"extKeyUsage"===c?t+=" "+this.getExtExtKeyUsage().array.join(", ")+"\n":"subjectAltName"===c?t+=" "+(r=this.getExtSubjectAltName(),JSON.stringify(r.array).replace(/[\[\]\{\}\"]/g,"")+"\n"):"cRLDistributionPoints"===c?t+=o(this.getExtCRLDistributionPoints()):"authorityInfoAccess"===c?t+=s(this.getExtAuthorityInfoAccess()):"certificatePolicies"===c&&(t+=i(this.getExtCertificatePolicies()))}}return(t+="signature algorithm: "+this.getSignatureAlgorithmName()+"\n")+"signature: "+this.getSignatureValueHex().substr(0,16)+"...\n"},"string"==typeof t&&(-1!=t.indexOf("-----BEGIN")?this.readCertPEM(t):ct.lang.String.isHex(t)&&this.readCertHex(t))}Ht.getKey=function(t,e,n){var r,i=(y=lt).getChildIdx,o=y.getVbyList,s=ct.crypto,a=s.ECDSA,u=s.DSA,c=it,h=Ct,f=Ht;if(void 0!==c&&t instanceof c)return t;if(void 0!==a&&t instanceof a)return t;if(void 0!==u&&t instanceof u)return t;if(void 0!==t.curve&&void 0!==t.xy&&void 0===t.d)return new a({pub:t.xy,curve:t.curve});if(void 0!==t.curve&&void 0!==t.d)return new a({prv:t.d,curve:t.curve});if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(C=new c).setPublic(t.n,t.e),C;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.co&&void 0===t.qi)return(C=new c).setPrivateEx(t.n,t.e,t.d,t.p,t.q,t.dp,t.dq,t.co),C;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0===t.p)return(C=new c).setPrivate(t.n,t.e,t.d),C;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0===t.x)return(C=new u).setPublic(t.p,t.q,t.g,t.y),C;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0!==t.x)return(C=new u).setPrivate(t.p,t.q,t.g,t.y,t.x),C;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(C=new c).setPublic(bt(t.n),bt(t.e)),C;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.qi)return(C=new c).setPrivateEx(bt(t.n),bt(t.e),bt(t.d),bt(t.p),bt(t.q),bt(t.dp),bt(t.dq),bt(t.qi)),C;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d)return(C=new c).setPrivate(bt(t.n),bt(t.e),bt(t.d)),C;if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0===t.d){var l=(j=new a({curve:t.crv})).ecparams.keylen/4,d="04"+("0000000000"+bt(t.x)).slice(-l)+("0000000000"+bt(t.y)).slice(-l);return j.setPublicKeyHex(d),j}if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0!==t.d){l=(j=new a({curve:t.crv})).ecparams.keylen/4,d="04"+("0000000000"+bt(t.x)).slice(-l)+("0000000000"+bt(t.y)).slice(-l);var v=("0000000000"+bt(t.d)).slice(-l);return j.setPublicKeyHex(d),j.setPrivateKeyHex(v),j}if("pkcs5prv"===n){var p,w=t,y=lt;if(9===(p=i(w,0)).length)(C=new c).readPKCS5PrvKeyHex(w);else if(6===p.length)(C=new u).readPKCS5PrvKeyHex(w);else{if(!(p.length>2&&"04"===w.substr(p[1],2)))throw new Error("unsupported PKCS#1/5 hexadecimal key");(C=new a).readPKCS5PrvKeyHex(w)}return C}if("pkcs8prv"===n)return f.getKeyFromPlainPrivatePKCS8Hex(t);if("pkcs8pub"===n)return f._getKeyFromPublicPKCS8Hex(t);if("x509pub"===n)return Vt.getPublicKeyFromCertHex(t);if(-1!=t.indexOf("-END CERTIFICATE-",0)||-1!=t.indexOf("-END X509 CERTIFICATE-",0)||-1!=t.indexOf("-END TRUSTED CERTIFICATE-",0))return Vt.getPublicKeyFromCertPEM(t);if(-1!=t.indexOf("-END PUBLIC KEY-")){var m=Ct(t,"PUBLIC KEY");return f._getKeyFromPublicPKCS8Hex(m)}if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var g=h(t,"RSA PRIVATE KEY");return f.getKey(g,null,"pkcs5prv")}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var b=o(r=h(t,"DSA PRIVATE KEY"),0,[1],"02"),E=o(r,0,[2],"02"),S=o(r,0,[3],"02"),F=o(r,0,[4],"02"),x=o(r,0,[5],"02");return(C=new u).setPrivate(new k(b,16),new k(E,16),new k(S,16),new k(F,16),new k(x,16)),C}if(-1!=t.indexOf("-END EC PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED"))return g=h(t,"EC PRIVATE KEY"),f.getKey(g,null,"pkcs5prv");if(-1!=t.indexOf("-END PRIVATE KEY-"))return f.getKeyFromPlainPrivatePKCS8PEM(t);if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var _=f.getDecryptedKeyHex(t,e),A=new it;return A.readPKCS5PrvKeyHex(_),A}if(-1!=t.indexOf("-END EC PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var j,C=o(r=f.getDecryptedKeyHex(t,e),0,[1],"04"),R=o(r,0,[2,0],"06"),T=o(r,0,[3,0],"03").substr(2);if(void 0===ct.crypto.OID.oidhex2name[R])throw new Error("undefined OID(hex) in KJUR.crypto.OID: "+R);return(j=new a({curve:ct.crypto.OID.oidhex2name[R]})).setPublicKeyHex(T),j.setPrivateKeyHex(C),j.isPublic=!1,j}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED"))return b=o(r=f.getDecryptedKeyHex(t,e),0,[1],"02"),E=o(r,0,[2],"02"),S=o(r,0,[3],"02"),F=o(r,0,[4],"02"),x=o(r,0,[5],"02"),(C=new u).setPrivate(new k(b,16),new k(E,16),new k(S,16),new k(F,16),new k(x,16)),C;if(-1!=t.indexOf("-END ENCRYPTED PRIVATE KEY-"))return f.getKeyFromEncryptedPKCS8PEM(t,e);throw new Error("not supported argument")},Ht.generateKeypair=function(t,e){if("RSA"==t){var n=e;(s=new it).generate(n,"10001"),s.isPrivate=!0,s.isPublic=!0;var r=new it,i=s.n.toString(16),o=s.e.toString(16);return r.setPublic(i,o),r.isPrivate=!1,r.isPublic=!0,(a={}).prvKeyObj=s,a.pubKeyObj=r,a}if("EC"==t){var s,a,u=e,c=new ct.crypto.ECDSA({curve:u}).generateKeyPairHex();return(s=new ct.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),s.setPrivateKeyHex(c.ecprvhex),s.isPrivate=!0,s.isPublic=!1,(r=new ct.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),r.isPrivate=!1,r.isPublic=!0,(a={}).prvKeyObj=s,a.pubKeyObj=r,a}throw new Error("unknown algorithm: "+t)},Ht.getPEM=function(t,e,n,r,i,o){var s=ct.asn1,a=s.DERObjectIdentifier,u=s.DERInteger,c=s.ASN1Util.newObject,h=ct.crypto,f=h.DSA,l=h.ECDSA,d=it;function v(t){return c({seq:[{int:0},{int:{bigint:t.n}},{int:t.e},{int:{bigint:t.d}},{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.dmp1}},{int:{bigint:t.dmq1}},{int:{bigint:t.coeff}}]})}function p(t){return c({seq:[{int:1},{octstr:{hex:t.prvKeyHex}},{tag:["a0",!0,{oid:{name:t.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]}]})}function w(t){return c({seq:[{int:0},{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}},{int:{bigint:t.y}},{int:{bigint:t.x}}]})}if((void 0!==d&&t instanceof d||void 0!==f&&t instanceof f||void 0!==l&&t instanceof l)&&1==t.isPublic&&(void 0===e||"PKCS8PUB"==e))return jt(E=new(0,s.x509.SubjectPublicKeyInfo)(t).getEncodedHex(),"PUBLIC KEY");if("PKCS1PRV"==e&&void 0!==d&&t instanceof d&&(void 0===n||null==n)&&1==t.isPrivate)return jt(E=v(t).getEncodedHex(),"RSA PRIVATE KEY");if("PKCS1PRV"==e&&void 0!==l&&t instanceof l&&(void 0===n||null==n)&&1==t.isPrivate){var y=new a({name:t.curveName}).getEncodedHex(),m=p(t).getEncodedHex(),b="";return(b+=jt(y,"EC PARAMETERS"))+jt(m,"EC PRIVATE KEY")}if("PKCS1PRV"==e&&void 0!==f&&t instanceof f&&(void 0===n||null==n)&&1==t.isPrivate)return jt(E=w(t).getEncodedHex(),"DSA PRIVATE KEY");if("PKCS5PRV"==e&&void 0!==d&&t instanceof d&&void 0!==n&&null!=n&&1==t.isPrivate){var E=v(t).getEncodedHex();return void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",E,n,r,o)}if("PKCS5PRV"==e&&void 0!==l&&t instanceof l&&void 0!==n&&null!=n&&1==t.isPrivate)return E=p(t).getEncodedHex(),void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",E,n,r,o);if("PKCS5PRV"==e&&void 0!==f&&t instanceof f&&void 0!==n&&null!=n&&1==t.isPrivate)return E=w(t).getEncodedHex(),void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",E,n,r,o);var S=function(t,e){var n=F(t,e);return new c({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(t,e){var n=g.lib.WordArray.random(8),r=g.lib.WordArray.random(8),i=g.PBKDF2(e,n,{keySize:6,iterations:100}),o=g.enc.Hex.parse(t),s=g.TripleDES.encrypt(o,i,{iv:r})+"",a={};return a.ciphertext=s,a.pbkdf2Salt=g.enc.Hex.stringify(n),a.pbkdf2Iter=100,a.encryptionSchemeAlg="DES-EDE3-CBC",a.encryptionSchemeIV=g.enc.Hex.stringify(r),a};if("PKCS8PRV"==e&&null!=d&&t instanceof d&&1==t.isPrivate){var k=v(t).getEncodedHex();return E=c({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:k}}]}).getEncodedHex(),void 0===n||null==n?jt(E,"PRIVATE KEY"):jt(m=S(E,n),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==e&&void 0!==l&&t instanceof l&&1==t.isPrivate)return k=new c({seq:[{int:1},{octstr:{hex:t.prvKeyHex}},{tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]}]}).getEncodedHex(),E=c({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:t.curveName}}]},{octstr:{hex:k}}]}).getEncodedHex(),void 0===n||null==n?jt(E,"PRIVATE KEY"):jt(m=S(E,n),"ENCRYPTED PRIVATE KEY");if("PKCS8PRV"==e&&void 0!==f&&t instanceof f&&1==t.isPrivate)return k=new u({bigint:t.x}).getEncodedHex(),E=c({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}}]}]},{octstr:{hex:k}}]}).getEncodedHex(),void 0===n||null==n?jt(E,"PRIVATE KEY"):jt(m=S(E,n),"ENCRYPTED PRIVATE KEY");throw new Error("unsupported object nor format")},Ht.getKeyFromCSRPEM=function(t){var e=Ct(t,"CERTIFICATE REQUEST");return Ht.getKeyFromCSRHex(e)},Ht.getKeyFromCSRHex=function(t){var e=Ht.parseCSRHex(t);return Ht.getKey(e.p8pubkeyhex,null,"pkcs8pub")},Ht.parseCSRHex=function(t){var e=lt.getChildIdx,n=lt.getTLV,r={},i=t;if("30"!=i.substr(0,2))throw new Error("malformed CSR(code:001)");var o=e(i,0);if(o.length<1)throw new Error("malformed CSR(code:002)");if("30"!=i.substr(o[0],2))throw new Error("malformed CSR(code:003)");var s=e(i,o[0]);if(s.length<3)throw new Error("malformed CSR(code:004)");return r.p8pubkeyhex=n(i,s[2]),r},Ht.getKeyID=function(t){var e=Ht,n=lt;"string"==typeof t&&-1!=t.indexOf("BEGIN ")&&(t=e.getKey(t));var r=Ct(e.getPEM(t)),i=n.getIdxbyList(r,0,[1]),o=n.getV(r,i).substring(2);return ct.crypto.Util.hashHex(o,"sha1")},Ht.getJWKFromKey=function(t){var e={};if(t instanceof it&&t.isPrivate)return e.kty="RSA",e.n=gt(t.n.toString(16)),e.e=gt(t.e.toString(16)),e.d=gt(t.d.toString(16)),e.p=gt(t.p.toString(16)),e.q=gt(t.q.toString(16)),e.dp=gt(t.dmp1.toString(16)),e.dq=gt(t.dmq1.toString(16)),e.qi=gt(t.coeff.toString(16)),e;if(t instanceof it&&t.isPublic)return e.kty="RSA",e.n=gt(t.n.toString(16)),e.e=gt(t.e.toString(16)),e;if(t instanceof ct.crypto.ECDSA&&t.isPrivate){if("P-256"!==(r=t.getShortNISTPCurveName())&&"P-384"!==r)throw new Error("unsupported curve name for JWT: "+r);var n=t.getPublicKeyXYHex();return e.kty="EC",e.crv=r,e.x=gt(n.x),e.y=gt(n.y),e.d=gt(t.prvKeyHex),e}if(t instanceof ct.crypto.ECDSA&&t.isPublic){var r;if("P-256"!==(r=t.getShortNISTPCurveName())&&"P-384"!==r)throw new Error("unsupported curve name for JWT: "+r);return n=t.getPublicKeyXYHex(),e.kty="EC",e.crv=r,e.x=gt(n.x),e.y=gt(n.y),e}throw new Error("not supported key object")},it.getPosArrayOfChildrenFromHex=function(t){return lt.getChildIdx(t,0)},it.getHexValueArrayOfChildrenFromHex=function(t){var e,n=lt.getV,r=n(t,(e=it.getPosArrayOfChildrenFromHex(t))[0]),i=n(t,e[1]),o=n(t,e[2]),s=n(t,e[3]),a=n(t,e[4]),u=n(t,e[5]),c=n(t,e[6]),h=n(t,e[7]),f=n(t,e[8]);return(e=new Array).push(r,i,o,s,a,u,c,h,f),e},it.prototype.readPrivateKeyFromPEMString=function(t){var e=Ct(t),n=it.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8])},it.prototype.readPKCS5PrvKeyHex=function(t){var e=it.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},it.prototype.readPKCS8PrvKeyHex=function(t){var e,n,r,i,o,s,a,u,c=lt.getVbyListEx;if(!1===lt.isASN1HEX(t))throw new Error("not ASN.1 hex string");try{e=c(t,0,[2,0,1],"02"),n=c(t,0,[2,0,2],"02"),r=c(t,0,[2,0,3],"02"),i=c(t,0,[2,0,4],"02"),o=c(t,0,[2,0,5],"02"),s=c(t,0,[2,0,6],"02"),a=c(t,0,[2,0,7],"02"),u=c(t,0,[2,0,8],"02")}catch(t){throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(e,n,r,i,o,s,a,u)},it.prototype.readPKCS5PubKeyHex=function(t){var e=lt,n=e.getV;if(!1===e.isASN1HEX(t))throw new Error("keyHex is not ASN.1 hex string");var r=e.getChildIdx(t,0);if(2!==r.length||"02"!==t.substr(r[0],2)||"02"!==t.substr(r[1],2))throw new Error("wrong hex for PKCS#5 public key");var i=n(t,r[0]),o=n(t,r[1]);this.setPublic(i,o)},it.prototype.readPKCS8PubKeyHex=function(t){var e=lt;if(!1===e.isASN1HEX(t))throw new Error("not ASN.1 hex string");if("06092a864886f70d010101"!==e.getTLVbyListEx(t,0,[0,0]))throw new Error("not PKCS8 RSA public key");var n=e.getTLVbyListEx(t,0,[1,0]);this.readPKCS5PubKeyHex(n)},it.prototype.readCertPubKeyHex=function(t){var e,n;(e=new Vt).readCertHex(t),n=e.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)},it.prototype.sign=function(t,e){var n=ct.crypto.Util.hashString(t,e);return this.signWithMessageHash(n,e)},it.prototype.signWithMessageHash=function(t,e){var n=nt(ct.crypto.Util.getPaddedDigestInfoHex(t,e,this.n.bitLength()),16);return $t(this.doPrivate(n).toString(16),this.n.bitLength())},it.prototype.signPSS=function(t,e,n){var r,i=(r=kt(t),ct.crypto.Util.hashHex(r,e));return void 0===n&&(n=-1),this.signWithMessageHashPSS(i,e,n)},it.prototype.signWithMessageHashPSS=function(t,e,n){var r,i=Ft(t),o=i.length,s=this.n.bitLength()-1,a=Math.ceil(s/8),u=function(t){return ct.crypto.Util.hashHex(t,e)};if(-1===n||void 0===n)n=o;else if(-2===n)n=a-o-2;else if(n<-2)throw new Error("invalid salt length");if(a<o+n+2)throw new Error("data too long");var c="";n>0&&(c=new Array(n),(new et).nextBytes(c),c=String.fromCharCode.apply(String,c));var h=Ft(u(kt("\0\0\0\0\0\0\0\0"+i+c))),f=[];for(r=0;r<a-n-o-2;r+=1)f[r]=0;var l=String.fromCharCode.apply(String,f)+""+c,d=Wt(h,l.length,u),v=[];for(r=0;r<l.length;r+=1)v[r]=l.charCodeAt(r)^d.charCodeAt(r);for(v[0]&=~(65280>>8*a-s&255),r=0;r<o;r++)v.push(h.charCodeAt(r));return v.push(188),$t(this.doPrivate(new k(v)).toString(16),this.n.bitLength())},it.prototype.verify=function(t,e){if(null==(e=e.toLowerCase()).match(/^[0-9a-f]+$/))return!1;var n=nt(e,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 o=qt(i.replace(/^1f+00/,""));return 0!=o.length&&o[1]==ct.crypto.Util.hashString(t,o[0])},it.prototype.verifyWithMessageHash=function(t,e){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var n=nt(e,16);if(n.bitLength()>this.n.bitLength())return 0;var r=qt(this.doPublic(n).toString(16).replace(/^1f+00/,""));return 0!=r.length&&r[1]==t},it.prototype.verifyPSS=function(t,e,n,r){var i,o=(i=kt(t),ct.crypto.Util.hashHex(i,n));return void 0===r&&(r=-1),this.verifyWithMessageHashPSS(o,e,n,r)},it.prototype.verifyWithMessageHashPSS=function(t,e,n,r){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var i,o=new k(e,16),s=function(t){return ct.crypto.Util.hashHex(t,n)},a=Ft(t),u=a.length,c=this.n.bitLength()-1,h=Math.ceil(c/8);if(-1===r||void 0===r)r=u;else if(-2===r)r=h-u-2;else if(r<-2)throw new Error("invalid salt length");if(h<u+r+2)throw new Error("data too long");var f=this.doPublic(o).toByteArray();for(i=0;i<f.length;i+=1)f[i]&=255;for(;f.length<h;)f.unshift(0);if(188!==f[h-1])throw new Error("encoded message does not end in 0xbc");var l=(f=String.fromCharCode.apply(String,f)).substr(0,h-u-1),d=f.substr(l.length,u),v=65280>>8*h-c&255;if(0!=(l.charCodeAt(0)&v))throw new Error("bits beyond keysize not zero");var p=Wt(d,l.length,s),w=[];for(i=0;i<l.length;i+=1)w[i]=l.charCodeAt(i)^p.charCodeAt(i);w[0]&=~v;var y=h-u-r-2;for(i=0;i<y;i+=1)if(0!==w[i])throw new Error("leftmost octets not zero");if(1!==w[y])throw new Error("0x01 marker not found");return d===Ft(s(kt("\0\0\0\0\0\0\0\0"+a+String.fromCharCode.apply(String,w.slice(-r)))))},it.SALT_LEN_HLEN=-1,it.SALT_LEN_MAX=-2,it.SALT_LEN_RECOVER=-2,Vt.hex2dn=function(t,e){void 0===e&&(e=0);var n=new Vt;return lt.getTLV(t,e),n.getX500Name(t).str},Vt.hex2rdn=function(t,e){if(void 0===e&&(e=0),"31"!==t.substr(e,2))throw new Error("malformed RDN");for(var n=new Array,r=lt.getChildIdx(t,e),i=0;i<r.length;i++)n.push(Vt.hex2attrTypeValue(t,r[i]));return(n=n.map((function(t){return t.replace("+","\\+")}))).join("+")},Vt.hex2attrTypeValue=function(t,e){var n=lt,r=n.getV;if(void 0===e&&(e=0),"30"!==t.substr(e,2))throw new Error("malformed attribute type and value");var i=n.getChildIdx(t,e);2!==i.length||t.substr(i[0],2);var o=r(t,i[0]),s=ct.asn1.ASN1Util.oidHexToInt(o);return ct.asn1.x509.OID.oid2atype(s)+"="+Ft(r(t,i[1]))},Vt.getPublicKeyFromCertHex=function(t){var e=new Vt;return e.readCertHex(t),e.getPublicKey()},Vt.getPublicKeyFromCertPEM=function(t){var e=new Vt;return e.readCertPEM(t),e.getPublicKey()},Vt.getPublicKeyInfoPropOfCertPEM=function(t){var e,n,r=lt.getVbyList,i={algparam:null};return(e=new Vt).readCertPEM(t),n=e.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},Vt.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"],void 0!==ct&&ct||(e.KJUR=ct={}),void 0!==ct.jws&&ct.jws||(ct.jws={}),ct.jws.JWS=function(){var t=ct.jws.JWS.isSafeJSONString;this.parseJWS=function(e,n){if(void 0===this.parsedJWS||!n&&void 0===this.parsedJWS.sigvalH){var r=e.match(/^([^.]+)\.([^.]+)\.([^.]+)$/);if(null==r)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";var i=r[1],o=r[2],s=r[3],a=i+"."+o;if(this.parsedJWS={},this.parsedJWS.headB64U=i,this.parsedJWS.payloadB64U=o,this.parsedJWS.sigvalB64U=s,this.parsedJWS.si=a,!n){var u=bt(s),c=nt(u,16);this.parsedJWS.sigvalH=u,this.parsedJWS.sigvalBI=c}var h=ft(i),f=ft(o);if(this.parsedJWS.headS=h,this.parsedJWS.payloadS=f,!t(h,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+h}}},ct.jws.JWS.sign=function(t,e,n,r,i){var o,s,a,u=ct.jws.JWS,c=u.readSafeJSONString,h=u.isSafeJSONString,f=ct.crypto,l=f.Mac,d=f.Signature,v=JSON;if("string"!=typeof e&&"object"!=(void 0===e?"undefined":y(e)))throw"spHeader must be JSON string or object: "+e;if("object"==(void 0===e?"undefined":y(e))&&(o=v.stringify(s=e)),"string"==typeof e){if(!h(o=e))throw"JWS Head is not safe JSON string: "+o;s=c(o)}if(a=n,"object"==(void 0===n?"undefined":y(n))&&(a=v.stringify(n)),""!=t&&null!=t||void 0===s.alg||(t=s.alg),""!=t&&null!=t&&void 0===s.alg&&(s.alg=t,o=v.stringify(s)),t!==s.alg)throw"alg and sHeader.alg doesn't match: "+t+"!="+s.alg;var p=null;if(void 0===u.jwsalg2sigalg[t])throw"unsupported alg name: "+t;p=u.jwsalg2sigalg[t];var w=ht(o)+"."+ht(a),m="";if("Hmac"==p.substr(0,4)){if(void 0===r)throw"mac key shall be specified for HS* alg";var g=new l({alg:p,prov:"cryptojs",pass:r});g.updateString(w),m=g.doFinal()}else if(-1!=p.indexOf("withECDSA")){(E=new d({alg:p})).init(r,i),E.updateString(w);var b=E.sign();m=ct.crypto.ECDSA.asn1SigToConcatSig(b)}else{var E;"none"!=p&&((E=new d({alg:p})).init(r,i),E.updateString(w),m=E.sign())}return w+"."+gt(m)},ct.jws.JWS.verify=function(t,e,n){var r,i=ct.jws.JWS,o=i.readSafeJSONString,s=ct.crypto,a=s.ECDSA,u=s.Mac,c=s.Signature;void 0!==y(it)&&(r=it);var h=t.split(".");if(3!==h.length)return!1;var f,l=h[0]+"."+h[1],d=bt(h[2]),v=o(ft(h[0])),p=null;if(void 0===v.alg)throw"algorithm not specified in header";if(f=(p=v.alg).substr(0,2),null!=n&&"[object Array]"===Object.prototype.toString.call(n)&&n.length>0&&-1==(":"+n.join(":")+":").indexOf(":"+p+":"))throw"algorithm '"+p+"' not accepted in the list";if("none"!=p&&null===e)throw"key shall be specified to verify.";if("string"==typeof e&&-1!=e.indexOf("-----BEGIN ")&&(e=Ht.getKey(e)),!("RS"!=f&&"PS"!=f||e instanceof r))throw"key shall be a RSAKey obj for RS* and PS* algs";if("ES"==f&&!(e instanceof a))throw"key shall be a ECDSA obj for ES* algs";var w=null;if(void 0===i.jwsalg2sigalg[v.alg])throw"unsupported alg name: "+p;if("none"==(w=i.jwsalg2sigalg[p]))throw"not supported";if("Hmac"==w.substr(0,4)){if(void 0===e)throw"hexadecimal key shall be specified for HMAC";var m=new u({alg:w,pass:e});return m.updateString(l),d==m.doFinal()}if(-1!=w.indexOf("withECDSA")){var g,b=null;try{b=a.concatSigToASN1Sig(d)}catch(t){return!1}return(g=new c({alg:w})).init(e),g.updateString(l),g.verify(b)}return(g=new c({alg:w})).init(e),g.updateString(l),g.verify(d)},ct.jws.JWS.parse=function(t){var e,n,r=t.split("."),i={};if(2!=r.length&&3!=r.length)throw"malformed sJWS: wrong number of '.' splitted elements";return e=r[1],3==r.length&&(n=r[2]),i.headerObj=ct.jws.JWS.readSafeJSONString(ft(r[0])),i.payloadObj=ct.jws.JWS.readSafeJSONString(ft(e)),i.headerPP=JSON.stringify(i.headerObj,null," "),i.payloadPP=null==i.payloadObj?ft(e):JSON.stringify(i.payloadObj,null," "),void 0!==n&&(i.sigHex=bt(n)),i},ct.jws.JWS.verifyJWT=function(t,e,n){var r=ct.jws,i=r.JWS,o=i.readSafeJSONString,s=i.inArray,a=i.includedArray,u=t.split("."),c=u[0],h=u[1],f=(bt(u[2]),o(ft(c))),l=o(ft(h));if(void 0===f.alg)return!1;if(void 0===n.alg)throw"acceptField.alg shall be specified";if(!s(f.alg,n.alg))return!1;if(void 0!==l.iss&&"object"===y(n.iss)&&!s(l.iss,n.iss))return!1;if(void 0!==l.sub&&"object"===y(n.sub)&&!s(l.sub,n.sub))return!1;if(void 0!==l.aud&&"object"===y(n.aud))if("string"==typeof l.aud){if(!s(l.aud,n.aud))return!1}else if("object"==y(l.aud)&&!a(l.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!==l.exp&&"number"==typeof l.exp&&l.exp+n.gracePeriod<d||void 0!==l.nbf&&"number"==typeof l.nbf&&d<l.nbf-n.gracePeriod||void 0!==l.iat&&"number"==typeof l.iat&&d<l.iat-n.gracePeriod||void 0!==l.jti&&void 0!==n.jti&&l.jti!==n.jti||!i.verify(t,e,n.alg))},ct.jws.JWS.includedArray=function(t,e){var n=ct.jws.JWS.inArray;if(null===t)return!1;if("object"!==(void 0===t?"undefined":y(t)))return!1;if("number"!=typeof t.length)return!1;for(var r=0;r<t.length;r++)if(!n(t[r],e))return!1;return!0},ct.jws.JWS.inArray=function(t,e){if(null===e)return!1;if("object"!==(void 0===e?"undefined":y(e)))return!1;if("number"!=typeof e.length)return!1;for(var n=0;n<e.length;n++)if(e[n]==t)return!0;return!1},ct.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"},ct.jws.JWS.isSafeJSONString=function(t,e,n){var r=null;try{return"object"!=(void 0===(r=ut(t))?"undefined":y(r))||r.constructor===Array?0:(e&&(e[n]=r),1)}catch(t){return 0}},ct.jws.JWS.readSafeJSONString=function(t){var e=null;try{return"object"!=(void 0===(e=ut(t))?"undefined":y(e))||e.constructor===Array?null:e}catch(t){return null}},ct.jws.JWS.getEncodedSignatureValueFromJWS=function(t){var e=t.match(/^[^.]+\.[^.]+\.([^.]+)$/);if(null==e)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";return e[1]},ct.jws.JWS.getJWKthumbprint=function(t){if("RSA"!==t.kty&&"EC"!==t.kty&&"oct"!==t.kty)throw"unsupported algorithm for JWK Thumprint";var e="{";if("RSA"===t.kty){if("string"!=typeof t.n||"string"!=typeof t.e)throw"wrong n and e value for RSA key";e+='"e":"'+t.e+'",',e+='"kty":"'+t.kty+'",',e+='"n":"'+t.n+'"}'}else if("EC"===t.kty){if("string"!=typeof t.crv||"string"!=typeof t.x||"string"!=typeof t.y)throw"wrong crv, x and y value for EC key";e+='"crv":"'+t.crv+'",',e+='"kty":"'+t.kty+'",',e+='"x":"'+t.x+'",',e+='"y":"'+t.y+'"}'}else if("oct"===t.kty){if("string"!=typeof t.k)throw"wrong k value for oct(symmetric) key";e+='"kty":"'+t.kty+'",',e+='"k":"'+t.k+'"}'}var n=kt(e);return gt(ct.crypto.Util.hashHex(n,"sha256"))},ct.jws.IntDate={},ct.jws.IntDate.get=function(t){var e=ct.jws.IntDate,n=e.getNow,r=e.getZulu;if("now"==t)return n();if("now + 1hour"==t)return n()+3600;if("now + 1day"==t)return n()+86400;if("now + 1month"==t)return n()+2592e3;if("now + 1year"==t)return n()+31536e3;if(t.match(/Z$/))return r(t);if(t.match(/^[0-9]+$/))return parseInt(t);throw"unsupported format: "+t},ct.jws.IntDate.getZulu=function(t){return Tt(t)},ct.jws.IntDate.getNow=function(){return~~(new Date/1e3)},ct.jws.IntDate.intDate2UTCString=function(t){return new Date(1e3*t).toUTCString()},ct.jws.IntDate.intDate2Zulu=function(t){var e=new Date(1e3*t);return("0000"+e.getUTCFullYear()).slice(-4)+("00"+(e.getUTCMonth()+1)).slice(-2)+("00"+e.getUTCDate()).slice(-2)+("00"+e.getUTCHours()).slice(-2)+("00"+e.getUTCMinutes()).slice(-2)+("00"+e.getUTCSeconds()).slice(-2)+"Z"},e.SecureRandom=et,e.rng_seed_time=X,e.BigInteger=k,e.RSAKey=it,e.EDSA=ct.crypto.EDSA,e.DSA=ct.crypto.DSA,e.Signature=ct.crypto.Signature,e.MessageDigest=ct.crypto.MessageDigest,e.Mac=ct.crypto.Mac,e.Cipher=ct.crypto.Cipher,e.KEYUTIL=Ht,e.ASN1HEX=lt,e.X509=Vt,e.CryptoJS=g,e.b64tohex=S,e.b64toBA=F,e.stoBA=dt,e.BAtos=vt,e.BAtohex=pt,e.stohex=wt,e.stob64=function(t){return E(wt(t))},e.stob64u=function(t){return yt(E(wt(t)))},e.b64utos=function(t){return vt(F(mt(t)))},e.b64tob64u=yt,e.b64utob64=mt,e.hex2b64=E,e.hextob64u=gt,e.b64utohex=bt,e.utf8tob64u=ht,e.b64utoutf8=ft,e.utf8tob64=function(t){return E(It(Ut(t)))},e.b64toutf8=function(t){return decodeURIComponent(Ot(S(t)))},e.utf8tohex=Et,e.hextoutf8=St,e.hextorstr=Ft,e.rstrtohex=kt,e.hextob64=xt,e.hextob64nl=_t,e.b64nltohex=At,e.hextopem=jt,e.pemtohex=Ct,e.hextoArrayBuffer=function(t){if(t.length%2!=0)throw"input is not even length";if(null==t.match(/^[0-9A-Fa-f]+$/))throw"input is not hexadecimal";for(var e=new ArrayBuffer(t.length/2),n=new DataView(e),r=0;r<t.length/2;r++)n.setUint8(r,parseInt(t.substr(2*r,2),16));return e},e.ArrayBuffertohex=function(t){for(var e="",n=new DataView(t),r=0;r<t.byteLength;r++)e+=("00"+n.getUint8(r).toString(16)).slice(-2);return e},e.zulutomsec=Rt,e.zulutosec=Tt,e.zulutodate=function(t){return new Date(Rt(t))},e.datetozulu=function(t,e,n){var r,i=t.getUTCFullYear();if(e){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"+(t.getUTCMonth()+1)).slice(-2),r+=("0"+t.getUTCDate()).slice(-2),r+=("0"+t.getUTCHours()).slice(-2),r+=("0"+t.getUTCMinutes()).slice(-2),r+=("0"+t.getUTCSeconds()).slice(-2),n){var o=t.getUTCMilliseconds();0!==o&&(r+="."+(o=(o=("00"+o).slice(-3)).replace(/0+$/g,"")))}return r+"Z"},e.uricmptohex=It,e.hextouricmp=Ot,e.ipv6tohex=Nt,e.hextoipv6=Pt,e.hextoip=Dt,e.iptohex=function(t){var e="malformed IP address";if(!(t=t.toLowerCase(t)).match(/^[0-9.]+$/)){if(t.match(/^[0-9a-f:]+$/)&&-1!==t.indexOf(":"))return Nt(t);throw e}var n=t.split(".");if(4!==n.length)throw e;var r="";try{for(var i=0;i<4;i++)r+=("0"+parseInt(n[i]).toString(16)).slice(-2);return r}catch(t){throw e}},e.encodeURIComponentAll=Ut,e.newline_toUnix=function(t){return t.replace(/\r\n/gm,"\n")},e.newline_toDos=function(t){return(t=t.replace(/\r\n/gm,"\n")).replace(/\n/gm,"\r\n")},e.hextoposhex=Bt,e.intarystrtohex=function(t){t=(t=(t=t.replace(/^\s*\[\s*/,"")).replace(/\s*\]\s*$/,"")).replace(/\s*/g,"");try{return t.split(/,/).map((function(t){var e=parseInt(t);if(e<0||255<e)throw"integer not in range 0-255";return("00"+e.toString(16)).slice(-2)})).join("")}catch(t){throw"malformed integer array string: "+t}},e.strdiffidx=function(t,e){var n=t.length;t.length>e.length&&(n=e.length);for(var r=0;r<n;r++)if(t.charCodeAt(r)!=e.charCodeAt(r))return r;return t.length!=e.length?n:-1},e.KJUR=ct,e.crypto=ct.crypto,e.asn1=ct.asn1,e.jws=ct.jws,e.lang=ct.lang}).call(this,n(28).Buffer)},function(t,e,n){(function(t){var r=n(30),i=n(31),o=n(32);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,n){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return f(this,t)}return c(this,t,e,n)}function c(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r),u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=l(t,e),t}(t,e,n,r):"string"==typeof e?function(t,e,n){if("string"==typeof n&&""!==n||(n="utf8"),!u.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|v(e,n),i=(t=a(t,r)).write(e,n);return i!==r&&(t=t.slice(0,i)),t}(t,e,n):function(t,e){if(u.isBuffer(e)){var n=0|d(e.length);return 0===(t=a(t,n)).length||e.copy(t,0,0,n),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(r=e.length)!=r?a(t,0):l(t,e);if("Buffer"===e.type&&o(e.data))return l(t,e.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function f(t,e){if(h(e),t=a(t,e<0?0:0|d(e)),!u.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function l(t,e){var n=e.length<0?0:0|d(e.length);t=a(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function d(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function v(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return J(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return K(t).length;default:if(r)return J(t).length;e=(""+e).toLowerCase(),r=!0}}function p(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,n);case"utf8":case"utf-8":return _(this,e,n);case"ascii":return j(this,e,n);case"latin1":case"binary":return C(this,e,n);case"base64":return x(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function w(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function y(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=u.from(e,r)),u.isBuffer(e))return 0===e.length?-1:m(t,e,n,r,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):m(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function m(t,e,n,r,i){var o,s=1,a=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var h=-1;for(o=n;o<a;o++)if(c(t,o)===c(e,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===u)return h*s}else-1!==h&&(o-=o-h),h=-1}else for(n+u>a&&(n=a-u),o=n;o>=0;o--){for(var f=!0,l=0;l<u;l++)if(c(t,o+l)!==c(e,l)){f=!1;break}if(f)return o}return-1}function g(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[n+s]=a}return s}function b(t,e,n,r){return H(J(e,t.length-n),t,n,r)}function E(t,e,n,r){return H(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function S(t,e,n,r){return E(t,e,n,r)}function F(t,e,n,r){return H(K(e),t,n,r)}function k(t,e,n,r){return H(function(t,e){for(var n,r,i=[],o=0;o<t.length&&!((e-=2)<0);++o)r=(n=t.charCodeAt(o))>>8,i.push(n%256),i.push(r);return i}(e,t.length-n),t,n,r)}function x(t,e,n){return r.fromByteArray(0===e&&n===t.length?t:t.slice(e,n))}function _(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,s,a,u,c=t[i],h=null,f=c>239?4:c>223?3:c>191?2:1;if(i+f<=n)switch(f){case 1:c<128&&(h=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(h=u);break;case 3:s=t[i+2],128==(192&(o=t[i+1]))&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:s=t[i+2],a=t[i+3],128==(192&(o=t[i+1]))&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(h=u)}null===h?(h=65533,f=1):h>65535&&(r.push((h-=65536)>>>10&1023|55296),h=56320|1023&h),r.push(h),i+=f}return function(t){var e=t.length;if(e<=A)return String.fromCharCode.apply(String,t);for(var n="",r=0;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=A));return n}(r)}e.Buffer=u,e.SlowBuffer=function(t){return+t!=t&&(t=0),u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=s(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,n){return c(null,t,e,n)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,n){return r=null,o=e,s=n,h(i=t),i<=0?a(r,i):void 0!==o?"string"==typeof s?a(r,i).fill(o,s):a(r,i).fill(o):a(r,i);var r,i,o,s},u.allocUnsafe=function(t){return f(null,t)},u.allocUnsafeSlow=function(t){return f(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=u.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var s=t[n];if(!u.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,i),i+=s.length}return r},u.byteLength=v,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)w(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)w(this,e,e+3),w(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)w(this,e,e+7),w(this,e+1,e+6),w(this,e+2,e+5),w(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?_(this,0,t):p.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,n,r,i){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0),a=Math.min(o,s),c=this.slice(r,i),h=t.slice(e,n),f=0;f<a;++f)if(c[f]!==h[f]){o=c[f],s=h[f];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},u.prototype.indexOf=function(t,e,n){return y(this,t,e,n,!0)},u.prototype.lastIndexOf=function(t,e,n){return y(this,t,e,n,!1)},u.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return g(this,t,e,n);case"utf8":case"utf-8":return b(this,t,e,n);case"ascii":return E(this,t,e,n);case"latin1":case"binary":return S(this,t,e,n);case"base64":return F(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function j(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function C(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function R(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o<n;++o)i+=B(t[o]);return i}function T(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function I(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,n,r,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function N(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i<o;++i)t[n+i]=(e&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function P(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i<o;++i)t[n+i]=e>>>8*(r?i:3-i)&255}function D(t,e,n,r){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function M(t,e,n,r,o){return o||D(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function U(t,e,n,r,o){return o||D(t,0,n,8),i.write(t,e,n,r,52,8),n+8}u.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),u.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=u.prototype;else{var i=e-t;n=new u(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+t]}return n},u.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||I(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},u.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||I(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},u.prototype.readUInt8=function(t,e){return e||I(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||I(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||I(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||I(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||I(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||I(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*e)),r},u.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||I(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||I(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||I(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(t,e){e||I(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(t,e){return e||I(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||I(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||I(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||I(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||I(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||I(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,n,r){t=+t,e|=0,n|=0,r||O(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},u.prototype.writeUIntBE=function(t,e,n,r){t=+t,e|=0,n|=0,r||O(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},u.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):N(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):N(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):P(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):P(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);O(this,t,e,n,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<n&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},u.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);O(this,t,e,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},u.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):N(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):N(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):P(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):P(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,n){return M(this,t,e,!0,n)},u.prototype.writeFloatBE=function(t,e,n){return M(this,t,e,!1,n)},u.prototype.writeDoubleLE=function(t,e,n){return U(this,t,e,!0,n)},u.prototype.writeDoubleBE=function(t,e,n){return U(this,t,e,!1,n)},u.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,o=r-n;if(this===t&&n<e&&e<r)for(i=o-1;i>=0;--i)t[i+e]=this[i+n];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o},u.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!u.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var o;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o<n;++o)this[o]=t;else{var s=u.isBuffer(t)?t:J(new u(t,r).toString()),a=s.length;for(o=0;o<n-e;++o)this[o+e]=s[o%a]}return this};var L=/[^+\/0-9A-Za-z-_]/g;function B(t){return t<16?"0"+t.toString(16):t.toString(16)}function J(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],s=0;s<r;++s){if((n=t.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function K(t){return r.toByteArray(function(t){if((t=(e=t,e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")).replace(L,"")).length<2)return"";for(var e;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}}).call(this,n(29))},function(t){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(t){"object"==typeof window&&(e=window)}t.exports=e},function(t,e){e.byteLength=function(t){var e=u(t),n=e[1];return 3*(e[0]+n)/4-n},e.toByteArray=function(t){var e,n,o,s=u(t),a=s[0],c=s[1],h=new i(3*(a+(o=c))/4-o),f=0,l=c>0?a-4:a;for(n=0;n<l;n+=4)e=r[t.charCodeAt(n)]<<18|r[t.charCodeAt(n+1)]<<12|r[t.charCodeAt(n+2)]<<6|r[t.charCodeAt(n+3)],h[f++]=e>>16&255,h[f++]=e>>8&255,h[f++]=255&e;return 2===c&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,h[f++]=255&e),1===c&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,h[f++]=e>>8&255,h[f++]=255&e),h},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,u=r-i;a<u;a+=s)o.push(c(t,a,a+s>u?u:a+s));return 1===i?o.push(n[(e=t[r-1])>>2]+n[e<<4&63]+"=="):2===i&&o.push(n[(e=(t[r-2]<<8)+t[r-1])>>10]+n[e>>4&63]+n[e<<2&63]+"="),o.join("")};for(var n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=o.length;s<a;++s)n[s]=o[s],r[o.charCodeAt(s)]=s;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function c(t,e,r){for(var i,o=[],s=e;s<r;s+=3)o.push(n[(i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]))>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return o.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,c=u>>1,h=-7,f=n?i-1:0,l=n?-1:1,d=t[e+f];for(f+=l,o=d&(1<<-h)-1,d>>=-h,h+=a;h>0;o=256*o+t[e+f],f+=l,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=r;h>0;s=256*s+t[e+f],f+=l,h-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),o-=c}return(d?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,u,c=8*o-i-1,h=(1<<c)-1,f=h>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,v=r?1:-1,p=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+f>=1?l/u:l*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=h?(a=0,s=h):s+f>=1?(a=(e*u-1)*Math.pow(2,i),s+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;t[n+d]=255&a,d+=v,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;t[n+d]=255&s,d+=v,s/=256,c-=8);t[n+d-v]|=128*p}},function(t){var e={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==e.call(t)}},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=t.jws,n=t.KeyUtil,i=t.X509,o=t.crypto,s=t.hextob64u,a=t.b64tohex,u=t.AllowedSigningAlgs;return function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.parseJwt=function(t){r.Log.debug("JoseUtil.parseJwt");try{var n=e.JWS.parse(t);return{header:n.headerObj,payload:n.payloadObj}}catch(t){r.Log.error(t)}},t.validateJwt=function(e,o,s,u,c,h,f){r.Log.debug("JoseUtil.validateJwt");try{if("RSA"===o.kty)if(o.e&&o.n)o=n.getKey(o);else{if(!o.x5c||!o.x5c.length)return r.Log.error("JoseUtil.validateJwt: RSA key missing key material",o),Promise.reject(new Error("RSA key missing key material"));var l=a(o.x5c[0]);o=i.getPublicKeyFromCertHex(l)}else{if("EC"!==o.kty)return r.Log.error("JoseUtil.validateJwt: Unsupported key type",o&&o.kty),Promise.reject(new Error(o.kty));if(!(o.crv&&o.x&&o.y))return r.Log.error("JoseUtil.validateJwt: EC key missing key material",o),Promise.reject(new Error("EC key missing key material"));o=n.getKey(o)}return t._validateJwt(e,o,s,u,c,h,f)}catch(t){return r.Log.error(t&&t.message||t),Promise.reject("JWT validation failed")}},t.validateJwtAttributes=function(e,n,i,o,s,a){o||(o=0),s||(s=parseInt(Date.now()/1e3));var u=t.parseJwt(e).payload;if(!u.iss)return r.Log.error("JoseUtil._validateJwt: issuer was not provided"),Promise.reject(new Error("issuer was not provided"));if(u.iss!==n)return r.Log.error("JoseUtil._validateJwt: Invalid issuer in token",u.iss),Promise.reject(new Error("Invalid issuer in token: "+u.iss));if(!u.aud)return r.Log.error("JoseUtil._validateJwt: aud was not provided"),Promise.reject(new Error("aud was not provided"));if(!(u.aud===i||Array.isArray(u.aud)&&u.aud.indexOf(i)>=0))return r.Log.error("JoseUtil._validateJwt: Invalid audience in token",u.aud),Promise.reject(new Error("Invalid audience in token: "+u.aud));if(u.azp&&u.azp!==i)return r.Log.error("JoseUtil._validateJwt: Invalid azp in token",u.azp),Promise.reject(new Error("Invalid azp in token: "+u.azp));if(!a){var c=s+o,h=s-o;if(!u.iat)return r.Log.error("JoseUtil._validateJwt: iat was not provided"),Promise.reject(new Error("iat was not provided"));if(c<u.iat)return r.Log.error("JoseUtil._validateJwt: iat is in the future",u.iat),Promise.reject(new Error("iat is in the future: "+u.iat));if(u.nbf&&c<u.nbf)return r.Log.error("JoseUtil._validateJwt: nbf is in the future",u.nbf),Promise.reject(new Error("nbf is in the future: "+u.nbf));if(!u.exp)return r.Log.error("JoseUtil._validateJwt: exp was not provided"),Promise.reject(new Error("exp was not provided"));if(u.exp<h)return r.Log.error("JoseUtil._validateJwt: exp is in the past",u.exp),Promise.reject(new Error("exp is in the past:"+u.exp))}return Promise.resolve(u)},t._validateJwt=function(n,i,o,s,a,c,h){return t.validateJwtAttributes(n,o,s,a,c,h).then((function(t){try{return e.JWS.verify(n,i,u)?t:(r.Log.error("JoseUtil._validateJwt: signature validation failed"),Promise.reject(new Error("signature validation failed")))}catch(t){return r.Log.error(t&&t.message||t),Promise.reject(new Error("signature validation failed"))}}))},t.hashString=function(t,e){try{return o.Util.hashString(t,e)}catch(t){r.Log.error(t)}},t.hexToBase64Url=function(t){try{return s(t)}catch(t){r.Log.error(t)}},t}()};var r=n(0);t.exports=e.default},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.SigninResponse=void 0;var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),i=n(3);function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.SigninResponse=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#";o(this,t);var r=i.UrlUtility.parseUrlFragment(e,n);this.error=r.error,this.error_description=r.error_description,this.error_uri=r.error_uri,this.code=r.code,this.state=r.state,this.id_token=r.id_token,this.session_state=r.session_state,this.access_token=r.access_token,this.token_type=r.token_type,this.scope=r.scope,this.profile=void 0,this.expires_in=r.expires_in}return r(t,[{key:"expires_in",get:function(){if(this.expires_at){var t=parseInt(Date.now()/1e3);return this.expires_at-t}},set:function(t){var e=parseInt(t);if("number"==typeof e&&e>0){var n=parseInt(Date.now()/1e3);this.expires_at=n+e}}},{key:"expired",get:function(){var t=this.expires_in;if(void 0!==t)return t<=0}},{key:"scopes",get:function(){return(this.scope||"").split(" ")}},{key:"isOpenIdConnect",get:function(){return this.scopes.indexOf("openid")>=0||!!this.id_token}}]),t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.SignoutRequest=void 0;var r=n(0),i=n(3),o=n(9);e.SignoutRequest=function t(e){var n=e.url,s=e.id_token_hint,a=e.post_logout_redirect_uri,u=e.data,c=e.extraQueryParams,h=e.request_type;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!n)throw r.Log.error("SignoutRequest.ctor: No url passed"),new Error("url");for(var f in s&&(n=i.UrlUtility.addQueryParam(n,"id_token_hint",s)),a&&(n=i.UrlUtility.addQueryParam(n,"post_logout_redirect_uri",a),u&&(this.state=new o.State({data:u,request_type:h}),n=i.UrlUtility.addQueryParam(n,"state",this.state.id))),c)n=i.UrlUtility.addQueryParam(n,f,c[f]);this.url=n}},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.SignoutResponse=void 0;var r=n(3);e.SignoutResponse=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var n=r.UrlUtility.parseUrlFragment(e,"?");this.error=n.error,this.error_description=n.error_description,this.error_uri=n.error_uri,this.state=n.state}},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.InMemoryWebStorage=void 0;var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),i=n(0);e.InMemoryWebStorage=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._data={}}return t.prototype.getItem=function(t){return i.Log.debug("InMemoryWebStorage.getItem",t),this._data[t]},t.prototype.setItem=function(t,e){i.Log.debug("InMemoryWebStorage.setItem",t),this._data[t]=e},t.prototype.removeItem=function(t){i.Log.debug("InMemoryWebStorage.removeItem",t),delete this._data[t]},t.prototype.key=function(t){return Object.getOwnPropertyNames(this._data)[t]},r(t,[{key:"length",get:function(){return Object.getOwnPropertyNames(this._data).length}}]),t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.UserManager=void 0;var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),i=n(0),o=n(10),s=n(39),a=n(15),u=n(45),c=n(47),h=n(18),f=n(8),l=n(20),d=n(11),v=n(4);function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function w(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}e.UserManager=function(t){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.SilentRenewService,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:h.SessionMonitor,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l.TokenRevocationClient,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:d.TokenClient,y=arguments.length>5&&void 0!==arguments[5]?arguments[5]:v.JoseUtil;p(this,e),n instanceof s.UserManagerSettings||(n=new s.UserManagerSettings(n));var m=w(this,t.call(this,n));return m._events=new u.UserManagerEvents(n),m._silentRenewService=new r(m),m.settings.automaticSilentRenew&&(i.Log.debug("UserManager.ctor: automaticSilentRenew is configured, setting up silent renew"),m.startSilentRenew()),m.settings.monitorSession&&(i.Log.debug("UserManager.ctor: monitorSession is configured, setting up session monitor"),m._sessionMonitor=new o(m)),m._tokenRevocationClient=new a(m._settings),m._tokenClient=new f(m._settings),m._joseUtil=y,m}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.getUser=function(){var t=this;return this._loadUser().then((function(e){return e?(i.Log.info("UserManager.getUser: user loaded"),t._events.load(e,!1),e):(i.Log.info("UserManager.getUser: user not found in storage"),null)}))},e.prototype.removeUser=function(){var t=this;return this.storeUser(null).then((function(){i.Log.info("UserManager.removeUser: user removed from storage"),t._events.unload()}))},e.prototype.signinRedirect=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(t=Object.assign({},t)).request_type="si:r";var e={useReplaceToNavigate:t.useReplaceToNavigate};return this._signinStart(t,this._redirectNavigator,e).then((function(){i.Log.info("UserManager.signinRedirect: successful")}))},e.prototype.signinRedirectCallback=function(t){return this._signinEnd(t||this._redirectNavigator.url).then((function(t){return t.profile&&t.profile.sub?i.Log.info("UserManager.signinRedirectCallback: successful, signed in sub: ",t.profile.sub):i.Log.info("UserManager.signinRedirectCallback: no sub"),t}))},e.prototype.signinPopup=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(t=Object.assign({},t)).request_type="si:p";var e=t.redirect_uri||this.settings.popup_redirect_uri||this.settings.redirect_uri;return e?(t.redirect_uri=e,t.display="popup",this._signin(t,this._popupNavigator,{startUrl:e,popupWindowFeatures:t.popupWindowFeatures||this.settings.popupWindowFeatures,popupWindowTarget:t.popupWindowTarget||this.settings.popupWindowTarget}).then((function(t){return t&&(t.profile&&t.profile.sub?i.Log.info("UserManager.signinPopup: signinPopup successful, signed in sub: ",t.profile.sub):i.Log.info("UserManager.signinPopup: no sub")),t}))):(i.Log.error("UserManager.signinPopup: No popup_redirect_uri or redirect_uri configured"),Promise.reject(new Error("No popup_redirect_uri or redirect_uri configured")))},e.prototype.signinPopupCallback=function(t){return this._signinCallback(t,this._popupNavigator).then((function(t){return t&&(t.profile&&t.profile.sub?i.Log.info("UserManager.signinPopupCallback: successful, signed in sub: ",t.profile.sub):i.Log.info("UserManager.signinPopupCallback: no sub")),t})).catch((function(t){i.Log.error(t.message)}))},e.prototype.signinSilent=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e=Object.assign({},e),this._loadUser().then((function(n){return n&&n.refresh_token?(e.refresh_token=n.refresh_token,t._useRefreshToken(e)):(e.request_type="si:s",e.id_token_hint=e.id_token_hint||t.settings.includeIdTokenInSilentRenew&&n&&n.id_token,n&&t._settings.validateSubOnSilentRenew&&(i.Log.debug("UserManager.signinSilent, subject prior to silent renew: ",n.profile.sub),e.current_sub=n.profile.sub),t._signinSilentIframe(e))}))},e.prototype._useRefreshToken=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._tokenClient.exchangeRefreshToken(e).then((function(e){return e?e.access_token?t._loadUser().then((function(n){if(n){var r=Promise.resolve();return e.id_token&&(r=t._validateIdTokenFromTokenRefreshToken(n.profile,e.id_token)),r.then((function(){return i.Log.debug("UserManager._useRefreshToken: refresh token response success"),n.id_token=e.id_token||n.id_token,n.access_token=e.access_token,n.refresh_token=e.refresh_token||n.refresh_token,n.expires_in=e.expires_in,t.storeUser(n).then((function(){return t._events.load(n),n}))}))}return null})):(i.Log.error("UserManager._useRefreshToken: No access token returned from token endpoint"),Promise.reject("No access token returned from token endpoint")):(i.Log.error("UserManager._useRefreshToken: No response returned from token endpoint"),Promise.reject("No response returned from token endpoint"))}))},e.prototype._validateIdTokenFromTokenRefreshToken=function(t,e){var n=this;return this._metadataService.getIssuer().then((function(r){return n.settings.getEpochTime().then((function(o){return n._joseUtil.validateJwtAttributes(e,r,n._settings.client_id,n._settings.clockSkew,o).then((function(e){return e?e.sub!==t.sub?(i.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: sub in id_token does not match current sub"),Promise.reject(new Error("sub in id_token does not match current sub"))):e.auth_time&&e.auth_time!==t.auth_time?(i.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: auth_time in id_token does not match original auth_time"),Promise.reject(new Error("auth_time in id_token does not match original auth_time"))):e.azp&&e.azp!==t.azp?(i.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: azp in id_token does not match original azp"),Promise.reject(new Error("azp in id_token does not match original azp"))):!e.azp&&t.azp?(i.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: azp not in id_token, but present in original id_token"),Promise.reject(new Error("azp not in id_token, but present in original id_token"))):void 0:(i.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: Failed to validate id_token"),Promise.reject(new Error("Failed to validate id_token")))}))}))}))},e.prototype._signinSilentIframe=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.redirect_uri||this.settings.silent_redirect_uri||this.settings.redirect_uri;return e?(t.redirect_uri=e,t.prompt=t.prompt||"none",this._signin(t,this._iframeNavigator,{startUrl:e,silentRequestTimeout:t.silentRequestTimeout||this.settings.silentRequestTimeout}).then((function(t){return t&&(t.profile&&t.profile.sub?i.Log.info("UserManager.signinSilent: successful, signed in sub: ",t.profile.sub):i.Log.info("UserManager.signinSilent: no sub")),t}))):(i.Log.error("UserManager.signinSilent: No silent_redirect_uri configured"),Promise.reject(new Error("No silent_redirect_uri configured")))},e.prototype.signinSilentCallback=function(t){return this._signinCallback(t,this._iframeNavigator).then((function(t){return t&&(t.profile&&t.profile.sub?i.Log.info("UserManager.signinSilentCallback: successful, signed in sub: ",t.profile.sub):i.Log.info("UserManager.signinSilentCallback: no sub")),t}))},e.prototype.signinCallback=function(t){var e=this;return this.readSigninResponseState(t).then((function(n){var r=n.state;return"si:r"===r.request_type?e.signinRedirectCallback(t):"si:p"===r.request_type?e.signinPopupCallback(t):"si:s"===r.request_type?e.signinSilentCallback(t):Promise.reject(new Error("invalid response_type in state"))}))},e.prototype.signoutCallback=function(t,e){var n=this;return this.readSignoutResponseState(t).then((function(r){var i=r.state,o=r.response;return i?"so:r"===i.request_type?n.signoutRedirectCallback(t):"so:p"===i.request_type?n.signoutPopupCallback(t,e):Promise.reject(new Error("invalid response_type in state")):o}))},e.prototype.querySessionStatus=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=Object.assign({},e)).request_type="si:s";var n=e.redirect_uri||this.settings.silent_redirect_uri||this.settings.redirect_uri;return n?(e.redirect_uri=n,e.prompt="none",e.response_type=e.response_type||this.settings.query_status_response_type,e.scope=e.scope||"openid",e.skipUserInfo=!0,this._signinStart(e,this._iframeNavigator,{startUrl:n,silentRequestTimeout:e.silentRequestTimeout||this.settings.silentRequestTimeout}).then((function(e){return t.processSigninResponse(e.url).then((function(t){if(i.Log.debug("UserManager.querySessionStatus: got signin response"),t.session_state&&t.profile.sub)return i.Log.info("UserManager.querySessionStatus: querySessionStatus success for sub: ",t.profile.sub),{session_state:t.session_state,sub:t.profile.sub,sid:t.profile.sid};i.Log.info("querySessionStatus successful, user not authenticated")})).catch((function(e){if(e.session_state&&t.settings.monitorAnonymousSession&&("login_required"==e.message||"consent_required"==e.message||"interaction_required"==e.message||"account_selection_required"==e.message))return i.Log.info("UserManager.querySessionStatus: querySessionStatus success for anonymous user"),{session_state:e.session_state};throw e}))}))):(i.Log.error("UserManager.querySessionStatus: No silent_redirect_uri configured"),Promise.reject(new Error("No silent_redirect_uri configured")))},e.prototype._signin=function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._signinStart(t,e,r).then((function(e){return n._signinEnd(e.url,t)}))},e.prototype._signinStart=function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return e.prepare(r).then((function(e){return i.Log.debug("UserManager._signinStart: got navigator window handle"),n.createSigninRequest(t).then((function(t){return i.Log.debug("UserManager._signinStart: got signin request"),r.url=t.url,r.id=t.state.id,e.navigate(r)})).catch((function(t){throw e.close&&(i.Log.debug("UserManager._signinStart: Error after preparing navigator, closing navigator window"),e.close()),t}))}))},e.prototype._signinEnd=function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.processSigninResponse(t).then((function(t){i.Log.debug("UserManager._signinEnd: got signin response");var r=new a.User(t);if(n.current_sub){if(n.current_sub!==r.profile.sub)return i.Log.debug("UserManager._signinEnd: current user does not match user returned from signin. sub from signin: ",r.profile.sub),Promise.reject(new Error("login_required"));i.Log.debug("UserManager._signinEnd: current user matches user returned from signin")}return e.storeUser(r).then((function(){return i.Log.debug("UserManager._signinEnd: user stored"),e._events.load(r),r}))}))},e.prototype._signinCallback=function(t,e){i.Log.debug("UserManager._signinCallback");var n="query"===this._settings.response_mode||!this._settings.response_mode&&f.SigninRequest.isCode(this._settings.response_type)?"?":"#";return e.callback(t,void 0,n)},e.prototype.signoutRedirect=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(t=Object.assign({},t)).request_type="so:r";var e=t.post_logout_redirect_uri||this.settings.post_logout_redirect_uri;e&&(t.post_logout_redirect_uri=e);var n={useReplaceToNavigate:t.useReplaceToNavigate};return this._signoutStart(t,this._redirectNavigator,n).then((function(){i.Log.info("UserManager.signoutRedirect: successful")}))},e.prototype.signoutRedirectCallback=function(t){return this._signoutEnd(t||this._redirectNavigator.url).then((function(t){return i.Log.info("UserManager.signoutRedirectCallback: successful"),t}))},e.prototype.signoutPopup=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(t=Object.assign({},t)).request_type="so:p";var e=t.post_logout_redirect_uri||this.settings.popup_post_logout_redirect_uri||this.settings.post_logout_redirect_uri;return t.post_logout_redirect_uri=e,t.display="popup",t.post_logout_redirect_uri&&(t.state=t.state||{}),this._signout(t,this._popupNavigator,{startUrl:e,popupWindowFeatures:t.popupWindowFeatures||this.settings.popupWindowFeatures,popupWindowTarget:t.popupWindowTarget||this.settings.popupWindowTarget}).then((function(){i.Log.info("UserManager.signoutPopup: successful")}))},e.prototype.signoutPopupCallback=function(t,e){return void 0===e&&"boolean"==typeof t&&(e=t,t=null),this._popupNavigator.callback(t,e,"?").then((function(){i.Log.info("UserManager.signoutPopupCallback: successful")}))},e.prototype._signout=function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._signoutStart(t,e,r).then((function(t){return n._signoutEnd(t.url)}))},e.prototype._signoutStart=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this,n=arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n.prepare(r).then((function(n){return i.Log.debug("UserManager._signoutStart: got navigator window handle"),e._loadUser().then((function(o){return i.Log.debug("UserManager._signoutStart: loaded current user from storage"),(e._settings.revokeAccessTokenOnSignout?e._revokeInternal(o):Promise.resolve()).then((function(){var s=t.id_token_hint||o&&o.id_token;return s&&(i.Log.debug("UserManager._signoutStart: Setting id_token into signout request"),t.id_token_hint=s),e.removeUser().then((function(){return i.Log.debug("UserManager._signoutStart: user removed, creating signout request"),e.createSignoutRequest(t).then((function(t){return i.Log.debug("UserManager._signoutStart: got signout request"),r.url=t.url,t.state&&(r.id=t.state.id),n.navigate(r)}))}))}))})).catch((function(t){throw n.close&&(i.Log.debug("UserManager._signoutStart: Error after preparing navigator, closing navigator window"),n.close()),t}))}))},e.prototype._signoutEnd=function(t){return this.processSignoutResponse(t).then((function(t){return i.Log.debug("UserManager._signoutEnd: got signout response"),t}))},e.prototype.revokeAccessToken=function(){var t=this;return this._loadUser().then((function(e){return t._revokeInternal(e,!0).then((function(n){if(n)return i.Log.debug("UserManager.revokeAccessToken: removing token properties from user and re-storing"),e.access_token=null,e.refresh_token=null,e.expires_at=null,e.token_type=null,t.storeUser(e).then((function(){i.Log.debug("UserManager.revokeAccessToken: user stored"),t._events.load(e)}))}))})).then((function(){i.Log.info("UserManager.revokeAccessToken: access token revoked successfully")}))},e.prototype._revokeInternal=function(t,e){var n=this;if(t){var r=t.refresh_token;return this._revokeAccessTokenInternal(t.access_token,e).then((function(t){return n._revokeRefreshTokenInternal(r,e).then((function(e){return t||e||i.Log.debug("UserManager.revokeAccessToken: no need to revoke due to no token(s), or JWT format"),t||e}))}))}return Promise.resolve(!1)},e.prototype._revokeAccessTokenInternal=function(t,e){return!t||t.indexOf(".")>=0?Promise.resolve(!1):this._tokenRevocationClient.revoke(t,e).then((function(){return!0}))},e.prototype._revokeRefreshTokenInternal=function(t,e){return t?this._tokenRevocationClient.revoke(t,e,"refresh_token").then((function(){return!0})):Promise.resolve(!1)},e.prototype.startSilentRenew=function(){this._silentRenewService.start()},e.prototype.stopSilentRenew=function(){this._silentRenewService.stop()},e.prototype._loadUser=function(){return this._userStore.get(this._userStoreKey).then((function(t){return t?(i.Log.debug("UserManager._loadUser: user storageString loaded"),a.User.fromStorageString(t)):(i.Log.debug("UserManager._loadUser: no user storageString"),null)}))},e.prototype.storeUser=function(t){if(t){i.Log.debug("UserManager.storeUser: storing user");var e=t.toStorageString();return this._userStore.set(this._userStoreKey,e)}return i.Log.debug("storeUser.storeUser: removing user"),this._userStore.remove(this._userStoreKey)},r(e,[{key:"_redirectNavigator",get:function(){return this.settings.redirectNavigator}},{key:"_popupNavigator",get:function(){return this.settings.popupNavigator}},{key:"_iframeNavigator",get:function(){return this.settings.iframeNavigator}},{key:"_userStore",get:function(){return this.settings.userStore}},{key:"events",get:function(){return this._events}},{key:"_userStoreKey",get:function(){return"user:"+this.settings.authority+":"+this.settings.client_id}}]),e}(o.OidcClient)},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.UserManagerSettings=void 0;var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),i=(n(0),n(5)),o=n(40),s=n(41),a=n(43),u=n(6),c=n(1),h=n(8);function f(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}e.UserManagerSettings=function(t){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.popup_redirect_uri,i=n.popup_post_logout_redirect_uri,d=n.popupWindowFeatures,v=n.popupWindowTarget,p=n.silent_redirect_uri,w=n.silentRequestTimeout,y=n.automaticSilentRenew,m=void 0!==y&&y,g=n.validateSubOnSilentRenew,b=void 0!==g&&g,E=n.includeIdTokenInSilentRenew,S=void 0===E||E,F=n.monitorSession,k=void 0===F||F,x=n.monitorAnonymousSession,_=void 0!==x&&x,A=n.checkSessionInterval,j=void 0===A?2e3:A,C=n.stopCheckSessionOnError,R=void 0===C||C,T=n.query_status_response_type,I=n.revokeAccessTokenOnSignout,O=void 0!==I&&I,N=n.accessTokenExpiringNotificationTime,P=void 0===N?60:N,D=n.redirectNavigator,M=void 0===D?new o.RedirectNavigator:D,U=n.popupNavigator,L=void 0===U?new s.PopupNavigator:U,B=n.iframeNavigator,J=void 0===B?new a.IFrameNavigator:B,K=n.userStore,H=void 0===K?new u.WebStorageStateStore({store:c.Global.sessionStorage}):K;f(this,e);var $=l(this,t.call(this,arguments[0]));return $._popup_redirect_uri=r,$._popup_post_logout_redirect_uri=i,$._popupWindowFeatures=d,$._popupWindowTarget=v,$._silent_redirect_uri=p,$._silentRequestTimeout=w,$._automaticSilentRenew=m,$._validateSubOnSilentRenew=b,$._includeIdTokenInSilentRenew=S,$._accessTokenExpiringNotificationTime=P,$._monitorSession=k,$._monitorAnonymousSession=_,$._checkSessionInterval=j,$._stopCheckSessionOnError=R,$._query_status_response_type=T||(arguments[0]&&arguments[0].response_type?h.SigninRequest.isOidc(arguments[0].response_type)?"id_token":"code":"id_token"),$._revokeAccessTokenOnSignout=O,$._redirectNavigator=M,$._popupNavigator=L,$._iframeNavigator=J,$._userStore=H,$}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),r(e,[{key:"popup_redirect_uri",get:function(){return this._popup_redirect_uri}},{key:"popup_post_logout_redirect_uri",get:function(){return this._popup_post_logout_redirect_uri}},{key:"popupWindowFeatures",get:function(){return this._popupWindowFeatures}},{key:"popupWindowTarget",get:function(){return this._popupWindowTarget}},{key:"silent_redirect_uri",get:function(){return this._silent_redirect_uri}},{key:"silentRequestTimeout",get:function(){return this._silentRequestTimeout}},{key:"automaticSilentRenew",get:function(){return this._automaticSilentRenew}},{key:"validateSubOnSilentRenew",get:function(){return this._validateSubOnSilentRenew}},{key:"includeIdTokenInSilentRenew",get:function(){return this._includeIdTokenInSilentRenew}},{key:"accessTokenExpiringNotificationTime",get:function(){return this._accessTokenExpiringNotificationTime}},{key:"monitorSession",get:function(){return this._monitorSession}},{key:"monitorAnonymousSession",get:function(){return this._monitorAnonymousSession}},{key:"checkSessionInterval",get:function(){return this._checkSessionInterval}},{key:"stopCheckSessionOnError",get:function(){return this._stopCheckSessionOnError}},{key:"query_status_response_type",get:function(){return this._query_status_response_type}},{key:"revokeAccessTokenOnSignout",get:function(){return this._revokeAccessTokenOnSignout}},{key:"redirectNavigator",get:function(){return this._redirectNavigator}},{key:"popupNavigator",get:function(){return this._popupNavigator}},{key:"iframeNavigator",get:function(){return this._iframeNavigator}},{key:"userStore",get:function(){return this._userStore}}]),e}(i.OidcClientSettings)},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.RedirectNavigator=void 0;var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),i=n(0);e.RedirectNavigator=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.prototype.prepare=function(){return Promise.resolve(this)},t.prototype.navigate=function(t){return t&&t.url?(t.useReplaceToNavigate?window.location.replace(t.url):window.location=t.url,Promise.resolve()):(i.Log.error("RedirectNavigator.navigate: No url provided"),Promise.reject(new Error("No url provided")))},r(t,[{key:"url",get:function(){return window.location.href}}]),t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.PopupNavigator=void 0;var r=n(0),i=n(42);e.PopupNavigator=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.prototype.prepare=function(t){var e=new i.PopupWindow(t);return Promise.resolve(e)},t.prototype.callback=function(t,e,n){r.Log.debug("PopupNavigator.callback");try{return i.PopupWindow.notifyOpener(t,e,n),Promise.resolve()}catch(t){return Promise.reject(t)}},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.PopupWindow=void 0;var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),i=n(0),o=n(3);e.PopupWindow=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._promise=new Promise((function(t,e){n._resolve=t,n._reject=e})),this._popup=window.open("",e.popupWindowTarget||"_blank",e.popupWindowFeatures||"location=no,toolbar=no,width=500,height=500,left=100,top=100;"),this._popup&&(i.Log.debug("PopupWindow.ctor: popup successfully created"),this._checkForPopupClosedTimer=window.setInterval(this._checkForPopupClosed.bind(this),500))}return t.prototype.navigate=function(t){return this._popup?t&&t.url?(i.Log.debug("PopupWindow.navigate: Setting URL in popup"),this._id=t.id,this._id&&(window["popupCallback_"+t.id]=this._callback.bind(this)),this._popup.focus(),this._popup.window.location=t.url):(this._error("PopupWindow.navigate: no url provided"),this._error("No url provided")):this._error("PopupWindow.navigate: Error opening popup window"),this.promise},t.prototype._success=function(t){i.Log.debug("PopupWindow.callback: Successful response from popup window"),this._cleanup(),this._resolve(t)},t.prototype._error=function(t){i.Log.error("PopupWindow.error: ",t),this._cleanup(),this._reject(new Error(t))},t.prototype.close=function(){this._cleanup(!1)},t.prototype._cleanup=function(t){i.Log.debug("PopupWindow.cleanup"),window.clearInterval(this._checkForPopupClosedTimer),this._checkForPopupClosedTimer=null,delete window["popupCallback_"+this._id],this._popup&&!t&&this._popup.close(),this._popup=null},t.prototype._checkForPopupClosed=function(){this._popup&&!this._popup.closed||this._error("Popup window closed")},t.prototype._callback=function(t,e){this._cleanup(e),t?(i.Log.debug("PopupWindow.callback success"),this._success({url:t})):(i.Log.debug("PopupWindow.callback: Invalid response from popup"),this._error("Invalid response from popup"))},t.notifyOpener=function(t,e,n){if(window.opener){if(t=t||window.location.href){var r=o.UrlUtility.parseUrlFragment(t,n);if(r.state){var s=window.opener["popupCallback_"+r.state];s?(i.Log.debug("PopupWindow.notifyOpener: passing url message to opener"),s(t,e)):i.Log.warn("PopupWindow.notifyOpener: no matching callback found on opener")}else i.Log.warn("PopupWindow.notifyOpener: no state found in response url")}}else i.Log.warn("PopupWindow.notifyOpener: no window.opener. Can't complete notification.")},r(t,[{key:"promise",get:function(){return this._promise}}]),t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.IFrameNavigator=void 0;var r=n(0),i=n(44);e.IFrameNavigator=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.prototype.prepare=function(t){var e=new i.IFrameWindow(t);return Promise.resolve(e)},t.prototype.callback=function(t){r.Log.debug("IFrameNavigator.callback");try{return i.IFrameWindow.notifyParent(t),Promise.resolve()}catch(t){return Promise.reject(t)}},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.IFrameWindow=void 0;var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),i=n(0);e.IFrameWindow=function(){function t(){var e=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._promise=new Promise((function(t,n){e._resolve=t,e._reject=n})),this._boundMessageEvent=this._message.bind(this),window.addEventListener("message",this._boundMessageEvent,!1),this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="absolute",this._frame.width=0,this._frame.height=0,window.document.body.appendChild(this._frame)}return t.prototype.navigate=function(t){if(t&&t.url){var e=t.silentRequestTimeout||1e4;i.Log.debug("IFrameWindow.navigate: Using timeout of:",e),this._timer=window.setTimeout(this._timeout.bind(this),e),this._frame.src=t.url}else this._error("No url provided");return this.promise},t.prototype._success=function(t){this._cleanup(),i.Log.debug("IFrameWindow: Successful response from frame window"),this._resolve(t)},t.prototype._error=function(t){this._cleanup(),i.Log.error(t),this._reject(new Error(t))},t.prototype.close=function(){this._cleanup()},t.prototype._cleanup=function(){this._frame&&(i.Log.debug("IFrameWindow: cleanup"),window.removeEventListener("message",this._boundMessageEvent,!1),window.clearTimeout(this._timer),window.document.body.removeChild(this._frame),this._timer=null,this._frame=null,this._boundMessageEvent=null)},t.prototype._timeout=function(){i.Log.debug("IFrameWindow.timeout"),this._error("Frame window timed out")},t.prototype._message=function(t){if(i.Log.debug("IFrameWindow.message"),this._timer&&t.origin===this._origin&&t.source===this._frame.contentWindow&&"string"==typeof t.data&&(t.data.startsWith("http://")||t.data.startsWith("https://"))){var e=t.data;e?this._success({url:e}):this._error("Invalid response from frame")}},t.notifyParent=function(t){i.Log.debug("IFrameWindow.notifyParent"),(t=t||window.location.href)&&(i.Log.debug("IFrameWindow.notifyParent: posting url message to parent"),window.parent.postMessage(t,location.protocol+"//"+location.host))},r(t,[{key:"promise",get:function(){return this._promise}},{key:"_origin",get:function(){return location.protocol+"//"+location.host}}]),t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.UserManagerEvents=void 0;var r=n(0),i=n(16),o=n(17);e.UserManagerEvents=function(t){function e(n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return r._userLoaded=new o.Event("User loaded"),r._userUnloaded=new o.Event("User unloaded"),r._silentRenewError=new o.Event("Silent renew error"),r._userSignedIn=new o.Event("User signed in"),r._userSignedOut=new o.Event("User signed out"),r._userSessionChanged=new o.Event("User session changed"),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.load=function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];r.Log.debug("UserManagerEvents.load"),t.prototype.load.call(this,e),n&&this._userLoaded.raise(e)},e.prototype.unload=function(){r.Log.debug("UserManagerEvents.unload"),t.prototype.unload.call(this),this._userUnloaded.raise()},e.prototype.addUserLoaded=function(t){this._userLoaded.addHandler(t)},e.prototype.removeUserLoaded=function(t){this._userLoaded.removeHandler(t)},e.prototype.addUserUnloaded=function(t){this._userUnloaded.addHandler(t)},e.prototype.removeUserUnloaded=function(t){this._userUnloaded.removeHandler(t)},e.prototype.addSilentRenewError=function(t){this._silentRenewError.addHandler(t)},e.prototype.removeSilentRenewError=function(t){this._silentRenewError.removeHandler(t)},e.prototype._raiseSilentRenewError=function(t){r.Log.debug("UserManagerEvents._raiseSilentRenewError",t.message),this._silentRenewError.raise(t)},e.prototype.addUserSignedIn=function(t){this._userSignedIn.addHandler(t)},e.prototype.removeUserSignedIn=function(t){this._userSignedIn.removeHandler(t)},e.prototype._raiseUserSignedIn=function(){r.Log.debug("UserManagerEvents._raiseUserSignedIn"),this._userSignedIn.raise()},e.prototype.addUserSignedOut=function(t){this._userSignedOut.addHandler(t)},e.prototype.removeUserSignedOut=function(t){this._userSignedOut.removeHandler(t)},e.prototype._raiseUserSignedOut=function(){r.Log.debug("UserManagerEvents._raiseUserSignedOut"),this._userSignedOut.raise()},e.prototype.addUserSessionChanged=function(t){this._userSessionChanged.addHandler(t)},e.prototype.removeUserSessionChanged=function(t){this._userSessionChanged.removeHandler(t)},e.prototype._raiseUserSessionChanged=function(){r.Log.debug("UserManagerEvents._raiseUserSessionChanged"),this._userSessionChanged.raise()},e}(i.AccessTokenEvents)},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.Timer=void 0;var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),i=n(0),o=n(1),s=n(17);function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}e.Timer=function(t){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.Global.timer,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;a(this,e);var s=u(this,t.call(this,n));return s._timer=r,s._nowFunc=i||function(){return Date.now()/1e3},s}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.init=function(t){t<=0&&(t=1),t=parseInt(t);var e=this.now+t;if(this.expiration===e&&this._timerHandle)i.Log.debug("Timer.init timer "+this._name+" skipping initialization since already initialized for expiration:",this.expiration);else{this.cancel(),i.Log.debug("Timer.init timer "+this._name+" for duration:",t),this._expiration=e;var n=5;t<n&&(n=t),this._timerHandle=this._timer.setInterval(this._callback.bind(this),1e3*n)}},e.prototype.cancel=function(){this._timerHandle&&(i.Log.debug("Timer.cancel: ",this._name),this._timer.clearInterval(this._timerHandle),this._timerHandle=null)},e.prototype._callback=function(){i.Log.debug("Timer.callback; "+this._name+" timer expires in:",this._expiration-this.now),this._expiration<=this.now&&(this.cancel(),t.prototype.raise.call(this))},r(e,[{key:"now",get:function(){return parseInt(this._nowFunc())}},{key:"expiration",get:function(){return this._expiration}}]),e}(s.Event)},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.SilentRenewService=void 0;var r=n(0);e.SilentRenewService=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._userManager=e}return t.prototype.start=function(){this._callback||(this._callback=this._tokenExpiring.bind(this),this._userManager.events.addAccessTokenExpiring(this._callback),this._userManager.getUser().then((function(){})).catch((function(t){r.Log.error("SilentRenewService.start: Error from getUser:",t.message)})))},t.prototype.stop=function(){this._callback&&(this._userManager.events.removeAccessTokenExpiring(this._callback),delete this._callback)},t.prototype._tokenExpiring=function(){var t=this;this._userManager.signinSilent().then((function(){r.Log.debug("SilentRenewService._tokenExpiring: Silent token renewal successful")}),(function(e){r.Log.error("SilentRenewService._tokenExpiring: Error from signinSilent:",e.message),t._userManager.events._raiseSilentRenewError(e)}))},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.CordovaPopupNavigator=void 0;var r=n(21);e.CordovaPopupNavigator=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.prototype.prepare=function(t){var e=new r.CordovaPopupWindow(t);return Promise.resolve(e)},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.CordovaIFrameNavigator=void 0;var r=n(21);e.CordovaIFrameNavigator=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.prototype.prepare=function(t){t.popupWindowFeatures="hidden=yes";var e=new r.CordovaPopupWindow(t);return Promise.resolve(e)},t}()},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Version="1.11.6"}])}))}}),Zr=b({"../node_modules/@inrupt/oidc-client-ext/dist/index.js"(t){var e=Qr(),n=Xr();function r(t){return void 0!==t.error_description&&"string"==typeof t.error_description}function i(t,e){if(void 0!==(i=t).error&&"string"==typeof i.error)throw new n.OidcProviderError(`Token endpoint returned error [${t.error}]${r(t)?`: ${t.error_description}`:""}${function(t){return void 0!==t.error_uri&&"string"==typeof t.error_uri}(t)?` (see ${t.error_uri})`:""}`,t.error,r(t)?t.error_description:void 0);var i;if(!function(t){return void 0!==t.access_token&&"string"==typeof t.access_token}(t))throw new n.InvalidResponseError(["access_token"]);if(!function(t){return void 0!==t.id_token&&"string"==typeof t.id_token}(t))throw new n.InvalidResponseError(["id_token"]);if(!function(t){return void 0!==t.token_type&&"string"==typeof t.token_type}(t))throw new n.InvalidResponseError(["token_type"]);if(!function(t){return void 0===t.expires_in||"number"==typeof t.expires_in}(t))throw new n.InvalidResponseError(["expires_in"]);if(!e&&"bearer"!==t.token_type.toLowerCase())throw new Error(`Invalid token endpoint response: requested a [Bearer] token, but got a 'token_type' value of [${t.token_type}].`);return t}Object.defineProperty(t,"CordovaIFrameNavigator",{enumerable:!0,get:function(){return e.CordovaIFrameNavigator}}),Object.defineProperty(t,"CordovaPopupNavigator",{enumerable:!0,get:function(){return e.CordovaPopupNavigator}}),Object.defineProperty(t,"InMemoryWebStorage",{enumerable:!0,get:function(){return e.InMemoryWebStorage}}),Object.defineProperty(t,"Log",{enumerable:!0,get:function(){return e.Log}}),Object.defineProperty(t,"OidcClient",{enumerable:!0,get:function(){return e.OidcClient}}),Object.defineProperty(t,"SessionMonitor",{enumerable:!0,get:function(){return e.SessionMonitor}}),Object.defineProperty(t,"User",{enumerable:!0,get:function(){return e.User}}),Object.defineProperty(t,"UserManager",{enumerable:!0,get:function(){return e.UserManager}}),Object.defineProperty(t,"Version",{enumerable:!0,get:function(){return e.Version}}),Object.defineProperty(t,"WebStorageStateStore",{enumerable:!0,get:function(){return e.WebStorageStateStore}}),t.clearOidcPersistentStorage=async function(){const t=new e.OidcClient({response_mode:"query"});await t.clearStaleState(new e.WebStorageStateStore({}));const n=window.localStorage,r=[];for(let t=0;t<=n.length;t+=1){const e=n.key(t);e&&(e.match(/^oidc\..+$/)||e.match(/^solidClientAuthenticationUser:.+$/))&&r.push(e)}r.forEach((t=>n.removeItem(t)))},t.getBearerToken=async function(t){let r;try{const i=new e.OidcClient({response_mode:"query",loadUserInfo:!1});if(r=await i.processSigninResponse(t),void 0===i.settings.metadata)throw new Error("Cannot retrieve issuer metadata from client information in storage.");if(void 0===i.settings.metadata.jwks_uri)throw new Error("Missing some issuer metadata from client information in storage: 'jwks_uri' is undefined");if(void 0===i.settings.metadata.issuer)throw new Error("Missing some issuer metadata from client information in storage: 'issuer' is undefined");if(void 0===i.settings.client_id)throw new Error("Missing some client information in storage: 'client_id' is undefined");const o=await n.getWebidFromTokenPayload(r.id_token,i.settings.metadata.jwks_uri,i.settings.metadata.issuer,i.settings.client_id);return{accessToken:r.access_token,idToken:r.id_token,webId:o,refreshToken:r.refresh_token}}catch(e){throw new Error(`Problem handling Auth Code Grant (Flow) redirect - URL [${t}]: ${e}`)}},t.getDpopToken=async function(t,e,r){return async function(t,e,r,o){!function(t,e){if(e.grantType&&(!t.grantTypesSupported||!t.grantTypesSupported.includes(e.grantType)))throw new Error(`The issuer [${t.issuer}] does not support the [${e.grantType}] grant`);if(!t.tokenEndpoint)throw new Error(`This issuer [${t.issuer}] does not have a token endpoint`)}(t,r);const s={"content-type":"application/x-www-form-urlencoded"};let a;o&&(a=await n.generateDpopKeyPair(),s.DPoP=await n.createDpopHeader(t.tokenEndpoint,"POST",a)),e.clientSecret&&(s.Authorization=`Basic ${btoa(`${e.clientId}:${e.clientSecret}`)}`);const u={method:"POST",headers:s,body:new URLSearchParams({grant_type:r.grantType,redirect_uri:r.redirectUrl,code:r.code,code_verifier:r.codeVerifier,client_id:e.clientId}).toString()},c=await await fetch(t.tokenEndpoint,u),h=i(await c.json(),o),f=await n.getWebidFromTokenPayload(h.id_token,t.jwksUri,t.issuer,e.clientId);return{accessToken:h.access_token,idToken:h.id_token,refreshToken:(l=h,void 0!==l.refresh_token&&"string"==typeof l.refresh_token?h.refresh_token:void 0),webId:f,dpopKey:a,expiresIn:h.expires_in};var l}(t,e,r,!0)},t.refresh=async function(t,e,r,o){if(void 0===r.clientId)throw new Error("No client ID available when trying to refresh the access token.");const s={grant_type:"refresh_token",refresh_token:t,scope:n.DEFAULT_SCOPES};let a={};void 0!==o&&(a={DPoP:await n.createDpopHeader(e.tokenEndpoint,"POST",o)});let u={};void 0!==r.clientSecret?u={Authorization:`Basic ${btoa(`${r.clientId}:${r.clientSecret}`)}`}:(t=>{try{return new URL(t),!0}catch(t){return!1}})(r.clientId)&&(s.client_id=r.clientId);const c=await fetch(e.tokenEndpoint,{method:"POST",body:new URLSearchParams(s).toString(),headers:{...a,...u,"Content-Type":"application/x-www-form-urlencoded"}});let h;try{h=await c.json()}catch(t){throw new Error(`The token endpoint of issuer ${e.issuer} returned a malformed response.`)}const f=i(h,void 0!==o),l=await n.getWebidFromTokenPayload(f.id_token,e.jwksUri,e.issuer,r.clientId);return{accessToken:f.access_token,idToken:f.id_token,refreshToken:"string"==typeof f.refresh_token?f.refresh_token:void 0,webId:l,dpopKey:o,expiresIn:f.expires_in}},t.registerClient=async function(t,e){var r;if(!e.registrationEndpoint)throw new Error("Dynamic Registration could not be completed because the issuer has no registration endpoint.");if(!Array.isArray(e.idTokenSigningAlgValuesSupported))throw new Error("The OIDC issuer discovery profile is missing the 'id_token_signing_alg_values_supported' value, which is mandatory.");const i=n.determineSigningAlg(e.idTokenSigningAlgValuesSupported,n.PREFERRED_SIGNING_ALG),o={client_name:t.clientName,application_type:"web",redirect_uris:[null===(r=t.redirectUrl)||void 0===r?void 0:r.toString()],subject_type:"public",token_endpoint_auth_method:"client_secret_basic",id_token_signed_response_alg:i,grant_types:["authorization_code","refresh_token"]},s=await fetch(e.registrationEndpoint.toString(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(s.ok){const e=await s.json();return function(t,e){if(void 0===t.client_id)throw new Error(`Dynamic client registration failed: no client_id has been found on ${JSON.stringify(t)}`);if(e.redirectUrl&&(void 0===t.redirect_uris||t.redirect_uris[0]!==e.redirectUrl.toString()))throw new Error(`Dynamic client registration failed: the returned redirect URIs ${JSON.stringify(t.redirect_uris)} don't match the provided ${JSON.stringify([e.redirectUrl.toString()])}`)}(e,t),{clientId:e.client_id,clientSecret:e.client_secret,idTokenSignedResponseAlg:e.id_token_signed_response_alg,clientType:"dynamic"}}throw 400===s.status&&function(t,e){var n,r,i,o;if("invalid_redirect_uri"===t.error)throw new Error(`Dynamic client registration failed: the provided redirect uri [${null===(n=e.redirectUrl)||void 0===n?void 0:n.toString()}] is invalid - ${null!==(r=t.error_description)&&void 0!==r?r:""}`);if("invalid_client_metadata"===t.error)throw new Error(`Dynamic client registration failed: the provided client metadata ${JSON.stringify(e)} is invalid - ${null!==(i=t.error_description)&&void 0!==i?i:""}`);throw new Error(`Dynamic client registration failed: ${t.error} - ${null!==(o=t.error_description)&&void 0!==o?o:""}`)}(await s.json(),t),new Error(`Dynamic client registration failed: the server returned ${s.status} ${s.statusText} - ${await s.text()}`)},t.removeOidcQueryParam=function(t){const e=new URL(t);return e.searchParams.delete("code"),e.searchParams.delete("state"),e.hash="",e.toString()}}}),ti=b({"../node_modules/@inrupt/solid-client-authn-browser/dist/ClientAuthentication.js"(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Xr(),n=Zr(),r=(t,e)=>window.fetch(t,e);t.default=class{constructor(t,i,o,s,a){this.loginHandler=t,this.redirectHandler=i,this.logoutHandler=o,this.sessionInfoManager=s,this.issuerConfigFetcher=a,this.login=async(t,e)=>{var r,i;await this.sessionInfoManager.clear(t.sessionId);const o=(0,n.removeOidcQueryParam)(null!==(r=t.redirectUrl)&&void 0!==r?r:window.location.href);await this.loginHandler.handle({...t,redirectUrl:o,clientName:null!==(i=t.clientName)&&void 0!==i?i:t.clientId,eventEmitter:e})},this.fetch=r,this.logout=async t=>{await this.logoutHandler.handle(t),this.fetch=r},this.getSessionInfo=async t=>this.sessionInfoManager.get(t),this.getAllSessionInfo=async()=>this.sessionInfoManager.getAll(),this.validateCurrentSession=async t=>{const e=await this.sessionInfoManager.get(t);return void 0===e||void 0===e.clientAppId||void 0===e.issuer?null:e},this.handleIncomingRedirect=async(t,n)=>{try{const e=await this.redirectHandler.handle(t,n);return this.fetch=e.fetch.bind(window),this.cleanUrlAfterRedirect(t),{isLoggedIn:e.isLoggedIn,webId:e.webId,sessionId:e.sessionId,expirationDate:e.expirationDate}}catch(r){return this.cleanUrlAfterRedirect(t),void n.emit(e.EVENTS.ERROR,"redirect",r)}}}cleanUrlAfterRedirect(t){const e=new URL(t);e.searchParams.delete("state"),e.searchParams.delete("code"),e.searchParams.delete("id_token"),e.searchParams.delete("access_token"),e.searchParams.delete("error"),e.searchParams.delete("error_description"),window.history.replaceState(null,"",e.toString())}}}}),ei=b({"../node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/OidcLoginHandler.js"(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Xr();function n(t){return"string"==typeof t.oidcIssuer}function r(t){return"string"==typeof t.redirectUrl}t.default=class{constructor(t,e,n,r){this.storageUtility=t,this.oidcHandler=e,this.issuerConfigFetcher=n,this.clientRegistrar=r}async canHandle(t){return n(t)&&r(t)}async handle(t){if(!n(t))throw new e.ConfigurationError(`OidcLoginHandler requires an OIDC issuer: missing property 'oidcIssuer' in ${JSON.stringify(t)}`);if(!r(t))throw new e.ConfigurationError(`OidcLoginHandler requires a redirect URL: missing property 'redirectUrl' in ${JSON.stringify(t)}`);const i=await this.issuerConfigFetcher.fetchConfig(t.oidcIssuer),o=await(0,e.handleRegistration)(t,i,this.storageUtility,this.clientRegistrar),s={issuer:i.issuer,dpop:"dpop"===t.tokenType.toLowerCase(),...t,issuerConfiguration:i,client:o};return this.oidcHandler.handle(s)}}}}),ni=b({"../node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler.js"(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Xr(),n=Zr();t.default=class{constructor(t,e){this.storageUtility=t,this.redirector=e}async canHandle(t){return!!(t.issuerConfiguration.grantTypesSupported&&t.issuerConfiguration.grantTypesSupported.indexOf("authorization_code")>-1)}async handle(t){var r;const i={authority:t.issuer.toString(),client_id:t.client.clientId,client_secret:t.client.clientSecret,redirect_uri:t.redirectUrl.toString(),post_logout_redirect_uri:t.redirectUrl.toString(),response_type:"code",scope:e.DEFAULT_SCOPES,filterProtocolClaims:!0,loadUserInfo:!1,code_verifier:!0,prompt:null!==(r=t.prompt)&&void 0!==r?r:"consent"},o=new n.OidcClient(i),{redirector:s}=this,a=this.storageUtility;try{const e=await o.createSigninRequest();await Promise.all([a.setForUser(e.state._id,{sessionId:t.sessionId}),a.setForUser(t.sessionId,{codeVerifier:e.state._code_verifier,issuer:t.issuer.toString(),redirectUrl:t.redirectUrl,dpop:t.dpop?"true":"false"})]),s.redirect(e.url.toString(),{handleRedirect:t.handleRedirect})}catch(t){console.error(t)}}}}}),ri=b({"../node_modules/@inrupt/solid-client-authn-browser/dist/util/urlPath.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.appendToUrlPathname=void 0,t.appendToUrlPathname=function(t,e){const n=new URL(t),r=n.pathname;return n.pathname=`${r}${r.endsWith("/")?"":"/"}${e.startsWith("/")?e.substring(1):e}`,n.toString()}}}),ii=b({"../node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/IssuerConfigFetcher.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.WELL_KNOWN_OPENID_CONFIG=void 0;var e=Xr(),n=ri();t.WELL_KNOWN_OPENID_CONFIG=".well-known/openid-configuration";var r={issuer:{toKey:"issuer",convertToUrl:!0},authorization_endpoint:{toKey:"authorizationEndpoint",convertToUrl:!0},token_endpoint:{toKey:"tokenEndpoint",convertToUrl:!0},userinfo_endpoint:{toKey:"userinfoEndpoint",convertToUrl:!0},jwks_uri:{toKey:"jwksUri",convertToUrl:!0},registration_endpoint:{toKey:"registrationEndpoint",convertToUrl:!0},scopes_supported:{toKey:"scopesSupported"},response_types_supported:{toKey:"responseTypesSupported"},response_modes_supported:{toKey:"responseModesSupported"},grant_types_supported:{toKey:"grantTypesSupported"},acr_values_supported:{toKey:"acrValuesSupported"},subject_types_supported:{toKey:"subjectTypesSupported"},id_token_signing_alg_values_supported:{toKey:"idTokenSigningAlgValuesSupported"},id_token_encryption_alg_values_supported:{toKey:"idTokenEncryptionAlgValuesSupported"},id_token_encryption_enc_values_supported:{toKey:"idTokenEncryptionEncValuesSupported"},userinfo_signing_alg_values_supported:{toKey:"userinfoSigningAlgValuesSupported"},userinfo_encryption_alg_values_supported:{toKey:"userinfoEncryptionAlgValuesSupported"},userinfo_encryption_enc_values_supported:{toKey:"userinfoEncryptionEncValuesSupported"},request_object_signing_alg_values_supported:{toKey:"requestObjectSigningAlgValuesSupported"},request_object_encryption_alg_values_supported:{toKey:"requestObjectEncryptionAlgValuesSupported"},request_object_encryption_enc_values_supported:{toKey:"requestObjectEncryptionEncValuesSupported"},token_endpoint_auth_methods_supported:{toKey:"tokenEndpointAuthMethodsSupported"},token_endpoint_auth_signing_alg_values_supported:{toKey:"tokenEndpointAuthSigningAlgValuesSupported"},display_values_supported:{toKey:"displayValuesSupported"},claim_types_supported:{toKey:"claimTypesSupported"},claims_supported:{toKey:"claimsSupported"},service_documentation:{toKey:"serviceDocumentation"},claims_locales_supported:{toKey:"claimsLocalesSupported"},ui_locales_supported:{toKey:"uiLocalesSupported"},claims_parameter_supported:{toKey:"claimsParameterSupported"},request_parameter_supported:{toKey:"requestParameterSupported"},request_uri_parameter_supported:{toKey:"requestUriParameterSupported"},require_request_uri_registration:{toKey:"requireRequestUriRegistration"},op_policy_uri:{toKey:"opPolicyUri",convertToUrl:!0},op_tos_uri:{toKey:"opTosUri",convertToUrl:!0}},i=class{constructor(t){this.storageUtility=t}static getLocalStorageKey(t){return`issuerConfig:${t}`}async fetchConfig(o){let s;const a=(0,n.appendToUrlPathname)(o,t.WELL_KNOWN_OPENID_CONFIG),u=await window.fetch(a);try{s=function(t){const e={};return Object.keys(t).forEach((n=>{r[n]&&(e[r[n].toKey]=t[n])})),Array.isArray(e.scopesSupported)||(e.scopesSupported=["openid"]),e}(await u.json())}catch(t){throw new e.ConfigurationError(`[${o.toString()}] has an invalid configuration: ${t.message}`)}return await this.storageUtility.set(i.getLocalStorageKey(o),JSON.stringify(s)),s}};t.default=i}}),oi=b({"../node_modules/@inrupt/solid-client-authn-browser/dist/sessionInfo/SessionInfoManager.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.SessionInfoManager=t.clear=t.getUnauthenticatedSession=void 0;var e=Xr(),n=zr(),r=Zr();async function i(t,e){await Promise.all([e.deleteAllUserData(t,{secure:!1}),e.deleteAllUserData(t,{secure:!0}),e.delete("clientKey",{secure:!1})]),await(0,r.clearOidcPersistentStorage)()}t.getUnauthenticatedSession=function(){return{isLoggedIn:!1,sessionId:(0,n.v4)(),fetch}},t.clear=i,t.SessionInfoManager=class{constructor(t){this.storageUtility=t}update(t,e){throw new Error("Not Implemented")}async get(t){var n;const r=await this.storageUtility.getForUser(t,"isLoggedIn",{secure:!0}),i=await this.storageUtility.getForUser(t,"webId",{secure:!0}),o=await this.storageUtility.getForUser(t,"clientId",{secure:!1}),s=await this.storageUtility.getForUser(t,"clientSecret",{secure:!1}),a=await this.storageUtility.getForUser(t,"redirectUrl",{secure:!1}),u=await this.storageUtility.getForUser(t,"refreshToken",{secure:!0}),c=await this.storageUtility.getForUser(t,"issuer",{secure:!1}),h=null!==(n=await this.storageUtility.getForUser(t,"tokenType",{secure:!1}))&&void 0!==n?n:"DPoP";if(!(0,e.isSupportedTokenType)(h))throw new Error(`Tokens of type [${h}] are not supported.`);if(void 0!==o||void 0!==r||void 0!==i||void 0!==u)return{sessionId:t,webId:i,isLoggedIn:"true"===r,redirectUrl:a,refreshToken:u,issuer:c,clientAppId:o,clientAppSecret:s,tokenType:h}}async getAll(){throw new Error("Not implemented")}async clear(t){return i(t,this.storageUtility)}async register(t){throw new Error("Not implemented")}async getRegisteredSessionIdAll(){throw new Error("Not implemented")}async clearAll(){throw new Error("Not implemented")}}}}),si=b({"../node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/incomingRedirectHandler/FallbackRedirectHandler.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.FallbackRedirectHandler=void 0;var e=oi();t.FallbackRedirectHandler=class{async canHandle(t){try{return new URL(t),!0}catch(e){throw new Error(`[${t}] is not a valid URL, and cannot be used as a redirect URL: ${e}`)}}async handle(t){return(0,e.getUnauthenticatedSession)()}}}}),ai=b({"../node_modules/@inrupt/solid-client-authn-browser/dist/logout/GeneralLogoutHandler.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(t){this.sessionInfoManager=t}async canHandle(){return!0}async handle(t){await this.sessionInfoManager.clear(t)}}}}),ui=b({"../node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/incomingRedirectHandler/AuthCodeRedirectHandler.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.AuthCodeRedirectHandler=void 0;var e=Xr(),n=Zr();t.AuthCodeRedirectHandler=class{constructor(t,e,n,r,i){this.storageUtility=t,this.sessionInfoManager=e,this.issuerConfigFetcher=n,this.clientRegistrar=r,this.tokerRefresher=i}async canHandle(t){try{const e=new URL(t);return null!==e.searchParams.get("code")&&null!==e.searchParams.get("state")}catch(e){throw new Error(`[${t}] is not a valid URL, and cannot be used as a redirect URL: ${e}`)}}async handle(t,r){if(!await this.canHandle(t))throw new Error(`AuthCodeRedirectHandler cannot handle [${t}]: it is missing one of [code, state].`);const i=new URL(t),o=i.searchParams.get("state"),s=await this.storageUtility.getForUser(o,"sessionId",{errorIfNull:!0}),{issuerConfig:a,codeVerifier:u,redirectUrl:c,dpop:h}=await(0,e.loadOidcContextFromStorage)(s,this.storageUtility,this.issuerConfigFetcher);if(void 0===u)throw new Error(`The code verifier for session ${s} is missing from storage.`);if(void 0===c)throw new Error(`The redirect URL for session ${s} is missing from storage.`);const f=await this.clientRegistrar.getClient({sessionId:s},a);let l;const d=Date.now();let v;h?(l=await(0,n.getDpopToken)(a,f,{grantType:"authorization_code",code:i.searchParams.get("code"),codeVerifier:u,redirectUrl:c}),window.localStorage.removeItem(`oidc.${o}`)):l=await(0,n.getBearerToken)(i.toString()),void 0!==l.refreshToken&&(v={sessionId:s,refreshToken:l.refreshToken,tokenRefresher:this.tokerRefresher});const p=await(0,e.buildAuthenticatedFetch)(fetch,l.accessToken,{dpopKey:l.dpopKey,refreshOptions:v,eventEmitter:r,expiresIn:l.expiresIn});await this.storageUtility.setForUser(s,{webId:l.webId,isLoggedIn:"true"},{secure:!0}),i.searchParams.delete("code"),await this.storageUtility.setForUser(s,{redirectUrl:i.toString()},{secure:!1});const w=await this.sessionInfoManager.get(s);if(!w)throw new Error(`Could not retrieve session: [${s}].`);return Object.assign(w,{fetch:p,expirationDate:"number"==typeof l.expiresIn?d+1e3*l.expiresIn:null})}}}}),ci=b({"../node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/AggregateRedirectHandler.js"(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Xr();t.default=class extends e.AggregateHandler{constructor(t){super(t)}}}}),hi=b({"../node_modules/@inrupt/solid-client-authn-browser/dist/storage/BrowserStorage.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{get storage(){return window.localStorage}async get(t){return this.storage.getItem(t)||void 0}async set(t,e){this.storage.setItem(t,e)}async delete(t){this.storage.removeItem(t)}}}}),fi=b({"../node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/Redirector.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{redirect(t,e){e&&e.handleRedirect?e.handleRedirect(t):e&&e.redirectByReplacingState?window.history.replaceState({},"",t):window.location.href=t}}}}),li=b({"../node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/ClientRegistrar.js"(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Zr();t.default=class{constructor(t){this.storageUtility=t}async getClient(t,n){const[r,i]=await Promise.all([this.storageUtility.getForUser(t.sessionId,"clientId",{secure:!1}),this.storageUtility.getForUser(t.sessionId,"clientSecret",{secure:!1})]);if(r)return{clientId:r,clientSecret:i,clientType:"dynamic"};try{const r=await(0,e.registerClient)(t,n),i={clientId:r.clientId};return r.clientSecret&&(i.clientSecret=r.clientSecret),r.idTokenSignedResponseAlg&&(i.idTokenSignedResponseAlg=r.idTokenSignedResponseAlg),await this.storageUtility.setForUser(t.sessionId,i,{secure:!1}),r}catch(t){throw new Error(`Client registration failed: [${t}]`)}}}}}),di=b({"../node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/incomingRedirectHandler/ErrorOidcHandler.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorOidcHandler=void 0;var e=Xr(),n=oi();t.ErrorOidcHandler=class{async canHandle(t){try{return new URL(t).searchParams.has("error")}catch(e){throw new Error(`[${t}] is not a valid URL, and cannot be used as a redirect URL: ${e}`)}}async handle(t,r){if(void 0!==r){const n=new URL(t),i=n.searchParams.get("error"),o=n.searchParams.get("error_description");r.emit(e.EVENTS.ERROR,i,o)}return(0,n.getUnauthenticatedSession)()}}}}),vi=b({"../node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/refresh/TokenRefresher.js"(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Xr(),n=Zr();t.default=class{constructor(t,e,n){this.storageUtility=t,this.issuerConfigFetcher=e,this.clientRegistrar=n}async refresh(t,r,i,o){const s=await(0,e.loadOidcContextFromStorage)(t,this.storageUtility,this.issuerConfigFetcher),a=await this.clientRegistrar.getClient({sessionId:t},s.issuerConfig);if(void 0===r)throw new Error(`Session [${t}] has no refresh token to allow it to refresh its access token.`);if(s.dpop&&void 0===i)throw new Error(`For session [${t}], the key bound to the DPoP access token must be provided to refresh said access token.`);const u=await(0,n.refresh)(r,s.issuerConfig,a,i);return void 0!==u.refreshToken&&(null==o||o.emit(e.EVENTS.NEW_REFRESH_TOKEN,u.refreshToken),await this.storageUtility.setForUser(t,{refreshToken:u.refreshToken})),u}}}}),pi=b({"../node_modules/@inrupt/solid-client-authn-browser/dist/dependencies.js"(t){var e=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.getClientAuthenticationWithDependencies=void 0;var n=Xr(),r=e(Yr()),i=e(ti()),o=e(ei()),s=e(ni()),a=e(ii()),u=si(),c=e(ai()),h=oi(),f=ui(),l=e(ci()),d=e(hi()),v=e(fi()),p=e(li()),w=di(),y=e(vi());t.getClientAuthenticationWithDependencies=function(t){const e=new n.InMemoryStorage,m=t.secureStorage||e,g=t.insecureStorage||new d.default,b=new r.default(m,g),E=new a.default(b),S=new p.default(b),F=new h.SessionInfoManager(b),k=new y.default(b,E,S),x=new o.default(b,new s.default(b,new v.default),E,S),_=new l.default([new w.ErrorOidcHandler,new f.AuthCodeRedirectHandler(b,F,E,S,k),new u.FallbackRedirectHandler]);return new i.default(x,_,new c.default(F),F,E)}}}),wi=b({"../node_modules/@inrupt/solid-client-authn-browser/dist/constant.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.KEY_CURRENT_URL=t.KEY_CURRENT_SESSION=void 0;var e=Xr();t.KEY_CURRENT_SESSION=`${e.SOLID_CLIENT_AUTHN_KEY_PREFIX}currentSession`,t.KEY_CURRENT_URL=`${e.SOLID_CLIENT_AUTHN_KEY_PREFIX}currentUrl`}}),yi=b({"../node_modules/@inrupt/solid-client-authn-browser/dist/Session.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Session=t.silentlyAuthenticate=void 0;var e=x(),n=Xr(),r=zr(),i=pi(),o=wi();async function s(t,e,n){var r;const i=await e.validateCurrentSession(t);return null!==i&&(window.localStorage.setItem(o.KEY_CURRENT_URL,window.location.href),await e.login({sessionId:t,prompt:"none",oidcIssuer:i.issuer,redirectUrl:i.redirectUrl,clientId:i.clientAppId,clientSecret:i.clientAppSecret,tokenType:null!==(r=i.tokenType)&&void 0!==r?r:"DPoP"},n),!0)}t.silentlyAuthenticate=s,t.Session=class extends e.EventEmitter{constructor(t={},e){super(),this.tokenRequestInProgress=!1,this.login=async t=>{var e;return await this.clientAuthentication.login({sessionId:this.info.sessionId,...t,tokenType:null!==(e=t.tokenType)&&void 0!==e?e:"DPoP"},this),new Promise((()=>{}))},this.fetch=async(t,e)=>this.clientAuthentication.fetch(t,e),this.internalLogout=async t=>{window.localStorage.removeItem(o.KEY_CURRENT_SESSION),await this.clientAuthentication.logout(this.info.sessionId),this.info.isLoggedIn=!1,t&&this.emit(n.EVENTS.LOGOUT)},this.logout=async()=>this.internalLogout(!0),this.handleIncomingRedirect=async(t={})=>{var e;if(this.info.isLoggedIn)return this.info;if(this.tokenRequestInProgress)return;const r="string"==typeof t?{url:t}:t,i=null!==(e=r.url)&&void 0!==e?e:window.location.href;this.tokenRequestInProgress=!0;const a=await this.clientAuthentication.handleIncomingRedirect(i,this);if(function(t){return!!(null==t?void 0:t.isLoggedIn)}(a)){this.setSessionInfo(a);const t=window.localStorage.getItem(o.KEY_CURRENT_URL);null===t?this.emit(n.EVENTS.LOGIN):(window.localStorage.removeItem(o.KEY_CURRENT_URL),this.emit(n.EVENTS.SESSION_RESTORED,t))}else if(!0===r.restorePreviousSession){const t=window.localStorage.getItem(o.KEY_CURRENT_SESSION);if(null!==t&&await s(t,this.clientAuthentication,this))return new Promise((()=>{}))}return this.tokenRequestInProgress=!1,a},this.clientAuthentication=t.clientAuthentication?t.clientAuthentication:(0,i.getClientAuthenticationWithDependencies)(t.secureStorage&&t.insecureStorage?{secureStorage:t.secureStorage,insecureStorage:t.insecureStorage}:{}),this.info=t.sessionInfo?{sessionId:t.sessionInfo.sessionId,isLoggedIn:!1,webId:t.sessionInfo.webId}:{sessionId:null!=e?e:(0,r.v4)(),isLoggedIn:!1},this.on(n.EVENTS.LOGIN,(()=>window.localStorage.setItem(o.KEY_CURRENT_SESSION,this.info.sessionId))),this.on(n.EVENTS.SESSION_EXPIRED,(()=>this.internalLogout(!1))),this.on(n.EVENTS.ERROR,(()=>this.internalLogout(!1)))}onLogin(t){this.on(n.EVENTS.LOGIN,t)}onLogout(t){this.on(n.EVENTS.LOGOUT,t)}onError(t){this.on(n.EVENTS.ERROR,t)}onSessionRestore(t){this.on(n.EVENTS.SESSION_RESTORED,t)}onSessionExpiration(t){this.on(n.EVENTS.SESSION_EXPIRED,t)}setSessionInfo(t){this.info.isLoggedIn=t.isLoggedIn,this.info.webId=t.webId,this.info.sessionId=t.sessionId,this.info.expirationDate=t.expirationDate,this.on(n.EVENTS.SESSION_EXTENDED,(t=>{this.info.expirationDate=Date.now()+1e3*t}))}}}}),mi=b({"../node_modules/@inrupt/solid-client-authn-browser/dist/defaultSession.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.onSessionRestore=t.onLogout=t.onLogin=t.handleIncomingRedirect=t.logout=t.login=t.fetch=t.getDefaultSession=void 0;var e,n=yi();function r(){return void 0===e&&(e=new n.Session),e}t.getDefaultSession=r,t.fetch=(...t)=>r().fetch(...t),t.login=(...t)=>r().login(...t),t.logout=(...t)=>r().logout(...t),t.handleIncomingRedirect=(...t)=>r().handleIncomingRedirect(...t),t.onLogin=(...t)=>r().onLogin(...t),t.onLogout=(...t)=>r().onLogout(...t),t.onSessionRestore=(...t)=>r().onSessionRestore(...t)}}),gi=b({"../node_modules/@inrupt/solid-client-authn-browser/dist/index.js"(t){var e=t&&t.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),n=t&&t.__exportStar||function(t,n){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(n,r)||e(n,t,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.InMemoryStorage=t.ConfigurationError=t.NotImplementedError=t.getClientAuthenticationWithDependencies=t.Session=void 0;var r=yi();Object.defineProperty(t,"Session",{enumerable:!0,get:function(){return r.Session}});var i=pi();Object.defineProperty(t,"getClientAuthenticationWithDependencies",{enumerable:!0,get:function(){return i.getClientAuthenticationWithDependencies}}),n(mi(),t);var o=Xr();Object.defineProperty(t,"NotImplementedError",{enumerable:!0,get:function(){return o.NotImplementedError}}),Object.defineProperty(t,"ConfigurationError",{enumerable:!0,get:function(){return o.ConfigurationError}}),Object.defineProperty(t,"InMemoryStorage",{enumerable:!0,get:function(){return o.InMemoryStorage}})}}),bi=b({"../node_modules/rdf-canonize/lib/IdentifierIssuer.js"(t,e){e.exports=class t{constructor(t,e=new Map,n=0){this.prefix=t,this._existing=e,this.counter=n}clone(){const{prefix:e,_existing:n,counter:r}=this;return new t(e,new Map(n),r)}getId(t){const e=t&&this._existing.get(t);if(e)return e;const n=this.prefix+this.counter;return this.counter++,t&&this._existing.set(t,n),n}hasId(t){return this._existing.has(t)}getOldIds(){return[...this._existing.keys()]}}}}),Ei=b({"../node_modules/setimmediate/setImmediate.js"(t){!function(t){if(!t.setImmediate){var e,n,r,i,o,s=1,a={},u=!1,c=t.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(t);h=h&&h.setTimeout?h:t,"[object process]"==={}.toString.call(t.process)?e=function(t){process.nextTick((function(){l(t)}))}:function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?(i="setImmediate$"+Math.random()+"$",o=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(i)&&l(+e.data.slice(i.length))},t.addEventListener?t.addEventListener("message",o,!1):t.attachEvent("onmessage",o),e=function(e){t.postMessage(i+e,"*")}):t.MessageChannel?((r=new MessageChannel).port1.onmessage=function(t){l(t.data)},e=function(t){r.port2.postMessage(t)}):c&&"onreadystatechange"in c.createElement("script")?(n=c.documentElement,e=function(t){var e=c.createElement("script");e.onreadystatechange=function(){l(t),e.onreadystatechange=null,n.removeChild(e),e=null},n.appendChild(e)}):e=function(t){setTimeout(l,0,t)},h.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var n=new Array(arguments.length-1),r=0;r<n.length;r++)n[r]=arguments[r+1];var i={callback:t,args:n};return a[s]=i,e(s),s++},h.clearImmediate=f}function f(t){delete a[t]}function l(t){if(u)setTimeout(l,0,t);else{var e=a[t];if(e){u=!0;try{!function(t){var e=t.callback,n=t.args;switch(n.length){case 0:e();break;case 1:e(n[0]);break;case 2:e(n[0],n[1]);break;case 3:e(n[0],n[1],n[2]);break;default:e.apply(void 0,n)}}(e)}finally{f(t),u=!1}}}}}("undefined"==typeof self?"undefined"==typeof global?t:global:self)}}),Si=b({"../node_modules/rdf-canonize/lib/MessageDigest-browser.js"(t,e){Ei();var n=self.crypto||self.msCrypto;e.exports=class{constructor(t){if(!n||!n.subtle)throw new Error("crypto.subtle not found.");if("sha256"===t)this.algorithm={name:"SHA-256"};else{if("sha1"!==t)throw new Error(`Unsupported algorithm "${t}".`);this.algorithm={name:"SHA-1"}}this._content=""}update(t){this._content+=t}async digest(){const t=(new TextEncoder).encode(this._content),e=new Uint8Array(await n.subtle.digest(this.algorithm,t));let r="";for(let t=0;t<e.length;++t)r+=e[t].toString(16).padStart(2,"0");return r}}}}),Fi=b({"../node_modules/rdf-canonize/lib/Permuter.js"(t,e){e.exports=class{constructor(t){this.current=t.sort(),this.done=!1,this.dir=new Map;for(let e=0;e<t.length;++e)this.dir.set(t[e],!0)}hasNext(){return!this.done}next(){const{current:t,dir:e}=this,n=t.slice();let r=null,i=0;const o=t.length;for(let n=0;n<o;++n){const s=t[n],a=e.get(s);(null===r||s>r)&&(a&&n>0&&s>t[n-1]||!a&&n<o-1&&s>t[n+1])&&(r=s,i=n)}if(null===r)this.done=!0;else{const n=e.get(r)?i-1:i+1;t[i]=t[n],t[n]=r;for(const n of t)n>r&&e.set(n,!e.get(n))}return n}}}}),ki=b({"../node_modules/rdf-canonize/lib/NQuads.js"(t,e){var n="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString",r="http://www.w3.org/2001/XMLSchema#string",i="NamedNode",o="BlankNode",s="Literal",a="DefaultGraph",u={};(()=>{const t="(?:<([^:]+:[^>]*)>)",e="A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_",n=e+"0-9-·̀-ͯ‿-⁀",r="(_:(?:["+e+"0-9])(?:(?:["+n+".])*(?:["+n+"]))?)",i="[ \\t]+",o="[ \\t]*",s="(?:"+t+"|"+r+")"+i,a=t+i,c="(?:"+t+"|"+r+'|(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"(?:(?:\\^\\^'+t+")|(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)))?))"+o,h="(?:\\.|(?:(?:"+t+"|"+r+")"+o+"\\.))";u.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,u.empty=new RegExp("^"+o+"$"),u.quad=new RegExp("^"+o+s+a+c+h+o+"$")})(),e.exports=class t{static parse(t){const e=[],c={},f=t.split(u.eoln);let l=0;for(const t of f){if(l++,u.empty.test(t))continue;const f=t.match(u.quad);if(null===f)throw new Error("N-Quads parse error on line "+l+".");const p={subject:null,predicate:null,object:null,graph:null};if(p.subject=void 0!==f[1]?{termType:i,value:f[1]}:{termType:o,value:f[2]},p.predicate={termType:i,value:f[3]},void 0!==f[4]?p.object={termType:i,value:f[4]}:void 0!==f[5]?p.object={termType:o,value:f[5]}:(p.object={termType:s,value:void 0,datatype:{termType:i}},void 0!==f[7]?p.object.datatype.value=f[7]:void 0!==f[8]?(p.object.datatype.value=n,p.object.language=f[8]):p.object.datatype.value=r,p.object.value=f[6].replace(h,(function(t,e,n,r){if(e)switch(e){case"t":return"\t";case"b":return"\b";case"n":return"\n";case"r":return"\r";case"f":return"\f";case'"':return'"';case"'":return"'";case"\\":return"\\"}if(n)return String.fromCharCode(parseInt(n,16));if(r)throw new Error("Unsupported U escape")}))),p.graph=void 0!==f[9]?{termType:i,value:f[9]}:void 0!==f[10]?{termType:o,value:f[10]}:{termType:a,value:""},p.graph.value in c){let t=!0;const n=c[p.graph.value];for(const e of n)if((d=e).subject.termType===(v=p).subject.termType&&d.object.termType===v.object.termType&&d.subject.value===v.subject.value&&d.predicate.value===v.predicate.value&&d.object.value===v.object.value&&(d.object.termType!==s||d.object.datatype.termType===v.object.datatype.termType&&d.object.language===v.object.language&&d.object.datatype.value===v.object.datatype.value)){t=!1;break}t&&(n.push(p),e.push(p))}else c[p.graph.value]=[p],e.push(p)}var d,v;return e}static serialize(e){Array.isArray(e)||(e=t.legacyDatasetToQuads(e));const n=[];for(const r of e)n.push(t.serializeQuad(r));return n.sort().join("")}static serializeQuadComponents(t,e,s,a){let u="";return u+=t.termType===i?`<${t.value}>`:`${t.value}`,u+=` <${e.value}> `,s.termType===i?u+=`<${s.value}>`:s.termType===o?u+=s.value:(u+=`"${function(t){return t.replace(c,(function(t){switch(t){case'"':return'\\"';case"\\":return"\\\\";case"\n":return"\\n";case"\r":return"\\r"}}))}(s.value)}"`,s.datatype.value===n?s.language&&(u+=`@${s.language}`):s.datatype.value!==r&&(u+=`^^<${s.datatype.value}>`)),a.termType===i?u+=` <${a.value}>`:a.termType===o&&(u+=` ${a.value}`),u+=" .\n",u}static serializeQuad(e){return t.serializeQuadComponents(e.subject,e.predicate,e.object,e.graph)}static legacyDatasetToQuads(t){const e=[],u={"blank node":o,IRI:i,literal:s};for(const c in t)t[c].forEach((t=>{const h={};for(const e in t){const o=t[e],a={termType:u[o.type],value:o.value};a.termType===s&&(a.datatype={termType:i},"datatype"in o&&(a.datatype.value=o.datatype),"language"in o?("datatype"in o||(a.datatype.value=n),a.language=o.language):"datatype"in o||(a.datatype.value=r)),h[e]=a}h.graph="@default"===c?{termType:a,value:""}:{termType:c.startsWith("_:")?o:i,value:c},e.push(h)}));return e}};var c=/["\\\n\r]/g,h=/(?:\\([tbnrf"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g}}),xi=b({"../node_modules/rdf-canonize/lib/URDNA2015.js"(t,e){var n=bi(),r=Si(),i=Fi(),o=ki();function s(t,e){return t.hash<e.hash?-1:t.hash>e.hash?1:0}e.exports=class{constructor({createMessageDigest:t=(()=>new r("sha256")),maxDeepIterations:e=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new n("_:c14n"),this.createMessageDigest=t,this.maxDeepIterations=e,this.quads=null,this.deepIterations=null}async main(t){this.deepIterations=new Map,this.quads=t;for(const e of t)this._addBlankNodeQuadInfo({quad:e,component:e.subject}),this._addBlankNodeQuadInfo({quad:e,component:e.object}),this._addBlankNodeQuadInfo({quad:e,component:e.graph});const e=new Map,r=[...this.blankNodeInfo.keys()];let i=0;for(const t of r)++i%100==0&&await this._yield(),await this._hashAndTrackBlankNode({id:t,hashToBlankNodes:e});const a=[...e.keys()].sort(),u=[];for(const t of a){const n=e.get(t);n.length>1?u.push(n):this.canonicalIssuer.getId(n[0])}for(const t of u){const e=[];for(const r of t){if(this.canonicalIssuer.hasId(r))continue;const t=new n("_:b");t.getId(r);const i=await this.hashNDegreeQuads(r,t);e.push(i)}e.sort(s);for(const t of e){const e=t.issuer.getOldIds();for(const t of e)this.canonicalIssuer.getId(t)}}const c=[];for(const t of this.quads){const e=o.serializeQuadComponents(this._componentWithCanonicalId(t.subject),t.predicate,this._componentWithCanonicalId(t.object),this._componentWithCanonicalId(t.graph));c.push(e)}return c.sort(),c.join("")}async hashFirstDegreeQuads(t){const e=[],n=this.blankNodeInfo.get(t),r=n.quads;for(const n of r){const r={subject:null,predicate:n.predicate,object:null,graph:null};r.subject=this.modifyFirstDegreeComponent(t,n.subject,"subject"),r.object=this.modifyFirstDegreeComponent(t,n.object,"object"),r.graph=this.modifyFirstDegreeComponent(t,n.graph,"graph"),e.push(o.serializeQuad(r))}e.sort();const i=this.createMessageDigest();for(const t of e)i.update(t);return n.hash=await i.digest(),n.hash}async hashRelatedBlankNode(t,e,n,r){let i;i=this.canonicalIssuer.hasId(t)?this.canonicalIssuer.getId(t):n.hasId(t)?n.getId(t):this.blankNodeInfo.get(t).hash;const o=this.createMessageDigest();return o.update(r),"g"!==r&&o.update(this.getRelatedPredicate(e)),o.update(i),o.digest()}async hashNDegreeQuads(t,e){const n=this.deepIterations.get(t)||0;if(n>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(t,n+1);const r=this.createMessageDigest(),o=await this.createHashToRelated(t,e),s=[...o.keys()].sort();for(const t of s){r.update(t);let n,s="";const a=new i(o.get(t));let u=0;for(;a.hasNext();){const t=a.next();++u%3==0&&await this._yield();let r=e.clone(),i="";const o=[];let c=!1;for(const e of t)if(this.canonicalIssuer.hasId(e)?i+=this.canonicalIssuer.getId(e):(r.hasId(e)||o.push(e),i+=r.getId(e)),0!==s.length&&i>s){c=!0;break}if(!c){for(const t of o){const e=await this.hashNDegreeQuads(t,r);if(i+=r.getId(t),i+=`<${e.hash}>`,r=e.issuer,0!==s.length&&i>s){c=!0;break}}c||(0===s.length||i<s)&&(s=i,n=r)}}r.update(s),e=n}return{hash:await r.digest(),issuer:e}}modifyFirstDegreeComponent(t,e){return"BlankNode"!==e.termType?e:{termType:"BlankNode",value:e.value===t?"_:a":"_:z"}}getRelatedPredicate(t){return`<${t.predicate.value}>`}async createHashToRelated(t,e){const n=new Map,r=this.blankNodeInfo.get(t).quads;let i=0;for(const o of r)++i%100==0&&await this._yield(),await Promise.all([this._addRelatedBlankNodeHash({quad:o,component:o.subject,position:"s",id:t,issuer:e,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:o,component:o.object,position:"o",id:t,issuer:e,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:o,component:o.graph,position:"g",id:t,issuer:e,hashToRelated:n})]);return n}async _hashAndTrackBlankNode({id:t,hashToBlankNodes:e}){const n=await this.hashFirstDegreeQuads(t),r=e.get(n);r?r.push(t):e.set(n,[t])}_addBlankNodeQuadInfo({quad:t,component:e}){if("BlankNode"!==e.termType)return;const n=e.value,r=this.blankNodeInfo.get(n);r?r.quads.add(t):this.blankNodeInfo.set(n,{quads:new Set([t]),hash:null})}async _addRelatedBlankNodeHash({quad:t,component:e,position:n,id:r,issuer:i,hashToRelated:o}){if("BlankNode"!==e.termType||e.value===r)return;const s=e.value,a=await this.hashRelatedBlankNode(s,t,i,n),u=o.get(a);u?u.push(s):o.set(a,[s])}_componentWithCanonicalId(t){return"BlankNode"!==t.termType||t.value.startsWith(this.canonicalIssuer.prefix)?t:{termType:"BlankNode",value:this.canonicalIssuer.getId(t.value)}}async _yield(){return new Promise((t=>setImmediate(t)))}}}}),_i=b({"../node_modules/rdf-canonize/lib/URGNA2012.js"(t,e){var n=Si(),r=xi();e.exports=class extends r{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new n("sha1")}modifyFirstDegreeComponent(t,e,n){return"BlankNode"!==e.termType?e:"graph"===n?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:e.value===t?"_:a":"_:z"}}getRelatedPredicate(t){return t.predicate.value}async createHashToRelated(t,e){const n=new Map,r=this.blankNodeInfo.get(t).quads;let i=0;for(const o of r){let r,s;if("BlankNode"===o.subject.termType&&o.subject.value!==t)s=o.subject.value,r="p";else{if("BlankNode"!==o.object.termType||o.object.value===t)continue;s=o.object.value,r="r"}++i%100==0&&await this._yield();const a=await this.hashRelatedBlankNode(s,o,e,r),u=n.get(a);u?u.push(s):n.set(a,[s])}return n}}}}),Ai=b({"../node_modules/rdf-canonize/lib/URDNA2015Sync.js"(t,e){var n=bi(),r=Si(),i=Fi(),o=ki();function s(t,e){return t.hash<e.hash?-1:t.hash>e.hash?1:0}e.exports=class{constructor({createMessageDigest:t=(()=>new r("sha256")),maxDeepIterations:e=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new n("_:c14n"),this.createMessageDigest=t,this.maxDeepIterations=e,this.quads=null,this.deepIterations=null}main(t){this.deepIterations=new Map,this.quads=t;for(const e of t)this._addBlankNodeQuadInfo({quad:e,component:e.subject}),this._addBlankNodeQuadInfo({quad:e,component:e.object}),this._addBlankNodeQuadInfo({quad:e,component:e.graph});const e=new Map,r=[...this.blankNodeInfo.keys()];for(const t of r)this._hashAndTrackBlankNode({id:t,hashToBlankNodes:e});const i=[...e.keys()].sort(),a=[];for(const t of i){const n=e.get(t);n.length>1?a.push(n):this.canonicalIssuer.getId(n[0])}for(const t of a){const e=[];for(const r of t){if(this.canonicalIssuer.hasId(r))continue;const t=new n("_:b");t.getId(r);const i=this.hashNDegreeQuads(r,t);e.push(i)}e.sort(s);for(const t of e){const e=t.issuer.getOldIds();for(const t of e)this.canonicalIssuer.getId(t)}}const u=[];for(const t of this.quads){const e=o.serializeQuadComponents(this._componentWithCanonicalId({component:t.subject}),t.predicate,this._componentWithCanonicalId({component:t.object}),this._componentWithCanonicalId({component:t.graph}));u.push(e)}return u.sort(),u.join("")}hashFirstDegreeQuads(t){const e=[],n=this.blankNodeInfo.get(t),r=n.quads;for(const n of r){const r={subject:null,predicate:n.predicate,object:null,graph:null};r.subject=this.modifyFirstDegreeComponent(t,n.subject,"subject"),r.object=this.modifyFirstDegreeComponent(t,n.object,"object"),r.graph=this.modifyFirstDegreeComponent(t,n.graph,"graph"),e.push(o.serializeQuad(r))}e.sort();const i=this.createMessageDigest();for(const t of e)i.update(t);return n.hash=i.digest(),n.hash}hashRelatedBlankNode(t,e,n,r){let i;i=this.canonicalIssuer.hasId(t)?this.canonicalIssuer.getId(t):n.hasId(t)?n.getId(t):this.blankNodeInfo.get(t).hash;const o=this.createMessageDigest();return o.update(r),"g"!==r&&o.update(this.getRelatedPredicate(e)),o.update(i),o.digest()}hashNDegreeQuads(t,e){const n=this.deepIterations.get(t)||0;if(n>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(t,n+1);const r=this.createMessageDigest(),o=this.createHashToRelated(t,e),s=[...o.keys()].sort();for(const t of s){r.update(t);let n,s="";const a=new i(o.get(t));for(;a.hasNext();){const t=a.next();let r=e.clone(),i="";const o=[];let u=!1;for(const e of t)if(this.canonicalIssuer.hasId(e)?i+=this.canonicalIssuer.getId(e):(r.hasId(e)||o.push(e),i+=r.getId(e)),0!==s.length&&i>s){u=!0;break}if(!u){for(const t of o){const e=this.hashNDegreeQuads(t,r);if(i+=r.getId(t),i+=`<${e.hash}>`,r=e.issuer,0!==s.length&&i>s){u=!0;break}}u||(0===s.length||i<s)&&(s=i,n=r)}}r.update(s),e=n}return{hash:r.digest(),issuer:e}}modifyFirstDegreeComponent(t,e){return"BlankNode"!==e.termType?e:{termType:"BlankNode",value:e.value===t?"_:a":"_:z"}}getRelatedPredicate(t){return`<${t.predicate.value}>`}createHashToRelated(t,e){const n=new Map,r=this.blankNodeInfo.get(t).quads;for(const i of r)this._addRelatedBlankNodeHash({quad:i,component:i.subject,position:"s",id:t,issuer:e,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:i,component:i.object,position:"o",id:t,issuer:e,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:i,component:i.graph,position:"g",id:t,issuer:e,hashToRelated:n});return n}_hashAndTrackBlankNode({id:t,hashToBlankNodes:e}){const n=this.hashFirstDegreeQuads(t),r=e.get(n);r?r.push(t):e.set(n,[t])}_addBlankNodeQuadInfo({quad:t,component:e}){if("BlankNode"!==e.termType)return;const n=e.value,r=this.blankNodeInfo.get(n);r?r.quads.add(t):this.blankNodeInfo.set(n,{quads:new Set([t]),hash:null})}_addRelatedBlankNodeHash({quad:t,component:e,position:n,id:r,issuer:i,hashToRelated:o}){if("BlankNode"!==e.termType||e.value===r)return;const s=e.value,a=this.hashRelatedBlankNode(s,t,i,n),u=o.get(a);u?u.push(s):o.set(a,[s])}_componentWithCanonicalId({component:t}){return"BlankNode"!==t.termType||t.value.startsWith(this.canonicalIssuer.prefix)?t:{termType:"BlankNode",value:this.canonicalIssuer.getId(t.value)}}}}}),ji=b({"../node_modules/rdf-canonize/lib/URGNA2012Sync.js"(t,e){var n=Si(),r=Ai();e.exports=class extends r{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new n("sha1")}modifyFirstDegreeComponent(t,e,n){return"BlankNode"!==e.termType?e:"graph"===n?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:e.value===t?"_:a":"_:z"}}getRelatedPredicate(t){return t.predicate.value}createHashToRelated(t,e){const n=new Map,r=this.blankNodeInfo.get(t).quads;for(const i of r){let r,o;if("BlankNode"===i.subject.termType&&i.subject.value!==t)o=i.subject.value,r="p";else{if("BlankNode"!==i.object.termType||i.object.value===t)continue;o=i.object.value,r="r"}const s=this.hashRelatedBlankNode(o,i,e,r),a=n.get(s);a?a.push(o):n.set(s,[o])}return n}}}}),Ci=b({"(disabled):rdf-canonize-native"(){}}),Ri=b({"../node_modules/rdf-canonize/lib/index.js"(t){var e,n=xi(),r=_i(),i=Ai(),o=ji();try{e=Ci()}catch(t){}t.NQuads=ki(),t.IdentifierIssuer=bi(),t._rdfCanonizeNative=function(t){return t&&(e=t),e},t.canonize=async function(i,o){if(Array.isArray(i)||(i=t.NQuads.legacyDatasetToQuads(i)),o.useNative){if(!e)throw new Error("rdf-canonize-native not available");if(o.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return new Promise(((t,n)=>e.canonize(i,o,((e,r)=>e?n(e):t(r)))))}if("URDNA2015"===o.algorithm)return new n(o).main(i);if("URGNA2012"===o.algorithm){if(o.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new r(o).main(i)}if(!("algorithm"in o))throw new Error("No RDF Dataset Canonicalization algorithm specified.");throw new Error("Invalid RDF Dataset Canonicalization algorithm: "+o.algorithm)},t._canonizeSync=function(n,r){if(Array.isArray(n)||(n=t.NQuads.legacyDatasetToQuads(n)),r.useNative){if(!e)throw new Error("rdf-canonize-native not available");if(r.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return e.canonizeSync(n,r)}if("URDNA2015"===r.algorithm)return new i(r).main(n);if("URGNA2012"===r.algorithm){if(r.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new o(r).main(n)}if(!("algorithm"in r))throw new Error("No RDF Dataset Canonicalization algorithm specified.");throw new Error("Invalid RDF Dataset Canonicalization algorithm: "+r.algorithm)}}}),Ti=b({"../node_modules/rdf-canonize/index.js"(t,e){e.exports=Ri()}}),Ii=b({"../node_modules/jsonld/lib/types.js"(t,e){var n={};e.exports=n,n.isArray=Array.isArray,n.isBoolean=t=>"boolean"==typeof t||"[object Boolean]"===Object.prototype.toString.call(t),n.isDouble=t=>n.isNumber(t)&&(-1!==String(t).indexOf(".")||Math.abs(t)>=1e21),n.isEmptyObject=t=>n.isObject(t)&&0===Object.keys(t).length,n.isNumber=t=>"number"==typeof t||"[object Number]"===Object.prototype.toString.call(t),n.isNumeric=t=>!isNaN(parseFloat(t))&&isFinite(t),n.isObject=t=>"[object Object]"===Object.prototype.toString.call(t),n.isString=t=>"string"==typeof t||"[object String]"===Object.prototype.toString.call(t),n.isUndefined=t=>void 0===t}}),Oi=b({"../node_modules/jsonld/lib/graphTypes.js"(t,e){var n=Ii(),r={};e.exports=r,r.isSubject=t=>!(!n.isObject(t)||"@value"in t||"@set"in t||"@list"in t)&&(Object.keys(t).length>1||!("@id"in t)),r.isSubjectReference=t=>n.isObject(t)&&1===Object.keys(t).length&&"@id"in t,r.isValue=t=>n.isObject(t)&&"@value"in t,r.isList=t=>n.isObject(t)&&"@list"in t,r.isGraph=t=>n.isObject(t)&&"@graph"in t&&1===Object.keys(t).filter((t=>"@id"!==t&&"@index"!==t)).length,r.isSimpleGraph=t=>r.isGraph(t)&&!("@id"in t),r.isBlankNode=t=>!!n.isObject(t)&&("@id"in t?0===t["@id"].indexOf("_:"):0===Object.keys(t).length||!("@value"in t||"@set"in t||"@list"in t))}}),Ni=b({"../node_modules/jsonld/lib/JsonLdError.js"(t,e){e.exports=class extends Error{constructor(t="An unspecified JSON-LD error occurred.",e="jsonld.Error",n={}){super(t),this.name=e,this.message=t,this.details=n}}}}),Pi=b({"../node_modules/jsonld/lib/util.js"(t,e){var n=Oi(),r=Ii(),i=Ti().IdentifierIssuer,o=Ni(),s=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,a=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,u=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,c="application/ld+json, application/json",h={};function f(t,e){if(r.isArray(e))for(let n=0;n<e.length;++n)e[n]=f(t,e[n]);else if(n.isList(e))e["@list"]=f(t,e["@list"]);else if(r.isObject(e)){n.isBlankNode(e)&&(e["@id"]=t.getId(e["@id"]));const r=Object.keys(e).sort();for(let n=0;n<r.length;++n){const i=r[n];"@id"!==i&&(e[i]=f(t,e[i]))}}return e}e.exports=h,h.IdentifierIssuer=i,h.clone=function(t){if(t&&"object"==typeof t){let e;if(r.isArray(t)){e=[];for(let n=0;n<t.length;++n)e[n]=h.clone(t[n])}else if(t instanceof Map){e=new Map;for(const[n,r]of t)e.set(n,h.clone(r))}else if(t instanceof Set){e=new Set;for(const n of t)e.add(h.clone(n))}else if(r.isObject(t)){e={};for(const n in t)e[n]=h.clone(t[n])}else e=t.toString();return e}return t},h.asArray=function(t){return Array.isArray(t)?t:[t]},h.buildHeaders=(t={})=>{if(Object.keys(t).some((t=>"accept"===t.toLowerCase())))throw new RangeError('Accept header may not be specified; only "'+c+'" is supported.');return Object.assign({Accept:c},t)},h.parseLinkHeader=t=>{const e={},n=t.match(s);for(let t=0;t<n.length;++t){let r=n[t].match(a);if(!r)continue;const i={target:r[1]},o=r[2];for(;r=u.exec(o);)i[r[1]]=void 0===r[2]?r[3]:r[2];const s=i.rel||"";Array.isArray(e[s])?e[s].push(i):e[s]=e.hasOwnProperty(s)?[e[s],i]:i}return e},h.validateTypeValue=(t,e)=>{if(!(r.isString(t)||r.isArray(t)&&t.every((t=>r.isString(t))))){if(e&&r.isObject(t))switch(Object.keys(t).length){case 0:return;case 1:if("@default"in t&&h.asArray(t["@default"]).every((t=>r.isString(t))))return}throw new o('Invalid JSON-LD syntax; "@type" value must a string, an array of strings, an empty object, or a default object.',"jsonld.SyntaxError",{code:"invalid type value",value:t})}},h.hasProperty=(t,e)=>{if(t.hasOwnProperty(e)){const n=t[e];return!r.isArray(n)||n.length>0}return!1},h.hasValue=(t,e,i)=>{if(h.hasProperty(t,e)){let o=t[e];const s=n.isList(o);if(r.isArray(o)||s){s&&(o=o["@list"]);for(let t=0;t<o.length;++t)if(h.compareValues(i,o[t]))return!0}else if(!r.isArray(i))return h.compareValues(i,o)}return!1},h.addValue=(t,e,n,i)=>{if("propertyIsArray"in(i=i||{})||(i.propertyIsArray=!1),"valueIsArray"in i||(i.valueIsArray=!1),"allowDuplicate"in i||(i.allowDuplicate=!0),"prependValue"in i||(i.prependValue=!1),i.valueIsArray)t[e]=n;else if(r.isArray(n)){0===n.length&&i.propertyIsArray&&!t.hasOwnProperty(e)&&(t[e]=[]),i.prependValue&&(n=n.concat(t[e]),t[e]=[]);for(let r=0;r<n.length;++r)h.addValue(t,e,n[r],i)}else if(t.hasOwnProperty(e)){const o=!i.allowDuplicate&&h.hasValue(t,e,n);r.isArray(t[e])||o&&!i.propertyIsArray||(t[e]=[t[e]]),o||(i.prependValue?t[e].unshift(n):t[e].push(n))}else t[e]=i.propertyIsArray?[n]:n},h.getValues=(t,e)=>[].concat(t[e]||[]),h.removeProperty=(t,e)=>{delete t[e]},h.removeValue=(t,e,n,r)=>{"propertyIsArray"in(r=r||{})||(r.propertyIsArray=!1);const i=h.getValues(t,e).filter((t=>!h.compareValues(t,n)));0===i.length?h.removeProperty(t,e):t[e]=1!==i.length||r.propertyIsArray?i:i[0]},h.relabelBlankNodes=(t,e)=>f((e=e||{}).issuer||new i("_:b"),t),h.compareValues=(t,e)=>t===e||!(!n.isValue(t)||!n.isValue(e)||t["@value"]!==e["@value"]||t["@type"]!==e["@type"]||t["@language"]!==e["@language"]||t["@index"]!==e["@index"])||!!(r.isObject(t)&&"@id"in t&&r.isObject(e)&&"@id"in e)&&t["@id"]===e["@id"],h.compareShortestLeast=(t,e)=>t.length<e.length?-1:e.length<t.length?1:t===e?0:t<e?-1:1}}),Di=b({"../node_modules/jsonld/lib/constants.js"(t,e){var n="http://www.w3.org/1999/02/22-rdf-syntax-ns#",r="http://www.w3.org/2001/XMLSchema#";e.exports={LINK_HEADER_REL:"http://www.w3.org/ns/json-ld#context",LINK_HEADER_CONTEXT:"http://www.w3.org/ns/json-ld#context",RDF:n,RDF_LIST:n+"List",RDF_FIRST:n+"first",RDF_REST:n+"rest",RDF_NIL:n+"nil",RDF_TYPE:n+"type",RDF_PLAIN_LITERAL:n+"PlainLiteral",RDF_XML_LITERAL:n+"XMLLiteral",RDF_JSON_LITERAL:n+"JSON",RDF_OBJECT:n+"object",RDF_LANGSTRING:n+"langString",XSD:r,XSD_BOOLEAN:r+"boolean",XSD_DOUBLE:r+"double",XSD_INTEGER:r+"integer",XSD_STRING:r+"string"}}}),Mi=b({"../node_modules/jsonld/lib/RequestQueue.js"(t,e){e.exports=class{constructor(){this._requests={}}wrapLoader(t){const e=this;return e._loader=t,function(){return e.add.apply(e,arguments)}}async add(t){let e=this._requests[t];if(e)return Promise.resolve(e);e=this._requests[t]=this._loader(t);try{return await e}finally{delete this._requests[t]}}}}}),Ui=b({"../node_modules/jsonld/lib/url.js"(t,e){var n=Ii(),r={};e.exports=r,r.parsers={simple:{keys:["href","scheme","authority","path","query","fragment"],regex:/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/},full:{keys:["href","protocol","scheme","authority","auth","user","password","hostname","port","path","directory","file","query","fragment"],regex:/^(([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},r.parse=(t,e)=>{const n={},i=r.parsers[e||"full"],o=i.regex.exec(t);let s=i.keys.length;for(;s--;)n[i.keys[s]]=void 0===o[s]?null:o[s];return("https"===n.scheme&&"443"===n.port||"http"===n.scheme&&"80"===n.port)&&(n.href=n.href.replace(":"+n.port,""),n.authority=n.authority.replace(":"+n.port,""),n.port=null),n.normalizedPath=r.removeDotSegments(n.path),n},r.prependBase=(t,e)=>{if(null===t)return e;if(r.isAbsolute(e))return e;t&&!n.isString(t)||(t=r.parse(t||""));const i=r.parse(e),o={protocol:t.protocol||""};if(null!==i.authority)o.authority=i.authority,o.path=i.path,o.query=i.query;else if(o.authority=t.authority,""===i.path)o.path=t.path,o.query=null!==i.query?i.query:t.query;else{if(0===i.path.indexOf("/"))o.path=i.path;else{let e=t.path;e=e.substr(0,e.lastIndexOf("/")+1),(e.length>0||t.authority)&&"/"!==e.substr(-1)&&(e+="/"),e+=i.path,o.path=e}o.query=i.query}""!==i.path&&(o.path=r.removeDotSegments(o.path));let s=o.protocol;return null!==o.authority&&(s+="//"+o.authority),s+=o.path,null!==o.query&&(s+="?"+o.query),null!==i.fragment&&(s+="#"+i.fragment),""===s&&(s="./"),s},r.removeBase=(t,e)=>{if(null===t)return e;t&&!n.isString(t)||(t=r.parse(t||""));let i="";if(""!==t.href?i+=(t.protocol||"")+"//"+(t.authority||""):e.indexOf("//")&&(i+="//"),0!==e.indexOf(i))return e;const o=r.parse(e.substr(i.length)),s=t.normalizedPath.split("/"),a=o.normalizedPath.split("/"),u=o.fragment||o.query?0:1;for(;s.length>0&&a.length>u&&s[0]===a[0];)s.shift(),a.shift();let c="";if(s.length>0){s.pop();for(let t=0;t<s.length;++t)c+="../"}return c+=a.join("/"),null!==o.query&&(c+="?"+o.query),null!==o.fragment&&(c+="#"+o.fragment),""===c&&(c="./"),c},r.removeDotSegments=t=>{if(0===t.length)return"";const e=t.split("/"),n=[];for(;e.length>0;){const t=e.shift(),r=0===e.length;"."!==t?".."!==t?n.push(t):(n.pop(),r&&n.push("")):r&&n.push("")}return"/"===t[0]&&n.length>0&&""!==n[0]&&n.unshift(""),1===n.length&&""===n[0]?"/":n.join("/")};var i=/^([A-Za-z][A-Za-z0-9+-.]*|_):[^\s]*$/;r.isAbsolute=t=>n.isString(t)&&i.test(t),r.isRelative=t=>n.isString(t)}}),Li=b({"../node_modules/jsonld/lib/documentLoaders/xhr.js"(t,e){var{parseLinkHeader:n,buildHeaders:r}=Pi(),{LINK_HEADER_CONTEXT:i}=Di(),o=Ni(),s=Mi(),{prependBase:a}=Ui(),u=/(^|(\r\n))link:/i;e.exports=({secure:t,headers:e={},xhr:c}={headers:{}})=>(e=r(e),(new s).wrapLoader((async function r(s){if(0!==s.indexOf("http:")&&0!==s.indexOf("https:"))throw new o('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:s});if(t&&0!==s.indexOf("https"))throw new o('URL could not be dereferenced; secure mode is enabled and the URL\'s scheme is not "https".',"jsonld.InvalidUrl",{code:"loading document failed",url:s});let h;try{h=await function(t,e,n){const r=new(t=t||XMLHttpRequest);return new Promise(((t,i)=>{r.onload=()=>t(r),r.onerror=t=>i(t),r.open("GET",e,!0);for(const t in n)r.setRequestHeader(t,n[t]);r.send()}))}(c,s,e)}catch(t){throw new o("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:s,cause:t})}if(h.status>=400)throw new o("URL could not be dereferenced: "+h.statusText,"jsonld.LoadDocumentError",{code:"loading document failed",url:s,httpStatusCode:h.status});let f={contextUrl:null,documentUrl:s,document:h.response},l=null;const d=h.getResponseHeader("Content-Type");let v;if(u.test(h.getAllResponseHeaders())&&(v=h.getResponseHeader("Link")),v&&"application/ld+json"!==d){const t=n(v),e=t[i];if(Array.isArray(e))throw new o("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:s});e&&(f.contextUrl=e.target),l=t.alternate,l&&"application/ld+json"==l.type&&!(d||"").match(/^application\/(\w*\+)?json$/)&&(f=await r(a(s,l.target)))}return f})))}}),Bi=b({"../node_modules/jsonld/lib/platform-browser.js"(t,e){var n=Li(),r={};e.exports=r,r.setupDocumentLoaders=function(t){"undefined"!=typeof XMLHttpRequest&&(t.documentLoaders.xhr=n,t.useDocumentLoader("xhr"))},r.setupGlobals=function(t){void 0===globalThis.JsonLdProcessor&&Object.defineProperty(globalThis,"JsonLdProcessor",{writable:!0,enumerable:!1,configurable:!0,value:t.JsonLdProcessor})}}}),Ji=b({"../node_modules/jsonld/node_modules/yallist/iterator.js"(t,e){e.exports=function(t){t.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}}}),Ki=b({"../node_modules/jsonld/node_modules/yallist/yallist.js"(t,e){function n(t){var e=this;if(e instanceof n||(e=new n),e.tail=null,e.head=null,e.length=0,t&&"function"==typeof t.forEach)t.forEach((function(t){e.push(t)}));else if(arguments.length>0)for(var r=0,i=arguments.length;r<i;r++)e.push(arguments[r]);return e}function r(t,e){t.tail=new o(e,t.tail,null,t),t.head||(t.head=t.tail),t.length++}function i(t,e){t.head=new o(e,null,t.head,t),t.tail||(t.tail=t.head),t.length++}function o(t,e,n,r){if(!(this instanceof o))return new o(t,e,n,r);this.list=r,this.value=t,e?(e.next=this,this.prev=e):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}e.exports=n,n.Node=o,n.create=n,n.prototype.removeNode=function(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");var e=t.next,n=t.prev;return e&&(e.prev=n),n&&(n.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=n),t.list.length--,t.next=null,t.prev=null,t.list=null,e},n.prototype.unshiftNode=function(t){if(t!==this.head){t.list&&t.list.removeNode(t);var e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}},n.prototype.pushNode=function(t){if(t!==this.tail){t.list&&t.list.removeNode(t);var e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}},n.prototype.push=function(){for(var t=0,e=arguments.length;t<e;t++)r(this,arguments[t]);return this.length},n.prototype.unshift=function(){for(var t=0,e=arguments.length;t<e;t++)i(this,arguments[t]);return this.length},n.prototype.pop=function(){if(this.tail){var t=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,t}},n.prototype.shift=function(){if(this.head){var t=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,t}},n.prototype.forEach=function(t,e){e=e||this;for(var n=this.head,r=0;null!==n;r++)t.call(e,n.value,r,this),n=n.next},n.prototype.forEachReverse=function(t,e){e=e||this;for(var n=this.tail,r=this.length-1;null!==n;r--)t.call(e,n.value,r,this),n=n.prev},n.prototype.get=function(t){for(var e=0,n=this.head;null!==n&&e<t;e++)n=n.next;if(e===t&&null!==n)return n.value},n.prototype.getReverse=function(t){for(var e=0,n=this.tail;null!==n&&e<t;e++)n=n.prev;if(e===t&&null!==n)return n.value},n.prototype.map=function(t,e){e=e||this;for(var r=new n,i=this.head;null!==i;)r.push(t.call(e,i.value,this)),i=i.next;return r},n.prototype.mapReverse=function(t,e){e=e||this;for(var r=new n,i=this.tail;null!==i;)r.push(t.call(e,i.value,this)),i=i.prev;return r},n.prototype.reduce=function(t,e){var n,r=this.head;if(arguments.length>1)n=e;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");r=this.head.next,n=this.head.value}for(var i=0;null!==r;i++)n=t(n,r.value,i),r=r.next;return n},n.prototype.reduceReverse=function(t,e){var n,r=this.tail;if(arguments.length>1)n=e;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");r=this.tail.prev,n=this.tail.value}for(var i=this.length-1;null!==r;i--)n=t(n,r.value,i),r=r.prev;return n},n.prototype.toArray=function(){for(var t=new Array(this.length),e=0,n=this.head;null!==n;e++)t[e]=n.value,n=n.next;return t},n.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,n=this.tail;null!==n;e++)t[e]=n.value,n=n.prev;return t},n.prototype.slice=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var r=new n;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var i=0,o=this.head;null!==o&&i<t;i++)o=o.next;for(;null!==o&&i<e;i++,o=o.next)r.push(o.value);return r},n.prototype.sliceReverse=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var r=new n;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var i=this.length,o=this.tail;null!==o&&i>e;i--)o=o.prev;for(;null!==o&&i>t;i--,o=o.prev)r.push(o.value);return r},n.prototype.splice=function(t,e,...n){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var r=0,i=this.head;null!==i&&r<t;r++)i=i.next;var s,a,u,c,h=[];for(r=0;i&&r<e;r++)h.push(i.value),i=this.removeNode(i);for(null===i&&(i=this.tail),i!==this.head&&i!==this.tail&&(i=i.prev),r=0;r<n.length;r++)u=n[r],c=void 0,null===(c=(a=i)===(s=this).head?new o(u,null,a,s):new o(u,a,a.next,s)).next&&(s.tail=c),null===c.prev&&(s.head=c),s.length++,i=c;return h},n.prototype.reverse=function(){for(var t=this.head,e=this.tail,n=t;null!==n;n=n.prev){var r=n.prev;n.prev=n.next,n.next=r}return this.head=e,this.tail=t,this};try{Ji()(n)}catch(t){}}}),Hi=b({"../node_modules/jsonld/node_modules/lru-cache/index.js"(t,e){var n=Ki(),r=Symbol("max"),i=Symbol("length"),o=Symbol("lengthCalculator"),s=Symbol("allowStale"),a=Symbol("maxAge"),u=Symbol("dispose"),c=Symbol("noDisposeOnSet"),h=Symbol("lruList"),f=Symbol("cache"),l=Symbol("updateAgeOnGet"),d=()=>1,v=(t,e,n)=>{const r=t[f].get(e);if(r){const e=r.value;if(p(t,e)){if(y(t,r),!t[s])return}else n&&(t[l]&&(r.value.now=Date.now()),t[h].unshiftNode(r));return e.value}},p=(t,e)=>{if(!e||!e.maxAge&&!t[a])return!1;const n=Date.now()-e.now;return e.maxAge?n>e.maxAge:t[a]&&n>t[a]},w=t=>{if(t[i]>t[r])for(let e=t[h].tail;t[i]>t[r]&&null!==e;){const n=e.prev;y(t,e),e=n}},y=(t,e)=>{if(e){const n=e.value;t[u]&&t[u](n.key,n.value),t[i]-=n.length,t[f].delete(n.key),t[h].removeNode(e)}},m=(t,e,n,r)=>{let i=n.value;p(t,i)&&(y(t,n),t[s]||(i=void 0)),i&&e.call(r,i.value,i.key,t)};e.exports=class{constructor(t){if("number"==typeof t&&(t={max:t}),t||(t={}),t.max&&("number"!=typeof t.max||t.max<0))throw new TypeError("max must be a non-negative number");this[r]=t.max||1/0;const e=t.length||d;if(this[o]="function"!=typeof e?d:e,this[s]=t.stale||!1,t.maxAge&&"number"!=typeof t.maxAge)throw new TypeError("maxAge must be a number");this[a]=t.maxAge||0,this[u]=t.dispose,this[c]=t.noDisposeOnSet||!1,this[l]=t.updateAgeOnGet||!1,this.reset()}set max(t){if("number"!=typeof t||t<0)throw new TypeError("max must be a non-negative number");this[r]=t||1/0,w(this)}get max(){return this[r]}set allowStale(t){this[s]=!!t}get allowStale(){return this[s]}set maxAge(t){if("number"!=typeof t)throw new TypeError("maxAge must be a non-negative number");this[a]=t,w(this)}get maxAge(){return this[a]}set lengthCalculator(t){"function"!=typeof t&&(t=d),t!==this[o]&&(this[o]=t,this[i]=0,this[h].forEach((t=>{t.length=this[o](t.value,t.key),this[i]+=t.length}))),w(this)}get lengthCalculator(){return this[o]}get length(){return this[i]}get itemCount(){return this[h].length}rforEach(t,e){e=e||this;for(let n=this[h].tail;null!==n;){const r=n.prev;m(this,t,n,e),n=r}}forEach(t,e){e=e||this;for(let n=this[h].head;null!==n;){const r=n.next;m(this,t,n,e),n=r}}keys(){return this[h].toArray().map((t=>t.key))}values(){return this[h].toArray().map((t=>t.value))}reset(){this[u]&&this[h]&&this[h].length&&this[h].forEach((t=>this[u](t.key,t.value))),this[f]=new Map,this[h]=new n,this[i]=0}dump(){return this[h].map((t=>!p(this,t)&&{k:t.key,v:t.value,e:t.now+(t.maxAge||0)})).toArray().filter((t=>t))}dumpLru(){return this[h]}set(t,e,n){if((n=n||this[a])&&"number"!=typeof n)throw new TypeError("maxAge must be a number");const s=n?Date.now():0,l=this[o](e,t);if(this[f].has(t)){if(l>this[r])return y(this,this[f].get(t)),!1;const o=this[f].get(t).value;return this[u]&&(this[c]||this[u](t,o.value)),o.now=s,o.maxAge=n,o.value=e,this[i]+=l-o.length,o.length=l,this.get(t),w(this),!0}const d=new class{constructor(t,e,n,r,i){this.key=t,this.value=e,this.length=n,this.now=r,this.maxAge=i||0}}(t,e,l,s,n);return d.length>this[r]?(this[u]&&this[u](t,e),!1):(this[i]+=d.length,this[h].unshift(d),this[f].set(t,this[h].head),w(this),!0)}has(t){if(!this[f].has(t))return!1;const e=this[f].get(t).value;return!p(this,e)}get(t){return v(this,t,!0)}peek(t){return v(this,t,!1)}pop(){const t=this[h].tail;return t?(y(this,t),t.value):null}del(t){y(this,this[f].get(t))}load(t){this.reset();const e=Date.now();for(let n=t.length-1;n>=0;n--){const r=t[n],i=r.e||0;if(0===i)this.set(r.k,r.v);else{const t=i-e;t>0&&this.set(r.k,r.v,t)}}}prune(){this[f].forEach(((t,e)=>v(this,e,!1)))}}}}),$i=b({"../node_modules/jsonld/lib/ResolvedContext.js"(t,e){var n=Hi();e.exports=class{constructor({document:t}){this.document=t,this.cache=new n({max:10})}getProcessed(t){return this.cache.get(t)}setProcessed(t,e){this.cache.set(t,e)}}}}),Wi=b({"../node_modules/jsonld/lib/ContextResolver.js"(t,e){var{isArray:n,isObject:r,isString:i}=Ii(),{asArray:o}=Pi(),{prependBase:s}=Ui(),a=Ni(),u=$i();function c(t){throw new a("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:t})}function h({context:t,base:e}){if(!t)return;const o=t["@context"];if(i(o))t["@context"]=s(e,o);else if(n(o))for(let t=0;t<o.length;++t){const n=o[t];i(n)?o[t]=s(e,n):r(n)&&h({context:{"@context":n},base:e})}else if(r(o))for(const t in o)h({context:o[t],base:e})}e.exports=class{constructor({sharedCache:t}){this.perOpCache=new Map,this.sharedCache=t}async resolve({activeCtx:t,context:e,documentLoader:s,base:a,cycles:h=new Set}){e&&r(e)&&e["@context"]&&(e=e["@context"]),e=o(e);const f=[];for(const o of e){if(i(o)){let e=this._get(o);e||(e=await this._resolveRemoteContext({activeCtx:t,url:o,documentLoader:s,base:a,cycles:h})),n(e)?f.push(...e):f.push(e);continue}if(null===o){f.push(new u({document:null}));continue}r(o)||c(e);const l=JSON.stringify(o);let d=this._get(l);d||(d=new u({document:o}),this._cacheResolvedContext({key:l,resolved:d,tag:"static"})),f.push(d)}return f}_get(t){let e=this.perOpCache.get(t);if(!e){const n=this.sharedCache.get(t);n&&(e=n.get("static"),e&&this.perOpCache.set(t,e))}return e}_cacheResolvedContext({key:t,resolved:e,tag:n}){if(this.perOpCache.set(t,e),void 0!==n){let r=this.sharedCache.get(t);r||(r=new Map,this.sharedCache.set(t,r)),r.set(n,e)}return e}async _resolveRemoteContext({activeCtx:t,url:e,documentLoader:n,base:r,cycles:i}){e=s(r,e);const{context:o,remoteDoc:a}=await this._fetchContext({activeCtx:t,url:e,documentLoader:n,cycles:i});h({context:o,base:r=a.documentUrl||e});const u=await this.resolve({activeCtx:t,context:o,documentLoader:n,base:r,cycles:i});return this._cacheResolvedContext({key:e,resolved:u,tag:a.tag}),u}async _fetchContext({activeCtx:t,url:e,documentLoader:o,cycles:s}){if(s.size>10)throw new a("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:"json-ld-1.0"===t.processingMode?"loading remote context failed":"context overflow",max:10});if(s.has(e))throw new a("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:"json-ld-1.0"===t.processingMode?"recursive context inclusion":"context overflow",url:e});let u,c;s.add(e);try{c=await o(e),u=c.document||null,i(u)&&(u=JSON.parse(u))}catch(t){throw new a("Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context.","jsonld.InvalidUrl",{code:"loading remote context failed",url:e,cause:t})}if(!r(u))throw new a("Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object.","jsonld.InvalidUrl",{code:"invalid remote context",url:e});return u="@context"in u?{"@context":u["@context"]}:{"@context":{}},c.contextUrl&&(n(u["@context"])||(u["@context"]=[u["@context"]]),u["@context"].push(c.contextUrl)),{context:u,remoteDoc:c}}}}}),qi=b({"../node_modules/jsonld/lib/NQuads.js"(t,e){e.exports=Ti().NQuads}}),Vi=b({"../node_modules/jsonld/lib/context.js"(t,e){var n=Pi(),r=Ni(),{isArray:i,isObject:o,isString:s,isUndefined:a}=Ii(),{isAbsolute:u,isRelative:c,prependBase:h}=Ui(),{asArray:f,compareShortestLeast:l}=Pi(),d=new Map,v=/^@[a-zA-Z]+$/,p={};function w(t,e,n,r,i,a){if(null===e||!s(e)||p.isKeyword(e))return e;if(e.match(v))return null;if(r&&r.hasOwnProperty(e)&&!0!==i.get(e)&&p.createTermDefinition({activeCtx:t,localCtx:r,term:e,defined:i,options:a}),(n=n||{}).vocab){const n=t.mappings.get(e);if(null===n)return null;if(o(n)&&"@id"in n)return n["@id"]}const c=e.indexOf(":");if(c>0){const n=e.substr(0,c),o=e.substr(c+1);if("_"===n||0===o.indexOf("//"))return e;r&&r.hasOwnProperty(n)&&p.createTermDefinition({activeCtx:t,localCtx:r,term:n,defined:i,options:a});const s=t.mappings.get(n);if(s&&s._prefix)return s["@id"]+o;if(u(e))return e}if(n.vocab&&"@vocab"in t)return t["@vocab"]+e;if(n.base&&"@base"in t){if(t["@base"])return h(h(a.base,t["@base"]),e)}else if(n.base)return h(a.base,e);return e}function y(t,e){if(!t||"object"!=typeof t||!e||"object"!=typeof e)return t===e;const n=Array.isArray(t);if(n!==Array.isArray(e))return!1;if(n){if(t.length!==e.length)return!1;for(let n=0;n<t.length;++n)if(!y(t[n],e[n]))return!1;return!0}const r=Object.keys(t),i=Object.keys(e);if(r.length!==i.length)return!1;for(const n in t){let r=t[n],i=e[n];if("@container"===n&&Array.isArray(r)&&Array.isArray(i)&&(r=r.slice().sort(),i=i.slice().sort()),!y(r,i))return!1}return!0}e.exports=p,p.process=async({activeCtx:t,localCtx:e,options:a,propagate:l=!0,overrideProtected:d=!1,cycles:v=new Set})=>{if(o(e)&&"@context"in e&&i(e["@context"])&&(e=e["@context"]),0===f(e).length)return t;const y=await a.contextResolver.resolve({activeCtx:t,context:e,documentLoader:a.documentLoader,base:a.base});o(y[0].document)&&"boolean"==typeof y[0].document["@propagate"]&&(l=y[0].document["@propagate"]);let m=t;l||m.previousContext||(m=m.clone(),m.previousContext=t);for(const i of y){let{document:f}=i;if(t=m,null===f){if(!d&&0!==Object.keys(t.protected).length){const o=a&&a.protectedMode||"error";if("error"===o)throw new r("Tried to nullify a context with protected terms outside of a term definition.","jsonld.SyntaxError",{code:"invalid context nullification"});if("warn"===o){console.warn("WARNING: invalid context nullification");const e=i.getProcessed(t);if(e){m=t=e;continue}const r=t;m=t=p.getInitialContext(a).clone();for(const[e,i]of Object.entries(r.protected))i&&(t.mappings[e]=n.clone(r.mappings[e]));t.protected=n.clone(r.protected),i.setProcessed(r,m);continue}throw new r("Invalid protectedMode.","jsonld.SyntaxError",{code:"invalid protected mode",context:e,protectedMode:o})}m=t=p.getInitialContext(a).clone();continue}const l=i.getProcessed(t);if(l){m=t=l;continue}if(o(f)&&"@context"in f&&(f=f["@context"]),!o(f))throw new r("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:f});m=m.clone();const y=new Map;if("@version"in f){if(1.1!==f["@version"])throw new r("Unsupported JSON-LD version: "+f["@version"],"jsonld.UnsupportedVersion",{code:"invalid @version value",context:f});if(t.processingMode&&"json-ld-1.0"===t.processingMode)throw new r("@version: "+f["@version"]+" not compatible with "+t.processingMode,"jsonld.ProcessingModeConflict",{code:"processing mode conflict",context:f});m.processingMode="json-ld-1.1",m["@version"]=f["@version"],y.set("@version",!0)}if(m.processingMode=m.processingMode||t.processingMode,"@base"in f){let t=f["@base"];if(null===t||u(t));else{if(!c(t))throw new r('Invalid JSON-LD syntax; the value of "@base" in a @context must be an absolute IRI, a relative IRI, or null.',"jsonld.SyntaxError",{code:"invalid base IRI",context:f});t=h(m["@base"],t)}m["@base"]=t,y.set("@base",!0)}if("@vocab"in f){const t=f["@vocab"];if(null===t)delete m["@vocab"];else{if(!s(t))throw new r('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:f});if(!u(t)&&p.processingMode(m,1))throw new r('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:f});m["@vocab"]=w(m,t,{vocab:!0,base:!0},void 0,void 0,a)}y.set("@vocab",!0)}if("@language"in f){const t=f["@language"];if(null===t)delete m["@language"];else{if(!s(t))throw new r('Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid default language",context:f});m["@language"]=t.toLowerCase()}y.set("@language",!0)}if("@direction"in f){const e=f["@direction"];if("json-ld-1.0"===t.processingMode)throw new r("Invalid JSON-LD syntax; @direction not compatible with "+t.processingMode,"jsonld.SyntaxError",{code:"invalid context member",context:f});if(null===e)delete m["@direction"];else{if("ltr"!==e&&"rtl"!==e)throw new r('Invalid JSON-LD syntax; the value of "@direction" in a @context must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:f});m["@direction"]=e}y.set("@direction",!0)}if("@propagate"in f){const n=f["@propagate"];if("json-ld-1.0"===t.processingMode)throw new r("Invalid JSON-LD syntax; @propagate not compatible with "+t.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:f});if("boolean"!=typeof n)throw new r("Invalid JSON-LD syntax; @propagate value must be a boolean.","jsonld.SyntaxError",{code:"invalid @propagate value",context:e});y.set("@propagate",!0)}if("@import"in f){const n=f["@import"];if("json-ld-1.0"===t.processingMode)throw new r("Invalid JSON-LD syntax; @import not compatible with "+t.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:f});if(!s(n))throw new r("Invalid JSON-LD syntax; @import must be a string.","jsonld.SyntaxError",{code:"invalid @import value",context:e});const i=await a.contextResolver.resolve({activeCtx:t,context:n,documentLoader:a.documentLoader,base:a.base});if(1!==i.length)throw new r("Invalid JSON-LD syntax; @import must reference a single context.","jsonld.SyntaxError",{code:"invalid remote context",context:e});const o=i[0].getProcessed(t);if(o)f=o;else{const n=i[0].document;if("@import"in n)throw new r("Invalid JSON-LD syntax: imported context must not include @import.","jsonld.SyntaxError",{code:"invalid context entry",context:e});for(const t in n)f.hasOwnProperty(t)||(f[t]=n[t]);i[0].setProcessed(t,f)}y.set("@import",!0)}y.set("@protected",f["@protected"]||!1);for(const t in f)if(p.createTermDefinition({activeCtx:m,localCtx:f,term:t,defined:y,options:a,overrideProtected:d}),o(f[t])&&"@context"in f[t]){const e=f[t]["@context"];let n=!0;if(s(e)){const t=h(a.base,e);v.has(t)?n=!1:v.add(t)}if(n)try{await p.process({activeCtx:m.clone(),localCtx:f[t]["@context"],overrideProtected:!0,options:a,cycles:v})}catch(e){throw new r("Invalid JSON-LD syntax; invalid scoped context.","jsonld.SyntaxError",{code:"invalid scoped context",context:f[t]["@context"],term:t})}}i.setProcessed(t,m)}return m},p.createTermDefinition=({activeCtx:t,localCtx:e,term:n,defined:a,options:c,overrideProtected:h=!1})=>{if(a.has(n)){if(a.get(n))return;throw new r("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:e,term:n})}let f;if(a.set(n,!1),e.hasOwnProperty(n)&&(f=e[n]),"@type"===n&&o(f)&&"@set"===(f["@container"]||"@set")&&p.processingMode(t,1.1)){const t=["@container","@id","@protected"],i=Object.keys(f);if(0===i.length||i.some((e=>!t.includes(e))))throw new r("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:e,term:n})}else{if(p.isKeyword(n))throw new r("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:e,term:n});if(n.match(v))return void console.warn('WARNING: terms beginning with "@" are reserved for future use and ignored',{term:n});if(""===n)throw new r("Invalid JSON-LD syntax; a term cannot be an empty string.","jsonld.SyntaxError",{code:"invalid term definition",context:e})}const l=t.mappings.get(n);t.mappings.has(n)&&t.mappings.delete(n);let d=!1;if((s(f)||null===f)&&(d=!0,f={"@id":f}),!o(f))throw new r("Invalid JSON-LD syntax; @context term values must be strings or objects.","jsonld.SyntaxError",{code:"invalid term definition",context:e});const m={};t.mappings.set(n,m),m.reverse=!1;const g=["@container","@id","@language","@reverse","@type"];p.processingMode(t,1.1)&&g.push("@context","@direction","@index","@nest","@prefix","@protected");for(const t in f)if(!g.includes(t))throw new r("Invalid JSON-LD syntax; a term definition must not contain "+t,"jsonld.SyntaxError",{code:"invalid term definition",context:e});const b=n.indexOf(":");if(m._termHasColon=b>0,"@reverse"in f){if("@id"in f)throw new r("Invalid JSON-LD syntax; a @reverse term definition must not contain @id.","jsonld.SyntaxError",{code:"invalid reverse property",context:e});if("@nest"in f)throw new r("Invalid JSON-LD syntax; a @reverse term definition must not contain @nest.","jsonld.SyntaxError",{code:"invalid reverse property",context:e});const i=f["@reverse"];if(!s(i))throw new r("Invalid JSON-LD syntax; a @context @reverse value must be a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:e});if(!p.isKeyword(i)&&i.match(v))return console.warn('WARNING: values beginning with "@" are reserved for future use and ignored',{reverse:i}),void(l?t.mappings.set(n,l):t.mappings.delete(n));const o=w(t,i,{vocab:!0,base:!1},e,a,c);if(!u(o))throw new r("Invalid JSON-LD syntax; a @context @reverse value must be an absolute IRI or a blank node identifier.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:e});m["@id"]=o,m.reverse=!0}else if("@id"in f){let i=f["@id"];if(i&&!s(i))throw new r("Invalid JSON-LD syntax; a @context @id value must be an array of strings or a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:e});if(null===i)m["@id"]=null;else{if(!p.isKeyword(i)&&i.match(v))return console.warn('WARNING: values beginning with "@" are reserved for future use and ignored',{id:i}),void(l?t.mappings.set(n,l):t.mappings.delete(n));if(i!==n){if(i=w(t,i,{vocab:!0,base:!1},e,a,c),!u(i)&&!p.isKeyword(i))throw new r("Invalid JSON-LD syntax; a @context @id value must be an absolute IRI, a blank node identifier, or a keyword.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:e});if(n.match(/(?::[^:])|\//)&&w(t,n,{vocab:!0,base:!1},e,new Map(a).set(n,!0),c)!==i)throw new r("Invalid JSON-LD syntax; term in form of IRI must expand to definition.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:e});m["@id"]=i,m._prefix=d&&!m._termHasColon&&i.match(/[:\/\?#\[\]@]$/)}}}if(!("@id"in m))if(m._termHasColon){const r=n.substr(0,b);if(e.hasOwnProperty(r)&&p.createTermDefinition({activeCtx:t,localCtx:e,term:r,defined:a,options:c}),t.mappings.has(r)){const e=n.substr(b+1);m["@id"]=t.mappings.get(r)["@id"]+e}else m["@id"]=n}else if("@type"===n)m["@id"]=n;else{if(!("@vocab"in t))throw new r("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:e,term:n});m["@id"]=t["@vocab"]+n}if((!0===f["@protected"]||!0===a.get("@protected")&&!1!==f["@protected"])&&(t.protected[n]=!0,m.protected=!0),a.set(n,!0),"@type"in f){let n=f["@type"];if(!s(n))throw new r("Invalid JSON-LD syntax; an @context @type value must be a string.","jsonld.SyntaxError",{code:"invalid type mapping",context:e});if("@json"===n||"@none"===n){if(p.processingMode(t,1))throw new r(`Invalid JSON-LD syntax; an @context @type value must not be "${n}" in JSON-LD 1.0 mode.`,"jsonld.SyntaxError",{code:"invalid type mapping",context:e})}else if("@id"!==n&&"@vocab"!==n){if(n=w(t,n,{vocab:!0,base:!1},e,a,c),!u(n))throw new r("Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.","jsonld.SyntaxError",{code:"invalid type mapping",context:e});if(0===n.indexOf("_:"))throw new r("Invalid JSON-LD syntax; an @context @type value must be an IRI, not a blank node identifier.","jsonld.SyntaxError",{code:"invalid type mapping",context:e})}m["@type"]=n}if("@container"in f){const n=s(f["@container"])?[f["@container"]]:f["@container"]||[],o=["@list","@set","@index","@language"];let a=!0;const u=n.includes("@set");if(p.processingMode(t,1.1)){if(o.push("@graph","@id","@type"),n.includes("@list")){if(1!==n.length)throw new r("Invalid JSON-LD syntax; @context @container with @list must have no other values","jsonld.SyntaxError",{code:"invalid container mapping",context:e})}else if(n.includes("@graph")){if(n.some((t=>"@graph"!==t&&"@id"!==t&&"@index"!==t&&"@set"!==t)))throw new r("Invalid JSON-LD syntax; @context @container with @graph must have no other values other than @id, @index, and @set","jsonld.SyntaxError",{code:"invalid container mapping",context:e})}else a&=n.length<=(u?2:1);if(n.includes("@type")&&(m["@type"]=m["@type"]||"@id",!["@id","@vocab"].includes(m["@type"])))throw new r("Invalid JSON-LD syntax; container: @type requires @type to be @id or @vocab.","jsonld.SyntaxError",{code:"invalid type mapping",context:e})}else a&=!i(f["@container"]),a&=n.length<=1;if(a&=n.every((t=>o.includes(t))),a&=!(u&&n.includes("@list")),!a)throw new r("Invalid JSON-LD syntax; @context @container value must be one of the following: "+o.join(", "),"jsonld.SyntaxError",{code:"invalid container mapping",context:e});if(m.reverse&&!n.every((t=>["@index","@set"].includes(t))))throw new r("Invalid JSON-LD syntax; @context @container value for a @reverse type definition must be @index or @set.","jsonld.SyntaxError",{code:"invalid reverse property",context:e});m["@container"]=n}if("@index"in f){if(!("@container"in f)||!m["@container"].includes("@index"))throw new r(`Invalid JSON-LD syntax; @index without @index in @container: "${f["@index"]}" on term "${n}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:e});if(!s(f["@index"])||0===f["@index"].indexOf("@"))throw new r(`Invalid JSON-LD syntax; @index must expand to an IRI: "${f["@index"]}" on term "${n}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:e});m["@index"]=f["@index"]}if("@context"in f&&(m["@context"]=f["@context"]),"@language"in f&&!("@type"in f)){let t=f["@language"];if(null!==t&&!s(t))throw new r("Invalid JSON-LD syntax; @context @language value must be a string or null.","jsonld.SyntaxError",{code:"invalid language mapping",context:e});null!==t&&(t=t.toLowerCase()),m["@language"]=t}if("@prefix"in f){if(n.match(/:|\//))throw new r("Invalid JSON-LD syntax; @context @prefix used on a compact IRI term","jsonld.SyntaxError",{code:"invalid term definition",context:e});if(p.isKeyword(m["@id"]))throw new r("Invalid JSON-LD syntax; keywords may not be used as prefixes","jsonld.SyntaxError",{code:"invalid term definition",context:e});if("boolean"!=typeof f["@prefix"])throw new r("Invalid JSON-LD syntax; @context value for @prefix must be boolean","jsonld.SyntaxError",{code:"invalid @prefix value",context:e});m._prefix=!0===f["@prefix"]}if("@direction"in f){const t=f["@direction"];if(null!==t&&"ltr"!==t&&"rtl"!==t)throw new r('Invalid JSON-LD syntax; @direction value must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:e});m["@direction"]=t}if("@nest"in f){const t=f["@nest"];if(!s(t)||"@nest"!==t&&0===t.indexOf("@"))throw new r("Invalid JSON-LD syntax; @context @nest value must be a string which is not a keyword other than @nest.","jsonld.SyntaxError",{code:"invalid @nest value",context:e});m["@nest"]=t}const E=m["@id"];if("@context"===E||"@preserve"===E)throw new r("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:e});if(l&&l.protected&&!h&&(t.protected[n]=!0,m.protected=!0,!y(l,m))){const t=c&&c.protectedMode||"error";if("error"===t)throw new r(`Invalid JSON-LD syntax; tried to redefine "${n}" which is a protected term.`,"jsonld.SyntaxError",{code:"protected term redefinition",context:e,term:n});if("warn"===t)return void console.warn("WARNING: protected term redefinition",{term:n});throw new r("Invalid protectedMode.","jsonld.SyntaxError",{code:"invalid protected mode",context:e,term:n,protectedMode:t})}},p.expandIri=(t,e,n,r)=>w(t,e,n,void 0,void 0,r),p.getInitialContext=t=>{const e=JSON.stringify({processingMode:t.processingMode}),r=d.get(e);if(r)return r;const i={processingMode:t.processingMode,mappings:new Map,inverse:null,getInverse:function(){const t=this;if(t.inverse)return t.inverse;const e=t.inverse={},n=t.fastCurieMap={},r={},i=(t["@language"]||"@none").toLowerCase(),a=t["@direction"],u=t.mappings,c=[...u.keys()].sort(l);for(const t of c){const o=u.get(t);if(null===o)continue;let c=o["@container"]||"@none";if(c=[].concat(c).sort().join(""),null===o["@id"])continue;const h=f(o["@id"]);for(const u of h){let h=e[u];const f=p.isKeyword(u);if(h)f||o._termHasColon||r[u].push(t);else if(e[u]=h={},!f&&!o._termHasColon){r[u]=[t];const e={iri:u,terms:r[u]};u[0]in n?n[u[0]].push(e):n[u[0]]=[e]}if(h[c]||(h[c]={"@language":{},"@type":{},"@any":{}}),h=h[c],s(t,h["@any"],"@none"),o.reverse)s(t,h["@type"],"@reverse");else if("@none"===o["@type"])s(t,h["@any"],"@none"),s(t,h["@language"],"@none"),s(t,h["@type"],"@none");else if("@type"in o)s(t,h["@type"],o["@type"]);else if("@language"in o&&"@direction"in o){const e=o["@language"],n=o["@direction"];s(t,h["@language"],e&&n?`${e}_${n}`.toLowerCase():e?e.toLowerCase():n?`_${n}`:"@null")}else"@language"in o?s(t,h["@language"],(o["@language"]||"@null").toLowerCase()):"@direction"in o?s(t,h["@language"],o["@direction"]?`_${o["@direction"]}`:"@none"):a?(s(t,h["@language"],`_${a}`),s(t,h["@language"],"@none"),s(t,h["@type"],"@none")):(s(t,h["@language"],i),s(t,h["@language"],"@none"),s(t,h["@type"],"@none"))}}for(const t in n)o(n,t,1);return e},clone:function(){const t={};return t.mappings=n.clone(this.mappings),t.clone=this.clone,t.inverse=null,t.getInverse=this.getInverse,t.protected=n.clone(this.protected),this.previousContext&&(t.previousContext=this.previousContext.clone()),t.revertToPreviousContext=this.revertToPreviousContext,"@base"in this&&(t["@base"]=this["@base"]),"@language"in this&&(t["@language"]=this["@language"]),"@vocab"in this&&(t["@vocab"]=this["@vocab"]),t},revertToPreviousContext:function(){return this.previousContext?this.previousContext.clone():this},protected:{}};return 1e4===d.size&&d.clear(),d.set(e,i),i;function o(t,e,n){const r=t[e],i=t[e]={};let s,a;for(const t of r)s=t.iri,a=n>=s.length?"":s[n],a in i?i[a].push(t):i[a]=[t];for(const t in i)""!==t&&o(i,t,n+1)}function s(t,e,n){e.hasOwnProperty(n)||(e[n]=t)}},p.getContextValue=(t,e,n)=>{if(null===e){if("@context"===n)return;return null}if(t.mappings.has(e)){const r=t.mappings.get(e);if(a(n))return r;if(r.hasOwnProperty(n))return r[n]}return"@language"===n&&n in t||"@direction"===n&&n in t?t[n]:"@context"!==n?null:void 0},p.processingMode=(t,e)=>e.toString()>="1.1"?!t.processingMode||t.processingMode>="json-ld-"+e.toString():"json-ld-1.0"===t.processingMode,p.isKeyword=t=>{if(!s(t)||"@"!==t[0])return!1;switch(t){case"@base":case"@container":case"@context":case"@default":case"@direction":case"@embed":case"@explicit":case"@graph":case"@id":case"@included":case"@index":case"@json":case"@language":case"@list":case"@nest":case"@none":case"@omitDefault":case"@prefix":case"@preserve":case"@protected":case"@requireAll":case"@reverse":case"@set":case"@type":case"@value":case"@version":case"@vocab":return!0}return!1}}}),Gi=b({"../node_modules/jsonld/lib/expand.js"(t,e){var n=Ni(),{isArray:r,isObject:i,isEmptyObject:o,isString:s,isUndefined:a}=Ii(),{isList:u,isValue:c,isGraph:h,isSubject:f}=Oi(),{expandIri:l,getContextValue:d,isKeyword:v,process:p,processingMode:w}=Vi(),{isAbsolute:y}=Ui(),{addValue:m,asArray:g,getValues:b,validateTypeValue:E}=Pi(),S={};e.exports=S;var F=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/;async function k({activeCtx:t,activeProperty:e,expandedActiveProperty:h,element:b,expandedParent:x,options:j={},insideList:C,typeKey:R,typeScopedContext:T,expansionMap:I}){const O=Object.keys(b).sort(),N=[];let P;const D=b[R]&&"@json"===l(t,r(b[R])?b[R][0]:b[R],{vocab:!0},j);for(const k of O){let R,O=b[k];if("@context"===k)continue;let M=l(t,k,{vocab:!0},j);if((null===M||!y(M)&&!v(M))&&(M=I({unmappedProperty:k,activeCtx:t,activeProperty:e,parent:b,options:j,insideList:C,value:O,expandedParent:x}),void 0===M))continue;if(v(M)){if("@reverse"===h)throw new n("Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.","jsonld.SyntaxError",{code:"invalid reverse property map",value:O});if(M in x&&"@included"!==M&&"@type"!==M)throw new n("Invalid JSON-LD syntax; colliding keywords detected.","jsonld.SyntaxError",{code:"colliding keywords",keyword:M})}if("@id"===M){if(!s(O)){if(!j.isFrame)throw new n('Invalid JSON-LD syntax; "@id" value must a string.',"jsonld.SyntaxError",{code:"invalid @id value",value:O});if(i(O)){if(!o(O))throw new n('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:O})}else{if(!r(O))throw new n('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:O});if(!O.every((t=>s(t))))throw new n('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:O})}}m(x,"@id",g(O).map((e=>s(e)?l(t,e,{base:!0},j):e)),{propertyIsArray:j.isFrame});continue}if("@type"===M){i(O)&&(O=Object.fromEntries(Object.entries(O).map((([t,e])=>[l(T,t,{vocab:!0}),g(e).map((t=>l(T,t,{base:!0,vocab:!0})))])))),E(O,j.isFrame),m(x,"@type",g(O).map((t=>s(t)?l(T,t,{base:!0,vocab:!0},j):t)),{propertyIsArray:j.isFrame});continue}if("@included"===M&&w(t,1.1)){const r=g(await S.expand({activeCtx:t,activeProperty:e,element:O,options:j,expansionMap:I}));if(!r.every((t=>f(t))))throw new n("Invalid JSON-LD syntax; values of @included must expand to node objects.","jsonld.SyntaxError",{code:"invalid @included value",value:O});m(x,"@included",r,{propertyIsArray:!0});continue}if("@graph"===M&&!i(O)&&!r(O))throw new n('Invalid JSON-LD syntax; "@graph" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid @graph value",value:O});if("@value"===M){P=O,D&&w(t,1.1)?x["@value"]=O:m(x,"@value",O,{propertyIsArray:j.isFrame});continue}if("@language"===M){if(null===O)continue;if(!s(O)&&!j.isFrame)throw new n('Invalid JSON-LD syntax; "@language" value must be a string.',"jsonld.SyntaxError",{code:"invalid language-tagged string",value:O});O=g(O).map((t=>s(t)?t.toLowerCase():t));for(const t of O)s(t)&&!t.match(F)&&console.warn(`@language must be valid BCP47: ${t}`);m(x,"@language",O,{propertyIsArray:j.isFrame});continue}if("@direction"===M){if(!s(O)&&!j.isFrame)throw new n('Invalid JSON-LD syntax; "@direction" value must be a string.',"jsonld.SyntaxError",{code:"invalid base direction",value:O});O=g(O);for(const t of O)if(s(t)&&"ltr"!==t&&"rtl"!==t)throw new n('Invalid JSON-LD syntax; "@direction" must be "ltr" or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",value:O});m(x,"@direction",O,{propertyIsArray:j.isFrame});continue}if("@index"===M){if(!s(O))throw new n('Invalid JSON-LD syntax; "@index" value must be a string.',"jsonld.SyntaxError",{code:"invalid @index value",value:O});m(x,"@index",O);continue}if("@reverse"===M){if(!i(O))throw new n('Invalid JSON-LD syntax; "@reverse" value must be an object.',"jsonld.SyntaxError",{code:"invalid @reverse value",value:O});if(R=await S.expand({activeCtx:t,activeProperty:"@reverse",element:O,options:j,expansionMap:I}),"@reverse"in R)for(const t in R["@reverse"])m(x,t,R["@reverse"][t],{propertyIsArray:!0});let e=x["@reverse"]||null;for(const t in R){if("@reverse"===t)continue;null===e&&(e=x["@reverse"]={}),m(e,t,[],{propertyIsArray:!0});const r=R[t];for(let i=0;i<r.length;++i){const o=r[i];if(c(o)||u(o))throw new n('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:R});m(e,t,o,{propertyIsArray:!0})}}continue}if("@nest"===M){N.push(k);continue}let U=t;const L=d(t,k,"@context");a(L)||(U=await p({activeCtx:t,localCtx:L,propagate:!0,overrideProtected:!0,options:j}));const B=d(U,k,"@container")||[];if(B.includes("@language")&&i(O))R=_(U,O,d(U,k,"@direction"),j);else if(B.includes("@index")&&i(O)){const e=B.includes("@graph"),n=d(U,k,"@index")||"@index",r="@index"!==n&&l(t,n,{vocab:!0},j);R=await A({activeCtx:U,options:j,activeProperty:k,value:O,expansionMap:I,asGraph:e,indexKey:n,propertyIndex:r})}else if(B.includes("@id")&&i(O)){const t=B.includes("@graph");R=await A({activeCtx:U,options:j,activeProperty:k,value:O,expansionMap:I,asGraph:t,indexKey:"@id"})}else if(B.includes("@type")&&i(O))R=await A({activeCtx:U.revertToPreviousContext(),options:j,activeProperty:k,value:O,expansionMap:I,asGraph:!1,indexKey:"@type"});else{const n="@list"===M;if(n||"@set"===M){let t=e;n&&"@graph"===h&&(t=null),R=await S.expand({activeCtx:U,activeProperty:t,element:O,options:j,insideList:n,expansionMap:I})}else R="@json"===d(t,k,"@type")?{"@type":"@json","@value":O}:await S.expand({activeCtx:U,activeProperty:k,element:O,options:j,insideList:!1,expansionMap:I})}if(null!==R||"@value"===M||(R=I({unmappedValue:O,expandedProperty:M,activeCtx:U,activeProperty:e,parent:b,options:j,insideList:C,key:k,expandedParent:x}),void 0!==R))if("@list"!==M&&!u(R)&&B.includes("@list")&&(R={"@list":g(R)}),B.includes("@graph")&&!B.some((t=>"@id"===t||"@index"===t))&&(R=g(R).map((t=>({"@graph":g(t)})))),U.mappings.has(k)&&U.mappings.get(k).reverse){const t=x["@reverse"]=x["@reverse"]||{};R=g(R);for(let e=0;e<R.length;++e){const r=R[e];if(c(r)||u(r))throw new n('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:R});m(t,M,r,{propertyIsArray:!0})}}else m(x,M,R,{propertyIsArray:!0})}if("@value"in x)if("@json"===x["@type"]&&w(t,1.1));else if((i(P)||r(P))&&!j.isFrame)throw new n('Invalid JSON-LD syntax; "@value" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid value object value",value:P});for(const o of N){const s=r(b[o])?b[o]:[b[o]];for(const r of s){if(!i(r)||Object.keys(r).some((e=>"@value"===l(t,e,{vocab:!0},j))))throw new n("Invalid JSON-LD syntax; nested value must be a node object.","jsonld.SyntaxError",{code:"invalid @nest value",value:r});await k({activeCtx:t,activeProperty:e,expandedActiveProperty:h,element:r,expandedParent:x,options:j,insideList:C,typeScopedContext:T,typeKey:R,expansionMap:I})}}}function x({activeCtx:t,activeProperty:e,value:n,options:r}){if(null==n)return null;const i=l(t,e,{vocab:!0},r);if("@id"===i)return l(t,n,{base:!0},r);if("@type"===i)return l(t,n,{vocab:!0,base:!0},r);const o=d(t,e,"@type");if(("@id"===o||"@graph"===i)&&s(n))return{"@id":l(t,n,{base:!0},r)};if("@vocab"===o&&s(n))return{"@id":l(t,n,{vocab:!0,base:!0},r)};if(v(i))return n;const a={};if(o&&!["@id","@vocab","@none"].includes(o))a["@type"]=o;else if(s(n)){const n=d(t,e,"@language");null!==n&&(a["@language"]=n);const r=d(t,e,"@direction");null!==r&&(a["@direction"]=r)}return["boolean","number","string"].includes(typeof n)||(n=n.toString()),a["@value"]=n,a}function _(t,e,i,o){const a=[],u=Object.keys(e).sort();for(const c of u){const u=l(t,c,{vocab:!0},o);let h=e[c];r(h)||(h=[h]);for(const t of h){if(null===t)continue;if(!s(t))throw new n("Invalid JSON-LD syntax; language map values must be strings.","jsonld.SyntaxError",{code:"invalid language map value",languageMap:e});const r={"@value":t};"@none"!==u&&(r["@language"]=c.toLowerCase()),i&&(r["@direction"]=i),a.push(r)}}return a}async function A({activeCtx:t,options:e,activeProperty:i,value:o,expansionMap:s,asGraph:u,indexKey:f,propertyIndex:v}){const w=[],y=Object.keys(o).sort(),g="@type"===f;for(let b of y){if(g){const n=d(t,b,"@context");a(n)||(t=await p({activeCtx:t,localCtx:n,propagate:!1,options:e}))}let y,E=o[b];r(E)||(E=[E]),E=await S.expand({activeCtx:t,activeProperty:i,element:E,options:e,insideList:!1,insideIndex:!0,expansionMap:s}),y=v?"@none"===b?"@none":x({activeCtx:t,activeProperty:f,value:b,options:e}):l(t,b,{vocab:!0},e),"@id"===f?b=l(t,b,{base:!0},e):g&&(b=y);for(let t of E){if(u&&!h(t)&&(t={"@graph":[t]}),"@type"===f)"@none"===y||(t["@type"]=t["@type"]?[b].concat(t["@type"]):[b]);else{if(c(t)&&!["@language","@type","@index"].includes(f))throw new n(`Invalid JSON-LD syntax; Attempt to add illegal key to value object: "${f}".`,"jsonld.SyntaxError",{code:"invalid value object",value:t});v?"@none"!==y&&m(t,v,y,{propertyIsArray:!0,prependValue:!0}):"@none"===y||f in t||(t[f]=b)}w.push(t)}}return w}S.expand=async({activeCtx:t,activeProperty:e=null,element:u,options:c={},insideList:h=!1,insideIndex:f=!1,typeScopedContext:v=null,expansionMap:m=(()=>{})})=>{if(null==u)return null;if("@default"===e&&(c=Object.assign({},c,{isFrame:!1})),!r(u)&&!i(u)){if(!h&&(null===e||"@graph"===l(t,e,{vocab:!0},c))){const n=await m({unmappedValue:u,activeCtx:t,activeProperty:e,options:c,insideList:h});return void 0===n?null:n}return x({activeCtx:t,activeProperty:e,value:u,options:c})}if(r(u)){let n=[];const i=d(t,e,"@container")||[];h=h||i.includes("@list");for(let i=0;i<u.length;++i){let o=await S.expand({activeCtx:t,activeProperty:e,element:u[i],options:c,expansionMap:m,insideIndex:f,typeScopedContext:v});h&&r(o)&&(o={"@list":o}),null===o&&(o=await m({unmappedValue:u[i],activeCtx:t,activeProperty:e,parent:u,index:i,options:c,expandedParent:n,insideList:h}),void 0===o)||(r(o)?n=n.concat(o):n.push(o))}return n}const E=l(t,e,{vocab:!0},c),F=d(t,e,"@context");v=v||(t.previousContext?t:null);let _=Object.keys(u).sort(),A=!f;if(A&&v&&_.length<=2&&!_.includes("@context"))for(const e of _){const n=l(v,e,{vocab:!0},c);if("@value"===n){A=!1,t=v;break}if("@id"===n&&1===_.length){A=!1;break}}A&&(t=t.revertToPreviousContext()),a(F)||(t=await p({activeCtx:t,localCtx:F,propagate:!0,overrideProtected:!0,options:c})),"@context"in u&&(t=await p({activeCtx:t,localCtx:u["@context"],options:c})),v=t;let j=null;for(const e of _)if("@type"===l(t,e,{vocab:!0},c)){j=j||e;const n=u[e],r=Array.isArray(n)?n.length>1?n.slice().sort():n:[n];for(const e of r){const n=d(v,e,"@context");a(n)||(t=await p({activeCtx:t,localCtx:n,options:c,propagate:!1}))}}let C={};await k({activeCtx:t,activeProperty:e,expandedActiveProperty:E,element:u,expandedParent:C,options:c,insideList:h,typeKey:j,typeScopedContext:v,expansionMap:m}),_=Object.keys(C);let R=_.length;if("@value"in C){if("@type"in C&&("@language"in C||"@direction"in C))throw new n('Invalid JSON-LD syntax; an element containing "@value" may not contain both "@type" and either "@language" or "@direction".',"jsonld.SyntaxError",{code:"invalid value object",element:C});let r=R-1;if("@type"in C&&(r-=1),"@index"in C&&(r-=1),"@language"in C&&(r-=1),"@direction"in C&&(r-=1),0!==r)throw new n('Invalid JSON-LD syntax; an element containing "@value" may only have an "@index" property and either "@type" or either or both "@language" or "@direction".',"jsonld.SyntaxError",{code:"invalid value object",element:C});const i=null===C["@value"]?[]:g(C["@value"]),a=b(C,"@type");if(w(t,1.1)&&a.includes("@json")&&1===a.length);else if(0===i.length){const n=await m({unmappedValue:C,activeCtx:t,activeProperty:e,element:u,options:c,insideList:h});C=void 0!==n?n:null}else{if(!i.every((t=>s(t)||o(t)))&&"@language"in C)throw new n("Invalid JSON-LD syntax; only strings may be language-tagged.","jsonld.SyntaxError",{code:"invalid language-tagged value",element:C});if(!a.every((t=>y(t)&&!(s(t)&&0===t.indexOf("_:"))||o(t))))throw new n('Invalid JSON-LD syntax; an element containing "@value" and "@type" must have an absolute IRI for the value of "@type".',"jsonld.SyntaxError",{code:"invalid typed value",element:C})}}else if("@type"in C&&!r(C["@type"]))C["@type"]=[C["@type"]];else if("@set"in C||"@list"in C){if(R>1&&(2!==R||!("@index"in C)))throw new n('Invalid JSON-LD syntax; if an element has the property "@set" or "@list", then it can have at most one other property that is "@index".',"jsonld.SyntaxError",{code:"invalid set or list object",element:C});"@set"in C&&(C=C["@set"],_=Object.keys(C),R=_.length)}else if(1===R&&"@language"in C){const n=await m(C,{unmappedValue:C,activeCtx:t,activeProperty:e,element:u,options:c,insideList:h});C=void 0!==n?n:null}if(i(C)&&!c.keepFreeFloatingNodes&&!h&&(null===e||"@graph"===E)&&(0===R||"@value"in C||"@list"in C||1===R&&"@id"in C)){const n=await m({unmappedValue:C,activeCtx:t,activeProperty:e,element:u,options:c,insideList:h});C=void 0!==n?n:null}return C}}}),zi=b({"../node_modules/jsonld/lib/nodeMap.js"(t,e){var{isKeyword:n}=Vi(),r=Oi(),i=Ii(),o=Pi(),s=Ni(),a={};e.exports=a,a.createMergedNodeMap=(t,e)=>{const n=(e=e||{}).issuer||new o.IdentifierIssuer("_:b"),r={"@default":{}};return a.createNodeMap(t,r,"@default",n),a.mergeNodeMaps(r)},a.createNodeMap=(t,e,u,c,h,f)=>{if(i.isArray(t)){for(const n of t)a.createNodeMap(n,e,u,c,void 0,f);return}if(!i.isObject(t))return void(f&&f.push(t));if(r.isValue(t)){if("@type"in t){let e=t["@type"];0===e.indexOf("_:")&&(t["@type"]=e=c.getId(e))}return void(f&&f.push(t))}if(f&&r.isList(t)){const n=[];return a.createNodeMap(t["@list"],e,u,c,h,n),void f.push({"@list":n})}if("@type"in t){const e=t["@type"];for(const t of e)0===t.indexOf("_:")&&c.getId(t)}i.isUndefined(h)&&(h=r.isBlankNode(t)?c.getId(t["@id"]):t["@id"]),f&&f.push({"@id":h});const l=e[u],d=l[h]=l[h]||{};d["@id"]=h;const v=Object.keys(t).sort();for(let i of v){if("@id"===i)continue;if("@reverse"===i){const n={"@id":h},i=t["@reverse"];for(const t in i){const s=i[t];for(const i of s){let s=i["@id"];r.isBlankNode(i)&&(s=c.getId(s)),a.createNodeMap(i,e,u,c,s),o.addValue(l[s],t,n,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if("@graph"===i){h in e||(e[h]={}),a.createNodeMap(t[i],e,h,c);continue}if("@included"===i){a.createNodeMap(t[i],e,u,c);continue}if("@type"!==i&&n(i)){if("@index"===i&&i in d&&(t[i]!==d[i]||t[i]["@id"]!==d[i]["@id"]))throw new s("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:d});d[i]=t[i];continue}const f=t[i];if(0===i.indexOf("_:")&&(i=c.getId(i)),0!==f.length)for(let t of f)if("@type"===i&&(t=0===t.indexOf("_:")?c.getId(t):t),r.isSubject(t)||r.isSubjectReference(t)){if("@id"in t&&!t["@id"])continue;const n=r.isBlankNode(t)?c.getId(t["@id"]):t["@id"];o.addValue(d,i,{"@id":n},{propertyIsArray:!0,allowDuplicate:!1}),a.createNodeMap(t,e,u,c,n)}else if(r.isValue(t))o.addValue(d,i,t,{propertyIsArray:!0,allowDuplicate:!1});else if(r.isList(t)){const n=[];a.createNodeMap(t["@list"],e,u,c,h,n),t={"@list":n},o.addValue(d,i,t,{propertyIsArray:!0,allowDuplicate:!1})}else a.createNodeMap(t,e,u,c,h),o.addValue(d,i,t,{propertyIsArray:!0,allowDuplicate:!1});else o.addValue(d,i,[],{propertyIsArray:!0})}},a.mergeNodeMapGraphs=t=>{const e={};for(const r of Object.keys(t).sort())for(const i of Object.keys(t[r]).sort()){const s=t[r][i];i in e||(e[i]={"@id":i});const a=e[i];for(const t of Object.keys(s).sort())if(n(t)&&"@type"!==t)a[t]=o.clone(s[t]);else for(const e of s[t])o.addValue(a,t,o.clone(e),{propertyIsArray:!0,allowDuplicate:!1})}return e},a.mergeNodeMaps=t=>{const e=t["@default"],n=Object.keys(t).sort();for(const i of n){if("@default"===i)continue;const n=t[i];let o=e[i];o?"@graph"in o||(o["@graph"]=[]):e[i]=o={"@id":i,"@graph":[]};const s=o["@graph"];for(const t of Object.keys(n).sort()){const e=n[t];r.isSubjectReference(e)||s.push(e)}}return e}}}),Xi=b({"../node_modules/jsonld/lib/flatten.js"(t,e){var{isSubjectReference:n}=Oi(),{createMergedNodeMap:r}=zi(),i={};e.exports=i,i.flatten=t=>{const e=r(t),i=[],o=Object.keys(e).sort();for(let t=0;t<o.length;++t){const r=e[o[t]];n(r)||i.push(r)}return i}}}),Yi=b({"../node_modules/jsonld/lib/fromRdf.js"(t,e){var n=Ni(),r=Oi(),i=Ii(),o=Pi(),{RDF_LIST:s,RDF_FIRST:a,RDF_REST:u,RDF_NIL:c,RDF_TYPE:h,RDF_JSON_LITERAL:f,XSD_BOOLEAN:l,XSD_DOUBLE:d,XSD_INTEGER:v,XSD_STRING:p}=Di(),w=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/,y={};function m(t,e,r){if(t.termType.endsWith("Node"))return{"@id":t.value};const o={"@value":t.value};if(t.language)o["@language"]=t.language;else{let s=t.datatype.value;if(s||(s=p),s===f){s="@json";try{o["@value"]=JSON.parse(o["@value"])}catch(t){throw new n("JSON literal could not be parsed.","jsonld.InvalidJsonLiteral",{code:"invalid JSON literal",value:o["@value"],cause:t})}}if(e){if(s===l)"true"===o["@value"]?o["@value"]=!0:"false"===o["@value"]&&(o["@value"]=!1);else if(i.isNumeric(o["@value"]))if(s===v){const t=parseInt(o["@value"],10);t.toFixed(0)===o["@value"]&&(o["@value"]=t)}else s===d&&(o["@value"]=parseFloat(o["@value"]));[l,v,d,p].includes(s)||(o["@type"]=s)}else if("i18n-datatype"===r&&s.startsWith("https://www.w3.org/ns/i18n#")){const[,t,e]=s.split(/[#_]/);t.length>0&&(o["@language"]=t,t.match(w)||console.warn(`@language must be valid BCP47: ${t}`)),o["@direction"]=e}else s!==p&&(o["@type"]=s)}return o}e.exports=y,y.fromRDF=async(t,{useRdfType:e=!1,useNativeTypes:n=!1,rdfDirection:f=null})=>{const l={},d={"@default":l},v={};for(const r of t){const t="DefaultGraph"===r.graph.termType?"@default":r.graph.value;t in d||(d[t]={}),"@default"===t||t in l||(l[t]={"@id":t});const i=d[t],s=r.subject.value,a=r.predicate.value,u=r.object;s in i||(i[s]={"@id":s});const p=i[s],w=u.termType.endsWith("Node");if(w&&!(u.value in i)&&(i[u.value]={"@id":u.value}),a===h&&!e&&w){o.addValue(p,"@type",u.value,{propertyIsArray:!0});continue}const y=m(u,n,f);if(o.addValue(p,a,y,{propertyIsArray:!0}),w)if(u.value===c){const t=i[u.value];"usages"in t||(t.usages=[]),t.usages.push({node:p,property:a,value:y})}else v[u.value]=!(u.value in v)&&{node:p,property:a,value:y}}for(const t in d){const e=d[t];if(!(c in e))continue;const n=e[c];if(n.usages){for(let t of n.usages){let n=t.node,o=t.property,c=t.value;const h=[],f=[];let l=Object.keys(n).length;for(;o===u&&i.isObject(v[n["@id"]])&&i.isArray(n[a])&&1===n[a].length&&i.isArray(n[u])&&1===n[u].length&&(3===l||4===l&&i.isArray(n["@type"])&&1===n["@type"].length&&n["@type"][0]===s)&&(h.push(n[a][0]),f.push(n["@id"]),t=v[n["@id"]],n=t.node,o=t.property,c=t.value,l=Object.keys(n).length,r.isBlankNode(n)););delete c["@id"],c["@list"]=h.reverse();for(const t of f)delete e[t]}delete n.usages}}const p=[],w=Object.keys(l).sort();for(const t of w){const e=l[t];if(t in d){const n=e["@graph"]=[],i=d[t],o=Object.keys(i).sort();for(const t of o){const e=i[t];r.isSubjectReference(e)||n.push(e)}}r.isSubjectReference(e)||p.push(e)}return p}}}),Qi=b({"../node_modules/canonicalize/lib/canonicalize.js"(t,e){e.exports=function t(e){return null===e||"object"!=typeof e||null!=e.toJSON?JSON.stringify(e):Array.isArray(e)?"["+e.reduce(((e,n,r)=>e+(0===r?"":",")+t(void 0===n||"symbol"==typeof n?null:n)),"")+"]":"{"+Object.keys(e).sort().reduce(((n,r)=>void 0===e[r]||"symbol"==typeof e[r]?n:n+(0===n.length?"":",")+t(r)+":"+t(e[r])),"")+"}"}}}),Zi=b({"../node_modules/jsonld/lib/toRdf.js"(t,e){var{createNodeMap:n}=zi(),{isKeyword:r}=Vi(),i=Oi(),o=Qi(),s=Ii(),a=Pi(),{RDF_FIRST:u,RDF_REST:c,RDF_NIL:h,RDF_TYPE:f,RDF_JSON_LITERAL:l,RDF_LANGSTRING:d,XSD_BOOLEAN:v,XSD_DOUBLE:p,XSD_INTEGER:w,XSD_STRING:y}=Di(),{isAbsolute:m}=Ui(),g={};function b(t,e,n,i,o){const s=Object.keys(e).sort();for(const a of s){const s=e[a],u=Object.keys(s).sort();for(let e of u){const u=s[e];if("@type"===e)e=f;else if(r(e))continue;for(const r of u){const s={termType:a.startsWith("_:")?"BlankNode":"NamedNode",value:a};if(!m(a))continue;const u={termType:e.startsWith("_:")?"BlankNode":"NamedNode",value:e};if(!m(e))continue;if("BlankNode"===u.termType&&!o.produceGeneralizedRdf)continue;const c=E(r,i,t,n,o.rdfDirection);c&&t.push({subject:s,predicate:u,object:c,graph:n})}}}}function E(t,e,n,r,a){const f={};if(i.isValue(t)){f.termType="Literal",f.value=void 0,f.datatype={termType:"NamedNode"};let e=t["@value"];const n=t["@type"]||null;"@json"===n?(f.value=o(e),f.datatype.value=l):s.isBoolean(e)?(f.value=e.toString(),f.datatype.value=n||v):s.isDouble(e)||n===p?(s.isDouble(e)||(e=parseFloat(e)),f.value=e.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),f.datatype.value=n||p):s.isNumber(e)?(f.value=e.toFixed(0),f.datatype.value=n||w):"i18n-datatype"===a&&"@direction"in t?(f.datatype.value="https://www.w3.org/ns/i18n#"+(t["@language"]||"")+`_${t["@direction"]}`,f.value=e):"@language"in t?(f.value=e,f.datatype.value=n||d,f.language=t["@language"]):(f.value=e,f.datatype.value=n||y)}else if(i.isList(t)){const i=function(t,e,n,r,i){const o={termType:"NamedNode",value:u},s={termType:"NamedNode",value:c},a={termType:"NamedNode",value:h},f=t.pop(),l=f?{termType:"BlankNode",value:e.getId()}:a;let d=l;for(const a of t){const t=E(a,e,n,r,i),u={termType:"BlankNode",value:e.getId()};n.push({subject:d,predicate:o,object:t,graph:r}),n.push({subject:d,predicate:s,object:u,graph:r}),d=u}if(f){const t=E(f,e,n,r,i);n.push({subject:d,predicate:o,object:t,graph:r}),n.push({subject:d,predicate:s,object:a,graph:r})}return l}(t["@list"],e,n,r,a);f.termType=i.termType,f.value=i.value}else{const e=s.isObject(t)?t["@id"]:t;f.termType=e.startsWith("_:")?"BlankNode":"NamedNode",f.value=e}return"NamedNode"!==f.termType||m(f.value)?f:null}e.exports=g,g.toRDF=(t,e)=>{const r=new a.IdentifierIssuer("_:b"),i={"@default":{}};n(t,i,"@default",r);const o=[],s=Object.keys(i).sort();for(const t of s){let n;if("@default"===t)n={termType:"DefaultGraph",value:""};else{if(!m(t))continue;n=t.startsWith("_:")?{termType:"BlankNode"}:{termType:"NamedNode"},n.value=t}b(o,i[t],n,r,e)}return o}}}),to=b({"../node_modules/jsonld/lib/frame.js"(t,e){var{isKeyword:n}=Vi(),r=Oi(),i=Ii(),o=Pi(),s=Ui(),a=Ni(),{createNodeMap:u,mergeNodeMapGraphs:c}=zi(),h={};function f(t){const e={};for(const n in t)void 0!==t[n]&&(e["@"+n]=[t[n]]);return[e]}function l(t,e,n){for(let r=n.length-1;r>=0;--r){const i=n[r];if(i.graph===e&&i.subject["@id"]===t["@id"])return!0}return!1}function d(t,e,n){const r="@"+n;let i=r in t?t[r][0]:e[n];if("embed"===n)if(!0===i)i="@once";else if(!1===i)i="@never";else if("@always"!==i&&"@never"!==i&&"@link"!==i&&"@first"!==i&&"@last"!==i&&"@once"!==i)throw new a("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:t});return i}function v(t){if(!i.isArray(t)||1!==t.length||!i.isObject(t[0]))throw new a("Invalid JSON-LD syntax; a JSON-LD frame must be a single object.","jsonld.SyntaxError",{frame:t});if("@id"in t[0])for(const e of o.asArray(t[0]["@id"]))if(!i.isObject(e)&&!s.isAbsolute(e)||i.isString(e)&&0===e.indexOf("_:"))throw new a("Invalid JSON-LD syntax; invalid @id in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:t});if("@type"in t[0])for(const e of o.asArray(t[0]["@type"]))if(!i.isObject(e)&&!s.isAbsolute(e)||i.isString(e)&&0===e.indexOf("_:"))throw new a("Invalid JSON-LD syntax; invalid @type in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:t})}function p(t,e,s,a){let u=!0,c=!1;for(const h in s){let f=!1;const l=o.getValues(e,h),d=0===o.getValues(s,h).length;if("@id"===h){if(i.isEmptyObject(s["@id"][0]||{})?f=!0:s["@id"].length>=0&&(f=s["@id"].includes(l[0])),!a.requireAll)return f}else if("@type"===h){if(u=!1,d){if(l.length>0)return!1;f=!0}else if(1===s["@type"].length&&i.isEmptyObject(s["@type"][0]))f=l.length>0;else for(const t of s["@type"])f=!(!i.isObject(t)||!("@default"in t))||f||l.some((e=>e===t));if(!a.requireAll)return f}else{if(n(h))continue;{const e=o.getValues(s,h)[0];let n=!1;if(e&&(v([e]),n="@default"in e),u=!1,0===l.length&&n)continue;if(l.length>0&&d)return!1;if(void 0===e){if(l.length>0)return!1;f=!0}else if(r.isList(e)){const n=e["@list"][0];if(r.isList(l[0])){const e=l[0]["@list"];r.isValue(n)?f=e.some((t=>b(n,t))):(r.isSubject(n)||r.isSubjectReference(n))&&(f=e.some((e=>g(t,n,e,a))))}}else f=r.isValue(e)?l.some((t=>b(e,t))):r.isSubjectReference(e)?l.some((n=>g(t,e,n,a))):!!i.isObject(e)&&l.length>0}}if(!f&&a.requireAll)return!1;c=c||f}return u||c}function w(t,e){const n=t.uniqueEmbeds[t.graph],r=n[e],s=r.parent,a=r.property,u={"@id":e};if(i.isArray(s)){for(let t=0;t<s.length;++t)if(o.compareValues(s[t],u)){s[t]=u;break}}else{const t=i.isArray(s[a]);o.removeValue(s,a,u,{propertyIsArray:t}),o.addValue(s,a,u,{propertyIsArray:t})}const c=t=>{const e=Object.keys(n);for(const r of e)r in n&&i.isObject(n[r].parent)&&n[r].parent["@id"]===t&&(delete n[r],c(r))};c(e)}function y(t,e){if(i.isArray(t))return t.map((t=>y(t,e)));if(i.isObject(t)){if("@preserve"in t)return t["@preserve"][0];if(r.isValue(t))return t;if(r.isList(t))return t["@list"]=y(t["@list"],e),t;if("@id"in t){const n=t["@id"];if(e.link.hasOwnProperty(n)){const r=e.link[n].indexOf(t);if(-1!==r)return e.link[n][r];e.link[n].push(t)}else e.link[n]=[t]}for(const n in t)"@id"===n&&e.bnodesToClear.includes(t[n])?delete t["@id"]:t[n]=y(t[n],e)}return t}function m(t,e,n){i.isObject(t)?o.addValue(t,e,n,{propertyIsArray:!0}):t.push(n)}function g(t,e,n,r){if(!("@id"in n))return!1;const i=t.subjects[n["@id"]];return i&&p(t,i,e,r)}function b(t,e){const n=e["@value"],r=e["@type"],o=e["@language"],s=t["@value"]?i.isArray(t["@value"])?t["@value"]:[t["@value"]]:[],a=t["@type"]?i.isArray(t["@type"])?t["@type"]:[t["@type"]]:[],u=t["@language"]?i.isArray(t["@language"])?t["@language"]:[t["@language"]]:[];return 0===s.length&&0===a.length&&0===u.length||!(!s.includes(n)&&!i.isEmptyObject(s[0]))&&!!(!r&&0===a.length||a.includes(r)||r&&i.isEmptyObject(a[0]))&&!!(!o&&0===u.length||u.includes(o)||o&&i.isEmptyObject(u[0]))}e.exports=h,h.frameMergedOrDefault=(t,e,n)=>{const r={options:n,embedded:!1,graph:"@default",graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},i=new o.IdentifierIssuer("_:b");u(t,r.graphMap,"@default",i),n.merged&&(r.graphMap["@merged"]=c(r.graphMap),r.graph="@merged"),r.subjects=r.graphMap[r.graph];const s=[];return h.frame(r,Object.keys(r.subjects).sort(),e,s),n.pruneBlankNodeIdentifiers&&(n.bnodesToClear=Object.keys(r.bnodeMap).filter((t=>1===r.bnodeMap[t].length))),n.link={},y(s,n)},h.frame=(t,e,s,u,c=null)=>{v(s);const y=t.options,g={embed:d(s=s[0],y,"embed"),explicit:d(s,y,"explicit"),requireAll:d(s,y,"requireAll")};t.link.hasOwnProperty(t.graph)||(t.link[t.graph]={});const E=t.link[t.graph],S=function(t,e,n,r){const i={};for(const o of e){const e=t.graphMap[t.graph][o];p(t,e,n,r)&&(i[o]=e)}return i}(t,e,s,g),F=Object.keys(S).sort();for(const v of F){const p=S[v];if(null===c?t.uniqueEmbeds={[t.graph]:{}}:t.uniqueEmbeds[t.graph]=t.uniqueEmbeds[t.graph]||{},"@link"===g.embed&&v in E){m(u,c,E[v]);continue}const F={"@id":v};if(0===v.indexOf("_:")&&o.addValue(t.bnodeMap,v,F,{propertyIsArray:!0}),E[v]=F,("@first"===g.embed||"@last"===g.embed)&&t.is11)throw new a("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:s});if(t.embedded||!t.uniqueEmbeds[t.graph].hasOwnProperty(v))if(!t.embedded||"@never"!==g.embed&&!l(p,t.graph,t.subjectStack))if(!t.embedded||"@first"!=g.embed&&"@once"!=g.embed||!t.uniqueEmbeds[t.graph].hasOwnProperty(v)){if("@last"===g.embed&&v in t.uniqueEmbeds[t.graph]&&w(t,v),t.uniqueEmbeds[t.graph][v]={parent:u,property:c},t.subjectStack.push({subject:p,graph:t.graph}),v in t.graphMap){let e=!1,n=null;"@graph"in s?(n=s["@graph"][0],e=!("@merged"===v||"@default"===v),i.isObject(n)||(n={})):(e="@merged"!==t.graph,n={}),e&&h.frame({...t,graph:v,embedded:!1},Object.keys(t.graphMap[v]).sort(),[n],F,"@graph")}"@included"in s&&h.frame({...t,embedded:!1},e,s["@included"],F,"@included");for(const e of Object.keys(p).sort())if(n(e)){if(F[e]=o.clone(p[e]),"@type"===e)for(const e of p["@type"])0===e.indexOf("_:")&&o.addValue(t.bnodeMap,e,F,{propertyIsArray:!0})}else if(!g.explicit||e in s)for(const n of p[e]){const i=e in s?s[e]:f(g);if(r.isList(n)){const i=s[e]&&s[e][0]&&s[e][0]["@list"]?s[e][0]["@list"]:f(g),a={"@list":[]};m(F,e,a);const u=n["@list"];for(const e of u)r.isSubjectReference(e)?h.frame({...t,embedded:!0},[e["@id"]],i,a,"@list"):m(a,"@list",o.clone(e))}else r.isSubjectReference(n)?h.frame({...t,embedded:!0},[n["@id"]],i,F,e):b(i[0],n)&&m(F,e,o.clone(n))}for(const t of Object.keys(s).sort()){if("@type"===t){if(!i.isObject(s[t][0])||!("@default"in s[t][0]))continue}else if(n(t))continue;const e=s[t][0]||{};if(!d(e,y,"omitDefault")&&!(t in F)){let n="@null";"@default"in e&&(n=o.clone(e["@default"])),i.isArray(n)||(n=[n]),F[t]=[{"@preserve":n}]}}for(const e of Object.keys(s["@reverse"]||{}).sort()){const n=s["@reverse"][e];for(const r of Object.keys(t.subjects))o.getValues(t.subjects[r],e).some((t=>t["@id"]===v))&&(F["@reverse"]=F["@reverse"]||{},o.addValue(F["@reverse"],e,[],{propertyIsArray:!0}),h.frame({...t,embedded:!0},[r],n,F["@reverse"][e],c))}m(u,c,F),t.subjectStack.pop()}else m(u,c,F);else m(u,c,F)}},h.cleanupNull=(t,e)=>{if(i.isArray(t))return t.map((t=>h.cleanupNull(t,e))).filter((t=>t));if("@null"===t)return null;if(i.isObject(t)){if("@id"in t){const n=t["@id"];if(e.link.hasOwnProperty(n)){const r=e.link[n].indexOf(t);if(-1!==r)return e.link[n][r];e.link[n].push(t)}else e.link[n]=[t]}for(const n in t)t[n]=h.cleanupNull(t[n],e)}return t}}}),eo=b({"../node_modules/jsonld/lib/compact.js"(t,e){var n=Ni(),{isArray:r,isObject:i,isString:o,isUndefined:s}=Ii(),{isList:a,isValue:u,isGraph:c,isSimpleGraph:h,isSubjectReference:f}=Oi(),{expandIri:l,getContextValue:d,isKeyword:v,process:p,processingMode:w}=Vi(),{removeBase:y,prependBase:m}=Ui(),{addValue:g,asArray:b,compareShortestLeast:E}=Pi(),S={};function F(t,e,r){if("@nest"!==l(t,e,{vocab:!0},r))throw new n("JSON-LD compact error; nested property must have an @nest value resolving to @nest.","jsonld.SyntaxError",{code:"invalid @nest value"})}e.exports=S,S.compact=async({activeCtx:t,activeProperty:e=null,element:l,options:y={},compactionMap:m=(()=>{})})=>{if(r(l)){let n=[];for(let r=0;r<l.length;++r){let i=await S.compact({activeCtx:t,activeProperty:e,element:l[r],options:y,compactionMap:m});null===i&&(i=await m({unmappedValue:l[r],activeCtx:t,activeProperty:e,parent:l,index:r,options:y}),void 0===i)||n.push(i)}return y.compactArrays&&1===n.length&&0===(d(t,e,"@container")||[]).length&&(n=n[0]),n}const E=d(t,e,"@context");if(s(E)||(t=await p({activeCtx:t,localCtx:E,propagate:!0,overrideProtected:!0,options:y})),i(l)){if(y.link&&"@id"in l&&y.link.hasOwnProperty(l["@id"])){const t=y.link[l["@id"]];for(let e=0;e<t.length;++e)if(t[e].expanded===l)return t[e].compacted}if(u(l)||f(l)){const n=S.compactValue({activeCtx:t,activeProperty:e,value:l,options:y});return y.link&&f(l)&&(y.link.hasOwnProperty(l["@id"])||(y.link[l["@id"]]=[]),y.link[l["@id"]].push({expanded:l,compacted:n})),n}if(a(l)&&(d(t,e,"@container")||[]).includes("@list"))return S.compact({activeCtx:t,activeProperty:e,element:l["@list"],options:y,compactionMap:m});const E="@reverse"===e,k={},x=t;u(l)||f(l)||(t=t.revertToPreviousContext());const _=d(x,e,"@context");s(_)||(t=await p({activeCtx:t,localCtx:_,propagate:!0,overrideProtected:!0,options:y})),y.link&&"@id"in l&&(y.link.hasOwnProperty(l["@id"])||(y.link[l["@id"]]=[]),y.link[l["@id"]].push({expanded:l,compacted:k}));let A=l["@type"]||[];A.length>1&&(A=Array.from(A).sort());const j=t;for(const e of A){const n=S.compactIri({activeCtx:j,iri:e,relativeTo:{vocab:!0}}),r=d(x,n,"@context");s(r)||(t=await p({activeCtx:t,localCtx:r,options:y,propagate:!1}))}const C=Object.keys(l).sort();for(const s of C){const f=l[s];if("@id"!==s)if("@type"!==s)if("@reverse"!==s)if("@preserve"!==s)if("@index"!==s)if("@graph"!==s&&"@list"!==s&&"@included"!==s&&v(s)){const e=S.compactIri({activeCtx:t,iri:s,relativeTo:{vocab:!0}});g(k,e,f)}else{if(!r(f))throw new n("JSON-LD expansion error; expanded value must be an array.","jsonld.SyntaxError");if(0===f.length){const e=S.compactIri({activeCtx:t,iri:s,value:f,relativeTo:{vocab:!0},reverse:E}),n=t.mappings.has(e)?t.mappings.get(e)["@nest"]:null;let r=k;n&&(F(t,n,y),i(k[n])||(k[n]={}),r=k[n]),g(r,e,f,{propertyIsArray:!0})}for(const e of f){const n=S.compactIri({activeCtx:t,iri:s,value:e,relativeTo:{vocab:!0},reverse:E}),f=t.mappings.has(n)?t.mappings.get(n)["@nest"]:null;let l=k;f&&(F(t,f,y),i(k[f])||(k[f]={}),l=k[f]);const v=d(t,n,"@container")||[],p=c(e),w=a(e);let x;w?x=e["@list"]:p&&(x=e["@graph"]);let _=await S.compact({activeCtx:t,activeProperty:n,element:w||p?x:e,options:y,compactionMap:m});if(w){if(r(_)||(_=[_]),v.includes("@list")){g(l,n,_,{valueIsArray:!0,allowDuplicate:!0});continue}_={[S.compactIri({activeCtx:t,iri:"@list",relativeTo:{vocab:!0}})]:_},"@index"in e&&(_[S.compactIri({activeCtx:t,iri:"@index",relativeTo:{vocab:!0}})]=e["@index"])}if(p)if(v.includes("@graph")&&(v.includes("@id")||v.includes("@index")&&h(e))){let r;l.hasOwnProperty(n)?r=l[n]:l[n]=r={};const i=(v.includes("@id")?e["@id"]:e["@index"])||S.compactIri({activeCtx:t,iri:"@none",relativeTo:{vocab:!0}});g(r,i,_,{propertyIsArray:!y.compactArrays||v.includes("@set")})}else v.includes("@graph")&&h(e)?(r(_)&&_.length>1&&(_={"@included":_}),g(l,n,_,{propertyIsArray:!y.compactArrays||v.includes("@set")})):(r(_)&&1===_.length&&y.compactArrays&&(_=_[0]),_={[S.compactIri({activeCtx:t,iri:"@graph",relativeTo:{vocab:!0}})]:_},"@id"in e&&(_[S.compactIri({activeCtx:t,iri:"@id",relativeTo:{vocab:!0}})]=e["@id"]),"@index"in e&&(_[S.compactIri({activeCtx:t,iri:"@index",relativeTo:{vocab:!0}})]=e["@index"]),g(l,n,_,{propertyIsArray:!y.compactArrays||v.includes("@set")}));else if(v.includes("@language")||v.includes("@index")||v.includes("@id")||v.includes("@type")){let r,i;if(l.hasOwnProperty(n)?r=l[n]:l[n]=r={},v.includes("@language"))u(_)&&(_=_["@value"]),i=e["@language"];else if(v.includes("@index")){const r=d(t,n,"@index")||"@index",s=S.compactIri({activeCtx:t,iri:r,relativeTo:{vocab:!0}});if("@index"===r)i=e["@index"],delete _[s];else{let t;if([i,...t]=b(_[r]||[]),o(i))switch(t.length){case 0:delete _[r];break;case 1:_[r]=t[0];break;default:_[r]=t}else i=null}}else if(v.includes("@id")){const e=S.compactIri({activeCtx:t,iri:"@id",relativeTo:{vocab:!0}});i=_[e],delete _[e]}else if(v.includes("@type")){const r=S.compactIri({activeCtx:t,iri:"@type",relativeTo:{vocab:!0}});let o;switch([i,...o]=b(_[r]||[]),o.length){case 0:delete _[r];break;case 1:_[r]=o[0];break;default:_[r]=o}1===Object.keys(_).length&&"@id"in e&&(_=await S.compact({activeCtx:t,activeProperty:n,element:{"@id":e["@id"]},options:y,compactionMap:m}))}i||(i=S.compactIri({activeCtx:t,iri:"@none",relativeTo:{vocab:!0}})),g(r,i,_,{propertyIsArray:v.includes("@set")})}else{const t=!y.compactArrays||v.includes("@set")||v.includes("@list")||r(_)&&0===_.length||"@list"===s||"@graph"===s;g(l,n,_,{propertyIsArray:t})}}}else{if((d(t,e,"@container")||[]).includes("@index"))continue;const n=S.compactIri({activeCtx:t,iri:s,relativeTo:{vocab:!0}});g(k,n,f)}else{const n=await S.compact({activeCtx:t,activeProperty:e,element:f,options:y,compactionMap:m});r(n)&&0===n.length||g(k,s,n)}else{const e=await S.compact({activeCtx:t,activeProperty:"@reverse",element:f,options:y,compactionMap:m});for(const n in e)if(t.mappings.has(n)&&t.mappings.get(n).reverse){const r=e[n],i=(d(t,n,"@container")||[]).includes("@set")||!y.compactArrays;g(k,n,r,{propertyIsArray:i}),delete e[n]}if(Object.keys(e).length>0){const n=S.compactIri({activeCtx:t,iri:s,relativeTo:{vocab:!0}});g(k,n,e)}}else{let e=b(f).map((t=>S.compactIri({activeCtx:x,iri:t,relativeTo:{vocab:!0}})));1===e.length&&(e=e[0]);const n=S.compactIri({activeCtx:t,iri:"@type",relativeTo:{vocab:!0}}),i=(d(t,n,"@container")||[]).includes("@set")&&w(t,1.1)||r(e)&&0===f.length;g(k,n,e,{propertyIsArray:i})}else{let e=b(f).map((e=>S.compactIri({activeCtx:t,iri:e,relativeTo:{vocab:!1},base:y.base})));1===e.length&&(e=e[0]),k[S.compactIri({activeCtx:t,iri:"@id",relativeTo:{vocab:!0}})]=e}}return k}return l},S.compactIri=({activeCtx:t,iri:e,value:r=null,relativeTo:o={vocab:!1},reverse:s=!1,base:h=null})=>{if(null===e)return e;t.isPropertyTermScoped&&t.previousContext&&(t=t.previousContext);const f=t.getInverse();if(v(e)&&e in f&&"@none"in f[e]&&"@type"in f[e]["@none"]&&"@none"in f[e]["@none"]["@type"])return f[e]["@none"]["@type"]["@none"];if(o.vocab&&e in f){const n=t["@language"]||"@none",o=[];i(r)&&"@index"in r&&!("@graph"in r)&&o.push("@index","@index@set"),i(r)&&"@preserve"in r&&(r=r["@preserve"][0]),c(r)?("@index"in r&&o.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in r&&o.push("@graph@id","@graph@id@set"),o.push("@graph","@graph@set","@set"),"@index"in r||o.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in r||o.push("@graph@id","@graph@id@set")):i(r)&&!u(r)&&o.push("@id","@id@set","@type","@set@type");let h="@language",f="@null";if(s)h="@type",f="@reverse",o.push("@set");else if(a(r)){"@index"in r||o.push("@list");const t=r["@list"];if(0===t.length)h="@any",f="@none";else{let e=0===t.length?n:null,r=null;for(let n=0;n<t.length;++n){const i=t[n];let o="@none",s="@none";if(u(i)?"@direction"in i?o=`${(i["@language"]||"").toLowerCase()}_${i["@direction"]}`:"@language"in i?o=i["@language"].toLowerCase():"@type"in i?s=i["@type"]:o="@null":s="@id",null===e?e=o:o!==e&&u(i)&&(e="@none"),null===r?r=s:s!==r&&(r="@none"),"@none"===e&&"@none"===r)break}e=e||"@none",r=r||"@none","@none"!==r?(h="@type",f=r):f=e}}else{if(u(r))if("@language"in r&&!("@index"in r)){o.push("@language","@language@set"),f=r["@language"];const t=r["@direction"];t&&(f=`${f}_${t}`)}else"@direction"in r&&!("@index"in r)?f=`_${r["@direction"]}`:"@type"in r&&(h="@type",f=r["@type"]);else h="@type",f="@id";o.push("@set")}o.push("@none"),i(r)&&!("@index"in r)&&o.push("@index","@index@set"),u(r)&&1===Object.keys(r).length&&o.push("@language","@language@set");const l=function(t,e,n,r,o,s){null===s&&(s="@null");const a=[];if(("@id"===s||"@reverse"===s)&&i(n)&&"@id"in n){"@reverse"===s&&a.push("@reverse");const e=S.compactIri({activeCtx:t,iri:n["@id"],relativeTo:{vocab:!0}});t.mappings.has(e)&&t.mappings.get(e)&&t.mappings.get(e)["@id"]===n["@id"]?a.push.apply(a,["@vocab","@id"]):a.push.apply(a,["@id","@vocab"])}else{a.push(s);const t=a.find((t=>t.includes("_")));t&&a.push(t.replace(/^[^_]+_/,"_"))}a.push("@none");const u=t.inverse[e];for(const t of r){if(!(t in u))continue;const e=u[t][o];for(const t of a)if(t in e)return e[t]}return null}(t,e,r,o,h,f);if(null!==l)return l}if(o.vocab&&"@vocab"in t){const n=t["@vocab"];if(0===e.indexOf(n)&&e!==n){const r=e.substr(n.length);if(!t.mappings.has(r))return r}}let l=null;const d=[];let p=t.fastCurieMap;const w=e.length-1;for(let t=0;t<w&&e[t]in p;++t)p=p[e[t]],""in p&&d.push(p[""][0]);for(let n=d.length-1;n>=0;--n){const i=d[n],o=i.terms;for(const n of o){const o=n+":"+e.substr(i.iri.length);t.mappings.get(n)._prefix&&(!t.mappings.has(o)||null===r&&t.mappings.get(o)["@id"]===e)&&(null===l||E(o,l)<0)&&(l=o)}}if(null!==l)return l;for(const[r,i]of t.mappings)if(i&&i._prefix&&e.startsWith(r+":"))throw new n(`Absolute IRI "${e}" confused with prefix "${r}".`,"jsonld.SyntaxError",{code:"IRI confused with prefix",context:t});return o.vocab?e:"@base"in t?t["@base"]?y(m(h,t["@base"]),e):e:y(h,e)},S.compactValue=({activeCtx:t,activeProperty:e,value:n,options:r})=>{if(u(n)){const r=d(t,e,"@type"),i=d(t,e,"@language"),s=d(t,e,"@direction"),a=d(t,e,"@container")||[],u="@index"in n&&!a.includes("@index");if(!u&&"@none"!==r){if(n["@type"]===r)return n["@value"];if("@language"in n&&n["@language"]===i&&"@direction"in n&&n["@direction"]===s)return n["@value"];if("@language"in n&&n["@language"]===i)return n["@value"];if("@direction"in n&&n["@direction"]===s)return n["@value"]}const c=Object.keys(n).length,h=1===c||2===c&&"@index"in n&&!u,f="@language"in t,l=o(n["@value"]),v=t.mappings.has(e)&&null===t.mappings.get(e)["@language"];if(h&&"@none"!==r&&(!f||!l||v))return n["@value"];const p={};return u&&(p[S.compactIri({activeCtx:t,iri:"@index",relativeTo:{vocab:!0}})]=n["@index"]),"@type"in n?p[S.compactIri({activeCtx:t,iri:"@type",relativeTo:{vocab:!0}})]=S.compactIri({activeCtx:t,iri:n["@type"],relativeTo:{vocab:!0}}):"@language"in n&&(p[S.compactIri({activeCtx:t,iri:"@language",relativeTo:{vocab:!0}})]=n["@language"]),"@direction"in n&&(p[S.compactIri({activeCtx:t,iri:"@direction",relativeTo:{vocab:!0}})]=n["@direction"]),p[S.compactIri({activeCtx:t,iri:"@value",relativeTo:{vocab:!0}})]=n["@value"],p}const i=l(t,e,{vocab:!0},r),s=d(t,e,"@type"),a=S.compactIri({activeCtx:t,iri:n["@id"],relativeTo:{vocab:"@vocab"===s},base:r.base});return"@id"===s||"@vocab"===s||"@graph"===i?a:{[S.compactIri({activeCtx:t,iri:"@id",relativeTo:{vocab:!0}})]:a}}}}),no=b({"../node_modules/jsonld/lib/JsonLdProcessor.js"(t,e){e.exports=t=>{class e{toString(){return"[object JsonLdProcessor]"}}return Object.defineProperty(e,"prototype",{writable:!1,enumerable:!1}),Object.defineProperty(e.prototype,"constructor",{writable:!0,enumerable:!1,configurable:!0,value:e}),e.compact=function(e,n){return arguments.length<2?Promise.reject(new TypeError("Could not compact, too few arguments.")):t.compact(e,n)},e.expand=function(e){return arguments.length<1?Promise.reject(new TypeError("Could not expand, too few arguments.")):t.expand(e)},e.flatten=function(e){return arguments.length<1?Promise.reject(new TypeError("Could not flatten, too few arguments.")):t.flatten(e)},e}}}),ro=b({"../node_modules/jsonld/lib/jsonld.js"(t,e){var n=Ti(),r=Bi(),i=Pi(),o=Wi(),s=i.IdentifierIssuer,a=Ni(),u=Hi(),c=qi(),{expand:h}=Gi(),{flatten:f}=Xi(),{fromRDF:l}=Yi(),{toRDF:d}=Zi(),{frameMergedOrDefault:v,cleanupNull:p}=to(),{isArray:w,isObject:y,isString:m}=Ii(),{isSubjectReference:g}=Oi(),{expandIri:b,getInitialContext:E,process:S,processingMode:F}=Vi(),{compact:k,compactIri:x}=eo(),{createNodeMap:_,createMergedNodeMap:A,mergeNodeMaps:j}=zi(),C=function(t){const e={},C=new u({max:100});function R(e,{documentLoader:n=t.documentLoader,...r}){return Object.assign({},{documentLoader:n},r,e)}return t.compact=async function(e,n,r){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(null===n)throw new a("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(null===e)return null;let u;(r=R(r,{base:m(e)?e:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new s("_:b"),contextResolver:new o({sharedCache:C})})).link&&(r.skipExpansion=!0),r.compactToRelative||delete r.base,u=r.skipExpansion?e:await t.expand(e,r);const c=await t.processContext(E(r),n,r);let h=await k({activeCtx:c,element:u,options:r,compactionMap:r.compactionMap});r.compactArrays&&!r.graph&&w(h)?1===h.length?h=h[0]:0===h.length&&(h={}):r.graph&&y(h)&&(h=[h]),y(n)&&"@context"in n&&(n=n["@context"]),n=i.clone(n),w(n)||(n=[n]);const f=n;n=[];for(let t=0;t<f.length;++t)(!y(f[t])||Object.keys(f[t]).length>0)&&n.push(f[t]);const l=n.length>0;if(1===n.length&&(n=n[0]),w(h)){const t=x({activeCtx:c,iri:"@graph",relativeTo:{vocab:!0}}),e=h;h={},l&&(h["@context"]=n),h[t]=e}else if(y(h)&&l){const t=h;h={"@context":n};for(const e in t)h[e]=t[e]}return h},t.expand=async function(e,n){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");!1===(n=R(n,{keepFreeFloatingNodes:!1,contextResolver:new o({sharedCache:C})})).expansionMap&&(n.expansionMap=void 0);const r={},s=[];if("expandContext"in n){const t=i.clone(n.expandContext);r.expandContext=y(t)&&"@context"in t?t:{"@context":t},s.push(r.expandContext)}let a;if(m(e)){const i=await t.get(e,n);a=i.documentUrl,r.input=i.document,i.contextUrl&&(r.remoteContext={"@context":i.contextUrl},s.push(r.remoteContext))}else r.input=i.clone(e);"base"in n||(n.base=a||"");let u=E(n);for(const t of s)u=await S({activeCtx:u,localCtx:t,options:n});let c=await h({activeCtx:u,element:r.input,options:n,expansionMap:n.expansionMap});return y(c)&&"@graph"in c&&1===Object.keys(c).length?c=c["@graph"]:null===c&&(c=[]),w(c)||(c=[c]),c},t.flatten=async function(e,n,r){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");n="function"==typeof n?null:n||null,r=R(r,{base:m(e)?e:"",contextResolver:new o({sharedCache:C})});const i=await t.expand(e,r),s=f(i);if(null===n)return s;r.graph=!0,r.skipExpansion=!0;const a=await t.compact(s,n,r);return a},t.frame=async function(e,n,r){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(r=R(r,{base:m(e)?e:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new o({sharedCache:C})}),m(n)){const e=await t.get(n,r);if(n=e.document,e.contextUrl){let t=n["@context"];t?w(t)?t.push(e.contextUrl):t=[t,e.contextUrl]:t=e.contextUrl,n["@context"]=t}}const i=n&&n["@context"]||{},s=await t.processContext(E(r),i,r);r.hasOwnProperty("omitGraph")||(r.omitGraph=F(s,1.1)),r.hasOwnProperty("pruneBlankNodeIdentifiers")||(r.pruneBlankNodeIdentifiers=F(s,1.1));const a=await t.expand(e,r),u={...r};u.isFrame=!0,u.keepFreeFloatingNodes=!0;const c=await t.expand(n,u),h=Object.keys(n).map((t=>b(s,t,{vocab:!0})));u.merged=!h.includes("@graph"),u.is11=F(s,1.1);const f=v(a,c,u);u.graph=!r.omitGraph,u.skipExpansion=!0,u.link={},u.framing=!0;let l=await t.compact(f,i,u);return u.link={},l=p(l,u),l},t.link=async function(e,n,r){const i={};return n&&(i["@context"]=n),i["@embed"]="@link",t.frame(e,i,r)},t.normalize=t.canonize=async function(e,r){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if("inputFormat"in(r=R(r,{base:m(e)?e:"",algorithm:"URDNA2015",skipExpansion:!1,contextResolver:new o({sharedCache:C})}))){if("application/n-quads"!==r.inputFormat&&"application/nquads"!==r.inputFormat)throw new a("Unknown canonicalization input format.","jsonld.CanonizeError");const t=c.parse(e);return n.canonize(t,r)}const i={...r};delete i.format,i.produceGeneralizedRdf=!1;const s=await t.toRDF(e,i);return n.canonize(s,r)},t.fromRDF=async function(t,n){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");n=R(n,{format:m(t)?"application/n-quads":void 0});const{format:r}=n;let{rdfParser:i}=n;if(r){if(i=i||e[r],!i)throw new a("Unknown input format.","jsonld.UnknownFormat",{format:r})}else i=()=>t;const o=await i(t);return l(o,n)},t.toRDF=async function(e,n){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");let r;r=(n=R(n,{base:m(e)?e:"",skipExpansion:!1,contextResolver:new o({sharedCache:C})})).skipExpansion?e:await t.expand(e,n);const i=d(r,n);if(n.format){if("application/n-quads"===n.format||"application/nquads"===n.format)return c.serialize(i);throw new a("Unknown output format.","jsonld.UnknownFormat",{format:n.format})}return i},t.createNodeMap=async function(e,n){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");n=R(n,{base:m(e)?e:"",contextResolver:new o({sharedCache:C})});const r=await t.expand(e,n);return A(r,n)},t.merge=async function(e,n,r){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!w(e))throw new TypeError('Could not merge, "docs" must be an array.');n="function"==typeof n?null:n||null,r=R(r,{contextResolver:new o({sharedCache:C})});const a=await Promise.all(e.map((e=>{const n={...r};return t.expand(e,n)})));let u=!0;"mergeNodes"in r&&(u=r.mergeNodes);const c=r.issuer||new s("_:b"),h={"@default":{}};for(let t=0;t<a.length;++t){const e=i.relabelBlankNodes(a[t],{issuer:new s("_:b"+t+"-")}),n=u||0===t?h:{"@default":{}};if(_(e,n,"@default",c),n!==h)for(const t in n){const e=n[t];if(!(t in h)){h[t]=e;continue}const r=h[t];for(const t in e)t in r||(r[t]=e[t])}}const f=j(h),l=[],d=Object.keys(f).sort();for(let t=0;t<d.length;++t){const e=f[d[t]];g(e)||l.push(e)}if(null===n)return l;r.graph=!0,r.skipExpansion=!0;const v=await t.compact(l,n,r);return v},Object.defineProperty(t,"documentLoader",{get:()=>t._documentLoader,set:e=>t._documentLoader=e}),t.documentLoader=async t=>{throw new a("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:t})},t.get=async function(e,n){let r;r="function"==typeof n.documentLoader?n.documentLoader:t.documentLoader;const i=await r(e);try{if(!i.document)throw new a("No remote document found at the given URL.","jsonld.NullRemoteDocument");m(i.document)&&(i.document=JSON.parse(i.document))}catch(t){throw new a("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:t,remoteDoc:i})}return i},t.processContext=async function(t,e,n){return n=R(n,{base:"",contextResolver:new o({sharedCache:C})}),null===e?E(n):(e=i.clone(e),y(e)&&"@context"in e||(e={"@context":e}),S({activeCtx:t,localCtx:e,options:n}))},t.getContextValue=Vi().getContextValue,t.documentLoaders={},t.useDocumentLoader=function(e){if(!(e in t.documentLoaders))throw new a('Unknown document loader type: "'+e+'"',"jsonld.UnknownDocumentLoader",{type:e});t.documentLoader=t.documentLoaders[e].apply(t,Array.prototype.slice.call(arguments,1))},t.registerRDFParser=function(t,n){e[t]=n},t.unregisterRDFParser=function(t){delete e[t]},t.registerRDFParser("application/n-quads",c.parse),t.registerRDFParser("application/nquads",c.parse),t.url=Ui(),t.util=i,Object.assign(t,i),t.promises=t,t.RequestQueue=Mi(),t.JsonLdProcessor=no()(t),r.setupGlobals(t),r.setupDocumentLoaders(t),t},R=function(){return C((function(){return R()}))};C(R),e.exports=R}}),io=b({"../node_modules/queue-microtask/index.js"(t,e){var n;e.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:global):t=>(n||(n=Promise.resolve())).then(t).catch((t=>setTimeout((()=>{throw t}),0)))}}),oo=b({"../node_modules/@babel/runtime/helpers/typeof.js"(t,e){function n(t){return e.exports=n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e.exports.__esModule=!0,e.exports.default=e.exports,n(t)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),so=b({"../node_modules/@babel/runtime/helpers/regeneratorRuntime.js"(t,e){var n=oo().default;function r(){e.exports=r=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},i=Object.prototype,o=i.hasOwnProperty,s=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",h=a.toStringTag||"@@toStringTag";function f(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=Object.create((e&&e.prototype instanceof p?e:p).prototype),o=new j(r||[]);return s(i,"_invoke",{value:k(t,n,o)}),i}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var v={};function p(){}function w(){}function y(){}var m={};f(m,u,(function(){return this}));var g=Object.getPrototypeOf,b=g&&g(g(C([])));b&&b!==i&&o.call(b,u)&&(m=b);var E=y.prototype=p.prototype=Object.create(m);function S(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function F(t,e){function r(i,s,a,u){var c=d(t[i],t,s);if("throw"!==c.type){var h=c.arg,f=h.value;return f&&"object"==n(f)&&o.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(f).then((function(t){h.value=t,a(h)}),(function(t){return r("throw",t,a,u)}))}u(c.arg)}var i;s(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(o,o):o()}})}function k(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var s=n.delegate;if(s){var a=x(s,n);if(a){if(a===v)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=d(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===v)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function x(t,e){var n=e.method,r=t.iterator[n];if(void 0===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=d(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,v;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,v):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function C(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function e(){for(;++n<t.length;)if(o.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return r.next=r}}return{next:R}}function R(){return{value:void 0,done:!0}}return w.prototype=y,s(E,"constructor",{value:y,configurable:!0}),s(y,"constructor",{value:w,configurable:!0}),w.displayName=f(y,h,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,f(t,h,"GeneratorFunction")),t.prototype=Object.create(E),t},t.awrap=function(t){return{__await:t}},S(F.prototype),f(F.prototype,c,(function(){return this})),t.AsyncIterator=F,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var s=new F(l(e,n,r,i),o);return t.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},S(E),f(E,h,"Generator"),f(E,u,(function(){return this})),f(E,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},t.values=C,j.prototype={constructor:j,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(A),!t)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,r){return s.type="throw",s.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var a=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(a&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=t,s.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),A(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;A(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:C(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),v}},t}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),ao=b({"../node_modules/@babel/runtime/regenerator/index.js"(t,e){var n=so()();e.exports=n;try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}}}),uo=b({"../node_modules/@xmldom/xmldom/lib/conventions.js"(t){function e(t,e){return void 0===e&&(e=Object),e&&"function"==typeof e.freeze?e.freeze(t):t}var n=e({HTML:"text/html",isHTML:function(t){return t===n.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),r=e({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(t){return t===r.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});t.assign=function(t,e){if(null===t||"object"!=typeof t)throw new TypeError("target is not an object");for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},t.find=function(t,e,n){if(void 0===n&&(n=Array.prototype),t&&"function"==typeof n.find)return n.find.call(t,e);for(var r=0;r<t.length;r++)if(Object.prototype.hasOwnProperty.call(t,r)){var i=t[r];if(e.call(void 0,i,r,t))return i}},t.freeze=e,t.MIME_TYPE=n,t.NAMESPACE=r}}),co=b({"../node_modules/@xmldom/xmldom/lib/dom.js"(t){var e=uo(),n=e.find,r=e.NAMESPACE;function i(t){return""!==t}function o(t,e){return t.hasOwnProperty(e)||(t[e]=!0),t}function s(t){if(!t)return[];var e=function(t){return t?t.split(/[\t\n\f\r ]+/).filter(i):[]}(t);return Object.keys(e.reduce(o,{}))}function a(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}function u(t,e){var n=t.prototype;if(!(n instanceof e)){let r=function(){};r.prototype=e.prototype,r=new r,a(n,r),t.prototype=n=r}n.constructor!=t&&("function"!=typeof t&&console.error("unknown Class:"+t),n.constructor=t)}var c={},h=c.ELEMENT_NODE=1,f=c.ATTRIBUTE_NODE=2,l=c.TEXT_NODE=3,d=c.CDATA_SECTION_NODE=4,v=c.ENTITY_REFERENCE_NODE=5,p=c.ENTITY_NODE=6,w=c.PROCESSING_INSTRUCTION_NODE=7,y=c.COMMENT_NODE=8,m=c.DOCUMENT_NODE=9,g=c.DOCUMENT_TYPE_NODE=10,b=c.DOCUMENT_FRAGMENT_NODE=11,E=c.NOTATION_NODE=12,S={},F={};S.INDEX_SIZE_ERR=(F[1]="Index size error",1),S.DOMSTRING_SIZE_ERR=(F[2]="DOMString size error",2);var k=S.HIERARCHY_REQUEST_ERR=(F[3]="Hierarchy request error",3);S.WRONG_DOCUMENT_ERR=(F[4]="Wrong document",4),S.INVALID_CHARACTER_ERR=(F[5]="Invalid character",5),S.NO_DATA_ALLOWED_ERR=(F[6]="No data allowed",6),S.NO_MODIFICATION_ALLOWED_ERR=(F[7]="No modification allowed",7);var x=S.NOT_FOUND_ERR=(F[8]="Not found",8);S.NOT_SUPPORTED_ERR=(F[9]="Not supported",9);var _=S.INUSE_ATTRIBUTE_ERR=(F[10]="Attribute in use",10);function A(t,e){if(e instanceof Error)var n=e;else n=this,Error.call(this,F[t]),this.message=F[t],Error.captureStackTrace&&Error.captureStackTrace(this,A);return n.code=t,e&&(this.message=this.message+": "+e),n}function j(){}function C(t,e){this._node=t,this._refresh=e,R(this)}function R(t){var e=t._node._inc||t._node.ownerDocument._inc;if(t._inc!=e){var n=t._refresh(t._node);wt(t,"length",n.length),a(n,t),t._inc=e}}function T(){}function I(t,e){for(var n=t.length;n--;)if(t[n]===e)return n}function O(t,e,n,i){if(i?e[I(e,i)]=n:e[e.length++]=n,t){n.ownerElement=t;var o=t.ownerDocument;o&&(i&&B(o,t,i),function(t,e,n){t&&t._inc++,n.namespaceURI===r.XMLNS&&(e._nsMap[n.prefix?n.localName:""]=n.value)}(o,t,n))}}function N(t,e,n){var r=I(e,n);if(!(r>=0))throw new A(x,new Error(t.tagName+"@"+n));for(var i=e.length-1;r<i;)e[r]=e[++r];if(e.length=i,t){var o=t.ownerDocument;o&&(B(o,t,n),n.ownerElement=null)}}function P(){}function D(){}function M(t){return("<"==t?"<":">"==t&&">")||"&"==t&&"&"||'"'==t&&"""||"&#"+t.charCodeAt()+";"}function U(t,e){if(e(t))return!0;if(t=t.firstChild)do{if(U(t,e))return!0}while(t=t.nextSibling)}function L(){this.ownerDocument=this}function B(t,e,n){t&&t._inc++,n.namespaceURI===r.XMLNS&&delete e._nsMap[n.prefix?n.localName:""]}function J(t,e,n){if(t&&t._inc){t._inc++;var r=e.childNodes;if(n)r[r.length++]=n;else{for(var i=e.firstChild,o=0;i;)r[o++]=i,i=i.nextSibling;r.length=o,delete r[r.length]}}}function K(t,e){var n=e.previousSibling,r=e.nextSibling;return n?n.nextSibling=r:t.firstChild=r,r?r.previousSibling=n:t.lastChild=n,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,J(t.ownerDocument,t),e}function H(t){return t&&t.nodeType===D.DOCUMENT_TYPE_NODE}function $(t){return t&&t.nodeType===D.ELEMENT_NODE}function W(t){return t&&t.nodeType===D.TEXT_NODE}function q(t,e){var r=t.childNodes||[];if(n(r,$)||H(e))return!1;var i=n(r,H);return!(e&&i&&r.indexOf(i)>r.indexOf(e))}function V(t,e){var r=t.childNodes||[];if(n(r,(function(t){return $(t)&&t!==e})))return!1;var i=n(r,H);return!(e&&i&&r.indexOf(i)>r.indexOf(e))}function G(t,e,r){var i=t.childNodes||[],o=e.childNodes||[];if(e.nodeType===D.DOCUMENT_FRAGMENT_NODE){var s=o.filter($);if(s.length>1||n(o,W))throw new A(k,"More than one element or text in fragment");if(1===s.length&&!q(t,r))throw new A(k,"Element in fragment can not be inserted before doctype")}if($(e)&&!q(t,r))throw new A(k,"Only one element can be added and only after doctype");if(H(e)){if(n(i,H))throw new A(k,"Only one doctype is allowed");var a=n(i,$);if(r&&i.indexOf(a)<i.indexOf(r))throw new A(k,"Doctype can only be inserted before an element");if(!r&&a)throw new A(k,"Doctype can not be appended since element is present")}}function z(t,e,r){var i=t.childNodes||[],o=e.childNodes||[];if(e.nodeType===D.DOCUMENT_FRAGMENT_NODE){var s=o.filter($);if(s.length>1||n(o,W))throw new A(k,"More than one element or text in fragment");if(1===s.length&&!V(t,r))throw new A(k,"Element in fragment can not be inserted before doctype")}if($(e)&&!V(t,r))throw new A(k,"Only one element can be added and only after doctype");if(H(e)){if(n(i,(function(t){return H(t)&&t!==r})))throw new A(k,"Only one doctype is allowed");var a=n(i,$);if(r&&i.indexOf(a)<i.indexOf(r))throw new A(k,"Doctype can only be inserted before an element")}}function X(t,e,n,r){(function(t,e,n){if(!function(t){return t&&(t.nodeType===D.DOCUMENT_NODE||t.nodeType===D.DOCUMENT_FRAGMENT_NODE||t.nodeType===D.ELEMENT_NODE)}(t))throw new A(k,"Unexpected parent node type "+t.nodeType);if(n&&n.parentNode!==t)throw new A(x,"child not in parent");if(!function(t){return t&&($(t)||W(t)||H(t)||t.nodeType===D.DOCUMENT_FRAGMENT_NODE||t.nodeType===D.COMMENT_NODE||t.nodeType===D.PROCESSING_INSTRUCTION_NODE)}(e)||H(e)&&t.nodeType!==D.DOCUMENT_NODE)throw new A(k,"Unexpected node type "+e.nodeType+" for parent node type "+t.nodeType)})(t,e,n),t.nodeType===D.DOCUMENT_NODE&&(r||G)(t,e,n);var i=e.parentNode;if(i&&i.removeChild(e),e.nodeType===b){var o=e.firstChild;if(null==o)return e;var s=e.lastChild}else o=s=e;var a=n?n.previousSibling:t.lastChild;o.previousSibling=a,s.nextSibling=n,a?a.nextSibling=o:t.firstChild=o,null==n?t.lastChild=s:n.previousSibling=s;do{o.parentNode=t}while(o!==s&&(o=o.nextSibling));return J(t.ownerDocument||t,t),e.nodeType==b&&(e.firstChild=e.lastChild=null),e}function Y(){this._nsMap={}}function Q(){}function Z(){}function tt(){}function et(){}function nt(){}function rt(){}function it(){}function ot(){}function st(){}function at(){}function ut(){}function ct(){}function ht(t,e){var n=[],r=9==this.nodeType&&this.documentElement||this,i=r.prefix,o=r.namespaceURI;if(o&&null==i&&null==(i=r.lookupPrefix(o)))var s=[{namespace:o,prefix:null}];return dt(this,n,t,e,s),n.join("")}function ft(t,e,n){var i=t.prefix||"",o=t.namespaceURI;if(!o)return!1;if("xml"===i&&o===r.XML||o===r.XMLNS)return!1;for(var s=n.length;s--;){var a=n[s];if(a.prefix===i)return a.namespace!==o}return!0}function lt(t,e,n){t.push(" ",e,'="',n.replace(/[<>&"\t\n\r]/g,M),'"')}function dt(t,e,n,i,o){if(o||(o=[]),i){if(!(t=i(t)))return;if("string"==typeof t)return void e.push(t)}switch(t.nodeType){case h:var s=t.attributes,a=s.length,u=t.firstChild,c=t.tagName,p=c;if(!(n=r.isHTML(t.namespaceURI)||n)&&!t.prefix&&t.namespaceURI){for(var E,S=0;S<s.length;S++)if("xmlns"===s.item(S).name){E=s.item(S).value;break}if(!E)for(var F=o.length-1;F>=0;F--)if(""===(k=o[F]).prefix&&k.namespace===t.namespaceURI){E=k.namespace;break}if(E!==t.namespaceURI)for(F=o.length-1;F>=0;F--){var k;if((k=o[F]).namespace===t.namespaceURI){k.prefix&&(p=k.prefix+":"+c);break}}}e.push("<",p);for(var x=0;x<a;x++)"xmlns"==(_=s.item(x)).prefix?o.push({prefix:_.localName,namespace:_.value}):"xmlns"==_.nodeName&&o.push({prefix:"",namespace:_.value});for(x=0;x<a;x++){var _,A,j;ft(_=s.item(x),0,o)&&(lt(e,(A=_.prefix||"")?"xmlns:"+A:"xmlns",j=_.namespaceURI),o.push({prefix:A,namespace:j})),dt(_,e,n,i,o)}if(c===p&&ft(t,0,o)&&(lt(e,(A=t.prefix||"")?"xmlns:"+A:"xmlns",j=t.namespaceURI),o.push({prefix:A,namespace:j})),u||n&&!/^(?:meta|link|img|br|hr|input)$/i.test(c)){if(e.push(">"),n&&/^script$/i.test(c))for(;u;)u.data?e.push(u.data):dt(u,e,n,i,o.slice()),u=u.nextSibling;else for(;u;)dt(u,e,n,i,o.slice()),u=u.nextSibling;e.push("</",p,">")}else e.push("/>");return;case m:case b:for(u=t.firstChild;u;)dt(u,e,n,i,o.slice()),u=u.nextSibling;return;case f:return lt(e,t.name,t.value);case l:return e.push(t.data.replace(/[<&>]/g,M));case d:return e.push("<![CDATA[",t.data,"]]>");case y:return e.push("\x3c!--",t.data,"--\x3e");case g:var C=t.publicId,R=t.systemId;if(e.push("<!DOCTYPE ",t.name),C)e.push(" PUBLIC ",C),R&&"."!=R&&e.push(" ",R),e.push(">");else if(R&&"."!=R)e.push(" SYSTEM ",R,">");else{var T=t.internalSubset;T&&e.push(" [",T,"]"),e.push(">")}return;case w:return e.push("<?",t.target," ",t.data,"?>");case v:return e.push("&",t.nodeName,";");default:e.push("??",t.nodeName)}}function vt(t,e,n){var r;switch(e.nodeType){case h:(r=e.cloneNode(!1)).ownerDocument=t;case b:break;case f:n=!0}if(r||(r=e.cloneNode(!1)),r.ownerDocument=t,r.parentNode=null,n)for(var i=e.firstChild;i;)r.appendChild(vt(t,i,n)),i=i.nextSibling;return r}function pt(t,e,n){var r=new e.constructor;for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var o=e[i];"object"!=typeof o&&o!=r[i]&&(r[i]=o)}switch(e.childNodes&&(r.childNodes=new j),r.ownerDocument=t,r.nodeType){case h:var s=e.attributes,a=r.attributes=new T,u=s.length;a._ownerElement=r;for(var c=0;c<u;c++)r.setAttributeNode(pt(t,s.item(c),!0));break;case f:n=!0}if(n)for(var l=e.firstChild;l;)r.appendChild(pt(t,l,n)),l=l.nextSibling;return r}function wt(t,e,n){t[e]=n}S.INVALID_STATE_ERR=(F[11]="Invalid state",11),S.SYNTAX_ERR=(F[12]="Syntax error",12),S.INVALID_MODIFICATION_ERR=(F[13]="Invalid modification",13),S.NAMESPACE_ERR=(F[14]="Invalid namespace",14),S.INVALID_ACCESS_ERR=(F[15]="Invalid access",15),A.prototype=Error.prototype,a(S,A),j.prototype={length:0,item:function(t){return this[t]||null},toString:function(t,e){for(var n=[],r=0;r<this.length;r++)dt(this[r],n,t,e);return n.join("")},filter:function(t){return Array.prototype.filter.call(this,t)},indexOf:function(t){return Array.prototype.indexOf.call(this,t)}},C.prototype.item=function(t){return R(this),this[t]},u(C,j),T.prototype={length:0,item:j.prototype.item,getNamedItem:function(t){for(var e=this.length;e--;){var n=this[e];if(n.nodeName==t)return n}},setNamedItem:function(t){var e=t.ownerElement;if(e&&e!=this._ownerElement)throw new A(_);var n=this.getNamedItem(t.nodeName);return O(this._ownerElement,this,t,n),n},setNamedItemNS:function(t){var e,n=t.ownerElement;if(n&&n!=this._ownerElement)throw new A(_);return e=this.getNamedItemNS(t.namespaceURI,t.localName),O(this._ownerElement,this,t,e),e},removeNamedItem:function(t){var e=this.getNamedItem(t);return N(this._ownerElement,this,e),e},removeNamedItemNS:function(t,e){var n=this.getNamedItemNS(t,e);return N(this._ownerElement,this,n),n},getNamedItemNS:function(t,e){for(var n=this.length;n--;){var r=this[n];if(r.localName==e&&r.namespaceURI==t)return r}return null}},P.prototype={hasFeature:function(){return!0},createDocument:function(t,e,n){var r=new L;if(r.implementation=this,r.childNodes=new j,r.doctype=n||null,n&&r.appendChild(n),e){var i=r.createElementNS(t,e);r.appendChild(i)}return r},createDocumentType:function(t,e,n){var r=new rt;return r.name=t,r.nodeName=t,r.publicId=e||"",r.systemId=n||"",r}},D.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(t,e){return X(this,t,e)},replaceChild:function(t,e){X(this,t,e,z),e&&this.removeChild(e)},removeChild:function(t){return K(this,t)},appendChild:function(t){return this.insertBefore(t,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(t){return pt(this.ownerDocument||this,this,t)},normalize:function(){for(var t=this.firstChild;t;){var e=t.nextSibling;e&&e.nodeType==l&&t.nodeType==l?(this.removeChild(e),t.appendData(e.data)):(t.normalize(),t=e)}},isSupported:function(t,e){return this.ownerDocument.implementation.hasFeature(t,e)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(t){for(var e=this;e;){var n=e._nsMap;if(n)for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)&&n[r]===t)return r;e=e.nodeType==f?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(t){for(var e=this;e;){var n=e._nsMap;if(n&&Object.prototype.hasOwnProperty.call(n,t))return n[t];e=e.nodeType==f?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(t){return null==this.lookupPrefix(t)}},a(c,D),a(c,D.prototype),L.prototype={nodeName:"#document",nodeType:m,doctype:null,documentElement:null,_inc:1,insertBefore:function(t,e){if(t.nodeType==b){for(var n=t.firstChild;n;){var r=n.nextSibling;this.insertBefore(n,e),n=r}return t}return X(this,t,e),t.ownerDocument=this,null===this.documentElement&&t.nodeType===h&&(this.documentElement=t),t},removeChild:function(t){return this.documentElement==t&&(this.documentElement=null),K(this,t)},replaceChild:function(t,e){X(this,t,e,z),t.ownerDocument=this,e&&this.removeChild(e),$(t)&&(this.documentElement=t)},importNode:function(t,e){return vt(this,t,e)},getElementById:function(t){var e=null;return U(this.documentElement,(function(n){if(n.nodeType==h&&n.getAttribute("id")==t)return e=n,!0})),e},getElementsByClassName:function(t){var e=s(t);return new C(this,(function(n){var r=[];return e.length>0&&U(n.documentElement,(function(i){if(i!==n&&i.nodeType===h){var o=i.getAttribute("class");if(o){var a=t===o;if(!a){var u=s(o);a=e.every((c=u,function(t){return c&&-1!==c.indexOf(t)}))}a&&r.push(i)}}var c})),r}))},createElement:function(t){var e=new Y;return e.ownerDocument=this,e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new j,(e.attributes=new T)._ownerElement=e,e},createDocumentFragment:function(){var t=new at;return t.ownerDocument=this,t.childNodes=new j,t},createTextNode:function(t){var e=new tt;return e.ownerDocument=this,e.appendData(t),e},createComment:function(t){var e=new et;return e.ownerDocument=this,e.appendData(t),e},createCDATASection:function(t){var e=new nt;return e.ownerDocument=this,e.appendData(t),e},createProcessingInstruction:function(t,e){var n=new ut;return n.ownerDocument=this,n.tagName=n.target=t,n.nodeValue=n.data=e,n},createAttribute:function(t){var e=new Q;return e.ownerDocument=this,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){var e=new st;return e.ownerDocument=this,e.nodeName=t,e},createElementNS:function(t,e){var n=new Y,r=e.split(":"),i=n.attributes=new T;return n.childNodes=new j,n.ownerDocument=this,n.nodeName=e,n.tagName=e,n.namespaceURI=t,2==r.length?(n.prefix=r[0],n.localName=r[1]):n.localName=e,i._ownerElement=n,n},createAttributeNS:function(t,e){var n=new Q,r=e.split(":");return n.ownerDocument=this,n.nodeName=e,n.name=e,n.namespaceURI=t,n.specified=!0,2==r.length?(n.prefix=r[0],n.localName=r[1]):n.localName=e,n}},u(L,D),Y.prototype={nodeType:h,hasAttribute:function(t){return null!=this.getAttributeNode(t)},getAttribute:function(t){var e=this.getAttributeNode(t);return e&&e.value||""},getAttributeNode:function(t){return this.attributes.getNamedItem(t)},setAttribute:function(t,e){var n=this.ownerDocument.createAttribute(t);n.value=n.nodeValue=""+e,this.setAttributeNode(n)},removeAttribute:function(t){var e=this.getAttributeNode(t);e&&this.removeAttributeNode(e)},appendChild:function(t){return t.nodeType===b?this.insertBefore(t,null):function(t,e){return e.parentNode&&e.parentNode.removeChild(e),e.parentNode=t,e.previousSibling=t.lastChild,e.nextSibling=null,e.previousSibling?e.previousSibling.nextSibling=e:t.firstChild=e,t.lastChild=e,J(t.ownerDocument,t,e),e}(this,t)},setAttributeNode:function(t){return this.attributes.setNamedItem(t)},setAttributeNodeNS:function(t){return this.attributes.setNamedItemNS(t)},removeAttributeNode:function(t){return this.attributes.removeNamedItem(t.nodeName)},removeAttributeNS:function(t,e){var n=this.getAttributeNodeNS(t,e);n&&this.removeAttributeNode(n)},hasAttributeNS:function(t,e){return null!=this.getAttributeNodeNS(t,e)},getAttributeNS:function(t,e){var n=this.getAttributeNodeNS(t,e);return n&&n.value||""},setAttributeNS:function(t,e,n){var r=this.ownerDocument.createAttributeNS(t,e);r.value=r.nodeValue=""+n,this.setAttributeNode(r)},getAttributeNodeNS:function(t,e){return this.attributes.getNamedItemNS(t,e)},getElementsByTagName:function(t){return new C(this,(function(e){var n=[];return U(e,(function(r){r===e||r.nodeType!=h||"*"!==t&&r.tagName!=t||n.push(r)})),n}))},getElementsByTagNameNS:function(t,e){return new C(this,(function(n){var r=[];return U(n,(function(i){i===n||i.nodeType!==h||"*"!==t&&i.namespaceURI!==t||"*"!==e&&i.localName!=e||r.push(i)})),r}))}},L.prototype.getElementsByTagName=Y.prototype.getElementsByTagName,L.prototype.getElementsByTagNameNS=Y.prototype.getElementsByTagNameNS,u(Y,D),Q.prototype.nodeType=f,u(Q,D),Z.prototype={data:"",substringData:function(t,e){return this.data.substring(t,t+e)},appendData:function(t){this.nodeValue=this.data=t=this.data+t,this.length=t.length},insertData:function(t,e){this.replaceData(t,0,e)},appendChild:function(){throw new Error(F[k])},deleteData:function(t,e){this.replaceData(t,e,"")},replaceData:function(t,e,n){var r=this.data.substring(0,t),i=this.data.substring(t+e);this.nodeValue=this.data=n=r+n+i,this.length=n.length}},u(Z,D),tt.prototype={nodeName:"#text",nodeType:l,splitText:function(t){var e=this.data,n=e.substring(t);e=e.substring(0,t),this.data=this.nodeValue=e,this.length=e.length;var r=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}},u(tt,Z),et.prototype={nodeName:"#comment",nodeType:y},u(et,Z),nt.prototype={nodeName:"#cdata-section",nodeType:d},u(nt,Z),rt.prototype.nodeType=g,u(rt,D),it.prototype.nodeType=E,u(it,D),ot.prototype.nodeType=p,u(ot,D),st.prototype.nodeType=v,u(st,D),at.prototype.nodeName="#document-fragment",at.prototype.nodeType=b,u(at,D),ut.prototype.nodeType=w,u(ut,D),ct.prototype.serializeToString=function(t,e,n){return ht.call(t,e,n)},D.prototype.toString=ht;try{if(Object.defineProperty){let t=function(e){switch(e.nodeType){case h:case b:var n=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&n.push(t(e)),e=e.nextSibling;return n.join("");default:return e.nodeValue}};Object.defineProperty(C.prototype,"length",{get:function(){return R(this),this.$$length}}),Object.defineProperty(D.prototype,"textContent",{get:function(){return t(this)},set:function(t){switch(this.nodeType){case h:case b:for(;this.firstChild;)this.removeChild(this.firstChild);(t||String(t))&&this.appendChild(this.ownerDocument.createTextNode(t));break;default:this.data=t,this.value=t,this.nodeValue=t}}}),wt=function(t,e,n){t["$$"+e]=n}}}catch(t){}t.DocumentType=rt,t.DOMException=A,t.DOMImplementation=P,t.Element=Y,t.Node=D,t.NodeList=j,t.XMLSerializer=ct}}),ho=b({"../node_modules/@xmldom/xmldom/lib/entities.js"(t){var e=uo().freeze;t.XML_ENTITIES=e({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),t.HTML_ENTITIES=e({lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}),t.entityMap=t.HTML_ENTITIES}}),fo=b({"../node_modules/@xmldom/xmldom/lib/sax.js"(t){var e=uo().NAMESPACE,n=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,r=new RegExp("[\\-\\.0-9"+n.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),i=new RegExp("^"+n.source+r.source+"*(?::"+n.source+r.source+"*)?$");function o(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,o)}function s(){}function a(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function u(t,n,r,i,o,s){function a(t,e,n){r.attributeNames.hasOwnProperty(t)&&s.fatalError("Attribute "+t+" redefined"),r.addValue(t,e.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,o),n)}for(var u,c=++n,h=0;;){var f=t.charAt(c);switch(f){case"=":if(1===h)u=t.slice(n,c),h=3;else{if(2!==h)throw new Error("attribute equal must after attrName");h=3}break;case"'":case'"':if(3===h||1===h){if(1===h&&(s.warning('attribute value must after "="'),u=t.slice(n,c)),!((c=t.indexOf(f,n=c+1))>0))throw new Error("attribute value no end '"+f+"' match");a(u,l=t.slice(n,c),n-1),h=5}else{if(4!=h)throw new Error('attribute value must after "="');a(u,l=t.slice(n,c),n),s.warning('attribute "'+u+'" missed start quot('+f+")!!"),n=c+1,h=5}break;case"/":switch(h){case 0:r.setTagName(t.slice(n,c));case 5:case 6:case 7:h=7,r.closed=!0;case 4:case 1:case 2:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),0==h&&r.setTagName(t.slice(n,c)),c;case">":switch(h){case 0:r.setTagName(t.slice(n,c));case 5:case 6:case 7:break;case 4:case 1:"/"===(l=t.slice(n,c)).slice(-1)&&(r.closed=!0,l=l.slice(0,-1));case 2:2===h&&(l=u),4==h?(s.warning('attribute "'+l+'" missed quot(")!'),a(u,l,n)):(e.isHTML(i[""])&&l.match(/^(?:disabled|checked|selected)$/i)||s.warning('attribute "'+l+'" missed value!! "'+l+'" instead!!'),a(l,l,n));break;case 3:throw new Error("attribute value missed!!")}return c;case"":f=" ";default:if(f<=" ")switch(h){case 0:r.setTagName(t.slice(n,c)),h=6;break;case 1:u=t.slice(n,c),h=2;break;case 4:var l=t.slice(n,c);s.warning('attribute "'+l+'" missed quot(")!!'),a(u,l,n);case 5:h=6}else switch(h){case 2:e.isHTML(i[""])&&u.match(/^(?:disabled|checked|selected)$/i)||s.warning('attribute "'+u+'" missed value!! "'+u+'" instead2!!'),a(u,u,n),n=c,h=1;break;case 5:s.warning('attribute space is required"'+u+'"!!');case 6:h=1,n=c;break;case 3:h=4,n=c;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}c++}}function c(t,n,r){for(var i=t.tagName,o=null,s=t.length;s--;){var a=t[s],u=a.qName,c=a.value;if((v=u.indexOf(":"))>0)var h=a.prefix=u.slice(0,v),f=u.slice(v+1),d="xmlns"===h&&f;else f=u,h=null,d="xmlns"===u&&"";a.localName=f,!1!==d&&(null==o&&(o={},l(r,r={})),r[d]=o[d]=c,a.uri=e.XMLNS,n.startPrefixMapping(d,c))}for(s=t.length;s--;)(h=(a=t[s]).prefix)&&("xml"===h&&(a.uri=e.XML),"xmlns"!==h&&(a.uri=r[h||""]));var v;(v=i.indexOf(":"))>0?(h=t.prefix=i.slice(0,v),f=t.localName=i.slice(v+1)):(h=null,f=t.localName=i);var p=t.uri=r[h||""];if(n.startElement(p,f,i,t),!t.closed)return t.currentNSMap=r,t.localNSMap=o,!0;if(n.endElement(p,f,i),o)for(h in o)Object.prototype.hasOwnProperty.call(o,h)&&n.endPrefixMapping(h)}function h(t,e,n,r,i){if(/^(?:script|textarea)$/i.test(n)){var o=t.indexOf("</"+n+">",e),s=t.substring(e+1,o);if(/[&<]/.test(s))return/^script$/i.test(n)?(i.characters(s,0,s.length),o):(s=s.replace(/&#?\w+;/g,r),i.characters(s,0,s.length),o)}return e+1}function f(t,e,n,r){var i=r[n];return null==i&&((i=t.lastIndexOf("</"+n+">"))<e&&(i=t.lastIndexOf("</"+n)),r[n]=i),i<e}function l(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}function d(t,e,n,r){if("-"===t.charAt(e+2))return"-"===t.charAt(e+3)?(i=t.indexOf("--\x3e",e+4))>e?(n.comment(t,e+4,i-e-4),i+3):(r.error("Unclosed comment"),-1):-1;if("CDATA["==t.substr(e+3,6)){var i=t.indexOf("]]>",e+9);return n.startCDATA(),n.characters(t,e+9,i-e-9),n.endCDATA(),i+3}var o=function(t,e){var n,r=[],i=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(i.lastIndex=e,i.exec(t);n=i.exec(t);)if(r.push(n),n[1])return r}(t,e),s=o.length;if(s>1&&/!doctype/i.test(o[0][0])){var a=o[1][0],u=!1,c=!1;s>3&&(/^public$/i.test(o[2][0])?(u=o[3][0],c=s>4&&o[4][0]):/^system$/i.test(o[2][0])&&(c=o[3][0]));var h=o[s-1];return n.startDTD(a,u,c),n.endDTD(),h.index+h[0].length}return-1}function v(t,e,n){var r=t.indexOf("?>",e);if(r){var i=t.substring(e,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return i?(n.processingInstruction(i[1],i[2]),r+2):-1}return-1}function p(){this.attributeNames={}}(o.prototype=new Error).name=o.name,s.prototype={parse:function(t,n,r){var i=this.domBuilder;i.startDocument(),l(n,n={}),function(t,n,r,i,s){function l(t){var e,n=t.slice(1,-1);return Object.hasOwnProperty.call(r,n)?r[n]:"#"===n.charAt(0)?(e=parseInt(n.substr(1).replace("x","0x")))>65535?(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e))):String.fromCharCode(e):(s.error("entity not found:"+t),t)}function w(e){if(e>k){var n=t.substring(k,e).replace(/&#?\w+;/g,l);E&&y(k),i.characters(n,0,e-k),k=e}}function y(e,n){for(;e>=g&&(n=b.exec(t));)g=(m=n.index)+n[0].length,E.lineNumber++;E.columnNumber=e-m+1}for(var m=0,g=0,b=/.*(?:\r\n?|\n)|.*$/g,E=i.locator,S=[{currentNSMap:n}],F={},k=0;;){try{var x=t.indexOf("<",k);if(x<0){if(!t.substr(k).match(/^\s*$/)){var _=i.doc,A=_.createTextNode(t.substr(k));_.appendChild(A),i.currentElement=A}return}switch(x>k&&w(x),t.charAt(x+1)){case"/":var j=t.indexOf(">",x+3),C=t.substring(x+2,j).replace(/[ \t\n\r]+$/g,""),R=S.pop();j<0?(C=t.substring(x+2).replace(/[\s<].*/,""),s.error("end tag name: "+C+" is not complete:"+R.tagName),j=x+1+C.length):C.match(/\s</)&&(C=C.replace(/[\s<].*/,""),s.error("end tag name: "+C+" maybe not complete"),j=x+1+C.length);var T=R.localNSMap,I=R.tagName==C;if(I||R.tagName&&R.tagName.toLowerCase()==C.toLowerCase()){if(i.endElement(R.uri,R.localName,C),T)for(var O in T)Object.prototype.hasOwnProperty.call(T,O)&&i.endPrefixMapping(O);I||s.fatalError("end tag name: "+C+" is not match the current start tagName:"+R.tagName)}else S.push(R);j++;break;case"?":E&&y(x),j=v(t,x,i);break;case"!":E&&y(x),j=d(t,x,i,s);break;default:E&&y(x);var N=new p,P=S[S.length-1].currentNSMap,D=(j=u(t,x,N,P,l,s),N.length);if(!N.closed&&f(t,j,N.tagName,F)&&(N.closed=!0,r.nbsp||s.warning("unclosed xml attribute")),E&&D){for(var M=a(E,{}),U=0;U<D;U++){var L=N[U];y(L.offset),L.locator=a(E,{})}i.locator=M,c(N,i,P)&&S.push(N),i.locator=E}else c(N,i,P)&&S.push(N);e.isHTML(N.uri)&&!N.closed?j=h(t,j,N.tagName,l,i):j++}}catch(t){if(t instanceof o)throw t;s.error("element parse error: "+t),j=-1}j>k?k=j:w(Math.max(x,k)+1)}}(t,n,r,i,this.errorHandler),i.endDocument()}},p.prototype={setTagName:function(t){if(!i.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,n){if(!i.test(t))throw new Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:n}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}},t.XMLReader=s,t.ParseError=o}}),lo=b({"../node_modules/@xmldom/xmldom/lib/dom-parser.js"(t){var e=uo(),n=co(),r=ho(),i=fo(),o=n.DOMImplementation,s=e.NAMESPACE,a=i.ParseError,u=i.XMLReader;function c(t){return t.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function h(t){this.options=t||{locator:{}}}function f(){this.cdata=!1}function l(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}function d(t){if(t)return"\n@"+(t.systemId||"")+"#[line:"+t.lineNumber+",col:"+t.columnNumber+"]"}function v(t,e,n){return"string"==typeof t?t.substr(e,n):t.length>=e+n||e?new java.lang.String(t,e,n)+"":t}function p(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}h.prototype.parseFromString=function(t,e){var n=this.options,i=new u,o=n.domBuilder||new f,a=n.errorHandler,h=n.locator,l=n.xmlns||{},v=/\/x?html?$/.test(e),p=v?r.HTML_ENTITIES:r.XML_ENTITIES;return h&&o.setDocumentLocator(h),i.errorHandler=function(t,e,n){if(!t){if(e instanceof f)return e;t=e}var r={},i=t instanceof Function;function o(e){var o=t[e];!o&&i&&(o=2==t.length?function(n){t(e,n)}:t),r[e]=o&&function(t){o("[xmldom "+e+"]\t"+t+d(n))}||function(){}}return n=n||{},o("warning"),o("error"),o("fatalError"),r}(a,o,h),i.domBuilder=n.domBuilder||o,v&&(l[""]=s.HTML),l.xml=l.xml||s.XML,t&&"string"==typeof t?i.parse((n.normalizeLineEndings||c)(t),l,p):i.errorHandler.error("invalid doc source"),o.doc},f.prototype={startDocument:function(){this.doc=(new o).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(t,e,n,r){var i=this.doc,o=i.createElementNS(t,n||e),s=r.length;p(this,o),this.currentElement=o,this.locator&&l(this.locator,o);for(var a=0;a<s;a++){t=r.getURI(a);var u=r.getValue(a),c=(n=r.getQName(a),i.createAttributeNS(t,n));this.locator&&l(r.getLocator(a),c),c.value=c.nodeValue=u,o.setAttributeNode(c)}},endElement:function(){this.currentElement=this.currentElement.parentNode},startPrefixMapping:function(){},endPrefixMapping:function(){},processingInstruction:function(t,e){var n=this.doc.createProcessingInstruction(t,e);this.locator&&l(this.locator,n),p(this,n)},ignorableWhitespace:function(){},characters:function(t,e,n){if(t=v.apply(this,arguments)){if(this.cdata)var r=this.doc.createCDATASection(t);else r=this.doc.createTextNode(t);this.currentElement?this.currentElement.appendChild(r):/^\s*$/.test(t)&&this.doc.appendChild(r),this.locator&&l(this.locator,r)}},skippedEntity:function(){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(t){(this.locator=t)&&(t.lineNumber=0)},comment:function(t,e,n){t=v.apply(this,arguments);var r=this.doc.createComment(t);this.locator&&l(this.locator,r),p(this,r)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(t,e,n){var r=this.doc.implementation;if(r&&r.createDocumentType){var i=r.createDocumentType(t,e,n);this.locator&&l(this.locator,i),p(this,i),this.doc.doctype=i}},warning:function(t){console.warn("[xmldom warning]\t"+t,d(this.locator))},error:function(t){console.error("[xmldom error]\t"+t,d(this.locator))},fatalError:function(t){throw new a(t,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(t){f.prototype[t]=function(){return null}})),t.__DOMHandler=f,t.normalizeLineEndings=c,t.DOMParser=h}}),vo=b({"../node_modules/@xmldom/xmldom/lib/index.js"(t){var e=co();t.DOMImplementation=e.DOMImplementation,t.XMLSerializer=e.XMLSerializer,t.DOMParser=lo().DOMParser}}),po=b({"../node_modules/solid-namespace/index.js"(t,e){var n={acl:"http://www.w3.org/ns/auth/acl#",arg:"http://www.w3.org/ns/pim/arg#",as:"https://www.w3.org/ns/activitystreams#",cal:"http://www.w3.org/2002/12/cal/ical#",cert:"http://www.w3.org/ns/auth/cert#",contact:"http://www.w3.org/2000/10/swap/pim/contact#",dc:"http://purl.org/dc/elements/1.1/",dct:"http://purl.org/dc/terms/",doap:"http://usefulinc.com/ns/doap#",foaf:"http://xmlns.com/foaf/0.1/",geo:"http://www.w3.org/2003/01/geo/wgs84_pos#",gpx:"http://www.w3.org/ns/pim/gpx#",http:"http://www.w3.org/2007/ont/http#",httph:"http://www.w3.org/2007/ont/httph#",icalTZ:"http://www.w3.org/2002/12/cal/icaltzd#",ldp:"http://www.w3.org/ns/ldp#",link:"http://www.w3.org/2007/ont/link#",log:"http://www.w3.org/2000/10/swap/log#",meeting:"http://www.w3.org/ns/pim/meeting#",mo:"http://purl.org/ontology/mo/",org:"http://www.w3.org/ns/org#",owl:"http://www.w3.org/2002/07/owl#",pad:"http://www.w3.org/ns/pim/pad#",patch:"http://www.w3.org/ns/pim/patch#",prov:"http://www.w3.org/ns/prov#",qu:"http://www.w3.org/2000/10/swap/pim/qif#",trip:"http://www.w3.org/ns/pim/trip#",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",rss:"http://purl.org/rss/1.0/",sched:"http://www.w3.org/ns/pim/schedule#",schema:"http://schema.org/",sioc:"http://rdfs.org/sioc/ns#",solid:"http://www.w3.org/ns/solid/terms#",space:"http://www.w3.org/ns/pim/space#",stat:"http://www.w3.org/ns/posix/stat#",tab:"http://www.w3.org/2007/ont/link#",tabont:"http://www.w3.org/2007/ont/link#",ui:"http://www.w3.org/ns/ui#",vcard:"http://www.w3.org/2006/vcard/ns#",wf:"http://www.w3.org/2005/01/wf/flow#",xsd:"http://www.w3.org/2001/XMLSchema#",cco:"http://www.ontologyrepository.com/CommonCoreOntologies/"};e.exports=function(t={namedNode:t=>t}){const e={};for(const r in n){const i=n[r];e[r]=function(e=""){return t.namedNode(i+e)}}return e}}}),wo=F(gi());function yo(t){return(yo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function mo(t){var e=function(t){if("object"!==yo(t)||null===t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!==yo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===yo(e)?e:String(e)}function go(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,mo(r.key),r)}}function bo(t,e,n){return e&&go(t.prototype,e),n&&go(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Eo(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function So(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Fo(t,e){return(Fo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function ko(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Fo(t,e)}function xo(t,e){if(e&&("object"===yo(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return So(t)}function _o(t){return(_o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Ao(t,e,n){return(e=mo(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var jo={Literal:1,Collection:3,Graph:4,NamedNode:5,BlankNode:6,Variable:7},Co=function(){function t(e){Eo(this,t),Ao(this,"termType",void 0),Ao(this,"classOrder",void 0),Ao(this,"value",void 0),this.value=e}return bo(t,[{key:"substitute",value:function(){return console.log("@@@ node substitute"+this),this}},{key:"compareTerm",value:function(t){return this.classOrder<t.classOrder?-1:this.classOrder>t.classOrder?1:this.value<t.value?-1:this.value>t.value?1:0}},{key:"equals",value:function(t){return!!t&&this.termType===t.termType&&this.value===t.value}},{key:"hashString",value:function(){return this.toCanonical()}},{key:"sameTerm",value:function(t){return this.equals(t)}},{key:"toCanonical",value:function(){return this.toNT()}},{key:"toNT",value:function(){return this.toString()}},{key:"toNQ",value:function(){return this.toNT()}},{key:"toString",value:function(){throw new Error("Node.toString() is abstract - see the subclasses instead")}}]),t}();Ao(Co,"fromValue",void 0),Ao(Co,"toJS",void 0);var Ro="NamedNode",To="BlankNode",Io="Literal",Oo="Variable",No="DefaultGraph",Po="Collection",Do="Empty",Mo="Graph",Uo="text/html",Lo="application/ld+json",Bo="text/n3",Jo="application/nquads",Ko="application/n-quads",Ho="application/rdf+xml",$o="application/sparql-update",Wo="application/sparql-update-single-match",qo="text/turtle",Vo="application/xhtml+xml";var Go=function(){ko(r,Co);var t,e,n=(t=r,e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var n,r=_o(t);if(e){var i=_o(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return xo(this,n)});function r(t){var e;return Eo(this,r),Ao(So(e=n.call(this,r.getId(t))),"termType",To),Ao(So(e),"classOrder",jo.BlankNode),Ao(So(e),"isBlank",1),Ao(So(e),"isVar",1),e}return bo(r,[{key:"id",get:function(){return this.value},set:function(t){this.value=t}},{key:"compareTerm",value:function(t){return this.classOrder<t.classOrder?-1:this.classOrder>t.classOrder?1:this.id<t.id?-1:this.id>t.id?1:0}},{key:"copy",value:function(t){var e=new r;return t.copyTo(this,e),e}},{key:"toCanonical",value:function(){return r.NTAnonymousNodePrefix+this.value}},{key:"toString",value:function(){return r.NTAnonymousNodePrefix+this.id}}],[{key:"getId",value:function(t){if(t){if("string"!=typeof t)throw console.log("Bad blank id:",t),new Error("Bad id argument to new blank node: "+t);if(t.includes("#")){var e=t.split("#");return e[e.length-1]}return t}return"n"+r.nextId++}}]),r}();function zo(t){return"string"==typeof t?t:t.value}function Xo(t){return"object"===yo(t)&&null!==t&&"subject"in t}function Yo(t){return"object"===yo(t)&&null!==t&&"statements"in t}function Qo(t){return ns(t)&&t.termType===Po}function Zo(t){return t&&Object.prototype.hasOwnProperty.call(t,"termType")&&(t.termType===Ro||t.termType===Oo||t.termType===To||t.termType===Po||t.termType===Io||t.termType===Mo)}function ts(t){return t&&Object.prototype.hasOwnProperty.call(t,"termType")&&(t.termType===Ro||t.termType===Oo||t.termType===To||t.termType===Po||t.termType===Io||t.termType===Mo)}function es(t){return ns(t)&&(t.termType===Ro||t.termType===To||t.termType===Oo)}function ns(t){return"object"===yo(t)&&null!==t&&"termType"in t}function rs(t){return t.termType===Io}function is(t){return"object"===yo(t)&&null!==t&&"subject"in t&&"predicate"in t&&"object"in t}function os(t){return ns(t)&&"NamedNode"===t.termType}function ss(t){return ns(t)&&(t.termType===Ro||t.termType===Oo||t.termType===To||t.termType===No)}Ao(Go,"nextId",0),Ao(Go,"NTAnonymousNodePrefix","_:");var as=function(){ko(r,Co);var t,e,n=(t=r,e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var n,r=_o(t);if(e){var i=_o(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return xo(this,n)});function r(t){var e;if(Eo(this,r),Ao(So(e=n.call(this,zo(t))),"termType",Ro),Ao(So(e),"classOrder",jo.NamedNode),!e.value)throw new Error("Missing IRI for NamedNode");if(!e.value.includes(":"))throw new Error('NamedNode IRI "'+t+'" must be absolute.');if(e.value.includes(" "))throw new Error('Error: NamedNode IRI "'+t+'" must not contain unencoded spaces.');return e}return bo(r,[{key:"dir",value:function(){var t=this.value.split("#")[0],e=t.slice(0,-1).lastIndexOf("/"),n=t.indexOf("//");return n>=0&&e<n+2||e<0?null:new r(t.slice(0,e+1))}},{key:"site",value:function(){var t=this.value.split("#")[0],e=t.indexOf("//");if(e<0)throw new Error("This URI does not have a web site part (origin)");var n=t.indexOf("/",e+2);return new r(n<0?t.slice(0)+"/":t.slice(0,n+1))}},{key:"doc",value:function(){return this.value.indexOf("#")<0?this:new r(this.value.split("#")[0])}},{key:"toString",value:function(){return"<"+this.value+">"}},{key:"id",value:function(){return this.value.split("#")[1]}},{key:"uri",get:function(){return this.value},set:function(t){this.value=t}}],[{key:"fromValue",value:function(t){return null==t||ns(t)?t:new r(t)}}]),r}(),us={boolean:new as("http://www.w3.org/2001/XMLSchema#boolean"),dateTime:new as("http://www.w3.org/2001/XMLSchema#dateTime"),decimal:new as("http://www.w3.org/2001/XMLSchema#decimal"),double:new as("http://www.w3.org/2001/XMLSchema#double"),integer:new as("http://www.w3.org/2001/XMLSchema#integer"),langString:new as("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),string:new as("http://www.w3.org/2001/XMLSchema#string")};var cs=function(){ko(r,Co);var t,e,n=(t=r,e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var n,r=_o(t);if(e){var i=_o(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return xo(this,n)});function r(t,e,i){var o;return Eo(this,r),Ao(So(o=n.call(this,t)),"termType",Io),Ao(So(o),"classOrder",jo.Literal),Ao(So(o),"datatype",us.string),Ao(So(o),"isVar",0),Ao(So(o),"language",""),e?(o.language=e,o.datatype=us.langString):o.datatype=i?as.fromValue(i):us.string,o}return bo(r,[{key:"copy",value:function(){return new r(this.value,this.lang,this.datatype)}},{key:"equals",value:function(t){return!!t&&this.termType===t.termType&&this.value===t.value&&this.language===t.language&&(!this.datatype&&!t.datatype||this.datatype&&this.datatype.equals(t.datatype))}},{key:"lang",get:function(){return this.language},set:function(t){this.language=t||""}},{key:"toNT",value:function(){return r.toNT(this)}},{key:"toString",value:function(){return""+this.value}}],[{key:"toNT",value:function(t){if("number"==typeof t.value)return""+t.value;if("string"!=typeof t.value)throw new Error("Value of RDF literal is not string or number: "+t.value);var e=t.value;return e='"'+(e=(e=(e=(e=e.replace(/\\/g,"\\\\")).replace(/\"/g,'\\"')).replace(/\n/g,"\\n")).replace(/\r/g,"\\r"))+'"',t.language?e+="@"+t.language:t.datatype.equals(us.string)||(e+="^^"+t.datatype.toCanonical()),e}},{key:"fromBoolean",value:function(t){return new r(t?"1":"0",null,us.boolean)}},{key:"fromDate",value:function(t){if(!(t instanceof Date))throw new TypeError("Invalid argument to Literal.fromDate()");var e=function(t){return(""+(100+t)).slice(1,3)};return new r(t.getUTCFullYear()+"-"+e(t.getUTCMonth()+1)+"-"+e(t.getUTCDate())+"T"+e(t.getUTCHours())+":"+e(t.getUTCMinutes())+":"+e(t.getUTCSeconds())+"Z",null,us.dateTime)}},{key:"fromNumber",value:function(t){if("number"!=typeof t)throw new TypeError("Invalid argument to Literal.fromNumber()");var e,n=t.toString();return e=n.indexOf("e")<0&&Math.abs(t)<=Number.MAX_SAFE_INTEGER?Number.isInteger(t)?us.integer:us.decimal:us.double,new r(n,null,e)}},{key:"fromValue",value:function(t){if(rs(t))return t;switch(yo(t)){case"object":if(t instanceof Date)return r.fromDate(t);case"boolean":return r.fromBoolean(t);case"number":return r.fromNumber(t);case"string":return new r(t)}throw new Error("Can't make literal from "+t+" of type "+yo(t))}}]),r}();function hs(t){return null==t||ns(t)?t:Array.isArray(t)?new fs(t):cs.fromValue(t)}var fs=function(){ko(r,Co);var t,e,n=(t=r,e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var n,r=_o(t);if(e){var i=_o(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return xo(this,n)});function r(t){var e;return Eo(this,r),Ao(So(e=n.call(this,(Go.nextId++).toString())),"termType",Po),Ao(So(e),"classOrder",jo.Collection),Ao(So(e),"closed",!1),Ao(So(e),"compareTerm",Go.prototype.compareTerm),Ao(So(e),"elements",[]),Ao(So(e),"isVar",0),t&&t.length>0&&t.forEach((function(t){e.elements.push(hs(t))})),e}return bo(r,[{key:"id",get:function(){return this.value},set:function(t){this.value=t}},{key:"append",value:function(t){return this.elements.push(t)}},{key:"close",value:function(){return this.closed=!0,this.closed}},{key:"shift",value:function(){return this.elements.shift()}},{key:"substitute",value:function(t){return new r(this.elements.map((function(e){return e.substitute(t)})))}},{key:"toNT",value:function(){return r.toNT(this)}},{key:"toString",value:function(){return"("+this.elements.join(" ")+")"}},{key:"unshift",value:function(t){return this.elements.unshift(t)}}],[{key:"toNT",value:function(t){return Go.NTAnonymousNodePrefix+t.id}}]),r}();function ls(t){return function(...e){var n=e.pop();return t.call(this,e,n)}}Ao(fs,"termType",Po);var ds="function"==typeof queueMicrotask&&queueMicrotask,vs="function"==typeof setImmediate&&setImmediate,ps="object"==typeof process&&"function"==typeof process.nextTick;function ws(t){setTimeout(t,0)}function ys(t){return(e,...n)=>t((()=>e(...n)))}var ms=ys(ds?queueMicrotask:vs?setImmediate:ps?process.nextTick:ws);function gs(t){return Ss(t)?function(...e){const n=e.pop();return bs(t.apply(this,e),n)}:ls((function(e,n){var r;try{r=t.apply(this,e)}catch(t){return n(t)}if(r&&"function"==typeof r.then)return bs(r,n);n(null,r)}))}function bs(t,e){return t.then((t=>{Es(e,null,t)}),(t=>{Es(e,t&&t.message?t:new Error(t))}))}function Es(t,e,n){try{t(e,n)}catch(t){ms((t=>{throw t}),t)}}function Ss(t){return"AsyncFunction"===t[Symbol.toStringTag]}function Fs(t){if("function"!=typeof t)throw new Error("expected a function");return Ss(t)?gs(t):t}function ks(t,e=t.length){if(!e)throw new Error("arity is undefined");return function(...n){return"function"==typeof n[e-1]?t.apply(this,n):new Promise(((r,i)=>{n[e-1]=(t,...e)=>{if(t)return i(t);r(e.length>1?e:e[0])},t.apply(this,n)}))}}function xs(t){return function(e,...n){return ks((function(r){var i=this;return t(e,((t,e)=>{Fs(t).apply(i,n.concat(e))}),r)}))}}function _s(t,e,n,r){e=e||[];var i=[],o=0,s=Fs(n);return t(e,((t,e,n)=>{var r=o++;s(t,((t,e)=>{i[r]=e,n(t)}))}),(t=>{r(t,i)}))}function As(t){return t&&"number"==typeof t.length&&t.length>=0&&t.length%1==0}var js={};function Cs(t){function e(...e){if(null!==t){var n=t;t=null,n.apply(this,e)}}return Object.assign(e,t),e}function Rs(t){return function(...e){if(null===t)throw new Error("Callback was already called.");var n=t;t=null,n.apply(this,e)}}function Ts(t,e,n,r){let i=!1,o=!1,s=!1,a=0,u=0;function c(){a>=e||s||i||(s=!0,t.next().then((({value:t,done:e})=>{if(!o&&!i){if(s=!1,e)return i=!0,void(a<=0&&r(null));a++,n(t,u,h),u++,c()}})).catch(f))}function h(t,e){if(a-=1,!o)return t?f(t):!1===t?(i=!0,void(o=!0)):e===js||i&&a<=0?(i=!0,r(null)):void c()}function f(t){o||(s=!1,i=!0,r(t))}c()}var Is=t=>(e,n,r)=>{if(r=Cs(r),t<=0)throw new RangeError("concurrency limit cannot be less than 1");if(!e)return r(null);if("AsyncGenerator"===e[Symbol.toStringTag])return Ts(e,t,n,r);if(function(t){return"function"==typeof t[Symbol.asyncIterator]}(e))return Ts(e[Symbol.asyncIterator](),t,n,r);var i=function(t){if(As(t))return function(t){var e=-1,n=t.length;return function(){return++e<n?{value:t[e],key:e}:null}}(t);var e,n,r,i,o=function(t){return t[Symbol.iterator]&&t[Symbol.iterator]()}(t);return o?function(t){var e=-1;return function(){var n=t.next();return n.done?null:(e++,{value:n.value,key:e})}}(o):(n=(e=t)?Object.keys(e):[],r=-1,i=n.length,function t(){var o=n[++r];return"__proto__"===o?t():r<i?{value:e[o],key:o}:null})}(e),o=!1,s=!1,a=0,u=!1;function c(t,e){if(!s)if(a-=1,t)o=!0,r(t);else if(!1===t)o=!0,s=!0;else{if(e===js||o&&a<=0)return o=!0,r(null);u||h()}}function h(){for(u=!0;a<t&&!o;){var e=i();if(null===e)return o=!0,void(a<=0&&r(null));a+=1,n(e.value,e.key,Rs(c))}u=!1}h()},Os=ks((function(t,e,n,r){return Is(e)(t,Fs(n),r)}),4);function Ns(t,e,n){n=Cs(n);var r=0,i=0,{length:o}=t,s=!1;function a(t,e){!1===t&&(s=!0),!0!==s&&(t?n(t):++i!==o&&e!==js||n(null))}for(0===o&&n(null);r<o;r++)e(t[r],r,Rs(a))}function Ps(t,e,n){return Os(t,1/0,e,n)}var Ds=ks((function(t,e,n){return(As(t)?Ns:Ps)(t,Fs(e),n)}),3),Ms=ks((function(t,e,n){return _s(Ds,t,e,n)}),3),Us=xs(Ms),Ls=ks((function(t,e,n){return Os(t,1,e,n)}),3),Bs=ks((function(t,e,n){return _s(Ls,t,e,n)}),3),Js=xs(Bs),Ks=Symbol("promiseCallback");function Hs(){let t,e;function n(n,...r){if(n)return e(n);t(r.length>1?r:r[0])}return n[Ks]=new Promise(((n,r)=>{t=n,e=r})),n}function $s(t,e,n){"number"!=typeof e&&(n=e,e=null),n=Cs(n||Hs());var r=Object.keys(t).length;if(!r)return n(null);e||(e=r);var i={},o=0,s=!1,a=!1,u=Object.create(null),c=[],h=[],f={};function l(t,e){c.push((()=>function(t,e){if(!a){var r=Rs(((e,...r)=>{if(o--,!1!==e)if(r.length<2&&([r]=r),e){var c={};if(Object.keys(i).forEach((t=>{c[t]=i[t]})),c[t]=r,a=!0,u=Object.create(null),s)return;n(e,c)}else i[t]=r,(u[t]||[]).forEach((t=>t())),d();else s=!0}));o++;var c=Fs(e[e.length-1]);e.length>1?c(i,r):c(r)}}(t,e)))}function d(){if(!s){if(0===c.length&&0===o)return n(null,i);for(;c.length&&o<e;)c.shift()()}}function v(e){var n=[];return Object.keys(t).forEach((r=>{const i=t[r];Array.isArray(i)&&i.indexOf(e)>=0&&n.push(r)})),n}return Object.keys(t).forEach((e=>{var n=t[e];if(!Array.isArray(n))return l(e,[n]),void h.push(e);var r=n.slice(0,n.length-1),i=r.length;if(0===i)return l(e,n),void h.push(e);f[e]=i,r.forEach((o=>{if(!t[o])throw new Error("async.auto task `"+e+"` has a non-existent dependency `"+o+"` in "+r.join(", "));var s,a;(a=u[s=o])||(a=u[s]=[]),a.push((()=>{0==--i&&l(e,n)}))}))})),function(){for(var t=0;h.length;)t++,v(h.pop()).forEach((t=>{0==--f[t]&&h.push(t)}));if(t!==r)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),d(),n[Ks]}var Ws=/^(?:async\s+)?(?:function)?\s*\w*\s*\(\s*([^)]+)\s*\)(?:\s*{)/,qs=/^(?:async\s+)?\(?\s*([^)=]+)\s*\)?(?:\s*=>)/,Vs=/,/,Gs=/(=.+)?(\s*)$/,zs=class{constructor(){this.head=this.tail=null,this.length=0}removeLink(t){return t.prev?t.prev.next=t.next:this.head=t.next,t.next?t.next.prev=t.prev:this.tail=t.prev,t.prev=t.next=null,this.length-=1,t}empty(){for(;this.head;)this.shift();return this}insertAfter(t,e){e.prev=t,e.next=t.next,t.next?t.next.prev=e:this.tail=e,t.next=e,this.length+=1}insertBefore(t,e){e.prev=t.prev,e.next=t,t.prev?t.prev.next=e:this.head=e,t.prev=e,this.length+=1}unshift(t){this.head?this.insertBefore(this.head,t):Xs(this,t)}push(t){this.tail?this.insertAfter(this.tail,t):Xs(this,t)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){for(var t=this.head;t;)yield t.data,t=t.next}remove(t){for(var e=this.head;e;){var{next:n}=e;t(e)&&this.removeLink(e),e=n}return this}};function Xs(t,e){t.length=1,t.head=t.tail=e}function Ys(t,e,n){if(null==e)e=1;else if(0===e)throw new RangeError("Concurrency must not be zero");var r=Fs(t),i=0,o=[];const s={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function a(t,e){return t?e?void(s[t]=s[t].filter((t=>t!==e))):s[t]=[]:Object.keys(s).forEach((t=>s[t]=[]))}function u(t,...e){s[t].forEach((t=>t(...e)))}var c=!1;function h(t,e,n,r){if(null!=r&&"function"!=typeof r)throw new Error("task callback must be a function");var i,o;function s(t,...e){return t?n?o(t):i():e.length<=1?i(e[0]):void i(e)}p.started=!0;var a=p._createTaskItem(t,n?s:r||s);if(e?p._tasks.unshift(a):p._tasks.push(a),c||(c=!0,ms((()=>{c=!1,p.process()}))),n||!r)return new Promise(((t,e)=>{i=t,o=e}))}function f(t){return function(e,...n){i-=1;for(var r=0,s=t.length;r<s;r++){var a=t[r],c=o.indexOf(a);0===c?o.shift():c>0&&o.splice(c,1),a.callback(e,...n),null!=e&&u("error",e,a.data)}i<=p.concurrency-p.buffer&&u("unsaturated"),p.idle()&&u("drain"),p.process()}}function l(t){return!(0!==t.length||!p.idle()||(ms((()=>u("drain"))),0))}const d=t=>e=>{if(!e)return new Promise(((e,n)=>{!function(t){const r=(...i)=>{a(t,r),((t,r)=>{if(t)return n(t);e(r)})(...i)};s[t].push(r)}(t)}));a(t),function(t,e){s[t].push(e)}(t,e)};var v=!1,p={_tasks:new zs,_createTaskItem:(t,e)=>({data:t,callback:e}),*[Symbol.iterator](){yield*p._tasks[Symbol.iterator]()},concurrency:e,payload:n,buffer:e/4,started:!1,paused:!1,push(t,e){if(Array.isArray(t)){if(l(t))return;return t.map((t=>h(t,!1,!1,e)))}return h(t,!1,!1,e)},pushAsync(t,e){if(Array.isArray(t)){if(l(t))return;return t.map((t=>h(t,!1,!0,e)))}return h(t,!1,!0,e)},kill(){a(),p._tasks.empty()},unshift(t,e){if(Array.isArray(t)){if(l(t))return;return t.map((t=>h(t,!0,!1,e)))}return h(t,!0,!1,e)},unshiftAsync(t,e){if(Array.isArray(t)){if(l(t))return;return t.map((t=>h(t,!0,!0,e)))}return h(t,!0,!0,e)},remove(t){p._tasks.remove(t)},process(){if(!v){for(v=!0;!p.paused&&i<p.concurrency&&p._tasks.length;){var t=[],e=[],n=p._tasks.length;p.payload&&(n=Math.min(n,p.payload));for(var s=0;s<n;s++){var a=p._tasks.shift();t.push(a),o.push(a),e.push(a.data)}i+=1,0===p._tasks.length&&u("empty"),i===p.concurrency&&u("saturated");var c=Rs(f(t));r(e,c)}v=!1}},length:()=>p._tasks.length,running:()=>i,workersList:()=>o,idle:()=>p._tasks.length+i===0,pause(){p.paused=!0},resume(){!1!==p.paused&&(p.paused=!1,ms(p.process))}};return Object.defineProperties(p,{saturated:{writable:!1,value:d("saturated")},unsaturated:{writable:!1,value:d("unsaturated")},empty:{writable:!1,value:d("empty")},drain:{writable:!1,value:d("drain")},error:{writable:!1,value:d("error")}}),p}var Qs=ks((function(t,e,n,r){r=Cs(r);var i=Fs(n);return Ls(t,((t,n,r)=>{i(e,t,((t,n)=>{e=n,r(t)}))}),(t=>r(t,e)))}),4);function Zs(...t){var e=t.map(Fs);return function(...t){var n=this,r=t[t.length-1];return"function"==typeof r?t.pop():r=Hs(),Qs(e,t,((t,e,r)=>{e.apply(n,t.concat(((t,...e)=>{r(t,e)})))}),((t,e)=>r(t,...e))),r[Ks]}}var ta=ks((function(t,e,n,r){return _s(Is(e),t,n,r)}),4),ea=ks((function(t,e,n,r){var i=Fs(n);return ta(t,e,((t,e)=>{i(t,((t,...n)=>t?e(t):e(t,n)))}),((t,e)=>{for(var n=[],i=0;i<e.length;i++)e[i]&&(n=n.concat(...e[i]));return r(t,n)}))}),4),na=ks((function(t,e,n){return ea(t,1/0,e,n)}),3),ra=ks((function(t,e,n){return ea(t,1,e,n)}),3);function ia(t,e){return(n,r,i,o)=>{var s,a=!1;const u=Fs(i);n(r,((n,r,i)=>{u(n,((r,o)=>r||!1===r?i(r):t(o)&&!s?(a=!0,s=e(!0,n),i(null,js)):void i()))}),(t=>{if(t)return o(t);o(null,a?s:e(!1))}))}}var oa=ks((function(t,e,n){return ia((t=>t),((t,e)=>e))(Ds,t,e,n)}),3),sa=ks((function(t,e,n,r){return ia((t=>t),((t,e)=>e))(Is(e),t,n,r)}),4),aa=ks((function(t,e,n){return ia((t=>t),((t,e)=>e))(Is(1),t,e,n)}),3);function ua(t){return(e,...n)=>Fs(e)(...n,((e,...n)=>{"object"==typeof console&&(e?console.error&&console.error(e):console[t]&&n.forEach((e=>console[t](e))))}))}var ca=ua("dir"),ha=ks((function(t,e,n){n=Rs(n);var r,i=Fs(t),o=Fs(e);function s(t,...e){if(t)return n(t);!1!==t&&(r=e,o(...e,a))}function a(t,e){return t?n(t):!1!==t?e?void i(s):n(null,...r):void 0}return a(null,!0)}),3);function fa(t){return(e,n,r)=>t(e,r)}var la=ks((function(t,e,n){return Ds(t,fa(Fs(e)),n)}),3),da=ks((function(t,e,n,r){return Is(e)(t,fa(Fs(n)),r)}),4),va=ks((function(t,e,n){return da(t,1,e,n)}),3);function pa(t){return Ss(t)?t:function(...e){var n=e.pop(),r=!0;e.push(((...t)=>{r?ms((()=>n(...t))):n(...t)})),t.apply(this,e),r=!1}}var wa=ks((function(t,e,n){return ia((t=>!t),(t=>!t))(Ds,t,e,n)}),3),ya=ks((function(t,e,n,r){return ia((t=>!t),(t=>!t))(Is(e),t,n,r)}),4),ma=ks((function(t,e,n){return ia((t=>!t),(t=>!t))(Ls,t,e,n)}),3);function ga(t,e,n,r){var i=new Array(e.length);t(e,((t,e,r)=>{n(t,((t,n)=>{i[e]=!!n,r(t)}))}),(t=>{if(t)return r(t);for(var n=[],o=0;o<e.length;o++)i[o]&&n.push(e[o]);r(null,n)}))}function ba(t,e,n,r){var i=[];t(e,((t,e,r)=>{n(t,((n,o)=>{if(n)return r(n);o&&i.push({index:e,value:t}),r(n)}))}),(t=>{if(t)return r(t);r(null,i.sort(((t,e)=>t.index-e.index)).map((t=>t.value)))}))}function Ea(t,e,n,r){return(As(e)?ga:ba)(t,e,Fs(n),r)}var Sa=ks((function(t,e,n){return Ea(Ds,t,e,n)}),3),Fa=ks((function(t,e,n,r){return Ea(Is(e),t,n,r)}),4),ka=ks((function(t,e,n){return Ea(Ls,t,e,n)}),3),xa=ks((function(t,e){var n=Rs(e),r=Fs(pa(t));return function t(e){if(e)return n(e);!1!==e&&r(t)}()}),2),_a=ks((function(t,e,n,r){var i=Fs(n);return ta(t,e,((t,e)=>{i(t,((n,r)=>n?e(n):e(n,{key:r,val:t})))}),((t,e)=>{for(var n={},{hasOwnProperty:i}=Object.prototype,o=0;o<e.length;o++)if(e[o]){var{key:s}=e[o],{val:a}=e[o];i.call(n,s)?n[s].push(a):n[s]=[a]}return r(t,n)}))}),4),Aa=ua("log"),ja=ks((function(t,e,n,r){r=Cs(r);var i={},o=Fs(n);return Is(e)(t,((t,e,n)=>{o(t,e,((t,r)=>{if(t)return n(t);i[e]=r,n(t)}))}),(t=>r(t,i)))}),4),Ca=ys(ps?process.nextTick:vs?setImmediate:ws),Ra=ks(((t,e,n)=>{var r=As(e)?[]:{};t(e,((t,e,n)=>{Fs(t)(((t,...i)=>{i.length<2&&([i]=i),r[e]=i,n(t)}))}),(t=>n(t,r)))}),3);function Ta(t,e){var n=Fs(t);return Ys(((t,e)=>{n(t[0],e)}),e,1)}var Ia=class{constructor(){this.heap=[],this.pushCount=Number.MIN_SAFE_INTEGER}get length(){return this.heap.length}empty(){return this.heap=[],this}percUp(t){let e;for(;t>0&&Na(this.heap[t],this.heap[e=Oa(t)]);){let n=this.heap[t];this.heap[t]=this.heap[e],this.heap[e]=n,t=e}}percDown(t){let e;for(;(e=1+(t<<1))<this.heap.length&&(e+1<this.heap.length&&Na(this.heap[e+1],this.heap[e])&&(e+=1),!Na(this.heap[t],this.heap[e]));){let n=this.heap[t];this.heap[t]=this.heap[e],this.heap[e]=n,t=e}}push(t){t.pushCount=++this.pushCount,this.heap.push(t),this.percUp(this.heap.length-1)}unshift(t){return this.heap.push(t)}shift(){let[t]=this.heap;return this.heap[0]=this.heap[this.heap.length-1],this.heap.pop(),this.percDown(0),t}toArray(){return[...this]}*[Symbol.iterator](){for(let t=0;t<this.heap.length;t++)yield this.heap[t].data}remove(t){let e=0;for(let n=0;n<this.heap.length;n++)t(this.heap[n])||(this.heap[e]=this.heap[n],e++);this.heap.splice(e);for(let t=Oa(this.heap.length-1);t>=0;t--)this.percDown(t);return this}};function Oa(t){return(t+1>>1)-1}function Na(t,e){return t.priority!==e.priority?t.priority<e.priority:t.pushCount<e.pushCount}var Pa=ks((function(t,e){if(e=Cs(e),!Array.isArray(t))return e(new TypeError("First argument to race must be an array of functions"));if(!t.length)return e();for(var n=0,r=t.length;n<r;n++)Fs(t[n])(e)}),2);function Da(t,e,n,r){var i=[...t].reverse();return Qs(i,e,n,r)}function Ma(t){var e=Fs(t);return ls((function(t,n){return t.push(((t,...e)=>{let r={};if(t&&(r.error=t),e.length>0){var i=e;e.length<=1&&([i]=e),r.value=i}n(null,r)})),e.apply(this,t)}))}function Ua(t,e,n,r){const i=Fs(n);return Ea(t,e,((t,e)=>{i(t,((t,n)=>{e(t,!n)}))}),r)}var La=ks((function(t,e,n){return Ua(Ds,t,e,n)}),3),Ba=ks((function(t,e,n,r){return Ua(Is(e),t,n,r)}),4),Ja=ks((function(t,e,n){return Ua(Ls,t,e,n)}),3);function Ka(t){return function(){return t}}function Ha(t,e,n){var r={times:5,intervalFunc:Ka(0)};if(arguments.length<3&&"function"==typeof t?(n=e||Hs(),e=t):($a(r,t),n=n||Hs()),"function"!=typeof e)throw new Error("Invalid arguments for async.retry");var i=Fs(e),o=1;function s(){i(((t,...e)=>{!1!==t&&(t&&o++<r.times&&("function"!=typeof r.errorFilter||r.errorFilter(t))?setTimeout(s,r.intervalFunc(o-1)):n(t,...e))}))}return s(),n[Ks]}function $a(t,e){if("object"==typeof e)t.times=+e.times||5,t.intervalFunc="function"==typeof e.interval?e.interval:Ka(+e.interval||0),t.errorFilter=e.errorFilter;else{if("number"!=typeof e&&"string"!=typeof e)throw new Error("Invalid arguments for async.retry");t.times=+e||5}}var Wa=ks((function(t,e,n){return ia(Boolean,(t=>t))(Ds,t,e,n)}),3),qa=ks((function(t,e,n,r){return ia(Boolean,(t=>t))(Is(e),t,n,r)}),4),Va=ks((function(t,e,n){return ia(Boolean,(t=>t))(Ls,t,e,n)}),3),Ga=ks((function(t,e,n){var r=Fs(e);return Ms(t,((t,e)=>{r(t,((n,r)=>{if(n)return e(n);e(n,{value:t,criteria:r})}))}),((t,e)=>{if(t)return n(t);n(null,e.sort(i).map((t=>t.value)))}));function i(t,e){var n=t.criteria,r=e.criteria;return n<r?-1:n>r?1:0}}),3);function za(t,e,n,r){var i=Fs(n);return ta(function(t){for(var e=Array(t);t--;)e[t]=t;return e}(t),e,i,r)}var Xa,Ya=ks((function(t,e){var n,r=null;return va(t,((t,e)=>{Fs(t)(((t,...i)=>{if(!1===t)return e(t);i.length<2?[n]=i:n=i,r=t,e(t?null:{})}))}),(()=>e(r,n)))})),Qa=ks((function(t,e,n){n=Rs(n);var r=Fs(e),i=Fs(t),o=[];function s(t,...e){if(t)return n(t);o=e,!1!==t&&i(a)}function a(t,e){return t?n(t):!1!==t?e?void r(s):n(null,...o):void 0}return i(a)}),3),Za=ks((function(t,e){if(e=Cs(e),!Array.isArray(t))return e(new Error("First argument to waterfall must be an array of functions"));if(!t.length)return e();var n=0;function r(e){Fs(t[n++])(...e,Rs(i))}function i(i,...o){if(!1!==i)return i||n===t.length?e(i,...o):void r(o)}r([])})),tu={apply:function(t,...e){return(...n)=>t(...e,...n)},applyEach:Us,applyEachSeries:Js,asyncify:gs,auto:$s,autoInject:function(t,e){var n={};return Object.keys(t).forEach((e=>{var r,i=t[e],o=Ss(i),s=!o&&1===i.length||o&&0===i.length;if(Array.isArray(i))r=[...i],i=r.pop(),n[e]=r.concat(r.length>0?a:i);else if(s)n[e]=i;else{if(r=function(t){const e=function(t){let e="",n=0,r=t.indexOf("*/");for(;n<t.length;)if("/"===t[n]&&"/"===t[n+1]){let e=t.indexOf("\n",n);n=-1===e?t.length:e}else if(-1!==r&&"/"===t[n]&&"*"===t[n+1]){let i=t.indexOf("*/",n);-1!==i?(n=i+2,r=t.indexOf("*/",n)):(e+=t[n],n++)}else e+=t[n],n++;return e}(t.toString());let n=e.match(Ws);if(n||(n=e.match(qs)),!n)throw new Error("could not parse args in autoInject\nSource:\n"+e);let[,r]=n;return r.replace(/\s/g,"").split(Vs).map((t=>t.replace(Gs,"").trim()))}(i),0===i.length&&!o&&0===r.length)throw new Error("autoInject task functions require explicit parameters.");o||r.pop(),n[e]=r.concat(a)}function a(t,e){var n=r.map((e=>t[e]));n.push(e),Fs(i)(...n)}})),$s(n,e)},cargo:function(t,e){return Ys(t,1,e)},cargoQueue:function(t,e,n){return Ys(t,e,n)},compose:function(...t){return Zs(...t.reverse())},concat:na,concatLimit:ea,concatSeries:ra,constant:function(...t){return function(...e){return e.pop()(null,...t)}},detect:oa,detectLimit:sa,detectSeries:aa,dir:ca,doUntil:function(t,e,n){const r=Fs(e);return ha(t,((...t)=>{const e=t.pop();r(...t,((t,n)=>e(t,!n)))}),n)},doWhilst:ha,each:la,eachLimit:da,eachOf:Ds,eachOfLimit:Os,eachOfSeries:Ls,eachSeries:va,ensureAsync:pa,every:wa,everyLimit:ya,everySeries:ma,filter:Sa,filterLimit:Fa,filterSeries:ka,forever:xa,groupBy:function(t,e,n){return _a(t,1/0,e,n)},groupByLimit:_a,groupBySeries:function(t,e,n){return _a(t,1,e,n)},log:Aa,map:Ms,mapLimit:ta,mapSeries:Bs,mapValues:function(t,e,n){return ja(t,1/0,e,n)},mapValuesLimit:ja,mapValuesSeries:function(t,e,n){return ja(t,1,e,n)},memoize:function(t,e=(t=>t)){var n=Object.create(null),r=Object.create(null),i=Fs(t),o=ls(((t,o)=>{var s=e(...t);s in n?ms((()=>o(null,...n[s]))):s in r?r[s].push(o):(r[s]=[o],i(...t,((t,...e)=>{t||(n[s]=e);var i=r[s];delete r[s];for(var o=0,a=i.length;o<a;o++)i[o](t,...e)})))}));return o.memo=n,o.unmemoized=t,o},nextTick:Ca,parallel:function(t,e){return Ra(Ds,t,e)},parallelLimit:function(t,e,n){return Ra(Is(e),t,n)},priorityQueue:function(t,e){var n=Ta(t,e),{push:r,pushAsync:i}=n;function o(t,e){return Array.isArray(t)?t.map((t=>({data:t,priority:e}))):{data:t,priority:e}}return n._tasks=new Ia,n._createTaskItem=({data:t,priority:e},n)=>({data:t,priority:e,callback:n}),n.push=function(t,e=0,n){return r(o(t,e),n)},n.pushAsync=function(t,e=0,n){return i(o(t,e),n)},delete n.unshift,delete n.unshiftAsync,n},queue:Ta,race:Pa,reduce:Qs,reduceRight:Da,reflect:Ma,reflectAll:function(t){var e;return Array.isArray(t)?e=t.map(Ma):(e={},Object.keys(t).forEach((n=>{e[n]=Ma.call(this,t[n])}))),e},reject:La,rejectLimit:Ba,rejectSeries:Ja,retry:Ha,retryable:function(t,e){e||(e=t,t=null);let n=t&&t.arity||e.length;Ss(e)&&(n+=1);var r=Fs(e);return ls(((e,i)=>{function o(t){r(...e,t)}return(e.length<n-1||null==i)&&(e.push(i),i=Hs()),t?Ha(t,o,i):Ha(o,i),i[Ks]}))},seq:Zs,series:function(t,e){return Ra(Ls,t,e)},setImmediate:ms,some:Wa,someLimit:qa,someSeries:Va,sortBy:Ga,timeout:function(t,e,n){var r=Fs(t);return ls(((i,o)=>{var s,a=!1;i.push(((...t)=>{a||(o(...t),clearTimeout(s))})),s=setTimeout((function(){var e=new Error('Callback function "'+(t.name||"anonymous")+'" timed out.');e.code="ETIMEDOUT",n&&(e.info=n),a=!0,o(e)}),e),r(...i)}))},times:function(t,e,n){return za(t,1/0,e,n)},timesLimit:za,timesSeries:function(t,e,n){return za(t,1,e,n)},transform:function(t,e,n,r){arguments.length<=3&&"function"==typeof e&&(r=n,n=e,e=Array.isArray(t)?[]:{}),r=Cs(r||Hs());var i=Fs(n);return Ds(t,((t,n,r)=>{i(e,t,n,r)}),(t=>r(t,e))),r[Ks]},tryEach:Ya,unmemoize:function(t){return(...e)=>(t.unmemoized||t)(...e)},until:function(t,e,n){const r=Fs(t);return Qa((t=>r(((e,n)=>t(e,!n)))),e,n)},waterfall:Za,whilst:Qa,all:wa,allLimit:ya,allSeries:ma,any:Wa,anyLimit:qa,anySeries:Va,find:oa,findLimit:sa,findSeries:aa,flatMap:na,flatMapLimit:ea,flatMapSeries:ra,forEach:la,forEachSeries:va,forEachLimit:da,forEachOf:Ds,forEachOfSeries:Ls,forEachOfLimit:Os,inject:Qs,foldl:Qs,foldr:Da,select:Sa,selectLimit:Fa,selectSeries:ka,wrapSync:gs,during:Qa,doDuring:ha},eu=tu,nu=F(ro()),ru="http://www.w3.org/1999/02/22-rdf-syntax-ns#",iu="http://www.w3.org/2001/XMLSchema#",ou="http://www.w3.org/2000/10/swap/",su={xsd:{decimal:`${iu}decimal`,boolean:`${iu}boolean`,double:`${iu}double`,integer:`${iu}integer`,string:`${iu}string`},rdf:{type:`${ru}type`,nil:`${ru}nil`,first:`${ru}first`,rest:`${ru}rest`,langString:`${ru}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${ou}reify#forSome`,forAll:`${ou}reify#forAll`},log:{implies:`${ou}log#implies`}},au=F(io()),{xsd:uu}=su,cu=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,hu={"\\":"\\","'":"'",'"':'"',n:"\n",r:"\r",t:"\t",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},fu=/[\x00-\x20<>\\"\{\}\|\^\`]/,lu={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},du=/$0^/,{rdf:vu,xsd:pu}=su,wu=0,yu={namedNode:function(t){return new bu(t)},blankNode:function(t){return new Su(t||"n3-"+wu++)},variable:function(t){return new Fu(t)},literal:function(t,e){if("string"==typeof e)return new Eu(`"${t}"@${e.toLowerCase()}`);let n=e?e.value:"";return""===n&&("boolean"==typeof t?n=pu.boolean:"number"==typeof t&&(Number.isFinite(t)?n=Number.isInteger(t)?pu.integer:pu.double:(n=pu.double,Number.isNaN(t)||(t=t>0?"INF":"-INF")))),new Eu(""===n||n===pu.string?`"${t}"`:`"${t}"^^${n}`)},defaultGraph:function(){return Xa},quad:xu,triple:xu},mu=yu,gu=class{constructor(t){this.id=t}get value(){return this.id}equals(t){return t instanceof gu?this.id===t.id:!!t&&this.termType===t.termType&&this.value===t.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}},bu=class extends gu{get termType(){return"NamedNode"}},Eu=class extends gu{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){const t=this.id;let e=t.lastIndexOf('"')+1;return e<t.length&&"@"===t[e++]?t.substr(e).toLowerCase():""}get datatype(){return new bu(this.datatypeString)}get datatypeString(){const t=this.id,e=t.lastIndexOf('"')+1,n=e<t.length?t[e]:"";return"^"===n?t.substr(e+2):"@"!==n?pu.string:vu.langString}equals(t){return t instanceof Eu?this.id===t.id:!!t&&!!t.datatype&&this.termType===t.termType&&this.value===t.value&&this.language===t.language&&this.datatype.value===t.datatype.value}toJSON(){return{termType:this.termType,value:this.value,language:this.language,datatype:{termType:"NamedNode",value:this.datatypeString}}}},Su=class extends gu{constructor(t){super(`_:${t}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},Fu=class extends gu{constructor(t){super(`?${t}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}};Xa=new class extends gu{constructor(){return super(""),Xa||this}get termType(){return"DefaultGraph"}equals(t){return this===t||!!t&&this.termType===t.termType}};var ku=class extends gu{constructor(t,e,n,r){super(""),this._subject=t,this._predicate=e,this._object=n,this._graph=r||Xa}get termType(){return"Quad"}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}get graph(){return this._graph}toJSON(){return{termType:this.termType,subject:this._subject.toJSON(),predicate:this._predicate.toJSON(),object:this._object.toJSON(),graph:this._graph.toJSON()}}equals(t){return!!t&&this._subject.equals(t.subject)&&this._predicate.equals(t.predicate)&&this._object.equals(t.object)&&this._graph.equals(t.graph)}};function xu(t,e,n,r){return new ku(t,e,n,r)}var _u=0,Au=class{constructor(t){this._contextStack=[],this._graph=null,this._setBase((t=t||{}).baseIRI),t.factory&&Cu(this,t.factory);const e="string"==typeof t.format?t.format.match(/\w*$/)[0].toLowerCase():"",n=/turtle/.test(e),r=/trig/.test(e),i=/triple/.test(e),o=/quad/.test(e),s=this._n3Mode=/n3/.test(e),a=i||o;(this._supportsNamedGraphs=!(n||s))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(n||r||i||s),this._supportsRDFStar=""===e||/star|\*$/.test(e),a&&(this._resolveRelativeIRI=()=>null),this._blankNodePrefix="string"!=typeof t.blankNodePrefix?"":t.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=t.lexer||new class{constructor(t){if(this._iri=/^<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/,this._unescapedIri=/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/,this._simpleQuotedString=/^"([^"\\\r\n]*)"(?=[^"])/,this._simpleApostropheString=/^'([^'\\\r\n]*)'(?=[^'])/,this._langcode=/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i,this._prefix=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,this._prefixed=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/,this._variable=/^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._blank=/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/,this._number=/^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/,this._boolean=/^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/,this._keyword=/^@[a-z]+(?=[\s#<:])/i,this._sparqlKeyword=/^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i,this._shortPredicates=/^a(?=[\s#()\[\]\{\}"'<>])/,this._newline=/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,this._comment=/#([^\n\r]*)/,this._whitespace=/^[ \t]+/,this._endOfFile=/^(?:#[^\n\r]*)?$/,this._lineMode=!!(t=t||{}).lineMode){this._n3Mode=!1;for(const t in this)!(t in lu)&&this[t]instanceof RegExp&&(this[t]=du)}else this._n3Mode=!1!==t.n3;this._comments=!!t.comments,this._literalClosingPos=0}_tokenizeToEnd(t,e){let n=this._input,r=n.length;for(;;){let t,s;for(;t=this._newline.exec(n);)this._comments&&(s=this._comment.exec(t[0]))&&i("comment",s[1],"",this._line,t[0].length),n=n.substr(t[0].length,n.length),r=n.length,this._line++;if(!t&&(t=this._whitespace.exec(n))&&(n=n.substr(t[0].length,n.length)),this._endOfFile.test(n))return e&&(this._comments&&(s=this._comment.exec(n))&&i("comment",s[1],"",this._line,n.length),n=null,i("eof","","",this._line,0)),this._input=n;const a=this._line,u=n[0];let c="",h="",f="",l=null,d=0,v=!1;switch(u){case"^":if(n.length<3)break;if("^"!==n[1]){this._n3Mode&&(d=1,c="^");break}if(this._previousMarker="^^",n=n.substr(2),"<"!==n[0]){v=!0;break}case"<":if(l=this._unescapedIri.exec(n))c="IRI",h=l[1];else if(l=this._iri.exec(n)){if(h=this._unescape(l[1]),null===h||fu.test(h))return o(this);c="IRI"}else n.length>1&&"<"===n[1]?(c="<<",d=2):this._n3Mode&&n.length>1&&"="===n[1]&&(c="inverse",d=2,h=">");break;case">":n.length>1&&">"===n[1]&&(c=">>",d=2);break;case"_":((l=this._blank.exec(n))||e&&(l=this._blank.exec(`${n} `)))&&(c="blank",f="_",h=l[1]);break;case'"':if(l=this._simpleQuotedString.exec(n))h=l[1];else if(({value:h,matchLength:d}=this._parseLiteral(n)),null===h)return o(this);null===l&&0===d||(c="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(l=this._simpleApostropheString.exec(n))h=l[1];else if(({value:h,matchLength:d}=this._parseLiteral(n)),null===h)return o(this);null===l&&0===d||(c="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(l=this._variable.exec(n))&&(c="var",h=l[0]);break;case"@":"literal"===this._previousMarker&&(l=this._langcode.exec(n))?(c="langcode",h=l[1]):(l=this._keyword.exec(n))&&(c=l[0]);break;case".":if(1===n.length?e:n[1]<"0"||n[1]>"9"){c=".",d=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(l=this._number.exec(n)||e&&(l=this._number.exec(`${n} `)))&&(c="literal",h=l[0],f="string"==typeof l[1]?uu.double:"string"==typeof l[2]?uu.decimal:uu.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(l=this._sparqlKeyword.exec(n))?c=l[0].toUpperCase():v=!0;break;case"f":case"t":(l=this._boolean.exec(n))?(c="literal",h=l[0],f=uu.boolean):v=!0;break;case"a":(l=this._shortPredicates.exec(n))?(c="abbreviation",h="a"):v=!0;break;case"=":this._n3Mode&&n.length>1&&(c="abbreviation",">"!==n[1]?(d=1,h="="):(d=2,h=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"{":case"}":this._lineMode||(d=1,c=u);break;default:v=!0}if(v&&("@prefix"!==this._previousMarker&&"PREFIX"!==this._previousMarker||!(l=this._prefix.exec(n))?((l=this._prefixed.exec(n))||e&&(l=this._prefixed.exec(`${n} `)))&&(c="prefixed",f=l[1]||"",h=this._unescape(l[2])):(c="prefix",h=l[1]||"")),"^^"===this._previousMarker)switch(c){case"prefixed":c="type";break;case"IRI":c="typeIRI";break;default:c=""}if(!c)return e||!/^'''|^"""/.test(n)&&/\n|\r/.test(n)?o(this):this._input=n;const p=d||l[0].length,w=i(c,h,f,a,p);this.previousToken=w,this._previousMarker=c,n=n.substr(p,n.length)}function i(e,i,o,s,a){const u=n?r-n.length:r,c={type:e,value:i,prefix:o,line:s,start:u,end:u+a};return t(null,c),c}function o(e){t(e._syntaxError(/^\S*/.exec(n)[0]))}}_unescape(t){let e=!1;const n=t.replace(cu,((t,n,r,i)=>{if("string"==typeof n)return String.fromCharCode(Number.parseInt(n,16));if("string"==typeof r){let t=Number.parseInt(r,16);return t<=65535?String.fromCharCode(Number.parseInt(r,16)):String.fromCharCode(55296+((t-=65536)>>10),56320+(1023&t))}return i in hu?hu[i]:(e=!0,"")}));return e?null:n}_parseLiteral(t){if(t.length>=3){const e=t.match(/^(?:"""|"|'''|'|)/)[0],n=e.length;let r=Math.max(this._literalClosingPos,n);for(;(r=t.indexOf(e,r))>0;){let e=0;for(;"\\"===t[r-e-1];)e++;if(e%2==0){const e=t.substring(n,r),i=e.split(/\r\n|\r|\n/).length-1,o=r+n;if(1===n&&0!==i||3===n&&this._lineMode)break;return this._line+=i,{value:this._unescape(e),matchLength:o}}r++}this._literalClosingPos=t.length-n+1}return{value:"",matchLength:0}}_syntaxError(t){this._input=null;const e=new Error(`Unexpected "${t}" on line ${this._line}.`);return e.context={token:void 0,line:this._line,previousToken:this.previousToken},e}_readStartingBom(t){return t.startsWith("\ufeff")?t.substr(1):t}tokenize(t,e){if(this._line=1,"string"==typeof t){if(this._input=this._readStartingBom(t),"function"!=typeof e){const t=[];let e;if(this._tokenizeToEnd(((n,r)=>n?e=n:t.push(r)),!0),e)throw e;return t}(0,au.default)((()=>this._tokenizeToEnd(e,!0)))}else this._pendingBuffer=null,"function"==typeof t.setEncoding&&t.setEncoding("utf8"),t.on("data",(t=>{null!==this._input&&0!==t.length&&(this._pendingBuffer&&(t=Buffer.concat([this._pendingBuffer,t]),this._pendingBuffer=null),128&t[t.length-1]?this._pendingBuffer=t:(void 0===this._input?this._input=this._readStartingBom("string"==typeof t?t:t.toString()):this._input+=t,this._tokenizeToEnd(e,!1)))})),t.on("end",(()=>{"string"==typeof this._input&&this._tokenizeToEnd(e,!0)})),t.on("error",e)}}({lineMode:a,n3:s}),this._explicitQuantifiers=!!t.explicitQuantifiers}static _resetBlankNodePrefix(){_u=0}_setBase(t){if(t){const e=t.indexOf("#");e>=0&&(t=t.substr(0,e)),this._base=t,this._basePath=t.indexOf("/")<0?t:t.replace(/[^\/?]*(?:\?.*)?$/,""),t=t.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=t[0],this._baseScheme=t[1]}else this._base="",this._basePath=""}_saveContext(t,e,n,r,i){const o=this._n3Mode;this._contextStack.push({type:t,subject:n,predicate:r,object:i,graph:e,inverse:!!o&&this._inversePredicate,blankPrefix:o?this._prefixes._:"",quantified:o?this._quantified:null}),o&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.id.substr(2)}.`:".",this._quantified=Object.create(this._quantified))}_restoreContext(t,e){const n=this._contextStack.pop();if(!n||n.type!==t)return this._error(`Unexpected ${e.type}`,e);this._subject=n.subject,this._predicate=n.predicate,this._object=n.object,this._graph=n.graph,this._n3Mode&&(this._inversePredicate=n.inverse,this._prefixes._=n.blankPrefix,this._quantified=n.quantified)}_readInTopContext(t){switch(t.type){case"eof":return null!==this._graph?this._error("Unclosed graph",t):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;case"{":if(this._supportsNamedGraphs)return this._graph="",this._subject=null,this._readSubject;case"GRAPH":if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(t)}}_readEntity(t,e){let n;switch(t.type){case"IRI":case"typeIRI":const e=this._resolveIRI(t.value);if(null===e)return this._error("Invalid IRI",t);n=this._namedNode(e);break;case"type":case"prefixed":const r=this._prefixes[t.prefix];if(void 0===r)return this._error(`Undefined prefix "${t.prefix}:"`,t);n=this._namedNode(r+t.value);break;case"blank":n=this._blankNode(this._prefixes[t.prefix]+t.value);break;case"var":n=this._variable(t.value.substr(1));break;default:return this._error(`Expected entity but got ${t.type}`,t)}return!e&&this._n3Mode&&n.id in this._quantified&&(n=this._quantified[n.id]),n}_readSubject(t){switch(this._predicate=null,t.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._blankNode(),null,null),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this.RDF_NIL,null,null),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._blankNode(),null,null),this._readSubject):this._error("Unexpected graph",t);case"}":return this._readPunctuation(t);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier=this._blankNode,this._readQuantifierList):this._error('Unexpected "@forSome"',t);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier=this._variable,this._readQuantifierList):this._error('Unexpected "@forAll"',t);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",t);if(0===t.prefix.length)return this._literalValue=t.value,this._completeSubjectLiteral;this._subject=this._literal(t.value,this._namedNode(t.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF* syntax",t);default:if(void 0===(this._subject=this._readEntity(t)))return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(t){const e=t.type;switch(e){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[t.value];break;case".":case"]":case"}":return null===this._predicate?this._error(`Unexpected ${e}`,t):(this._subject=null,"]"===e?this._readBlankNodeTail(t):this._readPunctuation(t));case";":return null!==this._predicate?this._readPredicate:this._error("Expected predicate but got ;",t);case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",t);default:if(void 0===(this._predicate=this._readEntity(t)))return}return this._readObject}_readObject(t){switch(t.type){case"literal":if(0===t.prefix.length)return this._literalValue=t.value,this._readDataTypeOrLang;this._object=this._literal(t.value,this._namedNode(t.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._blankNode()),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this._subject,this._predicate,this.RDF_NIL),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._blankNode()),this._readSubject):this._error("Unexpected graph",t);case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error("Unexpected RDF* syntax",t);default:if(void 0===(this._object=this._readEntity(t)))return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(t){return"{"===t.type?this._readGraph(t):this._readPredicate(t)}_readGraph(t){return"{"!==t.type?this._error(`Expected graph but got ${t.type}`,t):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(t){return"]"===t.type?(this._subject=null,this._readBlankNodeTail(t)):(this._predicate=null,this._readPredicate(t))}_readBlankNodeTail(t){if("]"!==t.type)return this._readBlankNodePunctuation(t);null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph);const e=null===this._predicate;return this._restoreContext("blank",t),null!==this._object?this._getContextEndReader():null!==this._predicate?this._readObject:e?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(t){switch(t.type){case".":case"}":return this._subject=null,this._readPunctuation(t);default:return this._readPredicate(t)}}_readListItem(t){let e=null,n=null,r=this._readListItem;const i=this._subject,o=this._contextStack,s=o[o.length-1];switch(t.type){case"[":this._saveContext("blank",this._graph,n=this._blankNode(),this.RDF_FIRST,this._subject=e=this._blankNode()),r=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,n=this._blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",t),0!==o.length&&"list"===o[o.length-1].type&&this._emit(this._subject,this._predicate,this._object,this._graph),null===this._predicate){if(r=this._readPredicate,this._subject===this.RDF_NIL)return r}else if(r=this._getContextEndReader(),this._object===this.RDF_NIL)return r;n=this.RDF_NIL;break;case"literal":0===t.prefix.length?(this._literalValue=t.value,r=this._readListItemDataTypeOrLang):(e=this._literal(t.value,this._namedNode(t.prefix)),r=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._blankNode()),this._readSubject):this._error("Unexpected graph",t);default:if(void 0===(e=this._readEntity(t)))return}if(null===n&&(this._subject=n=this._blankNode()),null===i?null===s.predicate?s.subject=n:s.object=n:this._emit(i,this.RDF_REST,n,this._graph),null!==e){if(this._n3Mode&&("IRI"===t.type||"prefixed"===t.type))return this._saveContext("item",this._graph,n,this.RDF_FIRST,e),this._subject=e,this._predicate=null,this._getPathReader(this._readListItem);this._emit(n,this.RDF_FIRST,e,this._graph)}return r}_readDataTypeOrLang(t){return this._completeObjectLiteral(t,!1)}_readListItemDataTypeOrLang(t){return this._completeObjectLiteral(t,!0)}_completeLiteral(t){let e=this._literal(this._literalValue);switch(t.type){case"type":case"typeIRI":const n=this._readEntity(t);if(void 0===n)return;e=this._literal(this._literalValue,n),t=null;break;case"langcode":e=this._literal(this._literalValue,t.value),t=null}return{token:t,literal:e}}_completeSubjectLiteral(t){return this._subject=this._completeLiteral(t).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(t,e){const n=this._completeLiteral(t);if(n)return this._object=n.literal,e&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),null===n.token?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(n.token))}_readFormulaTail(t){return"}"!==t.type?this._readPunctuation(t):(null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",t),null===this._object?this._readPredicate:this._getContextEndReader())}_readPunctuation(t){let e,n=this._graph;const r=this._subject,i=this._inversePredicate;switch(t.type){case"}":if(null===this._graph)return this._error("Unexpected graph closing",t);if(this._n3Mode)return this._readFormulaTail(t);this._graph=null;case".":this._subject=null,e=this._contextStack.length?this._readSubject:this._readInTopContext,i&&(this._inversePredicate=!1);break;case";":e=this._readPredicate;break;case",":e=this._readObject;break;default:if(this._supportsQuads&&null===this._graph&&void 0!==(n=this._readEntity(t))){e=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,t)}if(null!==r){const t=this._predicate,e=this._object;i?this._emit(e,t,r,n):this._emit(r,t,e,n)}return e}_readBlankNodePunctuation(t){let e;switch(t.type){case";":e=this._readPredicate;break;case",":e=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,t)}return this._emit(this._subject,this._predicate,this._object,this._graph),e}_readQuadPunctuation(t){return"."!==t.type?this._error("Expected dot to follow quad",t):this._readInTopContext}_readPrefix(t){return"prefix"!==t.type?this._error("Expected prefix to follow @prefix",t):(this._prefix=t.value,this._readPrefixIRI)}_readPrefixIRI(t){if("IRI"!==t.type)return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,t);const e=this._readEntity(t);return this._prefixes[this._prefix]=e.value,this._prefixCallback(this._prefix,e),this._readDeclarationPunctuation}_readBaseIRI(t){const e="IRI"===t.type&&this._resolveIRI(t.value);return e?(this._setBase(e),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",t)}_readNamedGraphLabel(t){switch(t.type){case"IRI":case"blank":case"prefixed":return this._readSubject(t),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",t)}}_readNamedGraphBlankLabel(t){return"]"!==t.type?this._error("Invalid graph label",t):(this._subject=this._blankNode(),this._readGraph)}_readDeclarationPunctuation(t){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(t)):"."!==t.type?this._error("Expected declaration to end with a dot",t):this._readInTopContext}_readQuantifierList(t){let e;switch(t.type){case"IRI":case"prefixed":if(void 0!==(e=this._readEntity(t,!0)))break;default:return this._error(`Unexpected ${t.type}`,t)}return this._explicitQuantifiers?(null===this._subject?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,e,this.QUANTIFIERS_GRAPH)):this._quantified[e.id]=this._quantifier(this._blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(t){return","===t.type?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(t))}_getPathReader(t){return this._afterPath=t,this._readPath}_readPath(t){switch(t.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:const e=this._contextStack,n=e.length&&e[e.length-1];if(n&&"item"===n.type){const e=this._subject;this._restoreContext("item",t),this._emit(this._subject,this.RDF_FIRST,e,this._graph)}return this._afterPath(t)}}_readForwardPath(t){let e,n;const r=this._blankNode();if(void 0!==(n=this._readEntity(t)))return null===this._predicate?(e=this._subject,this._subject=r):(e=this._object,this._object=r),this._emit(e,n,r,this._graph),this._readPath}_readBackwardPath(t){const e=this._blankNode();let n,r;if(void 0!==(n=this._readEntity(t)))return null===this._predicate?(r=this._subject,this._subject=e):(r=this._object,this._object=e),this._emit(e,n,r,this._graph),this._readPath}_readRDFStarTailOrGraph(t){return">>"!==t.type?this._supportsQuads&&null===this._graph&&void 0!==(this._graph=this._readEntity(t))?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,t):this._readRDFStarTail(t)}_readRDFStarTail(t){if(">>"!==t.type)return this._error(`Expected >> but got ${t.type}`,t);const e=this._quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<",t),null===this._subject?(this._subject=e,this._readPredicate):(this._object=e,this._getContextEndReader())}_getContextEndReader(){const t=this._contextStack;if(!t.length)return this._readPunctuation;switch(t[t.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<":return this._readRDFStarTailOrGraph}}_emit(t,e,n,r){this._callback(null,this._quad(t,e,n,r||this.DEFAULTGRAPH))}_error(t,e){const n=new Error(`${t} on line ${e.line}.`);n.context={token:e,line:e.line,previousToken:this._lexer.previousToken},this._callback(n),this._callback=ju}_resolveIRI(t){return/^[a-z][a-z0-9+.-]*:/i.test(t)?t:this._resolveRelativeIRI(t)}_resolveRelativeIRI(t){if(!t.length)return this._base;switch(t[0]){case"#":return this._base+t;case"?":return this._base.replace(/(?:\?.*)?$/,t);case"/":return("/"===t[1]?this._baseScheme:this._baseRoot)+this._removeDotSegments(t);default:return/^[^/:]*:/.test(t)?null:this._removeDotSegments(this._basePath+t)}}_removeDotSegments(t){if(!/(^|\/)\.\.?($|[/#?])/.test(t))return t;const e=t.length;let n="",r=-1,i=-1,o=0,s="/";for(;r<e;){switch(s){case":":if(i<0&&"/"===t[++r]&&"/"===t[++r])for(;(i=r+1)<e&&"/"!==t[i];)r=i;break;case"?":case"#":r=e;break;case"/":if("."===t[r+1])switch(s=t[1+ ++r],s){case"/":n+=t.substring(o,r-1),o=r+1;break;case void 0:case"?":case"#":return n+t.substring(o,r)+t.substr(r+1);case".":if(s=t[1+ ++r],void 0===s||"/"===s||"?"===s||"#"===s){if(n+=t.substring(o,r-2),(o=n.lastIndexOf("/"))>=i&&(n=n.substr(0,o)),"/"!==s)return`${n}/${t.substr(r+1)}`;o=r+1}}}s=t[++r]}return n+t.substring(o)}parse(t,e,n){if(this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${_u++}_`,this._prefixCallback=n||ju,this._inversePredicate=!1,this._quantified=Object.create(null),!e){const e=[];let n;if(this._callback=(t,r)=>{t?n=t:r&&e.push(r)},this._lexer.tokenize(t).every((t=>this._readCallback=this._readCallback(t))),n)throw n;return e}this._callback=e,this._lexer.tokenize(t,((t,e)=>{null!==t?(this._callback(t),this._callback=ju):this._readCallback&&(this._readCallback=this._readCallback(e))}))}};function ju(){}function Cu(t,e){const n=e.namedNode;t._namedNode=n,t._blankNode=e.blankNode,t._literal=e.literal,t._variable=e.variable,t._quad=e.quad,t.DEFAULTGRAPH=e.defaultGraph(),t.RDF_FIRST=n(su.rdf.first),t.RDF_REST=n(su.rdf.rest),t.RDF_NIL=n(su.rdf.nil),t.N3_FORALL=n(su.r.forAll),t.N3_FORSOME=n(su.r.forSome),t.ABBREVIATIONS={a:n(su.rdf.type),"=":n(su.owl.sameAs),">":n(su.log.implies)},t.QUANTIFIERS_GRAPH=n("urn:n3:quantifiers")}Cu(Au.prototype,mu);var Ru=mu.defaultGraph(),{rdf:Tu,xsd:Iu}=su,Ou=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,Nu=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,Pu={"\\":"\\\\",'"':'\\"',"\t":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"},Du=class extends gu{equals(){return!1}};function Mu(t){let e=Pu[t];return void 0===e&&(1===t.length?(e=t.charCodeAt(0).toString(16),e="\\u0000".substr(0,6-e.length)+e):(e=(1024*(t.charCodeAt(0)-55296)+t.charCodeAt(1)+9216).toString(16),e="\\U00000000".substr(0,10-e.length)+e)),e}function Uu(t){return t.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}function Lu(t,e,n,r,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(r,i)}var Bu=F(ao()),Ju="chrome:theSession";new as(Ju);var Ku=function(){ko(r,Co);var t,e,n=(t=r,e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var n,r=_o(t);if(e){var i=_o(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return xo(this,n)});function r(){var t;return Eo(this,r),Ao(So(t=n.call(this,"")),"value",""),Ao(So(t),"termType",No),Ao(So(t),"uri",Ju),t}return bo(r,[{key:"toCanonical",value:function(){return this.value}},{key:"toString",value:function(){return"DefaultGraph"}}]),r}();function Hu(t){return!!t&&t.termType===No}var $u=new Ku,Wu=function(){function t(e,n,r,i){Eo(this,t),Ao(this,"subject",void 0),Ao(this,"predicate",void 0),Ao(this,"object",void 0),Ao(this,"graph",void 0),this.subject=Co.fromValue(e),this.predicate=Co.fromValue(n),this.object=Co.fromValue(r),this.graph=null==i?$u:Co.fromValue(i)}return bo(t,[{key:"why",get:function(){return this.graph},set:function(t){this.graph=t}},{key:"equals",value:function(t){return t.subject.equals(this.subject)&&t.predicate.equals(this.predicate)&&t.object.equals(this.object)&&t.graph.equals(this.graph)}},{key:"substitute",value:function(e){var n=new t(this.subject.substitute(e),this.predicate.substitute(e),this.object.substitute(e),Hu(this.graph)?this.graph:this.graph.substitute(e));return console.log("@@@ statement substitute:"+n),n}},{key:"toCanonical",value:function(){var t=[this.subject.toCanonical(),this.predicate.toCanonical(),this.object.toCanonical()];return this.graph&&this.graph.termType!==No&&t.push(this.graph.toCanonical()),t.join(" ")+" ."}},{key:"toNT",value:function(){return[this.subject.toNT(),this.predicate.toNT(),this.object.toNT()].join(" ")+" ."}},{key:"toNQ",value:function(){return[this.subject.toNT(),this.predicate.toNT(),this.object.toNT(),Hu(this.graph)?"":this.graph.toNT()].join(" ")+" ."}},{key:"toString",value:function(){return this.toNT()}}]),t}(),qu={};E(qu,{docpart:()=>Gu,document:()=>zu,hostpart:()=>Xu,join:()=>Yu,protocol:()=>Qu,refTo:()=>Zu});var Vu=Vu||console.log;function Gu(t){var e;return(e=t.indexOf("#"))<0?t:t.slice(0,e)}function zu(t){return new as(Gu(t))}function Xu(t){var e=/[^\/]*\/\/([^\/]*)\//.exec(t);return e?e[1]:""}function Yu(t,e){var n,r,i,o,s,a=e.indexOf("#");if(a>0&&(e=e.slice(0,a)),0===t.length)return e;if(0===t.indexOf("#"))return e+t;if(t.indexOf(":")>=0)return t;if(n=e.indexOf(":"),0===e.length)return t;if(n<0)return Vu("Invalid base: "+e+" in join with given: "+t),t;if(r=e.slice(0,+n+1||9e9),0===t.indexOf("//"))return r+t;if(e.indexOf("//",n)===n+1){if((i=e.indexOf("/",n+3))<0)return e.length-n-3>0?e+"/"+t:r+t}else if((i=e.indexOf("/",n+1))<0)return e.length-n-1>0?e+"/"+t:r+t;if(0===t.indexOf("/"))return e.slice(0,i)+t;if((o=(s=e.slice(i)).lastIndexOf("/"))<0)return r+t;for(o>=0&&o<s.length-1&&(s=s.slice(0,+o+1||9e9)),s+=t;s.match(/[^\/]*\/\.\.\//);)s=s.replace(/[^\/]*\/\.\.\//,"");return s=(s=s.replace(/\.\//g,"")).replace(/\/\.$/,"/"),e.slice(0,i)+s}function Qu(t){var e=t.indexOf(":");return e<0?null:t.slice(0,e)}function Zu(t,e){var n,r,i,o,s,a,u,c,h,f,l,d,v=new RegExp("^[-_a-zA-Z0-9.]+:(//[^/]*)?/[^/]*$");if(!t)return e;if(t===e)return"";for(n=u=0,o=e.length;u<o&&e[n]===t[n];n=++u);if(t.slice(0,n).match(v)&&((r=e.indexOf("//"))<0&&(r=-2),i=e.indexOf("/",r+2),"/"!==e[i+1]&&"/"!==t[i+1]&&e.slice(0,i)===t.slice(0,i)))return e.slice(i);if("#"===e[n]&&t.length===n)return e.slice(n);for(;n>0&&"/"!==e[n-1];)n--;if(n<3)return e;if(t.indexOf("//",n-2)>0||e.indexOf("//",n-2)>0)return e;if(t.indexOf(":",n)>0)return e;for(a=0,c=0,s=(f=t.slice(n)).length;c<s;c++)"/"===f[c]&&a++;if(0===a&&n<e.length&&"#"===e[n])return"./"+e.slice(n);if(0===a&&n===e.length)return"./";if(d="",a>0)for(h=1,l=a;l>=1?h<=l:h>=l;l>=1?++h:--h)d+="../";return d+e.slice(n)}var tc,ec,nc,rc=function(){ko(r,Co);var t,e,n=(t=r,e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var n,r=_o(t);if(e){var i=_o(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return xo(this,n)});function r(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return Eo(this,r),Ao(So(t=n.call(this,e)),"termType",Oo),Ao(So(t),"base","varid:"),Ao(So(t),"classOrder",jo.Variable),Ao(So(t),"isVar",1),Ao(So(t),"uri",void 0),t.base="varid:",t.uri=Yu(e,t.base),t}return bo(r,[{key:"equals",value:function(t){return!!t&&this.termType===t.termType&&this.value===t.value}},{key:"hashString",value:function(){return this.toString()}},{key:"substitute",value:function(t){var e;return null!=(e=t[this.toNT()])?e:this}},{key:"toString",value:function(){return r.toString(this)}}],[{key:"toString",value:function(t){return t.uri.slice(0,t.base.length)===t.base?"?".concat(t.uri.slice(t.base.length)):"?".concat(t.uri)}}]),r}();(ec=tc||(tc={})).collections="COLLECTIONS",ec.defaultGraphType="DEFAULT_GRAPH_TYPE",ec.equalsMethod="EQUALS_METHOD",ec.id="ID",ec.identity="IDENTITY",ec.reversibleId="REVERSIBLE_ID",ec.variableType="VARIABLE_TYPE";var ic=new Ku,oc={supports:(nc={},Ao(nc,tc.collections,!1),Ao(nc,tc.defaultGraphType,!1),Ao(nc,tc.equalsMethod,!0),Ao(nc,tc.identity,!1),Ao(nc,tc.id,!0),Ao(nc,tc.reversibleId,!1),Ao(nc,tc.variableType,!0),nc),blankNode:function(t){return new Go(t)},defaultGraph:function(){return ic},equals:function(t,e){return t===e||!t||!e||(is(t)||is(e)?!(!is(t)||!is(e))&&this.equals(t.subject,e.subject)&&this.equals(t.predicate,e.predicate)&&this.equals(t.object,e.object)&&this.equals(t.graph,e.graph):!(!ns(t)||!ns(e))&&this.id(t)===this.id(e))},id:function(t){if(!t)return"undefined";if(is(t))return this.quadToNQ(t);switch(t.termType){case No:return"defaultGraph";case Oo:return rc.toString(t);default:var e=this.termToNQ(t);if(e)return e;throw new Error("Can't id term with type '".concat(t.termType,"'"))}},isQuad:function(t){return t instanceof Wu},literal:function(t,e){if("string"!=typeof t&&!e)return cs.fromValue(t);var n="string"==typeof t?t:""+t;return"string"==typeof e?-1===e.indexOf(":")?new cs(n,e):new cs(n,null,this.namedNode(e)):new cs(n,null,e)},namedNode:function(t){return new as(t)},quad:function(t,e,n,r){return new Wu(t,e,n,r||ic)},triple:function(t,e,n,r){return this.quad(t,e,n,r)},quadToNQ:function(t){return"".concat(this.termToNQ(t.subject)," ").concat(this.termToNQ(t.predicate)," ").concat(this.termToNQ(t.object)," ").concat(this.termToNQ(t.graph)," .")},termToNQ:function(t){var e=this;switch(t.termType){case To:return"_:"+t.value;case No:return"";case Do:return"<http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>";case Io:return cs.toNT(t);case Mo:case Ro:return"<"+t.value+">";case Po:return"("+t.elements.map((function(t){return e.termToNQ(t)})).join(" ")+")";default:throw new Error("Can't serialize nonstandard term type (was '".concat(t.termType,"')"))}},toNQ:function(t){return this.isQuad(t)?this.quadToNQ(t):this.termToNQ(t)},variable:function(t){return new rc(t)}},sc=oc,ac=function(){},uc=function(){},cc=function(){},hc=function(){};function fc(t,e){var n=e||{namedNode:function(t){return new as(t)}};return function(e){return n.namedNode(t+(e||""))}}var lc=F(vo());function dc(t,e){t.callbacks={};for(var n=e.length-1;n>=0;n--)t.callbacks[e[n]]=[];t.addHook=function(e){t.callbacks[e]||(t.callbacks[e]=[])},t.addCallback=function(e,n){t.callbacks[e].push(n)},t.removeCallback=function(e,n){for(var r=0;r<t.callbacks[e].length;r++)if(t.callbacks[e][r].name===n)return t.callbacks[e].splice(r,1),!0;return!1},t.insertCallback=function(e,n){t.callbacks[e].unshift(n)},t.fireCallbacks=function(e,n){var r,i,o=[],s=[],a=t.callbacks[e].length;for(r=a-1;r>=0;r--)(i=t.callbacks[e][r])&&i.apply(t,n)&&o.push(i);for(r=o.length-1;r>=0;r--)s.push(o[r]);for(r=a;r<t.callbacks[e].length;r++)s.push(t.callbacks[e][r]);t.callbacks[e]=s}}function vc(t,e){var n=[];(e=e||{})&&e.selfClosing&&e.selfClosing.split(" ").forEach((function(t){n[t]=!0}));var r=[];return e&&e.skipAttributes&&e.skipAttributes.split(" ").forEach((function(t){r[t]=!0})),pc(t,e,n,r)}function pc(t,e,n,r){var i,o="",s=[!1];if(void 0===t.nodeType)return o;if(1===t.nodeType){if(t.hasAttribute("class")&&e&&e.classWithChildText&&t.matches(e.classWithChildText.class))o+=t.querySelector(e.classWithChildText.element).textContent;else if(!(e&&e.skipNodeWithClass&&t.matches("."+e.skipNodeWithClass))){var a=t.nodeName.toLowerCase();o+="<"+a;var u=[];for(i=t.attributes.length-1;i>=0;i--){var c=t.attributes[i];if(!(r&&r.length>0&&r[c.name]||/^\d+$/.test(c.name))){if("class"===c.name&&e&&e.replaceClassItemWith&&c.value.split(" ").indexOf(e.replaceClassItemWith.source)>-1){var h=new RegExp(e.replaceClassItemWith.source,"g");c.value=c.value.replace(h,e.replaceClassItemWith.target).trim()}"class"===c.name&&e&&e.skipClassWithValue&&e.skipClassWithValue===c.value||u.push(c.name+"='"+c.value.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,""")+"'")}}if(u.length>0&&(e&&e.sortAttributes&&u.sort((function(t,e){return t.toLowerCase().localeCompare(e.toLowerCase())})),o+=" "+u.join(" ")),n&&n.ename)o+=" />";else{for(o+=">",o+="html"===a?"\n ":"",s.push("style"===a||"script"===a),i=0;i<t.childNodes.length;i++)o+=pc(t.childNodes[i]);s.pop(),o+="body"===a?"</"+a+">\n":"</"+a+">"}}}else if(8===t.nodeType)o+="\x3c!--"+t.nodeValue+"--\x3e";else if(3===t.nodeType||4===t.nodeType){var f=t.nodeValue.replace(/\n+$/,"");o+=s[s.length-1]?f:f.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}else console.log("Warning; Cannot handle serialising nodes of type: "+t.nodeType),console.log(t);return o}function wc(t,e,n,r){var i=function(t){return"BlankNode"===t.termType?null:t},o=function(t){var e=n.statementsMatching(t).map((function(t){return i(t.subject)+" "+i(t.predicate)+" "+i(t.object)})).concat(n.statementsMatching(void 0,void 0,t).map((function(t){return i(t.subject)+" "+i(t.predicate)+" "+i(t.object)})));return e.sort(),e.join("\n")},s=Object.prototype.hasOwnProperty.call(n,"compareTerms")?n.compareTerms(t,e):t.compareTerm(e);return"BlankNode"===t.termType&&"BlankNode"===e.termType?0===s?0:o(t)>o(e)?1:o(t)<o(e)?-1:s:r&&t.uri&&e.uri?(r[t.uri]||t.uri).localeCompare(r[e.uri]||e.uri):s}function yc(t,e){return e=e||{},"undefined"!=typeof module&&module&&module.exports?(new lc.DOMParser).parseFromString(t,e.contentType||"application/xhtml+xml"):("undefined"!=typeof window&&window.DOMParser?new window.DOMParser:new lc.DOMParser).parseFromString(t,"application/xml")}function mc(t,e){for(var n=0;n<t.length;n++)if(t[n].subject.equals(e.subject)&&t[n].predicate.equals(e.predicate)&&t[n].object.equals(e.object)&&t[n].why.equals(e.why))return void t.splice(n,1);throw new Error("RDFArrayRemove: Array did not contain "+e+" "+e.why)}function gc(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:sc;return{boolean:t.namedNode("http://www.w3.org/2001/XMLSchema#boolean"),dateTime:t.namedNode("http://www.w3.org/2001/XMLSchema#dateTime"),decimal:t.namedNode("http://www.w3.org/2001/XMLSchema#decimal"),double:t.namedNode("http://www.w3.org/2001/XMLSchema#double"),integer:t.namedNode("http://www.w3.org/2001/XMLSchema#integer"),langString:t.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),string:t.namedNode("http://www.w3.org/2001/XMLSchema#string")}}gc(sc);var bc=F(po()),Ec=function(){function t(e){Eo(this,t),Ao(this,"_notQNameChars","\t\r\n !\"#$%&'()*.,+/;<=>?@[\\]^`{|}~"),Ao(this,"_notNameChars",this._notQNameChars+":"),Ao(this,"validPrefix",new RegExp(/^[a-zA-Z][a-zA-Z0-9]*$/)),Ao(this,"forbidden1",new RegExp(/[\\"\b\f\r\v\t\n\u0080-\uffff]/gm)),Ao(this,"forbidden3",new RegExp(/[\\"\b\f\r\v\u0080-\uffff]/gm)),this.flags="",this.base=null,this.prefixes=[],this.namespaces=[];var n=Object.keys((0,bc.default)());for(var r in n){var i=(0,bc.default)()[n[r]](""),o=n[r];this.prefixes[i]=o,this.namespaces[o]=i}this.suggestPrefix("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#"),this.suggestPrefix("xml","reserved:reservedForFutureUse"),this.namespacesUsed=[],this.keywords=["a"],this.prefixchars="abcdefghijklmnopqustuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",this.incoming=null,this.formulas=[],this.store=e,this.rdfFactory=e.rdfFactory||sc,this.xsd=gc(this.rdfFactory)}return bo(t,[{key:"setBase",value:function(t){return this.base=t,this}},{key:"setFlags",value:function(t){return this.flags=t||"",this}},{key:"toStr",value:function(t){var e=t.toNT();return"Graph"===t.termType&&(this.formulas[e]=t),e}},{key:"fromStr",value:function(t){if("{"===t[0]){var e=this.formulas[t];return e||console.log("No formula object for "+t),e}return this.store.fromNT(t)}},{key:"setNamespaces",value:function(t){for(var e in t)this.setPrefix(e,t[e]);return this}},{key:"setPrefix",value:function(t,e){if("default"!==t.slice(0,7)&&"ns"!==t.slice(0,2)&&t&&e){for(var n in this.prefixes)this.prefixes[n]==t&&delete this.prefixes[n];this.prefixes[e]=t,this.namespaces[t]=e}}},{key:"suggestPrefix",value:function(t,e){"default"!==t.slice(0,7)&&"ns"!==t.slice(0,2)&&t&&e&&(t in this.namespaces||e in this.prefixes||(this.prefixes[e]=t,this.namespaces[t]=e))}},{key:"suggestNamespaces",value:function(t){for(var e in t)this.suggestPrefix(e,t[e]);return this}},{key:"checkIntegrity",value:function(){var t,e;for(t in this.namespaces)if(this.prefixes[this.namespaces[t]]!==t)throw new Error("Serializer integity error 1: "+t+", "+this.namespaces[t]+", "+this.prefixes[this.namespaces[t]]+"!");for(e in this.prefixes)if(this.namespaces[this.prefixes[e]]!==e)throw new Error("Serializer integity error 2: "+e+", "+this.prefixs[e]+", "+this.namespaces[this.prefixes[e]]+"!")}},{key:"makeUpPrefix",value:function(t){var e=t,n=function(e){return!!this.validPrefix.test(e)&&"ns"!==e&&!(e in this.namespaces)&&(this.prefixes[t]=e,this.namespaces[e]=t,e)}.bind(this);"#/".indexOf(e[e.length-1])>=0&&(e=e.slice(0,-1));var r=e.lastIndexOf("/");r>=0&&(e=e.slice(r+1));for(var i=0;i<e.length&&this.prefixchars.indexOf(e[i]);)i++;if((e=e.slice(0,i)).length<6&&n(e))return e;if(n(e.slice(0,3)))return e.slice(0,3);if(n(e.slice(0,2)))return e.slice(0,2);if(n(e.slice(0,4)))return e.slice(0,4);if(n(e.slice(0,1)))return e.slice(0,1);if(n(e.slice(0,5)))return e.slice(0,5);this.validPrefix.test(e)||(e="n");for(var o=0;;o++)if(n(e.slice(0,3)+o))return e.slice(0,3)+o}},{key:"rootSubjects",value:function(t){for(var e={},n={},r={},i=0;i<t.length;i++){var o=t[i],s=function(t){e.hasOwnProperty(t)||(e[t]=[]),e[t].push(o.subject)};[o.subject,o.predicate,o.object].map((function(t){"BlankNode"===t.termType?r[t.toNT()]=!0:"Collection"===t.termType&&t.elements.forEach((function(t){s(t)}))})),s(t[i].object);var a=n[this.toStr(o.subject)];a||(a=[]),a.push(o),n[this.toStr(o.subject)]=a}var u=[];for(var c in n)if(n.hasOwnProperty(c)){var h=this.fromStr(c);"BlankNode"===h.termType&&e[h]&&1===e[h].length||u.push(h)}this.incoming=e;for(var f={},l=0;l<u.length;l++)f[u[l].toNT()]=!0;return{roots:u,subjects:n,rootsHash:f,incoming:e}}},{key:"toN3",value:function(t){return this.statementsToN3(t.statements)}},{key:"explicitURI",value:function(t){return"<"+(t=this.flags.indexOf("r")<0&&this.base?Zu(this.base,t):this.flags.indexOf("u")>=0?function(t){for(var e,n="",r=0;r<t.length;r++)n+=(e=t.charCodeAt(r))>65535?"\\U"+("00000000"+e.toString(16)).slice(-8):e>126?"\\u"+("0000"+e.toString(16)).slice(-4):t[r];return n}(t):encodeURI(t))+">"}},{key:"statementsToNTriples",value:function(t){var e=t.slice();e.sort();for(var n="",r="http://www.w3.org/1999/02/22-rdf-syntax-ns#",i=this,o=this.store,s=this.rdfFactory,a=function t(e){if("Collection"!==e.termType)return i.atomicTermToN3(e);for(var a=e.elements,u=o.sym(r+"nill"),c=a.length-1;c>=0;c--){var h=s.blankNode();n+=t(h)+" "+t(o.sym(r+"first"))+" "+t(a[c])+".\n",n+=t(h)+" "+t(o.sym(r+"rest"))+" "+t(u)+".\n",u=h}return i.atomicTermToN3(u)},u=0;u<e.length;u++){var c=e[u],h="";h+=a(c.subject)+" ",h+=a(c.predicate)+" ",h+=a(c.object)+" ",this.flags.indexOf("q")>=0&&(h+=a(c.why)+" "),n+=h+=".\n"}return n}},{key:"statementsToN3",value:function(e){var n=this.store,r={"http://www.w3.org/1999/02/22-rdf-syntax-ns#type":"aaa:00"};e.sort((function(t,e){return function(t,e,n,r){return wc(t.subject,e.subject,n,r)||wc(t.predicate,e.predicate,n,r)||wc(t.object,e.object,n,r)}(t,e,n,r)})),this.base&&!this.defaultNamespace&&(this.defaultNamespace=this.base+"#");var i={};this.flags.indexOf("s")<0&&(i["http://www.w3.org/2002/07/owl#sameAs"]="="),this.flags.indexOf("t")<0&&(i["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"]="a"),this.flags.indexOf("i")<0&&(i["http://www.w3.org/2000/10/swap/log#implies"]="=>");var o=function(t){for(var e="",n=0;n<t;n++)e+=" ";return e},s=function t(e){for(var n="",r=0;r<e.length;r++){var i=e[r],o="string"==typeof i?i:t(i);if(0!==r){var s=n.slice(-1)||" ";","===o||";"===o||("."!==o||"0123456789.:".includes(s))&&(n+=" ")}n+=o}return n},a=function(t){for(var e=this.rootSubjects(t),n=e.roots,r=[],i=0;i<n.length;i++)r.push(u(n[i],e));return r}.bind(this);function u(t,e){return"BlankNode"!==t.termType||e.incoming[t]?[f(t,e)].concat([c(t,e)]).concat(["."]):h(t,e,!0).concat(["."])}var c=function(t,e){var n=[],r=null,o=e.subjects[this.toStr(t)]||[];if(void 0===o)throw new Error("Cant find statements for "+t);for(var s=[],a=0;a<o.length;a++){var u=o[a];u.predicate.uri===r?s.push(","):(r&&(n=n.concat([s]).concat([";"]),s=[]),n.push(i[u.predicate.uri]?i[u.predicate.uri]:f(u.predicate,e))),r=u.predicate.uri,s.push(h(u.object,e))}return n.concat([s])}.bind(this),h=function(t,e,n){return"BlankNode"!==t.termType||!n&&void 0!==e.rootsHash[t.toNT()]?f(t,e):e.subjects[this.toStr(t)]?["[",c(t,e),"]"]:"[]"}.bind(this);t.prototype.termToN3=f;var f=function(t,e){var n,r;switch(t.termType){case"Graph":return(r=(r=["{"]).concat(a(t.statements))).concat(["}"]);case"Collection":for(r=["("],n=0;n<t.elements.length;n++)r.push([h(t.elements[n],e)]);return r.push(")"),r;default:return this.atomicTermToN3(t)}}.bind(this),l=function(){var t="";for(var e in this.defaultNamespace&&(t+="@prefix : "+this.explicitURI(this.defaultNamespace)+".\n"),this.prefixes)this.prefixes.hasOwnProperty(e)&&this.namespacesUsed[e]&&(t+="@prefix "+this.prefixes[e]+": "+this.explicitURI(e)+".\n");return t+"\n"}.bind(this),d=a(e);return l()+function t(e,n){var r="",i=1e5;void 0===n&&(n=-1);for(var a=0;a<e.length;a++){var u=e[a];if("string"!=typeof u){var c=t(u,n+1);if(c.length<10*(80-4*n)&&c.indexOf('"""')<0){var h=s(u);h.length<80-4*n&&(u=h,c="")}c&&(i=1e4),r+=c}if("string"==typeof u){if(1===u.length&&"\n"===r.slice(-1)&&",.;".indexOf(u)>=0){r=r.slice(0,-1),"."==u&&"0123456789.:".includes(r.charAt(r.length-1))&&(r+=" ",i+=1),r+=u+"\n",i+=1;continue}if(i<4*n+4||i+u.length+1<80&&";.".indexOf(r[r.length-2])<0)r=r.slice(0,-1)+" "+u+"\n",i+=u.length+1;else{var f=o(4*n)+u;r+=f+"\n",i=f.length,n<0&&(r+="\n",i=1e5)}}}return r}(d)}},{key:"atomicTermToN3",value:function(t,e){switch(t.termType){case"BlankNode":case"Variable":return t.toNT();case"Literal":var n=t.value;if("string"!=typeof n)throw new TypeError("Value of RDF literal node must be a string");if(t.datatype&&this.flags.indexOf("x")<0)switch(t.datatype.uri){case"http://www.w3.org/2001/XMLSchema#integer":return n;case"http://www.w3.org/2001/XMLSchema#decimal":return n.indexOf(".")<0&&(n+=".0"),n;case"http://www.w3.org/2001/XMLSchema#double":var r=n.toLowerCase().indexOf("e")>0;return n.indexOf(".")<0&&!r&&(n+=".0"),r||(n+="e0"),n;case"http://www.w3.org/2001/XMLSchema#boolean":return"1"===t.value?"true":"false"}var i=this.stringToN3(t.value);return t.language?i+="@"+t.language:t.datatype.equals(this.xsd.string)||(i+="^^"+this.atomicTermToN3(t.datatype,e)),i;case"NamedNode":return this.symbolToN3(t);case"DefaultGraph":return"";default:throw new Error("Internal: atomicTermToN3 cannot handle "+t+" of termType: "+t.termType)}}},{key:"stringToN3",value:function(t,e){e||(e="e");var n,r,i,o,s,a="";for(t.length>20&&'"'!==t.slice(-1)&&e.indexOf("n")<0&&(t.indexOf("\n")>0||t.indexOf('"')>0)?(o='"""',s=this.forbidden3):(o='"',s=this.forbidden1),n=0;n<t.length&&(s.lastIndex=0,null!=s.exec(t.slice(n)));){a+=t.slice(n,r=n+s.lastIndex-1);var u=t[r];'"'===u&&'"""'===o&&'"""'!==t.slice(r,r+3)?a+=u:(i='\b\f\r\t\v\n\\"'.indexOf(u))>=0?a+="\\"+'bfrtvn\\"'[i]:e.indexOf("e")>=0?a+="\\u"+("000"+u.charCodeAt(0).toString(16).toLowerCase()).slice(-4):a+=u,n=r+1}return o+a+t.slice(n)+o}},{key:"symbolToN3",value:function(t){var e=t.uri,n=e.indexOf("#");if(n<0&&this.flags.indexOf("/")<0&&(n=e.lastIndexOf("/")),n>=0&&this.flags.indexOf("p")<0&&(0===e.indexOf("http")||0===e.indexOf("ws")||0===e.indexOf("file"))){for(var r=!0,i=n+1;i<e.length;i++)if(this._notNameChars.indexOf(e[i])>=0){r=!1;break}if(r){var o=e.slice(n+1),s=e.slice(0,n+1);if(this.defaultNamespace&&this.defaultNamespace===s&&this.flags.indexOf("d")<0)return this.flags.indexOf("k")>=0&&this.keyords.indexOf(o)<0?o:":"+o;var a=this.prefixes[s];if(a||(a=this.makeUpPrefix(s)),a)return this.namespacesUsed[s]=!0,a+":"+o}}return this.explicitURI(e)}},{key:"writeStore",value:function(t){var e=this.store,n=e.fetcher,r=n&&n.appNode,i=this.store.index[3];for(var o in i){var s=e.fromNT(o);r&&s.equals(r)||t("\n"+this.atomicTermToN3(s)+" "+this.atomicTermToN3(e.sym("http://www.w3.org/2000/10/swap/log#semantics"))+" { "+this.statementsToN3(e.statementsMatching(void 0,void 0,void 0,s))+" }.\n")}e.statementsMatching(void 0,e.sym("http://www.w3.org/2007/ont/link#requestedURI")).map((function(n){t("\n<"+n.object.value+"> log:metadata {\n");var r=e.statementsMatching(void 0,void 0,void 0,n.subject);t(this.statementsToN3(this.statementsToN3(r))),t("}.\n")}));var a=[];r&&a.push(r);var u=[];a.map((function(t){u=u.concat(e.statementsMatching(void 0,void 0,void 0,t))})),t(this.statementsToN3(u))}},{key:"statementsToXML",value:function(t){var e=[];e["http://www.w3.org/1999/02/22-rdf-syntax-ns#"]=!0;var n="http://www.w3.org/1999/02/22-rdf-syntax-ns#_",r=function(t){for(var e="",n=0;n<t;n++)e+=" ";return e},i=function t(e){for(var n="",r=0;r<e.length;r++){var i=e[r];n+="string"==typeof i?i:t(i)}return n},o=function(t){this.suggestPrefix("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#");for(var e=this.rootSubjects(t),n=e.roots,r=[],i=0;i<n.length;i++)r.push(u(n[i],e));return r}.bind(this);function s(t){return void 0===t?"@@@undefined@@@@":t.replace(/[&<"]/g,(function(t){switch(t[0]){case"&":return"&";case"<":return"<";case'"':return"""}}))}var a=function(t){return s(this.base?qu.refTo(this.base,t.uri):t.uri)}.bind(this),u=function(t,e){var r,i,o,l,d=[],v=e.subjects[this.toStr(t)];if(void 0===v)return h(t,e);v.sort((function(t,e){var r=t.predicate.uri,i=e.predicate.uri;if(r.substring(0,n.length)===n||i.substring(0,n.length)===n)return r.localeCompare(i);var o=r.substring(n.length),s=i.substring(n.length),a=parseInt(o,10),u=parseInt(s,10);return isNaN(a)||isNaN(u)||a!==o||u!==s?r.localeCompare(i):a-u}));for(var p=0;p<v.length;p++)if("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"!==(o=v[p]).predicate.uri||r||"NamedNode"!==o.object.termType){if((l=o.predicate).uri.substr(0,n.length)===n){var w=l.uri.substr(n.length);w===parseInt(w,10).toString()&&(l=this.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#li"))}switch(i=f(l),o.object.termType){case"BlankNode":d=d.concat(1===e.incoming[o.object].length?["<"+i+' rdf:parseType="Resource">',u(o.object,e),"</"+i+">"]:["<"+i+' rdf:nodeID="'+o.object.toNT().slice(2)+'"/>']);break;case"NamedNode":d=d.concat(["<"+i+' rdf:resource="'+a(o.object)+'"/>']);break;case"Literal":d=d.concat(["<"+i+(o.object.datatype.equals(this.xsd.string)?"":' rdf:datatype="'+s(o.object.datatype.uri)+'"')+(o.object.language?' xml:lang="'+o.object.language+'"':"")+">"+s(o.object.value)+"</"+i+">"]);break;case"Collection":d=d.concat(["<"+i+' rdf:parseType="Collection">',c(o.object,e),"</"+i+">"]);break;default:throw new Error("Can't serialize object of type "+o.object.termType+" into XML")}}else r=o.object;var y=r?f(r):"rdf:Description",m="";return"BlankNode"===t.termType?e.incoming[t]&&1===e.incoming[t].length||(m=' rdf:nodeID="'+t.toNT().slice(2)+'"'):m=' rdf:about="'+a(t)+'"',["<"+y+m+">"].concat([d]).concat(["</"+y+">"])}.bind(this);function c(t,e){for(var n=[],r=0;r<t.elements.length;r++)n.push(u(t.elements[r],e));return n}var h=function(t,e){var n=[],r=e.subjects[this.toStr(t)];if(!r)return n;r.sort();for(var i=0;i<r.length;i++){var o=r[i];switch(o.object.termType){case"BlankNode":n=e.rootsHash[o.object.toNT()]?n.concat(["<"+f(o.predicate)+' rdf:nodeID="'+o.object.toNT().slice(2)+'">',"</"+f(o.predicate)+">"]):n.concat(["<"+f(o.predicate)+' rdf:parseType="Resource">',h(o.object,e),"</"+f(o.predicate)+">"]);break;case"NamedNode":n=n.concat(["<"+f(o.predicate)+' rdf:resource="'+a(o.object)+'"/>']);break;case"Literal":n=n.concat(["<"+f(o.predicate)+(o.object.datatype.equals(this.xsd.string)?"":' rdf:datatype="'+s(o.object.datatype.value)+'"')+(o.object.language?' xml:lang="'+o.object.language+'"':"")+">"+s(o.object.value)+"</"+f(o.predicate)+">"]);break;case"Collection":n=n.concat(["<"+f(o.predicate)+' rdf:parseType="Collection">',c(o.object,e),"</"+f(o.predicate)+">"]);break;default:throw new Error("Can't serialize object of type "+o.object.termType+" into XML")}}return n}.bind(this),f=function(t){var n=t.uri,r=n.indexOf("#");if(r<0&&this.flags.indexOf("/")<0&&(r=n.lastIndexOf("/")),r<0)throw new Error("Cannot make qname out of <"+n+">");for(var i=r+1;i<n.length;i++)if(this._notNameChars.indexOf(n[i])>=0)throw new Error('Invalid character "'+n[i]+'" cannot be in XML qname for URI: '+n);var o=n.slice(r+1),s=n.slice(0,r+1);if(this.defaultNamespace&&this.defaultNamespace===s&&this.flags.indexOf("d")<0)return o;var a=this.prefixes[s];return a||(a=this.makeUpPrefix(s)),e[s]=!0,a+":"+o}.bind(this),l=o(t),d="<rdf:RDF";for(var v in this.defaultNamespace&&(d+=' xmlns="'+s(this.defaultNamespace)+'"'),e)if(e.hasOwnProperty(v)){var p=this.base&&this.flags.includes("z")?qu.refTo(this.base,v):v;d+="\n xmlns:"+this.prefixes[v]+'="'+s(p)+'"'}return function t(e,n){var o,s="",a=1e5;n||(n=0);for(var u=0;u<e.length;u++){var c=e[u];if("string"!=typeof c){var h=t(c,n+1);h.length<10*(80-4*n)&&h.indexOf('"""')<0&&(o=i(c)).length<80-4*n&&(c=" "+o,h=""),h&&(a=1e4),s+=h}"string"==typeof c&&(a<4*n+4?(s=s.slice(0,-1)+" "+c+"\n",a+=c.length+1):(s+=(o=r(4*n)+c)+"\n",a=o.length))}return s}([d+=">",l,"</rdf:RDF>"],-1)}}]),t}();function Sc(t,e,n,r,i,o){n=n||(null==t?void 0:t.value);var s,a,u,c,h,f=o||{};r=r||qo;try{var l=new Ec(e);f.flags&&l.setFlags(f.flags);var d=e.statementsMatching(void 0,void 0,void 0,t);switch("namespaces"in e&&l.suggestNamespaces(e.namespaces),f.namespaces&&l.setNamespaces(f.namespaces),l.setBase(n),r){case Ho:return v(null,l.statementsToXML(d));case Bo:case"application/n3":return v(null,l.statementsToN3(d));case qo:case"application/x-turtle":return l.setFlags("si"),v(null,l.statementsToN3(d));case"application/n-triples":return l.setFlags("deinprstux"),v(null,l.statementsToNTriples(d));case Lo:l.setFlags("deinprstux"),s=l.statementsToNTriples(d),a=i,c=new Au,h=new class{constructor(t,e){if(this._prefixRegex=/$0^/,t&&"function"!=typeof t.write&&(e=t,t=null),this._lists=(e=e||{}).lists,t)this._outputStream=t,this._endStream=void 0===e.end||!!e.end;else{let t="";this._outputStream={write(e,n,r){t+=e,r&&r()},end:e=>{e&&e(null,t)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(e.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=Ru,this._prefixIRIs=Object.create(null),e.prefixes&&this.addPrefixes(e.prefixes),e.baseIRI&&(this._baseMatcher=new RegExp(`^${Uu(e.baseIRI)}${e.baseIRI.endsWith("/")?"":"[#?]"}`),this._baseLength=e.baseIRI.length))}get _inDefaultGraph(){return Ru.equals(this._graph)}_write(t,e){this._outputStream.write(t,"utf8",e)}_writeQuad(t,e,n,r,i){try{r.equals(this._graph)||(this._write((null===this._subject?"":this._inDefaultGraph?".\n":"\n}\n")+(Ru.equals(r)?"":`${this._encodeIriOrBlank(r)} {\n`)),this._graph=r,this._subject=null),t.equals(this._subject)?e.equals(this._predicate)?this._write(`, ${this._encodeObject(n)}`,i):this._write(`;\n ${this._encodePredicate(this._predicate=e)} ${this._encodeObject(n)}`,i):this._write(`${(null===this._subject?"":".\n")+this._encodeSubject(this._subject=t)} ${this._encodePredicate(this._predicate=e)} ${this._encodeObject(n)}`,i)}catch(t){i&&i(t)}}_writeQuadLine(t,e,n,r,i){delete this._prefixMatch,this._write(this.quadToString(t,e,n,r),i)}quadToString(t,e,n,r){return`${this._encodeSubject(t)} ${this._encodeIriOrBlank(e)} ${this._encodeObject(n)}${r&&r.value?` ${this._encodeIriOrBlank(r)} .\n`:" .\n"}`}quadsToString(t){return t.map((t=>this.quadToString(t.subject,t.predicate,t.object,t.graph))).join("")}_encodeSubject(t){return"Quad"===t.termType?this._encodeQuad(t):this._encodeIriOrBlank(t)}_encodeIriOrBlank(t){if("NamedNode"!==t.termType)return this._lists&&t.value in this._lists&&(t=this.list(this._lists[t.value])),"id"in t?t.id:`_:${t.value}`;let e=t.value;this._baseMatcher&&this._baseMatcher.test(e)&&(e=e.substr(this._baseLength)),Ou.test(e)&&(e=e.replace(Nu,Mu));const n=this._prefixRegex.exec(e);return n?n[1]?this._prefixIRIs[n[1]]+n[2]:e:`<${e}>`}_encodeLiteral(t){let e=t.value;if(Ou.test(e)&&(e=e.replace(Nu,Mu)),t.language)return`"${e}"@${t.language}`;if(this._lineMode){if(t.datatype.value===Iu.string)return`"${e}"`}else switch(t.datatype.value){case Iu.string:return`"${e}"`;case Iu.boolean:if("true"===e||"false"===e)return e;break;case Iu.integer:if(/^[+-]?\d+$/.test(e))return e;break;case Iu.decimal:if(/^[+-]?\d*\.\d+$/.test(e))return e;break;case Iu.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(e))return e}return`"${e}"^^${this._encodeIriOrBlank(t.datatype)}`}_encodePredicate(t){return t.value===Tu.type?"a":this._encodeIriOrBlank(t)}_encodeObject(t){switch(t.termType){case"Quad":return this._encodeQuad(t);case"Literal":return this._encodeLiteral(t);default:return this._encodeIriOrBlank(t)}}_encodeQuad({subject:t,predicate:e,object:n,graph:r}){return`<<${this._encodeSubject(t)} ${this._encodePredicate(e)} ${this._encodeObject(n)}${i=r,i&&"DefaultGraph"===i.termType?"":` ${this._encodeIriOrBlank(r)}`}>>`;var i}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(t,e,n,r,i){void 0===n?this._writeQuad(t.subject,t.predicate,t.object,t.graph,e):"function"==typeof r?this._writeQuad(t,e,n,Ru,r):this._writeQuad(t,e,n,r||Ru,i)}addQuads(t){for(let e=0;e<t.length;e++)this.addQuad(t[e])}addPrefix(t,e,n){const r={};r[t]=e,this.addPrefixes(r,n)}addPrefixes(t,e){if(!this._prefixIRIs)return e&&e();let n=!1;for(let e in t){let r=t[e];"string"!=typeof r&&(r=r.value),n=!0,null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null,this._graph=""),this._prefixIRIs[r]=e+=":",this._write(`@prefix ${e} <${r}>.\n`)}if(n){let t="",e="";for(const n in this._prefixIRIs)t+=t?`|${n}`:n,e+=(e?"|":"")+this._prefixIRIs[n];t=Uu(t),this._prefixRegex=new RegExp(`^(?:${e})[^/]*$|^(${t})([_a-zA-Z][\\-_a-zA-Z0-9]*)$`)}this._write(n?"\n":"",e)}blank(t,e){let n,r,i=t;switch(void 0===t?i=[]:t.termType?i=[{predicate:t,object:e}]:"length"in t||(i=[t]),r=i.length){case 0:return new Du("[]");case 1:if(n=i[0],!(n.object instanceof Du))return new Du(`[ ${this._encodePredicate(n.predicate)} ${this._encodeObject(n.object)} ]`);default:let e="[";for(let o=0;o<r;o++)n=i[o],n.predicate.equals(t)?e+=`, ${this._encodeObject(n.object)}`:(e+=`${(o?";\n ":"\n ")+this._encodePredicate(n.predicate)} ${this._encodeObject(n.object)}`,t=n.predicate);return new Du(`${e}\n]`)}}list(t){const e=t&&t.length||0,n=new Array(e);for(let r=0;r<e;r++)n[r]=this._encodeObject(t[r]);return new Du(`(${n.join(" ")})`)}end(t){null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null),this._write=this._blockedWrite;let e=t&&((n,r)=>{e=null,t(n,r)});if(this._endStream)try{return this._outputStream.end(e)}catch(t){}e&&e()}}({format:"N-Quads"}),eu.waterfall([function(t){c.parse(s,(function(e,n){e?t(e):null!==n?h.addQuad(n):h.end(t)}))},function(t,e){try{nu.default.fromRDF(t,{format:"application/nquads"}).then((function(t){e(null,t)}))}catch(t){e(t)}},function(t){u=JSON.stringify(t),a(null,u)}],(function(t){a(t,u)}));break;case Ko:case Jo:return l.setFlags("deinprstux q"),v(null,l.statementsToNTriples(d));default:throw new Error("Serialize: Content-type "+r+" not supported for data write.")}}catch(t){if(i)return i(t,void 0);throw t}function v(t,e){return i?void i(t,e):e}}var Fc=["blankNode","defaultGraph","literal","namedNode","quad","variable","supports"],kc="http://www.w3.org/1999/02/22-rdf-syntax-ns#rest";function xc(t,e,n){var r=[];return n.reduce((function(e,n,i,o){var s;return r.push(t.quad(e,t.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#first"),o[i])),i<o.length-1?(s=t.blankNode(),r.push(t.quad(e,t.namedNode(kc),s))):r.push(t.quad(e,t.namedNode(kc),t.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"))),s}),e),r}function _c(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=t.length;for(n<0&&(n=r+n);n<r;n++)if(t[n]===e)return n;return-1}function Ac(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return jc(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?jc(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function jc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var Cc=function(){ko(r,Co);var t,e,n=(t=r,e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var n,r=_o(t);if(e){var i=_o(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return xo(this,n)});function r(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};Eo(this,r),(t=n.call(this,"")).statements=e,t.constraints=i,t.initBindings=o,t.optional=s,Ao(So(t),"termType",Mo),Ao(So(t),"classOrder",jo.Graph),Ao(So(t),"fetcher",void 0),Ao(So(t),"isVar",0),Ao(So(t),"ns",fc),Ao(So(t),"rdfFactory",void 0),t.rdfFactory=a&&a.rdfFactory||sc;var u,c=Ac(Fc);try{var h=function(){var e=u.value;t[e]=function(){var n;return(n=t.rdfFactory)[e].apply(n,arguments)}};for(c.s();!(u=c.n()).done;)h()}catch(t){c.e(t)}finally{c.f()}return t}return bo(r,[{key:"add",value:function(t,e,n,r){var i=this;return 1===arguments.length&&t.forEach((function(t){return i.add(t.subject,t.predicate,t.object,t.graph)})),this.statements.push(this.rdfFactory.quad(t,e,n,r))}},{key:"addStatement",value:function(t){return this.add(t)}},{key:"bnode",value:function(t){return this.rdfFactory.blankNode(t)}},{key:"addAll",value:function(t){var e=this;t.forEach((function(t){e.add(t.subject,t.predicate,t.object,t.graph)}))}},{key:"any",value:function(t,e,n,r){var i=this.anyStatementMatching(t,e,n,r);return null==i?null:null==t?i.subject:null==e?i.predicate:null==n?i.object:null}},{key:"anyValue",value:function(t,e,n,r){var i=this.any(t,e,n,r);return i?i.value:void 0}},{key:"anyJS",value:function(t,e,n,r){var i=this.any(t,e,n,r);return i?Co.toJS(i):void 0}},{key:"anyStatementMatching",value:function(t,e,n,r){var i=this.statementsMatching(t,e,n,r,!0);if(i&&0!==i.length)return i[0]}},{key:"id",value:function(t){return this.rdfFactory.id(t)}},{key:"statementsMatching",value:function(t,e,n,r,i){var o=this.statements.filter((function(i){return(!t||t.equals(i.subject))&&(!e||e.equals(i.predicate))&&(!n||n.equals(i.object))&&(!r||r.equals(i.graph))}));return i?0===o.length?[]:[o[0]]:o}},{key:"bottomTypeURIs",value:function(t){var e,n,r,i,o,s;for(var a in e=[],t)if(t.hasOwnProperty(a)){for(s=t[a],n=!0,r=0,i=(o=this.each(void 0,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"),this.rdfFactory.namedNode(a))).length;r<i;r++)if(o[r].uri in t){n=!1;break}n&&(e[a]=s)}return e}},{key:"collection",value:function(){return new fs}},{key:"each",value:function(t,e,n,r){var i=[],o=this.statementsMatching(t,e,n,r,!1);if(null==t)for(var s=0,a=o.length;s<a;s++)i.push(o[s].subject);else if(null==e)for(var u=0,c=o.length;u<c;u++)i.push(o[u].predicate);else if(null==n)for(var h=0,f=o.length;h<f;h++)i.push(o[h].object);else if(null==r)for(var l=0,d=o.length;l<d;l++)i.push(new as(o[l].graph.value));return i}},{key:"equals",value:function(t){return!!t&&this.hashString()===t.hashString()}},{key:"findMembersNT",value:function(t){var e,n,r,i,o,s,a,u,c,h,f,l,d;for(var v in(f={})[t.toNT()]=!0,i={},o=this.transitiveClosure(f,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"),!0))if(o.hasOwnProperty(v)){for(var p=0,w=(s=this.statementsMatching(void 0,this.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),this.fromNT(v))).length;p<w;p++)i[(l=s[p]).subject.toNT()]=l;for(var y=0,m=(a=this.each(void 0,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#domain"),this.fromNT(v))).length;y<m;y++)for(r=0,e=(u=this.statementsMatching(void 0,a[y])).length;r<e;r++)i[(l=u[r]).subject.toNT()]=l;for(var g=0,b=(c=this.each(void 0,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#range"),this.fromNT(v))).length;g<b;g++)for(d=0,n=(h=this.statementsMatching(void 0,c[g])).length;d<n;d++)i[(l=h[d]).object.toNT()]=l}return i}},{key:"findMemberURIs",value:function(t){return this.NTtoURI(this.findMembersNT(t))}},{key:"findSubClassesNT",value:function(t){var e={};return e[t.toNT()]=!0,this.transitiveClosure(e,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"),!0)}},{key:"findSuperClassesNT",value:function(t){var e={};return e[t.toNT()]=!0,this.transitiveClosure(e,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"),!1)}},{key:"findTypesNT",value:function(t){var e,n,r,i,o,s;s=[];for(var a=0,u=(e=this.statementsMatching(t,void 0,void 0)).length;a<u;a++)if("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"===(o=e[a]).predicate.uri)s[o.object.toNT()]=o;else for(var c=0,h=(n=this.each(o.predicate,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#domain"))).length;c<h;c++)s[n[c].toNT()]=o;for(var f=0,l=(r=this.statementsMatching(void 0,void 0,t)).length;f<l;f++)for(var d=0,v=(i=this.each((o=r[f]).predicate,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#range"))).length;d<v;d++)s[i[d].toNT()]=o;return this.transitiveClosure(s,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"),!1)}},{key:"findTypeURIs",value:function(t){return this.NTtoURI(this.findTypesNT(t))}},{key:"connectedStatements",value:function(t,e,n){n=n||[];for(var r=[t],i={},o={},s=[],a=this,u=function(t){var u=function(t){"BlankNode"!==t.termType||i[t.value]||(i[t.value]=!0,r.push(t))},c=a.statementsMatching(null,null,t,e).concat(a.statementsMatching(t,null,null,e));(c=c.filter((function(t){if(n[t.predicate.value])return!1;var e=t.toNT();return!o[e]&&(o[e]=!0,!0)}))).forEach((function(t){u(t.subject),u(t.object)})),s=s.concat(c)};r.length;)u(r.shift());return s}},{key:"formula",value:function(){return new r}},{key:"fromNT",value:function(t){var e,n,r;switch(t[0]){case"<":return this.sym(t.slice(1,-1));case'"':if(r=void 0,e=void 0,(n=t.lastIndexOf('"'))<t.length-1)if("@"===t[n+1])r=t.slice(n+2);else{if("^^"!==t.slice(n+1,n+3))throw new Error("Can't convert string from NT: "+t);e=this.fromNT(t.slice(n+3))}return t=(t=(t=(t=t.slice(1,n)).replace(/\\"/g,'"')).replace(/\\n/g,"\n")).replace(/\\\\/g,"\\"),this.rdfFactory.literal(t,r||e);case"_":return this.rdfFactory.blankNode(t.slice(2));case"?":return new rc(t.slice(1))}throw new Error("Can't convert from NT: "+t)}},{key:"holds",value:function(t,e,n,r){var i;if(1===arguments.length){if(!t)return!0;if(t instanceof Array){for(i=0;i<t.length;i++)if(!this.holds(t[i]))return!1;return!0}if(Xo(t))return this.holds(t.subject,t.predicate,t.object,t.graph);if(t.statements)return this.holds(t.statements)}var o=this.anyStatementMatching(t,e,n,r);return null!=o}},{key:"holdsStatement",value:function(t){return this.holds(t.subject,t.predicate,t.object,t.graph)}},{key:"list",value:function(t,e){if(e.rdfFactory.supports.COLLECTIONS){var n=e.rdfFactory.collection();return t.forEach((function(t){n.append(t)})),n}var r=e.rdfFactory.blankNode(),i=xc(e.rdfFactory,r,t);return e.addAll(i),r}},{key:"NTtoURI",value:function(t){var e,n,r={};for(e in t)t.hasOwnProperty(e)&&(n=t[e],"<"===e[0]&&(r[e.slice(1,-1)]=n));return r}},{key:"serialize",value:function(t,e,n,r){return Sc(n,this,t,e,void 0,r)}},{key:"substitute",value:function(t){var e=this.statements.map((function(e){return e.substitute(t)}));console.log("Formula subs statmnts:"+e);var n=new r;return n.addAll(e),console.log("indexed-form subs formula:"+n),n}},{key:"sym",value:function(t,e){if(e)throw new Error("This feature (kb.sym with 2 args) is removed. Do not assume prefix mappings.");return this.rdfFactory.namedNode(t)}},{key:"the",value:function(t,e,n,r){var i=this.any(t,e,n,r);return null==i&&hc("No value found for the() {"+t+" "+e+" "+n+"}."),i}},{key:"transitiveClosure",value:function(t,e,n){var r,i,o,s,a,u={};Object.assign(u,t);for(var c={};;){if(null==(a=function(){for(var t in u)if(u.hasOwnProperty(t))return t}()))return c;for(r=0,i=(s=n?this.each(void 0,e,this.fromNT(a)):this.each(this.fromNT(a),e)).length;r<i;r++)(o=s[r].toNT())in c||o in u||(u[o]=u[a]);c[a]=u[a],delete u[a]}}},{key:"topTypeURIs",value:function(t){var e,n,r,i,o,s,a;for(n in s=[],t)if(t.hasOwnProperty(n)){for(a=t[n],i=0,e=0,r=(o=this.each(this.rdfFactory.namedNode(n),this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"))).length;e<r;e++)if("http://www.w3.org/2000/01/rdf-schema#Resource"!==o[e].uri){i++;break}i||(s[n]=a)}return s["http://www.w3.org/2000/01/rdf-schema#Resource"]&&delete s["http://www.w3.org/2000/01/rdf-schema#Resource"],s["http://www.w3.org/2002/07/owl#Thing"]&&delete s["http://www.w3.org/2002/07/owl#Thing"],s}},{key:"toString",value:function(){return"{"+this.statements.join("\n")+"}"}},{key:"variable",value:function(t){return new rc(t)}},{key:"whether",value:function(t,e,n,r){return this.statementsMatching(t,e,n,r,!1).length}}]),r}();Co.fromValue=hs;var Rc=Co,Tc={xsd:fc("http://www.w3.org/2001/XMLSchema#")};Co.toJS=function(t){return Qo(t)?t.elements.map(Co.toJS):rs(t)?t.datatype.equals(Tc.xsd("boolean"))?"1"===t.value||"true"===t.value:t.datatype.equals(Tc.xsd("dateTime"))||t.datatype.equals(Tc.xsd("date"))?new Date(t.value):t.datatype.equals(Tc.xsd("integer"))||t.datatype.equals(Tc.xsd("float"))||t.datatype.equals(Tc.xsd("decimal"))?Number(t.value):t.value:t};var Ic=bo((function t(e,n){Eo(this,t),this.pat=new Kc,this.vars=[],this.name=e,this.id=n}));function Oc(t,e,n,r){function i(t){var e,n="";for(e in t)t.hasOwnProperty(e)&&(n+=" "+e+" -> "+t[e]);return n}function o(t){var e,n="Bindings: ",r=t.length;for(e=0;e<r;e++)n+=i(t[e][0])+";\n\t";return n}function s(t,e,n,r){var i;if(t.length!==e.length)return[];if(!t.length)return[[[],null]];var o=function(t,e,n,r){var i=n[t];if(void 0===i){if(t.isVar){var o=[];return o[t]=e,[[o,null]]}i=t}if(!i.complexType)return r.redirections[i]&&(i=r.redirections[i]),r.redirections[e]&&(e=r.redirections[e]),i.equals(e)||i.uri&&i.uri===Ju?[[[],null]]:[];if(t instanceof Array)return e instanceof Array?s(t,e,n):[];throw new Error("query.js: oops - code not written yet")}(t[0],e[0],n,r);if(0===o.length)return o;var a,u,c,h,f,l,d,v=[],p=o.length;for(a=0;a<p;a++){for(f in d=[],u=o[a][0])u.hasOwnProperty(f)&&(d[f]=u[f]);for(f in n)n.hasOwnProperty(f)&&(d[f]=n[f]);for(h=(i=s(t.slice(1),e.slice(1),d,r)).length,c=0;c<h;c++){for(f in l=i[c][0],u)u.hasOwnProperty(f)&&(l[f]=u[f]);v.push([l,null])}}return v}function a(t,e){var n,r={};for(n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);for(n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);return r}function u(t,e){return this.trunkBindings=e,this.originalCallback=t,this.branches=[],this}function c(t,e){return this.count=0,this.success=!1,this.done=!1,this.callback=t,this.onDone=e,this}u.prototype.checkAllDone=function(){var t;for(t=0;t<this.branches.length;t++)if(!this.branches[t].done)return;ac("OPTIONAL BIDNINGS ALL DONE:"),this.doCallBacks(this.branches.length-1,this.trunkBindings)},u.prototype.doCallBacks=function(t,e){var n;if(t<0)return this.originalCallback(e);for(n=0;n<this.branches[t].results.length;n++)this.doCallBacks(t-1,a(e,this.branches[t].results[n]))},c.prototype.reportMatch=function(t){this.callback(t),this.success=!0},c.prototype.reportDone=function(){this.done=!0,cc("Mandatory query branch finished.***"),void 0!==this.onDone&&this.onDone()};var h=function(t){return this.count=0,this.done=!1,this.results=[],this.junction=t,t.branches.push(this),this};function f(t,e,n){var r,i,o,s,a,u;for(e.nvars=0,e.index=null,r=[e.subject,e.predicate,e.object,e.why],s=[t.subjectIndex,t.predicateIndex,t.objectIndex,t.whyIndex],o=0;o<4;o++){var c=r[o];if(c.uri&&c.uri===Ju);else if(c.isVar&&void 0===n[c])e.nvars++;else{if(void 0,t.redirections[t.id(c=void 0===(u=n[a=r[o]])?a:u)]&&(c=t.redirections[t.id(c)]),!(i=s[o][t.id(c)]))return e.index=[],!1;(null===e.index||e.index.length>i.length)&&(e.index=i)}}return null===e.index&&(e.index=t.statements),!0}function l(t,e){return t.nvars!==e.nvars?t.nvars-e.nvars:t.index.length-e.index.length}h.prototype.reportMatch=function(t){this.results.push(t)},h.prototype.reportDone=function(){ac("Optional branch finished - results.length = "+this.results.length),0===this.results.length&&(this.results.push({}),ac("Optional branch FAILED - that's OK.")),this.done=!0,this.junction.checkAllDone()};var d=function t(n,r,o,s,a,c,f){ac("Match begins, Branch count now: "+f.count+" for "+f.pattern_debug);var l,d,v=r.statements;if(0===v.length){if(ac("FOUND MATCH WITH BINDINGS:"+i(o)),0===r.optional.length)f.reportMatch(o);else{ac("OPTIONAL: "+r.optional);var w,y=new u(e,o),m=[];for(w=0;w<r.optional.length;w++)m[w]=new h(y),m[w].pattern_debug=r.optional[w];for(w=0;w<r.optional.length;w++)m[w].count=m[w].count+1,t(n,r.optional[w],o,"",a,e,m[w])}return f.count--,void ac("Match ends -- success , Branch count now: "+f.count+" for "+f.pattern_debug)}var g=v.length;if(a){var b=function(e){var i=e.uri.split("#")[0];a.nowOrWhenFetched(i,void 0,(function(i,u){i||console.log("Error following link to <"+e.uri+"> in query: "+u),t(n,r,o,s,a,c,f)}))};for(d=0;d<g;d++){if(void 0!==o[(l=v[d]).subject]&&o[l.subject].uri&&a&&"unrequested"===a.getState(Gu(o[l.subject].uri)))return void b(o[l.subject]);if(void 0!==o[l.object]&&o[l.object].uri&&a&&"unrequested"===a.getState(Gu(o[l.object].uri)))return void b(o[l.object])}}p(n,r,o,s,a,c,f)},v=function(t,e){var n,r,i=!0;for(n in t)t.hasOwnProperty(n)&&e[n]&&(r=e[n].test)&&!r(t[n])&&(i=!1);return i},p=function(t,e,n,r,a,u,c){var h,p,w,y,m,g,b,E=e.statements,S=E.length;for(h=0;h<S;h++)f(t,b=E[h],n);E.sort(l),b=E[0];var F,k=t.formula();k.optional=e.optional,k.constraints=e.constraints,k.statements=E.slice(1),ac(r+"match2 searching "+b.index.length+" for "+b+"; bindings so far="+i(n));var x,_,A=b.index.length,j=0;for(F=0;F<A;F++)for(x=s([b.subject,b.predicate,b.object,b.why],[(_=b.index[F]).subject,_.predicate,_.object,_.why],n,t),cc(r+" From first: "+x.length+": "+o(x)),w=x.length,p=0;p<w;p++)if(m=[],v(g=x[p][0],e.constraints)){for(y in g)g.hasOwnProperty(y)&&(m[y]=g[y]);for(y in n)n.hasOwnProperty(y)&&(m[y]=n[y]);c.count++,j++,d(t,k,m,r+" ",a,u,c)}else ac("Branch count CS: "+c.count);c.count--,0===j&&ac("Match2 fails completely on "+b),ac("Match2 ends, Branch count: "+c.count+" for "+c.pattern_debug),0===c.count&&(ac("Branch finished."),c.reportDone())},w=this;ac("Query on "+this.statements.length);var y=new c(e,r);y.count++,t.sync?d(w,t.pat,t.pat.initBindings,"",n,e,y):setTimeout((function(){d(w,t.pat,t.pat.initBindings,"",n,e,y)}),0)}function Nc(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Pc(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Nc(Object(n),!0).forEach((function(e){Ao(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Nc(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Dc(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Mc(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Mc(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Mc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var Uc="http://www.w3.org/2002/07/owl#";function Lc(t,e,n,r){var i=t.any(e,n,void 0);return!!i&&(t.equate(i,r),!0)}function Bc(t,e,n,r){var i=t.any(void 0,n,r);return!!i&&(t.equate(i,e),!0)}function Jc(t,e,n,r,i){t.typeCallback&&t.typeCallback(t,r,i);var o=t.classActions[t.id(r)],s=!1;if(o)for(var a=0;a<o.length;a++)s=s||o[a](t,e,n,r,i);return s}var Kc=function(){ko(r,Cc);var t,e,n=(t=r,e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var n,r=_o(t);if(e){var i=_o(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return xo(this,n)});function r(t){var e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Eo(this,r),Ao(So(e=n.call(this,void 0,void 0,void 0,void 0,i)),"updater",void 0),Ao(So(e),"namespaces",void 0),Ao(So(e),"classActions",void 0),Ao(So(e),"propertyActions",void 0),Ao(So(e),"redirections",void 0),Ao(So(e),"aliases",void 0),Ao(So(e),"HTTPRedirects",void 0),Ao(So(e),"subjectIndex",void 0),Ao(So(e),"predicateIndex",void 0),Ao(So(e),"objectIndex",void 0),Ao(So(e),"whyIndex",void 0),Ao(So(e),"index",void 0),Ao(So(e),"features",void 0),Ao(So(e),"_universalVariables",void 0),Ao(So(e),"_existentialVariables",void 0),Ao(So(e),"rdfArrayRemove",void 0),Ao(So(e),"dataCallbacks",void 0),e.propertyActions={},e.classActions={},e.redirections=[],e.aliases=[],e.HTTPRedirects=[],e.subjectIndex=[],e.predicateIndex=[],e.objectIndex=[],e.whyIndex=[],e.index=[e.subjectIndex,e.predicateIndex,e.objectIndex,e.whyIndex],e.namespaces={},e.features=t||[],e.rdfArrayRemove=i.rdfArrayRemove||mc,i.dataCallback&&(e.dataCallbacks=[i.dataCallback]),e.initPropertyActions(e.features),e}return bo(r,[{key:"substitute",value:function(t){var e=this.statements.map((function(e){return e.substitute(t)})),n=new r;return n.add(e),n}},{key:"addDataCallback",value:function(t){this.dataCallbacks||(this.dataCallbacks=[]),this.dataCallbacks.push(t)}},{key:"applyPatch",value:function(t,e,n){var r,i=this,o=null;function s(s){if(t.delete){r=t.delete,o&&(r=r.substitute(o));var a=[],u=(r=r.statements).map((function(t){var n=i.statementsMatching(t.subject,t.predicate,t.object,e);return 0===n.length?(a.push(t),null):n[0]}));if(a.length)return n("Could not find to delete: "+a.join("\n or "));u.map((function(t){i.remove(t)}))}t.insert&&(r=t.insert,o&&(r=r.substitute(o)),(r=r.statements).map((function(t){t.graph=e,i.add(t.subject,t.predicate,t.object,t.graph)}))),s()}if(t.where){var a=new Ic("patch");a.pat=t.where,a.pat.statements.map((function(t){t.graph=zh(e.value)})),a.sync=!0;var u=[];i.query(a,(function(t){u.push(t)}),i.fetcher,(function(){return 0===u.length?n("No match found to be patched:"+t.where):u.length>1?n("Patch ambiguous. No patch done."):(o=u[0],void s(n))}))}else s(n)}},{key:"declareExistential",value:function(t){return this._existentialVariables||(this._existentialVariables=[]),this._existentialVariables.push(t),t}},{key:"initPropertyActions",value:function(t){this.propertyActions[this.rdfFactory.id(this.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"))]=[Jc],_c(t,"sameAs")>=0&&(this.propertyActions[this.rdfFactory.id(this.rdfFactory.namedNode("".concat(Uc,"sameAs")))]=[function(t,e,n,r){return t.equate(e,r),!0}]),_c(t,"InverseFunctionalProperty")>=0&&(this.classActions[this.rdfFactory.id(this.rdfFactory.namedNode("".concat(Uc,"InverseFunctionalProperty")))]=[function(t,e){return t.newPropertyAction(e,Bc)}]),_c(t,"FunctionalProperty")>=0&&(this.classActions[this.rdfFactory.id(this.rdfFactory.namedNode("".concat(Uc,"FunctionalProperty")))]=[function(t,e){return t.newPropertyAction(e,Lc)}])}},{key:"addStatement",value:function(t){return this.add(t.subject,t.predicate,t.object,t.graph),this.statements.length}},{key:"add",value:function(t,e,n,r){var i,o,s;if(1===arguments.length){if(t instanceof Array)for(i=0;i<t.length;i++)this.add(t[i]);else is(t)?this.add(t.subject,t.predicate,t.object,t.graph):Yo(t)&&this.add(t.statements);return this}r||(r=this.fetcher?this.fetcher.appNode:this.rdfFactory.defaultGraph()),"string"==typeof t&&(t=this.rdfFactory.namedNode(t)),e=Rc.fromValue(e);var a=Rc.fromValue(n);if(r=Rc.fromValue(r),!ts(t))throw new Error("Subject is not a subject type");if(!es(e))throw new Error("Predicate ".concat(e," is not a predicate type"));if(!Zo(a))throw new Error("Object ".concat(a," is not an object type"));if(!ss(r))throw new Error("Why is not a graph type");this.predicateCallback&&this.predicateCallback(this,e,r);var u=this.id(this.canon(e)),c=!1;if(o=this.propertyActions[u])for(i=0;i<o.length;i++)c=c||o[i](this,t,e,a,r);if(this.holds(t,e,a,r))return null;var h=[this.id(this.canon(t)),u,this.id(this.canon(a)),this.id(this.canon(r))];for(s=this.rdfFactory.quad(t,e,a,r),i=0;i<4;i++){var f=this.index[i],l=h[i];f[l]||(f[l]=[]),f[l].push(s)}if(this.statements.push(s),this.dataCallbacks){var d,v=Dc(this.dataCallbacks);try{for(v.s();!(d=v.n()).done;){var p=d.value;p(s)}}catch(t){v.e(t)}finally{v.f()}}return s}},{key:"canon",value:function(t){if(!t)return t;var e=this.redirections[this.id(t)];if(e)return e;switch(t.termType){case To:return new Go(t.value);case Po:return t;case No:return new Ku;case Do:case Mo:return t;case Io:return new cs(t.value,t.language,t.datatype);case Ro:return new as(t.value);case Oo:return new rc(t.value);default:throw new Error("Term Type not recognized for canonization: ".concat(t.termType))}}},{key:"check",value:function(){this.checkStatementList(this.statements);for(var t=0;t<4;t++){var e=this.index[t];for(var n in e)e.hasOwnProperty(n)&&this.checkStatementList(e[n],t)}}},{key:"checkStatementList",value:function(t,e){void 0===e&&(e=0);for(var n,r=" found in "+["subject","predicate","object","why"][e]+" index.",i=0;i<t.length;i++){for(var o=[(n=t[i]).subject,n.predicate,n.object,n.graph],s=function(t,e){for(var n=0;n<t.length;n++)if(t[n].subject.equals(e.subject)&&t[n].predicate.equals(e.predicate)&&t[n].object.equals(e.object)&&t[n].why.equals(e.graph))return!0},a=0;a<4;a++){var u=this.canon(o[a]),c=this.id(u);this.index[a][c]&&s(this.index[a][c],n)}if(!s(this.statements,n))throw new Error("Statement list does not statement "+n+"@"+n.graph+r)}}},{key:"close",value:function(){return this}},{key:"compareTerms",value:function(t,e){return Object.prototype.hasOwnProperty.call(t,"compareTerm")?t.compareTerm(e):jo[t.termType]<jo[e.termType]?-1:jo[t.termType]>jo[e.termType]?1:t.value<e.value?-1:t.value>e.value?1:0}},{key:"copyTo",value:function(t,e,n){n||(n=[]);var r=this.statementsMatching(t);-1!==_c(n,"two-direction")&&r.concat(this.statementsMatching(void 0,void 0,t));for(var i=0;i<r.length;i++){var o=r[i];switch(o.object.termType){case"NamedNode":this.add(e,o.predicate,o.object);break;case"Literal":case"BlankNode":case"Collection":this.add(e,o.predicate,o.object.copy(this))}-1!==_c(n,"delete")&&this.remove(o)}}},{key:"equate",value:function(t,e){var n=this.canon(t),r=this.canon(e),i=this.compareTerms(n,r);return!i||(i<0?this.replaceWith(r,n):this.replaceWith(n,r))}},{key:"formula",value:function(t){return new r(t)}},{key:"length",get:function(){return this.statements.length}},{key:"match",value:function(t,e,n,r){return this.statementsMatching(Rc.fromValue(t),Rc.fromValue(e),Rc.fromValue(n),Rc.fromValue(r))}},{key:"mentionsURI",value:function(t){var e="<"+t+">";return!!this.subjectIndex[e]||!!this.objectIndex[e]||!!this.predicateIndex[e]}},{key:"newExistential",value:function(t){if(!t)return this.bnode();var e=this.sym(t);return this.declareExistential(e)}},{key:"newPropertyAction",value:function(t,e){var n=this.id(t);this.propertyActions[n]||(this.propertyActions[n]=[]),this.propertyActions[n].push(e);for(var r=this.statementsMatching(void 0,t,void 0),i=!1,o=0;o<r.length;o++)i=i||e(this,r[o].subject,t,r[o].object);return i}},{key:"newUniversal",value:function(t){var e=this.sym(t);return this._universalVariables||(this._universalVariables=[]),this._universalVariables.push(e),e}},{key:"variable",value:function(t){return new rc(t)}},{key:"nextSymbol",value:function(t){for(var e=0;;e++){var n=t.value+"#n"+e;if(!this.mentionsURI(n))return this.sym(n)}}},{key:"query",value:function(t,e,n,r){return Oc.call(this,t,e,n,r)}},{key:"querySync",value:function(t){var e=[],n=!1;if(t.sync=!0,Oc.call(this,t,(function(t){e.push(t)}),null,(function(){n=!0})),!n)throw new Error("Sync query should have called done function");return e}},{key:"remove",value:function(t){if(t instanceof Array){for(var e=0;e<t.length;e++)this.remove(t[e]);return this}if(Yo(t))return this.remove(t.statements);var n=this.statementsMatching(t.subject,t.predicate,t.object,t.graph);if(!n.length)throw new Error("Statement to be removed is not on store: "+t);return this.removeStatement(n[0]),this}},{key:"removeDocument",value:function(t){for(var e=this.statementsMatching(void 0,void 0,void 0,t).slice(),n=0;n<e.length;n++)this.removeStatement(e[n]);return this}},{key:"removeMany",value:function(t,e,n,r,i){for(var o=this.statementsMatching(t,e,n,r,!1),s=[],a=0;a<o.length;a++)s.push(o[a]);for(i&&(s=s.slice(0,i)),a=0;a<s.length;a++)this.remove(s[a])}},{key:"removeMatches",value:function(t,e,n,r){return this.removeMany(t,e,n,r),this}},{key:"removeStatement",value:function(t){for(var e=[t.subject,t.predicate,t.object,t.graph],n=0;n<4;n++){var r=this.canon(e[n]),i=this.id(r);this.index[n][i]&&this.rdfArrayRemove(this.index[n][i],t)}return this.rdfArrayRemove(this.statements,t),this}},{key:"removeStatements",value:function(t){for(var e=0;e<t.length;e++)this.remove(t[e]);return this}},{key:"replaceWith",value:function(t,e){for(var n=this.id(t),r=this.id(e),i=function(t){var e=t[n];if(e){var i=t[r];t[r]=i?e.concat(i):e,delete t[n]}},o=0;o<4;o++)i(this.index[o]);if(this.redirections[n]=e,t.value){if(this.aliases[r]||(this.aliases[r]=[]),this.aliases[r].push(t),this.aliases[n])for(o=0;o<this.aliases[n].length;o++)this.redirections[this.id(this.aliases[n][o])]=e,this.aliases[r].push(this.aliases[n][o]);this.add(e,this.sym("http://www.w3.org/2007/ont/link#uri"),t),this.fetcher&&this.fetcher.nowKnownAs(t,e)}return i(this.classActions),i(this.propertyActions),!0}},{key:"allAliases",value:function(t){var e=this.aliases[this.id(this.canon(t))]||[];return e.push(this.canon(t)),e}},{key:"sameThings",value:function(t,e){if(t.equals(e))return!0;var n=this.canon(t);if(!n)return!1;var r=this.canon(e);return!!r&&n.value===r.value}},{key:"setPrefixForURI",value:function(t,e){if(("tab"!==t||!this.namespaces.tab)&&"ns"!==t.slice(0,2)&&"default"!==t.slice(0,7)){for(var n in this.namespaces)this.namespaces[n]==e&&delete this.namespaces[n];this.namespaces[t]=e}}},{key:"statementsMatching",value:function(t,e,n,r,i){var o,s,a=[t,e,n,r],u=[],c=[],h=[];for(o=0;o<4;o++)u[o]=this.canon(Rc.fromValue(a[o])),u[o]&&(h.push(o),c[o]=this.id(u[o]));if(0===h.length)return this.statements;if(1===h.length)return(s=this.index[o=h[0]][c[o]])&&i&&s.length>1&&(s=s.slice(0,1)),s||[];var f,l,d=1e10;for(l=0;l<h.length;l++){if(!(s=this.index[o=h[l]][c[o]]))return[];s.length<d&&(d=s.length,f=l)}for(var v=h[f],p=this.index[v][c[v]],w=h.slice(0,f).concat(h.slice(f+1)),y=[],m=["subject","predicate","object","why"],g=0;g<p.length;g++){var b=p[g];for(l=0;l<w.length;l++)if(!this.canon(b[m[o=w[l]]]).equals(u[o])){b=null;break}if(null!=b&&(y.push(b),i))break}return y}},{key:"uris",value:function(t){var e=this.canon(t),n=this.aliases[this.id(e)];if(!e.value)return[];var r=[e.value];if(n)for(var i=0;i<n.length;i++)r.push(n[i].uri);return r}},{key:"serialize",value:function(t,e,n,r){var i,o=null!==(i=r)&&void 0!==i&&i.namespaces?Pc(Pc({},this.namespaces),r.namespaces):Pc({},this.namespaces);return Sc(n,this,t,e,void 0,r=Pc(Pc({},r||{}),{},{namespaces:o}))}}],[{key:"defaultGraphURI",get:function(){return Ju}}]),r}();Ao(Kc,"handleRDFType",void 0),Kc.handleRDFType=Jc;var Hc="http://www.w3.org/2000/10/swap/log#",$c=function(t){return t},Wc=function(t){return t},qc=function(t){if(t.length>0)throw"missing.js: oops nnonempty dict not imp";return[]},Vc=function(t){return t.length},Gc=function(t,e,n){if(void 0===t.slice)throw"@@ mising.js: No .slice function for "+t+" of type "+yo(t);return void 0===n||null==n?t.slice(e):t.slice(e,n)},zc=Error("dummy error stop iteration"),Xc=function(t){return this.last=0,this.li=t,this.next=function(){if(this.last==this.li.length)throw zc;return this.li[this.last++]},this},Yc=function(t,e){return t.indexOf(e)},Qc=function(t,e){if(!t){if(e)throw"python Assertion failed: "+e;throw"(python) Assertion failed."}};String.prototype.encode=function(t){if("utf-8"!=t)throw"UTF8_converter: can only do utf-8";return function(t){t=t.replace(/\r\n/g,"\n");for(var e="",n=0;n<t.length;n++){var r=t.charCodeAt(n);r<128?e+=String.fromCharCode(r):r>127&&r<2048?(e+=String.fromCharCode(r>>6|192),e+=String.fromCharCode(63&r|128)):(e+=String.fromCharCode(r>>12|224),e+=String.fromCharCode(r>>6&63|128),e+=String.fromCharCode(63&r|128))}return e}(this)},String.prototype.decode=function(t){if("utf-8"!=t)throw"UTF8_converter: can only do utf-8";return this};var Zc,th=function(t,e){return Yu(e,t)},eh="http://www.w3.org/2002/07/owl#sameAs",nh="\t\r\n !\"#$%&'()*.,+/;<=>?@[\\]^`{|}~",rh=nh+":",ih=new RegExp("^([-+]?[0-9]+)(\\.[0-9]+)?(e[-+]?[0-9]+)?","g"),oh=new RegExp("^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9](T[0-9][0-9]:[0-9][0-9](:[0-9][0-9](\\.[0-9]*)?)?)?Z?"),sh=new RegExp('[\\\\\\r\\n\\"]',"g"),ah=new RegExp("^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*","g"),uh=function(t,e,n,r,i,o,s,a){return new ch(t,e,n,r,i,o,s,a)},ch=function(){function t(e,n,r,i,o,s,a,u){Eo(this,t),void 0===n&&(n=null),void 0===r&&(r=""),void 0===i&&(i=null),void 0===o&&(o=""),void 0===a&&(a=""),void 0===u&&(u=null),this._bindings=new qc([]),this._flags=a,""!=r&&(Qc(r.indexOf(":")>=0,"Document URI not absolute: "+r),this._bindings[""]=r+"#"),this._store=e,o&&e.setGenPrefix(o),this._thisDoc=r,this.source=e.sym(r),this.lines=0,this.statementCount=0,this.startOfLine=0,this.previousLine=0,this._genPrefix=o,this.keywords=new Wc(["a","this","bind","has","is","of","true","false"]),this.keywordsSet=0,this._anonymousNodes=new qc([]),this._variables=new qc([]),this._parentVariables=new qc([]),this._reason=u,this._reason2=null,this._baseURI=i||r||null,Qc(!this._baseURI||this._baseURI.indexOf(":")>=0),this._genPrefix||(this._genPrefix=this._thisDoc?this._thisDoc+"#_g":RDFSink_uniqueURI()),this._formula=null==n?this._thisDoc?e.formula(r+"#_formula"):e.formula():n,this._context=this._formula,this._parentContext=null}return bo(t,[{key:"here",value:function(t){return this._genPrefix+"_L"+this.lines+"C"+(t-this.startOfLine+1)}},{key:"formula",value:function(){return this._formula}},{key:"loadStream",value:function(t){return this.loadBuf(t.read())}},{key:"loadBuf",value:function(t){return this.startDoc(),this.feed(t),this.endDoc()}},{key:"feed",value:function(t){for(var e=t.decode("utf-8"),n=0;n>=0;){var r=this.skipSpace(e,n);if(r<0)return;if((n=this.directiveOrStatement(e,r))<0)throw hh(this._thisDoc,this.lines,e,r,"expected directive or statement")}}},{key:"directiveOrStatement",value:function(t,e){var n,r=this.skipSpace(t,e);return r<0?r:(n=this.directive(t,r))>=0||(n=this.statement(t,r))>=0?this.checkDot(t,n):n}},{key:"tok",value:function(t,e,n){if("@"==e.slice(n,n+1))n+=1;else if(_c(this.keywords,t)<0)return-1;var r=n+Vc(t);return e.slice(n,r)==t&&nh.indexOf(e.charAt(r))>=0?r:-1}},{key:"directive",value:function(t,e){if((o=this.skipSpace(t,e))<0)return o;var n=new Wc([]);if((o=this.tok("bind",t,e))>0)throw hh(this._thisDoc,this.lines,t,e,"keyword bind is obsolete: use @prefix");if((o=this.tok("keywords",t,e))>0){if((e=this.commaSeparatedList(t,o,n,!1))<0)throw hh(this._thisDoc,this.lines,t,e,"'@keywords' needs comma separated list of words");return this.setKeywords(Gc(n,null,null)),e}if((o=this.tok("forAll",t,e))>0){if((e=this.commaSeparatedList(t,o,n,!0))<0)throw hh(this._thisDoc,this.lines,t,e,"Bad variable list after @forAll");var r=new Xc(n);try{for(;;){var i=r.next();(_c(this._variables,i)<0||_c(this._parentVariables,i)>=0)&&(this._variables[i]=this._context.newUniversal(i))}}catch(t){if(t!=zc)throw t}return e}if((o=this.tok("forSome",t,e))>0){if((e=this.commaSeparatedList(t,o,n,this.uri_ref2))<0)throw hh(this._thisDoc,this.lines,t,e,"Bad variable list after @forSome");r=new Xc(n);try{for(;;)i=r.next(),this._context.declareExistential(i)}catch(t){if(t!=zc)throw t}return e}if((o=this.tok("prefix",t,e))>=0){var o,s=new Wc([]);if((e=this.qname(t,o,s))<0)throw hh(this._thisDoc,this.lines,t,o,"expected qname after @prefix");if((o=this.uri_ref2(t,e,s))<0)throw hh(this._thisDoc,this.lines,t,e,"expected <uriref> after @prefix _qname_");var a=s[1].uri;return this._baseURI?a=th(this._baseURI,a):Qc(a.indexOf(":")>=0,"With no base URI, cannot handle relative URI for NS"),Qc(a.indexOf(":")>=0),this._bindings[s[0][0]]=a,this.bind(s[0][0],function(t){return encodeURI(t)}(a)),o}if((o=this.tok("base",t,e))>=0){if(s=new Wc([]),(e=this.uri_ref2(t,o,s))<0)throw hh(this._thisDoc,this.lines,t,o,"expected <uri> after @base ");if(a=s[0].uri,!this._baseURI)throw hh(this._thisDoc,this.lines,t,o,"With no previous base URI, cannot use relative URI in @base <"+a+">");return a=th(this._baseURI,a),Qc(a.indexOf(":")>=0),this._baseURI=a,e}return-1}},{key:"bind",value:function(t,e){""==t||this._store.setPrefixForURI(t,e)}},{key:"setKeywords",value:function(t){null==t?this.keywordsSet=0:(this.keywords=t,this.keywordsSet=1)}},{key:"startDoc",value:function(){}},{key:"endDoc",value:function(){return this._formula}},{key:"makeStatement",value:function(t){t[0].add(t[2],t[1],t[3],this.source),this.statementCount+=1}},{key:"statement",value:function(t,e){var n=new Wc([]);if((e=this.object(t,e,n))<0)return e;var r=this.property_list(t,e,n[0]);if(r<0)throw hh(this._thisDoc,this.lines,t,e,"expected propertylist");return r}},{key:"subject",value:function(t,e,n){return this.item(t,e,n)}},{key:"verb",value:function(t,e,n){if((i=this.skipSpace(t,e))<0)return i;var r=new Wc([]);if((i=this.tok("has",t,e))>=0){if((e=this.prop(t,i,r))<0)throw hh(this._thisDoc,this.lines,t,i,"expected property after 'has'");return n.push(new $c(["->",r[0]])),e}if((i=this.tok("is",t,e))>=0){var i;if((e=this.prop(t,i,r))<0)throw hh(this._thisDoc,this.lines,t,i,"expected <property> after 'is'");if((i=this.skipSpace(t,e))<0)throw hh(this._thisDoc,this.lines,t,e,"End of file found, expected property after 'is'");if((i=this.tok("of",t,e=i))<0)throw hh(this._thisDoc,this.lines,t,e,"expected 'of' after 'is' <prop>");return n.push(new $c(["<-",r[0]])),i}if((i=this.tok("a",t,e))>=0)return n.push(new $c(["->",this._store.sym("http://www.w3.org/1999/02/22-rdf-syntax-ns#type")])),i;if("<="==t.slice(e,e+2))return n.push(new $c(["<-",this._store.sym(Hc+"implies")])),e+2;if("="==t.slice(e,e+1))return">"==t.slice(e+1,e+2)?(n.push(new $c(["->",this._store.sym(Hc+"implies")])),e+2):(n.push(new $c(["->",this._store.sym(eh)])),e+1);if(":="==t.slice(e,e+2))return n.push(new $c(["->",Hc+"becomes"])),e+2;if((i=this.prop(t,e,r))>=0)return n.push(new $c(["->",r[0]])),i;if(">-"==t.slice(e,e+2)||"<-"==t.slice(e,e+2))throw hh(this._thisDoc,this.lines,t,i,">- ... -> syntax is obsolete.");return-1}},{key:"prop",value:function(t,e,n){return this.item(t,e,n)}},{key:"item",value:function(t,e,n){return this.path(t,e,n)}},{key:"blankNode",value:function(t){return this._context.bnode(t,this._reason2)}},{key:"path",value:function(t,e,n){if((o=this.nodeOrLiteral(t,e,n))<0)return o;for(;"!^.".indexOf(t.slice(o,o+1))>=0;){var r=t.slice(o,o+1);if("."==r){var i=t.slice(o+1,o+2);if(!i||rh.indexOf(i)>=0&&":?<[{(".indexOf(i)<0)break}var o,s=n.pop(),a=this.blankNode(this.here(o));if((o=this.node(t,o+1,n))<0)throw hh(this._thisDoc,this.lines,t,o,"EOF found in middle of path syntax");var u=n.pop();this.makeStatement(new $c("^"==r?[this._context,u,a,s]:[this._context,u,s,a])),n.push(a)}return o}},{key:"anonymousNode",value:function(t){if(e=this._anonymousNodes[t])return e;var e=this._store.bnode(t);return this._anonymousNodes[t]=e,e}},{key:"node",value:function(t,e,n,r){void 0===r&&(r=null);var i=r;if((h=this.skipSpace(t,e))<0)return h;var o=t.slice(e=h,e+1);if("["==o){var s=this.here(e);if((h=this.skipSpace(t,e+1))<0)throw hh(this._thisDoc,this.lines,t,e,"EOF after '['");if("="==t.slice(h,h+1)){e=h+1;var a=new Wc([]);if(!((h=this.objectList(t,e,a))>=0))throw hh(this._thisDoc,this.lines,t,e,"objectList expected after [= ");if(i=a[0],Vc(a)>1){var u=new Xc(a);try{for(;;){var c=u.next();this.makeStatement(new $c([this._context,this._store.sym(eh),i,c]))}}catch(t){if(t!=zc)throw t}}if((h=this.skipSpace(t,h))<0)throw hh(this._thisDoc,this.lines,t,e,"EOF when objectList expected after [ = ");if(";"==t.slice(h,h+1))var h=h+1}if(null==i&&(i=this.blankNode(s)),(e=this.property_list(t,h,i))<0)throw hh(this._thisDoc,this.lines,t,h,"property_list expected");if((h=this.skipSpace(t,e))<0)throw hh(this._thisDoc,this.lines,t,e,"EOF when ']' expected after [ <propertyList>");if("]"!=t.slice(h,h+1))throw hh(this._thisDoc,this.lines,t,h,"']' expected");return n.push(i),h+1}if("{"==o){if("$"==t.slice(e+1,e+2)){h=(e+=1)+1;for(var f=new Wc([]),l=!0;;){if((e=this.skipSpace(t,h))<0)throw hh(this._thisDoc,this.lines,t,e,"needed '$}', found end.");if("$}"==t.slice(e,e+2)){h=e+2;break}if(l)l=!1;else{if(","!=t.slice(e,e+1))throw hh(this._thisDoc,this.lines,t,e,"expected: ','");e+=1}var d=new Wc([]);if((h=this.item(t,e,d))<0)throw hh(this._thisDoc,this.lines,t,e,"expected item in set or '$}'");f.push(d[0])}return n.push(this._store.newSet(f,this._context)),h}h=e+1;var v=this._parentContext;this._parentContext=this._context;var p=this._anonymousNodes,w=this._parentVariables;this._parentVariables=this._variables,this._anonymousNodes=new qc([]),this._variables=this._variables.slice();var y=this._reason2;for(this._reason2=null,null==i&&(i=this._store.formula()),this._context=i;;){if((e=this.skipSpace(t,h))<0)throw hh(this._thisDoc,this.lines,t,e,"needed '}', found end.");if("}"==t.slice(e,e+1)){h=e+1;break}if((h=this.directiveOrStatement(t,e))<0)throw hh(this._thisDoc,this.lines,t,e,"expected statement or '}'")}return this._anonymousNodes=p,this._variables=this._parentVariables,this._parentVariables=w,this._context=this._parentContext,this._reason2=y,this._parentContext=v,n.push(i.close()),h}if("("==o){var m=this._store.list;for("$"==t.slice(e+1,e+2)&&(m=this._store.newSet,e+=1),h=e+1,f=new Wc([]);;){if((e=this.skipSpace(t,h))<0)throw hh(this._thisDoc,this.lines,t,e,"needed ')', found end.");if(")"==t.slice(e,e+1)){h=e+1;break}if(d=new Wc([]),(h=this.item(t,e,d))<0)throw hh(this._thisDoc,this.lines,t,e,"expected item in list or ')'");f.push(d[0])}return n.push(m(f,this._context)),h}if((h=this.tok("this",t,e))>=0)throw hh(this._thisDoc,this.lines,t,e,"Keyword 'this' was ancient N3. Now use @forSome and @forAll keywords.");return(h=this.tok("true",t,e))>=0?(n.push(!0),h):(h=this.tok("false",t,e))>=0?(n.push(!1),h):null==i&&(h=this.uri_ref2(t,e,n))>=0?h:-1}},{key:"property_list",value:function(t,e,n){for(;;){if((c=this.skipSpace(t,e))<0)throw hh(this._thisDoc,this.lines,t,e,"EOF found when expected verb in property list");if(":-"!=t.slice(c,c+2)){e=c;var r=new Wc([]);if((c=this.verb(t,e,r))<=0)return e;var i=new Wc([]);if((e=this.objectList(t,c,i))<0)throw hh(this._thisDoc,this.lines,t,c,"objectList expected");var o=new Xc(i);try{for(;;){var s=o.next(),a=r[0],u=a[1];this.makeStatement(new $c("->"==a[0]?[this._context,u,n,s]:[this._context,u,s,n]))}}catch(t){if(t!=zc)throw t}if((c=this.skipSpace(t,e))<0)throw hh(this._thisDoc,this.lines,t,c,"EOF found in list of objects");if(";"!=t.slice(e,e+1))return e;e+=1}else{e=c+2;var c,h=new Wc([]);if((c=this.node(t,e,h,n))<0)throw hh(this._thisDoc,this.lines,t,e,"bad {} or () or [] node after :- ");e=c}}}},{key:"commaSeparatedList",value:function(t,e,n,r){if((i=this.skipSpace(t,e))<0)throw hh(this._thisDoc,this.lines,t,i,"EOF found expecting comma sep list");if("."==t.charAt(i))return e;if(r)var i=this.uri_ref2(t,i,n);else i=this.bareWord(t,i,n);if(i<0)return-1;for(;;){if((e=this.skipSpace(t,i))<0)return e;var o=t.slice(e,e+1);if(","!=o)return"."!=o?-1:e;if((i=r?this.uri_ref2(t,e+1,n):this.bareWord(t,e+1,n))<0)throw hh(this._thisDoc,this.lines,t,i,"bad list content")}}},{key:"objectList",value:function(t,e,n){if((e=this.object(t,e,n))<0)return-1;for(;;){var r=this.skipSpace(t,e);if(r<0)throw hh(this._thisDoc,this.lines,t,r,"EOF found after object");if(","!=t.slice(r,r+1))return r;if((e=this.object(t,r+1,n))<0)return e}}},{key:"checkDot",value:function(t,e){var n=this.skipSpace(t,e);if(n<0)return n;if("."==t.slice(n,n+1))return n+1;if("}"==t.slice(n,n+1))return n;if("]"==t.slice(n,n+1))return n;throw hh(this._thisDoc,this.lines,t,n,"expected '.' or '}' or ']' at end of statement")}},{key:"uri_ref2",value:function(t,e,n){var r=new Wc([]);if((l=this.qname(t,e,r))>=0){var i=r[0],o=i[0],s=i[1];if(null==o){Qc(0,"not used?");var a=this._baseURI+"#"}else if(!(a=this._bindings[o])){if("_"==o)return n.push(this.anonymousNode(s)),l;throw hh(this._thisDoc,this.lines,t,e,"Prefix "+o+" not bound.")}var u=this._store.sym(a+s);return _c(this._variables,u)>=0?n.push(this._variables[u]):n.push(u),l}if((e=this.skipSpace(t,e))<0)return-1;if("?"==t.charAt(e)){var c=new Wc([]);return(l=this.variable(t,e,c))>0?(n.push(c[0]),l):-1}if("<"==t.charAt(e)){for(var h=e+=1;e<Vc(t);){if(">"==t.charAt(e)){var f=t.slice(h,e);return this._baseURI?f=th(this._baseURI,f):Qc(f.indexOf(":")>=0,"With no base URI, cannot deal with relative URIs"),"#"==t.slice(e-1,e)&&"#"!=Gc(f,-1,null)&&(f+="#"),u=this._store.sym(f),_c(this._variables,u)>=0?n.push(this._variables[u]):n.push(u),e+1}e+=1}throw hh(this._thisDoc,this.lines,t,l,"unterminated URI reference")}if(this.keywordsSet){var l;if(c=new Wc([]),(l=this.bareWord(t,e,c))<0)return-1;if(_c(this.keywords,c[0])>=0)throw hh(this._thisDoc,this.lines,t,e,'Keyword "'+c[0]+'" not allowed here.');return n.push(this._store.sym(this._bindings[""]+c[0])),l}return-1}},{key:"skipSpace",value:function(t,e){for(var n=e||0;n<t.length;n++){var r=t.charAt(n);if(" \n\r\t\f\v \u2028\u2029 ".indexOf(r)<0){if("#"!==t.charAt(n))return n;for(;;n++){if(n===t.length)return-1;if("\n"===t.charAt(n)){this.lines=this.lines+1;break}}}else"\n"===t.charAt(n)&&(this.lines=this.lines+1)}return-1}},{key:"variable",value:function(t,e,n){if((r=this.skipSpace(t,e))<0)return-1;if("?"!=t.slice(r,r+1))return-1;var r;if(e=r+=1,"0123456789-".indexOf(t.charAt(r))>=0)throw hh(this._thisDoc,this.lines,t,r,"Varible name can't start with '"+t.charAt(r)+"s'");for(;e<Vc(t)&&rh.indexOf(t.charAt(e))<0;)e+=1;if(null==this._parentContext)throw hh(this._thisDoc,this.lines,t,r,"Can't use ?xxx syntax for variable in outermost level: "+t.slice(r-1,e));return n.push(this._store.variable(t.slice(r,e))),e}},{key:"bareWord",value:function(t,e,n){var r=this.skipSpace(t,e);if(r<0)return-1;var i=t.charAt(r);if("0123456789-".indexOf(i)>=0)return-1;if(rh.indexOf(i)>=0)return-1;for(e=r;e<Vc(t)&&rh.indexOf(t.charAt(e))<0;)e+=1;return n.push(t.slice(r,e)),e}},{key:"qname",value:function(t,e,n){if((e=this.skipSpace(t,e))<0)return-1;var r=t.charAt(e);if("0123456789-+".indexOf(r)>=0)return-1;if(rh.indexOf(r)<0){var i=r;for(e+=1;e<Vc(t)&&(r=t.charAt(e),rh.indexOf(r)<0);)i+=r,e+=1}else i="";if(e<Vc(t)&&":"==t.charAt(e)){var o=i;for(e+=1,i="";e<Vc(t)&&(r=t.charAt(e),rh.indexOf(r)<0);)i+=r,e+=1;return n.push(new $c([o,i])),e}return i&&this.keywordsSet&&_c(this.keywords,i)<0?(n.push(new $c(["",i])),e):-1}},{key:"object",value:function(t,e,n){if((s=this.subject(t,e,n))>=0)return s;if((s=this.skipSpace(t,e))<0)return-1;var r=null,i=t.charAt(e=s);if('"'==i||"'"==i){r=t.slice(e,e+3==i+i)?i+i+i:i,e+=Vc(r);var o=this.strconst(t,e,r),s=o[0];return n.push(this._store.literal(o[1])),s}return-1}},{key:"nodeOrLiteral",value:function(t,e,n){if((f=this.node(t,e,n))>=0)return f;if((f=this.skipSpace(t,e))<0)return-1;var r=t.charAt(e=f);if("-+0987654321".indexOf(r)>=0){if(oh.lastIndex=0,null!=(h=oh.exec(t.slice(e))))f=e+(i=h[0]).length,i.indexOf("T")>=0?n.push(this._store.literal(i,this._store.sym("http://www.w3.org/2001/XMLSchema#dateTime"))):n.push(this._store.literal(i,this._store.sym("http://www.w3.org/2001/XMLSchema#date")));else{var i;if(ih.lastIndex=0,null==(h=ih.exec(t.slice(e))))throw hh(this._thisDoc,this.lines,t,e,"Bad number or date syntax");(i=t.slice(e,f=e+ih.lastIndex)).indexOf("e")>=0?n.push(this._store.literal(parseFloat(i),this._store.sym("http://www.w3.org/2001/XMLSchema#double"))):t.slice(e,f).indexOf(".")>=0?n.push(this._store.literal(parseFloat(i),this._store.sym("http://www.w3.org/2001/XMLSchema#decimal"))):n.push(this._store.literal(parseInt(i),this._store.sym("http://www.w3.org/2001/XMLSchema#integer")))}return f}if('"'==t.charAt(e)){if('"""'==t.slice(e,e+3))var o='"""';else o='"';e+=Vc(o);var s=null,a=this.strconst(t,e,o),u=a[1],c=null;if("@"==t.slice(f=a[0],f+1)){var h;if(ah.lastIndex=0,null==(h=ah.exec(t.slice(f+1))))throw hh(this._thisDoc,startline,t,e,"Bad language code syntax on string literal, after @");c=t.slice(f+1,e=ah.lastIndex+f+1);var f=e}if("^^"==t.slice(f,f+2)){var l=new Wc([]);f=this.uri_ref2(t,f+2,l),s=l[0]}return n.push(this._store.literal(u,c||s)),f}return-1}},{key:"strconst",value:function(t,e,n){for(var r=e,i="",o=this.lines;r<Vc(t);){if(e=r+Vc(n),t.slice(r,e)==n)return new $c([e,i]);if('"'!=t.charAt(r)){if(sh.lastIndex=0,!sh.exec(t.slice(r)))throw hh(this._thisDoc,o,t,r,"Closing quote missing in string at ^ in "+t.slice(r-20,r)+"^"+t.slice(r,r+20));if(i+=t.slice(r,e=r+sh.lastIndex-1),'"'!=(u=t.charAt(e)))if("\r"!=u){if("\n"==u){if('"'==n)throw hh(this._thisDoc,o,t,e,"newline found in string literal");this.lines=this.lines+1,i+=u,r=e+1,this.previousLine=this.startOfLine,this.startOfLine=r}else if("\\"==u){if(!(u=t.slice(r=e+1,r+1)))throw hh(this._thisDoc,o,t,e,"unterminated string literal (2)");var s=Yc('abfrtvn\\"',u);if(s>=0)i+='a\b\f\r\t\v\n\\"'.charAt(s),r+=1;else if("u"==u)r=(a=this.uEscape(t,r+1,o))[0],i+=u=a[1];else{if("U"!=u)throw hh(this._thisDoc,this.lines,t,e,"bad escape");var a,u;r=(a=this.UEscape(t,r+1,o))[0],i+=u=a[1]}}}else r=e+1;else r=e}else i=i+'"',r=r+1}throw hh(this._thisDoc,this.lines,t,e,"unterminated string literal")}},{key:"uEscape",value:function(t,e,n){for(var r=e,i=0,o=0;i<4;){var s=t.slice(r,r+1).toLowerCase();if(r+=1,""==s)throw hh(this._thisDoc,n,t,e,"unterminated string literal(3)");var a=Yc("0123456789abcdef",s);if(a<0)throw hh(this._thisDoc,n,t,e,"bad string literal hex escape");o=16*o+a,i+=1}var u=String.fromCharCode(o);return new $c([r,u])}},{key:"UEscape",value:function(t,e,n){for(var r=e,i=0,o="\\U";i<8;){var s=t.slice(r,r+1).toLowerCase();if(r+=1,""==s)throw hh(this._thisDoc,n,t,e,"unterminated string literal(3)");if(Yc("0123456789abcdef",s)<0)throw hh(this._thisDoc,n,t,e,"bad string literal hex escape");o+=s,i+=1}var a,u=(a="0x"+Gc(o,2,10)-0,String.fromCharCode(a));return new $c([r,u])}}]),t}();function hh(t,e,n,r,i){var o=e+1,s="Line "+o+" of <"+t+">: Bad syntax: "+i+'\nat: "'+n.slice(r,r+30)+'"',a=new SyntaxError(s,t,o);return a.lineNo=o,a.characterInFile=r,a.syntaxProblem=i,a}function fh(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function lh(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?fh(Object(n),!0).forEach((function(e){Ao(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):fh(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var dh,vh=lh(lh({},sc),{},{supports:(Zc={},Ao(Zc,tc.collections,!0),Ao(Zc,tc.defaultGraphType,!1),Ao(Zc,tc.equalsMethod,!0),Ao(Zc,tc.identity,!1),Ao(Zc,tc.id,!0),Ao(Zc,tc.reversibleId,!1),Ao(Zc,tc.variableType,!0),Zc),collection:function(t){return new fs(t)},id:function(t){var e,n=this;return Qo(t)?"( ".concat(t.elements.map((function(t){return n.id(t)})).join(", ")," )"):ns(e=t)&&e.termType===Oo?rc.toString(t):sc.id(t)},termToNQ:function(t){return t.termType===Po?fs.toNT(t):sc.termToNQ(t)}}),ph=F(ro());function wh(t,e){return"string"==typeof e?t.rdfFactory.literal(e):Object.prototype.hasOwnProperty.call(e,"@list")?!0===t.rdfFactory.supports.COLLECTIONS?function(t,e){if(!Array.isArray(e))throw new TypeError("Object must be an array");return t.rdfFactory.collection(e.map((function(e){return wh(t,e)})))}(t,e["@list"]):function(t,e){var n=e["@id"]?t.rdfFactory.namedNode(e["@id"]):t.rdfFactory.blankNode(),r=e["@list"].map((function(e){return wh(t,e)})),i=xc(t.rdfFactory,n,r);return t.addAll(i),n}(t,e):Object.prototype.hasOwnProperty.call(e,"@id")?t.rdfFactory.namedNode(e["@id"]):Object.prototype.hasOwnProperty.call(e,"@language")?t.rdfFactory.literal(e["@value"],e["@language"]):Object.prototype.hasOwnProperty.call(e,"@type")?t.rdfFactory.literal(e["@value"],t.rdfFactory.namedNode(e["@type"])):Object.prototype.hasOwnProperty.call(e,"@value")?t.rdfFactory.literal(e["@value"]):t.rdfFactory.literal(e)}function yh(t,e,n,r){var i=n&&Object.prototype.hasOwnProperty.call(n,"termType")?n.value:n;return ph.default.flatten(JSON.parse(t),null,{base:i}).then((function(t){return t.reduce((function(t,r){return e=mh(e,n,r)}),e)})).then(r).catch(r)}function mh(t,e,n){for(var r=n["@id"]?t.rdfFactory.namedNode(n["@id"]):t.rdfFactory.blankNode(),i=0,o=Object.keys(n);i<o.length;i++){var s=o[i];if("@id"!==s){if("@graph"==s)for(var a=r,u=n[s],c=0;c<u.length;c++)t=mh(t,a,u[c]);var h=n[s];if(Array.isArray(h))for(var f=0;f<h.length;f++)t.addStatement(gh(t,r,s,h[f],e));else t.addStatement(gh(t,r,s,h,e))}}return t}function gh(t,e,n,r,i){var o,s;return"@type"===n?(o=t.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),s=t.rdfFactory.namedNode(r)):(o=t.rdfFactory.namedNode(n),s=wh(t,r)),t.rdfFactory.quad(e,o,s,t.rdfFactory.namedNode(i))}void 0===dh&&(dh={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12});var bh=function(){function t(e,n){Eo(this,t),this.options=n||{},this.kb=e,this.target=n.target||{graph:{subjects:{},prefixes:{},terms:{}}},this.blankNodes=[],this.htmlOptions={selfClosing:"br img input area base basefont col colgroup source wbr isindex link meta param hr"},this.theOne="_:"+(new Date).getTime(),this.language=null,this.vocabulary=null,this.blankCounter=0,this.langAttributes=[{namespaceURI:"http://www.w3.org/XML/1998/namespace",localName:"lang"}],this.inXHTMLMode=!1,this.absURIRE=/[\w\_\-]+:\S+/,this.finishedHandlers=[],this.init()}return bo(t,[{key:"addTriple",value:function(t,e,n,r){var i,o,s,a;i=void 0===e?sc.namedNode(this.options.base):this.toRDFNodeObject(e),s=this.toRDFNodeObject(n),o=this.toRDFNodeObject(r),a=sc.namedNode(this.options.base),this.kb.add(i,s,o,a)}},{key:"ancestorPath",value:function(t){for(var e="";t&&t.nodeType!==dh.DOCUMENT_NODE;)e="/"+t.localName+e,t=t.parentNode;return e}},{key:"copyMappings",value:function(t){var e={};for(var n in t)e[n]=t[n];return e}},{key:"copyProperties",value:function(){}},{key:"deriveDateTimeType",value:function(e){for(var n=0;n<t.dateTimeTypes.length;n++){var r=t.dateTimeTypes[n].pattern.exec(e);if(r&&r[0].length===e.length)return t.dateTimeTypes[n].type}return null}},{key:"init",value:function(){}},{key:"newBlankNode",value:function(){return this.blankCounter++,"_:"+this.blankCounter}},{key:"newSubjectOrigin",value:function(){}},{key:"parseCURIE",value:function(e,n){var r,i=e.indexOf(":");if(i>=0){var o=e.substring(0,i);if(""===o)return(r=n[""])?r+e.substring(i+1):null;if("_"===o)return"_:"+e.substring(i+1);if(t.NCNAME.test(o)&&(r=n[o]))return r+e.substring(i+1)}return null}},{key:"parseCURIEOrURI",value:function(t,e,n){return this.parseCURIE(t,e,n)||this.resolveAndNormalize(n,t)}},{key:"parsePredicate",value:function(t,e,n,r,i,o){if(""===t)return null;var s=this.parseTermOrCURIEOrAbsURI(t,e,o?null:n,r,i);return s&&0===s.indexOf("_:")?null:s}},{key:"parsePrefixMappings",value:function(t,e){for(var n=this.tokenize(t),r=null,i=0;i<n.length;i++)":"===n[i][n[i].length-1]?r=n[i].substring(0,n[i].length-1):r&&(e[r]=this.options.base?Yu(n[i],this.options.base):n[i],r=null)}},{key:"parseSafeCURIEOrCURIEOrURI",value:function(t,e,n){return"["===(t=this.trim(t)).charAt(0)&&"]"===t.charAt(t.length-1)?0===(t=(t=t.substring(1,t.length-1)).trim(t)).length?null:"_:"===t?this.theOne:this.parseCURIE(t,e,n):this.parseCURIEOrURI(t,e,n)}},{key:"parseTermOrCURIEOrAbsURI",value:function(t,e,n,r,i){t=this.trim(t);var o=this.parseCURIE(t,r,i);if(o)return o;if(n){if(e&&!this.absURIRE.exec(t))return e+t;var s=n[t];if(s)return s;if(s=n[t.toLowerCase()])return s}return this.absURIRE.exec(t)?this.resolveAndNormalize(i,t):null}},{key:"parseTermOrCURIEOrURI",value:function(t,e,n,r,i){t=this.trim(t);var o=this.parseCURIE(t,r,i);if(o)return o;var s=n[t];return s||((s=n[t.toLowerCase()])?s:e&&!this.absURIRE.exec(t)?e+t:this.resolveAndNormalize(i,t))}},{key:"parseURI",value:function(t){return t}},{key:"process",value:function(e,n){var r;n=n||{},e.nodeType===dh.DOCUMENT_NODE?(e.baseURI&&!n.baseURI&&(n.baseURI=e.baseURI),r=e.baseURI,(e=e.documentElement).baseURI||(e.baseURI=r),this.setContext(e)):e.parentNode.nodeType===dh.DOCUMENT_NODE&&this.setContext(e);var i=[],o=function(t){if(!t&&n&&n.baseURI)return n.baseURI;var e=t.indexOf("#");return e>=0&&(t=t.substring(0,e)),n&&n.baseURIMap&&(t=n.baseURIMap(t)),t};for(i.push({current:e,context:this.push(null,o(e.baseURI))});i.length>0;){var s=i.shift();if(s.parent){if(s.context.parent&&s.context.parent.listMapping===s.listMapping)continue;for(var a in s.listMapping){var u=s.listMapping[a];if(0!==u.length){for(var c=[],h=0;h<u.length;h++)c.push(this.newBlankNode());for(var f=0;f<c.length;f++)this.addTriple(s.parent,c[f],"http://www.w3.org/1999/02/22-rdf-syntax-ns#first",u[f]),this.addTriple(s.parent,c[f],"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest",{type:t.objectURI,value:f+1<c.length?c[f+1]:"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"});this.addTriple(s.parent,s.subject,a,{type:t.objectURI,value:c[0]})}else this.addTriple(s.parent,s.subject,a,{type:t.objectURI,value:"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"})}}else{var l=s.current,d=s.context,v=!1,p=null,w=null,y=null,m=d.prefixes,g=!1,b=[],E=d.listMapping,S=!d.parent,F=d.language,k=d.vocabulary;r=this.parseURI(o(l.baseURI)),l.item=null;var x=l.getAttributeNode("vocab");if(x){var _=this.trim(x.value);_.length>0?this.addTriple(l,r.spec,"http://www.w3.org/ns/rdfa#usesVocabulary",{type:t.objectURI,value:k=_}):k=this.vocabulary}for(var A=0;A<l.attributes.length;A++){var j=l.attributes[A];if("x"===j.nodeName.charAt(0)&&0===j.nodeName.indexOf("xmlns:")){g||(m=this.copyMappings(m),g=!0);var C=j.nodeName.substring(6),R=t.trim(j.value);m[C]=this.options.base?Yu(R,this.options.base):R}}var T=l.getAttributeNode("prefix");T&&(g||(m=this.copyMappings(m),g=!0),this.parsePrefixMappings(T.value,m));for(var I=null,O=0;!I&&O<this.langAttributes.length;O++)I=l.getAttributeNodeNS(this.langAttributes[O].namespaceURI,this.langAttributes[O].localName);if(I){var N=t.trim(I.value);F=N.length>0?N:null}var P,D,M=l.getAttributeNode("rel"),U=l.getAttributeNode("rev"),L=l.getAttributeNode("typeof"),B=l.getAttributeNode("property"),J=l.getAttributeNode("datatype"),K=this.inHTMLMode?l.getAttributeNode("datetime"):null,H=l.getAttributeNode("content"),$=l.getAttributeNode("about"),W=l.getAttributeNode("src"),q=l.getAttributeNode("resource"),V=l.getAttributeNode("href"),G=l.getAttributeNode("inlist"),z=[];if(M){D=this.tokenize(M.value);for(var X=0;X<D.length;X++)(P=this.parsePredicate(D[X],k,d.terms,m,r,this.inHTMLMode&&null!==B))&&z.push(P)}var Y=[];if(U){D=this.tokenize(U.value);for(var Q=0;Q<D.length;Q++)(P=this.parsePredicate(D[Q],k,d.terms,m,r,this.inHTMLMode&&B))&&Y.push(P)}if(this.inHTMLMode&&(M||U)&&B&&(0===z.length&&(M=null),0===Y.length&&(U=null)),M||U?($&&(p=this.parseSafeCURIEOrCURIEOrURI($.value,m,r)),L&&(y=p),p||(l.parentNode.nodeType===dh.DOCUMENT_NODE?p=o(l.baseURI):d.parentObject&&(p=o(l.parentNode.baseURI)===d.parentObject?o(l.baseURI):d.parentObject)),q&&(w=this.parseSafeCURIEOrCURIEOrURI(q.value,m,r)),w||(V?w=this.resolveAndNormalize(r,encodeURI(V.value)):W?w=this.resolveAndNormalize(r,encodeURI(W.value)):!L||$||this.inXHTMLMode&&("head"===l.localName||"body"===l.localName)||(w=this.newBlankNode())),!L||$||!this.inXHTMLMode||"head"!==l.localName&&"body"!==l.localName?L&&!$&&(y=w):y=p):!B||H||J?($&&(p=this.parseSafeCURIEOrCURIEOrURI($.value,m,r)),!p&&q&&(p=this.parseSafeCURIEOrCURIEOrURI(q.value,m,r)),!p&&V&&(p=this.resolveAndNormalize(r,encodeURI(V.value))),!p&&W&&(p=this.resolveAndNormalize(r,encodeURI(W.value))),p||(l.parentNode.nodeType===dh.DOCUMENT_NODE?p=o(l.baseURI):!this.inXHTMLMode&&!this.inHTMLMode||"head"!==l.localName&&"body"!==l.localName?L?p=this.newBlankNode():d.parentObject&&(p=o(l.parentNode.baseURI)===d.parentObject?o(l.baseURI):d.parentObject,B||(v=!0)):p=o(l.parentNode.baseURI)===d.parentObject?o(l.baseURI):d.parentObject),L&&(y=p)):($&&(p=this.parseSafeCURIEOrCURIEOrURI($.value,m,r),L&&(y=p)),p||l.parentNode.nodeType!==dh.DOCUMENT_NODE?!p&&d.parentObject&&(p=o(l.parentNode.baseURI)===d.parentObject?o(l.baseURI):d.parentObject):(p=o(l.baseURI),L&&(y=p)),L&&!y&&(q&&(y=this.parseSafeCURIEOrCURIEOrURI(q.value,m,r)),!y&&V&&(y=this.resolveAndNormalize(r,encodeURI(V.value))),!y&&W&&(y=this.resolveAndNormalize(r,encodeURI(W.value))),y||!this.inXHTMLMode&&!this.inHTMLMode||"head"!==l.localName&&"body"!==l.localName||(y=p),y||(y=this.newBlankNode()),w=y)),p&&($||q||y)){var Z=p;L&&!$&&!q&&w&&(Z=w),this.newSubjectOrigin(l,Z)}if(y){D=this.tokenize(L.value);for(var tt=0;tt<D.length;tt++){var et=this.parseTermOrCURIEOrAbsURI(D[tt],k,d.terms,m,r);et&&this.addTriple(l,y,t.typeURI,{type:t.objectURI,value:et})}}if(p&&p!==d.parentObject&&(E={},S=!0),w){if(M&&G)for(var nt=0;nt<z.length;nt++){var rt=E[z[nt]];rt||(E[z[nt]]=rt=[]),rt.push({type:t.objectURI,value:w})}else if(M)for(var it=0;it<z.length;it++)this.addTriple(l,p,z[it],{type:t.objectURI,value:w});if(U)for(var ot=0;ot<Y.length;ot++)this.addTriple(l,w,Y[ot],{type:t.objectURI,value:p})}else{if(p&&!w&&(M||U)&&(w=this.newBlankNode()),M&&G)for(var st=0;st<z.length;st++){var at=E[z[st]];at||(E[P]=at=[]),b.push({predicate:z[st],list:at})}else if(M)for(var ut=0;ut<z.length;ut++)b.push({predicate:z[ut],forward:!0});if(U)for(var ct=0;ct<Y.length;ct++)b.push({predicate:Y[ct],forward:!1})}if(B){var ht=null,ft=null;J?(ht=""===J.value?t.PlainLiteralURI:this.parseTermOrCURIEOrAbsURI(J.value,k,d.terms,m,r),ft=K&&!H?K.value:ht===t.XMLLiteralURI||ht===t.HTMLLiteralURI?null:H?H.value:l.textContent):H?(ht=t.PlainLiteralURI,ft=H.value):K?(ht=t.deriveDateTimeType(ft=K.value))||(ht=t.PlainLiteralURI):M||U||(q&&(ft=this.parseSafeCURIEOrCURIEOrURI(q.value,m,r)),!ft&&V?ft=this.resolveAndNormalize(r,encodeURI(V.value)):!ft&&W&&(ft=this.resolveAndNormalize(r,encodeURI(W.value))),ft&&(ht=t.objectURI)),ht||(L&&!$?(ht=t.objectURI,ft=y):(ft=l.textContent,this.inHTMLMode&&"time"===l.localName&&(ht=t.deriveDateTimeType(ft)),ht||(ht=t.PlainLiteralURI))),D=this.tokenize(B.value);for(var lt=0;lt<D.length;lt++){var dt=this.parsePredicate(D[lt],k,d.terms,m,r);if(dt)if(G){var vt=E[dt];vt||(E[dt]=vt=[]),vt.push(ht===t.XMLLiteralURI||ht===t.HTMLLiteralURI?{type:ht,value:l.childNodes}:{type:ht||t.PlainLiteralURI,value:ft,language:F})}else this.addTriple(l,p,dt,ht===t.XMLLiteralURI||ht===t.HTMLLiteralURI?{type:ht,value:l.childNodes}:{type:ht||t.PlainLiteralURI,value:ft,language:F})}}if(p&&!v)for(var pt=0;pt<d.incomplete.length;pt++)d.incomplete[pt].list?d.incomplete[pt].list.push({type:t.objectURI,value:p}):d.incomplete[pt].forward?this.addTriple(l,d.subject,d.incomplete[pt].predicate,{type:t.objectURI,value:p}):this.addTriple(l,p,d.incomplete[pt].predicate,{type:t.objectURI,value:d.subject});var wt=null,yt=p;v?((wt=this.push(d,d.subject)).parentObject=o(l.parentNode.baseURI)===d.parentObject?o(l.baseURI):d.parentObject,wt.incomplete=d.incomplete,wt.language=F,wt.prefixes=m,wt.vocabulary=k):((wt=this.push(d,p)).parentObject=w||p||d.subject,wt.prefixes=m,wt.incomplete=b,w&&(yt=w,E={},S=!0),wt.listMapping=E,wt.language=F,wt.vocabulary=k),S&&i.unshift({parent:l,context:d,subject:yt,listMapping:E});for(var mt=l.lastChild;mt;mt=mt.previousSibling)mt.nodeType===dh.ELEMENT_NODE&&i.unshift({current:mt,context:wt})}}this.inHTMLMode&&this.copyProperties();for(var gt=0;gt<this.finishedHandlers.length;gt++)this.finishedHandlers[gt](e)}},{key:"push",value:function(t,e){return{parent:t,subject:e||(t?t.subject:null),parentObject:null,incomplete:[],listMapping:t?t.listMapping:{},language:t?t.language:this.language,prefixes:t?t.prefixes:this.target.graph.prefixes,terms:t?t.terms:this.target.graph.terms,vocabulary:t?t.vocabulary:this.vocabulary}}},{key:"resolveAndNormalize",value:function(t,e){return Yu(e,t)}},{key:"setContext",value:function(t){"html"===t.localName&&"XHTML+RDFa 1.1"===t.getAttribute("version")?this.setXHTMLContext():"html"===t.localName||"http://www.w3.org/1999/xhtml"===t.namespaceURI?"undefined"!=typeof document&&document.doctype?"-//W3C//DTD XHTML+RDFa 1.0//EN"===document.doctype.publicId&&"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"===document.doctype.systemId?(console.log("WARNING: RDF 1.0 is not supported. Defaulting to HTML5 mode."),this.setHTMLContext()):"-//W3C//DTD XHTML+RDFa 1.1//EN"===document.doctype.publicId&&"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd"===document.doctype.systemId?this.setXHTMLContext():this.setHTMLContext():this.setHTMLContext():this.setXMLContext()}},{key:"setHTMLContext",value:function(){this.setInitialContext(),this.langAttributes=[{namespaceURI:"http://www.w3.org/XML/1998/namespace",localName:"lang"},{namespaceURI:null,localName:"lang"}],this.inXHTMLMode=!1,this.inHTMLMode=!0}},{key:"setInitialContext",value:function(){this.vocabulary=null,this.langAttributes=[{namespaceURI:"http://www.w3.org/XML/1998/namespace",localName:"lang"}]}},{key:"setXHTMLContext",value:function(){this.setInitialContext(),this.inXHTMLMode=!0,this.inHTMLMode=!1,this.langAttributes=[{namespaceURI:"http://www.w3.org/XML/1998/namespace",localName:"lang"},{namespaceURI:null,localName:"lang"}],this.target.graph.terms.alternate="http://www.w3.org/1999/xhtml/vocab#alternate",this.target.graph.terms.appendix="http://www.w3.org/1999/xhtml/vocab#appendix",this.target.graph.terms.bookmark="http://www.w3.org/1999/xhtml/vocab#bookmark",this.target.graph.terms.cite="http://www.w3.org/1999/xhtml/vocab#cite",this.target.graph.terms.chapter="http://www.w3.org/1999/xhtml/vocab#chapter",this.target.graph.terms.contents="http://www.w3.org/1999/xhtml/vocab#contents",this.target.graph.terms.copyright="http://www.w3.org/1999/xhtml/vocab#copyright",this.target.graph.terms.first="http://www.w3.org/1999/xhtml/vocab#first",this.target.graph.terms.glossary="http://www.w3.org/1999/xhtml/vocab#glossary",this.target.graph.terms.help="http://www.w3.org/1999/xhtml/vocab#help",this.target.graph.terms.icon="http://www.w3.org/1999/xhtml/vocab#icon",this.target.graph.terms.index="http://www.w3.org/1999/xhtml/vocab#index",this.target.graph.terms.last="http://www.w3.org/1999/xhtml/vocab#last",this.target.graph.terms.license="http://www.w3.org/1999/xhtml/vocab#license",this.target.graph.terms.meta="http://www.w3.org/1999/xhtml/vocab#meta",this.target.graph.terms.next="http://www.w3.org/1999/xhtml/vocab#next",this.target.graph.terms.prev="http://www.w3.org/1999/xhtml/vocab#prev",this.target.graph.terms.previous="http://www.w3.org/1999/xhtml/vocab#previous",this.target.graph.terms.section="http://www.w3.org/1999/xhtml/vocab#section",this.target.graph.terms.stylesheet="http://www.w3.org/1999/xhtml/vocab#stylesheet",this.target.graph.terms.subsection="http://www.w3.org/1999/xhtml/vocab#subsection",this.target.graph.terms.start="http://www.w3.org/1999/xhtml/vocab#start",this.target.graph.terms.top="http://www.w3.org/1999/xhtml/vocab#top",this.target.graph.terms.up="http://www.w3.org/1999/xhtml/vocab#up",this.target.graph.terms.p3pv1="http://www.w3.org/1999/xhtml/vocab#p3pv1",this.target.graph.terms.related="http://www.w3.org/1999/xhtml/vocab#related",this.target.graph.terms.role="http://www.w3.org/1999/xhtml/vocab#role",this.target.graph.terms.transformation="http://www.w3.org/1999/xhtml/vocab#transformation"}},{key:"setXMLContext",value:function(){this.setInitialContext(),this.inXHTMLMode=!1,this.inHTMLMode=!1}},{key:"tokenize",value:function(t){return this.trim(t).split(/\s+/)}},{key:"toRDFNodeObject",value:function(e){var n=this;if(void 0!==e){if("string"==typeof e)return"_:"===e.substring(0,2)?(void 0===this.blankNodes[e.substring(2)]&&(this.blankNodes[e.substring(2)]=new Go(e.substring(2))),this.blankNodes[e.substring(2)]):sc.namedNode(e);switch(e.type){case t.objectURI:return"_:"===e.value.substring(0,2)?(void 0===this.blankNodes[e.value.substring(2)]&&(this.blankNodes[e.value.substring(2)]=new Go(e.value.substring(2))),this.blankNodes[e.value.substring(2)]):sc.namedNode(e.value);case t.PlainLiteralURI:return new cs(e.value,e.language||"");case t.XMLLiteralURI:case t.HTMLLiteralURI:var r="";return Object.keys(e.value).forEach((function(t){r+=vc(e.value[t],n.htmlOptions)})),new cs(r,"",new as(e.type));default:return new cs(e.value,"",new as(e.type))}}}},{key:"trim",value:function(t){return t.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}}],[{key:"parseRDFaDOM",value:function(e,n,r){var i=new t(n,{base:r});e.baseURI||(e.baseURI=r),i.process(e,{baseURI:r})}},{key:"tokenize",value:function(t){return this.trim(t).split(/\s+/)}},{key:"trim",value:function(t){return t.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}}]),t}();bh.XMLLiteralURI="http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral",bh.HTMLLiteralURI="http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML",bh.PlainLiteralURI="http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral",bh.objectURI="http://www.w3.org/1999/02/22-rdf-syntax-ns#object",bh.typeURI="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",bh.nameChar="[-A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�က0-F.0-9·̀-ͯ‿-⁀]",bh.nameStartChar="[A-Za-zÀ-ÖØ-öø-ÿĀ-ıĴ-ľŁ-ňŊ-žƀ-ǃǍ-ǰǴ-ǵǺ-ȗɐ-ʨʻ-ˁΆΈ-ΊΌΎ-ΡΣ-ώϐ-ϖϚϜϞϠϢ-ϳЁ-ЌЎ-яё-ќў-ҁҐ-ӄӇ-ӈӋ-ӌӐ-ӫӮ-ӵӸ-ӹԱ-Ֆՙա-ֆא-תװ-ײء-غف-يٱ-ڷں-ھۀ-ێې-ۓەۥ-ۦअ-हऽक़-ॡঅ-ঌএ-ঐও-নপ-রলশ-হড়-ঢ়য়-ৡৰ-ৱਅ-ਊਏ-ਐਓ-ਨਪ-ਰਲ-ਲ਼ਵ-ਸ਼ਸ-ਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઋઍએ-ઑઓ-નપ-રલ-ળવ-હઽૠଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଶ-ହଽଡ଼-ଢ଼ୟ-ୡஅ-ஊஎ-ஐஒ-கங-சஜஞ-டண-தந-பம-வஷ-ஹఅ-ఌఎ-ఐఒ-నప-ళవ-హౠ-ౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹೞೠ-ೡഅ-ഌഎ-ഐഒ-നപ-ഹൠ-ൡก-ฮะา-ำเ-ๅກ-ຂຄງ-ຈຊຍດ-ທນ-ຟມ-ຣລວສ-ຫອ-ຮະາ-ຳຽເ-ໄཀ-ཇཉ-ཀྵႠ-Ⴥა-ჶᄀᄂ-ᄃᄅ-ᄇᄉᄋ-ᄌᄎ-ᄒᄼᄾᅀᅌᅎᅐᅔ-ᅕᅙᅟ-ᅡᅣᅥᅧᅩᅭ-ᅮᅲ-ᅳᅵᆞᆨᆫᆮ-ᆯᆷ-ᆸᆺᆼ-ᇂᇫᇰᇹḀ-ẛẠ-ỹἀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼΩK-Å℮ↀ-ↂぁ-ゔァ-ヺㄅ-ㄬ가-힣一-龥〇〡-〩_]",bh.NCNAME=new RegExp("^"+bh.nameStartChar+bh.nameChar+"*$"),bh.dateTimeTypes=[{pattern:/-?P(?:[0-9]+Y)?(?:[0-9]+M)?(?:[0-9]+D)?(?:T(?:[0-9]+H)?(?:[0-9]+M)?(?:[0-9]+(?:\.[0-9]+)?S)?)?/,type:"http://www.w3.org/2001/XMLSchema#duration"},{pattern:/-?(?:[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9])-[0-9][0-9]-[0-9][0-9]T(?:[0-1][0-9]|2[0-4]):[0-5][0-9]:[0-5][0-9](?:\.[0-9]+)?(?:Z|[+\-][0-9][0-9]:[0-9][0-9])?/,type:"http://www.w3.org/2001/XMLSchema#dateTime"},{pattern:/-?(?:[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9])-[0-9][0-9]-[0-9][0-9](?:Z|[+\-][0-9][0-9]:[0-9][0-9])?/,type:"http://www.w3.org/2001/XMLSchema#date"},{pattern:/(?:[0-1][0-9]|2[0-4]):[0-5][0-9]:[0-5][0-9](?:\.[0-9]+)?(?:Z|[+\-][0-9][0-9]:[0-9][0-9])?/,type:"http://www.w3.org/2001/XMLSchema#time"},{pattern:/-?(?:[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9])-[0-9][0-9]/,type:"http://www.w3.org/2001/XMLSchema#gYearMonth"},{pattern:/-?[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9]/,type:"http://www.w3.org/2001/XMLSchema#gYear"}];var Eh=bh.parseRDFaDOM,Sh=function(){function t(e){Eo(this,t),this.store=e,this.bnodes={},this.why=null,this.reify=!1}return bo(t,[{key:"frameFactory",value:function(e,n,r){return{NODE:1,ARC:2,parent:n,parser:e,store:e.store,element:r,lastChild:0,base:null,lang:null,node:null,nodeType:null,listIndex:1,rdfid:null,datatype:null,collection:!1,terminateFrame:function(){this.collection&&this.node.close()},addSymbol:function(t,e){e=Yu(e,this.base),this.node=this.store.sym(e),this.nodeType=t},loadTriple:function(){if(this.parent.parent.collection?this.parent.parent.node.append(this.node):this.store.add(this.parent.parent.node,this.parent.node,this.node,this.parser.why),null!=this.parent.rdfid){var e=this.store.sym(Yu("#"+this.parent.rdfid,this.base));this.store.add(e,this.store.sym(t.ns.RDF+"type"),this.store.sym(t.ns.RDF+"Statement"),this.parser.why),this.store.add(e,this.store.sym(t.ns.RDF+"subject"),this.parent.parent.node,this.parser.why),this.store.add(e,this.store.sym(t.ns.RDF+"predicate"),this.parent.node,this.parser.why),this.store.add(e,this.store.sym(t.ns.RDF+"object"),this.node,this.parser.why)}},isTripleToLoad:function(){return null!=this.parent&&null!=this.parent.parent&&this.nodeType===this.NODE&&this.parent.nodeType===this.ARC&&this.parent.parent.nodeType===this.NODE},addNode:function(t){this.addSymbol(this.NODE,t),this.isTripleToLoad()&&this.loadTriple()},addCollection:function(){this.nodeType=this.NODE,this.node=this.store.collection(),this.collection=!0,this.isTripleToLoad()&&this.loadTriple()},addCollectionArc:function(){this.nodeType=this.ARC},addBNode:function(t){this.node=null!=t?null!=this.parser.bnodes[t]?this.parser.bnodes[t]:this.parser.bnodes[t]=this.store.bnode():this.store.bnode(),this.nodeType=this.NODE,this.isTripleToLoad()&&this.loadTriple()},addArc:function(e){e===t.ns.RDF+"li"&&(e=t.ns.RDF+"_"+this.parent.listIndex,this.parent.listIndex++),this.addSymbol(this.ARC,e)},addLiteral:function(e){this.node=this.store.literal(e,this.parent.datatype&&this.parent.datatype!==t.ns.RDF+"langString"?this.store.sym(this.parent.datatype):this.lang),this.nodeType=this.NODE,this.isTripleToLoad()&&this.loadTriple()}}}},{key:"getAttributeNodeNS",value:function(t,e,n){var r=null;if(t.getAttributeNodeNS)r=t.getAttributeNodeNS(e,n);else for(var i,o=t.attributes,s=0;s<o.length;++s)if((i=o[s]).namespaceURI===e&&(i.prefix?i.prefix+":"+n:n)===i.nodeName){r=i;break}return r}},{key:"parse",value:function(e,n,r){var i,o=e.childNodes;if(this.cleanParser(),e.nodeType===t.nodeType.DOCUMENT){for(var s=0;s<o.length;s++)if(o[s].nodeType===t.nodeType.ELEMENT){i=o[s];break}}else{if(e.nodeType!==t.nodeType.ELEMENT)throw new Error("RDFParser: can't find root in "+n+". Halting. ");i=e}this.why=r;var a=this.frameFactory(this);return this.base=n,a.base=n,a.lang=null,this.parseDOM(this.buildFrame(a,i)),!0}},{key:"parseDOM",value:function(e){for(var n,r=function(t){var e="";if(null==t.namespaceURI)throw new Error("RDF/XML syntax error: No namespace for "+t.localName+" in "+this.base);return t.namespaceURI&&(e+=t.namespaceURI),t.localName?e+=t.localName:t.nodeName&&(t.nodeName.indexOf(":")>=0?e+=t.nodeName.split(":")[1]:e+=t.nodeName),e}.bind(this),i=!0;e.parent;){var o=e.element,s=o.attributes;if(o.nodeType===t.nodeType.TEXT||o.nodeType===t.nodeType.CDATA_SECTION)e.parent.nodeType===e.NODE&&(e.addArc(t.ns.RDF+"value"),e=this.buildFrame(e)),e.addLiteral(o.nodeValue);else if(r(o)!==t.ns.RDF+"RDF")if(e.parent&&e.parent.collection&&(e.addCollectionArc(),(e=this.buildFrame(e,e.element)).parent.element=null),e.parent&&e.parent.nodeType&&e.parent.nodeType!==e.ARC){e.addArc(r(o)),this.reify&&(n=this.getAttributeNodeNS(o,t.ns.RDF,"ID"))&&(e.rdfid=n.nodeValue,o.removeAttributeNode(n));var a=this.getAttributeNodeNS(o,t.ns.RDF,"parseType"),u=this.getAttributeNodeNS(o,t.ns.RDF,"datatype");if(u&&(e.datatype=u.nodeValue,o.removeAttributeNode(u)),a){var c=a.nodeValue;"Literal"===c?(e.datatype=t.ns.RDF+"XMLLiteral",(e=this.buildFrame(e)).addLiteral(o.childNodes),i=!1):"Resource"===c?((e=this.buildFrame(e,e.element)).parent.element=null,e.addBNode()):"Collection"===c&&((e=this.buildFrame(e,e.element)).parent.element=null,e.addCollection()),o.removeAttributeNode(a)}if(0!==s.length){var h=this.getAttributeNodeNS(o,t.ns.RDF,"resource"),f=this.getAttributeNodeNS(o,t.ns.RDF,"nodeID");e=this.buildFrame(e),h?(e.addNode(h.nodeValue),o.removeAttributeNode(h)):f?(e.addBNode(f.nodeValue),o.removeAttributeNode(f)):e.addBNode();for(var l=s.length-1;l>=0;l--){var d=this.buildFrame(e);d.addArc(r(s[l])),r(s[l])===t.ns.RDF+"type"?this.buildFrame(d).addNode(s[l].nodeValue):this.buildFrame(d).addLiteral(s[l].nodeValue)}}else 0===o.childNodes.length&&this.buildFrame(e).addLiteral("")}else{var v=this.getAttributeNodeNS(o,t.ns.RDF,"about");if(n=this.getAttributeNodeNS(o,t.ns.RDF,"ID"),v&&n)throw new Error("RDFParser: "+o.nodeName+" has both rdf:id and rdf:about. Halting. Only one of these properties may be specified on a node.");if(!v&&n)e.addNode("#"+n.nodeValue),o.removeAttributeNode(n);else if(null==v&&null==n){var p=this.getAttributeNodeNS(o,t.ns.RDF,"nodeID");p?(e.addBNode(p.nodeValue),o.removeAttributeNode(p)):e.addBNode()}else e.addNode(v.nodeValue),o.removeAttributeNode(v);var w=this.getAttributeNodeNS(o,t.ns.RDF,"type");t.ns.RDF+"Description"!==r(o)&&(w={nodeValue:r(o)}),null!=w&&(this.store.add(e.node,this.store.sym(t.ns.RDF+"type"),this.store.sym(Yu(w.nodeValue,e.base)),this.why),w.nodeName&&o.removeAttributeNode(w));for(var y=s.length-1;y>=0;y--)this.store.add(e.node,this.store.sym(r(s[y])),this.store.literal(s[y].nodeValue,e.lang),this.why)}for(o=e.element;e.parent;){for(var m=e;null==o;)o=(e=e.parent).element;var g=o.childNodes&&o.childNodes[e.lastChild];if(g&&i){if((g.nodeType===t.nodeType.ELEMENT||g.nodeType===t.nodeType.TEXT||g.nodeType===t.nodeType.CDATA_SECTION)&&(g.nodeType!==t.nodeType.TEXT&&g.nodeType!==t.nodeType.CDATA_SECTION||1===o.childNodes.length)){e.lastChild++,e=this.buildFrame(m,o.childNodes[e.lastChild-1]);break}e.lastChild++}else{if(e.terminateFrame(),!(e=e.parent))break;o=e.element,i=!0}}}}},{key:"cleanParser",value:function(){this.bnodes={},this.why=null}},{key:"buildFrame",value:function(e,n){var r=this.frameFactory(this,e,n);if(e&&(r.base=e.base,r.lang=e.lang),!n||n.nodeType===t.nodeType.TEXT||n.nodeType===t.nodeType.CDATA_SECTION)return r;var i=n.attributes,o=n.getAttributeNode("xml:base");null!=o&&(r.base=o.nodeValue,n.removeAttribute("xml:base"));var s=n.getAttributeNode("xml:lang");null!=s&&(r.lang=s.nodeValue,n.removeAttribute("xml:lang"));for(var a=i.length-1;a>=0;a--)if("xml"===i[a].nodeName.substr(0,3)){if("xmlns:"===i[a].name.slice(0,6)){var u=i[a].nodeValue;this.base&&(u=Yu(u,this.base)),this.store.setPrefixForURI(i[a].name.slice(6),u)}n.removeAttributeNode(i[a])}return r}}]),t}();function Fh(t,e,n){var r,i,o,s=["INSERT","DELETE","WHERE"],a=fc("http://www.w3.org/ns/pim/patch#"),u=uh(e,e,n,n,null,null,"",null),c={},h=function(t,e,n,r,i){return"Line "+(e+1)+" of <"+t+">: Bad syntax:\n "+i+'\n at: "'+n.slice(r,r+30)+'"'};r=0;var f=e.sym(n+"#query");for(c.query=f;;){if((i=u.skipSpace(t,r))<0)return c;if(";"===t[i]){if((r=u.skipSpace(t,i+1))<0)return c;i=r}var l=!1;for(o=0;o<s.length;o++){var d=s[o];if(t.slice(i,i+d.length)===d){if((r=u.skipSpace(t,i+d.length))<0)throw h(u._thisDoc,u.lines,t,i+d.length,"found EOF, needed {...} after "+d);if(("INSERT"===d||"DELETE"===d)&&"DATA"===t.slice(r,r+4)){if((i=u.skipSpace(t,r+4))<0)throw h(u._thisDoc,u.lines,t,r+4,"needed {...} after INSERT DATA "+d);r=i}var v=[];if((i=u.node(t,r,v))<0)throw h(u._thisDoc,u.lines,t,r,"bad syntax or EOF in {...} after "+d);c[d.toLowerCase()]=v[0],e.add(f,a(d.toLowerCase()),v[0]),l=!0,r=i}}if(!l&&"@prefix"===t.slice(i,i+7)){if((r=u.directive(t,i))<0)throw h(u._thisDoc,u.lines,t,r,"bad syntax or EOF after @prefix ");r=u.checkDot(t,r),l=!0}if(!l)throw h(u._thisDoc,u.lines,t,i,"Unknown syntax at start of statememt: '"+t.slice(i).slice(0,20)+"'")}}function kh(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"text/turtle",i=arguments.length>4?arguments[4]:void 0;r=(r=r||qo).split(";")[0];try{if(r===Bo||r===qo){var o=uh(e,e,n,n,null,null,"",null);o.loadBuf(t),u()}else if(r===Ho){var s=new Sh(e);s.parse(yc(t),n,e.sym(n)),u()}else if(r===Vo)Eh(yc(t,{contentType:Vo}),e,n),u();else if(r===Uo)Eh(yc(t,{contentType:Uo}),e,n),u();else if(r===$o||r===Wo)Fh(t,e,n),u();else if(r===Lo)yh(t,e,n,u);else{if(r!==Ko&&r!==Jo)throw void 0===r?new Error("contentType is undefined"):new Error("Don't know how to parse "+r+" yet");var a=new Au({factory:vh});h(null,t)}}catch(t){c(t)}function u(){i&&i(null,e)}function c(t){if(r!==Lo||r!==Ko||r!==Jo){if(!i){var o=new Error(t+" while trying to parse <"+n+"> as "+r);throw o.cause=t,o}i(t,e)}}function h(t,n){t&&i(t,e);try{a.parse(n,f)}catch(t){i(t,e)}}function f(t,n){n?e.add(n.subject,n.predicate,n.object,n.graph):i(t,e)}kh.handled={"text/n3":!0,"text/turtle":!0,"application/rdf+xml":!0,"application/xhtml+xml":!0,"text/html":!0,"application/sparql-update":!0,"application/sparql-update-single-match":!0,"application/ld+json":!0,"application/nquads":!0,"application/n-quads":!0}}Ao(Sh,"ns",{RDF:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",RDFS:"http://www.w3.org/2000/01/rdf-schema#"}),Ao(Sh,"nodeType",{ELEMENT:1,ATTRIBUTE:2,TEXT:3,CDATA_SECTION:4,ENTITY_REFERENCE:5,ENTITY:6,PROCESSING_INSTRUCTION:7,COMMENT:8,DOCUMENT:9,DOCUMENT_TYPE:10,DOCUMENT_FRAGMENT:11,NOTATION:12});var xh=F(_());function _h(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=_o(t);if(e){var i=_o(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return xo(this,n)}}var Ah={"text/n3":!0,"text/turtle":!0,"application/rdf+xml":!0,"application/xhtml+xml":!0,"text/html":!0,"application/ld+json":!0},jh={rdf:Ho,owl:Ho,n3:"text/n3",ttl:"text/turtle",nt:"text/n3",acl:"text/n3",html:"text/html",xml:"text/xml"},Ch=function(t){return{link:fc("http://www.w3.org/2007/ont/link#",t),http:fc("http://www.w3.org/2007/ont/http#",t),httph:fc("http://www.w3.org/2007/ont/httph#",t),rdf:fc("http://www.w3.org/1999/02/22-rdf-syntax-ns#",t),rdfs:fc("http://www.w3.org/2000/01/rdf-schema#",t),dc:fc("http://purl.org/dc/elements/1.1/",t),ldp:fc("http://www.w3.org/ns/ldp#",t)}},Rh=Ch(),Th=bo((function t(e,n){Eo(this,t),Ao(this,"response",void 0),Ao(this,"dom",void 0),this.response=e,this.dom=n}));Ao(Th,"pattern",void 0);var Ih=function(){ko(e,Th);var t=_h(e);function e(){return Eo(this,e),t.apply(this,arguments)}return bo(e,[{key:"parse",value:function(t,e,n){var r=t.store;if(this.dom||(this.dom=yc(e)),"parsererror"===this.dom.documentElement.nodeName)return t.failFetch(n,"Badly formed XML in "+n.resource.value,"parse_error");var i=new Sh(r);try{i.parse(this.dom,n.original.value,n.original)}catch(e){return t.failFetch(n,"Syntax error parsing RDF/XML! "+e,"parse_error")}return n.noMeta||r.add(n.original,Rh.rdf("type"),Rh.link("RDFDocument"),t.appNode),t.doneFetch(n,this.response)}}],[{key:"toString",value:function(){return"RDFXMLHandler"}},{key:"register",value:function(t){t.mediatypes[Ho]={q:.9}}}]),e}();Ih.pattern=new RegExp("application/rdf\\+xml");var Oh=function(){ko(e,Th);var t=_h(e);function e(){return Eo(this,e),t.apply(this,arguments)}return bo(e,[{key:"parse",value:function(t,e,n){var r,i;this.dom||(this.dom=yc(e));var o=t.store,s=this.dom.getElementsByTagName("title");s.length>0&&o.add(n.resource,Rh.dc("title"),o.rdfFactory.literal(s[0].textContent),n.resource);for(var a=this.dom.getElementsByTagName("link"),u=a.length-1;u>=0;u--)i=!1,(r=a[u].getAttribute("rel"))||(r=a[u].getAttribute("rev"),i=!0),r&&t.linkData(n.original,r,a[u].getAttribute("href"),n.resource,i);for(var c=this.dom.getElementsByTagName("script"),h=0;h<c.length;h++){var f=c[h].getAttribute("type");Ah[f]&&(kh(c[h].textContent,o,n.original.value,f),kh(c[h].textContent,o,n.original.value,f))}if(n.noMeta||o.add(n.resource,Rh.rdf("type"),Rh.link("WebPage"),t.appNode),!n.noRDFa&&Eh)try{Eh(this.dom,o,n.original.value)}catch(e){return t.failFetch(n,"Error trying to parse "+n.resource+" as RDFa:\n"+e+":\n"+e.stack,"parse_error")}return t.doneFetch(n,this.response)}}],[{key:"toString",value:function(){return"XHTMLHandler"}},{key:"register",value:function(t){t.mediatypes[Vo]={}}}]),e}();Oh.pattern=new RegExp("application/xhtml");var Nh=function(){ko(e,Th);var t=_h(e);function e(){return Eo(this,e),t.apply(this,arguments)}return bo(e,[{key:"parse",value:function(t,n,r){for(var i=yc(n),o=0;o<i.childNodes.length;o++){var s=i.childNodes[o];if(e.isElement(s)){var a=s.namespaceURI;if(a&&a===a.rdf)return t.addStatus(r.req,"Has XML root element in the RDF namespace, so assume RDF/XML."),new Ih(this.response,i).parse(t,n,r);break}}if(i.doctype&&"html"===i.doctype.name&&i.doctype.publicId.match(/^-\/\/W3C\/\/DTD XHTML/)&&i.doctype.systemId.match(/http:\/\/www.w3.org\/TR\/xhtml/))return t.addStatus(r.req,"Has XHTML DOCTYPE. Switching to XHTML Handler.\n"),new Oh(this.response,i).parse(t,n,r);var u=i.getElementsByTagName("html")[0];if(u){var c=u.getAttribute("xmlns");if(c&&c.match(/^http:\/\/www.w3.org\/1999\/xhtml/))return t.addStatus(r.req,"Has a default namespace for XHTML. Switching to XHTMLHandler.\n"),new Oh(this.response,i).parse(t,n,r)}return t.failFetch(r,"Unsupported dialect of XML: not RDF or XHTML namespace, etc.\n"+n.slice(0,80),901)}}],[{key:"toString",value:function(){return"XMLHandler"}},{key:"register",value:function(t){t.mediatypes["text/xml"]={q:.5},t.mediatypes["application/xml"]={q:.5}}},{key:"isElement",value:function(t){return t.nodeType===Node.ELEMENT_NODE}}]),e}();Nh.pattern=new RegExp("(text|application)/(.*)xml");var Ph=function(){ko(e,Th);var t=_h(e);function e(){return Eo(this,e),t.apply(this,arguments)}return bo(e,[{key:"parse",value:function(t,e,n){var r=t.store;if(Bh(e))return t.addStatus(n.req,"Has an XML declaration. We'll assume it's XHTML as the content-type was text/html.\n"),new Oh(this.response).parse(t,e,n);if(function(t){var e=t.indexOf("<!DOCTYPE html"),n=t.indexOf(">");return!(-1===e||-1===n||e>n)&&-1!==t.substr(e,n-e).indexOf("XHTML")}(e))return t.addStatus(n.req,"Has XHTML DOCTYPE. Switching to XHTMLHandler.\n"),new Oh(this.response).parse(t,e,n);if(function(t){return!!t.match(/[^(<html)]*<html\s+[^<]*xmlns=['"]http:\/\/www.w3.org\/1999\/xhtml["'][^<]*>/)}(e))return t.addStatus(n.req,"Has default namespace for XHTML, so switching to XHTMLHandler.\n"),new Oh(this.response).parse(t,e,n);var i=new RegExp("<title>([\\s\\S]+?)</title>","im").exec(e);return i&&r.add(n.resource,Rh.dc("title"),r.rdfFactory.literal(i[1]),n.resource),r.add(n.resource,Rh.rdf("type"),Rh.link("WebPage"),t.appNode),t.addStatus(n.req,"non-XML HTML document, not parsed for data."),t.doneFetch(n,this.response)}}],[{key:"toString",value:function(){return"HTMLHandler"}},{key:"register",value:function(t){t.mediatypes["text/html"]={q:.9}}}]),e}();Ph.pattern=new RegExp("text/html");var Dh=function(){ko(e,Th);var t=_h(e);function e(){return Eo(this,e),t.apply(this,arguments)}return bo(e,[{key:"parse",value:function(t,e,n,r){var i=t.store;return new Promise((function(o){try{yh(e,i,n.original.value,(function(){o(t.doneFetch(n,r))}))}catch(e){o(t.failFetch(n,"Error trying to parse "+n.resource+" as JSON-LD:\n"+e,"parse_error",r))}}))}}],[{key:"toString",value:function(){return"JsonLdHandler"}},{key:"register",value:function(t){t.mediatypes["application/ld+json"]={q:.9}}}]),e}();Dh.pattern=/application\/ld\+json/;var Mh=function(){ko(e,Th);var t=_h(e);function e(){return Eo(this,e),t.apply(this,arguments)}return bo(e,[{key:"parse",value:function(t,e,n){return Bh(e)?(t.addStatus(n.req,"Warning: "+n.resource+" has an XML declaration. We'll assume it's XML but its content-type wasn't XML.\n"),new Nh(this.response).parse(t,e,n)):e.slice(0,500).match(/xmlns:/)?(t.addStatus(n.req,"May have an XML namespace. We'll assume it's XML but its content-type wasn't XML.\n"),new Nh(this.response).parse(t,e,n)):(t.addStatus(n.req,"Plain text document, no known RDF semantics."),t.doneFetch(n,this.response))}}],[{key:"toString",value:function(){return"TextHandler"}},{key:"register",value:function(t){t.mediatypes["text/plain"]={q:.5}}}]),e}();Mh.pattern=new RegExp("text/plain");var Uh=function(){ko(e,Th);var t=_h(e);function e(){return Eo(this,e),t.apply(this,arguments)}return bo(e,[{key:"parse",value:function(t,e,n,r){var i=t.store,o=uh(i,i,n.original.value,n.original.value,null,null,"",null);try{o.loadBuf(e)}catch(e){return t.failFetch(n,"Error trying to parse "+n.resource+" as Notation3:\n"+e,"parse_error",r)}return t.addStatus(n.req,"N3 parsed: "+o.statementCount+" triples in "+o.lines+" lines."),t.store.add(n.original,Rh.rdf("type"),Rh.link("RDFDocument"),t.appNode),t.doneFetch(n,this.response)}}],[{key:"toString",value:function(){return"N3Handler"}},{key:"register",value:function(t){t.mediatypes["text/n3"]={q:"1.0"},t.mediatypes["text/turtle"]={q:1}}}]),e}();Uh.pattern=new RegExp("(application|text)/(x-)?(rdf\\+)?(n3|turtle)");var Lh={RDFXMLHandler:Ih,XHTMLHandler:Oh,XMLHandler:Nh,HTMLHandler:Ph,TextHandler:Mh,N3Handler:Uh,JsonLdHandler:Dh};function Bh(t){return!!t.match(/\s*<\?xml\s+version\s*=[^<>]+\?>/)}var Jh=function(){function t(e){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Eo(this,t),Ao(this,"store",void 0),Ao(this,"timeout",void 0),Ao(this,"_fetch",void 0),Ao(this,"mediatypes",void 0),Ao(this,"appNode",void 0),Ao(this,"requested",void 0),Ao(this,"timeouts",void 0),Ao(this,"redirectedTo",void 0),Ao(this,"fetchQueue",void 0),Ao(this,"fetchCallbacks",void 0),Ao(this,"nonexistent",void 0),Ao(this,"lookedUp",void 0),Ao(this,"handlers",void 0),Ao(this,"ns",void 0),Ao(this,"fireCallbacks",void 0),this.store=e||new Kc,this.ns=Ch(this.store.rdfFactory),this.timeout=r.timeout||3e4,this._fetch=r.fetch||"undefined"!=typeof global&&(global.solidFetcher||global.solidFetch)||"undefined"!=typeof window&&(window.solidFetcher||window.solidFetch)||xh.default,!this._fetch)throw new Error("No _fetch function available for Fetcher");this.appNode=this.store.rdfFactory.blankNode(),this.store.fetcher=this,this.requested={},this.timeouts={},this.redirectedTo={},this.fetchQueue={},this.fetchCallbacks={},this.nonexistent={},this.lookedUp={},this.handlers=[],this.mediatypes={"image/*":{q:.9},"*/*":{q:.1}},dc(this,["request","fail","refresh","retract","done"]),Object.keys(r.handlers||Lh).map((function(t){return n.addHandler(Lh[t])}))}var e,n;return bo(t,[{key:"load",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(n=Object.assign({},n),t instanceof Array)return Promise.all(t.map((function(t){return e.load(t,Object.assign({},n))})));var r=t,i=zo(r);i=i.split("#")[0],n=this.initFetchOptions(i,n);var o=this.initFetchOptions(i,n);return this.pendingFetchPromise(i,o.baseURI,o)}},{key:"pendingFetchPromise",value:function(t,e,n){var r,i=this;return!n.force&&this.fetchQueue[e]?r=this.fetchQueue[e]:(r=Promise.race([this.setRequestTimeout(t,n),this.fetchUri(t,n)]),this.fetchQueue[e]=r,this.cleanupFetchRequest(e,void 0,this.timeout)),r.then((function(e){return t in i.timeouts&&(i.timeouts[t].forEach(clearTimeout),delete i.timeouts[t]),e}))}},{key:"cleanupFetchRequest",value:function(t,e,n){var r=this;void 0!==e&&console.warn("_options is deprecated"),this.timeouts[t]=(this.timeouts[t]||[]).concat(setTimeout((function(){r.isPending(t)||delete r.fetchQueue[t]}),n))}},{key:"initFetchOptions",value:function(e,n){var r=this.store;!n.method||"GET"===n.method.toUpperCase()||(n.force=!0),n.resource=r.rdfFactory.namedNode(e),n.baseURI=n.baseURI||e,n.original=r.rdfFactory.namedNode(n.baseURI),n.req=r.bnode(),n.headers=n.headers||new xh.Headers,n.contentType&&(n.headers["content-type"]=n.contentType),n.force&&(n.cache="no-cache");var i=this.acceptString();n.headers.accept=i;var o=t.offlineOverride(e);n.requestedURI=o,t.setCredentials(o,n);var s=t.proxyIfNecessary(o);return o!==s&&(n.proxyUsed=!0),n.actualProxyURI=s,n}},{key:"fetchUri",value:function(e,n){var r=this;if(!e)return Promise.reject(new Error("Cannot fetch an empty uri"));if(t.unsupportedProtocol(e))return this.failFetch(n,"fetcher: Unsupported protocol","unsupported_protocol");var i=this.getState(e);if(n.force)delete this.nonexistent[e];else{if("fetched"===i)return Promise.resolve(this.doneFetch(n,{status:200,ok:!0,statusText:"Already loaded into quadstore."}));if("failed"===i&&404===this.requested[e]){var o="Previously failed: "+this.requested[e],s={url:e,status:this.requested[e],statusText:o,responseText:o,headers:new xh.Headers,ok:!1,body:null,bodyUsed:!1,size:0,timeout:0};return this.failFetch(n,o,this.requested[e],s)}}this.fireCallbacks("request",[e]),this.requested[e]=!0,n.noMeta||this.saveRequestMetadata(e,n);var a=n.actualProxyURI;return this._fetch(a,n).then((function(t){return r.handleResponse(t,e,n)}),(function(t){var i={url:a,status:999,statusText:(t.name||"network failure")+": "+(t.errno||t.code||t.type),responseText:t.message,headers:new xh.Headers,ok:!1,body:null,bodyUsed:!1,size:0,timeout:0};return console.log("Fetcher: <"+a+"> Non-HTTP fetch exception: "+t),r.handleError(i,e,n)}))}},{key:"nowOrWhenFetched",value:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=zo(t);"function"==typeof e?n=e:void 0===e||(os(e)?r.referringTerm=e:r=e),this.load(i,r).then((function(t){if(n)if(t)if(t.ok)n(!0,"OK",t);else{var e="HTTP error: Status "+t.status+" ("+t.statusText+")";t.responseText&&(e+=" "+t.responseText),console.log(e+" fetching "+i),n(!1,e,t)}else{var r="@@ nowOrWhenFetched: no response object!";console.log(r),n(!1,r)}}),(function(t){var e=t.message||t.statusText;e="Failed to load <"+i+"> "+e,console.log(e),t.response&&t.response.status&&(e+=" status: "+t.response.status),n(!1,e,t.response)}))}},{key:"addStatus",value:function(t,e){var n=new Date;e="["+n.getHours()+":"+n.getMinutes()+":"+n.getSeconds()+"."+n.getMilliseconds()+"] "+e;var r=this.store,i=r.the(t,this.ns.link("status"));Qo(i)?i.append(r.rdfFactory.literal(e)):uc("web.js: No list to add to: "+i+","+e)}},{key:"failFetch",value:function(t,e,n,r){this.addStatus(t.req,e),t.noMeta||this.store.add(t.original,this.ns.link("error"),this.store.rdfFactory.literal(e));var i=(t.method||"GET").toUpperCase();("GET"===i||"HEAD"===i)&&(t.resource.equals(t.original),this.requested[Gu(t.original.value)]=n,this.fireCallbacks("fail",[t.original.value,e]));var o=new Error("Fetcher: "+e);return o.status=n,o.statusText=e,o.response=r,Promise.reject(o)}},{key:"linkData",value:function(t,e,n,r,i){if(n){var o,s=this.store,a=s.rdfFactory.namedNode(Yu(n,t.value));if("alternate"===e||"seeAlso"===e||"meta"===e||"describedby"===e){if(a.value===t.value)return;o=this.ns.rdfs("seeAlso")}else o=s.rdfFactory.namedNode("type"===e?"http://www.w3.org/1999/02/22-rdf-syntax-ns#type":Yu(encodeURIComponent(e),"http://www.iana.org/assignments/link-relations/"));i?s.add(a,o,t,r):s.add(t,o,a,r)}}},{key:"parseLinkHeader",value:function(t,e,n){if(t){var r=/[^\(\)<>@,;:"\/\[\]\?={} \t]+=(([^\(\)<>@,;:"\/\[\]\?={} \t]+)|("[^"]*"))/g,i=t.match(/<[^>]*>\s*(\s*;\s*[^()<>@,;:"/[\]?={} \t]+=(([^\(\)<>@,;:"\/\[\]\?={} \t]+)|("[^"]*")))*(,|$)/g);if(null!=i)for(var o=0;o<i.length;o++){var s=i[o].split(">"),a=s[0].substring(1),u=s[1].match(r);if(null==u)return;for(var c=0;c<u.length;c++){var h=u[c].split("=")[1].replace(/["']/g,"");this.linkData(e,h,a,n)}}}}},{key:"doneFetch",value:function(t,e){return this.addStatus(t.req,"Done."),this.requested[t.original.value]="done",this.fireCallbacks("done",[t.original.value]),e.req=t.req,e}},{key:"nowKnownAs",value:function(t,e){this.lookedUp[t.value]?this.lookedUp[e.value]||this.lookUpThing(e,t):this.lookedUp[e.value]&&(this.lookedUp[t.value]||this.lookUpThing(t,e))}},{key:"putBack",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=zo(t),i=new as(r).doc();return n.contentType=n["content-type"]||n["Content-Type"]||n.contentType||qo,"application/ld+json"===n.contentType?new Promise((function(r,o){Sc(i,e.store,i.uri,n.contentType,(function(i,s){i?o(i):(n.data=s,e.webOperation("PUT",t,n).then((function(t){return r(t)})).catch((function(t){return o(t)})))}))})):(n.data=Sc(i,this.store,i.value,n.contentType),this.webOperation("PUT",r,n))}},{key:"webCopy",value:function(t,e,n){var r=this;return this.webOperation("GET",t).then((function(t){return r.webOperation("PUT",e,{data:t.responseText,contentType:n})}))}},{key:"delete",value:function(t,e){var n=this;return this.webOperation("DELETE",t,e).then((function(e){return n.requested[t]=404,n.nonexistent[t]=!0,n.unload(n.store.rdfFactory.namedNode(t)),e}))}},{key:"createIfNotExists",value:(e=Bu.default.mark((function t(e){var n,r,i,o,s=arguments;return Bu.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:qo,r=s.length>2&&void 0!==s[2]?s[2]:"",i=this,t.prev=3,t.next=6,i.load(e);case 6:o=t.sent,t.next=29;break;case 9:if(t.prev=9,t.t0=t.catch(3),404!==t.t0.response.status){t.next=27;break}return console.log("createIfNotExists: doc does NOT exist, will create... "+e),t.prev=13,t.next=16,i.webOperation("PUT",e.value,{data:r,contentType:n});case 16:o=t.sent,t.next=23;break;case 19:throw t.prev=19,t.t1=t.catch(13),console.log("createIfNotExists doc FAILED: "+e+": "+t.t1),t.t1;case 23:return delete i.requested[e.value],t.abrupt("return",o);case 27:throw console.log("createIfNotExists doc load error NOT 404: "+e+": "+t.t0),t.t0;case 29:return t.abrupt("return",o);case 30:case"end":return t.stop()}}),t,this,[[3,9],[13,19]])})),n=function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(t){Lu(o,r,i,s,a,"next",t)}function a(t){Lu(o,r,i,s,a,"throw",t)}s(void 0)}))},function(t){return n.apply(this,arguments)})},{key:"createContainer",value:function(t,e,n){var r={"content-type":qo,link:this.ns.ldp("BasicContainer")+'; rel="type"'};e&&(r.slug=e);var i={headers:r};return n&&(i.body=n),this.webOperation("POST",t,i)}},{key:"invalidateCache",value:function(t){var e=zo(t),n=this;if(n.fetchQueue&&n.fetchQueue[e]&&(console.log("Internal error - fetchQueue exists "+e),"resolved"===n.fetchQueue[e].PromiseStatus?delete n.fetchQueue[e]:(delete n.fetchQueue[e],console.log("*** Fetcher: pending fetchQueue deleted "+e))),n.requested[e]&&"done"!==n.requested[e]&&"failed"!==n.requested[e]&&404!==n.requested[e]){var r="Rdflib: fetcher: Destructive operation on <".concat(n.requested[e],"> file being fetched! ")+e;console.error(r)}else delete n.requested[e],delete n.nonexistent[e]}},{key:"webOperation",value:function(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=zo(n);r.method=e,r.body=r.data||r.body,r.force=!0;var o=this;if(r.body&&!r.contentType)throw new Error("Web operation sending data must have a defined contentType.");return r.contentType&&(r.headers=r.headers||{},r.headers["content-type"]=r.contentType),t.setCredentials(i,r),new Promise((function(t,n){o._fetch(i,r).then((function(r){if(r.ok)"PUT"!==e&&"PATCH"!==e&&"POST"!==e&&"DELETE"!==e||o.invalidateCache(i),r.text?r.text().then((function(e){r.responseText=e,t(r)})):t(r);else{var s="Web error: "+r.status;r.statusText&&(s+=" ("+r.statusText+")"),s+=" on "+e+" of <"+i+">",r.responseText&&(s+=": "+r.responseText);var a=new Error(s);a.response=r,n(a)}}),(function(t){n(new Error("Fetch error for "+e+" of <"+i+">:"+t))}))}))}},{key:"lookUpThing",value:function(t,e){var n=this,r=this.store.uris(t);return(r=r.map((function(t){return Gu(t)}))).forEach((function(t){n.lookedUp[t]=!0})),this.load(r,{referringTerm:e})}},{key:"getHeader",value:function(t,e){for(var n=this.store,r=t.value,i=n.each(void 0,this.ns.link("requestedURI"),n.rdfFactory.literal(r)),o=0;o<i.length;o++){var s=i[o];if(void 0!==s){var a=n.any(s,this.ns.link("response"));if(void 0!==a&&n.anyValue(a,this.ns.http("status"))&&n.anyValue(a,this.ns.http("status")).startsWith("2")){var u=n.each(a,this.ns.httph(e.toLowerCase()));return u.length?u.map((function(t){return t.value})):[]}}}}},{key:"saveRequestMetadata",value:function(t,e){var n=e.req,r=this.store,i=e.referringTerm;this.addStatus(e.req,"Accept: "+e.headers.accept),os(i)&&r.add(r.rdfFactory.namedNode(t),this.ns.link("requestedBy"),i,this.appNode),e.original&&e.original.value!==t&&r.add(n,this.ns.link("orginalURI"),r.rdfFactory.literal(e.original.value),this.appNode);var o=new Date,s="["+o.getHours()+":"+o.getMinutes()+":"+o.getSeconds()+"] ";r.add(n,this.ns.rdfs("label"),r.rdfFactory.literal(s+" Request for "+t),this.appNode),r.add(n,this.ns.link("requestedURI"),r.rdfFactory.literal(t),this.appNode),r.add(n,this.ns.link("status"),r.collection(),this.appNode)}},{key:"saveResponseMetadata",value:function(t,e){var n=this,r=this.store,i=r.bnode();return r.add(e.req,this.ns.link("response"),i,i),r.add(i,this.ns.http("status"),r.rdfFactory.literal(t.status),i),r.add(i,this.ns.http("statusText"),r.rdfFactory.literal(t.statusText),i),t.headers.forEach((function(t,o){var s;r.add(i,n.ns.httph(o),n.store.rdfFactory.literal(t),i),"content-type"===o&&r.add(e.resource,n.ns.rdf("type"),r.rdfFactory.namedNode((s=t,s=s.split(";")[0].trim(),new as("http://www.w3.org/ns/iana/media-types/"+s+"#Resource")).value),i)})),i}},{key:"objectRefresh",value:function(t){var e=this.store.uris(t);if(void 0!==e)for(var n=0;n<e.length;n++)this.refresh(this.store.rdfFactory.namedNode(Gu(e[n])))}},{key:"refresh",value:function(t,e){this.fireCallbacks("refresh",arguments),this.nowOrWhenFetched(t,{force:!0,clearPreviousData:!0},e)}},{key:"refreshIfExpired",value:function(t,e){var n=this.getHeader(t,"Expires");!n||new Date(n[0]).getTime()<=(new Date).getTime()?this.refresh(t,e):e(!0,"Not expired",{})}},{key:"retract",value:function(t){this.store.removeMany(void 0,void 0,void 0,t),t.value&&delete this.requested[Gu(t.value)],this.fireCallbacks("retract",arguments)}},{key:"getState",value:function(t){return void 0===this.requested[t]?"unrequested":!0===this.requested[t]?"requested":"done"===this.requested[t]?"fetched":"redirected"===this.requested[t]?this.getState(this.redirectedTo[t]):"failed"}},{key:"isPending",value:function(t){return!0===this.requested[t]}},{key:"unload",value:function(t){this.store.removeDocument(t),delete this.requested[t.value]}},{key:"addHandler",value:function(t){this.handlers.push(t),t.register(this)}},{key:"retryNoCredentials",value:function(t,e){console.log("Fetcher: CORS: RETRYING with NO CREDENTIALS for "+e.resource),e.retriedWithNoCredentials=!0,delete this.requested[t],delete this.fetchQueue[t];var n=Object.assign({},e,{credentials:"omit"});return this.addStatus(e.req,"Abort: Will retry with credentials SUPPRESSED to see if that helps"),this.load(t,n)}},{key:"isCrossSite",value:function(t){if("undefined"==typeof document||!document.location)return!1;var e=Xu,n=""+document.location;return(e(n)&&e(t)&&e(n))!==e(t)}},{key:"handleError",value:function(e,n,r){if(this.isCrossSite(n)){if(r.credentials&&"include"===r.credentials&&!r.retriedWithNoCredentials)return this.retryNoCredentials(n,r);var i=t.crossSiteProxy(n);if(i&&!r.proxyUsed)return console.log("web: Direct failed so trying proxy "+i),this.redirectToProxy(i,r)}var o;return e instanceof Error?o="Fetch error: "+e.message:(o=e.statusText,e.responseText&&(o+=" ".concat(e.responseText))),this.failFetch(r,o,e.status||998,e)}},{key:"addType",value:function(t,e,n,r){var i=e;if(r){var o=n.any(i,this.ns.link("requestedURI"));o&&o.value!==r&&n.add(n.rdfFactory.namedNode(r),this.ns.rdf("type"),t,this.appNode)}for(;;){var s=n.any(i,this.ns.link("requestedURI"));if(s&&s.value&&n.add(n.rdfFactory.namedNode(s.value),this.ns.rdf("type"),t,this.appNode),!(i=n.any(void 0,n.rdfFactory.namedNode("http://www.w3.org/2007/ont/link#redirectedRequest"),i)))break;var a=n.any(i,n.rdfFactory.namedNode("http://www.w3.org/2007/ont/link#response"));if(!a)break;var u=n.any(a,n.rdfFactory.namedNode("http://www.w3.org/2007/ont/http#status"));if(!u)break;if("301"!==u&&"302"!==u)break}}},{key:"handleResponse",value:function(t,e,n){var r=this,i=this.store,o=t.headers,s=n.req,a=this.saveResponseMetadata(t,n),u=this.normalizedContentType(n,o)||"",c=o.get("content-location");if(0===t.status)return console.log("Masked error - status 0 for "+e),this.handleError(t,e,n);if(t.status>=400)return 404===t.status&&(this.nonexistent[n.original.value]=!0,this.nonexistent[e]=!0),this.saveErrorResponse(t,a).then((function(){return r.failFetch(n,n.resource+" "+t.statusText,t.status,t)}));var h=null,f=null;if(c&&(f=Yu(c,e))!==e&&(h=f),200===t.status){this.addType(this.ns.link("Document"),s,i,e),h&&this.addType(this.ns.link("Document"),s,i,h),n.clearPreviousData&&i.removeDocument(n.resource);var l=u.includes("image/")||u.includes("application/pdf");u&&l&&(this.addType(i.rdfFactory.namedNode("http://purl.org/dc/terms/Image"),s,i,e),h&&this.addType(i.rdfFactory.namedNode("http://purl.org/dc/terms/Image"),s,i,h))}if(c){if(!n.force&&h&&"done"===this.requested[f])return this.doneFetch(n,t);this.requested[f]=!0}this.parseLinkHeader(o.get("link"),n.original,s);var d=this.handlerForContentType(u,t);return d?t.text().then((function(e){return t.responseText=e,d.parse(r,e,n,t)})):(this.addStatus(s,"Fetch over. No data handled."),this.doneFetch(n,t))}},{key:"saveErrorResponse",value:function(t,e){var n=this,r=this.store;return t.text().then((function(t){t.length>10&&r.add(e,n.ns.http("content"),r.rdfFactory.literal(t),e)}))}},{key:"handlerForContentType",value:function(t,e){if(!t)return null;var n=this.handlers.find((function(e){return t.match(e.pattern)}));return n?new n(e):null}},{key:"guessContentType",value:function(t){return jh[t.split(".").pop()]}},{key:"normalizedContentType",value:function(t,e){if(t.forceContentType)return t.forceContentType;var n=e.get("content-type");if(!n||n.includes("application/octet-stream")){var r=this.guessContentType(t.resource.value);if(r)return r}var i=Qu(t.resource.value);return!n&&["file","chrome"].includes(i)?"text/xml":n}},{key:"redirectToProxy",value:function(t,e){var n=this;this.addStatus(e.req,"BLOCKED -> Cross-site Proxy to <"+t+">"),e.proxyUsed=!0;var r=this.store,i=e.req;e.noMeta||(r.add(i,this.ns.link("redirectedTo"),r.rdfFactory.namedNode(t),i),this.addStatus(i,"redirected to new request")),this.requested[e.resource.value]="redirected",this.redirectedTo[e.resource.value]=t;var o=Object.assign({},e);return o.baseURI=e.resource.value,this.fetchUri(t,o).then((function(t){return o.noMeta||r.add(i,n.ns.link("redirectedRequest"),o.req,n.appNode),t}))}},{key:"setRequestTimeout",value:function(t,e){var n=this;return new Promise((function(r){n.timeouts[t]=(n.timeouts[t]||[]).concat(setTimeout((function(){!n.isPending(t)||e.retriedWithNoCredentials||e.proxyUsed||r(n.failFetch(e,"Request to ".concat(t," timed out"),"timeout"))}),n.timeout))}))}},{key:"addFetchCallback",value:function(t,e){this.fetchCallbacks[t]?this.fetchCallbacks[t].push(e):this.fetchCallbacks[t]=[e]}},{key:"acceptString",value:function(){var t="";for(var e in this.mediatypes)for(var n in""!==t&&(t+=", "),t+=e,this.mediatypes[e])t+=";"+n+"="+this.mediatypes[e][n];return t}}],[{key:"crossSiteProxy",value:function(e){return t.crossSiteProxyTemplate?t.crossSiteProxyTemplate.replace("{uri}",encodeURIComponent(e)):void 0}},{key:"offlineOverride",value:function(t){var e,n=t;return"undefined"!=typeof window&&window.panes&&(e=window.panes.UI)&&e.preferences&&e.preferences.get("offlineModeUsingLocalhost")&&"http://"===n.slice(0,7)&&"localhost/"!==n.slice(7,17)&&(n="http://localhost/"+n.slice(7),uc("Localhost kludge for offline use: actually getting <"+n+">")),n}},{key:"proxyIfNecessary",value:function(e){var n;if("undefined"!=typeof window&&window.panes&&(n=window.panes.UI)&&n.isExtension)return e;if("undefined"!=typeof $SolidTestEnvironment&&$SolidTestEnvironment.localSiteMap){var r=function t(e,n){var r=n[e.shift()];return r?"string"==typeof r?r+e.join("/"):e?t(e,r):null:null}(e.split("/").slice(2),$SolidTestEnvironment.localSiteMap);if(r)return r}return t.crossSiteProxyTemplate&&"undefined"!=typeof document&&document.location&&"https:"===(""+document.location).slice(0,6)&&"http:"===e.slice(0,5)?t.crossSiteProxyTemplate.replace("{uri}",encodeURIComponent(e)):e}},{key:"unsupportedProtocol",value:function(t){var e=Qu(t);return"tel"===e||"mailto"===e||"urn"===e}},{key:"setCredentials",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};void 0===e.credentials&&(e.credentials=void 0!==e.withCredentials?e.withCredentials?"include":"omit":"include")}}]),t}();function Kh(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Hh(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Kh(Object(n),!0).forEach((function(e){Ao(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Kh(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}Ao(Jh,"HANDLERS",void 0),Ao(Jh,"CONTENT_TYPE_BY_EXT",void 0),Ao(Jh,"crossSiteProxyTemplate",void 0),Jh.HANDLERS=Lh,Jh.CONTENT_TYPE_BY_EXT=jh;var $h,Wh=Hh(Hh({},vh),{},{fetcher:function(t,e){return new Jh(t,e)},graph:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return new Kc(t,e||{rdfFactory:vh})},lit:function(t,e,n){return this.literal(""+t,e||n)},st:function(t,e,n,r){return this.quad(t,e,n,r)}}),qh={};for($h in Wh)"function"==typeof Wh[$h]&&(qh[$h]=Wh[$h].bind(Wh));var Vh=qh.fetcher,Gh=qh.graph,zh=qh.namedNode;new Cc;var Xh=(t,e)=>{const n=t[e.predicate.uri];return m(y({},t),{[e.predicate.uri]:n?[...n,e.subject.value]:[e.subject.value]})},Yh=(t,e)=>{const n=t[e.predicate.uri];return m(y({},t),{[e.predicate.uri]:n?[...n,e.object.value]:[e.object.value]})},Qh=class{constructor(t,e){this.uri=t,this.store=e}label(){const t=this.anyValue("http://www.w3.org/2006/vcard/ns#fn","http://xmlns.com/foaf/0.1/name","http://xmlns.com/foaf/0.1/nick","https://schema.org/name","http://schema.org/name","http://purl.org/dc/terms/title","http://purl.org/dc/elements/1.1/title","http://www.w3.org/2000/01/rdf-schema#label","https://www.w3.org/ns/activitystreams#name","http://schema.org/caption","https://schema.org/caption");return null!=t?t:this.uri}literals(){const t=this.store.statementsMatching(zh(this.uri)).filter((t=>rs(t.object))).reduce(Yh,{});return Object.keys(t).map((e=>({predicate:e,values:t[e]})))}relations(){const t=this.store.statementsMatching(zh(this.uri)).filter((t=>os(t.object)&&!t.predicate.sameTerm(zh("http://www.w3.org/1999/02/22-rdf-syntax-ns#type")))).reduce(Yh,{});return Object.keys(t).map((e=>({predicate:e,uris:t[e]})))}reverseRelations(){const t=this.store.statementsMatching(void 0,void 0,zh(this.uri)).reduce(Xh,{});return Object.keys(t).map((e=>({predicate:e,uris:t[e]})))}anyValue(...t){let e;return t.some((t=>(e=this.store.anyValue(zh(this.uri),zh(t)),Boolean(e)))),e}description(){return this.anyValue("http://purl.org/dc/terms/description","http://purl.org/dc/elements/1.1/description","http://schema.org/description","https://schema.org/description","https://schema.org/text","http://www.w3.org/2000/01/rdf-schema#comment","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#content","http://www.w3.org/2006/vcard/ns#note")}picture(){const t=this.anyValue("http://schema.org/image","https://schema.org/image","http://schema.org/logo","https://schema.org/logo","http://www.w3.org/2006/vcard/ns#hasPhoto","http://www.w3.org/2006/vcard/ns#photo","http://www.w3.org/2006/vcard/ns#hasLogo","http://www.w3.org/2006/vcard/ns#logo","http://xmlns.com/foaf/0.1/img","http://xmlns.com/foaf/0.1/depiction","http://xmlns.com/foaf/0.1/thumbnail");return t?{url:t}:this.findActivityStreamsPicture()}findActivityStreamsPicture(){const t=this.store.any(zh(this.uri),zh("https://www.w3.org/ns/activitystreams#image"))||this.store.any(zh(this.uri),zh("https://www.w3.org/ns/activitystreams#icon"));if(!(t&&(e=t,ns(e)&&"termType"in e&&"BlankNode"===e.termType||os(t))))return null;var e;const n=this.store.anyValue(t,zh("https://www.w3.org/ns/activitystreams#url"));return n?{url:n}:null}types(){const t=this.store.findTypeURIs(zh(this.uri));return Object.keys(t).map((t=>{return{uri:t,label:(e=t,e.includes("#")?e.substring(e.lastIndexOf("#")+1):e.substring(e.lastIndexOf("/")+1))};var e}))}assume(t){return new t(this.uri,this.store)}},Zh=class extends Qh{constructor(t,e){super(t,e),this.uri=t,this.store=e}subjects(){const t=this.store.statementsMatching(null,null,null,zh(this.uri)).filter((t=>os(t.subject))).map((t=>t.subject.value)),e=new Set(t);return e.delete(this.uri),[...e].map((t=>({uri:t})))}},tf=class{constructor(){this.session=new class{get authenticatedFetch(){return this._authenticatedFetch}constructor(){this.session=new wo.Session,this._authenticatedFetch=this.session.fetch}handleIncomingRedirect(){return k(this,null,(function*(){return this.session.handleIncomingRedirect({restorePreviousSession:!1})}))}login(t){return k(this,null,(function*(){return this.session.login({oidcIssuer:t,redirectUrl:window.location.href,clientName:`Pod OS at ${window.location.host}`})}))}logout(){return k(this,null,(function*(){return this.session.logout()}))}trackSession(t){this.session.onLogin((()=>t(this.session.info))),this.session.onLogout((()=>t(this.session.info))),this.session.onSessionRestore((()=>t(this.session.info))),t(this.session.info)}},this.store=new class{constructor(t){this.graph=Gh(),this.fetcher=Vh(this.graph,{fetch:t.authenticatedFetch})}fetch(t){return this.fetcher.load(zh(t),{force:!0})}get(t){return new Qh(t,this.graph)}}(this.session),this.fileFetcher=new class{constructor(t){this.session=t}fetchFile(t){return k(this,null,(function*(){const e=yield this.session.authenticatedFetch(t);if(e.ok){const n=yield e.blob();return new class{constructor(t,e){this.url=t,this.data=e}blob(){return this.data}}(t,n)}return new class{constructor(t,e){this.url=t,this.status=e}toString(){return`${this.status.toString()} - ${this.url}`}blob(){return null}}(t,new class{constructor(t,e){this.code=t,this.text=e}toString(){return this.text?`${this.code} - ${this.text}`:this.code.toString()}}(e.status,e.statusText))}))}}(this.session)}handleIncomingRedirect(){this.session.handleIncomingRedirect()}fetch(t){return this.store.fetch(t)}fetchFile(t){return this.fileFetcher.fetchFile(t)}trackSession(t){return this.session.trackSession(t)}logout(){return this.session.logout()}login(t="http://localhost:3000"){return this.session.login(t)}};
|
|
8
|
+
/*! Bundled license information:
|
|
9
|
+
|
|
10
|
+
@inrupt/oidc-client/lib/oidc-client.min.js:
|
|
11
|
+
(*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
|
|
12
|
+
*)
|
|
13
|
+
(*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval
|
|
14
|
+
*)
|
|
15
|
+
(*!
|
|
16
|
+
* The buffer module from node.js, for the browser.
|
|
17
|
+
*
|
|
18
|
+
* @author Feross Aboukhadijeh <http://feross.org>
|
|
19
|
+
* @license MIT
|
|
20
|
+
*)
|
|
21
|
+
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
22
|
+
|
|
23
|
+
rdf-canonize/lib/MessageDigest-browser.js:
|
|
24
|
+
(*!
|
|
25
|
+
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
26
|
+
*)
|
|
27
|
+
|
|
28
|
+
rdf-canonize/lib/Permuter.js:
|
|
29
|
+
(*!
|
|
30
|
+
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
31
|
+
*)
|
|
32
|
+
|
|
33
|
+
rdf-canonize/lib/NQuads.js:
|
|
34
|
+
(*!
|
|
35
|
+
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
36
|
+
*)
|
|
37
|
+
|
|
38
|
+
rdf-canonize/lib/URDNA2015.js:
|
|
39
|
+
(*!
|
|
40
|
+
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
41
|
+
*)
|
|
42
|
+
|
|
43
|
+
rdf-canonize/lib/URGNA2012.js:
|
|
44
|
+
(*!
|
|
45
|
+
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
46
|
+
*)
|
|
47
|
+
|
|
48
|
+
rdf-canonize/lib/URDNA2015Sync.js:
|
|
49
|
+
(*!
|
|
50
|
+
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
51
|
+
*)
|
|
52
|
+
|
|
53
|
+
rdf-canonize/lib/URGNA2012Sync.js:
|
|
54
|
+
(*!
|
|
55
|
+
* Copyright (c) 2016-2021 Digital Bazaar, Inc. All rights reserved.
|
|
56
|
+
*)
|
|
57
|
+
|
|
58
|
+
jsonld/lib/context.js:
|
|
59
|
+
(* disallow aliasing @context and @preserve *)
|
|
60
|
+
|
|
61
|
+
jsonld/lib/frame.js:
|
|
62
|
+
(* remove @preserve from results *)
|
|
63
|
+
(**
|
|
64
|
+
* Removes the @preserve keywords from expanded result of framing.
|
|
65
|
+
*
|
|
66
|
+
* @param input the framed, framed output.
|
|
67
|
+
* @param options the framing options used.
|
|
68
|
+
*
|
|
69
|
+
* @return the resulting output.
|
|
70
|
+
*)
|
|
71
|
+
(* remove @preserve *)
|
|
72
|
+
|
|
73
|
+
jsonld/lib/jsonld.js:
|
|
74
|
+
(**
|
|
75
|
+
* A JavaScript implementation of the JSON-LD API.
|
|
76
|
+
*
|
|
77
|
+
* @author Dave Longley
|
|
78
|
+
*
|
|
79
|
+
* @license BSD 3-Clause License
|
|
80
|
+
* Copyright (c) 2011-2019 Digital Bazaar, Inc.
|
|
81
|
+
* All rights reserved.
|
|
82
|
+
*
|
|
83
|
+
* Redistribution and use in source and binary forms, with or without
|
|
84
|
+
* modification, are permitted provided that the following conditions are met:
|
|
85
|
+
*
|
|
86
|
+
* Redistributions of source code must retain the above copyright notice,
|
|
87
|
+
* this list of conditions and the following disclaimer.
|
|
88
|
+
*
|
|
89
|
+
* Redistributions in binary form must reproduce the above copyright
|
|
90
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
91
|
+
* documentation and/or other materials provided with the distribution.
|
|
92
|
+
*
|
|
93
|
+
* Neither the name of the Digital Bazaar, Inc. nor the names of its
|
|
94
|
+
* contributors may be used to endorse or promote products derived from
|
|
95
|
+
* this software without specific prior written permission.
|
|
96
|
+
*
|
|
97
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
|
98
|
+
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
99
|
+
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
100
|
+
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
101
|
+
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
102
|
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
|
103
|
+
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
104
|
+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
105
|
+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
106
|
+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
107
|
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
108
|
+
*)
|
|
109
|
+
|
|
110
|
+
queue-microtask/index.js:
|
|
111
|
+
(*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
112
|
+
|
|
113
|
+
@babel/runtime/helpers/regeneratorRuntime.js:
|
|
114
|
+
(*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE *)
|
|
115
|
+
*/
|
|
116
|
+
export{tf as P,Zh as R}
|